@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.
- package/CHANGELOG.md +17 -0
- package/cjs/__chunks/{45RPYV4J.cjs → EQ4A5RPW.cjs} +2 -2
- package/cjs/__chunks/{RRW7YVFR.cjs → IPYAEPOT.cjs} +17 -6
- package/cjs/__chunks/{4GLXDOKG.cjs → YAPOM5RT.cjs} +2 -2
- package/cjs/combobox/combobox-item.cjs +2 -2
- package/cjs/combobox/combobox-popover.cjs +2 -2
- package/cjs/combobox/combobox-store.d.cts +2 -1
- package/cjs/combobox/combobox-store.d.ts +2 -1
- package/cjs/combobox/combobox.cjs +6 -2
- package/cjs/combobox/combobox.d.cts +2 -1
- package/cjs/combobox/combobox.d.ts +2 -1
- package/cjs/composite/composite-hover.cjs +2 -2
- package/cjs/composite/composite-hover.d.cts +6 -0
- package/cjs/composite/composite-hover.d.ts +6 -0
- package/cjs/composite/composite-overflow.cjs +2 -2
- package/cjs/disclosure/disclosure-content.d.cts +2 -1
- package/cjs/disclosure/disclosure-content.d.ts +2 -1
- package/cjs/focusable/focusable.d.cts +1 -1
- package/cjs/focusable/focusable.d.ts +1 -1
- package/cjs/hovercard/hovercard.cjs +3 -3
- package/cjs/menu/menu-button.cjs +33 -21
- package/cjs/menu/menu-item-checkbox.cjs +3 -3
- package/cjs/menu/menu-item-radio.cjs +3 -3
- package/cjs/menu/menu-item.cjs +3 -3
- package/cjs/menu/menu-store.d.cts +4 -46
- package/cjs/menu/menu-store.d.ts +4 -46
- package/cjs/menu/menu.cjs +3 -3
- package/cjs/popover/popover.cjs +2 -2
- package/cjs/portal/portal.d.cts +2 -1
- package/cjs/portal/portal.d.ts +2 -1
- package/cjs/select/select-item.cjs +2 -2
- package/cjs/select/select-popover.cjs +2 -2
- package/cjs/tooltip/tooltip.cjs +3 -3
- package/esm/__chunks/{YGJUONJM.js → BONLQCKO.js} +1 -1
- package/esm/__chunks/{BRO2JF5P.js → G6ONQ5EH.js} +20 -9
- package/esm/__chunks/{W3TC4TID.js → JRUYDVPB.js} +1 -1
- package/esm/combobox/combobox-item.js +1 -1
- package/esm/combobox/combobox-popover.js +1 -1
- package/esm/combobox/combobox-store.d.ts +2 -1
- package/esm/combobox/combobox.d.ts +2 -1
- package/esm/combobox/combobox.js +7 -3
- package/esm/composite/composite-hover.d.ts +6 -0
- package/esm/composite/composite-hover.js +1 -1
- package/esm/composite/composite-overflow.js +1 -1
- package/esm/disclosure/disclosure-content.d.ts +2 -1
- package/esm/focusable/focusable.d.ts +1 -1
- package/esm/hovercard/hovercard.js +2 -2
- package/esm/menu/menu-button.js +33 -21
- package/esm/menu/menu-item-checkbox.js +2 -2
- package/esm/menu/menu-item-radio.js +2 -2
- package/esm/menu/menu-item.js +2 -2
- package/esm/menu/menu-store.d.ts +4 -46
- package/esm/menu/menu.js +2 -2
- package/esm/popover/popover.js +1 -1
- package/esm/portal/portal.d.ts +2 -1
- package/esm/select/select-item.js +1 -1
- package/esm/select/select-popover.js +1 -1
- package/esm/tooltip/tooltip.js +2 -2
- package/package.json +2 -2
- package/cjs/__chunks/{ISGOCBDC.cjs → RIZYIKBE.cjs} +1 -1
- package/esm/__chunks/{KB2HXEVC.js → WBQC3LL4.js} +1 -1
package/cjs/menu/menu-store.d.ts
CHANGED
|
@@ -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/
|
|
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/
|
|
45
|
-
|
|
46
|
-
|
|
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
|
};
|
package/cjs/menu/menu.cjs
CHANGED
|
@@ -13,9 +13,9 @@ require('../__chunks/UZNYSPKP.cjs');
|
|
|
13
13
|
require('../__chunks/BZTDJIVT.cjs');
|
|
14
14
|
|
|
15
15
|
|
|
16
|
-
var
|
|
16
|
+
var _EQ4A5RPWcjs = require('../__chunks/EQ4A5RPW.cjs');
|
|
17
17
|
require('../__chunks/KXQOQQ5B.cjs');
|
|
18
|
-
require('../__chunks/
|
|
18
|
+
require('../__chunks/RIZYIKBE.cjs');
|
|
19
19
|
|
|
20
20
|
|
|
21
21
|
var _XFPRAS3Jcjs = require('../__chunks/XFPRAS3J.cjs');
|
|
@@ -144,7 +144,7 @@ var useMenu = _RNZNGEL4cjs.createHook.call(void 0,
|
|
|
144
144
|
const modal = hasParentMenu ? false : modalProp;
|
|
145
145
|
const mayAutoFocusOnShow = !!autoFocusOnShow;
|
|
146
146
|
const canAutoFocusOnShow = !!initialFocusRef || !!props.initialFocus || !!modal;
|
|
147
|
-
props =
|
|
147
|
+
props = _EQ4A5RPWcjs.useHovercard.call(void 0, _AV6KTKLEcjs.__spreadProps.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, {
|
|
148
148
|
store,
|
|
149
149
|
alwaysVisible,
|
|
150
150
|
initialFocus: initialFocusRef,
|
package/cjs/popover/popover.cjs
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
|
|
5
|
-
var
|
|
5
|
+
var _RIZYIKBEcjs = require('../__chunks/RIZYIKBE.cjs');
|
|
6
6
|
require('../__chunks/XFPRAS3J.cjs');
|
|
7
7
|
require('../__chunks/SHOS7XOU.cjs');
|
|
8
8
|
require('../__chunks/NKR65BKC.cjs');
|
|
@@ -42,4 +42,4 @@ require('../__chunks/AV6KTKLE.cjs');
|
|
|
42
42
|
|
|
43
43
|
|
|
44
44
|
|
|
45
|
-
exports.Popover =
|
|
45
|
+
exports.Popover = _RIZYIKBEcjs.Popover; exports.usePopover = _RIZYIKBEcjs.usePopover;
|
package/cjs/portal/portal.d.cts
CHANGED
|
@@ -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
|
-
* - [
|
|
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)
|
package/cjs/portal/portal.d.ts
CHANGED
|
@@ -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
|
-
* - [
|
|
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)
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
var
|
|
4
|
+
var _IPYAEPOTcjs = require('../__chunks/IPYAEPOT.cjs');
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
|
@@ -158,7 +158,7 @@ var useSelectItem = _RNZNGEL4cjs.createHook.call(void 0,
|
|
|
158
158
|
preventScrollOnKeyDown
|
|
159
159
|
}, props));
|
|
160
160
|
const focusOnHoverProp = _EO6LS72Hcjs.useBooleanEvent.call(void 0, focusOnHover);
|
|
161
|
-
props =
|
|
161
|
+
props = _IPYAEPOTcjs.useCompositeHover.call(void 0, _AV6KTKLEcjs.__spreadProps.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, {
|
|
162
162
|
store
|
|
163
163
|
}, props), {
|
|
164
164
|
// We have to disable focusOnHover when the popup is closed, otherwise
|
|
@@ -12,7 +12,7 @@ require('../__chunks/UZNYSPKP.cjs');
|
|
|
12
12
|
require('../__chunks/BZTDJIVT.cjs');
|
|
13
13
|
|
|
14
14
|
|
|
15
|
-
var
|
|
15
|
+
var _RIZYIKBEcjs = require('../__chunks/RIZYIKBE.cjs');
|
|
16
16
|
|
|
17
17
|
|
|
18
18
|
var _XFPRAS3Jcjs = require('../__chunks/XFPRAS3J.cjs');
|
|
@@ -66,7 +66,7 @@ var useSelectPopover = _RNZNGEL4cjs.createHook.call(void 0,
|
|
|
66
66
|
const context = _2WCJJQSKcjs.useSelectProviderContext.call(void 0, );
|
|
67
67
|
store = store || context;
|
|
68
68
|
props = _F24A3PBWcjs.useSelectList.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, { store, alwaysVisible }, props));
|
|
69
|
-
props =
|
|
69
|
+
props = _RIZYIKBEcjs.usePopover.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, { store, alwaysVisible }, props));
|
|
70
70
|
return props;
|
|
71
71
|
}
|
|
72
72
|
);
|
package/cjs/tooltip/tooltip.cjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
var
|
|
4
|
+
var _EQ4A5RPWcjs = require('../__chunks/EQ4A5RPW.cjs');
|
|
5
5
|
require('../__chunks/KXQOQQ5B.cjs');
|
|
6
|
-
require('../__chunks/
|
|
6
|
+
require('../__chunks/RIZYIKBE.cjs');
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
var _XFPRAS3Jcjs = require('../__chunks/XFPRAS3J.cjs');
|
|
@@ -94,7 +94,7 @@ var useTooltip = _RNZNGEL4cjs.createHook.call(void 0,
|
|
|
94
94
|
(state) => state.type === "description" ? "tooltip" : "none"
|
|
95
95
|
);
|
|
96
96
|
props = _AV6KTKLEcjs.__spreadValues.call(void 0, { role }, props);
|
|
97
|
-
props =
|
|
97
|
+
props = _EQ4A5RPWcjs.useHovercard.call(void 0, _AV6KTKLEcjs.__spreadProps.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, {}, props), {
|
|
98
98
|
store,
|
|
99
99
|
portal,
|
|
100
100
|
gutter,
|
|
@@ -10,7 +10,8 @@ import {
|
|
|
10
10
|
import {
|
|
11
11
|
useBooleanEvent,
|
|
12
12
|
useEvent,
|
|
13
|
-
useIsMouseMoving
|
|
13
|
+
useIsMouseMoving,
|
|
14
|
+
useMergeRefs
|
|
14
15
|
} from "./6O5OEQGF.js";
|
|
15
16
|
import {
|
|
16
17
|
__objRest,
|
|
@@ -19,9 +20,10 @@ import {
|
|
|
19
20
|
} from "./4R3V3JGP.js";
|
|
20
21
|
|
|
21
22
|
// src/composite/composite-hover.ts
|
|
22
|
-
import {
|
|
23
|
+
import { useCallback } from "react";
|
|
24
|
+
import { contains } from "@ariakit/core/utils/dom";
|
|
23
25
|
import { hasFocus, hasFocusWithin } from "@ariakit/core/utils/focus";
|
|
24
|
-
import { invariant } from "@ariakit/core/utils/misc";
|
|
26
|
+
import { hasOwnProperty, invariant } from "@ariakit/core/utils/misc";
|
|
25
27
|
function getMouseDestination(event) {
|
|
26
28
|
const relatedTarget = event.relatedTarget;
|
|
27
29
|
if ((relatedTarget == null ? void 0 : relatedTarget.nodeType) === Node.ELEMENT_NODE) {
|
|
@@ -35,12 +37,17 @@ function hoveringInside(event) {
|
|
|
35
37
|
return false;
|
|
36
38
|
return contains(event.currentTarget, nextElement);
|
|
37
39
|
}
|
|
40
|
+
var symbol = Symbol("composite-hover");
|
|
38
41
|
function movingToAnotherItem(event) {
|
|
39
|
-
|
|
42
|
+
let dest = getMouseDestination(event);
|
|
40
43
|
if (!dest)
|
|
41
44
|
return false;
|
|
42
|
-
|
|
43
|
-
|
|
45
|
+
do {
|
|
46
|
+
if (hasOwnProperty(dest, symbol) && dest[symbol])
|
|
47
|
+
return true;
|
|
48
|
+
dest = dest.parentElement;
|
|
49
|
+
} while (dest);
|
|
50
|
+
return false;
|
|
44
51
|
}
|
|
45
52
|
var useCompositeHover = createHook(
|
|
46
53
|
(_a) => {
|
|
@@ -98,9 +105,13 @@ var useCompositeHover = createHook(
|
|
|
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
|
-
|
|
102
|
-
|
|
103
|
-
|
|
108
|
+
const ref = useCallback((element) => {
|
|
109
|
+
if (!element)
|
|
110
|
+
return;
|
|
111
|
+
element[symbol] = true;
|
|
112
|
+
}, []);
|
|
113
|
+
props = __spreadProps(__spreadValues({}, props), {
|
|
114
|
+
ref: useMergeRefs(ref, props.ref),
|
|
104
115
|
onMouseMove,
|
|
105
116
|
onMouseLeave
|
|
106
117
|
});
|
|
@@ -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
|
|
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
|
|
@@ -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
|
-
* - [
|
|
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
|
package/esm/combobox/combobox.js
CHANGED
|
@@ -40,7 +40,11 @@ import {
|
|
|
40
40
|
|
|
41
41
|
// src/combobox/combobox.ts
|
|
42
42
|
import { useEffect, useMemo, useRef, useState } from "react";
|
|
43
|
-
import {
|
|
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
|
-
|
|
180
|
+
setSelectionRange(element, storeValue.length, activeValue.length);
|
|
177
181
|
});
|
|
178
182
|
}, [
|
|
179
183
|
valueUpdated,
|
|
@@ -296,7 +300,7 @@ var useCombobox = createHook(
|
|
|
296
300
|
if (setValueOnChangeProp(event)) {
|
|
297
301
|
const isSameValue = value2 === store.getState().value;
|
|
298
302
|
flushSync(() => store == null ? void 0 : store.setValue(value2));
|
|
299
|
-
event.currentTarget
|
|
303
|
+
setSelectionRange(event.currentTarget, selectionStart, selectionEnd);
|
|
300
304
|
if (inline && autoSelect && isSameValue) {
|
|
301
305
|
forceValueUpdate();
|
|
302
306
|
}
|
|
@@ -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
|
}
|
|
@@ -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
|
|
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>>;
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
import {
|
|
3
3
|
Hovercard,
|
|
4
4
|
useHovercard
|
|
5
|
-
} from "../__chunks/
|
|
5
|
+
} from "../__chunks/BONLQCKO.js";
|
|
6
6
|
import "../__chunks/YMV43K4F.js";
|
|
7
|
-
import "../__chunks/
|
|
7
|
+
import "../__chunks/WBQC3LL4.js";
|
|
8
8
|
import "../__chunks/U7WGY7YX.js";
|
|
9
9
|
import "../__chunks/JSLLR7RC.js";
|
|
10
10
|
import "../__chunks/CLF4PQ7T.js";
|
package/esm/menu/menu-button.js
CHANGED
|
@@ -65,14 +65,12 @@ function getInitialFocus(event, dir) {
|
|
|
65
65
|
};
|
|
66
66
|
return keyMap[event.key];
|
|
67
67
|
}
|
|
68
|
-
function hasActiveItem(items,
|
|
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 ===
|
|
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
|
|
109
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
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
|
|
192
|
-
|
|
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({
|
|
@@ -8,12 +8,12 @@ import {
|
|
|
8
8
|
import "../__chunks/VPR2WHQV.js";
|
|
9
9
|
import {
|
|
10
10
|
useMenuItem
|
|
11
|
-
} from "../__chunks/
|
|
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/
|
|
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/
|
|
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/
|
|
14
|
+
import "../__chunks/G6ONQ5EH.js";
|
|
15
15
|
import "../__chunks/5PEPOQU7.js";
|
|
16
16
|
import "../__chunks/NWCBQ4CV.js";
|
|
17
17
|
import "../__chunks/UH3I23HL.js";
|
package/esm/menu/menu-item.js
CHANGED
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
import {
|
|
3
3
|
MenuItem,
|
|
4
4
|
useMenuItem
|
|
5
|
-
} from "../__chunks/
|
|
5
|
+
} from "../__chunks/JRUYDVPB.js";
|
|
6
6
|
import "../__chunks/YGMEBI3A.js";
|
|
7
7
|
import "../__chunks/KA4GX64Z.js";
|
|
8
|
-
import "../__chunks/
|
|
8
|
+
import "../__chunks/G6ONQ5EH.js";
|
|
9
9
|
import "../__chunks/5PEPOQU7.js";
|
|
10
10
|
import "../__chunks/NWCBQ4CV.js";
|
|
11
11
|
import "../__chunks/UH3I23HL.js";
|
package/esm/menu/menu-store.d.ts
CHANGED
|
@@ -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/
|
|
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/
|
|
45
|
-
|
|
46
|
-
|
|
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
|
};
|
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/
|
|
16
|
+
} from "../__chunks/BONLQCKO.js";
|
|
17
17
|
import "../__chunks/YMV43K4F.js";
|
|
18
|
-
import "../__chunks/
|
|
18
|
+
import "../__chunks/WBQC3LL4.js";
|
|
19
19
|
import {
|
|
20
20
|
createDialogComponent
|
|
21
21
|
} from "../__chunks/U7WGY7YX.js";
|