// form import { useFormContext, Controller } from 'react-hook-form'; // @mui import { FormHelperText } from '@mui/material'; // type import { UploadAvatar, UploadMultiFile, UploadSingleFile, UploadProps, UploadMultiFileProps, } from '../upload'; // ---------------------------------------------------------------------- interface Props extends Omit { name: string; } export function RHFUploadAvatar({ name, ...other }: Props) { const { control } = useFormContext(); return ( { const checkError = !!error && !field.value; return (
{checkError && ( {error.message} )}
); }} /> ); } // ---------------------------------------------------------------------- export function RHFUploadSingleFile({ name, ...other }: Props) { const { control } = useFormContext(); return ( { const checkError = !!error && !field.value; return ( {error.message} ) } {...other} /> ); }} /> ); } // ---------------------------------------------------------------------- interface RHFUploadMultiFileProps extends Omit { name: string; } export function RHFUploadMultiFile({ name, ...other }: RHFUploadMultiFileProps) { const { control } = useFormContext(); return ( { const checkError = !!error && field.value?.length === 0; return ( {error?.message} ) } {...other} /> ); }} /> ); }