@thecb/components 5.9.1 → 5.10.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.
Files changed (42) hide show
  1. package/dist/index.cjs.js +350 -157
  2. package/dist/index.cjs.js.map +1 -1
  3. package/dist/index.esm.js +350 -157
  4. package/dist/index.esm.js.map +1 -1
  5. package/package.json +11 -11
  6. package/src/components/atoms/amount-callout/AmountCallout.theme.js +1 -1
  7. package/src/components/atoms/button-with-action/ButtonWithAction.js +2 -0
  8. package/src/components/atoms/button-with-link/ButtonWithLink.js +10 -1
  9. package/src/components/atoms/icons/AutopayOnIcon.js +4 -10
  10. package/src/components/atoms/layouts/Box.styled.js +3 -5
  11. package/src/components/atoms/layouts/Cluster.js +1 -1
  12. package/src/components/atoms/layouts/Cluster.styled.js +1 -1
  13. package/src/components/atoms/layouts/examples/cluster-example/ClusterExample.stories.js +5 -12
  14. package/src/components/atoms/layouts/examples/cover-example/CoverExample.stories.js +2 -6
  15. package/src/components/atoms/layouts/examples/grid-example/GridExample.stories.js +3 -6
  16. package/src/components/atoms/layouts/examples/sidebar-example/SidebarExample.stories.js +3 -6
  17. package/src/components/atoms/layouts/examples/stack-example/StackExample.stories.js +5 -12
  18. package/src/components/atoms/layouts/examples/switcher-example/SwitcherExample.stories.js +4 -9
  19. package/src/components/atoms/link/ExternalLink.js +2 -0
  20. package/src/components/atoms/link/InternalLink.js +2 -0
  21. package/src/components/atoms/placeholder/Placeholder.js +1 -1
  22. package/src/components/atoms/text/Text.js +2 -0
  23. package/src/components/atoms/text/Text.styled.js +1 -0
  24. package/src/components/molecules/obligation/Obligation.js +46 -16
  25. package/src/components/molecules/obligation/modules/AmountModule.js +1 -0
  26. package/src/components/molecules/obligation/modules/AutopayModalModule.js +80 -47
  27. package/src/components/molecules/obligation/modules/InactiveControlsModule.js +20 -10
  28. package/src/components/molecules/obligation/modules/InactiveTitleModule.js +2 -2
  29. package/src/components/molecules/obligation/modules/PaymentDetailsActions.js +8 -9
  30. package/src/components/molecules/obligation/modules/RemoveAccountModalModule.js +62 -0
  31. package/src/components/molecules/obligation/modules/index.js +3 -1
  32. package/src/components/molecules/payment-details/PaymentDetails.js +80 -7
  33. package/src/components/molecules/payment-details/PaymentDetails.stories.js +93 -3
  34. package/src/components/molecules/tab-sidebar/TabSidebar.js +3 -2
  35. package/src/components/molecules/workflow-tile/WorkflowTile.js +1 -0
  36. package/src/components/templates/center-single/CenterSingle.js +2 -1
  37. package/src/components/templates/center-stack/CenterStack.js +2 -1
  38. package/src/components/templates/default-page-template/DefaultPageTemplate.js +2 -1
  39. package/src/components/templates/sidebar-single-content/SidebarSingleContent.js +2 -1
  40. package/src/components/templates/sidebar-stack-content/SidebarStackContent.js +2 -1
  41. package/src/components/templates/templates.theme.js +1 -1
  42. package/src/constants/colors.js +10 -8
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thecb/components",
3
- "version": "5.9.1",
3
+ "version": "5.10.0",
4
4
  "description": "Common lib for CityBase react components",
5
5
  "main": "dist/index.cjs.js",
6
6
  "module": "dist/index.esm.js",
@@ -30,14 +30,14 @@
30
30
  "@babel/preset-react": "^7.0.0",
31
31
  "@babel/register": "^7.6.2",
32
32
  "@rollup/plugin-json": "^4.0.3",
