@thecb/components 8.4.11-beta.8 → 9.0.0-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.
Files changed (34) hide show
  1. package/dist/index.cjs.js +217 -153
  2. package/dist/index.cjs.js.map +1 -1
  3. package/dist/index.d.ts +15 -0
  4. package/dist/index.esm.js +217 -153
  5. package/dist/index.esm.js.map +1 -1
  6. package/package.json +1 -1
  7. package/src/components/atoms/alert/Alert.js +1 -0
  8. package/src/components/atoms/checkbox/Checkbox.js +3 -2
  9. package/src/components/atoms/country-dropdown/CountryDropdown.js +2 -2
  10. package/src/components/atoms/country-dropdown/CountryDropdown.stories.js +1 -0
  11. package/src/components/atoms/display-box/DisplayBox.js +7 -1
  12. package/src/components/atoms/dropdown/Dropdown.js +22 -16
  13. package/src/components/atoms/dropdown/index.d.ts +32 -0
  14. package/src/components/atoms/form-layouts/FormInput.js +17 -9
  15. package/src/components/atoms/form-layouts/index.d.ts +8 -0
  16. package/src/components/atoms/form-select/FormSelect.js +17 -9
  17. package/src/components/atoms/form-select/index.d.ts +7 -0
  18. package/src/components/atoms/state-province-dropdown/StateProvinceDropdown.js +5 -2
  19. package/src/components/atoms/state-province-dropdown/index.d.ts +26 -0
  20. package/src/components/molecules/account-and-routing-modal/AccountAndRoutingModal.js +4 -1
  21. package/src/components/molecules/address-form/AddressForm.js +12 -16
  22. package/src/components/molecules/change-password-form/ChangePasswordForm.js +3 -3
  23. package/src/components/molecules/edit-name-form/EditNameForm.js +4 -2
  24. package/src/components/molecules/email-form/EmailForm.js +2 -1
  25. package/src/components/molecules/forgot-password-form/ForgotPasswordForm.js +1 -1
  26. package/src/components/molecules/login-form/LoginForm.js +2 -2
  27. package/src/components/molecules/modal/Modal.js +3 -2
  28. package/src/components/molecules/payment-form-ach/PaymentFormACH.js +13 -5
  29. package/src/components/molecules/payment-form-card/PaymentFormCard.js +12 -5
  30. package/src/components/molecules/phone-form/PhoneForm.js +2 -3
  31. package/src/components/molecules/registration-form/RegistrationForm.js +5 -5
  32. package/src/components/molecules/reset-password-form/ResetPasswordForm.js +2 -2
  33. package/src/components/molecules/terms-and-conditions/TermsAndConditionsControlV1.js +4 -2
  34. package/src/components/molecules/terms-and-conditions/TermsAndConditionsControlV2.js +14 -10
