@thecb/components 6.1.4-beta.3 → 6.1.4-beta.6

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
@@ -22550,7 +22550,7 @@ var fallbackValues$i = {
22550
22550
  };
22551
22551
 
22552
22552
  var _excluded$p = ["showErrors", "themeValues"],
22553
- _excluded2 = ["type", "labelTextWhenNoError", "errorMessages", "isNum", "isEmail", "helperModal", "field", "fieldActions", "showErrors", "formatter", "decorator", "themeValues", "background", "customHeight", "autocomplete", "extraStyles"];
22553
+ _excluded2 = ["type", "labelTextWhenNoError", "errorMessages", "isNum", "isEmail", "helperModal", "field", "fieldActions", "showErrors", "formatter", "decorator", "themeValues", "background", "customHeight", "autocomplete", "extraStyles", "removeFromValue"];
22554
22554
  var InputField = styled__default.input.withConfig({
22555
22555
  displayName: "FormInput__InputField",
22556
22556
  componentId: "sc-l094r1-0"
@@ -22634,6 +22634,7 @@ var FormInput = function FormInput(_ref15) {
22634
22634
  customHeight = _ref15.customHeight,
22635
22635
  autocomplete = _ref15.autocomplete,
22636
22636
  extraStyles = _ref15.extraStyles,
22637
+ removeFromValue = _ref15.removeFromValue,
22637
22638
  props = _objectWithoutProperties(_ref15, _excluded2);
22638
22639
 
22639
22640
  var _useState = React.useState(false),
@@ -22644,6 +22645,14 @@ var FormInput = function FormInput(_ref15) {
22644
22645
  var _useContext = React.useContext(styled.ThemeContext),
22645
22646
  isMobile = _useContext.isMobile;
22646
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
+
22647
22656
  return /*#__PURE__*/React__default.createElement(Stack, {
22648
22657
  childGap: "0.25rem"
22649
22658
  }, /*#__PURE__*/React__default.createElement(Box, {
@@ -22697,8 +22706,8 @@ var FormInput = function FormInput(_ref15) {
22697
22706
  "aria-labelledby": createIdFromString(labelTextWhenNoError),
22698
22707
  "aria-describedby": createIdFromString(labelTextWhenNoError, "error message"),
22699
22708
  "aria-invalid": field.dirty && field.hasErrors || field.hasErrors && showErrors,
22700
- onChange: function onChange(e) {
22701
- return fieldActions.set(e);
22709
+ onChange: function onChange(value) {
22710
+ return setValue(value);
22702
22711
  },
22703
22712
  type: type,
22704
22713
  value: field.rawValue,
@@ -22717,7 +22726,7 @@ var FormInput = function FormInput(_ref15) {
22717
22726
  "aria-describedby": createIdFromString(labelTextWhenNoError, "error message"),
22718
22727
  "aria-invalid": field.dirty && field.hasErrors || field.hasErrors && showErrors,
22719
22728
  onChange: function onChange(e) {
22720
- return fieldActions.set(e.target.value);
22729
+ return setValue(e.target.value);
22721
22730
  },
22722
22731
  type: type === "password" && showPassword ? "text" : type,
22723
22732
  value: field.rawValue,
@@ -35136,24 +35145,10 @@ const runValidator = (validator, value, form) => {
35136
35145
  if (validatorFn === undefined) {
35137
35146
  throw new Error(runValidatorErrorMessage(validator.type));
35138
35147
  }
35139
- console.log(
35140
- "run validator (validator, value, form):",
35141
- validator.type,
35142
- validator.args,
35143
- value,
35144
- form
35145
- );
35146
35148
  return validatorFn(value, validator.args, form) ? null : validator.error;
35147
35149
  };
35148
35150
 
35149
35151
  const _computeErrors = (fieldName, form, validators) => {
35150
- console.log("field name is", fieldName);
35151
- console.log("form is", form);
35152
- console.log("validators are", validators);
35153
- const validatorsResult = validators.map(v =>
35154
- runValidator(v, form[fieldName].rawValue, form)
35155
- );
35156
- console.log("validators result is", validatorsResult);
35157
35152
  return validators
35158
35153
  .map(v => runValidator(v, form[fieldName].rawValue, form))
35159
35154
  .filter(x => x !== null);
@@ -42279,6 +42274,8 @@ var PaymentFormCard = function PaymentFormCard(_ref) {
42279
42274
  return e.key === "Enter" && handleSubmit(e);
42280
42275
  },
42281
42276
  isNum: true,
42277
+ removeFromValue: /\// // removes "/" from browser autofill
42278
+ ,
42282
42279
  autocomplete: "cc-exp"
42283
42280
  }), /*#__PURE__*/React__default.createElement(FormInput$1, {
42284
42281
  labelTextWhenNoError: "CVV",