@vaadin/popover 25.0.0-alpha1 → 25.0.0-alpha10

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/popover",
3
- "version": "25.0.0-alpha1",
3
+ "version": "25.0.0-alpha10",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -23,6 +23,8 @@
23
23
  "lit.d.ts",
24
24
  "lit.js",
25
25
  "src",
26
+ "!src/styles/*-base-styles.d.ts",
27
+ "!src/styles/*-base-styles.js",
26
28
  "theme",
27
29
  "vaadin-*.d.ts",
28
30
  "vaadin-*.js",
@@ -37,23 +39,23 @@
37
39
  ],
38
40
  "dependencies": {
39
41
  "@open-wc/dedupe-mixin": "^1.3.0",
40
- "@vaadin/a11y-base": "25.0.0-alpha1",
41
- "@vaadin/component-base": "25.0.0-alpha1",
42
- "@vaadin/lit-renderer": "25.0.0-alpha1",
43
- "@vaadin/overlay": "25.0.0-alpha1",
44
- "@vaadin/vaadin-lumo-styles": "25.0.0-alpha1",
45
- "@vaadin/vaadin-themable-mixin": "25.0.0-alpha1",
42
+ "@vaadin/a11y-base": "25.0.0-alpha10",
43
+ "@vaadin/component-base": "25.0.0-alpha10",
44
+ "@vaadin/lit-renderer": "25.0.0-alpha10",
45
+ "@vaadin/overlay": "25.0.0-alpha10",
46
+ "@vaadin/vaadin-lumo-styles": "25.0.0-alpha10",
47
+ "@vaadin/vaadin-themable-mixin": "25.0.0-alpha10",
46
48
  "lit": "^3.0.0"
47
49
  },
48
50
  "devDependencies": {
49
- "@vaadin/chai-plugins": "25.0.0-alpha1",
50
- "@vaadin/test-runner-commands": "25.0.0-alpha1",
51
- "@vaadin/testing-helpers": "^1.1.0",
51
+ "@vaadin/chai-plugins": "25.0.0-alpha10",
52
+ "@vaadin/test-runner-commands": "25.0.0-alpha10",
53
+ "@vaadin/testing-helpers": "^2.0.0",
52
54
  "sinon": "^18.0.0"
53
55
  },
54
56
  "web-types": [
55
57
  "web-types.json",
56
58
  "web-types.lit.json"
57
59
  ],
58
- "gitHead": "b8c22a4a0c64156210d0daac96b43ae4e5526d49"
60
+ "gitHead": "6cc6c94079e805fa5b2f0af4dbf3b2a7485e57d0"
59
61
  }
