Skip to content

Commit 23aad2d

Browse files
authored
refactor(storybook): drop unnecessary React logic (#9103)
**Related Issue:** N/A ## Summary This is no longer be needed after recent Storybook updates (see #8944 and #9030). ✨🧹✨
1 parent bf565d5 commit 23aad2d

File tree

5 files changed

+15
-132
lines changed

5 files changed

+15
-132
lines changed

package-lock.json

Lines changed: 0 additions & 86 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@
3232
"util:sync-linked-package-versions": "tsx support/syncLinkedPackageVersions.ts"
3333
},
3434
"devDependencies": {
35-
"@babel/preset-react": "7.24.1",
3635
"@cspell/eslint-plugin": "8.6.1",
3736
"@esri/calcite-base": "1.2.0",
3837
"@esri/calcite-colors": "6.1.0",

packages/calcite-components/.storybook/main.ts

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,7 @@ module.exports = {
2121
babel: async (options) => {
2222
return {
2323
...options,
24-
presets: [
25-
// we need to set this up to enable custom Storybook doc components
26-
// https://storybook.js.org/docs/html/writing-docs/docs-page#with-a-custom-component
27-
"@babel/preset-react",
28-
"@babel/preset-typescript",
29-
],
24+
presets: ["@babel/preset-typescript"],
3025
};
3126
},
3227

packages/calcite-components/.storybook/utils.tsx renamed to packages/calcite-components/.storybook/utils.ts

Lines changed: 2 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,5 @@
1-
/* @jsx React.createElement */
2-
31
import { CSS_UTILITY } from "../src/utils/resources";
4-
5-
import { Description, DocsPage } from "@storybook/addon-docs";
62
import { withThemeByClassName } from "@storybook/addon-themes";
7-
import React from "react";
83
import { Scale } from "../src/components/interfaces";
94
import { html } from "../support/formatting";
105
import { Breakpoints } from "../src/utils/responsive";
@@ -40,11 +35,7 @@ interface DeferredAttribute {
4035
commit: () => Attribute;
4136
}
4237

43-
export const createComponentHTML = (
44-
tagName: string,
45-
attributes: Attributes,
46-
contentHTML: string = "",
47-
): string =>
38+
export const createComponentHTML = (tagName: string, attributes: Attributes, contentHTML: string = ""): string =>
4839
`<${tagName} ${attributes
4940
.map(({ name, value }) => {
5041
const booleanAttr = typeof value === "boolean";
@@ -55,17 +46,7 @@ export const createComponentHTML = (
5546
})
5647
.join(" ")}>${contentHTML}</${tagName}>`;
5748

58-
export const globalDocsPage: typeof DocsPage = () => (
59-
<React.Fragment>
60-
{/* omit <Title /> as Description includes it (from component READMEs) */}
61-
<Description />
62-
</React.Fragment>
63-
);
64-
65-
export const filterComponentAttributes = (
66-
attributesList: DeferredAttribute[],
67-
exceptions: string[],
68-
): Attributes => {
49+
export const filterComponentAttributes = (attributesList: DeferredAttribute[], exceptions: string[]): Attributes => {
6950
if (!exceptions.length) {
7051
return attributesList.map((attr) => attr.commit());
7152
}

packages/calcite-components/src/components/slider/slider.e2e.ts

Lines changed: 12 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -300,9 +300,8 @@ describe("calcite-slider", () => {
300300
await page.mouse.up();
301301
await page.waitForChanges();
302302

303-
let isThumbFocused = await page.$eval(
304-
"calcite-slider",
305-
(slider) => slider.shadowRoot.activeElement?.classList.contains("thumb--value"),
303+
let isThumbFocused = await page.$eval("calcite-slider", (slider) =>
304+
slider.shadowRoot.activeElement?.classList.contains("thumb--value"),
306305
);
307306

308307
expect(isThumbFocused).toBe(true);
@@ -313,9 +312,8 @@ describe("calcite-slider", () => {
313312
await page.mouse.up();
314313
await page.waitForChanges();
315314

316-
isThumbFocused = await page.$eval(
317-
"calcite-slider",
318-
(slider) => slider.shadowRoot.activeElement?.classList.contains("thumb--value"),
315+
isThumbFocused = await page.$eval("calcite-slider", (slider) =>
316+
slider.shadowRoot.activeElement?.classList.contains("thumb--value"),
319317
);
320318

321319
expect(isThumbFocused).toBe(true);
@@ -326,9 +324,8 @@ describe("calcite-slider", () => {
326324
await page.mouse.up();
327325
await page.waitForChanges();
328326

329-
isThumbFocused = await page.$eval(
330-
"calcite-slider",
331-
(slider) => slider.shadowRoot.activeElement?.classList.contains("thumb--value"),
327+
isThumbFocused = await page.$eval("calcite-slider", (slider) =>
328+
slider.shadowRoot.activeElement?.classList.contains("thumb--value"),
332329
);
333330

334331
expect(isThumbFocused).toBe(true);
@@ -359,9 +356,8 @@ describe("calcite-slider", () => {
359356
await page.mouse.up();
360357
await page.waitForChanges();
361358

362-
const isMinThumbFocused = await page.$eval(
363-
"calcite-slider",
364-
(slider) => slider.shadowRoot.activeElement?.classList.contains("thumb--minValue"),
359+
const isMinThumbFocused = await page.$eval("calcite-slider", (slider) =>
360+
slider.shadowRoot.activeElement?.classList.contains("thumb--minValue"),
365361
);
366362

367363
expect(await slider.getProperty("minValue")).toBe(0);
@@ -382,9 +378,8 @@ describe("calcite-slider", () => {
382378
await page.mouse.up();
383379
await page.waitForChanges();
384380

385-
const isMaxThumbFocused = await page.$eval(
386-
"calcite-slider",
387-
(slider) => slider.shadowRoot.activeElement?.classList.contains("thumb--value"),
381+
const isMaxThumbFocused = await page.$eval("calcite-slider", (slider) =>
382+
slider.shadowRoot.activeElement?.classList.contains("thumb--value"),
388383
);
389384

390385
expect(await slider.getProperty("minValue")).toBe(0);
@@ -405,9 +400,8 @@ describe("calcite-slider", () => {
405400
await page.mouse.up();
406401
await page.waitForChanges();
407402

408-
const isMaxThumbFocused = await page.$eval(
409-
"calcite-slider",
410-
(slider) => slider.shadowRoot.activeElement?.classList.contains("thumb--value"),
403+
const isMaxThumbFocused = await page.$eval("calcite-slider", (slider) =>
404+
slider.shadowRoot.activeElement?.classList.contains("thumb--value"),
411405
);
412406

413407
expect(await slider.getProperty("minValue")).toBe(0);

0 commit comments

Comments
 (0)