Skip to content

Commit 79cecb4

Browse files
authored
Merge pull request #51 from Darkdragon14/fix/ha-dialogs
fix: update ha-dialog usage for HA 2026.3.1
2 parents f5f4265 + 5941629 commit 79cecb4

File tree

2 files changed

+26
-16
lines changed

2 files changed

+26
-16
lines changed

custom_components/ha_guest_mode/manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,5 @@
88
"iot_class": "local_push",
99
"issue_tracker": "https://github.com/Darkdragon14/ha-guest-mode/issues",
1010
"requirements": ["qrcode", "Pillow"],
11-
"version": "v1.24.0"
11+
"version": "v1.24.1"
1212
}

custom_components/ha_guest_mode/www/ha-guest-mode.js

Lines changed: 25 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -619,7 +619,7 @@ class GuestModePanel extends LitElement {
619619

620620
// Dialog
621621
const dialog = document.createElement('ha-dialog');
622-
dialog.heading = `QR — ${token.name}`;
622+
dialog.setAttribute('header-title', `QR — ${token.name}`);
623623
dialog.style.setProperty('--dialog-content-padding', '16px');
624624

625625
const container = document.createElement('div');
@@ -639,6 +639,9 @@ class GuestModePanel extends LitElement {
639639
linkEl.style.textAlign = 'center';
640640
container.appendChild(linkEl);
641641

642+
const footer = document.createElement('ha-dialog-footer');
643+
footer.slot = 'footer';
644+
642645
const copyBtn = document.createElement('ha-button');
643646
copyBtn.slot = 'primaryAction';
644647
copyBtn.textContent = this.translate("copy") || "Copy";
@@ -654,8 +657,9 @@ class GuestModePanel extends LitElement {
654657
closeBtn.addEventListener('click', () => dialog.close());
655658

656659
dialog.appendChild(container);
657-
dialog.appendChild(copyBtn);
658-
dialog.appendChild(closeBtn);
660+
footer.appendChild(closeBtn);
661+
footer.appendChild(copyBtn);
662+
dialog.appendChild(footer);
659663
this.shadowRoot.appendChild(dialog);
660664
dialog.open = true;
661665

@@ -675,9 +679,12 @@ class GuestModePanel extends LitElement {
675679
async showConfirmationDialog(title, text, buttons) {
676680
return new Promise((resolve) => {
677681
const dialog = document.createElement('ha-dialog');
678-
dialog.heading = title;
682+
dialog.setAttribute('header-title', title);
679683
dialog.textContent = text;
680684

685+
const footer = document.createElement('ha-dialog-footer');
686+
footer.slot = 'footer';
687+
681688
const confirmButton = document.createElement('ha-button');
682689
confirmButton.slot = 'primaryAction';
683690
confirmButton.variant = 'danger';
@@ -696,8 +703,9 @@ class GuestModePanel extends LitElement {
696703
dialog.close();
697704
});
698705

699-
dialog.appendChild(confirmButton);
700-
dialog.appendChild(cancelButton);
706+
footer.appendChild(cancelButton);
707+
footer.appendChild(confirmButton);
708+
dialog.appendChild(footer);
701709
this.shadowRoot.appendChild(dialog);
702710
dialog.open = true;
703711

@@ -1039,7 +1047,7 @@ class GuestModePanel extends LitElement {
10391047
10401048
<div class="mdc-top-app-bar--fixed-adjust flex content">
10411049
${this.isCreateDialogOpen ? html`
1042-
<ha-dialog class="create-token-dialog" open .heading=${this.translate("create_token") || "Create token"} @closed=${this.closeCreateDialog}>
1050+
<ha-dialog class="create-token-dialog" open width="large" header-title=${this.translate("create_token") || "Create token"} @closed=${this.closeCreateDialog}>
10431051
<div class="dialog-content">
10441052
${this.renderCreateTokenForm(userSchema, groupSchema, dashboardSchema)}
10451053
</div>
@@ -1052,12 +1060,14 @@ class GuestModePanel extends LitElement {
10521060
</div>
10531061
`
10541062
: null}
1055-
<ha-button slot="secondaryAction" @click=${this.closeCreateDialog}>
1056-
${this.translate("close") || "Close"}
1057-
</ha-button>
1058-
<ha-button slot="primaryAction" @click=${this.addClick}>
1059-
${this.translate("add")}
1060-
</ha-button>
1063+
<ha-dialog-footer slot="footer">
1064+
<ha-button slot="secondaryAction" @click=${this.closeCreateDialog}>
1065+
${this.translate("close") || "Close"}
1066+
</ha-button>
1067+
<ha-button slot="primaryAction" @click=${this.addClick}>
1068+
${this.translate("add")}
1069+
</ha-button>
1070+
</ha-dialog-footer>
10611071
</ha-dialog>
10621072
` : null}
10631073
@@ -1324,8 +1334,8 @@ class GuestModePanel extends LitElement {
13241334
max-width: 100%;
13251335
}
13261336
.create-token-dialog {
1327-
--mdc-dialog-min-width: min(1080px, 92vw);
1328-
--mdc-dialog-max-width: min(1080px, 92vw);
1337+
--ha-dialog-width-lg: min(1080px, 92vw);
1338+
--ha-dialog-max-width: min(1080px, 92vw);
13291339
}
13301340
.modal-alert-footer {
13311341
margin-top: 10px;

0 commit comments

Comments
 (0)