import{r as t,h as o,H as i,g as s}from"./p-40eb06b7.js";import{c as e}from"./p-5b78f53d.js";import{c as n}from"./p-68a5aaff.js";const a={placement:"auto",modifiers:[{name:"offset",options:{offset:[0,0]}}]},d=class{constructor(o){t(this,o),this.show=!1,this.align="bottom",this.hover=!1,this.syncWidth=!1}onAlignWatch(){this.updatePopper()}componentDidLoad(){this.container=this.el.querySelector(".dropdown-container"),this.updatePopper(),this.el.addEventListener("mouseenter",(()=>{this.hover&&(this.show=!0)})),this.el.addEventListener("mouseleave",(()=>{this.hover&&(this.show=!1)}))}disconectedCallback(){this.popper&&this.popper.destroy()}updatePopper(){this.popper=n(this.el,this.container,Object.assign(Object.assign({},a),{placement:this.align})),this.syncWidth?(this.container.style.maxWidth=`${this.el.offsetWidth}px`,this.container.style.width="100%"):(this.container.style.maxWidth="auto",this.container.style.width="auto")}async display(t){this.show=t}render(){return o(i,{key:"ecfd7bf191d9fe90c4157e6c05bb4074fb33fc57"},o("slot",{key:"5a720b6b5f9dd78c76945dbbaa148dc19bf1e0fc"}),o("div",{key:"b5205981b09d40a758f83354e82f815d74afa939",class:e("dropdown-container",{"dropdown-show":this.show,"dropdown-hover":this.hover})},o("slot",{key:"6ab7f3925d9f4a2b6eadc999f7b23254282f2365",name:"dropdown"})))}get el(){return s(this)}static get watchers(){return{align:["onAlignWatch"],show:["onAlignWatch"]}}};d.style="x-dropdown{display:inherit;text-align:inherit}x-dropdown .dropdown-container{position:absolute;z-index:10000}x-dropdown .dropdown-container.dropdown-show{left:initial;-webkit-animation:0.4s fadeIn;animation:0.4s fadeIn}";export{d as x_dropdown}