@ariakit/react-core 0.2.3 → 0.2.4

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 (164) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/cjs/__chunks/{QXQ5XPUN.cjs → 3JRXLDD2.cjs} +3 -4
  3. package/cjs/__chunks/{TKAXHO22.cjs → 3ZQN2EZT.cjs} +2 -2
  4. package/cjs/__chunks/{RH6W76ZY.cjs → 6BXEA5EF.cjs} +2 -2
  5. package/cjs/__chunks/{DCKBTO5Y.cjs → 6EZOH2LA.cjs} +7 -6
  6. package/cjs/__chunks/{NWDBHXX3.cjs → 7BYVU5SZ.cjs} +7 -1
  7. package/cjs/__chunks/{J6GEGD5K.cjs → 7N3VSG4A.cjs} +3 -3
  8. package/cjs/__chunks/{YM35TRAD.cjs → COSA3K2S.cjs} +2 -2
  9. package/cjs/__chunks/{X6IBALQU.cjs → D3NRDEHG.cjs} +2 -2
  10. package/cjs/__chunks/{4BX4RTYL.cjs → EB6EBH7V.cjs} +2 -2
  11. package/cjs/__chunks/{CARNFZQT.cjs → GAXSMBTE.cjs} +2 -2
  12. package/cjs/__chunks/{XUVHJWFO.cjs → GBEGIHKI.cjs} +2 -2
  13. package/cjs/__chunks/{FINPO4DA.cjs → HMH6HLVB.cjs} +2 -2
  14. package/cjs/__chunks/{TVZPJJTX.cjs → HNCLPSSV.cjs} +2 -2
  15. package/cjs/__chunks/{S3IANNS4.cjs → IT5GLJ4X.cjs} +2 -2
  16. package/cjs/__chunks/{HLRHZHR2.cjs → NEHIVLGL.cjs} +2 -2
  17. package/cjs/__chunks/{J4OJ7GJT.cjs → PYMKALFY.cjs} +2 -2
  18. package/cjs/__chunks/{YY2AVCHR.cjs → QMOLTZZO.cjs} +18 -9
  19. package/cjs/__chunks/{ERWCTPBK.cjs → RD7ZO2HE.cjs} +4 -2
  20. package/cjs/__chunks/{A65PNFQY.cjs → T26XOJJH.cjs} +4 -4
  21. package/cjs/__chunks/{EE6OIU6X.cjs → TFOIZV2V.cjs} +5 -5
  22. package/cjs/__chunks/{RQPNMOWL.cjs → URXOWQSR.cjs} +1 -1
  23. package/cjs/__chunks/{L6EQRNH2.cjs → W2HT5JVG.cjs} +9 -22
  24. package/cjs/__chunks/{O45IXGJW.cjs → YEIYG56F.cjs} +4 -4
  25. package/cjs/__chunks/{TP4H5PWH.cjs → YQ76PEZV.cjs} +2 -2
  26. package/cjs/__chunks/{KJGDYG6M.cjs → ZCXLELXW.cjs} +2 -2
  27. package/cjs/__chunks/{72QRTHBX.cjs → ZHJT7NZK.cjs} +23 -20
  28. package/cjs/button/button.cjs +3 -3
  29. package/cjs/checkbox/checkbox.cjs +3 -3
  30. package/cjs/checkbox/checkbox.d.ts +2 -2
  31. package/cjs/combobox/combobox-cancel.cjs +3 -3
  32. package/cjs/combobox/combobox-disclosure.cjs +5 -5
  33. package/cjs/combobox/combobox-item.cjs +5 -5
  34. package/cjs/combobox/combobox-popover.cjs +9 -9
  35. package/cjs/command/command.cjs +2 -2
  36. package/cjs/composite/composite-hover.cjs +2 -2
  37. package/cjs/composite/composite-item.cjs +3 -3
  38. package/cjs/composite/composite-overflow-disclosure.cjs +8 -8
  39. package/cjs/composite/composite-overflow.cjs +9 -9
  40. package/cjs/composite/composite-typeahead.cjs +2 -2
  41. package/cjs/dialog/dialog-backdrop.cjs +4 -4
  42. package/cjs/dialog/dialog-disclosure.cjs +5 -5
  43. package/cjs/dialog/dialog-dismiss.cjs +4 -4
  44. package/cjs/dialog/dialog.cjs +8 -8
  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/walk-tree-outside.cjs +2 -2
  50. package/cjs/disclosure/disclosure.cjs +4 -4
  51. package/cjs/form/form-checkbox.cjs +3 -3
  52. package/cjs/form/form-push.cjs +3 -3
  53. package/cjs/form/form-radio.cjs +4 -4
  54. package/cjs/form/form-remove.cjs +3 -3
  55. package/cjs/form/form-reset.cjs +3 -3
  56. package/cjs/form/form-submit.cjs +3 -3
  57. package/cjs/hovercard/hovercard-disclosure.cjs +5 -5
  58. package/cjs/hovercard/hovercard-dismiss.cjs +6 -6
  59. package/cjs/hovercard/hovercard.cjs +10 -10
  60. package/cjs/hovercard/hovercard.d.ts +0 -9
  61. package/cjs/menu/menu-button.cjs +8 -8
  62. package/cjs/menu/menu-dismiss.cjs +6 -6
  63. package/cjs/menu/menu-item-checkbox.cjs +7 -7
  64. package/cjs/menu/menu-item-radio.cjs +7 -7
  65. package/cjs/menu/menu-item.cjs +5 -5
  66. package/cjs/menu/menu-list.cjs +3 -3
  67. package/cjs/menu/menu.cjs +13 -13
  68. package/cjs/popover/popover-disclosure.cjs +6 -6
  69. package/cjs/popover/popover-dismiss.cjs +5 -5
  70. package/cjs/popover/popover.cjs +9 -9
  71. package/cjs/popover/popover.d.ts +1 -1
  72. package/cjs/radio/radio.cjs +4 -4
  73. package/cjs/select/select-item.cjs +5 -5
  74. package/cjs/select/select-list.cjs +3 -3
  75. package/cjs/select/select-popover.cjs +12 -12
  76. package/cjs/select/select.cjs +8 -8
  77. package/cjs/tab/tab.cjs +3 -3
  78. package/cjs/toolbar/toolbar-container.cjs +4 -4
  79. package/cjs/toolbar/toolbar-input.cjs +4 -4
  80. package/cjs/toolbar/toolbar-item.cjs +4 -4
  81. package/cjs/tooltip/tooltip.cjs +10 -10
  82. package/cjs/tsconfig.build.tsbuildinfo +1 -1
  83. package/esm/__chunks/{SSEF6EVJ.js → 3DWMKQHI.js} +1 -1
  84. package/esm/__chunks/{4H6H5RRM.js → 4GMZGYHX.js} +2 -2
  85. package/esm/__chunks/{6NDCAXRV.js → 4OUEWDQI.js} +16 -13
  86. package/esm/__chunks/{7KMNPNCM.js → 5JAOITB6.js} +2 -2
  87. package/esm/__chunks/{B5KVTUMZ.js → 76X52BLD.js} +1 -1
  88. package/esm/__chunks/{BH4YAZB2.js → ACAQG6DN.js} +1 -1
  89. package/esm/__chunks/{U2FJPRXC.js → BBUDEDX6.js} +1 -1
  90. package/esm/__chunks/{DAQSLIJO.js → EEZDONXU.js} +1 -1
  91. package/esm/__chunks/{7A3SODQV.js → EKB2TUKR.js} +1 -1
  92. package/esm/__chunks/{VPMBP3SV.js → FETTDVY4.js} +1 -1
  93. package/esm/__chunks/{ISPCL6N4.js → FV23EKJL.js} +5 -5
  94. package/esm/__chunks/{UCNIXL4N.js → GGPLUQQY.js} +4 -5
  95. package/esm/__chunks/{RDMLE7SJ.js → GJAZZDOH.js} +1 -1
  96. package/esm/__chunks/{DNPURXZF.js → GKEHNDOU.js} +7 -1
  97. package/esm/__chunks/{GA2RA37M.js → H2CSFGIT.js} +1 -1
  98. package/esm/__chunks/{OVVTUDOE.js → HIZJQGB5.js} +9 -22
  99. package/esm/__chunks/{HYSKO35G.js → OTKCW3PM.js} +1 -1
  100. package/esm/__chunks/{K76RRXSE.js → QDEVTSDD.js} +1 -1
  101. package/esm/__chunks/{EPLYSKGE.js → VQPGNVAE.js} +1 -1
  102. package/esm/__chunks/{GFLJYJHR.js → WNWUDBP3.js} +5 -3
  103. package/esm/__chunks/{4UNPWQYT.js → WPWRDZX3.js} +1 -1
  104. package/esm/__chunks/{7W7JS5WE.js → WVBEOY53.js} +1 -1
  105. package/esm/__chunks/{H2EYGI5B.js → XMEKWVLK.js} +1 -1
  106. package/esm/__chunks/{ZYTXNZCP.js → XXMIY262.js} +1 -1
  107. package/esm/__chunks/{EGINZ4IG.js → YJSLDE5C.js} +17 -8
  108. package/esm/__chunks/{6MPOG72U.js → ZWS67PVZ.js} +6 -5
  109. package/esm/button/button.js +2 -2
  110. package/esm/checkbox/checkbox.d.ts +2 -2
  111. package/esm/checkbox/checkbox.js +2 -2
  112. package/esm/combobox/combobox-cancel.js +2 -2
  113. package/esm/combobox/combobox-disclosure.js +4 -4
  114. package/esm/combobox/combobox-item.js +3 -3
  115. package/esm/combobox/combobox-popover.js +8 -8
  116. package/esm/command/command.js +1 -1
  117. package/esm/composite/composite-hover.js +1 -1
  118. package/esm/composite/composite-item.js +2 -2
  119. package/esm/composite/composite-overflow-disclosure.js +6 -6
  120. package/esm/composite/composite-overflow.js +8 -8
  121. package/esm/composite/composite-typeahead.js +1 -1
  122. package/esm/dialog/dialog-backdrop.js +3 -3
  123. package/esm/dialog/dialog-disclosure.js +4 -4
  124. package/esm/dialog/dialog-dismiss.js +3 -3
  125. package/esm/dialog/dialog.js +7 -7
  126. package/esm/dialog/utils/disable-accessibility-tree-outside.js +2 -2
  127. package/esm/dialog/utils/disable-tree-outside.js +3 -3
  128. package/esm/dialog/utils/mark-tree-outside.js +2 -2
  129. package/esm/dialog/utils/use-hide-on-interact-outside.js +3 -3
  130. package/esm/dialog/utils/walk-tree-outside.js +1 -1
  131. package/esm/disclosure/disclosure.js +3 -3
  132. package/esm/form/form-checkbox.js +2 -2
  133. package/esm/form/form-push.js +2 -2
  134. package/esm/form/form-radio.js +3 -3
  135. package/esm/form/form-remove.js +2 -2
  136. package/esm/form/form-reset.js +2 -2
  137. package/esm/form/form-submit.js +2 -2
  138. package/esm/hovercard/hovercard-disclosure.js +4 -4
  139. package/esm/hovercard/hovercard-dismiss.js +5 -5
  140. package/esm/hovercard/hovercard.d.ts +0 -9
  141. package/esm/hovercard/hovercard.js +9 -9
  142. package/esm/menu/menu-button.js +6 -6
  143. package/esm/menu/menu-dismiss.js +5 -5
  144. package/esm/menu/menu-item-checkbox.js +5 -5
  145. package/esm/menu/menu-item-radio.js +5 -5
  146. package/esm/menu/menu-item.js +4 -4
  147. package/esm/menu/menu-list.js +2 -2
  148. package/esm/menu/menu.js +11 -11
  149. package/esm/popover/popover-disclosure.js +5 -5
  150. package/esm/popover/popover-dismiss.js +4 -4
  151. package/esm/popover/popover.d.ts +1 -1
  152. package/esm/popover/popover.js +8 -8
  153. package/esm/radio/radio.js +3 -3
  154. package/esm/select/select-item.js +3 -3
  155. package/esm/select/select-list.js +2 -2
  156. package/esm/select/select-popover.js +10 -10
  157. package/esm/select/select.js +6 -6
  158. package/esm/tab/tab.js +2 -2
  159. package/esm/toolbar/toolbar-container.js +3 -3
  160. package/esm/toolbar/toolbar-input.js +3 -3
  161. package/esm/toolbar/toolbar-item.js +3 -3
  162. package/esm/tooltip/tooltip.js +9 -9
  163. package/esm/tsconfig.build.tsbuildinfo +1 -1
  164. package/package.json +1 -1
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  DialogBackdrop
3
- } from "./SSEF6EVJ.js";
3
+ } from "./3DWMKQHI.js";
4
4
  import {
5
5
  disableTreeOutside
6
- } from "./4H6H5RRM.js";
6
+ } from "./4GMZGYHX.js";
7
7
  import {
8
8
  disableAccessibilityTreeOutside
9
- } from "./7A3SODQV.js";
9
+ } from "./EKB2TUKR.js";
10
10
  import {
11
11
  usePreventBodyScroll
12
12
  } from "./LMWFU6EQ.js";
