UNPKG

6.43 kBtext/lessView Raw
1@select-prefix: ~'rc-select';
2
3* {
4 box-sizing: border-box;
5}
6
7.search-input-without-border() {
8 .@{select-prefix}-selection-search-input {
9 border: none;
10 outline: none;
11 background: rgba(255, 0, 0, 0.2);
12 width: 100%;
13 }
14}
15
16.@{select-prefix} {
17 display: inline-block;
18 font-size: 12px;
19 width: 100px;
20 position: relative;
21
22 &-disabled {
23 &,
24 & input {
25 cursor: not-allowed;
26 }
27
28 .@{select-prefix}-selector {
29 opacity: 0.3;
30 }
31 }
32
33 &-show-arrow&-loading {
34 .@{select-prefix}-arrow {
35 &-icon::after {
36 box-sizing: border-box;
37 width: 12px;
38 height: 12px;
39 border-radius: 100%;
40 border: 2px solid #999;
41 border-top-color: transparent;
42 border-bottom-color: transparent;
43 transform: none;
44 margin-top: 4px;
45
46 animation: rcSelectLoadingIcon 0.5s infinite;
47 }
48 }
49 }
50
51 // ============== Selector ===============
52 .@{select-prefix}-selection-placeholder {
53 opacity: 0.4;
54 }
55
56 // --------------- Single ----------------
57 &-single {
58 .@{select-prefix}-selector {
59 display: flex;
60 position: relative;
61
62 .@{select-prefix}-selection-search {
63 width: 100%;
64
65 &-input {
66 width: 100%;
67 }
68 }
69
70 .@{select-prefix}-selection-item,
71 .@{select-prefix}-selection-placeholder {
72 position: absolute;
73 top: 1px;
74 left: 3px;
75 pointer-events: none;
76 }
77 }
78
79 // Not customize
80 &:not(.@{select-prefix}-customize-input) {
81 .@{select-prefix}-selector {
82 padding: 1px;
83 border: 1px solid #000;
84
85 .search-input-without-border();
86 }
87 }
88 }
89
90 // -------------- Multiple ---------------
91 &-multiple .@{select-prefix}-selector {
92 display: flex;
93 flex-wrap: wrap;
94 padding: 1px;
95 border: 1px solid #000;
96
97 .@{select-prefix}-selection-item {
98 flex: none;
99 background: #bbb;
100 border-radius: 4px;
101 margin-right: 2px;
102 padding: 0 8px;
103
104 &-disabled {
105 cursor: not-allowed;
106 opacity: 0.5;
107 }
108 }
109
110 .@{select-prefix}-selection-search {
111 position: relative;
112
113 &-input,
114 &-mirror {
115 padding: 1px;
116 font-family: system-ui;
117 }
118
119 &-mirror {
120 position: absolute;
121 z-index: 999;
122 white-space: nowrap;
123 position: none;
124 left: 0;
125 top: 0;
126 visibility: hidden;
127 }
128 }
129
130 .search-input-without-border();
131 }
132
133 // ================ Icons ================
134 &-allow-clear {
135 &.@{select-prefix}-multiple .@{select-prefix}-selector {
136 padding-right: 20px;
137 }
138
139 .@{select-prefix}-clear {
140 position: absolute;
141 right: 20px;
142 top: 0;
143 }
144 }
145
146 &-show-arrow {
147 &.@{select-prefix}-multiple .@{select-prefix}-selector {
148 padding-right: 20px;
149 }
150
151 .@{select-prefix}-arrow {
152 pointer-events: none;
153 position: absolute;
154 right: 5px;
155 top: 0;
156
157 &-icon::after {
158 content: '';
159 border: 5px solid transparent;
160 width: 0;
161 height: 0;
162 display: inline-block;
163 border-top-color: #999;
164 transform: translateY(5px);
165 }
166 }
167 }
168
169 // =============== Focused ===============
170 &-focused {
171 .@{select-prefix}-selector {
172 border-color: blue !important;
173 }
174 }
175
176 // ============== Dropdown ===============
177 &-dropdown {
178 border: 1px solid green;
179 min-height: 100px;
180 position: absolute;
181 background: #fff;
182
183 &-hidden {
184 display: none;
185 }
186 }
187
188 // =============== Option ================
189 &-item {
190 font-size: 16px;
191 line-height: 1.5;
192 padding: 4px 16px;
193
194 // >>> Group
195 &-group {
196 color: #999;
197 font-weight: bold;
198 font-size: 80%;
199 }
200
201 // >>> Option
202 &-option {
203 position: relative;
204
205 &-grouped {
206 padding-left: 24px;
207 }
208
209 .@{select-prefix}-item-option-state {
210 position: absolute;
211 right: 0;
212 top: 4px;
213 pointer-events: none;
214 }
215
216 // ------- Active -------
217 &-active {
218 background: green;
219 }
220
221 // ------ Disabled ------
222 &-disabled {
223 color: #999;
224 }
225 }
226
227 // >>> Empty
228 &-empty {
229 text-align: center;
230 color: #999;
231 }
232 }
233}
234
235.@{select-prefix}-selection__choice-zoom {
236 transition: all 0.3s;
237}
238
239.@{select-prefix}-selection__choice-zoom-appear {
240 opacity: 0;
241 transform: scale(0.5);
242
243 &&-active {
244 opacity: 1;
245 transform: scale(1);
246 }
247}
248.@{select-prefix}-selection__choice-zoom-leave {
249 opacity: 1;
250 transform: scale(1);
251
252 &&-active {
253 opacity: 0;
254 transform: scale(0.5);
255 }
256}
257
258.effect() {
259 animation-duration: 0.3s;
260 animation-fill-mode: both;
261 transform-origin: 0 0;
262}
263
264.@{select-prefix}-dropdown {
265 &-slide-up-enter,
266 &-slide-up-appear {
267 .effect();
268 opacity: 0;
269 animation-timing-function: cubic-bezier(0.08, 0.82, 0.17, 1);
270 animation-play-state: paused;
271 }
272
273 &-slide-up-leave {
274 .effect();
275 opacity: 1;
276 animation-timing-function: cubic-bezier(0.6, 0.04, 0.98, 0.34);
277 animation-play-state: paused;
278 }
279
280 &-slide-up-enter&-slide-up-enter-active&-placement-bottomLeft,
281 &-slide-up-appear&-slide-up-appear-active&-placement-bottomLeft {
282 animation-name: rcSelectDropdownSlideUpIn;
283 animation-play-state: running;
284 }
285
286 &-slide-up-leave&-slide-up-leave-active&-placement-bottomLeft {
287 animation-name: rcSelectDropdownSlideUpOut;
288 animation-play-state: running;
289 }
290
291 &-slide-up-enter&-slide-up-enter-active&-placement-topLeft,
292 &-slide-up-appear&-slide-up-appear-active&-placement-topLeft {
293 animation-name: rcSelectDropdownSlideDownIn;
294 animation-play-state: running;
295 }
296
297 &-slide-up-leave&-slide-up-leave-active&-placement-topLeft {
298 animation-name: rcSelectDropdownSlideDownOut;
299 animation-play-state: running;
300 }
301}
302
303@keyframes rcSelectDropdownSlideUpIn {
304 0% {
305 opacity: 0;
306 transform-origin: 0% 0%;
307 transform: scaleY(0);
308 }
309 100% {
310 opacity: 1;
311 transform-origin: 0% 0%;
312 transform: scaleY(1);
313 }
314}
315@keyframes rcSelectDropdownSlideUpOut {
316 0% {
317 opacity: 1;
318 transform-origin: 0% 0%;
319 transform: scaleY(1);
320 }
321 100% {
322 opacity: 0;
323 transform-origin: 0% 0%;
324 transform: scaleY(0);
325 }
326}
327
328@keyframes rcSelectLoadingIcon {
329 0% {
330 transform: rotate(0);
331 }
332 100% {
333 transform: rotate(360deg);
334 }
335}