UNPKG

3.82 kBSCSSView Raw
1/**Variable**/
2@import './helpers/mixin.scss';
3@import './base/common.scss';
4
5/*checkbox-group*/
6.vxe-checkbox-group {
7 display: inline-block;
8 vertical-align: middle;
9 line-height: 1;
10}
11
12/*checkbox*/
13.vxe-checkbox {
14 display: inline-block;
15 vertical-align: middle;
16 white-space: nowrap;
17 user-select: none;
18 line-height: 1;
19 cursor: pointer;
20 color: $vxe-font-color;
21 &+.vxe-checkbox {
22 margin-left: 10px;
23 }
24 > input {
25 &[type="checkbox"] {
26 position: absolute;
27 width: 0;
28 height: 0;
29 border: 0;
30 appearance: none;
31 }
32 &+.vxe-checkbox--icon {
33 position: relative;
34 display: inline-block;
35 width: 1em;
36 height: 1em;
37 background-color: $vxe-checkbox-icon-background-color;
38 vertical-align: middle;
39 border-radius: $vxe-checkbox-border-radius;
40 border: $vxe-checkbox-border-width solid $vxe-input-border-color;
41 &:before {
42 content: "";
43 position: absolute;
44 }
45 }
46 &:checked+.vxe-checkbox--icon {
47 background-color: $vxe-primary-color;
48 border-color: $vxe-primary-color;
49 &:before {
50 height: $vxe-checkbox-checked-height;
51 width: $vxe-checkbox-checked-width;
52 left: 50%;
53 top: 50%;
54 border: $vxe-checkbox-border-width solid $vxe-checkbox-checked-icon-border-color;
55 border-left: 0;
56 border-top: 0;
57 transform: translate(-50%, -50%) rotate(45deg);
58 }
59 &+.vxe-checkbox--label {
60 color: $vxe-primary-color;
61 }
62 }
63 }
64 &.is--indeterminate {
65 > input {
66 &:not(:checked) {
67 &+.vxe-checkbox--icon {
68 background-color: $vxe-primary-color;
69 border-color: $vxe-primary-color;
70 &:before {
71 border: 0;
72 left: 50%;
73 top: 50%;
74 height: $vxe-checkbox-indeterminate-height;
75 width: $vxe-checkbox-indeterminate-width;
76 background-color: $vxe-checkbox-indeterminate-icon-background-color;
77 transform: translate(-50%, -50%);
78 }
79 }
80 }
81 }
82 }
83 &:not(.is--disabled) {
84 & > input {
85 &:focus {
86 &+.vxe-checkbox--icon {
87 border-color: $vxe-primary-color;
88 box-shadow: 0 0 0.2em 0 $vxe-primary-color;
89 }
90 }
91 }
92 &:hover {
93 > input {
94 &+.vxe-checkbox--icon {
95 border-color: $vxe-primary-color;
96 }
97 }
98 }
99 }
100 &.is--disabled {
101 cursor: not-allowed;
102 > input {
103 &+.vxe-checkbox--icon {
104 border-color: $vxe-input-disabled-color;
105 background-color: $vxe-input-disabled-background-color;
106 &:before {
107 border-color: $vxe-primary-disabled-color;
108 }
109 &+.vxe-checkbox--label {
110 color: $vxe-disabled-color;
111 }
112 }
113 &:checked+.vxe-checkbox--icon {
114 border-color: $vxe-input-disabled-color;
115 background-color: $vxe-input-disabled-background-color;
116 }
117 }
118 }
119 .vxe-checkbox--label {
120 padding-left: 0.5em;
121 vertical-align: middle;
122 display: inline-block;
123 max-width: 50em;
124 @extend %TextEllipsis;
125 }
126}
127
128.vxe-checkbox {
129 font-size: $vxe-font-size;
130 .vxe-checkbox--icon {
131 font-size: $vxe-checkbox-font-size-default;
132 }
133 &.size--medium {
134 font-size: $vxe-font-size-medium;
135 .vxe-checkbox--icon {
136 font-size: $vxe-checkbox-font-size-medium;
137 }
138 }
139 &.size--small {
140 font-size: $vxe-font-size-small;
141 .vxe-checkbox--icon {
142 font-size: $vxe-checkbox-font-size-small;
143 }
144 }
145 &.size--mini {
146 font-size: $vxe-font-size-mini;
147 .vxe-checkbox--icon {
148 font-size: $vxe-checkbox-font-size-mini;
149 }
150 }
151}
\No newline at end of file