@ariakit/react-core 0.2.15 → 0.2.17

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 (180) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/cjs/__chunks/{GHDSJPDP.cjs → 2CBM6TG2.cjs} +9 -1
  3. package/cjs/__chunks/{7AY74MRV.cjs → 2GAPZOO5.cjs} +2 -2
  4. package/cjs/__chunks/{4ALK6CLY.cjs → 3ALHBZ3R.cjs} +2 -2
  5. package/cjs/__chunks/{PJQOOE4T.cjs → 4ZIMX233.cjs} +6 -8
  6. package/cjs/__chunks/{XE2DJMCI.cjs → 6BAHKJ5K.cjs} +14 -20
  7. package/cjs/__chunks/{RO6U6W2X.cjs → 6XUE2BI4.cjs} +7 -7
  8. package/cjs/__chunks/{B4KY2VS7.cjs → ATSMFQCO.cjs} +3 -3
  9. package/cjs/__chunks/{IIT6ECXG.cjs → BOBM73LT.cjs} +8 -8
  10. package/cjs/__chunks/{COQS7NEY.cjs → BPAMJRUF.cjs} +2 -2
  11. package/cjs/__chunks/{GJDDV2DB.cjs → CRKIULUL.cjs} +13 -13
  12. package/cjs/__chunks/{AGHEZ6QM.cjs → DZGTHAPX.cjs} +2 -2
  13. package/cjs/__chunks/{KAIRFV3B.cjs → EHQTSSAA.cjs} +4 -4
  14. package/cjs/__chunks/{SIVNE3PR.cjs → ETK4FMZH.cjs} +12 -12
  15. package/cjs/__chunks/{YBLCB5MM.cjs → HOHFF2K6.cjs} +5 -5
  16. package/cjs/__chunks/{VXMYNJ4Z.cjs → KCH72A7J.cjs} +2 -2
  17. package/cjs/__chunks/{GYMLYZWR.cjs → LRB2BIFR.cjs} +3 -3
  18. package/cjs/__chunks/{RS6F2A54.cjs → MNRJXH5I.cjs} +4 -4
  19. package/cjs/__chunks/{HV7BPIPP.cjs → MNUCM2FP.cjs} +7 -7
  20. package/cjs/__chunks/{MEIHBPXG.cjs → MPGRRS75.cjs} +32 -26
  21. package/cjs/__chunks/{VBRBBWCP.cjs → NH6Q6YSM.cjs} +2 -2
  22. package/cjs/__chunks/{UQ677BGW.cjs → OJKRJ6N2.cjs} +6 -6
  23. package/cjs/__chunks/{ZC54XMTA.cjs → OVOYNBFC.cjs} +4 -4
  24. package/cjs/__chunks/{LHLJ5HWH.cjs → RYHFE3BI.cjs} +2 -2
  25. package/cjs/__chunks/{2BUZEL3H.cjs → TUSNAJ32.cjs} +2 -2
  26. package/cjs/__chunks/{5PVFQNEK.cjs → ZK5KHSMP.cjs} +10 -10
  27. package/cjs/checkbox/checkbox-store.cjs +3 -3
  28. package/cjs/checkbox/checkbox.cjs +3 -3
  29. package/cjs/collection/collection-item.cjs +2 -2
  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 +4 -4
  33. package/cjs/combobox/combobox-popover.cjs +7 -7
  34. package/cjs/combobox/combobox-store.cjs +11 -11
  35. package/cjs/combobox/combobox.cjs +3 -3
  36. package/cjs/command/command.d.ts +18 -5
  37. package/cjs/composite/composite-container.cjs +3 -3
  38. package/cjs/composite/composite-item.cjs +4 -4
  39. package/cjs/composite/composite-overflow-disclosure.cjs +7 -6
  40. package/cjs/composite/composite-overflow-store.cjs +7 -7
  41. package/cjs/composite/composite-overflow.cjs +7 -7
  42. package/cjs/composite/composite-renderer.cjs +4 -4
  43. package/cjs/composite/composite-store.cjs +4 -4
  44. package/cjs/dialog/dialog-backdrop.cjs +4 -4
  45. package/cjs/dialog/dialog-store.cjs +4 -4
  46. package/cjs/dialog/dialog.cjs +6 -6
  47. package/cjs/dialog/utils/use-nested-dialogs.cjs +2 -2
  48. package/cjs/disclosure/disclosure-store.cjs +3 -3
  49. package/cjs/focusable/focusable.d.ts +52 -13
  50. package/cjs/form/form-checkbox.cjs +8 -8
  51. package/cjs/form/form-description.cjs +2 -2
  52. package/cjs/form/form-error.cjs +2 -2
  53. package/cjs/form/form-field.cjs +3 -3
  54. package/cjs/form/form-input.cjs +3 -3
  55. package/cjs/form/form-label.cjs +2 -2
  56. package/cjs/form/form-push.cjs +2 -2
  57. package/cjs/form/form-radio.cjs +7 -7
  58. package/cjs/form/form-store.cjs +8 -8
  59. package/cjs/hovercard/hovercard-anchor.cjs +2 -2
  60. package/cjs/hovercard/hovercard-disclosure.cjs +12 -14
  61. package/cjs/hovercard/hovercard-store.cjs +6 -6
  62. package/cjs/hovercard/hovercard.cjs +8 -8
  63. package/cjs/menu/menu-bar-store.cjs +6 -6
  64. package/cjs/menu/menu-button.cjs +9 -6
  65. package/cjs/menu/menu-item-checkbox.cjs +9 -9
  66. package/cjs/menu/menu-item-radio.cjs +7 -7
  67. package/cjs/menu/menu-item.cjs +5 -5
  68. package/cjs/menu/menu-list.cjs +3 -3
  69. package/cjs/menu/menu-store.cjs +13 -13
  70. package/cjs/menu/menu.cjs +10 -10
  71. package/cjs/popover/popover-store.cjs +5 -5
  72. package/cjs/popover/popover.cjs +7 -7
  73. package/cjs/radio/radio-store.cjs +7 -7
  74. package/cjs/radio/radio.cjs +5 -5
  75. package/cjs/select/select-item.cjs +4 -4
  76. package/cjs/select/select-popover.cjs +7 -7
  77. package/cjs/select/select-renderer.cjs +7 -7
  78. package/cjs/select/select-store.cjs +11 -11
  79. package/cjs/tab/tab-panel.cjs +5 -5
  80. package/cjs/tab/tab-store.cjs +9 -9
  81. package/cjs/tab/tab.cjs +4 -4
  82. package/cjs/toolbar/toolbar-container.cjs +7 -7
  83. package/cjs/toolbar/toolbar-input.cjs +5 -5
  84. package/cjs/toolbar/toolbar-item.cjs +5 -5
  85. package/cjs/toolbar/toolbar-store.cjs +6 -6
  86. package/cjs/tooltip/tooltip-anchor.cjs +22 -28
  87. package/cjs/tooltip/tooltip-store.cjs +10 -10
  88. package/cjs/tooltip/tooltip.cjs +8 -8
  89. package/cjs/tsconfig.build.tsbuildinfo +1 -1
  90. package/cjs/utils/store.cjs +2 -2
  91. package/esm/__chunks/{ID2DTD7Z.js → 24II2LYU.js} +5 -7
  92. package/esm/__chunks/{JWSYWSCR.js → 3CJV7UYE.js} +1 -1
  93. package/esm/__chunks/{SPTQP5I5.js → 3PKTK2K7.js} +2 -2
  94. package/esm/__chunks/{H3BU75TA.js → 5IZLNERH.js} +1 -1
  95. package/esm/__chunks/{QHXLY5NM.js → 5QHNNZNE.js} +1 -1
  96. package/esm/__chunks/{4LTL37RB.js → 6TMY6IFR.js} +1 -1
  97. package/esm/__chunks/{36V3RYFS.js → 7KULBIZY.js} +2 -2
  98. package/esm/__chunks/{I6WUAEGK.js → DITMA5PJ.js} +2 -2
  99. package/esm/__chunks/{VVJJXZ6R.js → FVD2NJZN.js} +2 -2
  100. package/esm/__chunks/{JHKKFNCJ.js → K5MSER23.js} +1 -1
  101. package/esm/__chunks/{ISVIGIQD.js → KME3EPVS.js} +1 -1
  102. package/esm/__chunks/{74BBE733.js → LDICFO4C.js} +2 -2
  103. package/esm/__chunks/{QLIKSQTQ.js → ONFAHVST.js} +1 -1
  104. package/esm/__chunks/{XEEFNNEM.js → P2MU7N5N.js} +1 -1
  105. package/esm/__chunks/{XE25NQP3.js → P4CYWFUE.js} +1 -1
  106. package/esm/__chunks/{MXMUDZTV.js → P63NRZ4A.js} +31 -25
  107. package/esm/__chunks/{OEA63YXU.js → PLOINBVB.js} +14 -20
  108. package/esm/__chunks/{WNGYZL6A.js → RS7KBRGA.js} +1 -1
  109. package/esm/__chunks/{JJW3R5IK.js → SWJ5EOOS.js} +1 -1
  110. package/esm/__chunks/{BIPBU2AE.js → SZIMOWLA.js} +5 -5
  111. package/esm/__chunks/{OJNIJGF2.js → UVKFBOMX.js} +2 -2
  112. package/esm/__chunks/{HGFTMLQ7.js → VFNGSUSF.js} +13 -13
  113. package/esm/__chunks/{RRY7OZXM.js → WC3GK4CL.js} +2 -2
  114. package/esm/__chunks/{JFQ4TNZX.js → XADDW7ND.js} +2 -2
  115. package/esm/__chunks/{I3PXTXPI.js → Y5XLHDDM.js} +9 -1
  116. package/esm/checkbox/checkbox-store.js +2 -2
  117. package/esm/checkbox/checkbox.js +2 -2
  118. package/esm/collection/collection-item.js +1 -1
  119. package/esm/collection/collection-renderer.js +2 -2
  120. package/esm/collection/collection-store.js +2 -2
  121. package/esm/combobox/combobox-item.js +3 -3
  122. package/esm/combobox/combobox-popover.js +6 -6
  123. package/esm/combobox/combobox-store.js +6 -6
  124. package/esm/combobox/combobox.js +3 -3
  125. package/esm/command/command.d.ts +18 -5
  126. package/esm/composite/composite-container.js +2 -2
  127. package/esm/composite/composite-item.js +3 -3
  128. package/esm/composite/composite-overflow-disclosure.js +6 -5
  129. package/esm/composite/composite-overflow-store.js +4 -4
  130. package/esm/composite/composite-overflow.js +6 -6
  131. package/esm/composite/composite-renderer.js +3 -3
  132. package/esm/composite/composite-store.js +3 -3
  133. package/esm/dialog/dialog-backdrop.js +3 -3
  134. package/esm/dialog/dialog-store.js +3 -3
  135. package/esm/dialog/dialog.js +5 -5
  136. package/esm/dialog/utils/use-nested-dialogs.js +1 -1
  137. package/esm/disclosure/disclosure-store.js +2 -2
  138. package/esm/focusable/focusable.d.ts +52 -13
  139. package/esm/form/form-checkbox.js +5 -5
  140. package/esm/form/form-description.js +1 -1
  141. package/esm/form/form-error.js +1 -1
  142. package/esm/form/form-field.js +2 -2
  143. package/esm/form/form-input.js +2 -2
  144. package/esm/form/form-label.js +1 -1
  145. package/esm/form/form-push.js +1 -1
  146. package/esm/form/form-radio.js +5 -5
  147. package/esm/form/form-store.js +2 -2
  148. package/esm/hovercard/hovercard-anchor.js +1 -1
  149. package/esm/hovercard/hovercard-disclosure.js +12 -14
  150. package/esm/hovercard/hovercard-store.js +5 -5
  151. package/esm/hovercard/hovercard.js +7 -7
  152. package/esm/menu/menu-bar-store.js +3 -3
  153. package/esm/menu/menu-button.js +7 -4
  154. package/esm/menu/menu-item-checkbox.js +6 -6
  155. package/esm/menu/menu-item-radio.js +5 -5
  156. package/esm/menu/menu-item.js +4 -4
  157. package/esm/menu/menu-list.js +2 -2
  158. package/esm/menu/menu-store.js +7 -7
  159. package/esm/menu/menu.js +8 -8
  160. package/esm/popover/popover-store.js +4 -4
  161. package/esm/popover/popover.js +6 -6
  162. package/esm/radio/radio-store.js +3 -3
  163. package/esm/radio/radio.js +4 -4
  164. package/esm/select/select-item.js +3 -3
  165. package/esm/select/select-popover.js +6 -6
  166. package/esm/select/select-renderer.js +3 -3
  167. package/esm/select/select-store.js +6 -6
  168. package/esm/tab/tab-panel.js +3 -3
  169. package/esm/tab/tab-store.js +3 -3
  170. package/esm/tab/tab.js +3 -3
  171. package/esm/toolbar/toolbar-container.js +5 -5
  172. package/esm/toolbar/toolbar-input.js +4 -4
  173. package/esm/toolbar/toolbar-item.js +4 -4
  174. package/esm/toolbar/toolbar-store.js +3 -3
  175. package/esm/tooltip/tooltip-anchor.js +22 -28
  176. package/esm/tooltip/tooltip-store.js +5 -5
  177. package/esm/tooltip/tooltip.js +7 -7
  178. package/esm/tsconfig.build.tsbuildinfo +1 -1
  179. package/esm/utils/store.js +1 -1
  180. package/package.json +2 -2
