@ariakit/react-core 0.3.7 → 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 +24 -0
- package/cjs/__chunks/{VEG6PRAG.cjs → 3WCBE6SU.cjs} +3 -1
- package/cjs/__chunks/{CILQPSH2.cjs → FA25CV2I.cjs} +2 -2
- 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/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 +45 -8
- 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 +5 -5
- 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 +26 -8
- package/cjs/combobox/combobox-store.d.ts +26 -8
- package/cjs/combobox/combobox.cjs +22 -12
- package/cjs/composite/composite-hover.d.cts +3 -0
- package/cjs/composite/composite-hover.d.ts +3 -0
- package/cjs/composite/composite-item.d.cts +3 -0
- package/cjs/composite/composite-item.d.ts +3 -0
- package/cjs/disclosure/disclosure-content.d.cts +1 -0
- package/cjs/disclosure/disclosure-content.d.ts +1 -0
- package/cjs/disclosure/disclosure.d.cts +3 -0
- package/cjs/disclosure/disclosure.d.ts +3 -0
- package/cjs/focusable/focusable.d.cts +1 -0
- package/cjs/focusable/focusable.d.ts +1 -0
- 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/menu/menu-item-checkbox.cjs +1 -1
- package/cjs/menu/menu-provider.cjs +3 -3
- package/cjs/menu/menu-store.cjs +3 -3
- package/cjs/menu/menu-store.d.cts +5 -11
- package/cjs/menu/menu-store.d.ts +5 -11
- package/cjs/popover/popover.d.cts +4 -0
- package/cjs/popover/popover.d.ts +4 -0
- package/cjs/portal/portal.d.cts +3 -0
- package/cjs/portal/portal.d.ts +3 -0
- package/cjs/select/select-item.cjs +3 -3
- package/cjs/select/select-label.cjs +1 -1
- 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/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/{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 +44 -7
- 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 +2 -2
- 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 +26 -8
- package/esm/combobox/combobox-store.js +1 -1
- package/esm/combobox/combobox.js +21 -11
- package/esm/composite/composite-hover.d.ts +3 -0
- package/esm/composite/composite-item.d.ts +3 -0
- package/esm/disclosure/disclosure-content.d.ts +1 -0
- package/esm/disclosure/disclosure.d.ts +3 -0
- package/esm/focusable/focusable.d.ts +1 -0
- package/esm/form/form-checkbox.js +1 -1
- package/esm/hovercard/hovercard-anchor.d.ts +3 -0
- package/esm/menu/menu-item-checkbox.js +1 -1
- package/esm/menu/menu-provider.js +2 -2
- package/esm/menu/menu-store.d.ts +5 -11
- package/esm/menu/menu-store.js +2 -2
- package/esm/popover/popover.d.ts +4 -0
- package/esm/portal/portal.d.ts +3 -0
- package/esm/select/select-item.js +3 -3
- package/esm/select/select-label.js +2 -2
- 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/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
|
@@ -52,15 +52,15 @@ export interface ComboboxItemOptions<T extends As = "div"> extends CompositeItem
|
|
|
52
52
|
store?: ComboboxStore;
|
|
53
53
|
/**
|
|
54
54
|
* The value of the item. This will be rendered as the children by default.
|
|
55
|
-
*
|
|
56
|
-
*
|
|
57
|
-
*
|
|
58
|
-
*
|
|
59
|
-
*
|
|
60
|
-
*
|
|
61
|
-
*
|
|
62
|
-
*
|
|
63
|
-
*
|
|
55
|
+
* - If
|
|
56
|
+
* [`setValueOnClick`](https://ariakit.org/reference/combobox-item#setvalueonclick)
|
|
57
|
+
* is set to `true`, this will be the value of the combobox input when the
|
|
58
|
+
* user clicks on this item.
|
|
59
|
+
* - If the
|
|
60
|
+
* [`autoComplete`](https://ariakit.org/reference/combobox#autocomplete)
|
|
61
|
+
* prop on the [`Combobox`](https://ariakit.org/reference/combobox)
|
|
62
|
+
* component is set to `both` or `inline`, this will be the value of the
|
|
63
|
+
* combobox input when the combobox loses focus.
|
|
64
64
|
*
|
|
65
65
|
* Live examples:
|
|
66
66
|
* - [Animated Combobox](https://ariakit.org/examples/combobox-animated)
|
|
@@ -73,18 +73,36 @@ export interface ComboboxItemOptions<T extends As = "div"> extends CompositeItem
|
|
|
73
73
|
*/
|
|
74
74
|
value?: string;
|
|
75
75
|
/**
|
|
76
|
-
* Whether to hide the combobox when this item is clicked.
|
|
76
|
+
* Whether to hide the combobox when this item is clicked. By default, the
|
|
77
|
+
* combobox will be hidden when the user clicks on an item with a
|
|
78
|
+
* [`value`](https://ariakit.org/reference/combobox-item#value) prop, unless
|
|
79
|
+
* the combobox is
|
|
80
|
+
* [multi-selectable](https://ariakit.org/examples/combobox-multiple).
|
|
77
81
|
*
|
|
78
82
|
* Live examples:
|
|
79
83
|
* - [Combobox with links](https://ariakit.org/examples/combobox-links)
|
|
80
|
-
* @default true
|
|
81
84
|
*/
|
|
82
85
|
hideOnClick?: BooleanOrCallback<MouseEvent<HTMLElement>>;
|
|
83
86
|
/**
|
|
84
|
-
* Whether to set the
|
|
85
|
-
*
|
|
87
|
+
* Whether to set the
|
|
88
|
+
* [`selectedValue`](https://ariakit.org/reference/combobox-provider#selectedvalue)
|
|
89
|
+
* state using this item's
|
|
90
|
+
* [`value`](https://ariakit.org/reference/combobox-item#value) when the item
|
|
91
|
+
* is clicked.
|
|
86
92
|
* @default true
|
|
87
93
|
*/
|
|
94
|
+
selectValueOnClick?: BooleanOrCallback<MouseEvent<HTMLElement>>;
|
|
95
|
+
/**
|
|
96
|
+
* Whether to set the combobox
|
|
97
|
+
* [`value`](https://ariakit.org/reference/combobox-provider#value) state
|
|
98
|
+
* using this item's
|
|
99
|
+
* [`value`](https://ariakit.org/reference/combobox-item#value) when the item
|
|
100
|
+
* is clicked. The default is `true`, unless the combobox is
|
|
101
|
+
* [multi-selectable](https://ariakit.org/examples/combobox-multiple).
|
|
102
|
+
*
|
|
103
|
+
* Live examples:
|
|
104
|
+
* - [Menu with Combobox](https://ariakit.org/examples/menu-combobox)
|
|
105
|
+
*/
|
|
88
106
|
setValueOnClick?: BooleanOrCallback<MouseEvent<HTMLElement>>;
|
|
89
107
|
/**
|
|
90
108
|
* @default false
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
var _3WCBE6SUcjs = require('../__chunks/3WCBE6SU.cjs');
|
|
5
|
+
require('../__chunks/UZNYSPKP.cjs');
|
|
6
|
+
require('../__chunks/BZTDJIVT.cjs');
|
|
7
|
+
require('../__chunks/UVBBMANL.cjs');
|
|
8
|
+
require('../__chunks/F2A2ZQDB.cjs');
|
|
9
|
+
require('../__chunks/S6UU7NA4.cjs');
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
var _RNZNGEL4cjs = require('../__chunks/RNZNGEL4.cjs');
|
|
15
|
+
require('../__chunks/EO6LS72H.cjs');
|
|
16
|
+
require('../__chunks/CJDHQUBR.cjs');
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
var _AV6KTKLEcjs = require('../__chunks/AV6KTKLE.cjs');
|
|
21
|
+
|
|
22
|
+
// src/combobox/combobox-label.ts
|
|
23
|
+
var _misc = require('@ariakit/core/utils/misc');
|
|
24
|
+
var useComboboxLabel = _RNZNGEL4cjs.createHook.call(void 0,
|
|
25
|
+
(_a) => {
|
|
26
|
+
var _b = _a, { store } = _b, props = _AV6KTKLEcjs.__objRest.call(void 0, _b, ["store"]);
|
|
27
|
+
const context = _3WCBE6SUcjs.useComboboxProviderContext.call(void 0, );
|
|
28
|
+
store = store || context;
|
|
29
|
+
_misc.invariant.call(void 0,
|
|
30
|
+
store,
|
|
31
|
+
process.env.NODE_ENV !== "production" && "ComboboxLabel must receive a `store` prop or be wrapped in a ComboboxProvider component."
|
|
32
|
+
);
|
|
33
|
+
const comboboxId = store.useState((state) => {
|
|
34
|
+
var _a2;
|
|
35
|
+
return (_a2 = state.baseElement) == null ? void 0 : _a2.id;
|
|
36
|
+
});
|
|
37
|
+
props = _AV6KTKLEcjs.__spreadValues.call(void 0, {
|
|
38
|
+
htmlFor: comboboxId
|
|
39
|
+
}, props);
|
|
40
|
+
return props;
|
|
41
|
+
}
|
|
42
|
+
);
|
|
43
|
+
var ComboboxLabel = _RNZNGEL4cjs.createMemoComponent.call(void 0,
|
|
44
|
+
(props) => {
|
|
45
|
+
const htmlProps = useComboboxLabel(props);
|
|
46
|
+
return _RNZNGEL4cjs.createElement.call(void 0, "label", htmlProps);
|
|
47
|
+
}
|
|
48
|
+
);
|
|
49
|
+
if (process.env.NODE_ENV !== "production") {
|
|
50
|
+
ComboboxLabel.displayName = "ComboboxLabel";
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
exports.ComboboxLabel = ComboboxLabel; exports.useComboboxLabel = useComboboxLabel;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { As, Options, Props } from "../utils/types.js";
|
|
2
|
+
import type { ComboboxStore } from "./combobox-store.js";
|
|
3
|
+
/**
|
|
4
|
+
* Returns props to create a `ComboboxLabel` component.
|
|
5
|
+
* @see https://ariakit.org/components/combobox
|
|
6
|
+
* @example
|
|
7
|
+
* ```jsx
|
|
8
|
+
* const store = useComboboxStore();
|
|
9
|
+
* const props = useComboboxLabel({ store });
|
|
10
|
+
* <Role {...props}>Favorite fruit</Role>
|
|
11
|
+
* <Combobox store={store} />
|
|
12
|
+
* ```
|
|
13
|
+
*/
|
|
14
|
+
export declare const useComboboxLabel: import("../utils/types.js").Hook<ComboboxLabelOptions<"label">>;
|
|
15
|
+
/**
|
|
16
|
+
* Renders a label for the [`Combobox`](https://ariakit.org/reference/combobox)
|
|
17
|
+
* component.
|
|
18
|
+
* @see https://ariakit.org/components/combobox
|
|
19
|
+
* @example
|
|
20
|
+
* ```jsx {2}
|
|
21
|
+
* <ComboboxProvider>
|
|
22
|
+
* <ComboboxLabel>Favorite fruit</ComboboxLabel>
|
|
23
|
+
* <Combobox />
|
|
24
|
+
* <ComboboxPopover>
|
|
25
|
+
* <ComboboxItem value="Apple" />
|
|
26
|
+
* <ComboboxItem value="Orange" />
|
|
27
|
+
* </ComboboxPopover>
|
|
28
|
+
* </ComboboxProvider>
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
31
|
+
export declare const ComboboxLabel: import("../utils/types.js").Component<ComboboxLabelOptions<"label">>;
|
|
32
|
+
export interface ComboboxLabelOptions<T extends As = "label"> extends Options<T> {
|
|
33
|
+
/**
|
|
34
|
+
* Object returned by the
|
|
35
|
+
* [`useComboboxStore`](https://ariakit.org/reference/use-combobox-store)
|
|
36
|
+
* hook. If not provided, the closest
|
|
37
|
+
* [`ComboboxProvider`](https://ariakit.org/reference/combobox-provider)
|
|
38
|
+
* component's context will be used.
|
|
39
|
+
*/
|
|
40
|
+
store?: ComboboxStore;
|
|
41
|
+
}
|
|
42
|
+
export type ComboboxLabelProps<T extends As = "label"> = Props<ComboboxLabelOptions<T>>;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { As, Options, Props } from "../utils/types.js";
|
|
2
|
+
import type { ComboboxStore } from "./combobox-store.js";
|
|
3
|
+
/**
|
|
4
|
+
* Returns props to create a `ComboboxLabel` component.
|
|
5
|
+
* @see https://ariakit.org/components/combobox
|
|
6
|
+
* @example
|
|
7
|
+
* ```jsx
|
|
8
|
+
* const store = useComboboxStore();
|
|
9
|
+
* const props = useComboboxLabel({ store });
|
|
10
|
+
* <Role {...props}>Favorite fruit</Role>
|
|
11
|
+
* <Combobox store={store} />
|
|
12
|
+
* ```
|
|
13
|
+
*/
|
|
14
|
+
export declare const useComboboxLabel: import("../utils/types.js").Hook<ComboboxLabelOptions<"label">>;
|
|
15
|
+
/**
|
|
16
|
+
* Renders a label for the [`Combobox`](https://ariakit.org/reference/combobox)
|
|
17
|
+
* component.
|
|
18
|
+
* @see https://ariakit.org/components/combobox
|
|
19
|
+
* @example
|
|
20
|
+
* ```jsx {2}
|
|
21
|
+
* <ComboboxProvider>
|
|
22
|
+
* <ComboboxLabel>Favorite fruit</ComboboxLabel>
|
|
23
|
+
* <Combobox />
|
|
24
|
+
* <ComboboxPopover>
|
|
25
|
+
* <ComboboxItem value="Apple" />
|
|
26
|
+
* <ComboboxItem value="Orange" />
|
|
27
|
+
* </ComboboxPopover>
|
|
28
|
+
* </ComboboxProvider>
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
31
|
+
export declare const ComboboxLabel: import("../utils/types.js").Component<ComboboxLabelOptions<"label">>;
|
|
32
|
+
export interface ComboboxLabelOptions<T extends As = "label"> extends Options<T> {
|
|
33
|
+
/**
|
|
34
|
+
* Object returned by the
|
|
35
|
+
* [`useComboboxStore`](https://ariakit.org/reference/use-combobox-store)
|
|
36
|
+
* hook. If not provided, the closest
|
|
37
|
+
* [`ComboboxProvider`](https://ariakit.org/reference/combobox-provider)
|
|
38
|
+
* component's context will be used.
|
|
39
|
+
*/
|
|
40
|
+
store?: ComboboxStore;
|
|
41
|
+
}
|
|
42
|
+
export type ComboboxLabelProps<T extends As = "label"> = Props<ComboboxLabelOptions<T>>;
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
|
|
5
|
-
var
|
|
6
|
-
require('../__chunks/
|
|
5
|
+
var _WH4I6OSNcjs = require('../__chunks/WH4I6OSN.cjs');
|
|
6
|
+
require('../__chunks/3WCBE6SU.cjs');
|
|
7
7
|
require('../__chunks/UZNYSPKP.cjs');
|
|
8
8
|
require('../__chunks/BZTDJIVT.cjs');
|
|
9
9
|
require('../__chunks/7BSMGTGR.cjs');
|
|
@@ -20,4 +20,4 @@ require('../__chunks/AV6KTKLE.cjs');
|
|
|
20
20
|
|
|
21
21
|
|
|
22
22
|
|
|
23
|
-
exports.ComboboxList =
|
|
23
|
+
exports.ComboboxList = _WH4I6OSNcjs.ComboboxList; exports.useComboboxList = _WH4I6OSNcjs.useComboboxList;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
var
|
|
4
|
+
var _WH4I6OSNcjs = require('../__chunks/WH4I6OSN.cjs');
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
var
|
|
7
|
+
var _3WCBE6SUcjs = require('../__chunks/3WCBE6SU.cjs');
|
|
8
8
|
require('../__chunks/UZNYSPKP.cjs');
|
|
9
9
|
require('../__chunks/BZTDJIVT.cjs');
|
|
10
10
|
|
|
@@ -84,14 +84,14 @@ var useComboboxPopover = _RNZNGEL4cjs.createHook.call(void 0,
|
|
|
84
84
|
"alwaysVisible",
|
|
85
85
|
"hideOnInteractOutside"
|
|
86
86
|
]);
|
|
87
|
-
const context =
|
|
87
|
+
const context = _3WCBE6SUcjs.useComboboxProviderContext.call(void 0, );
|
|
88
88
|
store = store || context;
|
|
89
89
|
_misc.invariant.call(void 0,
|
|
90
90
|
store,
|
|
91
91
|
process.env.NODE_ENV !== "production" && "ComboboxPopover must receive a `store` prop or be wrapped in a ComboboxProvider component."
|
|
92
92
|
);
|
|
93
93
|
const baseElement = store.useState("baseElement");
|
|
94
|
-
props =
|
|
94
|
+
props = _WH4I6OSNcjs.useComboboxList.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, { store, alwaysVisible }, props));
|
|
95
95
|
props = _RIZYIKBEcjs.usePopover.call(void 0, _AV6KTKLEcjs.__spreadProps.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, {
|
|
96
96
|
store,
|
|
97
97
|
alwaysVisible,
|
|
@@ -126,7 +126,7 @@ var ComboboxPopover = _XFPRAS3Jcjs.createDialogComponent.call(void 0,
|
|
|
126
126
|
const htmlProps = useComboboxPopover(props);
|
|
127
127
|
return _RNZNGEL4cjs.createElement.call(void 0, "div", htmlProps);
|
|
128
128
|
}),
|
|
129
|
-
|
|
129
|
+
_3WCBE6SUcjs.useComboboxProviderContext
|
|
130
130
|
);
|
|
131
131
|
if (process.env.NODE_ENV !== "production") {
|
|
132
132
|
ComboboxPopover.displayName = "ComboboxPopover";
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
var
|
|
4
|
+
var _L3WS5HGIcjs = require('../__chunks/L3WS5HGI.cjs');
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
var
|
|
7
|
+
var _3WCBE6SUcjs = require('../__chunks/3WCBE6SU.cjs');
|
|
8
8
|
require('../__chunks/A5RWZSX7.cjs');
|
|
9
9
|
require('../__chunks/TUVU5ERH.cjs');
|
|
10
10
|
require('../__chunks/UZNYSPKP.cjs');
|
|
@@ -24,8 +24,8 @@ require('../__chunks/AV6KTKLE.cjs');
|
|
|
24
24
|
// src/combobox/combobox-provider.tsx
|
|
25
25
|
var _jsxruntime = require('react/jsx-runtime');
|
|
26
26
|
function ComboboxProvider(props = {}) {
|
|
27
|
-
const store =
|
|
28
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
27
|
+
const store = _L3WS5HGIcjs.useComboboxStore.call(void 0, props);
|
|
28
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _3WCBE6SUcjs.ComboboxContextProvider, { value: store, children: props.children });
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import type { ReactNode } from "react";
|
|
2
|
-
import type {
|
|
1
|
+
import type { ReactElement, ReactNode } from "react";
|
|
2
|
+
import type { PickRequired } from "@ariakit/core/utils/types";
|
|
3
|
+
import type { ComboboxStoreProps, ComboboxStoreSelectedValue } from "./combobox-store.js";
|
|
4
|
+
type Value = ComboboxStoreSelectedValue;
|
|
3
5
|
/**
|
|
4
6
|
* Provides a combobox store to Combobox components.
|
|
5
7
|
* @see https://ariakit.org/components/combobox
|
|
@@ -15,7 +17,9 @@ import type { ComboboxStoreProps } from "./combobox-store.js";
|
|
|
15
17
|
* </ComboboxProvider>
|
|
16
18
|
* ```
|
|
17
19
|
*/
|
|
18
|
-
export declare function ComboboxProvider(props
|
|
19
|
-
export
|
|
20
|
+
export declare function ComboboxProvider<T extends Value = Value>(props: PickRequired<ComboboxProviderProps<T>, "selectedValue" | "defaultSelectedValue">): ReactElement;
|
|
21
|
+
export declare function ComboboxProvider(props?: ComboboxProviderProps): ReactElement;
|
|
22
|
+
export interface ComboboxProviderProps<T extends Value = Value> extends ComboboxStoreProps<T> {
|
|
20
23
|
children?: ReactNode;
|
|
21
24
|
}
|
|
25
|
+
export {};
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import type { ReactNode } from "react";
|
|
2
|
-
import type {
|
|
1
|
+
import type { ReactElement, ReactNode } from "react";
|
|
2
|
+
import type { PickRequired } from "@ariakit/core/utils/types";
|
|
3
|
+
import type { ComboboxStoreProps, ComboboxStoreSelectedValue } from "./combobox-store.js";
|
|
4
|
+
type Value = ComboboxStoreSelectedValue;
|
|
3
5
|
/**
|
|
4
6
|
* Provides a combobox store to Combobox components.
|
|
5
7
|
* @see https://ariakit.org/components/combobox
|
|
@@ -15,7 +17,9 @@ import type { ComboboxStoreProps } from "./combobox-store.js";
|
|
|
15
17
|
* </ComboboxProvider>
|
|
16
18
|
* ```
|
|
17
19
|
*/
|
|
18
|
-
export declare function ComboboxProvider(props
|
|
19
|
-
export
|
|
20
|
+
export declare function ComboboxProvider<T extends Value = Value>(props: PickRequired<ComboboxProviderProps<T>, "selectedValue" | "defaultSelectedValue">): ReactElement;
|
|
21
|
+
export declare function ComboboxProvider(props?: ComboboxProviderProps): ReactElement;
|
|
22
|
+
export interface ComboboxProviderProps<T extends Value = Value> extends ComboboxStoreProps<T> {
|
|
20
23
|
children?: ReactNode;
|
|
21
24
|
}
|
|
25
|
+
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
var
|
|
4
|
+
var _3WCBE6SUcjs = require('../__chunks/3WCBE6SU.cjs');
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
var _GJX4AG2Lcjs = require('../__chunks/GJX4AG2L.cjs');
|
|
@@ -28,7 +28,7 @@ var _misc = require('@ariakit/core/utils/misc');
|
|
|
28
28
|
var useComboboxRow = _RNZNGEL4cjs.createHook.call(void 0,
|
|
29
29
|
(_a) => {
|
|
30
30
|
var _b = _a, { store } = _b, props = _AV6KTKLEcjs.__objRest.call(void 0, _b, ["store"]);
|
|
31
|
-
const context =
|
|
31
|
+
const context = _3WCBE6SUcjs.useComboboxScopedContext.call(void 0, );
|
|
32
32
|
store = store || context;
|
|
33
33
|
_misc.invariant.call(void 0,
|
|
34
34
|
store,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
var
|
|
4
|
+
var _3WCBE6SUcjs = require('../__chunks/3WCBE6SU.cjs');
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
var _F34KLJKGcjs = require('../__chunks/F34KLJKG.cjs');
|
|
@@ -28,7 +28,7 @@ var _misc = require('@ariakit/core/utils/misc');
|
|
|
28
28
|
var useComboboxSeparator = _RNZNGEL4cjs.createHook.call(void 0,
|
|
29
29
|
(_a) => {
|
|
30
30
|
var _b = _a, { store } = _b, props = _AV6KTKLEcjs.__objRest.call(void 0, _b, ["store"]);
|
|
31
|
-
const context =
|
|
31
|
+
const context = _3WCBE6SUcjs.useComboboxScopedContext.call(void 0, );
|
|
32
32
|
store = store || context;
|
|
33
33
|
_misc.invariant.call(void 0,
|
|
34
34
|
store,
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
|
|
5
|
-
var
|
|
5
|
+
var _L3WS5HGIcjs = require('../__chunks/L3WS5HGI.cjs');
|
|
6
6
|
require('../__chunks/A5RWZSX7.cjs');
|
|
7
7
|
require('../__chunks/TUVU5ERH.cjs');
|
|
8
8
|
require('../__chunks/65GJIQK5.cjs');
|
|
@@ -15,4 +15,4 @@ require('../__chunks/AV6KTKLE.cjs');
|
|
|
15
15
|
|
|
16
16
|
|
|
17
17
|
|
|
18
|
-
exports.useComboboxStore =
|
|
18
|
+
exports.useComboboxStore = _L3WS5HGIcjs.useComboboxStore; exports.useComboboxStoreProps = _L3WS5HGIcjs.useComboboxStoreProps;
|
|
@@ -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,15 +19,19 @@ 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
37
|
* - [Combobox with integrated
|
|
@@ -36,9 +42,21 @@ export interface ComboboxStoreOptions extends Core.ComboboxStoreOptions, Composi
|
|
|
36
42
|
* Combobox](https://ariakit.org/examples/combobox-multiple)
|
|
37
43
|
* - [Menu with Combobox](https://ariakit.org/examples/menu-combobox)
|
|
38
44
|
* - [Select with Combobox](https://ariakit.org/examples/select-combobox)
|
|
39
|
-
* @param value The new value.
|
|
40
45
|
*/
|
|
41
|
-
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>> {
|
|
42
61
|
}
|
|
43
|
-
export
|
|
44
|
-
export type ComboboxStore = ComboboxStoreFunctions & Store<Core.ComboboxStore>;
|
|
62
|
+
export {};
|
|
@@ -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,15 +19,19 @@ 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
37
|
* - [Combobox with integrated
|
|
@@ -36,9 +42,21 @@ export interface ComboboxStoreOptions extends Core.ComboboxStoreOptions, Composi
|
|
|
36
42
|
* Combobox](https://ariakit.org/examples/combobox-multiple)
|
|
37
43
|
* - [Menu with Combobox](https://ariakit.org/examples/menu-combobox)
|
|
38
44
|
* - [Select with Combobox](https://ariakit.org/examples/select-combobox)
|
|
39
|
-
* @param value The new value.
|
|
40
45
|
*/
|
|
41
|
-
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>> {
|
|
42
61
|
}
|
|
43
|
-
export
|
|
44
|
-
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');
|
|
@@ -101,7 +101,7 @@ var useCombobox = _RNZNGEL4cjs.createHook.call(void 0,
|
|
|
101
101
|
"moveOnKeyPress",
|
|
102
102
|
"autoComplete"
|
|
103
103
|
]);
|
|
104
|
-
const context =
|
|
104
|
+
const context = _3WCBE6SUcjs.useComboboxProviderContext.call(void 0, );
|
|
105
105
|
store = store || context;
|
|
106
106
|
_misc.invariant.call(void 0,
|
|
107
107
|
store,
|
|
@@ -231,15 +231,16 @@ var useCombobox = _RNZNGEL4cjs.createHook.call(void 0,
|
|
|
231
231
|
return;
|
|
232
232
|
canAutoSelectRef.current = false;
|
|
233
233
|
}, [open]);
|
|
234
|
+
const resetValueOnSelect = store.useState("resetValueOnSelect");
|
|
234
235
|
_EO6LS72Hcjs.useUpdateEffect.call(void 0, () => {
|
|
235
|
-
var _a2;
|
|
236
|
+
var _a2, _b2;
|
|
236
237
|
if (!store)
|
|
237
238
|
return;
|
|
238
|
-
if (!autoSelect)
|
|
239
|
+
if (!autoSelect && !resetValueOnSelect)
|
|
239
240
|
return;
|
|
240
241
|
if (!canAutoSelectRef.current)
|
|
241
242
|
return;
|
|
242
|
-
const { baseElement, contentElement: contentElement2 } = store.getState();
|
|
243
|
+
const { baseElement, contentElement: contentElement2, activeId } = store.getState();
|
|
243
244
|
if (baseElement && !_focus.hasFocus.call(void 0, baseElement))
|
|
244
245
|
return;
|
|
245
246
|
if (contentElement2 == null ? void 0 : contentElement2.hasAttribute("data-placing")) {
|
|
@@ -247,14 +248,23 @@ var useCombobox = _RNZNGEL4cjs.createHook.call(void 0,
|
|
|
247
248
|
observer.observe(contentElement2, { attributeFilter: ["data-placing"] });
|
|
248
249
|
return () => observer.disconnect();
|
|
249
250
|
}
|
|
250
|
-
|
|
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
|
+
}
|
|
251
259
|
return;
|
|
252
|
-
}, [
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
260
|
+
}, [
|
|
261
|
+
store,
|
|
262
|
+
valueUpdated,
|
|
263
|
+
storeValue,
|
|
264
|
+
autoSelect,
|
|
265
|
+
resetValueOnSelect,
|
|
266
|
+
items
|
|
267
|
+
]);
|
|
258
268
|
_react.useEffect.call(void 0, () => {
|
|
259
269
|
if (!inline)
|
|
260
270
|
return;
|
|
@@ -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
|
+
* - [Multi-selectable
|
|
50
|
+
* Combobox](https://ariakit.org/examples/combobox-multiple)
|
|
49
51
|
* - [Combobox with integrated
|
|
50
52
|
* filter](https://ariakit.org/examples/combobox-filtering-integrated)
|
|
51
53
|
* - [Textarea with inline
|
|
@@ -60,6 +62,7 @@ export interface CompositeHoverOptions<T extends As = "div"> extends Options<T>
|
|
|
60
62
|
* is `true`.
|
|
61
63
|
*
|
|
62
64
|
* Live examples:
|
|
65
|
+
* - [Navigation Menubar](https://ariakit.org/examples/menubar-navigation)
|
|
63
66
|
* - [Combobox with integrated
|
|
64
67
|
* filter](https://ariakit.org/examples/combobox-filtering-integrated)
|
|
65
68
|
*/
|
|
@@ -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
|
+
* - [Multi-selectable
|
|
50
|
+
* Combobox](https://ariakit.org/examples/combobox-multiple)
|
|
49
51
|
* - [Combobox with integrated
|
|
50
52
|
* filter](https://ariakit.org/examples/combobox-filtering-integrated)
|
|
51
53
|
* - [Textarea with inline
|
|
@@ -60,6 +62,7 @@ export interface CompositeHoverOptions<T extends As = "div"> extends Options<T>
|
|
|
60
62
|
* is `true`.
|
|
61
63
|
*
|
|
62
64
|
* Live examples:
|
|
65
|
+
* - [Navigation Menubar](https://ariakit.org/examples/menubar-navigation)
|
|
63
66
|
* - [Combobox with integrated
|
|
64
67
|
* filter](https://ariakit.org/examples/combobox-filtering-integrated)
|
|
65
68
|
*/
|
|
@@ -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
|
}
|
|
@@ -61,6 +61,7 @@ export interface DisclosureContentOptions<T extends As = "div"> extends Options<
|
|
|
61
61
|
* the DOM when it's hidden.
|
|
62
62
|
*
|
|
63
63
|
* Live examples:
|
|
64
|
+
* - [Navigation Menubar](https://ariakit.org/examples/menubar-navigation)
|
|
64
65
|
* - [Combobox with integrated
|
|
65
66
|
* filter](https://ariakit.org/examples/combobox-filtering-integrated)
|
|
66
67
|
* - [Textarea with inline
|