@thecb/components 10.6.9-beta.1 → 10.6.9-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": "10.6.9-beta.1",
3
+ "version": "10.6.9-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",
@@ -357,7 +357,7 @@ const Dropdown = ({
357
357
  setInputChangedByAutofill(true);
358
358
  }
359
359
  }}
360
- padding="12px"
360
+ padding="12px 25px 12px 12px"
361
361
  placeholder={getSelection()}
362
362
  required={options.required || isRequired}
363
363
  role="combobox"
@@ -2,45 +2,27 @@ import React from "react";
2
2
 
3
3
  export const CloseIcon = ({
4
4
  iconFill = "#3B414D",
5
- iconWidth = "24",
6
- iconHeight = "24",
5
+ iconWidth = "24px",
6
+ iconHeight = "24px",
7
7
  ...rest
8
8
  }) => {
9
9
  return (
10
10
  <svg
11
11
  xmlns="http://www.w3.org/2000/svg"
12
- width={iconWidth}
13
- height={iconHeight}
14
- viewBox="0 0 24 24"
12
+ width="24"
13
+ height="25"
14
+ viewBox="0 0 24 25"
15
15
  fill="none"
16
+ style={{ width: iconWidth, height: iconHeight }}
16
17
  {...rest}
17
18
  >
18
19
  <title>Close Icon</title>
19
20
  <path
20
21
  fillRule="evenodd"
21
22
  clipRule="evenodd"
22
- d="M17.3033 5.98982C17.108 5.79456 16.7915 5.79456 16.5962 5.98982L12 10.586L7.40381 5.98982C7.20854 5.79456 6.89196 5.79456 6.6967 5.98982L5.98959 6.69693C5.79433 6.89219 5.79433 7.20878 5.98959 7.40404L10.5858 12.0002L5.98959 16.5964C5.79433 16.7917 5.79433 17.1083 5.98959 17.3035L6.6967 18.0106C6.89196 18.2059 7.20854 18.2059 7.40381 18.0106L12 13.4144L16.5962 18.0106C16.7915 18.2059 17.108 18.2059 17.3033 18.0106L18.0104 17.3035C18.2057 17.1083 18.2057 16.7917 18.0104 16.5964L13.4142 12.0002L18.0104 7.40404C18.2057 7.20878 18.2057 6.89219 18.0104 6.69693L17.3033 5.98982Z"
23
+ d="M17.3033 6.48982C17.108 6.29456 16.7915 6.29456 16.5962 6.48982L12 11.086L7.40381 6.48982C7.20854 6.29456 6.89196 6.29456 6.6967 6.48982L5.98959 7.19693C5.79433 7.39219 5.79433 7.70878 5.98959 7.90404L10.5858 12.5002L5.98959 17.0964C5.79433 17.2917 5.79433 17.6083 5.98959 17.8035L6.6967 18.5106C6.89196 18.7059 7.20854 18.7059 7.40381 18.5106L12 13.9144L16.5962 18.5106C16.7915 18.7059 17.108 18.7059 17.3033 18.5106L18.0104 17.8035C18.2057 17.6083 18.2057 17.2917 18.0104 17.0964L13.4142 12.5002L18.0104 7.90404C18.2057 7.70878 18.2057 7.39219 18.0104 7.19693L17.3033 6.48982Z"
23
24
  fill={iconFill}
24
25
  />
25
- <mask
26
- id="mask0_3727_16765"
27
- style={{ maskType: "luminance" }}
28
- maskUnits="userSpaceOnUse"
29
- x="5"
30
- y="5"
31
- width="14"
32
- height="14"
33
- >
34
- <path
35
- fillRule="evenodd"
36
- clipRule="evenodd"
37
- d="M17.3033 5.98982C17.108 5.79456 16.7915 5.79456 16.5962 5.98982L12 10.586L7.40381 5.98982C7.20854 5.79456 6.89196 5.79456 6.6967 5.98982L5.98959 6.69693C5.79433 6.89219 5.79433 7.20878 5.98959 7.40404L10.5858 12.0002L5.98959 16.5964C5.79433 16.7917 5.79433 17.1083 5.98959 17.3035L6.6967 18.0106C6.89196 18.2059 7.20854 18.2059 7.40381 18.0106L12 13.4144L16.5962 18.0106C16.7915 18.2059 17.108 18.2059 17.3033 18.0106L18.0104 17.3035C18.2057 17.1083 18.2057 16.7917 18.0104 16.5964L13.4142 12.0002L18.0104 7.40404C18.2057 7.20878 18.2057 6.89219 18.0104 6.69693L17.3033 5.98982Z"
38
- fill="none"
39
- />
40
- </mask>
41
- <g mask="url(#mask0_3727_16765)">
42
- <path d="M0 0H24V24H0V0Z" fill={iconFill} />
43
- </g>
44
26
  </svg>
45
27
  );
46
28
  };
