@thecb/components 8.4.0-beta.2 → 8.4.0-beta.21

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": "8.4.0-beta.2",
3
+ "version": "8.4.0-beta.21",
4
4
  "description": "Common lib for CityBase react components",
5
5
  "main": "dist/index.cjs.js",
6
6
  "typings": "dist/index.d.ts",
Binary file
@@ -1,7 +1,7 @@
1
1
  import React from "react";
2
2
  import { ROYAL_BLUE_VIVID } from "../../../constants/colors";
3
3
 
4
- const ArrowRightIcon = ({ color = ROYAL_BLUE_VIVID }) => {
4
+ const ArrowRightIcon = ({ color = ROYAL_BLUE_VIVID, labeledBy = "" }) => {
5
5
  return (
6
6
  <svg
7
7
  xmlns="http://www.w3.org/2000/svg"
@@ -9,6 +9,7 @@ const ArrowRightIcon = ({ color = ROYAL_BLUE_VIVID }) => {
9
9
  height="20"
10
10
  viewBox="0 0 20 20"
11
11
  fill="none"
12
+ aria-labeledBy={labeledBy}
12
13
  >
13
14
  <path
14
15
  fillRule="evenodd"
@@ -1,7 +1,7 @@
1
1
  import React from "react";
2
2
  import { ROYAL_BLUE_VIVID } from "../../../constants/colors";
3
3
 
4
- const PlusCircleIcon = ({ color = ROYAL_BLUE_VIVID }) => {
4
+ const PlusCircleIcon = ({ color = ROYAL_BLUE_VIVID, labeledBy = "" }) => {
5
5
  return (
6
6
  <svg
7
7
  xmlns="http://www.w3.org/2000/svg"
@@ -9,6 +9,7 @@ const PlusCircleIcon = ({ color = ROYAL_BLUE_VIVID }) => {
9
9
  height="20"
10
10
  viewBox="0 0 20 20"
11
11
  fill="none"
12
+ aria-labelledby={labeledBy}
12
13
  >
13
14
  <path
14
15
  fillRule="evenodd"
@@ -1,11 +1,17 @@
1
+ import {
2
+ SAPPHIRE_BLUE,
3
+ PEACOCK_BLUE,
4
+ MATISSE_BLUE
5
+ } from "../../../constants/colors";
6
+
1
7
  const fontFamily = {
2
8
  primary: "Public Sans",
3
9
  secondary: "Open Sans"
4
10
  };
5
11
 
6
- const hoverColor = "#116285";
7
- const activeColor = "#0E506D";
8
- const externalLinkColor = "#15749D";
12
+ const hoverColor = SAPPHIRE_BLUE;
13
+ const activeColor = PEACOCK_BLUE;
14
+ const externalLinkColor = MATISSE_BLUE;
9
15
 
10
16
  export const fallbackValues = {
11
17
  fontFamily,
@@ -1,125 +1,78 @@
1
- import React from "react";
2
- import { useNavigate } from "react-router-dom";
3
- import Heading from "../../atoms/heading";
4
- import Paragraph from "../../atoms/paragraph";
5
- // import { Text } from "../../atoms/text";
6
- // import { ROYAL_BLUE_VIVID } from "../../../constants/colors";
1
+ import React, { useContext } from "react";
7
2
  import { FONT_WEIGHT_SEMIBOLD } from "../../../constants/style_constants";
8
3
  import { Box, Stack } from "../../atoms/layouts";
9
4
  import { themeComponent } from "../../../util/themeUtils";
10
5
  import { fallbackValues } from "./LinkCard.theme";
11
- // import PlusCircleIcon from "../../atoms/icons/PlusCircleIcon";
12
- // import ArrowRightIcon from "../../atoms/icons/ArrowRightIcon";
6
+ import { ThemeContext } from "styled-components";
7
+ import * as Styled from "./LinkCard.styled";
13
8
 
14
9
  const LinkCard = ({
15
- variant = "default",
16
10
  title = "Test Workflow",
17
11
  subtitle = "Link your benefit plan",
18
12
  themeValues,
19
- path,
20
13
  showLeft,
21
14
  leftContent,
22
15
  showRight,
23
- rightContent
16
+ rightContent,
17
+ onClick,
18
+ extraStyles = "",
19
+ extraHoverStyles = "",
20
+ extraActiveStyles = ""
24
21
  }) => {
25
- const navigate = useNavigate();
26
- const activeHoverStyles = `
27
- border-radius: 8px;
28
- cursor: pointer;
29
- border: 1px solid ${themeValues.color};
30
- background: var(--primary-color-primary-10, #EBEFFB);
31
- /* Primitives/New Shadow/3-Pressed-New */
32
- box-shadow: 0px 0px 0px 0px rgba(41, 42, 51, 0.10), 0px 5px 11px 0px rgba(41, 42, 51, 0.10), 0px 4px 19px 0px rgba(41, 42, 51, 0.09), 0px 27px 26px 0px rgba(41, 42, 51, 0.05), 0px 56px 31px 0px rgba(41, 42, 51, 0.01), 0px 80px 33px 0px rgba(41, 42, 51, 0.00);
33
- .show-on-hover {color: ${themeValues.color};}
34
- `;
22
+ const { isMobile } = useContext(ThemeContext);
35
23
 
36
24
  return (
37
- <Box
38
- background="#FEFEFE" // --grays-cool-gray-00
39
- border="1px solid #C4CEF4;" // --primary-color-primary-30
25
+ <Styled.Container
26
+ border={`1px solid ${themeValues.background};`}
40
27
  borderRadius="8px"
41
28
  dataQa={`link-card-${title}`}
42
29
  width="100%"
43
- maxWidth="288px"
44
- minWidth="240px"
30
+ maxWidth={isMobile ? "100%" : "288px"}
31
+ minWidth={isMobile ? "240px" : "288px"}
45
32
  minHeight="141px"
46
- padding="16px 24px"
47
- extraStyles="
48
- display: flex;
49
- flex-direction: column;
50
- align-items: flex-start;
51
- gap: 40px;
52
- flex-shrink: 0;
53
- align-self: stretch;"
54
- hoverStyles={activeHoverStyles}
55
- activeStyles={activeHoverStyles}
56
- onClick={() => {
57
- navigate(path);
58
- }}
33
+ padding="24px"
34
+ extraStyles={extraStyles}
35
+ hoverStyles={extraHoverStyles}
36
+ activeStyles={extraActiveStyles}
37
+ onClick={onClick}
59
38
  >
60
- <Stack childGap={0} bottomItem={3} fullHeight>
61
- <Box padding={"1rem 1rem 0 1rem"}>
62
- <Heading
39
+ <Stack
40
+ childGap={0}
41
+ bottomItem={3}
42
+ justify="space-between"
43
+ style={{ width: "100%" }}
44
+ fullHeight
45
+ >
46
+ <Box padding={0} width="100%">
47
+ <Styled.Title
63
48
  variant="h6"
64
49
  weight={FONT_WEIGHT_SEMIBOLD}
65
50
  color={themeValues.color}
66
51
  margin={0}
67
- extraStyles="display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; align-self: stretch; overflow: hidden; text-overflow: ellipsis; font-family: Public Sans; font-size: 16px; font-style: normal; font-weight: 600; line-height: 150%;"
68
52
  >
69
53
  {title}
70
- </Heading>
54
+ </Styled.Title>
71
55
  </Box>
72
- <Box padding={"0 1rem 40px"} /* minHeight={"4.25rem"}*/>
73
- <Paragraph
74
- variant="pS"
75
- color={themeValues.color}
76
- extraStyles="overflow: hidden;
77
- text-overflow: ellipsis;
78
- display: -webkit-box;
79
- -webkit-box-orient: vertical;
80
- -webkit-line-clamp: 2;
81
- align-self: stretch;
82
-
83
- /* CB Standard/Desktop/D - P Small - Regular */
84
- font-family: Public Sans;
85
- font-size: 14px;
86
- font-style: normal;
87
- font-weight: 400;
88
- line-height: 150%; /* 21px */
89
- letter-spacing: 0.14px;"
90
- >
56
+ <Box padding={"0 0 40px"} width="100%">
57
+ <Styled.Subtitle variant="pS" color={themeValues.color}>
91
58
  {subtitle}
92
- </Paragraph>
59
+ </Styled.Subtitle>
93
60
  </Box>
94
61
  <Box
95
62
  background="transparent"
96
63
  borderWidthOverride="0 0 0 0"
97
- padding="0 1rem 1rem 1rem"
64
+ padding="0"
65
+ width="100%"
98
66
  >
99
- <Stack direction="row" justify="space-between">
67
+ <Styled.Footer direction="row" childGap="6px" justify="space-between">
68
+ {/* To keep rightContent aligned right, use an empty Box as leftContent if none is provided */}
69
+ {showLeft && !leftContent && <Box />}
100
70
  {showLeft && leftContent}
101
71
  {showRight && rightContent}
102
-
103
- {/* <Stack direction="row" childGap="6px">
104
- <Text
105
- variant="pS"
106
- color={themeValues.color}
107
- extraStyles="text-align: right; color: transparent;"
108
- className="show-on-hover"
109
- >
110
- {workflowActionName}
111
- </Text>
112
- {workflowActionName === "Find" && (
113
- <PlusCircleIcon color={themeValues.color} />
114
- )}
115
- {workflowActionName === "Pay" && (
116
- <ArrowRightIcon color={themeValues.color} />
117
- )}
118
- </Stack> */}
119
- </Stack>
72
+ </Styled.Footer>
120
73
  </Box>
121
74
  </Stack>
122
- </Box>
75
+ </Styled.Container>
123
76
  );
124
77
  };
125
78
 
@@ -8,7 +8,7 @@ import { text } from "@storybook/addon-knobs";
8
8
  import Badge from "../../atoms/badge/Badge";
9
9
  import PlusCircleIcon from "../../atoms/icons/PlusCircleIcon";
10
10
  import AutopayIcon from "../../atoms/icons/AutopayIcon";
11
- import { ROYAL_BLUE_VIVID } from "../../../constants/colors";
11
+ import { ROYAL_BLUE_VIVID, CORNFLOWER_BLUE } from "../../../constants/colors";
12
12
 
13
13
  const groupId = "props";
14
14
 
@@ -37,6 +37,12 @@ export const linkCard = () => (
37
37
  <PlusCircleIcon color={ROYAL_BLUE_VIVID} />
38
38
  </Stack>
39
39
  }
40
+ extraHoverStyles={`
41
+ .show-on-hover {color: ${ROYAL_BLUE_VIVID};}
42
+ `}
43
+ extraActiveStyles={`
44
+ background-color: ${CORNFLOWER_BLUE};
45
+ `}
40
46
  />
41
47
  );
42
48
 
@@ -0,0 +1,70 @@
1
+ import styled from "styled-components";
2
+ import Heading from "../../atoms/heading";
3
+ import Paragraph from "../../atoms/paragraph";
4
+ import Stack from "../../atoms/layouts/Stack";
5
+ import { Box } from "../../atoms/layouts";
6
+ import {
7
+ ROYAL_BLUE_VIVID,
8
+ LINK_WATER,
9
+ MOON_RAKER
10
+ } from "../../../constants/colors";
11
+
12
+ export const Container = styled(Box)`
13
+ display: flex;
14
+ flex-direction: column;
15
+ align-items: flex-start;
16
+ width: 100%;
17
+ gap: 40px;
18
+ flex-shrink: 0;
19
+ align-self: stretch;
20
+ border-radius: 8px;
21
+
22
+ &:hover,
23
+ &:active {
24
+ cursor: pointer;
25
+ box-shadow: 0px 0px 0px 0px rgba(41, 42, 51, 0.1),
26
+ 0px 5px 11px 0px rgba(41, 42, 51, 0.1),
27
+ 0px 4px 19px 0px rgba(41, 42, 51, 0.09),
28
+ 0px 27px 26px 0px rgba(41, 42, 51, 0.05),
29
+ 0px 56px 31px 0px rgba(41, 42, 51, 0.01),
30
+ 0px 80px 33px 0px rgba(41, 42, 51, 0);
31
+ }
32
+
33
+ &:hover:not(:active) {
34
+ border: 1px solid ${MOON_RAKER};
35
+ background-color: ${LINK_WATER};
36
+ }
37
+
38
+ &:active {
39
+ border: 1px solid ${ROYAL_BLUE_VIVID};
40
+ }
41
+ `;
42
+
43
+ export const Title = styled(Heading)`
44
+ display: -webkit-box;
45
+ -webkit-box-orient: vertical;
46
+ -webkit-line-clamp: 2;
47
+ align-self: stretch;
48
+ overflow: hidden;
49
+ text-overflow: ellipsis;
50
+ font-size: 16px;
51
+ line-height: 150%;
52
+ background-color: transparent;
53
+ `;
54
+
55
+ export const Subtitle = styled(Paragraph)`
56
+ overflow: hidden;
57
+ text-overflow: ellipsis;
58
+ display: -webkit-box;
59
+ -webkit-box-orient: vertical;
60
+ -webkit-line-clamp: 2;
61
+ align-self: stretch;
62
+ font-size: 14px;
63
+ line-height: 150 %;
64
+ letter-spacing: 0.14px;
65
+ `;
66
+
67
+ export const Footer = styled(Stack)`
68
+ align-items: center;
69
+ width: 100%;
70
+ `;
@@ -1,7 +1,7 @@
1
- import { ROYAL_BLUE_VIVID, WHITE } from "../../../constants/colors";
1
+ import { ROYAL_BLUE_VIVID, MOON_RAKER } from "../../../constants/colors";
2
2
 
3
- const background = { default: `${WHITE}` };
4
- const color = { default: `${ROYAL_BLUE_VIVID}` };
3
+ const background = { default: MOON_RAKER };
4
+ const color = { default: ROYAL_BLUE_VIVID };
5
5
 
6
6
  export const fallbackValues = {
7
7
  background,
@@ -5,12 +5,15 @@ export interface LinkCardProps {
5
5
  variant?: string; // "default" is only one
6
6
  title?: string; // title
7
7
  subtitle?: string; // beneath title
8
- slug: string; // path segment of button on click (/service/${slug})
9
8
  themeValues?: any;
10
9
  showLeft?: boolean;
11
10
  leftContent?: JSX.Element;
12
11
  showRight?: boolean;
13
12
  rightContent?: JSX.Element;
13
+ onClick: () => void;
14
+ extraHoverStyles?: string;
15
+ extraStyles?: string;
16
+ extraActiveStyles?: string;
14
17
  }
15
18
 
16
19
  export const LinkCard: React.FC<Expand<LinkCardProps> &
@@ -0,0 +1,127 @@
1
+ type Color = string;
2
+
3
+ type ColorSet = {
4
+ background: Color;
5
+ border: Color;
6
+ iconBackground: Color;
7
+ iconFill: Color;
8
+ };
9
+
10
+ export const BLACK: Color;
11
+ export const TRANSPARENT: Color;
12
+
13
+ // WHITE
14
+ export const WHITE: Color;
15
+ export const SOLITUDE_WHITE: Color;
16
+ export const SEASHELL_WHITE: Color;
17
+ export const ALABASTER_WHITE: Color;
18
+ export const AQUA_HAZE_WHITE: Color;
19
+ export const BLEACH_WHITE: Color;
20
+ export const CATSKILL_WHITE: Color;
21
+ export const HALF_COLONIAL_WHITE: Color;
22
+
23
+ // GREY
24
+ export const ATHENS_GREY: Color;
25
+ export const ALTO_GREY: Color;
26
+ export const SILVER_GREY: Color;
27
+ export const PEWTER_GREY: Color;
28
+ export const ASH_GREY: Color;
29
+ export const IRON_GREY: Color;
30
+ export const GHOST_GREY: Color;
31
+ export const DUSTY_GREY: Color;
32
+ export const REGENT_GREY: Color;
33
+ export const STORM_GREY: Color;
34
+ export const TROUT_GREY: Color;
35
+ export const MINESHAFT_GREY: Color;
36
+ export const SOOT_GREY: Color;
37
+ export const FIREFLY_GREY: Color;
38
+ export const BRIGHT_GREY: Color;
39
+ export const CHARADE_GREY: Color;
40
+ export const GRECIAN_GREY: Color;
41
+ export const BLACK_SQUEEZE: Color;
42
+ export const GREY_CHATEAU: Color;
43
+ export const COOL_GREY_05: Color;
44
+
45
+ // BLUE
46
+ export const CLOUDBURST_BLUE: Color;
47
+ export const ZODIAC_BLUE: Color;
48
+ export const CONGRESS_BLUE: Color;
49
+ export const SCIENCE_BLUE: Color;
50
+ export const MARINER_BLUE: Color;
51
+ export const CURIOUS_BLUE: Color;
52
+ export const SELAGO_BLUE: Color;
53
+ export const ONAHAU_BLUE: Color;
54
+ export const PICKLED_BLUE: Color;
55
+ export const CERULEAN_BLUE: Color;
56
+ export const FOAM_BLUE: Color;
57
+ export const CELLO_BLUE: Color;
58
+ export const BOSTON_BLUE: Color;
59
+ export const INFO_BLUE: Color;
60
+ export const CORNFLOWER_BLUE: Color;
61
+ export const HOVER_LIGHT_BLUE: Color;
62
+ export const MATISSE_BLUE: Color;
63
+ export const ROYAL_BLUE: Color;
64
+ export const ROYAL_BLUE_VIVID: Color;
65
+ export const ASTRAL_BLUE: Color;
66
+ export const SAPPHIRE_BLUE: Color;
67
+ export const PEACOCK_BLUE: Color;
68
+
69
+ // GREEN
70
+ export const FOREST_GREEN: Color;
71
+ export const MEADOW_GREEN: Color;
72
+ export const POLAR_GREEN: Color;
73
+ export const ICE_GREEN: Color;
74
+ export const HAZE_GREEN: Color;
75
+ export const EMERALD_GREEN: Color;
76
+ export const HINT_GREEN: Color;
77
+ export const SEA_GREEN: Color;
78
+
79
+ // YELLOW
80
+ export const SELECTIVE_YELLOW: Color;
81
+ export const MUSTARD_YELLOW: Color;
82
+ export const FIRE_YELLOW: Color;
83
+
84
+ // ORANGE
85
+ export const CARROT_ORANGE: Color;
86
+ export const ZEST_ORANGE: Color;
87
+ export const APRICOT_ORANGE: Color;
88
+
89
+ // RED
90
+ export const RED: Color;
91
+ export const CRIMSON_RED: Color;
92
+ export const THUNDERBIRD_RED: Color;
93
+ export const RAZZMATAZZ_RED: Color;
94
+ export const RASPBERRY: Color;
95
+ export const FANTASY_RED: Color;
96
+ export const COSMOS_RED: Color;
97
+ export const BLUSH_RED: Color;
98
+
99
+ export const ERROR_COLOR: Color;
100
+
101
+ export const ALERT_COLORS: {
102
+ warn: ColorSet;
103
+ info: ColorSet;
104
+ error: ColorSet;
105
+ success: ColorSet;
106
+ text: Color;
107
+ link: Color;
108
+ };
109
+
110
+ export const PILL_COLORS: {
111
+ danger: {
112
+ background: Color;
113
+ text: Color;
114
+ };
115
+ neutral: {
116
+ background: Color;
117
+ text: Color;
118
+ };
119
+ success: {
120
+ background: Color;
121
+ text: Color;
122
+ };
123
+ warning: {
124
+ background: Color;
125
+ text: Color;
126
+ };
127
+ };
@@ -6,7 +6,7 @@ to the one generated by name-that-color.
6
6
  */
7
7
  const BLACK = "#000000";
8
8
  const TRANSPARENT = "transparent";
9
- // WHITE
9
+ const LINK_WATER = "#FEFEFE";
10
10
  const WHITE = "#FFFFFF";
11
11
  const SOLITUDE_WHITE = "#EBEDF1";
12
12
  const SEASHELL_WHITE = "#F1F1F1";
@@ -45,6 +45,7 @@ const MARINER_BLUE = "#2E75D2";
45
45
  const CURIOUS_BLUE = "#27A9E1";
46
46
  const SELAGO_BLUE = "#F2F8FD";
47
47
  const ONAHAU_BLUE = "#D1ECFF";
48
+ const MOON_RAKER = "#C4CEF4";
48
49
  const PICKLED_BLUE = "#2C3E50";
49
50
  const CERULEAN_BLUE = "#0D8DC4";
50
51
  const FOAM_BLUE = "#EFF4FD";
@@ -143,6 +144,7 @@ export {
143
144
  BLACK,
144
145
  TRANSPARENT,
145
146
  WHITE,
147
+ LINK_WATER,
146
148
  SOLITUDE_WHITE,
147
149
  SEASHELL_WHITE,
148
150
  ALABASTER_WHITE,
@@ -180,6 +182,7 @@ export {
180
182
  CURIOUS_BLUE,
181
183
  SELAGO_BLUE,
182
184
  ONAHAU_BLUE,
185
+ MOON_RAKER,
183
186
  PICKLED_BLUE,
184
187
  CERULEAN_BLUE,
185
188
  FOAM_BLUE,
@@ -0,0 +1,3 @@
1
+ import * as colors from "./colors";
2
+
3
+ export { colors };
package/src/index.d.ts CHANGED
@@ -1,2 +1,4 @@
1
+ import * as constants from "./constants";
1
2
  export * from "./components";
2
3
  export * from "./types/common";
4
+ export { constants };