@@ -0,0 +1,8 @@
1
+ /**
2
+ * @license
3
+ * Copyright (c) 2024 - 2025 Vaadin Ltd.
4
+ * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
+ */
6
+ import type { CSSResult } from 'lit';
7
+
8
+ export const popoverOverlayStyles: CSSResult;
@@ -0,0 +1,210 @@
1
+ /**
2
+ * @license
3
+ * Copyright (c) 2024 - 2025 Vaadin Ltd.
4
+ * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
+ */
6
+ import { css } from 'lit';
7
+ import { overlayStyles } from '@vaadin/overlay/src/styles/vaadin-overlay-base-styles.js';
8
+
9
+ const popoverOverlay = css`
10
+ :host {
11
+ --_arrow-size: var(--vaadin-popover-arrow-size, 8px);
12
+ --_default-offset: 4px;
13
+ --_rtl-multiplier: 1;
14
+ --_border-width: var(--vaadin-popover-border-width, var(--vaadin-overlay-border-width, 1px));
15
+ }
16
+
17
+ [part='overlay']:focus-visible {
18
+ outline: var(--vaadin-focus-ring-width) solid var(--vaadin-focus-ring-color);
19
+ }
20
+
21
+ :host([dir='rtl']) {
22
+ --_rtl-multiplier: -1;
23
+ }
24
+
25
+ :host([modeless][with-backdrop]) [part='backdrop'] {
26
+ pointer-events: none;
27
+ }
28
+
29
+ :host([position^='top'][top-aligned]) [part='overlay'],
30
+ :host([position^='bottom'][top-aligned]) [part='overlay'] {
31
+ margin-top: var(--vaadin-popover-offset-top, var(--_default-offset));
32
+ }
33
+
34
+ [part='overlay'] {
35
+ position: relative;
36
+ overflow: visible;
37
+ max-height: 100%;
38
+ border: var(--_border-width) solid
39
+ var(--vaadin-popover-border-color, var(--vaadin-overlay-border-color, var(--vaadin-border-color)));
40
+ background: var(--vaadin-popover-background, var(--vaadin-overlay-background, var(--vaadin-background-color)));
41
+ box-shadow: var(--vaadin-popover-box-shadow, var(--vaadin-overlay-box-shadow, 0 8px 24px -4px rgba(0, 0, 0, 0.3)));
42
+ }
43
+
44
+ [part='content'] {
45
+ overflow: auto;
46
+ overscroll-behavior: contain;
47
+ box-sizing: border-box;
48
+ max-height: 100%;
49
+ padding: var(--vaadin-popover-padding, var(--vaadin-padding));
50
+ }
51
+
52
+ :host([theme~='no-padding']) [part='content'] {
53
+ padding: 0 !important;
54
+ }
55
+
56
+ /* Increase the area of the popover so the pointer can go from the target directly to it. */
57
+ [part='overlay']::before {
58
+ position: absolute;
59
+ content: '';
60
+ inset-block: calc(var(--vaadin-popover-offset-top, var(--_default-offset)) * -1)
61
+ calc(var(--vaadin-popover-offset-bottom, var(--_default-offset)) * -1);
62
+ inset-inline: calc(var(--vaadin-popover-offset-start, var(--_default-offset)) * -1)
63
+ calc(var(--vaadin-popover-offset-end, var(--_default-offset)) * -1);
64
+ z-index: -1;
65
+ pointer-events: auto;
66
+ }
67
+
68
+ :host([position^='top'][bottom-aligned]) [part='overlay'],
69
+ :host([position^='bottom'][bottom-aligned]) [part='overlay'] {
70
+ margin-bottom: var(--vaadin-popover-offset-bottom, var(--_default-offset));
71
+ }
72
+
73
+ :host([position^='start'][start-aligned]) [part='overlay'],
74
+ :host([position^='end'][start-aligned]) [part='overlay'] {
75
+ margin-inline-start: var(--vaadin-popover-offset-start, var(--_default-offset));
76
+ }
77
+
78
+ :host([position^='start'][end-aligned]) [part='overlay'],
79
+ :host([position^='end'][end-aligned]) [part='overlay'] {
80
+ margin-inline-end: var(--vaadin-popover-offset-end, var(--_default-offset));
81
+ }
82
+
83
+ [part='arrow'] {
84
+ display: none;
85
+ }
86
+
87
+ :host([theme~='arrow']) {
88
+ --_default-offset: calc(4px + var(--_arrow-size) / 2);
89
+ }
90
+
91
+ :host([theme~='arrow']) [part='arrow'] {
92
+ display: block;
93
+ position: absolute;
94
+ background: inherit;
95
+ border: inherit;
96
+ border-start-start-radius: var(--vaadin-popover-arrow-border-radius, 0);
97
+ outline: inherit;
98
+ box-shadow: inherit;
99
+ width: var(--_arrow-size);
100
+ height: var(--_arrow-size);
101
+ rotate: 45deg;
102
+ --o: 20px; /* clip-path outset, how far outward it extends to reveal the outline and box shadow */
103
+ --b: var(--_border-width);
104
+ /* We need this elaborate clip-path to allow the arrow bg and border to cover
105
+ the overlay border but prevent the outline and box-shadow from covering it */
106
+ clip-path: polygon(
107
+ calc(var(--o) * -1) calc(var(--o) * -1),
108
+ calc(100% + var(--o) - var(--b)) calc(var(--o) * -1),
109
+ calc(100% - var(--b) * 1.4) 0,
110
+ 100% 0,
111
+ calc(100% - var(--b)) var(--b),
112
+ calc(100% - var(--b)) calc(var(--b) + var(--ff, 0px)),
113
+ calc(var(--b) + var(--ff, 0px)) calc(100% - var(--b)),
114
+ calc(var(--b)) calc(100% - var(--b)),
115
+ 0 100%,
116
+ 0 calc(100% - var(--b) * 1.4),
117
+ calc(var(--o) * -1) calc(100% + var(--o) - var(--b))
118
+ );
119
+ }
120
+
121
+ /* Firefox renders a blurry edge for a diagonal clip-path + rotation,
122
+ so we need to extend the clip-path slightly further on the diagonal */
123
+ @supports (-moz-appearance: none) {
124
+ :host([theme~='arrow']) [part='arrow'] {
125
+ --ff: 1px;
126
+ }
127
+ }
128
+
129
+ /* bottom / top */
130
+ :host([theme~='arrow']:is([position^='bottom'], [position^='top'])[start-aligned]) [part='arrow'] {
131
+ inset-inline-start: calc(var(--_arrow-size) * 2);
132
+ }
133
+
134
+ :host([theme~='arrow']:is([position^='bottom'], [position^='top'])[end-aligned]) [part='arrow'] {
135
+ inset-inline-end: calc(var(--_arrow-size) * 2);
136
+ }
137
+
138
+ :host([theme~='arrow']:is([position^='bottom'], [position^='top'])[arrow-centered]) [part='arrow'] {
139
+ inset-inline-start: 50%;
140
+ }
141
+
142
+ /* bottom */
143
+ :host([theme~='arrow']:is([position^='bottom'], [position^='top'])[top-aligned]) [part='arrow'] {
144
+ top: 0;
145
+ translate: calc(-50% * var(--_rtl-multiplier)) -50%;
146
+ }
147
+
148
+ :host([theme~='arrow']:is([position^='bottom'], [position^='top'])[end-aligned][top-aligned]) [part='arrow'] {
149
+ translate: calc(50% * var(--_rtl-multiplier)) -50%;
150
+ }
151
+
152
+ /* top */
153
+ :host([theme~='arrow']:is([position^='bottom'], [position^='top'])[bottom-aligned]) [part='arrow'] {
154
+ bottom: 0;
155
+ rotate: 225deg;
156
+ translate: calc(-50% * var(--_rtl-multiplier)) 50%;
157
+ }
158
+
159
+ :host([theme~='arrow']:is([position^='bottom'], [position^='top'])[end-aligned][bottom-aligned]) [part='arrow'] {
160
+ translate: calc(50% * var(--_rtl-multiplier)) 50%;
161
+ }
162
+
163
+ /* start / end */
164
+ :host([theme~='arrow']:is([position^='start'], [position^='end'])[top-aligned]) [part='arrow'] {
165
+ rotate: -45deg;
166
+ top: calc(var(--_arrow-size) * 2);
167
+ }
168
+
169
+ :host([theme~='arrow']:is([position^='start'], [position^='end'])[bottom-aligned]) [part='arrow'] {
170
+ rotate: -45deg;
171
+ bottom: calc(var(--_arrow-size) * 2);
172
+ }
173
+
174
+ :host([theme~='arrow']:is([position='start'], [position='end'])[top-aligned]) [part='arrow'] {
175
+ top: 50%;
176
+ }
177
+
178
+ :host([dir='rtl'][theme~='arrow']:is([position^='start'], [position^='end'])) [part='arrow'] {
179
+ scale: -1;
180
+ }
181
+
182
+ /* end */
183
+ :host([theme~='arrow']:is([position^='start'], [position^='end'])[start-aligned]) [part='arrow'] {
184
+ inset-inline-start: 0;
185
+ translate: calc(-50% * var(--_rtl-multiplier)) -50%;
186
+ }
187
+
188
+ :host([theme~='arrow']:is([position^='start'], [position^='end'])[start-aligned][bottom-aligned]) [part='arrow'] {
189
+ translate: calc(-50% * var(--_rtl-multiplier)) 50%;
190
+ }
191
+
192
+ /* start */
193
+ :host([theme~='arrow']:is([position^='start'], [position^='end'])[end-aligned]) [part='arrow'] {
194
+ rotate: 135deg;
195
+ inset-inline-end: 0;
196
+ translate: calc(50% * var(--_rtl-multiplier)) -50%;
197
+ }
198
+
199
+ :host([theme~='arrow']:is([position^='start'], [position^='end'])[end-aligned][bottom-aligned]) [part='arrow'] {
200
+ translate: calc(50% * var(--_rtl-multiplier)) 50%;
201
+ }
202
+
203
+ @media (forced-colors: active) {
204
+ :host {
205
+ --_border-width: 3px;
206
+ }
207
+ }
208
+ `;
209
+
210
+ export const popoverOverlayStyles = [overlayStyles, popoverOverlay];
@@ -0,0 +1,8 @@
1
+ /**
2
+ * @license
3
+ * Copyright (c) 2024 - 2025 Vaadin Ltd.
4
+ * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
+ */
6
+ import type { CSSResult } from 'lit';
7
+
8
+ export const popoverOverlayStyles: CSSResult;
@@ -0,0 +1,74 @@
1
+ /**
2
+ * @license
3
+ * Copyright (c) 2024 - 2025 Vaadin Ltd.
4
+ * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
+ */
6
+ import { css } from 'lit';
7
+ import { overlayStyles } from '@vaadin/overlay/src/styles/vaadin-overlay-core-styles.js';
8
+
9
+ const popoverOverlay = css`
10
+ :host {
11
+ --_default-offset: 0;
12
+ }
13
+
14
+ :host([modeless][with-backdrop]) [part='backdrop'] {
15
+ pointer-events: none;
16
+ }
17
+
18
+ :host([position^='top'][top-aligned]) [part='overlay'],
19
+ :host([position^='bottom'][top-aligned]) [part='overlay'] {
20
+ margin-top: var(--vaadin-popover-offset-top, var(--_default-offset));
21
+ }
22
+
23
+ [part='overlay'] {
24
+ position: relative;
25
+ overflow: visible;
26
+ max-height: 100%;
27
+ }
28
+
29
+ [part='content'] {
30
+ overflow: auto;
31
+ box-sizing: border-box;
32
+ max-height: 100%;
33
+ }
34
+
35
+ /* Increase the area of the popover so the pointer can go from the target directly to it. */
36
+ [part='overlay']::before {
37
+ position: absolute;
38
+ content: '';
39
+ inset-block: calc(var(--vaadin-popover-offset-top, var(--_default-offset)) * -1)
40
+ calc(var(--vaadin-popover-offset-bottom, var(--_default-offset)) * -1);
41
+ inset-inline: calc(var(--vaadin-popover-offset-start, var(--_default-offset)) * -1)
42
+ calc(var(--vaadin-popover-offset-end, var(--_default-offset)) * -1);
43
+ z-index: -1;
44
+ pointer-events: auto;
45
+ }
46
+
47
+ :host([position^='top'][bottom-aligned]) [part='overlay'],
48
+ :host([position^='bottom'][bottom-aligned]) [part='overlay'] {
49
+ margin-bottom: var(--vaadin-popover-offset-bottom, var(--_default-offset));
50
+ }
51
+
52
+ :host([position^='start'][start-aligned]) [part='overlay'],
53
+ :host([position^='end'][start-aligned]) [part='overlay'] {
54
+ margin-inline-start: var(--vaadin-popover-offset-start, var(--_default-offset));
55
+ }
56
+
57
+ :host([position^='start'][end-aligned]) [part='overlay'],
58
+ :host([position^='end'][end-aligned]) [part='overlay'] {
59
+ margin-inline-end: var(--vaadin-popover-offset-end, var(--_default-offset));
60
+ }
61
+
62
+ [part='arrow'] {
63
+ display: none;
64
+ position: absolute;
65
+ height: 0;
66
+ width: 0;
67
+ }
68
+
69
+ :host([theme~='arrow']) [part='arrow'] {
70
+ display: block;
71
+ }
72
+ `;
73
+
74
+ export const popoverOverlayStyles = [overlayStyles, popoverOverlay];
@@ -5,26 +5,6 @@
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
- };
28
8
 