@@ -11,7 +11,7 @@ import {
11
11
  } from "./NQJBHION.js";
12
12
  import {
13
13
  useStoreState
14
- } from "./MXMUDZTV.js";
14
+ } from "./P63NRZ4A.js";
15
15
  import {
16
16
  useEvent,
17
17
  useMergeRefs,
@@ -1,11 +1,11 @@
1
1
  import {
2
2
  useDialogStoreOptions,
3
3
  useDialogStoreProps
4
- } from "./RRY7OZXM.js";
4
+ } from "./WC3GK4CL.js";
5
5
  import {
6
6
  useStore,
7
7
  useStoreProps
8
- } from "./MXMUDZTV.js";
8
+ } from "./P63NRZ4A.js";
9
9
  import {
10
10
  __spreadValues
11
11
  } from "./PNRLI7OV.js";
@@ -9,7 +9,7 @@ import {
9
9
  } from "./WHEEIXMF.js";
10
10
  import {
11
11
  useDisclosureStore
12
- } from "./JJW3R5IK.js";
12
+ } from "./SWJ5EOOS.js";
13
13
  import {
14
14
  useMergeRefs,
15
15
  useSafeLayoutEffect
@@ -3,7 +3,7 @@ import {
3
3
  } from "./P3I4MECH.js";
4
4
  import {
5
5
  useCollectionItem
6
- } from "./HGFTMLQ7.js";
6
+ } from "./VFNGSUSF.js";
7
7
  import {
8
8
  createElement,
9
9
  createHook,
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  useStore,
3
3
  useStoreProps
4
- } from "./MXMUDZTV.js";
4
+ } from "./P63NRZ4A.js";
5
5
 
