import { CSSResultGroup, html, LitElement, PropertyValues, TemplateResult, unsafeCSS, } from 'lit'; import { customElement, property } from 'lit/decorators.js'; import { classMap } from 'lit/directives/class-map.js'; import { KeyAssignerController } from '../components-lib/key-assigner-controller'; import { KeyboardShortcut } from '../config/schema/view'; import { localize } from '../localize/localize'; import keyAssignerStyle from '../scss/key-assigner.scss'; import './icon'; @customElement('advanced-camera-card-key-assigner') export class AdvancedCameraCardKeyAssigner extends LitElement { @property({ attribute: false }) public label?: string; @property({ attribute: false }) public value?: KeyboardShortcut | null; protected _controller = new KeyAssignerController(this); protected willUpdate(changedProps: PropertyValues): void { if (changedProps.has('value')) { this._controller.setValue(this.value ?? null); } } protected render(): TemplateResult | void { if (!this.label) { return; } const renderKey = (key: string) => { return html`