@thecb/components 9.1.5-beta.0 → 9.2.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.
- package/dist/index.cjs.js +1450 -397
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +1450 -397
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/atoms/line-item/LineItem.js +1 -1
- package/src/components/molecules/radio-section/radio-button/RadioButton.js +5 -7
- package/src/components/molecules/radio-section/radio-button/RadioButton.theme.js +2 -2
- package/src/components/molecules/toast-notification/ToastNotification.js +90 -0
- package/src/components/molecules/toast-notification/ToastNotification.stories.js +36 -0
- package/src/components/molecules/toast-notification/index.d.ts +1 -0
- package/src/components/molecules/toast-notification/index.js +3 -0
package/package.json
CHANGED
|
@@ -25,7 +25,7 @@ const LineItem = ({
|
|
|
25
25
|
|
|
26
26
|
const visibleCustomAttrs = customAttributes
|
|
27
27
|
?.filter(
|
|
28
|
-
attr => visibleFields
|
|
28
|
+
attr => visibleFields?.includes(attr.key) && attr.key !== "description"
|
|
29
29
|
)
|
|
30
30
|
?.map(attr => (
|
|
31
31
|
<Paragraph variant="pS" weight="400" key={attr.key} color={STORM_GREY}>
|
|
@@ -24,21 +24,19 @@ const RadioButton = ({
|
|
|
24
24
|
const buttonBorder = {
|
|
25
25
|
onFocused: {
|
|
26
26
|
borderColor: themeValues.activeColor,
|
|
27
|
-
|
|
28
|
-
outlineOffset: "2px"
|
|
27
|
+
boxShadow: `0px 0px 4px 0px ${themeValues.activeColor}`
|
|
29
28
|
},
|
|
30
29
|
offFocused: {
|
|
31
30
|
borderColor: themeValues.activeColor,
|
|
32
|
-
|
|
33
|
-
outlineOffset: "2px"
|
|
31
|
+
boxShadow: `0px 0px 4px 0px ${themeValues.activeColor}`
|
|
34
32
|
},
|
|
35
33
|
on: {
|
|
36
34
|
borderColor: themeValues.activeColor,
|
|
37
|
-
|
|
35
|
+
boxShadow: "0px 0px 0px 0px #FFFFFF"
|
|
38
36
|
},
|
|
39
37
|
off: {
|
|
40
38
|
borderColor: themeValues.inactiveColor,
|
|
41
|
-
|
|
39
|
+
boxShadow: "0px 0px 0px 0px #FFFFFF"
|
|
42
40
|
}
|
|
43
41
|
};
|
|
44
42
|
|
|
@@ -99,7 +97,7 @@ const RadioButton = ({
|
|
|
99
97
|
borderWidth="1px"
|
|
100
98
|
borderStyle="solid"
|
|
101
99
|
borderRadius="12px"
|
|
102
|
-
margin="
|
|
100
|
+
margin="4px 14px 4px 4px"
|
|
103
101
|
height="24px"
|
|
104
102
|
width="24px"
|
|
105
103
|
variants={buttonBorder}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { MATISSE_BLUE,
|
|
1
|
+
import { MATISSE_BLUE, GREY_CHATEAU } from "../../../../constants/colors";
|
|
2
2
|
|
|
3
3
|
const activeColor = `${MATISSE_BLUE}`;
|
|
4
|
-
const inactiveColor = `${
|
|
4
|
+
const inactiveColor = `${GREY_CHATEAU}`;
|
|
5
5
|
|
|
6
6
|
export const fallbackValues = {
|
|
7
7
|
activeColor,
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
|
|
3
|
+
// import CloseIcon from "../CloseIcon";
|
|
4
|
+
// import ErrorIcon from "../ErrorMessage/ErrorIcon";
|
|
5
|
+
// import SuccessIcon from "../SuccessMessage/SuccessIcon";
|
|
6
|
+
// import { SEMI_BOLD } from "@/constants/fonts";
|
|
7
|
+
// import { CloseIconWrapper } from "./ToastNotification.styled";
|
|
8
|
+
import { Box, Cluster } from "../../atoms/layouts";
|
|
9
|
+
import { Paragraph } from "../../atoms";
|
|
10
|
+
import {
|
|
11
|
+
SuccessfulIconMedium,
|
|
12
|
+
ErroredIcon,
|
|
13
|
+
IconQuitLarge,
|
|
14
|
+
SuccessfulIconSmall,
|
|
15
|
+
} from "../../atoms/icons";
|
|
16
|
+
import { ERROR_COLOR, HINT_GREEN } from "../../../constants/colors";
|
|
17
|
+
import { FONT_WEIGHT_SEMIBOLD } from "../../../constants/style_constants";
|
|
18
|
+
import styled from "styled-components";
|
|
19
|
+
|
|
20
|
+
export const CloseIconWrapper = styled.div`
|
|
21
|
+
min-height: 24px;
|
|
22
|
+
min-width: 24px;
|
|
23
|
+
display: flex;
|
|
24
|
+
margin: 16px;
|
|
25
|
+
justify-content: center;
|
|
26
|
+
align-items: center;
|
|
27
|
+
cursor: pointer;
|
|
28
|
+
`;
|
|
29
|
+
|
|
30
|
+
const VARIANTS = {
|
|
31
|
+
SUCCESS: "success",
|
|
32
|
+
ERROR: "error",
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
const ToastNotification = ({
|
|
36
|
+
message = "",
|
|
37
|
+
extraStyles,
|
|
38
|
+
minWidth = "112px",
|
|
39
|
+
maxWidth = "350px",
|
|
40
|
+
height = "56px",
|
|
41
|
+
closeToastNotification,
|
|
42
|
+
toastOpen,
|
|
43
|
+
variant = VARIANTS.SUCCESS,
|
|
44
|
+
backgroundColor
|
|
45
|
+
}) => (
|
|
46
|
+
<Box
|
|
47
|
+
onClick={closeToastNotification}
|
|
48
|
+
background={
|
|
49
|
+
backgroundColor
|
|
50
|
+
? backgroundColor
|
|
51
|
+
: variant === VARIANTS.SUCCESS
|
|
52
|
+
? HINT_GREEN
|
|
53
|
+
: variant === "error"
|
|
54
|
+
? ERROR_COLOR
|
|
55
|
+
: WHITE
|
|
56
|
+
}
|
|
57
|
+
minWidth={minWidth}
|
|
58
|
+
minHeight={height && parseInt(height) < 100 ? height : "100px"}
|
|
59
|
+
height={height ? height : "auto"}
|
|
60
|
+
tabIndex={toastOpen ? "-1" : "0"}
|
|
61
|
+
padding="0"
|
|
62
|
+
borderRadius="4px"
|
|
63
|
+
boxShadow="0px 4px 4px rgba(41, 42, 51, 0.15),
|
|
64
|
+
0px 1px 7px rgba(41, 42, 51, 0.2),
|
|
65
|
+
0px 7px 12px rgba(41, 42, 51, 0.15)"
|
|
66
|
+
extraStyles={`
|
|
67
|
+
display: ${toastOpen ? "block" : "none"};
|
|
68
|
+
position: fixed; bottom: 4rem; left: 4rem;
|
|
69
|
+
${extraStyles};
|
|
70
|
+
`}
|
|
71
|
+
>
|
|
72
|
+
<Cluster align="center" childGap="0">
|
|
73
|
+
{variant === "success" && <SuccessfulIconSmall />}
|
|
74
|
+
{variant === "error" && <ErroredIcon />}
|
|
75
|
+
<Box padding="1rem 0" maxWidth={maxWidth}>
|
|
76
|
+
<Paragraph
|
|
77
|
+
weight={FONT_WEIGHT_SEMIBOLD}
|
|
78
|
+
extraStyles={"word-break: break-word;"}
|
|
79
|
+
>
|
|
80
|
+
{message}
|
|
81
|
+
</Paragraph>
|
|
82
|
+
</Box>
|
|
83
|
+
<CloseIconWrapper>
|
|
84
|
+
<IconQuitLarge />
|
|
85
|
+
</CloseIconWrapper>
|
|
86
|
+
</Cluster>
|
|
87
|
+
</Box>
|
|
88
|
+
);
|
|
89
|
+
|
|
90
|
+
export default ToastNotification;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import React, { useState } from "react";
|
|
2
|
+
import ToastNotification from "./ToastNotification";
|
|
3
|
+
import page from "../../../../.storybook/page";
|
|
4
|
+
|
|
5
|
+
export const toastNotificationSuccess = () => {
|
|
6
|
+
const [toastOpen, setToastOpen] = useState(true);
|
|
7
|
+
return (
|
|
8
|
+
<ToastNotification
|
|
9
|
+
toastOpen={toastOpen}
|
|
10
|
+
closeToastNotification={() => setToastOpen(false)}
|
|
11
|
+
message="Successful"
|
|
12
|
+
variant="success"
|
|
13
|
+
/>
|
|
14
|
+
);
|
|
15
|
+
};
|
|
16
|
+
toastNotificationSuccess.storyName = "Success Toast";
|
|
17
|
+
|
|
18
|
+
export const toastNotificationError = () => {
|
|
19
|
+
const [toastOpen, setToastOpen] = useState(true);
|
|
20
|
+
return (
|
|
21
|
+
<ToastNotification
|
|
22
|
+
toastOpen={toastOpen}
|
|
23
|
+
closeToastNotification={() => setToastOpen(false)}
|
|
24
|
+
message="Errored"
|
|
25
|
+
variant="error"
|
|
26
|
+
/>
|
|
27
|
+
);
|
|
28
|
+
};
|
|
29
|
+
toastNotificationError.storyName = "Error Toast";
|
|
30
|
+
|
|
31
|
+
const story = page({
|
|
32
|
+
title: "Components|Molecules/ToastNotification",
|
|
33
|
+
Component: ToastNotification
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
export default story;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
// TODO - add types
|