@thecb/components 10.2.1-beta.0 → 10.4.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.
Files changed (33) hide show
  1. package/README.md +2 -2
  2. package/dist/index.cjs.js +153 -212
  3. package/dist/index.cjs.js.map +1 -1
  4. package/dist/index.d.ts +0 -36
  5. package/dist/index.esm.js +152 -211
  6. package/dist/index.esm.js.map +1 -1
  7. package/dist/src/apps/checkout/pages/payment/sub-pages/payment-amount/PaymentAmount_old.js +49322 -0
  8. package/package.json +1 -1
  9. package/src/.DS_Store +0 -0
  10. package/src/components/.DS_Store +0 -0
  11. package/src/components/atoms/.DS_Store +0 -0
  12. package/src/components/atoms/breadcrumb/Breadcrumb.js +3 -4
  13. package/src/components/atoms/breadcrumb/Breadcrumb.theme.js +2 -5
  14. package/src/components/atoms/button-with-action/ButtonWithAction.js +12 -9
  15. package/src/components/atoms/button-with-action/ButtonWithAction.stories.js +1 -4
  16. package/src/components/atoms/button-with-action/ButtonWithAction.theme.js +2 -22
  17. package/src/components/atoms/button-with-link/ButtonWithLink.js +3 -7
  18. package/src/components/atoms/icons/.DS_Store +0 -0
  19. package/src/components/atoms/layouts/Box.styled.js +0 -15
  20. package/src/components/atoms/link/ExternalLink.styled.js +3 -6
  21. package/src/components/atoms/link/InternalLink.styled.js +3 -6
  22. package/src/components/atoms/text/Text.js +0 -2
  23. package/src/components/atoms/text/Text.styled.js +0 -1
  24. package/src/components/molecules/obligation/Obligation.js +4 -1
  25. package/src/components/molecules/obligation/modules/PaymentDetailsActions.js +5 -4
  26. package/src/components/molecules/pagination/Pagination.js +7 -1
  27. package/src/components/molecules/pagination/Pagination.theme.js +2 -1
  28. package/src/components/molecules/tab-sidebar/TabSidebar.js +1 -0
  29. package/src/constants/index.d.ts +1 -2
  30. package/src/constants/index.js +3 -12
  31. package/src/constants/style_constants.js +1 -3
  32. package/src/components/molecules/pagination/Pagination.stories.js +0 -32
  33. package/src/constants/style_constants.d.ts +0 -11
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thecb/components",
3
- "version": "10.2.1-beta.0",
3
+ "version": "10.4.0-beta.0",
4
4
  "description": "Common lib for CityBase react components",
5
5
  "main": "dist/index.cjs.js",
6
6
  "typings": "dist/index.d.ts",