6
6
  // src/checkbox/checkbox-store.ts
7
7
  import * as Core from "@ariakit/core/checkbox/checkbox-store";
@@ -1,11 +1,11 @@
1
1
  import {
2
2
  useCollectionStoreOptions,
3
3
  useCollectionStoreProps
4
- } from "./WNGYZL6A.js";
4
+ } from "./RS7KBRGA.js";
5
5
  import {
6
6
  useStore,
7
7
  useStoreProps
8
- } from "./MXMUDZTV.js";
8
+ } from "./P63NRZ4A.js";
9
9
  import {
10
10
  __spreadValues
11
11
  } from "./PNRLI7OV.js";
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  getCollectionRendererItemId,
3
3
  useCollectionRenderer
4
- } from "./QLIKSQTQ.js";
4
+ } from "./ONFAHVST.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 "./MXMUDZTV.js";
14
+ } from "./P63NRZ4A.js";
15
15
  import {
16
16
  useId
17
17
  } from "./J7Q2EO23.js";
@@ -3,7 +3,7 @@ import {
3
3
  } from "./P4RGQGTG.js";
4
4
  import {
5
5
  useCollectionItem
6
- } from "./HGFTMLQ7.js";
6
+ } from "./VFNGSUSF.js";
7
7
  import {
8
8
  focusSilently,
9
9
  getEnabledItem,
@@ -21,7 +21,7 @@ import {
21
21
  } from "./NQJBHION.js";
22
22
  import {
23
23
  useStoreState
24
- } from "./MXMUDZTV.js";
24
+ } from "./P63NRZ4A.js";
25
25
  import {
26
26
  useBooleanEvent,
27
27
  useEvent,
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  useDialog
3
- } from "./BIPBU2AE.js";
3
+ } from "./SZIMOWLA.js";
4
4
  import {
5
5
  PopoverContext
6
6
  } from "./6GS36SYX.js";
