@vaadin/overlay 24.8.0-alpha8 → 25.0.0-alpha1

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/overlay",
3
- "version": "24.8.0-alpha8",
3
+ "version": "25.0.0-alpha1",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -21,6 +21,8 @@
21
21
  "type": "module",
22
22
  "files": [
23
23
  "src",
24
+ "!src/*-base-styles.d.ts",
25
+ "!src/*-base-styles.js",
24
26
  "theme",
25
27
  "vaadin-*.d.ts",
26
28
  "vaadin-*.js"
@@ -30,24 +32,21 @@
30
32
  "vaadin-overlay",
31
33
  "overlay",
32
34
  "web-components",
33
- "web-component",
34
- "polymer"
35
+ "web-component"
35
36
  ],
36
37
  "dependencies": {
37
38
  "@open-wc/dedupe-mixin": "^1.3.0",
38
- "@polymer/polymer": "^3.0.0",
39
- "@vaadin/a11y-base": "24.8.0-alpha8",
40
- "@vaadin/component-base": "24.8.0-alpha8",
41
- "@vaadin/vaadin-lumo-styles": "24.8.0-alpha8",
42
- "@vaadin/vaadin-material-styles": "24.8.0-alpha8",
43
- "@vaadin/vaadin-themable-mixin": "24.8.0-alpha8",
39
+ "@vaadin/a11y-base": "25.0.0-alpha1",
40
+ "@vaadin/component-base": "25.0.0-alpha1",
41
+ "@vaadin/vaadin-lumo-styles": "25.0.0-alpha1",
42
+ "@vaadin/vaadin-themable-mixin": "25.0.0-alpha1",
44
43
  "lit": "^3.0.0"
45
44
  },
46
45
  "devDependencies": {
47
- "@vaadin/chai-plugins": "24.8.0-alpha8",
48
- "@vaadin/test-runner-commands": "24.8.0-alpha8",
46
+ "@vaadin/chai-plugins": "25.0.0-alpha1",
47
+ "@vaadin/test-runner-commands": "25.0.0-alpha1",
49
48
  "@vaadin/testing-helpers": "^1.1.0",
50
49
  "sinon": "^18.0.0"
51
50
  },
52
- "gitHead": "d914bb8f669d7e3d1981feb8eac05688ab9870b4"
51
+ "gitHead": "b8c22a4a0c64156210d0daac96b43ae4e5526d49"
53
52
  }
