react-wizard-engine 0.1.3 → 0.1.4

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.
@@ -1,38 +1,15 @@
1
1
  "use client";
2
-
3
- // src/react/components-provider.tsx
4
- import { createContext, useContext } from "react";
5
- import { jsx } from "react/jsx-runtime";
6
- var FallbackButton = (props) => {
7
- const { children, asChild: _asChild, variant: _variant, size: _size, ...rest } = props;
8
- return /* @__PURE__ */ jsx("button", { ...rest, type: props.type ?? "button", children });
9
- };
10
- var FallbackBackArrowIcon = ({ className }) => /* @__PURE__ */ jsx("svg", { className, width: "16", height: "16", viewBox: "0 0 16 16", fill: "currentColor", "aria-hidden": true, children: /* @__PURE__ */ jsx("path", { d: "M10 4 L6 8 L10 12", stroke: "currentColor", strokeWidth: "1.5", fill: "none" }) });
11
- var defaults = { Button: FallbackButton, BackArrowIcon: FallbackBackArrowIcon };
12
- var WizardComponentsContext = createContext(defaults);
13
- function WizardComponentsProvider(props) {
14
- const { Button, BackArrowIcon, children } = props;
15
- const value = {
16
- Button: Button ?? defaults.Button,
17
- BackArrowIcon: BackArrowIcon ?? defaults.BackArrowIcon
18
- };
19
- return /* @__PURE__ */ jsx(WizardComponentsContext.Provider, { value, children });
20
- }
21
- function useWizardComponents() {
22
- return useContext(WizardComponentsContext);
23
- }
24
-
25
- // src/utils/cn.ts
26
- import { clsx } from "clsx";
27
- import { twMerge } from "tailwind-merge";
28
- function cn(...inputs) {
29
- return twMerge(clsx(...inputs));
30
- }
2
+ import {
3
+ WizardComponentsProvider,
4
+ cn,
5
+ useWizard,
6
+ useWizardComponents
7
+ } from "../chunk-5ZSA2PNS.js";
31
8
 
32
9
  // src/shadcn/default-back-arrow-icon.tsx
