"use strict";var e=require("react/jsx-runtime"),a=require("react"),n=require("react-aria"),R=require("../primitives/button.js");require("../primitives/checkbox.js"),require("../primitives/dropdown-selector.js"),require("../primitives/popover.js"),require("../primitives/radio.js"),require("../primitives/segmented-control.js"),require("../primitives/switch.js");var x=require("../primitives/text.js"),k=require("../../recipes/text-input.js"),P=require("@styled/css"),m=require("@styled/jsx"),z=require("@styled/tokens"),l=require("create-slots");const E=l.createSlot(({children:s,...o})=>e.jsx(m.Flex,{alignItems:"center",justifyContent:"center",children:a.Children.map(s,r=>{var t;return a.cloneElement(r,{...o,color:(t=r.props.color)!==null&&t!==void 0?t:z.token("colors.neutral.primary")})})})),w=l.createSlot(({children:s,...o})=>e.jsx(m.Flex,{alignItems:"center",justifyContent:"center",children:a.Children.map(s,r=>{var t;return a.isValidElement(r)?a.cloneElement(r,{...o,color:(t=r.props.color)!==null&&t!==void 0?t:z.token("colors.brand.base")}):null})})),D=l.createSlot(R.default),H=l.createSlot(x.default),A=l.createSlot(x.default),V=a.forwardRef((s,o)=>{const{label:r,disabled:t,size:c="md",alignText:v="left",attr:g,description:u,autoFocus:j,className:q="",errorMessage:h,required:d}=s,f=c==="sm"?16:20,M=a.useRef(null),N=o||M,{labelProps:O,inputProps:W,descriptionProps:G,errorMessageProps:J,isInvalid:C,validationErrors:F}=n.useTextField({...s,isDisabled:t??!1,isInvalid:!!h},N),{focusProps:K}=n.useFocusRing({autoFocus:j??!1}),{hoverProps:L}=n.useHover({isDisabled:t??!1});return l.createHost(s.children,p=>{const b=p.get(E),I=p.get(w),y=p.getProps(D),T=p.getProps(H),S=p.getProps(A),i=k.textInput({size:c,alignText:v,disabled:t,isError:C});return e.jsxs(m.VStack,{className:P.cx(i.container,q),children:[r&&e.jsxs("label",{className:i.label,...O,children:[r," ",d&&e.jsx("span",{className:P.css({color:"negative.darker"}),children:"*"})]}),e.jsxs(m.HStack,{className:i.inputContainer,children:[b&&{...b,props:{...b.props,className:i.typeIcon,width:f,height:f}},T&&e.jsx(x.default,{...T,fontColor:"text.tertiary"}),e.jsx("input",{ref:N,className:i.input,...n.mergeProps(W,K,L),...g}),S&&e.jsx(x.default,{...S,fontColor:"text.tertiary"}),I&&{...I,props:{...I.props,className:i.actionIcon,width:f,height:f}},y&&e.jsx(m.Flex,{alignItems:"center",justifyContent:"center",className:i.actionButton,children:e.jsx(R.default,{...y,variant:"text",size:c})})]}),u&&e.jsx("div",{className:i.description,...G,children:u}),C&&e.jsx(x.default,{variant:"error",...J,size:"sm",fontWeight:"normal",children:F.length>0?F.join(" "):h})]})})}),B=a.forwardRef((s,o)=>{const{disabled:r,autoFocus:t,className:c="",attr:v}=s,g=a.useRef(null),u=o||g,{inputProps:j}=n.useTextField({...s,isDisabled:r??!1},u),{focusProps:q}=n.useFocusRing({autoFocus:t??!1}),{hoverProps:h}=n.useHover({isDisabled:r??!1}),d=k.textInput({char:!0,disabled:r});return e.jsx("div",{className:P.cx(d.container,d.inputContainer,c),children:e.jsx("input",{ref:u,className:d.input,...n.mergeProps(j,q,h),size:1,...v})})}),Q=Object.assign(V,{TypeIcon:E,ActionIcon:w,ActionButton:D,Char:B,Prefix:H,Suffix:A});V.displayName="TextInput",B.displayName="TextInputChar",exports.TextInput=Q;
//# sourceMappingURL=text-input.js.map
