@thecb/components 8.2.2 → 8.3.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": "8.2.2",
3
+ "version": "8.3.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
@@ -0,0 +1,40 @@
1
+ import React from "react";
2
+ import styled from "styled-components";
3
+ import Box from "../layouts/Box";
4
+ import Text from "../../atoms/text/";
5
+ import { themeComponent } from "../../../util/themeUtils";
6
+ import { fallbackValues } from "./Badge.theme";
7
+
8
+ const StyledBadgeContainer = styled(Box)`
9
+ display: inline-flex;
10
+ padding: 2px 8px;
11
+ align-items: center;
12
+ align-self: flex-start;
13
+ gap: 4px;
14
+ border-radius: 4px;
15
+ `;
16
+
17
+ const StyledBadge = styled(Text)`
18
+ font-family: "Public Sans", sans-serif;
19
+ font-size: 10px;
20
+ font-style: normal;
21
+ font-weight: 400;
22
+ line-height: 150%; /* 15px */
23
+ letter-spacing: 0.2px;
24
+
25
+ @media screen and (min-width: 1049px) {
26
+ font-size: 12px;
27
+ line-height: 150%; /* 18px */
28
+ letter-spacing: 0.24px;
29
+ }
30
+ `;
31
+
32
+ const Badge = ({ label, Icon, themeValues, iconOnLeft = true }) => (
33
+ <StyledBadgeContainer background={themeValues.background}>
34
+ {iconOnLeft && Icon && <Icon fill={themeValues.color} />}
35
+ <StyledBadge color={themeValues.color}>{label}</StyledBadge>
36
+ {!iconOnLeft && Icon && <Icon fill={themeValues.color} />}
37
+ </StyledBadgeContainer>
38
+ );
39
+
40
+ export default themeComponent(Badge, "Badge", fallbackValues, "success");
@@ -0,0 +1,32 @@
1
+ import React from "react";
2
+ import { text, select } from "@storybook/addon-knobs";
3
+ import Badge from "./Badge";
4
+ import page from "../../../../.storybook/page";
5
+ import AutopayIcon from "../icons/AutopayIcon";
6
+
7
+ const variantsLabel = "variants";
8
+ const variants = {
9
+ info: "info",
10
+ warn: "warn",
11
+ primary: "primary",
12
+ success: "success"
13
+ };
14
+
15
+ const defaultValue = "success";
16
+ const groupId = "props";
17
+ const labelLabel = "label";
18
+ const iconLabel = "Icon";
19
+
20
+ export const badge = () => (
21
+ <Badge
22
+ variant={select(variantsLabel, variants, defaultValue, groupId)}
23
+ label={text(labelLabel, "Autopay Available", groupId)}
24
+ Icon={text(iconLabel, AutopayIcon, groupId)}
25
+ />
26
+ );
27
+
28
+ const story = page({
29
+ title: "Components|Atoms/Badge",
30
+ Component: Badge
31
+ });
32
+ export default story;
@@ -0,0 +1,29 @@
1
+ import {
2
+ CORNFLOWER_BLUE,
3
+ HALF_COLONIAL_WHITE,
4
+ HINT_GREEN,
5
+ INFO_BLUE,
6
+ MATISSE_BLUE,
7
+ ROYAL_BLUE_VIVID,
8
+ SEA_GREEN,
9
+ ZEST_ORANGE
10
+ } from "../../../constants/colors";
11
+
12
+ const background = {
13
+ info: `${INFO_BLUE}`,
14
+ warn: `${HALF_COLONIAL_WHITE}`,
15
+ primary: `${CORNFLOWER_BLUE}`,
16
+ success: `${HINT_GREEN}`
17
+ };
18
+
19
+ const color = {
20
+ info: `${MATISSE_BLUE}`,
21
+ warn: `${ZEST_ORANGE}`,
22
+ primary: `${ROYAL_BLUE_VIVID}`,
23
+ success: `${SEA_GREEN}`
24
+ };
25
+
26
+ export const fallbackValues = {
27
+ background,
28
+ color
29
+ };
@@ -0,0 +1,10 @@
1
+ import React, { HTMLAttributes } from "react";
2
+ import Expand from "../../../util/expand";
3
+
4
+ export interface BadgeProps {
5
+ label: string;
6
+ Icon?: JSX.Element;
7
+ iconOnLeft?: boolean;
8
+ }
9
+
10
+ export const Badge: React.FC<Expand<BadgeProps> & HTMLAttributes<HTMLElement>>;
@@ -0,0 +1,3 @@
1
+ import Badge from "./Badge";
2
+
3
+ export default Badge;
@@ -0,0 +1,32 @@
1
+ import React from "react";
2
+
3
+ // Fill color based on default "success" variant color
4
+ const AutopayIcon = ({ fill = "#317D4F" }) => (
5
+ <svg
6
+ width="16"
7
+ height="16"
8
+ viewBox="0 0 16 16"
9
+ fill="none"
10
+ xmlns="http://www.w3.org/2000/svg"
11
+ >
12
+ <mask
13
+ id="mask0_5560_39870"
14
+ style={{ maskType: "luminance" }}
15
+ maskUnits="userSpaceOnUse"
16
+ x="3"
17
+ y="3"
18
+ width="10"
19
+ height="10"
20
+ >
21
+ <path
22
+ d="M4.81368 7.38351C4.87789 7.38351 4.92927 7.36745 4.9678 7.33535C5.00633 7.30324 5.03202 7.2615 5.04486 7.21012C5.22467 6.49089 5.60677 5.9033 6.19114 5.44736C6.77552 4.99142 7.44018 4.76344 8.1851 4.76344C8.59609 4.76344 8.99103 4.83729 9.36991 4.98499C9.74879 5.13269 10.0924 5.34782 10.4006 5.63038L9.59146 6.43951C9.50155 6.52942 9.45661 6.63859 9.45661 6.76702C9.45661 6.89546 9.50155 7.00463 9.59146 7.09453C9.68136 7.18443 9.79054 7.22939 9.91897 7.22939L12.5005 7.22939C12.629 7.22939 12.7381 7.18443 12.828 7.09453C12.9179 7.00463 12.9629 6.89546 12.9629 6.76702L12.9629 4.18548C12.9629 4.05705 12.9179 3.94788 12.828 3.85797C12.7381 3.76807 12.629 3.72312 12.5005 3.72312C12.3721 3.72312 12.2629 3.76807 12.173 3.85797L11.4795 4.55152C11.0428 4.12769 10.5419 3.80018 9.97677 3.569C9.41166 3.33781 8.81443 3.22222 8.1851 3.22222C7.41449 3.22222 6.69846 3.3924 6.03702 3.73275C5.37558 4.0731 4.82009 4.53868 4.37057 5.12948C3.92105 5.72028 3.62565 6.38172 3.48437 7.1138C3.47153 7.17801 3.48759 7.23902 3.53253 7.29682C3.57749 7.35461 3.63849 7.38351 3.71555 7.38351L4.81368 7.38351ZM8.1851 12.7778C8.95571 12.7778 9.67173 12.6076 10.3332 12.2672C10.9946 11.9269 11.5501 11.4613 11.9996 10.8705C12.4491 10.2797 12.7445 9.61827 12.8858 8.88619C12.8987 8.82197 12.8826 8.76097 12.8377 8.70317C12.7927 8.64537 12.7317 8.61648 12.6546 8.61648H11.5565C11.4923 8.61648 11.4409 8.63253 11.4024 8.66464C11.3639 8.69675 11.3382 8.73849 11.3253 8.78986C11.1455 9.5091 10.7634 10.0967 10.1791 10.5526C9.59467 11.0086 8.93002 11.2366 8.1851 11.2366C7.77411 11.2366 7.37916 11.1627 7.00028 11.015C6.6214 10.8673 6.27784 10.6522 5.96959 10.3696L6.77873 9.56048C6.86864 9.47057 6.91359 9.3614 6.91359 9.23297C6.91359 9.10453 6.86864 8.99536 6.77873 8.90546C6.68882 8.81555 6.57966 8.7706 6.45122 8.7706H3.86968C3.74124 8.7706 3.63207 8.81555 3.54217 8.90546C3.45227 8.99536 3.40731 9.10453 3.40731 9.23297L3.40731 11.8145C3.40731 11.9429 3.45226 12.0521 3.54217 12.142C3.63207 12.2319 3.74124 12.2769 3.86968 12.2769C3.99811 12.2769 4.10728 12.2319 4.19719 12.142L4.89074 11.4485C5.32742 11.8723 5.82831 12.1998 6.39343 12.431C6.95854 12.6622 7.55577 12.7778 8.1851 12.7778Z"
23
+ fill="white"
24
+ />
25
+ </mask>
26
+ <g mask="url(#mask0_5560_39870)">
27
+ <path d="M0 0H16V16H0V0Z" fill={fill} />
28
+ </g>
29
+ </svg>
30
+ );
31
+
32
+ export default AutopayIcon;
@@ -38,7 +38,8 @@ import {
38
38
  RejectedVelocityIcon,
39
39
  SuccessfulIcon,
40
40
  VoidedIcon,
41
- StatusUnknownIcon
41
+ StatusUnknownIcon,
42
+ AutopayIcon
42
43
  } from "./index";
