@vaadin/popover 24.9.5 → 24.9.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +11 -11
- package/src/vaadin-popover-overlay-mixin.js +19 -7
- package/src/vaadin-popover.js +24 -16
- 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": "24.9.
|
|
3
|
+
"version": "24.9.7",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -37,18 +37,18 @@
|
|
|
37
37
|
],
|
|
38
38
|
"dependencies": {
|
|
39
39
|
"@open-wc/dedupe-mixin": "^1.3.0",
|
|
40
|
-
"@vaadin/a11y-base": "~24.9.
|
|
41
|
-
"@vaadin/component-base": "~24.9.
|
|
42
|
-
"@vaadin/lit-renderer": "~24.9.
|
|
43
|
-
"@vaadin/overlay": "~24.9.
|
|
44
|
-
"@vaadin/vaadin-lumo-styles": "~24.9.
|
|
45
|
-
"@vaadin/vaadin-material-styles": "~24.9.
|
|
46
|
-
"@vaadin/vaadin-themable-mixin": "~24.9.
|
|
40
|
+
"@vaadin/a11y-base": "~24.9.7",
|
|
41
|
+
"@vaadin/component-base": "~24.9.7",
|
|
42
|
+
"@vaadin/lit-renderer": "~24.9.7",
|
|
43
|
+
"@vaadin/overlay": "~24.9.7",
|
|
44
|
+
"@vaadin/vaadin-lumo-styles": "~24.9.7",
|
|
45
|
+
"@vaadin/vaadin-material-styles": "~24.9.7",
|
|
46
|
+
"@vaadin/vaadin-themable-mixin": "~24.9.7",
|
|
47
47
|
"lit": "^3.0.0"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
|
-
"@vaadin/chai-plugins": "~24.9.
|
|
51
|
-
"@vaadin/test-runner-commands": "~24.9.
|
|
50
|
+
"@vaadin/chai-plugins": "~24.9.7",
|
|
51
|
+
"@vaadin/test-runner-commands": "~24.9.7",
|
|
52
52
|
"@vaadin/testing-helpers": "^1.1.0",
|
|
53
53
|
"sinon": "^18.0.0"
|
|
54
54
|
},
|
|
@@ -56,5 +56,5 @@
|
|
|
56
56
|
"web-types.json",
|
|
57
57
|
"web-types.lit.json"
|
|
58
58
|
],
|
|
59
|
-
"gitHead": "
|
|
59
|
+
"gitHead": "90bf3c38a73a61fed3dd918f798d0a1c6bbe89b9"
|
|
60
60
|
}
|
|
@@ -79,11 +79,26 @@ export const PopoverOverlayMixin = (superClass) =>
|
|
|
79
79
|
|
|
80
80
|
this.removeAttribute('arrow-centered');
|
|
81
81
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
82
|
+
const targetRect = this.positionTarget.getBoundingClientRect();
|
|
83
|
+
const overlayRect = this.$.overlay.getBoundingClientRect();
|
|
84
|
+
const viewportWidth = Math.min(window.innerWidth, document.documentElement.clientWidth);
|
|
85
|
+
|
|
86
|
+
// If the overlay extends beyond viewport, align the overlay to the respective edge so it isn't cut off
|
|
87
|
+
// Can skip trying to center the overlay in this case
|
|
88
|
+
let skipHorizontalCentering = false;
|
|
89
|
+
|
|
90
|
+
if (overlayRect.left < 0) {
|
|
91
|
+
this.style.left = '0px';
|
|
92
|
+
this.style.right = '';
|
|
93
|
+
skipHorizontalCentering = true;
|
|
94
|
+
} else if (overlayRect.right > viewportWidth) {
|
|
95
|
+
this.style.right = '0px';
|
|
96
|
+
this.style.left = '';
|
|
97
|
+
skipHorizontalCentering = true;
|
|
98
|
+
}
|
|
86
99
|
|
|
100
|
+
// Center the overlay horizontally
|
|
101
|
+
if (!skipHorizontalCentering && (this.position === 'bottom' || this.position === 'top')) {
|
|
87
102
|
const offset = targetRect.width / 2 - overlayRect.width / 2;
|
|
88
103
|
|
|
89
104
|
if (this.style.left) {
|
|
@@ -107,9 +122,6 @@ export const PopoverOverlayMixin = (superClass) =>
|
|
|
107
122
|
|
|
108
123
|
// Center the overlay vertically
|
|
109
124
|
if (this.position === 'start' || this.position === 'end') {
|
|
110
|
-
const targetRect = this.positionTarget.getBoundingClientRect();
|
|
111
|
-
const overlayRect = this.$.overlay.getBoundingClientRect();
|
|
112
|
-
|
|
113
125
|
const offset = targetRect.height / 2 - overlayRect.height / 2;
|
|
114
126
|
this.style.top = `${overlayRect.top + offset}px`;
|
|
115
127
|
}
|
package/src/vaadin-popover.js
CHANGED
|
@@ -17,7 +17,10 @@ import { ElementMixin } from '@vaadin/component-base/src/element-mixin.js';
|
|
|
17
17
|
import { OverlayClassMixin } from '@vaadin/component-base/src/overlay-class-mixin.js';
|
|
18
18
|
import { PolylitMixin } from '@vaadin/component-base/src/polylit-mixin.js';
|
|
19
19
|
import { generateUniqueId } from '@vaadin/component-base/src/unique-id-utils.js';
|
|
20
|
-
import {
|
|
20
|
+
import {
|
|
21
|
+
hasOnlyNestedOverlays,
|
|
22
|
+
isLastOverlay as isLastOverlayBase,
|
|
23
|
+
} from '@vaadin/overlay/src/vaadin-overlay-stack-mixin.js';
|
|
21
24
|
import { ThemePropertyMixin } from '@vaadin/vaadin-themable-mixin/vaadin-theme-property-mixin.js';
|
|
22
25
|
import { PopoverPositionMixin } from './vaadin-popover-position-mixin.js';
|
|
23
26
|
import { PopoverTargetMixin } from './vaadin-popover-target-mixin.js';
|
|
@@ -753,10 +756,14 @@ class Popover extends PopoverPositionMixin(
|
|
|
753
756
|
|
|
754
757
|
/** @private */
|
|
755
758
|
__onTargetFocusOut(event) {
|
|
756
|
-
// Do not close
|
|
759
|
+
// Do not close if there is a nested overlay that should be closed through some method first.
|
|
757
760
|
// This covers the case when focus moves to the nested popover opened
|
|
758
761
|
// without focusing parent popover overlay (e.g. using hover trigger).
|
|
759
|
-
if (
|
|
762
|
+
if (
|
|
763
|
+
this._overlayElement.opened &&
|
|
764
|
+
!isLastOverlay(this._overlayElement) &&
|
|
765
|
+
hasOnlyNestedOverlays(this._overlayElement)
|
|
766
|
+
) {
|
|
760
767
|
return;
|
|
761
768
|
}
|
|
762
769
|
|
|
@@ -782,13 +789,16 @@ class Popover extends PopoverPositionMixin(
|
|
|
782
789
|
|
|
783
790
|
/** @private */
|
|
784
791
|
__onTargetMouseLeave(event) {
|
|
785
|
-
// Do not close
|
|
786
|
-
|
|
787
|
-
if (this._overlayElement.opened && !isLastOverlay(this._overlayElement)) {
|
|
792
|
+
// Do not close if the pointer moves to the overlay
|
|
793
|
+
if (this._overlayElement.contains(event.relatedTarget)) {
|
|
788
794
|
return;
|
|
789
795
|
}
|
|
790
|
-
|
|
791
|
-
if (
|
|
796
|
+
// Do not close if there is a nested overlay that should be closed through some method first.
|
|
797
|
+
if (
|
|
798
|
+
this._overlayElement.opened &&
|
|
799
|
+
!isLastOverlay(this._overlayElement) &&
|
|
800
|
+
hasOnlyNestedOverlays(this._overlayElement)
|
|
801
|
+
) {
|
|
792
802
|
return;
|
|
793
803
|
}
|
|
794
804
|
|
|
@@ -808,11 +818,11 @@ class Popover extends PopoverPositionMixin(
|
|
|
808
818
|
|
|
809
819
|
/** @private */
|
|
810
820
|
__onOverlayFocusOut(event) {
|
|
811
|
-
// Do not close
|
|
821
|
+
// Do not close if there is a nested overlay that should be closed through some method first.
|
|
812
822
|
// This covers the following cases of nested overlay based components:
|
|
813
823
|
// 1. Moving focus to the nested overlay (e.g. vaadin-select, vaadin-menu-bar)
|
|
814
824
|
// 2. Closing not focused nested overlay on outside (e.g. vaadin-combo-box)
|
|
815
|
-
if (!isLastOverlay(this._overlayElement)) {
|
|
825
|
+
if (!isLastOverlay(this._overlayElement) && hasOnlyNestedOverlays(this._overlayElement)) {
|
|
816
826
|
return;
|
|
817
827
|
}
|
|
818
828
|
|
|
@@ -854,14 +864,12 @@ class Popover extends PopoverPositionMixin(
|
|
|
854
864
|
|
|
855
865
|
/** @private */
|
|
856
866
|
__onOverlayMouseLeave(event) {
|
|
857
|
-
// Do not close the
|
|
858
|
-
|
|
859
|
-
// setting `pointer-events: none` on the body (combo-box, date-picker etc).
|
|
860
|
-
if (!isLastOverlay(this._overlayElement)) {
|
|
867
|
+
// Do not close if the pointer moves to the target
|
|
868
|
+
if (event.relatedTarget === this.target) {
|
|
861
869
|
return;
|
|
862
870
|
}
|
|
863
|
-
|
|
864
|
-
if (
|
|
871
|
+
// Do not close if there is a nested overlay that should be closed through some method first.
|
|
872
|
+
if (!isLastOverlay(this._overlayElement) && hasOnlyNestedOverlays(this._overlayElement)) {
|
|
865
873
|
return;
|
|
866
874
|
}
|
|
867
875
|
|
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": "24.9.
|
|
4
|
+
"version": "24.9.7",
|
|
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\n`<vaadin-popover>` uses `<vaadin-popover-overlay>` internal\nthemable component as the actual visible overlay.\n\nSee [`<vaadin-overlay>`](https://cdn.vaadin.com/vaadin-web-components/24.9.
|
|
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\n`<vaadin-popover>` uses `<vaadin-popover-overlay>` internal\nthemable component as the actual visible overlay.\n\nSee [`<vaadin-overlay>`](https://cdn.vaadin.com/vaadin-web-components/24.9.7/#/elements/vaadin-overlay) documentation\nfor `<vaadin-popover-overlay>` parts.\n\nIn addition to `<vaadin-overlay>` parts, the following parts are available for styling:\n\nPart name | Description\n-----------------|-------------------------------------------\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\nNote: the `theme` attribute value set on `<vaadin-popover>` is\npropagated to the internal `<vaadin-popover-overlay>` component.\n\n### Custom CSS Properties\n\nThe following custom CSS properties are available on the `<vaadin-popover>` element:\n\nCustom CSS property | Description\n---------------------------------|-------------\n`--vaadin-popover-offset-top` | Used as an offset when the popover is aligned vertically below the target\n`--vaadin-popover-offset-bottom` | Used as an offset when the popover is aligned vertically above the target\n`--vaadin-popover-offset-start` | Used as an offset when the popover is aligned horizontally after the target\n`--vaadin-popover-offset-end` | Used as an offset when the popover is aligned horizontally before the target\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.",
|
|
12
12
|
"attributes": [
|
|
13
13
|
{
|
|
14
14
|
"name": "overlay-class",
|
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": "24.9.
|
|
4
|
+
"version": "24.9.7",
|
|
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\n`<vaadin-popover>` uses `<vaadin-popover-overlay>` internal\nthemable component as the actual visible overlay.\n\nSee [`<vaadin-overlay>`](https://cdn.vaadin.com/vaadin-web-components/24.9.
|
|
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\n`<vaadin-popover>` uses `<vaadin-popover-overlay>` internal\nthemable component as the actual visible overlay.\n\nSee [`<vaadin-overlay>`](https://cdn.vaadin.com/vaadin-web-components/24.9.7/#/elements/vaadin-overlay) documentation\nfor `<vaadin-popover-overlay>` parts.\n\nIn addition to `<vaadin-overlay>` parts, the following parts are available for styling:\n\nPart name | Description\n-----------------|-------------------------------------------\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\nNote: the `theme` attribute value set on `<vaadin-popover>` is\npropagated to the internal `<vaadin-popover-overlay>` component.\n\n### Custom CSS Properties\n\nThe following custom CSS properties are available on the `<vaadin-popover>` element:\n\nCustom CSS property | Description\n---------------------------------|-------------\n`--vaadin-popover-offset-top` | Used as an offset when the popover is aligned vertically below the target\n`--vaadin-popover-offset-bottom` | Used as an offset when the popover is aligned vertically above the target\n`--vaadin-popover-offset-start` | Used as an offset when the popover is aligned horizontally after the target\n`--vaadin-popover-offset-end` | Used as an offset when the popover is aligned horizontally before the target\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.",
|
|
20
20
|
"extension": true,
|
|
21
21
|
"attributes": [
|
|
22
22
|
{
|