@thecb/components 11.8.0-beta.3 → 11.8.0-beta.4

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": "11.8.0-beta.3",
3
+ "version": "11.8.0-beta.4",
4
4
  "description": "Common lib for CityBase react components",
5
5
  "main": "dist/index.cjs.js",
6
6
  "typings": "dist/index.d.ts",
@@ -1,8 +1,10 @@
1
1
  import {
2
2
  APRICOT_ORANGE,
3
+ INFO_BLUE,
3
4
  BLUSH_RED,
4
5
  HINT_GREEN,
5
6
  ZEST_ORANGE,
7
+ MATISSE_BLUE,
6
8
  RAZZMATAZZ_RED,
7
9
  EMERALD_GREEN,
8
10
  MUSTARD_YELLOW,
@@ -14,20 +16,18 @@ import {
14
16
  THUNDERBIRD_RED,
15
17
  HAZE_GREEN,
16
18
  ZODIAC_BLUE,
17
- SCIENCE_BLUE,
18
- LUCKY_POINT,
19
- HAWKES_BLUE
19
+ SCIENCE_BLUE
20
20
  } from "../../../constants/colors";
21
21
 
22
22
  const background = {
23
- info: `${HAWKES_BLUE}`,
23
+ info: `${INFO_BLUE}`,
24
24
  warn: `${APRICOT_ORANGE}`,
25
25
  error: `${BLUSH_RED}`,
26
26
  success: `${HINT_GREEN}`
27
27
  };
28
28
 
29
29
  const border = {
30
- info: `${LUCKY_POINT}`,
30
+ info: `${MATISSE_BLUE}`,
31
31
  warn: `${ZEST_ORANGE}`,
32
32
  error: `${RAZZMATAZZ_RED}`,
33
33
  success: `${EMERALD_GREEN}`
@@ -31,15 +31,20 @@ const PaymentButtonBar = ({
31
31
  }) => {
32
32
  const { isMobile } = useContext(ThemeContext);
33
33
 
34
+ // cancel URLs are external (back to client system)
35
+ const handleCancel = () => {
36
+ window.location.href = cancelURL;
37
+ };
38
+
34
39
  const backButton =
35
40
  !!cancelURL && !!cancelText ? (
36
- <ButtonWithLink
41
+ <ButtonWithAction
37
42
  text={cancelText}
38
- url={cancelURL}
43
+ action={handleCancel}
39
44
  variant={backButtonVariant}
40
45
  extraStyles={isMobile && "flex-grow: 1"}
41
46
  dataQa={backButtonTestId || cancelText}
42
- aria-labelledby={`${kebabCaseString(cancelText)}-button`}
47
+ aria-label={`${cancelText}, navigate back to previous site`}
43
48
  role="link"
44
49
  />
45
50
  ) : (
@@ -50,7 +55,7 @@ const PaymentButtonBar = ({
50
55
  action={backButtonAction}
51
56
  extraStyles={isMobile && "flex-grow: 1"}
52
57
  dataQa="Back"
53
- aria-labelledby="back-button"
58
+ aria-label={"Back, navigate to previous page"}
54
59
  role="link"
55
60
  />
56
61
  )
@@ -7,8 +7,8 @@ import ButtonWithAction from "../../atoms/button-with-action";
7
7
  import { noop } from "../../../util/general";
8
8
  import { ESCAPE } from "../../../constants/keyboard";
9
9
  import { fallbackValues } from "./Tooltip.theme";
10
- import IconAdd from "../../atoms/icons/IconAdd";
11
- import { BLACK } from "../../../constants/colors";
10
+ import WarningIconXS from "../../atoms/icons/WarningIconXS";
11
+ import { SELECTIVE_YELLOW } from "../../../constants/colors";
12
12
 
13
13
  const arrowBorder = (borderColor, direction, width = "8px") => {
14
14
  const angle = `${width} solid transparent`;
@@ -29,32 +29,36 @@ const Tooltip = ({
29
29
  triggerText = "",
30
30
  content = "",
31
31
  hasIconTrigger = false,
32
- IconTrigger = IconAdd,
32
+ IconTrigger = WarningIconXS,
33
33
  iconHelpText = "",
34
- tooltipID = 0,
35
- extraStyles,
34
+ tooltipID = "tooltip-content",
35
+ extraStyles = "",
36
36
  textExtraStyles = "",
37
37
  minWidth = "250px",
38
38
  maxWidth = "300px",
39
39
  height = "auto",
40
- position,
41
- arrowPosition,
42
40
  arrowDirection = "down",
43
- transform = "none",
41
+ arrowPosition = {
42
+ arrowTop: "auto",
43
+ arrowRight: "10px",
44
+ arrowBottom: "-8px",
45
+ arrowLeft: "auto"
46
+ },
47
+ position = {
48
+ top: "-110px",
49
+ right: "auto",
50
+ bottom: "auto",
51
+ left: "-225px"
52
+ },
53
+ iconColor = SELECTIVE_YELLOW,
44
54
  buttonExtraStyles,
45
55
  backgroundColor = "white",
46
56
  borderColor = "rgba(255, 255, 255, 0.85)",
47
- tooltipExtraStyles
57
+ tooltipContentExtraStyles
48
58
  }) => {
49
59
  const { hoverColor, activeColor, tooltipTriggerColor } = themeValues;
50
- const { top = "-110px", right = "auto", bottom = "auto", left = "-225px" } =
51
- position ?? {};
52
- const {
53
- arrowTop = "auto",
54
- arrowRight = "10px",
55
- arrowBottom = "-8px",
56
- arrowLeft = "auto"
57
- } = arrowPosition ?? {};
60
+ const { top, right, bottom, left } = position ?? {};
61
+ const { arrowTop, arrowRight, arrowBottom, arrowLeft } = arrowPosition ?? {};
58
62
 
59
63
  const [tooltipOpen, setTooltipOpen] = useState(false);
60
64
 
@@ -89,8 +93,10 @@ const Tooltip = ({
89
93
  >
90
94
  {hasIconTrigger && (
91
95
  <>
92
- <IconTrigger stroke={BLACK} />
93
- <Box padding="0" srOnly>
96
+ <Box aria-label="Trigger Popover">
97
+ <IconTrigger color={iconColor} />
98
+ </Box>
99
+ <Box padding="0" srOnly aria-hidden="true">
94
100
  <Text>{iconHelpText}</Text>
95
101
  </Box>
96
102
  </>
@@ -107,6 +113,7 @@ const Tooltip = ({
107
113
  role="tooltip"
108
114
  minWidth={minWidth}
109
115
  maxWidth={maxWidth}
116
+ aria-hidden={!tooltipOpen}
110
117
  extraStyles={`
111
118
  display: ${tooltipOpen ? "block" : "none"};
112
119
  position: absolute;
@@ -115,8 +122,7 @@ const Tooltip = ({
115
122
  bottom: ${bottom};
116
123
  left: ${left};
117
124
  height: ${height};
118
- transform: ${transform};
119
- ${tooltipExtraStyles};
125
+ ${tooltipContentExtraStyles};
120
126
  `}
121
127
  >
122
128
  <Paragraph>{content}</Paragraph>
@@ -1,6 +1,5 @@
1
1
  import Tooltip from "./Tooltip";
2
- import IconAdd from "../../atoms/icons/IconAdd";
3
-
2
+ import WarningIconXS from "../../atoms/icons/WarningIconXS";
4
3
  export default {
5
4
  title: "Molecules/Tooltip",
6
5
  component: Tooltip,
@@ -13,7 +12,7 @@ export default {
13
12
  triggerText: "",
14
13
  content: "",
15
14
  hasIconTrigger: false,
16
- IconTrigger: IconAdd,
15
+ IconTrigger: WarningIconXS,
17
16
  iconHelpText: "",
18
17
  tooltipID: 0,
19
18
  extraStyles: undefined,
@@ -59,7 +58,7 @@ export default {
59
58
  "The icon component to display. Requires hasIcon to be true.",
60
59
  table: {
61
60
  type: { summary: "React Component" },
62
- defaultValue: { summary: "IconAdd" }
61
+ defaultValue: { summary: "WarningIconXS" }
63
62
  }
64
63
  },
65
64
  iconHelpText: {
@@ -186,7 +185,7 @@ export const BasicTooltip = {
186
185
  export const IconTooltip = {
187
186
  args: {
188
187
  hasIconTrigger: true,
189
- IconTrigger: IconAdd,
188
+ IconTrigger: WarningIconXS,
190
189
  content:
191
190
  "Contact support at 1-800-CTY-VILL for help with your account balance."
192
191
  }
@@ -31,7 +31,7 @@ export const AlertInfoIcon = () => (
31
31
  </mask>
32
32
  <use
33
33
  id="background-2"
34
- fill="#281978"
34
+ fill="#15749d"
35
35
  fillRule="nonzero"
36
36
  xlinkHref="#path-1"
37
37
  ></use>