import{j as o,B as O}from"./index-858224db.js";import{C as w}from"./index.esm-241dec99.js";import{F as I}from"./FormControlLabel-c742681c.js";import{C as M}from"./Checkbox-57cdf644.js";import{I as b,a as j}from"./TextField-bbb2480f.js";import{O as h}from"./Select-8b602eed.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};
