3
3
@use ' ../core/tokens/m2/mat/switch' as tokens-mat-switch ;
4
4
@use ' ../core/tokens/m2/mdc/switch' as tokens-mdc-switch ;
5
5
@use ' ../core/tokens/token-utils' ;
6
+ @use ' ../core/style/vendor-prefixes' ;
6
7
7
8
$_mdc-slots : (tokens-mdc-switch .$prefix , tokens-mdc-switch .get-token-slots ());
8
9
$_mat-slots : (tokens-mat-switch .$prefix , tokens-mat-switch .get-token-slots ());
@@ -12,7 +13,6 @@ $_interactive-disabled-selector: '.mat-mdc-slide-toggle-disabled-interactive.mdc
12
13
align-items : center ;
13
14
background : none ;
14
15
border : none ;
15
- cursor : pointer ;
16
16
display : inline-flex ;
17
17
flex-shrink : 0 ;
18
18
margin : 0 ;
@@ -21,15 +21,6 @@ $_interactive-disabled-selector: '.mat-mdc-slide-toggle-disabled-interactive.mdc
21
21
padding : 0 ;
22
22
position : relative ;
23
23
24
- & .mdc-switch--disabled {
25
- cursor : default ;
26
- pointer-events : none ;
27
- }
28
-
29
- & .mat-mdc-slide-toggle-disabled-interactive {
30
- pointer-events : auto ;
31
- }
32
-
33
24
@include token-utils .use-tokens ($_mdc-slots ...) {
34
25
@include token-utils .create-token-slot (width , track- width);
35
26
}
@@ -503,8 +494,23 @@ $_interactive-disabled-selector: '.mat-mdc-slide-toggle-disabled-interactive.mdc
503
494
}
504
495
505
496
.mat-mdc-slide-toggle {
497
+ @include vendor-prefixes .user-select (none );
506
498
display : inline-block ;
507
499
-webkit-tap-highlight-color : transparent ;
500
+ cursor : pointer ;
501
+
502
+ & :has (.mdc-switch--disabled ) {
503
+ pointer-events : none ;
504
+ cursor : auto ;
505
+ }
506
+
507
+ & :has (.mat-mdc-slide-toggle-disabled-interactive ) {
508
+ pointer-events : auto ;
509
+ }
510
+
511
+ button , label {
512
+ cursor : inherit ;
513
+ }
508
514
509
515
// Remove the native outline since we use the ripple for focus indication.
510
516
outline : 0 ;
@@ -564,11 +570,6 @@ $_interactive-disabled-selector: '.mat-mdc-slide-toggle-disabled-interactive.mdc
564
570
}
565
571
}
566
572
567
- // If our slide-toggle is enabled the cursor on label should appear as a pointer.
568
- .mdc-switch :enabled + .mdc-label {
569
- cursor : pointer ;
570
- }
571
-
572
573
// TODO(wagnermaciel): Use our custom token system to emit this css rule.
573
574
.mdc-switch--disabled + label {
574
575
color : var (--mdc-switch-disabled-label-text-color );
0 commit comments