@ariakit/react-core 0.2.13 → 0.2.15

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.
Files changed (170) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/cjs/__chunks/{46W63N4E.cjs → 2BUZEL3H.cjs} +4 -4
  3. package/cjs/__chunks/{I6HKRJRJ.cjs → 4ALK6CLY.cjs} +2 -2
  4. package/cjs/__chunks/{E6GEUTTK.cjs → 5PVFQNEK.cjs} +8 -8
  5. package/cjs/__chunks/{EB6HX5QF.cjs → 7AY74MRV.cjs} +2 -2
  6. package/cjs/__chunks/{YDQ6MWAU.cjs → AGHEZ6QM.cjs} +2 -2
  7. package/cjs/__chunks/{K7C3WV6U.cjs → B4KY2VS7.cjs} +3 -3
  8. package/cjs/__chunks/{ZWMVFMQY.cjs → CHVOMF22.cjs} +4 -4
  9. package/cjs/__chunks/{HBPCIWXH.cjs → COQS7NEY.cjs} +2 -2
  10. package/cjs/__chunks/{O22LNQHS.cjs → FA3DXDDT.cjs} +2 -2
  11. package/cjs/__chunks/{5LF25CUD.cjs → GJDDV2DB.cjs} +13 -13
  12. package/cjs/__chunks/{ATE4NNYG.cjs → GYMLYZWR.cjs} +3 -3
  13. package/cjs/__chunks/{FSADYSOP.cjs → HTEAWNBY.cjs} +14 -3
  14. package/cjs/__chunks/{W7CMR2JU.cjs → HV7BPIPP.cjs} +40 -28
  15. package/cjs/__chunks/{HZQ2KCIT.cjs → IIT6ECXG.cjs} +8 -8
  16. package/cjs/__chunks/{POWPPQ66.cjs → KAIRFV3B.cjs} +4 -4
  17. package/cjs/__chunks/{HUVFPCMZ.cjs → KJBIRAH5.cjs} +24 -6
  18. package/cjs/__chunks/{GFY2F547.cjs → LHLJ5HWH.cjs} +2 -2
  19. package/cjs/__chunks/{XWCRD3TO.cjs → MEIHBPXG.cjs} +27 -1
  20. package/cjs/__chunks/{TFOIZV2V.cjs → PD5YFDLO.cjs} +3 -2
  21. package/cjs/__chunks/{56BLECAM.cjs → PJQOOE4T.cjs} +2 -2
  22. package/cjs/__chunks/{6N3E4T5G.cjs → RO6U6W2X.cjs} +7 -7
  23. package/cjs/__chunks/{U6LIBFVC.cjs → RS6F2A54.cjs} +4 -4
  24. package/cjs/__chunks/{H6QASEXN.cjs → UQ677BGW.cjs} +6 -6
  25. package/cjs/__chunks/{KXIDRFWU.cjs → VXMYNJ4Z.cjs} +2 -2
  26. package/cjs/__chunks/{MLQBPFIH.cjs → YBLCB5MM.cjs} +5 -5
  27. package/cjs/__chunks/{N6GWKAPT.cjs → ZC54XMTA.cjs} +4 -4
  28. package/cjs/checkbox/checkbox-store.cjs +3 -3
  29. package/cjs/checkbox/checkbox.cjs +3 -3
  30. package/cjs/collection/collection-renderer.cjs +3 -3
  31. package/cjs/collection/collection-store.cjs +3 -3
  32. package/cjs/combobox/combobox-item.cjs +3 -3
  33. package/cjs/combobox/combobox-popover.cjs +11 -11
  34. package/cjs/combobox/combobox-store.cjs +11 -11
  35. package/cjs/composite/composite-container.cjs +3 -3
  36. package/cjs/composite/composite-item.cjs +3 -3
  37. package/cjs/composite/composite-overflow-disclosure.cjs +3 -3
  38. package/cjs/composite/composite-overflow-store.cjs +7 -7
  39. package/cjs/composite/composite-overflow.cjs +11 -11
  40. package/cjs/composite/composite-renderer.cjs +4 -4
  41. package/cjs/composite/composite-store.cjs +4 -4
  42. package/cjs/dialog/dialog-backdrop.cjs +6 -6
  43. package/cjs/dialog/dialog-store.cjs +4 -4
  44. package/cjs/dialog/dialog.cjs +10 -10
  45. package/cjs/dialog/utils/disable-accessibility-tree-outside.cjs +3 -3
  46. package/cjs/dialog/utils/disable-tree-outside.cjs +4 -4
  47. package/cjs/dialog/utils/mark-tree-outside.cjs +3 -3
  48. package/cjs/dialog/utils/use-hide-on-interact-outside.cjs +4 -4
  49. package/cjs/dialog/utils/use-hide-on-interact-outside.d.ts +1 -1
  50. package/cjs/dialog/utils/walk-tree-outside.cjs +2 -2
  51. package/cjs/dialog/utils/walk-tree-outside.d.ts +1 -1
  52. package/cjs/disclosure/disclosure-store.cjs +3 -3
  53. package/cjs/form/form-checkbox.cjs +5 -5
  54. package/cjs/form/form-radio.cjs +4 -4
  55. package/cjs/form/form-store.cjs +8 -8
  56. package/cjs/hovercard/hovercard-store.cjs +6 -6
  57. package/cjs/hovercard/hovercard.cjs +12 -12
  58. package/cjs/menu/menu-bar-store.cjs +6 -6
  59. package/cjs/menu/menu-button.cjs +2 -2
  60. package/cjs/menu/menu-item-checkbox.cjs +8 -8
  61. package/cjs/menu/menu-item-radio.cjs +6 -6
  62. package/cjs/menu/menu-item.cjs +4 -4
  63. package/cjs/menu/menu-list.cjs +3 -3
  64. package/cjs/menu/menu-store.cjs +13 -13
  65. package/cjs/menu/menu.cjs +14 -14
  66. package/cjs/popover/popover-store.cjs +5 -5
  67. package/cjs/popover/popover.cjs +11 -11
  68. package/cjs/radio/radio-store.cjs +7 -7
  69. package/cjs/radio/radio.cjs +4 -4
  70. package/cjs/select/select-item.cjs +3 -3
  71. package/cjs/select/select-popover.cjs +11 -11
  72. package/cjs/select/select-renderer.cjs +7 -7
  73. package/cjs/select/select-store.cjs +11 -11
  74. package/cjs/tab/tab-panel.cjs +3 -3
  75. package/cjs/tab/tab-store.cjs +9 -9
  76. package/cjs/tab/tab.cjs +3 -3
  77. package/cjs/toolbar/toolbar-container.cjs +6 -6
  78. package/cjs/toolbar/toolbar-input.cjs +4 -4
  79. package/cjs/toolbar/toolbar-item.cjs +4 -4
  80. package/cjs/toolbar/toolbar-store.cjs +6 -6
  81. package/cjs/tooltip/tooltip-anchor.cjs +19 -0
  82. package/cjs/tooltip/tooltip-store.cjs +10 -10
  83. package/cjs/tooltip/tooltip.cjs +12 -12
  84. package/cjs/tsconfig.build.tsbuildinfo +1 -1
  85. package/cjs/utils/store.cjs +2 -2
  86. package/esm/__chunks/{JQEMLKF6.js → 36V3RYFS.js} +2 -2
  87. package/esm/__chunks/{3QWF4P62.js → 4LTL37RB.js} +1 -1
  88. package/esm/__chunks/{FV23EKJL.js → 5M4ITSXL.js} +3 -2
  89. package/esm/__chunks/{DP7YKWXP.js → 74BBE733.js} +2 -2
  90. package/esm/__chunks/{5UGSKFCK.js → BIPBU2AE.js} +34 -22
  91. package/esm/__chunks/{4XWTU3WN.js → E5XSMSHD.js} +25 -7
  92. package/esm/__chunks/{CYJJUQU3.js → GDORSOK6.js} +1 -1
  93. package/esm/__chunks/{TM5MM3ME.js → H3BU75TA.js} +2 -2
  94. package/esm/__chunks/{XSCTYXG5.js → I6WUAEGK.js} +2 -2
  95. package/esm/__chunks/{LU22MAAA.js → ID2DTD7Z.js} +1 -1
  96. package/esm/__chunks/{X44LESGC.js → ISVIGIQD.js} +1 -1
  97. package/esm/__chunks/{RLFO7W2T.js → JFQ4TNZX.js} +2 -2
  98. package/esm/__chunks/{J2DK7IKI.js → JHKKFNCJ.js} +1 -1
  99. package/esm/__chunks/{LZ4RMGK5.js → JJW3R5IK.js} +1 -1
  100. package/esm/__chunks/{OQKUGLAX.js → JWSYWSCR.js} +1 -1
  101. package/esm/__chunks/{HCZMY53N.js → LEBYH5FW.js} +13 -2
  102. package/esm/__chunks/{563SOJCA.js → MXMUDZTV.js} +27 -1
  103. package/esm/__chunks/{AR6DTI3S.js → NHPU54IO.js} +2 -2
  104. package/esm/__chunks/{CTQHL4DC.js → OJNIJGF2.js} +2 -2
  105. package/esm/__chunks/{VJKEASM4.js → QLIKSQTQ.js} +1 -1
  106. package/esm/__chunks/{LYXIRVKB.js → RRY7OZXM.js} +2 -2
  107. package/esm/__chunks/{FAKCYHFK.js → SPTQP5I5.js} +2 -2
  108. package/esm/__chunks/{LNROWH6D.js → VVJJXZ6R.js} +1 -1
  109. package/esm/__chunks/{BFJZP2NO.js → WNGYZL6A.js} +1 -1
  110. package/esm/__chunks/{ZII73YFS.js → XE25NQP3.js} +1 -1
  111. package/esm/__chunks/{4L6ILOIA.js → XEEFNNEM.js} +1 -1
  112. package/esm/checkbox/checkbox-store.js +2 -2
  113. package/esm/checkbox/checkbox.js +2 -2
  114. package/esm/collection/collection-renderer.js +2 -2
  115. package/esm/collection/collection-store.js +2 -2
  116. package/esm/combobox/combobox-item.js +2 -2
  117. package/esm/combobox/combobox-popover.js +10 -10
  118. package/esm/combobox/combobox-store.js +6 -6
  119. package/esm/composite/composite-container.js +2 -2
  120. package/esm/composite/composite-item.js +2 -2
  121. package/esm/composite/composite-overflow-disclosure.js +2 -2
  122. package/esm/composite/composite-overflow-store.js +4 -4
  123. package/esm/composite/composite-overflow.js +10 -10
  124. package/esm/composite/composite-renderer.js +3 -3
  125. package/esm/composite/composite-store.js +3 -3
  126. package/esm/dialog/dialog-backdrop.js +5 -5
  127. package/esm/dialog/dialog-store.js +3 -3
  128. package/esm/dialog/dialog.js +9 -9
  129. package/esm/dialog/utils/disable-accessibility-tree-outside.js +2 -2
  130. package/esm/dialog/utils/disable-tree-outside.js +3 -3
  131. package/esm/dialog/utils/mark-tree-outside.js +2 -2
  132. package/esm/dialog/utils/use-hide-on-interact-outside.d.ts +1 -1
  133. package/esm/dialog/utils/use-hide-on-interact-outside.js +3 -3
  134. package/esm/dialog/utils/walk-tree-outside.d.ts +1 -1
  135. package/esm/dialog/utils/walk-tree-outside.js +1 -1
  136. package/esm/disclosure/disclosure-store.js +2 -2
  137. package/esm/form/form-checkbox.js +3 -3
  138. package/esm/form/form-radio.js +3 -3
  139. package/esm/form/form-store.js +2 -2
  140. package/esm/hovercard/hovercard-store.js +5 -5
  141. package/esm/hovercard/hovercard.js +11 -11
  142. package/esm/menu/menu-bar-store.js +3 -3
  143. package/esm/menu/menu-button.js +1 -1
  144. package/esm/menu/menu-item-checkbox.js +5 -5
  145. package/esm/menu/menu-item-radio.js +4 -4
  146. package/esm/menu/menu-item.js +3 -3
  147. package/esm/menu/menu-list.js +2 -2
  148. package/esm/menu/menu-store.js +7 -7
  149. package/esm/menu/menu.js +12 -12
  150. package/esm/popover/popover-store.js +4 -4
  151. package/esm/popover/popover.js +10 -10
  152. package/esm/radio/radio-store.js +3 -3
  153. package/esm/radio/radio.js +3 -3
  154. package/esm/select/select-item.js +2 -2
  155. package/esm/select/select-popover.js +10 -10
  156. package/esm/select/select-renderer.js +3 -3
  157. package/esm/select/select-store.js +6 -6
  158. package/esm/tab/tab-panel.js +2 -2
  159. package/esm/tab/tab-store.js +3 -3
  160. package/esm/tab/tab.js +2 -2
  161. package/esm/toolbar/toolbar-container.js +4 -4
  162. package/esm/toolbar/toolbar-input.js +3 -3
  163. package/esm/toolbar/toolbar-item.js +3 -3
  164. package/esm/toolbar/toolbar-store.js +3 -3
  165. package/esm/tooltip/tooltip-anchor.js +20 -1
  166. package/esm/tooltip/tooltip-store.js +5 -5
  167. package/esm/tooltip/tooltip.js +11 -11
  168. package/esm/tsconfig.build.tsbuildinfo +1 -1
  169. package/esm/utils/store.js +1 -1
  170. package/package.json +1 -1
