From 3430c4d7ef986476eb3b15751f822c5d4593f0d8 Mon Sep 17 00:00:00 2001 From: Miles Malerba Date: Mon, 23 Oct 2023 05:18:27 +0000 Subject: [PATCH] fix(material/form-field): move unthemable tokens to theme mixin (#27887) 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) --- src/material/form-field/_form-field-theme.scss | 12 +++++++++++- src/material/form-field/form-field.scss | 13 ------------- 2 files changed, 11 insertions(+), 14 deletions(-) diff --git a/src/material/form-field/_form-field-theme.scss b/src/material/form-field/_form-field-theme.scss index 624297f86a71..38312361346c 100644 --- a/src/material/form-field/_form-field-theme.scss +++ b/src/material/form-field/_form-field-theme.scss @@ -12,7 +12,17 @@ @use './form-field-density'; @mixin base($theme) { - // TODO(mmalerba): Move form field base tokens here + @include sass-utils.current-selector-or-root() { + @include token-utils.create-token-values( + tokens-mdc-filled-text-field.$prefix, + tokens-mdc-filled-text-field.get-unthemable-tokens()); + @include token-utils.create-token-values( + tokens-mdc-outlined-text-field.$prefix, + tokens-mdc-outlined-text-field.get-unthemable-tokens()); + @include token-utils.create-token-values( + tokens-mat-form-field.$prefix, + tokens-mat-form-field.get-unthemable-tokens()); + } } @mixin color($theme) { diff --git a/src/material/form-field/form-field.scss b/src/material/form-field/form-field.scss index e09cf5c67cc3..d4171f351946 100644 --- a/src/material/form-field/form-field.scss +++ b/src/material/form-field/form-field.scss @@ -15,7 +15,6 @@ @use '../core/tokens/m2/mat/form-field' as tokens-mat-form-field; @use '../core/tokens/m2/mdc/filled-text-field' as tokens-mdc-filled-text-field; @use '../core/tokens/m2/mdc/outlined-text-field' as tokens-mdc-outlined-text-field; -@use '../core/style/sass-utils'; @use './form-field-sizing'; @use './form-field-subscript'; @use './form-field-focus-overlay'; @@ -44,24 +43,12 @@ @include mdc-custom-properties.configure( $emit-fallback-values: false, $emit-fallback-vars: false) { - @include sass-utils.current-selector-or-root() { - @include token-utils.create-token-values( - tokens-mat-form-field.$prefix, - tokens-mat-form-field.get-unthemable-tokens()); - } - .mdc-text-field--filled { - @include token-utils.create-token-values( - tokens-mdc-filled-text-field.$prefix, - tokens-mdc-filled-text-field.get-unthemable-tokens()); @include mdc-filled-text-field-theme.theme-styles( tokens-mdc-filled-text-field.get-token-slots()); } .mdc-text-field--outlined { - @include token-utils.create-token-values( - tokens-mdc-outlined-text-field.$prefix, - tokens-mdc-outlined-text-field.get-unthemable-tokens()); @include mdc-outlined-text-field-theme.theme-styles( tokens-mdc-outlined-text-field.get-token-slots()); }