@vaadin/overlay 24.8.0-alpha2 → 24.8.0-alpha20

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-alpha2",
3
+ "version": "24.8.0-alpha20",
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"
@@ -36,18 +38,18 @@
36
38
  "dependencies": {
37
39
  "@open-wc/dedupe-mixin": "^1.3.0",
38
40
  "@polymer/polymer": "^3.0.0",
39
- "@vaadin/a11y-base": "24.8.0-alpha2",
40
- "@vaadin/component-base": "24.8.0-alpha2",
41
- "@vaadin/vaadin-lumo-styles": "24.8.0-alpha2",
42
- "@vaadin/vaadin-material-styles": "24.8.0-alpha2",
43
- "@vaadin/vaadin-themable-mixin": "24.8.0-alpha2",
41
+ "@vaadin/a11y-base": "24.8.0-alpha20",
42
+ "@vaadin/component-base": "24.8.0-alpha20",
43
+ "@vaadin/vaadin-lumo-styles": "24.8.0-alpha20",
44
+ "@vaadin/vaadin-material-styles": "24.8.0-alpha20",
45
+ "@vaadin/vaadin-themable-mixin": "24.8.0-alpha20",
44
46
  "lit": "^3.0.0"
45
47
  },
46
48
  "devDependencies": {
47
- "@vaadin/chai-plugins": "24.8.0-alpha2",
48
- "@vaadin/test-runner-commands": "24.8.0-alpha2",
49
+ "@vaadin/chai-plugins": "24.8.0-alpha20",
50
+ "@vaadin/test-runner-commands": "24.8.0-alpha20",
49
51
  "@vaadin/testing-helpers": "^1.1.0",
50
52
  "sinon": "^18.0.0"
51
53
  },
52
- "gitHead": "f48777a6e3dcf605b700305a7142145e197bb416"
54
+ "gitHead": "f091548b1f079f0c9de4be2a8ded77fb18671a2e"
53
55
  }
@@ -0,0 +1,80 @@
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
+ :host {
11
+ z-index: 200;
12
+ position: fixed;
13
+
14
+ /* Despite of what the names say, <vaadin-overlay> is just a container
15
+ for position/sizing/alignment. The actual overlay is the overlay part. */
16
+
17
+ /* Default position constraints. Themes can
18
+ override this to adjust the gap between the overlay and the viewport. */
19
+ inset: 8px;
20
+ bottom: var(--vaadin-overlay-viewport-bottom);
21
+
22
+ /* Use flexbox alignment for the overlay part. */
23
+ display: flex;
24
+ flex-direction: column; /* makes dropdowns sizing easier */
25
+ /* Align to center by default. */
26
+ align-items: center;
27
+ justify-content: center;
28
+
29
+ /* Allow centering when max-width/max-height applies. */
30
+ margin: auto;
31
+
32
+ /* The host is not clickable, only the overlay part is. */
33
+ pointer-events: none;
34
+
35
+ /* Remove tap highlight on touch devices. */
36
+ -webkit-tap-highlight-color: transparent;
37
+
38
+ /* CSS API for host */
39
+ --vaadin-overlay-viewport-bottom: 8px;
40
+ }
41
+
42
+ :host([hidden]),
43
+ :host(:not([opened]):not([closing])),
44
+ :host(:not([opened]):not([closing])) [part='overlay'] {
45
+ display: none !important;
46
+ }
47
+
48
+ [part='overlay'] {
49
+ background: var(--vaadin-overlay-background, var(--_vaadin-background));
50
+ border: var(--vaadin-overlay-border, 1px solid var(--_vaadin-border-color));
51
+ border-radius: var(--vaadin-overlay-border-radius, var(--_vaadin-radius-m));
52
+ box-shadow: var(--vaadin-overlay-box-shadow, 0 8px 24px -4px hsl(0 0 0 / 0.3));
53
+ box-sizing: border-box;
54
+ max-width: 100%;
55
+ overflow: auto;
56
+ overscroll-behavior: contain;
57
+ pointer-events: auto;
58
+ -webkit-tap-highlight-color: initial;
59
+ }
60
+
61
+ [part='backdrop'] {
62
+ background: var(--vaadin-overlay-backdrop-background, rgba(0, 0, 0, 0.5));
63
+ content: '';
64
+ inset: 0;
65
+ pointer-events: auto;
66
+ position: fixed;
67
+ z-index: -1;
68
+ }
69
+
70
+ @media (forced-colors: active) {
71
+ [part='overlay'] {
72
+ border: 3px solid;
73
+ }
74
+
75
+ [part='overlay']:focus-visible {
76
+ outline: var(--vaadin-focus-ring-width) solid;
77
+ outline-offset: 1px;
78
+ }
79
+ }
80
+ `;
@@ -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
+ `;
@@ -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';
@@ -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 };