@thecb/components 5.7.0 → 5.8.0-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": "5.7.0",
3
+ "version": "5.8.0-beta.0",
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
@@ -1,5 +1,5 @@
1
1
  import React from "react";
2
- import Heading from "../heading";
2
+ import Title from "../title";
3
3
  import { Box } from "../layouts";
4
4
  import { fallbackValues } from "./AmountCallout.theme";
5
5
  import { themeComponent } from "../../../util/themeUtils";
@@ -7,21 +7,15 @@ import { FONT_WEIGHT_SEMIBOLD } from "../../../constants/style_constants";
7
7
 
8
8
  const AmountCallout = ({ amount, textAlign, themeValues }) => (
9
9
  <Box padding="0" textAlign={textAlign}>
10
- <Heading
11
- variant="h6"
10
+ <Title
11
+ variant="small"
12
12
  weight={FONT_WEIGHT_SEMIBOLD}
13
- fontSize={themeValues.fontSize}
14
13
  color={themeValues.color}
15
- lineHeight={themeValues.lineHeight}
14
+ as="p"
16
15
  >
17
16
  {amount}
18
- </Heading>
17
+ </Title>
19
18
  </Box>
20
19
  );
21
20
 
22
- export default themeComponent(
23
- AmountCallout,
24
- "AmountCallout",
25
- fallbackValues,
26
- "medium"
27
- );
21
+ export default themeComponent(AmountCallout, "AmountCallout", fallbackValues);
@@ -3,15 +3,6 @@ import { text, select } from "@storybook/addon-knobs";
3
3
  import AmountCallout from "./AmountCallout";
4
4
  import page from "../../../../.storybook/page";
5
5
 
6
- const variantsLabel = "variant";
7
- const variants = {
8
- small: "small",
9
- medium: "medium",
10
- large: "large",
11
- None: undefined
12
- };
13
- const defaultValue = "large";
14
-
15
6
  const textAlignLabel = "textAlign";
