@thecb/components 6.1.4-beta.4 → 6.1.4-beta.5
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 +14 -4
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +14 -4
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/atoms/form-layouts/FormInput.js +9 -3
- package/src/components/molecules/payment-form-card/PaymentFormCard.js +1 -0
- package/src/components/molecules/payment-form-card/PaymentFormCard.state.js +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -22637,6 +22637,14 @@ var FormInput = function FormInput(_ref15) {
|
|
|
22637
22637
|
var _useContext = useContext(ThemeContext),
|
|
22638
22638
|
isMobile = _useContext.isMobile;
|
|
22639
22639
|
|
|
22640
|
+
var setValue = function setValue(value) {
|
|
22641
|
+
if (removeFromValue !== undefined) {
|
|
22642
|
+
return fieldActions.set(value.replace(removeFromValue, ""));
|
|
22643
|
+
}
|
|
22644
|
+
|
|
22645
|
+
return fieldActions.set(value);
|
|
22646
|
+
};
|
|
22647
|
+
|
|
22640
22648
|
return /*#__PURE__*/React.createElement(Stack, {
|
|
22641
22649
|
childGap: "0.25rem"
|
|
22642
22650
|
}, /*#__PURE__*/React.createElement(Box, {
|
|
@@ -22690,8 +22698,8 @@ var FormInput = function FormInput(_ref15) {
|
|
|
22690
22698
|
"aria-labelledby": createIdFromString(labelTextWhenNoError),
|
|
22691
22699
|
"aria-describedby": createIdFromString(labelTextWhenNoError, "error message"),
|
|
22692
22700
|
"aria-invalid": field.dirty && field.hasErrors || field.hasErrors && showErrors,
|
|
22693
|
-
onChange: function onChange(
|
|
22694
|
-
return
|
|
22701
|
+
onChange: function onChange(value) {
|
|
22702
|
+
return setValue(value);
|
|
22695
22703
|
},
|
|
22696
22704
|
type: type,
|
|
22697
22705
|
value: field.rawValue,
|
|
@@ -22710,7 +22718,7 @@ var FormInput = function FormInput(_ref15) {
|
|
|
22710
22718
|
"aria-describedby": createIdFromString(labelTextWhenNoError, "error message"),
|
|
22711
22719
|
"aria-invalid": field.dirty && field.hasErrors || field.hasErrors && showErrors,
|
|
22712
22720
|
onChange: function onChange(e) {
|
|
22713
|
-
return
|
|
22721
|
+
return setValue(e.target.value);
|
|
22714
22722
|
},
|
|
22715
22723
|
type: type === "password" && showPassword ? "text" : type,
|
|
22716
22724
|
value: field.rawValue,
|
|
@@ -42272,6 +42280,8 @@ var PaymentFormCard = function PaymentFormCard(_ref) {
|
|
|
42272
42280
|
return e.key === "Enter" && handleSubmit(e);
|
|
42273
42281
|
},
|
|
42274
42282
|
isNum: true,
|
|
42283
|
+
removeFromValue: /\// // removes "/" from browser autofill
|
|
42284
|
+
,
|
|
42275
42285
|
autocomplete: "cc-exp"
|
|
42276
42286
|
}), /*#__PURE__*/React.createElement(FormInput$1, {
|
|
42277
42287
|
labelTextWhenNoError: "CVV",
|
|
@@ -42324,7 +42334,7 @@ var formConfig$8 = {
|
|
|
42324
42334
|
},
|
|
42325
42335
|
expirationDate: {
|
|
42326
42336
|
validators: [required(), hasLength(4, 4), isValidMonth(0), dateAfterToday("MMYY", "month", true)],
|
|
42327
|
-
constraints: [onlyExpirationDate(), hasLength(0,
|
|
42337
|
+
constraints: [onlyExpirationDate(), hasLength(0, 4)]
|
|
42328
42338
|
},
|
|
42329
42339
|
cvv: {
|
|
42330
42340
|
validators: [required(), hasLength(3, 4)],
|