@ariakit/react-core 0.3.6 → 0.3.7

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 (61) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/cjs/__chunks/{45RPYV4J.cjs → EQ4A5RPW.cjs} +2 -2
  3. package/cjs/__chunks/{RRW7YVFR.cjs → IPYAEPOT.cjs} +17 -6
  4. package/cjs/__chunks/{4GLXDOKG.cjs → YAPOM5RT.cjs} +2 -2
  5. package/cjs/combobox/combobox-item.cjs +2 -2
  6. package/cjs/combobox/combobox-popover.cjs +2 -2
  7. package/cjs/combobox/combobox-store.d.cts +2 -1
  8. package/cjs/combobox/combobox-store.d.ts +2 -1
  9. package/cjs/combobox/combobox.cjs +6 -2
  10. package/cjs/combobox/combobox.d.cts +2 -1
  11. package/cjs/combobox/combobox.d.ts +2 -1
  12. package/cjs/composite/composite-hover.cjs +2 -2
  13. package/cjs/composite/composite-hover.d.cts +6 -0
  14. package/cjs/composite/composite-hover.d.ts +6 -0
  15. package/cjs/composite/composite-overflow.cjs +2 -2
  16. package/cjs/disclosure/disclosure-content.d.cts +2 -1
  17. package/cjs/disclosure/disclosure-content.d.ts +2 -1
  18. package/cjs/focusable/focusable.d.cts +1 -1
  19. package/cjs/focusable/focusable.d.ts +1 -1
  20. package/cjs/hovercard/hovercard.cjs +3 -3
  21. package/cjs/menu/menu-button.cjs +33 -21
  22. package/cjs/menu/menu-item-checkbox.cjs +3 -3
  23. package/cjs/menu/menu-item-radio.cjs +3 -3
  24. package/cjs/menu/menu-item.cjs +3 -3
  25. package/cjs/menu/menu-store.d.cts +4 -46
  26. package/cjs/menu/menu-store.d.ts +4 -46
  27. package/cjs/menu/menu.cjs +3 -3
  28. package/cjs/popover/popover.cjs +2 -2
  29. package/cjs/portal/portal.d.cts +2 -1
  30. package/cjs/portal/portal.d.ts +2 -1
  31. package/cjs/select/select-item.cjs +2 -2
  32. package/cjs/select/select-popover.cjs +2 -2
  33. package/cjs/tooltip/tooltip.cjs +3 -3
  34. package/esm/__chunks/{YGJUONJM.js → BONLQCKO.js} +1 -1
  35. package/esm/__chunks/{BRO2JF5P.js → G6ONQ5EH.js} +20 -9
  36. package/esm/__chunks/{W3TC4TID.js → JRUYDVPB.js} +1 -1
  37. package/esm/combobox/combobox-item.js +1 -1
  38. package/esm/combobox/combobox-popover.js +1 -1
  39. package/esm/combobox/combobox-store.d.ts +2 -1
  40. package/esm/combobox/combobox.d.ts +2 -1
  41. package/esm/combobox/combobox.js +7 -3
  42. package/esm/composite/composite-hover.d.ts +6 -0
  43. package/esm/composite/composite-hover.js +1 -1
  44. package/esm/composite/composite-overflow.js +1 -1
  45. package/esm/disclosure/disclosure-content.d.ts +2 -1
  46. package/esm/focusable/focusable.d.ts +1 -1
  47. package/esm/hovercard/hovercard.js +2 -2
  48. package/esm/menu/menu-button.js +33 -21
  49. package/esm/menu/menu-item-checkbox.js +2 -2
  50. package/esm/menu/menu-item-radio.js +2 -2
  51. package/esm/menu/menu-item.js +2 -2
  52. package/esm/menu/menu-store.d.ts +4 -46
  53. package/esm/menu/menu.js +2 -2
  54. package/esm/popover/popover.js +1 -1
  55. package/esm/portal/portal.d.ts +2 -1
  56. package/esm/select/select-item.js +1 -1
  57. package/esm/select/select-popover.js +1 -1
  58. package/esm/tooltip/tooltip.js +2 -2
  59. package/package.json +2 -2
  60. package/cjs/__chunks/{ISGOCBDC.cjs → RIZYIKBE.cjs} +1 -1
  61. package/esm/__chunks/{KB2HXEVC.js → WBQC3LL4.js} +1 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,22 @@
