@ariakit/react 0.4.28 → 0.4.29
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-035.md → CHANGELOG-0314.md} +205 -0
- package/CHANGELOG.md +48 -202
- package/cjs/__chunks/{SXAPGTJ4.cjs → 2ENQD3AS.cjs} +6 -6
- package/cjs/__chunks/{L2IFVMDU.cjs → 2WBRQ3I7.cjs} +7 -6
- package/cjs/__chunks/{N3DLR7OL.cjs → 3B6TF7HK.cjs} +6 -6
- package/cjs/__chunks/{XPQIHUQ7.cjs → 42GL4LKI.cjs} +20 -20
- package/cjs/__chunks/{VXUZM542.cjs → 53Q7HWXL.cjs} +165 -165
- package/cjs/__chunks/{3FIXGHZ2.cjs → 5QRVCRDI.cjs} +5 -5
- package/cjs/__chunks/{7MXJT4IN.cjs → 5XICU34X.cjs} +3 -3
- package/cjs/__chunks/{334WKW6I.cjs → 5ZX5ACFH.cjs} +4 -4
- package/cjs/__chunks/{2MDC3Z3V.cjs → 6BNWLCHF.cjs} +10 -10
- package/cjs/__chunks/{IFZV5LA3.cjs → 6XKLGFUO.cjs} +17 -17
- package/cjs/__chunks/{PZXRBFZF.cjs → 7SEEXNY6.cjs} +7 -7
- package/cjs/__chunks/{VXDLN5CP.cjs → 7XB4QE2H.cjs} +29 -29
- package/cjs/__chunks/{RVXPEX7O.cjs → AI3BA27G.cjs} +18 -18
- package/cjs/__chunks/{NG34QRI6.cjs → BTARPES4.cjs} +79 -32
- package/cjs/__chunks/{LCX235VJ.cjs → CKHOJYDQ.cjs} +6 -6
- package/cjs/__chunks/{C4NVIV6V.cjs → CRPG37KH.cjs} +104 -84
- package/cjs/__chunks/{4RKQMGBK.cjs → CYTUSXPR.cjs} +236 -222
- package/cjs/__chunks/{IHVFJGGN.cjs → D6USTXKA.cjs} +4 -4
- package/cjs/__chunks/{NFZWL7LE.cjs → DDV252ZY.cjs} +4 -4
- package/cjs/__chunks/DVB2WSHD.cjs +41 -0
- package/cjs/__chunks/{YEXJT4IL.cjs → EF57ZMJN.cjs} +10 -10
- package/cjs/__chunks/{RR46KI45.cjs → EQYJ6RA7.cjs} +3 -3
- package/cjs/__chunks/{D4HCGWOU.cjs → FHPV2Q7C.cjs} +182 -78
- package/cjs/__chunks/{FHQ5DVYQ.cjs → FNYFMCD7.cjs} +4 -4
- package/cjs/__chunks/{FELYQPO5.cjs → FWVWDDOL.cjs} +182 -173
- package/cjs/__chunks/{GUY4MKX2.cjs → G2JI2Z7U.cjs} +12 -12
- package/cjs/__chunks/{Z5PDS46M.cjs → GI27TVAM.cjs} +159 -159
- package/cjs/__chunks/{PTE2IJM5.cjs → GQZ5DRPC.cjs} +32 -30
- package/cjs/__chunks/{XH4GE3VE.cjs → GV4SR2CM.cjs} +7 -7
- package/cjs/__chunks/{PU63IQFD.cjs → HCYQ5Z7Z.cjs} +58 -58
- package/cjs/__chunks/{ASOIXRUN.cjs → HGV6FCZP.cjs} +61 -61
- package/cjs/__chunks/{OOFUBC32.cjs → I4JS2KAF.cjs} +17 -19
- package/cjs/__chunks/{DVWS2XPY.cjs → I6N3772N.cjs} +21 -21
- package/cjs/__chunks/{7POA4244.cjs → IEVLYJJP.cjs} +22 -22
- package/cjs/__chunks/{ZNW2LLWJ.cjs → IGWSYIUY.cjs} +15 -15
- package/cjs/__chunks/{QAUJZR6Y.cjs → JBOLBTVU.cjs} +15 -4
- package/cjs/__chunks/{MN5TONXW.cjs → JXYV7OWF.cjs} +33 -36
- package/cjs/__chunks/{FIPBE5IX.cjs → KDVG735H.cjs} +3 -3
- package/cjs/__chunks/{TSBEWPNT.cjs → KFUU3G3B.cjs} +39 -39
- package/cjs/__chunks/{ZYPARRXG.cjs → LGUAIO4Q.cjs} +4 -4
- package/cjs/__chunks/{5NTEPQ2U.cjs → M6YHODMV.cjs} +20 -20
- package/cjs/__chunks/{SIF7IN4L.cjs → MWZS5XD4.cjs} +12 -12
- package/cjs/__chunks/{UUEFM3TG.cjs → NBAYASRC.cjs} +17 -17
- package/cjs/__chunks/{RXZPZPJX.cjs → OFFSDIY3.cjs} +21 -21
- package/cjs/__chunks/{RGH2H3WL.cjs → OP2QHIHD.cjs} +4 -4
- package/cjs/__chunks/{2HXQHKBC.cjs → P6Y2DILA.cjs} +17 -17
- package/cjs/__chunks/{LMCBLO3G.cjs → P7AY4KL3.cjs} +10 -10
- package/cjs/__chunks/{PDPE2VAZ.cjs → QJQWEU4Q.cjs} +134 -120
- package/cjs/__chunks/{UV7CXZEM.cjs → RZJLQJQM.cjs} +9 -9
- package/cjs/__chunks/{34UJGLOZ.cjs → SAFZBKT3.cjs} +61 -48
- package/cjs/__chunks/{LVHC4DSB.cjs → TMY4OIYC.cjs} +19 -19
- package/cjs/__chunks/{LS5VO6AA.cjs → ULDO57DJ.cjs} +12 -12
- package/cjs/__chunks/{NMUCJYMR.cjs → US2XYAXE.cjs} +83 -83
- package/cjs/__chunks/{GUB6WHB6.cjs → VUISVT3V.cjs} +9 -9
- package/cjs/__chunks/{RLKC7JVT.cjs → WHUT2PFL.cjs} +4 -4
- package/cjs/__chunks/WLHP5OM6.cjs +37 -0
- package/cjs/__chunks/{7M4GY5DS.cjs → WYI5CKPV.cjs} +38 -38
- package/cjs/__chunks/{SQ72MZ63.cjs → ZPWE3FTF.cjs} +39 -39
- package/cjs/button.cjs +5 -5
- package/cjs/checkbox.cjs +8 -8
- package/cjs/collection.cjs +6 -6
- package/cjs/combobox.cjs +30 -30
- package/cjs/command.cjs +4 -4
- package/cjs/composite.cjs +17 -17
- package/cjs/dialog.cjs +18 -18
- package/cjs/disclosure.cjs +9 -9
- package/cjs/focus-trap.cjs +5 -5
- package/cjs/focusable.cjs +3 -3
- package/cjs/form.cjs +14 -14
- package/cjs/group.cjs +3 -3
- package/cjs/heading.cjs +3 -3
- package/cjs/hovercard.cjs +25 -25
- package/cjs/index.cjs +59 -59
- package/cjs/menu.cjs +42 -42
- package/cjs/menubar.cjs +8 -8
- package/cjs/popover.cjs +25 -25
- package/cjs/portal.cjs +5 -5
- package/cjs/radio.cjs +12 -12
- package/cjs/role.cjs +3 -3
- package/cjs/select.cjs +36 -36
- package/cjs/separator.cjs +3 -3
- package/cjs/store.cjs +3 -3
- package/cjs/tab.cjs +15 -15
- package/cjs/toolbar.cjs +13 -13
- package/cjs/tooltip.cjs +15 -15
- package/cjs/visually-hidden.cjs +3 -3
- package/package.json +4 -4
- package/cjs/__chunks/FVIS5BFZ.cjs +0 -41
- package/cjs/__chunks/TLUFYZC7.cjs +0 -37
|
@@ -1,29 +1,29 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _M6YHODMVcjs = require('./M6YHODMV.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
var
|
|
7
|
+
var _IEVLYJJPcjs = require('./IEVLYJJP.cjs');
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
var
|
|
10
|
+
var _2WBRQ3I7cjs = require('./2WBRQ3I7.cjs');
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
|
|
14
|
-
var
|
|
14
|
+
var _MWZS5XD4cjs = require('./MWZS5XD4.cjs');
|
|
15
15
|
|
|
16
16
|
|
|
17
|
-
var
|
|
17
|
+
var _VUISVT3Vcjs = require('./VUISVT3V.cjs');
|
|
18
18
|
|
|
19
19
|
|
|
20
20
|
|
|
21
21
|
|
|
22
22
|
|
|
23
|
-
var
|
|
23
|
+
var _42GL4LKIcjs = require('./42GL4LKI.cjs');
|
|
24
24
|
|
|
25
25
|
|
|
26
|
-
var
|
|
26
|
+
var _P7AY4KL3cjs = require('./P7AY4KL3.cjs');
|
|
27
27
|
|
|
28
28
|
|
|
29
29
|
|
|
@@ -33,10 +33,10 @@ var _LMCBLO3Gcjs = require('./LMCBLO3G.cjs');
|
|
|
33
33
|
|
|
34
34
|
|
|
35
35
|
|
|
36
|
-
var
|
|
36
|
+
var _FHPV2Q7Ccjs = require('./FHPV2Q7C.cjs');
|
|
37
37
|
|
|
38
38
|
|
|
39
|
-
var
|
|
39
|
+
var _BTARPES4cjs = require('./BTARPES4.cjs');
|
|
40
40
|
|
|
41
41
|
|
|
42
42
|
|
|
@@ -60,10 +60,10 @@ var _NG34QRI6cjs = require('./NG34QRI6.cjs');
|
|
|
60
60
|
|
|
61
61
|
|
|
62
62
|
|
|
63
|
-
var
|
|
63
|
+
var _JBOLBTVUcjs = require('./JBOLBTVU.cjs');
|
|
64
64
|
|
|
65
65
|
// ../ariakit-react-components/dist/form/form-context.js
|
|
66
|
-
var ctx =
|
|
66
|
+
var ctx = _JBOLBTVUcjs.createStoreContext.call(void 0, [_42GL4LKIcjs.CollectionContextProvider], [_42GL4LKIcjs.CollectionScopedContextProvider]);
|
|
67
67
|
var useFormContext = ctx.useContext;
|
|
68
68
|
var useFormScopedContext = ctx.useScopedContext;
|
|
69
69
|
var useFormProviderContext = ctx.useProviderContext;
|
|
@@ -83,18 +83,18 @@ function getFirstInvalidField(items) {
|
|
|
83
83
|
return item.type === "field" && ((_a = item.element) == null ? void 0 : _a.getAttribute("aria-invalid")) === "true";
|
|
84
84
|
});
|
|
85
85
|
}
|
|
86
|
-
var useForm =
|
|
86
|
+
var useForm = _JBOLBTVUcjs.createHook.call(void 0, function useForm2({ store, validateOnChange = true, validateOnBlur = true, resetOnUnmount = false, resetOnSubmit = true, autoFocusOnSubmit = true, ...props }) {
|
|
87
87
|
const context = useFormContext();
|
|
88
88
|
store = store || context;
|
|
89
|
-
|
|
89
|
+
_JBOLBTVUcjs.invariant.call(void 0, store, process.env.NODE_ENV !== "production" && "Form must receive a `store` prop or be wrapped in a FormProvider component.");
|
|
90
90
|
const ref = _react.useRef.call(void 0, null);
|
|
91
|
-
const values =
|
|
92
|
-
const submitSucceed =
|
|
93
|
-
const submitFailed =
|
|
94
|
-
const items =
|
|
95
|
-
const defaultValues =
|
|
91
|
+
const values = _FHPV2Q7Ccjs.useStoreState.call(void 0, store, "values");
|
|
92
|
+
const submitSucceed = _FHPV2Q7Ccjs.useStoreState.call(void 0, store, "submitSucceed");
|
|
93
|
+
const submitFailed = _FHPV2Q7Ccjs.useStoreState.call(void 0, store, "submitFailed");
|
|
94
|
+
const items = _FHPV2Q7Ccjs.useStoreState.call(void 0, store, "items");
|
|
95
|
+
const defaultValues = _JBOLBTVUcjs.useInitialValue.call(void 0, values);
|
|
96
96
|
_react.useEffect.call(void 0, () => resetOnUnmount ? store == null ? void 0 : store.reset : void 0, [resetOnUnmount, store]);
|
|
97
|
-
|
|
97
|
+
_JBOLBTVUcjs.useUpdateEffect.call(void 0, () => {
|
|
98
98
|
if (!validateOnChange) return;
|
|
99
99
|
if (values === defaultValues) return;
|
|
100
100
|
store == null ? void 0 : store.validate();
|
|
@@ -122,14 +122,14 @@ var useForm = _QAUJZR6Ycjs.createHook.call(void 0, function useForm2({ store, va
|
|
|
122
122
|
if (!element) return;
|
|
123
123
|
setShouldFocusOnSubmit(false);
|
|
124
124
|
element.focus();
|
|
125
|
-
if (
|
|
125
|
+
if (_JBOLBTVUcjs.isTextField.call(void 0, element)) element.select();
|
|
126
126
|
}, [
|
|
127
127
|
autoFocusOnSubmit,
|
|
128
128
|
submitFailed,
|
|
129
129
|
items
|
|
130
130
|
]);
|
|
131
131
|
const onSubmitProp = props.onSubmit;
|
|
132
|
-
const onSubmit =
|
|
132
|
+
const onSubmit = _JBOLBTVUcjs.useEvent.call(void 0, (event) => {
|
|
133
133
|
onSubmitProp == null ? void 0 : onSubmitProp(event);
|
|
134
134
|
if (event.defaultPrevented) return;
|
|
135
135
|
event.preventDefault();
|
|
@@ -138,7 +138,7 @@ var useForm = _QAUJZR6Ycjs.createHook.call(void 0, function useForm2({ store, va
|
|
|
138
138
|
setShouldFocusOnSubmit(true);
|
|
139
139
|
});
|
|
140
140
|
const onBlurProp = props.onBlur;
|
|
141
|
-
const onBlur =
|
|
141
|
+
const onBlur = _JBOLBTVUcjs.useEvent.call(void 0, (event) => {
|
|
142
142
|
onBlurProp == null ? void 0 : onBlurProp(event);
|
|
143
143
|
if (event.defaultPrevented) return;
|
|
144
144
|
if (!validateOnBlur) return;
|
|
@@ -147,29 +147,29 @@ var useForm = _QAUJZR6Ycjs.createHook.call(void 0, function useForm2({ store, va
|
|
|
147
147
|
store.validate();
|
|
148
148
|
});
|
|
149
149
|
const onResetProp = props.onReset;
|
|
150
|
-
const onReset =
|
|
150
|
+
const onReset = _JBOLBTVUcjs.useEvent.call(void 0, (event) => {
|
|
151
151
|
onResetProp == null ? void 0 : onResetProp(event);
|
|
152
152
|
if (event.defaultPrevented) return;
|
|
153
153
|
event.preventDefault();
|
|
154
154
|
store == null ? void 0 : store.reset();
|
|
155
155
|
});
|
|
156
|
-
props =
|
|
156
|
+
props = _JBOLBTVUcjs.useWrapElement.call(void 0, props, (element) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, FormScopedContextProvider, {
|
|
157
157
|
value: store,
|
|
158
158
|
children: element
|
|
159
159
|
}), [store]);
|
|
160
160
|
props = {
|
|
161
|
-
role:
|
|
161
|
+
role: _JBOLBTVUcjs.useTagName.call(void 0, ref, TagName) !== "form" ? "form" : void 0,
|
|
162
162
|
noValidate: true,
|
|
163
163
|
...props,
|
|
164
|
-
ref:
|
|
164
|
+
ref: _JBOLBTVUcjs.useMergeRefs.call(void 0, ref, props.ref),
|
|
165
165
|
onSubmit,
|
|
166
166
|
onBlur,
|
|
167
167
|
onReset
|
|
168
168
|
};
|
|
169
169
|
return props;
|
|
170
170
|
});
|
|
171
|
-
var Form =
|
|
172
|
-
return
|
|
171
|
+
var Form = _JBOLBTVUcjs.forwardRef.call(void 0, function Form2(props) {
|
|
172
|
+
return _JBOLBTVUcjs.createElement.call(void 0, TagName, useForm(props));
|
|
173
173
|
});
|
|
174
174
|
|
|
175
175
|
// ../ariakit-react-components/dist/form/form-control.js
|
|
@@ -180,17 +180,17 @@ function getNamedElement(ref, name) {
|
|
|
180
180
|
if (!element) return null;
|
|
181
181
|
if (element.name === name) return element;
|
|
182
182
|
if (element.form) return element.form.elements.namedItem(name);
|
|
183
|
-
return
|
|
183
|
+
return _JBOLBTVUcjs.getDocument.call(void 0, element).getElementsByName(name)[0];
|
|
184
184
|
}
|
|
185
185
|
function useItem(store, name, type) {
|
|
186
|
-
return
|
|
186
|
+
return _FHPV2Q7Ccjs.useStoreState.call(void 0, store, (state) => state.items.find((item) => item.type === type && item.name === name));
|
|
187
187
|
}
|
|
188
|
-
var useFormControl =
|
|
188
|
+
var useFormControl = _JBOLBTVUcjs.createHook.call(void 0, function useFormControl2({ store, name: nameProp, getItem: getItemProp, touchOnBlur = true, ...props }) {
|
|
189
189
|
const context = useFormContext();
|
|
190
190
|
store = store || context;
|
|
191
|
-
|
|
191
|
+
_JBOLBTVUcjs.invariant.call(void 0, store, process.env.NODE_ENV !== "production" && "FormControl must be wrapped in a Form component.");
|
|
192
192
|
const name = String(nameProp);
|
|
193
|
-
const id =
|
|
193
|
+
const id = _JBOLBTVUcjs.useId.call(void 0, props.id);
|
|
194
194
|
const ref = _react.useRef.call(void 0, null);
|
|
195
195
|
store.useValidate(async () => {
|
|
196
196
|
const element = getNamedElement(ref, name);
|
|
@@ -213,8 +213,8 @@ var useFormControl = _QAUJZR6Ycjs.createHook.call(void 0, function useFormContro
|
|
|
213
213
|
getItemProp
|
|
214
214
|
]);
|
|
215
215
|
const onBlurProp = props.onBlur;
|
|
216
|
-
const touchOnBlurProp =
|
|
217
|
-
const onBlur =
|
|
216
|
+
const touchOnBlurProp = _JBOLBTVUcjs.useBooleanEvent.call(void 0, touchOnBlur);
|
|
217
|
+
const onBlur = _JBOLBTVUcjs.useEvent.call(void 0, (event) => {
|
|
218
218
|
onBlurProp == null ? void 0 : onBlurProp(event);
|
|
219
219
|
if (event.defaultPrevented) return;
|
|
220
220
|
if (!touchOnBlurProp(event)) return;
|
|
@@ -223,18 +223,18 @@ var useFormControl = _QAUJZR6Ycjs.createHook.call(void 0, function useFormContro
|
|
|
223
223
|
const label = useItem(store, name, "label");
|
|
224
224
|
const error = useItem(store, name, "error");
|
|
225
225
|
const description = useItem(store, name, "description");
|
|
226
|
-
const describedBy =
|
|
227
|
-
const invalid =
|
|
226
|
+
const describedBy = _JBOLBTVUcjs.cx.call(void 0, error == null ? void 0 : error.id, description == null ? void 0 : description.id, props["aria-describedby"]);
|
|
227
|
+
const invalid = _FHPV2Q7Ccjs.useStoreState.call(void 0, store, () => !!(store == null ? void 0 : store.getError(name)) && store.getFieldTouched(name));
|
|
228
228
|
props = {
|
|
229
229
|
"aria-labelledby": props["aria-label"] != null ? void 0 : label == null ? void 0 : label.id,
|
|
230
230
|
"aria-invalid": invalid,
|
|
231
231
|
...props,
|
|
232
232
|
id,
|
|
233
233
|
"aria-describedby": describedBy || void 0,
|
|
234
|
-
ref:
|
|
234
|
+
ref: _JBOLBTVUcjs.useMergeRefs.call(void 0, ref, props.ref),
|
|
235
235
|
onBlur
|
|
236
236
|
};
|
|
237
|
-
props =
|
|
237
|
+
props = _VUISVT3Vcjs.useCollectionItem.call(void 0, {
|
|
238
238
|
store,
|
|
239
239
|
...props,
|
|
240
240
|
name,
|
|
@@ -242,19 +242,19 @@ var useFormControl = _QAUJZR6Ycjs.createHook.call(void 0, function useFormContro
|
|
|
242
242
|
});
|
|
243
243
|
return props;
|
|
244
244
|
});
|
|
245
|
-
var FormControl =
|
|
246
|
-
return
|
|
245
|
+
var FormControl = _JBOLBTVUcjs.memo.call(void 0, _JBOLBTVUcjs.forwardRef.call(void 0, function FormControl2(props) {
|
|
246
|
+
return _JBOLBTVUcjs.createElement.call(void 0, TagName2, useFormControl(props));
|
|
247
247
|
}));
|
|
248
248
|
|
|
249
249
|
// ../ariakit-react-components/dist/form/form-checkbox.js
|
|
250
250
|
var TagName3 = "input";
|
|
251
|
-
var useFormCheckbox =
|
|
251
|
+
var useFormCheckbox = _JBOLBTVUcjs.createHook.call(void 0, function useFormCheckbox2({ store, name: nameProp, value, checked, defaultChecked, ...props }) {
|
|
252
252
|
const context = useFormContext();
|
|
253
253
|
store = store || context;
|
|
254
|
-
|
|
254
|
+
_JBOLBTVUcjs.invariant.call(void 0, store, process.env.NODE_ENV !== "production" && "FormCheckbox must be wrapped in a Form component.");
|
|
255
255
|
const name = String(nameProp);
|
|
256
|
-
props =
|
|
257
|
-
store:
|
|
256
|
+
props = _IEVLYJJPcjs.useCheckbox.call(void 0, {
|
|
257
|
+
store: _IEVLYJJPcjs.useCheckboxStore.call(void 0, {
|
|
258
258
|
value: store.useValue(name),
|
|
259
259
|
setValue: (value2) => store == null ? void 0 : store.setValue(name, value2)
|
|
260
260
|
}),
|
|
@@ -270,18 +270,18 @@ var useFormCheckbox = _QAUJZR6Ycjs.createHook.call(void 0, function useFormCheck
|
|
|
270
270
|
});
|
|
271
271
|
return props;
|
|
272
272
|
});
|
|
273
|
-
var FormCheckbox =
|
|
274
|
-
return
|
|
273
|
+
var FormCheckbox = _JBOLBTVUcjs.memo.call(void 0, _JBOLBTVUcjs.forwardRef.call(void 0, function FormCheckbox2(props) {
|
|
274
|
+
return _JBOLBTVUcjs.createElement.call(void 0, TagName3, useFormCheckbox(props));
|
|
275
275
|
}));
|
|
276
276
|
|
|
277
277
|
// ../ariakit-react-components/dist/form/form-description.js
|
|
278
278
|
|
|
279
279
|
var TagName4 = "div";
|
|
280
|
-
var useFormDescription =
|
|
280
|
+
var useFormDescription = _JBOLBTVUcjs.createHook.call(void 0, function useFormDescription2({ store, name: nameProp, getItem: getItemProp, ...props }) {
|
|
281
281
|
const context = useFormContext();
|
|
282
282
|
store = store || context;
|
|
283
|
-
|
|
284
|
-
const id =
|
|
283
|
+
_JBOLBTVUcjs.invariant.call(void 0, store, process.env.NODE_ENV !== "production" && "FormDescription must be wrapped in a Form component.");
|
|
284
|
+
const id = _JBOLBTVUcjs.useId.call(void 0, props.id);
|
|
285
285
|
const ref = _react.useRef.call(void 0, null);
|
|
286
286
|
const name = String(nameProp);
|
|
287
287
|
const getItem = _react.useCallback.call(void 0, (item) => {
|
|
@@ -301,27 +301,27 @@ var useFormDescription = _QAUJZR6Ycjs.createHook.call(void 0, function useFormDe
|
|
|
301
301
|
props = {
|
|
302
302
|
...props,
|
|
303
303
|
id,
|
|
304
|
-
ref:
|
|
304
|
+
ref: _JBOLBTVUcjs.useMergeRefs.call(void 0, ref, props.ref)
|
|
305
305
|
};
|
|
306
|
-
props =
|
|
306
|
+
props = _VUISVT3Vcjs.useCollectionItem.call(void 0, {
|
|
307
307
|
store,
|
|
308
308
|
...props,
|
|
309
309
|
getItem
|
|
310
310
|
});
|
|
311
311
|
return props;
|
|
312
312
|
});
|
|
313
|
-
var FormDescription =
|
|
314
|
-
return
|
|
313
|
+
var FormDescription = _JBOLBTVUcjs.memo.call(void 0, _JBOLBTVUcjs.forwardRef.call(void 0, function FormDescription2(props) {
|
|
314
|
+
return _JBOLBTVUcjs.createElement.call(void 0, TagName4, useFormDescription(props));
|
|
315
315
|
}));
|
|
316
316
|
|
|
317
317
|
// ../ariakit-react-components/dist/form/form-error.js
|
|
318
318
|
|
|
319
319
|
var TagName5 = "div";
|
|
320
|
-
var useFormError =
|
|
320
|
+
var useFormError = _JBOLBTVUcjs.createHook.call(void 0, function useFormError2({ store, name: nameProp, getItem: getItemProp, ...props }) {
|
|
321
321
|
const context = useFormContext();
|
|
322
322
|
store = store || context;
|
|
323
|
-
|
|
324
|
-
const id =
|
|
323
|
+
_JBOLBTVUcjs.invariant.call(void 0, store, process.env.NODE_ENV !== "production" && "FormError must be wrapped in a Form component.");
|
|
324
|
+
const id = _JBOLBTVUcjs.useId.call(void 0, props.id);
|
|
325
325
|
const ref = _react.useRef.call(void 0, null);
|
|
326
326
|
const name = String(nameProp);
|
|
327
327
|
const getItem = _react.useCallback.call(void 0, (item) => {
|
|
@@ -340,7 +340,7 @@ var useFormError = _QAUJZR6Ycjs.createHook.call(void 0, function useFormError2({
|
|
|
340
340
|
]);
|
|
341
341
|
props = {
|
|
342
342
|
role: "alert",
|
|
343
|
-
children:
|
|
343
|
+
children: _FHPV2Q7Ccjs.useStoreState.call(void 0, store, () => {
|
|
344
344
|
const error = store == null ? void 0 : store.getError(name);
|
|
345
345
|
if (error == null) return;
|
|
346
346
|
if (!(store == null ? void 0 : store.getFieldTouched(name))) return;
|
|
@@ -348,57 +348,57 @@ var useFormError = _QAUJZR6Ycjs.createHook.call(void 0, function useFormError2({
|
|
|
348
348
|
}),
|
|
349
349
|
...props,
|
|
350
350
|
id,
|
|
351
|
-
ref:
|
|
351
|
+
ref: _JBOLBTVUcjs.useMergeRefs.call(void 0, ref, props.ref)
|
|
352
352
|
};
|
|
353
|
-
props =
|
|
353
|
+
props = _VUISVT3Vcjs.useCollectionItem.call(void 0, {
|
|
354
354
|
store,
|
|
355
355
|
...props,
|
|
356
356
|
getItem
|
|
357
357
|
});
|
|
358
358
|
return props;
|
|
359
359
|
});
|
|
360
|
-
var FormError =
|
|
361
|
-
return
|
|
360
|
+
var FormError = _JBOLBTVUcjs.memo.call(void 0, _JBOLBTVUcjs.forwardRef.call(void 0, function FormError2(props) {
|
|
361
|
+
return _JBOLBTVUcjs.createElement.call(void 0, TagName5, useFormError(props));
|
|
362
362
|
}));
|
|
363
363
|
|
|
364
364
|
// ../ariakit-react-components/dist/form/form-field.js
|
|
365
365
|
var TagName6 = "input";
|
|
366
|
-
var useFormField =
|
|
366
|
+
var useFormField = _JBOLBTVUcjs.createHook.call(void 0, function useFormField2(props) {
|
|
367
367
|
return useFormControl(props);
|
|
368
368
|
});
|
|
369
|
-
var FormField =
|
|
370
|
-
return
|
|
369
|
+
var FormField = _JBOLBTVUcjs.memo.call(void 0, _JBOLBTVUcjs.forwardRef.call(void 0, function FormField2(props) {
|
|
370
|
+
return _JBOLBTVUcjs.createElement.call(void 0, TagName6, useFormField(props));
|
|
371
371
|
}));
|
|
372
372
|
|
|
373
373
|
// ../ariakit-react-components/dist/form/form-group.js
|
|
374
374
|
var TagName7 = "div";
|
|
375
|
-
var useFormGroup =
|
|
376
|
-
props =
|
|
375
|
+
var useFormGroup = _JBOLBTVUcjs.createHook.call(void 0, function useFormGroup2({ store, ...props }) {
|
|
376
|
+
props = _MWZS5XD4cjs.useGroup.call(void 0, props);
|
|
377
377
|
return props;
|
|
378
378
|
});
|
|
379
|
-
var FormGroup =
|
|
380
|
-
return
|
|
379
|
+
var FormGroup = _JBOLBTVUcjs.forwardRef.call(void 0, function FormGroup2(props) {
|
|
380
|
+
return _JBOLBTVUcjs.createElement.call(void 0, TagName7, useFormGroup(props));
|
|
381
381
|
});
|
|
382
382
|
|
|
383
383
|
// ../ariakit-react-components/dist/form/form-group-label.js
|
|
384
384
|
var TagName8 = "div";
|
|
385
|
-
var useFormGroupLabel =
|
|
386
|
-
props =
|
|
385
|
+
var useFormGroupLabel = _JBOLBTVUcjs.createHook.call(void 0, function useFormGroupLabel2({ store, ...props }) {
|
|
386
|
+
props = _MWZS5XD4cjs.useGroupLabel.call(void 0, props);
|
|
387
387
|
return props;
|
|
388
388
|
});
|
|
389
|
-
var FormGroupLabel =
|
|
390
|
-
return
|
|
389
|
+
var FormGroupLabel = _JBOLBTVUcjs.forwardRef.call(void 0, function FormGroupLabel2(props) {
|
|
390
|
+
return _JBOLBTVUcjs.createElement.call(void 0, TagName8, useFormGroupLabel(props));
|
|
391
391
|
});
|
|
392
392
|
|
|
393
393
|
// ../ariakit-react-components/dist/form/form-input.js
|
|
394
394
|
var TagName9 = "input";
|
|
395
|
-
var useFormInput =
|
|
395
|
+
var useFormInput = _JBOLBTVUcjs.createHook.call(void 0, function useFormInput2({ store, name: nameProp, ...props }) {
|
|
396
396
|
const context = useFormContext();
|
|
397
397
|
store = store || context;
|
|
398
|
-
|
|
398
|
+
_JBOLBTVUcjs.invariant.call(void 0, store, process.env.NODE_ENV !== "production" && "FormInput must be wrapped in a Form component.");
|
|
399
399
|
const name = String(nameProp);
|
|
400
400
|
const onChangeProp = props.onChange;
|
|
401
|
-
const onChange =
|
|
401
|
+
const onChange = _JBOLBTVUcjs.useEvent.call(void 0, (event) => {
|
|
402
402
|
onChangeProp == null ? void 0 : onChangeProp(event);
|
|
403
403
|
if (event.defaultPrevented) return;
|
|
404
404
|
store == null ? void 0 : store.setValue(name, event.target.value);
|
|
@@ -408,7 +408,7 @@ var useFormInput = _QAUJZR6Ycjs.createHook.call(void 0, function useFormInput2({
|
|
|
408
408
|
...props,
|
|
409
409
|
onChange
|
|
410
410
|
};
|
|
411
|
-
props =
|
|
411
|
+
props = _BTARPES4cjs.useFocusable.call(void 0, props);
|
|
412
412
|
props = useFormControl({
|
|
413
413
|
store,
|
|
414
414
|
name,
|
|
@@ -416,8 +416,8 @@ var useFormInput = _QAUJZR6Ycjs.createHook.call(void 0, function useFormInput2({
|
|
|
416
416
|
});
|
|
417
417
|
return props;
|
|
418
418
|
});
|
|
419
|
-
var FormInput =
|
|
420
|
-
return
|
|
419
|
+
var FormInput = _JBOLBTVUcjs.memo.call(void 0, _JBOLBTVUcjs.forwardRef.call(void 0, function FormInput2(props) {
|
|
420
|
+
return _JBOLBTVUcjs.createElement.call(void 0, TagName9, useFormInput(props));
|
|
421
421
|
}));
|
|
422
422
|
|
|
423
423
|
// ../ariakit-react-components/dist/form/form-label.js
|
|
@@ -427,11 +427,11 @@ var TagName10 = "label";
|
|
|
427
427
|
function supportsNativeLabel(tagName) {
|
|
428
428
|
return tagName === "input" || tagName === "textarea" || tagName === "select" || tagName === "meter" || tagName === "progress";
|
|
429
429
|
}
|
|
430
|
-
var useFormLabel =
|
|
430
|
+
var useFormLabel = _JBOLBTVUcjs.createHook.call(void 0, function useFormLabel2({ store, name: nameProp, getItem: getItemProp, ...props }) {
|
|
431
431
|
const context = useFormContext();
|
|
432
432
|
store = store || context;
|
|
433
|
-
|
|
434
|
-
const id =
|
|
433
|
+
_JBOLBTVUcjs.invariant.call(void 0, store, process.env.NODE_ENV !== "production" && "FormLabel must be wrapped in a Form component.");
|
|
434
|
+
const id = _JBOLBTVUcjs.useId.call(void 0, props.id);
|
|
435
435
|
const ref = _react.useRef.call(void 0, null);
|
|
436
436
|
const name = String(nameProp);
|
|
437
437
|
const getItem = _react.useCallback.call(void 0, (item) => {
|
|
@@ -448,17 +448,17 @@ var useFormLabel = _QAUJZR6Ycjs.createHook.call(void 0, function useFormLabel2({
|
|
|
448
448
|
name,
|
|
449
449
|
getItemProp
|
|
450
450
|
]);
|
|
451
|
-
const field =
|
|
452
|
-
const isNativeLabel = supportsNativeLabel(
|
|
451
|
+
const field = _FHPV2Q7Ccjs.useStoreState.call(void 0, store, (state) => state.items.find((item) => item.type === "field" && item.name === name));
|
|
452
|
+
const isNativeLabel = supportsNativeLabel(_JBOLBTVUcjs.useTagName.call(void 0, field == null ? void 0 : field.element, "input"));
|
|
453
453
|
const onClickProp = props.onClick;
|
|
454
|
-
const onClick =
|
|
454
|
+
const onClick = _JBOLBTVUcjs.useEvent.call(void 0, (event) => {
|
|
455
455
|
onClickProp == null ? void 0 : onClickProp(event);
|
|
456
456
|
if (event.defaultPrevented) return;
|
|
457
457
|
if (isNativeLabel) return;
|
|
458
458
|
const fieldElement = field == null ? void 0 : field.element;
|
|
459
459
|
if (!fieldElement) return;
|
|
460
460
|
queueMicrotask(() => {
|
|
461
|
-
const focusableElement =
|
|
461
|
+
const focusableElement = _JBOLBTVUcjs.getFirstTabbableIn.call(void 0, fieldElement, true, true);
|
|
462
462
|
focusableElement == null ? void 0 : focusableElement.focus();
|
|
463
463
|
if ((focusableElement == null ? void 0 : focusableElement.getAttribute("role")) === "combobox") return;
|
|
464
464
|
focusableElement == null ? void 0 : focusableElement.click();
|
|
@@ -469,7 +469,7 @@ var useFormLabel = _QAUJZR6Ycjs.createHook.call(void 0, function useFormLabel2({
|
|
|
469
469
|
htmlFor: isNativeLabel ? field == null ? void 0 : field.id : void 0,
|
|
470
470
|
...props,
|
|
471
471
|
id,
|
|
472
|
-
ref:
|
|
472
|
+
ref: _JBOLBTVUcjs.useMergeRefs.call(void 0, ref, props.ref),
|
|
473
473
|
onClick
|
|
474
474
|
};
|
|
475
475
|
if (!isNativeLabel) props = {
|
|
@@ -479,15 +479,15 @@ var useFormLabel = _QAUJZR6Ycjs.createHook.call(void 0, function useFormLabel2({
|
|
|
479
479
|
...props.style
|
|
480
480
|
}
|
|
481
481
|
};
|
|
482
|
-
props =
|
|
482
|
+
props = _VUISVT3Vcjs.useCollectionItem.call(void 0, {
|
|
483
483
|
store,
|
|
484
484
|
...props,
|
|
485
485
|
getItem
|
|
486
486
|
});
|
|
487
487
|
return props;
|
|
488
488
|
});
|
|
489
|
-
var FormLabel =
|
|
490
|
-
return
|
|
489
|
+
var FormLabel = _JBOLBTVUcjs.memo.call(void 0, _JBOLBTVUcjs.forwardRef.call(void 0, function FormLabel2(props) {
|
|
490
|
+
return _JBOLBTVUcjs.createElement.call(void 0, TagName10, useFormLabel(props));
|
|
491
491
|
}));
|
|
492
492
|
|
|
493
493
|
// ../ariakit-react-components/dist/form/form-store.js
|
|
@@ -499,7 +499,7 @@ function nextFrame() {
|
|
|
499
499
|
}
|
|
500
500
|
function hasMessages(object) {
|
|
501
501
|
return Object.keys(object).some((key) => {
|
|
502
|
-
if (
|
|
502
|
+
if (_JBOLBTVUcjs.isObject.call(void 0, object[key])) return hasMessages(object[key]);
|
|
503
503
|
return !!object[key];
|
|
504
504
|
});
|
|
505
505
|
}
|
|
@@ -511,14 +511,14 @@ function get(values, path, defaultValue2) {
|
|
|
511
511
|
return get(values[key], rest, defaultValue2);
|
|
512
512
|
}
|
|
513
513
|
function getOrCreateNested(nestedValues, nextKey) {
|
|
514
|
-
if (Array.isArray(nestedValues) ||
|
|
515
|
-
return
|
|
514
|
+
if (Array.isArray(nestedValues) || _JBOLBTVUcjs.isObject.call(void 0, nestedValues)) return nestedValues;
|
|
515
|
+
return _JBOLBTVUcjs.isInteger.call(void 0, nextKey) ? [] : {};
|
|
516
516
|
}
|
|
517
517
|
function set(values, path, value) {
|
|
518
518
|
const [k, ...rest] = Array.isArray(path) ? path : String(path).split(".");
|
|
519
519
|
if (k == null) return values;
|
|
520
520
|
const key = k;
|
|
521
|
-
const isIntegerKey =
|
|
521
|
+
const isIntegerKey = _JBOLBTVUcjs.isInteger.call(void 0, key);
|
|
522
522
|
const nestedValues = (isIntegerKey ? values || [] : values || {})[key];
|
|
523
523
|
const nextKey = rest[0];
|
|
524
524
|
const result = rest.length && nextKey != null ? set(getOrCreateNested(nestedValues, nextKey), rest, value) : value;
|
|
@@ -541,10 +541,10 @@ function setAll(values, value) {
|
|
|
541
541
|
for (const key of keys) {
|
|
542
542
|
const currentValue = values[key];
|
|
543
543
|
if (Array.isArray(currentValue)) result[key] = currentValue.map((v) => {
|
|
544
|
-
if (
|
|
544
|
+
if (_JBOLBTVUcjs.isObject.call(void 0, v)) return setAll(v, value);
|
|
545
545
|
return value;
|
|
546
546
|
});
|
|
547
|
-
else if (
|
|
547
|
+
else if (_JBOLBTVUcjs.isObject.call(void 0, currentValue)) result[key] = setAll(currentValue, value);
|
|
548
548
|
else result[key] = value;
|
|
549
549
|
}
|
|
550
550
|
return result;
|
|
@@ -572,31 +572,31 @@ function createNames() {
|
|
|
572
572
|
}
|
|
573
573
|
function createFormStore(props = {}) {
|
|
574
574
|
var _a;
|
|
575
|
-
|
|
575
|
+
_FHPV2Q7Ccjs.throwOnConflictingProps.call(void 0, props, props.store);
|
|
576
576
|
const syncState = (_a = props.store) == null ? void 0 : _a.getState();
|
|
577
|
-
const collection =
|
|
578
|
-
const values =
|
|
579
|
-
const errors =
|
|
580
|
-
const touched =
|
|
581
|
-
const form =
|
|
577
|
+
const collection = _42GL4LKIcjs.createCollectionStore.call(void 0, props);
|
|
578
|
+
const values = _JBOLBTVUcjs.defaultValue.call(void 0, props.values, syncState == null ? void 0 : syncState.values, props.defaultValues, {});
|
|
579
|
+
const errors = _JBOLBTVUcjs.defaultValue.call(void 0, props.errors, syncState == null ? void 0 : syncState.errors, props.defaultErrors, {});
|
|
580
|
+
const touched = _JBOLBTVUcjs.defaultValue.call(void 0, props.touched, syncState == null ? void 0 : syncState.touched, props.defaultTouched, {});
|
|
581
|
+
const form = _FHPV2Q7Ccjs.createStore.call(void 0, {
|
|
582
582
|
...collection.getState(),
|
|
583
583
|
values,
|
|
584
584
|
errors,
|
|
585
585
|
touched,
|
|
586
|
-
validating:
|
|
587
|
-
submitting:
|
|
588
|
-
submitSucceed:
|
|
589
|
-
submitFailed:
|
|
586
|
+
validating: _JBOLBTVUcjs.defaultValue.call(void 0, syncState == null ? void 0 : syncState.validating, false),
|
|
587
|
+
submitting: _JBOLBTVUcjs.defaultValue.call(void 0, syncState == null ? void 0 : syncState.submitting, false),
|
|
588
|
+
submitSucceed: _JBOLBTVUcjs.defaultValue.call(void 0, syncState == null ? void 0 : syncState.submitSucceed, 0),
|
|
589
|
+
submitFailed: _JBOLBTVUcjs.defaultValue.call(void 0, syncState == null ? void 0 : syncState.submitFailed, 0),
|
|
590
590
|
valid: !hasMessages(errors)
|
|
591
591
|
}, collection, props.store);
|
|
592
592
|
const syncCallbacks = getStoreCallbacks(props.store);
|
|
593
593
|
const syncCallbacksState = syncCallbacks == null ? void 0 : syncCallbacks.getState();
|
|
594
|
-
const callbacks =
|
|
594
|
+
const callbacks = _FHPV2Q7Ccjs.createStore.call(void 0, {
|
|
595
595
|
validate: (syncCallbacksState == null ? void 0 : syncCallbacksState.validate) || [],
|
|
596
596
|
submit: (syncCallbacksState == null ? void 0 : syncCallbacksState.submit) || []
|
|
597
597
|
}, syncCallbacks);
|
|
598
|
-
|
|
599
|
-
|
|
598
|
+
_FHPV2Q7Ccjs.setup.call(void 0, form, () => _FHPV2Q7Ccjs.init.call(void 0, callbacks));
|
|
599
|
+
_FHPV2Q7Ccjs.setup.call(void 0, form, () => _FHPV2Q7Ccjs.sync.call(void 0, form, ["validating", "errors"], (state) => {
|
|
600
600
|
if (state.validating) return;
|
|
601
601
|
form.setState("valid", !hasMessages(state.errors));
|
|
602
602
|
}));
|
|
@@ -620,7 +620,7 @@ function createFormStore(props = {}) {
|
|
|
620
620
|
getValue: (name) => get(form.getState().values, name),
|
|
621
621
|
setValue: (name, value) => form.setState("values", (values2) => {
|
|
622
622
|
const prevValue = get(values2, name);
|
|
623
|
-
const nextValue =
|
|
623
|
+
const nextValue = _JBOLBTVUcjs.applyState.call(void 0, value, prevValue);
|
|
624
624
|
if (nextValue === prevValue) return values2;
|
|
625
625
|
return set(values2, name, nextValue);
|
|
626
626
|
}),
|
|
@@ -639,7 +639,7 @@ function createFormStore(props = {}) {
|
|
|
639
639
|
getError: (name) => get(form.getState().errors, name),
|
|
640
640
|
setError: (name, error) => form.setState("errors", (errors2) => {
|
|
641
641
|
const prevError = get(errors2, name);
|
|
642
|
-
const nextError =
|
|
642
|
+
const nextError = _JBOLBTVUcjs.applyState.call(void 0, error, prevError);
|
|
643
643
|
if (nextError === prevError) return errors2;
|
|
644
644
|
return set(errors2, name, nextError);
|
|
645
645
|
}),
|
|
@@ -647,7 +647,7 @@ function createFormStore(props = {}) {
|
|
|
647
647
|
getFieldTouched: (name) => !!get(form.getState().touched, name),
|
|
648
648
|
setFieldTouched: (name, value) => form.setState("touched", (touched2) => {
|
|
649
649
|
const prevValue = get(touched2, name);
|
|
650
|
-
const nextValue =
|
|
650
|
+
const nextValue = _JBOLBTVUcjs.applyState.call(void 0, value, prevValue);
|
|
651
651
|
if (nextValue === prevValue) return touched2;
|
|
652
652
|
return set(touched2, name, nextValue);
|
|
653
653
|
}),
|
|
@@ -702,18 +702,18 @@ function createFormStore(props = {}) {
|
|
|
702
702
|
|
|
703
703
|
// ../ariakit-react-components/dist/form/form-store.js
|
|
704
704
|
function useFormStoreProps(store, update, props) {
|
|
705
|
-
store =
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
const useValue = _react.useCallback.call(void 0, (name) =>
|
|
705
|
+
store = _42GL4LKIcjs.useCollectionStoreProps.call(void 0, store, update, props);
|
|
706
|
+
_FHPV2Q7Ccjs.useStoreProps.call(void 0, store, props, "values", "setValues");
|
|
707
|
+
_FHPV2Q7Ccjs.useStoreProps.call(void 0, store, props, "errors", "setErrors");
|
|
708
|
+
_FHPV2Q7Ccjs.useStoreProps.call(void 0, store, props, "touched", "setTouched");
|
|
709
|
+
const useValue = _react.useCallback.call(void 0, (name) => _FHPV2Q7Ccjs.useStoreState.call(void 0, store, () => store.getValue(name)), [store]);
|
|
710
710
|
const useValidate = _react.useCallback.call(void 0, (callback) => {
|
|
711
|
-
callback =
|
|
712
|
-
_react.useEffect.call(void 0, () => store.onValidate(callback), [
|
|
711
|
+
callback = _JBOLBTVUcjs.useEvent.call(void 0, callback);
|
|
712
|
+
_react.useEffect.call(void 0, () => store.onValidate(callback), [_FHPV2Q7Ccjs.useStoreState.call(void 0, store, "items"), callback]);
|
|
713
713
|
}, [store]);
|
|
714
714
|
const useSubmit = _react.useCallback.call(void 0, (callback) => {
|
|
715
|
-
callback =
|
|
716
|
-
_react.useEffect.call(void 0, () => store.onSubmit(callback), [
|
|
715
|
+
callback = _JBOLBTVUcjs.useEvent.call(void 0, callback);
|
|
716
|
+
_react.useEffect.call(void 0, () => store.onSubmit(callback), [_FHPV2Q7Ccjs.useStoreState.call(void 0, store, "items"), callback]);
|
|
717
717
|
}, [store]);
|
|
718
718
|
return _react.useMemo.call(void 0, () => ({
|
|
719
719
|
...store,
|
|
@@ -728,7 +728,7 @@ function useFormStoreProps(store, update, props) {
|
|
|
728
728
|
]);
|
|
729
729
|
}
|
|
730
730
|
function useFormStore(props = {}) {
|
|
731
|
-
const [store, update] =
|
|
731
|
+
const [store, update] = _FHPV2Q7Ccjs.useStore.call(void 0, createFormStore, props);
|
|
732
732
|
return useFormStoreProps(store, update, props);
|
|
733
733
|
}
|
|
734
734
|
|
|
@@ -756,10 +756,10 @@ function getFirstFieldsByName(items, name) {
|
|
|
756
756
|
}
|
|
757
757
|
return fields;
|
|
758
758
|
}
|
|
759
|
-
var useFormPush =
|
|
759
|
+
var useFormPush = _JBOLBTVUcjs.createHook.call(void 0, function useFormPush2({ store, value, name: nameProp, getItem: getItemProp, autoFocusOnClick = true, ...props }) {
|
|
760
760
|
const context = useFormContext();
|
|
761
761
|
store = store || context;
|
|
762
|
-
|
|
762
|
+
_JBOLBTVUcjs.invariant.call(void 0, store, process.env.NODE_ENV !== "production" && "FormPush must be wrapped in a Form component.");
|
|
763
763
|
const name = String(nameProp);
|
|
764
764
|
const [shouldFocus, setShouldFocus] = _react.useState.call(void 0, false);
|
|
765
765
|
_react.useEffect.call(void 0, () => {
|
|
@@ -785,7 +785,7 @@ var useFormPush = _QAUJZR6Ycjs.createHook.call(void 0, function useFormPush2({ s
|
|
|
785
785
|
return nextItem;
|
|
786
786
|
}, [name, getItemProp]);
|
|
787
787
|
const onClickProp = props.onClick;
|
|
788
|
-
const onClick =
|
|
788
|
+
const onClick = _JBOLBTVUcjs.useEvent.call(void 0, (event) => {
|
|
789
789
|
onClickProp == null ? void 0 : onClickProp(event);
|
|
790
790
|
if (event.defaultPrevented) return;
|
|
791
791
|
store == null ? void 0 : store.pushValue(name, value);
|
|
@@ -796,39 +796,39 @@ var useFormPush = _QAUJZR6Ycjs.createHook.call(void 0, function useFormPush2({ s
|
|
|
796
796
|
...props,
|
|
797
797
|
onClick
|
|
798
798
|
};
|
|
799
|
-
props =
|
|
800
|
-
props =
|
|
799
|
+
props = _P7AY4KL3cjs.useButton.call(void 0, props);
|
|
800
|
+
props = _VUISVT3Vcjs.useCollectionItem.call(void 0, {
|
|
801
801
|
store,
|
|
802
802
|
...props,
|
|
803
803
|
getItem
|
|
804
804
|
});
|
|
805
805
|
return props;
|
|
806
806
|
});
|
|
807
|
-
var FormPush =
|
|
808
|
-
return
|
|
807
|
+
var FormPush = _JBOLBTVUcjs.forwardRef.call(void 0, function FormPush2(props) {
|
|
808
|
+
return _JBOLBTVUcjs.createElement.call(void 0, TagName11, useFormPush(props));
|
|
809
809
|
});
|
|
810
810
|
|
|
811
811
|
// ../ariakit-react-components/dist/form/form-radio.js
|
|
812
812
|
var TagName12 = "input";
|
|
813
|
-
var useFormRadio =
|
|
813
|
+
var useFormRadio = _JBOLBTVUcjs.createHook.call(void 0, function useFormRadio2({ store, name: nameProp, value, ...props }) {
|
|
814
814
|
const context = useFormContext();
|
|
815
815
|
store = store || context;
|
|
816
|
-
|
|
816
|
+
_JBOLBTVUcjs.invariant.call(void 0, store, process.env.NODE_ENV !== "production" && "FormRadio must be wrapped in a Form component.");
|
|
817
817
|
const name = String(nameProp);
|
|
818
818
|
const onChangeProp = props.onChange;
|
|
819
|
-
const onChange =
|
|
819
|
+
const onChange = _JBOLBTVUcjs.useEvent.call(void 0, (event) => {
|
|
820
820
|
onChangeProp == null ? void 0 : onChangeProp(event);
|
|
821
821
|
if (event.defaultPrevented) return;
|
|
822
822
|
store == null ? void 0 : store.setValue(name, value);
|
|
823
823
|
});
|
|
824
824
|
const checkedProp = props.checked;
|
|
825
|
-
const checked =
|
|
825
|
+
const checked = _FHPV2Q7Ccjs.useStoreState.call(void 0, store, () => checkedProp != null ? checkedProp : (store == null ? void 0 : store.getValue(name)) === value);
|
|
826
826
|
props = {
|
|
827
827
|
...props,
|
|
828
828
|
checked,
|
|
829
829
|
onChange
|
|
830
830
|
};
|
|
831
|
-
props =
|
|
831
|
+
props = _M6YHODMVcjs.useRadio.call(void 0, {
|
|
832
832
|
name,
|
|
833
833
|
value,
|
|
834
834
|
...props
|
|
@@ -841,15 +841,15 @@ var useFormRadio = _QAUJZR6Ycjs.createHook.call(void 0, function useFormRadio2({
|
|
|
841
841
|
});
|
|
842
842
|
return props;
|
|
843
843
|
});
|
|
844
|
-
var FormRadio =
|
|
845
|
-
return
|
|
844
|
+
var FormRadio = _JBOLBTVUcjs.memo.call(void 0, _JBOLBTVUcjs.forwardRef.call(void 0, function FormRadio2(props) {
|
|
845
|
+
return _JBOLBTVUcjs.createElement.call(void 0, TagName12, useFormRadio(props));
|
|
846
846
|
}));
|
|
847
847
|
|
|
848
848
|
// ../ariakit-react-components/dist/form/form-radio-group.js
|
|
849
849
|
|
|
850
850
|
var TagName13 = "div";
|
|
851
|
-
var useFormRadioGroup =
|
|
852
|
-
props =
|
|
851
|
+
var useFormRadioGroup = _JBOLBTVUcjs.createHook.call(void 0, function useFormRadioGroup2({ store, ...props }) {
|
|
852
|
+
props = _JBOLBTVUcjs.useWrapElement.call(void 0, props, (element) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _2WBRQ3I7cjs.CompositeScopedContextProvider, {
|
|
853
853
|
value: void 0,
|
|
854
854
|
children: element
|
|
855
855
|
}), []);
|
|
@@ -860,8 +860,8 @@ var useFormRadioGroup = _QAUJZR6Ycjs.createHook.call(void 0, function useFormRad
|
|
|
860
860
|
props = useFormGroup(props);
|
|
861
861
|
return props;
|
|
862
862
|
});
|
|
863
|
-
var FormRadioGroup =
|
|
864
|
-
return
|
|
863
|
+
var FormRadioGroup = _JBOLBTVUcjs.forwardRef.call(void 0, function FormRadioGroup2(props) {
|
|
864
|
+
return _JBOLBTVUcjs.createElement.call(void 0, TagName13, useFormRadioGroup(props));
|
|
865
865
|
});
|
|
866
866
|
|
|
867
867
|
// ../ariakit-react-components/dist/form/form-remove.js
|
|
@@ -882,13 +882,13 @@ function findNextOrPreviousField(items, name, index) {
|
|
|
882
882
|
function findPushButton(items, name) {
|
|
883
883
|
return items == null ? void 0 : items.find((item) => item.type === "button" && item.name === name);
|
|
884
884
|
}
|
|
885
|
-
var useFormRemove =
|
|
885
|
+
var useFormRemove = _JBOLBTVUcjs.createHook.call(void 0, function useFormRemove2({ store, name: nameProp, index, autoFocusOnClick = true, ...props }) {
|
|
886
886
|
const context = useFormContext();
|
|
887
887
|
store = store || context;
|
|
888
|
-
|
|
888
|
+
_JBOLBTVUcjs.invariant.call(void 0, store, process.env.NODE_ENV !== "production" && "FormRemove must be wrapped in a Form component.");
|
|
889
889
|
const name = String(nameProp);
|
|
890
890
|
const onClickProp = props.onClick;
|
|
891
|
-
const onClick =
|
|
891
|
+
const onClick = _JBOLBTVUcjs.useEvent.call(void 0, (event) => {
|
|
892
892
|
var _a, _b, _c;
|
|
893
893
|
onClickProp == null ? void 0 : onClickProp(event);
|
|
894
894
|
if (event.defaultPrevented) return;
|
|
@@ -899,57 +899,57 @@ var useFormRemove = _QAUJZR6Ycjs.createHook.call(void 0, function useFormRemove2
|
|
|
899
899
|
const element = (_a = findNextOrPreviousField(items, name, index)) == null ? void 0 : _a.element;
|
|
900
900
|
if (element) {
|
|
901
901
|
element.focus();
|
|
902
|
-
if (
|
|
902
|
+
if (_JBOLBTVUcjs.isTextField.call(void 0, element)) element.select();
|
|
903
903
|
} else (_c = (_b = findPushButton(items, name)) == null ? void 0 : _b.element) == null ? void 0 : _c.focus();
|
|
904
904
|
});
|
|
905
905
|
props = {
|
|
906
906
|
...props,
|
|
907
907
|
onClick
|
|
908
908
|
};
|
|
909
|
-
props =
|
|
909
|
+
props = _P7AY4KL3cjs.useButton.call(void 0, props);
|
|
910
910
|
return props;
|
|
911
911
|
});
|
|
912
|
-
var FormRemove =
|
|
913
|
-
return
|
|
912
|
+
var FormRemove = _JBOLBTVUcjs.forwardRef.call(void 0, function FormRemove2(props) {
|
|
913
|
+
return _JBOLBTVUcjs.createElement.call(void 0, TagName14, useFormRemove(props));
|
|
914
914
|
});
|
|
915
915
|
|
|
916
916
|
// ../ariakit-react-components/dist/form/form-reset.js
|
|
917
917
|
var TagName15 = "button";
|
|
918
|
-
var useFormReset =
|
|
918
|
+
var useFormReset = _JBOLBTVUcjs.createHook.call(void 0, function useFormReset2({ store, ...props }) {
|
|
919
919
|
const context = useFormContext();
|
|
920
920
|
store = store || context;
|
|
921
|
-
|
|
921
|
+
_JBOLBTVUcjs.invariant.call(void 0, store, process.env.NODE_ENV !== "production" && "FormReset must be wrapped in a Form component.");
|
|
922
922
|
props = {
|
|
923
923
|
type: "reset",
|
|
924
|
-
disabled:
|
|
924
|
+
disabled: _FHPV2Q7Ccjs.useStoreState.call(void 0, store, "submitting"),
|
|
925
925
|
...props
|
|
926
926
|
};
|
|
927
|
-
props =
|
|
927
|
+
props = _P7AY4KL3cjs.useButton.call(void 0, props);
|
|
928
928
|
return props;
|
|
929
929
|
});
|
|
930
|
-
var FormReset =
|
|
931
|
-
return
|
|
930
|
+
var FormReset = _JBOLBTVUcjs.forwardRef.call(void 0, function FormReset2(props) {
|
|
931
|
+
return _JBOLBTVUcjs.createElement.call(void 0, TagName15, useFormReset(props));
|
|
932
932
|
});
|
|
933
933
|
|
|
934
934
|
// ../ariakit-react-components/dist/form/form-submit.js
|
|
935
935
|
var TagName16 = "button";
|
|
936
|
-
var useFormSubmit =
|
|
936
|
+
var useFormSubmit = _JBOLBTVUcjs.createHook.call(void 0, function useFormSubmit2({ store, accessibleWhenDisabled = true, ...props }) {
|
|
937
937
|
const context = useFormContext();
|
|
938
938
|
store = store || context;
|
|
939
|
-
|
|
939
|
+
_JBOLBTVUcjs.invariant.call(void 0, store, process.env.NODE_ENV !== "production" && "FormSubmit must be wrapped in a Form component.");
|
|
940
940
|
props = {
|
|
941
941
|
type: "submit",
|
|
942
|
-
disabled:
|
|
942
|
+
disabled: _FHPV2Q7Ccjs.useStoreState.call(void 0, store, "submitting"),
|
|
943
943
|
...props
|
|
944
944
|
};
|
|
945
|
-
props =
|
|
945
|
+
props = _P7AY4KL3cjs.useButton.call(void 0, {
|
|
946
946
|
...props,
|
|
947
947
|
accessibleWhenDisabled
|
|
948
948
|
});
|
|
949
949
|
return props;
|
|
950
950
|
});
|
|
951
|
-
var FormSubmit =
|
|
952
|
-
return
|
|
951
|
+
var FormSubmit = _JBOLBTVUcjs.forwardRef.call(void 0, function FormSubmit2(props) {
|
|
952
|
+
return _JBOLBTVUcjs.createElement.call(void 0, TagName16, useFormSubmit(props));
|
|
953
953
|
});
|
|
954
954
|
|
|
955
955
|
|