@ariakit/core 0.4.17 → 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 +9 -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/{CPH45Z4I.cjs → G2CSOTWZ.cjs} +7 -7
- package/cjs/__chunks/{VZPNI7C2.cjs → I4CBIWTX.cjs} +4 -4
- package/cjs/__chunks/{6REHCF5T.cjs → LS2SNHDM.cjs} +6 -6
- package/cjs/__chunks/{UROTDZFK.cjs → R37KOEUW.cjs} +10 -10
- package/cjs/__chunks/{NNJG45OF.cjs → UGAVMSQJ.cjs} +18 -18
- package/cjs/__chunks/{LT33CJGT.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 +25 -24
- 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/{37JWRFYW.js → G7XPWBXK.js} +3 -3
- package/esm/__chunks/{O6E4ZWCP.js → GMGLSF2B.js} +1 -1
- package/esm/__chunks/{PSMDSJUH.js → H7R2CY4Q.js} +3 -3
- package/esm/__chunks/{75BJEVSH.js → IHNLLH3I.js} +2 -2
- package/esm/__chunks/{AMRA5WUK.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/{73UNQSFO.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 +17 -16
- 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,11 +17,12 @@ function getWindow(node) {
|
|
|
17
17
|
return getDocument(node).defaultView || window;
|
|
18
18
|
}
|
|
19
19
|
function getActiveElement(node, activeDescendant = false) {
|
|
20
|
+
var _a;
|
|
20
21
|
const { activeElement } = getDocument(node);
|
|
21
22
|
if (!(activeElement == null ? void 0 : activeElement.nodeName)) {
|
|
22
23
|
return null;
|
|
23
24
|
}
|
|
24
|
-
if (isFrame(activeElement) && activeElement.contentDocument) {
|
|
25
|
+
if (isFrame(activeElement) && ((_a = activeElement.contentDocument) == null ? void 0 : _a.body)) {
|
|
25
26
|
return getActiveElement(
|
|
26
27
|
activeElement.contentDocument.body,
|
|
27
28
|
activeDescendant
|
|
@@ -119,7 +120,6 @@ function getPopupRole(element, fallback) {
|
|
|
119
120
|
return fallback;
|
|
120
121
|
}
|
|
121
122
|
function getPopupItemRole(element, fallback) {
|
|
122
|
-
var _a;
|
|
123
123
|
const itemRoleByPopupRole = {
|
|
124
124
|
menu: "menuitem",
|
|
125
125
|
listbox: "option",
|
|
@@ -128,7 +128,7 @@ function getPopupItemRole(element, fallback) {
|
|
|
128
128
|
const popupRole = getPopupRole(element);
|
|
129
129
|
if (!popupRole) return fallback;
|
|
130
130
|
const key = popupRole;
|
|
131
|
-
return
|
|
131
|
+
return itemRoleByPopupRole[key] ?? fallback;
|
|
132
132
|
}
|
|
133
133
|
function scrollIntoViewIfNeeded(element, arg) {
|
|
134
134
|
if (isPartiallyHidden(element) && "scrollIntoView" in element) {
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
3
|
createCompositeStore
|
|
4
|
-
} from "./
|
|
4
|
+
} from "./UNDE2QJS.js";
|
|
5
5
|
import {
|
|
6
6
|
createStore
|
|
7
|
-
} from "./
|
|
7
|
+
} from "./XTZ53NXG.js";
|
|
8
8
|
import {
|
|
9
9
|
defaultValue
|
|
10
|
-
} from "./
|
|
10
|
+
} from "./UWJK2WK2.js";
|
|
11
11
|
|
|
12
12
|
// src/menubar/menubar-store.ts
|
|
13
13
|
function createMenubarStore(props = {}) {
|
|
@@ -7,10 +7,10 @@ import {
|
|
|
7
7
|
subscribe,
|
|
8
8
|
sync,
|
|
9
9
|
throwOnConflictingProps
|
|
10
|
-
} from "./
|
|
10
|
+
} from "./XTZ53NXG.js";
|
|
11
11
|
import {
|
|
12
12
|
defaultValue
|
|
13
|
-
} from "./
|
|
13
|
+
} from "./UWJK2WK2.js";
|
|
14
14
|
|
|
15
15
|
// src/disclosure/disclosure-store.ts
|
|
16
16
|
function createDisclosureStore(props = {}) {
|
|
@@ -2,28 +2,31 @@
|
|
|
2
2
|
import {
|
|
3
3
|
getDocument,
|
|
4
4
|
sortBasedOnDOMPosition
|
|
5
|
-
} from "./
|
|
5
|
+
} from "./G7XPWBXK.js";
|
|
6
6
|
import {
|
|
7
7
|
batch,
|
|
8
8
|
createStore,
|
|
9
9
|
init,
|
|
10
10
|
setup,
|
|
11
11
|
throwOnConflictingProps
|
|
12
|
-
} from "./
|
|
12
|
+
} from "./XTZ53NXG.js";
|
|
13
13
|
import {
|
|
14
14
|
chain,
|
|
15
15
|
defaultValue
|
|
16
|
-
} from "./
|
|
16
|
+
} from "./UWJK2WK2.js";
|
|
17
17
|
|
|
18
18
|
// src/collection/collection-store.ts
|
|
19
19
|
function getCommonParent(items) {
|
|
20
|
-
var _a;
|
|
20
|
+
var _a, _b;
|
|
21
21
|
const firstItem = items.find((item) => !!item.element);
|
|
22
|
-
const
|
|
23
|
-
let parentElement = (
|
|
24
|
-
|
|
22
|
+
const lastElement = (_a = [...items].reverse().find((item) => !!item.element)) == null ? void 0 : _a.element;
|
|
23
|
+
let parentElement = (_b = firstItem == null ? void 0 : firstItem.element) == null ? void 0 : _b.parentElement;
|
|
24
|
+
if (!lastElement) {
|
|
25
|
+
return getDocument(parentElement).body;
|
|
26
|
+
}
|
|
27
|
+
while (parentElement) {
|
|
25
28
|
const parent = parentElement;
|
|
26
|
-
if (
|
|
29
|
+
if (parent.contains(lastElement)) {
|
|
27
30
|
return parentElement;
|
|
28
31
|
}
|
|
29
32
|
parentElement = parentElement.parentElement;
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
3
|
createDialogStore
|
|
4
|
-
} from "./
|
|
4
|
+
} from "./7KNZCZ55.js";
|
|
5
5
|
import {
|
|
6
6
|
createStore,
|
|
7
7
|
mergeStore,
|
|
8
8
|
omit,
|
|
9
9
|
throwOnConflictingProps
|
|
10
|
-
} from "./
|
|
10
|
+
} from "./XTZ53NXG.js";
|
|
11
11
|
import {
|
|
12
12
|
defaultValue
|
|
13
|
-
} from "./
|
|
13
|
+
} from "./UWJK2WK2.js";
|
|
14
14
|
|
|
15
15
|
// src/popover/popover-store.ts
|
|
16
16
|
function createPopoverStore({
|
|
@@ -42,7 +42,7 @@ function createPopoverStore({
|
|
|
42
42
|
anchorElement: defaultValue(syncState == null ? void 0 : syncState.anchorElement, null),
|
|
43
43
|
popoverElement: defaultValue(syncState == null ? void 0 : syncState.popoverElement, null),
|
|
44
44
|
arrowElement: defaultValue(syncState == null ? void 0 : syncState.arrowElement, null),
|
|
45
|
-
rendered: Symbol("rendered")
|
|
45
|
+
rendered: /* @__PURE__ */ Symbol("rendered")
|
|
46
46
|
};
|
|
47
47
|
const popover = createStore(initialState, dialog, store);
|
|
48
48
|
return {
|
|
@@ -51,7 +51,7 @@ function createPopoverStore({
|
|
|
51
51
|
setAnchorElement: (element) => popover.setState("anchorElement", element),
|
|
52
52
|
setPopoverElement: (element) => popover.setState("popoverElement", element),
|
|
53
53
|
setArrowElement: (element) => popover.setState("arrowElement", element),
|
|
54
|
-
render: () => popover.setState("rendered", Symbol("rendered"))
|
|
54
|
+
render: () => popover.setState("rendered", /* @__PURE__ */ Symbol("rendered"))
|
|
55
55
|
};
|
|
56
56
|
}
|
|
57
57
|
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
3
|
createPopoverStore
|
|
4
|
-
} from "./
|
|
4
|
+
} from "./MJ4ZJEIM.js";
|
|
5
5
|
import {
|
|
6
6
|
createStore
|
|
7
|
-
} from "./
|
|
7
|
+
} from "./XTZ53NXG.js";
|
|
8
8
|
import {
|
|
9
9
|
defaultValue
|
|
10
|
-
} from "./
|
|
10
|
+
} from "./UWJK2WK2.js";
|
|
11
11
|
|
|
12
12
|
// src/hovercard/hovercard-store.ts
|
|
13
13
|
function createHovercardStore(props = {}) {
|
|
@@ -37,7 +37,7 @@ function createUndoManager({
|
|
|
37
37
|
undoStack.shift();
|
|
38
38
|
}
|
|
39
39
|
const sameGroup = group === currentGroup;
|
|
40
|
-
currentGroup = group
|
|
40
|
+
currentGroup = group ?? null;
|
|
41
41
|
const nextIndex = sameGroup ? Math.max(0, undoStack.length - 1) : undoStack.length;
|
|
42
42
|
const undoCallback = await callback();
|
|
43
43
|
if (!undoCallback) return;
|
|
@@ -5,15 +5,15 @@ import {
|
|
|
5
5
|
} from "./7PRQYBBV.js";
|
|
6
6
|
import {
|
|
7
7
|
createCollectionStore
|
|
8
|
-
} from "./
|
|
8
|
+
} from "./KZX46JDB.js";
|
|
9
9
|
import {
|
|
10
10
|
createStore,
|
|
11
11
|
setup,
|
|
12
12
|
sync
|
|
13
|
-
} from "./
|
|
13
|
+
} from "./XTZ53NXG.js";
|
|
14
14
|
import {
|
|
15
15
|
defaultValue
|
|
16
|
-
} from "./
|
|
16
|
+
} from "./UWJK2WK2.js";
|
|
17
17
|
|
|
18
18
|
// src/composite/composite-store.ts
|
|
19
19
|
var NULL_ITEM = { id: null };
|
|
@@ -117,6 +117,11 @@ function isFalsyBooleanCallback(booleanOrCallback, ...args) {
|
|
|
117
117
|
function disabledFromProps(props) {
|
|
118
118
|
return props.disabled || props["aria-disabled"] === true || props["aria-disabled"] === "true";
|
|
119
119
|
}
|
|
120
|
+
function disabledFromElement(element) {
|
|
121
|
+
if (element.getAttribute("aria-disabled") === "true") return true;
|
|
122
|
+
if ("disabled" in element && element.disabled === true) return true;
|
|
123
|
+
return false;
|
|
124
|
+
}
|
|
120
125
|
function removeUndefinedValues(obj) {
|
|
121
126
|
const result = {};
|
|
122
127
|
for (const key in obj) {
|
|
@@ -153,6 +158,7 @@ export {
|
|
|
153
158
|
getKeys,
|
|
154
159
|
isFalsyBooleanCallback,
|
|
155
160
|
disabledFromProps,
|
|
161
|
+
disabledFromElement,
|
|
156
162
|
removeUndefinedValues,
|
|
157
163
|
defaultValue
|
|
158
164
|
};
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
noop,
|
|
9
9
|
omit,
|
|
10
10
|
pick
|
|
11
|
-
} from "./
|
|
11
|
+
} from "./UWJK2WK2.js";
|
|
12
12
|
|
|
13
13
|
// src/utils/store.ts
|
|
14
14
|
function getInternal(store, key) {
|
|
@@ -19,7 +19,7 @@ function getInternal(store, key) {
|
|
|
19
19
|
function createStore(initialState, ...stores) {
|
|
20
20
|
let state = initialState;
|
|
21
21
|
let prevStateBatch = state;
|
|
22
|
-
let lastUpdate = Symbol();
|
|
22
|
+
let lastUpdate = /* @__PURE__ */ Symbol();
|
|
23
23
|
let destroy = noop;
|
|
24
24
|
const instances = /* @__PURE__ */ new Set();
|
|
25
25
|
const updatedKeys = /* @__PURE__ */ new Set();
|
|
@@ -34,7 +34,7 @@ function createStore(initialState, ...stores) {
|
|
|
34
34
|
};
|
|
35
35
|
const storeInit = () => {
|
|
36
36
|
const initialized = instances.size;
|
|
37
|
-
const instance = Symbol();
|
|
37
|
+
const instance = /* @__PURE__ */ Symbol();
|
|
38
38
|
instances.add(instance);
|
|
39
39
|
const maybeDestroy = () => {
|
|
40
40
|
instances.delete(instance);
|
|
@@ -104,7 +104,7 @@ function createStore(initialState, ...stores) {
|
|
|
104
104
|
}
|
|
105
105
|
const prevState = state;
|
|
106
106
|
state = { ...state, [key]: nextValue };
|
|
107
|
-
const thisUpdate = Symbol();
|
|
107
|
+
const thisUpdate = /* @__PURE__ */ Symbol();
|
|
108
108
|
lastUpdate = thisUpdate;
|
|
109
109
|
updatedKeys.add(key);
|
|
110
110
|
const run = (listener, prev, uKeys) => {
|
|
@@ -11,13 +11,13 @@ export interface CheckboxStoreState<T extends CheckboxStoreValue = CheckboxStore
|
|
|
11
11
|
* The checked state of the checkbox.
|
|
12
12
|
*
|
|
13
13
|
* Live examples:
|
|
14
|
-
* - [Custom Checkbox](https://ariakit.
|
|
14
|
+
* - [Custom Checkbox](https://ariakit.com/examples/checkbox-custom)
|
|
15
15
|
*/
|
|
16
16
|
value: ToPrimitive<T>;
|
|
17
17
|
}
|
|
18
18
|
export interface CheckboxStoreFunctions<T extends CheckboxStoreValue = CheckboxStoreValue> {
|
|
19
19
|
/**
|
|
20
|
-
* Sets the [`value`](https://ariakit.
|
|
20
|
+
* Sets the [`value`](https://ariakit.com/reference/checkbox-provider#value)
|
|
21
21
|
* state.
|
|
22
22
|
* @example
|
|
23
23
|
* store.setValue(true);
|
|
@@ -28,12 +28,12 @@ export interface CheckboxStoreFunctions<T extends CheckboxStoreValue = CheckboxS
|
|
|
28
28
|
export interface CheckboxStoreOptions<T extends CheckboxStoreValue = CheckboxStoreValue> extends StoreOptions<CheckboxStoreState<T>, "value"> {
|
|
29
29
|
/**
|
|
30
30
|
* The default
|
|
31
|
-
* [`value`](https://ariakit.
|
|
31
|
+
* [`value`](https://ariakit.com/reference/checkbox-provider#value) state of
|
|
32
32
|
* the checkbox.
|
|
33
33
|
*
|
|
34
34
|
* Live examples:
|
|
35
|
-
* - [Custom Checkbox](https://ariakit.
|
|
36
|
-
* - [Checkbox group](https://ariakit.
|
|
35
|
+
* - [Custom Checkbox](https://ariakit.com/examples/checkbox-custom)
|
|
36
|
+
* - [Checkbox group](https://ariakit.com/examples/checkbox-group)
|
|
37
37
|
* @default false
|
|
38
38
|
*/
|
|
39
39
|
defaultValue?: CheckboxStoreState<T>["value"];
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
import {
|
|
3
3
|
createStore,
|
|
4
4
|
throwOnConflictingProps
|
|
5
|
-
} from "../__chunks/
|
|
5
|
+
} from "../__chunks/XTZ53NXG.js";
|
|
6
6
|
import {
|
|
7
7
|
defaultValue
|
|
8
|
-
} from "../__chunks/
|
|
8
|
+
} from "../__chunks/UWJK2WK2.js";
|
|
9
9
|
|
|
10
10
|
// src/checkbox/checkbox-store.ts
|
|
11
11
|
function createCheckboxStore(props = {}) {
|
|
@@ -18,19 +18,19 @@ export interface CollectionStoreState<T extends CollectionStoreItem = Collection
|
|
|
18
18
|
/**
|
|
19
19
|
* Lists all items along with their metadata. This state is automatically
|
|
20
20
|
* updated when an item is registered or unregistered using the
|
|
21
|
-
* [`registerItem`](https://ariakit.
|
|
21
|
+
* [`registerItem`](https://ariakit.com/reference/use-collection-store#registeritem)
|
|
22
22
|
* function.
|
|
23
23
|
*
|
|
24
24
|
* Live examples:
|
|
25
25
|
* - [Command Menu with
|
|
26
|
-
* Tabs](https://ariakit.
|
|
26
|
+
* Tabs](https://ariakit.com/examples/dialog-combobox-tab-command-menu)
|
|
27
27
|
*/
|
|
28
28
|
items: T[];
|
|
29
29
|
/**
|
|
30
30
|
* Lists all items, along with their metadata, in the exact order they appear in
|
|
31
31
|
* the DOM. This state is automatically updated when an item is rendered or
|
|
32
32
|
* unmounted using the
|
|
33
|
-
* [`renderItem`](https://ariakit.
|
|
33
|
+
* [`renderItem`](https://ariakit.com/reference/use-collection-store#renderitem)
|
|
34
34
|
* function.
|
|
35
35
|
*/
|
|
36
36
|
renderedItems: T[];
|
|
@@ -58,7 +58,7 @@ export interface CollectionStoreFunctions<T extends CollectionStoreItem = Collec
|
|
|
58
58
|
* Gets an item by its id.
|
|
59
59
|
*
|
|
60
60
|
* Live examples:
|
|
61
|
-
* - [Animated TabPanel](https://ariakit.
|
|
61
|
+
* - [Animated TabPanel](https://ariakit.com/examples/tab-panel-animated)
|
|
62
62
|
* @example
|
|
63
63
|
* const item = store.item("item-1");
|
|
64
64
|
*/
|
|
@@ -67,7 +67,7 @@ export interface CollectionStoreFunctions<T extends CollectionStoreItem = Collec
|
|
|
67
67
|
export interface CollectionStoreOptions<T extends CollectionStoreItem = CollectionStoreItem> extends StoreOptions<CollectionStoreState<T>, "items"> {
|
|
68
68
|
/**
|
|
69
69
|
* The defaut value for the
|
|
70
|
-
* [`items`](https://ariakit.
|
|
70
|
+
* [`items`](https://ariakit.com/reference/collection-provider#items) state.
|
|
71
71
|
* @default []
|
|
72
72
|
*/
|
|
73
73
|
defaultItems?: CollectionStoreState<T>["items"];
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
3
|
createCollectionStore
|
|
4
|
-
} from "../__chunks/
|
|
5
|
-
import "../__chunks/
|
|
6
|
-
import "../__chunks/
|
|
7
|
-
import "../__chunks/
|
|
4
|
+
} from "../__chunks/KZX46JDB.js";
|
|
5
|
+
import "../__chunks/G7XPWBXK.js";
|
|
6
|
+
import "../__chunks/XTZ53NXG.js";
|
|
7
|
+
import "../__chunks/UWJK2WK2.js";
|
|
8
8
|
export {
|
|
9
9
|
createCollectionStore
|
|
10
10
|
};
|
|
@@ -29,15 +29,15 @@ export interface ComboboxStoreState<T extends ComboboxStoreSelectedValue = Combo
|
|
|
29
29
|
*
|
|
30
30
|
* Live examples:
|
|
31
31
|
* - [Combobox with integrated
|
|
32
|
-
* filter](https://ariakit.
|
|
33
|
-
* - [Combobox with links](https://ariakit.
|
|
34
|
-
* - [Combobox filtering](https://ariakit.
|
|
32
|
+
* filter](https://ariakit.com/examples/combobox-filtering-integrated)
|
|
33
|
+
* - [Combobox with links](https://ariakit.com/examples/combobox-links)
|
|
34
|
+
* - [Combobox filtering](https://ariakit.com/examples/combobox-filtering)
|
|
35
35
|
* - [Multi-selectable
|
|
36
|
-
* Combobox](https://ariakit.
|
|
36
|
+
* Combobox](https://ariakit.com/examples/combobox-multiple)
|
|
37
37
|
* - [Textarea with inline
|
|
38
|
-
* Combobox](https://ariakit.
|
|
38
|
+
* Combobox](https://ariakit.com/examples/combobox-textarea)
|
|
39
39
|
* - [Command Menu with
|
|
40
|
-
* Tabs](https://ariakit.
|
|
40
|
+
* Tabs](https://ariakit.com/examples/dialog-combobox-tab-command-menu)
|
|
41
41
|
*/
|
|
42
42
|
value: string;
|
|
43
43
|
/**
|
|
@@ -49,71 +49,71 @@ export interface ComboboxStoreState<T extends ComboboxStoreSelectedValue = Combo
|
|
|
49
49
|
/**
|
|
50
50
|
* The value(s) of the currently selected item(s). This can be a string or an
|
|
51
51
|
* array of strings. If it's an array, the combobox is considered
|
|
52
|
-
* [multi-selectable](https://ariakit.
|
|
52
|
+
* [multi-selectable](https://ariakit.com/examples/combobox-multiple).
|
|
53
53
|
*
|
|
54
54
|
* Live examples:
|
|
55
55
|
* - [Multi-selectable
|
|
56
|
-
* Combobox](https://ariakit.
|
|
56
|
+
* Combobox](https://ariakit.com/examples/combobox-multiple)
|
|
57
57
|
*/
|
|
58
58
|
selectedValue: MutableValue<T>;
|
|
59
59
|
/**
|
|
60
60
|
* Whether to reset the value when the combobox popover closes. This prop is
|
|
61
61
|
* automatically set to `true` by default if the combobox supports multiple
|
|
62
62
|
* selections. In other words, if the
|
|
63
|
-
* [`selectedValue`](https://ariakit.
|
|
63
|
+
* [`selectedValue`](https://ariakit.com/reference/combobox-provider#selectedvalue)
|
|
64
64
|
* or
|
|
65
|
-
* [`defaultSelectedValue`](https://ariakit.
|
|
65
|
+
* [`defaultSelectedValue`](https://ariakit.com/reference/combobox-provider#defaultselectedvalue)
|
|
66
66
|
* props are arrays.
|
|
67
67
|
*
|
|
68
68
|
* Live examples:
|
|
69
69
|
* - [Multi-selectable
|
|
70
|
-
* Combobox](https://ariakit.
|
|
71
|
-
* - [Menu with Combobox](https://ariakit.
|
|
72
|
-
* - [Select with Combobox](https://ariakit.
|
|
70
|
+
* Combobox](https://ariakit.com/examples/combobox-multiple)
|
|
71
|
+
* - [Menu with Combobox](https://ariakit.com/examples/menu-combobox)
|
|
72
|
+
* - [Select with Combobox](https://ariakit.com/examples/select-combobox)
|
|
73
73
|
* - [Submenu with
|
|
74
|
-
* Combobox](https://ariakit.
|
|
74
|
+
* Combobox](https://ariakit.com/examples/menu-nested-combobox)
|
|
75
75
|
* - [Command Menu with
|
|
76
|
-
* Tabs](https://ariakit.
|
|
76
|
+
* Tabs](https://ariakit.com/examples/dialog-combobox-tab-command-menu)
|
|
77
77
|
* - [Select with Combobox and
|
|
78
|
-
* Tabs](https://ariakit.
|
|
78
|
+
* Tabs](https://ariakit.com/examples/select-combobox-tab)
|
|
79
79
|
*/
|
|
80
80
|
resetValueOnHide: boolean;
|
|
81
81
|
/**
|
|
82
82
|
* Whether to reset the value when an item is selected. This prop is
|
|
83
83
|
* automatically set to `true` by default if the combobox supports multiple
|
|
84
84
|
* selections. In other words, if the
|
|
85
|
-
* [`selectedValue`](https://ariakit.
|
|
85
|
+
* [`selectedValue`](https://ariakit.com/reference/combobox-provider#selectedvalue)
|
|
86
86
|
* or
|
|
87
|
-
* [`defaultSelectedValue`](https://ariakit.
|
|
87
|
+
* [`defaultSelectedValue`](https://ariakit.com/reference/combobox-provider#defaultselectedvalue)
|
|
88
88
|
* props are arrays.
|
|
89
89
|
* @deprecated Use the
|
|
90
|
-
* [`resetValueOnSelect`](https://ariakit.
|
|
91
|
-
* prop on [`ComboboxItem`](https://ariakit.
|
|
90
|
+
* [`resetValueOnSelect`](https://ariakit.com/reference/combobox-item#resetvalueonselect)
|
|
91
|
+
* prop on [`ComboboxItem`](https://ariakit.com/reference/combobox-item)
|
|
92
92
|
* instead.
|
|
93
93
|
*/
|
|
94
94
|
resetValueOnSelect: boolean;
|
|
95
95
|
}
|
|
96
96
|
export interface ComboboxStoreFunctions<T extends ComboboxStoreSelectedValue = ComboboxStoreSelectedValue> extends Pick<ComboboxStoreOptions<T>, "tag">, CompositeStoreFunctions<ComboboxStoreItem>, PopoverStoreFunctions {
|
|
97
97
|
/**
|
|
98
|
-
* Sets the [`value`](https://ariakit.
|
|
98
|
+
* Sets the [`value`](https://ariakit.com/reference/combobox-provider#value)
|
|
99
99
|
* state.
|
|
100
100
|
*
|
|
101
101
|
* Live examples:
|
|
102
102
|
* - [Textarea with inline
|
|
103
|
-
* Combobox](https://ariakit.
|
|
103
|
+
* Combobox](https://ariakit.com/examples/combobox-textarea)
|
|
104
104
|
* @example
|
|
105
105
|
* store.setValue("Hello world");
|
|
106
106
|
* store.setValue((value) => value + "!");
|
|
107
107
|
*/
|
|
108
108
|
setValue: SetState<ComboboxStoreState<T>["value"]>;
|
|
109
109
|
/**
|
|
110
|
-
* Resets the [`value`](https://ariakit.
|
|
110
|
+
* Resets the [`value`](https://ariakit.com/reference/combobox-provider#value)
|
|
111
111
|
* state to its initial value.
|
|
112
112
|
*/
|
|
113
113
|
resetValue: () => void;
|
|
114
114
|
/**
|
|
115
115
|
* Sets the
|
|
116
|
-
* [`selectedValue`](https://ariakit.
|
|
116
|
+
* [`selectedValue`](https://ariakit.com/reference/combobox-provider#selectedvalue)
|
|
117
117
|
* state.
|
|
118
118
|
*/
|
|
119
119
|
setSelectedValue: SetState<ComboboxStoreState<T>["selectedValue"]>;
|
|
@@ -128,10 +128,10 @@ export interface ComboboxStoreOptions<T extends ComboboxStoreSelectedValue = Com
|
|
|
128
128
|
defaultValue?: ComboboxStoreState<T>["value"];
|
|
129
129
|
/**
|
|
130
130
|
* The initial value of the
|
|
131
|
-
* [`selectedValue`](https://ariakit.
|
|
131
|
+
* [`selectedValue`](https://ariakit.com/reference/combobox-provider#selectedvalue)
|
|
132
132
|
* state. This can be a string or an array of strings. If it's an array, the
|
|
133
133
|
* combobox is considered
|
|
134
|
-
* [multi-selectable](https://ariakit.
|
|
134
|
+
* [multi-selectable](https://ariakit.com/examples/combobox-multiple).
|
|
135
135
|
* @default ""
|
|
136
136
|
*/
|
|
137
137
|
defaultSelectedValue?: ComboboxStoreState<T>["selectedValue"];
|
|
@@ -2,18 +2,18 @@
|
|
|
2
2
|
import {
|
|
3
3
|
isSafari,
|
|
4
4
|
isTouchDevice
|
|
5
|
-
} from "../__chunks/
|
|
5
|
+
} from "../__chunks/GMGLSF2B.js";
|
|
6
6
|
import {
|
|
7
7
|
createPopoverStore
|
|
8
|
-
} from "../__chunks/
|
|
8
|
+
} from "../__chunks/MJ4ZJEIM.js";
|
|
9
9
|
import {
|
|
10
10
|
createCompositeStore
|
|
11
|
-
} from "../__chunks/
|
|
11
|
+
} from "../__chunks/UNDE2QJS.js";
|
|
12
12
|
import "../__chunks/7PRQYBBV.js";
|
|
13
|
-
import "../__chunks/
|
|
14
|
-
import "../__chunks/
|
|
15
|
-
import "../__chunks/
|
|
16
|
-
import "../__chunks/
|
|
13
|
+
import "../__chunks/7KNZCZ55.js";
|
|
14
|
+
import "../__chunks/IHNLLH3I.js";
|
|
15
|
+
import "../__chunks/KZX46JDB.js";
|
|
16
|
+
import "../__chunks/G7XPWBXK.js";
|
|
17
17
|
import {
|
|
18
18
|
batch,
|
|
19
19
|
createStore,
|
|
@@ -22,11 +22,11 @@ import {
|
|
|
22
22
|
setup,
|
|
23
23
|
sync,
|
|
24
24
|
throwOnConflictingProps
|
|
25
|
-
} from "../__chunks/
|
|
25
|
+
} from "../__chunks/XTZ53NXG.js";
|
|
26
26
|
import {
|
|
27
27
|
chain,
|
|
28
28
|
defaultValue
|
|
29
|
-
} from "../__chunks/
|
|
29
|
+
} from "../__chunks/UWJK2WK2.js";
|
|
30
30
|
|
|
31
31
|
// src/combobox/combobox-store.ts
|
|
32
32
|
var isTouchSafari = isSafari() && isTouchDevice();
|
|
@@ -1,11 +1,11 @@
|
|
|
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/
|
|
4
|
+
} from "../__chunks/MJ4ZJEIM.js";
|
|
5
|
+
import "../__chunks/7KNZCZ55.js";
|
|
6
|
+
import "../__chunks/IHNLLH3I.js";
|
|
7
|
+
import "../__chunks/XTZ53NXG.js";
|
|
8
|
+
import "../__chunks/UWJK2WK2.js";
|
|
9
9
|
|
|
10
10
|
// src/composite/composite-overflow-store.ts
|
|
11
11
|
function createCompositeOverflowStore(props = {}) {
|