mirror of
https://github.com/home-assistant/frontend.git
synced 2025-11-16 14:30:36 +00:00
Safe area: dialogs (#26814)
* dialogs: apply safe-area insets (content padding, header mobile insets, more-info top margin) * Set default (40px prio if not set) * Set default (default padding prio if not set) * Set default to avoid issues * Set on container * Sort * No longer needed * No longer needed * No longer needed * Remove * Restore * Restore * Move to padding * Switch to margins, set min and max height * Set default * Account for insets to remove extra scrollbars * Fix content for filter dialog * Move margins outside of media check * Use padding instead * use min-width instead * Use padding for just top and bottom * Calculate lit-virtualizer to include safe areas * Calculate lit-virtualizer to include safe areas * Fix double scrollbar from previous * Remove calculation * Default * Remove double calculation * Remove double calculation
This commit is contained in:
@@ -90,7 +90,7 @@ export class HaDialog extends DialogBase {
|
|||||||
}
|
}
|
||||||
.mdc-dialog__actions {
|
.mdc-dialog__actions {
|
||||||
justify-content: var(--justify-action-buttons, flex-end);
|
justify-content: var(--justify-action-buttons, flex-end);
|
||||||
padding: 12px 16px max(var(--safe-area-inset-bottom), 16px) 16px;
|
padding: 12px 16px 16px 16px;
|
||||||
}
|
}
|
||||||
.mdc-dialog__actions span:nth-child(1) {
|
.mdc-dialog__actions span:nth-child(1) {
|
||||||
flex: var(--secondary-action-button-flex, unset);
|
flex: var(--secondary-action-button-flex, unset);
|
||||||
@@ -100,6 +100,8 @@ export class HaDialog extends DialogBase {
|
|||||||
}
|
}
|
||||||
.mdc-dialog__container {
|
.mdc-dialog__container {
|
||||||
align-items: var(--vertical-align-dialog, center);
|
align-items: var(--vertical-align-dialog, center);
|
||||||
|
padding-top: var(--safe-area-inset-top);
|
||||||
|
padding-bottom: var(--safe-area-inset-bottom);
|
||||||
}
|
}
|
||||||
.mdc-dialog__title {
|
.mdc-dialog__title {
|
||||||
padding: 16px 16px 0 16px;
|
padding: 16px 16px 0 16px;
|
||||||
@@ -115,15 +117,17 @@ export class HaDialog extends DialogBase {
|
|||||||
padding: var(--dialog-content-padding, 24px);
|
padding: var(--dialog-content-padding, 24px);
|
||||||
}
|
}
|
||||||
:host([hideactions]) .mdc-dialog .mdc-dialog__content {
|
:host([hideactions]) .mdc-dialog .mdc-dialog__content {
|
||||||
padding-bottom: max(
|
padding-bottom: var(--dialog-content-padding, 24px);
|
||||||
var(--dialog-content-padding, 24px),
|
|
||||||
var(--safe-area-inset-bottom)
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
.mdc-dialog .mdc-dialog__surface {
|
.mdc-dialog .mdc-dialog__surface {
|
||||||
position: var(--dialog-surface-position, relative);
|
position: var(--dialog-surface-position, relative);
|
||||||
top: var(--dialog-surface-top);
|
top: var(--dialog-surface-top);
|
||||||
margin-top: var(--dialog-surface-margin-top);
|
margin-top: var(--dialog-surface-margin-top);
|
||||||
|
min-width: calc(
|
||||||
|
var(--mdc-dialog-min-width, 100vw) - var(
|
||||||
|
--safe-area-inset-left
|
||||||
|
) - var(--safe-area-inset-right)
|
||||||
|
);
|
||||||
min-height: var(--mdc-dialog-min-height, auto);
|
min-height: var(--mdc-dialog-min-height, auto);
|
||||||
border-radius: var(--ha-dialog-border-radius, 24px);
|
border-radius: var(--ha-dialog-border-radius, 24px);
|
||||||
-webkit-backdrop-filter: var(--ha-dialog-surface-backdrop-filter, none);
|
-webkit-backdrop-filter: var(--ha-dialog-surface-backdrop-filter, none);
|
||||||
@@ -137,6 +141,24 @@ export class HaDialog extends DialogBase {
|
|||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@media all and (max-width: 450px), all and (max-height: 500px) {
|
||||||
|
.mdc-dialog .mdc-dialog__surface {
|
||||||
|
min-height: calc(
|
||||||
|
100vh - var(--safe-area-inset-top, 0px) - var(
|
||||||
|
--safe-area-inset-bottom,
|
||||||
|
0px
|
||||||
|
)
|
||||||
|
);
|
||||||
|
max-height: calc(
|
||||||
|
100vh - var(--safe-area-inset-top, 0px) - var(
|
||||||
|
--safe-area-inset-bottom,
|
||||||
|
0px
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.header_title {
|
.header_title {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
|||||||
@@ -475,7 +475,6 @@ class MoreInfoUpdate extends LitElement {
|
|||||||
bottom: 0;
|
bottom: 0;
|
||||||
margin: 0 -24px 0 -24px;
|
margin: 0 -24px 0 -24px;
|
||||||
margin-bottom: calc(-1 * max(var(--safe-area-inset-bottom), 24px));
|
margin-bottom: calc(-1 * max(var(--safe-area-inset-bottom), 24px));
|
||||||
padding-bottom: var(--safe-area-inset-bottom);
|
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
|
|||||||
@@ -661,7 +661,10 @@ export class MoreInfoDialog extends LitElement {
|
|||||||
ha-dialog {
|
ha-dialog {
|
||||||
/* Set the top top of the dialog to a fixed position, so it doesnt jump when the content changes size */
|
/* Set the top top of the dialog to a fixed position, so it doesnt jump when the content changes size */
|
||||||
--vertical-align-dialog: flex-start;
|
--vertical-align-dialog: flex-start;
|
||||||
--dialog-surface-margin-top: 40px;
|
--dialog-surface-margin-top: max(
|
||||||
|
40px,
|
||||||
|
var(--safe-area-inset-top, 0px)
|
||||||
|
);
|
||||||
--dialog-content-padding: 0;
|
--dialog-content-padding: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -281,11 +281,11 @@ export class QuickBar extends LitElement {
|
|||||||
class="ha-scrollbar"
|
class="ha-scrollbar"
|
||||||
style=${styleMap({
|
style=${styleMap({
|
||||||
height: this._narrow
|
height: this._narrow
|
||||||
? "calc(100vh - 56px)"
|
? "calc(100vh - 56px - var(--safe-area-inset-top, 0px) - var(--safe-area-inset-bottom, 0px))"
|
||||||
: `${Math.min(
|
: `calc(${Math.min(
|
||||||
items.length * (commandMode ? 56 : 72) + 26,
|
items.length * (commandMode ? 56 : 72) + 26,
|
||||||
500
|
500
|
||||||
)}px`,
|
)}px - var(--safe-area-inset-top, 0px) - var(--safe-area-inset-bottom, 0px))`,
|
||||||
})}
|
})}
|
||||||
.items=${items}
|
.items=${items}
|
||||||
.renderItem=${this._renderItem}
|
.renderItem=${this._renderItem}
|
||||||
|
|||||||
@@ -884,7 +884,13 @@ export class HaTabsSubpageDataTable extends KeyboardShortcutMixin(LitElement) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.filter-dialog-content {
|
.filter-dialog-content {
|
||||||
height: calc(100vh - 1px - 61px - var(--header-height));
|
height: calc(
|
||||||
|
100vh -
|
||||||
|
70px - var(--header-height, 0px) - var(
|
||||||
|
--safe-area-inset-top,
|
||||||
|
0px
|
||||||
|
) - var(--safe-area-inset-bottom, 0px)
|
||||||
|
);
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -239,12 +239,8 @@ class DialogMQTTDeviceDebugInfo extends LitElement {
|
|||||||
}
|
}
|
||||||
@media all and (max-width: 450px), all and (max-height: 500px) {
|
@media all and (max-width: 450px), all and (max-height: 500px) {
|
||||||
ha-dialog {
|
ha-dialog {
|
||||||
--mdc-dialog-min-width: calc(
|
--mdc-dialog-min-width: 100vw;
|
||||||
100vw - var(--safe-area-inset-right) - var(--safe-area-inset-left)
|
--mdc-dialog-max-width: 100vw;
|
||||||
);
|
|
||||||
--mdc-dialog-max-width: calc(
|
|
||||||
100vw - var(--safe-area-inset-right) - var(--safe-area-inset-left)
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ha-switch {
|
ha-switch {
|
||||||
|
|||||||
@@ -430,7 +430,13 @@ export class DialogHelperDetail extends LitElement {
|
|||||||
}
|
}
|
||||||
@media all and (max-width: 450px), all and (max-height: 500px) {
|
@media all and (max-width: 450px), all and (max-height: 500px) {
|
||||||
ha-list {
|
ha-list {
|
||||||
height: calc(100vh - 184px);
|
height: calc(
|
||||||
|
100vh -
|
||||||
|
184px - var(--safe-area-inset-top, 0px) - var(
|
||||||
|
--safe-area-inset-bottom,
|
||||||
|
0px
|
||||||
|
)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
`,
|
`,
|
||||||
|
|||||||
@@ -461,7 +461,9 @@ class AddIntegrationDialog extends LitElement {
|
|||||||
class="ha-scrollbar"
|
class="ha-scrollbar"
|
||||||
style=${styleMap({
|
style=${styleMap({
|
||||||
width: `${this._width}px`,
|
width: `${this._width}px`,
|
||||||
height: this._narrow ? "calc(100vh - 184px)" : "500px",
|
height: this._narrow
|
||||||
|
? "calc(100vh - 184px - var(--safe-area-inset-top, 0px) - var(--safe-area-inset-bottom, 0px))"
|
||||||
|
: "500px",
|
||||||
})}
|
})}
|
||||||
@click=${this._integrationPicked}
|
@click=${this._integrationPicked}
|
||||||
@keypress=${this._handleKeyPress}
|
@keypress=${this._handleKeyPress}
|
||||||
|
|||||||
@@ -242,19 +242,21 @@ class DialogExposeEntity extends LitElement {
|
|||||||
}
|
}
|
||||||
@media all and (max-width: 500px), all and (max-height: 500px) {
|
@media all and (max-width: 500px), all and (max-height: 500px) {
|
||||||
ha-dialog {
|
ha-dialog {
|
||||||
--mdc-dialog-min-width: calc(
|
--mdc-dialog-min-width: 100vw;
|
||||||
100vw - var(--safe-area-inset-right) - var(--safe-area-inset-left)
|
--mdc-dialog-max-width: 100vw;
|
||||||
);
|
|
||||||
--mdc-dialog-max-width: calc(
|
|
||||||
100vw - var(--safe-area-inset-right) - var(--safe-area-inset-left)
|
|
||||||
);
|
|
||||||
--mdc-dialog-min-height: 100%;
|
--mdc-dialog-min-height: 100%;
|
||||||
--mdc-dialog-max-height: 100%;
|
--mdc-dialog-max-height: 100%;
|
||||||
--vertical-align-dialog: flex-end;
|
--vertical-align-dialog: flex-end;
|
||||||
--ha-dialog-border-radius: 0px;
|
--ha-dialog-border-radius: 0px;
|
||||||
}
|
}
|
||||||
lit-virtualizer {
|
lit-virtualizer {
|
||||||
height: calc(100vh - 198px);
|
height: calc(
|
||||||
|
100vh -
|
||||||
|
210px - var(--safe-area-inset-top, 0px) - var(
|
||||||
|
--safe-area-inset-bottom,
|
||||||
|
0px
|
||||||
|
)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
search-input {
|
search-input {
|
||||||
--text-field-suffix-padding-left: unset;
|
--text-field-suffix-padding-left: unset;
|
||||||
|
|||||||
@@ -137,9 +137,8 @@ class DialogHomeZoneDetail extends LitElement {
|
|||||||
}
|
}
|
||||||
@media all and (max-width: 450px), all and (max-height: 500px) {
|
@media all and (max-width: 450px), all and (max-height: 500px) {
|
||||||
ha-dialog {
|
ha-dialog {
|
||||||
--mdc-dialog-min-width: calc(
|
--mdc-dialog-min-width: 100vw;
|
||||||
100vw - var(--safe-area-inset-right) - var(--safe-area-inset-left)
|
--mdc-dialog-max-width: 100vw;
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
`,
|
`,
|
||||||
|
|||||||
@@ -224,9 +224,8 @@ class DialogZoneDetail extends LitElement {
|
|||||||
}
|
}
|
||||||
@media all and (max-width: 450px), all and (max-height: 500px) {
|
@media all and (max-width: 450px), all and (max-height: 500px) {
|
||||||
ha-dialog {
|
ha-dialog {
|
||||||
--mdc-dialog-min-width: calc(
|
--mdc-dialog-min-width: 100vw;
|
||||||
100vw - var(--safe-area-inset-right) - var(--safe-area-inset-left)
|
--mdc-dialog-max-width: 100vw;
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ha-form.passive {
|
ha-form.passive {
|
||||||
|
|||||||
Reference in New Issue
Block a user