@paragrav/rhf-utils 0.0.16 → 0.0.17
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/dist/cjs/errors/orphans/FormErrorNonFieldMarker.d.ts +14 -0
- package/dist/cjs/{rhf/errors → errors}/orphans/FormErrorNonFieldMarker.js +7 -4
- package/dist/cjs/{rhf/errors → errors}/orphans/utils.js +1 -1
- package/dist/cjs/main.d.ts +7 -7
- package/dist/cjs/main.js +8 -8
- package/dist/esm/{rhf/errors → errors}/orphans/FormErrorNonFieldMarker.mjs +3 -3
- package/dist/esm/{rhf/errors → errors}/orphans/utils.mjs +6 -6
- package/dist/esm/{rhf/errors → errors}/utils.mjs +1 -1
- package/dist/esm/main.mjs +10 -10
- package/dist/types/errors/orphans/FormErrorNonFieldMarker.d.ts +14 -0
- package/dist/types/main.d.ts +7 -7
- package/package.json +1 -1
- package/dist/cjs/rhf/errors/orphans/FormErrorNonFieldMarker.d.ts +0 -11
- package/dist/types/rhf/errors/orphans/FormErrorNonFieldMarker.d.ts +0 -11
- /package/dist/cjs/{rhf/errors → errors}/orphans/useFormErrorOrphansToConsoleError.d.ts +0 -0
- /package/dist/cjs/{rhf/errors → errors}/orphans/useFormErrorOrphansToConsoleError.js +0 -0
- /package/dist/cjs/{rhf/errors → errors}/orphans/useFormOrphanErrors.d.ts +0 -0
- /package/dist/cjs/{rhf/errors → errors}/orphans/useFormOrphanErrors.js +0 -0
- /package/dist/cjs/{rhf/errors → errors}/orphans/utils.d.ts +0 -0
- /package/dist/cjs/{rhf/errors → errors}/roots/useFormRootFieldErrors.d.ts +0 -0
- /package/dist/cjs/{rhf/errors → errors}/roots/useFormRootFieldErrors.js +0 -0
- /package/dist/cjs/{rhf/errors → errors}/roots/utils.d.ts +0 -0
- /package/dist/cjs/{rhf/errors → errors}/roots/utils.js +0 -0
- /package/dist/cjs/{rhf/errors → errors}/useFormErrorsEffect.d.ts +0 -0
- /package/dist/cjs/{rhf/errors → errors}/useFormErrorsEffect.js +0 -0
- /package/dist/cjs/{rhf/errors → errors}/useFormErrorsOnChange.d.ts +0 -0
- /package/dist/cjs/{rhf/errors → errors}/useFormErrorsOnChange.js +0 -0
- /package/dist/cjs/{rhf/errors → errors}/useFormRequestSubmit.d.ts +0 -0
- /package/dist/cjs/{rhf/errors → errors}/useFormRequestSubmit.js +0 -0
- /package/dist/cjs/{rhf/errors → errors}/utils.d.ts +0 -0
- /package/dist/cjs/{rhf/errors → errors}/utils.js +0 -0
- /package/dist/esm/{rhf/errors → errors}/orphans/useFormErrorOrphansToConsoleError.mjs +0 -0
- /package/dist/esm/{rhf/errors → errors}/orphans/useFormOrphanErrors.mjs +0 -0
- /package/dist/esm/{rhf/errors → errors}/roots/useFormRootFieldErrors.mjs +0 -0
- /package/dist/esm/{rhf/errors → errors}/roots/utils.mjs +0 -0
- /package/dist/esm/{rhf/errors → errors}/useFormErrorsEffect.mjs +0 -0
- /package/dist/esm/{rhf/errors → errors}/useFormErrorsOnChange.mjs +0 -0
- /package/dist/esm/{rhf/errors → errors}/useFormRequestSubmit.mjs +0 -0
- /package/dist/types/{rhf/errors → errors}/orphans/useFormErrorOrphansToConsoleError.d.ts +0 -0
- /package/dist/types/{rhf/errors → errors}/orphans/useFormOrphanErrors.d.ts +0 -0
- /package/dist/types/{rhf/errors → errors}/orphans/utils.d.ts +0 -0
- /package/dist/types/{rhf/errors → errors}/roots/useFormRootFieldErrors.d.ts +0 -0
- /package/dist/types/{rhf/errors → errors}/roots/utils.d.ts +0 -0
- /package/dist/types/{rhf/errors → errors}/useFormErrorsEffect.d.ts +0 -0
- /package/dist/types/{rhf/errors → errors}/useFormErrorsOnChange.d.ts +0 -0
- /package/dist/types/{rhf/errors → errors}/useFormRequestSubmit.d.ts +0 -0
- /package/dist/types/{rhf/errors → errors}/utils.d.ts +0 -0
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
type Props = {
|
|
3
|
+
/** Flat field name. (e.g., `address.street`) */
|
|
4
|
+
path: string;
|
|
5
|
+
};
|
|
6
|
+
/**
|
|
7
|
+
* Empty, hidden marker to indicate a non-field error is presented to user.
|
|
8
|
+
*/
|
|
9
|
+
declare const FormErrorNonFieldMarker: React.FC<Props>;
|
|
10
|
+
export default FormErrorNonFieldMarker;
|
|
11
|
+
/**
|
|
12
|
+
* HTML data attribute for {@link FormErrorNonFieldMarker}.
|
|
13
|
+
*/
|
|
14
|
+
export declare const FormErrorNonFieldMarkerHtmlAttribute = "data-paragrav-rhf-utils-marker-path";
|
|
@@ -1,17 +1,20 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.FormErrorNonFieldMarkerHtmlAttribute = void 0;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
/**
|
|
6
|
-
* Empty marker to indicate a non-field error is presented to user.
|
|
6
|
+
* Empty, hidden marker to indicate a non-field error is presented to user.
|
|
7
7
|
*/
|
|
8
8
|
const FormErrorNonFieldMarker = ({ path }) => {
|
|
9
9
|
const attribute = {
|
|
10
|
-
[exports.
|
|
10
|
+
[exports.FormErrorNonFieldMarkerHtmlAttribute]: path,
|
|
11
11
|
};
|
|
12
12
|
return ((0, jsx_runtime_1.jsx)("div", { role: "alert", "aria-hidden": "true" // hide from screen readers
|
|
13
13
|
, style: { display: 'none' }, ...attribute }));
|
|
14
14
|
};
|
|
15
15
|
exports.default = FormErrorNonFieldMarker;
|
|
16
16
|
// utils
|
|
17
|
-
|
|
17
|
+
/**
|
|
18
|
+
* HTML data attribute for {@link FormErrorNonFieldMarker}.
|
|
19
|
+
*/
|
|
20
|
+
exports.FormErrorNonFieldMarkerHtmlAttribute = 'data-paragrav-rhf-utils-marker-path';
|
|
@@ -14,7 +14,7 @@ const getOrphanFieldErrorsWithMarkerCheck = (errors, formElement) => {
|
|
|
14
14
|
const orphanErrors = (0, exports.getOrphanFieldErrors)(errors);
|
|
15
15
|
return (0, utils_2.getFieldErrorsByFilter)(orphanErrors,
|
|
16
16
|
// if doesn't have alert, then it's an orphan
|
|
17
|
-
(path) => !formElement.querySelector(`[role="alert"][${FormErrorNonFieldMarker_1.
|
|
17
|
+
(path) => !formElement.querySelector(`[role="alert"][${FormErrorNonFieldMarker_1.FormErrorNonFieldMarkerHtmlAttribute}="${path}"]`));
|
|
18
18
|
};
|
|
19
19
|
exports.getOrphanFieldErrorsWithMarkerCheck = getOrphanFieldErrorsWithMarkerCheck;
|
|
20
20
|
//
|
package/dist/cjs/main.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export { default as FormErrorNonFieldMarker, FormErrorNonFieldMarkerDataHtmlAttribute, } from './
|
|
2
|
-
export { default as useFormErrorOrphansToConsoleError } from './
|
|
3
|
-
export { default as useFormOrphanErrors } from './
|
|
4
|
-
export { default as useFormRootFieldErrors } from './
|
|
5
|
-
export { default as useFormErrorsEffect } from './
|
|
6
|
-
export { default as useFormErrorsOnChange } from './
|
|
7
|
-
export { default as useFormRequestSubmit } from './
|
|
1
|
+
export { default as FormErrorNonFieldMarker, FormErrorNonFieldMarkerHtmlAttribute as FormErrorNonFieldMarkerDataHtmlAttribute, } from './errors/orphans/FormErrorNonFieldMarker';
|
|
2
|
+
export { default as useFormErrorOrphansToConsoleError } from './errors/orphans/useFormErrorOrphansToConsoleError';
|
|
3
|
+
export { default as useFormOrphanErrors } from './errors/orphans/useFormOrphanErrors';
|
|
4
|
+
export { default as useFormRootFieldErrors } from './errors/roots/useFormRootFieldErrors';
|
|
5
|
+
export { default as useFormErrorsEffect } from './errors/useFormErrorsEffect';
|
|
6
|
+
export { default as useFormErrorsOnChange } from './errors/useFormErrorsOnChange';
|
|
7
|
+
export { default as useFormRequestSubmit } from './errors/useFormRequestSubmit';
|
package/dist/cjs/main.js
CHANGED
|
@@ -4,18 +4,18 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.useFormRequestSubmit = exports.useFormErrorsOnChange = exports.useFormErrorsEffect = exports.useFormRootFieldErrors = exports.useFormOrphanErrors = exports.useFormErrorOrphansToConsoleError = exports.FormErrorNonFieldMarkerDataHtmlAttribute = exports.FormErrorNonFieldMarker = void 0;
|
|
7
|
-
var FormErrorNonFieldMarker_1 = require("./
|
|
7
|
+
var FormErrorNonFieldMarker_1 = require("./errors/orphans/FormErrorNonFieldMarker");
|
|
8
8
|
Object.defineProperty(exports, "FormErrorNonFieldMarker", { enumerable: true, get: function () { return __importDefault(FormErrorNonFieldMarker_1).default; } });
|
|
9
|
-
Object.defineProperty(exports, "FormErrorNonFieldMarkerDataHtmlAttribute", { enumerable: true, get: function () { return FormErrorNonFieldMarker_1.
|
|
10
|
-
var useFormErrorOrphansToConsoleError_1 = require("./
|
|
9
|
+
Object.defineProperty(exports, "FormErrorNonFieldMarkerDataHtmlAttribute", { enumerable: true, get: function () { return FormErrorNonFieldMarker_1.FormErrorNonFieldMarkerHtmlAttribute; } });
|
|
10
|
+
var useFormErrorOrphansToConsoleError_1 = require("./errors/orphans/useFormErrorOrphansToConsoleError");
|
|
11
11
|
Object.defineProperty(exports, "useFormErrorOrphansToConsoleError", { enumerable: true, get: function () { return __importDefault(useFormErrorOrphansToConsoleError_1).default; } });
|
|
12
|
-
var useFormOrphanErrors_1 = require("./
|
|
12
|
+
var useFormOrphanErrors_1 = require("./errors/orphans/useFormOrphanErrors");
|
|
13
13
|
Object.defineProperty(exports, "useFormOrphanErrors", { enumerable: true, get: function () { return __importDefault(useFormOrphanErrors_1).default; } });
|
|
14
|
-
var useFormRootFieldErrors_1 = require("./
|
|
14
|
+
var useFormRootFieldErrors_1 = require("./errors/roots/useFormRootFieldErrors");
|
|
15
15
|
Object.defineProperty(exports, "useFormRootFieldErrors", { enumerable: true, get: function () { return __importDefault(useFormRootFieldErrors_1).default; } });
|
|
16
|
-
var useFormErrorsEffect_1 = require("./
|
|
16
|
+
var useFormErrorsEffect_1 = require("./errors/useFormErrorsEffect");
|
|
17
17
|
Object.defineProperty(exports, "useFormErrorsEffect", { enumerable: true, get: function () { return __importDefault(useFormErrorsEffect_1).default; } });
|
|
18
|
-
var useFormErrorsOnChange_1 = require("./
|
|
18
|
+
var useFormErrorsOnChange_1 = require("./errors/useFormErrorsOnChange");
|
|
19
19
|
Object.defineProperty(exports, "useFormErrorsOnChange", { enumerable: true, get: function () { return __importDefault(useFormErrorsOnChange_1).default; } });
|
|
20
|
-
var useFormRequestSubmit_1 = require("./
|
|
20
|
+
var useFormRequestSubmit_1 = require("./errors/useFormRequestSubmit");
|
|
21
21
|
Object.defineProperty(exports, "useFormRequestSubmit", { enumerable: true, get: function () { return __importDefault(useFormRequestSubmit_1).default; } });
|
|
@@ -12,8 +12,8 @@ const o = ({ path: r }) => {
|
|
|
12
12
|
...t
|
|
13
13
|
}
|
|
14
14
|
);
|
|
15
|
-
},
|
|
15
|
+
}, n = o, a = "data-paragrav-rhf-utils-marker-path";
|
|
16
16
|
export {
|
|
17
|
-
a as
|
|
18
|
-
|
|
17
|
+
a as FormErrorNonFieldMarkerHtmlAttribute,
|
|
18
|
+
n as default
|
|
19
19
|
};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { isFormErrorPathRoot as l } from "../roots/utils.mjs";
|
|
2
|
-
import { getFieldErrorsByFilter as
|
|
3
|
-
import {
|
|
4
|
-
const n = (o) =>
|
|
2
|
+
import { getFieldErrorsByFilter as t } from "../utils.mjs";
|
|
3
|
+
import { FormErrorNonFieldMarkerHtmlAttribute as m } from "./FormErrorNonFieldMarker.mjs";
|
|
4
|
+
const n = (o) => t(o, (r, e) => e[r + ".ref"] === void 0 && // no ref
|
|
5
5
|
!l(r)), p = (o, r) => {
|
|
6
|
-
const
|
|
7
|
-
return
|
|
8
|
-
|
|
6
|
+
const e = n(o);
|
|
7
|
+
return t(
|
|
8
|
+
e,
|
|
9
9
|
// if doesn't have alert, then it's an orphan
|
|
10
10
|
(i) => !r.querySelector(
|
|
11
11
|
`[role="alert"][${m}="${i}"]`
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { flatten as f } from "
|
|
1
|
+
import { flatten as f } from "../node_modules/flat/index.mjs";
|
|
2
2
|
import { get as d } from "react-hook-form";
|
|
3
3
|
const p = (e, t) => i(e, t).reduce((r, s) => (r[s] = d(e, s), r), {}), F = (e, t) => i(e, t).map((r) => d(e, r)), i = (e, t) => {
|
|
4
4
|
const o = f(e);
|
package/dist/esm/main.mjs
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { default as e,
|
|
2
|
-
import { default as s } from "./
|
|
3
|
-
import { default as
|
|
4
|
-
import { default as l } from "./
|
|
5
|
-
import { default as d } from "./
|
|
6
|
-
import { default as
|
|
7
|
-
import { default as
|
|
1
|
+
import { default as e, FormErrorNonFieldMarkerHtmlAttribute as t } from "./errors/orphans/FormErrorNonFieldMarker.mjs";
|
|
2
|
+
import { default as s } from "./errors/orphans/useFormErrorOrphansToConsoleError.mjs";
|
|
3
|
+
import { default as u } from "./errors/orphans/useFormOrphanErrors.mjs";
|
|
4
|
+
import { default as l } from "./errors/roots/useFormRootFieldErrors.mjs";
|
|
5
|
+
import { default as d } from "./errors/useFormErrorsEffect.mjs";
|
|
6
|
+
import { default as p } from "./errors/useFormErrorsOnChange.mjs";
|
|
7
|
+
import { default as i } from "./errors/useFormRequestSubmit.mjs";
|
|
8
8
|
export {
|
|
9
9
|
e as FormErrorNonFieldMarker,
|
|
10
10
|
t as FormErrorNonFieldMarkerDataHtmlAttribute,
|
|
11
11
|
s as useFormErrorOrphansToConsoleError,
|
|
12
12
|
d as useFormErrorsEffect,
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
p as useFormErrorsOnChange,
|
|
14
|
+
u as useFormOrphanErrors,
|
|
15
|
+
i as useFormRequestSubmit,
|
|
16
16
|
l as useFormRootFieldErrors
|
|
17
17
|
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
type Props = {
|
|
3
|
+
/** Flat field name. (e.g., `address.street`) */
|
|
4
|
+
path: string;
|
|
5
|
+
};
|
|
6
|
+
/**
|
|
7
|
+
* Empty, hidden marker to indicate a non-field error is presented to user.
|
|
8
|
+
*/
|
|
9
|
+
declare const FormErrorNonFieldMarker: React.FC<Props>;
|
|
10
|
+
export default FormErrorNonFieldMarker;
|
|
11
|
+
/**
|
|
12
|
+
* HTML data attribute for {@link FormErrorNonFieldMarker}.
|
|
13
|
+
*/
|
|
14
|
+
export declare const FormErrorNonFieldMarkerHtmlAttribute = "data-paragrav-rhf-utils-marker-path";
|
package/dist/types/main.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export { default as FormErrorNonFieldMarker, FormErrorNonFieldMarkerDataHtmlAttribute, } from './
|
|
2
|
-
export { default as useFormErrorOrphansToConsoleError } from './
|
|
3
|
-
export { default as useFormOrphanErrors } from './
|
|
4
|
-
export { default as useFormRootFieldErrors } from './
|
|
5
|
-
export { default as useFormErrorsEffect } from './
|
|
6
|
-
export { default as useFormErrorsOnChange } from './
|
|
7
|
-
export { default as useFormRequestSubmit } from './
|
|
1
|
+
export { default as FormErrorNonFieldMarker, FormErrorNonFieldMarkerHtmlAttribute as FormErrorNonFieldMarkerDataHtmlAttribute, } from './errors/orphans/FormErrorNonFieldMarker';
|
|
2
|
+
export { default as useFormErrorOrphansToConsoleError } from './errors/orphans/useFormErrorOrphansToConsoleError';
|
|
3
|
+
export { default as useFormOrphanErrors } from './errors/orphans/useFormOrphanErrors';
|
|
4
|
+
export { default as useFormRootFieldErrors } from './errors/roots/useFormRootFieldErrors';
|
|
5
|
+
export { default as useFormErrorsEffect } from './errors/useFormErrorsEffect';
|
|
6
|
+
export { default as useFormErrorsOnChange } from './errors/useFormErrorsOnChange';
|
|
7
|
+
export { default as useFormRequestSubmit } from './errors/useFormRequestSubmit';
|
package/package.json
CHANGED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
type Props = {
|
|
3
|
-
/** Flat field name. (e.g., `address.street`) */
|
|
4
|
-
path: string;
|
|
5
|
-
};
|
|
6
|
-
/**
|
|
7
|
-
* Empty marker to indicate a non-field error is presented to user.
|
|
8
|
-
*/
|
|
9
|
-
declare const FormErrorNonFieldMarker: React.FC<Props>;
|
|
10
|
-
export default FormErrorNonFieldMarker;
|
|
11
|
-
export declare const FormErrorNonFieldMarkerDataHtmlAttribute = "data-grnwld-rhf-utils-marker-path";
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
type Props = {
|
|
3
|
-
/** Flat field name. (e.g., `address.street`) */
|
|
4
|
-
path: string;
|
|
5
|
-
};
|
|
6
|
-
/**
|
|
7
|
-
* Empty marker to indicate a non-field error is presented to user.
|
|
8
|
-
*/
|
|
9
|
-
declare const FormErrorNonFieldMarker: React.FC<Props>;
|
|
10
|
-
export default FormErrorNonFieldMarker;
|
|
11
|
-
export declare const FormErrorNonFieldMarkerDataHtmlAttribute = "data-grnwld-rhf-utils-marker-path";
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|