@@ -20,12 +20,13 @@ function walkTreeOutside(elements, callback, ancestorCallback) {
20
20
  return maybeAncestor.contains(element);
21
21
  });
22
22
  const doc = getDocument(element);
23
+ const originalElement = element;
23
24
  while (element.parentElement && element !== doc.body) {
24
- ancestorCallback == null ? void 0 : ancestorCallback(element.parentElement);
25
+ ancestorCallback == null ? void 0 : ancestorCallback(element.parentElement, originalElement);
25
26
  if (!hasAncestorAlready) {
26
27
  for (const child of element.parentElement.children) {
27
28
  if (isValidElement(child, elements)) {
28
- callback(child);
29
+ callback(child, originalElement);
29
30
  }
30
31
  }
31
32
  }
@@ -1,11 +1,11 @@
1
1
  import {
2
2
  usePopoverStoreOptions,
3
3
  usePopoverStoreProps
4
- } from "./FAKCYHFK.js";
4
+ } from "./SPTQP5I5.js";
5
5
  import {
6
6
  useStore,
7
7
  useStoreProps
8
- } from "./563SOJCA.js";
8
+ } from "./MXMUDZTV.js";
9
9
  import {
10
10
  __spreadValues
11
11
  } from "./PNRLI7OV.js";
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  DialogBackdrop
3
- } from "./TM5MM3ME.js";
3
+ } from "./H3BU75TA.js";
4
4
  import {
5
5
  disableTreeOutside
6
- } from "./AR6DTI3S.js";
6
+ } from "./NHPU54IO.js";
7
7
  import {
8
8
  disableAccessibilityTreeOutside
9
- } from "./CYJJUQU3.js";
9
+ } from "./GDORSOK6.js";
10
10
  import {
11
11
  usePreventBodyScroll
12
12
  } from "./3LAWLNOX.js";
