@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 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,6 +35145,13 @@ const runValidator = (validator, value, form) => {
35136
35145
  if (validatorFn === undefined) {
35137
35146
  throw new Error(runValidatorErrorMessage(validator.type));
35138
35147
  }
35148
+ console.log(
35149
+ "run validator (validator, value, form):",
35150
+ validator.type,
35151
+ validator.args,
35152
+ value,
35153
+ form
35154
+ );
35139
35155
  return validatorFn(value, validator.args, form) ? null : validator.error;
35140
35156
  };
35141
35157
 
@@ -42272,6 +42288,8 @@ var PaymentFormCard = function PaymentFormCard(_ref) {
42272
42288
  return e.key === "Enter" && handleSubmit(e);
42273
42289
  },
42274
42290
  isNum: true,
42291
+ removeFromValue: /\// // removes "/" from browser autofill
42292
+ ,
42275
42293
  autocomplete: "cc-exp"
42276
42294
  }), /*#__PURE__*/React__default.createElement(FormInput$1, {
42277
42295
  labelTextWhenNoError: "CVV",