Usage
FormWizard from @prepared911/ui/blocks/form-wizard is the full-viewport wizard for a multi-step create flow. It composes TakeoverDialog, Stepper and FormLayoutStandard: a stepper, the current step's form in a column of at most 640px, a pinned footer, and a header. You pass the steps, the current step id, the copy and the current step's fields. You own the values, the validation and any discard prompt.onSaveAndExit when there is something to save.FormDialog or FormLayoutDrawer.TakeoverDialog.Stepper on its own.title), then Save & exit as a ghost button when you pass onSaveAndExit, then the close control at the inline end. The close control is Cancel. At narrow widths Save & exit wraps to a second row while the close control stays on the title row.submitLabel, the finishing verb of the flow, such as "Create agency". There is no step counter, no Cancel and no Save & exit in the footer.sections, stepperLayout={FormWizardStepperLayout.Top}, or a container narrower than 640px puts a horizontal stepper above the form, pinned while the form scrolls.onStepSubmit({ stepId, nextId, isLast, event }). Read the fields with new FormData(event.currentTarget) and validate there. Continue is never disabled for an invalid or pristine form.current to nextId, or finish the flow when isLast. Focus moves to the new step's title, the stepper announces the change and the form scrolls to its top.current, mark the fields invalid and pass stepErrors. Focus moves to the first invalid field. The footer shows no error summary. Clear the entry when the step is valid again.onCurrentChange runs with no validation. By default only completed steps are reachable.pending, or return a promise from onStepSubmit. The primary shows submitPendingLabel; Back and the stepper are unavailable.onOpenChange(false, details) runs; call details.cancel() and show your own prompt with "Keep editing" and "Discard".