@ariakit/core 0.3.9 → 0.3.11
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 +15 -0
- package/cjs/__chunks/{JNFZSNOI.cjs → BFE5R4EZ.cjs} +17 -17
- package/cjs/__chunks/{EFIT5L4X.cjs → E53JW5BD.cjs} +12 -12
- package/cjs/__chunks/{2UK5WUJX.cjs → F6HPKLO2.cjs} +12 -14
- package/cjs/__chunks/{2LS4JJ4S.cjs → I3Y4EXEF.cjs} +2 -2
- package/cjs/__chunks/{3UT5FE6K.cjs → KBNYGXWI.cjs} +3 -0
- package/cjs/__chunks/{UCLKUBNP.cjs → MI6NUQYQ.cjs} +31 -18
- package/cjs/__chunks/{UTICNXST.cjs → NOFH2BLB.cjs} +7 -7
- package/cjs/__chunks/{GJFZ5ZPP.cjs → OTVLDMN2.cjs} +16 -16
- package/cjs/__chunks/{5SIVMOID.cjs → TQTGWD5K.cjs} +10 -10
- package/cjs/checkbox/checkbox-store.cjs +5 -5
- package/cjs/checkbox/checkbox-store.d.cts +5 -2
- package/cjs/checkbox/checkbox-store.d.ts +5 -2
- package/cjs/collection/collection-store.cjs +4 -4
- package/cjs/collection/collection-store.d.cts +11 -11
- package/cjs/collection/collection-store.d.ts +11 -11
- package/cjs/combobox/combobox-store.cjs +32 -32
- package/cjs/combobox/combobox-store.d.cts +3 -1
- package/cjs/combobox/combobox-store.d.ts +3 -1
- package/cjs/composite/composite-overflow-store.cjs +6 -6
- package/cjs/composite/composite-store.cjs +5 -5
- package/cjs/composite/composite-store.d.cts +128 -54
- package/cjs/composite/composite-store.d.ts +128 -54
- package/cjs/dialog/dialog-store.cjs +5 -5
- package/cjs/disclosure/disclosure-store.cjs +4 -4
- package/cjs/disclosure/disclosure-store.d.cts +33 -27
- package/cjs/disclosure/disclosure-store.d.ts +33 -27
- package/cjs/form/form-store.cjs +23 -23
- package/cjs/form/form-store.d.cts +35 -26
- package/cjs/form/form-store.d.ts +35 -26
- package/cjs/hovercard/hovercard-store.cjs +7 -7
- package/cjs/hovercard/hovercard-store.d.cts +14 -7
- package/cjs/hovercard/hovercard-store.d.ts +14 -7
- package/cjs/menu/menu-bar-store.cjs +6 -6
- package/cjs/menu/menu-store.cjs +26 -26
- package/cjs/menu/menu-store.d.cts +16 -7
- package/cjs/menu/menu-store.d.ts +16 -7
- package/cjs/menubar/menubar-store.cjs +6 -6
- package/cjs/popover/popover-store.cjs +6 -6
- package/cjs/popover/popover-store.d.cts +31 -6
- package/cjs/popover/popover-store.d.ts +31 -6
- package/cjs/radio/radio-store.cjs +8 -8
- package/cjs/radio/radio-store.d.cts +2 -1
- package/cjs/radio/radio-store.d.ts +2 -1
- package/cjs/select/select-store.cjs +28 -28
- package/cjs/select/select-store.d.cts +2 -1
- package/cjs/select/select-store.d.ts +2 -1
- package/cjs/tab/tab-store.cjs +20 -20
- package/cjs/tab/tab-store.d.cts +20 -15
- package/cjs/tab/tab-store.d.ts +20 -15
- package/cjs/toolbar/toolbar-store.cjs +7 -7
- package/cjs/toolbar/toolbar-store.d.cts +2 -6
- package/cjs/toolbar/toolbar-store.d.ts +2 -6
- package/cjs/tooltip/tooltip-store.cjs +12 -12
- package/cjs/tooltip/tooltip-store.d.cts +6 -4
- package/cjs/tooltip/tooltip-store.d.ts +6 -4
- package/cjs/utils/misc.cjs +2 -2
- package/cjs/utils/store.cjs +3 -3
- package/esm/__chunks/{TLN4ALYH.js → 22K762VQ.js} +22 -9
- package/esm/__chunks/{J6JIOWCS.js → AF6IUUFN.js} +3 -3
- package/esm/__chunks/{A2J4XZ5T.js → EAHJFCU4.js} +1 -3
- package/esm/__chunks/{DLX2AS6C.js → IERTEJ3A.js} +3 -3
- package/esm/__chunks/{T3DVYGXI.js → SOLWE6E5.js} +3 -3
- package/esm/__chunks/{LT2OYWRD.js → SX2XFD6A.js} +1 -1
- package/esm/__chunks/{EZ2TTBAQ.js → XU3EOSCU.js} +3 -3
- package/esm/__chunks/{I2VQ3XGR.js → Y3OOHFCN.js} +3 -0
- package/esm/__chunks/{NKLTHWCR.js → Z5IGYIPT.js} +2 -2
- package/esm/checkbox/checkbox-store.d.ts +5 -2
- package/esm/checkbox/checkbox-store.js +2 -2
- package/esm/collection/collection-store.d.ts +11 -11
- package/esm/collection/collection-store.js +3 -3
- package/esm/combobox/combobox-store.d.ts +3 -1
- package/esm/combobox/combobox-store.js +7 -7
- package/esm/composite/composite-overflow-store.js +5 -5
- package/esm/composite/composite-store.d.ts +128 -54
- package/esm/composite/composite-store.js +4 -4
- package/esm/dialog/dialog-store.js +4 -4
- package/esm/disclosure/disclosure-store.d.ts +33 -27
- package/esm/disclosure/disclosure-store.js +3 -3
- package/esm/form/form-store.d.ts +35 -26
- package/esm/form/form-store.js +3 -3
- package/esm/hovercard/hovercard-store.d.ts +14 -7
- package/esm/hovercard/hovercard-store.js +6 -6
- package/esm/menu/menu-bar-store.js +5 -5
- package/esm/menu/menu-store.d.ts +16 -7
- package/esm/menu/menu-store.js +8 -8
- package/esm/menubar/menubar-store.js +5 -5
- package/esm/popover/popover-store.d.ts +31 -6
- package/esm/popover/popover-store.js +5 -5
- package/esm/radio/radio-store.d.ts +2 -1
- package/esm/radio/radio-store.js +4 -4
- package/esm/select/select-store.d.ts +2 -1
- package/esm/select/select-store.js +7 -7
- package/esm/tab/tab-store.d.ts +20 -15
- package/esm/tab/tab-store.js +4 -4
- package/esm/toolbar/toolbar-store.d.ts +2 -6
- package/esm/toolbar/toolbar-store.js +4 -4
- package/esm/tooltip/tooltip-store.d.ts +6 -4
- package/esm/tooltip/tooltip-store.js +6 -6
- package/esm/utils/misc.js +1 -1
- package/esm/utils/store.js +2 -2
- package/package.json +1 -1
package/cjs/form/form-store.d.ts
CHANGED
|
@@ -19,6 +19,10 @@ export interface FormStoreItem extends CollectionStoreItem {
|
|
|
19
19
|
export interface FormStoreState<T extends FormStoreValues = FormStoreValues> extends CollectionStoreState<FormStoreItem> {
|
|
20
20
|
/**
|
|
21
21
|
* Form values.
|
|
22
|
+
*
|
|
23
|
+
* Live examples:
|
|
24
|
+
* - [FormRadio](https://ariakit.org/examples/form-radio)
|
|
25
|
+
* - [FormSelect](https://ariakit.org/examples/form-select)
|
|
22
26
|
* @default {}
|
|
23
27
|
*/
|
|
24
28
|
values: T;
|
|
@@ -43,18 +47,25 @@ export interface FormStoreState<T extends FormStoreValues = FormStoreValues> ext
|
|
|
43
47
|
*/
|
|
44
48
|
submitting: boolean;
|
|
45
49
|
/**
|
|
46
|
-
* The number of times
|
|
47
|
-
*
|
|
50
|
+
* The number of times
|
|
51
|
+
* [`submit`](https://ariakit.org/reference/use-form-store#submit) has been
|
|
52
|
+
* called with a successful response.
|
|
48
53
|
*/
|
|
49
54
|
submitSucceed: number;
|
|
50
55
|
/**
|
|
51
|
-
* The number of times
|
|
56
|
+
* The number of times
|
|
57
|
+
* [`submit`](https://ariakit.org/reference/use-form-store#submit) has been
|
|
58
|
+
* called with an error response.
|
|
52
59
|
*/
|
|
53
60
|
submitFailed: number;
|
|
54
61
|
}
|
|
55
62
|
export interface FormStoreFunctions<T extends FormStoreValues = FormStoreValues> extends CollectionStoreFunctions<FormStoreItem> {
|
|
56
63
|
/**
|
|
57
|
-
* An object containing the names of the form fields for type
|
|
64
|
+
* An object containing the names of the form fields for type safety.
|
|
65
|
+
*
|
|
66
|
+
* Live examples:
|
|
67
|
+
* - [FormRadio](https://ariakit.org/examples/form-radio)
|
|
68
|
+
* - [FormSelect](https://ariakit.org/examples/form-select)
|
|
58
69
|
* @example
|
|
59
70
|
* store.names.name; // "name"
|
|
60
71
|
* store.names.name.first; // "name.first"
|
|
@@ -62,7 +73,8 @@ export interface FormStoreFunctions<T extends FormStoreValues = FormStoreValues>
|
|
|
62
73
|
*/
|
|
63
74
|
names: Names<T>;
|
|
64
75
|
/**
|
|
65
|
-
* Sets the `values`
|
|
76
|
+
* Sets the [`values`](https://ariakit.org/reference/form-provider#values)
|
|
77
|
+
* state.
|
|
66
78
|
* @example
|
|
67
79
|
* store.setValues({ name: "John" });
|
|
68
80
|
* store.setValues((values) => ({ ...values, name: "John" }));
|
|
@@ -70,7 +82,9 @@ export interface FormStoreFunctions<T extends FormStoreValues = FormStoreValues>
|
|
|
70
82
|
setValues: SetState<FormStoreState<T>["values"]>;
|
|
71
83
|
/**
|
|
72
84
|
* Retrieves a field value.
|
|
73
|
-
*
|
|
85
|
+
*
|
|
86
|
+
* Live examples:
|
|
87
|
+
* - [FormRadio](https://ariakit.org/examples/form-radio)
|
|
74
88
|
* @example
|
|
75
89
|
* const nameValue = store.getValue("name");
|
|
76
90
|
* // Can also use store.names for type-safety.
|
|
@@ -79,8 +93,9 @@ export interface FormStoreFunctions<T extends FormStoreValues = FormStoreValues>
|
|
|
79
93
|
getValue: <T = any>(name: StringLike) => T;
|
|
80
94
|
/**
|
|
81
95
|
* Sets a field value.
|
|
82
|
-
*
|
|
83
|
-
*
|
|
96
|
+
*
|
|
97
|
+
* Live examples:
|
|
98
|
+
* - [FormSelect](https://ariakit.org/examples/form-select)
|
|
84
99
|
* @example
|
|
85
100
|
* store.setValue("name", "John");
|
|
86
101
|
* store.setValue("name", (value) => value + " Doe");
|
|
@@ -90,8 +105,6 @@ export interface FormStoreFunctions<T extends FormStoreValues = FormStoreValues>
|
|
|
90
105
|
setValue: <T>(name: StringLike, value: SetStateAction<T>) => void;
|
|
91
106
|
/**
|
|
92
107
|
* Pushes a value to an array field.
|
|
93
|
-
* @param name The array field name.
|
|
94
|
-
* @param value The value to push.
|
|
95
108
|
* @example
|
|
96
109
|
* store.pushValue("tags", "new tag");
|
|
97
110
|
* store.pushValue("tags", { id: 1, name: "new tag" });
|
|
@@ -101,8 +114,6 @@ export interface FormStoreFunctions<T extends FormStoreValues = FormStoreValues>
|
|
|
101
114
|
pushValue: <T>(name: StringLike, value: T) => void;
|
|
102
115
|
/**
|
|
103
116
|
* Removes a value from an array field.
|
|
104
|
-
* @param name The array field name.
|
|
105
|
-
* @param index The index of the value to remove.
|
|
106
117
|
* @example
|
|
107
118
|
* store.removeValue("tags", 0);
|
|
108
119
|
* store.removeValue("tags", 1);
|
|
@@ -111,7 +122,8 @@ export interface FormStoreFunctions<T extends FormStoreValues = FormStoreValues>
|
|
|
111
122
|
*/
|
|
112
123
|
removeValue: (name: StringLike, index: number) => void;
|
|
113
124
|
/**
|
|
114
|
-
* Sets the `errors`
|
|
125
|
+
* Sets the [`errors`](https://ariakit.org/reference/form-provider#errors)
|
|
126
|
+
* state.
|
|
115
127
|
* @example
|
|
116
128
|
* store.setErrors({ name: "Name is required" });
|
|
117
129
|
* store.setErrors((errors) => ({ ...errors, name: "Name is required" }));
|
|
@@ -119,7 +131,6 @@ export interface FormStoreFunctions<T extends FormStoreValues = FormStoreValues>
|
|
|
119
131
|
setErrors: SetState<FormStoreState<T>["errors"]>;
|
|
120
132
|
/**
|
|
121
133
|
* Retrieves a field error.
|
|
122
|
-
* @param name The field name.
|
|
123
134
|
* @example
|
|
124
135
|
* const nameError = store.getError("name");
|
|
125
136
|
* // Can also use store.names for type-safety.
|
|
@@ -128,8 +139,9 @@ export interface FormStoreFunctions<T extends FormStoreValues = FormStoreValues>
|
|
|
128
139
|
getError: (name: StringLike) => ErrorMessage;
|
|
129
140
|
/**
|
|
130
141
|
* Sets a field error.
|
|
131
|
-
*
|
|
132
|
-
*
|
|
142
|
+
*
|
|
143
|
+
* Live examples:
|
|
144
|
+
* - [FormRadio](https://ariakit.org/examples/form-radio)
|
|
133
145
|
* @example
|
|
134
146
|
* store.setError("name", "Name is required");
|
|
135
147
|
* store.setError("name", (error) => error + "!");
|
|
@@ -138,7 +150,8 @@ export interface FormStoreFunctions<T extends FormStoreValues = FormStoreValues>
|
|
|
138
150
|
*/
|
|
139
151
|
setError: (name: StringLike, error: SetStateAction<ErrorMessage>) => void;
|
|
140
152
|
/**
|
|
141
|
-
* Sets the `touched`
|
|
153
|
+
* Sets the [`touched`](https://ariakit.org/reference/form-provider#touched)
|
|
154
|
+
* state.
|
|
142
155
|
* @example
|
|
143
156
|
* store.setTouched({ name: true });
|
|
144
157
|
* store.setTouched((touched) => ({ ...touched, name: true }));
|
|
@@ -146,7 +159,6 @@ export interface FormStoreFunctions<T extends FormStoreValues = FormStoreValues>
|
|
|
146
159
|
setTouched: SetState<FormStoreState<T>["touched"]>;
|
|
147
160
|
/**
|
|
148
161
|
* Retrieves a field touched state.
|
|
149
|
-
* @param name The field name.
|
|
150
162
|
* @example
|
|
151
163
|
* const nameTouched = store.getFieldTouched("name");
|
|
152
164
|
* // Can also use store.names for type-safety.
|
|
@@ -155,8 +167,6 @@ export interface FormStoreFunctions<T extends FormStoreValues = FormStoreValues>
|
|
|
155
167
|
getFieldTouched: (name: StringLike) => boolean;
|
|
156
168
|
/**
|
|
157
169
|
* Sets a field touched state.
|
|
158
|
-
* @param name The field name.
|
|
159
|
-
* @param value The field touched state.
|
|
160
170
|
* @example
|
|
161
171
|
* store.setFieldTouched("name", true);
|
|
162
172
|
* store.setFieldTouched("name", (value) => !value);
|
|
@@ -166,9 +176,8 @@ export interface FormStoreFunctions<T extends FormStoreValues = FormStoreValues>
|
|
|
166
176
|
setFieldTouched: (name: StringLike, value: SetStateAction<boolean>) => void;
|
|
167
177
|
/**
|
|
168
178
|
* Function that accepts a callback that will be used to validate the form
|
|
169
|
-
* when `validate` is
|
|
170
|
-
* the callback.
|
|
171
|
-
* @param callback The callback function.
|
|
179
|
+
* when [`validate`](https://ariakit.org/reference/use-form-store#validate) is
|
|
180
|
+
* called. It returns a cleanup function that will remove the callback.
|
|
172
181
|
* @example
|
|
173
182
|
* const cleanup = store.onValidate(async (state) => {
|
|
174
183
|
* const errors = await api.validate(state.values);
|
|
@@ -179,9 +188,9 @@ export interface FormStoreFunctions<T extends FormStoreValues = FormStoreValues>
|
|
|
179
188
|
*/
|
|
180
189
|
onValidate: (callback: FormStoreCallback<FormStoreState<T>>) => void;
|
|
181
190
|
/**
|
|
182
|
-
* Function that accepts a callback that will be used to submit the form
|
|
183
|
-
*
|
|
184
|
-
* the callback.
|
|
191
|
+
* Function that accepts a callback that will be used to submit the form when
|
|
192
|
+
* [`submit`](https://ariakit.org/reference/use-form-store#submit) is called.
|
|
193
|
+
* It returns a cleanup function that will remove the callback.
|
|
185
194
|
* @param callback The callback function.
|
|
186
195
|
* @example
|
|
187
196
|
* const cleanup = store.onSubmit(async (state) => {
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
var
|
|
5
|
-
require('../__chunks/
|
|
6
|
-
require('../__chunks/
|
|
7
|
-
require('../__chunks/
|
|
8
|
-
require('../__chunks/
|
|
9
|
-
require('../__chunks/
|
|
4
|
+
var _TQTGWD5Kcjs = require('../__chunks/TQTGWD5K.cjs');
|
|
5
|
+
require('../__chunks/E53JW5BD.cjs');
|
|
6
|
+
require('../__chunks/I3Y4EXEF.cjs');
|
|
7
|
+
require('../__chunks/OTVLDMN2.cjs');
|
|
8
|
+
require('../__chunks/F6HPKLO2.cjs');
|
|
9
|
+
require('../__chunks/KBNYGXWI.cjs');
|
|
10
10
|
require('../__chunks/AV6KTKLE.cjs');
|
|
11
11
|
|
|
12
12
|
|
|
13
|
-
exports.createHovercardStore =
|
|
13
|
+
exports.createHovercardStore = _TQTGWD5Kcjs.createHovercardStore;
|
|
@@ -12,14 +12,16 @@ export interface HovercardStoreState extends PopoverStoreState {
|
|
|
12
12
|
placement: PopoverStoreState["placement"];
|
|
13
13
|
/**
|
|
14
14
|
* The amount of time in milliseconds to wait before showing and hiding the
|
|
15
|
-
*
|
|
16
|
-
* `showTimeout`
|
|
15
|
+
* popup. To control the delay for showing and hiding separately, use
|
|
16
|
+
* [`showTimeout`](https://ariakit.org/reference/hovercard-provider#showtimeout)
|
|
17
|
+
* and
|
|
18
|
+
* [`hideTimeout`](https://ariakit.org/reference/hovercard-provider#hidetimeout).
|
|
17
19
|
* @default 500
|
|
18
20
|
*/
|
|
19
21
|
timeout: number;
|
|
20
22
|
/**
|
|
21
|
-
* The amount of time in milliseconds to wait before
|
|
22
|
-
*
|
|
23
|
+
* The amount of time in milliseconds to wait before _showing_ the popup. It
|
|
24
|
+
* defaults to the value passed to
|
|
23
25
|
* [`timeout`](https://ariakit.org/reference/hovercard-provider#timeout).
|
|
24
26
|
*
|
|
25
27
|
* Live examples:
|
|
@@ -29,16 +31,18 @@ export interface HovercardStoreState extends PopoverStoreState {
|
|
|
29
31
|
*/
|
|
30
32
|
showTimeout?: number;
|
|
31
33
|
/**
|
|
32
|
-
* The amount of time in milliseconds to wait before
|
|
33
|
-
*
|
|
34
|
+
* The amount of time in milliseconds to wait before _hiding_ the popup. It
|
|
35
|
+
* defaults to the value passed to
|
|
34
36
|
* [`timeout`](https://ariakit.org/reference/hovercard-provider#timeout).
|
|
35
37
|
*
|
|
36
38
|
* Live examples:
|
|
37
39
|
* - [Navigation Menubar](https://ariakit.org/examples/menubar-navigation)
|
|
40
|
+
* - [Tooltip with Framer
|
|
41
|
+
* Motion](https://ariakit.org/examples/tooltip-framer-motion)
|
|
38
42
|
*/
|
|
39
43
|
hideTimeout?: number;
|
|
40
44
|
/**
|
|
41
|
-
* Whether the
|
|
45
|
+
* Whether the popup or an element inside it should be focused when it is
|
|
42
46
|
* shown.
|
|
43
47
|
* @default false
|
|
44
48
|
*/
|
|
@@ -47,6 +51,9 @@ export interface HovercardStoreState extends PopoverStoreState {
|
|
|
47
51
|
export interface HovercardStoreFunctions extends PopoverStoreFunctions {
|
|
48
52
|
/**
|
|
49
53
|
* Sets the `autoFocusOnShow` state.
|
|
54
|
+
*
|
|
55
|
+
* Live examples:
|
|
56
|
+
* - [Sliding Menu](https://ariakit.org/examples/menu-slide)
|
|
50
57
|
*/
|
|
51
58
|
setAutoFocusOnShow: SetState<HovercardStoreState["autoFocusOnShow"]>;
|
|
52
59
|
}
|
|
@@ -12,14 +12,16 @@ export interface HovercardStoreState extends PopoverStoreState {
|
|
|
12
12
|
placement: PopoverStoreState["placement"];
|
|
13
13
|
/**
|
|
14
14
|
* The amount of time in milliseconds to wait before showing and hiding the
|
|
15
|
-
*
|
|
16
|
-
* `showTimeout`
|
|
15
|
+
* popup. To control the delay for showing and hiding separately, use
|
|
16
|
+
* [`showTimeout`](https://ariakit.org/reference/hovercard-provider#showtimeout)
|
|
17
|
+
* and
|
|
18
|
+
* [`hideTimeout`](https://ariakit.org/reference/hovercard-provider#hidetimeout).
|
|
17
19
|
* @default 500
|
|
18
20
|
*/
|
|
19
21
|
timeout: number;
|
|
20
22
|
/**
|
|
21
|
-
* The amount of time in milliseconds to wait before
|
|
22
|
-
*
|
|
23
|
+
* The amount of time in milliseconds to wait before _showing_ the popup. It
|
|
24
|
+
* defaults to the value passed to
|
|
23
25
|
* [`timeout`](https://ariakit.org/reference/hovercard-provider#timeout).
|
|
24
26
|
*
|
|
25
27
|
* Live examples:
|
|
@@ -29,16 +31,18 @@ export interface HovercardStoreState extends PopoverStoreState {
|
|
|
29
31
|
*/
|
|
30
32
|
showTimeout?: number;
|
|
31
33
|
/**
|
|
32
|
-
* The amount of time in milliseconds to wait before
|
|
33
|
-
*
|
|
34
|
+
* The amount of time in milliseconds to wait before _hiding_ the popup. It
|
|
35
|
+
* defaults to the value passed to
|
|
34
36
|
* [`timeout`](https://ariakit.org/reference/hovercard-provider#timeout).
|
|
35
37
|
*
|
|
36
38
|
* Live examples:
|
|
37
39
|
* - [Navigation Menubar](https://ariakit.org/examples/menubar-navigation)
|
|
40
|
+
* - [Tooltip with Framer
|
|
41
|
+
* Motion](https://ariakit.org/examples/tooltip-framer-motion)
|
|
38
42
|
*/
|
|
39
43
|
hideTimeout?: number;
|
|
40
44
|
/**
|
|
41
|
-
* Whether the
|
|
45
|
+
* Whether the popup or an element inside it should be focused when it is
|
|
42
46
|
* shown.
|
|
43
47
|
* @default false
|
|
44
48
|
*/
|
|
@@ -47,6 +51,9 @@ export interface HovercardStoreState extends PopoverStoreState {
|
|
|
47
51
|
export interface HovercardStoreFunctions extends PopoverStoreFunctions {
|
|
48
52
|
/**
|
|
49
53
|
* Sets the `autoFocusOnShow` state.
|
|
54
|
+
*
|
|
55
|
+
* Live examples:
|
|
56
|
+
* - [Sliding Menu](https://ariakit.org/examples/menu-slide)
|
|
50
57
|
*/
|
|
51
58
|
setAutoFocusOnShow: SetState<HovercardStoreState["autoFocusOnShow"]>;
|
|
52
59
|
}
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
var
|
|
5
|
-
require('../__chunks/
|
|
6
|
-
require('../__chunks/
|
|
7
|
-
require('../__chunks/
|
|
8
|
-
require('../__chunks/
|
|
4
|
+
var _NOFH2BLBcjs = require('../__chunks/NOFH2BLB.cjs');
|
|
5
|
+
require('../__chunks/BFE5R4EZ.cjs');
|
|
6
|
+
require('../__chunks/MI6NUQYQ.cjs');
|
|
7
|
+
require('../__chunks/F6HPKLO2.cjs');
|
|
8
|
+
require('../__chunks/KBNYGXWI.cjs');
|
|
9
9
|
require('../__chunks/5F4DVUNS.cjs');
|
|
10
10
|
require('../__chunks/ULSPM3Y3.cjs');
|
|
11
11
|
require('../__chunks/AV6KTKLE.cjs');
|
|
12
12
|
|
|
13
13
|
// src/menu/menu-bar-store.ts
|
|
14
14
|
function createMenuBarStore(props = {}) {
|
|
15
|
-
return
|
|
15
|
+
return _NOFH2BLBcjs.createMenubarStore.call(void 0, props);
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
|
package/cjs/menu/menu-store.cjs
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
var
|
|
5
|
-
require('../__chunks/
|
|
6
|
-
require('../__chunks/
|
|
7
|
-
require('../__chunks/
|
|
4
|
+
var _TQTGWD5Kcjs = require('../__chunks/TQTGWD5K.cjs');
|
|
5
|
+
require('../__chunks/E53JW5BD.cjs');
|
|
6
|
+
require('../__chunks/I3Y4EXEF.cjs');
|
|
7
|
+
require('../__chunks/OTVLDMN2.cjs');
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
var
|
|
11
|
-
require('../__chunks/
|
|
10
|
+
var _BFE5R4EZcjs = require('../__chunks/BFE5R4EZ.cjs');
|
|
11
|
+
require('../__chunks/MI6NUQYQ.cjs');
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
|
|
@@ -17,11 +17,11 @@ require('../__chunks/UCLKUBNP.cjs');
|
|
|
17
17
|
|
|
18
18
|
|
|
19
19
|
|
|
20
|
-
var
|
|
20
|
+
var _F6HPKLO2cjs = require('../__chunks/F6HPKLO2.cjs');
|
|
21
21
|
|
|
22
22
|
|
|
23
23
|
|
|
24
|
-
var
|
|
24
|
+
var _KBNYGXWIcjs = require('../__chunks/KBNYGXWI.cjs');
|
|
25
25
|
require('../__chunks/5F4DVUNS.cjs');
|
|
26
26
|
require('../__chunks/ULSPM3Y3.cjs');
|
|
27
27
|
|
|
@@ -42,10 +42,10 @@ function createMenuStore(_a = {}) {
|
|
|
42
42
|
"menubar"
|
|
43
43
|
]);
|
|
44
44
|
const parentIsMenubar = !!menubar && !parent;
|
|
45
|
-
const store =
|
|
45
|
+
const store = _F6HPKLO2cjs.mergeStore.call(void 0,
|
|
46
46
|
props.store,
|
|
47
|
-
|
|
48
|
-
|
|
47
|
+
_F6HPKLO2cjs.pick.call(void 0, parent, ["values"]),
|
|
48
|
+
_F6HPKLO2cjs.omit.call(void 0, combobox, [
|
|
49
49
|
"arrowElement",
|
|
50
50
|
"anchorElement",
|
|
51
51
|
"contentElement",
|
|
@@ -53,51 +53,51 @@ function createMenuStore(_a = {}) {
|
|
|
53
53
|
"disclosureElement"
|
|
54
54
|
])
|
|
55
55
|
);
|
|
56
|
-
|
|
56
|
+
_F6HPKLO2cjs.throwOnConflictingProps.call(void 0, props, store);
|
|
57
57
|
const syncState = store.getState();
|
|
58
|
-
const composite =
|
|
58
|
+
const composite = _BFE5R4EZcjs.createCompositeStore.call(void 0, _AV6KTKLEcjs.__spreadProps.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, {}, props), {
|
|
59
59
|
store,
|
|
60
|
-
orientation:
|
|
60
|
+
orientation: _KBNYGXWIcjs.defaultValue.call(void 0,
|
|
61
61
|
props.orientation,
|
|
62
62
|
syncState.orientation,
|
|
63
63
|
"vertical"
|
|
64
64
|
)
|
|
65
65
|
}));
|
|
66
|
-
const hovercard =
|
|
66
|
+
const hovercard = _TQTGWD5Kcjs.createHovercardStore.call(void 0, _AV6KTKLEcjs.__spreadProps.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, {}, props), {
|
|
67
67
|
store,
|
|
68
|
-
placement:
|
|
68
|
+
placement: _KBNYGXWIcjs.defaultValue.call(void 0,
|
|
69
69
|
props.placement,
|
|
70
70
|
syncState.placement,
|
|
71
71
|
"bottom-start"
|
|
72
72
|
),
|
|
73
|
-
timeout:
|
|
73
|
+
timeout: _KBNYGXWIcjs.defaultValue.call(void 0,
|
|
74
74
|
props.timeout,
|
|
75
75
|
syncState.timeout,
|
|
76
76
|
parentIsMenubar ? 0 : 150
|
|
77
77
|
),
|
|
78
|
-
hideTimeout:
|
|
78
|
+
hideTimeout: _KBNYGXWIcjs.defaultValue.call(void 0, props.hideTimeout, syncState.hideTimeout, 0)
|
|
79
79
|
}));
|
|
80
80
|
const initialState = _AV6KTKLEcjs.__spreadProps.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, {}, composite.getState()), hovercard.getState()), {
|
|
81
|
-
initialFocus:
|
|
82
|
-
values:
|
|
81
|
+
initialFocus: _KBNYGXWIcjs.defaultValue.call(void 0, syncState.initialFocus, "container"),
|
|
82
|
+
values: _KBNYGXWIcjs.defaultValue.call(void 0,
|
|
83
83
|
props.values,
|
|
84
84
|
syncState.values,
|
|
85
85
|
props.defaultValues,
|
|
86
86
|
{}
|
|
87
87
|
)
|
|
88
88
|
});
|
|
89
|
-
const menu =
|
|
90
|
-
|
|
89
|
+
const menu = _F6HPKLO2cjs.createStore.call(void 0, initialState, composite, hovercard, store);
|
|
90
|
+
_F6HPKLO2cjs.setup.call(void 0,
|
|
91
91
|
menu,
|
|
92
|
-
() =>
|
|
92
|
+
() => _F6HPKLO2cjs.sync.call(void 0, menu, ["mounted"], (state) => {
|
|
93
93
|
if (state.mounted)
|
|
94
94
|
return;
|
|
95
95
|
menu.setState("activeId", null);
|
|
96
96
|
})
|
|
97
97
|
);
|
|
98
|
-
|
|
98
|
+
_F6HPKLO2cjs.setup.call(void 0,
|
|
99
99
|
menu,
|
|
100
|
-
() =>
|
|
100
|
+
() => _F6HPKLO2cjs.sync.call(void 0, parent, ["orientation"], (state) => {
|
|
101
101
|
menu.setState(
|
|
102
102
|
"placement",
|
|
103
103
|
state.orientation === "vertical" ? "right-start" : "bottom-start"
|
|
@@ -123,7 +123,7 @@ function createMenuStore(_a = {}) {
|
|
|
123
123
|
return;
|
|
124
124
|
menu.setState("values", (values) => {
|
|
125
125
|
const prevValue = values[name];
|
|
126
|
-
const nextValue =
|
|
126
|
+
const nextValue = _KBNYGXWIcjs.applyState.call(void 0, value, prevValue);
|
|
127
127
|
if (nextValue === prevValue)
|
|
128
128
|
return values;
|
|
129
129
|
return _AV6KTKLEcjs.__spreadProps.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, {}, values), {
|
|
@@ -13,10 +13,13 @@ export interface MenuStoreState<T extends MenuStoreValues = MenuStoreValues> ext
|
|
|
13
13
|
*/
|
|
14
14
|
initialFocus: "container" | "first" | "last";
|
|
15
15
|
/**
|
|
16
|
-
* A map of names and values that will be used by the
|
|
17
|
-
* `
|
|
16
|
+
* A map of names and values that will be used by the
|
|
17
|
+
* [`MenuItemCheckbox`](https://ariakit.org/reference/menu-item-checkbox) and
|
|
18
|
+
* [`MenuItemRadio`](https://ariakit.org/reference/menu-item-radio)
|
|
19
|
+
* components.
|
|
18
20
|
*
|
|
19
21
|
* Live examples:
|
|
22
|
+
* - [MenuItemCheckbox](https://ariakit.org/examples/menu-item-checkbox)
|
|
20
23
|
* - [Submenu with
|
|
21
24
|
* Combobox](https://ariakit.org/examples/menu-nested-combobox)
|
|
22
25
|
*/
|
|
@@ -42,7 +45,8 @@ export interface MenuStoreFunctions<T extends MenuStoreValues = MenuStoreValues>
|
|
|
42
45
|
*/
|
|
43
46
|
setInitialFocus: SetState<MenuStoreState<T>["initialFocus"]>;
|
|
44
47
|
/**
|
|
45
|
-
* Sets the `values`
|
|
48
|
+
* Sets the [`values`](https://ariakit.org/reference/menu-provider#values)
|
|
49
|
+
* state.
|
|
46
50
|
* @example
|
|
47
51
|
* store.setValues({ watching: ["issues"] });
|
|
48
52
|
* store.setValues((values) => ({ ...values, watching: ["issues"] }));
|
|
@@ -68,16 +72,21 @@ export interface MenuStoreOptions<T extends MenuStoreValues = MenuStoreValues> e
|
|
|
68
72
|
*/
|
|
69
73
|
combobox?: ComboboxStore | null;
|
|
70
74
|
/**
|
|
71
|
-
* A reference to a parent menu store. This
|
|
75
|
+
* A reference to a parent menu store. This is used on nested menus.
|
|
72
76
|
*/
|
|
73
77
|
parent?: MenuStore | null;
|
|
74
78
|
/**
|
|
75
|
-
* A reference to a
|
|
76
|
-
*
|
|
79
|
+
* A reference to a menubar store. This is used when rendering menus inside a
|
|
80
|
+
* menubar.
|
|
77
81
|
*/
|
|
78
82
|
menubar?: MenuBarStore | null;
|
|
79
83
|
/**
|
|
80
|
-
* The default values for the
|
|
84
|
+
* The default values for the
|
|
85
|
+
* [`values`](https://ariakit.org/reference/menu-provider#values) state.
|
|
86
|
+
*
|
|
87
|
+
* Live examples:
|
|
88
|
+
* - [MenuItemCheckbox](https://ariakit.org/examples/menu-item-checkbox)
|
|
89
|
+
* - [MenuItemRadio](https://ariakit.org/examples/menu-item-radio)
|
|
81
90
|
* @default {}
|
|
82
91
|
*/
|
|
83
92
|
defaultValues?: MenuStoreState<T>["values"];
|
package/cjs/menu/menu-store.d.ts
CHANGED
|
@@ -13,10 +13,13 @@ export interface MenuStoreState<T extends MenuStoreValues = MenuStoreValues> ext
|
|
|
13
13
|
*/
|
|
14
14
|
initialFocus: "container" | "first" | "last";
|
|
15
15
|
/**
|
|
16
|
-
* A map of names and values that will be used by the
|
|
17
|
-
* `
|
|
16
|
+
* A map of names and values that will be used by the
|
|
17
|
+
* [`MenuItemCheckbox`](https://ariakit.org/reference/menu-item-checkbox) and
|
|
18
|
+
* [`MenuItemRadio`](https://ariakit.org/reference/menu-item-radio)
|
|
19
|
+
* components.
|
|
18
20
|
*
|
|
19
21
|
* Live examples:
|
|
22
|
+
* - [MenuItemCheckbox](https://ariakit.org/examples/menu-item-checkbox)
|
|
20
23
|
* - [Submenu with
|
|
21
24
|
* Combobox](https://ariakit.org/examples/menu-nested-combobox)
|
|
22
25
|
*/
|
|
@@ -42,7 +45,8 @@ export interface MenuStoreFunctions<T extends MenuStoreValues = MenuStoreValues>
|
|
|
42
45
|
*/
|
|
43
46
|
setInitialFocus: SetState<MenuStoreState<T>["initialFocus"]>;
|
|
44
47
|
/**
|
|
45
|
-
* Sets the `values`
|
|
48
|
+
* Sets the [`values`](https://ariakit.org/reference/menu-provider#values)
|
|
49
|
+
* state.
|
|
46
50
|
* @example
|
|
47
51
|
* store.setValues({ watching: ["issues"] });
|
|
48
52
|
* store.setValues((values) => ({ ...values, watching: ["issues"] }));
|
|
@@ -68,16 +72,21 @@ export interface MenuStoreOptions<T extends MenuStoreValues = MenuStoreValues> e
|
|
|
68
72
|
*/
|
|
69
73
|
combobox?: ComboboxStore | null;
|
|
70
74
|
/**
|
|
71
|
-
* A reference to a parent menu store. This
|
|
75
|
+
* A reference to a parent menu store. This is used on nested menus.
|
|
72
76
|
*/
|
|
73
77
|
parent?: MenuStore | null;
|
|
74
78
|
/**
|
|
75
|
-
* A reference to a
|
|
76
|
-
*
|
|
79
|
+
* A reference to a menubar store. This is used when rendering menus inside a
|
|
80
|
+
* menubar.
|
|
77
81
|
*/
|
|
78
82
|
menubar?: MenuBarStore | null;
|
|
79
83
|
/**
|
|
80
|
-
* The default values for the
|
|
84
|
+
* The default values for the
|
|
85
|
+
* [`values`](https://ariakit.org/reference/menu-provider#values) state.
|
|
86
|
+
*
|
|
87
|
+
* Live examples:
|
|
88
|
+
* - [MenuItemCheckbox](https://ariakit.org/examples/menu-item-checkbox)
|
|
89
|
+
* - [MenuItemRadio](https://ariakit.org/examples/menu-item-radio)
|
|
81
90
|
* @default {}
|
|
82
91
|
*/
|
|
83
92
|
defaultValues?: MenuStoreState<T>["values"];
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
var
|
|
5
|
-
require('../__chunks/
|
|
6
|
-
require('../__chunks/
|
|
7
|
-
require('../__chunks/
|
|
8
|
-
require('../__chunks/
|
|
4
|
+
var _NOFH2BLBcjs = require('../__chunks/NOFH2BLB.cjs');
|
|
5
|
+
require('../__chunks/BFE5R4EZ.cjs');
|
|
6
|
+
require('../__chunks/MI6NUQYQ.cjs');
|
|
7
|
+
require('../__chunks/F6HPKLO2.cjs');
|
|
8
|
+
require('../__chunks/KBNYGXWI.cjs');
|
|
9
9
|
require('../__chunks/5F4DVUNS.cjs');
|
|
10
10
|
require('../__chunks/ULSPM3Y3.cjs');
|
|
11
11
|
require('../__chunks/AV6KTKLE.cjs');
|
|
12
12
|
|
|
13
13
|
|
|
14
|
-
exports.createMenubarStore =
|
|
14
|
+
exports.createMenubarStore = _NOFH2BLBcjs.createMenubarStore;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
var
|
|
5
|
-
require('../__chunks/
|
|
6
|
-
require('../__chunks/
|
|
7
|
-
require('../__chunks/
|
|
8
|
-
require('../__chunks/
|
|
4
|
+
var _E53JW5BDcjs = require('../__chunks/E53JW5BD.cjs');
|
|
5
|
+
require('../__chunks/I3Y4EXEF.cjs');
|
|
6
|
+
require('../__chunks/OTVLDMN2.cjs');
|
|
7
|
+
require('../__chunks/F6HPKLO2.cjs');
|
|
8
|
+
require('../__chunks/KBNYGXWI.cjs');
|
|
9
9
|
require('../__chunks/AV6KTKLE.cjs');
|
|
10
10
|
|
|
11
11
|
|
|
12
|
-
exports.createPopoverStore =
|
|
12
|
+
exports.createPopoverStore = _E53JW5BDcjs.createPopoverStore;
|