diff --git a/src/panels/config/automation/action/ha-automation-action-row.ts b/src/panels/config/automation/action/ha-automation-action-row.ts index dbc9150ecf..2d68bf0461 100644 --- a/src/panels/config/automation/action/ha-automation-action-row.ts +++ b/src/panels/config/automation/action/ha-automation-action-row.ts @@ -73,7 +73,7 @@ export const handleChangeEvent = (element: ActionElement, ev: CustomEvent) => { if (!name) { return; } - const newVal = ev.detail.value; + const newVal = ev.detail?.value || (ev.target as any).value; if ((element.action[name] || "") === newVal) { return; @@ -376,7 +376,7 @@ export default class HaAutomationActionRow extends LitElement { margin: 4px 0; } mwc-select { - margin-bottom: 16px; + margin-bottom: 24px; } `, ]; diff --git a/src/panels/config/automation/action/types/ha-automation-action-device_id.ts b/src/panels/config/automation/action/types/ha-automation-action-device_id.ts index c03b480d1b..c837304ea9 100644 --- a/src/panels/config/automation/action/types/ha-automation-action-device_id.ts +++ b/src/panels/config/automation/action/types/ha-automation-action-device_id.ts @@ -143,9 +143,12 @@ export class HaDeviceAction extends LitElement { } static styles = css` + ha-device-picker { + display: block; + margin-bottom: 24px; + } ha-device-action-picker { display: block; - margin-top: 8px; } `; } diff --git a/src/panels/config/automation/action/types/ha-automation-action-event.ts b/src/panels/config/automation/action/types/ha-automation-action-event.ts index 26ebb424c9..ee133fa7da 100644 --- a/src/panels/config/automation/action/types/ha-automation-action-event.ts +++ b/src/panels/config/automation/action/types/ha-automation-action-event.ts @@ -1,9 +1,9 @@ -import "@polymer/paper-input/paper-input"; -import { html, LitElement, PropertyValues } from "lit"; +import { css, CSSResultGroup, html, LitElement, PropertyValues } from "lit"; import { customElement, property, query } from "lit/decorators"; import { fireEvent } from "../../../../../common/dom/fire_event"; import "../../../../../components/entity/ha-entity-picker"; import "../../../../../components/ha-service-picker"; +import "../../../../../components/ha-textfield"; import "../../../../../components/ha-yaml-editor"; import type { HaYamlEditor } from "../../../../../components/ha-yaml-editor"; import type { EventAction } from "../../../../../data/script"; @@ -40,14 +40,13 @@ export class HaEventAction extends LitElement implements ActionElement { const { event, event_data } = this.action; return html` - + @change=${this._eventChanged} + > ${type === "count" - ? html`` + ? html` + + ` : ""} ${type === "while" ? html`

@@ -142,7 +144,7 @@ export class HaRepeatAction extends LitElement implements ActionElement { } private _countChanged(ev: CustomEvent): void { - const newVal = ev.detail.value; + const newVal = (ev.target as any).value; if ((this.action.repeat as CountRepeat).count === newVal) { return; } diff --git a/src/panels/config/automation/action/types/ha-automation-action-wait_for_trigger.ts b/src/panels/config/automation/action/types/ha-automation-action-wait_for_trigger.ts index 997ab3e752..2b76b0918c 100644 --- a/src/panels/config/automation/action/types/ha-automation-action-wait_for_trigger.ts +++ b/src/panels/config/automation/action/types/ha-automation-action-wait_for_trigger.ts @@ -1,6 +1,5 @@ -import "@polymer/paper-input/paper-input"; -import "@polymer/paper-input/paper-textarea"; -import { html, LitElement } from "lit"; +import "../../../../../components/ha-textfield"; +import { css, CSSResultGroup, html, LitElement } from "lit"; import { customElement, property } from "lit/decorators"; import { fireEvent } from "../../../../../common/dom/fire_event"; import "../../../../../components/ha-formfield"; @@ -26,14 +25,14 @@ export class HaWaitForTriggerAction const { wait_for_trigger, continue_on_timeout, timeout } = this.action; return html` - + .value=${timeout || ""} + @change=${this._valueChanged} + >
- -
- - - + `; } - private _continueChanged(ev) { - fireEvent(this, "value-changed", { - value: { ...this.action, continue_on_timeout: ev.target.checked }, - }); - } - - private _valueChanged(ev: CustomEvent): void { - handleChangeEvent(this, ev); - } + private _computeLabelCallback = (schema: HaFormSchema): string => + this.hass.localize( + `ui.panel.config.automation.editor.actions.type.wait_template.${ + schema.name === "continue_on_timeout" ? "continue_timeout" : schema.name + }` + ); } declare global { diff --git a/src/panels/config/automation/condition/ha-automation-condition-editor.ts b/src/panels/config/automation/condition/ha-automation-condition-editor.ts index e6c9378c8f..c03933e600 100644 --- a/src/panels/config/automation/condition/ha-automation-condition-editor.ts +++ b/src/panels/config/automation/condition/ha-automation-condition-editor.ts @@ -147,7 +147,7 @@ export default class HaAutomationConditionEditor extends LitElement { haStyle, css` mwc-select { - margin-bottom: 16px; + margin-bottom: 24px; } `, ]; diff --git a/src/panels/config/automation/condition/types/ha-automation-condition-state.ts b/src/panels/config/automation/condition/types/ha-automation-condition-state.ts index 9c88cdfb50..e6d166adaa 100644 --- a/src/panels/config/automation/condition/types/ha-automation-condition-state.ts +++ b/src/panels/config/automation/condition/types/ha-automation-condition-state.ts @@ -9,6 +9,7 @@ import type { StateCondition } from "../../../../../data/automation"; import type { HomeAssistant } from "../../../../../types"; import { forDictStruct } from "../../structs"; import type { ConditionElement } from "../ha-automation-condition-row"; +import "../../../../../components/ha-form/ha-form"; const stateConditionStruct = object({ condition: literal("state"), diff --git a/src/panels/config/automation/condition/types/ha-automation-condition-sun.ts b/src/panels/config/automation/condition/types/ha-automation-condition-sun.ts index e3d466ca6e..e8966b6969 100644 --- a/src/panels/config/automation/condition/types/ha-automation-condition-sun.ts +++ b/src/panels/config/automation/condition/types/ha-automation-condition-sun.ts @@ -7,6 +7,7 @@ import type { HomeAssistant } from "../../../../../types"; import type { ConditionElement } from "../ha-automation-condition-row"; import type { LocalizeFunc } from "../../../../../common/translations/localize"; import type { HaFormSchema } from "../../../../../components/ha-form/types"; +import "../../../../../components/ha-form/ha-form"; @customElement("ha-automation-condition-sun") export class HaSunCondition extends LitElement implements ConditionElement { diff --git a/src/panels/config/automation/condition/types/ha-automation-condition-time.ts b/src/panels/config/automation/condition/types/ha-automation-condition-time.ts index f09a132ff2..fca4616a7e 100644 --- a/src/panels/config/automation/condition/types/ha-automation-condition-time.ts +++ b/src/panels/config/automation/condition/types/ha-automation-condition-time.ts @@ -7,6 +7,7 @@ import type { HomeAssistant } from "../../../../../types"; import type { ConditionElement } from "../ha-automation-condition-row"; import type { LocalizeFunc } from "../../../../../common/translations/localize"; import type { HaFormSchema } from "../../../../../components/ha-form/types"; +import "../../../../../components/ha-form/ha-form"; const DAYS = { mon: 1, diff --git a/src/panels/config/automation/ha-automation-editor.ts b/src/panels/config/automation/ha-automation-editor.ts index 3a0d34706b..9a6293175c 100644 --- a/src/panels/config/automation/ha-automation-editor.ts +++ b/src/panels/config/automation/ha-automation-editor.ts @@ -9,7 +9,6 @@ import { } from "@mdi/js"; import "@polymer/app-layout/app-header/app-header"; import "@polymer/app-layout/app-toolbar/app-toolbar"; -import "@polymer/paper-input/paper-textarea"; import { UnsubscribeFunc } from "home-assistant-js-websocket"; import { css, @@ -201,7 +200,7 @@ export class HaAutomationEditor extends KeyboardShortcutMixin(LitElement) { ${this._config ? html` ${this.narrow - ? html` ${this._config?.alias} ` + ? html`${this._config?.alias}` : ""}
${this._errors}
` + ? html`
${this._errors}
` : ""} ${this._mode === "gui" ? html` ${"use_blueprint" in this._config - ? html`` - : html``} + ? html` + + ` + : html` + + `} ` : this._mode === "yaml" ? html` diff --git a/src/panels/config/automation/ha-automation-picker.ts b/src/panels/config/automation/ha-automation-picker.ts index 9f25fe3a00..7c637b4dc7 100644 --- a/src/panels/config/automation/ha-automation-picker.ts +++ b/src/panels/config/automation/ha-automation-picker.ts @@ -7,7 +7,6 @@ import { mdiPlayCircleOutline, mdiPlus, } from "@mdi/js"; -import "@polymer/paper-tooltip/paper-tooltip"; import { CSSResultGroup, html, LitElement, TemplateResult } from "lit"; import { customElement, property, state } from "lit/decorators"; import memoizeOne from "memoize-one"; diff --git a/src/panels/config/automation/manual-automation-editor.ts b/src/panels/config/automation/manual-automation-editor.ts index 755f7b639a..3fd2d8c915 100644 --- a/src/panels/config/automation/manual-automation-editor.ts +++ b/src/panels/config/automation/manual-automation-editor.ts @@ -1,11 +1,12 @@ import "@material/mwc-button/mwc-button"; -import "@polymer/paper-input/paper-textarea"; import { HassEntity } from "home-assistant-js-websocket"; import { css, CSSResultGroup, html, LitElement } from "lit"; import { customElement, property } from "lit/decorators"; import { fireEvent } from "../../../common/dom/fire_event"; import "../../../components/entity/ha-entity-toggle"; import "../../../components/ha-card"; +import "../../../components/ha-textarea"; +import "../../../components/ha-textfield"; import { Condition, ManualAutomationConfig, @@ -14,7 +15,7 @@ import { } from "../../../data/automation"; import { Action, MODES, MODES_MAX } from "../../../data/script"; import { haStyle } from "../../../resources/styles"; -import { HomeAssistant } from "../../../types"; +import type { HomeAssistant } from "../../../types"; import { documentationUrl } from "../../../util/documentation-url"; import "../ha-config-section"; import "./action/ha-automation-action"; @@ -36,7 +37,7 @@ export class HaManualAutomationEditor extends LitElement { protected render() { return html` ${!this.narrow - ? html` ${this.config.alias} ` + ? html`${this.config.alias}` : ""} ${this.hass.localize( @@ -45,16 +46,16 @@ export class HaManualAutomationEditor extends LitElement {
- - - + + .value=${this.config.description || ""} + @change=${this._valueChanged} + >

${this.hass.localize( "ui.panel.config.automation.editor.modes.description", @@ -98,16 +99,18 @@ export class HaManualAutomationEditor extends LitElement { )} ${this.config.mode && MODES_MAX.includes(this.config.mode) - ? html` - ` + ? html` + + + ` : html``}

${this.stateObj @@ -243,7 +246,7 @@ export class HaManualAutomationEditor extends LitElement { if (!name) { return; } - let newVal = ev.detail.value; + let newVal = target.value; if (target.type === "number") { newVal = Number(newVal); } diff --git a/src/panels/config/automation/trigger/ha-automation-trigger-row.ts b/src/panels/config/automation/trigger/ha-automation-trigger-row.ts index 9103ab5540..ecf1f1a4b7 100644 --- a/src/panels/config/automation/trigger/ha-automation-trigger-row.ts +++ b/src/panels/config/automation/trigger/ha-automation-trigger-row.ts @@ -14,6 +14,7 @@ import { LocalizeFunc } from "../../../../common/translations/localize"; import "../../../../components/ha-button-menu"; import "../../../../components/ha-card"; import "../../../../components/ha-alert"; +import "../../../../components/ha-textfield"; import "../../../../components/ha-icon-button"; import type { Trigger } from "../../../../data/automation"; import { showConfirmationDialog } from "../../../../dialogs/generic/show-dialog-box"; @@ -200,14 +201,14 @@ export default class HaAutomationTriggerRow extends LitElement { ${showId ? html` - - + ` : ""}
@@ -287,7 +288,7 @@ export default class HaAutomationTriggerRow extends LitElement { } private _idChanged(ev: CustomEvent) { - const newId = ev.detail.value; + const newId = (ev.target as any).value; if (newId === (this.trigger.id ?? "")) { return; } @@ -333,7 +334,11 @@ export default class HaAutomationTriggerRow extends LitElement { --mdc-theme-text-primary-on-background: var(--disabled-text-color); } mwc-select { - margin-bottom: 16px; + margin-bottom: 24px; + } + ha-textfield { + display: block; + margin-bottom: 24px; } `, ]; diff --git a/src/panels/config/automation/trigger/types/ha-automation-trigger-event.ts b/src/panels/config/automation/trigger/types/ha-automation-trigger-event.ts index 6804fb8787..5c191e76db 100644 --- a/src/panels/config/automation/trigger/types/ha-automation-trigger-event.ts +++ b/src/panels/config/automation/trigger/types/ha-automation-trigger-event.ts @@ -1,7 +1,7 @@ -import "@polymer/paper-input/paper-input"; -import { html, LitElement } from "lit"; +import { css, CSSResultGroup, html, LitElement } from "lit"; import { customElement, property } from "lit/decorators"; import { fireEvent } from "../../../../../common/dom/fire_event"; +import "../../../../../components/ha-textfield"; import "../../../../../components/ha-yaml-editor"; import "../../../../../components/user/ha-users-picker"; import { EventTrigger } from "../../../../../data/automation"; @@ -24,14 +24,14 @@ export class HaEventTrigger extends LitElement implements TriggerElement { protected render() { const { event_type, event_data, context } = this.trigger; return html` - + @change=${this._valueChanged} + >