UNPKG

@public-ui/components

Version:

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

4 lines 2.66 kB
/*! * KoliBri - The accessible HTML-Standard */ "use strict";var index=require("./index-C3uXtd6W.js"),common=require("./common-1pTy2kta.js"),hasCloser=require("./has-closer-Bpl3HJQj.js"),label=require("./label-6ELpV3zN.js"),i18n=require("./i18n-D4Klw_bZ.js"),validation=require("./validation-BNj07e2T.js"),componentNames=require("./component-names-Bu9hV7OT.js");require("./Alert-CpYj4v7g.js");var Heading=require("./Heading-CFrR8SYV.js");require("./markdown-3A2I0-h0.js");var dev_utils=require("./dev.utils-C6VGVnPR.js"),events=require("./events-Cd8febUV.js");require("./i18n-yHKQt1gl.js"),require("./tslib.es6-7DbU_BSw.js"),require("./clsx-CkZlkaek.js"),require("./bem-DQRepkGo.js"),require("./browser-XJa5sCFp.js");const KolCardWc=class{constructor(e){index.registerInstance(this,e),this.nonce=dev_utils.nonce(),this.translateClose=i18n.translate("kol-close"),this.close=()=>{var e;void 0!==(null===(e=this._on)||void 0===e?void 0:e.onClose)&&this._on.onClose(new Event("Close")),this.host&&events.dispatchDomEvent(this.host,events.KolEvent.close)},this.on={onClick:this.close},this._hasCloser=!1,this._level=0,this.state={_label:""},this.validateOnValue=e=>"object"==typeof e&&null!==e&&"function"==typeof e.onClose}render(){return index.h(index.Host,{key:"de517413c990072e7e7faca2916c0c5243ad9495"},index.h("div",{key:"01f98d52d173677f5e314e2dce9425cc19cdaadc","aria-labelledby":this.nonce,class:"kol-card",role:"group"},index.h(Heading.KolHeadingFc,{key:"d2ce693140449135323ff1601af712982aae9325",class:"kol-card__header",id:this.nonce,level:this.state._level},this.state._label),index.h("div",{key:"155c2d42406dbb9ba02f6a29ec92f10d93b8c38d",class:"kol-card__content"},index.h("slot",{key:"f3c23f1168273dbfbb515b1d83b7f087d9d019ca"})),this.state._hasCloser&&index.h(componentNames.KolButtonWcTag,{key:"f22067f09cde9099c29c8b26b0af1cb3229e0b3d",class:"kol-card__close-button kol-close-button","data-testid":"card-close-button",_hideLabel:!0,_icons:{left:{icon:"kolicon-cross"}},_label:this.translateClose,_on:this.on,_tooltipAlign:"left"})))}validateOn(e){this.validateOnValue(e)&&common.setState(this,"_on",{onClose:e.onClose})}validateHasCloser(e){hasCloser.validateHasCloser(this,e)}validateLabel(e){label.validateLabel(this,e,{required:!0})}validateLevel(e){validation.watchHeadingLevel(this,e)}componentWillLoad(){this.validateHasCloser(this._hasCloser),this.validateLabel(this._label),this.validateLevel(this._level),this.validateOn(this._on)}get host(){return index.getElement(this)}static get watchers(){return{_on:["validateOn"],_hasCloser:["validateHasCloser"],_label:["validateLabel"],_level:["validateLevel"]}}};exports.kol_card_wc=KolCardWc;