@connextar/house 0.2.0 → 0.4.0
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/README.md +213 -2
- package/dist/house.css +66 -0
- package/dist/ux/errors.d.ts +26 -0
- package/dist/ux/errors.d.ts.map +1 -0
- package/dist/ux/errors.js +33 -0
- package/dist/ux/errors.js.map +1 -0
- package/dist/ux/feedback.d.ts +23 -0
- package/dist/ux/feedback.d.ts.map +1 -0
- package/dist/ux/feedback.js +22 -0
- package/dist/ux/feedback.js.map +1 -0
- package/dist/ux/index.d.ts +20 -0
- package/dist/ux/index.d.ts.map +1 -0
- package/dist/ux/index.js +20 -0
- package/dist/ux/index.js.map +1 -0
- package/dist/ux/navigation-index.d.ts +10 -0
- package/dist/ux/navigation-index.d.ts.map +1 -0
- package/dist/ux/navigation-index.js +10 -0
- package/dist/ux/navigation-index.js.map +1 -0
- package/dist/ux/navigation-progress.d.ts +53 -0
- package/dist/ux/navigation-progress.d.ts.map +1 -0
- package/dist/ux/navigation-progress.js +245 -0
- package/dist/ux/navigation-progress.js.map +1 -0
- package/dist/ux/optimistic.d.ts +139 -0
- package/dist/ux/optimistic.d.ts.map +1 -0
- package/dist/ux/optimistic.js +242 -0
- package/dist/ux/optimistic.js.map +1 -0
- package/dist/ux/use-action.d.ts +60 -0
- package/dist/ux/use-action.d.ts.map +1 -0
- package/dist/ux/use-action.js +100 -0
- package/dist/ux/use-action.js.map +1 -0
- package/dist/ux/use-optimistic-list.d.ts +69 -0
- package/dist/ux/use-optimistic-list.d.ts.map +1 -0
- package/dist/ux/use-optimistic-list.js +115 -0
- package/dist/ux/use-optimistic-list.js.map +1 -0
- package/dist/ux/use-optimistic-value.d.ts +40 -0
- package/dist/ux/use-optimistic-value.d.ts.map +1 -0
- package/dist/ux/use-optimistic-value.js +68 -0
- package/dist/ux/use-optimistic-value.js.map +1 -0
- package/dist/wizard/index.d.ts +26 -0
- package/dist/wizard/index.d.ts.map +1 -0
- package/dist/wizard/index.js +26 -0
- package/dist/wizard/index.js.map +1 -0
- package/dist/wizard/invalid.d.ts +91 -0
- package/dist/wizard/invalid.d.ts.map +1 -0
- package/dist/wizard/invalid.js +121 -0
- package/dist/wizard/invalid.js.map +1 -0
- package/dist/wizard/react-hook-form-index.d.ts +12 -0
- package/dist/wizard/react-hook-form-index.d.ts.map +1 -0
- package/dist/wizard/react-hook-form-index.js +12 -0
- package/dist/wizard/react-hook-form-index.js.map +1 -0
- package/dist/wizard/rhf-adapter.d.ts +32 -0
- package/dist/wizard/rhf-adapter.d.ts.map +1 -0
- package/dist/wizard/rhf-adapter.js +58 -0
- package/dist/wizard/rhf-adapter.js.map +1 -0
- package/dist/wizard/rules.d.ts +92 -0
- package/dist/wizard/rules.d.ts.map +1 -0
- package/dist/wizard/rules.js +105 -0
- package/dist/wizard/rules.js.map +1 -0
- package/dist/wizard/wizard.d.ts +127 -0
- package/dist/wizard/wizard.d.ts.map +1 -0
- package/dist/wizard/wizard.js +195 -0
- package/dist/wizard/wizard.js.map +1 -0
- package/package.json +24 -3
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { type StepCheck, type StepCheckable } from "./rules.js";
|
|
3
|
+
export interface WizardStep extends StepCheckable {
|
|
4
|
+
id: string;
|
|
5
|
+
title: string;
|
|
6
|
+
/** One line saying what this step is for. */
|
|
7
|
+
description?: string;
|
|
8
|
+
content: React.ReactNode;
|
|
9
|
+
}
|
|
10
|
+
/** Every element the wizard draws. Each value replaces the default for that part. */
|
|
11
|
+
export interface WizardClassNames {
|
|
12
|
+
form: string;
|
|
13
|
+
markers: string;
|
|
14
|
+
markerItem: string;
|
|
15
|
+
marker: string;
|
|
16
|
+
markerLocked: string;
|
|
17
|
+
circle: string;
|
|
18
|
+
circleDone: string;
|
|
19
|
+
circleCurrent: string;
|
|
20
|
+
circleUpcoming: string;
|
|
21
|
+
markerTitle: string;
|
|
22
|
+
markerTitleCurrent: string;
|
|
23
|
+
connector: string;
|
|
24
|
+
connectorDone: string;
|
|
25
|
+
bar: string;
|
|
26
|
+
barFill: string;
|
|
27
|
+
heading: string;
|
|
28
|
+
description: string;
|
|
29
|
+
alert: string;
|
|
30
|
+
panel: string;
|
|
31
|
+
footer: string;
|
|
32
|
+
counter: string;
|
|
33
|
+
button: string;
|
|
34
|
+
backButton: string;
|
|
35
|
+
forwardButton: string;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* The house look, on the shared theme tokens. An app without them — MAS keeps
|
|
39
|
+
* its palette in literal classes — replaces the parts it needs through
|
|
40
|
+
* `classNames`, exactly as the guide renderer allows.
|
|
41
|
+
*/
|
|
42
|
+
export declare const WIZARD_CLASS_NAMES: WizardClassNames;
|
|
43
|
+
export interface FormWizardProps {
|
|
44
|
+
steps: WizardStep[];
|
|
45
|
+
/**
|
|
46
|
+
* Is the step being left complete? Asked before each advance, and again for
|
|
47
|
+
* every step on submit. See `StepCheck` for the ways it may answer.
|
|
48
|
+
*/
|
|
49
|
+
onValidateStep?: StepCheck;
|
|
50
|
+
/** Called once every step has passed, and never before. */
|
|
51
|
+
onSubmit: () => void | Promise<void>;
|
|
52
|
+
/** Shown in place of Back on the first step; without it, Back is disabled there. */
|
|
53
|
+
onCancel?: () => void;
|
|
54
|
+
submitLabel?: React.ReactNode;
|
|
55
|
+
nextLabel?: React.ReactNode;
|
|
56
|
+
cancelLabel?: React.ReactNode;
|
|
57
|
+
backLabel?: React.ReactNode;
|
|
58
|
+
/** The submission is in flight: navigation locks and the button says so. */
|
|
59
|
+
pending?: boolean;
|
|
60
|
+
/**
|
|
61
|
+
* Every step open from the start — for editing, where the values are all there
|
|
62
|
+
* already and the change is usually to one field on a later step.
|
|
63
|
+
*/
|
|
64
|
+
allReachable?: boolean;
|
|
65
|
+
/** Show how far through as a bar as well as a count. */
|
|
66
|
+
showProgressBar?: boolean;
|
|
67
|
+
/** A heading or introduction above the tracker, inside the form. */
|
|
68
|
+
header?: React.ReactNode;
|
|
69
|
+
className?: string;
|
|
70
|
+
footerClassName?: string;
|
|
71
|
+
classNames?: Partial<WizardClassNames>;
|
|
72
|
+
"aria-label"?: string;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* A long form split into steps. The one stepper for every multi-step form in
|
|
76
|
+
* every app — the union of what five of them each learnt the hard way.
|
|
77
|
+
*
|
|
78
|
+
* - **It renders the `<form>` itself,** so nothing reaches `onSubmit`
|
|
79
|
+
* unchecked and so Enter has one place to land. A wizard sitting inside
|
|
80
|
+
* somebody else's form cannot promise either.
|
|
81
|
+
* - **Enter never skips ahead.** Pressing Enter in a one-line field submits the
|
|
82
|
+
* form the browser's way, and before the last step that submission means
|
|
83
|
+
* Continue: this step is checked and, if it passes, the next one opens. Only
|
|
84
|
+
* the last step's Enter submits.
|
|
85
|
+
* - **There is one submit button and its `type` never changes.** PharmaLine put
|
|
86
|
+
* a `type="button"` Continue and a `type="submit"` Create in the same slot;
|
|
87
|
+
* React reused the one DOM node and switched its type mid-click, and Chromium
|
|
88
|
+
* submitted — every booking made from the dashboard skipped Confirm and sent a
|
|
89
|
+
* confirmation nobody chose. jsdom's timing hid it, so the guard here is
|
|
90
|
+
* structural rather than behavioural: one button, always `type="submit"`.
|
|
91
|
+
* - **Steps are checked as you leave them.** `onValidateStep` (or the step's own
|
|
92
|
+
* `validate`) is asked before each advance, and the step stays put if it
|
|
93
|
+
* refuses, saying why when the check gave a message.
|
|
94
|
+
* - **Submitting checks every step, in order, and lands on the first that
|
|
95
|
+
* fails.** Checking only the last one, or none at all, is how a form refuses
|
|
96
|
+
* with the problem on a screen nobody is looking at.
|
|
97
|
+
* - **Continue is never disabled for being incomplete.** A greyed-out button
|
|
98
|
+
* that will not say what is missing is a refusal with no words; it is only
|
|
99
|
+
* disabled while something is actually in flight.
|
|
100
|
+
* - **Visited markers are clickable; steps ahead stay locked** (unless
|
|
101
|
+
* `allReachable`), so the tracker is navigation rather than a way past a step
|
|
102
|
+
* that has never been checked.
|
|
103
|
+
* - **All steps stay mounted,** hidden rather than unmounted: one register, and
|
|
104
|
+
* nothing typed is lost by stepping back to check something.
|
|
105
|
+
*
|
|
106
|
+
* What it deliberately does not do is validate anything itself, or know what a
|
|
107
|
+
* button looks like. The check is a function the host supplies, so
|
|
108
|
+
* react-hook-form, plain state and a form built out of `useState` can all host
|
|
109
|
+
* it; the look is theme-token classes an app replaces through `classNames`.
|
|
110
|
+
*/
|
|
111
|
+
export declare function FormWizard({ steps, onValidateStep, onSubmit, onCancel, submitLabel, nextLabel, cancelLabel, backLabel, pending, allReachable, showProgressBar, header, className, footerClassName, classNames, "aria-label": ariaLabel, }: FormWizardProps): React.JSX.Element | null;
|
|
112
|
+
/**
|
|
113
|
+
* A field's error message, marked so the reporter can tell a visible error from
|
|
114
|
+
* a hidden one. An app whose form library draws its own message adds
|
|
115
|
+
* `data-error-for` to that component instead of using this.
|
|
116
|
+
*/
|
|
117
|
+
export declare function FieldError({ name, message, className, }: {
|
|
118
|
+
name: string;
|
|
119
|
+
message?: string | null;
|
|
120
|
+
className?: string;
|
|
121
|
+
}): React.JSX.Element | null;
|
|
122
|
+
/** A read-only label/value row, for the review step at the end of a wizard. */
|
|
123
|
+
export declare function ReviewRow({ label, value }: {
|
|
124
|
+
label: React.ReactNode;
|
|
125
|
+
value: React.ReactNode;
|
|
126
|
+
}): React.JSX.Element;
|
|
127
|
+
//# sourceMappingURL=wizard.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wizard.d.ts","sourceRoot":"","sources":["../../src/wizard/wizard.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,OAAO,EAQL,KAAK,SAAS,EACd,KAAK,aAAa,EACnB,MAAM,YAAY,CAAC;AAgBpB,MAAM,WAAW,UAAW,SAAQ,aAAa;IAC/C,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,6CAA6C;IAC7C,WA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|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
+
import { Check, ChevronLeft, ChevronRight } from "lucide-react";
|
|
4
|
+
import * as React from "react";
|
|
5
|
+
import { cx } from "../internal/cx.js";
|
|
6
|
+
import { ERROR_ATTRIBUTE } from "./invalid.js";
|
|
7
|
+
import { checkStep, firstFailure, isReachable, markerState, nextIndex, percentComplete, previousIndex, } from "./rules.js";
|
|
8
|
+
/** Inputs where Enter is not "I'm done with this field". */
|
|
9
|
+
const NOT_ONE_LINE_FIELDS = new Set([
|
|
10
|
+
"button",
|
|
11
|
+
"checkbox",
|
|
12
|
+
"color",
|
|
13
|
+
"file",
|
|
14
|
+
"hidden",
|
|
15
|
+
"image",
|
|
16
|
+
"radio",
|
|
17
|
+
"range",
|
|
18
|
+
"reset",
|
|
19
|
+
"submit",
|
|
20
|
+
]);
|
|
21
|
+
/**
|
|
22
|
+
* The house look, on the shared theme tokens. An app without them — MAS keeps
|
|
23
|
+
* its palette in literal classes — replaces the parts it needs through
|
|
24
|
+
* `classNames`, exactly as the guide renderer allows.
|
|
25
|
+
*/
|
|
26
|
+
export const WIZARD_CLASS_NAMES = {
|
|
27
|
+
form: "flex flex-col gap-5",
|
|
28
|
+
markers: "flex items-center gap-2",
|
|
29
|
+
markerItem: "flex min-w-0 flex-1 items-center gap-2 last:flex-none sm:last:flex-1",
|
|
30
|
+
marker: "flex min-w-0 items-center gap-2 rounded-lg px-1.5 py-1 text-left transition-colors focus-visible:ring-2 focus-visible:ring-ring focus-visible:outline-none sm:flex-1",
|
|
31
|
+
markerLocked: "cursor-not-allowed opacity-60",
|
|
32
|
+
circle: "flex size-6 shrink-0 items-center justify-center rounded-full border text-xs font-semibold",
|
|
33
|
+
circleDone: "border-primary bg-primary text-primary-foreground",
|
|
34
|
+
circleCurrent: "border-2 border-primary text-primary",
|
|
35
|
+
circleUpcoming: "border-border text-muted-foreground",
|
|
36
|
+
markerTitle: "hidden truncate text-sm sm:block",
|
|
37
|
+
markerTitleCurrent: "font-medium text-foreground",
|
|
38
|
+
connector: "h-px flex-1 bg-border sm:w-3 sm:flex-none",
|
|
39
|
+
connectorDone: "bg-primary",
|
|
40
|
+
bar: "h-1.5 w-full overflow-hidden rounded-full bg-muted",
|
|
41
|
+
barFill: "h-full rounded-full bg-primary transition-[width]",
|
|
42
|
+
heading: "text-sm font-medium",
|
|
43
|
+
description: "text-xs text-muted-foreground",
|
|
44
|
+
alert: "rounded-lg border border-destructive/40 bg-destructive/10 px-4 py-3 text-sm text-destructive",
|
|
45
|
+
panel: "space-y-4",
|
|
46
|
+
footer: "flex items-center justify-between gap-2 border-t border-border pt-4",
|
|
47
|
+
counter: "text-xs tabular-nums text-muted-foreground",
|
|
48
|
+
button: "inline-flex items-center gap-1.5 rounded-md px-3 py-2 text-sm font-medium transition-colors focus-visible:ring-2 focus-visible:ring-ring focus-visible:outline-none disabled:pointer-events-none disabled:opacity-60",
|
|
49
|
+
backButton: "text-muted-foreground hover:bg-muted hover:text-foreground",
|
|
50
|
+
forwardButton: "bg-primary text-primary-foreground hover:bg-primary/90",
|
|
51
|
+
};
|
|
52
|
+
/**
|
|
53
|
+
* A long form split into steps. The one stepper for every multi-step form in
|
|
54
|
+
* every app — the union of what five of them each learnt the hard way.
|
|
55
|
+
*
|
|
56
|
+
* - **It renders the `<form>` itself,** so nothing reaches `onSubmit`
|
|
57
|
+
* unchecked and so Enter has one place to land. A wizard sitting inside
|
|
58
|
+
* somebody else's form cannot promise either.
|
|
59
|
+
* - **Enter never skips ahead.** Pressing Enter in a one-line field submits the
|
|
60
|
+
* form the browser's way, and before the last step that submission means
|
|
61
|
+
* Continue: this step is checked and, if it passes, the next one opens. Only
|
|
62
|
+
* the last step's Enter submits.
|
|
63
|
+
* - **There is one submit button and its `type` never changes.** PharmaLine put
|
|
64
|
+
* a `type="button"` Continue and a `type="submit"` Create in the same slot;
|
|
65
|
+
* React reused the one DOM node and switched its type mid-click, and Chromium
|
|
66
|
+
* submitted — every booking made from the dashboard skipped Confirm and sent a
|
|
67
|
+
* confirmation nobody chose. jsdom's timing hid it, so the guard here is
|
|
68
|
+
* structural rather than behavioural: one button, always `type="submit"`.
|
|
69
|
+
* - **Steps are checked as you leave them.** `onValidateStep` (or the step's own
|
|
70
|
+
* `validate`) is asked before each advance, and the step stays put if it
|
|
71
|
+
* refuses, saying why when the check gave a message.
|
|
72
|
+
* - **Submitting checks every step, in order, and lands on the first that
|
|
73
|
+
* fails.** Checking only the last one, or none at all, is how a form refuses
|
|
74
|
+
* with the problem on a screen nobody is looking at.
|
|
75
|
+
* - **Continue is never disabled for being incomplete.** A greyed-out button
|
|
76
|
+
* that will not say what is missing is a refusal with no words; it is only
|
|
77
|
+
* disabled while something is actually in flight.
|
|
78
|
+
* - **Visited markers are clickable; steps ahead stay locked** (unless
|
|
79
|
+
* `allReachable`), so the tracker is navigation rather than a way past a step
|
|
80
|
+
* that has never been checked.
|
|
81
|
+
* - **All steps stay mounted,** hidden rather than unmounted: one register, and
|
|
82
|
+
* nothing typed is lost by stepping back to check something.
|
|
83
|
+
*
|
|
84
|
+
* What it deliberately does not do is validate anything itself, or know what a
|
|
85
|
+
* button looks like. The check is a function the host supplies, so
|
|
86
|
+
* react-hook-form, plain state and a form built out of `useState` can all host
|
|
87
|
+
* it; the look is theme-token classes an app replaces through `classNames`.
|
|
88
|
+
*/
|
|
89
|
+
export function FormWizard({ steps, onValidateStep, onSubmit, onCancel, submitLabel = "Save", nextLabel = "Continue", cancelLabel = "Cancel", backLabel = "Back", pending = false, allReachable = false, showProgressBar = false, header, className, footerClassName, classNames, "aria-label": ariaLabel, }) {
|
|
90
|
+
const c = { ...WIZARD_CLASS_NAMES, ...classNames };
|
|
91
|
+
const [current, setCurrent] = React.useState(0);
|
|
92
|
+
const [furthest, setFurthest] = React.useState(allReachable ? steps.length - 1 : 0);
|
|
93
|
+
const [checking, setChecking] = React.useState(false);
|
|
94
|
+
const [problem, setProblem] = React.useState(null);
|
|
95
|
+
const inFlight = React.useRef(false);
|
|
96
|
+
const formId = React.useId();
|
|
97
|
+
const step = steps[current];
|
|
98
|
+
const isFirst = current === 0;
|
|
99
|
+
const isLast = current === steps.length - 1;
|
|
100
|
+
const busy = pending || checking;
|
|
101
|
+
function goTo(index) {
|
|
102
|
+
setProblem(null);
|
|
103
|
+
setCurrent(index);
|
|
104
|
+
}
|
|
105
|
+
async function goNext() {
|
|
106
|
+
if (!step)
|
|
107
|
+
return;
|
|
108
|
+
setChecking(true);
|
|
109
|
+
try {
|
|
110
|
+
const result = await checkStep(step, onValidateStep);
|
|
111
|
+
if (!result.ok) {
|
|
112
|
+
setProblem(result.message);
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
finally {
|
|
117
|
+
setChecking(false);
|
|
118
|
+
}
|
|
119
|
+
const next = nextIndex(current, steps.length);
|
|
120
|
+
setProblem(null);
|
|
121
|
+
setCurrent(next);
|
|
122
|
+
setFurthest((seen) => Math.max(seen, next));
|
|
123
|
+
}
|
|
124
|
+
async function submit() {
|
|
125
|
+
setChecking(true);
|
|
126
|
+
try {
|
|
127
|
+
const failure = await firstFailure(steps, onValidateStep);
|
|
128
|
+
if (failure) {
|
|
129
|
+
// Show the step that holds the problem, so its message is on screen.
|
|
130
|
+
setCurrent(failure.index);
|
|
131
|
+
setProblem(failure.message);
|
|
132
|
+
return;
|
|
133
|
+
}
|
|
134
|
+
setProblem(null);
|
|
135
|
+
}
|
|
136
|
+
finally {
|
|
137
|
+
setChecking(false);
|
|
138
|
+
}
|
|
139
|
+
await onSubmit();
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Every way of submitting — the footer button, or Enter in a field — comes
|
|
143
|
+
* through here, and before the last step it means Continue. Re-entry is
|
|
144
|
+
* refused rather than queued: a second press is the person saying the first
|
|
145
|
+
* one gave them nothing to look at.
|
|
146
|
+
*/
|
|
147
|
+
function handleSubmit(event) {
|
|
148
|
+
event.preventDefault();
|
|
149
|
+
if (busy || inFlight.current)
|
|
150
|
+
return;
|
|
151
|
+
inFlight.current = true;
|
|
152
|
+
void (isLast ? submit() : goNext()).finally(() => {
|
|
153
|
+
inFlight.current = false;
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* Enter in a one-line field means "go on", whatever the field. Browsers
|
|
158
|
+
* disagree about Enter in some of them — Chromium does nothing on Enter in a
|
|
159
|
+
* date-and-time field — so the form asks for submission itself. A field that
|
|
160
|
+
* handles Enter on its own (and cancels it) is left alone, and so is a
|
|
161
|
+
* textarea, where Enter is a new line.
|
|
162
|
+
*/
|
|
163
|
+
function handleKeyDown(event) {
|
|
164
|
+
if (event.key !== "Enter" || event.defaultPrevented || event.nativeEvent.isComposing)
|
|
165
|
+
return;
|
|
166
|
+
const target = event.target;
|
|
167
|
+
if (!(target instanceof HTMLInputElement) || NOT_ONE_LINE_FIELDS.has(target.type))
|
|
168
|
+
return;
|
|
169
|
+
event.preventDefault();
|
|
170
|
+
event.currentTarget.requestSubmit();
|
|
171
|
+
}
|
|
172
|
+
if (!step)
|
|
173
|
+
return null;
|
|
174
|
+
const percent = percentComplete(current, steps.length);
|
|
175
|
+
return (_jsxs("form", { onSubmit: handleSubmit, onKeyDown: handleKeyDown, noValidate: true, "aria-label": ariaLabel, className: cx(c.form, className), children: [header, _jsx("ol", { className: c.markers, "aria-label": "Progress", children: steps.map((s, index) => {
|
|
176
|
+
const state = markerState(index, current);
|
|
177
|
+
const reachable = isReachable(index, furthest);
|
|
178
|
+
return (_jsxs("li", { className: c.markerItem, children: [_jsxs("button", { type: "button", disabled: !reachable || busy, onClick: () => goTo(index), "aria-current": state === "current" ? "step" : undefined, "aria-controls": `${formId}-${s.id}`, "aria-label": `Step ${index + 1}: ${s.title}`, className: cx(c.marker, !reachable && c.markerLocked), children: [_jsx("span", { "aria-hidden": true, className: cx(c.circle, state === "done" && c.circleDone, state === "current" && c.circleCurrent, state === "upcoming" && c.circleUpcoming), children: state === "done" ? _jsx(Check, { className: "size-3.5" }) : index + 1 }), _jsx("span", { "aria-hidden": true, className: cx(c.markerTitle, state === "current" && c.markerTitleCurrent), children: s.title })] }), index < steps.length - 1 ? (_jsx("span", { "aria-hidden": true, className: cx(c.connector, state === "done" && c.connectorDone) })) : null] }, s.id));
|
|
179
|
+
}) }), showProgressBar ? (_jsx("div", { className: c.bar, role: "progressbar", "aria-label": "Form progress", "aria-valuemin": 0, "aria-valuemax": 100, "aria-valuenow": percent, children: _jsx("div", { className: c.barFill, style: { width: `${percent}%` } }) })) : null, _jsxs("div", { children: [_jsx("h3", { className: cx(c.heading, "sm:hidden"), children: step.title }), step.description ? _jsx("p", { className: c.description, children: step.description }) : null] }), problem ? (_jsx("p", { className: c.alert, role: "alert", children: problem })) : null, steps.map((s, index) => (_jsx("section", { id: `${formId}-${s.id}`, hidden: index !== current, "aria-label": s.title, className: c.panel, children: s.content }, s.id))), _jsxs("div", { className: cx(c.footer, footerClassName), children: [isFirst && onCancel ? (_jsx("button", { type: "button", onClick: onCancel, disabled: pending, className: cx(c.button, c.backButton), children: cancelLabel })) : (_jsxs("button", { type: "button", onClick: () => goTo(previousIndex(current)), disabled: isFirst || busy, className: cx(c.button, c.backButton), children: [_jsx(ChevronLeft, { className: "size-4", "aria-hidden": true }), backLabel] })), _jsxs("span", { className: c.counter, "aria-live": "polite", children: ["Step ", current + 1, " of ", steps.length] }), _jsx("button", { type: "submit", disabled: busy, "data-busy": busy ? "true" : undefined, className: cx(c.button, c.forwardButton), children: isLast ? (submitLabel) : (_jsxs(_Fragment, { children: [nextLabel, _jsx(ChevronRight, { className: "size-4", "aria-hidden": true })] })) })] })] }));
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* A field's error message, marked so the reporter can tell a visible error from
|
|
183
|
+
* a hidden one. An app whose form library draws its own message adds
|
|
184
|
+
* `data-error-for` to that component instead of using this.
|
|
185
|
+
*/
|
|
186
|
+
export function FieldError({ name, message, className, }) {
|
|
187
|
+
if (!message)
|
|
188
|
+
return null;
|
|
189
|
+
return (_jsx("p", { [ERROR_ATTRIBUTE]: name, className: className ?? "text-xs text-destructive", children: message }));
|
|
190
|
+
}
|
|
191
|
+
/** A read-only label/value row, for the review step at the end of a wizard. */
|
|
192
|
+
export function ReviewRow({ label, value }) {
|
|
193
|
+
return (_jsxs("div", { className: "flex items-start justify-between gap-4 border-b border-border py-2 last:border-0", children: [_jsx("span", { className: "text-sm text-muted-foreground", children: label }), _jsx("span", { className: "text-right text-sm font-medium", children: value || _jsx("span", { className: "text-muted-foreground", children: "\u2014" }) })] }));
|
|
194
|
+
}
|
|
195
|
+
//# sourceMappingURL=wizard.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wizard.js","sourceRoot":"","sources":["../../src/wizard/wizard.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAChE,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,EAAE,EAAE,MAAM,mBAAmB,CAAC;AACvC,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,EACL,SAAS,EACT,YAAY,EACZ,WAAW,EACX,WAAW,EACX,SAAS,EACT,eAAe,EACf,aAAa,GAGd,MAAM,YAAY,CAAC;AAEpB,4DAA4D;AAC5D,MAAM,mBAAmB,GAAG,IAAI,GAAG,CAAC;IAClC,QAAQ;IACR,UAAU;IACV,OAAO;IACP,MAAM;IACN,QAAQ;IACR,OAAO;IACP,OAAO;IACP,OAAO;IACP,OAAO;IACP,QAAQ;CACT,CAAC,CAAC;AAsCH;;;;GAIG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAqB;IAClD,IAAI,EAAE,qBAAqB;IAC3B,OAAO,EAAE,yBAAyB;IAClC,UAAU,EAAE,sEAAsE;IAClF,MAAM,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,IAAI,eACH,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,EACpC,SAAS,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,aAAa,CAAC,YAEvC,MAAM,CAAC,CAAC,CAAC,CACR,WAAW,CACZ,CAAC,CAAC,CAAC,CACF,8BACG,SAAS,EACV,KAAC,YAAY,IAAC,SAAS,EAAC,QAAQ,wBAAe,IAC9C,CACJ,GACM,IACL,IACD,CACR,CAAC;AACJ,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,UAAU,CAAC,EACzB,IAAI,EACJ,OAAO,EACP,SAAS,GAKV;IACC,IAAI,CAAC,OAAO;QAAE,OAAO,IAAI,CAAC;IAC1B,OAAO,CACL,YAAS,CAAC,eAAe,CAAC,EAAE,IAAI,EAAI,SAAS,EAAE,SAAS,IAAI,0BAA0B,YACnF,OAAO,GACN,CACL,CAAC;AACJ,CAAC;AAED,+EAA+E;AAC/E,MAAM,UAAU,SAAS,CAAC,EAAE,KAAK,EAAE,KAAK,EAAsD;IAC5F,OAAO,CACL,eAAK,SAAS,EAAC,kFAAkF,aAC/F,eAAM,SAAS,EAAC,+BAA+B,YAAE,KAAK,GAAQ,EAC9D,eAAM,SAAS,EAAC,gCAAgC,YAC7C,KAAK,IAAI,eAAM,SAAS,EAAC,uBAAuB,uBAAS,GACrD,IACH,CACP,CAAC;AACJ,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@connextar/house",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "The pieces every app we build needs and none of them should own a copy of.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -42,6 +42,22 @@
|
|
|
42
42
|
"types": "./dist/trail/index.d.ts",
|
|
43
43
|
"default": "./dist/trail/index.js"
|
|
44
44
|
},
|
|
45
|
+
"./ux": {
|
|
46
|
+
"types": "./dist/ux/index.d.ts",
|
|
47
|
+
"default": "./dist/ux/index.js"
|
|
48
|
+
},
|
|
49
|
+
"./ux/navigation": {
|
|
50
|
+
"types": "./dist/ux/navigation-index.d.ts",
|
|
51
|
+
"default": "./dist/ux/navigation-index.js"
|
|
52
|
+
},
|
|
53
|
+
"./wizard": {
|
|
54
|
+
"types": "./dist/wizard/index.d.ts",
|
|
55
|
+
"default": "./dist/wizard/index.js"
|
|
56
|
+
},
|
|
57
|
+
"./wizard/react-hook-form": {
|
|
58
|
+
"types": "./dist/wizard/react-hook-form-index.d.ts",
|
|
59
|
+
"default": "./dist/wizard/react-hook-form-index.js"
|
|
60
|
+
},
|
|
45
61
|
"./editor": {
|
|
46
62
|
"types": "./dist/editor/index.d.ts",
|
|
47
63
|
"default": "./dist/editor/index.js"
|
|
@@ -70,18 +86,22 @@
|
|
|
70
86
|
"test": "vitest run",
|
|
71
87
|
"test:watch": "vitest",
|
|
72
88
|
"build": "rm -rf dist && tsc --project tsconfig.build.json && cp src/styles/house.css dist/house.css",
|
|
73
|
-
"verify": "npm run check:ci && npm run
|
|
89
|
+
"verify": "npm run check:ci && npm run build && npm run test",
|
|
74
90
|
"prepublishOnly": "npm run verify",
|
|
75
91
|
"check:ci": "npm run lint:check && npm run format:check && npm run typecheck"
|
|
76
92
|
},
|
|
77
93
|
"peerDependencies": {
|
|
78
94
|
"next": "^16.0.0",
|
|
79
95
|
"react": "^19.0.0",
|
|
80
|
-
"react-dom": "^19.0.0"
|
|
96
|
+
"react-dom": "^19.0.0",
|
|
97
|
+
"react-hook-form": "^7.60.0"
|
|
81
98
|
},
|
|
82
99
|
"peerDependenciesMeta": {
|
|
83
100
|
"next": {
|
|
84
101
|
"optional": true
|
|
102
|
+
},
|
|
103
|
+
"react-hook-form": {
|
|
104
|
+
"optional": true
|
|
85
105
|
}
|
|
86
106
|
},
|
|
87
107
|
"devDependencies": {
|
|
@@ -98,6 +118,7 @@
|
|
|
98
118
|
"prettier": "^3.0.0",
|
|
99
119
|
"react": "^19.2.8",
|
|
100
120
|
"react-dom": "^19.2.8",
|
|
121
|
+
"react-hook-form": "^7.68.0",
|
|
101
122
|
"typescript": "^5.7.0",
|
|
102
123
|
"typescript-eslint": "^8.69.0",
|
|
103
124
|
"vitest": "^4.0.0"
|