@@ -18,7 +18,7 @@ import {
18
18
  } from "./NQJBHION.js";
19
19
  import {
20
20
  useStoreState
21
- } from "./MXMUDZTV.js";
21
+ } from "./P63NRZ4A.js";
22
22
  import {
23
23
  useEvent,
24
24
  useId,
@@ -1,11 +1,11 @@
1
1
  import {
2
2
  usePopoverStoreOptions,
3
3
  usePopoverStoreProps
4
- } from "./SPTQP5I5.js";
4
+ } from "./3PKTK2K7.js";
5
5
  import {
6
6
  useStore,
7
7
  useStoreProps
8
- } from "./MXMUDZTV.js";
8
+ } from "./P63NRZ4A.js";
9
9
  import {
10
10
  __spreadValues
11
11
  } from "./PNRLI7OV.js";
@@ -7,7 +7,7 @@ import {
7
7
  } from "./NQJBHION.js";
8
8
  import {
9
9
  useStoreState
10
- } from "./MXMUDZTV.js";
10
+ } from "./P63NRZ4A.js";
11
11
  import {
12
12
  useBooleanEvent,
13
13
  useEvent,
@@ -11,7 +11,7 @@ import {
11
11
  } from "./NQJBHION.js";
12
12
  import {
13
13
  useStoreState
14
- } from "./MXMUDZTV.js";
14
+ } from "./P63NRZ4A.js";
15
15
  import {
16
16
  useEvent,
17
17
  useMergeRefs
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  useCompositeItem
3
- } from "./VVJJXZ6R.js";
3
+ } from "./FVD2NJZN.js";
4
4
  import {
5
5
  createElement,
6
6
  createHook,
@@ -9,10 +9,12 @@ import {
9
9
  } from "./PNRLI7OV.js";
10
10
 
11
11
  // src/utils/store.tsx
12
- import { useCallback, useMemo } from "react";
12
+ import * as React from "react";
13
13
  import { hasOwnProperty, identity } from "@ariakit/core/utils/misc";
14
+ import { batch, init, subscribe, sync } from "@ariakit/core/utils/store";
14
15
  import { flushSync } from "react-dom";
15
- import { useSyncExternalStore } from "use-sync-external-store/shim/index.js";
16
+ import useSyncExternalStoreExports from "use-sync-external-store/shim/index.js";
17
+ var { useSyncExternalStore } = useSyncExternalStoreExports;
16
18
  var noopSubscribe = () => () => {
17
19
  };
18
20
  var inFlushSyncContext = false;
@@ -38,6 +40,14 @@ function safeFlushSync(fn, canFlushSync = true) {
38
40
  }
39
41
  }
