import{FormControl as m,InputGroup as v}from"@chakra-ui/react";import{useEffect as C,useRef as g}from"react";import{useController as y}from"react-hook-form";import{jsx as n,jsxs as h}from"react/jsx-runtime";var R=({name:e,acceptedFileTypes:i,control:l,renderChild:p,schema:a})=>{let t=g(),{field:{ref:u,value:r,onChange:f,...c},fieldState:{invalid:o,error:F}}=y({name:e,control:l,rules:{validate:a.validateSync}}),s=p({click:()=>t.current.click(),image:r,error:o});return C(()=>{},[r]),n(m,{isInvalid:o,children:h(v,{children:[n("input",{type:"file",accept:i,name:e,ref:t,...c,inputRef:u,style:{display:"none"},onChange:d=>f(d.target.files[0])}),s]})})},E=R;export{E as default};
