@synerise/ds-toast 1.4.9 → 1.4.11

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 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.11](https://github.com/Synerise/synerise-design/compare/@synerise/ds-toast@1.4.10...@synerise/ds-toast@1.4.11) (2026-03-20)
7
+
8
+ ### Bug Fixes
9
+
10
+ - **toast:** add animations to toast ([5167350](https://github.com/Synerise/synerise-design/commit/5167350a1f15ad06f8fa4cb20ca97e6aa1269b64))
11
+
12
+ ## [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)
13
+
14
+ **Note:** Version bump only for package @synerise/ds-toast
15
+
6
16
  ## [1.4.9](https://github.com/Synerise/synerise-design/compare/@synerise/ds-toast@1.4.8...@synerise/ds-toast@1.4.9) (2026-02-23)
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) | ReactNode | - |
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
- enders a Toast of specified `type`, using toastProps and then displays it using the Toaster with toastOptoins. returns a toastID that can be later used to remove / dismiss that toast manually.
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
1
  import React from 'react';
2
2
  import { type ShowToastProps, type ToastCustomisationOptions, type ToastProps, type 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,4 +1,4 @@
1
- var _excluded = ["type", "message", "description", "expander", "expandedContent", "withClose", "customIcon", "expanded", "onExpand", "onCloseClick", "onDismiss", "button", "toastId"];
1
+ var _excluded = ["type", "message", "description", "expander", "expandedContent", "withClose", "customIcon", "expanded", "onExpand", "onCloseClick", "onDismiss", "button", "toastId", "show"];
2
2
  function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
3
3
  function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
4
4
  import React, { useCallback, useEffect, useMemo } from 'react';
@@ -7,7 +7,6 @@ import { v4 as uuid } from 'uuid';
7
7
  import Icon, { AngleDownS, CloseM } from '@synerise/ds-icon';
8
8
  import * as S from './Toast.styles';
9
9
  import { ICONS } from './constants';
10
- import { removeToast } from './utils';
11
10
  export var Toast = function Toast(_ref) {
12
11
  var type = _ref.type,
13
12
  message = _ref.message,
@@ -22,6 +21,8 @@ export var Toast = function Toast(_ref) {
22
21
  onDismiss = _ref.onDismiss,
23
22
  button = _ref.button,
24
23
  toastId = _ref.toastId,
24
+ _ref$show = _ref.show,
25
+ show = _ref$show === void 0 ? true : _ref$show,
25
26
  htmlAttributes = _objectWithoutPropertiesLoose(_ref, _excluded);
26
27
  var hasToastContent = button || description || expandedContent;
27
28
  var toastContent = hasToastContent && /*#__PURE__*/React.createElement(S.AlertContent, {
@@ -42,7 +43,7 @@ export var Toast = function Toast(_ref) {
42
43
  var handleCloseClick = function handleCloseClick() {
43
44
  onCloseClick == null || onCloseClick();
44
45
  if (toastId) {
45
- removeToast(toastId);
46
+ toast.dismiss(toastId);
46
47
  }
47
48
  };
48
49
  useEffect(function () {
@@ -50,7 +51,9 @@ export var Toast = function Toast(_ref) {
50
51
  onDismiss == null || onDismiss();
51
52
  };
52
53
  }, []);
53
- return /*#__PURE__*/React.createElement(S.Container, _extends({
54
+ return /*#__PURE__*/React.createElement(S.AnimationContainer, {
55
+ $show: show
56
+ }, /*#__PURE__*/React.createElement(S.Container, _extends({
54
57
  toastType: type,
55
58
  "data-toastType": type
56
59
  }, htmlAttributes), /*#__PURE__*/React.createElement(S.IconWrapper, null, customIcon || /*#__PURE__*/React.createElement(Icon, {
@@ -69,14 +72,17 @@ export var Toast = function Toast(_ref) {
69
72
  onClick: handleCloseClick
70
73
  }, /*#__PURE__*/React.createElement(Icon, {
71
74
  component: /*#__PURE__*/React.createElement(CloseM, null)
72
- }))), toastContent));
75
+ }))), toastContent)));
73
76
  };
74
77
  export var showToast = function showToast(type, props, options) {
75
78
  var toastId = props.toastId || "toast-" + uuid();
76
- return toast.custom(/*#__PURE__*/React.createElement(Toast, _extends({}, props, {
77
- toastId: toastId,
78
- type: type
79
- })), _extends({}, options, {
79
+ return toast.custom(function (t) {
80
+ return /*#__PURE__*/React.createElement(Toast, _extends({}, props, {
81
+ toastId: toastId,
82
+ type: type,
83
+ show: t.visible
84
+ }));
85
+ }, _extends({}, options, {
80
86
  id: toastId
81
87
  }));
82
88
  };
@@ -2,6 +2,9 @@ import { type ReactNode } from 'react';
2
2
  import { type Keyframes } from 'styled-components';
3
3
  import { type ToastType } from './Toast.types';
4
4
  export declare const closingAnimation: () => Keyframes;
5
+ export declare const AnimationContainer: import("styled-components").StyledComponent<"div", any, {
6
+ $show?: boolean;
7
+ }, never>;
5
8
  export declare const AlertContent: import("styled-components").StyledComponent<"div", any, {
6
9
  hasBottomMargin?: boolean;
7
10
  }, never>;
@@ -21,9 +24,6 @@ export declare const ListWrapper: import("styled-components").StyledComponent<"d
21
24
  export declare const IconOrderWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
22
25
  export declare const OrderWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
23
26
  export declare const Wrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
24
- export declare const AnimationContainer: import("styled-components").StyledComponent<"div", any, {
25
- show?: boolean;
26
- }, never>;
27
27
  export declare const WrapperSectionMessage: import("styled-components").StyledComponent<"div", any, {}, never>;
28
28
  export declare const AlertMessage: import("styled-components").StyledComponent<"div", any, {
29
29
  noToastContent?: boolean;
@@ -40,52 +40,58 @@ var getWidth = function getWidth(hasClose, hasExpander) {
40
40
  return '24px';
41
41
  };
42
42
  var openingAnimation = function openingAnimation() {
43
- return keyframes(["0%{height:0%;opacity:0;}100%{height:100%;opacity:1;}"]);
43
+ return keyframes(["0%{opacity:0;transform:translateY(60px);}100%{opacity:1;transform:translateY(0);}"]);
44
44
  };
45
45
  export var closingAnimation = function closingAnimation() {
46
- return keyframes(["0%{height:100%;opacity:1;}100%{height:0%;opacity:0;}"]);
46
+ return keyframes(["0%{opacity:1;transform:translateY(0) scale(1);}100%{opacity:0;transform:translateY(-8px) scale(0.98);}"]);
47
47
  };
48
+ export var AnimationContainer = styled.div.withConfig({
49
+ displayName: "Toaststyles__AnimationContainer",
50
+ componentId: "sc-wwaizr-0"
51
+ })(["animation:", " 0.6s cubic-bezier(0.4,0,0.2,1) forwards;"], function (props) {
52
+ return props.$show ? openingAnimation() : closingAnimation();
53
+ });
48
54
  export var AlertContent = styled.div.withConfig({
49
55
  displayName: "Toaststyles__AlertContent",
50
- componentId: "sc-wwaizr-0"
56
+ componentId: "sc-wwaizr-1"
51
57
  })(["display:flex;flex-direction:column;align-items:flex-start;justify-content:center;margin-right:24px;", " ", "{margin-bottom:8px;}"], function (props) {
52
58
  return props.hasBottomMargin && 'margin-bottom:16px;';
53
59
  }, UnorderedList);
54
60
  export var AllContent = styled.div.withConfig({
55
61
  displayName: "Toaststyles__AllContent",
56
- componentId: "sc-wwaizr-1"
62
+ componentId: "sc-wwaizr-2"
57
63
  })(["display:flex;color:inherit;"]);
58
64
  export var IconWrapper = styled.div.withConfig({
59
65
  displayName: "Toaststyles__IconWrapper",
60
- componentId: "sc-wwaizr-2"
66
+ componentId: "sc-wwaizr-3"
61
67
  })(["margin:12px;display:flex;"]);
62
68
  export var IconCloseWrapper = styled.div.withConfig({
63
69
  displayName: "Toaststyles__IconCloseWrapper",
64
- componentId: "sc-wwaizr-3"
70
+ componentId: "sc-wwaizr-4"
65
71
  })(["cursor:pointer;"]);
66
72
  export var IconExpanderWrapper = styled.div.withConfig({
67
73
  displayName: "Toaststyles__IconExpanderWrapper",
68
- componentId: "sc-wwaizr-4"
74
+ componentId: "sc-wwaizr-5"
69
75
  })(["cursor:pointer;svg{transition:transform 0.1s linear;transform:rotateZ(", ");}"], function (props) {
70
76
  return props.expanded ? '180deg' : '0deg';
71
77
  });
72
78
  export var ButtonWrapper = styled.div.withConfig({
73
79
  displayName: "Toaststyles__ButtonWrapper",
74
- componentId: "sc-wwaizr-5"
80
+ componentId: "sc-wwaizr-6"
75
81
  })(["position:absolute;right:12px;top:12px;display:flex;"]);
76
82
  export var FirstButtonWrapper = styled.div.withConfig({
77
83
  displayName: "Toaststyles__FirstButtonWrapper",
78
- componentId: "sc-wwaizr-6"
84
+ componentId: "sc-wwaizr-7"
79
85
  })(["margin-right:8px;"]);
80
86
  export var NumberWrapper = styled.div.withConfig({
81
87
  displayName: "Toaststyles__NumberWrapper",
82
- componentId: "sc-wwaizr-7"
88
+ componentId: "sc-wwaizr-8"
83
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;}"], function (props) {
84
90
  return props.theme.palette['grey-400'];
85
91
  });
86
92
  export var ListWrapper = styled.div.withConfig({
87
93
  displayName: "Toaststyles__ListWrapper",
88
- componentId: "sc-wwaizr-8"
94
+ componentId: "sc-wwaizr-9"
89
95
  })(["display:flex;visibility:", ";height:", ";margin-top:", ";"], function (props) {
90
96
  return props.visible ? 'visible' : 'hidden';
91
97
  }, function (props) {
@@ -95,26 +101,20 @@ export var ListWrapper = styled.div.withConfig({
95
101
  });
96
102
  export var IconOrderWrapper = styled.div.withConfig({
97
103
  displayName: "Toaststyles__IconOrderWrapper",
98
- componentId: "sc-wwaizr-9"
104
+ componentId: "sc-wwaizr-10"
99
105
  })(["visibility:hidden;margin:-4px 0;&:hover{svg{fill:", ";cursor:pointer;}}"], function (props) {
100
106
  return props.theme.palette['blue-600'];
101
107
  });
102
108
  export var OrderWrapper = styled.div.withConfig({
103
109
  displayName: "Toaststyles__OrderWrapper",
104
- componentId: "sc-wwaizr-10"
110
+ componentId: "sc-wwaizr-11"
105
111
  })(["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
112
  export var Wrapper = styled.div.withConfig({
107
113
  displayName: "Toaststyles__Wrapper",
108
- componentId: "sc-wwaizr-11"
114
+ componentId: "sc-wwaizr-12"
109
115
  })(["color:", ";"], function (props) {
110
116
  return props.theme.palette['grey-600'];
111
117
  });
112
- export var AnimationContainer = styled.div.withConfig({
113
- displayName: "Toaststyles__AnimationContainer",
114
- componentId: "sc-wwaizr-12"
115
- })(["animation:", " 0.5s ease-in-out 0s 1;"], function (props) {
116
- return props.show ? openingAnimation() : closingAnimation();
117
- });
118
118
  export var WrapperSectionMessage = styled.div.withConfig({
119
119
  displayName: "Toaststyles__WrapperSectionMessage",
120
120
  componentId: "sc-wwaizr-13"
@@ -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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@synerise/ds-toast",
3
- "version": "1.4.9",
3
+ "version": "1.4.11",
4
4
  "description": "Toast UI Component for the Synerise Design System",
5
5
  "license": "ISC",
6
6
  "repository": "Synerise/synerise-design",
@@ -35,9 +35,9 @@
35
35
  ],
36
36
  "types": "dist/index.d.ts",
37
37
  "dependencies": {
38
- "@synerise/ds-icon": "^1.14.1",
39
- "@synerise/ds-unordered-list": "^1.1.37",
40
- "@synerise/ds-utils": "^1.6.0",
38
+ "@synerise/ds-icon": "^1.15.0",
39
+ "@synerise/ds-unordered-list": "^1.1.39",
40
+ "@synerise/ds-utils": "^1.7.0",
41
41
  "react-hot-toast": "^2.5.2",
42
42
  "uuid": "^8.3.2"
43
43
  },
@@ -45,5 +45,5 @@
45
45
  "@synerise/ds-core": "*",
46
46
  "react": ">=16.9.0 <= 18.3.1"
47
47
  },
48
- "gitHead": "2997f77d657c1aed2fc39901d3e0b8f88b05cc53"
48
+ "gitHead": "8efc031fa688c0b87c7b3915bae93546bb63bcac"
49
49
  }