Repository navigation
feat(ui): add Stepper component to @automattic/ui #111036
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
137 commits
Select commit
Hold shift + click to select a range
d4d3e18
docs: add Stepper component design spec
bogiii 70c3709
docs: add Stepper implementation plan
bogiii a74e54a
chore(ui): add @base-ui/react dependency for Stepper
bogiii 0cf2e7b
feat(ui/stepper): add shared TypeScript types
bogiii fb6c7a4
feat(ui/stepper): add step registration hook
bogiii b2fe24a
feat(ui/stepper): add Stepper.Root
bogiii 6f6659a
feat(ui/stepper): add Stepper.Step
bogiii 562afee
test(ui/stepper): add Stepper.Step attribute and priority tests
bogiii 3ce7454
refactor(ui/stepper): use updateStep for metadata sync in Stepper.Step
bogiii 401a9a0
feat(ui/stepper): add Stepper.Indicator, Title, Description
bogiii 606e8b5
refactor(ui/stepper): simplify Indicator and fix ReactNode import
bogiii a653763
feat(ui/stepper): add Stepper.Trigger
bogiii ddf7dfe
feat(ui/stepper): add Stepper.Panel
bogiii d7111c5
feat(ui/stepper): add Stepper.List — Tier 2 primitives complete
bogiii 5900073
fix(ui/stepper): use aria-disabled on disabled triggers for accessibi…
bogiii a64d503
fix(ui/stepper): fix Trigger className asymmetry and clarify Panel ne…
bogiii fb0a6f5
feat(ui/stepper): add full CSS for Tier 2 primitives
bogiii 404313e
feat(ui/stepper): add Tier 2 Storybook stories
bogiii eea0f91
feat(ui/stepper): add VerticalStepper (Tier 1)
bogiii cb314a0
feat(ui/stepper): add VerticalStepper stories
bogiii cd60b92
feat(ui/stepper): add HorizontalStepper (Tier 1)
bogiii ac3707b
feat(ui/stepper): add HorizontalStepper stories
bogiii 9bb9cc3
fix(ui/stepper): add className prop to HorizontalStepper.Step
bogiii e7bb073
feat(ui/stepper): export Stepper, VerticalStepper, HorizontalStepper …
bogiii 6842b8a
fix(ui/stepper): register step with neutral defaults to avoid stale i…
bogiii 896d114
style(ui/stepper): fix Prettier formatting in SCSS files
bogiii 3e62073
style: fix CI code style failures
bogiii d654fb7
packages/ui/stepper: apply code review fixes
bogiii 6d24d73
packages/ui/stepper: resolve remaining review items
bogiii 2c11519
packages/ui/stepper: fix test type error after XOR aria-label type ch…
bogiii bcc7969
packages/ui/stepper: enable Storybook controls and fix completion ind…
bogiii 0725241
packages/ui/stepper: add Storybook docs explaining Tier 1 vs Tier 2
bogiii 8089e36
packages/ui/stepper: add StepVariants story showing all step states
bogiii 24f79dc
packages/ui/storybook: consolidate all stories under UI group
bogiii ec53cc8
packages/ui/storybook: group stepper stories under UI/Stepper
bogiii 17a7e2f
packages/ui/storybook: order stepper group as Horizontal, Vertical, H…
bogiii 54d6b66
packages/ui/storybook: add LandmarkThreshold story to VerticalStepper
bogiii b2451a3
packages/ui/storybook: add StepVariants story to HorizontalStepper
bogiii dd9b65a
packages/ui/storybook: add BackNavigation story to VerticalStepper
bogiii 9f52dff
docs(storybook): rewrite Headless (Tier 2) stepper stories for clarity
bogiii d5836f8
docs(storybook): add explicit source code to Headless (Tier 2) stories
bogiii 2dc0a88
docs(storybook): add explicit source code to Vertical and Horizontal …
bogiii 94c58a5
docs(storybook): use dynamic source extraction instead of manual code…
bogiii 1e65d25
refactor(stepper): use @wordpress/ui Icon in Stepper.Indicator
bogiii 0b65212
refactor(stepper): use @wordpress/ui Stack for trigger label layout
bogiii 51a845c
packages/ui: use Stack from @wordpress/ui in HorizontalStepper trigger
bogiii 7a0207f
packages/ui: update yarn.lock after adding @wordpress/ui dependency
bogiii 6d9ce5a
packages/ui: add indicatorVariant prop to Stepper ('bullet' | 'number')
bogiii 46ea7fa
packages/ui: fix TypeScript 5.9 story type errors in stepper stories
bogiii 67bce38
packages/ui: remove connector line between HorizontalStepper steps
bogiii fe0be68
packages/ui: redesign bullet indicator variant per design spec
bogiii ad3cda1
packages/ui: refine bullet current indicator and set 2px border globally
bogiii b55cf47
packages/ui: refine stepper indicator sizes, icons, and bullet varian…
bogiii 1a2f369
packages/ui: increase horizontal stepper trigger padding and gap
bogiii 6a08424
packages/ui: fix horizontal stepper icon and text vertical alignment
bogiii 2beac01
packages/ui: add mobile icon-only layout with connector lines to hori…
bogiii 416ffb4
packages/ui: prevent layout shift when bullet step transitions to cur…
bogiii 3c8ca75
packages/ui: use container query for horizontal stepper mobile layout
bogiii ecf8aba
packages/ui: unify number and bullet variant indicator and title colors
bogiii ffa2b79
packages/ui: replace error icon with plain exclamation mark in steppe…
bogiii 80850af
packages/ui: wire StepVariants story controls in horizontal stepper
bogiii e08be69
packages/ui: remove green/red color overrides from vertical stepper c…
bogiii d42d618
packages/ui: remove red color override from error step indicator
bogiii 011f29b
packages/ui: center vertical stepper trigger content vertically
bogiii f8df32d
packages/ui: remove headingLevel from HorizontalStepper public API
bogiii a047816
packages/ui: remove bold style from selected step description
bogiii fc30734
packages/ui: rename headless stepper story to Primitives
bogiii 9515aee
packages/ui: update cross-reference links to Primitives story
bogiii 0db753d
packages/ui: improve Primitives stories with fixes and new example
bogiii 0621ea2
packages/ui: fix stepper issues surfaced in code review
bogiii a14cd45
packages/ui: add missing stepper test coverage
bogiii 4738e3c
packages/ui: address post-review fixes for Stepper
bogiii 2c8fedf
packages/ui: fix vertical stepper panel close animation
bogiii 044b0e3
packages/ui: fix stale JSDoc and add missing Panel warning test
bogiii 93046c9
packages/ui: document useLayoutEffect/useEffect asymmetry and panel a…
bogiii 91dc28c
packages/ui: improve stepper test quality — delete, rewrite, and fill…
bogiii da3dacf
packages/ui: fix TS2322 in HorizontalStepper caused by Omit on union …
bogiii fc22f06
packages/ui: fix icon usage in stepper indicator
bogiii 8336284
chore: remove implementation plan and design spec from tracked files
bogiii 8d143bf
packages/ui: replace custom visually-hidden CSS with VisuallyHidden c…
bogiii b43f0e6
packages/ui: use Text component for stepper title and description
bogiii b7dfcb9
packages/ui: use --wpds-border-width-xs token for horizontal stepper …
bogiii 65669d9
packages/ui: replace grid-unit spacing with wpds dimension tokens
bogiii fbbad92
packages/ui: use wpds stroke token for horizontal stepper connector c…
bogiii 453553f
packages/ui: replace font-size-small with wpds typography token in in…
bogiii 5b15820
packages/ui: fix TypeScript error in stepper story metas
bogiii eba35db
packages/ui: code review safe-auto fixes
bogiii 00ae56c
packages/ui: add dark-theme mixin to horizontal-stepper connector line
bogiii 0135815
packages/ui: fix updateStep equality check to union keys from both ob…
bogiii 3cfac88
packages/ui: allow error steps to be navigable in linear mode
bogiii 5bdc4fa
packages/ui: add JSDoc notes to StepProps and formatStepLabel
bogiii d0c2d22
packages/ui: add missing stepper test coverage for linear mode, landm…
bogiii 28ae9cf
packages/ui: apply review fixes — clean up exports, add coverage, fix…
bogiii 25ef2ea
packages/ui: fix updateStep ReactNode equality bail-out — prevent spu…
bogiii 7f8220c
packages/ui: fix accordion collapse flash, guard indicator label, wid…
bogiii 994410a
packages/ui: test audit — delete framework testers, rewrite impl-coup…
bogiii 7befa0b
packages/ui: revert @wordpress/ui pin widening — lockfile update out …
bogiii 2c45b1d
packages/ui: fix Storybook 9 Docs page ordering and generation
bogiii 39d547c
packages/ui: update stepper indicator and title colors on hover
bogiii 4a1e94d
packages/ui: remove description prop from HorizontalStepper
bogiii 71bb92b
packages/ui: top-align indicator with trigger label in both steppers
bogiii 6dc41c8
packages/ui: hide vertical stepper connector line on desktop
bogiii 8b2f730
packages/ui: use interactive color tokens for stepper trigger states
bogiii dec2953
packages/ui: use --wpds-typography-font-size-md token for trigger fon…
bogiii 655c813
packages/ui: use --wpds-* tokens with theme fallbacks for stepper colors
bogiii 3471923
packages/ui: use Button as render element for stepper triggers and fi…
bogiii 5749c98
packages/ui: forward ref in StepperIndicator for composition consistency
bogiii e7c70ad
packages/ui: merge internal and external classNames in stepper compon…
bogiii 7377c36
packages/ui: fix misleading warning message in StepperRoot
bogiii 591a161
packages/ui: omit activationMode from VerticalStepper props
bogiii 195373f
packages/ui: replace HorizontalStepper registration pattern with dire…
bogiii 88d2068
packages/ui: remove manual fallbacks from --wpds-* CSS custom properties
bogiii 4d8f144
packages/ui: replace display:none on stepper title with visually hidden
bogiii 23d4ac5
packages/ui: replace 21px magic number in connector line with named v…
bogiii 343cd29
packages/ui: derive horizontal stepper connector offset from shared v…
bogiii 57e8930
packages/ui: derive vertical stepper connector offset from shared var…
bogiii f191689
packages/ui: consolidate stepper variables and fix vertical panel indent
bogiii 3df6fed
packages/ui: define indicator size tokens once on StepperRoot
bogiii 81bef3d
packages/ui: load wpds design tokens in Storybook
bogiii 6253cde
packages/ui: use wpds motion tokens for vertical stepper panel transi…
bogiii d6a99b9
packages/ui: replace --stepper-trigger-height leftover with token calc
bogiii 0b2ee6f
packages/ui: revert badge test changes — unrelated to stepper work
bogiii 7da0d23
packages/ui: remove explicit stepper story sort order from preview.js
bogiii 010c858
packages/ui: use sprintf/__() for i18n in defaultFormatStepLabel
bogiii 33c0049
packages/ui: mark 'Optional' label for translation in VerticalStepper…
bogiii 2316f37
packages/ui: rename forceMount to keepMounted and export StepperPanel…
bogiii 8eee3eb
packages/ui: fix stale comment on halfCircleIcon in StepperIndicator
bogiii dcbeaba
packages/ui: centralize dev warnings behind a warning() helper
bogiii 6895061
packages/ui: remove dark-mode overrides from stepper styles
bogiii 1b18d11
packages/ui: add Stepper changelog entry
bogiii d9d0b92
packages/ui: bump version to 1.1.0
bogiii 0f2fa5b
packages/ui: update yarn.lock after rebase onto trunk
bogiii 0c187e0
packages/ui: keep number color unchanged on hover for current step in…
bogiii bd39be2
chore: dedupe yarn.lock after rebase onto trunk
bogiii 8854d1d
packages/ui: apply code review safe-auto fixes for Stepper
bogiii d9acdce
packages/ui: remove redundant ref field from StepperBaseProps
bogiii fefada0
packages/ui: suppress accent border on hover for filled number indicator
bogiii File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
packages/ui/src/horizontal-stepper/horizontal-stepper-step.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| // packages/ui/src/horizontal-stepper/horizontal-stepper-step.tsx | ||
| import type { StepProps } from '../stepper/types'; | ||
|
|
||
| export type HorizontalStepperStepProps = Omit< StepProps, 'description' >; | ||
|
|
||
| /** | ||
| * Step descriptor for HorizontalStepper. | ||
| * Renders nothing — HorizontalStepper reads props from this element directly | ||
| * at render time to build the tab list and panels. | ||
| */ | ||
| export const HorizontalStepperStep: ( props: HorizontalStepperStepProps ) => null = () => null; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,83 @@ | ||
| // packages/ui/src/horizontal-stepper/horizontal-stepper.tsx | ||
| import { Children, forwardRef, isValidElement } from '@wordpress/element'; | ||
| import clsx from 'clsx'; | ||
| import { Stepper } from '../stepper'; | ||
| import { HorizontalStepperStep, type HorizontalStepperStepProps } from './horizontal-stepper-step'; | ||
| import styles from './style.module.scss'; | ||
| import type { AriaLabelXOR, StepperBaseProps, StepperRef } from '../stepper/types'; | ||
| import type { ReactNode, Ref } from 'react'; | ||
|
|
||
| // Omit is applied to StepperBaseProps (a plain object type) before intersecting | ||
| // with AriaLabelXOR so that the XOR union constraint is preserved. Applying | ||
| // Omit directly to StepperProps (which is StepperBaseProps & AriaLabelXOR) | ||
| // flattens the union and widens aria-label/aria-labelledby to string|undefined, | ||
| // breaking TypeScript's ability to verify the constraint downstream. | ||
| type HorizontalStepperProps = Omit< StepperBaseProps, 'headingLevel' > & AriaLabelXOR; | ||
|
|
||
| /** | ||
| * Extracts step descriptors from children at render time. | ||
| * Only direct HorizontalStepperStep children are collected — deeply nested | ||
| * or wrapped steps are not supported (use Stepper primitives for those). | ||
| */ | ||
| function getStepperSteps( children: ReactNode ): HorizontalStepperStepProps[] { | ||
| const steps: HorizontalStepperStepProps[] = []; | ||
| Children.forEach( children, ( child ) => { | ||
| if ( isValidElement( child ) && child.type === HorizontalStepperStep ) { | ||
| steps.push( child.props as HorizontalStepperStepProps ); | ||
| } | ||
| } ); | ||
| return steps; | ||
| } | ||
|
|
||
| function HorizontalStepperInner( | ||
| { children, className, ...props }: HorizontalStepperProps, | ||
| ref: Ref< StepperRef > | ||
| ) { | ||
| const steps = getStepperSteps( children ); | ||
|
|
||
| return ( | ||
| <Stepper.Root | ||
| orientation="horizontal" | ||
| ref={ ref } | ||
| className={ clsx( styles[ 'root' ], className ) } | ||
| { ...props } | ||
| > | ||
| <Stepper.List className={ styles[ 'list' ] }> | ||
| { steps.map( ( step ) => ( | ||
| <Stepper.Step | ||
| key={ step.value } | ||
| value={ step.value } | ||
| status={ step.status } | ||
| optional={ step.optional } | ||
| disabled={ step.disabled } | ||
| className={ clsx( styles[ 'step' ], step.className ) } | ||
| > | ||
| <Stepper.Trigger className={ styles[ 'trigger' ] }> | ||
| <Stepper.Indicator>{ step.indicator }</Stepper.Indicator> | ||
| <Stepper.Title className={ styles[ 'text-block' ] }>{ step.title }</Stepper.Title> | ||
| </Stepper.Trigger> | ||
| </Stepper.Step> | ||
| ) ) } | ||
| </Stepper.List> | ||
|
|
||
| { steps.map( ( step ) => ( | ||
| <Stepper.Panel | ||
| key={ step.value } | ||
| value={ step.value } | ||
| keepMounted={ step.keepMounted } | ||
| className={ styles[ 'panel' ] } | ||
| > | ||
| { step.children } | ||
| </Stepper.Panel> | ||
| ) ) } | ||
| </Stepper.Root> | ||
| ); | ||
| } | ||
|
|
||
| const HorizontalStepperBase = forwardRef< StepperRef, HorizontalStepperProps >( | ||
| HorizontalStepperInner | ||
| ); | ||
|
|
||
| export const HorizontalStepper = Object.assign( HorizontalStepperBase, { | ||
| Step: HorizontalStepperStep, | ||
| } ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| // packages/ui/src/horizontal-stepper/index.ts | ||
| export { HorizontalStepper } from './horizontal-stepper'; |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.