Skip to content

Commit e056d1d

Browse files
asynclizcopybara-github
authored andcommitted
chore(textfield): move newly added tokens into Sass component tokens
PiperOrigin-RevId: 601397525
1 parent 3be7ca3 commit e056d1d

File tree

5 files changed

+47
-53
lines changed

5 files changed

+47
-53
lines changed

textfield/internal/_filled-text-field.scss

Lines changed: 1 addition & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,7 @@
2020
'container-shape-start-start',
2121
'container-shape-start-end',
2222
'container-shape-end-end',
23-
'container-shape-end-start',
24-
'leading-space',
25-
'trailing-space',
26-
'top-space',
27-
'bottom-space',
28-
'with-label-top-space',
29-
'with-label-bottom-space',
30-
'input-text-prefix-trailing-space',
31-
'input-text-suffix-leading-space',
32-
'focus-caret-color'
23+
'container-shape-end-start'
3324
)
3425
);
3526

@@ -50,23 +41,6 @@
5041

5142
@mixin styles() {
5243
$tokens: tokens.md-comp-filled-text-field-values();
53-
// Add missing tokens
54-
$tokens: map.merge(
55-
(
56-
'leading-space': 16px,
57-
'trailing-space': 16px,
58-
'top-space': 16px,
59-
'bottom-space': 16px,
60-
'input-text-prefix-trailing-space': 2px,
61-
'input-text-suffix-leading-space': 2px,
62-
'with-label-top-space': 8px,
63-
'with-label-bottom-space': 8px,
64-
// TODO(b/270705687): remove when focus-caret-color token added
65-
'focus-caret-color':
66-
map.get(tokens.md-sys-color-values-light(), 'primary'),
67-
),
68-
$tokens
69-
);
7044

7145
:host {
7246
@each $token, $value in $tokens {

textfield/internal/_outlined-text-field.scss

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,7 @@
1919
'container-shape-start-start',
2020
'container-shape-start-end',
2121
'container-shape-end-end',
22-
'container-shape-end-start',
23-
'leading-space',
24-
'trailing-space',
25-
'top-space',
26-
'bottom-space',
27-
'input-text-prefix-trailing-space',
28-
'input-text-suffix-leading-space',
29-
'focus-caret-color'
22+
'container-shape-end-start'
3023
)
3124
);
3225

@@ -43,21 +36,6 @@
4336

4437
@mixin styles() {
4538
$tokens: tokens.md-comp-outlined-text-field-values();
46-
// Add missing tokens
47-
$tokens: map.merge(
48-
(
49-
'leading-space': 16px,
50-
'trailing-space': 16px,
51-
'top-space': 16px,
52-
'bottom-space': 16px,
53-
'input-text-prefix-trailing-space': 2px,
54-
'input-text-suffix-leading-space': 2px,
55-
// TODO(b/270705687): remove when focus-caret-color token added
56-
'focus-caret-color':
57-
map.get(tokens.md-sys-color-values-light(), 'primary'),
58-
),
59-
$tokens
60-
);
6139

6240
:host {
6341
@each $token, $value in $tokens {

tokens/_md-comp-filled-text-field.scss

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ $supported-tokens: (
1919
// go/keep-sorted start
2020
'active-indicator-color',
2121
'active-indicator-height',
22+
'bottom-space',
2223
'caret-color',
2324
'container-color',
2425
'container-shape',
@@ -60,6 +61,7 @@ $supported-tokens: (
6061
'error-trailing-icon-color',
6162
'focus-active-indicator-color',
6263
'focus-active-indicator-height',
64+
'focus-caret-color',
6365
'focus-input-text-color',
6466
'focus-label-text-color',
6567
'focus-leading-icon-color',
@@ -79,8 +81,10 @@ $supported-tokens: (
7981
'input-text-line-height',
8082
'input-text-placeholder-color',
8183
'input-text-prefix-color',
84+
'input-text-prefix-trailing-space',
8285
'input-text-size',
8386
'input-text-suffix-color',
87+
'input-text-suffix-leading-space',
8488
'input-text-weight',
8589
'label-text-color',
8690
'label-text-font',
@@ -91,13 +95,18 @@ $supported-tokens: (
9195
'label-text-weight',
9296
'leading-icon-color',
9397
'leading-icon-size',
98+
'leading-space',
9499
'supporting-text-color',
95100
'supporting-text-font',
96101
'supporting-text-line-height',
97102
'supporting-text-size',
98103
'supporting-text-weight',
104+
'top-space',
99105
'trailing-icon-color',
100106
'trailing-icon-size',
107+
'trailing-space',
108+
'with-label-bottom-space',
109+
'with-label-top-space',
101110
// go/keep-sorted end
102111
);
103112

@@ -123,7 +132,21 @@ $_default: (
123132
$tokens: validate.values(
124133
md-comp-filled-text-field.values($deps, $exclude-hardcoded-values),
125134
$supported-tokens: $supported-tokens,
126-
$unsupported-tokens: $unsupported-tokens
135+
$unsupported-tokens: $unsupported-tokens,
136+
$new-tokens: (
137+
'leading-space': if($exclude-hardcoded-values, null, 16px),
138+
'trailing-space': if($exclude-hardcoded-values, null, 16px),
139+
'top-space': if($exclude-hardcoded-values, null, 16px),
140+
'bottom-space': if($exclude-hardcoded-values, null, 16px),
141+
'input-text-prefix-trailing-space':
142+
if($exclude-hardcoded-values, null, 2px),
143+
'input-text-suffix-leading-space':
144+
if($exclude-hardcoded-values, null, 2px),
145+
'with-label-top-space': if($exclude-hardcoded-values, null, 8px),
146+
'with-label-bottom-space': if($exclude-hardcoded-values, null, 8px),
147+
// TODO(b/270705687): remove when focus-caret-color token added
148+
'focus-caret-color': map.get($deps, 'md-sys-color', 'primary'),
149+
)
127150
);
128151

129152
$tokens: map.merge(

tokens/_md-comp-outlined-text-field.scss

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
$supported-tokens: (
1818
// go/keep-sorted start
19+
'bottom-space',
1920
'caret-color',
2021
'container-shape',
2122
'disabled-input-text-color',
@@ -50,6 +51,7 @@ $supported-tokens: (
5051
'error-outline-color',
5152
'error-supporting-text-color',
5253
'error-trailing-icon-color',
54+
'focus-caret-color',
5355
'focus-input-text-color',
5456
'focus-label-text-color',
5557
'focus-leading-icon-color',
@@ -69,8 +71,10 @@ $supported-tokens: (
6971
'input-text-line-height',
7072
'input-text-placeholder-color',
7173
'input-text-prefix-color',
74+
'input-text-prefix-trailing-space',
7275
'input-text-size',
7376
'input-text-suffix-color',
77+
'input-text-suffix-leading-space',
7478
'input-text-weight',
7579
'label-text-color',
7680
'label-text-font',
@@ -81,15 +85,18 @@ $supported-tokens: (
8185
'label-text-weight',
8286
'leading-icon-color',
8387
'leading-icon-size',
88+
'leading-space',
8489
'outline-color',
8590
'outline-width',
8691
'supporting-text-color',
8792
'supporting-text-font',
8893
'supporting-text-line-height',
8994
'supporting-text-size',
9095
'supporting-text-weight',
96+
'top-space',
9197
'trailing-icon-color',
9298
'trailing-icon-size',
99+
'trailing-space',
93100
// go/keep-sorted end
94101
);
95102

@@ -114,7 +121,19 @@ $_default: (
114121
$tokens: validate.values(
115122
md-comp-outlined-text-field.values($deps, $exclude-hardcoded-values),
116123
$supported-tokens: $supported-tokens,
117-
$unsupported-tokens: $unsupported-tokens
124+
$unsupported-tokens: $unsupported-tokens,
125+
$new-tokens: (
126+
'leading-space': if($exclude-hardcoded-values, null, 16px),
127+
'trailing-space': if($exclude-hardcoded-values, null, 16px),
128+
'top-space': if($exclude-hardcoded-values, null, 16px),
129+
'bottom-space': if($exclude-hardcoded-values, null, 16px),
130+
'input-text-prefix-trailing-space':
131+
if($exclude-hardcoded-values, null, 2px),
132+
'input-text-suffix-leading-space':
133+
if($exclude-hardcoded-values, null, 2px),
134+
// TODO(b/270705687): remove when focus-caret-color token added
135+
'focus-caret-color': map.get($deps, 'md-sys-color', 'primary'),
136+
)
118137
);
119138

120139
$tokens: map.merge(

tokens/internal/_validate.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@
9595

9696
@each $token in map.keys($values) {
9797
@if list.index($supported-tokens, $token) == null {
98-
@error 'validate.values($supported-tokens)) is missing the \'#{$token}\' token. Does it need adding to $unsupported-tokens?';
98+
@error 'validate.values($supported-tokens) is missing the \'#{$token}\' token. Does it need adding to $unsupported-tokens?';
9999
}
100100
}
101101

0 commit comments

Comments
 (0)