UNPKG

@nish1896/rhf-mui-components

Version:

A suite of 20+ reusable Material UI components for React Hook Form to minimize your time and effort in creating and styling forms

27 lines (26 loc) 1.6 kB
import { type ReactNode, type ChangeEvent } from 'react'; import { type FieldValues, type Path, type Control, type RegisterOptions } from 'react-hook-form'; import type { FormLabelProps, FormHelperTextProps, FileInputProps, FileUploadError } from '../../types'; export type { FileUploadError }; export type RHFFileUploaderProps<T extends FieldValues> = { fieldName: Path<T>; control: Control<T>; registerOptions?: RegisterOptions<T, Path<T>>; required?: boolean; showFileSize?: boolean; hideFileList?: boolean; renderUploadButton?: (fileInput: ReactNode) => ReactNode; renderFileItem?: (file: File, index: number) => ReactNode; onValueChange?: (acceptedFiles: File | File[] | null, event: ChangeEvent<HTMLInputElement>) => void; onUploadError?: (errors: FileUploadError[], rejectedFiles: File[]) => void; label?: ReactNode; showLabelAboveFormField?: boolean; formLabelProps?: FormLabelProps; errorMessage?: ReactNode; helperText?: ReactNode; hideErrorMessage?: boolean; formHelperTextProps?: FormHelperTextProps; fullWidth?: boolean; } & FileInputProps; declare const RHFFileUploader: <T extends FieldValues>({ fieldName, control, registerOptions, accept, multiple, maxFiles, maxSize, hideFileList, showFileSize, renderUploadButton, renderFileItem, onValueChange, onUploadError, label, showLabelAboveFormField, formLabelProps, required, helperText, errorMessage, hideErrorMessage, formHelperTextProps, disabled, fullWidth }: RHFFileUploaderProps<T>) => import("react/jsx-runtime").JSX.Element; export default RHFFileUploader;