@@ -8,6 +8,13 @@ $_interactive-disabled-selector: '.mat-mdc-slide-toggle-disabled-interactive.mdc
8
8
9
9
$fallbacks : m3-slide-toggle .get-tokens ();
10
10
11
+ [matCheckedIcon ],
12
+ [matUncheckedIcon ],
13
+ [matCheckedDisabledIcon ],
14
+ [matUncheckedDisabledIcon ] {
15
+ display : none ;
16
+ }
17
+
11
18
.mdc-switch {
12
19
align-items : center ;
13
20
background : none ;
@@ -66,9 +73,13 @@ $fallbacks: m3-slide-toggle.get-tokens();
66
73
67
74
.mdc-switch--disabled & {
68
75
border-width : token-utils .slot (
69
- slide-toggle-disabled-unselected-track-outline-width , $fallbacks );
76
+ slide-toggle-disabled-unselected-track-outline-width ,
77
+ $fallbacks
78
+ );
70
79
border-color : token-utils .slot (
71
- slide-toggle-disabled-unselected-track-outline-color , $fallbacks );
80
+ slide-toggle-disabled-unselected-track-outline-color ,
81
+ $fallbacks
82
+ );
72
83
}
73
84
}
74
85
@@ -223,7 +234,9 @@ $fallbacks: m3-slide-toggle.get-tokens();
223
234
224
235
& :has (.mdc-switch__icons ) {
225
236
margin : token-utils .slot (
226
- slide-toggle-unselected-with-icon-handle-horizontal-margin , $fallbacks );
237
+ slide-toggle-unselected-with-icon-handle-horizontal-margin ,
238
+ $fallbacks
239
+ );
227
240
}
228
241
}
229
242
@@ -234,7 +247,9 @@ $fallbacks: m3-slide-toggle.get-tokens();
234
247
235
248
& :has (.mdc-switch__icons ) {
236
249
margin : token-utils .slot (
237
- slide-toggle-selected-with-icon-handle-horizontal-margin , $fallbacks );
250
+ slide-toggle-selected-with-icon-handle-horizontal-margin ,
251
+ $fallbacks
252
+ );
238
253
}
239
254
}
240
255
@@ -275,7 +290,8 @@ $fallbacks: m3-slide-toggle.get-tokens();
275
290
left : 0 ;
276
291
position : absolute ;
277
292
top : 0 ;
278
- transition : background-color 75ms 0ms cubic-bezier (0.4 , 0 , 0.2 , 1 ),
293
+ transition :
294
+ background-color 75ms 0ms cubic-bezier (0.4 , 0 , 0.2 , 1 ),
279
295
border-color 75ms 0ms cubic-bezier (0.4 , 0 , 0.2 , 1 );
280
296
z-index : -1 ;
281
297
@@ -435,39 +451,50 @@ $fallbacks: m3-slide-toggle.get-tokens();
435
451
}
436
452
}
437
453
438
- .mdc-switch__icon {
439
- bottom : 0 ;
440
- left : 0 ;
441
- margin : auto ;
454
+ .mdc-switch__icons > [matUncheckedIcon ],
455
+ .mdc-switch__icons > [matCheckedIcon ],
456
+ .mdc-switch__icons > [matUncheckedDisabledIcon ],
457
+ .mdc-switch__icons > [matCheckedDisabledIcon ] {
458
+ margin : 0 ;
442
459
position : absolute ;
443
- right : 0 ;
444
- top : 0 ;
460
+ top : 50% ;
461
+ right : 50% ;
462
+ transform : translate (50% , -50% );
445
463
opacity : 0 ;
464
+ font-size : 16px ;
465
+ display : block ;
466
+
446
467
transition : opacity 30ms 0ms cubic-bezier (0.4 , 0 , 1 , 1 );
447
468
448
469
.mdc-switch--unselected & {
449
470
width : token-utils .slot (slide-toggle-unselected-icon-size , $fallbacks );
450
471
height : token-utils .slot (slide-toggle-unselected-icon-size , $fallbacks );
451
472
fill : token-utils .slot (slide-toggle-unselected-icon-color , $fallbacks );
473
+ color : token-utils .slot (slide-toggle-unselected-icon-color , $fallbacks );
452
474
}
453
475
454
476
.mdc-switch--unselected.mdc-switch--disabled & {
455
477
fill : token-utils .slot (slide-toggle-disabled-unselected-icon-color , $fallbacks );
478
+ color : token-utils .slot (slide-toggle-disabled-unselected-icon-color , $fallbacks );
456
479
}
457
480
458
481
.mdc-switch--selected & {
459
482
width : token-utils .slot (slide-toggle-selected-icon-size , $fallbacks );
460
483
height : token-utils .slot (slide-toggle-selected-icon-size , $fallbacks );
461
484
fill : token-utils .slot (slide-toggle-selected-icon-color , $fallbacks );
485
+ color : token-utils .slot (slide-toggle-selected-icon-color , $fallbacks );
462
486
}
463
487
464
488
.mdc-switch--selected.mdc-switch--disabled & {
465
489
fill : token-utils .slot (slide-toggle-disabled-selected-icon-color , $fallbacks );
490
+ color : token-utils .slot (slide-toggle-disabled-selected-icon-color , $fallbacks );
466
491
}
467
492
}
468
493
469
- .mdc-switch--selected .mdc-switch__icon--on ,
470
- .mdc-switch--unselected .mdc-switch__icon--off {
494
+ .mdc-switch--selected .mdc-switch__icons [matCheckedIcon ],
495
+ .mdc-switch--unselected .mdc-switch__icons [matUncheckedIcon ],
496
+ .mdc-switch--disabled.mdc-switch--selected .mdc-switch__icons [matCheckedDisabledIcon ],
497
+ .mdc-switch--disabled.mdc-switch--unselected .mdc-switch__icons [matUncheckedDisabledIcon ] {
471
498
opacity : 1 ;
472
499
transition : opacity 45ms 30ms cubic-bezier (0 , 0 , 0.2 , 1 );
473
500
}
0 commit comments