@@ -15,13 +15,13 @@ import {
15
15
  } from "./NOIOBRWH.js";
16
16
  import {
17
17
  useHideOnInteractOutside
18
- } from "./GA2RA37M.js";
18
+ } from "./H2CSFGIT.js";
19
19
  import {
20
20
  prependHiddenDismiss
21
21
  } from "./62DFK33R.js";
22
22
  import {
23
23
  markTreeOutside
24
- } from "./BH4YAZB2.js";
24
+ } from "./ACAQG6DN.js";
25
25
  import {
26
26
  useFocusableContainer
27
27
  } from "./URYSNCDU.js";
@@ -89,9 +89,7 @@ function isAlreadyFocusingAnotherElement(dialog) {
89
89
  const activeElement = getActiveElement();
90
90
  if (!activeElement)
91
91
  return false;
92
- if (contains(dialog, activeElement))
93
- return false;
94
- if (activeElement.hasAttribute("data-dialog"))
92
+ if (dialog && contains(dialog, activeElement))
95
93
  return false;
96
94
  if (isFocusable(activeElement))
97
95
  return true;
@@ -228,9 +226,16 @@ var useDialog = createHook(
228
226
  if (!open)
229
227
  return;
230
228
  const { disclosureElement } = store.getState();
231
- const element = portal ? portalNode : ref.current;
229
+ const dialog = ref.current;
232
230
  const persistentElements = getPersistentElementsProp() || [];
233
- const allElements = [element, ...nestedDialogs, ...persistentElements];
231
+ const allElements = [
232
+ // In addition to the dialog element, we also include the portal node here
233
+ // so nested dialogs are considered as well.
234
+ dialog,
235
+ portalNode,
236
+ ...nestedDialogs,
237
+ ...persistentElements
238
+ ];
234
239
  if (!shouldDisableAccessibilityTree) {
235
240
  return markTreeOutside(id, disclosureElement, ...allElements);
236
241
  }
@@ -310,8 +315,6 @@ var useDialog = createHook(
310
315
  return;
311
316
  const dialog = ref.current;
312
317
  const focusOnHide = (retry = true) => {
313
- if (!dialog)
314
- return;
315
318
  if (isAlreadyFocusingAnotherElement(dialog))
316
319
  return;
317
320
  const { disclosureElement } = store.getState();
@@ -344,7 +347,7 @@ var useDialog = createHook(
344
347
  return;
345
348
  if (!isElementFocusable)
346
349
  return;
347
- queueMicrotask(() => element == null ? void 0 : element.focus());
350
+ element == null ? void 0 : element.focus();
348
351
  };
349
352
  if (!open) {
350
353
  return focusOnHide();
@@ -7,10 +7,10 @@ import {
7
7
  } from "./W7JXAQKF.js";
8
8
  import {
9
9
  useCompositeHover
10
- } from "./GFLJYJHR.js";
10
+ } from "./WNWUDBP3.js";
11
11
  import {
12
12
  useCompositeItem
13
- } from "./HYSKO35G.js";
13
+ } from "./OTKCW3PM.js";
14
14
  import {
15
15
  createElement,
16
16
  createHook,
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  useDisclosure
3
- } from "./UCNIXL4N.js";
3
+ } from "./GGPLUQQY.js";
4
4
  import {
5
5
  createComponent,
6
6
  createElement,
@@ -3,7 +3,7 @@ import {
3
3
  } from "./DJESYNLE.js";
4
4
  import {
5
5
  walkTreeOutside
6
- } from "./ISPCL6N4.js";
6
+ } from "./FV23EKJL.js";
7
7
 
8
8
  // src/dialog/utils/mark-tree-outside.ts
9
9
  import { chain } from "@ariakit/core/utils/misc";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  useDialogDismiss
3
- } from "./K76RRXSE.js";
3
+ } from "./QDEVTSDD.js";
4
4
  import {
5
5
  createComponent,
6
6
  createElement,
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  useCompositeItem
3
- } from "./HYSKO35G.js";
3
+ } from "./OTKCW3PM.js";
4
4
  import {
5
5
  createElement,
6
6
  createHook,
@@ -3,7 +3,7 @@ import {
3
3
  } from "./DJESYNLE.js";
4
4
  import {
5
5
  walkTreeOutside
6
- } from "./ISPCL6N4.js";
6
+ } from "./FV23EKJL.js";
7
7
 