40
42
  function useStoreState(store, keyOrSelector = identity) {
43
+ const storeSubscribe = React.useCallback(
44
+ (callback) => {
45
+ if (!store)
46
+ return noopSubscribe();
47
+ return subscribe(store, null, callback);
48
+ },
49
+ [store]
50
+ );
41
51
  const getSnapshot = () => {
42
52
  if (!store)
43
53
  return;
@@ -52,11 +62,7 @@ function useStoreState(store, keyOrSelector = identity) {
52
62
  return;
53
63
  return state[key];
54
64
  };
55
- return useSyncExternalStore(
56
- (store == null ? void 0 : store.subscribe) || noopSubscribe,
57
- getSnapshot,
58
- getSnapshot
59
- );
65
+ return useSyncExternalStore(storeSubscribe, getSnapshot, getSnapshot);
60
66
  }
61
67
  function useStoreProps(store, props, key, setKey) {
62
68
  const value = hasOwnProperty(props, key) ? props[key] : void 0;
@@ -69,36 +75,36 @@ function useStoreProps(store, props, key, setKey) {
69
75
  queueMicrotask(() => {
70
76
  canFlushSync = true;
71
77
  });
72
- return store.sync(
73
- (state, prev) => {
74
- const { value: value2, setValue } = propsRef.current;
75
- if (!setValue)
76
- return;
77
- if (state[key] === prev[key])
78
- return;
79
- if (state[key] === value2)
80
- return;
81
- safeFlushSync(() => setValue(state[key]), canFlushSync);
82
- },
83
- [key]
84
- );
78
+ return sync(store, [key], (state, prev) => {
79
+ const { value: value2, setValue } = propsRef.current;
80
+ if (!setValue)
81
+ return;
82
+ if (state[key] === prev[key])
83
+ return;
84
+ if (state[key] === value2)
85
+ return;
86
+ safeFlushSync(() => setValue(state[key]), canFlushSync);
87
+ });
85
88
  }, [store, key]);
86
89
  useSafeLayoutEffect(() => {
87
- return store.sync(() => {
90
+ return batch(store, [key], () => {
88
91
  if (value === void 0)
89
92
  return;
90
93
  store.setState(key, value);
91
- }, [key]);
94
+ });
92
95
  }, [store, key, value]);
93
96
  }
