Skip to content

Commit

Permalink
fix(material/form-field): move unthemable tokens to theme mixin (#27887)
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)
  • Loading branch information
mmalerba authored Oct 23, 2023
1 parent 1a56f09 commit 3430c4d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 14 deletions.
12 changes: 11 additions & 1 deletion src/material/form-field/_form-field-theme.scss
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
13 changes: 0 additions & 13 deletions src/material/form-field/form-field.scss
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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());
}
Expand Down

0 comments on commit 3430c4d

Please sign in to comment.