@vaadin/popover 24.7.0-alpha8 → 24.7.0-beta1
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 +34 -0
- package/src/vaadin-popover.js +17 -18
- 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.7.0-
|
|
3
|
+
"version": "24.7.0-beta1",
|
|
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.7.0-
|
|
41
|
-
"@vaadin/component-base": "24.7.0-
|
|
42
|
-
"@vaadin/lit-renderer": "24.7.0-
|
|
43
|
-
"@vaadin/overlay": "24.7.0-
|
|
44
|
-
"@vaadin/vaadin-lumo-styles": "24.7.0-
|
|
45
|
-
"@vaadin/vaadin-material-styles": "24.7.0-
|
|
46
|
-
"@vaadin/vaadin-themable-mixin": "24.7.0-
|
|
40
|
+
"@vaadin/a11y-base": "24.7.0-beta1",
|
|
41
|
+
"@vaadin/component-base": "24.7.0-beta1",
|
|
42
|
+
"@vaadin/lit-renderer": "24.7.0-beta1",
|
|
43
|
+
"@vaadin/overlay": "24.7.0-beta1",
|
|
44
|
+
"@vaadin/vaadin-lumo-styles": "24.7.0-beta1",
|
|
45
|
+
"@vaadin/vaadin-material-styles": "24.7.0-beta1",
|
|
46
|
+
"@vaadin/vaadin-themable-mixin": "24.7.0-beta1",
|
|
47
47
|
"lit": "^3.0.0"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
|
-
"@vaadin/chai-plugins": "24.7.0-
|
|
51
|
-
"@vaadin/test-runner-commands": "24.7.0-
|
|
50
|
+
"@vaadin/chai-plugins": "24.7.0-beta1",
|
|
51
|
+
"@vaadin/test-runner-commands": "24.7.0-beta1",
|
|
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": "4043c518ef9b915cde612d2907ddc9bd10e5af17"
|
|
60
60
|
}
|
|
@@ -5,6 +5,26 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import { OverlayMixin } from '@vaadin/overlay/src/vaadin-overlay-mixin.js';
|
|
7
7
|
import { PositionMixin } from '@vaadin/overlay/src/vaadin-overlay-position-mixin.js';
|
|
8
|
+
import { setNestedOverlay } from '@vaadin/overlay/src/vaadin-overlay-stack-mixin.js';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Returns the closest parent overlay for given node, if any.
|
|
12
|
+
* @param {HTMLElement} node
|
|
13
|
+
* @return {HTMLElement}
|
|
14
|
+
*/
|
|
15
|
+
const getClosestOverlay = (node) => {
|
|
16
|
+
let n = node;
|
|
17
|
+
|
|
18
|
+
while (n && n !== node.ownerDocument) {
|
|
19
|
+
n = n.parentNode || n.host;
|
|
20
|
+
|
|
21
|
+
if (n && n._hasOverlayStackMixin) {
|
|
22
|
+
return n;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
return null;
|
|
27
|
+
};
|
|
8
28
|
|
|
9
29
|
/**
|
|
10
30
|
* A mixin providing common popover overlay functionality.
|
|
@@ -24,6 +44,10 @@ export const PopoverOverlayMixin = (superClass) =>
|
|
|
24
44
|
};
|
|
25
45
|
}
|
|
26
46
|
|
|
47
|
+
static get observers() {
|
|
48
|
+
return ['__openedOrTargetChanged(opened, positionTarget)'];
|
|
49
|
+
}
|
|
50
|
+
|
|
27
51
|
/**
|
|
28
52
|
* Tag name prefix used by custom properties.
|
|
29
53
|
* @protected
|
|
@@ -96,4 +120,14 @@ export const PopoverOverlayMixin = (superClass) =>
|
|
|
96
120
|
this.style.top = `${overlayRect.top + offset}px`;
|
|
97
121
|
}
|
|
98
122
|
}
|
|
123
|
+
|
|
124
|
+
/** @private */
|
|
125
|
+
__openedOrTargetChanged(opened, target) {
|
|
126
|
+
if (target) {
|
|
127
|
+
const parent = getClosestOverlay(target);
|
|
128
|
+
if (parent) {
|
|
129
|
+
setNestedOverlay(parent, opened ? this : null);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
}
|
|
99
133
|
};
|
package/src/vaadin-popover.js
CHANGED
|
@@ -409,8 +409,7 @@ class Popover extends PopoverPositionMixin(
|
|
|
409
409
|
return [
|
|
410
410
|
'__updateContentHeight(contentHeight, _overlayElement)',
|
|
411
411
|
'__updateContentWidth(contentWidth, _overlayElement)',
|
|
412
|
-
'
|
|
413
|
-
'__overlayRoleOrTargetChanged(overlayRole, target)',
|
|
412
|
+
'__updateAriaAttributes(opened, overlayRole, target)',
|
|
414
413
|
];
|
|
415
414
|
}
|
|
416
415
|
|
|
@@ -578,27 +577,27 @@ class Popover extends PopoverPositionMixin(
|
|
|
578
577
|
}
|
|
579
578
|
|
|
580
579
|
/** @private */
|
|
581
|
-
|
|
582
|
-
if (target) {
|
|
583
|
-
target.setAttribute('aria-expanded', opened ? 'true' : 'false');
|
|
584
|
-
|
|
585
|
-
if (opened) {
|
|
586
|
-
target.setAttribute('aria-controls', this.__overlayId);
|
|
587
|
-
} else {
|
|
588
|
-
target.removeAttribute('aria-controls');
|
|
589
|
-
}
|
|
590
|
-
}
|
|
591
|
-
}
|
|
592
|
-
|
|
593
|
-
/** @private */
|
|
594
|
-
__overlayRoleOrTargetChanged(overlayRole, target) {
|
|
580
|
+
__updateAriaAttributes(opened, overlayRole, target) {
|
|
595
581
|
if (this.__oldTarget) {
|
|
596
|
-
this.__oldTarget.
|
|
582
|
+
const oldEffectiveTarget = this.__oldTarget.ariaTarget || this.__oldTarget;
|
|
583
|
+
oldEffectiveTarget.removeAttribute('aria-haspopup');
|
|
584
|
+
oldEffectiveTarget.removeAttribute('aria-expanded');
|
|
585
|
+
oldEffectiveTarget.removeAttribute('aria-controls');
|
|
597
586
|
}
|
|
598
587
|
|
|
599
588
|
if (target) {
|
|
589
|
+
const effectiveTarget = target.ariaTarget || target;
|
|
590
|
+
|
|
600
591
|
const isDialog = overlayRole === 'dialog' || overlayRole === 'alertdialog';
|
|
601
|
-
|
|
592
|
+
effectiveTarget.setAttribute('aria-haspopup', isDialog ? 'dialog' : 'true');
|
|
593
|
+
|
|
594
|
+
effectiveTarget.setAttribute('aria-expanded', opened ? 'true' : 'false');
|
|
595
|
+
|
|
596
|
+
if (opened) {
|
|
597
|
+
effectiveTarget.setAttribute('aria-controls', this.__overlayId);
|
|
598
|
+
} else {
|
|
599
|
+
effectiveTarget.removeAttribute('aria-controls');
|
|
600
|
+
}
|
|
602
601
|
|
|
603
602
|
this.__oldTarget = target;
|
|
604
603
|
}
|
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.7.0-
|
|
4
|
+
"version": "24.7.0-beta1",
|
|
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.7.0-
|
|
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.7.0-beta1/#/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.7.0-
|
|
4
|
+
"version": "24.7.0-beta1",
|
|
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.7.0-
|
|
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.7.0-beta1/#/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
|
{
|