@thecb/components 5.8.1 → 5.8.2-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": "5.8.1",
3
+ "version": "5.8.2-beta.2",
4
4
  "description": "Common lib for CityBase react components",
5
5
  "main": "dist/index.cjs.js",
6
6
  "module": "dist/index.esm.js",
package/src/.DS_Store ADDED
Binary file
Binary file
@@ -25,13 +25,21 @@ const Obligation = ({
25
25
  isPaymentPlan,
26
26
  nextAutopayDate,
27
27
  obligationAssocID,
28
- isActive = true,
28
+ inactive = false,
29
29
  inactiveLookupTitle = "",
30
30
  inactiveLookupInput = "Account",
31
31
  inactiveLookupValue = ""
32
32
  }) => {
33
- const obligation = obligations[0];
34
- const { customAttributes } = obligation;
33
+ /*
34
+ The value of obligations is always an array. It can contain:
35
+ - A single obligation
36
+ - A group of obligations (a "collection")
37
+
38
+ The top level desc/subdesc for all obligations in a collection is the same
39
+ (Collection accounts look different in the Account Details page)
40
+ */
41
+ const firstObligation = obligations[0];
42
+ const customAttributes = firstObligation?.customAttributes ?? {};
35
43
  const boxShadowValue =
36
44
  "0px 4px 4px rgba(41, 42, 51, 0.1), 0px 1px 1px 2px rgba(41, 42, 51, 0.1);";
37
45
  const activeObligation = (
@@ -40,11 +48,16 @@ const Obligation = ({
40
48
  borderRadius="4px"
41
49
  boxShadow={boxShadowValue}
42
50
  as="section"
43
- aria-label={`${obligation.description} ${obligation.subDescription}`}
51
+ aria-label={`${firstObligation?.description ??
52
+ "account"} ${firstObligation?.subDescription ?? obligationAssocID}`}
44
53
  >
45
- <Box background={WHITE}>
54
+ <Box background={WHITE} padding="24px 16px">
46
55
  <Stack childGap="14px">
47
- <Box key={`${obligations[0].id}-top`} padding="0 8px" minWidth="100%">
56
+ <Box
57
+ key={`${firstObligation?.id}-top`}
58
+ padding="0 8px"
59
+ minWidth="100%"
60
+ >
48
61
  <Cluster
49
62
  justify="space-between"
50
63
  align="center"
@@ -63,8 +76,8 @@ const Obligation = ({
63
76
  />
64
77
  )}
65
78
  <TitleModule
66
- title={obligation.description}
67
- subtitle={obligation.subDescription}
79
+ title={firstObligation?.description}
80
+ subtitle={firstObligation?.subDescription}
68
81
  titleColor={BRIGHT_GREY}
69
82
  isMobile={isMobile}
70
83
  />
@@ -72,7 +85,7 @@ const Obligation = ({
72
85
  </Box>
73
86
  {!isMobile && (
74
87
  <AmountModule
75
- totalAmountDue={obligations.reduce(
88
+ totalAmountDue={obligations?.reduce(
76
89
  (acc, curr) => acc + curr.amountDue,
77
90
  0
78
91
  )}
@@ -135,17 +148,17 @@ const Obligation = ({
135
148
  as="section"
136
149
  aria-label={`${inactiveLookupTitle} ${inactiveLookupInput}: ${inactiveLookupValue}`}
137
150
  >
138
- <Box background={ATHENS_GREY}>
151
+ <Box background={ATHENS_GREY} padding="24px">
139
152
  <Stack childGap="14px">
140
- <Box key={`${obligations[0].id}-top`} padding="0 8px" minWidth="100%">
153
+ <Box key={`${obligationAssocID}-top`} padding="0" minWidth="100%">
141
154
  <Cluster
142
155
  justify="space-between"
143
156
  align="center"
144
- childGap="4px"
157
+ childGap="40px"
145
158
  nowrap
146
159
  >
147
160
  <Box padding="0">
148
- <Cluster justify="flex-start" align="center">
161
+ <Cluster justify="flex-start" align="center" nowrap>
149
162
  <IconModule
150
163
  icon={config.icon}
151
164
  iconDefault={config.iconDefault}
@@ -197,7 +210,7 @@ const Obligation = ({
197
210
  </Box>
198
211
  );
199
212
 
200
- return isActive ? activeObligation : inactiveObligation;
213
+ return inactive ? inactiveObligation : activeObligation;
201
214
  };
202
215
 
203
216
  export default Obligation;
@@ -42,6 +42,7 @@ const AmountModule = ({
42
42
  paymentPlanSchedule={paymentPlanSchedule}
43
43
  isPaymentPlan={isPaymentPlan}
44
44
  nextAutopayDate={nextAutopayDate}
45
+ controlType="link"
45
46
  />
46
47
  )}
47
48
  </Stack>
@@ -7,6 +7,7 @@ import { Box, Cluster } from "../../../atoms/layouts";
7
7
  import { SEA_GREEN } from "../../../../constants/colors";
8
8
  import { fallbackValues } from "./AutopayModalModule.theme";
9
9
  import { themeComponent } from "../../../../util/themeUtils";
10
+ import { render } from "react-dom/cjs/react-dom.production.min";
10
11
 
11
12
  const AutopayModal = ({
12
13
  autoPayActive,
@@ -16,7 +17,7 @@ const AutopayModal = ({
16
17
  modalOpen,
17
18
  deactivatePaymentSchedule,
18
19
  navigateToSettings,
19
- buttonLinkType,
20
+ controlType = "tertiary",
20
21
  isMobile,
21
22
  themeValues,
22
23
  isPaymentPlan,
@@ -62,6 +63,73 @@ const AutopayModal = ({
62
63
  const defaultStyles = `
63
64
  .autopayIcon { fill: ${themeValues.color}; text-decoration: underline; }
64
65
  `;
66
+ const renderAutoPayControl = () => {
67
+ switch (controlType) {
68
+ case "secondary": {
69
+ return (
70
+ <ButtonWithAction
71
+ text={autoPayActive ? `Turn off ${planType}` : `Set Up ${planType}`}
72
+ variant="secondary"
73
+ action={() => {
74
+ toggleModal(true);
75
+ }}
76
+ dataQa="Turn off Autopay"
77
+ extraStyles={
78
+ isMobile ? `flex-grow: 1; width: 100%;` : `margin: 0px`
79
+ }
80
+ />
81
+ );
82
+ }
83
+ case "tertiary": {
84
+ return (
85
+ <ButtonWithAction
86
+ text={autoPayActive ? `Manage ${planType}` : `Set Up ${planType}`}
87
+ variant="tertiary"
88
+ action={() => {
89
+ toggleModal(true);
90
+ }}
91
+ dataQa="Manage Autopay"
92
+ extraStyles={isMobile && `flex-grow: 1; width: 100%;`}
93
+ />
94
+ );
95
+ }
96
+ case "link": {
97
+ return (
98
+ <Box
99
+ padding="0"
100
+ onClick={() => {
101
+ toggleModal(true);
102
+ }}
103
+ hoverStyles={hoverStyles}
104
+ activeStyles={activeStyles}
105
+ extraStyles={defaultStyles}
106
+ >
107
+ <Cluster
108
+ justify={isMobile ? "flex-start" : "flex-end"}
109
+ align="center"
110
+ >
111
+ <AutopayOnIcon />
112
+ <Text
113
+ variant="pS"
114
+ onClick={() => toggleModal(true)}
115
+ onKeyPress={e => {
116
+ e.key === "Enter" && toggleModal(true);
117
+ }}
118
+ tabIndex="0"
119
+ dataQa={`${planType} On`}
120
+ color={SEA_GREEN}
121
+ weight={themeValues.fontWeight}
122
+ hoverStyles={themeValues.modalLinkHoverFocus}
123
+ extraStyles={`padding-left: 0.25rem;`}
124
+ >
125
+ {`${planType} ${nextAutopayDate}`}
126
+ </Text>
127
+ </Cluster>
128
+ </Box>
129
+ );
130
+ }
131
+ }
132
+ };
65
133
  return (
66
134
  <Modal
67
135
  showModal={() => toggleModal(true)}
@@ -69,50 +137,7 @@ const AutopayModal = ({
69
137
  modalOpen={modalOpen}
70
138
  {...modalExtraProps}
71
139
  >
72
- {buttonLinkType ? (
73
- <ButtonWithAction
74
- text={autoPayActive ? `Manage ${planType}` : `Set Up ${planType}`}
75
- variant="tertiary"
76
- action={() => {
77
- toggleModal(true);
78
- }}
79
- dataQa="Manage Autopay"
80
- extraStyles={isMobile && `flex-grow: 1; width: 100%;`}
81
- />
82
- ) : (
83
- <Box
84
- padding="0"
85
- onClick={() => {
86
- toggleModal(true);
87
- }}
88
- hoverStyles={hoverStyles}
89
- activeStyles={activeStyles}
90
- extraStyles={defaultStyles}
91
- >
92
- <Cluster
93
- justify={isMobile ? "flex-start" : "flex-end"}
94
- align="center"
95
- >
96
- <AutopayOnIcon />
97
- <Text
98
- variant="pS"
99
- onClick={() => toggleModal(true)}
100
- onKeyPress={e => {
101
- console.log({ e });
102
- e.key === "Enter" && toggleModal(true);
103
- }}
104
- tabIndex="0"
105
- dataQa={`${planType} On`}
106
- color={SEA_GREEN}
107
- weight={themeValues.fontWeight}
108
- hoverStyles={themeValues.modalLinkHoverFocus}
109
- extraStyles={`padding-left: 0.25rem;`}
110
- >
111
- {`${planType} ${nextAutopayDate}`}
112
- </Text>
113
- </Cluster>
114
- </Box>
115
- )}
140
+ {renderAutoPayControl()}
116
141
  </Modal>
117
142
  );
118
143
  };
@@ -25,9 +25,9 @@ const InactiveControlsModule = ({
25
25
  border={isMobile ? `1px solid ${GHOST_GREY}` : `0px`}
26
26
  borderWidthOverride={isMobile ? `1px 0 0 0` : `0px`}
27
27
  >
28
- <Cluster childGap={isMobile ? `8px` : `18px`}>
28
+ <Cluster childGap={`8px`} nowrap>
29
29
  {autoPayEnabled && (
30
- <Box padding="0" extraStyles={`flex-grow: 1;`}>
30
+ <Box padding="0" extraStyles={`flex-grow: 1; min-width: 165px;`}>
31
31
  <AutopayModalModule
32
32
  autoPayActive={autoPayEnabled}
33
33
  autoPaySchedule={autoPaySchedule}
@@ -35,22 +35,24 @@ const InactiveControlsModule = ({
35
35
  modalOpen={modalOpen}
36
36
  navigateToSettings={navigateToSettings}
37
37
  deactivatePaymentSchedule={deactivatePaymentSchedule}
38
- buttonLinkType
39
38
  isMobile={isMobile}
40
39
  paymentPlanSchedule={paymentPlanSchedule}
41
40
  isPaymentPlan={isPaymentPlan}
42
41
  nextAutopayDate={nextAutopayDate}
43
42
  obligationAssocID={obligationAssocID}
43
+ controlType="secondary"
44
44
  />
45
45
  </Box>
46
46
  )}
47
47
  <Box padding="0" extraStyles={`flex-grow: 1;`}>
48
48
  <ButtonWithAction
49
- variant="tertiary"
49
+ variant="secondary"
50
50
  text="Remove"
51
51
  action={handleRemoveAccount}
52
52
  dataQa="Remove Account"
53
- extraStyles={isMobile && `flex-grow: 1; width: 100%;`}
53
+ extraStyles={
54
+ isMobile ? `flex-grow: 1; width: 100%;` : `flex-grow: 1;`
55
+ }
54
56
  />
55
57
  </Box>
56
58
  </Cluster>
@@ -120,7 +120,7 @@ const PaymentDetailsActions = ({
120
120
  modalOpen={modalOpen}
121
121
  navigateToSettings={navigateToSettings}
122
122
  deactivatePaymentSchedule={deactivatePaymentSchedule}
123
- buttonLinkType
123
+ controlType="tertiary"
124
124
  isMobile={isMobile}
125
125
  paymentPlanSchedule={paymentPlanSchedule}
126
126
  isPaymentPlan={isPaymentPlan}
Binary file