Skip to content

Commit 7c79745

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

File tree

3 files changed

+9
-2
lines changed

3 files changed

+9
-2
lines changed

src/material/_index.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@
167167
@forward './slider/slider-theme' as slider-* show slider-theme, slider-color, slider-typography,
168168
slider-density;
169169
@forward './snack-bar/snack-bar-theme' as snack-bar-* show snack-bar-theme, snack-bar-color,
170-
snack-bar-typography, snack-bar-density;
170+
snack-bar-typography, snack-bar-density, snack-bar-base;
171171
@forward './legacy-snack-bar/snack-bar-theme' as legacy-snack-bar-* show legacy-snack-bar-theme,
172172
legacy-snack-bar-color, legacy-snack-bar-typography;
173173
@forward './sort/sort-theme' as sort-* show sort-theme, sort-color, sort-typography, sort-density;

src/material/snack-bar/_snack-bar-theme.scss

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,17 @@
11
@use '@material/snackbar/snackbar-theme' as mdc-snackbar-theme;
22
@use '../core/theming/theming';
3+
@use '../core/style/sass-utils';
34
@use '../core/typography/typography';
45
@use '../core/tokens/token-utils';
56
@use '../core/tokens/m2/mdc/snack-bar' as tokens-mdc-snack-bar;
67
@use '../core/tokens/m2/mat/snack-bar' as tokens-mat-snack-bar;
78

9+
@mixin base($config-or-theme) {
10+
// Add default values for tokens not related to color, typography, or density.
11+
@include sass-utils.current-selector-or-root() {
12+
@include mdc-snackbar-theme.theme(tokens-mdc-snack-bar.get-unthemable-tokens());
13+
}
14+
}
815

916
@mixin color($config-or-theme) {
1017
$config: theming.get-color-config($config-or-theme);
@@ -36,6 +43,7 @@
3643
$density: theming.get-density-config($theme);
3744
$typography: theming.get-typography-config($theme);
3845

46+
@include base($theme);
3947
@if $color != null {
4048
@include color($color);
4149
}

src/material/snack-bar/snack-bar-container.scss

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@
4747
// surface element.
4848
@include mdc-snackbar-theme.elevation(mdc-snackbar-theme.$elevation);
4949
@include mdc-snackbar-theme.theme-styles(tokens-mdc-snack-bar.get-token-slots());
50-
@include mdc-snackbar-theme.theme(tokens-mdc-snack-bar.get-unthemable-tokens());
5150

5251
// MDC sets the position as fixed and sets the container on the bottom center of the page (or
5352
// otherwise can be set to be "leading"). Our overlay handles a more advanced configuration

0 commit comments

Comments
 (0)