@vaadin/dialog 25.0.0-alpha2 → 25.0.0-alpha21
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 +11 -12
- package/src/lit/renderer-directives.d.ts +0 -1
- package/src/{vaadin-dialog-styles.d.ts → styles/vaadin-dialog-overlay-base-styles.d.ts} +3 -3
- package/src/styles/vaadin-dialog-overlay-base-styles.js +215 -0
- package/src/vaadin-dialog-base-mixin.d.ts +9 -22
- package/src/vaadin-dialog-base-mixin.js +34 -28
- package/src/vaadin-dialog-draggable-mixin.js +2 -1
- package/src/vaadin-dialog-overlay-mixin.d.ts +0 -14
- package/src/vaadin-dialog-overlay-mixin.js +32 -41
- package/src/vaadin-dialog-overlay.d.ts +1 -1
- package/src/vaadin-dialog-overlay.js +16 -5
- package/src/vaadin-dialog-renderer-mixin.d.ts +3 -3
- package/src/vaadin-dialog-renderer-mixin.js +3 -3
- package/src/vaadin-dialog-resizable-mixin.js +2 -14
- package/src/vaadin-dialog-size-mixin.d.ts +24 -0
- package/src/vaadin-dialog-size-mixin.js +40 -0
- package/src/vaadin-dialog.d.ts +9 -24
- package/src/vaadin-dialog.js +41 -33
- package/vaadin-dialog.js +1 -1
- package/web-types.json +22 -66
- package/web-types.lit.json +13 -27
- package/src/vaadin-dialog-styles.js +0 -181
- package/theme/lumo/vaadin-dialog-styles.d.ts +0 -3
- package/theme/lumo/vaadin-dialog-styles.js +0 -109
- package/theme/lumo/vaadin-dialog.d.ts +0 -2
- package/theme/lumo/vaadin-dialog.js +0 -2
|
@@ -7,10 +7,10 @@ import { html, LitElement } from 'lit';
|
|
|
7
7
|
import { defineCustomElement } from '@vaadin/component-base/src/define.js';
|
|
8
8
|
import { DirMixin } from '@vaadin/component-base/src/dir-mixin.js';
|
|
9
9
|
import { PolylitMixin } from '@vaadin/component-base/src/polylit-mixin.js';
|
|
10
|
-
import {
|
|
10
|
+
import { LumoInjectionMixin } from '@vaadin/vaadin-themable-mixin/lumo-injection-mixin.js';
|
|
11
11
|
import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
12
|
+
import { dialogOverlayStyles } from './styles/vaadin-dialog-overlay-base-styles.js';
|
|
12
13
|
import { DialogOverlayMixin } from './vaadin-dialog-overlay-mixin.js';
|
|
13
|
-
import { dialogOverlay, resizableOverlay } from './vaadin-dialog-styles.js';
|
|
14
14
|
|
|
15
15
|
/**
|
|
16
16
|
* An element used internally by `<vaadin-dialog>`. Not intended to be used separately.
|
|
@@ -22,20 +22,31 @@ import { dialogOverlay, resizableOverlay } from './vaadin-dialog-styles.js';
|
|
|
22
22
|
* @mixes ThemableMixin
|
|
23
23
|
* @private
|
|
24
24
|
*/
|
|
25
|
-
export class DialogOverlay extends DialogOverlayMixin(
|
|
25
|
+
export class DialogOverlay extends DialogOverlayMixin(
|
|
26
|
+
DirMixin(ThemableMixin(PolylitMixin(LumoInjectionMixin(LitElement)))),
|
|
27
|
+
) {
|
|
26
28
|
static get is() {
|
|
27
29
|
return 'vaadin-dialog-overlay';
|
|
28
30
|
}
|
|
29
31
|
|
|
30
32
|
static get styles() {
|
|
31
|
-
return
|
|
33
|
+
return dialogOverlayStyles;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Override method from OverlayFocusMixin to use owner as focus trap root
|
|
38
|
+
* @protected
|
|
39
|
+
* @override
|
|
40
|
+
*/
|
|
41
|
+
get _focusTrapRoot() {
|
|
42
|
+
return this.owner;
|
|
32
43
|
}
|
|
33
44
|
|
|
34
45
|
/** @protected */
|
|
35
46
|
render() {
|
|
36
47
|
return html`
|
|
37
48
|
<div id="backdrop" part="backdrop" ?hidden="${!this.withBackdrop}"></div>
|
|
38
|
-
<div part="overlay" id="overlay"
|
|
49
|
+
<div part="overlay" id="overlay">
|
|
39
50
|
<section id="resizerContainer" class="resizer-container">
|
|
40
51
|
<header part="header">
|
|
41
52
|
<div part="title"><slot name="title"></slot></div>
|
|
@@ -27,7 +27,7 @@ export declare class DialogRendererMixinClass {
|
|
|
27
27
|
* and the elements created by the renderer will be placed next to
|
|
28
28
|
* each other, with the title coming first.
|
|
29
29
|
*
|
|
30
|
-
* When `headerTitle` is set, the attribute `has-title` is
|
|
30
|
+
* When `headerTitle` is set, the attribute `has-title` is set on the dialog.
|
|
31
31
|
* @attr {string} header-title
|
|
32
32
|
*/
|
|
33
33
|
headerTitle: string | null | undefined;
|
|
@@ -43,7 +43,7 @@ export declare class DialogRendererMixinClass {
|
|
|
43
43
|
* and the elements created by the renderer will be placed next to
|
|
44
44
|
* each other, with the title coming first.
|
|
45
45
|
*
|
|
46
|
-
* When `headerRenderer` is set, the attribute `has-header` is
|
|
46
|
+
* When `headerRenderer` is set, the attribute `has-header` is set on the dialog.
|
|
47
47
|
*/
|
|
48
48
|
headerRenderer: DialogRenderer | null | undefined;
|
|
49
49
|
|
|
@@ -54,7 +54,7 @@ export declare class DialogRendererMixinClass {
|
|
|
54
54
|
* - `root` The root container DOM element. Append your content to it.
|
|
55
55
|
* - `dialog` The reference to the `<vaadin-dialog>` element.
|
|
56
56
|
*
|
|
57
|
-
* When `footerRenderer` is set, the attribute `has-footer` is
|
|
57
|
+
* When `footerRenderer` is set, the attribute `has-footer` is set on the dialog.
|
|
58
58
|
*/
|
|
59
59
|
footerRenderer: DialogRenderer | null | undefined;
|
|
60
60
|
|
|
@@ -30,7 +30,7 @@ export const DialogRendererMixin = (superClass) =>
|
|
|
30
30
|
* and the elements created by the renderer will be placed next to
|
|
31
31
|
* each other, with the title coming first.
|
|
32
32
|
*
|
|
33
|
-
* When `headerTitle` is set, the attribute `has-title` is
|
|
33
|
+
* When `headerTitle` is set, the attribute `has-title` is set on the dialog.
|
|
34
34
|
* @attr {string} header-title
|
|
35
35
|
*/
|
|
36
36
|
headerTitle: String,
|
|
@@ -46,7 +46,7 @@ export const DialogRendererMixin = (superClass) =>
|
|
|
46
46
|
* and the elements created by the renderer will be placed next to
|
|
47
47
|
* each other, with the title coming first.
|
|
48
48
|
*
|
|
49
|
-
* When `headerRenderer` is set, the attribute `has-header` is
|
|
49
|
+
* When `headerRenderer` is set, the attribute `has-header` is set on the dialog.
|
|
50
50
|
* @type {DialogRenderer | undefined}
|
|
51
51
|
*/
|
|
52
52
|
headerRenderer: {
|
|
@@ -60,7 +60,7 @@ export const DialogRendererMixin = (superClass) =>
|
|
|
60
60
|
* - `root` The root container DOM element. Append your content to it.
|
|
61
61
|
* - `dialog` The reference to the `<vaadin-dialog>` element.
|
|
62
62
|
*
|
|
63
|
-
* When `footerRenderer` is set, the attribute `has-footer` is
|
|
63
|
+
* When `footerRenderer` is set, the attribute `has-footer` is set on the dialog.
|
|
64
64
|
* @type {DialogRenderer | undefined}
|
|
65
65
|
*/
|
|
66
66
|
footerRenderer: {
|
|
@@ -72,10 +72,7 @@ export const DialogResizableMixin = (superClass) =>
|
|
|
72
72
|
window.addEventListener('touchmove', this._resizeListeners.resize[direction]);
|
|
73
73
|
window.addEventListener('mouseup', this._resizeListeners.stop[direction]);
|
|
74
74
|
window.addEventListener('touchend', this._resizeListeners.stop[direction]);
|
|
75
|
-
|
|
76
|
-
this.$.overlay.setBounds(this._originalBounds);
|
|
77
|
-
}
|
|
78
|
-
|
|
75
|
+
this.$.overlay.setBounds(this._originalBounds);
|
|
79
76
|
this.$.overlay.setAttribute('has-bounds-set', '');
|
|
80
77
|
}
|
|
81
78
|
}
|
|
@@ -147,17 +144,8 @@ export const DialogResizableMixin = (superClass) =>
|
|
|
147
144
|
* @protected
|
|
148
145
|
*/
|
|
149
146
|
_getResizeDimensions() {
|
|
150
|
-
const scrollPosition = this.$.overlay.$.resizerContainer.scrollTop;
|
|
151
147
|
const { width, height, top, left } = getComputedStyle(this.$.overlay.$.overlay);
|
|
152
|
-
|
|
153
|
-
content.setAttribute(
|
|
154
|
-
'style',
|
|
155
|
-
'position: absolute; top: 0; right: 0; bottom: 0; left: 0; box-sizing: content-box; height: auto;',
|
|
156
|
-
);
|
|
157
|
-
const { width: contentWidth, height: contentHeight } = getComputedStyle(content);
|
|
158
|
-
content.removeAttribute('style');
|
|
159
|
-
this.$.overlay.$.resizerContainer.scrollTop = scrollPosition;
|
|
160
|
-
return { width, height, contentWidth, contentHeight, top, left };
|
|
148
|
+
return { width, height, top, left };
|
|
161
149
|
}
|
|
162
150
|
|
|
163
151
|
/**
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright (c) 2017 - 2025 Vaadin Ltd.
|
|
4
|
+
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
|
+
*/
|
|
6
|
+
import type { Constructor } from '@open-wc/dedupe-mixin';
|
|
7
|
+
|
|
8
|
+
export declare function DialogSizeMixin<T extends Constructor<HTMLElement>>(
|
|
9
|
+
base: T,
|
|
10
|
+
): Constructor<DialogSizeMixinClass> & T;
|
|
11
|
+
|
|
12
|
+
export declare class DialogSizeMixinClass {
|
|
13
|
+
/**
|
|
14
|
+
* Set the width of the dialog.
|
|
15
|
+
* If a unitless number is provided, pixels are assumed.
|
|
16
|
+
*/
|
|
17
|
+
width: string | null;
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Set the height of the dialog.
|
|
21
|
+
* If a unitless number is provided, pixels are assumed.
|
|
22
|
+
*/
|
|
23
|
+
height: string | null;
|
|
24
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright (c) 2017 - 2025 Vaadin Ltd.
|
|
4
|
+
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* @polymerMixin
|
|
9
|
+
*/
|
|
10
|
+
export const DialogSizeMixin = (superClass) =>
|
|
11
|
+
class DialogSizeMixinClass extends superClass {
|
|
12
|
+
static get properties() {
|
|
13
|
+
return {
|
|
14
|
+
/**
|
|
15
|
+
* Set the width of the dialog.
|
|
16
|
+
* If a unitless number is provided, pixels are assumed.
|
|
17
|
+
*/
|
|
18
|
+
width: {
|
|
19
|
+
type: String,
|
|
20
|
+
},
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Set the height of the dialog.
|
|
24
|
+
* If a unitless number is provided, pixels are assumed.
|
|
25
|
+
*/
|
|
26
|
+
height: {
|
|
27
|
+
type: String,
|
|
28
|
+
},
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
static get observers() {
|
|
33
|
+
return ['__sizeChanged(width, height)'];
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/** @private */
|
|
37
|
+
__sizeChanged(width, height) {
|
|
38
|
+
requestAnimationFrame(() => this.$.overlay.setBounds({ width, height }, false));
|
|
39
|
+
}
|
|
40
|
+
};
|
package/src/vaadin-dialog.d.ts
CHANGED
|
@@ -4,14 +4,14 @@
|
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
6
|
import { ElementMixin } from '@vaadin/component-base/src/element-mixin.js';
|
|
7
|
-
import { OverlayClassMixin } from '@vaadin/component-base/src/overlay-class-mixin.js';
|
|
8
7
|
import { ThemePropertyMixin } from '@vaadin/vaadin-themable-mixin/vaadin-theme-property-mixin.js';
|
|
9
8
|
import { DialogBaseMixin } from './vaadin-dialog-base-mixin.js';
|
|
10
9
|
import { DialogDraggableMixin } from './vaadin-dialog-draggable-mixin.js';
|
|
11
10
|
import { DialogRendererMixin } from './vaadin-dialog-renderer-mixin.js';
|
|
12
11
|
import { DialogResizableMixin } from './vaadin-dialog-resizable-mixin.js';
|
|
12
|
+
import { DialogSizeMixin } from './vaadin-dialog-size-mixin.js';
|
|
13
13
|
|
|
14
|
-
export { DialogOverlay, DialogOverlayBounds
|
|
14
|
+
export { DialogOverlay, DialogOverlayBounds } from './vaadin-dialog-overlay.js';
|
|
15
15
|
|
|
16
16
|
export type DialogRenderer = (root: HTMLElement, dialog: Dialog) => void;
|
|
17
17
|
|
|
@@ -20,8 +20,6 @@ export type DialogResizableDirection = 'e' | 'n' | 'ne' | 'nw' | 's' | 'se' | 's
|
|
|
20
20
|
export type DialogResizeDimensions = {
|
|
21
21
|
width: string;
|
|
22
22
|
height: string;
|
|
23
|
-
contentWidth: string;
|
|
24
|
-
contentHeight: string;
|
|
25
23
|
top: string;
|
|
26
24
|
left: string;
|
|
27
25
|
};
|
|
@@ -92,16 +90,13 @@ export type DialogEventMap = DialogCustomEventMap & HTMLElementEventMap;
|
|
|
92
90
|
*
|
|
93
91
|
* ### Styling
|
|
94
92
|
*
|
|
95
|
-
*
|
|
96
|
-
* themable component as the actual visible dialog overlay.
|
|
97
|
-
*
|
|
98
|
-
* See [`<vaadin-overlay>`](#/elements/vaadin-overlay) documentation.
|
|
99
|
-
* for `<vaadin-dialog-overlay>` parts.
|
|
100
|
-
*
|
|
101
|
-
* In addition to `<vaadin-overlay>` parts, the following parts are available for styling:
|
|
93
|
+
* The following shadow DOM parts are available for styling:
|
|
102
94
|
*
|
|
103
95
|
* Part name | Description
|
|
104
96
|
* -----------------|-------------------------------------------
|
|
97
|
+
* `backdrop` | Backdrop of the overlay
|
|
98
|
+
* `overlay` | The overlay container
|
|
99
|
+
* `content` | The overlay content
|
|
105
100
|
* `header` | Element wrapping title and header content
|
|
106
101
|
* `header-content` | Element wrapping the header content slot
|
|
107
102
|
* `title` | Element wrapping the title slot
|
|
@@ -116,9 +111,6 @@ export type DialogEventMap = DialogCustomEventMap & HTMLElementEventMap;
|
|
|
116
111
|
* `has-footer` | Set when the element has footer renderer
|
|
117
112
|
* `overflow` | Set to `top`, `bottom`, none or both
|
|
118
113
|
*
|
|
119
|
-
* Note: the `theme` attribute value set on `<vaadin-dialog>` is
|
|
120
|
-
* propagated to the internal `<vaadin-dialog-overlay>` component.
|
|
121
|
-
*
|
|
122
114
|
* See [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.
|
|
123
115
|
*
|
|
124
116
|
* @fires {CustomEvent} resize - Fired when the dialog resize is finished.
|
|
@@ -126,18 +118,11 @@ export type DialogEventMap = DialogCustomEventMap & HTMLElementEventMap;
|
|
|
126
118
|
* @fires {CustomEvent} opened-changed - Fired when the `opened` property changes.
|
|
127
119
|
* @fires {CustomEvent} closed - Fired when the dialog is closed.
|
|
128
120
|
*/
|
|
129
|
-
declare class Dialog extends
|
|
130
|
-
|
|
131
|
-
DialogRendererMixin(DialogBaseMixin(
|
|
121
|
+
declare class Dialog extends DialogSizeMixin(
|
|
122
|
+
DialogDraggableMixin(
|
|
123
|
+
DialogResizableMixin(DialogRendererMixin(DialogBaseMixin(ThemePropertyMixin(ElementMixin(HTMLElement))))),
|
|
132
124
|
),
|
|
133
125
|
) {
|
|
134
|
-
/**
|
|
135
|
-
* Set the `aria-label` attribute for assistive technologies like
|
|
136
|
-
* screen readers. An empty string value for this property (the
|
|
137
|
-
* default) means that the `aria-label` attribute is not present.
|
|
138
|
-
*/
|
|
139
|
-
ariaLabel: string;
|
|
140
|
-
|
|
141
126
|
addEventListener<K extends keyof DialogEventMap>(
|
|
142
127
|
type: K,
|
|
143
128
|
listener: (this: Dialog, ev: DialogEventMap[K]) => void,
|
package/src/vaadin-dialog.js
CHANGED
|
@@ -8,13 +8,13 @@ import { css, html, LitElement } from 'lit';
|
|
|
8
8
|
import { ifDefined } from 'lit/directives/if-defined.js';
|
|
9
9
|
import { defineCustomElement } from '@vaadin/component-base/src/define.js';
|
|
10
10
|
import { ElementMixin } from '@vaadin/component-base/src/element-mixin.js';
|
|
11
|
-
import { OverlayClassMixin } from '@vaadin/component-base/src/overlay-class-mixin.js';
|
|
12
11
|
import { PolylitMixin } from '@vaadin/component-base/src/polylit-mixin.js';
|
|
13
12
|
import { ThemePropertyMixin } from '@vaadin/vaadin-themable-mixin/vaadin-theme-property-mixin.js';
|
|
14
13
|
import { DialogBaseMixin } from './vaadin-dialog-base-mixin.js';
|
|
15
14
|
import { DialogDraggableMixin } from './vaadin-dialog-draggable-mixin.js';
|
|
16
15
|
import { DialogRendererMixin } from './vaadin-dialog-renderer-mixin.js';
|
|
17
16
|
import { DialogResizableMixin } from './vaadin-dialog-resizable-mixin.js';
|
|
17
|
+
import { DialogSizeMixin } from './vaadin-dialog-size-mixin.js';
|
|
18
18
|
|
|
19
19
|
export { DialogOverlay } from './vaadin-dialog-overlay.js';
|
|
20
20
|
|
|
@@ -47,16 +47,13 @@ export { DialogOverlay } from './vaadin-dialog-overlay.js';
|
|
|
47
47
|
*
|
|
48
48
|
* ### Styling
|
|
49
49
|
*
|
|
50
|
-
*
|
|
51
|
-
* themable component as the actual visible dialog overlay.
|
|
52
|
-
*
|
|
53
|
-
* See [`<vaadin-overlay>`](#/elements/vaadin-overlay) documentation.
|
|
54
|
-
* for `<vaadin-dialog-overlay>` parts.
|
|
55
|
-
*
|
|
56
|
-
* In addition to `<vaadin-overlay>` parts, the following parts are available for styling:
|
|
50
|
+
* The following shadow DOM parts are available for styling:
|
|
57
51
|
*
|
|
58
52
|
* Part name | Description
|
|
59
53
|
* -----------------|-------------------------------------------
|
|
54
|
+
* `backdrop` | Backdrop of the overlay
|
|
55
|
+
* `overlay` | The overlay container
|
|
56
|
+
* `content` | The overlay content
|
|
60
57
|
* `header` | Element wrapping title and header content
|
|
61
58
|
* `header-content` | Element wrapping the header content slot
|
|
62
59
|
* `title` | Element wrapping the title slot
|
|
@@ -71,9 +68,6 @@ export { DialogOverlay } from './vaadin-dialog-overlay.js';
|
|
|
71
68
|
* `has-footer` | Set when the element has footer renderer
|
|
72
69
|
* `overflow` | Set to `top`, `bottom`, none or both
|
|
73
70
|
*
|
|
74
|
-
* Note: the `theme` attribute value set on `<vaadin-dialog>` is
|
|
75
|
-
* propagated to the internal `<vaadin-dialog-overlay>` component.
|
|
76
|
-
*
|
|
77
71
|
* See [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.
|
|
78
72
|
*
|
|
79
73
|
* @fires {CustomEvent} resize - Fired when the dialog resize is finished.
|
|
@@ -89,11 +83,13 @@ export { DialogOverlay } from './vaadin-dialog-overlay.js';
|
|
|
89
83
|
* @mixes DialogDraggableMixin
|
|
90
84
|
* @mixes DialogRendererMixin
|
|
91
85
|
* @mixes DialogResizableMixin
|
|
92
|
-
* @mixes
|
|
86
|
+
* @mixes DialogSizeMixin
|
|
93
87
|
*/
|
|
94
|
-
class Dialog extends
|
|
95
|
-
|
|
96
|
-
|
|
88
|
+
class Dialog extends DialogSizeMixin(
|
|
89
|
+
DialogDraggableMixin(
|
|
90
|
+
DialogResizableMixin(
|
|
91
|
+
DialogRendererMixin(DialogBaseMixin(ThemePropertyMixin(ElementMixin(PolylitMixin(LitElement))))),
|
|
92
|
+
),
|
|
97
93
|
),
|
|
98
94
|
) {
|
|
99
95
|
static get is() {
|
|
@@ -102,24 +98,23 @@ class Dialog extends DialogDraggableMixin(
|
|
|
102
98
|
|
|
103
99
|
static get styles() {
|
|
104
100
|
return css`
|
|
105
|
-
:host
|
|
101
|
+
:host([opened]),
|
|
102
|
+
:host([opening]),
|
|
103
|
+
:host([closing]) {
|
|
104
|
+
display: block !important;
|
|
105
|
+
position: absolute;
|
|
106
|
+
outline: none;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
:host,
|
|
110
|
+
:host([hidden]) {
|
|
106
111
|
display: none !important;
|
|
107
112
|
}
|
|
108
|
-
`;
|
|
109
|
-
}
|
|
110
113
|
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
* screen readers. An empty string value for this property (the
|
|
116
|
-
* default) means that the `aria-label` attribute is not present.
|
|
117
|
-
*/
|
|
118
|
-
ariaLabel: {
|
|
119
|
-
type: String,
|
|
120
|
-
value: '',
|
|
121
|
-
},
|
|
122
|
-
};
|
|
114
|
+
:host(:focus-visible) ::part(overlay) {
|
|
115
|
+
outline: var(--vaadin-focus-ring-width) solid var(--vaadin-focus-ring-color);
|
|
116
|
+
}
|
|
117
|
+
`;
|
|
123
118
|
}
|
|
124
119
|
|
|
125
120
|
/** @protected */
|
|
@@ -127,7 +122,6 @@ class Dialog extends DialogDraggableMixin(
|
|
|
127
122
|
return html`
|
|
128
123
|
<vaadin-dialog-overlay
|
|
129
124
|
id="overlay"
|
|
130
|
-
role="${this.overlayRole}"
|
|
131
125
|
.owner="${this}"
|
|
132
126
|
.opened="${this.opened}"
|
|
133
127
|
.headerTitle="${this.headerTitle}"
|
|
@@ -138,15 +132,29 @@ class Dialog extends DialogDraggableMixin(
|
|
|
138
132
|
@mousedown="${this._bringOverlayToFront}"
|
|
139
133
|
@touchstart="${this._bringOverlayToFront}"
|
|
140
134
|
theme="${ifDefined(this._theme)}"
|
|
141
|
-
aria-label="${ifDefined(this.ariaLabel || this.headerTitle)}"
|
|
142
135
|
.modeless="${this.modeless}"
|
|
143
136
|
.withBackdrop="${!this.modeless}"
|
|
144
137
|
?resizable="${this.resizable}"
|
|
145
138
|
restore-focus-on-close
|
|
146
139
|
focus-trap
|
|
147
|
-
|
|
140
|
+
exportparts="backdrop, overlay, header, title, header-content, content, footer"
|
|
141
|
+
>
|
|
142
|
+
<slot name="title" slot="title"></slot>
|
|
143
|
+
<slot name="header-content" slot="header-content"></slot>
|
|
144
|
+
<slot name="footer" slot="footer"></slot>
|
|
145
|
+
<slot></slot>
|
|
146
|
+
</vaadin-dialog-overlay>
|
|
148
147
|
`;
|
|
149
148
|
}
|
|
149
|
+
|
|
150
|
+
/** @protected */
|
|
151
|
+
updated(props) {
|
|
152
|
+
super.updated(props);
|
|
153
|
+
|
|
154
|
+
if (props.has('headerTitle')) {
|
|
155
|
+
this.ariaLabel = this.headerTitle;
|
|
156
|
+
}
|
|
157
|
+
}
|
|
150
158
|
}
|
|
151
159
|
|
|
152
160
|
defineCustomElement(Dialog);
|
package/vaadin-dialog.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import './
|
|
1
|
+
import './src/vaadin-dialog.js';
|
|
2
2
|
export * from './src/vaadin-dialog.js';
|
package/web-types.json
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/web-types",
|
|
3
3
|
"name": "@vaadin/dialog",
|
|
4
|
-
"version": "25.0.0-
|
|
4
|
+
"version": "25.0.0-alpha21",
|
|
5
5
|
"description-markup": "markdown",
|
|
6
6
|
"contributions": {
|
|
7
7
|
"html": {
|
|
8
8
|
"elements": [
|
|
9
9
|
{
|
|
10
10
|
"name": "vaadin-dialog",
|
|
11
|
-
"description": "`<vaadin-dialog>` is a Web Component for creating customized modal dialogs.\n\n### Rendering\n\nThe content of the dialog can be populated by using the renderer callback function.\n\nThe renderer function provides `root`, `dialog` arguments.\nGenerate DOM content, append it to the `root` element and control the state\nof the host element by accessing `dialog`. Before generating new content,\nusers are able to check if there is already content in `root` for reusing it.\n\n```html\n<vaadin-dialog id=\"dialog\"></vaadin-dialog>\n```\n```js\nconst dialog = document.querySelector('#dialog');\ndialog.renderer = function(root, dialog) {\n root.textContent = \"Sample dialog\";\n};\n```\n\nRenderer is called on the opening of the dialog.\nDOM generated during the renderer call can be reused\nin the next renderer call and will be provided with the `root` argument.\nOn first call it will be empty.\n\n### Styling\n\
|
|
11
|
+
"description": "`<vaadin-dialog>` is a Web Component for creating customized modal dialogs.\n\n### Rendering\n\nThe content of the dialog can be populated by using the renderer callback function.\n\nThe renderer function provides `root`, `dialog` arguments.\nGenerate DOM content, append it to the `root` element and control the state\nof the host element by accessing `dialog`. Before generating new content,\nusers are able to check if there is already content in `root` for reusing it.\n\n```html\n<vaadin-dialog id=\"dialog\"></vaadin-dialog>\n```\n```js\nconst dialog = document.querySelector('#dialog');\ndialog.renderer = function(root, dialog) {\n root.textContent = \"Sample dialog\";\n};\n```\n\nRenderer is called on the opening of the dialog.\nDOM generated during the renderer call can be reused\nin the next renderer call and will be provided with the `root` argument.\nOn first call it will be empty.\n\n### Styling\n\nThe following shadow DOM parts are available for styling:\n\nPart name | Description\n-----------------|-------------------------------------------\n`backdrop` | Backdrop of the overlay\n`overlay` | The overlay container\n`content` | The overlay content\n`header` | Element wrapping title and header content\n`header-content` | Element wrapping the header content slot\n`title` | Element wrapping the title slot\n`footer` | Element wrapping the footer slot\n\nThe following state attributes are available for styling:\n\nAttribute | Description\n-----------------|--------------------------------------------\n`has-title` | Set when the element has a title\n`has-header` | Set when the element has header renderer\n`has-footer` | Set when the element has footer renderer\n`overflow` | Set to `top`, `bottom`, none or both\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.",
|
|
12
12
|
"attributes": [
|
|
13
13
|
{
|
|
14
14
|
"name": "opened",
|
|
15
|
-
"description": "True if the
|
|
15
|
+
"description": "True if the dialog is visible and available for interaction.",
|
|
16
16
|
"value": {
|
|
17
17
|
"type": [
|
|
18
18
|
"boolean"
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
},
|
|
49
49
|
{
|
|
50
50
|
"name": "top",
|
|
51
|
-
"description": "Set the distance of the
|
|
51
|
+
"description": "Set the distance of the dialog from the top of the viewport.\nIf a unitless number is provided, pixels are assumed.\n\nNote that the dialog uses an internal container that has some\nadditional spacing, which can be overridden by the theme.",
|
|
52
52
|
"value": {
|
|
53
53
|
"type": [
|
|
54
54
|
"string",
|
|
@@ -59,29 +59,7 @@
|
|
|
59
59
|
},
|
|
60
60
|
{
|
|
61
61
|
"name": "left",
|
|
62
|
-
"description": "Set the distance of the
|
|
63
|
-
"value": {
|
|
64
|
-
"type": [
|
|
65
|
-
"string",
|
|
66
|
-
"null",
|
|
67
|
-
"undefined"
|
|
68
|
-
]
|
|
69
|
-
}
|
|
70
|
-
},
|
|
71
|
-
{
|
|
72
|
-
"name": "width",
|
|
73
|
-
"description": "Set the width of the overlay.\nIf a unitless number is provided, pixels are assumed.",
|
|
74
|
-
"value": {
|
|
75
|
-
"type": [
|
|
76
|
-
"string",
|
|
77
|
-
"null",
|
|
78
|
-
"undefined"
|
|
79
|
-
]
|
|
80
|
-
}
|
|
81
|
-
},
|
|
82
|
-
{
|
|
83
|
-
"name": "height",
|
|
84
|
-
"description": "Set the height of the overlay.\nIf a unitless number is provided, pixels are assumed.",
|
|
62
|
+
"description": "Set the distance of the dialog from the left of the viewport.\nIf a unitless number is provided, pixels are assumed.\n\nNote that the dialog uses an internal container that has some\nadditional spacing, which can be overridden by the theme.",
|
|
85
63
|
"value": {
|
|
86
64
|
"type": [
|
|
87
65
|
"string",
|
|
@@ -92,7 +70,7 @@
|
|
|
92
70
|
},
|
|
93
71
|
{
|
|
94
72
|
"name": "overlay-role",
|
|
95
|
-
"description": "The `role` attribute value to be set on the
|
|
73
|
+
"description": "The `role` attribute value to be set on the dialog. Defaults to \"dialog\".",
|
|
96
74
|
"value": {
|
|
97
75
|
"type": [
|
|
98
76
|
"string",
|
|
@@ -112,7 +90,7 @@
|
|
|
112
90
|
},
|
|
113
91
|
{
|
|
114
92
|
"name": "header-title",
|
|
115
|
-
"description": "String used for rendering a dialog title.\n\nIf both `headerTitle` and `headerRenderer` are defined, the title\nand the elements created by the renderer will be placed next to\neach other, with the title coming first.\n\nWhen `headerTitle` is set, the attribute `has-title` is
|
|
93
|
+
"description": "String used for rendering a dialog title.\n\nIf both `headerTitle` and `headerRenderer` are defined, the title\nand the elements created by the renderer will be placed next to\neach other, with the title coming first.\n\nWhen `headerTitle` is set, the attribute `has-title` is set on the dialog.",
|
|
116
94
|
"value": {
|
|
117
95
|
"type": [
|
|
118
96
|
"string",
|
|
@@ -131,8 +109,8 @@
|
|
|
131
109
|
}
|
|
132
110
|
},
|
|
133
111
|
{
|
|
134
|
-
"name": "
|
|
135
|
-
"description": "
|
|
112
|
+
"name": "width",
|
|
113
|
+
"description": "Set the width of the dialog.\nIf a unitless number is provided, pixels are assumed.",
|
|
136
114
|
"value": {
|
|
137
115
|
"type": [
|
|
138
116
|
"string",
|
|
@@ -142,8 +120,8 @@
|
|
|
142
120
|
}
|
|
143
121
|
},
|
|
144
122
|
{
|
|
145
|
-
"name": "
|
|
146
|
-
"description": "Set the
|
|
123
|
+
"name": "height",
|
|
124
|
+
"description": "Set the height of the dialog.\nIf a unitless number is provided, pixels are assumed.",
|
|
147
125
|
"value": {
|
|
148
126
|
"type": [
|
|
149
127
|
"string",
|
|
@@ -168,7 +146,7 @@
|
|
|
168
146
|
"properties": [
|
|
169
147
|
{
|
|
170
148
|
"name": "opened",
|
|
171
|
-
"description": "True if the
|
|
149
|
+
"description": "True if the dialog is visible and available for interaction.",
|
|
172
150
|
"value": {
|
|
173
151
|
"type": [
|
|
174
152
|
"boolean"
|
|
@@ -204,7 +182,7 @@
|
|
|
204
182
|
},
|
|
205
183
|
{
|
|
206
184
|
"name": "top",
|
|
207
|
-
"description": "Set the distance of the
|
|
185
|
+
"description": "Set the distance of the dialog from the top of the viewport.\nIf a unitless number is provided, pixels are assumed.\n\nNote that the dialog uses an internal container that has some\nadditional spacing, which can be overridden by the theme.",
|
|
208
186
|
"value": {
|
|
209
187
|
"type": [
|
|
210
188
|
"string",
|
|
@@ -215,29 +193,7 @@
|
|
|
215
193
|
},
|
|
216
194
|
{
|
|
217
195
|
"name": "left",
|
|
218
|
-
"description": "Set the distance of the
|
|
219
|
-
"value": {
|
|
220
|
-
"type": [
|
|
221
|
-
"string",
|
|
222
|
-
"null",
|
|
223
|
-
"undefined"
|
|
224
|
-
]
|
|
225
|
-
}
|
|
226
|
-
},
|
|
227
|
-
{
|
|
228
|
-
"name": "width",
|
|
229
|
-
"description": "Set the width of the overlay.\nIf a unitless number is provided, pixels are assumed.",
|
|
230
|
-
"value": {
|
|
231
|
-
"type": [
|
|
232
|
-
"string",
|
|
233
|
-
"null",
|
|
234
|
-
"undefined"
|
|
235
|
-
]
|
|
236
|
-
}
|
|
237
|
-
},
|
|
238
|
-
{
|
|
239
|
-
"name": "height",
|
|
240
|
-
"description": "Set the height of the overlay.\nIf a unitless number is provided, pixels are assumed.",
|
|
196
|
+
"description": "Set the distance of the dialog from the left of the viewport.\nIf a unitless number is provided, pixels are assumed.\n\nNote that the dialog uses an internal container that has some\nadditional spacing, which can be overridden by the theme.",
|
|
241
197
|
"value": {
|
|
242
198
|
"type": [
|
|
243
199
|
"string",
|
|
@@ -248,7 +204,7 @@
|
|
|
248
204
|
},
|
|
249
205
|
{
|
|
250
206
|
"name": "overlayRole",
|
|
251
|
-
"description": "The `role` attribute value to be set on the
|
|
207
|
+
"description": "The `role` attribute value to be set on the dialog. Defaults to \"dialog\".",
|
|
252
208
|
"value": {
|
|
253
209
|
"type": [
|
|
254
210
|
"string",
|
|
@@ -278,7 +234,7 @@
|
|
|
278
234
|
},
|
|
279
235
|
{
|
|
280
236
|
"name": "headerTitle",
|
|
281
|
-
"description": "String used for rendering a dialog title.\n\nIf both `headerTitle` and `headerRenderer` are defined, the title\nand the elements created by the renderer will be placed next to\neach other, with the title coming first.\n\nWhen `headerTitle` is set, the attribute `has-title` is
|
|
237
|
+
"description": "String used for rendering a dialog title.\n\nIf both `headerTitle` and `headerRenderer` are defined, the title\nand the elements created by the renderer will be placed next to\neach other, with the title coming first.\n\nWhen `headerTitle` is set, the attribute `has-title` is set on the dialog.",
|
|
282
238
|
"value": {
|
|
283
239
|
"type": [
|
|
284
240
|
"string",
|
|
@@ -289,7 +245,7 @@
|
|
|
289
245
|
},
|
|
290
246
|
{
|
|
291
247
|
"name": "headerRenderer",
|
|
292
|
-
"description": "Custom function for rendering the dialog header.\nReceives two arguments:\n\n- `root` The root container DOM element. Append your content to it.\n- `dialog` The reference to the `<vaadin-dialog>` element.\n\nIf both `headerTitle` and `headerRenderer` are defined, the title\nand the elements created by the renderer will be placed next to\neach other, with the title coming first.\n\nWhen `headerRenderer` is set, the attribute `has-header` is
|
|
248
|
+
"description": "Custom function for rendering the dialog header.\nReceives two arguments:\n\n- `root` The root container DOM element. Append your content to it.\n- `dialog` The reference to the `<vaadin-dialog>` element.\n\nIf both `headerTitle` and `headerRenderer` are defined, the title\nand the elements created by the renderer will be placed next to\neach other, with the title coming first.\n\nWhen `headerRenderer` is set, the attribute `has-header` is set on the dialog.",
|
|
293
249
|
"value": {
|
|
294
250
|
"type": [
|
|
295
251
|
"DialogRenderer",
|
|
@@ -299,7 +255,7 @@
|
|
|
299
255
|
},
|
|
300
256
|
{
|
|
301
257
|
"name": "footerRenderer",
|
|
302
|
-
"description": "Custom function for rendering the dialog footer.\nReceives two arguments:\n\n- `root` The root container DOM element. Append your content to it.\n- `dialog` The reference to the `<vaadin-dialog>` element.\n\nWhen `footerRenderer` is set, the attribute `has-footer` is
|
|
258
|
+
"description": "Custom function for rendering the dialog footer.\nReceives two arguments:\n\n- `root` The root container DOM element. Append your content to it.\n- `dialog` The reference to the `<vaadin-dialog>` element.\n\nWhen `footerRenderer` is set, the attribute `has-footer` is set on the dialog.",
|
|
303
259
|
"value": {
|
|
304
260
|
"type": [
|
|
305
261
|
"DialogRenderer",
|
|
@@ -317,8 +273,8 @@
|
|
|
317
273
|
}
|
|
318
274
|
},
|
|
319
275
|
{
|
|
320
|
-
"name": "
|
|
321
|
-
"description": "
|
|
276
|
+
"name": "width",
|
|
277
|
+
"description": "Set the width of the dialog.\nIf a unitless number is provided, pixels are assumed.",
|
|
322
278
|
"value": {
|
|
323
279
|
"type": [
|
|
324
280
|
"string",
|
|
@@ -328,8 +284,8 @@
|
|
|
328
284
|
}
|
|
329
285
|
},
|
|
330
286
|
{
|
|
331
|
-
"name": "
|
|
332
|
-
"description": "Set the
|
|
287
|
+
"name": "height",
|
|
288
|
+
"description": "Set the height of the dialog.\nIf a unitless number is provided, pixels are assumed.",
|
|
333
289
|
"value": {
|
|
334
290
|
"type": [
|
|
335
291
|
"string",
|