@vaadin/popover 25.0.0-rc1 → 25.0.1
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 +10 -10
- package/src/vaadin-popover-overlay-mixin.js +19 -7
- package/src/vaadin-popover.d.ts +15 -8
- package/src/vaadin-popover.js +16 -9
- package/web-types.json +2 -2
- package/web-types.lit.json +2 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vaadin/popover",
|
|
3
|
-
"version": "25.0.
|
|
3
|
+
"version": "25.0.1",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -36,23 +36,23 @@
|
|
|
36
36
|
],
|
|
37
37
|
"dependencies": {
|
|
38
38
|
"@open-wc/dedupe-mixin": "^1.3.0",
|
|
39
|
-
"@vaadin/a11y-base": "25.0.
|
|
40
|
-
"@vaadin/component-base": "25.0.
|
|
41
|
-
"@vaadin/lit-renderer": "25.0.
|
|
42
|
-
"@vaadin/overlay": "25.0.
|
|
43
|
-
"@vaadin/vaadin-themable-mixin": "25.0.
|
|
39
|
+
"@vaadin/a11y-base": "~25.0.1",
|
|
40
|
+
"@vaadin/component-base": "~25.0.1",
|
|
41
|
+
"@vaadin/lit-renderer": "~25.0.1",
|
|
42
|
+
"@vaadin/overlay": "~25.0.1",
|
|
43
|
+
"@vaadin/vaadin-themable-mixin": "~25.0.1",
|
|
44
44
|
"lit": "^3.0.0"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
|
-
"@vaadin/chai-plugins": "25.0.
|
|
48
|
-
"@vaadin/test-runner-commands": "25.0.
|
|
47
|
+
"@vaadin/chai-plugins": "~25.0.1",
|
|
48
|
+
"@vaadin/test-runner-commands": "~25.0.1",
|
|
49
49
|
"@vaadin/testing-helpers": "^2.0.0",
|
|
50
|
-
"@vaadin/vaadin-lumo-styles": "25.0.
|
|
50
|
+
"@vaadin/vaadin-lumo-styles": "~25.0.1",
|
|
51
51
|
"sinon": "^21.0.0"
|
|
52
52
|
},
|
|
53
53
|
"web-types": [
|
|
54
54
|
"web-types.json",
|
|
55
55
|
"web-types.lit.json"
|
|
56
56
|
],
|
|
57
|
-
"gitHead": "
|
|
57
|
+
"gitHead": "ced28c07a8abee586510349b312452c8a555fd10"
|
|
58
58
|
}
|
|
@@ -37,11 +37,26 @@ export const PopoverOverlayMixin = (superClass) =>
|
|
|
37
37
|
|
|
38
38
|
this.removeAttribute('arrow-centered');
|
|
39
39
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
40
|
+
const targetRect = this.positionTarget.getBoundingClientRect();
|
|
41
|
+
const overlayRect = this.$.overlay.getBoundingClientRect();
|
|
42
|
+
const viewportWidth = Math.min(window.innerWidth, document.documentElement.clientWidth);
|
|
43
|
+
|
|
44
|
+
// If the overlay extends beyond viewport, align the overlay to the respective edge so it isn't cut off
|
|
45
|
+
// Can skip trying to center the overlay in this case
|
|
46
|
+
let skipHorizontalCentering = false;
|
|
47
|
+
|
|
48
|
+
if (overlayRect.left < 0) {
|
|
49
|
+
this.style.left = '0px';
|
|
50
|
+
this.style.right = '';
|
|
51
|
+
skipHorizontalCentering = true;
|
|
52
|
+
} else if (overlayRect.right > viewportWidth) {
|
|
53
|
+
this.style.right = '0px';
|
|
54
|
+
this.style.left = '';
|
|
55
|
+
skipHorizontalCentering = true;
|
|
56
|
+
}
|
|
44
57
|
|
|
58
|
+
// Center the overlay horizontally
|
|
59
|
+
if (!skipHorizontalCentering && (this.position === 'bottom' || this.position === 'top')) {
|
|
45
60
|
const offset = targetRect.width / 2 - overlayRect.width / 2;
|
|
46
61
|
|
|
47
62
|
if (this.style.left) {
|
|
@@ -65,9 +80,6 @@ export const PopoverOverlayMixin = (superClass) =>
|
|
|
65
80
|
|
|
66
81
|
// Center the overlay vertically
|
|
67
82
|
if (this.position === 'start' || this.position === 'end') {
|
|
68
|
-
const targetRect = this.positionTarget.getBoundingClientRect();
|
|
69
|
-
const overlayRect = this.$.overlay.getBoundingClientRect();
|
|
70
|
-
|
|
71
83
|
const offset = targetRect.height / 2 - overlayRect.height / 2;
|
|
72
84
|
this.style.top = `${overlayRect.top + offset}px`;
|
|
73
85
|
}
|
package/src/vaadin-popover.d.ts
CHANGED
|
@@ -51,16 +51,23 @@ export type PopoverEventMap = HTMLElementEventMap & PopoverCustomEventMap;
|
|
|
51
51
|
* -----------------|----------------------------------------
|
|
52
52
|
* `position` | Reflects the `position` property value.
|
|
53
53
|
*
|
|
54
|
-
* ### Custom CSS Properties
|
|
55
|
-
*
|
|
56
54
|
* The following custom CSS properties are available for styling:
|
|
57
55
|
*
|
|
58
|
-
* Custom CSS property
|
|
59
|
-
*
|
|
60
|
-
*
|
|
61
|
-
*
|
|
62
|
-
*
|
|
63
|
-
*
|
|
56
|
+
* Custom CSS property |
|
|
57
|
+
* :----------------------------------------|
|
|
58
|
+
* |`--vaadin-overlay-backdrop-background` |
|
|
59
|
+
* |`--vaadin-popover-arrow-border-radius` |
|
|
60
|
+
* |`--vaadin-popover-arrow-size` |
|
|
61
|
+
* |`--vaadin-popover-background` |
|
|
62
|
+
* |`--vaadin-popover-border-color` |
|
|
63
|
+
* |`--vaadin-popover-border-radius` |
|
|
64
|
+
* |`--vaadin-popover-border-width` |
|
|
65
|
+
* |`--vaadin-popover-offset-bottom` |
|
|
66
|
+
* |`--vaadin-popover-offset-end` |
|
|
67
|
+
* |`--vaadin-popover-offset-start` |
|
|
68
|
+
* |`--vaadin-popover-offset-top` |
|
|
69
|
+
* |`--vaadin-popover-padding` |
|
|
70
|
+
* |`--vaadin-popover-shadow` |
|
|
64
71
|
*
|
|
65
72
|
* See [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.
|
|
66
73
|
*
|
package/src/vaadin-popover.js
CHANGED
|
@@ -186,16 +186,23 @@ const isLastOverlay = (overlay) => {
|
|
|
186
186
|
* -----------------|----------------------------------------
|
|
187
187
|
* `position` | Reflects the `position` property value.
|
|
188
188
|
*
|
|
189
|
-
* ### Custom CSS Properties
|
|
190
|
-
*
|
|
191
189
|
* The following custom CSS properties are available for styling:
|
|
192
190
|
*
|
|
193
|
-
* Custom CSS property
|
|
194
|
-
*
|
|
195
|
-
*
|
|
196
|
-
*
|
|
197
|
-
*
|
|
198
|
-
*
|
|
191
|
+
* Custom CSS property |
|
|
192
|
+
* :----------------------------------------|
|
|
193
|
+
* |`--vaadin-overlay-backdrop-background` |
|
|
194
|
+
* |`--vaadin-popover-arrow-border-radius` |
|
|
195
|
+
* |`--vaadin-popover-arrow-size` |
|
|
196
|
+
* |`--vaadin-popover-background` |
|
|
197
|
+
* |`--vaadin-popover-border-color` |
|
|
198
|
+
* |`--vaadin-popover-border-radius` |
|
|
199
|
+
* |`--vaadin-popover-border-width` |
|
|
200
|
+
* |`--vaadin-popover-offset-bottom` |
|
|
201
|
+
* |`--vaadin-popover-offset-end` |
|
|
202
|
+
* |`--vaadin-popover-offset-start` |
|
|
203
|
+
* |`--vaadin-popover-offset-top` |
|
|
204
|
+
* |`--vaadin-popover-padding` |
|
|
205
|
+
* |`--vaadin-popover-shadow` |
|
|
199
206
|
*
|
|
200
207
|
* See [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.
|
|
201
208
|
*
|
|
@@ -222,7 +229,7 @@ class Popover extends PopoverPositionMixin(
|
|
|
222
229
|
:host([opening]),
|
|
223
230
|
:host([closing]) {
|
|
224
231
|
display: block !important;
|
|
225
|
-
position:
|
|
232
|
+
position: fixed;
|
|
226
233
|
outline: none;
|
|
227
234
|
}
|
|
228
235
|
|
package/web-types.json
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/web-types",
|
|
3
3
|
"name": "@vaadin/popover",
|
|
4
|
-
"version": "25.0.
|
|
4
|
+
"version": "25.0.1",
|
|
5
5
|
"description-markup": "markdown",
|
|
6
6
|
"contributions": {
|
|
7
7
|
"html": {
|
|
8
8
|
"elements": [
|
|
9
9
|
{
|
|
10
10
|
"name": "vaadin-popover",
|
|
11
|
-
"description": "`<vaadin-popover>` is a Web Component for creating overlays\nthat are positioned next to specified DOM element (target).\n\nUnlike `<vaadin-tooltip>`, the popover supports rich content\nthat can be provided by using `renderer` function.\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`arrow` | Optional arrow pointing to the target when using `theme=\"arrow\"`\n\nThe following state attributes are available for styling:\n\nAttribute | Description\n-----------------|----------------------------------------\n`position` | Reflects the `position` property value.\n\
|
|
11
|
+
"description": "`<vaadin-popover>` is a Web Component for creating overlays\nthat are positioned next to specified DOM element (target).\n\nUnlike `<vaadin-tooltip>`, the popover supports rich content\nthat can be provided by using `renderer` function.\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`arrow` | Optional arrow pointing to the target when using `theme=\"arrow\"`\n\nThe following state attributes are available for styling:\n\nAttribute | Description\n-----------------|----------------------------------------\n`position` | Reflects the `position` property value.\n\nThe following custom CSS properties are available for styling:\n\nCustom CSS property |\n:----------------------------------------|\n|`--vaadin-overlay-backdrop-background` |\n|`--vaadin-popover-arrow-border-radius` |\n|`--vaadin-popover-arrow-size` |\n|`--vaadin-popover-background` |\n|`--vaadin-popover-border-color` |\n|`--vaadin-popover-border-radius` |\n|`--vaadin-popover-border-width` |\n|`--vaadin-popover-offset-bottom` |\n|`--vaadin-popover-offset-end` |\n|`--vaadin-popover-offset-start` |\n|`--vaadin-popover-offset-top` |\n|`--vaadin-popover-padding` |\n|`--vaadin-popover-shadow` |\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.",
|
|
12
12
|
"attributes": [
|
|
13
13
|
{
|
|
14
14
|
"name": "position",
|
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/popover",
|
|
4
|
-
"version": "25.0.
|
|
4
|
+
"version": "25.0.1",
|
|
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-popover",
|
|
19
|
-
"description": "`<vaadin-popover>` is a Web Component for creating overlays\nthat are positioned next to specified DOM element (target).\n\nUnlike `<vaadin-tooltip>`, the popover supports rich content\nthat can be provided by using `renderer` function.\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`arrow` | Optional arrow pointing to the target when using `theme=\"arrow\"`\n\nThe following state attributes are available for styling:\n\nAttribute | Description\n-----------------|----------------------------------------\n`position` | Reflects the `position` property value.\n\
|
|
19
|
+
"description": "`<vaadin-popover>` is a Web Component for creating overlays\nthat are positioned next to specified DOM element (target).\n\nUnlike `<vaadin-tooltip>`, the popover supports rich content\nthat can be provided by using `renderer` function.\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`arrow` | Optional arrow pointing to the target when using `theme=\"arrow\"`\n\nThe following state attributes are available for styling:\n\nAttribute | Description\n-----------------|----------------------------------------\n`position` | Reflects the `position` property value.\n\nThe following custom CSS properties are available for styling:\n\nCustom CSS property |\n:----------------------------------------|\n|`--vaadin-overlay-backdrop-background` |\n|`--vaadin-popover-arrow-border-radius` |\n|`--vaadin-popover-arrow-size` |\n|`--vaadin-popover-background` |\n|`--vaadin-popover-border-color` |\n|`--vaadin-popover-border-radius` |\n|`--vaadin-popover-border-width` |\n|`--vaadin-popover-offset-bottom` |\n|`--vaadin-popover-offset-end` |\n|`--vaadin-popover-offset-start` |\n|`--vaadin-popover-offset-top` |\n|`--vaadin-popover-padding` |\n|`--vaadin-popover-shadow` |\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.",
|
|
20
20
|
"extension": true,
|
|
21
21
|
"attributes": [
|
|
22
22
|
{
|