@@ -0,0 +1,82 @@
1
+ /**
2
+ * @license
3
+ * Copyright (c) 2017 - 2025 Vaadin Ltd.
4
+ * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
+ */
6
+ import '@vaadin/component-base/src/style-props.js';
7
+ import { css } from 'lit';
8
+
9
+ export const overlayStyles = css`
10
+ @layer base {
11
+ :host {
12
+ z-index: 200;
13
+ position: fixed;
14
+
15
+ /* Despite of what the names say, <vaadin-overlay> is just a container
16
+ for position/sizing/alignment. The actual overlay is the overlay part. */
17
+
18
+ /* Default position constraints. Themes can
19
+ override this to adjust the gap between the overlay and the viewport. */
20
+ inset: 8px;
21
+ bottom: var(--vaadin-overlay-viewport-bottom);
22
+
23
+ /* Use flexbox alignment for the overlay part. */
24
+ display: flex;
25
+ flex-direction: column; /* makes dropdowns sizing easier */
26
+ /* Align to center by default. */
27
+ align-items: center;
28
+ justify-content: center;
29
+
30
+ /* Allow centering when max-width/max-height applies. */
31
+ margin: auto;
32
+
33
+ /* The host is not clickable, only the overlay part is. */
34
+ pointer-events: none;
35
+
36
+ /* Remove tap highlight on touch devices. */
37
+ -webkit-tap-highlight-color: transparent;
38
+
39
+ /* CSS API for host */
40
+ --vaadin-overlay-viewport-bottom: 8px;
41
+ }
42
+
43
+ :host([hidden]),
44
+ :host(:not([opened]):not([closing])),
45
+ :host(:not([opened]):not([closing])) [part='overlay'] {
46
+ display: none !important;
47
+ }
48
+
49
+ [part='overlay'] {
50
+ background: var(--vaadin-overlay-background, var(--_vaadin-background));
51
+ border: var(--vaadin-overlay-border, 1px solid var(--_vaadin-border-color));
52
+ border-radius: var(--vaadin-overlay-border-radius, var(--_vaadin-radius-m));
53
+ box-shadow: var(--vaadin-overlay-box-shadow, 0 8px 24px -4px hsl(0 0 0 / 0.3));
54
+ box-sizing: border-box;
55
+ max-width: 100%;
56
+ overflow: auto;
57
+ overscroll-behavior: contain;
58
+ pointer-events: auto;
59
+ -webkit-tap-highlight-color: initial;
60
+ }
61
+
62
+ [part='backdrop'] {
63
+ background: var(--vaadin-overlay-backdrop-background, rgba(0, 0, 0, 0.5));
64
+ content: '';
65
+ inset: 0;
66
+ pointer-events: auto;
67
+ position: fixed;
68
+ z-index: -1;
69
+ }
70
+
71
+ @media (forced-colors: active) {
72
+ [part='overlay'] {
73
+ border: 3px solid;
74
+ }
75
+
76
+ [part='overlay']:focus-visible {
77
+ outline: var(--vaadin-focus-ring-width) solid;
78
+ outline-offset: 1px;
79
+ }
80
+ }
81
+ }
82
+ `;
@@ -0,0 +1,67 @@
1
+ /**
2
+ * @license
3
+ * Copyright (c) 2017 - 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
+
8
+ export const overlayStyles = css`
9
+ :host {
10
+ z-index: 200;
11
+ position: fixed;
12
+
13
+ /* Despite of what the names say, <vaadin-overlay> is just a container
14
+ for position/sizing/alignment. The actual overlay is the overlay part. */
15
+
16
+ /* Default position constraints: the entire viewport. Note: themes can
17
+ override this to introduce gaps between the overlay and the viewport. */
18
+ inset: 0;
19
+ bottom: var(--vaadin-overlay-viewport-bottom);
20
+
21
+ /* Use flexbox alignment for the overlay part. */
22
+ display: flex;
23
+ flex-direction: column; /* makes dropdowns sizing easier */
24
+ /* Align to center by default. */
25
+ align-items: center;
26
+ justify-content: center;
27
+
28
+ /* Allow centering when max-width/max-height applies. */
29
+ margin: auto;
30
+
31
+ /* The host is not clickable, only the overlay part is. */
32
+ pointer-events: none;
33
+
34
+ /* Remove tap highlight on touch devices. */
35
+ -webkit-tap-highlight-color: transparent;
36
+
37
+ /* CSS API for host */
38
+ --vaadin-overlay-viewport-bottom: 0;
39
+ }
40
+
41
+ :host([hidden]),
42
+ :host(:not([opened]):not([closing])),
43
+ :host(:not([opened]):not([closing])) [part='overlay'] {
44
+ display: none !important;
45
+ }
46
+
47
+ [part='overlay'] {
48
+ -webkit-overflow-scrolling: touch;
49
+ overflow: auto;
50
+ pointer-events: auto;
51
+
52
+ /* Prevent overflowing the host */
53
+ max-width: 100%;
54
+ box-sizing: border-box;
55
+
56
+ -webkit-tap-highlight-color: initial; /* reenable tap highlight inside */
57
+ }
58
+
59
+ [part='backdrop'] {
60
+ z-index: -1;
61
+ content: '';
62
+ background: rgba(0, 0, 0, 0.5);
63
+ position: fixed;
64
+ inset: 0;
65
+ pointer-events: auto;
66
+ }
67
+ `;
@@ -4,11 +4,10 @@
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
6
  import type { Constructor } from '@open-wc/dedupe-mixin';
7
- import type { ControllerMixinClass } from '@vaadin/component-base/src/controller-mixin.js';
8
7
 
9
8
  export declare function OverlayFocusMixin<T extends Constructor<HTMLElement>>(
10
9
  base: T,
11
- ): Constructor<ControllerMixinClass> & Constructor<OverlayFocusMixinClass> & T;
10
+ ): Constructor<OverlayFocusMixinClass> & T;
12
11
 
13
12
  export declare class OverlayFocusMixinClass {
14
13
  /**
@@ -7,14 +7,12 @@ import { AriaModalController } from '@vaadin/a11y-base/src/aria-modal-controller
7
7
  import { FocusRestorationController } from '@vaadin/a11y-base/src/focus-restoration-controller.js';
8
8
  import { FocusTrapController } from '@vaadin/a11y-base/src/focus-trap-controller.js';
9
9
  import { getDeepActiveElement, isKeyboardActive } from '@vaadin/a11y-base/src/focus-utils.js';
10
- import { ControllerMixin } from '@vaadin/component-base/src/controller-mixin.js';
11
10
 
12
11
  /**
13
12
  * @polymerMixin
14
- * @mixes ControllerMixin
15
13
  */
16
14
  export const OverlayFocusMixin = (superClass) =>
17
- class OverlayFocusMixin extends ControllerMixin(superClass) {
15
+ class OverlayFocusMixin extends superClass {
18
16
  static get properties() {
19
17
  return {
20
18
  /**
@@ -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 type { Constructor } from '@open-wc/dedupe-mixin';
7
- import type { ControllerMixinClass } from '@vaadin/component-base/src/controller-mixin.js';
8
7
  import type { OverlayFocusMixinClass } from './vaadin-overlay-focus-mixin.js';
9
8
  import type { OverlayStackMixinClass } from './vaadin-overlay-stack-mixin.js';
10
9
 
@@ -12,11 +11,7 @@ export type OverlayRenderer = (root: HTMLElement, owner: HTMLElement, model?: ob
12
11
 
13
12
  export declare function OverlayMixin<T extends Constructor<HTMLElement>>(
14
13
  base: T,
15
- ): Constructor<ControllerMixinClass> &
16
- Constructor<OverlayFocusMixinClass> &
17
- Constructor<OverlayMixinClass> &
18
- Constructor<OverlayStackMixinClass> &
19
- T;
14
+ ): Constructor<OverlayFocusMixinClass> & Constructor<OverlayMixinClass> & Constructor<OverlayStackMixinClass> & T;
20
15
 
21
16
  export declare class OverlayMixinClass {
22
17
  /**
@@ -3,7 +3,6 @@
3
3
  * Copyright (c) 2017 - 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 { afterNextRender } from '@polymer/polymer/lib/utils/render-status.js';
7
6
  import { isIOS } from '@vaadin/component-base/src/browser-utils.js';
8
7
  import { OverlayFocusMixin } from './vaadin-overlay-focus-mixin.js';
9
8
  import { OverlayStackMixin } from './vaadin-overlay-stack-mixin.js';
@@ -266,11 +265,12 @@ export const OverlayMixin = (superClass) =>
266
265
 
267
266
  this._animatedOpening();
268
267
 
269
- afterNextRender(this, () => {
270
- this._trapFocus();
268
+ this.__scheduledOpen = requestAnimationFrame(() => {
269
+ setTimeout(() => {
270
+ this._trapFocus();
271
271
 
272
- const evt = new CustomEvent('vaadin-overlay-open', { bubbles: true });
273
- this.dispatchEvent(evt);
272
+ this.dispatchEvent(new CustomEvent('vaadin-overlay-open', { bubbles: true }));
273
+ });
274
274
  });
275
275
 
276
276
  document.addEventListener('keydown', this._boundKeydownListener);
@@ -279,6 +279,11 @@ export const OverlayMixin = (superClass) =>
279
279
  this._addGlobalListeners();
280
280
  }
281
281
  } else if (wasOpened) {
282
+ if (this.__scheduledOpen) {
283
+ cancelAnimationFrame(this.__scheduledOpen);
284
+ this.__scheduledOpen = null;
285
+ }
286
+
282
287
  this._resetFocus();
283
288
 
284
289
  this._animatedClosing();
@@ -3,65 +3,4 @@
3
3
  * Copyright (c) 2017 - 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 } from 'lit';
7
-
8
- export const overlayStyles = css`
9
- :host {
10
- z-index: 200;
11
- position: fixed;
12
-
13
- /* Despite of what the names say, <vaadin-overlay> is just a container
14
- for position/sizing/alignment. The actual overlay is the overlay part. */
15
-
16
- /* Default position constraints: the entire viewport. Note: themes can
17
- override this to introduce gaps between the overlay and the viewport. */
18
- inset: 0;
19
- bottom: var(--vaadin-overlay-viewport-bottom);
20
-
21
- /* Use flexbox alignment for the overlay part. */
22
- display: flex;
23
- flex-direction: column; /* makes dropdowns sizing easier */
24
- /* Align to center by default. */
25
- align-items: center;
26
- justify-content: center;
27
-
28
- /* Allow centering when max-width/max-height applies. */
29
- margin: auto;
30
-
31
- /* The host is not clickable, only the overlay part is. */
32
- pointer-events: none;
33
-
34
- /* Remove tap highlight on touch devices. */
35
- -webkit-tap-highlight-color: transparent;
36
-
37
- /* CSS API for host */
38
- --vaadin-overlay-viewport-bottom: 0;
39
- }
40
-
41
- :host([hidden]),
42
- :host(:not([opened]):not([closing])),
43
- :host(:not([opened]):not([closing])) [part='overlay'] {
44
- display: none !important;
45
- }
46
-
47
- [part='overlay'] {
48
- -webkit-overflow-scrolling: touch;
49
- overflow: auto;
50
- pointer-events: auto;
51
-
52
- /* Prevent overflowing the host */
53
- max-width: 100%;
54
- box-sizing: border-box;
55
-
56
- -webkit-tap-highlight-color: initial; /* reenable tap highlight inside */
57
- }
58
-
59
- [part='backdrop'] {
60
- z-index: -1;
61
- content: '';
62
- background: rgba(0, 0, 0, 0.5);
63
- position: fixed;
64
- inset: 0;
65
- pointer-events: auto;
66
- }
67
- `;
6
+ export { overlayStyles } from './vaadin-overlay-core-styles.js';
@@ -3,16 +3,14 @@
3
3
  * Copyright (c) 2017 - 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 { html, PolymerElement } from '@polymer/polymer/polymer-element.js';
6
+ import { html, LitElement } from 'lit';
7
7
  import { defineCustomElement } from '@vaadin/component-base/src/define.js';
8
8
  import { DirMixin } from '@vaadin/component-base/src/dir-mixin.js';
9
- import { processTemplates } from '@vaadin/component-base/src/templates.js';
10
- import { registerStyles, ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
9
+ import { PolylitMixin } from '@vaadin/component-base/src/polylit-mixin.js';
10
+ import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
11
11
  import { OverlayMixin } from './vaadin-overlay-mixin.js';
12
12
  import { overlayStyles } from './vaadin-overlay-styles.js';
13
13
 
14
- registerStyles('vaadin-overlay', overlayStyles, { moduleId: 'vaadin-overlay-styles' });
15
-
16
14
  /**
17
15
  * `<vaadin-overlay>` is a Web Component for creating overlays. The content of the overlay
18
16
  * can be populated imperatively by using `renderer` callback function.
@@ -78,10 +76,19 @@ registerStyles('vaadin-overlay', overlayStyles, { moduleId: 'vaadin-overlay-styl
78
76
  * @mixes DirMixin
79
77
  * @mixes OverlayMixin
80
78
  */
81
- class Overlay extends OverlayMixin(ThemableMixin(DirMixin(PolymerElement))) {
82
- static get template() {
79
+ class Overlay extends OverlayMixin(DirMixin(ThemableMixin(PolylitMixin(LitElement)))) {
80
+ static get is() {
81
+ return 'vaadin-overlay';
82
+ }
83
+
84
+ static get styles() {
85
+ return overlayStyles;
86
+ }
87
+
88
+ /** @protected */
89
+ render() {
83
90
  return html`
