@vaadin/dialog 24.6.0-alpha2 → 24.6.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vaadin/dialog",
3
- "version": "24.6.0-alpha2",
3
+ "version": "24.6.0-alpha4",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -39,24 +39,24 @@
39
39
  "dependencies": {
40
40
  "@open-wc/dedupe-mixin": "^1.3.0",
41
41
  "@polymer/polymer": "^3.0.0",
42
- "@vaadin/component-base": "24.6.0-alpha2",
43
- "@vaadin/lit-renderer": "24.6.0-alpha2",
44
- "@vaadin/overlay": "24.6.0-alpha2",
45
- "@vaadin/vaadin-lumo-styles": "24.6.0-alpha2",
46
- "@vaadin/vaadin-material-styles": "24.6.0-alpha2",
47
- "@vaadin/vaadin-themable-mixin": "24.6.0-alpha2",
42
+ "@vaadin/component-base": "24.6.0-alpha4",
43
+ "@vaadin/lit-renderer": "24.6.0-alpha4",
44
+ "@vaadin/overlay": "24.6.0-alpha4",
45
+ "@vaadin/vaadin-lumo-styles": "24.6.0-alpha4",
46
+ "@vaadin/vaadin-material-styles": "24.6.0-alpha4",
47
+ "@vaadin/vaadin-themable-mixin": "24.6.0-alpha4",
48
48
  "lit": "^3.0.0"
49
49
  },
50
50
  "devDependencies": {
51
- "@vaadin/a11y-base": "24.6.0-alpha2",
52
- "@vaadin/chai-plugins": "24.6.0-alpha2",
51
+ "@vaadin/a11y-base": "24.6.0-alpha4",
52
+ "@vaadin/chai-plugins": "24.6.0-alpha4",
53
53
  "@vaadin/testing-helpers": "^1.0.0",
54
- "@vaadin/text-area": "24.6.0-alpha2",
54
+ "@vaadin/text-area": "24.6.0-alpha4",
55
55
  "sinon": "^18.0.0"
56
56
  },
57
57
  "web-types": [
58
58
  "web-types.json",
59
59
  "web-types.lit.json"
60
60
  ],
61
- "gitHead": "21fa9ea077a04949a90d00934bfefe3e346bd129"
61
+ "gitHead": "78967d4f3bb46f58f43c2cc621802554acb2efaf"
62
62
  }
@@ -38,4 +38,24 @@ export declare class DialogBaseMixinClass {
38
38
  * @attr {string} overlay-role
39
39
  */
40
40
  overlayRole: string;
41
+
42
+ /**
43
+ * Set the distance of the overlay from the top of its container.
44
+ * If a unitless number is provided, pixels are assumed.
45
+ *
46
+ * Note that the overlay top edge may not be the same as the viewport
47
+ * top edge (e.g. the Lumo theme defines some spacing to prevent the
48
+ * overlay from stretching all the way to the top of the viewport).
49
+ */
50
+ top: string;
51
+
52
+ /**
53
+ * Set the distance of the overlay from the left of its container.
54
+ * If a unitless number is provided, pixels are assumed.
55
+ *
56
+ * Note that the overlay left edge may not be the same as the viewport
57
+ * left edge (e.g. the Lumo theme defines some spacing to prevent the
58
+ * overlay from stretching all the way to the left of the viewport).
59
+ */
60
+ left: string;
41
61
  }
@@ -50,6 +50,30 @@ export const DialogBaseMixin = (superClass) =>
50
50
  value: false,
51
51
  },
52
52
 
53
+ /**
54
+ * Set the distance of the overlay from the top of its container.
55
+ * If a unitless number is provided, pixels are assumed.
56
+ *
57
+ * Note that the overlay top edge may not be the same as the viewport
58
+ * top edge (e.g. the Lumo theme defines some spacing to prevent the
59
+ * overlay from stretching all the way to the top of the viewport).
60
+ */
61
+ top: {
62
+ type: String,
63
+ },
64
+
65
+ /**
66
+ * Set the distance of the overlay from the left of its container.
67
+ * If a unitless number is provided, pixels are assumed.
68
+ *
69
+ * Note that the overlay left edge may not be the same as the viewport
70
+ * left edge (e.g. the Lumo theme defines some spacing to prevent the
71
+ * overlay from stretching all the way to the left of the viewport).
72
+ */
73
+ left: {
74
+ type: String,
75
+ },
76
+
53
77
  /**
54
78
  * The `role` attribute value to be set on the overlay. Defaults to "dialog".
55
79
  *
@@ -62,6 +86,10 @@ export const DialogBaseMixin = (superClass) =>
62
86
  };
63
87
  }
64
88
 
89
+ static get observers() {
90
+ return ['__positionChanged(top, left)'];
91
+ }
92
+
65
93
  /** @protected */
66
94
  ready() {
67
95
  super.ready();
@@ -137,6 +165,11 @@ export const DialogBaseMixin = (superClass) =>
137
165
  }
138
166
  }
139
167
 