94
97
  function useStore(createStore) {
95
98
  const store = useLazyValue(createStore);
96
- useSafeLayoutEffect(() => store.init(), [store]);
97
- const useState = useCallback(
99
+ useSafeLayoutEffect(() => init(store), [store]);
100
+ const useState = React.useCallback(
98
101
  (keyOrSelector) => useStoreState(store, keyOrSelector),
99
102
  [store]
100
103
  );
101
- return useMemo(() => __spreadProps(__spreadValues({}, store), { useState }), [store, useState]);
104
+ return React.useMemo(
105
+ () => __spreadProps(__spreadValues({}, store), { useState }),
106
+ [store, useState]
107
+ );
102
108
  }
103
109
 
104
110
  export {
@@ -11,6 +11,7 @@ import {
11
11
  useState
12
12
  } from "react";
13
13
  import { chain } from "@ariakit/core/utils/misc";
14
+ import { sync } from "@ariakit/core/utils/store";
14
15
  import { jsx } from "react/jsx-runtime";
15
16
  var NestedDialogsContext = createContext({});
16
17
  function useNestedDialogs(store) {
@@ -27,28 +28,21 @@ function useNestedDialogs(store) {
27
28
  [context]
28
29
  );
29
30
  useSafeLayoutEffect(() => {
30
- return store.sync(
31
- (state) => {
32
- var _a;
33
- if (!state.open)
34
- return;
35
- if (!state.contentElement)
36
- return;
37
- return (_a = context.add) == null ? void 0 : _a.call(context, store);
38
- },
39
- ["open", "contentElement"]
40
- );
31
+ return sync(store, ["open", "contentElement"], (state) => {
32
+ var _a;
33
+ if (!state.open)
34
+ return;
35
+ if (!state.contentElement)
36
+ return;
37
+ return (_a = context.add) == null ? void 0 : _a.call(context, store);
38
+ });
41
39
  }, [store, context]);
42
40
  useSafeLayoutEffect(() => {
43
- var _a;
44
- return (_a = context.store) == null ? void 0 : _a.sync(
45
- (state) => {
46
- if (state.open)
47
- return;
48
- store.hide();
49
- },
50
- ["open"]
51
- );
41
+ return sync(context.store, ["open"], (state) => {
42
+ if (state.open)
43
+ return;
44
+ store.hide();
45
+ });
52
46
  }, [context, store]);
53
47
  const providerValue = useMemo(() => ({ store, add }), [store, add]);
54
48
  const wrapElement = useCallback(
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  useStore,
3
3
  useStoreProps
4
- } from "./MXMUDZTV.js";
4
+ } from "./P63NRZ4A.js";
5
5
  import {
6
6
  __spreadValues
7
7
  } from "./PNRLI7OV.js";
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  useStore,
3
3
  useStoreProps
4
- } from "./MXMUDZTV.js";
4
+ } from "./P63NRZ4A.js";
5
5
  import {
6
6
  __spreadValues
7
7
  } from "./PNRLI7OV.js";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  DialogBackdrop
3
- } from "./H3BU75TA.js";
3
+ } from "./5IZLNERH.js";
4
4
  import {
5
5
  disableTreeOutside
6
6
  } from "./NHPU54IO.js";
@@ -12,7 +12,7 @@ import {
12
12
  } from "./3LAWLNOX.js";
13
13
  import {
14
14
  useNestedDialogs
15
- } from "./OEA63YXU.js";
15
+ } from "./PLOINBVB.js";
16
16
  import {
17
17
  useHideOnInteractOutside
18
18
  } from "./E5XSMSHD.js";
@@ -166,7 +166,7 @@ var useDialog = createHook(
166
166
  if (dialog && contains(dialog, activeElement))
167
167
  return;
168
168
  store.setDisclosureElement(activeElement);
169
- }, [open]);
169
+ }, [open, store]);
170
170
  if (isSafariBrowser) {
171
171
  useEffect(() => {
172
172
  if (!mounted)
@@ -194,7 +194,7 @@ var useDialog = createHook(
194
194
  return () => {
195
195
  disclosureElement.removeEventListener("mousedown", onMouseDown);
196
196
  };
197
- }, [mounted]);
197
+ }, [mounted, store]);
198
198
  }
199
199
  const shouldDisableAccessibilityTree = modal || // Usually, we only want to disable the accessibility tree outside if the
200
200
  // dialog is a modal. But the Portal component can't preserve the tab
@@ -405,7 +405,7 @@ var useDialog = createHook(
405
405
  store.hide();
406
406
  };
407
407
  return addGlobalEventListener("keydown", onKeyDown);
