@ariakit/core 0.2.9 → 0.3.1
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 +33 -0
- package/cjs/__chunks/{F5DMXFQ2.cjs → 4L3HCXJY.cjs} +7 -5
- package/cjs/__chunks/{OQIG5VE3.cjs → 4OD4ZFRG.cjs} +6 -6
- package/cjs/__chunks/{V7OHZPBO.cjs → 52LQV3SV.cjs} +12 -10
- package/cjs/__chunks/{FS2K2N7U.cjs → 7GWXP6CQ.cjs} +38 -1
- package/cjs/__chunks/{DPHJ32KR.cjs → AIHTEA5D.cjs} +8 -6
- package/cjs/__chunks/{PIEJYPN7.cjs → GHET3DES.cjs} +2 -2
- package/cjs/__chunks/{MCCIH6SG.cjs → ZRCUNIY2.cjs} +4 -4
- package/cjs/checkbox/checkbox-store.cjs +4 -2
- package/cjs/collection/collection-store.cjs +3 -3
- package/cjs/combobox/combobox-store.cjs +30 -62
- package/cjs/combobox/combobox-store.d.ts +1 -15
- 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/disclosure/disclosure-store.d.ts +1 -1
- package/cjs/form/form-store.cjs +39 -12
- package/cjs/hovercard/hovercard-store.cjs +6 -6
- package/cjs/menu/menu-bar-store.cjs +4 -4
- package/cjs/menu/menu-store.cjs +46 -16
- package/cjs/menu/menu-store.d.ts +16 -2
- package/cjs/popover/popover-store.cjs +5 -5
- package/cjs/popover/popover-store.d.ts +1 -1
- package/cjs/radio/radio-store.cjs +5 -5
- package/cjs/select/select-store.cjs +20 -18
- package/cjs/select/select-store.d.ts +2 -6
- package/cjs/tab/tab-store.cjs +15 -15
- 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 +4 -2
- package/cjs/utils/store.d.ts +12 -10
- package/esm/__chunks/{COUCUJML.js → A2JA3CYE.js} +2 -2
- package/esm/__chunks/{LNMWV6UV.js → BE4I5ZDQ.js} +1 -1
- package/esm/__chunks/{ROY5BBHL.js → BL2LUIIN.js} +2 -2
- package/esm/__chunks/{OGOHEUXI.js → DEGIJZ7N.js} +38 -1
- package/esm/__chunks/{SOCHV2LZ.js → LTJQMYBN.js} +5 -3
- package/esm/__chunks/{WSKDP2MG.js → OZ4NH3RO.js} +4 -2
- package/esm/__chunks/{A7IMXABC.js → STQCKYT6.js} +4 -2
- package/esm/checkbox/checkbox-store.js +4 -2
- package/esm/collection/collection-store.js +2 -2
- package/esm/combobox/combobox-store.d.ts +1 -15
- package/esm/combobox/combobox-store.js +22 -54
- 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.d.ts +1 -1
- package/esm/disclosure/disclosure-store.js +2 -2
- package/esm/form/form-store.js +38 -11
- package/esm/hovercard/hovercard-store.js +5 -5
- package/esm/menu/menu-bar-store.js +3 -3
- package/esm/menu/menu-store.d.ts +16 -2
- package/esm/menu/menu-store.js +40 -10
- package/esm/popover/popover-store.d.ts +1 -1
- package/esm/popover/popover-store.js +4 -4
- package/esm/radio/radio-store.js +3 -3
- package/esm/select/select-store.d.ts +2 -6
- package/esm/select/select-store.js +10 -8
- 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/tsconfig.build.tsbuildinfo +1 -1
- package/esm/utils/store.d.ts +12 -10
- package/esm/utils/store.js +5 -3
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,38 @@
|
|
|
1
1
|
# @ariakit/core
|
|
2
2
|
|
|
3
|
+
## 0.3.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`#2801`](https://github.com/ariakit/ariakit/pull/2801) Fixed `values.slice` error that would occur when clicking on `FormCheckbox` that uses an integer-like field name.
|
|
8
|
+
|
|
9
|
+
## 0.3.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- [`#2783`](https://github.com/ariakit/ariakit/pull/2783) **BREAKING** _(This should affect very few people)_: The `select` and `menu` props on `useComboboxStore` have been removed. If you need to compose `Combobox` with `Select` or `Menu`, use the `combobox` prop on `useSelectStore` or `useMenuStore` instead.
|
|
14
|
+
|
|
15
|
+
- [`#2745`](https://github.com/ariakit/ariakit/pull/2745) Component stores will now throw an error if they receive another store prop in conjunction with default prop values.
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- [`#2782`](https://github.com/ariakit/ariakit/pull/2782) Fixed form store not synchrozining validate and submit callbacks with another form store through the `store` property.
|
|
20
|
+
|
|
21
|
+
- [`#2783`](https://github.com/ariakit/ariakit/pull/2783) Component store objects now contain properties for the composed stores passed to them as props. For instance, `useSelectStore({ combobox })` will return a `combobox` property if the `combobox` prop is specified.
|
|
22
|
+
|
|
23
|
+
- [`#2785`](https://github.com/ariakit/ariakit/pull/2785) Added `parent` and `menubar` properties to the menu store. These properties are automatically set when rendering nested menus or menus within a menubar.
|
|
24
|
+
|
|
25
|
+
Now, it also supports rendering nested menus that aren't nested in the React tree. In this case, you would have to supply the parent menu store manually to the child menu store.
|
|
26
|
+
|
|
27
|
+
These properties are also included in the returned menu store object, allowing you to verify whether the menu is nested. For instance:
|
|
28
|
+
|
|
29
|
+
```jsx
|
|
30
|
+
const menu = useMenuStore(props);
|
|
31
|
+
const isNested = Boolean(menu.parent);
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
- [`#2796`](https://github.com/ariakit/ariakit/pull/2796) Composed store props such as `useSelectStore({ combobox })` now accept `null` as a value.
|
|
35
|
+
|
|
3
36
|
## 0.2.9
|
|
4
37
|
|
|
5
38
|
### Patch Changes
|
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
|
|
6
|
+
var _7GWXP6CQcjs = require('./7GWXP6CQ.cjs');
|
|
6
7
|
|
|
7
8
|
|
|
8
9
|
|
|
@@ -63,6 +64,7 @@ function getCommonParent(items) {
|
|
|
63
64
|
}
|
|
64
65
|
function createCollectionStore(props = {}) {
|
|
65
66
|
var _a;
|
|
67
|
+
_7GWXP6CQcjs.throwOnConflictingProps.call(void 0, props, props.store);
|
|
66
68
|
const syncState = (_a = props.store) == null ? void 0 : _a.getState();
|
|
67
69
|
const items = _RCYVACJOcjs.defaultValue.call(void 0,
|
|
68
70
|
props.items,
|
|
@@ -75,18 +77,18 @@ function createCollectionStore(props = {}) {
|
|
|
75
77
|
items,
|
|
76
78
|
renderedItems: _RCYVACJOcjs.defaultValue.call(void 0, syncState == null ? void 0 : syncState.renderedItems, [])
|
|
77
79
|
};
|
|
78
|
-
const privateStore =
|
|
80
|
+
const privateStore = _7GWXP6CQcjs.createStore.call(void 0, {
|
|
79
81
|
renderedItems: initialState.renderedItems
|
|
80
82
|
});
|
|
81
|
-
const collection =
|
|
83
|
+
const collection = _7GWXP6CQcjs.createStore.call(void 0, initialState, props.store);
|
|
82
84
|
const sortItems = () => {
|
|
83
85
|
const state = privateStore.getState();
|
|
84
86
|
const renderedItems = sortBasedOnDOMPosition(state.renderedItems);
|
|
85
87
|
privateStore.setState("renderedItems", renderedItems);
|
|
86
88
|
collection.setState("renderedItems", renderedItems);
|
|
87
89
|
};
|
|
88
|
-
|
|
89
|
-
return
|
|
90
|
+
_7GWXP6CQcjs.setup.call(void 0, collection, () => {
|
|
91
|
+
return _7GWXP6CQcjs.batch.call(void 0, privateStore, ["renderedItems"], (state) => {
|
|
90
92
|
let firstRun = true;
|
|
91
93
|
let raf = requestAnimationFrame(sortItems);
|
|
92
94
|
if (typeof IntersectionObserver !== "function")
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _4L3HCXJYcjs = require('./4L3HCXJY.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
var
|
|
8
|
+
var _7GWXP6CQcjs = require('./7GWXP6CQ.cjs');
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
var _RCYVACJOcjs = require('./RCYVACJO.cjs');
|
|
@@ -123,7 +123,7 @@ function verticalizeItems(items) {
|
|
|
123
123
|
function createCompositeStore(props = {}) {
|
|
124
124
|
var _a;
|
|
125
125
|
const syncState = (_a = props.store) == null ? void 0 : _a.getState();
|
|
126
|
-
const collection =
|
|
126
|
+
const collection = _4L3HCXJYcjs.createCollectionStore.call(void 0, props);
|
|
127
127
|
const activeId = _RCYVACJOcjs.defaultValue.call(void 0,
|
|
128
128
|
props.activeId,
|
|
129
129
|
syncState == null ? void 0 : syncState.activeId,
|
|
@@ -153,10 +153,10 @@ function createCompositeStore(props = {}) {
|
|
|
153
153
|
focusWrap: _RCYVACJOcjs.defaultValue.call(void 0, props.focusWrap, syncState == null ? void 0 : syncState.focusWrap, false),
|
|
154
154
|
focusShift: _RCYVACJOcjs.defaultValue.call(void 0, props.focusShift, syncState == null ? void 0 : syncState.focusShift, false)
|
|
155
155
|
});
|
|
156
|
-
const composite =
|
|
157
|
-
|
|
156
|
+
const composite = _7GWXP6CQcjs.createStore.call(void 0, initialState, collection, props.store);
|
|
157
|
+
_7GWXP6CQcjs.setup.call(void 0,
|
|
158
158
|
composite,
|
|
159
|
-
() =>
|
|
159
|
+
() => _7GWXP6CQcjs.sync.call(void 0, composite, ["renderedItems", "activeId"], (state) => {
|
|
160
160
|
composite.setState("activeId", (activeId2) => {
|
|
161
161
|
var _a2;
|
|
162
162
|
if (activeId2 !== void 0)
|
|
@@ -4,7 +4,8 @@
|
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
|
|
8
|
+
var _7GWXP6CQcjs = require('./7GWXP6CQ.cjs');
|
|
8
9
|
|
|
9
10
|
|
|
10
11
|
var _RCYVACJOcjs = require('./RCYVACJO.cjs');
|
|
@@ -15,10 +16,11 @@ var _72I2GWXFcjs = require('./72I2GWXF.cjs');
|
|
|
15
16
|
|
|
16
17
|
// src/disclosure/disclosure-store.ts
|
|
17
18
|
function createDisclosureStore(props = {}) {
|
|
18
|
-
const store =
|
|
19
|
+
const store = _7GWXP6CQcjs.mergeStore.call(void 0,
|
|
19
20
|
props.store,
|
|
20
|
-
|
|
21
|
+
_7GWXP6CQcjs.omit.call(void 0, props.disclosure, ["contentElement", "disclosureElement"])
|
|
21
22
|
);
|
|
23
|
+
_7GWXP6CQcjs.throwOnConflictingProps.call(void 0, props, store);
|
|
22
24
|
const syncState = store == null ? void 0 : store.getState();
|
|
23
25
|
const open = _RCYVACJOcjs.defaultValue.call(void 0,
|
|
24
26
|
props.open,
|
|
@@ -35,18 +37,18 @@ function createDisclosureStore(props = {}) {
|
|
|
35
37
|
contentElement: _RCYVACJOcjs.defaultValue.call(void 0, syncState == null ? void 0 : syncState.contentElement, null),
|
|
36
38
|
disclosureElement: _RCYVACJOcjs.defaultValue.call(void 0, syncState == null ? void 0 : syncState.disclosureElement, null)
|
|
37
39
|
};
|
|
38
|
-
const disclosure =
|
|
39
|
-
|
|
40
|
+
const disclosure = _7GWXP6CQcjs.createStore.call(void 0, initialState, store);
|
|
41
|
+
_7GWXP6CQcjs.setup.call(void 0,
|
|
40
42
|
disclosure,
|
|
41
|
-
() =>
|
|
43
|
+
() => _7GWXP6CQcjs.sync.call(void 0, disclosure, ["animated", "animating"], (state) => {
|
|
42
44
|
if (state.animated)
|
|
43
45
|
return;
|
|
44
46
|
disclosure.setState("animating", false);
|
|
45
47
|
})
|
|
46
48
|
);
|
|
47
|
-
|
|
49
|
+
_7GWXP6CQcjs.setup.call(void 0,
|
|
48
50
|
disclosure,
|
|
49
|
-
() =>
|
|
51
|
+
() => _7GWXP6CQcjs.sync.call(void 0, disclosure, ["open", "animated"], (state, prev) => {
|
|
50
52
|
if (!state.animated)
|
|
51
53
|
return;
|
|
52
54
|
const mounting = state === prev;
|
|
@@ -54,9 +56,9 @@ function createDisclosureStore(props = {}) {
|
|
|
54
56
|
disclosure.setState("animating", animating);
|
|
55
57
|
})
|
|
56
58
|
);
|
|
57
|
-
|
|
59
|
+
_7GWXP6CQcjs.setup.call(void 0,
|
|
58
60
|
disclosure,
|
|
59
|
-
() =>
|
|
61
|
+
() => _7GWXP6CQcjs.sync.call(void 0, disclosure, ["open", "animating"], (state) => {
|
|
60
62
|
disclosure.setState("mounted", state.open || state.animating);
|
|
61
63
|
})
|
|
62
64
|
);
|
|
@@ -181,6 +181,43 @@ function mergeStore(...stores) {
|
|
|
181
181
|
const store = createStore(initialState, ...stores);
|
|
182
182
|
return store;
|
|
183
183
|
}
|
|
184
|
+
function throwOnConflictingProps(props, store) {
|
|
185
|
+
if (process.env.NODE_ENV === "production")
|
|
186
|
+
return;
|
|
187
|
+
if (!store)
|
|
188
|
+
return;
|
|
189
|
+
const defaultKeys = Object.entries(props).filter(([key, value]) => key.startsWith("default") && value !== void 0).map(([key]) => {
|
|
190
|
+
var _a;
|
|
191
|
+
const stateKey = key.replace("default", "");
|
|
192
|
+
return `${((_a = stateKey[0]) == null ? void 0 : _a.toLowerCase()) || ""}${stateKey.slice(1)}`;
|
|
193
|
+
});
|
|
194
|
+
if (!defaultKeys.length)
|
|
195
|
+
return;
|
|
196
|
+
const storeState = store.getState();
|
|
197
|
+
const conflictingProps = defaultKeys.filter(
|
|
198
|
+
(key) => _RCYVACJOcjs.hasOwnProperty.call(void 0, storeState, key)
|
|
199
|
+
);
|
|
200
|
+
if (!conflictingProps.length)
|
|
201
|
+
return;
|
|
202
|
+
throw new Error(
|
|
203
|
+
`Passing a store prop in conjunction with a default state is not supported.
|
|
204
|
+
|
|
205
|
+
const store = useSelectStore();
|
|
206
|
+
<SelectProvider store={store} defaultValue="Apple" />
|
|
207
|
+
^ ^
|
|
208
|
+
|
|
209
|
+
Instead, pass the default state to the topmost store:
|
|
210
|
+
|
|
211
|
+
const store = useSelectStore({ defaultValue: "Apple" });
|
|
212
|
+
<SelectProvider store={store} />
|
|
213
|
+
|
|
214
|
+
See https://github.com/ariakit/ariakit/pull/2745 for more details.
|
|
215
|
+
|
|
216
|
+
If there's a particular need for this, please submit a feature request at https://github.com/ariakit/ariakit
|
|
217
|
+
`
|
|
218
|
+
);
|
|
219
|
+
}
|
|
220
|
+
|
|
184
221
|
|
|
185
222
|
|
|
186
223
|
|
|
@@ -192,4 +229,4 @@ function mergeStore(...stores) {
|
|
|
192
229
|
|
|
193
230
|
|
|
194
231
|
|
|
195
|
-
exports.createStore = createStore; exports.setup = setup; exports.init = init; exports.subscribe = subscribe; exports.sync = sync; exports.batch = batch; exports.omit = omit2; exports.pick = pick2; exports.mergeStore = mergeStore;
|
|
232
|
+
exports.createStore = createStore; exports.setup = setup; exports.init = init; exports.subscribe = subscribe; exports.sync = sync; exports.batch = batch; exports.omit = omit2; exports.pick = pick2; exports.mergeStore = mergeStore; exports.throwOnConflictingProps = throwOnConflictingProps;
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _GHET3DEScjs = require('./GHET3DES.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
|
|
9
|
+
var _7GWXP6CQcjs = require('./7GWXP6CQ.cjs');
|
|
9
10
|
|
|
10
11
|
|
|
11
12
|
var _RCYVACJOcjs = require('./RCYVACJO.cjs');
|
|
@@ -22,9 +23,9 @@ function createPopoverStore(_a = {}) {
|
|
|
22
23
|
} = _b, props = _72I2GWXFcjs.__objRest.call(void 0, _b, [
|
|
23
24
|
"popover"
|
|
24
25
|
]);
|
|
25
|
-
const store =
|
|
26
|
+
const store = _7GWXP6CQcjs.mergeStore.call(void 0,
|
|
26
27
|
props.store,
|
|
27
|
-
|
|
28
|
+
_7GWXP6CQcjs.omit.call(void 0, otherPopover, [
|
|
28
29
|
"arrowElement",
|
|
29
30
|
"anchorElement",
|
|
30
31
|
"contentElement",
|
|
@@ -32,8 +33,9 @@ function createPopoverStore(_a = {}) {
|
|
|
32
33
|
"disclosureElement"
|
|
33
34
|
])
|
|
34
35
|
);
|
|
36
|
+
_7GWXP6CQcjs.throwOnConflictingProps.call(void 0, props, store);
|
|
35
37
|
const syncState = store == null ? void 0 : store.getState();
|
|
36
|
-
const dialog =
|
|
38
|
+
const dialog = _GHET3DEScjs.createDialogStore.call(void 0, _72I2GWXFcjs.__spreadProps.call(void 0, _72I2GWXFcjs.__spreadValues.call(void 0, {}, props), { store }));
|
|
37
39
|
const placement = _RCYVACJOcjs.defaultValue.call(void 0,
|
|
38
40
|
props.placement,
|
|
39
41
|
syncState == null ? void 0 : syncState.placement,
|
|
@@ -47,7 +49,7 @@ function createPopoverStore(_a = {}) {
|
|
|
47
49
|
arrowElement: _RCYVACJOcjs.defaultValue.call(void 0, syncState == null ? void 0 : syncState.arrowElement, null),
|
|
48
50
|
rendered: Symbol("rendered")
|
|
49
51
|
});
|
|
50
|
-
const popover =
|
|
52
|
+
const popover = _7GWXP6CQcjs.createStore.call(void 0, initialState, dialog, store);
|
|
51
53
|
return _72I2GWXFcjs.__spreadProps.call(void 0, _72I2GWXFcjs.__spreadValues.call(void 0, _72I2GWXFcjs.__spreadValues.call(void 0, {}, dialog), popover), {
|
|
52
54
|
setAnchorElement: (element) => popover.setState("anchorElement", element),
|
|
53
55
|
setPopoverElement: (element) => popover.setState("popoverElement", element),
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _52LQV3SVcjs = require('./52LQV3SV.cjs');
|
|
4
4
|
|
|
5
5
|
// src/dialog/dialog-store.ts
|
|
6
6
|
function createDialogStore(props = {}) {
|
|
7
|
-
return
|
|
7
|
+
return _52LQV3SVcjs.createDisclosureStore.call(void 0, props);
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _AIHTEA5Dcjs = require('./AIHTEA5D.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
var
|
|
6
|
+
var _7GWXP6CQcjs = require('./7GWXP6CQ.cjs');
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
var _RCYVACJOcjs = require('./RCYVACJO.cjs');
|
|
@@ -16,7 +16,7 @@ var _72I2GWXFcjs = require('./72I2GWXF.cjs');
|
|
|
16
16
|
function createHovercardStore(props = {}) {
|
|
17
17
|
var _a;
|
|
18
18
|
const syncState = (_a = props.store) == null ? void 0 : _a.getState();
|
|
19
|
-
const popover =
|
|
19
|
+
const popover = _AIHTEA5Dcjs.createPopoverStore.call(void 0, _72I2GWXFcjs.__spreadProps.call(void 0, _72I2GWXFcjs.__spreadValues.call(void 0, {}, props), {
|
|
20
20
|
placement: _RCYVACJOcjs.defaultValue.call(void 0,
|
|
21
21
|
props.placement,
|
|
22
22
|
syncState == null ? void 0 : syncState.placement,
|
|
@@ -30,7 +30,7 @@ function createHovercardStore(props = {}) {
|
|
|
30
30
|
hideTimeout: _RCYVACJOcjs.defaultValue.call(void 0, props.hideTimeout, syncState == null ? void 0 : syncState.hideTimeout),
|
|
31
31
|
autoFocusOnShow: _RCYVACJOcjs.defaultValue.call(void 0, syncState == null ? void 0 : syncState.autoFocusOnShow, false)
|
|
32
32
|
});
|
|
33
|
-
const hovercard =
|
|
33
|
+
const hovercard = _7GWXP6CQcjs.createStore.call(void 0, initialState, popover, props.store);
|
|
34
34
|
return _72I2GWXFcjs.__spreadProps.call(void 0, _72I2GWXFcjs.__spreadValues.call(void 0, _72I2GWXFcjs.__spreadValues.call(void 0, {}, popover), hovercard), {
|
|
35
35
|
setAutoFocusOnShow: (value) => hovercard.setState("autoFocusOnShow", value)
|
|
36
36
|
});
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
|
|
4
|
+
var _7GWXP6CQcjs = require('../__chunks/7GWXP6CQ.cjs');
|
|
4
5
|
|
|
5
6
|
|
|
6
7
|
var _RCYVACJOcjs = require('../__chunks/RCYVACJO.cjs');
|
|
@@ -12,6 +13,7 @@ var _72I2GWXFcjs = require('../__chunks/72I2GWXF.cjs');
|
|
|
12
13
|
// src/checkbox/checkbox-store.ts
|
|
13
14
|
function createCheckboxStore(props = {}) {
|
|
14
15
|
var _a;
|
|
16
|
+
_7GWXP6CQcjs.throwOnConflictingProps.call(void 0, props, props.store);
|
|
15
17
|
const syncState = (_a = props.store) == null ? void 0 : _a.getState();
|
|
16
18
|
const initialState = {
|
|
17
19
|
value: _RCYVACJOcjs.defaultValue.call(void 0,
|
|
@@ -21,7 +23,7 @@ function createCheckboxStore(props = {}) {
|
|
|
21
23
|
false
|
|
22
24
|
)
|
|
23
25
|
};
|
|
24
|
-
const checkbox =
|
|
26
|
+
const checkbox = _7GWXP6CQcjs.createStore.call(void 0, initialState, props.store);
|
|
25
27
|
return _72I2GWXFcjs.__spreadProps.call(void 0, _72I2GWXFcjs.__spreadValues.call(void 0, {}, checkbox), {
|
|
26
28
|
setValue: (value) => checkbox.setState("value", value)
|
|
27
29
|
});
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
require('../__chunks/
|
|
3
|
+
var _4L3HCXJYcjs = require('../__chunks/4L3HCXJY.cjs');
|
|
4
|
+
require('../__chunks/7GWXP6CQ.cjs');
|
|
5
5
|
require('../__chunks/RCYVACJO.cjs');
|
|
6
6
|
require('../__chunks/EXM2AW52.cjs');
|
|
7
7
|
require('../__chunks/72I2GWXF.cjs');
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
exports.createCollectionStore =
|
|
10
|
+
exports.createCollectionStore = _4L3HCXJYcjs.createCollectionStore;
|
|
@@ -1,20 +1,19 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
require('../__chunks/
|
|
5
|
-
require('../__chunks/
|
|
3
|
+
var _AIHTEA5Dcjs = require('../__chunks/AIHTEA5D.cjs');
|
|
4
|
+
require('../__chunks/GHET3DES.cjs');
|
|
5
|
+
require('../__chunks/52LQV3SV.cjs');
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
var
|
|
9
|
-
require('../__chunks/
|
|
8
|
+
var _4OD4ZFRGcjs = require('../__chunks/4OD4ZFRG.cjs');
|
|
9
|
+
require('../__chunks/4L3HCXJY.cjs');
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
|
|
16
|
-
|
|
17
|
-
var _FS2K2N7Ucjs = require('../__chunks/FS2K2N7U.cjs');
|
|
16
|
+
var _7GWXP6CQcjs = require('../__chunks/7GWXP6CQ.cjs');
|
|
18
17
|
|
|
19
18
|
|
|
20
19
|
var _RCYVACJOcjs = require('../__chunks/RCYVACJO.cjs');
|
|
@@ -27,81 +26,50 @@ require('../__chunks/GDZQUFNP.cjs');
|
|
|
27
26
|
|
|
28
27
|
|
|
29
28
|
|
|
30
|
-
|
|
31
29
|
var _72I2GWXFcjs = require('../__chunks/72I2GWXF.cjs');
|
|
32
30
|
|
|
33
31
|
// src/combobox/combobox-store.ts
|
|
34
32
|
var isSafariOnMobile = _EIRIJC7Tcjs.isSafari.call(void 0, ) && _EIRIJC7Tcjs.isTouchDevice.call(void 0, );
|
|
35
|
-
function createComboboxStore(
|
|
36
|
-
var
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
} = _b, props = _72I2GWXFcjs.__objRest.call(void 0, _b, [
|
|
40
|
-
"menu",
|
|
41
|
-
"select"
|
|
42
|
-
]);
|
|
43
|
-
const store = _FS2K2N7Ucjs.mergeStore.call(void 0,
|
|
44
|
-
props.store,
|
|
45
|
-
_FS2K2N7Ucjs.omit.call(void 0, menu, [
|
|
46
|
-
"baseElement",
|
|
47
|
-
"arrowElement",
|
|
48
|
-
"anchorElement",
|
|
49
|
-
"contentElement",
|
|
50
|
-
"popoverElement",
|
|
51
|
-
"disclosureElement",
|
|
52
|
-
"anchorElement"
|
|
53
|
-
]),
|
|
54
|
-
_FS2K2N7Ucjs.omit.call(void 0, select, [
|
|
55
|
-
"value",
|
|
56
|
-
"items",
|
|
57
|
-
"renderedItems",
|
|
58
|
-
"baseElement",
|
|
59
|
-
"arrowElement",
|
|
60
|
-
"anchorElement",
|
|
61
|
-
"contentElement",
|
|
62
|
-
"popoverElement",
|
|
63
|
-
"disclosureElement"
|
|
64
|
-
])
|
|
65
|
-
);
|
|
66
|
-
const syncState = store.getState();
|
|
33
|
+
function createComboboxStore(props = {}) {
|
|
34
|
+
var _a;
|
|
35
|
+
_7GWXP6CQcjs.throwOnConflictingProps.call(void 0, props, props.store);
|
|
36
|
+
const syncState = (_a = props.store) == null ? void 0 : _a.getState();
|
|
67
37
|
const activeId = _RCYVACJOcjs.defaultValue.call(void 0,
|
|
68
38
|
props.activeId,
|
|
69
|
-
syncState.activeId,
|
|
39
|
+
syncState == null ? void 0 : syncState.activeId,
|
|
70
40
|
props.defaultActiveId,
|
|
71
41
|
null
|
|
72
42
|
);
|
|
73
|
-
const composite =
|
|
74
|
-
store,
|
|
43
|
+
const composite = _4OD4ZFRGcjs.createCompositeStore.call(void 0, _72I2GWXFcjs.__spreadProps.call(void 0, _72I2GWXFcjs.__spreadValues.call(void 0, {}, props), {
|
|
75
44
|
activeId,
|
|
76
45
|
includesBaseElement: _RCYVACJOcjs.defaultValue.call(void 0,
|
|
77
46
|
props.includesBaseElement,
|
|
78
|
-
syncState.includesBaseElement,
|
|
47
|
+
syncState == null ? void 0 : syncState.includesBaseElement,
|
|
79
48
|
true
|
|
80
49
|
),
|
|
81
50
|
orientation: _RCYVACJOcjs.defaultValue.call(void 0,
|
|
82
51
|
props.orientation,
|
|
83
|
-
syncState.orientation,
|
|
52
|
+
syncState == null ? void 0 : syncState.orientation,
|
|
84
53
|
"vertical"
|
|
85
54
|
),
|
|
86
|
-
focusLoop: _RCYVACJOcjs.defaultValue.call(void 0, props.focusLoop, syncState.focusLoop, true),
|
|
87
|
-
focusWrap: _RCYVACJOcjs.defaultValue.call(void 0, props.focusWrap, syncState.focusWrap, true),
|
|
55
|
+
focusLoop: _RCYVACJOcjs.defaultValue.call(void 0, props.focusLoop, syncState == null ? void 0 : syncState.focusLoop, true),
|
|
56
|
+
focusWrap: _RCYVACJOcjs.defaultValue.call(void 0, props.focusWrap, syncState == null ? void 0 : syncState.focusWrap, true),
|
|
88
57
|
virtualFocus: _RCYVACJOcjs.defaultValue.call(void 0,
|
|
89
58
|
props.virtualFocus,
|
|
90
59
|
syncState == null ? void 0 : syncState.virtualFocus,
|
|
91
60
|
!isSafariOnMobile
|
|
92
61
|
)
|
|
93
62
|
}));
|
|
94
|
-
const popover =
|
|
95
|
-
store,
|
|
63
|
+
const popover = _AIHTEA5Dcjs.createPopoverStore.call(void 0, _72I2GWXFcjs.__spreadProps.call(void 0, _72I2GWXFcjs.__spreadValues.call(void 0, {}, props), {
|
|
96
64
|
placement: _RCYVACJOcjs.defaultValue.call(void 0,
|
|
97
65
|
props.placement,
|
|
98
|
-
syncState.placement,
|
|
66
|
+
syncState == null ? void 0 : syncState.placement,
|
|
99
67
|
"bottom-start"
|
|
100
68
|
)
|
|
101
69
|
}));
|
|
102
70
|
const initialValue = _RCYVACJOcjs.defaultValue.call(void 0,
|
|
103
71
|
props.value,
|
|
104
|
-
syncState.value,
|
|
72
|
+
syncState == null ? void 0 : syncState.value,
|
|
105
73
|
props.defaultValue,
|
|
106
74
|
""
|
|
107
75
|
);
|
|
@@ -109,15 +77,15 @@ function createComboboxStore(_a = {}) {
|
|
|
109
77
|
value: initialValue,
|
|
110
78
|
resetValueOnHide: _RCYVACJOcjs.defaultValue.call(void 0,
|
|
111
79
|
props.resetValueOnHide,
|
|
112
|
-
syncState.resetValueOnHide,
|
|
80
|
+
syncState == null ? void 0 : syncState.resetValueOnHide,
|
|
113
81
|
false
|
|
114
82
|
),
|
|
115
|
-
activeValue: syncState.activeValue
|
|
83
|
+
activeValue: syncState == null ? void 0 : syncState.activeValue
|
|
116
84
|
});
|
|
117
|
-
const combobox =
|
|
118
|
-
|
|
85
|
+
const combobox = _7GWXP6CQcjs.createStore.call(void 0, initialState, composite, popover, props.store);
|
|
86
|
+
_7GWXP6CQcjs.setup.call(void 0,
|
|
119
87
|
combobox,
|
|
120
|
-
() =>
|
|
88
|
+
() => _7GWXP6CQcjs.sync.call(void 0, combobox, ["resetValueOnHide", "mounted"], (state) => {
|
|
121
89
|
if (!state.resetValueOnHide)
|
|
122
90
|
return;
|
|
123
91
|
if (state.mounted)
|
|
@@ -125,26 +93,26 @@ function createComboboxStore(_a = {}) {
|
|
|
125
93
|
combobox.setState("value", initialValue);
|
|
126
94
|
})
|
|
127
95
|
);
|
|
128
|
-
|
|
96
|
+
_7GWXP6CQcjs.setup.call(void 0,
|
|
129
97
|
combobox,
|
|
130
|
-
() =>
|
|
98
|
+
() => _7GWXP6CQcjs.batch.call(void 0, combobox, ["mounted"], (state) => {
|
|
131
99
|
if (state.mounted)
|
|
132
100
|
return;
|
|
133
101
|
combobox.setState("activeId", activeId);
|
|
134
102
|
combobox.setState("moves", 0);
|
|
135
103
|
})
|
|
136
104
|
);
|
|
137
|
-
|
|
105
|
+
_7GWXP6CQcjs.setup.call(void 0,
|
|
138
106
|
combobox,
|
|
139
|
-
() =>
|
|
107
|
+
() => _7GWXP6CQcjs.sync.call(void 0, combobox, ["moves", "activeId"], (state, prevState) => {
|
|
140
108
|
if (state.moves === prevState.moves) {
|
|
141
109
|
combobox.setState("activeValue", void 0);
|
|
142
110
|
}
|
|
143
111
|
})
|
|
144
112
|
);
|
|
145
|
-
|
|
113
|
+
_7GWXP6CQcjs.setup.call(void 0,
|
|
146
114
|
combobox,
|
|
147
|
-
() =>
|
|
115
|
+
() => _7GWXP6CQcjs.batch.call(void 0, combobox, ["moves", "renderedItems"], (state, prev) => {
|
|
148
116
|
if (state.moves === prev.moves)
|
|
149
117
|
return;
|
|
150
118
|
const { activeId: activeId2 } = combobox.getState();
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import type { CompositeStoreFunctions, CompositeStoreItem, CompositeStoreOptions, CompositeStoreState } from "../composite/composite-store.js";
|
|
2
|
-
import type { MenuStore } from "../menu/menu-store.js";
|
|
3
2
|
import type { PopoverStoreFunctions, PopoverStoreOptions, PopoverStoreState } from "../popover/popover-store.js";
|
|
4
|
-
import type { SelectStore } from "../select/select-store.js";
|
|
5
3
|
import type { Store, StoreOptions, StoreProps } from "../utils/store.js";
|
|
6
4
|
import type { SetState } from "../utils/types.js";
|
|
7
5
|
type Item = CompositeStoreItem & {
|
|
@@ -10,7 +8,7 @@ type Item = CompositeStoreItem & {
|
|
|
10
8
|
/**
|
|
11
9
|
* Creates a combobox store.
|
|
12
10
|
*/
|
|
13
|
-
export declare function createComboboxStore(
|
|
11
|
+
export declare function createComboboxStore(props?: ComboboxStoreProps): ComboboxStore;
|
|
14
12
|
export type ComboboxStoreItem = Item;
|
|
15
13
|
export interface ComboboxStoreState extends CompositeStoreState<Item>, PopoverStoreState {
|
|
16
14
|
/**
|
|
@@ -64,18 +62,6 @@ export interface ComboboxStoreOptions extends StoreOptions<ComboboxStoreState, "
|
|
|
64
62
|
* @default null
|
|
65
63
|
*/
|
|
66
64
|
defaultActiveId?: CompositeStoreOptions<Item>["activeId"];
|
|
67
|
-
/**
|
|
68
|
-
* A reference to a menu store. This is used when combining the combobox with
|
|
69
|
-
* a menu (e.g., dropdown menu with a search input). The stores will share the
|
|
70
|
-
* same state.
|
|
71
|
-
*/
|
|
72
|
-
menu?: MenuStore;
|
|
73
|
-
/**
|
|
74
|
-
* A reference to a select store. This is used when combining the combobox
|
|
75
|
-
* with a select (e.g., select with a search input). The stores will share the
|
|
76
|
-
* same state.
|
|
77
|
-
*/
|
|
78
|
-
select?: SelectStore;
|
|
79
65
|
/**
|
|
80
66
|
* The combobox initial value.
|
|
81
67
|
*
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
require('../__chunks/
|
|
5
|
-
require('../__chunks/
|
|
6
|
-
require('../__chunks/
|
|
3
|
+
var _AIHTEA5Dcjs = require('../__chunks/AIHTEA5D.cjs');
|
|
4
|
+
require('../__chunks/GHET3DES.cjs');
|
|
5
|
+
require('../__chunks/52LQV3SV.cjs');
|
|
6
|
+
require('../__chunks/7GWXP6CQ.cjs');
|
|
7
7
|
require('../__chunks/RCYVACJO.cjs');
|
|
8
8
|
require('../__chunks/72I2GWXF.cjs');
|
|
9
9
|
|
|
10
10
|
// src/composite/composite-overflow-store.ts
|
|
11
11
|
function createCompositeOverflowStore(props = {}) {
|
|
12
|
-
return
|
|
12
|
+
return _AIHTEA5Dcjs.createPopoverStore.call(void 0, props);
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
require('../__chunks/
|
|
5
|
-
require('../__chunks/
|
|
3
|
+
var _4OD4ZFRGcjs = require('../__chunks/4OD4ZFRG.cjs');
|
|
4
|
+
require('../__chunks/4L3HCXJY.cjs');
|
|
5
|
+
require('../__chunks/7GWXP6CQ.cjs');
|
|
6
6
|
require('../__chunks/RCYVACJO.cjs');
|
|
7
7
|
require('../__chunks/EXM2AW52.cjs');
|
|
8
8
|
require('../__chunks/GDZQUFNP.cjs');
|
|
9
9
|
require('../__chunks/72I2GWXF.cjs');
|
|
10
10
|
|
|
11
11
|
|
|
12
|
-
exports.createCompositeStore =
|
|
12
|
+
exports.createCompositeStore = _4OD4ZFRGcjs.createCompositeStore;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
require('../__chunks/
|
|
5
|
-
require('../__chunks/
|
|
3
|
+
var _GHET3DEScjs = require('../__chunks/GHET3DES.cjs');
|
|
4
|
+
require('../__chunks/52LQV3SV.cjs');
|
|
5
|
+
require('../__chunks/7GWXP6CQ.cjs');
|
|
6
6
|
require('../__chunks/RCYVACJO.cjs');
|
|
7
7
|
require('../__chunks/72I2GWXF.cjs');
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
exports.createDialogStore =
|
|
10
|
+
exports.createDialogStore = _GHET3DEScjs.createDialogStore;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
require('../__chunks/
|
|
3
|
+
var _52LQV3SVcjs = require('../__chunks/52LQV3SV.cjs');
|
|
4
|
+
require('../__chunks/7GWXP6CQ.cjs');
|
|
5
5
|
require('../__chunks/RCYVACJO.cjs');
|
|
6
6
|
require('../__chunks/72I2GWXF.cjs');
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
exports.createDisclosureStore =
|
|
9
|
+
exports.createDisclosureStore = _52LQV3SVcjs.createDisclosureStore;
|
|
@@ -118,7 +118,7 @@ export interface DisclosureStoreOptions extends StoreOptions<DisclosureStoreStat
|
|
|
118
118
|
* `disclosureElement` won't be synced. For that, use the `store` prop
|
|
119
119
|
* instead.
|
|
120
120
|
*/
|
|
121
|
-
disclosure?: DisclosureStore;
|
|
121
|
+
disclosure?: DisclosureStore | null;
|
|
122
122
|
}
|
|
123
123
|
export type DisclosureStoreProps = DisclosureStoreOptions & StoreProps<DisclosureStoreState>;
|
|
124
124
|
export type DisclosureStore = DisclosureStoreFunctions & Store<DisclosureStoreState>;
|