@aristobyte-ui/radio 2.9.1 → 2.10.0

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.
@@ -6,6 +6,35 @@
6
6
  display: flex;
7
7
  position: relative;
8
8
 
9
+ &__control {
10
+ align-items: center;
11
+ border-radius: 999px;
12
+ display: flex;
13
+ flex-shrink: 0;
14
+ justify-content: center;
15
+ position: relative;
16
+ transition:
17
+ border-color 0.2s ease,
18
+ background-color 0.2s ease,
19
+ transform 300ms ease;
20
+
21
+ &::after {
22
+ border-radius: 50%;
23
+ content: '';
24
+ display: flex;
25
+ transform: scale(0);
26
+ transition: transform 0.2s ease;
27
+ }
28
+ }
29
+
30
+ &__input {
31
+ appearance: none;
32
+ height: 0;
33
+ margin: 0;
34
+ outline: none;
35
+ width: 0;
36
+ }
37
+
9
38
  &-align-label {
10
39
  &--top {
11
40
  flex-direction: column;
@@ -145,629 +174,115 @@
145
174
  }
146
175
  }
147
176
 
148
- &-variant {
149
- &--default {
150
- &.radio-appearance {
151
- &--outline {
152
- .radio__control {
153
- background-color: rgba($color-default, 0.3);
154
- border: 2px solid $color-default;
155
-
156
- &::after {
157
- background-color: $color-default;
158
- }
159
- }
160
-
161
- &:active .radio__control {
162
- background-color: rgba($color-default, 0.4);
163
- }
164
- }
165
-
166
- &--no-outline {
167
- .radio__control {
168
- background-color: rgba($color-default, 0.3);
169
- border: 2px solid transparent;
170
-
171
- &::after {
172
- background-color: $color-default;
173
- }
174
- }
175
-
176
- &:active .radio__control {
177
- background-color: rgba($color-default, 0.4);
178
- }
179
- }
180
-
181
- &--glowing {
182
- .radio__control {
183
- backdrop-filter: 8px;
184
- background-color: rgba($color-default, 0.3);
185
- border: 2px solid $color-default;
186
- box-shadow:
187
- 0 0 8px rgba($color-default, 0.5),
188
- 0 0 16px rgba($color-default, 0.4),
189
- 0 0 24px rgba($color-default, 0.3);
190
-
191
- &::after {
192
- background-color: $color-default;
193
- }
194
- }
195
-
196
- &:active .radio__control {
197
- background-color: rgba($color-default, 0.4);
198
- }
199
- }
200
-
201
- &--solid {
202
- .radio__control {
203
- background-color: $color-default;
204
- border: 2px solid $color-default;
205
-
206
- &::after {
207
- background-color: rgba($white, 0.5);
208
- }
209
- }
177
+ @mixin radio-variant($name, $color, $dot-alpha, $glow-dot) {
178
+ &-variant--#{$name}.radio-appearance--outline {
179
+ .radio__control {
180
+ background-color: rgba($color, 0.3);
181
+ border: 2px solid $color;
210
182
 
211
- &:active .radio__control {
212
- background-color: rgba($color-default, 0.9);
213
- }
183
+ &::after {
184
+ background-color: $color;
214
185
  }
215
186
  }
216
187
 
217
- .radio__label {
218
- color: $white;
219
-
220
- &--highlight-label {
221
- color: $color-default;
222
- }
188
+ &:active .radio__control {
189
+ background-color: rgba($color, 0.4);
223
190
  }
224
191
  }
225
192
 
226
- &--primary {
227
- &.radio-appearance {
228
- &--outline {
229
- .radio {
230
- &__control {
231
- background-color: rgba($color-primary, 0.3);
232
- border: 2px solid $color-primary;
233
-
234
- &::after {
235
- background-color: $color-primary;
236
- }
237
- }
238
- }
239
-
240
- &:active .radio__control {
241
- background-color: rgba($color-primary, 0.4);
242
- }
243
- }
244
-
245
- &--no-outline {
246
- .radio__control {
247
- background-color: rgba($color-primary, 0.3);
248
- border: 2px solid transparent;
249
-
250
- &::after {
251
- background-color: $color-primary;
252
- }
253
- }
254
-
255
- &:active .radio__control {
256
- background-color: rgba($color-primary, 0.4);
257
- }
258
- }
259
-
260
- &--glowing {
261
- .radio {
262
- &__control {
263
- backdrop-filter: 8px;
264
- background-color: rgba($color-primary, 0.3);
265
- border: 2px solid $color-primary;
266
- box-shadow:
267
- 0 0 8px rgba($color-primary, 0.5),
268
- 0 0 16px rgba($color-primary, 0.4),
269
- 0 0 24px rgba($color-primary, 0.3);
270
-
271
- &::after {
272
- background-color: $color-primary;
273
- box-shadow:
274
- 0 0 8px rgba($color-primary, 0.5),
275
- 0 0 16px rgba($color-primary, 0.4),
276
- 0 0 24px rgba($color-primary, 0.3);
277
- }
278
- }
279
- }
280
-
281
- &:active .radio__control {
282
- background-color: rgba($color-primary, 0.4);
283
- }
284
- }
285
-
286
- &--outline-dashed {
287
- .radio {
288
- &__control {
289
- background-color: rgba($color-primary, 0.3);
290
- border: 2px dashed $color-primary;
291
-
292
- &::after {
293
- background-color: $color-primary;
294
- }
295
- }
296
- }
297
-
298
- &:active .radio__control {
299
- background-color: rgba($color-primary, 0.4);
300
- }
301
- }
302
-
303
- &--solid {
304
- .radio__control {
305
- background-color: $color-primary;
306
- border: 2px solid $color-primary;
307
-
308
- &::after {
309
- background-color: rgba($white, 0.9);
310
- }
311
- }
193
+ &-variant--#{$name}.radio-appearance--no-outline {
194
+ .radio__control {
195
+ background-color: rgba($color, 0.3);
196
+ border: 2px solid transparent;
312
197
 
313
- &:active .radio__control {
314
- background-color: rgba($color-primary, 0.9);
315
- }
198
+ &::after {
199
+ background-color: $color;
316
200
  }
317
201
  }
318
202
 
319
- .radio__label {
320
- color: $white;
321
-
322
- &--highlight-label {
323
- color: $color-primary;
324
- }
203
+ &:active .radio__control {
204
+ background-color: rgba($color, 0.4);
325
205
  }
326
206
  }
327
207
 
328
- &--secondary {
329
- &.radio-appearance {
330
- &--outline {
331
- .radio {
332
- &__control {
333
- background-color: rgba($color-secondary, 0.3);
334
- border: 2px solid $color-secondary;
335
-
336
- &::after {
337
- background-color: $color-secondary;
338
- }
339
- }
340
- }
341
-
342
- &:active .radio__control {
343
- background-color: rgba($color-secondary, 0.4);
344
- }
345
- }
346
-
347
- &--no-outline {
348
- .radio__control {
349
- background-color: rgba($color-secondary, 0.3);
350
- border: 2px solid transparent;
351
-
352
- &::after {
353
- background-color: $color-secondary;
354
- }
355
- }
356
-
357
- &:active .radio__control {
358
- background-color: rgba($color-secondary, 0.4);
359
- }
360
- }
361
-
362
- &--glowing {
363
- .radio {
364
- &__control {
365
- backdrop-filter: 8px;
366
- background-color: rgba($color-secondary, 0.3);
367
- border: 2px solid $color-secondary;
368
- box-shadow:
369
- 0 0 8px rgba($color-secondary, 0.5),
370
- 0 0 16px rgba($color-secondary, 0.4),
371
- 0 0 24px rgba($color-secondary, 0.3);
372
-
373
- &::after {
374
- background-color: $color-secondary;
375
- box-shadow:
376
- 0 0 8px rgba($color-secondary, 0.5),
377
- 0 0 16px rgba($color-secondary, 0.4),
378
- 0 0 24px rgba($color-secondary, 0.3);
379
- }
380
- }
381
- }
382
-
383
- &:active .radio__control {
384
- background-color: rgba($color-secondary, 0.4);
385
- }
386
- }
387
-
388
- &--outline-dashed {
389
- .radio {
390
- &__control {
391
- background-color: rgba($color-secondary, 0.3);
392
- border: 2px dashed $color-secondary;
393
-
394
- &::after {
395
- background-color: $color-secondary;
396
- }
397
- }
398
- }
399
-
400
- &:active .radio__control {
401
- background-color: rgba($color-secondary, 0.4);
402
- }
403
- }
404
-
405
- &--solid {
406
- .radio__control {
407
- background-color: $color-secondary;
408
- border: 2px solid $color-secondary;
409
-
410
- &::after {
411
- background-color: rgba($white, 0.9);
412
- }
413
- }
414
-
415
- &:active .radio__control {
416
- background-color: rgba($color-secondary, 0.9);
208
+ &-variant--#{$name}.radio-appearance--glowing {
209
+ .radio__control {
210
+ backdrop-filter: 8px;
211
+ background-color: rgba($color, 0.3);
212
+ border: 2px solid $color;
213
+ box-shadow:
214
+ 0 0 8px rgba($color, 0.5),
215
+ 0 0 16px rgba($color, 0.4),
216
+ 0 0 24px rgba($color, 0.3);
217
+
218
+ &::after {
219
+ background-color: $color;
220
+
221
+ @if $glow-dot {
222
+ box-shadow:
223
+ 0 0 8px rgba($color, 0.5),
224
+ 0 0 16px rgba($color, 0.4),
225
+ 0 0 24px rgba($color, 0.3);
417
226
  }
418
227
  }
419
228
  }
420
229
 
421
- .radio__label {
422
- color: $white;
423
-
424
- &--highlight-label {
425
- color: $color-secondary;
426
- }
230
+ &:active .radio__control {
231
+ background-color: rgba($color, 0.4);
427
232
  }
428
233
  }
429
234
 
430
- &--error {
431
- &.radio-appearance {
432
- &--outline {
433
- .radio {
434
- &__control {
435
- background-color: rgba($color-error, 0.3);
436
- border: 2px solid $color-error;
437
-
438
- &::after {
439
- background-color: $color-error;
440
- }
441
- }
442
- }
443
-
444
- &:active .radio__control {
445
- background-color: rgba($color-error, 0.4);
446
- }
447
- }
448
-
449
- &--no-outline {
450
- .radio__control {
451
- background-color: rgba($color-error, 0.3);
452
- border: 2px solid transparent;
453
-
454
- &::after {
455
- background-color: $color-error;
456
- }
457
- }
458
-
459
- &:active .radio__control {
460
- background-color: rgba($color-error, 0.4);
461
- }
462
- }
463
-
464
- &--glowing {
465
- .radio {
466
- &__control {
467
- backdrop-filter: 8px;
468
- background-color: rgba($color-error, 0.3);
469
- border: 2px solid $color-error;
470
- box-shadow:
471
- 0 0 8px rgba($color-error, 0.5),
472
- 0 0 16px rgba($color-error, 0.4),
473
- 0 0 24px rgba($color-error, 0.3);
474
-
475
- &::after {
476
- background-color: $color-error;
477
- box-shadow:
478
- 0 0 8px rgba($color-error, 0.5),
479
- 0 0 16px rgba($color-error, 0.4),
480
- 0 0 24px rgba($color-error, 0.3);
481
- }
482
- }
483
- }
484
-
485
- &:active .radio__control {
486
- background-color: rgba($color-error, 0.4);
487
- }
488
- }
489
-
490
- &--outline-dashed {
491
- .radio {
492
- &__control {
493
- background-color: rgba($color-error, 0.3);
494
- border: 2px dashed $color-error;
495
-
496
- &::after {
497
- background-color: $color-error;
498
- }
499
- }
500
- }
501
-
502
- &:active .radio__control {
503
- background-color: rgba($color-error, 0.4);
504
- }
505
- }
506
-
507
- &--solid {
508
- .radio__control {
509
- background-color: $color-error;
510
- border: 2px solid $color-error;
511
-
512
- &::after {
513
- background-color: rgba($white, 0.9);
514
- }
515
- }
235
+ &-variant--#{$name}.radio-appearance--outline-dashed {
236
+ .radio__control {
237
+ background-color: rgba($color, 0.3);
238
+ border: 2px dashed $color;
516
239
 
517
- &:active .radio__control {
518
- background-color: rgba($color-error, 0.9);
519
- }
240
+ &::after {
241
+ background-color: $color;
520
242
  }
521
243
  }
522
244
 
523
- .radio__label {
524
- color: $white;
525
-
526
- &--highlight-label {
527
- color: $color-error;
528
- }
245
+ &:active .radio__control {
246
+ background-color: rgba($color, 0.4);
529
247
  }
530
248
  }
531
249
 
532
- &--warning {
533
- &.radio-appearance {
534
- &--outline {
535
- .radio {
536
- &__control {
537
- background-color: rgba($color-warning, 0.3);
538
- border: 2px solid $color-warning;
539
-
540
- &::after {
541
- background-color: $color-warning;
542
- }
543
- }
544
- }
545
-
546
- &:active .radio__control {
547
- background-color: rgba($color-warning, 0.4);
548
- }
549
- }
550
-
551
- &--no-outline {
552
- .radio__control {
553
- background-color: rgba($color-warning, 0.3);
554
- border: 2px solid transparent;
555
-
556
- &::after {
557
- background-color: $color-warning;
558
- }
559
- }
560
-
561
- &:active .radio__control {
562
- background-color: rgba($color-warning, 0.4);
563
- }
564
- }
565
-
566
- &--glowing {
567
- .radio {
568
- &__control {
569
- backdrop-filter: 8px;
570
- background-color: rgba($color-warning, 0.3);
571
- border: 2px solid $color-warning;
572
- box-shadow:
573
- 0 0 8px rgba($color-warning, 0.5),
574
- 0 0 16px rgba($color-warning, 0.4),
575
- 0 0 24px rgba($color-warning, 0.3);
576
-
577
- &::after {
578
- background-color: $color-warning;
579
- box-shadow:
580
- 0 0 8px rgba($color-warning, 0.5),
581
- 0 0 16px rgba($color-warning, 0.4),
582
- 0 0 24px rgba($color-warning, 0.3);
583
- }
584
- }
585
- }
586
-
587
- &:active .radio__control {
588
- background-color: rgba($color-warning, 0.4);
589
- }
590
- }
591
-
592
- &--outline-dashed {
593
- .radio {
594
- &__control {
595
- background-color: rgba($color-warning, 0.3);
596
- border: 2px dashed $color-warning;
597
-
598
- &::after {
599
- background-color: $color-warning;
600
- }
601
- }
602
- }
603
-
604
- &:active .radio__control {
605
- background-color: rgba($color-warning, 0.4);
606
- }
607
- }
608
-
609
- &--solid {
610
- .radio__control {
611
- background-color: $color-warning;
612
- border: 2px solid $color-warning;
613
-
614
- &::after {
615
- background-color: rgba($white, 0.9);
616
- }
617
- }
250
+ &-variant--#{$name}.radio-appearance--solid {
251
+ .radio__control {
252
+ background-color: $color;
253
+ border: 2px solid $color;
618
254
 
619
- &:active .radio__control {
620
- background-color: rgba($color-warning, 0.9);
621
- }
255
+ &::after {
256
+ background-color: rgba($white, $dot-alpha);
622
257
  }
623
258
  }
624
259
 
625
- .radio__label {
626
- color: $white;
627
-
628
- &--highlight-label {
629
- color: $color-warning;
630
- }
260
+ &:active .radio__control {
261
+ background-color: rgba($color, 0.9);
631
262
  }
632
263
  }
633
264
 
634
- &--success {
635
- &.radio-appearance {
636
- &--outline {
637
- .radio {
638
- &__control {
639
- background-color: rgba($color-success, 0.3);
640
- border: 2px solid $color-success;
641
-
642
- &::after {
643
- background-color: $color-success;
644
- }
645
- }
646
- }
647
-
648
- &:active .radio__control {
649
- background-color: rgba($color-success, 0.4);
650
- }
651
- }
652
-
653
- &--no-outline {
654
- .radio__control {
655
- background-color: rgba($color-success, 0.3);
656
- border: 2px solid transparent;
265
+ &-variant--#{$name} .radio__label {
266
+ color: $white;
657
267
 
658
- &::after {
659
- background-color: $color-success;
660
- }
661
- }
662
-
663
- &:active .radio__control {
664
- background-color: rgba($color-success, 0.4);
665
- }
666
- }
667
-
668
- &--glowing {
669
- .radio {
670
- &__control {
671
- backdrop-filter: 8px;
672
- background-color: rgba($color-success, 0.3);
673
- border: 2px solid $color-success;
674
- box-shadow:
675
- 0 0 8px rgba($color-success, 0.5),
676
- 0 0 16px rgba($color-success, 0.4),
677
- 0 0 24px rgba($color-success, 0.3);
678
-
679
- &::after {
680
- background-color: $color-success;
681
- box-shadow:
682
- 0 0 8px rgba($color-success, 0.5),
683
- 0 0 16px rgba($color-success, 0.4),
684
- 0 0 24px rgba($color-success, 0.3);
685
- }
686
- }
687
- }
688
-
689
- &:active .radio__control {
690
- background-color: rgba($color-success, 0.4);
691
- }
692
- }
693
-
694
- &--outline-dashed {
695
- .radio {
696
- &__control {
697
- background-color: rgba($color-success, 0.3);
698
- border: 2px dashed $color-success;
699
-
700
- &::after {
701
- background-color: $color-success;
702
- }
703
- }
704
- }
705
-
706
- &:active .radio__control {
707
- background-color: rgba($color-success, 0.4);
708
- }
709
- }
710
-
711
- &--solid {
712
- .radio__control {
713
- background-color: $color-success;
714
- border: 2px solid $color-success;
715
-
716
- &::after {
717
- background-color: rgba($white, 0.9);
718
- }
719
- }
720
-
721
- &:active .radio__control {
722
- background-color: rgba($color-success, 0.9);
723
- }
724
- }
725
- }
726
-
727
- .radio__label {
728
- color: $white;
729
-
730
- &--highlight-label {
731
- color: $color-success;
732
- }
268
+ &--highlight-label {
269
+ color: $color;
733
270
  }
734
271
  }
735
272
  }
736
273
 
737
- &:active &__control {
738
- transform: scale(0.95);
739
- }
274
+ @include radio-variant('default', $color-default, 0.5, false);
275
+ @include radio-variant('primary', $color-primary, 0.9, true);
276
+ @include radio-variant('secondary', $color-secondary, 0.9, true);
277
+ @include radio-variant('error', $color-error, 0.9, true);
278
+ @include radio-variant('warning', $color-warning, 0.9, true);
279
+ @include radio-variant('success', $color-success, 0.9, true);
740
280
 
741
- &__control {
742
- align-items: center;
743
- border-radius: 999px;
744
- display: flex;
745
- flex-shrink: 0;
746
- justify-content: center;
747
- position: relative;
748
- transition:
749
- border-color 0.2s ease,
750
- background-color 0.2s ease,
751
- transform 300ms ease;
752
-
753
- &::after {
754
- border-radius: 50%;
755
- content: '';
756
- display: flex;
757
- transform: scale(0);
758
- transition: transform 0.2s ease;
759
- }
281
+ &__input:checked + .radio__control::after {
282
+ transform: scale(1);
760
283
  }
761
284
 
762
- &__input {
763
- appearance: none;
764
- height: 0;
765
- margin: 0;
766
- outline: none;
767
- width: 0;
768
-
769
- &:checked + .radio__control::after {
770
- transform: scale(1);
771
- }
285
+ &:active &__control {
286
+ transform: scale(0.95);
772
287
  }
773
288
  }