Skip to content

Commit

Permalink
fix(material/expansion): move unthemable tokens to theme mixin
Browse files Browse the repository at this point in the history
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.expansion-theme that are not
emitted by any of: mat.expansion-color, mat.expansion-typography,
mat.expansion-density. If you rely on the partial mixins only and don't
call mat.expansion-theme, you can add mat.expansion-base to get the
missing styles.
  • Loading branch information
mmalerba committed Oct 3, 2023
1 parent 2f958ac commit 865014a
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/material/_index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@
@forward './divider/divider-theme' as divider-* show divider-theme, divider-color,
divider-typography, divider-density;
@forward './expansion/expansion-theme' as expansion-* show expansion-theme, expansion-color,
expansion-typography, expansion-density;
expansion-typography, expansion-density, expansion-base;
@forward './form-field/form-field-theme' as form-field-* show form-field-theme,
form-field-color, form-field-typography, form-field-density;
@forward './grid-list/grid-list-theme' as grid-list-* show grid-list-theme, grid-list-color,
Expand Down
8 changes: 8 additions & 0 deletions src/material/expansion/_expansion-theme.scss
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@
@use '../core/tokens/token-utils';
@use '../core/tokens/m2/mat/expansion' as tokens-mat-expansion;

@mixin base($theme) {
@include sass-utils.current-selector-or-root() {
@include token-utils.create-token-values(
tokens-mat-expansion.$prefix, tokens-mat-expansion.get-unthemable-tokens());
}
}

@mixin color($theme) {
@include sass-utils.current-selector-or-root() {
@include token-utils.create-token-values(tokens-mat-expansion.$prefix,
Expand All @@ -31,6 +38,7 @@

@mixin theme($theme) {
@include theming.private-check-duplicate-theme-styles($theme, 'mat-expansion') {
@include base($theme);
@if inspection.theme-has($theme, color) {
@include color($theme);
}
Expand Down
2 changes: 0 additions & 2 deletions src/material/expansion/expansion-panel.scss
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
@use '../core/style/elevation';

.mat-expansion-panel {
@include token-utils.create-token-values(
tokens-mat-expansion.$prefix, tokens-mat-expansion.get-unthemable-tokens());
@include elevation.overridable-elevation(2);
box-sizing: content-box;
display: block;
Expand Down

0 comments on commit 865014a

Please sign in to comment.