Skip to content

Commit

Permalink
fix(material/radio): Apply tokens at mixin root
Browse files Browse the repository at this point in the history
Applies radio tokens at the theme mixin's root selector (or html if the mixin
is called with no selector). This makes it easier for users to override tokens
without worrying about specificity.
  • Loading branch information
mmalerba committed Sep 28, 2023
1 parent 06559a0 commit 535ac77
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/material/radio/_radio-theme.scss
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
@use '@material/radio/radio' as mdc-radio;
@use '@material/radio/radio-theme' as mdc-radio-theme;
@use '@material/form-field' as mdc-form-field;
@use '../core/mdc-helpers/mdc-helpers';
@use '../core/style/sass-utils';
@use '../core/theming/theming';
@use '../core/theming/inspection';
@use '../core/tokens/token-utils';
Expand All @@ -10,7 +10,7 @@
@use '../core/tokens/m2/mat/radio' as tokens-mat-radio;

@mixin base($theme) {
.mat-mdc-radio-button {
@include sass-utils.current-selector-or-root() {
@include mdc-radio-theme.theme(tokens-mdc-radio.get-unthemable-tokens());
@include token-utils.create-token-values(
tokens-mat-radio.$prefix, tokens-mat-radio.get-unthemable-tokens());
Expand All @@ -19,7 +19,7 @@

@mixin color($theme) {
@include mdc-helpers.using-mdc-theme($theme) {
.mat-mdc-radio-button {
@include sass-utils.current-selector-or-root() {
@include mdc-form-field.core-styles($query: mdc-helpers.$mdc-theme-styles-query);
}
}
Expand All @@ -46,7 +46,7 @@
}

@mixin typography($theme) {
.mat-mdc-radio-button {
@include sass-utils.current-selector-or-root() {
@include mdc-radio-theme.theme(tokens-mdc-radio.get-typography-tokens($theme));
@include mdc-helpers.using-mdc-typography($theme) {
@include mdc-form-field.core-styles($query: mdc-helpers.$mdc-typography-styles-query);
Expand All @@ -57,7 +57,7 @@
@mixin density($theme) {
$density-scale: inspection.get-theme-density($theme);

.mat-mdc-radio-button .mdc-radio {
@include sass-utils.current-selector-or-root() {
@include mdc-radio-theme.theme(tokens-mdc-radio.get-density-tokens($theme));
}

Expand Down

0 comments on commit 535ac77

Please sign in to comment.