UNPKG

@kelvininc/ui-components

Version:
1 lines 2.24 kB
import{r as t,c as s,h as i,H as e,g as o}from"./p-D-JVwta2.js";import{o as a,f as r}from"./p-CJTtq_QG.js";import{d}from"./p-CSL3BQvE.js";import{a as n}from"./p-nGbDFIaH.js";import"./p-DjSNdVAB.js";import"./p-DzZLIMy0.js";import"./p-DwRzddFC.js";import"./p-DVds6a5Z.js";import"./p-CojoW2Y2.js";import"./p-SVedE_O8.js";import"./p-BcMhjKoS.js";import"./p-Do0EyoO8.js";import"./p-CBuzk8fR.js";import"./p-DHk26cGe.js";import"./p-7ioMFMb5.js";const p={placement:"bottom",middleware:[a(8),r({padding:16,fallbackPlacements:["top-end","bottom-end","top-start","bottom-start"]})]},h=class{constructor(i){t(this,i),this.openStateChange=s(this,"openStateChange",7),this.clickOutside=s(this,"clickOutside",7),this.isOpen=!1,this.options=p,this.actionElement=null,this.listElement=null,this.clickOutsideClose=!0,this.zIndex=n,this.getActionElement=()=>{var t;return null!==(t=this.actionElement)&&void 0!==t?t:this.action},this.getListElement=()=>{var t;return null!==(t=this.listElement)&&void 0!==t?t:this.portal},this.didClickOnDropdownAction=t=>{const s=this.getActionElement();return d(s,t)},this.didClickOnDropdownList=t=>{const s=this.getListElement();return d(s,t)}}checkForClickOutside(t){this.didClickOnDropdownAction(t)||this.didClickOnDropdownList(t)||(this.isOpen&&this.clickOutsideClose&&this.openStateChange.emit(!this.isOpen),this.clickOutside.emit())}disconnectedCallback(){var t;null===(t=this.portal)||void 0===t||t.remove()}render(){return i(e,{key:"0df805faac4fa5b200785e30eeb45e03b5612fd8"},i("div",{key:"6f6dac7aaa939ddf6bba101f6c303eac3a7c6be3",id:"dropdown-action",ref:t=>this.action=t},i("slot",{key:"b08f14ce5c960d7de0d16e3287a31d9268e9d2e7",name:"action"})),i("kv-portal",{key:"5cde2f3bd5ae4c571e83805032d18f57d9d6f027",animated:!0,ref:t=>this.portal=t,show:this.isOpen,reference:this.getActionElement(),options:this.options,zIndex:this.zIndex},i("div",{key:"80a3955b6d774d819189af42f7806f81ec952c04",class:"dropdown-base-list"},i("slot",{key:"836df702f17b000221222338b6bef3e1777a78a8",name:"list"}))))}get element(){return o(this)}};h.style='@property --rotation{syntax:"<angle>";initial-value:0deg;inherits:false}@keyframes rotate-border{to{--rotation:360deg}}.dropdown-base-list{width:100%}';export{h as kv_dropdown_base}