import{j as e}from"./jsx-runtime-C35QZyMw.js";import{F as p}from"./index.es-B9AeAEQu.js";import{c as t}from"./index-DzGUYBzK.js";import{r as N}from"./chunk-LFPYN7LY-BBzdRvLF.js";import{R as w}from"./r_error_alert-D98_m9co.js";import{R as y}from"./index-C1HDAmvx.js";import{R as E}from"./index-GTZDPbkC.js";import{W as g}from"./field-CM87aVBf.js";function C({inputRef:u,type:b="text",label:h,labelHidden:f,leadingText:n,leadingIcon:s,trailingIcon:o,trailingText:d,children:c,hintHidden:j,errors:a,hintId:i,errorId:l,id:r,inputClassName:k,placeholder:v,...m}){const R=N.useId();r||(r=R),i||(i=`${r}-hint`),l||(l=`${r}-error`);const z=[i,l].join(" "),x=!!m["aria-invalid"]||!!(a!=null&&a.length);return e.jsxs(g,{children:[e.jsx(E,{htmlFor:r,labelHidden:f,hasError:x,children:h}),e.jsxs("div",{className:t(k,"relative mb-2 flex rounded-md shadow-xs"),children:[n?e.jsx("span",{className:t("inline-flex items-center rounded-l-md border border-r-0 border-neutral-300 dark:border-zinc-600 bg-neutral-50 dark:bg-zinc-800 px-3 text-neutral-500 sm:text-sm dark:text-neutral-300",s?"pl-9":""),children:n}):null,s?e.jsx("div",{className:"pointer-events-none absolute inset-y-0 left-0 flex items-center pl-3",children:e.jsx(p,{className:"text-neutral-500",icon:s})}):null,e.jsx("input",{type:b,id:r,ref:u,className:t("relative block w-full appearance-none rounded-lg px-[calc(--spacing(3.5)-1px)] py-[calc(--spacing(2.5)-1px)] sm:px-[calc(--spacing(3)-1px)] sm:py-[calc(--spacing(1.5)-1px)]","text-base/6 text-zinc-950 placeholder:text-zinc-500 sm:text-sm/6 dark:text-white","border",x?"border-red-500 dark:border-red-400":"border-zinc-950/10 enabled:hover:border-zinc-950/20 dark:border-white/10 dark:hover:border-white/20","bg-transparent dark:bg-white/5","focus:outline-hidden",s&&!n&&"pl-10",n?"rounded-none rounded-r-md":"rounded-md",d||o?"rounded-r-none":""),...m,"aria-describedby":z,placeholder:v}),d?e.jsx("span",{className:t("inline-flex items-center rounded-r-md border border-l-0 border-neutral-300 dark:border-zinc-600 bg-neutral-50 dark:bg-zinc-800 px-3 text-neutral-500 sm:text-sm dark:text-neutral-300"),children:d}):null,o?e.jsx("div",{className:"pointer-events-none absolute inset-y-0 right-0 flex items-center pr-3",children:e.jsx(p,{icon:o})}):null]}),c?e.jsx(y,{className:t(j&&"sr-only"),children:c}):null,e.jsx(w,{id:l,errors:a})]})}export{C as R};