diff --git a/eslint.config.mjs b/eslint.config.mjs index f43f1d9c..6d740049 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -51,6 +51,8 @@ export default tseslint.config( sourceType: "module", parserOptions: { + project: "./tsconfig.json", + tsconfigRootDir: _dirname, ecmaFeatures: { modules: true, }, diff --git a/src/components/knx-dpt-dialog-selector.ts b/src/components/knx-dpt-dialog-selector.ts new file mode 100644 index 00000000..95e9b9a4 --- /dev/null +++ b/src/components/knx-dpt-dialog-selector.ts @@ -0,0 +1,189 @@ +import { LitElement, html, css, nothing } from "lit"; +import { customElement, property } from "lit/decorators"; + +import "@ha/components/ha-icon-button"; +import { mdiClose, mdiMenuOpen } from "@mdi/js"; +import { fireEvent } from "@ha/common/dom/fire_event"; +import type { HomeAssistant } from "@ha/types"; + +import type { KNX } from "../types/knx"; + +@customElement("knx-dpt-dialog-selector") +class KnxDptDialogSelector extends LitElement { + @property({ attribute: false }) public hass!: HomeAssistant; + + @property({ attribute: false }) public knx!: KNX; + + @property({ type: String }) public key!: string; + + @property({ attribute: false, type: Array }) public validDPTs?: string[]; + + @property() public value?: string; + + @property() public label?: string; + + @property({ type: Boolean }) public disabled = false; + + @property({ type: Boolean, reflect: true }) public invalid = false; + + @property({ attribute: false }) public invalidMessage?: string; + + @property({ attribute: false }) public localizeValue: (value: string) => string = (key: string) => + key; + + @property({ type: String }) public translation_key?: string; + + render() { + return html` +