UNPKG

@ui-machines/tags-input

Version:

Core logic for the tags-input widget implemented as a state machine

27 lines (26 loc) 998 B
import { StateMachine as S } from "@ui-machines/core"; import { PropTypes, ReactPropTypes } from "@ui-machines/types"; import { MachineContext, MachineState } from "./tags-input.types"; declare type TagProps = { index: string | number; value: string; }; export declare function connect<T extends PropTypes = ReactPropTypes>(state: S.State<MachineContext, MachineState>, send: (event: S.Event<S.AnyEventObject>) => void, normalize?: import("@ui-machines/types").NormalizeProps): { value: string[]; valueAsString: string; clear(): void; add(value: string): void; delete(id: string): void; focus(): void; blur(): void; rootProps: T["element"]; inputProps: T["input"]; hiddenInputProps: T["input"]; getTagProps({ index, value }: TagProps): T["element"]; getTagInputProps({ index }: { index: number; }): T["input"]; getTagDeleteButtonProps({ index, value }: TagProps): T["button"]; clearButtonProps: T["button"]; }; export {};