@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.
@@ -1,5 +1,5 @@
1
1
  import type { ValidationRule } from '../types';
2
- declare const _default: (validationData?: ValidationRule) => import("../types").ValidationValueMessage<import("../types").ValidationValue> | {
2
+ declare const _default: (validationData?: ValidationRule) => {
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("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;
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;
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,mBAAmB,eAAe,EAClC,YAAY,CAAC,EACb,0BAA0B,OAAO,EACjC,4BAA4B,OAAO,EACnC,eAAe,OAAO,KACrB,OAAO,CAAC,mBAAmB,CAAC;AAP/B,wBAqQE"}
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;yBAqBI,CAAC,SAAS,WAAW,EACzC,OAAO,KAAK,EACZ,mBAAmB,eAAe,EAClC,YAAY,CAAC,EACb,0BAA0B,OAAO,EACjC,4BAA4B,OAAO,EACnC,eAAe,OAAO,KACrB,OAAO,CAAC,mBAAmB,CAAC;AAP/B,wBA6PE"}
@@ -1,5 +1,4 @@
1
1
  import crypto from 'crypto';
2
- import React from 'react';
3
2
 
4
3
  var appendErrors = (name, validateAllFieldCriteria, errors, type, message) => validateAllFieldCriteria
5
4
  ? {
@@ -642,25 +641,13 @@ var updateFieldArrayRootError = (errors, error, name) => {
642
641
  return errors;
643
642
  };
644
643
 
645
- var isMessage = (value) => {
646
- // Support strings (existing functionality)
647
- if (isString(value)) {
648
- return true;
649
- }
650
- // Support React elements only (not primitives like null, undefined, numbers)
651
- if (React.isValidElement(value)) {
652
- return true;
653
- }
654
- return false;
655
- };
656
-
657
644
  function getValidateError(result, ref, type = 'validate') {
658
- if (isMessage(result) ||
659
- (Array.isArray(result) && result.every(isMessage)) ||
645
+ if (isString(result) ||
646
+ (Array.isArray(result) && result.every(isString)) ||
660
647
  (isBoolean(result) && !result)) {
661
648
  return {
662
649
  type,
663
- message: isMessage(result) ? result : '',
650
+ message: isString(result) ? result : '',
664
651
  ref,
665
652
  };
666
653
  }
@@ -682,16 +669,7 @@ var validateField = async (field, skippedFieldNames, formValues, validateAllFiel
682
669
  const inputRef = refs ? refs[0] : ref;
683
670
  const setCustomValidity = (message) => {
684
671
  if (shouldUseNativeValidation && inputRef.reportValidity) {
685
- if (isBoolean(message)) {
686
- inputRef.setCustomValidity('');
687
- }
688
- else if (typeof message === 'string') {
689
- inputRef.setCustomValidity(message || '');
690
- }
691
- else {
692
- // For ReactNode messages, convert to string or use empty string for native validation
693
- inputRef.setCustomValidity('');
694
- }
672
+ inputRef.setCustomValidity(isBoolean(message) ? '' : message || '');
695
673
  inputRef.reportValidity();
696
674
  }
697
675
  };
@@ -722,7 +700,7 @@ var validateField = async (field, skippedFieldNames, formValues, validateAllFiel
722
700
  (isBoolean(inputValue) && !inputValue) ||
723
701
  (isCheckBox && !getCheckboxValue(refs).isValid) ||
724
702
  (isRadio && !getRadioValue(refs).isValid))) {
725
- const { value, message } = isMessage(required)
703
+ const { value, message } = isString(required)
726
704
  ? { value: !!required, message: required }
727
705
  : getValueAndMessage(required);
728
706
  if (value) {