DocsAPI referenceUI machinesalert-dialog

alert-dialog machine

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

@grassroot/ui-machines/alert-dialog

Package

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

Service example

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

Exports

DeclarationView source
AlertDialogChangeReasonts
type AlertDialogChangeReason = AlertDialogOpenReason | AlertDialogCloseReason;
DeclarationView source
AlertDialogCloseReasonts
type AlertDialogCloseReason = "escape" | "outside-click" | "close-trigger" | "programmatic";
DeclarationView source
AlertDialogCommandts
type AlertDialogCommand = CommandObject & {
readonly type: "OPEN_CHANGE_REQUEST";
readonly open: boolean;
readonly reason: AlertDialogChangeReason;
};
Name
Kind
Type
Requirement
open
property
boolean
required
reason
property
AlertDialogChangeReason
required
type
property
string
required
Name
open
Kind
property
Type
boolean
Requirement
required
Name
reason
Kind
property
Type
AlertDialogChangeReason
Requirement
required
Name
type
Kind
property
Type
string
Requirement
required
DeclarationView source
AlertDialogContextts
type AlertDialogContext = {
readonly mode: "controlled" | "uncontrolled";
};
Name
Kind
Type
Requirement
mode
property
"controlled" | "uncontrolled"
required
Name
mode
Kind
property
Type
"controlled" | "uncontrolled"
Requirement
required
DeclarationView source
AlertDialogDiagnosticCodests
export declare const AlertDialogDiagnosticCodes: readonly DiagnosticCatalogueEntry[];
DeclarationView source
AlertDialogEventts
type AlertDialogEvent = {
readonly type: "OPEN";
readonly reason: AlertDialogOpenReason;
} | {
readonly type: "CLOSE";
readonly reason: AlertDialogCloseReason;
};
DeclarationView source
AlertDialogInputts
type AlertDialogInput = {
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
alertDialogMachinets
export declare const alertDialogMachine: AlertDialogMachine;
DeclarationView source
AlertDialogMachinets
type AlertDialogMachine = Machine<AlertDialogInput, AlertDialogStateValue, AlertDialogContext, AlertDialogEvent, AlertDialogCommand>;
DeclarationView source
AlertDialogOpenReasonts
type AlertDialogOpenReason = "trigger" | "programmatic";
DeclarationView source
alertDialogReplaySequencets
export declare const alertDialogReplaySequence: readonly AlertDialogEvent[];
DeclarationView source
alertDialogSelectorsts
export declare const alertDialogSelectors: {
open: (snapshot: AlertDialogSnapshot) => boolean;
};
Name
Kind
Type
Requirement
open
property
(snapshot: AlertDialogSnapshot) => boolean
required
Name
open
Kind
property
Type
(snapshot: AlertDialogSnapshot) => boolean
Requirement
required
DeclarationView source
AlertDialogSnapshotts
type AlertDialogSnapshot = Snapshot<AlertDialogStateValue, AlertDialogContext>;
DeclarationView source
AlertDialogStateValuets
type AlertDialogStateValue = "open" | "closed";