@thecb/components 12.1.0-beta.7 → 12.1.0-beta.8

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thecb/components",
3
- "version": "12.1.0-beta.7",
3
+ "version": "12.1.0-beta.8",
4
4
  "description": "Common lib for CityBase react components",
5
5
  "main": "dist/index.cjs.js",
6
6
  "typings": "dist/index.d.ts",
@@ -126,8 +126,11 @@ const Checkbox = forwardRef(
126
126
  const normalizedName = name ? name.replace(/\s+/g, "-") : name;
127
127
  const checkboxId = `checkbox-${normalizedName}`;
128
128
  const titleId = title ? `checkboxlabel-${normalizedName}` : undefined;
129
- // aria-label fallback when no visible title or external labelledById is provided
130
- const ariaLabel = !labelledById && !title ? name : undefined;
129
+ // aria-label: customAriaLabel wins, but only when no external labelledById is provided
130
+ // (aria-labelledby takes precedence per spec, so aria-label would be silently ignored)
131
+ const resolvedAriaLabel = labelledById
132
+ ? undefined
133
+ : customAriaLabel || (!title ? name : undefined);
131
134
 
132
135
  return (
133
136
  <Box
@@ -152,7 +155,7 @@ const Checkbox = forwardRef(
152
155
  tabIndex="0"
153
156
  required={isRequired}
154
157
  aria-invalid={error}
155
- aria-label={customAriaLabel || ariaLabel}
158
+ aria-label={resolvedAriaLabel}
156
159
  aria-labelledby={labelledById}
157
160
  aria-describedby={error ? `${name}-error-message` : undefined}
158
161
  onKeyDown={e => handleClick(e, onChange)}
@@ -56,7 +56,7 @@ const meta = {
56
56
  customAriaLabel: {
57
57
  table: {
58
58
  description:
59
- "Overrides the default aria-label. Useful when the checkbox needs a descriptive accessible name other than the `name` prop provides.",
59
+ "Overrides the default aria-label. Useful when the checkbox needs a descriptive accessible name other than the `name` prop provides.",
60
60
  type: { summary: "string" }
61
61
  }
62
62
  },
@@ -48,7 +48,9 @@ const Modal = ({
48
48
  children,
49
49
  dataQa = null,
50
50
  initialFocusSelector = "",
51
- blurUnderlay = true
51
+ blurUnderlay = true,
52
+ controlLabel = "",
53
+ controlExtraStyles = ""
52
54
  }) => {
53
55
  const { isMobile } = useContext(ThemeContext);
54
56
 
@@ -67,7 +69,13 @@ const Modal = ({
67
69
  const modalContainerRef = useRef("#react-aria-modal-dialog");
68
70
 
69
71
  return (
70
- <div ref={modalContainerRef} tabIndex="-1" data-qa={dataQa}>
72
+ <div
73
+ ref={modalContainerRef}
74
+ tabIndex="-1"
75
+ data-qa={dataQa}
76
+ style={{ display: "inline" }}
77
+ aria-label={controlLabel}
78
+ >
71
79
  {modalOpen && (
72
80
  <AriaModal
73
81
  focusTrapOptions={{
@@ -14,7 +14,6 @@ import {
14
14
  } from "../../atoms/form-layouts";
15
15
  import AccountAndRoutingModal from "../account-and-routing-modal";
16
16
  import { noop } from "../../../util/general";
17
- import { Cluster } from "../../atoms/layouts";
18
17
  import TermsAndConditions from "../terms-and-conditions";
19
18
  import TermsAndConditionsModal from "../terms-and-conditions-modal";
20
19
  import { useScrollTo } from "../../../hooks";
@@ -189,9 +188,12 @@ const PaymentFormACH = ({
189
188
  customAriaLabel="Save checking account to wallet (optional)."
190
189
  title={
191
190
  <>
192
- Save checking account to wallet (optional).{" "}
191
+ <span>Save checking account to wallet (optional). </span>
193
192
  {showTerms && (
194
- <span onClick={e => e.stopPropagation()}>
193
+ <span
194
+ onClick={e => e.stopPropagation()}
195
+ style={{ display: "inline" }}
196
+ >
195
197
  View{" "}
196
198
  <TermsAndConditionsModal
197
199
  link="Terms and Conditions"
@@ -199,7 +201,9 @@ const PaymentFormACH = ({
199
201
  isOpen={showTermsModal}
200
202
  toggleOpen={toggleTermsModal}
201
203
  initialFocusSelector=".modal-close-button"
202
- linkExtraStyles="display: inline-block;"
204
+ linkExtraStyles="display: inline;"
205
+ modalControlLabel="View Terms and Conditions"
206
+ modalControlExtraStyles="display: inline;"
203
207
  />
204
208
  </span>
205
209
  )}
@@ -27,7 +27,7 @@ import {
27
27
  FormContainer,
28
28
  FormInputRow
29
29
  } from "../../atoms/form-layouts";
30
- import { Box, Cluster } from "../../atoms/layouts";
30
+ import { Box } from "../../atoms/layouts";
31
31
  import withWindowSize from "../../withWindowSize";
32
32
  import TermsAndConditions from "../terms-and-conditions";
33
33
  import TermsAndConditionsModal from "../terms-and-conditions-modal";
@@ -213,9 +213,12 @@ const PaymentFormCard = ({
213
213
  customAriaLabel="Save credit card to wallet (optional)."
214
214
  title={
215
215
  <>
216
- Save credit card to wallet (optional).{" "}
216
+ <span>Save credit card to wallet (optional). </span>
217
217
  {showTerms && (
218
- <span onClick={e => e.stopPropagation()}>
218
+ <span
219
+ onClick={e => e.stopPropagation()}
220
+ style={{ display: "inline-block" }}
221
+ >
219
222
  View{" "}
220
223
  <TermsAndConditionsModal
221
224
  link="Terms and Conditions"
@@ -223,7 +226,9 @@ const PaymentFormCard = ({
223
226
  isOpen={showTermsModal}
224
227
  toggleOpen={toggleTermsModal}
225
228
  initialFocusSelector=".modal-close-button"
226
- linkExtraStyles="display: inline-block;"
229
+ linkExtraStyles="display: inline;"
230
+ modalControlLabel="View Terms and Conditions"
231
+ modalControlExtraStyles="display: inline;"
227
232
  />
228
233
  </span>
229
234
  )}
@@ -17,7 +17,9 @@ const TermsAndConditionsModal = ({
17
17
  linkVariant = "p",
18
18
  themeValues,
19
19
  initialFocusSelector = "",
20
- linkExtraStyles = ""
20
+ linkExtraStyles = "",
21
+ modalControlLabel,
22
+ modalControlExtraStyles = ""
21
23
  }) => (
22
24
  <Modal
23
25
  modalOpen={isOpen}
@@ -45,6 +47,8 @@ const TermsAndConditionsModal = ({
45
47
  toggleOpen(false);
46
48
  }}
47
49
  initialFocusSelector={initialFocusSelector}
50
+ controlLabel={modalControlLabel}
51
+ controlExtraStyles={modalControlExtraStyles}
48
52
  >
49
53
  <Text
50
54
  variant={linkVariant}