@thecb/components 6.1.3 → 6.1.4-beta.1

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
@@ -34730,6 +34730,24 @@ const ONLY_NATURALS_ERROR = "error/ONLY_NATURALS";
34730
34730
  const onlyNaturals = createValidator(ONLY_NATURALS, ONLY_NATURALS_ERROR);
34731
34731
  validatorFns[ONLY_NATURALS] = (value, args, form) => /^(\d+)?$/.test(value);
34732
34732
 
34733
+ /*
34734
+ 07/22: experimental expiration date constraint
34735
+ should allow entry of expiration date using "/" character
34736
+ to accommodate browser autofill
34737
+
34738
+ not tested as validation function
34739
+ to validate exp date instead use combo of:
34740
+ required(), hasLength(), isValidMonth(), dateAfterToday()
34741
+ */
34742
+ const ONLY_EXPIRATION_DATE = "validator/ONLY_EXPIRATION_DATE";
34743
+ const ONLY_EXPIRATION_DATE_ERROR = "error/ONLY_EXPIRATION_DATE";
34744
+ const onlyExpirationDate = createValidator(
34745
+ ONLY_EXPIRATION_DATE,
34746
+ ONLY_EXPIRATION_DATE_ERROR
34747
+ );
34748
+ validatorFns[ONLY_EXPIRATION_DATE] = (value, args, form) =>
34749
+ /^(\d?\d?\/?\d?\d?)?$/.test(value);
34750
+
34733
34751
  const NUMBER_LESS_THAN = "validator/NUMBER_LESS_THAN";
34734
34752
  const NUMBER_LESS_THAN_ERROR = "error/NUMBER_LESS_THAN";
34735
34753
  const numberLessThan = createValidator(
@@ -42299,7 +42317,7 @@ var formConfig$8 = {
42299
42317
  },
42300
42318
  expirationDate: {
42301
42319
  validators: [required(), hasLength(4, 4), isValidMonth(0), dateAfterToday("MMYY", "month", true)],
42302
- constraints: [onlyIntegers(), hasLength(0, 4)]
42320
+ constraints: [onlyExpirationDate(), hasLength(0, 4)]
42303
42321
  },
42304
42322
  cvv: {
42305
42323
  validators: [required(), hasLength(3, 4)],