UNPKG

4.99 kBSCSSView Raw
1/**Variable**/
2@import './helpers/mixin.scss';
3@import './base/common.scss';
4
5/*radio-group*/
6.vxe-radio-group {
7 display: inline-block;
8 vertical-align: middle;
9 line-height: 1;
10 font-size: 0;
11 &+.vxe-radio-group {
12 margin-left: 10px;
13 }
14}
15
16/*radio*/
17.vxe-radio {
18 display: inline-block;
19 vertical-align: middle;
20 white-space: nowrap;
21 user-select: none;
22 line-height: 1;
23 cursor: pointer;
24 color: $vxe-font-color;
25 > input {
26 &[type="radio"] {
27 position: absolute;
28 width: 0;
29 height: 0;
30 border: 0;
31 appearance: none;
32 }
33 &+.vxe-radio--icon {
34 position: relative;
35 display: inline-block;
36 width: 1em;
37 height: 1em;
38 border: $vxe-radio-border-width solid $vxe-input-border-color;
39 background-color: $vxe-radio-icon-background-color;
40 vertical-align: middle;
41 border-radius: 50%;
42 }
43 &:checked+.vxe-radio--icon {
44 background-color: $vxe-primary-color;
45 border-color: $vxe-primary-color;
46 &:before {
47 content: "";
48 position: absolute;
49 background-color: $vxe-radio-checked-icon-background-color;
50 border-radius: 50%;
51 height: 0.25em;
52 width: 0.25em;
53 top: 50%;
54 left: 50%;
55 transform: translate(-50%,-50%);
56 }
57 &+.vxe-radio--label {
58 color: $vxe-primary-color;
59 }
60 }
61 }
62 &:not(.is--disabled) {
63 & > input {
64 &:focus {
65 &+.vxe-radio--icon {
66 border-color: $vxe-primary-color;
67 box-shadow: 0 0 0.2em 0 $vxe-primary-color;
68 }
69 }
70 }
71 &:hover {
72 > input {
73 &+.vxe-radio--icon {
74 border-color: $vxe-primary-color;
75 }
76 }
77 }
78 }
79 &.is--disabled {
80 cursor: not-allowed;
81 > input {
82 &+.vxe-radio--icon {
83 border-color: $vxe-input-disabled-color;
84 background-color: $vxe-input-disabled-background-color;
85 &:before {
86 border-color: $vxe-primary-disabled-color;
87 background-color: $vxe-primary-disabled-color;
88 }
89 &+.vxe-radio--label {
90 color: $vxe-disabled-color;
91 }
92 }
93 }
94 }
95 .vxe-radio--label {
96 padding-left: 0.5em;
97 vertical-align: middle;
98 display: inline-block;
99 max-width: 50em;
100 @extend %TextEllipsis;
101 }
102 &:not(.vxe-radio-button) {
103 &+.vxe-radio {
104 margin-left: 10px;
105 }
106 }
107}
108
109.vxe-radio-button {
110 .vxe-radio--label {
111 background-color: $vxe-radio-button-default-background-color;
112 }
113 &:first-child {
114 .vxe-radio--label {
115 border-left: 1px solid $vxe-input-border-color;
116 border-radius: $vxe-border-radius 0 0 $vxe-border-radius;
117 }
118 }
119 &:last-child {
120 .vxe-radio--label {
121 border-radius: 0 $vxe-border-radius $vxe-border-radius 0;
122 }
123 }
124 > input {
125 &:checked+.vxe-radio--label {
126 color: #fff;
127 background-color: $vxe-primary-color;
128 border-color: $vxe-primary-color;
129 }
130 }
131 .vxe-radio--label {
132 padding: 0 1em;
133 line-height: $vxe-button-height-default - 2;
134 display: inline-block;
135 border-style: solid;
136 border-color: $vxe-input-border-color;
137 border-width: 1px 1px 1px 0;
138 max-width: 50em;
139 @extend %TextEllipsis;
140 }
141 &.is--disabled {
142 cursor: not-allowed;
143 > input {
144 &:not(:checked) {
145 &+.vxe-radio--label {
146 color: $vxe-input-disabled-color;
147 }
148 }
149 &:checked {
150 &+.vxe-radio--label {
151 border-color: lighten($vxe-primary-color, 20%);
152 background-color: lighten($vxe-primary-color, 20%);
153 }
154 }
155 }
156 }
157 &:not(.is--disabled) {
158 & > input {
159 &:focus {
160 &+.vxe-radio--label {
161 border-color: $vxe-primary-color;
162 box-shadow: 0 0 0.2em 0 $vxe-primary-color;
163 }
164 }
165 }
166 &:hover {
167 > input {
168 &:not(:checked) {
169 &+.vxe-radio--label {
170 color: $vxe-primary-color;
171 }
172 }
173 }
174 }
175 }
176 &.size--medium {
177 .vxe-radio--label {
178 line-height: $vxe-button-height-medium - 2;
179 }
180 }
181 &.size--small {
182 .vxe-radio--label {
183 line-height: $vxe-button-height-small - 2;
184 }
185 }
186 &.size--mini {
187 .vxe-radio--label {
188 line-height: $vxe-button-height-mini - 2;
189 }
190 }
191}
192
193.vxe-radio {
194 font-size: $vxe-font-size;
195 .vxe-radio--icon {
196 font-size: $vxe-radio-font-size-default;
197 }
198 &.size--medium {
199 font-size: $vxe-font-size-medium;
200 .vxe-radio--icon {
201 font-size: $vxe-radio-font-size-medium;
202 }
203 }
204 &.size--small {
205 font-size: $vxe-font-size-small;
206 .vxe-radio--icon {
207 font-size: $vxe-radio-font-size-small;
208 }
209 }
210 &.size--mini {
211 font-size: $vxe-font-size-mini;
212 .vxe-radio--icon {
213 font-size: $vxe-radio-font-size-mini;
214 }
215 }
216}
\No newline at end of file