Skip to content

Commit 7ec37a6

Browse files
marissahuysentruytcastastrophe
authored andcommitted
chore(picker): remove window.isChromatic calls
1 parent ccaf35b commit 7ec37a6

File tree

2 files changed

+6
-31
lines changed

2 files changed

+6
-31
lines changed

.storybook/decorators/context.js

Lines changed: 5 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,13 @@ export const withContextWrapper = makeDecorator({
3131
color: "light"
3232
},
3333
"white": {
34-
background: "var(--spectrum-examples-gradient-static-white",
34+
background: "var(--spectrum-examples-gradient-static-white)",
3535
color: "dark"
3636
},
3737
};
3838

3939
const original = {
4040
color,
41-
context,
4241
scale,
4342
};
4443

@@ -57,7 +56,6 @@ export const withContextWrapper = makeDecorator({
5756

5857
// Reset the context to the original values
5958
color = original.color;
60-
context = original.context;
6159
scale = original.scale;
6260

6361
let staticKey = staticColor;
@@ -72,20 +70,7 @@ export const withContextWrapper = makeDecorator({
7270
if (!staticKey) hasStaticElement = false;
7371

7472
// Every container gets the spectrum class
75-
container.classList.toggle("spectrum", !isRaw);
76-
77-
// S1 and S1 Express get the legacy class
78-
container.classList.toggle("spectrum--legacy", !isModern && !isRaw);
79-
80-
// Express only gets the express class
81-
container.classList.toggle("spectrum--express", isExpress && !isRaw);
82-
83-
// Darkest is deprecated in Spectrum 2
84-
if (isModern && color === "darkest") {
85-
/* eslint-disable no-console -- notify that darkest was deprecated in S2 */
86-
console.warn("The 'darkest' color is deprecated in Spectrum 2. Please use 'dark' instead.");
87-
color = "dark";
88-
}
73+
container.classList.toggle("spectrum", true);
8974

9075
// Let the static color override the color if it's set
9176
if (!isTestingWrapper && hasStaticElement && staticColorSettings[staticKey]?.color) {
@@ -98,12 +83,12 @@ export const withContextWrapper = makeDecorator({
9883
color = "light";
9984
}
10085

101-
for (let c of ["light", "dark", "darkest"]) {
102-
container.classList.toggle(`spectrum--${c}`, c === color && !isRaw);
86+
for (let c of ["light", "dark"]) {
87+
container.classList.toggle(`spectrum--${c}`, c === color);
10388
}
10489

10590
for (const s of ["medium", "large"]) {
106-
container.classList.toggle(`spectrum--${s}`, s === scale && !isRaw);
91+
container.classList.toggle(`spectrum--${s}`, s === scale);
10792
}
10893

10994
if (!isTestingWrapper) {

components/picker/stories/template.js

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ export const Picker = ({
3535
customClasses = [],
3636
customStyles = {},
3737
} = {}, context = {}) => {
38-
const { updateArgs } = context;
3938

4039
// Use the chevron from the UI icon set for each size, as defined in the design spec.
4140
let disclosureIconName = "ChevronDown100";
@@ -64,10 +63,7 @@ export const Picker = ({
6463
id=${id}
6564
style=${styleMap(customStyles)}
6665
type="button"
67-
@click=${() => {
68-
if (window.isChromatic()) return;
69-
updateArgs({ isOpen: !isOpen });
70-
}}
66+
@click=${onclick}
7167
aria-labelledby=${ifDefined(ariaLabeledBy)}
7268
>
7369
${when(contentIconName, () =>
@@ -195,12 +191,6 @@ export const Template = ({
195191
}, context)
196192
)}
197193
</div>`;
198-
199-
// Make sure there is a wrapper around sibling components when using the Chromatic
200-
// template, so their layout is not affected by the flex and grid layouts used.
201-
if (window.isChromatic()) {
202-
return html`<div style="position: relative;">${markup}</div>`;
203-
}
204194
return markup;
205195
};
206196

0 commit comments

Comments
 (0)