Skip to content

Commit 1c80ab1

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 55f9618 commit 1c80ab1

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
@@ -122,7 +122,7 @@
122122
@forward './slider/slider-theme' as slider-* show slider-theme, slider-color, slider-typography,
123123
slider-density, slider-base;
124124
@forward './snack-bar/snack-bar-theme' as snack-bar-* show snack-bar-theme, snack-bar-color,
125-
snack-bar-typography, snack-bar-density;
125+
snack-bar-typography, snack-bar-density, snack-bar-base;
126126
@forward './sort/sort-theme' as sort-* show sort-theme, sort-color, sort-typography, sort-density;
127127
@forward './stepper/stepper-theme' as stepper-* show stepper-theme, stepper-color,
128128
stepper-typography, stepper-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)