@vaadin/dialog 25.2.0-alpha9 → 25.2.0-beta2
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/custom-elements.json +37 -1
- package/package.json +12 -12
- package/src/styles/vaadin-dialog-overlay-base-styles.js +34 -0
- package/src/vaadin-dialog-base-mixin.js +0 -9
- package/src/vaadin-dialog-draggable-mixin.js +0 -16
- package/src/vaadin-dialog-overflow-controller.d.ts +29 -0
- package/src/vaadin-dialog-overflow-controller.js +89 -0
- package/src/vaadin-dialog-overlay-mixin.js +11 -41
- package/src/vaadin-dialog-overlay.js +0 -3
- package/src/vaadin-dialog-renderer-mixin.js +0 -3
- package/src/vaadin-dialog-resizable-mixin.js +0 -15
- package/src/vaadin-dialog-size-mixin.js +0 -3
- package/src/vaadin-dialog.d.ts +18 -16
- package/src/vaadin-dialog.js +18 -23
- package/web-types.json +30 -86
- package/web-types.lit.json +30 -30
package/custom-elements.json
CHANGED
|
@@ -281,6 +281,42 @@
|
|
|
281
281
|
}
|
|
282
282
|
]
|
|
283
283
|
},
|
|
284
|
+
{
|
|
285
|
+
"kind": "javascript-module",
|
|
286
|
+
"path": "src/vaadin-dialog-overflow-controller.js",
|
|
287
|
+
"declarations": [
|
|
288
|
+
{
|
|
289
|
+
"kind": "class",
|
|
290
|
+
"description": "A controller that detects if the content part of a dialog overlay overflows\nits scrolling viewport vertically, and sets the `overflow` attribute on the\noverlay (and its owner) with `top`, `bottom`, or `top bottom` accordingly, so\nthat overflow indicators can be styled in CSS.",
|
|
291
|
+
"name": "DialogOverflowController",
|
|
292
|
+
"members": [
|
|
293
|
+
{
|
|
294
|
+
"kind": "field",
|
|
295
|
+
"name": "host",
|
|
296
|
+
"description": "The overlay element that hosts the controller.",
|
|
297
|
+
"type": {
|
|
298
|
+
"text": "HTMLElement"
|
|
299
|
+
},
|
|
300
|
+
"default": "host"
|
|
301
|
+
},
|
|
302
|
+
{
|
|
303
|
+
"kind": "method",
|
|
304
|
+
"name": "hostConnected"
|
|
305
|
+
}
|
|
306
|
+
]
|
|
307
|
+
}
|
|
308
|
+
],
|
|
309
|
+
"exports": [
|
|
310
|
+
{
|
|
311
|
+
"kind": "js",
|
|
312
|
+
"name": "DialogOverflowController",
|
|
313
|
+
"declaration": {
|
|
314
|
+
"name": "DialogOverflowController",
|
|
315
|
+
"module": "src/vaadin-dialog-overflow-controller.js"
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
]
|
|
319
|
+
},
|
|
284
320
|
{
|
|
285
321
|
"kind": "javascript-module",
|
|
286
322
|
"path": "src/vaadin-dialog-overlay-mixin.js",
|
|
@@ -946,7 +982,7 @@
|
|
|
946
982
|
"declarations": [
|
|
947
983
|
{
|
|
948
984
|
"kind": "class",
|
|
949
|
-
"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\nThe following custom CSS properties are available for styling:\n\nCustom CSS property
|
|
985
|
+
"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\nThe following custom CSS properties are available for styling:\n\nCustom CSS property |\n:--------------------------------------------|\n|`--vaadin-dialog-background` |\n|`--vaadin-dialog-border-color` |\n|`--vaadin-dialog-border-radius` |\n|`--vaadin-dialog-border-width` |\n|`--vaadin-dialog-max-width` |\n|`--vaadin-dialog-min-width` |\n|`--vaadin-dialog-overflow-indicator-color` |\n|`--vaadin-dialog-overflow-indicator-height` |\n|`--vaadin-dialog-padding` |\n|`--vaadin-dialog-shadow` |\n|`--vaadin-dialog-text-color` |\n|`--vaadin-dialog-title-color` |\n|`--vaadin-dialog-title-font-size` |\n|`--vaadin-dialog-title-font-weight` |\n|`--vaadin-dialog-title-line-height` |\n|`--vaadin-overlay-backdrop-background` |\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.",
|
|
950
986
|
"name": "Dialog",
|
|
951
987
|
"members": [
|
|
952
988
|
{
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vaadin/dialog",
|
|
3
|
-
"version": "25.2.0-
|
|
3
|
+
"version": "25.2.0-beta2",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -37,25 +37,25 @@
|
|
|
37
37
|
],
|
|
38
38
|
"dependencies": {
|
|
39
39
|
"@open-wc/dedupe-mixin": "^1.3.0",
|
|
40
|
-
"@vaadin/component-base": "25.2.0-
|
|
41
|
-
"@vaadin/lit-renderer": "25.2.0-
|
|
42
|
-
"@vaadin/overlay": "25.2.0-
|
|
43
|
-
"@vaadin/vaadin-themable-mixin": "25.2.0-
|
|
40
|
+
"@vaadin/component-base": "25.2.0-beta2",
|
|
41
|
+
"@vaadin/lit-renderer": "25.2.0-beta2",
|
|
42
|
+
"@vaadin/overlay": "25.2.0-beta2",
|
|
43
|
+
"@vaadin/vaadin-themable-mixin": "25.2.0-beta2",
|
|
44
44
|
"lit": "^3.0.0"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
|
-
"@vaadin/a11y-base": "25.2.0-
|
|
48
|
-
"@vaadin/aura": "25.2.0-
|
|
49
|
-
"@vaadin/chai-plugins": "25.2.0-
|
|
50
|
-
"@vaadin/test-runner-commands": "25.2.0-
|
|
47
|
+
"@vaadin/a11y-base": "25.2.0-beta2",
|
|
48
|
+
"@vaadin/aura": "25.2.0-beta2",
|
|
49
|
+
"@vaadin/chai-plugins": "25.2.0-beta2",
|
|
50
|
+
"@vaadin/test-runner-commands": "25.2.0-beta2",
|
|
51
51
|
"@vaadin/testing-helpers": "^2.0.0",
|
|
52
|
-
"@vaadin/vaadin-lumo-styles": "25.2.0-
|
|
53
|
-
"sinon": "^
|
|
52
|
+
"@vaadin/vaadin-lumo-styles": "25.2.0-beta2",
|
|
53
|
+
"sinon": "^22.0.0"
|
|
54
54
|
},
|
|
55
55
|
"customElements": "custom-elements.json",
|
|
56
56
|
"web-types": [
|
|
57
57
|
"web-types.json",
|
|
58
58
|
"web-types.lit.json"
|
|
59
59
|
],
|
|
60
|
-
"gitHead": "
|
|
60
|
+
"gitHead": "9e18feb8057baf278b72fec4e42657b19e48f499"
|
|
61
61
|
}
|
|
@@ -22,6 +22,8 @@ export const dialogOverlayBase = css`
|
|
|
22
22
|
|
|
23
23
|
:host {
|
|
24
24
|
cursor: default;
|
|
25
|
+
--_overflow-indicator-height: var(--vaadin-dialog-overflow-indicator-height, 1px);
|
|
26
|
+
--_overflow-indicator-color: var(--vaadin-dialog-overflow-indicator-color, var(--vaadin-border-color-secondary));
|
|
25
27
|
}
|
|
26
28
|
|
|
27
29
|
[part='overlay']:focus-visible {
|
|
@@ -114,6 +116,38 @@ export const dialogOverlayBase = css`
|
|
|
114
116
|
:host(:not([has-footer])) [part='footer'] {
|
|
115
117
|
display: none !important;
|
|
116
118
|
}
|
|
119
|
+
|
|
120
|
+
[part='header'],
|
|
121
|
+
[part='footer'] {
|
|
122
|
+
position: relative;
|
|
123
|
+
|
|
124
|
+
&::after {
|
|
125
|
+
content: '';
|
|
126
|
+
opacity: 0;
|
|
127
|
+
position: absolute;
|
|
128
|
+
pointer-events: none;
|
|
129
|
+
height: var(--_overflow-indicator-height);
|
|
130
|
+
top: 100%;
|
|
131
|
+
inset-inline: 0;
|
|
132
|
+
background: linear-gradient(
|
|
133
|
+
var(--_overflow-indicator-dir, to bottom),
|
|
134
|
+
var(--_overflow-indicator-color),
|
|
135
|
+
var(--_overflow-indicator-color) 1px,
|
|
136
|
+
transparent
|
|
137
|
+
);
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
[part='footer']::after {
|
|
142
|
+
top: auto;
|
|
143
|
+
bottom: 100%;
|
|
144
|
+
--_overflow-indicator-dir: to top;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
:host([overflow~='top']) [part='header']::after,
|
|
148
|
+
:host([overflow~='bottom']) [part='footer']::after {
|
|
149
|
+
opacity: 1;
|
|
150
|
+
}
|
|
117
151
|
`;
|
|
118
152
|
|
|
119
153
|
const dialogResizableOverlay = css`
|
|
@@ -4,9 +4,6 @@
|
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
/**
|
|
8
|
-
* @polymerMixin
|
|
9
|
-
*/
|
|
10
7
|
export const DialogBaseMixin = (superClass) =>
|
|
11
8
|
class DialogBaseMixin extends superClass {
|
|
12
9
|
static get properties() {
|
|
@@ -216,10 +213,4 @@ export const DialogBaseMixin = (superClass) =>
|
|
|
216
213
|
__sizeChanged(width, height) {
|
|
217
214
|
requestAnimationFrame(() => this.$.overlay.setBounds({ width, height }, false));
|
|
218
215
|
}
|
|
219
|
-
|
|
220
|
-
/**
|
|
221
|
-
* Fired when the dialog is closed.
|
|
222
|
-
*
|
|
223
|
-
* @event closed
|
|
224
|
-
*/
|
|
225
216
|
};
|
|
@@ -6,9 +6,6 @@
|
|
|
6
6
|
import { isTouch } from '@vaadin/component-base/src/browser-utils.js';
|
|
7
7
|
import { eventInWindow, getMouseOrFirstTouchEvent } from './vaadin-dialog-utils.js';
|
|
8
8
|
|
|
9
|
-
/**
|
|
10
|
-
* @polymerMixin
|
|
11
|
-
*/
|
|
12
9
|
export const DialogDraggableMixin = (superClass) =>
|
|
13
10
|
class VaadinDialogDraggableMixin extends superClass {
|
|
14
11
|
static get properties() {
|
|
@@ -22,7 +19,6 @@ export const DialogDraggableMixin = (superClass) =>
|
|
|
22
19
|
* If you want a child element to be draggable
|
|
23
20
|
* but still have its children non-draggable (by default), mark it with
|
|
24
21
|
* "`draggable-leaf-only`" class name.
|
|
25
|
-
*
|
|
26
22
|
*/
|
|
27
23
|
draggable: {
|
|
28
24
|
type: Boolean,
|
|
@@ -139,16 +135,4 @@ export const DialogDraggableMixin = (superClass) =>
|
|
|
139
135
|
window.removeEventListener('mousemove', this._drag);
|
|
140
136
|
window.removeEventListener('touchmove', this._drag);
|
|
141
137
|
}
|
|
142
|
-
|
|
143
|
-
/**
|
|
144
|
-
* Fired when the dialog drag is started.
|
|
145
|
-
*
|
|
146
|
-
* @event drag-start
|
|
147
|
-
*/
|
|
148
|
-
|
|
149
|
-
/**
|
|
150
|
-
* Fired when the dialog drag is finished.
|
|
151
|
-
*
|
|
152
|
-
* @event dragged
|
|
153
|
-
*/
|
|
154
138
|
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright (c) 2017 - 2026 Vaadin Ltd.
|
|
4
|
+
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
|
+
*/
|
|
6
|
+
import type { ReactiveController } from 'lit';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* A controller that detects if the content part of a dialog overlay overflows
|
|
10
|
+
* its scrolling viewport vertically, and sets the `overflow` attribute on the
|
|
11
|
+
* overlay (and its owner) with `top`, `bottom`, or `top bottom` accordingly, so
|
|
12
|
+
* that overflow indicators can be styled in CSS.
|
|
13
|
+
*/
|
|
14
|
+
export class DialogOverflowController implements ReactiveController {
|
|
15
|
+
/**
|
|
16
|
+
* The overlay element that hosts the controller.
|
|
17
|
+
*/
|
|
18
|
+
host: HTMLElement;
|
|
19
|
+
|
|
20
|
+
constructor(host: HTMLElement);
|
|
21
|
+
|
|
22
|
+
hostConnected(): void;
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Forces a synchronous overflow update. Call after changing content that
|
|
26
|
+
* affects whether the content part overflows.
|
|
27
|
+
*/
|
|
28
|
+
update(): void;
|
|
29
|
+
}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright (c) 2017 - 2026 Vaadin Ltd.
|
|
4
|
+
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
|
+
*/
|
|
6
|
+
import { setOverlayStateAttribute } from '@vaadin/overlay/src/vaadin-overlay-utils.js';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* A controller that detects if the content part of a dialog overlay overflows
|
|
10
|
+
* its scrolling viewport vertically, and sets the `overflow` attribute on the
|
|
11
|
+
* overlay (and its owner) with `top`, `bottom`, or `top bottom` accordingly, so
|
|
12
|
+
* that overflow indicators can be styled in CSS.
|
|
13
|
+
*/
|
|
14
|
+
export class DialogOverflowController {
|
|
15
|
+
constructor(host) {
|
|
16
|
+
/**
|
|
17
|
+
* The overlay element that hosts the controller.
|
|
18
|
+
* @type {HTMLElement}
|
|
19
|
+
*/
|
|
20
|
+
this.host = host;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
hostConnected() {
|
|
24
|
+
if (!this.__initialized) {
|
|
25
|
+
this.__initialized = true;
|
|
26
|
+
|
|
27
|
+
const { host } = this;
|
|
28
|
+
|
|
29
|
+
// Update overflow attribute on resize
|
|
30
|
+
this.__resizeObserver = new ResizeObserver(() => this.__updateState());
|
|
31
|
+
this.__resizeObserver.observe(host.$.resizerContainer);
|
|
32
|
+
|
|
33
|
+
// Update overflow attribute on scroll
|
|
34
|
+
host.$.content.addEventListener('scroll', () => this.__updateState(true));
|
|
35
|
+
|
|
36
|
+
// Update overflow attribute on content change
|
|
37
|
+
host.shadowRoot.addEventListener('slotchange', () => this.__updateState(true));
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Forces a synchronous overflow update. Call after changing content that
|
|
43
|
+
* affects whether the content part overflows.
|
|
44
|
+
*/
|
|
45
|
+
update() {
|
|
46
|
+
this.__updateState(true);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/** @private */
|
|
50
|
+
__updateState(sync = false) {
|
|
51
|
+
cancelAnimationFrame(this.__updateRaf);
|
|
52
|
+
|
|
53
|
+
if (sync) {
|
|
54
|
+
this.__writeState(this.__readState());
|
|
55
|
+
} else {
|
|
56
|
+
// Defer reading until the animation frame so that layout has settled
|
|
57
|
+
// after a resize (some browsers report stale metrics synchronously).
|
|
58
|
+
this.__updateRaf = requestAnimationFrame(() => this.__writeState(this.__readState()));
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/** @private */
|
|
63
|
+
__readState() {
|
|
64
|
+
const content = this.host.$.content;
|
|
65
|
+
|
|
66
|
+
let overflow = '';
|
|
67
|
+
|
|
68
|
+
if (content.scrollTop > 0) {
|
|
69
|
+
overflow += ' top';
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
if (content.scrollTop < content.scrollHeight - content.clientHeight) {
|
|
73
|
+
overflow += ' bottom';
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
return overflow.trim();
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/** @private */
|
|
80
|
+
__writeState(value) {
|
|
81
|
+
const { host } = this;
|
|
82
|
+
|
|
83
|
+
if (value.length > 0) {
|
|
84
|
+
setOverlayStateAttribute(host, 'overflow', value);
|
|
85
|
+
} else {
|
|
86
|
+
setOverlayStateAttribute(host, 'overflow', null);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
@@ -6,11 +6,8 @@
|
|
|
6
6
|
import { SlotObserver } from '@vaadin/component-base/src/slot-observer.js';
|
|
7
7
|
import { OverlayMixin } from '@vaadin/overlay/src/vaadin-overlay-mixin.js';
|
|
8
8
|
import { setOverlayStateAttribute } from '@vaadin/overlay/src/vaadin-overlay-utils.js';
|
|
9
|
+
import { DialogOverflowController } from './vaadin-dialog-overflow-controller.js';
|
|
9
10
|
|
|
10
|
-
/**
|
|
11
|
-
* @polymerMixin
|
|
12
|
-
* @mixes OverlayMixin
|
|
13
|
-
*/
|
|
14
11
|
export const DialogOverlayMixin = (superClass) =>
|
|
15
12
|
class DialogOverlayMixin extends OverlayMixin(superClass) {
|
|
16
13
|
static get properties() {
|
|
@@ -82,36 +79,29 @@ export const DialogOverlayMixin = (superClass) =>
|
|
|
82
79
|
ready() {
|
|
83
80
|
super.ready();
|
|
84
81
|
|
|
85
|
-
//
|
|
82
|
+
// Detect overflow of the content part and toggle the `overflow` attribute
|
|
83
|
+
this.__overflowController = new DialogOverflowController(this);
|
|
84
|
+
this.addController(this.__overflowController);
|
|
85
|
+
|
|
86
|
+
// Adjust the position on resize to keep the overlay within the viewport
|
|
86
87
|
this.__resizeObserver = new ResizeObserver(() => {
|
|
87
88
|
requestAnimationFrame(() => {
|
|
88
89
|
this.__adjustPosition();
|
|
89
|
-
this.__updateOverflow();
|
|
90
90
|
});
|
|
91
91
|
});
|
|
92
92
|
this.__resizeObserver.observe(this.$.resizerContainer);
|
|
93
93
|
|
|
94
|
-
// Update overflow attribute on scroll
|
|
95
|
-
this.$.content.addEventListener('scroll', () => {
|
|
96
|
-
this.__updateOverflow();
|
|
97
|
-
});
|
|
98
|
-
|
|
99
|
-
// Update overflow attribute on content change
|
|
100
|
-
this.shadowRoot.addEventListener('slotchange', () => {
|
|
101
|
-
this.__updateOverflow();
|
|
102
|
-
});
|
|
103
|
-
|
|
104
94
|
// Observe header-content and footer slots for dynamic content
|
|
105
95
|
const headerSlot = this.shadowRoot.querySelector('slot[name="header-content"]');
|
|
106
96
|
this.__headerSlotObserver = new SlotObserver(headerSlot, ({ currentNodes }) => {
|
|
107
97
|
setOverlayStateAttribute(this, 'has-header', currentNodes.length > 0);
|
|
108
|
-
this.
|
|
98
|
+
this.__overflowController.update();
|
|
109
99
|
});
|
|
110
100
|
|
|
111
101
|
const footerSlot = this.shadowRoot.querySelector('slot[name="footer"]');
|
|
112
102
|
this.__footerSlotObserver = new SlotObserver(footerSlot, ({ currentNodes }) => {
|
|
113
103
|
setOverlayStateAttribute(this, 'has-footer', currentNodes.length > 0);
|
|
114
|
-
this.
|
|
104
|
+
this.__overflowController.update();
|
|
115
105
|
});
|
|
116
106
|
|
|
117
107
|
this.__handleWindowResize = this.__handleWindowResize.bind(this);
|
|
@@ -239,7 +229,9 @@ export const DialogOverlayMixin = (superClass) =>
|
|
|
239
229
|
|
|
240
230
|
this._headerTitleRenderer();
|
|
241
231
|
|
|
242
|
-
|
|
232
|
+
// May run via observers before the controller is set up in `ready()`;
|
|
233
|
+
// the initial overflow state is then detected by the resize observer.
|
|
234
|
+
this.__overflowController?.update();
|
|
243
235
|
}
|
|
244
236
|
|
|
245
237
|
/**
|
|
@@ -265,28 +257,6 @@ export const DialogOverlayMixin = (superClass) =>
|
|
|
265
257
|
this.__adjustPosition();
|
|
266
258
|
}
|
|
267
259
|
|
|
268
|
-
/** @private */
|
|
269
|
-
__updateOverflow() {
|
|
270
|
-
let overflow = '';
|
|
271
|
-
|
|
272
|
-
const content = this.$.content;
|
|
273
|
-
|
|
274
|
-
if (content.scrollTop > 0) {
|
|
275
|
-
overflow += ' top';
|
|
276
|
-
}
|
|
277
|
-
|
|
278
|
-
if (content.scrollTop < content.scrollHeight - content.clientHeight) {
|
|
279
|
-
overflow += ' bottom';
|
|
280
|
-
}
|
|
281
|
-
|
|
282
|
-
const value = overflow.trim();
|
|
283
|
-
if (value.length > 0 && this.getAttribute('overflow') !== value) {
|
|
284
|
-
setOverlayStateAttribute(this, 'overflow', value);
|
|
285
|
-
} else if (value.length === 0 && this.hasAttribute('overflow')) {
|
|
286
|
-
setOverlayStateAttribute(this, 'overflow', null);
|
|
287
|
-
}
|
|
288
|
-
}
|
|
289
|
-
|
|
290
260
|
/** @private */
|
|
291
261
|
__handleWindowResize() {
|
|
292
262
|
this.__adjustPosition();
|
|
@@ -17,9 +17,6 @@ import { DialogOverlayMixin } from './vaadin-dialog-overlay-mixin.js';
|
|
|
17
17
|
*
|
|
18
18
|
* @customElement vaadin-dialog-overlay
|
|
19
19
|
* @extends HTMLElement
|
|
20
|
-
* @mixes DialogOverlayMixin
|
|
21
|
-
* @mixes DirMixin
|
|
22
|
-
* @mixes ThemableMixin
|
|
23
20
|
* @private
|
|
24
21
|
*/
|
|
25
22
|
export class DialogOverlay extends DialogOverlayMixin(
|
|
@@ -4,9 +4,6 @@
|
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
/**
|
|
8
|
-
* @polymerMixin
|
|
9
|
-
*/
|
|
10
7
|
export const DialogRendererMixin = (superClass) =>
|
|
11
8
|
class DialogRendererMixin extends superClass {
|
|
12
9
|
static get properties() {
|
|
@@ -4,9 +4,6 @@
|
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
6
|
import { eventInWindow, getMouseOrFirstTouchEvent } from './vaadin-dialog-utils.js';
|
|
7
|
-
/**
|
|
8
|
-
* @polymerMixin
|
|
9
|
-
*/
|
|
10
7
|
export const DialogResizableMixin = (superClass) =>
|
|
11
8
|
class VaadinDialogResizableMixin extends superClass {
|
|
12
9
|
static get properties() {
|
|
@@ -149,16 +146,4 @@ export const DialogResizableMixin = (superClass) =>
|
|
|
149
146
|
const { width, height, top, left } = getComputedStyle(this.$.overlay.$.overlay);
|
|
150
147
|
return { width, height, top, left };
|
|
151
148
|
}
|
|
152
|
-
|
|
153
|
-
/**
|
|
154
|
-
* Fired when the dialog resize is started.
|
|
155
|
-
*
|
|
156
|
-
* @event resize-start
|
|
157
|
-
*/
|
|
158
|
-
|
|
159
|
-
/**
|
|
160
|
-
* Fired when the dialog resize is finished.
|
|
161
|
-
*
|
|
162
|
-
* @event resize
|
|
163
|
-
*/
|
|
164
149
|
};
|
|
@@ -4,9 +4,6 @@
|
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
/**
|
|
8
|
-
* @polymerMixin
|
|
9
|
-
*/
|
|
10
7
|
export const DialogSizeMixin = (superClass) =>
|
|
11
8
|
class DialogSizeMixinClass extends superClass {
|
|
12
9
|
static get properties() {
|
package/src/vaadin-dialog.d.ts
CHANGED
|
@@ -127,22 +127,24 @@ export type DialogEventMap = DialogCustomEventMap & HTMLElementEventMap;
|
|
|
127
127
|
*
|
|
128
128
|
* The following custom CSS properties are available for styling:
|
|
129
129
|
*
|
|
130
|
-
* Custom CSS property
|
|
131
|
-
*
|
|
132
|
-
* |`--vaadin-dialog-background`
|
|
133
|
-
* |`--vaadin-dialog-border-color`
|
|
134
|
-
* |`--vaadin-dialog-border-radius`
|
|
135
|
-
* |`--vaadin-dialog-border-width`
|
|
136
|
-
* |`--vaadin-dialog-max-width`
|
|
137
|
-
* |`--vaadin-dialog-min-width`
|
|
138
|
-
* |`--vaadin-dialog-
|
|
139
|
-
* |`--vaadin-dialog-
|
|
140
|
-
* |`--vaadin-dialog-
|
|
141
|
-
* |`--vaadin-dialog-
|
|
142
|
-
* |`--vaadin-dialog-
|
|
143
|
-
* |`--vaadin-dialog-title-
|
|
144
|
-
* |`--vaadin-dialog-title-
|
|
145
|
-
* |`--vaadin-
|
|
130
|
+
* Custom CSS property |
|
|
131
|
+
* :--------------------------------------------|
|
|
132
|
+
* |`--vaadin-dialog-background` |
|
|
133
|
+
* |`--vaadin-dialog-border-color` |
|
|
134
|
+
* |`--vaadin-dialog-border-radius` |
|
|
135
|
+
* |`--vaadin-dialog-border-width` |
|
|
136
|
+
* |`--vaadin-dialog-max-width` |
|
|
137
|
+
* |`--vaadin-dialog-min-width` |
|
|
138
|
+
* |`--vaadin-dialog-overflow-indicator-color` |
|
|
139
|
+
* |`--vaadin-dialog-overflow-indicator-height` |
|
|
140
|
+
* |`--vaadin-dialog-padding` |
|
|
141
|
+
* |`--vaadin-dialog-shadow` |
|
|
142
|
+
* |`--vaadin-dialog-text-color` |
|
|
143
|
+
* |`--vaadin-dialog-title-color` |
|
|
144
|
+
* |`--vaadin-dialog-title-font-size` |
|
|
145
|
+
* |`--vaadin-dialog-title-font-weight` |
|
|
146
|
+
* |`--vaadin-dialog-title-line-height` |
|
|
147
|
+
* |`--vaadin-overlay-backdrop-background` |
|
|
146
148
|
*
|
|
147
149
|
* See [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.
|
|
148
150
|
*
|
package/src/vaadin-dialog.js
CHANGED
|
@@ -70,22 +70,24 @@ export { DialogOverlay } from './vaadin-dialog-overlay.js';
|
|
|
70
70
|
*
|
|
71
71
|
* The following custom CSS properties are available for styling:
|
|
72
72
|
*
|
|
73
|
-
* Custom CSS property
|
|
74
|
-
*
|
|
75
|
-
* |`--vaadin-dialog-background`
|
|
76
|
-
* |`--vaadin-dialog-border-color`
|
|
77
|
-
* |`--vaadin-dialog-border-radius`
|
|
78
|
-
* |`--vaadin-dialog-border-width`
|
|
79
|
-
* |`--vaadin-dialog-max-width`
|
|
80
|
-
* |`--vaadin-dialog-min-width`
|
|
81
|
-
* |`--vaadin-dialog-
|
|
82
|
-
* |`--vaadin-dialog-
|
|
83
|
-
* |`--vaadin-dialog-
|
|
84
|
-
* |`--vaadin-dialog-
|
|
85
|
-
* |`--vaadin-dialog-
|
|
86
|
-
* |`--vaadin-dialog-title-
|
|
87
|
-
* |`--vaadin-dialog-title-
|
|
88
|
-
* |`--vaadin-
|
|
73
|
+
* Custom CSS property |
|
|
74
|
+
* :--------------------------------------------|
|
|
75
|
+
* |`--vaadin-dialog-background` |
|
|
76
|
+
* |`--vaadin-dialog-border-color` |
|
|
77
|
+
* |`--vaadin-dialog-border-radius` |
|
|
78
|
+
* |`--vaadin-dialog-border-width` |
|
|
79
|
+
* |`--vaadin-dialog-max-width` |
|
|
80
|
+
* |`--vaadin-dialog-min-width` |
|
|
81
|
+
* |`--vaadin-dialog-overflow-indicator-color` |
|
|
82
|
+
* |`--vaadin-dialog-overflow-indicator-height` |
|
|
83
|
+
* |`--vaadin-dialog-padding` |
|
|
84
|
+
* |`--vaadin-dialog-shadow` |
|
|
85
|
+
* |`--vaadin-dialog-text-color` |
|
|
86
|
+
* |`--vaadin-dialog-title-color` |
|
|
87
|
+
* |`--vaadin-dialog-title-font-size` |
|
|
88
|
+
* |`--vaadin-dialog-title-font-weight` |
|
|
89
|
+
* |`--vaadin-dialog-title-line-height` |
|
|
90
|
+
* |`--vaadin-overlay-backdrop-background` |
|
|
89
91
|
*
|
|
90
92
|
* See [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.
|
|
91
93
|
*
|
|
@@ -98,13 +100,6 @@ export { DialogOverlay } from './vaadin-dialog-overlay.js';
|
|
|
98
100
|
*
|
|
99
101
|
* @customElement vaadin-dialog
|
|
100
102
|
* @extends HTMLElement
|
|
101
|
-
* @mixes ThemePropertyMixin
|
|
102
|
-
* @mixes ElementMixin
|
|
103
|
-
* @mixes DialogBaseMixin
|
|
104
|
-
* @mixes DialogDraggableMixin
|
|
105
|
-
* @mixes DialogRendererMixin
|
|
106
|
-
* @mixes DialogResizableMixin
|
|
107
|
-
* @mixes DialogSizeMixin
|
|
108
103
|
*/
|
|
109
104
|
class Dialog extends DialogSizeMixin(
|
|
110
105
|
DialogDraggableMixin(
|
package/web-types.json
CHANGED
|
@@ -1,23 +1,21 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/web-types",
|
|
3
3
|
"name": "@vaadin/dialog",
|
|
4
|
-
"version": "25.2.0-
|
|
4
|
+
"version": "25.2.0-beta2",
|
|
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\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\nThe following custom CSS properties are available for styling:\n\nCustom CSS property
|
|
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\nThe following custom CSS properties are available for styling:\n\nCustom CSS property |\n:--------------------------------------------|\n|`--vaadin-dialog-background` |\n|`--vaadin-dialog-border-color` |\n|`--vaadin-dialog-border-radius` |\n|`--vaadin-dialog-border-width` |\n|`--vaadin-dialog-max-width` |\n|`--vaadin-dialog-min-width` |\n|`--vaadin-dialog-overflow-indicator-color` |\n|`--vaadin-dialog-overflow-indicator-height` |\n|`--vaadin-dialog-padding` |\n|`--vaadin-dialog-shadow` |\n|`--vaadin-dialog-text-color` |\n|`--vaadin-dialog-title-color` |\n|`--vaadin-dialog-title-font-size` |\n|`--vaadin-dialog-title-font-weight` |\n|`--vaadin-dialog-title-line-height` |\n|`--vaadin-overlay-backdrop-background` |\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.",
|
|
12
12
|
"attributes": [
|
|
13
13
|
{
|
|
14
14
|
"name": "draggable",
|
|
15
15
|
"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.",
|
|
16
16
|
"value": {
|
|
17
17
|
"type": [
|
|
18
|
-
"boolean"
|
|
19
|
-
"null",
|
|
20
|
-
"undefined"
|
|
18
|
+
"boolean"
|
|
21
19
|
]
|
|
22
20
|
}
|
|
23
21
|
},
|
|
@@ -26,9 +24,7 @@
|
|
|
26
24
|
"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.",
|
|
27
25
|
"value": {
|
|
28
26
|
"type": [
|
|
29
|
-
"string"
|
|
30
|
-
"null",
|
|
31
|
-
"undefined"
|
|
27
|
+
"string"
|
|
32
28
|
]
|
|
33
29
|
}
|
|
34
30
|
},
|
|
@@ -37,9 +33,7 @@
|
|
|
37
33
|
"description": "Set the height of the dialog.\nIf a unitless number is provided, pixels are assumed.",
|
|
38
34
|
"value": {
|
|
39
35
|
"type": [
|
|
40
|
-
"string"
|
|
41
|
-
"null",
|
|
42
|
-
"undefined"
|
|
36
|
+
"string"
|
|
43
37
|
]
|
|
44
38
|
}
|
|
45
39
|
},
|
|
@@ -48,9 +42,7 @@
|
|
|
48
42
|
"description": "Set to true to prevent the dialog from moving outside the viewport bounds.\nWhen enabled, all four edges of the dialog will remain visible, for example\nwhen dragging the dialog or when the viewport is resized. Note that the\ndialog will also adjust any programmatically configured size and position\nso that it stays within the viewport.",
|
|
49
43
|
"value": {
|
|
50
44
|
"type": [
|
|
51
|
-
"boolean"
|
|
52
|
-
"null",
|
|
53
|
-
"undefined"
|
|
45
|
+
"boolean"
|
|
54
46
|
]
|
|
55
47
|
}
|
|
56
48
|
},
|
|
@@ -59,9 +51,7 @@
|
|
|
59
51
|
"description": "Set the distance of the dialog from the left of the viewport.\nIf a unitless number is provided, pixels are assumed.\n\nNote that the dialog uses an internal container that has some\nadditional spacing, which can be overridden by the theme.",
|
|
60
52
|
"value": {
|
|
61
53
|
"type": [
|
|
62
|
-
"string"
|
|
63
|
-
"null",
|
|
64
|
-
"undefined"
|
|
54
|
+
"string"
|
|
65
55
|
]
|
|
66
56
|
}
|
|
67
57
|
},
|
|
@@ -70,9 +60,7 @@
|
|
|
70
60
|
"description": "Set to true to remove backdrop and allow click events on background elements.",
|
|
71
61
|
"value": {
|
|
72
62
|
"type": [
|
|
73
|
-
"boolean"
|
|
74
|
-
"null",
|
|
75
|
-
"undefined"
|
|
63
|
+
"boolean"
|
|
76
64
|
]
|
|
77
65
|
}
|
|
78
66
|
},
|
|
@@ -81,9 +69,7 @@
|
|
|
81
69
|
"description": "Set to true to disable closing dialog on Escape press",
|
|
82
70
|
"value": {
|
|
83
71
|
"type": [
|
|
84
|
-
"boolean"
|
|
85
|
-
"null",
|
|
86
|
-
"undefined"
|
|
72
|
+
"boolean"
|
|
87
73
|
]
|
|
88
74
|
}
|
|
89
75
|
},
|
|
@@ -92,9 +78,7 @@
|
|
|
92
78
|
"description": "Set to true to disable closing dialog on outside click",
|
|
93
79
|
"value": {
|
|
94
80
|
"type": [
|
|
95
|
-
"boolean"
|
|
96
|
-
"null",
|
|
97
|
-
"undefined"
|
|
81
|
+
"boolean"
|
|
98
82
|
]
|
|
99
83
|
}
|
|
100
84
|
},
|
|
@@ -103,9 +87,7 @@
|
|
|
103
87
|
"description": "Set to true to disable focus trapping.",
|
|
104
88
|
"value": {
|
|
105
89
|
"type": [
|
|
106
|
-
"boolean"
|
|
107
|
-
"null",
|
|
108
|
-
"undefined"
|
|
90
|
+
"boolean"
|
|
109
91
|
]
|
|
110
92
|
}
|
|
111
93
|
},
|
|
@@ -114,9 +96,7 @@
|
|
|
114
96
|
"description": "True if the dialog is visible and available for interaction.",
|
|
115
97
|
"value": {
|
|
116
98
|
"type": [
|
|
117
|
-
"boolean"
|
|
118
|
-
"null",
|
|
119
|
-
"undefined"
|
|
99
|
+
"boolean"
|
|
120
100
|
]
|
|
121
101
|
}
|
|
122
102
|
},
|
|
@@ -125,9 +105,7 @@
|
|
|
125
105
|
"description": "The `role` attribute value to be set on the dialog. Defaults to \"dialog\".",
|
|
126
106
|
"value": {
|
|
127
107
|
"type": [
|
|
128
|
-
"string"
|
|
129
|
-
"null",
|
|
130
|
-
"undefined"
|
|
108
|
+
"string"
|
|
131
109
|
]
|
|
132
110
|
}
|
|
133
111
|
},
|
|
@@ -136,9 +114,7 @@
|
|
|
136
114
|
"description": "Set to true to enable resizing the dialog by dragging the corners and edges.",
|
|
137
115
|
"value": {
|
|
138
116
|
"type": [
|
|
139
|
-
"boolean"
|
|
140
|
-
"null",
|
|
141
|
-
"undefined"
|
|
117
|
+
"boolean"
|
|
142
118
|
]
|
|
143
119
|
}
|
|
144
120
|
},
|
|
@@ -158,9 +134,7 @@
|
|
|
158
134
|
"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.",
|
|
159
135
|
"value": {
|
|
160
136
|
"type": [
|
|
161
|
-
"string"
|
|
162
|
-
"null",
|
|
163
|
-
"undefined"
|
|
137
|
+
"string"
|
|
164
138
|
]
|
|
165
139
|
}
|
|
166
140
|
},
|
|
@@ -169,9 +143,7 @@
|
|
|
169
143
|
"description": "Set the width of the dialog.\nIf a unitless number is provided, pixels are assumed.",
|
|
170
144
|
"value": {
|
|
171
145
|
"type": [
|
|
172
|
-
"string"
|
|
173
|
-
"null",
|
|
174
|
-
"undefined"
|
|
146
|
+
"string"
|
|
175
147
|
]
|
|
176
148
|
}
|
|
177
149
|
}
|
|
@@ -183,9 +155,7 @@
|
|
|
183
155
|
"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.",
|
|
184
156
|
"value": {
|
|
185
157
|
"type": [
|
|
186
|
-
"boolean"
|
|
187
|
-
"null",
|
|
188
|
-
"undefined"
|
|
158
|
+
"boolean"
|
|
189
159
|
]
|
|
190
160
|
}
|
|
191
161
|
},
|
|
@@ -214,9 +184,7 @@
|
|
|
214
184
|
"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.",
|
|
215
185
|
"value": {
|
|
216
186
|
"type": [
|
|
217
|
-
"string"
|
|
218
|
-
"null",
|
|
219
|
-
"undefined"
|
|
187
|
+
"string"
|
|
220
188
|
]
|
|
221
189
|
}
|
|
222
190
|
},
|
|
@@ -225,9 +193,7 @@
|
|
|
225
193
|
"description": "Set the height of the dialog.\nIf a unitless number is provided, pixels are assumed.",
|
|
226
194
|
"value": {
|
|
227
195
|
"type": [
|
|
228
|
-
"string"
|
|
229
|
-
"null",
|
|
230
|
-
"undefined"
|
|
196
|
+
"string"
|
|
231
197
|
]
|
|
232
198
|
}
|
|
233
199
|
},
|
|
@@ -236,9 +202,7 @@
|
|
|
236
202
|
"description": "Set to true to prevent the dialog from moving outside the viewport bounds.\nWhen enabled, all four edges of the dialog will remain visible, for example\nwhen dragging the dialog or when the viewport is resized. Note that the\ndialog will also adjust any programmatically configured size and position\nso that it stays within the viewport.",
|
|
237
203
|
"value": {
|
|
238
204
|
"type": [
|
|
239
|
-
"boolean"
|
|
240
|
-
"null",
|
|
241
|
-
"undefined"
|
|
205
|
+
"boolean"
|
|
242
206
|
]
|
|
243
207
|
}
|
|
244
208
|
},
|
|
@@ -247,9 +211,7 @@
|
|
|
247
211
|
"description": "Set the distance of the dialog from the left of the viewport.\nIf a unitless number is provided, pixels are assumed.\n\nNote that the dialog uses an internal container that has some\nadditional spacing, which can be overridden by the theme.",
|
|
248
212
|
"value": {
|
|
249
213
|
"type": [
|
|
250
|
-
"string"
|
|
251
|
-
"null",
|
|
252
|
-
"undefined"
|
|
214
|
+
"string"
|
|
253
215
|
]
|
|
254
216
|
}
|
|
255
217
|
},
|
|
@@ -258,9 +220,7 @@
|
|
|
258
220
|
"description": "Set to true to remove backdrop and allow click events on background elements.",
|
|
259
221
|
"value": {
|
|
260
222
|
"type": [
|
|
261
|
-
"boolean"
|
|
262
|
-
"null",
|
|
263
|
-
"undefined"
|
|
223
|
+
"boolean"
|
|
264
224
|
]
|
|
265
225
|
}
|
|
266
226
|
},
|
|
@@ -269,9 +229,7 @@
|
|
|
269
229
|
"description": "Set to true to disable closing dialog on Escape press",
|
|
270
230
|
"value": {
|
|
271
231
|
"type": [
|
|
272
|
-
"boolean"
|
|
273
|
-
"null",
|
|
274
|
-
"undefined"
|
|
232
|
+
"boolean"
|
|
275
233
|
]
|
|
276
234
|
}
|
|
277
235
|
},
|
|
@@ -280,9 +238,7 @@
|
|
|
280
238
|
"description": "Set to true to disable closing dialog on outside click",
|
|
281
239
|
"value": {
|
|
282
240
|
"type": [
|
|
283
|
-
"boolean"
|
|
284
|
-
"null",
|
|
285
|
-
"undefined"
|
|
241
|
+
"boolean"
|
|
286
242
|
]
|
|
287
243
|
}
|
|
288
244
|
},
|
|
@@ -291,9 +247,7 @@
|
|
|
291
247
|
"description": "Set to true to disable focus trapping.",
|
|
292
248
|
"value": {
|
|
293
249
|
"type": [
|
|
294
|
-
"boolean"
|
|
295
|
-
"null",
|
|
296
|
-
"undefined"
|
|
250
|
+
"boolean"
|
|
297
251
|
]
|
|
298
252
|
}
|
|
299
253
|
},
|
|
@@ -302,9 +256,7 @@
|
|
|
302
256
|
"description": "True if the dialog is visible and available for interaction.",
|
|
303
257
|
"value": {
|
|
304
258
|
"type": [
|
|
305
|
-
"boolean"
|
|
306
|
-
"null",
|
|
307
|
-
"undefined"
|
|
259
|
+
"boolean"
|
|
308
260
|
]
|
|
309
261
|
}
|
|
310
262
|
},
|
|
@@ -313,9 +265,7 @@
|
|
|
313
265
|
"description": "The `role` attribute value to be set on the dialog. Defaults to \"dialog\".",
|
|
314
266
|
"value": {
|
|
315
267
|
"type": [
|
|
316
|
-
"string"
|
|
317
|
-
"null",
|
|
318
|
-
"undefined"
|
|
268
|
+
"string"
|
|
319
269
|
]
|
|
320
270
|
}
|
|
321
271
|
},
|
|
@@ -334,9 +284,7 @@
|
|
|
334
284
|
"description": "Set to true to enable resizing the dialog by dragging the corners and edges.",
|
|
335
285
|
"value": {
|
|
336
286
|
"type": [
|
|
337
|
-
"boolean"
|
|
338
|
-
"null",
|
|
339
|
-
"undefined"
|
|
287
|
+
"boolean"
|
|
340
288
|
]
|
|
341
289
|
}
|
|
342
290
|
},
|
|
@@ -345,9 +293,7 @@
|
|
|
345
293
|
"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.",
|
|
346
294
|
"value": {
|
|
347
295
|
"type": [
|
|
348
|
-
"string"
|
|
349
|
-
"null",
|
|
350
|
-
"undefined"
|
|
296
|
+
"string"
|
|
351
297
|
]
|
|
352
298
|
}
|
|
353
299
|
},
|
|
@@ -356,9 +302,7 @@
|
|
|
356
302
|
"description": "Set the width of the dialog.\nIf a unitless number is provided, pixels are assumed.",
|
|
357
303
|
"value": {
|
|
358
304
|
"type": [
|
|
359
|
-
"string"
|
|
360
|
-
"null",
|
|
361
|
-
"undefined"
|
|
305
|
+
"string"
|
|
362
306
|
]
|
|
363
307
|
}
|
|
364
308
|
}
|
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.2.0-
|
|
4
|
+
"version": "25.2.0-beta2",
|
|
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\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\nThe following custom CSS properties are available for styling:\n\nCustom CSS property
|
|
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\nThe following custom CSS properties are available for styling:\n\nCustom CSS property |\n:--------------------------------------------|\n|`--vaadin-dialog-background` |\n|`--vaadin-dialog-border-color` |\n|`--vaadin-dialog-border-radius` |\n|`--vaadin-dialog-border-width` |\n|`--vaadin-dialog-max-width` |\n|`--vaadin-dialog-min-width` |\n|`--vaadin-dialog-overflow-indicator-color` |\n|`--vaadin-dialog-overflow-indicator-height` |\n|`--vaadin-dialog-padding` |\n|`--vaadin-dialog-shadow` |\n|`--vaadin-dialog-text-color` |\n|`--vaadin-dialog-title-color` |\n|`--vaadin-dialog-title-font-size` |\n|`--vaadin-dialog-title-font-weight` |\n|`--vaadin-dialog-title-line-height` |\n|`--vaadin-overlay-backdrop-background` |\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.",
|
|
20
20
|
"extension": true,
|
|
21
21
|
"attributes": [
|
|
22
22
|
{
|
|
@@ -27,99 +27,99 @@
|
|
|
27
27
|
}
|
|
28
28
|
},
|
|
29
29
|
{
|
|
30
|
-
"name": "
|
|
31
|
-
"description": "
|
|
30
|
+
"name": ".footerRenderer",
|
|
31
|
+
"description": "Custom function for rendering the dialog footer.\nReceives two arguments:\n\n- `root` The root container DOM element. Append your content to it.\n- `dialog` The reference to the `<vaadin-dialog>` element.\n\nWhen `footerRenderer` is set, the attribute `has-footer` is set on the dialog.",
|
|
32
32
|
"value": {
|
|
33
33
|
"kind": "expression"
|
|
34
34
|
}
|
|
35
35
|
},
|
|
36
36
|
{
|
|
37
|
-
"name": "
|
|
38
|
-
"description": "
|
|
37
|
+
"name": ".headerRenderer",
|
|
38
|
+
"description": "Custom function for rendering the dialog header.\nReceives two arguments:\n\n- `root` The root container DOM element. Append your content to it.\n- `dialog` The reference to the `<vaadin-dialog>` element.\n\nIf both `headerTitle` and `headerRenderer` are defined, the title\nand the elements created by the renderer will be placed next to\neach other, with the title coming first.\n\nWhen `headerRenderer` is set, the attribute `has-header` is set on the dialog.",
|
|
39
39
|
"value": {
|
|
40
40
|
"kind": "expression"
|
|
41
41
|
}
|
|
42
42
|
},
|
|
43
43
|
{
|
|
44
|
-
"name": "
|
|
45
|
-
"description": "
|
|
44
|
+
"name": ".headerTitle",
|
|
45
|
+
"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.",
|
|
46
46
|
"value": {
|
|
47
47
|
"kind": "expression"
|
|
48
48
|
}
|
|
49
49
|
},
|
|
50
50
|
{
|
|
51
|
-
"name": "
|
|
52
|
-
"description": "Set
|
|
51
|
+
"name": ".height",
|
|
52
|
+
"description": "Set the height of the dialog.\nIf a unitless number is provided, pixels are assumed.",
|
|
53
53
|
"value": {
|
|
54
54
|
"kind": "expression"
|
|
55
55
|
}
|
|
56
56
|
},
|
|
57
57
|
{
|
|
58
|
-
"name": "?
|
|
59
|
-
"description": "Set to true to
|
|
58
|
+
"name": "?keepInViewport",
|
|
59
|
+
"description": "Set to true to prevent the dialog from moving outside the viewport bounds.\nWhen enabled, all four edges of the dialog will remain visible, for example\nwhen dragging the dialog or when the viewport is resized. Note that the\ndialog will also adjust any programmatically configured size and position\nso that it stays within the viewport.",
|
|
60
60
|
"value": {
|
|
61
61
|
"kind": "expression"
|
|
62
62
|
}
|
|
63
63
|
},
|
|
64
64
|
{
|
|
65
|
-
"name": "
|
|
66
|
-
"description": "
|
|
65
|
+
"name": ".left",
|
|
66
|
+
"description": "Set the distance of the dialog from the left of the viewport.\nIf a unitless number is provided, pixels are assumed.\n\nNote that the dialog uses an internal container that has some\nadditional spacing, which can be overridden by the theme.",
|
|
67
67
|
"value": {
|
|
68
68
|
"kind": "expression"
|
|
69
69
|
}
|
|
70
70
|
},
|
|
71
71
|
{
|
|
72
|
-
"name": "?
|
|
73
|
-
"description": "Set to true to
|
|
72
|
+
"name": "?modeless",
|
|
73
|
+
"description": "Set to true to remove backdrop and allow click events on background elements.",
|
|
74
74
|
"value": {
|
|
75
75
|
"kind": "expression"
|
|
76
76
|
}
|
|
77
77
|
},
|
|
78
78
|
{
|
|
79
|
-
"name": "
|
|
80
|
-
"description": "
|
|
79
|
+
"name": "?noCloseOnEsc",
|
|
80
|
+
"description": "Set to true to disable closing dialog on Escape press",
|
|
81
81
|
"value": {
|
|
82
82
|
"kind": "expression"
|
|
83
83
|
}
|
|
84
84
|
},
|
|
85
85
|
{
|
|
86
|
-
"name": "
|
|
87
|
-
"description": "
|
|
86
|
+
"name": "?noCloseOnOutsideClick",
|
|
87
|
+
"description": "Set to true to disable closing dialog on outside click",
|
|
88
88
|
"value": {
|
|
89
89
|
"kind": "expression"
|
|
90
90
|
}
|
|
91
91
|
},
|
|
92
92
|
{
|
|
93
|
-
"name": "
|
|
94
|
-
"description": "
|
|
93
|
+
"name": "?noFocusTrap",
|
|
94
|
+
"description": "Set to true to disable focus trapping.",
|
|
95
95
|
"value": {
|
|
96
96
|
"kind": "expression"
|
|
97
97
|
}
|
|
98
98
|
},
|
|
99
99
|
{
|
|
100
|
-
"name": "
|
|
101
|
-
"description": "
|
|
100
|
+
"name": "?opened",
|
|
101
|
+
"description": "True if the dialog is visible and available for interaction.",
|
|
102
102
|
"value": {
|
|
103
103
|
"kind": "expression"
|
|
104
104
|
}
|
|
105
105
|
},
|
|
106
106
|
{
|
|
107
|
-
"name": ".
|
|
108
|
-
"description": "
|
|
107
|
+
"name": ".overlayRole",
|
|
108
|
+
"description": "The `role` attribute value to be set on the dialog. Defaults to \"dialog\".",
|
|
109
109
|
"value": {
|
|
110
110
|
"kind": "expression"
|
|
111
111
|
}
|
|
112
112
|
},
|
|
113
113
|
{
|
|
114
|
-
"name": ".
|
|
115
|
-
"description": "
|
|
114
|
+
"name": ".renderer",
|
|
115
|
+
"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.",
|
|
116
116
|
"value": {
|
|
117
117
|
"kind": "expression"
|
|
118
118
|
}
|
|
119
119
|
},
|
|
120
120
|
{
|
|
121
|
-
"name": "
|
|
122
|
-
"description": "
|
|
121
|
+
"name": "?resizable",
|
|
122
|
+
"description": "Set to true to enable resizing the dialog by dragging the corners and edges.",
|
|
123
123
|
"value": {
|
|
124
124
|
"kind": "expression"
|
|
125
125
|
}
|