From 5c2fcd7f9b6cedaee3b51ec74cb7febc5ae719e6 Mon Sep 17 00:00:00 2001 From: Gia Ferrari Date: Wed, 28 Dec 2022 17:16:05 -0800 Subject: [PATCH 1/6] Add alt attribute to various images (#14405) * ha-config-area-page: Add alt tag for area-picture * dialog-tag-detail: Add alt tag for generated QR code image. * ha-config-hardware: Blank alt tag for hardware pic, info already elsewhere * dialog-energy-solar-settings: Blank alt tag for brand icon. * ha-energy-grid-settings: Blank alt tag for co2signal brand icon. * Add a few more appropriately-blank alt texts. * ha-config-device-page: Logo alt text set to name of device domain. * ha-config-repairs: Logo alt text set to name of issue domain. * hui-picture-card(-editor): Alternate Text via config (blank default) * hui-picture-entity-card(-editor): Alternate Text via config (blank default) * ha-long-lived-access-token-dialog: Alt text for QR code. * hui-picture-header-footer: Support alt text via optional property. * A few more blank alt attributes. * ha-tile-image: Support alt tag (but it is blank in current usage). * prod cla-bot * Lint. Fix whitespace. * Add missing alt text properties to TS types. * Fix my silly typo in picture-entity-card-editor's SCHEMA (+ minor reformat) * Add alt_text to Picture(Entity)CardConfig TypeScript types. * Format with prettier. * Revise alt text for tag QR * Revise alt text for token QR * Revise alternate to alternative * Add alt to logo in gallery * Add alt text to crop image * Use ifDefined for tile image alt * Change area picture alt to area name * Remove entry from entities config struct * Revert altText changes for Picture Entity Card (to revisit in future PR) See: https://github.com/home-assistant/frontend/pull/14405#discussion_r1032735871 * Revert changes to hui-image and picture entity editor Co-authored-by: Steve Repsher --- gallery/src/pages/components/ha-alert.ts | 4 +++- hassio/src/addon-view/info/hassio-addon-info.ts | 1 + src/components/ha-addon-picker.ts | 6 +++++- src/components/ha-config-entry-picker.ts | 1 + src/components/tile/ha-tile-image.ts | 7 ++++++- .../image-cropper-dialog/image-cropper-dialog.ts | 2 +- src/onboarding/integration-badge.ts | 1 + src/panels/config/areas/ha-config-area-page.ts | 3 ++- .../config/devices/ha-config-device-page.ts | 4 ++++ .../energy/components/ha-energy-grid-settings.ts | 2 ++ .../dialogs/dialog-energy-solar-settings.ts | 1 + src/panels/config/hardware/ha-config-hardware.ts | 2 +- .../config/integrations/ha-domain-integrations.ts | 1 + .../config/integrations/ha-integration-header.ts | 1 + .../integrations/ha-integration-list-item.ts | 1 + src/panels/config/repairs/ha-config-repairs.ts | 1 + .../config/repairs/integrations-startup-time.ts | 1 + src/panels/config/tags/dialog-tag-detail.ts | 9 ++++++++- src/panels/lovelace/cards/hui-picture-card.ts | 5 ++++- src/panels/lovelace/cards/types.ts | 1 + .../config-elements/hui-picture-card-editor.ts | 15 +++++++++++++++ .../header-footer/hui-picture-header-footer.ts | 1 + src/panels/lovelace/header-footer/structs.ts | 1 + src/panels/lovelace/header-footer/types.ts | 1 + .../profile/ha-long-lived-access-token-dialog.ts | 9 ++++++++- src/translations/en.json | 8 ++++++-- 26 files changed, 78 insertions(+), 11 deletions(-) diff --git a/gallery/src/pages/components/ha-alert.ts b/gallery/src/pages/components/ha-alert.ts index ced4c5a44b..a0d3f309fb 100644 --- a/gallery/src/pages/components/ha-alert.ts +++ b/gallery/src/pages/components/ha-alert.ts @@ -98,7 +98,9 @@ const alerts: { description: "Alert with slotted image", type: "warning", iconSlot: html`Home Assistant logo`, }, { diff --git a/hassio/src/addon-view/info/hassio-addon-info.ts b/hassio/src/addon-view/info/hassio-addon-info.ts index 3cc3d23010..a6e8c99217 100644 --- a/hassio/src/addon-view/info/hassio-addon-info.ts +++ b/hassio/src/addon-view/info/hassio-addon-info.ts @@ -404,6 +404,7 @@ class HassioAddonInfo extends LitElement { ? html` ` diff --git a/src/components/ha-addon-picker.ts b/src/components/ha-addon-picker.ts index 955bb6fefb..8c765d9755 100644 --- a/src/components/ha-addon-picker.ts +++ b/src/components/ha-addon-picker.ts @@ -16,7 +16,11 @@ const rowRenderer: ComboBoxLitRenderer = ( ${item.name} ${item.slug} ${item.icon - ? html`` + ? html`` : ""} `; diff --git a/src/components/ha-config-entry-picker.ts b/src/components/ha-config-entry-picker.ts index 7bd4301bfe..09bfc45b4e 100644 --- a/src/components/ha-config-entry-picker.ts +++ b/src/components/ha-config-entry-picker.ts @@ -59,6 +59,7 @@ class HaConfigEntryPicker extends LitElement { > ${item.localized_domain_name} - ${this.imageUrl ? html`` : null} + ${this.imageUrl + ? html`${ifDefined(this.imageAlt)}` + : null} `; } diff --git a/src/dialogs/image-cropper-dialog/image-cropper-dialog.ts b/src/dialogs/image-cropper-dialog/image-cropper-dialog.ts index 74e3711235..94b6d22065 100644 --- a/src/dialogs/image-cropper-dialog/image-cropper-dialog.ts +++ b/src/dialogs/image-cropper-dialog/image-cropper-dialog.ts @@ -74,7 +74,7 @@ export class HaImagecropperDialog extends LitElement { round: Boolean(this._params?.options.round), })}" > - + ${this.hass.localize("ui.dialogs.image_cropper.crop_image")} ${this.hass.localize("ui.common.cancel")} diff --git a/src/onboarding/integration-badge.ts b/src/onboarding/integration-badge.ts index 62e48d1b00..fc440b1589 100644 --- a/src/onboarding/integration-badge.ts +++ b/src/onboarding/integration-badge.ts @@ -19,6 +19,7 @@ class IntegrationBadge extends LitElement { return html`
${area.picture ? html`
- + ${imageURL - ? html`` + ? html`` : ""} ${boardName || diff --git a/src/panels/config/integrations/ha-domain-integrations.ts b/src/panels/config/integrations/ha-domain-integrations.ts index 32a281247f..f62461b553 100644 --- a/src/panels/config/integrations/ha-domain-integrations.ts +++ b/src/panels/config/integrations/ha-domain-integrations.ts @@ -48,6 +48,7 @@ class HaDomainIntegrations extends LitElement { hasMeta >
${domainToName(this.hass.localize, `; + this._qrCode = html`${this.hass.localize(`; } static get styles(): CSSResultGroup { diff --git a/src/panels/lovelace/cards/hui-picture-card.ts b/src/panels/lovelace/cards/hui-picture-card.ts index 20a2a2f315..ffcf4f5009 100644 --- a/src/panels/lovelace/cards/hui-picture-card.ts +++ b/src/panels/lovelace/cards/hui-picture-card.ts @@ -101,7 +101,10 @@ export class HuiPictureCard extends LitElement implements LovelaceCard { ), })} > - + ${this._config.alt_text} `; } diff --git a/src/panels/lovelace/cards/types.ts b/src/panels/lovelace/cards/types.ts index 5ab627b466..2ad69eeb94 100644 --- a/src/panels/lovelace/cards/types.ts +++ b/src/panels/lovelace/cards/types.ts @@ -332,6 +332,7 @@ export interface PictureCardConfig extends LovelaceCardConfig { hold_action?: ActionConfig; double_tap_action?: ActionConfig; theme?: string; + alt_text?: string; } export interface PictureElementsCardConfig extends LovelaceCardConfig { diff --git a/src/panels/lovelace/editor/config-elements/hui-picture-card-editor.ts b/src/panels/lovelace/editor/config-elements/hui-picture-card-editor.ts index 8174a049e2..ee75869fc6 100644 --- a/src/panels/lovelace/editor/config-elements/hui-picture-card-editor.ts +++ b/src/panels/lovelace/editor/config-elements/hui-picture-card-editor.ts @@ -20,6 +20,7 @@ const cardConfigStruct = assign( tap_action: optional(actionConfigStruct), hold_action: optional(actionConfigStruct), theme: optional(string()), + alt_text: optional(string()), }) ); @@ -53,6 +54,10 @@ export class HuiPictureCardEditor return this._config!.theme || ""; } + get _alt_text(): string { + return this._config!.alt_text || ""; + } + protected render(): TemplateResult { if (!this.hass || !this._config) { return html``; @@ -72,6 +77,16 @@ export class HuiPictureCardEditor .configValue=${"image"} @input=${this._valueChanged} > + `; + this._qrCode = html`${this.hass.localize(`; } static get styles(): CSSResultGroup { diff --git a/src/translations/en.json b/src/translations/en.json index a6329fb139..f0b5e00104 100755 --- a/src/translations/en.json +++ b/src/translations/en.json @@ -791,7 +791,8 @@ "close": "Close" }, "image_cropper": { - "crop": "Crop" + "crop": "Crop", + "crop_image": "Picture to crop" }, "date-picker": { "today": "Today" @@ -1435,6 +1436,7 @@ "confirm_remove_title": "Remove tag?", "confirm_remove": "Are you sure you want to remove tag {tag}?", "automation_title": "Tag {name} is scanned", + "qr_code_image": "QR code for tag {name}", "headers": { "icon": "Icon", "name": "Name", @@ -4195,6 +4197,7 @@ "description": "The Light card allows you to change the brightness of the light." }, "generic": { + "alt_text": "Alternative Text", "aspect_ratio": "Aspect Ratio", "attribute": "Attribute", "camera_image": "Camera Entity", @@ -4598,7 +4601,8 @@ "name": "Name", "prompt_name": "Give the token a name", "prompt_copy_token": "Copy your access token. It will not be shown again.", - "empty_state": "You have no long-lived access tokens yet." + "empty_state": "You have no long-lived access tokens yet.", + "qr_code_image": "QR code for token {name}" } }, "shopping_list": { From a9378abe31600240511948f5ad22a64913896947 Mon Sep 17 00:00:00 2001 From: karwosts <32912880+karwosts@users.noreply.github.com> Date: Wed, 28 Dec 2022 21:06:48 -0800 Subject: [PATCH 2/6] Fix days missing from ha-base-time-input _valueChanged (#14910) * Fix days missing from ha-base-time-input _valueChanged * style change --- src/components/ha-base-time-input.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/components/ha-base-time-input.ts b/src/components/ha-base-time-input.ts index 9ada34f871..8db3e132e1 100644 --- a/src/components/ha-base-time-input.ts +++ b/src/components/ha-base-time-input.ts @@ -266,6 +266,9 @@ export class HaBaseTimeInput extends LitElement { seconds: this.seconds, milliseconds: this.milliseconds, }; + if (this.enableDay) { + value.days = this.days; + } if (this.format === 12) { value.amPm = this.amPm; } From f1d644ac518c9595de12a8a4a43302ec5953cfe1 Mon Sep 17 00:00:00 2001 From: Jan Bouwhuis Date: Fri, 30 Dec 2022 13:05:44 +0100 Subject: [PATCH 3/6] Add mV as unit for sensor device_class voltage (#14921) --- src/panels/config/entities/entity-registry-settings.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/panels/config/entities/entity-registry-settings.ts b/src/panels/config/entities/entity-registry-settings.ts index 2bd09c640b..bd9f7db055 100644 --- a/src/panels/config/entities/entity-registry-settings.ts +++ b/src/panels/config/entities/entity-registry-settings.ts @@ -125,6 +125,7 @@ const OVERRIDE_SENSOR_UNITS = { pressure: ["hPa", "Pa", "kPa", "bar", "cbar", "mbar", "mmHg", "inHg", "psi"], speed: ["ft/s", "in/d", "in/h", "km/h", "kn", "m/s", "mm/d", "mm/h", "mph"], temperature: ["°C", "°F", "K"], + voltage: ["V", "mV"], volume: ["CCF", "fl. oz.", "ft³", "gal", "L", "mL", "m³"], water: ["CCF", "ft³", "gal", "L", "m³"], weight: ["g", "kg", "lb", "mg", "oz", "st", "µg"], From a16e41a7ac48c5da5f77d929d442f00746789fff Mon Sep 17 00:00:00 2001 From: SukramJ Date: Fri, 30 Dec 2022 13:06:11 +0100 Subject: [PATCH 4/6] Add support for unit conversion of electric current (#14916) --- src/panels/config/entities/entity-registry-settings.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/panels/config/entities/entity-registry-settings.ts b/src/panels/config/entities/entity-registry-settings.ts index bd9f7db055..72f80712fe 100644 --- a/src/panels/config/entities/entity-registry-settings.ts +++ b/src/panels/config/entities/entity-registry-settings.ts @@ -118,6 +118,7 @@ const OVERRIDE_NUMBER_UNITS = { }; const OVERRIDE_SENSOR_UNITS = { + current: ["A", "mA"], distance: ["cm", "ft", "in", "km", "m", "mi", "mm", "yd"], gas: ["CCF", "ft³", "m³"], precipitation: ["cm", "in", "mm"], From 4901d509183aeb1b7771b5e068334c34b3dada4a Mon Sep 17 00:00:00 2001 From: Allen Porter Date: Fri, 30 Dec 2022 04:15:07 -0800 Subject: [PATCH 5/6] Fix All Day recurring events that end on a specific date (#14905) --- src/panels/calendar/dialog-calendar-event-editor.ts | 1 + src/panels/calendar/ha-recurrence-rule-editor.ts | 11 ++++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/panels/calendar/dialog-calendar-event-editor.ts b/src/panels/calendar/dialog-calendar-event-editor.ts index 613a048f7e..043064a300 100644 --- a/src/panels/calendar/dialog-calendar-event-editor.ts +++ b/src/panels/calendar/dialog-calendar-event-editor.ts @@ -250,6 +250,7 @@ class DialogCalendarEventEditor extends LitElement { Date: Fri, 30 Dec 2022 13:21:47 +0100 Subject: [PATCH 6/6] Bumped version to 20221230.0 --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 18a9d7c5f0..5095848ad9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "home-assistant-frontend" -version = "20221228.0" +version = "20221230.0" license = {text = "Apache-2.0"} description = "The Home Assistant frontend" readme = "README.md"