408
- }, [mounted, domReady, hideOnEscapeProp]);
408
+ }, [mounted, domReady, store, hideOnEscapeProp]);
409
409
  props = useWrapElement(
410
410
  props,
411
411
  (element) => /* @__PURE__ */ jsx(HeadingLevel, { level: modal ? 1 : void 0, children: element }),
@@ -3,7 +3,7 @@ import {
3
3
  } from "./6I2PARRP.js";
4
4
  import {
5
5
  useCompositeItem
6
- } from "./VVJJXZ6R.js";
6
+ } from "./FVD2NJZN.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 "./MXMUDZTV.js";
14
+ } from "./P63NRZ4A.js";
15
15
  import {
16
16
  useEvent,
17
17
  useId,
@@ -17,7 +17,7 @@ import {
17
17
  } from "./PNRLI7OV.js";
18
18
 
19
19
  // src/collection/collection-item.ts
20
- import { useCallback, useContext, useRef } from "react";
20
+ import { useContext, useEffect, useRef } from "react";
21
21
  import { identity } from "@ariakit/core/utils/misc";
22
22
  var useCollectionItem = createHook(
23
23
  (_a) => {
@@ -36,18 +36,18 @@ var useCollectionItem = createHook(
36
36
  const context = useContext(CollectionContext);
37
37
  store = store || context;
38
38
  const id = useId(props.id);
39
- const unrenderItem = useRef();
40
- const ref = useCallback(
41
- (element2) => {
42
- var _a2;
43
- if (!element2 || !id || !shouldRegisterItem) {
44
- return (_a2 = unrenderItem.current) == null ? void 0 : _a2.call(unrenderItem);
45
- }
46
- const item = getItem({ id, element: element2 });
47
- unrenderItem.current = store == null ? void 0 : store.renderItem(item);
48
- },
49
- [id, shouldRegisterItem, getItem, store]
50
- );
39
+ const ref = useRef(element);
40
+ useEffect(() => {
41
+ const element2 = ref.current;
42
+ if (!id)
43
+ return;
44
+ if (!element2)
45
+ return;
46
+ if (!shouldRegisterItem)
47
+ return;
48
+ const item = getItem({ id, element: element2 });
49
+ return store == null ? void 0 : store.renderItem(item);
50
+ }, [id, shouldRegisterItem, getItem, store]);
51
51
  props = __spreadProps(__spreadValues({}, props), {
52
52
  ref: useMergeRefs(ref, props.ref)
53
53
  });
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  useDisclosureStoreOptions,
3
3
  useDisclosureStoreProps
4
- } from "./JJW3R5IK.js";
4
+ } from "./SWJ5EOOS.js";
5
5
  import {
6
6
  useStore
7
- } from "./MXMUDZTV.js";
7
+ } from "./P63NRZ4A.js";
8
8
  import {
9
9
  __spreadValues
10
10
  } from "./PNRLI7OV.js";
@@ -10,7 +10,7 @@ import {
10
10
  } from "./W5P7IKOU.js";
11
11
  import {
12
12
  useCompositeItem
13
- } from "./VVJJXZ6R.js";
13
+ } from "./FVD2NJZN.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 "./MXMUDZTV.js";
21
+ } from "./P63NRZ4A.js";
22
22
  import {
23
23
  useBooleanEvent,
24
24
  useEvent
@@ -24,6 +24,7 @@ import { addGlobalEventListener } from "@ariakit/core/utils/events";
24
24
  var useHovercardAnchor = createHook(
25
25
  (_a) => {
26
26
  var _b = _a, { store, showOnHover = true } = _b, props = __objRest(_b, ["store", "showOnHover"]);
27
+ const mounted = store.useState("mounted");
27
28
  const disabled = props.disabled || props["aria-disabled"] === true || props["aria-disabled"] === "true";
28
29
  const showTimeoutRef = useRef(0);
29
30
  useEffect(() => () => window.clearTimeout(showTimeoutRef.current), []);
@@ -66,7 +67,14 @@ var useHovercardAnchor = createHook(
66
67
  }
67
68
  );
68
69
  props = __spreadProps(__spreadValues({}, props), {
69
- ref: useMergeRefs(store.setAnchorElement, props.ref),
70
+ ref: useMergeRefs(
71
+ store.setAnchorElement,
72
+ // We need to set the anchor element as the hovercard disclosure
73
+ // disclosure element only when the hovercard is shown so it doesn't get
74
+ // assigned an arbitrary element by the dialog component.
75
+ mounted ? store.setDisclosureElement : void 0,
76
+ props.ref
77
+ ),
70
78
  onMouseMove
71
79
  });
72
80
  props = useFocusable(props);
@@ -2,8 +2,8 @@ import {
2
2
  useCheckboxStore,
3
3
  useCheckboxStoreOptions,
4
4
  useCheckboxStoreProps
5
- } from "../__chunks/4LTL37RB.js";
6
- import "../__chunks/MXMUDZTV.js";
5
+ } from "../__chunks/6TMY6IFR.js";
6
+ import "../__chunks/P63NRZ4A.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/JWSYWSCR.js";
4
+ } from "../__chunks/3CJV7UYE.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/MXMUDZTV.js";
10
+ import "../__chunks/P63NRZ4A.js";
11
11
  import "../__chunks/J7Q2EO23.js";
12
12
  import "../__chunks/CP3U4HPL.js";
13
13
  import "../__chunks/PNRLI7OV.js";
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  CollectionItem,
3
3
  useCollectionItem
4
- } from "../__chunks/HGFTMLQ7.js";
4
+ } from "../__chunks/VFNGSUSF.js";
5
5
  import "../__chunks/T3DJZG63.js";
6
6
  import "../__chunks/NQJBHION.js";
7
7
  import "../__chunks/J7Q2EO23.js";
