@thecb/components 10.6.6-beta.5 → 10.6.7-beta.0

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.6-beta.5",
3
+ "version": "10.6.7-beta.0",
4
4
  "description": "Common lib for CityBase react components",
5
5
  "main": "dist/index.cjs.js",
6
6
  "typings": "dist/index.d.ts",
@@ -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
- )} cards are not available for payment`
74
+ )} is not accepted`
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, object } from "@storybook/addon-knobs";
3
+ import { boolean } from "@storybook/addon-knobs";
4
4
 
5
5
  import PaymentFormCard from "./PaymentFormCard";
6
6
  import page from "../../../../.storybook/page";
@@ -13,21 +13,12 @@ const story = page({
13
13
  mapStateToProps: PaymentFormCardState.mapStateToProps,
14
14
  mapDispatchToProps: PaymentFormCardState.mapDispatchToProps
15
15
  });
16
-
17
16
  export default story;
18
17
 
19
18
  const ConnectedForm = connect(
20
19
  PaymentFormCardState.mapStateToProps,
21
20
  PaymentFormCardState.mapDispatchToProps
22
21
  )(PaymentFormCard);
23
-
24
22
  export const paymentFormCard = () => (
25
23
  <ConnectedForm showErrors={boolean("showErrors", false, "props")} />
26
24
  );
27
-
28
- export const paymentFormCardWithDeniedCards = () => (
29
- <ConnectedForm
30
- showErrors={boolean("showErrors", false, "props")}
31
- deniedCards={object("deniedCards", ["AMEX"], "props")}
32
- />
33
- );
@@ -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]\d{13}$/.test(number)) {
77
+ } else if (/^3[4,7]/.test(number)) {
78
78
  return "American Express";
79
- } else return "Unknown";
79
+ } else return "Unknown Card";
80
80
  };
81
81
 
82
82
  export const checkDeniedCards = name => {
Binary file