import{a as l,j as e}from"./vendor-react-Dkpvlwai.js";import{d as p}from"./index-VJPzCABl.js";import{aE as v,aF as b}from"./vendor-icons-CbmLcMl-.js";function j({error:r,label:i,className:n,id:u,showPasswordToggle:c,type:s,...t}){const m=l.useId(),a=u||m,[o,x]=l.useState(!1),f=s==="password"&&o?"text":s,d=s==="password"&&c;return e.jsxs("div",{className:"w-full",children:[i&&e.jsx("label",{htmlFor:a,className:"block text-sm font-medium text-foreground mb-1",children:i}),e.jsxs("div",{className:"relative",children:[e.jsx("input",{id:a,type:f,className:p("w-full px-4 py-2.5 border rounded-xl focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/20 transition-all duration-[var(--duration-immersive)] ease-in-out","focus-visible:shadow-[0_0_0_3px_oklch(var(--primary)/0.15),0_0_12px_oklch(var(--primary)/0.1)]","bg-card border-border text-foreground placeholder:text-muted-foreground",r?"border-destructive focus-visible:border-destructive":"focus-visible:border-primary",d?"pr-10":"",n),"aria-invalid":r?"true":"false","aria-describedby":r?`${a}-error`:void 0,"aria-required":t.required?"true":void 0,...t,autoComplete:t.autoComplete!==void 0?t.autoComplete:s==="email"?"email":s==="password"?"current-password":void 0,required:t.required}),d&&e.jsx("button",{type:"button",onClick:()=>x(!o),className:"absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground transition-opacity transition-colors duration-[var(--duration-fast)]","aria-label":o?"Hide password":"Show password",tabIndex:-1,children:o?e.jsx(v,{className:"h-4 w-4"}):e.jsx(b,{className:"h-4 w-4"})})]}),r&&e.jsx("p",{id:`${a}-error`,className:"mt-1 text-sm text-destructive animate-shake",role:"alert",children:r})]})}export{j as A};