diff --git a/demo/src/ha-demo.ts b/demo/src/ha-demo.ts index a3af6c30e0..c1b059ebb5 100644 --- a/demo/src/ha-demo.ts +++ b/demo/src/ha-demo.ts @@ -10,6 +10,7 @@ import { import { HomeAssistantAppEl } from "../../src/layouts/home-assistant"; import { HomeAssistant } from "../../src/types"; import { selectedDemoConfig } from "./configs/demo-configs"; +import { mockAreaRegistry } from "./stubs/area_registry"; import { mockAuth } from "./stubs/auth"; import { mockConfigEntries } from "./stubs/config_entries"; import { mockEnergy } from "./stubs/energy"; @@ -23,10 +24,10 @@ import { mockLovelace } from "./stubs/lovelace"; import { mockMediaPlayer } from "./stubs/media_player"; import { mockPersistentNotification } from "./stubs/persistent_notification"; import { mockRecorder } from "./stubs/recorder"; -import { mockTodo } from "./stubs/todo"; import { mockSensor } from "./stubs/sensor"; import { mockSystemLog } from "./stubs/system_log"; import { mockTemplate } from "./stubs/template"; +import { mockTodo } from "./stubs/todo"; import { mockTranslations } from "./stubs/translations"; @customElement("ha-demo") @@ -62,6 +63,7 @@ export class HaDemo extends HomeAssistantAppEl { mockEnergy(hass); mockPersistentNotification(hass); mockConfigEntries(hass); + mockAreaRegistry(hass); mockEntityRegistry(hass, [ { config_entry_id: "co2signal", diff --git a/package.json b/package.json index d172d911de..8f633cfade 100644 --- a/package.json +++ b/package.json @@ -151,7 +151,7 @@ }, "devDependencies": { "@babel/core": "7.24.4", - "@babel/helper-define-polyfill-provider": "0.6.1", + "@babel/helper-define-polyfill-provider": "0.6.2", "@babel/plugin-proposal-decorators": "7.24.1", "@babel/plugin-transform-runtime": "7.24.3", "@babel/preset-env": "7.24.4", @@ -175,7 +175,7 @@ "@types/glob": "8.1.0", "@types/html-minifier-terser": "7.0.2", "@types/js-yaml": "4.0.9", - "@types/leaflet": "1.9.11", + "@types/leaflet": "1.9.12", "@types/leaflet-draw": "1.0.11", "@types/luxon": "3.4.2", "@types/mocha": "10.0.6", @@ -185,8 +185,8 @@ "@types/tar": "6.1.13", "@types/ua-parser-js": "0.7.39", "@types/webspeechapi": "0.0.29", - "@typescript-eslint/eslint-plugin": "7.7.0", - "@typescript-eslint/parser": "7.7.0", + "@typescript-eslint/eslint-plugin": "7.7.1", + "@typescript-eslint/parser": "7.7.1", "@web/dev-server": "0.1.38", "@web/dev-server-rollup": "0.4.1", "babel-loader": "9.1.3", diff --git a/pyproject.toml b/pyproject.toml index 221beef1ae..0d4c30855a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "home-assistant-frontend" -version = "20240424.1" +version = "20240426.0" license = {text = "Apache-2.0"} description = "The Home Assistant frontend" readme = "README.md" diff --git a/src/components/data-table/ha-data-table.ts b/src/components/data-table/ha-data-table.ts index e019a5d400..886a5ad963 100644 --- a/src/components/data-table/ha-data-table.ts +++ b/src/components/data-table/ha-data-table.ts @@ -1,4 +1,4 @@ -import { mdiArrowDown, mdiArrowUp, mdiChevronDown } from "@mdi/js"; +import { mdiArrowDown, mdiArrowUp, mdiChevronUp } from "@mdi/js"; import deepClone from "deep-clone-simple"; import { CSSResultGroup, @@ -578,7 +578,7 @@ export class HaDataTable extends LitElement { @click=${this._collapseGroup} > + + + `; + } + protected _labelClick() { const input = this.input as HTMLInputElement | undefined; if (!input) return; @@ -39,6 +55,9 @@ export class HaFormfield extends FormfieldBase { margin-inline-end: 10px; margin-inline-start: inline; } + .mdc-form-field { + align-items: var(--ha-formfield-align-items, center); + } .mdc-form-field > label { direction: var(--direction); margin-inline-start: 0; diff --git a/src/dialogs/more-info/controls/more-info-counter.ts b/src/dialogs/more-info/controls/more-info-counter.ts index 60e8c733e6..d7d5d95c6e 100644 --- a/src/dialogs/more-info/controls/more-info-counter.ts +++ b/src/dialogs/more-info/controls/more-info-counter.ts @@ -16,21 +16,23 @@ class MoreInfoCounter extends LitElement { return nothing; } - const disabled = isUnavailableState(this.stateObj!.state); + const disabled = isUnavailableState(this.stateObj.state); return html`
${this.hass!.localize("ui.card.counter.actions.increment")} ${this.hass!.localize("ui.card.counter.actions.decrement")} diff --git a/src/panels/config/automation/manual-automation-editor.ts b/src/panels/config/automation/manual-automation-editor.ts index 8fed0a26c3..921e79a472 100644 --- a/src/panels/config/automation/manual-automation-editor.ts +++ b/src/panels/config/automation/manual-automation-editor.ts @@ -97,7 +97,7 @@ export class HaManualAutomationEditor extends LitElement { ` - : ""} - ${this.hass.localize("ui.panel.config.cloud.account.remote.info")} - ${this.hass.localize( - `ui.panel.config.cloud.account.remote.${ - remote_connected - ? "instance_is_available" - : "instance_will_be_available" - }` - )} - ${this.hass.localize( - "ui.panel.config.cloud.account.remote.nabu_casa_url" - )}. - + : strict_connection === "drop_connection" + ? html`${this.hass.localize( + `ui.panel.config.cloud.account.remote.drop_connection_warning` + )}` + : nothing} +

+ ${this.hass.localize("ui.panel.config.cloud.account.remote.info")} +

+ ${remote_connected + ? nothing + : html` +

+ ${this.hass.localize( + "ui.panel.config.cloud.account.remote.info_instance_will_be_available" + )} +

+ `} +
+
+
` + } + > + +
+ + + ${this.hass.localize( + "ui.panel.config.cloud.account.remote.copy_link" + )} + +
+ + + + ${this.hass.localize( + "ui.panel.config.cloud.account.remote.strict_connection" + )} + + + ${this.hass.localize( + "ui.panel.config.cloud.account.remote.strict_connection_secondary" + )} + + + +
+ + +
+
+ ${this.hass.localize( + "ui.panel.config.cloud.account.remote.strict_connection_option_disabled" + )} +
+
+ ${this.hass.localize( + "ui.panel.config.cloud.account.remote.strict_connection_option_disabled_secondary" + )} +
+
+
+ + + +
+
+ ${this.hass.localize( + "ui.panel.config.cloud.account.remote.strict_connection_option_guard_page" + )} +
+
+ ${this.hass.localize( + "ui.panel.config.cloud.account.remote.strict_connection_option_guard_page_secondary" + )} +

+ ⚠️ + ${this.hass.localize( + "ui.panel.config.cloud.account.remote.strict_connection_option_guard_page_warning" + )} +
+
+
+ + + +
+
+ ${this.hass.localize( + "ui.panel.config.cloud.account.remote.strict_connection_option_drop_connection" + )} +
+
+ ${this.hass.localize( + "ui.panel.config.cloud.account.remote.strict_connection_option_drop_connection_secondary" + )} +

+ ⚠️ + ${this.hass.localize( + "ui.panel.config.cloud.account.remote.strict_connection_option_drop_connection_warning" + )} +
+
+
+
+ + ${strict_connection !== "disabled" + ? html` + + ${this.hass.localize( + "ui.panel.config.cloud.account.remote.strict_connection_link" + )} + ${this.hass.localize( + "ui.panel.config.cloud.account.remote.strict_connection_link_secondary" + )} + ${this.hass.localize( + "ui.panel.config.cloud.account.remote.strict_connection_create_link" + )} + + ` + : nothing} + +
${this.hass.localize( @@ -154,61 +304,7 @@ export class CloudRemotePref extends LitElement { @change=${this._toggleAllowRemoteEnabledChanged} > - - ${this.hass.localize( - "ui.panel.config.cloud.account.remote.strict_connection" - )} - ${this.hass.localize( - "ui.panel.config.cloud.account.remote.strict_connection_secondary" - )} - - - ${this.hass.localize( - "ui.panel.config.cloud.account.remote.strict_connection_modes.disabled" - )} - - - ${this.hass.localize( - "ui.panel.config.cloud.account.remote.strict_connection_modes.guard_page" - )} - - - ${this.hass.localize( - "ui.panel.config.cloud.account.remote.strict_connection_modes.drop_connection" - )} - - - - ${strict_connection !== "disabled" - ? html` - ${this.hass.localize( - "ui.panel.config.cloud.account.remote.strict_connection_link" - )} - ${this.hass.localize( - "ui.panel.config.cloud.account.remote.strict_connection_link_secondary" - )} - ${this.hass.localize( - "ui.panel.config.cloud.account.remote.strict_connection_create_link" - )} - ` - : nothing} +
${this.hass.localize( @@ -249,6 +345,10 @@ export class CloudRemotePref extends LitElement { }); } + private _toggleUnmaskedUrl(): void { + this._unmaskedUrl = !this._unmaskedUrl; + } + private async _toggleChanged(ev) { const toggle = ev.target as HaSwitch; @@ -279,15 +379,21 @@ export class CloudRemotePref extends LitElement { } } - private async _setStrictConnectionMode(ev) { - const mode = ev.target.value; + private async _strictConnectionModeChanged(ev) { + const toggle = ev.target as HaRadio; + + if (ev.target.value === this.cloudStatus?.prefs.strict_connection) { + return; + } + try { await updateCloudPref(this.hass, { - strict_connection: mode, + strict_connection: ev.target.value, }); fireEvent(this, "ha-refresh-cloud-status"); } catch (err: any) { alert(err.message); + toggle.checked = !toggle.checked; } } @@ -316,17 +422,22 @@ export class CloudRemotePref extends LitElement { text: html`${this.hass.localize( "ui.panel.config.cloud.account.remote.strict_connection_link_created_message" )} -
${result.response.url}
- - - ${this.hass.localize( - "ui.panel.config.cloud.account.remote.strict_connection_copy_link" - )} - `, + + + + ${this.hass.localize( + "ui.panel.config.cloud.account.remote.copy_link" + )} + + `, }); } catch (err: any) { showAlertDialog(this, { text: err.message }); @@ -343,8 +454,8 @@ export class CloudRemotePref extends LitElement { } .header-actions { position: absolute; - right: 24px; - inset-inline-end: 24px; + right: 16px; + inset-inline-end: 16px; inset-inline-start: initial; top: 24px; display: flex; @@ -378,17 +489,71 @@ export class CloudRemotePref extends LitElement { .card-actions a { text-decoration: none; } - ha-svg-icon { - --mdc-icon-size: 18px; - color: var(--secondary-text-color); - cursor: pointer; + ha-expansion-panel { + margin-top: 16px; } - ha-formfield { - margin-top: 8px; + ha-settings-row { + padding: 0; } ha-expansion-panel { + --expansion-panel-content-padding: 0 16px; + --expansion-panel-summary-padding: 0 16px; + } + ha-alert { + display: block; + margin-bottom: 16px; + } + .url-container { + display: flex; + align-items: center; + gap: 8px; margin-top: 8px; } + .textfield-container { + position: relative; + flex: 1; + } + .textfield-container ha-textfield { + display: block; + } + .toggle-unmasked-url { + position: absolute; + top: 8px; + right: 8px; + inset-inline-start: initial; + inset-inline-end: 8px; + --mdc-icon-button-size: 40px; + --mdc-icon-size: 20px; + color: var(--secondary-text-color); + direction: var(--direction); + } + ha-formfield { + margin-left: -12px; + margin-inline-start: -12px; + --ha-formfield-align-items: start; + } + .strict-connection-container { + gap: 16px; + display: flex; + flex-direction: column; + } + .strict-connection-container ha-formfield { + --ha-formfield-align-items: start; + } + .strict-connection-container .primary { + font-size: 14px; + margin-top: 12px; + } + .strict-connection-container .secondary { + color: var(--secondary-text-color); + font-size: 12px; + } + hr { + border: none; + height: 1px; + background-color: var(--divider-color); + margin: 8px 0; + } `; } } diff --git a/src/panels/config/integrations/integration-panels/zha/dialog-zha-reconfigure-device.ts b/src/panels/config/integrations/integration-panels/zha/dialog-zha-reconfigure-device.ts index bc5e3a1ef6..26a79ee700 100644 --- a/src/panels/config/integrations/integration-panels/zha/dialog-zha-reconfigure-device.ts +++ b/src/panels/config/integrations/integration-panels/zha/dialog-zha-reconfigure-device.ts @@ -47,6 +47,7 @@ class DialogZHAReconfigureDevice extends LitElement { public showDialog(params: ZHAReconfigureDeviceDialogParams): void { this._params = params; + this._clusterConfigurationStatuses = new Map(); this._stages = undefined; } diff --git a/src/panels/config/integrations/integration-panels/zha/zha-network-visualization-page.ts b/src/panels/config/integrations/integration-panels/zha/zha-network-visualization-page.ts index 7520d95502..be4f2accee 100644 --- a/src/panels/config/integrations/integration-panels/zha/zha-network-visualization-page.ts +++ b/src/panels/config/integrations/integration-panels/zha/zha-network-visualization-page.ts @@ -424,7 +424,7 @@ export class ZHANetworkVisualizationPage extends LitElement { ? { physics: { barnesHut: { - springConstant: 0.05, + springConstant: 0, avoidOverlap: 10, damping: 0.09, }, diff --git a/src/panels/config/script/manual-script-editor.ts b/src/panels/config/script/manual-script-editor.ts index fc3371521c..850f5406ed 100644 --- a/src/panels/config/script/manual-script-editor.ts +++ b/src/panels/config/script/manual-script-editor.ts @@ -122,7 +122,7 @@ export class HaManualScriptEditor extends LitElement {