@@ -3,10 +3,10 @@ import {
3
3
  getCollectionRendererItem,
4
4
  getCollectionRendererItemId,
5
5
  useCollectionRenderer
6
- } from "../__chunks/QLIKSQTQ.js";
6
+ } from "../__chunks/ONFAHVST.js";
7
7
  import "../__chunks/T3DJZG63.js";
8
8
  import "../__chunks/NQJBHION.js";
9
- import "../__chunks/MXMUDZTV.js";
9
+ import "../__chunks/P63NRZ4A.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/WNGYZL6A.js";
6
- import "../__chunks/MXMUDZTV.js";
5
+ } from "../__chunks/RS7KBRGA.js";
6
+ import "../__chunks/P63NRZ4A.js";
7
7
  import "../__chunks/J7Q2EO23.js";
8
8
  import "../__chunks/CP3U4HPL.js";
9
9
  import "../__chunks/PNRLI7OV.js";
@@ -7,9 +7,9 @@ import {
7
7
  } from "../__chunks/W5P7IKOU.js";
8
8
  import {
9
9
  useCompositeItem
10
- } from "../__chunks/VVJJXZ6R.js";
10
+ } from "../__chunks/FVD2NJZN.js";
11
11
  import "../__chunks/P4RGQGTG.js";
12
- import "../__chunks/HGFTMLQ7.js";
12
+ import "../__chunks/VFNGSUSF.js";
13
13
  import "../__chunks/T3DJZG63.js";
14
14
  import "../__chunks/OXPV2NBK.js";
15
15
  import "../__chunks/WJ37OVG2.js";
@@ -20,7 +20,7 @@ import {
20
20
  createHook,
21
21
  createMemoComponent
22
22
  } from "../__chunks/NQJBHION.js";
23
- import "../__chunks/MXMUDZTV.js";
23
+ import "../__chunks/P63NRZ4A.js";
24
24
  import {
25
25
  useBooleanEvent,
26
26
  useEvent,
@@ -4,14 +4,14 @@ import {
4
4
  import "../__chunks/5VGBBGF5.js";
5
5
  import {
6
6
  usePopover
7
- } from "../__chunks/JHKKFNCJ.js";
8
- import "../__chunks/BIPBU2AE.js";
9
- import "../__chunks/H3BU75TA.js";
7
+ } from "../__chunks/K5MSER23.js";
8
+ import "../__chunks/SZIMOWLA.js";
9
+ import "../__chunks/5IZLNERH.js";
10
10
  import "../__chunks/NHPU54IO.js";
11
11
  import "../__chunks/GDORSOK6.js";
12
12
  import "../__chunks/3LAWLNOX.js";
13
13
  import "../__chunks/CJI67A3R.js";
14
- import "../__chunks/OEA63YXU.js";
14
+ import "../__chunks/PLOINBVB.js";
15
15
  import "../__chunks/E5XSMSHD.js";
16
16
  import "../__chunks/LEBYH5FW.js";
17
17
  import "../__chunks/IXXFVVA2.js";
@@ -38,8 +38,8 @@ import {
38
38
  createElement,
39
39
  createHook
40
40
  } from "../__chunks/NQJBHION.js";
41
- import "../__chunks/JJW3R5IK.js";
42
- import "../__chunks/MXMUDZTV.js";
41
+ import "../__chunks/SWJ5EOOS.js";
42
+ import "../__chunks/P63NRZ4A.js";
43
43
  import "../__chunks/J7Q2EO23.js";
44
44
  import "../__chunks/CP3U4HPL.js";
45
45
  import {
@@ -1,18 +1,18 @@
1
1
  import {
2
2
  useCompositeStoreOptions,
3
3
  useCompositeStoreProps
4
- } from "../__chunks/36V3RYFS.js";
5
- import "../__chunks/WNGYZL6A.js";
4
+ } from "../__chunks/7KULBIZY.js";
5
+ import "../__chunks/RS7KBRGA.js";
6
6
  import {
7
7
  usePopoverStoreOptions,
8
8
  usePopoverStoreProps
9
- } from "../__chunks/SPTQP5I5.js";
10
- import "../__chunks/RRY7OZXM.js";
11
- import "../__chunks/JJW3R5IK.js";
9
+ } from "../__chunks/3PKTK2K7.js";
10
+ import "../__chunks/WC3GK4CL.js";
11
+ import "../__chunks/SWJ5EOOS.js";
12
12
  import {
13
13
  useStore,
14
14
  useStoreProps
15
- } from "../__chunks/MXMUDZTV.js";
15
+ } from "../__chunks/P63NRZ4A.js";
16
16
  import "../__chunks/J7Q2EO23.js";
17
17
  import "../__chunks/CP3U4HPL.js";
18
18
  import {