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