@ariakit/react-core 0.1.4 → 0.1.6

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 (256) hide show
  1. package/CHANGELOG.md +30 -0
  2. package/cjs/__chunks/{TIVUAJD3.cjs → 2G5G7FQE.cjs} +15 -15
  3. package/cjs/__chunks/{ABU7PK6G.cjs → 2WXUU3G6.cjs} +2 -2
  4. package/cjs/__chunks/{GTWUFHVO.cjs → 3X3VOT2M.cjs} +2 -2
  5. package/cjs/__chunks/{GV5LATA3.cjs → 53UPJ72H.cjs} +2 -2
  6. package/cjs/__chunks/{FHUZG4VD.cjs → 5ARECY7S.cjs} +22 -13
  7. package/cjs/__chunks/{LICOAFSX.cjs → 66TVVZQ7.cjs} +2 -2
  8. package/cjs/__chunks/{VSKE43XZ.cjs → 6THZKJIB.cjs} +2 -2
  9. package/cjs/__chunks/{YITIRUCT.cjs → 7RBGKDQ5.cjs} +2 -2
  10. package/cjs/__chunks/{KIZFPB5R.cjs → BSR35RJL.cjs} +5 -5
  11. package/cjs/__chunks/{TGXF67NL.cjs → BVCQMR5S.cjs} +2 -2
  12. package/cjs/__chunks/{M4ATEGE4.cjs → DSXWE3J4.cjs} +2 -2
  13. package/cjs/__chunks/{WLSIWMKQ.cjs → DVEJQM2Q.cjs} +2 -2
  14. package/cjs/__chunks/{FSEBHZVD.cjs → F5U4P2DJ.cjs} +4 -4
  15. package/cjs/__chunks/{WYGT6WVD.cjs → HRXM35NF.cjs} +16 -16
  16. package/cjs/__chunks/{GWL7P7EG.cjs → HSDQTR23.cjs} +2 -2
  17. package/cjs/__chunks/{5LMWS5O4.cjs → IBJDDWWU.cjs} +3 -3
  18. package/cjs/__chunks/{RG6JXX7T.cjs → IONDNL4F.cjs} +13 -13
  19. package/cjs/__chunks/{MAVPFWFV.cjs → K5PHY3H7.cjs} +2 -2
  20. package/cjs/__chunks/{3RC6Q4WI.cjs → K5YC5EZN.cjs} +5 -5
  21. package/cjs/__chunks/{44M2NZSK.cjs → KFKFEB7D.cjs} +2 -2
  22. package/cjs/__chunks/{IVRU7X3P.cjs → KUXCWMWW.cjs} +9 -1
  23. package/cjs/__chunks/LHHW5ZQP.cjs +7 -0
  24. package/cjs/__chunks/{3QEUUQVB.cjs → NKZKDBAR.cjs} +0 -4
  25. package/cjs/__chunks/OISXSXPD.cjs +38 -0
  26. package/cjs/__chunks/{ND6THRTE.cjs → QVX74QFT.cjs} +4 -4
  27. package/cjs/__chunks/{F6IOE5QT.cjs → SXSNI6QA.cjs} +18 -9
  28. package/cjs/__chunks/{T4TB3AAZ.cjs → UK7WFIG4.cjs} +22 -14
  29. package/cjs/__chunks/{NYVIJAIX.cjs → URF73P5I.cjs} +4 -4
  30. package/cjs/__chunks/{H5Z2A5K2.cjs → USA6K5CC.cjs} +5 -5
  31. package/cjs/__chunks/{22VQR3WC.cjs → WBMW454M.cjs} +2 -2
  32. package/cjs/__chunks/{EWCMH6G3.cjs → WMRNXISU.cjs} +2 -2
  33. package/cjs/__chunks/{743OAGBP.cjs → WUOKNX34.cjs} +2 -2
  34. package/cjs/__chunks/{44UMDBZE.cjs → X5PL2AHY.cjs} +6 -0
  35. package/cjs/__chunks/{NJHMO3XK.cjs → XXDYPCCB.cjs} +3 -3
  36. package/cjs/__chunks/{IYRMREW7.cjs → YDTVED7A.cjs} +5 -5
  37. package/cjs/__chunks/{QRBTWQPI.cjs → YTLECYPS.cjs} +8 -10
  38. package/cjs/button/button.cjs +5 -4
  39. package/cjs/checkbox/checkbox-store.cjs +3 -3
  40. package/cjs/checkbox/checkbox.cjs +6 -5
  41. package/cjs/checkbox/checkbox.d.ts +18 -5
  42. package/cjs/collection/collection-item.cjs +2 -2
  43. package/cjs/collection/collection-store.cjs +3 -3
  44. package/cjs/combobox/combobox-cancel.cjs +5 -4
  45. package/cjs/combobox/combobox-disclosure.cjs +7 -6
  46. package/cjs/combobox/combobox-item.cjs +7 -5
  47. package/cjs/combobox/combobox-popover.cjs +10 -8
  48. package/cjs/combobox/combobox-store.cjs +12 -12
  49. package/cjs/combobox/combobox.cjs +4 -3
  50. package/cjs/combobox/combobox.d.ts +44 -19
  51. package/cjs/command/command.cjs +4 -3
  52. package/cjs/composite/composite-container.cjs +3 -3
  53. package/cjs/composite/composite-hover.d.ts +4 -0
  54. package/cjs/composite/composite-item.cjs +7 -5
  55. package/cjs/composite/composite-overflow-disclosure.cjs +12 -10
  56. package/cjs/composite/composite-overflow-store.cjs +7 -7
  57. package/cjs/composite/composite-overflow.cjs +10 -8
  58. package/cjs/composite/composite-store.cjs +4 -4
  59. package/cjs/composite/composite-typeahead.d.ts +4 -0
  60. package/cjs/composite/composite.cjs +4 -3
  61. package/cjs/composite/composite.d.ts +4 -0
  62. package/cjs/dialog/dialog-disclosure.cjs +7 -6
  63. package/cjs/dialog/dialog-dismiss.cjs +6 -5
  64. package/cjs/dialog/dialog-store.cjs +4 -4
  65. package/cjs/dialog/dialog.cjs +9 -7
  66. package/cjs/dialog/utils/use-nested-dialogs.cjs +2 -2
  67. package/cjs/disclosure/disclosure-store.cjs +3 -3
  68. package/cjs/disclosure/disclosure.cjs +6 -5
  69. package/cjs/focusable/focusable-container.cjs +12 -0
  70. package/cjs/focusable/focusable-container.d.ts +33 -0
  71. package/cjs/focusable/focusable-context.cjs +6 -0
  72. package/cjs/focusable/focusable-context.d.ts +1 -0
  73. package/cjs/focusable/focusable.cjs +3 -2
  74. package/cjs/focusable/focusable.d.ts +3 -0
  75. package/cjs/form/form-checkbox.cjs +11 -10
  76. package/cjs/form/form-description.cjs +2 -2
  77. package/cjs/form/form-error.cjs +2 -2
  78. package/cjs/form/form-field.cjs +3 -3
  79. package/cjs/form/form-input.cjs +6 -5
  80. package/cjs/form/form-label.cjs +2 -2
  81. package/cjs/form/form-push.cjs +7 -6
  82. package/cjs/form/form-radio.cjs +10 -9
  83. package/cjs/form/form-remove.cjs +5 -4
  84. package/cjs/form/form-reset.cjs +5 -4
  85. package/cjs/form/form-store.cjs +28 -17
  86. package/cjs/form/form-submit.cjs +5 -4
  87. package/cjs/hovercard/hovercard-anchor.cjs +4 -3
  88. package/cjs/hovercard/hovercard-disclosure.cjs +7 -6
  89. package/cjs/hovercard/hovercard-dismiss.cjs +8 -7
  90. package/cjs/hovercard/hovercard-store.cjs +6 -6
  91. package/cjs/hovercard/hovercard.cjs +11 -9
  92. package/cjs/menu/menu-bar-store.cjs +6 -6
  93. package/cjs/menu/menu-bar.cjs +4 -3
  94. package/cjs/menu/menu-button.cjs +12 -11
  95. package/cjs/menu/menu-dismiss.cjs +8 -7
  96. package/cjs/menu/menu-item-checkbox.cjs +13 -12
  97. package/cjs/menu/menu-item-radio.cjs +11 -10
  98. package/cjs/menu/menu-item.cjs +8 -7
  99. package/cjs/menu/menu-list.cjs +6 -5
  100. package/cjs/menu/menu-store.cjs +14 -14
  101. package/cjs/menu/menu.cjs +15 -13
  102. package/cjs/popover/popover-disclosure.cjs +8 -7
  103. package/cjs/popover/popover-dismiss.cjs +7 -6
  104. package/cjs/popover/popover-store.cjs +5 -5
  105. package/cjs/popover/popover.cjs +10 -8
  106. package/cjs/portal/portal.cjs +2 -2
  107. package/cjs/radio/radio-group.cjs +4 -3
  108. package/cjs/radio/radio-store.cjs +7 -7
  109. package/cjs/radio/radio.cjs +8 -7
  110. package/cjs/select/select-item.cjs +7 -5
  111. package/cjs/select/select-list.cjs +5 -4
  112. package/cjs/select/select-popover.cjs +13 -11
  113. package/cjs/select/select-store.cjs +12 -12
  114. package/cjs/select/select.cjs +8 -7
  115. package/cjs/tab/tab-list.cjs +4 -3
  116. package/cjs/tab/tab-panel.cjs +8 -7
  117. package/cjs/tab/tab-store.cjs +9 -9
  118. package/cjs/tab/tab.cjs +7 -5
  119. package/cjs/toolbar/toolbar-container.cjs +10 -9
  120. package/cjs/toolbar/toolbar-input.cjs +8 -6
  121. package/cjs/toolbar/toolbar-item.cjs +8 -6
  122. package/cjs/toolbar/toolbar-store.cjs +6 -6
  123. package/cjs/toolbar/toolbar.cjs +4 -3
  124. package/cjs/tooltip/tooltip-store.cjs +7 -7
  125. package/cjs/tooltip/tooltip.cjs +2 -2
  126. package/cjs/tsconfig.build.tsbuildinfo +1 -1
  127. package/cjs/utils/store.cjs +2 -2
  128. package/esm/__chunks/{47TE2UD5.js → 2EKS6A3C.js} +2 -2
  129. package/esm/__chunks/{BIFSQ6O4.js → 2PS226YW.js} +1 -1
  130. package/esm/__chunks/{HRNQJHNJ.js → 3QLNHI3O.js} +1 -1
  131. package/esm/__chunks/{IACKFX3D.js → 7GYXZEBT.js} +1 -1
  132. package/esm/__chunks/{CWHDUB4A.js → A62WSI6V.js} +1 -1
  133. package/esm/__chunks/BMLNRUFQ.js +7 -0
  134. package/esm/__chunks/{RFLPDFU5.js → CDHQAO3X.js} +7 -9
  135. package/esm/__chunks/D6AEGMVG.js +38 -0
  136. package/esm/__chunks/{LZKGMRGC.js → DH2UH4YR.js} +1 -1
  137. package/esm/__chunks/{4STD3S2Y.js → DQXTORDL.js} +2 -2
  138. package/esm/__chunks/{WWZPDI2E.js → E3LZDF77.js} +20 -11
  139. package/esm/__chunks/{6DAEYZ43.js → EUGPS2W3.js} +18 -9
  140. package/esm/__chunks/{IW7LFTQE.js → EX5SMLJA.js} +1 -1
  141. package/esm/__chunks/{2WA5HZXQ.js → FVED2REU.js} +1 -1
  142. package/esm/__chunks/{I4MLEPTM.js → GEZPJZJE.js} +1 -1
  143. package/esm/__chunks/{WHN4PCW7.js → HAHDW4I2.js} +13 -13
  144. package/esm/__chunks/{5TGAWEHD.js → HBXYECGK.js} +7 -1
  145. package/esm/__chunks/{EJZ6BVXG.js → IIX2NU6T.js} +22 -14
  146. package/esm/__chunks/{4RNONDN5.js → LMKEQY3H.js} +2 -2
  147. package/esm/__chunks/{GEOALYS4.js → LUPFVLDA.js} +1 -1
  148. package/esm/__chunks/{OGTE6FGV.js → LWUHIEZR.js} +2 -2
  149. package/esm/__chunks/{JKSMOXA4.js → MMKQPA5B.js} +1 -1
  150. package/esm/__chunks/{3OSYJZM5.js → MPZ7PKON.js} +9 -1
  151. package/esm/__chunks/{OXIHLN45.js → NL6KEDBG.js} +1 -1
  152. package/esm/__chunks/{FXC76SFN.js → NOLA2XUH.js} +1 -1
  153. package/esm/__chunks/{6THLPTJO.js → NZB3NDFQ.js} +1 -1
  154. package/esm/__chunks/{OJNRBQKS.js → ON2AV7GH.js} +1 -5
  155. package/esm/__chunks/{NRA7DRSD.js → OOPJDYET.js} +1 -1
  156. package/esm/__chunks/{B3AF63GK.js → QLGPSTUO.js} +1 -1
  157. package/esm/__chunks/{SAVDGYCC.js → SMBMF2TX.js} +1 -1
  158. package/esm/__chunks/{YDNX3N4B.js → TQC4ZBYZ.js} +3 -3
  159. package/esm/__chunks/{57UTLR6J.js → UBWZV2LZ.js} +1 -1
  160. package/esm/__chunks/{WOX4XCVH.js → V3PAD47N.js} +3 -3
  161. package/esm/__chunks/{56XURSTF.js → WKCZETSE.js} +1 -1
  162. package/esm/__chunks/{RSJJ72ZD.js → YTUXLB4R.js} +2 -2
  163. package/esm/__chunks/{2EP53RLR.js → ZNVJPG2U.js} +2 -2
  164. package/esm/button/button.js +4 -3
  165. package/esm/checkbox/checkbox-store.js +2 -2
  166. package/esm/checkbox/checkbox.d.ts +18 -5
  167. package/esm/checkbox/checkbox.js +5 -4
  168. package/esm/collection/collection-item.js +1 -1
  169. package/esm/collection/collection-store.js +2 -2
  170. package/esm/combobox/combobox-cancel.js +4 -3
  171. package/esm/combobox/combobox-disclosure.js +6 -5
  172. package/esm/combobox/combobox-item.js +6 -4
  173. package/esm/combobox/combobox-popover.js +9 -7
  174. package/esm/combobox/combobox-store.js +6 -6
  175. package/esm/combobox/combobox.d.ts +44 -19
  176. package/esm/combobox/combobox.js +3 -2
  177. package/esm/command/command.js +3 -2
  178. package/esm/composite/composite-container.js +2 -2
  179. package/esm/composite/composite-hover.d.ts +4 -0
  180. package/esm/composite/composite-item.js +6 -4
  181. package/esm/composite/composite-overflow-disclosure.js +10 -8
  182. package/esm/composite/composite-overflow-store.js +4 -4
  183. package/esm/composite/composite-overflow.js +9 -7
  184. package/esm/composite/composite-store.js +3 -3
  185. package/esm/composite/composite-typeahead.d.ts +4 -0
  186. package/esm/composite/composite.d.ts +4 -0
  187. package/esm/composite/composite.js +3 -2
  188. package/esm/dialog/dialog-disclosure.js +6 -5
  189. package/esm/dialog/dialog-dismiss.js +5 -4
  190. package/esm/dialog/dialog-store.js +3 -3
  191. package/esm/dialog/dialog.js +8 -6
  192. package/esm/dialog/utils/use-nested-dialogs.js +1 -1
  193. package/esm/disclosure/disclosure-store.js +2 -2
  194. package/esm/disclosure/disclosure.js +5 -4
  195. package/esm/focusable/focusable-container.d.ts +33 -0
  196. package/esm/focusable/focusable-container.js +12 -0
  197. package/esm/focusable/focusable-context.d.ts +1 -0
  198. package/esm/focusable/focusable-context.js +6 -0
  199. package/esm/focusable/focusable.d.ts +3 -0
  200. package/esm/focusable/focusable.js +2 -1
  201. package/esm/form/form-checkbox.js +10 -9
  202. package/esm/form/form-description.js +1 -1
  203. package/esm/form/form-error.js +1 -1
  204. package/esm/form/form-field.js +2 -2
  205. package/esm/form/form-input.js +4 -3
  206. package/esm/form/form-label.js +1 -1
  207. package/esm/form/form-push.js +5 -4
  208. package/esm/form/form-radio.js +8 -7
  209. package/esm/form/form-remove.js +4 -3
  210. package/esm/form/form-reset.js +4 -3
  211. package/esm/form/form-store.js +24 -13
  212. package/esm/form/form-submit.js +4 -3
  213. package/esm/hovercard/hovercard-anchor.js +3 -2
  214. package/esm/hovercard/hovercard-disclosure.js +6 -5
  215. package/esm/hovercard/hovercard-dismiss.js +7 -6
  216. package/esm/hovercard/hovercard-store.js +5 -5
  217. package/esm/hovercard/hovercard.js +10 -8
  218. package/esm/menu/menu-bar-store.js +3 -3
  219. package/esm/menu/menu-bar.js +3 -2
  220. package/esm/menu/menu-button.js +9 -8
  221. package/esm/menu/menu-dismiss.js +7 -6
  222. package/esm/menu/menu-item-checkbox.js +12 -11
  223. package/esm/menu/menu-item-radio.js +9 -8
  224. package/esm/menu/menu-item.js +7 -6
  225. package/esm/menu/menu-list.js +5 -4
  226. package/esm/menu/menu-store.js +7 -7
  227. package/esm/menu/menu.js +13 -11
  228. package/esm/popover/popover-disclosure.js +7 -6
  229. package/esm/popover/popover-dismiss.js +6 -5
  230. package/esm/popover/popover-store.js +4 -4
  231. package/esm/popover/popover.js +9 -7
  232. package/esm/portal/portal.js +1 -1
  233. package/esm/radio/radio-group.js +3 -2
  234. package/esm/radio/radio-store.js +3 -3
  235. package/esm/radio/radio.js +7 -6
  236. package/esm/select/select-item.js +6 -4
  237. package/esm/select/select-list.js +4 -3
  238. package/esm/select/select-popover.js +11 -9
  239. package/esm/select/select-store.js +6 -6
  240. package/esm/select/select.js +7 -6
  241. package/esm/tab/tab-list.js +3 -2
  242. package/esm/tab/tab-panel.js +5 -4
  243. package/esm/tab/tab-store.js +3 -3
  244. package/esm/tab/tab.js +6 -4
  245. package/esm/toolbar/toolbar-container.js +8 -7
  246. package/esm/toolbar/toolbar-input.js +7 -5
  247. package/esm/toolbar/toolbar-item.js +7 -5
  248. package/esm/toolbar/toolbar-store.js +3 -3
  249. package/esm/toolbar/toolbar.js +3 -2
  250. package/esm/tooltip/tooltip-store.js +4 -4
  251. package/esm/tooltip/tooltip.js +1 -1
  252. package/esm/tsconfig.build.tsbuildinfo +1 -1
  253. package/esm/utils/store.js +1 -1
  254. package/focusable/focusable-container/package.json +7 -0
  255. package/focusable/focusable-context/package.json +7 -0
  256. package/package.json +10 -2
