Skip to content

Commit de65eb9

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 34abca0 commit de65eb9

File tree

2 files changed

+357
-353
lines changed

2 files changed

+357
-353
lines changed

components/switch/dist/metadata.json

Lines changed: 117 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,16 @@
22
"sourceFile": "index.css",
33
"selectors": [
44
".spectrum-Switch",
5-
".spectrum-Switch + .spectrum-Switch-switch:after",
6-
".spectrum-Switch + .spectrum-Switch-switch:before",
5+
".spectrum-Switch .spectrum-Switch-input:disabled + .spectrum-Switch-switch",
6+
".spectrum-Switch .spectrum-Switch-input:disabled + .spectrum-Switch-switch:before",
77
".spectrum-Switch .spectrum-Switch-input:disabled ~ .spectrum-Switch-label",
88
".spectrum-Switch .spectrum-Switch-input:disabled:checked + .spectrum-Switch-switch",
99
".spectrum-Switch .spectrum-Switch-input:disabled:checked + .spectrum-Switch-switch:before",
10-
".spectrum-Switch .spectrum-Switch-input:disabled:not(:checked) + .spectrum-Switch-switch",
11-
".spectrum-Switch .spectrum-Switch-input:disabled:not(:checked) + .spectrum-Switch-switch:before",
12-
".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",
1312
".spectrum-Switch .spectrum-Switch-input[disabled] ~ .spectrum-Switch-label",
1413
".spectrum-Switch .spectrum-Switch-input[disabled]:checked + .spectrum-Switch-switch",
1514
".spectrum-Switch .spectrum-Switch-input[disabled]:checked + .spectrum-Switch-switch:before",
16-
".spectrum-Switch .spectrum-Switch-input[disabled]:not(:checked) + .spectrum-Switch-switch",
17-
".spectrum-Switch .spectrum-Switch-input[disabled]:not(:checked) + .spectrum-Switch-switch:before",
18-
".spectrum-Switch .spectrum-Switch-switch",
19-
".spectrum-Switch .spectrum-Switch-switch:before",
20-
".spectrum-Switch ~ .spectrum-Switch-label",
2115
".spectrum-Switch--disabled",
2216
".spectrum-Switch--emphasized",
2317
".spectrum-Switch--sizeL",
@@ -26,90 +20,91 @@
2620
".spectrum-Switch-input",
2721
".spectrum-Switch-input:checked + .spectrum-Switch-switch",
2822
".spectrum-Switch-input:checked + .spectrum-Switch-switch:before",
29-
".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",
3025
".spectrum-Switch-input:disabled",
31-
".spectrum-Switch-input:disabled + .spectrum-Switch-switch",
32-
".spectrum-Switch-input:disabled + .spectrum-Switch-switch:before",
33-
".spectrum-Switch-input:disabled ~ .spectrum-Switch-label",
34-
".spectrum-Switch-input:disabled:checked + .spectrum-Switch-switch",
35-
".spectrum-Switch-input:disabled:checked + .spectrum-Switch-switch:before",
26+
".spectrum-Switch-input:focus-visible + .spectrum-Switch-switch",
3627
".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",
3730
".spectrum-Switch-input[disabled]",
38-
".spectrum-Switch-input[disabled] + .spectrum-Switch-switch",
39-
".spectrum-Switch-input[disabled] + .spectrum-Switch-switch:before",
40-
".spectrum-Switch-input[disabled] ~ .spectrum-Switch-label",
41-
".spectrum-Switch-input[disabled]:checked + .spectrum-Switch-switch",
42-
".spectrum-Switch-input[disabled]:checked + .spectrum-Switch-switch:before",
4331
".spectrum-Switch-label",
32+
".spectrum-Switch-label:lang(ja)",
33+
".spectrum-Switch-label:lang(ko)",
34+
".spectrum-Switch-label:lang(zh)",
4435
".spectrum-Switch-switch",
4536
".spectrum-Switch-switch:after",
4637
".spectrum-Switch-switch:before",
47-
".spectrum-Switch:active .spectrum-Switch-input + .spectrum-Switch-switch:before",
48-
".spectrum-Switch:active .spectrum-Switch-input ~ .spectrum-Switch-label",
49-
".spectrum-Switch:active .spectrum-Switch-input:checked:enabled + .spectrum-Switch-switch",
50-
".spectrum-Switch:active .spectrum-Switch-input:checked:enabled + .spectrum-Switch-switch:before",
51-
".spectrum-Switch:checked + .spectrum-Switch-switch",
52-
".spectrum-Switch:checked + .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,13 +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",
210+
"--spectrum-gray-25",
186211
"--spectrum-line-height-100",
187-
"--spectrum-neutral-background-color-selected-default",
188-
"--spectrum-neutral-background-color-selected-down",
189-
"--spectrum-neutral-background-color-selected-hover",
190-
"--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",
191216
"--spectrum-neutral-content-color-default",
192217
"--spectrum-neutral-content-color-down",
193218
"--spectrum-neutral-content-color-hover",
@@ -201,22 +226,30 @@
201226
"passthroughs": [],
202227
"high-contrast": [
203228
"--highcontrast-switch-background-color",
229+
"--highcontrast-switch-background-color-disabled",
204230
"--highcontrast-switch-background-color-selected-default",
205231
"--highcontrast-switch-background-color-selected-disabled",
206232
"--highcontrast-switch-background-color-selected-down",
207233
"--highcontrast-switch-background-color-selected-focus",
208234
"--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",
209244
"--highcontrast-switch-focus-indicator-color",
210245
"--highcontrast-switch-handle-background-color",
211-
"--highcontrast-switch-handle-border-color-default",
212-
"--highcontrast-switch-handle-border-color-disabled",
213-
"--highcontrast-switch-handle-border-color-down",
214-
"--highcontrast-switch-handle-border-color-focus",
215-
"--highcontrast-switch-handle-border-color-hover",
216-
"--highcontrast-switch-handle-border-color-selected-default",
217-
"--highcontrast-switch-handle-border-color-selected-down",
218-
"--highcontrast-switch-handle-border-color-selected-focus",
219-
"--highcontrast-switch-handle-border-color-selected-hover",
246+
"--highcontrast-switch-handle-background-color-default",
247+
"--highcontrast-switch-handle-background-color-disabled",
248+
"--highcontrast-switch-handle-background-color-down",
249+
"--highcontrast-switch-handle-background-color-focus",
250+
"--highcontrast-switch-handle-background-color-hover",
251+
"--highcontrast-switch-handle-background-color-selected",
252+
"--highcontrast-switch-handle-background-color-selected-disabled",
220253
"--highcontrast-switch-label-color-default",
221254
"--highcontrast-switch-label-color-disabled",
222255
"--highcontrast-switch-label-color-down",

0 commit comments

Comments
 (0)