Rev 3736 | AutorÃa | Comparar con el anterior | Ultima modificación | Ver Log |
import React from 'react';import { Controller, useFormContext } from 'react-hook-form';import { FormControl, InputLabel } from '@mui/material';import { FilePicker } from '../file-picker';export function FormFilePicker({label = '',name = 'file',type = 'image',description = 'Arrastra el archivo aqui, o haga click para seleccionar',rules = {}}) {const { control } = useFormContext();return (<Controllercontrol={control}name={name}rules={rules}render={({ field: { onChange } }) => (<FormControl variant='standard' fullWidth>{label && <InputLabel shrink>{label}</InputLabel>}<FilePickertype={type}description={description}onChange={(files) => {onChange(files[0]);}}/></FormControl>)}/>);}