8
8
  // src/dialog/utils/disable-accessibility-tree-outside.ts
9
9
  function hideElementFromAccessibilityTree(element) {
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  useCompositeTypeahead
3
- } from "./ZYTXNZCP.js";
3
+ } from "./XXMIY262.js";
4
4
  import {
5
5
  SelectContext
6
6
  } from "./EEVSGAZW.js";
@@ -19,14 +19,14 @@ function walkTreeOutside(elements, callback, ancestorCallback) {
19
19
  return false;
20
20
  return maybeAncestor.contains(element);
21
21
  });
22
- if (hasAncestorAlready)
23
- continue;
24
22
  const doc = getDocument(element);
25
23
  while (element.parentElement && element !== doc.body) {
26
24
  ancestorCallback == null ? void 0 : ancestorCallback(element.parentElement);
27
- for (const child of element.parentElement.children) {
28
- if (isValidElement(child, elements)) {
29
- callback(child);
25
+ if (!hasAncestorAlready) {
26
+ for (const child of element.parentElement.children) {
27
+ if (isValidElement(child, elements)) {
28
+ callback(child);
29
+ }
30
30
  }
31
31
  }
32
32
  element = element.parentElement;
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  useButton
3
- } from "./4UNPWQYT.js";
3
+ } from "./WPWRDZX3.js";
4
4
  import {
5
5
  createComponent,
6
6
  createElement,
@@ -9,8 +9,7 @@ import {
9
9
  import {
10
10
  useBooleanEvent,
11
11
  useEvent,
12
- useForkRef,
13
- useSafeLayoutEffect
12
+ useForkRef
14
13
  } from "./JSNCZ2E2.js";
15
14
  import {
16
15
  __objRest,
@@ -19,7 +18,7 @@ import {
19
18
  } from "./4BKCJXBM.js";
20
19
 
21
20
  // src/disclosure/disclosure.ts
22
- import { useRef, useState } from "react";
21
+ import { useEffect, useRef, useState } from "react";
23
22
  var useDisclosure = createHook(
24
23
  (_a) => {
25
24
  var _b = _a, { store, toggleOnClick = true } = _b, props = __objRest(_b, ["store", "toggleOnClick"]);
@@ -27,7 +26,7 @@ var useDisclosure = createHook(
27
26
  const [expanded, setExpanded] = useState(false);
28
27
  const disclosureElement = store.useState("disclosureElement");
29
28
  const open = store.useState("open");
30
- useSafeLayoutEffect(() => {
29
+ useEffect(() => {
31
30
  let isCurrentDisclosure = disclosureElement === ref.current;
32
31
  if (!disclosureElement || !disclosureElement.isConnected) {
33
32
  store.setDisclosureElement(ref.current);
@@ -4,7 +4,7 @@ import {
4
4
  } from "./HVBRRKV4.js";
5
5
  import {
6
6
  useCompositeTypeahead
7
- } from "./ZYTXNZCP.js";
7
+ } from "./XXMIY262.js";
8
8
  import {
9
9
  useComposite
10
10
  } from "./YBDXDAKQ.js";
@@ -30,7 +30,13 @@ function isNativeClick(event) {
30
30
  if (!event.isTrusted)
31
31
  return false;
32
32
  const element = event.currentTarget;
33
- return isButton(element) || element.tagName === "SUMMARY" || element.tagName === "INPUT" || element.tagName === "TEXTAREA" || element.tagName === "A" || element.tagName === "SELECT";
33
+ if (event.key === "Enter") {
34
+ return isButton(element) || element.tagName === "SUMMARY" || element.tagName === "A";
35
+ }
36
+ if (event.key === " ") {
37
+ return isButton(element) || element.tagName === "SUMMARY" || element.tagName === "INPUT" || element.tagName === "SELECT";
38
+ }
39
+ return false;
34
40
  }
35
41
  var useCommand = createHook(
36
42
  (_a) => {
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  isElementMarked
3
- } from "./BH4YAZB2.js";
3
+ } from "./ACAQG6DN.js";
4
4
  import {
5
5
  usePreviousMouseDownRef
6
6
  } from "./7JNF6I52.js";
@@ -5,7 +5,7 @@ import {
5
5
  } from "./X7FKJQME.js";
6
6
  import {
7
7
  usePopover
8
- } from "./6MPOG72U.js";
8
+ } from "./ZWS67PVZ.js";
9
9
  import {
10
10
  createComponent,
11
11
  createElement,
@@ -38,7 +38,7 @@ import {
38
38
  import { contains } from "@ariakit/core/utils/dom";
39
39
  import { addGlobalEventListener } from "@ariakit/core/utils/events";
40
40
  import { hasFocusWithin } from "@ariakit/core/utils/focus";
41
- import { chain } from "@ariakit/core/utils/misc";
41
+ import { chain, isFalsyBooleanCallback } from "@ariakit/core/utils/misc";
42
42
  import { jsx } from "react/jsx-runtime";
43
43
  function isMovingOnHovercard(target, card, anchor, nested) {
44
44
  if (hasFocusWithin(card))
@@ -118,7 +118,6 @@ var useHovercard = createHook(
118
118
  modal = false,
119
119
  portal = !!modal,
120
120
  hideOnEscape = true,
121
- hideOnControl = false,
122
121
  hideOnHoverOutside = true,
123
122
  disablePointerEventsOnApproach = !!hideOnHoverOutside
124
123
  } = _b, props = __objRest(_b, [
@@ -126,7 +125,6 @@ var useHovercard = createHook(
126
125
  "modal",
127
126
  "portal",
128
127
  "hideOnEscape",
129
- "hideOnControl",
130
128
  "hideOnHoverOutside",
131
129
  "disablePointerEventsOnApproach"
132
130
  ]);
@@ -135,22 +133,6 @@ var useHovercard = createHook(
135
133
  const hideTimeoutRef = useRef(0);
136
134
  const enterPointRef = useRef(null);
137
135
  const { portalRef, domReady } = usePortalRef(portal, props.portalRef);
138
- const hideOnEscapeProp = useBooleanEvent(hideOnEscape);
139
- const hideOnControlProp = useBooleanEvent(hideOnControl);
140
- const open = store.useState("open");
141
- useEffect(() => {
142
- if (!open)
143
- return;
144
- return addGlobalEventListener("keydown", (event) => {
145
- if (event.defaultPrevented)
146
- return;
147
- const isEscape = event.key === "Escape" && hideOnEscapeProp(event);
148
- const isControl = event.key === "Control" && hideOnControlProp(event);
149
- if (isEscape || isControl) {
150
- requestAnimationFrame(store.hide);
151
- }
152
- });
153
- }, [store, open, hideOnEscapeProp, hideOnControlProp]);
154
136
  const mayHideOnHoverOutside = !!hideOnHoverOutside;
155
137
  const hideOnHoverOutsideProp = useBooleanEvent(hideOnHoverOutside);
156
138
  const mayDisablePointerEvents = !!disablePointerEventsOnApproach;
@@ -283,12 +265,17 @@ var useHovercard = createHook(
283
265
  props = useAutoFocusOnHide(__spreadValues({ store }, props));
284
266
  props = useAutoFocusOnShow(__spreadValues({ store, modal }, props));
285
267
  props = usePopover(__spreadProps(__spreadValues({
286
- hideOnEscape,
287
268
  store,
288
269
  modal,
289
270
  portal
290
271
  }, props), {
291
- portalRef
272
+ portalRef,
273
+ hideOnEscape(event) {
274
+ if (isFalsyBooleanCallback(hideOnEscape, event))
275
+ return false;
276
+ requestAnimationFrame(() => requestAnimationFrame(store.hide));
277
+ return true;
278
+ }
292
279
  }));
293
280
  return props;
294
281
  }
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  useCommand
3
- } from "./DNPURXZF.js";
3
+ } from "./GKEHNDOU.js";
4
4
  import {
5
5
  useCollectionItem
6
6
  } from "./CWGC7RDD.js";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  useButton
3
- } from "./4UNPWQYT.js";
3
+ } from "./WPWRDZX3.js";
4
4
  import {
5
5
  DialogContext
6
6
  } from "./LNHZLQEK.js";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  usePopoverDismiss
3
- } from "./U2FJPRXC.js";
3
+ } from "./BBUDEDX6.js";
4
4
  import {
5
5
  createComponent,
6
6
  createElement,
@@ -20,7 +20,7 @@ import {
20
20
  // src/composite/composite-hover.ts
21
21
  import { useContext } from "react";
22
22
  import { closest, contains } from "@ariakit/core/utils/dom";
23
- import { hasFocusWithin } from "@ariakit/core/utils/focus";
23
+ import { hasFocus, hasFocusWithin } from "@ariakit/core/utils/focus";
24
24
  import { invariant } from "@ariakit/core/utils/misc";
25
25
  function getMouseDestination(event) {
26
26
  const relatedTarget = event.relatedTarget;
@@ -55,7 +55,6 @@ var useCompositeHover = createHook(
55
55
  const onMouseMoveProp = props.onMouseMove;
56
56
  const focusOnHoverProp = useBooleanEvent(focusOnHover);
57
57
  const onMouseMove = useEvent((event) => {
58
- var _a2;
59
58
  onMouseMoveProp == null ? void 0 : onMouseMoveProp(event);
60
59
  if (event.defaultPrevented)
61
60
  return;
@@ -64,7 +63,10 @@ var useCompositeHover = createHook(
64
63
  if (!focusOnHoverProp(event))
65
64
  return;
66
65
  if (!hasFocusWithin(event.currentTarget)) {
67
- (_a2 = store == null ? void 0 : store.getState().baseElement) == null ? void 0 : _a2.focus();
66
+ const baseElement = store == null ? void 0 : store.getState().baseElement;
67
+ if (baseElement && !hasFocus(baseElement)) {
68
+ baseElement.focus();
69
+ }
68
70
  }
69
71
  store == null ? void 0 : store.setActiveId(event.currentTarget.id);
70
72
  });
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  useCommand
3
- } from "./DNPURXZF.js";
3
+ } from "./GKEHNDOU.js";
4
4
  import {
5
5
  createComponent,
6
6
  createElement,
@@ -3,7 +3,7 @@ import {
3
3
  } from "./6I2PARRP.js";
4
4
  import {
5
5
  useCompositeItem
6
- } from "./HYSKO35G.js";
6
+ } from "./OTKCW3PM.js";
7
7
  import {
8
8
  createElement,
9
9
  createHook,
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  useDialogDisclosure
3
- } from "./B5KVTUMZ.js";
3
+ } from "./76X52BLD.js";
4
4
  import {
5
5
  usePopoverAnchor
6
6
  } from "./UYBDYDBM.js";
@@ -52,7 +52,7 @@ function itemTextStartsWith(item, text) {
52
52
  const itemText = ((_a = item.element) == null ? void 0 : _a.textContent) || item.children;
53
53
  if (!itemText)
54
54
  return false;
55
- return normalizeString(itemText).toLowerCase().startsWith(text.toLowerCase());
55
+ return normalizeString(itemText).trim().toLowerCase().startsWith(text.toLowerCase());
56
56
  }
57
57
  function getSameInitialItems(items, char, activeId) {
58
58
  if (!activeId)
@@ -3,7 +3,7 @@ import {
3
3
  } from "./M5KYRTQG.js";
4
4
  import {
5
5
  useCommand
6
- } from "./DNPURXZF.js";
6
+ } from "./GKEHNDOU.js";
7
7
  import {
8
8
  createComponent,
9
9
  createElement,
@@ -37,6 +37,12 @@ function setMixed(element, mixed) {
37
37
  function isNativeCheckbox(tagName, type) {
38
38
  return tagName === "input" && (!type || type === "checkbox");
39
39
  }
40
+ function getNonArrayValue(value) {
41
+ if (Array.isArray(value)) {
42
+ return value.toString();
43
+ }
44
+ return value;
45
+ }
40
46
  var useCheckbox = createHook(
41
47
  (_a) => {
42
48
  var _b = _a, {
@@ -56,9 +62,11 @@ var useCheckbox = createHook(
56
62
  return checkedProp;
57
63
  if (state.value === void 0)
58
64
  return;
59
- if (valueProp) {
60
- if (Array.isArray(state.value))
61
- return state.value.includes(valueProp);
65
+ if (valueProp != null) {
66
+ if (Array.isArray(state.value)) {
67
+ const nonArrayValue = getNonArrayValue(valueProp);
68
+ return state.value.includes(nonArrayValue);
69
+ }
62
70
  return state.value === valueProp;
63
71
  }
64
72
  if (Array.isArray(state.value))
@@ -98,14 +106,15 @@ var useCheckbox = createHook(
98
106
  const elementChecked = event.currentTarget.checked;
99
107
  setChecked(elementChecked);
100
108
  store == null ? void 0 : store.setValue((prevValue) => {
101
- if (!valueProp)
109
+ if (valueProp == null)
102
110
  return elementChecked;
111
+ const nonArrayValue = getNonArrayValue(valueProp);
103
112
  if (!Array.isArray(prevValue)) {
104
- return prevValue === valueProp ? false : valueProp;
113
+ return prevValue === nonArrayValue ? false : nonArrayValue;
105
114
  }
106
115
  if (elementChecked)
107
- return [...prevValue, valueProp];
108
- return prevValue.filter((v) => v !== valueProp);
116
+ return [...prevValue, nonArrayValue];
117
+ return prevValue.filter((v) => v !== nonArrayValue);
109
118
  });
110
119
  });
111
120
  const onClickProp = props.onClick;
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  useDialog
3
- } from "./6NDCAXRV.js";
3
+ } from "./4OUEWDQI.js";
4
4
  import {
5
5
  PopoverContext
6
6
  } from "./6GS36SYX.js";
@@ -201,8 +201,8 @@ var usePopover = createHook(
201
201
  const [positioned, setPositioned] = useState(false);
202
202
  const { portalRef, domReady } = usePortalRef(portal, props.portalRef);
203
203
  const getAnchorRectProp = useEvent(getAnchorRect);
204
- const hasCustomUpdatePosition = !!updatePosition;
205
204
  const updatePositionProp = useEvent(updatePosition);
205
+ const hasCustomUpdatePosition = !!updatePosition;
206
206
  useSafeLayoutEffect(() => {
207
207
  if (!(popoverElement == null ? void 0 : popoverElement.isConnected))
208
208
  return;
@@ -252,11 +252,12 @@ var usePopover = createHook(
252
252
  return autoUpdate(
253
253
  anchor,
254
254
  popoverElement,
255
- () => {
255
+ async () => {
256
256
  if (hasCustomUpdatePosition) {
257
- updatePositionProp({ updatePosition: update });
257
+ await updatePositionProp({ updatePosition: update });
258
+ setPositioned(true);
258
259
  } else {
259
- update();
260
+ await update();
260
261
  }
261
262
  },
262
263
  {
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  Button,
3
3
  useButton
4
- } from "../__chunks/4UNPWQYT.js";
5
- import "../__chunks/DNPURXZF.js";
4
+ } from "../__chunks/WPWRDZX3.js";
5
+ import "../__chunks/GKEHNDOU.js";
6
6
  import "../__chunks/IMP6LK4U.js";
7
7
  import "../__chunks/BMLNRUFQ.js";
8
8
  import "../__chunks/U2LXZPCY.js";
@@ -1,4 +1,4 @@
1
- import type { ChangeEvent } from "react";
1
+ import type { ChangeEvent, InputHTMLAttributes } from "react";
2
2
  import type { CommandOptions } from "../command/command.js";
3
3
  import type { As, Props } from "../utils/types.js";
4
4
  import type { CheckboxStore } from "./checkbox-store.js";
@@ -52,7 +52,7 @@ export interface CheckboxOptions<T extends As = "input"> extends CommandOptions<
52
52
  * <Checkbox store={checkbox} value="Watermelon" />
53
53
  * ```
54
54
  */
55
- value?: string | number;
55
+ value?: InputHTMLAttributes<HTMLInputElement>["value"];
56
56
  /**
57
57
  * The default `checked` state of the checkbox. This prop is ignored if the
58
58
  * `checked` or the `store` props are provided.
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  Checkbox,
3
3
  useCheckbox
4
- } from "../__chunks/EGINZ4IG.js";
4
+ } from "../__chunks/YJSLDE5C.js";
5
5
  import "../__chunks/M5KYRTQG.js";
6
- import "../__chunks/DNPURXZF.js";
6
+ import "../__chunks/GKEHNDOU.js";
7
7
  import "../__chunks/IMP6LK4U.js";
8
8
  import "../__chunks/BMLNRUFQ.js";
9
9
  import "../__chunks/U2LXZPCY.js";
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  useButton
3
- } from "../__chunks/4UNPWQYT.js";
4
- import "../__chunks/DNPURXZF.js";
3
+ } from "../__chunks/WPWRDZX3.js";
4
+ import "../__chunks/GKEHNDOU.js";
5
5
  import "../__chunks/IMP6LK4U.js";
6
6
  import "../__chunks/BMLNRUFQ.js";
7
7
  import {
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  useDialogDisclosure
3
- } from "../__chunks/B5KVTUMZ.js";
4
- import "../__chunks/UCNIXL4N.js";
5
- import "../__chunks/4UNPWQYT.js";
6
- import "../__chunks/DNPURXZF.js";
3
+ } from "../__chunks/76X52BLD.js";
4
+ import "../__chunks/GGPLUQQY.js";
5
+ import "../__chunks/WPWRDZX3.js";
6
+ import "../__chunks/GKEHNDOU.js";
7
7
  import "../__chunks/IMP6LK4U.js";
8
8
  import "../__chunks/BMLNRUFQ.js";
9
9
  import {
@@ -4,11 +4,11 @@ import {
4
4
  } from "../__chunks/5VGBBGF5.js";
5
5
  import {
6
6
  useCompositeHover
7
- } from "../__chunks/GFLJYJHR.js";
7
+ } from "../__chunks/WNWUDBP3.js";
8
8
  import {
9
9
  useCompositeItem
10
- } from "../__chunks/HYSKO35G.js";
11
- import "../__chunks/DNPURXZF.js";
10
+ } from "../__chunks/OTKCW3PM.js";
11
+ import "../__chunks/GKEHNDOU.js";
12
12
  import "../__chunks/CWGC7RDD.js";
13
13
  import "../__chunks/T3DJZG63.js";
14
14
  import "../__chunks/OXPV2NBK.js";
@@ -4,20 +4,20 @@ import {
4
4
  import "../__chunks/5VGBBGF5.js";
5
5
  import {
6
6
  usePopover
7
- } from "../__chunks/6MPOG72U.js";
8
- import "../__chunks/6NDCAXRV.js";
9
- import "../__chunks/SSEF6EVJ.js";
10
- import "../__chunks/4H6H5RRM.js";
11
- import "../__chunks/7A3SODQV.js";
7
+ } from "../__chunks/ZWS67PVZ.js";
8
+ import "../__chunks/4OUEWDQI.js";
9
+ import "../__chunks/3DWMKQHI.js";
10
+ import "../__chunks/4GMZGYHX.js";
11
+ import "../__chunks/EKB2TUKR.js";
12
12
  import "../__chunks/LMWFU6EQ.js";
13
13
  import "../__chunks/NOIOBRWH.js";
14
- import "../__chunks/GA2RA37M.js";
14
+ import "../__chunks/H2CSFGIT.js";
15
15
  import "../__chunks/KOVUJERF.js";
16
16
  import "../__chunks/62DFK33R.js";
17
- import "../__chunks/BH4YAZB2.js";
17
+ import "../__chunks/ACAQG6DN.js";
18
18
  import "../__chunks/DJESYNLE.js";
19
19
  import "../__chunks/URYSNCDU.js";
20
- import "../__chunks/ISPCL6N4.js";
20
+ import "../__chunks/FV23EKJL.js";
21
21
  import "../__chunks/7JNF6I52.js";
22
22
  import "../__chunks/6OMX4H3W.js";
23
23
  import "../__chunks/56DUJ462.js";
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  Command,
3
3
  useCommand
4
- } from "../__chunks/DNPURXZF.js";
4
+ } from "../__chunks/GKEHNDOU.js";
5
5
  import "../__chunks/IMP6LK4U.js";
6
6
  import "../__chunks/BMLNRUFQ.js";
7
7
  import "../__chunks/U2LXZPCY.js";
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  CompositeHover,
3
3
  useCompositeHover
4
- } from "../__chunks/GFLJYJHR.js";
4
+ } from "../__chunks/WNWUDBP3.js";
5
5
  import "../__chunks/Z3X3QN6P.js";
6
6
  import "../__chunks/U2LXZPCY.js";
7
7
  import "../__chunks/JSNCZ2E2.js";
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  CompositeItem,
3
3
  useCompositeItem
4
- } from "../__chunks/HYSKO35G.js";
5
- import "../__chunks/DNPURXZF.js";
4
+ } from "../__chunks/OTKCW3PM.js";
5
+ import "../__chunks/GKEHNDOU.js";
6
6
  import "../__chunks/CWGC7RDD.js";
7
7
  import "../__chunks/T3DJZG63.js";
8
8
  import "../__chunks/OXPV2NBK.js";