@@ -49,38 +49,43 @@ $_checkmark-bottom-left: 7px, -14px;
49
49
@mixin styles () {
50
50
$tokens : tokens .md-comp-checkbox-values ();
51
51
52
- :host {
53
- @each $token , $value in $tokens {
54
- --_ #{$token } : var (--md-checkbox - #{$token } , #{$value } );
55
- }
52
+ // Support logical shape properties
53
+ $container-shape : map .get ($tokens , ' container-shape' );
54
+ $tokens : map .set (
55
+ $tokens ,
56
+ ' container-shape-start-start' ,
57
+ var (--md-checkbox-container-shape , #{$container-shape } )
58
+ );
59
+ $tokens : map .set (
60
+ $tokens ,
61
+ ' container-shape-start-end' ,
62
+ var (--md-checkbox-container-shape , #{$container-shape } )
63
+ );
64
+ $tokens : map .set (
65
+ $tokens ,
66
+ ' container-shape-end-end' ,
67
+ var (--md-checkbox-container-shape , #{$container-shape } )
68
+ );
69
+ $tokens : map .set (
70
+ $tokens ,
71
+ ' container-shape-end-start' ,
72
+ var (--md-checkbox-container-shape , #{$container-shape } )
73
+ );
56
74
57
- // Support logical shape properties
58
- --_container-shape-start-start : var (
59
- --md-checkbox-container-shape-start-start ,
60
- var (--_container-shape )
61
- );
62
- --_container-shape-start-end : var (
63
- --md-checkbox-container-shape-start-end ,
64
- var (--_container-shape )
65
- );
66
- --_container-shape-end-end : var (
67
- --md-checkbox-container-shape-end-end ,
68
- var (--_container-shape )
69
- );
70
- --_container-shape-end-start : var (
71
- --md-checkbox-container-shape-end-start ,
72
- var (--_container-shape )
73
- );
75
+ @each $token , $value in $tokens {
76
+ $tokens : map .set ($tokens , $token , var (--md-checkbox - #{$token } , #{$value } ));
77
+ }
74
78
75
- border-start-start-radius : var (--_container-shape-start-start );
76
- border-start-end-radius : var (--_container-shape-start-end );
77
- border-end-end-radius : var (--_container-shape-end-end );
78
- border-end-start-radius : var (--_container-shape-end-start );
79
+ :host {
80
+ border-start-start-radius : map .get ($tokens , ' container-shape-start-start' );
81
+ border-start-end-radius : map .get ($tokens , ' container-shape-start-end' );
82
+ border-end-end-radius : map .get ($tokens , ' container-shape-end-end' );
83
+ border-end-start-radius : map .get ($tokens , ' container-shape-end-start' );
79
84
display : inline-flex ;
80
- height : var ( --_container- size );
85
+ height : map . get ( $tokens , ' container- size' );
81
86
position : relative ;
82
87
vertical-align : top ; // Fix extra space when placed inside display: block
83
- width : var ( --_container- size );
88
+ width : map . get ( $tokens , ' container- size' );
84
89
-webkit-tap-highlight-color : transparent ;
85
90
cursor : pointer ;
86
91
}
@@ -90,7 +95,7 @@ $_checkmark-bottom-left: 7px, -14px;
90
95
}
91
96
92
97
:host ([touch- target=' wrapper' ]) {
93
- margin : max (0px , ((48px - var ( --_container- size )) / 2 ));
98
+ margin : max (0px , ((48px - map . get ( $tokens , ' container- size' )) / 2 ));
94
99
}
95
100
96
101
md-focus-ring {
@@ -140,14 +145,14 @@ $_checkmark-bottom-left: 7px, -14px;
140
145
}
141
146
142
147
.outline {
143
- border-color : var ( --_outline- color );
148
+ border-color : map . get ( $tokens , ' outline- color' );
144
149
border-style : solid ;
145
- border-width : var ( --_outline- width );
150
+ border-width : map . get ( $tokens , ' outline- width' );
146
151
box-sizing : border-box ;
147
152
}
148
153
149
154
.background {
150
- background-color : var ( --_selected- container-color );
155
+ background-color : map . get ( $tokens , ' selected- container-color' );
151
156
}
152
157
153
158
// Background and icon transitions.
@@ -181,28 +186,29 @@ $_checkmark-bottom-left: 7px, -14px;
181
186
// Ripple
182
187
183
188
md-ripple {
184
- border-radius : var ( --_state- layer-shape );
185
- height : var ( --_state- layer-size );
189
+ border-radius : map . get ( $tokens , ' state- layer-shape' );
190
+ height : map . get ( $tokens , ' state- layer-size' );
186
191
inset : unset ;
187
- width : var ( --_state- layer-size );
192
+ width : map . get ( $tokens , ' state- layer-size' );
188
193
189
194
@include ripple .theme (
190
195
(
191
- hover- color: var ( --_hover- state-layer-color ),
192
- hover- opacity: var ( --_hover- state-layer-opacity ),
193
- pressed- color: var ( --_pressed- state-layer-color ),
194
- pressed- opacity: var ( --_pressed- state-layer-opacity ),
196
+ hover- color: map . get ( $tokens , ' hover- state-layer-color' ),
197
+ hover- opacity: map . get ( $tokens , ' hover- state-layer-opacity' ),
198
+ pressed- color: map . get ( $tokens , ' pressed- state-layer-color' ),
199
+ pressed- opacity: map . get ( $tokens , ' pressed- state-layer-opacity' ),
195
200
)
196
201
);
197
202
}
198
203
199
204
.selected md-ripple {
200
205
@include ripple .theme (
201
206
(
202
- hover- color: var (--_selected-hover-state-layer-color ),
203
- hover- opacity: var (--_selected-hover-state-layer-opacity ),
204
- pressed- color: var (--_selected-pressed-state-layer-color ),
205
- pressed- opacity: var (--_selected-pressed-state-layer-opacity ),
207
+ hover- color: map .get ($tokens , ' selected-hover-state-layer-color' ),
208
+ hover- opacity: map .get ($tokens , ' selected-hover-state-layer-opacity' ),
209
+ pressed- color: map .get ($tokens , ' selected-pressed-state-layer-color' ),
210
+ pressed- opacity:
211
+ map .get ($tokens , ' selected-pressed-state-layer-opacity' ),
206
212
)
207
213
);
208
214
}
@@ -217,9 +223,9 @@ $_checkmark-bottom-left: 7px, -14px;
217
223
// 2. Long end
218
224
// - the larger trailing part of the checkmark
219
225
// - the entirety of the indeterminate mark
220
- fill : var ( --_selected- icon-color );
221
- height : var ( --_icon- size );
222
- width : var ( --_icon- size );
226
+ fill : map . get ( $tokens , ' selected- icon-color' );
227
+ height : map . get ( $tokens , ' icon- size' );
228
+ width : map . get ( $tokens , ' icon- size' );
223
229
}
224
230
225
231
// The short end of the checkmark. Initially hidden underneath the
@@ -327,42 +333,42 @@ $_checkmark-bottom-left: 7px, -14px;
327
333
// States
328
334
329
335
:where (:hover ) .outline {
330
- border-color : var ( --_hover- outline-color );
331
- border-width : var ( --_hover- outline-width );
336
+ border-color : map . get ( $tokens , ' hover- outline-color' );
337
+ border-width : map . get ( $tokens , ' hover- outline-width' );
332
338
}
333
339
334
340
:where (:hover ) .background {
335
- background : var ( --_selected- hover-container-color );
341
+ background : map . get ( $tokens , ' selected- hover-container-color' );
336
342
}
337
343
338
344
:where (:hover ) .icon {
339
- fill : var ( --_selected- hover-icon-color );
345
+ fill : map . get ( $tokens , ' selected- hover-icon-color' );
340
346
}
341
347
342
348
:where (:focus-within ) .outline {
343
- border-color : var ( --_focus- outline-color );
344
- border-width : var ( --_focus- outline-width );
349
+ border-color : map . get ( $tokens , ' focus- outline-color' );
350
+ border-width : map . get ( $tokens , ' focus- outline-width' );
345
351
}
346
352
347
353
:where (:focus-within ) .background {
348
- background : var ( --_selected- focus-container-color );
354
+ background : map . get ( $tokens , ' selected- focus-container-color' );
349
355
}
350
356
351
357
:where (:focus-within ) .icon {
352
- fill : var ( --_selected- focus-icon-color );
358
+ fill : map . get ( $tokens , ' selected- focus-icon-color' );
353
359
}
354
360
355
361
:where (:active ) .outline {
356
- border-color : var ( --_pressed- outline-color );
357
- border-width : var ( --_pressed- outline-width );
362
+ border-color : map . get ( $tokens , ' pressed- outline-color' );
363
+ border-width : map . get ( $tokens , ' pressed- outline-width' );
358
364
}
359
365
360
366
:where (:active ) .background {
361
- background : var ( --_selected- pressed-container-color );
367
+ background : map . get ( $tokens , ' selected- pressed-container-color' );
362
368
}
363
369
364
370
:where (:active ) .icon {
365
- fill : var ( --_selected- pressed-icon-color );
371
+ fill : map . get ( $tokens , ' selected- pressed-icon-color' );
366
372
}
367
373
368
374
// Don't animate to/from disabled states because the outline is hidden when
@@ -374,9 +380,9 @@ $_checkmark-bottom-left: 7px, -14px;
374
380
}
375
381
376
382
:where (.disabled ) .outline {
377
- border-color : var ( --_disabled- outline-color );
378
- border-width : var ( --_disabled- outline-width );
379
- opacity : var ( --_disabled- container-opacity );
383
+ border-color : map . get ( $tokens , ' disabled- outline-color' );
384
+ border-width : map . get ( $tokens , ' disabled- outline-width' );
385
+ opacity : map . get ( $tokens , ' disabled- container-opacity' );
380
386
}
381
387
382
388
:where (.selected.disabled ) .outline {
@@ -388,12 +394,12 @@ $_checkmark-bottom-left: 7px, -14px;
388
394
:where (.selected.disabled ) .background {
389
395
// Set disabled opacity only when selected since opacity is used to show
390
396
// or hide the container background.
391
- background : var ( --_selected- disabled-container-color );
392
- opacity : var ( --_selected- disabled-container-opacity );
397
+ background : map . get ( $tokens , ' selected- disabled-container-color' );
398
+ opacity : map . get ( $tokens , ' selected- disabled-container-opacity' );
393
399
}
394
400
395
401
:where (.disabled ) .icon {
396
- fill : var ( --_selected- disabled-icon-color );
402
+ fill : map . get ( $tokens , ' selected- disabled-icon-color' );
397
403
}
398
404
399
405
@media (forced-colors : active ) {
0 commit comments