diff --git a/src/material/_index.scss b/src/material/_index.scss index 10e11d74c54e..7e9b5232969e 100644 --- a/src/material/_index.scss +++ b/src/material/_index.scss @@ -94,7 +94,7 @@ @forward './expansion/expansion-theme' as expansion-* show expansion-theme, expansion-color, expansion-typography, expansion-density; @forward './form-field/form-field-theme' as form-field-* show form-field-theme, - form-field-color, form-field-typography, form-field-density; + form-field-color, form-field-typography, form-field-density, form-field-base; @forward './grid-list/grid-list-theme' as grid-list-* show grid-list-theme, grid-list-color, grid-list-typography, grid-list-density; @forward './icon/icon-theme' as icon-* show icon-theme, icon-color, icon-typography, icon-density; diff --git a/src/material/form-field/_form-field-theme.scss b/src/material/form-field/_form-field-theme.scss index 5498d1a9ba1f..38312361346c 100644 --- a/src/material/form-field/_form-field-theme.scss +++ b/src/material/form-field/_form-field-theme.scss @@ -11,6 +11,20 @@ @use '../core/tokens/token-utils'; @use './form-field-density'; +@mixin base($theme) { + @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) { @include sass-utils.current-selector-or-root() { @include mdc-filled-text-field-theme.theme( @@ -57,6 +71,7 @@ @mixin theme($theme) { @include theming.private-check-duplicate-theme-styles($theme, 'mat-form-field') { + @include base($theme); @if inspection.theme-has($theme, color) { @include color($theme); } diff --git a/src/material/form-field/form-field.scss b/src/material/form-field/form-field.scss index e09cf5c67cc3..658004519531 100644 --- a/src/material/form-field/form-field.scss +++ b/src/material/form-field/form-field.scss @@ -44,24 +44,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()); }