From bddd57c10071fb3884dfc6454a2362bfb3fd3263 Mon Sep 17 00:00:00 2001 From: Steve Dodier-Lazaro Date: Fri, 20 Feb 2026 15:08:27 +0100 Subject: [PATCH 01/10] UI: Fix code/copy buttons overlap with content --- .../src/blocks/components/Preview.stories.tsx | 13 +++++ .../docs/src/blocks/components/Preview.tsx | 15 ++++-- .../ActionBar/ActionBar.stories.tsx | 3 ++ .../components/ActionBar/ActionBar.tsx | 54 ++++++++++++------- .../syntaxhighlighter/syntaxhighlighter.tsx | 9 +++- 5 files changed, 69 insertions(+), 25 deletions(-) diff --git a/code/addons/docs/src/blocks/components/Preview.stories.tsx b/code/addons/docs/src/blocks/components/Preview.stories.tsx index 223efabeee51..a1c5108d234d 100644 --- a/code/addons/docs/src/blocks/components/Preview.stories.tsx +++ b/code/addons/docs/src/blocks/components/Preview.stories.tsx @@ -51,6 +51,19 @@ export const CodeError = () => ( ); +export const ActionBarWrapping = { + render: () => ( + + + + ), + globals: { + viewport: 'mobile1', + }, +}; + export const Single = () => ( + )} + {hasValidSource && ( + <> + setExpanded(!expanded)} + variant="ghost" + className={`docblock-code-toggle${expanded ? ' docblock-code-toggle--expanded' : ''}`} + > + {expanded ? 'Hide code' : 'Show code'} + + + + )} + {additionalActionItems.map(({ title, className, onClick, disabled }, index: number) => ( + + ))} + + )} + ); }; diff --git a/code/addons/docs/src/blocks/components/Source.tsx b/code/addons/docs/src/blocks/components/Source.tsx index 5b0e7b36037b..92f9a9c6360b 100644 --- a/code/addons/docs/src/blocks/components/Source.tsx +++ b/code/addons/docs/src/blocks/components/Source.tsx @@ -44,8 +44,8 @@ export interface SourceCodeProps { /** The formatter the syntax highlighter uses for your story’s code. */ format?: ComponentProps['format']; /** Display the source snippet in a dark mode. */ - dark?: boolean; -} + dark?: boolean; /** Whether to show the copy button. Defaults to true. */ + copyable?: boolean;} export interface SourceProps extends SourceCodeProps { isLoading?: boolean; @@ -91,6 +91,7 @@ const Source: FunctionComponent = ({ code, dark, format = true, + copyable = true, ...rest }) => { const { typography } = useTheme(); @@ -104,7 +105,7 @@ const Source: FunctionComponent = ({ const syntaxHighlighter = ( Date: Thu, 26 Feb 2026 17:06:15 +0100 Subject: [PATCH 03/10] UI: Remove toolbar padding for preview despite outline crop --- code/addons/docs/src/blocks/components/Preview.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/addons/docs/src/blocks/components/Preview.tsx b/code/addons/docs/src/blocks/components/Preview.tsx index 331184b9f62d..303d1c81c7d4 100644 --- a/code/addons/docs/src/blocks/components/Preview.tsx +++ b/code/addons/docs/src/blocks/components/Preview.tsx @@ -224,7 +224,7 @@ export const Preview: FC = ({ )} {(withSource || additionalActionItems.length > 0) && ( - + {hasSourceError && ( )} diff --git a/code/addons/docs/src/blocks/components/Source.tsx b/code/addons/docs/src/blocks/components/Source.tsx index 92f9a9c6360b..164aadaf38cf 100644 --- a/code/addons/docs/src/blocks/components/Source.tsx +++ b/code/addons/docs/src/blocks/components/Source.tsx @@ -44,8 +44,10 @@ export interface SourceCodeProps { /** The formatter the syntax highlighter uses for your story’s code. */ format?: ComponentProps['format']; /** Display the source snippet in a dark mode. */ - dark?: boolean; /** Whether to show the copy button. Defaults to true. */ - copyable?: boolean;} + dark?: boolean; + /** Whether to show the copy button. Defaults to true. */ + copyable?: boolean; +} export interface SourceProps extends SourceCodeProps { isLoading?: boolean; From b0f94e71f164cfe7e0f03ab8841b2315475e6757 Mon Sep 17 00:00:00 2001 From: Steve Dodier-Lazaro Date: Thu, 26 Feb 2026 17:25:15 +0100 Subject: [PATCH 05/10] Address PR review --- .../src/components/components/ActionBar/ActionBar.stories.tsx | 3 --- 1 file changed, 3 deletions(-) diff --git a/code/core/src/components/components/ActionBar/ActionBar.stories.tsx b/code/core/src/components/components/ActionBar/ActionBar.stories.tsx index 5935b7bb7b81..8c3a04983b1d 100644 --- a/code/core/src/components/components/ActionBar/ActionBar.stories.tsx +++ b/code/core/src/components/components/ActionBar/ActionBar.stories.tsx @@ -27,9 +27,6 @@ export default { ), ], - args: { - sb11FlexLayout: true, - }, }; export const SingleItem = () => ; From 11ed0453ff77321da34432d6e00faca9c92e38bc Mon Sep 17 00:00:00 2001 From: Steve Dodier-Lazaro Date: Thu, 26 Feb 2026 17:31:33 +0100 Subject: [PATCH 06/10] Remove dead code --- code/addons/docs/src/blocks/components/Preview.tsx | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/code/addons/docs/src/blocks/components/Preview.tsx b/code/addons/docs/src/blocks/components/Preview.tsx index c8341101df6a..609646f549e9 100644 --- a/code/addons/docs/src/blocks/components/Preview.tsx +++ b/code/addons/docs/src/blocks/components/Preview.tsx @@ -101,15 +101,11 @@ const StyledSource = styled(Source)(({ theme }) => ({ })); const PreviewContainer = styled.div( - ({ theme, withSource, isExpanded }) => ({ + ({ theme }) => ({ position: 'relative', overflow: 'hidden', margin: '25px 0 40px', ...getBlockBackgroundStyle(theme), - borderBottomLeftRadius: withSource && isExpanded ? 0 : undefined, - borderBottomRightRadius: withSource && isExpanded ? 0 : undefined, - borderBottomWidth: isExpanded ? 0 : undefined, - 'h3 + &': { marginTop: '16px', }, From f8dabbf2ea8d00665dcc49ebff89eb45b3f77c04 Mon Sep 17 00:00:00 2001 From: Steve Dodier-Lazaro Date: Thu, 26 Feb 2026 17:44:17 +0100 Subject: [PATCH 07/10] Fix between-story spacing in Preview! --- code/addons/docs/src/blocks/components/Preview.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/code/addons/docs/src/blocks/components/Preview.tsx b/code/addons/docs/src/blocks/components/Preview.tsx index 609646f549e9..bce5168efecf 100644 --- a/code/addons/docs/src/blocks/components/Preview.tsx +++ b/code/addons/docs/src/blocks/components/Preview.tsx @@ -81,6 +81,7 @@ const ChildrenContainer = styled.div( const ActionBar = styled(Bar)({ marginTop: -40, + marginBottom: 40, }); const StyledSource = styled(Source)(({ theme }) => ({ From 3bc11e10e8895169a34db3f49a79f7e9caa07412 Mon Sep 17 00:00:00 2001 From: Steve Dodier-Lazaro Date: Thu, 26 Feb 2026 18:01:22 +0100 Subject: [PATCH 08/10] Try explicit value syntax for viewport global --- code/addons/docs/src/blocks/components/Preview.stories.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/addons/docs/src/blocks/components/Preview.stories.tsx b/code/addons/docs/src/blocks/components/Preview.stories.tsx index a1c5108d234d..d75bac0b374d 100644 --- a/code/addons/docs/src/blocks/components/Preview.stories.tsx +++ b/code/addons/docs/src/blocks/components/Preview.stories.tsx @@ -60,7 +60,7 @@ export const ActionBarWrapping = { ), globals: { - viewport: 'mobile1', + viewport: { value: 'mobile1' }, }, }; From 38b12c9575ffef6800e6426ceccf1decddc34f46 Mon Sep 17 00:00:00 2001 From: Steve Dodier-Lazaro Date: Fri, 27 Feb 2026 09:44:58 +0100 Subject: [PATCH 09/10] UI: Repair docs-story class selector --- code/addons/docs/src/blocks/components/Preview.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/code/addons/docs/src/blocks/components/Preview.tsx b/code/addons/docs/src/blocks/components/Preview.tsx index bce5168efecf..ceb904044056 100644 --- a/code/addons/docs/src/blocks/components/Preview.tsx +++ b/code/addons/docs/src/blocks/components/Preview.tsx @@ -208,6 +208,7 @@ export const Preview: FC = ({ columns={columns} layout={layout} inline={inline} + className="docs-story" > {Array.isArray(children) ? ( From 2f69d12d64e33b26083cd430c0c59bbad1c13d66 Mon Sep 17 00:00:00 2001 From: Steve Dodier-Lazaro Date: Fri, 27 Feb 2026 12:47:36 +0100 Subject: [PATCH 10/10] UI: Repair docs-story decorators for primary stories --- .../src/blocks/examples/ButtonSomeAutodocs.stories.tsx | 5 +++++ code/core/src/backgrounds/decorator.ts | 10 ++++++++-- docs/_snippets/storybook-addon-use-global.md | 2 +- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/code/addons/docs/src/blocks/examples/ButtonSomeAutodocs.stories.tsx b/code/addons/docs/src/blocks/examples/ButtonSomeAutodocs.stories.tsx index d691e2b8f91b..0a477e1d64c0 100644 --- a/code/addons/docs/src/blocks/examples/ButtonSomeAutodocs.stories.tsx +++ b/code/addons/docs/src/blocks/examples/ButtonSomeAutodocs.stories.tsx @@ -28,6 +28,11 @@ export const Secondary: Story = { args: { label: 'Button', }, + globals: { + backgrounds: { + grid: true, + }, + }, }; export const ForcedBgLight: Story = { diff --git a/code/core/src/backgrounds/decorator.ts b/code/core/src/backgrounds/decorator.ts index bb0d35de9cfc..a58e7e14cfb0 100644 --- a/code/core/src/backgrounds/decorator.ts +++ b/code/core/src/backgrounds/decorator.ts @@ -34,8 +34,14 @@ export const withBackgroundAndGrid: DecoratorFunction = (StoryFn, context) => { const showGrid = typeof data === 'string' ? false : data.grid || false; const shownBackground = !!item && !disable; - const backgroundSelector = viewMode === 'docs' ? `#anchor--${id} .docs-story` : '.sb-show-main'; - const gridSelector = viewMode === 'docs' ? `#anchor--${id} .docs-story` : '.sb-show-main'; + const backgroundSelector = + viewMode === 'docs' + ? `#anchor--${id} .docs-story, #anchor--primary--${id} .docs-story` + : '.sb-show-main'; + const gridSelector = + viewMode === 'docs' + ? `#anchor--${id} .docs-story, #anchor--primary--${id} .docs-story` + : '.sb-show-main'; const isLayoutPadded = parameters.layout === undefined || parameters.layout === 'padded'; const defaultOffset = viewMode === 'docs' ? 20 : isLayoutPadded ? 16 : 0; diff --git a/docs/_snippets/storybook-addon-use-global.md b/docs/_snippets/storybook-addon-use-global.md index dd12a1767c72..d1913cef1424 100644 --- a/docs/_snippets/storybook-addon-use-global.md +++ b/docs/_snippets/storybook-addon-use-global.md @@ -21,7 +21,7 @@ export const withGlobals = (StoryFn: StoryFunction, context: StoryCont const isInDocs = context.viewMode === 'docs'; const outlineStyles = useMemo(() => { - const selector = isInDocs ? `#anchor--${context.id} .docs-story` : '.sb-show-main'; + const selector = isInDocs ? `#anchor--${context.id} .docs-story, #anchor--primary--${context.id} .docs-story` : '.sb-show-main'; return outlineCSS(selector); }, [context.id]);