@@ -15,11 +15,11 @@ import {
15
15
  } from "./OEA63YXU.js";
16
16
  import {
17
17
  useHideOnInteractOutside
18
- } from "./4XWTU3WN.js";
18
+ } from "./E5XSMSHD.js";
19
19
  import {
20
20
  isElementMarked,
21
21
  markTreeOutside
22
- } from "./HCZMY53N.js";
22
+ } from "./LEBYH5FW.js";
23
23
  import {
24
24
  prependHiddenDismiss
25
25
  } from "./62DFK33R.js";
@@ -65,7 +65,7 @@ import {
65
65
  } from "./PNRLI7OV.js";
66
66
 
67
67
  // src/dialog/dialog.tsx
68
- import { useEffect, useRef, useState } from "react";
68
+ import { useCallback, useEffect, useRef, useState } from "react";
69
69
  import {
70
70
  closest,
71
71
  contains,
@@ -151,7 +151,7 @@ var useDialog = createHook(
151
151
  const contentElement = store.useState("contentElement");
152
152
  const hidden = isHidden(mounted, props.hidden, props.alwaysVisible);
153
153
  usePreventBodyScroll(contentElement, id, preventBodyScroll && !hidden);
154
- useHideOnInteractOutside(store, hideOnInteractOutside);
154
+ useHideOnInteractOutside(store, hideOnInteractOutside, domReady);
155
155
  const { wrapElement, nestedDialogs } = useNestedDialogs(store);
156
156
  props = useWrapElement(props, wrapElement, [wrapElement]);
157
157
  useSafeLayoutEffect(() => {
@@ -309,16 +309,13 @@ var useDialog = createHook(
309
309
  setHasOpened(true);
310
310
  return () => setHasOpened(false);
311
311
  }, [open]);
312
- useSafeLayoutEffect(() => {
313
- if (!hasOpened)
314
- return;
315
- if (!mayAutoFocusOnHide)
316
- return;
317
- const dialog = ref.current;
318
- const focusOnHide = (retry = true) => {
312
+ const focusOnHide = useCallback(
313
+ (dialog, retry = true) => {
314
+ const { open: open2, disclosureElement } = store.getState();
315
+ if (open2)
316
+ return;
319
317
  if (isAlreadyFocusingAnotherElement(dialog))
320
318
  return;
321
- const { disclosureElement } = store.getState();
322
319
  let element = getElementFromProp(finalFocus) || disclosureElement;
323
320
  if (element == null ? void 0 : element.id) {
324
321
  const doc = getDocument(element);
@@ -341,7 +338,7 @@ var useDialog = createHook(
341
338
  }
342
339
  const isElementFocusable = element && isFocusable(element);
343
340
  if (!isElementFocusable && retry) {
344
- requestAnimationFrame(() => focusOnHide(false));
341
+ requestAnimationFrame(() => focusOnHide(dialog, false));
345
342
  return;
346
343
  }
347
344
  if (!autoFocusOnHideProp(isElementFocusable ? element : null))
@@ -349,12 +346,27 @@ var useDialog = createHook(
349
346
  if (!isElementFocusable)
350
347
  return;
351
348
  element == null ? void 0 : element.focus();
352
- };
353
- if (!open) {
354
- return focusOnHide();
355
- }
356
- return focusOnHide;
357
- }, [hasOpened, open, mayAutoFocusOnHide, finalFocus, autoFocusOnHideProp]);
349
+ },
350
+ [store, finalFocus, autoFocusOnHideProp]
351
+ );
352
+ useEffect(() => {
353
+ if (open)
354
+ return;
355
+ if (!hasOpened)
356
+ return;
357
+ if (!mayAutoFocusOnHide)
358
+ return;
359
+ const dialog = ref.current;
360
+ focusOnHide(dialog);
361
+ }, [open, hasOpened, mayAutoFocusOnHide, focusOnHide]);
362
+ useEffect(() => {
363
+ if (!hasOpened)
364
+ return;
365
+ if (!mayAutoFocusOnHide)
366
+ return;
367
+ const dialog = ref.current;
368
+ return () => focusOnHide(dialog);
369
+ }, [hasOpened, mayAutoFocusOnHide, focusOnHide]);
358
370
  const hideOnEscapeProp = useBooleanEvent(hideOnEscape);
359
371
  useEffect(() => {
360
372
  if (!domReady)
@@ -1,11 +1,12 @@
1
1
  import {
2
2
  isElementMarked
3
- } from "./HCZMY53N.js";
3
+ } from "./LEBYH5FW.js";
4
4
  import {
5
5
  usePreviousMouseDownRef
6
6
  } from "./7JNF6I52.js";
7
7
  import {
8
- useEvent
8
+ useEvent,
9
+ useSafeLayoutEffect
9
10
  } from "./J7Q2EO23.js";
10
11
  import {
11
12
  __spreadProps,
@@ -13,7 +14,7 @@ import {
13
14
  } from "./PNRLI7OV.js";
14
15
 
15
16
  // src/dialog/utils/use-hide-on-interact-outside.ts
16
- import { useEffect } from "react";
17
+ import { useEffect, useRef } from "react";
17
18
  import { contains, getDocument, isVisible } from "@ariakit/core/utils/dom";
18
19
  import { addGlobalEventListener } from "@ariakit/core/utils/events";
19
20
  function isInDocument(target) {
@@ -47,10 +48,26 @@ function useEventOutside({
47
48
  store,
48
49
  type,
49
50
  listener,
50
- capture
51
+ capture,
52
+ domReady
51
53
  }) {
52
54
  const callListener = useEvent(listener);
53
55
  const open = store.useState("open");
56
+ const focusedRef = useRef(false);
57
+ useSafeLayoutEffect(() => {
58
+ if (!open)
59
+ return;
60
+ if (!domReady)
61
+ return;
62
+ const { contentElement } = store.getState();
63
+ if (!contentElement)
64
+ return;
65
+ const onFocus = () => {
66
+ focusedRef.current = true;
67
+ };
68
+ contentElement.addEventListener("focusin", onFocus, true);
69
+ return () => contentElement.removeEventListener("focusin", onFocus, true);
70
+ }, [store, open, domReady]);
54
71
  useEffect(() => {
55
72
  if (!open)
56
73
  return;
@@ -71,7 +88,8 @@ function useEventOutside({
71
88
  return;
72
89
  if (isMouseEventOnDialog(event, contentElement))
73
90
  return;
74
- if (!isElementMarked(target, contentElement.id))
91
+ const focused = focusedRef.current;
92
+ if (focused && !isElementMarked(target, contentElement.id))
75
93
  return;
76
94
  callListener(event);
77
95
  };
@@ -84,10 +102,10 @@ function shouldHideOnInteractOutside(hideOnInteractOutside, event) {
84
102
  }
85
103
  return !!hideOnInteractOutside;
86
104
  }
87
- function useHideOnInteractOutside(store, hideOnInteractOutside) {
105
+ function useHideOnInteractOutside(store, hideOnInteractOutside, domReady) {
88
106
  const open = store.useState("open");
89
107
  const previousMouseDownRef = usePreviousMouseDownRef(open);
90
- const props = { store, capture: true };
108
+ const props = { store, domReady, capture: true };
91
109
  useEventOutside(__spreadProps(__spreadValues({}, props), {
92
110
  type: "click",
93
111
  listener: (event) => {
@@ -6,7 +6,7 @@ import {
6
6
  } from "./FW6QFGFT.js";
7
7
  import {
8
8
  walkTreeOutside
9
- } from "./FV23EKJL.js";
9
+ } from "./5M4ITSXL.js";
10
10
 
11
11
  // src/dialog/utils/disable-accessibility-tree-outside.ts
12
12
  function hideElementFromAccessibilityTree(element) {
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  markAncestor
3
- } from "./HCZMY53N.js";
3
+ } from "./LEBYH5FW.js";
4
4
  import {
5
5
  Role
6
6
  } from "./M5I7AM4N.js";
@@ -9,7 +9,7 @@ import {
9
9
  } from "./WHEEIXMF.js";
10
10
  import {
11
11
  useDisclosureStore
12
- } from "./LZ4RMGK5.js";
12
+ } from "./JJW3R5IK.js";
13
13
  import {
14
14
  useMergeRefs,
15
15
  useSafeLayoutEffect
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  getCollectionRendererItemId,
3
3
  useCollectionRenderer
4
- } from "./VJKEASM4.js";
4
+ } from "./QLIKSQTQ.js";
5
5
  import {
6
6
  CompositeContext
7
7
  } from "./WJ37OVG2.js";
@@ -11,7 +11,7 @@ import {
11
11
  } from "./NQJBHION.js";
12
12
  import {
13
13
  useStoreState
14
- } from "./563SOJCA.js";
14
+ } from "./MXMUDZTV.js";
15
15
  import {
16
16
  useId
17
17
  } from "./J7Q2EO23.js";
@@ -5,7 +5,7 @@ import {
5
5
  } from "./X7FKJQME.js";
6
6
  import {
7
7
  usePopover
8
- } from "./J2DK7IKI.js";
8
+ } from "./JHKKFNCJ.js";
9
9
  import {
10
10
  createComponent,
11
11
  createElement,
@@ -18,7 +18,7 @@ import {
18
18
  } from "./NQJBHION.js";
19
19
  import {
20
20
  useStoreState
21
- } from "./563SOJCA.js";
21
+ } from "./MXMUDZTV.js";
22
22
  import {
23
23
  useEvent,
24
24
  useId,
@@ -10,7 +10,7 @@ import {
10
10
  } from "./W5P7IKOU.js";
11
11
  import {
12
12
  useCompositeItem
13
- } from "./LNROWH6D.js";
13
+ } from "./VVJJXZ6R.js";
14
14
  import {
15
15
  createElement,
16
16
  createHook,
@@ -18,7 +18,7 @@ import {
18
18
  } from "./NQJBHION.js";
19
19
  import {
20
20
  useStoreState
21
- } from "./563SOJCA.js";
21
+ } from "./MXMUDZTV.js";
22
22
  import {
23
23
  useBooleanEvent,
24
24
  useEvent
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  useDialog
3
- } from "./5UGSKFCK.js";
3
+ } from "./BIPBU2AE.js";
4
4
  import {
5
5
  PopoverContext
6
6
  } from "./6GS36SYX.js";
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  useStore,
3
3
  useStoreProps
4
- } from "./563SOJCA.js";
4
+ } from "./MXMUDZTV.js";
5
5
  import {
6
6
  __spreadValues
7
7
  } from "./PNRLI7OV.js";
@@ -11,7 +11,7 @@ import {
11
11
  } from "./NQJBHION.js";
12
12
  import {
13
13
  useStoreState
14
- } from "./563SOJCA.js";
14
+ } from "./MXMUDZTV.js";
15
15
  import {
16
16
  useEvent,
17
17
  useMergeRefs,
@@ -6,7 +6,7 @@ import {
6
6
  } from "./FW6QFGFT.js";
7
7
  import {
8
8
  walkTreeOutside
9
- } from "./FV23EKJL.js";
9
+ } from "./5M4ITSXL.js";
10
10
 
11
11
  // src/dialog/utils/mark-tree-outside.ts
12
12
  import { chain } from "@ariakit/core/utils/misc";
@@ -15,12 +15,18 @@ function getPropertyName(id = "", ancestor = false) {
15
15
  }
16
16
  function markElement(element, id = "") {
17
17
  return chain(
18
+ // Debug
19
+ // setAttribute(element, getPropertyName(), "true"),
20
+ // setAttribute(element, getPropertyName(id), "true"),
18
21
  setProperty(element, getPropertyName(), true),
19
22
  setProperty(element, getPropertyName(id), true)
20
23
  );
21
24
  }
22
25
  function markAncestor(element, id = "") {
23
26
  return chain(
27
+ // Debug
28
+ // setAttribute(element, getPropertyName("", true), "true"),
29
+ // setAttribute(element, getPropertyName(id, true), "true"),
24
30
  setProperty(element, getPropertyName("", true), true),
25
31
  setProperty(element, getPropertyName(id, true), true)
26
32
  );
@@ -48,7 +54,12 @@ function markTreeOutside(dialogId, ...elements) {
48
54
  return;
49
55
  cleanups.unshift(markElement(element, dialogId));
50
56
  },
51
- (ancestor) => cleanups.unshift(markAncestor(ancestor, dialogId))
57
+ (ancestor, element) => {
58
+ const isAnotherDialogAncestor = element.hasAttribute("data-dialog") && element.id !== dialogId;
59
+ if (isAnotherDialogAncestor)
60
+ return;
61
+ cleanups.unshift(markAncestor(ancestor, dialogId));
62
+ }
52
63
  );
53
64
  const restoreAccessibilityTree = () => {
54
65
  cleanups.forEach((fn) => fn());
@@ -15,6 +15,28 @@ import { flushSync } from "react-dom";
15
15
  import { useSyncExternalStore } from "use-sync-external-store/shim/index.js";
16
16
  var noopSubscribe = () => () => {
17
17
  };
18
+ var inFlushSyncContext = false;
19
+ function safeFlushSync(fn, canFlushSync = true) {
20
+ if (inFlushSyncContext || !canFlushSync) {
21
+ fn();
22
+ return;
23
+ }
24
+ inFlushSyncContext = true;
25
+ const originalError = console.error;
26
+ if (process.env.NODE_ENV !== "production") {
27
+ console.error = (msg) => {
28
+ if (msg.startsWith("Warning: flushSync"))
29
+ return;
30
+ originalError(msg);
31
+ };
32
+ }
33
+ try {
34
+ flushSync(fn);
35
+ } finally {
36
+ console.error = originalError;
37
+ inFlushSyncContext = false;
38
+ }
39
+ }
18
40
  function useStoreState(store, keyOrSelector = identity) {
19
41
  const getSnapshot = () => {
20
42
  if (!store)
@@ -43,6 +65,10 @@ function useStoreProps(store, props, key, setKey) {
43
65
  setValue: setKey ? props[setKey] : void 0
44
66
  });
45
67
  useSafeLayoutEffect(() => {
68
+ let canFlushSync = false;
69
+ queueMicrotask(() => {
70
+ canFlushSync = true;
71
+ });
46
72
  return store.sync(
47
73
  (state, prev) => {
48
74
  const { value: value2, setValue } = propsRef.current;
@@ -52,7 +78,7 @@ function useStoreProps(store, props, key, setKey) {
52
78
  return;
53
79
  if (state[key] === value2)
54
80
  return;
55
- flushSync(() => setValue(state[key]));
81
+ safeFlushSync(() => setValue(state[key]), canFlushSync);
56
82
  },
57
83
  [key]
58
84
  );
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  hideElementFromAccessibilityTree
3
- } from "./CYJJUQU3.js";
3
+ } from "./GDORSOK6.js";
4
4
  import {
5
5
  isBackdrop
6
6
  } from "./IXXFVVA2.js";
@@ -14,7 +14,7 @@ import {
14
14
  } from "./FW6QFGFT.js";
15
15
  import {
16
16
  walkTreeOutside
17
- } from "./FV23EKJL.js";
17
+ } from "./5M4ITSXL.js";
18
18
 
19
19
  // src/dialog/utils/disable-tree-outside.ts
20
20
  import { contains } from "@ariakit/core/utils/dom";
@@ -3,7 +3,7 @@ import {
3
3
  } from "./6I2PARRP.js";
4
4
  import {
5
5
  useCompositeItem
6
- } from "./LNROWH6D.js";
6
+ } from "./VVJJXZ6R.js";
7
7
  import {
8
8
  createElement,
9
9
  createHook,
@@ -11,7 +11,7 @@ import {
11
11
  } from "./NQJBHION.js";
12
12
  import {
13
13
  useStoreState
14
- } from "./563SOJCA.js";
14
+ } from "./MXMUDZTV.js";
15
15
  import {
16
16
  useEvent,
17
17
  useId,
@@ -7,7 +7,7 @@ import {
7
7
  } from "./NQJBHION.js";
8
8
  import {
9
9
  useStoreState
10
- } from "./563SOJCA.js";
10
+ } from "./MXMUDZTV.js";
11
11
  import {
12
12
  useBooleanEvent,
13
13
  useEvent,
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  useDisclosureStoreOptions,
3
3
  useDisclosureStoreProps
4
- } from "./LZ4RMGK5.js";
4
+ } from "./JJW3R5IK.js";
5
5
  import {
6
6
  useStore
7
- } from "./563SOJCA.js";
7
+ } from "./MXMUDZTV.js";
8
8
  import {
9
9
  __spreadValues
10
10
  } from "./PNRLI7OV.js";
@@ -1,11 +1,11 @@
1
1
  import {
2
2
  useDialogStoreOptions,
3
3
  useDialogStoreProps
4
- } from "./LYXIRVKB.js";
4
+ } from "./RRY7OZXM.js";
5
5
  import {
6
6
  useStore,
7
7
  useStoreProps
8
- } from "./563SOJCA.js";
8
+ } from "./MXMUDZTV.js";
9
9
  import {
10
10
  __spreadValues
11
11
  } from "./PNRLI7OV.js";
@@ -21,7 +21,7 @@ import {
21
21
  } from "./NQJBHION.js";
22
22
  import {
23
23
  useStoreState
24
- } from "./563SOJCA.js";
24
+ } from "./MXMUDZTV.js";
25
25
  import {
26
26
  useBooleanEvent,
27
27
  useEvent,
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  useStore,
3
3
  useStoreProps
4
- } from "./563SOJCA.js";
4
+ } from "./MXMUDZTV.js";
5
5
  import {
6
6
  __spreadValues
7
7
  } from "./PNRLI7OV.js";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  useCompositeItem
3
- } from "./LNROWH6D.js";
3
+ } from "./VVJJXZ6R.js";
4
4
  import {
5
5
  createElement,
6
6
  createHook,
@@ -11,7 +11,7 @@ import {
11
11
  } from "./NQJBHION.js";
12
12
  import {
13
13
  useStoreState
14
- } from "./563SOJCA.js";
14
+ } from "./MXMUDZTV.js";
15
15
  import {
16
16
  useEvent,
17
17
  useMergeRefs
@@ -2,8 +2,8 @@ import {
2
2
  useCheckboxStore,
3
3
  useCheckboxStoreOptions,
4
4
  useCheckboxStoreProps
5
- } from "../__chunks/3QWF4P62.js";
6
- import "../__chunks/563SOJCA.js";
5
+ } from "../__chunks/4LTL37RB.js";
6
+ import "../__chunks/MXMUDZTV.js";
7
7
  import "../__chunks/J7Q2EO23.js";
