Skip to content

Commit c572dc4

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

File tree

3 files changed

+10
-4
lines changed

3 files changed

+10
-4
lines changed

src/material/_index.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@
165165
@forward './legacy-slider/slider-theme' as legacy-slider-* show legacy-slider-theme,
166166
legacy-slider-color, legacy-slider-typography;
167167
@forward './slider/slider-theme' as slider-* show slider-theme, slider-color, slider-typography,
168-
slider-density;
168+
slider-density, slider-base;
169169
@forward './snack-bar/snack-bar-theme' as snack-bar-* show snack-bar-theme, snack-bar-color,
170170
snack-bar-typography, snack-bar-density;
171171
@forward './legacy-snack-bar/snack-bar-theme' as legacy-snack-bar-* show legacy-snack-bar-theme,

src/material/slider/_slider-theme.scss

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,18 @@
33
@use '@material/slider/slider-theme' as mdc-slider-theme;
44
@use '../core/theming/theming';
55
@use '../core/typography/typography';
6+
@use '../core/style/sass-utils';
67
@use '../core/tokens/token-utils';
78
@use '../core/tokens/m2/mat/slider' as m2-mat-slider;
89
@use '../core/tokens/m2/mdc/slider' as m2-mdc-slider;
910

11+
@mixin base($config-or-theme) {
12+
// Add default values for tokens not related to color, typography, or density.
13+
@include sass-utils.current-selector-or-root() {
14+
@include mdc-slider-theme.theme(m2-mdc-slider.get-unthemable-tokens());
15+
}
16+
}
17+
1018
@mixin color($config-or-theme) {
1119
$config: theming.get-color-config($config-or-theme);
1220
$is-dark: map.get($config, is-dark);
@@ -74,6 +82,7 @@
7482
$density: theming.get-density-config($theme);
7583
$typography: theming.get-typography-config($theme);
7684

85+
@include base($theme);
7786
@if $color != null {
7887
@include color($color);
7988
}

src/material/slider/slider.scss

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,6 @@ $mat-slider-horizontal-margin: 8px !default;
3232
}
3333
}
3434

35-
// Add default values for MDC slider tokens that aren't outputted by the theming API.
36-
@include mdc-slider-theme.theme(m2-mdc-slider.get-unthemable-tokens());
37-
3835
display: inline-block;
3936
box-sizing: border-box;
4037
outline: none;

0 commit comments

Comments
 (0)