From d33636c6fb7cd4bc83de36641a4d695219ea0566 Mon Sep 17 00:00:00 2001 From: Paul Bottein Date: Wed, 28 May 2025 12:04:54 +0200 Subject: [PATCH] Force narrow style for action, condition and trigger in flows (#25619) --- src/components/ha-form/ha-form.ts | 3 +++ src/components/ha-selector/ha-selector-action.ts | 3 +++ src/components/ha-selector/ha-selector-condition.ts | 3 +++ src/components/ha-selector/ha-selector-trigger.ts | 3 +++ src/components/ha-selector/ha-selector.ts | 3 +++ src/dialogs/config-flow/dialog-data-entry-flow.ts | 1 + src/dialogs/config-flow/step-flow-form.ts | 3 +++ 7 files changed, 19 insertions(+) diff --git a/src/components/ha-form/ha-form.ts b/src/components/ha-form/ha-form.ts index cbca7aca3c..fbc79a56dd 100644 --- a/src/components/ha-form/ha-form.ts +++ b/src/components/ha-form/ha-form.ts @@ -34,6 +34,8 @@ const getWarning = (obj, item) => (obj && item.name ? obj[item.name] : null); export class HaForm extends LitElement implements HaFormElement { @property({ attribute: false }) public hass?: HomeAssistant; + @property({ type: Boolean }) public narrow = false; + @property({ attribute: false }) public data!: HaFormDataContainer; @property({ attribute: false }) public schema!: readonly HaFormSchema[]; @@ -135,6 +137,7 @@ export class HaForm extends LitElement implements HaFormElement { ? html` `; } diff --git a/src/components/ha-selector/ha-selector-condition.ts b/src/components/ha-selector/ha-selector-condition.ts index 512b9657be..b96bd2894a 100644 --- a/src/components/ha-selector/ha-selector-condition.ts +++ b/src/components/ha-selector/ha-selector-condition.ts @@ -9,6 +9,8 @@ import type { HomeAssistant } from "../../types"; export class HaConditionSelector extends LitElement { @property({ attribute: false }) public hass!: HomeAssistant; + @property({ type: Boolean }) public narrow = false; + @property({ attribute: false }) public selector!: ConditionSelector; @property({ attribute: false }) public value?: Condition; @@ -24,6 +26,7 @@ export class HaConditionSelector extends LitElement { .disabled=${this.disabled} .conditions=${this.value || []} .hass=${this.hass} + .narrow=${this.narrow} > `; } diff --git a/src/components/ha-selector/ha-selector-trigger.ts b/src/components/ha-selector/ha-selector-trigger.ts index 9a580d8d5a..110a744b6e 100644 --- a/src/components/ha-selector/ha-selector-trigger.ts +++ b/src/components/ha-selector/ha-selector-trigger.ts @@ -11,6 +11,8 @@ import type { HomeAssistant } from "../../types"; export class HaTriggerSelector extends LitElement { @property({ attribute: false }) public hass!: HomeAssistant; + @property({ type: Boolean }) public narrow = false; + @property({ attribute: false }) public selector!: TriggerSelector; @property({ attribute: false }) public value?: Trigger; @@ -33,6 +35,7 @@ export class HaTriggerSelector extends LitElement { .disabled=${this.disabled} .triggers=${this._triggers(this.value)} .hass=${this.hass} + .narrow=${this.narrow} > `; } diff --git a/src/components/ha-selector/ha-selector.ts b/src/components/ha-selector/ha-selector.ts index 69a5b59a25..47c2bdd8dd 100644 --- a/src/components/ha-selector/ha-selector.ts +++ b/src/components/ha-selector/ha-selector.ts @@ -69,6 +69,8 @@ const LEGACY_UI_SELECTORS = new Set(["ui-action", "ui-color"]); export class HaSelector extends LitElement { @property({ attribute: false }) public hass!: HomeAssistant; + @property({ type: Boolean }) public narrow = false; + @property() public name?: string; @property({ attribute: false }) public selector!: Selector; @@ -127,6 +129,7 @@ export class HaSelector extends LitElement { return html` ${dynamicElement(`ha-selector-${this._type}`, { hass: this.hass, + narrow: this.narrow, name: this.name, selector: this._handleLegacySelector(this.selector), value: this.value, diff --git a/src/dialogs/config-flow/dialog-data-entry-flow.ts b/src/dialogs/config-flow/dialog-data-entry-flow.ts index 5f141c3572..298f5742e2 100644 --- a/src/dialogs/config-flow/dialog-data-entry-flow.ts +++ b/src/dialogs/config-flow/dialog-data-entry-flow.ts @@ -349,6 +349,7 @@ class DataEntryFlowDialog extends LitElement { ${this._step.type === "form" ? html`