8
8
  import "../__chunks/CP3U4HPL.js";
9
9
  import "../__chunks/PNRLI7OV.js";
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  Checkbox,
3
3
  useCheckbox
4
- } from "../__chunks/OQKUGLAX.js";
4
+ } from "../__chunks/JWSYWSCR.js";
5
5
  import "../__chunks/M5KYRTQG.js";
6
6
  import "../__chunks/P4RGQGTG.js";
7
7
  import "../__chunks/MYID4V27.js";
8
8
  import "../__chunks/BMLNRUFQ.js";
9
9
  import "../__chunks/NQJBHION.js";
10
- import "../__chunks/563SOJCA.js";
10
+ import "../__chunks/MXMUDZTV.js";
11
11
  import "../__chunks/J7Q2EO23.js";
12
12
  import "../__chunks/CP3U4HPL.js";
13
13
  import "../__chunks/PNRLI7OV.js";
@@ -3,10 +3,10 @@ import {
3
3
  getCollectionRendererItem,
4
4
  getCollectionRendererItemId,
5
5
  useCollectionRenderer
6
- } from "../__chunks/VJKEASM4.js";
6
+ } from "../__chunks/QLIKSQTQ.js";
7
7
  import "../__chunks/T3DJZG63.js";
8
8
  import "../__chunks/NQJBHION.js";
