-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy path_fields.scss
More file actions
389 lines (298 loc) Β· 7.65 KB
/
Copy path_fields.scss
File metadata and controls
389 lines (298 loc) Β· 7.65 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
.field {
@apply text-sm appearance-none bg-white border border-gray-300 rounded text-gray-700 leading-normal outline-none w-full px-2 py-1;
transition: all 0.3s $transition-effect;
@screen md { @apply text-base px-3 py-2; }
@include input-placeholder {
@apply text-gray-500;
opacity: 1;
}
&:focus:not([disabled]) {
@apply outline-none shadow-focus;
}
&[readonly] { @apply bg-gray-200; }
&:disabled { opacity: 0.5; }
&--title {
@apply font-bold text-xl py-3;
&:hover { @apply bg-gray-200; }
&.field--success {
@apply bg-success-100;
&:focus:not([disabled]) { @apply bg-success-100; }
}
&.field--danger {
@apply bg-danger-100;
&:focus:not([disabled]) { @apply bg-danger-100; }
}
}
&--input {}
&--textarea {}
&--xs {
@apply text-xs px-1 py-1;
}
&--sm {
@apply text-sm px-2 py-1;
}
&--lg {
@apply text-lg px-6 py-3;
}
&--success {
@apply border-success-500;
&:focus:not([disabled]) {
@apply border-success-300 shadow-focus-success;
}
}
&--danger {
@apply border-danger-500;
&:focus:not([disabled]) {
@apply border-danger-300 shadow-focus-danger;
}
}
}
.field-password {
@apply relative;
&__button {
@apply absolute;
top: 50%;
right: rem(4px);
transform: translateY(-50%);
}
}
.field-number {
@apply flex items-center text-center w-full;
&__button { @apply flex-shrink-0; }
&__input {
@apply flex-auto flex-shrink text-center;
-moz-appearance: textfield;
&::-webkit-outer-spin-button,
&::-webkit-inner-spin-button {
-webkit-appearance: none;
margin: 0;
}
}
}
.field-select {
@apply flex justify-between items-center px-3 py-2;
&--sm {
@apply p-1;
}
&--bordered {
@apply border;
}
&--readonly {
opacity: 1!important;
}
&__placeholder {
@apply text-gray-500;
}
&__selected {
&--multiple { @apply -my-1; }
}
&__list {
@apply flex flex-wrap list-none p-0 m-0 -mb-1;
}
&__item {
@apply mb-1 mr-1;
}
&__arrow { @apply text-xs; }
}
.field-dropdown {
@apply bg-gray-100 border border-gray-300 rounded shadow-md text-gray-700 leading-normal w-full py-3 z-10;
margin: rem(3px) 0;
&__search {
@apply px-3 mb-2;
}
&__controls {
@apply mb-2 px-3 text-gray-600 text-sm;
}
&__group {
@extend %no-bottom;
}
&__options {
max-height: rem(385px);
overflow-y: auto;
&--list {
@apply list-none p-0 m-0;
}
&--check { @apply px-3; }
}
&__option {
&:not(.field-check) { @apply p-3; }
&:hover:not(.field-check),
&--highlighted:not(.field-check) { @apply bg-gray-200; }
&--selected:not(.field-check) { @apply bg-gray-300; }
}
&__empty {
@apply text-center px-3;
}
}
.field-upload {
&__label {
@apply inline-block;
cursor: pointer;
&:hover {
@apply bg-primary-700 border-primary-700;
}
* { pointer-events: none; }
}
&__input {
width: 0.1px;
height: 0.1px;
opacity: 0;
overflow: hidden;
position: absolute;
z-index: -1;
&:focus + label {
@apply outline-none shadow-focus;
}
&:active + label {
@apply bg-primary-900 border-primary-900;
}
}
}
.field-upload-list {
@apply list-none p-0 m-0 mt-3 w-full;
&__item {
@apply flex items-center mb-4 w-full;
&:last-child { @apply mb-0; }
.button { @apply flex-shrink-0 mr-3; }
}
&__file { @apply inline-block; }
}
.field-check {
@apply flex relative leading-normal mb-2;
&--inline {
@apply inline-flex items-center mr-2;
}
&__input {
@apply inline-block flex-shrink-0 opacity-0 mr-2;
width: rem(20px);
& + .field-check__label::after { content: none; }
&:checked + .field-check__label {
&:before {
@apply bg-primary-500 border-primary-500;
}
&:after {
content: '';
.field-check--checkbox & { @apply border-white; }
.field-check--radio & { @apply bg-white; }
}
}
&:indeterminate + .field-check__label {
.field-check--checkbox & {
&:before {
@apply bg-gray-200;
}
&:after {
@apply border-gray-500 border-l-0;
content: '';
transform: rotate(0deg);
}
}
}
&:focus + .field-check__label::before { @apply shadow-focus; }
&[disabled] + .field-check__label {
@apply text-gray-500;
&:before,
&:after { opacity: 0.5; }
}
}
&__label {
display: inline-block;
@extend %no-bottom;
&:before,
&:after { @apply absolute inline-block; }
&:before{
@apply bg-white border border-gray-500;
content: '';
left: 0;
top: rem(3px);
height: rem(20px);
width: rem(20px);
.field-check--checkbox & { @apply rounded; }
.field-check--radio & { @apply rounded-full; }
}
&:after {
@apply border-gray-500 border-0;
content: '';
.field-check--checkbox & {
left: rem(6px);
top: rem(9px);
height: rem(6px);
width: rem(9px);
border-left: 2px solid;
border-bottom: 2px solid;
transform: rotate(-45deg);
}
.field-check--radio & {
@apply bg-white rounded-full;
left: rem(5px);
top: rem(8px);
height: rem(10px);
width: rem(10px);
}
}
}
}
// TO-DO: Toggle component
.field__toggle {
@apply cursor-pointer opacity-0 absolute w-full h-full z-10;
}
.toggle {
&__wrap {
@apply
border-gray-300
cursor-pointer
flex-shrink-0
rounded-full
inline-flex
relative
border-2
w-10
h-6
;
&.toggle__wrap--checked {
@apply
border-success-500
;
}
&:focus-within {
@apply
outline-none
shadow-focus
;
}
&:before {
@apply
inline-block
rounded-full
bg-gray-300
h-full
w-full
;
content: "";
transition: background-color 0.2s ease;
}
&:after {
@apply
rounded-full
absolute
bg-white
left-0
top-0
h-5
w-5
;
content: "";
transform: translateX(0);
transition: transform 0.2s ease;
}
&--checked:before {
@apply
bg-success-500
;
transition: border-color 0.2s ease;
}
&--checked:after {
transform: translateX(rem(15px));
}
}
}