@vaadin/popover 25.0.0-alpha9 → 25.0.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 -14
- package/src/lit/renderer-directives.d.ts +2 -1
- package/src/lit/renderer-directives.js +2 -1
- package/src/styles/vaadin-popover-overlay-base-styles.js +5 -4
- package/src/vaadin-popover-overlay.js +36 -4
- package/src/vaadin-popover.d.ts +21 -20
- package/src/vaadin-popover.js +120 -96
- package/vaadin-popover.js +1 -1
- package/web-types.json +41 -41
- package/web-types.lit.json +18 -18
- package/src/styles/vaadin-popover-overlay-core-styles.d.ts +0 -8
- package/src/styles/vaadin-popover-overlay-core-styles.js +0 -74
- package/theme/lumo/vaadin-popover-styles.d.ts +0 -4
- package/theme/lumo/vaadin-popover-styles.js +0 -107
- package/theme/lumo/vaadin-popover.d.ts +0 -2
- package/theme/lumo/vaadin-popover.js +0 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vaadin/popover",
|
|
3
|
-
"version": "25.0.0-
|
|
3
|
+
"version": "25.0.0-beta1",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -23,9 +23,6 @@
|
|
|
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",
|
|
28
|
-
"theme",
|
|
29
26
|
"vaadin-*.d.ts",
|
|
30
27
|
"vaadin-*.js",
|
|
31
28
|
"web-types.json",
|
|
@@ -39,23 +36,23 @@
|
|
|
39
36
|
],
|
|
40
37
|
"dependencies": {
|
|
41
38
|
"@open-wc/dedupe-mixin": "^1.3.0",
|
|
42
|
-
"@vaadin/a11y-base": "25.0.0-
|
|
43
|
-
"@vaadin/component-base": "25.0.0-
|
|
44
|
-
"@vaadin/lit-renderer": "25.0.0-
|
|
45
|
-
"@vaadin/overlay": "25.0.0-
|
|
46
|
-
"@vaadin/vaadin-
|
|
47
|
-
"@vaadin/vaadin-themable-mixin": "25.0.0-alpha9",
|
|
39
|
+
"@vaadin/a11y-base": "25.0.0-beta1",
|
|
40
|
+
"@vaadin/component-base": "25.0.0-beta1",
|
|
41
|
+
"@vaadin/lit-renderer": "25.0.0-beta1",
|
|
42
|
+
"@vaadin/overlay": "25.0.0-beta1",
|
|
43
|
+
"@vaadin/vaadin-themable-mixin": "25.0.0-beta1",
|
|
48
44
|
"lit": "^3.0.0"
|
|
49
45
|
},
|
|
50
46
|
"devDependencies": {
|
|
51
|
-
"@vaadin/chai-plugins": "25.0.0-
|
|
52
|
-
"@vaadin/test-runner-commands": "25.0.0-
|
|
47
|
+
"@vaadin/chai-plugins": "25.0.0-beta1",
|
|
48
|
+
"@vaadin/test-runner-commands": "25.0.0-beta1",
|
|
53
49
|
"@vaadin/testing-helpers": "^2.0.0",
|
|
54
|
-
"
|
|
50
|
+
"@vaadin/vaadin-lumo-styles": "25.0.0-beta1",
|
|
51
|
+
"sinon": "^21.0.0"
|
|
55
52
|
},
|
|
56
53
|
"web-types": [
|
|
57
54
|
"web-types.json",
|
|
58
55
|
"web-types.lit.json"
|
|
59
56
|
],
|
|
60
|
-
"gitHead": "
|
|
57
|
+
"gitHead": "1d20cf54e582d1f2e209126d4586f8b4c01c50e0"
|
|
61
58
|
}
|
|
@@ -27,7 +27,7 @@ export class PopoverRendererDirective extends LitRendererDirective<Popover, Popo
|
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
/**
|
|
30
|
-
* A Lit directive for populating the content of the `<vaadin-popover
|
|
30
|
+
* A Lit directive for populating the content of the `<vaadin-popover>` element.
|
|
31
31
|
*
|
|
32
32
|
* The directive accepts a renderer callback returning a Lit template and assigns it to the popover
|
|
33
33
|
* via the `renderer` property. The renderer is called once to populate the content when assigned
|
|
@@ -51,6 +51,7 @@ export class PopoverRendererDirective extends LitRendererDirective<Popover, Popo
|
|
|
51
51
|
* @param renderer the renderer callback that returns a Lit template.
|
|
52
52
|
* @param dependencies a single dependency or an array of dependencies
|
|
53
53
|
* which trigger a re-render when changed.
|
|
54
|
+
* @deprecated Add content elements as children of the popover using default slot
|
|
54
55
|
*/
|
|
55
56
|
export declare function popoverRenderer(
|
|
56
57
|
renderer: PopoverLitRenderer,
|
|
@@ -32,7 +32,7 @@ export class PopoverRendererDirective extends LitRendererDirective {
|
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
/**
|
|
35
|
-
* A Lit directive for populating the content of the `<vaadin-popover
|
|
35
|
+
* A Lit directive for populating the content of the `<vaadin-popover>` element.
|
|
36
36
|
*
|
|
37
37
|
* The directive accepts a renderer callback returning a Lit template and assigns it to the popover
|
|
38
38
|
* via the `renderer` property. The renderer is called once to populate the content when assigned
|
|
@@ -56,5 +56,6 @@ export class PopoverRendererDirective extends LitRendererDirective {
|
|
|
56
56
|
* @param renderer the renderer callback that returns a Lit template.
|
|
57
57
|
* @param dependencies a single dependency or an array of dependencies
|
|
58
58
|
* which trigger a re-render when changed.
|
|
59
|
+
* @deprecated Add content elements as children of the popover using default slot
|
|
59
60
|
*/
|
|
60
61
|
export const popoverRenderer = directive(PopoverRendererDirective);
|
|
@@ -36,9 +36,10 @@ const popoverOverlay = css`
|
|
|
36
36
|
overflow: visible;
|
|
37
37
|
max-height: 100%;
|
|
38
38
|
border: var(--_border-width) solid
|
|
39
|
-
var(--vaadin-popover-border-color, var(--vaadin-overlay-border-color, var(--vaadin-border-color)));
|
|
39
|
+
var(--vaadin-popover-border-color, var(--vaadin-overlay-border-color, var(--vaadin-border-color-secondary)));
|
|
40
40
|
background: var(--vaadin-popover-background, var(--vaadin-overlay-background, var(--vaadin-background-color)));
|
|
41
|
-
box-shadow: var(--vaadin-popover-
|
|
41
|
+
box-shadow: var(--vaadin-popover-shadow, var(--vaadin-overlay-shadow, 0 8px 24px -4px rgba(0, 0, 0, 0.3)));
|
|
42
|
+
border-radius: var(--vaadin-popover-border-radius, var(--vaadin-overlay-border-radius, var(--vaadin-radius-m)));
|
|
42
43
|
}
|
|
43
44
|
|
|
44
45
|
[part='content'] {
|
|
@@ -46,7 +47,7 @@ const popoverOverlay = css`
|
|
|
46
47
|
overscroll-behavior: contain;
|
|
47
48
|
box-sizing: border-box;
|
|
48
49
|
max-height: 100%;
|
|
49
|
-
padding: var(--vaadin-popover-padding, var(--vaadin-padding));
|
|
50
|
+
padding: var(--vaadin-popover-padding, var(--vaadin-padding-s));
|
|
50
51
|
}
|
|
51
52
|
|
|
52
53
|
:host([theme~='no-padding']) [part='content'] {
|
|
@@ -85,7 +86,7 @@ const popoverOverlay = css`
|
|
|
85
86
|
}
|
|
86
87
|
|
|
87
88
|
:host([theme~='arrow']) {
|
|
88
|
-
--_default-offset:
|
|
89
|
+
--_default-offset: var(--_arrow-size);
|
|
89
90
|
}
|
|
90
91
|
|
|
91
92
|
:host([theme~='arrow']) [part='arrow'] {
|
|
@@ -10,7 +10,7 @@ import { DirMixin } from '@vaadin/component-base/src/dir-mixin.js';
|
|
|
10
10
|
import { PolylitMixin } from '@vaadin/component-base/src/polylit-mixin.js';
|
|
11
11
|
import { LumoInjectionMixin } from '@vaadin/vaadin-themable-mixin/lumo-injection-mixin.js';
|
|
12
12
|
import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
13
|
-
import { popoverOverlayStyles } from './styles/vaadin-popover-overlay-
|
|
13
|
+
import { popoverOverlayStyles } from './styles/vaadin-popover-overlay-base-styles.js';
|
|
14
14
|
import { PopoverOverlayMixin } from './vaadin-popover-overlay-mixin.js';
|
|
15
15
|
|
|
16
16
|
/**
|
|
@@ -34,11 +34,17 @@ class PopoverOverlay extends PopoverOverlayMixin(
|
|
|
34
34
|
return popoverOverlayStyles;
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
+
static get lumoInjector() {
|
|
38
|
+
return {
|
|
39
|
+
includeBaseStyles: true,
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
|
|
37
43
|
/** @protected */
|
|
38
44
|
render() {
|
|
39
45
|
return html`
|
|
40
46
|
<div id="backdrop" part="backdrop" hidden ?hidden="${!this.withBackdrop}"></div>
|
|
41
|
-
<div part="overlay" id="overlay"
|
|
47
|
+
<div part="overlay" id="overlay">
|
|
42
48
|
<div part="arrow"></div>
|
|
43
49
|
<div part="content" id="content"><slot></slot></div>
|
|
44
50
|
</div>
|
|
@@ -69,12 +75,38 @@ class PopoverOverlay extends PopoverOverlayMixin(
|
|
|
69
75
|
}
|
|
70
76
|
|
|
71
77
|
/**
|
|
72
|
-
*
|
|
78
|
+
* Override method from OverlayFocusMixin to use owner as focus trap root
|
|
73
79
|
* @protected
|
|
80
|
+
* @override
|
|
74
81
|
*/
|
|
75
|
-
get
|
|
82
|
+
get _focusTrapRoot() {
|
|
76
83
|
return this.owner;
|
|
77
84
|
}
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Override method from `OverlayMixin` to always add outside
|
|
88
|
+
* click listener so that it can be used by modeless popover.
|
|
89
|
+
* @return {boolean}
|
|
90
|
+
* @protected
|
|
91
|
+
* @override
|
|
92
|
+
*/
|
|
93
|
+
_shouldAddGlobalListeners() {
|
|
94
|
+
return true;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Override method from `OverlayMixin` to prevent closing when clicking on target.
|
|
99
|
+
* Clicking the target will already close the popover when using the click trigger.
|
|
100
|
+
*
|
|
101
|
+
* @override
|
|
102
|
+
* @protected
|
|
103
|
+
*/
|
|
104
|
+
_shouldCloseOnOutsideClick(event) {
|
|
105
|
+
if (event.composedPath().includes(this.positionTarget)) {
|
|
106
|
+
return false;
|
|
107
|
+
}
|
|
108
|
+
return super._shouldCloseOnOutsideClick(event);
|
|
109
|
+
}
|
|
78
110
|
}
|
|
79
111
|
|
|
80
112
|
defineCustomElement(PopoverOverlay);
|
package/src/vaadin-popover.d.ts
CHANGED
|
@@ -4,7 +4,6 @@
|
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
6
|
import { ElementMixin } from '@vaadin/component-base/src/element-mixin.js';
|
|
7
|
-
import { OverlayClassMixin } from '@vaadin/component-base/src/overlay-class-mixin.js';
|
|
8
7
|
import { ThemePropertyMixin } from '@vaadin/vaadin-themable-mixin/vaadin-theme-property-mixin.js';
|
|
9
8
|
import { PopoverPositionMixin } from './vaadin-popover-position-mixin.js';
|
|
10
9
|
import { PopoverTargetMixin } from './vaadin-popover-target-mixin.js';
|
|
@@ -68,9 +67,7 @@ export type PopoverEventMap = HTMLElementEventMap & PopoverCustomEventMap;
|
|
|
68
67
|
* @fires {CustomEvent} opened-changed - Fired when the `opened` property changes.
|
|
69
68
|
* @fires {CustomEvent} closed - Fired when the popover is closed.
|
|
70
69
|
*/
|
|
71
|
-
declare class Popover extends PopoverPositionMixin(
|
|
72
|
-
PopoverTargetMixin(OverlayClassMixin(ThemePropertyMixin(ElementMixin(HTMLElement)))),
|
|
73
|
-
) {
|
|
70
|
+
declare class Popover extends PopoverPositionMixin(PopoverTargetMixin(ThemePropertyMixin(ElementMixin(HTMLElement)))) {
|
|
74
71
|
/**
|
|
75
72
|
* Sets the default focus delay to be used by all popover instances,
|
|
76
73
|
* except for those that have focus delay configured using property.
|
|
@@ -93,6 +90,7 @@ declare class Popover extends PopoverPositionMixin(
|
|
|
93
90
|
* String used to label the popover to screen reader users.
|
|
94
91
|
*
|
|
95
92
|
* @attr {string} accessible-name
|
|
93
|
+
* @deprecated Use `aria-label` attribute on the popover instead
|
|
96
94
|
*/
|
|
97
95
|
accessibleName: string | null | undefined;
|
|
98
96
|
|
|
@@ -100,6 +98,7 @@ declare class Popover extends PopoverPositionMixin(
|
|
|
100
98
|
* Id of the element used as label of the popover to screen reader users.
|
|
101
99
|
*
|
|
102
100
|
* @attr {string} accessible-name-ref
|
|
101
|
+
* @deprecated Use `aria-labelledby` attribute on the popover instead
|
|
103
102
|
*/
|
|
104
103
|
accessibleNameRef: string | null | undefined;
|
|
105
104
|
|
|
@@ -110,13 +109,13 @@ declare class Popover extends PopoverPositionMixin(
|
|
|
110
109
|
autofocus: boolean;
|
|
111
110
|
|
|
112
111
|
/**
|
|
113
|
-
* Set the height of the
|
|
112
|
+
* Set the height of the popover.
|
|
114
113
|
* If a unitless number is provided, pixels are assumed.
|
|
115
114
|
*/
|
|
116
115
|
height: string | null;
|
|
117
116
|
|
|
118
117
|
/**
|
|
119
|
-
* Set the width of the
|
|
118
|
+
* Set the width of the popover.
|
|
120
119
|
* If a unitless number is provided, pixels are assumed.
|
|
121
120
|
*/
|
|
122
121
|
width: string | null;
|
|
@@ -153,60 +152,60 @@ declare class Popover extends PopoverPositionMixin(
|
|
|
153
152
|
hoverDelay: number;
|
|
154
153
|
|
|
155
154
|
/**
|
|
156
|
-
* True if the popover
|
|
155
|
+
* True if the popover is visible and available for interaction.
|
|
157
156
|
*/
|
|
158
157
|
opened: boolean;
|
|
159
158
|
|
|
160
159
|
/**
|
|
161
|
-
* The `role` attribute value to be set on the
|
|
160
|
+
* The `role` attribute value to be set on the popover.
|
|
162
161
|
*
|
|
163
162
|
* @attr {string} overlay-role
|
|
163
|
+
* @deprecated Use standard `role` attribute on the popover instead
|
|
164
164
|
*/
|
|
165
165
|
overlayRole: string;
|
|
166
166
|
|
|
167
167
|
/**
|
|
168
|
-
* Custom function for rendering the content of the
|
|
168
|
+
* Custom function for rendering the content of the popover.
|
|
169
169
|
* Receives two arguments:
|
|
170
170
|
*
|
|
171
171
|
* - `root` The root container DOM element. Append your content to it.
|
|
172
|
-
* - `popover` The reference to the `vaadin-popover` element
|
|
172
|
+
* - `popover` The reference to the `vaadin-popover` element.
|
|
173
|
+
*
|
|
174
|
+
* @deprecated Add content elements as children of the popover using default slot
|
|
173
175
|
*/
|
|
174
176
|
renderer: PopoverRenderer | null | undefined;
|
|
175
177
|
|
|
176
178
|
/**
|
|
177
179
|
* When true, the popover prevents interacting with background elements
|
|
178
180
|
* by setting `pointer-events` style on the document body to `none`.
|
|
179
|
-
* This also enables trapping focus inside the
|
|
181
|
+
* This also enables trapping focus inside the popover.
|
|
180
182
|
*/
|
|
181
183
|
modal: boolean;
|
|
182
184
|
|
|
183
185
|
/**
|
|
184
|
-
* Set to true to disable closing popover
|
|
186
|
+
* Set to true to disable closing popover on outside click.
|
|
185
187
|
*
|
|
186
188
|
* @attr {boolean} no-close-on-outside-click
|
|
187
189
|
*/
|
|
188
190
|
noCloseOnOutsideClick: boolean;
|
|
189
191
|
|
|
190
192
|
/**
|
|
191
|
-
* Set to true to disable closing popover
|
|
192
|
-
* When the popover is modal, pressing Escape anywhere in the
|
|
193
|
-
* document closes the overlay. Otherwise, only Escape press
|
|
194
|
-
* from the popover itself or its target closes the overlay.
|
|
193
|
+
* Set to true to disable closing popover on Escape press.
|
|
195
194
|
*
|
|
196
195
|
* @attr {boolean} no-close-on-esc
|
|
197
196
|
*/
|
|
198
197
|
noCloseOnEsc: boolean;
|
|
199
198
|
|
|
200
199
|
/**
|
|
201
|
-
* Popover trigger mode, used to configure how the
|
|
200
|
+
* Popover trigger mode, used to configure how the popover is opened or closed.
|
|
202
201
|
* Could be set to multiple by providing an array, e.g. `trigger = ['hover', 'focus']`.
|
|
203
202
|
*
|
|
204
203
|
* Supported values:
|
|
205
204
|
* - `click` (default) - opens and closes on target click.
|
|
206
205
|
* - `hover` - opens on target mouseenter, closes on target mouseleave. Moving mouse
|
|
207
|
-
* to the popover
|
|
206
|
+
* to the popover content keeps the popover opened.
|
|
208
207
|
* - `focus` - opens on target focus, closes on target blur. Moving focus to the
|
|
209
|
-
* popover
|
|
208
|
+
* popover content keeps the popover opened.
|
|
210
209
|
*
|
|
211
210
|
* In addition to the behavior specified by `trigger`, the popover can be closed by:
|
|
212
211
|
* - pressing Escape key (unless `noCloseOnEsc` property is true)
|
|
@@ -219,7 +218,7 @@ declare class Popover extends PopoverPositionMixin(
|
|
|
219
218
|
trigger: PopoverTrigger[] | null | undefined;
|
|
220
219
|
|
|
221
220
|
/**
|
|
222
|
-
* When true, the
|
|
221
|
+
* When true, the popover has a backdrop (modality curtain) on top of the
|
|
223
222
|
* underlying page content, covering the whole viewport.
|
|
224
223
|
*
|
|
225
224
|
* @attr {boolean} with-backdrop
|
|
@@ -231,6 +230,8 @@ declare class Popover extends PopoverPositionMixin(
|
|
|
231
230
|
* While performing the update, it invokes the renderer passed in the `renderer` property.
|
|
232
231
|
*
|
|
233
232
|
* It is not guaranteed that the update happens immediately (synchronously) after it is requested.
|
|
233
|
+
*
|
|
234
|
+
* @deprecated Add content elements as children of the popover using default slot
|
|
234
235
|
*/
|
|
235
236
|
requestContentUpdate(): void;
|
|
236
237
|
|