@thecb/components 7.10.1-beta.5 → 7.10.1-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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thecb/components",
3
- "version": "7.10.1-beta.5",
3
+ "version": "7.10.1-beta.7",
4
4
  "description": "Common lib for CityBase react components",
5
5
  "main": "dist/index.cjs.js",
6
6
  "typings": "dist/index.d.ts",
@@ -8,6 +8,7 @@ import { Box, Cluster, Stack, Motion } from "../../atoms/layouts";
8
8
  import { noop } from "../../../util/general";
9
9
  import Text from "../../atoms/text";
10
10
  import { CHARADE_GREY } from "../../../constants/colors";
11
+ import { createIdFromString } from "../../../util/general";
11
12
  /*
12
13
  Takes an array of section objects, each object should look like:
13
14
  {
@@ -40,7 +41,8 @@ const RadioSection = ({
40
41
  toggleOpenSection,
41
42
  staggeredAnimation = false,
42
43
  initiallyOpen = true,
43
- openHeight = "auto"
44
+ openHeight = "auto",
45
+ ariaDescribedBy
44
46
  }) => {
45
47
  const handleKeyDown = (id, e) => {
46
48
  if (e?.keyCode === 13) {
@@ -157,7 +159,10 @@ const RadioSection = ({
157
159
  {!section.hideRadioButton && (
158
160
  <Box padding="0">
159
161
  <RadioButton
160
- name={section.id}
162
+ name={
163
+ createIdFromString(section.title) || section.id
164
+ }
165
+ ariaDescribedBy={ariaDescribedBy}
161
166
  radioOn={openSection === section.id}
162
167
  radioFocused={focused === section.id}
163
168
  toggleRadio={
@@ -16,6 +16,7 @@ const RadioButton = ({
16
16
  toggleRadio,
17
17
  name,
18
18
  disabled = false,
19
+ ariaDescribedBy = "",
19
20
  themeValues
20
21
  }) => {
21
22
  const buttonBorder = {
@@ -80,6 +81,7 @@ const RadioButton = ({
80
81
  aria-label={name}
81
82
  disabled={disabled}
82
83
  onClick={toggleRadio}
84
+ aria-describedby={ariaDescribedBy}
83
85
  tabIndex="-1"
84
86
  />
85
87
  <Motion