import{r as c,j as s}from"./query-Bw69rE6b.js";import{c as u}from"./index-CoUu6FiM.js";function N({label:l,description:d,error:e,required:o,hint:n,className:p,children:i}){const t=c.useId(),x=`${t}-error`,m=`${t}-desc`;let r=i;if(c.isValidElement(i)){const a=i.props,j=[e?x:null,d?m:null,a["aria-describedby"]].filter(Boolean).join(" ")||void 0;r=c.cloneElement(i,{id:a.id??t,"aria-invalid":e?!0:a["aria-invalid"],"aria-describedby":j,invalid:!!e||a.invalid})}return s.jsxs("div",{className:u("flex flex-col gap-1.5",p),children:[(l||n)&&s.jsxs("div",{className:"flex items-baseline justify-between gap-2",children:[l&&s.jsxs("label",{htmlFor:t,className:"text-xs font-medium text-ink-muted",children:[l,o&&s.jsx("span",{className:"ml-0.5 text-critical","aria-hidden":"true",children:"*"})]}),n&&s.jsx("span",{className:"text-[11px] text-ink-dim",children:n})]}),r,d&&!e&&s.jsx("p",{id:m,className:"text-xs text-ink-dim",children:d}),e&&s.jsx("p",{id:x,className:"text-xs text-critical",children:e})]})}export{N as F};
