@ariakit/react-core 0.3.6 → 0.3.8

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 (148) hide show
  1. package/CHANGELOG.md +41 -0
  2. package/cjs/__chunks/{VEG6PRAG.cjs → 3WCBE6SU.cjs} +3 -1
  3. package/cjs/__chunks/{45RPYV4J.cjs → EQ4A5RPW.cjs} +2 -2
  4. package/cjs/__chunks/{CILQPSH2.cjs → FA25CV2I.cjs} +2 -2
  5. package/cjs/__chunks/{RRW7YVFR.cjs → IPYAEPOT.cjs} +17 -6
  6. package/cjs/__chunks/{AYDXWQBF.cjs → L3WS5HGI.cjs} +2 -0
  7. package/cjs/__chunks/{QU2266CJ.cjs → WH4I6OSN.cjs} +12 -4
  8. package/cjs/__chunks/{LVOI2KVN.cjs → XGKLTARH.cjs} +2 -2
  9. package/cjs/__chunks/{4GLXDOKG.cjs → YAPOM5RT.cjs} +2 -2
  10. package/cjs/checkbox/checkbox-provider.cjs +2 -2
  11. package/cjs/combobox/combobox-cancel.cjs +2 -2
  12. package/cjs/combobox/combobox-context.cjs +4 -2
  13. package/cjs/combobox/combobox-context.d.cts +6 -5
  14. package/cjs/combobox/combobox-context.d.ts +6 -5
  15. package/cjs/combobox/combobox-disclosure.cjs +2 -2
  16. package/cjs/combobox/combobox-item-check.cjs +50 -0
  17. package/cjs/combobox/combobox-item-check.d.cts +60 -0
  18. package/cjs/combobox/combobox-item-check.d.ts +60 -0
  19. package/cjs/combobox/combobox-item-value.cjs +3 -3
  20. package/cjs/combobox/combobox-item.cjs +47 -10
  21. package/cjs/combobox/combobox-item.d.cts +31 -13
  22. package/cjs/combobox/combobox-item.d.ts +31 -13
  23. package/cjs/combobox/combobox-label.cjs +55 -0
  24. package/cjs/combobox/combobox-label.d.cts +42 -0
  25. package/cjs/combobox/combobox-label.d.ts +42 -0
  26. package/cjs/combobox/combobox-list.cjs +3 -3
  27. package/cjs/combobox/combobox-popover.cjs +7 -7
  28. package/cjs/combobox/combobox-provider.cjs +4 -4
  29. package/cjs/combobox/combobox-provider.d.cts +8 -4
  30. package/cjs/combobox/combobox-provider.d.ts +8 -4
  31. package/cjs/combobox/combobox-row.cjs +2 -2
  32. package/cjs/combobox/combobox-separator.cjs +2 -2
  33. package/cjs/combobox/combobox-store.cjs +2 -2
  34. package/cjs/combobox/combobox-store.d.cts +28 -9
  35. package/cjs/combobox/combobox-store.d.ts +28 -9
  36. package/cjs/combobox/combobox.cjs +28 -14
  37. package/cjs/combobox/combobox.d.cts +2 -1
  38. package/cjs/combobox/combobox.d.ts +2 -1
  39. package/cjs/composite/composite-hover.cjs +2 -2
  40. package/cjs/composite/composite-hover.d.cts +9 -0
  41. package/cjs/composite/composite-hover.d.ts +9 -0
  42. package/cjs/composite/composite-item.d.cts +3 -0
  43. package/cjs/composite/composite-item.d.ts +3 -0
  44. package/cjs/composite/composite-overflow.cjs +2 -2
  45. package/cjs/disclosure/disclosure-content.d.cts +3 -1
  46. package/cjs/disclosure/disclosure-content.d.ts +3 -1
  47. package/cjs/disclosure/disclosure.d.cts +3 -0
  48. package/cjs/disclosure/disclosure.d.ts +3 -0
  49. package/cjs/focusable/focusable.d.cts +2 -1
  50. package/cjs/focusable/focusable.d.ts +2 -1
  51. package/cjs/form/form-checkbox.cjs +1 -1
  52. package/cjs/hovercard/hovercard-anchor.d.cts +3 -0
  53. package/cjs/hovercard/hovercard-anchor.d.ts +3 -0
  54. package/cjs/hovercard/hovercard.cjs +3 -3
  55. package/cjs/menu/menu-button.cjs +33 -21
  56. package/cjs/menu/menu-item-checkbox.cjs +4 -4
  57. package/cjs/menu/menu-item-radio.cjs +3 -3
  58. package/cjs/menu/menu-item.cjs +3 -3
  59. package/cjs/menu/menu-provider.cjs +3 -3
  60. package/cjs/menu/menu-store.cjs +3 -3
  61. package/cjs/menu/menu-store.d.cts +7 -55
  62. package/cjs/menu/menu-store.d.ts +7 -55
  63. package/cjs/menu/menu.cjs +3 -3
  64. package/cjs/popover/popover.cjs +2 -2
  65. package/cjs/popover/popover.d.cts +4 -0
  66. package/cjs/popover/popover.d.ts +4 -0
  67. package/cjs/portal/portal.d.cts +5 -1
  68. package/cjs/portal/portal.d.ts +5 -1
  69. package/cjs/select/select-item.cjs +5 -5
  70. package/cjs/select/select-label.cjs +1 -1
  71. package/cjs/select/select-popover.cjs +2 -2
  72. package/cjs/select/select-provider.cjs +3 -3
  73. package/cjs/select/select-store.cjs +3 -3
  74. package/cjs/select/select-store.d.cts +1 -7
  75. package/cjs/select/select-store.d.ts +1 -7
  76. package/cjs/tooltip/tooltip.cjs +3 -3
  77. package/combobox/combobox-item-check/package.json +8 -0
  78. package/combobox/combobox-label/package.json +8 -0
  79. package/esm/__chunks/{KFUKDUTY.js → 4AMOOZBQ.js} +10 -2
  80. package/esm/__chunks/{PHTJ3BCW.js → 7HYEBVZE.js} +1 -1
  81. package/esm/__chunks/{YGJUONJM.js → BONLQCKO.js} +1 -1
  82. package/esm/__chunks/{BRO2JF5P.js → G6ONQ5EH.js} +20 -9
  83. package/esm/__chunks/{W3TC4TID.js → JRUYDVPB.js} +1 -1
  84. package/esm/__chunks/{NE6JAKK6.js → P3UZS6BC.js} +1 -1
  85. package/esm/__chunks/{MTC2KUZZ.js → W76OTZCC.js} +3 -1
  86. package/esm/__chunks/{24AKC2LC.js → ZETMAOTK.js} +2 -0
  87. package/esm/checkbox/checkbox-provider.js +3 -3
  88. package/esm/combobox/combobox-cancel.js +1 -1
  89. package/esm/combobox/combobox-context.d.ts +6 -5
  90. package/esm/combobox/combobox-context.js +3 -1
  91. package/esm/combobox/combobox-disclosure.js +1 -1
  92. package/esm/combobox/combobox-item-check.d.ts +60 -0
  93. package/esm/combobox/combobox-item-check.js +50 -0
  94. package/esm/combobox/combobox-item-value.js +1 -1
  95. package/esm/combobox/combobox-item.d.ts +31 -13
  96. package/esm/combobox/combobox-item.js +45 -8
  97. package/esm/combobox/combobox-label.d.ts +42 -0
  98. package/esm/combobox/combobox-label.js +55 -0
  99. package/esm/combobox/combobox-list.js +2 -2
  100. package/esm/combobox/combobox-popover.js +3 -3
  101. package/esm/combobox/combobox-provider.d.ts +8 -4
  102. package/esm/combobox/combobox-provider.js +2 -2
  103. package/esm/combobox/combobox-row.js +1 -1
  104. package/esm/combobox/combobox-separator.js +1 -1
  105. package/esm/combobox/combobox-store.d.ts +28 -9
  106. package/esm/combobox/combobox-store.js +1 -1
  107. package/esm/combobox/combobox.d.ts +2 -1
  108. package/esm/combobox/combobox.js +28 -14
  109. package/esm/composite/composite-hover.d.ts +9 -0
  110. package/esm/composite/composite-hover.js +1 -1
  111. package/esm/composite/composite-item.d.ts +3 -0
  112. package/esm/composite/composite-overflow.js +1 -1
  113. package/esm/disclosure/disclosure-content.d.ts +3 -1
  114. package/esm/disclosure/disclosure.d.ts +3 -0
  115. package/esm/focusable/focusable.d.ts +2 -1
  116. package/esm/form/form-checkbox.js +1 -1
  117. package/esm/hovercard/hovercard-anchor.d.ts +3 -0
  118. package/esm/hovercard/hovercard.js +2 -2
  119. package/esm/menu/menu-button.js +33 -21
  120. package/esm/menu/menu-item-checkbox.js +3 -3
  121. package/esm/menu/menu-item-radio.js +2 -2
  122. package/esm/menu/menu-item.js +2 -2
  123. package/esm/menu/menu-provider.js +2 -2
  124. package/esm/menu/menu-store.d.ts +7 -55
  125. package/esm/menu/menu-store.js +2 -2
  126. package/esm/menu/menu.js +2 -2
  127. package/esm/popover/popover.d.ts +4 -0
  128. package/esm/popover/popover.js +1 -1
  129. package/esm/portal/portal.d.ts +5 -1
  130. package/esm/select/select-item.js +4 -4
  131. package/esm/select/select-label.js +2 -2
  132. package/esm/select/select-popover.js +1 -1
  133. package/esm/select/select-provider.js +2 -2
  134. package/esm/select/select-store.d.ts +1 -7
  135. package/esm/select/select-store.js +2 -2
  136. package/esm/tooltip/tooltip.js +2 -2
  137. package/package.json +16 -2
  138. package/cjs/collection/collection-context.d.cts +0 -34
  139. package/cjs/collection/collection-context.d.ts +0 -34
  140. package/cjs/composite/utils.d.cts +0 -69
  141. package/cjs/composite/utils.d.ts +0 -69
  142. package/cjs/tab/tab-store.d.cts +0 -74
  143. package/cjs/tab/tab-store.d.ts +0 -74
  144. package/esm/collection/collection-context.d.ts +0 -34
  145. package/esm/composite/utils.d.ts +0 -69
  146. package/esm/tab/tab-store.d.ts +0 -74
  147. package/cjs/__chunks/{ISGOCBDC.cjs → RIZYIKBE.cjs} +1 -1
  148. package/esm/__chunks/{KB2HXEVC.js → WBQC3LL4.js} +1 -1
