@kelvininc/ui-components
Version:
Kelvin UI Components
1 lines • 2.38 kB
JavaScript
import{r as t,c as e,h as i,H as s,g as a}from"./p-WTwLUJcM.js";import{a as o}from"./p-CJTtq_QG.js";import{a as r}from"./p-DCOsOAOy.js";import{d as n}from"./p-BzJpag4J.js";import{T as p}from"./p-B4OowdnI.js";import{m as d}from"./p-Z0C9-DU6.js";import{i as c}from"./p-GpUjqmUL.js";import"./p-COrzvkrr.js";import"./p-DjSNdVAB.js";import"./p-BL_6ssnk.js";import"./p-CK4jS9_E.js";import"./p-Dkd2PDJ-.js";import"./p-DavHqO6y.js";const h={strategy:"fixed"},l={padding:5},f=class{constructor(i){t(this,i),this.openStateChange=e(this,"openStateChange",7),this.options=h,this.isOpen=!1,this.isFixed=!1,this.withArrow=!1,this.disabled=!1,this.customClass="",this.getOptions=()=>{const t=c(this.allowedPositions)?this.position:void 0,e=[];return!c(this.allowedPositions)&&c(t)&&e.push(o(Object.assign(Object.assign({},l),{allowedPlacements:this.allowedPositions}))),d({placement:t,middleware:e},this.options)},this.onButtonClick=()=>{this.disabled||(this.isOpen=!this.isOpen,this.openStateChange.emit(this.isOpen))}}checkForClickOutside(t){if(!this.isFixed){if(n(this.portal,t)||n(this.openElement,t))return;this.isOpen&&(this.isOpen=!1,this.openStateChange.emit(!1))}}disconnectedCallback(){this.portal.remove()}render(){return i(s,{key:"d21c9a4f083cd9b24b327f6ddd79e54a509ddfaa"},i("div",{key:"ae22ad1af1bb99534dc0008862259564a091cb5c",ref:t=>this.openElement=t,onClick:this.onButtonClick,class:"toggle-tip-open-element-container"},i("slot",{key:"aed47673a0867fc484fb955c8abaa35712081725",name:"open-element-slot"})),i("kv-portal",{key:"832174f0a296cafadc90a8505d513357dcbaf5df",zIndex:p,ref:t=>this.portal=t,withArrow:this.withArrow,animated:!0,show:this.isOpen,reference:this.openElement,options:this.getOptions()},i("kv-tooltip-text",{key:"f2a6895e0b3ec8a3413f0302cfaba537ec0c8a26",class:Object.assign({"toggle-tip-container":!0},r(this.customClass)),text:this.text},i("div",{key:"8f66451e6f0df808d941b3726f9e91cea009801b"},i("slot",{key:"07da6324217c837885abb25d5d9bb7672b156dbf",name:"content-slot"})))))}get el(){return a(this)}};f.style='@property --rotation{syntax:"<angle>";initial-value:0deg;inherits:false}@keyframes rotate-border{to{--rotation:360deg}}kv-dropdown-base:not(.hydrated)>[slot=list]{display:none}.toggle-tip-open-element-container{width:fit-content;height:fit-content}.toggle-tip-container::part(tooltip-container){padding:var(--spacing-xl)}';export{f as kv_toggle_tip}