@vaadin/dialog 25.0.0-alpha1 → 25.0.0-alpha11
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/{vaadin-dialog-styles.js → styles/vaadin-dialog-overlay-base-styles.js} +88 -53
- package/src/vaadin-dialog-base-mixin.d.ts +2 -13
- package/src/vaadin-dialog-base-mixin.js +17 -19
- package/src/vaadin-dialog-overlay-mixin.d.ts +0 -14
- package/src/vaadin-dialog-overlay-mixin.js +41 -41
- package/src/vaadin-dialog-overlay.d.ts +1 -1
- package/src/vaadin-dialog-overlay.js +6 -4
- 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 +11 -23
- package/src/vaadin-dialog.js +37 -31
- package/vaadin-dialog.js +1 -1
- package/web-types.json +33 -55
- package/web-types.lit.json +14 -21
- 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
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vaadin/dialog",
|
|
3
|
-
"version": "25.0.0-
|
|
3
|
+
"version": "25.0.0-alpha11",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -23,7 +23,6 @@
|
|
|
23
23
|
"lit.d.ts",
|
|
24
24
|
"lit.js",
|
|
25
25
|
"src",
|
|
26
|
-
"theme",
|
|
27
26
|
"vaadin-*.d.ts",
|
|
28
27
|
"vaadin-*.js",
|
|
29
28
|
"web-types.json",
|
|
@@ -37,23 +36,23 @@
|
|
|
37
36
|
],
|
|
38
37
|
"dependencies": {
|
|
39
38
|
"@open-wc/dedupe-mixin": "^1.3.0",
|
|
40
|
-
"@vaadin/component-base": "25.0.0-
|
|
41
|
-
"@vaadin/lit-renderer": "25.0.0-
|
|
42
|
-
"@vaadin/overlay": "25.0.0-
|
|
43
|
-
"@vaadin/vaadin-
|
|
44
|
-
"@vaadin/vaadin-themable-mixin": "25.0.0-alpha1",
|
|
39
|
+
"@vaadin/component-base": "25.0.0-alpha11",
|
|
40
|
+
"@vaadin/lit-renderer": "25.0.0-alpha11",
|
|
41
|
+
"@vaadin/overlay": "25.0.0-alpha11",
|
|
42
|
+
"@vaadin/vaadin-themable-mixin": "25.0.0-alpha11",
|
|
45
43
|
"lit": "^3.0.0"
|
|
46
44
|
},
|
|
47
45
|
"devDependencies": {
|
|
48
|
-
"@vaadin/a11y-base": "25.0.0-
|
|
49
|
-
"@vaadin/chai-plugins": "25.0.0-
|
|
50
|
-
"@vaadin/test-runner-commands": "25.0.0-
|
|
51
|
-
"@vaadin/testing-helpers": "^
|
|
46
|
+
"@vaadin/a11y-base": "25.0.0-alpha11",
|
|
47
|
+
"@vaadin/chai-plugins": "25.0.0-alpha11",
|
|
48
|
+
"@vaadin/test-runner-commands": "25.0.0-alpha11",
|
|
49
|
+
"@vaadin/testing-helpers": "^2.0.0",
|
|
50
|
+
"@vaadin/vaadin-lumo-styles": "25.0.0-alpha11",
|
|
52
51
|
"sinon": "^18.0.0"
|
|
53
52
|
},
|
|
54
53
|
"web-types": [
|
|
55
54
|
"web-types.json",
|
|
56
55
|
"web-types.lit.json"
|
|
57
56
|
],
|
|
58
|
-
"gitHead": "
|
|
57
|
+
"gitHead": "abfd315ba5a7484a613e0768635a4e8fe945a44b"
|
|
59
58
|
}
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
* Copyright (c) 2017 - 2025 Vaadin Ltd.
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
|
-
/* eslint-disable max-classes-per-file */
|
|
7
6
|
import type { DirectiveResult } from 'lit/directive.js';
|
|
8
7
|
import type { LitRendererResult } from '@vaadin/lit-renderer';
|
|
9
8
|
import { LitRendererDirective } from '@vaadin/lit-renderer';
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
|
-
* Copyright (c)
|
|
3
|
+
* Copyright (c) 2017 - 2025 Vaadin Ltd.
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
6
|
import type { CSSResult } from 'lit';
|
|
7
7
|
|
|
8
|
-
export const
|
|
8
|
+
export const dialogOverlayBase: CSSResult;
|
|
9
9
|
|
|
10
|
-
export const
|
|
10
|
+
export const dialogOverlayStyles: CSSResult;
|
|
@@ -3,9 +3,45 @@
|
|
|
3
3
|
* Copyright (c) 2017 - 2025 Vaadin Ltd.
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
|
+
import '@vaadin/component-base/src/styles/style-props.js';
|
|
6
7
|
import { css } from 'lit';
|
|
8
|
+
import { overlayStyles } from '@vaadin/overlay/src/styles/vaadin-overlay-base-styles.js';
|
|
9
|
+
|
|
10
|
+
export const dialogOverlayBase = css`
|
|
11
|
+
/* Optical centering */
|
|
12
|
+
:host::before,
|
|
13
|
+
:host::after {
|
|
14
|
+
content: '';
|
|
15
|
+
flex-basis: 0;
|
|
16
|
+
flex-grow: 1;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
:host::after {
|
|
20
|
+
flex-grow: 1.1;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
:host {
|
|
24
|
+
cursor: default;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
[part='overlay']:focus-visible {
|
|
28
|
+
outline: var(--vaadin-focus-ring-width) solid var(--vaadin-focus-ring-color);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
[part='overlay'] {
|
|
32
|
+
background: var(--vaadin-dialog-background, var(--vaadin-background-color));
|
|
33
|
+
background-origin: border-box;
|
|
34
|
+
border: 0;
|
|
35
|
+
box-shadow:
|
|
36
|
+
0 0 0 var(--vaadin-dialog-border-width, 1px) var(--vaadin-dialog-border-color, rgba(0, 0, 0, 0.1)),
|
|
37
|
+
var(--vaadin-dialog-box-shadow, 0 8px 24px -4px rgba(0, 0, 0, 0.3));
|
|
38
|
+
border-radius: var(--vaadin-dialog-border-radius, var(--vaadin-radius-l));
|
|
39
|
+
width: max-content;
|
|
40
|
+
min-width: min(var(--vaadin-dialog-min-width, 4em), 100%);
|
|
41
|
+
max-width: var(--vaadin-dialog-max-width, 100%);
|
|
42
|
+
max-height: 100%;
|
|
43
|
+
}
|
|
7
44
|
|
|
8
|
-
export const dialogOverlay = css`
|
|
9
45
|
[part='header'],
|
|
10
46
|
[part='header-content'],
|
|
11
47
|
[part='footer'] {
|
|
@@ -15,6 +51,29 @@ export const dialogOverlay = css`
|
|
|
15
51
|
flex: none;
|
|
16
52
|
pointer-events: none;
|
|
17
53
|
z-index: 1;
|
|
54
|
+
gap: var(--vaadin-dialog-toolbar-gap, var(--vaadin-gap-container-inline));
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
::slotted(*) {
|
|
58
|
+
pointer-events: auto;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
[part='header'],
|
|
62
|
+
[part='content'],
|
|
63
|
+
[part='footer'] {
|
|
64
|
+
padding: var(--vaadin-dialog-padding, var(--vaadin-padding));
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
:host([theme~='no-padding']) [part='content'] {
|
|
68
|
+
padding: 0 !important;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
:host(:is([has-header], [has-title])) [part='content'] {
|
|
72
|
+
padding-top: 0;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
:host([has-footer]) [part='content'] {
|
|
76
|
+
padding-bottom: 0;
|
|
18
77
|
}
|
|
19
78
|
|
|
20
79
|
[part='header'] {
|
|
@@ -25,14 +84,21 @@ export const dialogOverlay = css`
|
|
|
25
84
|
::slotted([slot='title']),
|
|
26
85
|
::slotted([slot='footer']) {
|
|
27
86
|
display: contents;
|
|
28
|
-
pointer-events: auto;
|
|
29
87
|
}
|
|
30
88
|
|
|
31
89
|
::slotted([slot='title']) {
|
|
32
90
|
font: inherit !important;
|
|
91
|
+
color: inherit !important;
|
|
33
92
|
overflow-wrap: anywhere;
|
|
34
93
|
}
|
|
35
94
|
|
|
95
|
+
[part='title'] {
|
|
96
|
+
color: var(--vaadin-dialog-title-color, var(--vaadin-color));
|
|
97
|
+
font-weight: var(--vaadin-dialog-title-font-weight, 600);
|
|
98
|
+
font-size: var(--vaadin-dialog-title-font-size, 1em);
|
|
99
|
+
line-height: var(--vaadin-dialog-title-line-height, inherit);
|
|
100
|
+
}
|
|
101
|
+
|
|
36
102
|
[part='header-content'] {
|
|
37
103
|
flex: 1;
|
|
38
104
|
}
|
|
@@ -48,77 +114,44 @@ export const dialogOverlay = css`
|
|
|
48
114
|
:host(:not([has-footer])) [part='footer'] {
|
|
49
115
|
display: none !important;
|
|
50
116
|
}
|
|
51
|
-
|
|
52
|
-
:host(:is([has-title], [has-header], [has-footer])) [part='content'] {
|
|
53
|
-
height: auto;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
@media (min-height: 320px) {
|
|
57
|
-
:host(:is([has-title], [has-header], [has-footer])) .resizer-container {
|
|
58
|
-
overflow: hidden;
|
|
59
|
-
display: flex;
|
|
60
|
-
flex-direction: column;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
:host(:is([has-title], [has-header], [has-footer])) [part='content'] {
|
|
64
|
-
flex: 1;
|
|
65
|
-
overflow: auto;
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
/*
|
|
70
|
-
NOTE(platosha): Make some min-width to prevent collapsing of the content
|
|
71
|
-
taking the parent width, e. g., <vaadin-grid> and such.
|
|
72
|
-
*/
|
|
73
|
-
[part='content'] {
|
|
74
|
-
min-width: 12em; /* matches the default <vaadin-text-field> width */
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
:host([has-bounds-set]) [part='overlay'] {
|
|
78
|
-
max-width: none;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
@media (forced-colors: active) {
|
|
82
|
-
[part='overlay'] {
|
|
83
|
-
outline: 3px solid !important;
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
117
|
`;
|
|
87
118
|
|
|
88
|
-
|
|
119
|
+
const dialogResizableOverlay = css`
|
|
89
120
|
[part='overlay'] {
|
|
90
121
|
position: relative;
|
|
91
122
|
overflow: visible;
|
|
92
|
-
max-height: 100%;
|
|
93
123
|
display: flex;
|
|
94
124
|
}
|
|
95
125
|
|
|
126
|
+
:host([has-bounds-set]) [part='overlay'] {
|
|
127
|
+
min-width: 0;
|
|
128
|
+
max-width: none;
|
|
129
|
+
max-height: none;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
/* Content part scrolls by default */
|
|
96
133
|
[part='content'] {
|
|
97
|
-
|
|
98
|
-
height:
|
|
134
|
+
flex: 1;
|
|
135
|
+
min-height: 0;
|
|
99
136
|
}
|
|
100
137
|
|
|
101
|
-
|
|
138
|
+
:host([overflow]) [part='content'] {
|
|
102
139
|
overflow: auto;
|
|
103
|
-
|
|
104
|
-
border-radius: inherit; /* prevent child elements being drawn outside part=overlay */
|
|
140
|
+
overscroll-behavior: contain;
|
|
105
141
|
}
|
|
106
142
|
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
143
|
+
.resizer-container {
|
|
144
|
+
display: flex;
|
|
145
|
+
flex-direction: column;
|
|
146
|
+
flex-grow: 1;
|
|
147
|
+
border-radius: inherit;
|
|
148
|
+
max-width: 100%;
|
|
110
149
|
}
|
|
111
150
|
|
|
112
151
|
:host(:not([resizable])) .resizer {
|
|
113
152
|
display: none;
|
|
114
153
|
}
|
|
115
154
|
|
|
116
|
-
:host([resizable]) [part='title'] {
|
|
117
|
-
cursor: move;
|
|
118
|
-
-webkit-user-select: none;
|
|
119
|
-
user-select: none;
|
|
120
|
-
}
|
|
121
|
-
|
|
122
155
|
.resizer {
|
|
123
156
|
position: absolute;
|
|
124
157
|
height: 16px;
|
|
@@ -179,3 +212,5 @@ export const resizableOverlay = css`
|
|
|
179
212
|
cursor: nwse-resize;
|
|
180
213
|
}
|
|
181
214
|
`;
|
|
215
|
+
|
|
216
|
+
export const dialogOverlayStyles = [overlayStyles, dialogOverlayBase, dialogResizableOverlay];
|
|
@@ -33,9 +33,10 @@ export declare class DialogBaseMixinClass {
|
|
|
33
33
|
modeless: boolean;
|
|
34
34
|
|
|
35
35
|
/**
|
|
36
|
-
* The `role` attribute value to be set on the
|
|
36
|
+
* The `role` attribute value to be set on the dialog. Defaults to "dialog".
|
|
37
37
|
*
|
|
38
38
|
* @attr {string} overlay-role
|
|
39
|
+
* @deprecated Use standard `role` attribute on the dialog instead
|
|
39
40
|
*/
|
|
40
41
|
overlayRole: string;
|
|
41
42
|
|
|
@@ -58,16 +59,4 @@ export declare class DialogBaseMixinClass {
|
|
|
58
59
|
* overlay from stretching all the way to the left of the viewport).
|
|
59
60
|
*/
|
|
60
61
|
left: string;
|
|
61
|
-
|
|
62
|
-
/**
|
|
63
|
-
* Set the width of the overlay.
|
|
64
|
-
* If a unitless number is provided, pixels are assumed.
|
|
65
|
-
*/
|
|
66
|
-
width: string;
|
|
67
|
-
|
|
68
|
-
/**
|
|
69
|
-
* Set the height of the overlay.
|
|
70
|
-
* If a unitless number is provided, pixels are assumed.
|
|
71
|
-
*/
|
|
72
|
-
height: string;
|
|
73
62
|
}
|
|
@@ -17,6 +17,7 @@ export const DialogBaseMixin = (superClass) =>
|
|
|
17
17
|
*/
|
|
18
18
|
opened: {
|
|
19
19
|
type: Boolean,
|
|
20
|
+
reflectToAttribute: true,
|
|
20
21
|
value: false,
|
|
21
22
|
notify: true,
|
|
22
23
|
sync: true,
|
|
@@ -76,35 +77,19 @@ export const DialogBaseMixin = (superClass) =>
|
|
|
76
77
|
},
|
|
77
78
|
|
|
78
79
|
/**
|
|
79
|
-
*
|
|
80
|
-
* If a unitless number is provided, pixels are assumed.
|
|
81
|
-
*/
|
|
82
|
-
width: {
|
|
83
|
-
type: String,
|
|
84
|
-
},
|
|
85
|
-
|
|
86
|
-
/**
|
|
87
|
-
* Set the height of the overlay.
|
|
88
|
-
* If a unitless number is provided, pixels are assumed.
|
|
89
|
-
*/
|
|
90
|
-
height: {
|
|
91
|
-
type: String,
|
|
92
|
-
},
|
|
93
|
-
|
|
94
|
-
/**
|
|
95
|
-
* The `role` attribute value to be set on the overlay. Defaults to "dialog".
|
|
80
|
+
* The `role` attribute value to be set on the dialog. Defaults to "dialog".
|
|
96
81
|
*
|
|
97
82
|
* @attr {string} overlay-role
|
|
83
|
+
* @deprecated Use standard `role` attribute on the dialog instead
|
|
98
84
|
*/
|
|
99
85
|
overlayRole: {
|
|
100
86
|
type: String,
|
|
101
|
-
value: 'dialog',
|
|
102
87
|
},
|
|
103
88
|
};
|
|
104
89
|
}
|
|
105
90
|
|
|
106
91
|
static get observers() {
|
|
107
|
-
return ['__positionChanged(top, left)'
|
|
92
|
+
return ['__positionChanged(top, left)'];
|
|
108
93
|
}
|
|
109
94
|
|
|
110
95
|
/** @protected */
|
|
@@ -118,6 +103,19 @@ export const DialogBaseMixin = (superClass) =>
|
|
|
118
103
|
overlay.addEventListener('vaadin-overlay-closed', this.__handleOverlayClosed.bind(this));
|
|
119
104
|
|
|
120
105
|
this._overlayElement = overlay;
|
|
106
|
+
|
|
107
|
+
if (!this.hasAttribute('role')) {
|
|
108
|
+
this.role = 'dialog';
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/** @protected */
|
|
113
|
+
updated(props) {
|
|
114
|
+
super.updated(props);
|
|
115
|
+
|
|
116
|
+
if (props.has('overlayRole')) {
|
|
117
|
+
this.role = this.overlayRole || 'dialog';
|
|
118
|
+
}
|
|
121
119
|
}
|
|
122
120
|
|
|
123
121
|
/** @private */
|
|
@@ -14,15 +14,6 @@ export type DialogOverlayBounds = {
|
|
|
14
14
|
height: number;
|
|
15
15
|
};
|
|
16
16
|
|
|
17
|
-
export type DialogOverlayBoundsParam =
|
|
18
|
-
| DialogOverlayBounds
|
|
19
|
-
| {
|
|
20
|
-
top?: number | string;
|
|
21
|
-
left?: number | string;
|
|
22
|
-
width?: number | string;
|
|
23
|
-
height?: number | string;
|
|
24
|
-
};
|
|
25
|
-
|
|
26
17
|
export declare function DialogOverlayMixin<T extends Constructor<HTMLElement>>(
|
|
27
18
|
base: T,
|
|
28
19
|
): Constructor<DialogOverlayMixinClass> & Constructor<OverlayMixinClass> & T;
|
|
@@ -48,9 +39,4 @@ export declare class DialogOverlayMixinClass {
|
|
|
48
39
|
* Retrieves the coordinates of the overlay.
|
|
49
40
|
*/
|
|
50
41
|
getBounds(): DialogOverlayBounds;
|
|
51
|
-
|
|
52
|
-
/**
|
|
53
|
-
* Updates the coordinates of the overlay.
|
|
54
|
-
*/
|
|
55
|
-
setBounds(bounds: DialogOverlayBoundsParam, absolute: boolean): void;
|
|
56
42
|
}
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
6
|
import { OverlayMixin } from '@vaadin/overlay/src/vaadin-overlay-mixin.js';
|
|
7
|
+
import { setOverlayStateAttribute } from '@vaadin/overlay/src/vaadin-overlay-utils.js';
|
|
7
8
|
|
|
8
9
|
/**
|
|
9
10
|
* @polymerMixin
|
|
@@ -43,13 +44,33 @@ export const DialogOverlayMixin = (superClass) =>
|
|
|
43
44
|
];
|
|
44
45
|
}
|
|
45
46
|
|
|
47
|
+
/**
|
|
48
|
+
* Override method from OverlayFocusMixin to use owner as content root
|
|
49
|
+
* @protected
|
|
50
|
+
* @override
|
|
51
|
+
*/
|
|
52
|
+
get _contentRoot() {
|
|
53
|
+
return this.owner;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Override method from OverlayFocusMixin to use owner as modal root
|
|
58
|
+
* @protected
|
|
59
|
+
* @override
|
|
60
|
+
*/
|
|
61
|
+
get _modalRoot() {
|
|
62
|
+
return this.owner;
|
|
63
|
+
}
|
|
64
|
+
|
|
46
65
|
/** @protected */
|
|
47
66
|
ready() {
|
|
48
67
|
super.ready();
|
|
49
68
|
|
|
50
69
|
// Update overflow attribute on resize
|
|
51
70
|
this.__resizeObserver = new ResizeObserver(() => {
|
|
52
|
-
|
|
71
|
+
requestAnimationFrame(() => {
|
|
72
|
+
this.__updateOverflow();
|
|
73
|
+
});
|
|
53
74
|
});
|
|
54
75
|
this.__resizeObserver.observe(this.$.resizerContainer);
|
|
55
76
|
|
|
@@ -57,6 +78,11 @@ export const DialogOverlayMixin = (superClass) =>
|
|
|
57
78
|
this.$.content.addEventListener('scroll', () => {
|
|
58
79
|
this.__updateOverflow();
|
|
59
80
|
});
|
|
81
|
+
|
|
82
|
+
// Update overflow attribute on content change
|
|
83
|
+
this.shadowRoot.addEventListener('slotchange', () => {
|
|
84
|
+
this.__updateOverflow();
|
|
85
|
+
});
|
|
60
86
|
}
|
|
61
87
|
|
|
62
88
|
/** @private */
|
|
@@ -99,8 +125,8 @@ export const DialogOverlayMixin = (superClass) =>
|
|
|
99
125
|
this._oldOpenedFooterHeader = opened;
|
|
100
126
|
|
|
101
127
|
// Set attributes here to update styles before detecting content overflow
|
|
102
|
-
this
|
|
103
|
-
this
|
|
128
|
+
setOverlayStateAttribute(this, 'has-header', !!headerRenderer);
|
|
129
|
+
setOverlayStateAttribute(this, 'has-footer', !!footerRenderer);
|
|
104
130
|
|
|
105
131
|
if (headerRendererChanged) {
|
|
106
132
|
if (headerRenderer) {
|
|
@@ -134,7 +160,7 @@ export const DialogOverlayMixin = (superClass) =>
|
|
|
134
160
|
|
|
135
161
|
/** @private */
|
|
136
162
|
_headerTitleChanged(headerTitle, opened) {
|
|
137
|
-
this
|
|
163
|
+
setOverlayStateAttribute(this, 'has-title', !!headerTitle);
|
|
138
164
|
|
|
139
165
|
if (opened && (headerTitle || this._oldHeaderTitle)) {
|
|
140
166
|
this.requestContentUpdate();
|
|
@@ -150,7 +176,7 @@ export const DialogOverlayMixin = (superClass) =>
|
|
|
150
176
|
this.headerTitleElement.setAttribute('slot', 'title');
|
|
151
177
|
this.headerTitleElement.classList.add('draggable');
|
|
152
178
|
}
|
|
153
|
-
this.appendChild(this.headerTitleElement);
|
|
179
|
+
this.owner.appendChild(this.headerTitleElement);
|
|
154
180
|
this.headerTitleElement.textContent = this.headerTitle;
|
|
155
181
|
} else if (this.headerTitleElement) {
|
|
156
182
|
this.headerTitleElement.remove();
|
|
@@ -167,7 +193,7 @@ export const DialogOverlayMixin = (superClass) =>
|
|
|
167
193
|
if (this.headerContainer) {
|
|
168
194
|
// If a new renderer has been set, make sure to reattach the container
|
|
169
195
|
if (!this.headerContainer.parentElement) {
|
|
170
|
-
this.appendChild(this.headerContainer);
|
|
196
|
+
this.owner.appendChild(this.headerContainer);
|
|
171
197
|
}
|
|
172
198
|
|
|
173
199
|
if (this.headerRenderer) {
|
|
@@ -179,7 +205,7 @@ export const DialogOverlayMixin = (superClass) =>
|
|
|
179
205
|
if (this.footerContainer) {
|
|
180
206
|
// If a new renderer has been set, make sure to reattach the container
|
|
181
207
|
if (!this.footerContainer.parentElement) {
|
|
182
|
-
this.appendChild(this.footerContainer);
|
|
208
|
+
this.owner.appendChild(this.footerContainer);
|
|
183
209
|
}
|
|
184
210
|
|
|
185
211
|
if (this.footerRenderer) {
|
|
@@ -193,28 +219,6 @@ export const DialogOverlayMixin = (superClass) =>
|
|
|
193
219
|
this.__updateOverflow();
|
|
194
220
|
}
|
|
195
221
|
|
|
196
|
-
/**
|
|
197
|
-
* Updates the coordinates of the overlay.
|
|
198
|
-
* @param {!DialogOverlayBoundsParam} bounds
|
|
199
|
-
* @param {boolean} absolute
|
|
200
|
-
*/
|
|
201
|
-
setBounds(bounds, absolute = true) {
|
|
202
|
-
const overlay = this.$.overlay;
|
|
203
|
-
const parsedBounds = { ...bounds };
|
|
204
|
-
|
|
205
|
-
if (absolute && overlay.style.position !== 'absolute') {
|
|
206
|
-
overlay.style.position = 'absolute';
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
Object.keys(parsedBounds).forEach((arg) => {
|
|
210
|
-
if (!isNaN(parsedBounds[arg])) {
|
|
211
|
-
parsedBounds[arg] = `${parsedBounds[arg]}px`;
|
|
212
|
-
}
|
|
213
|
-
});
|
|
214
|
-
|
|
215
|
-
Object.assign(overlay.style, parsedBounds);
|
|
216
|
-
}
|
|
217
|
-
|
|
218
222
|
/**
|
|
219
223
|
* Retrieves the coordinates of the overlay.
|
|
220
224
|
* @return {!DialogOverlayBounds}
|
|
@@ -233,25 +237,21 @@ export const DialogOverlayMixin = (superClass) =>
|
|
|
233
237
|
__updateOverflow() {
|
|
234
238
|
let overflow = '';
|
|
235
239
|
|
|
236
|
-
|
|
237
|
-
// Check for state attributes as extending components might not use renderers.
|
|
238
|
-
if (this.hasAttribute('has-header') || this.hasAttribute('has-footer') || this.headerTitle) {
|
|
239
|
-
const content = this.$.content;
|
|
240
|
+
const content = this.$.content;
|
|
240
241
|
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
242
|
+
if (content.scrollTop > 0) {
|
|
243
|
+
overflow += ' top';
|
|
244
|
+
}
|
|
244
245
|
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
}
|
|
246
|
+
if (content.scrollTop < content.scrollHeight - content.clientHeight) {
|
|
247
|
+
overflow += ' bottom';
|
|
248
248
|
}
|
|
249
249
|
|
|
250
250
|
const value = overflow.trim();
|
|
251
251
|
if (value.length > 0 && this.getAttribute('overflow') !== value) {
|
|
252
|
-
this
|
|
252
|
+
setOverlayStateAttribute(this, 'overflow', value);
|
|
253
253
|
} else if (value.length === 0 && this.hasAttribute('overflow')) {
|
|
254
|
-
this
|
|
254
|
+
setOverlayStateAttribute(this, 'overflow', null);
|
|
255
255
|
}
|
|
256
256
|
}
|
|
257
257
|
};
|
|
@@ -7,7 +7,7 @@ import { DirMixin } from '@vaadin/component-base/src/dir-mixin.js';
|
|
|
7
7
|
import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
8
8
|
import { DialogOverlayMixin } from './vaadin-dialog-overlay-mixin.js';
|
|
9
9
|
|
|
10
|
-
export { DialogOverlayBounds
|
|
10
|
+
export { DialogOverlayBounds } from './vaadin-dialog-overlay-mixin.js';
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
13
|
* An element used internally by `<vaadin-dialog>`. Not intended to be used separately.
|
|
@@ -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,13 +22,15 @@ 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;
|
|
32
34
|
}
|
|
33
35
|
|
|
34
36
|
/** @protected */
|
|
@@ -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 overlay.
|
|
15
|
+
* If a unitless number is provided, pixels are assumed.
|
|
16
|
+
*/
|
|
17
|
+
width: string | null;
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Set the height of the overlay.
|
|
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 overlay.
|
|
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 overlay.
|
|
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
|
@@ -10,8 +10,9 @@ import { DialogBaseMixin } from './vaadin-dialog-base-mixin.js';
|
|
|
10
10
|
import { DialogDraggableMixin } from './vaadin-dialog-draggable-mixin.js';
|
|
11
11
|
import { DialogRendererMixin } from './vaadin-dialog-renderer-mixin.js';
|
|
12
12
|
import { DialogResizableMixin } from './vaadin-dialog-resizable-mixin.js';
|
|
13
|
+
import { DialogSizeMixin } from './vaadin-dialog-size-mixin.js';
|
|
13
14
|
|
|
14
|
-
export { DialogOverlay, DialogOverlayBounds
|
|
15
|
+
export { DialogOverlay, DialogOverlayBounds } from './vaadin-dialog-overlay.js';
|
|
15
16
|
|
|
16
17
|
export type DialogRenderer = (root: HTMLElement, dialog: Dialog) => void;
|
|
17
18
|
|
|
@@ -20,8 +21,6 @@ export type DialogResizableDirection = 'e' | 'n' | 'ne' | 'nw' | 's' | 'se' | 's
|
|
|
20
21
|
export type DialogResizeDimensions = {
|
|
21
22
|
width: string;
|
|
22
23
|
height: string;
|
|
23
|
-
contentWidth: string;
|
|
24
|
-
contentHeight: string;
|
|
25
24
|
top: string;
|
|
26
25
|
left: string;
|
|
27
26
|
};
|
|
@@ -92,16 +91,13 @@ export type DialogEventMap = DialogCustomEventMap & HTMLElementEventMap;
|
|
|
92
91
|
*
|
|
93
92
|
* ### Styling
|
|
94
93
|
*
|
|
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:
|
|
94
|
+
* The following shadow DOM parts are available for styling:
|
|
102
95
|
*
|
|
103
96
|
* Part name | Description
|
|
104
97
|
* -----------------|-------------------------------------------
|
|
98
|
+
* `backdrop` | Backdrop of the overlay
|
|
99
|
+
* `overlay` | The overlay container
|
|
100
|
+
* `content` | The overlay content
|
|
105
101
|
* `header` | Element wrapping title and header content
|
|
106
102
|
* `header-content` | Element wrapping the header content slot
|
|
107
103
|
* `title` | Element wrapping the title slot
|
|
@@ -116,9 +112,6 @@ export type DialogEventMap = DialogCustomEventMap & HTMLElementEventMap;
|
|
|
116
112
|
* `has-footer` | Set when the element has footer renderer
|
|
117
113
|
* `overflow` | Set to `top`, `bottom`, none or both
|
|
118
114
|
*
|
|
119
|
-
* Note: the `theme` attribute value set on `<vaadin-dialog>` is
|
|
120
|
-
* propagated to the internal `<vaadin-dialog-overlay>` component.
|
|
121
|
-
*
|
|
122
115
|
* See [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.
|
|
123
116
|
*
|
|
124
117
|
* @fires {CustomEvent} resize - Fired when the dialog resize is finished.
|
|
@@ -126,18 +119,13 @@ export type DialogEventMap = DialogCustomEventMap & HTMLElementEventMap;
|
|
|
126
119
|
* @fires {CustomEvent} opened-changed - Fired when the `opened` property changes.
|
|
127
120
|
* @fires {CustomEvent} closed - Fired when the dialog is closed.
|
|
128
121
|
*/
|
|
129
|
-
declare class Dialog extends
|
|
130
|
-
|
|
131
|
-
|
|
122
|
+
declare class Dialog extends DialogSizeMixin(
|
|
123
|
+
DialogDraggableMixin(
|
|
124
|
+
DialogResizableMixin(
|
|
125
|
+
DialogRendererMixin(DialogBaseMixin(OverlayClassMixin(ThemePropertyMixin(ElementMixin(HTMLElement))))),
|
|
126
|
+
),
|
|
132
127
|
),
|
|
133
128
|
) {
|
|
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
129
|
addEventListener<K extends keyof DialogEventMap>(
|
|
142
130
|
type: K,
|
|
143
131
|
listener: (this: Dialog, ev: DialogEventMap[K]) => void,
|
package/src/vaadin-dialog.js
CHANGED
|
@@ -15,6 +15,7 @@ import { DialogBaseMixin } from './vaadin-dialog-base-mixin.js';
|
|
|
15
15
|
import { DialogDraggableMixin } from './vaadin-dialog-draggable-mixin.js';
|
|
16
16
|
import { DialogRendererMixin } from './vaadin-dialog-renderer-mixin.js';
|
|
17
17
|
import { DialogResizableMixin } from './vaadin-dialog-resizable-mixin.js';
|
|
18
|
+
import { DialogSizeMixin } from './vaadin-dialog-size-mixin.js';
|
|
18
19
|
|
|
19
20
|
export { DialogOverlay } from './vaadin-dialog-overlay.js';
|
|
20
21
|
|
|
@@ -47,16 +48,13 @@ export { DialogOverlay } from './vaadin-dialog-overlay.js';
|
|
|
47
48
|
*
|
|
48
49
|
* ### Styling
|
|
49
50
|
*
|
|
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:
|
|
51
|
+
* The following shadow DOM parts are available for styling:
|
|
57
52
|
*
|
|
58
53
|
* Part name | Description
|
|
59
54
|
* -----------------|-------------------------------------------
|
|
55
|
+
* `backdrop` | Backdrop of the overlay
|
|
56
|
+
* `overlay` | The overlay container
|
|
57
|
+
* `content` | The overlay content
|
|
60
58
|
* `header` | Element wrapping title and header content
|
|
61
59
|
* `header-content` | Element wrapping the header content slot
|
|
62
60
|
* `title` | Element wrapping the title slot
|
|
@@ -71,9 +69,6 @@ export { DialogOverlay } from './vaadin-dialog-overlay.js';
|
|
|
71
69
|
* `has-footer` | Set when the element has footer renderer
|
|
72
70
|
* `overflow` | Set to `top`, `bottom`, none or both
|
|
73
71
|
*
|
|
74
|
-
* Note: the `theme` attribute value set on `<vaadin-dialog>` is
|
|
75
|
-
* propagated to the internal `<vaadin-dialog-overlay>` component.
|
|
76
|
-
*
|
|
77
72
|
* See [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.
|
|
78
73
|
*
|
|
79
74
|
* @fires {CustomEvent} resize - Fired when the dialog resize is finished.
|
|
@@ -89,11 +84,16 @@ export { DialogOverlay } from './vaadin-dialog-overlay.js';
|
|
|
89
84
|
* @mixes DialogDraggableMixin
|
|
90
85
|
* @mixes DialogRendererMixin
|
|
91
86
|
* @mixes DialogResizableMixin
|
|
87
|
+
* @mixes DialogSizeMixin
|
|
92
88
|
* @mixes OverlayClassMixin
|
|
93
89
|
*/
|
|
94
|
-
class Dialog extends
|
|
95
|
-
|
|
96
|
-
|
|
90
|
+
class Dialog extends DialogSizeMixin(
|
|
91
|
+
DialogDraggableMixin(
|
|
92
|
+
DialogResizableMixin(
|
|
93
|
+
DialogRendererMixin(
|
|
94
|
+
DialogBaseMixin(OverlayClassMixin(ThemePropertyMixin(ElementMixin(PolylitMixin(LitElement))))),
|
|
95
|
+
),
|
|
96
|
+
),
|
|
97
97
|
),
|
|
98
98
|
) {
|
|
99
99
|
static get is() {
|
|
@@ -102,32 +102,24 @@ class Dialog extends DialogDraggableMixin(
|
|
|
102
102
|
|
|
103
103
|
static get styles() {
|
|
104
104
|
return css`
|
|
105
|
-
:host
|
|
105
|
+
:host([opened]),
|
|
106
|
+
:host([opening]),
|
|
107
|
+
:host([closing]) {
|
|
108
|
+
display: contents !important;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
:host,
|
|
112
|
+
:host([hidden]) {
|
|
106
113
|
display: none !important;
|
|
107
114
|
}
|
|
108
115
|
`;
|
|
109
116
|
}
|
|
110
117
|
|
|
111
|
-
static get properties() {
|
|
112
|
-
return {
|
|
113
|
-
/**
|
|
114
|
-
* Set the `aria-label` attribute for assistive technologies like
|
|
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
|
-
};
|
|
123
|
-
}
|
|
124
|
-
|
|
125
118
|
/** @protected */
|
|
126
119
|
render() {
|
|
127
120
|
return html`
|
|
128
121
|
<vaadin-dialog-overlay
|
|
129
122
|
id="overlay"
|
|
130
|
-
role="${this.overlayRole}"
|
|
131
123
|
.owner="${this}"
|
|
132
124
|
.opened="${this.opened}"
|
|
133
125
|
.headerTitle="${this.headerTitle}"
|
|
@@ -138,15 +130,29 @@ class Dialog extends DialogDraggableMixin(
|
|
|
138
130
|
@mousedown="${this._bringOverlayToFront}"
|
|
139
131
|
@touchstart="${this._bringOverlayToFront}"
|
|
140
132
|
theme="${ifDefined(this._theme)}"
|
|
141
|
-
aria-label="${ifDefined(this.ariaLabel || this.headerTitle)}"
|
|
142
133
|
.modeless="${this.modeless}"
|
|
143
134
|
.withBackdrop="${!this.modeless}"
|
|
144
135
|
?resizable="${this.resizable}"
|
|
145
136
|
restore-focus-on-close
|
|
146
137
|
focus-trap
|
|
147
|
-
|
|
138
|
+
exportparts="backdrop, overlay, header, title, header-content, content, footer"
|
|
139
|
+
>
|
|
140
|
+
<slot name="title" slot="title"></slot>
|
|
141
|
+
<slot name="header-content" slot="header-content"></slot>
|
|
142
|
+
<slot name="footer" slot="footer"></slot>
|
|
143
|
+
<slot></slot>
|
|
144
|
+
</vaadin-dialog-overlay>
|
|
148
145
|
`;
|
|
149
146
|
}
|
|
147
|
+
|
|
148
|
+
/** @protected */
|
|
149
|
+
updated(props) {
|
|
150
|
+
super.updated(props);
|
|
151
|
+
|
|
152
|
+
if (props.has('headerTitle')) {
|
|
153
|
+
this.ariaLabel = this.headerTitle;
|
|
154
|
+
}
|
|
155
|
+
}
|
|
150
156
|
}
|
|
151
157
|
|
|
152
158
|
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,14 +1,14 @@
|
|
|
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-alpha11",
|
|
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",
|
|
@@ -69,8 +69,8 @@
|
|
|
69
69
|
}
|
|
70
70
|
},
|
|
71
71
|
{
|
|
72
|
-
"name": "
|
|
73
|
-
"description": "
|
|
72
|
+
"name": "overlay-role",
|
|
73
|
+
"description": "The `role` attribute value to be set on the dialog. Defaults to \"dialog\".",
|
|
74
74
|
"value": {
|
|
75
75
|
"type": [
|
|
76
76
|
"string",
|
|
@@ -80,19 +80,17 @@
|
|
|
80
80
|
}
|
|
81
81
|
},
|
|
82
82
|
{
|
|
83
|
-
"name": "
|
|
84
|
-
"description": "Set the
|
|
83
|
+
"name": "draggable",
|
|
84
|
+
"description": "Set to true to enable repositioning the dialog by clicking and dragging.\n\nBy default, only the overlay area can be used to drag the element. But,\na child element can be marked as a draggable area by adding a\n\"`draggable`\" class to it, this will by default make all of its children draggable also.\nIf you want a child element to be draggable\nbut still have its children non-draggable (by default), mark it with\n\"`draggable-leaf-only`\" class name.",
|
|
85
85
|
"value": {
|
|
86
86
|
"type": [
|
|
87
|
-
"
|
|
88
|
-
"null",
|
|
89
|
-
"undefined"
|
|
87
|
+
"boolean"
|
|
90
88
|
]
|
|
91
89
|
}
|
|
92
90
|
},
|
|
93
91
|
{
|
|
94
|
-
"name": "
|
|
95
|
-
"description": "
|
|
92
|
+
"name": "header-title",
|
|
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 added to the overlay element.",
|
|
96
94
|
"value": {
|
|
97
95
|
"type": [
|
|
98
96
|
"string",
|
|
@@ -102,8 +100,8 @@
|
|
|
102
100
|
}
|
|
103
101
|
},
|
|
104
102
|
{
|
|
105
|
-
"name": "
|
|
106
|
-
"description": "Set to true to enable
|
|
103
|
+
"name": "resizable",
|
|
104
|
+
"description": "Set to true to enable resizing the dialog by dragging the corners and edges.",
|
|
107
105
|
"value": {
|
|
108
106
|
"type": [
|
|
109
107
|
"boolean"
|
|
@@ -111,8 +109,8 @@
|
|
|
111
109
|
}
|
|
112
110
|
},
|
|
113
111
|
{
|
|
114
|
-
"name": "
|
|
115
|
-
"description": "
|
|
112
|
+
"name": "width",
|
|
113
|
+
"description": "Set the width of the overlay.\nIf a unitless number is provided, pixels are assumed.",
|
|
116
114
|
"value": {
|
|
117
115
|
"type": [
|
|
118
116
|
"string",
|
|
@@ -122,17 +120,8 @@
|
|
|
122
120
|
}
|
|
123
121
|
},
|
|
124
122
|
{
|
|
125
|
-
"name": "
|
|
126
|
-
"description": "Set
|
|
127
|
-
"value": {
|
|
128
|
-
"type": [
|
|
129
|
-
"boolean"
|
|
130
|
-
]
|
|
131
|
-
}
|
|
132
|
-
},
|
|
133
|
-
{
|
|
134
|
-
"name": "overlay-class",
|
|
135
|
-
"description": "A space-delimited list of CSS class names to set on the overlay element.\nThis property does not affect other CSS class names set manually via JS.\n\nNote, if the CSS class name was set with this property, clearing it will\nremove it from the overlay, even if the same class name was also added\nmanually, e.g. by using `classList.add()` in the `renderer` function.",
|
|
123
|
+
"name": "height",
|
|
124
|
+
"description": "Set the height of the overlay.\nIf a unitless number is provided, pixels are assumed.",
|
|
136
125
|
"value": {
|
|
137
126
|
"type": [
|
|
138
127
|
"string",
|
|
@@ -142,8 +131,8 @@
|
|
|
142
131
|
}
|
|
143
132
|
},
|
|
144
133
|
{
|
|
145
|
-
"name": "
|
|
146
|
-
"description": "
|
|
134
|
+
"name": "overlay-class",
|
|
135
|
+
"description": "A space-delimited list of CSS class names to set on the overlay element.\nThis property does not affect other CSS class names set manually via JS.\n\nNote, if the CSS class name was set with this property, clearing it will\nremove it from the overlay, even if the same class name was also added\nmanually, e.g. by using `classList.add()` in the `renderer` function.",
|
|
147
136
|
"value": {
|
|
148
137
|
"type": [
|
|
149
138
|
"string",
|
|
@@ -224,31 +213,9 @@
|
|
|
224
213
|
]
|
|
225
214
|
}
|
|
226
215
|
},
|
|
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.",
|
|
241
|
-
"value": {
|
|
242
|
-
"type": [
|
|
243
|
-
"string",
|
|
244
|
-
"null",
|
|
245
|
-
"undefined"
|
|
246
|
-
]
|
|
247
|
-
}
|
|
248
|
-
},
|
|
249
216
|
{
|
|
250
217
|
"name": "overlayRole",
|
|
251
|
-
"description": "The `role` attribute value to be set on the
|
|
218
|
+
"description": "The `role` attribute value to be set on the dialog. Defaults to \"dialog\".",
|
|
252
219
|
"value": {
|
|
253
220
|
"type": [
|
|
254
221
|
"string",
|
|
@@ -317,8 +284,8 @@
|
|
|
317
284
|
}
|
|
318
285
|
},
|
|
319
286
|
{
|
|
320
|
-
"name": "
|
|
321
|
-
"description": "
|
|
287
|
+
"name": "width",
|
|
288
|
+
"description": "Set the width of the overlay.\nIf a unitless number is provided, pixels are assumed.",
|
|
322
289
|
"value": {
|
|
323
290
|
"type": [
|
|
324
291
|
"string",
|
|
@@ -328,8 +295,19 @@
|
|
|
328
295
|
}
|
|
329
296
|
},
|
|
330
297
|
{
|
|
331
|
-
"name": "
|
|
332
|
-
"description": "Set the
|
|
298
|
+
"name": "height",
|
|
299
|
+
"description": "Set the height of the overlay.\nIf a unitless number is provided, pixels are assumed.",
|
|
300
|
+
"value": {
|
|
301
|
+
"type": [
|
|
302
|
+
"string",
|
|
303
|
+
"null",
|
|
304
|
+
"undefined"
|
|
305
|
+
]
|
|
306
|
+
}
|
|
307
|
+
},
|
|
308
|
+
{
|
|
309
|
+
"name": "overlayClass",
|
|
310
|
+
"description": "A space-delimited list of CSS class names to set on the overlay element.\nThis property does not affect other CSS class names set manually via JS.\n\nNote, if the CSS class name was set with this property, clearing it will\nremove it from the overlay, even if the same class name was also added\nmanually, e.g. by using `classList.add()` in the `renderer` function.",
|
|
333
311
|
"value": {
|
|
334
312
|
"type": [
|
|
335
313
|
"string",
|
package/web-types.lit.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
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-alpha11",
|
|
5
5
|
"description-markup": "markdown",
|
|
6
6
|
"framework": "lit",
|
|
7
7
|
"framework-config": {
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"elements": [
|
|
17
17
|
{
|
|
18
18
|
"name": "vaadin-dialog",
|
|
19
|
-
"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\
|
|
19
|
+
"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.",
|
|
20
20
|
"extension": true,
|
|
21
21
|
"attributes": [
|
|
22
22
|
{
|
|
@@ -75,23 +75,9 @@
|
|
|
75
75
|
"kind": "expression"
|
|
76
76
|
}
|
|
77
77
|
},
|
|
78
|
-
{
|
|
79
|
-
"name": ".width",
|
|
80
|
-
"description": "Set the width of the overlay.\nIf a unitless number is provided, pixels are assumed.",
|
|
81
|
-
"value": {
|
|
82
|
-
"kind": "expression"
|
|
83
|
-
}
|
|
84
|
-
},
|
|
85
|
-
{
|
|
86
|
-
"name": ".height",
|
|
87
|
-
"description": "Set the height of the overlay.\nIf a unitless number is provided, pixels are assumed.",
|
|
88
|
-
"value": {
|
|
89
|
-
"kind": "expression"
|
|
90
|
-
}
|
|
91
|
-
},
|
|
92
78
|
{
|
|
93
79
|
"name": ".overlayRole",
|
|
94
|
-
"description": "The `role` attribute value to be set on the
|
|
80
|
+
"description": "The `role` attribute value to be set on the dialog. Defaults to \"dialog\".",
|
|
95
81
|
"value": {
|
|
96
82
|
"kind": "expression"
|
|
97
83
|
}
|
|
@@ -125,15 +111,22 @@
|
|
|
125
111
|
}
|
|
126
112
|
},
|
|
127
113
|
{
|
|
128
|
-
"name": ".
|
|
129
|
-
"description": "
|
|
114
|
+
"name": ".width",
|
|
115
|
+
"description": "Set the width of the overlay.\nIf a unitless number is provided, pixels are assumed.",
|
|
130
116
|
"value": {
|
|
131
117
|
"kind": "expression"
|
|
132
118
|
}
|
|
133
119
|
},
|
|
134
120
|
{
|
|
135
|
-
"name": ".
|
|
136
|
-
"description": "Set the
|
|
121
|
+
"name": ".height",
|
|
122
|
+
"description": "Set the height of the overlay.\nIf a unitless number is provided, pixels are assumed.",
|
|
123
|
+
"value": {
|
|
124
|
+
"kind": "expression"
|
|
125
|
+
}
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
"name": ".overlayClass",
|
|
129
|
+
"description": "A space-delimited list of CSS class names to set on the overlay element.\nThis property does not affect other CSS class names set manually via JS.\n\nNote, if the CSS class name was set with this property, clearing it will\nremove it from the overlay, even if the same class name was also added\nmanually, e.g. by using `classList.add()` in the `renderer` function.",
|
|
137
130
|
"value": {
|
|
138
131
|
"kind": "expression"
|
|
139
132
|
}
|
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
import '@vaadin/vaadin-lumo-styles/spacing.js';
|
|
2
|
-
import { overlay } from '@vaadin/vaadin-lumo-styles/mixins/overlay.js';
|
|
3
|
-
import { css, registerStyles } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
4
|
-
|
|
5
|
-
const dialogOverlay = css`
|
|
6
|
-
/* Optical centering */
|
|
7
|
-
:host::before,
|
|
8
|
-
:host::after {
|
|
9
|
-
content: '';
|
|
10
|
-
flex-basis: 0;
|
|
11
|
-
flex-grow: 1;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
:host::after {
|
|
15
|
-
flex-grow: 1.1;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
[part='overlay'] {
|
|
19
|
-
border-radius: var(--lumo-border-radius-l);
|
|
20
|
-
box-shadow:
|
|
21
|
-
0 0 0 1px var(--lumo-shade-5pct),
|
|
22
|
-
var(--lumo-box-shadow-xl);
|
|
23
|
-
background-image: none;
|
|
24
|
-
outline: none;
|
|
25
|
-
-webkit-tap-highlight-color: transparent;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
[part='content'] {
|
|
29
|
-
padding: var(--lumo-space-l);
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
:host(:is([has-header], [has-title])) [part='header'] + [part='content'] {
|
|
33
|
-
padding-top: 0;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
[part='header'],
|
|
37
|
-
[part='header-content'],
|
|
38
|
-
[part='footer'] {
|
|
39
|
-
gap: var(--lumo-space-xs) var(--lumo-space-s);
|
|
40
|
-
line-height: var(--lumo-line-height-s);
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
[part='header'] {
|
|
44
|
-
padding: var(--lumo-space-m);
|
|
45
|
-
background-color: var(--lumo-base-color);
|
|
46
|
-
border-radius: var(--lumo-border-radius-l) var(--lumo-border-radius-l) 0 0; /* Needed for Safari */
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
[part='footer'] {
|
|
50
|
-
padding: var(--lumo-space-s) var(--lumo-space-m);
|
|
51
|
-
background-color: var(--lumo-contrast-5pct);
|
|
52
|
-
border-radius: 0 0 var(--lumo-border-radius-l) var(--lumo-border-radius-l); /* Needed for Safari */
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
[part='title'] {
|
|
56
|
-
font-size: var(--lumo-font-size-xl);
|
|
57
|
-
font-weight: 600;
|
|
58
|
-
color: var(--lumo-header-text-color);
|
|
59
|
-
margin-inline-start: calc(var(--lumo-space-l) - var(--lumo-space-m));
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
/* No padding */
|
|
63
|
-
:host([theme~='no-padding']) [part='content'] {
|
|
64
|
-
padding: 0 !important;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
@media (min-height: 320px) {
|
|
68
|
-
:host([overflow~='top']) [part='header'] {
|
|
69
|
-
box-shadow: 0 1px 0 0 var(--lumo-contrast-10pct);
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
/* Animations */
|
|
74
|
-
|
|
75
|
-
:host([opening]),
|
|
76
|
-
:host([closing]) {
|
|
77
|
-
animation: 0.25s lumo-overlay-dummy-animation;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
:host([opening]) [part='overlay'] {
|
|
81
|
-
animation: 0.12s 0.05s vaadin-dialog-enter cubic-bezier(0.215, 0.61, 0.355, 1) both;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
@keyframes vaadin-dialog-enter {
|
|
85
|
-
0% {
|
|
86
|
-
opacity: 0;
|
|
87
|
-
transform: scale(0.95);
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
:host([closing]) [part='overlay'] {
|
|
92
|
-
animation: 0.1s 0.03s vaadin-dialog-exit cubic-bezier(0.55, 0.055, 0.675, 0.19) both;
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
:host([closing]) [part='backdrop'] {
|
|
96
|
-
animation-delay: 0.05s;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
@keyframes vaadin-dialog-exit {
|
|
100
|
-
100% {
|
|
101
|
-
opacity: 0;
|
|
102
|
-
transform: scale(1.02);
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
`;
|
|
106
|
-
|
|
107
|
-
registerStyles('vaadin-dialog-overlay', [overlay, dialogOverlay], { moduleId: 'lumo-dialog' });
|
|
108
|
-
|
|
109
|
-
export { dialogOverlay };
|