import{Br as e,Cr as t,Ir as n,Mr as r,Nr as i,Pr as a,Qt as o,Tr as s,Yr as c,_r as l,ai as u,ar as d,fr as f,gr as p,ii as m,jr as h,mr as g,oi as _,pr as v,ri as y,vr as b,yr as x}from"./KXnyWfWg.js";import{a as S,i as C,n as w,o as T,r as E}from"./8DIyfikS.js";import{t as D}from"./CW2ZGZ_D.js";var O={class:`relative`},k=[`title`,`aria-label`,`disabled`,`aria-expanded`],A=[`onClick`],j={class:`whitespace-nowrap`},M=s({__name:`IconMenuSelect`,props:{icon:{},title:{},options:{},modelValue:{},disabled:{type:Boolean}},emits:[`update:modelValue`],setup(s,{emit:M}){let N=s,P=M,F=c(null),I=c(null),L=c(!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 h(()=>document.addEventListener(`click`,V)),r(()=>document.removeEventListener(`click`,V)),(r,c)=>(i(),x(`div`,O,[p(`button`,{ref_key:`reference`,ref:F,type:`button`,class:m([`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:c[0]||=f(e=>L.value=!y(L),[`stop`])},[(i(),l(n(N.icon),{size:18}))],10,k),(i(),l(g,{to:`body`},[t(d,{"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:e(()=>[y(L)?(i(),x(`div`,{key:0,ref_key:`floating`,ref:I,style:u(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:c[1]||=(...e)=>y(z)&&y(z)(...e)},[(i(!0),x(v,null,a(s.options,e=>(i(),x(`button`,{key:e.value,type:`button`,role:`menuitem`,class:m([`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===s.modelValue}]),onClick:t=>B(e.value)},[p(`span`,j,_(e.label),1),e.value===s.modelValue?(i(),l(y(o),{key:0,size:16})):b(``,!0)],10,A))),128))],36)):b(``,!0)]),_:1})]))]))}}),N=Object.assign(M,{__name:`IconMenuSelect`});export{N as t};