import{B as h,L as b,c as u,r as w,a as p,o as i,f as r,i as d,b as x,G as l,C as g,e as y,n as f,E as C,y as S,d as _,p as $}from"./app-DtilF0jd.js";const E={class:"relative"},z={__name:"Dropdown",props:{align:{type:String,default:"right"},width:{type:String,default:"48"},contentClasses:{type:String,default:"py-1 bg-white dark:bg-gray-800"}},setup(t,{expose:a}){const s=t,c=n=>{e.value&&n.key==="Escape"&&(e.value=!1)};h(()=>document.addEventListener("keydown",c)),b(()=>document.removeEventListener("keydown",c));const v=u(()=>({48:"w-48"})[s.width.toString()]),k=u(()=>s.align==="left"?"ltr:origin-top-left rtl:origin-top-right start-0":s.align==="right"?"ltr:origin-top-right rtl:origin-top-left end-0":"origin-top"),e=w(!1);return a({close:()=>{e.value=!1}}),(n,o)=>(i(),p("div",E,[r("div",{onClick:o[0]||(o[0]=m=>e.value=!e.value)},[l(n.$slots,"trigger")]),d(r("div",{class:"fixed inset-0 z-40",onClick:o[1]||(o[1]=m=>e.value=!1)},null,512),[[g,e.value]]),x(C,{"enter-active-class":"transition ease-out duration-200","enter-from-class":"opacity-0 scale-95","enter-to-class":"opacity-100 scale-100","leave-active-class":"transition ease-in duration-75","leave-from-class":"opacity-100 scale-100","leave-to-class":"opacity-0 scale-95"},{default:y(()=>[d(r("div",{class:f(["absolute z-50 mt-2 rounded-md shadow-lg",[v.value,k.value]])},[r("div",{class:f(["rounded-md ring-1 ring-black ring-opacity-5 dark:ring-gray-700",t.contentClasses])},[l(n.$slots,"content")],2)],2),[[g,e.value]])]),_:3})]))}},B={key:0,type:"submit",class:"block w-full px-4 py-2 text-start text-sm leading-5 text-gray-700 dark:text-gray-300 transition duration-150 ease-in-out hover:bg-gray-100 dark:hover:bg-gray-700 focus:bg-gray-100 dark:focus:bg-gray-700 focus:outline-none"},N={__name:"DropdownLink",props:{href:{type:String,default:null},as:{type:String,default:"link"}},setup(t){return(a,s)=>t.as==="button"?(i(),p("button",B,[l(a.$slots,"default")])):(i(),S(_($),{key:1,href:t.href,class:"block w-full px-4 py-2 text-start text-sm leading-5 text-gray-700 dark:text-gray-300 transition duration-150 ease-in-out hover:bg-gray-100 dark:hover:bg-gray-700 focus:bg-gray-100 dark:focus:bg-gray-700 focus:outline-none"},{default:y(()=>[l(a.$slots,"default")]),_:3},8,["href"]))}};export{N as _,z as a};
