@bombillazo/rhf-plus 7.71.0-plus.0 → 7.71.2-plus.4
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/__tests__/utils/update.test.d.ts +2 -0
- package/dist/__tests__/utils/update.test.d.ts.map +1 -0
- package/dist/index.cjs.js +1 -1
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.mjs +18 -5
- package/dist/index.esm.mjs.map +1 -1
- package/dist/index.umd.js +1 -1
- package/dist/index.umd.js.map +1 -1
- package/dist/logic/createFormControl.d.ts.map +1 -1
- package/dist/react-server.esm.mjs +18 -5
- package/dist/react-server.esm.mjs.map +1 -1
- package/dist/types/form.d.ts +2 -2
- package/dist/types/form.d.ts.map +1 -1
- package/package.json +31 -29
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createFormControl.d.ts","sourceRoot":"","sources":["../../src/logic/createFormControl.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAaV,WAAW,EACX,YAAY,EAiBZ,YAAY,EAIZ,aAAa,EAUd,MAAM,UAAU,CAAC;AAyDlB,wBAAgB,iBAAiB,CAC/B,YAAY,SAAS,WAAW,GAAG,WAAW,EAC9C,QAAQ,GAAG,GAAG,EACd,kBAAkB,GAAG,YAAY,EACjC,SAAS,SAAS,YAAY,GAAG,GAAG,EAEpC,KAAK,GAAE,YAAY,CACjB,YAAY,EACZ,QAAQ,EACR,kBAAkB,EAClB,SAAS,CACL,GACL,IAAI,CACL,aAAa,CAAC,YAAY,EAAE,QAAQ,EAAE,kBAAkB,EAAE,SAAS,CAAC,EACpE,WAAW,CACZ,GAAG;IACF,WAAW,EAAE,IAAI,CACf,aAAa,CAAC,YAAY,EAAE,QAAQ,EAAE,kBAAkB,EAAE,SAAS,CAAC,EACpE,WAAW,CACZ,CAAC;CACH,
|
|
1
|
+
{"version":3,"file":"createFormControl.d.ts","sourceRoot":"","sources":["../../src/logic/createFormControl.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAaV,WAAW,EACX,YAAY,EAiBZ,YAAY,EAIZ,aAAa,EAUd,MAAM,UAAU,CAAC;AAyDlB,wBAAgB,iBAAiB,CAC/B,YAAY,SAAS,WAAW,GAAG,WAAW,EAC9C,QAAQ,GAAG,GAAG,EACd,kBAAkB,GAAG,YAAY,EACjC,SAAS,SAAS,YAAY,GAAG,GAAG,EAEpC,KAAK,GAAE,YAAY,CACjB,YAAY,EACZ,QAAQ,EACR,kBAAkB,EAClB,SAAS,CACL,GACL,IAAI,CACL,aAAa,CAAC,YAAY,EAAE,QAAQ,EAAE,kBAAkB,EAAE,SAAS,CAAC,EACpE,WAAW,CACZ,GAAG;IACF,WAAW,EAAE,IAAI,CACf,aAAa,CAAC,YAAY,EAAE,QAAQ,EAAE,kBAAkB,EAAE,SAAS,CAAC,EACpE,WAAW,CACZ,CAAC;CACH,CAo0DA"}
|
|
@@ -1574,11 +1574,24 @@ function createFormControl(props = {}) {
|
|
|
1574
1574
|
isFocused: (formState || _formState).focusedField === name,
|
|
1575
1575
|
});
|
|
1576
1576
|
const clearErrors = (name) => {
|
|
1577
|
-
name
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1577
|
+
const names = name ? convertToArrayPayload(name) : undefined;
|
|
1578
|
+
names === null || names === void 0 ? void 0 : names.forEach((inputName) => unset(_formState.errors, inputName));
|
|
1579
|
+
if (names) {
|
|
1580
|
+
// Emit for each cleared field with the field name so that
|
|
1581
|
+
// shouldSubscribeByName can filter and avoid broad re-renders
|
|
1582
|
+
names.forEach((inputName) => {
|
|
1583
|
+
_subjects.state.next({
|
|
1584
|
+
name: inputName,
|
|
1585
|
+
errors: _formState.errors,
|
|
1586
|
+
});
|
|
1587
|
+
});
|
|
1588
|
+
}
|
|
1589
|
+
else {
|
|
1590
|
+
// Clear all errors - emit without name to notify all subscribers
|
|
1591
|
+
_subjects.state.next({
|
|
1592
|
+
errors: {},
|
|
1593
|
+
});
|
|
1594
|
+
}
|
|
1582
1595
|
};
|
|
1583
1596
|
const setError = (name, error, options) => {
|
|
1584
1597
|
const ref = (get(_fields, name, { _f: {} })._f || {}).ref;
|