@vaadin/dialog 24.8.4 → 25.0.0-alpha10
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/README.md +0 -23
- package/package.json +14 -15
- package/src/lit/renderer-directives.d.ts +0 -1
- package/src/styles/vaadin-dialog-overlay-base-styles.d.ts +10 -0
- package/src/styles/vaadin-dialog-overlay-base-styles.js +216 -0
- package/src/{vaadin-dialog-styles.d.ts → styles/vaadin-dialog-overlay-core-styles.d.ts} +2 -2
- package/src/{vaadin-dialog-styles.js → styles/vaadin-dialog-overlay-core-styles.js} +5 -2
- package/src/vaadin-dialog-base-mixin.d.ts +1 -13
- package/src/vaadin-dialog-base-mixin.js +16 -19
- package/src/vaadin-dialog-overlay-mixin.d.ts +0 -14
- package/src/vaadin-dialog-overlay-mixin.js +27 -31
- package/src/vaadin-dialog-overlay.d.ts +1 -1
- package/src/vaadin-dialog-overlay.js +15 -11
- 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 +60 -78
- package/web-types.json +33 -55
- package/web-types.lit.json +14 -21
- package/src/vaadin-lit-dialog-overlay.js +0 -51
- package/src/vaadin-lit-dialog.js +0 -99
- package/theme/lumo/vaadin-lit-dialog.d.ts +0 -2
- package/theme/lumo/vaadin-lit-dialog.js +0 -2
- package/theme/material/vaadin-dialog-styles.d.ts +0 -4
- package/theme/material/vaadin-dialog-styles.js +0 -64
- package/theme/material/vaadin-dialog.d.ts +0 -2
- package/theme/material/vaadin-dialog.js +0 -2
- package/theme/material/vaadin-lit-dialog.d.ts +0 -2
- package/theme/material/vaadin-lit-dialog.js +0 -2
- package/vaadin-lit-dialog.d.ts +0 -1
- package/vaadin-lit-dialog.js +0 -2
package/README.md
CHANGED
|
@@ -33,29 +33,6 @@ Once installed, import the component in your application:
|
|
|
33
33
|
import '@vaadin/dialog';
|
|
34
34
|
```
|
|
35
35
|
|
|
36
|
-
## Themes
|
|
37
|
-
|
|
38
|
-
Vaadin components come with two built-in [themes](https://vaadin.com/docs/latest/styling), Lumo and Material.
|
|
39
|
-
The [main entrypoint](https://github.com/vaadin/web-components/blob/main/packages/dialog/vaadin-dialog.js) of the package uses the Lumo theme.
|
|
40
|
-
|
|
41
|
-
To use the Material theme, import the component from the `theme/material` folder:
|
|
42
|
-
|
|
43
|
-
```js
|
|
44
|
-
import '@vaadin/dialog/theme/material/vaadin-dialog.js';
|
|
45
|
-
```
|
|
46
|
-
|
|
47
|
-
You can also import the Lumo version of the component explicitly:
|
|
48
|
-
|
|
49
|
-
```js
|
|
50
|
-
import '@vaadin/dialog/theme/lumo/vaadin-dialog.js';
|
|
51
|
-
```
|
|
52
|
-
|
|
53
|
-
Finally, you can import the un-themed component from the `src` folder to get a minimal starting point:
|
|
54
|
-
|
|
55
|
-
```js
|
|
56
|
-
import '@vaadin/dialog/src/vaadin-dialog.js';
|
|
57
|
-
```
|
|
58
|
-
|
|
59
36
|
## Contributing
|
|
60
37
|
|
|
61
38
|
Read the [contributing guide](https://vaadin.com/docs/latest/contributing) to learn about our development process, how to propose bugfixes and improvements, and how to test your changes to Vaadin components.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vaadin/dialog",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "25.0.0-alpha10",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -23,6 +23,8 @@
|
|
|
23
23
|
"lit.d.ts",
|
|
24
24
|
"lit.js",
|
|
25
25
|
"src",
|
|
26
|
+
"!src/styles/*-base-styles.d.ts",
|
|
27
|
+
"!src/styles/*-base-styles.js",
|
|
26
28
|
"theme",
|
|
27
29
|
"vaadin-*.d.ts",
|
|
28
30
|
"vaadin-*.js",
|
|
@@ -33,30 +35,27 @@
|
|
|
33
35
|
"Vaadin",
|
|
34
36
|
"vaadin-dialog",
|
|
35
37
|
"web-components",
|
|
36
|
-
"web-component"
|
|
37
|
-
"polymer"
|
|
38
|
+
"web-component"
|
|
38
39
|
],
|
|
39
40
|
"dependencies": {
|
|
40
41
|
"@open-wc/dedupe-mixin": "^1.3.0",
|
|
41
|
-
"@
|
|
42
|
-
"@vaadin/
|
|
43
|
-
"@vaadin/
|
|
44
|
-
"@vaadin/
|
|
45
|
-
"@vaadin/vaadin-
|
|
46
|
-
"@vaadin/vaadin-material-styles": "~24.8.4",
|
|
47
|
-
"@vaadin/vaadin-themable-mixin": "~24.8.4",
|
|
42
|
+
"@vaadin/component-base": "25.0.0-alpha10",
|
|
43
|
+
"@vaadin/lit-renderer": "25.0.0-alpha10",
|
|
44
|
+
"@vaadin/overlay": "25.0.0-alpha10",
|
|
45
|
+
"@vaadin/vaadin-lumo-styles": "25.0.0-alpha10",
|
|
46
|
+
"@vaadin/vaadin-themable-mixin": "25.0.0-alpha10",
|
|
48
47
|
"lit": "^3.0.0"
|
|
49
48
|
},
|
|
50
49
|
"devDependencies": {
|
|
51
|
-
"@vaadin/a11y-base": "
|
|
52
|
-
"@vaadin/chai-plugins": "
|
|
53
|
-
"@vaadin/test-runner-commands": "
|
|
54
|
-
"@vaadin/testing-helpers": "^
|
|
50
|
+
"@vaadin/a11y-base": "25.0.0-alpha10",
|
|
51
|
+
"@vaadin/chai-plugins": "25.0.0-alpha10",
|
|
52
|
+
"@vaadin/test-runner-commands": "25.0.0-alpha10",
|
|
53
|
+
"@vaadin/testing-helpers": "^2.0.0",
|
|
55
54
|
"sinon": "^18.0.0"
|
|
56
55
|
},
|
|
57
56
|
"web-types": [
|
|
58
57
|
"web-types.json",
|
|
59
58
|
"web-types.lit.json"
|
|
60
59
|
],
|
|
61
|
-
"gitHead": "
|
|
60
|
+
"gitHead": "6cc6c94079e805fa5b2f0af4dbf3b2a7485e57d0"
|
|
62
61
|
}
|
|
@@ -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';
|
|
@@ -0,0 +1,10 @@
|
|
|
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 { CSSResult } from 'lit';
|
|
7
|
+
|
|
8
|
+
export const dialogOverlayBase: CSSResult;
|
|
9
|
+
|
|
10
|
+
export const dialogOverlayStyles: CSSResult;
|
|
@@ -0,0 +1,216 @@
|
|
|
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 '@vaadin/component-base/src/style-props.js';
|
|
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
|
+
}
|
|
44
|
+
|
|
45
|
+
[part='header'],
|
|
46
|
+
[part='header-content'],
|
|
47
|
+
[part='footer'] {
|
|
48
|
+
display: flex;
|
|
49
|
+
align-items: center;
|
|
50
|
+
flex-wrap: wrap;
|
|
51
|
+
flex: none;
|
|
52
|
+
pointer-events: none;
|
|
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;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
[part='header'] {
|
|
80
|
+
flex-wrap: nowrap;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
::slotted([slot='header-content']),
|
|
84
|
+
::slotted([slot='title']),
|
|
85
|
+
::slotted([slot='footer']) {
|
|
86
|
+
display: contents;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
::slotted([slot='title']) {
|
|
90
|
+
font: inherit !important;
|
|
91
|
+
color: inherit !important;
|
|
92
|
+
overflow-wrap: anywhere;
|
|
93
|
+
}
|
|
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
|
+
|
|
102
|
+
[part='header-content'] {
|
|
103
|
+
flex: 1;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
:host([has-title]) [part='header-content'],
|
|
107
|
+
[part='footer'] {
|
|
108
|
+
justify-content: flex-end;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
:host(:not([has-title]):not([has-header])) [part='header'],
|
|
112
|
+
:host(:not([has-header])) [part='header-content'],
|
|
113
|
+
:host(:not([has-title])) [part='title'],
|
|
114
|
+
:host(:not([has-footer])) [part='footer'] {
|
|
115
|
+
display: none !important;
|
|
116
|
+
}
|
|
117
|
+
`;
|
|
118
|
+
|
|
119
|
+
const dialogResizableOverlay = css`
|
|
120
|
+
[part='overlay'] {
|
|
121
|
+
position: relative;
|
|
122
|
+
overflow: visible;
|
|
123
|
+
display: flex;
|
|
124
|
+
}
|
|
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 */
|
|
133
|
+
[part='content'] {
|
|
134
|
+
flex: 1;
|
|
135
|
+
min-height: 0;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
:host([overflow]) [part='content'] {
|
|
139
|
+
overflow: auto;
|
|
140
|
+
overscroll-behavior: contain;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
.resizer-container {
|
|
144
|
+
display: flex;
|
|
145
|
+
flex-direction: column;
|
|
146
|
+
flex-grow: 1;
|
|
147
|
+
border-radius: inherit;
|
|
148
|
+
max-width: 100%;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
:host(:not([resizable])) .resizer {
|
|
152
|
+
display: none;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
.resizer {
|
|
156
|
+
position: absolute;
|
|
157
|
+
height: 16px;
|
|
158
|
+
width: 16px;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
.resizer.edge {
|
|
162
|
+
height: 8px;
|
|
163
|
+
width: 8px;
|
|
164
|
+
inset: -4px;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
.resizer.edge.n {
|
|
168
|
+
width: auto;
|
|
169
|
+
bottom: auto;
|
|
170
|
+
cursor: ns-resize;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
.resizer.ne {
|
|
174
|
+
top: -4px;
|
|
175
|
+
right: -4px;
|
|
176
|
+
cursor: nesw-resize;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
.resizer.edge.e {
|
|
180
|
+
height: auto;
|
|
181
|
+
left: auto;
|
|
182
|
+
cursor: ew-resize;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
.resizer.se {
|
|
186
|
+
bottom: -4px;
|
|
187
|
+
right: -4px;
|
|
188
|
+
cursor: nwse-resize;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
.resizer.edge.s {
|
|
192
|
+
width: auto;
|
|
193
|
+
top: auto;
|
|
194
|
+
cursor: ns-resize;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
.resizer.sw {
|
|
198
|
+
bottom: -4px;
|
|
199
|
+
left: -4px;
|
|
200
|
+
cursor: nesw-resize;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
.resizer.edge.w {
|
|
204
|
+
height: auto;
|
|
205
|
+
right: auto;
|
|
206
|
+
cursor: ew-resize;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
.resizer.nw {
|
|
210
|
+
top: -4px;
|
|
211
|
+
left: -4px;
|
|
212
|
+
cursor: nwse-resize;
|
|
213
|
+
}
|
|
214
|
+
`;
|
|
215
|
+
|
|
216
|
+
export const dialogOverlayStyles = [overlayStyles, dialogOverlayBase, dialogResizableOverlay];
|
|
@@ -4,8 +4,9 @@
|
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
6
|
import { css } from 'lit';
|
|
7
|
+
import { overlayStyles } from '@vaadin/overlay/src/styles/vaadin-overlay-core-styles.js';
|
|
7
8
|
|
|
8
|
-
export const
|
|
9
|
+
export const dialogOverlayBase = css`
|
|
9
10
|
[part='header'],
|
|
10
11
|
[part='header-content'],
|
|
11
12
|
[part='footer'] {
|
|
@@ -85,7 +86,7 @@ export const dialogOverlay = css`
|
|
|
85
86
|
}
|
|
86
87
|
`;
|
|
87
88
|
|
|
88
|
-
|
|
89
|
+
const dialogResizableOverlay = css`
|
|
89
90
|
[part='overlay'] {
|
|
90
91
|
position: relative;
|
|
91
92
|
overflow: visible;
|
|
@@ -179,3 +180,5 @@ export const resizableOverlay = css`
|
|
|
179
180
|
cursor: nwse-resize;
|
|
180
181
|
}
|
|
181
182
|
`;
|
|
183
|
+
|
|
184
|
+
export const dialogOverlayStyles = [overlayStyles, dialogOverlayBase, dialogResizableOverlay];
|
|
@@ -33,7 +33,7 @@ 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
39
|
*/
|
|
@@ -58,16 +58,4 @@ export declare class DialogBaseMixinClass {
|
|
|
58
58
|
* overlay from stretching all the way to the left of the viewport).
|
|
59
59
|
*/
|
|
60
60
|
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
61
|
}
|
|
@@ -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,18 @@ 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
|
|
98
83
|
*/
|
|
99
84
|
overlayRole: {
|
|
100
85
|
type: String,
|
|
101
|
-
value: 'dialog',
|
|
102
86
|
},
|
|
103
87
|
};
|
|
104
88
|
}
|
|
105
89
|
|
|
106
90
|
static get observers() {
|
|
107
|
-
return ['__positionChanged(top, left)'
|
|
91
|
+
return ['__positionChanged(top, left)'];
|
|
108
92
|
}
|
|
109
93
|
|
|
110
94
|
/** @protected */
|
|
@@ -118,6 +102,19 @@ export const DialogBaseMixin = (superClass) =>
|
|
|
118
102
|
overlay.addEventListener('vaadin-overlay-closed', this.__handleOverlayClosed.bind(this));
|
|
119
103
|
|
|
120
104
|
this._overlayElement = overlay;
|
|
105
|
+
|
|
106
|
+
if (!this.hasAttribute('role')) {
|
|
107
|
+
this.role = 'dialog';
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/** @protected */
|
|
112
|
+
updated(props) {
|
|
113
|
+
super.updated(props);
|
|
114
|
+
|
|
115
|
+
if (props.has('overlayRole')) {
|
|
116
|
+
this.role = this.overlayRole || 'dialog';
|
|
117
|
+
}
|
|
121
118
|
}
|
|
122
119
|
|
|
123
120
|
/** @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,6 +44,24 @@ 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();
|
|
@@ -99,8 +118,8 @@ export const DialogOverlayMixin = (superClass) =>
|
|
|
99
118
|
this._oldOpenedFooterHeader = opened;
|
|
100
119
|
|
|
101
120
|
// Set attributes here to update styles before detecting content overflow
|
|
102
|
-
this
|
|
103
|
-
this
|
|
121
|
+
setOverlayStateAttribute(this, 'has-header', !!headerRenderer);
|
|
122
|
+
setOverlayStateAttribute(this, 'has-footer', !!footerRenderer);
|
|
104
123
|
|
|
105
124
|
if (headerRendererChanged) {
|
|
106
125
|
if (headerRenderer) {
|
|
@@ -134,7 +153,7 @@ export const DialogOverlayMixin = (superClass) =>
|
|
|
134
153
|
|
|
135
154
|
/** @private */
|
|
136
155
|
_headerTitleChanged(headerTitle, opened) {
|
|
137
|
-
this
|
|
156
|
+
setOverlayStateAttribute(this, 'has-title', !!headerTitle);
|
|
138
157
|
|
|
139
158
|
if (opened && (headerTitle || this._oldHeaderTitle)) {
|
|
140
159
|
this.requestContentUpdate();
|
|
@@ -150,7 +169,7 @@ export const DialogOverlayMixin = (superClass) =>
|
|
|
150
169
|
this.headerTitleElement.setAttribute('slot', 'title');
|
|
151
170
|
this.headerTitleElement.classList.add('draggable');
|
|
152
171
|
}
|
|
153
|
-
this.appendChild(this.headerTitleElement);
|
|
172
|
+
this.owner.appendChild(this.headerTitleElement);
|
|
154
173
|
this.headerTitleElement.textContent = this.headerTitle;
|
|
155
174
|
} else if (this.headerTitleElement) {
|
|
156
175
|
this.headerTitleElement.remove();
|
|
@@ -167,7 +186,7 @@ export const DialogOverlayMixin = (superClass) =>
|
|
|
167
186
|
if (this.headerContainer) {
|
|
168
187
|
// If a new renderer has been set, make sure to reattach the container
|
|
169
188
|
if (!this.headerContainer.parentElement) {
|
|
170
|
-
this.appendChild(this.headerContainer);
|
|
189
|
+
this.owner.appendChild(this.headerContainer);
|
|
171
190
|
}
|
|
172
191
|
|
|
173
192
|
if (this.headerRenderer) {
|
|
@@ -179,7 +198,7 @@ export const DialogOverlayMixin = (superClass) =>
|
|
|
179
198
|
if (this.footerContainer) {
|
|
180
199
|
// If a new renderer has been set, make sure to reattach the container
|
|
181
200
|
if (!this.footerContainer.parentElement) {
|
|
182
|
-
this.appendChild(this.footerContainer);
|
|
201
|
+
this.owner.appendChild(this.footerContainer);
|
|
183
202
|
}
|
|
184
203
|
|
|
185
204
|
if (this.footerRenderer) {
|
|
@@ -193,29 +212,6 @@ export const DialogOverlayMixin = (superClass) =>
|
|
|
193
212
|
this.__updateOverflow();
|
|
194
213
|
}
|
|
195
214
|
|
|
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
|
-
// Allow setting width or height to `null`
|
|
211
|
-
if (parsedBounds[arg] !== null && !isNaN(parsedBounds[arg])) {
|
|
212
|
-
parsedBounds[arg] = `${parsedBounds[arg]}px`;
|
|
213
|
-
}
|
|
214
|
-
});
|
|
215
|
-
|
|
216
|
-
Object.assign(overlay.style, parsedBounds);
|
|
217
|
-
}
|
|
218
|
-
|
|
219
215
|
/**
|
|
220
216
|
* Retrieves the coordinates of the overlay.
|
|
221
217
|
* @return {!DialogOverlayBounds}
|
|
@@ -250,9 +246,9 @@ export const DialogOverlayMixin = (superClass) =>
|
|
|
250
246
|
|
|
251
247
|
const value = overflow.trim();
|
|
252
248
|
if (value.length > 0 && this.getAttribute('overflow') !== value) {
|
|
253
|
-
this
|
|
249
|
+
setOverlayStateAttribute(this, 'overflow', value);
|
|
254
250
|
} else if (value.length === 0 && this.hasAttribute('overflow')) {
|
|
255
|
-
this
|
|
251
|
+
setOverlayStateAttribute(this, 'overflow', null);
|
|
256
252
|
}
|
|
257
253
|
}
|
|
258
254
|
};
|
|
@@ -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.
|
|
@@ -3,17 +3,14 @@
|
|
|
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 { html,
|
|
6
|
+
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
|
-
import {
|
|
10
|
-
import {
|
|
9
|
+
import { PolylitMixin } from '@vaadin/component-base/src/polylit-mixin.js';
|
|
10
|
+
import { LumoInjectionMixin } from '@vaadin/vaadin-themable-mixin/lumo-injection-mixin.js';
|
|
11
|
+
import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
12
|
+
import { dialogOverlayStyles } from './styles/vaadin-dialog-overlay-core-styles.js';
|
|
11
13
|
import { DialogOverlayMixin } from './vaadin-dialog-overlay-mixin.js';
|
|
12
|
-
import { dialogOverlay, resizableOverlay } from './vaadin-dialog-styles.js';
|
|
13
|
-
|
|
14
|
-
registerStyles('vaadin-dialog-overlay', [overlayStyles, dialogOverlay, resizableOverlay], {
|
|
15
|
-
moduleId: 'vaadin-dialog-overlay-styles',
|
|
16
|
-
});
|
|
17
14
|
|
|
18
15
|
/**
|
|
19
16
|
* An element used internally by `<vaadin-dialog>`. Not intended to be used separately.
|
|
@@ -25,14 +22,21 @@ registerStyles('vaadin-dialog-overlay', [overlayStyles, dialogOverlay, resizable
|
|
|
25
22
|
* @mixes ThemableMixin
|
|
26
23
|
* @private
|
|
27
24
|
*/
|
|
28
|
-
export class DialogOverlay extends DialogOverlayMixin(
|
|
25
|
+
export class DialogOverlay extends DialogOverlayMixin(
|
|
26
|
+
DirMixin(ThemableMixin(PolylitMixin(LumoInjectionMixin(LitElement)))),
|
|
27
|
+
) {
|
|
29
28
|
static get is() {
|
|
30
29
|
return 'vaadin-dialog-overlay';
|
|
31
30
|
}
|
|
32
31
|
|
|
33
|
-
static get
|
|
32
|
+
static get styles() {
|
|
33
|
+
return dialogOverlayStyles;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/** @protected */
|
|
37
|
+
render() {
|
|
34
38
|
return html`
|
|
35
|
-
<div id="backdrop" part="backdrop" hidden
|
|
39
|
+
<div id="backdrop" part="backdrop" ?hidden="${!this.withBackdrop}"></div>
|
|
36
40
|
<div part="overlay" id="overlay" tabindex="0">
|
|
37
41
|
<section id="resizerContainer" class="resizer-container">
|
|
38
42
|
<header part="header">
|
|
@@ -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
|
/**
|