Skip to content

Commit

Permalink
fix(material/radio): move unthemable tokens to theme mixin (#27809)
Browse files Browse the repository at this point in the history
Though these tokens are not currently affected by the theme, in the
future they will be affected by the design system used for theming (M2
or M3)

BREAKING CHANGE:
There are new styles emitted by `mat.radio-theme` that are not
emitted by any of: `mat.radio-color`, `mat.radio-typography`,
`mat.radio-density`. If you rely on the partial mixins only and don't
call `mat.radio-theme`, you can add `mat.radio-base` to get the
missing styles.
  • Loading branch information
mmalerba authored Sep 22, 2023
1 parent 7bb4491 commit 943b5da
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/material/_index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ list-density, list-base;
progress-spinner-theme, progress-spinner-color, progress-spinner-typography,
progress-spinner-density, progress-spinner-base;
@forward './radio/radio-theme' as radio-* show radio-theme, radio-color, radio-typography,
radio-density;
radio-density, radio-base;
@forward './select/select-theme' as select-* show select-theme, select-color, select-typography,
select-density;
@forward './sidenav/sidenav-theme' as sidenav-* show sidenav-theme, sidenav-color,
Expand Down
9 changes: 9 additions & 0 deletions src/material/radio/_radio-theme.scss
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,14 @@
@use '../core/tokens/m2/mdc/radio' as tokens-mdc-radio;
@use '../core/tokens/m2/mat/radio' as tokens-mat-radio;

@mixin base($theme) {
.mat-mdc-radio-button {
@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());
}
}

@mixin color($theme) {
@include mdc-helpers.using-mdc-theme($theme) {
.mat-mdc-radio-button {
Expand Down Expand Up @@ -62,6 +70,7 @@

@mixin theme($theme) {
@include theming.private-check-duplicate-theme-styles($theme, 'mat-radio') {
@include base($theme);
@if inspection.theme-has($theme, color) {
@include color($theme);
}
Expand Down
3 changes: 0 additions & 3 deletions src/material/radio/radio.scss
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,6 @@
@include mdc-form-field.core-styles($query: mdc-helpers.$mdc-base-styles-query);

.mat-mdc-radio-button {
@include token-utils.create-token-values(
tokens-mat-radio.$prefix, tokens-mat-radio.get-unthemable-tokens());
@include mdc-radio-theme.theme(tokens-mdc-radio.get-unthemable-tokens());
-webkit-tap-highlight-color: transparent;

.mdc-radio {
Expand Down

0 comments on commit 943b5da

Please sign in to comment.