@thecb/components 6.1.4-beta.2 → 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 +22 -4
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +22 -4
- package/dist/index.esm.js.map +1 -1
- package/package.json +2 -2
- package/src/components/atoms/form-layouts/FormInput.js +9 -2
- package/src/components/molecules/payment-form-card/PaymentFormCard.js +1 -0
package/dist/index.esm.js
CHANGED
|
@@ -22542,7 +22542,7 @@ var fallbackValues$i = {
|
|
|
22542
22542
|
};
|
|
22543
22543
|
|
|
22544
22544
|
var _excluded$p = ["showErrors", "themeValues"],
|
|
22545
|
-
_excluded2 = ["type", "labelTextWhenNoError", "errorMessages", "isNum", "isEmail", "helperModal", "field", "fieldActions", "showErrors", "formatter", "decorator", "themeValues", "background", "customHeight", "autocomplete", "extraStyles"];
|
|
22545
|
+
_excluded2 = ["type", "labelTextWhenNoError", "errorMessages", "isNum", "isEmail", "helperModal", "field", "fieldActions", "showErrors", "formatter", "decorator", "themeValues", "background", "customHeight", "autocomplete", "extraStyles", "removeFromValue"];
|
|
22546
22546
|
var InputField = styled.input.withConfig({
|
|
22547
22547
|
displayName: "FormInput__InputField",
|
|
22548
22548
|
componentId: "sc-l094r1-0"
|
|
@@ -22626,6 +22626,7 @@ var FormInput = function FormInput(_ref15) {
|
|
|
22626
22626
|
customHeight = _ref15.customHeight,
|
|
22627
22627
|
autocomplete = _ref15.autocomplete,
|
|
22628
22628
|
extraStyles = _ref15.extraStyles,
|
|
22629
|
+
removeFromValue = _ref15.removeFromValue,
|
|
22629
22630
|
props = _objectWithoutProperties(_ref15, _excluded2);
|
|
22630
22631
|
|
|
22631
22632
|
var _useState = useState(false),
|
|
@@ -22636,6 +22637,14 @@ var FormInput = function FormInput(_ref15) {
|
|
|
22636
22637
|
var _useContext = useContext(ThemeContext),
|
|
22637
22638
|
isMobile = _useContext.isMobile;
|
|
22638
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
|
+
|
|
22639
22648
|
return /*#__PURE__*/React.createElement(Stack, {
|
|
22640
22649
|
childGap: "0.25rem"
|
|
22641
22650
|
}, /*#__PURE__*/React.createElement(Box, {
|
|
@@ -22689,8 +22698,8 @@ var FormInput = function FormInput(_ref15) {
|
|
|
22689
22698
|
"aria-labelledby": createIdFromString(labelTextWhenNoError),
|
|
22690
22699
|
"aria-describedby": createIdFromString(labelTextWhenNoError, "error message"),
|
|
22691
22700
|
"aria-invalid": field.dirty && field.hasErrors || field.hasErrors && showErrors,
|
|
22692
|
-
onChange: function onChange(
|
|
22693
|
-
return
|
|
22701
|
+
onChange: function onChange(value) {
|
|
22702
|
+
return setValue(value);
|
|
22694
22703
|
},
|
|
22695
22704
|
type: type,
|
|
22696
22705
|
value: field.rawValue,
|
|
@@ -22709,7 +22718,7 @@ var FormInput = function FormInput(_ref15) {
|
|
|
22709
22718
|
"aria-describedby": createIdFromString(labelTextWhenNoError, "error message"),
|
|
22710
22719
|
"aria-invalid": field.dirty && field.hasErrors || field.hasErrors && showErrors,
|
|
22711
22720
|
onChange: function onChange(e) {
|
|
22712
|
-
return
|
|
22721
|
+
return setValue(e.target.value);
|
|
22713
22722
|
},
|
|
22714
22723
|
type: type === "password" && showPassword ? "text" : type,
|
|
22715
22724
|
value: field.rawValue,
|
|
@@ -35128,6 +35137,13 @@ const runValidator = (validator, value, form) => {
|
|
|
35128
35137
|
if (validatorFn === undefined) {
|
|
35129
35138
|
throw new Error(runValidatorErrorMessage(validator.type));
|
|
35130
35139
|
}
|
|
35140
|
+
console.log(
|
|
35141
|
+
"run validator (validator, value, form):",
|
|
35142
|
+
validator.type,
|
|
35143
|
+
validator.args,
|
|
35144
|
+
value,
|
|
35145
|
+
form
|
|
35146
|
+
);
|
|
35131
35147
|
return validatorFn(value, validator.args, form) ? null : validator.error;
|
|
35132
35148
|
};
|
|
35133
35149
|
|
|
@@ -42264,6 +42280,8 @@ var PaymentFormCard = function PaymentFormCard(_ref) {
|
|
|
42264
42280
|
return e.key === "Enter" && handleSubmit(e);
|
|
42265
42281
|
},
|
|
42266
42282
|
isNum: true,
|
|
42283
|
+
removeFromValue: /\// // removes "/" from browser autofill
|
|
42284
|
+
,
|
|
42267
42285
|
autocomplete: "cc-exp"
|
|
42268
42286
|
}), /*#__PURE__*/React.createElement(FormInput$1, {
|
|
42269
42287
|
labelTextWhenNoError: "CVV",
|