@synerise/ds-toast 1.4.11 → 1.4.12
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/CHANGELOG.md +4 -0
- package/dist/Toast.d.ts +2 -2
- package/dist/Toast.js +66 -84
- package/dist/Toast.styles.d.ts +20 -20
- package/dist/Toast.styles.js +79 -95
- package/dist/Toast.types.d.ts +3 -3
- package/dist/Toast.types.js +1 -1
- package/dist/constants.d.ts +2 -2
- package/dist/constants.js +11 -8
- package/dist/index.js +12 -4
- package/dist/utils/dismissToast.js +5 -2
- package/dist/utils/index.js +6 -2
- package/dist/utils/removeToast.js +5 -2
- package/package.json +9 -8
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,10 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [1.4.12](https://github.com/Synerise/synerise-design/compare/@synerise/ds-toast@1.4.11...@synerise/ds-toast@1.4.12) (2026-03-24)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @synerise/ds-toast
|
|
9
|
+
|
|
6
10
|
## [1.4.11](https://github.com/Synerise/synerise-design/compare/@synerise/ds-toast@1.4.10...@synerise/ds-toast@1.4.11) (2026-03-20)
|
|
7
11
|
|
|
8
12
|
### Bug Fixes
|
package/dist/Toast.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import {
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { ShowToastProps, ToastCustomisationOptions, ToastProps, ToastType } from './Toast.types';
|
|
3
3
|
export declare const Toast: {
|
|
4
4
|
({ type, message, description, expander, expandedContent, withClose, customIcon, expanded, onExpand, onCloseClick, onDismiss, button, toastId, show, ...htmlAttributes }: ToastProps): React.JSX.Element;
|
|
5
5
|
success(props: ShowToastProps, options?: ToastCustomisationOptions): string;
|
package/dist/Toast.js
CHANGED
|
@@ -1,100 +1,82 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import {
|
|
7
|
-
import
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
button: !!button
|
|
33
|
-
}, description), expandedContent && /*#__PURE__*/React.createElement(S.ListWrapper, {
|
|
34
|
-
description: description,
|
|
35
|
-
visible: expanded
|
|
36
|
-
}, expandedContent), button);
|
|
37
|
-
var iconComponentForType = useMemo(function () {
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo, useCallback, useEffect } from "react";
|
|
3
|
+
import toast from "react-hot-toast";
|
|
4
|
+
import { v4 } from "uuid";
|
|
5
|
+
import Icon, { AngleDownS, CloseM } from "@synerise/ds-icon";
|
|
6
|
+
import { AnimationContainer, Container, IconWrapper, WrapperSectionMessage, AlertMessage, ButtonWrapper, IconExpanderWrapper, IconCloseWrapper, AlertContent, AlertDescription, ListWrapper } from "./Toast.styles.js";
|
|
7
|
+
import { ICONS } from "./constants.js";
|
|
8
|
+
const Toast = ({
|
|
9
|
+
type,
|
|
10
|
+
message,
|
|
11
|
+
description,
|
|
12
|
+
expander,
|
|
13
|
+
expandedContent,
|
|
14
|
+
withClose,
|
|
15
|
+
customIcon,
|
|
16
|
+
expanded,
|
|
17
|
+
onExpand,
|
|
18
|
+
onCloseClick,
|
|
19
|
+
onDismiss,
|
|
20
|
+
button,
|
|
21
|
+
toastId,
|
|
22
|
+
show = true,
|
|
23
|
+
...htmlAttributes
|
|
24
|
+
}) => {
|
|
25
|
+
const hasToastContent = button || description || expandedContent;
|
|
26
|
+
const toastContent = hasToastContent && /* @__PURE__ */ jsxs(AlertContent, { hasBottomMargin: Boolean(button || description || expandedContent && expanded), children: [
|
|
27
|
+
description && /* @__PURE__ */ jsx(AlertDescription, { expandedContent: !!expandedContent, button: !!button, children: description }),
|
|
28
|
+
expandedContent && /* @__PURE__ */ jsx(ListWrapper, { description, visible: expanded, children: expandedContent }),
|
|
29
|
+
button
|
|
30
|
+
] });
|
|
31
|
+
const iconComponentForType = useMemo(() => {
|
|
38
32
|
return ICONS[type];
|
|
39
33
|
}, [type]);
|
|
40
|
-
|
|
34
|
+
const expandContent = useCallback(() => {
|
|
41
35
|
onExpand && onExpand(!expanded);
|
|
42
36
|
}, [onExpand, expanded]);
|
|
43
|
-
|
|
44
|
-
onCloseClick
|
|
37
|
+
const handleCloseClick = () => {
|
|
38
|
+
onCloseClick?.();
|
|
45
39
|
if (toastId) {
|
|
46
40
|
toast.dismiss(toastId);
|
|
47
41
|
}
|
|
48
42
|
};
|
|
49
|
-
useEffect(
|
|
50
|
-
return
|
|
51
|
-
onDismiss
|
|
43
|
+
useEffect(() => {
|
|
44
|
+
return () => {
|
|
45
|
+
onDismiss?.();
|
|
52
46
|
};
|
|
53
47
|
}, []);
|
|
54
|
-
return
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
}, message), /*#__PURE__*/React.createElement(S.ButtonWrapper, null, expander && /*#__PURE__*/React.createElement(S.IconExpanderWrapper, {
|
|
66
|
-
onClick: expandContent,
|
|
67
|
-
expanded: expanded
|
|
68
|
-
}, /*#__PURE__*/React.createElement(Icon, {
|
|
69
|
-
component: /*#__PURE__*/React.createElement(AngleDownS, null),
|
|
70
|
-
size: 24
|
|
71
|
-
})), withClose && /*#__PURE__*/React.createElement(S.IconCloseWrapper, {
|
|
72
|
-
onClick: handleCloseClick
|
|
73
|
-
}, /*#__PURE__*/React.createElement(Icon, {
|
|
74
|
-
component: /*#__PURE__*/React.createElement(CloseM, null)
|
|
75
|
-
}))), toastContent)));
|
|
48
|
+
return /* @__PURE__ */ jsx(AnimationContainer, { $show: show, children: /* @__PURE__ */ jsxs(Container, { toastType: type, "data-toastType": type, ...htmlAttributes, children: [
|
|
49
|
+
/* @__PURE__ */ jsx(IconWrapper, { children: customIcon || /* @__PURE__ */ jsx(Icon, { component: iconComponentForType }) }),
|
|
50
|
+
/* @__PURE__ */ jsxs(WrapperSectionMessage, { children: [
|
|
51
|
+
/* @__PURE__ */ jsx(AlertMessage, { noToastContent: !hasToastContent, hasClose: !!withClose, hasExpander: !!expander, children: message }),
|
|
52
|
+
/* @__PURE__ */ jsxs(ButtonWrapper, { children: [
|
|
53
|
+
expander && /* @__PURE__ */ jsx(IconExpanderWrapper, { onClick: expandContent, expanded, children: /* @__PURE__ */ jsx(Icon, { component: /* @__PURE__ */ jsx(AngleDownS, {}), size: 24 }) }),
|
|
54
|
+
withClose && /* @__PURE__ */ jsx(IconCloseWrapper, { onClick: handleCloseClick, children: /* @__PURE__ */ jsx(Icon, { component: /* @__PURE__ */ jsx(CloseM, {}) }) })
|
|
55
|
+
] }),
|
|
56
|
+
toastContent
|
|
57
|
+
] })
|
|
58
|
+
] }) });
|
|
76
59
|
};
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
return toast.custom(
|
|
80
|
-
|
|
81
|
-
toastId: toastId,
|
|
82
|
-
type: type,
|
|
83
|
-
show: t.visible
|
|
84
|
-
}));
|
|
85
|
-
}, _extends({}, options, {
|
|
60
|
+
const showToast = (type, props, options) => {
|
|
61
|
+
const toastId = props.toastId || `toast-${v4()}`;
|
|
62
|
+
return toast.custom((t) => /* @__PURE__ */ jsx(Toast, { ...props, toastId, type, show: t.visible }), {
|
|
63
|
+
...options,
|
|
86
64
|
id: toastId
|
|
87
|
-
})
|
|
65
|
+
});
|
|
88
66
|
};
|
|
89
|
-
Toast.success =
|
|
90
|
-
return showToast(
|
|
67
|
+
Toast.success = (props, options) => {
|
|
68
|
+
return showToast("success", props, options);
|
|
91
69
|
};
|
|
92
|
-
Toast.error =
|
|
93
|
-
return showToast(
|
|
70
|
+
Toast.error = (props, options) => {
|
|
71
|
+
return showToast("negative", props, options);
|
|
94
72
|
};
|
|
95
|
-
Toast.info =
|
|
96
|
-
return showToast(
|
|
73
|
+
Toast.info = (props, options) => {
|
|
74
|
+
return showToast("informative", props, options);
|
|
75
|
+
};
|
|
76
|
+
Toast.warning = (props, options) => {
|
|
77
|
+
return showToast("warning", props, options);
|
|
78
|
+
};
|
|
79
|
+
export {
|
|
80
|
+
Toast,
|
|
81
|
+
showToast
|
|
97
82
|
};
|
|
98
|
-
Toast.warning = function (props, options) {
|
|
99
|
-
return showToast('warning', props, options);
|
|
100
|
-
};
|
package/dist/Toast.styles.d.ts
CHANGED
|
@@ -1,39 +1,39 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { Keyframes } from 'styled-components';
|
|
3
|
+
import { ToastType } from './Toast.types';
|
|
4
4
|
export declare const closingAnimation: () => Keyframes;
|
|
5
|
-
export declare const AnimationContainer: import(
|
|
5
|
+
export declare const AnimationContainer: import('styled-components').StyledComponent<"div", any, {
|
|
6
6
|
$show?: boolean;
|
|
7
7
|
}, never>;
|
|
8
|
-
export declare const AlertContent: import(
|
|
8
|
+
export declare const AlertContent: import('styled-components').StyledComponent<"div", any, {
|
|
9
9
|
hasBottomMargin?: boolean;
|
|
10
10
|
}, never>;
|
|
11
|
-
export declare const AllContent: import(
|
|
12
|
-
export declare const IconWrapper: import(
|
|
13
|
-
export declare const IconCloseWrapper: import(
|
|
14
|
-
export declare const IconExpanderWrapper: import(
|
|
11
|
+
export declare const AllContent: import('styled-components').StyledComponent<"div", any, {}, never>;
|
|
12
|
+
export declare const IconWrapper: import('styled-components').StyledComponent<"div", any, {}, never>;
|
|
13
|
+
export declare const IconCloseWrapper: import('styled-components').StyledComponent<"div", any, {}, never>;
|
|
14
|
+
export declare const IconExpanderWrapper: import('styled-components').StyledComponent<"div", any, {
|
|
15
15
|
expanded?: boolean;
|
|
16
16
|
}, never>;
|
|
17
|
-
export declare const ButtonWrapper: import(
|
|
18
|
-
export declare const FirstButtonWrapper: import(
|
|
19
|
-
export declare const NumberWrapper: import(
|
|
20
|
-
export declare const ListWrapper: import(
|
|
17
|
+
export declare const ButtonWrapper: import('styled-components').StyledComponent<"div", any, {}, never>;
|
|
18
|
+
export declare const FirstButtonWrapper: import('styled-components').StyledComponent<"div", any, {}, never>;
|
|
19
|
+
export declare const NumberWrapper: import('styled-components').StyledComponent<"div", any, {}, never>;
|
|
20
|
+
export declare const ListWrapper: import('styled-components').StyledComponent<"div", any, {
|
|
21
21
|
visible?: boolean;
|
|
22
22
|
description?: ReactNode;
|
|
23
23
|
}, never>;
|
|
24
|
-
export declare const IconOrderWrapper: import(
|
|
25
|
-
export declare const OrderWrapper: import(
|
|
26
|
-
export declare const Wrapper: import(
|
|
27
|
-
export declare const WrapperSectionMessage: import(
|
|
28
|
-
export declare const AlertMessage: import(
|
|
24
|
+
export declare const IconOrderWrapper: import('styled-components').StyledComponent<"div", any, {}, never>;
|
|
25
|
+
export declare const OrderWrapper: import('styled-components').StyledComponent<"div", any, {}, never>;
|
|
26
|
+
export declare const Wrapper: import('styled-components').StyledComponent<"div", any, {}, never>;
|
|
27
|
+
export declare const WrapperSectionMessage: import('styled-components').StyledComponent<"div", any, {}, never>;
|
|
28
|
+
export declare const AlertMessage: import('styled-components').StyledComponent<"div", any, {
|
|
29
29
|
noToastContent?: boolean;
|
|
30
30
|
hasClose?: boolean;
|
|
31
31
|
hasExpander?: boolean;
|
|
32
32
|
}, never>;
|
|
33
|
-
export declare const AlertDescription: import(
|
|
33
|
+
export declare const AlertDescription: import('styled-components').StyledComponent<"div", any, {
|
|
34
34
|
button?: boolean;
|
|
35
35
|
expandedContent?: boolean;
|
|
36
36
|
}, never>;
|
|
37
|
-
export declare const Container: import(
|
|
37
|
+
export declare const Container: import('styled-components').StyledComponent<"div", any, {
|
|
38
38
|
toastType: ToastType;
|
|
39
39
|
}, never>;
|
package/dist/Toast.styles.js
CHANGED
|
@@ -1,149 +1,133 @@
|
|
|
1
|
-
import styled, { keyframes } from
|
|
2
|
-
import { UnorderedList } from
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import styled, { keyframes } from "styled-components";
|
|
2
|
+
import { UnorderedList } from "@synerise/ds-unordered-list/dist/Unordered-list.styles";
|
|
3
|
+
const getIconColorForType = ({
|
|
4
|
+
toastType,
|
|
5
|
+
theme
|
|
6
|
+
}) => {
|
|
6
7
|
switch (toastType) {
|
|
7
|
-
case
|
|
8
|
-
return theme.palette[
|
|
9
|
-
case
|
|
10
|
-
return theme.palette[
|
|
11
|
-
case
|
|
12
|
-
return theme.palette[
|
|
13
|
-
case
|
|
8
|
+
case "informative":
|
|
9
|
+
return theme.palette["grey-600"];
|
|
10
|
+
case "negative":
|
|
11
|
+
return theme.palette["red-500"];
|
|
12
|
+
case "warning":
|
|
13
|
+
return theme.palette["yellow-600"];
|
|
14
|
+
case "success":
|
|
14
15
|
default:
|
|
15
|
-
return theme.palette[
|
|
16
|
+
return theme.palette["green-600"];
|
|
16
17
|
}
|
|
17
18
|
};
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
const getBackgroundColorForType = ({
|
|
20
|
+
toastType,
|
|
21
|
+
theme
|
|
22
|
+
}) => {
|
|
21
23
|
switch (toastType) {
|
|
22
|
-
case
|
|
23
|
-
return theme.palette[
|
|
24
|
-
case
|
|
25
|
-
return theme.palette[
|
|
26
|
-
case
|
|
27
|
-
return theme.palette[
|
|
28
|
-
case
|
|
24
|
+
case "informative":
|
|
25
|
+
return theme.palette["grey-600"];
|
|
26
|
+
case "negative":
|
|
27
|
+
return theme.palette["red-500"];
|
|
28
|
+
case "warning":
|
|
29
|
+
return theme.palette["yellow-600"];
|
|
30
|
+
case "success":
|
|
29
31
|
default:
|
|
30
|
-
return theme.palette[
|
|
32
|
+
return theme.palette["green-600"];
|
|
31
33
|
}
|
|
32
34
|
};
|
|
33
|
-
|
|
35
|
+
const getWidth = (hasClose, hasExpander) => {
|
|
34
36
|
if (hasClose && hasExpander) {
|
|
35
|
-
return
|
|
37
|
+
return "72px";
|
|
36
38
|
}
|
|
37
39
|
if (hasClose || hasExpander) {
|
|
38
|
-
return
|
|
40
|
+
return "48px";
|
|
39
41
|
}
|
|
40
|
-
return
|
|
42
|
+
return "24px";
|
|
41
43
|
};
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
export var closingAnimation = function closingAnimation() {
|
|
46
|
-
return keyframes(["0%{opacity:1;transform:translateY(0) scale(1);}100%{opacity:0;transform:translateY(-8px) scale(0.98);}"]);
|
|
47
|
-
};
|
|
48
|
-
export var AnimationContainer = styled.div.withConfig({
|
|
44
|
+
const openingAnimation = () => keyframes(["0%{opacity:0;transform:translateY(60px);}100%{opacity:1;transform:translateY(0);}"]);
|
|
45
|
+
const closingAnimation = () => keyframes(["0%{opacity:1;transform:translateY(0) scale(1);}100%{opacity:0;transform:translateY(-8px) scale(0.98);}"]);
|
|
46
|
+
const AnimationContainer = /* @__PURE__ */ styled.div.withConfig({
|
|
49
47
|
displayName: "Toaststyles__AnimationContainer",
|
|
50
48
|
componentId: "sc-wwaizr-0"
|
|
51
|
-
})(["animation:", " 0.6s cubic-bezier(0.4,0,0.2,1) forwards;"],
|
|
52
|
-
|
|
53
|
-
});
|
|
54
|
-
export var AlertContent = styled.div.withConfig({
|
|
49
|
+
})(["animation:", " 0.6s cubic-bezier(0.4,0,0.2,1) forwards;"], (props) => props.$show ? openingAnimation() : closingAnimation());
|
|
50
|
+
const AlertContent = /* @__PURE__ */ styled.div.withConfig({
|
|
55
51
|
displayName: "Toaststyles__AlertContent",
|
|
56
52
|
componentId: "sc-wwaizr-1"
|
|
57
|
-
})(["display:flex;flex-direction:column;align-items:flex-start;justify-content:center;margin-right:24px;", " ", "{margin-bottom:8px;}"],
|
|
58
|
-
|
|
59
|
-
}, UnorderedList);
|
|
60
|
-
export var AllContent = styled.div.withConfig({
|
|
53
|
+
})(["display:flex;flex-direction:column;align-items:flex-start;justify-content:center;margin-right:24px;", " ", "{margin-bottom:8px;}"], (props) => props.hasBottomMargin && "margin-bottom:16px;", UnorderedList);
|
|
54
|
+
const AllContent = /* @__PURE__ */ styled.div.withConfig({
|
|
61
55
|
displayName: "Toaststyles__AllContent",
|
|
62
56
|
componentId: "sc-wwaizr-2"
|
|
63
57
|
})(["display:flex;color:inherit;"]);
|
|
64
|
-
|
|
58
|
+
const IconWrapper = /* @__PURE__ */ styled.div.withConfig({
|
|
65
59
|
displayName: "Toaststyles__IconWrapper",
|
|
66
60
|
componentId: "sc-wwaizr-3"
|
|
67
61
|
})(["margin:12px;display:flex;"]);
|
|
68
|
-
|
|
62
|
+
const IconCloseWrapper = /* @__PURE__ */ styled.div.withConfig({
|
|
69
63
|
displayName: "Toaststyles__IconCloseWrapper",
|
|
70
64
|
componentId: "sc-wwaizr-4"
|
|
71
65
|
})(["cursor:pointer;"]);
|
|
72
|
-
|
|
66
|
+
const IconExpanderWrapper = /* @__PURE__ */ styled.div.withConfig({
|
|
73
67
|
displayName: "Toaststyles__IconExpanderWrapper",
|
|
74
68
|
componentId: "sc-wwaizr-5"
|
|
75
|
-
})(["cursor:pointer;svg{transition:transform 0.1s linear;transform:rotateZ(", ");}"],
|
|
76
|
-
|
|
77
|
-
});
|
|
78
|
-
export var ButtonWrapper = styled.div.withConfig({
|
|
69
|
+
})(["cursor:pointer;svg{transition:transform 0.1s linear;transform:rotateZ(", ");}"], (props) => props.expanded ? "180deg" : "0deg");
|
|
70
|
+
const ButtonWrapper = /* @__PURE__ */ styled.div.withConfig({
|
|
79
71
|
displayName: "Toaststyles__ButtonWrapper",
|
|
80
72
|
componentId: "sc-wwaizr-6"
|
|
81
73
|
})(["position:absolute;right:12px;top:12px;display:flex;"]);
|
|
82
|
-
|
|
74
|
+
const FirstButtonWrapper = /* @__PURE__ */ styled.div.withConfig({
|
|
83
75
|
displayName: "Toaststyles__FirstButtonWrapper",
|
|
84
76
|
componentId: "sc-wwaizr-7"
|
|
85
77
|
})(["margin-right:8px;"]);
|
|
86
|
-
|
|
78
|
+
const NumberWrapper = /* @__PURE__ */ styled.div.withConfig({
|
|
87
79
|
displayName: "Toaststyles__NumberWrapper",
|
|
88
80
|
componentId: "sc-wwaizr-8"
|
|
89
|
-
})(["margin-left:4px;color:inherit;opacity:0.6;cursor:pointer;&:hover{background-image:linear-gradient( to right,", " 20%,rgba(255,255,255,0) 10% );background-color:transparent;background-position:bottom left;background-size:5px 1px;background-repeat:repeat-x;opacity:1;}"],
|
|
90
|
-
|
|
91
|
-
});
|
|
92
|
-
export var ListWrapper = styled.div.withConfig({
|
|
81
|
+
})(["margin-left:4px;color:inherit;opacity:0.6;cursor:pointer;&:hover{background-image:linear-gradient( to right,", " 20%,rgba(255,255,255,0) 10% );background-color:transparent;background-position:bottom left;background-size:5px 1px;background-repeat:repeat-x;opacity:1;}"], (props) => props.theme.palette["grey-400"]);
|
|
82
|
+
const ListWrapper = /* @__PURE__ */ styled.div.withConfig({
|
|
93
83
|
displayName: "Toaststyles__ListWrapper",
|
|
94
84
|
componentId: "sc-wwaizr-9"
|
|
95
|
-
})(["display:flex;visibility:", ";height:", ";margin-top:", ";"],
|
|
96
|
-
|
|
97
|
-
}, function (props) {
|
|
98
|
-
return props.visible ? 'auto' : '0';
|
|
99
|
-
}, function (props) {
|
|
100
|
-
return !props.description && props.visible ? '10px' : '0';
|
|
101
|
-
});
|
|
102
|
-
export var IconOrderWrapper = styled.div.withConfig({
|
|
85
|
+
})(["display:flex;visibility:", ";height:", ";margin-top:", ";"], (props) => props.visible ? "visible" : "hidden", (props) => props.visible ? "auto" : "0", (props) => !props.description && props.visible ? "10px" : "0");
|
|
86
|
+
const IconOrderWrapper = /* @__PURE__ */ styled.div.withConfig({
|
|
103
87
|
displayName: "Toaststyles__IconOrderWrapper",
|
|
104
88
|
componentId: "sc-wwaizr-10"
|
|
105
|
-
})(["visibility:hidden;margin:-4px 0;&:hover{svg{fill:", ";cursor:pointer;}}"],
|
|
106
|
-
|
|
107
|
-
});
|
|
108
|
-
export var OrderWrapper = styled.div.withConfig({
|
|
89
|
+
})(["visibility:hidden;margin:-4px 0;&:hover{svg{fill:", ";cursor:pointer;}}"], (props) => props.theme.palette["blue-600"]);
|
|
90
|
+
const OrderWrapper = /* @__PURE__ */ styled.div.withConfig({
|
|
109
91
|
displayName: "Toaststyles__OrderWrapper",
|
|
110
92
|
componentId: "sc-wwaizr-11"
|
|
111
93
|
})(["display:flex;&:hover{", "{visibility:visible;}", "{background-color:transparent;background-position:bottom left;background-size:5px 1px;background-repeat:repeat-x;opacity:1;}}"], IconOrderWrapper, NumberWrapper);
|
|
112
|
-
|
|
94
|
+
const Wrapper = /* @__PURE__ */ styled.div.withConfig({
|
|
113
95
|
displayName: "Toaststyles__Wrapper",
|
|
114
96
|
componentId: "sc-wwaizr-12"
|
|
115
|
-
})(["color:", ";"],
|
|
116
|
-
|
|
117
|
-
});
|
|
118
|
-
export var WrapperSectionMessage = styled.div.withConfig({
|
|
97
|
+
})(["color:", ";"], (props) => props.theme.palette["grey-600"]);
|
|
98
|
+
const WrapperSectionMessage = /* @__PURE__ */ styled.div.withConfig({
|
|
119
99
|
displayName: "Toaststyles__WrapperSectionMessage",
|
|
120
100
|
componentId: "sc-wwaizr-13"
|
|
121
101
|
})(["position:relative;font-size:13px;min-width:0;color:inherit;"]);
|
|
122
|
-
|
|
102
|
+
const AlertMessage = /* @__PURE__ */ styled.div.withConfig({
|
|
123
103
|
displayName: "Toaststyles__AlertMessage",
|
|
124
104
|
componentId: "sc-wwaizr-14"
|
|
125
|
-
})(["font-size:14px;line-height:20px;padding-top:14px;", ";font-weight:500;overflow:hidden;overflow-wrap:break-word;text-overflow:ellipsis;padding-right:", ";"],
|
|
126
|
-
|
|
127
|
-
}, function (props) {
|
|
128
|
-
return getWidth(props.hasClose, props.hasExpander);
|
|
129
|
-
});
|
|
130
|
-
export var AlertDescription = styled.div.withConfig({
|
|
105
|
+
})(["font-size:14px;line-height:20px;padding-top:14px;", ";font-weight:500;overflow:hidden;overflow-wrap:break-word;text-overflow:ellipsis;padding-right:", ";"], (props) => props.noToastContent && "padding-bottom: 14px;", (props) => getWidth(props.hasClose, props.hasExpander));
|
|
106
|
+
const AlertDescription = /* @__PURE__ */ styled.div.withConfig({
|
|
131
107
|
displayName: "Toaststyles__AlertDescription",
|
|
132
108
|
componentId: "sc-wwaizr-15"
|
|
133
|
-
})(["font-size:13px;line-height:1.39;font-weight:normal;overflow:hidden;overflow-wrap:anywhere;text-overflow:ellipsis;padding-bottom:", ";margin-top:2px;"],
|
|
134
|
-
|
|
135
|
-
});
|
|
136
|
-
export var Container = styled.div.withConfig({
|
|
109
|
+
})(["font-size:13px;line-height:1.39;font-weight:normal;overflow:hidden;overflow-wrap:anywhere;text-overflow:ellipsis;padding-bottom:", ";margin-top:2px;"], (props) => props.button || props.expandedContent ? "16px" : "0");
|
|
110
|
+
const Container = /* @__PURE__ */ styled.div.withConfig({
|
|
137
111
|
displayName: "Toaststyles__Container",
|
|
138
112
|
componentId: "sc-wwaizr-16"
|
|
139
|
-
})(["display:flex;flex-direction:row;max-width:500px;align-items:flex-start;justify-content:center;border-top:solid 2px ", ";background-color:", ";border-radius:4px;box-shadow:0 16px 32px 0 rgba(35,41,54,0.12);", ",", ",", "{svg{fill:", ";}}", ",", ",", ",", ":hover,", "{color:", ";}", ":hover{", "{background-image:linear-gradient( to right,", ";20%,rgba(255,255,255,0) 10% );color:", ";}}", "{svg{color:", ";fill:", ";}}"], getBackgroundColorForType,
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
113
|
+
})(["display:flex;flex-direction:row;max-width:500px;align-items:flex-start;justify-content:center;border-top:solid 2px ", ";background-color:", ";border-radius:4px;box-shadow:0 16px 32px 0 rgba(35,41,54,0.12);", ",", ",", "{svg{fill:", ";}}", ",", ",", ",", ":hover,", "{color:", ";}", ":hover{", "{background-image:linear-gradient( to right,", ";20%,rgba(255,255,255,0) 10% );color:", ";}}", "{svg{color:", ";fill:", ";}}"], getBackgroundColorForType, (props) => props.theme.palette.white, IconExpanderWrapper, IconOrderWrapper, IconCloseWrapper, (props) => props.theme.palette["grey-600"], OrderWrapper, AlertMessage, ListWrapper, NumberWrapper, AlertDescription, (props) => props.theme.palette["grey-600"], OrderWrapper, NumberWrapper, (props) => props.theme.palette["grey-600"], (props) => props.theme.palette["grey-600"], IconWrapper, getIconColorForType, getIconColorForType);
|
|
114
|
+
export {
|
|
115
|
+
AlertContent,
|
|
116
|
+
AlertDescription,
|
|
117
|
+
AlertMessage,
|
|
118
|
+
AllContent,
|
|
119
|
+
AnimationContainer,
|
|
120
|
+
ButtonWrapper,
|
|
121
|
+
Container,
|
|
122
|
+
FirstButtonWrapper,
|
|
123
|
+
IconCloseWrapper,
|
|
124
|
+
IconExpanderWrapper,
|
|
125
|
+
IconOrderWrapper,
|
|
126
|
+
IconWrapper,
|
|
127
|
+
ListWrapper,
|
|
128
|
+
NumberWrapper,
|
|
129
|
+
OrderWrapper,
|
|
130
|
+
Wrapper,
|
|
131
|
+
WrapperSectionMessage,
|
|
132
|
+
closingAnimation
|
|
133
|
+
};
|
package/dist/Toast.types.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import { ReactElement, ReactNode } from 'react';
|
|
2
|
+
import { ToastOptions } from 'react-hot-toast';
|
|
3
|
+
import { WithHTMLAttributes } from '@synerise/ds-utils';
|
|
4
4
|
export type ToastType = 'success' | 'warning' | 'negative' | 'informative';
|
|
5
5
|
export type ToastProps = WithHTMLAttributes<HTMLDivElement, {
|
|
6
6
|
type: ToastType;
|
package/dist/Toast.types.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
|
package/dist/constants.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { ToastType } from './Toast.types';
|
|
3
3
|
export declare const ICONS: Record<ToastType, ReactNode>;
|
package/dist/constants.js
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
success:
|
|
5
|
-
warning:
|
|
6
|
-
negative:
|
|
7
|
-
informative:
|
|
8
|
-
};
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { InfoFillM, WarningFillM, Check3M } from "@synerise/ds-icon";
|
|
3
|
+
const ICONS = {
|
|
4
|
+
success: /* @__PURE__ */ jsx(Check3M, {}),
|
|
5
|
+
warning: /* @__PURE__ */ jsx(WarningFillM, {}),
|
|
6
|
+
negative: /* @__PURE__ */ jsx(WarningFillM, {}),
|
|
7
|
+
informative: /* @__PURE__ */ jsx(InfoFillM, {})
|
|
8
|
+
};
|
|
9
|
+
export {
|
|
10
|
+
ICONS
|
|
11
|
+
};
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { Toast, Toast as Toast2, showToast } from "./Toast.js";
|
|
2
|
+
import { dismissToast } from "./utils/dismissToast.js";
|
|
3
|
+
import { removeToast } from "./utils/removeToast.js";
|
|
4
|
+
import { ICONS } from "./constants.js";
|
|
5
|
+
export {
|
|
6
|
+
ICONS,
|
|
7
|
+
Toast,
|
|
8
|
+
Toast2 as default,
|
|
9
|
+
dismissToast,
|
|
10
|
+
removeToast,
|
|
11
|
+
showToast
|
|
12
|
+
};
|
package/dist/utils/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@synerise/ds-toast",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.12",
|
|
4
4
|
"description": "Toast UI Component for the Synerise Design System",
|
|
5
5
|
"license": "ISC",
|
|
6
6
|
"repository": "Synerise/synerise-design",
|
|
@@ -16,10 +16,10 @@
|
|
|
16
16
|
"access": "public"
|
|
17
17
|
},
|
|
18
18
|
"scripts": {
|
|
19
|
-
"build": "
|
|
19
|
+
"build": "vite build",
|
|
20
20
|
"build:css": "node ../../../scripts/style/less.js",
|
|
21
21
|
"build:js": "babel --delete-dir-on-start --root-mode upward src --out-dir dist --extensions '.js,.ts,.tsx'",
|
|
22
|
-
"build:watch": "
|
|
22
|
+
"build:watch": "vite build --watch",
|
|
23
23
|
"defs": "tsc --declaration --outDir dist/ --emitDeclarationOnly",
|
|
24
24
|
"pack:ci": "pnpm pack --pack-destination ../../storybook/storybook-static/static",
|
|
25
25
|
"prepublish": "pnpm run build",
|
|
@@ -35,15 +35,16 @@
|
|
|
35
35
|
],
|
|
36
36
|
"types": "dist/index.d.ts",
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@synerise/ds-icon": "^1.15.
|
|
39
|
-
"@synerise/ds-unordered-list": "^1.1.
|
|
40
|
-
"@synerise/ds-utils": "^1.7.
|
|
38
|
+
"@synerise/ds-icon": "^1.15.1",
|
|
39
|
+
"@synerise/ds-unordered-list": "^1.1.40",
|
|
40
|
+
"@synerise/ds-utils": "^1.7.1",
|
|
41
41
|
"react-hot-toast": "^2.5.2",
|
|
42
42
|
"uuid": "^8.3.2"
|
|
43
43
|
},
|
|
44
44
|
"peerDependencies": {
|
|
45
45
|
"@synerise/ds-core": "*",
|
|
46
|
-
"react": ">=16.9.0 <= 18.3.1"
|
|
46
|
+
"react": ">=16.9.0 <= 18.3.1",
|
|
47
|
+
"styled-components": "^5.3.3"
|
|
47
48
|
},
|
|
48
|
-
"gitHead": "
|
|
49
|
+
"gitHead": "e4ecca8944fc9b41c1b9d59c8bcad5e5e2013225"
|
|
49
50
|
}
|