@vaadin/dialog 23.1.0-alpha2 → 23.1.0-beta1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vaadin/dialog",
3
- "version": "23.1.0-alpha2",
3
+ "version": "23.1.0-beta1",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -35,18 +35,19 @@
35
35
  "dependencies": {
36
36
  "@open-wc/dedupe-mixin": "^1.3.0",
37
37
  "@polymer/polymer": "^3.0.0",
38
- "@vaadin/component-base": "23.1.0-alpha2",
39
- "@vaadin/vaadin-lumo-styles": "23.1.0-alpha2",
40
- "@vaadin/vaadin-material-styles": "23.1.0-alpha2",
41
- "@vaadin/vaadin-overlay": "23.1.0-alpha2",
42
- "@vaadin/vaadin-themable-mixin": "23.1.0-alpha2"
38
+ "@vaadin/component-base": "23.1.0-beta1",
39
+ "@vaadin/lit-renderer": "23.1.0-beta1",
40
+ "@vaadin/vaadin-lumo-styles": "23.1.0-beta1",
41
+ "@vaadin/vaadin-material-styles": "23.1.0-beta1",
42
+ "@vaadin/vaadin-overlay": "23.1.0-beta1",
43
+ "@vaadin/vaadin-themable-mixin": "23.1.0-beta1"
43
44
  },
44
45
  "devDependencies": {
45
46
  "@esm-bundle/chai": "^4.3.4",
46
- "@vaadin/polymer-legacy-adapter": "23.1.0-alpha2",
47
+ "@vaadin/polymer-legacy-adapter": "23.1.0-beta1",
47
48
  "@vaadin/testing-helpers": "^0.3.2",
48
- "@vaadin/text-area": "23.1.0-alpha2",
49
- "sinon": "^9.2.1"
49
+ "@vaadin/text-area": "23.1.0-beta1",
50
+ "sinon": "^13.0.2"
50
51
  },
51
- "gitHead": "6842dcb8b163d4512fae8d3d12a6559077a4aee6"
52
+ "gitHead": "8be43cf83102a6b9ccf309687446e590ce0164e8"
52
53
  }