@@ -141,7 +141,11 @@ const Modal = ({
141
141
  {modalHeaderText}
142
142
  </Title>
143
143
  {showCloseIconButton && (
144
- <CloseIconButton hideModal={hideModal} />
144
+ <CloseIconButton
145
+ hideModal={hideModal}
146
+ iconHeight={isMobile ? "20px" : "24px"}
147
+ iconWidth={isMobile ? "20px" : "24px"}
148
+ />
145
149
  )}
146
150
  </Cluster>
147
151
  </Box>
@@ -6,8 +6,8 @@ import { CloseIcon } from "../../../atoms/icons/CloseIcon";
6
6
  export const CloseIconButton = ({
7
7
  buttonExtraStyles = "",
8
8
  hideModal = noop,
9
- iconWidth = "24",
10
- iconHeight = "24",
9
+ iconWidth = "24px",
10
+ iconHeight = "24px",
11
11
  ariaLabel = "Close Modal"
12
12
  }) => {
13
13
  return (
@@ -162,9 +162,7 @@ const PaymentDetailsActions = ({
162
162
  <Box padding="8px 0 0" width="100%">
163
163
  <ButtonWithAction
164
164
  isLoading={isLoading}
165
- action={() =>
166
- disableActions ? noop : () => handleClick(obligations)
167
- }
165
+ action={disableActions ? noop : () => handleClick(obligations)}
168
166
  text="Pay Now"
169
167
  variant={isMobile ? "smallSecondary" : "secondary"}
170
168
  dataQa="Pay Now"
@@ -71,7 +71,7 @@ const PaymentFormCard = ({
71
71
  [hasLength.error]: "Credit card number is invalid",
72
72
  [matchesRegex.error]: `${displayCardBrand(
73
73
  fields.creditCardNumber.rawValue
74
- )} is not accepted`
74
+ )} cards are not available for payment`
75
75
  };
76
76
  const expirationDateErrors = {
77
77
  [required.error]: "Expiration date is required",
@@ -1,6 +1,6 @@
1
1
  import React from "react";
2
2
  import { connect } from "react-redux";
3
- import { boolean } from "@storybook/addon-knobs";
3
+ import { boolean, object } from "@storybook/addon-knobs";
4
4
 
5
5
  import PaymentFormCard from "./PaymentFormCard";
6
6
  import page from "../../../../.storybook/page";
@@ -13,12 +13,21 @@ const story = page({
13
13
  mapStateToProps: PaymentFormCardState.mapStateToProps,
14
14
  mapDispatchToProps: PaymentFormCardState.mapDispatchToProps
15
15
  });
16
+
16
17
  export default story;
17
18
 
18
19
  const ConnectedForm = connect(
19
20
  PaymentFormCardState.mapStateToProps,
20
21
  PaymentFormCardState.mapDispatchToProps
21
22
  )(PaymentFormCard);
23
+
22
24
  export const paymentFormCard = () => (
23
25
  <ConnectedForm showErrors={boolean("showErrors", false, "props")} />
24
26
  );
27
+
28
+ export const paymentFormCardWithDeniedCards = () => (
29
+ <ConnectedForm
30
+ showErrors={boolean("showErrors", false, "props")}
31
+ deniedCards={object("deniedCards", ["AMEX"], "props")}
32
+ />
33
+ );
@@ -3,22 +3,14 @@ import { ThemeContext } from "styled-components";
3
3
  import Heading from "../../atoms/heading";
4
4
  import Paragraph from "../../atoms/paragraph";
5
5
  import { Box, Cluster } from "../../atoms/layouts";
6
- import { CHARADE_GREY, WHITE } from "../../../constants/colors";
6
+ import { GRECIAN_GREY, CHARADE_GREY, WHITE } from "../../../constants/colors";
7
7
  import ButtonWithLink from "../../atoms/button-with-link";
8
8
  import { ForgotPasswordIcon } from "../../atoms/icons";
9
9
  import withWindowSize from "../../withWindowSize";
10
10
  import { FormContainer, FormInputColumn } from "../../atoms/form-layouts";
11
- import { fallbackValues } from "./ResetConfirmatForm.theme";
12
- import { createThemeValues } from "../../../util/themeUtils";
13
11
 
14
12
  const ResetConfirmationForm = () => {
15
- const themeContext = useContext(ThemeContext);
16
- const themeValues = createThemeValues(
17
- themeContext,
18
- fallbackValues,
19
- "ResetConfirmationForm"
20
- );
21
- const { isMobile } = themeContext;
13
+ const { isMobile } = useContext(ThemeContext);
22
14
 
23
15
  return (
24
16
  <Box
@@ -28,11 +20,7 @@ const ResetConfirmationForm = () => {
28
20
  background={WHITE}
29
21
  boxShadow="0px 2px 14px 0px rgb(246, 246, 249), 0px 3px 8px 0px rgb(202, 206, 216)"
30
22
  >
31
- <Box
32
- background={themeValues.bannerBackgroundColor}
33
- minWidth="100%"
34
- padding="0.5rem"
35
- >
23
+ <Box background={GRECIAN_GREY} minWidth="100%" padding="0.5rem">
36
24
  <Cluster justify="center" align="center">
37
25
  <ForgotPasswordIcon />
38
26
  </Cluster>
@@ -3,22 +3,14 @@ import { ThemeContext } from "styled-components";
3
3
  import Heading from "../../atoms/heading";
4
4
  import Paragraph from "../../atoms/paragraph";
5
5
  import { Box, Cluster } from "../../atoms/layouts";
6
- import { CHARADE_GREY, WHITE } from "../../../constants/colors";
6
+ import { GRECIAN_GREY, CHARADE_GREY, WHITE } from "../../../constants/colors";
7
7
  import ButtonWithLink from "../../atoms/button-with-link";
8
8
  import { ForgotPasswordIcon } from "../../atoms/icons";
9
9
  import withWindowSize from "../../withWindowSize";
10
10
  import { FormContainer, FormInputColumn } from "../../atoms/form-layouts";
11
- import { fallbackValues } from "./ResetPasswordSuccess.theme";
12
- import { createThemeValues } from "../../../util/themeUtils";
13
11
 
14
- const ResetPasswordSuccess = () => {
15
- const themeContext = useContext(ThemeContext);
16
- const themeValues = createThemeValues(
17
- themeContext,
18
- fallbackValues,
19
- "ResetPasswordSuccess"
20
- );
21
- const { isMobile } = themeContext;
12
+ const ResetConfirmationForm = () => {
13
+ const { isMobile } = useContext(ThemeContext);
22
14
 
23
15
  return (
24
16
  <Box
@@ -28,11 +20,7 @@ const ResetPasswordSuccess = () => {
28
20
  background={WHITE}
29
21
  boxShadow="0px 2px 14px 0px rgb(246, 246, 249), 0px 3px 8px 0px rgb(202, 206, 216)"
30
22
  >
31
- <Box
32
- background={themeValues.bannerBackgroundColor}
33
- minWidth="100%"
34
- padding="0.5rem"
35
- >
23
+ <Box background={GRECIAN_GREY} minWidth="100%" padding="0.5rem">
36
24
  <Cluster justify="center" align="center">
37
25
  <ForgotPasswordIcon />
38
26
  </Cluster>
@@ -65,4 +53,4 @@ const ResetPasswordSuccess = () => {
65
53
  </Box>
66
54
  );
67
55
  };
68
- export default withWindowSize(ResetPasswordSuccess);
56
+ export default withWindowSize(ResetConfirmationForm);
@@ -30,10 +30,13 @@ const ToastNotification = ({
30
30
  height = "56px",
31
31
  childGap = "1rem",
32
32
  backgroundColor,
33
- role = "alert"
33
+ role = "alert",
34
+ ariaLive = "polite",
35
+ ...rest
34
36
  }) => (
35
37
  <Box
36
38
  onClick={closeToastNotification}
39
+ onKeyDown={e => e.key === "Enter" && closeToastNotification()}
37
40
  background={
38
41
  backgroundColor
39
42
  ? backgroundColor
@@ -57,6 +60,8 @@ const ToastNotification = ({
57
60
  cursor: pointer;
58
61
  `}
59
62
  role={role}
63
+ aria-live={ariaLive}
64
+ {...rest}
60
65
  >
61
66
  <Cluster align="center" childGap={childGap} justify="space-between">
62
67
  <Cluster align="center" childGap={childGap}>
@@ -74,9 +74,9 @@ export const displayCardBrand = number => {
74
74
  return "Mastercard";
75
75
  } else if (/^4/.test(number)) {
76
76
  return "Visa";
77
- } else if (/^3[4,7]/.test(number)) {
77
+ } else if (/^3[4,7]\d{13}$/.test(number)) {
78
78
  return "American Express";
79
- } else return "Unknown Card";
79
+ } else return "Unknown";
80
80
  };
81
81
 
82
82
  export const checkDeniedCards = name => {
Binary file
Binary file
@@ -1,9 +0,0 @@
1
- import { colors } from "../../../constants";
2
-
3
- const { GRECIAN_GREY } = colors;
4
-
5
- const bannerBackgroundColor = GRECIAN_GREY;
6
-
7
- export const fallbackValues = {
8
- bannerBackgroundColor
9
- };
@@ -1,9 +0,0 @@
1
- import { colors } from "../../../constants";
2
-
3
- const { GRECIAN_GREY } = colors;
4
-
5
- const bannerBackgroundColor = GRECIAN_GREY;
6
-
7
- export const fallbackValues = {
8
- bannerBackgroundColor
9
- };