@bombillazo/rhf-plus 7.62.0-plus.1 → 7.62.0-plus.2
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 +3 -1
- package/dist/index.cjs.js +1 -1
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.mjs +32 -4
- 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/getValidateError.d.ts.map +1 -1
- package/dist/logic/getValueAndMessage.d.ts +1 -1
- package/dist/logic/hasValidation.d.ts +1 -1
- package/dist/logic/validateField.d.ts.map +1 -1
- package/dist/react-server.esm.mjs +22 -2
- package/dist/react-server.esm.mjs.map +1 -1
- package/dist/types/controller.d.ts +3 -1
- package/dist/types/controller.d.ts.map +1 -1
- package/dist/types/errors.d.ts +2 -1
- package/dist/types/errors.d.ts.map +1 -1
- package/dist/useController.d.ts.map +1 -1
- package/dist/utils/isMessage.d.ts.map +1 -1
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getValidateError.d.ts","sourceRoot":"","sources":["../../src/logic/getValidateError.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,
|
|
1
|
+
{"version":3,"file":"getValidateError.d.ts","sourceRoot":"","sources":["../../src/logic/getValidateError.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAW,GAAG,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAIzE,MAAM,CAAC,OAAO,UAAU,gBAAgB,CACtC,MAAM,EAAE,cAAc,EACtB,GAAG,EAAE,GAAG,EACR,IAAI,SAAa,GAChB,UAAU,GAAG,IAAI,CAYnB"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ValidationRule } from '../types';
|
|
2
|
-
declare const _default: (validationData?: ValidationRule) => {
|
|
2
|
+
declare const _default: (validationData?: ValidationRule) => import("../types").ValidationValueMessage<import("../types").ValidationValue> | {
|
|
3
3
|
value: string | number | boolean | RegExp | undefined;
|
|
4
4
|
message: string;
|
|
5
5
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { Field } from '../types';
|
|
2
|
-
declare const _default: (options: Field["_f"]) => string | number | boolean | import("../types").ValidationValueMessage<boolean> | import("../types").ValidationValueMessage<string | number> | import("../types").ValidationRule<RegExp> | import("../types").Validate<any, import("../types").FieldValues> | Record<string, import("../types").Validate<any, import("../types").FieldValues>> | undefined;
|
|
2
|
+
declare const _default: (options: Field["_f"]) => string | number | boolean | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | import("../types").ValidationValueMessage<boolean> | import("../types").ValidationValueMessage<string | number> | import("../types").ValidationRule<RegExp> | import("../types").Validate<any, import("../types").FieldValues> | Record<string, import("../types").Validate<any, import("../types").FieldValues>> | undefined;
|
|
3
3
|
export default _default;
|
|
4
4
|
//# sourceMappingURL=hasValidation.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validateField.d.ts","sourceRoot":"","sources":["../../src/logic/validateField.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,KAAK,EAEL,WAAW,EACX,mBAAmB,EACnB,eAAe,EAKhB,MAAM,UAAU,CAAC;yBAsBI,CAAC,SAAS,WAAW,EACzC,OAAO,KAAK,EACZ,oBAAoB,eAAe,EACnC,YAAY,CAAC,EACb,0BAA0B,OAAO,EACjC,4BAA4B,OAAO,EACnC,eAAe,OAAO,KACrB,OAAO,CAAC,mBAAmB,CAAC;AAP/B,
|
|
1
|
+
{"version":3,"file":"validateField.d.ts","sourceRoot":"","sources":["../../src/logic/validateField.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,KAAK,EAEL,WAAW,EACX,mBAAmB,EACnB,eAAe,EAKhB,MAAM,UAAU,CAAC;yBAsBI,CAAC,SAAS,WAAW,EACzC,OAAO,KAAK,EACZ,oBAAoB,eAAe,EACnC,YAAY,CAAC,EACb,0BAA0B,OAAO,EACjC,4BAA4B,OAAO,EACnC,eAAe,OAAO,KACrB,OAAO,CAAC,mBAAmB,CAAC;AAP/B,wBAoQE"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import crypto from 'crypto';
|
|
2
|
+
import React from 'react';
|
|
2
3
|
|
|
3
4
|
var appendErrors = (name, validateAllFieldCriteria, errors, type, message) => validateAllFieldCriteria
|
|
4
5
|
? {
|
|
@@ -601,7 +602,17 @@ var updateFieldArrayRootError = (errors, error, name) => {
|
|
|
601
602
|
return errors;
|
|
602
603
|
};
|
|
603
604
|
|
|
604
|
-
var isMessage = (value) =>
|
|
605
|
+
var isMessage = (value) => {
|
|
606
|
+
// Support strings (existing functionality)
|
|
607
|
+
if (isString(value)) {
|
|
608
|
+
return true;
|
|
609
|
+
}
|
|
610
|
+
// Support React elements only (not primitives like null, undefined, numbers)
|
|
611
|
+
if (React.isValidElement(value)) {
|
|
612
|
+
return true;
|
|
613
|
+
}
|
|
614
|
+
return false;
|
|
615
|
+
};
|
|
605
616
|
|
|
606
617
|
function getValidateError(result, ref, type = 'validate') {
|
|
607
618
|
if (isMessage(result) ||
|
|
@@ -631,7 +642,16 @@ var validateField = async (field, disabledFieldNames, formValues, validateAllFie
|
|
|
631
642
|
const inputRef = refs ? refs[0] : ref;
|
|
632
643
|
const setCustomValidity = (message) => {
|
|
633
644
|
if (shouldUseNativeValidation && inputRef.reportValidity) {
|
|
634
|
-
|
|
645
|
+
if (isBoolean(message)) {
|
|
646
|
+
inputRef.setCustomValidity('');
|
|
647
|
+
}
|
|
648
|
+
else if (typeof message === 'string') {
|
|
649
|
+
inputRef.setCustomValidity(message || '');
|
|
650
|
+
}
|
|
651
|
+
else {
|
|
652
|
+
// For ReactNode messages, convert to string or use empty string for native validation
|
|
653
|
+
inputRef.setCustomValidity('');
|
|
654
|
+
}
|
|
635
655
|
inputRef.reportValidity();
|
|
636
656
|
}
|
|
637
657
|
};
|