mirror of
https://github.com/home-assistant/frontend.git
synced 2025-12-20 15:07:21 +00:00
Compare commits
14 Commits
disable-cr
...
dev
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
bd46c358fb | ||
|
|
30b8ea1ae8 | ||
|
|
a24dacf50d | ||
|
|
7cbd07e33e | ||
|
|
c72ad83532 | ||
|
|
f2aba45dfe | ||
|
|
639c2ce077 | ||
|
|
1bddc02ae0 | ||
|
|
ebea5176e2 | ||
|
|
39f550cf9f | ||
|
|
cdcbd00a92 | ||
|
|
86cd0e81ad | ||
|
|
6efe444af3 | ||
|
|
09c9665b2f |
@@ -1,3 +0,0 @@
|
||||
issue_enrichment:
|
||||
auto_enrich:
|
||||
enabled: false
|
||||
2
.github/copilot-instructions.md
vendored
2
.github/copilot-instructions.md
vendored
@@ -154,7 +154,7 @@ try {
|
||||
|
||||
- **Use CSS custom properties**: Leverage the theme system
|
||||
- **Use spacing tokens**: Prefer `--ha-space-*` tokens over hardcoded values for consistent spacing
|
||||
- Spacing scale: `--ha-space-0` (0px) through `--ha-space-20` (80px) in 4px increments
|
||||
- Spacing scale: `--ha-space-1` (4px) through `--ha-space-20` (80px) in 4px increments
|
||||
- Defined in `src/resources/theme/core.globals.ts`
|
||||
- Common values: `--ha-space-2` (8px), `--ha-space-4` (16px), `--ha-space-8` (32px)
|
||||
- **Mobile-first responsive**: Design for mobile, enhance for desktop
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
compressionLevel: mixed
|
||||
|
||||
npmMinimalAgeGate: "3d"
|
||||
|
||||
defaultSemverRangePrefix: ""
|
||||
|
||||
enableGlobalCache: false
|
||||
|
||||
@@ -20,8 +20,6 @@ module.exports.ignorePackages = () => [];
|
||||
// Files from NPM packages that we should replace with empty file
|
||||
module.exports.emptyPackages = ({ isHassioBuild, isLandingPageBuild }) =>
|
||||
[
|
||||
require.resolve("@vaadin/vaadin-material-styles/typography.js"),
|
||||
require.resolve("@vaadin/vaadin-material-styles/font-icons.js"),
|
||||
// Icons in supervisor conflict with icons in HA so we don't load.
|
||||
(isHassioBuild || isLandingPageBuild) &&
|
||||
require.resolve(
|
||||
|
||||
@@ -168,12 +168,16 @@ const createRspackConfig = ({
|
||||
);
|
||||
},
|
||||
}),
|
||||
new rspack.NormalModuleReplacementPlugin(
|
||||
new RegExp(
|
||||
bundle.emptyPackages({ isHassioBuild, isLandingPageBuild }).join("|")
|
||||
),
|
||||
path.resolve(paths.root_dir, "src/util/empty.js")
|
||||
),
|
||||
bundle.emptyPackages({ isHassioBuild, isLandingPageBuild }).length
|
||||
? new rspack.NormalModuleReplacementPlugin(
|
||||
new RegExp(
|
||||
bundle
|
||||
.emptyPackages({ isHassioBuild, isLandingPageBuild })
|
||||
.join("|")
|
||||
),
|
||||
path.resolve(paths.root_dir, "src/util/empty.js")
|
||||
)
|
||||
: false,
|
||||
!isProdBuild && new LogStartCompilePlugin(),
|
||||
isProdBuild &&
|
||||
new StatsWriterPlugin({
|
||||
@@ -217,6 +221,42 @@ const createRspackConfig = ({
|
||||
"@lit-labs/virtualizer/polyfills/resize-observer-polyfill/ResizeObserver.js",
|
||||
"@lit-labs/observers/resize-controller":
|
||||
"@lit-labs/observers/resize-controller.js",
|
||||
"@formatjs/intl-durationformat/should-polyfill$":
|
||||
"@formatjs/intl-durationformat/should-polyfill.js",
|
||||
"@formatjs/intl-durationformat/polyfill-force$":
|
||||
"@formatjs/intl-durationformat/polyfill-force.js",
|
||||
"@formatjs/intl-datetimeformat/should-polyfill":
|
||||
"@formatjs/intl-datetimeformat/should-polyfill.js",
|
||||
"@formatjs/intl-datetimeformat/polyfill-force":
|
||||
"@formatjs/intl-datetimeformat/polyfill-force.js",
|
||||
"@formatjs/intl-displaynames/should-polyfill":
|
||||
"@formatjs/intl-displaynames/should-polyfill.js",
|
||||
"@formatjs/intl-displaynames/polyfill-force":
|
||||
"@formatjs/intl-displaynames/polyfill-force.js",
|
||||
"@formatjs/intl-getcanonicallocales/should-polyfill":
|
||||
"@formatjs/intl-getcanonicallocales/should-polyfill.js",
|
||||
"@formatjs/intl-getcanonicallocales/polyfill-force":
|
||||
"@formatjs/intl-getcanonicallocales/polyfill-force.js",
|
||||
"@formatjs/intl-listformat/should-polyfill":
|
||||
"@formatjs/intl-listformat/should-polyfill.js",
|
||||
"@formatjs/intl-listformat/polyfill-force":
|
||||
"@formatjs/intl-listformat/polyfill-force.js",
|
||||
"@formatjs/intl-locale/should-polyfill":
|
||||
"@formatjs/intl-locale/should-polyfill.js",
|
||||
"@formatjs/intl-locale/polyfill-force":
|
||||
"@formatjs/intl-locale/polyfill-force.js",
|
||||
"@formatjs/intl-numberformat/should-polyfill":
|
||||
"@formatjs/intl-numberformat/should-polyfill.js",
|
||||
"@formatjs/intl-numberformat/polyfill-force":
|
||||
"@formatjs/intl-numberformat/polyfill-force.js",
|
||||
"@formatjs/intl-pluralrules/should-polyfill":
|
||||
"@formatjs/intl-pluralrules/should-polyfill.js",
|
||||
"@formatjs/intl-pluralrules/polyfill-force":
|
||||
"@formatjs/intl-pluralrules/polyfill-force.js",
|
||||
"@formatjs/intl-relativetimeformat/should-polyfill":
|
||||
"@formatjs/intl-relativetimeformat/should-polyfill.js",
|
||||
"@formatjs/intl-relativetimeformat/polyfill-force":
|
||||
"@formatjs/intl-relativetimeformat/polyfill-force.js",
|
||||
},
|
||||
},
|
||||
output: {
|
||||
|
||||
@@ -40,6 +40,9 @@ const ENTITIES = [
|
||||
getEntity("switch", "coffee", "off", {
|
||||
friendly_name: "Coffee",
|
||||
}),
|
||||
getEntity("number", "number", 5, {
|
||||
friendly_name: "Number",
|
||||
}),
|
||||
];
|
||||
|
||||
const DEVICES: DeviceRegistryEntry[] = [
|
||||
@@ -377,6 +380,33 @@ const SCHEMAS: {
|
||||
name: "Constant",
|
||||
selector: { constant: { value: true, label: "Yes!" } },
|
||||
},
|
||||
choose: {
|
||||
name: "Choose",
|
||||
selector: {
|
||||
choose: {
|
||||
choices: {
|
||||
number: {
|
||||
selector: {
|
||||
number: {
|
||||
min: 0,
|
||||
max: 100,
|
||||
step: 0.1,
|
||||
},
|
||||
},
|
||||
},
|
||||
entity: {
|
||||
selector: {
|
||||
entity: {
|
||||
filter: {
|
||||
domain: "number",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
|
||||
32
package.json
32
package.json
@@ -29,7 +29,7 @@
|
||||
"@babel/runtime": "7.28.4",
|
||||
"@braintree/sanitize-url": "7.1.1",
|
||||
"@codemirror/autocomplete": "6.20.0",
|
||||
"@codemirror/commands": "6.10.0",
|
||||
"@codemirror/commands": "6.10.1",
|
||||
"@codemirror/language": "6.11.3",
|
||||
"@codemirror/legacy-modes": "6.5.2",
|
||||
"@codemirror/search": "6.5.11",
|
||||
@@ -37,15 +37,15 @@
|
||||
"@codemirror/view": "6.39.4",
|
||||
"@date-fns/tz": "1.4.1",
|
||||
"@egjs/hammerjs": "2.0.17",
|
||||
"@formatjs/intl-datetimeformat": "6.18.2",
|
||||
"@formatjs/intl-displaynames": "6.8.13",
|
||||
"@formatjs/intl-durationformat": "0.7.6",
|
||||
"@formatjs/intl-getcanonicallocales": "2.5.6",
|
||||
"@formatjs/intl-listformat": "7.7.13",
|
||||
"@formatjs/intl-locale": "4.2.13",
|
||||
"@formatjs/intl-numberformat": "8.15.6",
|
||||
"@formatjs/intl-pluralrules": "5.4.6",
|
||||
"@formatjs/intl-relativetimeformat": "11.4.13",
|
||||
"@formatjs/intl-datetimeformat": "7.0.2",
|
||||
"@formatjs/intl-displaynames": "7.0.2",
|
||||
"@formatjs/intl-durationformat": "0.8.2",
|
||||
"@formatjs/intl-getcanonicallocales": "3.0.2",
|
||||
"@formatjs/intl-listformat": "8.0.2",
|
||||
"@formatjs/intl-locale": "5.0.2",
|
||||
"@formatjs/intl-numberformat": "9.0.3",
|
||||
"@formatjs/intl-pluralrules": "6.0.2",
|
||||
"@formatjs/intl-relativetimeformat": "12.0.3",
|
||||
"@fullcalendar/core": "6.1.19",
|
||||
"@fullcalendar/daygrid": "6.1.19",
|
||||
"@fullcalendar/interaction": "6.1.19",
|
||||
@@ -89,8 +89,6 @@
|
||||
"@thomasloven/round-slider": "0.6.0",
|
||||
"@tsparticles/engine": "3.9.1",
|
||||
"@tsparticles/preset-links": "3.2.0",
|
||||
"@vaadin/combo-box": "24.9.6",
|
||||
"@vaadin/vaadin-themable-mixin": "24.9.6",
|
||||
"@vibrant/color": "4.0.0",
|
||||
"@vue/web-component-wrapper": "1.3.0",
|
||||
"@webcomponents/scoped-custom-element-registry": "0.0.10",
|
||||
@@ -114,7 +112,7 @@
|
||||
"hls.js": "1.6.15",
|
||||
"home-assistant-js-websocket": "9.6.0",
|
||||
"idb-keyval": "6.2.2",
|
||||
"intl-messageformat": "10.7.18",
|
||||
"intl-messageformat": "11.0.2",
|
||||
"js-yaml": "4.1.1",
|
||||
"leaflet": "1.9.4",
|
||||
"leaflet-draw": "patch:leaflet-draw@npm%3A1.0.4#./.yarn/patches/leaflet-draw-npm-1.0.4-0ca0ebcf65.patch",
|
||||
@@ -158,7 +156,7 @@
|
||||
"@octokit/plugin-retry": "8.0.3",
|
||||
"@octokit/rest": "22.0.1",
|
||||
"@rsdoctor/rspack-plugin": "1.3.16",
|
||||
"@rspack/core": "1.6.7",
|
||||
"@rspack/core": "1.6.8",
|
||||
"@rspack/dev-server": "1.1.4",
|
||||
"@types/babel__plugin-transform-runtime": "7.9.5",
|
||||
"@types/chromecast-caf-receiver": "6.0.25",
|
||||
@@ -178,7 +176,7 @@
|
||||
"@types/tar": "6.1.13",
|
||||
"@types/ua-parser-js": "0.7.39",
|
||||
"@types/webspeechapi": "0.0.29",
|
||||
"@vitest/coverage-v8": "4.0.15",
|
||||
"@vitest/coverage-v8": "4.0.16",
|
||||
"babel-loader": "10.0.0",
|
||||
"babel-plugin-template-html-minifier": "4.1.0",
|
||||
"browserslist-useragent-regexp": "4.1.3",
|
||||
@@ -218,8 +216,8 @@
|
||||
"ts-lit-plugin": "2.0.2",
|
||||
"typescript": "5.9.3",
|
||||
"typescript-eslint": "8.50.0",
|
||||
"vite-tsconfig-paths": "6.0.1",
|
||||
"vitest": "4.0.15",
|
||||
"vite-tsconfig-paths": "6.0.2",
|
||||
"vitest": "4.0.16",
|
||||
"webpack-stats-plugin": "1.1.3",
|
||||
"webpackbar": "7.0.0",
|
||||
"workbox-build": "patch:workbox-build@npm%3A7.1.1#~/.yarn/patches/workbox-build-npm-7.1.1-a854f3faae.patch"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { ComboBoxLitRenderer } from "@vaadin/combo-box/lit";
|
||||
import type { RenderItemFunction } from "@lit-labs/virtualizer/virtualize";
|
||||
import type { HassEntity } from "home-assistant-js-websocket";
|
||||
import { html, LitElement, nothing, type PropertyValues } from "lit";
|
||||
import { customElement, property, query, state } from "lit/decorators";
|
||||
@@ -162,7 +162,7 @@ export class HaDevicePicker extends LitElement {
|
||||
}
|
||||
);
|
||||
|
||||
private _rowRenderer: ComboBoxLitRenderer<DevicePickerItem> = (item) => html`
|
||||
private _rowRenderer: RenderItemFunction<DevicePickerItem> = (item) => html`
|
||||
<ha-combo-box-item type="button">
|
||||
${item.domain
|
||||
? html`
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { RenderItemFunction } from "@lit-labs/virtualizer/virtualize";
|
||||
import { mdiPlus, mdiShape } from "@mdi/js";
|
||||
import type { ComboBoxLitRenderer } from "@vaadin/combo-box/lit";
|
||||
import { html, LitElement, nothing, type PropertyValues } from "lit";
|
||||
import { customElement, property, query } from "lit/decorators";
|
||||
import memoizeOne from "memoize-one";
|
||||
@@ -172,9 +172,9 @@ export class HaEntityPicker extends LitElement {
|
||||
return this.showEntityId || this.hass.userData?.showEntityIdPicker;
|
||||
}
|
||||
|
||||
private _rowRenderer: ComboBoxLitRenderer<EntityComboBoxItem> = (
|
||||
private _rowRenderer: RenderItemFunction<EntityComboBoxItem> = (
|
||||
item,
|
||||
{ index }
|
||||
index
|
||||
) => {
|
||||
const showEntityId = this._showEntityId;
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { RenderItemFunction } from "@lit-labs/virtualizer/virtualize";
|
||||
import { mdiChartLine, mdiHelpCircle, mdiShape } from "@mdi/js";
|
||||
import type { ComboBoxLitRenderer } from "@vaadin/combo-box/lit";
|
||||
import type { HassEntity } from "home-assistant-js-websocket";
|
||||
import { html, LitElement, nothing, type PropertyValues } from "lit";
|
||||
import { customElement, property, query } from "lit/decorators";
|
||||
@@ -424,9 +424,9 @@ export class HaStatisticPicker extends LitElement {
|
||||
};
|
||||
}
|
||||
|
||||
private _rowRenderer: ComboBoxLitRenderer<StatisticComboBoxItem> = (
|
||||
private _rowRenderer: RenderItemFunction<StatisticComboBoxItem> = (
|
||||
item,
|
||||
{ index }
|
||||
index
|
||||
) => {
|
||||
const showEntityId = this.hass.userData?.showEntityIdPicker;
|
||||
return html`
|
||||
|
||||
@@ -175,7 +175,7 @@ export class HaAutomationRow extends LitElement {
|
||||
::slotted([slot="header"]) {
|
||||
flex: 1;
|
||||
overflow-wrap: anywhere;
|
||||
margin: var(--ha-space-0) var(--ha-space-3);
|
||||
margin: 0 var(--ha-space-3);
|
||||
}
|
||||
.icons {
|
||||
display: flex;
|
||||
|
||||
@@ -241,7 +241,7 @@ export class HaBottomSheet extends ScrollableFadeMixin(LitElement) {
|
||||
}
|
||||
slot[name="footer"] {
|
||||
display: block;
|
||||
padding: var(--ha-space-0);
|
||||
padding: 0;
|
||||
}
|
||||
::slotted([slot="footer"]) {
|
||||
display: flex;
|
||||
|
||||
@@ -46,14 +46,14 @@ export class HaCard extends LitElement {
|
||||
line-height: var(--ha-line-height-expanded);
|
||||
padding: var(--ha-space-3) var(--ha-space-4) var(--ha-space-4);
|
||||
display: block;
|
||||
margin-block-start: var(--ha-space-0);
|
||||
margin-block-end: var(--ha-space-0);
|
||||
margin-block-start: 0;
|
||||
margin-block-end: 0;
|
||||
font-weight: var(--ha-font-weight-normal);
|
||||
}
|
||||
|
||||
:host ::slotted(.card-content:not(:first-child)),
|
||||
slot:not(:first-child)::slotted(.card-content) {
|
||||
padding-top: var(--ha-space-0);
|
||||
padding-top: 0;
|
||||
margin-top: calc(var(--ha-space-2) * -1);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,433 +0,0 @@
|
||||
import { mdiClose, mdiMenuDown, mdiMenuUp } from "@mdi/js";
|
||||
import type { ComboBoxLitRenderer } from "@vaadin/combo-box/lit";
|
||||
import { comboBoxRenderer } from "@vaadin/combo-box/lit";
|
||||
import "@vaadin/combo-box/theme/material/vaadin-combo-box-light";
|
||||
import type {
|
||||
ComboBoxDataProvider,
|
||||
ComboBoxLight,
|
||||
ComboBoxLightFilterChangedEvent,
|
||||
ComboBoxLightOpenedChangedEvent,
|
||||
ComboBoxLightValueChangedEvent,
|
||||
} from "@vaadin/combo-box/vaadin-combo-box-light";
|
||||
import { registerStyles } from "@vaadin/vaadin-themable-mixin/register-styles";
|
||||
import type { TemplateResult } from "lit";
|
||||
import { css, html, LitElement } from "lit";
|
||||
import { customElement, property, query, state } from "lit/decorators";
|
||||
import { ifDefined } from "lit/directives/if-defined";
|
||||
import { fireEvent } from "../common/dom/fire_event";
|
||||
import type { HomeAssistant } from "../types";
|
||||
import "./ha-combo-box-item";
|
||||
import "./ha-combo-box-textfield";
|
||||
import "./ha-icon-button";
|
||||
import "./ha-input-helper-text";
|
||||
import "./ha-textfield";
|
||||
import type { HaTextField } from "./ha-textfield";
|
||||
|
||||
registerStyles(
|
||||
"vaadin-combo-box-item",
|
||||
css`
|
||||
:host {
|
||||
padding: 0 !important;
|
||||
}
|
||||
:host([focused]:not([disabled])) {
|
||||
background-color: rgba(var(--rgb-primary-text-color, 0, 0, 0), 0.12);
|
||||
}
|
||||
:host([selected]:not([disabled])) {
|
||||
background-color: transparent;
|
||||
color: var(--mdc-theme-primary);
|
||||
--mdc-ripple-color: var(--mdc-theme-primary);
|
||||
--mdc-theme-text-primary-on-background: var(--mdc-theme-primary);
|
||||
}
|
||||
:host([selected]:not([disabled])):before {
|
||||
background-color: var(--mdc-theme-primary);
|
||||
opacity: 0.12;
|
||||
content: "";
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
:host([selected][focused]:not([disabled])):before {
|
||||
opacity: 0.24;
|
||||
}
|
||||
:host(:hover:not([disabled])) {
|
||||
background-color: transparent;
|
||||
}
|
||||
[part="content"] {
|
||||
width: 100%;
|
||||
}
|
||||
[part="checkmark"] {
|
||||
display: none;
|
||||
}
|
||||
`
|
||||
);
|
||||
|
||||
@customElement("ha-combo-box")
|
||||
export class HaComboBox extends LitElement {
|
||||
@property({ attribute: false }) public hass?: HomeAssistant;
|
||||
|
||||
@property() public label?: string;
|
||||
|
||||
@property() public value?: string;
|
||||
|
||||
@property() public placeholder?: string;
|
||||
|
||||
@property({ attribute: false }) public validationMessage?: string;
|
||||
|
||||
@property() public helper?: string;
|
||||
|
||||
@property({ attribute: "error-message" }) public errorMessage?: string;
|
||||
|
||||
@property({ type: Boolean }) public invalid = false;
|
||||
|
||||
@property({ type: Boolean }) public icon = false;
|
||||
|
||||
@property({ attribute: false }) public items?: any[];
|
||||
|
||||
@property({ attribute: false }) public filteredItems?: any[];
|
||||
|
||||
@property({ attribute: false })
|
||||
public dataProvider?: ComboBoxDataProvider<any>;
|
||||
|
||||
@property({ attribute: "allow-custom-value", type: Boolean })
|
||||
public allowCustomValue = false;
|
||||
|
||||
@property({ attribute: "item-value-path" }) public itemValuePath = "value";
|
||||
|
||||
@property({ attribute: "item-label-path" }) public itemLabelPath = "label";
|
||||
|
||||
@property({ attribute: "item-id-path" }) public itemIdPath?: string;
|
||||
|
||||
@property({ attribute: false }) public renderer?: ComboBoxLitRenderer<any>;
|
||||
|
||||
@property({ type: Boolean }) public disabled = false;
|
||||
|
||||
@property({ type: Boolean }) public required = false;
|
||||
|
||||
@property({ type: Boolean, reflect: true }) public opened = false;
|
||||
|
||||
@property({ type: Boolean, attribute: "hide-clear-icon" })
|
||||
public hideClearIcon = false;
|
||||
|
||||
@property({ type: Boolean, attribute: "clear-initial-value" })
|
||||
public clearInitialValue = false;
|
||||
|
||||
@query("vaadin-combo-box-light", true) private _comboBox!: ComboBoxLight;
|
||||
|
||||
@query("ha-combo-box-textfield", true) private _inputElement!: HaTextField;
|
||||
|
||||
@state({ type: Boolean }) private _forceBlankValue = false;
|
||||
|
||||
private _overlayMutationObserver?: MutationObserver;
|
||||
|
||||
private _bodyMutationObserver?: MutationObserver;
|
||||
|
||||
public async open() {
|
||||
await this.updateComplete;
|
||||
this._comboBox?.open();
|
||||
}
|
||||
|
||||
public async focus() {
|
||||
await this.updateComplete;
|
||||
await this._inputElement?.updateComplete;
|
||||
this._inputElement?.focus();
|
||||
}
|
||||
|
||||
public disconnectedCallback() {
|
||||
super.disconnectedCallback();
|
||||
if (this._overlayMutationObserver) {
|
||||
this._overlayMutationObserver.disconnect();
|
||||
this._overlayMutationObserver = undefined;
|
||||
}
|
||||
if (this._bodyMutationObserver) {
|
||||
this._bodyMutationObserver.disconnect();
|
||||
this._bodyMutationObserver = undefined;
|
||||
}
|
||||
}
|
||||
|
||||
public get selectedItem() {
|
||||
return this._comboBox.selectedItem;
|
||||
}
|
||||
|
||||
public setInputValue(value: string) {
|
||||
this._comboBox.value = value;
|
||||
}
|
||||
|
||||
public setTextFieldValue(value: string) {
|
||||
this._inputElement.value = value;
|
||||
}
|
||||
|
||||
protected render(): TemplateResult {
|
||||
return html`
|
||||
<!-- @ts-ignore Tag definition is not included in theme folder -->
|
||||
<vaadin-combo-box-light
|
||||
.itemValuePath=${this.itemValuePath}
|
||||
.itemIdPath=${this.itemIdPath}
|
||||
.itemLabelPath=${this.itemLabelPath}
|
||||
.items=${this.items}
|
||||
.value=${this.value || ""}
|
||||
.filteredItems=${this.filteredItems}
|
||||
.dataProvider=${this.dataProvider}
|
||||
.allowCustomValue=${this.allowCustomValue}
|
||||
.disabled=${this.disabled}
|
||||
.required=${this.required}
|
||||
${comboBoxRenderer(this.renderer || this._defaultRowRenderer)}
|
||||
@opened-changed=${this._openedChanged}
|
||||
@filter-changed=${this._filterChanged}
|
||||
@value-changed=${this._valueChanged}
|
||||
attr-for-value="value"
|
||||
>
|
||||
<ha-combo-box-textfield
|
||||
label=${ifDefined(this.label)}
|
||||
placeholder=${ifDefined(this.placeholder)}
|
||||
?disabled=${this.disabled}
|
||||
?required=${this.required}
|
||||
validationMessage=${ifDefined(this.validationMessage)}
|
||||
.errorMessage=${this.errorMessage}
|
||||
class="input"
|
||||
autocapitalize="none"
|
||||
autocomplete="off"
|
||||
.autocorrect=${false}
|
||||
input-spellcheck="false"
|
||||
.suffix=${html`<div
|
||||
style="width: 28px;"
|
||||
role="none presentation"
|
||||
></div>`}
|
||||
.icon=${this.icon}
|
||||
.invalid=${this.invalid}
|
||||
.forceBlankValue=${this._forceBlankValue}
|
||||
>
|
||||
<slot name="icon" slot="leadingIcon"></slot>
|
||||
</ha-combo-box-textfield>
|
||||
${this.value && !this.hideClearIcon
|
||||
? html`<ha-svg-icon
|
||||
role="button"
|
||||
tabindex="-1"
|
||||
aria-label=${ifDefined(this.hass?.localize("ui.common.clear"))}
|
||||
class=${`clear-button ${this.label ? "" : "no-label"}`}
|
||||
.path=${mdiClose}
|
||||
?disabled=${this.disabled}
|
||||
@click=${this._clearValue}
|
||||
></ha-svg-icon>`
|
||||
: ""}
|
||||
<ha-svg-icon
|
||||
role="button"
|
||||
tabindex="-1"
|
||||
aria-label=${ifDefined(this.label)}
|
||||
aria-expanded=${this.opened ? "true" : "false"}
|
||||
class=${`toggle-button ${this.label ? "" : "no-label"}`}
|
||||
.path=${this.opened ? mdiMenuUp : mdiMenuDown}
|
||||
?disabled=${this.disabled}
|
||||
@click=${this._toggleOpen}
|
||||
></ha-svg-icon>
|
||||
</vaadin-combo-box-light>
|
||||
${this._renderHelper()}
|
||||
`;
|
||||
}
|
||||
|
||||
private _renderHelper() {
|
||||
return this.helper
|
||||
? html`<ha-input-helper-text .disabled=${this.disabled}
|
||||
>${this.helper}</ha-input-helper-text
|
||||
>`
|
||||
: "";
|
||||
}
|
||||
|
||||
private _defaultRowRenderer: ComboBoxLitRenderer<
|
||||
string | Record<string, any>
|
||||
> = (item) => html`
|
||||
<ha-combo-box-item type="button">
|
||||
${this.itemLabelPath ? item[this.itemLabelPath] : item}
|
||||
</ha-combo-box-item>
|
||||
`;
|
||||
|
||||
private _clearValue(ev: Event) {
|
||||
ev.stopPropagation();
|
||||
fireEvent(this, "value-changed", { value: undefined });
|
||||
}
|
||||
|
||||
private _toggleOpen(ev: Event) {
|
||||
if (this.opened) {
|
||||
this._comboBox?.close();
|
||||
ev.stopPropagation();
|
||||
} else {
|
||||
this._comboBox?.inputElement.focus();
|
||||
}
|
||||
}
|
||||
|
||||
private _openedChanged(ev: ComboBoxLightOpenedChangedEvent) {
|
||||
ev.stopPropagation();
|
||||
const opened = ev.detail.value;
|
||||
// delay this so we can handle click event for toggle button before setting _opened
|
||||
setTimeout(() => {
|
||||
this.opened = opened;
|
||||
fireEvent(this, "opened-changed", { value: ev.detail.value });
|
||||
}, 0);
|
||||
|
||||
if (this.clearInitialValue) {
|
||||
this.setTextFieldValue("");
|
||||
if (opened) {
|
||||
// Wait 100ms to be sure vaddin-combo-box-light already tried to set the value
|
||||
setTimeout(() => {
|
||||
this._forceBlankValue = false;
|
||||
}, 100);
|
||||
} else {
|
||||
this._forceBlankValue = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (opened) {
|
||||
const overlay = document.querySelector<HTMLElement>(
|
||||
"vaadin-combo-box-overlay"
|
||||
);
|
||||
|
||||
if (overlay) {
|
||||
this._removeInert(overlay);
|
||||
}
|
||||
this._observeBody();
|
||||
} else {
|
||||
this._bodyMutationObserver?.disconnect();
|
||||
this._bodyMutationObserver = undefined;
|
||||
}
|
||||
}
|
||||
|
||||
private _observeBody() {
|
||||
if ("MutationObserver" in window && !this._bodyMutationObserver) {
|
||||
this._bodyMutationObserver = new MutationObserver((mutations) => {
|
||||
mutations.forEach((mutation) => {
|
||||
mutation.addedNodes.forEach((node) => {
|
||||
if (node.nodeName === "VAADIN-COMBO-BOX-OVERLAY") {
|
||||
this._removeInert(node as HTMLElement);
|
||||
}
|
||||
});
|
||||
mutation.removedNodes.forEach((node) => {
|
||||
if (node.nodeName === "VAADIN-COMBO-BOX-OVERLAY") {
|
||||
this._overlayMutationObserver?.disconnect();
|
||||
this._overlayMutationObserver = undefined;
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
this._bodyMutationObserver.observe(document.body, {
|
||||
childList: true,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private _removeInert(overlay: HTMLElement) {
|
||||
if (overlay.inert) {
|
||||
overlay.inert = false;
|
||||
this._overlayMutationObserver?.disconnect();
|
||||
this._overlayMutationObserver = undefined;
|
||||
return;
|
||||
}
|
||||
if ("MutationObserver" in window && !this._overlayMutationObserver) {
|
||||
this._overlayMutationObserver = new MutationObserver((mutations) => {
|
||||
mutations.forEach((mutation) => {
|
||||
if (mutation.attributeName === "inert") {
|
||||
const target = mutation.target as HTMLElement;
|
||||
if (target.inert) {
|
||||
this._overlayMutationObserver?.disconnect();
|
||||
this._overlayMutationObserver = undefined;
|
||||
target.inert = false;
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
this._overlayMutationObserver.observe(overlay, {
|
||||
attributes: true,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private _filterChanged(ev: ComboBoxLightFilterChangedEvent) {
|
||||
ev.stopPropagation();
|
||||
fireEvent(this, "filter-changed", { value: ev.detail.value });
|
||||
}
|
||||
|
||||
private _valueChanged(ev: ComboBoxLightValueChangedEvent) {
|
||||
ev.stopPropagation();
|
||||
if (!this.allowCustomValue) {
|
||||
// @ts-ignore
|
||||
this._comboBox._closeOnBlurIsPrevented = true;
|
||||
}
|
||||
if (!this.opened) {
|
||||
return;
|
||||
}
|
||||
const newValue = ev.detail.value;
|
||||
if (newValue !== this.value) {
|
||||
fireEvent(this, "value-changed", { value: newValue || undefined });
|
||||
}
|
||||
}
|
||||
|
||||
static styles = css`
|
||||
:host {
|
||||
display: block;
|
||||
width: 100%;
|
||||
}
|
||||
vaadin-combo-box-light {
|
||||
position: relative;
|
||||
}
|
||||
ha-combo-box-textfield {
|
||||
width: 100%;
|
||||
}
|
||||
ha-combo-box-textfield > ha-icon-button {
|
||||
--mdc-icon-button-size: 24px;
|
||||
padding: 2px;
|
||||
color: var(--secondary-text-color);
|
||||
}
|
||||
ha-svg-icon {
|
||||
color: var(--input-dropdown-icon-color);
|
||||
position: absolute;
|
||||
cursor: pointer;
|
||||
}
|
||||
.toggle-button {
|
||||
right: 12px;
|
||||
top: -10px;
|
||||
inset-inline-start: initial;
|
||||
inset-inline-end: 12px;
|
||||
direction: var(--direction);
|
||||
}
|
||||
:host([opened]) .toggle-button {
|
||||
color: var(--primary-color);
|
||||
}
|
||||
.toggle-button[disabled],
|
||||
.clear-button[disabled] {
|
||||
color: var(--disabled-text-color);
|
||||
pointer-events: none;
|
||||
}
|
||||
.toggle-button.no-label {
|
||||
top: -3px;
|
||||
}
|
||||
.clear-button {
|
||||
--mdc-icon-size: 20px;
|
||||
top: -7px;
|
||||
right: 36px;
|
||||
inset-inline-start: initial;
|
||||
inset-inline-end: 36px;
|
||||
direction: var(--direction);
|
||||
}
|
||||
.clear-button.no-label {
|
||||
top: 0;
|
||||
}
|
||||
ha-input-helper-text {
|
||||
margin-top: 4px;
|
||||
}
|
||||
`;
|
||||
}
|
||||
|
||||
declare global {
|
||||
interface HTMLElementTagNameMap {
|
||||
"ha-combo-box": HaComboBox;
|
||||
}
|
||||
}
|
||||
|
||||
declare global {
|
||||
interface HASSDomEvents {
|
||||
"filter-changed": { value: string };
|
||||
"opened-changed": { value: boolean };
|
||||
}
|
||||
}
|
||||
@@ -101,14 +101,13 @@ export class HaDialog extends DialogBase {
|
||||
}
|
||||
.mdc-dialog__container {
|
||||
align-items: var(--vertical-align-dialog, center);
|
||||
padding: var(--dialog-container-padding, var(--ha-space-0));
|
||||
padding: var(--dialog-container-padding, 0);
|
||||
}
|
||||
.mdc-dialog__title {
|
||||
padding: var(--ha-space-4) var(--ha-space-4) var(--ha-space-0)
|
||||
var(--ha-space-4);
|
||||
padding: var(--ha-space-4) var(--ha-space-4) 0 var(--ha-space-4);
|
||||
}
|
||||
.mdc-dialog__title:has(span) {
|
||||
padding: var(--ha-space-3) var(--ha-space-3) var(--ha-space-0);
|
||||
padding: var(--ha-space-3) var(--ha-space-3) 0;
|
||||
}
|
||||
.mdc-dialog__title::before {
|
||||
content: unset;
|
||||
@@ -136,7 +135,7 @@ export class HaDialog extends DialogBase {
|
||||
--ha-dialog-surface-background,
|
||||
var(--mdc-theme-surface, #fff)
|
||||
);
|
||||
padding: var(--dialog-surface-padding, var(--ha-space-0));
|
||||
padding: var(--dialog-surface-padding, 0);
|
||||
}
|
||||
:host([flexContent]) .mdc-dialog .mdc-dialog__content {
|
||||
display: flex;
|
||||
@@ -168,7 +167,7 @@ export class HaDialog extends DialogBase {
|
||||
}
|
||||
.dialog-actions {
|
||||
inset-inline-start: initial !important;
|
||||
inset-inline-end: var(--ha-space-0) !important;
|
||||
inset-inline-end: 0 !important;
|
||||
direction: var(--direction);
|
||||
}
|
||||
`,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { RenderItemFunction } from "@lit-labs/virtualizer/virtualize";
|
||||
import { mdiPlus, mdiTextureBox } from "@mdi/js";
|
||||
import type { ComboBoxLitRenderer } from "@vaadin/combo-box/lit";
|
||||
import type { HassEntity } from "home-assistant-js-websocket";
|
||||
import type { TemplateResult } from "lit";
|
||||
import { LitElement, html } from "lit";
|
||||
@@ -303,7 +303,7 @@ export class HaFloorPicker extends LitElement {
|
||||
}
|
||||
);
|
||||
|
||||
private _rowRenderer: ComboBoxLitRenderer<FloorComboBoxItem> = (item) => html`
|
||||
private _rowRenderer: RenderItemFunction<FloorComboBoxItem> = (item) => html`
|
||||
<ha-combo-box-item type="button" compact>
|
||||
${item.icon_path
|
||||
? html`
|
||||
|
||||
@@ -393,7 +393,7 @@ export class HaGenericPicker extends PickerMixin(LitElement) {
|
||||
}
|
||||
|
||||
wa-popover {
|
||||
--wa-space-l: var(--ha-space-0);
|
||||
--wa-space-l: 0;
|
||||
}
|
||||
|
||||
wa-popover::part(body) {
|
||||
@@ -418,7 +418,7 @@ export class HaGenericPicker extends PickerMixin(LitElement) {
|
||||
--ha-bottom-sheet-height: calc(100dvh - var(--ha-space-12));
|
||||
--ha-bottom-sheet-max-height: var(--ha-bottom-sheet-height);
|
||||
--ha-bottom-sheet-max-width: 600px;
|
||||
--ha-bottom-sheet-padding: var(--ha-space-0);
|
||||
--ha-bottom-sheet-padding: 0;
|
||||
--ha-bottom-sheet-surface-background: var(--card-background-color);
|
||||
--ha-bottom-sheet-border-radius: var(--ha-border-radius-2xl);
|
||||
}
|
||||
|
||||
@@ -175,10 +175,10 @@ export class HaMdDialog extends Dialog {
|
||||
}
|
||||
|
||||
.container {
|
||||
margin-top: var(--safe-area-inset-top, var(--ha-space-0));
|
||||
margin-bottom: var(--safe-area-inset-bottom, var(--ha-space-0));
|
||||
margin-left: var(--safe-area-inset-left, var(--ha-space-0));
|
||||
margin-right: var(--safe-area-inset-right, var(--ha-space-0));
|
||||
margin-top: var(--safe-area-inset-top, 0);
|
||||
margin-bottom: var(--safe-area-inset-bottom, 0);
|
||||
margin-left: var(--safe-area-inset-left, 0);
|
||||
margin-right: var(--safe-area-inset-right, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
202
src/components/ha-selector/ha-selector-choose.ts
Normal file
202
src/components/ha-selector/ha-selector-choose.ts
Normal file
@@ -0,0 +1,202 @@
|
||||
import type { PropertyValues } from "lit";
|
||||
import { css, html, LitElement, nothing } from "lit";
|
||||
import { customElement, property, state } from "lit/decorators";
|
||||
import memoizeOne from "memoize-one";
|
||||
import { fireEvent } from "../../common/dom/fire_event";
|
||||
import { isTemplate } from "../../common/string/has-template";
|
||||
import type { ChooseSelector, Selector } from "../../data/selector";
|
||||
import type { HomeAssistant } from "../../types";
|
||||
import "../ha-button-toggle-group";
|
||||
import "./ha-selector";
|
||||
|
||||
@customElement("ha-selector-choose")
|
||||
export class HaChooseSelector extends LitElement {
|
||||
@property({ attribute: false }) public hass!: HomeAssistant;
|
||||
|
||||
@property({ attribute: false }) public selector!: ChooseSelector;
|
||||
|
||||
@property() public value?: any;
|
||||
|
||||
@property() public label?: string;
|
||||
|
||||
@property() public helper?: string;
|
||||
|
||||
@property({ attribute: false })
|
||||
public localizeValue?: (key: string) => string;
|
||||
|
||||
@property({ type: Boolean }) public disabled = false;
|
||||
|
||||
@property({ type: Boolean }) public required = true;
|
||||
|
||||
@state() public _activeChoice?: string;
|
||||
|
||||
protected willUpdate(changedProperties: PropertyValues): void {
|
||||
if (
|
||||
changedProperties.has("selector") &&
|
||||
(!this._activeChoice ||
|
||||
!(this._activeChoice in this.selector.choose.choices))
|
||||
) {
|
||||
this._setActiveChoice();
|
||||
}
|
||||
}
|
||||
|
||||
protected render() {
|
||||
if (!this._activeChoice) {
|
||||
return nothing;
|
||||
}
|
||||
|
||||
const selector = this._selector(this._activeChoice);
|
||||
const value = this._value(this._activeChoice);
|
||||
|
||||
return html`<div class="multi-header">
|
||||
<span>${this.label}${this.required ? "*" : ""}</span>
|
||||
<ha-button-toggle-group
|
||||
size="small"
|
||||
.buttons=${this._toggleButtons(
|
||||
this.selector.choose.choices,
|
||||
this.selector.choose.translation_key
|
||||
)}
|
||||
.active=${this._activeChoice}
|
||||
@value-changed=${this._choiceChanged}
|
||||
></ha-button-toggle-group>
|
||||
</div>
|
||||
<ha-selector
|
||||
.hass=${this.hass}
|
||||
.selector=${selector}
|
||||
.value=${value}
|
||||
.disabled=${this.disabled}
|
||||
.required=${this.required}
|
||||
@value-changed=${this._handleValueChanged}
|
||||
.helper=${this.helper}
|
||||
></ha-selector>`;
|
||||
}
|
||||
|
||||
private _toggleButtons = memoizeOne(
|
||||
(choices: ChooseSelector["choose"]["choices"], translationKey?: string) =>
|
||||
Object.keys(choices).map((choice) => ({
|
||||
label:
|
||||
this.localizeValue && translationKey
|
||||
? this.localizeValue(`${translationKey}.choices.${choice}`)
|
||||
: choice,
|
||||
value: choice,
|
||||
}))
|
||||
);
|
||||
|
||||
private _choiceChanged(ev) {
|
||||
ev.stopPropagation();
|
||||
const value =
|
||||
typeof this.value === "object"
|
||||
? this.value
|
||||
: {
|
||||
[this._activeChoice!]: this.value,
|
||||
};
|
||||
this._activeChoice = ev.detail?.value || ev.target.value;
|
||||
fireEvent(this, "value-changed", {
|
||||
value: {
|
||||
...value,
|
||||
active_choice: this._activeChoice,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
private _handleValueChanged(ev: CustomEvent) {
|
||||
ev.stopPropagation();
|
||||
const value = typeof this.value === "object" ? this.value : {};
|
||||
fireEvent(this, "value-changed", {
|
||||
value: {
|
||||
...value,
|
||||
[this._activeChoice!]: ev.detail.value,
|
||||
active_choice: this._activeChoice,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
private _selector(choice?: string): Selector {
|
||||
const choices = this.selector.choose.choices;
|
||||
|
||||
choice = choice || this.value?.active_choice;
|
||||
|
||||
if (choice && choice in choices) {
|
||||
return choices[choice].selector;
|
||||
}
|
||||
|
||||
return choices[Object.keys(choices)[0]].selector;
|
||||
}
|
||||
|
||||
private _value(choice?: string): any {
|
||||
if (!this.value) {
|
||||
return undefined;
|
||||
}
|
||||
return typeof this.value === "object"
|
||||
? this.value[choice || this.value.active_choice]
|
||||
: this.value;
|
||||
}
|
||||
|
||||
private _setActiveChoice() {
|
||||
if (this.value) {
|
||||
if (typeof this.value === "object") {
|
||||
if (this.value.active_choice in this.selector.choose.choices) {
|
||||
this._activeChoice = this.value.active_choice;
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
const typeofValue = typeof this.value;
|
||||
const selectorTypes = Object.values(this.selector.choose.choices).map(
|
||||
(choice) => Object.keys(choice.selector)[0]
|
||||
);
|
||||
if (typeofValue === "number" && selectorTypes.includes("number")) {
|
||||
this._activeChoice = Object.keys(this.selector.choose.choices)[
|
||||
selectorTypes.indexOf("number")
|
||||
];
|
||||
return;
|
||||
}
|
||||
if (
|
||||
typeofValue === "string" &&
|
||||
isTemplate(this.value) &&
|
||||
selectorTypes.includes("template")
|
||||
) {
|
||||
this._activeChoice = Object.keys(this.selector.choose.choices)[
|
||||
selectorTypes.indexOf("template")
|
||||
];
|
||||
return;
|
||||
}
|
||||
if (
|
||||
typeofValue === "string" &&
|
||||
this.value.includes(".") &&
|
||||
selectorTypes.includes("entity")
|
||||
) {
|
||||
this._activeChoice = Object.keys(this.selector.choose.choices)[
|
||||
selectorTypes.indexOf("entity")
|
||||
];
|
||||
return;
|
||||
}
|
||||
if (typeofValue === "string" && selectorTypes.includes("text")) {
|
||||
this._activeChoice = Object.keys(this.selector.choose.choices)[
|
||||
selectorTypes.indexOf("text")
|
||||
];
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
this._activeChoice = Object.keys(this.selector.choose.choices)[0];
|
||||
}
|
||||
|
||||
static styles = css`
|
||||
.multi-header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin-bottom: var(--ha-space-2);
|
||||
}
|
||||
ha-button-toggle-group {
|
||||
display: block;
|
||||
justify-self: end;
|
||||
}
|
||||
`;
|
||||
}
|
||||
|
||||
declare global {
|
||||
interface HTMLElementTagNameMap {
|
||||
"ha-selector-choose": HaChooseSelector;
|
||||
}
|
||||
}
|
||||
@@ -18,6 +18,7 @@ const LOAD_ELEMENTS = {
|
||||
attribute: () => import("./ha-selector-attribute"),
|
||||
assist_pipeline: () => import("./ha-selector-assist-pipeline"),
|
||||
boolean: () => import("./ha-selector-boolean"),
|
||||
choose: () => import("./ha-selector-choose"),
|
||||
color_rgb: () => import("./ha-selector-color-rgb"),
|
||||
condition: () => import("./ha-selector-condition"),
|
||||
config_entry: () => import("./ha-selector-config-entry"),
|
||||
|
||||
@@ -726,6 +726,7 @@ export class HaServiceControl extends LitElement {
|
||||
: undefined}
|
||||
.placeholder=${dataField.default}
|
||||
.localizeValue=${this._localizeValueCallback}
|
||||
.required=${dataField.required}
|
||||
></ha-selector>
|
||||
</ha-settings-row>`
|
||||
: "";
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { RenderItemFunction } from "@lit-labs/virtualizer/virtualize";
|
||||
import { mdiRoomService } from "@mdi/js";
|
||||
import type { ComboBoxLitRenderer } from "@vaadin/combo-box/lit";
|
||||
import { html, LitElement, nothing, type TemplateResult } from "lit";
|
||||
import { customElement, property, query } from "lit/decorators";
|
||||
import memoizeOne from "memoize-one";
|
||||
@@ -56,9 +56,9 @@ class HaServicePicker extends LitElement {
|
||||
getServiceIcons(this.hass);
|
||||
}
|
||||
|
||||
private _rowRenderer: ComboBoxLitRenderer<ServiceComboBoxItem> = (
|
||||
private _rowRenderer: RenderItemFunction<ServiceComboBoxItem> = (
|
||||
item,
|
||||
{ index }
|
||||
index
|
||||
) => html`
|
||||
<ha-combo-box-item type="button" .borderTop=${index !== 0}>
|
||||
<ha-service-icon
|
||||
|
||||
@@ -681,7 +681,7 @@ class HaSidebar extends SubscribeMixin(LitElement) {
|
||||
tooltip.style.display = "block";
|
||||
tooltip.style.position = "fixed";
|
||||
tooltip.style.top = `${top}px`;
|
||||
tooltip.style.left = `calc(${item.offsetLeft + item.clientWidth + 8}px + var(--safe-area-inset-left, var(--ha-space-0)))`;
|
||||
tooltip.style.left = `calc(${item.offsetLeft + item.clientWidth + 8}px + var(--safe-area-inset-left, 0px))`;
|
||||
}
|
||||
|
||||
private _hideTooltip() {
|
||||
@@ -720,14 +720,10 @@ class HaSidebar extends SubscribeMixin(LitElement) {
|
||||
background-color: var(--sidebar-background-color);
|
||||
width: 100%;
|
||||
box-sizing: border-box;
|
||||
padding-bottom: calc(
|
||||
14px + var(--safe-area-inset-bottom, var(--ha-space-0))
|
||||
);
|
||||
padding-bottom: calc(14px + var(--safe-area-inset-bottom, 0px));
|
||||
}
|
||||
.menu {
|
||||
height: calc(
|
||||
var(--header-height) + var(--safe-area-inset-top, var(--ha-space-0))
|
||||
);
|
||||
height: calc(var(--header-height) + var(--safe-area-inset-top, 0px));
|
||||
box-sizing: border-box;
|
||||
display: flex;
|
||||
padding: 0 var(--ha-space-1);
|
||||
@@ -746,16 +742,16 @@ class HaSidebar extends SubscribeMixin(LitElement) {
|
||||
font-size: var(--ha-font-size-xl);
|
||||
align-items: center;
|
||||
padding-left: calc(
|
||||
var(--ha-space-1) + var(--safe-area-inset-left, var(--ha-space-0))
|
||||
var(--ha-space-1) + var(--safe-area-inset-left, 0px)
|
||||
);
|
||||
padding-inline-start: calc(
|
||||
var(--ha-space-1) + var(--safe-area-inset-left, var(--ha-space-0))
|
||||
var(--ha-space-1) + var(--safe-area-inset-left, 0px)
|
||||
);
|
||||
padding-inline-end: initial;
|
||||
padding-top: var(--safe-area-inset-top, var(--ha-space-0));
|
||||
padding-top: var(--safe-area-inset-top, 0px);
|
||||
}
|
||||
:host([expanded]) .menu {
|
||||
width: calc(256px + var(--safe-area-inset-left, var(--ha-space-0)));
|
||||
width: calc(256px + var(--safe-area-inset-left, 0px));
|
||||
}
|
||||
:host([narrow][expanded]) .menu {
|
||||
width: 100%;
|
||||
@@ -771,8 +767,8 @@ class HaSidebar extends SubscribeMixin(LitElement) {
|
||||
display: none;
|
||||
}
|
||||
:host([narrow]) .title {
|
||||
margin: var(--ha-space-0);
|
||||
padding: var(--ha-space-0) var(--ha-space-4);
|
||||
margin: 0;
|
||||
padding: 0 var(--ha-space-4);
|
||||
}
|
||||
:host([expanded]) .title {
|
||||
display: initial;
|
||||
@@ -784,16 +780,13 @@ class HaSidebar extends SubscribeMixin(LitElement) {
|
||||
ha-fade-in,
|
||||
ha-md-list {
|
||||
height: calc(
|
||||
100% - var(--header-height) - var(
|
||||
--safe-area-inset-top,
|
||||
var(--ha-space-0)
|
||||
) -
|
||||
100% - var(--header-height) - var(--safe-area-inset-top, 0px) -
|
||||
132px
|
||||
);
|
||||
}
|
||||
|
||||
ha-fade-in {
|
||||
padding: var(--ha-space-1) var(--ha-space-0);
|
||||
padding: var(--ha-space-1) 0;
|
||||
box-sizing: border-box;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
@@ -803,7 +796,7 @@ class HaSidebar extends SubscribeMixin(LitElement) {
|
||||
ha-md-list {
|
||||
overflow-x: hidden;
|
||||
background: none;
|
||||
margin-left: var(--safe-area-inset-left, var(--ha-space-0));
|
||||
margin-left: var(--safe-area-inset-left, 0px);
|
||||
}
|
||||
|
||||
ha-md-list-item {
|
||||
@@ -825,7 +818,7 @@ class HaSidebar extends SubscribeMixin(LitElement) {
|
||||
width: 248px;
|
||||
}
|
||||
:host([narrow][expanded]) ha-md-list-item {
|
||||
width: calc(240px - var(--safe-area-inset-left, var(--ha-space-0)));
|
||||
width: calc(240px - var(--safe-area-inset-left, 0px));
|
||||
}
|
||||
|
||||
ha-md-list-item.selected {
|
||||
@@ -898,7 +891,7 @@ class HaSidebar extends SubscribeMixin(LitElement) {
|
||||
border-radius: var(--ha-border-radius-md);
|
||||
font-size: 0.65em;
|
||||
line-height: var(--ha-line-height-expanded);
|
||||
padding: var(--ha-space-0) var(--ha-space-1);
|
||||
padding: 0 var(--ha-space-1);
|
||||
}
|
||||
|
||||
ha-md-list-item.user {
|
||||
|
||||
@@ -988,7 +988,7 @@ export class HaTargetPicker extends SubscribeMixin(LitElement) {
|
||||
style=${styleMap({
|
||||
width: "var(--ha-space-12)",
|
||||
position: "absolute",
|
||||
top: "var(--ha-space-0)",
|
||||
top: "0",
|
||||
left: rtl ? undefined : "var(--ha-space-1)",
|
||||
right: rtl ? "var(--ha-space-1)" : undefined,
|
||||
transform: rtl ? "scaleX(-1)" : "",
|
||||
@@ -1092,7 +1092,7 @@ export class HaTargetPicker extends SubscribeMixin(LitElement) {
|
||||
z-index: 2;
|
||||
}
|
||||
.mdc-chip-set {
|
||||
padding: var(--ha-space-1) var(--ha-space-0);
|
||||
padding: var(--ha-space-1) 0;
|
||||
gap: var(--ha-space-2);
|
||||
}
|
||||
|
||||
|
||||
@@ -266,15 +266,15 @@ export class HaWaDialog extends ScrollableFadeMixin(LitElement) {
|
||||
/* Used to offset the dialog from the safe areas when space is limited */
|
||||
transform: translate(
|
||||
calc(
|
||||
var(--safe-area-offset-left, var(--ha-space-0)) - var(
|
||||
var(--safe-area-offset-left, 0px) - var(
|
||||
--safe-area-offset-right,
|
||||
var(--ha-space-0)
|
||||
0px
|
||||
)
|
||||
),
|
||||
calc(
|
||||
var(--safe-area-offset-top, var(--ha-space-0)) - var(
|
||||
var(--safe-area-offset-top, 0px) - var(
|
||||
--safe-area-offset-bottom,
|
||||
var(--ha-space-0)
|
||||
0px
|
||||
)
|
||||
)
|
||||
);
|
||||
@@ -285,7 +285,7 @@ export class HaWaDialog extends ScrollableFadeMixin(LitElement) {
|
||||
|
||||
@media all and (max-width: 450px), all and (max-height: 500px) {
|
||||
:host([type="standard"]) {
|
||||
--ha-dialog-border-radius: var(--ha-space-0);
|
||||
--ha-dialog-border-radius: 0;
|
||||
|
||||
wa-dialog {
|
||||
/* Make the container fill the whole screen width and not the safe width */
|
||||
@@ -372,7 +372,7 @@ export class HaWaDialog extends ScrollableFadeMixin(LitElement) {
|
||||
}
|
||||
|
||||
wa-dialog::part(footer) {
|
||||
padding: var(--ha-space-0);
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
::slotted([slot="footer"]) {
|
||||
|
||||
@@ -89,7 +89,7 @@ export class HaTargetPickerItemGroup extends LitElement {
|
||||
static styles = css`
|
||||
:host {
|
||||
display: block;
|
||||
--expansion-panel-content-padding: var(--ha-space-0);
|
||||
--expansion-panel-content-padding: 0;
|
||||
}
|
||||
ha-expansion-panel::part(summary) {
|
||||
background-color: var(--ha-color-fill-neutral-quiet-resting);
|
||||
@@ -101,7 +101,7 @@ export class HaTargetPickerItemGroup extends LitElement {
|
||||
min-height: unset;
|
||||
}
|
||||
ha-md-list {
|
||||
padding: var(--ha-space-0);
|
||||
padding: 0;
|
||||
}
|
||||
`;
|
||||
}
|
||||
|
||||
@@ -605,8 +605,8 @@ export class HaTargetPickerItemRow extends LitElement {
|
||||
buttonLinkStyle,
|
||||
css`
|
||||
:host {
|
||||
--md-list-item-top-space: var(--ha-space-0);
|
||||
--md-list-item-bottom-space: var(--ha-space-0);
|
||||
--md-list-item-top-space: 0;
|
||||
--md-list-item-bottom-space: 0;
|
||||
--md-list-item-leading-space: var(--ha-space-2);
|
||||
--md-list-item-trailing-space: var(--ha-space-2);
|
||||
--md-list-item-two-line-container-height: 56px;
|
||||
|
||||
@@ -278,8 +278,8 @@ export class HaTargetPickerValueChip extends LitElement {
|
||||
direction: var(--direction);
|
||||
}
|
||||
.expand-btn {
|
||||
margin-right: var(--ha-space-0);
|
||||
margin-inline-end: var(--ha-space-0);
|
||||
margin-right: 0;
|
||||
margin-inline-end: 0;
|
||||
margin-inline-start: initial;
|
||||
}
|
||||
.mdc-chip.area:not(.add),
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { ComboBoxLitRenderer } from "@vaadin/combo-box/lit";
|
||||
import type { RenderItemFunction } from "@lit-labs/virtualizer/virtualize";
|
||||
import type { TemplateResult } from "lit";
|
||||
import { html, LitElement, nothing } from "lit";
|
||||
import { customElement, property } from "lit/decorators";
|
||||
@@ -73,7 +73,7 @@ class HaUserPicker extends LitElement {
|
||||
`;
|
||||
};
|
||||
|
||||
private _rowRenderer: ComboBoxLitRenderer<UserComboBoxItem> = (item) => {
|
||||
private _rowRenderer: RenderItemFunction<UserComboBoxItem> = (item) => {
|
||||
const user = item.user;
|
||||
if (!user) {
|
||||
return html`<ha-combo-box-item type="button" compact>
|
||||
|
||||
@@ -27,6 +27,7 @@ export type Selector =
|
||||
| AttributeSelector
|
||||
| BooleanSelector
|
||||
| ButtonToggleSelector
|
||||
| ChooseSelector
|
||||
| ColorRGBSelector
|
||||
| ColorTempSelector
|
||||
| ConditionSelector
|
||||
@@ -116,6 +117,13 @@ export interface ButtonToggleSelector {
|
||||
} | null;
|
||||
}
|
||||
|
||||
export interface ChooseSelector {
|
||||
choose: {
|
||||
choices: Record<string, { selector: Selector }>;
|
||||
translation_key?: string;
|
||||
};
|
||||
}
|
||||
|
||||
export interface ColorRGBSelector {
|
||||
color_rgb: {} | null;
|
||||
}
|
||||
|
||||
@@ -37,8 +37,8 @@ export class HaMoreInfoControlSelectContainer extends LitElement {
|
||||
overflow: auto;
|
||||
-ms-overflow-style: none; /* IE and Edge */
|
||||
scrollbar-width: none; /* Firefox */
|
||||
margin: -2px -24px;
|
||||
padding: 2px 24px;
|
||||
margin: -2px calc(var(--ha-space-6) * -1);
|
||||
padding: 2px var(--ha-space-6);
|
||||
}
|
||||
.controls-scroll::-webkit-scrollbar {
|
||||
display: none;
|
||||
|
||||
@@ -84,8 +84,8 @@ export class HaMoreInfoStateHeader extends LitElement {
|
||||
font-weight: var(--ha-font-weight-medium);
|
||||
line-height: var(--ha-line-height-normal);
|
||||
letter-spacing: 0.1px;
|
||||
padding: 4px 0;
|
||||
margin-bottom: 20px;
|
||||
padding: var(--ha-space-1) 0;
|
||||
margin-bottom: var(--ha-space-5);
|
||||
cursor: pointer;
|
||||
user-select: none;
|
||||
-webkit-user-select: none;
|
||||
|
||||
@@ -268,14 +268,14 @@ class DialogLightColorFavorite extends LitElement {
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: 24px;
|
||||
padding: var(--ha-space-6);
|
||||
flex: 1;
|
||||
}
|
||||
.modes {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
justify-content: flex-end;
|
||||
padding: 0 24px;
|
||||
padding: 0 var(--ha-space-6);
|
||||
}
|
||||
.wheel {
|
||||
width: 30px;
|
||||
|
||||
@@ -254,14 +254,14 @@ export class HaMoreInfoLightFavoriteColors extends LitElement {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
margin: -8px;
|
||||
margin: calc(var(--ha-space-2) * -1);
|
||||
flex-wrap: wrap;
|
||||
max-width: 250px;
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
.container > * {
|
||||
margin: 8px;
|
||||
margin: var(--ha-space-2);
|
||||
}
|
||||
|
||||
.color {
|
||||
|
||||
@@ -515,7 +515,7 @@ class LightRgbColorPicker extends LitElement {
|
||||
hr {
|
||||
border-color: var(--divider-color);
|
||||
border-bottom: none;
|
||||
margin: 16px 0;
|
||||
margin: var(--ha-space-4) 0;
|
||||
}
|
||||
`,
|
||||
];
|
||||
|
||||
@@ -15,22 +15,22 @@ export const moreInfoControlStyle = css`
|
||||
}
|
||||
|
||||
.controls:not(:last-child) {
|
||||
margin-bottom: 24px;
|
||||
margin-bottom: var(--ha-space-6);
|
||||
}
|
||||
|
||||
.controls > *:not(:last-child) {
|
||||
margin-bottom: 24px;
|
||||
margin-bottom: var(--ha-space-6);
|
||||
}
|
||||
|
||||
.buttons {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
margin-bottom: 12px;
|
||||
margin-bottom: var(--ha-space-3);
|
||||
}
|
||||
|
||||
.buttons > * {
|
||||
margin: 8px;
|
||||
margin: var(--ha-space-2);
|
||||
}
|
||||
|
||||
ha-attributes {
|
||||
@@ -38,6 +38,6 @@ export const moreInfoControlStyle = css`
|
||||
width: 100%;
|
||||
}
|
||||
ha-more-info-control-select-container + ha-attributes:not([empty]) {
|
||||
margin-top: 16px;
|
||||
margin-top: var(--ha-space-4);
|
||||
}
|
||||
`;
|
||||
|
||||
@@ -209,7 +209,7 @@ class MoreInfoSirenAdvancedControls extends LitElement {
|
||||
flex-direction: row;
|
||||
justify-content: center;
|
||||
gap: var(--ha-space-4);
|
||||
margin-top: 16px;
|
||||
margin-top: var(--ha-space-4);
|
||||
}
|
||||
ha-control-button {
|
||||
--control-button-border-radius: var(--ha-border-radius-xl);
|
||||
|
||||
@@ -48,7 +48,7 @@ class MoreInfoViewVoiceAssistants extends LitElement {
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: 24px;
|
||||
padding: var(--ha-space-6);
|
||||
flex: 1;
|
||||
}
|
||||
`,
|
||||
|
||||
@@ -52,7 +52,7 @@ class MoreInfoAutomation extends LitElement {
|
||||
justify-content: space-between;
|
||||
}
|
||||
.actions {
|
||||
margin: 8px 0;
|
||||
margin: var(--ha-space-2) 0;
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
justify-content: center;
|
||||
@@ -60,7 +60,7 @@ class MoreInfoAutomation extends LitElement {
|
||||
hr {
|
||||
border-color: var(--divider-color);
|
||||
border-bottom: none;
|
||||
margin: 16px 0;
|
||||
margin: var(--ha-space-4) 0;
|
||||
}
|
||||
`;
|
||||
}
|
||||
|
||||
@@ -106,7 +106,7 @@ class MoreInfoCamera extends LitElement {
|
||||
flex-wrap: wrap;
|
||||
justify-content: flex-end;
|
||||
box-sizing: border-box;
|
||||
padding: 16px;
|
||||
padding: var(--ha-space-4);
|
||||
z-index: 1;
|
||||
gap: var(--ha-space-2);
|
||||
}
|
||||
|
||||
@@ -511,7 +511,7 @@ class MoreInfoClimate extends LitElement {
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
text-align: center;
|
||||
margin-bottom: 40px;
|
||||
margin-bottom: var(--ha-space-10);
|
||||
}
|
||||
|
||||
.current div {
|
||||
@@ -534,7 +534,7 @@ class MoreInfoClimate extends LitElement {
|
||||
font-size: var(--ha-font-size-m);
|
||||
line-height: var(--ha-line-height-condensed);
|
||||
letter-spacing: 0.4px;
|
||||
margin-bottom: 4px;
|
||||
margin-bottom: var(--ha-space-1);
|
||||
}
|
||||
|
||||
.current .value {
|
||||
@@ -545,7 +545,7 @@ class MoreInfoClimate extends LitElement {
|
||||
}
|
||||
ha-select {
|
||||
width: 100%;
|
||||
margin-top: 8px;
|
||||
margin-top: var(--ha-space-2);
|
||||
}
|
||||
|
||||
.container-humidity .single-row {
|
||||
@@ -561,7 +561,7 @@ class MoreInfoClimate extends LitElement {
|
||||
}
|
||||
|
||||
.single-row {
|
||||
padding: 8px 0;
|
||||
padding: var(--ha-space-2) 0;
|
||||
}
|
||||
`,
|
||||
];
|
||||
|
||||
@@ -87,7 +87,7 @@ export class MoreInfoConfigurator extends LitElement {
|
||||
flex-direction: column;
|
||||
}
|
||||
p {
|
||||
margin: 8px 0;
|
||||
margin: var(--ha-space-2) 0;
|
||||
}
|
||||
|
||||
a {
|
||||
|
||||
@@ -62,7 +62,7 @@ class MoreInfoCounter extends LitElement {
|
||||
|
||||
static styles = css`
|
||||
.actions {
|
||||
margin: 8px 0;
|
||||
margin: var(--ha-space-2) 0;
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
justify-content: center;
|
||||
|
||||
@@ -194,7 +194,7 @@ class MoreInfoCover extends LitElement {
|
||||
align-items: center;
|
||||
}
|
||||
.main-control > * {
|
||||
margin: 0 8px;
|
||||
margin: 0 var(--ha-space-2);
|
||||
}
|
||||
`,
|
||||
];
|
||||
|
||||
@@ -72,8 +72,8 @@ class MoreInfoDatetime extends LitElement {
|
||||
justify-content: flex-end;
|
||||
}
|
||||
ha-date-input + ha-time-input {
|
||||
margin-left: 4px;
|
||||
margin-inline-start: 4px;
|
||||
margin-left: var(--ha-space-1);
|
||||
margin-inline-start: var(--ha-space-1);
|
||||
margin-inline-end: initial;
|
||||
}
|
||||
`;
|
||||
|
||||
@@ -100,7 +100,7 @@ class MoreInfoGroup extends LitElement {
|
||||
css`
|
||||
state-card-content {
|
||||
display: block;
|
||||
margin-top: 8px;
|
||||
margin-top: var(--ha-space-2);
|
||||
}
|
||||
`,
|
||||
];
|
||||
|
||||
@@ -217,7 +217,7 @@ class MoreInfoHumidifier extends LitElement {
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
text-align: center;
|
||||
margin-bottom: 40px;
|
||||
margin-bottom: var(--ha-space-10);
|
||||
}
|
||||
.current div {
|
||||
display: flex;
|
||||
@@ -237,7 +237,7 @@ class MoreInfoHumidifier extends LitElement {
|
||||
font-size: var(--ha-font-size-m);
|
||||
line-height: var(--ha-line-height-condensed);
|
||||
letter-spacing: 0.4px;
|
||||
margin-bottom: 4px;
|
||||
margin-bottom: var(--ha-space-1);
|
||||
}
|
||||
.current .value {
|
||||
font-size: var(--ha-font-size-xl);
|
||||
|
||||
@@ -84,8 +84,8 @@ class MoreInfoInputDatetime extends LitElement {
|
||||
justify-content: flex-end;
|
||||
}
|
||||
ha-date-input + ha-time-input {
|
||||
margin-left: 4px;
|
||||
margin-inline-start: 4px;
|
||||
margin-left: var(--ha-space-1);
|
||||
margin-inline-start: var(--ha-space-1);
|
||||
margin-inline-end: initial;
|
||||
}
|
||||
`;
|
||||
|
||||
@@ -192,7 +192,7 @@ class MoreInfoLock extends LitElement {
|
||||
margin: 0 auto;
|
||||
}
|
||||
ha-control-button-group + ha-attributes:not([empty]) {
|
||||
margin-top: 16px;
|
||||
margin-top: var(--ha-space-4);
|
||||
}
|
||||
@keyframes pulse {
|
||||
0% {
|
||||
|
||||
@@ -528,11 +528,11 @@ class MoreInfoMediaPlayer extends LitElement {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: var(--ha-space-3);
|
||||
margin-left: 8px;
|
||||
margin-left: var(--ha-space-2);
|
||||
}
|
||||
|
||||
.volume ha-svg-icon {
|
||||
padding: 4px;
|
||||
padding: var(--ha-space-1);
|
||||
height: 16px;
|
||||
width: 16px;
|
||||
}
|
||||
@@ -545,17 +545,17 @@ class MoreInfoMediaPlayer extends LitElement {
|
||||
.badge {
|
||||
position: absolute;
|
||||
top: -10px;
|
||||
left: 16px;
|
||||
left: var(--ha-space-4);
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
height: 16px;
|
||||
min-width: 8px;
|
||||
min-width: var(--ha-space-2);
|
||||
border-radius: var(--ha-border-radius-md);
|
||||
font-weight: var(--ha-font-weight-normal);
|
||||
font-size: var(--ha-font-size-xs);
|
||||
background-color: var(--primary-color);
|
||||
padding: 0 4px;
|
||||
padding: 0 var(--ha-space-1);
|
||||
color: var(--text-primary-color);
|
||||
}
|
||||
|
||||
@@ -572,13 +572,13 @@ class MoreInfoMediaPlayer extends LitElement {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: space-between;
|
||||
margin: 8px 0 8px 8px;
|
||||
margin: var(--ha-space-2) 0 var(--ha-space-2) var(--ha-space-2);
|
||||
}
|
||||
|
||||
.media-title {
|
||||
font-size: var(--ha-font-size-xl);
|
||||
font-weight: var(--ha-font-weight-bold);
|
||||
margin-bottom: 4px;
|
||||
margin-bottom: var(--ha-space-1);
|
||||
}
|
||||
|
||||
.media-artist {
|
||||
|
||||
@@ -72,12 +72,12 @@ class MoreInfoPerson extends LitElement {
|
||||
justify-content: space-between;
|
||||
}
|
||||
.actions {
|
||||
margin: 8px 0;
|
||||
margin: var(--ha-space-2) 0;
|
||||
text-align: right;
|
||||
}
|
||||
ha-map {
|
||||
margin-top: 16px;
|
||||
margin-bottom: 16px;
|
||||
margin-top: var(--ha-space-4);
|
||||
margin-bottom: var(--ha-space-4);
|
||||
}
|
||||
`;
|
||||
}
|
||||
|
||||
@@ -227,24 +227,24 @@ class MoreInfoScript extends LitElement {
|
||||
visibility: hidden;
|
||||
color: var(--secondary-text-color);
|
||||
text-align: center;
|
||||
margin-bottom: 16px;
|
||||
margin-bottom: var(--ha-space-4);
|
||||
height: 21px;
|
||||
}
|
||||
.queue.has-queue {
|
||||
visibility: visible;
|
||||
}
|
||||
.fields {
|
||||
padding: 16px;
|
||||
padding: var(--ha-space-4);
|
||||
border: 1px solid var(--divider-color);
|
||||
border-radius: var(--ha-border-radius-md);
|
||||
margin-bottom: 16px;
|
||||
margin-bottom: var(--ha-space-4);
|
||||
}
|
||||
.fields .title {
|
||||
font-weight: var(--ha-font-weight-bold);
|
||||
}
|
||||
ha-control-button ha-svg-icon {
|
||||
z-index: -1;
|
||||
margin-right: 4px;
|
||||
margin-right: var(--ha-space-1);
|
||||
}
|
||||
ha-service-control {
|
||||
--service-control-padding: 0;
|
||||
@@ -252,7 +252,7 @@ class MoreInfoScript extends LitElement {
|
||||
}
|
||||
ha-markdown {
|
||||
text-align: center;
|
||||
padding: 0 16px;
|
||||
padding: 0 var(--ha-space-4);
|
||||
}
|
||||
`;
|
||||
}
|
||||
|
||||
@@ -83,7 +83,7 @@ class MoreInfoSun extends LitElement {
|
||||
hr {
|
||||
border-color: var(--divider-color);
|
||||
border-bottom: none;
|
||||
margin: 16px 0;
|
||||
margin: var(--ha-space-4) 0;
|
||||
}
|
||||
`;
|
||||
}
|
||||
|
||||
@@ -80,7 +80,7 @@ class MoreInfoTimer extends LitElement {
|
||||
|
||||
static styles = css`
|
||||
.actions {
|
||||
margin: 8px 0;
|
||||
margin: var(--ha-space-2) 0;
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
justify-content: center;
|
||||
|
||||
@@ -448,14 +448,14 @@ class MoreInfoUpdate extends LitElement {
|
||||
hr {
|
||||
border-color: var(--divider-color);
|
||||
border-bottom: none;
|
||||
margin: 16px 0;
|
||||
margin: var(--ha-space-4) 0;
|
||||
}
|
||||
ha-expansion-panel {
|
||||
margin: 16px 0;
|
||||
margin: var(--ha-space-4) 0;
|
||||
}
|
||||
|
||||
.summary {
|
||||
margin-bottom: 16px;
|
||||
margin-bottom: var(--ha-space-4);
|
||||
}
|
||||
|
||||
.row {
|
||||
@@ -473,8 +473,10 @@ class MoreInfoUpdate extends LitElement {
|
||||
);
|
||||
position: sticky;
|
||||
bottom: 0;
|
||||
margin: 0 -24px 0 -24px;
|
||||
margin-bottom: calc(-1 * max(var(--safe-area-inset-bottom), 24px));
|
||||
margin: 0 calc(var(--ha-space-6) * -1) 0 calc(var(--ha-space-6) * -1);
|
||||
margin-bottom: calc(
|
||||
-1 * max(var(--safe-area-inset-bottom), var(--ha-space-6))
|
||||
);
|
||||
box-sizing: border-box;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
@@ -486,8 +488,8 @@ class MoreInfoUpdate extends LitElement {
|
||||
ha-md-list {
|
||||
width: 100%;
|
||||
box-sizing: border-box;
|
||||
margin-bottom: -16px;
|
||||
margin-top: -4px;
|
||||
margin-bottom: calc(var(--ha-space-4) * -1);
|
||||
margin-top: calc(var(--ha-space-1) * -1);
|
||||
--md-sys-color-surface: var(
|
||||
--ha-dialog-surface-background,
|
||||
var(--mdc-theme-surface, #fff)
|
||||
@@ -495,8 +497,8 @@ class MoreInfoUpdate extends LitElement {
|
||||
}
|
||||
|
||||
ha-md-list-item {
|
||||
--md-list-item-leading-space: 24px;
|
||||
--md-list-item-trailing-space: 24px;
|
||||
--md-list-item-leading-space: var(--ha-space-6);
|
||||
--md-list-item-trailing-space: var(--ha-space-6);
|
||||
}
|
||||
|
||||
.actions {
|
||||
@@ -506,7 +508,7 @@ class MoreInfoUpdate extends LitElement {
|
||||
flex-wrap: wrap;
|
||||
justify-content: flex-end;
|
||||
box-sizing: border-box;
|
||||
padding: 16px;
|
||||
padding: var(--ha-space-4);
|
||||
z-index: 1;
|
||||
gap: var(--ha-space-2);
|
||||
}
|
||||
@@ -520,12 +522,12 @@ class MoreInfoUpdate extends LitElement {
|
||||
align-items: center;
|
||||
}
|
||||
mwc-linear-progress {
|
||||
margin-bottom: -8px;
|
||||
margin-top: 4px;
|
||||
margin-bottom: calc(var(--ha-space-2) * -1);
|
||||
margin-top: var(--ha-space-1);
|
||||
}
|
||||
ha-markdown {
|
||||
direction: ltr;
|
||||
padding-bottom: 16px;
|
||||
padding-bottom: var(--ha-space-4);
|
||||
box-sizing: border-box;
|
||||
}
|
||||
ha-markdown.hidden {
|
||||
@@ -534,7 +536,7 @@ class MoreInfoUpdate extends LitElement {
|
||||
.loader {
|
||||
height: 80px;
|
||||
box-sizing: border-box;
|
||||
padding-bottom: 16px;
|
||||
padding-bottom: var(--ha-space-4);
|
||||
}
|
||||
`;
|
||||
}
|
||||
|
||||
@@ -173,7 +173,7 @@ class MoreInfoValve extends LitElement {
|
||||
align-items: center;
|
||||
}
|
||||
.main-control > * {
|
||||
margin: 0 8px;
|
||||
margin: 0 var(--ha-space-2);
|
||||
}
|
||||
`,
|
||||
];
|
||||
|
||||
@@ -214,7 +214,7 @@ class MoreInfoWaterHeater extends LitElement {
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
text-align: center;
|
||||
margin-bottom: 40px;
|
||||
margin-bottom: var(--ha-space-10);
|
||||
}
|
||||
|
||||
.current div {
|
||||
@@ -237,7 +237,7 @@ class MoreInfoWaterHeater extends LitElement {
|
||||
font-size: var(--ha-font-size-m);
|
||||
line-height: var(--ha-line-height-condensed);
|
||||
letter-spacing: 0.4px;
|
||||
margin-bottom: 4px;
|
||||
margin-bottom: var(--ha-space-1);
|
||||
}
|
||||
|
||||
.current .value {
|
||||
|
||||
@@ -440,13 +440,13 @@ class MoreInfoWeather extends LitElement {
|
||||
css`
|
||||
ha-svg-icon {
|
||||
color: var(--state-icon-color);
|
||||
margin-left: 8px;
|
||||
margin-inline-start: 8px;
|
||||
margin-left: var(--ha-space-2);
|
||||
margin-inline-start: var(--ha-space-2);
|
||||
margin-inline-end: initial;
|
||||
}
|
||||
|
||||
.section {
|
||||
margin: 16px 0 8px 0;
|
||||
margin: var(--ha-space-4) 0 var(--ha-space-2) 0;
|
||||
font-size: 1.2em;
|
||||
}
|
||||
|
||||
@@ -470,14 +470,14 @@ class MoreInfoWeather extends LitElement {
|
||||
|
||||
.main {
|
||||
flex: 1;
|
||||
margin-left: 24px;
|
||||
margin-inline-start: 24px;
|
||||
margin-left: var(--ha-space-6);
|
||||
margin-inline-start: var(--ha-space-6);
|
||||
margin-inline-end: initial;
|
||||
}
|
||||
|
||||
.attribution {
|
||||
text-align: center;
|
||||
margin-top: 16px;
|
||||
margin-top: var(--ha-space-4);
|
||||
}
|
||||
|
||||
.time-ago,
|
||||
@@ -500,15 +500,15 @@ class MoreInfoWeather extends LitElement {
|
||||
flex-wrap: nowrap;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin-bottom: 16px;
|
||||
margin-bottom: var(--ha-space-4);
|
||||
}
|
||||
|
||||
.icon-image {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
min-width: 64px;
|
||||
margin-right: 16px;
|
||||
margin-inline-end: 16px;
|
||||
margin-right: var(--ha-space-4);
|
||||
margin-inline-end: var(--ha-space-4);
|
||||
margin-inline-start: initial;
|
||||
}
|
||||
|
||||
@@ -534,7 +534,7 @@ class MoreInfoWeather extends LitElement {
|
||||
|
||||
.temp-attribute .temp {
|
||||
position: relative;
|
||||
margin-right: 24px;
|
||||
margin-right: var(--ha-space-6);
|
||||
direction: ltr;
|
||||
}
|
||||
|
||||
@@ -557,8 +557,8 @@ class MoreInfoWeather extends LitElement {
|
||||
|
||||
.name-state {
|
||||
overflow: hidden;
|
||||
padding-right: 12px;
|
||||
padding-inline-end: 12px;
|
||||
padding-right: var(--ha-space-3);
|
||||
padding-inline-end: var(--ha-space-3);
|
||||
padding-inline-start: initial;
|
||||
width: 100%;
|
||||
}
|
||||
@@ -572,7 +572,7 @@ class MoreInfoWeather extends LitElement {
|
||||
.forecast {
|
||||
display: flex;
|
||||
justify-content: space-around;
|
||||
padding: 16px;
|
||||
padding: var(--ha-space-4);
|
||||
padding-bottom: 0px;
|
||||
overflow-x: auto;
|
||||
scrollbar-color: var(--scrollbar-thumb-color) transparent;
|
||||
@@ -634,8 +634,8 @@ class MoreInfoWeather extends LitElement {
|
||||
}
|
||||
|
||||
.forecast-image-icon {
|
||||
padding-top: 4px;
|
||||
padding-bottom: 4px;
|
||||
padding-top: var(--ha-space-1);
|
||||
padding-bottom: var(--ha-space-1);
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
@@ -802,8 +802,7 @@ export class MoreInfoDialog extends ScrollableFadeMixin(LitElement) {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: flex-start;
|
||||
margin: var(--ha-space-0) var(--ha-space-0)
|
||||
calc(var(--ha-space-2) * -1) var(--ha-space-0);
|
||||
margin: 0 0 calc(var(--ha-space-2) * -1) 0;
|
||||
}
|
||||
|
||||
.title p {
|
||||
|
||||
@@ -58,7 +58,7 @@ export class MoreInfoHistoryAndLogbook extends LitElement {
|
||||
display: block;
|
||||
}
|
||||
ha-more-info-history + ha-more-info-logbook {
|
||||
margin-top: 16px;
|
||||
margin-top: var(--ha-space-4);
|
||||
}
|
||||
`;
|
||||
}
|
||||
|
||||
@@ -264,7 +264,7 @@ export class MoreInfoHistory extends LitElement {
|
||||
flex-direction: row;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin-bottom: 8px;
|
||||
margin-bottom: var(--ha-space-2);
|
||||
}
|
||||
.header > a,
|
||||
a:visited {
|
||||
|
||||
@@ -130,8 +130,8 @@ export class MoreInfoInfo extends LitElement {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
flex: 1;
|
||||
padding: 24px;
|
||||
padding-bottom: max(var(--safe-area-inset-bottom), 24px);
|
||||
padding: var(--ha-space-6);
|
||||
padding-bottom: max(var(--safe-area-inset-bottom), var(--ha-space-6));
|
||||
}
|
||||
|
||||
[data-domain="camera"] .content {
|
||||
@@ -153,7 +153,7 @@ export class MoreInfoInfo extends LitElement {
|
||||
ha-more-info-history,
|
||||
ha-more-info-logbook:not(:last-child) {
|
||||
display: block;
|
||||
margin-bottom: 16px;
|
||||
margin-bottom: var(--ha-space-4);
|
||||
}
|
||||
|
||||
ha-alert {
|
||||
|
||||
@@ -82,7 +82,7 @@ export class MoreInfoLogbook extends LitElement {
|
||||
flex-direction: row;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin-bottom: 8px;
|
||||
margin-bottom: var(--ha-space-2);
|
||||
}
|
||||
.header > a,
|
||||
a:visited {
|
||||
|
||||
@@ -83,7 +83,8 @@ export class HaMoreInfoSettings extends LitElement {
|
||||
return [
|
||||
css`
|
||||
.content {
|
||||
padding: 8px 24px 24px 24px;
|
||||
padding: var(--ha-space-2) var(--ha-space-6) var(--ha-space-6)
|
||||
var(--ha-space-6);
|
||||
}
|
||||
`,
|
||||
];
|
||||
|
||||
@@ -119,7 +119,7 @@ class MoreInfoContent extends LitElement {
|
||||
hui-section {
|
||||
width: 100%;
|
||||
display: block;
|
||||
margin-top: 16px;
|
||||
margin-top: var(--ha-space-4);
|
||||
}
|
||||
`;
|
||||
}
|
||||
|
||||
@@ -1120,7 +1120,7 @@ export class QuickBar extends LitElement {
|
||||
}
|
||||
|
||||
.nothing-found {
|
||||
padding: var(--ha-space-4) var(--ha-space-0);
|
||||
padding: var(--ha-space-4) 0;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
|
||||
@@ -123,8 +123,8 @@ export const ScrollableFadeMixin = <T extends Constructor<LitElement>>(
|
||||
.fade-top,
|
||||
.fade-bottom {
|
||||
position: absolute;
|
||||
left: var(--ha-space-0);
|
||||
right: var(--ha-space-0);
|
||||
left: 0;
|
||||
right: 0;
|
||||
height: var(--ha-space-4);
|
||||
pointer-events: none;
|
||||
transition: opacity 180ms ease-in-out;
|
||||
@@ -137,10 +137,10 @@ export const ScrollableFadeMixin = <T extends Constructor<LitElement>>(
|
||||
opacity: 0;
|
||||
}
|
||||
.fade-top {
|
||||
top: var(--ha-space-0);
|
||||
top: 0;
|
||||
}
|
||||
.fade-bottom {
|
||||
bottom: var(--ha-space-0);
|
||||
bottom: 0;
|
||||
transform: rotate(180deg);
|
||||
}
|
||||
|
||||
|
||||
@@ -2016,12 +2016,12 @@ class DialogAddAutomationElement
|
||||
--ha-bottom-sheet-height: calc(100dvh - var(--ha-space-12));
|
||||
--ha-bottom-sheet-max-height: var(--ha-bottom-sheet-height);
|
||||
--ha-bottom-sheet-max-width: 888px;
|
||||
--ha-bottom-sheet-padding: var(--ha-space-0);
|
||||
--ha-bottom-sheet-padding: 0;
|
||||
--ha-bottom-sheet-surface-background: var(--card-background-color);
|
||||
}
|
||||
|
||||
ha-wa-dialog {
|
||||
--dialog-content-padding: var(--ha-space-0);
|
||||
--dialog-content-padding: 0;
|
||||
--ha-dialog-min-height: min(
|
||||
800px,
|
||||
calc(
|
||||
@@ -2045,7 +2045,7 @@ class DialogAddAutomationElement
|
||||
|
||||
search-input {
|
||||
display: block;
|
||||
margin: var(--ha-space-0) var(--ha-space-4);
|
||||
margin: 0 var(--ha-space-4);
|
||||
}
|
||||
|
||||
ha-button-toggle-group {
|
||||
@@ -2079,7 +2079,7 @@ class DialogAddAutomationElement
|
||||
.groups {
|
||||
overflow: auto;
|
||||
flex: 4;
|
||||
margin-inline-end: var(--ha-space-0);
|
||||
margin-inline-end: 0;
|
||||
}
|
||||
|
||||
ha-automation-add-from-target.hidden {
|
||||
|
||||
@@ -213,8 +213,8 @@ export class HaAutomationAddItems extends LitElement {
|
||||
background-color: var(--ha-color-surface-default);
|
||||
align-items: center;
|
||||
color: var(--ha-color-text-secondary);
|
||||
padding: var(--ha-space-0);
|
||||
margin: var(--ha-space-0) var(--ha-space-4)
|
||||
padding: 0;
|
||||
margin: 0 var(--ha-space-4)
|
||||
max(var(--safe-area-inset-bottom), var(--ha-space-3));
|
||||
line-height: var(--ha-line-height-expanded);
|
||||
justify-content: center;
|
||||
@@ -233,7 +233,7 @@ export class HaAutomationAddItems extends LitElement {
|
||||
--md-list-item-supporting-text-font: var(--ha-font-family-body);
|
||||
--ha-md-list-item-gap: var(--ha-space-3);
|
||||
gap: var(--ha-space-2);
|
||||
padding: var(--ha-space-0) var(--ha-space-4);
|
||||
padding: 0 var(--ha-space-4);
|
||||
}
|
||||
.items ha-md-list ha-md-list-item {
|
||||
border-radius: var(--ha-border-radius-lg);
|
||||
|
||||
@@ -327,7 +327,7 @@ export class HaAutomationAddSearch extends LitElement {
|
||||
style=${styleMap({
|
||||
width: "var(--ha-space-12)",
|
||||
position: "absolute",
|
||||
top: "var(--ha-space-0)",
|
||||
top: "0",
|
||||
left: rtl ? undefined : "var(--ha-space-1)",
|
||||
right: rtl ? "var(--ha-space-1)" : undefined,
|
||||
transform: rtl ? "scaleX(-1)" : "",
|
||||
|
||||
@@ -256,6 +256,7 @@ export class HaPlatformCondition extends LitElement {
|
||||
: undefined}
|
||||
.placeholder=${dataField.default}
|
||||
.localizeValue=${this._localizeValueCallback}
|
||||
.required=${dataField.required}
|
||||
></ha-selector>
|
||||
</ha-settings-row>`
|
||||
: nothing;
|
||||
|
||||
@@ -292,6 +292,7 @@ export class HaPlatformTrigger extends LitElement {
|
||||
: undefined}
|
||||
.placeholder=${dataField.default}
|
||||
.localizeValue=${this._localizeValueCallback}
|
||||
.required=${dataField.required}
|
||||
></ha-selector>
|
||||
</ha-settings-row>`
|
||||
: nothing;
|
||||
|
||||
@@ -462,7 +462,7 @@ class AddIntegrationDialog extends LitElement {
|
||||
style=${styleMap({
|
||||
width: `${this._width}px`,
|
||||
height: this._narrow
|
||||
? "calc(100vh - 184px - var(--safe-area-inset-top, var(--ha-space-0)) - var(--safe-area-inset-bottom, var(--ha-space-0)))"
|
||||
? "calc(100vh - 184px - var(--safe-area-inset-top, 0px) - var(--safe-area-inset-bottom, 0px))"
|
||||
: "500px",
|
||||
})}
|
||||
@click=${this._integrationPicked}
|
||||
|
||||
@@ -199,7 +199,7 @@ export class DialogLabsPreviewFeatureEnable
|
||||
|
||||
static readonly styles = css`
|
||||
ha-wa-dialog {
|
||||
--dialog-content-padding: var(--ha-space-0);
|
||||
--dialog-content-padding: 0;
|
||||
}
|
||||
|
||||
p {
|
||||
|
||||
@@ -31,7 +31,11 @@ import { formatTime } from "../../../../../common/datetime/format_time";
|
||||
import type { ECOption } from "../../../../../resources/echarts/echarts";
|
||||
import { filterXSS } from "../../../../../common/util/xss";
|
||||
|
||||
export function getSuggestedMax(dayDifference: number, end: Date): number {
|
||||
export function getSuggestedMax(
|
||||
dayDifference: number,
|
||||
end: Date,
|
||||
detailedDailyData = false
|
||||
): number {
|
||||
let suggestedMax = new Date(end);
|
||||
|
||||
// Sometimes around DST we get a time of 0:59 instead of 23:59 as expected.
|
||||
@@ -40,7 +44,9 @@ export function getSuggestedMax(dayDifference: number, end: Date): number {
|
||||
suggestedMax = subHours(suggestedMax, 1);
|
||||
}
|
||||
|
||||
suggestedMax.setMinutes(0, 0, 0);
|
||||
if (!detailedDailyData) {
|
||||
suggestedMax.setMinutes(0, 0, 0);
|
||||
}
|
||||
if (dayDifference > 35) {
|
||||
suggestedMax.setDate(1);
|
||||
}
|
||||
@@ -77,7 +83,8 @@ export function getCommonOptions(
|
||||
unit?: string,
|
||||
compareStart?: Date,
|
||||
compareEnd?: Date,
|
||||
formatTotal?: (total: number) => string
|
||||
formatTotal?: (total: number) => string,
|
||||
detailedDailyData = false
|
||||
): ECOption {
|
||||
const dayDifference = differenceInDays(end, start);
|
||||
|
||||
@@ -89,7 +96,7 @@ export function getCommonOptions(
|
||||
xAxis: {
|
||||
type: "time",
|
||||
min: start,
|
||||
max: getSuggestedMax(dayDifference, end),
|
||||
max: getSuggestedMax(dayDifference, end, detailedDailyData),
|
||||
},
|
||||
yAxis: {
|
||||
type: "value",
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { endOfToday, isToday, startOfToday } from "date-fns";
|
||||
import { endOfToday, isSameDay, isToday, startOfToday } from "date-fns";
|
||||
import type { HassConfig, UnsubscribeFunc } from "home-assistant-js-websocket";
|
||||
import type { PropertyValues } from "lit";
|
||||
import { css, html, LitElement, nothing } from "lit";
|
||||
@@ -132,7 +132,9 @@ export class HuiPowerSourcesGraphCard
|
||||
config,
|
||||
"kW",
|
||||
compareStart,
|
||||
compareEnd
|
||||
compareEnd,
|
||||
undefined,
|
||||
true
|
||||
),
|
||||
legend: {
|
||||
show: this._config?.show_legend !== false,
|
||||
@@ -210,14 +212,17 @@ export class HuiPowerSourcesGraphCard
|
||||
const { positive, negative } = this._processData(
|
||||
statIds[key].stats.map((id: string) => {
|
||||
const stats = energyData.stats[id] ?? [];
|
||||
const currentStateWatts = getPowerFromState(this.hass.states[id]);
|
||||
if (currentStateWatts !== undefined) {
|
||||
// getPowerFromState returns power in W; convert to kW for this graph
|
||||
stats.push({
|
||||
start: now,
|
||||
end: now,
|
||||
mean: currentStateWatts / 1000,
|
||||
});
|
||||
if (isSameDay(now, this._start) && isSameDay(now, this._end)) {
|
||||
// Append current state if we are showing today
|
||||
const currentStateWatts = getPowerFromState(this.hass.states[id]);
|
||||
if (currentStateWatts !== undefined) {
|
||||
// getPowerFromState returns power in W; convert to kW for this graph
|
||||
stats.push({
|
||||
start: now,
|
||||
end: now,
|
||||
mean: currentStateWatts / 1000,
|
||||
});
|
||||
}
|
||||
}
|
||||
return stats;
|
||||
})
|
||||
|
||||
@@ -732,9 +732,7 @@ export class HuiAreaCard extends LitElement implements LovelaceCard {
|
||||
padding: 0 var(--ha-space-3) var(--ha-space-3) var(--ha-space-3);
|
||||
}
|
||||
.container.horizontal hui-card-features {
|
||||
width: calc(
|
||||
50% - var(--column-gap, var(--ha-space-0)) / 2 - var(--ha-space-3)
|
||||
);
|
||||
width: calc(50% - var(--column-gap, 0px) / 2 - var(--ha-space-3));
|
||||
flex: none;
|
||||
--feature-height: var(--ha-space-9);
|
||||
padding: 0 var(--ha-space-3);
|
||||
|
||||
@@ -142,11 +142,10 @@ export const haStyleDialog = css`
|
||||
--mdc-dialog-max-width: 600px;
|
||||
--mdc-dialog-max-width: min(600px, 95vw);
|
||||
--justify-action-buttons: space-between;
|
||||
--dialog-container-padding: var(--safe-area-inset-top, var(--ha-space-0))
|
||||
var(--safe-area-inset-right, var(--ha-space-0))
|
||||
var(--safe-area-inset-bottom, var(--ha-space-0))
|
||||
var(--safe-area-inset-left, var(--ha-space-0));
|
||||
--dialog-surface-padding: var(--ha-space-0);
|
||||
--dialog-container-padding: var(--safe-area-inset-top, 0)
|
||||
var(--safe-area-inset-right, 0) var(--safe-area-inset-bottom, 0)
|
||||
var(--safe-area-inset-left, 0);
|
||||
--dialog-surface-padding: 0px;
|
||||
}
|
||||
|
||||
ha-dialog .form {
|
||||
@@ -166,11 +165,10 @@ export const haStyleDialog = css`
|
||||
--mdc-dialog-min-height: 100svh;
|
||||
--mdc-dialog-max-height: 100vh;
|
||||
--mdc-dialog-max-height: 100svh;
|
||||
--dialog-container-padding: var(--ha-space-0);
|
||||
--dialog-surface-padding: var(--safe-area-inset-top, var(--ha-space-0))
|
||||
var(--safe-area-inset-right, var(--ha-space-0))
|
||||
var(--safe-area-inset-bottom, var(--ha-space-0))
|
||||
var(--safe-area-inset-left, var(--ha-space-0));
|
||||
--dialog-container-padding: 0px;
|
||||
--dialog-surface-padding: var(--safe-area-inset-top, 0)
|
||||
var(--safe-area-inset-right, 0) var(--safe-area-inset-bottom, 0)
|
||||
var(--safe-area-inset-left, 0);
|
||||
--vertical-align-dialog: flex-end;
|
||||
--ha-dialog-border-radius: var(--ha-border-radius-square);
|
||||
}
|
||||
@@ -188,13 +186,13 @@ export const haStyleDialogFixedTop = css`
|
||||
--mdc-dialog-max-height: calc(
|
||||
100vh - var(--dialog-surface-margin-top) - var(--ha-space-2) - var(
|
||||
--safe-area-inset-y,
|
||||
var(--ha-space-0)
|
||||
0px
|
||||
)
|
||||
);
|
||||
--mdc-dialog-max-height: calc(
|
||||
100svh - var(--dialog-surface-margin-top) - var(--ha-space-2) - var(
|
||||
--safe-area-inset-y,
|
||||
var(--ha-space-0)
|
||||
0px
|
||||
)
|
||||
);
|
||||
}
|
||||
@@ -202,7 +200,7 @@ export const haStyleDialogFixedTop = css`
|
||||
@media all and (max-width: 450px), all and (max-height: 500px) {
|
||||
ha-dialog {
|
||||
/* When in fullscreen, dialog should be attached to top */
|
||||
--dialog-surface-margin-top: var(--ha-space-0);
|
||||
--dialog-surface-margin-top: 0px;
|
||||
--mdc-dialog-min-height: 100vh;
|
||||
--mdc-dialog-min-height: 100svh;
|
||||
--mdc-dialog-max-height: 100vh;
|
||||
|
||||
@@ -339,12 +339,6 @@ export const colorStyles = css`
|
||||
--ha-assist-chip-filled-container-color: rgba(var(--rgb-primary-text-color), 0.15);
|
||||
--ha-assist-chip-active-container-color: rgba(var(--rgb-primary-color), 0.15);
|
||||
--chip-background-color: rgba(var(--rgb-primary-text-color), 0.15);
|
||||
|
||||
/* Vaadin */
|
||||
--material-body-text-color: var(--primary-text-color);
|
||||
--material-background-color: var(--card-background-color);
|
||||
--material-secondary-background-color: var(--secondary-background-color);
|
||||
--material-secondary-text-color: var(--secondary-text-color);
|
||||
}
|
||||
`;
|
||||
|
||||
|
||||
@@ -21,7 +21,6 @@ export const coreStyles = css`
|
||||
--ha-border-radius-square: 0;
|
||||
|
||||
/* Spacing */
|
||||
--ha-space-0: 0px;
|
||||
--ha-space-1: 4px;
|
||||
--ha-space-2: 8px;
|
||||
--ha-space-3: 12px;
|
||||
|
||||
@@ -36,12 +36,6 @@ export const typographyStyles = css`
|
||||
--ha-font-smoothing: antialiased;
|
||||
--ha-moz-osx-font-smoothing: grayscale;
|
||||
|
||||
/* Vaadin typography */
|
||||
--material-h6-font-size: var(--ha-font-size-m);
|
||||
--material-small-font-size: var(--ha-font-size-xs);
|
||||
--material-caption-font-size: var(--ha-font-size-2xs);
|
||||
--material-button-font-size: var(--ha-font-size-xs);
|
||||
|
||||
/* Add font to lists since default does not handle non-latin characters */
|
||||
--md-list-item-label-text-font: var(--ha-font-family-body);
|
||||
--md-list-item-supporting-text-font: var(--ha-font-family-body);
|
||||
|
||||
@@ -76,6 +76,60 @@
|
||||
],
|
||||
"@lit-labs/observers/resize-controller": [
|
||||
"./node_modules/@lit-labs/observers/resize-controller.js"
|
||||
],
|
||||
"@formatjs/intl-durationformat/should-polyfill": [
|
||||
"./node_modules/@formatjs/intl-durationformat/should-polyfill.js"
|
||||
],
|
||||
"@formatjs/intl-durationformat/polyfill-force": [
|
||||
"./node_modules/@formatjs/intl-durationformat/polyfill-force.js"
|
||||
],
|
||||
"@formatjs/intl-datetimeformat/should-polyfill": [
|
||||
"./node_modules/@formatjs/intl-datetimeformat/should-polyfill.js"
|
||||
],
|
||||
"@formatjs/intl-datetimeformat/polyfill-force": [
|
||||
"./node_modules/@formatjs/intl-datetimeformat/polyfill-force.js"
|
||||
],
|
||||
"@formatjs/intl-displaynames/should-polyfill": [
|
||||
"./node_modules/@formatjs/intl-displaynames/should-polyfill.js"
|
||||
],
|
||||
"@formatjs/intl-displaynames/polyfill-force": [
|
||||
"./node_modules/@formatjs/intl-displaynames/polyfill-force.js"
|
||||
],
|
||||
"@formatjs/intl-getcanonicallocales/should-polyfill": [
|
||||
"./node_modules/@formatjs/intl-getcanonicallocales/should-polyfill.js"
|
||||
],
|
||||
"@formatjs/intl-getcanonicallocales/polyfill-force": [
|
||||
"./node_modules/@formatjs/intl-getcanonicallocales/polyfill-force.js"
|
||||
],
|
||||
"@formatjs/intl-listformat/should-polyfill": [
|
||||
"./node_modules/@formatjs/intl-listformat/should-polyfill.js"
|
||||
],
|
||||
"@formatjs/intl-listformat/polyfill-force": [
|
||||
"./node_modules/@formatjs/intl-listformat/polyfill-force.js"
|
||||
],
|
||||
"@formatjs/intl-locale/should-polyfill": [
|
||||
"./node_modules/@formatjs/intl-locale/should-polyfill.js"
|
||||
],
|
||||
"@formatjs/intl-locale/polyfill-force": [
|
||||
"./node_modules/@formatjs/intl-locale/polyfill-force.js"
|
||||
],
|
||||
"@formatjs/intl-numberformat/should-polyfill": [
|
||||
"./node_modules/@formatjs/intl-numberformat/should-polyfill.js"
|
||||
],
|
||||
"@formatjs/intl-numberformat/polyfill-force": [
|
||||
"./node_modules/@formatjs/intl-numberformat/polyfill-force.js"
|
||||
],
|
||||
"@formatjs/intl-pluralrules/should-polyfill": [
|
||||
"./node_modules/@formatjs/intl-pluralrules/should-polyfill.js"
|
||||
],
|
||||
"@formatjs/intl-pluralrules/polyfill-force": [
|
||||
"./node_modules/@formatjs/intl-pluralrules/polyfill-force.js"
|
||||
],
|
||||
"@formatjs/intl-relativetimeformat/should-polyfill": [
|
||||
"./node_modules/@formatjs/intl-relativetimeformat/should-polyfill.js"
|
||||
],
|
||||
"@formatjs/intl-relativetimeformat/polyfill-force": [
|
||||
"./node_modules/@formatjs/intl-relativetimeformat/polyfill-force.js"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user