@thecb/components 9.1.4-beta.5 → 9.1.4
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 +192 -183
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +192 -183
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/atoms/country-dropdown/CountryDropdown.js +1 -3
- package/src/components/atoms/form-layouts/FormInput.js +0 -3
- package/src/components/atoms/form-select/FormSelect.js +1 -3
- package/src/components/atoms/layouts/Motion.styled.js +1 -1
- package/src/components/molecules/payment-form-ach/PaymentFormACH.js +3 -19
- package/src/components/molecules/payment-form-ach/PaymentFormACH.state.js +2 -2
- package/src/components/molecules/payment-form-card/PaymentFormCard.js +1 -15
- package/src/components/molecules/radio-section/RadioSection.js +1 -4
- package/src/components/molecules/radio-section/radio-button/RadioButton.js +7 -5
- package/src/components/molecules/radio-section/radio-button/RadioButton.theme.js +2 -2
- package/dist/src/apps/checkout/pages/payment/sub-pages/payment-amount/PaymentAmount_old.js +0 -49322
- package/src/.DS_Store +0 -0
- package/src/components/.DS_Store +0 -0
- package/src/components/atoms/.DS_Store +0 -0
- package/src/components/atoms/icons/.DS_Store +0 -0
package/package.json
CHANGED
|
@@ -10,8 +10,7 @@ const CountryDropdown = ({
|
|
|
10
10
|
fieldActions,
|
|
11
11
|
showErrors,
|
|
12
12
|
onChange,
|
|
13
|
-
dataQa = null
|
|
14
|
-
isRequired = false
|
|
13
|
+
dataQa = null
|
|
15
14
|
}) => (
|
|
16
15
|
<FormSelect
|
|
17
16
|
options={options}
|
|
@@ -23,7 +22,6 @@ const CountryDropdown = ({
|
|
|
23
22
|
showErrors={showErrors}
|
|
24
23
|
onChange={onChange}
|
|
25
24
|
autocompleteValue="country-name"
|
|
26
|
-
isRequired={isRequired}
|
|
27
25
|
/>
|
|
28
26
|
);
|
|
29
27
|
export default CountryDropdown;
|
|
@@ -116,7 +116,6 @@ const FormInput = ({
|
|
|
116
116
|
extraStyles,
|
|
117
117
|
removeFromValue, // regex of characters to remove before setting value
|
|
118
118
|
dataQa = null,
|
|
119
|
-
isRequired = false,
|
|
120
119
|
...props
|
|
121
120
|
}) => {
|
|
122
121
|
const [showPassword, setShowPassword] = useState(false);
|
|
@@ -222,7 +221,6 @@ const FormInput = ({
|
|
|
222
221
|
$extraStyles={extraStyles}
|
|
223
222
|
data-qa={dataQa || labelTextWhenNoError}
|
|
224
223
|
autoComplete={autocompleteValue}
|
|
225
|
-
required={isRequired}
|
|
226
224
|
{...props}
|
|
227
225
|
/>
|
|
228
226
|
) : (
|
|
@@ -249,7 +247,6 @@ const FormInput = ({
|
|
|
249
247
|
$extraStyles={extraStyles}
|
|
250
248
|
data-qa={dataQa || labelTextWhenNoError}
|
|
251
249
|
autoComplete={autocompleteValue}
|
|
252
|
-
required={isRequired}
|
|
253
250
|
{...props}
|
|
254
251
|
/>
|
|
255
252
|
)}
|
|
@@ -24,8 +24,7 @@ const FormSelect = ({
|
|
|
24
24
|
autocompleteValue, // browser autofill value, like country-name
|
|
25
25
|
smoothScroll = true, // whether the browser should animate scroll to selected item on first open
|
|
26
26
|
dataQa = null,
|
|
27
|
-
widthFitOptions = false
|
|
28
|
-
isRequired = false
|
|
27
|
+
widthFitOptions = false
|
|
29
28
|
}) => {
|
|
30
29
|
const [open, setOpen] = useState(false);
|
|
31
30
|
const dropdownRef = useRef(null);
|
|
@@ -95,7 +94,6 @@ const FormSelect = ({
|
|
|
95
94
|
disabled={disabled}
|
|
96
95
|
autocompleteValue={autocompleteValue}
|
|
97
96
|
smoothScroll={smoothScroll}
|
|
98
|
-
required={isRequired}
|
|
99
97
|
/>
|
|
100
98
|
<Stack direction="row" justify="space-between">
|
|
101
99
|
<Text
|
|
@@ -8,7 +8,7 @@ export const MotionWrapper = styled(motion.div)`
|
|
|
8
8
|
padding: ${({ padding }) => padding};
|
|
9
9
|
border: ${({ borderShorthand }) => borderShorthand};
|
|
10
10
|
border-color: ${({ borderColor }) => borderColor};
|
|
11
|
-
border-
|
|
11
|
+
border-size: ${({ borderSize }) => borderSize};
|
|
12
12
|
border-style: ${({ borderStyle }) => borderStyle};
|
|
13
13
|
border-width: ${({ borderWidth }) => borderWidth};
|
|
14
14
|
border-radius: ${({ borderRadius }) => borderRadius};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { useEffect, useState
|
|
1
|
+
import React, { useEffect, useState } from "react";
|
|
2
2
|
import Checkbox from "../../atoms/checkbox";
|
|
3
3
|
import {
|
|
4
4
|
required,
|
|
@@ -50,8 +50,7 @@ const PaymentFormACH = ({
|
|
|
50
50
|
};
|
|
51
51
|
const confirmRoutingNumberErrors = {
|
|
52
52
|
[matchesField.error]:
|
|
53
|
-
"Confirm routing number field must match routing number"
|
|
54
|
-
[required.error]: "Confirm routing number is required"
|
|
53
|
+
"Confirm routing number field must match routing number"
|
|
55
54
|
};
|
|
56
55
|
const accountNumberErrors = {
|
|
57
56
|
[required.error]: "Account number is required",
|
|
@@ -59,21 +58,12 @@ const PaymentFormACH = ({
|
|
|
59
58
|
};
|
|
60
59
|
const confirmAccountNumberErrors = {
|
|
61
60
|
[matchesField.error]:
|
|
62
|
-
"Confirm account number field must match account number"
|
|
63
|
-
[required.error]: "Confirm account number is required"
|
|
61
|
+
"Confirm account number field must match account number"
|
|
64
62
|
};
|
|
65
63
|
const accountTypeErrors = {
|
|
66
64
|
[required.error]: "Account type is required"
|
|
67
65
|
};
|
|
68
66
|
|
|
69
|
-
const getIsRequiredFromValidators = useCallback(
|
|
70
|
-
field =>
|
|
71
|
-
!!field?.validators?.find(
|
|
72
|
-
validator => validator.type === "validator/REQUIRED"
|
|
73
|
-
),
|
|
74
|
-
[]
|
|
75
|
-
);
|
|
76
|
-
|
|
77
67
|
return (
|
|
78
68
|
<FormContainer variant={variant} role="form" aria-label="ACH Payment">
|
|
79
69
|
<FormInputColumn>
|
|
@@ -86,7 +76,6 @@ const PaymentFormACH = ({
|
|
|
86
76
|
showErrors={showErrors}
|
|
87
77
|
onKeyDown={e => e.key === "Enter" && handleSubmit(e)}
|
|
88
78
|
autocompleteValue="name"
|
|
89
|
-
isRequired={getIsRequiredFromValidators(fields.name)}
|
|
90
79
|
/>
|
|
91
80
|
<FormInput
|
|
92
81
|
labelTextWhenNoError="Routing number"
|
|
@@ -95,7 +84,6 @@ const PaymentFormACH = ({
|
|
|
95
84
|
field={fields.routingNumber}
|
|
96
85
|
fieldActions={actions.fields.routingNumber}
|
|
97
86
|
showErrors={showErrors}
|
|
98
|
-
isRequired={getIsRequiredFromValidators(fields.routingNumber)}
|
|
99
87
|
isNum
|
|
100
88
|
helperModal={() => (
|
|
101
89
|
<AccountAndRoutingModal
|
|
@@ -118,7 +106,6 @@ const PaymentFormACH = ({
|
|
|
118
106
|
fieldActions={actions.fields.confirmRoutingNumber}
|
|
119
107
|
showErrors={showErrors}
|
|
120
108
|
onKeyDown={e => e.key === "Enter" && handleSubmit(e)}
|
|
121
|
-
isRequired={getIsRequiredFromValidators(fields.confirmRoutingNumber)}
|
|
122
109
|
isNum
|
|
123
110
|
/>
|
|
124
111
|
<FormInput
|
|
@@ -128,7 +115,6 @@ const PaymentFormACH = ({
|
|
|
128
115
|
field={fields.accountNumber}
|
|
129
116
|
fieldActions={actions.fields.accountNumber}
|
|
130
117
|
showErrors={showErrors}
|
|
131
|
-
isRequired={getIsRequiredFromValidators(fields.accountNumber)}
|
|
132
118
|
isNum
|
|
133
119
|
helperModal={() => (
|
|
134
120
|
<AccountAndRoutingModal
|
|
@@ -151,7 +137,6 @@ const PaymentFormACH = ({
|
|
|
151
137
|
fieldActions={actions.fields.confirmAccountNumber}
|
|
152
138
|
showErrors={showErrors}
|
|
153
139
|
onKeyDown={e => e.key === "Enter" && handleSubmit(e)}
|
|
154
|
-
isRequired={getIsRequiredFromValidators(fields.confirmAccountNumber)}
|
|
155
140
|
isNum
|
|
156
141
|
/>
|
|
157
142
|
{allowBankAccountType && (
|
|
@@ -167,7 +152,6 @@ const PaymentFormACH = ({
|
|
|
167
152
|
showErrors={showErrors}
|
|
168
153
|
errorMessages={accountTypeErrors}
|
|
169
154
|
field={fields.accountType}
|
|
170
|
-
isRequired={getIsRequiredFromValidators(fields.accountType)}
|
|
171
155
|
/>
|
|
172
156
|
)}
|
|
173
157
|
{!hideDefaultPayment && (
|
|
@@ -16,7 +16,7 @@ const formConfig = {
|
|
|
16
16
|
constraints: [onlyIntegers(), hasLength(0, 9)]
|
|
17
17
|
},
|
|
18
18
|
confirmRoutingNumber: {
|
|
19
|
-
validators: [matchesField("routingNumber")
|
|
19
|
+
validators: [matchesField("routingNumber")],
|
|
20
20
|
constraints: [onlyIntegers(), hasLength(0, 9)]
|
|
21
21
|
},
|
|
22
22
|
accountNumber: {
|
|
@@ -24,7 +24,7 @@ const formConfig = {
|
|
|
24
24
|
constraints: [onlyIntegers(), hasLength(0, 17)]
|
|
25
25
|
},
|
|
26
26
|
confirmAccountNumber: {
|
|
27
|
-
validators: [matchesField("accountNumber")
|
|
27
|
+
validators: [matchesField("accountNumber")],
|
|
28
28
|
constraints: [onlyIntegers(), hasLength(0, 17)]
|
|
29
29
|
},
|
|
30
30
|
accountType: {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { useEffect, useContext,
|
|
1
|
+
import React, { useEffect, useContext, useState } from "react";
|
|
2
2
|
import { ThemeContext } from "styled-components";
|
|
3
3
|
import {
|
|
4
4
|
required,
|
|
@@ -47,14 +47,6 @@ const PaymentFormCard = ({
|
|
|
47
47
|
const { isMobile } = useContext(ThemeContext);
|
|
48
48
|
const showTerms = !!termsContent;
|
|
49
49
|
|
|
50
|
-
const getIsRequiredFromValidators = useCallback(
|
|
51
|
-
field =>
|
|
52
|
-
!!field?.validators?.find(
|
|
53
|
-
validator => validator.type === "validator/REQUIRED"
|
|
54
|
-
),
|
|
55
|
-
[]
|
|
56
|
-
);
|
|
57
|
-
|
|
58
50
|
useEffect(() => {
|
|
59
51
|
if (deniedCards) {
|
|
60
52
|
deniedCards.map(card =>
|
|
@@ -118,7 +110,6 @@ const PaymentFormCard = ({
|
|
|
118
110
|
}}
|
|
119
111
|
showErrors={showErrors}
|
|
120
112
|
dataQa="Country"
|
|
121
|
-
isRequired={getIsRequiredFromValidators(fields.country)}
|
|
122
113
|
/>
|
|
123
114
|
)}
|
|
124
115
|
<FormInput
|
|
@@ -130,7 +121,6 @@ const PaymentFormCard = ({
|
|
|
130
121
|
showErrors={showErrors}
|
|
131
122
|
onKeyDown={e => e.key === "Enter" && handleSubmit(e)}
|
|
132
123
|
autocompleteValue="cc-name"
|
|
133
|
-
isRequired={getIsRequiredFromValidators(fields.nameOnCard)}
|
|
134
124
|
/>
|
|
135
125
|
<FormInput
|
|
136
126
|
labelTextWhenNoError="Credit card number"
|
|
@@ -143,7 +133,6 @@ const PaymentFormCard = ({
|
|
|
143
133
|
onKeyDown={e => e.key === "Enter" && handleSubmit(e)}
|
|
144
134
|
isNum
|
|
145
135
|
autocompleteValue="cc-number"
|
|
146
|
-
isRequired={getIsRequiredFromValidators(fields.creditCardNumber)}
|
|
147
136
|
/>
|
|
148
137
|
<FormInputRow
|
|
149
138
|
breakpoint={isMobile ? "1000rem" : "21rem"}
|
|
@@ -161,7 +150,6 @@ const PaymentFormCard = ({
|
|
|
161
150
|
isNum
|
|
162
151
|
removeFromValue={/\//} // removes "/" from browser autofill
|
|
163
152
|
autocompleteValue="cc-exp"
|
|
164
|
-
isRequired={getIsRequiredFromValidators(fields.expirationDate)}
|
|
165
153
|
/>
|
|
166
154
|
<FormInput
|
|
167
155
|
labelTextWhenNoError="CVV"
|
|
@@ -178,7 +166,6 @@ const PaymentFormCard = ({
|
|
|
178
166
|
}
|
|
179
167
|
onKeyDown={e => e.key === "Enter" && handleSubmit(e)}
|
|
180
168
|
autocompleteValue="cc-csc"
|
|
181
|
-
isRequired={getIsRequiredFromValidators(fields.cvv)}
|
|
182
169
|
/>
|
|
183
170
|
</FormInputRow>
|
|
184
171
|
{!hideZipCode && (
|
|
@@ -197,7 +184,6 @@ const PaymentFormCard = ({
|
|
|
197
184
|
showErrors={showErrors}
|
|
198
185
|
onKeyDown={e => e.key === "Enter" && handleSubmit(e)}
|
|
199
186
|
autocompleteValue="billing postal-code"
|
|
200
|
-
isRequired={getIsRequiredFromValidators(fields.zipCode)}
|
|
201
187
|
/>
|
|
202
188
|
</Box>
|
|
203
189
|
)}
|
|
@@ -123,8 +123,7 @@ const RadioSection = ({
|
|
|
123
123
|
extraStyles={borderStyles}
|
|
124
124
|
role="radio"
|
|
125
125
|
aria-checked={openSection === section.id}
|
|
126
|
-
disabled={section.disabled}
|
|
127
|
-
required={section?.required}
|
|
126
|
+
aria-disabled={section.disabled}
|
|
128
127
|
>
|
|
129
128
|
<Stack childGap="0">
|
|
130
129
|
<Box
|
|
@@ -167,8 +166,6 @@ const RadioSection = ({
|
|
|
167
166
|
{!section.hideRadioButton && (
|
|
168
167
|
<Box padding="0">
|
|
169
168
|
<RadioButton
|
|
170
|
-
role="radio"
|
|
171
|
-
required={!!section?.required}
|
|
172
169
|
id={`radio-input-${idString(section)}`}
|
|
173
170
|
name={idString(section)}
|
|
174
171
|
ariaDescribedBy={ariaDescribedBy}
|
|
@@ -24,19 +24,21 @@ const RadioButton = ({
|
|
|
24
24
|
const buttonBorder = {
|
|
25
25
|
onFocused: {
|
|
26
26
|
borderColor: themeValues.activeColor,
|
|
27
|
-
|
|
27
|
+
outline: `3px solid ${themeValues.activeColor}`,
|
|
28
|
+
outlineOffset: "2px"
|
|
28
29
|
},
|
|
29
30
|
offFocused: {
|
|
30
31
|
borderColor: themeValues.activeColor,
|
|
31
|
-
|
|
32
|
+
outline: `3px solid ${themeValues.activeColor}`,
|
|
33
|
+
outlineOffset: "2px"
|
|
32
34
|
},
|
|
33
35
|
on: {
|
|
34
36
|
borderColor: themeValues.activeColor,
|
|
35
|
-
|
|
37
|
+
outline: "0"
|
|
36
38
|
},
|
|
37
39
|
off: {
|
|
38
40
|
borderColor: themeValues.inactiveColor,
|
|
39
|
-
|
|
41
|
+
outline: "0"
|
|
40
42
|
}
|
|
41
43
|
};
|
|
42
44
|
|
|
@@ -97,7 +99,7 @@ const RadioButton = ({
|
|
|
97
99
|
borderWidth="1px"
|
|
98
100
|
borderStyle="solid"
|
|
99
101
|
borderRadius="12px"
|
|
100
|
-
margin="
|
|
102
|
+
margin="6px 14px 6px 6px"
|
|
101
103
|
height="24px"
|
|
102
104
|
width="24px"
|
|
103
105
|
variants={buttonBorder}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { MATISSE_BLUE,
|
|
1
|
+
import { MATISSE_BLUE, STORM_GREY } from "../../../../constants/colors";
|
|
2
2
|
|
|
3
3
|
const activeColor = `${MATISSE_BLUE}`;
|
|
4
|
-
const inactiveColor = `${
|
|
4
|
+
const inactiveColor = `${STORM_GREY}`;
|
|
5
5
|
|
|
6
6
|
export const fallbackValues = {
|
|
7
7
|
activeColor,
|