ra-core
Version:
Core components of react-admin, a frontend Framework for building admin applications on top of REST services, using ES6, React
34 lines • 1.38 kB
TypeScript
import { ReactElement, FocusEvent } from 'react';
import { ControllerFieldState, ControllerRenderProps, UseControllerProps, UseControllerReturn, UseFormStateReturn } from 'react-hook-form';
import type { EditorEvents } from '@tiptap/react';
import { Validator } from './validation';
export declare const useInput: <ValueType = any>(props: InputProps<ValueType>) => UseInputValue;
export type InputProps<ValueType = any> = Omit<UseControllerProps, 'name' | 'defaultValue' | 'rules'> & Partial<UseControllerReturn> & {
alwaysOn?: any;
defaultValue?: any;
format?: (value: ValueType) => any;
id?: string;
isRequired?: boolean;
label?: string | ReactElement | false;
helperText?: string | ReactElement | false;
name?: string;
onBlur?: (...event: any[]) => void;
onChange?: (...event: any[]) => void;
parse?: (value: any) => ValueType;
type?: string;
resource?: string;
source: string;
validate?: Validator | Validator[];
readOnly?: boolean;
disabled?: boolean;
};
export type UseInputValue = {
id: string;
isRequired: boolean;
field: Omit<ControllerRenderProps, 'onBlur'> & {
onBlur: (event?: FocusEvent<HTMLElement> | EditorEvents['blur']) => void;
};
formState: UseFormStateReturn<Record<string, string>>;
fieldState: ControllerFieldState;
};
//# sourceMappingURL=useInput.d.ts.map