43
44
 
44
45
  const story = page({
@@ -84,3 +85,4 @@ export const rejectedVelocityIcon = () => <RejectedVelocityIcon />;
84
85
  export const successfulIcon = () => <SuccessfulIcon />;
85
86
  export const voidedIcon = () => <VoidedIcon />;
86
87
  export const statusUnknownIcon = () => <StatusUnknownIcon />;
88
+ export const autopayIcon = () => <AutopayIcon />;
@@ -1,4 +1,5 @@
1
1
  import AccountsIcon from "./AccountsIcon";
2
+ import AutopayIcon from "./AutopayIcon";
2
3
  import AccountsAddIcon from "./AccountsAddIcon";
3
4
  import ForgotPasswordIcon from "./ForgotPasswordIcon";
4
5
  import GoToEmailIcon from "./GoToEmailIcon";
@@ -86,6 +87,7 @@ import ChargebackReversalIconMedium from "./ChargebackReversalIconMedium";
86
87
  export {
87
88
  AccountsIcon,
88
89
  AccountsAddIcon,
90
+ AutopayIcon,
89
91
  ForgotPasswordIcon,
90
92
  GoToEmailIcon,
91
93
  VerifiedEmailIcon,
@@ -1,6 +1,7 @@
1
1
  export { default as AddObligation } from "./add-obligation";
2
2
  export { default as Alert } from "./alert";
3
3
  export { default as AmountCallout } from "./amount-callout";
4
+ export { default as Badge } from "./badge";
4
5
  export { default as BoxWithShadow } from "./box-with-shadow";
5
6
  export { default as Breadcrumb } from "./breadcrumb";
6
7
  export { default as ButtonWithAction } from "./button-with-action";
@@ -51,9 +51,11 @@ const FOAM_BLUE = "#EFF4FD";
51
51
  const CELLO_BLUE = "#214566";
52
52
  const BOSTON_BLUE = "#357fb8";
53
53
  const INFO_BLUE = "#E4F4FD";
54
+ const CORNFLOWER_BLUE = "#EBEFFB";
54
55
  const HOVER_LIGHT_BLUE = "#EFFAFF";
55
56
  const MATISSE_BLUE = "#15749D";
56
57
  const ROYAL_BLUE = "#3181E3";
58
+ const ROYAL_BLUE_VIVID = "#3B5BDB";
57
59
  const ASTRAL_BLUE = "#3176AA";
58
60
  const SAPPHIRE_BLUE = "#116285";
59
61
  const PEACOCK_BLUE = "#0E506D";
@@ -147,6 +149,7 @@ export {
147
149
  AQUA_HAZE_WHITE,
148
150
  BLEACH_WHITE,
149
151
  CATSKILL_WHITE,
152
+ CORNFLOWER_BLUE,
150
153
  HALF_COLONIAL_WHITE,
151
154
  ATHENS_GREY,
152
155
  ALTO_GREY,
@@ -185,6 +188,7 @@ export {
185
188
  HOVER_LIGHT_BLUE,
186
189
  MATISSE_BLUE,
187
190
  ROYAL_BLUE,
191
+ ROYAL_BLUE_VIVID,
188
192
  ASTRAL_BLUE,
189
193
  SAPPHIRE_BLUE,
190
194
  PEACOCK_BLUE,