Skip to content

Feature - Implement huxStepper pattern (setup for huxWizard)#45

Open
Copilot wants to merge 14 commits into
mainfrom
copilot/add-stepper-pattern-component
Open

Feature - Implement huxStepper pattern (setup for huxWizard)#45
Copilot wants to merge 14 commits into
mainfrom
copilot/add-stepper-pattern-component

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 21, 2026

This PR introduces a new huxStepper Alpine pattern to support accessible step-based flows (multi-step forms/progress navigation) and establish a reusable foundation for a future Wizard component. It adds the runtime primitive, a demo, and implementation-aligned documentation using HyperUX’s demo-first format.

  • Stepper runtime primitive (huxStepper)

    • Added huxStepper registration in PatternRegistration.astro.
    • Supports filtered/validated stepItems, deterministic initial step resolution, linear navigation, direct step selection, and progress helpers.
    • Exposes public API for composition:
      • goToStep, goToPreviousStep, goToNextStep
      • activeStepId, activeStepIndex, isFirstStep, isLastStep
      • isStepComplete, isStepCurrent
    • Adds stepsAreViewable config (default: false):
      • When false, completion is inferred from step position.
      • When true, direct step clicks are view-only (no completion inference from selection), and completion is tracked when advancing with goToNextStep().
    • Includes internal completed-step tracking for stepsAreViewable mode.
    • Normalizes stepItems input to avoid runtime errors when non-array values are passed.
    • goToStep() now no-ops when the requested step is already active, preventing duplicate change dispatches.
    • Uses stepperId config for scoped events.
    • Emits optional scoped change events when stepperId is provided: hux-stepper:{stepperId}:change with { stepId, stepIndex, totalSteps }.
  • Stepper demo

    • Added src/components/demos/Stepper.astro.
    • Demonstrates:
      • Clickable step list + previous/next controls
      • Panel switching by active step
      • stepsAreViewable: true mode for non-assumptive step viewing
      • Visible completion progression when navigating with Next step
      • Explicit step state indicators (● Current, ✓ Completed, ○ Not completed) to avoid color-only state communication
      • Copy-ready registration + markup snippet integration (data-hux-copy).
  • Stepper docs page

    • Added src/content/patterns/stepper.mdx with required structure:
      • Runtime constraints, API, options, quick start, usage patterns, behavior contract, error handling, accessibility notes, notes.
    • Documents only supported public API and marks helpers as private implementation details.
    • Accessibility guidance is reflected in snippets and demo (e.g. aria-current="step", explicit button semantics, aria-live="polite", aria-describedby state associations, and non-color-only state text).
    • Updated behavior/docs to reflect stepsAreViewable semantics, including view-only direct selection plus completion tracking via next-step progression.
    • Updated config/event naming references from id to stepperId.
huxStepper({
  stepperId: 'checkout',
  stepsAreViewable: true,
  stepItems: [
    { label: 'Contact', id: 'contact' },
    { label: 'Shipping', id: 'shipping' },
    { label: 'Payment', id: 'payment' },
  ],
})

// Optional composition hook for Wizard-like orchestration
window.addEventListener('hux-stepper:checkout:change', (event) => {
  const { stepId, stepIndex, totalSteps } = event.detail
})

> [!WARNING]
>
>

@cloudflare-workers-and-pages
Copy link
Copy Markdown
Contributor

cloudflare-workers-and-pages Bot commented May 21, 2026

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
hyperux 98f666b Commit Preview URL

Branch Preview URL
May 24 2026, 07:46 AM

Copilot AI changed the title [WIP] Add Stepper pattern/component as base for Wizard Feature - Add Stepper pattern as base for Wizard composition May 21, 2026
Copilot AI requested a review from markmead May 21, 2026 16:26
@markmead
Copy link
Copy Markdown
Owner

@copilot Nice start. However, the isStepCompleted implementation assumes a lot. In the current setup, someone clicking to the "Payment" step just to view, will then see that "Contact" and "Shipping" are completed. Can we add a config option (stepsAreViewable?) that allows users to click the steps to view them – with NO assumption if it is a completed step.

Copy link
Copy Markdown
Contributor Author

Copilot AI commented May 21, 2026

@copilot Nice start. However, the isStepCompleted implementation assumes a lot. In the current setup, someone clicking to the "Payment" step just to view, will then see that "Contact" and "Shipping"...

Implemented in commit 4d29ecc.

Added stepsAreViewable to huxStepper:

  • stepsAreViewable: false (default): existing inferred completion behavior remains.
  • stepsAreViewable: true: step clicks are view-only and isStepComplete() no longer infers completion.

