From cff69b3323a881ab1ca28c797d214731e22aa601 Mon Sep 17 00:00:00 2001 From: Amy Sorto <8575252+amysorto@users.noreply.github.com> Date: Tue, 8 Aug 2023 23:55:36 +0000 Subject: [PATCH] fix(material/list): 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.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. --- src/material/_index.scss | 3 ++- src/material/list/_list-theme.scss | 9 +++++++++ src/material/list/list.scss | 5 ----- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/src/material/_index.scss b/src/material/_index.scss index 8aef4a5a4f4b..d81fbd494691 100644 --- a/src/material/_index.scss +++ b/src/material/_index.scss @@ -101,7 +101,8 @@ @forward './icon/icon-theme' as icon-* show icon-theme, icon-color, icon-typography, icon-density; @forward './input/input-theme' as input-* show input-theme, input-color, input-typography, input-density; -@forward './list/list-theme' as list-* show list-theme, list-color, list-typography, list-density; +@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 './paginator/paginator-theme' as paginator-* show paginator-theme, paginator-color, paginator-typography, paginator-density; diff --git a/src/material/list/_list-theme.scss b/src/material/list/_list-theme.scss index 15064663a5ee..2cc037bca894 100644 --- a/src/material/list/_list-theme.scss +++ b/src/material/list/_list-theme.scss @@ -4,6 +4,7 @@ @use '@material/radio/radio-theme' as mdc-radio-theme; @use '@material/list/list-theme' as mdc-list-theme; +@use '../core/style/sass-utils'; @use '../core/theming/theming'; @use '../core/tokens/m2/mdc/checkbox' as tokens-mdc-checkbox; @use '../core/tokens/m2/mdc/radio' as tokens-mdc-radio; @@ -11,6 +12,13 @@ @use '../core/typography/typography'; @use '../core/typography/typography-utils'; +@mixin base($config-or-theme) { + // Add default values for tokens not related to color, typography, or density. + @include sass-utils.current-selector-or-root() { + @include mdc-list-theme.theme(tokens-mdc-list.get-unthemable-tokens()); + } +} + @mixin color($config-or-theme) { $config: theming.get-color-config($config-or-theme); $primary: map.get($config, primary); @@ -140,6 +148,7 @@ $density: theming.get-density-config($theme); $typography: theming.get-typography-config($theme); + @include base($theme); @if $color != null { @include color($color); } diff --git a/src/material/list/list.scss b/src/material/list/list.scss index c852822a10c9..11a3587808b8 100644 --- a/src/material/list/list.scss +++ b/src/material/list/list.scss @@ -75,11 +75,6 @@ @include token-utils.create-token-slot(background-color, list-item-leading-avatar-color); } } - - // Add default values for tokens that aren't outputted by the theming API. - .mat-mdc-list-base { - @include mdc-list-theme.theme(m2-mdc-list.get-unthemable-tokens()); - } } a.mdc-list-item--activated {