@public-ui/components
Version:
Contains all web components that belong to KoliBri - The accessible HTML-Standard.
4 lines • 2.65 kB
JavaScript
/*!
* KoliBri - The accessible HTML-Standard
*/
"use strict";var index=require("./index-C4Loo2IH.js"),common=require("./common-Cd2qH809.js"),hasCloser=require("./has-closer-COtNvUI4.js"),label=require("./label-Nicf9N_T.js"),i18n=require("./i18n-DNWGj4j8.js"),validation=require("./validation-DsxRnVmU.js"),componentNames=require("./component-names-CuI-0Pbo.js");require("./Alert-yK5O3Czw.js");var Heading=require("./Heading-CqQULYGY.js");require("./markdown-1dxeA2q6.js");var dev_utils=require("./dev.utils-L6CxXgBo.js"),events=require("./events-cX8h6I3p.js");require("./i18n-BnIFsVIa.js"),require("./tslib.es6-7DbU_BSw.js"),require("./clsx-CkZlkaek.js"),require("./bem-Bu0VYjZa.js"),require("./browser-D7A31aEp.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:"31a21a7dd16b81042127406bc4cd091f16f230d4"},index.h("div",{key:"22001ed9c1f73d9b6445b0b6e36109c9cc8ef608","aria-labelledby":this.nonce,class:"kol-card",role:"group"},index.h(Heading.KolHeadingFc,{key:"5b6760cafee75437ba6ef208d35e05e96ec3f76a",class:"kol-card__header",id:this.nonce,level:this.state._level},this.state._label),index.h("div",{key:"9b780b199200df0ce78ad4f3d2f1ad746f838a8e",class:"kol-card__content"},index.h("slot",{key:"cdf53c951f6980b6827db3bf37ea7ad216037c69"})),this.state._hasCloser&&index.h(componentNames.KolButtonWcTag,{key:"a228fd3f5ace0033ae7eb47b98c6b4d18fcb3ff5",class:"kol-card__close-button","data-testid":"card-close-button",_hideLabel:!0,_icons:{left:{icon:"codicon codicon-close"}},_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;