@duetds/components
Version:
This package includes Duet Core Components and related tools.
80 lines (79 loc) • 2.46 kB
JavaScript
import { h } from "@stencil/core";
export class DuetToggle {
constructor() {
/**
* Theme of the divider. Can be one of: "default", "turva".
*/
this.theme = "";
/**
* Controls the margin of the component. Can be one of: "auto", "none".
*/
this.margin = "auto";
}
/**
* Component lifecycle events.
*/
componentWillLoad() {
if (this.theme !== "default" && document.documentElement.classList.contains("duet-theme-turva")) {
this.theme = "turva";
}
}
/**
* render() function
* Always the last one in the class.
*/
render() {
return (h("div", { class: {
"duet-m-0": this.margin === "none",
"duet-divider": true,
"duet-theme-turva": this.theme === "turva",
} }));
}
static get is() { return "duet-divider"; }
static get encapsulation() { return "shadow"; }
static get originalStyleUrls() { return {
"$": ["duet-divider.scss"]
}; }
static get styleUrls() { return {
"$": ["duet-divider.css"]
}; }
static get properties() { return {
"theme": {
"type": "string",
"mutable": false,
"complexType": {
"original": "string",
"resolved": "string",
"references": {}
},
"required": false,
"optional": false,
"docs": {
"tags": [],
"text": "Theme of the divider. Can be one of: \"default\", \"turva\"."
},
"attribute": "theme",
"reflect": false,
"defaultValue": "\"\""
},
"margin": {
"type": "string",
"mutable": false,
"complexType": {
"original": "string",
"resolved": "string",
"references": {}
},
"required": false,
"optional": false,
"docs": {
"tags": [],
"text": "Controls the margin of the component. Can be one of: \"auto\", \"none\"."
},
"attribute": "margin",
"reflect": false,
"defaultValue": "\"auto\""
}
}; }
static get elementRef() { return "element"; }
}