33
- "@storybook/addon-a11y": "5.3.14",
34
- "@storybook/addon-actions": "^5.3.14",
35
- "@storybook/addon-console": "^1.2.1",
36
- "@storybook/addon-docs": "^5.3.19",
33
+ "@storybook/addon-a11y": "6.4.22",
34
+ "@storybook/addon-actions": "^6.4.22",
35
+ "@storybook/addon-console": "^1.2.3",
36
+ "@storybook/addon-docs": "^6.4.22",
37
37
  "@storybook/addon-knobs": "^5.3.14",
38
- "@storybook/addon-storysource": "^5.3.14",
39
- "@storybook/addon-viewport": "^5.3.14",
40
- "@storybook/react": "^5.3.14",
38
+ "@storybook/addon-storysource": "^6.4.22",
39
+ "@storybook/addon-viewport": "^6.4.22",
40
+ "@storybook/react": "^6.4.22",
41
41
  "babel-core": "^6.26.3",
42
42
  "babel-loader": "^8.1.0",
43
43
  "babel-preset-env": "^1.7.0",
@@ -52,7 +52,7 @@
52
52
  "prettier": "^1.19.1",
53
53
  "pretty-quick": "^2.0.1",
54
54
  "react-redux": "^7.2.0",
55
- "react-router-dom": "6.0.0-alpha.3",
55
+ "react-router-dom": "^6.3.0",
56
56
  "redux": "^4.0.5",
57
57
  "rollup": "^1.21.4",
58
58
  "rollup-plugin-babel": "^4.3.3",
@@ -60,13 +60,13 @@
60
60
  "rollup-plugin-json": "^4.0.0",
61
61
  "rollup-plugin-node-resolve": "^5.1.0",
62
62
  "rollup-plugin-visualizer": "^4.0.4",
63
- "storybook": "^5.3.14",
63
+ "storybook": "^6.4.22",
64
64
  "styled-theming": "^2.2.0"
65
65
  },
66
66
  "peerDependencies": {
67
67
  "react": "^16.13.1",
68
68
  "react-dom": "^16.13.1",
69
- "react-router-dom": "6.0.0-alpha.3",
69
+ "react-router-dom": "^6.3.0",
70
70
  "styled-theming": "^2.2.0"
71
71
  },
