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-dzXW86AR.js";import{i as a}from"./p-B5lx0dpl.js";const d=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:"029a9751092ead67d7ccec5cc1b9d3b38bc90b24"},s("div",Object.assign({key:"fed8c85de3f93fdf34c248de2f92e1f48318d7cb",class:this.getClasses()},this.inheritedAttributes),s("slot",{key:"dd73ca36c2c5f79229fbff6a5a8f4b623d7350b5"})))}get el(){return o(this)}static get watchers(){return{delay:["delayChanged"]}}};d.style="";export{d as modus_wc_toast}