@public-ui/components
Version:
Contains all web components that belong to KoliBri - The accessible HTML-Standard.
4 lines • 2.39 kB
JavaScript
/*!
* KoliBri - The accessible HTML-Standard
*/
import{r as t,h as s,g as e}from"./index-DyUiyxj3.js";import{K as i}from"./Alert-w-XRy_I0.js";import{w as a,d as o,s as l}from"./common-BXXICkFX.js";import{v as r}from"./has-closer-OxGfsISj.js";import{v as n}from"./label-Dkj9sxQK.js";import{d as h,K as v}from"./events-DHTi_wtD.js";import{w as d}from"./validation-D0gTVdAQ.js";import"./tslib.es6-CxX45GIN.js";import"./clsx-eK3rPvPS.js";import"./component-names-B_kYyA8u.js";import"./i18n-CvQhdUrE.js";import"./i18n-B0tfVPMa.js";import"./bem-De7JANRY.js";import"./browser-DaourpHc.js";import"./Heading-C1x8c7QT.js";const c=["default","info","success","warning","error"],m=t=>"string"==typeof t&&c.includes(t),p=(t,e)=>{a(t,"_type",m,new Set(c),e)},f=["card","msg"],_=t=>"string"==typeof t&&f.includes(t),j=(t,e)=>{a(t,"_variant",_,new Set(f),e)},b=class{constructor(e){t(this,e),this.close=()=>{var t,e;null===(e=null===(t=this._on)||void 0===t?void 0:t.onClose)||void 0===e||e.call(t,new Event("Close")),this.host&&h(this.host,v.close)},this.handleAlertTimeout=()=>{this.validateAlert(!1)},this._alert=!1,this._hasCloser=!1,this._level=0,this._type="default",this._variant="msg",this.state={_level:0},this.validateOnValue=t=>"object"==typeof t&&null!==t&&"function"==typeof t.onClose}render(){const{_alert:t,_hasCloser:e,_label:a,_level:l,_type:o,_variant:r}=this.state,n={alert:t,hasCloser:e,label:a,level:l,type:o,variant:r,onCloserClick:this.close,onAlertTimeout:this.handleAlertTimeout};return s(i,Object.assign({key:"5db3514131f644ab76a9bddc438cdf0af412e6e8"},n),s("slot",{key:"61ef793542ae680a090596e44fcb98b9f4e55708"}))}validateAlert(t){o(this,"_alert",t)}validateHasCloser(t){r(this,t)}validateLabel(t){n(this,t)}validateLevel(t){d(this,t)}validateOn(t){this.validateOnValue(t)&&l(this,"_on",{onClose:t.onClose})}validateType(t){p(this,t)}validateVariant(t){j(this,t)}componentWillLoad(){this.validateAlert(this._alert),this.validateHasCloser(this._hasCloser),this.validateLabel(this._label),this.validateLevel(this._level),this.validateOn(this._on),this.validateType(this._type),this.validateVariant(this._variant)}get host(){return e(this)}static get watchers(){return{_alert:["validateAlert"],_hasCloser:["validateHasCloser"],_label:["validateLabel"],_level:["validateLevel"],_on:["validateOn"],_type:["validateType"],_variant:["validateVariant"]}}};export{b as kol_alert_wc};