@ariakit/core 0.4.18 → 0.4.19
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 +5 -0
- package/cjs/__chunks/{MJNGPYVQ.cjs → 2RUCRSRF.cjs} +16 -16
- package/cjs/__chunks/{6BYUUR4M.cjs → 4TRESXTO.cjs} +7 -1
- package/cjs/__chunks/{AOXAROPF.cjs → 75F3RDBE.cjs} +14 -14
- package/cjs/__chunks/{SHOLYDNP.cjs → CTEQSOKZ.cjs} +2 -2
- package/cjs/__chunks/{T247D7JS.cjs → CVLMIMPT.cjs} +2 -2
- package/cjs/__chunks/{JNPL5IHP.cjs → G2CSOTWZ.cjs} +7 -7
- package/cjs/__chunks/{4ITB54IT.cjs → I4CBIWTX.cjs} +2 -3
- package/cjs/__chunks/{JNYCP2QO.cjs → LS2SNHDM.cjs} +6 -6
- package/cjs/__chunks/{UROTDZFK.cjs → R37KOEUW.cjs} +10 -10
- package/cjs/__chunks/{OYTZFOIJ.cjs → UGAVMSQJ.cjs} +18 -18
- package/cjs/__chunks/{HGVIF2R4.cjs → VC22SYOD.cjs} +24 -21
- package/cjs/__chunks/{WPBYRKFQ.cjs → WMTGHDLE.cjs} +15 -15
- package/cjs/checkbox/checkbox-store.cjs +5 -5
- package/cjs/checkbox/checkbox-store.d.cts +5 -5
- package/cjs/checkbox/checkbox-store.d.ts +5 -5
- package/cjs/collection/collection-store.cjs +5 -5
- package/cjs/collection/collection-store.d.cts +5 -5
- package/cjs/collection/collection-store.d.ts +5 -5
- package/cjs/combobox/combobox-store.cjs +40 -40
- package/cjs/combobox/combobox-store.d.cts +26 -26
- package/cjs/combobox/combobox-store.d.ts +26 -26
- package/cjs/composite/composite-overflow-store.cjs +6 -6
- package/cjs/composite/composite-store.cjs +6 -6
- package/cjs/composite/composite-store.d.cts +62 -54
- package/cjs/composite/composite-store.d.ts +62 -54
- package/cjs/dialog/dialog-store.cjs +5 -5
- package/cjs/disclosure/disclosure-store.cjs +4 -4
- package/cjs/disclosure/disclosure-store.d.cts +22 -22
- package/cjs/disclosure/disclosure-store.d.ts +22 -22
- package/cjs/form/form-store.cjs +41 -37
- package/cjs/form/form-store.d.cts +14 -14
- package/cjs/form/form-store.d.ts +14 -14
- package/cjs/hovercard/hovercard-store.cjs +7 -7
- package/cjs/hovercard/hovercard-store.d.cts +10 -10
- package/cjs/hovercard/hovercard-store.d.ts +10 -10
- package/cjs/menu/menu-bar-store.cjs +7 -7
- package/cjs/menu/menu-store.cjs +27 -27
- package/cjs/menu/menu-store.d.cts +10 -10
- package/cjs/menu/menu-store.d.ts +10 -10
- package/cjs/menubar/menubar-store.cjs +7 -7
- package/cjs/popover/popover-store.cjs +6 -6
- package/cjs/popover/popover-store.d.cts +17 -17
- package/cjs/popover/popover-store.d.ts +17 -17
- package/cjs/radio/radio-store.cjs +9 -9
- package/cjs/radio/radio-store.d.cts +1 -1
- package/cjs/radio/radio-store.d.ts +1 -1
- package/cjs/select/select-store.cjs +32 -32
- package/cjs/select/select-store.d.cts +17 -17
- package/cjs/select/select-store.d.ts +17 -17
- package/cjs/tab/tab-store.cjs +32 -32
- package/cjs/tab/tab-store.d.cts +20 -20
- package/cjs/tab/tab-store.d.ts +20 -20
- package/cjs/tag/tag-store.cjs +16 -16
- package/cjs/tag/tag-store.d.cts +5 -5
- package/cjs/tag/tag-store.d.ts +5 -5
- package/cjs/toolbar/toolbar-store.cjs +8 -8
- package/cjs/tooltip/tooltip-store.cjs +13 -13
- package/cjs/utils/dom.cjs +2 -2
- package/cjs/utils/events.cjs +6 -6
- package/cjs/utils/focus.cjs +12 -13
- package/cjs/utils/misc.cjs +4 -2
- package/cjs/utils/misc.d.cts +4 -0
- package/cjs/utils/misc.d.ts +4 -0
- package/cjs/utils/platform.cjs +3 -3
- package/cjs/utils/store.cjs +3 -3
- package/cjs/utils/store.d.cts +1 -1
- package/cjs/utils/store.d.ts +1 -1
- package/cjs/utils/undo.cjs +2 -2
- package/esm/__chunks/{KMAUV3TY.js → 7KNZCZ55.js} +1 -1
- package/esm/__chunks/{3DNM6L6E.js → G7XPWBXK.js} +1 -2
- package/esm/__chunks/{SNHYQNEZ.js → GMGLSF2B.js} +1 -1
- package/esm/__chunks/{WSDJ6ZRB.js → H7R2CY4Q.js} +3 -3
- package/esm/__chunks/{75BJEVSH.js → IHNLLH3I.js} +2 -2
- package/esm/__chunks/{N5XGANPW.js → KZX46JDB.js} +11 -8
- package/esm/__chunks/{BFGNM53A.js → MJ4ZJEIM.js} +5 -5
- package/esm/__chunks/{TIQDSBWP.js → TEVO2DMI.js} +3 -3
- package/esm/__chunks/{7LM4Q2XB.js → U4NM2NCP.js} +1 -1
- package/esm/__chunks/{RVTIKFRL.js → UNDE2QJS.js} +3 -3
- package/esm/__chunks/{XMCVU3LR.js → UWJK2WK2.js} +6 -0
- package/esm/__chunks/{SXKM4CGU.js → XTZ53NXG.js} +4 -4
- package/esm/checkbox/checkbox-store.d.ts +5 -5
- package/esm/checkbox/checkbox-store.js +2 -2
- package/esm/collection/collection-store.d.ts +5 -5
- package/esm/collection/collection-store.js +4 -4
- package/esm/combobox/combobox-store.d.ts +26 -26
- package/esm/combobox/combobox-store.js +9 -9
- package/esm/composite/composite-overflow-store.js +5 -5
- package/esm/composite/composite-store.d.ts +62 -54
- package/esm/composite/composite-store.js +5 -5
- package/esm/dialog/dialog-store.js +4 -4
- package/esm/disclosure/disclosure-store.d.ts +22 -22
- package/esm/disclosure/disclosure-store.js +3 -3
- package/esm/form/form-store.d.ts +14 -14
- package/esm/form/form-store.js +19 -15
- package/esm/hovercard/hovercard-store.d.ts +10 -10
- package/esm/hovercard/hovercard-store.js +6 -6
- package/esm/menu/menu-bar-store.js +6 -6
- package/esm/menu/menu-store.d.ts +10 -10
- package/esm/menu/menu-store.js +9 -9
- package/esm/menubar/menubar-store.js +6 -6
- package/esm/popover/popover-store.d.ts +17 -17
- package/esm/popover/popover-store.js +5 -5
- package/esm/radio/radio-store.d.ts +1 -1
- package/esm/radio/radio-store.js +5 -5
- package/esm/select/select-store.d.ts +17 -17
- package/esm/select/select-store.js +8 -8
- package/esm/tab/tab-store.d.ts +20 -20
- package/esm/tab/tab-store.js +5 -5
- package/esm/tag/tag-store.d.ts +5 -5
- package/esm/tag/tag-store.js +7 -7
- package/esm/toolbar/toolbar-store.js +5 -5
- package/esm/tooltip/tooltip-store.js +7 -7
- package/esm/utils/dom.js +1 -1
- package/esm/utils/events.js +4 -4
- package/esm/utils/focus.js +2 -3
- package/esm/utils/misc.d.ts +4 -0
- package/esm/utils/misc.js +3 -1
- package/esm/utils/platform.js +2 -2
- package/esm/utils/store.d.ts +1 -1
- package/esm/utils/store.js +2 -2
- package/esm/utils/undo.js +1 -1
- package/package.json +20 -21
- package/tsconfig.build.json +7 -2
- package/tsconfig.node.json +5 -0
- package/tsconfig.test.json +5 -0
|
@@ -17,7 +17,7 @@ export interface CompositeStoreItem extends CollectionStoreItem {
|
|
|
17
17
|
/**
|
|
18
18
|
* The row id of the item. This is only used on two-dimensional composite
|
|
19
19
|
* widgets (when using
|
|
20
|
-
* [`CompositeRow`](https://ariakit.
|
|
20
|
+
* [`CompositeRow`](https://ariakit.com/reference/composite-row)).
|
|
21
21
|
*/
|
|
22
22
|
rowId?: string;
|
|
23
23
|
/**
|
|
@@ -42,7 +42,7 @@ export interface CompositeStoreState<T extends CompositeStoreItem = CompositeSto
|
|
|
42
42
|
* contains composite items. However, in a combobox, it's the input element.
|
|
43
43
|
*
|
|
44
44
|
* Live examples:
|
|
45
|
-
* - [Sliding Menu](https://ariakit.
|
|
45
|
+
* - [Sliding Menu](https://ariakit.com/examples/menu-slide)
|
|
46
46
|
*/
|
|
47
47
|
baseElement: HTMLElement | null;
|
|
48
48
|
/**
|
|
@@ -54,12 +54,12 @@ export interface CompositeStoreState<T extends CompositeStoreItem = CompositeSto
|
|
|
54
54
|
* virtual focus.
|
|
55
55
|
*
|
|
56
56
|
* In both scenarios, the item in focus will carry the
|
|
57
|
-
* [`data-active-item`](https://ariakit.
|
|
57
|
+
* [`data-active-item`](https://ariakit.com/guide/styling#data-active-item)
|
|
58
58
|
* attribute.
|
|
59
59
|
*
|
|
60
60
|
* Live examples:
|
|
61
61
|
* - [Select with Combobox and
|
|
62
|
-
* Tabs](https://ariakit.
|
|
62
|
+
* Tabs](https://ariakit.com/examples/select-combobox-tab)
|
|
63
63
|
* @default false
|
|
64
64
|
*/
|
|
65
65
|
virtualFocus: boolean;
|
|
@@ -77,8 +77,8 @@ export interface CompositeStoreState<T extends CompositeStoreItem = CompositeSto
|
|
|
77
77
|
orientation: Orientation;
|
|
78
78
|
/**
|
|
79
79
|
* Determines how the
|
|
80
|
-
* [`next`](https://ariakit.
|
|
81
|
-
* [`previous`](https://ariakit.
|
|
80
|
+
* [`next`](https://ariakit.com/reference/use-composite-store#next) and
|
|
81
|
+
* [`previous`](https://ariakit.com/reference/use-composite-store#previous)
|
|
82
82
|
* functions will behave. If `rtl` is set to `true`, they will be inverted.
|
|
83
83
|
*
|
|
84
84
|
* This only affects the composite widget behavior. You still need to set
|
|
@@ -93,21 +93,21 @@ export interface CompositeStoreState<T extends CompositeStoreItem = CompositeSto
|
|
|
93
93
|
* On one-dimensional composite widgets:
|
|
94
94
|
* - `true` loops from the last item to the first item and vice-versa.
|
|
95
95
|
* - `horizontal` loops only if
|
|
96
|
-
* [`orientation`](https://ariakit.
|
|
96
|
+
* [`orientation`](https://ariakit.com/reference/composite-provider#orientation)
|
|
97
97
|
* is `horizontal` or not set.
|
|
98
98
|
* - `vertical` loops only if
|
|
99
|
-
* [`orientation`](https://ariakit.
|
|
99
|
+
* [`orientation`](https://ariakit.com/reference/composite-provider#orientation)
|
|
100
100
|
* is `vertical` or not set.
|
|
101
101
|
* - If
|
|
102
|
-
* [`includesBaseElement`](https://ariakit.
|
|
102
|
+
* [`includesBaseElement`](https://ariakit.com/reference/composite-provider#includesbaseelement)
|
|
103
103
|
* is set to `true` (or
|
|
104
|
-
* [`activeId`](https://ariakit.
|
|
104
|
+
* [`activeId`](https://ariakit.com/reference/composite-provider#activeid)
|
|
105
105
|
* is initially set to `null`), the composite element will be focused in
|
|
106
106
|
* between the last and first items.
|
|
107
107
|
*
|
|
108
108
|
* On two-dimensional composite widgets (when using
|
|
109
|
-
* [`CompositeRow`](https://ariakit.
|
|
110
|
-
* passing a [`rowId`](https://ariakit.
|
|
109
|
+
* [`CompositeRow`](https://ariakit.com/reference/composite-row) or explicitly
|
|
110
|
+
* passing a [`rowId`](https://ariakit.com/reference/composite-item#rowid)
|
|
111
111
|
* prop to composite items):
|
|
112
112
|
* - `true` loops from the last row/column item to the first item in the same
|
|
113
113
|
* row/column and vice-versa. If it's the last item in the last row, it
|
|
@@ -117,22 +117,22 @@ export interface CompositeStoreState<T extends CompositeStoreItem = CompositeSto
|
|
|
117
117
|
* - `vertical` loops only from the last column item to the first item in the
|
|
118
118
|
* column row.
|
|
119
119
|
* - If
|
|
120
|
-
* [`includesBaseElement`](https://ariakit.
|
|
120
|
+
* [`includesBaseElement`](https://ariakit.com/reference/composite-provider#includesbaseelement)
|
|
121
121
|
* is set to `true` (or
|
|
122
|
-
* [`activeId`](https://ariakit.
|
|
122
|
+
* [`activeId`](https://ariakit.com/reference/composite-provider#activeid)
|
|
123
123
|
* is initially set to `null`), vertical loop will have no effect as moving
|
|
124
124
|
* down from the last row or up from the first row will focus on the
|
|
125
125
|
* composite element.
|
|
126
126
|
* - If
|
|
127
|
-
* [`focusWrap`](https://ariakit.
|
|
127
|
+
* [`focusWrap`](https://ariakit.com/reference/composite-provider#focuswrap)
|
|
128
128
|
* matches the value of `focusLoop`, it'll wrap between the last item in the
|
|
129
129
|
* last row or column and the first item in the first row or column and
|
|
130
130
|
* vice-versa.
|
|
131
131
|
*
|
|
132
132
|
* Live examples:
|
|
133
|
-
* - [Command Menu](https://ariakit.
|
|
133
|
+
* - [Command Menu](https://ariakit.com/examples/dialog-combobox-command-menu)
|
|
134
134
|
* - [Command Menu with
|
|
135
|
-
* Tabs](https://ariakit.
|
|
135
|
+
* Tabs](https://ariakit.com/examples/dialog-combobox-tab-command-menu)
|
|
136
136
|
* @default false
|
|
137
137
|
*/
|
|
138
138
|
focusLoop: boolean | Orientation;
|
|
@@ -145,14 +145,14 @@ export interface CompositeStoreState<T extends CompositeStoreItem = CompositeSto
|
|
|
145
145
|
* - `horizontal` wraps only between rows.
|
|
146
146
|
* - `vertical` wraps only between columns.
|
|
147
147
|
* - If
|
|
148
|
-
* [`focusLoop`](https://ariakit.
|
|
148
|
+
* [`focusLoop`](https://ariakit.com/reference/composite-provider#focusloop)
|
|
149
149
|
* matches the value of `focusWrap`, it'll wrap between the last item in the
|
|
150
150
|
* last row or column and the first item in the first row or column and
|
|
151
151
|
* vice-versa.
|
|
152
152
|
*
|
|
153
153
|
* Live examples:
|
|
154
154
|
* - [Command Menu with
|
|
155
|
-
* Tabs](https://ariakit.
|
|
155
|
+
* Tabs](https://ariakit.com/examples/dialog-combobox-tab-command-menu)
|
|
156
156
|
* @default false
|
|
157
157
|
*/
|
|
158
158
|
focusWrap: boolean | Orientation;
|
|
@@ -164,13 +164,13 @@ export interface CompositeStoreState<T extends CompositeStoreItem = CompositeSto
|
|
|
164
164
|
*
|
|
165
165
|
* Live examples:
|
|
166
166
|
* - [Command Menu with
|
|
167
|
-
* Tabs](https://ariakit.
|
|
167
|
+
* Tabs](https://ariakit.com/examples/dialog-combobox-tab-command-menu)
|
|
168
168
|
* @default false
|
|
169
169
|
*/
|
|
170
170
|
focusShift: boolean;
|
|
171
171
|
/**
|
|
172
172
|
* The number of times the
|
|
173
|
-
* [`move`](https://ariakit.
|
|
173
|
+
* [`move`](https://ariakit.com/reference/use-composite-store#move) function
|
|
174
174
|
* has been called.
|
|
175
175
|
*/
|
|
176
176
|
moves: number;
|
|
@@ -184,27 +184,27 @@ export interface CompositeStoreState<T extends CompositeStoreItem = CompositeSto
|
|
|
184
184
|
*
|
|
185
185
|
* Live examples:
|
|
186
186
|
* - [Submenu with
|
|
187
|
-
* Combobox](https://ariakit.
|
|
188
|
-
* - [Command Menu](https://ariakit.
|
|
187
|
+
* Combobox](https://ariakit.com/examples/menu-nested-combobox)
|
|
188
|
+
* - [Command Menu](https://ariakit.com/examples/dialog-combobox-command-menu)
|
|
189
189
|
* @default false
|
|
190
190
|
*/
|
|
191
191
|
includesBaseElement: boolean;
|
|
192
192
|
/**
|
|
193
193
|
* The current active item `id`. The active item is the element within the
|
|
194
194
|
* composite widget that has either DOM or virtual focus (in case
|
|
195
|
-
* [`virtualFocus`](https://ariakit.
|
|
195
|
+
* [`virtualFocus`](https://ariakit.com/reference/composite-provider#virtualfocus)
|
|
196
196
|
* is enabled).
|
|
197
197
|
* - `null` represents the base composite element (the one with a [composite
|
|
198
198
|
* role](https://w3c.github.io/aria/#composite)). Users will be able to
|
|
199
199
|
* navigate out of it using arrow keys.
|
|
200
200
|
* - If `activeId` is initially set to `null`, the
|
|
201
|
-
* [`includesBaseElement`](https://ariakit.
|
|
201
|
+
* [`includesBaseElement`](https://ariakit.com/reference/composite-provider#includesbaseelement)
|
|
202
202
|
* prop will also default to `true`, which means the base composite element
|
|
203
203
|
* itself will have focus and users will be able to navigate to it using
|
|
204
204
|
* arrow keys.
|
|
205
205
|
*
|
|
206
206
|
* Live examples:
|
|
207
|
-
* - [Combobox with Tabs](https://ariakit.
|
|
207
|
+
* - [Combobox with Tabs](https://ariakit.com/examples/combobox-tabs)
|
|
208
208
|
*/
|
|
209
209
|
activeId: string | null | undefined;
|
|
210
210
|
}
|
|
@@ -215,9 +215,9 @@ export interface CompositeStoreFunctions<T extends CompositeStoreItem = Composit
|
|
|
215
215
|
setBaseElement: SetState<CompositeStoreState<T>["baseElement"]>;
|
|
216
216
|
/**
|
|
217
217
|
* Sets the
|
|
218
|
-
* [`activeId`](https://ariakit.
|
|
218
|
+
* [`activeId`](https://ariakit.com/reference/composite-provider#activeid)
|
|
219
219
|
* state _without moving focus_. If you want to move focus, use the
|
|
220
|
-
* [`move`](https://ariakit.
|
|
220
|
+
* [`move`](https://ariakit.com/reference/use-composite-store#move) function
|
|
221
221
|
* instead.
|
|
222
222
|
* @example
|
|
223
223
|
* // Sets the composite element as the active item
|
|
@@ -234,11 +234,11 @@ export interface CompositeStoreFunctions<T extends CompositeStoreItem = Composit
|
|
|
234
234
|
* [composite role](https://w3c.github.io/aria/#composite)). Users will be
|
|
235
235
|
* able to navigate out of it using arrow keys.
|
|
236
236
|
* - If you want to set the active item id _without moving focus_, use the
|
|
237
|
-
* [`setActiveId`](https://ariakit.
|
|
237
|
+
* [`setActiveId`](https://ariakit.com/reference/use-composite-store#setactiveid)
|
|
238
238
|
* function instead.
|
|
239
239
|
*
|
|
240
240
|
* Live examples:
|
|
241
|
-
* - [Select Grid](https://ariakit.
|
|
241
|
+
* - [Select Grid](https://ariakit.com/examples/select-grid)
|
|
242
242
|
* @example
|
|
243
243
|
* // Moves focus to the composite element
|
|
244
244
|
* store.move(null);
|
|
@@ -250,52 +250,60 @@ export interface CompositeStoreFunctions<T extends CompositeStoreItem = Composit
|
|
|
250
250
|
move: (id?: string | null) => void;
|
|
251
251
|
/**
|
|
252
252
|
* Returns the id of the next enabled item based on the current
|
|
253
|
-
* [`activeId`](https://ariakit.
|
|
253
|
+
* [`activeId`](https://ariakit.com/reference/composite-provider#activeid)
|
|
254
254
|
* state. You can pass additional options to override the current state.
|
|
255
255
|
* @example
|
|
256
256
|
* const nextId = store.next();
|
|
257
257
|
*/
|
|
258
|
-
next
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
258
|
+
next: {
|
|
259
|
+
(options?: NextOptions): string | null | undefined;
|
|
260
|
+
/**
|
|
261
|
+
* @deprecated Use the object syntax instead: `next({ skip: 2 })`.
|
|
262
|
+
*/
|
|
263
|
+
(skip?: number): string | null | undefined;
|
|
264
|
+
};
|
|
263
265
|
/**
|
|
264
266
|
* Returns the id of the previous enabled item based on the current
|
|
265
|
-
* [`activeId`](https://ariakit.
|
|
267
|
+
* [`activeId`](https://ariakit.com/reference/composite-provider#activeid)
|
|
266
268
|
* state. You can pass additional options to override the current state.
|
|
267
269
|
* @example
|
|
268
270
|
* const previousId = store.previous();
|
|
269
271
|
*/
|
|
270
|
-
previous
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
272
|
+
previous: {
|
|
273
|
+
(options?: NextOptions): string | null | undefined;
|
|
274
|
+
/**
|
|
275
|
+
* @deprecated Use the object syntax instead: `previous({ skip: 2 })`.
|
|
276
|
+
*/
|
|
277
|
+
(skip?: number): string | null | undefined;
|
|
278
|
+
};
|
|
275
279
|
/**
|
|
276
280
|
* Returns the id of the enabled item above based on the current
|
|
277
|
-
* [`activeId`](https://ariakit.
|
|
281
|
+
* [`activeId`](https://ariakit.com/reference/composite-provider#activeid)
|
|
278
282
|
* state. You can pass additional options to override the current state.
|
|
279
283
|
* @example
|
|
280
284
|
* const upId = store.up();
|
|
281
285
|
*/
|
|
282
|
-
up
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
286
|
+
up: {
|
|
287
|
+
(options?: NextOptions): string | null | undefined;
|
|
288
|
+
/**
|
|
289
|
+
* @deprecated Use the object syntax instead: `up({ skip: 2 })`.
|
|
290
|
+
*/
|
|
291
|
+
(skip?: number): string | null | undefined;
|
|
292
|
+
};
|
|
287
293
|
/**
|
|
288
294
|
* Returns the id of the enabled item below based on the current
|
|
289
|
-
* [`activeId`](https://ariakit.
|
|
295
|
+
* [`activeId`](https://ariakit.com/reference/composite-provider#activeid)
|
|
290
296
|
* state. You can pass additional options to override the current state.
|
|
291
297
|
* @example
|
|
292
298
|
* const downId = store.down();
|
|
293
299
|
*/
|
|
294
|
-
down
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
300
|
+
down: {
|
|
301
|
+
(options?: NextOptions): string | null | undefined;
|
|
302
|
+
/**
|
|
303
|
+
* @deprecated Use the object syntax instead: `down({ skip: 2 })`.
|
|
304
|
+
*/
|
|
305
|
+
(skip?: number): string | null | undefined;
|
|
306
|
+
};
|
|
299
307
|
/**
|
|
300
308
|
* Returns the id of the first enabled item.
|
|
301
309
|
*/
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
3
|
createCompositeStore
|
|
4
|
-
} from "../__chunks/
|
|
4
|
+
} from "../__chunks/UNDE2QJS.js";
|
|
5
5
|
import "../__chunks/7PRQYBBV.js";
|
|
6
|
-
import "../__chunks/
|
|
7
|
-
import "../__chunks/
|
|
8
|
-
import "../__chunks/
|
|
9
|
-
import "../__chunks/
|
|
6
|
+
import "../__chunks/KZX46JDB.js";
|
|
7
|
+
import "../__chunks/G7XPWBXK.js";
|
|
8
|
+
import "../__chunks/XTZ53NXG.js";
|
|
9
|
+
import "../__chunks/UWJK2WK2.js";
|
|
10
10
|
export {
|
|
11
11
|
createCompositeStore
|
|
12
12
|
};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
3
|
createDialogStore
|
|
4
|
-
} from "../__chunks/
|
|
5
|
-
import "../__chunks/
|
|
6
|
-
import "../__chunks/
|
|
7
|
-
import "../__chunks/
|
|
4
|
+
} from "../__chunks/7KNZCZ55.js";
|
|
5
|
+
import "../__chunks/IHNLLH3I.js";
|
|
6
|
+
import "../__chunks/XTZ53NXG.js";
|
|
7
|
+
import "../__chunks/UWJK2WK2.js";
|
|
8
8
|
export {
|
|
9
9
|
createDialogStore
|
|
10
10
|
};
|
|
@@ -9,25 +9,25 @@ export interface DisclosureStoreState {
|
|
|
9
9
|
* Whether the content is visible.
|
|
10
10
|
*
|
|
11
11
|
* Live examples:
|
|
12
|
-
* - [Combobox with links](https://ariakit.
|
|
12
|
+
* - [Combobox with links](https://ariakit.com/examples/combobox-links)
|
|
13
13
|
* - [Dialog with React
|
|
14
|
-
* Router](https://ariakit.
|
|
15
|
-
* - [Menu with
|
|
16
|
-
* Motion](https://ariakit.
|
|
17
|
-
* - [Lazy Popover](https://ariakit.
|
|
14
|
+
* Router](https://ariakit.com/examples/dialog-react-router)
|
|
15
|
+
* - [Menu with
|
|
16
|
+
* Motion](https://ariakit.com/examples/menu-framer-motion)
|
|
17
|
+
* - [Lazy Popover](https://ariakit.com/examples/popover-lazy)
|
|
18
18
|
* @default false
|
|
19
19
|
*/
|
|
20
20
|
open: boolean;
|
|
21
21
|
/**
|
|
22
22
|
* The mounted state usually matches the
|
|
23
|
-
* [`open`](https://ariakit.
|
|
23
|
+
* [`open`](https://ariakit.com/reference/disclosure-provider#open) value.
|
|
24
24
|
* However, if the content element is animated, it waits for the animation to
|
|
25
25
|
* finish before turning `false`. This ensures the content element doesn't get
|
|
26
26
|
* unmounted during the animation.
|
|
27
27
|
*
|
|
28
28
|
* Live examples:
|
|
29
|
-
* - [Navigation Menubar](https://ariakit.
|
|
30
|
-
* - [Responsive Popover](https://ariakit.
|
|
29
|
+
* - [Navigation Menubar](https://ariakit.com/examples/menubar-navigation)
|
|
30
|
+
* - [Responsive Popover](https://ariakit.com/examples/popover-responsive)
|
|
31
31
|
*/
|
|
32
32
|
mounted: boolean;
|
|
33
33
|
/**
|
|
@@ -55,43 +55,43 @@ export interface DisclosureStoreState {
|
|
|
55
55
|
}
|
|
56
56
|
export interface DisclosureStoreFunctions extends Pick<DisclosureStoreOptions, "disclosure"> {
|
|
57
57
|
/**
|
|
58
|
-
* Sets the [`open`](https://ariakit.
|
|
58
|
+
* Sets the [`open`](https://ariakit.com/reference/disclosure-provider#open)
|
|
59
59
|
* state.
|
|
60
60
|
*
|
|
61
61
|
* Live examples:
|
|
62
62
|
* - [Textarea with inline
|
|
63
|
-
* Combobox](https://ariakit.
|
|
63
|
+
* Combobox](https://ariakit.com/examples/combobox-textarea)
|
|
64
64
|
* @example
|
|
65
65
|
* store.setOpen(true);
|
|
66
66
|
* store.setOpen((open) => !open);
|
|
67
67
|
*/
|
|
68
68
|
setOpen: SetState<DisclosureStoreState["open"]>;
|
|
69
69
|
/**
|
|
70
|
-
* Sets the [`open`](https://ariakit.
|
|
70
|
+
* Sets the [`open`](https://ariakit.com/reference/disclosure-provider#open)
|
|
71
71
|
* state to `true`.
|
|
72
72
|
*
|
|
73
73
|
* Live examples:
|
|
74
74
|
* - [Textarea with inline
|
|
75
|
-
* Combobox](https://ariakit.
|
|
76
|
-
* - [Dialog with
|
|
77
|
-
* Motion](https://ariakit.
|
|
78
|
-
* - [Context Menu](https://ariakit.
|
|
79
|
-
* - [Navigation Menubar](https://ariakit.
|
|
75
|
+
* Combobox](https://ariakit.com/examples/combobox-textarea)
|
|
76
|
+
* - [Dialog with
|
|
77
|
+
* Motion](https://ariakit.com/examples/dialog-framer-motion)
|
|
78
|
+
* - [Context Menu](https://ariakit.com/examples/menu-context-menu)
|
|
79
|
+
* - [Navigation Menubar](https://ariakit.com/examples/menubar-navigation)
|
|
80
80
|
*/
|
|
81
81
|
show: () => void;
|
|
82
82
|
/**
|
|
83
|
-
* Sets the [`open`](https://ariakit.
|
|
83
|
+
* Sets the [`open`](https://ariakit.com/reference/disclosure-provider#open)
|
|
84
84
|
* state to `false`.
|
|
85
85
|
*
|
|
86
86
|
* Live examples:
|
|
87
87
|
* - [Textarea with inline
|
|
88
|
-
* Combobox](https://ariakit.
|
|
89
|
-
* - [Sliding Menu](https://ariakit.
|
|
88
|
+
* Combobox](https://ariakit.com/examples/combobox-textarea)
|
|
89
|
+
* - [Sliding Menu](https://ariakit.com/examples/menu-slide)
|
|
90
90
|
*/
|
|
91
91
|
hide: () => void;
|
|
92
92
|
/**
|
|
93
93
|
* Toggles the
|
|
94
|
-
* [`open`](https://ariakit.
|
|
94
|
+
* [`open`](https://ariakit.com/reference/disclosure-provider#open) state.
|
|
95
95
|
*/
|
|
96
96
|
toggle: () => void;
|
|
97
97
|
/**
|
|
@@ -109,7 +109,7 @@ export interface DisclosureStoreFunctions extends Pick<DisclosureStoreOptions, "
|
|
|
109
109
|
* Sets the `disclosureElement` state.
|
|
110
110
|
*
|
|
111
111
|
* Live examples:
|
|
112
|
-
* - [Navigation Menubar](https://ariakit.
|
|
112
|
+
* - [Navigation Menubar](https://ariakit.com/examples/menubar-navigation)
|
|
113
113
|
*/
|
|
114
114
|
setDisclosureElement: SetState<DisclosureStoreState["disclosureElement"]>;
|
|
115
115
|
}
|
|
@@ -128,7 +128,7 @@ export interface DisclosureStoreOptions extends StoreOptions<DisclosureStoreStat
|
|
|
128
128
|
* A reference to another disclosure store that controls another disclosure
|
|
129
129
|
* component to keep them in sync. Element states like `contentElement` and
|
|
130
130
|
* `disclosureElement` won't be synced. For that, use the
|
|
131
|
-
* [`store`](https://ariakit.
|
|
131
|
+
* [`store`](https://ariakit.com/reference/disclosure-provider#store) prop
|
|
132
132
|
* instead.
|
|
133
133
|
*/
|
|
134
134
|
disclosure?: DisclosureStore | null;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
3
|
createDisclosureStore
|
|
4
|
-
} from "../__chunks/
|
|
5
|
-
import "../__chunks/
|
|
6
|
-
import "../__chunks/
|
|
4
|
+
} from "../__chunks/IHNLLH3I.js";
|
|
5
|
+
import "../__chunks/XTZ53NXG.js";
|
|
6
|
+
import "../__chunks/UWJK2WK2.js";
|
|
7
7
|
export {
|
|
8
8
|
createDisclosureStore
|
|
9
9
|
};
|
package/esm/form/form-store.d.ts
CHANGED
|
@@ -21,8 +21,8 @@ export interface FormStoreState<T extends FormStoreValues = FormStoreValues> ext
|
|
|
21
21
|
* Form values.
|
|
22
22
|
*
|
|
23
23
|
* Live examples:
|
|
24
|
-
* - [FormRadio](https://ariakit.
|
|
25
|
-
* - [FormSelect](https://ariakit.
|
|
24
|
+
* - [FormRadio](https://ariakit.com/examples/form-radio)
|
|
25
|
+
* - [FormSelect](https://ariakit.com/examples/form-select)
|
|
26
26
|
* @default {}
|
|
27
27
|
*/
|
|
28
28
|
values: T;
|
|
@@ -48,13 +48,13 @@ export interface FormStoreState<T extends FormStoreValues = FormStoreValues> ext
|
|
|
48
48
|
submitting: boolean;
|
|
49
49
|
/**
|
|
50
50
|
* The number of times
|
|
51
|
-
* [`submit`](https://ariakit.
|
|
51
|
+
* [`submit`](https://ariakit.com/reference/use-form-store#submit) has been
|
|
52
52
|
* called with a successful response.
|
|
53
53
|
*/
|
|
54
54
|
submitSucceed: number;
|
|
55
55
|
/**
|
|
56
56
|
* The number of times
|
|
57
|
-
* [`submit`](https://ariakit.
|
|
57
|
+
* [`submit`](https://ariakit.com/reference/use-form-store#submit) has been
|
|
58
58
|
* called with an error response.
|
|
59
59
|
*/
|
|
60
60
|
submitFailed: number;
|
|
@@ -64,8 +64,8 @@ export interface FormStoreFunctions<T extends FormStoreValues = FormStoreValues>
|
|
|
64
64
|
* An object containing the names of the form fields for type safety.
|
|
65
65
|
*
|
|
66
66
|
* Live examples:
|
|
67
|
-
* - [FormRadio](https://ariakit.
|
|
68
|
-
* - [FormSelect](https://ariakit.
|
|
67
|
+
* - [FormRadio](https://ariakit.com/examples/form-radio)
|
|
68
|
+
* - [FormSelect](https://ariakit.com/examples/form-select)
|
|
69
69
|
* @example
|
|
70
70
|
* store.names.name; // "name"
|
|
71
71
|
* store.names.name.first; // "name.first"
|
|
@@ -73,7 +73,7 @@ export interface FormStoreFunctions<T extends FormStoreValues = FormStoreValues>
|
|
|
73
73
|
*/
|
|
74
74
|
names: Names<T>;
|
|
75
75
|
/**
|
|
76
|
-
* Sets the [`values`](https://ariakit.
|
|
76
|
+
* Sets the [`values`](https://ariakit.com/reference/form-provider#values)
|
|
77
77
|
* state.
|
|
78
78
|
* @example
|
|
79
79
|
* store.setValues({ name: "John" });
|
|
@@ -84,7 +84,7 @@ export interface FormStoreFunctions<T extends FormStoreValues = FormStoreValues>
|
|
|
84
84
|
* Retrieves a field value.
|
|
85
85
|
*
|
|
86
86
|
* Live examples:
|
|
87
|
-
* - [FormRadio](https://ariakit.
|
|
87
|
+
* - [FormRadio](https://ariakit.com/examples/form-radio)
|
|
88
88
|
* @example
|
|
89
89
|
* const nameValue = store.getValue("name");
|
|
90
90
|
* // Can also use store.names for type-safety.
|
|
@@ -95,7 +95,7 @@ export interface FormStoreFunctions<T extends FormStoreValues = FormStoreValues>
|
|
|
95
95
|
* Sets a field value.
|
|
96
96
|
*
|
|
97
97
|
* Live examples:
|
|
98
|
-
* - [FormSelect](https://ariakit.
|
|
98
|
+
* - [FormSelect](https://ariakit.com/examples/form-select)
|
|
99
99
|
* @example
|
|
100
100
|
* store.setValue("name", "John");
|
|
101
101
|
* store.setValue("name", (value) => value + " Doe");
|
|
@@ -122,7 +122,7 @@ export interface FormStoreFunctions<T extends FormStoreValues = FormStoreValues>
|
|
|
122
122
|
*/
|
|
123
123
|
removeValue: (name: StringLike, index: number) => void;
|
|
124
124
|
/**
|
|
125
|
-
* Sets the [`errors`](https://ariakit.
|
|
125
|
+
* Sets the [`errors`](https://ariakit.com/reference/form-provider#errors)
|
|
126
126
|
* state.
|
|
127
127
|
* @example
|
|
128
128
|
* store.setErrors({ name: "Name is required" });
|
|
@@ -141,7 +141,7 @@ export interface FormStoreFunctions<T extends FormStoreValues = FormStoreValues>
|
|
|
141
141
|
* Sets a field error.
|
|
142
142
|
*
|
|
143
143
|
* Live examples:
|
|
144
|
-
* - [FormRadio](https://ariakit.
|
|
144
|
+
* - [FormRadio](https://ariakit.com/examples/form-radio)
|
|
145
145
|
* @example
|
|
146
146
|
* store.setError("name", "Name is required");
|
|
147
147
|
* store.setError("name", (error) => error + "!");
|
|
@@ -150,7 +150,7 @@ export interface FormStoreFunctions<T extends FormStoreValues = FormStoreValues>
|
|
|
150
150
|
*/
|
|
151
151
|
setError: (name: StringLike, error: SetStateAction<ErrorMessage>) => void;
|
|
152
152
|
/**
|
|
153
|
-
* Sets the [`touched`](https://ariakit.
|
|
153
|
+
* Sets the [`touched`](https://ariakit.com/reference/form-provider#touched)
|
|
154
154
|
* state.
|
|
155
155
|
* @example
|
|
156
156
|
* store.setTouched({ name: true });
|
|
@@ -176,7 +176,7 @@ export interface FormStoreFunctions<T extends FormStoreValues = FormStoreValues>
|
|
|
176
176
|
setFieldTouched: (name: StringLike, value: SetStateAction<boolean>) => void;
|
|
177
177
|
/**
|
|
178
178
|
* Function that accepts a callback that will be used to validate the form
|
|
179
|
-
* when [`validate`](https://ariakit.
|
|
179
|
+
* when [`validate`](https://ariakit.com/reference/use-form-store#validate) is
|
|
180
180
|
* called. It returns a cleanup function that will remove the callback.
|
|
181
181
|
* @example
|
|
182
182
|
* const cleanup = store.onValidate(async (state) => {
|
|
@@ -189,7 +189,7 @@ export interface FormStoreFunctions<T extends FormStoreValues = FormStoreValues>
|
|
|
189
189
|
onValidate: (callback: FormStoreCallback<FormStoreState<T>>) => () => void;
|
|
190
190
|
/**
|
|
191
191
|
* Function that accepts a callback that will be used to submit the form when
|
|
192
|
-
* [`submit`](https://ariakit.
|
|
192
|
+
* [`submit`](https://ariakit.com/reference/use-form-store#submit) is called.
|
|
193
193
|
* It returns a cleanup function that will remove the callback.
|
|
194
194
|
* @param callback The callback function.
|
|
195
195
|
* @example
|
package/esm/form/form-store.js
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
3
|
createCollectionStore
|
|
4
|
-
} from "../__chunks/
|
|
5
|
-
import "../__chunks/
|
|
4
|
+
} from "../__chunks/KZX46JDB.js";
|
|
5
|
+
import "../__chunks/G7XPWBXK.js";
|
|
6
6
|
import {
|
|
7
7
|
createStore,
|
|
8
8
|
init,
|
|
9
9
|
setup,
|
|
10
10
|
sync,
|
|
11
11
|
throwOnConflictingProps
|
|
12
|
-
} from "../__chunks/
|
|
12
|
+
} from "../__chunks/XTZ53NXG.js";
|
|
13
13
|
import {
|
|
14
14
|
applyState,
|
|
15
15
|
defaultValue,
|
|
16
16
|
isInteger,
|
|
17
17
|
isObject
|
|
18
|
-
} from "../__chunks/
|
|
18
|
+
} from "../__chunks/UWJK2WK2.js";
|
|
19
19
|
|
|
20
20
|
// src/form/form-store.ts
|
|
21
21
|
function nextFrame() {
|
|
@@ -30,38 +30,42 @@ function hasMessages(object) {
|
|
|
30
30
|
});
|
|
31
31
|
}
|
|
32
32
|
function get(values, path, defaultValue2) {
|
|
33
|
-
|
|
34
|
-
const [key, ...rest] = Array.isArray(path) ? path : `${path}`.split(".");
|
|
33
|
+
const [key, ...rest] = Array.isArray(path) ? path : String(path).split(".");
|
|
35
34
|
if (key == null || !values) {
|
|
36
35
|
return defaultValue2;
|
|
37
36
|
}
|
|
38
37
|
if (!rest.length) {
|
|
39
|
-
return
|
|
38
|
+
return values[key] ?? defaultValue2;
|
|
40
39
|
}
|
|
41
40
|
return get(values[key], rest, defaultValue2);
|
|
42
41
|
}
|
|
42
|
+
function getOrCreateNested(nestedValues, nextKey) {
|
|
43
|
+
if (Array.isArray(nestedValues) || isObject(nestedValues)) {
|
|
44
|
+
return nestedValues;
|
|
45
|
+
}
|
|
46
|
+
return isInteger(nextKey) ? [] : {};
|
|
47
|
+
}
|
|
43
48
|
function set(values, path, value) {
|
|
44
|
-
const [k, ...rest] = Array.isArray(path) ? path :
|
|
49
|
+
const [k, ...rest] = Array.isArray(path) ? path : String(path).split(".");
|
|
45
50
|
if (k == null) return values;
|
|
46
51
|
const key = k;
|
|
47
52
|
const isIntegerKey = isInteger(key);
|
|
48
53
|
const nextValues = isIntegerKey ? values || [] : values || {};
|
|
49
54
|
const nestedValues = nextValues[key];
|
|
50
|
-
const
|
|
55
|
+
const nextKey = rest[0];
|
|
56
|
+
const result = rest.length && nextKey != null ? set(getOrCreateNested(nestedValues, nextKey), rest, value) : value;
|
|
51
57
|
if (isIntegerKey) {
|
|
52
58
|
const index = Number(key);
|
|
53
59
|
if (values && Array.isArray(values)) {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
...values.slice(index + 1)
|
|
58
|
-
];
|
|
60
|
+
const copy = [...values];
|
|
61
|
+
copy[index] = result;
|
|
62
|
+
return copy;
|
|
59
63
|
}
|
|
60
64
|
const nextValues2 = [];
|
|
61
65
|
nextValues2[index] = result;
|
|
62
66
|
return nextValues2;
|
|
63
67
|
}
|
|
64
|
-
return {
|
|
68
|
+
return Object.assign({}, values, { [key]: result });
|
|
65
69
|
}
|
|
66
70
|
function setAll(values, value) {
|
|
67
71
|
const result = {};
|