@ariakit/core 0.3.9 → 0.3.10
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/{2UK5WUJX.cjs → 5CBCKBZ2.cjs} +0 -2
- package/cjs/__chunks/{UTICNXST.cjs → CWDUO5EV.cjs} +4 -4
- package/cjs/__chunks/{5SIVMOID.cjs → HMO4CKUP.cjs} +4 -4
- package/cjs/__chunks/{2LS4JJ4S.cjs → MFSCSSBJ.cjs} +2 -2
- package/cjs/__chunks/{GJFZ5ZPP.cjs → MWNFQD55.cjs} +11 -11
- package/cjs/__chunks/{EFIT5L4X.cjs → Y6PHIDP6.cjs} +7 -7
- package/cjs/__chunks/{UCLKUBNP.cjs → YLMJBIQM.cjs} +16 -12
- package/cjs/__chunks/{JNFZSNOI.cjs → ZXCB7MXN.cjs} +6 -6
- package/cjs/checkbox/checkbox-store.cjs +3 -3
- package/cjs/checkbox/checkbox-store.d.cts +5 -2
- package/cjs/checkbox/checkbox-store.d.ts +5 -2
- package/cjs/collection/collection-store.cjs +3 -3
- package/cjs/collection/collection-store.d.cts +11 -11
- package/cjs/collection/collection-store.d.ts +11 -11
- package/cjs/combobox/combobox-store.cjs +20 -20
- package/cjs/combobox/combobox-store.d.cts +3 -1
- package/cjs/combobox/combobox-store.d.ts +3 -1
- package/cjs/composite/composite-overflow-store.cjs +5 -5
- package/cjs/composite/composite-store.cjs +4 -4
- package/cjs/composite/composite-store.d.cts +128 -54
- package/cjs/composite/composite-store.d.ts +128 -54
- package/cjs/dialog/dialog-store.cjs +4 -4
- package/cjs/disclosure/disclosure-store.cjs +3 -3
- package/cjs/disclosure/disclosure-store.d.cts +33 -27
- package/cjs/disclosure/disclosure-store.d.ts +33 -27
- package/cjs/form/form-store.cjs +7 -7
- package/cjs/form/form-store.d.cts +34 -25
- package/cjs/form/form-store.d.ts +34 -25
- package/cjs/hovercard/hovercard-store.cjs +6 -6
- package/cjs/menu/menu-bar-store.cjs +5 -5
- package/cjs/menu/menu-store.cjs +18 -18
- package/cjs/menubar/menubar-store.cjs +5 -5
- package/cjs/popover/popover-store.cjs +5 -5
- package/cjs/radio/radio-store.cjs +5 -5
- package/cjs/select/select-store.cjs +18 -18
- package/cjs/tab/tab-store.cjs +15 -15
- package/cjs/tab/tab-store.d.cts +15 -4
- package/cjs/tab/tab-store.d.ts +15 -4
- package/cjs/toolbar/toolbar-store.cjs +4 -4
- package/cjs/tooltip/tooltip-store.cjs +7 -7
- package/cjs/utils/store.cjs +2 -2
- package/esm/__chunks/{LT2OYWRD.js → 25MEC56I.js} +1 -1
- package/esm/__chunks/{J6JIOWCS.js → AKMSZ36N.js} +2 -2
- package/esm/__chunks/{A2J4XZ5T.js → K6ELJFXN.js} +0 -2
- package/esm/__chunks/{NKLTHWCR.js → L5RYKTVQ.js} +1 -1
- package/esm/__chunks/{TLN4ALYH.js → MYUKSFP5.js} +10 -6
- package/esm/__chunks/{T3DVYGXI.js → QJ5CUA32.js} +2 -2
- package/esm/__chunks/{EZ2TTBAQ.js → UUFF4PQ6.js} +2 -2
- package/esm/__chunks/{DLX2AS6C.js → VEUNYQYR.js} +2 -2
- package/esm/checkbox/checkbox-store.d.ts +5 -2
- package/esm/checkbox/checkbox-store.js +1 -1
- package/esm/collection/collection-store.d.ts +11 -11
- package/esm/collection/collection-store.js +2 -2
- package/esm/combobox/combobox-store.d.ts +3 -1
- package/esm/combobox/combobox-store.js +6 -6
- package/esm/composite/composite-overflow-store.js +4 -4
- package/esm/composite/composite-store.d.ts +128 -54
- package/esm/composite/composite-store.js +3 -3
- package/esm/dialog/dialog-store.js +3 -3
- package/esm/disclosure/disclosure-store.d.ts +33 -27
- package/esm/disclosure/disclosure-store.js +2 -2
- package/esm/form/form-store.d.ts +34 -25
- package/esm/form/form-store.js +2 -2
- package/esm/hovercard/hovercard-store.js +5 -5
- package/esm/menu/menu-bar-store.js +4 -4
- package/esm/menu/menu-store.js +7 -7
- package/esm/menubar/menubar-store.js +4 -4
- package/esm/popover/popover-store.js +4 -4
- package/esm/radio/radio-store.js +3 -3
- package/esm/select/select-store.js +6 -6
- package/esm/tab/tab-store.d.ts +15 -4
- package/esm/tab/tab-store.js +3 -3
- package/esm/toolbar/toolbar-store.js +3 -3
- package/esm/tooltip/tooltip-store.js +5 -5
- package/esm/utils/store.js +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
# @ariakit/core
|
|
2
2
|
|
|
3
|
+
## 0.3.10
|
|
4
|
+
|
|
5
|
+
- Fixed [`CompositeItem`](https://ariakit.org/reference/composite-item) triggering blur on focus.
|
|
6
|
+
- Improved JSDocs.
|
|
7
|
+
|
|
3
8
|
## 0.3.9
|
|
4
9
|
|
|
5
10
|
- Fixed `Maximum update depth exceeded` warning when rendering multiple collection items on the page.
|
|
@@ -37,8 +37,6 @@ function createStore(initialState, ...stores) {
|
|
|
37
37
|
return () => setups.delete(callback);
|
|
38
38
|
};
|
|
39
39
|
const storeInit = () => {
|
|
40
|
-
if (!stores.length)
|
|
41
|
-
return _3UT5FE6Kcjs.noop;
|
|
42
40
|
const initialized = instances.size;
|
|
43
41
|
const instance = Symbol();
|
|
44
42
|
instances.add(instance);
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
var
|
|
4
|
+
var _ZXCB7MXNcjs = require('./ZXCB7MXN.cjs');
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
var
|
|
7
|
+
var _5CBCKBZ2cjs = require('./5CBCKBZ2.cjs');
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
var _3UT5FE6Kcjs = require('./3UT5FE6K.cjs');
|
|
@@ -17,7 +17,7 @@ var _AV6KTKLEcjs = require('./AV6KTKLE.cjs');
|
|
|
17
17
|
function createMenubarStore(props = {}) {
|
|
18
18
|
var _a;
|
|
19
19
|
const syncState = (_a = props.store) == null ? void 0 : _a.getState();
|
|
20
|
-
const composite =
|
|
20
|
+
const composite = _ZXCB7MXNcjs.createCompositeStore.call(void 0, _AV6KTKLEcjs.__spreadProps.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, {}, props), {
|
|
21
21
|
orientation: _3UT5FE6Kcjs.defaultValue.call(void 0,
|
|
22
22
|
props.orientation,
|
|
23
23
|
syncState == null ? void 0 : syncState.orientation,
|
|
@@ -26,7 +26,7 @@ function createMenubarStore(props = {}) {
|
|
|
26
26
|
focusLoop: _3UT5FE6Kcjs.defaultValue.call(void 0, props.focusLoop, syncState == null ? void 0 : syncState.focusLoop, true)
|
|
27
27
|
}));
|
|
28
28
|
const initialState = _AV6KTKLEcjs.__spreadValues.call(void 0, {}, composite.getState());
|
|
29
|
-
const menubar =
|
|
29
|
+
const menubar = _5CBCKBZ2cjs.createStore.call(void 0, initialState, composite, props.store);
|
|
30
30
|
return _AV6KTKLEcjs.__spreadValues.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, {}, composite), menubar);
|
|
31
31
|
}
|
|
32
32
|
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
var
|
|
4
|
+
var _Y6PHIDP6cjs = require('./Y6PHIDP6.cjs');
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
var
|
|
7
|
+
var _5CBCKBZ2cjs = require('./5CBCKBZ2.cjs');
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
var _3UT5FE6Kcjs = require('./3UT5FE6K.cjs');
|
|
@@ -17,7 +17,7 @@ var _AV6KTKLEcjs = require('./AV6KTKLE.cjs');
|
|
|
17
17
|
function createHovercardStore(props = {}) {
|
|
18
18
|
var _a;
|
|
19
19
|
const syncState = (_a = props.store) == null ? void 0 : _a.getState();
|
|
20
|
-
const popover =
|
|
20
|
+
const popover = _Y6PHIDP6cjs.createPopoverStore.call(void 0, _AV6KTKLEcjs.__spreadProps.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, {}, props), {
|
|
21
21
|
placement: _3UT5FE6Kcjs.defaultValue.call(void 0,
|
|
22
22
|
props.placement,
|
|
23
23
|
syncState == null ? void 0 : syncState.placement,
|
|
@@ -31,7 +31,7 @@ function createHovercardStore(props = {}) {
|
|
|
31
31
|
hideTimeout: _3UT5FE6Kcjs.defaultValue.call(void 0, props.hideTimeout, syncState == null ? void 0 : syncState.hideTimeout),
|
|
32
32
|
autoFocusOnShow: _3UT5FE6Kcjs.defaultValue.call(void 0, syncState == null ? void 0 : syncState.autoFocusOnShow, false)
|
|
33
33
|
});
|
|
34
|
-
const hovercard =
|
|
34
|
+
const hovercard = _5CBCKBZ2cjs.createStore.call(void 0, initialState, popover, props.store);
|
|
35
35
|
return _AV6KTKLEcjs.__spreadProps.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, {}, popover), hovercard), {
|
|
36
36
|
setAutoFocusOnShow: (value) => hovercard.setState("autoFocusOnShow", value)
|
|
37
37
|
});
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
var
|
|
4
|
+
var _MWNFQD55cjs = require('./MWNFQD55.cjs');
|
|
5
5
|
|
|
6
6
|
// src/dialog/dialog-store.ts
|
|
7
7
|
function createDialogStore(props = {}) {
|
|
8
|
-
return
|
|
8
|
+
return _MWNFQD55cjs.createDisclosureStore.call(void 0, props);
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
var
|
|
10
|
+
var _5CBCKBZ2cjs = require('./5CBCKBZ2.cjs');
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
var _3UT5FE6Kcjs = require('./3UT5FE6K.cjs');
|
|
@@ -18,11 +18,11 @@ var _AV6KTKLEcjs = require('./AV6KTKLE.cjs');
|
|
|
18
18
|
|
|
19
19
|
// src/disclosure/disclosure-store.ts
|
|
20
20
|
function createDisclosureStore(props = {}) {
|
|
21
|
-
const store =
|
|
21
|
+
const store = _5CBCKBZ2cjs.mergeStore.call(void 0,
|
|
22
22
|
props.store,
|
|
23
|
-
|
|
23
|
+
_5CBCKBZ2cjs.omit.call(void 0, props.disclosure, ["contentElement", "disclosureElement"])
|
|
24
24
|
);
|
|
25
|
-
|
|
25
|
+
_5CBCKBZ2cjs.throwOnConflictingProps.call(void 0, props, store);
|
|
26
26
|
const syncState = store == null ? void 0 : store.getState();
|
|
27
27
|
const open = _3UT5FE6Kcjs.defaultValue.call(void 0,
|
|
28
28
|
props.open,
|
|
@@ -39,26 +39,26 @@ function createDisclosureStore(props = {}) {
|
|
|
39
39
|
contentElement: _3UT5FE6Kcjs.defaultValue.call(void 0, syncState == null ? void 0 : syncState.contentElement, null),
|
|
40
40
|
disclosureElement: _3UT5FE6Kcjs.defaultValue.call(void 0, syncState == null ? void 0 : syncState.disclosureElement, null)
|
|
41
41
|
};
|
|
42
|
-
const disclosure =
|
|
43
|
-
|
|
42
|
+
const disclosure = _5CBCKBZ2cjs.createStore.call(void 0, initialState, store);
|
|
43
|
+
_5CBCKBZ2cjs.setup.call(void 0,
|
|
44
44
|
disclosure,
|
|
45
|
-
() =>
|
|
45
|
+
() => _5CBCKBZ2cjs.sync.call(void 0, disclosure, ["animated", "animating"], (state) => {
|
|
46
46
|
if (state.animated)
|
|
47
47
|
return;
|
|
48
48
|
disclosure.setState("animating", false);
|
|
49
49
|
})
|
|
50
50
|
);
|
|
51
|
-
|
|
51
|
+
_5CBCKBZ2cjs.setup.call(void 0,
|
|
52
52
|
disclosure,
|
|
53
|
-
() =>
|
|
53
|
+
() => _5CBCKBZ2cjs.subscribe.call(void 0, disclosure, ["open"], () => {
|
|
54
54
|
if (!disclosure.getState().animated)
|
|
55
55
|
return;
|
|
56
56
|
disclosure.setState("animating", true);
|
|
57
57
|
})
|
|
58
58
|
);
|
|
59
|
-
|
|
59
|
+
_5CBCKBZ2cjs.setup.call(void 0,
|
|
60
60
|
disclosure,
|
|
61
|
-
() =>
|
|
61
|
+
() => _5CBCKBZ2cjs.sync.call(void 0, disclosure, ["open", "animating"], (state) => {
|
|
62
62
|
disclosure.setState("mounted", state.open || state.animating);
|
|
63
63
|
})
|
|
64
64
|
);
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
var
|
|
4
|
+
var _MFSCSSBJcjs = require('./MFSCSSBJ.cjs');
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
var
|
|
10
|
+
var _5CBCKBZ2cjs = require('./5CBCKBZ2.cjs');
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
var _3UT5FE6Kcjs = require('./3UT5FE6K.cjs');
|
|
@@ -24,9 +24,9 @@ function createPopoverStore(_a = {}) {
|
|
|
24
24
|
} = _b, props = _AV6KTKLEcjs.__objRest.call(void 0, _b, [
|
|
25
25
|
"popover"
|
|
26
26
|
]);
|
|
27
|
-
const store =
|
|
27
|
+
const store = _5CBCKBZ2cjs.mergeStore.call(void 0,
|
|
28
28
|
props.store,
|
|
29
|
-
|
|
29
|
+
_5CBCKBZ2cjs.omit.call(void 0, otherPopover, [
|
|
30
30
|
"arrowElement",
|
|
31
31
|
"anchorElement",
|
|
32
32
|
"contentElement",
|
|
@@ -34,9 +34,9 @@ function createPopoverStore(_a = {}) {
|
|
|
34
34
|
"disclosureElement"
|
|
35
35
|
])
|
|
36
36
|
);
|
|
37
|
-
|
|
37
|
+
_5CBCKBZ2cjs.throwOnConflictingProps.call(void 0, props, store);
|
|
38
38
|
const syncState = store == null ? void 0 : store.getState();
|
|
39
|
-
const dialog =
|
|
39
|
+
const dialog = _MFSCSSBJcjs.createDialogStore.call(void 0, _AV6KTKLEcjs.__spreadProps.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, {}, props), { store }));
|
|
40
40
|
const placement = _3UT5FE6Kcjs.defaultValue.call(void 0,
|
|
41
41
|
props.placement,
|
|
42
42
|
syncState == null ? void 0 : syncState.placement,
|
|
@@ -50,7 +50,7 @@ function createPopoverStore(_a = {}) {
|
|
|
50
50
|
arrowElement: _3UT5FE6Kcjs.defaultValue.call(void 0, syncState == null ? void 0 : syncState.arrowElement, null),
|
|
51
51
|
rendered: Symbol("rendered")
|
|
52
52
|
});
|
|
53
|
-
const popover =
|
|
53
|
+
const popover = _5CBCKBZ2cjs.createStore.call(void 0, initialState, dialog, store);
|
|
54
54
|
return _AV6KTKLEcjs.__spreadProps.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, {}, dialog), popover), {
|
|
55
55
|
setAnchorElement: (element) => popover.setState("anchorElement", element),
|
|
56
56
|
setPopoverElement: (element) => popover.setState("popoverElement", element),
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
var
|
|
8
|
+
var _5CBCKBZ2cjs = require('./5CBCKBZ2.cjs');
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
|
|
@@ -69,7 +69,7 @@ function getPrivateStore(store) {
|
|
|
69
69
|
}
|
|
70
70
|
function createCollectionStore(props = {}) {
|
|
71
71
|
var _a;
|
|
72
|
-
|
|
72
|
+
_5CBCKBZ2cjs.throwOnConflictingProps.call(void 0, props, props.store);
|
|
73
73
|
const syncState = (_a = props.store) == null ? void 0 : _a.getState();
|
|
74
74
|
const items = _3UT5FE6Kcjs.defaultValue.call(void 0,
|
|
75
75
|
props.items,
|
|
@@ -83,22 +83,25 @@ function createCollectionStore(props = {}) {
|
|
|
83
83
|
renderedItems: _3UT5FE6Kcjs.defaultValue.call(void 0, syncState == null ? void 0 : syncState.renderedItems, [])
|
|
84
84
|
};
|
|
85
85
|
const syncPrivateStore = getPrivateStore(props.store);
|
|
86
|
-
const privateStore =
|
|
86
|
+
const privateStore = _5CBCKBZ2cjs.createStore.call(void 0,
|
|
87
87
|
{ renderedItems: initialState.renderedItems },
|
|
88
88
|
syncPrivateStore
|
|
89
89
|
);
|
|
90
|
-
const collection =
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
90
|
+
const collection = _5CBCKBZ2cjs.createStore.call(void 0, initialState, props.store);
|
|
91
|
+
const sortItems = (renderedItems) => {
|
|
92
|
+
const sortedItems = sortBasedOnDOMPosition(renderedItems);
|
|
93
|
+
privateStore.setState("renderedItems", sortedItems);
|
|
94
|
+
collection.setState("renderedItems", sortedItems);
|
|
95
|
+
};
|
|
96
|
+
_5CBCKBZ2cjs.setup.call(void 0, collection, () => _5CBCKBZ2cjs.init.call(void 0, privateStore));
|
|
97
|
+
_5CBCKBZ2cjs.setup.call(void 0, privateStore, () => {
|
|
98
|
+
return _5CBCKBZ2cjs.batch.call(void 0, privateStore, ["renderedItems"], (state) => {
|
|
94
99
|
let firstRun = true;
|
|
95
|
-
|
|
100
|
+
let raf = requestAnimationFrame(() => {
|
|
96
101
|
const { renderedItems } = collection.getState();
|
|
97
102
|
if (state.renderedItems === renderedItems)
|
|
98
103
|
return;
|
|
99
|
-
|
|
100
|
-
privateStore.setState("renderedItems", sortedItems);
|
|
101
|
-
collection.setState("renderedItems", sortedItems);
|
|
104
|
+
sortItems(state.renderedItems);
|
|
102
105
|
});
|
|
103
106
|
if (typeof IntersectionObserver !== "function") {
|
|
104
107
|
return () => cancelAnimationFrame(raf);
|
|
@@ -108,7 +111,8 @@ function createCollectionStore(props = {}) {
|
|
|
108
111
|
firstRun = false;
|
|
109
112
|
return;
|
|
110
113
|
}
|
|
111
|
-
|
|
114
|
+
cancelAnimationFrame(raf);
|
|
115
|
+
raf = requestAnimationFrame(() => sortItems(state.renderedItems));
|
|
112
116
|
};
|
|
113
117
|
const root = getCommonParent(state.renderedItems);
|
|
114
118
|
const observer = new IntersectionObserver(ioCallback, { root });
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
var
|
|
4
|
+
var _YLMJBIQMcjs = require('./YLMJBIQM.cjs');
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
var
|
|
9
|
+
var _5CBCKBZ2cjs = require('./5CBCKBZ2.cjs');
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
var _3UT5FE6Kcjs = require('./3UT5FE6K.cjs');
|
|
@@ -124,7 +124,7 @@ function verticalizeItems(items) {
|
|
|
124
124
|
function createCompositeStore(props = {}) {
|
|
125
125
|
var _a;
|
|
126
126
|
const syncState = (_a = props.store) == null ? void 0 : _a.getState();
|
|
127
|
-
const collection =
|
|
127
|
+
const collection = _YLMJBIQMcjs.createCollectionStore.call(void 0, props);
|
|
128
128
|
const activeId = _3UT5FE6Kcjs.defaultValue.call(void 0,
|
|
129
129
|
props.activeId,
|
|
130
130
|
syncState == null ? void 0 : syncState.activeId,
|
|
@@ -154,10 +154,10 @@ function createCompositeStore(props = {}) {
|
|
|
154
154
|
focusWrap: _3UT5FE6Kcjs.defaultValue.call(void 0, props.focusWrap, syncState == null ? void 0 : syncState.focusWrap, false),
|
|
155
155
|
focusShift: _3UT5FE6Kcjs.defaultValue.call(void 0, props.focusShift, syncState == null ? void 0 : syncState.focusShift, false)
|
|
156
156
|
});
|
|
157
|
-
const composite =
|
|
158
|
-
|
|
157
|
+
const composite = _5CBCKBZ2cjs.createStore.call(void 0, initialState, collection, props.store);
|
|
158
|
+
_5CBCKBZ2cjs.setup.call(void 0,
|
|
159
159
|
composite,
|
|
160
|
-
() =>
|
|
160
|
+
() => _5CBCKBZ2cjs.sync.call(void 0, composite, ["renderedItems", "activeId"], (state) => {
|
|
161
161
|
composite.setState("activeId", (activeId2) => {
|
|
162
162
|
var _a2;
|
|
163
163
|
if (activeId2 !== void 0)
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
|
|
5
|
-
var
|
|
5
|
+
var _5CBCKBZ2cjs = require('../__chunks/5CBCKBZ2.cjs');
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
var _3UT5FE6Kcjs = require('../__chunks/3UT5FE6K.cjs');
|
|
@@ -14,7 +14,7 @@ var _AV6KTKLEcjs = require('../__chunks/AV6KTKLE.cjs');
|
|
|
14
14
|
// src/checkbox/checkbox-store.ts
|
|
15
15
|
function createCheckboxStore(props = {}) {
|
|
16
16
|
var _a;
|
|
17
|
-
|
|
17
|
+
_5CBCKBZ2cjs.throwOnConflictingProps.call(void 0, props, props.store);
|
|
18
18
|
const syncState = (_a = props.store) == null ? void 0 : _a.getState();
|
|
19
19
|
const initialState = {
|
|
20
20
|
value: _3UT5FE6Kcjs.defaultValue.call(void 0,
|
|
@@ -24,7 +24,7 @@ function createCheckboxStore(props = {}) {
|
|
|
24
24
|
false
|
|
25
25
|
)
|
|
26
26
|
};
|
|
27
|
-
const checkbox =
|
|
27
|
+
const checkbox = _5CBCKBZ2cjs.createStore.call(void 0, initialState, props.store);
|
|
28
28
|
return _AV6KTKLEcjs.__spreadProps.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, {}, checkbox), {
|
|
29
29
|
setValue: (value) => checkbox.setState("value", value)
|
|
30
30
|
});
|
|
@@ -17,7 +17,8 @@ export interface CheckboxStoreState<T extends CheckboxStoreValue = CheckboxStore
|
|
|
17
17
|
}
|
|
18
18
|
export interface CheckboxStoreFunctions<T extends CheckboxStoreValue = CheckboxStoreValue> {
|
|
19
19
|
/**
|
|
20
|
-
* Sets the `value`
|
|
20
|
+
* Sets the [`value`](https://ariakit.org/reference/checkbox-provider#value)
|
|
21
|
+
* state.
|
|
21
22
|
* @example
|
|
22
23
|
* store.setValue(true);
|
|
23
24
|
* store.setValue((value) => !value);
|
|
@@ -26,7 +27,9 @@ export interface CheckboxStoreFunctions<T extends CheckboxStoreValue = CheckboxS
|
|
|
26
27
|
}
|
|
27
28
|
export interface CheckboxStoreOptions<T extends CheckboxStoreValue = CheckboxStoreValue> extends StoreOptions<CheckboxStoreState<T>, "value"> {
|
|
28
29
|
/**
|
|
29
|
-
* The default
|
|
30
|
+
* The default
|
|
31
|
+
* [`value`](https://ariakit.org/reference/checkbox-provider#value) state of
|
|
32
|
+
* the checkbox.
|
|
30
33
|
*
|
|
31
34
|
* Live examples:
|
|
32
35
|
* - [Custom Checkbox](https://ariakit.org/examples/checkbox-custom)
|
|
@@ -17,7 +17,8 @@ export interface CheckboxStoreState<T extends CheckboxStoreValue = CheckboxStore
|
|
|
17
17
|
}
|
|
18
18
|
export interface CheckboxStoreFunctions<T extends CheckboxStoreValue = CheckboxStoreValue> {
|
|
19
19
|
/**
|
|
20
|
-
* Sets the `value`
|
|
20
|
+
* Sets the [`value`](https://ariakit.org/reference/checkbox-provider#value)
|
|
21
|
+
* state.
|
|
21
22
|
* @example
|
|
22
23
|
* store.setValue(true);
|
|
23
24
|
* store.setValue((value) => !value);
|
|
@@ -26,7 +27,9 @@ export interface CheckboxStoreFunctions<T extends CheckboxStoreValue = CheckboxS
|
|
|
26
27
|
}
|
|
27
28
|
export interface CheckboxStoreOptions<T extends CheckboxStoreValue = CheckboxStoreValue> extends StoreOptions<CheckboxStoreState<T>, "value"> {
|
|
28
29
|
/**
|
|
29
|
-
* The default
|
|
30
|
+
* The default
|
|
31
|
+
* [`value`](https://ariakit.org/reference/checkbox-provider#value) state of
|
|
32
|
+
* the checkbox.
|
|
30
33
|
*
|
|
31
34
|
* Live examples:
|
|
32
35
|
* - [Custom Checkbox](https://ariakit.org/examples/checkbox-custom)
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
var
|
|
5
|
-
require('../__chunks/
|
|
4
|
+
var _YLMJBIQMcjs = require('../__chunks/YLMJBIQM.cjs');
|
|
5
|
+
require('../__chunks/5CBCKBZ2.cjs');
|
|
6
6
|
require('../__chunks/3UT5FE6K.cjs');
|
|
7
7
|
require('../__chunks/5F4DVUNS.cjs');
|
|
8
8
|
require('../__chunks/AV6KTKLE.cjs');
|
|
9
9
|
|
|
10
10
|
|
|
11
|
-
exports.createCollectionStore =
|
|
11
|
+
exports.createCollectionStore = _YLMJBIQMcjs.createCollectionStore;
|
|
@@ -16,16 +16,18 @@ export interface CollectionStoreItem {
|
|
|
16
16
|
}
|
|
17
17
|
export interface CollectionStoreState<T extends CollectionStoreItem = CollectionStoreItem> {
|
|
18
18
|
/**
|
|
19
|
-
* Lists all
|
|
20
|
-
* updated when an item is registered or unregistered
|
|
19
|
+
* Lists all items along with their metadata. This state is automatically
|
|
20
|
+
* updated when an item is registered or unregistered using the
|
|
21
|
+
* [`registerItem`](https://ariakit.org/reference/use-collection-store#registeritem)
|
|
21
22
|
* function.
|
|
22
23
|
*/
|
|
23
24
|
items: T[];
|
|
24
25
|
/**
|
|
25
|
-
* Lists all
|
|
26
|
-
* automatically updated when an item is rendered or
|
|
27
|
-
*
|
|
28
|
-
*
|
|
26
|
+
* Lists all items, along with their metadata, in the exact order they appear in
|
|
27
|
+
* the DOM. This state is automatically updated when an item is rendered or
|
|
28
|
+
* unmounted using the
|
|
29
|
+
* [`renderItem`](https://ariakit.org/reference/use-collection-store#renderitem)
|
|
30
|
+
* function.
|
|
29
31
|
*/
|
|
30
32
|
renderedItems: T[];
|
|
31
33
|
}
|
|
@@ -33,7 +35,6 @@ export interface CollectionStoreFunctions<T extends CollectionStoreItem = Collec
|
|
|
33
35
|
/**
|
|
34
36
|
* Registers an item in the collection. This function returns a cleanup
|
|
35
37
|
* function that unregisters the item.
|
|
36
|
-
* @param item The item to register.
|
|
37
38
|
* @example
|
|
38
39
|
* const unregisterItem = store.registerItem({ id: "item-1" });
|
|
39
40
|
* // on cleanup
|
|
@@ -42,8 +43,7 @@ export interface CollectionStoreFunctions<T extends CollectionStoreItem = Collec
|
|
|
42
43
|
registerItem: BivariantCallback<(item: T) => () => void>;
|
|
43
44
|
/**
|
|
44
45
|
* Renders an item in the collection. This function returns a cleanup function
|
|
45
|
-
* that
|
|
46
|
-
* @param item The item to render.
|
|
46
|
+
* that unmounts the item.
|
|
47
47
|
* @example
|
|
48
48
|
* const unrenderItem = store.renderItem({ id: "item-1" });
|
|
49
49
|
* // on cleanup
|
|
@@ -52,7 +52,6 @@ export interface CollectionStoreFunctions<T extends CollectionStoreItem = Collec
|
|
|
52
52
|
renderItem: BivariantCallback<(item: T) => () => void>;
|
|
53
53
|
/**
|
|
54
54
|
* Gets an item by its id.
|
|
55
|
-
* @param id The id of the item.
|
|
56
55
|
* @example
|
|
57
56
|
* const item = store.item("item-1");
|
|
58
57
|
*/
|
|
@@ -60,7 +59,8 @@ export interface CollectionStoreFunctions<T extends CollectionStoreItem = Collec
|
|
|
60
59
|
}
|
|
61
60
|
export interface CollectionStoreOptions<T extends CollectionStoreItem = CollectionStoreItem> extends StoreOptions<CollectionStoreState<T>, "items"> {
|
|
62
61
|
/**
|
|
63
|
-
* The defaut value for the
|
|
62
|
+
* The defaut value for the
|
|
63
|
+
* [`items`](https://ariakit.org/reference/collection-provider#items) state.
|
|
64
64
|
* @default []
|
|
65
65
|
*/
|
|
66
66
|
defaultItems?: CollectionStoreState<T>["items"];
|
|
@@ -16,16 +16,18 @@ export interface CollectionStoreItem {
|
|
|
16
16
|
}
|
|
17
17
|
export interface CollectionStoreState<T extends CollectionStoreItem = CollectionStoreItem> {
|
|
18
18
|
/**
|
|
19
|
-
* Lists all
|
|
20
|
-
* updated when an item is registered or unregistered
|
|
19
|
+
* Lists all items along with their metadata. This state is automatically
|
|
20
|
+
* updated when an item is registered or unregistered using the
|
|
21
|
+
* [`registerItem`](https://ariakit.org/reference/use-collection-store#registeritem)
|
|
21
22
|
* function.
|
|
22
23
|
*/
|
|
23
24
|
items: T[];
|
|
24
25
|
/**
|
|
25
|
-
* Lists all
|
|
26
|
-
* automatically updated when an item is rendered or
|
|
27
|
-
*
|
|
28
|
-
*
|
|
26
|
+
* Lists all items, along with their metadata, in the exact order they appear in
|
|
27
|
+
* the DOM. This state is automatically updated when an item is rendered or
|
|
28
|
+
* unmounted using the
|
|
29
|
+
* [`renderItem`](https://ariakit.org/reference/use-collection-store#renderitem)
|
|
30
|
+
* function.
|
|
29
31
|
*/
|
|
30
32
|
renderedItems: T[];
|
|
31
33
|
}
|
|
@@ -33,7 +35,6 @@ export interface CollectionStoreFunctions<T extends CollectionStoreItem = Collec
|
|
|
33
35
|
/**
|
|
34
36
|
* Registers an item in the collection. This function returns a cleanup
|
|
35
37
|
* function that unregisters the item.
|
|
36
|
-
* @param item The item to register.
|
|
37
38
|
* @example
|
|
38
39
|
* const unregisterItem = store.registerItem({ id: "item-1" });
|
|
39
40
|
* // on cleanup
|
|
@@ -42,8 +43,7 @@ export interface CollectionStoreFunctions<T extends CollectionStoreItem = Collec
|
|
|
42
43
|
registerItem: BivariantCallback<(item: T) => () => void>;
|
|
43
44
|
/**
|
|
44
45
|
* Renders an item in the collection. This function returns a cleanup function
|
|
45
|
-
* that
|
|
46
|
-
* @param item The item to render.
|
|
46
|
+
* that unmounts the item.
|
|
47
47
|
* @example
|
|
48
48
|
* const unrenderItem = store.renderItem({ id: "item-1" });
|
|
49
49
|
* // on cleanup
|
|
@@ -52,7 +52,6 @@ export interface CollectionStoreFunctions<T extends CollectionStoreItem = Collec
|
|
|
52
52
|
renderItem: BivariantCallback<(item: T) => () => void>;
|
|
53
53
|
/**
|
|
54
54
|
* Gets an item by its id.
|
|
55
|
-
* @param id The id of the item.
|
|
56
55
|
* @example
|
|
57
56
|
* const item = store.item("item-1");
|
|
58
57
|
*/
|
|
@@ -60,7 +59,8 @@ export interface CollectionStoreFunctions<T extends CollectionStoreItem = Collec
|
|
|
60
59
|
}
|
|
61
60
|
export interface CollectionStoreOptions<T extends CollectionStoreItem = CollectionStoreItem> extends StoreOptions<CollectionStoreState<T>, "items"> {
|
|
62
61
|
/**
|
|
63
|
-
* The defaut value for the
|
|
62
|
+
* The defaut value for the
|
|
63
|
+
* [`items`](https://ariakit.org/reference/collection-provider#items) state.
|
|
64
64
|
* @default []
|
|
65
65
|
*/
|
|
66
66
|
defaultItems?: CollectionStoreState<T>["items"];
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
var
|
|
5
|
-
require('../__chunks/
|
|
6
|
-
require('../__chunks/
|
|
4
|
+
var _Y6PHIDP6cjs = require('../__chunks/Y6PHIDP6.cjs');
|
|
5
|
+
require('../__chunks/MFSCSSBJ.cjs');
|
|
6
|
+
require('../__chunks/MWNFQD55.cjs');
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
var
|
|
10
|
-
require('../__chunks/
|
|
9
|
+
var _ZXCB7MXNcjs = require('../__chunks/ZXCB7MXN.cjs');
|
|
10
|
+
require('../__chunks/YLMJBIQM.cjs');
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
|
|
16
16
|
|
|
17
|
-
var
|
|
17
|
+
var _5CBCKBZ2cjs = require('../__chunks/5CBCKBZ2.cjs');
|
|
18
18
|
|
|
19
19
|
|
|
20
20
|
var _3UT5FE6Kcjs = require('../__chunks/3UT5FE6K.cjs');
|
|
@@ -33,7 +33,7 @@ var _AV6KTKLEcjs = require('../__chunks/AV6KTKLE.cjs');
|
|
|
33
33
|
var isSafariOnMobile = _YIUPKKEKcjs.isSafari.call(void 0, ) && _YIUPKKEKcjs.isTouchDevice.call(void 0, );
|
|
34
34
|
function createComboboxStore(props = {}) {
|
|
35
35
|
var _a;
|
|
36
|
-
|
|
36
|
+
_5CBCKBZ2cjs.throwOnConflictingProps.call(void 0, props, props.store);
|
|
37
37
|
const syncState = (_a = props.store) == null ? void 0 : _a.getState();
|
|
38
38
|
const activeId = _3UT5FE6Kcjs.defaultValue.call(void 0,
|
|
39
39
|
props.activeId,
|
|
@@ -41,7 +41,7 @@ function createComboboxStore(props = {}) {
|
|
|
41
41
|
props.defaultActiveId,
|
|
42
42
|
null
|
|
43
43
|
);
|
|
44
|
-
const composite =
|
|
44
|
+
const composite = _ZXCB7MXNcjs.createCompositeStore.call(void 0, _AV6KTKLEcjs.__spreadProps.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, {}, props), {
|
|
45
45
|
activeId,
|
|
46
46
|
includesBaseElement: _3UT5FE6Kcjs.defaultValue.call(void 0,
|
|
47
47
|
props.includesBaseElement,
|
|
@@ -61,7 +61,7 @@ function createComboboxStore(props = {}) {
|
|
|
61
61
|
!isSafariOnMobile
|
|
62
62
|
)
|
|
63
63
|
}));
|
|
64
|
-
const popover =
|
|
64
|
+
const popover = _Y6PHIDP6cjs.createPopoverStore.call(void 0, _AV6KTKLEcjs.__spreadProps.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, {}, props), {
|
|
65
65
|
placement: _3UT5FE6Kcjs.defaultValue.call(void 0,
|
|
66
66
|
props.placement,
|
|
67
67
|
syncState == null ? void 0 : syncState.placement,
|
|
@@ -96,10 +96,10 @@ function createComboboxStore(props = {}) {
|
|
|
96
96
|
),
|
|
97
97
|
activeValue: syncState == null ? void 0 : syncState.activeValue
|
|
98
98
|
});
|
|
99
|
-
const combobox =
|
|
100
|
-
|
|
99
|
+
const combobox = _5CBCKBZ2cjs.createStore.call(void 0, initialState, composite, popover, props.store);
|
|
100
|
+
_5CBCKBZ2cjs.setup.call(void 0,
|
|
101
101
|
combobox,
|
|
102
|
-
() =>
|
|
102
|
+
() => _5CBCKBZ2cjs.sync.call(void 0, combobox, ["resetValueOnHide", "mounted"], (state) => {
|
|
103
103
|
if (!state.resetValueOnHide)
|
|
104
104
|
return;
|
|
105
105
|
if (state.mounted)
|
|
@@ -107,34 +107,34 @@ function createComboboxStore(props = {}) {
|
|
|
107
107
|
combobox.setState("value", value);
|
|
108
108
|
})
|
|
109
109
|
);
|
|
110
|
-
|
|
110
|
+
_5CBCKBZ2cjs.setup.call(void 0,
|
|
111
111
|
combobox,
|
|
112
|
-
() =>
|
|
112
|
+
() => _5CBCKBZ2cjs.sync.call(void 0, combobox, ["resetValueOnSelect", "selectedValue"], (state) => {
|
|
113
113
|
if (!state.resetValueOnSelect)
|
|
114
114
|
return;
|
|
115
115
|
combobox.setState("value", value);
|
|
116
116
|
})
|
|
117
117
|
);
|
|
118
|
-
|
|
118
|
+
_5CBCKBZ2cjs.setup.call(void 0,
|
|
119
119
|
combobox,
|
|
120
|
-
() =>
|
|
120
|
+
() => _5CBCKBZ2cjs.batch.call(void 0, combobox, ["mounted"], (state) => {
|
|
121
121
|
if (state.mounted)
|
|
122
122
|
return;
|
|
123
123
|
combobox.setState("activeId", activeId);
|
|
124
124
|
combobox.setState("moves", 0);
|
|
125
125
|
})
|
|
126
126
|
);
|
|
127
|
-
|
|
127
|
+
_5CBCKBZ2cjs.setup.call(void 0,
|
|
128
128
|
combobox,
|
|
129
|
-
() =>
|
|
129
|
+
() => _5CBCKBZ2cjs.sync.call(void 0, combobox, ["moves", "activeId"], (state, prevState) => {
|
|
130
130
|
if (state.moves === prevState.moves) {
|
|
131
131
|
combobox.setState("activeValue", void 0);
|
|
132
132
|
}
|
|
133
133
|
})
|
|
134
134
|
);
|
|
135
|
-
|
|
135
|
+
_5CBCKBZ2cjs.setup.call(void 0,
|
|
136
136
|
combobox,
|
|
137
|
-
() =>
|
|
137
|
+
() => _5CBCKBZ2cjs.batch.call(void 0, combobox, ["moves", "renderedItems"], (state, prev) => {
|
|
138
138
|
if (state.moves === prev.moves)
|
|
139
139
|
return;
|
|
140
140
|
const { activeId: activeId2 } = combobox.getState();
|
|
@@ -32,7 +32,9 @@ export interface ComboboxStoreState<T extends ComboboxStoreSelectedValue = Combo
|
|
|
32
32
|
*/
|
|
33
33
|
value: string;
|
|
34
34
|
/**
|
|
35
|
-
* The value of the
|
|
35
|
+
* The value of the currently active item. This state automatically updates as
|
|
36
|
+
* the user navigates the combobox items either by keyboard or mouse click.
|
|
37
|
+
* Note that it doesn't update when the user simply hovers over the items.
|
|
36
38
|
*/
|
|
37
39
|
activeValue: string | undefined;
|
|
38
40
|
/**
|
|
@@ -32,7 +32,9 @@ export interface ComboboxStoreState<T extends ComboboxStoreSelectedValue = Combo
|
|
|
32
32
|
*/
|
|
33
33
|
value: string;
|
|
34
34
|
/**
|
|
35
|
-
* The value of the
|
|
35
|
+
* The value of the currently active item. This state automatically updates as
|
|
36
|
+
* the user navigates the combobox items either by keyboard or mouse click.
|
|
37
|
+
* Note that it doesn't update when the user simply hovers over the items.
|
|
36
38
|
*/
|
|
37
39
|
activeValue: string | undefined;
|
|
38
40
|
/**
|