@thecb/components 4.0.3-beta-0 → 4.0.5

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": "4.0.3-beta-0",
3
+ "version": "4.0.5",
4
4
  "description": "Common lib for CityBase react components",
5
5
  "main": "dist/index.cjs.js",
6
6
  "module": "dist/index.esm.js",
@@ -1,5 +1,5 @@
1
1
  import {
2
- FIREFLY_GREY,
2
+ STORM_GREY,
3
3
  MATISSE_BLUE,
4
4
  WHITE,
5
5
  SEASHELL_WHITE,
@@ -23,7 +23,7 @@ const inputBackgroundColor = {
23
23
  disabled: `${SEASHELL_WHITE}`
24
24
  };
25
25
  const color = { default: `${MINESHAFT_GREY}`, disabled: `${DUSTY_GREY}` };
26
- const labelColor = { default: `${FIREFLY_GREY}`, disabled: `${FIREFLY_GREY}` };
26
+ const labelColor = { default: `${STORM_GREY}`, disabled: `${STORM_GREY}` };
27
27
  const borderColor = { default: `${GREY_CHATEAU}`, disabled: `${GREY_CHATEAU}` };
28
28
  const lineHeight = { default: "1rem", disabled: "1rem" };
29
29
  const fontSize = { default: "0.875rem", disabled: "0.875rem" };
@@ -2,9 +2,11 @@ import React from "react";
2
2
  import styled from "styled-components";
3
3
  import GenericCard from "../icons/GenericCard";
4
4
  import Text from "../text";
5
- import { Stack } from "../layouts";
5
+ import Paragraph from "../paragraph";
6
+ import { Box, Stack } from "../layouts";
6
7
  import { fallbackValues } from "./FormattedCreditCard.theme";
7
8
  import { themeComponent } from "../../../util/themeUtils";
9
+ import { ASH_GREY } from "../../../constants/colors";
8
10
 
9
11
  export const CreditCardWrapper = styled.div`
10
12
  display: flex;
@@ -19,21 +21,33 @@ export const CCIconWrapper = styled.div`
19
21
  display: flex;
20
22
  `;
21
23
 
22
- const FormattedCreditCard = ({ lastFour, autoPay, themeValues }) => (
24
+ const FormattedCreditCard = ({
25
+ lastFour,
26
+ autoPay,
27
+ expireDate,
28
+ themeValues
29
+ }) => (
23
30
  <CreditCardWrapper>
24
31
  <CCIconWrapper>
25
32
  <GenericCard />
26
33
  </CCIconWrapper>
27
34
  <Stack childGap="0">
28
- <Text
29
- variant="p"
30
- padding="0 0 0 8px"
31
- color={themeValues.textColor}
32
- textAlign="left"
33
- extraStyles={`display: inline-block;`}
34
- >
35
- {`Card ending in ${lastFour}`}
36
- </Text>
35
+ <Box padding="0">
36
+ <Text
37
+ variant="p"
38
+ padding="0 0 0 8px"
39
+ color={themeValues.textColor}
40
+ textAlign="left"
41
+ extraStyles={`display: inline-block;`}
42
+ >
43
+ {`Card ending in ${lastFour}`}
44
+ </Text>
45
+ {expireDate && (
46
+ <Paragraph variant="pXS" color={ASH_GREY} textAlign="left">
47
+ {`Exp ${expireDate}`}
48
+ </Paragraph>
49
+ )}
50
+ </Box>
37
51
  {autoPay && (
38
52
  <Text
39
53
  variant="p"
@@ -15,14 +15,12 @@ const Heading = ({
15
15
  extraStyles = ``,
16
16
  className,
17
17
  variant = "h1",
18
- as = "h1",
19
18
  dataQa,
20
19
  children,
21
20
  ...rest
22
21
  }) => (
23
22
  <HeadingText
24
- variant={variant}
25
- as={as}
23
+ as={variant}
26
24
  weight={weight}
27
25
  color={color}
28
26
  margin={margin}
@@ -5,13 +5,12 @@ import { Stack } from "../layouts";
5
5
  import Heading from "../heading";
6
6
  import Paragraph from "../paragraph";
7
7
 
8
- const LabeledAmount = ({ variant = "pL", label, amount, themeValues, as }) => {
8
+ const LabeledAmount = ({ variant = "pL", label, amount, themeValues }) => {
9
9
  const LabeledAmountText = variant === "h6" ? Heading : Paragraph;
10
10
  return (
11
11
  <Stack direction="row">
12
12
  <LabeledAmountText
13
13
  variant={variant}
14
- as={as}
15
14
  weight={themeValues.fontWeight}
16
15
  extraStyles="text-align: start; flex: 3;"
17
16
  >
@@ -19,7 +18,6 @@ const LabeledAmount = ({ variant = "pL", label, amount, themeValues, as }) => {
19
18
  </LabeledAmountText>
20
19
  <LabeledAmountText
21
20
  variant={variant}
22
- as={as}
23
21
  weight={themeValues.fontWeight}
24
22
  extraStyles="text-align: end; flex: 1;"
25
23
  >
@@ -27,8 +27,10 @@ export const BoxWrapper = styled(
27
27
  maxWidth,
28
28
  padding,
29
29
  hiddenStyles,
30
+ ariaControls,
31
+ ariaLabel,
30
32
  ...props
31
- }) => <div {...props} />
33
+ }) => <div aria-controls={ariaControls} aria-label={ariaLabel} {...props} />
32
34
  )`
33
35
  position: relative;
34
36
  box-sizing: border-box;
@@ -106,11 +108,5 @@ export const BoxWrapper = styled(
106
108
  css`
107
109
  ${extraStyles}
108
110
  `}
109
-
110
- ${({ hiddenStyles }) =>
111
- hiddenStyles &&
112
- css`
113
- display: none;
114
- `}
115
111
  `;
116
112
  /* eslint-enable no-unused-vars */
@@ -16,11 +16,12 @@ const Module = ({
16
16
  <Fragment>
17
17
  {heading && (
18
18
  <Heading
19
- variant={variant === "default" ? "h5" : "h2"}
19
+ variant={variant === "default" ? "h5" : "h3"}
20
20
  weight={themeValues.fontWeight}
21
21
  color={themeValues.fontColor}
22
22
  margin={`${spacing} 0 ${themeValues.titleSpacing} 0`}
23
23
  textAlign={themeValues.textAlign}
24
+ aria-level={variant === "default" ? "3" : "1"}
24
25
  >
25
26
  {heading}
26
27
  </Heading>
@@ -5,7 +5,7 @@ const fontWeight = { default: "600", largeTitle: "700" };
5
5
  const fontColor = { default: CHARADE_GREY, largeTitle: CHARADE_GREY };
6
6
  const lineHeight = { default: "2rem", largeTitle: "2rem" };
7
7
  const textAlign = { default: "left", largeTitle: "left" };
8
- const titleType = { default: "h5", largeTitle: "h1" };
8
+ const titleType = { default: "h5", largeTitle: "h3" };
9
9
  const titleSpacing = { default: "0.5rem", largeTitle: "1.125rem" };
10
10
  const boxShadow = {
11
11
  default:
@@ -17,8 +17,10 @@ const Obligation = ({
17
17
  handleAutopayAction,
18
18
  deactivatePaymentSchedule,
19
19
  autoPaySchedule,
20
+ paymentPlanSchedule,
20
21
  navigateToSettings,
21
- isMobile
22
+ isMobile,
23
+ isPaymentPlan
22
24
  }) => {
23
25
  const obligation = obligations[0];
24
26
  const { customAttributes } = obligation;
@@ -67,6 +69,8 @@ const Obligation = ({
67
69
  deactivatePaymentSchedule={deactivatePaymentSchedule}
68
70
  navigateToSettings={navigateToSettings}
69
71
  autoPaySchedule={autoPaySchedule}
72
+ paymentPlanSchedule={paymentPlanSchedule}
73
+ isPaymentPlan={isPaymentPlan}
70
74
  />
71
75
  )}
72
76
  </Cluster>
@@ -79,10 +83,12 @@ const Obligation = ({
79
83
  handleAutopayAction={handleAutopayAction}
80
84
  deactivatePaymentSchedule={deactivatePaymentSchedule}
81
85
  autoPaySchedule={autoPaySchedule}
86
+ paymentPlanSchedule={paymentPlanSchedule}
82
87
  navigateToSettings={navigateToSettings}
83
88
  config={config}
84
89
  actions={actions}
85
90
  isMobile={isMobile}
91
+ isPaymentPlan={isPaymentPlan}
86
92
  />
87
93
  )}
88
94
  </Stack>
@@ -95,10 +101,12 @@ const Obligation = ({
95
101
  handleAutopayAction={handleAutopayAction}
96
102
  deactivatePaymentSchedule={deactivatePaymentSchedule}
97
103
  autoPaySchedule={autoPaySchedule}
104
+ paymentPlanSchedule={paymentPlanSchedule}
98
105
  navigateToSettings={navigateToSettings}
99
106
  config={config}
100
107
  actions={actions}
101
108
  isMobile={isMobile}
109
+ isPaymentPlan={isPaymentPlan}
102
110
  />
103
111
  )}
104
112
  </Box>
@@ -12,7 +12,9 @@ const AmountModule = ({
12
12
  isMobile,
13
13
  deactivatePaymentSchedule,
14
14
  navigateToSettings,
15
- autoPaySchedule
15
+ autoPaySchedule,
16
+ paymentPlanSchedule,
17
+ isPaymentPlan
16
18
  }) => {
17
19
  const [modalOpen, toggleModal] = useState(false);
18
20
  return (
@@ -38,6 +40,8 @@ const AmountModule = ({
38
40
  navigateToSettings={navigateToSettings}
39
41
  deactivatePaymentSchedule={deactivatePaymentSchedule}
40
42
  isMobile={isMobile}
43
+ paymentPlanSchedule={paymentPlanSchedule}
44
+ isPaymentPlan={isPaymentPlan}
41
45
  />
42
46
  )}
43
47
  </Stack>
@@ -9,24 +9,38 @@ import { themeComponent } from "../../../../util/themeUtils";
9
9
  const AutopayModal = ({
10
10
  autoPayActive,
11
11
  autoPaySchedule,
12
+ paymentPlanSchedule,
12
13
  toggleModal,
13
14
  modalOpen,
14
15
  deactivatePaymentSchedule,
15
16
  navigateToSettings,
16
17
  buttonLinkType,
17
18
  isMobile,
18
- themeValues
19
+ themeValues,
20
+ isPaymentPlan
19
21
  }) => {
22
+ const planType = isPaymentPlan ? "Payment Plan" : "Autopay";
20
23
  const modalExtraProps = {
21
- modalHeaderText: autoPayActive ? "Deactivate Autopay" : "Set Up Autopay",
24
+ modalHeaderText: autoPayActive
25
+ ? `Deactivate ${planType}`
26
+ : `Set Up ${planType}`,
22
27
  modalBodyText: autoPayActive
23
- ? "Are you sure you want to deactivate autopay? You will need to manually make your next payment."
24
- : "To set up autopay you must save a payment method and address in your profile. Do you want to save these now?",
25
- continueButtonText: autoPayActive ? "Disable Autopay" : "Add to Profile",
28
+ ? `Are you sure you want to deactivate ${
29
+ isPaymentPlan ? "your payment plan" : "autopay"
30
+ }? You will need to manually make your next payment.`
31
+ : `To set up ${
32
+ isPaymentPlan ? "a payment plan" : "autopay"
33
+ } you must save a payment method and address in your profile. Do you want to save these now?`,
34
+ continueButtonText: autoPayActive
35
+ ? `Disable ${planType}`
36
+ : "Add to Profile",
26
37
  useDangerButton: autoPayActive,
27
38
  continueAction: autoPayActive
28
39
  ? () => {
29
- deactivatePaymentSchedule(autoPaySchedule);
40
+ deactivatePaymentSchedule(
41
+ isPaymentPlan ? paymentPlanSchedule : autoPaySchedule,
42
+ isPaymentPlan
43
+ );
30
44
  toggleModal(false);
31
45
  }
32
46
  : navigateToSettings
@@ -50,7 +64,7 @@ const AutopayModal = ({
50
64
  ModalLink={() =>
51
65
  buttonLinkType ? (
52
66
  <ButtonWithAction
53
- text={autoPayActive ? "Manage Autopay" : "Set Up Autopay"}
67
+ text={autoPayActive ? `Manage ${planType}` : `Set Up ${planType}`}
54
68
  variant="tertiary"
55
69
  action={() => {
56
70
  toggleModal(true);
@@ -74,7 +88,7 @@ const AutopayModal = ({
74
88
  >
75
89
  <AutopayOnIcon />
76
90
  <ButtonWithAction
77
- text="Autopay On"
91
+ text={`${planType} On`}
78
92
  variant="smallGhost"
79
93
  dataQa="Autopay On"
80
94
  textExtraStyles={`font-size: 0.875rem; `}
@@ -15,8 +15,11 @@ const PaymentDetailsActions = ({
15
15
  handleAutopayAction,
16
16
  deactivatePaymentSchedule,
17
17
  navigateToSettings,
18
- autoPaySchedule
18
+ autoPaySchedule,
19
+ paymentPlanSchedule,
20
+ isPaymentPlan
19
21
  }) => {
22
+ const planType = isPaymentPlan ? "Payment Plan" : "Autopay";
20
23
  const [isLoading, setIsLoading] = useState(false);
21
24
  const [modalOpen, toggleModal] = useState(false);
22
25
  const { obligationSlug } = config;
@@ -64,6 +67,8 @@ const PaymentDetailsActions = ({
64
67
  deactivatePaymentSchedule={deactivatePaymentSchedule}
65
68
  navigateToSettings={navigateToSettings}
66
69
  autoPaySchedule={autoPaySchedule}
70
+ paymentPlanSchedule={paymentPlanSchedule}
71
+ isPaymentPlan={isPaymentPlan}
67
72
  />
68
73
  </Cluster>
69
74
  </Box>
@@ -97,7 +102,7 @@ const PaymentDetailsActions = ({
97
102
  {autoPayAvailable && !autoPayEnabled ? (
98
103
  <ButtonWithAction
99
104
  variant="tertiary"
100
- text="Set Up Autopay"
105
+ text={`Set Up ${planType}`}
101
106
  action={() => {
102
107
  setDetailedObligation(obligations, config);
103
108
  handleAutopayAction();
@@ -115,6 +120,8 @@ const PaymentDetailsActions = ({
115
120
  deactivatePaymentSchedule={deactivatePaymentSchedule}
116
121
  buttonLinkType
117
122
  isMobile={isMobile}
123
+ paymentPlanSchedule={paymentPlanSchedule}
124
+ isPaymentPlan={isPaymentPlan}
118
125
  />
119
126
  )}
120
127
  </Box>
@@ -31,7 +31,6 @@ const PaymentDetailsContent = ({
31
31
  </Box>
32
32
  <SolidDivider />
33
33
  <LabeledAmount
34
- as="h2"
35
34
  variant={themeValues.labeledAmountTotal}
36
35
  label="Total"
37
36
  amount={displayCurrency(total)}
@@ -124,14 +123,14 @@ const PaymentDetails = ({
124
123
  ) : isCollapsible ? (
125
124
  <Box width="100%" padding="none">
126
125
  <Cluster justify="space-between" align="center">
127
- <Heading variant="h5" weight="700" as="h1">
126
+ <Heading variant="h6" weight="700">
128
127
  {titleText}
129
128
  </Heading>
130
129
  {displayCurrency(total)}
131
130
  </Cluster>
132
131
  </Box>
133
132
  ) : (
134
- <Heading as="h1" variant="h3" weight="700" margin="1rem 0 0 0">
133
+ <Heading variant="h3" weight="700" margin="1rem 0 0 0">
135
134
  {titleText}
136
135
  </Heading>
137
136
  );
@@ -181,7 +181,6 @@ const RadioSection = ({
181
181
  key={icon.img}
182
182
  fade={!icon.enabled}
183
183
  isMobile={isMobile}
184
- alt={icon.altText}
185
184
  />
186
185
  ))}
187
186
  </Cluster>