@vaadin/dialog 25.1.0-alpha3 → 25.1.0-alpha4
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 -11
- package/src/vaadin-dialog-base-mixin.d.ts +6 -0
- package/src/vaadin-dialog-base-mixin.js +10 -0
- package/src/vaadin-dialog-draggable-mixin.d.ts +8 -0
- package/src/vaadin-dialog-draggable-mixin.js +29 -2
- package/src/vaadin-dialog.js +1 -1
- package/web-types.json +37 -1
- package/web-types.lit.json +15 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vaadin/dialog",
|
|
3
|
-
"version": "25.1.0-
|
|
3
|
+
"version": "25.1.0-alpha4",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -36,24 +36,24 @@
|
|
|
36
36
|
],
|
|
37
37
|
"dependencies": {
|
|
38
38
|
"@open-wc/dedupe-mixin": "^1.3.0",
|
|
39
|
-
"@vaadin/component-base": "25.1.0-
|
|
40
|
-
"@vaadin/lit-renderer": "25.1.0-
|
|
41
|
-
"@vaadin/overlay": "25.1.0-
|
|
42
|
-
"@vaadin/vaadin-themable-mixin": "25.1.0-
|
|
39
|
+
"@vaadin/component-base": "25.1.0-alpha4",
|
|
40
|
+
"@vaadin/lit-renderer": "25.1.0-alpha4",
|
|
41
|
+
"@vaadin/overlay": "25.1.0-alpha4",
|
|
42
|
+
"@vaadin/vaadin-themable-mixin": "25.1.0-alpha4",
|
|
43
43
|
"lit": "^3.0.0"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
|
-
"@vaadin/a11y-base": "25.1.0-
|
|
47
|
-
"@vaadin/aura": "25.1.0-
|
|
48
|
-
"@vaadin/chai-plugins": "25.1.0-
|
|
49
|
-
"@vaadin/test-runner-commands": "25.1.0-
|
|
46
|
+
"@vaadin/a11y-base": "25.1.0-alpha4",
|
|
47
|
+
"@vaadin/aura": "25.1.0-alpha4",
|
|
48
|
+
"@vaadin/chai-plugins": "25.1.0-alpha4",
|
|
49
|
+
"@vaadin/test-runner-commands": "25.1.0-alpha4",
|
|
50
50
|
"@vaadin/testing-helpers": "^2.0.0",
|
|
51
|
-
"@vaadin/vaadin-lumo-styles": "25.1.0-
|
|
51
|
+
"@vaadin/vaadin-lumo-styles": "25.1.0-alpha4",
|
|
52
52
|
"sinon": "^21.0.0"
|
|
53
53
|
},
|
|
54
54
|
"web-types": [
|
|
55
55
|
"web-types.json",
|
|
56
56
|
"web-types.lit.json"
|
|
57
57
|
],
|
|
58
|
-
"gitHead": "
|
|
58
|
+
"gitHead": "4fb917150617231c1acf27faabf386560dcd3bc5"
|
|
59
59
|
}
|
|
@@ -32,6 +32,12 @@ export declare class DialogBaseMixinClass {
|
|
|
32
32
|
*/
|
|
33
33
|
modeless: boolean;
|
|
34
34
|
|
|
35
|
+
/**
|
|
36
|
+
* Set to true to disable focus trapping.
|
|
37
|
+
* @attr {boolean} no-focus-trap
|
|
38
|
+
*/
|
|
39
|
+
noFocusTrap: boolean;
|
|
40
|
+
|
|
35
41
|
/**
|
|
36
42
|
* The `role` attribute value to be set on the dialog. Defaults to "dialog".
|
|
37
43
|
*
|
|
@@ -52,6 +52,16 @@ export const DialogBaseMixin = (superClass) =>
|
|
|
52
52
|
value: false,
|
|
53
53
|
},
|
|
54
54
|
|
|
55
|
+
/**
|
|
56
|
+
* Set to true to disable focus trapping.
|
|
57
|
+
* @attr {boolean} no-focus-trap
|
|
58
|
+
* @type {boolean}
|
|
59
|
+
*/
|
|
60
|
+
noFocusTrap: {
|
|
61
|
+
type: Boolean,
|
|
62
|
+
value: false,
|
|
63
|
+
},
|
|
64
|
+
|
|
55
65
|
/**
|
|
56
66
|
* Set the distance of the dialog from the top of the viewport.
|
|
57
67
|
* If a unitless number is provided, pixels are assumed.
|
|
@@ -21,4 +21,12 @@ export declare class DialogDraggableMixinClass {
|
|
|
21
21
|
* "`draggable-leaf-only`" class name.
|
|
22
22
|
*/
|
|
23
23
|
draggable: boolean;
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Set to true to prevent dragging the dialog outside the viewport bounds.
|
|
27
|
+
* When enabled, all four edges of the dialog will remain visible during dragging.
|
|
28
|
+
* The dialog may still become partially hidden when the viewport is resized.
|
|
29
|
+
* @attr {boolean} keep-in-viewport
|
|
30
|
+
*/
|
|
31
|
+
keepInViewport: boolean;
|
|
24
32
|
}
|
|
@@ -31,6 +31,19 @@ export const DialogDraggableMixin = (superClass) =>
|
|
|
31
31
|
reflectToAttribute: true,
|
|
32
32
|
},
|
|
33
33
|
|
|
34
|
+
/**
|
|
35
|
+
* Set to true to prevent dragging the dialog outside the viewport bounds.
|
|
36
|
+
* When enabled, all four edges of the dialog will remain visible during dragging.
|
|
37
|
+
* The dialog may still become partially hidden when the viewport is resized.
|
|
38
|
+
* @attr {boolean} keep-in-viewport
|
|
39
|
+
* @type {boolean}
|
|
40
|
+
*/
|
|
41
|
+
keepInViewport: {
|
|
42
|
+
type: Boolean,
|
|
43
|
+
value: false,
|
|
44
|
+
reflectToAttribute: true,
|
|
45
|
+
},
|
|
46
|
+
|
|
34
47
|
/** @private */
|
|
35
48
|
_touchDevice: {
|
|
36
49
|
type: Boolean,
|
|
@@ -110,8 +123,22 @@ export const DialogDraggableMixin = (superClass) =>
|
|
|
110
123
|
_drag(e) {
|
|
111
124
|
const event = getMouseOrFirstTouchEvent(e);
|
|
112
125
|
if (eventInWindow(event)) {
|
|
113
|
-
|
|
114
|
-
|
|
126
|
+
let top = this._originalBounds.top + (event.pageY - this._originalMouseCoords.top);
|
|
127
|
+
let left = this._originalBounds.left + (event.pageX - this._originalMouseCoords.left);
|
|
128
|
+
|
|
129
|
+
if (this.keepInViewport) {
|
|
130
|
+
const { width, height } = this._originalBounds;
|
|
131
|
+
// Get the overlay container's position to account for its offset from the viewport
|
|
132
|
+
const containerBounds = this.$.overlay.getBoundingClientRect();
|
|
133
|
+
// Calculate bounds so the dialog's visual edges stay within the viewport
|
|
134
|
+
const minLeft = -containerBounds.left;
|
|
135
|
+
const maxLeft = window.innerWidth - containerBounds.left - width;
|
|
136
|
+
const minTop = -containerBounds.top;
|
|
137
|
+
const maxTop = window.innerHeight - containerBounds.top - height;
|
|
138
|
+
left = Math.max(minLeft, Math.min(left, maxLeft));
|
|
139
|
+
top = Math.max(minTop, Math.min(top, maxTop));
|
|
140
|
+
}
|
|
141
|
+
|
|
115
142
|
this.top = top;
|
|
116
143
|
this.left = left;
|
|
117
144
|
}
|
package/src/vaadin-dialog.js
CHANGED
|
@@ -156,7 +156,7 @@ class Dialog extends DialogSizeMixin(
|
|
|
156
156
|
.withBackdrop="${!this.modeless}"
|
|
157
157
|
?resizable="${this.resizable}"
|
|
158
158
|
restore-focus-on-close
|
|
159
|
-
focus-trap
|
|
159
|
+
?focus-trap="${!this.noFocusTrap}"
|
|
160
160
|
exportparts="backdrop, overlay, header, title, header-content, content, footer"
|
|
161
161
|
>
|
|
162
162
|
<slot name="title" slot="title"></slot>
|
package/web-types.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.1.0-
|
|
4
|
+
"version": "25.1.0-alpha4",
|
|
5
5
|
"description-markup": "markdown",
|
|
6
6
|
"contributions": {
|
|
7
7
|
"html": {
|
|
@@ -46,6 +46,15 @@
|
|
|
46
46
|
]
|
|
47
47
|
}
|
|
48
48
|
},
|
|
49
|
+
{
|
|
50
|
+
"name": "no-focus-trap",
|
|
51
|
+
"description": "Set to true to disable focus trapping.",
|
|
52
|
+
"value": {
|
|
53
|
+
"type": [
|
|
54
|
+
"boolean"
|
|
55
|
+
]
|
|
56
|
+
}
|
|
57
|
+
},
|
|
49
58
|
{
|
|
50
59
|
"name": "top",
|
|
51
60
|
"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.",
|
|
@@ -88,6 +97,15 @@
|
|
|
88
97
|
]
|
|
89
98
|
}
|
|
90
99
|
},
|
|
100
|
+
{
|
|
101
|
+
"name": "keep-in-viewport",
|
|
102
|
+
"description": "Set to true to prevent dragging the dialog outside the viewport bounds.\nWhen enabled, all four edges of the dialog will remain visible during dragging.\nThe dialog may still become partially hidden when the viewport is resized.",
|
|
103
|
+
"value": {
|
|
104
|
+
"type": [
|
|
105
|
+
"boolean"
|
|
106
|
+
]
|
|
107
|
+
}
|
|
108
|
+
},
|
|
91
109
|
{
|
|
92
110
|
"name": "header-title",
|
|
93
111
|
"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.",
|
|
@@ -180,6 +198,15 @@
|
|
|
180
198
|
]
|
|
181
199
|
}
|
|
182
200
|
},
|
|
201
|
+
{
|
|
202
|
+
"name": "noFocusTrap",
|
|
203
|
+
"description": "Set to true to disable focus trapping.",
|
|
204
|
+
"value": {
|
|
205
|
+
"type": [
|
|
206
|
+
"boolean"
|
|
207
|
+
]
|
|
208
|
+
}
|
|
209
|
+
},
|
|
183
210
|
{
|
|
184
211
|
"name": "top",
|
|
185
212
|
"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.",
|
|
@@ -222,6 +249,15 @@
|
|
|
222
249
|
]
|
|
223
250
|
}
|
|
224
251
|
},
|
|
252
|
+
{
|
|
253
|
+
"name": "keepInViewport",
|
|
254
|
+
"description": "Set to true to prevent dragging the dialog outside the viewport bounds.\nWhen enabled, all four edges of the dialog will remain visible during dragging.\nThe dialog may still become partially hidden when the viewport is resized.",
|
|
255
|
+
"value": {
|
|
256
|
+
"type": [
|
|
257
|
+
"boolean"
|
|
258
|
+
]
|
|
259
|
+
}
|
|
260
|
+
},
|
|
225
261
|
{
|
|
226
262
|
"name": "renderer",
|
|
227
263
|
"description": "Custom function for rendering the content of the dialog.\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.",
|
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.1.0-
|
|
4
|
+
"version": "25.1.0-alpha4",
|
|
5
5
|
"description-markup": "markdown",
|
|
6
6
|
"framework": "lit",
|
|
7
7
|
"framework-config": {
|
|
@@ -47,6 +47,13 @@
|
|
|
47
47
|
"kind": "expression"
|
|
48
48
|
}
|
|
49
49
|
},
|
|
50
|
+
{
|
|
51
|
+
"name": "?noFocusTrap",
|
|
52
|
+
"description": "Set to true to disable focus trapping.",
|
|
53
|
+
"value": {
|
|
54
|
+
"kind": "expression"
|
|
55
|
+
}
|
|
56
|
+
},
|
|
50
57
|
{
|
|
51
58
|
"name": "?draggable",
|
|
52
59
|
"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.",
|
|
@@ -54,6 +61,13 @@
|
|
|
54
61
|
"kind": "expression"
|
|
55
62
|
}
|
|
56
63
|
},
|
|
64
|
+
{
|
|
65
|
+
"name": "?keepInViewport",
|
|
66
|
+
"description": "Set to true to prevent dragging the dialog outside the viewport bounds.\nWhen enabled, all four edges of the dialog will remain visible during dragging.\nThe dialog may still become partially hidden when the viewport is resized.",
|
|
67
|
+
"value": {
|
|
68
|
+
"kind": "expression"
|
|
69
|
+
}
|
|
70
|
+
},
|
|
57
71
|
{
|
|
58
72
|
"name": "?resizable",
|
|
59
73
|
"description": "Set to true to enable resizing the dialog by dragging the corners and edges.",
|