@vaadin/popover 24.9.2 → 24.9.4
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.js +25 -0
- package/src/vaadin-popover.js +1 -34
- 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.4",
|
|
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.4",
|
|
41
|
+
"@vaadin/component-base": "~24.9.4",
|
|
42
|
+
"@vaadin/lit-renderer": "~24.9.4",
|
|
43
|
+
"@vaadin/overlay": "~24.9.4",
|
|
44
|
+
"@vaadin/vaadin-lumo-styles": "~24.9.4",
|
|
45
|
+
"@vaadin/vaadin-material-styles": "~24.9.4",
|
|
46
|
+
"@vaadin/vaadin-themable-mixin": "~24.9.4",
|
|
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.4",
|
|
51
|
+
"@vaadin/test-runner-commands": "~24.9.4",
|
|
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": "7084e972641ef2355ffc281cbd932c070f998ed1"
|
|
60
60
|
}
|
|
@@ -123,6 +123,31 @@ class PopoverOverlay extends PopoverOverlayMixin(DirMixin(ThemableMixin(PolylitM
|
|
|
123
123
|
}
|
|
124
124
|
}
|
|
125
125
|
}
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* Override method from `OverlayMixin` to always add outside
|
|
129
|
+
* click listener so that it can be used by modeless popover.
|
|
130
|
+
* @return {boolean}
|
|
131
|
+
* @protected
|
|
132
|
+
* @override
|
|
133
|
+
*/
|
|
134
|
+
_shouldAddGlobalListeners() {
|
|
135
|
+
return true;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* Override method from `OverlayMixin` to prevent closing when clicking on target.
|
|
140
|
+
* Clicking the target will already close the popover when using the click trigger.
|
|
141
|
+
*
|
|
142
|
+
* @override
|
|
143
|
+
* @protected
|
|
144
|
+
*/
|
|
145
|
+
_shouldCloseOnOutsideClick(event) {
|
|
146
|
+
if (event.composedPath().includes(this.positionTarget)) {
|
|
147
|
+
return false;
|
|
148
|
+
}
|
|
149
|
+
return super._shouldCloseOnOutsideClick(event);
|
|
150
|
+
}
|
|
126
151
|
}
|
|
127
152
|
|
|
128
153
|
defineCustomElement(PopoverOverlay);
|
package/src/vaadin-popover.js
CHANGED
|
@@ -468,7 +468,6 @@ class Popover extends PopoverPositionMixin(
|
|
|
468
468
|
|
|
469
469
|
this.__overlayId = `vaadin-popover-${generateUniqueId()}`;
|
|
470
470
|
|
|
471
|
-
this.__onGlobalClick = this.__onGlobalClick.bind(this);
|
|
472
471
|
this.__onGlobalKeyDown = this.__onGlobalKeyDown.bind(this);
|
|
473
472
|
this.__onTargetClick = this.__onTargetClick.bind(this);
|
|
474
473
|
this.__onTargetFocusIn = this.__onTargetFocusIn.bind(this);
|
|
@@ -539,19 +538,10 @@ class Popover extends PopoverPositionMixin(
|
|
|
539
538
|
this._overlayElement = this.$[this.__overlayId];
|
|
540
539
|
}
|
|
541
540
|
|
|
542
|
-
/** @protected */
|
|
543
|
-
connectedCallback() {
|
|
544
|
-
super.connectedCallback();
|
|
545
|
-
|
|
546
|
-
document.documentElement.addEventListener('click', this.__onGlobalClick, true);
|
|
547
|
-
}
|
|
548
|
-
|
|
549
541
|
/** @protected */
|
|
550
542
|
disconnectedCallback() {
|
|
551
543
|
super.disconnectedCallback();
|
|
552
544
|
|
|
553
|
-
document.documentElement.removeEventListener('click', this.__onGlobalClick, true);
|
|
554
|
-
|
|
555
545
|
// Automatically close popover when it is removed from DOM
|
|
556
546
|
// Avoid closing if the popover is just moved in the DOM
|
|
557
547
|
queueMicrotask(() => {
|
|
@@ -623,23 +613,6 @@ class Popover extends PopoverPositionMixin(
|
|
|
623
613
|
}
|
|
624
614
|
}
|
|
625
615
|
|
|
626
|
-
/**
|
|
627
|
-
* Overlay's global outside click listener doesn't work when
|
|
628
|
-
* the overlay is modeless, so we use a separate listener.
|
|
629
|
-
* @private
|
|
630
|
-
*/
|
|
631
|
-
__onGlobalClick(event) {
|
|
632
|
-
if (
|
|
633
|
-
this.opened &&
|
|
634
|
-
!this.modal &&
|
|
635
|
-
!event.composedPath().some((el) => el === this._overlayElement || el === this.target) &&
|
|
636
|
-
!this.noCloseOnOutsideClick &&
|
|
637
|
-
isLastOverlay(this._overlayElement)
|
|
638
|
-
) {
|
|
639
|
-
this._openedStateController.close(true);
|
|
640
|
-
}
|
|
641
|
-
}
|
|
642
|
-
|
|
643
616
|
/** @private */
|
|
644
617
|
__onTargetClick() {
|
|
645
618
|
if (this.__hasTrigger('click')) {
|
|
@@ -660,17 +633,11 @@ class Popover extends PopoverPositionMixin(
|
|
|
660
633
|
* @private
|
|
661
634
|
*/
|
|
662
635
|
__onGlobalKeyDown(event) {
|
|
663
|
-
// Modal popover uses overlay logic
|
|
636
|
+
// Modal popover uses overlay logic focus trap.
|
|
664
637
|
if (this.modal) {
|
|
665
638
|
return;
|
|
666
639
|
}
|
|
667
640
|
|
|
668
|
-
if (event.key === 'Escape' && !this.noCloseOnEsc && this.opened && isLastOverlay(this._overlayElement)) {
|
|
669
|
-
// Prevent closing parent overlay (e.g. dialog)
|
|
670
|
-
event.stopPropagation();
|
|
671
|
-
this._openedStateController.close(true);
|
|
672
|
-
}
|
|
673
|
-
|
|
674
641
|
// Include popover content in the Tab order after the target.
|
|
675
642
|
if (event.key === 'Tab') {
|
|
676
643
|
if (event.shiftKey) {
|
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.4",
|
|
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.4/#/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.4",
|
|
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.4/#/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
|
{
|