@ariakit/core 0.2.7 → 0.2.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 +8 -0
- package/cjs/__chunks/{ZXPKRPGY.cjs → DPHJ32KR.cjs} +8 -7
- package/cjs/__chunks/{SXMUYOXB.cjs → F5DMXFQ2.cjs} +30 -31
- package/cjs/__chunks/{5AWPMH4S.cjs → FS2K2N7U.cjs} +72 -25
- package/cjs/__chunks/{NVEPU4WA.cjs → MCCIH6SG.cjs} +4 -4
- package/cjs/__chunks/{PR7FUI5D.cjs → OQIG5VE3.cjs} +16 -16
- package/cjs/__chunks/{K2LZWNNX.cjs → PIEJYPN7.cjs} +2 -2
- package/cjs/__chunks/{RS4LBZRZ.cjs → V7OHZPBO.cjs} +28 -32
- package/cjs/checkbox/checkbox-store.cjs +2 -2
- package/cjs/collection/collection-store.cjs +3 -3
- package/cjs/combobox/combobox-store.cjs +53 -56
- package/cjs/combobox/combobox-store.d.ts +1 -1
- package/cjs/composite/composite-overflow-store.cjs +5 -5
- package/cjs/composite/composite-store.cjs +4 -4
- package/cjs/dialog/dialog-store.cjs +4 -4
- package/cjs/disclosure/disclosure-store.cjs +3 -3
- package/cjs/form/form-store.cjs +4 -4
- package/cjs/hovercard/hovercard-store.cjs +6 -6
- package/cjs/menu/menu-bar-store.cjs +4 -4
- package/cjs/menu/menu-store.cjs +23 -22
- package/cjs/popover/popover-store.cjs +5 -5
- package/cjs/radio/radio-store.cjs +5 -5
- package/cjs/select/select-store.cjs +65 -67
- package/cjs/tab/tab-store.cjs +55 -56
- package/cjs/toolbar/toolbar-store.cjs +4 -4
- package/cjs/tooltip/tooltip-store.cjs +7 -7
- package/cjs/tsconfig.build.tsbuildinfo +1 -1
- package/cjs/utils/store.cjs +16 -2
- package/cjs/utils/store.d.ts +19 -59
- package/esm/__chunks/{SHUO6V52.js → A7IMXABC.js} +29 -30
- package/esm/__chunks/{XJGRXN57.js → COUCUJML.js} +2 -2
- package/esm/__chunks/{UWW2ZP3K.js → LNMWV6UV.js} +1 -1
- package/esm/__chunks/{FQL4TRMX.js → OGOHEUXI.js} +71 -24
- package/esm/__chunks/{NRXA5QTV.js → ROY5BBHL.js} +15 -15
- package/esm/__chunks/{LM4QG55U.js → SOCHV2LZ.js} +6 -5
- package/esm/__chunks/{L5RO76KW.js → WSKDP2MG.js} +27 -31
- package/esm/checkbox/checkbox-store.js +1 -1
- package/esm/collection/collection-store.js +2 -2
- package/esm/combobox/combobox-store.d.ts +1 -1
- package/esm/combobox/combobox-store.js +50 -53
- package/esm/composite/composite-overflow-store.js +4 -4
- package/esm/composite/composite-store.js +3 -3
- package/esm/dialog/dialog-store.js +3 -3
- package/esm/disclosure/disclosure-store.js +2 -2
- package/esm/form/form-store.js +2 -2
- package/esm/hovercard/hovercard-store.js +5 -5
- package/esm/menu/menu-bar-store.js +3 -3
- package/esm/menu/menu-store.js +20 -19
- package/esm/popover/popover-store.js +4 -4
- package/esm/radio/radio-store.js +3 -3
- package/esm/select/select-store.js +62 -64
- package/esm/tab/tab-store.js +53 -54
- package/esm/toolbar/toolbar-store.js +3 -3
- package/esm/tooltip/tooltip-store.js +5 -5
- package/esm/tsconfig.build.tsbuildinfo +1 -1
- package/esm/utils/store.d.ts +19 -59
- package/esm/utils/store.js +17 -3
- package/package.json +1 -1
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
batch,
|
|
3
|
+
createStore,
|
|
4
|
+
setup
|
|
5
|
+
} from "./OGOHEUXI.js";
|
|
4
6
|
import {
|
|
5
7
|
chain,
|
|
6
8
|
defaultValue
|
|
@@ -83,35 +85,32 @@ function createCollectionStore(props = {}) {
|
|
|
83
85
|
privateStore.setState("renderedItems", renderedItems);
|
|
84
86
|
collection.setState("renderedItems", renderedItems);
|
|
85
87
|
};
|
|
86
|
-
|
|
87
|
-
return privateStore
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
88
|
+
setup(collection, () => {
|
|
89
|
+
return batch(privateStore, ["renderedItems"], (state) => {
|
|
90
|
+
let firstRun = true;
|
|
91
|
+
let raf = requestAnimationFrame(sortItems);
|
|
92
|
+
if (typeof IntersectionObserver !== "function")
|
|
93
|
+
return;
|
|
94
|
+
const callback = () => {
|
|
95
|
+
if (firstRun) {
|
|
96
|
+
firstRun = false;
|
|
92
97
|
return;
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
cancelAnimationFrame(raf);
|
|
110
|
-
observer.disconnect();
|
|
111
|
-
};
|
|
112
|
-
},
|
|
113
|
-
["renderedItems"]
|
|
114
|
-
);
|
|
98
|
+
}
|
|
99
|
+
cancelAnimationFrame(raf);
|
|
100
|
+
raf = requestAnimationFrame(sortItems);
|
|
101
|
+
};
|
|
102
|
+
const root = getCommonParent(state.renderedItems);
|
|
103
|
+
const observer = new IntersectionObserver(callback, { root });
|
|
104
|
+
state.renderedItems.forEach((item) => {
|
|
105
|
+
if (!item.element)
|
|
106
|
+
return;
|
|
107
|
+
observer.observe(item.element);
|
|
108
|
+
});
|
|
109
|
+
return () => {
|
|
110
|
+
cancelAnimationFrame(raf);
|
|
111
|
+
observer.disconnect();
|
|
112
|
+
};
|
|
113
|
+
});
|
|
115
114
|
});
|
|
116
115
|
const mergeItem = (item, setItems, canDeleteFromMap = false) => {
|
|
117
116
|
let prevItem;
|
|
@@ -3,6 +3,7 @@ import {
|
|
|
3
3
|
chain,
|
|
4
4
|
getKeys,
|
|
5
5
|
hasOwnProperty,
|
|
6
|
+
invariant,
|
|
6
7
|
noop,
|
|
7
8
|
omit,
|
|
8
9
|
pick
|
|
@@ -13,6 +14,11 @@ import {
|
|
|
13
14
|
} from "./PNRLI7OV.js";
|
|
14
15
|
|
|
15
16
|
// src/utils/store.ts
|
|
17
|
+
function getInternal(store, key) {
|
|
18
|
+
const internals = store.__unstableInternals;
|
|
19
|
+
invariant(internals, "Invalid store");
|
|
20
|
+
return internals[key];
|
|
21
|
+
}
|
|
16
22
|
function createStore(initialState, ...stores) {
|
|
17
23
|
let state = initialState;
|
|
18
24
|
let prevStateBatch = state;
|
|
@@ -24,11 +30,11 @@ function createStore(initialState, ...stores) {
|
|
|
24
30
|
const listenersBatch = /* @__PURE__ */ new Set();
|
|
25
31
|
const disposables = /* @__PURE__ */ new WeakMap();
|
|
26
32
|
const listenerKeys = /* @__PURE__ */ new WeakMap();
|
|
27
|
-
const
|
|
33
|
+
const storeSetup = (callback) => {
|
|
28
34
|
setups.add(callback);
|
|
29
35
|
return () => setups.delete(callback);
|
|
30
36
|
};
|
|
31
|
-
const
|
|
37
|
+
const storeInit = () => {
|
|
32
38
|
if (initialized)
|
|
33
39
|
return noop;
|
|
34
40
|
if (!stores.length)
|
|
@@ -37,28 +43,25 @@ function createStore(initialState, ...stores) {
|
|
|
37
43
|
const desyncs = getKeys(state).map(
|
|
38
44
|
(key) => chain(
|
|
39
45
|
...stores.map((store) => {
|
|
40
|
-
var _a
|
|
46
|
+
var _a;
|
|
41
47
|
const storeState = (_a = store == null ? void 0 : store.getState) == null ? void 0 : _a.call(store);
|
|
42
48
|
if (!storeState)
|
|
43
49
|
return;
|
|
44
50
|
if (!hasOwnProperty(storeState, key))
|
|
45
51
|
return;
|
|
46
|
-
return
|
|
52
|
+
return sync(store, [key], (state2) => setState(key, state2[key]));
|
|
47
53
|
})
|
|
48
54
|
)
|
|
49
55
|
);
|
|
50
56
|
const teardowns = [];
|
|
51
57
|
setups.forEach((setup2) => teardowns.push(setup2()));
|
|
52
|
-
const cleanups = stores.map(
|
|
53
|
-
var _a;
|
|
54
|
-
return (_a = store == null ? void 0 : store.init) == null ? void 0 : _a.call(store);
|
|
55
|
-
});
|
|
58
|
+
const cleanups = stores.map(init);
|
|
56
59
|
return chain(...desyncs, ...teardowns, ...cleanups, () => {
|
|
57
60
|
initialized = false;
|
|
58
61
|
});
|
|
59
62
|
};
|
|
60
|
-
const sub = (
|
|
61
|
-
const set =
|
|
63
|
+
const sub = (keys, listener, batch2 = false) => {
|
|
64
|
+
const set = batch2 ? listenersBatch : listeners;
|
|
62
65
|
set.add(listener);
|
|
63
66
|
listenerKeys.set(listener, keys);
|
|
64
67
|
return () => {
|
|
@@ -69,15 +72,17 @@ function createStore(initialState, ...stores) {
|
|
|
69
72
|
set.delete(listener);
|
|
70
73
|
};
|
|
71
74
|
};
|
|
72
|
-
const
|
|
73
|
-
const
|
|
75
|
+
const storeSubscribe = (keys, listener) => sub(keys, listener);
|
|
76
|
+
const storeSync = (keys, listener) => {
|
|
74
77
|
disposables.set(listener, listener(state, state));
|
|
75
|
-
return sub(
|
|
78
|
+
return sub(keys, listener);
|
|
76
79
|
};
|
|
77
|
-
const
|
|
80
|
+
const storeBatch = (keys, listener) => {
|
|
78
81
|
disposables.set(listener, listener(state, prevStateBatch));
|
|
79
|
-
return sub(
|
|
82
|
+
return sub(keys, listener, true);
|
|
80
83
|
};
|
|
84
|
+
const storePick = (keys) => createStore(pick(state, keys), finalStore);
|
|
85
|
+
const storeOmit = (keys) => createStore(omit(state, keys), finalStore);
|
|
81
86
|
const getState = () => state;
|
|
82
87
|
const setState = (key, value) => {
|
|
83
88
|
if (!hasOwnProperty(state, key))
|
|
@@ -115,21 +120,56 @@ function createStore(initialState, ...stores) {
|
|
|
115
120
|
updatedKeys.clear();
|
|
116
121
|
});
|
|
117
122
|
};
|
|
118
|
-
const pick2 = (...keys) => createStore(pick(state, keys), finalStore);
|
|
119
|
-
const omit2 = (...keys) => createStore(omit(state, keys), finalStore);
|
|
120
123
|
const finalStore = {
|
|
121
|
-
setup,
|
|
122
|
-
init,
|
|
123
|
-
subscribe,
|
|
124
|
-
sync,
|
|
125
|
-
syncBatch,
|
|
126
124
|
getState,
|
|
127
125
|
setState,
|
|
128
|
-
|
|
129
|
-
|
|
126
|
+
__unstableInternals: {
|
|
127
|
+
setup: storeSetup,
|
|
128
|
+
init: storeInit,
|
|
129
|
+
subscribe: storeSubscribe,
|
|
130
|
+
sync: storeSync,
|
|
131
|
+
batch: storeBatch,
|
|
132
|
+
pick: storePick,
|
|
133
|
+
omit: storeOmit
|
|
134
|
+
}
|
|
130
135
|
};
|
|
131
136
|
return finalStore;
|
|
132
137
|
}
|
|
138
|
+
function setup(store, ...args) {
|
|
139
|
+
if (!store)
|
|
140
|
+
return;
|
|
141
|
+
return getInternal(store, "setup")(...args);
|
|
142
|
+
}
|
|
143
|
+
function init(store, ...args) {
|
|
144
|
+
if (!store)
|
|
145
|
+
return;
|
|
146
|
+
return getInternal(store, "init")(...args);
|
|
147
|
+
}
|
|
148
|
+
function subscribe(store, ...args) {
|
|
149
|
+
if (!store)
|
|
150
|
+
return;
|
|
151
|
+
return getInternal(store, "subscribe")(...args);
|
|
152
|
+
}
|
|
153
|
+
function sync(store, ...args) {
|
|
154
|
+
if (!store)
|
|
155
|
+
return;
|
|
156
|
+
return getInternal(store, "sync")(...args);
|
|
157
|
+
}
|
|
158
|
+
function batch(store, ...args) {
|
|
159
|
+
if (!store)
|
|
160
|
+
return;
|
|
161
|
+
return getInternal(store, "batch")(...args);
|
|
162
|
+
}
|
|
163
|
+
function omit2(store, ...args) {
|
|
164
|
+
if (!store)
|
|
165
|
+
return;
|
|
166
|
+
return getInternal(store, "omit")(...args);
|
|
167
|
+
}
|
|
168
|
+
function pick2(store, ...args) {
|
|
169
|
+
if (!store)
|
|
170
|
+
return;
|
|
171
|
+
return getInternal(store, "pick")(...args);
|
|
172
|
+
}
|
|
133
173
|
function mergeStore(...stores) {
|
|
134
174
|
const initialState = stores.reduce((state, store2) => {
|
|
135
175
|
var _a;
|
|
@@ -144,5 +184,12 @@ function mergeStore(...stores) {
|
|
|
144
184
|
|
|
145
185
|
export {
|
|
146
186
|
createStore,
|
|
187
|
+
setup,
|
|
188
|
+
init,
|
|
189
|
+
subscribe,
|
|
190
|
+
sync,
|
|
191
|
+
batch,
|
|
192
|
+
omit2 as omit,
|
|
193
|
+
pick2 as pick,
|
|
147
194
|
mergeStore
|
|
148
195
|
};
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createCollectionStore
|
|
3
|
-
} from "./
|
|
3
|
+
} from "./A7IMXABC.js";
|
|
4
4
|
import {
|
|
5
|
-
createStore
|
|
6
|
-
|
|
5
|
+
createStore,
|
|
6
|
+
setup,
|
|
7
|
+
sync
|
|
8
|
+
} from "./OGOHEUXI.js";
|
|
7
9
|
import {
|
|
8
10
|
defaultValue
|
|
9
11
|
} from "./WVTCK5PV.js";
|
|
@@ -152,18 +154,16 @@ function createCompositeStore(props = {}) {
|
|
|
152
154
|
focusShift: defaultValue(props.focusShift, syncState == null ? void 0 : syncState.focusShift, false)
|
|
153
155
|
});
|
|
154
156
|
const composite = createStore(initialState, collection, props.store);
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
["renderedItems", "activeId"]
|
|
166
|
-
)
|
|
157
|
+
setup(
|
|
158
|
+
composite,
|
|
159
|
+
() => sync(composite, ["renderedItems", "activeId"], (state) => {
|
|
160
|
+
composite.setState("activeId", (activeId2) => {
|
|
161
|
+
var _a2;
|
|
162
|
+
if (activeId2 !== void 0)
|
|
163
|
+
return activeId2;
|
|
164
|
+
return (_a2 = findFirstEnabledItem(state.renderedItems)) == null ? void 0 : _a2.id;
|
|
165
|
+
});
|
|
166
|
+
})
|
|
167
167
|
);
|
|
168
168
|
const getNextId = (items, orientation, hasNullItem, skip) => {
|
|
169
169
|
var _a2, _b;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createDialogStore
|
|
3
|
-
} from "./
|
|
3
|
+
} from "./LNMWV6UV.js";
|
|
4
4
|
import {
|
|
5
5
|
createStore,
|
|
6
|
-
mergeStore
|
|
7
|
-
|
|
6
|
+
mergeStore,
|
|
7
|
+
omit
|
|
8
|
+
} from "./OGOHEUXI.js";
|
|
8
9
|
import {
|
|
9
10
|
defaultValue
|
|
10
11
|
} from "./WVTCK5PV.js";
|
|
@@ -23,13 +24,13 @@ function createPopoverStore(_a = {}) {
|
|
|
23
24
|
]);
|
|
24
25
|
const store = mergeStore(
|
|
25
26
|
props.store,
|
|
26
|
-
otherPopover
|
|
27
|
+
omit(otherPopover, [
|
|
27
28
|
"arrowElement",
|
|
28
29
|
"anchorElement",
|
|
29
30
|
"contentElement",
|
|
30
31
|
"popoverElement",
|
|
31
32
|
"disclosureElement"
|
|
32
|
-
)
|
|
33
|
+
])
|
|
33
34
|
);
|
|
34
35
|
const syncState = store == null ? void 0 : store.getState();
|
|
35
36
|
const dialog = createDialogStore(__spreadProps(__spreadValues({}, props), { store }));
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createStore,
|
|
3
|
-
mergeStore
|
|
4
|
-
|
|
3
|
+
mergeStore,
|
|
4
|
+
omit,
|
|
5
|
+
setup,
|
|
6
|
+
sync
|
|
7
|
+
} from "./OGOHEUXI.js";
|
|
5
8
|
import {
|
|
6
9
|
defaultValue
|
|
7
10
|
} from "./WVTCK5PV.js";
|
|
@@ -12,10 +15,9 @@ import {
|
|
|
12
15
|
|
|
13
16
|
// src/disclosure/disclosure-store.ts
|
|
14
17
|
function createDisclosureStore(props = {}) {
|
|
15
|
-
var _a;
|
|
16
18
|
const store = mergeStore(
|
|
17
19
|
props.store,
|
|
18
|
-
(
|
|
20
|
+
omit(props.disclosure, ["contentElement", "disclosureElement"])
|
|
19
21
|
);
|
|
20
22
|
const syncState = store == null ? void 0 : store.getState();
|
|
21
23
|
const open = defaultValue(
|
|
@@ -34,35 +36,29 @@ function createDisclosureStore(props = {}) {
|
|
|
34
36
|
disclosureElement: defaultValue(syncState == null ? void 0 : syncState.disclosureElement, null)
|
|
35
37
|
};
|
|
36
38
|
const disclosure = createStore(initialState, store);
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
["animated", "animating"]
|
|
45
|
-
)
|
|
39
|
+
setup(
|
|
40
|
+
disclosure,
|
|
41
|
+
() => sync(disclosure, ["animated", "animating"], (state) => {
|
|
42
|
+
if (state.animated)
|
|
43
|
+
return;
|
|
44
|
+
disclosure.setState("animating", false);
|
|
45
|
+
})
|
|
46
46
|
);
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
["open", "animated"]
|
|
57
|
-
)
|
|
47
|
+
setup(
|
|
48
|
+
disclosure,
|
|
49
|
+
() => sync(disclosure, ["open", "animated"], (state, prev) => {
|
|
50
|
+
if (!state.animated)
|
|
51
|
+
return;
|
|
52
|
+
const mounting = state === prev;
|
|
53
|
+
const animating = mounting ? state.open : state.open !== prev.open;
|
|
54
|
+
disclosure.setState("animating", animating);
|
|
55
|
+
})
|
|
58
56
|
);
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
["open", "animating"]
|
|
65
|
-
)
|
|
57
|
+
setup(
|
|
58
|
+
disclosure,
|
|
59
|
+
() => sync(disclosure, ["open", "animating"], (state) => {
|
|
60
|
+
disclosure.setState("mounted", state.open || state.animating);
|
|
61
|
+
})
|
|
66
62
|
);
|
|
67
63
|
return __spreadProps(__spreadValues({}, disclosure), {
|
|
68
64
|
setOpen: (value) => disclosure.setState("open", value),
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createCollectionStore
|
|
3
|
-
} from "../__chunks/
|
|
4
|
-
import "../__chunks/
|
|
3
|
+
} from "../__chunks/A7IMXABC.js";
|
|
4
|
+
import "../__chunks/OGOHEUXI.js";
|
|
5
5
|
import "../__chunks/WVTCK5PV.js";
|
|
6
6
|
import "../__chunks/O35LWD4W.js";
|
|
7
7
|
import "../__chunks/PNRLI7OV.js";
|
|
@@ -23,7 +23,7 @@ export interface ComboboxStoreState extends CompositeStoreState<Item>, PopoverSt
|
|
|
23
23
|
* Live examples:
|
|
24
24
|
* - [ComboboxGroup](https://ariakit.org/examples/combobox-group)
|
|
25
25
|
* - [Combobox with links](https://ariakit.org/examples/combobox-links)
|
|
26
|
-
* - [
|
|
26
|
+
* - [Combobox filtering](https://ariakit.org/examples/combobox-filtering)
|
|
27
27
|
* - [Multi-selectable
|
|
28
28
|
* Combobox](https://ariakit.org/examples/combobox-multiple)
|
|
29
29
|
* - [Textarea with inline
|
|
@@ -1,16 +1,20 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createPopoverStore
|
|
3
|
-
} from "../__chunks/
|
|
4
|
-
import "../__chunks/
|
|
5
|
-
import "../__chunks/
|
|
3
|
+
} from "../__chunks/SOCHV2LZ.js";
|
|
4
|
+
import "../__chunks/LNMWV6UV.js";
|
|
5
|
+
import "../__chunks/WSKDP2MG.js";
|
|
6
6
|
import {
|
|
7
7
|
createCompositeStore
|
|
8
|
-
} from "../__chunks/
|
|
9
|
-
import "../__chunks/
|
|
8
|
+
} from "../__chunks/ROY5BBHL.js";
|
|
9
|
+
import "../__chunks/A7IMXABC.js";
|
|
10
10
|
import {
|
|
11
|
+
batch,
|
|
11
12
|
createStore,
|
|
12
|
-
mergeStore
|
|
13
|
-
|
|
13
|
+
mergeStore,
|
|
14
|
+
omit,
|
|
15
|
+
setup,
|
|
16
|
+
sync
|
|
17
|
+
} from "../__chunks/OGOHEUXI.js";
|
|
14
18
|
import {
|
|
15
19
|
defaultValue
|
|
16
20
|
} from "../__chunks/WVTCK5PV.js";
|
|
@@ -38,15 +42,16 @@ function createComboboxStore(_a = {}) {
|
|
|
38
42
|
]);
|
|
39
43
|
const store = mergeStore(
|
|
40
44
|
props.store,
|
|
41
|
-
menu
|
|
45
|
+
omit(menu, [
|
|
42
46
|
"baseElement",
|
|
43
47
|
"arrowElement",
|
|
44
48
|
"anchorElement",
|
|
45
49
|
"contentElement",
|
|
46
50
|
"popoverElement",
|
|
47
|
-
"disclosureElement"
|
|
48
|
-
|
|
49
|
-
|
|
51
|
+
"disclosureElement",
|
|
52
|
+
"anchorElement"
|
|
53
|
+
]),
|
|
54
|
+
omit(select, [
|
|
50
55
|
"value",
|
|
51
56
|
"items",
|
|
52
57
|
"renderedItems",
|
|
@@ -56,7 +61,7 @@ function createComboboxStore(_a = {}) {
|
|
|
56
61
|
"contentElement",
|
|
57
62
|
"popoverElement",
|
|
58
63
|
"disclosureElement"
|
|
59
|
-
)
|
|
64
|
+
])
|
|
60
65
|
);
|
|
61
66
|
const syncState = store.getState();
|
|
62
67
|
const activeId = defaultValue(
|
|
@@ -110,50 +115,42 @@ function createComboboxStore(_a = {}) {
|
|
|
110
115
|
activeValue: syncState.activeValue
|
|
111
116
|
});
|
|
112
117
|
const combobox = createStore(initialState, composite, popover, store);
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
["resetValueOnHide", "mounted"]
|
|
123
|
-
)
|
|
118
|
+
setup(
|
|
119
|
+
combobox,
|
|
120
|
+
() => sync(combobox, ["resetValueOnHide", "mounted"], (state) => {
|
|
121
|
+
if (!state.resetValueOnHide)
|
|
122
|
+
return;
|
|
123
|
+
if (state.mounted)
|
|
124
|
+
return;
|
|
125
|
+
combobox.setState("value", initialValue);
|
|
126
|
+
})
|
|
124
127
|
);
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
["mounted"]
|
|
134
|
-
)
|
|
128
|
+
setup(
|
|
129
|
+
combobox,
|
|
130
|
+
() => batch(combobox, ["mounted"], (state) => {
|
|
131
|
+
if (state.mounted)
|
|
132
|
+
return;
|
|
133
|
+
combobox.setState("activeId", activeId);
|
|
134
|
+
combobox.setState("moves", 0);
|
|
135
|
+
})
|
|
135
136
|
);
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
["moves", "activeId"]
|
|
144
|
-
)
|
|
137
|
+
setup(
|
|
138
|
+
combobox,
|
|
139
|
+
() => sync(combobox, ["moves", "activeId"], (state, prevState) => {
|
|
140
|
+
if (state.moves === prevState.moves) {
|
|
141
|
+
combobox.setState("activeValue", void 0);
|
|
142
|
+
}
|
|
143
|
+
})
|
|
145
144
|
);
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
["moves", "renderedItems"]
|
|
156
|
-
)
|
|
145
|
+
setup(
|
|
146
|
+
combobox,
|
|
147
|
+
() => batch(combobox, ["moves", "renderedItems"], (state, prev) => {
|
|
148
|
+
if (state.moves === prev.moves)
|
|
149
|
+
return;
|
|
150
|
+
const { activeId: activeId2 } = combobox.getState();
|
|
151
|
+
const activeItem = composite.item(activeId2);
|
|
152
|
+
combobox.setState("activeValue", activeItem == null ? void 0 : activeItem.value);
|
|
153
|
+
})
|
|
157
154
|
);
|
|
158
155
|
return __spreadProps(__spreadValues(__spreadValues(__spreadValues({}, popover), composite), combobox), {
|
|
159
156
|
setValue: (value) => combobox.setState("value", value)
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createPopoverStore
|
|
3
|
-
} from "../__chunks/
|
|
4
|
-
import "../__chunks/
|
|
5
|
-
import "../__chunks/
|
|
6
|
-
import "../__chunks/
|
|
3
|
+
} from "../__chunks/SOCHV2LZ.js";
|
|
4
|
+
import "../__chunks/LNMWV6UV.js";
|
|
5
|
+
import "../__chunks/WSKDP2MG.js";
|
|
6
|
+
import "../__chunks/OGOHEUXI.js";
|
|
7
7
|
import "../__chunks/WVTCK5PV.js";
|
|
8
8
|
import "../__chunks/PNRLI7OV.js";
|
|
9
9
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createCompositeStore
|
|
3
|
-
} from "../__chunks/
|
|
4
|
-
import "../__chunks/
|
|
5
|
-
import "../__chunks/
|
|
3
|
+
} from "../__chunks/ROY5BBHL.js";
|
|
4
|
+
import "../__chunks/A7IMXABC.js";
|
|
5
|
+
import "../__chunks/OGOHEUXI.js";
|
|
6
6
|
import "../__chunks/WVTCK5PV.js";
|
|
7
7
|
import "../__chunks/O35LWD4W.js";
|
|
8
8
|
import "../__chunks/5XEKIOCW.js";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createDialogStore
|
|
3
|
-
} from "../__chunks/
|
|
4
|
-
import "../__chunks/
|
|
5
|
-
import "../__chunks/
|
|
3
|
+
} from "../__chunks/LNMWV6UV.js";
|
|
4
|
+
import "../__chunks/WSKDP2MG.js";
|
|
5
|
+
import "../__chunks/OGOHEUXI.js";
|
|
6
6
|
import "../__chunks/WVTCK5PV.js";
|
|
7
7
|
import "../__chunks/PNRLI7OV.js";
|
|
8
8
|
export {
|
package/esm/form/form-store.js
CHANGED