@vaadin/popover 25.0.0 → 25.0.2

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",
3
+ "version": "25.0.2",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -36,23 +36,23 @@
36
36
  ],
37
37
  "dependencies": {
38
38
  "@open-wc/dedupe-mixin": "^1.3.0",
39
- "@vaadin/a11y-base": "~25.0.0",
40
- "@vaadin/component-base": "~25.0.0",
41
- "@vaadin/lit-renderer": "~25.0.0",
42
- "@vaadin/overlay": "~25.0.0",
43
- "@vaadin/vaadin-themable-mixin": "~25.0.0",
39
+ "@vaadin/a11y-base": "~25.0.2",
40
+ "@vaadin/component-base": "~25.0.2",
41
+ "@vaadin/lit-renderer": "~25.0.2",
42
+ "@vaadin/overlay": "~25.0.2",
43
+ "@vaadin/vaadin-themable-mixin": "~25.0.2",
44
44
  "lit": "^3.0.0"
45
45
  },
46
46
  "devDependencies": {
47
- "@vaadin/chai-plugins": "~25.0.0",
48
- "@vaadin/test-runner-commands": "~25.0.0",
47
+ "@vaadin/chai-plugins": "~25.0.2",
48
+ "@vaadin/test-runner-commands": "~25.0.2",
49
49
  "@vaadin/testing-helpers": "^2.0.0",
50
- "@vaadin/vaadin-lumo-styles": "~25.0.0",
50
+ "@vaadin/vaadin-lumo-styles": "~25.0.2",
51
51
  "sinon": "^21.0.0"
52
52
  },
53
53
  "web-types": [
54
54
  "web-types.json",
55
55
  "web-types.lit.json"
56
56
  ],
57
- "gitHead": "c979f7ca278b6412095176ada230eb07eb4456bf"
57
+ "gitHead": "d17c1f8b7c6f3f991cafd9dbdbe5759caa57afcd"
58
58
  }
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2024 - 2025 Vaadin Ltd.
3
+ * Copyright (c) 2024 - 2026 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
6
  import type { DirectiveResult } from 'lit/directive.js';
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2024 - 2025 Vaadin Ltd.
3
+ * Copyright (c) 2024 - 2026 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
6
  import { directive } from 'lit/directive.js';
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2024 - 2025 Vaadin Ltd.
3
+ * Copyright (c) 2024 - 2026 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
6
  import type { CSSResult } from 'lit';
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2024 - 2025 Vaadin Ltd.
3
+ * Copyright (c) 2024 - 2026 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
6
  import { css } from 'lit';
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2022 - 2025 Vaadin Ltd.
3
+ * Copyright (c) 2022 - 2026 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
6
  import { OverlayMixin } from '@vaadin/overlay/src/vaadin-overlay-mixin.js';
@@ -37,11 +37,26 @@ export const PopoverOverlayMixin = (superClass) =>
37
37
 
38
38
  this.removeAttribute('arrow-centered');
39
39
 
40
- // Center the overlay horizontally
41
- if (this.position === 'bottom' || this.position === 'top') {
42
- const targetRect = this.positionTarget.getBoundingClientRect();
43
- const overlayRect = this.$.overlay.getBoundingClientRect();
40
+ const targetRect = this.positionTarget.getBoundingClientRect();
41
+ const overlayRect = this.$.overlay.getBoundingClientRect();
42
+ const viewportWidth = Math.min(window.innerWidth, document.documentElement.clientWidth);
43
+
44
+ // If the overlay extends beyond viewport, align the overlay to the respective edge so it isn't cut off
45
+ // Can skip trying to center the overlay in this case
46
+ let skipHorizontalCentering = false;
47
+
48
+ if (overlayRect.left < 0) {
49
+ this.style.left = '0px';
50
+ this.style.right = '';
51
+ skipHorizontalCentering = true;
52
+ } else if (overlayRect.right > viewportWidth) {
53
+ this.style.right = '0px';
54
+ this.style.left = '';
55
+ skipHorizontalCentering = true;
56
+ }
44
57
 
58
+ // Center the overlay horizontally
59
+ if (!skipHorizontalCentering && (this.position === 'bottom' || this.position === 'top')) {
45
60
  const offset = targetRect.width / 2 - overlayRect.width / 2;
46
61
 
47
62
  if (this.style.left) {
@@ -65,9 +80,6 @@ export const PopoverOverlayMixin = (superClass) =>
65
80
 
66
81
  // Center the overlay vertically
67
82
  if (this.position === 'start' || this.position === 'end') {
68
- const targetRect = this.positionTarget.getBoundingClientRect();
69
- const overlayRect = this.$.overlay.getBoundingClientRect();
70
-
71
83
  const offset = targetRect.height / 2 - overlayRect.height / 2;
72
84
  this.style.top = `${overlayRect.top + offset}px`;
73
85
  }
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2024 - 2025 Vaadin Ltd.
3
+ * Copyright (c) 2024 - 2026 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
6
  import { html, LitElement } from 'lit';
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2024 - 2025 Vaadin Ltd.
3
+ * Copyright (c) 2024 - 2026 Vaadin Ltd.
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';
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2024 - 2025 Vaadin Ltd.
3
+ * Copyright (c) 2024 - 2026 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
6
 
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2024 - 2025 Vaadin Ltd.
3
+ * Copyright (c) 2024 - 2026 Vaadin Ltd.
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';
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2024 - 2025 Vaadin Ltd.
3
+ * Copyright (c) 2024 - 2026 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
6
  import { microTask } from '@vaadin/component-base/src/async.js';
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2024 - 2025 Vaadin Ltd.
3
+ * Copyright (c) 2024 - 2026 Vaadin Ltd.
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';
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2024 - 2025 Vaadin Ltd.
3
+ * Copyright (c) 2024 - 2026 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
6
  import './vaadin-popover-overlay.js';
package/web-types.json CHANGED
@@ -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",
4
+ "version": "25.0.2",
5
5
  "description-markup": "markdown",
6
6
  "contributions": {
7
7
  "html": {
@@ -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",
4
+ "version": "25.0.2",
5
5
  "description-markup": "markdown",
6
6
  "framework": "lit",
7
7
  "framework-config": {