diff --git a/gallery/src/pages/components/ha-expansion-panel.ts b/gallery/src/pages/components/ha-expansion-panel.ts index 0fbbc69694..56eb284aa2 100644 --- a/gallery/src/pages/components/ha-expansion-panel.ts +++ b/gallery/src/pages/components/ha-expansion-panel.ts @@ -1,4 +1,4 @@ -import { mdiPacMan } from "@mdi/js"; +import { mdiLightbulbOn, mdiPacMan } from "@mdi/js"; import type { TemplateResult } from "lit"; import { css, html, LitElement } from "lit"; import { customElement } from "lit/decorators"; @@ -125,6 +125,23 @@ const SAMPLES: { `; }, }, + { + template(slot, leftChevron) { + return html` + + + ${SHORT_TEXT} + + `; + }, + }, ]; @customElement("demo-components-ha-expansion-panel") diff --git a/src/components/ha-expansion-panel.ts b/src/components/ha-expansion-panel.ts index ae300508cf..6604123d48 100644 --- a/src/components/ha-expansion-panel.ts +++ b/src/components/ha-expansion-panel.ts @@ -1,6 +1,6 @@ import { mdiChevronDown } from "@mdi/js"; import type { PropertyValues, TemplateResult } from "lit"; -import { css, html, LitElement } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property, query, state } from "lit/decorators"; import { classMap } from "lit/directives/class-map"; import { fireEvent } from "../common/dom/fire_event"; @@ -13,11 +13,11 @@ export class HaExpansionPanel extends LitElement { @property({ type: Boolean, reflect: true }) outlined = false; - @property({ attribute: false, type: Boolean, reflect: true }) leftChevron = - false; + @property({ attribute: "left-chevron", type: Boolean, reflect: true }) + public leftChevron = false; - @property({ attribute: false, type: Boolean, reflect: true }) noCollapse = - false; + @property({ attribute: "no-collapse", type: Boolean, reflect: true }) + public noCollapse = false; @property() header?: string; @@ -28,6 +28,14 @@ export class HaExpansionPanel extends LitElement { @query(".container") private _container!: HTMLDivElement; protected render(): TemplateResult { + const chevronIcon = this.noCollapse + ? nothing + : html` + + `; return html`
- ${this.leftChevron && !this.noCollapse - ? html` - - ` - : ""} + ${this.leftChevron ? chevronIcon : nothing} +
${this.header} ${this.secondary}
- ${!this.leftChevron && !this.noCollapse - ? html` - - ` - : ""} + ${!this.leftChevron ? chevronIcon : nothing}
@@ -177,7 +172,8 @@ export class HaExpansionPanel extends LitElement { margin-inline-end: initial; } - :host([leftchevron]) .summary-icon { + :host([left-chevron]) .summary-icon, + ::slotted([slot="leading-icon"]) { margin-left: 0; margin-right: 8px; margin-inline-start: 0; diff --git a/src/components/ha-filter-blueprints.ts b/src/components/ha-filter-blueprints.ts index 53c20e079f..18839b7cb6 100644 --- a/src/components/ha-filter-blueprints.ts +++ b/src/components/ha-filter-blueprints.ts @@ -45,7 +45,7 @@ export class HaFilterBlueprints extends LitElement { protected render() { return html` item.icon); return html` + ${this.schema.icon + ? html` + + ` + : this.schema.iconPath + ? html` + + ` + : nothing}
- ${this.schema.icon - ? html` ` - : this.schema.iconPath - ? html` - - ` - : nothing} ${this.schema.title || this.computeLabel?.(this.schema)}
diff --git a/src/components/ha-service-control.ts b/src/components/ha-service-control.ts index 70ff1c5f97..a6f9d0126d 100644 --- a/src/components/ha-service-control.ts +++ b/src/components/ha-service-control.ts @@ -523,7 +523,7 @@ export class HaServiceControl extends LitElement { return fields.length && this._hasFilteredFields(fields, targetEntities) ? html` ` : nothing} - -

- ${type === "service" && - "action" in this.action && - this.action.action - ? html` + ${type === "service" && "action" in this.action && this.action.action + ? html` + ` - : html` + ` + : html` + `} + > + `} +

${capitalizeFirstLetter( describeAction( this.hass, @@ -640,9 +644,6 @@ export default class HaAutomationActionRow extends LitElement { display: inline-block; color: var(--secondary-text-color); opacity: 0.9; - margin-right: 8px; - margin-inline-end: 8px; - margin-inline-start: initial; } } .card-content { diff --git a/src/panels/config/automation/condition/ha-automation-condition-row.ts b/src/panels/config/automation/condition/ha-automation-condition-row.ts index 80a32ec849..ea8c6240d7 100644 --- a/src/panels/config/automation/condition/ha-automation-condition-row.ts +++ b/src/panels/config/automation/condition/ha-automation-condition-row.ts @@ -128,12 +128,13 @@ export default class HaAutomationConditionRow extends LitElement { ` : ""} - + +

- ${capitalizeFirstLetter( describeCondition(this.condition, this.hass, this._entityReg) )} @@ -526,9 +527,6 @@ export default class HaAutomationConditionRow extends LitElement { display: inline-block; color: var(--secondary-text-color); opacity: 0.9; - margin-right: 8px; - margin-inline-end: 8px; - margin-inline-start: initial; } } .card-content { diff --git a/src/panels/config/automation/option/ha-automation-option-row.ts b/src/panels/config/automation/option/ha-automation-option-row.ts index 862adbd9d3..a6e4c80475 100644 --- a/src/panels/config/automation/option/ha-automation-option-row.ts +++ b/src/panels/config/automation/option/ha-automation-option-row.ts @@ -92,7 +92,7 @@ export default class HaAutomationOptionRow extends LitElement { return html` 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 aa090886c7..c2cdf73b4a 100644 --- a/src/panels/config/automation/trigger/ha-automation-trigger-row.ts +++ b/src/panels/config/automation/trigger/ha-automation-trigger-row.ts @@ -159,12 +159,13 @@ export default class HaAutomationTriggerRow extends LitElement { ` : nothing} - + +

- ${describeTrigger(this.trigger, this.hass, this._entityReg)}

@@ -672,9 +673,6 @@ export default class HaAutomationTriggerRow extends LitElement { display: inline-block; color: var(--secondary-text-color); opacity: 0.9; - margin-right: 8px; - margin-inline-end: 8px; - margin-inline-start: initial; } } .card-content { diff --git a/src/panels/config/blueprint/blueprint-generic-editor.ts b/src/panels/config/blueprint/blueprint-generic-editor.ts index a08e6e7869..840f7f1946 100644 --- a/src/panels/config/blueprint/blueprint-generic-editor.ts +++ b/src/panels/config/blueprint/blueprint-generic-editor.ts @@ -130,13 +130,16 @@ export abstract class HaBlueprintGenericEditor extends LitElement { .expanded=${expanded} .noCollapse=${anyRequired} > -
- ${section?.icon - ? html`` - : nothing} + > + ` + : nothing} +
diff --git a/src/panels/config/script/ha-script-field-row.ts b/src/panels/config/script/ha-script-field-row.ts index 9363dc1784..ec6098602a 100644 --- a/src/panels/config/script/ha-script-field-row.ts +++ b/src/panels/config/script/ha-script-field-row.ts @@ -82,7 +82,7 @@ export default class HaScriptFieldRow extends LitElement { return html` - +

${this.key}

diff --git a/src/panels/lovelace/editor/conditions/ha-card-condition-editor.ts b/src/panels/lovelace/editor/conditions/ha-card-condition-editor.ts index 4503522504..cfa2a63a08 100644 --- a/src/panels/lovelace/editor/conditions/ha-card-condition-editor.ts +++ b/src/panels/lovelace/editor/conditions/ha-card-condition-editor.ts @@ -97,12 +97,13 @@ export class HaCardConditionEditor extends LitElement { return html`
- + +

- ${this.hass.localize( `ui.panel.lovelace.editor.condition-editor.condition.${condition.condition}.label` ) || condition.condition} diff --git a/src/panels/lovelace/editor/config-elements/config-elements-style.ts b/src/panels/lovelace/editor/config-elements/config-elements-style.ts index 5434de8d2e..8810a230f1 100644 --- a/src/panels/lovelace/editor/config-elements/config-elements-style.ts +++ b/src/panels/lovelace/editor/config-elements/config-elements-style.ts @@ -43,7 +43,7 @@ export const configElementStyle = css` ha-expansion-panel .content { padding: 12px; } - ha-expansion-panel > * { + ha-expansion-panel > *[slot="header"] { margin: 0; font-size: inherit; font-weight: inherit; diff --git a/src/panels/lovelace/editor/config-elements/hui-heading-card-editor.ts b/src/panels/lovelace/editor/config-elements/hui-heading-card-editor.ts index e2b1c985bc..9a0486ebbf 100644 --- a/src/panels/lovelace/editor/config-elements/hui-heading-card-editor.ts +++ b/src/panels/lovelace/editor/config-elements/hui-heading-card-editor.ts @@ -137,8 +137,8 @@ export class HuiHeadingCardEditor @value-changed=${this._valueChanged} > +

- ${this.hass!.localize( "ui.panel.lovelace.editor.card.heading.entities" )} diff --git a/src/panels/lovelace/editor/config-elements/hui-humidifier-card-editor.ts b/src/panels/lovelace/editor/config-elements/hui-humidifier-card-editor.ts index 16ff0caff2..ebc035dfe3 100644 --- a/src/panels/lovelace/editor/config-elements/hui-humidifier-card-editor.ts +++ b/src/panels/lovelace/editor/config-elements/hui-humidifier-card-editor.ts @@ -102,8 +102,8 @@ export class HuiHumidifierCardEditor @value-changed=${this._valueChanged} > +

- ${this.hass!.localize( "ui.panel.lovelace.editor.card.generic.features" )} diff --git a/src/panels/lovelace/editor/config-elements/hui-thermostat-card-editor.ts b/src/panels/lovelace/editor/config-elements/hui-thermostat-card-editor.ts index 93977539ef..b274c80bb9 100644 --- a/src/panels/lovelace/editor/config-elements/hui-thermostat-card-editor.ts +++ b/src/panels/lovelace/editor/config-elements/hui-thermostat-card-editor.ts @@ -101,8 +101,8 @@ export class HuiThermostatCardEditor @value-changed=${this._valueChanged} > +

- ${this.hass!.localize( "ui.panel.lovelace.editor.card.generic.features" )} diff --git a/src/panels/lovelace/editor/config-elements/hui-tile-card-editor.ts b/src/panels/lovelace/editor/config-elements/hui-tile-card-editor.ts index a5e3c9e528..ba834a00d7 100644 --- a/src/panels/lovelace/editor/config-elements/hui-tile-card-editor.ts +++ b/src/panels/lovelace/editor/config-elements/hui-tile-card-editor.ts @@ -310,8 +310,8 @@ export class HuiTileCardEditor @value-changed=${this._valueChanged} > +

- ${this.hass!.localize( "ui.panel.lovelace.editor.card.generic.features" )} diff --git a/src/panels/lovelace/editor/heading-badge-editor/hui-entity-heading-badge-editor.ts b/src/panels/lovelace/editor/heading-badge-editor/hui-entity-heading-badge-editor.ts index 70688e1d46..061a0a0646 100644 --- a/src/panels/lovelace/editor/heading-badge-editor/hui-entity-heading-badge-editor.ts +++ b/src/panels/lovelace/editor/heading-badge-editor/hui-entity-heading-badge-editor.ts @@ -191,8 +191,8 @@ export class HuiHeadingEntityEditor @value-changed=${this._valueChanged} > +

- ${this.hass!.localize( "ui.panel.lovelace.editor.card.heading.entity_config.visibility" )}