import{x as k,h as r,g,O as y,d as S,a2 as $,o as m,c as v,k as u,H as a,w as n,r as h,n as N,l as _,N as D,e as T,T as B,a as I,t as R,p as V,m as z,_ as F}from"./framework.3f630664.js";import{o as H}from"./index.b15c605d.js";import{_ as M}from"./FwbButton.vue_vue_type_script_setup_true_lang.47b4329e.js";import{_ as w}from"./FwbSlotListener.vue_vue_type_script_lang.85726df2.js";import{c as O}from"./FwbRange.vue_vue_type_style_index_0_scoped_fadec9c5_lang.66ff4c69.js";const P="absolute z-10 bg-white divide-y divide-gray-100 rounded shadow dark:bg-gray-700",l=8,j={bottom:"",left:"top-0",right:"top-0",top:""},E={bottom(e){return`bottom: -${e.height+l}px;`},left(e){return`left: -${e.width+l}px;`},right(e){return`right: -${e.width+l}px;`},top(e){return`top: -${e.height+l}px;`}};function G(e){k(e.visible,o=>{o&&y(()=>c())});const t=r(""),c=()=>{var s;const o=(s=e.contentRef.value)==null?void 0:s.getBoundingClientRect();if(!o){t.value="";return}t.value=E[e.placement.value](o)};return{contentClasses:g(()=>O(P,j[e.placement.value])),contentStyles:t}}const q=e=>(V("data-v-e40b6242"),e=e(),z(),e),A={class:"inline-flex items-center"},J=q(()=>u("svg",{class:"w-4 h-4 ml-2",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},[u("path",{d:"M19 9l-7 7-7-7","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"})],-1)),K=S({__name:"FwbDropdown",props:{placement:{default:"bottom"},text:{default:""},transition:{default:""}},setup(e){const t=r(!1),c=()=>t.value=!1,d=()=>t.value=!t.value,o=e,s={bottom:"to-bottom",left:"to-left",right:"to-right",top:"to-top"},C=g(()=>o.transition===null?s[o.placement]:o.transition),p=r(),f=r(),{contentClasses:b,contentStyles:x}=G({placement:$(o,"placement"),visible:t,contentRef:p});return H(f,()=>{t.value&&(t.value=!1)}),(i,L)=>(m(),v("div",{ref_key:"wrapper",ref:f,class:"inline-flex relative"},[u("div",A,[a(w,{onClick:d},{default:n(()=>[h(i.$slots,"trigger",{},()=>[a(M,null,{suffix:n(()=>[J]),default:n(()=>[I(R(i.text)+" ",1)]),_:1})],!0)]),_:3})]),a(B,{name:C.value},{default:n(()=>[t.value?(m(),v("div",{key:0,ref_key:"content",ref:p,class:N([_(b)]),style:D(_(x))},[a(w,{onClick:c},{default:n(()=>[h(i.$slots,"default",{},void 0,!0)]),_:3})],6)):T("",!0)]),_:3},8,["name"])],512))}}),Z=F(K,[["__scopeId","data-v-e40b6242"]]);export{Z as F};