9
- import "../__chunks/563SOJCA.js";
9
+ import "../__chunks/MXMUDZTV.js";
10
10
  import "../__chunks/J7Q2EO23.js";
11
11
  import "../__chunks/CP3U4HPL.js";
12
12
  import "../__chunks/PNRLI7OV.js";
@@ -2,8 +2,8 @@ import {
2
2
  useCollectionStore,
3
3
  useCollectionStoreOptions,
4
4
  useCollectionStoreProps
5
- } from "../__chunks/BFJZP2NO.js";
6
- import "../__chunks/563SOJCA.js";
5
+ } from "../__chunks/WNGYZL6A.js";
6
+ import "../__chunks/MXMUDZTV.js";
7
7
  import "../__chunks/J7Q2EO23.js";
8
8
  import "../__chunks/CP3U4HPL.js";
9
9
  import "../__chunks/PNRLI7OV.js";
@@ -7,7 +7,7 @@ import {
7
7
  } from "../__chunks/W5P7IKOU.js";
8
8
  import {
9
9
  useCompositeItem
10
- } from "../__chunks/LNROWH6D.js";
10
+ } from "../__chunks/VVJJXZ6R.js";
11
11
  import "../__chunks/P4RGQGTG.js";
12
12
  import "../__chunks/HGFTMLQ7.js";
