import type { BoxProps } from '@mui/material/Box'; import { Controller, useFormContext } from 'react-hook-form'; import Box from '@mui/material/Box'; import { HelperText } from './help-text'; import { UploadAvatar } from '../upload'; import type { UploadProps } from '../upload'; // ---------------------------------------------------------------------- export type RHFUploadProps = UploadProps & { name: string; slotProps?: { wrapper?: BoxProps; }; }; export function RHFUploadAvatar({ name, slotProps, ...other }: RHFUploadProps) { const { control, setValue } = useFormContext(); return ( { const onDrop = (acceptedFiles: File[]) => { const value = acceptedFiles[0]; setValue(name, value, { shouldValidate: true }); }; return ( ); }} /> ); }