UNPKG

@public-ui/components

Version:

Contains all web components that belong to KoliBri - The accessible HTML-Standard.

4 lines 2.44 kB
/*! * KoliBri - The accessible HTML-Standard */ import{r as t,h as e,g as s}from"./index-136f59ac.js";import{h as i,k as a,w as l}from"./index-88dea7b1.js";import{w as r}from"./validation-66c33ff5.js";import{K as o}from"./Alert-3c98a2ff.js";import{d as n,K as h}from"./events-5886c68b.js";import{v as d}from"./has-closer-ca9bcd36.js";import{v as c}from"./label-5982d241.js";import"./tslib.es6-1173d062.js";import"./clsx-09a06a12.js";import"./component-names-799e91e2.js";import"./i18n-01abf777.js";import"./i18n-45224cc3.js";import"./bem-e4c3a2e6.js";import"./browser-f629a56a.js";import"./Heading-bb974fcc.js";const f=["default","info","success","warning","error"],v=["card","msg"],m=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&&n(this.host,h.close)},this.handleAlertTimeout=()=>{this.validateAlert(!1)},this.validateOnValue=t=>"object"==typeof t&&null!==t&&"function"==typeof t.onClose,this._alert=!1,this._hasCloser=!1,this._label=void 0,this._level=0,this._on=void 0,this._type="default",this._variant="msg",this.state={_level:0}}render(){const{_alert:t,_hasCloser:a,_label:s,_level:i,_type:l,_variant:r}=this.state,n={alert:t,hasCloser:a,label:s,level:i,type:l,variant:r,onCloserClick:this.close,onAlertTimeout:this.handleAlertTimeout};return e(o,Object.assign({key:"9038051f21b86a9c83c8ac5619e723dff5ebcbeb"},n),e("slot",{key:"cfd116176ab783db5232d9d5520f8ae890ca44db"}))}validateAlert(t){i(this,"_alert",t)}validateHasCloser(t){d(this,t)}validateLabel(t){c(this,t)}validateLevel(t){r(this,t)}validateOn(t){this.validateOnValue(t)&&a(this,"_on",{onClose:t.onClose})}validateType(t){l(this,"_type",(t=>"string"==typeof t&&f.includes(t)),new Set(`String {${f.join(", ")}`),t)}validateVariant(t){l(this,"_variant",(t=>"string"==typeof t&&v.includes(t)),new Set(`AlertVariant {${v.join(", ")}`),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 s(this)}static get watchers(){return{_alert:["validateAlert"],_hasCloser:["validateHasCloser"],_label:["validateLabel"],_level:["validateLevel"],_on:["validateOn"],_type:["validateType"],_variant:["validateVariant"]}}};export{m as kol_alert_wc};