@thecb/components 6.1.4-beta.4 → 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 +14 -4
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +14 -4
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/atoms/form-layouts/FormInput.js +9 -3
- package/src/components/molecules/payment-form-card/PaymentFormCard.js +1 -0
- package/src/components/molecules/payment-form-card/PaymentFormCard.state.js +1 -1
package/package.json
CHANGED
|
@@ -114,11 +114,17 @@ const FormInput = ({
|
|
|
114
114
|
customHeight,
|
|
115
115
|
autocomplete,
|
|
116
116
|
extraStyles,
|
|
117
|
-
removeFromValue,
|
|
117
|
+
removeFromValue, // regex of characters to remove before setting value
|
|
118
118
|
...props
|
|
119
119
|
}) => {
|
|
120
120
|
const [showPassword, setShowPassword] = useState(false);
|
|
121
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
|
+
};
|
|
122
128
|
|
|
123
129
|
return (
|
|
124
130
|
<Stack childGap="0.25rem">
|
|
@@ -200,7 +206,7 @@ const FormInput = ({
|
|
|
200
206
|
(field.dirty && field.hasErrors) ||
|
|
201
207
|
(field.hasErrors && showErrors)
|
|
202
208
|
}
|
|
203
|
-
onChange={
|
|
209
|
+
onChange={value => setValue(value)}
|
|
204
210
|
type={type}
|
|
205
211
|
value={field.rawValue}
|
|
206
212
|
pattern={isNum ? "[0-9]*" : ""}
|
|
@@ -226,7 +232,7 @@ const FormInput = ({
|
|
|
226
232
|
(field.dirty && field.hasErrors) ||
|
|
227
233
|
(field.hasErrors && showErrors)
|
|
228
234
|
}
|
|
229
|
-
onChange={e =>
|
|
235
|
+
onChange={e => setValue(e.target.value)}
|
|
230
236
|
type={type === "password" && showPassword ? "text" : type}
|
|
231
237
|
value={field.rawValue}
|
|
232
238
|
pattern={isNum ? "[0-9]*" : ""}
|
|
@@ -31,7 +31,7 @@ const formConfig = {
|
|
|
31
31
|
isValidMonth(0),
|
|
32
32
|
dateAfterToday("MMYY", "month", true)
|
|
33
33
|
],
|
|
34
|
-
constraints: [onlyExpirationDate(), hasLength(0,
|
|
34
|
+
constraints: [onlyExpirationDate(), hasLength(0, 4)]
|
|
35
35
|
},
|
|
36
36
|
cvv: {
|
|
37
37
|
validators: [required(), hasLength(3, 4)],
|