@thecb/components 10.4.7-beta.1 → 10.4.7-beta.3

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.4.7-beta.1",
3
+ "version": "10.4.7-beta.3",
4
4
  "description": "Common lib for CityBase react components",
5
5
  "main": "dist/index.cjs.js",
6
6
  "typings": "dist/index.d.ts",
@@ -1,6 +1,6 @@
1
1
  import React from "react";
2
2
 
3
- const IconAdd = () => (
3
+ const IconAdd = ({ strokeWidth = 1 }) => (
4
4
  <svg
5
5
  xmlns="http://www.w3.org/2000/svg"
6
6
  xmlnsXlink="http://www.w3.org/1999/xlink"
@@ -15,7 +15,7 @@ const IconAdd = () => (
15
15
  d="M7.91666623 4.78508747L4.78508747 4.78508747 4.78508747 7.91666623 3.74122788 7.91666623 3.74122788 4.78508747 0.609649123 4.78508747 0.609649123 3.74122788 3.74122788 3.74122788 3.74122788 0.609649123 4.78508747 0.609649123 4.78508747 3.74122788 7.91666623 3.74122788z"
16
16
  ></path>
17
17
  </defs>
18
- <g fill="none" fillRule="evenodd" stroke="none" strokeWidth="1">
18
+ <g fill="none" fillRule="evenodd" stroke="none" strokeWidth={strokeWidth}>
19
19
  <g transform="translate(-407 -563)">
20
20
  <g transform="translate(408 562)">
21
21
  <g transform="translate(0 2)">
@@ -25,7 +25,13 @@ const IconAdd = () => (
25
25
  </mask>
26
26
  <use className="fill" xlinkHref="#path-1"></use>
27
27
  </g>
28
- <circle className="stroke" cx="8.155" cy="8.072" r="8"></circle>
28
+ <circle
29
+ className="stroke"
30
+ strokeWidth={strokeWidth}
31
+ cx="8.155"
32
+ cy="8.072"
33
+ r="8"
34
+ ></circle>
29
35
  </g>
30
36
  </g>
31
37
  </g>
@@ -9,7 +9,6 @@ const IconQuitLarge = ({ fill = "#091325" }) => (
9
9
  xmlns="http://www.w3.org/2000/svg"
10
10
  xmlnsXlink="http://www.w3.org/1999/xlink"
11
11
  >
12
- <title>Icon/X</title>
13
12
  <defs>
14
13
  <polygon
15
14
  id="quit-large-path-1"
@@ -16,7 +16,7 @@ import {
16
16
  IconAdd,
17
17
  PaymentMethodAddIcon
18
18
  } from "../icons";
19
- import { FONT_WEIGHT_REGULAR } from "../../../constants/style_constants";
19
+ import { FONT_WEIGHT_SEMIBOLD } from "../../../constants/style_constants";
20
20
 
21
21
  const getLargeIcon = iconName => {
22
22
  switch (iconName) {
@@ -123,7 +123,7 @@ const Placeholder = ({
123
123
  stroke: ${
124
124
  variant === "large" ? CHARADE_GREY : themeValues.color
125
125
  };
126
- }`}
126
+ } `}
127
127
  >
128
128
  {variant === "large" ? (
129
129
  <Center intrinsic>
@@ -131,7 +131,7 @@ const Placeholder = ({
131
131
  <Text
132
132
  variant="pS"
133
133
  color={themeValues.color}
134
- weight={FONT_WEIGHT_REGULAR}
134
+ weight={FONT_WEIGHT_SEMIBOLD}
135
135
  extraStyles={`text-align: center;`}
136
136
  >
137
137
  {text}
@@ -140,12 +140,12 @@ const Placeholder = ({
140
140
  ) : (
141
141
  <Cover singleChild minHeight="100%">
142
142
  <Cluster justify="center" align="center">
143
- <IconAdd />
143
+ <IconAdd strokeWidth="2" />
144
144
  <Center intrinsic>
145
145
  <Text
146
146
  variant="pS"
147
147
  color={themeValues.color}
148
- weight={FONT_WEIGHT_REGULAR}
148
+ weight={FONT_WEIGHT_SEMIBOLD}
149
149
  extraStyles={`padding: 0 0 0 8px; text-align: center;`}
150
150
  >
151
151
  {text}
@@ -13,7 +13,8 @@ const groupId = "props";
13
13
 
14
14
  const icons = {
15
15
  accounts: "accounts",
16
- properties: "properties"
16
+ properties: "properties",
17
+ payments: "payments"
17
18
  };
18
19
 
19
20
  const iconLabel = "largeIcon";
@@ -78,8 +78,8 @@ const ToggleSwitch = ({
78
78
  backgroundColor: themeValues.white,
79
79
  right: "8px",
80
80
  top: "3px",
81
- bottom: "4px",
82
- left: "23px",
81
+ bottom: "3px",
82
+ left: "22px",
83
83
  transition: {
84
84
  ease: "backIn"
85
85
  }
@@ -29,7 +29,8 @@ const ToastNotification = ({
29
29
  maxWidth = "350px",
30
30
  height = "56px",
31
31
  childGap = "1rem",
32
- backgroundColor
32
+ backgroundColor,
33
+ role = "alert"
33
34
  }) => (
34
35
  <Box
35
36
  onClick={closeToastNotification}
@@ -55,18 +56,21 @@ const ToastNotification = ({
55
56
  ${extraStyles};
56
57
  cursor: pointer;
57
58
  `}
59
+ role={role}
58
60
  >
59
- <Cluster align="center" childGap={childGap}>
60
- {variant === VARIANTS.SUCCESS && <SuccessfulIconMedium />}
61
- {variant === VARIANTS.ERROR && <ErroredIcon />}
62
- <Box padding="1rem 0" maxWidth={maxWidth}>
63
- <Paragraph
64
- weight={FONT_WEIGHT_SEMIBOLD}
65
- extraStyles={"word-break: break-word;"}
66
- >
67
- {message}
68
- </Paragraph>
69
- </Box>
61
+ <Cluster align="center" childGap={childGap} justify="space-between">
62
+ <Cluster align="center" childGap={childGap}>
63
+ {variant === VARIANTS.SUCCESS && <SuccessfulIconMedium />}
64
+ {variant === VARIANTS.ERROR && <ErroredIcon />}
65
+ <Box padding="1rem 0" maxWidth={maxWidth}>
66
+ <Paragraph
67
+ weight={FONT_WEIGHT_SEMIBOLD}
68
+ extraStyles={"word-break: break-word;"}
69
+ >
70
+ {message}
71
+ </Paragraph>
72
+ </Box>
73
+ </Cluster>
70
74
  <IconQuitLarge />
71
75
  </Cluster>
72
76
  </Box>
@@ -3,6 +3,9 @@ import ToastNotification from "./ToastNotification";
3
3
  import page from "../../../../.storybook/page";
4
4
  import { useToastNotification } from "../../../hooks";
5
5
  import { ToastVariants } from "../../../types/common";
6
+ import { text } from "@storybook/addon-knobs";
7
+
8
+ const groupId = "props";
6
9
 
7
10
  export const toastNotificationSuccess = () => {
8
11
  const {
@@ -26,6 +29,9 @@ export const toastNotificationSuccess = () => {
26
29
  message={toastMessage}
27
30
  toastOpen={isToastOpen}
28
31
  closeToastNotification={() => hideToast()}
32
+ role={text("role", "alert", groupId)}
33
+ minWidth={text("minWidth", null, groupId)}
34
+ maxWidth={text("maxWidth", null, groupId)}
29
35
  />
30
36
  );
31
37
  };
@@ -54,11 +60,43 @@ export const toastNotificationError = () => {
54
60
  message={toastMessage}
55
61
  toastOpen={isToastOpen}
56
62
  closeToastNotification={() => hideToast()}
63
+ role={text("role", "alert", groupId)}
64
+ minWidth={text("minWidth", null, groupId)}
65
+ maxWidth={text("maxWidth", null, groupId)}
57
66
  />
58
67
  );
59
68
  };
60
69
  toastNotificationError.storyName = "Error Toast";
61
70
 
71
+ export const toastNotificationNoAutoHide = () => {
72
+ const {
73
+ isToastOpen,
74
+ toastMessage,
75
+ showToast,
76
+ hideToast
77
+ } = useToastNotification({ timeout: 0 });
78
+
79
+ useEffect(() => {
80
+ showToast({
81
+ message: "Success!",
82
+ variant: ToastVariants.SUCCESS
83
+ });
84
+ }, []);
85
+
86
+ return (
87
+ <ToastNotification
88
+ message={toastMessage}
89
+ toastOpen={isToastOpen}
90
+ closeToastNotification={() => hideToast()}
91
+ role={text("role", "alert", groupId)}
92
+ minWidth={text("minWidth", null, groupId)}
93
+ maxWidth={text("maxWidth", null, groupId)}
94
+ />
95
+ );
96
+ };
97
+
98
+ toastNotificationNoAutoHide.storyName = "No auto-hide";
99
+
62
100
  const story = page({
63
101
  title: "Components|Molecules/ToastNotification",
64
102
  Component: ToastNotification
@@ -10,7 +10,7 @@ const useToastNotification = ({ timeout = 5000 } = {}) => {
10
10
  const [toastState, setToastState] = useState(initialToastState);
11
11
 
12
12
  useEffect(() => {
13
- if (toastState.isOpen) {
13
+ if (toastState.isOpen && timeout > 0) {
14
14
  setTimeout(() => {
15
15
  setToastState(initialToastState);
16
16
  }, timeout);