import{r as h,j as a}from"./vendor-tanstack-BpuysabX.js";import{$ as x,p as b}from"./index-CREafGO4.js";const I=({onChange:r,value:t=[],onBlur:g,placeholder:o="Enter tags",...u}={})=>{const[e,i]=h.useState(""),d=n=>{i(n.target.value)},l=n=>{n.key==="Enter"&&e.trim()!==""?(n.preventDefault(),c(e.trim())):n.key==="Backspace"&&e===""&&t.length>0&&f(t.length-1)},p=n=>s=>{e.trim()!==""&&c(e.trim()),n?.(s)},c=n=>{if(!t.includes(n)){const s=[...t,n];i(""),r?.(s)}},f=n=>{const s=t.filter((w,m)=>m!==n);r?.(s)};return a.jsxs("div",{className:"flex items-center border rounded-md focus-within:ring-1 focus-within:ring-ring bg-card dark:bg-background",children:[a.jsx(x,{tags:t,onTagsChange:r,variant:"secondary"}),a.jsx(b,{type:"text",value:e,onChange:d,onKeyDown:l,onBlur:p(g),className:"grow border-none shadow-none focus-visible:ring-0 focus-visible:ring-offset-0",placeholder:o,"aria-label":o,...u})]})};export{I as T};
//# sourceMappingURL=tags-input-Bd-BicQ9.js.map
