Skip to content

Commit faed7b3

Browse files
committed
fix(material/form-field): 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.form-field-theme that are not emitted by any of: mat.form-field-color, mat.form-field-typography, mat.form-field-density. If you rely on the partial mixins only and don't call mat.form-field-theme, you can add mat.form-field-base to get the missing styles.
1 parent 2f958ac commit faed7b3

File tree

3 files changed

+16
-14
lines changed

3 files changed

+16
-14
lines changed

src/material/_index.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@
9494
@forward './expansion/expansion-theme' as expansion-* show expansion-theme, expansion-color,
9595
expansion-typography, expansion-density;
9696
@forward './form-field/form-field-theme' as form-field-* show form-field-theme,
97-
form-field-color, form-field-typography, form-field-density;
97+
form-field-color, form-field-typography, form-field-density, form-field-base;
9898
@forward './grid-list/grid-list-theme' as grid-list-* show grid-list-theme, grid-list-color,
9999
grid-list-typography, grid-list-density;
100100
@forward './icon/icon-theme' as icon-* show icon-theme, icon-color, icon-typography, icon-density;

src/material/form-field/_form-field-theme.scss

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,20 @@
1111
@use '../core/tokens/token-utils';
1212
@use './form-field-density';
1313

14+
@mixin base($theme) {
15+
@include sass-utils.current-selector-or-root() {
16+
@include token-utils.create-token-values(
17+
tokens-mdc-filled-text-field.$prefix,
18+
tokens-mdc-filled-text-field.get-unthemable-tokens());
19+
@include token-utils.create-token-values(
20+
tokens-mdc-outlined-text-field.$prefix,
21+
tokens-mdc-outlined-text-field.get-unthemable-tokens());
22+
@include token-utils.create-token-values(
23+
tokens-mat-form-field.$prefix,
24+
tokens-mat-form-field.get-unthemable-tokens());
25+
}
26+
}
27+
1428
@mixin color($theme) {
1529
@include sass-utils.current-selector-or-root() {
1630
@include mdc-filled-text-field-theme.theme(
@@ -57,6 +71,7 @@
5771

5872
@mixin theme($theme) {
5973
@include theming.private-check-duplicate-theme-styles($theme, 'mat-form-field') {
74+
@include base($theme);
6075
@if inspection.theme-has($theme, color) {
6176
@include color($theme);
6277
}

src/material/form-field/form-field.scss

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
@use '../core/tokens/m2/mat/form-field' as tokens-mat-form-field;
1616
@use '../core/tokens/m2/mdc/filled-text-field' as tokens-mdc-filled-text-field;
1717
@use '../core/tokens/m2/mdc/outlined-text-field' as tokens-mdc-outlined-text-field;
18-
@use '../core/style/sass-utils';
1918
@use './form-field-sizing';
2019
@use './form-field-subscript';
2120
@use './form-field-focus-overlay';
@@ -44,24 +43,12 @@
4443
@include mdc-custom-properties.configure(
4544
$emit-fallback-values: false, $emit-fallback-vars: false) {
4645

47-
@include sass-utils.current-selector-or-root() {
48-
@include token-utils.create-token-values(
49-
tokens-mat-form-field.$prefix,
50-
tokens-mat-form-field.get-unthemable-tokens());
51-
}
52-
5346
.mdc-text-field--filled {
54-
@include token-utils.create-token-values(
55-
tokens-mdc-filled-text-field.$prefix,
56-
tokens-mdc-filled-text-field.get-unthemable-tokens());
5747
@include mdc-filled-text-field-theme.theme-styles(
5848
tokens-mdc-filled-text-field.get-token-slots());
5949
}
6050

6151
.mdc-text-field--outlined {
62-
@include token-utils.create-token-values(
63-
tokens-mdc-outlined-text-field.$prefix,
64-
tokens-mdc-outlined-text-field.get-unthemable-tokens());
6552
@include mdc-outlined-text-field-theme.theme-styles(
6653
tokens-mdc-outlined-text-field.get-token-slots());
6754
}

0 commit comments

Comments
 (0)