Skip to content

Commit

Permalink
20231205.0 (#18916)
Browse files Browse the repository at this point in the history
  • Loading branch information
bramkragten authored Dec 5, 2023
2 parents ae2e8e7 + dccd9b2 commit eb5e7ba
Show file tree
Hide file tree
Showing 114 changed files with 1,636 additions and 858 deletions.
4 changes: 3 additions & 1 deletion demo/src/custom-cards/ha-demo-card.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,9 @@ export class HADemoCard extends LitElement implements LovelaceCard {
<div class="picker">
<div class="label">
${this._switching
? html`<ha-circular-progress active></ha-circular-progress>`
? html`<ha-circular-progress
indeterminate
></ha-circular-progress>`
: until(
selectedDemoConfig.then(
(conf) => html`
Expand Down
4 changes: 4 additions & 0 deletions gallery/src/pages/components/ha-circular-progress.markdown
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
title: Circular Progress
subtitle: Can be used to indicate an ongoing task.
---
64 changes: 64 additions & 0 deletions gallery/src/pages/components/ha-circular-progress.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
import { html, css, LitElement, TemplateResult } from "lit";
import { customElement, property } from "lit/decorators";
import "../../../../src/components/ha-bar";
import "../../../../src/components/ha-card";
import "../../../../src/components/ha-circular-progress";
import "@material/web/progress/circular-progress";
import { HomeAssistant } from "../../../../src/types";

@customElement("demo-components-ha-circular-progress")
export class DemoHaCircularProgress extends LitElement {
@property({ attribute: false }) hass!: HomeAssistant;

protected render(): TemplateResult {
return html`<ha-card header="Basic circular progress">
<div class="card-content">
<ha-circular-progress indeterminate></ha-circular-progress></div
></ha-card>
<ha-card header="Different circular progress sizes">
<div class="card-content">
<ha-circular-progress
indeterminate
size="tiny"
></ha-circular-progress>
<ha-circular-progress
indeterminate
size="small"
></ha-circular-progress>
<ha-circular-progress
indeterminate
size="medium"
></ha-circular-progress>
<ha-circular-progress
indeterminate
size="large"
></ha-circular-progress></div
></ha-card>
<ha-card header="Circular progress with an aria-label">
<div class="card-content">
<ha-circular-progress
indeterminate
aria-label="Doing something..."
></ha-circular-progress>
<ha-circular-progress
indeterminate
.ariaLabel=${"Doing something..."}
></ha-circular-progress></div
></ha-card>`;
}

static get styles() {
return css`
ha-card {
max-width: 600px;
margin: 24px auto;
}
`;
}
}

declare global {
interface HTMLElementTagNameMap {
"demo-components-ha-circular-progress": DemoHaCircularProgress;
}
}
2 changes: 1 addition & 1 deletion hassio/src/addon-view/config/hassio-addon-config-tab.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class HassioAddonConfigDashboard extends LitElement {

protected render(): TemplateResult {
if (!this.addon) {
return html`<ha-circular-progress active></ha-circular-progress>`;
return html`<ha-circular-progress indeterminate></ha-circular-progress>`;
}
const hasConfiguration =
(this.addon.options && Object.keys(this.addon.options).length) ||
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class HassioAddonDocumentationDashboard extends LitElement {

protected render(): TemplateResult {
if (!this.addon) {
return html`<ha-circular-progress active></ha-circular-progress>`;
return html`<ha-circular-progress indeterminate></ha-circular-progress>`;
}
return html`
<div class="content">
Expand Down
2 changes: 1 addition & 1 deletion hassio/src/addon-view/info/hassio-addon-info-tab.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class HassioAddonInfoDashboard extends LitElement {

protected render(): TemplateResult {
if (!this.addon) {
return html`<ha-circular-progress active></ha-circular-progress>`;
return html`<ha-circular-progress indeterminate></ha-circular-progress>`;
}

return html`
Expand Down
4 changes: 3 additions & 1 deletion hassio/src/addon-view/log/hassio-addon-log-tab.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ class HassioAddonLogDashboard extends LitElement {

protected render(): TemplateResult {
if (!this.addon) {
return html` <ha-circular-progress active></ha-circular-progress> `;
return html`
<ha-circular-progress indeterminate></ha-circular-progress>
`;
}
return html`
<div class="content">
Expand Down
2 changes: 1 addition & 1 deletion hassio/src/dialogs/backup/dialog-hassio-backup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ class HassioBackupDialog
</ha-header-bar>
</div>
${this._restoringBackup
? html`<ha-circular-progress active></ha-circular-progress>`
? html`<ha-circular-progress indeterminate></ha-circular-progress>`
: html`
<supervisor-backup-content
.hass=${this.hass}
Expand Down
2 changes: 1 addition & 1 deletion hassio/src/dialogs/backup/dialog-hassio-create-backup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ class HassioCreateBackupDialog extends LitElement {
)}
>
${this._creatingBackup
? html`<ha-circular-progress active></ha-circular-progress>`
? html`<ha-circular-progress indeterminate></ha-circular-progress>`
: html`<supervisor-backup-content
.hass=${this.hass}
.supervisor=${this._dialogParams.supervisor}
Expand Down
6 changes: 5 additions & 1 deletion hassio/src/dialogs/datadisk/dialog-hassio-datadisk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,11 @@ class HassioDatadiskDialog extends LitElement {
?hideActions=${this.moving}
>
${this.moving
? html` <ha-circular-progress alt="Moving" size="large" active>
? html` <ha-circular-progress
aria-label="Moving"
size="large"
indeterminate
>
</ha-circular-progress>
<p class="progress-text">
${this.dialogParams.supervisor.localize(
Expand Down
8 changes: 6 additions & 2 deletions hassio/src/dialogs/network/dialog-hassio-network.ts
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,11 @@ export class DialogHassioNetwork
.disabled=${this._scanning}
>
${this._scanning
? html`<ha-circular-progress active size="small">
? html`<ha-circular-progress
aria-label="Scanning"
indeterminate
size="small"
>
</ha-circular-progress>`
: this.supervisor.localize("dialog.network.scan_ap")}
</mwc-button>
Expand Down Expand Up @@ -274,7 +278,7 @@ export class DialogHassioNetwork
</mwc-button>
<mwc-button @click=${this._updateNetwork} .disabled=${!this._dirty}>
${this._processing
? html`<ha-circular-progress active size="small">
? html`<ha-circular-progress indeterminate size="small">
</ha-circular-progress>`
: this.supervisor.localize("common.save")}
</mwc-button>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ class HassioRepositoriesDialog extends LitElement {
<mwc-button @click=${this._addRepository}>
${this._processing
? html`<ha-circular-progress
active
indeterminate
size="small"
></ha-circular-progress>`
: this._dialogParams!.supervisor.localize(
Expand Down
6 changes: 5 additions & 1 deletion hassio/src/update-available/update-available-card.ts
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,11 @@ class UpdateAvailableCard extends LitElement {
`
: ""}
`
: html`<ha-circular-progress alt="Updating" size="large" active>
: html`<ha-circular-progress
aria-label="Updating"
size="large"
indeterminate
>
</ha-circular-progress>
<p class="progress-text">
${this.supervisor.localize("update_available.updating", {
Expand Down
12 changes: 5 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@
"@material/mwc-base": "0.27.0",
"@material/mwc-button": "0.27.0",
"@material/mwc-checkbox": "0.27.0",
"@material/mwc-circular-progress": "0.27.0",
"@material/mwc-dialog": "0.27.0",
"@material/mwc-drawer": "0.27.0",
"@material/mwc-fab": "0.27.0",
Expand Down Expand Up @@ -91,8 +90,8 @@
"@polymer/paper-toast": "3.0.1",
"@polymer/polymer": "3.5.1",
"@thomasloven/round-slider": "0.6.0",
"@vaadin/combo-box": "24.2.4",
"@vaadin/vaadin-themable-mixin": "24.2.4",
"@vaadin/combo-box": "24.2.5",
"@vaadin/vaadin-themable-mixin": "24.2.5",
"@vibrant/color": "3.2.1-alpha.1",
"@vibrant/core": "3.2.1-alpha.1",
"@vibrant/quantizer-mmcq": "3.2.1-alpha.1",
Expand Down Expand Up @@ -120,14 +119,13 @@
"leaflet-draw": "1.0.4",
"lit": "2.8.0",
"luxon": "3.4.4",
"marked": "10.0.0",
"marked": "11.0.0",
"memoize-one": "6.0.0",
"node-vibrant": "3.2.1-alpha.1",
"proxy-polyfill": "0.3.2",
"punycode": "2.3.1",
"qr-scanner": "1.4.2",
"qrcode": "1.5.3",
"resize-observer-polyfill": "1.5.1",
"roboto-fontface": "0.10.0",
"rrule": "2.8.1",
"sortablejs": "1.15.1",
Expand Down Expand Up @@ -194,7 +192,7 @@
"babel-plugin-template-html-minifier": "4.1.0",
"chai": "4.3.10",
"del": "7.1.0",
"eslint": "8.54.0",
"eslint": "8.55.0",
"eslint-config-airbnb-base": "15.0.0",
"eslint-config-airbnb-typescript": "17.1.0",
"eslint-config-prettier": "9.0.0",
Expand All @@ -206,7 +204,7 @@
"eslint-plugin-unused-imports": "3.0.0",
"eslint-plugin-wc": "2.0.4",
"fancy-log": "2.0.0",
"fs-extra": "11.1.1",
"fs-extra": "11.2.0",
"glob": "10.3.10",
"gulp": "4.0.2",
"gulp-flatmap": "1.0.2",
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "home-assistant-frontend"
version = "20231204.0"
version = "20231205.0"
license = {text = "Apache-2.0"}
description = "The Home Assistant frontend"
readme = "README.md"
Expand Down
2 changes: 1 addition & 1 deletion src/components/buttons/ha-progress-button.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export class HaProgressButton extends LitElement {
? html`
<ha-circular-progress
size="small"
active
indeterminate
></ha-circular-progress>
`
: ""}
Expand Down
2 changes: 2 additions & 0 deletions src/components/chart/ha-chart-base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -469,13 +469,15 @@ export class HaChartBase extends LitElement {
.chartTooltip li {
display: flex;
white-space: pre-line;
word-break: break-word;
align-items: center;
line-height: 16px;
padding: 4px 0;
}
.chartTooltip .title {
text-align: center;
font-weight: 500;
word-break: break-word;
direction: ltr;
}
.chartTooltip .footer {
Expand Down
74 changes: 32 additions & 42 deletions src/components/ha-circular-progress.ts
Original file line number Diff line number Diff line change
@@ -1,54 +1,44 @@
import { CircularProgress } from "@material/mwc-circular-progress";
import { CSSResultGroup, css } from "lit";
import "element-internals-polyfill";
import { MdCircularProgress } from "@material/web/progress/circular-progress";
import { CSSResult, PropertyValues, css } from "lit";
import { customElement, property } from "lit/decorators";

@customElement("ha-circular-progress")
// @ts-ignore
export class HaCircularProgress extends CircularProgress {
@property({ type: Boolean })
public active = false;

@property()
public alt = "Loading";

@property()
public size: "tiny" | "small" | "medium" | "large" = "medium";

// @ts-ignore
public set density(_) {
// just a dummy
}

public get density() {
switch (this.size) {
case "tiny":
return -8;
case "small":
return -5;
case "medium":
return 0;
case "large":
return 5;
default:
return 0;
export class HaCircularProgress extends MdCircularProgress {
@property({ attribute: "aria-label", type: String }) public ariaLabel =
"Loading";

@property() public size: "tiny" | "small" | "medium" | "large" = "medium";

protected updated(changedProps: PropertyValues) {
super.updated(changedProps);

if (changedProps.has("size")) {
switch (this.size) {
case "tiny":
this.style.setProperty("--md-circular-progress-size", "16px");
break;
case "small":
this.style.setProperty("--md-circular-progress-size", "28px");
break;
// medium is default size
case "medium":
this.style.setProperty("--md-circular-progress-size", "48px");
break;
case "large":
this.style.setProperty("--md-circular-progress-size", "68px");
break;
}
}
}

// @ts-ignore
public set indeterminate(_) {
// just a dummy
}

public get indeterminate() {
return this.active;
}

static get styles(): CSSResultGroup {
static get styles(): CSSResult[] {
return [
super.styles,
...super.styles,
css`
:host {
overflow: hidden;
--md-sys-color-primary: var(--primary-color);
--md-circular-progress-size: 48px;
}
`,
];
Expand Down
5 changes: 4 additions & 1 deletion src/components/ha-control-circular-slider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -618,6 +618,7 @@ export class HaControlCircularSlider extends LitElement {
--control-circular-slider-high-color: var(
--control-circular-slider-color
);
--control-circular-slider-interaction-margin: 12px;
width: 320px;
display: block;
}
Expand All @@ -633,7 +634,9 @@ export class HaControlCircularSlider extends LitElement {
fill: none;
stroke: transparent;
stroke-linecap: round;
stroke-width: 48px;
stroke-width: calc(
24px + 2 * var(--control-circular-slider-interaction-margin)
);
cursor: pointer;
}
#display {
Expand Down
Loading

0 comments on commit eb5e7ba

Please sign in to comment.