@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 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) | 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
- import React from 'react';
2
- import { type ShowToastProps, type ToastCustomisationOptions, type ToastProps, type ToastType } from './Toast.types';
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
- var _excluded = ["type", "message", "description", "expander", "expandedContent", "withClose", "customIcon", "expanded", "onExpand", "onCloseClick", "onDismiss", "button", "toastId"];
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
- 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
- import React, { useCallback, useEffect, useMemo } from 'react';
5
- import toast from 'react-hot-toast';
6
- import { v4 as uuid } from 'uuid';
7
- import Icon, { AngleDownS, CloseM } from '@synerise/ds-icon';
8
- import * as S from './Toast.styles';
9
- import { ICONS } from './constants';
10
- import { removeToast } from './utils';
11
- export var Toast = function Toast(_ref) {
12
- var type = _ref.type,
13
- message = _ref.message,
14
- description = _ref.description,
15
- expander = _ref.expander,
16
- expandedContent = _ref.expandedContent,
17
- withClose = _ref.withClose,
18
- customIcon = _ref.customIcon,
19
- expanded = _ref.expanded,
20
- onExpand = _ref.onExpand,
21
- onCloseClick = _ref.onCloseClick,
22
- onDismiss = _ref.onDismiss,
23
- button = _ref.button,
24
- toastId = _ref.toastId,
25
- htmlAttributes = _objectWithoutPropertiesLoose(_ref, _excluded);
26
- var hasToastContent = button || description || expandedContent;
27
- var toastContent = hasToastContent && /*#__PURE__*/React.createElement(S.AlertContent, {
28
- hasBottomMargin: Boolean(button || description || expandedContent && expanded)
29
- }, description && /*#__PURE__*/React.createElement(S.AlertDescription, {
30
- expandedContent: !!expandedContent,
31
- button: !!button
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
- var expandContent = useCallback(function () {
34
+ const expandContent = useCallback(() => {
40
35
  onExpand && onExpand(!expanded);
41
36
  }, [onExpand, expanded]);
42
- var handleCloseClick = function handleCloseClick() {
43
- onCloseClick == null || onCloseClick();
37
+ const handleCloseClick = () => {
38
+ onCloseClick?.();
44
39
  if (toastId) {
45
- removeToast(toastId);
40
+ toast.dismiss(toastId);
46
41
  }
47
42
  };
48
- useEffect(function () {
49
- return function () {
50
- onDismiss == null || onDismiss();
43
+ useEffect(() => {
44
+ return () => {
45
+ onDismiss?.();
51
46
  };
52
47
  }, []);
53
- return /*#__PURE__*/React.createElement(S.Container, _extends({
54
- toastType: type,
55
- "data-toastType": type
56
- }, htmlAttributes), /*#__PURE__*/React.createElement(S.IconWrapper, null, customIcon || /*#__PURE__*/React.createElement(Icon, {
57
- component: iconComponentForType
58
- })), /*#__PURE__*/React.createElement(S.WrapperSectionMessage, null, /*#__PURE__*/React.createElement(S.AlertMessage, {
59
- noToastContent: !hasToastContent,
60
- hasClose: !!withClose,
61
- hasExpander: !!expander
62
- }, message), /*#__PURE__*/React.createElement(S.ButtonWrapper, null, expander && /*#__PURE__*/React.createElement(S.IconExpanderWrapper, {
63
- onClick: expandContent,
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
- export var showToast = function showToast(type, props, options) {
75
- 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, {
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 = function (props, options) {
84
- return showToast('success', props, options);
67
+ Toast.success = (props, options) => {
68
+ return showToast("success", props, options);
85
69
  };
86
- Toast.error = function (props, options) {
87
- return showToast('negative', props, options);
70
+ Toast.error = (props, options) => {
71
+ return showToast("negative", props, options);
88
72
  };
89
- Toast.info = function (props, options) {
90
- return showToast('informative', props, options);
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
- };
@@ -1,39 +1,39 @@
1
- import { type ReactNode } from 'react';
2
- import { type Keyframes } from 'styled-components';
3
- import { type ToastType } from './Toast.types';
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 AlertContent: import("styled-components").StyledComponent<"div", any, {
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("styled-components").StyledComponent<"div", any, {}, never>;
9
- export declare const IconWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
10
- export declare const IconCloseWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
11
- export declare const IconExpanderWrapper: import("styled-components").StyledComponent<"div", any, {
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("styled-components").StyledComponent<"div", any, {}, never>;
15
- export declare const FirstButtonWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
16
- export declare const NumberWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
17
- export declare const ListWrapper: import("styled-components").StyledComponent<"div", any, {
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("styled-components").StyledComponent<"div", any, {}, never>;
22
- export declare const OrderWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
23
- 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
- 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("styled-components").StyledComponent<"div", any, {
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("styled-components").StyledComponent<"div", any, {
37
+ export declare const Container: import('styled-components').StyledComponent<"div", any, {
38
38
  toastType: ToastType;
39
39
  }, never>;
@@ -1,149 +1,133 @@
1
- import styled, { keyframes } from 'styled-components';
2
- import { UnorderedList } from '@synerise/ds-unordered-list/dist/Unordered-list.styles';
3
- var getIconColorForType = function getIconColorForType(_ref) {
4
- var toastType = _ref.toastType,
5
- theme = _ref.theme;
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 'informative':
8
- return theme.palette['grey-600'];
9
- case 'negative':
10
- return theme.palette['red-500'];
11
- case 'warning':
12
- return theme.palette['yellow-600'];
13
- case 'success':
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['green-600'];
16
+ return theme.palette["green-600"];
16
17
  }
17
18
  };
18
- var getBackgroundColorForType = function getBackgroundColorForType(_ref2) {
19
- var toastType = _ref2.toastType,
20
- theme = _ref2.theme;
19
+ const getBackgroundColorForType = ({
20
+ toastType,
21
+ theme
22
+ }) => {
21
23
  switch (toastType) {
22
- case 'informative':
23
- return theme.palette['grey-600'];
24
- case 'negative':
25
- return theme.palette['red-500'];
26
- case 'warning':
27
- return theme.palette['yellow-600'];
28
- case 'success':
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['green-600'];
32
+ return theme.palette["green-600"];
31
33
  }
32
34
  };
33
- var getWidth = function getWidth(hasClose, hasExpander) {
35
+ const getWidth = (hasClose, hasExpander) => {
34
36
  if (hasClose && hasExpander) {
35
- return '72px';
37
+ return "72px";
36
38
  }
37
39
  if (hasClose || hasExpander) {
38
- return '48px';
40
+ return "48px";
39
41
  }
40
- return '24px';
42
+ return "24px";
41
43
  };
42
- var openingAnimation = function openingAnimation() {
43
- return keyframes(["0%{height:0%;opacity:0;}100%{height:100%;opacity:1;}"]);
44
- };
45
- export var closingAnimation = function closingAnimation() {
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
- })(["display:flex;flex-direction:column;align-items:flex-start;justify-content:center;margin-right:24px;", " ", "{margin-bottom:8px;}"], function (props) {
52
- return props.hasBottomMargin && 'margin-bottom:16px;';
53
- }, UnorderedList);
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
- export var IconWrapper = styled.div.withConfig({
58
+ const IconWrapper = /* @__PURE__ */ styled.div.withConfig({
59
59
  displayName: "Toaststyles__IconWrapper",
60
- componentId: "sc-wwaizr-2"
60
+ componentId: "sc-wwaizr-3"
61
61
  })(["margin:12px;display:flex;"]);
62
- export var IconCloseWrapper = styled.div.withConfig({
62
+ const IconCloseWrapper = /* @__PURE__ */ styled.div.withConfig({
63
63
  displayName: "Toaststyles__IconCloseWrapper",
64
- componentId: "sc-wwaizr-3"
64
+ componentId: "sc-wwaizr-4"
65
65
  })(["cursor:pointer;"]);
66
- export var IconExpanderWrapper = styled.div.withConfig({
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
- export var FirstButtonWrapper = styled.div.withConfig({
74
+ const FirstButtonWrapper = /* @__PURE__ */ styled.div.withConfig({
77
75
  displayName: "Toaststyles__FirstButtonWrapper",
78
- componentId: "sc-wwaizr-6"
76
+ componentId: "sc-wwaizr-7"
79
77
  })(["margin-right:8px;"]);
80
- export var NumberWrapper = styled.div.withConfig({
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
- })(["display:flex;visibility:", ";height:", ";margin-top:", ";"], function (props) {
90
- return props.visible ? 'visible' : 'hidden';
91
- }, function (props) {
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:hidden;margin:-4px 0;&:hover{svg{fill:", ";cursor:pointer;}}"], function (props) {
100
- return props.theme.palette['blue-600'];
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
- export var Wrapper = styled.div.withConfig({
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
- })(["animation:", " 0.5s ease-in-out 0s 1;"], function (props) {
116
- return props.show ? openingAnimation() : closingAnimation();
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
- export var AlertMessage = styled.div.withConfig({
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:", ";"], function (props) {
126
- return props.noToastContent && 'padding-bottom: 14px;';
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;"], function (props) {
134
- return props.button || props.expandedContent ? '16px' : '0';
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, function (props) {
140
- return props.theme.palette.white;
141
- }, IconExpanderWrapper, IconOrderWrapper, IconCloseWrapper, function (props) {
142
- return props.theme.palette['grey-600'];
143
- }, OrderWrapper, AlertMessage, ListWrapper, NumberWrapper, AlertDescription, function (props) {
144
- return props.theme.palette['grey-600'];
145
- }, OrderWrapper, NumberWrapper, function (props) {
146
- return props.theme.palette['grey-600'];
147
- }, function (props) {
148
- return props.theme.palette['grey-600'];
149
- }, IconWrapper, getIconColorForType, getIconColorForType);
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
+ };
@@ -1,6 +1,6 @@
1
- import type { ReactElement, ReactNode } from 'react';
2
- import type { ToastOptions } from 'react-hot-toast';
3
- import type { WithHTMLAttributes } from '@synerise/ds-utils';
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'>;
@@ -1 +1 @@
1
- export {};
1
+
@@ -1,3 +1,3 @@
1
- import { type ReactNode } from 'react';
2
- import { type ToastType } from './Toast.types';
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 React from 'react';
2
- import { Check3M, InfoFillM, WarningFillM } from '@synerise/ds-icon';
3
- export var ICONS = {
4
- success: /*#__PURE__*/React.createElement(Check3M, null),
5
- warning: /*#__PURE__*/React.createElement(WarningFillM, null),
6
- negative: /*#__PURE__*/React.createElement(WarningFillM, null),
7
- informative: /*#__PURE__*/React.createElement(InfoFillM, null)
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
- export * from './Toast';
2
- export { Toast as default } from './Toast';
3
- export * from './utils';
4
- export * from './constants';
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
+ };
@@ -1,2 +1,5 @@
1
- import toast from 'react-hot-toast';
2
- export var dismissToast = toast.dismiss;
1
+ import toast from "react-hot-toast";
2
+ const dismissToast = toast.dismiss;
3
+ export {
4
+ dismissToast
5
+ };
@@ -1,2 +1,6 @@
1
- export * from './dismissToast';
2
- export * from './removeToast';
1
+ import { dismissToast } from "./dismissToast.js";
2
+ import { removeToast } from "./removeToast.js";
3
+ export {
4
+ dismissToast,
5
+ removeToast
6
+ };
@@ -1,2 +1,5 @@
1
- import toast from 'react-hot-toast';
2
- export var removeToast = toast.remove;
1
+ import toast from "react-hot-toast";
2
+ const removeToast = toast.remove;
3
+ export {
4
+ removeToast
5
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@synerise/ds-toast",
3
- "version": "1.4.10",
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": "pnpm run build:js && pnpm run build:css && pnpm run defs",
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": "pnpm run build:js -- --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.14.1",
39
- "@synerise/ds-unordered-list": "^1.1.38",
40
- "@synerise/ds-utils": "^1.6.0",
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": "8dfafc5d7278f09d430f1e7499782d05c76b47c0"
49
+ "gitHead": "e4ecca8944fc9b41c1b9d59c8bcad5e5e2013225"
49
50
  }