import{Ar as e,Kr as t,Lr as n,Nr as r,Or as i,Sr as a,Xt as o,br as s,dr as c,ei as l,gr as u,hr as d,jr as f,kr as p,lr as m,mr as h,ni as g,nr as _,pr as v,ri as y,ti as b,ur as x}from"./D-ctIW6J.js";import{a as S,i as C,n as w,o as T,r as E}from"./BDv5i2FV.js";import{t as D}from"./Ddp-4uT3.js";var O={class:`relative`},k=[`title`,`aria-label`,`disabled`,`aria-expanded`],A=[`onClick`],j={class:`whitespace-nowrap`},M=a({__name:`IconMenuSelect`,props:{icon:{},title:{},options:{},modelValue:{},disabled:{type:Boolean}},emits:[`update:modelValue`],setup(a,{emit:M}){let N=a,P=M,F=t(null),I=t(null),L=t(!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 i(()=>document.addEventListener(`click`,V)),p(()=>document.removeEventListener(`click`,V)),(t,i)=>(e(),u(`div`,O,[v(`button`,{ref_key:`reference`,ref:F,type:`button`,class:b([`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":l(L)}]),title:N.title,"aria-label":N.title,disabled:N.disabled,"aria-haspopup":`menu`,"aria-expanded":l(L),onClick:i[0]||=m(e=>L.value=!l(L),[`stop`])},[(e(),h(r(N.icon),{size:18}))],10,k),(e(),h(c,{to:`body`},[s(_,{"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:n(()=>[l(L)?(e(),u(`div`,{key:0,ref_key:`floating`,ref:I,style:g(l(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:i[1]||=(...e)=>l(z)&&l(z)(...e)},[(e(!0),u(x,null,f(a.options,t=>(e(),u(`button`,{key:t.value,type:`button`,role:`menuitem`,class:b([`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":t.value===a.modelValue}]),onClick:e=>B(t.value)},[v(`span`,j,y(t.label),1),t.value===a.modelValue?(e(),h(l(o),{key:0,size:16})):d(``,!0)],10,A))),128))],36)):d(``,!0)]),_:1})]))]))}}),N=Object.assign(M,{__name:`IconMenuSelect`});export{N as t};