@thecb/components 12.1.0-beta.4 → 12.1.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thecb/components",
3
- "version": "12.1.0-beta.4",
3
+ "version": "12.1.0-beta.6",
4
4
  "description": "Common lib for CityBase react components",
5
5
  "main": "dist/index.cjs.js",
6
6
  "typings": "dist/index.d.ts",
@@ -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).{" "}
@@ -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).{" "}