@zag-js/popover 0.0.0-dev-20220703123907 → 0.0.0-dev-20220703125047

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
@@ -46,54 +46,9 @@ module.exports = __toCommonJS(src_exports);
46
46
  var dataAttr = (guard) => {
47
47
  return guard ? "" : void 0;
48
48
  };
49
- var hasProp = (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop);
50
- var runIfFn = (v, ...a) => {
51
- const res = typeof v === "function" ? v(...a) : v;
52
- return res != null ? res : void 0;
53
- };
54
- var isRef = (v) => hasProp(v, "current");
55
- function addDomEvent(target, eventName, handler, options) {
56
- const node = isRef(target) ? target.current : runIfFn(target);
57
- node == null ? void 0 : node.addEventListener(eventName, handler, options);
58
- return () => {
59
- node == null ? void 0 : node.removeEventListener(eventName, handler, options);
60
- };
61
- }
62
- function nextTick(fn) {
63
- const set = /* @__PURE__ */ new Set();
64
- function raf2(fn2) {
65
- const id = globalThis.requestAnimationFrame(fn2);
66
- set.add(() => globalThis.cancelAnimationFrame(id));
67
- }
68
- raf2(() => raf2(fn));
69
- return function cleanup() {
70
- set.forEach(function(fn2) {
71
- fn2();
72
- });
73
- };
74
- }
75
- function raf(fn) {
76
- const id = globalThis.requestAnimationFrame(fn);
77
- return function cleanup() {
78
- globalThis.cancelAnimationFrame(id);
79
- };
80
- }
81
- function isWindow(value) {
82
- return (value == null ? void 0 : value.toString()) === "[object Window]";
83
- }
84
49
  function isFrame(element) {
85
50
  return element.localName === "iframe";
86
51
  }
