@thecb/components 6.1.4 → 6.1.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thecb/components",
3
- "version": "6.1.4",
3
+ "version": "6.1.5",
4
4
  "description": "Common lib for CityBase react components",
5
5
  "main": "dist/index.cjs.js",
6
6
  "module": "dist/index.esm.js",
@@ -86,6 +86,6 @@
86
86
  "ramda": "^0.27.0",
87
87
  "react-aria-modal": "^4.0.0",
88
88
  "react-pose": "^4.0.10",
89
- "redux-freeform": "^5.5.0"
89
+ "redux-freeform": "^5.6.0"
90
90
  }
91
91
  }
package/src/.DS_Store ADDED
Binary file
@@ -114,10 +114,17 @@ const FormInput = ({
114
114
  customHeight,
115
115
  autocomplete,
116
116
  extraStyles,
117
+ removeFromValue, // regex of characters to remove before setting value
117
118
  ...props
118
119
  }) => {
119
120
  const [showPassword, setShowPassword] = useState(false);
120
121
  const { isMobile } = useContext(ThemeContext);
122
+ const setValue = value => {
123
+ if (removeFromValue !== undefined) {
124
+ return fieldActions.set(value.replace(removeFromValue, ""));
125
+ }
126
+ return fieldActions.set(value);
127
+ };
121
128
 
122
129
  return (
123
130
  <Stack childGap="0.25rem">
@@ -199,7 +206,7 @@ const FormInput = ({
199
206
  (field.dirty && field.hasErrors) ||
200
207
  (field.hasErrors && showErrors)
201
208
  }
202
- onChange={e => fieldActions.set(e)}
209
+ onChange={value => setValue(value)}
203
210
  type={type}
204
211
  value={field.rawValue}
205
212
  pattern={isNum ? "[0-9]*" : ""}
@@ -225,7 +232,7 @@ const FormInput = ({
225
232
  (field.dirty && field.hasErrors) ||
226
233
  (field.hasErrors && showErrors)
227
234
  }
228
- onChange={e => fieldActions.set(e.target.value)}
235
+ onChange={e => setValue(e.target.value)}
229
236
  type={type === "password" && showPassword ? "text" : type}
230
237
  value={field.rawValue}
231
238
  pattern={isNum ? "[0-9]*" : ""}
@@ -140,6 +140,7 @@ const PaymentFormCard = ({
140
140
  formatter={expirationDateFormat}
141
141
  onKeyDown={e => e.key === "Enter" && handleSubmit(e)}
142
142
  isNum
143
+ removeFromValue={/\//} // removes "/" from browser autofill
143
144
  autocomplete="cc-exp"
144
145
  />
145
146
  <FormInput
@@ -6,7 +6,8 @@ import {
6
6
  matchesRegex,
7
7
  validateWhen,
8
8
  dateAfterToday,
9
- isValidMonth
9
+ isValidMonth,
10
+ onlyExpirationDate
10
11
  } from "redux-freeform";
11
12
 
12
13
  //TODO: Will make zip code able to have more than 5 digits once we add in the FormattedInput because it will have issues with format of 60606-1111.
@@ -30,7 +31,7 @@ const formConfig = {
30
31
  isValidMonth(0),
31
32
  dateAfterToday("MMYY", "month", true)
32
33
  ],
33
- constraints: [onlyIntegers(), hasLength(0, 4)]
34
+ constraints: [onlyExpirationDate(), hasLength(0, 4)]
34
35
  },
35
36
  cvv: {
36
37
  validators: [required(), hasLength(3, 4)],
@@ -41,8 +41,7 @@ const PeriscopeDashboardIframe = ({
41
41
  periscopeDataSuccess,
42
42
  periscopeDataFailure,
43
43
  periscopeDataRequestSuccess,
44
- periscopeDataRequestFailure,
45
- timerMS = 20000
44
+ periscopeDataRequestFailure
46
45
  }) => {
47
46
  const [height, setHeight] = useState(0);
48
47
  let time = { timer: null };
@@ -52,7 +51,7 @@ const PeriscopeDashboardIframe = ({
52
51
  if (!periscopeDataSuccess) {
53
52
  periscopeDataRequestFailure();
54
53
  }
55
- }, timerMS);
54
+ }, 10000);
56
55
  return () => clearTimeout(time.timer);
57
56
  }, [periscopeDataSuccess]);
58
57