@ariakit/core 0.3.5 → 0.3.7
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 +18 -0
- package/cjs/__chunks/{FJSZTIOU.cjs → 46BH65MC.cjs} +4 -6
- package/cjs/__chunks/{FTB5CXVB.cjs → 5F4DVUNS.cjs} +7 -1
- package/cjs/__chunks/{AR2VJ37F.cjs → 6WBY3ZZM.cjs} +6 -6
- package/cjs/__chunks/{HOEZKRUM.cjs → 7ZUFMSXJ.cjs} +7 -7
- package/cjs/__chunks/{F5YZIIEA.cjs → GXIZMD53.cjs} +8 -2
- package/cjs/__chunks/{MYTMMWXI.cjs → GZDVJEID.cjs} +2 -2
- package/cjs/__chunks/{FFY2GSOG.cjs → JLC5A6WF.cjs} +8 -8
- package/cjs/__chunks/{F6Q5QSXF.cjs → MEHGRTJ3.cjs} +11 -11
- package/cjs/__chunks/{XVR5QRC3.cjs → PD7XZBXC.cjs} +4 -4
- package/cjs/__chunks/{G5EW4WED.cjs → YIUPKKEK.cjs} +6 -6
- package/cjs/checkbox/checkbox-store.cjs +3 -3
- package/cjs/collection/collection-store.cjs +4 -4
- package/cjs/collection/collection-store.d.cts +6 -4
- package/cjs/collection/collection-store.d.ts +6 -4
- package/cjs/combobox/combobox-store.cjs +48 -26
- package/cjs/combobox/combobox-store.d.cts +69 -21
- package/cjs/combobox/combobox-store.d.ts +69 -21
- package/cjs/composite/composite-overflow-store.cjs +5 -5
- package/cjs/composite/composite-store.cjs +5 -5
- package/cjs/composite/composite-store.d.cts +6 -8
- package/cjs/composite/composite-store.d.ts +6 -8
- package/cjs/dialog/dialog-store.cjs +4 -4
- package/cjs/disclosure/disclosure-store.cjs +3 -3
- package/cjs/disclosure/disclosure-store.d.cts +2 -0
- package/cjs/disclosure/disclosure-store.d.ts +2 -0
- package/cjs/form/form-store.cjs +8 -8
- package/cjs/hovercard/hovercard-store.cjs +6 -6
- package/cjs/hovercard/hovercard-store.d.cts +6 -0
- package/cjs/hovercard/hovercard-store.d.ts +6 -0
- package/cjs/menu/menu-bar-store.cjs +6 -6
- package/cjs/menu/menu-store.cjs +19 -19
- package/cjs/menubar/menubar-store.cjs +6 -6
- package/cjs/menubar/menubar-store.d.cts +12 -6
- package/cjs/menubar/menubar-store.d.ts +12 -6
- package/cjs/popover/popover-store.cjs +5 -5
- package/cjs/popover/popover-store.d.cts +3 -0
- package/cjs/popover/popover-store.d.ts +3 -0
- package/cjs/radio/radio-store.cjs +6 -6
- package/cjs/select/select-store.cjs +19 -19
- package/cjs/select/select-store.d.cts +28 -18
- package/cjs/select/select-store.d.ts +28 -18
- package/cjs/tab/tab-store.cjs +16 -16
- package/cjs/toolbar/toolbar-store.cjs +5 -5
- package/cjs/tooltip/tooltip-store.cjs +7 -7
- package/cjs/utils/dom.cjs +4 -2
- package/cjs/utils/dom.d.cts +9 -0
- package/cjs/utils/dom.d.ts +9 -0
- package/cjs/utils/events.cjs +5 -5
- package/cjs/utils/focus.cjs +13 -13
- package/cjs/utils/platform.cjs +3 -3
- package/cjs/utils/store.cjs +2 -2
- package/cjs/utils/store.d.cts +3 -0
- package/cjs/utils/store.d.ts +3 -0
- package/esm/__chunks/{6LSGADQM.js → ANO6WJO4.js} +8 -2
- package/esm/__chunks/{EIFVU736.js → BXH3I7ML.js} +2 -2
- package/esm/__chunks/{6EMNXRG3.js → CCU5UHQ2.js} +2 -2
- package/esm/__chunks/{DREIYIMP.js → CL47ZAPY.js} +1 -1
- package/esm/__chunks/{NIF7E7VE.js → DLOEKDPY.js} +7 -1
- package/esm/__chunks/{PCA5ARZU.js → DYD4YNLE.js} +1 -1
- package/esm/__chunks/{HJS6GJT4.js → E7OQVGGY.js} +4 -6
- package/esm/__chunks/{5UJPJ37G.js → MHPO2BXA.js} +1 -1
- package/esm/__chunks/{5BWT4GY2.js → OGMLJYDV.js} +2 -2
- package/esm/__chunks/{MRBDYBGO.js → WY3EMTH6.js} +2 -2
- package/esm/checkbox/checkbox-store.js +1 -1
- package/esm/collection/collection-store.d.ts +6 -4
- package/esm/collection/collection-store.js +3 -3
- package/esm/combobox/combobox-store.d.ts +69 -21
- package/esm/combobox/combobox-store.js +35 -13
- package/esm/composite/composite-overflow-store.js +4 -4
- package/esm/composite/composite-store.d.ts +6 -8
- package/esm/composite/composite-store.js +4 -4
- package/esm/dialog/dialog-store.js +3 -3
- package/esm/disclosure/disclosure-store.d.ts +2 -0
- package/esm/disclosure/disclosure-store.js +2 -2
- package/esm/form/form-store.js +3 -3
- package/esm/hovercard/hovercard-store.d.ts +6 -0
- package/esm/hovercard/hovercard-store.js +5 -5
- package/esm/menu/menu-bar-store.js +5 -5
- package/esm/menu/menu-store.js +8 -8
- package/esm/menubar/menubar-store.d.ts +12 -6
- package/esm/menubar/menubar-store.js +5 -5
- package/esm/popover/popover-store.d.ts +3 -0
- package/esm/popover/popover-store.js +4 -4
- package/esm/radio/radio-store.js +4 -4
- package/esm/select/select-store.d.ts +28 -18
- package/esm/select/select-store.js +7 -7
- package/esm/tab/tab-store.js +4 -4
- package/esm/toolbar/toolbar-store.js +4 -4
- package/esm/tooltip/tooltip-store.js +5 -5
- package/esm/utils/dom.d.ts +9 -0
- package/esm/utils/dom.js +5 -3
- package/esm/utils/events.js +2 -2
- package/esm/utils/focus.js +1 -1
- package/esm/utils/platform.js +2 -2
- package/esm/utils/store.d.ts +3 -0
- package/esm/utils/store.js +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# @ariakit/core
|
|
2
2
|
|
|
3
|
+
## 0.3.7
|
|
4
|
+
|
|
5
|
+
### Multi-selectable Combobox
|
|
6
|
+
|
|
7
|
+
We've added support for the [Combobox](https://ariakit.org/components/combobox) with multiple selection capabilities using a new [`selectedValue`](https://ariakit.org/reference/combobox-provider#selectedvalue) prop, along with [`defaultSelectedValue`](https://ariakit.org/reference/combobox-provider#defaultselectedvalue) and [`setSelectedValue`](https://ariakit.org/reference/combobox-provider#setselectedvalue).
|
|
8
|
+
|
|
9
|
+
This works similarly to the [`value`](https://ariakit.org/reference/select-provider#value) prop on [Select](https://ariakit.org/components/select) components. If it receives an array, the combobox will allow multiple selections. By default, it's a string that represents the selected value in a single-select combobox.
|
|
10
|
+
|
|
11
|
+
Check out the [Multi-selectable Combobox](https://ariakit.org/examples/combobox-multiple) example to see it in action.
|
|
12
|
+
|
|
13
|
+
### Other updates
|
|
14
|
+
|
|
15
|
+
- Added [`resetValueOnSelect`](https://ariakit.org/reference/combobox-provider#resetvalueonselect) state to [Combobox](https://ariakit.org/components/combobox) components.
|
|
16
|
+
|
|
17
|
+
## 0.3.6
|
|
18
|
+
|
|
19
|
+
- Fixed `setSelectionRange` error when used with [unsupported](https://html.spec.whatwg.org/multipage/input.html#concept-input-apply) input types.
|
|
20
|
+
|
|
3
21
|
## 0.3.5
|
|
4
22
|
|
|
5
23
|
- Added new `menubar` module.
|
|
@@ -50,17 +50,15 @@ function createStore(initialState, ...stores) {
|
|
|
50
50
|
return;
|
|
51
51
|
if (!_3UT5FE6Kcjs.hasOwnProperty.call(void 0, storeState, key))
|
|
52
52
|
return;
|
|
53
|
-
return sync(
|
|
54
|
-
|
|
55
|
-
[key],
|
|
56
|
-
(state2) => setState(
|
|
53
|
+
return sync(store, [key], (state2) => {
|
|
54
|
+
setState(
|
|
57
55
|
key,
|
|
58
56
|
state2[key],
|
|
59
57
|
// @ts-expect-error - Not public API. This is just to prevent
|
|
60
58
|
// infinite loops.
|
|
61
59
|
true
|
|
62
|
-
)
|
|
63
|
-
);
|
|
60
|
+
);
|
|
61
|
+
});
|
|
64
62
|
})
|
|
65
63
|
)
|
|
66
64
|
);
|
|
@@ -169,6 +169,12 @@ function isPartiallyHidden(element) {
|
|
|
169
169
|
const right = elementRect.right > scrollerRight;
|
|
170
170
|
return top || left || bottom || right;
|
|
171
171
|
}
|
|
172
|
+
function setSelectionRange(element, ...args) {
|
|
173
|
+
if (/text|search|password|tel|url/i.test(element.type)) {
|
|
174
|
+
element.setSelectionRange(...args);
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
|
|
172
178
|
|
|
173
179
|
|
|
174
180
|
|
|
@@ -188,4 +194,4 @@ function isPartiallyHidden(element) {
|
|
|
188
194
|
|
|
189
195
|
|
|
190
196
|
|
|
191
|
-
exports.canUseDOM = canUseDOM; exports.getDocument = getDocument; exports.getWindow = getWindow; exports.getActiveElement = getActiveElement; exports.contains = contains; exports.isFrame = isFrame; exports.isButton = isButton; exports.matches = matches; exports.isVisible = isVisible; exports.closest = closest; exports.isTextField = isTextField; exports.getPopupRole = getPopupRole; exports.getPopupItemRole = getPopupItemRole; exports.getTextboxSelection = getTextboxSelection; exports.scrollIntoViewIfNeeded = scrollIntoViewIfNeeded; exports.getScrollingElement = getScrollingElement; exports.isPartiallyHidden = isPartiallyHidden;
|
|
197
|
+
exports.canUseDOM = canUseDOM; exports.getDocument = getDocument; exports.getWindow = getWindow; exports.getActiveElement = getActiveElement; exports.contains = contains; exports.isFrame = isFrame; exports.isButton = isButton; exports.matches = matches; exports.isVisible = isVisible; exports.closest = closest; exports.isTextField = isTextField; exports.getPopupRole = getPopupRole; exports.getPopupItemRole = getPopupItemRole; exports.getTextboxSelection = getTextboxSelection; exports.scrollIntoViewIfNeeded = scrollIntoViewIfNeeded; exports.getScrollingElement = getScrollingElement; exports.isPartiallyHidden = isPartiallyHidden; exports.setSelectionRange = setSelectionRange;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
var
|
|
4
|
+
var _JLC5A6WFcjs = require('./JLC5A6WF.cjs');
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
var
|
|
9
|
+
var _46BH65MCcjs = require('./46BH65MC.cjs');
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
var _3UT5FE6Kcjs = require('./3UT5FE6K.cjs');
|
|
@@ -124,7 +124,7 @@ function verticalizeItems(items) {
|
|
|
124
124
|
function createCompositeStore(props = {}) {
|
|
125
125
|
var _a;
|
|
126
126
|
const syncState = (_a = props.store) == null ? void 0 : _a.getState();
|
|
127
|
-
const collection =
|
|
127
|
+
const collection = _JLC5A6WFcjs.createCollectionStore.call(void 0, props);
|
|
128
128
|
const activeId = _3UT5FE6Kcjs.defaultValue.call(void 0,
|
|
129
129
|
props.activeId,
|
|
130
130
|
syncState == null ? void 0 : syncState.activeId,
|
|
@@ -154,10 +154,10 @@ function createCompositeStore(props = {}) {
|
|
|
154
154
|
focusWrap: _3UT5FE6Kcjs.defaultValue.call(void 0, props.focusWrap, syncState == null ? void 0 : syncState.focusWrap, false),
|
|
155
155
|
focusShift: _3UT5FE6Kcjs.defaultValue.call(void 0, props.focusShift, syncState == null ? void 0 : syncState.focusShift, false)
|
|
156
156
|
});
|
|
157
|
-
const composite =
|
|
158
|
-
|
|
157
|
+
const composite = _46BH65MCcjs.createStore.call(void 0, initialState, collection, props.store);
|
|
158
|
+
_46BH65MCcjs.setup.call(void 0,
|
|
159
159
|
composite,
|
|
160
|
-
() =>
|
|
160
|
+
() => _46BH65MCcjs.sync.call(void 0, composite, ["renderedItems", "activeId"], (state) => {
|
|
161
161
|
composite.setState("activeId", (activeId2) => {
|
|
162
162
|
var _a2;
|
|
163
163
|
if (activeId2 !== void 0)
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
var
|
|
4
|
+
var _GZDVJEIDcjs = require('./GZDVJEID.cjs');
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
var
|
|
10
|
+
var _46BH65MCcjs = require('./46BH65MC.cjs');
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
var _3UT5FE6Kcjs = require('./3UT5FE6K.cjs');
|
|
@@ -24,9 +24,9 @@ function createPopoverStore(_a = {}) {
|
|
|
24
24
|
} = _b, props = _AV6KTKLEcjs.__objRest.call(void 0, _b, [
|
|
25
25
|
"popover"
|
|
26
26
|
]);
|
|
27
|
-
const store =
|
|
27
|
+
const store = _46BH65MCcjs.mergeStore.call(void 0,
|
|
28
28
|
props.store,
|
|
29
|
-
|
|
29
|
+
_46BH65MCcjs.omit.call(void 0, otherPopover, [
|
|
30
30
|
"arrowElement",
|
|
31
31
|
"anchorElement",
|
|
32
32
|
"contentElement",
|
|
@@ -34,9 +34,9 @@ function createPopoverStore(_a = {}) {
|
|
|
34
34
|
"disclosureElement"
|
|
35
35
|
])
|
|
36
36
|
);
|
|
37
|
-
|
|
37
|
+
_46BH65MCcjs.throwOnConflictingProps.call(void 0, props, store);
|
|
38
38
|
const syncState = store == null ? void 0 : store.getState();
|
|
39
|
-
const dialog =
|
|
39
|
+
const dialog = _GZDVJEIDcjs.createDialogStore.call(void 0, _AV6KTKLEcjs.__spreadProps.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, {}, props), { store }));
|
|
40
40
|
const placement = _3UT5FE6Kcjs.defaultValue.call(void 0,
|
|
41
41
|
props.placement,
|
|
42
42
|
syncState == null ? void 0 : syncState.placement,
|
|
@@ -50,7 +50,7 @@ function createPopoverStore(_a = {}) {
|
|
|
50
50
|
arrowElement: _3UT5FE6Kcjs.defaultValue.call(void 0, syncState == null ? void 0 : syncState.arrowElement, null),
|
|
51
51
|
rendered: Symbol("rendered")
|
|
52
52
|
});
|
|
53
|
-
const popover =
|
|
53
|
+
const popover = _46BH65MCcjs.createStore.call(void 0, initialState, dialog, store);
|
|
54
54
|
return _AV6KTKLEcjs.__spreadProps.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, {}, dialog), popover), {
|
|
55
55
|
setAnchorElement: (element) => popover.setState("anchorElement", element),
|
|
56
56
|
setPopoverElement: (element) => popover.setState("popoverElement", element),
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
var
|
|
4
|
+
var _6WBY3ZZMcjs = require('./6WBY3ZZM.cjs');
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
var _46BH65MCcjs = require('./46BH65MC.cjs');
|
|
5
8
|
|
|
6
9
|
|
|
7
10
|
var _3UT5FE6Kcjs = require('./3UT5FE6K.cjs');
|
|
@@ -14,7 +17,7 @@ var _AV6KTKLEcjs = require('./AV6KTKLE.cjs');
|
|
|
14
17
|
function createMenubarStore(props = {}) {
|
|
15
18
|
var _a;
|
|
16
19
|
const syncState = (_a = props.store) == null ? void 0 : _a.getState();
|
|
17
|
-
|
|
20
|
+
const composite = _6WBY3ZZMcjs.createCompositeStore.call(void 0, _AV6KTKLEcjs.__spreadProps.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, {}, props), {
|
|
18
21
|
orientation: _3UT5FE6Kcjs.defaultValue.call(void 0,
|
|
19
22
|
props.orientation,
|
|
20
23
|
syncState == null ? void 0 : syncState.orientation,
|
|
@@ -22,6 +25,9 @@ function createMenubarStore(props = {}) {
|
|
|
22
25
|
),
|
|
23
26
|
focusLoop: _3UT5FE6Kcjs.defaultValue.call(void 0, props.focusLoop, syncState == null ? void 0 : syncState.focusLoop, true)
|
|
24
27
|
}));
|
|
28
|
+
const initialState = _AV6KTKLEcjs.__spreadValues.call(void 0, {}, composite.getState());
|
|
29
|
+
const menubar = _46BH65MCcjs.createStore.call(void 0, initialState, composite, props.store);
|
|
30
|
+
return _AV6KTKLEcjs.__spreadValues.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, {}, composite), menubar);
|
|
25
31
|
}
|
|
26
32
|
|
|
27
33
|
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
var
|
|
4
|
+
var _MEHGRTJ3cjs = require('./MEHGRTJ3.cjs');
|
|
5
5
|
|
|
6
6
|
// src/dialog/dialog-store.ts
|
|
7
7
|
function createDialogStore(props = {}) {
|
|
8
|
-
return
|
|
8
|
+
return _MEHGRTJ3cjs.createDisclosureStore.call(void 0, props);
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
|
|
@@ -4,14 +4,14 @@
|
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
var
|
|
7
|
+
var _46BH65MCcjs = require('./46BH65MC.cjs');
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
var _3UT5FE6Kcjs = require('./3UT5FE6K.cjs');
|
|
12
12
|
|
|
13
13
|
|
|
14
|
-
var
|
|
14
|
+
var _5F4DVUNScjs = require('./5F4DVUNS.cjs');
|
|
15
15
|
|
|
16
16
|
|
|
17
17
|
|
|
@@ -61,11 +61,11 @@ function getCommonParent(items) {
|
|
|
61
61
|
}
|
|
62
62
|
parentElement = parentElement.parentElement;
|
|
63
63
|
}
|
|
64
|
-
return
|
|
64
|
+
return _5F4DVUNScjs.getDocument.call(void 0, parentElement).body;
|
|
65
65
|
}
|
|
66
66
|
function createCollectionStore(props = {}) {
|
|
67
67
|
var _a;
|
|
68
|
-
|
|
68
|
+
_46BH65MCcjs.throwOnConflictingProps.call(void 0, props, props.store);
|
|
69
69
|
const syncState = (_a = props.store) == null ? void 0 : _a.getState();
|
|
70
70
|
const items = _3UT5FE6Kcjs.defaultValue.call(void 0,
|
|
71
71
|
props.items,
|
|
@@ -78,18 +78,18 @@ function createCollectionStore(props = {}) {
|
|
|
78
78
|
items,
|
|
79
79
|
renderedItems: _3UT5FE6Kcjs.defaultValue.call(void 0, syncState == null ? void 0 : syncState.renderedItems, [])
|
|
80
80
|
};
|
|
81
|
-
const privateStore =
|
|
81
|
+
const privateStore = _46BH65MCcjs.createStore.call(void 0, {
|
|
82
82
|
renderedItems: initialState.renderedItems
|
|
83
83
|
});
|
|
84
|
-
const collection =
|
|
84
|
+
const collection = _46BH65MCcjs.createStore.call(void 0, initialState, props.store);
|
|
85
85
|
const sortItems = () => {
|
|
86
86
|
const state = privateStore.getState();
|
|
87
87
|
const renderedItems = sortBasedOnDOMPosition(state.renderedItems);
|
|
88
88
|
privateStore.setState("renderedItems", renderedItems);
|
|
89
89
|
collection.setState("renderedItems", renderedItems);
|
|
90
90
|
};
|
|
91
|
-
|
|
92
|
-
return
|
|
91
|
+
_46BH65MCcjs.setup.call(void 0, collection, () => {
|
|
92
|
+
return _46BH65MCcjs.batch.call(void 0, privateStore, ["renderedItems"], (state) => {
|
|
93
93
|
let firstRun = true;
|
|
94
94
|
let raf = requestAnimationFrame(sortItems);
|
|
95
95
|
if (typeof IntersectionObserver !== "function")
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
var
|
|
10
|
+
var _46BH65MCcjs = require('./46BH65MC.cjs');
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
var _3UT5FE6Kcjs = require('./3UT5FE6K.cjs');
|
|
@@ -18,11 +18,11 @@ var _AV6KTKLEcjs = require('./AV6KTKLE.cjs');
|
|
|
18
18
|
|
|
19
19
|
// src/disclosure/disclosure-store.ts
|
|
20
20
|
function createDisclosureStore(props = {}) {
|
|
21
|
-
const store =
|
|
21
|
+
const store = _46BH65MCcjs.mergeStore.call(void 0,
|
|
22
22
|
props.store,
|
|
23
|
-
|
|
23
|
+
_46BH65MCcjs.omit.call(void 0, props.disclosure, ["contentElement", "disclosureElement"])
|
|
24
24
|
);
|
|
25
|
-
|
|
25
|
+
_46BH65MCcjs.throwOnConflictingProps.call(void 0, props, store);
|
|
26
26
|
const syncState = store == null ? void 0 : store.getState();
|
|
27
27
|
const open = _3UT5FE6Kcjs.defaultValue.call(void 0,
|
|
28
28
|
props.open,
|
|
@@ -39,26 +39,26 @@ function createDisclosureStore(props = {}) {
|
|
|
39
39
|
contentElement: _3UT5FE6Kcjs.defaultValue.call(void 0, syncState == null ? void 0 : syncState.contentElement, null),
|
|
40
40
|
disclosureElement: _3UT5FE6Kcjs.defaultValue.call(void 0, syncState == null ? void 0 : syncState.disclosureElement, null)
|
|
41
41
|
};
|
|
42
|
-
const disclosure =
|
|
43
|
-
|
|
42
|
+
const disclosure = _46BH65MCcjs.createStore.call(void 0, initialState, store);
|
|
43
|
+
_46BH65MCcjs.setup.call(void 0,
|
|
44
44
|
disclosure,
|
|
45
|
-
() =>
|
|
45
|
+
() => _46BH65MCcjs.sync.call(void 0, disclosure, ["animated", "animating"], (state) => {
|
|
46
46
|
if (state.animated)
|
|
47
47
|
return;
|
|
48
48
|
disclosure.setState("animating", false);
|
|
49
49
|
})
|
|
50
50
|
);
|
|
51
|
-
|
|
51
|
+
_46BH65MCcjs.setup.call(void 0,
|
|
52
52
|
disclosure,
|
|
53
|
-
() =>
|
|
53
|
+
() => _46BH65MCcjs.subscribe.call(void 0, disclosure, ["open"], () => {
|
|
54
54
|
if (!disclosure.getState().animated)
|
|
55
55
|
return;
|
|
56
56
|
disclosure.setState("animating", true);
|
|
57
57
|
})
|
|
58
58
|
);
|
|
59
|
-
|
|
59
|
+
_46BH65MCcjs.setup.call(void 0,
|
|
60
60
|
disclosure,
|
|
61
|
-
() =>
|
|
61
|
+
() => _46BH65MCcjs.sync.call(void 0, disclosure, ["open", "animating"], (state) => {
|
|
62
62
|
disclosure.setState("mounted", state.open || state.animating);
|
|
63
63
|
})
|
|
64
64
|
);
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
var
|
|
4
|
+
var _7ZUFMSXJcjs = require('./7ZUFMSXJ.cjs');
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
var
|
|
7
|
+
var _46BH65MCcjs = require('./46BH65MC.cjs');
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
var _3UT5FE6Kcjs = require('./3UT5FE6K.cjs');
|
|
@@ -17,7 +17,7 @@ var _AV6KTKLEcjs = require('./AV6KTKLE.cjs');
|
|
|
17
17
|
function createHovercardStore(props = {}) {
|
|
18
18
|
var _a;
|
|
19
19
|
const syncState = (_a = props.store) == null ? void 0 : _a.getState();
|
|
20
|
-
const popover =
|
|
20
|
+
const popover = _7ZUFMSXJcjs.createPopoverStore.call(void 0, _AV6KTKLEcjs.__spreadProps.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, {}, props), {
|
|
21
21
|
placement: _3UT5FE6Kcjs.defaultValue.call(void 0,
|
|
22
22
|
props.placement,
|
|
23
23
|
syncState == null ? void 0 : syncState.placement,
|
|
@@ -31,7 +31,7 @@ function createHovercardStore(props = {}) {
|
|
|
31
31
|
hideTimeout: _3UT5FE6Kcjs.defaultValue.call(void 0, props.hideTimeout, syncState == null ? void 0 : syncState.hideTimeout),
|
|
32
32
|
autoFocusOnShow: _3UT5FE6Kcjs.defaultValue.call(void 0, syncState == null ? void 0 : syncState.autoFocusOnShow, false)
|
|
33
33
|
});
|
|
34
|
-
const hovercard =
|
|
34
|
+
const hovercard = _46BH65MCcjs.createStore.call(void 0, initialState, popover, props.store);
|
|
35
35
|
return _AV6KTKLEcjs.__spreadProps.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, {}, popover), hovercard), {
|
|
36
36
|
setAutoFocusOnShow: (value) => hovercard.setState("autoFocusOnShow", value)
|
|
37
37
|
});
|
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
var
|
|
4
|
+
var _5F4DVUNScjs = require('./5F4DVUNS.cjs');
|
|
5
5
|
|
|
6
6
|
// src/utils/platform.ts
|
|
7
7
|
function isTouchDevice() {
|
|
8
|
-
return
|
|
8
|
+
return _5F4DVUNScjs.canUseDOM && !!navigator.maxTouchPoints;
|
|
9
9
|
}
|
|
10
10
|
function isApple() {
|
|
11
|
-
if (!
|
|
11
|
+
if (!_5F4DVUNScjs.canUseDOM)
|
|
12
12
|
return false;
|
|
13
13
|
return /mac|iphone|ipad|ipod/i.test(navigator.platform);
|
|
14
14
|
}
|
|
15
15
|
function isSafari() {
|
|
16
|
-
return
|
|
16
|
+
return _5F4DVUNScjs.canUseDOM && isApple() && /apple/i.test(navigator.vendor);
|
|
17
17
|
}
|
|
18
18
|
function isFirefox() {
|
|
19
|
-
return
|
|
19
|
+
return _5F4DVUNScjs.canUseDOM && /firefox\//i.test(navigator.userAgent);
|
|
20
20
|
}
|
|
21
21
|
function isMac() {
|
|
22
|
-
return
|
|
22
|
+
return _5F4DVUNScjs.canUseDOM && navigator.platform.startsWith("Mac") && !isTouchDevice();
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
|
|
5
|
-
var
|
|
5
|
+
var _46BH65MCcjs = require('../__chunks/46BH65MC.cjs');
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
var _3UT5FE6Kcjs = require('../__chunks/3UT5FE6K.cjs');
|
|
@@ -14,7 +14,7 @@ var _AV6KTKLEcjs = require('../__chunks/AV6KTKLE.cjs');
|
|
|
14
14
|
// src/checkbox/checkbox-store.ts
|
|
15
15
|
function createCheckboxStore(props = {}) {
|
|
16
16
|
var _a;
|
|
17
|
-
|
|
17
|
+
_46BH65MCcjs.throwOnConflictingProps.call(void 0, props, props.store);
|
|
18
18
|
const syncState = (_a = props.store) == null ? void 0 : _a.getState();
|
|
19
19
|
const initialState = {
|
|
20
20
|
value: _3UT5FE6Kcjs.defaultValue.call(void 0,
|
|
@@ -24,7 +24,7 @@ function createCheckboxStore(props = {}) {
|
|
|
24
24
|
false
|
|
25
25
|
)
|
|
26
26
|
};
|
|
27
|
-
const checkbox =
|
|
27
|
+
const checkbox = _46BH65MCcjs.createStore.call(void 0, initialState, props.store);
|
|
28
28
|
return _AV6KTKLEcjs.__spreadProps.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, {}, checkbox), {
|
|
29
29
|
setValue: (value) => checkbox.setState("value", value)
|
|
30
30
|
});
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
var
|
|
5
|
-
require('../__chunks/
|
|
4
|
+
var _JLC5A6WFcjs = require('../__chunks/JLC5A6WF.cjs');
|
|
5
|
+
require('../__chunks/46BH65MC.cjs');
|
|
6
6
|
require('../__chunks/3UT5FE6K.cjs');
|
|
7
|
-
require('../__chunks/
|
|
7
|
+
require('../__chunks/5F4DVUNS.cjs');
|
|
8
8
|
require('../__chunks/AV6KTKLE.cjs');
|
|
9
9
|
|
|
10
10
|
|
|
11
|
-
exports.createCollectionStore =
|
|
11
|
+
exports.createCollectionStore = _JLC5A6WFcjs.createCollectionStore;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { Store, StoreOptions, StoreProps } from "../utils/store.js";
|
|
2
2
|
import type { BivariantCallback } from "../utils/types.js";
|
|
3
|
-
|
|
3
|
+
interface Item {
|
|
4
4
|
id: string;
|
|
5
5
|
element?: HTMLElement | null;
|
|
6
|
-
}
|
|
6
|
+
}
|
|
7
7
|
/**
|
|
8
8
|
* Creates a collection store.
|
|
9
9
|
*/
|
|
@@ -60,6 +60,8 @@ export interface CollectionStoreOptions<T extends Item = Item> extends StoreOpti
|
|
|
60
60
|
*/
|
|
61
61
|
defaultItems?: CollectionStoreState<T>["items"];
|
|
62
62
|
}
|
|
63
|
-
export
|
|
64
|
-
|
|
63
|
+
export interface CollectionStoreProps<T extends Item = Item> extends CollectionStoreOptions<T>, StoreProps<CollectionStoreState<T>> {
|
|
64
|
+
}
|
|
65
|
+
export interface CollectionStore<T extends Item = Item> extends CollectionStoreFunctions<T>, Store<CollectionStoreState<T>> {
|
|
66
|
+
}
|
|
65
67
|
export {};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { Store, StoreOptions, StoreProps } from "../utils/store.js";
|
|
2
2
|
import type { BivariantCallback } from "../utils/types.js";
|
|
3
|
-
|
|
3
|
+
interface Item {
|
|
4
4
|
id: string;
|
|
5
5
|
element?: HTMLElement | null;
|
|
6
|
-
}
|
|
6
|
+
}
|
|
7
7
|
/**
|
|
8
8
|
* Creates a collection store.
|
|
9
9
|
*/
|
|
@@ -60,6 +60,8 @@ export interface CollectionStoreOptions<T extends Item = Item> extends StoreOpti
|
|
|
60
60
|
*/
|
|
61
61
|
defaultItems?: CollectionStoreState<T>["items"];
|
|
62
62
|
}
|
|
63
|
-
export
|
|
64
|
-
|
|
63
|
+
export interface CollectionStoreProps<T extends Item = Item> extends CollectionStoreOptions<T>, StoreProps<CollectionStoreState<T>> {
|
|
64
|
+
}
|
|
65
|
+
export interface CollectionStore<T extends Item = Item> extends CollectionStoreFunctions<T>, Store<CollectionStoreState<T>> {
|
|
66
|
+
}
|
|
65
67
|
export {};
|
|
@@ -1,28 +1,28 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
var
|
|
5
|
-
require('../__chunks/
|
|
6
|
-
require('../__chunks/
|
|
4
|
+
var _7ZUFMSXJcjs = require('../__chunks/7ZUFMSXJ.cjs');
|
|
5
|
+
require('../__chunks/GZDVJEID.cjs');
|
|
6
|
+
require('../__chunks/MEHGRTJ3.cjs');
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
var
|
|
10
|
-
require('../__chunks/
|
|
9
|
+
var _6WBY3ZZMcjs = require('../__chunks/6WBY3ZZM.cjs');
|
|
10
|
+
require('../__chunks/JLC5A6WF.cjs');
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
|
|
16
16
|
|
|
17
|
-
var
|
|
17
|
+
var _46BH65MCcjs = require('../__chunks/46BH65MC.cjs');
|
|
18
18
|
|
|
19
19
|
|
|
20
20
|
var _3UT5FE6Kcjs = require('../__chunks/3UT5FE6K.cjs');
|
|
21
21
|
|
|
22
22
|
|
|
23
23
|
|
|
24
|
-
var
|
|
25
|
-
require('../__chunks/
|
|
24
|
+
var _YIUPKKEKcjs = require('../__chunks/YIUPKKEK.cjs');
|
|
25
|
+
require('../__chunks/5F4DVUNS.cjs');
|
|
26
26
|
require('../__chunks/ULSPM3Y3.cjs');
|
|
27
27
|
|
|
28
28
|
|
|
@@ -30,10 +30,10 @@ require('../__chunks/ULSPM3Y3.cjs');
|
|
|
30
30
|
var _AV6KTKLEcjs = require('../__chunks/AV6KTKLE.cjs');
|
|
31
31
|
|
|
32
32
|
// src/combobox/combobox-store.ts
|
|
33
|
-
var isSafariOnMobile =
|
|
33
|
+
var isSafariOnMobile = _YIUPKKEKcjs.isSafari.call(void 0, ) && _YIUPKKEKcjs.isTouchDevice.call(void 0, );
|
|
34
34
|
function createComboboxStore(props = {}) {
|
|
35
35
|
var _a;
|
|
36
|
-
|
|
36
|
+
_46BH65MCcjs.throwOnConflictingProps.call(void 0, props, props.store);
|
|
37
37
|
const syncState = (_a = props.store) == null ? void 0 : _a.getState();
|
|
38
38
|
const activeId = _3UT5FE6Kcjs.defaultValue.call(void 0,
|
|
39
39
|
props.activeId,
|
|
@@ -41,7 +41,7 @@ function createComboboxStore(props = {}) {
|
|
|
41
41
|
props.defaultActiveId,
|
|
42
42
|
null
|
|
43
43
|
);
|
|
44
|
-
const composite =
|
|
44
|
+
const composite = _6WBY3ZZMcjs.createCompositeStore.call(void 0, _AV6KTKLEcjs.__spreadProps.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, {}, props), {
|
|
45
45
|
activeId,
|
|
46
46
|
includesBaseElement: _3UT5FE6Kcjs.defaultValue.call(void 0,
|
|
47
47
|
props.includesBaseElement,
|
|
@@ -61,59 +61,80 @@ function createComboboxStore(props = {}) {
|
|
|
61
61
|
!isSafariOnMobile
|
|
62
62
|
)
|
|
63
63
|
}));
|
|
64
|
-
const popover =
|
|
64
|
+
const popover = _7ZUFMSXJcjs.createPopoverStore.call(void 0, _AV6KTKLEcjs.__spreadProps.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, {}, props), {
|
|
65
65
|
placement: _3UT5FE6Kcjs.defaultValue.call(void 0,
|
|
66
66
|
props.placement,
|
|
67
67
|
syncState == null ? void 0 : syncState.placement,
|
|
68
68
|
"bottom-start"
|
|
69
69
|
)
|
|
70
70
|
}));
|
|
71
|
-
const
|
|
71
|
+
const value = _3UT5FE6Kcjs.defaultValue.call(void 0,
|
|
72
72
|
props.value,
|
|
73
73
|
syncState == null ? void 0 : syncState.value,
|
|
74
74
|
props.defaultValue,
|
|
75
75
|
""
|
|
76
76
|
);
|
|
77
|
+
const selectedValue = _3UT5FE6Kcjs.defaultValue.call(void 0,
|
|
78
|
+
props.selectedValue,
|
|
79
|
+
syncState == null ? void 0 : syncState.selectedValue,
|
|
80
|
+
props.defaultSelectedValue,
|
|
81
|
+
""
|
|
82
|
+
);
|
|
83
|
+
const multiSelectable = Array.isArray(selectedValue);
|
|
77
84
|
const initialState = _AV6KTKLEcjs.__spreadProps.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, {}, composite.getState()), popover.getState()), {
|
|
78
|
-
value
|
|
85
|
+
value,
|
|
86
|
+
selectedValue,
|
|
87
|
+
resetValueOnSelect: _3UT5FE6Kcjs.defaultValue.call(void 0,
|
|
88
|
+
props.resetValueOnSelect,
|
|
89
|
+
syncState == null ? void 0 : syncState.resetValueOnSelect,
|
|
90
|
+
multiSelectable
|
|
91
|
+
),
|
|
79
92
|
resetValueOnHide: _3UT5FE6Kcjs.defaultValue.call(void 0,
|
|
80
93
|
props.resetValueOnHide,
|
|
81
94
|
syncState == null ? void 0 : syncState.resetValueOnHide,
|
|
82
|
-
|
|
95
|
+
multiSelectable
|
|
83
96
|
),
|
|
84
97
|
activeValue: syncState == null ? void 0 : syncState.activeValue
|
|
85
98
|
});
|
|
86
|
-
const combobox =
|
|
87
|
-
|
|
99
|
+
const combobox = _46BH65MCcjs.createStore.call(void 0, initialState, composite, popover, props.store);
|
|
100
|
+
_46BH65MCcjs.setup.call(void 0,
|
|
88
101
|
combobox,
|
|
89
|
-
() =>
|
|
102
|
+
() => _46BH65MCcjs.sync.call(void 0, combobox, ["resetValueOnHide", "mounted"], (state) => {
|
|
90
103
|
if (!state.resetValueOnHide)
|
|
91
104
|
return;
|
|
92
105
|
if (state.mounted)
|
|
93
106
|
return;
|
|
94
|
-
combobox.setState("value",
|
|
107
|
+
combobox.setState("value", value);
|
|
108
|
+
})
|
|
109
|
+
);
|
|
110
|
+
_46BH65MCcjs.setup.call(void 0,
|
|
111
|
+
combobox,
|
|
112
|
+
() => _46BH65MCcjs.sync.call(void 0, combobox, ["resetValueOnSelect", "selectedValue"], (state) => {
|
|
113
|
+
if (!state.resetValueOnSelect)
|
|
114
|
+
return;
|
|
115
|
+
combobox.setState("value", value);
|
|
95
116
|
})
|
|
96
117
|
);
|
|
97
|
-
|
|
118
|
+
_46BH65MCcjs.setup.call(void 0,
|
|
98
119
|
combobox,
|
|
99
|
-
() =>
|
|
120
|
+
() => _46BH65MCcjs.batch.call(void 0, combobox, ["mounted"], (state) => {
|
|
100
121
|
if (state.mounted)
|
|
101
122
|
return;
|
|
102
123
|
combobox.setState("activeId", activeId);
|
|
103
124
|
combobox.setState("moves", 0);
|
|
104
125
|
})
|
|
105
126
|
);
|
|
106
|
-
|
|
127
|
+
_46BH65MCcjs.setup.call(void 0,
|
|
107
128
|
combobox,
|
|
108
|
-
() =>
|
|
129
|
+
() => _46BH65MCcjs.sync.call(void 0, combobox, ["moves", "activeId"], (state, prevState) => {
|
|
109
130
|
if (state.moves === prevState.moves) {
|
|
110
131
|
combobox.setState("activeValue", void 0);
|
|
111
132
|
}
|
|
112
133
|
})
|
|
113
134
|
);
|
|
114
|
-
|
|
135
|
+
_46BH65MCcjs.setup.call(void 0,
|
|
115
136
|
combobox,
|
|
116
|
-
() =>
|
|
137
|
+
() => _46BH65MCcjs.batch.call(void 0, combobox, ["moves", "renderedItems"], (state, prev) => {
|
|
117
138
|
if (state.moves === prev.moves)
|
|
118
139
|
return;
|
|
119
140
|
const { activeId: activeId2 } = combobox.getState();
|
|
@@ -122,7 +143,8 @@ function createComboboxStore(props = {}) {
|
|
|
122
143
|
})
|
|
123
144
|
);
|
|
124
145
|
return _AV6KTKLEcjs.__spreadProps.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, {}, popover), composite), combobox), {
|
|
125
|
-
setValue: (
|
|
146
|
+
setValue: (value2) => combobox.setState("value", value2),
|
|
147
|
+
setSelectedValue: (selectedValue2) => combobox.setState("selectedValue", selectedValue2)
|
|
126
148
|
});
|
|
127
149
|
}
|
|
128
150
|
|