@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
|
@@ -7,14 +7,14 @@ import {
|
|
|
7
7
|
subscribe,
|
|
8
8
|
sync,
|
|
9
9
|
throwOnConflictingProps
|
|
10
|
-
} from "./
|
|
10
|
+
} from "./EQQLU3CG.js";
|
|
11
11
|
import {
|
|
12
12
|
defaultValue
|
|
13
|
-
} from "./
|
|
13
|
+
} from "./PBFD2E7P.js";
|
|
14
14
|
import {
|
|
15
15
|
__spreadProps,
|
|
16
16
|
__spreadValues
|
|
17
|
-
} from "./
|
|
17
|
+
} from "./3YLGPPWQ.js";
|
|
18
18
|
|
|
19
19
|
// src/disclosure/disclosure-store.ts
|
|
20
20
|
function createDisclosureStore(props = {}) {
|
|
@@ -43,16 +43,14 @@ function createDisclosureStore(props = {}) {
|
|
|
43
43
|
setup(
|
|
44
44
|
disclosure,
|
|
45
45
|
() => sync(disclosure, ["animated", "animating"], (state) => {
|
|
46
|
-
if (state.animated)
|
|
47
|
-
return;
|
|
46
|
+
if (state.animated) return;
|
|
48
47
|
disclosure.setState("animating", false);
|
|
49
48
|
})
|
|
50
49
|
);
|
|
51
50
|
setup(
|
|
52
51
|
disclosure,
|
|
53
52
|
() => subscribe(disclosure, ["open"], () => {
|
|
54
|
-
if (!disclosure.getState().animated)
|
|
55
|
-
return;
|
|
53
|
+
if (!disclosure.getState().animated) return;
|
|
56
54
|
disclosure.setState("animating", true);
|
|
57
55
|
})
|
|
58
56
|
);
|
|
@@ -21,21 +21,18 @@ function createUndoManager({
|
|
|
21
21
|
const canRedo = () => redoStack.length > 0;
|
|
22
22
|
const undo = async () => {
|
|
23
23
|
var _a;
|
|
24
|
-
if (!canUndo())
|
|
25
|
-
return;
|
|
24
|
+
if (!canUndo()) return;
|
|
26
25
|
currentGroup = null;
|
|
27
26
|
redoStack.push(await ((_a = undoStack.pop()) == null ? void 0 : _a()));
|
|
28
27
|
};
|
|
29
28
|
const redo = async () => {
|
|
30
29
|
var _a;
|
|
31
|
-
if (!canRedo())
|
|
32
|
-
return;
|
|
30
|
+
if (!canRedo()) return;
|
|
33
31
|
currentGroup = null;
|
|
34
32
|
undoStack.push(await ((_a = redoStack.pop()) == null ? void 0 : _a()));
|
|
35
33
|
};
|
|
36
34
|
const execute = async (callback, group) => {
|
|
37
|
-
if (!callback)
|
|
38
|
-
return;
|
|
35
|
+
if (!callback) return;
|
|
39
36
|
while (undoStack.length > limit) {
|
|
40
37
|
undoStack.shift();
|
|
41
38
|
}
|
|
@@ -43,8 +40,7 @@ function createUndoManager({
|
|
|
43
40
|
currentGroup = group != null ? group : null;
|
|
44
41
|
const nextIndex = sameGroup ? Math.max(0, undoStack.length - 1) : undoStack.length;
|
|
45
42
|
const undoCallback = await callback();
|
|
46
|
-
if (!undoCallback)
|
|
47
|
-
return;
|
|
43
|
+
if (!undoCallback) return;
|
|
48
44
|
redoStack = [];
|
|
49
45
|
const currentUndo = undoStack[nextIndex];
|
|
50
46
|
undoStack[nextIndex] = createUndoCallback(async () => {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
3
|
createCollectionStore
|
|
4
|
-
} from "./
|
|
4
|
+
} from "./6DHTHWXD.js";
|
|
5
5
|
import {
|
|
6
6
|
flatten2DArray,
|
|
7
7
|
reverseArray
|
|
@@ -10,14 +10,14 @@ import {
|
|
|
10
10
|
createStore,
|
|
11
11
|
setup,
|
|
12
12
|
sync
|
|
13
|
-
} from "./
|
|
13
|
+
} from "./EQQLU3CG.js";
|
|
14
14
|
import {
|
|
15
15
|
defaultValue
|
|
16
|
-
} from "./
|
|
16
|
+
} from "./PBFD2E7P.js";
|
|
17
17
|
import {
|
|
18
18
|
__spreadProps,
|
|
19
19
|
__spreadValues
|
|
20
|
-
} from "./
|
|
20
|
+
} from "./3YLGPPWQ.js";
|
|
21
21
|
|
|
22
22
|
// src/composite/composite-store.ts
|
|
23
23
|
var NULL_ITEM = { id: null };
|
|
@@ -38,10 +38,8 @@ function getEnabledItems(items, excludeId) {
|
|
|
38
38
|
});
|
|
39
39
|
}
|
|
40
40
|
function getOppositeOrientation(orientation) {
|
|
41
|
-
if (orientation === "vertical")
|
|
42
|
-
|
|
43
|
-
if (orientation === "horizontal")
|
|
44
|
-
return "vertical";
|
|
41
|
+
if (orientation === "vertical") return "horizontal";
|
|
42
|
+
if (orientation === "horizontal") return "vertical";
|
|
45
43
|
return;
|
|
46
44
|
}
|
|
47
45
|
function getItemsInRow(items, rowId) {
|
|
@@ -160,8 +158,7 @@ function createCompositeStore(props = {}) {
|
|
|
160
158
|
() => sync(composite, ["renderedItems", "activeId"], (state) => {
|
|
161
159
|
composite.setState("activeId", (activeId2) => {
|
|
162
160
|
var _a2;
|
|
163
|
-
if (activeId2 !== void 0)
|
|
164
|
-
return activeId2;
|
|
161
|
+
if (activeId2 !== void 0) return activeId2;
|
|
165
162
|
return (_a2 = findFirstEnabledItem(state.renderedItems)) == null ? void 0 : _a2.id;
|
|
166
163
|
});
|
|
167
164
|
})
|
|
@@ -228,8 +225,7 @@ function createCompositeStore(props = {}) {
|
|
|
228
225
|
setBaseElement: (element) => composite.setState("baseElement", element),
|
|
229
226
|
setActiveId: (id) => composite.setState("activeId", id),
|
|
230
227
|
move: (id) => {
|
|
231
|
-
if (id === void 0)
|
|
232
|
-
return;
|
|
228
|
+
if (id === void 0) return;
|
|
233
229
|
composite.setState("activeId", id);
|
|
234
230
|
composite.setState("moves", (moves) => moves + 1);
|
|
235
231
|
},
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
3
|
createPopoverStore
|
|
4
|
-
} from "./
|
|
4
|
+
} from "./3UYWTADI.js";
|
|
5
5
|
import {
|
|
6
6
|
createStore
|
|
7
|
-
} from "./
|
|
7
|
+
} from "./EQQLU3CG.js";
|
|
8
8
|
import {
|
|
9
9
|
defaultValue
|
|
10
|
-
} from "./
|
|
10
|
+
} from "./PBFD2E7P.js";
|
|
11
11
|
import {
|
|
12
12
|
__spreadProps,
|
|
13
13
|
__spreadValues
|
|
14
|
-
} from "./
|
|
14
|
+
} from "./3YLGPPWQ.js";
|
|
15
15
|
|
|
16
16
|
// src/hovercard/hovercard-store.ts
|
|
17
17
|
function createHovercardStore(props = {}) {
|
|
@@ -8,11 +8,11 @@ import {
|
|
|
8
8
|
noop,
|
|
9
9
|
omit,
|
|
10
10
|
pick
|
|
11
|
-
} from "./
|
|
11
|
+
} from "./PBFD2E7P.js";
|
|
12
12
|
import {
|
|
13
13
|
__spreadProps,
|
|
14
14
|
__spreadValues
|
|
15
|
-
} from "./
|
|
15
|
+
} from "./3YLGPPWQ.js";
|
|
16
16
|
|
|
17
17
|
// src/utils/store.ts
|
|
18
18
|
function getInternal(store, key) {
|
|
@@ -42,21 +42,17 @@ function createStore(initialState, ...stores) {
|
|
|
42
42
|
instances.add(instance);
|
|
43
43
|
const maybeDestroy = () => {
|
|
44
44
|
instances.delete(instance);
|
|
45
|
-
if (instances.size)
|
|
46
|
-
return;
|
|
45
|
+
if (instances.size) return;
|
|
47
46
|
destroy();
|
|
48
47
|
};
|
|
49
|
-
if (initialized)
|
|
50
|
-
return maybeDestroy;
|
|
48
|
+
if (initialized) return maybeDestroy;
|
|
51
49
|
const desyncs = getKeys(state).map(
|
|
52
50
|
(key) => chain(
|
|
53
51
|
...stores.map((store) => {
|
|
54
52
|
var _a;
|
|
55
53
|
const storeState = (_a = store == null ? void 0 : store.getState) == null ? void 0 : _a.call(store);
|
|
56
|
-
if (!storeState)
|
|
57
|
-
|
|
58
|
-
if (!hasOwnProperty(storeState, key))
|
|
59
|
-
return;
|
|
54
|
+
if (!storeState) return;
|
|
55
|
+
if (!hasOwnProperty(storeState, key)) return;
|
|
60
56
|
return sync(store, [key], (state2) => {
|
|
61
57
|
setState(
|
|
62
58
|
key,
|
|
@@ -70,7 +66,9 @@ function createStore(initialState, ...stores) {
|
|
|
70
66
|
)
|
|
71
67
|
);
|
|
72
68
|
const teardowns = [];
|
|
73
|
-
|
|
69
|
+
for (const setup2 of setups) {
|
|
70
|
+
teardowns.push(setup2());
|
|
71
|
+
}
|
|
74
72
|
const cleanups = stores.map(init);
|
|
75
73
|
destroy = chain(...desyncs, ...teardowns, ...cleanups);
|
|
76
74
|
return maybeDestroy;
|
|
@@ -99,16 +97,14 @@ function createStore(initialState, ...stores) {
|
|
|
99
97
|
const storeOmit = (keys) => createStore(omit(state, keys), finalStore);
|
|
100
98
|
const getState = () => state;
|
|
101
99
|
const setState = (key, value, fromStores = false) => {
|
|
102
|
-
|
|
103
|
-
|
|
100
|
+
var _a;
|
|
101
|
+
if (!hasOwnProperty(state, key)) return;
|
|
104
102
|
const nextValue = applyState(value, state[key]);
|
|
105
|
-
if (nextValue === state[key])
|
|
106
|
-
return;
|
|
103
|
+
if (nextValue === state[key]) return;
|
|
107
104
|
if (!fromStores) {
|
|
108
|
-
|
|
109
|
-
var _a;
|
|
105
|
+
for (const store of stores) {
|
|
110
106
|
(_a = store == null ? void 0 : store.setState) == null ? void 0 : _a.call(store, key, nextValue);
|
|
111
|
-
}
|
|
107
|
+
}
|
|
112
108
|
}
|
|
113
109
|
const prevState = state;
|
|
114
110
|
state = __spreadProps(__spreadValues({}, state), { [key]: nextValue });
|
|
@@ -116,24 +112,23 @@ function createStore(initialState, ...stores) {
|
|
|
116
112
|
lastUpdate = thisUpdate;
|
|
117
113
|
updatedKeys.add(key);
|
|
118
114
|
const run = (listener, prev, uKeys) => {
|
|
119
|
-
var
|
|
115
|
+
var _a2;
|
|
120
116
|
const keys = listenerKeys.get(listener);
|
|
121
117
|
const updated = (k) => uKeys ? uKeys.has(k) : k === key;
|
|
122
118
|
if (!keys || keys.some(updated)) {
|
|
123
|
-
(
|
|
119
|
+
(_a2 = disposables.get(listener)) == null ? void 0 : _a2();
|
|
124
120
|
disposables.set(listener, listener(state, prev));
|
|
125
121
|
}
|
|
126
122
|
};
|
|
127
|
-
|
|
123
|
+
for (const listener of listeners) {
|
|
128
124
|
run(listener, prevState);
|
|
129
|
-
}
|
|
125
|
+
}
|
|
130
126
|
queueMicrotask(() => {
|
|
131
|
-
if (lastUpdate !== thisUpdate)
|
|
132
|
-
return;
|
|
127
|
+
if (lastUpdate !== thisUpdate) return;
|
|
133
128
|
const snapshot = state;
|
|
134
|
-
|
|
129
|
+
for (const listener of batchListeners) {
|
|
135
130
|
run(listener, prevStateBatch, updatedKeys);
|
|
136
|
-
}
|
|
131
|
+
}
|
|
137
132
|
prevStateBatch = snapshot;
|
|
138
133
|
updatedKeys.clear();
|
|
139
134
|
});
|
|
@@ -154,69 +149,57 @@ function createStore(initialState, ...stores) {
|
|
|
154
149
|
return finalStore;
|
|
155
150
|
}
|
|
156
151
|
function setup(store, ...args) {
|
|
157
|
-
if (!store)
|
|
158
|
-
return;
|
|
152
|
+
if (!store) return;
|
|
159
153
|
return getInternal(store, "setup")(...args);
|
|
160
154
|
}
|
|
161
155
|
function init(store, ...args) {
|
|
162
|
-
if (!store)
|
|
163
|
-
return;
|
|
156
|
+
if (!store) return;
|
|
164
157
|
return getInternal(store, "init")(...args);
|
|
165
158
|
}
|
|
166
159
|
function subscribe(store, ...args) {
|
|
167
|
-
if (!store)
|
|
168
|
-
return;
|
|
160
|
+
if (!store) return;
|
|
169
161
|
return getInternal(store, "subscribe")(...args);
|
|
170
162
|
}
|
|
171
163
|
function sync(store, ...args) {
|
|
172
|
-
if (!store)
|
|
173
|
-
return;
|
|
164
|
+
if (!store) return;
|
|
174
165
|
return getInternal(store, "sync")(...args);
|
|
175
166
|
}
|
|
176
167
|
function batch(store, ...args) {
|
|
177
|
-
if (!store)
|
|
178
|
-
return;
|
|
168
|
+
if (!store) return;
|
|
179
169
|
return getInternal(store, "batch")(...args);
|
|
180
170
|
}
|
|
181
171
|
function omit2(store, ...args) {
|
|
182
|
-
if (!store)
|
|
183
|
-
return;
|
|
172
|
+
if (!store) return;
|
|
184
173
|
return getInternal(store, "omit")(...args);
|
|
185
174
|
}
|
|
186
175
|
function pick2(store, ...args) {
|
|
187
|
-
if (!store)
|
|
188
|
-
return;
|
|
176
|
+
if (!store) return;
|
|
189
177
|
return getInternal(store, "pick")(...args);
|
|
190
178
|
}
|
|
191
179
|
function mergeStore(...stores) {
|
|
192
180
|
const initialState = stores.reduce((state, store2) => {
|
|
193
181
|
var _a;
|
|
194
182
|
const nextState = (_a = store2 == null ? void 0 : store2.getState) == null ? void 0 : _a.call(store2);
|
|
195
|
-
if (!nextState)
|
|
196
|
-
|
|
197
|
-
return __spreadValues(__spreadValues({}, state), nextState);
|
|
183
|
+
if (!nextState) return state;
|
|
184
|
+
return Object.assign(state, nextState);
|
|
198
185
|
}, {});
|
|
199
186
|
const store = createStore(initialState, ...stores);
|
|
200
187
|
return store;
|
|
201
188
|
}
|
|
202
189
|
function throwOnConflictingProps(props, store) {
|
|
203
|
-
if (process.env.NODE_ENV === "production")
|
|
204
|
-
|
|
205
|
-
if (!store)
|
|
206
|
-
return;
|
|
190
|
+
if (process.env.NODE_ENV === "production") return;
|
|
191
|
+
if (!store) return;
|
|
207
192
|
const defaultKeys = Object.entries(props).filter(([key, value]) => key.startsWith("default") && value !== void 0).map(([key]) => {
|
|
208
193
|
var _a;
|
|
209
194
|
const stateKey = key.replace("default", "");
|
|
210
195
|
return `${((_a = stateKey[0]) == null ? void 0 : _a.toLowerCase()) || ""}${stateKey.slice(1)}`;
|
|
211
196
|
});
|
|
212
|
-
if (!defaultKeys.length)
|
|
213
|
-
return;
|
|
197
|
+
if (!defaultKeys.length) return;
|
|
214
198
|
const storeState = store.getState();
|
|
215
199
|
const conflictingProps = defaultKeys.filter(
|
|
216
200
|
(key) => hasOwnProperty(storeState, key)
|
|
217
201
|
);
|
|
218
|
-
if (!conflictingProps.length)
|
|
219
|
-
return;
|
|
202
|
+
if (!conflictingProps.length) return;
|
|
220
203
|
throw new Error(
|
|
221
204
|
`Passing a store prop in conjunction with a default state is not supported.
|
|
222
205
|
|
|
@@ -42,8 +42,7 @@ function isFrame(element) {
|
|
|
42
42
|
}
|
|
43
43
|
function isButton(element) {
|
|
44
44
|
const tagName = element.tagName.toLowerCase();
|
|
45
|
-
if (tagName === "button")
|
|
46
|
-
return true;
|
|
45
|
+
if (tagName === "button") return true;
|
|
47
46
|
if (tagName === "input" && element.type) {
|
|
48
47
|
return buttonInputTypes.indexOf(element.type) !== -1;
|
|
49
48
|
}
|
|
@@ -123,8 +122,7 @@ function getPopupItemRole(element, fallback) {
|
|
|
123
122
|
tree: "treeitem"
|
|
124
123
|
};
|
|
125
124
|
const popupRole = getPopupRole(element);
|
|
126
|
-
if (!popupRole)
|
|
127
|
-
return fallback;
|
|
125
|
+
if (!popupRole) return fallback;
|
|
128
126
|
const key = popupRole;
|
|
129
127
|
return (_a = itemRoleByPopupRole[key]) != null ? _a : fallback;
|
|
130
128
|
}
|
|
@@ -134,26 +132,22 @@ function scrollIntoViewIfNeeded(element, arg) {
|
|
|
134
132
|
}
|
|
135
133
|
}
|
|
136
134
|
function getScrollingElement(element) {
|
|
137
|
-
if (!element)
|
|
138
|
-
return null;
|
|
135
|
+
if (!element) return null;
|
|
139
136
|
if (element.clientHeight && element.scrollHeight > element.clientHeight) {
|
|
140
137
|
const { overflowY } = getComputedStyle(element);
|
|
141
138
|
const isScrollable = overflowY !== "visible" && overflowY !== "hidden";
|
|
142
|
-
if (isScrollable)
|
|
143
|
-
return element;
|
|
139
|
+
if (isScrollable) return element;
|
|
144
140
|
} else if (element.clientWidth && element.scrollWidth > element.clientWidth) {
|
|
145
141
|
const { overflowX } = getComputedStyle(element);
|
|
146
142
|
const isScrollable = overflowX !== "visible" && overflowX !== "hidden";
|
|
147
|
-
if (isScrollable)
|
|
148
|
-
return element;
|
|
143
|
+
if (isScrollable) return element;
|
|
149
144
|
}
|
|
150
145
|
return getScrollingElement(element.parentElement) || document.scrollingElement || document.body;
|
|
151
146
|
}
|
|
152
147
|
function isPartiallyHidden(element) {
|
|
153
148
|
const elementRect = element.getBoundingClientRect();
|
|
154
149
|
const scroller = getScrollingElement(element);
|
|
155
|
-
if (!scroller)
|
|
156
|
-
return false;
|
|
150
|
+
if (!scroller) return false;
|
|
157
151
|
const scrollerRect = scroller.getBoundingClientRect();
|
|
158
152
|
const isHTML = scroller.tagName === "HTML";
|
|
159
153
|
const scrollerTop = isHTML ? scrollerRect.top + scroller.scrollTop : scrollerRect.top;
|
|
@@ -1,27 +1,21 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
3
|
__spreadValues
|
|
4
|
-
} from "./
|
|
4
|
+
} from "./3YLGPPWQ.js";
|
|
5
5
|
|
|
6
6
|
// src/utils/misc.ts
|
|
7
7
|
function noop(..._) {
|
|
8
8
|
}
|
|
9
9
|
function shallowEqual(a, b) {
|
|
10
|
-
if (a === b)
|
|
11
|
-
|
|
12
|
-
if (!
|
|
13
|
-
|
|
14
|
-
if (
|
|
15
|
-
return false;
|
|
16
|
-
if (typeof a !== "object")
|
|
17
|
-
return false;
|
|
18
|
-
if (typeof b !== "object")
|
|
19
|
-
return false;
|
|
10
|
+
if (a === b) return true;
|
|
11
|
+
if (!a) return false;
|
|
12
|
+
if (!b) return false;
|
|
13
|
+
if (typeof a !== "object") return false;
|
|
14
|
+
if (typeof b !== "object") return false;
|
|
20
15
|
const aKeys = Object.keys(a);
|
|
21
16
|
const bKeys = Object.keys(b);
|
|
22
17
|
const { length } = aKeys;
|
|
23
|
-
if (bKeys.length !== length)
|
|
24
|
-
return false;
|
|
18
|
+
if (bKeys.length !== length) return false;
|
|
25
19
|
for (const key of aKeys) {
|
|
26
20
|
if (a[key] !== b[key]) {
|
|
27
21
|
return false;
|
|
@@ -46,14 +40,10 @@ function isObject(arg) {
|
|
|
46
40
|
return typeof arg === "object" && arg != null;
|
|
47
41
|
}
|
|
48
42
|
function isEmpty(arg) {
|
|
49
|
-
if (Array.isArray(arg))
|
|
50
|
-
|
|
51
|
-
if (
|
|
52
|
-
|
|
53
|
-
if (arg == null)
|
|
54
|
-
return true;
|
|
55
|
-
if (arg === "")
|
|
56
|
-
return true;
|
|
43
|
+
if (Array.isArray(arg)) return !arg.length;
|
|
44
|
+
if (isObject(arg)) return !Object.keys(arg).length;
|
|
45
|
+
if (arg == null) return true;
|
|
46
|
+
if (arg === "") return true;
|
|
57
47
|
return false;
|
|
58
48
|
}
|
|
59
49
|
function isInteger(arg) {
|
|
@@ -115,10 +105,8 @@ function afterPaint(cb = noop) {
|
|
|
115
105
|
return () => cancelAnimationFrame(raf);
|
|
116
106
|
}
|
|
117
107
|
function invariant(condition, message) {
|
|
118
|
-
if (condition)
|
|
119
|
-
|
|
120
|
-
if (typeof message !== "string")
|
|
121
|
-
throw new Error("Invariant failed");
|
|
108
|
+
if (condition) return;
|
|
109
|
+
if (typeof message !== "string") throw new Error("Invariant failed");
|
|
122
110
|
throw new Error(message);
|
|
123
111
|
}
|
|
124
112
|
function getKeys(obj) {
|
|
@@ -126,8 +114,7 @@ function getKeys(obj) {
|
|
|
126
114
|
}
|
|
127
115
|
function isFalsyBooleanCallback(booleanOrCallback, ...args) {
|
|
128
116
|
const result = typeof booleanOrCallback === "function" ? booleanOrCallback(...args) : booleanOrCallback;
|
|
129
|
-
if (result == null)
|
|
130
|
-
return false;
|
|
117
|
+
if (result == null) return false;
|
|
131
118
|
return !result;
|
|
132
119
|
}
|
|
133
120
|
function disabledFromProps(props) {
|
|
@@ -144,8 +131,7 @@ function removeUndefinedValues(obj) {
|
|
|
144
131
|
}
|
|
145
132
|
function defaultValue(...values) {
|
|
146
133
|
for (const value of values) {
|
|
147
|
-
if (value !== void 0)
|
|
148
|
-
return value;
|
|
134
|
+
if (value !== void 0) return value;
|
|
149
135
|
}
|
|
150
136
|
return void 0;
|
|
151
137
|
}
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
3
|
createCompositeStore
|
|
4
|
-
} from "./
|
|
4
|
+
} from "./D7EIQZAU.js";
|
|
5
5
|
import {
|
|
6
6
|
createStore
|
|
7
|
-
} from "./
|
|
7
|
+
} from "./EQQLU3CG.js";
|
|
8
8
|
import {
|
|
9
9
|
defaultValue
|
|
10
|
-
} from "./
|
|
10
|
+
} from "./PBFD2E7P.js";
|
|
11
11
|
import {
|
|
12
12
|
__spreadProps,
|
|
13
13
|
__spreadValues
|
|
14
|
-
} from "./
|
|
14
|
+
} from "./3YLGPPWQ.js";
|
|
15
15
|
|
|
16
16
|
// src/menubar/menubar-store.ts
|
|
17
17
|
function createMenubarStore(props = {}) {
|
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
3
|
canUseDOM
|
|
4
|
-
} from "./
|
|
4
|
+
} from "./HWOIWM4O.js";
|
|
5
5
|
|
|
6
6
|
// src/utils/platform.ts
|
|
7
7
|
function isTouchDevice() {
|
|
8
8
|
return canUseDOM && !!navigator.maxTouchPoints;
|
|
9
9
|
}
|
|
10
10
|
function isApple() {
|
|
11
|
-
if (!canUseDOM)
|
|
12
|
-
return false;
|
|
11
|
+
if (!canUseDOM) return false;
|
|
13
12
|
return /mac|iphone|ipad|ipod/i.test(navigator.platform);
|
|
14
13
|
}
|
|
15
14
|
function isSafari() {
|
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
import {
|
|
3
3
|
createStore,
|
|
4
4
|
throwOnConflictingProps
|
|
5
|
-
} from "../__chunks/
|
|
5
|
+
} from "../__chunks/EQQLU3CG.js";
|
|
6
6
|
import {
|
|
7
7
|
defaultValue
|
|
8
|
-
} from "../__chunks/
|
|
8
|
+
} from "../__chunks/PBFD2E7P.js";
|
|
9
9
|
import {
|
|
10
10
|
__spreadProps,
|
|
11
11
|
__spreadValues
|
|
12
|
-
} from "../__chunks/
|
|
12
|
+
} from "../__chunks/3YLGPPWQ.js";
|
|
13
13
|
|
|
14
14
|
// src/checkbox/checkbox-store.ts
|
|
15
15
|
function createCheckboxStore(props = {}) {
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
3
|
createCollectionStore
|
|
4
|
-
} from "../__chunks/
|
|
5
|
-
import "../__chunks/
|
|
6
|
-
import "../__chunks/
|
|
7
|
-
import "../__chunks/
|
|
8
|
-
import "../__chunks/
|
|
4
|
+
} from "../__chunks/6DHTHWXD.js";
|
|
5
|
+
import "../__chunks/EQQLU3CG.js";
|
|
6
|
+
import "../__chunks/PBFD2E7P.js";
|
|
7
|
+
import "../__chunks/HWOIWM4O.js";
|
|
8
|
+
import "../__chunks/3YLGPPWQ.js";
|
|
9
9
|
export {
|
|
10
10
|
createCollectionStore
|
|
11
11
|
};
|
|
@@ -71,6 +71,8 @@ export interface ComboboxStoreState<T extends ComboboxStoreSelectedValue = Combo
|
|
|
71
71
|
* - [Submenu with
|
|
72
72
|
* Combobox](https://ariakit.org/examples/menu-nested-combobox)
|
|
73
73
|
* - [Command Menu](https://ariakit.org/examples/dialog-combobox-command-menu)
|
|
74
|
+
* - [Select with Combobox and
|
|
75
|
+
* Tabs](https://ariakit.org/examples/select-combobox-tab)
|
|
74
76
|
*/
|
|
75
77
|
resetValueOnHide: boolean;
|
|
76
78
|
/**
|
|
@@ -1,14 +1,14 @@
|
|
|
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
|
createPopoverStore
|
|
9
|
-
} from "../__chunks/
|
|
10
|
-
import "../__chunks/
|
|
11
|
-
import "../__chunks/
|
|
9
|
+
} from "../__chunks/3UYWTADI.js";
|
|
10
|
+
import "../__chunks/YOHCVXJB.js";
|
|
11
|
+
import "../__chunks/6E4KKOSB.js";
|
|
12
12
|
import {
|
|
13
13
|
batch,
|
|
14
14
|
createStore,
|
|
@@ -17,21 +17,21 @@ import {
|
|
|
17
17
|
setup,
|
|
18
18
|
sync,
|
|
19
19
|
throwOnConflictingProps
|
|
20
|
-
} from "../__chunks/
|
|
20
|
+
} from "../__chunks/EQQLU3CG.js";
|
|
21
21
|
import {
|
|
22
22
|
chain,
|
|
23
23
|
defaultValue
|
|
24
|
-
} from "../__chunks/
|
|
24
|
+
} from "../__chunks/PBFD2E7P.js";
|
|
25
25
|
import {
|
|
26
26
|
isSafari,
|
|
27
27
|
isTouchDevice
|
|
28
|
-
} from "../__chunks/
|
|
29
|
-
import "../__chunks/
|
|
28
|
+
} from "../__chunks/US4USQPI.js";
|
|
29
|
+
import "../__chunks/HWOIWM4O.js";
|
|
30
30
|
import {
|
|
31
31
|
__objRest,
|
|
32
32
|
__spreadProps,
|
|
33
33
|
__spreadValues
|
|
34
|
-
} from "../__chunks/
|
|
34
|
+
} from "../__chunks/3YLGPPWQ.js";
|
|
35
35
|
|
|
36
36
|
// src/combobox/combobox-store.ts
|
|
37
37
|
var isTouchSafari = isSafari() && isTouchDevice();
|
|
@@ -117,12 +117,10 @@ function createComboboxStore(_a = {}) {
|
|
|
117
117
|
);
|
|
118
118
|
}
|
|
119
119
|
setup(combobox, () => {
|
|
120
|
-
if (!tag)
|
|
121
|
-
return;
|
|
120
|
+
if (!tag) return;
|
|
122
121
|
return chain(
|
|
123
122
|
sync(combobox, ["selectedValue"], (state) => {
|
|
124
|
-
if (!Array.isArray(state.selectedValue))
|
|
125
|
-
return;
|
|
123
|
+
if (!Array.isArray(state.selectedValue)) return;
|
|
126
124
|
tag.setValues(state.selectedValue);
|
|
127
125
|
}),
|
|
128
126
|
sync(tag, ["values"], (state) => {
|
|
@@ -133,18 +131,15 @@ function createComboboxStore(_a = {}) {
|
|
|
133
131
|
setup(
|
|
134
132
|
combobox,
|
|
135
133
|
() => sync(combobox, ["resetValueOnHide", "mounted"], (state) => {
|
|
136
|
-
if (!state.resetValueOnHide)
|
|
137
|
-
|
|
138
|
-
if (state.mounted)
|
|
139
|
-
return;
|
|
134
|
+
if (!state.resetValueOnHide) return;
|
|
135
|
+
if (state.mounted) return;
|
|
140
136
|
combobox.setState("value", value);
|
|
141
137
|
})
|
|
142
138
|
);
|
|
143
139
|
setup(
|
|
144
140
|
combobox,
|
|
145
141
|
() => batch(combobox, ["mounted"], (state) => {
|
|
146
|
-
if (state.mounted)
|
|
147
|
-
return;
|
|
142
|
+
if (state.mounted) return;
|
|
148
143
|
combobox.setState("activeId", activeId);
|
|
149
144
|
combobox.setState("moves", 0);
|
|
150
145
|
})
|
|
@@ -160,8 +155,7 @@ function createComboboxStore(_a = {}) {
|
|
|
160
155
|
setup(
|
|
161
156
|
combobox,
|
|
162
157
|
() => batch(combobox, ["moves", "renderedItems"], (state, prev) => {
|
|
163
|
-
if (state.moves === prev.moves)
|
|
164
|
-
return;
|
|
158
|
+
if (state.moves === prev.moves) return;
|
|
165
159
|
const { activeId: activeId2 } = combobox.getState();
|
|
166
160
|
const activeItem = composite.item(activeId2);
|
|
167
161
|
combobox.setState("activeValue", activeItem == null ? void 0 : activeItem.value);
|