@thecb/components 7.13.0-beta.0 → 7.13.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": "7.13.0-beta.0",
3
+ "version": "7.13.0",
4
4
  "description": "Common lib for CityBase react components",
5
5
  "main": "dist/index.cjs.js",
6
6
  "typings": "dist/index.d.ts",
@@ -1,5 +1,5 @@
1
1
  import React from "react";
2
- import { MATISSE_BLUE, INFO_BLUE } from "../../../constants/colors";
2
+ import { SEA_GREEN, HINT_GREEN } from "../../../constants/colors";
3
3
 
4
4
  const CheckmarkIcon = () => (
5
5
  <svg
@@ -22,9 +22,9 @@ const CheckmarkIcon = () => (
22
22
  <g id="icon---checkmark" transform="translate(672.000000, 64.000000)">
23
23
  <circle
24
24
  id="Oval-2"
25
- stroke={MATISSE_BLUE}
25
+ stroke={SEA_GREEN}
26
26
  strokeWidth="2"
27
- fill={INFO_BLUE}
27
+ fill={HINT_GREEN}
28
28
  cx="48"
29
29
  cy="48"
30
30
  r="48"
@@ -32,7 +32,7 @@ const CheckmarkIcon = () => (
32
32
  <g
33
33
  id="Group-2"
34
34
  transform="translate(20.800000, 28.400000)"
35
- fill={MATISSE_BLUE}
35
+ fill={SEA_GREEN}
36
36
  >
37
37
  <polygon
38
38
  id="Rectangle-2"
@@ -1,6 +1,7 @@
1
1
  import React from "react";
2
+ import { STORM_GREY } from "../../../constants/colors";
2
3
 
3
- const PendingIcon = () => (
4
+ const PendingIcon = ({ fill = STORM_GREY }) => (
4
5
  <svg
5
6
  width="32px"
6
7
  height="32px"
@@ -16,11 +17,7 @@ const PendingIcon = () => (
16
17
  fill="none"
17
18
  fillRule="evenodd"
18
19
  >
19
- <g
20
- id="Icons"
21
- transform="translate(-64.000000, -448.000000)"
22
- fill="#6D717E"
23
- >
20
+ <g id="Icons" transform="translate(-64.000000, -448.000000)" fill={fill}>
24
21
  <path
25
22
  d="M80,480 C88.836556,480 96,472.836556 96,464 C96,455.163444 88.836556,448 80,448 C71.163444,448 64,455.163444 64,464 C64,472.836556 71.163444,480 80,480 Z M87,466 C88.1045695,466 89,465.104569 89,464 C89,462.895431 88.1045695,462 87,462 C85.8954305,462 85,462.895431 85,464 C85,465.104569 85.8954305,466 87,466 Z M80,462 C81.1045695,462 82,462.895431 82,464 C82,465.104569 81.1045695,466 80,466 C78.8954305,466 78,465.104569 78,464 C78,462.895431 78.8954305,462 80,462 Z M73,462 C74.1045695,462 75,462.895431 75,464 C75,465.104569 74.1045695,466 73,466 C71.8954305,466 71,465.104569 71,464 C71,462.895431 71.8954305,462 73,462 Z"
26
23
  id="status-icon---pending"
@@ -18,6 +18,7 @@ const PartialAmountForm = ({
18
18
  lineItems,
19
19
  maximum,
20
20
  minimum = 1,
21
+ blockPartialPaymentOverpay,
21
22
  clearOnDismount,
22
23
  fields,
23
24
  actions,
@@ -37,6 +38,20 @@ const PartialAmountForm = ({
37
38
  )}`
38
39
  };
39
40
 
41
+ const getPartialAmountFormErrors = itemAmount => {
42
+ let errorMessages = amountErrors;
43
+ if (blockPartialPaymentOverpay) {
44
+ const maxAmountError = `There is a maximum payment of ${displayCurrency(
45
+ itemAmount
46
+ )}`;
47
+ return {
48
+ ...errorMessages,
49
+ [numberLessThanOrEqualTo.error]: maxAmountError
50
+ };
51
+ }
52
+ return errorMessages;
53
+ };
54
+
40
55
  const lineItemsNew = Array.isArray(lineItems) ? lineItems : [];
41
56
  return (
42
57
  <FormContainer variant={variant} role="form" aria-label="Other amount">
@@ -53,7 +68,7 @@ const PartialAmountForm = ({
53
68
  field={fields[li.id]}
54
69
  fieldActions={actions.fields[li.id]}
55
70
  showErrors={showErrors}
56
- errorMessages={amountErrors}
71
+ errorMessages={getPartialAmountFormErrors(li.amount)}
57
72
  style={{ textAlign: "right" }}
58
73
  placeholder="$0.00"
59
74
  formatter={moneyFormat}
@@ -10,7 +10,8 @@ import {
10
10
  export const createPartialAmountFormState = (
11
11
  lineItems,
12
12
  maximum,
13
- minimum = 1
13
+ minimum = 1,
14
+ blockPartialPaymentOverpay = false
14
15
  ) => {
15
16
  const formConfig = lineItems.reduce((acc, item) => {
16
17
  const validators = [
@@ -32,6 +33,9 @@ export const createPartialAmountFormState = (
32
33
  )
33
34
  );
34
35
  }
36
+ if (blockPartialPaymentOverpay) {
37
+ validators.push(numberLessThanOrEqualTo(item.amount));
38
+ }
35
39
  return {
36
40
  ...acc,
37
41
  [item.id]: {
@@ -18,7 +18,8 @@ const PaymentButtonBar = ({
18
18
  redirectURL,
19
19
  redirectText = "Return",
20
20
  buttonFlexOverride,
21
- hideForwardButton = false
21
+ hideForwardButton = false,
22
+ hideBackButton = false
22
23
  }) => {
23
24
  const { isMobile } = useContext(ThemeContext);
24
25
 
@@ -79,7 +80,7 @@ const PaymentButtonBar = ({
79
80
  }
80
81
  align="center"
81
82
  >
82
- {backButton}
83
+ {!hideBackButton && <Fragment>{backButton}</Fragment>}
83
84
  {!hideForwardButton && <Fragment>{forwardButton}</Fragment>}
84
85
  </Cluster>
85
86
  </Box>
@@ -12,16 +12,13 @@ import {
12
12
  } from "../../../constants/colors";
13
13
  import { FONT_WEIGHT_SEMIBOLD } from "../../../constants/style_constants";
14
14
  import ButtonWithLink from "../../atoms/button-with-link";
15
- import ButtonWithAction from "../../atoms/button-with-action";
16
15
  import { Box, Stack } from "../../atoms/layouts";
17
16
  const WorkflowTile = ({
18
17
  workflowName = "Test Workflow",
19
18
  workflowDescription = "Link your benefit plan",
20
19
  workflowActionName = "Search",
21
20
  slug,
22
- buttonVariant = "primary",
23
- selectWorkflowAction,
24
- navigate
21
+ buttonVariant = "primary"
25
22
  }) => (
26
23
  <Box
27
24
  background={WHITE}
@@ -51,37 +48,19 @@ const WorkflowTile = ({
51
48
  borderColor={GRECIAN_GREY}
52
49
  borderWidthOverride="2px 0 0 0"
53
50
  >
54
- {selectWorkflowAction ? (
55
- <ButtonWithAction
56
- variant={buttonVariant}
57
- primary={buttonVariant == "primary"}
58
- primaryBG={MATISSE_BLUE}
59
- fontWeight={FONT_WEIGHT_SEMIBOLD}
60
- fontSize={"1.125rem"}
61
- text={workflowActionName}
62
- minWidth={"100%"}
63
- extraStyles={`width: 100%; margin: 0; text-align: center;`}
64
- dataQa={slug}
65
- action={() => {
66
- selectWorkflowAction(slug);
67
- navigate(`/service/${slug}`);
68
- }}
69
- />
70
- ) : (
71
- <ButtonWithLink
72
- variant={buttonVariant}
73
- primary={buttonVariant == "primary"}
74
- primaryBG={MATISSE_BLUE}
75
- fontWeight={FONT_WEIGHT_SEMIBOLD}
76
- fontSize={"1.125rem"}
77
- text={workflowActionName}
78
- minWidth={"100%"}
79
- url={`/service/${slug}`}
80
- extraStyles={`width: 100%; margin: 0;`}
81
- linkExtraStyles={`justify-content: center;`}
82
- dataQa={slug}
83
- />
84
- )}
51
+ <ButtonWithLink
52
+ variant={buttonVariant}
53
+ primary={buttonVariant == "primary"}
54
+ primaryBG={MATISSE_BLUE}
55
+ fontWeight={FONT_WEIGHT_SEMIBOLD}
56
+ fontSize={"1.125rem"}
57
+ text={workflowActionName}
58
+ minWidth={"100%"}
59
+ url={`/service/${slug}`}
60
+ extraStyles={`width: 100%; margin: 0;`}
61
+ linkExtraStyles={`justify-content: center;`}
62
+ dataQa={slug}
63
+ />
85
64
  </Box>
86
65
  </Stack>
87
66
  </Box>
package/src/.DS_Store DELETED
Binary file
Binary file
Binary file