@public-ui/components
Version:
Contains all web components that belong to KoliBri - The accessible HTML-Standard.
95 lines (91 loc) • 3.85 kB
JavaScript
/*!
* KoliBri - The accessible HTML-Standard
*/
'use strict';
var index = require('./index-BrhW8s5h.js');
var common = require('./common-DPb6NWR4.js');
var hasCloser = require('./has-closer-DdfOvOk6.js');
var label = require('./label-8vcJJEVI.js');
var i18n = require('./i18n-Cjy0vgJA.js');
var validation = require('./validation-4QVpAFd9.js');
var componentNames = require('./component-names-5KS_pYRF.js');
require('./Alert-C5eDyNdi.js');
var dev_utils = require('./dev.utils-BeTuwcHU.js');
var Heading = require('./Heading-Zb8_ekSw.js');
require('./variant-quote-DpNzmCtr.js');
require('./component-BUJSMbIY.js');
var events = require('./events-Jc2wxPjR.js');
require('./i18n-CgUN6lev.js');
require('./level-DmIt1w-r.js');
require('./normalizers-BCLslVaT.js');
require('./_Uint8Array-BAQUGozM.js');
require('./isArray-BOIOdEQh.js');
require('./tslib.es6-Cm0ytgPY.js');
require('./clsx-Bm_HQUnh.js');
require('./bem-registry-DevvgGUu.js');
require('./component-CuHGwo27.js');
const KolCardWc = class {
constructor(hostRef) {
index.registerInstance(this, hostRef);
this.translateClose = i18n.translate('kol-close');
this.close = () => {
var _a;
if (((_a = this._on) === null || _a === void 0 ? void 0 : _a.onClose) !== undefined) {
this._on.onClose(new Event('Close'));
}
if (this.host) {
events.dispatchDomEvent(this.host, events.KolEvent.close);
}
};
this.on = {
onClick: this.close,
};
this._hasCloser = false;
this._headingId = dev_utils.createUniqueId('card-heading');
this._level = 0;
this.state = {
_label: '',
};
this.validateOnValue = (value) => typeof value === 'object' && value !== null && typeof value.onClose === 'function';
}
render() {
return (index.h(index.Host, { key: '909cc395209bdb2eba2f674f5fe9f4b8750fccef' }, index.h("article", { key: '8bbd3d853a4ea8bc6f83dedf245414e8d9421461', "aria-labelledby": this._headingId, class: "kol-card" }, index.h(Heading.KolHeadingFc, { key: '2609f6812d8d909de20b00162cb119b32c0d7f23', class: "kol-card__header", id: this._headingId, level: this.state._level }, this.state._label), index.h("div", { key: 'a953cb61794cf76980111256849685184cc5dcf9', class: "kol-card__content" }, index.h("slot", { key: '31d86a46cb4e9d9cee62692aeea43f08db236ccb' })), this.state._hasCloser && (index.h(componentNames.KolButtonWcTag, { key: '763993312892b16856634e6d0d10de5cb1454629', class: "kol-card__close-button kol-close-button", "data-testid": "card-close-button", _hideLabel: true, _icons: {
left: {
icon: 'kolicon-cross',
},
}, _label: this.translateClose, _on: this.on, _tooltipAlign: "left" })))));
}
validateHasCloser(value) {
hasCloser.validateHasCloser(this, value);
}
validateLabel(value) {
label.validateLabel(this, value, {
required: true,
});
}
validateLevel(value) {
validation.watchHeadingLevel(this, value);
}
validateOn(value) {
if (this.validateOnValue(value)) {
common.setState(this, '_on', {
onClose: value.onClose,
});
}
}
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 {
"_hasCloser": ["validateHasCloser"],
"_label": ["validateLabel"],
"_level": ["validateLevel"],
"_on": ["validateOn"]
}; }
};
exports.kol_card_wc = KolCardWc;
//# sourceMappingURL=kol-card-wc.entry.cjs.js.map