@bulmil/core
Version:

63 lines (58 loc) • 1.96 kB
JavaScript
/*!
* Bulmil - MIT License
*/
import { HTMLElement, h, proxyCustomElement } from '@stencil/core/internal/client';
const checkboxCss = ".radio,.checkbox{cursor:pointer;display:inline-block;line-height:1.25;position:relative}.radio input,.checkbox input{cursor:pointer}.radio:hover,.checkbox:hover{color:#363636}[disabled].radio,[disabled].checkbox,fieldset[disabled] .radio,fieldset[disabled] .checkbox,.radio input[disabled],.checkbox input[disabled]{color:#7a7a7a;cursor:not-allowed}.radio+.radio{margin-left:0.5em}bm-checkbox[disabled=true] .checkbox{color:#7a7a7a;cursor:not-allowed}";
let Checkbox = class extends HTMLElement {
constructor() {
super();
this.__registerHost();
/**
* Input classes
*/
this.inputClass = '';
/**
* Label classes
*/
this.labelClass = '';
/**
* Checked
*/
this.checked = false;
/**
* Disabled
*/
this.disabled = false;
}
render() {
return (h("label", { class: {
checkbox: true,
[this.labelClass]: Boolean(this.labelClass),
} }, h("input", { type: "checkbox", class: {
[this.inputClass]: Boolean(this.inputClass),
}, disabled: this.disabled, checked: this.checked }), h("slot", null)));
}
static get style() { return checkboxCss; }
};
Checkbox = /*@__PURE__*/ proxyCustomElement(Checkbox, [4, "bm-checkbox", {
"inputClass": [1, "input-class"],
"labelClass": [1, "label-class"],
"checked": [4],
"disabled": [4]
}]);
function defineCustomElement$1() {
if (typeof customElements === "undefined") {
return;
}
const components = ["bm-checkbox"];
components.forEach(tagName => { switch (tagName) {
case "bm-checkbox":
if (!customElements.get(tagName)) {
customElements.define(tagName, Checkbox);
}
break;
} });
}
const BmCheckbox = Checkbox;
const defineCustomElement = defineCustomElement$1;
export { BmCheckbox, defineCustomElement };