import{g as t,A as s,J as l,D as h,B as x,j as B,a8 as f,i as C,a6 as S,ab as D,K as m,L as _,P as v,O as R,G as $,Y as I,r as d,n as z,c as N}from"./index-DOFLUERq.js";import{c as O}from"./index-CRx3oDcD.js";import{I as V}from"./iconify-p99pbjf9.js";import{_ as A}from"./_plugin-vue_export-helper-DlAUqK2U.js";import"./index-DuPUrsw1.js";const L={class:"dropdown-wrapper"},P={class:"dropdown-options"},T={key:0,class:"group-title"},j=["title"],q=["onClick"],F={__name:"Dropdown",props:{options:{type:Array,required:!0},placement:{type:String,default:"bottom-end"}},setup(w){const r=w,e=d(!1),a=d(null),c=d(null),u=d({});O(a,()=>e.value=!1,{ignore:[c]});const g=N(()=>(r.options[0]?.group?r.options:[{group:"",items:r.options}]).map((p,n)=>({key:n,group:p.group,items:p.items})));function b(){if(!a.value||!e.value)return;const o=a.value.getBoundingClientRect();u.value={position:"fixed",top:`${o.bottom+4}px`,left:r.placement==="bottom-end"?"auto":`${o.left}px`,right:r.placement==="bottom-end"?`${window.innerWidth-o.right}px`:"auto",zIndex:1e3}}function k(){e.value=!e.value,z(()=>b())}function y(o){o&&o(),e.value=!1}return(o,p)=>(t(),s("div",L,[l("button",{ref_key:"dropdownBtnRef",ref:a,class:"dropdown-btn btn btn-xs btn-icon",onClick:f(k,["stop"])},[h(o.$slots,"default",{},()=>[x(B(V),{icon:"mdi:dots-horizontal",class:"icon-sm"})],!0)],512),(t(),C(I,{to:"body"},[S(l("div",{ref_key:"dropdownRef",ref:c,class:"dropdown-menu",style:$(u.value)},[l("div",P,[(t(!0),s(m,null,_(g.value,n=>(t(),s("div",{key:n.key,class:"groups"},[n.group?(t(),s("div",T,v(n.group),1)):R("",!0),(t(!0),s(m,null,_(n.items,i=>(t(),s("div",{class:"dropdown-option",key:i.label,title:i.tooltip},[l("button",{class:"dropdown-item",onClick:f(G=>y(i.onClick),["stop"])},v(i.label),9,q)],8,j))),128))]))),128))])],4),[[D,e.value]])]))]))}},E=A(F,[["__scopeId","data-v-0014848b"]]);export{E as default};
