import type { CSSResultGroup } from "lit"; import { LitElement, css, html, nothing } from "lit"; import { customElement, property, query } from "lit/decorators"; import { classMap } from "lit/directives/class-map"; import { dynamicElement } from "../../../../common/dom/dynamic-element-directive"; import { fireEvent } from "../../../../common/dom/fire_event"; import "../../../../components/ha-textfield"; import "../../../../components/ha-yaml-editor"; import type { HaYamlEditor } from "../../../../components/ha-yaml-editor"; import type { Trigger } from "../../../../data/automation"; import { migrateAutomationTrigger } from "../../../../data/automation"; import { isTriggerList } from "../../../../data/trigger"; import { haStyle } from "../../../../resources/styles"; import type { HomeAssistant } from "../../../../types"; import "../ha-automation-editor-warning"; @customElement("ha-automation-trigger-editor") export default class HaAutomationTriggerEditor extends LitElement { @property({ attribute: false }) public hass!: HomeAssistant; @property({ attribute: false }) public trigger!: Trigger; @property({ type: Boolean }) public disabled = false; @property({ type: Boolean, attribute: "yaml" }) public yamlMode = false; @property({ type: Boolean, attribute: "supported" }) public uiSupported = false; @property({ type: Boolean, attribute: "sidebar" }) public inSidebar = false; @property({ type: Boolean, attribute: "show-id" }) public showId = false; @query("ha-yaml-editor") public yamlEditor?: HaYamlEditor; protected render() { const type = isTriggerList(this.trigger) ? "list" : this.trigger.trigger; const yamlMode = this.yamlMode || !this.uiSupported; const showId = "id" in this.trigger || this.showId; return html`