87
- function getDocument(el) {
88
- var _a;
89
- if (isWindow(el))
90
- return el.document;
91
- return (_a = el == null ? void 0 : el.ownerDocument) != null ? _a : document;
92
- }
93
- function getEventTarget(event) {
94
- var _a, _b;
95
- return (_b = (_a = event.composedPath) == null ? void 0 : _a.call(event)[0]) != null ? _b : event.target;
96
- }
97
52
  function contains(parent, child) {
98
53
  if (!parent)
99
54
  return false;
@@ -165,6 +120,38 @@ function getLastTabbable(container, includeContainer) {
165
120
  const elements = getTabbables(container, includeContainer);
166
121
  return elements[elements.length - 1] || null;
167
122
  }
123
+ var hasProp = (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop);
124
+ var runIfFn = (v, ...a) => {
125
+ const res = typeof v === "function" ? v(...a) : v;
126
+ return res != null ? res : void 0;
127
+ };
128
+ var isRef = (v) => hasProp(v, "current");
129
+ function addDomEvent(target, eventName, handler, options) {
130
+ const node = isRef(target) ? target.current : runIfFn(target);
131
+ node == null ? void 0 : node.addEventListener(eventName, handler, options);
132
+ return () => {
133
+ node == null ? void 0 : node.removeEventListener(eventName, handler, options);
134
+ };
135
+ }
136
+ function nextTick(fn) {
137
+ const set = /* @__PURE__ */ new Set();
138
+ function raf2(fn2) {
139
+ const id = globalThis.requestAnimationFrame(fn2);
140
+ set.add(() => globalThis.cancelAnimationFrame(id));
141
+ }
142
+ raf2(() => raf2(fn));
143
+ return function cleanup() {
144
+ set.forEach(function(fn2) {
145
+ fn2();
146
+ });
147
+ };
148
+ }
149
+ function raf(fn) {
150
+ const id = globalThis.requestAnimationFrame(fn);
151
+ return function cleanup() {
152
+ globalThis.cancelAnimationFrame(id);
153
+ };
154
+ }
168
155
 
169
156
  // src/popover.connect.ts
170
157
  var import_popper = require("@zag-js/popper");
@@ -344,25 +331,12 @@ var import_aria_hidden = require("@zag-js/aria-hidden");
344
331
  var import_core = require("@zag-js/core");
345
332
 
346
333
  // ../../utilities/interact-outside/dist/index.mjs
347
- var hasProp2 = (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop);
348
- var runIfFn3 = (v, ...a) => {
349
- const res = typeof v === "function" ? v(...a) : v;
350
- return res != null ? res : void 0;
351
- };
352
- var isRef2 = (v) => hasProp2(v, "current");
353
- function addDomEvent2(target, eventName, handler, options) {
354
- const node = isRef2(target) ? target.current : runIfFn3(target);
355
- node == null ? void 0 : node.addEventListener(eventName, handler, options);
356
- return () => {
357
- node == null ? void 0 : node.removeEventListener(eventName, handler, options);
358
- };
359
- }
360
- function isWindow2(value) {
334
+ function isWindow(value) {
361
335
  return (value == null ? void 0 : value.toString()) === "[object Window]";
362
336
  }
363
- function getDocument2(el) {
337
+ function getDocument(el) {
364
338
  var _a;
365
- if (isWindow2(el))
339
+ if (isWindow(el))
366
340
  return el.document;
367
341
  return (_a = el == null ? void 0 : el.ownerDocument) != null ? _a : document;
368
342
  }
@@ -370,7 +344,7 @@ function getWindow(el) {
370
344
  var _a;
371
345
  return (_a = el == null ? void 0 : el.ownerDocument.defaultView) != null ? _a : window;
372
346
  }
373
- function getEventTarget2(event) {
347
+ function getEventTarget(event) {
374
348
  var _a, _b;
375
349
  return (_b = (_a = event.composedPath) == null ? void 0 : _a.call(event)[0]) != null ? _b : event.target;
376
350
  }
@@ -399,6 +373,19 @@ function isFocusable2(element) {
399
373
  return false;
400
374
  return element.matches(focusableSelector2) && isVisible2(element);
401
375
  }
376
+ var hasProp2 = (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop);
377
+ var runIfFn3 = (v, ...a) => {
378
+ const res = typeof v === "function" ? v(...a) : v;
379
+ return res != null ? res : void 0;
380
+ };
381
+ var isRef2 = (v) => hasProp2(v, "current");
382
+ function addDomEvent2(target, eventName, handler, options) {
383
+ const node = isRef2(target) ? target.current : runIfFn3(target);
384
+ node == null ? void 0 : node.addEventListener(eventName, handler, options);
385
+ return () => {
386
+ node == null ? void 0 : node.removeEventListener(eventName, handler, options);
387
+ };
388
+ }
402
389
  var isDom = () => typeof window !== "undefined";
403
390
  function getPlatform() {
404
391
  var _a;
@@ -418,10 +405,10 @@ function trackInteractOutside(node, options) {
418
405
  const { exclude, onFocusOutside, onPointerDownOutside } = options;
419
406
  if (!node)
420
407
  return;
421
- const doc = getDocument2(node);
408
+ const doc = getDocument(node);
422
409
  const win = getWindow(node);
423
410
  function isEventOutside(event) {
424
- const target = getEventTarget2(event);
411
+ const target = getEventTarget(event);
425
412
  if (!(target instanceof win.HTMLElement)) {
426
413
  return false;
427
414
  }
@@ -447,7 +434,7 @@ function trackInteractOutside(node, options) {
447
434
  detail: {
448
435
  originalEvent: event,
449
436
  contextmenu: isContextMenuEvent(event),
450
- focusable: isFocusable2(getEventTarget2(event))
437
+ focusable: isFocusable2(getEventTarget(event))
451
438
  }
452
439
  });
453
440
  }
@@ -475,7 +462,7 @@ function trackInteractOutside(node, options) {
475
462
  detail: {
476
463
  originalEvent: event,
477
464
  contextmenu: false,
478
- focusable: isFocusable2(getEventTarget2(event))
465
+ focusable: isFocusable2(getEventTarget(event))
479
466
  }
480
467
  });
481
468
  }
@@ -488,16 +475,48 @@ function trackInteractOutside(node, options) {
488
475
  };
489
476
  }
490
477
 
491
- // ../../utilities/dismissable/src/escape-keydown.ts
478
+ // ../../utilities/dismissable/dist/index.mjs
479
+ function isWindow2(value) {
480
+ return (value == null ? void 0 : value.toString()) === "[object Window]";
481
+ }
482
+ function getDocument2(el) {
483
+ var _a;
484
+ if (isWindow2(el))
485
+ return el.document;
486
+ return (_a = el == null ? void 0 : el.ownerDocument) != null ? _a : document;
487
+ }
488
+ function getEventTarget2(event) {
489
+ var _a, _b;
490
+ return (_b = (_a = event.composedPath) == null ? void 0 : _a.call(event)[0]) != null ? _b : event.target;
491
+ }
492
+ function contains3(parent, child) {
493
+ if (!parent)
494
+ return false;
495
+ return parent === child || isHTMLElement3(parent) && isHTMLElement3(child) && parent.contains(child);
496
+ }
497
+ function isHTMLElement3(v) {
498
+ return typeof v === "object" && (v == null ? void 0 : v.nodeType) === Node.ELEMENT_NODE && typeof (v == null ? void 0 : v.nodeName) === "string";
499
+ }
500
+ var hasProp3 = (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop);
501
+ var runIfFn4 = (v, ...a) => {
502
+ const res = typeof v === "function" ? v(...a) : v;
503
+ return res != null ? res : void 0;
504
+ };
505
+ var isRef3 = (v) => hasProp3(v, "current");
506
+ function addDomEvent3(target, eventName, handler, options) {
507
+ const node = isRef3(target) ? target.current : runIfFn4(target);
508
+ node == null ? void 0 : node.addEventListener(eventName, handler, options);
509
+ return () => {
510
+ node == null ? void 0 : node.removeEventListener(eventName, handler, options);
511
+ };
512
+ }
492
513
  function trackEscapeKeydown(fn) {
493
514
  const handleKeyDown = (event) => {
494
515
  if (event.key === "Escape")
495
516
  fn == null ? void 0 : fn(event);
496
517
  };
497
- return addDomEvent(document, "keydown", handleKeyDown);
518
+ return addDomEvent3(document, "keydown", handleKeyDown);
498
519
  }
499
-
500
- // ../../utilities/dismissable/src/layer-stack.ts
501
520
  var layerStack = {
502
521
  layers: [],
503
522
  branches: [],
@@ -527,10 +546,10 @@ var layerStack = {
527
546
  return this.layers.slice(this.indexOf(node));
528
547
  },
529
548
  isInChildLayer(node, target) {
530
- return this.getChildLayers(node).some((layer) => contains(layer.node, target));
549
+ return this.getChildLayers(node).some((layer) => contains3(layer.node, target));
531
550
  },
532
551
  isInBranch(target) {
533
- return [...this.branches].some((branch) => contains(branch, target));
552
+ return [...this.branches].some((branch) => contains3(branch, target));
534
553
  },
535
554
  add(layer) {
536
555
  this.layers.push(layer);
@@ -561,8 +580,6 @@ var layerStack = {
561
580
  this.remove(this.layers[0].node);
562
581
  }
563
582
  };
564
-
565
- // ../../utilities/dismissable/src/pointer-event-outside.ts
566
583
  var originalBodyPointerEvents;
567
584
  function assignPointerEventToLayers() {
568
585
  layerStack.layers.forEach(({ node }) => {
@@ -574,7 +591,7 @@ function clearPointerEvent(node) {
574
591
  }
575
592
  var DATA_ATTR = "data-inert";
576
593
  function disablePointerEventsOutside(node) {
577
- const doc = getDocument(node);
594
+ const doc = getDocument2(node);
578
595
  if (layerStack.hasPointerBlockingLayer() && !doc.body.hasAttribute(DATA_ATTR)) {
579
596
  originalBodyPointerEvents = document.body.style.pointerEvents;
580
597
  doc.body.style.pointerEvents = "none";
@@ -589,8 +606,6 @@ function disablePointerEventsOutside(node) {
589
606
  doc.body.removeAttribute("style");
590
607
  };
591
608
  }
592
-
593
- // ../../utilities/dismissable/src/dismissable-layer.ts
594
609
  function trackDismissableElement(node, options) {
595
610
  if (!node)
596
611
  return;
@@ -600,7 +615,7 @@ function trackDismissableElement(node, options) {
600
615
  assignPointerEventToLayers();
601
616
  function onPointerDownOutside(event) {
602
617
  var _a, _b;
603
- const target = getEventTarget(event.detail.originalEvent);
618
+ const target = getEventTarget2(event.detail.originalEvent);
604
619
  if (layerStack.isBelowPointerBlockingLayer(node) || layerStack.isInBranch(target))
605
620
  return;
606
621
  (_a = options.onPointerDownOutside) == null ? void 0 : _a.call(options, event);
@@ -611,7 +626,7 @@ function trackDismissableElement(node, options) {
611
626
  }
612
627
  function onFocusOutside(event) {
613
628
  var _a, _b;
614
- const target = getEventTarget(event.detail.originalEvent);
629
+ const target = getEventTarget2(event.detail.originalEvent);
615
630
  if (layerStack.isInBranch(target))
616
631
  return;
617
632
  (_a = options.onFocusOutside) == null ? void 0 : _a.call(options, event);
@@ -633,7 +648,7 @@ function trackDismissableElement(node, options) {
633
648
  function exclude(target) {
634
649
  const containers = typeof excludeContainers === "function" ? excludeContainers() : excludeContainers;
635
650
  const inContainers = Array.isArray(containers) ? containers : [containers];
636
- return inContainers.some((node2) => contains(node2, target)) || layerStack.isInChildLayer(node, target);
651
+ return inContainers.some((node2) => contains3(node2, target)) || layerStack.isInChildLayer(node, target);
637
652
  }
638
653
  const cleanups = [
639
654
  pointerBlocking ? disablePointerEventsOutside(node) : void 0,
package/dist/index.mjs CHANGED
@@ -23,54 +23,9 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
23
23
  var dataAttr = (guard) => {
24
24
  return guard ? "" : void 0;
25
25
  };
26
- var hasProp = (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop);
27
- var runIfFn = (v, ...a) => {
28
- const res = typeof v === "function" ? v(...a) : v;
29
- return res != null ? res : void 0;
30
- };
31
- var isRef = (v) => hasProp(v, "current");
32
- function addDomEvent(target, eventName, handler, options) {
33
- const node = isRef(target) ? target.current : runIfFn(target);
34
- node == null ? void 0 : node.addEventListener(eventName, handler, options);
35
- return () => {
36
- node == null ? void 0 : node.removeEventListener(eventName, handler, options);
37
- };
38
- }
39
- function nextTick(fn) {
40
- const set = /* @__PURE__ */ new Set();
41
- function raf2(fn2) {
42
- const id = globalThis.requestAnimationFrame(fn2);
43
- set.add(() => globalThis.cancelAnimationFrame(id));
44
- }
45
- raf2(() => raf2(fn));
46
- return function cleanup() {
47
- set.forEach(function(fn2) {
48
- fn2();
49
- });
50
- };
51
- }
52
- function raf(fn) {
53
- const id = globalThis.requestAnimationFrame(fn);
54
- return function cleanup() {
55
- globalThis.cancelAnimationFrame(id);
56
- };
57
- }
58
- function isWindow(value) {
59
- return (value == null ? void 0 : value.toString()) === "[object Window]";
60
- }
61
26
  function isFrame(element) {
62
27
  return element.localName === "iframe";
63
28
  }
64
- function getDocument(el) {
65
- var _a;
66
- if (isWindow(el))
67
- return el.document;
68
- return (_a = el == null ? void 0 : el.ownerDocument) != null ? _a : document;
69
- }
70
- function getEventTarget(event) {
71
- var _a, _b;
72
- return (_b = (_a = event.composedPath) == null ? void 0 : _a.call(event)[0]) != null ? _b : event.target;
73
- }
74
29
  function contains(parent, child) {
75
30
  if (!parent)
76
31
  return false;
@@ -142,6 +97,38 @@ function getLastTabbable(container, includeContainer) {
142
97
  const elements = getTabbables(container, includeContainer);
143
98
  return elements[elements.length - 1] || null;
144
99
  }
100
+ var hasProp = (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop);
101
+ var runIfFn = (v, ...a) => {
102
+ const res = typeof v === "function" ? v(...a) : v;
103
+ return res != null ? res : void 0;
104
+ };
105
+ var isRef = (v) => hasProp(v, "current");
106
+ function addDomEvent(target, eventName, handler, options) {
107
+ const node = isRef(target) ? target.current : runIfFn(target);
108
+ node == null ? void 0 : node.addEventListener(eventName, handler, options);
109
+ return () => {
110
+ node == null ? void 0 : node.removeEventListener(eventName, handler, options);
111
+ };
112
+ }
113
+ function nextTick(fn) {
114
+ const set = /* @__PURE__ */ new Set();
115
+ function raf2(fn2) {
116
+ const id = globalThis.requestAnimationFrame(fn2);
117
+ set.add(() => globalThis.cancelAnimationFrame(id));
118
+ }
119
+ raf2(() => raf2(fn));
120
+ return function cleanup() {
121
+ set.forEach(function(fn2) {
122
+ fn2();
123
+ });
124
+ };
125
+ }
126
+ function raf(fn) {
127
+ const id = globalThis.requestAnimationFrame(fn);
128
+ return function cleanup() {
129
+ globalThis.cancelAnimationFrame(id);
130
+ };
131
+ }
145
132
 
146
133
  // src/popover.connect.ts
147
134
  import { getPlacementStyles } from "@zag-js/popper";
@@ -321,25 +308,12 @@ import { ariaHidden } from "@zag-js/aria-hidden";
321
308
  import { createMachine, guards, ref } from "@zag-js/core";
322
309
 
323
310
  // ../../utilities/interact-outside/dist/index.mjs
324
- var hasProp2 = (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop);
325
- var runIfFn3 = (v, ...a) => {
326
- const res = typeof v === "function" ? v(...a) : v;
327
- return res != null ? res : void 0;
328
- };
329
- var isRef2 = (v) => hasProp2(v, "current");
330
- function addDomEvent2(target, eventName, handler, options) {
331
- const node = isRef2(target) ? target.current : runIfFn3(target);
332
- node == null ? void 0 : node.addEventListener(eventName, handler, options);
333
- return () => {
334
- node == null ? void 0 : node.removeEventListener(eventName, handler, options);
335
- };
336
- }
337
- function isWindow2(value) {
311
+ function isWindow(value) {
338
312
  return (value == null ? void 0 : value.toString()) === "[object Window]";
339
313
  }
340
- function getDocument2(el) {
314
+ function getDocument(el) {
341
315
  var _a;
342
- if (isWindow2(el))
316
+ if (isWindow(el))
343
317
  return el.document;
344
318
  return (_a = el == null ? void 0 : el.ownerDocument) != null ? _a : document;
345
319
  }
@@ -347,7 +321,7 @@ function getWindow(el) {
347
321
  var _a;
348
322
  return (_a = el == null ? void 0 : el.ownerDocument.defaultView) != null ? _a : window;
349
323
  }
350
- function getEventTarget2(event) {
324
+ function getEventTarget(event) {
351
325
  var _a, _b;
352
326
  return (_b = (_a = event.composedPath) == null ? void 0 : _a.call(event)[0]) != null ? _b : event.target;
353
327
  }
@@ -376,6 +350,19 @@ function isFocusable2(element) {
376
350
  return false;
377
351
  return element.matches(focusableSelector2) && isVisible2(element);
378
352
  }
353
+ var hasProp2 = (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop);
354
+ var runIfFn3 = (v, ...a) => {
355
+ const res = typeof v === "function" ? v(...a) : v;
356
+ return res != null ? res : void 0;
357
+ };
358
+ var isRef2 = (v) => hasProp2(v, "current");
359
+ function addDomEvent2(target, eventName, handler, options) {
360
+ const node = isRef2(target) ? target.current : runIfFn3(target);
361
+ node == null ? void 0 : node.addEventListener(eventName, handler, options);
362
+ return () => {
363
+ node == null ? void 0 : node.removeEventListener(eventName, handler, options);
364
+ };
365
+ }
379
366
  var isDom = () => typeof window !== "undefined";
380
367
  function getPlatform() {
381
368
  var _a;
@@ -395,10 +382,10 @@ function trackInteractOutside(node, options) {
395
382
  const { exclude, onFocusOutside, onPointerDownOutside } = options;
396
383
  if (!node)
397
384
  return;
398
- const doc = getDocument2(node);
385
+ const doc = getDocument(node);
399
386
  const win = getWindow(node);
400
387
  function isEventOutside(event) {
401
- const target = getEventTarget2(event);
388
+ const target = getEventTarget(event);
402
389
  if (!(target instanceof win.HTMLElement)) {
403
390
  return false;
404
391
  }
@@ -424,7 +411,7 @@ function trackInteractOutside(node, options) {
424
411
  detail: {
425
412
  originalEvent: event,
426
413
  contextmenu: isContextMenuEvent(event),
427
- focusable: isFocusable2(getEventTarget2(event))
414
+ focusable: isFocusable2(getEventTarget(event))
428
415
  }
429
416
  });
430
417
  }
@@ -452,7 +439,7 @@ function trackInteractOutside(node, options) {
452
439
  detail: {
453
440
  originalEvent: event,
454
441
  contextmenu: false,
455
- focusable: isFocusable2(getEventTarget2(event))
442
+ focusable: isFocusable2(getEventTarget(event))
456
443
  }
457
444
  });
458
445
  }
@@ -465,16 +452,48 @@ function trackInteractOutside(node, options) {
465
452
  };
466
453
  }
467
454
 
468
- // ../../utilities/dismissable/src/escape-keydown.ts
455
+ // ../../utilities/dismissable/dist/index.mjs
456
+ function isWindow2(value) {
457
+ return (value == null ? void 0 : value.toString()) === "[object Window]";
458
+ }
459
+ function getDocument2(el) {
460
+ var _a;
461
+ if (isWindow2(el))
462
+ return el.document;
463
+ return (_a = el == null ? void 0 : el.ownerDocument) != null ? _a : document;
464
+ }
465
+ function getEventTarget2(event) {
466
+ var _a, _b;
467
+ return (_b = (_a = event.composedPath) == null ? void 0 : _a.call(event)[0]) != null ? _b : event.target;
468
+ }
469
+ function contains3(parent, child) {
470
+ if (!parent)
471
+ return false;
472
+ return parent === child || isHTMLElement3(parent) && isHTMLElement3(child) && parent.contains(child);
473
+ }
474
+ function isHTMLElement3(v) {
475
+ return typeof v === "object" && (v == null ? void 0 : v.nodeType) === Node.ELEMENT_NODE && typeof (v == null ? void 0 : v.nodeName) === "string";
476
+ }
477
+ var hasProp3 = (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop);
478
+ var runIfFn4 = (v, ...a) => {
479
+ const res = typeof v === "function" ? v(...a) : v;
480
+ return res != null ? res : void 0;
481
+ };
482
+ var isRef3 = (v) => hasProp3(v, "current");
483
+ function addDomEvent3(target, eventName, handler, options) {
484
+ const node = isRef3(target) ? target.current : runIfFn4(target);
485
+ node == null ? void 0 : node.addEventListener(eventName, handler, options);
486
+ return () => {
487
+ node == null ? void 0 : node.removeEventListener(eventName, handler, options);
488
+ };
489
+ }
469
490
  function trackEscapeKeydown(fn) {
470
491
  const handleKeyDown = (event) => {
471
492
  if (event.key === "Escape")
472
493
  fn == null ? void 0 : fn(event);
473
494
  };
474
- return addDomEvent(document, "keydown", handleKeyDown);
495
+ return addDomEvent3(document, "keydown", handleKeyDown);
475
496
  }
476
-
477
- // ../../utilities/dismissable/src/layer-stack.ts
478
497
  var layerStack = {
479
498
  layers: [],
480
499
  branches: [],
@@ -504,10 +523,10 @@ var layerStack = {
504
523
  return this.layers.slice(this.indexOf(node));
505
524
  },
506
525
  isInChildLayer(node, target) {
507
- return this.getChildLayers(node).some((layer) => contains(layer.node, target));
526
+ return this.getChildLayers(node).some((layer) => contains3(layer.node, target));
508
527
  },
509
528
  isInBranch(target) {
510
- return [...this.branches].some((branch) => contains(branch, target));
529
+ return [...this.branches].some((branch) => contains3(branch, target));
511
530
  },
512
531
  add(layer) {
513
532
  this.layers.push(layer);
@@ -538,8 +557,6 @@ var layerStack = {
538
557
  this.remove(this.layers[0].node);
539
558
  }
540
559
  };
541
-
542
- // ../../utilities/dismissable/src/pointer-event-outside.ts
543
560
  var originalBodyPointerEvents;
544
561
  function assignPointerEventToLayers() {
545
562
  layerStack.layers.forEach(({ node }) => {
@@ -551,7 +568,7 @@ function clearPointerEvent(node) {
551
568
  }
552
569
  var DATA_ATTR = "data-inert";
553
570
  function disablePointerEventsOutside(node) {
554
- const doc = getDocument(node);
571
+ const doc = getDocument2(node);
555
572
  if (layerStack.hasPointerBlockingLayer() && !doc.body.hasAttribute(DATA_ATTR)) {
556
573
  originalBodyPointerEvents = document.body.style.pointerEvents;
557
574
  doc.body.style.pointerEvents = "none";
@@ -566,8 +583,6 @@ function disablePointerEventsOutside(node) {
566
583
  doc.body.removeAttribute("style");
567
584
  };
568
585
  }
569
-
570
- // ../../utilities/dismissable/src/dismissable-layer.ts
571
586
  function trackDismissableElement(node, options) {
572
587
  if (!node)
573
588
  return;
@@ -577,7 +592,7 @@ function trackDismissableElement(node, options) {
577
592
  assignPointerEventToLayers();
578
593
  function onPointerDownOutside(event) {
579
594
  var _a, _b;
580
- const target = getEventTarget(event.detail.originalEvent);
595
+ const target = getEventTarget2(event.detail.originalEvent);
581
596
  if (layerStack.isBelowPointerBlockingLayer(node) || layerStack.isInBranch(target))
582
597
  return;
583
598
  (_a = options.onPointerDownOutside) == null ? void 0 : _a.call(options, event);
@@ -588,7 +603,7 @@ function trackDismissableElement(node, options) {
588
603
  }
589
604
  function onFocusOutside(event) {
590
605
  var _a, _b;
591
- const target = getEventTarget(event.detail.originalEvent);
606
+ const target = getEventTarget2(event.detail.originalEvent);
592
607
  if (layerStack.isInBranch(target))
593
608
  return;
594
609
  (_a = options.onFocusOutside) == null ? void 0 : _a.call(options, event);
@@ -610,7 +625,7 @@ function trackDismissableElement(node, options) {
610
625
  function exclude(target) {
611
626
  const containers = typeof excludeContainers === "function" ? excludeContainers() : excludeContainers;
612
627
  const inContainers = Array.isArray(containers) ? containers : [containers];
613
- return inContainers.some((node2) => contains(node2, target)) || layerStack.isInChildLayer(node, target);
628
+ return inContainers.some((node2) => contains3(node2, target)) || layerStack.isInChildLayer(node, target);
614
629
  }
615
630
  const cleanups = [
616
631
  pointerBlocking ? disablePointerEventsOutside(node) : void 0,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zag-js/popover",
3
- "version": "0.0.0-dev-20220703123907",
3
+ "version": "0.0.0-dev-20220703125047",
4
4
  "description": "Core logic for the popover widget implemented as a state machine",
5
5
  "keywords": [
6
6
  "js",
@@ -30,11 +30,11 @@
30
30
  },
31
31
  "dependencies": {
32
32
  "@zag-js/aria-hidden": "0.1.0",
33
- "@zag-js/core": "0.0.0-dev-20220703123907",
34
- "@zag-js/dom-utils": "0.0.0-dev-20220703123907",
35
- "@zag-js/popper": "0.0.0-dev-20220703123907",
33
+ "@zag-js/core": "0.0.0-dev-20220703125047",
34
+ "@zag-js/dom-utils": "0.0.0-dev-20220703125047",
35
+ "@zag-js/popper": "0.0.0-dev-20220703125047",
36
36
  "@zag-js/remove-scroll": "0.1.0",
37
- "@zag-js/types": "0.0.0-dev-20220703123907",
37
+ "@zag-js/types": "0.0.0-dev-20220703125047",
38
38
  "@zag-js/utils": "0.1.2",
39
39
  "focus-trap": "6.7.1"
40
40
  },