@tribepad/themis 1.5.6 → 1.5.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +10 -0
- package/dist/elements/Wizard/Wizard.d.ts.map +1 -1
- package/dist/elements/Wizard/Wizard.types.d.ts +49 -0
- package/dist/elements/Wizard/Wizard.types.d.ts.map +1 -1
- package/dist/elements/Wizard/WizardContent.d.ts +17 -8
- package/dist/elements/Wizard/WizardContent.d.ts.map +1 -1
- package/dist/elements/Wizard/WizardContext.d.ts +3 -1
- package/dist/elements/Wizard/WizardContext.d.ts.map +1 -1
- package/dist/elements/Wizard/WizardStep.d.ts.map +1 -1
- package/dist/elements/Wizard/index.js +1 -1
- package/dist/elements/Wizard/index.js.map +1 -1
- package/dist/elements/Wizard/index.mjs +1 -1
- package/dist/elements/Wizard/index.mjs.map +1 -1
- package/dist/elements/index.js +1 -1
- package/dist/elements/index.js.map +1 -1
- package/dist/elements/index.mjs +1 -1
- package/dist/elements/index.mjs.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/elements/Wizard/Wizard.stories.tsx +95 -0
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,16 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [1.5.8] - 2026-05-28
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
- **Wizard.Content** — new opt-in `preserveState` prop (default `false`). When `true`, every `Wizard.Step` child is mounted on first render and stays mounted across step transitions; inactive steps are wrapped in React 19.2's `<Activity mode="hidden">` so their effects pause and their in-memory state survives back/forward navigation. Mirrors the `Tabs.Panel` `preserveState` pattern, using the same conditional-import-with-fallback so consumers on pre-19.2 React degrade to the legacy "render only the active step" behaviour instead of crashing. Use when step subtrees own non-trivial draft state (autosaving forms, typed-but-not-yet-saved inputs); leave off for wizards with heavy per-step boot cost.
|
|
12
|
+
|
|
13
|
+
## [1.5.7] - 2026-05-27
|
|
14
|
+
|
|
15
|
+
### Added
|
|
16
|
+
- **Wizard** — new `stepHeadingLevel` prop (`'h2' | 'h3' | 'h4' | 'h5' | 'h6'`, default `'h3'`) on the Wizard root. Each step's title (the focus target on step change) was previously a hardcoded `<h3>`, which forced a skipped heading level (and a duplicate heading) on any consumer whose wizard sits directly under an `<h1>`. Consumers can now set the level so the step title nests correctly under their page hierarchy (WCAG 1.3.1 / 2.4.10). Backward-compatible — omitting the prop keeps the `h3` behaviour.
|
|
17
|
+
|
|
8
18
|
## [1.5.6] - 2026-05-18
|
|
9
19
|
|
|
10
20
|
### Fixed
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Wizard.d.ts","sourceRoot":"","sources":["../../../src/elements/Wizard/Wizard.tsx"],"names":[],"mappings":"AAsCA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"Wizard.d.ts","sourceRoot":"","sources":["../../../src/elements/Wizard/Wizard.tsx"],"names":[],"mappings":"AAsCA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAqIlD;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,eAAO,MAAM,MAAM;;;;;;;CAOjB,CAAC"}
|
|
@@ -37,6 +37,23 @@ export interface WizardNavigationLabels {
|
|
|
37
37
|
finish?: WizardNavigationLabel;
|
|
38
38
|
}
|
|
39
39
|
export type WizardAnnounceTemplate = (index: number, total: number, label: string) => string;
|
|
40
|
+
/**
|
|
41
|
+
* Heading level for each step's title (the focus target on step change).
|
|
42
|
+
*
|
|
43
|
+
* Defaults to `h3`. Set this so the step heading sits one level below the
|
|
44
|
+
* consumer's surrounding page hierarchy — e.g. a page with an `<h1>` page
|
|
45
|
+
* title and an `<h2>` section should pass `stepHeadingLevel="h3"` (the
|
|
46
|
+
* default), whereas a page whose wizard sits directly under the `<h1>`
|
|
47
|
+
* should pass `"h2"` to avoid a skipped heading level (WCAG 1.3.1 / 2.4.10).
|
|
48
|
+
*/
|
|
49
|
+
export declare const WizardHeadingLevelSchema: z.ZodEnum<{
|
|
50
|
+
h2: "h2";
|
|
51
|
+
h3: "h3";
|
|
52
|
+
h4: "h4";
|
|
53
|
+
h5: "h5";
|
|
54
|
+
h6: "h6";
|
|
55
|
+
}>;
|
|
56
|
+
export type WizardHeadingLevel = z.infer<typeof WizardHeadingLevelSchema>;
|
|
40
57
|
export declare const WizardPropsSchema: z.ZodObject<{
|
|
41
58
|
className: z.ZodOptional<z.ZodString>;
|
|
42
59
|
id: z.ZodOptional<z.ZodString>;
|
|
@@ -61,6 +78,13 @@ export declare const WizardPropsSchema: z.ZodObject<{
|
|
|
61
78
|
isLoading: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
62
79
|
errors: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
63
80
|
announceTemplate: z.ZodOptional<z.ZodCustom<WizardAnnounceTemplate, WizardAnnounceTemplate>>;
|
|
81
|
+
stepHeadingLevel: z.ZodDefault<z.ZodOptional<z.ZodEnum<{
|
|
82
|
+
h2: "h2";
|
|
83
|
+
h3: "h3";
|
|
84
|
+
h4: "h4";
|
|
85
|
+
h5: "h5";
|
|
86
|
+
h6: "h6";
|
|
87
|
+
}>>>;
|
|
64
88
|
}, z.core.$strip>;
|
|
65
89
|
export interface WizardProps {
|
|
66
90
|
children: ReactNode;
|
|
@@ -70,6 +94,12 @@ export interface WizardProps {
|
|
|
70
94
|
isLoading?: boolean;
|
|
71
95
|
errors?: string[];
|
|
72
96
|
announceTemplate?: WizardAnnounceTemplate;
|
|
97
|
+
/**
|
|
98
|
+
* Heading level for each step's title. Defaults to `'h3'`. See
|
|
99
|
+
* {@link WizardHeadingLevel} for how to pick a level that keeps the
|
|
100
|
+
* consumer's heading hierarchy unbroken.
|
|
101
|
+
*/
|
|
102
|
+
stepHeadingLevel?: WizardHeadingLevel;
|
|
73
103
|
className?: string;
|
|
74
104
|
id?: string;
|
|
75
105
|
'aria-label'?: string;
|
|
@@ -165,11 +195,30 @@ export declare const WizardContentPropsSchema: z.ZodObject<{
|
|
|
165
195
|
'aria-hidden': z.ZodOptional<z.ZodBoolean>;
|
|
166
196
|
'data-testid': z.ZodOptional<z.ZodString>;
|
|
167
197
|
children: z.ZodCustom<ReactNode, ReactNode>;
|
|
198
|
+
preserveState: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
168
199
|
}, z.core.$strip>;
|
|
169
200
|
export interface WizardContentProps {
|
|
170
201
|
children: ReactNode;
|
|
171
202
|
className?: string;
|
|
172
203
|
'data-testid'?: string;
|
|
204
|
+
/**
|
|
205
|
+
* When `true`, ALL `Wizard.Step` children stay mounted across step
|
|
206
|
+
* transitions; only the currently-selected step is visible (uses React
|
|
207
|
+
* 19.2's `<Activity>` API so inactive steps' effects pause and their
|
|
208
|
+
* in-memory state survives). This is the same opt-in `preserveState`
|
|
209
|
+
* pattern `Tabs.Panel` uses (see `Tabs.tsx`).
|
|
210
|
+
*
|
|
211
|
+
* Defaults to `false` — preserves the legacy "render only the active
|
|
212
|
+
* step" behaviour, so existing consumers see no change.
|
|
213
|
+
*
|
|
214
|
+
* Use this when the step subtrees own non-trivial local state that must
|
|
215
|
+
* survive back/forward navigation (e.g. an autosaving form whose
|
|
216
|
+
* typed-but-not-yet-saved values would otherwise be lost on remount).
|
|
217
|
+
* Memory note: every step is mounted, so don't enable for wizards with
|
|
218
|
+
* heavy per-step initialisation (multiple file uploaders, etc.) — the
|
|
219
|
+
* legacy default exists for that case.
|
|
220
|
+
*/
|
|
221
|
+
preserveState?: boolean;
|
|
173
222
|
}
|
|
174
223
|
export declare const WizardNavigationPropsSchema: z.ZodObject<{
|
|
175
224
|
className: z.ZodOptional<z.ZodString>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Wizard.types.d.ts","sourceRoot":"","sources":["../../../src/elements/Wizard/Wizard.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,KAAK,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAMrD,eAAO,MAAM,wBAAwB;;;;;EAA2C,CAAC;AACjF,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAM1E,eAAO,MAAM,0BAA0B;;;;iBAIrC,CAAC;AAEH,MAAM,WAAW,oBAAoB;IACnC,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAMD,MAAM,WAAW,qBAAqB;IACpC,KAAK,EAAE,MAAM,CAAC;IACd,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,kBAAkB,CAAC;CAC5B;AAMD,MAAM,WAAW,4BAA4B;IAC3C,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,EAAE,EAAE,MAAM,CAAC;CACZ;AAED,MAAM,MAAM,qBAAqB,GAC7B,MAAM,GACN,CAAC,CAAC,GAAG,EAAE,4BAA4B,KAAK,MAAM,CAAC,CAAC;AAEpD,MAAM,WAAW,sBAAsB;IACrC,IAAI,CAAC,EAAE,qBAAqB,CAAC;IAC7B,IAAI,CAAC,EAAE,qBAAqB,CAAC;IAC7B,IAAI,CAAC,EAAE,qBAAqB,CAAC;IAC7B,KAAK,CAAC,EAAE,qBAAqB,CAAC;IAC9B,MAAM,CAAC,EAAE,qBAAqB,CAAC;CAChC;AAMD,MAAM,MAAM,sBAAsB,GAAG,CACnC,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,MAAM,KACV,MAAM,CAAC;AAMZ,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;sCAIG,qBAAqB,KAAK,IAAI,UAA9B,qBAAqB,KAAK,IAAI
|
|
1
|
+
{"version":3,"file":"Wizard.types.d.ts","sourceRoot":"","sources":["../../../src/elements/Wizard/Wizard.types.ts"],"names":[],"mappings":"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"}
|
|
@@ -1,14 +1,23 @@
|
|
|
1
1
|
import type { WizardContentProps } from './Wizard.types';
|
|
2
2
|
/**
|
|
3
|
-
* Renders
|
|
4
|
-
* are unmounted — this is deliberate. It preserves the pre-migration
|
|
5
|
-
* `renderStepContent()` switch-case behaviour (one step mounted at a time)
|
|
6
|
-
* and prevents 6 file-upload forms from mounting simultaneously on a 6-step
|
|
7
|
-
* branding wizard.
|
|
3
|
+
* Renders the currently-selected `Wizard.Step`'s subtree.
|
|
8
4
|
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
5
|
+
* Default mode (legacy, `preserveState={false}`): only the active step is
|
|
6
|
+
* mounted. Inactive steps are unmounted on step change — fast and lean, but
|
|
7
|
+
* any step-local state (Formik values, typed-but-not-yet-saved inputs,
|
|
8
|
+
* autosave timers) is destroyed on every navigation and re-initialised on
|
|
9
|
+
* remount. This preserves the pre-1.5.8 behaviour for existing consumers.
|
|
10
|
+
*
|
|
11
|
+
* Opt-in mode (`preserveState={true}`): ALL `Wizard.Step` children stay
|
|
12
|
+
* mounted across step transitions; only the active one is visible (every
|
|
13
|
+
* step is wrapped in React 19.2's `<Activity mode="visible|hidden">`, which
|
|
14
|
+
* mounts the subtree but pauses effects for the hidden ones). Use this
|
|
15
|
+
* when the candidate's draft state needs to survive back/forward navigation.
|
|
16
|
+
* Mirrors the `Tabs.Panel` `preserveState` pattern.
|
|
17
|
+
*
|
|
18
|
+
* Trade-off: enabling `preserveState` mounts every step on first render, so
|
|
19
|
+
* keep it off for wizards with heavy per-step boot cost (multiple
|
|
20
|
+
* file-upload fields, etc.). The legacy default exists for that case.
|
|
12
21
|
*/
|
|
13
22
|
export declare const WizardContent: import("react").ForwardRefExoticComponent<WizardContentProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
14
23
|
//# sourceMappingURL=WizardContent.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WizardContent.d.ts","sourceRoot":"","sources":["../../../src/elements/Wizard/WizardContent.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"WizardContent.d.ts","sourceRoot":"","sources":["../../../src/elements/Wizard/WizardContent.tsx"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,kBAAkB,EAAmB,MAAM,gBAAgB,CAAC;AA2B1E;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,aAAa,+GA+DzB,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { WizardStepChangeEvent, WizardStepDescriptor, WizardAnnounceTemplate } from './Wizard.types';
|
|
1
|
+
import type { WizardStepChangeEvent, WizardStepDescriptor, WizardAnnounceTemplate, WizardHeadingLevel } from './Wizard.types';
|
|
2
2
|
export interface WizardContextValue {
|
|
3
3
|
currentStepIndex: number;
|
|
4
4
|
currentStepId: string;
|
|
@@ -7,6 +7,8 @@ export interface WizardContextValue {
|
|
|
7
7
|
isLoading: boolean;
|
|
8
8
|
errors: string[];
|
|
9
9
|
announceTemplate: WizardAnnounceTemplate;
|
|
10
|
+
/** Heading level for each step's title. Defaults to `'h3'` at the root. */
|
|
11
|
+
stepHeadingLevel: WizardHeadingLevel;
|
|
10
12
|
onStepChange: (event: WizardStepChangeEvent) => void;
|
|
11
13
|
/** Callback invoked by Wizard.Content after a step change to hand the heading node to the root for focus-on-change. */
|
|
12
14
|
registerStepHeading: (node: HTMLHeadingElement | null) => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WizardContext.d.ts","sourceRoot":"","sources":["../../../src/elements/Wizard/WizardContext.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,qBAAqB,EACrB,oBAAoB,EACpB,sBAAsB,
|
|
1
|
+
{"version":3,"file":"WizardContext.d.ts","sourceRoot":"","sources":["../../../src/elements/Wizard/WizardContext.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,qBAAqB,EACrB,oBAAoB,EACpB,sBAAsB,EACtB,kBAAkB,EACnB,MAAM,gBAAgB,CAAC;AAExB,MAAM,WAAW,kBAAkB;IACjC,gBAAgB,EAAE,MAAM,CAAC;IACzB,aAAa,EAAE,MAAM,CAAC;IACtB,KAAK,EAAE,oBAAoB,EAAE,CAAC;IAC9B,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,OAAO,CAAC;IACnB,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,gBAAgB,EAAE,sBAAsB,CAAC;IACzC,2EAA2E;IAC3E,gBAAgB,EAAE,kBAAkB,CAAC;IACrC,YAAY,EAAE,CAAC,KAAK,EAAE,qBAAqB,KAAK,IAAI,CAAC;IACrD,uHAAuH;IACvH,mBAAmB,EAAE,CAAC,IAAI,EAAE,kBAAkB,GAAG,IAAI,KAAK,IAAI,CAAC;CAChE;AAED,eAAO,MAAM,aAAa,oDAAiD,CAAC;AAE5E,wBAAgB,gBAAgB,IAAI,kBAAkB,CAMrD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WizardStep.d.ts","sourceRoot":"","sources":["../../../src/elements/Wizard/WizardStep.tsx"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAEtD;;;;;;;;GAQG;AACH,eAAO,MAAM,UAAU,
|
|
1
|
+
{"version":3,"file":"WizardStep.d.ts","sourceRoot":"","sources":["../../../src/elements/Wizard/WizardStep.tsx"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAEtD;;;;;;;;GAQG;AACH,eAAO,MAAM,UAAU,yGA0DtB,CAAC"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
'use strict';var react=require('react'),clsx=require('clsx'),tailwindMerge=require('tailwind-merge'),classVarianceAuthority=require('class-variance-authority'),jsxRuntime=require('react/jsx-runtime'),lucideReact=require('lucide-react'),reactAriaComponents=require('react-aria-components'),zod=require('zod');function z(...s){return tailwindMerge.twMerge(clsx.clsx(s))}var et=react.createContext(null);function W(){let s=react.useContext(et);if(!s)throw new Error("Wizard compound components must be used within <Wizard>");return s}var H=["motion-reduce:transition-none","motion-reduce:animate-none"],rt=["transition-colors","duration-200"];function G(...s){return s.flatMap(t=>Array.isArray(t)?[...t]:[t])}var it=classVarianceAuthority.cva("flex min-h-0 flex-1 flex-col"),ot=classVarianceAuthority.cva("flex min-h-0 flex-1 flex-col lg:flex-row"),nt=classVarianceAuthority.cva("flex min-w-0 flex-1 justify-center gap-8 overflow-y-auto bg-[var(--page-background)] p-6"),st=classVarianceAuthority.cva("hidden w-56 shrink-0 pt-2 lg:block"),dt=classVarianceAuthority.cva("flex w-full max-w-2xl flex-col"),pt=classVarianceAuthority.cva("mt-3 text-center text-xs text-[var(--menu-muted)]"),lt=classVarianceAuthority.cva("hidden w-80 shrink-0 border-l border-[var(--border)] bg-[var(--accent-background)] p-6 xl:block"),ct=classVarianceAuthority.cva("flex flex-col gap-2"),ut=classVarianceAuthority.cva("text-xs font-semibold uppercase tracking-wide text-[var(--primary)]"),mt=classVarianceAuthority.cva("text-sm font-bold text-[var(--content-foreground)]"),ft=classVarianceAuthority.cva("mt-6 flex flex-col"),xt=classVarianceAuthority.cva("flex items-start"),gt=classVarianceAuthority.cva("flex w-11 shrink-0 flex-col items-center"),vt=classVarianceAuthority.cva(G("flex h-9 w-9 shrink-0 items-center justify-center rounded-full text-sm font-semibold",rt,H),{variants:{state:{completed:"bg-[var(--primary)] text-[var(--primary-foreground)]",current:"border-2 border-[var(--primary)] bg-[var(--content-background)] text-[var(--primary)]",upcoming:"border border-[var(--border)] bg-[var(--content-background)] text-[var(--menu-muted)]"}},defaultVariants:{state:"upcoming"}}),zt=classVarianceAuthority.cva(G("my-0.5 h-5 w-0.5",rt,H),{variants:{completed:{true:"bg-[var(--primary)]",false:"bg-[var(--border)]"}},defaultVariants:{completed:false}}),bt=classVarianceAuthority.cva("flex min-h-11 items-center pl-3"),St=classVarianceAuthority.cva("flex flex-col justify-center"),ht=classVarianceAuthority.cva("text-sm",{variants:{state:{completed:"font-medium text-[var(--content-foreground)]",current:"font-semibold text-[var(--content-foreground)]",upcoming:"text-[var(--menu-muted)]"}},defaultVariants:{state:"upcoming"}}),wt=classVarianceAuthority.cva("text-xs text-[var(--primary)]"),Nt=classVarianceAuthority.cva("flex flex-col gap-6"),Wt=classVarianceAuthority.cva("flex items-start gap-4"),Vt=classVarianceAuthority.cva("flex h-12 w-12 shrink-0 items-center justify-center rounded-full bg-[var(--accent-background)] text-[var(--primary)]"),yt=classVarianceAuthority.cva("text-lg font-bold text-[var(--content-foreground)] focus:outline-none"),Ct=classVarianceAuthority.cva("mt-1 text-sm text-[var(--menu-muted)]"),Lt=classVarianceAuthority.cva("rounded-lg border border-[var(--border)] bg-[var(--content-background)] p-6 text-[var(--content-foreground)]"),Et=classVarianceAuthority.cva("mt-4 flex items-center justify-between border-t border-[var(--border)] pt-4"),Rt=classVarianceAuthority.cva(""),Pt=classVarianceAuthority.cva("flex items-center gap-3"),Tt=classVarianceAuthority.cva("flex flex-col items-center gap-1.5 py-3 lg:hidden"),It=classVarianceAuthority.cva("flex items-center justify-center gap-2"),_t=classVarianceAuthority.cva(G("h-2 rounded-full transition-all duration-200",H),{variants:{state:{completed:"w-2 bg-[var(--primary)] opacity-60",current:"w-8 bg-[var(--primary)]",upcoming:"w-2 bg-[var(--border)]"}},defaultVariants:{state:"upcoming"}}),At=classVarianceAuthority.cva("text-xs font-medium text-[var(--menu-muted)]"),kt=classVarianceAuthority.cva("text-[var(--content-foreground)]"),$=classVarianceAuthority.cva("sr-only");var U=react.forwardRef(function({children:t,stepper:m,preview:d,helpText:l,className:x,"data-testid":r="wizard-layout"},i){return jsxRuntime.jsxs("div",{ref:i,className:z(ot(),x),"data-testid":r,children:[jsxRuntime.jsxs("div",{className:nt(),children:[m?jsxRuntime.jsx("nav",{className:st(),"aria-label":"Wizard steps","data-testid":`${r}-stepper-slot`,children:m}):null,jsxRuntime.jsxs("div",{className:dt(),children:[t,l?jsxRuntime.jsx("p",{className:pt(),children:l}):null]})]}),d?jsxRuntime.jsx("aside",{className:lt(),"aria-hidden":"true","data-testid":`${r}-preview`,children:d}):null]})});U.displayName="Wizard.Layout";var qt=classVarianceAuthority.cva("inline-flex justify-center min-h-[44px] min-w-[44px] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--ring)] focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:pointer-events-none disabled:opacity-50",{variants:{fullWidth:{true:"w-full",false:""},inVerticalGroup:{true:"items-stretch",false:"items-center"}},defaultVariants:{fullWidth:false,inVerticalGroup:false}}),Xt=classVarianceAuthority.cva("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium ring-offset-background motion-safe:transition-transform motion-safe:duration-200 motion-safe:[transition-timing-function:cubic-bezier(0.34,1.56,0.64,1)] motion-reduce:transition-none [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0 relative cursor-pointer",{variants:{variant:{default:"bg-[var(--primary-action)] text-[var(--primary-action-foreground)] shadow-md hover:bg-[var(--primary-action-hover)] hover:-translate-y-1",destructive:"bg-[var(--destructive-background)] text-[var(--destructive-foreground)] shadow-md hover:bg-[var(--destructive-background-hover,var(--destructive-background))] motion-safe:hover:btn-warn-shake",outline:"border border-[var(--input-border)] bg-[var(--page-background)] hover:bg-[var(--input-border)]",secondary:"bg-[var(--secondary)] text-[var(--secondary-foreground)] shadow-md hover:bg-[var(--secondary-hover,var(--secondary))]",ghost:"hover:bg-[var(--accent)] hover:text-[var(--accent-foreground)]",link:"text-[var(--text-link)] underline underline-offset-4 hover:bg-[var(--accent)] hover:text-[var(--text-link-hover)]"},fullWidth:{true:"w-full",false:""},visualSize:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3 text-xs",lg:"h-11 rounded-md px-8",icon:"h-10 w-10",dot:"h-5 w-5 rounded-full p-0 min-h-0 min-w-0"},paywall:{true:"!bg-[var(--paywall)] !text-[var(--paywall-foreground)] !shadow-md hover:!bg-[var(--paywall)]/90 !cursor-not-allowed !border-transparent",false:""}},defaultVariants:{variant:"default",visualSize:"default",paywall:false}});var Ot="data-[pressed]:scale-[0.97]";var Bt="data-[hovered]:shadow-md";var F="hc:data-[hovered]:outline hc:data-[hovered]:outline-2 hc:data-[hovered]:outline-foreground",Y="hc:data-[pressed]:outline hc:data-[pressed]:outline-2 hc:data-[pressed]:outline-offset-1 hc:data-[pressed]:outline-foreground";var te=react.createContext(null);te.displayName="ButtonGroupContext";function ee(){return react.useContext(te)}var ae=react.createContext(null);ae.displayName="ButtonGroupItemContext";function re(){return react.useContext(ae)}classVarianceAuthority.cva("inline-flex items-center gap-0",{variants:{orientation:{horizontal:"flex-row",vertical:"flex-col w-full"}},defaultVariants:{orientation:"horizontal"}});var ie=classVarianceAuthority.cva("",{variants:{orientation:{horizontal:"min-w-[44px]",vertical:"flex min-h-[44px]"},position:{first:"",middle:"",last:"",only:""}},compoundVariants:[{orientation:"horizontal",position:"first",className:"rounded-r-none border-r-0"},{orientation:"horizontal",position:"middle",className:"rounded-none border-r-0"},{orientation:"horizontal",position:"last",className:"rounded-l-none"},{orientation:"vertical",position:"first",className:"rounded-b-none border-b-0"},{orientation:"vertical",position:"middle",className:"rounded-none border-b-0"},{orientation:"vertical",position:"last",className:"rounded-t-none"}],defaultVariants:{orientation:"horizontal",position:"only"}});classVarianceAuthority.cva("bg-[var(--border)]",{variants:{orientation:{horizontal:"w-px h-6 mx-1",vertical:"h-px w-full my-1"}},defaultVariants:{orientation:"horizontal"}});var I=react.memo(react.forwardRef(({className:s,buttonVisualClassName:t,variant:m,size:d,visualSize:l,fullWidth:x,loading:r=false,loadingText:i="Loading...",shortcut:b,children:n,isDisabled:g,paywall:p=false,paywallRedirect:c,paywallDescription:o,onPress:u,...f},v)=>{let h=react.useId(),S=ee(),V=re(),R=m??S?.variant??"default",C=d??S?.size,A=g??S?.isDisabled??false,P=S?.orientation==="vertical",T=x||P,k=V?ie({orientation:S?.orientation??"horizontal",position:V.position}):"",L=l??C??"default";return process.env.NODE_ENV!=="production"&&(L==="dot"||L==="icon")&&!f["aria-label"]&&!n&&console.warn('[Button] visualSize="dot" or "icon" requires aria-label when no visible text is provided (WCAG 1.1.1)'),jsxRuntime.jsx(reactAriaComponents.Button,{ref:v,isDisabled:A||r||void 0,"aria-disabled":p?true:void 0,"aria-describedby":p?h:void 0,onPress:B=>{if(p){c&&window.open(c,"_blank","noopener,noreferrer");return}u?.(B);},className:z(qt({fullWidth:T,inVerticalGroup:P}),s),...f,children:B=>jsxRuntime.jsxs("span",{className:z(Xt({variant:R,visualSize:L,paywall:p,fullWidth:T}),k,t,Ot,Bt,F,Y),"data-pressed":B.isPressed||void 0,children:[r&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(lucideReact.Loader2,{className:"motion-safe:animate-spin","aria-hidden":"true"}),jsxRuntime.jsx("span",{className:"sr-only","aria-live":"polite",children:i})]}),!r&&n,p&&jsxRuntime.jsx(lucideReact.Zap,{"data-testid":"zap-icon","aria-hidden":"true",className:"ml-1"}),p&&jsxRuntime.jsxs("span",{id:h,className:"sr-only",children:["Premium feature: ",o||"Upgrade required to access this feature"]}),B.isFocusVisible&&b&&jsxRuntime.jsx("kbd",{className:"ml-auto hidden text-xs opacity-60 lg:inline",children:b})]})})}));I.displayName="Button";var j=react.forwardRef(function({sectionLabel:t,sectionNumber:m,totalSections:d,allowClickOnCompleted:l=true,className:x,"aria-label":r,"data-testid":i="wizard-stepper"},b){let{currentStepIndex:n,steps:g,onStepChange:p,isLoading:c}=W();return jsxRuntime.jsxs("div",{ref:b,className:z(ct(),x),"aria-label":r,"data-testid":i,children:[t&&m!==void 0&&d!==void 0?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("p",{className:ut(),children:["Section ",m," of ",d]}),jsxRuntime.jsx("h2",{className:mt(),children:t})]}):null,jsxRuntime.jsx("ol",{className:ft(),children:g.map((o,u)=>{let f=u<n,v=u===n,h=f?"completed":v?"current":"upcoming",S=f&&l&&!c,V=u===g.length-1,R=vt({state:h}),C=jsxRuntime.jsx("span",{className:R,"aria-hidden":"true",children:f?jsxRuntime.jsx(lucideReact.Check,{className:"h-4 w-4"}):jsxRuntime.jsx("span",{children:u+1})});return jsxRuntime.jsx("li",{"data-testid":`${i}-item-${o.id}`,"aria-current":v?"step":void 0,children:jsxRuntime.jsxs("div",{className:xt(),children:[jsxRuntime.jsxs("div",{className:gt(),children:[S?jsxRuntime.jsx(I,{variant:"ghost",visualSize:"icon",buttonVisualClassName:"rounded-full","aria-label":`Go back to ${o.label}`,onPress:()=>p({index:u,id:o.id,label:o.label,reason:"jump"}),"data-testid":`${i}-button-${o.id}`,children:C}):jsxRuntime.jsx("span",{className:"flex h-11 w-11 items-center justify-center",children:C}),V?null:jsxRuntime.jsx("span",{className:zt({completed:f}),"aria-hidden":"true"})]}),jsxRuntime.jsxs("div",{className:bt(),children:[jsxRuntime.jsxs("span",{className:St(),children:[jsxRuntime.jsx("span",{className:ht({state:h}),children:o.label}),v?jsxRuntime.jsx("span",{className:wt(),children:"Current step"}):null]}),v?null:jsxRuntime.jsx("span",{className:"sr-only",children:f?"(completed)":"(upcoming)"})]})]})},o.id)})})]})});j.displayName="Wizard.Stepper";function Ee(s){if(!react.isValidElement(s))return false;let t=s.type;return typeof t=="string"?false:t?.displayName==="Wizard.Step"}var Z=react.forwardRef(function({children:t,className:m,"data-testid":d="wizard-content"},l){let{currentStepId:x,steps:r}=W(),i=react.Children.toArray(t).filter(Ee);if(process.env.NODE_ENV!=="production"){let n=i.map(o=>o.props.id),g=r.map(o=>o.id),p=g.filter(o=>!n.includes(o)),c=n.filter(o=>!g.includes(o));(p.length>0||c.length>0)&&console.warn("[Wizard] Wizard.Step children do not match `steps` descriptors. "+(p.length?`Missing steps: ${p.join(", ")}. `:"")+(c.length?`Unknown step ids: ${c.join(", ")}.`:""));}let b=i.find(n=>n.props.id===x)??null;return jsxRuntime.jsx("div",{ref:l,className:z(Lt(),m),"data-testid":d,children:b})});Z.displayName="Wizard.Content";var X=react.forwardRef(function({id:t,icon:m,children:d,className:l,"data-testid":x},r){let{steps:i,currentStepIndex:b,registerStepHeading:n}=W(),g=i.find(v=>v.id===t),p=g?.label??t,c=g?.description,o=react.useId(),u=react.useId(),f=x??`wizard-step-${t}`;return jsxRuntime.jsxs("section",{ref:r,className:z(Nt(),l),"aria-labelledby":o,"aria-describedby":c?u:void 0,"data-testid":f,"data-wizard-step-id":t,"data-wizard-step-index":b,children:[jsxRuntime.jsxs("div",{className:Wt(),children:[m?jsxRuntime.jsx("span",{className:Vt(),"aria-hidden":"true",children:m}):null,jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{id:o,ref:n,tabIndex:-1,className:yt(),children:p}),c?jsxRuntime.jsx("p",{id:u,className:Ct(),children:c}):null]})]}),jsxRuntime.jsx("div",{children:d})]})});X.displayName="Wizard.Step";var D={back:"Back",skip:"Skip for now",next:"Next",start:"Next",finish:"Finish"};function O(s,t){return typeof s=="function"?s(t):s}var J=react.forwardRef(function({labels:t,showSkip:m=false,onBack:d,onNext:l,onSkip:x,className:r,"data-testid":i="wizard-navigation"},b){let{currentStepIndex:n,currentStepId:g,totalSteps:p,steps:c,isLoading:o,onStepChange:u}=W(),f={index:n,total:p,id:g},v={back:O(t?.back??D.back,f),skip:O(t?.skip??D.skip,f),next:O(t?.next??D.next,f),start:O(t?.start??t?.next??D.start,f),finish:O(t?.finish??D.finish,f)},h=n===0,S=n===p-1,V=n===p-2,R=!h&&!S,C=!S,A=m&&!h&&!S&&!V,P=h?v.start:V?v.finish:v.next,T=()=>{let w=Math.max(0,n-1);u({index:w,id:c[w]?.id??"",label:c[w]?.label??"",reason:"back"}),d?.();},k=()=>{let w=Math.min(p-1,n+1);u({index:w,id:c[w]?.id??"",label:c[w]?.label??"",reason:"next"}),l?.();},L=()=>{let w=Math.min(p-1,n+1);u({index:w,id:c[w]?.id??"",label:c[w]?.label??"",reason:"skip"}),x?.();};return jsxRuntime.jsxs("div",{ref:b,className:z(Et(),r),"data-testid":i,children:[jsxRuntime.jsx("div",{className:Rt(),children:R?jsxRuntime.jsxs(I,{variant:"secondary",onPress:T,isDisabled:o,"data-testid":`${i}-back`,children:[jsxRuntime.jsx(lucideReact.ArrowLeft,{className:"mr-1 h-4 w-4 rtl:rotate-180","aria-hidden":"true"}),v.back]}):null}),jsxRuntime.jsxs("div",{className:Pt(),children:[A?jsxRuntime.jsx(I,{variant:"ghost",onPress:L,isDisabled:o,"data-testid":`${i}-skip`,children:v.skip}):null,C?jsxRuntime.jsxs(I,{variant:"default",onPress:k,isDisabled:o,loading:o,"data-testid":`${i}-next`,children:[P,V?null:jsxRuntime.jsx(lucideReact.ArrowRight,{className:"ml-1 h-4 w-4 rtl:rotate-180","aria-hidden":"true"})]}):null]})]})});J.displayName="Wizard.Navigation";var tt=react.forwardRef(function({className:t,"data-testid":m="wizard-mobile-progress"},d){let{currentStepIndex:l,steps:x,totalSteps:r}=W(),i=x[l]?.label,b=i?`Step ${l+1} of ${r}: ${i}`:`Step ${l+1} of ${r}`;return jsxRuntime.jsxs("div",{ref:d,className:z(Tt(),t),role:"progressbar","aria-label":"Wizard progress","aria-valuemin":1,"aria-valuemax":r,"aria-valuenow":l+1,"aria-valuetext":b,"data-testid":m,children:[jsxRuntime.jsx("div",{className:It(),children:x.map((n,g)=>{let p=g<l?"completed":g===l?"current":"upcoming";return jsxRuntime.jsx("span",{className:_t({state:p}),"aria-hidden":"true","data-testid":`${m}-dot-${n.id}`},n.id)})}),i?jsxRuntime.jsxs("p",{className:At(),"aria-hidden":"true","data-testid":`${m}-caption`,children:["Step ",l+1," of ",r," \xB7 ",jsxRuntime.jsx("span",{className:kt(),children:i})]}):null]})});tt.displayName="Wizard.MobileProgress";var Oe=(s,t)=>`Step ${s} of ${t}`,pe=react.forwardRef(function({children:t,currentStep:m,steps:d,onStepChange:l,isLoading:x=false,errors:r,announceTemplate:i=Oe,className:b,id:n,"aria-label":g,"aria-labelledby":p,"data-testid":c="wizard"},o){let u=Math.min(Math.max(m,0),Math.max(d.length-1,0)),f=d[u],v=f?.id??"",h=f?.label??"",[S,V]=react.useState("");react.useEffect(()=>{d.length!==0&&V(i(u+1,d.length,h));},[u,d.length,h,i]);let[R,C]=react.useState("");react.useEffect(()=>{if(!r||r.length===0){C("");return}C(r.join(". "));},[r]);let A=react.useRef(null),P=react.useRef(true),T=react.useCallback(L=>{A.current=L;},[]);react.useEffect(()=>{if(P.current){P.current=false;return}let L=requestAnimationFrame(()=>{A.current?.focus();});return ()=>cancelAnimationFrame(L)},[u]);let k=react.useMemo(()=>({currentStepIndex:u,currentStepId:v,steps:d,totalSteps:d.length,isLoading:x,errors:r??[],announceTemplate:i,onStepChange:l,registerStepHeading:T}),[u,v,d,x,r,i,l,T]);return jsxRuntime.jsx(et.Provider,{value:k,children:jsxRuntime.jsxs("div",{ref:o,id:n,className:z(it(),b),"aria-label":g,"aria-labelledby":p,"data-testid":c,"data-wizard-step":u,children:[t,jsxRuntime.jsx("div",{role:"status","aria-live":"polite","aria-atomic":"true",className:$(),"data-testid":`${c}-live-polite`,children:S}),jsxRuntime.jsx("div",{role:"alert","aria-live":"assertive","aria-atomic":"true",className:$(),"data-testid":`${c}-live-assertive`,children:R})]})})});pe.displayName="Wizard";var Be=Object.assign(pe,{Layout:U,Stepper:j,Content:Z,Step:X,Navigation:J,MobileProgress:tt});var E=zod.z.object({className:zod.z.string().optional(),children:zod.z.any().optional(),id:zod.z.string().optional(),"aria-label":zod.z.string().optional(),"aria-labelledby":zod.z.string().optional(),"aria-describedby":zod.z.string().optional(),"aria-live":zod.z.enum(["off","polite","assertive"]).optional(),"aria-hidden":zod.z.boolean().optional(),"data-testid":zod.z.string().optional()});var Ge=zod.z.enum(["next","back","skip","jump"]),le=zod.z.object({id:zod.z.string().min(1),label:zod.z.string().min(1),description:zod.z.string().optional()}),$e=E.extend({children:zod.z.custom(),currentStep:zod.z.number().int().min(0),steps:zod.z.array(le).min(1),onStepChange:zod.z.custom(),isLoading:zod.z.boolean().optional().default(false),errors:zod.z.array(zod.z.string()).optional(),announceTemplate:zod.z.custom().optional()}),Ue=E.extend({children:zod.z.custom(),preview:zod.z.custom().optional(),helpText:zod.z.string().optional()}),Fe=E.extend({sectionLabel:zod.z.string().optional(),sectionNumber:zod.z.number().int().min(1).optional(),totalSections:zod.z.number().int().min(1).optional(),allowClickOnCompleted:zod.z.boolean().optional().default(true)}),Ye=E.extend({id:zod.z.string().min(1),children:zod.z.custom(),icon:zod.z.custom().optional()}),je=E.extend({children:zod.z.custom()}),Ze=E.extend({labels:zod.z.custom().optional(),showSkip:zod.z.boolean().optional().default(false),onBack:zod.z.custom().optional(),onNext:zod.z.custom().optional(),onSkip:zod.z.custom().optional()}),qe=E.extend({});exports.Wizard=Be;exports.WizardChangeReasonSchema=Ge;exports.WizardContent=Z;exports.WizardContentPropsSchema=je;exports.WizardLayout=U;exports.WizardLayoutPropsSchema=Ue;exports.WizardMobileProgress=tt;exports.WizardMobileProgressPropsSchema=qe;exports.WizardNavigation=J;exports.WizardNavigationPropsSchema=Ze;exports.WizardPropsSchema=$e;exports.WizardStep=X;exports.WizardStepDescriptorSchema=le;exports.WizardStepPropsSchema=Ye;exports.WizardStepper=j;exports.WizardStepperPropsSchema=Fe;exports.useWizardContext=W;exports.wizardContentCardVariants=Lt;exports.wizardLayoutContentSlotVariants=dt;exports.wizardLayoutHelpTextVariants=pt;exports.wizardLayoutMainVariants=nt;exports.wizardLayoutPreviewVariants=lt;exports.wizardLayoutStepperSlotVariants=st;exports.wizardLayoutVariants=ot;exports.wizardLiveRegionVariants=$;exports.wizardMobileProgressCaptionTitleVariants=kt;exports.wizardMobileProgressCaptionVariants=At;exports.wizardMobileProgressContainerVariants=Tt;exports.wizardMobileProgressDotRowVariants=It;exports.wizardMobileProgressDotVariants=_t;exports.wizardNavigationLeftVariants=Rt;exports.wizardNavigationRightVariants=Pt;exports.wizardNavigationVariants=Et;exports.wizardRootVariants=it;exports.wizardStepContainerVariants=Nt;exports.wizardStepDescriptionVariants=Ct;exports.wizardStepHeaderRowVariants=Wt;exports.wizardStepHeadingVariants=yt;exports.wizardStepIconVariants=Vt;exports.wizardStepperCircleVariants=vt;exports.wizardStepperConnectorVariants=zt;exports.wizardStepperContainerVariants=ct;exports.wizardStepperCurrentSubtitleVariants=wt;exports.wizardStepperIndicatorColumnVariants=gt;exports.wizardStepperItemVariants=xt;exports.wizardStepperLabelColumnVariants=bt;exports.wizardStepperLabelTextVariants=ht;exports.wizardStepperLabelVariants=St;exports.wizardStepperListVariants=ft;exports.wizardStepperSectionHeadingVariants=mt;exports.wizardStepperSectionLabelVariants=ut;//# sourceMappingURL=index.js.map
|
|
2
|
+
'use strict';var react=require('react'),clsx=require('clsx'),tailwindMerge=require('tailwind-merge'),classVarianceAuthority=require('class-variance-authority'),jsxRuntime=require('react/jsx-runtime'),lucideReact=require('lucide-react'),reactAriaComponents=require('react-aria-components'),zod=require('zod');function v(...n){return tailwindMerge.twMerge(clsx.clsx(n))}var rt=react.createContext(null);function W(){let n=react.useContext(rt);if(!n)throw new Error("Wizard compound components must be used within <Wizard>");return n}var B=["motion-reduce:transition-none","motion-reduce:animate-none"],ot=["transition-colors","duration-200"];function G(...n){return n.flatMap(t=>Array.isArray(t)?[...t]:[t])}var nt=classVarianceAuthority.cva("flex min-h-0 flex-1 flex-col"),st=classVarianceAuthority.cva("flex min-h-0 flex-1 flex-col lg:flex-row"),dt=classVarianceAuthority.cva("flex min-w-0 flex-1 justify-center gap-8 overflow-y-auto bg-[var(--page-background)] p-6"),pt=classVarianceAuthority.cva("hidden w-56 shrink-0 pt-2 lg:block"),lt=classVarianceAuthority.cva("flex w-full max-w-2xl flex-col"),ct=classVarianceAuthority.cva("mt-3 text-center text-xs text-[var(--menu-muted)]"),ut=classVarianceAuthority.cva("hidden w-80 shrink-0 border-l border-[var(--border)] bg-[var(--accent-background)] p-6 xl:block"),mt=classVarianceAuthority.cva("flex flex-col gap-2"),ft=classVarianceAuthority.cva("text-xs font-semibold uppercase tracking-wide text-[var(--primary)]"),gt=classVarianceAuthority.cva("text-sm font-bold text-[var(--content-foreground)]"),xt=classVarianceAuthority.cva("mt-6 flex flex-col"),vt=classVarianceAuthority.cva("flex items-start"),zt=classVarianceAuthority.cva("flex w-11 shrink-0 flex-col items-center"),bt=classVarianceAuthority.cva(G("flex h-9 w-9 shrink-0 items-center justify-center rounded-full text-sm font-semibold",ot,B),{variants:{state:{completed:"bg-[var(--primary)] text-[var(--primary-foreground)]",current:"border-2 border-[var(--primary)] bg-[var(--content-background)] text-[var(--primary)]",upcoming:"border border-[var(--border)] bg-[var(--content-background)] text-[var(--menu-muted)]"}},defaultVariants:{state:"upcoming"}}),St=classVarianceAuthority.cva(G("my-0.5 h-5 w-0.5",ot,B),{variants:{completed:{true:"bg-[var(--primary)]",false:"bg-[var(--border)]"}},defaultVariants:{completed:false}}),ht=classVarianceAuthority.cva("flex min-h-11 items-center pl-3"),wt=classVarianceAuthority.cva("flex flex-col justify-center"),Nt=classVarianceAuthority.cva("text-sm",{variants:{state:{completed:"font-medium text-[var(--content-foreground)]",current:"font-semibold text-[var(--content-foreground)]",upcoming:"text-[var(--menu-muted)]"}},defaultVariants:{state:"upcoming"}}),Wt=classVarianceAuthority.cva("text-xs text-[var(--primary)]"),yt=classVarianceAuthority.cva("flex flex-col gap-6"),Vt=classVarianceAuthority.cva("flex items-start gap-4"),Ct=classVarianceAuthority.cva("flex h-12 w-12 shrink-0 items-center justify-center rounded-full bg-[var(--accent-background)] text-[var(--primary)]"),Lt=classVarianceAuthority.cva("text-lg font-bold text-[var(--content-foreground)] focus:outline-none"),Et=classVarianceAuthority.cva("mt-1 text-sm text-[var(--menu-muted)]"),$=classVarianceAuthority.cva("rounded-lg border border-[var(--border)] bg-[var(--content-background)] p-6 text-[var(--content-foreground)]"),Rt=classVarianceAuthority.cva("mt-4 flex items-center justify-between border-t border-[var(--border)] pt-4"),Pt=classVarianceAuthority.cva(""),Tt=classVarianceAuthority.cva("flex items-center gap-3"),It=classVarianceAuthority.cva("flex flex-col items-center gap-1.5 py-3 lg:hidden"),_t=classVarianceAuthority.cva("flex items-center justify-center gap-2"),At=classVarianceAuthority.cva(G("h-2 rounded-full transition-all duration-200",B),{variants:{state:{completed:"w-2 bg-[var(--primary)] opacity-60",current:"w-8 bg-[var(--primary)]",upcoming:"w-2 bg-[var(--border)]"}},defaultVariants:{state:"upcoming"}}),kt=classVarianceAuthority.cva("text-xs font-medium text-[var(--menu-muted)]"),Mt=classVarianceAuthority.cva("text-[var(--content-foreground)]"),U=classVarianceAuthority.cva("sr-only");var F=react.forwardRef(function({children:t,stepper:c,preview:s,helpText:u,className:x,"data-testid":r="wizard-layout"},i){return jsxRuntime.jsxs("div",{ref:i,className:v(st(),x),"data-testid":r,children:[jsxRuntime.jsxs("div",{className:dt(),children:[c?jsxRuntime.jsx("nav",{className:pt(),"aria-label":"Wizard steps","data-testid":`${r}-stepper-slot`,children:c}):null,jsxRuntime.jsxs("div",{className:lt(),children:[t,u?jsxRuntime.jsx("p",{className:ct(),children:u}):null]})]}),s?jsxRuntime.jsx("aside",{className:ut(),"aria-hidden":"true","data-testid":`${r}-preview`,children:s}):null]})});F.displayName="Wizard.Layout";var Xt=classVarianceAuthority.cva("inline-flex justify-center min-h-[44px] min-w-[44px] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--ring)] focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:pointer-events-none disabled:opacity-50",{variants:{fullWidth:{true:"w-full",false:""},inVerticalGroup:{true:"items-stretch",false:"items-center"}},defaultVariants:{fullWidth:false,inVerticalGroup:false}}),Kt=classVarianceAuthority.cva("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium ring-offset-background motion-safe:transition-transform motion-safe:duration-200 motion-safe:[transition-timing-function:cubic-bezier(0.34,1.56,0.64,1)] motion-reduce:transition-none [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0 relative cursor-pointer",{variants:{variant:{default:"bg-[var(--primary-action)] text-[var(--primary-action-foreground)] shadow-md hover:bg-[var(--primary-action-hover)] hover:-translate-y-1",destructive:"bg-[var(--destructive-background)] text-[var(--destructive-foreground)] shadow-md hover:bg-[var(--destructive-background-hover,var(--destructive-background))] motion-safe:hover:btn-warn-shake",outline:"border border-[var(--input-border)] bg-[var(--page-background)] hover:bg-[var(--input-border)]",secondary:"bg-[var(--secondary)] text-[var(--secondary-foreground)] shadow-md hover:bg-[var(--secondary-hover,var(--secondary))]",ghost:"hover:bg-[var(--accent)] hover:text-[var(--accent-foreground)]",link:"text-[var(--text-link)] underline underline-offset-4 hover:bg-[var(--accent)] hover:text-[var(--text-link-hover)]"},fullWidth:{true:"w-full",false:""},visualSize:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3 text-xs",lg:"h-11 rounded-md px-8",icon:"h-10 w-10",dot:"h-5 w-5 rounded-full p-0 min-h-0 min-w-0"},paywall:{true:"!bg-[var(--paywall)] !text-[var(--paywall-foreground)] !shadow-md hover:!bg-[var(--paywall)]/90 !cursor-not-allowed !border-transparent",false:""}},defaultVariants:{variant:"default",visualSize:"default",paywall:false}});var Ot="data-[pressed]:scale-[0.97]";var Bt="data-[hovered]:shadow-md";var Y="hc:data-[hovered]:outline hc:data-[hovered]:outline-2 hc:data-[hovered]:outline-foreground",j="hc:data-[pressed]:outline hc:data-[pressed]:outline-2 hc:data-[pressed]:outline-offset-1 hc:data-[pressed]:outline-foreground";var ee=react.createContext(null);ee.displayName="ButtonGroupContext";function ae(){return react.useContext(ee)}var re=react.createContext(null);re.displayName="ButtonGroupItemContext";function ie(){return react.useContext(re)}classVarianceAuthority.cva("inline-flex items-center gap-0",{variants:{orientation:{horizontal:"flex-row",vertical:"flex-col w-full"}},defaultVariants:{orientation:"horizontal"}});var oe=classVarianceAuthority.cva("",{variants:{orientation:{horizontal:"min-w-[44px]",vertical:"flex min-h-[44px]"},position:{first:"",middle:"",last:"",only:""}},compoundVariants:[{orientation:"horizontal",position:"first",className:"rounded-r-none border-r-0"},{orientation:"horizontal",position:"middle",className:"rounded-none border-r-0"},{orientation:"horizontal",position:"last",className:"rounded-l-none"},{orientation:"vertical",position:"first",className:"rounded-b-none border-b-0"},{orientation:"vertical",position:"middle",className:"rounded-none border-b-0"},{orientation:"vertical",position:"last",className:"rounded-t-none"}],defaultVariants:{orientation:"horizontal",position:"only"}});classVarianceAuthority.cva("bg-[var(--border)]",{variants:{orientation:{horizontal:"w-px h-6 mx-1",vertical:"h-px w-full my-1"}},defaultVariants:{orientation:"horizontal"}});var I=react.memo(react.forwardRef(({className:n,buttonVisualClassName:t,variant:c,size:s,visualSize:u,fullWidth:x,loading:r=false,loadingText:i="Loading...",shortcut:z,children:m,isDisabled:f,paywall:p=false,paywallRedirect:g,paywallDescription:o,onPress:l,...d},b)=>{let w=react.useId(),S=ae(),y=ie(),E=c??S?.variant??"default",C=s??S?.size,A=f??S?.isDisabled??false,R=S?.orientation==="vertical",P=x||R,k=y?oe({orientation:S?.orientation??"horizontal",position:y.position}):"",T=u??C??"default";return process.env.NODE_ENV!=="production"&&(T==="dot"||T==="icon")&&!d["aria-label"]&&!m&&console.warn('[Button] visualSize="dot" or "icon" requires aria-label when no visible text is provided (WCAG 1.1.1)'),jsxRuntime.jsx(reactAriaComponents.Button,{ref:b,isDisabled:A||r||void 0,"aria-disabled":p?true:void 0,"aria-describedby":p?w:void 0,onPress:O=>{if(p){g&&window.open(g,"_blank","noopener,noreferrer");return}l?.(O);},className:v(Xt({fullWidth:P,inVerticalGroup:R}),n),...d,children:O=>jsxRuntime.jsxs("span",{className:v(Kt({variant:E,visualSize:T,paywall:p,fullWidth:P}),k,t,Ot,Bt,Y,j),"data-pressed":O.isPressed||void 0,children:[r&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(lucideReact.Loader2,{className:"motion-safe:animate-spin","aria-hidden":"true"}),jsxRuntime.jsx("span",{className:"sr-only","aria-live":"polite",children:i})]}),!r&&m,p&&jsxRuntime.jsx(lucideReact.Zap,{"data-testid":"zap-icon","aria-hidden":"true",className:"ml-1"}),p&&jsxRuntime.jsxs("span",{id:w,className:"sr-only",children:["Premium feature: ",o||"Upgrade required to access this feature"]}),O.isFocusVisible&&z&&jsxRuntime.jsx("kbd",{className:"ml-auto hidden text-xs opacity-60 lg:inline",children:z})]})})}));I.displayName="Button";var Z=react.forwardRef(function({sectionLabel:t,sectionNumber:c,totalSections:s,allowClickOnCompleted:u=true,className:x,"aria-label":r,"data-testid":i="wizard-stepper"},z){let{currentStepIndex:m,steps:f,onStepChange:p,isLoading:g}=W();return jsxRuntime.jsxs("div",{ref:z,className:v(mt(),x),"aria-label":r,"data-testid":i,children:[t&&c!==void 0&&s!==void 0?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("p",{className:ft(),children:["Section ",c," of ",s]}),jsxRuntime.jsx("h2",{className:gt(),children:t})]}):null,jsxRuntime.jsx("ol",{className:xt(),children:f.map((o,l)=>{let d=l<m,b=l===m,w=d?"completed":b?"current":"upcoming",S=d&&u&&!g,y=l===f.length-1,E=bt({state:w}),C=jsxRuntime.jsx("span",{className:E,"aria-hidden":"true",children:d?jsxRuntime.jsx(lucideReact.Check,{className:"h-4 w-4"}):jsxRuntime.jsx("span",{children:l+1})});return jsxRuntime.jsx("li",{"data-testid":`${i}-item-${o.id}`,"aria-current":b?"step":void 0,children:jsxRuntime.jsxs("div",{className:vt(),children:[jsxRuntime.jsxs("div",{className:zt(),children:[S?jsxRuntime.jsx(I,{variant:"ghost",visualSize:"icon",buttonVisualClassName:"rounded-full","aria-label":`Go back to ${o.label}`,onPress:()=>p({index:l,id:o.id,label:o.label,reason:"jump"}),"data-testid":`${i}-button-${o.id}`,children:C}):jsxRuntime.jsx("span",{className:"flex h-11 w-11 items-center justify-center",children:C}),y?null:jsxRuntime.jsx("span",{className:St({completed:d}),"aria-hidden":"true"})]}),jsxRuntime.jsxs("div",{className:ht(),children:[jsxRuntime.jsxs("span",{className:wt(),children:[jsxRuntime.jsx("span",{className:Nt({state:w}),children:o.label}),b?jsxRuntime.jsx("span",{className:Wt(),children:"Current step"}):null]}),b?null:jsxRuntime.jsx("span",{className:"sr-only",children:d?"(completed)":"(upcoming)"})]})]})},o.id)})})]})});Z.displayName="Wizard.Stepper";var Pe=react.Activity??function({children:t,mode:c}){return jsxRuntime.jsx("div",{"data-activity-mode":c,children:t})};function Te(n){if(!react.isValidElement(n))return false;let t=n.type;return typeof t=="string"?false:t?.displayName==="Wizard.Step"}var X=react.forwardRef(function({children:t,className:c,"data-testid":s="wizard-content",preserveState:u=false},x){let{currentStepId:r,steps:i}=W(),z=react.Children.toArray(t).filter(Te);if(process.env.NODE_ENV!=="production"){let f=z.map(l=>l.props.id),p=i.map(l=>l.id),g=p.filter(l=>!f.includes(l)),o=f.filter(l=>!p.includes(l));(g.length>0||o.length>0)&&console.warn("[Wizard] Wizard.Step children do not match `steps` descriptors. "+(g.length?`Missing steps: ${g.join(", ")}. `:"")+(o.length?`Unknown step ids: ${o.join(", ")}.`:""));}if(u)return jsxRuntime.jsx("div",{ref:x,className:v($(),c),"data-testid":s,children:z.map(f=>jsxRuntime.jsx(Pe,{mode:f.props.id===r?"visible":"hidden",children:f},f.props.id))});let m=z.find(f=>f.props.id===r)??null;return jsxRuntime.jsx("div",{ref:x,className:v($(),c),"data-testid":s,children:m})});X.displayName="Wizard.Content";var Q=react.forwardRef(function({id:t,icon:c,children:s,className:u,"data-testid":x},r){let{steps:i,currentStepIndex:z,registerStepHeading:m,stepHeadingLevel:f}=W(),p=i.find(S=>S.id===t),g=p?.label??t,o=p?.description,l=react.useId(),d=react.useId(),b=x??`wizard-step-${t}`,w=f;return jsxRuntime.jsxs("section",{ref:r,className:v(yt(),u),"aria-labelledby":l,"aria-describedby":o?d:void 0,"data-testid":b,"data-wizard-step-id":t,"data-wizard-step-index":z,children:[jsxRuntime.jsxs("div",{className:Vt(),children:[c?jsxRuntime.jsx("span",{className:Ct(),"aria-hidden":"true",children:c}):null,jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx(w,{id:l,ref:m,tabIndex:-1,className:Lt(),children:g}),o?jsxRuntime.jsx("p",{id:d,className:Et(),children:o}):null]})]}),jsxRuntime.jsx("div",{children:s})]})});Q.displayName="Wizard.Step";var D={back:"Back",skip:"Skip for now",next:"Next",start:"Next",finish:"Finish"};function H(n,t){return typeof n=="function"?n(t):n}var et=react.forwardRef(function({labels:t,showSkip:c=false,onBack:s,onNext:u,onSkip:x,className:r,"data-testid":i="wizard-navigation"},z){let{currentStepIndex:m,currentStepId:f,totalSteps:p,steps:g,isLoading:o,onStepChange:l}=W(),d={index:m,total:p,id:f},b={back:H(t?.back??D.back,d),skip:H(t?.skip??D.skip,d),next:H(t?.next??D.next,d),start:H(t?.start??t?.next??D.start,d),finish:H(t?.finish??D.finish,d)},w=m===0,S=m===p-1,y=m===p-2,E=!w&&!S,C=!S,A=c&&!w&&!S&&!y,R=w?b.start:y?b.finish:b.next,P=()=>{let h=Math.max(0,m-1);l({index:h,id:g[h]?.id??"",label:g[h]?.label??"",reason:"back"}),s?.();},k=()=>{let h=Math.min(p-1,m+1);l({index:h,id:g[h]?.id??"",label:g[h]?.label??"",reason:"next"}),u?.();},T=()=>{let h=Math.min(p-1,m+1);l({index:h,id:g[h]?.id??"",label:g[h]?.label??"",reason:"skip"}),x?.();};return jsxRuntime.jsxs("div",{ref:z,className:v(Rt(),r),"data-testid":i,children:[jsxRuntime.jsx("div",{className:Pt(),children:E?jsxRuntime.jsxs(I,{variant:"secondary",onPress:P,isDisabled:o,"data-testid":`${i}-back`,children:[jsxRuntime.jsx(lucideReact.ArrowLeft,{className:"mr-1 h-4 w-4 rtl:rotate-180","aria-hidden":"true"}),b.back]}):null}),jsxRuntime.jsxs("div",{className:Tt(),children:[A?jsxRuntime.jsx(I,{variant:"ghost",onPress:T,isDisabled:o,"data-testid":`${i}-skip`,children:b.skip}):null,C?jsxRuntime.jsxs(I,{variant:"default",onPress:k,isDisabled:o,loading:o,"data-testid":`${i}-next`,children:[R,y?null:jsxRuntime.jsx(lucideReact.ArrowRight,{className:"ml-1 h-4 w-4 rtl:rotate-180","aria-hidden":"true"})]}):null]})]})});et.displayName="Wizard.Navigation";var at=react.forwardRef(function({className:t,"data-testid":c="wizard-mobile-progress"},s){let{currentStepIndex:u,steps:x,totalSteps:r}=W(),i=x[u]?.label,z=i?`Step ${u+1} of ${r}: ${i}`:`Step ${u+1} of ${r}`;return jsxRuntime.jsxs("div",{ref:s,className:v(It(),t),role:"progressbar","aria-label":"Wizard progress","aria-valuemin":1,"aria-valuemax":r,"aria-valuenow":u+1,"aria-valuetext":z,"data-testid":c,children:[jsxRuntime.jsx("div",{className:_t(),children:x.map((m,f)=>{let p=f<u?"completed":f===u?"current":"upcoming";return jsxRuntime.jsx("span",{className:At({state:p}),"aria-hidden":"true","data-testid":`${c}-dot-${m.id}`},m.id)})}),i?jsxRuntime.jsxs("p",{className:kt(),"aria-hidden":"true","data-testid":`${c}-caption`,children:["Step ",u+1," of ",r," \xB7 ",jsxRuntime.jsx("span",{className:Mt(),children:i})]}):null]})});at.displayName="Wizard.MobileProgress";var Be=(n,t)=>`Step ${n} of ${t}`,le=react.forwardRef(function({children:t,currentStep:c,steps:s,onStepChange:u,isLoading:x=false,errors:r,announceTemplate:i=Be,stepHeadingLevel:z="h3",className:m,id:f,"aria-label":p,"aria-labelledby":g,"data-testid":o="wizard"},l){let d=Math.min(Math.max(c,0),Math.max(s.length-1,0)),b=s[d],w=b?.id??"",S=b?.label??"",[y,E]=react.useState("");react.useEffect(()=>{s.length!==0&&E(i(d+1,s.length,S));},[d,s.length,S,i]);let[C,A]=react.useState("");react.useEffect(()=>{if(!r||r.length===0){A("");return}A(r.join(". "));},[r]);let R=react.useRef(null),P=react.useRef(true),k=react.useCallback(h=>{R.current=h;},[]);react.useEffect(()=>{if(P.current){P.current=false;return}let h=requestAnimationFrame(()=>{R.current?.focus();});return ()=>cancelAnimationFrame(h)},[d]);let T=react.useMemo(()=>({currentStepIndex:d,currentStepId:w,steps:s,totalSteps:s.length,isLoading:x,errors:r??[],announceTemplate:i,stepHeadingLevel:z,onStepChange:u,registerStepHeading:k}),[d,w,s,x,r,i,z,u,k]);return jsxRuntime.jsx(rt.Provider,{value:T,children:jsxRuntime.jsxs("div",{ref:l,id:f,className:v(nt(),m),"aria-label":p,"aria-labelledby":g,"data-testid":o,"data-wizard-step":d,children:[t,jsxRuntime.jsx("div",{role:"status","aria-live":"polite","aria-atomic":"true",className:U(),"data-testid":`${o}-live-polite`,children:y}),jsxRuntime.jsx("div",{role:"alert","aria-live":"assertive","aria-atomic":"true",className:U(),"data-testid":`${o}-live-assertive`,children:C})]})})});le.displayName="Wizard";var Ge=Object.assign(le,{Layout:F,Stepper:Z,Content:X,Step:Q,Navigation:et,MobileProgress:at});var L=zod.z.object({className:zod.z.string().optional(),children:zod.z.any().optional(),id:zod.z.string().optional(),"aria-label":zod.z.string().optional(),"aria-labelledby":zod.z.string().optional(),"aria-describedby":zod.z.string().optional(),"aria-live":zod.z.enum(["off","polite","assertive"]).optional(),"aria-hidden":zod.z.boolean().optional(),"data-testid":zod.z.string().optional()});var Ue=zod.z.enum(["next","back","skip","jump"]),ce=zod.z.object({id:zod.z.string().min(1),label:zod.z.string().min(1),description:zod.z.string().optional()}),Fe=zod.z.enum(["h2","h3","h4","h5","h6"]),Ye=L.extend({children:zod.z.custom(),currentStep:zod.z.number().int().min(0),steps:zod.z.array(ce).min(1),onStepChange:zod.z.custom(),isLoading:zod.z.boolean().optional().default(false),errors:zod.z.array(zod.z.string()).optional(),announceTemplate:zod.z.custom().optional(),stepHeadingLevel:Fe.optional().default("h3")}),je=L.extend({children:zod.z.custom(),preview:zod.z.custom().optional(),helpText:zod.z.string().optional()}),Ze=L.extend({sectionLabel:zod.z.string().optional(),sectionNumber:zod.z.number().int().min(1).optional(),totalSections:zod.z.number().int().min(1).optional(),allowClickOnCompleted:zod.z.boolean().optional().default(true)}),qe=L.extend({id:zod.z.string().min(1),children:zod.z.custom(),icon:zod.z.custom().optional()}),Xe=L.extend({children:zod.z.custom(),preserveState:zod.z.boolean().optional().default(false)}),Ke=L.extend({labels:zod.z.custom().optional(),showSkip:zod.z.boolean().optional().default(false),onBack:zod.z.custom().optional(),onNext:zod.z.custom().optional(),onSkip:zod.z.custom().optional()}),Qe=L.extend({});exports.Wizard=Ge;exports.WizardChangeReasonSchema=Ue;exports.WizardContent=X;exports.WizardContentPropsSchema=Xe;exports.WizardLayout=F;exports.WizardLayoutPropsSchema=je;exports.WizardMobileProgress=at;exports.WizardMobileProgressPropsSchema=Qe;exports.WizardNavigation=et;exports.WizardNavigationPropsSchema=Ke;exports.WizardPropsSchema=Ye;exports.WizardStep=Q;exports.WizardStepDescriptorSchema=ce;exports.WizardStepPropsSchema=qe;exports.WizardStepper=Z;exports.WizardStepperPropsSchema=Ze;exports.useWizardContext=W;exports.wizardContentCardVariants=$;exports.wizardLayoutContentSlotVariants=lt;exports.wizardLayoutHelpTextVariants=ct;exports.wizardLayoutMainVariants=dt;exports.wizardLayoutPreviewVariants=ut;exports.wizardLayoutStepperSlotVariants=pt;exports.wizardLayoutVariants=st;exports.wizardLiveRegionVariants=U;exports.wizardMobileProgressCaptionTitleVariants=Mt;exports.wizardMobileProgressCaptionVariants=kt;exports.wizardMobileProgressContainerVariants=It;exports.wizardMobileProgressDotRowVariants=_t;exports.wizardMobileProgressDotVariants=At;exports.wizardNavigationLeftVariants=Pt;exports.wizardNavigationRightVariants=Tt;exports.wizardNavigationVariants=Rt;exports.wizardRootVariants=nt;exports.wizardStepContainerVariants=yt;exports.wizardStepDescriptionVariants=Et;exports.wizardStepHeaderRowVariants=Vt;exports.wizardStepHeadingVariants=Lt;exports.wizardStepIconVariants=Ct;exports.wizardStepperCircleVariants=bt;exports.wizardStepperConnectorVariants=St;exports.wizardStepperContainerVariants=mt;exports.wizardStepperCurrentSubtitleVariants=Wt;exports.wizardStepperIndicatorColumnVariants=zt;exports.wizardStepperItemVariants=vt;exports.wizardStepperLabelColumnVariants=ht;exports.wizardStepperLabelTextVariants=Nt;exports.wizardStepperLabelVariants=wt;exports.wizardStepperListVariants=xt;exports.wizardStepperSectionHeadingVariants=gt;exports.wizardStepperSectionLabelVariants=ft;//# sourceMappingURL=index.js.map
|
|
3
3
|
//# sourceMappingURL=index.js.map
|