29
9
  /**
30
10
  * A mixin providing common popover overlay functionality.
@@ -44,34 +24,6 @@ export const PopoverOverlayMixin = (superClass) =>
44
24
  };
45
25
  }
46
26
 
47
- static get observers() {
48
- return ['__openedOrTargetChanged(opened, positionTarget)'];
49
- }
50
-
51
- /**
52
- * Tag name prefix used by custom properties.
53
- * @protected
54
- * @return {string}
55
- */
56
- get _tagNamePrefix() {
57
- return 'vaadin-popover';
58
- }
59
-
60
- requestContentUpdate() {
61
- super.requestContentUpdate();
62
-
63
- // Copy custom properties from the owner
64
- if (this.positionTarget && this.owner) {
65
- const style = getComputedStyle(this.owner);
66
- ['top', 'bottom', 'start', 'end'].forEach((prop) => {
67
- this.style.setProperty(
68
- `--${this._tagNamePrefix}-offset-${prop}`,
69
- style.getPropertyValue(`--${this._tagNamePrefix}-offset-${prop}`),
70
- );
71
- });
72
- }
73
- }
74
-
75
27
  /**
76
28
  * @protected
77
29
  * @override
@@ -120,14 +72,4 @@ export const PopoverOverlayMixin = (superClass) =>
120
72
  this.style.top = `${overlayRect.top + offset}px`;
121
73
  }
122
74
  }
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
- }
133
75
  };
@@ -3,12 +3,14 @@
3
3
  * Copyright (c) 2024 - 2025 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
- import { css, html, LitElement } from 'lit';
6
+ import { html, LitElement } from 'lit';
7
+ import { isElementFocused } from '@vaadin/a11y-base/src/focus-utils.js';
7
8
  import { defineCustomElement } from '@vaadin/component-base/src/define.js';
8
9
  import { DirMixin } from '@vaadin/component-base/src/dir-mixin.js';
9
10
  import { PolylitMixin } from '@vaadin/component-base/src/polylit-mixin.js';
10
- import { overlayStyles } from '@vaadin/overlay/src/vaadin-overlay-styles.js';
11
+ import { LumoInjectionMixin } from '@vaadin/vaadin-themable-mixin/lumo-injection-mixin.js';
11
12
  import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
13
+ import { popoverOverlayStyles } from './styles/vaadin-popover-overlay-core-styles.js';
12
14
  import { PopoverOverlayMixin } from './vaadin-popover-overlay-mixin.js';
13
15
 
14
16
  /**
@@ -21,80 +23,15 @@ import { PopoverOverlayMixin } from './vaadin-popover-overlay-mixin.js';
21
23
  * @mixes ThemableMixin
22
24
  * @private
23
25
  */
