@mailstep/design-system 0.6.26 → 0.6.27
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/package.json +1 -3
- package/ui/Elements/Toast/Toast.d.ts +3 -4
- package/ui/Elements/Toast/Toast.js +14 -19
- package/ui/Elements/Toast/constants.d.ts +5 -0
- package/ui/Elements/Toast/constants.js +18 -0
- package/ui/Elements/Toast/styles.d.ts +8 -0
- package/ui/Elements/Toast/styles.js +22 -0
- package/ui/index.es.js +4727 -4657
- package/ui/index.umd.js +388 -346
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mailstep/design-system",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.27",
|
|
4
4
|
"license": "ISC",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./ui/index.js",
|
|
@@ -79,7 +79,6 @@
|
|
|
79
79
|
"react-router-dom": "^5.1.2",
|
|
80
80
|
"react-script": "^2.0.5",
|
|
81
81
|
"react-select": "^5.8.0",
|
|
82
|
-
"react-toastify": "^9.1.3",
|
|
83
82
|
"react-use-draggable-scroll": "^0.4.7",
|
|
84
83
|
"redux": ">=4.0.5",
|
|
85
84
|
"reselect": "5.0.0-alpha.2",
|
|
@@ -122,7 +121,6 @@
|
|
|
122
121
|
"react-router": "^5.1.2",
|
|
123
122
|
"react-router-dom": "^5.1.2",
|
|
124
123
|
"react-select": "^5.8.0",
|
|
125
|
-
"react-toastify": "^9.1.3",
|
|
126
124
|
"react-use-draggable-scroll": "^0.4.7",
|
|
127
125
|
"redux": ">=4.0.5",
|
|
128
126
|
"reselect": "5.0.0-alpha.2",
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import { ToastOptions } from 'react-toastify';
|
|
2
1
|
export type ToastType = 'info' | 'success' | 'error' | 'warning';
|
|
3
|
-
export type CustomToastProps =
|
|
2
|
+
export type CustomToastProps = {
|
|
4
3
|
closeToast?: () => void;
|
|
5
|
-
toastProps?: ToastOptions;
|
|
6
4
|
title?: string;
|
|
7
5
|
text?: string;
|
|
8
6
|
type: ToastType;
|
|
7
|
+
withProgressBar?: boolean;
|
|
9
8
|
};
|
|
10
|
-
declare const Toast: ({ closeToast, title, text, type }: CustomToastProps) => JSX.Element;
|
|
9
|
+
declare const Toast: ({ closeToast, title, text, type, withProgressBar }: CustomToastProps) => JSX.Element;
|
|
11
10
|
export default Toast;
|
|
@@ -1,24 +1,19 @@
|
|
|
1
|
-
var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
|
|
2
|
-
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
|
|
3
|
-
return cooked;
|
|
4
|
-
};
|
|
5
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
6
|
-
import
|
|
7
|
-
import { th } from '@xstyled/styled-components';
|
|
2
|
+
import { useEffect } from 'react';
|
|
8
3
|
import { Icon } from '../Icon';
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
error: 'Error',
|
|
13
|
-
warning: 'Warning',
|
|
14
|
-
};
|
|
15
|
-
var Title = styled.span(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n display: block;\n margin-bottom: 5px;\n line-height: 18px;\n font-weight: 700;\n color: ", ";\n"], ["\n display: block;\n margin-bottom: 5px;\n line-height: 18px;\n font-weight: 700;\n color: ", ";\n"])), th('colors.blue2'));
|
|
16
|
-
var Text = styled.span(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n display: block;\n font-size: 12px;\n line-height: 18px;\n font-weight: 500;\n color: ", ";\n"], ["\n display: block;\n font-size: 12px;\n line-height: 18px;\n font-weight: 500;\n color: ", ";\n"])), th('colors.gray1'));
|
|
17
|
-
var ContentWrapper = styled.div(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n display: flex;\n justify-content: space-between;\n"], ["\n display: flex;\n justify-content: space-between;\n"])));
|
|
18
|
-
var CloseWrapper = styled.span(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n display: flex;\n align-items: center;\n margin-left: 15px;\n\n svg {\n cursor: pointer;\n }\n"], ["\n display: flex;\n align-items: center;\n margin-left: 15px;\n\n svg {\n cursor: pointer;\n }\n"])));
|
|
4
|
+
import { Title, Text, ContentWrapper, CloseWrapper, Container } from './styles';
|
|
5
|
+
import { x } from '@xstyled/styled-components';
|
|
6
|
+
import { toastTitleMap, toastIconMap, toastIconFill } from './constants';
|
|
19
7
|
var Toast = function (_a) {
|
|
20
|
-
var closeToast = _a.closeToast, title = _a.title, text = _a.text, type = _a.type;
|
|
21
|
-
|
|
8
|
+
var closeToast = _a.closeToast, title = _a.title, text = _a.text, type = _a.type, _b = _a.withProgressBar, withProgressBar = _b === void 0 ? false : _b;
|
|
9
|
+
var icon = toastIconMap[type];
|
|
10
|
+
var fill = toastIconFill[type];
|
|
11
|
+
useEffect(function () {
|
|
12
|
+
if (!withProgressBar)
|
|
13
|
+
return;
|
|
14
|
+
var timer = setTimeout(function () { return closeToast === null || closeToast === void 0 ? void 0 : closeToast(); }, 5000);
|
|
15
|
+
return function () { return clearTimeout(timer); };
|
|
16
|
+
}, []);
|
|
17
|
+
return (_jsxs(Container, { withProgressBar: withProgressBar, fill: fill, children: [_jsx(x.div, { mx: "12px", children: _jsx(Icon, { icon: icon, fill: fill, size: "20px" }) }), _jsxs(ContentWrapper, { children: [_jsxs("div", { children: [_jsx(Title, { children: title || toastTitleMap[type] }), text && _jsx(Text, { children: text })] }), _jsx(CloseWrapper, { children: _jsx("div", { onClick: closeToast, children: _jsx(Icon, { icon: "close" }) }) })] })] }));
|
|
22
18
|
};
|
|
23
19
|
export default Toast;
|
|
24
|
-
var templateObject_1, templateObject_2, templateObject_3, templateObject_4;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ToastType } from './Toast';
|
|
3
|
+
export declare const toastIconMap: Record<ToastType, string>;
|
|
4
|
+
export declare const toastIconFill: Record<ToastType, string>;
|
|
5
|
+
export declare const toastTitleMap: Record<ToastType, React.ReactElement | string>;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export var toastIconMap = {
|
|
2
|
+
info: 'info',
|
|
3
|
+
success: 'circleCheck',
|
|
4
|
+
error: 'circleX',
|
|
5
|
+
warning: 'circleTriangle',
|
|
6
|
+
};
|
|
7
|
+
export var toastIconFill = {
|
|
8
|
+
info: 'blue2',
|
|
9
|
+
success: 'darkGreen',
|
|
10
|
+
error: 'red1',
|
|
11
|
+
warning: 'yellow1',
|
|
12
|
+
};
|
|
13
|
+
export var toastTitleMap = {
|
|
14
|
+
info: 'Info',
|
|
15
|
+
success: 'Success',
|
|
16
|
+
error: 'Error',
|
|
17
|
+
warning: 'Warning',
|
|
18
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare const Title: import("styled-components").StyledComponent<"span", import("@xstyled/system").Theme, {}, never>;
|
|
2
|
+
export declare const Text: import("styled-components").StyledComponent<"span", import("@xstyled/system").Theme, {}, never>;
|
|
3
|
+
export declare const ContentWrapper: import("styled-components").StyledComponent<"div", import("@xstyled/system").Theme, {}, never>;
|
|
4
|
+
export declare const CloseWrapper: import("styled-components").StyledComponent<"span", import("@xstyled/system").Theme, {}, never>;
|
|
5
|
+
export declare const Container: import("styled-components").StyledComponent<"div", import("@xstyled/system").Theme, {
|
|
6
|
+
withProgressBar: boolean;
|
|
7
|
+
fill: string;
|
|
8
|
+
}, never>;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
|
|
2
|
+
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
|
|
3
|
+
return cooked;
|
|
4
|
+
};
|
|
5
|
+
import styled, { css, keyframes, th } from '@xstyled/styled-components';
|
|
6
|
+
export var Title = styled.span(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n display: block;\n margin-bottom: 5px;\n line-height: 18px;\n font-weight: 700;\n color: ", ";\n"], ["\n display: block;\n margin-bottom: 5px;\n line-height: 18px;\n font-weight: 700;\n color: ", ";\n"])), th('colors.blue2'));
|
|
7
|
+
export var Text = styled.span(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n display: block;\n font-size: 12px;\n line-height: 18px;\n font-weight: 500;\n color: ", ";\n"], ["\n display: block;\n font-size: 12px;\n line-height: 18px;\n font-weight: 500;\n color: ", ";\n"])), th('colors.gray1'));
|
|
8
|
+
export var ContentWrapper = styled.div(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n display: flex;\n justify-content: space-between;\n"], ["\n display: flex;\n justify-content: space-between;\n"])));
|
|
9
|
+
export var CloseWrapper = styled.span(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n display: flex;\n align-items: center;\n margin-left: 15px;\n\n svg {\n cursor: pointer;\n }\n"], ["\n display: flex;\n align-items: center;\n margin-left: 15px;\n\n svg {\n cursor: pointer;\n }\n"])));
|
|
10
|
+
var timerAnimation = keyframes(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n to {\n transform: scaleX(0)\n }\n"], ["\n to {\n transform: scaleX(0)\n }\n"])));
|
|
11
|
+
var after = css(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n &:after {\n position: absolute;\n bottom: 0;\n left: 0;\n content: '';\n height: 4px;\n width: 100%;\n transform-origin: left center;\n animation: ", " 5s linear;\n border-radius: ", ";\n background-color: ", ";\n }\n"], ["\n &:after {\n position: absolute;\n bottom: 0;\n left: 0;\n content: '';\n height: 4px;\n width: 100%;\n transform-origin: left center;\n animation: ", " 5s linear;\n border-radius: ", ";\n background-color: ", ";\n }\n"])), timerAnimation, th.radius('lg'), th.color('lightGray5'));
|
|
12
|
+
export var Container = styled.div(templateObject_7 || (templateObject_7 = __makeTemplateObject(["\n display: flex;\n position: relative;\n background-color: white;\n border-radius: ", ";\n box-shadow: ", ";\n padding: 10px;\n\n @media ", " {\n font-size: 14px;\n }\n\n &:before {\n position: absolute;\n top: 5px;\n bottom: 5px;\n left: 5px;\n content: '';\n width: 4px;\n ", ";\n border-radius: ", ";\n background-color: ", ";\n }\n\n ", ";\n"], ["\n display: flex;\n position: relative;\n background-color: white;\n border-radius: ", ";\n box-shadow: ", ";\n padding: 10px;\n\n @media ", " {\n font-size: 14px;\n }\n\n &:before {\n position: absolute;\n top: 5px;\n bottom: 5px;\n left: 5px;\n content: '';\n width: 4px;\n ", ";\n border-radius: ", ";\n background-color: ", ";\n }\n\n ", ";\n"])), th.radius('lg'), th.shadow('cornerDialogShadow'), '(max-width: 576px)', function (_a) {
|
|
13
|
+
var withProgressBar = _a.withProgressBar;
|
|
14
|
+
return withProgressBar && 'bottom: 8px';
|
|
15
|
+
}, th.radius('lg'), function (_a) {
|
|
16
|
+
var fill = _a.fill;
|
|
17
|
+
return th.color(fill);
|
|
18
|
+
}, function (_a) {
|
|
19
|
+
var withProgressBar = _a.withProgressBar;
|
|
20
|
+
return withProgressBar && after;
|
|
21
|
+
});
|
|
22
|
+
var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6, templateObject_7;
|