@@ -44,12 +44,13 @@ const Modal = ({
44
44
  customWidth,
45
45
  isLoading,
46
46
  buttonExtraStyles,
47
- children
47
+ children,
48
+ dataQa = ""
48
49
  }) => {
49
50
  const { isMobile } = useContext(ThemeContext);
50
51
  const modalContainerRef = useRef(null);
51
52
  return (
52
- <div ref={modalContainerRef}>
53
+ <div ref={modalContainerRef} data-qa={dataQa}>
53
54
  {modalOpen && (
54
55
  <AriaModal
55
56
  // fallback to resolve Jest unit test errors when tabbable doesn't exist in jsdom https://github.com/focus-trap/focus-trap-react/issues/91
@@ -69,15 +69,17 @@ const PaymentFormACH = ({
69
69
  <FormInputColumn>
70
70
  <FormInput
71
71
  labelTextWhenNoError="Name on checking account"
72
+ dataQa="Name on checking account"
72
73
  errorMessages={nameErrors}
73
74
  field={fields.name}
74
75
  fieldActions={actions.fields.name}
75
76
  showErrors={showErrors}
76
77
  onKeyDown={e => e.key === "Enter" && handleSubmit(e)}
77
- autocomplete="name"
78
+ autocompleteValue="name"
78
79
  />
79
80
  <FormInput
80
81
  labelTextWhenNoError="Routing number"
82
+ dataQa="Routing number"
81
83
  errorMessages={routingNumberErrors}
82
84
  field={fields.routingNumber}
83
85
  fieldActions={actions.fields.routingNumber}
@@ -87,17 +89,18 @@ const PaymentFormACH = ({
87
89
  <AccountAndRoutingModal
88
90
  link="What is this?"
89
91
  title="Where is my routing number?"
90
- content="Your routing number is the 9-digit number in the bottom left
91
- corner of your check."
92
+ content="Your routing number is the 9-digit number in the bottom left corner of your check."
92
93
  imageType="Routing"
93
94
  isOpen={showRouting}
94
95
  toggleOpen={toggleShowRouting}
96
+ data-qa="What is my routing number"
95
97
  />
96
98
  )}
97
99
  onKeyDown={e => e.key === "Enter" && handleSubmit(e)}
98
100
  />
99
101
  <FormInput
100
102
  labelTextWhenNoError="Confirm routing number"
103
+ dataQa="Confirm routing number"
101
104
  errorMessages={confirmRoutingNumberErrors}
102
105
  field={fields.confirmRoutingNumber}
103
106
  fieldActions={actions.fields.confirmRoutingNumber}
@@ -107,6 +110,7 @@ const PaymentFormACH = ({
107
110
  />
108
111
  <FormInput
109
112
  labelTextWhenNoError="Account number"
113
+ dataQa="Account number"
110
114
  errorMessages={accountNumberErrors}
111
115
  field={fields.accountNumber}
112
116
  fieldActions={actions.fields.accountNumber}
@@ -116,17 +120,18 @@ const PaymentFormACH = ({
116
120
  <AccountAndRoutingModal
117
121
  link="What is this?"
118
122
  title="Where is my account number?"
119
- content="Your account number is usually the 10-digit number in the bottom
120
- of your check to the right of the routing number."
123
+ content="Your account number is usually the 10-digit number in the bottom of your check to the right of the routing number."
121
124
  imageType="Account"
122
125
  isOpen={showAccount}
123
126
  toggleOpen={toggleShowAccount}
127
+ dataQa="What is my account number"
124
128
  />
125
129
  )}
126
130
  onKeyDown={e => e.key === "Enter" && handleSubmit(e)}
127
131
  />
128
132
  <FormInput
129
133
  labelTextWhenNoError="Confirm account number"
134
+ dataQa="Confirm account number"
130
135
  errorMessages={confirmAccountNumberErrors}
131
136
  field={fields.confirmAccountNumber}
132
137
  fieldActions={actions.fields.confirmAccountNumber}
@@ -137,6 +142,7 @@ const PaymentFormACH = ({
137
142
  {allowBankAccountType && (
138
143
  <FormSelect
139
144
  labelTextWhenNoError="Account type"
145
+ dataQa="Account type"
140
146
  options={[
141
147
  { text: "Select account type", value: "" },
142
148
  { text: "Checking", value: "CHECKING" },
@@ -151,6 +157,7 @@ const PaymentFormACH = ({
151
157
  {!hideDefaultPayment && (
152
158
  <Checkbox
153
159
  title="Save as Default Payment Method"
160
+ dataQa="default-payment-ach"
154
161
  name="default-payment-ach"
155
162
  onChange={toggleCheckbox}
156
163
  checked={defaultMethod.value}
@@ -162,6 +169,7 @@ const PaymentFormACH = ({
162
169
  {showWalletCheckbox && (
163
170
  <Checkbox
164
171
  name="bank checkbox"
172
+ dataQa="Save checking account to wallet"
165
173
  title="Save checking account to wallet."
166
174
  checked={walletCheckboxMarked}
167
175
  onChange={saveToWallet}
@@ -109,19 +109,22 @@ const PaymentFormCard = ({
109
109
  }
110
110
  }}
111
111
  showErrors={showErrors}
112
+ dataQa="Country"
112
113
  />
113
114
  )}
114
115
  <FormInput
115
116
  labelTextWhenNoError="Name on card"
117
+ dataQa="Name on card"
116
118
  errorMessages={nameOnCardErrors}
117
119
  field={fields.nameOnCard}
118
120
  fieldActions={actions.fields.nameOnCard}
119
121
  showErrors={showErrors}
120
122
  onKeyDown={e => e.key === "Enter" && handleSubmit(e)}
121
- autocomplete="cc-name"
123
+ autocompleteValue="cc-name"
122
124
  />
123
125
  <FormInput
124
126
  labelTextWhenNoError="Credit card number"
127
+ dataQa="Credit card number"
125
128
  errorMessages={creditCardNumberErrors}
126
129
  field={fields.creditCardNumber}
127
130
  fieldActions={actions.fields.creditCardNumber}
@@ -129,7 +132,7 @@ const PaymentFormCard = ({
129
132
  formatter={creditCardFormat}
130
133
  onKeyDown={e => e.key === "Enter" && handleSubmit(e)}
131
134
  isNum
132
- autocomplete="cc-number"
135
+ autocompleteValue="cc-number"
133
136
  />
134
137
  <FormInputRow
135
138
  breakpoint={isMobile ? "1000rem" : "21rem"}
@@ -137,6 +140,7 @@ const PaymentFormCard = ({
137
140
  >
138
141
  <FormInput
139
142
  labelTextWhenNoError="Expiration date (MM/YY)"
143
+ dataQa="Expiration date"
140
144
  errorMessages={expirationDateErrors}
141
145
  field={fields.expirationDate}
142
146
  fieldActions={actions.fields.expirationDate}
@@ -145,10 +149,11 @@ const PaymentFormCard = ({
145
149
  onKeyDown={e => e.key === "Enter" && handleSubmit(e)}
146
150
  isNum
147
151
  removeFromValue={/\//} // removes "/" from browser autofill
148
- autocomplete="cc-exp"
152
+ autocompleteValue="cc-exp"
149
153
  />
150
154
  <FormInput
151
155
  labelTextWhenNoError="CVV"
156
+ dataQa="CVV"
152
157
  errorMessages={cvvErrors}
153
158
  field={fields.cvv}
154
159
  fieldActions={actions.fields.cvv}
@@ -160,7 +165,7 @@ const PaymentFormCard = ({
160
165
  : "/CVVHint.svg"
161
166
  }
162
167
  onKeyDown={e => e.key === "Enter" && handleSubmit(e)}
163
- autocomplete="cc-csc"
168
+ autocompleteValue="cc-csc"
164
169
  />
165
170
  </FormInputRow>
166
171
  {!hideZipCode && (
@@ -172,12 +177,13 @@ const PaymentFormCard = ({
172
177
  isNum={isUS}
173
178
  formatter={isUS ? zipFormat : null}
174
179
  labelTextWhenNoError="Zip code"
180
+ dataQa="Zip code"
175
181
  errorMessages={zipCodeErrors}
176
182
  field={fields.zipCode}
177
183
  fieldActions={actions.fields.zipCode}
178
184
  showErrors={showErrors}
179
185
  onKeyDown={e => e.key === "Enter" && handleSubmit(e)}
180
- autocomplete="billing postal-code"
186
+ autocompleteValue="billing postal-code"
181
187
  />
182
188
  </Box>
183
189
  )}
@@ -186,6 +192,7 @@ const PaymentFormCard = ({
186
192
  {showWalletCheckbox && (
187
193
  <Checkbox
188
194
  name="credit card checkbox"
195
+ dataQa="Save credit card to wallet"
189
196
  title="Save credit card to wallet."
190
197
  checked={walletCheckboxMarked}
191
198
  onChange={saveToWallet}
@@ -7,7 +7,6 @@ import {
7
7
  FormInputColumn
8
8
  } from "../../atoms/form-layouts";
9
9
  import Checkbox from "../../atoms/checkbox";
10
- import { noop } from "../../../util/general";
11
10
  import { phoneFormats, formatDelimiter } from "../../../util/formats";
12
11
 
13
12
  const PhoneForm = ({
@@ -40,8 +39,8 @@ const PhoneForm = ({
40
39
  showErrors={showErrors}
41
40
  formatter={createFormat(phoneFormats, formatDelimiter)}
42
41
  onKeyUp={e => e.key === "Enter" && handleSubmit(e)}
43
- isNum
44
- autocomplete="tel"
42
+ autocompleteValue="tel"
43
+ dataQa="Phone number"
45
44
  />
46
45
  {showWalletCheckbox && (
47
46
  <Checkbox
@@ -59,7 +59,7 @@ const RegistrationForm = ({
59
59
  fieldActions={actions.fields.firstName}
60
60
  showErrors={showErrors}
61
61
  onKeyDown={e => e.key === "Enter" && handleSubmit(e)}
62
- autocomplete="given-name"
62
+ autocompleteValue="given-name"
63
63
  />
64
64
  <FormInput
65
65
  labelTextWhenNoError="Last name"
@@ -68,7 +68,7 @@ const RegistrationForm = ({
68
68
  fieldActions={actions.fields.lastName}
69
69
  showErrors={showErrors}
70
70
  onKeyDown={e => e.key === "Enter" && handleSubmit(e)}
71
- autocomplete="family-name"
71
+ autocompleteValue="family-name"
72
72
  />
73
73
  <FormInput
74
74
  labelTextWhenNoError="Email address"
@@ -79,7 +79,7 @@ const RegistrationForm = ({
79
79
  onKeyDown={e => e.key === "Enter" && handleSubmit(e)}
80
80
  type="email"
81
81
  isEmail
82
- autocomplete="email"
82
+ autocompleteValue="email"
83
83
  />
84
84
  <FormInput
85
85
  labelTextWhenNoError="Password"
@@ -89,7 +89,7 @@ const RegistrationForm = ({
89
89
  showErrors={showErrors}
90
90
  onKeyDown={e => e.key === "Enter" && handleSubmit(e)}
91
91
  type="password"
92
- autocomplete="new-password"
92
+ autocompleteValue="new-password"
93
93
  />
94
94
  <FormInput
95
95
  labelTextWhenNoError="Confirm password"
@@ -99,7 +99,7 @@ const RegistrationForm = ({
99
99
  showErrors={showErrors}
100
100
  onKeyDown={e => e.key === "Enter" && handleSubmit(e)}
101
101
  type="password"
102
- autocomplete="new-password"
102
+ autocompleteValue="new-password"
103
103
  />
104
104
  <Box padding={isMobile ? "0" : "0.5rem 0 0"}>
105
105
  <PasswordRequirements password={fields.password} isMobile={isMobile} />
@@ -49,7 +49,7 @@ const ResetPasswordForm = ({
49
49
  showErrors={showErrors}
50
50
  onKeyDown={e => e.key === "Enter" && handleSubmit(e)}
51
51
  type="password"
52
- autocomplete="new-password"
52
+ autocompleteValue="new-password"
53
53
  />
54
54
  <FormInput
55
55
  labelTextWhenNoError="Confirm password"
@@ -59,7 +59,7 @@ const ResetPasswordForm = ({
59
59
  showErrors={showErrors}
60
60
  onKeyDown={e => e.key === "Enter" && handleSubmit(e)}
61
61
  type="password"
62
- autocomplete="new-password"
62
+ autocompleteValue="new-password"
63
63
  />
64
64
  <Box padding="0">
65
65
  <PasswordRequirements password={fields.password} isMobile={isMobile} />
@@ -10,15 +10,17 @@ const TermsAndConditionsControlV1 = ({
10
10
  html,
11
11
  terms,
12
12
  error = false,
13
- linkVariant
13
+ linkVariant,
14
+ dataQa = "TermsAndConditionsControlV1"
14
15
  }) => {
15
16
  const [showTerms, toggleShowTerms] = useState(false);
16
17
  return (
17
- <DisplayBox>
18
+ <DisplayBox dataQ={dataQa}>
18
19
  <Stack>
19
20
  <Checkbox
20
21
  name="terms"
21
22
  title="Terms and Conditions"
23
+ dataQa="Terms and Conditions"
22
24
  error={error}
23
25
  checked={isChecked}
24
26
  onChange={onCheck}
@@ -26,7 +26,8 @@ const TermsAndConditionsControlV2 = ({
26
26
  modalVariant = "default",
27
27
  containerBackground = ATHENS_GREY,
28
28
  checkboxMargin = "4px 8px 4px 4px",
29
- modalTitle = "Terms and Conditions"
29
+ modalTitle = "Terms and Conditions",
30
+ dataQa = "TermsAndConditionsControlV2"
30
31
  }) => {
31
32
  const [showTerms, toggleShowTerms] = useState(false);
32
33
  const standardBoxShadow = generateShadows().standard.base;
@@ -45,6 +46,7 @@ const TermsAndConditionsControlV2 = ({
45
46
  background={displayInline ? "transparent" : containerBackground}
46
47
  boxShadow={displayInline ? "none" : standardBoxShadow}
47
48
  borderRadius={displayInline ? "0" : "4px"}
49
+ dataQa={dataQa}
48
50
  >
49
51
  <Stack childGap="0">
50
52
  {html && <Box padding="0">{html}</Box>}
@@ -78,15 +80,17 @@ const TermsAndConditionsControlV2 = ({
78
80
  />
79
81
  )}
80
82
  </Cluster>
81
- {showCheckbox && hasError && (
82
- <Text
83
- variant="pXS"
84
- color={ERROR_COLOR}
85
- id={`${id}-error-message`}
86
- >
87
- {errorMessage}
88
- </Text>
89
- )}
83
+ <div aria-live="polite" aria-atomic={true}>
84
+ {showCheckbox && hasError && (
85
+ <Text
86
+ variant="pXS"
87
+ color={ERROR_COLOR}
88
+ id={`${id}-error-message`}
89
+ >
90
+ {errorMessage}
91
+ </Text>
92
+ )}
93
+ </div>
90
94
  </Stack>
91
95
  </Cluster>
92
96
  </Stack>