@@ -0,0 +1,139 @@
1
+ /**
2
+ * @license
3
+ * Copyright (c) 2017 - 2022 Vaadin Ltd.
4
+ * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
+ */
6
+ /* eslint-disable max-classes-per-file */
7
+ import { TemplateResult } from 'lit';
8
+ import { DirectiveResult } from 'lit/directive.js';
9
+ import { LitRendererDirective } from '@vaadin/lit-renderer';
10
+ import { Dialog } from '../vaadin-dialog.js';
11
+
12
+ export type DialogLitRenderer = (dialog: Dialog) => TemplateResult;
13
+
14
+ declare abstract class AbstractDialogRendererDirective extends LitRendererDirective<Dialog, DialogLitRenderer> {
15
+ /**
16
+ * A property to that the renderer callback will be assigned.
17
+ */
18
+ abstract rendererProperty: 'renderer' | 'headerRenderer' | 'footerRenderer';
19
+
20
+ /**
21
+ * Adds the renderer callback to the dialog.
22
+ */
23
+ addRenderer(): void;
24
+
25
+ /**
26
+ * Runs the renderer callback on the dialog.
27
+ */
28
+ runRenderer(): void;
29
+
30
+ /**
31
+ * Removes the renderer callback from the dialog.
32
+ */
33
+ removeRenderer(): void;
34
+ }
35
+
36
+ export class DialogRendererDirective extends AbstractDialogRendererDirective {
37
+ rendererProperty: 'renderer';
38
+ }
39
+
40
+ export class DialogHeaderRendererDirective extends AbstractDialogRendererDirective {
41
+ rendererProperty: 'headerRenderer';
42
+ }
43
+
44
+ export class DialogFooterRendererDirective extends AbstractDialogRendererDirective {
45
+ rendererProperty: 'footerRenderer';
46
+ }
47
+
48
+ /**
49
+ * A Lit directive for populating the content of the dialog.
50
+ *
51
+ * The directive accepts a renderer callback returning a Lit template and assigns it to the dialog
52
+ * via the `renderer` property. The renderer is called to populate the content once when assigned
53
+ * and whenever a single dependency or an array of dependencies changes.
54
+ * It is not guaranteed that the renderer will be called immediately (synchronously) in both cases.
55
+ *
56
+ * Dependencies can be a single value or an array of values.
57
+ * Values are checked against previous values with strict equality (`===`),
58
+ * so the check won't detect nested property changes inside objects or arrays.
59
+ * When dependencies are provided as an array, each item is checked against the previous value
60
+ * at the same index with strict equality. Nested arrays are also checked only by strict
61
+ * equality.
62
+ *
63
+ * Example of usage:
64
+ * ```js
65
+ * `<vaadin-dialog
66
+ * ${dialogRenderer((dialog) => html`...`)}
67
+ * ></vaadin-dialog>`
68
+ * ```
69
+ *
70
+ * @param renderer the renderer callback that returns a Lit template.
71
+ * @param dependencies a single dependency or an array of dependencies
72
+ * which trigger a re-render when changed.
73
+ */
74
+ export declare function dialogRenderer(
75
+ renderer: DialogLitRenderer,
76
+ dependencies?: unknown,
77
+ ): DirectiveResult<typeof DialogRendererDirective>;
78
+
79
+ /**
80
+ * A Lit directive for populating the content of the dialog header.
81
+ *
82
+ * The directive accepts a renderer callback returning a Lit template and assigns it to the dialog
83
+ * via the `headerRenderer` property. The renderer is called to populate the content once
84
+ * when assigned and whenever a single dependency or an array of dependencies changes.
85
+ * It is not guaranteed that the renderer will be called immediately (synchronously) in both cases.
86
+ *
87
+ * Dependencies can be a single value or an array of values.
88
+ * Values are checked against previous values with strict equality (`===`),
89
+ * so the check won't detect nested property changes inside objects or arrays.
90
+ * When dependencies are provided as an array, each item is checked against the previous value
91
+ * at the same index with strict equality. Nested arrays are also checked only by strict
92
+ * equality.
93
+ *
94
+ * Example of usage:
95
+ * ```js
96
+ * `<vaadin-dialog
97
+ * ${dialogHeaderRenderer((dialog) => html`...`)}
98
+ * ></vaadin-dialog>`
99
+ * ```
100
+ *
101
+ * @param renderer the renderer callback.
102
+ * @param dependencies a single dependency or an array of dependencies
103
+ * which trigger a re-render when changed.
104
+ */
105
+ export declare function dialogHeaderRenderer(
106
+ renderer: DialogLitRenderer,
107
+ dependencies?: unknown,
108
+ ): DirectiveResult<typeof DialogHeaderRendererDirective>;
109
+
110
+ /**
111
+ * A Lit directive for populating the content of the dialog footer.
112
+ *
113
+ * The directive accepts a renderer callback returning a Lit template and assigns it to the dialog
114
+ * via the `footerRenderer` property. The renderer is called to populate the content once when assigned
115
+ * and whenever a single dependency or an array of dependencies changes.
116
+ * It is not guaranteed that the renderer will be called immediately (synchronously) in both cases.
117
+ *
118
+ * Dependencies can be a single value or an array of values.
119
+ * Values are checked against previous values with strict equality (`===`),
120
+ * so the check won't detect nested property changes inside objects or arrays.
121
+ * When dependencies are provided as an array, each item is checked against the previous value
122
+ * at the same index with strict equality. Nested arrays are also checked only by strict
123
+ * equality.
124
+ *
125
+ * Example of usage:
126
+ * ```js
127
+ * `<vaadin-dialog
128
+ * ${dialogFooterRenderer((dialog) => html`...`)}
129
+ * ></vaadin-dialog>`
130
+ * ```
131
+ *
132
+ * @param renderer the renderer callback.
133
+ * @param dependencies a single dependency or an array of dependencies
134
+ * which trigger a re-render when changed.
135
+ */
136
+ export declare function dialogFooterRenderer(
137
+ renderer: DialogLitRenderer,
138
+ dependencies?: unknown,
139
+ ): DirectiveResult<typeof DialogFooterRendererDirective>;
@@ -0,0 +1,147 @@
1
+ /**
2
+ * @license
3
+ * Copyright (c) 2017 - 2022 Vaadin Ltd.
4
+ * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
+ */
6
+ /* eslint-disable max-classes-per-file */
7
+ import { directive } from 'lit/directive.js';
8
+ import { microTask } from '@vaadin/component-base/src/async.js';
9
+ import { Debouncer } from '@vaadin/component-base/src/debounce.js';
10
+ import { LitRendererDirective } from '@vaadin/lit-renderer';
11
+
12
+ const CONTENT_UPDATE_DEBOUNCER = Symbol('contentUpdateDebouncer');
13
+
14
+ class AbstractDialogRendererDirective extends LitRendererDirective {
15
+ /**
16
+ * A property to that the renderer callback will be assigned.
17
+ *
18
+ * @abstract
19
+ */
20
+ rendererProperty;
21
+
22
+ /**
23
+ * Adds the renderer callback to the dialog.
24
+ */
25
+ addRenderer() {
26
+ this.element[this.rendererProperty] = (root, dialog) => {
27
+ this.renderRenderer(root, dialog);
28
+ };
29
+ }
30
+
31
+ /**
32
+ * Runs the renderer callback on the dialog.
33
+ */
34
+ runRenderer() {
35
+ this.element[CONTENT_UPDATE_DEBOUNCER] = Debouncer.debounce(
36
+ this.element[CONTENT_UPDATE_DEBOUNCER],
37
+ microTask,
38
+ () => {
39
+ this.element.requestContentUpdate();
40
+ },
41
+ );
42
+ }
43
+
44
+ /**
45
+ * Removes the renderer callback from the dialog.
46
+ */
47
+ removeRenderer() {
48
+ this.element[this.rendererProperty] = null;
49
+ delete this.element[CONTENT_UPDATE_DEBOUNCER];
50
+ }
51
+ }
52
+
53
+ export class DialogRendererDirective extends AbstractDialogRendererDirective {
54
+ rendererProperty = 'renderer';
55
+ }
56
+
57
+ export class DialogHeaderRendererDirective extends AbstractDialogRendererDirective {
58
+ rendererProperty = 'headerRenderer';
59
+ }
60
+
61
+ export class DialogFooterRendererDirective extends AbstractDialogRendererDirective {
62
+ rendererProperty = 'footerRenderer';
63
+ }
64
+
65
+ /**
66
+ * A Lit directive for populating the content of the dialog.
67
+ *
68
+ * The directive accepts a renderer callback returning a Lit template and assigns it to the dialog
69
+ * via the `renderer` property. The renderer is called to populate the content once when assigned
70
+ * and whenever a single dependency or an array of dependencies changes.
71
+ * It is not guaranteed that the renderer will be called immediately (synchronously) in both cases.
72
+ *
73
+ * Dependencies can be a single value or an array of values.
74
+ * Values are checked against previous values with strict equality (`===`),
75
+ * so the check won't detect nested property changes inside objects or arrays.
76
+ * When dependencies are provided as an array, each item is checked against the previous value
77
+ * at the same index with strict equality. Nested arrays are also checked only by strict
78
+ * equality.
79
+ *
80
+ * Example of usage:
81
+ * ```js
82
+ * `<vaadin-dialog
83
+ * ${dialogRenderer((dialog) => html`...`)}
84
+ * ></vaadin-dialog>`
85
+ * ```
86
+ *
87
+ * @param renderer the renderer callback that returns a Lit template.
88
+ * @param dependencies a single dependency or an array of dependencies
89
+ * which trigger a re-render when changed.
90
+ */
91
+ export const dialogRenderer = directive(DialogRendererDirective);
92
+
93
+ /**
94
+ * A Lit directive for populating the content of the dialog header.
95
+ *
96
+ * The directive accepts a renderer callback returning a Lit template and assigns it to the dialog
97
+ * via the `headerRenderer` property. The renderer is called to populate the content once when assigned
98
+ * and whenever a single dependency or an array of dependencies changes.
99
+ * It is not guaranteed that the renderer will be called immediately (synchronously) in both cases.
100
+ *
101
+ * Dependencies can be a single value or an array of values.
102
+ * Values are checked against previous values with strict equality (`===`),
103
+ * so the check won't detect nested property changes inside objects or arrays.
104
+ * When dependencies are provided as an array, each item is checked against the previous value
105
+ * at the same index with strict equality. Nested arrays are also checked only by strict
106
+ * equality.
107
+ *
108
+ * Example of usage:
109
+ * ```js
110
+ * `<vaadin-dialog
111
+ * ${dialogHeaderRenderer((dialog) => html`...`)}
112
+ * ></vaadin-dialog>`
113
+ * ```
114
+ *
115
+ * @param renderer the renderer callback.
116
+ * @param dependencies a single dependency or an array of dependencies
117
+ * which trigger a re-render when changed.
118
+ */
119
+ export const dialogHeaderRenderer = directive(DialogHeaderRendererDirective);
120
+
121
+ /**
122
+ * A Lit directive for populating the content of the dialog footer.
123
+ *
124
+ * The directive accepts a renderer callback returning a Lit template and assigns it to the dialog
125
+ * via the `footerRenderer` property. The renderer is called to populate the content once when assigned
126
+ * and whenever a single dependency or an array of dependencies changes.
127
+ * It is not guaranteed that the renderer will be called immediately (synchronously) in both cases.
128
+ *
129
+ * Dependencies can be a single value or an array of values.
130
+ * Values are checked against previous values with strict equality (`===`),
131
+ * so the check won't detect nested property changes inside objects or arrays.
132
+ * When dependencies are provided as an array, each item is checked against the previous value
133
+ * at the same index with strict equality. Nested arrays are also checked only by strict
134
+ * equality.
135
+ *
136
+ * Example of usage:
137
+ * ```js
138
+ * `<vaadin-dialog
139
+ * ${dialogFooterRenderer((dialog) => html`...`)}
140
+ * ></vaadin-dialog>`
141
+ * ```
142
+ *
143
+ * @param renderer the renderer callback.
144
+ * @param dependencies a single dependency or an array of dependencies
145
+ * which trigger a re-render when changed.
146
+ */
147
+ export const dialogFooterRenderer = directive(DialogFooterRendererDirective);
@@ -6,7 +6,7 @@
6
6
  import { Constructor } from '@open-wc/dedupe-mixin';
