import{j as o,B as O}from"./index-952e178b.js";import{C as w}from"./index.esm-6feddb16.js";import{F as I}from"./FormControlLabel-973be654.js";import{C as M}from"./Checkbox-6c7c4dc0.js";import{I as b,a as j}from"./TextField-d1a887ff.js";import{O as h}from"./Select-41d78585.js";const L=({control:x,id:u,label:l,name:n,helperText:p,containerSx:k,minlength:g,maxlength:C,onChange:i,required:a,type:s,...d})=>o.jsx(w,{control:x,defaultValue:"",render:({field:e,fieldState:t})=>{var m,c;return o.jsxs(O,{sx:k,children:[s==="checkbox"?o.jsx(I,{control:o.jsx(M,{id:u??n,...e,required:a,checked:!!e.value,onChange:r=>{e.onChange(r.target.checked),i&&i(r)}}),label:l}):s==="number"?o.jsxs(o.Fragment,{children:[o.jsx(b,{sx:{".MuiInputLabel-asterisk":{color:"red"}},required:a,htmlFor:u??n,style:{fontWeight:"medium"},error:t.error!=null,children:l}),o.jsx(h,{id:u??n,...d,...e,type:"text",sx:r=>({width:"100%",mt:1,backgroundColor:"transparent !important","& .MuiOutlinedInput-notchedOutline":{borderColor:"rgba(0, 0, 0, 0.23) !important"},"&:hover .MuiOutlinedInput-notchedOutline":{borderColor:"#5B3959 !important"},"&.Mui-focused .MuiOutlinedInput-notchedOutline":{borderColor:"#5B3959 !important",borderWidth:"1px !important"},"& input":{fontWeight:"normal !important",backgroundColor:"transparent !important","&:-webkit-autofill, &:-webkit-autofill:hover, &:-webkit-autofill:focus, &:-webkit-autofill:active":{"-webkit-box-shadow":"0 0 0 1000px white inset !important",transition:"background-color 5000s ease-in-out 0s"}},"&.Mui-disabled":{borderColor:t.error?"red":"#e6e6e6fd","& .MuiOutlinedInput-notchedOutline":{borderColor:t.error?"red":"inherit"}}}),error:t.error!=null,inputProps:{minlength:g,maxlength:C,style:{padding:"10px 12px"},onKeyDown:r=>{!/[0-9.]/.test(r.key)&&r.key!=="Tab"&&r.key!=="Backspace"&&r.preventDefault()}},onChange:r=>{e.onChange(r.target.value),i&&i(r)}})]}):o.jsxs(o.Fragment,{children:[o.jsx(b,{sx:{".MuiInputLabel-asterisk":{color:"red"}},required:a,htmlFor:u??n,style:{fontWeight:"medium"},error:t.error!=null,children:l}),o.jsx(h,{id:u??n,...d,...e,type:s,sx:r=>({width:"100%",mt:1,backgroundColor:"transparent !important","& .MuiOutlinedInput-notchedOutline":{borderColor:"rgba(0, 0, 0, 0.23) !important"},"&:hover .MuiOutlinedInput-notchedOutline":{borderColor:"#5B3959 !important"},"&.Mui-focused .MuiOutlinedInput-notchedOutline":{borderColor:"#5B3959 !important",borderWidth:"1px !important"},"& input":{fontWeight:"normal !important",backgroundColor:"transparent !important","&:-webkit-autofill, &:-webkit-autofill:hover, &:-webkit-autofill:focus, &:-webkit-autofill:active":{"-webkit-box-shadow":"0 0 0 1000px white inset !important",transition:"background-color 5000s ease-in-out 0s"}},"&.Mui-disabled":{borderColor:t.error?"red":"#e6e6e6fd","& .MuiOutlinedInput-notchedOutline":{borderColor:t.error?"red":"inherit"}}}),error:t.error!=null,inputProps:{style:{padding:"10px 12px"}},onChange:r=>{e.onChange(r.target.value),i&&i(r)}})]}),(p||((m=t.error)==null?void 0:m.message))&&o.jsx(j,{error:t.error!=null,children:((c=t.error)==null?void 0:c.message)??p})]})},name:n});export{L as F};
