bruno-ui
Version:
Bruno UI Kit
82 lines (81 loc) • 2.61 kB
JavaScript
import { h } from "@stencil/core";
export class ToggleComponent {
constructor() {
this.type = "primary";
}
render() {
return (h("label", null,
h("input", { type: "checkbox", checked: this.checked, onChange: e => this.OnChangeHandler(e) }),
h("span", { class: `brn-toggle__checkmark brn-toggle__checkmark--${this.type}` }),
h("span", { class: "brn-toggle__text" },
h("slot", null))));
}
OnChangeHandler(event) {
this.changed.emit(event.target.checked);
}
static get is() { return "brn-toggle"; }
static get originalStyleUrls() { return {
"$": ["toggle.component.scss"]
}; }
static get styleUrls() { return {
"$": ["toggle.component.css"]
}; }
static get properties() { return {
"checked": {
"type": "boolean",
"mutable": false,
"complexType": {
"original": "boolean",
"resolved": "boolean",
"references": {}
},
"required": false,
"optional": false,
"docs": {
"tags": [],
"text": ""
},
"attribute": "checked",
"reflect": false
},
"type": {
"type": "string",
"mutable": false,
"complexType": {
"original": "keyof StyleType",
"resolved": "\"danger\" | \"dark\" | \"info\" | \"light\" | \"primary\" | \"secondary\" | \"success\" | \"warning\"",
"references": {
"StyleType": {
"location": "import",
"path": "../../objects/types"
}
}
},
"required": false,
"optional": false,
"docs": {
"tags": [],
"text": ""
},
"attribute": "type",
"reflect": false,
"defaultValue": "\"primary\""
}
}; }
static get events() { return [{
"method": "changed",
"name": "changed",
"bubbles": true,
"cancelable": true,
"composed": true,
"docs": {
"tags": [],
"text": ""
},
"complexType": {
"original": "boolean",
"resolved": "boolean",
"references": {}
}
}]; }
}