@ariakit/core 0.3.7 → 0.3.9
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 +11 -0
- package/cjs/__chunks/{GZDVJEID.cjs → 2LS4JJ4S.cjs} +2 -2
- package/cjs/__chunks/{46BH65MC.cjs → 2UK5WUJX.cjs} +15 -7
- package/cjs/__chunks/{PD7XZBXC.cjs → 5SIVMOID.cjs} +4 -4
- package/cjs/__chunks/{7ZUFMSXJ.cjs → EFIT5L4X.cjs} +7 -7
- package/cjs/__chunks/{MEHGRTJ3.cjs → GJFZ5ZPP.cjs} +11 -11
- package/cjs/__chunks/{6WBY3ZZM.cjs → JNFZSNOI.cjs} +6 -6
- package/cjs/__chunks/{JLC5A6WF.cjs → UCLKUBNP.cjs} +35 -25
- package/cjs/__chunks/{GXIZMD53.cjs → UTICNXST.cjs} +4 -4
- package/cjs/checkbox/checkbox-store.cjs +3 -3
- package/cjs/checkbox/checkbox-store.d.cts +9 -9
- package/cjs/checkbox/checkbox-store.d.ts +9 -9
- package/cjs/collection/collection-store.cjs +3 -3
- package/cjs/collection/collection-store.d.cts +16 -12
- package/cjs/collection/collection-store.d.ts +16 -12
- package/cjs/combobox/combobox-store.cjs +20 -20
- package/cjs/combobox/combobox-store.d.cts +14 -14
- package/cjs/combobox/combobox-store.d.ts +14 -14
- package/cjs/composite/composite-overflow-store.cjs +5 -5
- package/cjs/composite/composite-overflow-store.d.cts +13 -7
- package/cjs/composite/composite-overflow-store.d.ts +13 -7
- package/cjs/composite/composite-store.cjs +4 -4
- package/cjs/composite/composite-store.d.cts +31 -14
- package/cjs/composite/composite-store.d.ts +31 -14
- package/cjs/dialog/dialog-store.cjs +4 -4
- package/cjs/dialog/dialog-store.d.cts +12 -6
- package/cjs/dialog/dialog-store.d.ts +12 -6
- package/cjs/disclosure/disclosure-store.cjs +3 -3
- package/cjs/disclosure/disclosure-store.d.cts +4 -2
- package/cjs/disclosure/disclosure-store.d.ts +4 -2
- package/cjs/form/form-store.cjs +7 -7
- package/cjs/form/form-store.d.cts +15 -15
- package/cjs/form/form-store.d.ts +15 -15
- package/cjs/hovercard/hovercard-store.cjs +6 -6
- package/cjs/hovercard/hovercard-store.d.cts +11 -5
- package/cjs/hovercard/hovercard-store.d.ts +11 -5
- package/cjs/menu/menu-bar-store.cjs +5 -5
- package/cjs/menu/menu-bar-store.d.cts +12 -6
- package/cjs/menu/menu-bar-store.d.ts +12 -6
- package/cjs/menu/menu-store.cjs +18 -18
- package/cjs/menu/menu-store.d.cts +20 -10
- package/cjs/menu/menu-store.d.ts +20 -10
- package/cjs/menubar/menubar-store.cjs +5 -5
- package/cjs/menubar/menubar-store.d.cts +1 -1
- package/cjs/menubar/menubar-store.d.ts +1 -1
- package/cjs/popover/popover-store.cjs +5 -5
- package/cjs/popover/popover-store.d.cts +7 -3
- package/cjs/popover/popover-store.d.ts +7 -3
- package/cjs/radio/radio-store.cjs +5 -5
- package/cjs/radio/radio-store.d.cts +5 -3
- package/cjs/radio/radio-store.d.ts +5 -3
- package/cjs/select/select-store.cjs +18 -18
- package/cjs/select/select-store.d.cts +14 -16
- package/cjs/select/select-store.d.ts +14 -16
- package/cjs/tab/tab-store.cjs +15 -15
- package/cjs/tab/tab-store.d.cts +15 -16
- package/cjs/tab/tab-store.d.ts +15 -16
- package/cjs/toolbar/toolbar-store.cjs +4 -4
- package/cjs/toolbar/toolbar-store.d.cts +9 -6
- package/cjs/toolbar/toolbar-store.d.ts +9 -6
- package/cjs/tooltip/tooltip-store.cjs +7 -7
- package/cjs/tooltip/tooltip-store.d.cts +5 -3
- package/cjs/tooltip/tooltip-store.d.ts +5 -3
- package/cjs/utils/store.cjs +2 -2
- package/esm/__chunks/{E7OQVGGY.js → A2J4XZ5T.js} +15 -7
- package/esm/__chunks/{OGMLJYDV.js → DLX2AS6C.js} +2 -2
- package/esm/__chunks/{ANO6WJO4.js → EZ2TTBAQ.js} +2 -2
- package/esm/__chunks/{WY3EMTH6.js → J6JIOWCS.js} +2 -2
- package/esm/__chunks/{CL47ZAPY.js → LT2OYWRD.js} +1 -1
- package/esm/__chunks/{DYD4YNLE.js → NKLTHWCR.js} +1 -1
- package/esm/__chunks/{BXH3I7ML.js → T3DVYGXI.js} +2 -2
- package/esm/__chunks/{CCU5UHQ2.js → TLN4ALYH.js} +32 -22
- package/esm/checkbox/checkbox-store.d.ts +9 -9
- package/esm/checkbox/checkbox-store.js +1 -1
- package/esm/collection/collection-store.d.ts +16 -12
- package/esm/collection/collection-store.js +2 -2
- package/esm/combobox/combobox-store.d.ts +14 -14
- package/esm/combobox/combobox-store.js +6 -6
- package/esm/composite/composite-overflow-store.d.ts +13 -7
- package/esm/composite/composite-overflow-store.js +4 -4
- package/esm/composite/composite-store.d.ts +31 -14
- package/esm/composite/composite-store.js +3 -3
- package/esm/dialog/dialog-store.d.ts +12 -6
- package/esm/dialog/dialog-store.js +3 -3
- package/esm/disclosure/disclosure-store.d.ts +4 -2
- package/esm/disclosure/disclosure-store.js +2 -2
- package/esm/form/form-store.d.ts +15 -15
- package/esm/form/form-store.js +2 -2
- package/esm/hovercard/hovercard-store.d.ts +11 -5
- package/esm/hovercard/hovercard-store.js +5 -5
- package/esm/menu/menu-bar-store.d.ts +12 -6
- package/esm/menu/menu-bar-store.js +4 -4
- package/esm/menu/menu-store.d.ts +20 -10
- package/esm/menu/menu-store.js +7 -7
- package/esm/menubar/menubar-store.d.ts +1 -1
- package/esm/menubar/menubar-store.js +4 -4
- package/esm/popover/popover-store.d.ts +7 -3
- package/esm/popover/popover-store.js +4 -4
- package/esm/radio/radio-store.d.ts +5 -3
- package/esm/radio/radio-store.js +3 -3
- package/esm/select/select-store.d.ts +14 -16
- package/esm/select/select-store.js +6 -6
- package/esm/tab/tab-store.d.ts +15 -16
- package/esm/tab/tab-store.js +3 -3
- package/esm/toolbar/toolbar-store.d.ts +9 -6
- package/esm/toolbar/toolbar-store.js +3 -3
- package/esm/tooltip/tooltip-store.d.ts +5 -3
- package/esm/tooltip/tooltip-store.js +5 -5
- package/esm/utils/store.js +1 -1
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type { StoreOptions } from "../utils/store.js";
|
|
1
|
+
import type { CompositeStoreFunctions, CompositeStoreOptions, CompositeStoreState } from "../composite/composite-store.js";
|
|
2
|
+
import type { Store, StoreOptions, StoreProps } from "../utils/store.js";
|
|
3
3
|
/**
|
|
4
4
|
* Creates a toolbar store.
|
|
5
5
|
*/
|
|
@@ -14,8 +14,11 @@ export interface ToolbarStoreState extends CompositeStoreState {
|
|
|
14
14
|
*/
|
|
15
15
|
focusLoop: CompositeStoreState["focusLoop"];
|
|
16
16
|
}
|
|
17
|
-
export
|
|
18
|
-
|
|
17
|
+
export interface ToolbarStoreFunctions extends CompositeStoreFunctions {
|
|
18
|
+
}
|
|
19
|
+
export interface ToolbarStoreOptions extends CompositeStoreOptions, StoreOptions<ToolbarStoreState, "orientation" | "focusLoop"> {
|
|
20
|
+
}
|
|
21
|
+
export interface ToolbarStoreProps extends ToolbarStoreOptions, StoreProps<ToolbarStoreState> {
|
|
22
|
+
}
|
|
23
|
+
export interface ToolbarStore extends ToolbarStoreFunctions, Store<ToolbarStoreState> {
|
|
19
24
|
}
|
|
20
|
-
export type ToolbarStore = CompositeStore;
|
|
21
|
-
export type ToolbarStoreProps = CompositeStoreProps;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
var
|
|
5
|
-
require('../__chunks/
|
|
6
|
-
require('../__chunks/
|
|
7
|
-
require('../__chunks/
|
|
4
|
+
var _5SIVMOIDcjs = require('../__chunks/5SIVMOID.cjs');
|
|
5
|
+
require('../__chunks/EFIT5L4X.cjs');
|
|
6
|
+
require('../__chunks/2LS4JJ4S.cjs');
|
|
7
|
+
require('../__chunks/GJFZ5ZPP.cjs');
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
var
|
|
10
|
+
var _2UK5WUJXcjs = require('../__chunks/2UK5WUJX.cjs');
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
var _3UT5FE6Kcjs = require('../__chunks/3UT5FE6K.cjs');
|
|
@@ -20,7 +20,7 @@ var _AV6KTKLEcjs = require('../__chunks/AV6KTKLE.cjs');
|
|
|
20
20
|
function createTooltipStore(props = {}) {
|
|
21
21
|
var _a;
|
|
22
22
|
const syncState = (_a = props.store) == null ? void 0 : _a.getState();
|
|
23
|
-
const hovercard =
|
|
23
|
+
const hovercard = _5SIVMOIDcjs.createHovercardStore.call(void 0, _AV6KTKLEcjs.__spreadProps.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, {}, props), {
|
|
24
24
|
placement: _3UT5FE6Kcjs.defaultValue.call(void 0,
|
|
25
25
|
props.placement,
|
|
26
26
|
syncState == null ? void 0 : syncState.placement,
|
|
@@ -32,7 +32,7 @@ function createTooltipStore(props = {}) {
|
|
|
32
32
|
type: _3UT5FE6Kcjs.defaultValue.call(void 0, props.type, syncState == null ? void 0 : syncState.type, "description"),
|
|
33
33
|
skipTimeout: _3UT5FE6Kcjs.defaultValue.call(void 0, props.skipTimeout, syncState == null ? void 0 : syncState.skipTimeout, 300)
|
|
34
34
|
});
|
|
35
|
-
const tooltip =
|
|
35
|
+
const tooltip = _2UK5WUJXcjs.createStore.call(void 0, initialState, hovercard, props.store);
|
|
36
36
|
return _AV6KTKLEcjs.__spreadValues.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, {}, hovercard), tooltip);
|
|
37
37
|
}
|
|
38
38
|
|
|
@@ -23,7 +23,9 @@ export interface TooltipStoreState extends HovercardStoreState {
|
|
|
23
23
|
hideTimeout?: HovercardStoreState["hideTimeout"];
|
|
24
24
|
}
|
|
25
25
|
export type TooltipStoreFunctions = HovercardStoreFunctions;
|
|
26
|
-
export interface TooltipStoreOptions extends StoreOptions<TooltipStoreState, "type" | "placement" | "timeout" | "showTimeout" | "hideTimeout" | "skipTimeout"
|
|
26
|
+
export interface TooltipStoreOptions extends HovercardStoreOptions, StoreOptions<TooltipStoreState, "type" | "placement" | "timeout" | "showTimeout" | "hideTimeout" | "skipTimeout"> {
|
|
27
|
+
}
|
|
28
|
+
export interface TooltipStoreProps extends TooltipStoreOptions, StoreProps<TooltipStoreState> {
|
|
29
|
+
}
|
|
30
|
+
export interface TooltipStore extends TooltipStoreFunctions, Store<TooltipStoreState> {
|
|
27
31
|
}
|
|
28
|
-
export type TooltipStoreProps = TooltipStoreOptions & StoreProps<TooltipStoreState>;
|
|
29
|
-
export type TooltipStore = TooltipStoreFunctions & Store<TooltipStoreState>;
|
|
@@ -23,7 +23,9 @@ export interface TooltipStoreState extends HovercardStoreState {
|
|
|
23
23
|
hideTimeout?: HovercardStoreState["hideTimeout"];
|
|
24
24
|
}
|
|
25
25
|
export type TooltipStoreFunctions = HovercardStoreFunctions;
|
|
26
|
-
export interface TooltipStoreOptions extends StoreOptions<TooltipStoreState, "type" | "placement" | "timeout" | "showTimeout" | "hideTimeout" | "skipTimeout"
|
|
26
|
+
export interface TooltipStoreOptions extends HovercardStoreOptions, StoreOptions<TooltipStoreState, "type" | "placement" | "timeout" | "showTimeout" | "hideTimeout" | "skipTimeout"> {
|
|
27
|
+
}
|
|
28
|
+
export interface TooltipStoreProps extends TooltipStoreOptions, StoreProps<TooltipStoreState> {
|
|
29
|
+
}
|
|
30
|
+
export interface TooltipStore extends TooltipStoreFunctions, Store<TooltipStoreState> {
|
|
27
31
|
}
|
|
28
|
-
export type TooltipStoreProps = TooltipStoreOptions & StoreProps<TooltipStoreState>;
|
|
29
|
-
export type TooltipStore = TooltipStoreFunctions & Store<TooltipStoreState>;
|
package/cjs/utils/store.cjs
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
|
|
13
|
-
var
|
|
13
|
+
var _2UK5WUJXcjs = require('../__chunks/2UK5WUJX.cjs');
|
|
14
14
|
require('../__chunks/3UT5FE6K.cjs');
|
|
15
15
|
require('../__chunks/AV6KTKLE.cjs');
|
|
16
16
|
|
|
@@ -24,4 +24,4 @@ require('../__chunks/AV6KTKLE.cjs');
|
|
|
24
24
|
|
|
25
25
|
|
|
26
26
|
|
|
27
|
-
exports.batch =
|
|
27
|
+
exports.batch = _2UK5WUJXcjs.batch; exports.createStore = _2UK5WUJXcjs.createStore; exports.init = _2UK5WUJXcjs.init; exports.mergeStore = _2UK5WUJXcjs.mergeStore; exports.omit = _2UK5WUJXcjs.omit; exports.pick = _2UK5WUJXcjs.pick; exports.setup = _2UK5WUJXcjs.setup; exports.subscribe = _2UK5WUJXcjs.subscribe; exports.sync = _2UK5WUJXcjs.sync; exports.throwOnConflictingProps = _2UK5WUJXcjs.throwOnConflictingProps;
|
|
@@ -24,7 +24,8 @@ function createStore(initialState, ...stores) {
|
|
|
24
24
|
let state = initialState;
|
|
25
25
|
let prevStateBatch = state;
|
|
26
26
|
let lastUpdate = Symbol();
|
|
27
|
-
let
|
|
27
|
+
let destroy = noop;
|
|
28
|
+
const instances = /* @__PURE__ */ new Set();
|
|
28
29
|
const updatedKeys = /* @__PURE__ */ new Set();
|
|
29
30
|
const setups = /* @__PURE__ */ new Set();
|
|
30
31
|
const listeners = /* @__PURE__ */ new Set();
|
|
@@ -36,11 +37,19 @@ function createStore(initialState, ...stores) {
|
|
|
36
37
|
return () => setups.delete(callback);
|
|
37
38
|
};
|
|
38
39
|
const storeInit = () => {
|
|
39
|
-
if (initialized)
|
|
40
|
-
return noop;
|
|
41
40
|
if (!stores.length)
|
|
42
41
|
return noop;
|
|
43
|
-
initialized =
|
|
42
|
+
const initialized = instances.size;
|
|
43
|
+
const instance = Symbol();
|
|
44
|
+
instances.add(instance);
|
|
45
|
+
const maybeDestroy = () => {
|
|
46
|
+
instances.delete(instance);
|
|
47
|
+
if (instances.size)
|
|
48
|
+
return;
|
|
49
|
+
destroy();
|
|
50
|
+
};
|
|
51
|
+
if (initialized)
|
|
52
|
+
return maybeDestroy;
|
|
44
53
|
const desyncs = getKeys(state).map(
|
|
45
54
|
(key) => chain(
|
|
46
55
|
...stores.map((store) => {
|
|
@@ -65,9 +74,8 @@ function createStore(initialState, ...stores) {
|
|
|
65
74
|
const teardowns = [];
|
|
66
75
|
setups.forEach((setup2) => teardowns.push(setup2()));
|
|
67
76
|
const cleanups = stores.map(init);
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
});
|
|
77
|
+
destroy = chain(...desyncs, ...teardowns, ...cleanups);
|
|
78
|
+
return maybeDestroy;
|
|
71
79
|
};
|
|
72
80
|
const sub = (keys, listener, set = listeners) => {
|
|
73
81
|
set.add(listener);
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
3
|
createCollectionStore
|
|
4
|
-
} from "./
|
|
4
|
+
} from "./TLN4ALYH.js";
|
|
5
5
|
import {
|
|
6
6
|
createStore,
|
|
7
7
|
setup,
|
|
8
8
|
sync
|
|
9
|
-
} from "./
|
|
9
|
+
} from "./A2J4XZ5T.js";
|
|
10
10
|
import {
|
|
11
11
|
defaultValue
|
|
12
12
|
} from "./I2VQ3XGR.js";
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
3
|
createDialogStore
|
|
4
|
-
} from "./
|
|
4
|
+
} from "./LT2OYWRD.js";
|
|
5
5
|
import {
|
|
6
6
|
createStore,
|
|
7
7
|
mergeStore,
|
|
8
8
|
omit,
|
|
9
9
|
throwOnConflictingProps
|
|
10
|
-
} from "./
|
|
10
|
+
} from "./A2J4XZ5T.js";
|
|
11
11
|
import {
|
|
12
12
|
defaultValue
|
|
13
13
|
} from "./I2VQ3XGR.js";
|
|
@@ -2,9 +2,10 @@
|
|
|
2
2
|
import {
|
|
3
3
|
batch,
|
|
4
4
|
createStore,
|
|
5
|
+
init,
|
|
5
6
|
setup,
|
|
6
7
|
throwOnConflictingProps
|
|
7
|
-
} from "./
|
|
8
|
+
} from "./A2J4XZ5T.js";
|
|
8
9
|
import {
|
|
9
10
|
chain,
|
|
10
11
|
defaultValue
|
|
@@ -63,6 +64,9 @@ function getCommonParent(items) {
|
|
|
63
64
|
}
|
|
64
65
|
return getDocument(parentElement).body;
|
|
65
66
|
}
|
|
67
|
+
function getPrivateStore(store) {
|
|
68
|
+
return store == null ? void 0 : store.__unstablePrivateStore;
|
|
69
|
+
}
|
|
66
70
|
function createCollectionStore(props = {}) {
|
|
67
71
|
var _a;
|
|
68
72
|
throwOnConflictingProps(props, props.store);
|
|
@@ -78,37 +82,41 @@ function createCollectionStore(props = {}) {
|
|
|
78
82
|
items,
|
|
79
83
|
renderedItems: defaultValue(syncState == null ? void 0 : syncState.renderedItems, [])
|
|
80
84
|
};
|
|
81
|
-
const
|
|
82
|
-
|
|
83
|
-
|
|
85
|
+
const syncPrivateStore = getPrivateStore(props.store);
|
|
86
|
+
const privateStore = createStore(
|
|
87
|
+
{ renderedItems: initialState.renderedItems },
|
|
88
|
+
syncPrivateStore
|
|
89
|
+
);
|
|
84
90
|
const collection = createStore(initialState, props.store);
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
const renderedItems = sortBasedOnDOMPosition(state.renderedItems);
|
|
88
|
-
privateStore.setState("renderedItems", renderedItems);
|
|
89
|
-
collection.setState("renderedItems", renderedItems);
|
|
90
|
-
};
|
|
91
|
-
setup(collection, () => {
|
|
91
|
+
setup(collection, () => init(privateStore));
|
|
92
|
+
setup(privateStore, () => {
|
|
92
93
|
return batch(privateStore, ["renderedItems"], (state) => {
|
|
93
94
|
let firstRun = true;
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
95
|
+
const raf = requestAnimationFrame(() => {
|
|
96
|
+
const { renderedItems } = collection.getState();
|
|
97
|
+
if (state.renderedItems === renderedItems)
|
|
98
|
+
return;
|
|
99
|
+
const sortedItems = sortBasedOnDOMPosition(state.renderedItems);
|
|
100
|
+
privateStore.setState("renderedItems", sortedItems);
|
|
101
|
+
collection.setState("renderedItems", sortedItems);
|
|
102
|
+
});
|
|
103
|
+
if (typeof IntersectionObserver !== "function") {
|
|
104
|
+
return () => cancelAnimationFrame(raf);
|
|
105
|
+
}
|
|
106
|
+
const ioCallback = () => {
|
|
98
107
|
if (firstRun) {
|
|
99
108
|
firstRun = false;
|
|
100
109
|
return;
|
|
101
110
|
}
|
|
102
|
-
|
|
103
|
-
raf = requestAnimationFrame(sortItems);
|
|
111
|
+
privateStore.setState("renderedItems", [...state.renderedItems]);
|
|
104
112
|
};
|
|
105
113
|
const root = getCommonParent(state.renderedItems);
|
|
106
|
-
const observer = new IntersectionObserver(
|
|
107
|
-
state.renderedItems
|
|
114
|
+
const observer = new IntersectionObserver(ioCallback, { root });
|
|
115
|
+
for (const item of state.renderedItems) {
|
|
108
116
|
if (!item.element)
|
|
109
|
-
|
|
117
|
+
continue;
|
|
110
118
|
observer.observe(item.element);
|
|
111
|
-
}
|
|
119
|
+
}
|
|
112
120
|
return () => {
|
|
113
121
|
cancelAnimationFrame(raf);
|
|
114
122
|
observer.disconnect();
|
|
@@ -172,7 +180,9 @@ function createCollectionStore(props = {}) {
|
|
|
172
180
|
}
|
|
173
181
|
}
|
|
174
182
|
return item || null;
|
|
175
|
-
}
|
|
183
|
+
},
|
|
184
|
+
// @ts-expect-error Internal
|
|
185
|
+
__unstablePrivateStore: privateStore
|
|
176
186
|
});
|
|
177
187
|
}
|
|
178
188
|
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import type { Store, StoreOptions, StoreProps } from "../utils/store.js";
|
|
2
2
|
import type { PickRequired, SetState, ToPrimitive } from "../utils/types.js";
|
|
3
|
-
type Value = boolean | string | number | Array<string | number>;
|
|
4
3
|
/**
|
|
5
4
|
* Creates a checkbox store.
|
|
6
5
|
*/
|
|
7
|
-
export declare function createCheckboxStore<T extends
|
|
6
|
+
export declare function createCheckboxStore<T extends CheckboxStoreValue = CheckboxStoreValue>(props: PickRequired<CheckboxStoreProps<T>, "value" | "defaultValue">): CheckboxStore<T>;
|
|
8
7
|
export declare function createCheckboxStore(props?: CheckboxStoreProps): CheckboxStore;
|
|
9
|
-
export type CheckboxStoreValue =
|
|
10
|
-
export interface CheckboxStoreState<T extends
|
|
8
|
+
export type CheckboxStoreValue = boolean | string | number | Array<string | number>;
|
|
9
|
+
export interface CheckboxStoreState<T extends CheckboxStoreValue = CheckboxStoreValue> {
|
|
11
10
|
/**
|
|
12
11
|
* The checked state of the checkbox.
|
|
13
12
|
*
|
|
@@ -16,7 +15,7 @@ export interface CheckboxStoreState<T extends Value = Value> {
|
|
|
16
15
|
*/
|
|
17
16
|
value: ToPrimitive<T>;
|
|
18
17
|
}
|
|
19
|
-
export interface CheckboxStoreFunctions<T extends
|
|
18
|
+
export interface CheckboxStoreFunctions<T extends CheckboxStoreValue = CheckboxStoreValue> {
|
|
20
19
|
/**
|
|
21
20
|
* Sets the `value` state.
|
|
22
21
|
* @example
|
|
@@ -25,7 +24,7 @@ export interface CheckboxStoreFunctions<T extends Value = Value> {
|
|
|
25
24
|
*/
|
|
26
25
|
setValue: SetState<CheckboxStoreState<T>["value"]>;
|
|
27
26
|
}
|
|
28
|
-
export interface CheckboxStoreOptions<T extends
|
|
27
|
+
export interface CheckboxStoreOptions<T extends CheckboxStoreValue = CheckboxStoreValue> extends StoreOptions<CheckboxStoreState<T>, "value"> {
|
|
29
28
|
/**
|
|
30
29
|
* The default value of the checkbox.
|
|
31
30
|
*
|
|
@@ -36,6 +35,7 @@ export interface CheckboxStoreOptions<T extends Value = Value> extends StoreOpti
|
|
|
36
35
|
*/
|
|
37
36
|
defaultValue?: CheckboxStoreState<T>["value"];
|
|
38
37
|
}
|
|
39
|
-
export
|
|
40
|
-
|
|
41
|
-
export {
|
|
38
|
+
export interface CheckboxStoreProps<T extends CheckboxStoreValue = CheckboxStoreValue> extends CheckboxStoreOptions<T>, StoreProps<CheckboxStoreState<T>> {
|
|
39
|
+
}
|
|
40
|
+
export interface CheckboxStore<T extends CheckboxStoreValue = CheckboxStoreValue> extends CheckboxStoreFunctions<T>, Store<CheckboxStoreState<T>> {
|
|
41
|
+
}
|
|
@@ -1,15 +1,20 @@
|
|
|
1
1
|
import type { Store, StoreOptions, StoreProps } from "../utils/store.js";
|
|
2
2
|
import type { BivariantCallback } from "../utils/types.js";
|
|
3
|
-
interface Item {
|
|
4
|
-
id: string;
|
|
5
|
-
element?: HTMLElement | null;
|
|
6
|
-
}
|
|
7
3
|
/**
|
|
8
4
|
* Creates a collection store.
|
|
9
5
|
*/
|
|
10
|
-
export declare function createCollectionStore<T extends
|
|
11
|
-
export
|
|
12
|
-
|
|
6
|
+
export declare function createCollectionStore<T extends CollectionStoreItem = CollectionStoreItem>(props?: CollectionStoreProps<T>): CollectionStore<T>;
|
|
7
|
+
export interface CollectionStoreItem {
|
|
8
|
+
/**
|
|
9
|
+
* The id of the item.
|
|
10
|
+
*/
|
|
11
|
+
id: string;
|
|
12
|
+
/**
|
|
13
|
+
* The item HTML element. This is automatically set when the item is rendered.
|
|
14
|
+
*/
|
|
15
|
+
element?: HTMLElement | null;
|
|
16
|
+
}
|
|
17
|
+
export interface CollectionStoreState<T extends CollectionStoreItem = CollectionStoreItem> {
|
|
13
18
|
/**
|
|
14
19
|
* Lists all the items with their meta data. This state is automatically
|
|
15
20
|
* updated when an item is registered or unregistered with the `registerItem`
|
|
@@ -24,7 +29,7 @@ export interface CollectionStoreState<T extends Item = Item> {
|
|
|
24
29
|
*/
|
|
25
30
|
renderedItems: T[];
|
|
26
31
|
}
|
|
27
|
-
export interface CollectionStoreFunctions<T extends
|
|
32
|
+
export interface CollectionStoreFunctions<T extends CollectionStoreItem = CollectionStoreItem> {
|
|
28
33
|
/**
|
|
29
34
|
* Registers an item in the collection. This function returns a cleanup
|
|
30
35
|
* function that unregisters the item.
|
|
@@ -53,15 +58,14 @@ export interface CollectionStoreFunctions<T extends Item = Item> {
|
|
|
53
58
|
*/
|
|
54
59
|
item: (id: string | null | undefined) => T | null;
|
|
55
60
|
}
|
|
56
|
-
export interface CollectionStoreOptions<T extends
|
|
61
|
+
export interface CollectionStoreOptions<T extends CollectionStoreItem = CollectionStoreItem> extends StoreOptions<CollectionStoreState<T>, "items"> {
|
|
57
62
|
/**
|
|
58
63
|
* The defaut value for the `items` state.
|
|
59
64
|
* @default []
|
|
60
65
|
*/
|
|
61
66
|
defaultItems?: CollectionStoreState<T>["items"];
|
|
62
67
|
}
|
|
63
|
-
export interface CollectionStoreProps<T extends
|
|
68
|
+
export interface CollectionStoreProps<T extends CollectionStoreItem = CollectionStoreItem> extends CollectionStoreOptions<T>, StoreProps<CollectionStoreState<T>> {
|
|
64
69
|
}
|
|
65
|
-
export interface CollectionStore<T extends
|
|
70
|
+
export interface CollectionStore<T extends CollectionStoreItem = CollectionStoreItem> extends CollectionStoreFunctions<T>, Store<CollectionStoreState<T>> {
|
|
66
71
|
}
|
|
67
|
-
export {};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
3
|
createCollectionStore
|
|
4
|
-
} from "../__chunks/
|
|
5
|
-
import "../__chunks/
|
|
4
|
+
} from "../__chunks/TLN4ALYH.js";
|
|
5
|
+
import "../__chunks/A2J4XZ5T.js";
|
|
6
6
|
import "../__chunks/I2VQ3XGR.js";
|
|
7
7
|
import "../__chunks/DLOEKDPY.js";
|
|
8
8
|
import "../__chunks/4R3V3JGP.js";
|
|
@@ -2,19 +2,17 @@ import type { CompositeStoreFunctions, CompositeStoreItem, CompositeStoreOptions
|
|
|
2
2
|
import type { PopoverStoreFunctions, PopoverStoreOptions, PopoverStoreState } from "../popover/popover-store.js";
|
|
3
3
|
import type { Store, StoreOptions, StoreProps } from "../utils/store.js";
|
|
4
4
|
import type { PickRequired, SetState } from "../utils/types.js";
|
|
5
|
-
type
|
|
6
|
-
type MutableValue<T extends Value = Value> = T extends string ? string : T;
|
|
7
|
-
interface Item extends CompositeStoreItem {
|
|
8
|
-
value?: string;
|
|
9
|
-
}
|
|
5
|
+
type MutableValue<T extends ComboboxStoreSelectedValue = ComboboxStoreSelectedValue> = T extends string ? string : T;
|
|
10
6
|
/**
|
|
11
7
|
* Creates a combobox store.
|
|
12
8
|
*/
|
|
13
|
-
export declare function createComboboxStore<T extends
|
|
9
|
+
export declare function createComboboxStore<T extends ComboboxStoreSelectedValue = ComboboxStoreSelectedValue>(props: PickRequired<ComboboxStoreProps<T>, "selectedValue" | "defaultSelectedValue">): ComboboxStore<T>;
|
|
14
10
|
export declare function createComboboxStore(props?: ComboboxStoreProps): ComboboxStore;
|
|
15
|
-
export type
|
|
16
|
-
export
|
|
17
|
-
|
|
11
|
+
export type ComboboxStoreSelectedValue = string | string[];
|
|
12
|
+
export interface ComboboxStoreItem extends CompositeStoreItem {
|
|
13
|
+
value?: string;
|
|
14
|
+
}
|
|
15
|
+
export interface ComboboxStoreState<T extends ComboboxStoreSelectedValue = ComboboxStoreSelectedValue> extends CompositeStoreState<ComboboxStoreItem>, PopoverStoreState {
|
|
18
16
|
/**
|
|
19
17
|
* @default true
|
|
20
18
|
*/
|
|
@@ -61,6 +59,8 @@ export interface ComboboxStoreState<T extends Value = Value> extends CompositeSt
|
|
|
61
59
|
* Combobox](https://ariakit.org/examples/combobox-multiple)
|
|
62
60
|
* - [Menu with Combobox](https://ariakit.org/examples/menu-combobox)
|
|
63
61
|
* - [Select with Combobox](https://ariakit.org/examples/select-combobox)
|
|
62
|
+
* - [Submenu with
|
|
63
|
+
* Combobox](https://ariakit.org/examples/menu-nested-combobox)
|
|
64
64
|
*/
|
|
65
65
|
resetValueOnHide: boolean;
|
|
66
66
|
/**
|
|
@@ -78,7 +78,7 @@ export interface ComboboxStoreState<T extends Value = Value> extends CompositeSt
|
|
|
78
78
|
*/
|
|
79
79
|
resetValueOnSelect: boolean;
|
|
80
80
|
}
|
|
81
|
-
export interface ComboboxStoreFunctions<T extends
|
|
81
|
+
export interface ComboboxStoreFunctions<T extends ComboboxStoreSelectedValue = ComboboxStoreSelectedValue> extends CompositeStoreFunctions<ComboboxStoreItem>, PopoverStoreFunctions {
|
|
82
82
|
/**
|
|
83
83
|
* Sets the [`value`](https://ariakit.org/reference/combobox-provider#value)
|
|
84
84
|
* state.
|
|
@@ -98,11 +98,11 @@ export interface ComboboxStoreFunctions<T extends Value = Value> extends Composi
|
|
|
98
98
|
*/
|
|
99
99
|
setSelectedValue: SetState<ComboboxStoreState<T>["selectedValue"]>;
|
|
100
100
|
}
|
|
101
|
-
export interface ComboboxStoreOptions<T extends
|
|
101
|
+
export interface ComboboxStoreOptions<T extends ComboboxStoreSelectedValue = ComboboxStoreSelectedValue> extends CompositeStoreOptions<ComboboxStoreItem>, PopoverStoreOptions, StoreOptions<ComboboxStoreState<T>, "includesBaseElement" | "value" | "selectedValue" | "resetValueOnHide" | "resetValueOnSelect"> {
|
|
102
102
|
/**
|
|
103
103
|
* @default null
|
|
104
104
|
*/
|
|
105
|
-
defaultActiveId?: CompositeStoreOptions<
|
|
105
|
+
defaultActiveId?: CompositeStoreOptions<ComboboxStoreItem>["activeId"];
|
|
106
106
|
/**
|
|
107
107
|
* The initial value of the combobox input.
|
|
108
108
|
* @default ""
|
|
@@ -118,8 +118,8 @@ export interface ComboboxStoreOptions<T extends Value = Value> extends StoreOpti
|
|
|
118
118
|
*/
|
|
119
119
|
defaultSelectedValue?: ComboboxStoreState<T>["selectedValue"];
|
|
120
120
|
}
|
|
121
|
-
export interface ComboboxStoreProps<T extends
|
|
121
|
+
export interface ComboboxStoreProps<T extends ComboboxStoreSelectedValue = ComboboxStoreSelectedValue> extends ComboboxStoreOptions<T>, StoreProps<ComboboxStoreState<T>> {
|
|
122
122
|
}
|
|
123
|
-
export interface ComboboxStore<T extends
|
|
123
|
+
export interface ComboboxStore<T extends ComboboxStoreSelectedValue = ComboboxStoreSelectedValue> extends ComboboxStoreFunctions<T>, Store<ComboboxStoreState<T>> {
|
|
124
124
|
}
|
|
125
125
|
export {};
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
3
|
createPopoverStore
|
|
4
|
-
} from "../__chunks/
|
|
5
|
-
import "../__chunks/
|
|
6
|
-
import "../__chunks/
|
|
4
|
+
} from "../__chunks/J6JIOWCS.js";
|
|
5
|
+
import "../__chunks/LT2OYWRD.js";
|
|
6
|
+
import "../__chunks/NKLTHWCR.js";
|
|
7
7
|
import {
|
|
8
8
|
createCompositeStore
|
|
9
|
-
} from "../__chunks/
|
|
10
|
-
import "../__chunks/
|
|
9
|
+
} from "../__chunks/DLX2AS6C.js";
|
|
10
|
+
import "../__chunks/TLN4ALYH.js";
|
|
11
11
|
import {
|
|
12
12
|
batch,
|
|
13
13
|
createStore,
|
|
14
14
|
setup,
|
|
15
15
|
sync,
|
|
16
16
|
throwOnConflictingProps
|
|
17
|
-
} from "../__chunks/
|
|
17
|
+
} from "../__chunks/A2J4XZ5T.js";
|
|
18
18
|
import {
|
|
19
19
|
defaultValue
|
|
20
20
|
} from "../__chunks/I2VQ3XGR.js";
|
|
@@ -1,10 +1,16 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { PopoverStoreFunctions, PopoverStoreOptions, PopoverStoreState } from "../popover/popover-store.js";
|
|
2
|
+
import type { Store, StoreProps } from "../utils/store.js";
|
|
2
3
|
/**
|
|
3
|
-
* Creates a
|
|
4
|
+
* Creates a compositeOverflow store.
|
|
4
5
|
*/
|
|
5
6
|
export declare function createCompositeOverflowStore(props?: CompositeOverflowStoreProps): CompositeOverflowStore;
|
|
6
|
-
export
|
|
7
|
-
|
|
8
|
-
export
|
|
9
|
-
|
|
10
|
-
export
|
|
7
|
+
export interface CompositeOverflowStoreState extends PopoverStoreState {
|
|
8
|
+
}
|
|
9
|
+
export interface CompositeOverflowStoreFunctions extends PopoverStoreFunctions {
|
|
10
|
+
}
|
|
11
|
+
export interface CompositeOverflowStoreOptions extends PopoverStoreOptions {
|
|
12
|
+
}
|
|
13
|
+
export interface CompositeOverflowStoreProps extends CompositeOverflowStoreOptions, StoreProps<CompositeOverflowStoreState> {
|
|
14
|
+
}
|
|
15
|
+
export interface CompositeOverflowStore extends CompositeOverflowStoreFunctions, Store<CompositeOverflowStoreState> {
|
|
16
|
+
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
3
|
createPopoverStore
|
|
4
|
-
} from "../__chunks/
|
|
5
|
-
import "../__chunks/
|
|
6
|
-
import "../__chunks/
|
|
7
|
-
import "../__chunks/
|
|
4
|
+
} from "../__chunks/J6JIOWCS.js";
|
|
5
|
+
import "../__chunks/LT2OYWRD.js";
|
|
6
|
+
import "../__chunks/NKLTHWCR.js";
|
|
7
|
+
import "../__chunks/A2J4XZ5T.js";
|
|
8
8
|
import "../__chunks/I2VQ3XGR.js";
|
|
9
9
|
import "../__chunks/4R3V3JGP.js";
|
|
10
10
|
|