@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.cjs.js
CHANGED
|
@@ -22645,6 +22645,14 @@ var FormInput = function FormInput(_ref15) {
|
|
|
22645
22645
|
var _useContext = React.useContext(styled.ThemeContext),
|
|
22646
22646
|
isMobile = _useContext.isMobile;
|
|
22647
22647
|
|
|
22648
|
+
var setValue = function setValue(value) {
|
|
22649
|
+
if (removeFromValue !== undefined) {
|
|
22650
|
+
return fieldActions.set(value.replace(removeFromValue, ""));
|
|
22651
|
+
}
|
|
22652
|
+
|
|
22653
|
+
return fieldActions.set(value);
|
|
22654
|
+
};
|
|
22655
|
+
|
|
22648
22656
|
return /*#__PURE__*/React__default.createElement(Stack, {
|
|
22649
22657
|
childGap: "0.25rem"
|
|
22650
22658
|
}, /*#__PURE__*/React__default.createElement(Box, {
|
|
@@ -22698,8 +22706,8 @@ var FormInput = function FormInput(_ref15) {
|
|
|
22698
22706
|
"aria-labelledby": createIdFromString(labelTextWhenNoError),
|
|
22699
22707
|
"aria-describedby": createIdFromString(labelTextWhenNoError, "error message"),
|
|
22700
22708
|
"aria-invalid": field.dirty && field.hasErrors || field.hasErrors && showErrors,
|
|
22701
|
-
onChange: function onChange(
|
|
22702
|
-
return
|
|
22709
|
+
onChange: function onChange(value) {
|
|
22710
|
+
return setValue(value);
|
|
22703
22711
|
},
|
|
22704
22712
|
type: type,
|
|
22705
22713
|
value: field.rawValue,
|
|
@@ -22718,7 +22726,7 @@ var FormInput = function FormInput(_ref15) {
|
|
|
22718
22726
|
"aria-describedby": createIdFromString(labelTextWhenNoError, "error message"),
|
|
22719
22727
|
"aria-invalid": field.dirty && field.hasErrors || field.hasErrors && showErrors,
|
|
22720
22728
|
onChange: function onChange(e) {
|
|
22721
|
-
return
|
|
22729
|
+
return setValue(e.target.value);
|
|
22722
22730
|
},
|
|
22723
22731
|
type: type === "password" && showPassword ? "text" : type,
|
|
22724
22732
|
value: field.rawValue,
|
|
@@ -42280,6 +42288,8 @@ var PaymentFormCard = function PaymentFormCard(_ref) {
|
|
|
42280
42288
|
return e.key === "Enter" && handleSubmit(e);
|
|
42281
42289
|
},
|
|
42282
42290
|
isNum: true,
|
|
42291
|
+
removeFromValue: /\// // removes "/" from browser autofill
|
|
42292
|
+
,
|
|
42283
42293
|
autocomplete: "cc-exp"
|
|
42284
42294
|
}), /*#__PURE__*/React__default.createElement(FormInput$1, {
|
|
42285
42295
|
labelTextWhenNoError: "CVV",
|
|
@@ -42332,7 +42342,7 @@ var formConfig$8 = {
|
|
|
42332
42342
|
},
|
|
42333
42343
|
expirationDate: {
|
|
42334
42344
|
validators: [required(), hasLength(4, 4), isValidMonth(0), dateAfterToday("MMYY", "month", true)],
|
|
42335
|
-
constraints: [onlyExpirationDate(), hasLength(0,
|
|
42345
|
+
constraints: [onlyExpirationDate(), hasLength(0, 4)]
|
|
42336
42346
|
},
|
|
42337
42347
|
cvv: {
|
|
42338
42348
|
validators: [required(), hasLength(3, 4)],
|