Changelog
What changed in each release of Stepperize v9.
Release notes for Stepperize v9. Earlier releases are in the v8 changelog.
v9.0.0
A smaller API on a core that does not depend on a framework. Read Migrating from v8 before upgrading; a codemod rewrites most of it.
npm install @stepperize/react@^9
npx @stepperize/codemod v9 src --checkBreaking changes
next()validates.next(data)saves the data on the current step, checks it against the step's schema, completes the step and moves on. It replacesnext({ data, complete: true })and the guard you wrote to callvalidate(). See Moves.next()on the last step finishes the flow. It callsonFinishand resolves withto: null, where v8 returnedboundary.beforeStepChangeisguard. Its context is{ from, to, direction, data, signal }. It runs after validation, and no longer runs forreset().- One state per step.
state(id)returnspending,currentorcomplete, and replacesstatus(),isComplete()andsetComplete().data-statusanddata-completeare nowdata-state. See Step state. - Completion follows the data. Editing a complete step makes it pending
again; in a
linearflow, so are the steps completed after it. linearallows the current step and the completed ones. The only way forward isnext().- Data is a plain object. Read
stepper.data.shippingand write withstepper.setData(id, value). Thedata.get,data.set,data.update,data.all,data.clearanddata.resetmethods are gone. - Snapshots replace controlled props.
snapshot,onChange,snapshot()andrestore()replacedata,completed, their defaults and their callbacks. See Saving and resuming. stepbehaves likegoTo.linearand the guard apply to it, so a deep link cannot skip validation.onStepChangeis gone: useonChange. See The step in the URL.prev(),goTo()andreset()take no options.prev()returns to the step the user came from.bypassPolicyis replaced by declared branches.- Removed from the stepper:
id,count,completed,canPrev,canNextandis. Usecurrent,index,steps,isFirst,isLastandisPending. - Removed from the definition:
get,at,parseStepandvalidate. - Primitives.
Stepper.Listtakes a function child and replacesStepper.Items.Stepper.Rootcalls its function child with the stepper itself.ActionsandSeparatorare gone,TitleandDescriptionrender aspan, and the@stepperize/react/primitivesentry is removed. @stepperize/coreexportscreateStepper. Its v8 utilities are gone.
Added
- Declarative branching. A
nextmap says where each step leads, typed from the step's schema. Anullentry ends the flow there, so a flow can have more than one ending. See Branching. issues(id). The issues of the last failed check, gone once the step's data changes. See Validation.validate(id?). Checks a step without moving.output. What each complete step's schema produced, with transforms and defaults applied, next todataas it was typed.onFinish(output, data)receives both.isFinished. The flow finishes once: a secondnext()is refused withfinished. Return a promise fromonFinishand the flow stays pending until it settles.- The flow without React.
definition.create()andcreateStepperrun the same state machine in tests, servers and agents. See Core. - Selectors can return objects.
useStepperContext((s) => ({ ... }))no longer needs an equality function. - Automatic ARIA pattern. A
linearflow renders an ordered list of steps witharia-current="step"; a free flow renders tabs. See Accessibility. Stepper.useItem().pending, anddata-pendinganddata-finishedonStepper.Root."use client"on the published files, for frameworks with Server Components.
Changed
- Smaller. 5.2 kB with the primitives (was 5.4) and 2.6 kB for the hooks only (was 3.6), minified and gzipped.
isLastknows about branches. It istruewhennext()would finish the flow.
Tooling
@stepperize/codemod.npx @stepperize/codemod v9 <paths>rewrites what has a direct equivalent, renamesdata-statusselectors, and leaves aTODO(stepperize-v9)comment where a decision is yours.--checktype-checks what it migrated and--jsonprints the report for scripts.- A prompt for coding agents that runs the codemod and resolves what it leaves. See Migrating with an AI agent.
Documentation
Edit on GitHub
Last updated on