1
1
  # @ariakit/react-core
2
2
 
3
+ ## 0.3.7
4
+
5
+ ### Expanding Menubar
6
+
7
+ The [Menubar](https://ariakit.org/components/menubar) component will now only expand if there's another menu already expanded in the same menubar.
8
+
9
+ ### Internal data attribute changes
10
+
11
+ Just like the change in v0.3.6 that removed the `data-command` and `data-disclosure` attributes from elements, this update stops the `data-composite-hover` attribute from infiltrating composite item elements in the DOM. We're mentioning this in the changelog as some users might have snapshot tests that require updating.
12
+
13
+ ### Other updates
14
+
15
+ - Fixed `setSelectionRange` error when used with [unsupported](https://html.spec.whatwg.org/multipage/input.html#concept-input-apply) input types.
16
+ - Fixed [`MenuButton`](https://ariakit.org/reference/menu-button) with [`showOnHover`](https://ariakit.org/reference/menu-button#showonhover) not updating the `activeId` state when hovered.
17
+ - Updated [`onFocusVisible`](https://ariakit.org/reference/focusable#onfocusvisible) element type on [`Focusable`](https://ariakit.org/reference/focusable) from `Element` to `HTMLElement`.
18
+ - Updated dependencies: `@ariakit/core@0.3.6`
19
+
3
20
  ## 0.3.6
4
21
 
5
22
  ### Data attributes for duplicate components
@@ -6,7 +6,7 @@
6
6
  var _KXQOQQ5Bcjs = require('./KXQOQQ5B.cjs');
7
7
 
8
8
 
9
- var _ISGOCBDCcjs = require('./ISGOCBDC.cjs');
9
+ var _RIZYIKBEcjs = require('./RIZYIKBE.cjs');
10
10
 
11
11
 
12
12
  var _XFPRAS3Jcjs = require('./XFPRAS3J.cjs');
@@ -283,7 +283,7 @@ var useHovercard = _RNZNGEL4cjs.createHook.call(void 0,
283
283
  const autoFocusOnShow = store.useState(
284
284
  (state) => modal || state.autoFocusOnShow
285
285
  );
286
- props = _ISGOCBDCcjs.usePopover.call(void 0, _AV6KTKLEcjs.__spreadProps.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, {
286
+ props = _RIZYIKBEcjs.usePopover.call(void 0, _AV6KTKLEcjs.__spreadProps.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, {
287
287
  store,
288
288
  modal,
289
289
  portal,
@@ -11,6 +11,7 @@ var _RNZNGEL4cjs = require('./RNZNGEL4.cjs');
11
11
 
12
12
 
13
13
 
14
+
14
15
  var _EO6LS72Hcjs = require('./EO6LS72H.cjs');
15
16
 
16
17
 
@@ -19,6 +20,7 @@ var _EO6LS72Hcjs = require('./EO6LS72H.cjs');
19
20
  var _AV6KTKLEcjs = require('./AV6KTKLE.cjs');
20
21
 
21
22
  // src/composite/composite-hover.ts
23
+ var _react = require('react');
22
24
  var _dom = require('@ariakit/core/utils/dom');
23
25
  var _focus = require('@ariakit/core/utils/focus');
24
26
  var _misc = require('@ariakit/core/utils/misc');
@@ -35,12 +37,17 @@ function hoveringInside(event) {
35
37
  return false;
36
38
  return _dom.contains.call(void 0, event.currentTarget, nextElement);
37
39
  }
40
+ var symbol = Symbol("composite-hover");
38
41
  function movingToAnotherItem(event) {
39
- const dest = getMouseDestination(event);
42
+ let dest = getMouseDestination(event);
40
43
  if (!dest)
41
44
  return false;
42
- const item = _dom.closest.call(void 0, dest, "[data-composite-hover]");
43
- return !!item;
45
+ do {
46
+ if (_misc.hasOwnProperty.call(void 0, dest, symbol) && dest[symbol])
47
+ return true;
48
+ dest = dest.parentElement;
49
+ } while (dest);
50
+ return false;
44
51
  }
45
52
  var useCompositeHover = _RNZNGEL4cjs.createHook.call(void 0,
46
53
  (_a) => {
@@ -98,9 +105,13 @@ var useCompositeHover = _RNZNGEL4cjs.createHook.call(void 0,
98
105
  store == null ? void 0 : store.setActiveId(null);
99
106
  (_a2 = store == null ? void 0 : store.getState().baseElement) == null ? void 0 : _a2.focus();
100
107
  });
101
- props = _AV6KTKLEcjs.__spreadProps.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, {
102
- "data-composite-hover": ""
103
- }, props), {
108
+ const ref = _react.useCallback.call(void 0, (element) => {
109
+ if (!element)
110
+ return;
111
+ element[symbol] = true;
112
+ }, []);
113
+ props = _AV6KTKLEcjs.__spreadProps.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, {}, props), {
114
+ ref: _EO6LS72Hcjs.useMergeRefs.call(void 0, ref, props.ref),
104
115
  onMouseMove,
105
116
  onMouseLeave
106
117
  });
@@ -7,7 +7,7 @@ var _NGEKJJDHcjs = require('./NGEKJJDH.cjs');
7
7
  var _7LBZXSLYcjs = require('./7LBZXSLY.cjs');
8
8
 
9
9
 
10
- var _RRW7YVFRcjs = require('./RRW7YVFR.cjs');
10
+ var _IPYAEPOTcjs = require('./IPYAEPOT.cjs');
11
11
 
12
12
 
13
13
  var _P43G7USHcjs = require('./P43G7USH.cjs');
@@ -109,7 +109,7 @@ var useMenuItem = _RNZNGEL4cjs.createHook.call(void 0,
109
109
  onClick
110
110
  });
111
111
  props = _P43G7USHcjs.useCompositeItem.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, { store, preventScrollOnKeyDown }, props));
112
- props = _RRW7YVFRcjs.useCompositeHover.call(void 0, _AV6KTKLEcjs.__spreadProps.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, {
112
+ props = _IPYAEPOTcjs.useCompositeHover.call(void 0, _AV6KTKLEcjs.__spreadProps.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, {
113
113
  store
114
114
  }, props), {
115
115
  focusOnHover: (event) => {
@@ -1,7 +1,7 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";
2
2
 
3
3
 
4
- var _RRW7YVFRcjs = require('../__chunks/RRW7YVFR.cjs');
4
+ var _IPYAEPOTcjs = require('../__chunks/IPYAEPOT.cjs');
5
5
 
6
6
 
7
7
 
@@ -146,7 +146,7 @@ var useComboboxItem = _RNZNGEL4cjs.createHook.call(void 0,
146
146
  return true;
147
147
  }
148
148
  }));
149
- props = _RRW7YVFRcjs.useCompositeHover.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, { store, focusOnHover }, props));
149
+ props = _IPYAEPOTcjs.useCompositeHover.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, { store, focusOnHover }, props));
150
150
  return props;
151
151
  }
152
152
  );