72
72
  "husky": {
@@ -1,4 +1,4 @@
1
- const color = "#15749D";
1
+ const color = "#292A33";
2
2
 
3
3
  export const fallbackValues = {
4
4
  color
@@ -64,6 +64,7 @@ const ButtonWithAction = ({
64
64
  action = noop,
65
65
  variant = "primary",
66
66
  text,
67
+ textWrap = false,
67
68
  isLoading = false,
68
69
  dataQa = null,
69
70
  textExtraStyles,
@@ -143,6 +144,7 @@ const ButtonWithAction = ({
143
144
  weight={themeValues.fontWeight}
144
145
  variant={themeValues.fontSizeVariant}
145
146
  color={themeValues.color}
147
+ textWrap={textWrap}
146
148
  extraStyles={textExtraStyles}
147
149
  >
148
150
  {text}
@@ -12,6 +12,7 @@ const ButtonWithLink = ({
12
12
  extraStyles,
13
13
  linkExtraStyles,
14
14
  newTab = false,
15
+ dataQa,
15
16
  ...otherProps
16
17
  }) => {
17
18
  const ButtonWithLinkWrapper = ({
@@ -19,6 +20,7 @@ const ButtonWithLink = ({
19
20
  url,
20
21
  disabled,
21
22
  newTab,
23
+ dataQa,
22
24
  extraStyles
23
25
  }) => {
24
26
  if (disabled) {
@@ -30,11 +32,17 @@ const ButtonWithLink = ({
30
32
  tabIndex="-1"
31
33
  newTab={newTab}
32
34
  extraStyles={extraStyles}
35
+ dataQa={dataQa}
33
36
  >
34
37
  {safeChildren(children, <span />)}
35
38
  </ExternalLink>
36
39
  ) : (
37
- <InternalLink to={url} tabIndex="-1" extraStyles={extraStyles}>
40
+ <InternalLink
41
+ to={url}
42
+ tabIndex="-1"
43
+ dataQa={dataQa}
44
+ extraStyles={extraStyles}
45
+ >
38
46
  {safeChildren(children, <span />)}
39
47
  </InternalLink>
40
48
  );
@@ -47,6 +55,7 @@ const ButtonWithLink = ({
47
55
  newTab={newTab}
48
56
  extraStyles={`${linkExtraStyles} text-decoration: none; &:hover {
49
57
  text-decoration: none; }`}
58
+ dataQa={dataQa}
50
59
  >
51
60
  <ButtonWithAction {...otherProps} extraStyles={extraStyles} />
52
61
  </ButtonWithLinkWrapper>
@@ -1,8 +1,7 @@
1
1
  import React from "react";
2
- import { fallbackValues } from "./Icons.theme";
3
- import { themeComponent } from "../../../util/themeUtils";
2
+ import { SEA_GREEN } from "../../../constants/colors";
4
3
 
5
- const AutopayOnIcon = ({ themeValues }) => (
4
+ const AutopayOnIcon = () => (
6
5
  <svg
7
6
  xmlns="http://www.w3.org/2000/svg"
8
7
  width="12"
@@ -12,7 +11,7 @@ const AutopayOnIcon = ({ themeValues }) => (
12
11
  <g fill="none" fillRule="evenodd" stroke="none" strokeWidth="1">
13
12
  <path
14
13
  className="autopayIcon"
15
- fill={themeValues.primaryColor}
14
+ fill={SEA_GREEN}
16
15
  fillRule="nonzero"
17
16
  d="M1.898 5.75c.079 0 .141-.02.188-.059a.281.281 0 00.094-.152 3.825 3.825 0 011.394-2.144A3.838 3.838 0 016 2.563c.5 0 .98.09 1.441.27.461.179.88.44 1.254.784l-.984.985A.542.542 0 007.547 5c0 .156.055.29.164.398.11.11.242.165.398.165h3.141c.156 0 .289-.055.398-.165A.542.542 0 0011.812 5V1.86a.542.542 0 00-.164-.399.542.542 0 00-.398-.164.542.542 0 00-.398.164l-.844.844A5.699 5.699 0 006 .688c-.938 0-1.809.207-2.613.62-.805.415-1.48.981-2.028 1.7A5.726 5.726 0 00.281 5.422a.265.265 0 00.059.223c.055.07.129.105.222.105h1.336zM6 12.312c.937 0 1.809-.207 2.613-.62a5.919 5.919 0 002.028-1.7 5.726 5.726 0 001.078-2.414.265.265 0 00-.059-.223.267.267 0 00-.223-.105h-1.335c-.079 0-.141.02-.188.059a.281.281 0 00-.094.152 3.825 3.825 0 01-1.394 2.144c-.711.555-1.52.833-2.426.833-.5 0-.98-.09-1.441-.27a3.985 3.985 0 01-1.254-.785l.984-.985A.542.542 0 004.453 8a.542.542 0 00-.164-.398.542.542 0 00-.398-.164H.75a.542.542 0 00-.398.164A.542.542 0 00.187 8v3.14c0 .157.055.29.165.4.109.108.242.163.398.163.156 0 .29-.055.398-.164l.844-.844A5.699 5.699 0 006 12.312z"
18
17
  ></path>
@@ -20,9 +19,4 @@ const AutopayOnIcon = ({ themeValues }) => (
20
19
  </svg>
21
20
  );
22
21
 
23
- export default themeComponent(
24
- AutopayOnIcon,
25
- "Icons",
26
- fallbackValues,
27
- "primary"
28
- );
22
+ export default AutopayOnIcon;
@@ -35,8 +35,8 @@ export const BoxWrapper = styled(
35
35
  position: relative;
36
36
  box-sizing: border-box;
37
37
  padding: ${({ padding }) => padding};
38
- border: ${({ borderSize, borderColor }) =>
39
- `${borderSize} solid ${borderColor}`};
38
+ border: ${({ border, borderSize, borderColor }) =>
39
+ border ? border : `${borderSize} solid ${borderColor}`};
40
40
  box-shadow: ${({ boxShadow }) => boxShadow};
41
41
  background-color: ${({ background }) => background};
42
42
  min-height: ${({ minHeight }) => (minHeight ? minHeight : "auto")};
@@ -45,9 +45,7 @@ export const BoxWrapper = styled(
45
45
  max-width: ${({ maxWidth }) => (maxWidth ? maxWidth : "auto")};
46
46
  color: ${({ color }) => color};
47
47
  border-radius: ${({ borderRadius }) => borderRadius};
48
- border-width: ${({ borderWidthOverride, borderSize }) =>
49
- borderWidthOverride ? borderWidthOverride : borderSize};
50
- border: ${({ border }) => border};
48
+ border-width: ${({ borderWidthOverride }) => borderWidthOverride};
51
49
  text-align: ${({ textAlign }) => textAlign};
52
50
 
53
51
  &:hover {
@@ -40,7 +40,7 @@ const Cluster = ({
40
40
  childGap={childGap}
41
41
  minHeight={minHeight}
42
42
  minWidth={minWidth}
43
- nowrap={nowrap}
43
+ $nowrap={nowrap}
44
44
  >
45
45
  {safeChildren(children, <Fragment />)}
46
46
  </ClusterInnerWrapper>
@@ -16,7 +16,7 @@ export const ClusterWrapper = styled(({ overflow, ...props }) => (
16
16
  export const ClusterInnerWrapper = styled.div`
17
17
  box-sizing: border-box;
18
18
  display: flex;
19
- flex-wrap: ${({ nowrap }) => (nowrap ? "nowrap" : "wrap")};
19
+ flex-wrap: ${({ $nowrap }) => ($nowrap ? "nowrap" : "wrap")};
20
20
  justify-content: ${({ justify }) => justify};
21
21
  align-items: ${({ align }) => align};
22
22
  margin: calc(${({ childGap }) => childGap} / 2 * -1);
@@ -1,5 +1,5 @@
1
1
  import React from "react";
2
- import { withKnobs, text, radios } from "@storybook/addon-knobs";
2
+ import { text, radios } from "@storybook/addon-knobs";
3
3
  import ClusterExample from "./ClusterExample";
4
4
  import Cover from "../../Cover";
5
5
  import Center from "../../Center";
@@ -8,10 +8,9 @@ import ResizingContainer from "../ResizingContainer";
8
8
  import LayoutContentBlock from "../LayoutContentBlock";
9
9
 
10
10
  export default {
11
- title: "Layouts|Basic Layouts/Cluster",
11
+ title: "Layouts/Basic Layouts/Cluster",
12
12
  component: ClusterExample,
13
13
  decorators: [
14
- withKnobs,
15
14
  storyFn => (
16
15
  <Cover>
17
16
  <div />
@@ -59,9 +58,7 @@ export const basicCluster = () => (
59
58
  </ResizingContainer>
60
59
  );
61
60
 
62
- basicCluster.story = {
63
- name: "Resizing Nav Cluster"
64
- };
61
+ basicCluster.storyName = "Resizing Nav Cluster";
65
62
 
66
63
  export const formButtonCluster = () => (
67
64
  <FixedSizeContainer
@@ -75,9 +72,7 @@ export const formButtonCluster = () => (
75
72
  </FixedSizeContainer>
76
73
  );
77
74
 
78
- formButtonCluster.story = {
79
- name: "Form Button Cluster"
80
- };
75
+ formButtonCluster.storyName = "Form Button Cluster";
81
76
 
82
77
  export const formInputCluster = () => (
83
78
  <ResizingContainer
@@ -92,6 +87,4 @@ export const formInputCluster = () => (
92
87
  </ResizingContainer>
93
88
  );
94
89
 
95
- formInputCluster.story = {
96
- name: "Form Input Cluster"
97
- };
90
+ formInputCluster.storyName = "Form Input Cluster";
@@ -27,9 +27,7 @@ export const cover = () => (
27
27
  </Cover>
28
28
  );
29
29
 
30
- cover.story = {
31
- name: "Cover with Multiple Children"
32
- };
30
+ cover.storyName = "Cover with Multiple Children";
33
31
 
34
32
  export const coverSingleChild = () => (
35
33
  <Cover
@@ -48,6 +46,4 @@ export const coverSingleChild = () => (
48
46
  </Cover>
49
47
  );
50
48
 
51
- coverSingleChild.story = {
52
- name: "Cover with Single Child"
53
- };
49
+ coverSingleChild.storyName = "Cover with Single Child";
@@ -1,15 +1,14 @@
1
1
  import React from "react";
2
- import { withKnobs, text, radios, number } from "@storybook/addon-knobs";
2
+ import { text, radios, number } from "@storybook/addon-knobs";
3
3
  import GridExample from "./GridExample";
4
4
  import Cover from "../../Cover";
5
5
  import Center from "../../Center";
6
6
  import ResizingContainer from "../ResizingContainer";
7
7
 
8
8
  export default {
9
- title: "Layouts|Basic Layouts/Grid",
9
+ title: "Layouts/Basic Layouts/Grid",
10
10
  component: GridExample,
11
11
  decorators: [
12
- withKnobs,
13
12
  storyFn => (
14
13
  <Cover>
15
14
  <div />
@@ -39,6 +38,4 @@ export const basicGrid = () => (
39
38
  </ResizingContainer>
40
39
  );
41
40
 
42
- basicGrid.story = {
43
- name: "Grid of cards"
44
- };
41
+ basicGrid.storyName = "Grid of cards";
@@ -1,5 +1,5 @@
1
1
  import React from "react";
2
- import { withKnobs, text, radios } from "@storybook/addon-knobs";
2
+ import { text, radios } from "@storybook/addon-knobs";
3
3
  import SidebarExample from "./SidebarExample";
4
4
  //import Stack from "../../Stack";
5
5
  import Switcher from "../../Switcher";
@@ -10,10 +10,9 @@ import ResizingContainer from "../ResizingContainer";
10
10
  import LayoutContentBlock from "../LayoutContentBlock";
11
11
 
12
12
  export default {
13
- title: "Layouts|Basic Layouts/Sidebar",
13
+ title: "Layouts/Basic Layouts/Sidebar",
14
14
  component: SidebarExample,
15
15
  decorators: [
16
- withKnobs,
17
16
  storyFn => (
18
17
  <Cover>
19
18
  <div />
@@ -82,6 +81,4 @@ export const basicSidebar = () => (
82
81
  </ResizingContainer>
83
82
  );
84
83
 
85
- basicSidebar.story = {
86
- name: "Sidebar and content"
87
- };
84
+ basicSidebar.storyName = "Sidebar and content";
@@ -1,5 +1,5 @@
1
1
  import React from "react";
2
- import { withKnobs, text, number, boolean } from "@storybook/addon-knobs";
2
+ import { text, number, boolean } from "@storybook/addon-knobs";
3
3
  import StackExample from "./StackExample";
4
4
  import Cover from "../../Cover";
5
5
  import Center from "../../Center";
@@ -7,10 +7,9 @@ import FixedSizeContainer from "../FixedSizeContainer";
7
7
  import { TROUT_GREY } from "../../../../../constants/colors";
8
8
 
9
9
  export default {
10
- title: "Layouts|Basic Layouts/Stack",
10
+ title: "Layouts/Basic Layouts/Stack",
11
11
  component: StackExample,
12
12
  decorators: [
13
- withKnobs,
14
13
  storyFn => (
15
14
  <Cover>
16
15
  <div />
@@ -36,9 +35,7 @@ export const basicStack = () => (
36
35
  </FixedSizeContainer>
37
36
  );
38
37
 
39
- basicStack.story = {
40
- name: "Basic Stack"
41
- };
38
+ basicStack.storyName = "Basic Stack";
42
39
 
43
40
  export const bottomItemStack = () => (
44
41
  <FixedSizeContainer
@@ -50,9 +47,7 @@ export const bottomItemStack = () => (
50
47
  </FixedSizeContainer>
51
48
  );
52
49
 
53
- bottomItemStack.story = {
54
- name: "Bottom Item Stack"
55
- };
50
+ bottomItemStack.storyName = "Bottom Item Stack";
56
51
 
57
52
  export const splitStack = () => (
58
53
  <FixedSizeContainer
@@ -64,6 +59,4 @@ export const splitStack = () => (
64
59
  </FixedSizeContainer>
65
60
  );
66
61
 
67
- splitStack.story = {
68
- name: "Split Stack"
69
- };
62
+ splitStack.storyName = "Split Stack";
@@ -1,5 +1,5 @@
1
1
  import React from "react";
2
- import { withKnobs, text, radios, number } from "@storybook/addon-knobs";
2
+ import { text, radios, number } from "@storybook/addon-knobs";
3
3
  import SwitcherExample from "./SwitcherExample";
4
4
  import Cover from "../../Cover";
5
5
  import Center from "../../Center";
@@ -7,10 +7,9 @@ import FixedSizeContainer from "../FixedSizeContainer";
7
7
  import ResizingContainer from "../ResizingContainer";
8
8
 
9
9
  export default {
10
- title: "Layouts|Basic Layouts/Switcher",
10
+ title: "Layouts/Basic Layouts/Switcher",
11
11
  component: SwitcherExample,
12
12
  decorators: [
13
- withKnobs,
14
13
  storyFn => (
15
14
  <Cover>
16
15
  <div />
@@ -42,9 +41,7 @@ export const basicSwitcher = () => (
42
41
  </ResizingContainer>
43
42
  );
44
43
 
45
- basicSwitcher.story = {
46
- name: "Resizing Switcher"
47
- };
44
+ basicSwitcher.storyName = "Resizing Switcher";
48
45
 
49
46
  export const childLimitSwitcher = () => (
50
47
  <FixedSizeContainer
@@ -60,6 +57,4 @@ export const childLimitSwitcher = () => (
60
57
  </FixedSizeContainer>
61
58
  );
62
59
 
63
- childLimitSwitcher.story = {
64
- name: "Limited Children Switcher"
65
- };
60
+ childLimitSwitcher.storyName = "Limited Children Switcher";
@@ -15,6 +15,7 @@ const ExternalLink = ({
15
15
  extraStyles = ``,
16
16
  variant = "primary",
17
17
  tabIndex = "0",
18
+ dataQa,
18
19
  children
19
20
  }) => {
20
21
  const themeContext = useContext(ThemeContext);
@@ -39,6 +40,7 @@ const ExternalLink = ({
39
40
  tabIndex={tabIndex}
40
41
  extrastyles={extraStyles}
41
42
  rel={newTab ? "noopener" : ""}
43
+ data-qa={dataQa}
42
44
  >
43
45
  {safeChildren(children, <span />)}
44
46
  </StyledExternalLink>
@@ -16,6 +16,7 @@ const InternalLink = ({
16
16
  variant = "primary",
17
17
  margin,
18
18
  tabIndex = "0",
19
+ dataQa,
19
20
  extraStyles = ``
20
21
  }) => {
21
22
  const themeContext = useContext(ThemeContext);
@@ -40,6 +41,7 @@ const InternalLink = ({
40
41
  activeColor={themeValues.activeColor}
41
42
  tabIndex={tabIndex}
42
43
  extrastyles={extraStyles}
44
+ data-qa={dataQa}
43
45
  >
44
46
  {safeChildren(children, <span />)}
45
47
  </StyledInternalLink>
@@ -21,7 +21,7 @@ const PlaceholderContentWrapper = ({
21
21
  dataQa
22
22
  }) =>
23
23
  isLink ? (
24
- <Link to={destination} dataQa={dataQa}>
24
+ <Link to={destination} data-qa={dataQa}>
25
25
  <Box padding="0" minHeight="100%" extraStyles={`cursor: pointer;`}>
26
26
  {children}
27
27
  </Box>
@@ -10,6 +10,7 @@ const Text = ({
10
10
  themeValues,
11
11
  weight = FONT_WEIGHT_REGULAR,
12
12
  color = FIREFLY_GREY,
13
+ textWrap = true,
13
14
  extraStyles = ``,
14
15
  hoverStyles,
15
16
  onClick,
@@ -30,6 +31,7 @@ const Text = ({
30
31
  onClick={onClick}
31
32
  onKeyPress={onKeyPress}
32
33
  data-qa={dataQa}
34
+ $textWrap={textWrap}
33
35
  {...rest}
34
36
  >
35
37
  {safeChildren(children, <span />)}
@@ -8,6 +8,7 @@ export const TextSpan = styled.span`
8
8
  font-weight: ${({ weight }) => weight};
9
9
  font-family: ${({ fontFamily }) => fontFamily};
10
10
  color: ${({ color }) => color};
11
+ white-space: ${({ $textWrap }) => ($textWrap ? "initial" : "nowrap")};
11
12
 
12
13
  &:hover {
13
14
  ${({ hoverStyles }) =>
@@ -1,6 +1,11 @@
1
1
  import React from "react";
2
2
  import { Box, Cluster, Stack } from "../../../components/atoms/layouts";
3
- import { WHITE, BRIGHT_GREY, ATHENS_GREY } from "../../../constants/colors";
3
+ import {
4
+ WHITE,
5
+ BRIGHT_GREY,
6
+ ATHENS_GREY,
7
+ GRECIAN_GREY
8
+ } from "../../../constants/colors";
4
9
  import {
5
10
  IconModule,
6
11
  TitleModule,
@@ -25,26 +30,43 @@ const Obligation = ({
25
30
  isPaymentPlan,
26
31
  nextAutopayDate,
27
32
  obligationAssocID,
28
- isActive = true,
33
+ dueDate,
34
+ agencyName,
35
+ inactive = false,
29
36
  inactiveLookupTitle = "",
30
37
  inactiveLookupInput = "Account",
31
38
  inactiveLookupValue = ""
32
39
  }) => {
33
- const obligation = obligations[0];
34
- const { customAttributes } = obligation;
40
+ /*
41
+ The value of obligations is always an array. It can contain:
42
+ - A single obligation
43
+ - A group of obligations (a "collection")
44
+
45
+ The top level desc/subdesc for all obligations in a collection is the same
46
+ (Collection accounts look different in the Account Details page)
47
+ */
48
+ const firstObligation = obligations[0];
49
+ const customAttributes = firstObligation?.customAttributes ?? {};
35
50
  const boxShadowValue =
36
- "0px 4px 4px rgba(41, 42, 51, 0.1), 0px 1px 1px 2px rgba(41, 42, 51, 0.1);";
51
+ "0px 2px 4px rgba(41, 42, 51, 0.1), 0px 1px 1px 2px rgba(41, 42, 51, 0.1);";
37
52
  const activeObligation = (
38
53
  <Box
39
54
  padding="0"
40
55
  borderRadius="4px"
41
56
  boxShadow={boxShadowValue}
42
57
  as="section"
43
- aria-label={`${obligation.description} ${obligation.subDescription}`}
58
+ aria-label={`${firstObligation?.description ??
59
+ "account"} ${firstObligation?.subDescription ?? obligationAssocID}`}
60
+ border={`1px solid ${GRECIAN_GREY}`}
61
+ borderWidthOverride="1px 0 0 0"
44
62
  >
45
- <Box background={WHITE}>
63
+ <Box background={WHITE} padding={isMobile ? "16px" : "24px 16px"}>
46
64
  <Stack childGap="14px">
47
- <Box key={`${obligations[0].id}-top`} padding="0 8px" minWidth="100%">
65
+ <Box
66
+ key={`${firstObligation?.id}-top`}
67
+ padding="0 8px"
68
+ minWidth="100%"
69
+ >
48
70
  <Cluster
49
71
  justify="space-between"
50
72
  align="center"
@@ -63,8 +85,8 @@ const Obligation = ({
63
85
  />
64
86
  )}
65
87
  <TitleModule
66
- title={obligation.description}
67
- subtitle={obligation.subDescription}
88
+ title={firstObligation?.description}
89
+ subtitle={firstObligation?.subDescription}
68
90
  titleColor={BRIGHT_GREY}
69
91
  isMobile={isMobile}
70
92
  />
@@ -72,7 +94,7 @@ const Obligation = ({
72
94
  </Box>
73
95
  {!isMobile && (
74
96
  <AmountModule
75
- totalAmountDue={obligations.reduce(
97
+ totalAmountDue={obligations?.reduce(
76
98
  (acc, curr) => acc + curr.amountDue,
77
99
  0
78
100
  )}
@@ -103,6 +125,7 @@ const Obligation = ({
103
125
  isMobile={isMobile}
104
126
  isPaymentPlan={isPaymentPlan}
105
127
  nextAutopayDate={nextAutopayDate}
128
+ obligationAssocID={obligationAssocID}
106
129
  />
107
130
  )}
108
131
  </Stack>
@@ -122,6 +145,7 @@ const Obligation = ({
122
145
  isMobile={isMobile}
123
146
  isPaymentPlan={isPaymentPlan}
124
147
  nextAutopayDate={nextAutopayDate}
148
+ obligationAssocID={obligationAssocID}
125
149
  />
126
150
  )}
127
151
  </Box>
@@ -135,17 +159,17 @@ const Obligation = ({
135
159
  as="section"
136
160
  aria-label={`${inactiveLookupTitle} ${inactiveLookupInput}: ${inactiveLookupValue}`}
137
161
  >
138
- <Box background={ATHENS_GREY}>
162
+ <Box background={ATHENS_GREY} padding={isMobile ? "16px" : "24px"}>
139
163
  <Stack childGap="14px">
140
- <Box key={`${obligations[0].id}-top`} padding="0 8px" minWidth="100%">
164
+ <Box key={`${obligationAssocID}-top`} padding="0" minWidth="100%">
141
165
  <Cluster
142
166
  justify="space-between"
143
167
  align="center"
144
- childGap="4px"
168
+ childGap="40px"
145
169
  nowrap
146
170
  >
147
171
  <Box padding="0">
148
- <Cluster justify="flex-start" align="center">
172
+ <Cluster justify="flex-start" align="center" nowrap>
149
173
  <IconModule
150
174
  icon={config.icon}
151
175
  iconDefault={config.iconDefault}
@@ -174,6 +198,9 @@ const Obligation = ({
174
198
  isMobile={isMobile}
175
199
  nextAutopayDate={nextAutopayDate}
176
200
  obligationAssocID={obligationAssocID}
201
+ dueDate={dueDate}
202
+ agencyName={agencyName}
203
+ configType={config.type}
177
204
  />
178
205
  )}
179
206
  </Cluster>
@@ -190,6 +217,9 @@ const Obligation = ({
190
217
  isMobile={isMobile}
191
218
  nextAutopayDate={nextAutopayDate}
192
219
  obligationAssocID={obligationAssocID}
220
+ dueDate={dueDate}
221
+ agencyName={agencyName}
222
+ configType={config.type}
193
223
  />
194
224
  )}
195
225
  </Stack>
@@ -197,7 +227,7 @@ const Obligation = ({
197
227
  </Box>
198
228
  );
199
229
 
200
- return isActive ? activeObligation : inactiveObligation;
230
+ return inactive ? inactiveObligation : activeObligation;
201
231
  };
202
232
 
203
233
  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>