import{g as x,C as _,D as g,o as s,c as n,a as i,m as l,x as c,t as f,b as h,T as C,w as y,r as p,q as V,F as L,s as B,z,_ as E}from"./BKxwI4SA.js";const F={class:"truncate"},N={key:0,class:"absolute z-40 mt-2 max-h-64 w-full overflow-auto rounded-xl border border-surface-border bg-white p-1 shadow-soft dark:bg-slate-900"},S=["onClick"],D=x({__name:"SelectField",props:{modelValue:{},options:{},placeholder:{default:"Select option"}},emits:["update:modelValue"],setup(r,{emit:v}){const d=r,b=v,e=p(!1),u=p(null),w=V(()=>d.options.find(t=>t.value===d.modelValue)?.label||d.placeholder),k=t=>{b("update:modelValue",t),e.value=!1},m=t=>{const a=t.target;u.value?.contains(a)||(e.value=!1)};return _(()=>{window.addEventListener("click",m)}),g(()=>{window.removeEventListener("click",m)}),(t,a)=>(s(),n("div",{ref_key:"rootRef",ref:u,class:"relative"},[i("button",{type:"button",class:c(["input flex items-center justify-between gap-3 text-left",l(e)?"border-brand-500 shadow-glow":""]),onClick:a[0]||(a[0]=o=>e.value=!l(e))},[i("span",F,f(l(w)),1),(s(),n("svg",{viewBox:"0 0 20 20",class:c(["h-4 w-4 transition",l(e)?"rotate-180":""]),fill:"none",stroke:"currentColor","stroke-width":"1.8"},[...a[1]||(a[1]=[i("path",{d:"M5 7.5L10 12.5L15 7.5"},null,-1)])],2))],2),h(C,{name:"fade-slide"},{default:y(()=>[l(e)?(s(),n("ul",N,[(s(!0),n(L,null,B(r.options,o=>(s(),n("li",{key:o.value,class:c(["cursor-pointer rounded-lg px-3 py-2 text-sm transition",r.modelValue===o.value?"bg-brand-500 text-white":"text-text-primary hover:bg-brand-50 dark:hover:bg-slate-800"]),onClick:M=>k(o.value)},f(o.label),11,S))),128))])):z("",!0)]),_:1})],512))}}),T=E(D,[["__scopeId","data-v-6786f4a6"]]);export{T as _};