7
7
 
8
8
  export declare function DialogDraggableMixin<T extends Constructor<HTMLElement>>(
9
- base: T
9
+ base: T,
10
10
  ): T & Constructor<DialogDraggableMixinClass>;
11
11
 
12
12
  export declare class DialogDraggableMixinClass {
@@ -28,19 +28,19 @@ export const DialogDraggableMixin = (superClass) =>
28
28
  draggable: {
29
29
  type: Boolean,
30
30
  value: false,
31
- reflectToAttribute: true
31
+ reflectToAttribute: true,
32
32
  },
33
33
 
34
34
  /** @private */
35
35
  _touchDevice: {
36
36
  type: Boolean,
37
- value: isTouch
37
+ value: isTouch,
38
38
  },
39
39
 
40
40
  /* TODO: Expose as a public property (check naming) */
41
41
  __dragHandleClassName: {
42
- type: String
43
- }
42
+ type: String,
43
+ },
44
44
  };
45
45
  }
46
46
 
@@ -82,7 +82,9 @@ export const DialogDraggableMixin = (superClass) =>
82
82
  });
83
83
 
84
84
  if ((isResizerContainer && !isResizerContainerScrollbar) || isContentPart || isDraggable) {
85
- !isDraggable && e.preventDefault();
85
+ if (!isDraggable) {
86
+ e.preventDefault();
87
+ }
86
88
  this._originalBounds = this.$.overlay.getBounds();
87
89
  const event = getMouseOrFirstTouchEvent(e);
88
90
  this._originalMouseCoords = { top: event.pageY, left: event.pageX };
@@ -6,7 +6,7 @@
6
6
  import { Constructor } from '@open-wc/dedupe-mixin';
7
7
 
8
8
  export declare function DialogResizableMixin<T extends Constructor<HTMLElement>>(
9
- base: T
9
+ base: T,
10
10
  ): T & Constructor<DialogResizableMixinClass>;
11
11
 
12
12
  export declare class DialogResizableMixinClass {
@@ -105,7 +105,7 @@ registerStyles(
105
105
  cursor: nwse-resize;
106
106
  }
107
107
  `,
108
- { moduleId: 'vaadin-dialog-resizable-overlay-styles' }
108
+ { moduleId: 'vaadin-dialog-resizable-overlay-styles' },
109
109
  );
110
110
 
111
111
  /**
@@ -122,8 +122,8 @@ export const DialogResizableMixin = (superClass) =>
122
122
  resizable: {
123
123
  type: Boolean,
124
124
  value: false,
125
- reflectToAttribute: true
126
- }
125
+ reflectToAttribute: true,
126
+ },
127
127
  };
128
128
  }
129
129
 
@@ -252,7 +252,7 @@ export const DialogResizableMixin = (superClass) =>
252
252
  const content = this.$.overlay.$.content;
253
253
  content.setAttribute(
254
254
  'style',
255
- 'position: absolute; top: 0; right: 0; bottom: 0; left: 0; box-sizing: content-box; height: auto;'
255
+ 'position: absolute; top: 0; right: 0; bottom: 0; left: 0; box-sizing: content-box; height: auto;',
256
256
  );
257
257
  const { width: contentWidth, height: contentHeight } = getComputedStyle(content);
258
258
  content.removeAttribute('style');
@@ -208,13 +208,13 @@ declare class Dialog extends ThemePropertyMixin(ElementMixin(DialogDraggableMixi
208
208
  addEventListener<K extends keyof DialogEventMap>(
209
209
  type: K,
210
210
  listener: (this: Dialog, ev: DialogEventMap[K]) => void,
211
- options?: boolean | AddEventListenerOptions
211
+ options?: boolean | AddEventListenerOptions,
212
212
  ): void;
213
213
 
214
214
  removeEventListener<K extends keyof DialogEventMap>(
215
215
  type: K,
216
216
  listener: (this: Dialog, ev: DialogEventMap[K]) => void,
217
- options?: boolean | EventListenerOptions
217
+ options?: boolean | EventListenerOptions,
218
218
  ): void;
219
219
  }
220
220
 
@@ -15,10 +15,9 @@ import { DialogResizableMixin } from './vaadin-dialog-resizable-mixin.js';
15
15
  registerStyles(
16
16
  'vaadin-dialog-overlay',
17
17
  css`
18
- /* prefixing with the element tags to avoid styling confirm-dialog header part */
19
- header[part='header'],
18
+ [part='header'],
20
19
  [part='header-content'],
21
- footer[part='footer'] {
20
+ [part='footer'] {
22
21
  display: flex;
23
22
  align-items: center;
24
23
  flex-wrap: wrap;
@@ -27,10 +26,9 @@ registerStyles(
27
26
  z-index: 1;
28
27
  }
29
28
 
30
- :host(:is([has-title], [has-header])) ::slotted([slot='header']),
31
29
  ::slotted([slot='header-content']),
32
30
  ::slotted([slot='title']),
33
- :host([has-footer]) ::slotted([slot='footer']) {
31
+ ::slotted([slot='footer']) {
34
32
  display: contents;
35
33
  pointer-events: auto;
36
34
  }
@@ -39,19 +37,16 @@ registerStyles(
39
37
  flex: 1;
40
38
  }
41
39
 
42
- /* prefixing with the element tag to avoid styling confirm-dialog footer part */
43
- [part='header-content'],
44
- footer[part='footer'] {
40
+ :host([has-title]) [part='header-content'],
41
+ [part='footer'] {
45
42
  justify-content: flex-end;
46
43
  }
47
44
 
48
- :host(:not([has-title]):not([has-header])) header[part='header'],
49
- :host(:not([has-title])) [part='title'] {
50
- display: none;
51
- }
52
-
53
- :host(:not([has-footer])) footer[part='footer'] {
54
- display: none;
45
+ :host(:not([has-title]):not([has-header])) [part='header'],
46
+ :host(:not([has-header])) [part='header-content'],
47
+ :host(:not([has-title])) [part='title'],
48
+ :host(:not([has-footer])) [part='footer'] {
49
+ display: none !important;
55
50
  }
56
51
 
57
52
  :host(:is([has-title], [has-header], [has-footer])) [part='content'] {
@@ -83,7 +78,7 @@ registerStyles(
83
78
  max-width: none;
84
79
  }
85
80
  `,
86
- { moduleId: 'vaadin-dialog-overlay-styles' }
81
+ { moduleId: 'vaadin-dialog-overlay-styles' },
87
82
  );
88
83
 
89
84
  let memoizedTemplate;
@@ -104,7 +99,7 @@ export class DialogOverlay extends OverlayElement {
104
99
  memoizedTemplate = super.template.cloneNode(true);
105
100
  const contentPart = memoizedTemplate.content.querySelector('[part="content"]');
106
101
  const overlayPart = memoizedTemplate.content.querySelector('[part="overlay"]');
107
- const resizerContainer = document.createElement('div');
102
+ const resizerContainer = document.createElement('section');
108
103
  resizerContainer.id = 'resizerContainer';
109
104
  resizerContainer.classList.add('resizer-container');
110
105
  resizerContainer.appendChild(contentPart);
@@ -144,7 +139,7 @@ export class DialogOverlay extends OverlayElement {
144
139
  static get observers() {
145
140
  return [
146
141
  '_headerFooterRendererChange(headerRenderer, footerRenderer, opened)',
147
- '_headerTitleChanged(headerTitle, opened)'
142
+ '_headerTitleChanged(headerTitle, opened)',
148
143
  ];
149
144
  }
150
145
 
@@ -158,7 +153,7 @@ export class DialogOverlay extends OverlayElement {
158
153
 
159
154
  headerRenderer: Function,
160
155
 
161
- footerRenderer: Function
156
+ footerRenderer: Function,
162
157
  };
163
158
  }
164
159
 
@@ -166,9 +161,6 @@ export class DialogOverlay extends OverlayElement {
166
161
  ready() {
167
162
  super.ready();
168
163
 
169
- const uniqueId = (DialogOverlay._uniqueId = 1 + DialogOverlay._uniqueId || 0);
170
- this._titleId = `${this.constructor.is}-title-${uniqueId}`;
171
-
172
164
  // Update overflow attribute on resize
173
165
  this.__resizeObserver = new ResizeObserver(() => {
174
166
  this.__updateOverflow();
@@ -269,18 +261,14 @@ export class DialogOverlay extends OverlayElement {
269
261
  if (this.headerTitle) {
270
262
  if (!this.headerTitleElement) {
271
263
  this.headerTitleElement = document.createElement('span');
272
- this.headerTitleElement.id = this._titleId;
273
264
  this.headerTitleElement.setAttribute('slot', 'title');
274
265
  this.headerTitleElement.classList.add('draggable');
275
-
276
- this.setAttribute('aria-labelledby', this._titleId);
277
266
  }
278
267
  this.appendChild(this.headerTitleElement);
279
268
  this.headerTitleElement.textContent = this.headerTitle;
280
269
  } else if (this.headerTitleElement) {
281
270
  this.headerTitleElement.remove();
282
271
  this.headerTitleElement = null;
283
- this.removeAttribute('aria-labelledby');
284
272
  }
285
273
  }
286
274
 
@@ -502,7 +490,7 @@ class Dialog extends ThemePropertyMixin(ElementMixin(DialogDraggableMixin(Dialog
502
490
  opened: {
503
491
  type: Boolean,
504
492
  value: false,
505
- notify: true
493
+ notify: true,
506
494
  },
507
495
 
508
496
  /**
@@ -512,7 +500,7 @@ class Dialog extends ThemePropertyMixin(ElementMixin(DialogDraggableMixin(Dialog
512
500
  */
513
501
  noCloseOnOutsideClick: {
514
502
  type: Boolean,
515
- value: false
503
+ value: false,
516
504
  },
517
505
 
518
506
  /**
@@ -522,7 +510,7 @@ class Dialog extends ThemePropertyMixin(ElementMixin(DialogDraggableMixin(Dialog
522
510
  */
523
511
  noCloseOnEsc: {
524
512
  type: Boolean,
525
- value: false
513
+ value: false,
526
514
  },
527
515
 
528
516
  /**
@@ -532,7 +520,7 @@ class Dialog extends ThemePropertyMixin(ElementMixin(DialogDraggableMixin(Dialog
532
520
  */
533
521
  ariaLabel: {
534
522
  type: String,
535
- value: ''
523
+ value: '',
536
524
  },
537
525
 
538
526
  /**
@@ -591,16 +579,16 @@ class Dialog extends ThemePropertyMixin(ElementMixin(DialogDraggableMixin(Dialog
591
579
  */
592
580
  modeless: {
593
581
  type: Boolean,
594
- value: false
595
- }
582
+ value: false,
583
+ },
596
584
  };
597
585
  }
598
586
 
599
587
  static get observers() {
600
588
  return [
601
589
  '_openedChanged(opened)',
602
- '_ariaLabelChanged(ariaLabel)',
603
- '_rendererChanged(renderer, headerRenderer, footerRenderer)'
590
+ '_ariaLabelChanged(ariaLabel, headerTitle)',
591
+ '_rendererChanged(renderer, headerRenderer, footerRenderer)',
604
592
  ];
605
593
  }
606
594
 
@@ -653,9 +641,9 @@ class Dialog extends ThemePropertyMixin(ElementMixin(DialogDraggableMixin(Dialog
653
641
  }
654
642
 
655
643
  /** @private */
656
- _ariaLabelChanged(ariaLabel) {
657
- if (ariaLabel) {
658
- this.$.overlay.setAttribute('aria-label', ariaLabel);
644
+ _ariaLabelChanged(ariaLabel, headerTitle) {
645
+ if (ariaLabel || headerTitle) {
646
+ this.$.overlay.setAttribute('aria-label', ariaLabel || headerTitle);
659
647
  } else {
660
648
  this.$.overlay.removeAttribute('aria-label');
661
649
  }
@@ -31,25 +31,21 @@ const dialogOverlay = css`
31
31
  padding-top: 0;
32
32
  }
33
33
 
34
- :host(:is([has-header], [has-title])) [part='header'],
35
- :host([has-header]) [part='header-content'],
36
- :host([has-footer]) [part='footer'] {
34
+ [part='header'],
35
+ [part='header-content'],
36
+ [part='footer'] {
37
37
  gap: var(--lumo-space-xs) var(--lumo-space-s);
38
38
  line-height: var(--lumo-line-height-s);
39
39
  }
40
40
 
41
- :host(:is([has-header], [has-title])) [part='header'] {
42
- padding: var(--lumo-space-s) var(--lumo-space-m);
43
- min-height: var(--lumo-size-xl);
44
- box-sizing: border-box;
41
+ [part='header'] {
42
+ padding: var(--lumo-space-m);
45
43
  background-color: var(--lumo-base-color);
46
44
  border-radius: var(--lumo-border-radius-l) var(--lumo-border-radius-l) 0 0; /* Needed for Safari */
47
45
  }
48
46
 
49
- :host([has-footer]) [part='footer'] {
47
+ [part='footer'] {
50
48
  padding: var(--lumo-space-s) var(--lumo-space-m);
51
- min-height: var(--lumo-size-l);
52
- box-sizing: border-box;
53
49
  background-color: var(--lumo-contrast-5pct);
54
50
  border-radius: 0 0 var(--lumo-border-radius-l) var(--lumo-border-radius-l); /* Needed for Safari */
55
51
  }
@@ -66,16 +62,8 @@ const dialogOverlay = css`
66
62
  padding: 0;
67
63
  }
68
64
 
69
- :host([theme~='no-padding']:is([has-header], [has-title])) [part='header'] {
70
- padding: 0;
71
- }
72
-
73
- :host([theme~='no-padding'][has-footer]) [part='footer'] {
74
- padding: 0;
75
- }
76
-
77
65
  @media (min-height: 320px) {
78
- :host(:is([has-header], [has-title])[overflow~='top']) [part='header'] {
66
+ :host([overflow~='top']) [part='header'] {
79
67
  box-shadow: 0 1px 0 0 var(--lumo-contrast-10pct);
80
68
  }
81
69
  }
@@ -16,7 +16,7 @@ const dialogOverlay = css`
16
16
  padding: 24px;
17
17
  }
18
18
 
19
- :host(:is([has-header], [has-title])) [part='header'] {
19
+ [part='header'] {
20
20
  padding: 16px;
21
21
  }
22
22
 
@@ -24,9 +24,9 @@ const dialogOverlay = css`
24
24
  padding-top: 0;
25
25
  }
26
26
 
27
- :host(:is([has-header], [has-title])) [part='header'],
28
- :host([has-header]) [part='header-content'],
29
- :host([has-footer]) [part='footer'] {
27
+ [part='header'],
28
+ [part='header-content'],
29
+ [part='footer'] {
30
30
  gap: 8px;
31
31
  line-height: 1.2;
32
32
  }
@@ -37,16 +37,16 @@ const dialogOverlay = css`
37
37
  margin-inline-start: 8px;
38
38
  }
39
39
 
40
- :host([has-footer]) [part='footer'] {
40
+ [part='footer'] {
41
41
  padding: 8px;
42
42
  }
43
43
 
44
44
  @media (min-height: 320px) {
45
- :host(:is([has-header], [has-title])[overflow~='top']) [part='header'] {
45
+ :host([overflow~='top']) [part='header'] {
46
46
  box-shadow: 0 1px 0 0 var(--material-divider-color);
47
47
  }
48
48
 
49
- :host([has-footer][overflow~='bottom']) [part='footer'] {
49
+ :host([overflow~='bottom']) [part='footer'] {
50
50
  box-shadow: 0 -1px 0 0 var(--material-divider-color);
51
51
  }
52
52
  }
@@ -58,5 +58,5 @@ const dialogOverlay = css`
58
58
  `;
59
59
 
60
60
  registerStyles('vaadin-dialog-overlay', [overlay, dialogOverlay], {
61
- moduleId: 'material-dialog'
61
+ moduleId: 'material-dialog',
62
62
  });