I also updated the Stepper demo/docs to show and document this mode.

Screenshot: /tmp/playwright-logs/stepper-steps-are-viewable.png

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • fonts.google.com
    • Triggering command: /home/REDACTED/work/_temp/ghcca-node/node/bin/node node /home/REDACTED/work/hyperux/hyperux/node_modules/.bin/../astro/bin/astro.mjs build odules/workerd/bin/workerd (dns block)
    • Triggering command: /home/REDACTED/work/_temp/ghcca-node/node/bin/node node /home/REDACTED/work/hyperux/hyperux/node_modules/.bin/../astro/bin/astro.mjs dev --host 0.0.0.0 --port 4321 (dns block)
  • sparrow.cloudflare.com
    • Triggering command: /opt/hostedtoolcache/node/24.15.0/x64/bin/node /opt/hostedtoolcache/node/24.15.0/x64/bin/node --no-warnings --experimental-vm-modules /home/REDACTED/work/hyperux/hyperux/node_modules/.pnpm/wrangler@4.93.0/node_modules/wrangler/wrangler-dist/cli.js types (dns block)
  • telemetry.astro.build
    • Triggering command: /home/REDACTED/work/_temp/ghcca-node/node/bin/node node /home/REDACTED/work/hyperux/hyperux/node_modules/.bin/../astro/bin/astro.mjs build odules/workerd/bin/workerd (dns block)
    • Triggering command: /home/REDACTED/work/_temp/ghcca-node/node/bin/node node /home/REDACTED/work/hyperux/hyperux/node_modules/.bin/../astro/bin/astro.mjs dev --host 0.0.0.0 --port 4321 (dns block)
  • workers.cloudflare.com
    • Triggering command: /home/REDACTED/work/_temp/ghcca-node/node/bin/node node /home/REDACTED/work/hyperux/hyperux/node_modules/.bin/../astro/bin/astro.mjs check (dns block)
    • Triggering command: /home/REDACTED/work/_temp/ghcca-node/node/bin/node node /home/REDACTED/work/hyperux/hyperux/node_modules/.bin/../astro/bin/astro.mjs build odules/workerd/bin/workerd (dns block)
    • Triggering command: /home/REDACTED/work/_temp/ghcca-node/node/bin/node node /home/REDACTED/work/hyperux/hyperux/node_modules/.bin/../astro/bin/astro.mjs dev --host 0.0.0.0 --port 4321 (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

@markmead
Copy link
Copy Markdown
Owner

@copilot Better, but we're shouldn't steps be marked as "completed" if the user has completed the step? At the moment I click "Next step" and there's no indication that I have completed the previous step.

Copilot AI and others added 3 commits May 23, 2026 10:42
Copy link
Copy Markdown
Contributor Author

Copilot AI commented May 23, 2026

@copilot Better, but we're shouldn't steps be marked as "completed" if the user has completed the step? At the moment I click "Next step" and there's no indication that I have completed the previous...

Implemented in commit 61828f2 (plus follow-up hardening in 5455f00).

stepsAreViewable now behaves as:

  • direct step clicks (goToStep) remain view-only (no completion inferred)
  • Next step (goToNextStep) marks the step you just left as completed, so progress is visible

Screenshot: /tmp/playwright-logs/stepper-next-shows-completed.png

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • fonts.google.com
    • Triggering command: /home/REDACTED/work/_temp/ghcca-node/node/bin/node node /home/REDACTED/work/hyperux/hyperux/node_modules/.bin/../astro/bin/astro.mjs build (dns block)
    • Triggering command: /home/REDACTED/work/_temp/ghcca-node/node/bin/node node /home/REDACTED/work/hyperux/hyperux/node_modules/.bin/../astro/bin/astro.mjs dev --host 0.0.0.0 --port 4321 ndor/bin/sh (dns block)
  • sparrow.cloudflare.com
    • Triggering command: /opt/hostedtoolcache/node/24.15.0/x64/bin/node /opt/hostedtoolcache/node/24.15.0/x64/bin/node --no-warnings --experimental-vm-modules /home/REDACTED/work/hyperux/hyperux/node_modules/.pnpm/wrangler@4.93.0/node_modules/wrangler/wrangler-dist/cli.js types (dns block)
    • Triggering command: /opt/hostedtoolcache/node/24.15.0/x64/bin/node /opt/hostedtoolcache/node/24.15.0/x64/bin/node --no-warnings --experimental-vm-modules /home/REDACTED/work/hyperux/hyperux/node_modules/.pnpm/wrangler@4.93.0/node_modules/wrangler/wrangler-dist/cli.js types d -n 10 (dns block)
  • telemetry.astro.build
    • Triggering command: /home/REDACTED/work/_temp/ghcca-node/node/bin/node node /home/REDACTED/work/hyperux/hyperux/node_modules/.bin/../astro/bin/astro.mjs build (dns block)
    • Triggering command: /home/REDACTED/work/_temp/ghcca-node/node/bin/node node /home/REDACTED/work/hyperux/hyperux/node_modules/.bin/../astro/bin/astro.mjs dev --host 0.0.0.0 --port 4321 ndor/bin/sh (dns block)
  • workers.cloudflare.com
    • Triggering command: /home/REDACTED/work/_temp/ghcca-node/node/bin/node node /home/REDACTED/work/hyperux/hyperux/node_modules/.bin/../astro/bin/astro.mjs check (dns block)
    • Triggering command: /home/REDACTED/work/_temp/ghcca-node/node/bin/node node /home/REDACTED/work/hyperux/hyperux/node_modules/.bin/../astro/bin/astro.mjs build (dns block)
    • Triggering command: /home/REDACTED/work/_temp/ghcca-node/node/bin/node node /home/REDACTED/work/hyperux/hyperux/node_modules/.bin/../astro/bin/astro.mjs dev --host 0.0.0.0 --port 4321 ndor/bin/sh (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds a new huxStepper Alpine pattern (runtime + demo + documentation) to support accessible, step-based flows and to serve as a composable base for a future Wizard component.

Changes:

  • Registered huxStepper in PatternRegistration.astro with step navigation, completion helpers, and optional scoped change events.
  • Added a Stepper demo showing direct step selection plus previous/next navigation (including stepsAreViewable: true behavior).
  • Added demo-first Stepper documentation page describing API/options/behavior/accessibility.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
src/components/PatternRegistration.astro Adds huxStepper Alpine data registration and stepper runtime logic.
src/components/demos/Stepper.astro Adds a UI demo showcasing the stepper behavior and copy-ready snippet sources.
src/content/patterns/stepper.mdx Adds documentation for huxStepper following the repo’s demo-first patterns format.

Comment thread src/components/PatternRegistration.astro
Comment thread src/components/PatternRegistration.astro
Comment thread src/content/patterns/stepper.mdx Outdated
@markmead
Copy link
Copy Markdown
Owner

@copilot Address the feedback.

Copy link
Copy Markdown
Contributor Author

Copilot AI commented May 23, 2026

@copilot Address the feedback.

Addressed in commit 31b5a39.

Implemented the requested feedback:

  • normalize stepItems with Array.isArray(...) before filtering (no throw on non-array input)
  • remove the unnecessary completed-step filtering path
  • guard goToStep() when the requested step is already active, so change events only fire on actual step changes

Screenshot: /tmp/playwright-logs/stepper-feedback-addressed.png

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • fonts.google.com
    • Triggering command: /home/REDACTED/work/_temp/ghcca-node/node/bin/node node /home/REDACTED/work/hyperux/hyperux/node_modules/.bin/../astro/bin/astro.mjs build /esbuild/bin/esbuild (dns block)
    • Triggering command: /home/REDACTED/work/_temp/ghcca-node/node/bin/node node /home/REDACTED/work/hyperux/hyperux/node_modules/.bin/../astro/bin/astro.mjs build (dns block)
    • Triggering command: /home/REDACTED/work/_temp/ghcca-node/node/bin/node node /home/REDACTED/work/hyperux/hyperux/node_modules/.bin/../astro/bin/astro.mjs dev --host 0.0.0.0 --port 4321 (dns block)
  • sparrow.cloudflare.com
    • Triggering command: /opt/hostedtoolcache/node/24.15.0/x64/bin/node /opt/hostedtoolcache/node/24.15.0/x64/bin/node --no-warnings --experimental-vm-modules /home/REDACTED/work/hyperux/hyperux/node_modules/.pnpm/wrangler@4.93.0/node_modules/wrangler/wrangler-dist/cli.js types (dns block)
  • telemetry.astro.build
    • Triggering command: /home/REDACTED/work/_temp/ghcca-node/node/bin/node node /home/REDACTED/work/hyperux/hyperux/node_modules/.bin/../astro/bin/astro.mjs build /esbuild/bin/esbuild (dns block)
    • Triggering command: /home/REDACTED/work/_temp/ghcca-node/node/bin/node node /home/REDACTED/work/hyperux/hyperux/node_modules/.bin/../astro/bin/astro.mjs build (dns block)
    • Triggering command: /home/REDACTED/work/_temp/ghcca-node/node/bin/node node /home/REDACTED/work/hyperux/hyperux/node_modules/.bin/../astro/bin/astro.mjs dev --host 0.0.0.0 --port 4321 (dns block)
  • workers.cloudflare.com
    • Triggering command: /home/REDACTED/work/_temp/ghcca-node/node/bin/node node /home/REDACTED/work/hyperux/hyperux/node_modules/.bin/../astro/bin/astro.mjs check (dns block)
    • Triggering command: /home/REDACTED/work/_temp/ghcca-node/node/bin/node node /home/REDACTED/work/hyperux/hyperux/node_modules/.bin/../astro/bin/astro.mjs build /esbuild/bin/esbuild (dns block)
    • Triggering command: /home/REDACTED/work/_temp/ghcca-node/node/bin/node node /home/REDACTED/work/hyperux/hyperux/node_modules/.bin/../astro/bin/astro.mjs build (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

@markmead markmead marked this pull request as ready for review May 23, 2026 11:34
@markmead markmead changed the title Feature - Add Stepper pattern as base for Wizard composition Feature - Implement huxStepper pattern (setup for huxWizard) May 23, 2026
@markmead
Copy link
Copy Markdown
Owner

@copilot Few bits of feedback:

  • Replace id with stepperId for the huxStepper config
  • Custom-event name is misleading as hux-stepper:{id}:change is actually hux-stepper:{stepperId}:change

As well as that, do a deep dive of the accessibility.

Copy link
Copy Markdown
Contributor Author

Copilot AI commented May 23, 2026

@copilot Few bits of feedback:

  • Replace id with stepperId for the huxStepper config
    ...

Addressed in commits 6906516, da54efc, and 2f64c55.

Updated Stepper to use stepperId (runtime + demo + docs), aligned event naming to hux-stepper:{stepperId}:change, and completed a deeper accessibility pass with explicit step-state indicators and strengthened ARIA guidance/markup alignment.

Screenshot: /tmp/playwright-logs/stepper-stepperId-accessibility-final.png

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • fonts.google.com
    • Triggering command: /home/REDACTED/work/_temp/ghcca-node/node/bin/node node /home/REDACTED/work/hyperux/hyperux/node_modules/.bin/../astro/bin/astro.mjs build /esbuild/bin/esbuild (dns block)
    • Triggering command: /home/REDACTED/work/_temp/ghcca-node/node/bin/node node /home/REDACTED/work/hyperux/hyperux/node_modules/.bin/../astro/bin/astro.mjs build (dns block)
    • Triggering command: /home/REDACTED/work/_temp/ghcca-node/node/bin/node node /home/REDACTED/work/hyperux/hyperux/node_modules/.bin/../astro/bin/astro.mjs dev --host 0.0.0.0 --port 4321 developer-action-main/ebpf/in-path/mkcert (dns block)
  • sparrow.cloudflare.com
    • Triggering command: /opt/hostedtoolcache/node/24.15.0/x64/bin/node /opt/hostedtoolcache/node/24.15.0/x64/bin/node --no-warnings --experimental-vm-modules /home/REDACTED/work/hyperux/hyperux/node_modules/.pnpm/wrangler@4.93.1/node_modules/wrangler/wrangler-dist/cli.js types (dns block)
  • telemetry.astro.build
    • Triggering command: /home/REDACTED/work/_temp/ghcca-node/node/bin/node node /home/REDACTED/work/hyperux/hyperux/node_modules/.bin/../astro/bin/astro.mjs build /esbuild/bin/esbuild (dns block)
    • Triggering command: /home/REDACTED/work/_temp/ghcca-node/node/bin/node node /home/REDACTED/work/hyperux/hyperux/node_modules/.bin/../astro/bin/astro.mjs build (dns block)
    • Triggering command: /home/REDACTED/work/_temp/ghcca-node/node/bin/node node /home/REDACTED/work/hyperux/hyperux/node_modules/.bin/../astro/bin/astro.mjs dev --host 0.0.0.0 --port 4321 developer-action-main/ebpf/in-path/mkcert (dns block)
  • workers.cloudflare.com
    • Triggering command: /home/REDACTED/work/_temp/ghcca-node/node/bin/node node /home/REDACTED/work/hyperux/hyperux/node_modules/.bin/../astro/bin/astro.mjs check (dns block)
    • Triggering command: /home/REDACTED/work/_temp/ghcca-node/node/bin/node node /home/REDACTED/work/hyperux/hyperux/node_modules/.bin/../astro/bin/astro.mjs build /esbuild/bin/esbuild (dns block)
    • Triggering command: /home/REDACTED/work/_temp/ghcca-node/node/bin/node node /home/REDACTED/work/hyperux/hyperux/node_modules/.bin/../astro/bin/astro.mjs build (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Replace symbolic status markers (●, ✓, ○) with plain text labels (“Current”, “Completed”, “Not completed”) in Stepper.astro and stepper.mdx to improve screen-reader clarity and avoid reliance on symbols or color. Also tidy a minor span formatting/whitespace in Stepper.astro.
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

Comment thread src/content/patterns/stepper.mdx Outdated
Comment on lines +159 to +160
- When `stepperId` is set, `hux-stepper:{stepperId}:change` is dispatched on init and on every successful step change.

@markmead
Copy link
Copy Markdown
Owner

@copilot Address the feedback. Also, can you explain how huxWizard would be different from the huxStepper component.

Copy link
Copy Markdown
Contributor Author

Copilot AI commented May 23, 2026

@copilot Address the feedback. Also, can you explain how huxWizard would be different from the huxStepper component.

Addressed in commit 5a02dd9.

I updated the Stepper Behavior Contract docs to match implementation exactly: hux-stepper:{stepperId}:change dispatches on init only when activeStepId !== null, then on successful step changes.

huxStepper vs huxWizard:

  • huxStepper is a navigation/state primitive (active step, movement, completion helpers, step change events).
  • huxWizard would be a higher-level orchestration layer built on top of Stepper (step validation rules, form-data lifecycle, async submission/loading/error handling, optional persistence, and guarded transitions).

Screenshot: /tmp/playwright-logs/stepper-init-event-doc-update.png

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • fonts.google.com
    • Triggering command: /home/REDACTED/work/_temp/ghcca-node/node/bin/node node /home/REDACTED/work/hyperux/hyperux/node_modules/.bin/../astro/bin/astro.mjs build /esbuild/bin/esbuild (dns block)
    • Triggering command: /home/REDACTED/work/_temp/ghcca-node/node/bin/node node /home/REDACTED/work/hyperux/hyperux/node_modules/.bin/../astro/bin/astro.mjs build (dns block)
    • Triggering command: /home/REDACTED/work/_temp/ghcca-node/node/bin/node node /home/REDACTED/work/hyperux/hyperux/node_modules/.bin/../astro/bin/astro.mjs dev --host 0.0.0.0 --port 4321 (dns block)
  • sparrow.cloudflare.com
    • Triggering command: /opt/hostedtoolcache/node/24.15.0/x64/bin/node /opt/hostedtoolcache/node/24.15.0/x64/bin/node --no-warnings --experimental-vm-modules /home/REDACTED/work/hyperux/hyperux/node_modules/.pnpm/wrangler@4.93.1/node_modules/wrangler/wrangler-dist/cli.js types (dns block)
  • telemetry.astro.build
    • Triggering command: /home/REDACTED/work/_temp/ghcca-node/node/bin/node node /home/REDACTED/work/hyperux/hyperux/node_modules/.bin/../astro/bin/astro.mjs build /esbuild/bin/esbuild (dns block)
    • Triggering command: /home/REDACTED/work/_temp/ghcca-node/node/bin/node node /home/REDACTED/work/hyperux/hyperux/node_modules/.bin/../astro/bin/astro.mjs build (dns block)
    • Triggering command: /home/REDACTED/work/_temp/ghcca-node/node/bin/node node /home/REDACTED/work/hyperux/hyperux/node_modules/.bin/../astro/bin/astro.mjs dev --host 0.0.0.0 --port 4321 (dns block)
  • workers.cloudflare.com
    • Triggering command: /home/REDACTED/work/_temp/ghcca-node/node/bin/node node /home/REDACTED/work/hyperux/hyperux/node_modules/.bin/../astro/bin/astro.mjs check (dns block)
    • Triggering command: /home/REDACTED/work/_temp/ghcca-node/node/bin/node node /home/REDACTED/work/hyperux/hyperux/node_modules/.bin/../astro/bin/astro.mjs build /esbuild/bin/esbuild (dns block)
    • Triggering command: /home/REDACTED/work/_temp/ghcca-node/node/bin/node node /home/REDACTED/work/hyperux/hyperux/node_modules/.bin/../astro/bin/astro.mjs build (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot AI requested a review from markmead May 23, 2026 18:20
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated no new comments.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated no new comments.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add "Stepper" pattern/component as base for "Wizard"

3 participants