@synerise/ds-toast 1.4.10 → 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 +10 -0
- package/README.md +2 -2
- package/dist/Toast.d.ts +3 -3
- package/dist/Toast.js +67 -79
- package/dist/Toast.styles.d.ts +22 -22
- package/dist/Toast.styles.js +92 -108
- package/dist/Toast.types.d.ts +5 -4
- 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,16 @@
|
|
|
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
|
+
|
|
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)
|
|
11
|
+
|
|
12
|
+
### Bug Fixes
|
|
13
|
+
|
|
14
|
+
- **toast:** add animations to toast ([5167350](https://github.com/Synerise/synerise-design/commit/5167350a1f15ad06f8fa4cb20ca97e6aa1269b64))
|
|
15
|
+
|
|
6
16
|
## [1.4.10](https://github.com/Synerise/synerise-design/compare/@synerise/ds-toast@1.4.9...@synerise/ds-toast@1.4.10) (2026-03-09)
|
|
7
17
|
|
|
8
18
|
**Note:** Version bump only for package @synerise/ds-toast
|
package/README.md
CHANGED
|
@@ -34,7 +34,7 @@ import Button from '@synerise/ds-button';
|
|
|
34
34
|
| type | message type | 'success' / 'negative' / 'warning' / 'informative' | - |
|
|
35
35
|
| message | message main content | ReactNode | - |
|
|
36
36
|
| description | message description | ReactNode | - |
|
|
37
|
-
| customIcon | overwrite default icon (default icon depends on type) |
|
|
37
|
+
| customIcon | overwrite default icon (default icon depends on type) | ReactElement | - |
|
|
38
38
|
| expander | render with expander icon | boolean | - |
|
|
39
39
|
| onExpand | triggered on click of expander icon | (expanded: boolean) => void | - |
|
|
40
40
|
| expandedContent | content rendered if exapanded prop is true | ReactNode | - |
|
|
@@ -74,4 +74,4 @@ Removes a specific or all displayed toasts with an exit animation.
|
|
|
74
74
|
|
|
75
75
|
#### showToast(type, toastProps, toastOptions?)
|
|
76
76
|
|
|
77
|
-
|
|
77
|
+
Renders a Toast of specified `type`, using toastProps and then displays it using the Toaster with toastOptions. Returns a toastId that can be later used to remove / dismiss that toast manually.
|
package/dist/Toast.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
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
|
-
({ type, message, description, expander, expandedContent, withClose, customIcon, expanded, onExpand, onCloseClick, onDismiss, button, toastId, ...htmlAttributes }: ToastProps): React.JSX.Element;
|
|
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;
|
|
6
6
|
error(props: ShowToastProps, options?: ToastCustomisationOptions): string;
|
|
7
7
|
info(props: ShowToastProps, options?: ToastCustomisationOptions): string;
|
package/dist/Toast.js
CHANGED
|
@@ -1,94 +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
|
-
}, description), expandedContent && /*#__PURE__*/React.createElement(S.ListWrapper, {
|
|
33
|
-
description: description,
|
|
34
|
-
visible: expanded
|
|
35
|
-
}, expandedContent), button);
|
|
36
|
-
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(() => {
|
|
37
32
|
return ICONS[type];
|
|
38
33
|
}, [type]);
|
|
39
|
-
|
|
34
|
+
const expandContent = useCallback(() => {
|
|
40
35
|
onExpand && onExpand(!expanded);
|
|
41
36
|
}, [onExpand, expanded]);
|
|
42
|
-
|
|
43
|
-
onCloseClick
|
|
37
|
+
const handleCloseClick = () => {
|
|
38
|
+
onCloseClick?.();
|
|
44
39
|
if (toastId) {
|
|
45
|
-
|
|
40
|
+
toast.dismiss(toastId);
|
|
46
41
|
}
|
|
47
42
|
};
|
|
48
|
-
useEffect(
|
|
49
|
-
return
|
|
50
|
-
onDismiss
|
|
43
|
+
useEffect(() => {
|
|
44
|
+
return () => {
|
|
45
|
+
onDismiss?.();
|
|
51
46
|
};
|
|
52
47
|
}, []);
|
|
53
|
-
return
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
expanded: expanded
|
|
65
|
-
}, /*#__PURE__*/React.createElement(Icon, {
|
|
66
|
-
component: /*#__PURE__*/React.createElement(AngleDownS, null),
|
|
67
|
-
size: 24
|
|
68
|
-
})), withClose && /*#__PURE__*/React.createElement(S.IconCloseWrapper, {
|
|
69
|
-
onClick: handleCloseClick
|
|
70
|
-
}, /*#__PURE__*/React.createElement(Icon, {
|
|
71
|
-
component: /*#__PURE__*/React.createElement(CloseM, null)
|
|
72
|
-
}))), 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
|
+
] }) });
|
|
73
59
|
};
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
return toast.custom(
|
|
77
|
-
|
|
78
|
-
type: type
|
|
79
|
-
})), _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,
|
|
80
64
|
id: toastId
|
|
81
|
-
})
|
|
65
|
+
});
|
|
82
66
|
};
|
|
83
|
-
Toast.success =
|
|
84
|
-
return showToast(
|
|
67
|
+
Toast.success = (props, options) => {
|
|
68
|
+
return showToast("success", props, options);
|
|
85
69
|
};
|
|
86
|
-
Toast.error =
|
|
87
|
-
return showToast(
|
|
70
|
+
Toast.error = (props, options) => {
|
|
71
|
+
return showToast("negative", props, options);
|
|
88
72
|
};
|
|
89
|
-
Toast.info =
|
|
90
|
-
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
|
|
91
82
|
};
|
|
92
|
-
Toast.warning = function (props, options) {
|
|
93
|
-
return showToast('warning', props, options);
|
|
94
|
-
};
|
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
|
|
5
|
+
export declare const AnimationContainer: import('styled-components').StyledComponent<"div", any, {
|
|
6
|
+
$show?: boolean;
|
|
7
|
+
}, never>;
|
|
8
|
+
export declare const AlertContent: import('styled-components').StyledComponent<"div", any, {
|
|
6
9
|
hasBottomMargin?: boolean;
|
|
7
10
|
}, never>;
|
|
8
|
-
export declare const AllContent: import(
|
|
9
|
-
export declare const IconWrapper: import(
|
|
10
|
-
export declare const IconCloseWrapper: import(
|
|
11
|
-
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, {
|
|
12
15
|
expanded?: boolean;
|
|
13
16
|
}, never>;
|
|
14
|
-
export declare const ButtonWrapper: import(
|
|
15
|
-
export declare const FirstButtonWrapper: import(
|
|
16
|
-
export declare const NumberWrapper: import(
|
|
17
|
-
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, {
|
|
18
21
|
visible?: boolean;
|
|
19
22
|
description?: ReactNode;
|
|
20
23
|
}, never>;
|
|
21
|
-
export declare const IconOrderWrapper: import(
|
|
22
|
-
export declare const OrderWrapper: import(
|
|
23
|
-
export declare const Wrapper: import(
|
|
24
|
-
export declare const
|
|
25
|
-
|
|
26
|
-
}, never>;
|
|
27
|
-
export declare const WrapperSectionMessage: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
28
|
-
export declare const AlertMessage: import("styled-components").StyledComponent<"div", any, {
|
|
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
|
-
|
|
46
|
-
return keyframes(["0%{height:100%;opacity:1;}100%{height:0%;opacity:0;}"]);
|
|
47
|
-
};
|
|
48
|
-
export var AlertContent = styled.div.withConfig({
|
|
49
|
-
displayName: "Toaststyles__AlertContent",
|
|
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({
|
|
47
|
+
displayName: "Toaststyles__AnimationContainer",
|
|
50
48
|
componentId: "sc-wwaizr-0"
|
|
51
|
-
})(["
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
export var AllContent = styled.div.withConfig({
|
|
55
|
-
displayName: "Toaststyles__AllContent",
|
|
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({
|
|
51
|
+
displayName: "Toaststyles__AlertContent",
|
|
56
52
|
componentId: "sc-wwaizr-1"
|
|
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({
|
|
55
|
+
displayName: "Toaststyles__AllContent",
|
|
56
|
+
componentId: "sc-wwaizr-2"
|
|
57
57
|
})(["display:flex;color:inherit;"]);
|
|
58
|
-
|
|
58
|
+
const IconWrapper = /* @__PURE__ */ styled.div.withConfig({
|
|
59
59
|
displayName: "Toaststyles__IconWrapper",
|
|
60
|
-
componentId: "sc-wwaizr-
|
|
60
|
+
componentId: "sc-wwaizr-3"
|
|
61
61
|
})(["margin:12px;display:flex;"]);
|
|
62
|
-
|
|
62
|
+
const IconCloseWrapper = /* @__PURE__ */ styled.div.withConfig({
|
|
63
63
|
displayName: "Toaststyles__IconCloseWrapper",
|
|
64
|
-
componentId: "sc-wwaizr-
|
|
64
|
+
componentId: "sc-wwaizr-4"
|
|
65
65
|
})(["cursor:pointer;"]);
|
|
66
|
-
|
|
66
|
+
const IconExpanderWrapper = /* @__PURE__ */ styled.div.withConfig({
|
|
67
67
|
displayName: "Toaststyles__IconExpanderWrapper",
|
|
68
|
-
componentId: "sc-wwaizr-4"
|
|
69
|
-
})(["cursor:pointer;svg{transition:transform 0.1s linear;transform:rotateZ(", ");}"], function (props) {
|
|
70
|
-
return props.expanded ? '180deg' : '0deg';
|
|
71
|
-
});
|
|
72
|
-
export var ButtonWrapper = styled.div.withConfig({
|
|
73
|
-
displayName: "Toaststyles__ButtonWrapper",
|
|
74
68
|
componentId: "sc-wwaizr-5"
|
|
69
|
+
})(["cursor:pointer;svg{transition:transform 0.1s linear;transform:rotateZ(", ");}"], (props) => props.expanded ? "180deg" : "0deg");
|
|
70
|
+
const ButtonWrapper = /* @__PURE__ */ styled.div.withConfig({
|
|
71
|
+
displayName: "Toaststyles__ButtonWrapper",
|
|
72
|
+
componentId: "sc-wwaizr-6"
|
|
75
73
|
})(["position:absolute;right:12px;top:12px;display:flex;"]);
|
|
76
|
-
|
|
74
|
+
const FirstButtonWrapper = /* @__PURE__ */ styled.div.withConfig({
|
|
77
75
|
displayName: "Toaststyles__FirstButtonWrapper",
|
|
78
|
-
componentId: "sc-wwaizr-
|
|
76
|
+
componentId: "sc-wwaizr-7"
|
|
79
77
|
})(["margin-right:8px;"]);
|
|
80
|
-
|
|
78
|
+
const NumberWrapper = /* @__PURE__ */ styled.div.withConfig({
|
|
81
79
|
displayName: "Toaststyles__NumberWrapper",
|
|
82
|
-
componentId: "sc-wwaizr-7"
|
|
83
|
-
})(["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;}"], function (props) {
|
|
84
|
-
return props.theme.palette['grey-400'];
|
|
85
|
-
});
|
|
86
|
-
export var ListWrapper = styled.div.withConfig({
|
|
87
|
-
displayName: "Toaststyles__ListWrapper",
|
|
88
80
|
componentId: "sc-wwaizr-8"
|
|
89
|
-
})(["
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
return props.visible ? 'auto' : '0';
|
|
93
|
-
}, function (props) {
|
|
94
|
-
return !props.description && props.visible ? '10px' : '0';
|
|
95
|
-
});
|
|
96
|
-
export var IconOrderWrapper = styled.div.withConfig({
|
|
97
|
-
displayName: "Toaststyles__IconOrderWrapper",
|
|
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({
|
|
83
|
+
displayName: "Toaststyles__ListWrapper",
|
|
98
84
|
componentId: "sc-wwaizr-9"
|
|
99
|
-
})(["visibility:
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
export var OrderWrapper = styled.div.withConfig({
|
|
103
|
-
displayName: "Toaststyles__OrderWrapper",
|
|
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({
|
|
87
|
+
displayName: "Toaststyles__IconOrderWrapper",
|
|
104
88
|
componentId: "sc-wwaizr-10"
|
|
89
|
+
})(["visibility:hidden;margin:-4px 0;&:hover{svg{fill:", ";cursor:pointer;}}"], (props) => props.theme.palette["blue-600"]);
|
|
90
|
+
const OrderWrapper = /* @__PURE__ */ styled.div.withConfig({
|
|
91
|
+
displayName: "Toaststyles__OrderWrapper",
|
|
92
|
+
componentId: "sc-wwaizr-11"
|
|
105
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);
|
|
106
|
-
|
|
94
|
+
const Wrapper = /* @__PURE__ */ styled.div.withConfig({
|
|
107
95
|
displayName: "Toaststyles__Wrapper",
|
|
108
|
-
componentId: "sc-wwaizr-11"
|
|
109
|
-
})(["color:", ";"], function (props) {
|
|
110
|
-
return props.theme.palette['grey-600'];
|
|
111
|
-
});
|
|
112
|
-
export var AnimationContainer = styled.div.withConfig({
|
|
113
|
-
displayName: "Toaststyles__AnimationContainer",
|
|
114
96
|
componentId: "sc-wwaizr-12"
|
|
115
|
-
})(["
|
|
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;
|
|
@@ -12,6 +12,7 @@ export type ToastProps = WithHTMLAttributes<HTMLDivElement, {
|
|
|
12
12
|
withClose?: boolean;
|
|
13
13
|
button?: ReactNode;
|
|
14
14
|
expanded?: boolean;
|
|
15
|
+
show?: boolean;
|
|
15
16
|
onExpand?: (isExpanded: boolean) => void;
|
|
16
17
|
/**
|
|
17
18
|
* fired when user manually dismisses the toast by clicking the X button
|
|
@@ -24,4 +25,4 @@ export type ToastProps = WithHTMLAttributes<HTMLDivElement, {
|
|
|
24
25
|
toastId?: string;
|
|
25
26
|
}>;
|
|
26
27
|
export type ToastCustomisationOptions = Pick<ToastOptions, 'duration' | 'position' | 'id' | 'removeDelay' | 'className' | 'style'>;
|
|
27
|
-
export type ShowToastProps = Omit<ToastProps, 'type'>;
|
|
28
|
+
export type ShowToastProps = Omit<ToastProps, 'type' | 'show'>;
|
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.
|
|
39
|
-
"@synerise/ds-unordered-list": "^1.1.
|
|
40
|
-
"@synerise/ds-utils": "^1.
|
|
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
|
}
|