84
- <div id="backdrop" part="backdrop" hidden$="[[!withBackdrop]]"></div>
91
+ <div id="backdrop" part="backdrop" ?hidden="${!this.withBackdrop}"></div>
85
92
  <div part="overlay" id="overlay" tabindex="0">
86
93
  <div part="content" id="content">
87
94
  <slot></slot>
@@ -90,17 +97,6 @@ class Overlay extends OverlayMixin(ThemableMixin(DirMixin(PolymerElement))) {
90
97
  `;
91
98
  }
92
99
 
93
- static get is() {
94
- return 'vaadin-overlay';
95
- }
96
-
97
- /** @protected */
98
- ready() {
99
- super.ready();
100
-
101
- processTemplates(this);
102
- }
103
-
104
100
  /**
105
101
  * @event vaadin-overlay-open
106
102
  * Fired after the overlay is opened.
@@ -1,23 +0,0 @@
1
- /**
2
- * @license
3
- * Copyright (c) 2017 - 2025 Vaadin Ltd.
4
- * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
- */
6
- import { LitElement } from 'lit';
7
- import { DirMixin } from '@vaadin/component-base/src/dir-mixin.js';
8
- import { PolylitMixin } from '@vaadin/component-base/src/polylit-mixin.js';
9
- import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
10
- import { OverlayMixin } from './vaadin-overlay-mixin.js';
11
-
12
- /**
13
- * LitElement based version of `<vaadin-overlay>` web component.
14
- *
15
- * ## Disclaimer
16
- *
17
- * This component is an experiment and not yet a part of Vaadin platform.
18
- * There is no ETA regarding specific Vaadin version where it'll land.
19
- * Feel free to try this code in your apps as per Apache 2.0 license.
20
- */
21
- declare class Overlay extends OverlayMixin(DirMixin(ThemableMixin(PolylitMixin(LitElement)))) {}
22
-
23
- export { Overlay };
@@ -1,47 +0,0 @@
1
- /**
2
- * @license
3
- * Copyright (c) 2017 - 2025 Vaadin Ltd.
4
- * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
- */
6
- import { html, LitElement } from 'lit';
7
- import { defineCustomElement } from '@vaadin/component-base/src/define.js';
8
- import { DirMixin } from '@vaadin/component-base/src/dir-mixin.js';
9
- import { PolylitMixin } from '@vaadin/component-base/src/polylit-mixin.js';
10
- import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
11
- import { OverlayMixin } from './vaadin-overlay-mixin.js';
12
- import { overlayStyles } from './vaadin-overlay-styles.js';
13
-
14
- /**
15
- * LitElement based version of `<vaadin-overlay>` web component.
16
- *
17
- * ## Disclaimer
18
- *
19
- * This component is an experiment and not yet a part of Vaadin platform.
20
- * There is no ETA regarding specific Vaadin version where it'll land.
21
- * Feel free to try this code in your apps as per Apache 2.0 license.
22
- */
23
- class Overlay extends OverlayMixin(DirMixin(ThemableMixin(PolylitMixin(LitElement)))) {
24
- static get is() {
25
- return 'vaadin-overlay';
26
- }
27
-
28
- static get styles() {
29
- return overlayStyles;
30
- }
31
-
32
- /** @protected */
33
- render() {
34
- return html`
35
- <div id="backdrop" part="backdrop" ?hidden="${!this.withBackdrop}"></div>
36
- <div part="overlay" id="overlay" tabindex="0">
37
- <div part="content" id="content">
38
- <slot></slot>
39
- </div>
40
- </div>
41
- `;
42
- }
43
- }
44
-
45
- defineCustomElement(Overlay);
46
-
47
- export { Overlay };
@@ -1 +0,0 @@
1
- export {};
@@ -1,4 +0,0 @@
1
- import { overlay } from '@vaadin/vaadin-material-styles/mixins/overlay.js';
2
- import { registerStyles } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
3
-
4
- registerStyles('vaadin-overlay', overlay, { moduleId: 'material-vaadin-overlay' });
@@ -1,2 +0,0 @@
1
- import './vaadin-overlay-styles.js';
2
- import '../../src/vaadin-overlay.js';
@@ -1,2 +0,0 @@
1
- import './vaadin-overlay-styles.js';
2
- import '../../src/vaadin-overlay.js';