24
- class PopoverOverlay extends PopoverOverlayMixin(DirMixin(ThemableMixin(PolylitMixin(LitElement)))) {
26
+ class PopoverOverlay extends PopoverOverlayMixin(
27
+ DirMixin(ThemableMixin(PolylitMixin(LumoInjectionMixin(LitElement)))),
28
+ ) {
25
29
  static get is() {
26
30
  return 'vaadin-popover-overlay';
27
31
  }
28
32
 
29
33
  static get styles() {
30
- return [
31
- overlayStyles,
32
- css`
33
- :host {
34
- --_vaadin-popover-content-width: auto;
35
- --_vaadin-popover-content-height: auto;
36
- }
37
-
38
- :host([modeless][with-backdrop]) [part='backdrop'] {
39
- pointer-events: none;
40
- }
41
-
42
- :host([position^='top'][top-aligned]) [part='overlay'],
43
- :host([position^='bottom'][top-aligned]) [part='overlay'] {
44
- margin-top: var(--vaadin-popover-offset-top, 0);
45
- }
46
-
47
- [part='overlay'] {
48
- position: relative;
49
- overflow: visible;
50
- max-height: 100%;
51
- }
52
-
53
- [part='content'] {
54
- overflow: auto;
55
- box-sizing: border-box;
56
- max-height: 100%;
57
- width: var(--_vaadin-popover-content-width);
58
- height: var(--_vaadin-popover-content-height);
59
- }
60
-
61
- /* Increase the area of the popover so the pointer can go from the target directly to it. */
62
- [part='overlay']::before {
63
- position: absolute;
64
- content: '';
65
- inset-block: calc(var(--vaadin-popover-offset-top, 0) * -1) calc(var(--vaadin-popover-offset-bottom, 0) * -1);
66
- inset-inline: calc(var(--vaadin-popover-offset-start, 0) * -1) calc(var(--vaadin-popover-offset-end, 0) * -1);
67
- z-index: -1;
68
- pointer-events: auto;
69
- }
70
-
71
- :host([position^='top'][bottom-aligned]) [part='overlay'],
72
- :host([position^='bottom'][bottom-aligned]) [part='overlay'] {
73
- margin-bottom: var(--vaadin-popover-offset-bottom, 0);
74
- }
75
-
76
- :host([position^='start'][start-aligned]) [part='overlay'],
77
- :host([position^='end'][start-aligned]) [part='overlay'] {
78
- margin-inline-start: var(--vaadin-popover-offset-start, 0);
79
- }
80
-
81
- :host([position^='start'][end-aligned]) [part='overlay'],
82
- :host([position^='end'][end-aligned]) [part='overlay'] {
83
- margin-inline-end: var(--vaadin-popover-offset-end, 0);
84
- }
85
-
86
- [part='arrow'] {
87
- display: none;
88
- position: absolute;
89
- height: 0;
90
- width: 0;
91
- }
92
-
93
- :host([theme~='arrow']) [part='arrow'] {
94
- display: block;
95
- }
96
- `,
97
- ];
34
+ return popoverOverlayStyles;
98
35
  }
99
36
 
100
37
  /** @protected */
@@ -107,6 +44,37 @@ class PopoverOverlay extends PopoverOverlayMixin(DirMixin(ThemableMixin(PolylitM
107
44
  </div>
108
45
  `;
109
46
  }
47
+
48
+ /** @protected */
49
+ updated(props) {
50
+ super.updated(props);
51
+
52
+ if (props.has('restoreFocusNode') && this.opened) {
53
+ // Save focus to be restored when target is set while opened
54
+ if (this.restoreFocusNode && isElementFocused(this.restoreFocusNode.focusElement || this.restoreFocusNode)) {
55
+ this.__focusRestorationController.saveFocus();
56
+ } else if (!this.restoreFocusNode) {
57
+ // Do not restore focus when target is cleared while opened
58
+ this.__focusRestorationController.focusNode = null;
59
+ }
60
+ }
61
+ }
62
+
63
+ /**
64
+ * @override
65
+ * @protected
66
+ */
67
+ get _contentRoot() {
68
+ return this.owner;
69
+ }
70
+
71
+ /**
72
+ * @override
73
+ * @protected
74
+ */
75
+ get _modalRoot() {
76
+ return this.owner;
77
+ }
110
78
  }
111
79
 
112
80
  defineCustomElement(PopoverOverlay);
@@ -37,16 +37,13 @@ export type PopoverEventMap = HTMLElementEventMap & PopoverCustomEventMap;
37
37
  *
38
38
  * ### Styling
39
39
  *
40
- * `<vaadin-popover>` uses `<vaadin-popover-overlay>` internal
41
- * themable component as the actual visible overlay.
42
- *
43
- * See [`<vaadin-overlay>`](#/elements/vaadin-overlay) documentation
44
- * for `<vaadin-popover-overlay>` parts.
45
- *
46
- * In addition to `<vaadin-overlay>` parts, the following parts are available for styling:
40
+ * The following shadow DOM parts are available for styling:
47
41
  *
48
42
  * Part name | Description
49
43
  * -----------------|-------------------------------------------
44
+ * `backdrop` | Backdrop of the overlay
45
+ * `overlay` | The overlay container
46
+ * `content` | The overlay content
50
47
  * `arrow` | Optional arrow pointing to the target when using `theme="arrow"`
51
48
  *
52
49
  * The following state attributes are available for styling:
@@ -55,9 +52,6 @@ export type PopoverEventMap = HTMLElementEventMap & PopoverCustomEventMap;
55
52
  * -----------------|----------------------------------------
56
53
  * `position` | Reflects the `position` property value.
57
54
  *
58
- * Note: the `theme` attribute value set on `<vaadin-popover>` is
59
- * propagated to the internal `<vaadin-popover-overlay>` component.
60
- *
61
55
  * ### Custom CSS Properties
62
56
  *
63
57
  * The following custom CSS properties are available on the `<vaadin-popover>` element:
@@ -96,14 +90,14 @@ declare class Popover extends PopoverPositionMixin(
96
90
  static setDefaultHoverDelay(hoverDelay: number): void;
97
91
 
98
92
  /**
99
- * String used to label the overlay to screen reader users.
93
+ * String used to label the popover to screen reader users.
100
94
  *
101
95
  * @attr {string} accessible-name
102
96
  */
103
97
  accessibleName: string | null | undefined;
104
98
 
105
99
  /**
106
- * Id of the element used as label of the overlay to screen reader users.
100
+ * Id of the element used as label of the popover to screen reader users.
107
101
  *
108
102
  * @attr {string} accessible-name-ref
109
103
  */
@@ -116,18 +110,16 @@ declare class Popover extends PopoverPositionMixin(
116
110
  autofocus: boolean;
117
111
 
118
112
  /**
119
- * Height to be set on the overlay content.
120
- *
121
- * @attr {string} content-height
113
+ * Set the height of the overlay.
114
+ * If a unitless number is provided, pixels are assumed.
122
115
  */
123
- contentHeight: string;
116
+ height: string | null;
124
117
 
125
118
  /**
126
- * Width to be set on the overlay content.
127
- *
128
- * @attr {string} content-width
119
+ * Set the width of the overlay.
120
+ * If a unitless number is provided, pixels are assumed.
129
121
  */
130
- contentWidth: string;
122
+ width: string | null;
131
123
 
132
124
  /**
133
125
  * The delay in milliseconds before the popover is opened
@@ -17,7 +17,7 @@ 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 { isLastOverlay } from '@vaadin/overlay/src/vaadin-overlay-stack-mixin.js';
20
+ import { isLastOverlay as isLastOverlayBase } from '@vaadin/overlay/src/vaadin-overlay-stack-mixin.js';
21
21
  import { ThemePropertyMixin } from '@vaadin/vaadin-themable-mixin/vaadin-theme-property-mixin.js';
22
22
  import { PopoverPositionMixin } from './vaadin-popover-position-mixin.js';
23
23
  import { PopoverTargetMixin } from './vaadin-popover-target-mixin.js';
@@ -148,6 +148,18 @@ class PopoverOpenedStateController {
148
148
  }
149
149
  }
150
150
 
151
+ /**
152
+ * Returns true if the popover overlay is the last one in the opened overlays stack, ignoring tooltips.
153
+ * @param {HTMLElement} overlay
154
+ * @return {boolean}
155
+ * @protected
156
+ */
157
+ const isLastOverlay = (overlay) => {
158
+ // Ignore tooltips, popovers should still close when a tooltip is present
159
+ const filter = (o) => o.localName !== 'vaadin-tooltip-overlay';
160
+ return isLastOverlayBase(overlay, filter);
161
+ };
162
+
151
163
  /**
152
164
  * `<vaadin-popover>` is a Web Component for creating overlays
153
165
  * that are positioned next to specified DOM element (target).
@@ -157,16 +169,13 @@ class PopoverOpenedStateController {
157
169
  *
158
170
  * ### Styling
159
171
  *
160
- * `<vaadin-popover>` uses `<vaadin-popover-overlay>` internal
161
- * themable component as the actual visible overlay.
162
- *
163
- * See [`<vaadin-overlay>`](#/elements/vaadin-overlay) documentation
164
- * for `<vaadin-popover-overlay>` parts.
165
- *
166
- * In addition to `<vaadin-overlay>` parts, the following parts are available for styling:
172
+ * The following shadow DOM parts are available for styling:
167
173
  *
168
174
  * Part name | Description
169
175
  * -----------------|-------------------------------------------
176
+ * `backdrop` | Backdrop of the overlay
177
+ * `overlay` | The overlay container
178
+ * `content` | The overlay content
170
179
  * `arrow` | Optional arrow pointing to the target when using `theme="arrow"`
171
180
  *
172
181
  * The following state attributes are available for styling:
@@ -175,9 +184,6 @@ class PopoverOpenedStateController {
175
184
  * -----------------|----------------------------------------
176
185
  * `position` | Reflects the `position` property value.
177
186
  *
178
- * Note: the `theme` attribute value set on `<vaadin-popover>` is
179
- * propagated to the internal `<vaadin-popover-overlay>` component.
180
- *
181
187
  * ### Custom CSS Properties
182
188
  *
183
189
  * The following custom CSS properties are available on the `<vaadin-popover>` element:
@@ -212,7 +218,7 @@ class Popover extends PopoverPositionMixin(
212
218
  static get styles() {
213
219
  return css`
214
220
  :host {
215
- display: none !important;
221
+ display: contents;
216
222
  }
217
223
  `;
218
224
  }
@@ -220,7 +226,7 @@ class Popover extends PopoverPositionMixin(
220
226
  static get properties() {
221
227
  return {
222
228
  /**
223
- * String used to label the overlay to screen reader users.
229
+ * String used to label the popover to screen reader users.
224
230
  *
225
231
  * @attr {string} accessible-name
226
232
  */
@@ -229,7 +235,7 @@ class Popover extends PopoverPositionMixin(
229
235
  },
230
236
 
231
237
  /**
232
- * Id of the element used as label of the overlay to screen reader users.
238
+ * Id of the element used as label of the popover to screen reader users.
233
239
  *
234
240
  * @attr {string} accessible-name-ref
235
241
  */
@@ -246,20 +252,18 @@ class Popover extends PopoverPositionMixin(
246
252
  },
247
253
 
248
254
  /**
249
- * Height to be set on the overlay content.
250
- *
251
- * @attr {string} content-height
255
+ * Set the height of the overlay.
256
+ * If a unitless number is provided, pixels are assumed.
252
257
  */
253
- contentHeight: {
258
+ height: {
254
259
  type: String,
255
260
  },
256
261
 
257
262
  /**
258
- * Width to be set on the overlay content.
259
- *
260
- * @attr {string} content-width
263
+ * Set the width of the overlay.
264
+ * If a unitless number is provided, pixels are assumed.
261
265
  */
262
- contentWidth: {
266
+ width: {
263
267
  type: String,
264
268
  },
265
269
 
@@ -310,6 +314,15 @@ class Popover extends PopoverPositionMixin(
310
314
  observer: '__openedChanged',
311
315
  },
312
316
 
317
+ /**
318
+ * The `role` attribute value to be set on the popover.
319
+ * When not specified, defaults to 'dialog'.
320
+ */
321
+ role: {
322
+ type: String,
323
+ reflectToAttribute: true,
324
+ },
325
+
313
326
  /**
314
327
  * The `role` attribute value to be set on the overlay.
315
328
  *
@@ -317,7 +330,6 @@ class Popover extends PopoverPositionMixin(
317
330
  */
318
331
  overlayRole: {
319
332
  type: String,
320
- value: 'dialog',
321
333
  },
322
334
 
323
335
  /**
@@ -405,20 +417,11 @@ class Popover extends PopoverPositionMixin(
405
417
  value: false,
406
418
  sync: true,
407
419
  },
408
-
409
- /** @private */
410
- __overlayId: {
411
- type: String,
412
- },
413
420
  };
414
421
  }
415
422
 
416
423
  static get observers() {
417
- return [
418
- '__updateContentHeight(contentHeight, _overlayElement)',
419
- '__updateContentWidth(contentWidth, _overlayElement)',
420
- '__updateAriaAttributes(opened, overlayRole, target)',
421
- ];
424
+ return ['__sizeChanged(width, height, _overlayElement)', '__updateAriaAttributes(opened, role, target)'];
422
425
  }
423
426
 
424
427
  /**
@@ -454,7 +457,7 @@ class Popover extends PopoverPositionMixin(
454
457
  constructor() {
455
458
  super();
456
459
 
457
- this.__overlayId = `vaadin-popover-${generateUniqueId()}`;
460
+ this.__generatedId = `vaadin-popover-${generateUniqueId()}`;
458
461
 
459
462
  this.__onGlobalClick = this.__onGlobalClick.bind(this);
460
463
  this.__onGlobalKeyDown = this.__onGlobalKeyDown.bind(this);
@@ -473,10 +476,7 @@ class Popover extends PopoverPositionMixin(
473
476
 
474
477
  return html`
475
478
  <vaadin-popover-overlay
476
- id="${this.__overlayId}"
477
- role="${this.overlayRole}"
478
- aria-label="${ifDefined(this.accessibleName)}"
479
- aria-labelledby="${ifDefined(this.accessibleNameRef)}"
479
+ id="overlay"
480
480
  .renderer="${this.renderer}"
481
481
  .owner="${this}"
482
482
  theme="${ifDefined(this._theme)}"
@@ -498,11 +498,14 @@ class Popover extends PopoverPositionMixin(
498
498
  @opened-changed="${this.__onOpenedChanged}"
499
499
  .restoreFocusOnClose="${this.__shouldRestoreFocus}"
500
500
  .restoreFocusNode="${this.target}"
501
+ exportparts="backdrop, overlay, content, arrow"
501
502
  @vaadin-overlay-escape-press="${this.__onEscapePress}"
502
503
  @vaadin-overlay-outside-click="${this.__onOutsideClick}"
503
504
  @vaadin-overlay-open="${this.__onOverlayOpened}"
504
505
  @vaadin-overlay-closed="${this.__onOverlayClosed}"
505
- ></vaadin-popover-overlay>
506
+ >
507
+ <slot></slot>
508
+ </vaadin-popover-overlay>
506
509
  `;
507
510
  }
508
511
 
@@ -524,13 +527,52 @@ class Popover extends PopoverPositionMixin(
524
527
  ready() {
525
528
  super.ready();
526
529
 
527
- this._overlayElement = this.$[this.__overlayId];
530
+ this._overlayElement = this.$.overlay;
531
+
532
+ if (!this.hasAttribute('role')) {
533
+ this.role = 'dialog';
534
+ }
535
+ }
536
+
537
+ /** @protected */
538
+ willUpdate(props) {
539
+ super.willUpdate(props);
540
+
541
+ if (props.has('overlayRole')) {
542
+ this.role = this.overlayRole;
543
+ }
544
+ }
545
+
546
+ /** @protected */
547
+ updated(props) {
548
+ super.updated(props);
549
+
550
+ if (props.has('accessibleName')) {
551
+ if (this.accessibleName) {
552
+ this.setAttribute('aria-label', this.accessibleName);
553
+ } else {
554
+ this.removeAttribute('aria-label');
555
+ }
556
+ }
557
+
558
+ if (props.has('accessibleNameRef')) {
559
+ if (this.accessibleNameRef) {
560
+ this.setAttribute('aria-labelledby', this.accessibleNameRef);
561
+ } else {
562
+ this.removeAttribute('aria-labelledby');
563
+ }
564
+ }
528
565
  }
529
566
 
530
567
  /** @protected */
531
568
  connectedCallback() {
532
569
  super.connectedCallback();
533
570
 
571
+ // If no user ID is provided, set generated ID
572
+ if (!this.id) {
573
+ this.id = this.__generatedId;
574
+ }
575
+
534
576
  document.documentElement.addEventListener('click', this.__onGlobalClick, true);
535
577
  }
536
578
 
@@ -585,7 +627,7 @@ class Popover extends PopoverPositionMixin(
585
627
  }
586
628
 
587
629
  /** @private */
588
- __updateAriaAttributes(opened, overlayRole, target) {
630
+ __updateAriaAttributes(opened, role, target) {
589
631
  if (this.__oldTarget) {
590
632
  const oldEffectiveTarget = this.__oldTarget.ariaTarget || this.__oldTarget;
591
633
  oldEffectiveTarget.removeAttribute('aria-haspopup');
@@ -596,13 +638,13 @@ class Popover extends PopoverPositionMixin(
596
638
  if (target) {
597
639
  const effectiveTarget = target.ariaTarget || target;
598
640
 
599
- const isDialog = overlayRole === 'dialog' || overlayRole === 'alertdialog';
641
+ const isDialog = role === 'dialog' || role === 'alertdialog';
600
642
  effectiveTarget.setAttribute('aria-haspopup', isDialog ? 'dialog' : 'true');
601
643
 
602
644
  effectiveTarget.setAttribute('aria-expanded', opened ? 'true' : 'false');
603
645
 
604
646
  if (opened) {
605
- effectiveTarget.setAttribute('aria-controls', this.__overlayId);
647
+ effectiveTarget.setAttribute('aria-controls', this.id);
606
648
  } else {
607
649
  effectiveTarget.removeAttribute('aria-controls');
608
650
  }
@@ -781,7 +823,7 @@ class Popover extends PopoverPositionMixin(
781
823
  return;
782
824
  }
783
825
 
784
- if ((this.__hasTrigger('focus') && this.__mouseDownInside) || this._overlayElement.contains(event.relatedTarget)) {
826
+ if ((this.__hasTrigger('focus') && this.__mouseDownInside) || this.contains(event.relatedTarget)) {
785
827
  return;
786
828
  }
787
829
 
@@ -809,7 +851,7 @@ class Popover extends PopoverPositionMixin(
809
851
  return;
810
852
  }
811
853
 
812
- if (this._overlayElement.contains(event.relatedTarget)) {
854
+ if (this.contains(event.relatedTarget)) {
813
855
  return;
814
856
  }
815
857
 
@@ -840,7 +882,8 @@ class Popover extends PopoverPositionMixin(
840
882
  if (
841
883
  (this.__hasTrigger('focus') && this.__mouseDownInside) ||
842
884
  event.relatedTarget === this.target ||
843
- this._overlayElement.contains(event.relatedTarget)
885
+ event.relatedTarget === this._overlayElement ||
886
+ this.contains(event.relatedTarget)
844
887
  ) {
845
888
  return;
846
889
  }
@@ -898,6 +941,11 @@ class Popover extends PopoverPositionMixin(
898
941
  }
899
942
 
900
943
  if (this.__hasTrigger('focus')) {
944
+ // Do not restore focus if closed on focusout on Tab
945
+ if (isKeyboardActive()) {
946
+ this.__shouldRestoreFocus = false;
947
+ }
948
+
901
949
  this._openedStateController.close(true);
902
950
  }
903
951
  }
@@ -971,27 +1019,9 @@ class Popover extends PopoverPositionMixin(
971
1019
  }
972
1020
 
973
1021
  /** @private */
974
- __updateDimension(overlay, dimension, value) {
975
- const prop = `--_vaadin-popover-content-${dimension}`;
976
-
977
- if (value) {
978
- overlay.style.setProperty(prop, value);
979
- } else {
980
- overlay.style.removeProperty(prop);
981
- }
982
- }
983
-
984
- /** @private */
985
- __updateContentHeight(height, overlay) {
986
- if (overlay) {
987
- this.__updateDimension(overlay, 'height', height);
988
- }
989
- }
990
-
991
- /** @private */
992
- __updateContentWidth(width, overlay) {
1022
+ __sizeChanged(width, height, overlay) {
993
1023
  if (overlay) {
994
- this.__updateDimension(overlay, 'width', width);
1024
+ requestAnimationFrame(() => overlay.setBounds({ width, height }, false));
995
1025
  }
996
1026
  }
997
1027
 
@@ -7,12 +7,8 @@ import { css, registerStyles } from '@vaadin/vaadin-themable-mixin/vaadin-themab
7
7
 
8
8
  const popoverOverlay = css`
9
9
  :host {
10
- --vaadin-popover-offset-top: var(--_vaadin-popover-default-offset);
11
- --vaadin-popover-offset-bottom: var(--_vaadin-popover-default-offset);
12
- --vaadin-popover-offset-start: var(--_vaadin-popover-default-offset);
13
- --vaadin-popover-offset-end: var(--_vaadin-popover-default-offset);
14
10
  --vaadin-popover-arrow-size: 0.5rem;
15
- --_vaadin-popover-default-offset: var(--lumo-space-xs);
11
+ --_default-offset: var(--lumo-space-xs);
16
12
  }
17
13
 
18
14
  [part='overlay'] {
@@ -24,11 +20,11 @@ const popoverOverlay = css`
24
20
  }
25
21
 
26
22
  :host([theme~='no-padding']) [part='content'] {
27
- padding: 0;
23
+ padding: 0 !important;
28
24
  }
29
25
 
30
26
  :host([theme~='arrow']) {
31
- --_vaadin-popover-default-offset: calc(var(--lumo-space-s) + var(--vaadin-popover-arrow-size) / 2);
27
+ --_default-offset: calc(var(--lumo-space-s) + var(--vaadin-popover-arrow-size) / 2);
32
28
  }
33
29
 
34
30
  /* top / bottom position */
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.0-alpha1",
4
+ "version": "25.0.0-alpha10",
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/25.0.0-alpha1/#/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.",
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\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",
@@ -45,7 +45,7 @@
45
45
  },
46
46
  {
47
47
  "name": "accessible-name",
48
- "description": "String used to label the overlay to screen reader users.",
48
+ "description": "String used to label the popover to screen reader users.",
49
49
  "value": {
50
50
  "type": [
51
51
  "string",
@@ -56,7 +56,7 @@
56
56
  },
57
57
  {
58
58
  "name": "accessible-name-ref",
59
- "description": "Id of the element used as label of the overlay to screen reader users.",
59
+ "description": "Id of the element used as label of the popover to screen reader users.",
60
60
  "value": {
61
61
  "type": [
62
62
  "string",
@@ -77,8 +77,8 @@
77
77
  }
78
78
  },
79
79
  {
80
- "name": "content-height",
81
- "description": "Height to be set on the overlay content.",
80
+ "name": "height",
81
+ "description": "Set the height of the overlay.\nIf a unitless number is provided, pixels are assumed.",
82
82
  "value": {
83
83
  "type": [
84
84
  "string",
@@ -88,8 +88,8 @@
88
88
  }
89
89
  },
90
90
  {
91
- "name": "content-width",
92
- "description": "Width to be set on the overlay content.",
91
+ "name": "width",
92
+ "description": "Set the width of the overlay.\nIf a unitless number is provided, pixels are assumed.",
93
93
  "value": {
94
94
  "type": [
95
95
  "string",
@@ -142,6 +142,17 @@
142
142
  ]
143
143
  }
144
144
  },
145
+ {
146
+ "name": "role",
147
+ "description": "The `role` attribute value to be set on the popover.\nWhen not specified, defaults to 'dialog'.",
148
+ "value": {
149
+ "type": [
150
+ "string",
151
+ "null",
152
+ "undefined"
153
+ ]
154
+ }
155
+ },
145
156
  {
146
157
  "name": "overlay-role",
147
158
  "description": "The `role` attribute value to be set on the overlay.",
@@ -257,7 +268,7 @@
257
268
  },
258
269
  {
259
270
  "name": "accessibleName",
260
- "description": "String used to label the overlay to screen reader users.",
271
+ "description": "String used to label the popover to screen reader users.",
261
272
  "value": {
262
273
  "type": [
263
274
  "string",
@@ -268,7 +279,7 @@
268
279
  },
269
280
  {
270
281
  "name": "accessibleNameRef",
271
- "description": "Id of the element used as label of the overlay to screen reader users.",
282
+ "description": "Id of the element used as label of the popover to screen reader users.",
272
283
  "value": {
273
284
  "type": [
274
285
  "string",
@@ -289,8 +300,8 @@
289
300
  }
290
301
  },
291
302
  {
292
- "name": "contentHeight",
293
- "description": "Height to be set on the overlay content.",
303
+ "name": "height",
304
+ "description": "Set the height of the overlay.\nIf a unitless number is provided, pixels are assumed.",
294
305
  "value": {
295
306
  "type": [
296
307
  "string",
@@ -300,8 +311,8 @@
300
311
  }
301
312
  },
302
313
  {
303
- "name": "contentWidth",
304
- "description": "Width to be set on the overlay content.",
314
+ "name": "width",
315
+ "description": "Set the width of the overlay.\nIf a unitless number is provided, pixels are assumed.",
305
316
  "value": {
306
317
  "type": [
307
318
  "string",
@@ -354,6 +365,17 @@
354
365
  ]
355
366
  }
356
367
  },
368
+ {
369
+ "name": "role",
370
+ "description": "The `role` attribute value to be set on the popover.\nWhen not specified, defaults to 'dialog'.",
371
+ "value": {
372
+ "type": [
373
+ "string",
374
+ "null",
375
+ "undefined"
376
+ ]
377
+ }
378
+ },
357
379
  {
358
380
  "name": "overlayRole",
359
381
  "description": "The `role` attribute value to be set on the overlay.",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/web-types",
3
3
  "name": "@vaadin/popover",
4
- "version": "25.0.0-alpha1",
4
+ "version": "25.0.0-alpha10",
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/25.0.0-alpha1/#/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.",
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\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
  {
@@ -91,28 +91,28 @@
91
91
  },
92
92
  {
93
93
  "name": ".accessibleName",
94
- "description": "String used to label the overlay to screen reader users.",
94
+ "description": "String used to label the popover to screen reader users.",
95
95
  "value": {
96
96
  "kind": "expression"
97
97
  }
98
98
  },
99
99
  {
100
100
  "name": ".accessibleNameRef",
101
- "description": "Id of the element used as label of the overlay to screen reader users.",
101
+ "description": "Id of the element used as label of the popover to screen reader users.",
102
102
  "value": {
103
103
  "kind": "expression"
104
104
  }
105
105
  },
106
106
  {
107
- "name": ".contentHeight",
108
- "description": "Height to be set on the overlay content.",
107
+ "name": ".height",
108
+ "description": "Set the height of the overlay.\nIf a unitless number is provided, pixels are assumed.",
109
109
  "value": {
110
110
  "kind": "expression"
111
111
  }
112
112
  },
113
113
  {
114
- "name": ".contentWidth",
115
- "description": "Width to be set on the overlay content.",
114
+ "name": ".width",
115
+ "description": "Set the width of the overlay.\nIf a unitless number is provided, pixels are assumed.",
116
116
  "value": {
117
117
  "kind": "expression"
118
118
  }
@@ -138,6 +138,13 @@
138
138
  "kind": "expression"
139
139
  }
140
140
  },
141
+ {
142
+ "name": ".role",
143
+ "description": "The `role` attribute value to be set on the popover.\nWhen not specified, defaults to 'dialog'.",
144
+ "value": {
145
+ "kind": "expression"
146
+ }
147
+ },
141
148
  {
142
149
  "name": ".overlayRole",
143
150
  "description": "The `role` attribute value to be set on the overlay.",