import{Di as e,Ei as t,Fi as n,Hi as r,It as i,Ji as a,Oi as o,Si as s,Xi as c,Yi as l,Zi as u,bi as d,di as f,gi as p,hi as m,ji as h,ki as g,li as _,mi as v,pi as y,ti as b,ui as x}from"./CWa6_HoJ.js";import{a as S,i as C,n as w,o as T,r as E}from"./Be8DdZkI.js";import{t as D}from"./oGVl7Jf2.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=r(null),I=r(null),L=r(!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 t(()=>document.addEventListener(`click`,V)),e(()=>document.removeEventListener(`click`,V)),(e,t)=>(o(),p(`div`,O,[y(`button`,{ref_key:`reference`,ref:F,type:`button`,class:l([`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":a(L)}]),title:N.title,"aria-label":N.title,disabled:N.disabled,"aria-haspopup":`menu`,"aria-expanded":a(L),onClick:t[0]||=_(e=>L.value=!a(L),[`stop`])},[(o(),v(h(N.icon),{size:18}))],10,k),(o(),v(f,{to:`body`},[d(b,{"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(()=>[a(L)?(o(),p(`div`,{key:0,ref_key:`floating`,ref:I,style:c(a(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:t[1]||=(...e)=>a(z)&&a(z)(...e)},[(o(!0),p(x,null,g(s.options,e=>(o(),p(`button`,{key:e.value,type:`button`,role:`menuitem`,class:l([`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)},[y(`span`,j,u(e.label),1),e.value===s.modelValue?(o(),v(a(i),{key:0,size:16})):m(``,!0)],10,A))),128))],36)):m(``,!0)]),_:1})]))]))}}),N=Object.assign(M,{__name:`IconMenuSelect`});export{N as t};