@ariakit/core 0.3.7 → 0.3.9
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 +11 -0
- package/cjs/__chunks/{GZDVJEID.cjs → 2LS4JJ4S.cjs} +2 -2
- package/cjs/__chunks/{46BH65MC.cjs → 2UK5WUJX.cjs} +15 -7
- package/cjs/__chunks/{PD7XZBXC.cjs → 5SIVMOID.cjs} +4 -4
- package/cjs/__chunks/{7ZUFMSXJ.cjs → EFIT5L4X.cjs} +7 -7
- package/cjs/__chunks/{MEHGRTJ3.cjs → GJFZ5ZPP.cjs} +11 -11
- package/cjs/__chunks/{6WBY3ZZM.cjs → JNFZSNOI.cjs} +6 -6
- package/cjs/__chunks/{JLC5A6WF.cjs → UCLKUBNP.cjs} +35 -25
- package/cjs/__chunks/{GXIZMD53.cjs → UTICNXST.cjs} +4 -4
- package/cjs/checkbox/checkbox-store.cjs +3 -3
- package/cjs/checkbox/checkbox-store.d.cts +9 -9
- package/cjs/checkbox/checkbox-store.d.ts +9 -9
- package/cjs/collection/collection-store.cjs +3 -3
- package/cjs/collection/collection-store.d.cts +16 -12
- package/cjs/collection/collection-store.d.ts +16 -12
- package/cjs/combobox/combobox-store.cjs +20 -20
- package/cjs/combobox/combobox-store.d.cts +14 -14
- package/cjs/combobox/combobox-store.d.ts +14 -14
- package/cjs/composite/composite-overflow-store.cjs +5 -5
- package/cjs/composite/composite-overflow-store.d.cts +13 -7
- package/cjs/composite/composite-overflow-store.d.ts +13 -7
- package/cjs/composite/composite-store.cjs +4 -4
- package/cjs/composite/composite-store.d.cts +31 -14
- package/cjs/composite/composite-store.d.ts +31 -14
- package/cjs/dialog/dialog-store.cjs +4 -4
- package/cjs/dialog/dialog-store.d.cts +12 -6
- package/cjs/dialog/dialog-store.d.ts +12 -6
- package/cjs/disclosure/disclosure-store.cjs +3 -3
- package/cjs/disclosure/disclosure-store.d.cts +4 -2
- package/cjs/disclosure/disclosure-store.d.ts +4 -2
- package/cjs/form/form-store.cjs +7 -7
- package/cjs/form/form-store.d.cts +15 -15
- package/cjs/form/form-store.d.ts +15 -15
- package/cjs/hovercard/hovercard-store.cjs +6 -6
- package/cjs/hovercard/hovercard-store.d.cts +11 -5
- package/cjs/hovercard/hovercard-store.d.ts +11 -5
- package/cjs/menu/menu-bar-store.cjs +5 -5
- package/cjs/menu/menu-bar-store.d.cts +12 -6
- package/cjs/menu/menu-bar-store.d.ts +12 -6
- package/cjs/menu/menu-store.cjs +18 -18
- package/cjs/menu/menu-store.d.cts +20 -10
- package/cjs/menu/menu-store.d.ts +20 -10
- package/cjs/menubar/menubar-store.cjs +5 -5
- package/cjs/menubar/menubar-store.d.cts +1 -1
- package/cjs/menubar/menubar-store.d.ts +1 -1
- package/cjs/popover/popover-store.cjs +5 -5
- package/cjs/popover/popover-store.d.cts +7 -3
- package/cjs/popover/popover-store.d.ts +7 -3
- package/cjs/radio/radio-store.cjs +5 -5
- package/cjs/radio/radio-store.d.cts +5 -3
- package/cjs/radio/radio-store.d.ts +5 -3
- package/cjs/select/select-store.cjs +18 -18
- package/cjs/select/select-store.d.cts +14 -16
- package/cjs/select/select-store.d.ts +14 -16
- package/cjs/tab/tab-store.cjs +15 -15
- package/cjs/tab/tab-store.d.cts +15 -16
- package/cjs/tab/tab-store.d.ts +15 -16
- package/cjs/toolbar/toolbar-store.cjs +4 -4
- package/cjs/toolbar/toolbar-store.d.cts +9 -6
- package/cjs/toolbar/toolbar-store.d.ts +9 -6
- package/cjs/tooltip/tooltip-store.cjs +7 -7
- package/cjs/tooltip/tooltip-store.d.cts +5 -3
- package/cjs/tooltip/tooltip-store.d.ts +5 -3
- package/cjs/utils/store.cjs +2 -2
- package/esm/__chunks/{E7OQVGGY.js → A2J4XZ5T.js} +15 -7
- package/esm/__chunks/{OGMLJYDV.js → DLX2AS6C.js} +2 -2
- package/esm/__chunks/{ANO6WJO4.js → EZ2TTBAQ.js} +2 -2
- package/esm/__chunks/{WY3EMTH6.js → J6JIOWCS.js} +2 -2
- package/esm/__chunks/{CL47ZAPY.js → LT2OYWRD.js} +1 -1
- package/esm/__chunks/{DYD4YNLE.js → NKLTHWCR.js} +1 -1
- package/esm/__chunks/{BXH3I7ML.js → T3DVYGXI.js} +2 -2
- package/esm/__chunks/{CCU5UHQ2.js → TLN4ALYH.js} +32 -22
- package/esm/checkbox/checkbox-store.d.ts +9 -9
- package/esm/checkbox/checkbox-store.js +1 -1
- package/esm/collection/collection-store.d.ts +16 -12
- package/esm/collection/collection-store.js +2 -2
- package/esm/combobox/combobox-store.d.ts +14 -14
- package/esm/combobox/combobox-store.js +6 -6
- package/esm/composite/composite-overflow-store.d.ts +13 -7
- package/esm/composite/composite-overflow-store.js +4 -4
- package/esm/composite/composite-store.d.ts +31 -14
- package/esm/composite/composite-store.js +3 -3
- package/esm/dialog/dialog-store.d.ts +12 -6
- package/esm/dialog/dialog-store.js +3 -3
- package/esm/disclosure/disclosure-store.d.ts +4 -2
- package/esm/disclosure/disclosure-store.js +2 -2
- package/esm/form/form-store.d.ts +15 -15
- package/esm/form/form-store.js +2 -2
- package/esm/hovercard/hovercard-store.d.ts +11 -5
- package/esm/hovercard/hovercard-store.js +5 -5
- package/esm/menu/menu-bar-store.d.ts +12 -6
- package/esm/menu/menu-bar-store.js +4 -4
- package/esm/menu/menu-store.d.ts +20 -10
- package/esm/menu/menu-store.js +7 -7
- package/esm/menubar/menubar-store.d.ts +1 -1
- package/esm/menubar/menubar-store.js +4 -4
- package/esm/popover/popover-store.d.ts +7 -3
- package/esm/popover/popover-store.js +4 -4
- package/esm/radio/radio-store.d.ts +5 -3
- package/esm/radio/radio-store.js +3 -3
- package/esm/select/select-store.d.ts +14 -16
- package/esm/select/select-store.js +6 -6
- package/esm/tab/tab-store.d.ts +15 -16
- package/esm/tab/tab-store.js +3 -3
- package/esm/toolbar/toolbar-store.d.ts +9 -6
- package/esm/toolbar/toolbar-store.js +3 -3
- package/esm/tooltip/tooltip-store.d.ts +5 -3
- package/esm/tooltip/tooltip-store.js +5 -5
- package/esm/utils/store.js +1 -1
- package/package.json +1 -1
|
@@ -2,18 +2,28 @@ import type { CollectionStoreFunctions, CollectionStoreItem, CollectionStoreOpti
|
|
|
2
2
|
import type { Store, StoreOptions, StoreProps } from "../utils/store.js";
|
|
3
3
|
import type { SetState } from "../utils/types.js";
|
|
4
4
|
type Orientation = "horizontal" | "vertical" | "both";
|
|
5
|
-
interface Item extends CollectionStoreItem {
|
|
6
|
-
rowId?: string;
|
|
7
|
-
disabled?: boolean;
|
|
8
|
-
children?: string;
|
|
9
|
-
}
|
|
10
5
|
/**
|
|
11
6
|
* Creates a composite store.
|
|
12
7
|
*/
|
|
13
|
-
export declare function createCompositeStore<T extends
|
|
8
|
+
export declare function createCompositeStore<T extends CompositeStoreItem = CompositeStoreItem>(props?: CompositeStoreProps<T>): CompositeStore<T>;
|
|
14
9
|
export type CompositeStoreOrientation = Orientation;
|
|
15
|
-
export
|
|
16
|
-
|
|
10
|
+
export interface CompositeStoreItem extends CollectionStoreItem {
|
|
11
|
+
/**
|
|
12
|
+
* The row id of the item. This is only used on two-dimensional composites
|
|
13
|
+
* (when using `CompositeRow`).
|
|
14
|
+
*/
|
|
15
|
+
rowId?: string;
|
|
16
|
+
/**
|
|
17
|
+
* If enabled, the item will be disabled and users won't be able to focus it
|
|
18
|
+
* using arrow keys.
|
|
19
|
+
*/
|
|
20
|
+
disabled?: boolean;
|
|
21
|
+
/**
|
|
22
|
+
* The item children. This can be used for typeahead purposes.
|
|
23
|
+
*/
|
|
24
|
+
children?: string;
|
|
25
|
+
}
|
|
26
|
+
export interface CompositeStoreState<T extends CompositeStoreItem = CompositeStoreItem> extends CollectionStoreState<T> {
|
|
17
27
|
/**
|
|
18
28
|
* The composite element.
|
|
19
29
|
*/
|
|
@@ -101,8 +111,15 @@ export interface CompositeStoreState<T extends Item = Item> extends CollectionSt
|
|
|
101
111
|
*/
|
|
102
112
|
moves: number;
|
|
103
113
|
/**
|
|
104
|
-
* Indicates
|
|
105
|
-
* order.
|
|
114
|
+
* Indicates if the composite element (such as `menu`, `combobox`, `listbox`,
|
|
115
|
+
* `toolbar`, etc.) should be part of the focus order. In other words, moving
|
|
116
|
+
* to the previous element when the first item is in focus will focus on the
|
|
117
|
+
* composite element itself. The same applies to the last item when moving to
|
|
118
|
+
* the next element.
|
|
119
|
+
*
|
|
120
|
+
* Live examples:
|
|
121
|
+
* - [Submenu with
|
|
122
|
+
* Combobox](https://ariakit.org/examples/menu-nested-combobox)
|
|
106
123
|
* @default false
|
|
107
124
|
*/
|
|
108
125
|
includesBaseElement: boolean;
|
|
@@ -117,7 +134,7 @@ export interface CompositeStoreState<T extends Item = Item> extends CollectionSt
|
|
|
117
134
|
*/
|
|
118
135
|
activeId: string | null | undefined;
|
|
119
136
|
}
|
|
120
|
-
export interface CompositeStoreFunctions<T extends
|
|
137
|
+
export interface CompositeStoreFunctions<T extends CompositeStoreItem = CompositeStoreItem> extends CollectionStoreFunctions<T> {
|
|
121
138
|
/**
|
|
122
139
|
* Sets the `baseElement`.
|
|
123
140
|
*/
|
|
@@ -188,7 +205,7 @@ export interface CompositeStoreFunctions<T extends Item = Item> extends Collecti
|
|
|
188
205
|
*/
|
|
189
206
|
last: () => string | null | undefined;
|
|
190
207
|
}
|
|
191
|
-
export interface CompositeStoreOptions<T extends
|
|
208
|
+
export interface CompositeStoreOptions<T extends CompositeStoreItem = CompositeStoreItem> extends CollectionStoreOptions<T>, StoreOptions<CompositeStoreState<T>, "virtualFocus" | "orientation" | "rtl" | "focusLoop" | "focusWrap" | "focusShift" | "includesBaseElement" | "activeId"> {
|
|
192
209
|
/**
|
|
193
210
|
* The composite item id that should be active by default when the composite
|
|
194
211
|
* widget is rendered. If `null`, the composite element itself will have focus
|
|
@@ -197,8 +214,8 @@ export interface CompositeStoreOptions<T extends Item = Item> extends StoreOptio
|
|
|
197
214
|
*/
|
|
198
215
|
defaultActiveId?: CompositeStoreState<T>["activeId"];
|
|
199
216
|
}
|
|
200
|
-
export interface CompositeStoreProps<T extends
|
|
217
|
+
export interface CompositeStoreProps<T extends CompositeStoreItem = CompositeStoreItem> extends CompositeStoreOptions<T>, StoreProps<CompositeStoreState<T>> {
|
|
201
218
|
}
|
|
202
|
-
export interface CompositeStore<T extends
|
|
219
|
+
export interface CompositeStore<T extends CompositeStoreItem = CompositeStoreItem> extends CompositeStoreFunctions<T>, Store<CompositeStoreState<T>> {
|
|
203
220
|
}
|
|
204
221
|
export {};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
3
|
createCompositeStore
|
|
4
|
-
} from "../__chunks/
|
|
5
|
-
import "../__chunks/
|
|
6
|
-
import "../__chunks/
|
|
4
|
+
} from "../__chunks/DLX2AS6C.js";
|
|
5
|
+
import "../__chunks/TLN4ALYH.js";
|
|
6
|
+
import "../__chunks/A2J4XZ5T.js";
|
|
7
7
|
import "../__chunks/I2VQ3XGR.js";
|
|
8
8
|
import "../__chunks/DLOEKDPY.js";
|
|
9
9
|
import "../__chunks/7PRQYBBV.js";
|
|
@@ -1,10 +1,16 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { DisclosureStoreFunctions, DisclosureStoreOptions, DisclosureStoreState } from "../disclosure/disclosure-store.js";
|
|
2
|
+
import type { Store, StoreProps } from "../utils/store.js";
|
|
2
3
|
/**
|
|
3
4
|
* Creates a dialog store.
|
|
4
5
|
*/
|
|
5
6
|
export declare function createDialogStore(props?: DialogStoreProps): DialogStore;
|
|
6
|
-
export
|
|
7
|
-
|
|
8
|
-
export
|
|
9
|
-
|
|
10
|
-
export
|
|
7
|
+
export interface DialogStoreState extends DisclosureStoreState {
|
|
8
|
+
}
|
|
9
|
+
export interface DialogStoreFunctions extends DisclosureStoreFunctions {
|
|
10
|
+
}
|
|
11
|
+
export interface DialogStoreOptions extends DisclosureStoreOptions {
|
|
12
|
+
}
|
|
13
|
+
export interface DialogStoreProps extends DialogStoreOptions, StoreProps<DialogStoreState> {
|
|
14
|
+
}
|
|
15
|
+
export interface DialogStore extends DialogStoreFunctions, Store<DialogStoreState> {
|
|
16
|
+
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
3
|
createDialogStore
|
|
4
|
-
} from "../__chunks/
|
|
5
|
-
import "../__chunks/
|
|
6
|
-
import "../__chunks/
|
|
4
|
+
} from "../__chunks/LT2OYWRD.js";
|
|
5
|
+
import "../__chunks/NKLTHWCR.js";
|
|
6
|
+
import "../__chunks/A2J4XZ5T.js";
|
|
7
7
|
import "../__chunks/I2VQ3XGR.js";
|
|
8
8
|
import "../__chunks/4R3V3JGP.js";
|
|
9
9
|
export {
|
|
@@ -123,5 +123,7 @@ export interface DisclosureStoreOptions extends StoreOptions<DisclosureStoreStat
|
|
|
123
123
|
*/
|
|
124
124
|
disclosure?: DisclosureStore | null;
|
|
125
125
|
}
|
|
126
|
-
export
|
|
127
|
-
|
|
126
|
+
export interface DisclosureStoreProps extends DisclosureStoreOptions, StoreProps<DisclosureStoreState> {
|
|
127
|
+
}
|
|
128
|
+
export interface DisclosureStore extends DisclosureStoreFunctions, Store<DisclosureStoreState> {
|
|
129
|
+
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
3
|
createDisclosureStore
|
|
4
|
-
} from "../__chunks/
|
|
5
|
-
import "../__chunks/
|
|
4
|
+
} from "../__chunks/NKLTHWCR.js";
|
|
5
|
+
import "../__chunks/A2J4XZ5T.js";
|
|
6
6
|
import "../__chunks/I2VQ3XGR.js";
|
|
7
7
|
import "../__chunks/4R3V3JGP.js";
|
|
8
8
|
export {
|
package/esm/form/form-store.d.ts
CHANGED
|
@@ -2,23 +2,21 @@ import type { CollectionStoreFunctions, CollectionStoreItem, CollectionStoreOpti
|
|
|
2
2
|
import type { Store, StoreOptions, StoreProps } from "../utils/store.js";
|
|
3
3
|
import type { AnyObject, PickRequired, SetState, SetStateAction } from "../utils/types.js";
|
|
4
4
|
import type { DeepMap, DeepPartial, Names, StringLike } from "./types.js";
|
|
5
|
-
type Values = AnyObject;
|
|
6
5
|
type ErrorMessage = string | undefined | null;
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
name: string;
|
|
10
|
-
};
|
|
11
|
-
export declare function hasMessages(object: Values): boolean;
|
|
12
|
-
export declare function get<T>(values: Values, path: StringLike | string[], defaultValue?: T): T;
|
|
6
|
+
export declare function hasMessages(object: FormStoreValues): boolean;
|
|
7
|
+
export declare function get<T>(values: FormStoreValues, path: StringLike | string[], defaultValue?: T): T;
|
|
13
8
|
/**
|
|
14
9
|
* Creates a form store.
|
|
15
10
|
*/
|
|
16
|
-
export declare function createFormStore<T extends
|
|
11
|
+
export declare function createFormStore<T extends FormStoreValues = FormStoreValues>(props: PickRequired<FormStoreProps<T>, "values" | "defaultValues" | "errors" | "defaultErrors" | "touched" | "defaultTouched">): FormStore<T>;
|
|
17
12
|
export declare function createFormStore(props: FormStoreProps): FormStore;
|
|
18
13
|
export type FormStoreCallback<T extends FormStoreState = FormStoreState> = (state: T) => void | Promise<void>;
|
|
19
|
-
export type FormStoreValues =
|
|
20
|
-
export
|
|
21
|
-
|
|
14
|
+
export type FormStoreValues = AnyObject;
|
|
15
|
+
export interface FormStoreItem extends CollectionStoreItem {
|
|
16
|
+
type: "field" | "label" | "description" | "error" | "button";
|
|
17
|
+
name: string;
|
|
18
|
+
}
|
|
19
|
+
export interface FormStoreState<T extends FormStoreValues = FormStoreValues> extends CollectionStoreState<FormStoreItem> {
|
|
22
20
|
/**
|
|
23
21
|
* Form values.
|
|
24
22
|
* @default {}
|
|
@@ -54,7 +52,7 @@ export interface FormStoreState<T extends Values = Values> extends CollectionSto
|
|
|
54
52
|
*/
|
|
55
53
|
submitFailed: number;
|
|
56
54
|
}
|
|
57
|
-
export interface FormStoreFunctions<T extends
|
|
55
|
+
export interface FormStoreFunctions<T extends FormStoreValues = FormStoreValues> extends CollectionStoreFunctions<FormStoreItem> {
|
|
58
56
|
/**
|
|
59
57
|
* An object containing the names of the form fields for type-safety.
|
|
60
58
|
* @example
|
|
@@ -216,7 +214,7 @@ export interface FormStoreFunctions<T extends Values = Values> extends Collectio
|
|
|
216
214
|
*/
|
|
217
215
|
reset: () => void;
|
|
218
216
|
}
|
|
219
|
-
export interface FormStoreOptions<T extends
|
|
217
|
+
export interface FormStoreOptions<T extends FormStoreValues = FormStoreValues> extends CollectionStoreOptions<FormStoreItem>, StoreOptions<FormStoreState<T>, "values" | "errors" | "touched"> {
|
|
220
218
|
/**
|
|
221
219
|
* The default values of the form.
|
|
222
220
|
* @default {}
|
|
@@ -231,6 +229,8 @@ export interface FormStoreOptions<T extends Values = Values> extends StoreOption
|
|
|
231
229
|
*/
|
|
232
230
|
defaultTouched?: FormStoreState<T>["touched"];
|
|
233
231
|
}
|
|
234
|
-
export
|
|
235
|
-
|
|
232
|
+
export interface FormStoreProps<T extends FormStoreValues = FormStoreValues> extends FormStoreOptions<T>, StoreProps<FormStoreState<T>> {
|
|
233
|
+
}
|
|
234
|
+
export interface FormStore<T extends FormStoreValues = FormStoreValues> extends FormStoreFunctions<T>, Store<FormStoreState<T>> {
|
|
235
|
+
}
|
|
236
236
|
export {};
|
package/esm/form/form-store.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
3
|
createCollectionStore
|
|
4
|
-
} from "../__chunks/
|
|
4
|
+
} from "../__chunks/TLN4ALYH.js";
|
|
5
5
|
import {
|
|
6
6
|
createStore,
|
|
7
7
|
init,
|
|
8
8
|
setup,
|
|
9
9
|
throwOnConflictingProps
|
|
10
|
-
} from "../__chunks/
|
|
10
|
+
} from "../__chunks/A2J4XZ5T.js";
|
|
11
11
|
import {
|
|
12
12
|
applyState,
|
|
13
13
|
defaultValue,
|
|
@@ -19,15 +19,19 @@ export interface HovercardStoreState extends PopoverStoreState {
|
|
|
19
19
|
timeout: number;
|
|
20
20
|
/**
|
|
21
21
|
* The amount of time in milliseconds to wait before **showing** the popover.
|
|
22
|
-
* It defaults to the value passed to
|
|
22
|
+
* It defaults to the value passed to
|
|
23
|
+
* [`timeout`](https://ariakit.org/reference/hovercard-provider#timeout).
|
|
23
24
|
*
|
|
24
25
|
* Live examples:
|
|
25
26
|
* - [Navigation Menubar](https://ariakit.org/examples/menubar-navigation)
|
|
27
|
+
* - [Submenu with
|
|
28
|
+
* Combobox](https://ariakit.org/examples/menu-nested-combobox)
|
|
26
29
|
*/
|
|
27
30
|
showTimeout?: number;
|
|
28
31
|
/**
|
|
29
32
|
* The amount of time in milliseconds to wait before **hiding** the popover.
|
|
30
|
-
* It defaults to the value passed to
|
|
33
|
+
* It defaults to the value passed to
|
|
34
|
+
* [`timeout`](https://ariakit.org/reference/hovercard-provider#timeout).
|
|
31
35
|
*
|
|
32
36
|
* Live examples:
|
|
33
37
|
* - [Navigation Menubar](https://ariakit.org/examples/menubar-navigation)
|
|
@@ -46,7 +50,9 @@ export interface HovercardStoreFunctions extends PopoverStoreFunctions {
|
|
|
46
50
|
*/
|
|
47
51
|
setAutoFocusOnShow: SetState<HovercardStoreState["autoFocusOnShow"]>;
|
|
48
52
|
}
|
|
49
|
-
export interface HovercardStoreOptions extends StoreOptions<HovercardStoreState, "placement" | "timeout" | "showTimeout" | "hideTimeout"
|
|
53
|
+
export interface HovercardStoreOptions extends PopoverStoreOptions, StoreOptions<HovercardStoreState, "placement" | "timeout" | "showTimeout" | "hideTimeout"> {
|
|
54
|
+
}
|
|
55
|
+
export interface HovercardStoreProps extends HovercardStoreOptions, StoreProps<HovercardStoreState> {
|
|
56
|
+
}
|
|
57
|
+
export interface HovercardStore extends HovercardStoreFunctions, Store<HovercardStoreState> {
|
|
50
58
|
}
|
|
51
|
-
export type HovercardStoreProps = HovercardStoreOptions & StoreProps<HovercardStoreState>;
|
|
52
|
-
export type HovercardStore = HovercardStoreFunctions & Store<HovercardStoreState>;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
3
|
createHovercardStore
|
|
4
|
-
} from "../__chunks/
|
|
5
|
-
import "../__chunks/
|
|
6
|
-
import "../__chunks/
|
|
7
|
-
import "../__chunks/
|
|
8
|
-
import "../__chunks/
|
|
4
|
+
} from "../__chunks/T3DVYGXI.js";
|
|
5
|
+
import "../__chunks/J6JIOWCS.js";
|
|
6
|
+
import "../__chunks/LT2OYWRD.js";
|
|
7
|
+
import "../__chunks/NKLTHWCR.js";
|
|
8
|
+
import "../__chunks/A2J4XZ5T.js";
|
|
9
9
|
import "../__chunks/I2VQ3XGR.js";
|
|
10
10
|
import "../__chunks/4R3V3JGP.js";
|
|
11
11
|
export {
|
|
@@ -1,10 +1,16 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { MenubarStoreFunctions, MenubarStoreOptions, MenubarStoreState } from "../menubar/menubar-store.js";
|
|
2
|
+
import type { Store, StoreProps } from "../utils/store.js";
|
|
2
3
|
/**
|
|
3
4
|
* Creates a menu bar store.
|
|
4
5
|
*/
|
|
5
6
|
export declare function createMenuBarStore(props?: MenuBarStoreProps): MenuBarStore;
|
|
6
|
-
export
|
|
7
|
-
|
|
8
|
-
export
|
|
9
|
-
|
|
10
|
-
export
|
|
7
|
+
export interface MenuBarStoreState extends MenubarStoreState {
|
|
8
|
+
}
|
|
9
|
+
export interface MenuBarStoreFunctions extends MenubarStoreFunctions {
|
|
10
|
+
}
|
|
11
|
+
export interface MenuBarStoreOptions extends MenubarStoreOptions {
|
|
12
|
+
}
|
|
13
|
+
export interface MenuBarStoreProps extends MenuBarStoreOptions, StoreProps<MenuBarStoreState> {
|
|
14
|
+
}
|
|
15
|
+
export interface MenuBarStore extends MenuBarStoreFunctions, Store<MenuBarStoreState> {
|
|
16
|
+
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
3
|
createMenubarStore
|
|
4
|
-
} from "../__chunks/
|
|
5
|
-
import "../__chunks/
|
|
6
|
-
import "../__chunks/
|
|
7
|
-
import "../__chunks/
|
|
4
|
+
} from "../__chunks/EZ2TTBAQ.js";
|
|
5
|
+
import "../__chunks/DLX2AS6C.js";
|
|
6
|
+
import "../__chunks/TLN4ALYH.js";
|
|
7
|
+
import "../__chunks/A2J4XZ5T.js";
|
|
8
8
|
import "../__chunks/I2VQ3XGR.js";
|
|
9
9
|
import "../__chunks/DLOEKDPY.js";
|
|
10
10
|
import "../__chunks/7PRQYBBV.js";
|
package/esm/menu/menu-store.d.ts
CHANGED
|
@@ -4,11 +4,10 @@ import type { HovercardStoreFunctions, HovercardStoreOptions, HovercardStoreStat
|
|
|
4
4
|
import type { Store, StoreOptions, StoreProps } from "../utils/store.js";
|
|
5
5
|
import type { BivariantCallback, PickRequired, SetState, SetStateAction } from "../utils/types.js";
|
|
6
6
|
import type { MenuBarStore } from "./menu-bar-store.js";
|
|
7
|
-
|
|
8
|
-
export declare function createMenuStore<T extends Values = Values>(props: PickRequired<MenuStoreProps<T>, "values" | "defaultValues">): MenuStore<T>;
|
|
7
|
+
export declare function createMenuStore<T extends MenuStoreValues = MenuStoreValues>(props: PickRequired<MenuStoreProps<T>, "values" | "defaultValues">): MenuStore<T>;
|
|
9
8
|
export declare function createMenuStore(props?: MenuStoreProps): MenuStore;
|
|
10
9
|
export type MenuStoreValues = Record<string, string | boolean | number | Array<string | number>>;
|
|
11
|
-
export interface MenuStoreState<T extends
|
|
10
|
+
export interface MenuStoreState<T extends MenuStoreValues = MenuStoreValues> extends CompositeStoreState, HovercardStoreState {
|
|
12
11
|
/**
|
|
13
12
|
* Determines the element that should be focused when the menu is opened.
|
|
14
13
|
*/
|
|
@@ -16,6 +15,10 @@ export interface MenuStoreState<T extends Values = Values> extends CompositeStor
|
|
|
16
15
|
/**
|
|
17
16
|
* A map of names and values that will be used by the `MenuItemCheckbox` and
|
|
18
17
|
* `MenuItemRadio` components.
|
|
18
|
+
*
|
|
19
|
+
* Live examples:
|
|
20
|
+
* - [Submenu with
|
|
21
|
+
* Combobox](https://ariakit.org/examples/menu-nested-combobox)
|
|
19
22
|
*/
|
|
20
23
|
values: T;
|
|
21
24
|
/** @default "vertical" */
|
|
@@ -25,9 +28,13 @@ export interface MenuStoreState<T extends Values = Values> extends CompositeStor
|
|
|
25
28
|
/** @default 0 */
|
|
26
29
|
hideTimeout?: HovercardStoreState["hideTimeout"];
|
|
27
30
|
}
|
|
28
|
-
export interface MenuStoreFunctions<T extends
|
|
31
|
+
export interface MenuStoreFunctions<T extends MenuStoreValues = MenuStoreValues> extends CompositeStoreFunctions, HovercardStoreFunctions, Pick<MenuStoreOptions, "combobox" | "parent" | "menubar"> {
|
|
29
32
|
/**
|
|
30
33
|
* Hides the menu and all its parent menus.
|
|
34
|
+
*
|
|
35
|
+
* Live examples:
|
|
36
|
+
* - [Submenu with
|
|
37
|
+
* Combobox](https://ariakit.org/examples/menu-nested-combobox)
|
|
31
38
|
*/
|
|
32
39
|
hideAll: () => void;
|
|
33
40
|
/**
|
|
@@ -43,15 +50,17 @@ export interface MenuStoreFunctions<T extends Values = Values> extends Pick<Menu
|
|
|
43
50
|
setValues: SetState<MenuStoreState<T>["values"]>;
|
|
44
51
|
/**
|
|
45
52
|
* Sets a specific menu value.
|
|
46
|
-
*
|
|
47
|
-
*
|
|
53
|
+
*
|
|
54
|
+
* Live examples:
|
|
55
|
+
* - [Submenu with
|
|
56
|
+
* Combobox](https://ariakit.org/examples/menu-nested-combobox)
|
|
48
57
|
* @example
|
|
49
58
|
* store.setValue("watching", ["issues"]);
|
|
50
59
|
* store.setValue("watching", (value) => [...value, "issues"]);
|
|
51
60
|
*/
|
|
52
61
|
setValue: BivariantCallback<(name: string, value: SetStateAction<MenuStoreState<T>["values"][string]>) => void>;
|
|
53
62
|
}
|
|
54
|
-
export interface MenuStoreOptions<T extends
|
|
63
|
+
export interface MenuStoreOptions<T extends MenuStoreValues = MenuStoreValues> extends CompositeStoreOptions, HovercardStoreOptions, StoreOptions<MenuStoreState<T>, "orientation" | "placement" | "hideTimeout" | "values"> {
|
|
55
64
|
/**
|
|
56
65
|
* A reference to a combobox store. This is used when combining the combobox
|
|
57
66
|
* with a menu (e.g., dropdown menu with a search input). The stores will
|
|
@@ -73,6 +82,7 @@ export interface MenuStoreOptions<T extends Values = Values> extends StoreOption
|
|
|
73
82
|
*/
|
|
74
83
|
defaultValues?: MenuStoreState<T>["values"];
|
|
75
84
|
}
|
|
76
|
-
export
|
|
77
|
-
|
|
78
|
-
export {
|
|
85
|
+
export interface MenuStoreProps<T extends MenuStoreValues = MenuStoreValues> extends MenuStoreOptions<T>, StoreProps<MenuStoreState<T>> {
|
|
86
|
+
}
|
|
87
|
+
export interface MenuStore<T extends MenuStoreValues = MenuStoreValues> extends MenuStoreFunctions<T>, Store<MenuStoreState<T>> {
|
|
88
|
+
}
|
package/esm/menu/menu-store.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
3
|
createHovercardStore
|
|
4
|
-
} from "../__chunks/
|
|
5
|
-
import "../__chunks/
|
|
6
|
-
import "../__chunks/
|
|
7
|
-
import "../__chunks/
|
|
4
|
+
} from "../__chunks/T3DVYGXI.js";
|
|
5
|
+
import "../__chunks/J6JIOWCS.js";
|
|
6
|
+
import "../__chunks/LT2OYWRD.js";
|
|
7
|
+
import "../__chunks/NKLTHWCR.js";
|
|
8
8
|
import {
|
|
9
9
|
createCompositeStore
|
|
10
|
-
} from "../__chunks/
|
|
11
|
-
import "../__chunks/
|
|
10
|
+
} from "../__chunks/DLX2AS6C.js";
|
|
11
|
+
import "../__chunks/TLN4ALYH.js";
|
|
12
12
|
import {
|
|
13
13
|
createStore,
|
|
14
14
|
mergeStore,
|
|
@@ -17,7 +17,7 @@ import {
|
|
|
17
17
|
setup,
|
|
18
18
|
sync,
|
|
19
19
|
throwOnConflictingProps
|
|
20
|
-
} from "../__chunks/
|
|
20
|
+
} from "../__chunks/A2J4XZ5T.js";
|
|
21
21
|
import {
|
|
22
22
|
applyState,
|
|
23
23
|
defaultValue
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { CompositeStoreFunctions, CompositeStoreOptions, CompositeStoreState } from "../composite/composite-store.js";
|
|
2
2
|
import type { Store, StoreProps } from "../utils/store.js";
|
|
3
3
|
/**
|
|
4
|
-
* Creates a
|
|
4
|
+
* Creates a menubar store.
|
|
5
5
|
*/
|
|
6
6
|
export declare function createMenubarStore(props?: MenubarStoreProps): MenubarStore;
|
|
7
7
|
export interface MenubarStoreState extends CompositeStoreState {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
3
|
createMenubarStore
|
|
4
|
-
} from "../__chunks/
|
|
5
|
-
import "../__chunks/
|
|
6
|
-
import "../__chunks/
|
|
7
|
-
import "../__chunks/
|
|
4
|
+
} from "../__chunks/EZ2TTBAQ.js";
|
|
5
|
+
import "../__chunks/DLX2AS6C.js";
|
|
6
|
+
import "../__chunks/TLN4ALYH.js";
|
|
7
|
+
import "../__chunks/A2J4XZ5T.js";
|
|
8
8
|
import "../__chunks/I2VQ3XGR.js";
|
|
9
9
|
import "../__chunks/DLOEKDPY.js";
|
|
10
10
|
import "../__chunks/7PRQYBBV.js";
|
|
@@ -31,6 +31,8 @@ export interface PopoverStoreState extends DialogStoreState {
|
|
|
31
31
|
*
|
|
32
32
|
* Live examples:
|
|
33
33
|
* - [Navigation Menubar](https://ariakit.org/examples/menubar-navigation)
|
|
34
|
+
* - [Submenu with
|
|
35
|
+
* Combobox](https://ariakit.org/examples/menu-nested-combobox)
|
|
34
36
|
* @default "bottom"
|
|
35
37
|
*/
|
|
36
38
|
placement: Placement;
|
|
@@ -60,13 +62,15 @@ export interface PopoverStoreFunctions extends DialogStoreFunctions {
|
|
|
60
62
|
*/
|
|
61
63
|
render: () => void;
|
|
62
64
|
}
|
|
63
|
-
export interface PopoverStoreOptions extends StoreOptions<PopoverStoreState, "placement"
|
|
65
|
+
export interface PopoverStoreOptions extends DialogStoreOptions, StoreOptions<PopoverStoreState, "placement"> {
|
|
64
66
|
/**
|
|
65
67
|
* A reference to another popover store that's controlling another popover to
|
|
66
68
|
* keep them in sync.
|
|
67
69
|
*/
|
|
68
70
|
popover?: PopoverStore | null;
|
|
69
71
|
}
|
|
70
|
-
export
|
|
71
|
-
|
|
72
|
+
export interface PopoverStoreProps extends PopoverStoreOptions, StoreProps<PopoverStoreState> {
|
|
73
|
+
}
|
|
74
|
+
export interface PopoverStore extends PopoverStoreFunctions, Store<PopoverStoreState> {
|
|
75
|
+
}
|
|
72
76
|
export {};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
3
|
createPopoverStore
|
|
4
|
-
} from "../__chunks/
|
|
5
|
-
import "../__chunks/
|
|
6
|
-
import "../__chunks/
|
|
7
|
-
import "../__chunks/
|
|
4
|
+
} from "../__chunks/J6JIOWCS.js";
|
|
5
|
+
import "../__chunks/LT2OYWRD.js";
|
|
6
|
+
import "../__chunks/NKLTHWCR.js";
|
|
7
|
+
import "../__chunks/A2J4XZ5T.js";
|
|
8
8
|
import "../__chunks/I2VQ3XGR.js";
|
|
9
9
|
import "../__chunks/4R3V3JGP.js";
|
|
10
10
|
export {
|
|
@@ -25,12 +25,14 @@ export interface RadioStoreFunctions extends CompositeStoreFunctions {
|
|
|
25
25
|
*/
|
|
26
26
|
setValue: SetState<RadioStoreState["value"]>;
|
|
27
27
|
}
|
|
28
|
-
export interface RadioStoreOptions extends StoreOptions<RadioStoreState, "focusLoop" | "value"
|
|
28
|
+
export interface RadioStoreOptions extends CompositeStoreOptions, StoreOptions<RadioStoreState, "focusLoop" | "value"> {
|
|
29
29
|
/**
|
|
30
30
|
* The default value of the radio group.
|
|
31
31
|
* @default null
|
|
32
32
|
*/
|
|
33
33
|
defaultValue?: RadioStoreState["value"];
|
|
34
34
|
}
|
|
35
|
-
export
|
|
36
|
-
|
|
35
|
+
export interface RadioStoreProps extends RadioStoreOptions, StoreProps<RadioStoreState> {
|
|
36
|
+
}
|
|
37
|
+
export interface RadioStore extends RadioStoreFunctions, Store<RadioStoreState> {
|
|
38
|
+
}
|
package/esm/radio/radio-store.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
3
|
createCompositeStore
|
|
4
|
-
} from "../__chunks/
|
|
5
|
-
import "../__chunks/
|
|
4
|
+
} from "../__chunks/DLX2AS6C.js";
|
|
5
|
+
import "../__chunks/TLN4ALYH.js";
|
|
6
6
|
import {
|
|
7
7
|
createStore
|
|
8
|
-
} from "../__chunks/
|
|
8
|
+
} from "../__chunks/A2J4XZ5T.js";
|
|
9
9
|
import {
|
|
10
10
|
defaultValue
|
|
11
11
|
} from "../__chunks/I2VQ3XGR.js";
|
|
@@ -3,24 +3,22 @@ import type { CompositeStoreFunctions, CompositeStoreItem, CompositeStoreOptions
|
|
|
3
3
|
import type { PopoverStoreFunctions, PopoverStoreOptions, PopoverStoreState } from "../popover/popover-store.js";
|
|
4
4
|
import type { Store, StoreOptions, StoreProps } from "../utils/store.js";
|
|
5
5
|
import type { PickRequired, SetState } from "../utils/types.js";
|
|
6
|
-
type
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
type MutableValue<T extends SelectStoreValue = SelectStoreValue> = T extends string ? string : T;
|
|
7
|
+
export declare function createSelectStore<T extends SelectStoreValue = SelectStoreValue>(props: PickRequired<SelectStoreProps<T>, "value" | "defaultValue">): SelectStore<T>;
|
|
8
|
+
export declare function createSelectStore(props?: SelectStoreProps): SelectStore;
|
|
9
|
+
export type SelectStoreValue = string | string[];
|
|
10
|
+
export interface SelectStoreItem extends CompositeStoreItem {
|
|
9
11
|
value?: string;
|
|
10
12
|
}
|
|
11
|
-
export
|
|
12
|
-
export declare function createSelectStore(props?: SelectStoreProps): SelectStore;
|
|
13
|
-
export type SelectStoreItem = Item;
|
|
14
|
-
export type SelectStoreValue = Value;
|
|
15
|
-
export interface SelectStoreState<T extends Value = Value> extends CompositeStoreState<Item>, PopoverStoreState {
|
|
13
|
+
export interface SelectStoreState<T extends SelectStoreValue = SelectStoreValue> extends CompositeStoreState<SelectStoreItem>, PopoverStoreState {
|
|
16
14
|
/** @default true */
|
|
17
|
-
virtualFocus: CompositeStoreState<
|
|
15
|
+
virtualFocus: CompositeStoreState<SelectStoreItem>["virtualFocus"];
|
|
18
16
|
/** @default false */
|
|
19
|
-
includesBaseElement: CompositeStoreState<
|
|
17
|
+
includesBaseElement: CompositeStoreState<SelectStoreItem>["includesBaseElement"];
|
|
20
18
|
/** @default null */
|
|
21
|
-
activeId: CompositeStoreState<
|
|
19
|
+
activeId: CompositeStoreState<SelectStoreItem>["activeId"];
|
|
22
20
|
/** @default "vertical" */
|
|
23
|
-
orientation: CompositeStoreState<
|
|
21
|
+
orientation: CompositeStoreState<SelectStoreItem>["orientation"];
|
|
24
22
|
/** @default "bottom-start" */
|
|
25
23
|
placement: PopoverStoreState["placement"];
|
|
26
24
|
/**
|
|
@@ -60,7 +58,7 @@ export interface SelectStoreState<T extends Value = Value> extends CompositeStor
|
|
|
60
58
|
*/
|
|
61
59
|
labelElement: HTMLElement | null;
|
|
62
60
|
}
|
|
63
|
-
export interface SelectStoreFunctions<T extends
|
|
61
|
+
export interface SelectStoreFunctions<T extends SelectStoreValue = SelectStoreValue> extends Pick<SelectStoreOptions<T>, "combobox">, CompositeStoreFunctions<SelectStoreItem>, PopoverStoreFunctions {
|
|
64
62
|
/**
|
|
65
63
|
* Sets the `value` state.
|
|
66
64
|
* @example
|
|
@@ -78,7 +76,7 @@ export interface SelectStoreFunctions<T extends Value = Value> extends Pick<Sele
|
|
|
78
76
|
*/
|
|
79
77
|
setLabelElement: SetState<SelectStoreState<T>["labelElement"]>;
|
|
80
78
|
}
|
|
81
|
-
export interface SelectStoreOptions<T extends
|
|
79
|
+
export interface SelectStoreOptions<T extends SelectStoreValue = SelectStoreValue> extends CompositeStoreOptions<SelectStoreItem>, PopoverStoreOptions, StoreOptions<SelectStoreState<T>, "virtualFocus" | "includesBaseElement" | "activeId" | "orientation" | "placement" | "value" | "setValueOnMove"> {
|
|
82
80
|
/**
|
|
83
81
|
* A reference to a combobox store. This is used when combining the combobox
|
|
84
82
|
* with a select (e.g., select with a search input). The stores will share the
|
|
@@ -96,8 +94,8 @@ export interface SelectStoreOptions<T extends Value = Value> extends StoreOption
|
|
|
96
94
|
*/
|
|
97
95
|
defaultValue?: SelectStoreState<T>["value"];
|
|
98
96
|
}
|
|
99
|
-
export interface SelectStoreProps<T extends
|
|
97
|
+
export interface SelectStoreProps<T extends SelectStoreValue = SelectStoreValue> extends SelectStoreOptions<T>, StoreProps<SelectStoreState<T>> {
|
|
100
98
|
}
|
|
101
|
-
export interface SelectStore<T extends
|
|
99
|
+
export interface SelectStore<T extends SelectStoreValue = SelectStoreValue> extends SelectStoreFunctions<T>, Store<SelectStoreState<T>> {
|
|
102
100
|
}
|
|
103
101
|
export {};
|