@thecb/components 9.1.0 → 9.1.1-beta.0
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 +150 -100
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +150 -100
- package/dist/index.esm.js.map +1 -1
- package/dist/src/apps/checkout/pages/payment/sub-pages/payment-amount/PaymentAmount_old.js +49322 -0
- package/package.json +1 -1
- 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/checkbox/Checkbox.js +3 -1
- package/src/components/atoms/country-dropdown/CountryDropdown.js +3 -1
- package/src/components/atoms/form-layouts/FormInput.js +11 -3
- package/src/components/{molecules → atoms/icons}/.DS_Store +0 -0
- package/src/components/atoms/radio-button-with-label/RadioButtonWithLabel.js +3 -1
- package/src/components/molecules/address-form/AddressForm.js +6 -0
- package/src/components/molecules/edit-name-form/EditNameForm.js +2 -0
- package/src/components/molecules/email-form/EmailForm.js +5 -2
- package/src/components/molecules/payment-form-ach/PaymentFormACH.js +6 -0
- package/src/components/molecules/payment-form-card/PaymentFormCard.js +6 -0
- package/src/components/molecules/phone-form/PhoneForm.js +3 -1
- package/src/components/molecules/radio-group/RadioGroup.js +3 -1
- package/src/components/molecules/radio-section/RadioSection.js +1 -0
- package/src/components/molecules/radio-section/radio-button/RadioButton.js +3 -1
- /package/src/components/atoms/icons/{ExternalLinkicon.js → ExternalLinkIcon.js} +0 -0
package/package.json
CHANGED
package/src/.DS_Store
CHANGED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -64,7 +64,8 @@ const StyledCheckbox = styled.div`
|
|
|
64
64
|
focusedStyles,
|
|
65
65
|
errorStyles,
|
|
66
66
|
disabledStyles,
|
|
67
|
-
disabledCheckedStyles
|
|
67
|
+
disabledCheckedStyles,
|
|
68
|
+
required = false
|
|
68
69
|
}) =>
|
|
69
70
|
error
|
|
70
71
|
? css`
|
|
@@ -128,6 +129,7 @@ const Checkbox = ({
|
|
|
128
129
|
tabIndex="-1"
|
|
129
130
|
aria-invalid={error}
|
|
130
131
|
aria-describedby={error ? `${name}-error-message` : ""}
|
|
132
|
+
required={required}
|
|
131
133
|
/>
|
|
132
134
|
<StyledCheckbox
|
|
133
135
|
role="checkbox"
|
|
@@ -10,7 +10,8 @@ const CountryDropdown = ({
|
|
|
10
10
|
fieldActions,
|
|
11
11
|
showErrors,
|
|
12
12
|
onChange,
|
|
13
|
-
dataQa = null
|
|
13
|
+
dataQa = null,
|
|
14
|
+
isRequired = false
|
|
14
15
|
}) => (
|
|
15
16
|
<FormSelect
|
|
16
17
|
options={options}
|
|
@@ -22,6 +23,7 @@ const CountryDropdown = ({
|
|
|
22
23
|
showErrors={showErrors}
|
|
23
24
|
onChange={onChange}
|
|
24
25
|
autocompleteValue="country-name"
|
|
26
|
+
required={isRequired}
|
|
25
27
|
/>
|
|
26
28
|
);
|
|
27
29
|
export default CountryDropdown;
|
|
@@ -55,9 +55,14 @@ const InputField = styled.input`
|
|
|
55
55
|
`;
|
|
56
56
|
|
|
57
57
|
// eslint-disable-next-line no-unused-vars
|
|
58
|
-
const FormattedInputField = styled(({ showErrors, themeValues, ...props }) =>
|
|
59
|
-
|
|
60
|
-
|
|
58
|
+
const FormattedInputField = styled(({ showErrors, themeValues, ...props }) => {
|
|
59
|
+
const { isRequired } = props;
|
|
60
|
+
return (
|
|
61
|
+
<FormattedInput
|
|
62
|
+
{...(isRequired ? { ...props, required: true } : { ...props })}
|
|
63
|
+
/>
|
|
64
|
+
);
|
|
65
|
+
})`
|
|
61
66
|
border: 1px solid
|
|
62
67
|
${({ field, showErrors, themeValues }) =>
|
|
63
68
|
(field.dirty && field.hasErrors) || (field.hasErrors && showErrors)
|
|
@@ -116,6 +121,7 @@ const FormInput = ({
|
|
|
116
121
|
extraStyles,
|
|
117
122
|
removeFromValue, // regex of characters to remove before setting value
|
|
118
123
|
dataQa = null,
|
|
124
|
+
isRequired = false,
|
|
119
125
|
...props
|
|
120
126
|
}) => {
|
|
121
127
|
const [showPassword, setShowPassword] = useState(false);
|
|
@@ -221,6 +227,7 @@ const FormInput = ({
|
|
|
221
227
|
$extraStyles={extraStyles}
|
|
222
228
|
data-qa={dataQa || labelTextWhenNoError}
|
|
223
229
|
autoComplete={autocompleteValue}
|
|
230
|
+
required={isRequired}
|
|
224
231
|
{...props}
|
|
225
232
|
/>
|
|
226
233
|
) : (
|
|
@@ -247,6 +254,7 @@ const FormInput = ({
|
|
|
247
254
|
$extraStyles={extraStyles}
|
|
248
255
|
data-qa={dataQa || labelTextWhenNoError}
|
|
249
256
|
autoComplete={autocompleteValue}
|
|
257
|
+
required={isRequired}
|
|
250
258
|
{...props}
|
|
251
259
|
/>
|
|
252
260
|
)}
|
|
Binary file
|
|
@@ -59,7 +59,8 @@ const RadioButtonWithLabel = ({
|
|
|
59
59
|
index,
|
|
60
60
|
handleChange = noop, // optional, for custom event handling in ingesting app
|
|
61
61
|
field,
|
|
62
|
-
config
|
|
62
|
+
config,
|
|
63
|
+
required = false
|
|
63
64
|
}) => {
|
|
64
65
|
const getDefaultChecked = (value, idx) => {
|
|
65
66
|
const selectionExistsInConfig = config
|
|
@@ -91,6 +92,7 @@ const RadioButtonWithLabel = ({
|
|
|
91
92
|
handleChange(e);
|
|
92
93
|
}}
|
|
93
94
|
defaultChecked={getDefaultChecked(value, index)}
|
|
95
|
+
required={required}
|
|
94
96
|
/>
|
|
95
97
|
<Text
|
|
96
98
|
as="label"
|
|
@@ -71,6 +71,7 @@ const AddressForm = ({
|
|
|
71
71
|
}}
|
|
72
72
|
showErrors={showErrors}
|
|
73
73
|
dataQa="Country"
|
|
74
|
+
isRequired={true}
|
|
74
75
|
/>
|
|
75
76
|
<FormInput
|
|
76
77
|
labelTextWhenNoError="Address"
|
|
@@ -81,6 +82,7 @@ const AddressForm = ({
|
|
|
81
82
|
onKeyDown={e => e.key === "Enter" && handleSubmit(e)}
|
|
82
83
|
autocompleteValue="address-line1"
|
|
83
84
|
dataQa="Address"
|
|
85
|
+
required={true}
|
|
84
86
|
/>
|
|
85
87
|
<FormInput
|
|
86
88
|
labelTextWhenNoError="Apt, Suite, Unit, Floor, etc. (Optional)"
|
|
@@ -90,6 +92,7 @@ const AddressForm = ({
|
|
|
90
92
|
onKeyDown={e => e.key === "Enter" && handleSubmit(e)}
|
|
91
93
|
autocompleteValue="address-line2"
|
|
92
94
|
dataQa="Address Line 2"
|
|
95
|
+
required={true}
|
|
93
96
|
/>
|
|
94
97
|
<FormInput
|
|
95
98
|
labelTextWhenNoError="City"
|
|
@@ -100,6 +103,7 @@ const AddressForm = ({
|
|
|
100
103
|
onKeyDown={e => e.key === "Enter" && handleSubmit(e)}
|
|
101
104
|
autocompleteValue="address-level2"
|
|
102
105
|
dataQa="City"
|
|
106
|
+
required={true}
|
|
103
107
|
/>
|
|
104
108
|
<StateProvinceDropdown
|
|
105
109
|
labelTextWhenNoError={isUS ? "State" : "State or Province"}
|
|
@@ -110,6 +114,7 @@ const AddressForm = ({
|
|
|
110
114
|
showErrors={showErrors}
|
|
111
115
|
onKeyDown={e => e.key === "Enter" && handleSubmit(e)}
|
|
112
116
|
dataQa="State or Province"
|
|
117
|
+
required={true}
|
|
113
118
|
/>
|
|
114
119
|
<FormInput
|
|
115
120
|
isNum={isUS}
|
|
@@ -122,6 +127,7 @@ const AddressForm = ({
|
|
|
122
127
|
onKeyDown={e => e.key === "Enter" && handleSubmit(e)}
|
|
123
128
|
autocompleteValue="postal-code"
|
|
124
129
|
dataQa="Zip code"
|
|
130
|
+
required={true}
|
|
125
131
|
/>
|
|
126
132
|
{showWalletCheckbox && (
|
|
127
133
|
<Checkbox
|
|
@@ -37,6 +37,7 @@ const EditNameForm = ({
|
|
|
37
37
|
showErrors={showErrors}
|
|
38
38
|
onKeyDown={e => e.key === "Enter" && handleSubmit(e)}
|
|
39
39
|
autocompleteValue="given-name"
|
|
40
|
+
isRequired={true}
|
|
40
41
|
/>
|
|
41
42
|
<FormInput
|
|
42
43
|
labelTextWhenNoError="Last Name"
|
|
@@ -47,6 +48,7 @@ const EditNameForm = ({
|
|
|
47
48
|
showErrors={showErrors}
|
|
48
49
|
onKeyDown={e => e.key === "Enter" && handleSubmit(e)}
|
|
49
50
|
autocompleteValue="family-name"
|
|
51
|
+
isRequired={true}
|
|
50
52
|
/>
|
|
51
53
|
</FormInputColumn>
|
|
52
54
|
</FormContainer>
|
|
@@ -19,7 +19,8 @@ const EmailForm = ({
|
|
|
19
19
|
handleSubmit = noop,
|
|
20
20
|
showWalletCheckbox,
|
|
21
21
|
saveToWallet,
|
|
22
|
-
walletCheckboxMarked
|
|
22
|
+
walletCheckboxMarked,
|
|
23
|
+
isRequired = false
|
|
23
24
|
}) => {
|
|
24
25
|
if (clearOnDismount) {
|
|
25
26
|
useEffect(() => () => actions.form.clear(), []);
|
|
@@ -32,7 +33,7 @@ const EmailForm = ({
|
|
|
32
33
|
return (
|
|
33
34
|
<FormContainer variant={variant} role="form" aria-label="Email address">
|
|
34
35
|
{guestCheckout && (
|
|
35
|
-
<Paragraph margin="0 0 1.125rem 0">
|
|
36
|
+
<Paragraph margin="0 0 1.125rem 0" id="explanation">
|
|
36
37
|
If desired, you can create a wallet later for faster checkout
|
|
37
38
|
</Paragraph>
|
|
38
39
|
)}
|
|
@@ -48,6 +49,7 @@ const EmailForm = ({
|
|
|
48
49
|
isEmail
|
|
49
50
|
autocompleteValue="email"
|
|
50
51
|
dataQa="Email address"
|
|
52
|
+
required={isRequired}
|
|
51
53
|
/>
|
|
52
54
|
{showWalletCheckbox && (
|
|
53
55
|
<Checkbox
|
|
@@ -55,6 +57,7 @@ const EmailForm = ({
|
|
|
55
57
|
title="Save email address to wallet"
|
|
56
58
|
checked={walletCheckboxMarked}
|
|
57
59
|
onChange={saveToWallet}
|
|
60
|
+
aria-describedby="explanation"
|
|
58
61
|
/>
|
|
59
62
|
)}
|
|
60
63
|
</FormInputColumn>
|
|
@@ -76,6 +76,7 @@ const PaymentFormACH = ({
|
|
|
76
76
|
showErrors={showErrors}
|
|
77
77
|
onKeyDown={e => e.key === "Enter" && handleSubmit(e)}
|
|
78
78
|
autocompleteValue="name"
|
|
79
|
+
isRequired={true}
|
|
79
80
|
/>
|
|
80
81
|
<FormInput
|
|
81
82
|
labelTextWhenNoError="Routing number"
|
|
@@ -97,6 +98,7 @@ const PaymentFormACH = ({
|
|
|
97
98
|
/>
|
|
98
99
|
)}
|
|
99
100
|
onKeyDown={e => e.key === "Enter" && handleSubmit(e)}
|
|
101
|
+
isRequired={true}
|
|
100
102
|
/>
|
|
101
103
|
<FormInput
|
|
102
104
|
labelTextWhenNoError="Confirm routing number"
|
|
@@ -106,6 +108,7 @@ const PaymentFormACH = ({
|
|
|
106
108
|
fieldActions={actions.fields.confirmRoutingNumber}
|
|
107
109
|
showErrors={showErrors}
|
|
108
110
|
onKeyDown={e => e.key === "Enter" && handleSubmit(e)}
|
|
111
|
+
isRequired={true}
|
|
109
112
|
isNum
|
|
110
113
|
/>
|
|
111
114
|
<FormInput
|
|
@@ -115,6 +118,7 @@ const PaymentFormACH = ({
|
|
|
115
118
|
field={fields.accountNumber}
|
|
116
119
|
fieldActions={actions.fields.accountNumber}
|
|
117
120
|
showErrors={showErrors}
|
|
121
|
+
isRequired={true}
|
|
118
122
|
isNum
|
|
119
123
|
helperModal={() => (
|
|
120
124
|
<AccountAndRoutingModal
|
|
@@ -131,6 +135,7 @@ const PaymentFormACH = ({
|
|
|
131
135
|
/>
|
|
132
136
|
<FormInput
|
|
133
137
|
labelTextWhenNoError="Confirm account number"
|
|
138
|
+
isRequired={true}
|
|
134
139
|
dataQa="Confirm account number"
|
|
135
140
|
errorMessages={confirmAccountNumberErrors}
|
|
136
141
|
field={fields.confirmAccountNumber}
|
|
@@ -157,6 +162,7 @@ const PaymentFormACH = ({
|
|
|
157
162
|
{!hideDefaultPayment && (
|
|
158
163
|
<Checkbox
|
|
159
164
|
title="Save as Default Payment Method"
|
|
165
|
+
required={true}
|
|
160
166
|
dataQa="default-payment-ach"
|
|
161
167
|
name="default-payment-ach"
|
|
162
168
|
onChange={toggleCheckbox}
|
|
@@ -110,6 +110,7 @@ const PaymentFormCard = ({
|
|
|
110
110
|
}}
|
|
111
111
|
showErrors={showErrors}
|
|
112
112
|
dataQa="Country"
|
|
113
|
+
isRequired={true}
|
|
113
114
|
/>
|
|
114
115
|
)}
|
|
115
116
|
<FormInput
|
|
@@ -121,6 +122,7 @@ const PaymentFormCard = ({
|
|
|
121
122
|
showErrors={showErrors}
|
|
122
123
|
onKeyDown={e => e.key === "Enter" && handleSubmit(e)}
|
|
123
124
|
autocompleteValue="cc-name"
|
|
125
|
+
required={true}
|
|
124
126
|
/>
|
|
125
127
|
<FormInput
|
|
126
128
|
labelTextWhenNoError="Credit card number"
|
|
@@ -133,6 +135,7 @@ const PaymentFormCard = ({
|
|
|
133
135
|
onKeyDown={e => e.key === "Enter" && handleSubmit(e)}
|
|
134
136
|
isNum
|
|
135
137
|
autocompleteValue="cc-number"
|
|
138
|
+
required={true}
|
|
136
139
|
/>
|
|
137
140
|
<FormInputRow
|
|
138
141
|
breakpoint={isMobile ? "1000rem" : "21rem"}
|
|
@@ -150,6 +153,7 @@ const PaymentFormCard = ({
|
|
|
150
153
|
isNum
|
|
151
154
|
removeFromValue={/\//} // removes "/" from browser autofill
|
|
152
155
|
autocompleteValue="cc-exp"
|
|
156
|
+
required={true}
|
|
153
157
|
/>
|
|
154
158
|
<FormInput
|
|
155
159
|
labelTextWhenNoError="CVV"
|
|
@@ -166,6 +170,7 @@ const PaymentFormCard = ({
|
|
|
166
170
|
}
|
|
167
171
|
onKeyDown={e => e.key === "Enter" && handleSubmit(e)}
|
|
168
172
|
autocompleteValue="cc-csc"
|
|
173
|
+
required={true}
|
|
169
174
|
/>
|
|
170
175
|
</FormInputRow>
|
|
171
176
|
{!hideZipCode && (
|
|
@@ -184,6 +189,7 @@ const PaymentFormCard = ({
|
|
|
184
189
|
showErrors={showErrors}
|
|
185
190
|
onKeyDown={e => e.key === "Enter" && handleSubmit(e)}
|
|
186
191
|
autocompleteValue="billing postal-code"
|
|
192
|
+
required={true}
|
|
187
193
|
/>
|
|
188
194
|
</Box>
|
|
189
195
|
)}
|
|
@@ -19,7 +19,8 @@ const PhoneForm = ({
|
|
|
19
19
|
handleSubmit = noop,
|
|
20
20
|
showWalletCheckbox,
|
|
21
21
|
saveToWallet,
|
|
22
|
-
walletCheckboxMarked
|
|
22
|
+
walletCheckboxMarked,
|
|
23
|
+
isRequired = false
|
|
23
24
|
}) => {
|
|
24
25
|
if (clearOnDismount) {
|
|
25
26
|
useEffect(() => () => actions.form.clear(), []);
|
|
@@ -43,6 +44,7 @@ const PhoneForm = ({
|
|
|
43
44
|
autocompleteValue="tel-national"
|
|
44
45
|
dataQa="Phone number"
|
|
45
46
|
isNum={true}
|
|
47
|
+
required={isRequired}
|
|
46
48
|
/>
|
|
47
49
|
{showWalletCheckbox && (
|
|
48
50
|
<Checkbox
|
|
@@ -29,7 +29,8 @@ const RadioGroup = ({
|
|
|
29
29
|
handleChange = noop, // optional, for custom event handling in ingesting app
|
|
30
30
|
// redux-freeform props - this is similar to how FormInput works, duplicated because the radio input is hidden for styling overrides
|
|
31
31
|
field,
|
|
32
|
-
fieldActions
|
|
32
|
+
fieldActions,
|
|
33
|
+
isRequired = false
|
|
33
34
|
}) => {
|
|
34
35
|
const setValue = value => fieldActions.set(value);
|
|
35
36
|
return (
|
|
@@ -42,6 +43,7 @@ const RadioGroup = ({
|
|
|
42
43
|
<Stack childGap="4px">
|
|
43
44
|
{config.map((c, idx) => (
|
|
44
45
|
<RadioButtonWithLabel
|
|
46
|
+
required={isRequired}
|
|
45
47
|
index={idx}
|
|
46
48
|
key={c.id}
|
|
47
49
|
{...c}
|
|
@@ -19,7 +19,8 @@ const RadioButton = ({
|
|
|
19
19
|
ariaDescribedBy = "",
|
|
20
20
|
themeValues,
|
|
21
21
|
ariaLabelledBy = "",
|
|
22
|
-
ariaLabel = null
|
|
22
|
+
ariaLabel = null,
|
|
23
|
+
isRequired = false
|
|
23
24
|
}) => {
|
|
24
25
|
const buttonBorder = {
|
|
25
26
|
onFocused: {
|
|
@@ -91,6 +92,7 @@ const RadioButton = ({
|
|
|
91
92
|
onClick={toggleRadio}
|
|
92
93
|
aria-describedby={ariaDescribedBy}
|
|
93
94
|
tabIndex="-1"
|
|
95
|
+
required={isRequired}
|
|
94
96
|
{...extraProps}
|
|
95
97
|
/>
|
|
96
98
|
<Motion
|
|
File without changes
|