package/src/.DS_Store ADDED
Binary file
Binary file
Binary file
@@ -34,15 +34,14 @@ const Breadcrumbs = ({ breadcrumbsList = [] }) => {
34
34
  extraStyles={`
35
35
  text-transform: uppercase;
36
36
  ${isActive.toString() === "true" &&
37
- `color: ${themeValues.activeBreadcrumbColor};
38
- pointer-events: none;
39
- text-decoration: none;
37
+ `pointer-events: none;
38
+ color: ${themeValues.activeBreadcrumbColor};
40
39
  `}
41
40
  &:first-child {
42
41
  margin-left: 0;
43
42
  }
44
43
  &:active {
45
- color: ${themeValues.activeColor};
44
+ color: ${themeValues.activeColor};
46
45
  }`}
47
46
  >
48
47
  {linkText}
@@ -1,8 +1,5 @@
1
1
  // import theme from "styled-theming";
2
- import { colors, styleConstants } from "../../../constants";
3
-
4
- const { MATISSE_BLUE, STORM_GREY } = colors;
5
- const { LINK_TEXT_DECORATION } = styleConstants;
2
+ import { MATISSE_BLUE, STORM_GREY } from "../../../constants/colors";
6
3
 
7
4
  /*
8
5
  For now I'm using string values, eventually shared components library will have its own constants file
@@ -16,7 +13,7 @@ const fontSize = "0.875rem";
16
13
  const lineHeight = "1.25rem";
17
14
  const fontWeight = "400";
18
15
  const margin = "0.5rem";
19
- const hover = `text-decoration: ${LINK_TEXT_DECORATION};`;
16
+ const hover = `text-decoration: none;`;
20
17
 
21
18
  export const fallbackValues = {
22
19
  color,
@@ -57,7 +57,7 @@ const Spinner = ({ color, isMobile }) => (
57
57
 
58
58
  Note: the children prop is only used if contentOverride is set to true, in which case
59
59
  the text prop is ignored.
60
-
60
+
61
61
  */
62
62
 
63
63
  const ButtonWithAction = forwardRef(
@@ -68,7 +68,6 @@ const ButtonWithAction = forwardRef(
68
68
  text,
69
69
  textWrap = false,
70
70
  isLoading = false,
71
- disabled = false,
72
71
  loadingColor = "white",
73
72
  dataQa = null,
74
73
  textExtraStyles,
@@ -95,6 +94,9 @@ const ButtonWithAction = forwardRef(
95
94
  background-color: ${themeValues.hoverBackgroundColor};
96
95
  border-color: ${themeValues.hoverBorderColor};
97
96
  color: ${themeValues.hoverColor};
97
+ text-decoration: ${
98
+ variant === "ghost" || variant === "smallGhost" ? "underline" : "none"
99
+ };
98
100
  cursor: pointer;
99
101
  `;
100
102
  const activeStyles = `
@@ -102,6 +104,9 @@ const ButtonWithAction = forwardRef(
102
104
  background-color: ${themeValues.activeBackgroundColor};
103
105
  border-color: ${themeValues.activeBorderColor};
104
106
  color: ${themeValues.activeColor};
107
+ text-decoration: ${
108
+ variant === "ghost" || variant === "smallGhost" ? "underline" : "none"
109
+ };
105
110
  `;
106
111
  const disabledStyles = `
107
112
  background-color: #6D717E;
@@ -109,8 +114,8 @@ const ButtonWithAction = forwardRef(
109
114
  color: #FFFFFF;
110
115
  cursor: default;
111
116
  &:focus {
112
- outline: 3px solid #6D717E;
113
- outline-offset: 2px;
117
+ box-shadow: 0 0 10px #6D717E;
118
+ outline: none;
114
119
  }
115
120
  ${extraDisabledStyles}
116
121
  `;
@@ -124,12 +129,11 @@ const ButtonWithAction = forwardRef(
124
129
  minWidth={themeValues.minWidth}
125
130
  background={themeValues.backgroundColor}
126
131
  border={themeValues.border}
127
- hoverStyles={disabled ? disabledStyles : hoverStyles}
128
- activeStyles={disabled ? disabledStyles : activeStyles}
132
+ hoverStyles={hoverStyles}
133
+ activeStyles={activeStyles}
129
134
  disabledStyles={disabledStyles}
130
- aria-disabled={disabled}
131
135
  as="button"
132
- onClick={isLoading || disabled ? undefined : action}
136
+ onClick={isLoading ? undefined : action}
133
137
  borderRadius="2px"
134
138
  theme={themeContext}
135
139
  extraStyles={`margin: 0.5rem; ${extraStyles}`}
@@ -148,7 +152,6 @@ const ButtonWithAction = forwardRef(
148
152
  weight={themeValues.fontWeight}
149
153
  variant={themeValues.fontSizeVariant}
150
154
  color={themeValues.color}
151
- textDecoration={themeValues.textDecoration}
152
155
  textWrap={textWrap}
153
156
  extraStyles={textExtraStyles}
154
157
  >
@@ -18,15 +18,12 @@ const variants = {
18
18
  const defaultValue = "primary";
19
19
  const groupId = "props";
20
20
 
21
- const buttonHandler = () => console.log("Button selected");
22
-
23
21
  export const buttonWithAction = () => (
24
22
  <ButtonWithAction
25
23
  variant={select(variantsLabel, variants, defaultValue, groupId)}
26
24
  text={text("text", "button", "props")}
27
25
  isLoading={boolean("isLoading", false, "props")}
28
- action={text("action", buttonHandler, "props")}
29
- disabled={boolean("disabled", false, "props")}
26
+ action={text("action", undefined, "props")}
30
27
  />
31
28
  );
32
29
 
@@ -1,6 +1,4 @@
1
- import { colors, styleConstants } from "../../../constants";
2
-
3
- const {
1
+ import {
4
2
  WHITE,
5
3
  TRANSPARENT,
6
4
  SAPPHIRE_BLUE,
@@ -8,9 +6,7 @@ const {
8
6
  MATISSE_BLUE,
9
7
  RASPBERRY,
10
8
  ERROR_COLOR
11
- } = colors;
12
-
13
- const { LINK_TEXT_DECORATION } = styleConstants;
9
+ } from "../../../constants/colors";
14
10
 
15
11
  const padding = {
16
12
  primary: "0.75rem 1.5rem",
@@ -102,21 +98,6 @@ const minWidth = {
102
98
  whitePrimary: "130px"
103
99
  };
104
100
 
105
- const textDecoration = {
106
- primary: "none",
107
- secondary: "none",
108
- back: "none",
109
- smallPrimary: "none",
110
- smallSecondary: "none",
111
- smallGhost: LINK_TEXT_DECORATION,
112
- ghost: LINK_TEXT_DECORATION,
113
- tertiary: "none",
114
- danger: "none",
115
- dangerSecondary: "none",
116
- whiteSecondary: "none",
117
- whitePrimary: "none"
118
- };
119
-
120
101
  const backgroundColor = {
121
102
  primary: MATISSE_BLUE,
122
103
  secondary: TRANSPARENT,
@@ -244,7 +225,6 @@ export const fallbackValues = {
244
225
  fontWeight,
245
226
  height,
246
227
  minWidth,
247
- textDecoration,
248
228
  backgroundColor,
249
229
  border,
250
230
  hoverBackgroundColor,
@@ -9,8 +9,8 @@ const ButtonWithLink = ({
9
9
  url = "/",
10
10
  disabled = false,
11
11
  fileLink = false,
12
- extraStyles = "",
13
- linkExtraStyles = "",
12
+ extraStyles,
13
+ linkExtraStyles,
14
14
  newTab = false,
15
15
  dataQa,
16
16
  ...otherProps
@@ -57,11 +57,7 @@ const ButtonWithLink = ({
57
57
  text-decoration: none; }`}
58
58
  dataQa={dataQa}
59
59
  >
60
- <ButtonWithAction
61
- {...otherProps}
62
- disabled={disabled}
63
- extraStyles={extraStyles}
64
- />
60
+ <ButtonWithAction {...otherProps} extraStyles={extraStyles} />
65
61
  </ButtonWithLinkWrapper>
66
62
  );
67
63
  };
@@ -107,21 +107,6 @@ export const BoxWrapper = styled(
107
107
  : ``}
108
108
  `}
109
109
  }
110
-
111
- &[aria-disabled="true"] {
112
- ${({ disabledStyles, as }) =>
113
- css`
114
- ${disabledStyles}
115
- ${as === "button"
116
- ? ` > * > span {
117
- ${disabledStyles}
118
- border: none;
119
- outline: none;
120
- box-shadow: none;
121
- }`
122
- : ``}
123
- `}
124
- }
125
110
 
126
111
  & * {
127
112
  color: ${({ color }) => color};
@@ -1,10 +1,6 @@
1
1
  import React, { forwardRef } from "react";
2
2
  import styled from "styled-components";
3
- import { colors, styleConstants } from "../../../constants";
4
-
5
- const { ROYAL_BLUE } = colors;
6
- const { LINK_TEXT_DECORATION } = styleConstants;
7
-
3
+ import { ROYAL_BLUE } from "../../../constants/colors";
8
4
  /*
9
5
  The extracting of props and the disabling of the eslint rule is to stop React from complaining about
10
6
  unrecognized DOM attributes.
@@ -22,10 +18,10 @@ export const StyledExternalLink = styled(
22
18
  font-weight: ${({ weight }) => weight};
23
19
  font-family: ${({ fontFamily }) => fontFamily};
24
20
  line-height: ${({ lineheight }) => lineheight};
25
- text-decoration: ${LINK_TEXT_DECORATION};
26
21
 
27
22
  &:hover {
28
23
  color: ${({ hoverColor }) => hoverColor};
24
+ text-decoration: underline;
29
25
  }
30
26
 
31
27
  &:focus {
@@ -34,6 +30,7 @@ export const StyledExternalLink = styled(
34
30
  }
35
31
 
36
32
  &:active {
33
+ text-decoration: underline;
37
34
  color: ${({ activeColor }) => activeColor};
38
35
  }
39
36
 
@@ -1,11 +1,7 @@
1
1
  import React, { forwardRef } from "react";
2
2
  import styled from "styled-components";
3
3
  import { Link } from "react-router-dom";
4
- import { colors, styleConstants } from "../../../constants";
5
-
6
- const { ROYAL_BLUE } = colors;
7
- const { LINK_TEXT_DECORATION } = styleConstants;
8
-
4
+ import { ROYAL_BLUE } from "../../../constants/colors";
9
5
  /*
10
6
  The extracting of props and the disabling of the eslint rule is to stop React from complaining about
11
7
  unrecognized DOM attributes.
@@ -28,10 +24,10 @@ export const StyledInternalLink = styled(
28
24
  font-size: ${({ fontSize }) => fontSize};
29
25
  font-family: ${({ fontFamily }) => fontFamily};
30
26
  margin: ${({ margin }) => margin};
31
- text-decoration: ${LINK_TEXT_DECORATION};
32
27
 
33
28
  &:hover {
34
29
  color: ${({ hoverColor }) => hoverColor};
30
+ text-decoration: underline;
35
31
  }
36
32
 
37
33
  &:focus {
@@ -40,6 +36,7 @@ export const StyledInternalLink = styled(
40
36
  }
41
37
 
42
38
  &:active {
39
+ text-decoration: underline;
43
40
  color: ${({ activeColor }) => activeColor};
44
41
  }
45
42
 
@@ -10,7 +10,6 @@ const Text = ({
10
10
  themeValues,
11
11
  weight = FONT_WEIGHT_REGULAR,
12
12
  color = FIREFLY_GREY,
13
- textDecoration = "none",
14
13
  textWrap = true,
15
14
  extraStyles = ``,
16
15
  hoverStyles,
@@ -27,7 +26,6 @@ const Text = ({
27
26
  weight={weight}
28
27
  color={color}
29
28
  fontFamily={themeValues.fontFamily}
30
- textDecoration={textDecoration}
31
29
  as={as}
32
30
  extraStyles={extraStyles}
33
31
  hoverStyles={hoverStyles}
@@ -8,7 +8,6 @@ export const TextSpan = styled.span`
8
8
  font-weight: ${({ weight }) => weight};
9
9
  font-family: ${({ fontFamily }) => fontFamily};
10
10
  color: ${({ color }) => color};
11
- text-decoration: ${textDecoration => textDecoration};
12
11
  white-space: ${({ $textWrap }) => ($textWrap ? "initial" : "nowrap")};
13
12
 
14
13
  &:hover {
@@ -36,7 +36,8 @@ const Obligation = ({
36
36
  inactive = false,
37
37
  inactiveLookupTitle = "",
38
38
  inactiveLookupInput = "Account",
39
- inactiveLookupValue = ""
39
+ inactiveLookupValue = "",
40
+ isInCustomerManagement = false
40
41
  }) => {
41
42
  /*
42
43
  The value of obligations is always an array. It can contain:
@@ -137,6 +138,7 @@ const Obligation = ({
137
138
  description={description}
138
139
  subDescription={subDescription}
139
140
  allowedPaymentInstruments={allowedPaymentInstruments}
141
+ isInCustomerManagement={isInCustomerManagement}
140
142
  />
141
143
  )}
142
144
  </Stack>
@@ -160,6 +162,7 @@ const Obligation = ({
160
162
  description={description}
161
163
  subDescription={subDescription}
162
164
  allowedPaymentInstruments={allowedPaymentInstruments}
165
+ isInCustomerManagement={isInCustomerManagement}
163
166
  />
164
167
  )}
165
168
  </Box>
@@ -23,7 +23,8 @@ const PaymentDetailsActions = ({
23
23
  dueDate,
24
24
  description,
25
25
  subDescription,
26
- allowedPaymentInstruments
26
+ allowedPaymentInstruments,
27
+ isInCustomerManagement = false
27
28
  }) => {
28
29
  const planType = isPaymentPlan ? "Payment Plan" : "Autopay";
29
30
  const [isLoading, setIsLoading] = useState(false);
@@ -109,7 +110,7 @@ const PaymentDetailsActions = ({
109
110
  padding={isMobile ? "0 8px 0 0" : "0"}
110
111
  extraStyles={isMobile && `flex-grow: 1;`}
111
112
  >
112
- {autoPayAvailable && !autoPayEnabled ? (
113
+ {autoPayAvailable && !autoPayEnabled && !isInCustomerManagement ? (
113
114
  <ButtonWithAction
114
115
  variant="tertiary"
115
116
  text={`Set Up ${planType}`}
@@ -140,7 +141,7 @@ const PaymentDetailsActions = ({
140
141
  />
141
142
  )}
142
143
  </Box>
143
- {!isMobile && (
144
+ {!isMobile && !isInCustomerManagement && (
144
145
  <Box padding={"0"}>
145
146
  <ButtonWithAction
146
147
  isLoading={isLoading}
@@ -152,7 +153,7 @@ const PaymentDetailsActions = ({
152
153
  </Box>
153
154
  )}
154
155
  </Cluster>
155
- {isMobile && (
156
+ {isMobile && !isInCustomerManagement && (
156
157
  <Box padding="8px 0 0" width="100%">
157
158
  <ButtonWithAction
158
159
  isLoading={isLoading}
@@ -94,7 +94,6 @@ export const getPagesPanel = (page, pagesCount) => {
94
94
 
95
95
  const Pagination = ({
96
96
  activeBorderWidth = "3px",
97
- ariaLabel,
98
97
  arrowColor,
99
98
  borderRadius = "3px",
100
99
  buttonHeight = "44px",
@@ -108,6 +107,7 @@ const Pagination = ({
108
107
  pageNext,
109
108
  pagePrevious,
110
109
  setCurrentPage,
110
+ ariaLabel,
111
111
  themeValues
112
112
  }) => {
113
113
  const { isMobile } = useContext(ThemeContext);
@@ -115,6 +115,12 @@ const Pagination = ({
115
115
  const extraStyles = `
116
116
  min-width: ${buttonWidth}; min-height: 100%; padding: 0;
117
117
  border-radius: ${borderRadius};
118
+ &:hover, &:focus {
119
+ text-decoration: none;
120
+ > * > span {
121
+ text-decoration: none;
122
+ }
123
+ }
118
124
  > * > span {
119
125
  color: ${numberColor ?? themeValues.numberColor}
120
126
  }
@@ -1,7 +1,8 @@
1
1
  import {
2
2
  WHITE,
3
3
  MATISSE_BLUE,
4
- ALABASTER_WHITE
4
+ ALABASTER_WHITE,
5
+ STORM_GREY
5
6
  } from "../../../constants/colors";
6
7
 
7
8
  const arrowColor = WHITE;
@@ -36,6 +36,7 @@ const TabSidebar = ({ links, isMobile, themeValues }) => (
36
36
  to={route}
37
37
  key={`${route}-${index}`}
38
38
  extraStyles={`&:hover {
39
+ text-decoration: none;
39
40
  ${
40
41
  active
41
42
  ? `> * {
@@ -1,4 +1,3 @@
1
1
  import * as colors from "./colors";
2
- import * as styleConstants from "./style_constants";
3
2
 
4
- export { colors, styleConstants };
3
+ export { colors };
@@ -1,13 +1,4 @@
1
- export * as colors from "./colors";
2
- export * as general from "./general";
3
- export * as regexConstants from "./regex_constants";
4
- export * as styleConstants from "./style_constants";
1
+ import * as colors from "./colors";
2
+ import * as fontWeights from "./style_constants";
5
3
 
6
- /**
7
- * This export is named "fontWeights" and referenced as such in much existing code.
8
- * Navigate Frontend is one example that uses this particular export. However, new
9
- * usage of style constants should reference the `styleConstants` export instead.
10
- *
11
- * @deprecated
12
- */
13
- export * as fontWeights from "./style_constants";
4
+ export { colors, fontWeights };
@@ -8,7 +8,6 @@ const COMPACT_JUMBO_HEIGHT = "65px";
8
8
  const FONT_WEIGHT_REGULAR = "400";
9
9
  const FONT_WEIGHT_BOLD = "700";
10
10
  const FONT_WEIGHT_SEMIBOLD = "600";
11
- const LINK_TEXT_DECORATION = "underline solid 1px";
12
11
 
13
12
  export {
14
13
  HEADER_HEIGHT,
@@ -18,6 +17,5 @@ export {
18
17
  COMPACT_JUMBO_HEIGHT,
19
18
  FONT_WEIGHT_REGULAR,
20
19
  FONT_WEIGHT_BOLD,
21
- FONT_WEIGHT_SEMIBOLD,
22
- LINK_TEXT_DECORATION
20
+ FONT_WEIGHT_SEMIBOLD
23
21
  };
@@ -1,32 +0,0 @@
1
- import React from "react";
2
- import { number, text } from "@storybook/addon-knobs";
3
- import Pagination from "./Pagination";
4
- import page from "../../../../.storybook/page";
5
-
6
- export const pagination = () => (
7
- <Pagination
8
- activeBorderWidth={text("activeBorderWidth", "3px", "props")}
9
- ariaLabel={text("ariaLabel", "Aria Label", "props")}
10
- arrowColor={text("arrowColor", "#FFFFFF", "props")}
11
- borderRadius={text("borderRadius", "3px", "props")}
12
- buttonHeight={text("buttonHeight", "44px", "props")}
13
- buttonWidth={text("buttonWidth", "44px", "props")}
14
- childGap={text("childGap", "24px", "props")}
15
- currentPage={number("currentPage", 2)}
16
- fontSize={text("fontSize", "17px", "props")}
17
- fontWeight={text("fontWeight", "900", "props")}
18
- numberColor={text("numberColor", "#15749D", "props")}
19
- pageCount={number("pageCount", 3)}
20
- pageNext={() => {}}
21
- pagePrevious={() => {}}
22
- setCurrentPage={() => {}}
23
- // themeValues
24
- />
25
- );
26
-
27
- const story = page({
28
- title: "Components|Molecules/Pagination",
29
- Component: Pagination
30
- });
31
-
32
- export default story;
@@ -1,11 +0,0 @@
1
- type StyleDeclaration = string;
2
-
3
- export const HEADER_HEIGHT: StyleDeclaration;
4
- export const FOOTER_HEIGHT: StyleDeclaration;
5
- export const SPACER_HEIGHT: StyleDeclaration;
6
- export const JUMBO_HEIGHT: StyleDeclaration;
7
- export const COMPACT_JUMBO_HEIGHT: StyleDeclaration;
8
- export const FONT_WEIGHT_REGULAR: StyleDeclaration;
9
- export const FONT_WEIGHT_BOLD: StyleDeclaration;
10
- export const FONT_WEIGHT_SEMIBOLD: StyleDeclaration;
11
- export const LINK_TEXT_DECORATION: StyleDeclaration;