@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.
- package/CHANGELOG.md +41 -0
- package/cjs/__chunks/{VEG6PRAG.cjs → 3WCBE6SU.cjs} +3 -1
- package/cjs/__chunks/{45RPYV4J.cjs → EQ4A5RPW.cjs} +2 -2
- package/cjs/__chunks/{CILQPSH2.cjs → FA25CV2I.cjs} +2 -2
- package/cjs/__chunks/{RRW7YVFR.cjs → IPYAEPOT.cjs} +17 -6
- package/cjs/__chunks/{AYDXWQBF.cjs → L3WS5HGI.cjs} +2 -0
- package/cjs/__chunks/{QU2266CJ.cjs → WH4I6OSN.cjs} +12 -4
- package/cjs/__chunks/{LVOI2KVN.cjs → XGKLTARH.cjs} +2 -2
- package/cjs/__chunks/{4GLXDOKG.cjs → YAPOM5RT.cjs} +2 -2
- package/cjs/checkbox/checkbox-provider.cjs +2 -2
- package/cjs/combobox/combobox-cancel.cjs +2 -2
- package/cjs/combobox/combobox-context.cjs +4 -2
- package/cjs/combobox/combobox-context.d.cts +6 -5
- package/cjs/combobox/combobox-context.d.ts +6 -5
- package/cjs/combobox/combobox-disclosure.cjs +2 -2
- package/cjs/combobox/combobox-item-check.cjs +50 -0
- package/cjs/combobox/combobox-item-check.d.cts +60 -0
- package/cjs/combobox/combobox-item-check.d.ts +60 -0
- package/cjs/combobox/combobox-item-value.cjs +3 -3
- package/cjs/combobox/combobox-item.cjs +47 -10
- package/cjs/combobox/combobox-item.d.cts +31 -13
- package/cjs/combobox/combobox-item.d.ts +31 -13
- package/cjs/combobox/combobox-label.cjs +55 -0
- package/cjs/combobox/combobox-label.d.cts +42 -0
- package/cjs/combobox/combobox-label.d.ts +42 -0
- package/cjs/combobox/combobox-list.cjs +3 -3
- package/cjs/combobox/combobox-popover.cjs +7 -7
- package/cjs/combobox/combobox-provider.cjs +4 -4
- package/cjs/combobox/combobox-provider.d.cts +8 -4
- package/cjs/combobox/combobox-provider.d.ts +8 -4
- package/cjs/combobox/combobox-row.cjs +2 -2
- package/cjs/combobox/combobox-separator.cjs +2 -2
- package/cjs/combobox/combobox-store.cjs +2 -2
- package/cjs/combobox/combobox-store.d.cts +28 -9
- package/cjs/combobox/combobox-store.d.ts +28 -9
- package/cjs/combobox/combobox.cjs +28 -14
- 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 +9 -0
- package/cjs/composite/composite-hover.d.ts +9 -0
- package/cjs/composite/composite-item.d.cts +3 -0
- package/cjs/composite/composite-item.d.ts +3 -0
- package/cjs/composite/composite-overflow.cjs +2 -2
- package/cjs/disclosure/disclosure-content.d.cts +3 -1
- package/cjs/disclosure/disclosure-content.d.ts +3 -1
- package/cjs/disclosure/disclosure.d.cts +3 -0
- package/cjs/disclosure/disclosure.d.ts +3 -0
- package/cjs/focusable/focusable.d.cts +2 -1
- package/cjs/focusable/focusable.d.ts +2 -1
- package/cjs/form/form-checkbox.cjs +1 -1
- package/cjs/hovercard/hovercard-anchor.d.cts +3 -0
- package/cjs/hovercard/hovercard-anchor.d.ts +3 -0
- package/cjs/hovercard/hovercard.cjs +3 -3
- package/cjs/menu/menu-button.cjs +33 -21
- package/cjs/menu/menu-item-checkbox.cjs +4 -4
- package/cjs/menu/menu-item-radio.cjs +3 -3
- package/cjs/menu/menu-item.cjs +3 -3
- package/cjs/menu/menu-provider.cjs +3 -3
- package/cjs/menu/menu-store.cjs +3 -3
- package/cjs/menu/menu-store.d.cts +7 -55
- package/cjs/menu/menu-store.d.ts +7 -55
- package/cjs/menu/menu.cjs +3 -3
- package/cjs/popover/popover.cjs +2 -2
- package/cjs/popover/popover.d.cts +4 -0
- package/cjs/popover/popover.d.ts +4 -0
- package/cjs/portal/portal.d.cts +5 -1
- package/cjs/portal/portal.d.ts +5 -1
- package/cjs/select/select-item.cjs +5 -5
- package/cjs/select/select-label.cjs +1 -1
- package/cjs/select/select-popover.cjs +2 -2
- package/cjs/select/select-provider.cjs +3 -3
- package/cjs/select/select-store.cjs +3 -3
- package/cjs/select/select-store.d.cts +1 -7
- package/cjs/select/select-store.d.ts +1 -7
- package/cjs/tooltip/tooltip.cjs +3 -3
- package/combobox/combobox-item-check/package.json +8 -0
- package/combobox/combobox-label/package.json +8 -0
- package/esm/__chunks/{KFUKDUTY.js → 4AMOOZBQ.js} +10 -2
- package/esm/__chunks/{PHTJ3BCW.js → 7HYEBVZE.js} +1 -1
- 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/__chunks/{NE6JAKK6.js → P3UZS6BC.js} +1 -1
- package/esm/__chunks/{MTC2KUZZ.js → W76OTZCC.js} +3 -1
- package/esm/__chunks/{24AKC2LC.js → ZETMAOTK.js} +2 -0
- package/esm/checkbox/checkbox-provider.js +3 -3
- package/esm/combobox/combobox-cancel.js +1 -1
- package/esm/combobox/combobox-context.d.ts +6 -5
- package/esm/combobox/combobox-context.js +3 -1
- package/esm/combobox/combobox-disclosure.js +1 -1
- package/esm/combobox/combobox-item-check.d.ts +60 -0
- package/esm/combobox/combobox-item-check.js +50 -0
- package/esm/combobox/combobox-item-value.js +1 -1
- package/esm/combobox/combobox-item.d.ts +31 -13
- package/esm/combobox/combobox-item.js +45 -8
- package/esm/combobox/combobox-label.d.ts +42 -0
- package/esm/combobox/combobox-label.js +55 -0
- package/esm/combobox/combobox-list.js +2 -2
- package/esm/combobox/combobox-popover.js +3 -3
- package/esm/combobox/combobox-provider.d.ts +8 -4
- package/esm/combobox/combobox-provider.js +2 -2
- package/esm/combobox/combobox-row.js +1 -1
- package/esm/combobox/combobox-separator.js +1 -1
- package/esm/combobox/combobox-store.d.ts +28 -9
- package/esm/combobox/combobox-store.js +1 -1
- package/esm/combobox/combobox.d.ts +2 -1
- package/esm/combobox/combobox.js +28 -14
- package/esm/composite/composite-hover.d.ts +9 -0
- package/esm/composite/composite-hover.js +1 -1
- package/esm/composite/composite-item.d.ts +3 -0
- package/esm/composite/composite-overflow.js +1 -1
- package/esm/disclosure/disclosure-content.d.ts +3 -1
- package/esm/disclosure/disclosure.d.ts +3 -0
- package/esm/focusable/focusable.d.ts +2 -1
- package/esm/form/form-checkbox.js +1 -1
- package/esm/hovercard/hovercard-anchor.d.ts +3 -0
- package/esm/hovercard/hovercard.js +2 -2
- package/esm/menu/menu-button.js +33 -21
- package/esm/menu/menu-item-checkbox.js +3 -3
- package/esm/menu/menu-item-radio.js +2 -2
- package/esm/menu/menu-item.js +2 -2
- package/esm/menu/menu-provider.js +2 -2
- package/esm/menu/menu-store.d.ts +7 -55
- package/esm/menu/menu-store.js +2 -2
- package/esm/menu/menu.js +2 -2
- package/esm/popover/popover.d.ts +4 -0
- package/esm/popover/popover.js +1 -1
- package/esm/portal/portal.d.ts +5 -1
- package/esm/select/select-item.js +4 -4
- package/esm/select/select-label.js +2 -2
- package/esm/select/select-popover.js +1 -1
- package/esm/select/select-provider.js +2 -2
- package/esm/select/select-store.d.ts +1 -7
- package/esm/select/select-store.js +2 -2
- package/esm/tooltip/tooltip.js +2 -2
- package/package.json +16 -2
- package/cjs/collection/collection-context.d.cts +0 -34
- package/cjs/collection/collection-context.d.ts +0 -34
- package/cjs/composite/utils.d.cts +0 -69
- package/cjs/composite/utils.d.ts +0 -69
- package/cjs/tab/tab-store.d.cts +0 -74
- package/cjs/tab/tab-store.d.ts +0 -74
- package/esm/collection/collection-context.d.ts +0 -34
- package/esm/composite/utils.d.ts +0 -69
- package/esm/tab/tab-store.d.ts +0 -74
- package/cjs/__chunks/{ISGOCBDC.cjs → RIZYIKBE.cjs} +1 -1
- package/esm/__chunks/{KB2HXEVC.js → WBQC3LL4.js} +1 -1
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import * as Core from "@ariakit/core/combobox/combobox-store";
|
|
2
|
+
import type { PickRequired } from "@ariakit/core/utils/types";
|
|
2
3
|
import type { CompositeStoreFunctions, CompositeStoreOptions, CompositeStoreState } from "../composite/composite-store.js";
|
|
3
4
|
import type { PopoverStoreFunctions, PopoverStoreOptions, PopoverStoreState } from "../popover/popover-store.js";
|
|
4
5
|
import type { Store } from "../utils/store.js";
|
|
6
|
+
type Value = Core.ComboboxStoreSelectedValue;
|
|
5
7
|
export declare function useComboboxStoreProps<T extends Core.ComboboxStore>(store: T, update: () => void, props: ComboboxStoreProps): T;
|
|
6
8
|
/**
|
|
7
9
|
* Creates a combobox store.
|
|
@@ -17,27 +19,44 @@ export declare function useComboboxStoreProps<T extends Core.ComboboxStore>(stor
|
|
|
17
19
|
* </ComboboxPopover>
|
|
18
20
|
* ```
|
|
19
21
|
*/
|
|
22
|
+
export declare function useComboboxStore<T extends Value = Value>(props: PickRequired<ComboboxStoreProps<T>, "selectedValue" | "defaultSelectedValue">): ComboboxStore<T>;
|
|
20
23
|
export declare function useComboboxStore(props?: ComboboxStoreProps): ComboboxStore;
|
|
21
24
|
export type ComboboxStoreItem = Core.ComboboxStoreItem;
|
|
22
|
-
export
|
|
25
|
+
export type ComboboxStoreSelectedValue = Core.ComboboxStoreSelectedValue;
|
|
26
|
+
export interface ComboboxStoreState<T extends Value = Value> extends Core.ComboboxStoreState<T>, CompositeStoreState<ComboboxStoreItem>, PopoverStoreState {
|
|
23
27
|
}
|
|
24
|
-
export interface ComboboxStoreFunctions extends Core.ComboboxStoreFunctions
|
|
28
|
+
export interface ComboboxStoreFunctions<T extends Value = Value> extends Core.ComboboxStoreFunctions<T>, CompositeStoreFunctions<ComboboxStoreItem>, PopoverStoreFunctions {
|
|
25
29
|
}
|
|
26
|
-
export interface ComboboxStoreOptions extends Core.ComboboxStoreOptions
|
|
30
|
+
export interface ComboboxStoreOptions<T extends Value = Value> extends Core.ComboboxStoreOptions<T>, CompositeStoreOptions<ComboboxStoreItem>, PopoverStoreOptions {
|
|
27
31
|
/**
|
|
28
|
-
* A callback that gets called when the
|
|
32
|
+
* A callback that gets called when the
|
|
33
|
+
* [`value`](https://ariakit.org/reference/combobox-provider#value) state
|
|
34
|
+
* changes.
|
|
29
35
|
*
|
|
30
36
|
* Live examples:
|
|
31
|
-
* - [Combobox
|
|
37
|
+
* - [Combobox with integrated
|
|
38
|
+
* filter](https://ariakit.org/examples/combobox-filtering-integrated)
|
|
32
39
|
* - [ComboboxGroup](https://ariakit.org/examples/combobox-group)
|
|
33
40
|
* - [Combobox with links](https://ariakit.org/examples/combobox-links)
|
|
34
41
|
* - [Multi-selectable
|
|
35
42
|
* Combobox](https://ariakit.org/examples/combobox-multiple)
|
|
36
43
|
* - [Menu with Combobox](https://ariakit.org/examples/menu-combobox)
|
|
37
44
|
* - [Select with Combobox](https://ariakit.org/examples/select-combobox)
|
|
38
|
-
* @param value The new value.
|
|
39
45
|
*/
|
|
40
|
-
setValue?: (value: ComboboxStoreState["value"]) => void;
|
|
46
|
+
setValue?: (value: ComboboxStoreState<T>["value"]) => void;
|
|
47
|
+
/**
|
|
48
|
+
* A callback that gets called when the
|
|
49
|
+
* [`selectedValue`](https://ariakit.org/reference/combobox-provider#selectedvalue)
|
|
50
|
+
* state changes.
|
|
51
|
+
*
|
|
52
|
+
* Live examples:
|
|
53
|
+
* - [Multi-selectable
|
|
54
|
+
* Combobox](https://ariakit.org/examples/combobox-multiple)
|
|
55
|
+
*/
|
|
56
|
+
setSelectedValue?: (value: ComboboxStoreState<T>["selectedValue"]) => void;
|
|
57
|
+
}
|
|
58
|
+
export interface ComboboxStoreProps<T extends Value = Value> extends ComboboxStoreOptions<T>, Core.ComboboxStoreProps<T> {
|
|
59
|
+
}
|
|
60
|
+
export interface ComboboxStore<T extends Value = Value> extends ComboboxStoreFunctions<T>, Store<Core.ComboboxStore<T>> {
|
|
41
61
|
}
|
|
42
|
-
export
|
|
43
|
-
export type ComboboxStore = ComboboxStoreFunctions & Store<Core.ComboboxStore>;
|
|
62
|
+
export {};
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
var _3QW6ELTGcjs = require('../__chunks/3QW6ELTG.cjs');
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
var
|
|
7
|
+
var _3WCBE6SUcjs = require('../__chunks/3WCBE6SU.cjs');
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
var _CZOBQEIOcjs = require('../__chunks/CZOBQEIO.cjs');
|
|
@@ -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
|
|
|
@@ -97,7 +101,7 @@ var useCombobox = _RNZNGEL4cjs.createHook.call(void 0,
|
|
|
97
101
|
"moveOnKeyPress",
|
|
98
102
|
"autoComplete"
|
|
99
103
|
]);
|
|
100
|
-
const context =
|
|
104
|
+
const context = _3WCBE6SUcjs.useComboboxProviderContext.call(void 0, );
|
|
101
105
|
store = store || context;
|
|
102
106
|
_misc.invariant.call(void 0,
|
|
103
107
|
store,
|
|
@@ -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
|
-
|
|
180
|
+
_dom.setSelectionRange.call(void 0, element, storeValue.length, activeValue.length);
|
|
177
181
|
});
|
|
178
182
|
}, [
|
|
179
183
|
valueUpdated,
|
|
@@ -227,15 +231,16 @@ var useCombobox = _RNZNGEL4cjs.createHook.call(void 0,
|
|
|
227
231
|
return;
|
|
228
232
|
canAutoSelectRef.current = false;
|
|
229
233
|
}, [open]);
|
|
234
|
+
const resetValueOnSelect = store.useState("resetValueOnSelect");
|
|
230
235
|
_EO6LS72Hcjs.useUpdateEffect.call(void 0, () => {
|
|
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 && !_focus.hasFocus.call(void 0, baseElement))
|
|
240
245
|
return;
|
|
241
246
|
if (contentElement2 == null ? void 0 : contentElement2.hasAttribute("data-placing")) {
|
|
@@ -243,14 +248,23 @@ var useCombobox = _RNZNGEL4cjs.createHook.call(void 0,
|
|
|
243
248
|
observer.observe(contentElement2, { attributeFilter: ["data-placing"] });
|
|
244
249
|
return () => observer.disconnect();
|
|
245
250
|
}
|
|
246
|
-
|
|
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
|
-
}, [
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
260
|
+
}, [
|
|
261
|
+
store,
|
|
262
|
+
valueUpdated,
|
|
263
|
+
storeValue,
|
|
264
|
+
autoSelect,
|
|
265
|
+
resetValueOnSelect,
|
|
266
|
+
items
|
|
267
|
+
]);
|
|
254
268
|
_react.useEffect.call(void 0, () => {
|
|
255
269
|
if (!inline)
|
|
256
270
|
return;
|
|
@@ -296,7 +310,7 @@ var useCombobox = _RNZNGEL4cjs.createHook.call(void 0,
|
|
|
296
310
|
if (setValueOnChangeProp(event)) {
|
|
297
311
|
const isSameValue = value2 === store.getState().value;
|
|
298
312
|
_reactdom.flushSync.call(void 0, () => store == null ? void 0 : store.setValue(value2));
|
|
299
|
-
event.currentTarget
|
|
313
|
+
_dom.setSelectionRange.call(void 0, event.currentTarget, selectionStart, selectionEnd);
|
|
300
314
|
if (inline && autoSelect && isSameValue) {
|
|
301
315
|
forceValueUpdate();
|
|
302
316
|
}
|
|
@@ -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
|
|
@@ -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
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
|
|
5
|
-
var
|
|
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 =
|
|
15
|
+
exports.CompositeHover = _IPYAEPOTcjs.CompositeHover; exports.useCompositeHover = _IPYAEPOTcjs.useCompositeHover;
|
|
@@ -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
|
}
|
|
@@ -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
|
}
|
|
@@ -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
|
}
|
|
@@ -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 strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
var
|
|
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 =
|
|
94
|
+
props = _RIZYIKBEcjs.usePopover.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, {
|
|
95
95
|
store,
|
|
96
96
|
backdropProps,
|
|
97
97
|
wrapperProps,
|
|
@@ -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
|
-
* - [
|
|
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)
|
|
@@ -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
|
-
* - [
|
|
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>>;
|
|
@@ -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>>;
|
|
@@ -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 @@ var _FROYTN4Bcjs = require('../__chunks/FROYTN4B.cjs');
|
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
var _BY6ER73Ucjs = require('../__chunks/BY6ER73U.cjs');
|
|
11
|
+
require('../__chunks/63UPRTFZ.cjs');
|
|
11
12
|
|
|
12
13
|
|
|
13
14
|
var _5GQV7KPQcjs = require('../__chunks/5GQV7KPQ.cjs');
|
|
14
|
-
require('../__chunks/63UPRTFZ.cjs');
|
|
15
15
|
require('../__chunks/ERFHNHON.cjs');
|
|
16
16
|
require('../__chunks/DAJUUBUI.cjs');
|
|
17
17
|
require('../__chunks/R5A2WTWB.cjs');
|
|
@@ -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>>;
|
|
@@ -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
|
|
|
3
3
|
|
|
4
4
|
|
|
5
|
-
var
|
|
5
|
+
var _EQ4A5RPWcjs = require('../__chunks/EQ4A5RPW.cjs');
|
|
6
6
|
require('../__chunks/KXQOQQ5B.cjs');
|
|
7
|
-
require('../__chunks/
|
|
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 =
|
|
48
|
+
exports.Hovercard = _EQ4A5RPWcjs.Hovercard; exports.useHovercard = _EQ4A5RPWcjs.useHovercard;
|
package/cjs/menu/menu-button.cjs
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 = _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
|
|
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 = _RNZNGEL4cjs.createHook.call(void 0,
|
|
|
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 = _RNZNGEL4cjs.createHook.call(void 0,
|
|
|
147
149
|
store.setInitialFocus(isKeyboardClick ? "first" : "container");
|
|
148
150
|
}
|
|
149
151
|
if (hasParentMenu) {
|
|
150
|
-
|
|
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
|
-
|
|
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 = _LICANQTIcjs.usePopoverDisclosure.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, {
|
|
@@ -2,18 +2,18 @@
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
var _BY6ER73Ucjs = require('../__chunks/BY6ER73U.cjs');
|
|
5
|
+
require('../__chunks/63UPRTFZ.cjs');
|
|
5
6
|
|
|
6
7
|
|
|
7
8
|
var _5GQV7KPQcjs = require('../__chunks/5GQV7KPQ.cjs');
|
|
8
|
-
require('../__chunks/63UPRTFZ.cjs');
|
|
9
9
|
|
|
10
10
|
|
|
11
|
-
var
|
|
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/
|
|
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 =
|
|
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
|
|
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/
|
|
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 =
|
|
113
|
+
props = _YAPOM5RTcjs.useMenuItem.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, { store, hideOnClick }, props));
|
|
114
114
|
return props;
|
|
115
115
|
}
|
|
116
116
|
);
|
package/cjs/menu/menu-item.cjs
CHANGED
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
|
|
5
|
-
var
|
|
5
|
+
var _YAPOM5RTcjs = require('../__chunks/YAPOM5RT.cjs');
|
|
6
6
|
require('../__chunks/NGEKJJDH.cjs');
|
|
7
7
|
require('../__chunks/7LBZXSLY.cjs');
|
|
8
|
-
require('../__chunks/
|
|
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 =
|
|
29
|
+
exports.MenuItem = _YAPOM5RTcjs.MenuItem; exports.useMenuItem = _YAPOM5RTcjs.useMenuItem;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
var
|
|
4
|
+
var _XGKLTARHcjs = require('../__chunks/XGKLTARH.cjs');
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
var _NGEKJJDHcjs = require('../__chunks/NGEKJJDH.cjs');
|
|
8
8
|
require('../__chunks/7LBZXSLY.cjs');
|
|
9
|
-
require('../__chunks/
|
|
9
|
+
require('../__chunks/3WCBE6SU.cjs');
|
|
10
10
|
require('../__chunks/A5RWZSX7.cjs');
|
|
11
11
|
require('../__chunks/TUVU5ERH.cjs');
|
|
12
12
|
require('../__chunks/UZNYSPKP.cjs');
|
|
@@ -28,7 +28,7 @@ require('../__chunks/AV6KTKLE.cjs');
|
|
|
28
28
|
// src/menu/menu-provider.tsx
|
|
29
29
|
var _jsxruntime = require('react/jsx-runtime');
|
|
30
30
|
function MenuProvider(props = {}) {
|
|
31
|
-
const store =
|
|
31
|
+
const store = _XGKLTARHcjs.useMenuStore.call(void 0, props);
|
|
32
32
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _NGEKJJDHcjs.MenuContextProvider, { value: store, children: props.children });
|
|
33
33
|
}
|
|
34
34
|
|
package/cjs/menu/menu-store.cjs
CHANGED
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
|
|
5
|
-
var
|
|
5
|
+
var _XGKLTARHcjs = require('../__chunks/XGKLTARH.cjs');
|
|
6
6
|
require('../__chunks/NGEKJJDH.cjs');
|
|
7
7
|
require('../__chunks/7LBZXSLY.cjs');
|
|
8
|
-
require('../__chunks/
|
|
8
|
+
require('../__chunks/3WCBE6SU.cjs');
|
|
9
9
|
require('../__chunks/A5RWZSX7.cjs');
|
|
10
10
|
require('../__chunks/TUVU5ERH.cjs');
|
|
11
11
|
require('../__chunks/UZNYSPKP.cjs');
|
|
@@ -26,4 +26,4 @@ require('../__chunks/AV6KTKLE.cjs');
|
|
|
26
26
|
|
|
27
27
|
|
|
28
28
|
|
|
29
|
-
exports.useMenuStore =
|
|
29
|
+
exports.useMenuStore = _XGKLTARHcjs.useMenuStore; exports.useMenuStoreProps = _XGKLTARHcjs.useMenuStoreProps;
|