@kelvininc/ui-components
Version:
Kelvin UI Components
68 lines (65 loc) • 2.52 kB
JavaScript
import { H as proxyCustomElement, I as H, J as createEvent, e as EComponentSize, t as EIconName, K as h, L as Host } from './p-BP5CxQcH.js';
import { d as defineCustomElement$2 } from './p-DQ7v6WT-.js';
import { d as defineCustomElement$1 } from './p-s9JMr6UQ.js';
const KvCheckbox = /*@__PURE__*/ proxyCustomElement(class KvCheckbox extends H {
constructor() {
super();
this.__registerHost();
this.__attachShadow();
this.clickCheckbox = createEvent(this, "clickCheckbox", 7);
/** @inheritdoc */
this.size = EComponentSize.Small;
/** @inheritdoc */
this.checked = false;
/** @inheritdoc */
this.disabled = false;
/** @inheritdoc */
this.indeterminate = false;
this.getIconName = () => {
if (this.indeterminate) {
return EIconName.IndeterminateState;
}
if (this.checked) {
return EIconName.CheckState;
}
return EIconName.UncheckState;
};
this.onCheckedChange = (ev) => {
this.clickCheckbox.emit(ev);
};
}
render() {
return (h(Host, { key: 'fb72d4933e73e276ae26411f97c754d139246dfc' }, h("kv-radio", { key: '5653adda328d5aef1bbc2ae4aff58a9a253852aa', exportparts: "label", size: this.size, checked: this.checked, label: this.label, disabled: this.disabled, onCheckedChange: this.onCheckedChange }, h("kv-icon", { key: '8eacab2a237f0f47ebb2031778177b2de684cce9', slot: "action-icon", name: this.getIconName(), part: "icon" }))));
}
}, [257, "kv-checkbox", {
"size": [1],
"checked": [516],
"label": [513],
"disabled": [516],
"indeterminate": [516]
}]);
function defineCustomElement() {
if (typeof customElements === "undefined") {
return;
}
const components = ["kv-checkbox", "kv-icon", "kv-radio"];
components.forEach(tagName => { switch (tagName) {
case "kv-checkbox":
if (!customElements.get(tagName)) {
customElements.define(tagName, KvCheckbox);
}
break;
case "kv-icon":
if (!customElements.get(tagName)) {
defineCustomElement$2();
}
break;
case "kv-radio":
if (!customElements.get(tagName)) {
defineCustomElement$1();
}
break;
} });
}
defineCustomElement();
export { KvCheckbox as K, defineCustomElement as d };