@@ -4,7 +4,7 @@ import {
4
4
  } from "../__chunks/JCH6MLL2.js";
5
5
  import {
6
6
  useComboboxProviderContext
7
- } from "../__chunks/MTC2KUZZ.js";
7
+ } from "../__chunks/W76OTZCC.js";
8
8
  import {
9
9
  useComposite
10
10
  } from "../__chunks/FHDXHZLB.js";
@@ -40,7 +40,11 @@ import {
40
40
 
41
41
  // src/combobox/combobox.ts
42
42
  import { useEffect, useMemo, useRef, useState } from "react";
43
- import { getPopupRole, getScrollingElement } from "@ariakit/core/utils/dom";
43
+ import {
44
+ getPopupRole,
45
+ getScrollingElement,
46
+ setSelectionRange
47
+ } from "@ariakit/core/utils/dom";
44
48
  import {
45
49
  isFocusEventOutside,
46
50
  queueBeforeEvent
@@ -173,7 +177,7 @@ var useCombobox = createHook(
173
177
  const element = ref.current;
174
178
  if (!element)
175
179
  return;
176
- element.setSelectionRange(storeValue.length, activeValue.length);
180
+ setSelectionRange(element, storeValue.length, activeValue.length);
177
181
  });
178
182
  }, [
179
183
  valueUpdated,
@@ -227,15 +231,16 @@ var useCombobox = createHook(
227
231
  return;
228
232
  canAutoSelectRef.current = false;
229
233
  }, [open]);
