@trimble-oss/moduswebcomponents
Version:
Modus Web Components is a modern, accessible UI library built with Stencil JS that provides reusable web components following Trimble's Modus design system. This updated version focuses on improved flexibility, enhanced theming options, comprehensive cust
1 lines • 1.78 kB
JavaScript
import{r as t,h as s,e,g as o}from"./p-C1-Dpkp7.js";import{h as a}from"./p-tWS3Egrk.js";import{i as d}from"./p-DJ2rBB6r.js";const c=class{constructor(s){t(this,s),this.inheritedAttributes={},this.customClass="",this.position="top-end",this.getClasses=()=>{const t=["modus-wc-toast"],s=(({position:t})=>{let s="";if(t)switch(t){case"top-start":s=`${s} modus-wc-toast-top modus-wc-toast-start`;break;case"top-center":s=`${s} modus-wc-toast-top modus-wc-toast-center`;break;case"top-end":s=`${s} modus-wc-toast-top modus-wc-toast-end`;break;case"middle-start":s=`${s} modus-wc-toast-start modus-wc-toast-middle`;break;case"middle-center":s=`${s} modus-wc-toast-center modus-wc-toast-middle`;break;case"middle-end":s=`${s} modus-wc-toast-end modus-wc-toast-middle`;break;case"bottom-start":s=`${s} modus-wc-toast-start`;break;case"bottom-center":s=`${s} modus-wc-toast-center`;break;case"bottom-end":s=`${s} modus-wc-toast-end`}return s.trim()})({position:this.position});return s&&t.push(s),this.customClass&&t.push(this.customClass),t.join(" ")}}componentWillLoad(){a(this.el),this.inheritedAttributes=d(this.el)}delayChanged(t){clearTimeout(this.timerId),this.timerId=setTimeout((()=>{this.dismissElement()}),t)}dismissElement(){this.el.remove()}componentDidLoad(){this.delay&&this.delay>0&&(this.timerId=setTimeout((()=>{this.dismissElement()}),this.delay))}disconnectedCallback(){clearTimeout(this.timerId)}render(){return s(e,{key:"03e451b43e87140ac51c226e6c2f84aef5fd93d0"},s("div",Object.assign({key:"dd05cac9621d35b85d176214338a21914bfd0469",class:this.getClasses()},this.inheritedAttributes),s("slot",{key:"e196d140d9f196254d195424152fa88efd471e5a"})))}get el(){return o(this)}static get watchers(){return{delay:["delayChanged"]}}};c.style="";export{c as modus_wc_toast}