import {customElement, DeesElement, type TemplateResult, property, html, type CSSResult,} from '@design.estate/dees-element'; import * as domtools from '@design.estate/dees-domtools'; declare global { interface HTMLElementTagNameMap { 'dees-input-radio': DeesInputRadio; } } @customElement('dees-input-radio') export class DeesInputRadio extends DeesElement { public static demo = () => html``; // INSTANCE public changeSubject = new domtools.plugins.smartrx.rxjs.Subject(); @property({ type: String, reflect: true, }) public key: string; @property() public label: string = 'Label'; @property() public value: boolean = false; @property({ type: Boolean, }) public required: boolean = false; @property({ type: Boolean }) public disabled: boolean = false; constructor() { super(); } public render(): TemplateResult { return html `
${this.value ? html`
`: html``}
${this.label}
`; } public async toggleSelected () { this.value = !this.value; this.dispatchEvent(new CustomEvent('newValue', { detail: this.value, bubbles: true })); this.changeSubject.next(this); } }