@thecb/components 9.2.10-beta.1 → 9.2.10-beta.11
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 +35 -20
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +35 -20
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/atoms/checkbox/Checkbox.js +12 -3
- package/src/components/atoms/checkbox/Checkbox.stories.js +5 -0
- package/src/components/molecules/account-and-routing-modal/AccountAndRoutingModal.js +1 -0
- package/src/components/molecules/modal/Modal.js +2 -3
- package/src/components/molecules/payment-form-ach/PaymentFormACH.js +1 -0
- package/src/components/molecules/payment-form-card/PaymentFormCard.js +1 -0
- package/src/components/molecules/terms-and-conditions/TermsAndConditions.js +1 -6
- package/src/components/molecules/terms-and-conditions/TermsAndConditions.stories.js +14 -4
- package/src/components/molecules/terms-and-conditions/TermsAndConditionsControlV1.js +3 -1
- package/src/components/molecules/terms-and-conditions/TermsAndConditionsControlV2.js +3 -1
package/package.json
CHANGED
|
@@ -33,7 +33,7 @@ const CheckboxIcon = styled.svg`
|
|
|
33
33
|
const HiddenCheckbox = styled.input.attrs({ type: "checkbox" })`
|
|
34
34
|
border: 0;
|
|
35
35
|
clip: rect(0 0 0 0);
|
|
36
|
-
|
|
36
|
+
clip-path: inset(50%);
|
|
37
37
|
height: 1px;
|
|
38
38
|
margin: -1px;
|
|
39
39
|
overflow: hidden;
|
|
@@ -95,7 +95,8 @@ const Checkbox = ({
|
|
|
95
95
|
checkboxMargin = "0 16px 0 0",
|
|
96
96
|
extraStyles,
|
|
97
97
|
textExtraStyles,
|
|
98
|
-
dataQa = null
|
|
98
|
+
dataQa = null,
|
|
99
|
+
checkboxAriaLabel = ""
|
|
99
100
|
}) => {
|
|
100
101
|
const [focused, setFocused] = useState(false);
|
|
101
102
|
|
|
@@ -105,6 +106,10 @@ const Checkbox = ({
|
|
|
105
106
|
}
|
|
106
107
|
};
|
|
107
108
|
|
|
109
|
+
const checkboxProps = {
|
|
110
|
+
...(checkboxAriaLabel ? { "aria-label": checkboxAriaLabel } : {})
|
|
111
|
+
};
|
|
112
|
+
|
|
108
113
|
return (
|
|
109
114
|
<Box
|
|
110
115
|
padding="0"
|
|
@@ -122,7 +127,7 @@ const Checkbox = ({
|
|
|
122
127
|
id={`checkbox-${name}`}
|
|
123
128
|
disabled={disabled}
|
|
124
129
|
name={name}
|
|
125
|
-
aria-label={
|
|
130
|
+
aria-label={checkboxAriaLabel || `${title} checkbox`}
|
|
126
131
|
checked={checked}
|
|
127
132
|
onChange={onChange}
|
|
128
133
|
tabIndex="-1"
|
|
@@ -131,8 +136,11 @@ const Checkbox = ({
|
|
|
131
136
|
/>
|
|
132
137
|
<StyledCheckbox
|
|
133
138
|
role="checkbox"
|
|
139
|
+
name={name}
|
|
134
140
|
error={error}
|
|
141
|
+
aria-invalid={error}
|
|
135
142
|
disabled={disabled}
|
|
143
|
+
aria-disabled={disabled}
|
|
136
144
|
checked={checked}
|
|
137
145
|
aria-checked={checked}
|
|
138
146
|
focused={focused}
|
|
@@ -142,6 +150,7 @@ const Checkbox = ({
|
|
|
142
150
|
disabledStyles={themeValues.disabledStyles}
|
|
143
151
|
disabledCheckedStyles={themeValues.disabledCheckedStyles}
|
|
144
152
|
focusedStyles={themeValues.focusedStyles}
|
|
153
|
+
{...checkboxProps}
|
|
145
154
|
>
|
|
146
155
|
<CheckboxIcon
|
|
147
156
|
viewBox="0 0 24 24"
|
|
@@ -19,6 +19,11 @@ export const checkbox = () => (
|
|
|
19
19
|
error={boolean("error", false, "props")}
|
|
20
20
|
disabled={boolean("disabled", false, "props")}
|
|
21
21
|
focused={boolean("focused", false, "props")}
|
|
22
|
+
checkboxAriaLabel={text(
|
|
23
|
+
"checkboxAriaLabel",
|
|
24
|
+
"Checkbox Label Prop",
|
|
25
|
+
groupId
|
|
26
|
+
)}
|
|
22
27
|
/>
|
|
23
28
|
);
|
|
24
29
|
|
|
@@ -46,8 +46,7 @@ const Modal = ({
|
|
|
46
46
|
buttonExtraStyles,
|
|
47
47
|
children,
|
|
48
48
|
dataQa = null,
|
|
49
|
-
initialFocusSelector = ""
|
|
50
|
-
modalName = ""
|
|
49
|
+
initialFocusSelector = ""
|
|
51
50
|
}) => {
|
|
52
51
|
const { isMobile } = useContext(ThemeContext);
|
|
53
52
|
const modalContainerRef = useRef(null);
|
|
@@ -75,8 +74,8 @@ const Modal = ({
|
|
|
75
74
|
}}
|
|
76
75
|
underlayClickExits={underlayClickExits}
|
|
77
76
|
aria-modal={true}
|
|
78
|
-
aria-name={!!modalName.length ? modalName : modalHeaderText}
|
|
79
77
|
initialFocus={initialFocusSelector}
|
|
78
|
+
focusDialog={!initialFocusSelector} // Focus the dialogue box itself if no selector for initial focus was provided
|
|
80
79
|
>
|
|
81
80
|
<Box
|
|
82
81
|
padding="0"
|
|
@@ -8,12 +8,7 @@ const TermsAndConditions = ({ version = "v1", ...rest }) => {
|
|
|
8
8
|
? TermsAndConditionsControlV1
|
|
9
9
|
: TermsAndConditionsControlV2;
|
|
10
10
|
|
|
11
|
-
return
|
|
12
|
-
<TermsAndConditionsControl
|
|
13
|
-
initialFocusSelector="[role='button']:not(.modal-trigger)"
|
|
14
|
-
{...rest}
|
|
15
|
-
/>
|
|
16
|
-
);
|
|
11
|
+
return <TermsAndConditionsControl {...rest} />;
|
|
17
12
|
};
|
|
18
13
|
|
|
19
14
|
export default TermsAndConditions;
|
|
@@ -9,7 +9,18 @@ const groupId = "props";
|
|
|
9
9
|
|
|
10
10
|
const Terms = () => (
|
|
11
11
|
<p>
|
|
12
|
-
|
|
12
|
+
Modal Content: Elit voluptate cupidatat in pariatur anim in excepteur non.{" "}
|
|
13
|
+
<a href="#modal-bottom" id="focus-me">
|
|
14
|
+
Laboris elit laboris labore pariatur incididunt
|
|
15
|
+
</a>{" "}
|
|
16
|
+
proident occaecat laboris sit elit. Dolor irure enim adipisicing irure
|
|
17
|
+
consectetur dolor enim eiusmod elit eiusmod ut. Pariatur ut quis et pariatur
|
|
18
|
+
nulla nostrud sit esse. Veniam est occaecat cupidatat est nulla dolor minim
|
|
19
|
+
nostrud anim ea voluptate. modal content. Elit voluptate cupidatat in
|
|
20
|
+
pariatur anim in excepteur non. Laboris elit laboris labore pariatur
|
|
21
|
+
incididunt proident occaecat laboris sit elit. Dolor irure enim adipisicing
|
|
22
|
+
irure consectetur dolor enim eiusmod elit eiusmod ut. Pariatur ut quis et
|
|
23
|
+
pariatur nulla nostrud sit esse.
|
|
13
24
|
</p>
|
|
14
25
|
);
|
|
15
26
|
|
|
@@ -17,11 +28,10 @@ export const termsAndConditions = () => (
|
|
|
17
28
|
<TermsAndConditions
|
|
18
29
|
onCheck={noop}
|
|
19
30
|
isChecked={boolean("isChecked", false, groupId)}
|
|
20
|
-
html={text("html", "Terms and Conditions html", groupId)}
|
|
21
|
-
modalName="Terms and Conditions Modal"
|
|
22
31
|
terms={<Terms />}
|
|
23
32
|
error={boolean("error", false, groupId)}
|
|
24
|
-
initialFocusSelector="
|
|
33
|
+
initialFocusSelector={text("initialFocusSelector", "#focus-me", groupId)}
|
|
34
|
+
checkboxAriaLabel="I agree to the Terms and Conditions"
|
|
25
35
|
/>
|
|
26
36
|
);
|
|
27
37
|
|
|
@@ -11,7 +11,8 @@ const TermsAndConditionsControlV1 = ({
|
|
|
11
11
|
terms,
|
|
12
12
|
error = false,
|
|
13
13
|
linkVariant,
|
|
14
|
-
initialFocusSelector = ""
|
|
14
|
+
initialFocusSelector = "",
|
|
15
|
+
checkboxAriaLabel = ""
|
|
15
16
|
}) => {
|
|
16
17
|
const [showTerms, toggleShowTerms] = useState(false);
|
|
17
18
|
return (
|
|
@@ -23,6 +24,7 @@ const TermsAndConditionsControlV1 = ({
|
|
|
23
24
|
error={error}
|
|
24
25
|
checked={isChecked}
|
|
25
26
|
onChange={onCheck}
|
|
27
|
+
aria-label={checkboxAriaLabel}
|
|
26
28
|
/>
|
|
27
29
|
<Box padding="0 0 0 58px">
|
|
28
30
|
<Stack>
|
|
@@ -27,7 +27,8 @@ const TermsAndConditionsControlV2 = ({
|
|
|
27
27
|
containerBackground = ATHENS_GREY,
|
|
28
28
|
checkboxMargin = "4px 8px 4px 4px",
|
|
29
29
|
modalTitle = "Terms and Conditions",
|
|
30
|
-
initialFocusSelector = ""
|
|
30
|
+
initialFocusSelector = "",
|
|
31
|
+
checkboxAriaLabel = ""
|
|
31
32
|
}) => {
|
|
32
33
|
const [showTerms, toggleShowTerms] = useState(false);
|
|
33
34
|
const standardBoxShadow = generateShadows().standard.base;
|
|
@@ -58,6 +59,7 @@ const TermsAndConditionsControlV2 = ({
|
|
|
58
59
|
onChange={onCheck}
|
|
59
60
|
checkboxMargin={checkboxMargin}
|
|
60
61
|
extraStyles={`align-self: flex-start;`}
|
|
62
|
+
aria-label={checkboxAriaLabel}
|
|
61
63
|
/>
|
|
62
64
|
)}
|
|
63
65
|
<Stack childGap="0.25rem" fullHeight>
|