Skip to content

Commit 4ac1f76

Browse files
AndrewJakubowiczcopybara-github
authored andcommitted
chore: refactor slider tokens to follow best practices
PiperOrigin-RevId: 546940817
1 parent 7d91950 commit 4ac1f76

File tree

1 file changed

+48
-2
lines changed

1 file changed

+48
-2
lines changed

tokens/_md-comp-slider.scss

Lines changed: 48 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,50 @@
1313
@use './md-sys-state';
1414
@use './md-sys-typescale';
1515
@use './v0_172/md-comp-slider';
16+
@use './values';
1617
// go/keep-sorted end
1718

19+
$supported-tokens: (
20+
// go/keep-sorted start
21+
'active-track-color',
22+
'active-track-height',
23+
'active-track-shape',
24+
'disabled-active-track-color',
25+
'disabled-active-track-opacity',
26+
'disabled-handle-color',
27+
'disabled-handle-elevation',
28+
'disabled-inactive-track-color',
29+
'disabled-inactive-track-opacity',
30+
'focus-handle-color',
31+
'handle-color',
32+
'handle-elevation',
33+
'handle-height',
34+
'handle-shadow-color',
35+
'handle-shape',
36+
'handle-width',
37+
'hover-handle-color',
38+
'hover-state-layer-color',
39+
'hover-state-layer-opacity',
40+
'inactive-track-color',
41+
'inactive-track-height',
42+
'inactive-track-shape',
43+
'label-container-color',
44+
'label-container-height',
45+
'label-label-text-color',
46+
'label-label-text-type',
47+
'pressed-handle-color',
48+
'pressed-state-layer-color',
49+
'pressed-state-layer-opacity',
50+
'state-layer-size',
51+
'with-overlap-handle-outline-color',
52+
'with-overlap-handle-outline-width',
53+
'with-tick-marks-active-container-color',
54+
'with-tick-marks-container-size',
55+
'with-tick-marks-disabled-container-color',
56+
'with-tick-marks-inactive-container-color',
57+
// go/keep-sorted end
58+
);
59+
1860
$_default: (
1961
'md-sys-color': md-sys-color.values-light(),
2062
'md-sys-elevation': md-sys-elevation.values(),
@@ -44,8 +86,11 @@ $_unsupported-tokens: (
4486
);
4587

4688
@function values($deps: $_default, $exclude-hardcoded-values: false) {
47-
$tokens: md-comp-slider.values($deps, $exclude-hardcoded-values);
48-
$tokens: map.remove($tokens, $_unsupported-tokens...);
89+
$tokens: values.validate(
90+
md-comp-slider.values($deps, $exclude-hardcoded-values),
91+
$supported-tokens: $supported-tokens,
92+
$unsupported-tokens: $_unsupported-tokens
93+
);
4994

5095
// TODO(b/271876162): remove when tokens compiler emits typescale tokens
5196
$tokens: map.merge(
@@ -55,5 +100,6 @@ $_unsupported-tokens: (
55100
map.get($deps, 'md-sys-typescale', 'label-medium'),
56101
)
57102
);
103+
58104
@return $tokens;
59105
}

0 commit comments

Comments
 (0)