@@ -0,0 +1,7 @@
1
+ // src/focusable/focusable-context.ts
2
+ import { createContext } from "react";
3
+ var FocusableContext = createContext(true);
4
+
5
+ export {
6
+ FocusableContext
7
+ };
@@ -3,7 +3,7 @@ import {
3
3
  } from "./P3I4MECH.js";
4
4
  import {
5
5
  useCollectionItem
6
- } from "./OJNRBQKS.js";
6
+ } from "./ON2AV7GH.js";
7
7
  import {
8
8
  createElement,
9
9
  createHook,
@@ -24,15 +24,13 @@ function getNamedElement(ref, name) {
24
24
  const element = ref.current;
25
25
  if (!element)
26
26
  return null;
27
- if (element.name !== name) {
28
- if (element.form) {
29
- return element.form.elements.namedItem(name);
30
- } else {
31
- const document = getDocument(element);
32
- return document.getElementsByName(name)[0];
33
- }
27
+ if (element.name === name)
28
+ return element;
29
+ if (element.form) {
30
+ return element.form.elements.namedItem(name);
34
31
  }
35
- return element;
32
+ const document = getDocument(element);
33
+ return document.getElementsByName(name)[0];
36
34
  }
37
35
  function useItem(store, name, type) {
38
36
  return store.useState(
@@ -0,0 +1,38 @@
1
+ import {
2
+ FocusableContext
3
+ } from "./BMLNRUFQ.js";
4
+ import {
5
+ createComponent,
6
+ createElement,
7
+ createHook
8
+ } from "./JE5NWDDX.js";
9
+ import {
10
+ useWrapElement
11
+ } from "./B7MIN7YT.js";
12
+
13
+ // src/focusable/focusable-container.tsx
14
+ import { jsx } from "react/jsx-runtime";
15
+ var useFocusableContainer = createHook(
16
+ ({ autoFocusOnShow = true, ...props }) => {
17
+ props = useWrapElement(
18
+ props,
19
+ (element) => /* @__PURE__ */ jsx(FocusableContext.Provider, { value: autoFocusOnShow, children: element }),
20
+ [autoFocusOnShow]
21
+ );
22
+ return props;
23
+ }
24
+ );
25
+ var FocusableContainer = createComponent(
26
+ (props) => {
27
+ const htmlProps = useFocusableContainer(props);
28
+ return createElement("div", htmlProps);
29
+ }
30
+ );
31
+ if (process.env.NODE_ENV !== "production") {
32
+ FocusableContainer.displayName = "FocusableContainer";
33
+ }
34
+
35
+ export {
36
+ useFocusableContainer,
37
+ FocusableContainer
38
+ };
@@ -6,7 +6,7 @@ import {
6
6
  } from "./EEVSGAZW.js";
7
7
  import {
8
8
  useComposite
9
- } from "./FXC76SFN.js";
9
+ } from "./NOLA2XUH.js";
10
10
  import {
11
11
  createComponent,
12
12
  createElement,
@@ -3,7 +3,7 @@ import {
3
3
  } from "./6I2PARRP.js";
4
4
  import {
5
5
  useCompositeItem
6
- } from "./WHN4PCW7.js";
6
+ } from "./HAHDW4I2.js";
7
7
  import {
8
8
  createElement,
9
9
  createHook,
@@ -11,7 +11,7 @@ import {
11
11
  } from "./JE5NWDDX.js";
12
12
  import {
13
13
  useStoreState
14
- } from "./6DAEYZ43.js";
14
+ } from "./EUGPS2W3.js";
15
15
  import {
16
16
  useEvent,
17
17
  useForkRef,
@@ -1,9 +1,18 @@
1
1
  import {
2
2
  DialogBackdrop
3
3
  } from "./4U6AOLE4.js";
4
+ import {
5
+ usePreventBodyScroll
6
+ } from "./GWYHKM6Q.js";
7
+ import {
8
+ useNestedDialogs
9
+ } from "./IIX2NU6T.js";
4
10
  import {
5
11
  useHideOnInteractOutside
6
12
  } from "./ARIIJA3Z.js";
13
+ import {
14
+ useChampionDialog
15
+ } from "./FD7UP2TJ.js";
7
16
  import {
8
17
  prependHiddenDismiss
9
18
  } from "./PU22SOKH.js";
@@ -13,18 +22,12 @@ import {
13
22
  import {
14
23
  disableAccessibilityTreeOutside
15
24
  } from "./NV7HSBKK.js";
25
+ import {
26
+ useFocusableContainer
27
+ } from "./D6AEGMVG.js";
16
28
  import {
17
29
  useFocusTrapRegion
18
30
  } from "./2SVAPVVI.js";
19
- import {
20
- usePreventBodyScroll
21
- } from "./GWYHKM6Q.js";
22
- import {
23
- useChampionDialog
24
- } from "./FD7UP2TJ.js";
25
- import {
26
- useNestedDialogs
27
- } from "./EJZ6BVXG.js";
28
31
  import {
29
32
  HeadingLevel
30
33
  } from "./6OMX4H3W.js";
@@ -35,10 +38,10 @@ import {
35
38
  } from "./LNHZLQEK.js";
36
39
  import {
37
40
  useFocusable
38
- } from "./5TGAWEHD.js";
41
+ } from "./HBXYECGK.js";
39
42
  import {
40
43
  usePortal
41
- } from "./3OSYJZM5.js";
44
+ } from "./MPZ7PKON.js";
42
45
  import {
43
46
  useDisclosureContent
44
47
  } from "./FFRIGW5T.js";
@@ -256,6 +259,7 @@ var useDialog = createHook(
256
259
  }, [shouldDisableOutside, portal, portalNode, modal]);
257
260
  const mayAutoFocusOnShow = !!autoFocusOnShow;
258
261
  const autoFocusOnShowProp = useBooleanEvent(autoFocusOnShow);
262
+ const [autoFocusEnabled, setAutoFocusEnabled] = useState(false);
259
263
  useEffect(() => {
260
264
  if (!open)
261
265
  return;
@@ -284,6 +288,7 @@ var useDialog = createHook(
284
288
  getFirstTabbableIn(dialog, true, portal && preserveTabOrder) || dialog;
285
289
  if (!autoFocusOnShowProp(element))
286
290
  return;
291
+ setAutoFocusEnabled(true);
287
292
  element.focus();
288
293
  }, [
289
294
  contentElement,
@@ -442,6 +447,10 @@ var useDialog = createHook(
442
447
  ...props,
443
448
  ref: useForkRef(ref, props.ref)
444
449
  };
450
+ props = useFocusableContainer({
451
+ ...props,
452
+ autoFocusOnShow: autoFocusEnabled
453
+ });
445
454
  props = useDisclosureContent({ store, ...props });
446
455
  props = useFocusable({ ...props, focusable });
447
456
  props = usePortal({ portal, ...props, portalRef, preserveTabOrder });
@@ -42,16 +42,25 @@ function useStoreProps(store, props, key, setKey) {
42
42
  return store.sync(
43
43
  (state, prev) => {
44
44
  const { value: value2, setValue } = propsRef.current;
45
- if (value2 !== void 0) {
46
- store.setState(key, value2);
47
- }
48
- if (setValue && state[key] !== prev[key] && state[key] !== value2) {
49
- setValue(state[key]);
50
- }
45
+ if (!setValue)
46
+ return;
47
+ if (state[key] === prev[key])
48
+ return;
49
+ if (state[key] === value2)
50
+ return;
51
+ setValue(state[key]);
51
52
  },
52
53
  [key]
53
54
  );
54
55
  }, [store, key]);
56
+ useSafeLayoutEffect(() => {
57
+ return store.sync(() => {
58
+ const { value: value2 } = propsRef.current;
59
+ if (value2 === void 0)
60
+ return;
61
+ store.setState(key, value2);
62
+ }, [key]);
63
+ }, [store, key]);
55
64
  useUpdateLayoutEffect(() => {
56
65
  if (value === void 0)
57
66
  return;
@@ -60,12 +69,12 @@ function useStoreProps(store, props, key, setKey) {
60
69
  }
61
70
  function useStore(createStore) {
62
71
  const store = useLazyValue(createStore);
63
- useSafeLayoutEffect(() => store.init(), []);
72
+ useSafeLayoutEffect(() => store.init(), [store]);
64
73
  const useState = useCallback(
65
74
  (keyOrSelector) => useStoreState(store, keyOrSelector),
66
- []
75
+ [store]
67
76
  );
68
- return useMemo(() => ({ ...store, useState }), []);
77
+ return useMemo(() => ({ ...store, useState }), [store, useState]);
69
78
  }
70
79
 
71
80
  export {
@@ -5,7 +5,7 @@ import {
5
5
  } from "./X7FKJQME.js";
6
6
  import {
7
7
  usePopover
8
- } from "./GEOALYS4.js";
8
+ } from "./LUPFVLDA.js";
9
9
  import {
10
10
  createComponent,
11
11
  createElement,
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  useFocusable
3
- } from "./5TGAWEHD.js";
3
+ } from "./HBXYECGK.js";
4
4
  import {
5
5
  createComponent,
6
6
  createElement,
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  useCommand
3
- } from "./SAVDGYCC.js";
3
+ } from "./SMBMF2TX.js";
4
4
  import {
5
5
  createComponent,
6
6
  createElement,
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  useCommand
3
- } from "./SAVDGYCC.js";
3
+ } from "./SMBMF2TX.js";
4
4
  import {
5
5
  useCollectionItem
6
- } from "./OJNRBQKS.js";
6
+ } from "./ON2AV7GH.js";
7
7
  import {
8
8
  focusSilently,
9
9
  getEnabledItem,
@@ -19,6 +19,9 @@ import {
19
19
  createHook,
20
20
  createMemoComponent
21
21
  } from "./JE5NWDDX.js";
22
+ import {
23
+ useStoreState
24
+ } from "./EUGPS2W3.js";
22
25
  import {
23
26
  useBooleanEvent,
24
27
  useEvent,
@@ -36,7 +39,6 @@ import {
36
39
  isTextField
37
40
  } from "@ariakit/core/utils/dom";
38
41
  import { isPortalEvent, isSelfTarget } from "@ariakit/core/utils/events";
39
- import { invariant } from "@ariakit/core/utils/misc";
40
42
  import { jsx } from "react/jsx-runtime";
41
43
  function isEditableElement(element) {
42
44
  if (element.isContentEditable)
@@ -144,14 +146,10 @@ var useCompositeItem = createHook(
144
146
  }) => {
145
147
  const context = useContext(CompositeContext);
146
148
  store = store || context;
147
- invariant(
148
- store,
149
- process.env.NODE_ENV !== "production" && "CompositeItem must be wrapped in a Composite component"
150
- );
151
149
  const id = useId(props.id);
152
150
  const ref = useRef(null);
153
151
  const row = useContext(CompositeRowContext);
154
- const rowId = store.useState((state) => {
152
+ const rowId = useStoreState(store, (state) => {
155
153
  if (rowIdProp)
156
154
  return rowIdProp;
157
155
  if (!row?.baseElement)
@@ -274,7 +272,8 @@ var useCompositeItem = createHook(
274
272
  }
275
273
  }
276
274
  });
277
- const baseElement = store.useState(
275
+ const baseElement = useStoreState(
276
+ store,
278
277
  (state) => state.baseElement || void 0
279
278
  );
280
279
  const providerValue = useMemo(
@@ -286,9 +285,9 @@ var useCompositeItem = createHook(
286
285
  (element) => /* @__PURE__ */ jsx(CompositeItemContext.Provider, { value: providerValue, children: element }),
287
286
  [providerValue]
288
287
  );
289
- const isActiveItem = store.useState((state) => state.activeId === id);
288
+ const isActiveItem = useStoreState(store, (state) => state.activeId === id);
290
289
  const role = useRole(ref, props);
291
- const virtualFocus = store.useState("virtualFocus");
290
+ const virtualFocus = useStoreState(store, "virtualFocus");
292
291
  let ariaSelected;
293
292
  if (isActiveItem) {
294
293
  if (requiresAriaSelected(role)) {
@@ -297,7 +296,8 @@ var useCompositeItem = createHook(
297
296
  ariaSelected = true;
298
297
  }
299
298
  }
300
- const shouldTabIndex = store.useState(
299
+ const shouldTabIndex = useStoreState(
300
+ store,
301
301
  (state) => !state.virtualFocus && isActiveItem
302
302
  );
303
303
  props = {
@@ -306,7 +306,7 @@ var useCompositeItem = createHook(
306
306
  "data-active-item": isActiveItem ? "" : void 0,
307
307
  ...props,
308
308
  ref: useForkRef(ref, props.ref),
309
- tabIndex: shouldTabIndex ? props.tabIndex : -1,
309
+ tabIndex: shouldTabIndex !== false ? props.tabIndex : -1,
310
310
  onFocus,
311
311
  onBlurCapture,
312
312
  onKeyDown
@@ -1,3 +1,6 @@
1
+ import {
2
+ FocusableContext
3
+ } from "./BMLNRUFQ.js";
1
4
  import {
2
5
  createComponent,
3
6
  createElement,
@@ -10,7 +13,7 @@ import {
10
13
  } from "./B7MIN7YT.js";
11
14
 
12
15
  // src/focusable/focusable.ts
13
- import { useEffect, useRef, useState } from "react";
16
+ import { useContext, useEffect, useRef, useState } from "react";
14
17
  import { isButton } from "@ariakit/core/utils/dom";
15
18
  import {
16
19
  addGlobalEventListener,
@@ -293,6 +296,7 @@ var useFocusable = createHook(
293
296
  setFocusVisible(false);
294
297
  }
295
298
  });
299
+ const autoFocusOnShow = useContext(FocusableContext);
296
300
  const autoFocusRef = useEvent((element) => {
297
301
  if (!focusable)
298
302
  return;
@@ -300,6 +304,8 @@ var useFocusable = createHook(
300
304
  return;
301
305
  if (!element)
302
306
  return;
307
+ if (!autoFocusOnShow)
308
+ return;
303
309
  queueMicrotask(() => {
304
310
  if (hasFocus(element))
305
311
  return;
@@ -18,8 +18,6 @@ function useNestedDialogs(store, modal) {
18
18
  const context = useContext(NestedDialogsContext);
19
19
  const [openModals, setOpenModals] = useState([]);
20
20
  const [nestedDialogs, setNestedDialogs] = useState([]);
21
- const open = store.useState("open");
22
- const contentElement = store.useState("contentElement");
23
21
  const addDialog = useCallback(
24
22
  (dialog) => {
25
23
  return chain(
@@ -34,7 +32,7 @@ function useNestedDialogs(store, modal) {
34
32
  })()
35
33
  );
36
34
  },
37
- [context.addDialog]
35
+ [context]
38
36
  );
39
37
  const showModal = useCallback(
40
38
  (dialog) => {
@@ -50,22 +48,32 @@ function useNestedDialogs(store, modal) {
50
48
  })()
51
49
  );
52
50
  },
53
- [context.showModal]
51
+ [context]
54
52
  );
55
53
  useSafeLayoutEffect(() => {
56
- if (!contentElement)
57
- return;
58
- return context.addDialog?.(contentElement);
59
- }, [contentElement, context.addDialog]);
54
+ return store.sync(
55
+ (state) => {
56
+ if (!state.contentElement)
57
+ return;
58
+ return context.addDialog?.(state.contentElement);
59
+ },
60
+ ["contentElement"]
61
+ );
62
+ }, [store, context]);
60
63
  useSafeLayoutEffect(() => {
61
64
  if (!modal)
62
65
  return;
63
- if (!open)
64
- return;
65
- if (!contentElement)
66
- return;
67
- return context.showModal?.(contentElement);
68
- }, [modal, open, contentElement, context.showModal]);
66
+ return store.sync(
67
+ (state) => {
68
+ if (!state.open)
69
+ return;
70
+ if (!state.contentElement)
71
+ return;
72
+ return context.showModal?.(state.contentElement);
73
+ },
74
+ ["open", "contentElement"]
75
+ );
76
+ }, [store, modal, context]);
69
77
  useEffect(() => {
70
78
  return context.store?.syncBatch(
71
79
  (state) => {
@@ -3,7 +3,7 @@ import {
3
3
  } from "./M5KYRTQG.js";
4
4
  import {
5
5
  useCommand
6
- } from "./SAVDGYCC.js";
6
+ } from "./SMBMF2TX.js";
7
7
  import {
8
8
  createComponent,
9
9
  createElement,
@@ -11,7 +11,7 @@ import {
11
11
  } from "./JE5NWDDX.js";
12
12
  import {
13
13
  useStoreState
14
- } from "./6DAEYZ43.js";
14
+ } from "./EUGPS2W3.js";
15
15
  import {
16
16
  useEvent,
17
17
  useForkRef,
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  useDialog
3
- } from "./WWZPDI2E.js";
3
+ } from "./E3LZDF77.js";
4
4
  import {
5
5
  PopoverContext
6
6
  } from "./6GS36SYX.js";
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  useDisclosureStoreOptions,
3
3
  useDisclosureStoreProps
4
- } from "./OXIHLN45.js";
4
+ } from "./NL6KEDBG.js";
5
5
  import {
6
6
  useStore
7
- } from "./6DAEYZ43.js";
7
+ } from "./EUGPS2W3.js";
8
8
 
9
9
  // src/dialog/dialog-store.ts
10
10
  import * as Core from "@ariakit/core/dialog/dialog-store";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  useDialogDisclosure
3
- } from "./NRA7DRSD.js";
3
+ } from "./OOPJDYET.js";
4
4
  import {
5
5
  PopoverContext
6
6
  } from "./6GS36SYX.js";
@@ -122,7 +122,15 @@ var usePortal = createHook(
122
122
  if (!portal)
123
123
  return element;
124
124
  if (!portalNode) {
125
- return /* @__PURE__ */ jsx("span", { ref: refProp, id: props.id, style: { position: "fixed" } });
125
+ return /* @__PURE__ */ jsx(
126
+ "span",
127
+ {
128
+ ref: refProp,
129
+ id: props.id,
130
+ style: { position: "fixed" },
131
+ hidden: true
132
+ }
133
+ );
126
134
  }
127
135
  element = /* @__PURE__ */ jsxs(Fragment, { children: [
128
136
  preserveTabOrder && portalNode && /* @__PURE__ */ jsx(
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  useStore,
3
3
  useStoreProps
4
- } from "./6DAEYZ43.js";
4
+ } from "./EUGPS2W3.js";
5
5
 
6
6
  // src/disclosure/disclosure-store.ts
7
7
  import * as Core from "@ariakit/core/disclosure/disclosure-store";
@@ -7,7 +7,7 @@ import {
7
7
  } from "./STKLF26R.js";
8
8
  import {
9
9
  useFocusable
10
- } from "./5TGAWEHD.js";
10
+ } from "./HBXYECGK.js";
11
11
  import {
12
12
  CompositeContext
13
13
  } from "./Z3X3QN6P.js";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  useButton
3
- } from "./I4MLEPTM.js";
3
+ } from "./GEZPJZJE.js";
4
4
  import {
5
5
  DialogContext
6
6
  } from "./LNHZLQEK.js";
@@ -13,15 +13,11 @@ import {
13
13
 
14
14
  // src/collection/collection-item.ts
15
15
  import { useCallback, useContext, useRef } from "react";
16
- import { identity, invariant } from "@ariakit/core/utils/misc";
16
+ import { identity } from "@ariakit/core/utils/misc";
17
17
  var useCollectionItem = createHook(
18
18
  ({ store, shouldRegisterItem = true, getItem = identity, ...props }) => {
19
19
  const context = useContext(CollectionContext);
20
20
  store = store || context;
21
- invariant(
22
- store,
23
- process.env.NODE_ENV !== "production" && "CollectionItem must be wrapped in a Collection component"
24
- );
25
21
  const id = useId(props.id);
26
22
  const unrenderItem = useRef();
27
23
  const ref = useCallback(
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  useDisclosure
3
- } from "./57UTLR6J.js";
3
+ } from "./UBWZV2LZ.js";
4
4
  import {
5
5
  createComponent,
6
6
  createElement,
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  useDialogDismiss
3
- } from "./6THLPTJO.js";
3
+ } from "./NZB3NDFQ.js";
4
4
  import {
5
5
  createComponent,
6
6
  createElement,
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  useFocusable
3
- } from "./5TGAWEHD.js";
3
+ } from "./HBXYECGK.js";
4
4
  import {
5
5
  createComponent,
6
6
  createElement,
@@ -10,7 +10,7 @@ import {
10
10
  } from "./DRSUYUM5.js";
11
11
  import {
12
12
  useCompositeItem
13
- } from "./WHN4PCW7.js";
13
+ } from "./HAHDW4I2.js";
14
14
  import {
15
15
  createElement,
16
16
  createHook,
@@ -18,7 +18,7 @@ import {
18
18
  } from "./JE5NWDDX.js";
19
19
  import {
20
20
  useStoreState
21
- } from "./6DAEYZ43.js";
21
+ } from "./EUGPS2W3.js";
22
22
  import {
23
23
  useBooleanEvent,
24
24
  useEvent
@@ -42,7 +42,7 @@ var useMenuItem = createHook(
42
42
  store = store || menuContext || menuBarContext;
43
43
  invariant(
44
44
  store,
45
- process.env.NODE_ENV !== "production" && "MenuItem must be wrapped in a MenuList, MenuPopover or MenuBar component"
45
+ process.env.NODE_ENV !== "production" && "MenuItem must be wrapped in a MenuList, Menu or MenuBar component"
46
46
  );
47
47
  const onClickProp = props.onClick;
48
48
  const hideOnClickProp = useBooleanEvent(hideOnClick);
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  useButton
3
- } from "./I4MLEPTM.js";
3
+ } from "./GEZPJZJE.js";
4
4
  import {
5
5
  createComponent,
6
6
  createElement,
@@ -7,7 +7,7 @@ import {
7
7
  } from "./6OCAIYRY.js";
8
8
  import {
9
9
  useComposite
10
- } from "./FXC76SFN.js";
10
+ } from "./NOLA2XUH.js";
11
11
  import {
12
12
  createComponent,
13
13
  createElement,
@@ -15,7 +15,7 @@ import {
15
15
  } from "./JE5NWDDX.js";
16
16
  import {
17
17
  useStoreState
18
- } from "./6DAEYZ43.js";
18
+ } from "./EUGPS2W3.js";
19
19
  import {
20
20
  useEvent,
21
21
  useForkRef,
@@ -122,7 +122,7 @@ var useMenuList = createHook(
122
122
  );
123
123
  const ariaLabelledBy = useAriaLabelledBy({ store, ...props });
124
124
  const mounted = store.useState("mounted");
125
- const style = mounted ? props.style : { ...props.style, display: "none" };
125
+ const style = mounted && props.hidden !== true || props.hidden === false ? props.style : { ...props.style, display: "none" };
126
126
  props = {
127
127
  id,
128
128
  "aria-labelledby": ariaLabelledBy,
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  useStore,
3
3
  useStoreProps
4
- } from "./6DAEYZ43.js";
4
+ } from "./EUGPS2W3.js";
5
5
 
6
6
  // src/collection/collection-store.ts
7
7
  import * as Core from "@ariakit/core/collection/collection-store";
@@ -1,11 +1,11 @@
1
1
  import {
2
2
  useDialogStoreOptions,
3
3
  useDialogStoreProps
4
- } from "./OGTE6FGV.js";
4
+ } from "./LWUHIEZR.js";
5
5
  import {
6
6
  useStore,
7
7
  useStoreProps
8
- } from "./6DAEYZ43.js";
8
+ } from "./EUGPS2W3.js";
9
9
  import {
10
10
  useEvent
11
11
  } from "./B7MIN7YT.js";