@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.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(e) {
22693
- return fieldActions.set(e);
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 fieldActions.set(e.target.value);
22721
+ return setValue(e.target.value);
22713
22722
  },
22714
22723
  type: type === "password" && showPassword ? "text" : type,
22715
22724
  value: field.rawValue,
@@ -35128,24 +35137,10 @@ const runValidator = (validator, value, form) => {
35128
35137
  if (validatorFn === undefined) {
35129
35138
  throw new Error(runValidatorErrorMessage(validator.type));
35130
35139
  }
35131
- console.log(
35132
- "run validator (validator, value, form):",
35133
- validator.type,
35134
- validator.args,
35135
- value,
35136
- form
35137
- );
35138
35140
  return validatorFn(value, validator.args, form) ? null : validator.error;
35139
35141
  };
35140
35142
 
35141
35143
  const _computeErrors = (fieldName, form, validators) => {
35142
- console.log("field name is", fieldName);
35143
- console.log("form is", form);
35144
- console.log("validators are", validators);
35145
- const validatorsResult = validators.map(v =>
35146
- runValidator(v, form[fieldName].rawValue, form)
35147
- );
35148
- console.log("validators result is", validatorsResult);
35149
35144
  return validators
35150
35145
  .map(v => runValidator(v, form[fieldName].rawValue, form))
35151
35146
  .filter(x => x !== null);
@@ -42271,6 +42266,8 @@ var PaymentFormCard = function PaymentFormCard(_ref) {
42271
42266
  return e.key === "Enter" && handleSubmit(e);
42272
42267
  },
42273
42268
  isNum: true,
42269
+ removeFromValue: /\// // removes "/" from browser autofill
42270
+ ,
42274
42271
  autocomplete: "cc-exp"
42275
42272
  }), /*#__PURE__*/React.createElement(FormInput$1, {
42276
42273
  labelTextWhenNoError: "CVV",