@synerise/ds-toast 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md ADDED
@@ -0,0 +1,11 @@
1
+ # Change Log
2
+
3
+ All notable changes to this project will be documented in this file.
4
+ See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
+
6
+ # 1.1.0 (2025-05-07)
7
+
8
+
9
+ ### Features
10
+
11
+ * **toast:** toast component ([0cb20d0](https://github.com/Synerise/synerise-design/commit/0cb20d07b48d1c768a0ddf133b1970a4a13444ca))
package/LICENSE.md ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2019 Synerise
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,73 @@
1
+ ---
2
+ id: toast
3
+ title: Toast
4
+ ---
5
+
6
+ Toast UI Component
7
+
8
+ ## Installation
9
+
10
+ ```
11
+ npm i @synerise/ds-toast
12
+ or
13
+ yarn add @synerise/ds-toast
14
+ ```
15
+
16
+ ## Usage
17
+
18
+ ```
19
+ import Toast from '@synerise/ds-toast';
20
+ import Button from '@synerise/ds-button';
21
+
22
+ <Button onClick={() => Toast.success({message: 'Message title'})} />
23
+
24
+ ```
25
+
26
+ ## Demo
27
+
28
+ <iframe src="/storybook-static/iframe.html?id=components-toast--default"></iframe>
29
+
30
+ ## API
31
+
32
+ | Property | Description | Type | Default |
33
+ | --------------- | ----------------------------------------------------- | -------------------------------------------------- | ------- |
34
+ | type | message type | 'success' / 'negative' / 'warning' / 'informative' | - |
35
+ | message | message main content | ReactNode | - |
36
+ | description | message description | ReactNode | - |
37
+ | customIcon | overwrite default icon (default icon depends on type) | ReactNode | - |
38
+ | expander | render with expander icon | boolean | - |
39
+ | onExpand | triggered on click of expander icon | (expanded: boolean) => void | - |
40
+ | expandedContent | content rendered if exapanded prop is true | ReactNode | - |
41
+ | expanded | toggles rendering expanded content | boolean | - |
42
+ | withClose | renders X icon to manually dismiss toast | boolean | - |
43
+ | onCloseClick | triggered on click of close icon | () => void | - |
44
+ | button | button element to render below message content | ReactNode | - |
45
+
46
+ ## Static methods
47
+
48
+ To display a Toast using Toaster (it is rendered inside DSProvider by default) use any of the shortcut methods provided:
49
+
50
+ - Toast.success(props) - shows a Toast type 'success'
51
+ - Toast.error(props) - shows a Toast type 'negative'
52
+ - Toast.info(props) - shows a Toast type 'informative'
53
+ - Toast.warning(props) - shows a Toast type 'warning'
54
+
55
+ ```
56
+
57
+ import Toast from '@synerise/ds-toast';
58
+ import Button from '@synerise/ds-button';
59
+
60
+ <Button onClick={() => Toast.success({message: 'Message title'})} />
61
+
62
+ ```
63
+
64
+ ### Additional methods
65
+
66
+ #### removeToast(toastId?)
67
+ Removes a specific or all displayed toasts instantly
68
+
69
+ #### dismissToast(toastId?)
70
+ Removes a specific or all displayed toasts with an exit animation.
71
+
72
+ #### showToast(type, toastProps, toastOptions?)
73
+ 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.
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ import { ShowToastProps, ToastCustomisationOptions, ToastProps } from './Toast.types';
3
+ export declare const Toast: {
4
+ ({ type, message, description, expander, expandedContent, withClose, customIcon, expanded, onExpand, onCloseClick, button, ...htmlAttributes }: ToastProps): React.JSX.Element;
5
+ success(props: ShowToastProps, options?: ToastCustomisationOptions): string;
6
+ error(props: ShowToastProps, options?: ToastCustomisationOptions): string;
7
+ info(props: ShowToastProps, options?: ToastCustomisationOptions): string;
8
+ warning(props: ShowToastProps, options?: ToastCustomisationOptions): string;
9
+ };
package/dist/Toast.js ADDED
@@ -0,0 +1,69 @@
1
+ var _excluded = ["type", "message", "description", "expander", "expandedContent", "withClose", "customIcon", "expanded", "onExpand", "onCloseClick", "button"];
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, useMemo } from 'react';
5
+ import Icon, { CloseM, AngleDownS } from '@synerise/ds-icon';
6
+ import * as S from './Toast.styles';
7
+ import { showToast } from './utils/showToast';
8
+ import { ICONS } from './constants';
9
+ export var Toast = function Toast(_ref) {
10
+ var type = _ref.type,
11
+ message = _ref.message,
12
+ description = _ref.description,
13
+ expander = _ref.expander,
14
+ expandedContent = _ref.expandedContent,
15
+ withClose = _ref.withClose,
16
+ customIcon = _ref.customIcon,
17
+ expanded = _ref.expanded,
18
+ onExpand = _ref.onExpand,
19
+ onCloseClick = _ref.onCloseClick,
20
+ button = _ref.button,
21
+ htmlAttributes = _objectWithoutPropertiesLoose(_ref, _excluded);
22
+ var hasToastContent = button || description || expandedContent;
23
+ var toastContent = hasToastContent && /*#__PURE__*/React.createElement(S.AlertContent, {
24
+ hasBottomMargin: Boolean(button || description || expandedContent && expanded)
25
+ }, description && /*#__PURE__*/React.createElement(S.AlertDescription, {
26
+ expandedContent: !!expandedContent,
27
+ button: !!button
28
+ }, description), expandedContent && /*#__PURE__*/React.createElement(S.ListWrapper, {
29
+ description: description,
30
+ visible: expanded
31
+ }, expandedContent), button);
32
+ var iconComponentForType = useMemo(function () {
33
+ return ICONS[type];
34
+ }, [type]);
35
+ var expandContent = useCallback(function () {
36
+ onExpand && onExpand(!expanded);
37
+ }, [onExpand, expanded]);
38
+ return /*#__PURE__*/React.createElement(S.Container, _extends({
39
+ toastType: type
40
+ }, htmlAttributes), /*#__PURE__*/React.createElement(S.IconWrapper, null, customIcon || /*#__PURE__*/React.createElement(Icon, {
41
+ component: iconComponentForType
42
+ })), /*#__PURE__*/React.createElement(S.WrapperSectionMessage, null, /*#__PURE__*/React.createElement(S.AlertMessage, {
43
+ noToastContent: !hasToastContent,
44
+ hasClose: !!withClose,
45
+ hasExpander: !!expander
46
+ }, message), /*#__PURE__*/React.createElement(S.ButtonWrapper, null, expander && /*#__PURE__*/React.createElement(S.IconExpanderWrapper, {
47
+ onClick: expandContent,
48
+ expanded: expanded
49
+ }, /*#__PURE__*/React.createElement(Icon, {
50
+ component: /*#__PURE__*/React.createElement(AngleDownS, null),
51
+ size: 24
52
+ })), withClose && /*#__PURE__*/React.createElement(S.IconCloseWrapper, {
53
+ onClick: onCloseClick
54
+ }, /*#__PURE__*/React.createElement(Icon, {
55
+ component: /*#__PURE__*/React.createElement(CloseM, null)
56
+ }))), toastContent));
57
+ };
58
+ Toast.success = function (props, options) {
59
+ return showToast('success', props, options);
60
+ };
61
+ Toast.error = function (props, options) {
62
+ return showToast('negative', props, options);
63
+ };
64
+ Toast.info = function (props, options) {
65
+ return showToast('informative', props, options);
66
+ };
67
+ Toast.warning = function (props, options) {
68
+ return showToast('warning', props, options);
69
+ };
@@ -0,0 +1,39 @@
1
+ import { Keyframes } from 'styled-components';
2
+ import { ReactNode } from 'react';
3
+ import { ToastType } from './Toast.types';
4
+ export declare const closingAnimation: () => Keyframes;
5
+ export declare const AlertContent: import("styled-components").StyledComponent<"div", any, {
6
+ hasBottomMargin?: boolean | undefined;
7
+ }, 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, {
12
+ expanded?: boolean | undefined;
13
+ }, 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, {
18
+ visible?: boolean | undefined;
19
+ description?: ReactNode;
20
+ }, 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 | undefined;
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, {
29
+ noToastContent?: boolean | undefined;
30
+ hasClose?: boolean | undefined;
31
+ hasExpander?: boolean | undefined;
32
+ }, never>;
33
+ export declare const AlertDescription: import("styled-components").StyledComponent<"div", any, {
34
+ button?: boolean | undefined;
35
+ expandedContent?: boolean | undefined;
36
+ }, never>;
37
+ export declare const Container: import("styled-components").StyledComponent<"div", any, {
38
+ toastType: ToastType;
39
+ }, never>;
@@ -0,0 +1,153 @@
1
+ import styled, { keyframes } from 'styled-components';
2
+ import { hexToRgba } from '@synerise/ds-utils';
3
+ import { UnorderedList } from '@synerise/ds-unordered-list/dist/Unordered-list.styles';
4
+ var getDescriptionColorForType = function getDescriptionColorForType(_ref) {
5
+ var toastType = _ref.toastType,
6
+ theme = _ref.theme;
7
+ switch (toastType) {
8
+ case 'informative':
9
+ return theme.palette['grey-600'];
10
+ case 'negative':
11
+ case 'success':
12
+ case 'warning':
13
+ default:
14
+ return theme.palette.white;
15
+ }
16
+ };
17
+ var getIconColorForType = function getIconColorForType(_ref2) {
18
+ var toastType = _ref2.toastType,
19
+ theme = _ref2.theme;
20
+ switch (toastType) {
21
+ case 'informative':
22
+ return theme.palette['grey-600'];
23
+ case 'negative':
24
+ case 'success':
25
+ case 'warning':
26
+ default:
27
+ return theme.palette.white;
28
+ }
29
+ };
30
+ var getBackgroundColorForType = function getBackgroundColorForType(_ref3) {
31
+ var toastType = _ref3.toastType,
32
+ theme = _ref3.theme;
33
+ switch (toastType) {
34
+ case 'informative':
35
+ return theme.palette['grey-050'];
36
+ case 'negative':
37
+ return theme.palette['red-500'];
38
+ case 'warning':
39
+ return theme.palette['yellow-600'];
40
+ case 'success':
41
+ default:
42
+ return theme.palette['green-600'];
43
+ }
44
+ };
45
+ var getWidth = function getWidth(hasClose, hasExpander) {
46
+ if (hasClose && hasExpander) {
47
+ return '72px';
48
+ }
49
+ if (hasClose || hasExpander) {
50
+ return '48px';
51
+ }
52
+ return '24px';
53
+ };
54
+ var openingAnimation = function openingAnimation() {
55
+ return keyframes(["0%{height:0%;opacity:0;}100%{height:100%;opacity:1;}"]);
56
+ };
57
+ export var closingAnimation = function closingAnimation() {
58
+ return keyframes(["0%{height:100%;opacity:1;}100%{height:0%;opacity:0;}"]);
59
+ };
60
+ export var AlertContent = styled.div.withConfig({
61
+ displayName: "Toaststyles__AlertContent",
62
+ componentId: "sc-wwaizr-0"
63
+ })(["display:flex;flex-direction:column;align-items:flex-start;justify-content:center;margin-right:24px;", " ", "{margin-bottom:8px;}"], function (props) {
64
+ return props.hasBottomMargin && 'margin-bottom:16px;';
65
+ }, UnorderedList);
66
+ export var AllContent = styled.div.withConfig({
67
+ displayName: "Toaststyles__AllContent",
68
+ componentId: "sc-wwaizr-1"
69
+ })(["display:flex;color:inherit;"]);
70
+ export var IconWrapper = styled.div.withConfig({
71
+ displayName: "Toaststyles__IconWrapper",
72
+ componentId: "sc-wwaizr-2"
73
+ })(["margin:12px;display:flex;"]);
74
+ export var IconCloseWrapper = styled.div.withConfig({
75
+ displayName: "Toaststyles__IconCloseWrapper",
76
+ componentId: "sc-wwaizr-3"
77
+ })(["cursor:pointer;"]);
78
+ export var IconExpanderWrapper = styled.div.withConfig({
79
+ displayName: "Toaststyles__IconExpanderWrapper",
80
+ componentId: "sc-wwaizr-4"
81
+ })(["cursor:pointer;svg{transition:transform 0.1s linear;transform:rotateZ(", ");}"], function (props) {
82
+ return props.expanded ? '180deg' : '0deg';
83
+ });
84
+ export var ButtonWrapper = styled.div.withConfig({
85
+ displayName: "Toaststyles__ButtonWrapper",
86
+ componentId: "sc-wwaizr-5"
87
+ })(["position:absolute;right:12px;top:12px;display:flex;"]);
88
+ export var FirstButtonWrapper = styled.div.withConfig({
89
+ displayName: "Toaststyles__FirstButtonWrapper",
90
+ componentId: "sc-wwaizr-6"
91
+ })(["margin-right:8px;"]);
92
+ export var NumberWrapper = styled.div.withConfig({
93
+ displayName: "Toaststyles__NumberWrapper",
94
+ componentId: "sc-wwaizr-7"
95
+ })(["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) {
96
+ return props.theme.palette['grey-400'];
97
+ });
98
+ export var ListWrapper = styled.div.withConfig({
99
+ displayName: "Toaststyles__ListWrapper",
100
+ componentId: "sc-wwaizr-8"
101
+ })(["display:flex;visibility:", ";height:", ";margin-top:", ";"], function (props) {
102
+ return props.visible ? 'visible' : 'hidden';
103
+ }, function (props) {
104
+ return props.visible ? 'auto' : '0';
105
+ }, function (props) {
106
+ return !props.description && props.visible ? '10px' : '0';
107
+ });
108
+ export var IconOrderWrapper = styled.div.withConfig({
109
+ displayName: "Toaststyles__IconOrderWrapper",
110
+ componentId: "sc-wwaizr-9"
111
+ })(["visibility:hidden;margin:-4px 0;&:hover{svg{fill:", ";cursor:pointer;}}"], function (props) {
112
+ return props.theme.palette['blue-600'];
113
+ });
114
+ export var OrderWrapper = styled.div.withConfig({
115
+ displayName: "Toaststyles__OrderWrapper",
116
+ componentId: "sc-wwaizr-10"
117
+ })(["display:flex;&:hover{", "{visibility:visible;}", "{background-color:transparent;background-position:bottom left;background-size:5px 1px;background-repeat:repeat-x;opacity:1;}}"], IconOrderWrapper, NumberWrapper);
118
+ export var Wrapper = styled.div.withConfig({
119
+ displayName: "Toaststyles__Wrapper",
120
+ componentId: "sc-wwaizr-11"
121
+ })(["color:", ";"], function (props) {
122
+ return props.theme.palette['grey-050'];
123
+ });
124
+ export var AnimationContainer = styled.div.withConfig({
125
+ displayName: "Toaststyles__AnimationContainer",
126
+ componentId: "sc-wwaizr-12"
127
+ })(["animation:", " 0.5s ease-in-out 0s 1;"], function (props) {
128
+ return props.show ? openingAnimation() : closingAnimation();
129
+ });
130
+ export var WrapperSectionMessage = styled.div.withConfig({
131
+ displayName: "Toaststyles__WrapperSectionMessage",
132
+ componentId: "sc-wwaizr-13"
133
+ })(["position:relative;font-size:13px;min-width:0;color:inherit;"]);
134
+ export var AlertMessage = styled.div.withConfig({
135
+ displayName: "Toaststyles__AlertMessage",
136
+ componentId: "sc-wwaizr-14"
137
+ })(["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) {
138
+ return props.noToastContent && 'padding-bottom: 14px;';
139
+ }, function (props) {
140
+ return getWidth(props.hasClose, props.hasExpander);
141
+ });
142
+ export var AlertDescription = styled.div.withConfig({
143
+ displayName: "Toaststyles__AlertDescription",
144
+ componentId: "sc-wwaizr-15"
145
+ })(["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) {
146
+ return props.button || props.expandedContent ? '16px' : '0';
147
+ });
148
+ export var Container = styled.div.withConfig({
149
+ displayName: "Toaststyles__Container",
150
+ componentId: "sc-wwaizr-16"
151
+ })(["display:flex;flex-direction:row;max-width:500px;align-items:flex-start;justify-content:center;background-color:", ";border-radius:4px;box-shadow:", ";", ",", ",", "{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) {
152
+ return props.color ? "0px 16px 32px 5px " + hexToRgba(props.theme.palette['grey-900'], 0.2) : 'none';
153
+ }, IconExpanderWrapper, IconOrderWrapper, IconCloseWrapper, getDescriptionColorForType, OrderWrapper, AlertMessage, NumberWrapper, AlertDescription, getDescriptionColorForType, OrderWrapper, NumberWrapper, getDescriptionColorForType, getDescriptionColorForType, IconWrapper, getIconColorForType, getIconColorForType);
@@ -0,0 +1,19 @@
1
+ import type { ReactElement, ReactNode } from 'react';
2
+ import type { ToastOptions } from 'react-hot-toast';
3
+ import type { WithHTMLAttributes } from '@synerise/ds-utils';
4
+ export type ToastType = 'success' | 'warning' | 'negative' | 'informative';
5
+ export type ToastProps = WithHTMLAttributes<HTMLDivElement, {
6
+ type: ToastType;
7
+ message?: ReactNode;
8
+ description?: ReactNode;
9
+ customIcon?: ReactElement;
10
+ expander?: boolean;
11
+ expandedContent?: ReactNode;
12
+ withClose?: ReactNode;
13
+ button?: ReactNode;
14
+ expanded?: boolean;
15
+ onExpand?: (isExpanded: boolean) => void;
16
+ onCloseClick?: () => void;
17
+ }>;
18
+ export type ToastCustomisationOptions = Pick<ToastOptions, 'duration' | 'position' | 'id' | 'removeDelay' | 'className' | 'style'>;
19
+ export type ShowToastProps = Omit<ToastProps, 'type'>;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,3 @@
1
+ import { ReactNode } from 'react';
2
+ import { ToastType } from './Toast.types';
3
+ export declare const ICONS: Record<ToastType, ReactNode>;
@@ -0,0 +1,8 @@
1
+ import React from 'react';
2
+ import { WarningFillM, Check3M, InfoFillM } 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
+ };
@@ -0,0 +1,5 @@
1
+ export * from './Toast';
2
+ export { Toast as default } from './Toast';
3
+ export * from './utils';
4
+ export * from './constants';
5
+ export type { ToastProps } from './Toast.types';
package/dist/index.js ADDED
@@ -0,0 +1,4 @@
1
+ export * from './Toast';
2
+ export { Toast as default } from './Toast';
3
+ export * from './utils';
4
+ export * from './constants';
@@ -0,0 +1 @@
1
+ export declare const dismissToast: (toastId?: string | undefined) => void;
@@ -0,0 +1,2 @@
1
+ import toast from 'react-hot-toast';
2
+ export var dismissToast = toast.dismiss;
@@ -0,0 +1,3 @@
1
+ export * from './dismissToast';
2
+ export * from './removeToast';
3
+ export * from './showToast';
@@ -0,0 +1,3 @@
1
+ export * from './dismissToast';
2
+ export * from './removeToast';
3
+ export * from './showToast';
@@ -0,0 +1 @@
1
+ export declare const removeToast: (toastId?: string | undefined) => void;
@@ -0,0 +1,2 @@
1
+ import toast from 'react-hot-toast';
2
+ export var removeToast = toast.remove;
@@ -0,0 +1,2 @@
1
+ import { ShowToastProps, ToastCustomisationOptions, ToastType } from '../Toast.types';
2
+ export declare const showToast: (type: ToastType, props: ShowToastProps, options?: ToastCustomisationOptions) => string;
@@ -0,0 +1,9 @@
1
+ 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); }
2
+ import React from 'react';
3
+ import toast from 'react-hot-toast';
4
+ import { Toast } from '../Toast';
5
+ export var showToast = function showToast(type, props, options) {
6
+ return toast.custom(/*#__PURE__*/React.createElement(Toast, _extends({}, props, {
7
+ type: type
8
+ })), options);
9
+ };
package/package.json ADDED
@@ -0,0 +1,50 @@
1
+ {
2
+ "name": "@synerise/ds-toast",
3
+ "version": "1.1.0",
4
+ "description": "Toast UI Component for the Synerise Design System",
5
+ "license": "ISC",
6
+ "repository": "Synerise/synerise-design",
7
+ "main": "dist/index.js",
8
+ "files": [
9
+ "/dist",
10
+ "CHANGELOG.md",
11
+ "README.md",
12
+ "package.json",
13
+ "LICENSE.md"
14
+ ],
15
+ "publishConfig": {
16
+ "access": "public"
17
+ },
18
+ "scripts": {
19
+ "build": "npm run build:js && npm run build:css && npm run defs",
20
+ "build:css": "node ../../../scripts/style/less.js",
21
+ "build:js": "babel --delete-dir-on-start --root-mode upward src --out-dir dist --extensions '.js,.ts,.tsx'",
22
+ "build:watch": "npm run build:js -- --watch",
23
+ "defs": "tsc --declaration --outDir dist/ --emitDeclarationOnly",
24
+ "pack:ci": "npm pack --pack-destination ../../storybook/storybook-static/static",
25
+ "prepublish": "npm run build",
26
+ "test": "jest",
27
+ "test:watch": "npm run test -- --watchAll",
28
+ "types": "tsc --noEmit",
29
+ "upgrade:ds": "ncu -f \"@synerise/ds-*\" -u"
30
+ },
31
+ "sideEffects": [
32
+ "dist/style/*",
33
+ "*.less"
34
+ ],
35
+ "types": "dist/index.d.ts",
36
+ "dependencies": {
37
+ "@synerise/ds-icon": "^1.4.2",
38
+ "@synerise/ds-unordered-list": "^1.1.2",
39
+ "@synerise/ds-utils": "^1.1.0",
40
+ "react-hot-toast": "^2.5.2"
41
+ },
42
+ "peerDependencies": {
43
+ "@synerise/ds-core": "*",
44
+ "react": ">=16.9.0 <= 18.3.1"
45
+ },
46
+ "devDependencies": {
47
+ "@synerise/ds-toaster": "^1.1.0"
48
+ },
49
+ "gitHead": "90af7549cf0f556340bdd0deec4bb59bacf3e95e"
50
+ }