@ariakit/core 0.4.4 → 0.4.5
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/{7DU6YMLQ.cjs → 2D5LEVE7.cjs} +6 -6
- package/cjs/__chunks/{UKR6TQI3.cjs → IMYW2UAC.cjs} +36 -20
- package/cjs/__chunks/{Y7KNI5NS.cjs → KL74MAHB.cjs} +5 -5
- package/cjs/__chunks/LPDHSEHU.cjs +71 -0
- package/cjs/__chunks/{SU2BSHGB.cjs → MHZQJPY3.cjs} +2 -2
- package/cjs/__chunks/{FFZYCAXA.cjs → QD2A4YF6.cjs} +2 -2
- package/cjs/collection/collection-store.cjs +3 -3
- package/cjs/combobox/combobox-store.cjs +40 -21
- package/cjs/combobox/combobox-store.d.cts +16 -5
- package/cjs/combobox/combobox-store.d.ts +16 -5
- package/cjs/composite/composite-store.cjs +5 -5
- package/cjs/form/form-store.cjs +3 -3
- package/cjs/menu/menu-bar-store.cjs +6 -6
- package/cjs/menu/menu-store.cjs +7 -7
- package/cjs/menubar/menubar-store.cjs +6 -6
- package/cjs/radio/radio-store.cjs +5 -5
- package/cjs/select/select-store.cjs +9 -9
- package/cjs/tab/tab-store.cjs +6 -6
- package/cjs/tag/tag-store.cjs +90 -0
- package/cjs/tag/tag-store.d.cts +80 -0
- package/cjs/tag/tag-store.d.ts +80 -0
- package/cjs/toolbar/toolbar-store.cjs +5 -5
- package/cjs/utils/dom.cjs +6 -2
- package/cjs/utils/dom.d.cts +14 -5
- package/cjs/utils/dom.d.ts +14 -5
- package/cjs/utils/events.cjs +17 -6
- package/cjs/utils/events.d.cts +6 -0
- package/cjs/utils/events.d.ts +6 -0
- package/cjs/utils/focus.cjs +13 -13
- package/cjs/utils/platform.cjs +3 -3
- package/cjs/utils/undo.cjs +10 -0
- package/cjs/utils/undo.d.cts +19 -0
- package/cjs/utils/undo.d.ts +19 -0
- package/esm/__chunks/{URUD7X4C.js → ABMC67JW.js} +1 -1
- package/esm/__chunks/EKIWAN6A.js +71 -0
- package/esm/__chunks/{RRSZHCH6.js → IUORCTET.js} +36 -20
- package/esm/__chunks/{PXYVPXSS.js → K7A7LTR3.js} +1 -1
- package/esm/__chunks/{VDNATJW2.js → QAI5BPCY.js} +1 -1
- package/esm/__chunks/{2H5K47H4.js → YVUNPQHS.js} +5 -5
- package/esm/collection/collection-store.js +2 -2
- package/esm/combobox/combobox-store.d.ts +16 -5
- package/esm/combobox/combobox-store.js +40 -21
- package/esm/composite/composite-store.js +4 -4
- package/esm/form/form-store.js +2 -2
- package/esm/menu/menu-bar-store.js +5 -5
- package/esm/menu/menu-store.js +6 -6
- package/esm/menubar/menubar-store.js +5 -5
- package/esm/radio/radio-store.js +4 -4
- package/esm/select/select-store.js +8 -8
- package/esm/tab/tab-store.js +4 -4
- package/esm/tag/tag-store.d.ts +80 -0
- package/esm/tag/tag-store.js +90 -0
- package/esm/toolbar/toolbar-store.js +4 -4
- package/esm/utils/dom.d.ts +14 -5
- package/esm/utils/dom.js +5 -1
- package/esm/utils/events.d.ts +6 -0
- package/esm/utils/events.js +13 -2
- package/esm/utils/focus.js +1 -1
- package/esm/utils/platform.js +2 -2
- package/esm/utils/undo.d.ts +19 -0
- package/esm/utils/undo.js +10 -0
- package/package.json +15 -1
- package/tag/tag-store/package.json +8 -0
- package/utils/undo/package.json +8 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# @ariakit/core
|
|
2
2
|
|
|
3
|
+
## 0.4.5
|
|
4
|
+
|
|
5
|
+
- Added new `undo` utils.
|
|
6
|
+
- Added new experimental Tag components.
|
|
7
|
+
- Added DOM utils: `isTextbox`, `getTextboxValue`.
|
|
8
|
+
- Added event function: `getInputType`.
|
|
9
|
+
- Added new [`resetValue`](https://ariakit.org/reference/use-combobox-store#resetvalue) method to combobox store.
|
|
10
|
+
- Improved JSDocs.
|
|
11
|
+
|
|
3
12
|
## 0.4.4
|
|
4
13
|
|
|
5
14
|
### Combobox `autoFocusOnHide` behavior
|
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
var
|
|
4
|
+
var _IMYW2UACcjs = require('./IMYW2UAC.cjs');
|
|
5
5
|
|
|
6
6
|
// src/utils/platform.ts
|
|
7
7
|
function isTouchDevice() {
|
|
8
|
-
return
|
|
8
|
+
return _IMYW2UACcjs.canUseDOM && !!navigator.maxTouchPoints;
|
|
9
9
|
}
|
|
10
10
|
function isApple() {
|
|
11
|
-
if (!
|
|
11
|
+
if (!_IMYW2UACcjs.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 _IMYW2UACcjs.canUseDOM && isApple() && /apple/i.test(navigator.vendor);
|
|
17
17
|
}
|
|
18
18
|
function isFirefox() {
|
|
19
|
-
return
|
|
19
|
+
return _IMYW2UACcjs.canUseDOM && /firefox\//i.test(navigator.userAgent);
|
|
20
20
|
}
|
|
21
21
|
function isMac() {
|
|
22
|
-
return
|
|
22
|
+
return _IMYW2UACcjs.canUseDOM && navigator.platform.startsWith("Mac") && !isTouchDevice();
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
|
|
@@ -89,26 +89,19 @@ function isTextField(element) {
|
|
|
89
89
|
return false;
|
|
90
90
|
}
|
|
91
91
|
}
|
|
92
|
-
function
|
|
93
|
-
|
|
94
|
-
const role = element == null ? void 0 : element.getAttribute("role");
|
|
95
|
-
if (role && allowedPopupRoles.indexOf(role) !== -1) {
|
|
96
|
-
return role;
|
|
97
|
-
}
|
|
98
|
-
return fallback;
|
|
92
|
+
function isTextbox(element) {
|
|
93
|
+
return element.isContentEditable || isTextField(element);
|
|
99
94
|
}
|
|
100
|
-
function
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
const key = popupRole;
|
|
111
|
-
return (_a = itemRoleByPopupRole[key]) != null ? _a : fallback;
|
|
95
|
+
function getTextboxValue(element) {
|
|
96
|
+
if (isTextField(element)) {
|
|
97
|
+
return element.value;
|
|
98
|
+
}
|
|
99
|
+
if (element.isContentEditable) {
|
|
100
|
+
const range = getDocument(element).createRange();
|
|
101
|
+
range.selectNodeContents(element);
|
|
102
|
+
return range.toString();
|
|
103
|
+
}
|
|
104
|
+
return "";
|
|
112
105
|
}
|
|
113
106
|
function getTextboxSelection(element) {
|
|
114
107
|
let start = 0;
|
|
@@ -130,6 +123,27 @@ function getTextboxSelection(element) {
|
|
|
130
123
|
}
|
|
131
124
|
return { start, end };
|
|
132
125
|
}
|
|
126
|
+
function getPopupRole(element, fallback) {
|
|
127
|
+
const allowedPopupRoles = ["dialog", "menu", "listbox", "tree", "grid"];
|
|
128
|
+
const role = element == null ? void 0 : element.getAttribute("role");
|
|
129
|
+
if (role && allowedPopupRoles.indexOf(role) !== -1) {
|
|
130
|
+
return role;
|
|
131
|
+
}
|
|
132
|
+
return fallback;
|
|
133
|
+
}
|
|
134
|
+
function getPopupItemRole(element, fallback) {
|
|
135
|
+
var _a;
|
|
136
|
+
const itemRoleByPopupRole = {
|
|
137
|
+
menu: "menuitem",
|
|
138
|
+
listbox: "option",
|
|
139
|
+
tree: "treeitem"
|
|
140
|
+
};
|
|
141
|
+
const popupRole = getPopupRole(element);
|
|
142
|
+
if (!popupRole)
|
|
143
|
+
return fallback;
|
|
144
|
+
const key = popupRole;
|
|
145
|
+
return (_a = itemRoleByPopupRole[key]) != null ? _a : fallback;
|
|
146
|
+
}
|
|
133
147
|
function scrollIntoViewIfNeeded(element, arg) {
|
|
134
148
|
if (isPartiallyHidden(element) && "scrollIntoView" in element) {
|
|
135
149
|
element.scrollIntoView(arg);
|
|
@@ -193,4 +207,6 @@ function setSelectionRange(element, ...args) {
|
|
|
193
207
|
|
|
194
208
|
|
|
195
209
|
|
|
196
|
-
|
|
210
|
+
|
|
211
|
+
|
|
212
|
+
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.isTextbox = isTextbox; exports.getTextboxValue = getTextboxValue; exports.getTextboxSelection = getTextboxSelection; exports.getPopupRole = getPopupRole; exports.getPopupItemRole = getPopupItemRole; exports.scrollIntoViewIfNeeded = scrollIntoViewIfNeeded; exports.getScrollingElement = getScrollingElement; exports.isPartiallyHidden = isPartiallyHidden; exports.setSelectionRange = setSelectionRange;
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
var
|
|
4
|
+
var _QD2A4YF6cjs = require('./QD2A4YF6.cjs');
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
|
8
|
+
var _ULSPM3Y3cjs = require('./ULSPM3Y3.cjs');
|
|
8
9
|
|
|
9
|
-
var _B4LYZ4EMcjs = require('./B4LYZ4EM.cjs');
|
|
10
10
|
|
|
11
11
|
|
|
12
|
-
var _EEDWPDM2cjs = require('./EEDWPDM2.cjs');
|
|
13
12
|
|
|
13
|
+
var _B4LYZ4EMcjs = require('./B4LYZ4EM.cjs');
|
|
14
14
|
|
|
15
15
|
|
|
16
|
-
var
|
|
16
|
+
var _EEDWPDM2cjs = require('./EEDWPDM2.cjs');
|
|
17
17
|
|
|
18
18
|
|
|
19
19
|
|
|
@@ -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 = _QD2A4YF6cjs.createCollectionStore.call(void 0, props);
|
|
128
128
|
const activeId = _EEDWPDM2cjs.defaultValue.call(void 0,
|
|
129
129
|
props.activeId,
|
|
130
130
|
syncState == null ? void 0 : syncState.activeId,
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";
|
|
2
|
+
|
|
3
|
+
// src/utils/undo.ts
|
|
4
|
+
function createUndoCallback(callback) {
|
|
5
|
+
return async () => {
|
|
6
|
+
const redo = await (callback == null ? void 0 : callback());
|
|
7
|
+
return createUndoCallback(async () => {
|
|
8
|
+
await (redo == null ? void 0 : redo());
|
|
9
|
+
return callback;
|
|
10
|
+
});
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
var UndoManager = createUndoManager();
|
|
14
|
+
function createUndoManager({
|
|
15
|
+
limit = 100
|
|
16
|
+
} = {}) {
|
|
17
|
+
const undoStack = [];
|
|
18
|
+
let redoStack = [];
|
|
19
|
+
let currentGroup = null;
|
|
20
|
+
const canUndo = () => undoStack.length > 0;
|
|
21
|
+
const canRedo = () => redoStack.length > 0;
|
|
22
|
+
const undo = async () => {
|
|
23
|
+
var _a;
|
|
24
|
+
if (!canUndo())
|
|
25
|
+
return;
|
|
26
|
+
currentGroup = null;
|
|
27
|
+
redoStack.push(await ((_a = undoStack.pop()) == null ? void 0 : _a()));
|
|
28
|
+
};
|
|
29
|
+
const redo = async () => {
|
|
30
|
+
var _a;
|
|
31
|
+
if (!canRedo())
|
|
32
|
+
return;
|
|
33
|
+
currentGroup = null;
|
|
34
|
+
undoStack.push(await ((_a = redoStack.pop()) == null ? void 0 : _a()));
|
|
35
|
+
};
|
|
36
|
+
const execute = async (callback, group) => {
|
|
37
|
+
if (!callback)
|
|
38
|
+
return;
|
|
39
|
+
while (undoStack.length > limit) {
|
|
40
|
+
undoStack.shift();
|
|
41
|
+
}
|
|
42
|
+
const sameGroup = group === currentGroup;
|
|
43
|
+
currentGroup = group != null ? group : null;
|
|
44
|
+
const nextIndex = sameGroup ? Math.max(0, undoStack.length - 1) : undoStack.length;
|
|
45
|
+
const undoCallback = await callback();
|
|
46
|
+
if (!undoCallback)
|
|
47
|
+
return;
|
|
48
|
+
redoStack = [];
|
|
49
|
+
const currentUndo = undoStack[nextIndex];
|
|
50
|
+
undoStack[nextIndex] = createUndoCallback(async () => {
|
|
51
|
+
await (undoCallback == null ? void 0 : undoCallback());
|
|
52
|
+
const currentRedo = await (currentUndo == null ? void 0 : currentUndo());
|
|
53
|
+
return async () => {
|
|
54
|
+
await (currentRedo == null ? void 0 : currentRedo());
|
|
55
|
+
await (callback == null ? void 0 : callback());
|
|
56
|
+
};
|
|
57
|
+
});
|
|
58
|
+
};
|
|
59
|
+
return {
|
|
60
|
+
canUndo,
|
|
61
|
+
canRedo,
|
|
62
|
+
undo,
|
|
63
|
+
redo,
|
|
64
|
+
execute
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
exports.UndoManager = UndoManager; exports.createUndoManager = createUndoManager;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
var
|
|
4
|
+
var _KL74MAHBcjs = require('./KL74MAHB.cjs');
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
var _B4LYZ4EMcjs = require('./B4LYZ4EM.cjs');
|
|
@@ -17,7 +17,7 @@ var _AV6KTKLEcjs = require('./AV6KTKLE.cjs');
|
|
|
17
17
|
function createMenubarStore(props = {}) {
|
|
18
18
|
var _a;
|
|
19
19
|
const syncState = (_a = props.store) == null ? void 0 : _a.getState();
|
|
20
|
-
const composite =
|
|
20
|
+
const composite = _KL74MAHBcjs.createCompositeStore.call(void 0, _AV6KTKLEcjs.__spreadProps.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, {}, props), {
|
|
21
21
|
orientation: _EEDWPDM2cjs.defaultValue.call(void 0,
|
|
22
22
|
props.orientation,
|
|
23
23
|
syncState == null ? void 0 : syncState.orientation,
|
|
@@ -12,7 +12,7 @@ var _B4LYZ4EMcjs = require('./B4LYZ4EM.cjs');
|
|
|
12
12
|
var _EEDWPDM2cjs = require('./EEDWPDM2.cjs');
|
|
13
13
|
|
|
14
14
|
|
|
15
|
-
var
|
|
15
|
+
var _IMYW2UACcjs = require('./IMYW2UAC.cjs');
|
|
16
16
|
|
|
17
17
|
|
|
18
18
|
|
|
@@ -62,7 +62,7 @@ function getCommonParent(items) {
|
|
|
62
62
|
}
|
|
63
63
|
parentElement = parentElement.parentElement;
|
|
64
64
|
}
|
|
65
|
-
return
|
|
65
|
+
return _IMYW2UACcjs.getDocument.call(void 0, parentElement).body;
|
|
66
66
|
}
|
|
67
67
|
function getPrivateStore(store) {
|
|
68
68
|
return store == null ? void 0 : store.__unstablePrivateStore;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
var
|
|
4
|
+
var _QD2A4YF6cjs = require('../__chunks/QD2A4YF6.cjs');
|
|
5
5
|
require('../__chunks/B4LYZ4EM.cjs');
|
|
6
6
|
require('../__chunks/EEDWPDM2.cjs');
|
|
7
|
-
require('../__chunks/
|
|
7
|
+
require('../__chunks/IMYW2UAC.cjs');
|
|
8
8
|
require('../__chunks/AV6KTKLE.cjs');
|
|
9
9
|
|
|
10
10
|
|
|
11
|
-
exports.createCollectionStore =
|
|
11
|
+
exports.createCollectionStore = _QD2A4YF6cjs.createCollectionStore;
|
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";
|
|
2
2
|
|
|
3
3
|
|
|
4
|
+
var _KL74MAHBcjs = require('../__chunks/KL74MAHB.cjs');
|
|
5
|
+
require('../__chunks/QD2A4YF6.cjs');
|
|
6
|
+
require('../__chunks/ULSPM3Y3.cjs');
|
|
7
|
+
|
|
8
|
+
|
|
4
9
|
var _5JEQEZFRcjs = require('../__chunks/5JEQEZFR.cjs');
|
|
5
10
|
require('../__chunks/LTLFSC4X.cjs');
|
|
6
11
|
require('../__chunks/AETQC2AR.cjs');
|
|
7
12
|
|
|
8
13
|
|
|
9
|
-
var _Y7KNI5NScjs = require('../__chunks/Y7KNI5NS.cjs');
|
|
10
|
-
require('../__chunks/FFZYCAXA.cjs');
|
|
11
14
|
|
|
12
15
|
|
|
13
16
|
|
|
@@ -17,30 +20,37 @@ require('../__chunks/FFZYCAXA.cjs');
|
|
|
17
20
|
var _B4LYZ4EMcjs = require('../__chunks/B4LYZ4EM.cjs');
|
|
18
21
|
|
|
19
22
|
|
|
23
|
+
|
|
20
24
|
var _EEDWPDM2cjs = require('../__chunks/EEDWPDM2.cjs');
|
|
21
25
|
|
|
22
26
|
|
|
23
|
-
var
|
|
24
|
-
require('../__chunks/
|
|
25
|
-
|
|
27
|
+
var _2D5LEVE7cjs = require('../__chunks/2D5LEVE7.cjs');
|
|
28
|
+
require('../__chunks/IMYW2UAC.cjs');
|
|
29
|
+
|
|
26
30
|
|
|
27
31
|
|
|
28
32
|
|
|
29
33
|
var _AV6KTKLEcjs = require('../__chunks/AV6KTKLE.cjs');
|
|
30
34
|
|
|
31
35
|
// src/combobox/combobox-store.ts
|
|
32
|
-
var isSafariOnMobile =
|
|
33
|
-
function createComboboxStore(
|
|
34
|
-
var _a
|
|
35
|
-
|
|
36
|
-
|
|
36
|
+
var isSafariOnMobile = _2D5LEVE7cjs.isSafari.call(void 0, ) && matchMedia("(hover:none)").matches;
|
|
37
|
+
function createComboboxStore(_a = {}) {
|
|
38
|
+
var _b = _a, {
|
|
39
|
+
tag
|
|
40
|
+
} = _b, props = _AV6KTKLEcjs.__objRest.call(void 0, _b, [
|
|
41
|
+
"tag"
|
|
42
|
+
]);
|
|
43
|
+
const store = _B4LYZ4EMcjs.mergeStore.call(void 0, props.store, _B4LYZ4EMcjs.pick.call(void 0, tag, ["value", "rtl"]));
|
|
44
|
+
_B4LYZ4EMcjs.throwOnConflictingProps.call(void 0, props, store);
|
|
45
|
+
const tagState = tag == null ? void 0 : tag.getState();
|
|
46
|
+
const syncState = store == null ? void 0 : store.getState();
|
|
37
47
|
const activeId = _EEDWPDM2cjs.defaultValue.call(void 0,
|
|
38
48
|
props.activeId,
|
|
39
49
|
syncState == null ? void 0 : syncState.activeId,
|
|
40
50
|
props.defaultActiveId,
|
|
41
51
|
null
|
|
42
52
|
);
|
|
43
|
-
const composite =
|
|
53
|
+
const composite = _KL74MAHBcjs.createCompositeStore.call(void 0, _AV6KTKLEcjs.__spreadProps.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, {}, props), {
|
|
44
54
|
activeId,
|
|
45
55
|
includesBaseElement: _EEDWPDM2cjs.defaultValue.call(void 0,
|
|
46
56
|
props.includesBaseElement,
|
|
@@ -76,6 +86,7 @@ function createComboboxStore(props = {}) {
|
|
|
76
86
|
const selectedValue = _EEDWPDM2cjs.defaultValue.call(void 0,
|
|
77
87
|
props.selectedValue,
|
|
78
88
|
syncState == null ? void 0 : syncState.selectedValue,
|
|
89
|
+
tagState == null ? void 0 : tagState.values,
|
|
79
90
|
props.defaultSelectedValue,
|
|
80
91
|
""
|
|
81
92
|
);
|
|
@@ -91,11 +102,25 @@ function createComboboxStore(props = {}) {
|
|
|
91
102
|
resetValueOnHide: _EEDWPDM2cjs.defaultValue.call(void 0,
|
|
92
103
|
props.resetValueOnHide,
|
|
93
104
|
syncState == null ? void 0 : syncState.resetValueOnHide,
|
|
94
|
-
multiSelectable
|
|
105
|
+
multiSelectable && !tag
|
|
95
106
|
),
|
|
96
107
|
activeValue: syncState == null ? void 0 : syncState.activeValue
|
|
97
108
|
});
|
|
98
|
-
const combobox = _B4LYZ4EMcjs.createStore.call(void 0, initialState, composite, popover,
|
|
109
|
+
const combobox = _B4LYZ4EMcjs.createStore.call(void 0, initialState, composite, popover, store);
|
|
110
|
+
_B4LYZ4EMcjs.setup.call(void 0, combobox, () => {
|
|
111
|
+
if (!tag)
|
|
112
|
+
return;
|
|
113
|
+
return _EEDWPDM2cjs.chain.call(void 0,
|
|
114
|
+
_B4LYZ4EMcjs.sync.call(void 0, combobox, ["selectedValue"], (state) => {
|
|
115
|
+
if (!Array.isArray(state.selectedValue))
|
|
116
|
+
return;
|
|
117
|
+
tag.setValues(state.selectedValue);
|
|
118
|
+
}),
|
|
119
|
+
_B4LYZ4EMcjs.sync.call(void 0, tag, ["values"], (state) => {
|
|
120
|
+
combobox.setState("selectedValue", state.values);
|
|
121
|
+
})
|
|
122
|
+
);
|
|
123
|
+
});
|
|
99
124
|
_B4LYZ4EMcjs.setup.call(void 0,
|
|
100
125
|
combobox,
|
|
101
126
|
() => _B4LYZ4EMcjs.sync.call(void 0, combobox, ["resetValueOnHide", "mounted"], (state) => {
|
|
@@ -106,14 +131,6 @@ function createComboboxStore(props = {}) {
|
|
|
106
131
|
combobox.setState("value", value);
|
|
107
132
|
})
|
|
108
133
|
);
|
|
109
|
-
_B4LYZ4EMcjs.setup.call(void 0,
|
|
110
|
-
combobox,
|
|
111
|
-
() => _B4LYZ4EMcjs.sync.call(void 0, combobox, ["resetValueOnSelect", "selectedValue"], (state) => {
|
|
112
|
-
if (!state.resetValueOnSelect)
|
|
113
|
-
return;
|
|
114
|
-
combobox.setState("value", value);
|
|
115
|
-
})
|
|
116
|
-
);
|
|
117
134
|
_B4LYZ4EMcjs.setup.call(void 0,
|
|
118
135
|
combobox,
|
|
119
136
|
() => _B4LYZ4EMcjs.batch.call(void 0, combobox, ["mounted"], (state) => {
|
|
@@ -142,7 +159,9 @@ function createComboboxStore(props = {}) {
|
|
|
142
159
|
})
|
|
143
160
|
);
|
|
144
161
|
return _AV6KTKLEcjs.__spreadProps.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, {}, popover), composite), combobox), {
|
|
162
|
+
tag,
|
|
145
163
|
setValue: (value2) => combobox.setState("value", value2),
|
|
164
|
+
resetValue: () => combobox.setState("value", initialState.value),
|
|
146
165
|
setSelectedValue: (selectedValue2) => combobox.setState("selectedValue", selectedValue2)
|
|
147
166
|
});
|
|
148
167
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { CompositeStoreFunctions, CompositeStoreItem, CompositeStoreOptions, CompositeStoreState } from "../composite/composite-store.js";
|
|
2
2
|
import type { PopoverStoreFunctions, PopoverStoreOptions, PopoverStoreState } from "../popover/popover-store.js";
|
|
3
|
+
import type { TagStore } from "../tag/tag-store.js";
|
|
3
4
|
import type { Store, StoreOptions, StoreProps } from "../utils/store.js";
|
|
4
5
|
import type { PickRequired, SetState } from "../utils/types.js";
|
|
5
6
|
type MutableValue<T extends ComboboxStoreSelectedValue = ComboboxStoreSelectedValue> = T extends string ? string : T;
|
|
@@ -80,14 +81,14 @@ export interface ComboboxStoreState<T extends ComboboxStoreSelectedValue = Combo
|
|
|
80
81
|
* or
|
|
81
82
|
* [`defaultSelectedValue`](https://ariakit.org/reference/combobox-provider#defaultselectedvalue)
|
|
82
83
|
* props are arrays.
|
|
83
|
-
*
|
|
84
|
-
*
|
|
85
|
-
*
|
|
86
|
-
*
|
|
84
|
+
* @deprecated Use the
|
|
85
|
+
* [`resetValueOnSelect`](https://ariakit.org/reference/combobox-item#resetvalueonselect)
|
|
86
|
+
* prop on [`ComboboxItem`](https://ariakit.org/reference/combobox-item)
|
|
87
|
+
* instead.
|
|
87
88
|
*/
|
|
88
89
|
resetValueOnSelect: boolean;
|
|
89
90
|
}
|
|
90
|
-
export interface ComboboxStoreFunctions<T extends ComboboxStoreSelectedValue = ComboboxStoreSelectedValue> extends CompositeStoreFunctions<ComboboxStoreItem>, PopoverStoreFunctions {
|
|
91
|
+
export interface ComboboxStoreFunctions<T extends ComboboxStoreSelectedValue = ComboboxStoreSelectedValue> extends Pick<ComboboxStoreOptions<T>, "tag">, CompositeStoreFunctions<ComboboxStoreItem>, PopoverStoreFunctions {
|
|
91
92
|
/**
|
|
92
93
|
* Sets the [`value`](https://ariakit.org/reference/combobox-provider#value)
|
|
93
94
|
* state.
|
|
@@ -100,6 +101,11 @@ export interface ComboboxStoreFunctions<T extends ComboboxStoreSelectedValue = C
|
|
|
100
101
|
* store.setValue((value) => value + "!");
|
|
101
102
|
*/
|
|
102
103
|
setValue: SetState<ComboboxStoreState<T>["value"]>;
|
|
104
|
+
/**
|
|
105
|
+
* Resets the [`value`](https://ariakit.org/reference/combobox-provider#value)
|
|
106
|
+
* state to its initial value.
|
|
107
|
+
*/
|
|
108
|
+
resetValue: () => void;
|
|
103
109
|
/**
|
|
104
110
|
* Sets the
|
|
105
111
|
* [`selectedValue`](https://ariakit.org/reference/combobox-provider#selectedvalue)
|
|
@@ -124,6 +130,11 @@ export interface ComboboxStoreOptions<T extends ComboboxStoreSelectedValue = Com
|
|
|
124
130
|
* @default ""
|
|
125
131
|
*/
|
|
126
132
|
defaultSelectedValue?: ComboboxStoreState<T>["selectedValue"];
|
|
133
|
+
/**
|
|
134
|
+
* A reference to a tag store. This is used when rendering a combobox within a
|
|
135
|
+
* tag list. The stores will share the same state.
|
|
136
|
+
*/
|
|
137
|
+
tag?: TagStore | null;
|
|
127
138
|
}
|
|
128
139
|
export interface ComboboxStoreProps<T extends ComboboxStoreSelectedValue = ComboboxStoreSelectedValue> extends ComboboxStoreOptions<T>, StoreProps<ComboboxStoreState<T>> {
|
|
129
140
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { CompositeStoreFunctions, CompositeStoreItem, CompositeStoreOptions, CompositeStoreState } from "../composite/composite-store.js";
|
|
2
2
|
import type { PopoverStoreFunctions, PopoverStoreOptions, PopoverStoreState } from "../popover/popover-store.js";
|
|
3
|
+
import type { TagStore } from "../tag/tag-store.js";
|
|
3
4
|
import type { Store, StoreOptions, StoreProps } from "../utils/store.js";
|
|
4
5
|
import type { PickRequired, SetState } from "../utils/types.js";
|
|
5
6
|
type MutableValue<T extends ComboboxStoreSelectedValue = ComboboxStoreSelectedValue> = T extends string ? string : T;
|
|
@@ -80,14 +81,14 @@ export interface ComboboxStoreState<T extends ComboboxStoreSelectedValue = Combo
|
|
|
80
81
|
* or
|
|
81
82
|
* [`defaultSelectedValue`](https://ariakit.org/reference/combobox-provider#defaultselectedvalue)
|
|
82
83
|
* props are arrays.
|
|
83
|
-
*
|
|
84
|
-
*
|
|
85
|
-
*
|
|
86
|
-
*
|
|
84
|
+
* @deprecated Use the
|
|
85
|
+
* [`resetValueOnSelect`](https://ariakit.org/reference/combobox-item#resetvalueonselect)
|
|
86
|
+
* prop on [`ComboboxItem`](https://ariakit.org/reference/combobox-item)
|
|
87
|
+
* instead.
|
|
87
88
|
*/
|
|
88
89
|
resetValueOnSelect: boolean;
|
|
89
90
|
}
|
|
90
|
-
export interface ComboboxStoreFunctions<T extends ComboboxStoreSelectedValue = ComboboxStoreSelectedValue> extends CompositeStoreFunctions<ComboboxStoreItem>, PopoverStoreFunctions {
|
|
91
|
+
export interface ComboboxStoreFunctions<T extends ComboboxStoreSelectedValue = ComboboxStoreSelectedValue> extends Pick<ComboboxStoreOptions<T>, "tag">, CompositeStoreFunctions<ComboboxStoreItem>, PopoverStoreFunctions {
|
|
91
92
|
/**
|
|
92
93
|
* Sets the [`value`](https://ariakit.org/reference/combobox-provider#value)
|
|
93
94
|
* state.
|
|
@@ -100,6 +101,11 @@ export interface ComboboxStoreFunctions<T extends ComboboxStoreSelectedValue = C
|
|
|
100
101
|
* store.setValue((value) => value + "!");
|
|
101
102
|
*/
|
|
102
103
|
setValue: SetState<ComboboxStoreState<T>["value"]>;
|
|
104
|
+
/**
|
|
105
|
+
* Resets the [`value`](https://ariakit.org/reference/combobox-provider#value)
|
|
106
|
+
* state to its initial value.
|
|
107
|
+
*/
|
|
108
|
+
resetValue: () => void;
|
|
103
109
|
/**
|
|
104
110
|
* Sets the
|
|
105
111
|
* [`selectedValue`](https://ariakit.org/reference/combobox-provider#selectedvalue)
|
|
@@ -124,6 +130,11 @@ export interface ComboboxStoreOptions<T extends ComboboxStoreSelectedValue = Com
|
|
|
124
130
|
* @default ""
|
|
125
131
|
*/
|
|
126
132
|
defaultSelectedValue?: ComboboxStoreState<T>["selectedValue"];
|
|
133
|
+
/**
|
|
134
|
+
* A reference to a tag store. This is used when rendering a combobox within a
|
|
135
|
+
* tag list. The stores will share the same state.
|
|
136
|
+
*/
|
|
137
|
+
tag?: TagStore | null;
|
|
127
138
|
}
|
|
128
139
|
export interface ComboboxStoreProps<T extends ComboboxStoreSelectedValue = ComboboxStoreSelectedValue> extends ComboboxStoreOptions<T>, StoreProps<ComboboxStoreState<T>> {
|
|
129
140
|
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
var
|
|
5
|
-
require('../__chunks/
|
|
4
|
+
var _KL74MAHBcjs = require('../__chunks/KL74MAHB.cjs');
|
|
5
|
+
require('../__chunks/QD2A4YF6.cjs');
|
|
6
|
+
require('../__chunks/ULSPM3Y3.cjs');
|
|
6
7
|
require('../__chunks/B4LYZ4EM.cjs');
|
|
7
8
|
require('../__chunks/EEDWPDM2.cjs');
|
|
8
|
-
require('../__chunks/
|
|
9
|
-
require('../__chunks/ULSPM3Y3.cjs');
|
|
9
|
+
require('../__chunks/IMYW2UAC.cjs');
|
|
10
10
|
require('../__chunks/AV6KTKLE.cjs');
|
|
11
11
|
|
|
12
12
|
|
|
13
|
-
exports.createCompositeStore =
|
|
13
|
+
exports.createCompositeStore = _KL74MAHBcjs.createCompositeStore;
|
package/cjs/form/form-store.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
var
|
|
4
|
+
var _QD2A4YF6cjs = require('../__chunks/QD2A4YF6.cjs');
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
|
@@ -14,7 +14,7 @@ var _B4LYZ4EMcjs = require('../__chunks/B4LYZ4EM.cjs');
|
|
|
14
14
|
|
|
15
15
|
|
|
16
16
|
var _EEDWPDM2cjs = require('../__chunks/EEDWPDM2.cjs');
|
|
17
|
-
require('../__chunks/
|
|
17
|
+
require('../__chunks/IMYW2UAC.cjs');
|
|
18
18
|
|
|
19
19
|
|
|
20
20
|
|
|
@@ -116,7 +116,7 @@ function createFormStore(props = {}) {
|
|
|
116
116
|
var _a;
|
|
117
117
|
_B4LYZ4EMcjs.throwOnConflictingProps.call(void 0, props, props.store);
|
|
118
118
|
const syncState = (_a = props.store) == null ? void 0 : _a.getState();
|
|
119
|
-
const collection =
|
|
119
|
+
const collection = _QD2A4YF6cjs.createCollectionStore.call(void 0, props);
|
|
120
120
|
const values = _EEDWPDM2cjs.defaultValue.call(void 0,
|
|
121
121
|
props.values,
|
|
122
122
|
syncState == null ? void 0 : syncState.values,
|
|
@@ -1,18 +1,18 @@
|
|
|
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 _MHZQJPY3cjs = require('../__chunks/MHZQJPY3.cjs');
|
|
5
|
+
require('../__chunks/KL74MAHB.cjs');
|
|
6
|
+
require('../__chunks/QD2A4YF6.cjs');
|
|
7
|
+
require('../__chunks/ULSPM3Y3.cjs');
|
|
7
8
|
require('../__chunks/B4LYZ4EM.cjs');
|
|
8
9
|
require('../__chunks/EEDWPDM2.cjs');
|
|
9
|
-
require('../__chunks/
|
|
10
|
-
require('../__chunks/ULSPM3Y3.cjs');
|
|
10
|
+
require('../__chunks/IMYW2UAC.cjs');
|
|
11
11
|
require('../__chunks/AV6KTKLE.cjs');
|
|
12
12
|
|
|
13
13
|
// src/menu/menu-bar-store.ts
|
|
14
14
|
function createMenuBarStore(props = {}) {
|
|
15
|
-
return
|
|
15
|
+
return _MHZQJPY3cjs.createMenubarStore.call(void 0, props);
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
|
package/cjs/menu/menu-store.cjs
CHANGED
|
@@ -2,15 +2,16 @@
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
var _UEZLSKZ4cjs = require('../__chunks/UEZLSKZ4.cjs');
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
var _KL74MAHBcjs = require('../__chunks/KL74MAHB.cjs');
|
|
8
|
+
require('../__chunks/QD2A4YF6.cjs');
|
|
9
|
+
require('../__chunks/ULSPM3Y3.cjs');
|
|
5
10
|
require('../__chunks/5JEQEZFR.cjs');
|
|
6
11
|
require('../__chunks/LTLFSC4X.cjs');
|
|
7
12
|
require('../__chunks/AETQC2AR.cjs');
|
|
8
13
|
|
|
9
14
|
|
|
10
|
-
var _Y7KNI5NScjs = require('../__chunks/Y7KNI5NS.cjs');
|
|
11
|
-
require('../__chunks/FFZYCAXA.cjs');
|
|
12
|
-
|
|
13
|
-
|
|
14
15
|
|
|
15
16
|
|
|
16
17
|
|
|
@@ -22,8 +23,7 @@ var _B4LYZ4EMcjs = require('../__chunks/B4LYZ4EM.cjs');
|
|
|
22
23
|
|
|
23
24
|
|
|
24
25
|
var _EEDWPDM2cjs = require('../__chunks/EEDWPDM2.cjs');
|
|
25
|
-
require('../__chunks/
|
|
26
|
-
require('../__chunks/ULSPM3Y3.cjs');
|
|
26
|
+
require('../__chunks/IMYW2UAC.cjs');
|
|
27
27
|
|
|
28
28
|
|
|
29
29
|
|
|
@@ -55,7 +55,7 @@ function createMenuStore(_a = {}) {
|
|
|
55
55
|
);
|
|
56
56
|
_B4LYZ4EMcjs.throwOnConflictingProps.call(void 0, props, store);
|
|
57
57
|
const syncState = store.getState();
|
|
58
|
-
const composite =
|
|
58
|
+
const composite = _KL74MAHBcjs.createCompositeStore.call(void 0, _AV6KTKLEcjs.__spreadProps.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, {}, props), {
|
|
59
59
|
store,
|
|
60
60
|
orientation: _EEDWPDM2cjs.defaultValue.call(void 0,
|
|
61
61
|
props.orientation,
|
|
@@ -1,14 +1,14 @@
|
|
|
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 _MHZQJPY3cjs = require('../__chunks/MHZQJPY3.cjs');
|
|
5
|
+
require('../__chunks/KL74MAHB.cjs');
|
|
6
|
+
require('../__chunks/QD2A4YF6.cjs');
|
|
7
|
+
require('../__chunks/ULSPM3Y3.cjs');
|
|
7
8
|
require('../__chunks/B4LYZ4EM.cjs');
|
|
8
9
|
require('../__chunks/EEDWPDM2.cjs');
|
|
9
|
-
require('../__chunks/
|
|
10
|
-
require('../__chunks/ULSPM3Y3.cjs');
|
|
10
|
+
require('../__chunks/IMYW2UAC.cjs');
|
|
11
11
|
require('../__chunks/AV6KTKLE.cjs');
|
|
12
12
|
|
|
13
13
|
|
|
14
|
-
exports.createMenubarStore =
|
|
14
|
+
exports.createMenubarStore = _MHZQJPY3cjs.createMenubarStore;
|