UNPKG

@public-ui/components

Version:

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

4 lines 2.36 kB
/*! * KoliBri - The accessible HTML-Standard */ import{r as t,h as s,g as e}from"./index-CElQfBOC.js";import{w as i,d as a,s as o}from"./common-7RW_NFNf.js";import{v as l}from"./has-closer-DbTKc11W.js";import{v as r}from"./label-DAfXJvJZ.js";import{w as n}from"./validation-CcPLmr0Q.js";import{K as h}from"./Alert-BscBrOtx.js";import{d as c,K as v}from"./events-CoPFQEiC.js";import"./Heading-D6_TFw6T.js";import"./clsx-eK3rPvPS.js";import"./component-names-CkE54Ym7.js";import"./i18n-yBVLeHdv.js";import"./i18n-CjhRejiw.js";import"./bem-CwA0xXwr.js";import"./browser-D7tkBuSS.js";const d=["default","info","success","warning","error"],m=t=>"string"==typeof t&&d.includes(t),f=(t,e)=>{i(t,"_type",m,new Set(d),e)},p=["card","msg"],_=t=>"string"==typeof t&&p.includes(t),j=(t,e)=>{i(t,"_variant",_,new Set(p),e)},C=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&&c(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:i,_type:l,_variant:o}=this.state,r={alert:t,hasCloser:e,label:a,level:i,type:l,variant:o,onCloserClick:this.close,onAlertTimeout:this.handleAlertTimeout};return s(h,Object.assign({key:"2f36ca7164492eb43c7942db6e0cb0c231dc9088"},r),s("slot",{key:"626fc6293d159c137669aa44e30a7f122e64f7ef"}))}validateAlert(t){a(this,"_alert",t)}validateHasCloser(t){l(this,t)}validateLabel(t){r(this,t)}validateLevel(t){n(this,t)}validateOn(t){this.validateOnValue(t)&&o(this,"_on",{onClose:t.onClose})}validateType(t){f(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{C as kol_alert_wc};