1+ @use ' sass:map' ;
12@use ' ../../../../styles/common/component' ;
23@use ' ../../../../styles/utilities' as * ;
4+ @use ' ../../../../styles/themes/schemas' as * ;
35
46:host {
57 display : inline-flex ;
68 font-family : var (--ig-font-family );
7-
8- --size : #{rem (36px )} ;
9- --thumb-size : #{rem (20px )} ;
10- --thumb-offset : #{rem (-1px )} ;
119}
1210
1311input [type = ' checkbox' ] {
1412 @include hide-default ();
1513}
1614
17- label {
15+ [ part ~= ' base ' ] {
1816 display : flex ;
1917 flex-flow : row nowrap ;
2018 align-items : center ;
2119 cursor : pointer ;
22- gap : rem (8px );
23-
24- & :hover [part ~= ' thumb' ] {
25- & ::after {
26- background : color (gray , 600 , .06 );
27- }
28- }
29-
30- & :focus-within [part ~= ' thumb' ] {
31- & ::after {
32- background : color (gray , 600 , .12 );
33- }
34- }
20+ gap : var (--label-gap );
3521}
3622
3723[part ~= ' control' ] {
3824 display : flex ;
3925 flex-shrink : 0 ;
4026 align-items : center ;
4127 user-select : none ;
42- transition : all .2s ease-in-out ;
4328}
4429
4530[part ~= ' thumb' ] {
46- @include border-radius (rem (10px ));
47-
4831 position : relative ;
49- animation-name : thumb- off;
5032 animation-duration : .2s ;
5133 animation-fill-mode : none ;
34+ }
35+
36+ [part ~= ' control' ],
37+ [part ~= ' thumb' ] {
5238 transition : all .2s ease-in-out ;
5339}
5440
5541[part ~= ' thumb' ][part ~= ' checked' ] {
56- animation-name : thumb- on;
5742 animation-duration : .2s ;
5843 animation-fill-mode : forwards ;
5944}
6045
6146[part ~= ' label' ] {
62- @include type-style (' subtitle-1' );
63-
6447 display : inline-block ;
65- color : color (gray , 900 );
6648 cursor : pointer ;
6749 user-select : none ;
68- word-wrap : break-all ;
69- transition : all .2s ease-in-out ;
50+ word-wrap : break-word ;
7051}
7152
7253:host ([disabled ]) {
7354 user-select : none ;
7455 pointer-events : none ;
7556 cursor : initial ;
76-
77- [part ~= ' label' ] {
78- color : color (gray , 400 );
79- }
80- }
81-
82- :host (:not ([disabled ])[invalid ]) {
83- [part ~= ' label' ] {
84- color : color (error , 500 );
85- }
86-
87- [part ~= ' thumb' ] {
88- background : color (error , 500 );
89- }
9057}
9158
9259:host ([label-position = ' before' ]) {
@@ -101,16 +68,17 @@ label {
10168 }
10269
10370 to {
104- margin-inline-start : calc (var (--size ) - var (--thumb-size ) - var ( --thumb-offset ) );
71+ margin-inline-start : calc (var (--size ) - var (--thumb-size ));
10572 }
10673}
10774
10875@keyframes thumb-off {
10976 from {
110- margin-inline-start : calc (var (--size ) - var (--thumb-size ) - var ( --thumb-offset ) );
77+ margin-inline-start : calc (var (--size ) - var (--thumb-size ));
11178 }
11279
11380 to {
11481 margin-inline-start : var (--thumb-offset );
11582 }
11683}
84+
0 commit comments