Skip to content

Commit

Permalink
fix(material/progress-spinner): Move unthemable tokens to theme mixin (
Browse files Browse the repository at this point in the history
…#27567)

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.progress-spinner-theme that are not
emitted by any of: mat.progress-spinner-color, mat.progress-spinner-typography,
mat.progress-spinner-density. If you rely on the partial mixins only and don't
call mat.progress-spinner-theme, you can add mat.progress-spinner-base to get the
missing styles.
  • Loading branch information
amysorto authored Aug 4, 2023
1 parent ccd2d7f commit 593fc79
Show file tree
Hide file tree
Showing 3 changed files with 12 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 @@ -143,7 +143,7 @@
progress-bar-density, progress-bar-base;
@forward './progress-spinner/progress-spinner-theme' as progress-spinner-* show
progress-spinner-theme, progress-spinner-color, progress-spinner-typography,
progress-spinner-density;
progress-spinner-density, progress-spinner-base;
@forward './legacy-progress-spinner/progress-spinner-theme' as legacy-progress-spinner-* show
legacy-progress-spinner-theme, legacy-progress-spinner-color, legacy-progress-spinner-typography;
@forward './radio/radio-theme' as radio-* show radio-theme, radio-color, radio-typography,
Expand Down
11 changes: 11 additions & 0 deletions src/material/progress-spinner/_progress-spinner-theme.scss
Original file line number Diff line number Diff line change
@@ -1,8 +1,18 @@
@use 'sass:map';
@use '../core/style/sass-utils';
@use '../core/theming/theming';
@use '../core/tokens/m2/mdc/circular-progress' as tokens-mdc-circular-progress;
@use '@material/circular-progress/circular-progress-theme' as mdc-circular-progress-theme;

@mixin base($config-or-theme) {
// Add default values for tokens not related to color, typography, or density.
@include sass-utils.current-selector-or-root() {
@include mdc-circular-progress-theme.theme(
tokens-mdc-circular-progress.get-unthemable-tokens()
);
}
}

@mixin color($config-or-theme) {
$config: theming.get-color-config($config-or-theme);
$mdc-circular-progress-color-tokens: tokens-mdc-circular-progress.get-color-tokens($config);
Expand Down Expand Up @@ -33,6 +43,7 @@
$density: theming.get-density-config($theme);
$typography: theming.get-typography-config($theme);

@include base($theme);
@if $color != null {
@include color($color);
}
Expand Down
3 changes: 0 additions & 3 deletions src/material/progress-spinner/progress-spinner.scss
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@
.mat-mdc-progress-spinner {
// Add the official slots for the MDC circular progress.
@include mdc-circular-progress-theme.theme-styles($mdc-circular-progress-token-slots);

// Add default values for tokens that aren't outputted by the theming API.
@include mdc-circular-progress-theme.theme(m2-mdc-circular-progress.get-unthemable-tokens());
}
}

Expand Down

0 comments on commit 593fc79

Please sign in to comment.