Skip to content

Commit

Permalink
fix(material/menu): move unthemable tokens to theme mixin (#27888)
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.menu-theme that are not
emitted by any of: mat.menu-color, mat.menu-typography,
mat.menu-density. If you rely on the partial mixins only and don't
call mat.menu-theme, you can add mat.menu-base to get the
missing styles.
  • Loading branch information
mmalerba authored Oct 5, 2023
1 parent 999029a commit c77ffa0
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 @@ -103,7 +103,7 @@
input-density, input-base;
@forward './list/list-theme' as list-* show list-theme, list-color, list-typography,
list-density, list-base;
@forward './menu/menu-theme' as menu-* show menu-theme, menu-color, menu-typography, menu-density;
@forward './menu/menu-theme' as menu-* show menu-theme, menu-color, menu-typography, menu-density, menu-base;
@forward './paginator/paginator-theme' as paginator-* show paginator-theme, paginator-color,
paginator-typography, paginator-density, paginator-base;
@forward './progress-bar/progress-bar-theme' as progress-bar-* show
Expand Down
8 changes: 8 additions & 0 deletions src/material/menu/_menu-theme.scss
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@
@use '../core/theming/inspection';
@use '../core/typography/typography';

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

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

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

.mat-mdc-menu-panel {
@include token-utils.create-token-values(tokens-mat-menu.$prefix,
tokens-mat-menu.get-unthemable-tokens());
@include menu-common.base;
box-sizing: border-box;
outline: 0;
Expand Down

0 comments on commit c77ffa0

Please sign in to comment.