@thecb/components 10.3.2-beta.1 → 10.3.2-beta.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 CHANGED
@@ -39774,6 +39774,12 @@ validatorFns[IS_PROBABLY_EMAIL] = (value, args, form) => {
39774
39774
  return new RegExp(/^\S+@\S+\.\S+$/).test(value);
39775
39775
  };
39776
39776
 
39777
+ const VALID_NAME = 'validator/VALID_NAME';
39778
+ const VALID_NAME_ERROR = 'validator/VALID_NAME_ERROR';
39779
+ const validName = createValidator(VALID_NAME, VALID_NAME_ERROR);
39780
+ validatorFns[VALID_NAME] = (value, args, form) =>
39781
+ value === '' ? false : new RegExp(/[A-Za-z]+(\s?[A-Za-z\-,'])*/i).test(value);
39782
+
39777
39783
  const runValidatorErrorMessage = (type) =>
39778
39784
  `${type} was passed to runValidator, but that validator type does not exist.
39779
39785
  Please check that you are only calling validator creator functions exported from
@@ -49320,8 +49326,8 @@ var RegistrationForm = function RegistrationForm(_ref) {
49320
49326
  };
49321
49327
  }, []);
49322
49328
  }
49323
- var firstNameErrorMessages = _defineProperty(_defineProperty({}, required.error, "First name is required"), matchesRegex.error, "First name contains invalid characters");
49324
- var lastNameErrorMessages = _defineProperty(_defineProperty({}, required.error, "Last name is required"), matchesRegex.error, "Last name contains invalid characters");
49329
+ var firstNameErrorMessages = _defineProperty(_defineProperty({}, required.error, "First name is required"), validName.error, "First name contains invalid characters");
49330
+ var lastNameErrorMessages = _defineProperty(_defineProperty({}, required.error, "Last name is required"), validName.error, "Last name contains invalid characters");
49325
49331
  var emailErrorMessages = _defineProperty(_defineProperty({}, required.error, "Email is required"), isProbablyEmail.error, "Invalid email address");
49326
49332
  var passwordErrorMessages = _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, required.error, "Password is required"), hasLength.error, "Password must have at least 8 characters"), hasNumber.error, "Password must contain at least one number"), hasLowercaseLetter.error, "Password must contain at least one lowercase letter"), hasUppercaseLetter.error, "Password must contain at least one uppercase letter"), hasSpecialCharacter.error, "Password must contain at least one special character (!@#$%^&*.?)");
49327
49333
  var confirmPasswordErrorMessages = _defineProperty({}, matchesField.error, "Confirm password must match password");
@@ -49397,10 +49403,10 @@ var RegistrationForm = function RegistrationForm(_ref) {
49397
49403
 
49398
49404
  var formConfig$9 = {
49399
49405
  firstName: {
49400
- validators: [required(), matchesRegex(/[A-Za-z]+(\s?[A-Za-z\-,'])*/i)]
49406
+ validators: [required(), validName()]
49401
49407
  },
49402
49408
  lastName: {
49403
- validators: [required(), matchesRegex(/[A-Za-z]+(\s?[A-Za-z\-,'])*/i)]
49409
+ validators: [required(), validName()]
49404
49410
  },
49405
49411
  email: {
49406
49412
  validators: [required(), isProbablyEmail()]