168
+ /** @private */
169
+ __positionChanged(top, left) {
170
+ this.$.overlay.setBounds({ top, left });
171
+ }
172
+
140
173
  /**
141
174
  * Fired when the dialog is closed.
142
175
  *
@@ -96,7 +96,8 @@ export const DialogDraggableMixin = (superClass) =>
96
96
  window.addEventListener('mousemove', this._drag);
97
97
  window.addEventListener('touchmove', this._drag);
98
98
  if (this.$.overlay.$.overlay.style.position !== 'absolute') {
99
- this.$.overlay.setBounds(this._originalBounds);
99
+ const { top, left } = this._originalBounds;
100
+ this.$.overlay.setBounds({ top, left });
100
101
  }
101
102
  }
102
103
  }
@@ -108,7 +109,8 @@ export const DialogDraggableMixin = (superClass) =>
108
109
  if (eventInWindow(event)) {
109
110
  const top = this._originalBounds.top + (event.pageY - this._originalMouseCoords.top);
110
111
  const left = this._originalBounds.left + (event.pageX - this._originalMouseCoords.left);
111
- this.$.overlay.setBounds({ top, left });
112
+ this.top = top;
113
+ this.left = left;
112
114
  }
113
115
  }
114
116
 
@@ -207,7 +207,7 @@ export const DialogOverlayMixin = (superClass) =>
207
207
  }
208
208
 
209
209
  Object.keys(parsedBounds).forEach((arg) => {
210
- if (typeof parsedBounds[arg] === 'number') {
210
+ if (!isNaN(parsedBounds[arg])) {
211
211
  parsedBounds[arg] = `${parsedBounds[arg]}px`;
212
212
  }
213
213
  });
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": "24.6.0-alpha2",
4
+ "version": "24.6.0-alpha4",
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/24.6.0-alpha2/#/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.",
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/24.6.0-alpha4/#/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",
@@ -46,6 +46,28 @@
46
46
  ]
47
47
  }
48
48
  },
49
+ {
50
+ "name": "top",
51
+ "description": "Set the distance of the overlay from the top of its container.\nIf a unitless number is provided, pixels are assumed.\n\nNote that the overlay top edge may not be the same as the viewport\ntop edge (e.g. the Lumo theme defines some spacing to prevent the\noverlay from stretching all the way to the top of the viewport).",
52
+ "value": {
53
+ "type": [
54
+ "string",
55
+ "null",
56
+ "undefined"
57
+ ]
58
+ }
59
+ },
60
+ {
61
+ "name": "left",
62
+ "description": "Set the distance of the overlay from the left of its container.\nIf a unitless number is provided, pixels are assumed.\n\nNote that the overlay left edge may not be the same as the viewport\nleft edge (e.g. the Lumo theme defines some spacing to prevent the\noverlay from stretching all the way to the left of the viewport).",
63
+ "value": {
64
+ "type": [
65
+ "string",
66
+ "null",
67
+ "undefined"
68
+ ]
69
+ }
70
+ },
49
71
  {
50
72
  "name": "overlay-role",
51
73
  "description": "The `role` attribute value to be set on the overlay. Defaults to \"dialog\".",
@@ -158,6 +180,28 @@
158
180
  ]
159
181
  }
160
182
  },
183
+ {
184
+ "name": "top",
185
+ "description": "Set the distance of the overlay from the top of its container.\nIf a unitless number is provided, pixels are assumed.\n\nNote that the overlay top edge may not be the same as the viewport\ntop edge (e.g. the Lumo theme defines some spacing to prevent the\noverlay from stretching all the way to the top of the viewport).",
186
+ "value": {
187
+ "type": [
188
+ "string",
189
+ "null",
190
+ "undefined"
191
+ ]
192
+ }
193
+ },
194
+ {
195
+ "name": "left",
196
+ "description": "Set the distance of the overlay from the left of its container.\nIf a unitless number is provided, pixels are assumed.\n\nNote that the overlay left edge may not be the same as the viewport\nleft edge (e.g. the Lumo theme defines some spacing to prevent the\noverlay from stretching all the way to the left of the viewport).",
197
+ "value": {
198
+ "type": [
199
+ "string",
200
+ "null",
201
+ "undefined"
202
+ ]
203
+ }
204
+ },
161
205
  {
162
206
  "name": "overlayRole",
163
207
  "description": "The `role` attribute value to be set on the overlay. Defaults to \"dialog\".",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/web-types",
3
3
  "name": "@vaadin/dialog",
4
- "version": "24.6.0-alpha2",
4
+ "version": "24.6.0-alpha4",
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/24.6.0-alpha2/#/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.",
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/24.6.0-alpha4/#/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
  {
@@ -61,6 +61,20 @@
61
61
  "kind": "expression"
62
62
  }
63
63
  },
64
+ {
65
+ "name": ".top",
66
+ "description": "Set the distance of the overlay from the top of its container.\nIf a unitless number is provided, pixels are assumed.\n\nNote that the overlay top edge may not be the same as the viewport\ntop edge (e.g. the Lumo theme defines some spacing to prevent the\noverlay from stretching all the way to the top of the viewport).",
67
+ "value": {
68
+ "kind": "expression"
69
+ }
70
+ },
71
+ {
72
+ "name": ".left",
73
+ "description": "Set the distance of the overlay from the left of its container.\nIf a unitless number is provided, pixels are assumed.\n\nNote that the overlay left edge may not be the same as the viewport\nleft edge (e.g. the Lumo theme defines some spacing to prevent the\noverlay from stretching all the way to the left of the viewport).",
74
+ "value": {
75
+ "kind": "expression"
76
+ }
77
+ },
64
78
  {
65
79
  "name": ".overlayRole",
66
80
  "description": "The `role` attribute value to be set on the overlay. Defaults to \"dialog\".",