UNPKG

@wordpress/components

Version:
48 lines 1.94 kB
/** * External dependencies */ import type { SyntheticEvent } from 'react'; /** * Internal dependencies */ import type { DragProps } from '../types'; export declare const CHANGE = "CHANGE"; export declare const COMMIT = "COMMIT"; export declare const CONTROL = "CONTROL"; export declare const DRAG_END = "DRAG_END"; export declare const DRAG_START = "DRAG_START"; export declare const DRAG = "DRAG"; export declare const INVALIDATE = "INVALIDATE"; export declare const PRESS_DOWN = "PRESS_DOWN"; export declare const PRESS_ENTER = "PRESS_ENTER"; export declare const PRESS_UP = "PRESS_UP"; export declare const RESET = "RESET"; interface EventPayload { event?: SyntheticEvent; } export interface Action<Type = string, ExtraPayload = {}> { type: Type; payload: EventPayload & ExtraPayload; } interface ValuePayload { value: string; } export type ChangeAction = Action<typeof CHANGE, ValuePayload>; export type CommitAction = Action<typeof COMMIT, ValuePayload>; export type ControlAction = Action<typeof CONTROL, ValuePayload>; export type PressUpAction = Action<typeof PRESS_UP>; export type PressDownAction = Action<typeof PRESS_DOWN>; export type PressEnterAction = Action<typeof PRESS_ENTER>; export type DragStartAction = Action<typeof DRAG_START, DragProps>; export type DragEndAction = Action<typeof DRAG_END, DragProps>; export type DragAction = Action<typeof DRAG, DragProps>; export type ResetAction = Action<typeof RESET, Partial<ValuePayload>>; export type InvalidateAction = Action<typeof INVALIDATE, { error: unknown; }>; export type ChangeEventAction = ChangeAction | ResetAction | CommitAction; export type DragEventAction = DragStartAction | DragEndAction | DragAction; export type KeyEventAction = PressDownAction | PressUpAction | PressEnterAction; export type InputAction = ChangeEventAction | KeyEventAction | DragEventAction | InvalidateAction; export {}; //# sourceMappingURL=actions.d.ts.map