@paragrav/rhf-utils 0.0.116 → 0.0.118
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/README.md +51 -51
- package/dist/esm/client/config/useRhfUtilsClientConfigContext.mjs +7 -8
- package/dist/esm/client/index.mjs +10 -12
- package/dist/esm/client/zod/context/useRhfUtilsClientForZodContext.mjs +7 -4
- package/dist/esm/errors/flat/context/FlatFieldErrorsContextProvider.mjs +13 -11
- package/dist/esm/errors/flat/context/useFlatFieldErrorsContext.mjs +6 -3
- package/dist/esm/errors/flat/context/useFlatFieldErrorsContextOutput.mjs +19 -20
- package/dist/esm/errors/getRefdFromFlatFieldErrors.mjs +8 -0
- package/dist/esm/errors/isFlatFieldErrorEntryRefd.mjs +5 -0
- package/dist/esm/form/Form.mjs +52 -62
- package/dist/esm/form/FormWithProviders.mjs +7 -10
- package/dist/esm/form/context/group/index.mjs +9 -9
- package/dist/esm/form/context/utils/RhfUtilsContextProvider.mjs +12 -15
- package/dist/esm/form/context/utils/useRhfUtilsContext.mjs +3 -3
- package/dist/esm/utils/createContext.mjs +10 -6
- package/dist/types/client/config/RhfUtilsClientConfig.d.ts +11 -15
- package/dist/types/client/config/useRhfUtilsClientConfigContext.d.ts +1 -1
- package/dist/types/client/zod/context/useRhfUtilsClientForZodContext.d.ts +1 -1
- package/dist/types/errors/flat/context/useFlatFieldErrorsContext.d.ts +2 -1
- package/dist/types/errors/flat/context/useFlatFieldErrorsContextOutput.d.ts +2 -2
- package/dist/types/errors/getRefdFromFlatFieldErrors.d.ts +2 -0
- package/dist/types/errors/isFlatFieldErrorEntryRefd.d.ts +1 -1
- package/dist/types/form/Form.d.ts +3 -3
- package/dist/types/form/FormWithProviders.d.ts +1 -1
- package/dist/types/form/RhfUtilsFormOptions.d.ts +8 -4
- package/dist/types/form/_FormBase.d.ts +2 -4
- package/dist/types/form/context/group/index.d.ts +1 -1
- package/dist/types/submit/useResetFormOnSubmitSuccessful.d.ts +2 -2
- package/dist/types/utils/createContext.d.ts +6 -2
- package/package.json +1 -1
- package/dist/esm/form/_FormBase.mjs +0 -18
package/README.md
CHANGED
|
@@ -14,8 +14,6 @@ To configure, create a file `config.tsx` with desired configuration settings. Th
|
|
|
14
14
|
|
|
15
15
|
```tsx
|
|
16
16
|
export const rhfUtilsClientConfig: RhfUtilsClientConfig = {
|
|
17
|
-
isDevelopment: import.meta.env.DEV,
|
|
18
|
-
|
|
19
17
|
// defaults -- overridable per form instance
|
|
20
18
|
defaults: {
|
|
21
19
|
// globally relevant subset of RHF's `UseFormProps` options
|
|
@@ -25,61 +23,63 @@ export const rhfUtilsClientConfig: RhfUtilsClientConfig = {
|
|
|
25
23
|
|
|
26
24
|
// RhfUtilsFormOptions (see further below)
|
|
27
25
|
utils: {
|
|
28
|
-
// enable dev tool
|
|
29
|
-
devTool:
|
|
26
|
+
// enable dev tool on dev env
|
|
27
|
+
devTool: import.meta.env.DEV,
|
|
30
28
|
},
|
|
31
29
|
},
|
|
32
30
|
|
|
33
31
|
// optional (defaults to primitive HTML form)
|
|
34
32
|
FormComponent: Form.Root,
|
|
35
33
|
|
|
34
|
+
// optional wrapper to inject your own hooks and components
|
|
35
|
+
// `children` prop is provided by RhfUtilsZodForm's Children prop
|
|
36
|
+
FormChildren: (
|
|
37
|
+
// UseRhfUtilsFormChildrenProps
|
|
38
|
+
{
|
|
39
|
+
formId, // unique id string
|
|
40
|
+
formRef, // ref
|
|
41
|
+
context, // rhf UseFormReturn
|
|
42
|
+
options, // RhfUtilsFormOptions
|
|
43
|
+
Controller, // strictly-typed controller
|
|
44
|
+
FormSubmitError, // strictly-typed error class
|
|
45
|
+
children, // RhfUtilsZodForm.Children
|
|
46
|
+
},
|
|
47
|
+
) => {
|
|
48
|
+
// navigation blocker (using custom option)
|
|
49
|
+
useFormRouterBlocker(!!options?.prompter);
|
|
50
|
+
|
|
51
|
+
return (
|
|
52
|
+
<>
|
|
53
|
+
{/* specific form children -- e.g., fields, etc. */}
|
|
54
|
+
{children}
|
|
55
|
+
|
|
56
|
+
{/* global error list */}
|
|
57
|
+
<RootErrorsListFromFlatFieldErrorsContext />
|
|
58
|
+
</>
|
|
59
|
+
);
|
|
60
|
+
},
|
|
61
|
+
|
|
36
62
|
// non-FormSubmitError throw in onSubmit
|
|
37
|
-
// use case: transform backend error
|
|
63
|
+
// example use case: transform backend error
|
|
38
64
|
onSubmitUnknownError: (
|
|
39
65
|
error, // unknown
|
|
40
66
|
) => {
|
|
41
67
|
// if other error, re-throw to handle in ErrorBoundary
|
|
42
68
|
if (!(error instanceof MyServerError)) throw error;
|
|
43
69
|
|
|
44
|
-
// return to be merged into RHF context errors
|
|
70
|
+
// return FormSubmitErrors object to be merged into RHF context errors
|
|
45
71
|
return transformServerErrorToFormSubmitErrors(error);
|
|
46
72
|
},
|
|
47
73
|
|
|
48
|
-
Children: {
|
|
49
|
-
top: (
|
|
50
|
-
// UseRhfUtilsFormChildrenProps
|
|
51
|
-
{
|
|
52
|
-
formId, // unique id string
|
|
53
|
-
formRef, // ref
|
|
54
|
-
context, // rhf UseFormReturn
|
|
55
|
-
options, // RhfUtilsFormOptions
|
|
56
|
-
Controller, // strongly-typed controller
|
|
57
|
-
FormSubmitError, // strongly-typed error class
|
|
58
|
-
},
|
|
59
|
-
) => {
|
|
60
|
-
// navigation blocker (using custom option)
|
|
61
|
-
useFormRouterBlocker(!!options?.prompter);
|
|
62
|
-
|
|
63
|
-
return null;
|
|
64
|
-
},
|
|
65
|
-
|
|
66
|
-
bottom: () => (
|
|
67
|
-
<>
|
|
68
|
-
{/* global error list */}
|
|
69
|
-
<RootErrorsListFromFlatFieldErrorsContext />
|
|
70
|
-
</>
|
|
71
|
-
),
|
|
72
|
-
},
|
|
73
|
-
|
|
74
74
|
errors: {
|
|
75
75
|
output: {
|
|
76
76
|
// callback to determine when to output form context errors to console ("debug" or "error")
|
|
77
|
-
console: ({
|
|
78
|
-
(hasOrphans && { type: 'error' }) || //
|
|
79
|
-
(
|
|
77
|
+
console: ({ hasOrphans }) =>
|
|
78
|
+
(hasOrphans && { type: 'error' }) || // console error for reporting on prod
|
|
79
|
+
(import.meta.env.DEV && { type: 'debug' }), // facilitate debugging on dev
|
|
80
80
|
|
|
81
81
|
// callback to determine when to throw an error based on context
|
|
82
|
-
throw: ({
|
|
82
|
+
throw: ({ hasOrphans }) => import.meta.env.DEV && hasOrphans,
|
|
83
83
|
},
|
|
84
84
|
},
|
|
85
85
|
};
|
|
@@ -108,7 +108,7 @@ Currently, only `zod` is supported.
|
|
|
108
108
|
// submit handler
|
|
109
109
|
onSubmit={async (
|
|
110
110
|
data, // schema output
|
|
111
|
-
context, // UseRhfUtilsFormOnSubmitContext (form id, form ref, context (rhf), utils options,
|
|
111
|
+
context, // UseRhfUtilsFormOnSubmitContext (form id, form ref, context (rhf), utils options, strictly-typed FormSubmitError class)
|
|
112
112
|
event, // SubmitEvent
|
|
113
113
|
) => {
|
|
114
114
|
await authLoginService(data);
|
|
@@ -129,12 +129,12 @@ Currently, only `zod` is supported.
|
|
|
129
129
|
formRef, // ref
|
|
130
130
|
context, // rhf UseFormReturn
|
|
131
131
|
options, // RhfUtilsFormOptions
|
|
132
|
-
Controller, //
|
|
133
|
-
FormSubmitError, //
|
|
132
|
+
Controller, // strictly-typed controller
|
|
133
|
+
FormSubmitError, // strictly-typed error class
|
|
134
134
|
}) => (
|
|
135
135
|
<>
|
|
136
136
|
<Controller
|
|
137
|
-
name="email" //
|
|
137
|
+
name="email" // strictly-typed field name
|
|
138
138
|
render={({ field, formState: { isSubmitting } }) => (
|
|
139
139
|
<label>
|
|
140
140
|
Email
|
|
@@ -161,9 +161,9 @@ function Children({...}: RhfUtilsUseFormChildrenZodProps<typeof schema>) { }
|
|
|
161
161
|
|
|
162
162
|
## `FormSubmitError`
|
|
163
163
|
|
|
164
|
-
This is an `Error`-based class you can use to throw a structured error in your submit handler. It is
|
|
164
|
+
This is an `Error`-based class you can use to throw a structured error in your submit handler. It is strictly-typed, so it only allows field names from your schema and `root`/`root.{string}` keys.
|
|
165
165
|
|
|
166
|
-
It uses `FormSubmitErrors`
|
|
166
|
+
It uses `FormSubmitErrors` type's structure, which is a flat, simplified version of RHF's `FieldErrors`.
|
|
167
167
|
|
|
168
168
|
Example:
|
|
169
169
|
|
|
@@ -192,8 +192,7 @@ These options can be set globally and/or per form.
|
|
|
192
192
|
```ts
|
|
193
193
|
type RhfUtilsFormOptions = {
|
|
194
194
|
/**
|
|
195
|
-
*
|
|
196
|
-
* (Defaults merged with individual class names.)
|
|
195
|
+
* Style via your own classes.
|
|
197
196
|
*/
|
|
198
197
|
classNames?: string[];
|
|
199
198
|
|
|
@@ -207,11 +206,12 @@ type RhfUtilsFormOptions = {
|
|
|
207
206
|
stopSubmitPropagation?: boolean;
|
|
208
207
|
|
|
209
208
|
/** Reset form after successful submit. */
|
|
210
|
-
resetFormAfterSubmitSuccessful?:
|
|
211
|
-
typeof useResetFormAfterSubmitSuccessful
|
|
212
|
-
>[0];
|
|
209
|
+
resetFormAfterSubmitSuccessful?: UseResetFormAfterSubmitSuccessfulOptions;
|
|
213
210
|
|
|
214
|
-
/**
|
|
211
|
+
/**
|
|
212
|
+
* Control dev tool options.
|
|
213
|
+
* (Lazy-loaded when truthy value supplied.)
|
|
214
|
+
*/
|
|
215
215
|
devTool?: true | Pick<DevtoolUIProps, 'placement' | 'styles'>;
|
|
216
216
|
};
|
|
217
217
|
```
|
|
@@ -261,10 +261,10 @@ Alternatively, you can use `FormErrorMessageByPath` to display error message to
|
|
|
261
261
|
|
|
262
262
|
Example use case: Field array with minimum items. (When there are no items, the error is not associated with a field and is displayed separately.)
|
|
263
263
|
|
|
264
|
-
Orphans are
|
|
264
|
+
Orphans are exposed in a few places.
|
|
265
265
|
|
|
266
|
-
- In errors outputted via console. (
|
|
267
|
-
- And `useFlatFieldErrorsContext()` hook, which returns an object with
|
|
266
|
+
- In errors outputted via console. (Configurable via `RhfUtilsClientConfig['errors']['output']`.)
|
|
267
|
+
- And `useFlatFieldErrorsContext()` hook, which returns an object with errors grouped by `all`, `fields`, `root`, and `orphans`.
|
|
268
268
|
- Boolean value from `useFlatFieldErrorsContextHasOnlyOrphans`.
|
|
269
269
|
|
|
270
270
|
`FlatFieldErrors` is a flattened, simplified version of RHF's `FieldErrors`. Keys represent field paths flattened to dot notation.
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import
|
|
2
|
-
const
|
|
3
|
-
o,
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
] = t();
|
|
1
|
+
import e from "../../utils/createContext.mjs";
|
|
2
|
+
const {
|
|
3
|
+
Provider: o,
|
|
4
|
+
useMaybe: i
|
|
5
|
+
} = e();
|
|
7
6
|
export {
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
o as _RhfUtilsClientConfigContextProvider,
|
|
8
|
+
i as default
|
|
10
9
|
};
|
|
@@ -4,28 +4,26 @@ import d from "../form/useRhfUtilsForm.mjs";
|
|
|
4
4
|
const R = (e) => (r) => {
|
|
5
5
|
const m = F(e, r);
|
|
6
6
|
return {
|
|
7
|
-
useForm: (
|
|
8
|
-
const t = m(
|
|
7
|
+
useForm: (o, s) => {
|
|
8
|
+
const t = m(o, s);
|
|
9
9
|
return {
|
|
10
10
|
...d(t),
|
|
11
|
-
FormWithProviders: ({
|
|
12
|
-
children: o
|
|
13
|
-
}) => /* @__PURE__ */ h(f, { ...t, children: o })
|
|
11
|
+
FormWithProviders: () => /* @__PURE__ */ h(f, { ...t })
|
|
14
12
|
};
|
|
15
13
|
},
|
|
16
14
|
FormWithProviders: a(e, r)
|
|
17
15
|
};
|
|
18
|
-
}, F = (e, r) => function(
|
|
19
|
-
var t,
|
|
16
|
+
}, F = (e, r) => function(o, s) {
|
|
17
|
+
var t, i, l, n, u;
|
|
20
18
|
return {
|
|
21
19
|
...s,
|
|
22
20
|
rhf: {
|
|
23
21
|
...(t = r.defaults) == null ? void 0 : t.rhf,
|
|
24
22
|
...s.rhf,
|
|
25
|
-
resolver: e(
|
|
23
|
+
resolver: e(o)
|
|
26
24
|
},
|
|
27
25
|
utils: {
|
|
28
|
-
...(
|
|
26
|
+
...(i = r.defaults) == null ? void 0 : i.utils,
|
|
29
27
|
...s.utils,
|
|
30
28
|
classNames: [
|
|
31
29
|
...((n = (l = r.defaults) == null ? void 0 : l.utils) == null ? void 0 : n.classNames) ?? [],
|
|
@@ -34,15 +32,15 @@ const R = (e) => (r) => {
|
|
|
34
32
|
}
|
|
35
33
|
};
|
|
36
34
|
}, a = (e, r) => function({
|
|
37
|
-
schema:
|
|
35
|
+
schema: o,
|
|
38
36
|
children: s,
|
|
39
37
|
...t
|
|
40
38
|
}) {
|
|
41
|
-
const
|
|
39
|
+
const i = F(e, r);
|
|
42
40
|
return /* @__PURE__ */ h(
|
|
43
41
|
f,
|
|
44
42
|
{
|
|
45
|
-
...o
|
|
43
|
+
...i(o, t),
|
|
46
44
|
children: s
|
|
47
45
|
}
|
|
48
46
|
);
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
import
|
|
2
|
-
const
|
|
1
|
+
import e from "../../../utils/createContext.mjs";
|
|
2
|
+
const {
|
|
3
|
+
Provider: o,
|
|
4
|
+
useRequired: r
|
|
5
|
+
} = e();
|
|
3
6
|
export {
|
|
4
|
-
|
|
5
|
-
|
|
7
|
+
o as _RhfUtilsClientForZodContextProvider,
|
|
8
|
+
r as default
|
|
6
9
|
};
|
|
@@ -1,21 +1,23 @@
|
|
|
1
|
-
import { jsx as
|
|
1
|
+
import { jsx as s } from "react/jsx-runtime";
|
|
2
2
|
import "react";
|
|
3
3
|
import { useFormState as i } from "react-hook-form";
|
|
4
|
-
import l from "../../
|
|
5
|
-
import F from "../../
|
|
6
|
-
import a from "
|
|
7
|
-
import
|
|
8
|
-
|
|
4
|
+
import l from "../../getRefdFromFlatFieldErrors.mjs";
|
|
5
|
+
import F from "../../orphan/getOrphansFromFlatFieldErrors.mjs";
|
|
6
|
+
import a from "../../root/getRootsFromFlatFieldErrors.mjs";
|
|
7
|
+
import n from "../getFlatFieldErrors.mjs";
|
|
8
|
+
import { _FormErrorsFlatContextProvider as p } from "./useFlatFieldErrorsContext.mjs";
|
|
9
|
+
const h = ({
|
|
9
10
|
formRef: o,
|
|
10
11
|
children: t
|
|
11
12
|
}) => {
|
|
12
|
-
const { errors: e } = i(), r =
|
|
13
|
+
const { errors: e } = i(), r = n(e), m = {
|
|
13
14
|
all: r,
|
|
14
|
-
|
|
15
|
-
|
|
15
|
+
fields: l(r),
|
|
16
|
+
roots: a(r),
|
|
17
|
+
orphans: o.current ? F(r, o.current) : {}
|
|
16
18
|
};
|
|
17
|
-
return /* @__PURE__ */
|
|
19
|
+
return /* @__PURE__ */ s(p, { value: m, children: t });
|
|
18
20
|
};
|
|
19
21
|
export {
|
|
20
|
-
|
|
22
|
+
h as default
|
|
21
23
|
};
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
import
|
|
2
|
-
const
|
|
1
|
+
import r from "../../../utils/createContext.mjs";
|
|
2
|
+
const {
|
|
3
|
+
Provider: o,
|
|
4
|
+
useRequired: e
|
|
5
|
+
} = r(), s = e;
|
|
3
6
|
export {
|
|
4
|
-
|
|
7
|
+
o as _FormErrorsFlatContextProvider,
|
|
5
8
|
s as default
|
|
6
9
|
};
|
|
@@ -1,29 +1,28 @@
|
|
|
1
1
|
import h from "react";
|
|
2
2
|
import { useFormContext as E } from "react-hook-form";
|
|
3
|
-
import
|
|
3
|
+
import l from "../../../utils/isEmptyObject.mjs";
|
|
4
4
|
import F from "../../output/consoleErrors.mjs";
|
|
5
5
|
import x from "./useFlatFieldErrorsContext.mjs";
|
|
6
|
-
const
|
|
7
|
-
const
|
|
6
|
+
const n = (r) => {
|
|
7
|
+
const u = E(), t = x();
|
|
8
8
|
h.useEffect(() => {
|
|
9
|
-
var
|
|
10
|
-
if (
|
|
9
|
+
var m, a;
|
|
10
|
+
if (l(t.all))
|
|
11
11
|
return;
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
s.type
|
|
12
|
+
const o = {
|
|
13
|
+
hasOrphans: !l(t.orphans)
|
|
14
|
+
}, e = (m = r == null ? void 0 : r.console) == null ? void 0 : m.call(r, o);
|
|
15
|
+
e && F(
|
|
16
|
+
e.message ?? p,
|
|
17
|
+
u.getValues(),
|
|
18
|
+
t,
|
|
19
|
+
e.type
|
|
21
20
|
);
|
|
22
|
-
const
|
|
23
|
-
if (
|
|
24
|
-
throw new Error(typeof
|
|
25
|
-
}, [
|
|
26
|
-
},
|
|
21
|
+
const s = (a = r == null ? void 0 : r.throw) == null ? void 0 : a.call(r, o);
|
|
22
|
+
if (s)
|
|
23
|
+
throw new Error(typeof s == "string" ? s : p);
|
|
24
|
+
}, [t]);
|
|
25
|
+
}, p = "Form errors";
|
|
27
26
|
export {
|
|
28
|
-
|
|
27
|
+
n as default
|
|
29
28
|
};
|
package/dist/esm/form/Form.mjs
CHANGED
|
@@ -1,102 +1,92 @@
|
|
|
1
|
-
import { jsxs as
|
|
1
|
+
import { jsx as c, jsxs as E, Fragment as N } from "react/jsx-runtime";
|
|
2
2
|
import "react";
|
|
3
|
-
import { useFormContext as
|
|
4
|
-
import
|
|
5
|
-
import
|
|
3
|
+
import { useFormContext as P } from "react-hook-form";
|
|
4
|
+
import f from "../client/config/useRhfUtilsClientConfigContext.mjs";
|
|
5
|
+
import w from "../devtool/LazyDevTool.mjs";
|
|
6
6
|
import { FormSubmitError as C } from "../submit/error/FormSubmitError.mjs";
|
|
7
|
-
import
|
|
7
|
+
import B from "../submit/error/setCtxErrorsByFormSubmitErrors.mjs";
|
|
8
8
|
import S from "./_Controller.mjs";
|
|
9
|
-
import w from "./_FormBase.mjs";
|
|
10
9
|
function A({
|
|
11
|
-
formId:
|
|
12
|
-
formRef:
|
|
10
|
+
formId: e,
|
|
11
|
+
formRef: m,
|
|
13
12
|
//
|
|
14
|
-
onSubmit:
|
|
13
|
+
onSubmit: s,
|
|
15
14
|
onSubmitError: d,
|
|
16
|
-
onSubmitInvalid:
|
|
17
|
-
Children:
|
|
15
|
+
onSubmitInvalid: y,
|
|
16
|
+
Children: h,
|
|
18
17
|
//
|
|
19
|
-
form:
|
|
20
|
-
utils: o
|
|
21
|
-
//
|
|
22
|
-
children: b
|
|
18
|
+
form: p,
|
|
19
|
+
utils: o
|
|
23
20
|
}) {
|
|
24
|
-
const n =
|
|
25
|
-
o != null && o.stopSubmitPropagation &&
|
|
21
|
+
const n = P(), r = f(), i = async (t) => {
|
|
22
|
+
o != null && o.stopSubmitPropagation && t.stopPropagation();
|
|
26
23
|
try {
|
|
27
|
-
await n.handleSubmit(
|
|
28
|
-
} catch (
|
|
29
|
-
|
|
24
|
+
await n.handleSubmit(b, y)(t);
|
|
25
|
+
} catch (a) {
|
|
26
|
+
j(a, t);
|
|
30
27
|
}
|
|
31
|
-
},
|
|
32
|
-
|
|
28
|
+
}, b = (t, a) => s == null ? void 0 : s(
|
|
29
|
+
t,
|
|
33
30
|
{
|
|
34
|
-
formId:
|
|
35
|
-
formRef:
|
|
31
|
+
formId: e,
|
|
32
|
+
formRef: m,
|
|
36
33
|
context: n,
|
|
37
34
|
utils: o,
|
|
38
35
|
FormSubmitError: C
|
|
39
36
|
},
|
|
40
|
-
|
|
41
|
-
),
|
|
42
|
-
var
|
|
43
|
-
const
|
|
37
|
+
a
|
|
38
|
+
), j = (t, a) => {
|
|
39
|
+
var l;
|
|
40
|
+
const F = t instanceof C ? (
|
|
44
41
|
// consumer can manually throw FormSubmitError (e.g., manual validation)
|
|
45
|
-
|
|
42
|
+
t.errors
|
|
46
43
|
) : (
|
|
47
44
|
// if error is not FormSubmitError, consumer can provide global handler
|
|
48
|
-
(
|
|
45
|
+
(l = r == null ? void 0 : r.onSubmitUnknownError) == null ? void 0 : l.call(r, t)
|
|
49
46
|
);
|
|
50
|
-
|
|
51
|
-
|
|
47
|
+
F && B(n, F), d == null || d(
|
|
48
|
+
t,
|
|
52
49
|
{
|
|
53
|
-
formId:
|
|
54
|
-
formRef:
|
|
50
|
+
formId: e,
|
|
51
|
+
formRef: m,
|
|
55
52
|
context: n,
|
|
56
53
|
utils: o
|
|
57
54
|
},
|
|
58
|
-
|
|
55
|
+
a
|
|
59
56
|
);
|
|
60
|
-
},
|
|
61
|
-
formId:
|
|
62
|
-
formRef:
|
|
57
|
+
}, x = {
|
|
58
|
+
formId: e,
|
|
59
|
+
formRef: m,
|
|
63
60
|
context: n,
|
|
64
61
|
utils: o,
|
|
65
62
|
Controller: S,
|
|
66
63
|
FormSubmitError: C
|
|
67
|
-
},
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
return r && /* @__PURE__ */ l(r, { ...h });
|
|
71
|
-
};
|
|
72
|
-
return /* @__PURE__ */ T(
|
|
73
|
-
w,
|
|
64
|
+
}, T = (r == null ? void 0 : r.FormComponent) ?? "form", v = (r == null ? void 0 : r.FormChildren) ?? U;
|
|
65
|
+
return /* @__PURE__ */ c(
|
|
66
|
+
T,
|
|
74
67
|
{
|
|
75
68
|
noValidate: !0,
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
onSubmit: F,
|
|
84
|
-
children: [
|
|
85
|
-
i("top"),
|
|
86
|
-
(o == null ? void 0 : o.devTool) && /* @__PURE__ */ l(
|
|
87
|
-
N,
|
|
69
|
+
ref: m,
|
|
70
|
+
...p,
|
|
71
|
+
className: [o == null ? void 0 : o.classNames, p == null ? void 0 : p.className].filter(Boolean).join(" "),
|
|
72
|
+
onSubmit: i,
|
|
73
|
+
children: /* @__PURE__ */ E(v, { ...x, children: [
|
|
74
|
+
(o == null ? void 0 : o.devTool) && /* @__PURE__ */ c(
|
|
75
|
+
w,
|
|
88
76
|
{
|
|
89
|
-
isDevelopment: t == null ? void 0 : t.isDevelopment,
|
|
90
77
|
props: typeof o.devTool == "object" ? o.devTool : void 0
|
|
91
78
|
}
|
|
92
79
|
),
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
i("bottom")
|
|
96
|
-
]
|
|
80
|
+
h && /* @__PURE__ */ c(h, { ...x })
|
|
81
|
+
] })
|
|
97
82
|
}
|
|
98
83
|
);
|
|
99
84
|
}
|
|
85
|
+
function U({
|
|
86
|
+
children: e
|
|
87
|
+
}) {
|
|
88
|
+
return /* @__PURE__ */ c(N, { children: e });
|
|
89
|
+
}
|
|
100
90
|
export {
|
|
101
91
|
A as default
|
|
102
92
|
};
|
|
@@ -1,14 +1,11 @@
|
|
|
1
1
|
import { jsx as o } from "react/jsx-runtime";
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
function
|
|
6
|
-
|
|
7
|
-
...i
|
|
8
|
-
}) {
|
|
9
|
-
const r = s(i);
|
|
10
|
-
return /* @__PURE__ */ o(f, { ...r.providerProps, children: /* @__PURE__ */ o(t, { ...r.formProps, children: m }) });
|
|
2
|
+
import i from "./Form.mjs";
|
|
3
|
+
import t from "./RhfUtilsFormProviders.mjs";
|
|
4
|
+
import f from "./useRhfUtilsForm.mjs";
|
|
5
|
+
function n(m) {
|
|
6
|
+
const r = f(m);
|
|
7
|
+
return /* @__PURE__ */ o(t, { ...r.providerProps, children: /* @__PURE__ */ o(i, { ...r.formProps }) });
|
|
11
8
|
}
|
|
12
9
|
export {
|
|
13
|
-
|
|
10
|
+
n as default
|
|
14
11
|
};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import
|
|
2
|
-
const
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import e from "../../../utils/createContext.mjs";
|
|
2
|
+
const {
|
|
3
|
+
Provider: r,
|
|
4
|
+
useRequired: t,
|
|
5
|
+
useMaybe: u
|
|
6
|
+
} = e();
|
|
7
7
|
export {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
r as _FormGroupContextProvider,
|
|
9
|
+
t as _useFormGroupContext,
|
|
10
|
+
u as _useFormGroupContextMaybe
|
|
11
11
|
};
|
|
@@ -1,33 +1,30 @@
|
|
|
1
|
-
import { jsx as
|
|
1
|
+
import { jsx as l } from "react/jsx-runtime";
|
|
2
2
|
import C from "../../../client/config/useRhfUtilsClientConfigContext.mjs";
|
|
3
3
|
import F from "../../../errors/flat/context/useFlatFieldErrorsContextOutput.mjs";
|
|
4
4
|
import x from "../../../submit/useFormOnSubmitSuccessfulAndReset.mjs";
|
|
5
5
|
import O from "../../../submit/useResetFormOnSubmitError.mjs";
|
|
6
6
|
import b from "../../../submit/useResetFormOnSubmitSuccessful.mjs";
|
|
7
7
|
import h from "../../../submit/useSubmitFormOnChange.mjs";
|
|
8
|
-
import { _RhfUtilsContextProvider as
|
|
9
|
-
const
|
|
10
|
-
formId:
|
|
8
|
+
import { _RhfUtilsContextProvider as d } from "./useRhfUtilsContext.mjs";
|
|
9
|
+
const M = ({
|
|
10
|
+
formId: a,
|
|
11
11
|
formRef: t,
|
|
12
|
-
onSubmitSuccessfulAndReset:
|
|
12
|
+
onSubmitSuccessfulAndReset: e,
|
|
13
13
|
options: r,
|
|
14
|
-
children:
|
|
14
|
+
children: f
|
|
15
15
|
}) => {
|
|
16
16
|
var u;
|
|
17
|
-
const
|
|
18
|
-
return F({
|
|
19
|
-
...(u = e == null ? void 0 : e.errors) == null ? void 0 : u.output,
|
|
20
|
-
isDevelopment: e == null ? void 0 : e.isDevelopment
|
|
21
|
-
}), h(t, {
|
|
17
|
+
const m = C();
|
|
18
|
+
return F((u = m == null ? void 0 : m.errors) == null ? void 0 : u.output), h(t, {
|
|
22
19
|
disabled: !(r != null && r.submitOnChange)
|
|
23
20
|
}), O({
|
|
24
21
|
disabled: !(r != null && r.resetValuesOnSubmitError)
|
|
25
22
|
}), b(
|
|
26
|
-
(r == null ? void 0 : r.resetFormAfterSubmitSuccessful) || !!
|
|
23
|
+
(r == null ? void 0 : r.resetFormAfterSubmitSuccessful) || !!e
|
|
27
24
|
), x(() => {
|
|
28
|
-
|
|
29
|
-
}), /* @__PURE__ */
|
|
25
|
+
e == null || e();
|
|
26
|
+
}), /* @__PURE__ */ l(d, { value: { formId: a, formRef: t, options: r }, children: f });
|
|
30
27
|
};
|
|
31
28
|
export {
|
|
32
|
-
|
|
29
|
+
M as default
|
|
33
30
|
};
|
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
import r from "react";
|
|
2
|
-
function
|
|
3
|
-
const
|
|
4
|
-
|
|
5
|
-
const o = e();
|
|
2
|
+
function i() {
|
|
3
|
+
const e = r.createContext(void 0), t = () => r.useContext(e), n = () => {
|
|
4
|
+
const o = t();
|
|
6
5
|
if (o === void 0)
|
|
7
6
|
throw new Error();
|
|
8
7
|
return o;
|
|
9
|
-
}
|
|
8
|
+
};
|
|
9
|
+
return {
|
|
10
|
+
Provider: e.Provider,
|
|
11
|
+
useMaybe: t,
|
|
12
|
+
useRequired: n
|
|
13
|
+
};
|
|
10
14
|
}
|
|
11
15
|
export {
|
|
12
|
-
|
|
16
|
+
i as default
|
|
13
17
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { UseFormProps } from 'react-hook-form';
|
|
2
2
|
import { FlatFieldErrorsOutputConfig } from '../../errors/flat/context/FlatFieldErrorsOutputConfig';
|
|
3
|
-
import { FormChildrenSlots } from '../../form/Form';
|
|
4
3
|
import { RhfUtilsFormOptions } from '../../form/RhfUtilsFormOptions';
|
|
4
|
+
import { SafeFieldValues } from '../../form/SafeFieldValues';
|
|
5
5
|
import { UseRhfUtilsFormChildrenProps } from '../../form/UseRhfUtilsFormChildrenProps';
|
|
6
6
|
import { FormSubmitErrors } from '../../submit/error/FormSubmitErrors';
|
|
7
7
|
|
|
@@ -11,10 +11,6 @@ import { FormSubmitErrors } from '../../submit/error/FormSubmitErrors';
|
|
|
11
11
|
* Options under `defaults` can be overridden at form level.
|
|
12
12
|
*/
|
|
13
13
|
export type RhfUtilsClientConfig = {
|
|
14
|
-
/**
|
|
15
|
-
* Some behavior is dependent on environment.
|
|
16
|
-
*/
|
|
17
|
-
isDevelopment?: boolean;
|
|
18
14
|
/**
|
|
19
15
|
* Default options for all forms. (Are overridden by form-specific options.)
|
|
20
16
|
*/
|
|
@@ -26,9 +22,9 @@ export type RhfUtilsClientConfig = {
|
|
|
26
22
|
*/
|
|
27
23
|
rhf?: Pick<UseFormProps, 'mode' | 'reValidateMode' | 'resetOptions' | 'context' | 'shouldFocusError' | 'shouldUnregister' | 'shouldUseNativeValidation' | 'progressive' | 'criteriaMode' | 'delayError'>;
|
|
28
24
|
/**
|
|
29
|
-
*
|
|
25
|
+
* Global settings and defaults.
|
|
30
26
|
*
|
|
31
|
-
* Extend this type to inject custom options/functionality via `Children` component.
|
|
27
|
+
* (Extend this type via `Register` type to inject custom options/functionality via `Children` component.)
|
|
32
28
|
*/
|
|
33
29
|
utils?: RhfUtilsFormOptions;
|
|
34
30
|
};
|
|
@@ -38,6 +34,14 @@ export type RhfUtilsClientConfig = {
|
|
|
38
34
|
* By default, a primitive `<form>` element is used.
|
|
39
35
|
*/
|
|
40
36
|
FormComponent?: React.FC<React.PropsWithChildren<React.HTMLAttributes<HTMLFormElement>>>;
|
|
37
|
+
/**
|
|
38
|
+
* Wrap all form bodies with your own hooks, components, etc.
|
|
39
|
+
*
|
|
40
|
+
* Use cases:
|
|
41
|
+
* - custom hooks/behaviors based on `options`
|
|
42
|
+
* - shared header, footer
|
|
43
|
+
*/
|
|
44
|
+
FormChildren?: <TFieldValues extends SafeFieldValues, TTransformedValues extends SafeFieldValues>(props: React.PropsWithChildren<UseRhfUtilsFormChildrenProps<TFieldValues, TTransformedValues>>) => React.ReactNode;
|
|
41
45
|
/**
|
|
42
46
|
* Global submit error handler when/if submit handler throws an error other than {@link FormSubmitError}.
|
|
43
47
|
*
|
|
@@ -49,14 +53,6 @@ export type RhfUtilsClientConfig = {
|
|
|
49
53
|
* - if `undefined`: do nothing.
|
|
50
54
|
*/
|
|
51
55
|
onSubmitUnknownError?: (error: unknown) => FormSubmitErrors | undefined;
|
|
52
|
-
/**
|
|
53
|
-
* Components injected by slot across all forms.
|
|
54
|
-
* (Per-form injection can be done via `Children` prop.)
|
|
55
|
-
*
|
|
56
|
-
* - `top`: e.g., block navigation on dirty form.
|
|
57
|
-
* - `bottom`: e.g., root errors list.
|
|
58
|
-
*/
|
|
59
|
-
Children?: Partial<Record<FormChildrenSlots, React.FC<UseRhfUtilsFormChildrenProps>>>;
|
|
60
56
|
errors?: {
|
|
61
57
|
/**
|
|
62
58
|
* Configure how/if errors should be outputted.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { RhfUtilsClientConfig } from './RhfUtilsClientConfig';
|
|
2
2
|
|
|
3
|
-
declare const
|
|
3
|
+
declare const _RhfUtilsClientConfigContextProvider: import('react').Provider<RhfUtilsClientConfig | undefined>, useRhfUtilsClientConfigMaybeContext: () => RhfUtilsClientConfig | undefined;
|
|
4
4
|
export default useRhfUtilsClientConfigMaybeContext;
|
|
5
5
|
export { _RhfUtilsClientConfigContextProvider };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { default as createRhfUtilsClientForZod } from '../createRhfUtilsClientForZod';
|
|
2
2
|
|
|
3
3
|
export type RhfUtilsClientForZodContext = ReturnType<typeof createRhfUtilsClientForZod>;
|
|
4
|
-
declare const
|
|
4
|
+
declare const _RhfUtilsClientForZodContextProvider: import('react').Provider<import('../..').CreateRhfUtilsClient<import('../ZodTypeFieldValues').ZodTypeFieldValues, "_input", "_output"> | undefined>, useRhfUtilsClientForZodContext: () => import('../..').CreateRhfUtilsClient<import('../ZodTypeFieldValues').ZodTypeFieldValues, "_input", "_output">;
|
|
5
5
|
export default useRhfUtilsClientForZodContext;
|
|
6
6
|
export { _RhfUtilsClientForZodContextProvider };
|
|
@@ -2,9 +2,10 @@ import { FlatFieldErrors } from '../types';
|
|
|
2
2
|
|
|
3
3
|
export type FlatFieldErrorsContext = {
|
|
4
4
|
all: FlatFieldErrors;
|
|
5
|
+
fields: FlatFieldErrors;
|
|
5
6
|
roots: FlatFieldErrors;
|
|
6
7
|
orphans: FlatFieldErrors;
|
|
7
8
|
};
|
|
8
|
-
declare const
|
|
9
|
+
declare const _FormErrorsFlatContextProvider: import('react').Provider<FlatFieldErrorsContext | undefined>, useFlatFieldErrorsContext: () => FlatFieldErrorsContext;
|
|
9
10
|
export default useFlatFieldErrorsContext;
|
|
10
11
|
export { _FormErrorsFlatContextProvider };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { FlatFieldErrorsOutputConfig } from './FlatFieldErrorsOutputConfig';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Outputs (e.g., console, throw) errors based on config.
|
|
5
5
|
*/
|
|
6
|
-
declare const useFlatFieldErrorsContextOutput: (config
|
|
6
|
+
declare const useFlatFieldErrorsContextOutput: (config?: FlatFieldErrorsOutputConfig) => void;
|
|
7
7
|
export default useFlatFieldErrorsContextOutput;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { FlatFieldErrorEntry } from './flat/types';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
4
|
+
* Determine if {@link FieldError} is a `ref`'d field error.
|
|
5
5
|
*/
|
|
6
6
|
declare const isFlatFieldErrorEntryRefd: ([, error]: FlatFieldErrorEntry) => boolean;
|
|
7
7
|
export default isFlatFieldErrorEntryRefd;
|
|
@@ -3,9 +3,9 @@ import { SafeFieldValues } from './SafeFieldValues';
|
|
|
3
3
|
import { UseRhfUtilsFormProps } from './UseRhfUtilsFormProps';
|
|
4
4
|
|
|
5
5
|
export type FormChildrenSlots = 'top' | 'bottom';
|
|
6
|
-
export type FormProps<TFieldValues extends SafeFieldValues, TTransformedValues extends SafeFieldValues> =
|
|
6
|
+
export type FormProps<TFieldValues extends SafeFieldValues, TTransformedValues extends SafeFieldValues> = {
|
|
7
7
|
formId: string;
|
|
8
8
|
formRef: React.RefObject<HTMLFormElement>;
|
|
9
|
-
} & Pick<UseRhfUtilsFormProps<TFieldValues, TTransformedValues>, 'onSubmit' | 'onSubmitError' | 'onSubmitInvalid' | 'Children' | 'form' | 'utils'
|
|
10
|
-
declare function _Form<TFieldValues extends SafeFieldValues, TTransformedValues extends SafeFieldValues>({ formId, formRef, onSubmit, onSubmitError, onSubmitInvalid, Children, form, utils,
|
|
9
|
+
} & Pick<UseRhfUtilsFormProps<TFieldValues, TTransformedValues>, 'onSubmit' | 'onSubmitError' | 'onSubmitInvalid' | 'Children' | 'form' | 'utils'>;
|
|
10
|
+
declare function _Form<TFieldValues extends SafeFieldValues, TTransformedValues extends SafeFieldValues>({ formId, formRef, onSubmit, onSubmitError, onSubmitInvalid, Children, form, utils, }: FormProps<TFieldValues, TTransformedValues>): import("react/jsx-runtime").JSX.Element;
|
|
11
11
|
export default _Form;
|
|
@@ -9,5 +9,5 @@ export type FormWithProvidersProps<TFieldValues extends SafeFieldValues, TTransf
|
|
|
9
9
|
* Use {@link useRhfUtilsForm} if you need to specific nesting hierarchy.
|
|
10
10
|
* (e.g., wrapping `<tr>` with provider and nesting `<form>` within `<td>` to appease HTML rules.)
|
|
11
11
|
*/
|
|
12
|
-
declare function FormWithProviders<TFieldValues extends SafeFieldValues, TTransformedValues extends SafeFieldValues>(
|
|
12
|
+
declare function FormWithProviders<TFieldValues extends SafeFieldValues, TTransformedValues extends SafeFieldValues>(props: FormWithProvidersProps<TFieldValues, TTransformedValues>): import("react/jsx-runtime").JSX.Element;
|
|
13
13
|
export default FormWithProviders;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { DevtoolUIProps } from '@hookform/devtools/dist/devToolUI';
|
|
2
|
-
import {
|
|
2
|
+
import { UseResetFormAfterSubmitSuccessfulOptions } from '../submit/useResetFormOnSubmitSuccessful';
|
|
3
3
|
import { Register } from '../register';
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -9,7 +9,7 @@ import { Register } from '../register';
|
|
|
9
9
|
*/
|
|
10
10
|
export type RhfUtilsFormOptions = {
|
|
11
11
|
/**
|
|
12
|
-
*
|
|
12
|
+
* Style via your own classes.
|
|
13
13
|
* (Defaults merged with individual class names.)
|
|
14
14
|
*/
|
|
15
15
|
classNames?: string[];
|
|
@@ -20,8 +20,12 @@ export type RhfUtilsFormOptions = {
|
|
|
20
20
|
/** Stop propagation of submit event. Useful for portals. */
|
|
21
21
|
stopSubmitPropagation?: boolean;
|
|
22
22
|
/** Reset form after successful submit. */
|
|
23
|
-
resetFormAfterSubmitSuccessful?:
|
|
24
|
-
/**
|
|
23
|
+
resetFormAfterSubmitSuccessful?: UseResetFormAfterSubmitSuccessfulOptions;
|
|
24
|
+
/**
|
|
25
|
+
* Control dev tool options.
|
|
26
|
+
* (Lazy-loaded when truthy value supplied.
|
|
27
|
+
* For zero bundle size in prod, be sure to check for dev environment.)
|
|
28
|
+
*/
|
|
25
29
|
devTool?: true | Pick<DevtoolUIProps, 'placement' | 'styles'>;
|
|
26
30
|
} & (Register extends {
|
|
27
31
|
RhfUtilsFormOptions: infer _RhfUtilsFormOptions;
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
|
-
import { RhfUtilsClientConfig } from '../client/config/RhfUtilsClientConfig';
|
|
3
2
|
|
|
4
3
|
export type FormBaseProps = React.PropsWithChildren<React.HTMLAttributes<HTMLFormElement>> & {
|
|
4
|
+
Component?: React.FC<React.PropsWithChildren<React.HTMLAttributes<HTMLFormElement>>>;
|
|
5
5
|
formRef: React.RefObject<HTMLFormElement>;
|
|
6
|
-
config?: RhfUtilsClientConfig;
|
|
7
|
-
antiCsrfToken?: string;
|
|
8
6
|
};
|
|
9
|
-
declare const _FormBase:
|
|
7
|
+
declare const _FormBase: React.FC<FormBaseProps>;
|
|
10
8
|
export default _FormBase;
|
|
@@ -12,4 +12,4 @@ export type FormGroupContext = {
|
|
|
12
12
|
setIsBusy: (isBusy: boolean) => void;
|
|
13
13
|
};
|
|
14
14
|
};
|
|
15
|
-
export declare const
|
|
15
|
+
export declare const _FormGroupContextProvider: import('react').Provider<FormGroupContext | undefined>, _useFormGroupContext: () => FormGroupContext, _useFormGroupContextMaybe: () => FormGroupContext | undefined;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { KeepStateOptions } from 'react-hook-form';
|
|
2
2
|
import { SafeFieldValues } from '../form/SafeFieldValues';
|
|
3
3
|
|
|
4
|
-
type
|
|
4
|
+
export type UseResetFormAfterSubmitSuccessfulOptions = false | undefined | true | {
|
|
5
5
|
values?: undefined | SafeFieldValues | {
|
|
6
6
|
resetToCurrentValues: true;
|
|
7
7
|
};
|
|
@@ -12,5 +12,5 @@ type Options = false | undefined | true | {
|
|
|
12
12
|
* See `Rules` section: https://react-hook-form.com/api/useform/reset/
|
|
13
13
|
* Specifically: "- It's recommended to reset inside useEffect after submission."
|
|
14
14
|
*/
|
|
15
|
-
declare const useResetFormAfterSubmitSuccessful: (options:
|
|
15
|
+
declare const useResetFormAfterSubmitSuccessful: (options: UseResetFormAfterSubmitSuccessfulOptions) => void;
|
|
16
16
|
export default useResetFormAfterSubmitSuccessful;
|
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* Create a
|
|
4
|
+
* Create a strictly-typed context that throws error if no provider is found.
|
|
5
5
|
* @returns A tuple with a function to get the context and the context provider.
|
|
6
6
|
*/
|
|
7
|
-
declare function createContext<T = unknown>():
|
|
7
|
+
declare function createContext<T = unknown>(): {
|
|
8
|
+
readonly Provider: React.Provider<T | undefined>;
|
|
9
|
+
readonly useMaybe: () => T | undefined;
|
|
10
|
+
readonly useRequired: () => T & ({} | null);
|
|
11
|
+
};
|
|
8
12
|
export default createContext;
|
package/package.json
CHANGED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { jsxs as p, jsx as s } from "react/jsx-runtime";
|
|
2
|
-
import "react";
|
|
3
|
-
const l = ({
|
|
4
|
-
config: e,
|
|
5
|
-
formRef: t,
|
|
6
|
-
antiCsrfToken: r,
|
|
7
|
-
children: o,
|
|
8
|
-
...m
|
|
9
|
-
}) => {
|
|
10
|
-
const n = (e == null ? void 0 : e.FormComponent) ?? "form";
|
|
11
|
-
return /* @__PURE__ */ p(n, { role: "form", ...m, ref: t, children: [
|
|
12
|
-
r && /* @__PURE__ */ s("input", { type: "hidden", name: "anticsrftoken", value: r }),
|
|
13
|
-
o
|
|
14
|
-
] });
|
|
15
|
-
};
|
|
16
|
-
export {
|
|
17
|
-
l as default
|
|
18
|
-
};
|