Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion .storybook/interaction-toggle/reduced-motion.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { useCallback, useEffect, useState } from "react";

import { IconButton } from "@storybook/components";
import { IconButton } from "storybook/internal/components";
import { CheckIcon, CrossIcon } from "@storybook/icons";
import { INTERACTION_TOGGLE_TOOL_ID } from "./constants";

Expand Down
6 changes: 0 additions & 6 deletions .storybook/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,6 @@ const config: StorybookConfig = {

addons: [
"@storybook/addon-a11y",
"@storybook/addon-actions",
"@storybook/addon-controls",
{
name: "@storybook/addon-docs",
options: {
Expand All @@ -52,11 +50,7 @@ const config: StorybookConfig = {
},
},
},
"@storybook/addon-interactions",
"storybook-addon-pseudo-states",
"@storybook/addon-essentials",
"@storybook/addon-toolbars",
"@storybook/addon-viewport",
"@chromatic-com/storybook",
],

Expand Down
14 changes: 1 addition & 13 deletions .storybook/manager.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { addons, types } from "@storybook/manager-api";
import { addons, types } from "storybook/manager-api";
import sageTheme from "./sage-docs-theme";
import { ADDON_ID, TOOL_ID } from "./version-picker/constants";
import {
Expand All @@ -7,7 +7,6 @@ import {
} from "./interaction-toggle/constants";
import { InteractionToggle } from "./interaction-toggle/reduced-motion";
import { VersionPicker } from "./version-picker";
import { API_PreparedIndexEntry, API_StatusObject } from "@storybook/types";

const useVersionPicker = process.env.USE_VERSION_PICKER === "true";

Expand All @@ -34,15 +33,4 @@ addons.register(INTERACTION_TOGGLE_ADDON_ID, () => {
addons.setConfig({
theme: sageTheme,
panelPosition: "bottom",
sidebar: {
filters: {
patterns: (
item: API_PreparedIndexEntry & {
status: Record<string, API_StatusObject | null>;
},
): boolean => {
return !(item.tags ?? []).includes("hideInSidebar");
},
},
},
});
4 changes: 2 additions & 2 deletions .storybook/preview.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Preview } from "@storybook/react";
import { configure } from "@storybook/test";
import { Preview } from "@storybook/react-vite";
import { configure } from "storybook/test";

import "../src/style/fonts.css";

Expand Down
2 changes: 1 addition & 1 deletion .storybook/sage-docs-theme.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { create } from "@storybook/theming/create";
import { create } from "storybook/theming/create";

export default create({
base: "light",
Expand Down
2 changes: 1 addition & 1 deletion .storybook/sage-storybook-theme.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { create } from "@storybook/theming/create";
import { create } from "storybook/theming/create";

export default create({
base: "light",
Expand Down
4 changes: 2 additions & 2 deletions .storybook/utils/partial-action.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { action } from "@storybook/addon-actions";
import { action } from "storybook/actions";
import React from "react";

function partialAction(actionName: string) {
Expand All @@ -7,7 +7,7 @@ function partialAction(actionName: string) {
typeof eventObj === "string"
? { view: undefined }
: { ...eventObj, view: undefined },
...args
...args,
);
};
}
Expand Down
43 changes: 26 additions & 17 deletions .storybook/utils/styled-system-props.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ArgTypes } from "@storybook/react";
import { ArgTypes } from "@storybook/react-vite";
import {
SpaceProps,
LayoutProps,
Expand Down Expand Up @@ -77,7 +77,7 @@ type Props = {
};

const generateStyledSystemMarginProps = (
defaults: StyledSystemDefaults
defaults: StyledSystemDefaults,
): ArgTypes[] => {
return [
{
Expand Down Expand Up @@ -843,7 +843,7 @@ const generateStyledSystemGridProps = (defaults: StyledSystemDefaults) => {
};

const generateStyledSystemBackgroundProps = (
defaults: StyledSystemDefaults
defaults: StyledSystemDefaults,
) => {
return [
{
Expand Down Expand Up @@ -994,13 +994,13 @@ const generateStyledSystemPositionProps = (defaults: StyledSystemDefaults) => {

const filterProps = (
props: Record<string, unknown>[],
excludes: string[] = []
excludes: string[] = [],
) => props.filter((prop) => !excludes.includes(Object.keys(prop)[0]));

const generateStyledSystemProps = (
props: StyledSystemProps,
defaults?: StyledSystemDefaults,
excludes?: string[]
excludes?: string[],
): ArgTypes<StyledSystemProps> => {
const {
spacing,
Expand All @@ -1019,67 +1019,76 @@ const generateStyledSystemProps = (
if (spacing) {
Object.assign(
result,
...filterProps(generateStyledSystemSpacingProps(defaults || {}), excludes)
...filterProps(
generateStyledSystemSpacingProps(defaults || {}),
excludes,
),
);
}
if (margin) {
Object.assign(
result,
...filterProps(generateStyledSystemMarginProps(defaults || {}), excludes)
...filterProps(generateStyledSystemMarginProps(defaults || {}), excludes),
);
}
if (padding) {
Object.assign(
result,
...filterProps(generateStyledSystemPaddingProps(defaults || {}), excludes)
...filterProps(
generateStyledSystemPaddingProps(defaults || {}),
excludes,
),
);
}
if (color) {
Object.assign(
result,
...filterProps(generateStyledSystemColorProps(defaults || {}), excludes)
...filterProps(generateStyledSystemColorProps(defaults || {}), excludes),
);
}
if (layout) {
Object.assign(
result,
...filterProps(generateStyledSystemLayoutProps(defaults || {}), excludes)
...filterProps(generateStyledSystemLayoutProps(defaults || {}), excludes),
);
}
if (width) {
Object.assign(
result,
...filterProps(generateStyledSystemWidthProps(defaults || {}), excludes)
...filterProps(generateStyledSystemWidthProps(defaults || {}), excludes),
);
}
if (flexBox) {
Object.assign(
result,
...filterProps(generateStyledSystemFlexBoxProps(defaults || {}), excludes)
...filterProps(
generateStyledSystemFlexBoxProps(defaults || {}),
excludes,
),
);
}
if (grid) {
Object.assign(
result,
...filterProps(generateStyledSystemGridProps(defaults || {}), excludes)
...filterProps(generateStyledSystemGridProps(defaults || {}), excludes),
);
}
if (background) {
Object.assign(
result,
...filterProps(
generateStyledSystemBackgroundProps(defaults || {}),
excludes
)
excludes,
),
);
}
if (position) {
Object.assign(
result,
...filterProps(
generateStyledSystemPositionProps(defaults || {}),
excludes
)
excludes,
),
);
}

Expand Down
20 changes: 14 additions & 6 deletions .storybook/version-picker/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,27 @@ import React, { useEffect, useState } from "react";
import {
IconButton,
WithTooltip,
TooltipLinkList,
TooltipLinkListLink,
} from "@storybook/components";
TooltipLinkList
} from "storybook/internal/components";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

question: the migration docs indicate anything moved to internal might be deprecated in v10, is this the right package to use here and if we have to do we have a ticket/plan for migrating off it asap?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is within our addon (version-picker) and the migration docs also mention:

"Addon authors may continue to use the internal packages, there is currently not yet any replacement."

I might create a ticket to keep an eye on it essentially, but not sure there's much that can be done right now other that rewrite all these components and make them internal for our Storybook only?

Copy link
Contributor

@Parsium Parsium Jun 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: what do you think about adding a comment briefing explaining this and/or linking to the ticket once its raised?

Might be worth being clear Storybook only recommend addon authors use this API and it shouldn't be used elsewhere.

import compareBuild from "semver/functions/compare-build";

import { TOOL_ID } from "./constants";
import fetchData from "./fetch-data";

type VersionLink = {
id: string;
title: string;
onClick: () => void;
active: boolean;
href: string;
target: string;
};

const getDisplayedItems = (
versions: Record<string, string>,
onClick: TooltipLinkListLink["onClick"]
onClick: VersionLink["onClick"],
) => {
let formattedVersions: TooltipLinkListLink[] = [];
let formattedVersions: VersionLink[] = [];

for (const [key, value] of Object.entries(versions)) {
formattedVersions.push({
Expand All @@ -36,7 +44,7 @@ const getDisplayedItems = (

export const VersionPicker = () => {
const [versions, setVersions] = useState<Record<string, string> | undefined>(
undefined
undefined,
);
const [currentVersion, setCurrentVersion] = useState("Latest");

Expand Down
2 changes: 1 addition & 1 deletion .storybook/with-global-styles.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Decorator } from "@storybook/react";
import { Decorator } from "@storybook/react-vite";
import React from "react";
import GlobalStyle from "../src/style/global-style";

Expand Down
4 changes: 2 additions & 2 deletions .storybook/with-locale-selector.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import React from "react";
import { Decorator } from "@storybook/react";
import { Decorator } from "@storybook/react-vite";
import I18nProvider from "../src/components/i18n-provider";
import { enGB, deDE, enCA, enUS, esES, frCA, frFR } from "../src/locales";

const withLocaleSelector: Decorator = (Story, context) => {
const selectedLocale =
[enGB, deDE, enCA, enUS, esES, frCA, frFR].find(
({ locale }) => locale?.() === context.globals.locale
({ locale }) => locale?.() === context.globals.locale,
) || enGB;

return (
Expand Down
2 changes: 1 addition & 1 deletion .storybook/with-portal-provider.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Decorator } from "@storybook/react";
import { Decorator } from "@storybook/react-vite";
import React from "react";
import PortalContext from "../src/components/portal/__internal__/portal.context";
import isChromatic from "./isChromatic";
Expand Down
2 changes: 1 addition & 1 deletion .storybook/withThemeProvider.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { makeDecorator } from "@storybook/preview-api";
import { makeDecorator } from "storybook/preview-api";
import isChromatic from "./isChromatic";
import React from "react";
import styled from "styled-components";
Expand Down
2 changes: 1 addition & 1 deletion contributing/codebase-overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ This would typically look like the following:
```none
/* in button.mdx... */

import { Meta, Story, Canvas, ArgsTable } from "@storybook/addon-docs";
import { Meta, Story, Canvas, ArgsTable } from "@storybook/addon-docs/blocks";

import Button from ".";
import * as ButtonStories from "./button.stories.tsx";
Expand Down
2 changes: 1 addition & 1 deletion docs/bundle-size.mdx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Meta } from "@storybook/blocks";
import { Meta } from "@storybook/addon-docs/blocks";

<Meta title="Documentation/Bundle Size" />

Expand Down
2 changes: 1 addition & 1 deletion docs/colors.mdx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Meta } from "@storybook/blocks";
import { Meta } from "@storybook/addon-docs/blocks";

<Meta title="Documentation/Colors" />

Expand Down
2 changes: 1 addition & 1 deletion docs/extending-styles-using-styled-components.mdx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Meta, Canvas } from "@storybook/blocks";
import { Meta, Canvas } from "@storybook/addon-docs/blocks";

import * as ExtendingStylesStories from "./extending-styles-using-styled-components.stories";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from "react";
import { Meta, StoryObj } from "@storybook/react";
import { Meta, StoryObj } from "@storybook/react-vite";

import styled from "styled-components";
import Box from "../src/components/box";
Expand Down
2 changes: 1 addition & 1 deletion docs/how-to-contribute.mdx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Meta } from "@storybook/blocks";
import { Meta } from "@storybook/addon-docs/blocks";

<Meta title="Contributing/How to contribute" />

Expand Down
2 changes: 1 addition & 1 deletion docs/i18n.mdx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Meta } from "@storybook/blocks";
import { Meta } from "@storybook/addon-docs/blocks";

<Meta title="Documentation/i18n" />

Expand Down
2 changes: 1 addition & 1 deletion docs/installation.mdx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Meta } from "@storybook/blocks";
import { Meta } from "@storybook/addon-docs/blocks";

<Meta title="Getting Started/Installation" />

Expand Down
2 changes: 1 addition & 1 deletion docs/recommended-practices.mdx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Meta } from "@storybook/blocks";
import { Meta } from "@storybook/addon-docs/blocks";

<Meta title="Documentation/Recommended Practices" />

Expand Down
2 changes: 1 addition & 1 deletion docs/roadmap.mdx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Meta } from "@storybook/blocks";
import { Meta } from "@storybook/addon-docs/blocks";

<Meta title="Contributing/Roadmap" />

Expand Down
2 changes: 1 addition & 1 deletion docs/usage-with-routing.mdx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Meta } from "@storybook/blocks";
import { Meta } from "@storybook/addon-docs/blocks";

<Meta title="Documentation/Usage with routing" />

Expand Down
2 changes: 1 addition & 1 deletion docs/usage.mdx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Meta } from "@storybook/blocks";
import { Meta } from "@storybook/addon-docs/blocks";

<Meta title="Getting Started/Usage" />

Expand Down
2 changes: 1 addition & 1 deletion docs/using-lexical.mdx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Meta } from "@storybook/blocks";
import { Meta } from "@storybook/addon-docs/blocks";

<Meta title="Documentation/Using Lexical" />

Expand Down
2 changes: 1 addition & 1 deletion docs/validations.mdx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Meta, Canvas } from "@storybook/blocks";
import { Meta, Canvas } from "@storybook/addon-docs/blocks";

import * as ValidationsStories from "./validations.stories";

Expand Down
2 changes: 1 addition & 1 deletion docs/validations.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from "react";
import { Meta, StoryObj } from "@storybook/react";
import { Meta, StoryObj } from "@storybook/react-vite";

import Textbox from "../src/components/textbox";
import { RadioButton, RadioButtonGroup } from "../src/components/radio-button";
Expand Down
Loading
Loading