@zag-js/popper 0.79.2 → 0.79.3

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/dist/index.js CHANGED
@@ -231,13 +231,20 @@ function getPlacementImpl(referenceOrVirtual, floating, opts = {}) {
231
231
  const y = roundByDpr(win, pos.y);
232
232
  floating.style.setProperty("--x", `${x}px`);
233
233
  floating.style.setProperty("--y", `${y}px`);
234
- if (options.hideWhenDetached && pos.middlewareData.hide?.referenceHidden) {
235
- floating.style.setProperty("visibility", "hidden");
234
+ if (options.hideWhenDetached) {
235
+ const isHidden = pos.middlewareData.hide?.referenceHidden;
236
+ if (isHidden) {
237
+ floating.style.setProperty("visibility", "hidden");
238
+ floating.style.setProperty("pointer-events", "none");
239
+ } else {
240
+ floating.style.removeProperty("visibility");
241
+ floating.style.removeProperty("pointer-events");
242
+ }
236
243
  }
237
244
  const contentEl = floating.firstElementChild;
238
245
  if (contentEl) {
239
- const zIndex = win.getComputedStyle(contentEl).zIndex;
240
- floating.style.setProperty("--z-index", zIndex);
246
+ const styles = domQuery.getComputedStyle(contentEl);
247
+ floating.style.setProperty("--z-index", styles.zIndex);
241
248
  }
242
249
  };
243
250
  const update = async () => {
package/dist/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  import { autoUpdate, arrow, offset, flip, shift, limitShift, size, hide, computePosition } from '@floating-ui/dom';
2
- import { raf, isHTMLElement, getWindow } from '@zag-js/dom-query';
2
+ import { raf, isHTMLElement, getWindow, getComputedStyle } from '@zag-js/dom-query';
3
3
  import { noop, isNull, compact, runIfFn } from '@zag-js/utils';
4
4
 
5
5
  // src/get-placement.ts
@@ -229,13 +229,20 @@ function getPlacementImpl(referenceOrVirtual, floating, opts = {}) {
229
229
  const y = roundByDpr(win, pos.y);
230
230
  floating.style.setProperty("--x", `${x}px`);
231
231
  floating.style.setProperty("--y", `${y}px`);
232
- if (options.hideWhenDetached && pos.middlewareData.hide?.referenceHidden) {
233
- floating.style.setProperty("visibility", "hidden");
232
+ if (options.hideWhenDetached) {
233
+ const isHidden = pos.middlewareData.hide?.referenceHidden;
234
+ if (isHidden) {
235
+ floating.style.setProperty("visibility", "hidden");
236
+ floating.style.setProperty("pointer-events", "none");
237
+ } else {
238
+ floating.style.removeProperty("visibility");
239
+ floating.style.removeProperty("pointer-events");
240
+ }
234
241
  }
235
242
  const contentEl = floating.firstElementChild;
236
243
  if (contentEl) {
237
- const zIndex = win.getComputedStyle(contentEl).zIndex;
238
- floating.style.setProperty("--z-index", zIndex);
244
+ const styles = getComputedStyle(contentEl);
245
+ floating.style.setProperty("--z-index", styles.zIndex);
239
246
  }
240
247
  };
241
248
  const update = async () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zag-js/popper",
3
- "version": "0.79.2",
3
+ "version": "0.79.3",
4
4
  "description": "Dynamic positioning logic for ui machines",
5
5
  "keywords": [
6
6
  "js",
@@ -23,8 +23,8 @@
23
23
  },
24
24
  "dependencies": {
25
25
  "@floating-ui/dom": "1.6.12",
26
- "@zag-js/dom-query": "0.79.2",
27
- "@zag-js/utils": "0.79.2"
26
+ "@zag-js/dom-query": "0.79.3",
27
+ "@zag-js/utils": "0.79.3"
28
28
  },
29
29
  "devDependencies": {
30
30
  "clean-package": "2.2.0"