UNPKG

@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.73 kB
import{r as t,h as s,H as e,g as o}from"./p-D_4hbGjA.js";import{i as a}from"./p-BLBSdonk.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(){this.inheritedAttributes=a(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:"b18c8300437189599f74b74163db345cb4352edf"},s("div",Object.assign({key:"662886a31d8a1a0f5ebc59a39ae92af6318024f4",class:this.getClasses()},this.inheritedAttributes),s("slot",{key:"d455abc8a91cba5c4882463c8b227a27ebba9ec3"})))}get el(){return o(this)}static get watchers(){return{delay:["delayChanged"]}}};c.style="";export{c as modus_wc_toast}