@vaadin/dialog 24.8.0-alpha8 → 25.0.0-alpha1
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 +11 -14
- package/src/vaadin-dialog-overlay.js +11 -9
- package/src/vaadin-dialog.js +35 -59
- package/web-types.json +2 -2
- package/web-types.lit.json +2 -2
- package/src/vaadin-lit-dialog-overlay.d.ts +0 -6
- package/src/vaadin-lit-dialog-overlay.js +0 -51
- package/src/vaadin-lit-dialog.d.ts +0 -6
- 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-alpha1",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -33,24 +33,21 @@
|
|
|
33
33
|
"Vaadin",
|
|
34
34
|
"vaadin-dialog",
|
|
35
35
|
"web-components",
|
|
36
|
-
"web-component"
|
|
37
|
-
"polymer"
|
|
36
|
+
"web-component"
|
|
38
37
|
],
|
|
39
38
|
"dependencies": {
|
|
40
39
|
"@open-wc/dedupe-mixin": "^1.3.0",
|
|
41
|
-
"@
|
|
42
|
-
"@vaadin/
|
|
43
|
-
"@vaadin/
|
|
44
|
-
"@vaadin/
|
|
45
|
-
"@vaadin/vaadin-
|
|
46
|
-
"@vaadin/vaadin-material-styles": "24.8.0-alpha8",
|
|
47
|
-
"@vaadin/vaadin-themable-mixin": "24.8.0-alpha8",
|
|
40
|
+
"@vaadin/component-base": "25.0.0-alpha1",
|
|
41
|
+
"@vaadin/lit-renderer": "25.0.0-alpha1",
|
|
42
|
+
"@vaadin/overlay": "25.0.0-alpha1",
|
|
43
|
+
"@vaadin/vaadin-lumo-styles": "25.0.0-alpha1",
|
|
44
|
+
"@vaadin/vaadin-themable-mixin": "25.0.0-alpha1",
|
|
48
45
|
"lit": "^3.0.0"
|
|
49
46
|
},
|
|
50
47
|
"devDependencies": {
|
|
51
|
-
"@vaadin/a11y-base": "
|
|
52
|
-
"@vaadin/chai-plugins": "
|
|
53
|
-
"@vaadin/test-runner-commands": "
|
|
48
|
+
"@vaadin/a11y-base": "25.0.0-alpha1",
|
|
49
|
+
"@vaadin/chai-plugins": "25.0.0-alpha1",
|
|
50
|
+
"@vaadin/test-runner-commands": "25.0.0-alpha1",
|
|
54
51
|
"@vaadin/testing-helpers": "^1.1.0",
|
|
55
52
|
"sinon": "^18.0.0"
|
|
56
53
|
},
|
|
@@ -58,5 +55,5 @@
|
|
|
58
55
|
"web-types.json",
|
|
59
56
|
"web-types.lit.json"
|
|
60
57
|
],
|
|
61
|
-
"gitHead": "
|
|
58
|
+
"gitHead": "b8c22a4a0c64156210d0daac96b43ae4e5526d49"
|
|
62
59
|
}
|
|
@@ -3,18 +3,15 @@
|
|
|
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 { PolylitMixin } from '@vaadin/component-base/src/polylit-mixin.js';
|
|
9
10
|
import { overlayStyles } from '@vaadin/overlay/src/vaadin-overlay-styles.js';
|
|
10
|
-
import {
|
|
11
|
+
import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
11
12
|
import { DialogOverlayMixin } from './vaadin-dialog-overlay-mixin.js';
|
|
12
13
|
import { dialogOverlay, resizableOverlay } from './vaadin-dialog-styles.js';
|
|
13
14
|
|
|
14
|
-
registerStyles('vaadin-dialog-overlay', [overlayStyles, dialogOverlay, resizableOverlay], {
|
|
15
|
-
moduleId: 'vaadin-dialog-overlay-styles',
|
|
16
|
-
});
|
|
17
|
-
|
|
18
15
|
/**
|
|
19
16
|
* An element used internally by `<vaadin-dialog>`. Not intended to be used separately.
|
|
20
17
|
*
|
|
@@ -25,14 +22,19 @@ registerStyles('vaadin-dialog-overlay', [overlayStyles, dialogOverlay, resizable
|
|
|
25
22
|
* @mixes ThemableMixin
|
|
26
23
|
* @private
|
|
27
24
|
*/
|
|
28
|
-
export class DialogOverlay extends DialogOverlayMixin(DirMixin(ThemableMixin(
|
|
25
|
+
export class DialogOverlay extends DialogOverlayMixin(DirMixin(ThemableMixin(PolylitMixin(LitElement)))) {
|
|
29
26
|
static get is() {
|
|
30
27
|
return 'vaadin-dialog-overlay';
|
|
31
28
|
}
|
|
32
29
|
|
|
33
|
-
static get
|
|
30
|
+
static get styles() {
|
|
31
|
+
return [overlayStyles, dialogOverlay, resizableOverlay];
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/** @protected */
|
|
35
|
+
render() {
|
|
34
36
|
return html`
|
|
35
|
-
<div id="backdrop" part="backdrop" hidden
|
|
37
|
+
<div id="backdrop" part="backdrop" ?hidden="${!this.withBackdrop}"></div>
|
|
36
38
|
<div part="overlay" id="overlay" tabindex="0">
|
|
37
39
|
<section id="resizerContainer" class="resizer-container">
|
|
38
40
|
<header part="header">
|
package/src/vaadin-dialog.js
CHANGED
|
@@ -4,11 +4,12 @@
|
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
6
|
import './vaadin-dialog-overlay.js';
|
|
7
|
-
import { html,
|
|
7
|
+
import { css, html, LitElement } from 'lit';
|
|
8
|
+
import { ifDefined } from 'lit/directives/if-defined.js';
|
|
8
9
|
import { defineCustomElement } from '@vaadin/component-base/src/define.js';
|
|
9
10
|
import { ElementMixin } from '@vaadin/component-base/src/element-mixin.js';
|
|
10
11
|
import { OverlayClassMixin } from '@vaadin/component-base/src/overlay-class-mixin.js';
|
|
11
|
-
import {
|
|
12
|
+
import { PolylitMixin } from '@vaadin/component-base/src/polylit-mixin.js';
|
|
12
13
|
import { ThemePropertyMixin } from '@vaadin/vaadin-themable-mixin/vaadin-theme-property-mixin.js';
|
|
13
14
|
import { DialogBaseMixin } from './vaadin-dialog-base-mixin.js';
|
|
14
15
|
import { DialogDraggableMixin } from './vaadin-dialog-draggable-mixin.js';
|
|
@@ -92,38 +93,21 @@ export { DialogOverlay } from './vaadin-dialog-overlay.js';
|
|
|
92
93
|
*/
|
|
93
94
|
class Dialog extends DialogDraggableMixin(
|
|
94
95
|
DialogResizableMixin(
|
|
95
|
-
DialogRendererMixin(DialogBaseMixin(OverlayClassMixin(ThemePropertyMixin(ElementMixin(
|
|
96
|
+
DialogRendererMixin(DialogBaseMixin(OverlayClassMixin(ThemePropertyMixin(ElementMixin(PolylitMixin(LitElement)))))),
|
|
96
97
|
),
|
|
97
98
|
) {
|
|
98
|
-
static get template() {
|
|
99
|
-
return html`
|
|
100
|
-
<style>
|
|
101
|
-
:host {
|
|
102
|
-
display: none !important;
|
|
103
|
-
}
|
|
104
|
-
</style>
|
|
105
|
-
|
|
106
|
-
<vaadin-dialog-overlay
|
|
107
|
-
id="overlay"
|
|
108
|
-
role$="[[overlayRole]]"
|
|
109
|
-
header-title="[[headerTitle]]"
|
|
110
|
-
on-opened-changed="_onOverlayOpened"
|
|
111
|
-
on-mousedown="_bringOverlayToFront"
|
|
112
|
-
on-touchstart="_bringOverlayToFront"
|
|
113
|
-
theme$="[[_theme]]"
|
|
114
|
-
modeless="[[modeless]]"
|
|
115
|
-
with-backdrop="[[!modeless]]"
|
|
116
|
-
resizable$="[[resizable]]"
|
|
117
|
-
restore-focus-on-close
|
|
118
|
-
focus-trap
|
|
119
|
-
></vaadin-dialog-overlay>
|
|
120
|
-
`;
|
|
121
|
-
}
|
|
122
|
-
|
|
123
99
|
static get is() {
|
|
124
100
|
return 'vaadin-dialog';
|
|
125
101
|
}
|
|
126
102
|
|
|
103
|
+
static get styles() {
|
|
104
|
+
return css`
|
|
105
|
+
:host {
|
|
106
|
+
display: none !important;
|
|
107
|
+
}
|
|
108
|
+
`;
|
|
109
|
+
}
|
|
110
|
+
|
|
127
111
|
static get properties() {
|
|
128
112
|
return {
|
|
129
113
|
/**
|
|
@@ -138,38 +122,30 @@ class Dialog extends DialogDraggableMixin(
|
|
|
138
122
|
};
|
|
139
123
|
}
|
|
140
124
|
|
|
141
|
-
static get observers() {
|
|
142
|
-
return [
|
|
143
|
-
'_openedChanged(opened)',
|
|
144
|
-
'_ariaLabelChanged(ariaLabel, headerTitle)',
|
|
145
|
-
'_rendererChanged(renderer, headerRenderer, footerRenderer)',
|
|
146
|
-
];
|
|
147
|
-
}
|
|
148
|
-
|
|
149
125
|
/** @protected */
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
126
|
+
render() {
|
|
127
|
+
return html`
|
|
128
|
+
<vaadin-dialog-overlay
|
|
129
|
+
id="overlay"
|
|
130
|
+
role="${this.overlayRole}"
|
|
131
|
+
.owner="${this}"
|
|
132
|
+
.opened="${this.opened}"
|
|
133
|
+
.headerTitle="${this.headerTitle}"
|
|
134
|
+
.renderer="${this.renderer}"
|
|
135
|
+
.headerRenderer="${this.headerRenderer}"
|
|
136
|
+
.footerRenderer="${this.footerRenderer}"
|
|
137
|
+
@opened-changed="${this._onOverlayOpened}"
|
|
138
|
+
@mousedown="${this._bringOverlayToFront}"
|
|
139
|
+
@touchstart="${this._bringOverlayToFront}"
|
|
140
|
+
theme="${ifDefined(this._theme)}"
|
|
141
|
+
aria-label="${ifDefined(this.ariaLabel || this.headerTitle)}"
|
|
142
|
+
.modeless="${this.modeless}"
|
|
143
|
+
.withBackdrop="${!this.modeless}"
|
|
144
|
+
?resizable="${this.resizable}"
|
|
145
|
+
restore-focus-on-close
|
|
146
|
+
focus-trap
|
|
147
|
+
></vaadin-dialog-overlay>
|
|
148
|
+
`;
|
|
173
149
|
}
|
|
174
150
|
}
|
|
175
151
|
|
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": "
|
|
4
|
+
"version": "25.0.0-alpha1",
|
|
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\n`<vaadin-dialog>` uses `<vaadin-dialog-overlay>` internal\nthemable component as the actual visible dialog overlay.\n\nSee [`<vaadin-overlay>`](https://cdn.vaadin.com/vaadin-web-components/
|
|
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\n`<vaadin-dialog>` uses `<vaadin-dialog-overlay>` internal\nthemable component as the actual visible dialog overlay.\n\nSee [`<vaadin-overlay>`](https://cdn.vaadin.com/vaadin-web-components/25.0.0-alpha1/#/elements/vaadin-overlay) documentation.\nfor `<vaadin-dialog-overlay>` parts.\n\nIn addition to `<vaadin-overlay>` parts, the following parts are available for styling:\n\nPart name | Description\n-----------------|-------------------------------------------\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\nNote: the `theme` attribute value set on `<vaadin-dialog>` is\npropagated to the internal `<vaadin-dialog-overlay>` component.\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.",
|
|
12
12
|
"attributes": [
|
|
13
13
|
{
|
|
14
14
|
"name": "opened",
|
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": "
|
|
4
|
+
"version": "25.0.0-alpha1",
|
|
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\n`<vaadin-dialog>` uses `<vaadin-dialog-overlay>` internal\nthemable component as the actual visible dialog overlay.\n\nSee [`<vaadin-overlay>`](https://cdn.vaadin.com/vaadin-web-components/
|
|
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\n`<vaadin-dialog>` uses `<vaadin-dialog-overlay>` internal\nthemable component as the actual visible dialog overlay.\n\nSee [`<vaadin-overlay>`](https://cdn.vaadin.com/vaadin-web-components/25.0.0-alpha1/#/elements/vaadin-overlay) documentation.\nfor `<vaadin-dialog-overlay>` parts.\n\nIn addition to `<vaadin-overlay>` parts, the following parts are available for styling:\n\nPart name | Description\n-----------------|-------------------------------------------\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\nNote: the `theme` attribute value set on `<vaadin-dialog>` is\npropagated to the internal `<vaadin-dialog-overlay>` component.\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.",
|
|
20
20
|
"extension": true,
|
|
21
21
|
"attributes": [
|
|
22
22
|
{
|
|
@@ -1,51 +0,0 @@
|
|
|
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 { html, LitElement } from 'lit';
|
|
7
|
-
import { defineCustomElement } from '@vaadin/component-base/src/define.js';
|
|
8
|
-
import { DirMixin } from '@vaadin/component-base/src/dir-mixin.js';
|
|
9
|
-
import { PolylitMixin } from '@vaadin/component-base/src/polylit-mixin.js';
|
|
10
|
-
import { overlayStyles } from '@vaadin/overlay/src/vaadin-overlay-styles.js';
|
|
11
|
-
import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
12
|
-
import { DialogOverlayMixin } from './vaadin-dialog-overlay-mixin.js';
|
|
13
|
-
import { dialogOverlay, resizableOverlay } from './vaadin-dialog-styles.js';
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* An element used internally by `<vaadin-dialog>`. Not intended to be used separately.
|
|
17
|
-
*
|
|
18
|
-
* @extends HTMLElement
|
|
19
|
-
* @mixes DialogOverlayMixin
|
|
20
|
-
* @mixes DirMixin
|
|
21
|
-
* @mixes ThemableMixin
|
|
22
|
-
* @private
|
|
23
|
-
*/
|
|
24
|
-
export class DialogOverlay extends DialogOverlayMixin(DirMixin(ThemableMixin(PolylitMixin(LitElement)))) {
|
|
25
|
-
static get is() {
|
|
26
|
-
return 'vaadin-dialog-overlay';
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
static get styles() {
|
|
30
|
-
return [overlayStyles, dialogOverlay, resizableOverlay];
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
/** @protected */
|
|
34
|
-
render() {
|
|
35
|
-
return html`
|
|
36
|
-
<div id="backdrop" part="backdrop" ?hidden="${!this.withBackdrop}"></div>
|
|
37
|
-
<div part="overlay" id="overlay" tabindex="0">
|
|
38
|
-
<section id="resizerContainer" class="resizer-container">
|
|
39
|
-
<header part="header">
|
|
40
|
-
<div part="title"><slot name="title"></slot></div>
|
|
41
|
-
<div part="header-content"><slot name="header-content"></slot></div>
|
|
42
|
-
</header>
|
|
43
|
-
<div part="content" id="content"><slot></slot></div>
|
|
44
|
-
<footer part="footer"><slot name="footer"></slot></footer>
|
|
45
|
-
</section>
|
|
46
|
-
</div>
|
|
47
|
-
`;
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
defineCustomElement(DialogOverlay);
|
package/src/vaadin-lit-dialog.js
DELETED
|
@@ -1,99 +0,0 @@
|
|
|
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-lit-dialog-overlay.js';
|
|
7
|
-
import { css, html, LitElement } from 'lit';
|
|
8
|
-
import { ifDefined } from 'lit/directives/if-defined.js';
|
|
9
|
-
import { defineCustomElement } from '@vaadin/component-base/src/define.js';
|
|
10
|
-
import { ElementMixin } from '@vaadin/component-base/src/element-mixin.js';
|
|
11
|
-
import { OverlayClassMixin } from '@vaadin/component-base/src/overlay-class-mixin.js';
|
|
12
|
-
import { PolylitMixin } from '@vaadin/component-base/src/polylit-mixin.js';
|
|
13
|
-
import { ThemePropertyMixin } from '@vaadin/vaadin-themable-mixin/vaadin-theme-property-mixin.js';
|
|
14
|
-
import { DialogBaseMixin } from './vaadin-dialog-base-mixin.js';
|
|
15
|
-
import { DialogDraggableMixin } from './vaadin-dialog-draggable-mixin.js';
|
|
16
|
-
import { DialogRendererMixin } from './vaadin-dialog-renderer-mixin.js';
|
|
17
|
-
import { DialogResizableMixin } from './vaadin-dialog-resizable-mixin.js';
|
|
18
|
-
|
|
19
|
-
export { DialogOverlay } from './vaadin-lit-dialog-overlay.js';
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* LitElement based version of `<vaadin-dialog>` web component.
|
|
23
|
-
*
|
|
24
|
-
* ## Disclaimer
|
|
25
|
-
*
|
|
26
|
-
* This component is an experiment and not yet a part of Vaadin platform.
|
|
27
|
-
* There is no ETA regarding specific Vaadin version where it'll land.
|
|
28
|
-
* Feel free to try this code in your apps as per Apache 2.0 license.
|
|
29
|
-
*
|
|
30
|
-
* @extends HTMLElement
|
|
31
|
-
* @mixes ElementMixin
|
|
32
|
-
* @mixes DialogBaseMixin
|
|
33
|
-
* @mixes DialogDraggableMixin
|
|
34
|
-
* @mixes DialogRendererMixin
|
|
35
|
-
* @mixes DialogResizableMixin
|
|
36
|
-
* @mixes OverlayClassMixin
|
|
37
|
-
* @mixes ThemePropertyMixin
|
|
38
|
-
*/
|
|
39
|
-
class Dialog extends DialogDraggableMixin(
|
|
40
|
-
DialogResizableMixin(
|
|
41
|
-
DialogRendererMixin(DialogBaseMixin(OverlayClassMixin(ThemePropertyMixin(ElementMixin(PolylitMixin(LitElement)))))),
|
|
42
|
-
),
|
|
43
|
-
) {
|
|
44
|
-
static get is() {
|
|
45
|
-
return 'vaadin-dialog';
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
static get styles() {
|
|
49
|
-
return css`
|
|
50
|
-
:host {
|
|
51
|
-
display: none !important;
|
|
52
|
-
}
|
|
53
|
-
`;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
static get properties() {
|
|
57
|
-
return {
|
|
58
|
-
/**
|
|
59
|
-
* Set the `aria-label` attribute for assistive technologies like
|
|
60
|
-
* screen readers. An empty string value for this property (the
|
|
61
|
-
* default) means that the `aria-label` attribute is not present.
|
|
62
|
-
*/
|
|
63
|
-
ariaLabel: {
|
|
64
|
-
type: String,
|
|
65
|
-
value: '',
|
|
66
|
-
},
|
|
67
|
-
};
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
/** @protected */
|
|
71
|
-
render() {
|
|
72
|
-
return html`
|
|
73
|
-
<vaadin-dialog-overlay
|
|
74
|
-
id="overlay"
|
|
75
|
-
role="${this.overlayRole}"
|
|
76
|
-
.owner="${this}"
|
|
77
|
-
.opened="${this.opened}"
|
|
78
|
-
.headerTitle="${this.headerTitle}"
|
|
79
|
-
.renderer="${this.renderer}"
|
|
80
|
-
.headerRenderer="${this.headerRenderer}"
|
|
81
|
-
.footerRenderer="${this.footerRenderer}"
|
|
82
|
-
@opened-changed="${this._onOverlayOpened}"
|
|
83
|
-
@mousedown="${this._bringOverlayToFront}"
|
|
84
|
-
@touchstart="${this._bringOverlayToFront}"
|
|
85
|
-
theme="${ifDefined(this._theme)}"
|
|
86
|
-
aria-label="${ifDefined(this.ariaLabel || this.headerTitle)}"
|
|
87
|
-
.modeless="${this.modeless}"
|
|
88
|
-
.withBackdrop="${!this.modeless}"
|
|
89
|
-
?resizable="${this.resizable}"
|
|
90
|
-
restore-focus-on-close
|
|
91
|
-
focus-trap
|
|
92
|
-
></vaadin-dialog-overlay>
|
|
93
|
-
`;
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
defineCustomElement(Dialog);
|
|
98
|
-
|
|
99
|
-
export { Dialog };
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import '@vaadin/vaadin-material-styles/shadow.js';
|
|
2
|
-
import '@vaadin/vaadin-material-styles/color.js';
|
|
3
|
-
import { overlay } from '@vaadin/vaadin-material-styles/mixins/overlay.js';
|
|
4
|
-
import { css, registerStyles } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
5
|
-
|
|
6
|
-
const dialogOverlay = css`
|
|
7
|
-
[part='overlay'] {
|
|
8
|
-
box-shadow: var(--material-shadow-elevation-24dp);
|
|
9
|
-
outline: none;
|
|
10
|
-
max-width: 560px;
|
|
11
|
-
min-width: 280px;
|
|
12
|
-
-webkit-tap-highlight-color: transparent;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
[part='content'] {
|
|
16
|
-
padding: 24px;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
[part='header'] {
|
|
20
|
-
padding: 16px;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
:host(:is([has-header], [has-title])) [part='header'] + [part='content'] {
|
|
24
|
-
padding-top: 0;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
[part='header'],
|
|
28
|
-
[part='header-content'],
|
|
29
|
-
[part='footer'] {
|
|
30
|
-
gap: 8px;
|
|
31
|
-
line-height: 1.2;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
[part='title'] {
|
|
35
|
-
font-size: var(--material-h5-font-size);
|
|
36
|
-
font-weight: 500;
|
|
37
|
-
margin-inline-start: 8px;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
[part='footer'] {
|
|
41
|
-
padding: 8px;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
@media (min-height: 320px) {
|
|
45
|
-
:host([overflow~='top']) [part='header'] {
|
|
46
|
-
box-shadow: 0 1px 0 0 var(--material-divider-color);
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
:host([overflow~='bottom']) [part='footer'] {
|
|
50
|
-
box-shadow: 0 -1px 0 0 var(--material-divider-color);
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
/* No padding */
|
|
55
|
-
:host([theme~='no-padding']) [part='content'] {
|
|
56
|
-
padding: 0 !important;
|
|
57
|
-
}
|
|
58
|
-
`;
|
|
59
|
-
|
|
60
|
-
registerStyles('vaadin-dialog-overlay', [overlay, dialogOverlay], {
|
|
61
|
-
moduleId: 'material-dialog',
|
|
62
|
-
});
|
|
63
|
-
|
|
64
|
-
export { dialogOverlay };
|
package/vaadin-lit-dialog.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './src/vaadin-dialog.js';
|
package/vaadin-lit-dialog.js
DELETED