Skip to content

Commit 42908a0

Browse files
Melissa Thompsoncastastrophe
authored andcommitted
feat(switch): s2 migration (#2651)
* feat(switch): s2 migration * chore: remove themes * fix: animation * fix: whcm light mode unchecked handle shows * docs(storybook): align chromatic setup with new standard * fix: checked corners for non-retina display * fix: whcm handle selected color * fix: namespace mods, use semantic tokens instead of global * fix: handle state colors
1 parent cb2a092 commit 42908a0

File tree

2 files changed

+322
-362
lines changed

2 files changed

+322
-362
lines changed

components/switch/dist/metadata.json

Lines changed: 118 additions & 90 deletions
Original file line numberDiff line numberDiff line change
@@ -2,114 +2,109 @@
22
"sourceFile": "index.css",
33
"selectors": [
44
".spectrum-Switch",
5+
".spectrum-Switch .spectrum-Switch-input:disabled + .spectrum-Switch-switch",
6+
".spectrum-Switch .spectrum-Switch-input:disabled + .spectrum-Switch-switch:before",
57
".spectrum-Switch .spectrum-Switch-input:disabled ~ .spectrum-Switch-label",
68
".spectrum-Switch .spectrum-Switch-input:disabled:checked + .spectrum-Switch-switch",
79
".spectrum-Switch .spectrum-Switch-input:disabled:checked + .spectrum-Switch-switch:before",
8-
".spectrum-Switch .spectrum-Switch-input:disabled:not(:checked) + .spectrum-Switch-switch",
9-
".spectrum-Switch .spectrum-Switch-input:disabled:not(:checked) + .spectrum-Switch-switch:before",
10-
".spectrum-Switch .spectrum-Switch-input:focus-visible + .spectrum-Switch-switch:after",
11-
".spectrum-Switch .spectrum-Switch-input:focus-visible + .spectrum-Switch-switch:before",
12-
".spectrum-Switch .spectrum-Switch-input:focus-visible ~ .spectrum-Switch-label",
13-
".spectrum-Switch .spectrum-Switch-input:focus-visible:checked + .spectrum-Switch-switch",
14-
".spectrum-Switch .spectrum-Switch-input:focus-visible:checked + .spectrum-Switch-switch:before",
15-
".spectrum-Switch .spectrum-Switch-input:not(:checked) + .spectrum-Switch-switch",
10+
".spectrum-Switch .spectrum-Switch-input[disabled] + .spectrum-Switch-switch",
11+
".spectrum-Switch .spectrum-Switch-input[disabled] + .spectrum-Switch-switch:before",
1612
".spectrum-Switch .spectrum-Switch-input[disabled] ~ .spectrum-Switch-label",
1713
".spectrum-Switch .spectrum-Switch-input[disabled]:checked + .spectrum-Switch-switch",
1814
".spectrum-Switch .spectrum-Switch-input[disabled]:checked + .spectrum-Switch-switch:before",
19-
".spectrum-Switch .spectrum-Switch-input[disabled]:not(:checked) + .spectrum-Switch-switch",
20-
".spectrum-Switch .spectrum-Switch-input[disabled]:not(:checked) + .spectrum-Switch-switch:before",
21-
".spectrum-Switch .spectrum-Switch-switch",
22-
".spectrum-Switch .spectrum-Switch-switch:before",
2315
".spectrum-Switch--disabled",
16+
".spectrum-Switch--emphasized",
2417
".spectrum-Switch--sizeL",
2518
".spectrum-Switch--sizeS",
2619
".spectrum-Switch--sizeXL",
2720
".spectrum-Switch-input",
2821
".spectrum-Switch-input:checked + .spectrum-Switch-switch",
2922
".spectrum-Switch-input:checked + .spectrum-Switch-switch:before",
30-
".spectrum-Switch-input:checked + .spectrum-Switch-switch:dir(rtl):before",
23+
".spectrum-Switch-input:checked + .spectrum-Switch-switch:before:dir(rtl)",
24+
".spectrum-Switch-input:checked:focus-visible + .spectrum-Switch-switch",
3125
".spectrum-Switch-input:disabled",
32-
".spectrum-Switch-input:disabled + .spectrum-Switch-switch",
33-
".spectrum-Switch-input:disabled + .spectrum-Switch-switch:before",
34-
".spectrum-Switch-input:disabled ~ .spectrum-Switch-label",
35-
".spectrum-Switch-input:disabled:checked + .spectrum-Switch-switch",
36-
".spectrum-Switch-input:disabled:checked + .spectrum-Switch-switch:before",
26+
".spectrum-Switch-input:focus-visible + .spectrum-Switch-switch",
3727
".spectrum-Switch-input:focus-visible + .spectrum-Switch-switch:after",
28+
".spectrum-Switch-input:focus-visible + .spectrum-Switch-switch:before",
29+
".spectrum-Switch-input:focus-visible ~ .spectrum-Switch-label",
3830
".spectrum-Switch-input[disabled]",
39-
".spectrum-Switch-input[disabled] + .spectrum-Switch-switch",
40-
".spectrum-Switch-input[disabled] + .spectrum-Switch-switch:before",
41-
".spectrum-Switch-input[disabled] ~ .spectrum-Switch-label",
42-
".spectrum-Switch-input[disabled]:checked + .spectrum-Switch-switch",
43-
".spectrum-Switch-input[disabled]:checked + .spectrum-Switch-switch:before",
4431
".spectrum-Switch-label",
32+
".spectrum-Switch-label:lang(ja)",
33+
".spectrum-Switch-label:lang(ko)",
34+
".spectrum-Switch-label:lang(zh)",
4535
".spectrum-Switch-switch",
4636
".spectrum-Switch-switch:after",
4737
".spectrum-Switch-switch:before",
48-
".spectrum-Switch.spectrum-Switch--emphasized",
49-
".spectrum-Switch:active .spectrum-Switch-input + .spectrum-Switch-switch:before",
50-
".spectrum-Switch:active .spectrum-Switch-input ~ .spectrum-Switch-label",
51-
".spectrum-Switch:active .spectrum-Switch-input:checked:enabled + .spectrum-Switch-switch",
52-
".spectrum-Switch:active .spectrum-Switch-input:checked:enabled + .spectrum-Switch-switch:before",
53-
".spectrum-Switch:hover .spectrum-Switch-input + .spectrum-Switch-switch:before",
54-
".spectrum-Switch:hover .spectrum-Switch-input ~ .spectrum-Switch-label",
55-
".spectrum-Switch:hover .spectrum-Switch-input:checked:enabled + .spectrum-Switch-switch",
56-
".spectrum-Switch:hover .spectrum-Switch-input:checked:enabled + .spectrum-Switch-switch:before",
38+
".spectrum-Switch:active .spectrum-Switch-input:checked + .spectrum-Switch-switch",
39+
".spectrum-Switch:active .spectrum-Switch-input:not(:disabled) + .spectrum-Switch-switch:before",
40+
".spectrum-Switch:active .spectrum-Switch-input:not(:disabled):checked + .spectrum-Switch-switch:before",
41+
".spectrum-Switch:active .spectrum-Switch-input:not(:disabled):checked + .spectrum-Switch-switch:before:dir(rtl)",
42+
".spectrum-Switch:active .spectrum-Switch-switch",
43+
".spectrum-Switch:active .spectrum-Switch-switch:before",
44+
".spectrum-Switch:active ~ .spectrum-Switch-label",
45+
".spectrum-Switch:hover .spectrum-Switch-input:checked + .spectrum-Switch-switch",
46+
".spectrum-Switch:hover .spectrum-Switch-input:checked + .spectrum-Switch-switch:before",
5747
".spectrum-Switch:hover .spectrum-Switch-input:disabled + .spectrum-Switch-switch",
5848
".spectrum-Switch:hover .spectrum-Switch-input:disabled + .spectrum-Switch-switch:before",
5949
".spectrum-Switch:hover .spectrum-Switch-input:disabled ~ .spectrum-Switch-label",
6050
".spectrum-Switch:hover .spectrum-Switch-input:disabled:checked + .spectrum-Switch-switch",
6151
".spectrum-Switch:hover .spectrum-Switch-input:disabled:checked + .spectrum-Switch-switch:before",
62-
".spectrum-Switch:hover .spectrum-Switch-input:disabled:checked ~ .spectrum-Switch-label",
63-
".spectrum-Switch:hover .spectrum-Switch-input:focus-visible + .spectrum-Switch-switch:after",
64-
".spectrum-Switch:hover .spectrum-Switch-input:focus-visible + .spectrum-Switch-switch:before",
65-
".spectrum-Switch:hover .spectrum-Switch-input:focus-visible ~ .spectrum-Switch-label",
66-
".spectrum-Switch:hover .spectrum-Switch-input:focus-visible:checked + .spectrum-Switch-switch",
67-
".spectrum-Switch:hover .spectrum-Switch-input:focus-visible:checked + .spectrum-Switch-switch:before",
68-
".spectrum-Switch:hover .spectrum-Switch-input:not(:checked) + .spectrum-Switch-switch",
6952
".spectrum-Switch:hover .spectrum-Switch-input[disabled] + .spectrum-Switch-switch",
7053
".spectrum-Switch:hover .spectrum-Switch-input[disabled] + .spectrum-Switch-switch:before",
7154
".spectrum-Switch:hover .spectrum-Switch-input[disabled] ~ .spectrum-Switch-label",
7255
".spectrum-Switch:hover .spectrum-Switch-input[disabled]:checked + .spectrum-Switch-switch",
7356
".spectrum-Switch:hover .spectrum-Switch-input[disabled]:checked + .spectrum-Switch-switch:before",
74-
".spectrum-Switch:hover .spectrum-Switch-input[disabled]:checked ~ .spectrum-Switch-label",
75-
"[dir=\"rtl\"] .spectrum-Switch-input:checked + .spectrum-Switch-switch:before"
57+
".spectrum-Switch:hover .spectrum-Switch-switch",
58+
".spectrum-Switch:hover .spectrum-Switch-switch:before",
59+
".spectrum-Switch:hover ~ .spectrum-Switch-label",
60+
"[dir=\"rtl\"] .spectrum-Switch-input:checked + .spectrum-Switch-switch:before",
61+
"[dir=\"rtl\"] .spectrum-Switch:active .spectrum-Switch-input:not(:disabled):checked + .spectrum-Switch-switch:before"
7662
],
7763
"modifiers": [
7864
"--mod-animation-duration-100",
79-
"--mod-animation-duration-200",
80-
"--mod-border-width-200",
81-
"--mod-focus-indicator-gap",
82-
"--mod-focus-indicator-thickness",
83-
"--mod-line-height-100",
8465
"--mod-switch-background-color",
8566
"--mod-switch-background-color-disabled",
8667
"--mod-switch-background-color-selected-default",
8768
"--mod-switch-background-color-selected-disabled",
8869
"--mod-switch-background-color-selected-down",
8970
"--mod-switch-background-color-selected-focus",
9071
"--mod-switch-background-color-selected-hover",
72+
"--mod-switch-border-color-default",
73+
"--mod-switch-border-color-disabled",
74+
"--mod-switch-border-color-down",
75+
"--mod-switch-border-color-focus",
76+
"--mod-switch-border-color-hover",
77+
"--mod-switch-border-color-selected-default",
78+
"--mod-switch-border-color-selected-down",
79+
"--mod-switch-border-color-selected-focus",
80+
"--mod-switch-border-color-selected-hover",
81+
"--mod-switch-border-radius",
82+
"--mod-switch-border-width",
83+
"--mod-switch-cjk-line-height",
9184
"--mod-switch-control-height",
9285
"--mod-switch-control-label-spacing",
9386
"--mod-switch-control-width",
9487
"--mod-switch-focus-indicator-color",
88+
"--mod-switch-focus-indicator-gap",
9589
"--mod-switch-focus-indicator-thickness",
9690
"--mod-switch-font-size",
97-
"--mod-switch-handle-background-color",
98-
"--mod-switch-handle-border-color-default",
99-
"--mod-switch-handle-border-color-disabled",
100-
"--mod-switch-handle-border-color-down",
101-
"--mod-switch-handle-border-color-focus",
102-
"--mod-switch-handle-border-color-hover",
103-
"--mod-switch-handle-border-color-selected-default",
104-
"--mod-switch-handle-border-color-selected-down",
105-
"--mod-switch-handle-border-color-selected-focus",
106-
"--mod-switch-handle-border-color-selected-hover",
91+
"--mod-switch-handle-background-color-default",
92+
"--mod-switch-handle-background-color-disabled",
93+
"--mod-switch-handle-background-color-down",
94+
"--mod-switch-handle-background-color-focus",
95+
"--mod-switch-handle-background-color-hover",
96+
"--mod-switch-handle-background-color-selected",
97+
"--mod-switch-handle-background-color-selected-disabled",
98+
"--mod-switch-handle-selected-size",
99+
"--mod-switch-handle-size",
107100
"--mod-switch-height",
108-
"--mod-switch-label-color-default",
101+
"--mod-switch-label-color",
109102
"--mod-switch-label-color-disabled",
110103
"--mod-switch-label-color-down",
111104
"--mod-switch-label-color-focus",
112105
"--mod-switch-label-color-hover",
106+
"--mod-switch-line-height",
107+
"--mod-switch-spacing-bottom-to-label",
113108
"--mod-switch-spacing-top-to-control",
114109
"--mod-switch-spacing-top-to-label"
115110
],
@@ -121,6 +116,18 @@
121116
"--spectrum-switch-background-color-selected-down",
122117
"--spectrum-switch-background-color-selected-focus",
123118
"--spectrum-switch-background-color-selected-hover",
119+
"--spectrum-switch-border-color-default",
120+
"--spectrum-switch-border-color-disabled",
121+
"--spectrum-switch-border-color-down",
122+
"--spectrum-switch-border-color-focus",
123+
"--spectrum-switch-border-color-hover",
124+
"--spectrum-switch-border-color-selected-default",
125+
"--spectrum-switch-border-color-selected-down",
126+
"--spectrum-switch-border-color-selected-focus",
127+
"--spectrum-switch-border-color-selected-hover",
128+
"--spectrum-switch-border-radius",
129+
"--spectrum-switch-border-width",
130+
"--spectrum-switch-cjk-line-height",
124131
"--spectrum-switch-control-height",
125132
"--spectrum-switch-control-height-extra-large",
126133
"--spectrum-switch-control-height-large",
@@ -133,24 +140,34 @@
133140
"--spectrum-switch-control-width-medium",
134141
"--spectrum-switch-control-width-small",
135142
"--spectrum-switch-focus-indicator-color",
143+
"--spectrum-switch-focus-indicator-gap",
136144
"--spectrum-switch-focus-indicator-thickness",
137145
"--spectrum-switch-font-size",
138-
"--spectrum-switch-handle-background-color",
139-
"--spectrum-switch-handle-border-color-default",
140-
"--spectrum-switch-handle-border-color-disabled",
141-
"--spectrum-switch-handle-border-color-down",
142-
"--spectrum-switch-handle-border-color-focus",
143-
"--spectrum-switch-handle-border-color-hover",
144-
"--spectrum-switch-handle-border-color-selected-default",
145-
"--spectrum-switch-handle-border-color-selected-down",
146-
"--spectrum-switch-handle-border-color-selected-focus",
147-
"--spectrum-switch-handle-border-color-selected-hover",
146+
"--spectrum-switch-handle-background-color-default",
147+
"--spectrum-switch-handle-background-color-disabled",
148+
"--spectrum-switch-handle-background-color-down",
149+
"--spectrum-switch-handle-background-color-focus",
150+
"--spectrum-switch-handle-background-color-hover",
151+
"--spectrum-switch-handle-background-color-selected",
152+
"--spectrum-switch-handle-background-color-selected-disabled",
153+
"--spectrum-switch-handle-selected-size",
154+
"--spectrum-switch-handle-selected-size-extra-large",
155+
"--spectrum-switch-handle-selected-size-large",
156+
"--spectrum-switch-handle-selected-size-medium",
157+
"--spectrum-switch-handle-selected-size-small",
158+
"--spectrum-switch-handle-size",
159+
"--spectrum-switch-handle-size-extra-large",
160+
"--spectrum-switch-handle-size-large",
161+
"--spectrum-switch-handle-size-medium",
162+
"--spectrum-switch-handle-size-small",
148163
"--spectrum-switch-label-color-default",
149164
"--spectrum-switch-label-color-disabled",
150165
"--spectrum-switch-label-color-down",
151166
"--spectrum-switch-label-color-focus",
152167
"--spectrum-switch-label-color-hover",
168+
"--spectrum-switch-line-height",
153169
"--spectrum-switch-min-height",
170+
"--spectrum-switch-spacing-bottom-to-label",
154171
"--spectrum-switch-spacing-top-to-control",
155172
"--spectrum-switch-spacing-top-to-label",
156173
"--spectrum-switch-top-to-control-extra-large",
@@ -159,20 +176,29 @@
159176
"--spectrum-switch-top-to-control-small"
160177
],
161178
"global": [
162-
"--spectrum-accent-color-1000",
163-
"--spectrum-accent-color-1100",
164-
"--spectrum-accent-color-900",
179+
"--spectrum-accent-background-color-default",
180+
"--spectrum-accent-background-color-down",
181+
"--spectrum-accent-background-color-hover",
182+
"--spectrum-accent-background-color-key-focus",
165183
"--spectrum-animation-duration-100",
166184
"--spectrum-animation-duration-200",
167185
"--spectrum-border-width-200",
186+
"--spectrum-cjk-line-height-100",
187+
"--spectrum-component-bottom-to-text-100",
188+
"--spectrum-component-bottom-to-text-200",
189+
"--spectrum-component-bottom-to-text-300",
190+
"--spectrum-component-bottom-to-text-75",
168191
"--spectrum-component-height-100",
169192
"--spectrum-component-height-200",
170193
"--spectrum-component-height-300",
171194
"--spectrum-component-height-75",
195+
"--spectrum-component-size-difference-down",
196+
"--spectrum-component-size-minimum-perspective-down",
172197
"--spectrum-component-top-to-text-100",
173198
"--spectrum-component-top-to-text-200",
174199
"--spectrum-component-top-to-text-300",
175200
"--spectrum-component-top-to-text-75",
201+
"--spectrum-corner-radius-full",
176202
"--spectrum-disabled-content-color",
177203
"--spectrum-focus-indicator-color",
178204
"--spectrum-focus-indicator-gap",
@@ -181,17 +207,12 @@
181207
"--spectrum-font-size-200",
182208
"--spectrum-font-size-300",
183209
"--spectrum-font-size-75",
184-
"--spectrum-gray-200",
185-
"--spectrum-gray-50",
186-
"--spectrum-gray-600",
187-
"--spectrum-gray-700",
188-
"--spectrum-gray-800",
189-
"--spectrum-gray-900",
210+
"--spectrum-gray-25",
190211
"--spectrum-line-height-100",
191-
"--spectrum-neutral-background-color-selected-default",
192-
"--spectrum-neutral-background-color-selected-down",
193-
"--spectrum-neutral-background-color-selected-hover",
194-
"--spectrum-neutral-background-color-selected-key-focus",
212+
"--spectrum-neutral-background-color-default",
213+
"--spectrum-neutral-background-color-down",
214+
"--spectrum-neutral-background-color-hover",
215+
"--spectrum-neutral-background-color-key-focus",
195216
"--spectrum-neutral-content-color-default",
196217
"--spectrum-neutral-content-color-down",
197218
"--spectrum-neutral-content-color-hover",
@@ -205,22 +226,29 @@
205226
"passthroughs": [],
206227
"high-contrast": [
207228
"--highcontrast-switch-background-color",
229+
"--highcontrast-switch-background-color-disabled",
208230
"--highcontrast-switch-background-color-selected-default",
209231
"--highcontrast-switch-background-color-selected-disabled",
210232
"--highcontrast-switch-background-color-selected-down",
211233
"--highcontrast-switch-background-color-selected-focus",
212234
"--highcontrast-switch-background-color-selected-hover",
235+
"--highcontrast-switch-border-color-default",
236+
"--highcontrast-switch-border-color-disabled",
237+
"--highcontrast-switch-border-color-down",
238+
"--highcontrast-switch-border-color-focus",
239+
"--highcontrast-switch-border-color-hover",
240+
"--highcontrast-switch-border-color-selected-default",
241+
"--highcontrast-switch-border-color-selected-down",
242+
"--highcontrast-switch-border-color-selected-focus",
243+
"--highcontrast-switch-border-color-selected-hover",
213244
"--highcontrast-switch-focus-indicator-color",
214-
"--highcontrast-switch-handle-background-color",
215-
"--highcontrast-switch-handle-border-color-default",
216-
"--highcontrast-switch-handle-border-color-disabled",
217-
"--highcontrast-switch-handle-border-color-down",
218-
"--highcontrast-switch-handle-border-color-focus",
219-
"--highcontrast-switch-handle-border-color-hover",
220-
"--highcontrast-switch-handle-border-color-selected-default",
221-
"--highcontrast-switch-handle-border-color-selected-down",
222-
"--highcontrast-switch-handle-border-color-selected-focus",
223-
"--highcontrast-switch-handle-border-color-selected-hover",
245+
"--highcontrast-switch-handle-background-color-default",
246+
"--highcontrast-switch-handle-background-color-disabled",
247+
"--highcontrast-switch-handle-background-color-down",
248+
"--highcontrast-switch-handle-background-color-focus",
249+
"--highcontrast-switch-handle-background-color-hover",
250+
"--highcontrast-switch-handle-background-color-selected",
251+
"--highcontrast-switch-handle-background-color-selected-disabled",
224252
"--highcontrast-switch-label-color-default",
225253
"--highcontrast-switch-label-color-disabled",
226254
"--highcontrast-switch-label-color-down",

0 commit comments

Comments
 (0)