Skip to content

Commit 0474040

Browse files
authored
fix(material/progress-bar): Move unthemable tokens to theme mixin (#27563)
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-bar-theme that are not emitted by any of: mat.progress-bar-color, mat.progress-bar-typography, mat.progress-bar-density. If you rely on the partial mixins only and don't call mat.progress-bar-theme, you can add mat.progress-bar-base to get the missing styles.
1 parent 98f610d commit 0474040

3 files changed

Lines changed: 11 additions & 7 deletions

File tree

src/material/_index.scss

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,8 @@
139139
@forward './legacy-progress-bar/progress-bar-theme' as legacy-progress-bar-* show
140140
legacy-progress-bar-theme, legacy-progress-bar-color, legacy-progress-bar-typography;
141141
@forward './progress-bar/progress-bar-theme' as progress-bar-* show
142-
progress-bar-theme, progress-bar-color, progress-bar-typography, progress-bar-density;
142+
progress-bar-theme, progress-bar-color, progress-bar-typography,
143+
progress-bar-density, progress-bar-base;
143144
@forward './progress-spinner/progress-spinner-theme' as progress-spinner-* show
144145
progress-spinner-theme, progress-spinner-color, progress-spinner-typography,
145146
progress-spinner-density;

src/material/progress-bar/_progress-bar-theme.scss

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,16 @@
1+
@use '../core/style/sass-utils';
12
@use '../core/theming/theming';
23
@use '../core/tokens/m2/mdc/linear-progress' as tokens-mdc-linear-progress;
34
@use '@material/linear-progress/linear-progress-theme' as mdc-linear-progress-theme;
45
@use 'sass:map';
56

7+
@mixin base($config-or-theme) {
8+
// Add default values for tokens not related to color, typography, or density.
9+
@include sass-utils.current-selector-or-root() {
10+
@include mdc-linear-progress-theme.theme(tokens-mdc-linear-progress.get-unthemable-tokens());
11+
}
12+
}
13+
614
@mixin _palette-styles($config, $palette-name) {
715
$palette-config: map.merge($config, (primary: map.get($config, $palette-name)));
816
$color-tokens: tokens-mdc-linear-progress.get-color-tokens($palette-config);
@@ -49,6 +57,7 @@
4957
$density: theming.get-density-config($theme);
5058
$typography: theming.get-typography-config($theme);
5159

60+
@include base($theme);
5261
@if $color != null {
5362
@include color($color);
5463
}

src/material/progress-bar/progress-bar.scss

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,6 @@
1717
track-color: null,
1818
))
1919
);
20-
21-
// Add default values for tokens that aren't outputted by the theming API.
22-
.mat-mdc-progress-bar {
23-
// Add default values for tokens that aren't outputted by the theming API.
24-
@include mdc-linear-progress-theme.theme(m2-mdc-linear-progress.get-unthemable-tokens());
25-
}
2620
}
2721

2822
.mat-mdc-progress-bar {

0 commit comments

Comments
 (0)