- Name
open- Kind
- property
- Type
boolean- Requirement
- required
DocsAPI referenceUI machinesdialog
dialog machine
The public state machine contract for @grassroot/ui-machines/dialog. The machine owns behaviour; the matching headless layer owns composition.
@grassroot/ui-machines/dialog
Package
Service example
dialog.tsts
import { createService } from "@grassroot/statechart";import { dialogMachine } from "@grassroot/ui-machines/dialog"; const service = createService(dialogMachine, { input: {} });service.start();service.send({ type: "…" });service.stop();14 of 14
Exports
DialogChangeReason
typeDialogChangeReasonts
type DialogChangeReason = DialogOpenReason | DialogCloseReason;DialogCloseReason
typeDialogCloseReasonts
type DialogCloseReason = "escape" | "outside-click" | "close-trigger" | "programmatic";DialogCommand
typeDialogCommandts
type DialogCommand = CommandObject & { readonly type: "OPEN_CHANGE_REQUEST"; readonly open: boolean; readonly reason: DialogChangeReason;};Name
Kind
Type
Requirement
openproperty
booleanrequired
reasonproperty
DialogChangeReasonrequired
typeproperty
stringrequired
- Name
reason- Kind
- property
- Type
DialogChangeReason- Requirement
- required
- Name
type- Kind
- property
- Type
string- Requirement
- required
DialogContext
typeDialogContextts
type DialogContext = { readonly mode: "controlled" | "uncontrolled";};Name
Kind
Type
Requirement
modeproperty
"controlled" | "uncontrolled"required
- Name
mode- Kind
- property
- Type
"controlled" | "uncontrolled"- Requirement
- required
DialogDiagnosticCodes
valueDialogDiagnosticCodests
export declare const DialogDiagnosticCodes: readonly DiagnosticCatalogueEntry[];DialogEvent
typeDialogEventts
type DialogEvent = { readonly type: "OPEN"; readonly reason: DialogOpenReason;} | { readonly type: "CLOSE"; readonly reason: DialogCloseReason;};DialogInput
typeDialogInputts
type DialogInput = { readonly open?: boolean; readonly defaultOpen?: boolean; readonly dismissable?: boolean;};Name
Kind
Type
Requirement
defaultOpenproperty
booleanoptional
dismissableproperty
booleanoptional
openproperty
booleanoptional
- Name
defaultOpen- Kind
- property
- Type
boolean- Requirement
- optional
- Name
dismissable- Kind
- property
- Type
boolean- Requirement
- optional
- Name
open- Kind
- property
- Type
boolean- Requirement
- optional
dialogMachine
valuedialogMachinets
export declare const dialogMachine: DialogMachine;DialogMachine
typeDialogMachinets
type DialogMachine = Machine<DialogInput, DialogStateValue, DialogContext, DialogEvent, DialogCommand>;DialogOpenReason
typeDialogOpenReasonts
type DialogOpenReason = "trigger" | "programmatic";dialogReplaySequence
valuedialogReplaySequencets
export declare const dialogReplaySequence: readonly DialogEvent[];dialogSelectors
valuedialogSelectorsts
export declare const dialogSelectors: { open: (snapshot: DialogSnapshot) => boolean;};Name
Kind
Type
Requirement
openproperty
(snapshot: DialogSnapshot) => booleanrequired
- Name
open- Kind
- property
- Type
(snapshot: DialogSnapshot) => boolean- Requirement
- required
DialogSnapshot
typeDialogSnapshotts
type DialogSnapshot = Snapshot<DialogStateValue, DialogContext>;DialogStateValue
typeDialogStateValuets
type DialogStateValue = "open" | "closed";