@public-ui/components
Version:
Contains all web components that belong to KoliBri - The accessible HTML-Standard.
4 lines • 2.43 kB
JavaScript
/*!
* KoliBri - The accessible HTML-Standard
*/
import{r as t,h as e,g as s}from"./index-1ed13705.js";import{i,l as a,w as l}from"./index-ebe5a881.js";import{w as r}from"./validation-152ea092.js";import{K as o}from"./Alert-112aec59.js";import{d as n,K as h}from"./events-bad0a075.js";import{v as d}from"./has-closer-798e8f4d.js";import{v}from"./label-bf9966d0.js";import"./tslib.es6-1173d062.js";import"./clsx-09a06a12.js";import"./component-names-7924d82a.js";import"./i18n-260f0fe9.js";import"./i18n-45224cc3.js";import"./bem-e4c3a2e6.js";import"./browser-f629a56a.js";import"./Heading-733c8dda.js";const c=["default","info","success","warning","error"],f=["card","msg"],m=class{constructor(e){t(this,e),this.close=()=>{var e,t;null===(t=null===(e=this._on)||void 0===e?void 0:e.onClose)||void 0===t||t.call(e,new Event("Close")),this.host&&n(this.host,h.close)},this.handleAlertTimeout=()=>{this.validateAlert(!1)},this.validateOnValue=e=>"object"==typeof e&&null!==e&&"function"==typeof e.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(e){i(this,"_alert",e)}validateHasCloser(e){d(this,e)}validateLabel(e){v(this,e)}validateLevel(e){r(this,e)}validateOn(e){this.validateOnValue(e)&&a(this,"_on",{onClose:e.onClose})}validateType(e){l(this,"_type",(e=>"string"==typeof e&&c.includes(e)),new Set(`String {${c.join(", ")}`),e)}validateVariant(e){l(this,"_variant",(e=>"string"==typeof e&&f.includes(e)),new Set(`AlertVariant {${f.join(", ")}`),e)}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};