import b from"react";import{createMultiStyleConfigHelpers as g,defineStyle as y,FormControl as S,Input as C,InputGroup as h,Text as t}from"@chakra-ui/react";import{inputAnatomy as x}from"@chakra-ui/anatomy";import{jsx as o,jsxs as u}from"react/jsx-runtime";var w=b.forwardRef(({label:r,error:n,placeholder:l,helperText:d,isInvalid:e,as:c=C,InputLeftAddon:p,InputRightAddon:m,...i},a)=>{let{disabled:f}=i;return u(S,{isInvalid:e,opacity:f?.4:1,children:[r&&o(t,{color:e?"destructive":"foreground",fontWeight:"medium",fontSize:"sm",lineHeight:1,children:r}),u(h,{mt:"2",children:[p,o(c,{variant:"",placeholder:l,...i,ref:a}),m]}),d&&o(t,{fontSize:"xs",mt:2,color:"mutedForeground",children:d}),e&&n&&o(t,{fontSize:"xs",mt:2,color:"destructive",children:n})]})}),{definePartsStyle:s,defineMultiStyleConfig:I}=g(x.keys),k=s({field:{color:"foreground",background:"background",boxShadow:"base",borderWidth:"1px",borderStyle:"solid",borderColor:"input",borderRadius:"lg",_focusVisible:{borderColor:"ring"},_hover:{},_disabled:{opacity:1},_placeholder:{color:"mutedForeground"}}}),z=y({borderRadius:"md"}),F={sm:s({field:z})},G=I({baseStyle:k,sizes:F});export{w as Input,G as InputTheme};