33
- import { jsx as jsx2 } from "react/jsx-runtime";
10
+ import { jsx } from "react/jsx-runtime";
34
11
  function defaultBackArrowIcon({ className, ...rest }) {
35
- return /* @__PURE__ */ jsx2(
12
+ return /* @__PURE__ */ jsx(
36
13
  "svg",
37
14
  {
38
15
  className: cn(
@@ -47,7 +24,7 @@ function defaultBackArrowIcon({ className, ...rest }) {
47
24
  viewBox: "0 0 16 16",
48
25
  "aria-hidden": true,
49
26
  ...rest,
50
- children: /* @__PURE__ */ jsx2("path", { d: "M10 4 L6 8 L10 12" })
27
+ children: /* @__PURE__ */ jsx("path", { d: "M10 4 L6 8 L10 12" })
51
28
  }
52
29
  );
53
30
  }
@@ -56,7 +33,7 @@ function defaultBackArrowIcon({ className, ...rest }) {
56
33
  import { Slot } from "@radix-ui/react-slot";
57
34
  import { cva } from "class-variance-authority";
58
35
  import { forwardRef } from "react";
59
- import { jsx as jsx3 } from "react/jsx-runtime";
36
+ import { jsx as jsx2 } from "react/jsx-runtime";
60
37
  var buttonVariants = cva(
61
38
  "inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",
62
39
  {
@@ -78,7 +55,7 @@ var buttonVariants = cva(
78
55
  );
79
56
  var defaultButton = forwardRef(function DefaultButton({ asChild, className, size, variant, type, ...rest }, ref) {
80
57
  const Comp = asChild ? Slot : "button";
81
- return /* @__PURE__ */ jsx3(
58
+ return /* @__PURE__ */ jsx2(
82
59
  Comp,
83
60
  {
84
61
  ref,
@@ -90,9 +67,9 @@ var defaultButton = forwardRef(function DefaultButton({ asChild, className, size
90
67
  });
91
68
 
92
69
  // src/shadcn/components-provider-with-defaults.tsx
93
- import { jsx as jsx4 } from "react/jsx-runtime";
70
+ import { jsx as jsx3 } from "react/jsx-runtime";
94
71
  function WizardComponentsProviderWithDefaults({ children }) {
95
- return /* @__PURE__ */ jsx4(WizardComponentsProvider, { Button: defaultButton, BackArrowIcon: defaultBackArrowIcon, children });
72
+ return /* @__PURE__ */ jsx3(WizardComponentsProvider, { Button: defaultButton, BackArrowIcon: defaultBackArrowIcon, children });
96
73
  }
97
74
 
98
75
  // src/shadcn/wizard-layout.tsx
@@ -100,17 +77,17 @@ import * as Dialog from "@radix-ui/react-dialog";
100
77
  import { useState } from "react";
101
78
 
102
79
  // src/shadcn/wizard-layout.context.ts
103
- import { createContext as createContext2 } from "react";
104
- var WizardLayoutContext = createContext2(null);
80
+ import { createContext } from "react";
81
+ var WizardLayoutContext = createContext(null);
105
82
 
106
83
  // src/shadcn/wizard-layout.tsx
107
- import { jsx as jsx5, jsxs } from "react/jsx-runtime";
84
+ import { jsx as jsx4, jsxs } from "react/jsx-runtime";
108
85
  function WizardLayout(props) {
109
86
  const { children, className, defaultRailTitle = "Wizard steps", rail, railTitle, ref, topBar } = props;
110
87
  const [mobileSheetOpen, setMobileSheetOpen] = useState(false);
111
88
  const closeMobileSheet = () => setMobileSheetOpen(false);
112
89
  return /* @__PURE__ */ jsxs(WizardLayoutContext.Provider, { value: { mobileSheetOpen, setMobileSheetOpen }, children: [
113
- /* @__PURE__ */ jsx5("div", { className: cn("flex h-full min-h-0 w-full flex-1 bg-sidebar", className), "data-slot": "wizard-layout-outer", children: /* @__PURE__ */ jsxs(
90
+ /* @__PURE__ */ jsx4("div", { className: cn("flex h-full min-h-0 w-full flex-1 bg-sidebar", className), "data-slot": "wizard-layout-outer", children: /* @__PURE__ */ jsxs(
114
91
  "div",
115
92
  {
116
93
  className: "flex flex-1 overflow-hidden bg-background text-foreground shadow-sm ring-1 ring-foreground/10 md:rounded-xl",
@@ -122,14 +99,14 @@ function WizardLayout(props) {
122
99
  className: "hidden w-[280px] shrink-0 flex-col gap-4 border-r border-border px-4 py-6 md:flex",
123
100
  "data-slot": "wizard-layout-rail",
124
101
  children: [
125
- railTitle && /* @__PURE__ */ jsx5("div", { className: "px-3 text-base font-semibold text-foreground", children: railTitle }),
102
+ railTitle && /* @__PURE__ */ jsx4("div", { className: "px-3 text-base font-semibold text-foreground", children: railTitle }),
126
103
  rail
127
104
  ]
128
105
  }
129
106
  ),
130
107
  /* @__PURE__ */ jsxs("div", { className: "flex min-w-0 flex-1 flex-col", children: [
131
108
  topBar,
132
- /* @__PURE__ */ jsx5(
109
+ /* @__PURE__ */ jsx4(
133
110
  "div",
134
111
  {
135
112
  className: "min-h-0 flex-1 overflow-y-auto px-4 py-6 sm:px-8",
@@ -142,16 +119,16 @@ function WizardLayout(props) {
142
119
  ]
143
120
  }
144
121
  ) }),
145
- /* @__PURE__ */ jsx5(Dialog.Root, { onOpenChange: setMobileSheetOpen, open: mobileSheetOpen, children: /* @__PURE__ */ jsxs(Dialog.Portal, { children: [
146
- /* @__PURE__ */ jsx5(Dialog.Overlay, { className: "fixed inset-0 z-50 bg-black/50 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0" }),
122
+ /* @__PURE__ */ jsx4(Dialog.Root, { onOpenChange: setMobileSheetOpen, open: mobileSheetOpen, children: /* @__PURE__ */ jsxs(Dialog.Portal, { children: [
123
+ /* @__PURE__ */ jsx4(Dialog.Overlay, { className: "fixed inset-0 z-50 bg-black/50 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0" }),
147
124
  /* @__PURE__ */ jsxs(
148
125
  Dialog.Content,
149
126
  {
150
127
  "aria-describedby": void 0,
151
128
  className: "fixed inset-y-0 left-0 z-50 flex w-3/4 max-w-sm flex-col gap-4 border-r border-border bg-background px-4 py-6 shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left",
152
129
  children: [
153
- /* @__PURE__ */ jsx5(Dialog.Title, { className: "px-3 text-base font-semibold", children: railTitle ?? defaultRailTitle }),
154
- /* @__PURE__ */ jsx5("div", { onClickCapture: closeMobileSheet, children: rail })
130
+ /* @__PURE__ */ jsx4(Dialog.Title, { className: "px-3 text-base font-semibold", children: railTitle ?? defaultRailTitle }),
131
+ /* @__PURE__ */ jsx4("div", { onClickCapture: closeMobileSheet, children: rail })
155
132
  ]
156
133
  }
157
134
  )
@@ -161,40 +138,12 @@ function WizardLayout(props) {
161
138
 
162
139
  // src/shadcn/wizard-top-bar.tsx
163
140
  import { MenuIcon, XIcon } from "lucide-react";
164
- import { useContext as useContext3 } from "react";
165
-
166
- // src/react/use-wizard.ts
167
- import { useContext as useContext2, useSyncExternalStore } from "react";
168
-
169
- // src/core/errors/wizard.error.ts
170
- var WizardError = class extends Error {
171
- name = "WizardError";
172
- constructor(message) {
173
- super(message);
174
- Object.setPrototypeOf(this, new.target.prototype);
175
- }
176
- };
177
-
178
- // src/react/context.ts
179
- import { createContext as createContext3 } from "react";
180
- var WizardEngineContext = createContext3(null);
181
-
182
- // src/react/use-wizard.ts
183
- function useWizard() {
184
- const engine = useContext2(WizardEngineContext);
185
- if (!engine) {
186
- throw new WizardError("useWizard must be used inside <WizardProvider>");
187
- }
188
- useSyncExternalStore(engine.subscribe, engine.getTreeSnapshot, engine.getTreeSnapshot);
189
- return engine;
190
- }
191
-
192
- // src/shadcn/wizard-top-bar.tsx
193
- import { jsx as jsx6, jsxs as jsxs2 } from "react/jsx-runtime";
141
+ import { useContext } from "react";
142
+ import { jsx as jsx5, jsxs as jsxs2 } from "react/jsx-runtime";
194
143
  function WizardTopBar(props) {
195
144
  const { backLabel, className, closeLabel, disabled, extraActions, finishLabel, menuLabel, nextLabel, onClose } = props;
196
145
  const wizard = useWizard();
197
- const layout = useContext3(WizardLayoutContext);
146
+ const layout = useContext(WizardLayoutContext);
198
147
  const { Button, BackArrowIcon } = useWizardComponents();
199
148
  const config = wizard.configOptions;
200
149
  const tree = wizard.tree;
@@ -211,7 +160,7 @@ function WizardTopBar(props) {
211
160
  className: cn("flex h-14 items-center gap-3 border-b border-border bg-background px-4 sm:px-6", className),
212
161
  "data-slot": "wizard-top-bar",
213
162
  children: [
214
- layout && /* @__PURE__ */ jsx6(
163
+ layout && /* @__PURE__ */ jsx5(
215
164
  Button,
216
165
  {
217
166
  "aria-label": resolvedMenuLabel,
@@ -220,7 +169,7 @@ function WizardTopBar(props) {
220
169
  size: "icon-sm",
221
170
  type: "button",
222
171
  variant: "ghost",
223
- children: /* @__PURE__ */ jsx6(MenuIcon, {})
172
+ children: /* @__PURE__ */ jsx5(MenuIcon, {})
224
173
  }
225
174
  ),
226
175
  !isFirstStep && /* @__PURE__ */ jsxs2(
@@ -233,14 +182,14 @@ function WizardTopBar(props) {
233
182
  },
234
183
  type: "button",
235
184
  children: [
236
- /* @__PURE__ */ jsx6(BackArrowIcon, {}),
237
- /* @__PURE__ */ jsx6("span", { children: resolvedBackLabel })
185
+ /* @__PURE__ */ jsx5(BackArrowIcon, {}),
186
+ /* @__PURE__ */ jsx5("span", { children: resolvedBackLabel })
238
187
  ]
239
188
  }
240
189
  ),
241
190
  /* @__PURE__ */ jsxs2("div", { className: "flex flex-1 items-center justify-end gap-2", children: [
242
191
  extraActions,
243
- isLastStep ? /* @__PURE__ */ jsx6(Button, { disabled, type: "submit", variant: "default", children: resolvedFinishLabel }, "wizard-finish") : /* @__PURE__ */ jsx6(
192
+ isLastStep ? /* @__PURE__ */ jsx5(Button, { disabled, type: "submit", variant: "default", children: resolvedFinishLabel }, "wizard-finish") : /* @__PURE__ */ jsx5(
244
193
  Button,
245
194
  {
246
195
  disabled,
@@ -253,7 +202,7 @@ function WizardTopBar(props) {
253
202
  },
254
203
  "wizard-next"
255
204
  ),
256
- /* @__PURE__ */ jsx6(Button, { "aria-label": resolvedCloseLabel, onClick: onClose, size: "icon-sm", type: "button", variant: "ghost", children: /* @__PURE__ */ jsx6(XIcon, {}) })
205
+ /* @__PURE__ */ jsx5(Button, { "aria-label": resolvedCloseLabel, onClick: onClose, size: "icon-sm", type: "button", variant: "ghost", children: /* @__PURE__ */ jsx5(XIcon, {}) })
257
206
  ] })
258
207
  ]
259
208
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/react/components-provider.tsx","../../src/utils/cn.ts","../../src/shadcn/default-back-arrow-icon.tsx","../../src/shadcn/default-button.tsx","../../src/shadcn/components-provider-with-defaults.tsx","../../src/shadcn/wizard-layout.tsx","../../src/shadcn/wizard-layout.context.ts","../../src/shadcn/wizard-top-bar.tsx","../../src/react/use-wizard.ts","../../src/core/errors/wizard.error.ts","../../src/react/context.ts"],"sourcesContent":["'use client';\n\nimport { type ComponentType, createContext, type ReactNode, useContext } from 'react';\n\nexport interface IWizardButtonProps {\n\tasChild?: boolean;\n\tchildren?: ReactNode;\n\tclassName?: string;\n\tdisabled?: boolean;\n\tonClick?: () => void;\n\ttype?: 'button' | 'submit';\n\tvariant?: 'default' | 'ghost';\n\tsize?: 'default' | 'icon-sm';\n\t'aria-label'?: string;\n}\n\nexport interface IWizardBackArrowIconProps {\n\tclassName?: string;\n}\n\nexport interface IWizardComponents {\n\tButton: ComponentType<IWizardButtonProps>;\n\tBackArrowIcon: ComponentType<IWizardBackArrowIconProps>;\n}\n\nconst FallbackButton: ComponentType<IWizardButtonProps> = (props) => {\n\tconst { children, asChild: _asChild, variant: _variant, size: _size, ...rest } = props;\n\treturn (\n\t\t<button {...rest} type={props.type ?? 'button'}>\n\t\t\t{children}\n\t\t</button>\n\t);\n};\n\nconst FallbackBackArrowIcon: ComponentType<IWizardBackArrowIconProps> = ({ className }) => (\n\t<svg className={className} width=\"16\" height=\"16\" viewBox=\"0 0 16 16\" fill=\"currentColor\" aria-hidden>\n\t\t<path d=\"M10 4 L6 8 L10 12\" stroke=\"currentColor\" strokeWidth=\"1.5\" fill=\"none\" />\n\t</svg>\n);\n\nconst defaults: IWizardComponents = { Button: FallbackButton, BackArrowIcon: FallbackBackArrowIcon };\n\nconst WizardComponentsContext = createContext<IWizardComponents>(defaults);\n\nexport function WizardComponentsProvider(props: {\n\tButton?: ComponentType<IWizardButtonProps>;\n\tBackArrowIcon?: ComponentType<IWizardBackArrowIconProps>;\n\tchildren: ReactNode;\n}) {\n\tconst { Button, BackArrowIcon, children } = props;\n\tconst value: IWizardComponents = {\n\t\tButton: Button ?? defaults.Button,\n\t\tBackArrowIcon: BackArrowIcon ?? defaults.BackArrowIcon,\n\t};\n\treturn <WizardComponentsContext.Provider value={value}>{children}</WizardComponentsContext.Provider>;\n}\n\nexport function useWizardComponents(): IWizardComponents {\n\treturn useContext(WizardComponentsContext);\n}\n","import { clsx, type ClassValue } from 'clsx';\nimport { twMerge } from 'tailwind-merge';\n\nexport function cn(...inputs: ClassValue[]): string {\n return twMerge(clsx(...inputs));\n}\n","'use client';\n\nimport { type ComponentProps } from 'react';\n\nimport { cn } from '~/utils/cn';\n\n/** Animated back-arrow icon. The arrow translates -2px on the parent's group-hover. */\nexport function defaultBackArrowIcon({ className, ...rest }: ComponentProps<'svg'>) {\n\treturn (\n\t\t<svg\n\t\t\tclassName={cn(\n\t\t\t\t'h-4 w-4 transition-transform duration-150 group-hover:-translate-x-0.5',\n\t\t\t\tclassName\n\t\t\t)}\n\t\t\tfill=\"none\"\n\t\t\tstroke=\"currentColor\"\n\t\t\tstrokeWidth={1.75}\n\t\t\tstrokeLinecap=\"round\"\n\t\t\tstrokeLinejoin=\"round\"\n\t\t\tviewBox=\"0 0 16 16\"\n\t\t\taria-hidden\n\t\t\t{...rest}\n\t\t>\n\t\t\t<path d=\"M10 4 L6 8 L10 12\" />\n\t\t</svg>\n\t);\n}\n","'use client';\n\nimport { Slot } from '@radix-ui/react-slot';\nimport { cva, type VariantProps } from 'class-variance-authority';\nimport { forwardRef, type ReactNode } from 'react';\n\nimport { cn } from '~/utils/cn';\nimport { type IWizardButtonProps } from '../react/components-provider';\n\nconst buttonVariants = cva(\n\t'inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50',\n\t{\n\t\tvariants: {\n\t\t\tvariant: {\n\t\t\t\tdefault: 'bg-primary text-primary-foreground hover:bg-primary/90',\n\t\t\t\tghost: 'hover:bg-accent hover:text-accent-foreground',\n\t\t\t},\n\t\t\tsize: {\n\t\t\t\tdefault: 'h-9 px-4 py-2',\n\t\t\t\t'icon-sm': 'h-8 w-8',\n\t\t\t},\n\t\t},\n\t\tdefaultVariants: {\n\t\t\tvariant: 'default',\n\t\t\tsize: 'default',\n\t\t},\n\t}\n);\n\ntype InternalProps = Omit<IWizardButtonProps, 'size' | 'variant'> &\n\tVariantProps<typeof buttonVariants> & {\n\t\tchildren?: ReactNode;\n\t};\n\nexport const defaultButton = forwardRef<HTMLButtonElement, InternalProps>(function DefaultButton(\n\t{ asChild, className, size, variant, type, ...rest },\n\tref\n) {\n\tconst Comp: any = asChild ? Slot : 'button';\n\treturn (\n\t\t<Comp\n\t\t\tref={ref}\n\t\t\ttype={asChild ? undefined : (type ?? 'button')}\n\t\t\tclassName={cn(buttonVariants({ size, variant }), className)}\n\t\t\t{...rest}\n\t\t/>\n\t);\n});\n","'use client';\n\nimport { type ReactNode } from 'react';\n\nimport { WizardComponentsProvider } from '../react/components-provider';\nimport { defaultBackArrowIcon } from './default-back-arrow-icon';\nimport { defaultButton } from './default-button';\n\n/**\n * Convenience wrapper around `WizardComponentsProvider` that wires in the\n * package-shipped `defaultButton` and `defaultBackArrowIcon`. Use this if\n * you want the styled adapter out of the box; use `WizardComponentsProvider`\n * directly if you want to pass your own.\n */\nexport function WizardComponentsProviderWithDefaults({ children }: { children: ReactNode }) {\n\treturn (\n\t\t<WizardComponentsProvider Button={defaultButton} BackArrowIcon={defaultBackArrowIcon}>\n\t\t\t{children}\n\t\t</WizardComponentsProvider>\n\t);\n}\n","'use client';\n\nimport * as Dialog from '@radix-ui/react-dialog';\nimport { type ReactNode, type Ref, useState } from 'react';\n\nimport { cn } from '~/utils/cn';\nimport { WizardLayoutContext } from './wizard-layout.context';\n\ninterface IWizardLayoutProps {\n\tchildren: ReactNode;\n\tclassName?: string;\n\tdefaultRailTitle?: string;\n\trail: ReactNode;\n\trailTitle?: ReactNode;\n\tref?: Ref<HTMLDivElement>;\n\ttopBar: ReactNode;\n}\n\n/**\n * Full-page wizard shell. Renders a top bar across the right column on\n * desktop, a vertical rail on the left, and a scrollable content area for\n * the active step. Below the `md` breakpoint the rail collapses into a\n * left-side dialog whose open state is exposed via `WizardLayoutContext`\n * so the top bar's hamburger button can drive it.\n */\nexport function WizardLayout(props: IWizardLayoutProps) {\n\tconst { children, className, defaultRailTitle = 'Wizard steps', rail, railTitle, ref, topBar } = props;\n\tconst [mobileSheetOpen, setMobileSheetOpen] = useState(false);\n\n\tconst closeMobileSheet = () => setMobileSheetOpen(false);\n\n\treturn (\n\t\t<WizardLayoutContext.Provider value={{ mobileSheetOpen, setMobileSheetOpen }}>\n\t\t\t<div className={cn('flex h-full min-h-0 w-full flex-1 bg-sidebar', className)} data-slot=\"wizard-layout-outer\">\n\t\t\t\t<div\n\t\t\t\t\tclassName=\"flex flex-1 overflow-hidden bg-background text-foreground shadow-sm ring-1 ring-foreground/10 md:rounded-xl\"\n\t\t\t\t\tdata-slot=\"wizard-layout\"\n\t\t\t\t>\n\t\t\t\t\t<aside\n\t\t\t\t\t\tclassName=\"hidden w-[280px] shrink-0 flex-col gap-4 border-r border-border px-4 py-6 md:flex\"\n\t\t\t\t\t\tdata-slot=\"wizard-layout-rail\"\n\t\t\t\t\t>\n\t\t\t\t\t\t{railTitle && <div className=\"px-3 text-base font-semibold text-foreground\">{railTitle}</div>}\n\t\t\t\t\t\t{rail}\n\t\t\t\t\t</aside>\n\n\t\t\t\t\t<div className=\"flex min-w-0 flex-1 flex-col\">\n\t\t\t\t\t\t{topBar}\n\t\t\t\t\t\t<div\n\t\t\t\t\t\t\tclassName=\"min-h-0 flex-1 overflow-y-auto px-4 py-6 sm:px-8\"\n\t\t\t\t\t\t\tdata-slot=\"wizard-layout-scroll\"\n\t\t\t\t\t\t\tref={ref}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{children}\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t</div>\n\n\t\t\t<Dialog.Root onOpenChange={setMobileSheetOpen} open={mobileSheetOpen}>\n\t\t\t\t<Dialog.Portal>\n\t\t\t\t\t<Dialog.Overlay className=\"fixed inset-0 z-50 bg-black/50 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0\" />\n\t\t\t\t\t<Dialog.Content\n\t\t\t\t\t\taria-describedby={undefined}\n\t\t\t\t\t\tclassName=\"fixed inset-y-0 left-0 z-50 flex w-3/4 max-w-sm flex-col gap-4 border-r border-border bg-background px-4 py-6 shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left\"\n\t\t\t\t\t>\n\t\t\t\t\t\t<Dialog.Title className=\"px-3 text-base font-semibold\">{railTitle ?? defaultRailTitle}</Dialog.Title>\n\t\t\t\t\t\t<div onClickCapture={closeMobileSheet}>{rail}</div>\n\t\t\t\t\t</Dialog.Content>\n\t\t\t\t</Dialog.Portal>\n\t\t\t</Dialog.Root>\n\t\t</WizardLayoutContext.Provider>\n\t);\n}\n","'use client';\n\nimport { createContext } from 'react';\n\nexport interface IWizardLayoutContextValue {\n\tmobileSheetOpen: boolean;\n\tsetMobileSheetOpen: (open: boolean) => void;\n}\n\n/**\n * Communicates the rail's mobile-Sheet open state from `WizardLayout` to\n * `WizardTopBar`. Null outside a layout — consumers (top bar's hamburger\n * button) silently no-op when context is missing, so the top bar stays usable\n * outside `WizardLayout`.\n */\nexport const WizardLayoutContext = createContext<IWizardLayoutContextValue | null>(null);\n","'use client';\n\nimport { MenuIcon, XIcon } from 'lucide-react';\nimport { type ReactNode, useContext } from 'react';\n\nimport { useWizardComponents } from '../react/components-provider';\nimport { useWizard } from '../react/use-wizard';\nimport { cn } from '~/utils/cn';\nimport { WizardLayoutContext } from './wizard-layout.context';\n\ninterface IWizardTopBarProps {\n\tbackLabel?: ReactNode;\n\tclassName?: string;\n\tcloseLabel?: string;\n\tdisabled?: boolean;\n\textraActions?: ReactNode;\n\tfinishLabel?: ReactNode;\n\tmenuLabel?: string;\n\tnextLabel?: ReactNode;\n\tonClose: () => void;\n}\n\n/**\n * Header bar for full-page wizard layouts. Renders Back / primary action /\n * extras / close X. Reads `useWizard` for first/last-step detection. The\n * primary action is `type=\"submit\"` on the last step (lets the parent form\n * own submission) and dispatches `wizard.next()` otherwise. Hamburger only\n * surfaces when wrapped by a `WizardLayout`.\n */\nexport function WizardTopBar(props: IWizardTopBarProps) {\n\tconst { backLabel, className, closeLabel, disabled, extraActions, finishLabel, menuLabel, nextLabel, onClose } =\n\t\tprops;\n\tconst wizard = useWizard();\n\tconst layout = useContext(WizardLayoutContext);\n\tconst { Button, BackArrowIcon } = useWizardComponents();\n\n\tconst config = wizard.configOptions;\n\tconst tree = wizard.tree;\n\tconst isFirstStep = tree.activeBranch.prevCategory == null && tree.activeCategory.prevStep == null;\n\tconst isLastStep = tree.activeBranch.nextCategory == null && tree.activeCategory.nextStep == null;\n\n\tconst resolvedBackLabel = backLabel ?? config.backBtnText;\n\tconst resolvedFinishLabel = finishLabel ?? config.finishText;\n\tconst resolvedNextLabel = nextLabel ?? config.nextBtnText;\n\tconst resolvedMenuLabel = menuLabel ?? 'Open wizard steps';\n\tconst resolvedCloseLabel = closeLabel ?? 'Close';\n\n\treturn (\n\t\t<div\n\t\t\tclassName={cn('flex h-14 items-center gap-3 border-b border-border bg-background px-4 sm:px-6', className)}\n\t\t\tdata-slot=\"wizard-top-bar\"\n\t\t>\n\t\t\t{layout && (\n\t\t\t\t<Button\n\t\t\t\t\taria-label={resolvedMenuLabel}\n\t\t\t\t\tclassName=\"md:hidden\"\n\t\t\t\t\tonClick={() => layout.setMobileSheetOpen(true)}\n\t\t\t\t\tsize=\"icon-sm\"\n\t\t\t\t\ttype=\"button\"\n\t\t\t\t\tvariant=\"ghost\"\n\t\t\t\t>\n\t\t\t\t\t<MenuIcon />\n\t\t\t\t</Button>\n\t\t\t)}\n\n\t\t\t{!isFirstStep && (\n\t\t\t\t<button\n\t\t\t\t\taria-label={typeof resolvedBackLabel === 'string' ? resolvedBackLabel : undefined}\n\t\t\t\t\tclassName=\"group inline-flex items-center gap-1 rounded-md py-1 pr-2.5 pl-3.5 text-sm font-normal text-muted-foreground transition-colors duration-150 hover:bg-muted hover:text-foreground\"\n\t\t\t\t\tonClick={() => {\n\t\t\t\t\t\tvoid wizard.back();\n\t\t\t\t\t}}\n\t\t\t\t\ttype=\"button\"\n\t\t\t\t>\n\t\t\t\t\t<BackArrowIcon />\n\t\t\t\t\t<span>{resolvedBackLabel}</span>\n\t\t\t\t</button>\n\t\t\t)}\n\n\t\t\t<div className=\"flex flex-1 items-center justify-end gap-2\">\n\t\t\t\t{extraActions}\n\t\t\t\t{isLastStep ? (\n\t\t\t\t\t<Button disabled={disabled} key=\"wizard-finish\" type=\"submit\" variant=\"default\">\n\t\t\t\t\t\t{resolvedFinishLabel}\n\t\t\t\t\t</Button>\n\t\t\t\t) : (\n\t\t\t\t\t<Button\n\t\t\t\t\t\tdisabled={disabled}\n\t\t\t\t\t\tkey=\"wizard-next\"\n\t\t\t\t\t\tonClick={() => {\n\t\t\t\t\t\t\tvoid wizard.next();\n\t\t\t\t\t\t}}\n\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\tvariant=\"default\"\n\t\t\t\t\t>\n\t\t\t\t\t\t{resolvedNextLabel}\n\t\t\t\t\t</Button>\n\t\t\t\t)}\n\t\t\t\t<Button aria-label={resolvedCloseLabel} onClick={onClose} size=\"icon-sm\" type=\"button\" variant=\"ghost\">\n\t\t\t\t\t<XIcon />\n\t\t\t\t</Button>\n\t\t\t</div>\n\t\t</div>\n\t);\n}\n","'use client';\n\nimport { useContext, useSyncExternalStore } from 'react';\n\nimport type { WizardEngine } from '../core/wizard-engine';\n\nimport { WizardError } from '../core/errors';\nimport { WizardEngineContext } from './context';\n\n/**\n * Returns the active `WizardEngine` instance and re-renders the consumer on\n * every tree change. Throws if used outside a `<WizardProvider>`.\n *\n * Engine identity is stable across renders.\n */\nexport function useWizard<Step extends string, Category extends string, Branch extends string = string>(): WizardEngine<\n\tStep,\n\tCategory,\n\tBranch\n> {\n\tconst engine = useContext(WizardEngineContext) as null | WizardEngine<Step, Category, Branch>;\n\tif (!engine) {\n\t\tthrow new WizardError('useWizard must be used inside <WizardProvider>');\n\t}\n\tuseSyncExternalStore(engine.subscribe, engine.getTreeSnapshot, engine.getTreeSnapshot);\n\treturn engine;\n}\n","export class WizardError extends Error {\n\tpublic override readonly name: string = 'WizardError';\n\n\tconstructor(message?: string) {\n\t\tsuper(message);\n\t\tObject.setPrototypeOf(this, new.target.prototype);\n\t}\n}\n\nexport class WizardInitializationError extends WizardError {\n\tpublic override readonly name: string = 'WizardInitializationError';\n}\n\nexport class WizardNavigationError extends WizardError {\n\tpublic override readonly name: string = 'WizardNavigationError';\n}\n\nexport class WizardResolverError extends WizardError {\n\tpublic override readonly name: string = 'WizardResolverError';\n}\n","'use client';\n\nimport { createContext } from 'react';\n\nimport type { WizardEngine } from '../core/wizard-engine';\n\n/**\n * React context exposing the active `WizardEngine` instance to descendants.\n * `null` outside a `<WizardProvider>` — `useWizard()` throws a clear error.\n */\nexport const WizardEngineContext = createContext<null | WizardEngine<string, string, string>>(null);\n"],"mappings":";;;AAEA,SAA6B,eAA+B,kBAAkB;AA0B5E;AAHF,IAAM,iBAAoD,CAAC,UAAU;AACpE,QAAM,EAAE,UAAU,SAAS,UAAU,SAAS,UAAU,MAAM,OAAO,GAAG,KAAK,IAAI;AACjF,SACC,oBAAC,YAAQ,GAAG,MAAM,MAAM,MAAM,QAAQ,UACpC,UACF;AAEF;AAEA,IAAM,wBAAkE,CAAC,EAAE,UAAU,MACpF,oBAAC,SAAI,WAAsB,OAAM,MAAK,QAAO,MAAK,SAAQ,aAAY,MAAK,gBAAe,eAAW,MACpG,8BAAC,UAAK,GAAE,qBAAoB,QAAO,gBAAe,aAAY,OAAM,MAAK,QAAO,GACjF;AAGD,IAAM,WAA8B,EAAE,QAAQ,gBAAgB,eAAe,sBAAsB;AAEnG,I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G;AAAA,UAQL;AAAA,UAED,gBAAAA,KAAC,UAAO,cAAY,oBAAoB,SAAS,SAAS,MAAK,WAAU,MAAK,UAAS,SAAQ,SAC9F,0BAAAA,KAAC,SAAM,GACR;AAAA,WACD;AAAA;AAAA;AAAA,EACD;AAEF;","names":["jsx","jsx","jsx","createContext","jsx","useContext","useContext","createContext","useContext","jsx","jsxs","useContext"]}
1
+ {"version":3,"sources":["../../src/shadcn/default-back-arrow-icon.tsx","../../src/shadcn/default-button.tsx","../../src/shadcn/components-provider-with-defaults.tsx","../../src/shadcn/wizard-layout.tsx","../../src/shadcn/wizard-layout.context.ts","../../src/shadcn/wizard-top-bar.tsx"],"sourcesContent":["'use client';\n\nimport { type ComponentProps } from 'react';\n\nimport { cn } from '~/utils/cn';\n\n/** Animated back-arrow icon. The arrow translates -2px on the parent's group-hover. */\nexport function defaultBackArrowIcon({ className, ...rest }: ComponentProps<'svg'>) {\n\treturn (\n\t\t<svg\n\t\t\tclassName={cn(\n\t\t\t\t'h-4 w-4 transition-transform duration-150 group-hover:-translate-x-0.5',\n\t\t\t\tclassName\n\t\t\t)}\n\t\t\tfill=\"none\"\n\t\t\tstroke=\"currentColor\"\n\t\t\tstrokeWidth={1.75}\n\t\t\tstrokeLinecap=\"round\"\n\t\t\tstrokeLinejoin=\"round\"\n\t\t\tviewBox=\"0 0 16 16\"\n\t\t\taria-hidden\n\t\t\t{...rest}\n\t\t>\n\t\t\t<path d=\"M10 4 L6 8 L10 12\" />\n\t\t</svg>\n\t);\n}\n","'use client';\n\nimport { Slot } from '@radix-ui/react-slot';\nimport { cva, type VariantProps } from 'class-variance-authority';\nimport { forwardRef, type ReactNode } from 'react';\n\nimport { cn } from '~/utils/cn';\nimport { type IWizardButtonProps } from '../react/components-provider';\n\nconst buttonVariants = cva(\n\t'inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50',\n\t{\n\t\tvariants: {\n\t\t\tvariant: {\n\t\t\t\tdefault: 'bg-primary text-primary-foreground hover:bg-primary/90',\n\t\t\t\tghost: 'hover:bg-accent hover:text-accent-foreground',\n\t\t\t},\n\t\t\tsize: {\n\t\t\t\tdefault: 'h-9 px-4 py-2',\n\t\t\t\t'icon-sm': 'h-8 w-8',\n\t\t\t},\n\t\t},\n\t\tdefaultVariants: {\n\t\t\tvariant: 'default',\n\t\t\tsize: 'default',\n\t\t},\n\t}\n);\n\ntype InternalProps = Omit<IWizardButtonProps, 'size' | 'variant'> &\n\tVariantProps<typeof buttonVariants> & {\n\t\tchildren?: ReactNode;\n\t};\n\nexport const defaultButton = forwardRef<HTMLButtonElement, InternalProps>(function DefaultButton(\n\t{ asChild, className, size, variant, type, ...rest },\n\tref\n) {\n\tconst Comp: any = asChild ? Slot : 'button';\n\treturn (\n\t\t<Comp\n\t\t\tref={ref}\n\t\t\ttype={asChild ? undefined : (type ?? 'button')}\n\t\t\tclassName={cn(buttonVariants({ size, variant }), className)}\n\t\t\t{...rest}\n\t\t/>\n\t);\n});\n","'use client';\n\nimport { type ReactNode } from 'react';\n\nimport { WizardComponentsProvider } from '../react/components-provider';\nimport { defaultBackArrowIcon } from './default-back-arrow-icon';\nimport { defaultButton } from './default-button';\n\n/**\n * Convenience wrapper around `WizardComponentsProvider` that wires in the\n * package-shipped `defaultButton` and `defaultBackArrowIcon`. Use this if\n * you want the styled adapter out of the box; use `WizardComponentsProvider`\n * directly if you want to pass your own.\n */\nexport function WizardComponentsProviderWithDefaults({ children }: { children: ReactNode }) {\n\treturn (\n\t\t<WizardComponentsProvider Button={defaultButton} BackArrowIcon={defaultBackArrowIcon}>\n\t\t\t{children}\n\t\t</WizardComponentsProvider>\n\t);\n}\n","'use client';\n\nimport * as Dialog from '@radix-ui/react-dialog';\nimport { type ReactNode, type Ref, useState } from 'react';\n\nimport { cn } from '~/utils/cn';\nimport { WizardLayoutContext } from './wizard-layout.context';\n\ninterface IWizardLayoutProps {\n\tchildren: ReactNode;\n\tclassName?: string;\n\tdefaultRailTitle?: string;\n\trail: ReactNode;\n\trailTitle?: ReactNode;\n\tref?: Ref<HTMLDivElement>;\n\ttopBar: ReactNode;\n}\n\n/**\n * Full-page wizard shell. Renders a top bar across the right column on\n * desktop, a vertical rail on the left, and a scrollable content area for\n * the active step. Below the `md` breakpoint the rail collapses into a\n * left-side dialog whose open state is exposed via `WizardLayoutContext`\n * so the top bar's hamburger button can drive it.\n */\nexport function WizardLayout(props: IWizardLayoutProps) {\n\tconst { children, className, defaultRailTitle = 'Wizard steps', rail, railTitle, ref, topBar } = props;\n\tconst [mobileSheetOpen, setMobileSheetOpen] = useState(false);\n\n\tconst closeMobileSheet = () => setMobileSheetOpen(false);\n\n\treturn (\n\t\t<WizardLayoutContext.Provider value={{ mobileSheetOpen, setMobileSheetOpen }}>\n\t\t\t<div className={cn('flex h-full min-h-0 w-full flex-1 bg-sidebar', className)} data-slot=\"wizard-layout-outer\">\n\t\t\t\t<div\n\t\t\t\t\tclassName=\"flex flex-1 overflow-hidden bg-background text-foreground shadow-sm ring-1 ring-foreground/10 md:rounded-xl\"\n\t\t\t\t\tdata-slot=\"wizard-layout\"\n\t\t\t\t>\n\t\t\t\t\t<aside\n\t\t\t\t\t\tclassName=\"hidden w-[280px] shrink-0 flex-col gap-4 border-r border-border px-4 py-6 md:flex\"\n\t\t\t\t\t\tdata-slot=\"wizard-layout-rail\"\n\t\t\t\t\t>\n\t\t\t\t\t\t{railTitle && <div className=\"px-3 text-base font-semibold text-foreground\">{railTitle}</div>}\n\t\t\t\t\t\t{rail}\n\t\t\t\t\t</aside>\n\n\t\t\t\t\t<div className=\"flex min-w-0 flex-1 flex-col\">\n\t\t\t\t\t\t{topBar}\n\t\t\t\t\t\t<div\n\t\t\t\t\t\t\tclassName=\"min-h-0 flex-1 overflow-y-auto px-4 py-6 sm:px-8\"\n\t\t\t\t\t\t\tdata-slot=\"wizard-layout-scroll\"\n\t\t\t\t\t\t\tref={ref}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{children}\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t</div>\n\n\t\t\t<Dialog.Root onOpenChange={setMobileSheetOpen} open={mobileSheetOpen}>\n\t\t\t\t<Dialog.Portal>\n\t\t\t\t\t<Dialog.Overlay className=\"fixed inset-0 z-50 bg-black/50 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0\" />\n\t\t\t\t\t<Dialog.Content\n\t\t\t\t\t\taria-describedby={undefined}\n\t\t\t\t\t\tclassName=\"fixed inset-y-0 left-0 z-50 flex w-3/4 max-w-sm flex-col gap-4 border-r border-border bg-background px-4 py-6 shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left\"\n\t\t\t\t\t>\n\t\t\t\t\t\t<Dialog.Title className=\"px-3 text-base font-semibold\">{railTitle ?? defaultRailTitle}</Dialog.Title>\n\t\t\t\t\t\t<div onClickCapture={closeMobileSheet}>{rail}</div>\n\t\t\t\t\t</Dialog.Content>\n\t\t\t\t</Dialog.Portal>\n\t\t\t</Dialog.Root>\n\t\t</WizardLayoutContext.Provider>\n\t);\n}\n","'use client';\n\nimport { createContext } from 'react';\n\nexport interface IWizardLayoutContextValue {\n\tmobileSheetOpen: boolean;\n\tsetMobileSheetOpen: (open: boolean) => void;\n}\n\n/**\n * Communicates the rail's mobile-Sheet open state from `WizardLayout` to\n * `WizardTopBar`. Null outside a layout — consumers (top bar's hamburger\n * button) silently no-op when context is missing, so the top bar stays usable\n * outside `WizardLayout`.\n */\nexport const WizardLayoutContext = createContext<IWizardLayoutContextValue | null>(null);\n","'use client';\n\nimport { MenuIcon, XIcon } from 'lucide-react';\nimport { type ReactNode, useContext } from 'react';\n\nimport { useWizardComponents } from '../react/components-provider';\nimport { useWizard } from '../react/use-wizard';\nimport { cn } from '~/utils/cn';\nimport { WizardLayoutContext } from './wizard-layout.context';\n\ninterface IWizardTopBarProps {\n\tbackLabel?: ReactNode;\n\tclassName?: string;\n\tcloseLabel?: string;\n\tdisabled?: boolean;\n\textraActions?: ReactNode;\n\tfinishLabel?: ReactNode;\n\tmenuLabel?: string;\n\tnextLabel?: ReactNode;\n\tonClose: () => void;\n}\n\n/**\n * Header bar for full-page wizard layouts. Renders Back / primary action /\n * extras / close X. Reads `useWizard` for first/last-step detection. The\n * primary action is `type=\"submit\"` on the last step (lets the parent form\n * own submission) and dispatches `wizard.next()` otherwise. Hamburger only\n * surfaces when wrapped by a `WizardLayout`.\n */\nexport function WizardTopBar(props: IWizardTopBarProps) {\n\tconst { backLabel, className, closeLabel, disabled, extraActions, finishLabel, menuLabel, nextLabel, onClose } =\n\t\tprops;\n\tconst wizard = useWizard();\n\tconst layout = useContext(WizardLayoutContext);\n\tconst { Button, BackArrowIcon } = useWizardComponents();\n\n\tconst config = wizard.configOptions;\n\tconst tree = wizard.tree;\n\tconst isFirstStep = tree.activeBranch.prevCategory == null && tree.activeCategory.prevStep == null;\n\tconst isLastStep = tree.activeBranch.nextCategory == null && tree.activeCategory.nextStep == null;\n\n\tconst resolvedBackLabel = backLabel ?? config.backBtnText;\n\tconst resolvedFinishLabel = finishLabel ?? config.finishText;\n\tconst resolvedNextLabel = nextLabel ?? config.nextBtnText;\n\tconst resolvedMenuLabel = menuLabel ?? 'Open wizard steps';\n\tconst resolvedCloseLabel = closeLabel ?? 'Close';\n\n\treturn (\n\t\t<div\n\t\t\tclassName={cn('flex h-14 items-center gap-3 border-b border-border bg-background px-4 sm:px-6', className)}\n\t\t\tdata-slot=\"wizard-top-bar\"\n\t\t>\n\t\t\t{layout && (\n\t\t\t\t<Button\n\t\t\t\t\taria-label={resolvedMenuLabel}\n\t\t\t\t\tclassName=\"md:hidden\"\n\t\t\t\t\tonClick={() => layout.setMobileSheetOpen(true)}\n\t\t\t\t\tsize=\"icon-sm\"\n\t\t\t\t\ttype=\"button\"\n\t\t\t\t\tvariant=\"ghost\"\n\t\t\t\t>\n\t\t\t\t\t<MenuIcon />\n\t\t\t\t</Button>\n\t\t\t)}\n\n\t\t\t{!isFirstStep && (\n\t\t\t\t<button\n\t\t\t\t\taria-label={typeof resolvedBackLabel === 'string' ? resolvedBackLabel : undefined}\n\t\t\t\t\tclassName=\"group inline-flex items-center gap-1 rounded-md py-1 pr-2.5 pl-3.5 text-sm font-normal text-muted-foreground transition-colors duration-150 hover:bg-muted hover:text-foreground\"\n\t\t\t\t\tonClick={() => {\n\t\t\t\t\t\tvoid wizard.back();\n\t\t\t\t\t}}\n\t\t\t\t\ttype=\"button\"\n\t\t\t\t>\n\t\t\t\t\t<BackArrowIcon />\n\t\t\t\t\t<span>{resolvedBackLabel}</span>\n\t\t\t\t</button>\n\t\t\t)}\n\n\t\t\t<div className=\"flex flex-1 items-center justify-end gap-2\">\n\t\t\t\t{extraActions}\n\t\t\t\t{isLastStep ? (\n\t\t\t\t\t<Button disabled={disabled} key=\"wizard-finish\" type=\"submit\" variant=\"default\">\n\t\t\t\t\t\t{resolvedFinishLabel}\n\t\t\t\t\t</Button>\n\t\t\t\t) : (\n\t\t\t\t\t<Button\n\t\t\t\t\t\tdisabled={disabled}\n\t\t\t\t\t\tkey=\"wizard-next\"\n\t\t\t\t\t\tonClick={() => {\n\t\t\t\t\t\t\tvoid wizard.next();\n\t\t\t\t\t\t}}\n\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\tvariant=\"default\"\n\t\t\t\t\t>\n\t\t\t\t\t\t{resolvedNextLabel}\n\t\t\t\t\t</Button>\n\t\t\t\t)}\n\t\t\t\t<Button aria-label={resolvedCloseLabel} onClick={onClose} size=\"icon-sm\" type=\"button\" variant=\"ghost\">\n\t\t\t\t\t<XIcon />\n\t\t\t\t</Button>\n\t\t\t</div>\n\t\t</div>\n\t);\n}\n"],"mappings":";;;;;;;;;AAuBG;AAhBI,SAAS,qBAAqB,EAAE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AAC,SAAI,WAAU,8CACb;AAAA;AAAA,UACA,aACA,gBAAAD,KAAC,UAAO,UAAwC,MAAK,UAAS,SAAQ,WACpE,iCAD8B,eAEhC,IAEA,gBAAAA;AAAA,YAAC;AAAA;AAAA,cACA;AAAA,cAEA,SAAS,MAAM;AACd,qBAAK,OAAO,KAAK;AAAA,cAClB;AAAA,cACA,MAAK;AAAA,cACL,SAAQ;AAAA,cAEP;AAAA;AAAA,YAPG;AAAA,UAQL;AAAA,UAED,gBAAAA,KAAC,UAAO,cAAY,oBAAoB,SAAS,SAAS,MAAK,WAAU,MAAK,UAAS,SAAQ,SAC9F,0BAAAA,KAAC,SAAM,GACR;AAAA,WACD;AAAA;AAAA;AAAA,EACD;AAEF;","names":["jsx","jsx","jsx","jsx","jsxs"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-wizard-engine",
3
- "version": "0.1.3",
3
+ "version": "0.1.4",
4
4
  "license": "MIT",
5
5
  "description": "Multi-step flow engine for React: steps, categories, branches, pluggable strategies, async navigation with cancellation.",
6
6
  "keywords": [