16
7
  const textAlign = {
17
8
  left: "left",
@@ -23,7 +14,6 @@ const groupId = "props";
23
14
 
24
15
  export const amountCallout = () => (
25
16
  <AmountCallout
26
- variant={select(variantsLabel, variants, defaultValue, groupId)}
27
17
  amount={text("text", "$1.23", "props")}
28
18
  textAlign={select(
29
19
  textAlignLabel,
@@ -1,19 +1,5 @@
1
- const fontSize = {
2
- large: "1.5rem",
3
- medium: "1.25rem",
4
- small: "1.094rem"
5
- };
6
-
7
1
  const color = "#15749D";
8
2
 
9
- const lineHeight = {
10
- large: "2rem",
11
- medium: "1.875rem",
12
- small: "1.641rem"
13
- };
14
-
15
3
  export const fallbackValues = {
16
- fontSize,
17
- color,
18
- lineHeight
4
+ color
19
5
  };
@@ -1,8 +1,10 @@
1
+ // Comments assume desktop base font size of 16px, mobile base font size of 14px
2
+
1
3
  const fontSize = {
2
- large: "1.125rem",
3
- regular: "1rem",
4
- small: "0.875rem",
5
- extraSmall: "0.75rem"
4
+ large: "1.125rem", // 18px (at base font size of 16)
5
+ regular: "1rem", // 16px
6
+ small: "0.875rem", // 14px
7
+ extraSmall: "0.75rem" // 12px
6
8
  };
7
9
 
8
10
  const fontFamily = {
@@ -13,10 +15,10 @@ const fontFamily = {
13
15
  };
14
16
 
15
17
  const mobileFontSize = {
16
- large: "1.14285rem",
17
- regular: "1",
18
- small: "0.85714rem",
19
- extraSmall: "0.71428rem"
18
+ large: "1.14285rem", // 16px (at base font size of 14)
19
+ regular: "1", // 14px
20
+ small: "0.85714rem", // 12px
21
+ extraSmall: "0.71428rem" // 10px
20
22
  };
21
23
 
22
24
  export const fallbackValues = {
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  SOON TO BE DEPRECATED AS OF 8/1/2021
3
3
 
4
- For new pages/applications, please us <Title /> and <Detail /> atoms
4
+ For new pages/applications, please us <Title /> and <Detail /> atoms (specify "as" prop with value of "p")
5
5
 
6
6
  */
7
7
  import React from "react";
@@ -7,13 +7,15 @@ const fontFamily = {
7
7
  pXL: "Public Sans"
8
8
  };
9
9
 
10
+ // Comments assume base font size of 16px
11
+
10
12
  const fontSize = {
11
- p: "1rem",
12
- pL: "1.125rem",
13
- pS: "0.875rem",
14
- pXS: "0.75rem",
15
- pXXS: "0.65rem",
16
- pXL: "1.5rem"
13
+ p: "1rem", // 16px
14
+ pL: "1.125rem", // 18px
15
+ pS: "0.875rem", // 14px
16
+ pXS: "0.75rem", // 12px
17
+ pXXS: "0.65rem", // 10px
18
+ pXL: "1.5rem" // 24px
17
19
  };
18
20
 
19
21
  export const fallbackValues = {
@@ -11,13 +11,15 @@ const fontFamily = {
11
11
  // Use a Paragraph if you want a block level element
12
12
  // Use a Text if you want an inline element
13
13
 
14
+ // Comments assume base font size of 16px
15
+
14
16
  const fontSize = {
15
- p: "1rem",
16
- pL: "1.125rem",
17
- pS: "0.875rem",
18
- pXS: "0.75rem",
19
- pXXS: "0.65rem",
20
- pXL: "1.5rem"
17
+ p: "1rem", // 16px
18
+ pL: "1.125rem", // 18px
19
+ pS: "0.875rem", // 14px
20
+ pXS: "0.75rem", // 12px
21
+ pXXS: "0.65rem", // 10px
22
+ pXL: "1.5rem" // 24px
21
23
  };
22
24
 
23
25
  export const fallbackValues = {
@@ -1,6 +1,8 @@
1
+ // Comments assume desktop base font size of 16px, mobile base font size of 14px
2
+
1
3
  const fontSize = {
2
- large: "1.5rem",
3
- small: "1.25rem"
4
+ large: "1.5rem", // 24px (at base font size of 16px)
5
+ small: "1.25rem" // 20px
4
6
  };
5
7
 
6
8
  const fontFamily = {
@@ -9,8 +11,8 @@ const fontFamily = {
9
11
  };
10
12
 
11
13
  const mobileFontSize = {
12
- large: "1.5rem",
13
- small: "1.2142rem"
14
+ large: "1.5rem", // 21px (at base font size of 14px)
15
+ small: "1.2142rem" // 17px
14
16
  };
15
17
 
16
18
  export const fallbackValues = {
@@ -1,11 +1,13 @@
1
1
  import React from "react";
2
2
  import { Box, Cluster, Stack } from "../../../components/atoms/layouts";
3
- import { WHITE, GHOST_GREY, BRIGHT_GREY } from "../../../constants/colors";
3
+ import { WHITE, BRIGHT_GREY, ATHENS_GREY } from "../../../constants/colors";
4
4
  import {
5
5
  IconModule,
6
6
  TitleModule,
7
7
  AmountModule,
8
- PaymentDetailsActions
8
+ PaymentDetailsActions,
9
+ InactiveControlsModule,
10
+ InactiveTitleModule
9
11
  } from "./modules";
10
12
 
11
13
  const Obligation = ({
@@ -21,15 +23,24 @@ const Obligation = ({
21
23
  navigateToSettings,
22
24
  isMobile,
23
25
  isPaymentPlan,
24
- nextAutopayDate
26
+ nextAutopayDate,
27
+ obligationAssocID,
28
+ isActive = true,
29
+ inactiveLookupTitle = "",
30
+ inactiveLookupInput = "Account",
31
+ inactiveLookupValue = ""
25
32
  }) => {
26
33
  const obligation = obligations[0];
27
34
  const { customAttributes } = obligation;
28
- return (
35
+ const boxShadowValue =
36
+ "0px 4px 4px rgba(41, 42, 51, 0.1), 0px 1px 1px 2px rgba(41, 42, 51, 0.1);";
37
+ const activeObligation = (
29
38
  <Box
30
39
  padding="0"
31
40
  borderRadius="4px"
32
- boxShadow={`0px 0px 5px 0px ${GHOST_GREY}`}
41
+ boxShadow={boxShadowValue}
42
+ as="section"
43
+ aria-label={`${obligation.description} ${obligation.subDescription}`}
33
44
  >
34
45
  <Box background={WHITE}>
35
46
  <Stack childGap="14px">
@@ -115,6 +126,78 @@ const Obligation = ({
115
126
  )}
116
127
  </Box>
117
128
  );
129
+
130
+ const inactiveObligation = (
131
+ <Box
132
+ padding="0"
133
+ borderRadius="4px"
134
+ boxShadow={boxShadowValue}
135
+ as="section"
136
+ aria-label={`${inactiveLookupTitle} ${inactiveLookupInput}: ${inactiveLookupValue}`}
137
+ >
138
+ <Box background={ATHENS_GREY}>
139
+ <Stack childGap="14px">
140
+ <Box key={`${obligations[0].id}-top`} padding="0 8px" minWidth="100%">
141
+ <Cluster
142
+ justify="space-between"
143
+ align="center"
144
+ childGap="4px"
145
+ nowrap
146
+ >
147
+ <Box padding="0">
148
+ <Cluster justify="flex-start" align="center">
149
+ <IconModule
150
+ icon={config.icon}
151
+ iconDefault={config.iconDefault}
152
+ configIconMap={config.iconMap}
153
+ iconValue={config.iconValue}
154
+ customAttributes={customAttributes}
155
+ />
156
+ <InactiveTitleModule
157
+ title={inactiveLookupTitle}
158
+ subtitle={`${inactiveLookupInput}: ${inactiveLookupValue}`}
159
+ titleColor={BRIGHT_GREY}
160
+ autoPayEnabled={autoPayEnabled}
161
+ isMobile={isMobile}
162
+ />
163
+ </Cluster>
164
+ </Box>
165
+ {!isMobile && (
166
+ <InactiveControlsModule
167
+ obligations={obligations}
168
+ autoPayEnabled={autoPayEnabled}
169
+ deactivatePaymentSchedule={deactivatePaymentSchedule}
170
+ autoPaySchedule={autoPaySchedule}
171
+ paymentPlanSchedule={paymentPlanSchedule}
172
+ config={config}
173
+ actions={actions}
174
+ isMobile={isMobile}
175
+ nextAutopayDate={nextAutopayDate}
176
+ obligationAssocID={obligationAssocID}
177
+ />
178
+ )}
179
+ </Cluster>
180
+ </Box>
181
+ {isMobile && (
182
+ <InactiveControlsModule
183
+ obligations={obligations}
184
+ autoPayEnabled={autoPayEnabled}
185
+ deactivatePaymentSchedule={deactivatePaymentSchedule}
186
+ autoPaySchedule={autoPaySchedule}
187
+ paymentPlanSchedule={paymentPlanSchedule}
188
+ config={config}
189
+ actions={actions}
190
+ isMobile={isMobile}
191
+ nextAutopayDate={nextAutopayDate}
192
+ obligationAssocID={obligationAssocID}
193
+ />
194
+ )}
195
+ </Stack>
196
+ </Box>
197
+ </Box>
198
+ );
199
+
200
+ return isActive ? activeObligation : inactiveObligation;
118
201
  };
119
202
 
120
203
  export default Obligation;
@@ -0,0 +1,61 @@
1
+ import React, { useState } from "react";
2
+ import { GHOST_GREY } from "../../../../constants/colors";
3
+ import ButtonWithAction from "../../../atoms/button-with-action";
4
+ import { Box, Cluster } from "../../../atoms/layouts";
5
+ import { AutopayModalModule } from "./AutopayModalModule";
6
+
7
+ const InactiveControlsModule = ({
8
+ autoPayEnabled,
9
+ autoPaySchedule,
10
+ navigateToSettings,
11
+ deactivatePaymentSchedule,
12
+ isMobile,
13
+ paymentPlanSchedule,
14
+ isPaymentPlan,
15
+ nextAutopayDate,
16
+ obligationAssocID,
17
+ actions
18
+ }) => {
19
+ const [modalOpen, toggleModal] = useState(false);
20
+ const { removeAccount } = actions;
21
+ const handleRemoveAccount = () => removeAccount(obligationAssocID);
22
+ return (
23
+ <Box
24
+ padding={isMobile ? "18px 0 0 0" : "0"}
25
+ border={isMobile ? `1px solid ${GHOST_GREY}` : `0px`}
26
+ borderWidthOverride={isMobile ? `1px 0 0 0` : `0px`}
27
+ >
28
+ <Cluster childGap={isMobile ? `8px` : `18px`}>
29
+ {autoPayEnabled && (
30
+ <Box padding="0" extraStyles={`flex-grow: 1;`}>
31
+ <AutopayModalModule
32
+ autoPayActive={autoPayEnabled}
33
+ autoPaySchedule={autoPaySchedule}
34
+ toggleModal={toggleModal}
35
+ modalOpen={modalOpen}
36
+ navigateToSettings={navigateToSettings}
37
+ deactivatePaymentSchedule={deactivatePaymentSchedule}
38
+ buttonLinkType
39
+ isMobile={isMobile}
40
+ paymentPlanSchedule={paymentPlanSchedule}
41
+ isPaymentPlan={isPaymentPlan}
42
+ nextAutopayDate={nextAutopayDate}
43
+ obligationAssocID={obligationAssocID}
44
+ />
45
+ </Box>
46
+ )}
47
+ <Box padding="0" extraStyles={`flex-grow: 1;`}>
48
+ <ButtonWithAction
49
+ variant="tertiary"
50
+ text="Remove"
51
+ action={handleRemoveAccount}
52
+ dataQa="Remove Account"
53
+ extraStyles={isMobile && `flex-grow: 1; width: 100%;`}
54
+ />
55
+ </Box>
56
+ </Cluster>
57
+ </Box>
58
+ );
59
+ };
60
+
61
+ export default InactiveControlsModule;
@@ -0,0 +1,41 @@
1
+ import React from "react";
2
+ import { Box, Stack } from "../../../atoms/layouts";
3
+ import Title from "../../../atoms/title";
4
+ import Detail from "../../../atoms/detail";
5
+ import { BLACK, CHARADE_GREY, ZEST_ORANGE } from "../../../../constants/colors";
6
+ import { FONT_WEIGHT_SEMIBOLD } from "../../../../constants/style_constants";
7
+
8
+ const InactiveTitleModule = ({ title, subtitle, autoPayEnabled }) => (
9
+ <Box padding="0">
10
+ <Stack childGap="0">
11
+ <Title
12
+ variant="small"
13
+ as="h4"
14
+ color={CHARADE_GREY}
15
+ weight={FONT_WEIGHT_SEMIBOLD}
16
+ >
17
+ {title}
18
+ </Title>
19
+ <Detail variant="small" as="h5" color={CHARADE_GREY}>
20
+ {subtitle}
21
+ </Detail>
22
+ <Detail
23
+ variant="small"
24
+ as="p"
25
+ color={ZEST_ORANGE}
26
+ weight={FONT_WEIGHT_SEMIBOLD}
27
+ >
28
+ Unable to load account details
29
+ </Detail>
30
+ <Detail variant="extraSmall" as="p" color={BLACK}>
31
+ {`This may mean that the account has been paid off or there was an error loading it. If you have questions about this account, please contact us.${
32
+ autoPayEnabled
33
+ ? " You may disable Autopay for this account by pressing the Turn off Autopay button."
34
+ : ""
35
+ }`}
36
+ </Detail>
37
+ </Stack>
38
+ </Box>
39
+ );
40
+
41
+ export default InactiveTitleModule;
@@ -1,23 +1,29 @@
1
1
  import React from "react";
2
2
  import { Box, Stack } from "../../../atoms/layouts";
3
- import Heading from "../../../atoms/heading";
4
- import Text from "../../../atoms/text";
3
+ import Title from "../../../atoms/title";
4
+ import Detail from "../../../atoms/detail";
5
5
  import { FONT_WEIGHT_SEMIBOLD } from "../../../../constants/style_constants";
6
6
 
7
7
  const TitleModule = ({ title, subtitle, titleColor, subtitleColor }) => (
8
8
  <Box padding="0">
9
9
  <Stack childGap="0">
10
- <Heading
11
- variant="h6"
10
+ <Title
11
+ variant="small"
12
12
  weight={FONT_WEIGHT_SEMIBOLD}
13
13
  color={titleColor}
14
- as="h2"
14
+ as="h4"
15
+ id="obligation-title"
15
16
  >
16
17
  {title}
17
- </Heading>
18
- <Text variant="pS" color={subtitleColor}>
18
+ </Title>
19
+ <Detail
20
+ variant="small"
21
+ color={subtitleColor}
22
+ as="h5"
23
+ id="obligation-subtitle"
24
+ >
19
25
  {subtitle}
20
- </Text>
26
+ </Detail>
21
27
  </Stack>
22
28
  </Box>
23
29
  );
@@ -2,5 +2,14 @@ import IconModule from "./IconModule";
2
2
  import TitleModule from "./TitleModule";
3
3
  import AmountModule from "./AmountModule";
4
4
  import PaymentDetailsActions from "./PaymentDetailsActions";
5
+ import InactiveControlsModule from "./InactiveControlsModule";
6
+ import InactiveTitleModule from "./InactiveTitleModule";
5
7
 
6
- export { IconModule, TitleModule, AmountModule, PaymentDetailsActions };
8
+ export {
9
+ IconModule,
10
+ TitleModule,
11
+ AmountModule,
12
+ PaymentDetailsActions,
13
+ InactiveControlsModule,
14
+ InactiveTitleModule
15
+ };
Binary file