@bombillazo/rhf-plus 7.64.0-plus.1 → 7.64.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/dist/index.cjs.js +1 -1
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.mjs +5 -26
- 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/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 +5 -27
- package/dist/react-server.esm.mjs.map +1 -1
- package/dist/types/errors.d.ts +1 -2
- package/dist/types/errors.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/utils/isMessage.d.ts +0 -4
- package/dist/utils/isMessage.d.ts.map +0 -1
package/dist/index.esm.mjs
CHANGED
|
@@ -1258,25 +1258,13 @@ var updateFieldArrayRootError = (errors, error, name) => {
|
|
|
1258
1258
|
return errors;
|
|
1259
1259
|
};
|
|
1260
1260
|
|
|
1261
|
-
var isMessage = (value) => {
|
|
1262
|
-
// Support strings (existing functionality)
|
|
1263
|
-
if (isString(value)) {
|
|
1264
|
-
return true;
|
|
1265
|
-
}
|
|
1266
|
-
// Support React elements only (not primitives like null, undefined, numbers)
|
|
1267
|
-
if (React.isValidElement(value)) {
|
|
1268
|
-
return true;
|
|
1269
|
-
}
|
|
1270
|
-
return false;
|
|
1271
|
-
};
|
|
1272
|
-
|
|
1273
1261
|
function getValidateError(result, ref, type = 'validate') {
|
|
1274
|
-
if (
|
|
1275
|
-
(Array.isArray(result) && result.every(
|
|
1262
|
+
if (isString(result) ||
|
|
1263
|
+
(Array.isArray(result) && result.every(isString)) ||
|
|
1276
1264
|
(isBoolean(result) && !result)) {
|
|
1277
1265
|
return {
|
|
1278
1266
|
type,
|
|
1279
|
-
message:
|
|
1267
|
+
message: isString(result) ? result : '',
|
|
1280
1268
|
ref,
|
|
1281
1269
|
};
|
|
1282
1270
|
}
|
|
@@ -1298,16 +1286,7 @@ var validateField = async (field, skippedFieldNames, formValues, validateAllFiel
|
|
|
1298
1286
|
const inputRef = refs ? refs[0] : ref;
|
|
1299
1287
|
const setCustomValidity = (message) => {
|
|
1300
1288
|
if (shouldUseNativeValidation && inputRef.reportValidity) {
|
|
1301
|
-
|
|
1302
|
-
inputRef.setCustomValidity('');
|
|
1303
|
-
}
|
|
1304
|
-
else if (typeof message === 'string') {
|
|
1305
|
-
inputRef.setCustomValidity(message || '');
|
|
1306
|
-
}
|
|
1307
|
-
else {
|
|
1308
|
-
// For ReactNode messages, convert to string or use empty string for native validation
|
|
1309
|
-
inputRef.setCustomValidity('');
|
|
1310
|
-
}
|
|
1289
|
+
inputRef.setCustomValidity(isBoolean(message) ? '' : message || '');
|
|
1311
1290
|
inputRef.reportValidity();
|
|
1312
1291
|
}
|
|
1313
1292
|
};
|
|
@@ -1338,7 +1317,7 @@ var validateField = async (field, skippedFieldNames, formValues, validateAllFiel
|
|
|
1338
1317
|
(isBoolean(inputValue) && !inputValue) ||
|
|
1339
1318
|
(isCheckBox && !getCheckboxValue(refs).isValid) ||
|
|
1340
1319
|
(isRadio && !getRadioValue(refs).isValid))) {
|
|
1341
|
-
const { value, message } =
|
|
1320
|
+
const { value, message } = isString(required)
|
|
1342
1321
|
? { value: !!required, message: required }
|
|
1343
1322
|
: getValueAndMessage(required);
|
|
1344
1323
|
if (value) {
|