DocsAPI referenceUI machineswizard

wizard machine

The public state machine contract for @grassroot/ui-machines/wizard. The machine owns behaviour; the matching headless layer owns composition.

@grassroot/ui-machines/wizard

Package

10 exports
View source packages/ui-machines/src/wizard/index.ts

Service example

wizard.tsts
import { createService } from "@grassroot/statechart";
import { wizardMachine } from "@grassroot/ui-machines/wizard";
const service = createService(wizardMachine, { input: {} });
service.start();
service.send({ type: "…" });
service.stop();

Exports

DeclarationView source
WizardCommandts
type WizardCommand = CommandObject & ({
readonly type: "STEP_CHANGE_REQUEST";
readonly index: number;
readonly reason: WizardReason;
} | {
readonly type: "FINISH_REQUEST";
readonly reason: WizardReason;
});
DeclarationView source
WizardContextts
type WizardContext = {
readonly current: number;
readonly mode: BindingMode;
};
Name
Kind
Type
Requirement
current
property
number
required
mode
property
BindingMode
required
Name
current
Kind
property
Type
number
Requirement
required
Name
mode
Kind
property
Type
BindingMode
Requirement
required
DeclarationView source
WizardDiagnosticCodests
export declare const WizardDiagnosticCodes: readonly DiagnosticCatalogueEntry[];
DeclarationView source
WizardEventts
type WizardEvent = {
readonly type: "GO_TO";
readonly index: number;
readonly reason: WizardReason;
} | {
readonly type: "NEXT";
readonly reason: WizardReason;
} | {
readonly type: "BACK";
readonly reason: WizardReason;
} | {
readonly type: "MOVE";
readonly direction: -1 | 1;
readonly reason: WizardReason;
} | {
readonly type: "HOME";
readonly reason: WizardReason;
} | {
readonly type: "END";
readonly reason: WizardReason;
} | {
readonly type: "RESET";
};
DeclarationView source
WizardInputts
type WizardInput = {
readonly stepCount: number;
readonly step?: number;
readonly defaultStep?: number;
};
Name
Kind
Type
Requirement
defaultStep
property
number
optional
step
property
number
optional
stepCount
property
number
required
Name
defaultStep
Kind
property
Type
number
Requirement
optional
Name
step
Kind
property
Type
number
Requirement
optional
Name
stepCount
Kind
property
Type
number
Requirement
required
DeclarationView source
wizardMachinets
export declare const wizardMachine: Machine<WizardInput, "ready", WizardContext, WizardEvent, WizardCommand>;
DeclarationView source
WizardReasonts
type WizardReason = "pointer" | "keyboard" | "programmatic";
DeclarationView source
wizardReplaySequencets
export declare const wizardReplaySequence: readonly WizardEvent[];
DeclarationView source
wizardSelectorsts
export declare const wizardSelectors: {
current: (snapshot: WizardSnapshot) => number;
};
Name
Kind
Type
Requirement
current
property
(snapshot: WizardSnapshot) => number
required
Name
current
Kind
property
Type
(snapshot: WizardSnapshot) => number
Requirement
required
DeclarationView source
WizardSnapshotts
type WizardSnapshot = Snapshot<"ready", WizardContext>;