@@ -9,7 +9,7 @@ require('../__chunks/UZNYSPKP.cjs');
9
9
  require('../__chunks/BZTDJIVT.cjs');
10
10
 
11
11
 
12
- var _ISGOCBDCcjs = require('../__chunks/ISGOCBDC.cjs');
12
+ var _RIZYIKBEcjs = require('../__chunks/RIZYIKBE.cjs');
13
13
 
14
14
 
15
15
  var _XFPRAS3Jcjs = require('../__chunks/XFPRAS3J.cjs');
@@ -92,7 +92,7 @@ var useComboboxPopover = _RNZNGEL4cjs.createHook.call(void 0,
92
92
  );
93
93
  const baseElement = store.useState("baseElement");
94
94
  props = _QU2266CJcjs.useComboboxList.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, { store, alwaysVisible }, props));
95
- props = _ISGOCBDCcjs.usePopover.call(void 0, _AV6KTKLEcjs.__spreadProps.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, {
95
+ props = _RIZYIKBEcjs.usePopover.call(void 0, _AV6KTKLEcjs.__spreadProps.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, {
96
96
  store,
97
97
  alwaysVisible,
98
98
  autoFocusOnShow: false,
@@ -28,7 +28,8 @@ export interface ComboboxStoreOptions extends Core.ComboboxStoreOptions, Composi
28
28
  * A callback that gets called when the `value` state changes.
29
29
  *
30
30
  * Live examples:
31
- * - [Combobox filtering](https://ariakit.org/examples/combobox-filtering)
31
+ * - [Combobox with integrated
32
+ * filter](https://ariakit.org/examples/combobox-filtering-integrated)
32
33
  * - [ComboboxGroup](https://ariakit.org/examples/combobox-group)
33
34
  * - [Combobox with links](https://ariakit.org/examples/combobox-links)
34
35
  * - [Multi-selectable
@@ -28,7 +28,8 @@ export interface ComboboxStoreOptions extends Core.ComboboxStoreOptions, Composi
28
28
  * A callback that gets called when the `value` state changes.
29
29
  *
30
30
  * Live examples:
31
- * - [Combobox filtering](https://ariakit.org/examples/combobox-filtering)
31
+ * - [Combobox with integrated
32
+ * filter](https://ariakit.org/examples/combobox-filtering-integrated)
32
33
  * - [ComboboxGroup](https://ariakit.org/examples/combobox-group)
33
34
  * - [Combobox with links](https://ariakit.org/examples/combobox-links)
34
35
  * - [Multi-selectable
@@ -40,6 +40,10 @@ var _AV6KTKLEcjs = require('../__chunks/AV6KTKLE.cjs');
40
40
 
41
41
  // src/combobox/combobox.ts
42
42
  var _react = require('react');
43
+
44
+
45
+
46
+
43
47
  var _dom = require('@ariakit/core/utils/dom');
44
48
 
45
49
 
@@ -173,7 +177,7 @@ var useCombobox = _RNZNGEL4cjs.createHook.call(void 0,
173
177
  const element = ref.current;
174
178
  if (!element)
175
179
  return;
176
- element.setSelectionRange(storeValue.length, activeValue.length);
180
+ _dom.setSelectionRange.call(void 0, element, storeValue.length, activeValue.length);
177
181
  });
178
182
  }, [
179
183
  valueUpdated,
@@ -296,7 +300,7 @@ var useCombobox = _RNZNGEL4cjs.createHook.call(void 0,
296
300
  if (setValueOnChangeProp(event)) {
297
301
  const isSameValue = value2 === store.getState().value;
298
302
  _reactdom.flushSync.call(void 0, () => store == null ? void 0 : store.setValue(value2));
299
- event.currentTarget.setSelectionRange(selectionStart, selectionEnd);
303
+ _dom.setSelectionRange.call(void 0, event.currentTarget, selectionStart, selectionEnd);
300
304
  if (inline && autoSelect && isSameValue) {
301
305
  forceValueUpdate();
302
306
  }
@@ -59,7 +59,8 @@ export interface ComboboxOptions<T extends As = "input"> extends CompositeOption
59
59
  * popup opens, but the input value doesn't change.
60
60
  *
61
61
  * Live examples:
62
- * - [ComboboxCancel](https://ariakit.org/examples/combobox-cancel)
62
+ * - [Combobox with integrated
63
+ * filter](https://ariakit.org/examples/combobox-filtering-integrated)
63
64
  * - [ComboboxGroup](https://ariakit.org/examples/combobox-group)
64
65
  * - [Combobox with links](https://ariakit.org/examples/combobox-links)
65
66
  * - [Textarea with inline
@@ -59,7 +59,8 @@ export interface ComboboxOptions<T extends As = "input"> extends CompositeOption
59
59
  * popup opens, but the input value doesn't change.
60
60
  *
61
61
  * Live examples:
62
- * - [ComboboxCancel](https://ariakit.org/examples/combobox-cancel)
62
+ * - [Combobox with integrated
63
+ * filter](https://ariakit.org/examples/combobox-filtering-integrated)
63
64
  * - [ComboboxGroup](https://ariakit.org/examples/combobox-group)
64
65
  * - [Combobox with links](https://ariakit.org/examples/combobox-links)
65
66
  * - [Textarea with inline
@@ -2,7 +2,7 @@
2
2
 
3
3
 
4
4
 
5
- var _RRW7YVFRcjs = require('../__chunks/RRW7YVFR.cjs');
5
+ var _IPYAEPOTcjs = require('../__chunks/IPYAEPOT.cjs');
6
6
  require('../__chunks/UZNYSPKP.cjs');
7
7
  require('../__chunks/BZTDJIVT.cjs');
8
8
  require('../__chunks/RNZNGEL4.cjs');
@@ -12,4 +12,4 @@ require('../__chunks/AV6KTKLE.cjs');
12
12
 
13
13
 
14
14
 
15
- exports.CompositeHover = _RRW7YVFRcjs.CompositeHover; exports.useCompositeHover = _RRW7YVFRcjs.useCompositeHover;
15
+ exports.CompositeHover = _IPYAEPOTcjs.CompositeHover; exports.useCompositeHover = _IPYAEPOTcjs.useCompositeHover;
@@ -46,6 +46,8 @@ 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
+ * - [Combobox with integrated
50
+ * filter](https://ariakit.org/examples/combobox-filtering-integrated)
49
51
  * - [Textarea with inline
50
52
  * Combobox](https://ariakit.org/examples/combobox-textarea)
51
53
  * @default true
@@ -56,6 +58,10 @@ export interface CompositeHoverOptions<T extends As = "div"> extends Options<T>
56
58
  * By default, this is set to `true` if
57
59
  * [`focusOnHover`](https://ariakit.org/reference/composite-hover#focusonhover)
58
60
  * is `true`.
61
+ *
62
+ * Live examples:
63
+ * - [Combobox with integrated
64
+ * filter](https://ariakit.org/examples/combobox-filtering-integrated)
59
65
  */
60
66
  blurOnHoverEnd?: BooleanOrCallback<ReactMouseEvent<HTMLElement>>;
61
67
  }
@@ -46,6 +46,8 @@ 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
+ * - [Combobox with integrated
50
+ * filter](https://ariakit.org/examples/combobox-filtering-integrated)
49
51
  * - [Textarea with inline
50
52
  * Combobox](https://ariakit.org/examples/combobox-textarea)
51
53
  * @default true
@@ -56,6 +58,10 @@ export interface CompositeHoverOptions<T extends As = "div"> extends Options<T>
56
58
  * By default, this is set to `true` if
57
59
  * [`focusOnHover`](https://ariakit.org/reference/composite-hover#focusonhover)
58
60
  * is `true`.
61
+ *
62
+ * Live examples:
63
+ * - [Combobox with integrated
64
+ * filter](https://ariakit.org/examples/combobox-filtering-integrated)
59
65
  */
60
66
  blurOnHoverEnd?: BooleanOrCallback<ReactMouseEvent<HTMLElement>>;
61
67
  }
@@ -1,7 +1,7 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";
2
2
 
3
3
 
4
- var _ISGOCBDCcjs = require('../__chunks/ISGOCBDC.cjs');
4
+ var _RIZYIKBEcjs = require('../__chunks/RIZYIKBE.cjs');
5
5
  require('../__chunks/XFPRAS3J.cjs');
6
6
  require('../__chunks/SHOS7XOU.cjs');
7
7
  require('../__chunks/NKR65BKC.cjs');
@@ -91,7 +91,7 @@ var useCompositeOverflow = _RNZNGEL4cjs.createHook.call(void 0,
91
91
  }, props), {
92
92
  onFocus
93
93
  });
94
- props = _ISGOCBDCcjs.usePopover.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, {
94
+ props = _RIZYIKBEcjs.usePopover.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, {
95
95
  store,
96
96
  backdropProps,
97
97
  wrapperProps,
@@ -61,7 +61,8 @@ 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
+ * - [Combobox with integrated
65
+ * filter](https://ariakit.org/examples/combobox-filtering-integrated)
65
66
  * - [Textarea with inline
66
67
  * Combobox](https://ariakit.org/examples/combobox-textarea)
67
68
  * - [Standalone Popover](https://ariakit.org/examples/popover-standalone)
@@ -61,7 +61,8 @@ 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
+ * - [Combobox with integrated
65
+ * filter](https://ariakit.org/examples/combobox-filtering-integrated)
65
66
  * - [Textarea with inline
66
67
  * Combobox](https://ariakit.org/examples/combobox-textarea)
67
68
  * - [Standalone Popover](https://ariakit.org/examples/popover-standalone)
@@ -108,6 +108,6 @@ export interface FocusableOptions<T extends As = "div"> extends Options<T> {
108
108
  * Live examples:
109
109
  * - [Custom Checkbox](https://ariakit.org/examples/checkbox-custom)
110
110
  */
111
- onFocusVisible?: BivariantCallback<(event: SyntheticEvent) => void>;
111
+ onFocusVisible?: BivariantCallback<(event: SyntheticEvent<HTMLElement>) => void>;
112
112
  }
113
113
  export type FocusableProps<T extends As = "div"> = Props<FocusableOptions<T>>;
@@ -108,6 +108,6 @@ export interface FocusableOptions<T extends As = "div"> extends Options<T> {
108
108
  * Live examples:
109
109
  * - [Custom Checkbox](https://ariakit.org/examples/checkbox-custom)
110
110
  */
111
- onFocusVisible?: BivariantCallback<(event: SyntheticEvent) => void>;
111
+ onFocusVisible?: BivariantCallback<(event: SyntheticEvent<HTMLElement>) => void>;
112
112
  }
113
113
  export type FocusableProps<T extends As = "div"> = Props<FocusableOptions<T>>;
@@ -2,9 +2,9 @@
2
2
 
3
3
 
4
4
 
5
- var _45RPYV4Jcjs = require('../__chunks/45RPYV4J.cjs');
5
+ var _EQ4A5RPWcjs = require('../__chunks/EQ4A5RPW.cjs');
6
6
  require('../__chunks/KXQOQQ5B.cjs');
7
- require('../__chunks/ISGOCBDC.cjs');
7
+ require('../__chunks/RIZYIKBE.cjs');
8
8
  require('../__chunks/XFPRAS3J.cjs');
9
9
  require('../__chunks/SHOS7XOU.cjs');
10
10
  require('../__chunks/NKR65BKC.cjs');
@@ -45,4 +45,4 @@ require('../__chunks/AV6KTKLE.cjs');
45
45
 
46
46
 
47
47
 
48
- exports.Hovercard = _45RPYV4Jcjs.Hovercard; exports.useHovercard = _45RPYV4Jcjs.useHovercard;
48
+ exports.Hovercard = _EQ4A5RPWcjs.Hovercard; exports.useHovercard = _EQ4A5RPWcjs.useHovercard;
@@ -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 = _RNZNGEL4cjs.createHook.call(void 0,
91
89
  const hasParentMenu = !!parentMenu;
92
90
  const parentIsMenubar = !!parentMenubar && !hasParentMenu;
93
91
  const disabled = _misc.disabledFromProps.call(void 0, 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 = _EO6LS72Hcjs.useEvent.call(void 0, (event) => {
96
102
  onFocusProp == null ? void 0 : onFocusProp(event);
@@ -105,10 +111,8 @@ var useMenuButton = _RNZNGEL4cjs.createHook.call(void 0,
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 = _RNZNGEL4cjs.createHook.call(void 0,
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 = _RNZNGEL4cjs.createHook.call(void 0,
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 = _EO6LS72Hcjs.useWrapElement.call(void 0,
@@ -180,16 +182,26 @@ var useMenuButton = _RNZNGEL4cjs.createHook.call(void 0,
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 = _LICANQTIcjs.usePopoverDisclosure.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, {
@@ -8,12 +8,12 @@ var _5GQV7KPQcjs = require('../__chunks/5GQV7KPQ.cjs');
8
8
  require('../__chunks/63UPRTFZ.cjs');
9
9
 
10
10
 
11
- var _4GLXDOKGcjs = require('../__chunks/4GLXDOKG.cjs');
11
+ var _YAPOM5RTcjs = require('../__chunks/YAPOM5RT.cjs');
12
12
 
13
13
 
14
14
  var _NGEKJJDHcjs = require('../__chunks/NGEKJJDH.cjs');
15
15
  require('../__chunks/7LBZXSLY.cjs');
16
- require('../__chunks/RRW7YVFR.cjs');
16
+ require('../__chunks/IPYAEPOT.cjs');
17
17
  require('../__chunks/ERFHNHON.cjs');
18
18
  require('../__chunks/P43G7USH.cjs');
19
19
  require('../__chunks/DAJUUBUI.cjs');
@@ -136,7 +136,7 @@ var useMenuItemCheckbox = _RNZNGEL4cjs.createHook.call(void 0,
136
136
  value,
137
137
  checked
138
138
  }, props));
139
- props = _4GLXDOKGcjs.useMenuItem.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, { store, hideOnClick }, props));
139
+ props = _YAPOM5RTcjs.useMenuItem.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, { store, hideOnClick }, props));
140
140
  return props;
141
141
  }
142
142
  );
@@ -1,7 +1,7 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";
2
2
 
3
3
 
4
- var _4GLXDOKGcjs = require('../__chunks/4GLXDOKG.cjs');
4
+ var _YAPOM5RTcjs = require('../__chunks/YAPOM5RT.cjs');
5
5
 
6
6
 
7
7
 
@@ -11,7 +11,7 @@ require('../__chunks/7LBZXSLY.cjs');
11
11
 
12
12
  var _HGT5CLDMcjs = require('../__chunks/HGT5CLDM.cjs');
13
13
  require('../__chunks/HEEQY4DZ.cjs');
14
- require('../__chunks/RRW7YVFR.cjs');
14
+ require('../__chunks/IPYAEPOT.cjs');
15
15
  require('../__chunks/P43G7USH.cjs');
16
16
  require('../__chunks/DAJUUBUI.cjs');
17
17
  require('../__chunks/R5A2WTWB.cjs');
@@ -110,7 +110,7 @@ var useMenuItemRadio = _RNZNGEL4cjs.createHook.call(void 0,
110
110
  });
111
111
  }
112
112
  }, props));
113
- props = _4GLXDOKGcjs.useMenuItem.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, { store, hideOnClick }, props));
113
+ props = _YAPOM5RTcjs.useMenuItem.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, { store, hideOnClick }, props));
114
114
  return props;
115
115
  }
116
116
  );
@@ -2,10 +2,10 @@
2
2
 
3
3
 
4
4
 
5
- var _4GLXDOKGcjs = require('../__chunks/4GLXDOKG.cjs');
5
+ var _YAPOM5RTcjs = require('../__chunks/YAPOM5RT.cjs');
6
6
  require('../__chunks/NGEKJJDH.cjs');
7
7
  require('../__chunks/7LBZXSLY.cjs');
8
- require('../__chunks/RRW7YVFR.cjs');
8
+ require('../__chunks/IPYAEPOT.cjs');
9
9
  require('../__chunks/P43G7USH.cjs');
10
10
  require('../__chunks/DAJUUBUI.cjs');
11
11
  require('../__chunks/R5A2WTWB.cjs');
@@ -26,4 +26,4 @@ require('../__chunks/AV6KTKLE.cjs');
26
26
 
27
27
 
28
28
 
29
- exports.MenuItem = _4GLXDOKGcjs.MenuItem; exports.useMenuItem = _4GLXDOKGcjs.useMenuItem;
29
+ exports.MenuItem = _YAPOM5RTcjs.MenuItem; exports.useMenuItem = _YAPOM5RTcjs.useMenuItem;
@@ -25,53 +25,11 @@ export declare function useMenuStoreProps<T extends Core.MenuStore>(store: T, up
25
25
  }> & import("@ariakit/core/utils/store").Store<Core.MenuStoreState<{
26
26
  [x: string]: string | number | boolean | (string | number)[];
27
27
  }>>) | 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
- }>> & {
28
+ menubar: (import("../menubar/menubar-store.js").MenubarStoreFunctions & import("@ariakit/core/menubar/menubar-store").MenubarStore & {
43
29
  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;
30
+ (): import("@ariakit/core/menubar/menubar-store").MenubarStoreState;
31
+ <K_2 extends keyof import("@ariakit/core/menubar/menubar-store").MenubarStoreState>(key: K_2): import("@ariakit/core/menubar/menubar-store").MenubarStoreState[K_2];
32
+ <V_2>(selector: (state: import("@ariakit/core/menubar/menubar-store").MenubarStoreState) => V_2): V_2;
75
33
  };
76
34
  }) | null | undefined;
77
35
  };