DocsAPI referenceUI machinesasync-validated-input

async-validated-input machine

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

@grassroot/ui-machines/async-validated-input

Package

11 exports
View source packages/ui-machines/src/async-validated-input/index.ts

Service example

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

Exports

DeclarationView source
AsyncValidatedInputCommandts
type AsyncValidatedInputCommand = (CommandObject & {
readonly type: "VALIDATE_REQUEST";
readonly value: string;
readonly reason: AsyncValidatedInputReason;
}) | (CommandObject & {
readonly type: "VALUE_CHANGE_REQUEST";
readonly value: string;
readonly reason: AsyncValidatedInputReason;
});
DeclarationView source
AsyncValidatedInputContextts
type AsyncValidatedInputContext = {
readonly value: string;
readonly pending: boolean;
readonly status: AsyncValidatedInputStatus;
readonly mode: BindingMode;
};
Name
Kind
Type
Requirement
mode
property
BindingMode
required
pending
property
boolean
required
status
property
AsyncValidatedInputStatus
required
value
property
string
required
Name
mode
Kind
property
Type
BindingMode
Requirement
required
Name
pending
Kind
property
Type
boolean
Requirement
required
Name
status
Kind
property
Type
AsyncValidatedInputStatus
Requirement
required
Name
value
Kind
property
Type
string
Requirement
required
DeclarationView source
AsyncValidatedInputDiagnosticCodests
export declare const AsyncValidatedInputDiagnosticCodes: readonly DiagnosticCatalogueEntry[];
DeclarationView source
AsyncValidatedInputEventts
type AsyncValidatedInputEvent = {
readonly type: "SET_VALUE";
readonly value: string;
readonly reason: AsyncValidatedInputReason;
} | {
readonly type: "VALIDATE";
readonly reason: AsyncValidatedInputReason;
} | {
readonly type: "VALIDATE_SUCCEEDED";
} | {
readonly type: "VALIDATE_FAILED";
} | {
readonly type: "RESET";
};
DeclarationView source
AsyncValidatedInputInputts
type AsyncValidatedInputInput = {
readonly value?: string;
readonly defaultValue?: string;
readonly pending?: boolean;
readonly status?: AsyncValidatedInputStatus;
};
Name
Kind
Type
Requirement
defaultValue
property
string
optional
pending
property
boolean
optional
status
property
AsyncValidatedInputStatus
optional
value
property
string
optional
Name
defaultValue
Kind
property
Type
string
Requirement
optional
Name
pending
Kind
property
Type
boolean
Requirement
optional
Name
status
Kind
property
Type
AsyncValidatedInputStatus
Requirement
optional
Name
value
Kind
property
Type
string
Requirement
optional
DeclarationView source
asyncValidatedInputMachinets
export declare const asyncValidatedInputMachine: Machine<AsyncValidatedInputInput, "ready", AsyncValidatedInputContext, AsyncValidatedInputEvent, AsyncValidatedInputCommand>;
DeclarationView source
AsyncValidatedInputReasonts
type AsyncValidatedInputReason = "pointer" | "keyboard" | "programmatic";
DeclarationView source
asyncValidatedInputReplaySequencets
export declare const asyncValidatedInputReplaySequence: readonly AsyncValidatedInputEvent[];
DeclarationView source
asyncValidatedInputSelectorsts
export declare const asyncValidatedInputSelectors: {
value: (snapshot: AsyncValidatedInputSnapshot) => string;
pending: (snapshot: AsyncValidatedInputSnapshot) => boolean;
};
Name
Kind
Type
Requirement
pending
property
(snapshot: AsyncValidatedInputSnapshot) => boolean
required
value
property
(snapshot: AsyncValidatedInputSnapshot) => string
required
Name
pending
Kind
property
Type
(snapshot: AsyncValidatedInputSnapshot) => boolean
Requirement
required
Name
value
Kind
property
Type
(snapshot: AsyncValidatedInputSnapshot) => string
Requirement
required
DeclarationView source
AsyncValidatedInputSnapshotts
type AsyncValidatedInputSnapshot = Snapshot<"ready", AsyncValidatedInputContext>;
DeclarationView source
AsyncValidatedInputStatusts
type AsyncValidatedInputStatus = "idle" | "validating" | "valid" | "error";