1- import { css , html , LitElement , nothing } from "lit" ;
2- import { customElement , property , state } from "lit/decorators" ;
31import "@home-assistant/webawesome/dist/components/dialog/dialog" ;
42import { mdiClose } from "@mdi/js" ;
5- import "./ha-dialog-header" ;
6- import "./ha-icon-button" ;
7- import type { HomeAssistant } from "../types" ;
3+ import { css , html , LitElement , nothing } from "lit" ;
4+ import { customElement , eventOptions , property , state } from "lit/decorators" ;
85import { fireEvent } from "../common/dom/fire_event" ;
96import { haStyleScrollbar } from "../resources/styles" ;
7+ import type { HomeAssistant } from "../types" ;
8+ import "./ha-dialog-header" ;
9+ import "./ha-icon-button" ;
1010
1111export type DialogWidth = "small" | "medium" | "large" | "full" ;
1212
@@ -90,6 +90,9 @@ export class HaWaDialog extends LitElement {
9090 @state ( )
9191 private _open = false ;
9292
93+ @state ( )
94+ private _bodyScrolled = false ;
95+
9396 protected updated (
9497 changedProperties : Map < string | number | symbol , unknown >
9598 ) : void {
@@ -110,7 +113,10 @@ export class HaWaDialog extends LitElement {
110113 @wa-after-hide = ${ this . _handleAfterHide }
111114 >
112115 <slot name= "header" >
113- <ha- dialog- header .subtitlePosition = ${ this . headerSubtitlePosition } >
116+ <ha- dialog- header
117+ .subtitlePosition = ${ this . headerSubtitlePosition }
118+ .showBorder = ${ this . _bodyScrolled }
119+ >
114120 <slot name= "headerNavigationIcon" slot = "navigationIcon" >
115121 <ha- icon- butto n
116122 data- dialog= "close"
@@ -129,7 +135,7 @@ export class HaWaDialog extends LitElement {
129135 <slot name= "headerActionItems" slot = "actionItems" > </ slot>
130136 </ ha- dialog- header>
131137 </ slot>
132- <div class= "body ha-scrollbar" >
138+ <div class= "body ha-scrollbar" @scroll = ${ this . _handleBodyScroll } >
133139 <slot> </ slot>
134140 </ div>
135141 <slot name= "footer" slot = "footer" > </ slot>
@@ -156,6 +162,11 @@ export class HaWaDialog extends LitElement {
156162 this . _open = false ;
157163 }
158164
165+ @eventOptions ( { passive : true } )
166+ private _handleBodyScroll ( ev : Event ) {
167+ this . _bodyScrolled = ( ev . target as HTMLDivElement ) . scrollTop > 0 ;
168+ }
169+
159170 static styles = [
160171 haStyleScrollbar ,
161172 css `
0 commit comments