@ariakit/core 0.1.4 → 0.2.0
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 +66 -0
- package/cjs/__chunks/{QYB6XH64.cjs → 27ZAGOYG.cjs} +17 -13
- package/cjs/__chunks/6455U47T.cjs +37 -0
- package/cjs/__chunks/{ZPOXPO2L.cjs → 6SPJEESB.cjs} +33 -21
- package/cjs/__chunks/CNODBYSG.cjs +58 -0
- package/cjs/__chunks/{2YFRPUZP.cjs → DBHIHK7C.cjs} +6 -6
- package/cjs/__chunks/{W5IHD6VG.cjs → EUJ6NNA6.cjs} +56 -43
- package/cjs/__chunks/{4DQ3OTE7.cjs → FXEBKN6G.cjs} +22 -17
- package/cjs/__chunks/{ZJEEK57E.cjs → HEFJPUYD.cjs} +2 -2
- package/cjs/__chunks/{QNEPGQLL.cjs → M6ZA7XUP.cjs} +6 -2
- package/cjs/__chunks/RD3S4VKY.cjs +60 -0
- package/cjs/__chunks/{OFNGELMA.cjs → ZNW4LSWU.cjs} +8 -6
- package/cjs/checkbox/checkbox-store.cjs +14 -10
- package/cjs/collection/collection-store.cjs +6 -5
- package/cjs/combobox/combobox-store.cjs +49 -48
- package/cjs/composite/composite-overflow-store.cjs +7 -6
- package/cjs/composite/composite-store.cjs +7 -6
- package/cjs/dialog/dialog-store.cjs +6 -5
- package/cjs/disclosure/disclosure-store.cjs +5 -4
- package/cjs/disclosure/disclosure-store.d.ts +8 -0
- package/cjs/form/form-store.cjs +38 -35
- package/cjs/hovercard/hovercard-store.cjs +8 -7
- package/cjs/hovercard/hovercard-store.d.ts +3 -2
- package/cjs/index.cjs +3 -1
- package/cjs/menu/menu-bar-store.cjs +17 -13
- package/cjs/menu/menu-store.cjs +41 -43
- package/cjs/popover/popover-store.cjs +7 -6
- package/cjs/popover/popover-store.d.ts +8 -89
- package/cjs/radio/radio-store.cjs +25 -24
- package/cjs/select/select-store.cjs +42 -42
- package/cjs/tab/tab-store.cjs +29 -28
- package/cjs/tab/tab-store.d.ts +9 -0
- package/cjs/toolbar/toolbar-store.cjs +17 -13
- package/cjs/tooltip/tooltip-store.cjs +31 -79
- package/cjs/tooltip/tooltip-store.d.ts +20 -15
- package/cjs/tsconfig.build.tsbuildinfo +1 -1
- package/cjs/utils/array.cjs +1 -0
- package/cjs/utils/dom.cjs +3 -2
- package/cjs/utils/events.cjs +14 -9
- package/cjs/utils/focus.cjs +24 -14
- package/cjs/utils/misc.cjs +3 -2
- package/cjs/utils/platform.cjs +4 -3
- package/cjs/utils/store.cjs +4 -3
- package/esm/__chunks/3BAGFTL5.js +58 -0
- package/esm/__chunks/4BKCJXBM.js +37 -0
- package/esm/__chunks/{NA5BK7DD.js → BOKMNDR7.js} +22 -10
- package/esm/__chunks/{WFGVC6LE.js → EWHSN7GO.js} +17 -12
- package/esm/__chunks/{4T5RHRE5.js → MNNKHNLW.js} +1 -1
- package/esm/__chunks/{UVCATTRC.js → N6JW4ITM.js} +7 -5
- package/esm/__chunks/{RMD7SNCC.js → NWU4GBZ6.js} +5 -1
- package/esm/__chunks/{X7MJ3FB5.js → R6VHFWTV.js} +49 -36
- package/esm/__chunks/{DXA3K2FY.js → TFBCK4JB.js} +1 -1
- package/esm/__chunks/Z5IDQSMV.js +60 -0
- package/esm/__chunks/{IOAGNCXX.js → ZV2GEGPL.js} +14 -10
- package/esm/checkbox/checkbox-store.js +11 -7
- package/esm/collection/collection-store.js +5 -4
- package/esm/combobox/combobox-store.js +34 -33
- package/esm/composite/composite-overflow-store.js +6 -5
- package/esm/composite/composite-store.js +6 -5
- package/esm/dialog/dialog-store.js +5 -4
- package/esm/disclosure/disclosure-store.d.ts +8 -0
- package/esm/disclosure/disclosure-store.js +4 -3
- package/esm/form/form-store.js +24 -21
- package/esm/hovercard/hovercard-store.d.ts +3 -2
- package/esm/hovercard/hovercard-store.js +7 -6
- package/esm/index.js +2 -0
- package/esm/menu/menu-bar-store.js +15 -11
- package/esm/menu/menu-store.js +31 -33
- package/esm/popover/popover-store.d.ts +8 -89
- package/esm/popover/popover-store.js +6 -5
- package/esm/radio/radio-store.js +22 -21
- package/esm/select/select-store.js +29 -29
- package/esm/tab/tab-store.d.ts +9 -0
- package/esm/tab/tab-store.js +23 -22
- package/esm/toolbar/toolbar-store.js +15 -11
- package/esm/tooltip/tooltip-store.d.ts +20 -15
- package/esm/tooltip/tooltip-store.js +32 -80
- package/esm/tsconfig.build.tsbuildinfo +1 -1
- package/esm/utils/array.js +1 -0
- package/esm/utils/dom.js +2 -1
- package/esm/utils/events.js +10 -5
- package/esm/utils/focus.js +14 -4
- package/esm/utils/misc.js +2 -1
- package/esm/utils/platform.js +3 -2
- package/esm/utils/store.js +3 -2
- package/package.json +1 -1
- package/cjs/__chunks/DQHU5K4Q.cjs +0 -57
- package/cjs/__chunks/HLVPXX7H.cjs +0 -1491
- package/esm/__chunks/6HMPWUDT.js +0 -57
- package/esm/__chunks/6PEWNRTN.js +0 -1491
package/cjs/form/form-store.cjs
CHANGED
|
@@ -1,16 +1,20 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _FXEBKN6Gcjs = require('../__chunks/FXEBKN6G.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
var
|
|
6
|
+
var _6SPJEESBcjs = require('../__chunks/6SPJEESB.cjs');
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
|
|
12
|
-
var
|
|
13
|
-
require('../__chunks/
|
|
12
|
+
var _M6ZA7XUPcjs = require('../__chunks/M6ZA7XUP.cjs');
|
|
13
|
+
require('../__chunks/ZNW4LSWU.cjs');
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
var _6455U47Tcjs = require('../__chunks/6455U47T.cjs');
|
|
14
18
|
|
|
15
19
|
// src/form/form-store.ts
|
|
16
20
|
function nextFrame() {
|
|
@@ -18,19 +22,20 @@ function nextFrame() {
|
|
|
18
22
|
}
|
|
19
23
|
function hasMessages(object) {
|
|
20
24
|
return Object.keys(object).some((key) => {
|
|
21
|
-
if (
|
|
25
|
+
if (_M6ZA7XUPcjs.isObject.call(void 0, object[key])) {
|
|
22
26
|
return hasMessages(object[key]);
|
|
23
27
|
}
|
|
24
28
|
return !!object[key];
|
|
25
29
|
});
|
|
26
30
|
}
|
|
27
31
|
function get(values, path, defaultValue2) {
|
|
32
|
+
var _a;
|
|
28
33
|
const [key, ...rest] = Array.isArray(path) ? path : `${path}`.split(".");
|
|
29
34
|
if (key == null || !values) {
|
|
30
35
|
return defaultValue2;
|
|
31
36
|
}
|
|
32
37
|
if (!rest.length) {
|
|
33
|
-
return
|
|
38
|
+
return (_a = values[key]) != null ? _a : defaultValue2;
|
|
34
39
|
}
|
|
35
40
|
return get(values[key], rest, defaultValue2);
|
|
36
41
|
}
|
|
@@ -39,10 +44,10 @@ function set(values, path, value) {
|
|
|
39
44
|
if (k == null)
|
|
40
45
|
return values;
|
|
41
46
|
const key = k;
|
|
42
|
-
const isIntegerKey =
|
|
47
|
+
const isIntegerKey = _M6ZA7XUPcjs.isInteger.call(void 0, key);
|
|
43
48
|
const nextValues = isIntegerKey ? values || [] : values || {};
|
|
44
49
|
const nestedValues = nextValues[key];
|
|
45
|
-
const result = rest.length && (Array.isArray(nestedValues) ||
|
|
50
|
+
const result = rest.length && (Array.isArray(nestedValues) || _M6ZA7XUPcjs.isObject.call(void 0, nestedValues)) ? set(nestedValues, rest, value) : value;
|
|
46
51
|
if (isIntegerKey) {
|
|
47
52
|
const index = Number(key);
|
|
48
53
|
if (values) {
|
|
@@ -56,7 +61,7 @@ function set(values, path, value) {
|
|
|
56
61
|
nextValues2[index] = result;
|
|
57
62
|
return nextValues2;
|
|
58
63
|
}
|
|
59
|
-
return {
|
|
64
|
+
return _6455U47Tcjs.__spreadProps.call(void 0, _6455U47Tcjs.__spreadValues.call(void 0, {}, values), { [key]: result });
|
|
60
65
|
}
|
|
61
66
|
function setAll(values, value) {
|
|
62
67
|
const result = {};
|
|
@@ -65,12 +70,12 @@ function setAll(values, value) {
|
|
|
65
70
|
const currentValue = values[key];
|
|
66
71
|
if (Array.isArray(currentValue)) {
|
|
67
72
|
result[key] = currentValue.map((v) => {
|
|
68
|
-
if (
|
|
73
|
+
if (_M6ZA7XUPcjs.isObject.call(void 0, v)) {
|
|
69
74
|
return setAll(v, value);
|
|
70
75
|
}
|
|
71
76
|
return value;
|
|
72
77
|
});
|
|
73
|
-
} else if (
|
|
78
|
+
} else if (_M6ZA7XUPcjs.isObject.call(void 0, currentValue)) {
|
|
74
79
|
result[key] = setAll(currentValue, value);
|
|
75
80
|
} else {
|
|
76
81
|
result[key] = value;
|
|
@@ -101,38 +106,38 @@ function createNames() {
|
|
|
101
106
|
return new Proxy(/* @__PURE__ */ Object.create(null), getNameHandler(cache));
|
|
102
107
|
}
|
|
103
108
|
function createFormStore(props = {}) {
|
|
104
|
-
|
|
105
|
-
const
|
|
106
|
-
const
|
|
109
|
+
var _a;
|
|
110
|
+
const syncState = (_a = props.store) == null ? void 0 : _a.getState();
|
|
111
|
+
const collection = _FXEBKN6Gcjs.createCollectionStore.call(void 0, props);
|
|
112
|
+
const values = _M6ZA7XUPcjs.defaultValue.call(void 0,
|
|
107
113
|
props.values,
|
|
108
|
-
|
|
114
|
+
syncState == null ? void 0 : syncState.values,
|
|
109
115
|
props.defaultValues,
|
|
110
116
|
{}
|
|
111
117
|
);
|
|
112
|
-
const errors =
|
|
118
|
+
const errors = _M6ZA7XUPcjs.defaultValue.call(void 0,
|
|
113
119
|
props.errors,
|
|
114
|
-
|
|
120
|
+
syncState == null ? void 0 : syncState.errors,
|
|
115
121
|
props.defaultErrors,
|
|
116
122
|
{}
|
|
117
123
|
);
|
|
118
|
-
const touched =
|
|
124
|
+
const touched = _M6ZA7XUPcjs.defaultValue.call(void 0,
|
|
119
125
|
props.touched,
|
|
120
|
-
|
|
126
|
+
syncState == null ? void 0 : syncState.touched,
|
|
121
127
|
props.defaultTouched,
|
|
122
128
|
{}
|
|
123
129
|
);
|
|
124
|
-
const initialState = {
|
|
125
|
-
...collection.getState(),
|
|
130
|
+
const initialState = _6455U47Tcjs.__spreadProps.call(void 0, _6455U47Tcjs.__spreadValues.call(void 0, {}, collection.getState()), {
|
|
126
131
|
values,
|
|
127
132
|
errors,
|
|
128
133
|
touched,
|
|
129
|
-
validating:
|
|
130
|
-
submitting:
|
|
131
|
-
submitSucceed:
|
|
132
|
-
submitFailed:
|
|
134
|
+
validating: _M6ZA7XUPcjs.defaultValue.call(void 0, syncState == null ? void 0 : syncState.validating, false),
|
|
135
|
+
submitting: _M6ZA7XUPcjs.defaultValue.call(void 0, syncState == null ? void 0 : syncState.submitting, false),
|
|
136
|
+
submitSucceed: _M6ZA7XUPcjs.defaultValue.call(void 0, syncState == null ? void 0 : syncState.submitSucceed, 0),
|
|
137
|
+
submitFailed: _M6ZA7XUPcjs.defaultValue.call(void 0, syncState == null ? void 0 : syncState.submitFailed, 0),
|
|
133
138
|
valid: !hasMessages(errors)
|
|
134
|
-
};
|
|
135
|
-
const form =
|
|
139
|
+
});
|
|
140
|
+
const form = _6SPJEESBcjs.createStore.call(void 0, initialState, collection, props.store);
|
|
136
141
|
const validateCallbacks = /* @__PURE__ */ new Set();
|
|
137
142
|
const submitCallbacks = /* @__PURE__ */ new Set();
|
|
138
143
|
const validate = async () => {
|
|
@@ -148,15 +153,13 @@ function createFormStore(props = {}) {
|
|
|
148
153
|
form.setState("validating", false);
|
|
149
154
|
}
|
|
150
155
|
};
|
|
151
|
-
return {
|
|
152
|
-
...collection,
|
|
153
|
-
...form,
|
|
156
|
+
return _6455U47Tcjs.__spreadProps.call(void 0, _6455U47Tcjs.__spreadValues.call(void 0, _6455U47Tcjs.__spreadValues.call(void 0, {}, collection), form), {
|
|
154
157
|
names: createNames(),
|
|
155
158
|
setValues: (values2) => form.setState("values", values2),
|
|
156
159
|
getValue: (name) => get(form.getState().values, name),
|
|
157
160
|
setValue: (name, value) => form.setState("values", (values2) => {
|
|
158
161
|
const prevValue = get(values2, name);
|
|
159
|
-
const nextValue =
|
|
162
|
+
const nextValue = _M6ZA7XUPcjs.applyState.call(void 0, value, prevValue);
|
|
160
163
|
if (nextValue === prevValue)
|
|
161
164
|
return values2;
|
|
162
165
|
return set(values2, name, nextValue);
|
|
@@ -177,7 +180,7 @@ function createFormStore(props = {}) {
|
|
|
177
180
|
getError: (name) => get(form.getState().errors, name),
|
|
178
181
|
setError: (name, error) => form.setState("errors", (errors2) => {
|
|
179
182
|
const prevError = get(errors2, name);
|
|
180
|
-
const nextError =
|
|
183
|
+
const nextError = _M6ZA7XUPcjs.applyState.call(void 0, error, prevError);
|
|
181
184
|
if (nextError === prevError)
|
|
182
185
|
return errors2;
|
|
183
186
|
return set(errors2, name, nextError);
|
|
@@ -186,7 +189,7 @@ function createFormStore(props = {}) {
|
|
|
186
189
|
getFieldTouched: (name) => !!get(form.getState().touched, name),
|
|
187
190
|
setFieldTouched: (name, value) => form.setState("touched", (touched2) => {
|
|
188
191
|
const prevValue = get(touched2, name);
|
|
189
|
-
const nextValue =
|
|
192
|
+
const nextValue = _M6ZA7XUPcjs.applyState.call(void 0, value, prevValue);
|
|
190
193
|
if (nextValue === prevValue)
|
|
191
194
|
return touched2;
|
|
192
195
|
return set(touched2, name, nextValue);
|
|
@@ -232,7 +235,7 @@ function createFormStore(props = {}) {
|
|
|
232
235
|
form.setState("submitSucceed", 0);
|
|
233
236
|
form.setState("submitFailed", 0);
|
|
234
237
|
}
|
|
235
|
-
};
|
|
238
|
+
});
|
|
236
239
|
}
|
|
237
240
|
|
|
238
241
|
|
|
@@ -1,11 +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/
|
|
8
|
-
require('../__chunks/
|
|
3
|
+
var _CNODBYSGcjs = require('../__chunks/CNODBYSG.cjs');
|
|
4
|
+
require('../__chunks/RD3S4VKY.cjs');
|
|
5
|
+
require('../__chunks/HEFJPUYD.cjs');
|
|
6
|
+
require('../__chunks/27ZAGOYG.cjs');
|
|
7
|
+
require('../__chunks/6SPJEESB.cjs');
|
|
8
|
+
require('../__chunks/M6ZA7XUP.cjs');
|
|
9
|
+
require('../__chunks/6455U47T.cjs');
|
|
9
10
|
|
|
10
11
|
|
|
11
|
-
exports.createHovercardStore =
|
|
12
|
+
exports.createHovercardStore = _CNODBYSGcjs.createHovercardStore;
|
|
@@ -11,8 +11,9 @@ export interface HovercardStoreState extends PopoverStoreState {
|
|
|
11
11
|
*/
|
|
12
12
|
placement: PopoverStoreState["placement"];
|
|
13
13
|
/**
|
|
14
|
-
* The amount of time in milliseconds to wait before showing
|
|
15
|
-
* popover.
|
|
14
|
+
* The amount of time in milliseconds to wait before showing and hiding the
|
|
15
|
+
* popover. To control the delay for showing and hiding separately, use
|
|
16
|
+
* `showTimeout` and `hideTimeout`.
|
|
16
17
|
* @default 500
|
|
17
18
|
*/
|
|
18
19
|
timeout: number;
|
package/cjs/index.cjs
CHANGED
|
@@ -1,26 +1,30 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
require('../__chunks/
|
|
5
|
-
require('../__chunks/
|
|
3
|
+
var _EUJ6NNA6cjs = require('../__chunks/EUJ6NNA6.cjs');
|
|
4
|
+
require('../__chunks/FXEBKN6G.cjs');
|
|
5
|
+
require('../__chunks/6SPJEESB.cjs');
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
var
|
|
9
|
-
require('../__chunks/
|
|
8
|
+
var _M6ZA7XUPcjs = require('../__chunks/M6ZA7XUP.cjs');
|
|
9
|
+
require('../__chunks/ZNW4LSWU.cjs');
|
|
10
10
|
require('../__chunks/GDZQUFNP.cjs');
|
|
11
11
|
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
var _6455U47Tcjs = require('../__chunks/6455U47T.cjs');
|
|
15
|
+
|
|
12
16
|
// src/menu/menu-bar-store.ts
|
|
13
17
|
function createMenuBarStore(props = {}) {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
orientation:
|
|
18
|
+
var _a;
|
|
19
|
+
const syncState = (_a = props.store) == null ? void 0 : _a.getState();
|
|
20
|
+
return _EUJ6NNA6cjs.createCompositeStore.call(void 0, _6455U47Tcjs.__spreadProps.call(void 0, _6455U47Tcjs.__spreadValues.call(void 0, {}, props), {
|
|
21
|
+
orientation: _M6ZA7XUPcjs.defaultValue.call(void 0,
|
|
18
22
|
props.orientation,
|
|
19
|
-
|
|
23
|
+
syncState == null ? void 0 : syncState.orientation,
|
|
20
24
|
"horizontal"
|
|
21
25
|
),
|
|
22
|
-
focusLoop:
|
|
23
|
-
});
|
|
26
|
+
focusLoop: _M6ZA7XUPcjs.defaultValue.call(void 0, props.focusLoop, syncState == null ? void 0 : syncState.focusLoop, true)
|
|
27
|
+
}));
|
|
24
28
|
}
|
|
25
29
|
|
|
26
30
|
|
package/cjs/menu/menu-store.cjs
CHANGED
|
@@ -1,72 +1,74 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
require('../__chunks/
|
|
5
|
-
require('../__chunks/
|
|
6
|
-
require('../__chunks/
|
|
3
|
+
var _CNODBYSGcjs = require('../__chunks/CNODBYSG.cjs');
|
|
4
|
+
require('../__chunks/RD3S4VKY.cjs');
|
|
5
|
+
require('../__chunks/HEFJPUYD.cjs');
|
|
6
|
+
require('../__chunks/27ZAGOYG.cjs');
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
var
|
|
10
|
-
require('../__chunks/
|
|
9
|
+
var _EUJ6NNA6cjs = require('../__chunks/EUJ6NNA6.cjs');
|
|
10
|
+
require('../__chunks/FXEBKN6G.cjs');
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
|
|
14
|
-
var
|
|
14
|
+
var _6SPJEESBcjs = require('../__chunks/6SPJEESB.cjs');
|
|
15
15
|
|
|
16
16
|
|
|
17
17
|
|
|
18
|
-
var
|
|
19
|
-
require('../__chunks/
|
|
18
|
+
var _M6ZA7XUPcjs = require('../__chunks/M6ZA7XUP.cjs');
|
|
19
|
+
require('../__chunks/ZNW4LSWU.cjs');
|
|
20
20
|
require('../__chunks/GDZQUFNP.cjs');
|
|
21
21
|
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
var _6455U47Tcjs = require('../__chunks/6455U47T.cjs');
|
|
26
|
+
|
|
22
27
|
// src/menu/menu-store.ts
|
|
23
|
-
function createMenuStore({
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
} =
|
|
27
|
-
|
|
28
|
+
function createMenuStore(_a = {}) {
|
|
29
|
+
var _b = _a, {
|
|
30
|
+
combobox
|
|
31
|
+
} = _b, props = _6455U47Tcjs.__objRest.call(void 0, _b, [
|
|
32
|
+
"combobox"
|
|
33
|
+
]);
|
|
34
|
+
const store = _6SPJEESBcjs.mergeStore.call(void 0,
|
|
28
35
|
props.store,
|
|
29
|
-
|
|
30
|
-
"baseElement",
|
|
36
|
+
combobox == null ? void 0 : combobox.omit(
|
|
31
37
|
"arrowElement",
|
|
32
38
|
"anchorElement",
|
|
33
39
|
"contentElement",
|
|
34
40
|
"popoverElement",
|
|
35
41
|
"disclosureElement"
|
|
36
|
-
)
|
|
42
|
+
)
|
|
37
43
|
);
|
|
38
44
|
const syncState = store.getState();
|
|
39
|
-
const composite =
|
|
40
|
-
...props,
|
|
45
|
+
const composite = _EUJ6NNA6cjs.createCompositeStore.call(void 0, _6455U47Tcjs.__spreadProps.call(void 0, _6455U47Tcjs.__spreadValues.call(void 0, {}, props), {
|
|
41
46
|
store,
|
|
42
|
-
orientation:
|
|
47
|
+
orientation: _M6ZA7XUPcjs.defaultValue.call(void 0,
|
|
43
48
|
props.orientation,
|
|
44
49
|
syncState.orientation,
|
|
45
50
|
"vertical"
|
|
46
51
|
)
|
|
47
|
-
});
|
|
48
|
-
const hovercard =
|
|
49
|
-
...props,
|
|
52
|
+
}));
|
|
53
|
+
const hovercard = _CNODBYSGcjs.createHovercardStore.call(void 0, _6455U47Tcjs.__spreadProps.call(void 0, _6455U47Tcjs.__spreadValues.call(void 0, {}, props), {
|
|
50
54
|
store,
|
|
51
|
-
placement:
|
|
55
|
+
placement: _M6ZA7XUPcjs.defaultValue.call(void 0,
|
|
52
56
|
props.placement,
|
|
53
57
|
syncState.placement,
|
|
54
58
|
"bottom-start"
|
|
55
59
|
),
|
|
56
|
-
hideTimeout:
|
|
57
|
-
});
|
|
58
|
-
const initialState = {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
initialFocus: _QNEPGQLLcjs.defaultValue.call(void 0, syncState.initialFocus, "container"),
|
|
62
|
-
values: _QNEPGQLLcjs.defaultValue.call(void 0,
|
|
60
|
+
hideTimeout: _M6ZA7XUPcjs.defaultValue.call(void 0, props.hideTimeout, syncState.hideTimeout, 0)
|
|
61
|
+
}));
|
|
62
|
+
const initialState = _6455U47Tcjs.__spreadProps.call(void 0, _6455U47Tcjs.__spreadValues.call(void 0, _6455U47Tcjs.__spreadValues.call(void 0, {}, composite.getState()), hovercard.getState()), {
|
|
63
|
+
initialFocus: _M6ZA7XUPcjs.defaultValue.call(void 0, syncState.initialFocus, "container"),
|
|
64
|
+
values: _M6ZA7XUPcjs.defaultValue.call(void 0,
|
|
63
65
|
props.values,
|
|
64
66
|
syncState.values,
|
|
65
67
|
props.defaultValues,
|
|
66
68
|
{}
|
|
67
69
|
)
|
|
68
|
-
};
|
|
69
|
-
const menu =
|
|
70
|
+
});
|
|
71
|
+
const menu = _6SPJEESBcjs.createStore.call(void 0, initialState, composite, hovercard, store);
|
|
70
72
|
menu.setup(
|
|
71
73
|
() => menu.sync(
|
|
72
74
|
(state) => {
|
|
@@ -77,10 +79,7 @@ function createMenuStore({
|
|
|
77
79
|
["mounted"]
|
|
78
80
|
)
|
|
79
81
|
);
|
|
80
|
-
return {
|
|
81
|
-
...composite,
|
|
82
|
-
...hovercard,
|
|
83
|
-
...menu,
|
|
82
|
+
return _6455U47Tcjs.__spreadProps.call(void 0, _6455U47Tcjs.__spreadValues.call(void 0, _6455U47Tcjs.__spreadValues.call(void 0, _6455U47Tcjs.__spreadValues.call(void 0, {}, composite), hovercard), menu), {
|
|
84
83
|
setInitialFocus: (value) => menu.setState("initialFocus", value),
|
|
85
84
|
setValues: (values) => menu.setState("values", values),
|
|
86
85
|
setValue: (name, value) => {
|
|
@@ -92,16 +91,15 @@ function createMenuStore({
|
|
|
92
91
|
return;
|
|
93
92
|
menu.setState("values", (values) => {
|
|
94
93
|
const prevValue = values[name];
|
|
95
|
-
const nextValue =
|
|
94
|
+
const nextValue = _M6ZA7XUPcjs.applyState.call(void 0, value, prevValue);
|
|
96
95
|
if (nextValue === prevValue)
|
|
97
96
|
return values;
|
|
98
|
-
return {
|
|
99
|
-
...values,
|
|
97
|
+
return _6455U47Tcjs.__spreadProps.call(void 0, _6455U47Tcjs.__spreadValues.call(void 0, {}, values), {
|
|
100
98
|
[name]: nextValue !== void 0 && nextValue
|
|
101
|
-
};
|
|
99
|
+
});
|
|
102
100
|
});
|
|
103
101
|
}
|
|
104
|
-
};
|
|
102
|
+
});
|
|
105
103
|
}
|
|
106
104
|
|
|
107
105
|
|
|
@@ -1,10 +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/
|
|
7
|
-
require('../__chunks/
|
|
3
|
+
var _RD3S4VKYcjs = require('../__chunks/RD3S4VKY.cjs');
|
|
4
|
+
require('../__chunks/HEFJPUYD.cjs');
|
|
5
|
+
require('../__chunks/27ZAGOYG.cjs');
|
|
6
|
+
require('../__chunks/6SPJEESB.cjs');
|
|
7
|
+
require('../__chunks/M6ZA7XUP.cjs');
|
|
8
|
+
require('../__chunks/6455U47T.cjs');
|
|
8
9
|
|
|
9
10
|
|
|
10
|
-
exports.createPopoverStore =
|
|
11
|
+
exports.createPopoverStore = _RD3S4VKYcjs.createPopoverStore;
|
|
@@ -3,27 +3,10 @@ import type { Store, StoreOptions, StoreProps } from "../utils/store.js";
|
|
|
3
3
|
import type { SetState } from "../utils/types.js";
|
|
4
4
|
type BasePlacement = "top" | "bottom" | "left" | "right";
|
|
5
5
|
type Placement = BasePlacement | `${BasePlacement}-start` | `${BasePlacement}-end`;
|
|
6
|
-
type AnchorRect = {
|
|
7
|
-
x?: number;
|
|
8
|
-
y?: number;
|
|
9
|
-
width?: number;
|
|
10
|
-
height?: number;
|
|
11
|
-
};
|
|
12
6
|
/**
|
|
13
7
|
* Creates a popover store.
|
|
14
8
|
*/
|
|
15
|
-
export declare function createPopoverStore({
|
|
16
|
-
export interface PopoverStoreRenderCallbackProps extends Pick<PopoverStoreState, "anchorElement" | "popoverElement" | "arrowElement" | "mounted" | "placement" | "fixed" | "gutter" | "shift" | "overlap" | "flip" | "sameWidth" | "fitViewport" | "arrowPadding" | "overflowPadding"> {
|
|
17
|
-
/**
|
|
18
|
-
* A method that updates the `currentPlacement` state.
|
|
19
|
-
*/
|
|
20
|
-
setPlacement: SetState<Placement>;
|
|
21
|
-
/**
|
|
22
|
-
* The default render callback that will be called when the `renderCallback`
|
|
23
|
-
* prop is not provided.
|
|
24
|
-
*/
|
|
25
|
-
defaultRenderCallback: () => () => void;
|
|
26
|
-
}
|
|
9
|
+
export declare function createPopoverStore({ popover: otherPopover, ...props }?: PopoverStoreProps): PopoverStore;
|
|
27
10
|
export interface PopoverStoreState extends DialogStoreState {
|
|
28
11
|
/**
|
|
29
12
|
* The anchor element.
|
|
@@ -49,64 +32,10 @@ export interface PopoverStoreState extends DialogStoreState {
|
|
|
49
32
|
*/
|
|
50
33
|
placement: Placement;
|
|
51
34
|
/**
|
|
52
|
-
*
|
|
53
|
-
*
|
|
54
|
-
*/
|
|
55
|
-
fixed: boolean;
|
|
56
|
-
/**
|
|
57
|
-
* The distance between the popover and the anchor element. By default, it's 0
|
|
58
|
-
* plus half of the arrow offset, if it exists.
|
|
35
|
+
* A symbol that's used to recompute the popover position when the `render`
|
|
36
|
+
* method is called.
|
|
59
37
|
*/
|
|
60
|
-
|
|
61
|
-
/**
|
|
62
|
-
* The skidding of the popover along the anchor element.
|
|
63
|
-
* @default 0
|
|
64
|
-
*/
|
|
65
|
-
shift: number;
|
|
66
|
-
/**
|
|
67
|
-
* Controls the behavior of the popover when it overflows the viewport:
|
|
68
|
-
* - If a `boolean`, specifies whether the popover should flip to the
|
|
69
|
-
* opposite side when it overflows.
|
|
70
|
-
* - If a `string`, indicates the preferred fallback placements when it
|
|
71
|
-
* overflows. The placements must be spaced-delimited, e.g. "top left".
|
|
72
|
-
* @default true
|
|
73
|
-
*/
|
|
74
|
-
flip: boolean | string;
|
|
75
|
-
/**
|
|
76
|
-
* Whether the popover should slide when it overflows.
|
|
77
|
-
* @default true
|
|
78
|
-
*/
|
|
79
|
-
slide: boolean;
|
|
80
|
-
/**
|
|
81
|
-
* Whether the popover can overlap the anchor element when it overflows.
|
|
82
|
-
* @default false
|
|
83
|
-
*/
|
|
84
|
-
overlap: boolean;
|
|
85
|
-
/**
|
|
86
|
-
* Whether the popover should have the same width as the anchor element. This
|
|
87
|
-
* will be exposed to CSS as `--popover-anchor-width`.
|
|
88
|
-
* @default false
|
|
89
|
-
*/
|
|
90
|
-
sameWidth: boolean;
|
|
91
|
-
/**
|
|
92
|
-
* Whether the popover should fit the viewport. If this is set to true, the
|
|
93
|
-
* popover wrapper will have `maxWidth` and `maxHeight` set to the viewport
|
|
94
|
-
* size. This will be exposed to CSS as `--popover-available-width` and
|
|
95
|
-
* `--popover-available-height`.
|
|
96
|
-
* @default false
|
|
97
|
-
*/
|
|
98
|
-
fitViewport: boolean;
|
|
99
|
-
/**
|
|
100
|
-
* The minimum padding between the arrow and the popover corner.
|
|
101
|
-
* @default 4
|
|
102
|
-
*/
|
|
103
|
-
arrowPadding: number;
|
|
104
|
-
/**
|
|
105
|
-
* The minimum padding between the popover and the viewport edge. This will be
|
|
106
|
-
* exposed to CSS as `--popover-overflow-padding`.
|
|
107
|
-
* @default 8
|
|
108
|
-
*/
|
|
109
|
-
overflowPadding: number;
|
|
38
|
+
rendered: symbol;
|
|
110
39
|
}
|
|
111
40
|
export interface PopoverStoreFunctions extends DialogStoreFunctions {
|
|
112
41
|
/**
|
|
@@ -122,23 +51,13 @@ export interface PopoverStoreFunctions extends DialogStoreFunctions {
|
|
|
122
51
|
*/
|
|
123
52
|
setArrowElement: SetState<PopoverStoreState["arrowElement"]>;
|
|
124
53
|
/**
|
|
125
|
-
*
|
|
126
|
-
*
|
|
127
|
-
*
|
|
128
|
-
*/
|
|
129
|
-
getAnchorRect?: (anchor: HTMLElement | null) => AnchorRect | null;
|
|
130
|
-
/**
|
|
131
|
-
* A function that will be called when the popover needs to calculate its
|
|
132
|
-
* styles. It will override the internal behavior.
|
|
133
|
-
*/
|
|
134
|
-
renderCallback?: (props: PopoverStoreRenderCallbackProps) => void | (() => void);
|
|
135
|
-
/**
|
|
136
|
-
* A function that can be used to recompute the popover styles. This is useful
|
|
137
|
-
* when the popover anchor changes in a way that affects the popover position.
|
|
54
|
+
* A function that can be used to recompute the popover position. This is
|
|
55
|
+
* useful when the popover anchor changes in a way that affects the popover
|
|
56
|
+
* position.
|
|
138
57
|
*/
|
|
139
58
|
render: () => void;
|
|
140
59
|
}
|
|
141
|
-
export interface PopoverStoreOptions extends StoreOptions<PopoverStoreState, "placement"
|
|
60
|
+
export interface PopoverStoreOptions extends StoreOptions<PopoverStoreState, "placement">, DialogStoreOptions {
|
|
142
61
|
/**
|
|
143
62
|
* A reference to another popover store that's controlling another popover to
|
|
144
63
|
* keep them in sync.
|
|
@@ -1,40 +1,41 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
require('../__chunks/
|
|
3
|
+
var _EUJ6NNA6cjs = require('../__chunks/EUJ6NNA6.cjs');
|
|
4
|
+
require('../__chunks/FXEBKN6G.cjs');
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
var
|
|
7
|
+
var _6SPJEESBcjs = require('../__chunks/6SPJEESB.cjs');
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
var
|
|
11
|
-
require('../__chunks/
|
|
10
|
+
var _M6ZA7XUPcjs = require('../__chunks/M6ZA7XUP.cjs');
|
|
11
|
+
require('../__chunks/ZNW4LSWU.cjs');
|
|
12
12
|
require('../__chunks/GDZQUFNP.cjs');
|
|
13
13
|
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
var _6455U47Tcjs = require('../__chunks/6455U47T.cjs');
|
|
18
|
+
|
|
14
19
|
// src/radio/radio-store.ts
|
|
15
|
-
function createRadioStore({
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
const syncState =
|
|
19
|
-
const composite =
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
})
|
|
23
|
-
|
|
24
|
-
...composite.getState(),
|
|
25
|
-
value: _QNEPGQLLcjs.defaultValue.call(void 0,
|
|
20
|
+
function createRadioStore(_a = {}) {
|
|
21
|
+
var props = _6455U47Tcjs.__objRest.call(void 0, _a, []);
|
|
22
|
+
var _a2;
|
|
23
|
+
const syncState = (_a2 = props.store) == null ? void 0 : _a2.getState();
|
|
24
|
+
const composite = _EUJ6NNA6cjs.createCompositeStore.call(void 0, _6455U47Tcjs.__spreadProps.call(void 0, _6455U47Tcjs.__spreadValues.call(void 0, {}, props), {
|
|
25
|
+
focusLoop: _M6ZA7XUPcjs.defaultValue.call(void 0, props.focusLoop, syncState == null ? void 0 : syncState.focusLoop, true)
|
|
26
|
+
}));
|
|
27
|
+
const initialState = _6455U47Tcjs.__spreadProps.call(void 0, _6455U47Tcjs.__spreadValues.call(void 0, {}, composite.getState()), {
|
|
28
|
+
value: _M6ZA7XUPcjs.defaultValue.call(void 0,
|
|
26
29
|
props.value,
|
|
27
|
-
|
|
30
|
+
syncState == null ? void 0 : syncState.value,
|
|
28
31
|
props.defaultValue,
|
|
29
32
|
null
|
|
30
33
|
)
|
|
31
|
-
};
|
|
32
|
-
const radio =
|
|
33
|
-
return {
|
|
34
|
-
...composite,
|
|
35
|
-
...radio,
|
|
34
|
+
});
|
|
35
|
+
const radio = _6SPJEESBcjs.createStore.call(void 0, initialState, composite, props.store);
|
|
36
|
+
return _6455U47Tcjs.__spreadProps.call(void 0, _6455U47Tcjs.__spreadValues.call(void 0, _6455U47Tcjs.__spreadValues.call(void 0, {}, composite), radio), {
|
|
36
37
|
setValue: (value) => radio.setState("value", value)
|
|
37
|
-
};
|
|
38
|
+
});
|
|
38
39
|
}
|
|
39
40
|
|
|
40
41
|
|