234
+ const resetValueOnSelect = store.useState("resetValueOnSelect");
230
235
  useUpdateEffect(() => {
231
- var _a2;
236
+ var _a2, _b2;
232
237
  if (!store)
233
238
  return;
234
- if (!autoSelect)
239
+ if (!autoSelect && !resetValueOnSelect)
235
240
  return;
236
241
  if (!canAutoSelectRef.current)
237
242
  return;
238
- const { baseElement, contentElement: contentElement2 } = store.getState();
243
+ const { baseElement, contentElement: contentElement2, activeId } = store.getState();
239
244
  if (baseElement && !hasFocus(baseElement))
240
245
  return;
241
246
  if (contentElement2 == null ? void 0 : contentElement2.hasAttribute("data-placing")) {
@@ -243,14 +248,23 @@ var useCombobox = createHook(
243
248
  observer.observe(contentElement2, { attributeFilter: ["data-placing"] });
244
249
  return () => observer.disconnect();
245
250
  }
246
- store.move((_a2 = store.first()) != null ? _a2 : null);
251
+ if (autoSelect) {
252
+ store.move((_a2 = store.first()) != null ? _a2 : null);
253
+ } else {
254
+ const element = (_b2 = store.item(activeId)) == null ? void 0 : _b2.element;
255
+ if (element && "scrollIntoView" in element) {
256
+ element.scrollIntoView({ block: "nearest", inline: "nearest" });
257
+ }
258
+ }
247
259
  return;
248
- }, [store, valueUpdated, storeValue, autoSelect, items]);
249
- useSafeLayoutEffect(() => {
250
- if (autoSelect)
251
- return;
252
- store == null ? void 0 : store.setActiveId(null);
253
- }, [valueUpdated, autoSelect, store]);
260
+ }, [
261
+ store,
262
+ valueUpdated,
263
+ storeValue,
264
+ autoSelect,
265
+ resetValueOnSelect,
266
+ items
267
+ ]);
254
268
  useEffect(() => {
255
269
  if (!inline)
256
270
  return;
@@ -296,7 +310,7 @@ var useCombobox = createHook(
296
310
  if (setValueOnChangeProp(event)) {
297
311
  const isSameValue = value2 === store.getState().value;
298
312
  flushSync(() => store == null ? void 0 : store.setValue(value2));
299
- event.currentTarget.setSelectionRange(selectionStart, selectionEnd);
313
+ setSelectionRange(event.currentTarget, selectionStart, selectionEnd);
300
314
  if (inline && autoSelect && isSameValue) {
301
315
  forceValueUpdate();
302
316
  }
@@ -46,6 +46,10 @@ export interface CompositeHoverOptions<T extends As = "div"> extends Options<T>
46
46
  * Determines if the composite item should be focused on hover.
47
47
  *
48
48
  * Live examples:
49
+ * - [Multi-selectable
50
+ * Combobox](https://ariakit.org/examples/combobox-multiple)
51
+ * - [Combobox with integrated
52
+ * filter](https://ariakit.org/examples/combobox-filtering-integrated)
49
53
  * - [Textarea with inline
50
54
  * Combobox](https://ariakit.org/examples/combobox-textarea)
51
55
  * @default true
@@ -56,6 +60,11 @@ export interface CompositeHoverOptions<T extends As = "div"> extends Options<T>
56
60
  * By default, this is set to `true` if
57
61
  * [`focusOnHover`](https://ariakit.org/reference/composite-hover#focusonhover)
58
62
  * is `true`.
63
+ *
64
+ * Live examples:
65
+ * - [Navigation Menubar](https://ariakit.org/examples/menubar-navigation)
66
+ * - [Combobox with integrated
67
+ * filter](https://ariakit.org/examples/combobox-filtering-integrated)
59
68
  */
60
69
  blurOnHoverEnd?: BooleanOrCallback<ReactMouseEvent<HTMLElement>>;
61
70
  }
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  CompositeHover,
4
4
  useCompositeHover
5
- } from "../__chunks/BRO2JF5P.js";
5
+ } from "../__chunks/G6ONQ5EH.js";
6
6
  import "../__chunks/IB7YUKH5.js";
7
7
  import "../__chunks/4UUKJZ4V.js";
8
8
  import "../__chunks/3ORBWXWF.js";
@@ -84,6 +84,9 @@ export interface CompositeItemOptions<T extends As = "button"> extends CommandOp
84
84
  * **Note**: This prop has no effect when the
85
85
  * [`virtualFocus`](https://ariakit.org/reference/composite-provider#virtualfocus)
86
86
  * option is enabled.
87
+ *
88
+ * Live examples:
89
+ * - [Navigation Menubar](https://ariakit.org/examples/menubar-navigation)
87
90
  */
88
91
  tabbable?: boolean;
89
92
  }
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import {
3
3
  usePopover
4
- } from "../__chunks/KB2HXEVC.js";
4
+ } from "../__chunks/WBQC3LL4.js";
5
5
  import "../__chunks/U7WGY7YX.js";
6
6
  import "../__chunks/JSLLR7RC.js";
7
7
  import "../__chunks/CLF4PQ7T.js";
@@ -61,7 +61,9 @@ export interface DisclosureContentOptions<T extends As = "div"> extends Options<
61
61
  * the DOM when it's hidden.
62
62
  *
63
63
  * Live examples:
64
- * - [Combobox with links](https://ariakit.org/examples/combobox-links)
64
+ * - [Navigation Menubar](https://ariakit.org/examples/menubar-navigation)
65
+ * - [Combobox with integrated
66
+ * filter](https://ariakit.org/examples/combobox-filtering-integrated)
65
67
  * - [Textarea with inline
66
68
  * Combobox](https://ariakit.org/examples/combobox-textarea)
67
69
  * - [Standalone Popover](https://ariakit.org/examples/popover-standalone)
@@ -42,6 +42,9 @@ export interface DisclosureOptions<T extends As = "button"> extends ButtonOption
42
42
  * [`toggle`](https://ariakit.org/reference/use-disclosure-store#toggle) will
43
43
  * be called on click. This is useful if you want to handle the toggle logic
44
44
  * yourself.
45
+ *
46
+ * Live examples:
47
+ * - [Navigation Menubar](https://ariakit.org/examples/menubar-navigation)
45
48
  * @default true
46
49
  */
47
50
  toggleOnClick?: BooleanOrCallback<MouseEvent<HTMLElement>>;
@@ -106,8 +106,9 @@ export interface FocusableOptions<T extends As = "div"> extends Options<T> {
106
106
  * programmatic equivalent of the `data-focus-visible` attribute.
107
107
  *
108
108
  * Live examples:
109
+ * - [Navigation Menubar](https://ariakit.org/examples/menubar-navigation)
109
110
  * - [Custom Checkbox](https://ariakit.org/examples/checkbox-custom)
110
111
  */
111
- onFocusVisible?: BivariantCallback<(event: SyntheticEvent) => void>;
112
+ onFocusVisible?: BivariantCallback<(event: SyntheticEvent<HTMLElement>) => void>;
112
113
  }
113
114
  export type FocusableProps<T extends As = "div"> = Props<FocusableOptions<T>>;
@@ -8,10 +8,10 @@ import {
8
8
  import {
9
9
  useCheckbox
10
10
  } from "../__chunks/D42GAV4S.js";
11
+ import "../__chunks/VPR2WHQV.js";
11
12
  import {
12
13
  useCheckboxStore
13
14
  } from "../__chunks/BI7ZXWGY.js";
14
- import "../__chunks/VPR2WHQV.js";
15
15
  import "../__chunks/6XBVQI3K.js";
16
16
  import "../__chunks/NWCBQ4CV.js";
17
17
  import "../__chunks/UH3I23HL.js";
@@ -39,6 +39,9 @@ export interface HovercardAnchorOptions<T extends As = "a"> extends FocusableOpt
39
39
  store?: HovercardStore;
40
40
  /**
41
41
  * Whether to show the hovercard on mouse move.
42
+ *
43
+ * Live examples:
44
+ * - [Navigation Menubar](https://ariakit.org/examples/menubar-navigation)
42
45
  * @default true
43
46
  */
44
47
  showOnHover?: BooleanOrCallback<ReactMouseEvent<HTMLElement>>;
@@ -2,9 +2,9 @@
2
2
  import {
3
3
  Hovercard,
4
4
  useHovercard
5
- } from "../__chunks/YGJUONJM.js";
5
+ } from "../__chunks/BONLQCKO.js";
6
6
  import "../__chunks/YMV43K4F.js";
7
- import "../__chunks/KB2HXEVC.js";
7
+ import "../__chunks/WBQC3LL4.js";
8
8
  import "../__chunks/U7WGY7YX.js";
9
9
  import "../__chunks/JSLLR7RC.js";
10
10
  import "../__chunks/CLF4PQ7T.js";
@@ -65,14 +65,12 @@ function getInitialFocus(event, dir) {
65
65
  };
66
66
  return keyMap[event.key];
67
67
  }
68
- function hasActiveItem(items, currentTarget, relatedTarget) {
68
+ function hasActiveItem(items, excludeElement) {
69
69
  return !!(items == null ? void 0 : items.some((item) => {
70
70
  if (!item.element)
71
71
  return false;
72
- if (item.element === currentTarget)
72
+ if (item.element === excludeElement)
73
73
  return false;
74
- if (item.element === relatedTarget)
75
- return true;
76
74
  return item.element.getAttribute("aria-expanded") === "true";
77
75
  }));
78
76
  }
@@ -91,6 +89,14 @@ var useMenuButton = createHook(
91
89
  const hasParentMenu = !!parentMenu;
92
90
  const parentIsMenubar = !!parentMenubar && !hasParentMenu;
93
91
  const disabled = disabledFromProps(props);
92
+ const showMenu = () => {
93
+ const trigger = ref.current;
94
+ if (!trigger)
95
+ return;
96
+ store == null ? void 0 : store.setDisclosureElement(trigger);
97
+ store == null ? void 0 : store.setAnchorElement(trigger);
98
+ store == null ? void 0 : store.show();
99
+ };
94
100
  const onFocusProp = props.onFocus;
95
101
  const onFocus = useEvent((event) => {
96
102
  onFocusProp == null ? void 0 : onFocusProp(event);
@@ -105,10 +111,8 @@ var useMenuButton = createHook(
105
111
  if (!parentIsMenubar)
106
112
  return;
107
113
  const { items } = parentMenubar.getState();
108
- if (hasActiveItem(items, event.currentTarget, event.relatedTarget)) {
109
- store == null ? void 0 : store.setDisclosureElement(event.currentTarget);
110
- store == null ? void 0 : store.setAnchorElement(event.currentTarget);
111
- store == null ? void 0 : store.show();
114
+ if (hasActiveItem(items, event.currentTarget)) {
115
+ showMenu();
112
116
  }
113
117
  });
114
118
  const dir = store.useState(
@@ -124,9 +128,7 @@ var useMenuButton = createHook(
124
128
  const initialFocus = getInitialFocus(event, dir);
125
129
  if (initialFocus) {
126
130
  event.preventDefault();
127
- store == null ? void 0 : store.setAnchorElement(event.currentTarget);
128
- store == null ? void 0 : store.setDisclosureElement(event.currentTarget);
129
- store == null ? void 0 : store.show();
131
+ showMenu();
130
132
  store == null ? void 0 : store.setAutoFocusOnShow(true);
131
133
  store == null ? void 0 : store.setInitialFocus(initialFocus);
132
134
  }
@@ -147,7 +149,7 @@ var useMenuButton = createHook(
147
149
  store.setInitialFocus(isKeyboardClick ? "first" : "container");
148
150
  }
149
151
  if (hasParentMenu) {
150
- store.show();
152
+ showMenu();
151
153
  }
152
154
  });
153
155
  props = useWrapElement(
@@ -180,16 +182,26 @@ var useMenuButton = createHook(
180
182
  accessibleWhenDisabled
181
183
  }, props), {
182
184
  showOnHover: (event) => {
183
- if (typeof showOnHover === "function")
184
- return showOnHover(event);
185
- if (showOnHover != null)
186
- return showOnHover;
187
- if (hasParentMenu)
188
- return true;
189
- if (!parentMenubar)
185
+ const getShowOnHover = () => {
186
+ if (typeof showOnHover === "function")
187
+ return showOnHover(event);
188
+ if (showOnHover != null)
189
+ return showOnHover;
190
+ if (hasParentMenu)
191
+ return true;
192
+ if (!parentMenubar)
193
+ return false;
194
+ const { items } = parentMenubar.getState();
195
+ return parentIsMenubar && hasActiveItem(items);
196
+ };
197
+ const canShowOnHover = getShowOnHover();
198
+ if (!canShowOnHover)
190
199
  return false;
191
- const { items } = parentMenubar.getState();
192
- return parentIsMenubar && hasActiveItem(items);
200
+ const parent = parentIsMenubar ? parentMenubar : parentMenu;
201
+ if (!parent)
202
+ return true;
203
+ parent.setActiveId(event.currentTarget.id);
204
+ return true;
193
205
  }
194
206
  }));
195
207
  props = usePopoverDisclosure(__spreadValues({
@@ -2,18 +2,18 @@
2
2
  import {
3
3
  useCheckbox
4
4
  } from "../__chunks/D42GAV4S.js";
5
+ import "../__chunks/VPR2WHQV.js";
5
6
  import {
6
7
  useCheckboxStore
7
8
  } from "../__chunks/BI7ZXWGY.js";
8
- import "../__chunks/VPR2WHQV.js";
9
9
  import {
10
10
  useMenuItem
11
- } from "../__chunks/W3TC4TID.js";
11
+ } from "../__chunks/JRUYDVPB.js";
12
12
  import {
13
13
  useMenuScopedContext
14
14
  } from "../__chunks/YGMEBI3A.js";
15
15
  import "../__chunks/KA4GX64Z.js";
16
- import "../__chunks/BRO2JF5P.js";
16
+ import "../__chunks/G6ONQ5EH.js";
17
17
  import "../__chunks/6XBVQI3K.js";
18
18
  import "../__chunks/5PEPOQU7.js";
19
19
  import "../__chunks/NWCBQ4CV.js";
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import {
3
3
  useMenuItem
4
- } from "../__chunks/W3TC4TID.js";
4
+ } from "../__chunks/JRUYDVPB.js";
5
5
  import {
6
6
  MenuItemCheckedContext,
7
7
  useMenuScopedContext
@@ -11,7 +11,7 @@ import {
11
11
  useRadio
12
12
  } from "../__chunks/SZD4L3WR.js";
13
13
  import "../__chunks/XEV62JUQ.js";
14
- import "../__chunks/BRO2JF5P.js";
14
+ import "../__chunks/G6ONQ5EH.js";
15
15
  import "../__chunks/5PEPOQU7.js";
16
16
  import "../__chunks/NWCBQ4CV.js";
17
17
  import "../__chunks/UH3I23HL.js";
@@ -2,10 +2,10 @@
2
2
  import {
3
3
  MenuItem,
4
4
  useMenuItem
5
- } from "../__chunks/W3TC4TID.js";
5
+ } from "../__chunks/JRUYDVPB.js";
6
6
  import "../__chunks/YGMEBI3A.js";
7
7
  import "../__chunks/KA4GX64Z.js";
8
- import "../__chunks/BRO2JF5P.js";
8
+ import "../__chunks/G6ONQ5EH.js";
9
9
  import "../__chunks/5PEPOQU7.js";
10
10
  import "../__chunks/NWCBQ4CV.js";
11
11
  import "../__chunks/UH3I23HL.js";
@@ -1,12 +1,12 @@
1
1
  "use client";
2
2
  import {
3
3
  useMenuStore
4
- } from "../__chunks/PHTJ3BCW.js";
4
+ } from "../__chunks/7HYEBVZE.js";
5
5
  import {
6
6
  MenuContextProvider
7
7
  } from "../__chunks/YGMEBI3A.js";
8
8
  import "../__chunks/KA4GX64Z.js";
9
- import "../__chunks/MTC2KUZZ.js";
9
+ import "../__chunks/W76OTZCC.js";
10
10
  import "../__chunks/ELWRSPQ7.js";
11
11
  import "../__chunks/5A2VZUUV.js";
12
12
  import "../__chunks/IB7YUKH5.js";
@@ -7,71 +7,23 @@ import type { MenubarStore } from "../menubar/menubar-store.js";
7
7
  import type { Store } from "../utils/store.js";
8
8
  type Values = Core.MenuStoreValues;
9
9
  export declare function useMenuStoreProps<T extends Core.MenuStore>(store: T, update: () => void, props: MenuStoreProps): T & {
10
- combobox: (import("../combobox/combobox-store.js").ComboboxStoreFunctions & import("@ariakit/core/combobox/combobox-store").ComboboxStoreFunctions & import("@ariakit/core/utils/store").Store<import("@ariakit/core/combobox/combobox-store").ComboboxStoreState> & {
11
- useState: {
12
- (): import("@ariakit/core/combobox/combobox-store").ComboboxStoreState;
13
- <K extends keyof import("@ariakit/core/combobox/combobox-store").ComboboxStoreState>(key: K): import("@ariakit/core/combobox/combobox-store").ComboboxStoreState[K];
14
- <V>(selector: (state: import("@ariakit/core/combobox/combobox-store").ComboboxStoreState) => V): V;
15
- };
16
- }) | null | undefined;
10
+ combobox: (ComboboxStore<string | string[]> & import("@ariakit/core/combobox/combobox-store").ComboboxStore<string | string[]>) | null | undefined;
17
11
  parent: (MenuStoreFunctions<Core.MenuStoreValues> & Core.MenuStoreFunctions<Core.MenuStoreValues> & import("@ariakit/core/utils/store").Store<Core.MenuStoreState<Core.MenuStoreValues>> & {
18
12
  useState: {
19
13
  (): Core.MenuStoreState<Core.MenuStoreValues>;
20
- <K_1 extends keyof Core.MenuStoreState<Core.MenuStoreValues>>(key: K_1): Core.MenuStoreState<Core.MenuStoreValues>[K_1];
21
- <V_1>(selector: (state: Core.MenuStoreState<Core.MenuStoreValues>) => V_1): V_1;
14
+ <K extends keyof Core.MenuStoreState<Core.MenuStoreValues>>(key: K): Core.MenuStoreState<Core.MenuStoreValues>[K];
15
+ <V>(selector: (state: Core.MenuStoreState<Core.MenuStoreValues>) => V): V;
22
16
  };
23
17
  } & Core.MenuStoreFunctions<{
24
18
  [x: string]: string | number | boolean | (string | number)[];
25
19
  }> & import("@ariakit/core/utils/store").Store<Core.MenuStoreState<{
26
20
  [x: string]: string | number | boolean | (string | number)[];
27
21
  }>>) | null | undefined;
28
- menubar: (import("../menubar/menubar-store.js").MenubarStoreFunctions & import("@ariakit/core/composite/composite-store").CompositeStoreFunctions<{
29
- id: string;
30
- element?: HTMLElement | null | undefined;
31
- } & {
32
- rowId?: string | undefined;
33
- disabled?: boolean | undefined;
34
- children?: string | undefined;
35
- }> & import("@ariakit/core/utils/store").Store<import("@ariakit/core/composite/composite-store").CompositeStoreState<{
36
- id: string;
37
- element?: HTMLElement | null | undefined;
38
- } & {
39
- rowId?: string | undefined;
40
- disabled?: boolean | undefined;
41
- children?: string | undefined;
42
- }>> & {
22
+ menubar: (import("../menubar/menubar-store.js").MenubarStoreFunctions & import("@ariakit/core/menubar/menubar-store").MenubarStore & {
43
23
  useState: {
44
- (): import("@ariakit/core/composite/composite-store").CompositeStoreState<{
45
- id: string;
46
- element?: HTMLElement | null | undefined;
47
- } & {
48
- rowId?: string | undefined;
49
- disabled?: boolean | undefined;
50
- children?: string | undefined;
51
- }>;
52
- <K_2 extends keyof import("@ariakit/core/composite/composite-store").CompositeStoreState<{
53
- id: string;
54
- element?: HTMLElement | null | undefined;
55
- } & {
56
- rowId?: string | undefined;
57
- disabled?: boolean | undefined;
58
- children?: string | undefined;
59
- }>>(key: K_2): import("@ariakit/core/composite/composite-store").CompositeStoreState<{
60
- id: string;
61
- element?: HTMLElement | null | undefined;
62
- } & {
63
- rowId?: string | undefined;
64
- disabled?: boolean | undefined;
65
- children?: string | undefined;
66
- }>[K_2];
67
- <V_2>(selector: (state: import("@ariakit/core/composite/composite-store").CompositeStoreState<{
68
- id: string;
69
- element?: HTMLElement | null | undefined;
70
- } & {
71
- rowId?: string | undefined;
72
- disabled?: boolean | undefined;
73
- children?: string | undefined;
74
- }>) => V_2): V_2;
24
+ (): import("@ariakit/core/menubar/menubar-store").MenubarStoreState;
25
+ <K_1 extends keyof import("@ariakit/core/menubar/menubar-store").MenubarStoreState>(key: K_1): import("@ariakit/core/menubar/menubar-store").MenubarStoreState[K_1];
26
+ <V_1>(selector: (state: import("@ariakit/core/menubar/menubar-store").MenubarStoreState) => V_1): V_1;
75
27
  };
76
28
  }) | null | undefined;
77
29
  };
@@ -2,10 +2,10 @@
2
2
  import {
3
3
  useMenuStore,
4
4
  useMenuStoreProps
5
- } from "../__chunks/PHTJ3BCW.js";
5
+ } from "../__chunks/7HYEBVZE.js";
6
6
  import "../__chunks/YGMEBI3A.js";
7
7
  import "../__chunks/KA4GX64Z.js";
8
- import "../__chunks/MTC2KUZZ.js";
8
+ import "../__chunks/W76OTZCC.js";
9
9
  import "../__chunks/ELWRSPQ7.js";
10
10
  import "../__chunks/5A2VZUUV.js";
11
11
  import "../__chunks/IB7YUKH5.js";
package/esm/menu/menu.js CHANGED
@@ -13,9 +13,9 @@ import "../__chunks/IB7YUKH5.js";
13
13
  import "../__chunks/4UUKJZ4V.js";
14
14
  import {
15
15
  useHovercard
16
- } from "../__chunks/YGJUONJM.js";
16
+ } from "../__chunks/BONLQCKO.js";
17
17
  import "../__chunks/YMV43K4F.js";
18
- import "../__chunks/KB2HXEVC.js";
18
+ import "../__chunks/WBQC3LL4.js";
19
19
  import {
20
20
  createDialogComponent
21
21
  } from "../__chunks/U7WGY7YX.js";
@@ -43,6 +43,9 @@ export interface PopoverOptions<T extends As = "div"> extends DialogOptions<T> {
43
43
  /**
44
44
  * Props that will be passed to the popover wrapper element. This element will
45
45
  * be used to position the popover.
46
+ *
47
+ * Live examples:
48
+ * - [Navigation Menubar](https://ariakit.org/examples/menubar-navigation)
46
49
  */
47
50
  wrapperProps?: HTMLAttributes<HTMLDivElement>;
48
51
  /**
@@ -68,6 +71,7 @@ export interface PopoverOptions<T extends As = "div"> extends DialogOptions<T> {
68
71
  * negative values to make the popover shift to the opposite side.
69
72
  *
70
73
  * Live examples:
74
+ * - [Navigation Menubar](https://ariakit.org/examples/menubar-navigation)
71
75
  * - [Submenu](https://ariakit.org/examples/menu-nested)
72
76
  * - [Menubar](https://ariakit.org/components/menubar)
73
77
  * @default 0
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  Popover,
4
4
  usePopover
5
- } from "../__chunks/KB2HXEVC.js";
5
+ } from "../__chunks/WBQC3LL4.js";
6
6
  import "../__chunks/U7WGY7YX.js";
7
7
  import "../__chunks/JSLLR7RC.js";
8
8
  import "../__chunks/CLF4PQ7T.js";
@@ -83,7 +83,8 @@ export interface PortalOptions<T extends As = "div"> extends Options<T> {
83
83
  * Determines whether the element should be rendered as a React Portal.
84
84
  *
85
85
  * Live examples:
86
- * - [ComboboxGroup](https://ariakit.org/examples/combobox-group)
86
+ * - [Combobox with integrated
87
+ * filter](https://ariakit.org/examples/combobox-filtering-integrated)
87
88
  * - [Dialog with Menu](https://ariakit.org/examples/dialog-menu)
88
89
  * - [Hovercard with keyboard
89
90
  * support](https://ariakit.org/examples/hovercard-disclosure)
@@ -97,6 +98,9 @@ export interface PortalOptions<T extends As = "div"> extends Options<T> {
97
98
  * An HTML element or a memoized callback function that returns an HTML
98
99
  * element to be used as the portal element. By default, the portal element
99
100
  * will be a `div` element appended to the `document.body`.
101
+ *
102
+ * Live examples:
103
+ * - [Navigation Menubar](https://ariakit.org/examples/menubar-navigation)
100
104
  * @example
101
105
  * ```jsx
102
106
  * const [portal, setPortal] = useState(null);
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import {
3
3
  useCompositeHover
4
- } from "../__chunks/BRO2JF5P.js";
4
+ } from "../__chunks/G6ONQ5EH.js";
5
5
  import {
6
6
  SelectItemCheckedContext,
7
7
  useSelectScopedContext
@@ -45,9 +45,9 @@ import { isDownloading, isOpeningInNewTab } from "@ariakit/core/utils/events";
45
45
  import { disabledFromProps, invariant } from "@ariakit/core/utils/misc";
46
46
  import { jsx } from "react/jsx-runtime";
47
47
  function isSelected(storeValue, itemValue) {
48
- if (storeValue == null)
49
- return false;
50
48
  if (itemValue == null)
49
+ return;
50
+ if (storeValue == null)
51
51
  return false;
52
52
  if (Array.isArray(storeValue)) {
53
53
  return storeValue.includes(itemValue);
@@ -127,7 +127,7 @@ var useSelectItem = createHook(
127
127
  const selected = store.useState((state) => isSelected(state.value, value));
128
128
  props = useWrapElement(
129
129
  props,
130
- (element) => /* @__PURE__ */ jsx(SelectItemCheckedContext.Provider, { value: selected, children: element }),
130
+ (element) => /* @__PURE__ */ jsx(SelectItemCheckedContext.Provider, { value: selected != null ? selected : false, children: element }),
131
131
  [selected]
132
132
  );
133
133
  const contentElement = store.useState("contentElement");
@@ -1,6 +1,6 @@
1
1
  "use client";
2
2
  import {
3
- useSelectScopedContext
3
+ useSelectProviderContext
4
4
  } from "../__chunks/5HVNGX6D.js";
5
5
  import "../__chunks/IB7YUKH5.js";
6
6
  import "../__chunks/4UUKJZ4V.js";
@@ -29,7 +29,7 @@ import { invariant } from "@ariakit/core/utils/misc";
29
29
  var useSelectLabel = createHook(
30
30
  (_a) => {
31
31
  var _b = _a, { store } = _b, props = __objRest(_b, ["store"]);
32
- const context = useSelectScopedContext();
32
+ const context = useSelectProviderContext();
33
33
  store = store || context;
34
34
  invariant(
35
35
  store,
@@ -12,7 +12,7 @@ import "../__chunks/IB7YUKH5.js";
12
12
  import "../__chunks/4UUKJZ4V.js";
13
13
  import {
14
14
  usePopover
15
- } from "../__chunks/KB2HXEVC.js";
15
+ } from "../__chunks/WBQC3LL4.js";
16
16
  import {
17
17
  createDialogComponent
18
18
  } from "../__chunks/U7WGY7YX.js";
@@ -1,8 +1,8 @@
1
1
  "use client";
2
2
  import {
3
3
  useSelectStore
4
- } from "../__chunks/NE6JAKK6.js";
5
- import "../__chunks/MTC2KUZZ.js";
4
+ } from "../__chunks/P3UZS6BC.js";
5
+ import "../__chunks/W76OTZCC.js";
6
6
  import {
7
7
  SelectContextProvider
8
8
  } from "../__chunks/5HVNGX6D.js";
@@ -7,13 +7,7 @@ import type { Store } from "../utils/store.js";
7
7
  type Item = Core.SelectStoreItem;
8
8
  type Value = Core.SelectStoreValue;
9
9
  export declare function useSelectStoreProps<T extends Core.SelectStore>(store: T, update: () => void, props: SelectStoreProps): T & {
10
- combobox: (import("../combobox/combobox-store.js").ComboboxStoreFunctions & import("@ariakit/core/combobox/combobox-store").ComboboxStoreFunctions & import("@ariakit/core/utils/store").Store<import("@ariakit/core/combobox/combobox-store").ComboboxStoreState> & {
11
- useState: {
12
- (): import("@ariakit/core/combobox/combobox-store").ComboboxStoreState;
13
- <K extends keyof import("@ariakit/core/combobox/combobox-store").ComboboxStoreState>(key: K): import("@ariakit/core/combobox/combobox-store").ComboboxStoreState[K];
14
- <V>(selector: (state: import("@ariakit/core/combobox/combobox-store").ComboboxStoreState) => V): V;
15
- };
16
- }) | null | undefined;
10
+ combobox: (ComboboxStore<string | string[]> & import("@ariakit/core/combobox/combobox-store").ComboboxStore<string | string[]>) | null | undefined;
17
11
  };
18
12
  /**
19
13
  * Creates a select store.
@@ -2,8 +2,8 @@
2
2
  import {
3
3
  useSelectStore,
4
4
  useSelectStoreProps
5
- } from "../__chunks/NE6JAKK6.js";
6
- import "../__chunks/MTC2KUZZ.js";
5
+ } from "../__chunks/P3UZS6BC.js";
6
+ import "../__chunks/W76OTZCC.js";
7
7
  import "../__chunks/ELWRSPQ7.js";
8
8
  import "../__chunks/5A2VZUUV.js";
9
9
  import "../__chunks/IB7YUKH5.js";