@thecb/components 9.0.0-beta.4 → 9.0.0-beta.6
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 +30 -34
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.esm.js +30 -34
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/atoms/checkbox/Checkbox.js +2 -1
- package/src/components/atoms/country-dropdown/CountryDropdown.js +2 -2
- package/src/components/atoms/display-box/DisplayBox.js +1 -6
- package/src/components/atoms/dropdown/Dropdown.js +5 -6
- package/src/components/atoms/form-layouts/FormInput.js +2 -2
- package/src/components/atoms/form-layouts/index.d.ts +1 -1
- package/src/components/atoms/form-select/FormSelect.js +9 -4
- package/src/components/atoms/form-select/index.d.ts +1 -1
- package/src/components/atoms/state-province-dropdown/StateProvinceDropdown.js +1 -4
- package/src/components/molecules/account-and-routing-modal/AccountAndRoutingModal.js +1 -1
- package/src/components/molecules/address-form/AddressForm.js +8 -2
- package/src/components/molecules/link-card/index.d.ts +1 -1
- package/src/components/molecules/terms-and-conditions/TermsAndConditionsControlV1.js +2 -3
- package/src/components/molecules/terms-and-conditions/TermsAndConditionsControlV2.js +2 -3
package/package.json
CHANGED
|
@@ -95,7 +95,7 @@ const Checkbox = ({
|
|
|
95
95
|
checkboxMargin = "0 16px 0 0",
|
|
96
96
|
extraStyles,
|
|
97
97
|
textExtraStyles,
|
|
98
|
-
dataQa =
|
|
98
|
+
dataQa = null
|
|
99
99
|
}) => {
|
|
100
100
|
const [focused, setFocused] = useState(false);
|
|
101
101
|
|
|
@@ -130,6 +130,7 @@ const Checkbox = ({
|
|
|
130
130
|
aria-describedby={error ? `${name}-error-message` : ""}
|
|
131
131
|
/>
|
|
132
132
|
<StyledCheckbox
|
|
133
|
+
role="checkbox"
|
|
133
134
|
error={error}
|
|
134
135
|
disabled={disabled}
|
|
135
136
|
checked={checked}
|
|
@@ -10,14 +10,14 @@ const CountryDropdown = ({
|
|
|
10
10
|
fieldActions,
|
|
11
11
|
showErrors,
|
|
12
12
|
onChange,
|
|
13
|
-
dataQa =
|
|
13
|
+
dataQa = null
|
|
14
14
|
}) => (
|
|
15
15
|
<FormSelect
|
|
16
16
|
options={options}
|
|
17
17
|
field={field}
|
|
18
18
|
fieldActions={fieldActions}
|
|
19
19
|
labelTextWhenNoError={labelTextWhenNoError}
|
|
20
|
-
dataQa={dataQa}
|
|
20
|
+
dataQa={dataQa || "CountryDropdown"}
|
|
21
21
|
errorMessages={errorMessages}
|
|
22
22
|
showErrors={showErrors}
|
|
23
23
|
onChange={onChange}
|
|
@@ -4,12 +4,7 @@ import { fallbackValues } from "./DisplayBox.theme";
|
|
|
4
4
|
import { themeComponent } from "../../../util/themeUtils";
|
|
5
5
|
import { RED } from "../../../constants/colors";
|
|
6
6
|
|
|
7
|
-
const DisplayBox = ({
|
|
8
|
-
children,
|
|
9
|
-
themeValues,
|
|
10
|
-
showError,
|
|
11
|
-
dataQa = "DisplayBox"
|
|
12
|
-
}) => (
|
|
7
|
+
const DisplayBox = ({ children, themeValues, showError, dataQa = null }) => (
|
|
13
8
|
<Box padding="0.5rem 0 1.5rem 0">
|
|
14
9
|
<Box
|
|
15
10
|
padding="1.5rem"
|
|
@@ -290,13 +290,15 @@ const Dropdown = ({
|
|
|
290
290
|
as="input"
|
|
291
291
|
aria-multiline="false"
|
|
292
292
|
autoComplete={autocompleteValue}
|
|
293
|
-
aria-controls={`${
|
|
293
|
+
aria-controls={`${ariaLabelledby}_listbox`}
|
|
294
294
|
aria-activedescendant="focused_option"
|
|
295
295
|
aria-owns={`${ariaLabelledby}_listbox`}
|
|
296
296
|
aria-haspopup="listbox"
|
|
297
297
|
aria-labelledby={ariaLabelledby}
|
|
298
298
|
aria-describedby={ariaDescribedby}
|
|
299
299
|
aria-expanded={isOpen}
|
|
300
|
+
aria-required={options.required}
|
|
301
|
+
aria-invalid={ariaInvalid}
|
|
300
302
|
background={isOpen ? themeValues.hoverColor : WHITE}
|
|
301
303
|
borderRadius="2px"
|
|
302
304
|
borderSize="1px"
|
|
@@ -307,6 +309,7 @@ const Dropdown = ({
|
|
|
307
309
|
? themeValues.selectedColor
|
|
308
310
|
: GREY_CHATEAU
|
|
309
311
|
}
|
|
312
|
+
dataQa={placeholder}
|
|
310
313
|
extraStyles={
|
|
311
314
|
disabled
|
|
312
315
|
? `${inputPlaceholderTextStyle}${inputDisabledStyle}`
|
|
@@ -326,6 +329,7 @@ const Dropdown = ({
|
|
|
326
329
|
}}
|
|
327
330
|
padding="12px"
|
|
328
331
|
placeholder={getSelection()}
|
|
332
|
+
required={options.required}
|
|
329
333
|
role="combobox"
|
|
330
334
|
themeValues={themeValues}
|
|
331
335
|
title={hasTitles ? getSelection() : null}
|
|
@@ -333,10 +337,6 @@ const Dropdown = ({
|
|
|
333
337
|
tabIndex={0}
|
|
334
338
|
value={inputValue}
|
|
335
339
|
width="100%"
|
|
336
|
-
dataQa={placeholder}
|
|
337
|
-
required={options.required}
|
|
338
|
-
aria-required={options.required}
|
|
339
|
-
aria-invalid={ariaInvalid}
|
|
340
340
|
/>
|
|
341
341
|
<IconWrapper open={isOpen} onClick={onClick}>
|
|
342
342
|
<DropdownIcon />
|
|
@@ -384,7 +384,6 @@ const Dropdown = ({
|
|
|
384
384
|
themeValues={themeValues}
|
|
385
385
|
title={hasTitles ? choice.text : null}
|
|
386
386
|
onFocus={() => setFocusedRef(optionRefs.current[i])}
|
|
387
|
-
role="option"
|
|
388
387
|
>
|
|
389
388
|
<Text
|
|
390
389
|
variant="p"
|
|
@@ -219,7 +219,7 @@ const FormInput = ({
|
|
|
219
219
|
themeValues={themeValues}
|
|
220
220
|
$customHeight={customHeight}
|
|
221
221
|
$extraStyles={extraStyles}
|
|
222
|
-
data-qa={dataQa
|
|
222
|
+
data-qa={dataQa}
|
|
223
223
|
autoComplete={autocompleteValue}
|
|
224
224
|
{...props}
|
|
225
225
|
/>
|
|
@@ -245,7 +245,7 @@ const FormInput = ({
|
|
|
245
245
|
background={background}
|
|
246
246
|
$customHeight={customHeight}
|
|
247
247
|
$extraStyles={extraStyles}
|
|
248
|
-
data-qa={dataQa
|
|
248
|
+
data-qa={dataQa}
|
|
249
249
|
autoComplete={autocompleteValue}
|
|
250
250
|
{...props}
|
|
251
251
|
/>
|
|
@@ -21,9 +21,9 @@ const FormSelect = ({
|
|
|
21
21
|
disabled,
|
|
22
22
|
themeValues,
|
|
23
23
|
hasTitles = false,
|
|
24
|
-
autocompleteValue =
|
|
24
|
+
autocompleteValue = null, // browser autofill value, like country-name
|
|
25
25
|
smoothScroll = true, // whether the browser should animate scroll to selected item on first open
|
|
26
|
-
dataQa =
|
|
26
|
+
dataQa = null
|
|
27
27
|
}) => {
|
|
28
28
|
const [open, setOpen] = useState(false);
|
|
29
29
|
const dropdownRef = useRef(null);
|
|
@@ -42,7 +42,12 @@ const FormSelect = ({
|
|
|
42
42
|
});
|
|
43
43
|
|
|
44
44
|
return (
|
|
45
|
-
<SelectContainer
|
|
45
|
+
<SelectContainer
|
|
46
|
+
ref={dropdownRef}
|
|
47
|
+
disabled={disabled}
|
|
48
|
+
aria-disabled={disabled}
|
|
49
|
+
data-qa={dataQa}
|
|
50
|
+
>
|
|
46
51
|
<Box padding="0" minWidth="100%">
|
|
47
52
|
<Cluster justify="space-between" align="center">
|
|
48
53
|
<Text
|
|
@@ -62,7 +67,7 @@ const FormSelect = ({
|
|
|
62
67
|
</Cluster>
|
|
63
68
|
</Box>
|
|
64
69
|
<Dropdown
|
|
65
|
-
ariaLabelledby={labelTextWhenNoError}
|
|
70
|
+
ariaLabelledby={createIdFromString(labelTextWhenNoError)}
|
|
66
71
|
ariaDescribedBy={createIdFromString(
|
|
67
72
|
labelTextWhenNoError,
|
|
68
73
|
"error message"
|
|
@@ -10,8 +10,7 @@ const FormStateDropdown = ({
|
|
|
10
10
|
fieldActions,
|
|
11
11
|
showErrors,
|
|
12
12
|
countryCode,
|
|
13
|
-
autocompleteValue =
|
|
14
|
-
dataQa = "StateProvinceDropdown"
|
|
13
|
+
autocompleteValue = null
|
|
15
14
|
}) => {
|
|
16
15
|
const placeholder =
|
|
17
16
|
countryCode === "US" ? placeHolderOptionUS : placeHolderOption;
|
|
@@ -24,9 +23,7 @@ const FormStateDropdown = ({
|
|
|
24
23
|
labelTextWhenNoError={labelTextWhenNoError}
|
|
25
24
|
errorMessages={errorMessages}
|
|
26
25
|
showErrors={showErrors}
|
|
27
|
-
aria-invalid={!!errorMessages?.length}
|
|
28
26
|
autocompleteValue={autocompleteValue}
|
|
29
|
-
dataQa={dataQa}
|
|
30
27
|
/>
|
|
31
28
|
);
|
|
32
29
|
};
|
|
@@ -20,7 +20,8 @@ const AddressForm = ({
|
|
|
20
20
|
handleSubmit = noop,
|
|
21
21
|
showWalletCheckbox,
|
|
22
22
|
saveToWallet,
|
|
23
|
-
walletCheckboxMarked
|
|
23
|
+
walletCheckboxMarked,
|
|
24
|
+
dataQa = null
|
|
24
25
|
}) => {
|
|
25
26
|
if (clearOnDismount) {
|
|
26
27
|
useEffect(() => () => actions.form.clear(), []);
|
|
@@ -46,7 +47,12 @@ const AddressForm = ({
|
|
|
46
47
|
const isUS = fields.country.rawValue === "US";
|
|
47
48
|
|
|
48
49
|
return (
|
|
49
|
-
<FormContainer
|
|
50
|
+
<FormContainer
|
|
51
|
+
variant={variant}
|
|
52
|
+
role="form"
|
|
53
|
+
aria-label="Address"
|
|
54
|
+
dataQa={dataQa}
|
|
55
|
+
>
|
|
50
56
|
<FormInputColumn>
|
|
51
57
|
<CountryDropdown
|
|
52
58
|
labelTextWhenNoError="Country"
|
|
@@ -10,12 +10,11 @@ const TermsAndConditionsControlV1 = ({
|
|
|
10
10
|
html,
|
|
11
11
|
terms,
|
|
12
12
|
error = false,
|
|
13
|
-
linkVariant
|
|
14
|
-
dataQa = "TermsAndConditionsControlV1"
|
|
13
|
+
linkVariant
|
|
15
14
|
}) => {
|
|
16
15
|
const [showTerms, toggleShowTerms] = useState(false);
|
|
17
16
|
return (
|
|
18
|
-
<DisplayBox
|
|
17
|
+
<DisplayBox dataQa="TermsAndConditionsControlV1">
|
|
19
18
|
<Stack>
|
|
20
19
|
<Checkbox
|
|
21
20
|
name="terms"
|
|
@@ -26,8 +26,7 @@ const TermsAndConditionsControlV2 = ({
|
|
|
26
26
|
modalVariant = "default",
|
|
27
27
|
containerBackground = ATHENS_GREY,
|
|
28
28
|
checkboxMargin = "4px 8px 4px 4px",
|
|
29
|
-
modalTitle = "Terms and Conditions"
|
|
30
|
-
dataQa = "TermsAndConditionsControlV2"
|
|
29
|
+
modalTitle = "Terms and Conditions"
|
|
31
30
|
}) => {
|
|
32
31
|
const [showTerms, toggleShowTerms] = useState(false);
|
|
33
32
|
const standardBoxShadow = generateShadows().standard.base;
|
|
@@ -46,7 +45,7 @@ const TermsAndConditionsControlV2 = ({
|
|
|
46
45
|
background={displayInline ? "transparent" : containerBackground}
|
|
47
46
|
boxShadow={displayInline ? "none" : standardBoxShadow}
|
|
48
47
|
borderRadius={displayInline ? "0" : "4px"}
|
|
49
|
-
dataQa=
|
|
48
|
+
dataQa="TermsAndConditionsControlV2"
|
|
50
49
|
>
|
|
51
50
|
<Stack childGap="0">
|
|
52
51
|
{html && <Box padding="0">{html}</Box>}
|