v4web-components
Version:
Stencil Component Starter
103 lines (102 loc) • 2.58 kB
JavaScript
import { h } from '@stencil/core';
export class LabDsSwitch {
constructor() {
this.size = 'medium';
this.disabled = undefined;
this.checked = false;
}
handleClick() {
this.handleSwitch.emit(this.checked);
}
render() {
return (h("div", { class: `${this.size} ${this.disabled ? 'disabled' : ''} v4-switch` }, h("label", { class: "switch" }, h("input", { disabled: this.disabled, checked: this.checked, onClick: () => this.handleClick(), type: "checkbox" }), h("span", { class: "slider round material-symbols-outlined" }))));
}
static get is() { return "lab-ds-switch"; }
static get encapsulation() { return "shadow"; }
static get originalStyleUrls() {
return {
"$": ["lab-ds-switch.css"]
};
}
static get styleUrls() {
return {
"$": ["lab-ds-switch.css"]
};
}
static get properties() {
return {
"size": {
"type": "string",
"mutable": false,
"complexType": {
"original": "'small' | 'medium'",
"resolved": "\"medium\" | \"small\"",
"references": {}
},
"required": false,
"optional": false,
"docs": {
"tags": [],
"text": ""
},
"attribute": "size",
"reflect": false,
"defaultValue": "'medium'"
},
"disabled": {
"type": "boolean",
"mutable": false,
"complexType": {
"original": "boolean",
"resolved": "boolean",
"references": {}
},
"required": false,
"optional": false,
"docs": {
"tags": [],
"text": ""
},
"attribute": "disabled",
"reflect": false
},
"checked": {
"type": "boolean",
"mutable": false,
"complexType": {
"original": "boolean",
"resolved": "boolean",
"references": {}
},
"required": false,
"optional": false,
"docs": {
"tags": [],
"text": ""
},
"attribute": "checked",
"reflect": false,
"defaultValue": "false"
}
};
}
static get events() {
return [{
"method": "handleSwitch",
"name": "handleSwitch",
"bubbles": true,
"cancelable": true,
"composed": true,
"docs": {
"tags": [],
"text": ""
},
"complexType": {
"original": "any",
"resolved": "any",
"references": {}
}
}];
}
}
//# sourceMappingURL=lab-ds-switch.js.map