@ariakit/core 0.1.2 → 0.1.4
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 +16 -0
- package/cjs/__chunks/{IBEUC4KN.cjs → 4DQ3OTE7.cjs} +1 -2
- package/cjs/__chunks/{6GFPNMAE.cjs → W5IHD6VG.cjs} +2 -2
- package/cjs/checkbox/checkbox-store.d.ts +7 -0
- package/cjs/collection/collection-store.cjs +2 -2
- package/cjs/combobox/combobox-store.cjs +3 -3
- package/cjs/combobox/combobox-store.d.ts +24 -0
- package/cjs/composite/composite-store.cjs +3 -3
- package/cjs/composite/composite-store.d.ts +38 -34
- package/cjs/disclosure/disclosure-store.d.ts +28 -6
- package/cjs/form/form-store.cjs +10 -10
- package/cjs/menu/menu-bar-store.cjs +3 -3
- package/cjs/menu/menu-store.cjs +3 -3
- package/cjs/radio/radio-store.cjs +3 -3
- package/cjs/select/select-store.cjs +3 -3
- package/cjs/select/select-store.d.ts +16 -0
- package/cjs/tab/tab-store.cjs +4 -4
- package/cjs/toolbar/toolbar-store.cjs +3 -3
- package/cjs/tsconfig.build.tsbuildinfo +1 -1
- package/cjs/utils/focus.cjs +29 -1
- package/cjs/utils/focus.d.ts +1 -1
- package/cjs/utils/store.d.ts +7 -0
- package/esm/__chunks/{HWAS6XKA.js → WFGVC6LE.js} +1 -2
- package/esm/__chunks/{RRTNFXIK.js → X7MJ3FB5.js} +1 -1
- package/esm/checkbox/checkbox-store.d.ts +7 -0
- package/esm/collection/collection-store.js +1 -1
- package/esm/combobox/combobox-store.d.ts +24 -0
- package/esm/combobox/combobox-store.js +2 -2
- package/esm/composite/composite-store.d.ts +38 -34
- package/esm/composite/composite-store.js +2 -2
- package/esm/disclosure/disclosure-store.d.ts +28 -6
- package/esm/form/form-store.js +9 -9
- package/esm/menu/menu-bar-store.js +2 -2
- package/esm/menu/menu-store.js +2 -2
- package/esm/radio/radio-store.js +2 -2
- package/esm/select/select-store.d.ts +16 -0
- package/esm/select/select-store.js +2 -2
- package/esm/tab/tab-store.js +2 -2
- package/esm/toolbar/toolbar-store.js +2 -2
- package/esm/tsconfig.build.tsbuildinfo +1 -1
- package/esm/utils/focus.d.ts +1 -1
- package/esm/utils/focus.js +29 -1
- package/esm/utils/store.d.ts +7 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @ariakit/core
|
|
2
2
|
|
|
3
|
+
## 0.1.4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated JSDocs.
|
|
8
|
+
|
|
9
|
+
## 0.1.3
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- Added support for native radio buttons within forms, that work with roving tabindex, to all `focus` utilities. ([#2313](https://github.com/ariakit/ariakit/pull/2313))
|
|
14
|
+
|
|
15
|
+
- Updated validate and submit callbacks on `Form` so they always run in a consistent order. ([#2319](https://github.com/ariakit/ariakit/pull/2319))
|
|
16
|
+
|
|
17
|
+
- Marked internal store functions as deprecated/experimental. ([#2316](https://github.com/ariakit/ariakit/pull/2316))
|
|
18
|
+
|
|
3
19
|
## 0.1.2
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
|
@@ -75,8 +75,7 @@ function createCollectionStore(props = {}) {
|
|
|
75
75
|
return privateStore.syncBatch(
|
|
76
76
|
(state) => {
|
|
77
77
|
let firstRun = true;
|
|
78
|
-
let raf =
|
|
79
|
-
raf = requestAnimationFrame(sortItems);
|
|
78
|
+
let raf = requestAnimationFrame(sortItems);
|
|
80
79
|
if (typeof IntersectionObserver !== "function")
|
|
81
80
|
return;
|
|
82
81
|
const callback = () => {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _4DQ3OTE7cjs = require('./4DQ3OTE7.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
var _ZPOXPO2Lcjs = require('./ZPOXPO2L.cjs');
|
|
@@ -114,7 +114,7 @@ function verticalizeItems(items) {
|
|
|
114
114
|
}
|
|
115
115
|
function createCompositeStore(props = {}) {
|
|
116
116
|
const syncState = _optionalChain([props, 'access', _4 => _4.store, 'optionalAccess', _5 => _5.getState, 'call', _6 => _6()]);
|
|
117
|
-
const collection =
|
|
117
|
+
const collection = _4DQ3OTE7cjs.createCollectionStore.call(void 0, props);
|
|
118
118
|
const activeId = _QNEPGQLLcjs.defaultValue.call(void 0,
|
|
119
119
|
props.activeId,
|
|
120
120
|
_optionalChain([syncState, 'optionalAccess', _7 => _7.activeId]),
|
|
@@ -10,6 +10,9 @@ export type CheckboxStoreValue = Value;
|
|
|
10
10
|
export interface CheckboxStoreState<T extends Value = Value> {
|
|
11
11
|
/**
|
|
12
12
|
* The checked state of the checkbox.
|
|
13
|
+
*
|
|
14
|
+
* Live examples:
|
|
15
|
+
* - [Custom Checkbox](https://ariakit.org/examples/checkbox-custom)
|
|
13
16
|
*/
|
|
14
17
|
value: ToPrimitive<T>;
|
|
15
18
|
}
|
|
@@ -25,6 +28,10 @@ export interface CheckboxStoreFunctions<T extends Value = Value> {
|
|
|
25
28
|
export interface CheckboxStoreOptions<T extends Value = Value> extends StoreOptions<CheckboxStoreState<T>, "value"> {
|
|
26
29
|
/**
|
|
27
30
|
* The default value of the checkbox.
|
|
31
|
+
*
|
|
32
|
+
* Live examples:
|
|
33
|
+
* - [Custom Checkbox](https://ariakit.org/examples/checkbox-custom)
|
|
34
|
+
* - [Checkbox group](https://ariakit.org/examples/checkbox-group)
|
|
28
35
|
* @default false
|
|
29
36
|
*/
|
|
30
37
|
defaultValue?: CheckboxStoreState<T>["value"];
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _4DQ3OTE7cjs = require('../__chunks/4DQ3OTE7.cjs');
|
|
4
4
|
require('../__chunks/ZPOXPO2L.cjs');
|
|
5
5
|
require('../__chunks/QNEPGQLL.cjs');
|
|
6
6
|
require('../__chunks/OFNGELMA.cjs');
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
exports.createCollectionStore =
|
|
9
|
+
exports.createCollectionStore = _4DQ3OTE7cjs.createCollectionStore;
|
|
@@ -5,8 +5,8 @@ require('../__chunks/ZJEEK57E.cjs');
|
|
|
5
5
|
require('../__chunks/QYB6XH64.cjs');
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
var
|
|
9
|
-
require('../__chunks/
|
|
8
|
+
var _W5IHD6VGcjs = require('../__chunks/W5IHD6VG.cjs');
|
|
9
|
+
require('../__chunks/4DQ3OTE7.cjs');
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
|
|
@@ -57,7 +57,7 @@ function createComboboxStore({
|
|
|
57
57
|
props.defaultActiveId,
|
|
58
58
|
null
|
|
59
59
|
);
|
|
60
|
-
const composite =
|
|
60
|
+
const composite = _W5IHD6VGcjs.createCompositeStore.call(void 0, {
|
|
61
61
|
...props,
|
|
62
62
|
store,
|
|
63
63
|
activeId,
|
|
@@ -19,6 +19,15 @@ export interface ComboboxStoreState extends CompositeStoreState<Item>, PopoverSt
|
|
|
19
19
|
includesBaseElement: boolean;
|
|
20
20
|
/**
|
|
21
21
|
* The input value.
|
|
22
|
+
*
|
|
23
|
+
* Live examples:
|
|
24
|
+
* - [ComboboxGroup](https://ariakit.org/examples/combobox-group)
|
|
25
|
+
* - [Combobox with links](https://ariakit.org/examples/combobox-links)
|
|
26
|
+
* - [Filterable Combobox](https://ariakit.org/examples/combobox-matches)
|
|
27
|
+
* - [Multi-selectable
|
|
28
|
+
* Combobox](https://ariakit.org/examples/combobox-multiple)
|
|
29
|
+
* - [Textarea with inline
|
|
30
|
+
* Combobox](https://ariakit.org/examples/combobox-textarea)
|
|
22
31
|
*/
|
|
23
32
|
value: string;
|
|
24
33
|
/**
|
|
@@ -27,12 +36,23 @@ export interface ComboboxStoreState extends CompositeStoreState<Item>, PopoverSt
|
|
|
27
36
|
activeValue: string | undefined;
|
|
28
37
|
/**
|
|
29
38
|
* Whether to reset the value when the combobox popover is hidden.
|
|
39
|
+
*
|
|
40
|
+
* Live examples:
|
|
41
|
+
* - [Multi-selectable
|
|
42
|
+
* Combobox](https://ariakit.org/examples/combobox-multiple)
|
|
43
|
+
* @default false
|
|
30
44
|
*/
|
|
31
45
|
resetValueOnHide: boolean;
|
|
32
46
|
}
|
|
33
47
|
export interface ComboboxStoreFunctions extends CompositeStoreFunctions<Item>, PopoverStoreFunctions {
|
|
34
48
|
/**
|
|
35
49
|
* Sets the `value` state.
|
|
50
|
+
*
|
|
51
|
+
* Live examples:
|
|
52
|
+
* - [Multi-selectable
|
|
53
|
+
* Combobox](https://ariakit.org/examples/combobox-multiple)
|
|
54
|
+
* - [Textarea with inline
|
|
55
|
+
* Combobox](https://ariakit.org/examples/combobox-textarea)
|
|
36
56
|
* @example
|
|
37
57
|
* store.setValue("Hello world");
|
|
38
58
|
* store.setValue((value) => value + "!");
|
|
@@ -58,6 +78,10 @@ export interface ComboboxStoreOptions extends StoreOptions<ComboboxStoreState, "
|
|
|
58
78
|
select?: SelectStore;
|
|
59
79
|
/**
|
|
60
80
|
* The combobox initial value.
|
|
81
|
+
*
|
|
82
|
+
* Live examples:
|
|
83
|
+
* - [Multi-selectable
|
|
84
|
+
* Combobox](https://ariakit.org/examples/combobox-multiple)
|
|
61
85
|
* @default ""
|
|
62
86
|
*/
|
|
63
87
|
defaultValue?: ComboboxStoreState["value"];
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
require('../__chunks/
|
|
3
|
+
var _W5IHD6VGcjs = require('../__chunks/W5IHD6VG.cjs');
|
|
4
|
+
require('../__chunks/4DQ3OTE7.cjs');
|
|
5
5
|
require('../__chunks/ZPOXPO2L.cjs');
|
|
6
6
|
require('../__chunks/QNEPGQLL.cjs');
|
|
7
7
|
require('../__chunks/OFNGELMA.cjs');
|
|
8
8
|
require('../__chunks/GDZQUFNP.cjs');
|
|
9
9
|
|
|
10
10
|
|
|
11
|
-
exports.createCompositeStore =
|
|
11
|
+
exports.createCompositeStore = _W5IHD6VGcjs.createCompositeStore;
|
|
@@ -25,6 +25,10 @@ export interface CompositeStoreState<T extends Item = Item> extends CollectionSt
|
|
|
25
25
|
* tabindex](https://www.w3.org/WAI/ARIA/apg/practices/keyboard-interface/#kbd_roving_tabindex).
|
|
26
26
|
* DOM focus will remain on the composite element while its items receive
|
|
27
27
|
* virtual focus.
|
|
28
|
+
*
|
|
29
|
+
* Live examples:
|
|
30
|
+
* - [Multi-selectable
|
|
31
|
+
* Combobox](https://ariakit.org/examples/combobox-multiple)
|
|
28
32
|
* @default false
|
|
29
33
|
*/
|
|
30
34
|
virtualFocus: boolean;
|
|
@@ -32,9 +36,9 @@ export interface CompositeStoreState<T extends Item = Item> extends CollectionSt
|
|
|
32
36
|
* Defines the orientation of the composite widget. If the composite has a
|
|
33
37
|
* single row or column (one-dimensional), the `orientation` value determines
|
|
34
38
|
* which arrow keys can be used to move focus:
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
*
|
|
39
|
+
* - `both`: all arrow keys work.
|
|
40
|
+
* - `horizontal`: only left and right arrow keys work.
|
|
41
|
+
* - `vertical`: only up and down arrow keys work.
|
|
38
42
|
*
|
|
39
43
|
* It doesn't have any effect on two-dimensional composites.
|
|
40
44
|
* @default "both"
|
|
@@ -52,27 +56,27 @@ export interface CompositeStoreState<T extends Item = Item> extends CollectionSt
|
|
|
52
56
|
* composite widget.
|
|
53
57
|
*
|
|
54
58
|
* On one-dimensional composites:
|
|
55
|
-
*
|
|
56
|
-
*
|
|
57
|
-
*
|
|
58
|
-
*
|
|
59
|
-
*
|
|
60
|
-
*
|
|
59
|
+
* - `true` loops from the last item to the first item and vice-versa.
|
|
60
|
+
* - `horizontal` loops only if `orientation` is `horizontal` or not set.
|
|
61
|
+
* - `vertical` loops only if `orientation` is `vertical` or not set.
|
|
62
|
+
* - If `includesBaseElement` is set to `true` (or `activeId` is initially set
|
|
63
|
+
* to `null`), the composite element will be focused in between the last and
|
|
64
|
+
* first items.
|
|
61
65
|
*
|
|
62
66
|
* On two-dimensional composites (when using `CompositeRow`):
|
|
63
|
-
*
|
|
64
|
-
*
|
|
65
|
-
*
|
|
66
|
-
*
|
|
67
|
-
*
|
|
68
|
-
*
|
|
69
|
-
*
|
|
70
|
-
*
|
|
71
|
-
*
|
|
72
|
-
*
|
|
73
|
-
*
|
|
74
|
-
*
|
|
75
|
-
*
|
|
67
|
+
* - `true` loops from the last row/column item to the first item in the same
|
|
68
|
+
* row/column and vice-versa. If it's the last item in the last row, it
|
|
69
|
+
* moves to the first item in the first row and vice-versa.
|
|
70
|
+
* - `horizontal` loops only from the last row item to the first item in the
|
|
71
|
+
* same row.
|
|
72
|
+
* - `vertical` loops only from the last column item to the first item in the
|
|
73
|
+
* column row.
|
|
74
|
+
* - If `includesBaseElement` is set to `true` (or `activeId` is initially set
|
|
75
|
+
* to `null`), vertical loop will have no effect as moving down from the
|
|
76
|
+
* last row or up from the first row will focus the composite element.
|
|
77
|
+
* - If `focusWrap` matches the value of `focusLoop`, it'll wrap between the
|
|
78
|
+
* last item in the last row or column and the first item in the first row
|
|
79
|
+
* or column and vice-versa.
|
|
76
80
|
* @default false
|
|
77
81
|
*/
|
|
78
82
|
focusLoop: boolean | Orientation;
|
|
@@ -80,12 +84,12 @@ export interface CompositeStoreState<T extends Item = Item> extends CollectionSt
|
|
|
80
84
|
* **Works only on two-dimensional composites**. If enabled, moving to the
|
|
81
85
|
* next item from the last one in a row or column will focus the first item in
|
|
82
86
|
* the next row or column and vice-versa.
|
|
83
|
-
*
|
|
84
|
-
*
|
|
85
|
-
*
|
|
86
|
-
*
|
|
87
|
-
*
|
|
88
|
-
*
|
|
87
|
+
* - `true` wraps between rows and columns.
|
|
88
|
+
* - `horizontal` wraps only between rows.
|
|
89
|
+
* - `vertical` wraps only between columns.
|
|
90
|
+
* - If `focusLoop` matches the value of `focusWrap`, it'll wrap between the
|
|
91
|
+
* last item in the last row or column and the first item in the first row
|
|
92
|
+
* or column and vice-versa.
|
|
89
93
|
* @default false
|
|
90
94
|
*/
|
|
91
95
|
focusWrap: boolean | Orientation;
|
|
@@ -108,12 +112,12 @@ export interface CompositeStoreState<T extends Item = Item> extends CollectionSt
|
|
|
108
112
|
includesBaseElement: boolean;
|
|
109
113
|
/**
|
|
110
114
|
* The current focused item `id`.
|
|
111
|
-
*
|
|
112
|
-
*
|
|
113
|
-
*
|
|
114
|
-
*
|
|
115
|
-
*
|
|
116
|
-
*
|
|
115
|
+
* - `null` focuses the base composite element and users will be able to
|
|
116
|
+
* navigate out of it using arrow keys.
|
|
117
|
+
* - If `activeId` is initially set to `null`, the `includesBaseElement` prop
|
|
118
|
+
* will also default to `true`, which means the base composite element
|
|
119
|
+
* itself will have focus and users will be able to navigate to it using
|
|
120
|
+
* arrow keys.
|
|
117
121
|
*/
|
|
118
122
|
activeId: string | null | undefined;
|
|
119
123
|
}
|
|
@@ -15,16 +15,26 @@ export interface DisclosureStoreState {
|
|
|
15
15
|
* this will be the same as `open`. Otherwise, it will wait for the animation
|
|
16
16
|
* to complete before becoming `false` so the content is not unmounted while
|
|
17
17
|
* animating.
|
|
18
|
+
*
|
|
19
|
+
* Live examples:
|
|
20
|
+
* - [Combobox with links](https://ariakit.org/examples/combobox-links)
|
|
21
|
+
* - [Textarea with inline
|
|
22
|
+
* Combobox](https://ariakit.org/examples/combobox-textarea)
|
|
18
23
|
*/
|
|
19
24
|
mounted: boolean;
|
|
20
25
|
/**
|
|
21
26
|
* Determines whether the content should animate when it is shown or hidden.
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
27
|
+
* - If `true`, the `animating` state will be `true` when the content is shown
|
|
28
|
+
* or hidden and it will wait for `stopAnimation` to be called or a CSS
|
|
29
|
+
* animation/transition to end before becoming `false`.
|
|
30
|
+
* - If it's set to a number, the `animating` state will be `true` when the
|
|
31
|
+
* content is shown or hidden and it will wait for the number of
|
|
32
|
+
* milliseconds to pass before becoming `false`.
|
|
33
|
+
*
|
|
34
|
+
* Live examples:
|
|
35
|
+
* - [Animated Combobox](https://ariakit.org/examples/combobox-animated)
|
|
36
|
+
* - [Animated Dialog](https://ariakit.org/examples/dialog-animated)
|
|
37
|
+
* - [Animated Select](https://ariakit.org/examples/select-animated)
|
|
28
38
|
* @default false
|
|
29
39
|
*/
|
|
30
40
|
animated: boolean | number;
|
|
@@ -44,6 +54,10 @@ export interface DisclosureStoreState {
|
|
|
44
54
|
export interface DisclosureStoreFunctions {
|
|
45
55
|
/**
|
|
46
56
|
* Sets the `open` state.
|
|
57
|
+
*
|
|
58
|
+
* Live examples:
|
|
59
|
+
* - [Textarea with inline
|
|
60
|
+
* Combobox](https://ariakit.org/examples/combobox-textarea)
|
|
47
61
|
* @example
|
|
48
62
|
* store.setOpen(true);
|
|
49
63
|
* store.setOpen((open) => !open);
|
|
@@ -51,10 +65,18 @@ export interface DisclosureStoreFunctions {
|
|
|
51
65
|
setOpen: SetState<DisclosureStoreState["open"]>;
|
|
52
66
|
/**
|
|
53
67
|
* Sets the `open` state to `true`.
|
|
68
|
+
*
|
|
69
|
+
* Live examples:
|
|
70
|
+
* - [Textarea with inline
|
|
71
|
+
* Combobox](https://ariakit.org/examples/combobox-textarea)
|
|
54
72
|
*/
|
|
55
73
|
show: () => void;
|
|
56
74
|
/**
|
|
57
75
|
* Sets the `open` state to `false`.
|
|
76
|
+
*
|
|
77
|
+
* Live examples:
|
|
78
|
+
* - [Textarea with inline
|
|
79
|
+
* Combobox](https://ariakit.org/examples/combobox-textarea)
|
|
58
80
|
*/
|
|
59
81
|
hide: () => void;
|
|
60
82
|
/**
|
package/cjs/form/form-store.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _4DQ3OTE7cjs = require('../__chunks/4DQ3OTE7.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
var _ZPOXPO2Lcjs = require('../__chunks/ZPOXPO2L.cjs');
|
|
@@ -102,7 +102,7 @@ function createNames() {
|
|
|
102
102
|
}
|
|
103
103
|
function createFormStore(props = {}) {
|
|
104
104
|
const syncState = _optionalChain([props, 'access', _ => _.store, 'optionalAccess', _2 => _2.getState, 'call', _3 => _3()]);
|
|
105
|
-
const collection =
|
|
105
|
+
const collection = _4DQ3OTE7cjs.createCollectionStore.call(void 0, props);
|
|
106
106
|
const values = _QNEPGQLLcjs.defaultValue.call(void 0,
|
|
107
107
|
props.values,
|
|
108
108
|
_optionalChain([syncState, 'optionalAccess', _4 => _4.values]),
|
|
@@ -139,9 +139,10 @@ function createFormStore(props = {}) {
|
|
|
139
139
|
form.setState("validating", true);
|
|
140
140
|
form.setState("errors", {});
|
|
141
141
|
try {
|
|
142
|
-
const
|
|
143
|
-
|
|
144
|
-
|
|
142
|
+
for (const callback of validateCallbacks) {
|
|
143
|
+
await callback(form.getState());
|
|
144
|
+
}
|
|
145
|
+
await nextFrame();
|
|
145
146
|
return !hasMessages(form.getState().errors);
|
|
146
147
|
} finally {
|
|
147
148
|
form.setState("validating", false);
|
|
@@ -204,11 +205,10 @@ function createFormStore(props = {}) {
|
|
|
204
205
|
form.setState("touched", setAll(form.getState().values, true));
|
|
205
206
|
try {
|
|
206
207
|
if (await validate()) {
|
|
207
|
-
const
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
);
|
|
211
|
-
await Promise.all(results).then(nextFrame);
|
|
208
|
+
for (const callback of submitCallbacks) {
|
|
209
|
+
await callback(form.getState());
|
|
210
|
+
}
|
|
211
|
+
await nextFrame();
|
|
212
212
|
if (!hasMessages(form.getState().errors)) {
|
|
213
213
|
form.setState("submitSucceed", (count) => count + 1);
|
|
214
214
|
return true;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
require('../__chunks/
|
|
3
|
+
var _W5IHD6VGcjs = require('../__chunks/W5IHD6VG.cjs');
|
|
4
|
+
require('../__chunks/4DQ3OTE7.cjs');
|
|
5
5
|
require('../__chunks/ZPOXPO2L.cjs');
|
|
6
6
|
|
|
7
7
|
|
|
@@ -12,7 +12,7 @@ require('../__chunks/GDZQUFNP.cjs');
|
|
|
12
12
|
// src/menu/menu-bar-store.ts
|
|
13
13
|
function createMenuBarStore(props = {}) {
|
|
14
14
|
const syncState = _optionalChain([props, 'access', _ => _.store, 'optionalAccess', _2 => _2.getState, 'call', _3 => _3()]);
|
|
15
|
-
return
|
|
15
|
+
return _W5IHD6VGcjs.createCompositeStore.call(void 0, {
|
|
16
16
|
...props,
|
|
17
17
|
orientation: _QNEPGQLLcjs.defaultValue.call(void 0,
|
|
18
18
|
props.orientation,
|
package/cjs/menu/menu-store.cjs
CHANGED
|
@@ -6,8 +6,8 @@ require('../__chunks/ZJEEK57E.cjs');
|
|
|
6
6
|
require('../__chunks/QYB6XH64.cjs');
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
var
|
|
10
|
-
require('../__chunks/
|
|
9
|
+
var _W5IHD6VGcjs = require('../__chunks/W5IHD6VG.cjs');
|
|
10
|
+
require('../__chunks/4DQ3OTE7.cjs');
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
|
|
@@ -36,7 +36,7 @@ function createMenuStore({
|
|
|
36
36
|
)])
|
|
37
37
|
);
|
|
38
38
|
const syncState = store.getState();
|
|
39
|
-
const composite =
|
|
39
|
+
const composite = _W5IHD6VGcjs.createCompositeStore.call(void 0, {
|
|
40
40
|
...props,
|
|
41
41
|
store,
|
|
42
42
|
orientation: _QNEPGQLLcjs.defaultValue.call(void 0,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
require('../__chunks/
|
|
3
|
+
var _W5IHD6VGcjs = require('../__chunks/W5IHD6VG.cjs');
|
|
4
|
+
require('../__chunks/4DQ3OTE7.cjs');
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
var _ZPOXPO2Lcjs = require('../__chunks/ZPOXPO2L.cjs');
|
|
@@ -16,7 +16,7 @@ function createRadioStore({
|
|
|
16
16
|
...props
|
|
17
17
|
} = {}) {
|
|
18
18
|
const syncState = _optionalChain([props, 'access', _ => _.store, 'optionalAccess', _2 => _2.getState, 'call', _3 => _3()]);
|
|
19
|
-
const composite =
|
|
19
|
+
const composite = _W5IHD6VGcjs.createCompositeStore.call(void 0, {
|
|
20
20
|
...props,
|
|
21
21
|
focusLoop: _QNEPGQLLcjs.defaultValue.call(void 0, props.focusLoop, _optionalChain([syncState, 'optionalAccess', _4 => _4.focusLoop]), true)
|
|
22
22
|
});
|
|
@@ -5,8 +5,8 @@ require('../__chunks/ZJEEK57E.cjs');
|
|
|
5
5
|
require('../__chunks/QYB6XH64.cjs');
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
var
|
|
9
|
-
require('../__chunks/
|
|
8
|
+
var _W5IHD6VGcjs = require('../__chunks/W5IHD6VG.cjs');
|
|
9
|
+
require('../__chunks/4DQ3OTE7.cjs');
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
|
|
@@ -39,7 +39,7 @@ function createSelectStore({
|
|
|
39
39
|
)])
|
|
40
40
|
);
|
|
41
41
|
const syncState = store.getState();
|
|
42
|
-
const composite =
|
|
42
|
+
const composite = _W5IHD6VGcjs.createCompositeStore.call(void 0, {
|
|
43
43
|
...props,
|
|
44
44
|
store,
|
|
45
45
|
virtualFocus: _QNEPGQLLcjs.defaultValue.call(void 0,
|
|
@@ -35,6 +35,10 @@ export interface SelectStoreState<T extends Value = Value> extends CompositeStor
|
|
|
35
35
|
placement: PopoverStoreState["placement"];
|
|
36
36
|
/**
|
|
37
37
|
* The select value.
|
|
38
|
+
*
|
|
39
|
+
* Live examples:
|
|
40
|
+
* - [Multi-selectable
|
|
41
|
+
* Combobox](https://ariakit.org/examples/combobox-multiple)
|
|
38
42
|
*/
|
|
39
43
|
value: MutableValue<T>;
|
|
40
44
|
/**
|
|
@@ -55,6 +59,10 @@ export interface SelectStoreState<T extends Value = Value> extends CompositeStor
|
|
|
55
59
|
export interface SelectStoreFunctions<T extends Value = Value> extends CompositeStoreFunctions<Item>, PopoverStoreFunctions {
|
|
56
60
|
/**
|
|
57
61
|
* Sets the `value` state.
|
|
62
|
+
*
|
|
63
|
+
* Live examples:
|
|
64
|
+
* - [Multi-selectable
|
|
65
|
+
* Combobox](https://ariakit.org/examples/combobox-multiple)
|
|
58
66
|
* @example
|
|
59
67
|
* store.setValue("Apple");
|
|
60
68
|
* store.setValue(["Apple", "Banana"]);
|
|
@@ -75,10 +83,18 @@ export interface SelectStoreOptions<T extends Value = Value> extends StoreOption
|
|
|
75
83
|
* A reference to a combobox store. This is used when combining the combobox
|
|
76
84
|
* with a select (e.g., select with a search input). The stores will share the
|
|
77
85
|
* same state.
|
|
86
|
+
*
|
|
87
|
+
* Live examples:
|
|
88
|
+
* - [Multi-selectable
|
|
89
|
+
* Combobox](https://ariakit.org/examples/combobox-multiple)
|
|
78
90
|
*/
|
|
79
91
|
combobox?: ComboboxStore;
|
|
80
92
|
/**
|
|
81
93
|
* The default value. If not set, the first non-disabled item will be used.
|
|
94
|
+
*
|
|
95
|
+
* Live examples:
|
|
96
|
+
* - [Multi-selectable
|
|
97
|
+
* Combobox](https://ariakit.org/examples/combobox-multiple)
|
|
82
98
|
*/
|
|
83
99
|
defaultValue?: SelectStoreState<T>["value"];
|
|
84
100
|
}
|
package/cjs/tab/tab-store.cjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _W5IHD6VGcjs = require('../__chunks/W5IHD6VG.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
var
|
|
6
|
+
var _4DQ3OTE7cjs = require('../__chunks/4DQ3OTE7.cjs');
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
var _ZPOXPO2Lcjs = require('../__chunks/ZPOXPO2L.cjs');
|
|
@@ -16,7 +16,7 @@ require('../__chunks/GDZQUFNP.cjs');
|
|
|
16
16
|
// src/tab/tab-store.ts
|
|
17
17
|
function createTabStore(props = {}) {
|
|
18
18
|
const syncState = _optionalChain([props, 'access', _ => _.store, 'optionalAccess', _2 => _2.getState, 'call', _3 => _3()]);
|
|
19
|
-
const composite =
|
|
19
|
+
const composite = _W5IHD6VGcjs.createCompositeStore.call(void 0, {
|
|
20
20
|
...props,
|
|
21
21
|
orientation: _QNEPGQLLcjs.defaultValue.call(void 0,
|
|
22
22
|
props.orientation,
|
|
@@ -25,7 +25,7 @@ function createTabStore(props = {}) {
|
|
|
25
25
|
),
|
|
26
26
|
focusLoop: _QNEPGQLLcjs.defaultValue.call(void 0, props.focusLoop, _optionalChain([syncState, 'optionalAccess', _5 => _5.focusLoop]), true)
|
|
27
27
|
});
|
|
28
|
-
const panels =
|
|
28
|
+
const panels = _4DQ3OTE7cjs.createCollectionStore.call(void 0, );
|
|
29
29
|
const initialState = {
|
|
30
30
|
...composite.getState(),
|
|
31
31
|
selectedId: _QNEPGQLLcjs.defaultValue.call(void 0,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
require('../__chunks/
|
|
3
|
+
var _W5IHD6VGcjs = require('../__chunks/W5IHD6VG.cjs');
|
|
4
|
+
require('../__chunks/4DQ3OTE7.cjs');
|
|
5
5
|
require('../__chunks/ZPOXPO2L.cjs');
|
|
6
6
|
|
|
7
7
|
|
|
@@ -12,7 +12,7 @@ require('../__chunks/GDZQUFNP.cjs');
|
|
|
12
12
|
// src/toolbar/toolbar-store.ts
|
|
13
13
|
function createToolbarStore(props = {}) {
|
|
14
14
|
const syncState = _optionalChain([props, 'access', _ => _.store, 'optionalAccess', _2 => _2.getState, 'call', _3 => _3()]);
|
|
15
|
-
return
|
|
15
|
+
return _W5IHD6VGcjs.createCompositeStore.call(void 0, {
|
|
16
16
|
...props,
|
|
17
17
|
orientation: _QNEPGQLLcjs.defaultValue.call(void 0,
|
|
18
18
|
props.orientation,
|