@thecb/components 10.7.2-beta.0 → 10.7.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": "10.7.2-beta.0",
3
+ "version": "10.7.2",
4
4
  "description": "Common lib for CityBase react components",
5
5
  "main": "dist/index.cjs.js",
6
6
  "typings": "dist/index.d.ts",
Binary file
@@ -7,7 +7,6 @@ import { ThemeContext } from "styled-components";
7
7
  import Module from "../../molecules/module/Module";
8
8
  import Spinner from "../spinner/Spinner";
9
9
  import { CHARADE_GREY } from "../../../constants/colors";
10
- import { noop } from "../../../util/general";
11
10
 
12
11
  const WalletName = ({
13
12
  mainText, // left side text
@@ -16,7 +15,9 @@ const WalletName = ({
16
15
  actionText = null, // right side hyperlinked text
17
16
  disableAction = false,
18
17
  linkButtonExtraStyles = "", // hyperlinked text extraStyles
19
- isLoading = false // shows a spinner on the left when true
18
+ isLoading = false, // shows a spinner on the left when true
19
+ dataQa = null,
20
+ actionTextPositionMobile = "outside" // whether action text is outside/below box or inside it
20
21
  }) => {
21
22
  const { isMobile } = useContext(ThemeContext);
22
23
 
@@ -49,7 +50,7 @@ const WalletName = ({
49
50
  mainText && <Text>{mainText}</Text>
50
51
  )}
51
52
  </Box>
52
- {!isMobile && (
53
+ {(actionTextPositionMobile === "inside" || !isMobile) && (
53
54
  <Box padding="0">
54
55
  {text && <Text variant="pXS">{text}</Text>}
55
56
  {(text || actionText) && <>&nbsp;</>}
@@ -57,6 +58,7 @@ const WalletName = ({
57
58
  <ButtonWithAction
58
59
  disabled={disableAction}
59
60
  text={actionText}
61
+ dataQa={dataQa}
60
62
  action={action}
61
63
  variant="smallGhost"
62
64
  extraStyles={`
@@ -71,7 +73,7 @@ const WalletName = ({
71
73
  )}
72
74
  </Cluster>
73
75
  </Module>
74
- {isMobile && (
76
+ {!!isMobile && actionTextPositionMobile === "outside" && (
75
77
  <Cluster
76
78
  align="center"
77
79
  justify={text || actionText ? "flex-end" : "flex-start"}
@@ -1,6 +1,6 @@
1
1
  import React from "react";
2
2
  import WalletName from "./WalletName";
3
- import { text, object, boolean } from "@storybook/addon-knobs";
3
+ import { text, object, boolean, select } from "@storybook/addon-knobs";
4
4
  import page from "../../../../.storybook/page";
5
5
 
6
6
  export const walletName = () => {
@@ -12,6 +12,31 @@ export const walletName = () => {
12
12
  text={text("text", "Not you?", "props")}
13
13
  disableAction={boolean("disableAction", false, "props")}
14
14
  isLoading={boolean("isLoading", false, "props")}
15
+ actionTextPositionMobile={select(
16
+ "actionTextPositionMobile",
17
+ { inside: "inside", outside: "outside" },
18
+ "outside",
19
+ "props"
20
+ )}
21
+ />
22
+ );
23
+ };
24
+
25
+ export const walletNameWithOverrides = () => {
26
+ return (
27
+ <WalletName
28
+ mainText={text("mainText", "Firstname Lastname", "props")}
29
+ action={object("action", () => window.alert("action fired!"), "props")}
30
+ actionText={text("actionText", "Check out as a guest", "props")}
31
+ text={text("text", "Not you?", "props")}
32
+ disableAction={boolean("disableAction", false, "props")}
33
+ isLoading={boolean("isLoading", false, "props")}
34
+ actionTextPositionMobile={select(
35
+ "actionTextPositionMobile",
36
+ { inside: "inside", outside: "outside" },
37
+ "outside",
38
+ "props"
39
+ )}
15
40
  />
16
41
  );
17
42
  };
@@ -9,6 +9,8 @@ export interface WalletNameProps {
9
9
  text?: string | null;
10
10
  isLoading: boolean;
11
11
  buttonExtraStyles?: string;
12
+ dataQa?: string | null;
13
+ actionTextPositionMobile?: "inside" | "outside";
12
14
  }
13
15
 
14
16
  export const WalletName: React.FC<Expand<WalletNameProps> &
@@ -25,7 +25,9 @@ const PaymentButtonBar = ({
25
25
  hideBackButton = false,
26
26
  buttonGroupStyles,
27
27
  hideAdditionalButton = false,
28
- additionalButton
28
+ additionalButton,
29
+ nextButtonTestId = null,
30
+ backButtonTestId = null
29
31
  }) => {
30
32
  const { isMobile } = useContext(ThemeContext);
31
33
 
@@ -36,7 +38,7 @@ const PaymentButtonBar = ({
36
38
  url={cancelURL}
37
39
  variant={backButtonVariant}
38
40
  extraStyles={isMobile && "flex-grow: 1"}
39
- dataQa={cancelText}
41
+ dataQa={backButtonTestId || cancelText}
40
42
  aria-labelledby={`${kebabCaseString(cancelText)}-button`}
41
43
  role="link"
42
44
  />
@@ -60,7 +62,7 @@ const PaymentButtonBar = ({
60
62
  text={redirectText}
61
63
  variant={forwardButtonVariant}
62
64
  extraStyles={isMobile && "flex-grow: 1"}
63
- dataQa={redirectText}
65
+ dataQa={nextButtonTestId || redirectText}
64
66
  disabled={isForwardButtonDisabled}
65
67
  aria-labelledby={`${kebabCaseString(redirectText)}-button`}
66
68
  role={forwardButtonAriaRole}
@@ -73,7 +75,7 @@ const PaymentButtonBar = ({
73
75
  action={forwardButtonAction}
74
76
  isLoading={forwardButtonLoading}
75
77
  extraStyles={isMobile && "flex-grow: 1"}
76
- dataQa={forwardButtonText}
78
+ dataQa={nextButtonTestId || forwardButtonText}
77
79
  disabled={isForwardButtonDisabled}
78
80
  aria-labelledby={`${kebabCaseString(forwardButtonText)}-button`}
79
81
  role={forwardButtonAriaRole}
@@ -58,6 +58,7 @@ const RadioSection = ({
58
58
  ariaDescribedBy,
59
59
  isSectionRequired = false,
60
60
  groupedSections,
61
+ borderOverride,
61
62
  ...rest
62
63
  }) => {
63
64
  const [focused, setFocused] = useState(null);
@@ -98,7 +99,7 @@ const RadioSection = ({
98
99
  return (
99
100
  <Box
100
101
  padding="1px"
101
- border={`1px solid ${themeValues.borderColor}`}
102
+ border={borderOverride || `1px solid ${themeValues.borderColor}`}
102
103
  borderRadius="4px"
103
104
  extraStyles={containerStyles}
104
105
  role="radiogroup"
@@ -31,7 +31,7 @@ const ToastNotification = ({
31
31
  height = "56px",
32
32
  childGap = "1rem",
33
33
  backgroundColor,
34
- role = "log",
34
+ role = "status",
35
35
  ariaLive = "polite",
36
36
  screenReaderMessage,
37
37
  showScreenReaderMessage = true,