Rename ha-button-menu-new into ha-md-button-menu (#22016)

* ha-button-menu-new => ha-md-button-menu

* linting
This commit is contained in:
Simon Lamon 2024-09-18 14:02:15 +02:00 committed by GitHub
parent c0043af4c9
commit d2194d55f9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
11 changed files with 253 additions and 247 deletions

View File

@ -6,8 +6,8 @@ import type { HaIconButton } from "./ha-icon-button";
import "./ha-menu";
import type { HaMenu } from "./ha-menu";
@customElement("ha-button-menu-new")
export class HaButtonMenuNew extends LitElement {
@customElement("ha-md-button-menu")
export class HaMdButtonMenu extends LitElement {
protected readonly [FOCUS_TARGET];
@property({ type: Boolean }) public disabled = false;
@ -84,6 +84,6 @@ export class HaButtonMenuNew extends LitElement {
declare global {
interface HTMLElementTagNameMap {
"ha-button-menu-new": HaButtonMenuNew;
"ha-md-button-menu": HaMdButtonMenu;
}
}

View File

@ -2,8 +2,8 @@ import { MdMenuItem } from "@material/web/menu/menu-item";
import { css } from "lit";
import { customElement, property } from "lit/decorators";
@customElement("ha-menu-item")
export class HaMenuItem extends MdMenuItem {
@customElement("ha-md-menu-item")
export class HaMdMenuItem extends MdMenuItem {
@property({ attribute: false }) clickAction?: (item?: HTMLElement) => void;
static override styles = [
@ -41,6 +41,6 @@ export class HaMenuItem extends MdMenuItem {
declare global {
interface HTMLElementTagNameMap {
"ha-menu-item": HaMenuItem;
"ha-md-menu-item": HaMdMenuItem;
}
}

View File

@ -6,7 +6,7 @@ import {
} from "@material/web/menu/internal/controllers/shared";
import { css } from "lit";
import { customElement } from "lit/decorators";
import type { HaMenuItem } from "./ha-menu-item";
import type { HaMdMenuItem } from "./ha-md-menu-item";
@customElement("ha-menu")
export class HaMenu extends MdMenu {
@ -22,7 +22,7 @@ export class HaMenu extends MdMenu {
) {
return;
}
(ev.detail.initiator as HaMenuItem).clickAction?.(ev.detail.initiator);
(ev.detail.initiator as HaMdMenuItem).clickAction?.(ev.detail.initiator);
}
static override styles = [

View File

@ -35,10 +35,10 @@ import type {
HaDataTable,
SortingDirection,
} from "../components/data-table/ha-data-table";
import "../components/ha-button-menu-new";
import "../components/ha-md-button-menu";
import "../components/ha-dialog";
import { HaMenu } from "../components/ha-menu";
import "../components/ha-menu-item";
import "../components/ha-md-menu-item";
import "../components/search-input-outlined";
import type { HomeAssistant, Route } from "../types";
import "./hass-tabs-subpage";
@ -330,7 +330,7 @@ export class HaTabsSubpageDataTable extends LitElement {
"ui.components.subpage-data-table.exit_selection_mode"
)}
></ha-icon-button>
<ha-button-menu-new positioning="absolute">
<ha-md-button-menu positioning="absolute">
<ha-assist-chip
.label=${localize(
"ui.components.subpage-data-table.select"
@ -346,20 +346,26 @@ export class HaTabsSubpageDataTable extends LitElement {
.path=${mdiMenuDown}
></ha-svg-icon
></ha-assist-chip>
<ha-menu-item .value=${undefined} @click=${this._selectAll}>
<ha-md-menu-item
.value=${undefined}
@click=${this._selectAll}
>
<div slot="headline">
${localize("ui.components.subpage-data-table.select_all")}
</div>
</ha-menu-item>
<ha-menu-item .value=${undefined} @click=${this._selectNone}>
</ha-md-menu-item>
<ha-md-menu-item
.value=${undefined}
@click=${this._selectNone}
>
<div slot="headline">
${localize(
"ui.components.subpage-data-table.select_none"
)}
</div>
</ha-menu-item>
</ha-md-menu-item>
<md-divider role="separator" tabindex="-1"></md-divider>
<ha-menu-item
<ha-md-menu-item
.value=${undefined}
@click=${this._disableSelectMode}
>
@ -368,8 +374,8 @@ export class HaTabsSubpageDataTable extends LitElement {
"ui.components.subpage-data-table.close_select_mode"
)}
</div>
</ha-menu-item>
</ha-button-menu-new>
</ha-md-menu-item>
</ha-md-button-menu>
<p>
${localize("ui.components.subpage-data-table.selected", {
selected: this.selected || "0",
@ -476,27 +482,27 @@ export class HaTabsSubpageDataTable extends LitElement {
${Object.entries(this.columns).map(([id, column]) =>
column.groupable
? html`
<ha-menu-item
<ha-md-menu-item
.value=${id}
@click=${this._handleGroupBy}
.selected=${id === this._groupColumn}
class=${classMap({ selected: id === this._groupColumn })}
>
${column.title || column.label}
</ha-menu-item>
</ha-md-menu-item>
`
: nothing
)}
<ha-menu-item
<ha-md-menu-item
.value=${undefined}
@click=${this._handleGroupBy}
.selected=${this._groupColumn === undefined}
class=${classMap({ selected: this._groupColumn === undefined })}
>
${localize("ui.components.subpage-data-table.dont_group_by")}
</ha-menu-item>
</ha-md-menu-item>
<md-divider role="separator" tabindex="-1"></md-divider>
<ha-menu-item
<ha-md-menu-item
@click=${this._collapseAllGroups}
.disabled=${this._groupColumn === undefined}
>
@ -505,8 +511,8 @@ export class HaTabsSubpageDataTable extends LitElement {
.path=${mdiUnfoldLessHorizontal}
></ha-svg-icon>
${localize("ui.components.subpage-data-table.collapse_all_groups")}
</ha-menu-item>
<ha-menu-item
</ha-md-menu-item>
<ha-md-menu-item
@click=${this._expandAllGroups}
.disabled=${this._groupColumn === undefined}
>
@ -515,13 +521,13 @@ export class HaTabsSubpageDataTable extends LitElement {
.path=${mdiUnfoldMoreHorizontal}
></ha-svg-icon>
${localize("ui.components.subpage-data-table.expand_all_groups")}
</ha-menu-item>
</ha-md-menu-item>
</ha-menu>
<ha-menu anchor="sort-by-anchor" id="sort-by-menu" positioning="fixed">
${Object.entries(this.columns).map(([id, column]) =>
column.sortable
? html`
<ha-menu-item
<ha-md-menu-item
.value=${id}
@click=${this._handleSortBy}
keep-open
@ -539,7 +545,7 @@ export class HaTabsSubpageDataTable extends LitElement {
`
: nothing}
${column.title || column.label}
</ha-menu-item>
</ha-md-menu-item>
`
: nothing
)}
@ -893,7 +899,7 @@ export class HaTabsSubpageDataTable extends LitElement {
#sort-by-anchor,
#group-by-anchor,
ha-button-menu-new ha-assist-chip {
ha-md-button-menu ha-assist-chip {
--md-assist-chip-trailing-space: 8px;
}
`;

View File

@ -67,8 +67,8 @@ import "../../../components/ha-icon-button";
import "../../../components/ha-icon-overflow-menu";
import "../../../components/ha-menu";
import type { HaMenu } from "../../../components/ha-menu";
import "../../../components/ha-menu-item";
import type { HaMenuItem } from "../../../components/ha-menu-item";
import "../../../components/ha-md-menu-item";
import type { HaMdMenuItem } from "../../../components/ha-md-menu-item";
import "../../../components/ha-sub-menu";
import "../../../components/ha-svg-icon";
import { createAreaRegistryEntry } from "../../../data/area_registry";
@ -403,7 +403,7 @@ class HaAutomationPicker extends SubscribeMixin(LitElement) {
protected render(): TemplateResult {
const categoryItems = html`${this._categories?.map(
(category) =>
html`<ha-menu-item
html`<ha-md-menu-item
.value=${category.category_id}
@click=${this._handleBulkCategory}
>
@ -411,21 +411,21 @@ class HaAutomationPicker extends SubscribeMixin(LitElement) {
? html`<ha-icon slot="start" .icon=${category.icon}></ha-icon>`
: html`<ha-svg-icon slot="start" .path=${mdiTag}></ha-svg-icon>`}
<div slot="headline">${category.name}</div>
</ha-menu-item>`
</ha-md-menu-item>`
)}
<ha-menu-item .value=${null} @click=${this._handleBulkCategory}>
<ha-md-menu-item .value=${null} @click=${this._handleBulkCategory}>
<div slot="headline">
${this.hass.localize(
"ui.panel.config.automation.picker.bulk_actions.no_category"
)}
</div>
</ha-menu-item>
</ha-md-menu-item>
<md-divider role="separator" tabindex="-1"></md-divider>
<ha-menu-item @click=${this._bulkCreateCategory}>
<ha-md-menu-item @click=${this._bulkCreateCategory}>
<div slot="headline">
${this.hass.localize("ui.panel.config.category.editor.add")}
</div>
</ha-menu-item>`;
</ha-md-menu-item>`;
const labelItems = html`${this._labels?.map((label) => {
const color = label.color ? computeCssColor(label.color) : undefined;
@ -437,7 +437,7 @@ class HaAutomationPicker extends SubscribeMixin(LitElement) {
this._selected.some((entityId) =>
this.hass.entities[entityId]?.labels.includes(label.label_id)
);
return html`<ha-menu-item
return html`<ha-md-menu-item
.value=${label.label_id}
.action=${selected ? "remove" : "add"}
@click=${this._handleBulkLabel}
@ -455,18 +455,18 @@ class HaAutomationPicker extends SubscribeMixin(LitElement) {
: nothing}
${label.name}
</ha-label>
</ha-menu-item>`;
</ha-md-menu-item>`;
})}
<md-divider role="separator" tabindex="-1"></md-divider>
<ha-menu-item @click=${this._bulkCreateLabel}>
<ha-md-menu-item @click=${this._bulkCreateLabel}>
<div slot="headline">
${this.hass.localize("ui.panel.config.labels.add_label")}
</div></ha-menu-item
</div></ha-md-menu-item
>`;
const areaItems = html`${Object.values(this.hass.areas).map(
(area) =>
html`<ha-menu-item
html`<ha-md-menu-item
.value=${area.area_id}
@click=${this._handleBulkArea}
>
@ -477,23 +477,23 @@ class HaAutomationPicker extends SubscribeMixin(LitElement) {
.path=${mdiTextureBox}
></ha-svg-icon>`}
<div slot="headline">${area.name}</div>
</ha-menu-item>`
</ha-md-menu-item>`
)}
<ha-menu-item .value=${null} @click=${this._handleBulkArea}>
<ha-md-menu-item .value=${null} @click=${this._handleBulkArea}>
<div slot="headline">
${this.hass.localize(
"ui.panel.config.devices.picker.bulk_actions.no_area"
)}
</div>
</ha-menu-item>
</ha-md-menu-item>
<md-divider role="separator" tabindex="-1"></md-divider>
<ha-menu-item @click=${this._bulkCreateArea}>
<ha-md-menu-item @click=${this._bulkCreateArea}>
<div slot="headline">
${this.hass.localize(
"ui.panel.config.devices.picker.bulk_actions.add_area"
)}
</div>
</ha-menu-item>`;
</ha-md-menu-item>`;
const areasInOverflow =
(this._sizeController.value && this._sizeController.value < 900) ||
@ -633,7 +633,7 @@ class HaAutomationPicker extends SubscribeMixin(LitElement) {
></ha-filter-blueprints>
${
!this.narrow
? html`<ha-button-menu-new slot="selection-bar">
? html`<ha-md-button-menu slot="selection-bar">
<ha-assist-chip
slot="trigger"
.label=${this.hass.localize(
@ -646,10 +646,10 @@ class HaAutomationPicker extends SubscribeMixin(LitElement) {
></ha-svg-icon>
</ha-assist-chip>
${categoryItems}
</ha-button-menu-new>
</ha-md-button-menu>
${labelsInOverflow
? nothing
: html`<ha-button-menu-new slot="selection-bar">
: html`<ha-md-button-menu slot="selection-bar">
<ha-assist-chip
slot="trigger"
.label=${this.hass.localize(
@ -662,10 +662,10 @@ class HaAutomationPicker extends SubscribeMixin(LitElement) {
></ha-svg-icon>
</ha-assist-chip>
${labelItems}
</ha-button-menu-new>`}
</ha-md-button-menu>`}
${areasInOverflow
? nothing
: html`<ha-button-menu-new slot="selection-bar">
: html`<ha-md-button-menu slot="selection-bar">
<ha-assist-chip
slot="trigger"
.label=${this.hass.localize(
@ -678,10 +678,10 @@ class HaAutomationPicker extends SubscribeMixin(LitElement) {
></ha-svg-icon>
</ha-assist-chip>
${areaItems}
</ha-button-menu-new>`}`
</ha-md-button-menu>`}`
: nothing
}
<ha-button-menu-new has-overflow slot="selection-bar">
<ha-md-button-menu has-overflow slot="selection-bar">
${
this.narrow
? html`<ha-assist-chip
@ -709,7 +709,7 @@ class HaAutomationPicker extends SubscribeMixin(LitElement) {
${
this.narrow
? html`<ha-sub-menu>
<ha-menu-item slot="item">
<ha-md-menu-item slot="item">
<div slot="headline">
${this.hass.localize(
"ui.panel.config.automation.picker.bulk_actions.move_category"
@ -719,7 +719,7 @@ class HaAutomationPicker extends SubscribeMixin(LitElement) {
slot="end"
.path=${mdiChevronRight}
></ha-svg-icon>
</ha-menu-item>
</ha-md-menu-item>
<ha-menu slot="menu">${categoryItems}</ha-menu>
</ha-sub-menu>`
: nothing
@ -727,7 +727,7 @@ class HaAutomationPicker extends SubscribeMixin(LitElement) {
${
this.narrow || labelsInOverflow
? html`<ha-sub-menu>
<ha-menu-item slot="item">
<ha-md-menu-item slot="item">
<div slot="headline">
${this.hass.localize(
"ui.panel.config.automation.picker.bulk_actions.add_label"
@ -737,7 +737,7 @@ class HaAutomationPicker extends SubscribeMixin(LitElement) {
slot="end"
.path=${mdiChevronRight}
></ha-svg-icon>
</ha-menu-item>
</ha-md-menu-item>
<ha-menu slot="menu">${labelItems}</ha-menu>
</ha-sub-menu>`
: nothing
@ -745,7 +745,7 @@ class HaAutomationPicker extends SubscribeMixin(LitElement) {
${
this.narrow || areasInOverflow
? html`<ha-sub-menu>
<ha-menu-item slot="item">
<ha-md-menu-item slot="item">
<div slot="headline">
${this.hass.localize(
"ui.panel.config.devices.picker.bulk_actions.move_area"
@ -755,20 +755,20 @@ class HaAutomationPicker extends SubscribeMixin(LitElement) {
slot="end"
.path=${mdiChevronRight}
></ha-svg-icon>
</ha-menu-item>
</ha-md-menu-item>
<ha-menu slot="menu">${areaItems}</ha-menu>
</ha-sub-menu>`
: nothing
}
<ha-menu-item @click=${this._handleBulkEnable}>
<ha-md-menu-item @click=${this._handleBulkEnable}>
<ha-svg-icon slot="start" .path=${mdiToggleSwitch}></ha-svg-icon>
<div slot="headline">
${this.hass.localize(
"ui.panel.config.automation.picker.bulk_actions.enable"
)}
</div>
</ha-menu-item>
<ha-menu-item @click=${this._handleBulkDisable}>
</ha-md-menu-item>
<ha-md-menu-item @click=${this._handleBulkDisable}>
<ha-svg-icon
slot="start"
.path=${mdiToggleSwitchOffOutline}
@ -778,8 +778,8 @@ class HaAutomationPicker extends SubscribeMixin(LitElement) {
"ui.panel.config.automation.picker.bulk_actions.disable"
)}
</div>
</ha-menu-item>
</ha-button-menu-new>
</ha-md-menu-item>
</ha-md-button-menu>
${
!this.automations.length
? html`<div class="empty" slot="empty">
@ -827,7 +827,7 @@ class HaAutomationPicker extends SubscribeMixin(LitElement) {
</ha-fab>
</hass-tabs-subpage-data-table>
<ha-menu id="overflow-menu" positioning="fixed">
<ha-menu-item .clickAction=${this._showInfo}>
<ha-md-menu-item .clickAction=${this._showInfo}>
<ha-svg-icon
.path=${mdiInformationOutline}
slot="start"
@ -835,46 +835,46 @@ class HaAutomationPicker extends SubscribeMixin(LitElement) {
<div slot="headline">
${this.hass.localize("ui.panel.config.automation.editor.show_info")}
</div>
</ha-menu-item>
</ha-md-menu-item>
<ha-menu-item .clickAction=${this._showSettings}>
<ha-md-menu-item .clickAction=${this._showSettings}>
<ha-svg-icon .path=${mdiCog} slot="start"></ha-svg-icon>
<div slot="headline">
${this.hass.localize(
"ui.panel.config.automation.picker.show_settings"
)}
</div>
</ha-menu-item>
<ha-menu-item .clickAction=${this._editCategory}>
</ha-md-menu-item>
<ha-md-menu-item .clickAction=${this._editCategory}>
<ha-svg-icon .path=${mdiTag} slot="start"></ha-svg-icon>
<div slot="headline">
${this.hass.localize(
`ui.panel.config.automation.picker.${this._overflowAutomation?.category ? "edit_category" : "assign_category"}`
)}
</div>
</ha-menu-item>
<ha-menu-item .clickAction=${this._runActions}>
</ha-md-menu-item>
<ha-md-menu-item .clickAction=${this._runActions}>
<ha-svg-icon .path=${mdiPlay} slot="start"></ha-svg-icon>
<div slot="headline">
${this.hass.localize("ui.panel.config.automation.editor.run")}
</div>
</ha-menu-item>
<ha-menu-item .clickAction=${this._showTrace}>
</ha-md-menu-item>
<ha-md-menu-item .clickAction=${this._showTrace}>
<ha-svg-icon .path=${mdiTransitConnection} slot="start"></ha-svg-icon>
<div slot="headline">
${this.hass.localize(
"ui.panel.config.automation.editor.show_trace"
)}
</div>
</ha-menu-item>
</ha-md-menu-item>
<md-divider role="separator" tabindex="-1"></md-divider>
<ha-menu-item .clickAction=${this._duplicate}>
<ha-md-menu-item .clickAction=${this._duplicate}>
<ha-svg-icon .path=${mdiContentDuplicate} slot="start"></ha-svg-icon>
<div slot="headline">
${this.hass.localize("ui.panel.config.automation.picker.duplicate")}
</div>
</ha-menu-item>
<ha-menu-item .clickAction=${this._toggle}>
</ha-md-menu-item>
<ha-md-menu-item .clickAction=${this._toggle}>
<ha-svg-icon
.path=${
this._overflowAutomation?.state === "off"
@ -892,13 +892,13 @@ class HaAutomationPicker extends SubscribeMixin(LitElement) {
)
}
</div>
</ha-menu-item>
<ha-menu-item .clickAction=${this._deleteConfirm} class="warning">
</ha-md-menu-item>
<ha-md-menu-item .clickAction=${this._deleteConfirm} class="warning">
<ha-svg-icon .path=${mdiDelete} slot="start"></ha-svg-icon>
<div slot="headline">
${this.hass.localize("ui.panel.config.automation.picker.delete")}
</div>
</ha-menu-item>
</ha-md-menu-item>
</ha-menu>
`;
}
@ -1056,13 +1056,13 @@ class HaAutomationPicker extends SubscribeMixin(LitElement) {
this._applyFilters();
}
private _showInfo = (item: HaMenuItem) => {
private _showInfo = (item: HaMdMenuItem) => {
const automation = ((item.parentElement as HaMenu)!.anchorElement as any)!
.automation;
fireEvent(this, "hass-more-info", { entityId: automation.entity_id });
};
private _showSettings = (item: HaMenuItem) => {
private _showSettings = (item: HaMdMenuItem) => {
const automation = ((item.parentElement as HaMenu)!.anchorElement as any)!
.automation;
@ -1072,14 +1072,14 @@ class HaAutomationPicker extends SubscribeMixin(LitElement) {
});
};
private _runActions = (item: HaMenuItem) => {
private _runActions = (item: HaMdMenuItem) => {
const automation = ((item.parentElement as HaMenu)!.anchorElement as any)!
.automation;
triggerAutomationActions(this.hass, automation.entity_id);
};
private _editCategory = (item: HaMenuItem) => {
private _editCategory = (item: HaMdMenuItem) => {
const automation = ((item.parentElement as HaMenu)!.anchorElement as any)!
.automation;
@ -1103,7 +1103,7 @@ class HaAutomationPicker extends SubscribeMixin(LitElement) {
});
};
private _showTrace = (item: HaMenuItem) => {
private _showTrace = (item: HaMdMenuItem) => {
const automation = ((item.parentElement as HaMenu)!.anchorElement as any)!
.automation;
@ -1120,7 +1120,7 @@ class HaAutomationPicker extends SubscribeMixin(LitElement) {
);
};
private _toggle = async (item: HaMenuItem): Promise<void> => {
private _toggle = async (item: HaMdMenuItem): Promise<void> => {
const automation = ((item.parentElement as HaMenu)!.anchorElement as any)!
.automation;
@ -1130,7 +1130,7 @@ class HaAutomationPicker extends SubscribeMixin(LitElement) {
});
};
private _deleteConfirm = async (item: HaMenuItem) => {
private _deleteConfirm = async (item: HaMdMenuItem) => {
const automation = ((item.parentElement as HaMenu)!.anchorElement as any)!
.automation;
@ -1167,7 +1167,7 @@ class HaAutomationPicker extends SubscribeMixin(LitElement) {
}
}
private _duplicate = async (item: HaMenuItem) => {
private _duplicate = async (item: HaMdMenuItem) => {
const automation = ((item.parentElement as HaMenu)!.anchorElement as any)!
.automation;
@ -1455,7 +1455,7 @@ ${rejected
ha-assist-chip {
--ha-assist-chip-container-shape: 10px;
}
ha-button-menu-new ha-assist-chip {
ha-md-button-menu ha-assist-chip {
--md-assist-chip-trailing-space: 8px;
}
ha-label {

View File

@ -54,7 +54,7 @@ import "../../../components/ha-filter-integrations";
import "../../../components/ha-filter-labels";
import "../../../components/ha-filter-states";
import "../../../components/ha-icon-button";
import "../../../components/ha-menu-item";
import "../../../components/ha-md-menu-item";
import "../../../components/ha-sub-menu";
import { createAreaRegistryEntry } from "../../../data/area_registry";
import { ConfigEntry, sortConfigEntries } from "../../../data/config_entries";
@ -629,7 +629,7 @@ export class HaConfigDeviceDashboard extends SubscribeMixin(LitElement) {
const areaItems = html`${Object.values(this.hass.areas).map(
(area) =>
html`<ha-menu-item
html`<ha-md-menu-item
.value=${area.area_id}
@click=${this._handleBulkArea}
>
@ -640,23 +640,23 @@ export class HaConfigDeviceDashboard extends SubscribeMixin(LitElement) {
.path=${mdiTextureBox}
></ha-svg-icon>`}
<div slot="headline">${area.name}</div>
</ha-menu-item>`
</ha-md-menu-item>`
)}
<ha-menu-item .value=${null} @click=${this._handleBulkArea}>
<ha-md-menu-item .value=${null} @click=${this._handleBulkArea}>
<div slot="headline">
${this.hass.localize(
"ui.panel.config.devices.picker.bulk_actions.no_area"
)}
</div>
</ha-menu-item>
</ha-md-menu-item>
<md-divider role="separator" tabindex="-1"></md-divider>
<ha-menu-item @click=${this._bulkCreateArea}>
<ha-md-menu-item @click=${this._bulkCreateArea}>
<div slot="headline">
${this.hass.localize(
"ui.panel.config.devices.picker.bulk_actions.add_area"
)}
</div>
</ha-menu-item>`;
</ha-md-menu-item>`;
const labelItems = html`${this._labels?.map((label) => {
const color = label.color ? computeCssColor(label.color) : undefined;
@ -668,7 +668,7 @@ export class HaConfigDeviceDashboard extends SubscribeMixin(LitElement) {
this._selected.some((deviceId) =>
this.hass.devices[deviceId]?.labels.includes(label.label_id)
);
return html`<ha-menu-item
return html`<ha-md-menu-item
.value=${label.label_id}
.action=${selected ? "remove" : "add"}
@click=${this._handleBulkLabel}
@ -686,13 +686,13 @@ export class HaConfigDeviceDashboard extends SubscribeMixin(LitElement) {
: nothing}
${label.name}
</ha-label>
</ha-menu-item>`;
</ha-md-menu-item>`;
})}
<md-divider role="separator" tabindex="-1"></md-divider>
<ha-menu-item @click=${this._bulkCreateLabel}>
<ha-md-menu-item @click=${this._bulkCreateLabel}>
<div slot="headline">
${this.hass.localize("ui.panel.config.labels.add_label")}
</div></ha-menu-item
</div></ha-md-menu-item
>`;
return html`
@ -802,7 +802,7 @@ export class HaConfigDeviceDashboard extends SubscribeMixin(LitElement) {
></ha-filter-labels>
${!this.narrow
? html`<ha-button-menu-new slot="selection-bar">
? html`<ha-md-button-menu slot="selection-bar">
<ha-assist-chip
slot="trigger"
.label=${this.hass.localize(
@ -815,11 +815,11 @@ export class HaConfigDeviceDashboard extends SubscribeMixin(LitElement) {
></ha-svg-icon>
</ha-assist-chip>
${labelItems}
</ha-button-menu-new>
</ha-md-button-menu>
${areasInOverflow
? nothing
: html`<ha-button-menu-new slot="selection-bar">
: html`<ha-md-button-menu slot="selection-bar">
<ha-assist-chip
slot="trigger"
.label=${this.hass.localize(
@ -832,10 +832,10 @@ export class HaConfigDeviceDashboard extends SubscribeMixin(LitElement) {
></ha-svg-icon>
</ha-assist-chip>
${areaItems}
</ha-button-menu-new>`}`
</ha-md-button-menu>`}`
: nothing}
${this.narrow || areasInOverflow
? html`<ha-button-menu-new has-overflow slot="selection-bar">
? html`<ha-md-button-menu has-overflow slot="selection-bar">
${this.narrow
? html`<ha-assist-chip
.label=${this.hass.localize(
@ -855,7 +855,7 @@ export class HaConfigDeviceDashboard extends SubscribeMixin(LitElement) {
></ha-icon-button>`}
${this.narrow
? html` <ha-sub-menu>
<ha-menu-item slot="item">
<ha-md-menu-item slot="item">
<div slot="headline">
${this.hass.localize(
"ui.panel.config.automation.picker.bulk_actions.add_label"
@ -865,12 +865,12 @@ export class HaConfigDeviceDashboard extends SubscribeMixin(LitElement) {
slot="end"
.path=${mdiChevronRight}
></ha-svg-icon>
</ha-menu-item>
</ha-md-menu-item>
<ha-menu slot="menu">${labelItems}</ha-menu>
</ha-sub-menu>`
: nothing}
<ha-sub-menu>
<ha-menu-item slot="item">
<ha-md-menu-item slot="item">
<div slot="headline">
${this.hass.localize(
"ui.panel.config.devices.picker.bulk_actions.move_area"
@ -880,10 +880,10 @@ export class HaConfigDeviceDashboard extends SubscribeMixin(LitElement) {
slot="end"
.path=${mdiChevronRight}
></ha-svg-icon>
</ha-menu-item>
</ha-md-menu-item>
<ha-menu slot="menu">${areaItems}</ha-menu>
</ha-sub-menu>
</ha-button-menu-new>`
</ha-md-button-menu>`
: nothing}
</hass-tabs-subpage-data-table>
`;
@ -1100,7 +1100,7 @@ ${rejected
ha-assist-chip {
--ha-assist-chip-container-shape: 10px;
}
ha-button-menu-new ha-assist-chip {
ha-md-button-menu ha-assist-chip {
--md-assist-chip-trailing-space: 8px;
}
ha-label {

View File

@ -60,7 +60,7 @@ import "../../../components/ha-filter-labels";
import "../../../components/ha-filter-states";
import "../../../components/ha-icon";
import "../../../components/ha-icon-button";
import "../../../components/ha-menu-item";
import "../../../components/ha-md-menu-item";
import "../../../components/ha-sub-menu";
import "../../../components/ha-svg-icon";
import { ConfigEntry, getConfigEntries } from "../../../data/config_entries";
@ -700,7 +700,7 @@ export class HaConfigEntities extends SubscribeMixin(LitElement) {
this._selected.some((entityId) =>
this.hass.entities[entityId]?.labels.includes(label.label_id)
);
return html`<ha-menu-item
return html`<ha-md-menu-item
.value=${label.label_id}
.action=${selected ? "remove" : "add"}
@click=${this._handleBulkLabel}
@ -718,13 +718,13 @@ export class HaConfigEntities extends SubscribeMixin(LitElement) {
: nothing}
${label.name}
</ha-label>
</ha-menu-item>`;
</ha-md-menu-item>`;
})}
<md-divider role="separator" tabindex="-1"></md-divider>
<ha-menu-item @click=${this._bulkCreateLabel}>
<ha-md-menu-item @click=${this._bulkCreateLabel}>
<div slot="headline">
${this.hass.localize("ui.panel.config.labels.add_label")}
</div></ha-menu-item
</div></ha-md-menu-item
>`;
return html`
@ -782,7 +782,7 @@ export class HaConfigEntities extends SubscribeMixin(LitElement) {
${
!this.narrow
? html`<ha-button-menu-new slot="selection-bar">
? html`<ha-md-button-menu slot="selection-bar">
<ha-assist-chip
slot="trigger"
.label=${this.hass.localize(
@ -792,10 +792,10 @@ ${
<ha-svg-icon slot="trailing-icon" .path=${mdiMenuDown}></ha-svg-icon>
</ha-assist-chip>
${labelItems}
</ha-button-menu-new>`
</ha-md-button-menu>`
: nothing
}
<ha-button-menu-new has-overflow slot="selection-bar">
<ha-md-button-menu has-overflow slot="selection-bar">
${
this.narrow
? html`<ha-assist-chip
@ -820,29 +820,29 @@ ${
${
this.narrow
? html`<ha-sub-menu>
<ha-menu-item slot="item">
<ha-md-menu-item slot="item">
<div slot="headline">
${this.hass.localize(
"ui.panel.config.automation.picker.bulk_actions.add_label"
)}
</div>
<ha-svg-icon slot="end" .path=${mdiChevronRight}></ha-svg-icon>
</ha-menu-item>
</ha-md-menu-item>
<ha-menu slot="menu">${labelItems}</ha-menu>
</ha-sub-menu>
<md-divider role="separator" tabindex="-1"></md-divider>`
: nothing
}
<ha-menu-item @click=${this._enableSelected}>
<ha-md-menu-item @click=${this._enableSelected}>
<ha-svg-icon slot="start" .path=${mdiToggleSwitch}></ha-svg-icon>
<div slot="headline">
${this.hass.localize(
"ui.panel.config.entities.picker.enable_selected.button"
)}
</div>
</ha-menu-item>
<ha-menu-item @click=${this._disableSelected}>
</ha-md-menu-item>
<ha-md-menu-item @click=${this._disableSelected}>
<ha-svg-icon
slot="start"
.path=${mdiToggleSwitchOffOutline}
@ -852,10 +852,10 @@ ${
"ui.panel.config.entities.picker.disable_selected.button"
)}
</div>
</ha-menu-item>
</ha-md-menu-item>
<md-divider role="separator" tabindex="-1"></md-divider>
<ha-menu-item @click=${this._unhideSelected}>
<ha-md-menu-item @click=${this._unhideSelected}>
<ha-svg-icon
slot="start"
.path=${mdiEye}
@ -865,8 +865,8 @@ ${
"ui.panel.config.entities.picker.unhide_selected.button"
)}
</div>
</ha-menu-item>
<ha-menu-item @click=${this._hideSelected}>
</ha-md-menu-item>
<ha-md-menu-item @click=${this._hideSelected}>
<ha-svg-icon
slot="start"
.path=${mdiEyeOff}
@ -876,10 +876,10 @@ ${
"ui.panel.config.entities.picker.hide_selected.button"
)}
</div>
</ha-menu-item>
</ha-md-menu-item>
<md-divider role="separator" tabindex="-1"></md-divider>
<ha-menu-item @click=${this._removeSelected} class="warning">
<ha-md-menu-item @click=${this._removeSelected} class="warning">
<ha-svg-icon
slot="start"
.path=${mdiDelete}
@ -889,9 +889,9 @@ ${
"ui.panel.config.entities.picker.delete_selected.button"
)}
</div>
</ha-menu-item>
</ha-md-menu-item>
</ha-button-menu-new>
</ha-md-button-menu>
${
Array.isArray(this._filters.config_entry) &&
this._filters.config_entry?.length
@ -1454,7 +1454,7 @@ ${rejected
ha-assist-chip {
--ha-assist-chip-container-shape: 10px;
}
ha-button-menu-new ha-assist-chip {
ha-md-button-menu ha-assist-chip {
--md-assist-chip-trailing-space: 8px;
}
ha-label {

View File

@ -479,7 +479,7 @@ export class HaConfigHelpers extends SubscribeMixin(LitElement) {
const categoryItems = html`${this._categories?.map(
(category) =>
html`<ha-menu-item
html`<ha-md-menu-item
.value=${category.category_id}
@click=${this._handleBulkCategory}
>
@ -487,21 +487,21 @@ export class HaConfigHelpers extends SubscribeMixin(LitElement) {
? html`<ha-icon slot="start" .icon=${category.icon}></ha-icon>`
: html`<ha-svg-icon slot="start" .path=${mdiTag}></ha-svg-icon>`}
<div slot="headline">${category.name}</div>
</ha-menu-item>`
</ha-md-menu-item>`
)}
<ha-menu-item .value=${null} @click=${this._handleBulkCategory}>
<ha-md-menu-item .value=${null} @click=${this._handleBulkCategory}>
<div slot="headline">
${this.hass.localize(
"ui.panel.config.automation.picker.bulk_actions.no_category"
)}
</div>
</ha-menu-item>
</ha-md-menu-item>
<md-divider role="separator" tabindex="-1"></md-divider>
<ha-menu-item @click=${this._bulkCreateCategory}>
<ha-md-menu-item @click=${this._bulkCreateCategory}>
<div slot="headline">
${this.hass.localize("ui.panel.config.category.editor.add")}
</div>
</ha-menu-item>`;
</ha-md-menu-item>`;
const labelItems = html`${this._labels?.map((label) => {
const color = label.color ? computeCssColor(label.color) : undefined;
const selected = this._selected.every((entityId) =>
@ -512,7 +512,7 @@ export class HaConfigHelpers extends SubscribeMixin(LitElement) {
this._selected.some((entityId) =>
this.hass.entities[entityId]?.labels.includes(label.label_id)
);
return html`<ha-menu-item
return html`<ha-md-menu-item
.value=${label.label_id}
.action=${selected ? "remove" : "add"}
@click=${this._handleBulkLabel}
@ -530,13 +530,13 @@ export class HaConfigHelpers extends SubscribeMixin(LitElement) {
: nothing}
${label.name}
</ha-label>
</ha-menu-item> `;
</ha-md-menu-item> `;
})}<md-divider role="separator" tabindex="-1"></md-divider>
<ha-menu-item @click=${this._bulkCreateLabel}>
<ha-md-menu-item @click=${this._bulkCreateLabel}>
<div slot="headline">
${this.hass.localize("ui.panel.config.labels.add_label")}
</div>
</ha-menu-item>`;
</ha-md-menu-item>`;
const labelsInOverflow =
(this._sizeController.value && this._sizeController.value < 700) ||
(!this._sizeController.value && this.hass.dockedSidebar === "docked");
@ -637,7 +637,7 @@ export class HaConfigHelpers extends SubscribeMixin(LitElement) {
></ha-filter-categories>
${!this.narrow
? html`<ha-button-menu-new slot="selection-bar">
? html`<ha-md-button-menu slot="selection-bar">
<ha-assist-chip
slot="trigger"
.label=${this.hass.localize(
@ -650,10 +650,10 @@ export class HaConfigHelpers extends SubscribeMixin(LitElement) {
></ha-svg-icon>
</ha-assist-chip>
${categoryItems}
</ha-button-menu-new>
</ha-md-button-menu>
${labelsInOverflow
? nothing
: html`<ha-button-menu-new slot="selection-bar">
: html`<ha-md-button-menu slot="selection-bar">
<ha-assist-chip
slot="trigger"
.label=${this.hass.localize(
@ -666,11 +666,11 @@ export class HaConfigHelpers extends SubscribeMixin(LitElement) {
></ha-svg-icon>
</ha-assist-chip>
${labelItems}
</ha-button-menu-new>`}`
</ha-md-button-menu>`}`
: nothing}
${this.narrow || labelsInOverflow
? html`
<ha-button-menu-new has-overflow slot="selection-bar">
<ha-md-button-menu has-overflow slot="selection-bar">
${
this.narrow
? html`<ha-assist-chip
@ -698,7 +698,7 @@ export class HaConfigHelpers extends SubscribeMixin(LitElement) {
${
this.narrow
? html`<ha-sub-menu>
<ha-menu-item slot="item">
<ha-md-menu-item slot="item">
<div slot="headline">
${this.hass.localize(
"ui.panel.config.automation.picker.bulk_actions.move_category"
@ -708,7 +708,7 @@ export class HaConfigHelpers extends SubscribeMixin(LitElement) {
slot="end"
.path=${mdiChevronRight}
></ha-svg-icon>
</ha-menu-item>
</ha-md-menu-item>
<ha-menu slot="menu">${categoryItems}</ha-menu>
</ha-sub-menu>`
: nothing
@ -716,7 +716,7 @@ export class HaConfigHelpers extends SubscribeMixin(LitElement) {
${
this.narrow || this.hass.dockedSidebar === "docked"
? html` <ha-sub-menu>
<ha-menu-item slot="item">
<ha-md-menu-item slot="item">
<div slot="headline">
${this.hass.localize(
"ui.panel.config.automation.picker.bulk_actions.add_label"
@ -726,12 +726,12 @@ export class HaConfigHelpers extends SubscribeMixin(LitElement) {
slot="end"
.path=${mdiChevronRight}
></ha-svg-icon>
</ha-menu-item>
</ha-md-menu-item>
<ha-menu slot="menu">${labelItems}</ha-menu>
</ha-sub-menu>`
: nothing
}
</ha-button-menu-new>`
</ha-md-button-menu>`
: nothing}
<ha-integration-overflow-menu
@ -1155,7 +1155,7 @@ ${rejected
ha-assist-chip {
--ha-assist-chip-container-shape: 10px;
}
ha-button-menu-new ha-assist-chip {
ha-md-button-menu ha-assist-chip {
--md-assist-chip-trailing-space: 8px;
}
ha-label {

View File

@ -45,12 +45,12 @@ import { isDevVersion } from "../../../common/config/version";
import { caseInsensitiveStringCompare } from "../../../common/string/compare";
import { nextRender } from "../../../common/util/render-status";
import "../../../components/ha-button";
import "../../../components/ha-button-menu-new";
import "../../../components/ha-md-button-menu";
import "../../../components/ha-card";
import "../../../components/ha-list-item";
import "../../../components/ha-md-list-item";
import "../../../components/ha-md-list";
import "../../../components/ha-menu-item";
import "../../../components/ha-md-menu-item";
import {
deleteApplicationCredential,
fetchApplicationCredentialsConfigEntry,
@ -797,23 +797,23 @@ class HaConfigIntegrationPage extends SubscribeMixin(LitElement) {
</mwc-button>
`
: ""}
<ha-button-menu-new positioning="popover" slot="end">
<ha-md-button-menu positioning="popover" slot="end">
<ha-icon-button
slot="trigger"
.label=${this.hass.localize("ui.common.menu")}
.path=${mdiDotsVertical}
></ha-icon-button>
${item.supports_options && stateText
? html`<ha-menu-item @click=${this._showOptions}>
? html`<ha-md-menu-item @click=${this._showOptions}>
<ha-svg-icon slot="start" .path=${mdiCog}></ha-svg-icon>
${this.hass.localize(
"ui.panel.config.integrations.config_entry.configure"
)}
</ha-menu-item>`
</ha-md-menu-item>`
: ""}
${item.disabled_by && devices.length
? html`
<ha-menu-item
<ha-md-menu-item
href=${devices.length === 1
? `/config/devices/device/${devices[0].id}`
: `/config/devices/dashboard?historyBack=1&config_entry=${item.entry_id}`}
@ -824,11 +824,11 @@ class HaConfigIntegrationPage extends SubscribeMixin(LitElement) {
{ count: devices.length }
)}
<ha-icon-next slot="end"></ha-icon-next>
</ha-menu-item>
</ha-md-menu-item>
`
: ""}
${item.disabled_by && services.length
? html`<ha-menu-item
? html`<ha-md-menu-item
href=${services.length === 1
? `/config/devices/device/${services[0].id}`
: `/config/devices/dashboard?historyBack=1&config_entry=${item.entry_id}`}
@ -842,11 +842,11 @@ class HaConfigIntegrationPage extends SubscribeMixin(LitElement) {
{ count: services.length }
)}
<ha-icon-next slot="end"></ha-icon-next>
</ha-menu-item> `
</ha-md-menu-item> `
: ""}
${item.disabled_by && entities.length
? html`
<ha-menu-item
<ha-md-menu-item
href=${`/config/entities?historyBack=1&config_entry=${item.entry_id}`}
>
<ha-svg-icon
@ -858,7 +858,7 @@ class HaConfigIntegrationPage extends SubscribeMixin(LitElement) {
{ count: entities.length }
)}
<ha-icon-next slot="end"></ha-icon-next>
</ha-menu-item>
</ha-md-menu-item>
`
: ""}
${!item.disabled_by &&
@ -866,27 +866,27 @@ class HaConfigIntegrationPage extends SubscribeMixin(LitElement) {
item.supports_unload &&
item.source !== "system"
? html`
<ha-menu-item @click=${this._handleReload}>
<ha-md-menu-item @click=${this._handleReload}>
<ha-svg-icon slot="start" .path=${mdiReload}></ha-svg-icon>
${this.hass.localize(
"ui.panel.config.integrations.config_entry.reload"
)}
</ha-menu-item>
</ha-md-menu-item>
`
: nothing}
<ha-menu-item @click=${this._handleRename} graphic="icon">
<ha-md-menu-item @click=${this._handleRename} graphic="icon">
<ha-svg-icon slot="start" .path=${mdiRenameBox}></ha-svg-icon>
${this.hass.localize(
"ui.panel.config.integrations.config_entry.rename"
)}
</ha-menu-item>
</ha-md-menu-item>
<md-divider role="separator" tabindex="-1"></md-divider>
${this._diagnosticHandler && item.state === "loaded"
? html`
<ha-menu-item
<ha-md-menu-item
href=${getConfigEntryDiagnosticsDownloadUrl(item.entry_id)}
target="_blank"
@click=${this._signUrl}
@ -895,41 +895,41 @@ class HaConfigIntegrationPage extends SubscribeMixin(LitElement) {
${this.hass.localize(
"ui.panel.config.integrations.config_entry.download_diagnostics"
)}
</ha-menu-item>
</ha-md-menu-item>
`
: ""}
${!item.disabled_by &&
item.supports_reconfigure &&
item.source !== "system"
? html`
<ha-menu-item @click=${this._handleReconfigure}>
<ha-md-menu-item @click=${this._handleReconfigure}>
<ha-svg-icon slot="start" .path=${mdiWrench}></ha-svg-icon>
${this.hass.localize(
"ui.panel.config.integrations.config_entry.reconfigure"
)}
</ha-menu-item>
</ha-md-menu-item>
`
: nothing}
<ha-menu-item @click=${this._handleSystemOptions} graphic="icon">
<ha-md-menu-item @click=${this._handleSystemOptions} graphic="icon">
<ha-svg-icon slot="start" .path=${mdiCog}></ha-svg-icon>
${this.hass.localize(
"ui.panel.config.integrations.config_entry.system_options"
)}
</ha-menu-item>
</ha-md-menu-item>
${item.disabled_by === "user"
? html`
<ha-menu-item @click=${this._handleEnable}>
<ha-md-menu-item @click=${this._handleEnable}>
<ha-svg-icon
slot="start"
.path=${mdiPlayCircleOutline}
></ha-svg-icon>
${this.hass.localize("ui.common.enable")}
</ha-menu-item>
</ha-md-menu-item>
`
: item.source !== "system"
? html`
<ha-menu-item
<ha-md-menu-item
class="warning"
@click=${this._handleDisable}
graphic="icon"
@ -940,12 +940,12 @@ class HaConfigIntegrationPage extends SubscribeMixin(LitElement) {
.path=${mdiStopCircleOutline}
></ha-svg-icon>
${this.hass.localize("ui.common.disable")}
</ha-menu-item>
</ha-md-menu-item>
`
: nothing}
${item.source !== "system"
? html`
<ha-menu-item class="warning" @click=${this._handleDelete}>
<ha-md-menu-item class="warning" @click=${this._handleDelete}>
<ha-svg-icon
slot="start"
class="warning"
@ -954,10 +954,10 @@ class HaConfigIntegrationPage extends SubscribeMixin(LitElement) {
${this.hass.localize(
"ui.panel.config.integrations.config_entry.delete"
)}
</ha-menu-item>
</ha-md-menu-item>
`
: nothing}
</ha-button-menu-new>
</ha-md-button-menu>
</ha-md-list-item>`;
}

View File

@ -58,7 +58,7 @@ import "../../../components/ha-filter-floor-areas";
import "../../../components/ha-filter-labels";
import "../../../components/ha-icon-button";
import "../../../components/ha-icon-overflow-menu";
import "../../../components/ha-menu-item";
import "../../../components/ha-md-menu-item";
import "../../../components/ha-state-icon";
import "../../../components/ha-sub-menu";
import "../../../components/ha-svg-icon";
@ -423,7 +423,7 @@ class HaSceneDashboard extends SubscribeMixin(LitElement) {
protected render(): TemplateResult {
const categoryItems = html`${this._categories?.map(
(category) =>
html`<ha-menu-item
html`<ha-md-menu-item
.value=${category.category_id}
@click=${this._handleBulkCategory}
>
@ -431,21 +431,21 @@ class HaSceneDashboard extends SubscribeMixin(LitElement) {
? html`<ha-icon slot="start" .icon=${category.icon}></ha-icon>`
: html`<ha-svg-icon slot="start" .path=${mdiTag}></ha-svg-icon>`}
<div slot="headline">${category.name}</div>
</ha-menu-item>`
</ha-md-menu-item>`
)}
<ha-menu-item .value=${null} @click=${this._handleBulkCategory}>
<ha-md-menu-item .value=${null} @click=${this._handleBulkCategory}>
<div slot="headline">
${this.hass.localize(
"ui.panel.config.automation.picker.bulk_actions.no_category"
)}
</div>
</ha-menu-item>
</ha-md-menu-item>
<md-divider role="separator" tabindex="-1"></md-divider>
<ha-menu-item @click=${this._bulkCreateCategory}>
<ha-md-menu-item @click=${this._bulkCreateCategory}>
<div slot="headline">
${this.hass.localize("ui.panel.config.category.editor.add")}
</div>
</ha-menu-item>`;
</ha-md-menu-item>`;
const labelItems = html` ${this._labels?.map((label) => {
const color = label.color ? computeCssColor(label.color) : undefined;
@ -457,7 +457,7 @@ class HaSceneDashboard extends SubscribeMixin(LitElement) {
this._selected.some((entityId) =>
this.hass.entities[entityId]?.labels.includes(label.label_id)
);
return html`<ha-menu-item
return html`<ha-md-menu-item
.value=${label.label_id}
.action=${selected ? "remove" : "add"}
@click=${this._handleBulkLabel}
@ -475,18 +475,18 @@ class HaSceneDashboard extends SubscribeMixin(LitElement) {
: nothing}
${label.name}
</ha-label>
</ha-menu-item>`;
</ha-md-menu-item>`;
})}
<md-divider role="separator" tabindex="-1"></md-divider>
<ha-menu-item @click=${this._bulkCreateLabel}>
<ha-md-menu-item @click=${this._bulkCreateLabel}>
<div slot="headline">
${this.hass.localize("ui.panel.config.labels.add_label")}
</div></ha-menu-item
</div></ha-md-menu-item
>`;
const areaItems = html`${Object.values(this.hass.areas).map(
(area) =>
html`<ha-menu-item
html`<ha-md-menu-item
.value=${area.area_id}
@click=${this._handleBulkArea}
>
@ -497,23 +497,23 @@ class HaSceneDashboard extends SubscribeMixin(LitElement) {
.path=${mdiTextureBox}
></ha-svg-icon>`}
<div slot="headline">${area.name}</div>
</ha-menu-item>`
</ha-md-menu-item>`
)}
<ha-menu-item .value=${null} @click=${this._handleBulkArea}>
<ha-md-menu-item .value=${null} @click=${this._handleBulkArea}>
<div slot="headline">
${this.hass.localize(
"ui.panel.config.devices.picker.bulk_actions.no_area"
)}
</div>
</ha-menu-item>
</ha-md-menu-item>
<md-divider role="separator" tabindex="-1"></md-divider>
<ha-menu-item @click=${this._bulkCreateArea}>
<ha-md-menu-item @click=${this._bulkCreateArea}>
<div slot="headline">
${this.hass.localize(
"ui.panel.config.devices.picker.bulk_actions.add_area"
)}
</div>
</ha-menu-item>`;
</ha-md-menu-item>`;
const areasInOverflow =
(this._sizeController.value && this._sizeController.value < 900) ||
@ -637,7 +637,7 @@ class HaSceneDashboard extends SubscribeMixin(LitElement) {
></ha-filter-categories>
${!this.narrow
? html`<ha-button-menu-new slot="selection-bar">
? html`<ha-md-button-menu slot="selection-bar">
<ha-assist-chip
slot="trigger"
.label=${this.hass.localize(
@ -650,10 +650,10 @@ class HaSceneDashboard extends SubscribeMixin(LitElement) {
></ha-svg-icon>
</ha-assist-chip>
${categoryItems}
</ha-button-menu-new>
</ha-md-button-menu>
${labelsInOverflow
? nothing
: html`<ha-button-menu-new slot="selection-bar">
: html`<ha-md-button-menu slot="selection-bar">
<ha-assist-chip
slot="trigger"
.label=${this.hass.localize(
@ -666,10 +666,10 @@ class HaSceneDashboard extends SubscribeMixin(LitElement) {
></ha-svg-icon>
</ha-assist-chip>
${labelItems}
</ha-button-menu-new>`}
</ha-md-button-menu>`}
${areasInOverflow
? nothing
: html`<ha-button-menu-new slot="selection-bar">
: html`<ha-md-button-menu slot="selection-bar">
<ha-assist-chip
slot="trigger"
.label=${this.hass.localize(
@ -682,11 +682,11 @@ class HaSceneDashboard extends SubscribeMixin(LitElement) {
></ha-svg-icon>
</ha-assist-chip>
${areaItems}
</ha-button-menu-new>`}`
</ha-md-button-menu>`}`
: nothing}
${this.narrow || areasInOverflow
? html`
<ha-button-menu-new has-overflow slot="selection-bar">
<ha-md-button-menu has-overflow slot="selection-bar">
${
this.narrow
? html`<ha-assist-chip
@ -714,7 +714,7 @@ class HaSceneDashboard extends SubscribeMixin(LitElement) {
${
this.narrow
? html`<ha-sub-menu>
<ha-menu-item slot="item">
<ha-md-menu-item slot="item">
<div slot="headline">
${this.hass.localize(
"ui.panel.config.automation.picker.bulk_actions.move_category"
@ -724,7 +724,7 @@ class HaSceneDashboard extends SubscribeMixin(LitElement) {
slot="end"
.path=${mdiChevronRight}
></ha-svg-icon>
</ha-menu-item>
</ha-md-menu-item>
<ha-menu slot="menu">${categoryItems}</ha-menu>
</ha-sub-menu>`
: nothing
@ -732,7 +732,7 @@ class HaSceneDashboard extends SubscribeMixin(LitElement) {
${
this.narrow || labelsInOverflow
? html`<ha-sub-menu>
<ha-menu-item slot="item">
<ha-md-menu-item slot="item">
<div slot="headline">
${this.hass.localize(
"ui.panel.config.automation.picker.bulk_actions.add_label"
@ -742,7 +742,7 @@ class HaSceneDashboard extends SubscribeMixin(LitElement) {
slot="end"
.path=${mdiChevronRight}
></ha-svg-icon>
</ha-menu-item>
</ha-md-menu-item>
<ha-menu slot="menu">${labelItems}</ha-menu>
</ha-sub-menu>`
: nothing
@ -750,7 +750,7 @@ class HaSceneDashboard extends SubscribeMixin(LitElement) {
${
this.narrow || areasInOverflow
? html`<ha-sub-menu>
<ha-menu-item slot="item">
<ha-md-menu-item slot="item">
<div slot="headline">
${this.hass.localize(
"ui.panel.config.devices.picker.bulk_actions.move_area"
@ -760,12 +760,12 @@ class HaSceneDashboard extends SubscribeMixin(LitElement) {
slot="end"
.path=${mdiChevronRight}
></ha-svg-icon>
</ha-menu-item>
</ha-md-menu-item>
<ha-menu slot="menu">${areaItems}</ha-menu>
</ha-sub-menu>`
: nothing
}
</ha-button-menu-new>`
</ha-md-button-menu>`
: nothing}
${!this.scenes.length
? html`<div class="empty" slot="empty">
@ -1204,7 +1204,7 @@ ${rejected
ha-assist-chip {
--ha-assist-chip-container-shape: 10px;
}
ha-button-menu-new ha-assist-chip {
ha-md-button-menu ha-assist-chip {
--md-assist-chip-trailing-space: 8px;
}
ha-label {

View File

@ -59,7 +59,7 @@ import "../../../components/ha-filter-floor-areas";
import "../../../components/ha-filter-labels";
import "../../../components/ha-icon-button";
import "../../../components/ha-icon-overflow-menu";
import "../../../components/ha-menu-item";
import "../../../components/ha-md-menu-item";
import "../../../components/ha-sub-menu";
import "../../../components/ha-svg-icon";
import { createAreaRegistryEntry } from "../../../data/area_registry";
@ -413,7 +413,7 @@ class HaScriptPicker extends SubscribeMixin(LitElement) {
protected render(): TemplateResult {
const categoryItems = html`${this._categories?.map(
(category) =>
html`<ha-menu-item
html`<ha-md-menu-item
.value=${category.category_id}
@click=${this._handleBulkCategory}
>
@ -421,20 +421,20 @@ class HaScriptPicker extends SubscribeMixin(LitElement) {
? html`<ha-icon slot="start" .icon=${category.icon}></ha-icon>`
: html`<ha-svg-icon slot="start" .path=${mdiTag}></ha-svg-icon>`}
<div slot="headline">${category.name}</div>
</ha-menu-item>`
</ha-md-menu-item>`
)}
<ha-menu-item .value=${null} @click=${this._handleBulkCategory}>
<ha-md-menu-item .value=${null} @click=${this._handleBulkCategory}>
<div slot="headline">
${this.hass.localize(
"ui.panel.config.automation.picker.bulk_actions.no_category"
)}
</div> </ha-menu-item
</div> </ha-md-menu-item
><md-divider role="separator" tabindex="-1"></md-divider>
<ha-menu-item @click=${this._bulkCreateCategory}>
<ha-md-menu-item @click=${this._bulkCreateCategory}>
<div slot="headline">
${this.hass.localize("ui.panel.config.category.editor.add")}
</div>
</ha-menu-item>`;
</ha-md-menu-item>`;
const labelItems = html`${this._labels?.map((label) => {
const color = label.color ? computeCssColor(label.color) : undefined;
@ -446,7 +446,7 @@ class HaScriptPicker extends SubscribeMixin(LitElement) {
this._selected.some((entityId) =>
this.hass.entities[entityId]?.labels.includes(label.label_id)
);
return html`<ha-menu-item
return html`<ha-md-menu-item
.value=${label.label_id}
.action=${selected ? "remove" : "add"}
@click=${this._handleBulkLabel}
@ -464,18 +464,18 @@ class HaScriptPicker extends SubscribeMixin(LitElement) {
: nothing}
${label.name}
</ha-label>
</ha-menu-item>`;
</ha-md-menu-item>`;
})}
<md-divider role="separator" tabindex="-1"></md-divider>
<ha-menu-item @click=${this._bulkCreateLabel}>
<ha-md-menu-item @click=${this._bulkCreateLabel}>
<div slot="headline">
${this.hass.localize("ui.panel.config.labels.add_label")}
</div></ha-menu-item
</div></ha-md-menu-item
>`;
const areaItems = html`${Object.values(this.hass.areas).map(
(area) =>
html`<ha-menu-item
html`<ha-md-menu-item
.value=${area.area_id}
@click=${this._handleBulkArea}
>
@ -486,23 +486,23 @@ class HaScriptPicker extends SubscribeMixin(LitElement) {
.path=${mdiTextureBox}
></ha-svg-icon>`}
<div slot="headline">${area.name}</div>
</ha-menu-item>`
</ha-md-menu-item>`
)}
<ha-menu-item .value=${null} @click=${this._handleBulkArea}>
<ha-md-menu-item .value=${null} @click=${this._handleBulkArea}>
<div slot="headline">
${this.hass.localize(
"ui.panel.config.devices.picker.bulk_actions.no_area"
)}
</div>
</ha-menu-item>
</ha-md-menu-item>
<md-divider role="separator" tabindex="-1"></md-divider>
<ha-menu-item @click=${this._bulkCreateArea}>
<ha-md-menu-item @click=${this._bulkCreateArea}>
<div slot="headline">
${this.hass.localize(
"ui.panel.config.devices.picker.bulk_actions.add_area"
)}
</div>
</ha-menu-item>`;
</ha-md-menu-item>`;
const areasInOverflow =
(this._sizeController.value && this._sizeController.value < 900) ||
@ -635,7 +635,7 @@ class HaScriptPicker extends SubscribeMixin(LitElement) {
></ha-filter-blueprints>
${!this.narrow
? html`<ha-button-menu-new slot="selection-bar">
? html`<ha-md-button-menu slot="selection-bar">
<ha-assist-chip
slot="trigger"
.label=${this.hass.localize(
@ -648,10 +648,10 @@ class HaScriptPicker extends SubscribeMixin(LitElement) {
></ha-svg-icon>
</ha-assist-chip>
${categoryItems}
</ha-button-menu-new>
</ha-md-button-menu>
${labelsInOverflow
? nothing
: html`<ha-button-menu-new slot="selection-bar">
: html`<ha-md-button-menu slot="selection-bar">
<ha-assist-chip
slot="trigger"
.label=${this.hass.localize(
@ -664,10 +664,10 @@ class HaScriptPicker extends SubscribeMixin(LitElement) {
></ha-svg-icon>
</ha-assist-chip>
${labelItems}
</ha-button-menu-new>`}
</ha-md-button-menu>`}
${areasInOverflow
? nothing
: html`<ha-button-menu-new slot="selection-bar">
: html`<ha-md-button-menu slot="selection-bar">
<ha-assist-chip
slot="trigger"
.label=${this.hass.localize(
@ -680,11 +680,11 @@ class HaScriptPicker extends SubscribeMixin(LitElement) {
></ha-svg-icon>
</ha-assist-chip>
${areaItems}
</ha-button-menu-new>`}`
</ha-md-button-menu>`}`
: nothing}
${this.narrow || areasInOverflow
? html`
<ha-button-menu-new has-overflow slot="selection-bar">
<ha-md-button-menu has-overflow slot="selection-bar">
${
this.narrow
? html`<ha-assist-chip
@ -712,7 +712,7 @@ class HaScriptPicker extends SubscribeMixin(LitElement) {
${
this.narrow
? html`<ha-sub-menu>
<ha-menu-item slot="item">
<ha-md-menu-item slot="item">
<div slot="headline">
${this.hass.localize(
"ui.panel.config.automation.picker.bulk_actions.move_category"
@ -722,7 +722,7 @@ class HaScriptPicker extends SubscribeMixin(LitElement) {
slot="end"
.path=${mdiChevronRight}
></ha-svg-icon>
</ha-menu-item>
</ha-md-menu-item>
<ha-menu slot="menu">${categoryItems}</ha-menu>
</ha-sub-menu>`
: nothing
@ -730,7 +730,7 @@ class HaScriptPicker extends SubscribeMixin(LitElement) {
${
this.narrow || labelsInOverflow
? html`<ha-sub-menu>
<ha-menu-item slot="item">
<ha-md-menu-item slot="item">
<div slot="headline">
${this.hass.localize(
"ui.panel.config.automation.picker.bulk_actions.add_label"
@ -740,7 +740,7 @@ class HaScriptPicker extends SubscribeMixin(LitElement) {
slot="end"
.path=${mdiChevronRight}
></ha-svg-icon>
</ha-menu-item>
</ha-md-menu-item>
<ha-menu slot="menu">${labelItems}</ha-menu>
</ha-sub-menu>`
: nothing
@ -748,7 +748,7 @@ class HaScriptPicker extends SubscribeMixin(LitElement) {
${
this.narrow || areasInOverflow
? html`<ha-sub-menu>
<ha-menu-item slot="item">
<ha-md-menu-item slot="item">
<div slot="headline">
${this.hass.localize(
"ui.panel.config.devices.picker.bulk_actions.move_area"
@ -758,12 +758,12 @@ class HaScriptPicker extends SubscribeMixin(LitElement) {
slot="end"
.path=${mdiChevronRight}
></ha-svg-icon>
</ha-menu-item>
</ha-md-menu-item>
<ha-menu slot="menu">${areaItems}</ha-menu>
</ha-sub-menu>`
: nothing
}
</ha-button-menu-new>`
</ha-md-button-menu>`
: nothing}
${!this.scripts.length
? html` <div class="empty" slot="empty">
@ -1295,7 +1295,7 @@ ${rejected
ha-assist-chip {
--ha-assist-chip-container-shape: 10px;
}
ha-button-menu-new ha-assist-chip {
ha-md-button-menu ha-assist-chip {
--md-assist-chip-trailing-space: 8px;
}
ha-label {