13
13
  import "../__chunks/T3DJZG63.js";
@@ -20,7 +20,7 @@ import {
20
20
  createHook,
21
21
  createMemoComponent
22
22
  } from "../__chunks/NQJBHION.js";
23
- import "../__chunks/563SOJCA.js";
23
+ import "../__chunks/MXMUDZTV.js";
24
24
  import {
25
25
  useBooleanEvent,
26
26
  useEvent,
@@ -4,23 +4,23 @@ import {
4
4
  import "../__chunks/5VGBBGF5.js";
5
5
  import {
6
6
  usePopover
7
- } from "../__chunks/J2DK7IKI.js";
8
- import "../__chunks/5UGSKFCK.js";
9
- import "../__chunks/TM5MM3ME.js";
10
- import "../__chunks/AR6DTI3S.js";
11
- import "../__chunks/CYJJUQU3.js";
7
+ } from "../__chunks/JHKKFNCJ.js";
8
+ import "../__chunks/BIPBU2AE.js";
9
+ import "../__chunks/H3BU75TA.js";
10
+ import "../__chunks/NHPU54IO.js";
11
+ import "../__chunks/GDORSOK6.js";
12
12
  import "../__chunks/3LAWLNOX.js";
13
13
  import "../__chunks/CJI67A3R.js";
14
14
  import "../__chunks/OEA63YXU.js";
15
- import "../__chunks/4XWTU3WN.js";
16
- import "../__chunks/HCZMY53N.js";
15
+ import "../__chunks/E5XSMSHD.js";
16
+ import "../__chunks/LEBYH5FW.js";
17
17
  import "../__chunks/IXXFVVA2.js";
18
18
  import "../__chunks/7JNF6I52.js";
19
19
  import "../__chunks/KOVUJERF.js";
20
20
  import "../__chunks/62DFK33R.js";
21
21
  import "../__chunks/FW6QFGFT.js";
22
22
  import "../__chunks/IYNN2ZO5.js";
23
- import "../__chunks/FV23EKJL.js";
23
+ import "../__chunks/5M4ITSXL.js";
24
24
  import "../__chunks/6OMX4H3W.js";
25
25
  import "../__chunks/LL3AE4N4.js";
26
26
  import "../__chunks/EJ3GIT5B.js";
@@ -38,8 +38,8 @@ import {
38
38
  createElement,
39
39
  createHook
40
40
  } from "../__chunks/NQJBHION.js";
41
- import "../__chunks/LZ4RMGK5.js";
42
- import "../__chunks/563SOJCA.js";
41
+ import "../__chunks/JJW3R5IK.js";
42
+ import "../__chunks/MXMUDZTV.js";
43
43
  import "../__chunks/J7Q2EO23.js";
44
44
  import "../__chunks/CP3U4HPL.js";
45
45
  import {