@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/cjs/form/form-store.cjs
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _4L3HCXJYcjs = require('../__chunks/4L3HCXJY.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
var _7GWXP6CQcjs = require('../__chunks/7GWXP6CQ.cjs');
|
|
7
10
|
|
|
8
11
|
|
|
9
12
|
|
|
@@ -50,7 +53,7 @@ function set(values, path, value) {
|
|
|
50
53
|
const result = rest.length && (Array.isArray(nestedValues) || _RCYVACJOcjs.isObject.call(void 0, nestedValues)) ? set(nestedValues, rest, value) : value;
|
|
51
54
|
if (isIntegerKey) {
|
|
52
55
|
const index = Number(key);
|
|
53
|
-
if (values) {
|
|
56
|
+
if (values && Array.isArray(values)) {
|
|
54
57
|
return [
|
|
55
58
|
...values.slice(0, index),
|
|
56
59
|
result,
|
|
@@ -101,14 +104,18 @@ function getNameHandler(cache, prevKeys = []) {
|
|
|
101
104
|
};
|
|
102
105
|
return handler;
|
|
103
106
|
}
|
|
107
|
+
function getStoreCallbacks(store) {
|
|
108
|
+
return store == null ? void 0 : store.__unstableCallbacks;
|
|
109
|
+
}
|
|
104
110
|
function createNames() {
|
|
105
111
|
const cache = /* @__PURE__ */ Object.create(null);
|
|
106
112
|
return new Proxy(/* @__PURE__ */ Object.create(null), getNameHandler(cache));
|
|
107
113
|
}
|
|
108
114
|
function createFormStore(props = {}) {
|
|
109
115
|
var _a;
|
|
116
|
+
_7GWXP6CQcjs.throwOnConflictingProps.call(void 0, props, props.store);
|
|
110
117
|
const syncState = (_a = props.store) == null ? void 0 : _a.getState();
|
|
111
|
-
const collection =
|
|
118
|
+
const collection = _4L3HCXJYcjs.createCollectionStore.call(void 0, props);
|
|
112
119
|
const values = _RCYVACJOcjs.defaultValue.call(void 0,
|
|
113
120
|
props.values,
|
|
114
121
|
syncState == null ? void 0 : syncState.values,
|
|
@@ -137,12 +144,19 @@ function createFormStore(props = {}) {
|
|
|
137
144
|
submitFailed: _RCYVACJOcjs.defaultValue.call(void 0, syncState == null ? void 0 : syncState.submitFailed, 0),
|
|
138
145
|
valid: !hasMessages(errors)
|
|
139
146
|
});
|
|
140
|
-
const form =
|
|
141
|
-
const
|
|
142
|
-
const
|
|
147
|
+
const form = _7GWXP6CQcjs.createStore.call(void 0, initialState, collection, props.store);
|
|
148
|
+
const syncCallbacks = getStoreCallbacks(props.store);
|
|
149
|
+
const syncCallbacksState = syncCallbacks == null ? void 0 : syncCallbacks.getState();
|
|
150
|
+
const callbacksInitialState = {
|
|
151
|
+
validate: (syncCallbacksState == null ? void 0 : syncCallbacksState.validate) || [],
|
|
152
|
+
submit: (syncCallbacksState == null ? void 0 : syncCallbacksState.submit) || []
|
|
153
|
+
};
|
|
154
|
+
const callbacks = _7GWXP6CQcjs.createStore.call(void 0, callbacksInitialState, syncCallbacks);
|
|
155
|
+
_7GWXP6CQcjs.setup.call(void 0, form, () => _7GWXP6CQcjs.init.call(void 0, callbacks));
|
|
143
156
|
const validate = async () => {
|
|
144
157
|
form.setState("validating", true);
|
|
145
158
|
form.setState("errors", {});
|
|
159
|
+
const validateCallbacks = callbacks.getState().validate;
|
|
146
160
|
try {
|
|
147
161
|
for (const callback of validateCallbacks) {
|
|
148
162
|
await callback(form.getState());
|
|
@@ -195,19 +209,30 @@ function createFormStore(props = {}) {
|
|
|
195
209
|
return set(touched2, name, nextValue);
|
|
196
210
|
}),
|
|
197
211
|
onValidate: (callback) => {
|
|
198
|
-
|
|
199
|
-
return () =>
|
|
212
|
+
callbacks.setState("validate", (callbacks2) => [...callbacks2, callback]);
|
|
213
|
+
return () => {
|
|
214
|
+
callbacks.setState(
|
|
215
|
+
"validate",
|
|
216
|
+
(callbacks2) => callbacks2.filter((c) => c !== callback)
|
|
217
|
+
);
|
|
218
|
+
};
|
|
200
219
|
},
|
|
201
220
|
validate,
|
|
202
221
|
onSubmit: (callback) => {
|
|
203
|
-
|
|
204
|
-
return () =>
|
|
222
|
+
callbacks.setState("submit", (callbacks2) => [...callbacks2, callback]);
|
|
223
|
+
return () => {
|
|
224
|
+
callbacks.setState(
|
|
225
|
+
"submit",
|
|
226
|
+
(callbacks2) => callbacks2.filter((c) => c !== callback)
|
|
227
|
+
);
|
|
228
|
+
};
|
|
205
229
|
},
|
|
206
230
|
submit: async () => {
|
|
207
231
|
form.setState("submitting", true);
|
|
208
232
|
form.setState("touched", setAll(form.getState().values, true));
|
|
209
233
|
try {
|
|
210
234
|
if (await validate()) {
|
|
235
|
+
const submitCallbacks = callbacks.getState().submit;
|
|
211
236
|
for (const callback of submitCallbacks) {
|
|
212
237
|
await callback(form.getState());
|
|
213
238
|
}
|
|
@@ -234,7 +259,9 @@ function createFormStore(props = {}) {
|
|
|
234
259
|
form.setState("submitting", false);
|
|
235
260
|
form.setState("submitSucceed", 0);
|
|
236
261
|
form.setState("submitFailed", 0);
|
|
237
|
-
}
|
|
262
|
+
},
|
|
263
|
+
// @ts-expect-error Internal
|
|
264
|
+
__unstableCallbacks: callbacks
|
|
238
265
|
});
|
|
239
266
|
}
|
|
240
267
|
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
require('../__chunks/
|
|
5
|
-
require('../__chunks/
|
|
6
|
-
require('../__chunks/
|
|
7
|
-
require('../__chunks/
|
|
3
|
+
var _ZRCUNIY2cjs = require('../__chunks/ZRCUNIY2.cjs');
|
|
4
|
+
require('../__chunks/AIHTEA5D.cjs');
|
|
5
|
+
require('../__chunks/GHET3DES.cjs');
|
|
6
|
+
require('../__chunks/52LQV3SV.cjs');
|
|
7
|
+
require('../__chunks/7GWXP6CQ.cjs');
|
|
8
8
|
require('../__chunks/RCYVACJO.cjs');
|
|
9
9
|
require('../__chunks/72I2GWXF.cjs');
|
|
10
10
|
|
|
11
11
|
|
|
12
|
-
exports.createHovercardStore =
|
|
12
|
+
exports.createHovercardStore = _ZRCUNIY2cjs.createHovercardStore;
|
|
@@ -1,8 +1,8 @@
|
|
|
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
|
|
|
7
7
|
|
|
8
8
|
var _RCYVACJOcjs = require('../__chunks/RCYVACJO.cjs');
|
|
@@ -17,7 +17,7 @@ var _72I2GWXFcjs = require('../__chunks/72I2GWXF.cjs');
|
|
|
17
17
|
function createMenuBarStore(props = {}) {
|
|
18
18
|
var _a;
|
|
19
19
|
const syncState = (_a = props.store) == null ? void 0 : _a.getState();
|
|
20
|
-
return
|
|
20
|
+
return _4OD4ZFRGcjs.createCompositeStore.call(void 0, _72I2GWXFcjs.__spreadProps.call(void 0, _72I2GWXFcjs.__spreadValues.call(void 0, {}, props), {
|
|
21
21
|
orientation: _RCYVACJOcjs.defaultValue.call(void 0,
|
|
22
22
|
props.orientation,
|
|
23
23
|
syncState == null ? void 0 : syncState.orientation,
|
package/cjs/menu/menu-store.cjs
CHANGED
|
@@ -1,20 +1,22 @@
|
|
|
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 _ZRCUNIY2cjs = require('../__chunks/ZRCUNIY2.cjs');
|
|
4
|
+
require('../__chunks/AIHTEA5D.cjs');
|
|
5
|
+
require('../__chunks/GHET3DES.cjs');
|
|
6
|
+
require('../__chunks/52LQV3SV.cjs');
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
var
|
|
10
|
-
require('../__chunks/
|
|
9
|
+
var _4OD4ZFRGcjs = require('../__chunks/4OD4ZFRG.cjs');
|
|
10
|
+
require('../__chunks/4L3HCXJY.cjs');
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
var _7GWXP6CQcjs = require('../__chunks/7GWXP6CQ.cjs');
|
|
18
20
|
|
|
19
21
|
|
|
20
22
|
|
|
@@ -30,13 +32,19 @@ var _72I2GWXFcjs = require('../__chunks/72I2GWXF.cjs');
|
|
|
30
32
|
// src/menu/menu-store.ts
|
|
31
33
|
function createMenuStore(_a = {}) {
|
|
32
34
|
var _b = _a, {
|
|
33
|
-
combobox
|
|
35
|
+
combobox,
|
|
36
|
+
parent,
|
|
37
|
+
menubar
|
|
34
38
|
} = _b, props = _72I2GWXFcjs.__objRest.call(void 0, _b, [
|
|
35
|
-
"combobox"
|
|
39
|
+
"combobox",
|
|
40
|
+
"parent",
|
|
41
|
+
"menubar"
|
|
36
42
|
]);
|
|
37
|
-
const
|
|
43
|
+
const parentIsMenubar = !!menubar && !parent;
|
|
44
|
+
const store = _7GWXP6CQcjs.mergeStore.call(void 0,
|
|
38
45
|
props.store,
|
|
39
|
-
|
|
46
|
+
_7GWXP6CQcjs.pick.call(void 0, parent, ["values"]),
|
|
47
|
+
_7GWXP6CQcjs.omit.call(void 0, combobox, [
|
|
40
48
|
"arrowElement",
|
|
41
49
|
"anchorElement",
|
|
42
50
|
"contentElement",
|
|
@@ -44,8 +52,9 @@ function createMenuStore(_a = {}) {
|
|
|
44
52
|
"disclosureElement"
|
|
45
53
|
])
|
|
46
54
|
);
|
|
55
|
+
_7GWXP6CQcjs.throwOnConflictingProps.call(void 0, props, store);
|
|
47
56
|
const syncState = store.getState();
|
|
48
|
-
const composite =
|
|
57
|
+
const composite = _4OD4ZFRGcjs.createCompositeStore.call(void 0, _72I2GWXFcjs.__spreadProps.call(void 0, _72I2GWXFcjs.__spreadValues.call(void 0, {}, props), {
|
|
49
58
|
store,
|
|
50
59
|
orientation: _RCYVACJOcjs.defaultValue.call(void 0,
|
|
51
60
|
props.orientation,
|
|
@@ -53,13 +62,18 @@ function createMenuStore(_a = {}) {
|
|
|
53
62
|
"vertical"
|
|
54
63
|
)
|
|
55
64
|
}));
|
|
56
|
-
const hovercard =
|
|
65
|
+
const hovercard = _ZRCUNIY2cjs.createHovercardStore.call(void 0, _72I2GWXFcjs.__spreadProps.call(void 0, _72I2GWXFcjs.__spreadValues.call(void 0, {}, props), {
|
|
57
66
|
store,
|
|
58
67
|
placement: _RCYVACJOcjs.defaultValue.call(void 0,
|
|
59
68
|
props.placement,
|
|
60
69
|
syncState.placement,
|
|
61
70
|
"bottom-start"
|
|
62
71
|
),
|
|
72
|
+
timeout: _RCYVACJOcjs.defaultValue.call(void 0,
|
|
73
|
+
props.timeout,
|
|
74
|
+
syncState.timeout,
|
|
75
|
+
parentIsMenubar ? 0 : 150
|
|
76
|
+
),
|
|
63
77
|
hideTimeout: _RCYVACJOcjs.defaultValue.call(void 0, props.hideTimeout, syncState.hideTimeout, 0)
|
|
64
78
|
}));
|
|
65
79
|
const initialState = _72I2GWXFcjs.__spreadProps.call(void 0, _72I2GWXFcjs.__spreadValues.call(void 0, _72I2GWXFcjs.__spreadValues.call(void 0, {}, composite.getState()), hovercard.getState()), {
|
|
@@ -71,16 +85,32 @@ function createMenuStore(_a = {}) {
|
|
|
71
85
|
{}
|
|
72
86
|
)
|
|
73
87
|
});
|
|
74
|
-
const menu =
|
|
75
|
-
|
|
88
|
+
const menu = _7GWXP6CQcjs.createStore.call(void 0, initialState, composite, hovercard, store);
|
|
89
|
+
_7GWXP6CQcjs.setup.call(void 0,
|
|
76
90
|
menu,
|
|
77
|
-
() =>
|
|
91
|
+
() => _7GWXP6CQcjs.sync.call(void 0, menu, ["mounted"], (state) => {
|
|
78
92
|
if (state.mounted)
|
|
79
93
|
return;
|
|
80
94
|
menu.setState("activeId", null);
|
|
81
95
|
})
|
|
82
96
|
);
|
|
97
|
+
_7GWXP6CQcjs.setup.call(void 0,
|
|
98
|
+
menu,
|
|
99
|
+
() => _7GWXP6CQcjs.sync.call(void 0, parent, ["orientation"], (state) => {
|
|
100
|
+
menu.setState(
|
|
101
|
+
"placement",
|
|
102
|
+
state.orientation === "vertical" ? "right-start" : "bottom-start"
|
|
103
|
+
);
|
|
104
|
+
})
|
|
105
|
+
);
|
|
83
106
|
return _72I2GWXFcjs.__spreadProps.call(void 0, _72I2GWXFcjs.__spreadValues.call(void 0, _72I2GWXFcjs.__spreadValues.call(void 0, _72I2GWXFcjs.__spreadValues.call(void 0, {}, composite), hovercard), menu), {
|
|
107
|
+
combobox,
|
|
108
|
+
parent,
|
|
109
|
+
menubar,
|
|
110
|
+
hideAll: () => {
|
|
111
|
+
hovercard.hide();
|
|
112
|
+
parent == null ? void 0 : parent.hideAll();
|
|
113
|
+
},
|
|
84
114
|
setInitialFocus: (value) => menu.setState("initialFocus", value),
|
|
85
115
|
setValues: (values) => menu.setState("values", values),
|
|
86
116
|
setValue: (name, value) => {
|
package/cjs/menu/menu-store.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ import type { CompositeStoreFunctions, CompositeStoreOptions, CompositeStoreStat
|
|
|
3
3
|
import type { HovercardStoreFunctions, HovercardStoreOptions, HovercardStoreState } from "../hovercard/hovercard-store.js";
|
|
4
4
|
import type { Store, StoreOptions, StoreProps } from "../utils/store.js";
|
|
5
5
|
import type { BivariantCallback, PickRequired, SetState, SetStateAction } from "../utils/types.js";
|
|
6
|
+
import type { MenuBarStore } from "./menu-bar-store.js";
|
|
6
7
|
type Values = Record<string, string | boolean | number | Array<string | number>>;
|
|
7
8
|
export declare function createMenuStore<T extends Values = Values>(props: PickRequired<MenuStoreProps<T>, "values" | "defaultValues">): MenuStore<T>;
|
|
8
9
|
export declare function createMenuStore(props?: MenuStoreProps): MenuStore;
|
|
@@ -24,7 +25,11 @@ export interface MenuStoreState<T extends Values = Values> extends CompositeStor
|
|
|
24
25
|
/** @default 0 */
|
|
25
26
|
hideTimeout?: HovercardStoreState["hideTimeout"];
|
|
26
27
|
}
|
|
27
|
-
export interface MenuStoreFunctions<T extends Values = Values> extends CompositeStoreFunctions, HovercardStoreFunctions {
|
|
28
|
+
export interface MenuStoreFunctions<T extends Values = Values> extends Pick<MenuStoreOptions, "combobox" | "parent" | "menubar">, CompositeStoreFunctions, HovercardStoreFunctions {
|
|
29
|
+
/**
|
|
30
|
+
* Hides the menu and all its parent menus.
|
|
31
|
+
*/
|
|
32
|
+
hideAll: () => void;
|
|
28
33
|
/**
|
|
29
34
|
* Sets the `initialFocus` state.
|
|
30
35
|
*/
|
|
@@ -52,7 +57,16 @@ export interface MenuStoreOptions<T extends Values = Values> extends StoreOption
|
|
|
52
57
|
* with a menu (e.g., dropdown menu with a search input). The stores will
|
|
53
58
|
* share the same state.
|
|
54
59
|
*/
|
|
55
|
-
combobox?: ComboboxStore;
|
|
60
|
+
combobox?: ComboboxStore | null;
|
|
61
|
+
/**
|
|
62
|
+
* A reference to a parent menu store. This should be used on nested menus.
|
|
63
|
+
*/
|
|
64
|
+
parent?: MenuStore | null;
|
|
65
|
+
/**
|
|
66
|
+
* A reference to a menu bar store. This should be used when rendering menus
|
|
67
|
+
* inside a menu bar.
|
|
68
|
+
*/
|
|
69
|
+
menubar?: MenuBarStore | null;
|
|
56
70
|
/**
|
|
57
71
|
* The default values for the `values` state.
|
|
58
72
|
* @default {}
|
|
@@ -1,11 +1,11 @@
|
|
|
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
|
|
|
11
|
-
exports.createPopoverStore =
|
|
11
|
+
exports.createPopoverStore = _AIHTEA5Dcjs.createPopoverStore;
|
|
@@ -62,7 +62,7 @@ export interface PopoverStoreOptions extends StoreOptions<PopoverStoreState, "pl
|
|
|
62
62
|
* A reference to another popover store that's controlling another popover to
|
|
63
63
|
* keep them in sync.
|
|
64
64
|
*/
|
|
65
|
-
popover?: PopoverStore;
|
|
65
|
+
popover?: PopoverStore | null;
|
|
66
66
|
}
|
|
67
67
|
export type PopoverStoreProps = PopoverStoreOptions & StoreProps<PopoverStoreState>;
|
|
68
68
|
export type PopoverStore = PopoverStoreFunctions & Store<PopoverStoreState>;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
require('../__chunks/
|
|
3
|
+
var _4OD4ZFRGcjs = require('../__chunks/4OD4ZFRG.cjs');
|
|
4
|
+
require('../__chunks/4L3HCXJY.cjs');
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
var
|
|
7
|
+
var _7GWXP6CQcjs = require('../__chunks/7GWXP6CQ.cjs');
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
var _RCYVACJOcjs = require('../__chunks/RCYVACJO.cjs');
|
|
@@ -21,7 +21,7 @@ function createRadioStore(_a = {}) {
|
|
|
21
21
|
var props = _72I2GWXFcjs.__objRest.call(void 0, _a, []);
|
|
22
22
|
var _a2;
|
|
23
23
|
const syncState = (_a2 = props.store) == null ? void 0 : _a2.getState();
|
|
24
|
-
const composite =
|
|
24
|
+
const composite = _4OD4ZFRGcjs.createCompositeStore.call(void 0, _72I2GWXFcjs.__spreadProps.call(void 0, _72I2GWXFcjs.__spreadValues.call(void 0, {}, props), {
|
|
25
25
|
focusLoop: _RCYVACJOcjs.defaultValue.call(void 0, props.focusLoop, syncState == null ? void 0 : syncState.focusLoop, true)
|
|
26
26
|
}));
|
|
27
27
|
const initialState = _72I2GWXFcjs.__spreadProps.call(void 0, _72I2GWXFcjs.__spreadValues.call(void 0, {}, composite.getState()), {
|
|
@@ -32,7 +32,7 @@ function createRadioStore(_a = {}) {
|
|
|
32
32
|
null
|
|
33
33
|
)
|
|
34
34
|
});
|
|
35
|
-
const radio =
|
|
35
|
+
const radio = _7GWXP6CQcjs.createStore.call(void 0, initialState, composite, props.store);
|
|
36
36
|
return _72I2GWXFcjs.__spreadProps.call(void 0, _72I2GWXFcjs.__spreadValues.call(void 0, _72I2GWXFcjs.__spreadValues.call(void 0, {}, composite), radio), {
|
|
37
37
|
setValue: (value) => radio.setState("value", value)
|
|
38
38
|
});
|
|
@@ -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 _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
|
|
|
@@ -14,7 +14,8 @@ require('../__chunks/F5DMXFQ2.cjs');
|
|
|
14
14
|
|
|
15
15
|
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
|
|
18
|
+
var _7GWXP6CQcjs = require('../__chunks/7GWXP6CQ.cjs');
|
|
18
19
|
|
|
19
20
|
|
|
20
21
|
var _RCYVACJOcjs = require('../__chunks/RCYVACJO.cjs');
|
|
@@ -35,9 +36,9 @@ function createSelectStore(_a = {}) {
|
|
|
35
36
|
} = _b, props = _72I2GWXFcjs.__objRest.call(void 0, _b, [
|
|
36
37
|
"combobox"
|
|
37
38
|
]);
|
|
38
|
-
const store =
|
|
39
|
+
const store = _7GWXP6CQcjs.mergeStore.call(void 0,
|
|
39
40
|
props.store,
|
|
40
|
-
|
|
41
|
+
_7GWXP6CQcjs.omit.call(void 0, combobox, [
|
|
41
42
|
"value",
|
|
42
43
|
"items",
|
|
43
44
|
"renderedItems",
|
|
@@ -49,8 +50,9 @@ function createSelectStore(_a = {}) {
|
|
|
49
50
|
"disclosureElement"
|
|
50
51
|
])
|
|
51
52
|
);
|
|
53
|
+
_7GWXP6CQcjs.throwOnConflictingProps.call(void 0, props, store);
|
|
52
54
|
const syncState = store.getState();
|
|
53
|
-
const composite =
|
|
55
|
+
const composite = _4OD4ZFRGcjs.createCompositeStore.call(void 0, _72I2GWXFcjs.__spreadProps.call(void 0, _72I2GWXFcjs.__spreadValues.call(void 0, {}, props), {
|
|
54
56
|
store,
|
|
55
57
|
virtualFocus: _RCYVACJOcjs.defaultValue.call(void 0,
|
|
56
58
|
props.virtualFocus,
|
|
@@ -74,7 +76,7 @@ function createSelectStore(_a = {}) {
|
|
|
74
76
|
"vertical"
|
|
75
77
|
)
|
|
76
78
|
}));
|
|
77
|
-
const popover =
|
|
79
|
+
const popover = _AIHTEA5Dcjs.createPopoverStore.call(void 0, _72I2GWXFcjs.__spreadProps.call(void 0, _72I2GWXFcjs.__spreadValues.call(void 0, {}, props), {
|
|
78
80
|
store,
|
|
79
81
|
placement: _RCYVACJOcjs.defaultValue.call(void 0,
|
|
80
82
|
props.placement,
|
|
@@ -84,7 +86,6 @@ function createSelectStore(_a = {}) {
|
|
|
84
86
|
}));
|
|
85
87
|
const initialValue = new String("");
|
|
86
88
|
const initialState = _72I2GWXFcjs.__spreadProps.call(void 0, _72I2GWXFcjs.__spreadValues.call(void 0, _72I2GWXFcjs.__spreadValues.call(void 0, {}, composite.getState()), popover.getState()), {
|
|
87
|
-
combobox: _RCYVACJOcjs.defaultValue.call(void 0, syncState.combobox, !!combobox),
|
|
88
89
|
value: _RCYVACJOcjs.defaultValue.call(void 0,
|
|
89
90
|
props.value,
|
|
90
91
|
syncState.value,
|
|
@@ -99,10 +100,10 @@ function createSelectStore(_a = {}) {
|
|
|
99
100
|
selectElement: _RCYVACJOcjs.defaultValue.call(void 0, syncState.selectElement, null),
|
|
100
101
|
labelElement: _RCYVACJOcjs.defaultValue.call(void 0, syncState.labelElement, null)
|
|
101
102
|
});
|
|
102
|
-
const select =
|
|
103
|
-
|
|
103
|
+
const select = _7GWXP6CQcjs.createStore.call(void 0, initialState, composite, popover, store);
|
|
104
|
+
_7GWXP6CQcjs.setup.call(void 0,
|
|
104
105
|
select,
|
|
105
|
-
() =>
|
|
106
|
+
() => _7GWXP6CQcjs.sync.call(void 0, select, ["value", "items"], (state) => {
|
|
106
107
|
if (state.value !== initialValue)
|
|
107
108
|
return;
|
|
108
109
|
if (!state.items.length)
|
|
@@ -115,9 +116,9 @@ function createSelectStore(_a = {}) {
|
|
|
115
116
|
select.setState("value", item.value);
|
|
116
117
|
})
|
|
117
118
|
);
|
|
118
|
-
|
|
119
|
+
_7GWXP6CQcjs.setup.call(void 0,
|
|
119
120
|
select,
|
|
120
|
-
() =>
|
|
121
|
+
() => _7GWXP6CQcjs.sync.call(void 0, select, ["mounted", "items", "value"], (state) => {
|
|
121
122
|
if (combobox)
|
|
122
123
|
return;
|
|
123
124
|
if (state.mounted)
|
|
@@ -134,9 +135,9 @@ function createSelectStore(_a = {}) {
|
|
|
134
135
|
select.setState("activeId", item.id);
|
|
135
136
|
})
|
|
136
137
|
);
|
|
137
|
-
|
|
138
|
+
_7GWXP6CQcjs.setup.call(void 0,
|
|
138
139
|
select,
|
|
139
|
-
() =>
|
|
140
|
+
() => _7GWXP6CQcjs.batch.call(void 0, select, ["setValueOnMove", "moves"], (state) => {
|
|
140
141
|
const { mounted, value, activeId } = select.getState();
|
|
141
142
|
if (!state.setValueOnMove && mounted)
|
|
142
143
|
return;
|
|
@@ -153,6 +154,7 @@ function createSelectStore(_a = {}) {
|
|
|
153
154
|
})
|
|
154
155
|
);
|
|
155
156
|
return _72I2GWXFcjs.__spreadProps.call(void 0, _72I2GWXFcjs.__spreadValues.call(void 0, _72I2GWXFcjs.__spreadValues.call(void 0, _72I2GWXFcjs.__spreadValues.call(void 0, {}, composite), popover), select), {
|
|
157
|
+
combobox,
|
|
156
158
|
setValue: (value) => select.setState("value", value),
|
|
157
159
|
setSelectElement: (element) => select.setState("selectElement", element),
|
|
158
160
|
setLabelElement: (element) => select.setState("labelElement", element)
|
|
@@ -23,10 +23,6 @@ export interface SelectStoreState<T extends Value = Value> extends CompositeStor
|
|
|
23
23
|
orientation: CompositeStoreState<Item>["orientation"];
|
|
24
24
|
/** @default "bottom-start" */
|
|
25
25
|
placement: PopoverStoreState["placement"];
|
|
26
|
-
/**
|
|
27
|
-
* Whether the select store has received a combobox prop.
|
|
28
|
-
*/
|
|
29
|
-
combobox: boolean;
|
|
30
26
|
/**
|
|
31
27
|
* The select value.
|
|
32
28
|
*
|
|
@@ -50,7 +46,7 @@ export interface SelectStoreState<T extends Value = Value> extends CompositeStor
|
|
|
50
46
|
*/
|
|
51
47
|
labelElement: HTMLElement | null;
|
|
52
48
|
}
|
|
53
|
-
export interface SelectStoreFunctions<T extends Value = Value> extends CompositeStoreFunctions<Item>, PopoverStoreFunctions {
|
|
49
|
+
export interface SelectStoreFunctions<T extends Value = Value> extends Pick<SelectStoreOptions<T>, "combobox">, CompositeStoreFunctions<Item>, PopoverStoreFunctions {
|
|
54
50
|
/**
|
|
55
51
|
* Sets the `value` state.
|
|
56
52
|
*
|
|
@@ -82,7 +78,7 @@ export interface SelectStoreOptions<T extends Value = Value> extends StoreOption
|
|
|
82
78
|
* - [Multi-selectable
|
|
83
79
|
* Combobox](https://ariakit.org/examples/combobox-multiple)
|
|
84
80
|
*/
|
|
85
|
-
combobox?: ComboboxStore;
|
|
81
|
+
combobox?: ComboboxStore | null;
|
|
86
82
|
/**
|
|
87
83
|
* The default value. If not set, the first non-disabled item will be used.
|
|
88
84
|
*
|
package/cjs/tab/tab-store.cjs
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _4OD4ZFRGcjs = require('../__chunks/4OD4ZFRG.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
var
|
|
6
|
+
var _4L3HCXJYcjs = require('../__chunks/4L3HCXJY.cjs');
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
|
|
12
|
-
var
|
|
12
|
+
var _7GWXP6CQcjs = require('../__chunks/7GWXP6CQ.cjs');
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
var _RCYVACJOcjs = require('../__chunks/RCYVACJO.cjs');
|
|
@@ -24,7 +24,7 @@ var _72I2GWXFcjs = require('../__chunks/72I2GWXF.cjs');
|
|
|
24
24
|
function createTabStore(props = {}) {
|
|
25
25
|
var _a;
|
|
26
26
|
const syncState = (_a = props.store) == null ? void 0 : _a.getState();
|
|
27
|
-
const composite =
|
|
27
|
+
const composite = _4OD4ZFRGcjs.createCompositeStore.call(void 0, _72I2GWXFcjs.__spreadProps.call(void 0, _72I2GWXFcjs.__spreadValues.call(void 0, {}, props), {
|
|
28
28
|
orientation: _RCYVACJOcjs.defaultValue.call(void 0,
|
|
29
29
|
props.orientation,
|
|
30
30
|
syncState == null ? void 0 : syncState.orientation,
|
|
@@ -32,7 +32,7 @@ function createTabStore(props = {}) {
|
|
|
32
32
|
),
|
|
33
33
|
focusLoop: _RCYVACJOcjs.defaultValue.call(void 0, props.focusLoop, syncState == null ? void 0 : syncState.focusLoop, true)
|
|
34
34
|
}));
|
|
35
|
-
const panels =
|
|
35
|
+
const panels = _4L3HCXJYcjs.createCollectionStore.call(void 0, );
|
|
36
36
|
const initialState = _72I2GWXFcjs.__spreadProps.call(void 0, _72I2GWXFcjs.__spreadValues.call(void 0, {}, composite.getState()), {
|
|
37
37
|
selectedId: _RCYVACJOcjs.defaultValue.call(void 0,
|
|
38
38
|
props.selectedId,
|
|
@@ -46,10 +46,10 @@ function createTabStore(props = {}) {
|
|
|
46
46
|
true
|
|
47
47
|
)
|
|
48
48
|
});
|
|
49
|
-
const tab =
|
|
50
|
-
|
|
49
|
+
const tab = _7GWXP6CQcjs.createStore.call(void 0, initialState, composite, props.store);
|
|
50
|
+
_7GWXP6CQcjs.setup.call(void 0,
|
|
51
51
|
tab,
|
|
52
|
-
() =>
|
|
52
|
+
() => _7GWXP6CQcjs.sync.call(void 0, tab, ["moves"], () => {
|
|
53
53
|
const { activeId, selectOnMove } = tab.getState();
|
|
54
54
|
if (!selectOnMove)
|
|
55
55
|
return;
|
|
@@ -65,17 +65,17 @@ function createTabStore(props = {}) {
|
|
|
65
65
|
tab.setState("selectedId", tabItem.id);
|
|
66
66
|
})
|
|
67
67
|
);
|
|
68
|
-
|
|
68
|
+
_7GWXP6CQcjs.setup.call(void 0,
|
|
69
69
|
tab,
|
|
70
|
-
() =>
|
|
70
|
+
() => _7GWXP6CQcjs.batch.call(void 0,
|
|
71
71
|
tab,
|
|
72
72
|
["selectedId"],
|
|
73
73
|
(state) => tab.setState("activeId", state.selectedId)
|
|
74
74
|
)
|
|
75
75
|
);
|
|
76
|
-
|
|
76
|
+
_7GWXP6CQcjs.setup.call(void 0,
|
|
77
77
|
tab,
|
|
78
|
-
() =>
|
|
78
|
+
() => _7GWXP6CQcjs.sync.call(void 0, tab, ["selectedId", "renderedItems"], (state) => {
|
|
79
79
|
if (state.selectedId !== void 0)
|
|
80
80
|
return;
|
|
81
81
|
const { activeId, renderedItems } = tab.getState();
|
|
@@ -90,13 +90,13 @@ function createTabStore(props = {}) {
|
|
|
90
90
|
}
|
|
91
91
|
})
|
|
92
92
|
);
|
|
93
|
-
|
|
93
|
+
_7GWXP6CQcjs.setup.call(void 0,
|
|
94
94
|
tab,
|
|
95
|
-
() =>
|
|
95
|
+
() => _7GWXP6CQcjs.sync.call(void 0, tab, ["renderedItems"], (state) => {
|
|
96
96
|
const tabs = state.renderedItems;
|
|
97
97
|
if (!tabs.length)
|
|
98
98
|
return;
|
|
99
|
-
return
|
|
99
|
+
return _7GWXP6CQcjs.sync.call(void 0, panels, ["renderedItems"], (state2) => {
|
|
100
100
|
const items = state2.renderedItems;
|
|
101
101
|
const hasOrphanPanels = items.some((panel) => !panel.tabId);
|
|
102
102
|
if (!hasOrphanPanels)
|
|
@@ -1,8 +1,8 @@
|
|
|
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
|
|
|
7
7
|
|
|
8
8
|
var _RCYVACJOcjs = require('../__chunks/RCYVACJO.cjs');
|
|
@@ -17,7 +17,7 @@ var _72I2GWXFcjs = require('../__chunks/72I2GWXF.cjs');
|
|
|
17
17
|
function createToolbarStore(props = {}) {
|
|
18
18
|
var _a;
|
|
19
19
|
const syncState = (_a = props.store) == null ? void 0 : _a.getState();
|
|
20
|
-
return
|
|
20
|
+
return _4OD4ZFRGcjs.createCompositeStore.call(void 0, _72I2GWXFcjs.__spreadProps.call(void 0, _72I2GWXFcjs.__spreadValues.call(void 0, {}, props), {
|
|
21
21
|
orientation: _RCYVACJOcjs.defaultValue.call(void 0,
|
|
22
22
|
props.orientation,
|
|
23
23
|
syncState == null ? void 0 : syncState.orientation,
|
|
@@ -1,12 +1,12 @@
|
|
|
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 _ZRCUNIY2cjs = require('../__chunks/ZRCUNIY2.cjs');
|
|
4
|
+
require('../__chunks/AIHTEA5D.cjs');
|
|
5
|
+
require('../__chunks/GHET3DES.cjs');
|
|
6
|
+
require('../__chunks/52LQV3SV.cjs');
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
var
|
|
9
|
+
var _7GWXP6CQcjs = require('../__chunks/7GWXP6CQ.cjs');
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
var _RCYVACJOcjs = require('../__chunks/RCYVACJO.cjs');
|
|
@@ -19,7 +19,7 @@ var _72I2GWXFcjs = require('../__chunks/72I2GWXF.cjs');
|
|
|
19
19
|
function createTooltipStore(props = {}) {
|
|
20
20
|
var _a;
|
|
21
21
|
const syncState = (_a = props.store) == null ? void 0 : _a.getState();
|
|
22
|
-
const hovercard =
|
|
22
|
+
const hovercard = _ZRCUNIY2cjs.createHovercardStore.call(void 0, _72I2GWXFcjs.__spreadProps.call(void 0, _72I2GWXFcjs.__spreadValues.call(void 0, {}, props), {
|
|
23
23
|
placement: _RCYVACJOcjs.defaultValue.call(void 0,
|
|
24
24
|
props.placement,
|
|
25
25
|
syncState == null ? void 0 : syncState.placement,
|
|
@@ -31,7 +31,7 @@ function createTooltipStore(props = {}) {
|
|
|
31
31
|
type: _RCYVACJOcjs.defaultValue.call(void 0, props.type, syncState == null ? void 0 : syncState.type, "description"),
|
|
32
32
|
skipTimeout: _RCYVACJOcjs.defaultValue.call(void 0, props.skipTimeout, syncState == null ? void 0 : syncState.skipTimeout, 300)
|
|
33
33
|
});
|
|
34
|
-
const tooltip =
|
|
34
|
+
const tooltip = _7GWXP6CQcjs.createStore.call(void 0, initialState, hovercard, props.store);
|
|
35
35
|
return _72I2GWXFcjs.__spreadValues.call(void 0, _72I2GWXFcjs.__spreadValues.call(void 0, {}, hovercard), tooltip);
|
|
36
36
|
}
|
|
37
37
|
|