@thecb/components 9.1.2-beta.0 → 9.1.2-beta.2

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": "9.1.2-beta.0",
3
+ "version": "9.1.2-beta.2",
4
4
  "description": "Common lib for CityBase react components",
5
5
  "main": "dist/index.cjs.js",
6
6
  "typings": "dist/index.d.ts",
@@ -5,6 +5,7 @@ import ButtonWithLink from "../../atoms/button-with-link";
5
5
  import ButtonWithAction from "../../atoms/button-with-action";
6
6
  import { Box, Cluster } from "../../atoms/layouts";
7
7
  import SolidDivider from "../../atoms/solid-divider";
8
+ import { kebabCaseString } from "../../../util/general";
8
9
 
9
10
  const PaymentButtonBar = ({
10
11
  isForwardButtonDisabled = false,
@@ -12,6 +13,7 @@ const PaymentButtonBar = ({
12
13
  forwardButtonAction,
13
14
  forwardButtonLoading,
14
15
  forwardButtonVariant = "primary",
16
+ forwardButtonAriaRole = "button",
15
17
  backButtonVariant = "secondary",
16
18
  backButtonAction,
17
19
  cancelURL,
@@ -32,6 +34,7 @@ const PaymentButtonBar = ({
32
34
  variant={backButtonVariant}
33
35
  extraStyles={isMobile && "flex-grow: 1"}
34
36
  dataQa={cancelText}
37
+ aria-labelledby={`${kebabCaseString(cancelText)}-button`}
35
38
  role="link"
36
39
  />
37
40
  ) : (
@@ -42,6 +45,7 @@ const PaymentButtonBar = ({
42
45
  action={backButtonAction}
43
46
  extraStyles={isMobile && "flex-grow: 1"}
44
47
  dataQa="Back"
48
+ aria-labelledby="back-button"
45
49
  role="link"
46
50
  />
47
51
  )
@@ -55,7 +59,8 @@ const PaymentButtonBar = ({
55
59
  extraStyles={isMobile && "flex-grow: 1"}
56
60
  dataQa={redirectText}
57
61
  disabled={isForwardButtonDisabled}
58
- role="link"
62
+ aria-labelledby={`${kebabCaseString(redirectText)}-button`}
63
+ role={forwardButtonAriaRole}
59
64
  />
60
65
  ) : (
61
66
  forwardButtonAction && (
@@ -67,7 +72,8 @@ const PaymentButtonBar = ({
67
72
  extraStyles={isMobile && "flex-grow: 1"}
68
73
  dataQa={forwardButtonText}
69
74
  disabled={isForwardButtonDisabled}
70
- role="link"
75
+ aria-labelledby={`${kebabCaseString(forwardButtonText)}-button`}
76
+ role={forwardButtonAriaRole}
71
77
  />
72
78
  )
73
79
  );
@@ -159,3 +159,7 @@ export const titleCaseString = string => {
159
159
  )
160
160
  .join(" ");
161
161
  };
162
+
163
+ export const kebabCaseString = string => {
164
+ return string?.replaceAll(" ", "-").toLowerCase();
165
+ };