@thecb/components 10.2.1-beta.2 → 10.2.1

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": "10.2.1-beta.2",
3
+ "version": "10.2.1",
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
@@ -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(
@@ -95,6 +95,9 @@ const ButtonWithAction = forwardRef(
95
95
  background-color: ${themeValues.hoverBackgroundColor};
96
96
  border-color: ${themeValues.hoverBorderColor};
97
97
  color: ${themeValues.hoverColor};
98
+ text-decoration: ${
99
+ variant === "ghost" || variant === "smallGhost" ? "underline" : "none"
100
+ };
98
101
  cursor: pointer;
99
102
  `;
100
103
  const activeStyles = `
@@ -102,6 +105,9 @@ const ButtonWithAction = forwardRef(
102
105
  background-color: ${themeValues.activeBackgroundColor};
103
106
  border-color: ${themeValues.activeBorderColor};
104
107
  color: ${themeValues.activeColor};
108
+ text-decoration: ${
109
+ variant === "ghost" || variant === "smallGhost" ? "underline" : "none"
110
+ };
105
111
  `;
106
112
  const disabledStyles = `
107
113
  background-color: #6D717E;
@@ -148,7 +154,6 @@ const ButtonWithAction = forwardRef(
148
154
  weight={themeValues.fontWeight}
149
155
  variant={themeValues.fontSizeVariant}
150
156
  color={themeValues.color}
151
- textDecoration={themeValues.textDecoration}
152
157
  textWrap={textWrap}
153
158
  extraStyles={textExtraStyles}
154
159
  >
@@ -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
@@ -1,23 +1,25 @@
1
1
  import React from "react";
2
2
 
3
- const MultiCartIcon = ({ iconFill = "#3B5BDB", isMobile = true }) => {
4
- const iconWidth = isMobile ? "20" : "25";
5
- const iconHeight = isMobile ? "17" : "23";
3
+ const MultiCartIcon = ({
4
+ iconFill = "#3B5BDB",
5
+ iconWidth = "20",
6
+ iconHeight = "17",
7
+ ...rest
8
+ }) => {
6
9
  return (
7
10
  <svg
8
11
  xmlns="http://www.w3.org/2000/svg"
9
12
  width={iconWidth}
10
13
  height={iconHeight}
11
- viewBox={`0 0 ${iconWidth} ${iconHeight}`}
12
- fill="none"
14
+ viewBox="0 0 24.81 22.06"
15
+ {...rest}
13
16
  >
17
+ <title>Icon - Cart-Empty</title>
14
18
  <path
15
- d={
16
- isMobile
17
- ? "M17.5312 9.99414C17.4648 10.1934 17.3652 10.3594 17.2324 10.459C17.0996 10.5918 16.9336 10.625 16.7676 10.625H7.03906L7.23828 11.6875H16.1699C16.4023 11.6875 16.6016 11.7871 16.7676 11.9863C16.9004 12.1855 16.9668 12.418 16.9336 12.6504L16.7344 13.4805C17.0664 13.6465 17.2988 13.8789 17.498 14.1777C17.6973 14.4766 17.7969 14.8086 17.7969 15.1406C17.7969 15.6719 17.5977 16.1035 17.2324 16.4688C16.8672 16.834 16.4355 17 15.9375 17C15.4062 17 14.9746 16.834 14.6094 16.4688C14.2441 16.1035 14.0781 15.6719 14.0781 15.1406C14.0781 14.6094 14.2441 14.1777 14.6426 13.8125H7.66992C8.03516 14.1777 8.23438 14.6094 8.23438 15.1406C8.23438 15.6719 8.03516 16.1035 7.66992 16.4688C7.30469 16.834 6.87305 17 6.375 17C5.84375 17 5.41211 16.834 5.04688 16.4688C4.68164 16.1035 4.51562 15.6719 4.51562 15.1406C4.51562 14.8086 4.58203 14.5098 4.74805 14.2109C4.91406 13.9453 5.14648 13.7129 5.44531 13.5137L3.12109 2.125H0.796875C0.564453 2.125 0.365234 2.05859 0.232422 1.89258C0.0664062 1.75977 0 1.56055 0 1.32812V0.796875C0 0.597656 0.0664062 0.398438 0.232422 0.232422C0.365234 0.0996094 0.564453 0 0.796875 0H4.2168C4.38281 0 4.54883 0.0664062 4.68164 0.199219C4.81445 0.332031 4.91406 0.464844 4.98047 0.630859L5.2793 2.125H18.3281C18.5938 2.125 18.793 2.22461 18.959 2.42383C19.0918 2.62305 19.1582 2.85547 19.0918 3.08789L17.5312 9.99414Z"
18
- : "M22.6875 13.4336C22.6016 13.6914 22.4727 13.9062 22.3008 14.0352C22.1289 14.207 21.9141 14.25 21.6992 14.25H9.10938L9.36719 15.625H20.9258C21.2266 15.625 21.4844 15.7539 21.6992 16.0117C21.8711 16.2695 21.957 16.5703 21.9141 16.8711L21.6562 17.9453C22.0859 18.1602 22.3867 18.4609 22.6445 18.8477C22.9023 19.2344 23.0312 19.6641 23.0312 20.0938C23.0312 20.7812 22.7734 21.3398 22.3008 21.8125C21.8281 22.2852 21.2695 22.5 20.625 22.5C19.9375 22.5 19.3789 22.2852 18.9062 21.8125C18.4336 21.3398 18.2188 20.7812 18.2188 20.0938C18.2188 19.4062 18.4336 18.8477 18.9492 18.375H9.92578C10.3984 18.8477 10.6562 19.4062 10.6562 20.0938C10.6562 20.7812 10.3984 21.3398 9.92578 21.8125C9.45312 22.2852 8.89453 22.5 8.25 22.5C7.5625 22.5 7.00391 22.2852 6.53125 21.8125C6.05859 21.3398 5.84375 20.7812 5.84375 20.0938C5.84375 19.6641 5.92969 19.2773 6.14453 18.8906C6.35938 18.5469 6.66016 18.2461 7.04688 17.9883L4.03906 3.25H1.03125C0.730469 3.25 0.472656 3.16406 0.300781 2.94922C0.0859375 2.77734 0 2.51953 0 2.21875V1.53125C0 1.27344 0.0859375 1.01562 0.300781 0.800781C0.472656 0.628906 0.730469 0.5 1.03125 0.5H5.45703C5.67188 0.5 5.88672 0.585938 6.05859 0.757812C6.23047 0.929688 6.35938 1.10156 6.44531 1.31641L6.83203 3.25H23.7188C24.0625 3.25 24.3203 3.37891 24.5352 3.63672C24.707 3.89453 24.793 4.19531 24.707 4.49609L22.6875 13.4336Z"
19
- }
19
+ d="M18.7499553,20.499994 C19.348912,20.499994 19.8632339,20.2851508 20.2929204,19.8554643 C20.7226068,19.4257779 20.9374501,18.911456 20.9374501,18.3124993 C20.9374501,17.8958334 20.8267735,17.5117199 20.6054196,17.1601583 C20.3840658,16.8085966 20.0780771,16.5416703 19.6874531,16.3593789 L19.6874531,16.3593789 L19.9218275,15.3828187 C19.9739105,15.0963613 19.9088069,14.835945 19.7265155,14.6015706 C19.544224,14.3671962 19.3098496,14.2500089 19.0233921,14.2500089 L19.0233921,14.2500089 L8.5156047,14.2500089 L8.28123026,13.0000119 L19.7265155,13.0000119 C19.9348481,13.0000119 20.1236501,12.9349077 20.2929204,12.8046999 C20.4621906,12.6744921 20.5728678,12.4922006 20.6249508,12.2578262 L20.6249508,12.2578262 L22.4608839,4.13284556 C22.5390088,3.84638811 22.4869258,3.58597187 22.3046343,3.35159742 C22.1223429,3.11722298 21.8749478,3.00004172 21.5624486,3.00004172 L21.5624486,3.00004172 L6.21092269,3.00004172 L5.85936103,1.24222745 C5.80727802,1.03389482 5.6966008,0.858113985 5.52733057,0.714884961 C5.35806034,0.571655937 5.16925831,0.500041723 4.96092567,0.500041723 L4.96092567,0.500041723 L0.937497765,0.500041723 C0.67708152,0.500041723 0.455728279,0.591187141 0.273436848,0.773478571 C0.0911454173,0.955770002 0,1.17712324 0,1.43753949 L0,1.43753949 L0,2.062538 C0,2.32295424 0.0911454173,2.54430748 0.273436848,2.72659891 C0.455728279,2.90889035 0.67708152,3.00004172 0.937497765,3.00004172 L0.937497765,3.00004172 L3.67186625,3.00004172 L6.40623473,16.3984413 C6.06769367,16.606774 5.80076742,16.8802108 5.60545539,17.2187519 C5.41014335,17.5572929 5.31248733,17.9218752 5.31248733,18.3124993 C5.31248733,18.911456 5.52733057,19.4257779 5.95701705,19.8554643 C6.38670352,20.2851508 6.90102541,20.499994 7.49998212,20.499994 C8.09893883,20.499994 8.61326071,20.2851508 9.04294719,19.8554643 C9.47263367,19.4257779 9.6874769,18.904946 9.6874769,18.2929681 C9.6874769,17.6809901 9.46612307,17.1666689 9.02341599,16.750003 L9.02341599,16.750003 L17.2265214,16.750003 C16.7838143,17.1666689 16.5624605,17.6809901 16.5624605,18.2929681 C16.5624605,18.904946 16.7773037,19.4257779 17.2069902,19.8554643 C17.6366767,20.2851508 18.1509986,20.499994 18.7499553,20.499994 Z"
20
+ id="cart-badge-shopping-cart"
20
21
  fill={iconFill}
22
+ fillRule="nonzero"
21
23
  />
22
24
  </svg>
23
25
  );
@@ -21,9 +21,7 @@ const Jumbo = ({
21
21
  itemsCount,
22
22
  showCartStatus = false,
23
23
  openCartSlider,
24
- extraStyles,
25
- cartStatusExtraStyles,
26
- cartStatusThemeValues
24
+ extraStyles
27
25
  }) => {
28
26
  const { isMobile } = useContext(ThemeContext);
29
27
  return (
@@ -53,7 +51,6 @@ const Jumbo = ({
53
51
  }
54
52
  align="center"
55
53
  nowrap={showCartStatus}
56
- extraStyles={cartStatusExtraStyles}
57
54
  >
58
55
  <Title
59
56
  variant={isMobile ? "small" : "large"}
@@ -83,7 +80,6 @@ const Jumbo = ({
83
80
  )}
84
81
  {showCartStatus && (
85
82
  <CartStatus
86
- themeValues={cartStatusThemeValues}
87
83
  total={total}
88
84
  itemsCount={itemsCount}
89
85
  openCart={openCartSlider}
@@ -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
 
@@ -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 {
@@ -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;
@@ -22,7 +22,10 @@ const PaymentButtonBar = ({
22
22
  redirectText = "Return",
23
23
  buttonFlexOverride,
24
24
  hideForwardButton = false,
25
- hideBackButton = false
25
+ hideBackButton = false,
26
+ buttonGroupStyles,
27
+ hideAdditionalButton = false,
28
+ additionalButton
26
29
  }) => {
27
30
  const { isMobile } = useContext(ThemeContext);
28
31
 
@@ -92,9 +95,11 @@ const PaymentButtonBar = ({
92
95
  : "flex-end"
93
96
  }
94
97
  align="center"
98
+ extraStyles={buttonGroupStyles}
95
99
  >
96
100
  {!hideBackButton && <Fragment>{backButton}</Fragment>}
97
101
  {!hideForwardButton && <Fragment>{forwardButton}</Fragment>}
102
+ {!hideAdditionalButton && <Fragment>{additionalButton}</Fragment>}
98
103
  </Cluster>
99
104
  </Box>
100
105
  </Fragment>
@@ -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;