@thecb/components 6.1.4 → 6.2.1

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.2.1",
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]*" : ""}
@@ -0,0 +1,38 @@
1
+ import React from "react";
2
+
3
+ const ExternalLinkIcon = ({ linkColor, text }) => (
4
+ <svg
5
+ width="14"
6
+ height="14"
7
+ viewBox="0 0 14 14"
8
+ fill="none"
9
+ xmlns="http://www.w3.org/2000/svg"
10
+ >
11
+ <path
12
+ fillRule="evenodd"
13
+ clipRule="evenodd"
14
+ d="M1.86092 1.59483C1.92074 1.56953 1.98651 1.55554 2.05554 1.55554H2.6111H4.94443C5.22057 1.55554 5.44443 1.7794 5.44443 2.05554V2.6111C5.44443 2.88724 5.22057 3.1111 4.94443 3.1111H3.1111V10.8889H10.8889V9.05554C10.8889 8.7794 11.1127 8.55554 11.3889 8.55554H11.9444C12.2206 8.55554 12.4444 8.7794 12.4444 9.05554V11.9444C12.4444 12.2206 12.2206 12.4444 11.9444 12.4444H11.3889C11.3507 12.4444 11.3135 12.4401 11.2778 12.432C11.242 12.4401 11.2048 12.4444 11.1667 12.4444H2.6111H2.05554C1.7794 12.4444 1.55554 12.2206 1.55554 11.9444V11.3889V2.6111V2.05554C1.55554 2.05554 1.55554 2.05554 1.55554 2.05554C1.55554 2.01307 1.56084 1.97183 1.57081 1.93246C1.60944 1.77983 1.71826 1.65517 1.86092 1.59483ZM7.77776 2.05554C7.77776 1.7794 8.00162 1.55554 8.27776 1.55554H11.3889H11.9444C12.2206 1.55554 12.4444 1.7794 12.4444 2.05554V2.6111V5.72221C12.4444 5.99835 12.2206 6.22221 11.9444 6.22221H11.3889C11.1127 6.22221 10.8889 5.99835 10.8889 5.72221V4.26638L6.89793 8.25733C6.70267 8.45259 6.38608 8.45259 6.19082 8.25733L5.79798 7.8645C5.60272 7.66923 5.60272 7.35265 5.79798 7.15739L9.84428 3.1111H8.27776C8.00162 3.1111 7.77776 2.88724 7.77776 2.6111V2.05554Z"
15
+ fill="#292A33"
16
+ />
17
+ <mask
18
+ id={`mask0_902_435-${text}`}
19
+ maskUnits="userSpaceOnUse"
20
+ x="1"
21
+ y="1"
22
+ width="12"
23
+ height="12"
24
+ >
25
+ <path
26
+ fillRule="evenodd"
27
+ clipRule="evenodd"
28
+ d="M1.86092 1.59483C1.92074 1.56953 1.98651 1.55554 2.05554 1.55554H2.6111H4.94443C5.22057 1.55554 5.44443 1.7794 5.44443 2.05554V2.6111C5.44443 2.88724 5.22057 3.1111 4.94443 3.1111H3.1111V10.8889H10.8889V9.05554C10.8889 8.7794 11.1127 8.55554 11.3889 8.55554H11.9444C12.2206 8.55554 12.4444 8.7794 12.4444 9.05554V11.9444C12.4444 12.2206 12.2206 12.4444 11.9444 12.4444H11.3889C11.3507 12.4444 11.3135 12.4401 11.2778 12.432C11.242 12.4401 11.2048 12.4444 11.1667 12.4444H2.6111H2.05554C1.7794 12.4444 1.55554 12.2206 1.55554 11.9444V11.3889V2.6111V2.05554C1.55554 2.05554 1.55554 2.05554 1.55554 2.05554C1.55554 2.01307 1.56084 1.97183 1.57081 1.93246C1.60944 1.77983 1.71826 1.65517 1.86092 1.59483ZM7.77776 2.05554C7.77776 1.7794 8.00162 1.55554 8.27776 1.55554H11.3889H11.9444C12.2206 1.55554 12.4444 1.7794 12.4444 2.05554V2.6111V5.72221C12.4444 5.99835 12.2206 6.22221 11.9444 6.22221H11.3889C11.1127 6.22221 10.8889 5.99835 10.8889 5.72221V4.26638L6.89793 8.25733C6.70267 8.45259 6.38608 8.45259 6.19082 8.25733L5.79798 7.8645C5.60272 7.66923 5.60272 7.35265 5.79798 7.15739L9.84428 3.1111H8.27776C8.00162 3.1111 7.77776 2.88724 7.77776 2.6111V2.05554Z"
29
+ fill={linkColor}
30
+ />
31
+ </mask>
32
+ <g mask={`url(#mask0_902_435-${text})`}>
33
+ <rect x="-0.0864258" width="14" height="14" fill="#292A33" />
34
+ </g>
35
+ </svg>
36
+ );
37
+
38
+ export default ExternalLinkIcon;
@@ -32,6 +32,7 @@ import ChargebackIcon from "./ChargebackIcon";
32
32
  import ChargebackReversalIcon from "./ChargebackReversalIcon";
33
33
  import DuplicateIcon from "./DuplicateIcon";
34
34
  import ErroredIcon from "./ErroredIcon";
35
+ import ExternalLinkIcon from "./ExternalLinkIcon";
35
36
  import FailedIcon from "./FailedIcon";
36
37
  import PendingIcon from "./PendingIcon";
37
38
  import RefundIcon from "./RefundIcon";
@@ -91,6 +92,7 @@ export {
91
92
  ChargebackReversalIcon,
92
93
  DuplicateIcon,
93
94
  ErroredIcon,
95
+ ExternalLinkIcon,
94
96
  FailedIcon,
95
97
  PendingIcon,
96
98
  RefundIcon,
@@ -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)],