@vaadin/overlay 25.0.0-alpha4 → 25.0.0-alpha6

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": "25.0.0-alpha4",
3
+ "version": "25.0.0-alpha6",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -36,17 +36,17 @@
36
36
  ],
37
37
  "dependencies": {
38
38
  "@open-wc/dedupe-mixin": "^1.3.0",
39
- "@vaadin/a11y-base": "25.0.0-alpha4",
40
- "@vaadin/component-base": "25.0.0-alpha4",
41
- "@vaadin/vaadin-lumo-styles": "25.0.0-alpha4",
42
- "@vaadin/vaadin-themable-mixin": "25.0.0-alpha4",
39
+ "@vaadin/a11y-base": "25.0.0-alpha6",
40
+ "@vaadin/component-base": "25.0.0-alpha6",
41
+ "@vaadin/vaadin-lumo-styles": "25.0.0-alpha6",
42
+ "@vaadin/vaadin-themable-mixin": "25.0.0-alpha6",
43
43
  "lit": "^3.0.0"
44
44
  },
45
45
  "devDependencies": {
46
- "@vaadin/chai-plugins": "25.0.0-alpha4",
47
- "@vaadin/test-runner-commands": "25.0.0-alpha4",
46
+ "@vaadin/chai-plugins": "25.0.0-alpha6",
47
+ "@vaadin/test-runner-commands": "25.0.0-alpha6",
48
48
  "@vaadin/testing-helpers": "^2.0.0",
49
49
  "sinon": "^18.0.0"
50
50
  },
51
- "gitHead": "ce4421f0daf26027b863b91787a474e4cc264344"
51
+ "gitHead": "cd1d084198d2b326c58d44bb39fa4845b71ce551"
52
52
  }
@@ -47,10 +47,10 @@ export const overlayStyles = css`
47
47
  }
48
48
 
49
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));
50
+ background: var(--vaadin-overlay-background, var(--vaadin-background-color));
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 rgba(0, 0, 0, 0.3));
54
54
  box-sizing: border-box;
55
55
  max-width: 100%;
56
56
  overflow: auto;
@@ -45,7 +45,6 @@ export const overlayStyles = css`
45
45
  }
46
46
 
47
47
  [part='overlay'] {
48
- -webkit-overflow-scrolling: touch;
49
48
  overflow: auto;
50
49
  pointer-events: auto;
51
50
 
@@ -7,6 +7,13 @@ import type { Constructor } from '@open-wc/dedupe-mixin';
7
7
  import type { OverlayFocusMixinClass } from './vaadin-overlay-focus-mixin.js';
8
8
  import type { OverlayStackMixinClass } from './vaadin-overlay-stack-mixin.js';
9
9
 
10
+ export type OverlayBounds = {
11
+ top?: number | string;
12
+ left?: number | string;
13
+ width?: number | string;
14
+ height?: number | string;
15
+ };
16
+
10
17
  export type OverlayRenderer = (root: HTMLElement, owner: HTMLElement, model?: object) => void;
11
18
 
12
19
  export declare function OverlayMixin<T extends Constructor<HTMLElement>>(
@@ -58,6 +65,11 @@ export declare class OverlayMixinClass {
58
65
 
59
66
  close(sourceEvent?: Event | null): void;
60
67
 
68
+ /**
69
+ * Updates the coordinates of the overlay.
70
+ */
71
+ setBounds(bounds: OverlayBounds, absolute?: boolean): void;
72
+
61
73
  /**
62
74
  * Requests an update for the content of the overlay.
63
75
  * While performing the update, it invokes the renderer passed in the `renderer` property.
@@ -182,6 +182,29 @@ export const OverlayMixin = (superClass) =>
182
182
  }
183
183
  }
184
184
 
185
+ /**
186
+ * Updates the coordinates of the overlay.
187
+ * @param {!OverlayBoundsParam} bounds
188
+ * @param {boolean} absolute
189
+ */
190
+ setBounds(bounds, absolute = true) {
191
+ const overlay = this.$.overlay;
192
+ const parsedBounds = { ...bounds };
193
+
194
+ if (absolute && overlay.style.position !== 'absolute') {
195
+ overlay.style.position = 'absolute';
196
+ }
197
+
198
+ Object.keys(parsedBounds).forEach((arg) => {
199
+ // Allow setting width or height to `null`
200
+ if (parsedBounds[arg] !== null && !isNaN(parsedBounds[arg])) {
201
+ parsedBounds[arg] = `${parsedBounds[arg]}px`;
202
+ }
203
+ });
204
+
205
+ Object.assign(overlay.style, parsedBounds);
206
+ }
207
+
185
208
  /** @private */
186
209
  _detectIosNavbar() {
187
210
  /* c8 ignore next 15 */
@@ -7,6 +7,7 @@ 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
9
  import { PolylitMixin } from '@vaadin/component-base/src/polylit-mixin.js';
10
+ import { LumoInjectionMixin } from '@vaadin/vaadin-themable-mixin/lumo-injection-mixin.js';
10
11
  import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
11
12
  import { overlayStyles } from './styles/vaadin-overlay-core-styles.js';
12
13
  import { OverlayMixin } from './vaadin-overlay-mixin.js';
@@ -76,7 +77,7 @@ import { OverlayMixin } from './vaadin-overlay-mixin.js';
76
77
  * @mixes DirMixin
77
78
  * @mixes OverlayMixin
78
79
  */
79
- class Overlay extends OverlayMixin(DirMixin(ThemableMixin(PolylitMixin(LitElement)))) {
80
+ class Overlay extends OverlayMixin(DirMixin(ThemableMixin(LumoInjectionMixin(PolylitMixin(LitElement))))) {
80
81
  static get is() {
81
82
  return 'vaadin-overlay';
82
83
  }