2727@use ' sass:math' ;
2828@use ' @material/animation/functions' as functions2 ;
2929@use ' @material/density/functions' as density-functions ;
30+ @use ' @material/density/variables' as density-variables ;
3031@use ' @material/feature-targeting/feature-targeting' ;
3132@use ' @material/ripple/ripple' ;
3233@use ' @material/ripple/ripple-theme' ;
33- @use ' @material/touch-target/mixins' as touch-target-mixins ;
34- @use ' @material/theme/theme-color' ;
35- @use ' ./checkbox-custom-properties' ;
36- @use ' @material/theme/theme' ;
3734@use ' @material/theme/color-custom-properties' ;
3835@use ' @material/theme/custom-properties' ;
36+ @use ' @material/theme/theme' ;
37+ @use ' @material/theme/theme-color' ;
3938@use ' @material/touch-target/variables' as touch-target-variables ;
40- @use ' @material/density/variables ' as density-variables ;
39+ @use ' ./checkbox-custom-properties ' ;
4140
4241$baseline-theme-color : secondary !default ;
4342$mark-color : theme-color .prop-value (on-secondary ) !default ;
@@ -212,19 +211,8 @@ $light-theme: (
212211 $query : feature-targeting .all ()
213212) {
214213 $feat-structure : feature-targeting .create-target ($query , structure );
215- $checkbox-padding : ($ripple-size - $icon-size ) / 2 ;
216-
217- @include feature-targeting .targets ($feat-structure ) {
218- padding : $checkbox-padding ;
219- }
220-
221- .mdc-checkbox__background {
222- @include feature-targeting .targets ($feat-structure ) {
223- top : $checkbox-padding ;
224- left : $checkbox-padding ;
225- }
226- }
227214
215+ $checkbox-padding : ($ripple-size - $icon-size ) / 2 ;
228216 .mdc-checkbox__background ::before {
229217 @include feature-targeting .targets ($feat-structure ) {
230218 top : - ($border-width ) - $checkbox-padding ;
@@ -234,9 +222,36 @@ $light-theme: (
234222 }
235223 }
236224
237- @if ($touch-target-size == null) {
225+ $ripple-size : custom-properties .create (
226+ checkbox-custom-properties .$ripple-size ,
227+ $ripple-size
228+ );
229+ $checkbox-padding : calc ((_ripple- size - _icon- size) / 2 );
230+ $replace : (
231+ _ripple- size: $ripple-size ,
232+ _icon- size: $icon-size ,
233+ );
234+
235+ @include feature-targeting .targets ($feat-structure ) {
236+ @include theme .property (padding , $checkbox-padding , $replace : $replace );
237+ }
238+
239+ .mdc-checkbox__background {
240+ @include feature-targeting .targets ($feat-structure ) {
241+ @include theme .property (top , $checkbox-padding , $replace : $replace );
242+ @include theme .property (left , $checkbox-padding , $replace : $replace );
243+ }
244+ }
245+
246+ @if ($touch-target-size ) {
247+ $touch-target-size : custom-properties .create (
248+ checkbox-custom-properties .$touch-target-size ,
249+ $touch-target-size
250+ );
251+ } @else {
238252 $touch-target-size : $ripple-size ;
239253 }
254+
240255 @include touch-target (
241256 $touch-target-size : $touch-target-size ,
242257 $ripple-size : $ripple-size ,
@@ -492,23 +507,25 @@ $light-theme: (
492507) {
493508 $feat-structure : feature-targeting .create-target ($query , structure );
494509
495- @include touch-target-mixins .margin (
496- $component-height : $ripple-size ,
497- $component-width : $ripple-size ,
498- $touch-target-height : $touch-target-size ,
499- $touch-target-width : $touch-target-size ,
500- $query : $query
510+ $margin : calc ((_touch- target- size - _ripple- size) / 2 );
511+ $replace : (
512+ _touch- target- size: $touch-target-size ,
513+ _ripple- size: $ripple-size ,
501514 );
502515
503- $offset : ($ripple-size - $touch-target-size ) / 2 ;
516+ @include feature-targeting .targets ($feat-structure ) {
517+ @include theme .property (margin , $margin , $replace : $replace );
518+ }
519+
520+ $offset : calc ((_ripple- size - _touch- target- size) / 2 );
504521
505522 @include feature-targeting .targets ($feat-structure ) {
506523 .mdc-checkbox__native-control {
507- top : $offset ;
508- right : $offset ;
509- left : $offset ;
510- width : $touch-target-size ;
511- height : $touch-target-size ;
524+ @include theme . property ( top , $offset , $replace : $replace ) ;
525+ @include theme . property ( right , $offset , $replace : $replace ) ;
526+ @include theme . property ( left , $offset , $replace : $replace ) ;
527+ @include theme . property ( width , $touch-target-size ) ;
528+ @include theme . property ( height , $touch-target-size ) ;
512529 }
513530 }
514531}
0 commit comments