@conform-to/react
Version:
Conform view adapter for react
46 lines • 2.82 kB
TypeScript
import { type Key, type RefCallback } from 'react';
export declare function getFormElement(formId: string): HTMLFormElement | null;
export declare function getFieldElements(form: HTMLFormElement | null, name: string): Array<HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement>;
export declare function getEventTarget(form: HTMLFormElement | null, name: string, value?: string | string[]): HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement | null;
export declare function createDummySelect(form: HTMLFormElement, name: string, value: string | string[]): HTMLSelectElement;
export declare function isDummySelect(element: HTMLElement): element is HTMLSelectElement;
export declare function getInputValue(element: HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement): string | string[] | null;
export declare function useInputEvent(onUpdate: React.Dispatch<React.SetStateAction<string | string[] | undefined>>): {
change(value: string | string[]): void;
focus(): void;
blur(): void;
register: RefCallback<HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement | undefined>;
};
export declare function useInputValue<Value extends string | string[] | Array<string | undefined>>(options: {
key?: Key | null | undefined;
initialValue?: Value | undefined;
}): readonly [(Value extends string ? Value : string | string[]) | undefined, import("react").Dispatch<import("react").SetStateAction<(Value extends string ? Value : string | string[]) | undefined>>];
export declare function useControl<Value extends string | string[] | Array<string | undefined>>(meta: {
key?: Key | null | undefined;
initialValue?: Value | undefined;
}): {
register: RefCallback<HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement | undefined>;
value: (Value extends string ? Value : string | string[]) | undefined;
change: (value: Value extends string ? Value : string | string[]) => void;
focus: () => void;
blur: () => void;
};
export declare function useInputControl<Value extends string | string[] | Array<string | undefined>>(meta: {
key?: Key | null | undefined;
name: string;
formId: string;
initialValue?: Value | undefined;
}): {
value: (Value extends string ? Value : string | string[]) | undefined;
change: import("react").Dispatch<import("react").SetStateAction<(Value extends string ? Value : string | string[]) | undefined>>;
focus: () => void;
blur: () => void;
};
export declare function Control<Value extends string | string[] | Array<string | undefined>>(props: {
meta: {
key?: Key | null | undefined;
initialValue?: Value | undefined;
};
render: (control: ReturnType<typeof useControl<Value>>) => React.ReactNode;
}): import("react").ReactNode;
//# sourceMappingURL=integrations.d.ts.map