import{Ar as e,Cr as t,Mr as n,Pr as r,Rr as i,Zt as a,_r as o,dr as s,fr as c,gr as l,hr as u,ii as d,jr as f,kr as p,mr as m,ni as h,qr as g,ri as _,rr as v,ti as y,ur as b,xr as x}from"./ChQ2IioC.js";import{a as S,i as C,n as w,o as T,r as E}from"./CO3D73wX.js";import{t as D}from"./DNoEyKBz.js";var O={class:`relative`},k=[`title`,`aria-label`,`disabled`,`aria-expanded`],A=[`onClick`],j={class:`whitespace-nowrap`},M=t({__name:`IconMenuSelect`,props:{icon:{},title:{},options:{},modelValue:{},disabled:{type:Boolean}},emits:[`update:modelValue`],setup(t,{emit:M}){let N=t,P=M,F=g(null),I=g(null),L=g(!1),{floatingStyles:R}=w(F,I,{placement:`bottom-end`,middleware:[S(8),C(),T({padding:8})],whileElementsMounted:E}),{onKeydown:z}=D({isOpen:L,triggerEl:F,menuEl:I,close:()=>{L.value=!1}});function B(e){P(`update:modelValue`,e),L.value=!1}function V(e){let t=e.target;!F.value?.contains(t)&&!I.value?.contains(t)&&(L.value=!1)}return p(()=>document.addEventListener(`click`,V)),e(()=>document.removeEventListener(`click`,V)),(e,p)=>(f(),o(`div`,O,[m(`button`,{ref_key:`reference`,ref:F,type:`button`,class:h([`flex h-9 w-9 items-center justify-center rounded-[0.625rem] border border-base-content/10 bg-base-200/80 text-base-content/70 transition-all duration-200 hover:border-primary/30 hover:bg-primary/15 hover:text-primary disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:border-base-content/10 disabled:hover:bg-base-200/80 disabled:hover:text-base-content/70`,{"border-primary/30 bg-primary/15 text-primary":y(L)}]),title:N.title,"aria-label":N.title,disabled:N.disabled,"aria-haspopup":`menu`,"aria-expanded":y(L),onClick:p[0]||=b(e=>L.value=!y(L),[`stop`])},[(f(),u(r(N.icon),{size:18}))],10,k),(f(),u(c,{to:`body`},[x(v,{"enter-active-class":`transition-opacity duration-150`,"leave-active-class":`transition-opacity duration-100`,"enter-from-class":`opacity-0`,"leave-to-class":`opacity-0`},{default:i(()=>[y(L)?(f(),o(`div`,{key:0,ref_key:`floating`,ref:I,style:_(y(R)),role:`menu`,class:`z-70 max-h-80 min-w-40 overflow-y-auto rounded-xl border border-base-content/10 bg-base-300/98 p-1.5 shadow-[0_10px_40px_rgb(0_0_0/0.3)] backdrop-blur-[12px]`,onKeydown:p[1]||=(...e)=>y(z)&&y(z)(...e)},[(f(!0),o(s,null,n(t.options,e=>(f(),o(`button`,{key:e.value,type:`button`,role:`menuitem`,class:h([`flex w-full cursor-pointer items-center justify-between gap-3 rounded-lg px-2.5 py-2 text-[0.8125rem] text-base-content transition-all duration-150 hover:bg-base-content/8`,{"bg-primary/15 text-primary":e.value===t.modelValue}]),onClick:t=>B(e.value)},[m(`span`,j,d(e.label),1),e.value===t.modelValue?(f(),u(y(a),{key:0,size:16})):l(``,!0)],10,A))),128))],36)):l(``,!0)]),_:1})]))]))}}),N=Object.assign(M,{__name:`IconMenuSelect`});export{N as t};