import { ButtonStyle, InputStyle, TagProps, TagStyle } from "@team-devmonster/react-tags"; import { FocusEventHandler, KeyboardEventHandler, SyntheticEvent } from "react"; import { Control, FieldErrorsImpl, Path } from "react-hook-form"; export interface InputRuleProps { required?: boolean | string | { value: boolean; message: string; }; maxLength?: number | { value: number; message: string; }; minLength?: { value: number; message: string; }; max?: number | string | { value: number; message: string; }; min?: number | string | { value: number; message: string; }; pattern?: { value: RegExp; message: string; }; validate?: Function | Object; valueAsNumber?: boolean; valueAsDate?: boolean; setValueAs?: (value: any) => any; disabled?: boolean; onChange?: (e: SyntheticEvent) => void; onBlur?: (e: SyntheticEvent) => void; value?: any; shouldUnregister?: boolean; deps?: string | string[]; } export interface FormValues { [name: string]: any; } export interface InputProps extends InputRuleProps { control: Control; name: Path; placeholder?: string; style?: InputStyle; disabledStyle?: InputStyle; errorStyle?: InputStyle; type?: InputType; returnKeyType?: ReturnKeyType; onKeyDown?: KeyboardEventHandler; onKeyUp?: KeyboardEventHandler; onEnter?: KeyboardEventHandler; onFocus?: FocusEventHandler; onClick?: ((event: any) => void) | null | undefined; onChange?: (v: any) => void; keyboardType?: InputKeyboardType; cameraText?: string; albumText?: string; confirmText?: string; cancelText?: string; cameraButtonStyle?: ButtonStyle; albumButtonStyle?: ButtonStyle; confirmButtonStyle?: ButtonStyle; cancelButtonStyle?: ButtonStyle; checkedStyle?: InputStyle; accept?: string; multiple?: boolean; } export type InputType = 'text' | 'email' | 'url' | 'number' | 'tel' | 'password' | 'checkbox' | 'radio' | 'file' | 'hidden' | 'color' | 'price' | InputDateType; export type InputDateType = 'date' | 'time' | 'month' | 'datetime-local'; export type ReturnKeyType = "done" | "go" | "next" | "search" | "send"; export type InputKeyboardType = 'default' | 'email-address' | 'number-pad' | 'numeric' | 'decimal-pad' | 'phone-pad' | 'url'; export interface LabelProps extends TagProps { errors?: Partial>; disabled?: boolean; name?: Path; style?: TagStyle; disabledStyle?: TagStyle; errorStyle?: TagStyle; } export interface OptionProps { value: any; disabled?: boolean; children: string; } export type Options = JSX.Element | JSX.Element[] | null | undefined; export interface SelectProps extends Omit, 'type' | 'cameraButtonStyle' | 'albumButtonStyle'> { children?: Options | Options[]; }