Skip to content

Commit 7c16cc8

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

File tree

3 files changed

+11
-6
lines changed

3 files changed

+11
-6
lines changed

src/material/_index.scss

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,8 @@
101101
@forward './icon/icon-theme' as icon-* show icon-theme, icon-color, icon-typography, icon-density;
102102
@forward './input/input-theme' as input-* show input-theme, input-color, input-typography,
103103
input-density;
104-
@forward './list/list-theme' as list-* show list-theme, list-color, list-typography, list-density;
104+
@forward './list/list-theme' as list-* show list-theme, list-color, list-typography,
105+
list-density, list-base;
105106
@forward './menu/menu-theme' as menu-* show menu-theme, menu-color, menu-typography, menu-density;
106107
@forward './paginator/paginator-theme' as paginator-* show paginator-theme, paginator-color,
107108
paginator-typography, paginator-density;

src/material/list/_list-theme.scss

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,21 @@
44
@use '@material/radio/radio-theme' as mdc-radio-theme;
55
@use '@material/list/list-theme' as mdc-list-theme;
66

7+
@use '../core/style/sass-utils';
78
@use '../core/theming/theming';
89
@use '../core/tokens/m2/mdc/checkbox' as tokens-mdc-checkbox;
910
@use '../core/tokens/m2/mdc/radio' as tokens-mdc-radio;
1011
@use '../core/tokens/m2/mdc/list' as tokens-mdc-list;
1112
@use '../core/typography/typography';
1213
@use '../core/typography/typography-utils';
1314

15+
@mixin base($config-or-theme) {
16+
// Add default values for tokens not related to color, typography, or density.
17+
@include sass-utils.current-selector-or-root() {
18+
@include mdc-list-theme.theme(tokens-mdc-list.get-unthemable-tokens());
19+
}
20+
}
21+
1422
@mixin color($config-or-theme) {
1523
$config: theming.get-color-config($config-or-theme);
1624
$primary: map.get($config, primary);
@@ -140,6 +148,7 @@
140148
$density: theming.get-density-config($theme);
141149
$typography: theming.get-typography-config($theme);
142150

151+
@include base($theme);
143152
@if $color != null {
144153
@include color($color);
145154
}

src/material/list/list.scss

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -75,11 +75,6 @@
7575
@include token-utils.create-token-slot(background-color, list-item-leading-avatar-color);
7676
}
7777
}
78-
79-
// Add default values for tokens that aren't outputted by the theming API.
80-
.mat-mdc-list-base {
81-
@include mdc-list-theme.theme(m2-mdc-list.get-unthemable-tokens());
82-
}
8378
}
8479

8580
a.mdc-list-item--activated {

0 commit comments

Comments
 (0)