UNPKG

webwriter-chart

Version:

ww-chart is an interactive data visualization widget for the WebWriter tool that implements various charts and diagrams for static and exploratory data visualization.

49 lines (40 loc) 1.09 kB
import { html } from "lit"; import { customElement, property } from "lit/decorators.js"; import "@shoelace-style/shoelace/dist/components/switch/switch.js"; import { LitElementWw } from "@webwriter/lit"; import SlSwitch from "@shoelace-style/shoelace/dist/components/switch/switch.js"; @customElement("wwci-switch") export class Switch extends LitElementWw { @property({ type: Boolean }) accessor checked: boolean = false; @property({ type: Boolean }) accessor disabled: boolean = false; change(e: any) { this.checked = e.target.checked; this.dispatchEvent( new CustomEvent("wwci-change", { detail: { value: this.checked }, composed: true, bubbles: true, }) ); } render() { return html` <sl-switch ?checked=${this.checked} ?disabled=${this.disabled} @sl-change=${this.change} ><slot></slot ></sl-switch>`; } public static get scopedElements() { return { "sl-switch": SlSwitch, }; } } declare global { interface HTMLElementTagNameMap { "wwci-switch": Switch; } }