@thecb/components 12.1.0-beta.4 → 12.1.0-beta.7
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 +13 -6
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +13 -6
- 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/checkbox/Checkbox.stories.js +16 -0
- package/src/components/molecules/payment-form-ach/PaymentFormACH.js +2 -0
- package/src/components/molecules/payment-form-card/PaymentFormCard.js +2 -0
- package/src/components/molecules/terms-and-conditions-modal/TermsAndConditionsModal.js +3 -2
package/package.json
CHANGED
|
@@ -109,6 +109,7 @@ const Checkbox = forwardRef(
|
|
|
109
109
|
dataQa = null,
|
|
110
110
|
checkboxExtraStyles,
|
|
111
111
|
hasIconOverride = false,
|
|
112
|
+
customAriaLabel,
|
|
112
113
|
icon: Icon,
|
|
113
114
|
...rest
|
|
114
115
|
},
|
|
@@ -151,7 +152,7 @@ const Checkbox = forwardRef(
|
|
|
151
152
|
tabIndex="0"
|
|
152
153
|
required={isRequired}
|
|
153
154
|
aria-invalid={error}
|
|
154
|
-
aria-label={ariaLabel}
|
|
155
|
+
aria-label={customAriaLabel || ariaLabel}
|
|
155
156
|
aria-labelledby={labelledById}
|
|
156
157
|
aria-describedby={error ? `${name}-error-message` : undefined}
|
|
157
158
|
onKeyDown={e => handleClick(e, onChange)}
|
|
@@ -21,6 +21,7 @@ const meta = {
|
|
|
21
21
|
extraStyles: undefined,
|
|
22
22
|
textExtraStyles: undefined,
|
|
23
23
|
labelledById: undefined,
|
|
24
|
+
customAriaLabel: undefined,
|
|
24
25
|
dataQa: null
|
|
25
26
|
},
|
|
26
27
|
argTypes: {
|
|
@@ -52,6 +53,13 @@ const meta = {
|
|
|
52
53
|
type: { summary: "string" }
|
|
53
54
|
}
|
|
54
55
|
},
|
|
56
|
+
customAriaLabel: {
|
|
57
|
+
table: {
|
|
58
|
+
description:
|
|
59
|
+
"Overrides the default aria-label. Useful when the checkbox needs a descriptive accessible name other than the `name` prop provides.",
|
|
60
|
+
type: { summary: "string" }
|
|
61
|
+
}
|
|
62
|
+
},
|
|
55
63
|
extraStyles: {
|
|
56
64
|
table: {
|
|
57
65
|
type: { summary: "string" }
|
|
@@ -153,3 +161,11 @@ export const Hidden = {
|
|
|
153
161
|
},
|
|
154
162
|
render: args => <CheckboxWithHooks {...args} />
|
|
155
163
|
};
|
|
164
|
+
|
|
165
|
+
export const WithCustomAriaLabel = {
|
|
166
|
+
args: {
|
|
167
|
+
customAriaLabel: "Custom aria label",
|
|
168
|
+
title: "A different label"
|
|
169
|
+
},
|
|
170
|
+
render: args => <CheckboxWithHooks {...args} />
|
|
171
|
+
};
|
|
@@ -186,6 +186,7 @@ const PaymentFormACH = ({
|
|
|
186
186
|
<Checkbox
|
|
187
187
|
name="bank checkbox"
|
|
188
188
|
dataQa="Save checking account to wallet"
|
|
189
|
+
customAriaLabel="Save checking account to wallet (optional)."
|
|
189
190
|
title={
|
|
190
191
|
<>
|
|
191
192
|
Save checking account to wallet (optional).{" "}
|
|
@@ -198,6 +199,7 @@ const PaymentFormACH = ({
|
|
|
198
199
|
isOpen={showTermsModal}
|
|
199
200
|
toggleOpen={toggleTermsModal}
|
|
200
201
|
initialFocusSelector=".modal-close-button"
|
|
202
|
+
linkExtraStyles="display: inline-block;"
|
|
201
203
|
/>
|
|
202
204
|
</span>
|
|
203
205
|
)}
|
|
@@ -210,6 +210,7 @@ const PaymentFormCard = ({
|
|
|
210
210
|
<Checkbox
|
|
211
211
|
name="credit card checkbox"
|
|
212
212
|
dataQa="Save credit card to wallet"
|
|
213
|
+
customAriaLabel="Save credit card to wallet (optional)."
|
|
213
214
|
title={
|
|
214
215
|
<>
|
|
215
216
|
Save credit card to wallet (optional).{" "}
|
|
@@ -222,6 +223,7 @@ const PaymentFormCard = ({
|
|
|
222
223
|
isOpen={showTermsModal}
|
|
223
224
|
toggleOpen={toggleTermsModal}
|
|
224
225
|
initialFocusSelector=".modal-close-button"
|
|
226
|
+
linkExtraStyles="display: inline-block;"
|
|
225
227
|
/>
|
|
226
228
|
</span>
|
|
227
229
|
)}
|
|
@@ -16,7 +16,8 @@ const TermsAndConditionsModal = ({
|
|
|
16
16
|
variant,
|
|
17
17
|
linkVariant = "p",
|
|
18
18
|
themeValues,
|
|
19
|
-
initialFocusSelector = ""
|
|
19
|
+
initialFocusSelector = "",
|
|
20
|
+
linkExtraStyles = ""
|
|
20
21
|
}) => (
|
|
21
22
|
<Modal
|
|
22
23
|
modalOpen={isOpen}
|
|
@@ -54,7 +55,7 @@ const TermsAndConditionsModal = ({
|
|
|
54
55
|
weight={themeValues.fontWeight}
|
|
55
56
|
hoverStyles={themeValues.modalLinkHoverFocus}
|
|
56
57
|
textDecoration={themeValues.modalLinkTextDecoration}
|
|
57
|
-
extraStyles={`display: inline-block; width: fit-content; cursor: pointer; min-height: 24px; line-height: 24px
|
|
58
|
+
extraStyles={`display: inline-block; width: fit-content; cursor: pointer; min-height: 24px; line-height: 24px; ${linkExtraStyles}`}
|
|
58
59
|
role="button" // This should always be a "button" since it opens a modal
|
|
59
60
|
className="modal-trigger"
|
|
60
61
|
>
|