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

14 exports
View source packages/ui-machines/src/dialog/index.ts

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();

Exports

DeclarationView source
DialogChangeReasonts
type DialogChangeReason = DialogOpenReason | DialogCloseReason;
DeclarationView source
DialogCloseReasonts
type DialogCloseReason = "escape" | "outside-click" | "close-trigger" | "programmatic";
DeclarationView source
DialogCommandts
type DialogCommand = CommandObject & {
readonly type: "OPEN_CHANGE_REQUEST";
readonly open: boolean;
readonly reason: DialogChangeReason;
};
Name
Kind
Type
Requirement
open
property
boolean
required
reason
property
DialogChangeReason
required
type
property
string
required
Name
open
Kind
property
Type
boolean
Requirement
required
Name
reason
Kind
property
Type
DialogChangeReason
Requirement
required
Name
type
Kind
property
Type
string
Requirement
required
DeclarationView source
DialogContextts
type DialogContext = {
readonly mode: "controlled" | "uncontrolled";
};
Name
Kind
Type
Requirement
mode
property
"controlled" | "uncontrolled"
required
Name
mode
Kind
property
Type
"controlled" | "uncontrolled"
Requirement
required
DeclarationView source
DialogDiagnosticCodests
export declare const DialogDiagnosticCodes: readonly DiagnosticCatalogueEntry[];
DeclarationView source
DialogEventts
type DialogEvent = {
readonly type: "OPEN";
readonly reason: DialogOpenReason;
} | {
readonly type: "CLOSE";
readonly reason: DialogCloseReason;
};
DeclarationView source
DialogInputts
type DialogInput = {
readonly open?: boolean;
readonly defaultOpen?: boolean;
readonly dismissable?: boolean;
};
Name
Kind
Type
Requirement
defaultOpen
property
boolean
optional
dismissable
property
boolean
optional
open
property
boolean
optional
Name
defaultOpen
Kind
property
Type
boolean
Requirement
optional
Name
dismissable
Kind
property
Type
boolean
Requirement
optional
Name
open
Kind
property
Type
boolean
Requirement
optional
DeclarationView source
dialogMachinets
export declare const dialogMachine: DialogMachine;
DeclarationView source
DialogMachinets
type DialogMachine = Machine<DialogInput, DialogStateValue, DialogContext, DialogEvent, DialogCommand>;
DeclarationView source
DialogOpenReasonts
type DialogOpenReason = "trigger" | "programmatic";
DeclarationView source
dialogReplaySequencets
export declare const dialogReplaySequence: readonly DialogEvent[];
DeclarationView source
dialogSelectorsts
export declare const dialogSelectors: {
open: (snapshot: DialogSnapshot) => boolean;
};
Name
Kind
Type
Requirement
open
property
(snapshot: DialogSnapshot) => boolean
required
Name
open
Kind
property
Type
(snapshot: DialogSnapshot) => boolean
Requirement
required
DeclarationView source
DialogSnapshotts
type DialogSnapshot = Snapshot<DialogStateValue, DialogContext>;
DeclarationView source
DialogStateValuets
type DialogStateValue = "open" | "closed";