@mt-gloss/styles 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,753 @@
1
+ // ============================================
2
+ // COMPONENT: SELECTION (CHECKBOX & TOGGLE)
3
+ // ============================================
4
+
5
+ @use '../tokens' as *;
6
+ @use '../mixins' as *;
7
+
8
+ // --- CHECKBOX ---
9
+
10
+ // Wrapper for checkbox + helper text
11
+ .gloss-checkbox-wrapper {
12
+ display: flex;
13
+ flex-direction: column;
14
+ gap: $space-1;
15
+ }
16
+
17
+ .gloss-checkbox {
18
+ display: flex;
19
+ align-items: center;
20
+ gap: $space-3;
21
+ cursor: pointer;
22
+ user-select: none;
23
+ position: relative;
24
+
25
+ &:hover .gloss-checkbox__control {
26
+ border-color: $alias-border-hover;
27
+ @include shadow-elevation-hover;
28
+ transform: translateY(-1px);
29
+ }
30
+
31
+ // Disabled state
32
+ &--disabled {
33
+ cursor: not-allowed;
34
+ opacity: 0.6;
35
+
36
+ &:hover .gloss-checkbox__control {
37
+ transform: none;
38
+ box-shadow: $shadow-input-disabled;
39
+ }
40
+ }
41
+
42
+ // Label position
43
+ &--label-left {
44
+ flex-direction: row-reverse;
45
+ }
46
+
47
+ // Size variants
48
+ &--sm {
49
+ gap: $space-2;
50
+
51
+ .gloss-checkbox__control {
52
+ width: 16px;
53
+ height: 16px;
54
+
55
+ svg {
56
+ width: 10px;
57
+ }
58
+ }
59
+
60
+ .gloss-checkbox__label {
61
+ font-size: $text-sm;
62
+ }
63
+ }
64
+
65
+ &--md {
66
+ // Default size - no changes needed
67
+ }
68
+
69
+ &--lg {
70
+ gap: $space-4;
71
+
72
+ .gloss-checkbox__control {
73
+ width: 24px;
74
+ height: 24px;
75
+
76
+ svg {
77
+ width: 14px;
78
+ }
79
+ }
80
+
81
+ .gloss-checkbox__label {
82
+ font-size: $text-lg;
83
+ }
84
+ }
85
+
86
+ // Status variants
87
+ &--success {
88
+ .gloss-checkbox__control {
89
+ border-color: $alias-border-success;
90
+ }
91
+
92
+ .gloss-checkbox__input:checked ~ .gloss-checkbox__control {
93
+ background: $color-green-600;
94
+ border-color: $color-green-600;
95
+ }
96
+ }
97
+
98
+ &--error {
99
+ .gloss-checkbox__control {
100
+ border-color: $alias-border-error;
101
+ }
102
+
103
+ .gloss-checkbox__input:checked ~ .gloss-checkbox__control {
104
+ background: $color-red-600;
105
+ border-color: $color-red-600;
106
+ }
107
+ }
108
+ }
109
+
110
+ .gloss-checkbox__input {
111
+ position: absolute;
112
+ opacity: 0;
113
+ width: 0;
114
+ height: 0;
115
+
116
+ &:focus-visible ~ .gloss-checkbox__control {
117
+ border-color: $alias-border-focus;
118
+ @include shadow-input-focus;
119
+ }
120
+
121
+ &:checked ~ .gloss-checkbox__control {
122
+ background: $alias-primary;
123
+ border-color: $alias-primary;
124
+
125
+ svg {
126
+ opacity: 1;
127
+ transform: scale(1);
128
+ }
129
+ }
130
+
131
+ &:indeterminate ~ .gloss-checkbox__control {
132
+ background: $alias-primary;
133
+ border-color: $alias-primary;
134
+
135
+ &::after {
136
+ content: '';
137
+ width: 8px;
138
+ height: 2px;
139
+ background: white;
140
+ border-radius: 1px;
141
+ }
142
+ }
143
+
144
+ &:disabled ~ .gloss-checkbox__control {
145
+ background: $alias-bg-disabled;
146
+ border-color: transparent;
147
+ box-shadow: $shadow-input-disabled;
148
+ cursor: not-allowed;
149
+ }
150
+ }
151
+
152
+ .gloss-checkbox__control {
153
+ width: 20px;
154
+ height: 20px;
155
+ border: 1.5px solid $alias-border-default;
156
+ border-radius: $radius-xs;
157
+ background: $color-white;
158
+ display: flex;
159
+ align-items: center;
160
+ justify-content: center;
161
+ transition: all 0.2s;
162
+ flex-shrink: 0;
163
+ @include shadow-input-default;
164
+
165
+ svg {
166
+ width: 12px;
167
+ opacity: 0;
168
+ transform: scale(0.5);
169
+ transition: all 0.2s;
170
+ color: white;
171
+ }
172
+ }
173
+
174
+ .gloss-checkbox__label {
175
+ color: $alias-text-primary;
176
+ font-size: $text-base;
177
+ line-height: 1.4;
178
+ }
179
+
180
+ .gloss-checkbox__required {
181
+ color: $color-red-500;
182
+ }
183
+
184
+ .gloss-checkbox__helper {
185
+ display: flex;
186
+ align-items: center;
187
+ gap: $space-1;
188
+ font-size: $text-sm;
189
+ color: $alias-text-secondary;
190
+ margin-left: calc(20px + $space-3); // Align with label (control width + gap)
191
+
192
+ &--error {
193
+ color: $alias-text-error;
194
+
195
+ svg {
196
+ color: $color-red-500;
197
+ }
198
+ }
199
+ }
200
+
201
+ // Checkbox in label-left mode adjusts helper margin
202
+ .gloss-checkbox--label-left ~ .gloss-checkbox__helper,
203
+ .gloss-checkbox--label-left + .gloss-checkbox__helper {
204
+ margin-left: 0;
205
+ margin-right: calc(20px + $space-3);
206
+ }
207
+
208
+ // Size-specific helper alignment
209
+ .gloss-checkbox--sm ~ .gloss-checkbox__helper {
210
+ margin-left: calc(16px + $space-2);
211
+ }
212
+
213
+ .gloss-checkbox--lg ~ .gloss-checkbox__helper {
214
+ margin-left: calc(24px + $space-4);
215
+ }
216
+
217
+ // --- CHECKBOX GROUP ---
218
+ .gloss-checkbox-group {
219
+ border: none;
220
+ padding: 0;
221
+ margin: 0;
222
+ display: flex;
223
+ flex-direction: column;
224
+ gap: $space-3;
225
+
226
+ &--disabled {
227
+ opacity: 0.6;
228
+ }
229
+
230
+ &--horizontal .gloss-checkbox-group__items {
231
+ flex-direction: row;
232
+ flex-wrap: wrap;
233
+ }
234
+
235
+ &--vertical .gloss-checkbox-group__items {
236
+ flex-direction: column;
237
+ }
238
+ }
239
+
240
+ .gloss-checkbox-group__label {
241
+ font-size: $text-base;
242
+ font-weight: 500;
243
+ color: $alias-text-primary;
244
+ margin-bottom: $space-2;
245
+ padding: 0;
246
+ }
247
+
248
+ .gloss-checkbox-group__required {
249
+ color: $color-red-500;
250
+ }
251
+
252
+ .gloss-checkbox-group__items {
253
+ display: flex;
254
+ gap: $space-4;
255
+ }
256
+
257
+ .gloss-checkbox-group__helper {
258
+ display: flex;
259
+ align-items: center;
260
+ gap: $space-1;
261
+ font-size: $text-sm;
262
+ color: $alias-text-secondary;
263
+ margin-top: $space-1;
264
+
265
+ &--error {
266
+ color: $alias-text-error;
267
+
268
+ svg {
269
+ color: $color-red-500;
270
+ }
271
+ }
272
+ }
273
+
274
+ // --- RADIO ---
275
+ .gloss-radio-wrapper {
276
+ display: flex;
277
+ flex-direction: column;
278
+ gap: $space-1;
279
+ }
280
+
281
+ .gloss-radio {
282
+ display: flex;
283
+ align-items: center;
284
+ gap: $space-3;
285
+ cursor: pointer;
286
+ user-select: none;
287
+ position: relative;
288
+
289
+ &:hover .gloss-radio__control {
290
+ border-color: $alias-border-hover;
291
+ @include shadow-elevation-hover;
292
+ transform: translateY(-1px);
293
+ }
294
+
295
+ // Disabled state
296
+ &--disabled {
297
+ cursor: not-allowed;
298
+ opacity: 0.6;
299
+
300
+ &:hover .gloss-radio__control {
301
+ transform: none;
302
+ box-shadow: $shadow-input-disabled;
303
+ }
304
+ }
305
+
306
+ // Label position
307
+ &--label-left {
308
+ flex-direction: row-reverse;
309
+ }
310
+
311
+ // Size variants
312
+ &--sm {
313
+ gap: $space-2;
314
+
315
+ .gloss-radio__control {
316
+ width: 16px;
317
+ height: 16px;
318
+
319
+ &::after {
320
+ width: 6px;
321
+ height: 6px;
322
+ }
323
+ }
324
+
325
+ .gloss-radio__label {
326
+ font-size: $text-sm;
327
+ }
328
+ }
329
+
330
+ &--md {
331
+ // Default size
332
+ }
333
+
334
+ &--lg {
335
+ gap: $space-4;
336
+
337
+ .gloss-radio__control {
338
+ width: 24px;
339
+ height: 24px;
340
+
341
+ &::after {
342
+ width: 10px;
343
+ height: 10px;
344
+ }
345
+ }
346
+
347
+ .gloss-radio__label {
348
+ font-size: $text-lg;
349
+ }
350
+ }
351
+
352
+ // Status variants
353
+ &--success {
354
+ .gloss-radio__control {
355
+ border-color: $alias-border-success;
356
+ }
357
+
358
+ .gloss-radio__input:checked ~ .gloss-radio__control {
359
+ border-color: $color-green-600;
360
+
361
+ &::after {
362
+ background: $color-green-600;
363
+ }
364
+ }
365
+ }
366
+
367
+ &--error {
368
+ .gloss-radio__control {
369
+ border-color: $alias-border-error;
370
+ }
371
+
372
+ .gloss-radio__input:checked ~ .gloss-radio__control {
373
+ border-color: $color-red-600;
374
+
375
+ &::after {
376
+ background: $color-red-600;
377
+ }
378
+ }
379
+ }
380
+ }
381
+
382
+ .gloss-radio__input {
383
+ position: absolute;
384
+ opacity: 0;
385
+ width: 0;
386
+ height: 0;
387
+
388
+ &:focus-visible ~ .gloss-radio__control {
389
+ border-color: $alias-border-focus;
390
+ @include shadow-input-focus;
391
+ }
392
+
393
+ &:checked ~ .gloss-radio__control {
394
+ border-color: $alias-primary;
395
+
396
+ &::after {
397
+ opacity: 1;
398
+ transform: scale(1);
399
+ }
400
+ }
401
+
402
+ &:disabled ~ .gloss-radio__control {
403
+ background: $alias-bg-disabled;
404
+ border-color: transparent;
405
+ box-shadow: $shadow-input-disabled;
406
+ cursor: not-allowed;
407
+ }
408
+ }
409
+
410
+ .gloss-radio__control {
411
+ width: 20px;
412
+ height: 20px;
413
+ border: 1.5px solid $alias-border-default;
414
+ border-radius: $radius-full;
415
+ background: $color-white;
416
+ display: flex;
417
+ align-items: center;
418
+ justify-content: center;
419
+ transition: all 0.2s;
420
+ flex-shrink: 0;
421
+ @include shadow-input-default;
422
+
423
+ &::after {
424
+ content: '';
425
+ width: 8px;
426
+ height: 8px;
427
+ border-radius: $radius-full;
428
+ background: $alias-primary;
429
+ opacity: 0;
430
+ transform: scale(0.5);
431
+ transition: all 0.2s;
432
+ }
433
+ }
434
+
435
+ .gloss-radio__label {
436
+ color: $alias-text-primary;
437
+ font-size: $text-base;
438
+ line-height: 1.4;
439
+ }
440
+
441
+ .gloss-radio__required {
442
+ color: $color-red-500;
443
+ }
444
+
445
+ .gloss-radio__description {
446
+ font-size: $text-sm;
447
+ color: $alias-text-secondary;
448
+ margin-top: $space-1;
449
+ }
450
+
451
+ .gloss-radio__helper {
452
+ display: flex;
453
+ align-items: center;
454
+ gap: $space-1;
455
+ font-size: $text-sm;
456
+ color: $alias-text-secondary;
457
+ margin-left: calc(20px + $space-3);
458
+
459
+ &--error {
460
+ color: $alias-text-error;
461
+
462
+ svg {
463
+ color: $color-red-500;
464
+ }
465
+ }
466
+ }
467
+
468
+ // --- RADIO GROUP ---
469
+ .gloss-radio-group {
470
+ border: none;
471
+ padding: 0;
472
+ margin: 0;
473
+ display: flex;
474
+ flex-direction: column;
475
+ gap: $space-3;
476
+
477
+ &--disabled {
478
+ opacity: 0.6;
479
+ }
480
+
481
+ &--horizontal .gloss-radio-group__items {
482
+ flex-direction: row;
483
+ flex-wrap: wrap;
484
+ }
485
+
486
+ &--vertical .gloss-radio-group__items {
487
+ flex-direction: column;
488
+ }
489
+ }
490
+
491
+ .gloss-radio-group__label {
492
+ font-size: $text-base;
493
+ font-weight: 500;
494
+ color: $alias-text-primary;
495
+ margin-bottom: $space-2;
496
+ padding: 0;
497
+ }
498
+
499
+ .gloss-radio-group__required {
500
+ color: $color-red-500;
501
+ }
502
+
503
+ .gloss-radio-group__items {
504
+ display: flex;
505
+ gap: $space-4;
506
+ }
507
+
508
+ .gloss-radio-group__helper {
509
+ display: flex;
510
+ align-items: center;
511
+ gap: $space-1;
512
+ font-size: $text-sm;
513
+ color: $alias-text-secondary;
514
+ margin-top: $space-1;
515
+
516
+ &--error {
517
+ color: $alias-text-error;
518
+
519
+ svg {
520
+ color: $color-red-500;
521
+ }
522
+ }
523
+ }
524
+
525
+ // --- TOGGLE ---
526
+
527
+ // Wrapper for toggle + helper text
528
+ .gloss-toggle-wrapper {
529
+ display: flex;
530
+ flex-direction: column;
531
+ gap: $space-1;
532
+ }
533
+
534
+ .gloss-toggle {
535
+ display: flex;
536
+ align-items: center;
537
+ gap: $space-3;
538
+ cursor: pointer;
539
+ user-select: none;
540
+ position: relative;
541
+
542
+ &:hover .gloss-toggle__track {
543
+ background: $color-gray-400;
544
+ }
545
+
546
+ &:hover .gloss-toggle__input:checked ~ .gloss-toggle__track {
547
+ background: $alias-primary-hover;
548
+ }
549
+
550
+ // Disabled state
551
+ &--disabled {
552
+ cursor: not-allowed;
553
+ opacity: 0.6;
554
+
555
+ &:hover .gloss-toggle__track {
556
+ background: $color-gray-300;
557
+ }
558
+ }
559
+
560
+ // Label position
561
+ &--label-left {
562
+ flex-direction: row-reverse;
563
+ }
564
+
565
+ // Size variants
566
+ &--sm {
567
+ gap: $space-2;
568
+
569
+ .gloss-toggle__track {
570
+ width: 36px;
571
+ height: 20px;
572
+ }
573
+
574
+ .gloss-toggle__thumb {
575
+ width: 16px;
576
+ height: 16px;
577
+ }
578
+
579
+ .gloss-toggle__input:checked ~ .gloss-toggle__track .gloss-toggle__thumb {
580
+ transform: translateX(16px);
581
+ }
582
+
583
+ .gloss-toggle__label {
584
+ font-size: $text-sm;
585
+ }
586
+ }
587
+
588
+ &--md {
589
+ // Default size - no changes needed
590
+ }
591
+
592
+ &--lg {
593
+ gap: $space-4;
594
+
595
+ .gloss-toggle__track {
596
+ width: 52px;
597
+ height: 28px;
598
+ }
599
+
600
+ .gloss-toggle__thumb {
601
+ width: 24px;
602
+ height: 24px;
603
+ }
604
+
605
+ .gloss-toggle__input:checked ~ .gloss-toggle__track .gloss-toggle__thumb {
606
+ transform: translateX(24px);
607
+ }
608
+
609
+ .gloss-toggle__label {
610
+ font-size: $text-lg;
611
+ }
612
+ }
613
+
614
+ // Status variants
615
+ &--success {
616
+ .gloss-toggle__input:checked ~ .gloss-toggle__track {
617
+ background: $color-green-600;
618
+ }
619
+
620
+ &:hover .gloss-toggle__input:checked ~ .gloss-toggle__track {
621
+ background: $color-green-700;
622
+ }
623
+ }
624
+
625
+ &--error {
626
+ .gloss-toggle__track {
627
+ box-shadow: inset 0 1px 3px rgba(0,0,0,0.15), 0 0 0 1px $alias-border-error;
628
+ }
629
+ }
630
+ }
631
+
632
+ .gloss-toggle__input {
633
+ position: absolute;
634
+ opacity: 0;
635
+ width: 0;
636
+ height: 0;
637
+
638
+ &:focus-visible ~ .gloss-toggle__track {
639
+ box-shadow: inset 0 1px 3px rgba(0,0,0,0.15), 0 0 0 2px $alias-border-focus;
640
+ }
641
+
642
+ &:checked ~ .gloss-toggle__track {
643
+ background: $alias-primary;
644
+
645
+ .gloss-toggle__thumb {
646
+ transform: translateX(20px);
647
+ }
648
+
649
+ .gloss-toggle__on-label {
650
+ opacity: 1;
651
+ }
652
+
653
+ .gloss-toggle__off-label {
654
+ opacity: 0;
655
+ }
656
+ }
657
+
658
+ &:not(:checked) ~ .gloss-toggle__track {
659
+ .gloss-toggle__on-label {
660
+ opacity: 0;
661
+ }
662
+
663
+ .gloss-toggle__off-label {
664
+ opacity: 1;
665
+ }
666
+ }
667
+
668
+ &:disabled ~ .gloss-toggle__track {
669
+ background: $color-gray-200;
670
+ cursor: not-allowed;
671
+ }
672
+ }
673
+
674
+ .gloss-toggle__track {
675
+ width: 44px;
676
+ height: 24px;
677
+ background: $color-gray-300;
678
+ border-radius: $radius-full;
679
+ position: relative;
680
+ transition: 0.3s;
681
+ box-shadow: inset 0 1px 3px rgba(0,0,0,0.15);
682
+ flex-shrink: 0;
683
+ }
684
+
685
+ .gloss-toggle__thumb {
686
+ width: 20px;
687
+ height: 20px;
688
+ background: white;
689
+ border-radius: 50%;
690
+ position: absolute;
691
+ top: 2px;
692
+ left: 2px;
693
+ transition: 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
694
+ box-shadow: 0 1px 2px rgba(0,0,0,0.2);
695
+ z-index: 1;
696
+ }
697
+
698
+ .gloss-toggle__labels {
699
+ position: absolute;
700
+ inset: 0;
701
+ display: flex;
702
+ align-items: center;
703
+ justify-content: space-between;
704
+ padding: 0 $space-2;
705
+ font-size: 9px;
706
+ font-weight: 700;
707
+ text-transform: uppercase;
708
+ pointer-events: none;
709
+ }
710
+
711
+ .gloss-toggle__on-label {
712
+ color: white;
713
+ opacity: 0;
714
+ transition: opacity 0.2s;
715
+ }
716
+
717
+ .gloss-toggle__off-label {
718
+ color: $color-gray-600;
719
+ opacity: 1;
720
+ transition: opacity 0.2s;
721
+ }
722
+
723
+ .gloss-toggle__label {
724
+ color: $alias-text-primary;
725
+ font-size: $text-base;
726
+ line-height: 1.4;
727
+ }
728
+
729
+ .gloss-toggle__helper {
730
+ display: flex;
731
+ align-items: center;
732
+ gap: $space-1;
733
+ font-size: $text-sm;
734
+ color: $alias-text-secondary;
735
+ margin-left: calc(44px + $space-3); // Align with label (track width + gap)
736
+
737
+ &--error {
738
+ color: $alias-text-error;
739
+
740
+ svg {
741
+ color: $color-red-500;
742
+ }
743
+ }
744
+ }
745
+
746
+ // Size-specific helper alignment
747
+ .gloss-toggle--sm ~ .gloss-toggle__helper {
748
+ margin-left: calc(36px + $space-2);
749
+ }
750
+
751
+ .gloss-toggle--lg ~ .gloss-toggle__helper {
752
+ margin-left: calc(52px + $space-4);
753
+ }