DocsAPI referenceUI machinessheet

sheet machine

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

@grassroot/ui-machines/sheet

Package

15 exports
View source packages/ui-machines/src/sheet/index.ts

Service example

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

Exports

DeclarationView source
SheetChangeReasonts
type SheetChangeReason = SheetOpenReason | SheetCloseReason;
DeclarationView source
SheetCloseReasonts
type SheetCloseReason = "escape" | "outside-click" | "close-trigger" | "programmatic";
DeclarationView source
SheetCommandts
type SheetCommand = CommandObject & {
readonly type: "OPEN_CHANGE_REQUEST";
readonly open: boolean;
readonly reason: SheetChangeReason;
};
Name
Kind
Type
Requirement
open
property
boolean
required
reason
property
SheetChangeReason
required
type
property
string
required
Name
open
Kind
property
Type
boolean
Requirement
required
Name
reason
Kind
property
Type
SheetChangeReason
Requirement
required
Name
type
Kind
property
Type
string
Requirement
required
DeclarationView source
SheetContextts
type SheetContext = {
readonly mode: "controlled" | "uncontrolled";
};
Name
Kind
Type
Requirement
mode
property
"controlled" | "uncontrolled"
required
Name
mode
Kind
property
Type
"controlled" | "uncontrolled"
Requirement
required
DeclarationView source
SheetDiagnosticCodests
export declare const SheetDiagnosticCodes: readonly DiagnosticCatalogueEntry[];

SheetEvent

type
DeclarationView source
SheetEventts
type SheetEvent = {
readonly type: "OPEN";
readonly reason: SheetOpenReason;
} | {
readonly type: "CLOSE";
readonly reason: SheetCloseReason;
};

SheetInput

type
DeclarationView source
SheetInputts
type SheetInput = {
readonly open?: boolean;
readonly defaultOpen?: boolean;
readonly dismissable?: boolean;
readonly side?: SheetSide;
};
Name
Kind
Type
Requirement
defaultOpen
property
boolean
optional
dismissable
property
boolean
optional
open
property
boolean
optional
side
property
SheetSide
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
Name
side
Kind
property
Type
SheetSide
Requirement
optional

sheetMachine

value
DeclarationView source
sheetMachinets
export declare const sheetMachine: SheetMachine;
DeclarationView source
SheetMachinets
type SheetMachine = Machine<SheetInput, SheetStateValue, SheetContext, SheetEvent, SheetCommand>;
DeclarationView source
SheetOpenReasonts
type SheetOpenReason = "trigger" | "programmatic";
DeclarationView source
sheetReplaySequencets
export declare const sheetReplaySequence: readonly SheetEvent[];
DeclarationView source
sheetSelectorsts
export declare const sheetSelectors: {
open: (snapshot: SheetSnapshot) => boolean;
};
Name
Kind
Type
Requirement
open
property
(snapshot: SheetSnapshot) => boolean
required
Name
open
Kind
property
Type
(snapshot: SheetSnapshot) => boolean
Requirement
required

SheetSide

type
DeclarationView source
SheetSidets
type SheetSide = "left" | "right" | "bottom" | "top";
DeclarationView source
SheetSnapshotts
type SheetSnapshot = Snapshot<SheetStateValue, SheetContext>;
DeclarationView source
SheetStateValuets
type SheetStateValue = "open" | "closed";