@ariakit/core 0.4.6 → 0.4.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +9 -0
- package/cjs/__chunks/{B4LYZ4EM.cjs → 3QF3ODTR.cjs} +44 -61
- package/cjs/__chunks/{LPDHSEHU.cjs → 7CES7GVE.cjs} +4 -8
- package/cjs/__chunks/{Q2WCPTYS.cjs → 7WYII4AN.cjs} +6 -12
- package/cjs/__chunks/{EEDWPDM2.cjs → BTUHABP4.cjs} +16 -30
- package/cjs/__chunks/{4W3OYRR3.cjs → CCI5VM7E.cjs} +24 -30
- package/cjs/__chunks/{5JEQEZFR.cjs → H6ZQSQQL.cjs} +16 -16
- package/cjs/__chunks/{D7M2PCAQ.cjs → KCEXELK7.cjs} +6 -7
- package/cjs/__chunks/{LTLFSC4X.cjs → N667HVED.cjs} +2 -2
- package/cjs/__chunks/{3HYNC3XA.cjs → PW36G76L.cjs} +25 -29
- package/cjs/__chunks/{AETQC2AR.cjs → QLWAGBAQ.cjs} +20 -22
- package/cjs/__chunks/{B4AKUC4S.cjs → VJAE2Y4T.cjs} +10 -10
- package/cjs/__chunks/XIZWLBI2.cjs +42 -0
- package/cjs/checkbox/checkbox-store.cjs +7 -7
- package/cjs/collection/collection-store.cjs +6 -6
- package/cjs/combobox/combobox-store.cjs +50 -56
- package/cjs/combobox/combobox-store.d.cts +2 -0
- package/cjs/combobox/combobox-store.d.ts +2 -0
- package/cjs/composite/composite-overflow-store.cjs +7 -7
- package/cjs/composite/composite-store.cjs +7 -7
- package/cjs/composite/composite-store.d.cts +5 -1
- package/cjs/composite/composite-store.d.ts +5 -1
- package/cjs/dialog/dialog-store.cjs +6 -6
- package/cjs/disclosure/disclosure-store.cjs +5 -5
- package/cjs/form/form-store.cjs +32 -36
- package/cjs/hovercard/hovercard-store.cjs +8 -8
- package/cjs/index.cjs +1 -1
- package/cjs/menu/menu-bar-store.cjs +8 -8
- package/cjs/menu/menu-store.cjs +37 -42
- package/cjs/menubar/menubar-store.cjs +8 -8
- package/cjs/popover/popover-store.cjs +7 -7
- package/cjs/radio/radio-store.cjs +13 -13
- package/cjs/select/select-store.cjs +49 -62
- package/cjs/select/select-store.d.cts +2 -0
- package/cjs/select/select-store.d.ts +2 -0
- package/cjs/tab/tab-store.cjs +49 -61
- package/cjs/tab/tab-store.d.cts +10 -4
- package/cjs/tab/tab-store.d.ts +10 -4
- package/cjs/tag/tag-store.cjs +23 -27
- package/cjs/toolbar/toolbar-store.cjs +9 -9
- package/cjs/tooltip/tooltip-store.cjs +15 -15
- package/cjs/utils/array.cjs +1 -1
- package/cjs/utils/dom.cjs +3 -3
- package/cjs/utils/events.cjs +25 -37
- package/cjs/utils/focus.cjs +41 -61
- package/cjs/utils/misc.cjs +3 -3
- package/cjs/utils/misc.d.cts +1 -1
- package/cjs/utils/misc.d.ts +1 -1
- package/cjs/utils/platform.cjs +4 -4
- package/cjs/utils/store.cjs +4 -4
- package/cjs/utils/undo.cjs +3 -3
- package/esm/__chunks/{MFZZDIHG.js → 3UYWTADI.js} +4 -4
- package/esm/__chunks/{EQPTKGFA.js → 6DHTHWXD.js} +10 -16
- package/esm/__chunks/{WCKXDMU7.js → 6E4KKOSB.js} +5 -7
- package/esm/__chunks/{EKIWAN6A.js → 7LM4Q2XB.js} +4 -8
- package/esm/__chunks/{PBSSD2DM.js → D7EIQZAU.js} +8 -12
- package/esm/__chunks/{BRS7GKWU.js → EACLTACN.js} +4 -4
- package/esm/__chunks/{R676XYVY.js → EQQLU3CG.js} +34 -51
- package/esm/__chunks/{I2NJJ3XW.js → HWOIWM4O.js} +6 -12
- package/esm/__chunks/{22HHDS5F.js → PBFD2E7P.js} +15 -29
- package/esm/__chunks/{P3MTNH46.js → PIWLWQMB.js} +4 -4
- package/esm/__chunks/{CLSHHUGK.js → US4USQPI.js} +2 -3
- package/esm/__chunks/{5RJNXXU2.js → YOHCVXJB.js} +1 -1
- package/esm/checkbox/checkbox-store.js +3 -3
- package/esm/collection/collection-store.js +5 -5
- package/esm/combobox/combobox-store.d.ts +2 -0
- package/esm/combobox/combobox-store.js +16 -22
- package/esm/composite/composite-overflow-store.js +6 -6
- package/esm/composite/composite-store.d.ts +5 -1
- package/esm/composite/composite-store.js +6 -6
- package/esm/dialog/dialog-store.js +5 -5
- package/esm/disclosure/disclosure-store.js +4 -4
- package/esm/form/form-store.js +9 -13
- package/esm/hovercard/hovercard-store.js +7 -7
- package/esm/index.js +1 -1
- package/esm/menu/menu-bar-store.js +7 -7
- package/esm/menu/menu-store.js +15 -20
- package/esm/menubar/menubar-store.js +7 -7
- package/esm/popover/popover-store.js +6 -6
- package/esm/radio/radio-store.js +6 -6
- package/esm/select/select-store.d.ts +2 -0
- package/esm/select/select-store.js +22 -35
- package/esm/tab/tab-store.d.ts +10 -4
- package/esm/tab/tab-store.js +18 -30
- package/esm/tag/tag-store.js +11 -15
- package/esm/toolbar/toolbar-store.js +6 -6
- package/esm/tooltip/tooltip-store.js +7 -7
- package/esm/utils/array.js +1 -1
- package/esm/utils/dom.js +2 -2
- package/esm/utils/events.js +20 -32
- package/esm/utils/focus.js +33 -53
- package/esm/utils/misc.d.ts +1 -1
- package/esm/utils/misc.js +2 -2
- package/esm/utils/platform.js +3 -3
- package/esm/utils/store.js +3 -3
- package/esm/utils/undo.js +2 -2
- package/package.json +2 -2
- package/readme.md +18 -0
- package/.eslintignore +0 -6
- package/cjs/__chunks/UEZLSKZ4.cjs +0 -42
- /package/cjs/__chunks/{AV6KTKLE.cjs → 3IVNQNIV.cjs} +0 -0
- /package/esm/__chunks/{4R3V3JGP.js → 3YLGPPWQ.js} +0 -0
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
3
|
createPopoverStore
|
|
4
|
-
} from "../__chunks/
|
|
5
|
-
import "../__chunks/
|
|
6
|
-
import "../__chunks/
|
|
7
|
-
import "../__chunks/
|
|
8
|
-
import "../__chunks/
|
|
9
|
-
import "../__chunks/
|
|
4
|
+
} from "../__chunks/3UYWTADI.js";
|
|
5
|
+
import "../__chunks/YOHCVXJB.js";
|
|
6
|
+
import "../__chunks/6E4KKOSB.js";
|
|
7
|
+
import "../__chunks/EQQLU3CG.js";
|
|
8
|
+
import "../__chunks/PBFD2E7P.js";
|
|
9
|
+
import "../__chunks/3YLGPPWQ.js";
|
|
10
10
|
|
|
11
11
|
// src/composite/composite-overflow-store.ts
|
|
12
12
|
function createCompositeOverflowStore(props = {}) {
|
|
@@ -44,6 +44,10 @@ export interface CompositeStoreState<T extends CompositeStoreItem = CompositeSto
|
|
|
44
44
|
* In both scenarios, the item in focus will carry the
|
|
45
45
|
* [`data-active-item`](https://ariakit.org/guide/styling#data-active-item)
|
|
46
46
|
* attribute.
|
|
47
|
+
*
|
|
48
|
+
* Live examples:
|
|
49
|
+
* - [Select with Combobox and
|
|
50
|
+
* Tabs](https://ariakit.org/examples/select-combobox-tab)
|
|
47
51
|
* @default false
|
|
48
52
|
*/
|
|
49
53
|
virtualFocus: boolean;
|
|
@@ -178,7 +182,7 @@ export interface CompositeStoreState<T extends CompositeStoreItem = CompositeSto
|
|
|
178
182
|
* arrow keys.
|
|
179
183
|
*
|
|
180
184
|
* Live examples:
|
|
181
|
-
* - [Combobox with
|
|
185
|
+
* - [Combobox with Tabs](https://ariakit.org/examples/combobox-tabs)
|
|
182
186
|
*/
|
|
183
187
|
activeId: string | null | undefined;
|
|
184
188
|
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
3
|
createCompositeStore
|
|
4
|
-
} from "../__chunks/
|
|
5
|
-
import "../__chunks/
|
|
4
|
+
} from "../__chunks/D7EIQZAU.js";
|
|
5
|
+
import "../__chunks/6DHTHWXD.js";
|
|
6
6
|
import "../__chunks/7PRQYBBV.js";
|
|
7
|
-
import "../__chunks/
|
|
8
|
-
import "../__chunks/
|
|
9
|
-
import "../__chunks/
|
|
10
|
-
import "../__chunks/
|
|
7
|
+
import "../__chunks/EQQLU3CG.js";
|
|
8
|
+
import "../__chunks/PBFD2E7P.js";
|
|
9
|
+
import "../__chunks/HWOIWM4O.js";
|
|
10
|
+
import "../__chunks/3YLGPPWQ.js";
|
|
11
11
|
export {
|
|
12
12
|
createCompositeStore
|
|
13
13
|
};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
3
|
createDialogStore
|
|
4
|
-
} from "../__chunks/
|
|
5
|
-
import "../__chunks/
|
|
6
|
-
import "../__chunks/
|
|
7
|
-
import "../__chunks/
|
|
8
|
-
import "../__chunks/
|
|
4
|
+
} from "../__chunks/YOHCVXJB.js";
|
|
5
|
+
import "../__chunks/6E4KKOSB.js";
|
|
6
|
+
import "../__chunks/EQQLU3CG.js";
|
|
7
|
+
import "../__chunks/PBFD2E7P.js";
|
|
8
|
+
import "../__chunks/3YLGPPWQ.js";
|
|
9
9
|
export {
|
|
10
10
|
createDialogStore
|
|
11
11
|
};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
3
|
createDisclosureStore
|
|
4
|
-
} from "../__chunks/
|
|
5
|
-
import "../__chunks/
|
|
6
|
-
import "../__chunks/
|
|
7
|
-
import "../__chunks/
|
|
4
|
+
} from "../__chunks/6E4KKOSB.js";
|
|
5
|
+
import "../__chunks/EQQLU3CG.js";
|
|
6
|
+
import "../__chunks/PBFD2E7P.js";
|
|
7
|
+
import "../__chunks/3YLGPPWQ.js";
|
|
8
8
|
export {
|
|
9
9
|
createDisclosureStore
|
|
10
10
|
};
|
package/esm/form/form-store.js
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
3
|
createCollectionStore
|
|
4
|
-
} from "../__chunks/
|
|
4
|
+
} from "../__chunks/6DHTHWXD.js";
|
|
5
5
|
import {
|
|
6
6
|
createStore,
|
|
7
7
|
init,
|
|
8
8
|
setup,
|
|
9
9
|
throwOnConflictingProps
|
|
10
|
-
} from "../__chunks/
|
|
10
|
+
} from "../__chunks/EQQLU3CG.js";
|
|
11
11
|
import {
|
|
12
12
|
applyState,
|
|
13
13
|
defaultValue,
|
|
14
14
|
isInteger,
|
|
15
15
|
isObject
|
|
16
|
-
} from "../__chunks/
|
|
17
|
-
import "../__chunks/
|
|
16
|
+
} from "../__chunks/PBFD2E7P.js";
|
|
17
|
+
import "../__chunks/HWOIWM4O.js";
|
|
18
18
|
import {
|
|
19
19
|
__spreadProps,
|
|
20
20
|
__spreadValues
|
|
21
|
-
} from "../__chunks/
|
|
21
|
+
} from "../__chunks/3YLGPPWQ.js";
|
|
22
22
|
|
|
23
23
|
// src/form/form-store.ts
|
|
24
24
|
function nextFrame() {
|
|
@@ -45,8 +45,7 @@ function get(values, path, defaultValue2) {
|
|
|
45
45
|
}
|
|
46
46
|
function set(values, path, value) {
|
|
47
47
|
const [k, ...rest] = Array.isArray(path) ? path : `${path}`.split(".");
|
|
48
|
-
if (k == null)
|
|
49
|
-
return values;
|
|
48
|
+
if (k == null) return values;
|
|
50
49
|
const key = k;
|
|
51
50
|
const isIntegerKey = isInteger(key);
|
|
52
51
|
const nextValues = isIntegerKey ? values || [] : values || {};
|
|
@@ -175,8 +174,7 @@ function createFormStore(props = {}) {
|
|
|
175
174
|
setValue: (name, value) => form.setState("values", (values2) => {
|
|
176
175
|
const prevValue = get(values2, name);
|
|
177
176
|
const nextValue = applyState(value, prevValue);
|
|
178
|
-
if (nextValue === prevValue)
|
|
179
|
-
return values2;
|
|
177
|
+
if (nextValue === prevValue) return values2;
|
|
180
178
|
return set(values2, name, nextValue);
|
|
181
179
|
}),
|
|
182
180
|
pushValue: (name, value) => form.setState("values", (values2) => {
|
|
@@ -196,8 +194,7 @@ function createFormStore(props = {}) {
|
|
|
196
194
|
setError: (name, error) => form.setState("errors", (errors2) => {
|
|
197
195
|
const prevError = get(errors2, name);
|
|
198
196
|
const nextError = applyState(error, prevError);
|
|
199
|
-
if (nextError === prevError)
|
|
200
|
-
return errors2;
|
|
197
|
+
if (nextError === prevError) return errors2;
|
|
201
198
|
return set(errors2, name, nextError);
|
|
202
199
|
}),
|
|
203
200
|
setTouched: (touched2) => form.setState("touched", touched2),
|
|
@@ -205,8 +202,7 @@ function createFormStore(props = {}) {
|
|
|
205
202
|
setFieldTouched: (name, value) => form.setState("touched", (touched2) => {
|
|
206
203
|
const prevValue = get(touched2, name);
|
|
207
204
|
const nextValue = applyState(value, prevValue);
|
|
208
|
-
if (nextValue === prevValue)
|
|
209
|
-
return touched2;
|
|
205
|
+
if (nextValue === prevValue) return touched2;
|
|
210
206
|
return set(touched2, name, nextValue);
|
|
211
207
|
}),
|
|
212
208
|
onValidate: (callback) => {
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
3
|
createHovercardStore
|
|
4
|
-
} from "../__chunks/
|
|
5
|
-
import "../__chunks/
|
|
6
|
-
import "../__chunks/
|
|
7
|
-
import "../__chunks/
|
|
8
|
-
import "../__chunks/
|
|
9
|
-
import "../__chunks/
|
|
10
|
-
import "../__chunks/
|
|
4
|
+
} from "../__chunks/EACLTACN.js";
|
|
5
|
+
import "../__chunks/3UYWTADI.js";
|
|
6
|
+
import "../__chunks/YOHCVXJB.js";
|
|
7
|
+
import "../__chunks/6E4KKOSB.js";
|
|
8
|
+
import "../__chunks/EQQLU3CG.js";
|
|
9
|
+
import "../__chunks/PBFD2E7P.js";
|
|
10
|
+
import "../__chunks/3YLGPPWQ.js";
|
|
11
11
|
export {
|
|
12
12
|
createHovercardStore
|
|
13
13
|
};
|
package/esm/index.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
3
|
createMenubarStore
|
|
4
|
-
} from "../__chunks/
|
|
5
|
-
import "../__chunks/
|
|
6
|
-
import "../__chunks/
|
|
4
|
+
} from "../__chunks/PIWLWQMB.js";
|
|
5
|
+
import "../__chunks/D7EIQZAU.js";
|
|
6
|
+
import "../__chunks/6DHTHWXD.js";
|
|
7
7
|
import "../__chunks/7PRQYBBV.js";
|
|
8
|
-
import "../__chunks/
|
|
9
|
-
import "../__chunks/
|
|
10
|
-
import "../__chunks/
|
|
11
|
-
import "../__chunks/
|
|
8
|
+
import "../__chunks/EQQLU3CG.js";
|
|
9
|
+
import "../__chunks/PBFD2E7P.js";
|
|
10
|
+
import "../__chunks/HWOIWM4O.js";
|
|
11
|
+
import "../__chunks/3YLGPPWQ.js";
|
|
12
12
|
|
|
13
13
|
// src/menu/menu-bar-store.ts
|
|
14
14
|
function createMenuBarStore(props = {}) {
|
package/esm/menu/menu-store.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
3
|
createHovercardStore
|
|
4
|
-
} from "../__chunks/
|
|
4
|
+
} from "../__chunks/EACLTACN.js";
|
|
5
5
|
import {
|
|
6
6
|
createCompositeStore
|
|
7
|
-
} from "../__chunks/
|
|
8
|
-
import "../__chunks/
|
|
7
|
+
} from "../__chunks/D7EIQZAU.js";
|
|
8
|
+
import "../__chunks/6DHTHWXD.js";
|
|
9
9
|
import "../__chunks/7PRQYBBV.js";
|
|
10
|
-
import "../__chunks/
|
|
11
|
-
import "../__chunks/
|
|
12
|
-
import "../__chunks/
|
|
10
|
+
import "../__chunks/3UYWTADI.js";
|
|
11
|
+
import "../__chunks/YOHCVXJB.js";
|
|
12
|
+
import "../__chunks/6E4KKOSB.js";
|
|
13
13
|
import {
|
|
14
14
|
createStore,
|
|
15
15
|
mergeStore,
|
|
@@ -18,17 +18,17 @@ import {
|
|
|
18
18
|
setup,
|
|
19
19
|
sync,
|
|
20
20
|
throwOnConflictingProps
|
|
21
|
-
} from "../__chunks/
|
|
21
|
+
} from "../__chunks/EQQLU3CG.js";
|
|
22
22
|
import {
|
|
23
23
|
applyState,
|
|
24
24
|
defaultValue
|
|
25
|
-
} from "../__chunks/
|
|
26
|
-
import "../__chunks/
|
|
25
|
+
} from "../__chunks/PBFD2E7P.js";
|
|
26
|
+
import "../__chunks/HWOIWM4O.js";
|
|
27
27
|
import {
|
|
28
28
|
__objRest,
|
|
29
29
|
__spreadProps,
|
|
30
30
|
__spreadValues
|
|
31
|
-
} from "../__chunks/
|
|
31
|
+
} from "../__chunks/3YLGPPWQ.js";
|
|
32
32
|
|
|
33
33
|
// src/menu/menu-store.ts
|
|
34
34
|
function createMenuStore(_a = {}) {
|
|
@@ -90,8 +90,7 @@ function createMenuStore(_a = {}) {
|
|
|
90
90
|
setup(
|
|
91
91
|
menu,
|
|
92
92
|
() => sync(menu, ["mounted"], (state) => {
|
|
93
|
-
if (state.mounted)
|
|
94
|
-
return;
|
|
93
|
+
if (state.mounted) return;
|
|
95
94
|
menu.setState("activeId", null);
|
|
96
95
|
})
|
|
97
96
|
);
|
|
@@ -115,17 +114,13 @@ function createMenuStore(_a = {}) {
|
|
|
115
114
|
setInitialFocus: (value) => menu.setState("initialFocus", value),
|
|
116
115
|
setValues: (values) => menu.setState("values", values),
|
|
117
116
|
setValue: (name, value) => {
|
|
118
|
-
if (name === "__proto__")
|
|
119
|
-
|
|
120
|
-
if (name
|
|
121
|
-
return;
|
|
122
|
-
if (Array.isArray(name))
|
|
123
|
-
return;
|
|
117
|
+
if (name === "__proto__") return;
|
|
118
|
+
if (name === "constructor") return;
|
|
119
|
+
if (Array.isArray(name)) return;
|
|
124
120
|
menu.setState("values", (values) => {
|
|
125
121
|
const prevValue = values[name];
|
|
126
122
|
const nextValue = applyState(value, prevValue);
|
|
127
|
-
if (nextValue === prevValue)
|
|
128
|
-
return values;
|
|
123
|
+
if (nextValue === prevValue) return values;
|
|
129
124
|
return __spreadProps(__spreadValues({}, values), {
|
|
130
125
|
[name]: nextValue !== void 0 && nextValue
|
|
131
126
|
});
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
3
|
createMenubarStore
|
|
4
|
-
} from "../__chunks/
|
|
5
|
-
import "../__chunks/
|
|
6
|
-
import "../__chunks/
|
|
4
|
+
} from "../__chunks/PIWLWQMB.js";
|
|
5
|
+
import "../__chunks/D7EIQZAU.js";
|
|
6
|
+
import "../__chunks/6DHTHWXD.js";
|
|
7
7
|
import "../__chunks/7PRQYBBV.js";
|
|
8
|
-
import "../__chunks/
|
|
9
|
-
import "../__chunks/
|
|
10
|
-
import "../__chunks/
|
|
11
|
-
import "../__chunks/
|
|
8
|
+
import "../__chunks/EQQLU3CG.js";
|
|
9
|
+
import "../__chunks/PBFD2E7P.js";
|
|
10
|
+
import "../__chunks/HWOIWM4O.js";
|
|
11
|
+
import "../__chunks/3YLGPPWQ.js";
|
|
12
12
|
export {
|
|
13
13
|
createMenubarStore
|
|
14
14
|
};
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
3
|
createPopoverStore
|
|
4
|
-
} from "../__chunks/
|
|
5
|
-
import "../__chunks/
|
|
6
|
-
import "../__chunks/
|
|
7
|
-
import "../__chunks/
|
|
8
|
-
import "../__chunks/
|
|
9
|
-
import "../__chunks/
|
|
4
|
+
} from "../__chunks/3UYWTADI.js";
|
|
5
|
+
import "../__chunks/YOHCVXJB.js";
|
|
6
|
+
import "../__chunks/6E4KKOSB.js";
|
|
7
|
+
import "../__chunks/EQQLU3CG.js";
|
|
8
|
+
import "../__chunks/PBFD2E7P.js";
|
|
9
|
+
import "../__chunks/3YLGPPWQ.js";
|
|
10
10
|
export {
|
|
11
11
|
createPopoverStore
|
|
12
12
|
};
|
package/esm/radio/radio-store.js
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
3
|
createCompositeStore
|
|
4
|
-
} from "../__chunks/
|
|
5
|
-
import "../__chunks/
|
|
4
|
+
} from "../__chunks/D7EIQZAU.js";
|
|
5
|
+
import "../__chunks/6DHTHWXD.js";
|
|
6
6
|
import "../__chunks/7PRQYBBV.js";
|
|
7
7
|
import {
|
|
8
8
|
createStore
|
|
9
|
-
} from "../__chunks/
|
|
9
|
+
} from "../__chunks/EQQLU3CG.js";
|
|
10
10
|
import {
|
|
11
11
|
defaultValue
|
|
12
|
-
} from "../__chunks/
|
|
13
|
-
import "../__chunks/
|
|
12
|
+
} from "../__chunks/PBFD2E7P.js";
|
|
13
|
+
import "../__chunks/HWOIWM4O.js";
|
|
14
14
|
import {
|
|
15
15
|
__objRest,
|
|
16
16
|
__spreadProps,
|
|
17
17
|
__spreadValues
|
|
18
|
-
} from "../__chunks/
|
|
18
|
+
} from "../__chunks/3YLGPPWQ.js";
|
|
19
19
|
|
|
20
20
|
// src/radio/radio-store.ts
|
|
21
21
|
function createRadioStore(_a = {}) {
|
|
@@ -102,6 +102,8 @@ export interface SelectStoreOptions<T extends SelectStoreValue = SelectStoreValu
|
|
|
102
102
|
* - [SelectGroup](https://ariakit.org/examples/select-group)
|
|
103
103
|
* - [Select with Next.js App
|
|
104
104
|
* Router](https://ariakit.org/examples/select-next-router)
|
|
105
|
+
* - [Select with Combobox and
|
|
106
|
+
* Tabs](https://ariakit.org/examples/select-combobox-tab)
|
|
105
107
|
*/
|
|
106
108
|
defaultValue?: SelectStoreState<T>["value"];
|
|
107
109
|
}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
3
|
createCompositeStore
|
|
4
|
-
} from "../__chunks/
|
|
5
|
-
import "../__chunks/
|
|
4
|
+
} from "../__chunks/D7EIQZAU.js";
|
|
5
|
+
import "../__chunks/6DHTHWXD.js";
|
|
6
6
|
import {
|
|
7
7
|
toArray
|
|
8
8
|
} from "../__chunks/7PRQYBBV.js";
|
|
9
9
|
import {
|
|
10
10
|
createPopoverStore
|
|
11
|
-
} from "../__chunks/
|
|
12
|
-
import "../__chunks/
|
|
13
|
-
import "../__chunks/
|
|
11
|
+
} from "../__chunks/3UYWTADI.js";
|
|
12
|
+
import "../__chunks/YOHCVXJB.js";
|
|
13
|
+
import "../__chunks/6E4KKOSB.js";
|
|
14
14
|
import {
|
|
15
15
|
batch,
|
|
16
16
|
createStore,
|
|
@@ -19,16 +19,16 @@ import {
|
|
|
19
19
|
setup,
|
|
20
20
|
sync,
|
|
21
21
|
throwOnConflictingProps
|
|
22
|
-
} from "../__chunks/
|
|
22
|
+
} from "../__chunks/EQQLU3CG.js";
|
|
23
23
|
import {
|
|
24
24
|
defaultValue
|
|
25
|
-
} from "../__chunks/
|
|
26
|
-
import "../__chunks/
|
|
25
|
+
} from "../__chunks/PBFD2E7P.js";
|
|
26
|
+
import "../__chunks/HWOIWM4O.js";
|
|
27
27
|
import {
|
|
28
28
|
__objRest,
|
|
29
29
|
__spreadProps,
|
|
30
30
|
__spreadValues
|
|
31
|
-
} from "../__chunks/
|
|
31
|
+
} from "../__chunks/3YLGPPWQ.js";
|
|
32
32
|
|
|
33
33
|
// src/select/select-store.ts
|
|
34
34
|
function createSelectStore(_a = {}) {
|
|
@@ -106,42 +106,34 @@ function createSelectStore(_a = {}) {
|
|
|
106
106
|
setup(
|
|
107
107
|
select,
|
|
108
108
|
() => sync(select, ["value", "items"], (state) => {
|
|
109
|
-
if (state.value !== initialValue)
|
|
110
|
-
|
|
111
|
-
if (!state.items.length)
|
|
112
|
-
return;
|
|
109
|
+
if (state.value !== initialValue) return;
|
|
110
|
+
if (!state.items.length) return;
|
|
113
111
|
const item = state.items.find(
|
|
114
112
|
(item2) => !item2.disabled && item2.value != null
|
|
115
113
|
);
|
|
116
|
-
if ((item == null ? void 0 : item.value) == null)
|
|
117
|
-
return;
|
|
114
|
+
if ((item == null ? void 0 : item.value) == null) return;
|
|
118
115
|
select.setState("value", item.value);
|
|
119
116
|
})
|
|
120
117
|
);
|
|
121
118
|
setup(
|
|
122
119
|
select,
|
|
123
120
|
() => sync(select, ["mounted"], (state) => {
|
|
124
|
-
if (state.mounted)
|
|
125
|
-
return;
|
|
121
|
+
if (state.mounted) return;
|
|
126
122
|
select.setState("activeId", initialState.activeId);
|
|
127
123
|
})
|
|
128
124
|
);
|
|
129
125
|
setup(
|
|
130
126
|
select,
|
|
131
127
|
() => sync(select, ["mounted", "items", "value"], (state) => {
|
|
132
|
-
if (combobox)
|
|
133
|
-
|
|
134
|
-
if (state.mounted)
|
|
135
|
-
return;
|
|
128
|
+
if (combobox) return;
|
|
129
|
+
if (state.mounted) return;
|
|
136
130
|
const values = toArray(state.value);
|
|
137
131
|
const lastValue = values[values.length - 1];
|
|
138
|
-
if (lastValue == null)
|
|
139
|
-
return;
|
|
132
|
+
if (lastValue == null) return;
|
|
140
133
|
const item = state.items.find(
|
|
141
134
|
(item2) => !item2.disabled && item2.value === lastValue
|
|
142
135
|
);
|
|
143
|
-
if (!item)
|
|
144
|
-
return;
|
|
136
|
+
if (!item) return;
|
|
145
137
|
select.setState("activeId", item.id);
|
|
146
138
|
})
|
|
147
139
|
);
|
|
@@ -149,17 +141,12 @@ function createSelectStore(_a = {}) {
|
|
|
149
141
|
select,
|
|
150
142
|
() => batch(select, ["setValueOnMove", "moves"], (state) => {
|
|
151
143
|
const { mounted, value, activeId } = select.getState();
|
|
152
|
-
if (!state.setValueOnMove && mounted)
|
|
153
|
-
|
|
154
|
-
if (
|
|
155
|
-
|
|
156
|
-
if (!state.moves)
|
|
157
|
-
return;
|
|
158
|
-
if (!activeId)
|
|
159
|
-
return;
|
|
144
|
+
if (!state.setValueOnMove && mounted) return;
|
|
145
|
+
if (Array.isArray(value)) return;
|
|
146
|
+
if (!state.moves) return;
|
|
147
|
+
if (!activeId) return;
|
|
160
148
|
const item = composite.item(activeId);
|
|
161
|
-
if (!item || item.disabled || item.value == null)
|
|
162
|
-
return;
|
|
149
|
+
if (!item || item.disabled || item.value == null) return;
|
|
163
150
|
select.setState("value", item.value);
|
|
164
151
|
})
|
|
165
152
|
);
|
package/esm/tab/tab-store.d.ts
CHANGED
|
@@ -22,16 +22,20 @@ export interface TabStoreState extends CompositeStoreState<TabStoreItem> {
|
|
|
22
22
|
*
|
|
23
23
|
* Live examples:
|
|
24
24
|
* - [Tab with React Router](https://ariakit.org/examples/tab-react-router)
|
|
25
|
-
* - [Combobox with
|
|
25
|
+
* - [Combobox with Tabs](https://ariakit.org/examples/combobox-tabs)
|
|
26
|
+
* - [Select with Combobox and
|
|
27
|
+
* Tabs](https://ariakit.org/examples/select-combobox-tab)
|
|
26
28
|
*/
|
|
27
29
|
selectedId: TabStoreState["activeId"];
|
|
28
30
|
/**
|
|
29
31
|
* Determines if the tab should be selected when it receives focus. If set to
|
|
30
|
-
* `false`, the tab will only be selected upon clicking, not when
|
|
31
|
-
*
|
|
32
|
+
* `false`, the tab will only be selected upon clicking, not when using arrow
|
|
33
|
+
* keys to shift focus.
|
|
32
34
|
*
|
|
33
35
|
* Live examples:
|
|
34
36
|
* - [Tab with React Router](https://ariakit.org/examples/tab-react-router)
|
|
37
|
+
* - [Select with Combobox and
|
|
38
|
+
* Tabs](https://ariakit.org/examples/select-combobox-tab)
|
|
35
39
|
* @default true
|
|
36
40
|
*/
|
|
37
41
|
selectOnMove?: boolean;
|
|
@@ -99,8 +103,10 @@ export interface TabStoreOptions extends StoreOptions<TabStoreState, "orientatio
|
|
|
99
103
|
* will be automatically set to the first enabled tab.
|
|
100
104
|
*
|
|
101
105
|
* Live examples:
|
|
102
|
-
* - [Combobox with
|
|
106
|
+
* - [Combobox with Tabs](https://ariakit.org/examples/combobox-tabs)
|
|
103
107
|
* - [Animated TabPanel](https://ariakit.org/examples/tab-panel-animated)
|
|
108
|
+
* - [Select with Combobox and
|
|
109
|
+
* Tabs](https://ariakit.org/examples/select-combobox-tab)
|
|
104
110
|
*/
|
|
105
111
|
defaultSelectedId?: TabStoreState["selectedId"];
|
|
106
112
|
}
|
package/esm/tab/tab-store.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
3
|
createCompositeStore
|
|
4
|
-
} from "../__chunks/
|
|
4
|
+
} from "../__chunks/D7EIQZAU.js";
|
|
5
5
|
import {
|
|
6
6
|
createCollectionStore
|
|
7
|
-
} from "../__chunks/
|
|
7
|
+
} from "../__chunks/6DHTHWXD.js";
|
|
8
8
|
import "../__chunks/7PRQYBBV.js";
|
|
9
9
|
import {
|
|
10
10
|
batch,
|
|
@@ -13,17 +13,17 @@ import {
|
|
|
13
13
|
omit,
|
|
14
14
|
setup,
|
|
15
15
|
sync
|
|
16
|
-
} from "../__chunks/
|
|
16
|
+
} from "../__chunks/EQQLU3CG.js";
|
|
17
17
|
import {
|
|
18
18
|
chain,
|
|
19
19
|
defaultValue
|
|
20
|
-
} from "../__chunks/
|
|
21
|
-
import "../__chunks/
|
|
20
|
+
} from "../__chunks/PBFD2E7P.js";
|
|
21
|
+
import "../__chunks/HWOIWM4O.js";
|
|
22
22
|
import {
|
|
23
23
|
__objRest,
|
|
24
24
|
__spreadProps,
|
|
25
25
|
__spreadValues
|
|
26
|
-
} from "../__chunks/
|
|
26
|
+
} from "../__chunks/3YLGPPWQ.js";
|
|
27
27
|
|
|
28
28
|
// src/tab/tab-store.ts
|
|
29
29
|
function createTabStore(_a = {}) {
|
|
@@ -88,33 +88,26 @@ function createTabStore(_a = {}) {
|
|
|
88
88
|
tab,
|
|
89
89
|
() => sync(tab, ["moves"], () => {
|
|
90
90
|
const { activeId, selectOnMove } = tab.getState();
|
|
91
|
-
if (!selectOnMove)
|
|
92
|
-
|
|
93
|
-
if (!activeId)
|
|
94
|
-
return;
|
|
91
|
+
if (!selectOnMove) return;
|
|
92
|
+
if (!activeId) return;
|
|
95
93
|
const tabItem = composite.item(activeId);
|
|
96
|
-
if (!tabItem)
|
|
97
|
-
|
|
98
|
-
if (tabItem.
|
|
99
|
-
return;
|
|
100
|
-
if (tabItem.disabled)
|
|
101
|
-
return;
|
|
94
|
+
if (!tabItem) return;
|
|
95
|
+
if (tabItem.dimmed) return;
|
|
96
|
+
if (tabItem.disabled) return;
|
|
102
97
|
tab.setState("selectedId", tabItem.id);
|
|
103
98
|
})
|
|
104
99
|
);
|
|
105
100
|
setup(
|
|
106
101
|
tab,
|
|
107
102
|
() => batch(tab, ["selectedId"], (state, prev) => {
|
|
108
|
-
if (parentComposite && state.selectedId === prev.selectedId)
|
|
109
|
-
return;
|
|
103
|
+
if (parentComposite && state.selectedId === prev.selectedId) return;
|
|
110
104
|
tab.setState("activeId", state.selectedId);
|
|
111
105
|
})
|
|
112
106
|
);
|
|
113
107
|
setup(
|
|
114
108
|
tab,
|
|
115
109
|
() => sync(tab, ["selectedId", "renderedItems"], (state) => {
|
|
116
|
-
if (state.selectedId !== void 0)
|
|
117
|
-
return;
|
|
110
|
+
if (state.selectedId !== void 0) return;
|
|
118
111
|
const { activeId, renderedItems } = tab.getState();
|
|
119
112
|
const tabItem = composite.item(activeId);
|
|
120
113
|
if (tabItem && !tabItem.disabled && !tabItem.dimmed) {
|
|
@@ -131,19 +124,15 @@ function createTabStore(_a = {}) {
|
|
|
131
124
|
tab,
|
|
132
125
|
() => sync(tab, ["renderedItems"], (state) => {
|
|
133
126
|
const tabs = state.renderedItems;
|
|
134
|
-
if (!tabs.length)
|
|
135
|
-
return;
|
|
127
|
+
if (!tabs.length) return;
|
|
136
128
|
return sync(panels, ["renderedItems"], (state2) => {
|
|
137
129
|
const items = state2.renderedItems;
|
|
138
130
|
const hasOrphanPanels = items.some((panel) => !panel.tabId);
|
|
139
|
-
if (!hasOrphanPanels)
|
|
140
|
-
return;
|
|
131
|
+
if (!hasOrphanPanels) return;
|
|
141
132
|
items.forEach((panel, i) => {
|
|
142
|
-
if (panel.tabId)
|
|
143
|
-
return;
|
|
133
|
+
if (panel.tabId) return;
|
|
144
134
|
const tabItem = tabs[i];
|
|
145
|
-
if (!tabItem)
|
|
146
|
-
return;
|
|
135
|
+
if (!tabItem) return;
|
|
147
136
|
panels.renderItem(__spreadProps(__spreadValues({}, panel), { tabId: tabItem.id }));
|
|
148
137
|
});
|
|
149
138
|
});
|
|
@@ -163,8 +152,7 @@ function createTabStore(_a = {}) {
|
|
|
163
152
|
sync(parentComposite, ["open"], restoreSelectedId)
|
|
164
153
|
);
|
|
165
154
|
}
|
|
166
|
-
if (!combobox)
|
|
167
|
-
return;
|
|
155
|
+
if (!combobox) return;
|
|
168
156
|
return chain(
|
|
169
157
|
sync(combobox, ["selectedValue"], backupSelectedId),
|
|
170
158
|
sync(combobox, ["open"], restoreSelectedId)
|