@paragrav/rhf-utils 0.0.89 → 0.0.90
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/esm/errors/nonfield/FormNonFieldErrorMarker.utils.mjs +21 -4
- package/dist/esm/errors/nonfield/isNonFieldErrorMarkerInDOM.mjs +5 -0
- package/dist/esm/errors/orphan/isOrphanFormError.mjs +2 -2
- package/dist/types/errors/nonfield/FormNonFieldErrorMarker.utils.d.ts +16 -2
- package/dist/types/errors/nonfield/isNonFieldErrorMarkerInDOM.d.ts +5 -0
- package/package.json +1 -1
|
@@ -1,6 +1,23 @@
|
|
|
1
|
-
import
|
|
2
|
-
const
|
|
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}"]`;
|
|
3
21
|
export {
|
|
4
|
-
|
|
5
|
-
i as isNonFieldErrorMarkerInDOM
|
|
22
|
+
m as getFormNonFieldErrorMarkerQuerySelector
|
|
6
23
|
};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import m from "../isFieldErrorRefd.mjs";
|
|
2
|
-
import { isNonFieldErrorMarkerInDOM as t } from "../nonfield/
|
|
2
|
+
import { isNonFieldErrorMarkerInDOM as t } from "../nonfield/isNonFieldErrorMarkerInDOM.mjs";
|
|
3
3
|
import e from "../root/isFormErrorPathRoot.mjs";
|
|
4
4
|
const d = (r, o, i) => (
|
|
5
5
|
// not root path
|
|
6
6
|
!e(r) && // non-field
|
|
7
|
-
!m(o) && //
|
|
7
|
+
!m(o) && // not marked in DOM
|
|
8
8
|
!t(r, i)
|
|
9
9
|
);
|
|
10
10
|
export {
|
|
@@ -1,2 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Returns query selector for matching non-field error marker.
|
|
3
|
+
* By default includes nested field matching. (See `options.excludeNested`.)
|
|
4
|
+
*
|
|
5
|
+
* @returns One or more selectors in a comma-separated list.
|
|
6
|
+
*/
|
|
7
|
+
export declare const getFormNonFieldErrorMarkerQuerySelector: (path: string, options?: {
|
|
8
|
+
/**
|
|
9
|
+
* Do not look for match as nested field.
|
|
10
|
+
*
|
|
11
|
+
* By default this is enabled to facilitate looking for fields that may be nested inside objects.
|
|
12
|
+
* For example, field arrays require objects as items, so actual field may be `field.value`.
|
|
13
|
+
* This should be safe, as fields are by definition leaf nodes, so will not have nested fields.
|
|
14
|
+
*/
|
|
15
|
+
excludeNested?: boolean;
|
|
16
|
+
}) => string;
|