@paragrav/rhf-utils 0.0.138 → 0.0.139
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 +10 -17
- package/dist/esm/{utils/createContext.mjs → createContext-Jzs0Nsql.js} +1 -1
- package/dist/esm/exports.mjs +483 -44
- package/dist/esm/form/context/group/exports.mjs +74 -0
- package/dist/types/devtool/LazyDevTool.d.ts +1 -1
- package/dist/types/errors/nonfield/{FormNonFieldErrorMarker.d.ts → RhfUtilsNonFieldErrorMarker.d.ts} +2 -2
- package/dist/types/errors/nonfield/{FormNonFieldErrorMarker.utils.d.ts → RhfUtilsNonFieldErrorMarker.utils.d.ts} +1 -1
- package/dist/types/errors/nonfield/RhfUtilsNonFieldErrorMarkerHtmlAttribute.d.ts +5 -0
- package/dist/types/exports.d.ts +1 -15
- package/dist/types/form/context/group/exports.d.ts +9 -0
- package/package.json +7 -1
- package/dist/esm/client/config/useRhfUtilsClientConfigContext.mjs +0 -9
- package/dist/esm/client/index.mjs +0 -49
- package/dist/esm/client/utils.mjs +0 -38
- package/dist/esm/client/zod/context/RhfUtilsClientForZodContextProvider.mjs +0 -17
- package/dist/esm/client/zod/context/RhfUtilsZodForm.mjs +0 -12
- package/dist/esm/client/zod/context/useRhfUtilsClientForZodContext.mjs +0 -9
- package/dist/esm/client/zod/context/useRhfUtilsZodForm.mjs +0 -5
- package/dist/esm/client/zod/createRhfUtilsClientForZod.mjs +0 -6
- package/dist/esm/devtool/LazyDevTool.mjs +0 -15
- package/dist/esm/errors/flat/FlatFieldErrorsList.mjs +0 -17
- package/dist/esm/errors/flat/context/FlatFieldErrorsContextProvider.mjs +0 -27
- package/dist/esm/errors/flat/context/useFlatFieldErrorsContext.mjs +0 -9
- package/dist/esm/errors/flat/context/useFlatFieldErrorsContextHasOnlyOrphans.mjs +0 -9
- package/dist/esm/errors/flat/context/useFlatFieldErrorsContextOutput.mjs +0 -24
- package/dist/esm/errors/flat/filterFlatFieldErrors.mjs +0 -10
- package/dist/esm/errors/flat/flattenFieldErrors.mjs +0 -5
- package/dist/esm/errors/flat/getFlatFieldErrors.mjs +0 -24
- package/dist/esm/errors/getRefdFromFlatFieldErrors.mjs +0 -8
- package/dist/esm/errors/isFieldErrorRefd.mjs +0 -4
- package/dist/esm/errors/isFlatFieldErrorEntryRefd.mjs +0 -5
- package/dist/esm/errors/message/FormErrorMessage.mjs +0 -14
- package/dist/esm/errors/message/RhfUtilsFieldErrorMessage.mjs +0 -14
- package/dist/esm/errors/nonfield/FormNonFieldErrorMarker.mjs +0 -19
- package/dist/esm/errors/nonfield/FormNonFieldErrorMarker.utils.mjs +0 -23
- package/dist/esm/errors/nonfield/FormNonFieldErrorMarkerHtmlAttribute.mjs +0 -4
- package/dist/esm/errors/nonfield/isNonFieldErrorMarkerInDOM.mjs +0 -5
- package/dist/esm/errors/orphan/getIsOrphanFormErrorWithParentElement.mjs +0 -5
- package/dist/esm/errors/orphan/getOrphansFromFlatFieldErrors.mjs +0 -8
- package/dist/esm/errors/orphan/isOrphanFormError.mjs +0 -12
- package/dist/esm/errors/output/consoleErrors.mjs +0 -6
- package/dist/esm/errors/root/RootErrorsListFromFlatFieldErrorsContext.mjs +0 -10
- package/dist/esm/errors/root/consts.mjs +0 -4
- package/dist/esm/errors/root/getRootsFromFlatFieldErrors.mjs +0 -8
- package/dist/esm/errors/root/isFlatFieldErrorEntryPathRoot.mjs +0 -5
- package/dist/esm/errors/root/isFormErrorPathRoot.mjs +0 -5
- package/dist/esm/form/Form.mjs +0 -86
- package/dist/esm/form/FormWithProviders.mjs +0 -11
- package/dist/esm/form/RhfUtilsFormProviders.mjs +0 -24
- package/dist/esm/form/_Controller.mjs +0 -8
- package/dist/esm/form/context/group/FormGroupContextProvider.mjs +0 -30
- package/dist/esm/form/context/group/index.mjs +0 -11
- package/dist/esm/form/context/group/useFormGroupChildIsMountedTracker.mjs +0 -6
- package/dist/esm/form/context/group/useFormGroupChildIsSubmittingTracker.mjs +0 -10
- package/dist/esm/form/context/group/useFormGroupChildTracker.mjs +0 -13
- package/dist/esm/form/context/group/useFormGroupIsAnyBusy.mjs +0 -8
- package/dist/esm/form/context/group/useFormGroupIsChildBusy.mjs +0 -8
- package/dist/esm/form/context/group/useFormGroupIsParentBusy.mjs +0 -8
- package/dist/esm/form/context/group/useFormGroupParentTracker.mjs +0 -13
- package/dist/esm/form/context/group/useFormOrParentIsBusy.mjs +0 -10
- package/dist/esm/form/context/utils/RhfUtilsContextProvider.mjs +0 -23
- package/dist/esm/form/context/utils/useRhfUtilsContext.mjs +0 -6
- package/dist/esm/form/context/utils/useRhfUtilsContextRequestSubmit.mjs +0 -9
- package/dist/esm/form/useFormIsBusy.mjs +0 -8
- package/dist/esm/form/useRhfUtilsForm.mjs +0 -43
- package/dist/esm/form/utils/getSubmitterButtonData.mjs +0 -12
- package/dist/esm/form/utils/useFormRequestSubmit.mjs +0 -13
- package/dist/esm/submit/error/FormSubmitError.mjs +0 -8
- package/dist/esm/submit/error/setCtxErrorsByFormSubmitFieldErrors.mjs +0 -12
- package/dist/esm/submit/useFormOnSubmitted.mjs +0 -12
- package/dist/esm/submit/useResetFormOnSubmitted.mjs +0 -36
- package/dist/esm/submit/useSubmitFormOnChange.mjs +0 -26
- package/dist/esm/utils/PassthroughChildren.mjs +0 -7
- package/dist/esm/utils/isEmptyObject.mjs +0 -4
- package/dist/esm/utils/useDebouncedOnChangeValue.mjs +0 -26
- package/dist/esm/utils/useRefIfValueWasTrue.mjs +0 -14
- package/dist/types/errors/nonfield/FormNonFieldErrorMarkerHtmlAttribute.d.ts +0 -5
- /package/dist/types/errors/nonfield/{FormNonFieldErrorMarker.spec.d.ts → RhfUtilsNonFieldErrorMarker.spec.d.ts} +0 -0
package/dist/types/errors/nonfield/{FormNonFieldErrorMarker.d.ts → RhfUtilsNonFieldErrorMarker.d.ts}
RENAMED
|
@@ -9,5 +9,5 @@ type Props = {
|
|
|
9
9
|
* Field array with minimum items.
|
|
10
10
|
* (When there are no items, the error is not associated with a field and is displayed separately.)
|
|
11
11
|
*/
|
|
12
|
-
declare const
|
|
13
|
-
export default
|
|
12
|
+
declare const RhfUtilsNonFieldErrorMarker: React.FC<Props>;
|
|
13
|
+
export default RhfUtilsNonFieldErrorMarker;
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*
|
|
5
5
|
* @returns One or more selectors in a comma-separated list.
|
|
6
6
|
*/
|
|
7
|
-
export declare const
|
|
7
|
+
export declare const getRhfUtilsNonFieldErrorMarkerQuerySelector: (path: string, options?: {
|
|
8
8
|
/**
|
|
9
9
|
* Do not look for match as nested field.
|
|
10
10
|
*
|
package/dist/types/exports.d.ts
CHANGED
|
@@ -7,23 +7,9 @@ export type { RhfUtilsUseFormChildrenZodFC } from './client/zod/RhfUtilsUseFormC
|
|
|
7
7
|
export type { RhfUtilsUseFormChildrenZodProps } from './client/zod/RhfUtilsUseFormChildrenZodProps';
|
|
8
8
|
export { default as useFlatFieldErrorsContext } from './errors/flat/context/useFlatFieldErrorsContext';
|
|
9
9
|
export { default as useFlatFieldErrorsContextHasOnlyOrphans } from './errors/flat/context/useFlatFieldErrorsContextHasOnlyOrphans';
|
|
10
|
-
export { default as
|
|
11
|
-
export { default as FormNonFieldErrorMarker } from './errors/nonfield/FormNonFieldErrorMarker';
|
|
12
|
-
export { default as RootErrorsListFromFlatFieldErrorsContext } from './errors/root/RootErrorsListFromFlatFieldErrorsContext';
|
|
10
|
+
export { default as RhfUtilsNonFieldErrorMarker } from './errors/nonfield/RhfUtilsNonFieldErrorMarker';
|
|
13
11
|
export type { RhfUtilsFormOptions } from './form/RhfUtilsFormOptions';
|
|
14
12
|
export type { SafeFieldValues } from './form/SafeFieldValues';
|
|
15
13
|
export type { UseRhfUtilsFormChildrenProps } from './form/UseRhfUtilsFormChildrenProps';
|
|
16
14
|
export { default as useRhfUtilsContext } from './form/context/utils/useRhfUtilsContext';
|
|
17
|
-
export { default as useRhfUtilsContextRequestSubmit } from './form/context/utils/useRhfUtilsContextRequestSubmit';
|
|
18
|
-
export { default as FormGroupContextProvider } from './form/context/group/FormGroupContextProvider';
|
|
19
|
-
export { default as useFormGroupChildIsMountedTracker } from './form/context/group/useFormGroupChildIsMountedTracker';
|
|
20
|
-
export { default as useFormGroupChildIsSubmittingTracker } from './form/context/group/useFormGroupChildIsSubmittingTracker';
|
|
21
|
-
export { default as useFormGroupChildTracker } from './form/context/group/useFormGroupChildTracker';
|
|
22
|
-
export { default as useFormGroupIsAnyBusy } from './form/context/group/useFormGroupIsAnyBusy';
|
|
23
|
-
export { default as useFormGroupIsChildBusy } from './form/context/group/useFormGroupIsChildBusy';
|
|
24
|
-
export { default as useFormGroupIsParentBusy } from './form/context/group/useFormGroupIsParentBusy';
|
|
25
|
-
export { default as useFormGroupParentTracker } from './form/context/group/useFormGroupParentTracker';
|
|
26
|
-
export { default as useFormOrParentIsBusy } from './form/context/group/useFormOrParentIsBusy';
|
|
27
|
-
export { default as getSubmitterButtonData } from './form/utils/getSubmitterButtonData';
|
|
28
|
-
export { default as useFormRequestSubmit } from './form/utils/useFormRequestSubmit';
|
|
29
15
|
export { FormSubmitError } from './submit/error/FormSubmitError';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export { default as FormGroupContextProvider } from './FormGroupContextProvider';
|
|
2
|
+
export { default as useFormGroupChildIsMountedTracker } from './useFormGroupChildIsMountedTracker';
|
|
3
|
+
export { default as useFormGroupChildIsSubmittingTracker } from './useFormGroupChildIsSubmittingTracker';
|
|
4
|
+
export { default as useFormGroupChildTracker } from './useFormGroupChildTracker';
|
|
5
|
+
export { default as useFormGroupIsAnyBusy } from './useFormGroupIsAnyBusy';
|
|
6
|
+
export { default as useFormGroupIsChildBusy } from './useFormGroupIsChildBusy';
|
|
7
|
+
export { default as useFormGroupIsParentBusy } from './useFormGroupIsParentBusy';
|
|
8
|
+
export { default as useFormGroupParentTracker } from './useFormGroupParentTracker';
|
|
9
|
+
export { default as useFormOrParentIsBusy } from './useFormOrParentIsBusy';
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@paragrav/rhf-utils",
|
|
3
3
|
"author": "paragrav.dev",
|
|
4
4
|
"license": "MIT",
|
|
5
|
-
"version": "0.0.
|
|
5
|
+
"version": "0.0.139",
|
|
6
6
|
"description": "Integration utilities for react-hook-form.",
|
|
7
7
|
"type": "module",
|
|
8
8
|
"sideEffects": false,
|
|
@@ -17,6 +17,12 @@
|
|
|
17
17
|
"default": "./dist/esm/exports.mjs",
|
|
18
18
|
"types": "./dist/types/exports.d.ts"
|
|
19
19
|
}
|
|
20
|
+
},
|
|
21
|
+
"./form/context/group": {
|
|
22
|
+
"import": {
|
|
23
|
+
"default": "./dist/esm/form/context/group/exports.mjs",
|
|
24
|
+
"types": "./dist/types/form/context/group/exports.d.ts"
|
|
25
|
+
}
|
|
20
26
|
}
|
|
21
27
|
},
|
|
22
28
|
"peerDependencies": {
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import { jsx as m } from "react/jsx-runtime";
|
|
2
|
-
import "react";
|
|
3
|
-
import n from "../form/FormWithProviders.mjs";
|
|
4
|
-
import l from "../form/useRhfUtilsForm.mjs";
|
|
5
|
-
import { mergeRhfUtilsClientConfigDefaultsWithUseRhfUtilsFormProps as F } from "./utils.mjs";
|
|
6
|
-
const c = (r) => (o) => {
|
|
7
|
-
const e = f(r, o);
|
|
8
|
-
return {
|
|
9
|
-
useForm: (s, t) => {
|
|
10
|
-
const i = e(s, t);
|
|
11
|
-
return {
|
|
12
|
-
...l(i),
|
|
13
|
-
FormWithProviders: () => /* @__PURE__ */ m(n, { ...i })
|
|
14
|
-
};
|
|
15
|
-
},
|
|
16
|
-
FormWithProviders: u(r, o)
|
|
17
|
-
};
|
|
18
|
-
}, f = (r, o) => function(s, t) {
|
|
19
|
-
return {
|
|
20
|
-
...t,
|
|
21
|
-
...F(
|
|
22
|
-
o.defaults,
|
|
23
|
-
t,
|
|
24
|
-
{
|
|
25
|
-
rhf: {
|
|
26
|
-
resolver: r(s)
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
)
|
|
30
|
-
};
|
|
31
|
-
}, u = (r, o) => {
|
|
32
|
-
const e = f(r, o);
|
|
33
|
-
return function({
|
|
34
|
-
schema: t,
|
|
35
|
-
children: i,
|
|
36
|
-
...h
|
|
37
|
-
}) {
|
|
38
|
-
return /* @__PURE__ */ m(
|
|
39
|
-
n,
|
|
40
|
-
{
|
|
41
|
-
...e(t, h),
|
|
42
|
-
children: i
|
|
43
|
-
}
|
|
44
|
-
);
|
|
45
|
-
};
|
|
46
|
-
};
|
|
47
|
-
export {
|
|
48
|
-
c as createRhfUtilsClient
|
|
49
|
-
};
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
const u = (n, ...r) => (
|
|
2
|
-
// sequentially merge each set of props into defaults
|
|
3
|
-
r.reduce(
|
|
4
|
-
(t, e) => {
|
|
5
|
-
var s, i, l, m, o, f;
|
|
6
|
-
return {
|
|
7
|
-
rhf: {
|
|
8
|
-
...t == null ? void 0 : t.rhf,
|
|
9
|
-
...e.rhf
|
|
10
|
-
},
|
|
11
|
-
utils: {
|
|
12
|
-
...t == null ? void 0 : t.utils,
|
|
13
|
-
...e.utils,
|
|
14
|
-
// manual merges
|
|
15
|
-
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing -- false positive
|
|
16
|
-
...(((s = t == null ? void 0 : t.utils) == null ? void 0 : s.resetOnSubmitted) || ((i = e.utils) == null ? void 0 : i.resetOnSubmitted)) && {
|
|
17
|
-
resetOnSubmitted: {
|
|
18
|
-
...(l = t == null ? void 0 : t.utils) == null ? void 0 : l.resetOnSubmitted,
|
|
19
|
-
...(m = e.utils) == null ? void 0 : m.resetOnSubmitted
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
},
|
|
23
|
-
form: {
|
|
24
|
-
...t == null ? void 0 : t.form,
|
|
25
|
-
...e.form,
|
|
26
|
-
// manual merges
|
|
27
|
-
className: [(o = t == null ? void 0 : t.form) == null ? void 0 : o.className, (f = e.form) == null ? void 0 : f.className].filter(Boolean).join(" ") || void 0
|
|
28
|
-
// stringify (replace empty string with undefined)
|
|
29
|
-
}
|
|
30
|
-
};
|
|
31
|
-
},
|
|
32
|
-
// start with defaults
|
|
33
|
-
n
|
|
34
|
-
)
|
|
35
|
-
);
|
|
36
|
-
export {
|
|
37
|
-
u as mergeRhfUtilsClientConfigDefaultsWithUseRhfUtilsFormProps
|
|
38
|
-
};
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { jsx as o } from "react/jsx-runtime";
|
|
2
|
-
import e from "react";
|
|
3
|
-
import { _RhfUtilsClientConfigContextProvider as l } from "../../config/useRhfUtilsClientConfigContext.mjs";
|
|
4
|
-
import f from "../createRhfUtilsClientForZod.mjs";
|
|
5
|
-
import { _RhfUtilsClientForZodContextProvider as s } from "./useRhfUtilsClientForZodContext.mjs";
|
|
6
|
-
const d = ({
|
|
7
|
-
config: r,
|
|
8
|
-
children: i
|
|
9
|
-
}) => {
|
|
10
|
-
const [t] = e.useState(r), [n] = e.useState(
|
|
11
|
-
() => f(t ?? {})
|
|
12
|
-
);
|
|
13
|
-
return /* @__PURE__ */ o(l, { value: t, children: /* @__PURE__ */ o(s, { value: n, children: i }) });
|
|
14
|
-
}, p = d;
|
|
15
|
-
export {
|
|
16
|
-
p as default
|
|
17
|
-
};
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { jsx as i } from "react/jsx-runtime";
|
|
2
|
-
import e from "./useRhfUtilsClientForZodContext.mjs";
|
|
3
|
-
function m({
|
|
4
|
-
schema: o,
|
|
5
|
-
...t
|
|
6
|
-
}) {
|
|
7
|
-
const { FormWithProviders: r } = e();
|
|
8
|
-
return /* @__PURE__ */ i(r, { schema: o, ...t });
|
|
9
|
-
}
|
|
10
|
-
export {
|
|
11
|
-
m as default
|
|
12
|
-
};
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { jsx as t } from "react/jsx-runtime";
|
|
2
|
-
import e from "react";
|
|
3
|
-
import { useFormContext as n } from "react-hook-form";
|
|
4
|
-
const a = e.lazy(
|
|
5
|
-
() => import("@hookform/devtools").then((o) => ({
|
|
6
|
-
default: o.DevTool
|
|
7
|
-
}))
|
|
8
|
-
), u = ({ isDevelopment: o, props: r }) => {
|
|
9
|
-
if (!o) return null;
|
|
10
|
-
const { control: l } = n();
|
|
11
|
-
return /* @__PURE__ */ t(e.Suspense, { fallback: null, children: /* @__PURE__ */ t(a, { control: l, ...r }) });
|
|
12
|
-
};
|
|
13
|
-
export {
|
|
14
|
-
u as default
|
|
15
|
-
};
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { jsx as t } from "react/jsx-runtime";
|
|
2
|
-
import l from "../../utils/isEmptyObject.mjs";
|
|
3
|
-
const o = ({ errors: e }) => {
|
|
4
|
-
if (e && !l(e))
|
|
5
|
-
return /* @__PURE__ */ t("ul", { children: Object.values(e).map((i, r) => /* @__PURE__ */ t(
|
|
6
|
-
"li",
|
|
7
|
-
{
|
|
8
|
-
role: "alert",
|
|
9
|
-
"aria-live": "polite",
|
|
10
|
-
children: i.message
|
|
11
|
-
},
|
|
12
|
-
r
|
|
13
|
-
)) });
|
|
14
|
-
};
|
|
15
|
-
export {
|
|
16
|
-
o as default
|
|
17
|
-
};
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { jsx as a } from "react/jsx-runtime";
|
|
2
|
-
import "react";
|
|
3
|
-
import { useFormState as l } from "react-hook-form";
|
|
4
|
-
import F from "../../getRefdFromFlatFieldErrors.mjs";
|
|
5
|
-
import e from "../../../utils/isEmptyObject.mjs";
|
|
6
|
-
import p from "../../orphan/getOrphansFromFlatFieldErrors.mjs";
|
|
7
|
-
import n from "../../root/getRootsFromFlatFieldErrors.mjs";
|
|
8
|
-
import d from "../getFlatFieldErrors.mjs";
|
|
9
|
-
import { _FormErrorsFlatContextProvider as f } from "./useFlatFieldErrorsContext.mjs";
|
|
10
|
-
const C = ({
|
|
11
|
-
formRef: o,
|
|
12
|
-
children: m
|
|
13
|
-
}) => {
|
|
14
|
-
const { errors: t } = l(), r = d(t), s = o.current ? p(r, o.current) : {}, i = {
|
|
15
|
-
all: r,
|
|
16
|
-
fields: F(r),
|
|
17
|
-
roots: n(r),
|
|
18
|
-
orphans: s,
|
|
19
|
-
// computed
|
|
20
|
-
hasErrors: !e(t),
|
|
21
|
-
hasOrphans: !e(s)
|
|
22
|
-
};
|
|
23
|
-
return /* @__PURE__ */ a(f, { value: i, children: m });
|
|
24
|
-
};
|
|
25
|
-
export {
|
|
26
|
-
C as default
|
|
27
|
-
};
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import s from "react";
|
|
2
|
-
import e from "./useFlatFieldErrorsContext.mjs";
|
|
3
|
-
const t = () => {
|
|
4
|
-
const r = e();
|
|
5
|
-
return s.useMemo(() => !r.hasErrors || !r.hasOrphans ? !1 : Object.keys(r.orphans).length === Object.keys(r.all).length, [r]);
|
|
6
|
-
}, l = t;
|
|
7
|
-
export {
|
|
8
|
-
l as default
|
|
9
|
-
};
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import u from "react";
|
|
2
|
-
import { useFormContext as p } from "react-hook-form";
|
|
3
|
-
import E from "../../output/consoleErrors.mjs";
|
|
4
|
-
import F from "./useFlatFieldErrorsContext.mjs";
|
|
5
|
-
const C = (r) => {
|
|
6
|
-
const l = p(), t = F();
|
|
7
|
-
u.useEffect(() => {
|
|
8
|
-
var o, m;
|
|
9
|
-
if (!t.hasErrors) return;
|
|
10
|
-
const e = (o = r == null ? void 0 : r.console) == null ? void 0 : o.call(r, t);
|
|
11
|
-
e && E(
|
|
12
|
-
e.message ?? a,
|
|
13
|
-
l.getValues(),
|
|
14
|
-
t,
|
|
15
|
-
e.type
|
|
16
|
-
);
|
|
17
|
-
const s = (m = r == null ? void 0 : r.throw) == null ? void 0 : m.call(r, t);
|
|
18
|
-
if (s)
|
|
19
|
-
throw new Error(typeof s == "string" ? s : a);
|
|
20
|
-
}, [t]);
|
|
21
|
-
}, a = "Form errors";
|
|
22
|
-
export {
|
|
23
|
-
C as default
|
|
24
|
-
};
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { get as d } from "react-hook-form";
|
|
2
|
-
import a from "./flattenFieldErrors.mjs";
|
|
3
|
-
const b = (t) => {
|
|
4
|
-
const s = a(t), n = Object.keys(s);
|
|
5
|
-
return Object.fromEntries(
|
|
6
|
-
n.reduce(
|
|
7
|
-
(e, o) => {
|
|
8
|
-
const r = o.replace(
|
|
9
|
-
i,
|
|
10
|
-
""
|
|
11
|
-
);
|
|
12
|
-
if (r === o) return e;
|
|
13
|
-
const f = d(t, r, void 0);
|
|
14
|
-
return f && e.push([r, f]), e;
|
|
15
|
-
},
|
|
16
|
-
[]
|
|
17
|
-
// entries
|
|
18
|
-
)
|
|
19
|
-
);
|
|
20
|
-
}, i = /\.(?:type|message)\b$/;
|
|
21
|
-
export {
|
|
22
|
-
b as default,
|
|
23
|
-
i as regexMaybeFieldErrorLeafNodeSuffix
|
|
24
|
-
};
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { jsx as o } from "react/jsx-runtime";
|
|
2
|
-
import "react";
|
|
3
|
-
const i = ({ message: r, className: e }) => /* @__PURE__ */ o(
|
|
4
|
-
"p",
|
|
5
|
-
{
|
|
6
|
-
role: "alert",
|
|
7
|
-
"aria-live": "polite",
|
|
8
|
-
className: e,
|
|
9
|
-
children: r
|
|
10
|
-
}
|
|
11
|
-
);
|
|
12
|
-
export {
|
|
13
|
-
i as default
|
|
14
|
-
};
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { jsxs as n, Fragment as i, jsx as o } from "react/jsx-runtime";
|
|
2
|
-
import { useFormState as a, get as l } from "react-hook-form";
|
|
3
|
-
import f from "../nonfield/FormNonFieldErrorMarker.mjs";
|
|
4
|
-
import g from "./FormErrorMessage.mjs";
|
|
5
|
-
const F = ({ path: e, Component: s }) => {
|
|
6
|
-
const { errors: t } = a(), r = l(t, e, void 0), m = s ?? g;
|
|
7
|
-
return r != null && r.message ? /* @__PURE__ */ n(i, { children: [
|
|
8
|
-
/* @__PURE__ */ o(m, { message: r.message }),
|
|
9
|
-
/* @__PURE__ */ o(f, { path: e })
|
|
10
|
-
] }) : null;
|
|
11
|
-
}, E = F;
|
|
12
|
-
export {
|
|
13
|
-
E as default
|
|
14
|
-
};
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { jsx as t } from "react/jsx-runtime";
|
|
2
|
-
import e from "./FormNonFieldErrorMarkerHtmlAttribute.mjs";
|
|
3
|
-
const a = ({ path: r }) => {
|
|
4
|
-
const o = {
|
|
5
|
-
[e]: r
|
|
6
|
-
};
|
|
7
|
-
return /* @__PURE__ */ t(
|
|
8
|
-
"div",
|
|
9
|
-
{
|
|
10
|
-
role: "alert",
|
|
11
|
-
"aria-hidden": "true",
|
|
12
|
-
style: { display: "none" },
|
|
13
|
-
...o
|
|
14
|
-
}
|
|
15
|
-
);
|
|
16
|
-
}, d = a;
|
|
17
|
-
export {
|
|
18
|
-
d as default
|
|
19
|
-
};
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import l from "./FormNonFieldErrorMarkerHtmlAttribute.mjs";
|
|
2
|
-
const m = (r, e) => (
|
|
3
|
-
// list of selector variants
|
|
4
|
-
[
|
|
5
|
-
// equals
|
|
6
|
-
// e.g., attr="path"
|
|
7
|
-
["", ""],
|
|
8
|
-
[
|
|
9
|
-
// @see https://developer.mozilla.org/en-US/docs/Web/CSS/Attribute_selectors#attrvalue_4
|
|
10
|
-
"^",
|
|
11
|
-
// only match nested (avoid match 'field' with 'field1`)
|
|
12
|
-
"."
|
|
13
|
-
]
|
|
14
|
-
].map(
|
|
15
|
-
([o, t]) => n(
|
|
16
|
-
l + o,
|
|
17
|
-
r + t
|
|
18
|
-
)
|
|
19
|
-
).join(", ")
|
|
20
|
-
), n = (r, e) => `[role="alert"][${r}="${e}"]`;
|
|
21
|
-
export {
|
|
22
|
-
m as getFormNonFieldErrorMarkerQuerySelector
|
|
23
|
-
};
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import m from "../isFieldErrorRefd.mjs";
|
|
2
|
-
import t from "../nonfield/isNonFieldErrorMarkerInDOM.mjs";
|
|
3
|
-
import e from "../root/isFormErrorPathRoot.mjs";
|
|
4
|
-
const d = (r, o, i) => (
|
|
5
|
-
// non-field
|
|
6
|
-
!m(o) && // non-root
|
|
7
|
-
!e(r) && // not marked in DOM
|
|
8
|
-
!t(r, i)
|
|
9
|
-
);
|
|
10
|
-
export {
|
|
11
|
-
d as default
|
|
12
|
-
};
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { jsx as o } from "react/jsx-runtime";
|
|
2
|
-
import t from "../flat/context/useFlatFieldErrorsContext.mjs";
|
|
3
|
-
import s from "../flat/FlatFieldErrorsList.mjs";
|
|
4
|
-
const e = () => {
|
|
5
|
-
const r = t().roots;
|
|
6
|
-
return /* @__PURE__ */ o(s, { errors: r });
|
|
7
|
-
}, m = e;
|
|
8
|
-
export {
|
|
9
|
-
m as default
|
|
10
|
-
};
|