From ce5830675c1d3837f6c9f4662c677b3fa01d5343 Mon Sep 17 00:00:00 2001 From: Cindy Zhang Date: Thu, 5 Nov 2026 08:25:58 -0800 Subject: [PATCH 1/3] feat(lab): DialogHeroHeader A hero-style Dialog header for Lab: media above a title, composed inside an Astryx Dialog, naming the dialog and requesting title focus through the internal Dialog context. Carries jiunshinn's component, tests, doc and story from #5105, as of its handshake fix (the rendered heading drives the handshake, so a re-render keeps focus and a late heading still names the dialog). Co-authored-by: jiunshinn --- .github/scripts/story-play-guard.js | 14 + .../stories/DialogHeroHeader.stories.tsx | 628 ++++++++++++++++++ internal/shadcn-registry/routes.lock.json | 5 + .../DialogHeroHeader/DialogHeroHeader.doc.mjs | 229 +++++++ .../DialogHeroHeader.test.tsx | 575 ++++++++++++++++ .../src/DialogHeroHeader/DialogHeroHeader.tsx | 406 +++++++++++ packages/lab/src/DialogHeroHeader/index.ts | 14 + packages/lab/src/index.ts | 7 + 8 files changed, 1878 insertions(+) create mode 100644 apps/storybook/stories/DialogHeroHeader.stories.tsx create mode 100644 packages/lab/src/DialogHeroHeader/DialogHeroHeader.doc.mjs create mode 100644 packages/lab/src/DialogHeroHeader/DialogHeroHeader.test.tsx create mode 100644 packages/lab/src/DialogHeroHeader/DialogHeroHeader.tsx create mode 100644 packages/lab/src/DialogHeroHeader/index.ts diff --git a/.github/scripts/story-play-guard.js b/.github/scripts/story-play-guard.js index 17883bc7c33a1..be285a737c081 100644 --- a/.github/scripts/story-play-guard.js +++ b/.github/scripts/story-play-guard.js @@ -347,6 +347,20 @@ const TARGETS = [ guards: 'the rendered RTL wrapper mirrors fixed-track item order while responsive and span geometry remain bounded', }, + { + component: 'DialogHeroHeader', + story: 'lab-dialogheroheader--media-bleed-geometry', + guards: + 'media reaches the dialog edges at theme-default, 0/2/8 padding, a ' + + 'theme override, and RTL while the title keeps the cancelled inset', + }, + { + component: 'DialogHeroHeader', + story: 'lab-dialogheroheader--custom-heading-focus-after-rerender', + guards: + 'a custom heading keeps focus and keeps naming the open modal while ' + + 'the header re-renders with a new title element', + }, { component: 'TabList', story: 'core-tablist--full-bleed-geometry', diff --git a/apps/storybook/stories/DialogHeroHeader.stories.tsx b/apps/storybook/stories/DialogHeroHeader.stories.tsx new file mode 100644 index 0000000000000..59c3f89f93e01 --- /dev/null +++ b/apps/storybook/stories/DialogHeroHeader.stories.tsx @@ -0,0 +1,628 @@ +// Copyright (c) Meta Platforms, Inc. and affiliates. + +/** + * @file DialogHeroHeader.stories.tsx + * @input DialogHeroHeader and its Dialog, Layout, Heading, and media composition + * @output Inline visual states, an interactive modal example, and a media + * bleed geometry guard across Dialog paddings and RTL + * @position Storybook coverage for the experimental hero header; the geometry + * story's play function is required CI via story-play-guard.js + */ + +import { + useEffect, + useId, + useState, + type ComponentProps, + type CSSProperties, +} from 'react'; +import type {Meta, StoryObj} from '@storybook/react'; +import {DialogHeroHeader} from '@astryxdesign/lab'; +import {Dialog} from '@astryxdesign/core/Dialog'; +import { + Layout, + LayoutContent, + LayoutFooter, + HStack, +} from '@astryxdesign/core/Layout'; +import {Button} from '@astryxdesign/core/Button'; +import {Heading} from '@astryxdesign/core/Heading'; +import {Icon} from '@astryxdesign/core/Icon'; +import {Text} from '@astryxdesign/core/Text'; +import DialogHeroHeaderShowcase from '../../../packages/lab/blocks/DialogHeroHeaderShowcase'; +import * as stylex from '@stylexjs/stylex'; + +const styles = stylex.create({ + heroSvg: { + display: 'block', + }, +}); + +// Self-contained stand-in for a hero image / illustration. A real app would +// pass an ,