@elliemae/ds-toast 2.2.0-alpha.3 → 2.2.0-next.2
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/cjs/DSToast.js +97 -81
- package/cjs/ToastAction.js +60 -60
- package/cjs/ToastPosition.js +13 -41
- package/cjs/ToastRender.js +38 -62
- package/cjs/ToastType.js +13 -40
- package/cjs/index.js +24 -40
- package/cjs/toast.js +47 -46
- package/esm/DSToast.js +86 -53
- package/esm/ToastAction.js +47 -30
- package/esm/ToastPosition.js +8 -12
- package/esm/ToastRender.js +28 -29
- package/esm/ToastType.js +8 -11
- package/esm/index.js +5 -11
- package/esm/toast.js +37 -17
- package/package.json +5 -5
- package/cjs/DSToast.js.map +0 -7
- package/cjs/ToastAction.js.map +0 -7
- package/cjs/ToastPosition.js.map +0 -7
- package/cjs/ToastRender.js.map +0 -7
- package/cjs/ToastType.js.map +0 -7
- package/cjs/index.js.map +0 -7
- package/cjs/toast.js.map +0 -7
- package/esm/DSToast.js.map +0 -7
- package/esm/ToastAction.js.map +0 -7
- package/esm/ToastPosition.js.map +0 -7
- package/esm/ToastRender.js.map +0 -7
- package/esm/ToastType.js.map +0 -7
- package/esm/index.js.map +0 -7
- package/esm/toast.js.map +0 -7
package/cjs/toast.js
CHANGED
|
@@ -1,46 +1,47 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
var
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
var
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
})(
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
}), {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
require('core-js/modules/esnext.async-iterator.filter.js');
|
|
6
|
+
require('core-js/modules/esnext.iterator.constructor.js');
|
|
7
|
+
require('core-js/modules/esnext.iterator.filter.js');
|
|
8
|
+
require('core-js/modules/esnext.async-iterator.for-each.js');
|
|
9
|
+
require('core-js/modules/esnext.iterator.for-each.js');
|
|
10
|
+
var _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
11
|
+
var _jsx = require('@babel/runtime/helpers/jsx');
|
|
12
|
+
var _objectWithoutProperties = require('@babel/runtime/helpers/objectWithoutProperties');
|
|
13
|
+
require('react');
|
|
14
|
+
var reactToastify = require('react-toastify');
|
|
15
|
+
var ToastRender = require('./ToastRender.js');
|
|
16
|
+
|
|
17
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
18
|
+
|
|
19
|
+
var _defineProperty__default = /*#__PURE__*/_interopDefaultLegacy(_defineProperty);
|
|
20
|
+
var _jsx__default = /*#__PURE__*/_interopDefaultLegacy(_jsx);
|
|
21
|
+
var _objectWithoutProperties__default = /*#__PURE__*/_interopDefaultLegacy(_objectWithoutProperties);
|
|
22
|
+
|
|
23
|
+
const _excluded = ["type", "messageTitle", "messageText"];
|
|
24
|
+
|
|
25
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
26
|
+
|
|
27
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty__default["default"](target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
28
|
+
const toast = Object.assign((_ref, options) => {
|
|
29
|
+
let {
|
|
30
|
+
type,
|
|
31
|
+
messageTitle,
|
|
32
|
+
messageText
|
|
33
|
+
} = _ref,
|
|
34
|
+
rest = _objectWithoutProperties__default["default"](_ref, _excluded);
|
|
35
|
+
|
|
36
|
+
return reactToastify.toast( /*#__PURE__*/_jsx__default["default"](ToastRender, {
|
|
37
|
+
messageText: messageText,
|
|
38
|
+
messageTitle: messageTitle,
|
|
39
|
+
type: type
|
|
40
|
+
}), _objectSpread(_objectSpread(_objectSpread({}, rest), options), {}, {
|
|
41
|
+
type
|
|
42
|
+
}));
|
|
43
|
+
}, _objectSpread(_objectSpread({}, reactToastify.toast), {}, {
|
|
44
|
+
isActive: id => reactToastify.toast.isActive(id)
|
|
45
|
+
}));
|
|
46
|
+
|
|
47
|
+
exports.toast = toast;
|
package/esm/DSToast.js
CHANGED
|
@@ -1,57 +1,90 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
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
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
}
|
|
1
|
+
import 'core-js/modules/esnext.async-iterator.filter.js';
|
|
2
|
+
import 'core-js/modules/esnext.iterator.constructor.js';
|
|
3
|
+
import 'core-js/modules/esnext.iterator.filter.js';
|
|
4
|
+
import 'core-js/modules/esnext.async-iterator.for-each.js';
|
|
5
|
+
import 'core-js/modules/esnext.iterator.for-each.js';
|
|
6
|
+
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
7
|
+
import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
8
|
+
import 'react';
|
|
9
|
+
import { PropTypes, describe } from 'react-desc';
|
|
10
|
+
import { ToastContainer, Slide } from 'react-toastify';
|
|
11
|
+
import { CloseSmall } from '@elliemae/ds-icons';
|
|
12
|
+
import DSButton from '@elliemae/ds-button';
|
|
13
|
+
import { toastsPositions } from './ToastPosition.js';
|
|
14
|
+
import { jsx } from 'react/jsx-runtime';
|
|
15
|
+
|
|
16
|
+
var _CloseSmall, _CloseButton;
|
|
17
|
+
|
|
18
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
19
|
+
|
|
20
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
21
|
+
|
|
22
|
+
const CloseButton = _ref => {
|
|
23
|
+
let {
|
|
24
|
+
closeToast
|
|
25
|
+
} = _ref;
|
|
26
|
+
return /*#__PURE__*/_jsx(DSButton, {
|
|
27
|
+
buttonType: "text",
|
|
28
|
+
className: "toast-close-button",
|
|
29
|
+
icon: _CloseSmall || (_CloseSmall = /*#__PURE__*/_jsx(CloseSmall, {})),
|
|
30
|
+
onClick: closeToast,
|
|
31
|
+
size: "m"
|
|
32
|
+
});
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
const DSToast = _ref2 => {
|
|
36
|
+
let {
|
|
37
|
+
containerProps = {},
|
|
38
|
+
position = 'bottom-left',
|
|
39
|
+
autoClose = 5000,
|
|
40
|
+
// can be false or a number in milliseconds
|
|
41
|
+
showProgressBar = false,
|
|
42
|
+
closeOnClick = false,
|
|
43
|
+
enableMultiContainer = false,
|
|
44
|
+
containerId = undefined,
|
|
45
|
+
toastId = undefined
|
|
46
|
+
} = _ref2;
|
|
47
|
+
return /*#__PURE__*/jsx(ToastContainer, _objectSpread(_objectSpread({}, containerProps), {}, {
|
|
48
|
+
autoClose: autoClose,
|
|
49
|
+
className: showProgressBar && 'with-progressbar' || '',
|
|
50
|
+
closeButton: _CloseButton || (_CloseButton = /*#__PURE__*/_jsx(CloseButton, {})),
|
|
51
|
+
closeOnClick: closeOnClick,
|
|
52
|
+
containerId: containerId,
|
|
53
|
+
enableMultiContainer: enableMultiContainer,
|
|
54
|
+
hideProgressBar: !showProgressBar,
|
|
55
|
+
newestOnTop: true,
|
|
56
|
+
position: position,
|
|
57
|
+
toastId: toastId,
|
|
58
|
+
transition: Slide
|
|
59
|
+
}));
|
|
60
|
+
};
|
|
61
|
+
|
|
38
62
|
const props = {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
63
|
+
/** inject props to wrapper */
|
|
64
|
+
containerProps: PropTypes.object.description('inject props to wrapper'),
|
|
65
|
+
|
|
66
|
+
/** Position on the screen to show the toast */
|
|
67
|
+
position: PropTypes.oneOf(toastsPositions).description('Position on the screen to show the toast'),
|
|
68
|
+
|
|
69
|
+
/** ms to autoclose the toast */
|
|
70
|
+
autoClose: PropTypes.number.description('ms to autoclose the toast'),
|
|
71
|
+
|
|
72
|
+
/** Whether to show a progress bar indicating when the toast is going to be closed */
|
|
73
|
+
showProgressBar: PropTypes.bool.description('Whether to show a progress bar indicating when the toast is going to be closed'),
|
|
74
|
+
|
|
75
|
+
/** Close toast handler */
|
|
76
|
+
closeOnClick: PropTypes.bool.description('Close toast handler'),
|
|
77
|
+
|
|
78
|
+
/** Allows instantiating multiple Toast containers */
|
|
79
|
+
enableMultiContainer: PropTypes.bool.description('Allows instantiating multiple Toast containers'),
|
|
80
|
+
|
|
81
|
+
/** unique id for multi container */
|
|
82
|
+
containerId: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).description('unique id for multi container'),
|
|
83
|
+
|
|
84
|
+
/** id for the toast */
|
|
85
|
+
toastId: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).description('id for the toast')
|
|
47
86
|
};
|
|
48
|
-
DSToast.propTypes = props;
|
|
49
87
|
const DSToastWithSchema = describe(DSToast);
|
|
50
88
|
DSToastWithSchema.propTypes = props;
|
|
51
|
-
|
|
52
|
-
export {
|
|
53
|
-
DSToast,
|
|
54
|
-
DSToastWithSchema,
|
|
55
|
-
DSToast_default as default
|
|
56
|
-
};
|
|
57
|
-
//# sourceMappingURL=DSToast.js.map
|
|
89
|
+
|
|
90
|
+
export { DSToast, DSToastWithSchema, DSToast as default };
|
package/esm/ToastAction.js
CHANGED
|
@@ -1,38 +1,55 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import { PropTypes, describe } from
|
|
4
|
-
import styled from
|
|
5
|
-
import { color } from
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
1
|
+
import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
2
|
+
import 'react';
|
|
3
|
+
import { PropTypes, describe } from 'react-desc';
|
|
4
|
+
import styled from 'styled-components';
|
|
5
|
+
import { color } from '@elliemae/ds-system';
|
|
6
|
+
|
|
7
|
+
const Link = /*#__PURE__*/styled.span.withConfig({
|
|
8
|
+
componentId: "sc-1bs5g4c-0"
|
|
9
|
+
})(["", ""], color('brand', '600'));
|
|
10
|
+
|
|
11
|
+
const DSToastAction = _ref => {
|
|
12
|
+
let {
|
|
13
|
+
children,
|
|
14
|
+
onClick,
|
|
15
|
+
onKeyDown
|
|
16
|
+
} = _ref;
|
|
17
|
+
return (
|
|
18
|
+
/*#__PURE__*/
|
|
19
|
+
// eslint-disable-next-line jsx-a11y/no-static-element-interactions
|
|
20
|
+
_jsx("div", {
|
|
21
|
+
onKeyDown: onKeyDown,
|
|
22
|
+
onClick: onClick,
|
|
23
|
+
role: onClick ? 'button' : 'textbox'
|
|
24
|
+
}, void 0, children)
|
|
25
|
+
);
|
|
26
|
+
}; // eslint-disable-next-line jsx-a11y/anchor-is-valid
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
const DSToastActionLink = _ref2 => {
|
|
30
|
+
let {
|
|
31
|
+
children
|
|
32
|
+
} = _ref2;
|
|
33
|
+
return /*#__PURE__*/_jsx(Link, {}, void 0, children);
|
|
34
|
+
};
|
|
35
|
+
|
|
15
36
|
const actionprops = {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
onClick: PropTypes.func.description(
|
|
21
|
-
|
|
37
|
+
/** DSToastActionLink component or text string */
|
|
38
|
+
children: PropTypes.oneOfType([PropTypes.string, PropTypes.element]).description('DSToastActionLink component or text string'),
|
|
39
|
+
|
|
40
|
+
/** click handler */
|
|
41
|
+
onClick: PropTypes.func.description('click handler'),
|
|
42
|
+
|
|
43
|
+
/** key down handler */
|
|
44
|
+
onKeyDown: PropTypes.func.description('key down handler')
|
|
22
45
|
};
|
|
23
46
|
const linkprops = {
|
|
24
|
-
|
|
47
|
+
/** link text */
|
|
48
|
+
children: PropTypes.string.isRequired.description('link text')
|
|
25
49
|
};
|
|
26
|
-
DSToastAction.propTypes = actionprops;
|
|
27
|
-
DSToastActionLink.propTypes = linkprops;
|
|
28
50
|
const DSToastActionWithSchema = describe(DSToastAction);
|
|
29
51
|
const DSToastActionLinkWithSchema = describe(DSToastActionLink);
|
|
30
52
|
DSToastActionLinkWithSchema.propTypes = linkprops;
|
|
31
53
|
DSToastActionWithSchema.propTypes = actionprops;
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
DSToastActionLink,
|
|
35
|
-
DSToastActionLinkWithSchema,
|
|
36
|
-
DSToastActionWithSchema
|
|
37
|
-
};
|
|
38
|
-
//# sourceMappingURL=ToastAction.js.map
|
|
54
|
+
|
|
55
|
+
export { DSToastAction, DSToastActionLink, DSToastActionLinkWithSchema, DSToastActionWithSchema };
|
package/esm/ToastPosition.js
CHANGED
|
@@ -1,15 +1,11 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
1
|
const ToastPosition = {
|
|
3
|
-
TOP_RIGHT:
|
|
4
|
-
TOP_CENTER:
|
|
5
|
-
TOP_LEFT:
|
|
6
|
-
BOTTOM_RIGHT:
|
|
7
|
-
BOTTOM_CENTER:
|
|
8
|
-
BOTTOM_LEFT:
|
|
2
|
+
TOP_RIGHT: 'top-right',
|
|
3
|
+
TOP_CENTER: 'top-center',
|
|
4
|
+
TOP_LEFT: 'top-left',
|
|
5
|
+
BOTTOM_RIGHT: 'bottom-right',
|
|
6
|
+
BOTTOM_CENTER: 'bottom-center',
|
|
7
|
+
BOTTOM_LEFT: 'bottom-left'
|
|
9
8
|
};
|
|
10
9
|
const toastsPositions = Object.values(ToastPosition);
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
toastsPositions
|
|
14
|
-
};
|
|
15
|
-
//# sourceMappingURL=ToastPosition.js.map
|
|
10
|
+
|
|
11
|
+
export { ToastPosition, toastsPositions };
|
package/esm/ToastRender.js
CHANGED
|
@@ -1,37 +1,36 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
const blockName =
|
|
8
|
-
const Container = aggregatedClasses(
|
|
9
|
-
const IconContainer = aggregatedClasses(
|
|
10
|
-
const MessageContent = aggregatedClasses(
|
|
11
|
-
const MessageHeader = aggregatedClasses(
|
|
12
|
-
const MessageText = aggregatedClasses(
|
|
13
|
-
|
|
1
|
+
import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
2
|
+
import 'react';
|
|
3
|
+
import { aggregatedClasses } from '@elliemae/ds-classnames';
|
|
4
|
+
import { CheckmarkCircleFill, WarningCircleFill, InfoCircleFill } from '@elliemae/ds-icons';
|
|
5
|
+
import { ToastType } from './ToastType.js';
|
|
6
|
+
|
|
7
|
+
const blockName = 'toast-content';
|
|
8
|
+
const Container = aggregatedClasses('div')(blockName);
|
|
9
|
+
const IconContainer = aggregatedClasses('div')(blockName, 'icon-container');
|
|
10
|
+
const MessageContent = aggregatedClasses('div')(blockName, 'message-content');
|
|
11
|
+
const MessageHeader = aggregatedClasses('div')(blockName, 'message-header');
|
|
12
|
+
const MessageText = aggregatedClasses('span')(blockName, 'message-text');
|
|
13
|
+
|
|
14
|
+
const getIconByToastType = type => ({
|
|
14
15
|
[ToastType.SUCCESS]: CheckmarkCircleFill,
|
|
15
16
|
[ToastType.WARNING]: WarningCircleFill,
|
|
16
17
|
[ToastType.INFO]: InfoCircleFill,
|
|
17
18
|
[ToastType.ERROR]: WarningCircleFill,
|
|
18
|
-
[ToastType.DEFAULT]:
|
|
19
|
+
[ToastType.DEFAULT]: 'div'
|
|
19
20
|
})[type];
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
|
|
22
|
+
const ToastRender = _ref => {
|
|
23
|
+
let {
|
|
24
|
+
type = ToastType.DEFAULT,
|
|
25
|
+
messageTitle = '',
|
|
26
|
+
messageText = ''
|
|
27
|
+
} = _ref;
|
|
28
|
+
const IconMessage = aggregatedClasses(getIconByToastType(type))(blockName, 'icon-message');
|
|
29
|
+
return /*#__PURE__*/_jsx(Container, {
|
|
23
30
|
"data-testid": "ds-toast-render"
|
|
24
|
-
},
|
|
31
|
+
}, void 0, /*#__PURE__*/_jsx(IconContainer, {}, void 0, /*#__PURE__*/_jsx(IconMessage, {
|
|
25
32
|
size: "m"
|
|
26
|
-
})),
|
|
33
|
+
})), /*#__PURE__*/_jsx(MessageContent, {}, void 0, /*#__PURE__*/_jsx(MessageHeader, {}, void 0, messageTitle), /*#__PURE__*/_jsx(MessageText, {}, void 0, messageText)));
|
|
27
34
|
};
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
messageText: PropTypes.oneOfType([PropTypes.string, PropTypes.element]),
|
|
31
|
-
type: PropTypes.oneOf(toastTypes).isRequired
|
|
32
|
-
};
|
|
33
|
-
var ToastRender_default = ToastRender;
|
|
34
|
-
export {
|
|
35
|
-
ToastRender_default as default
|
|
36
|
-
};
|
|
37
|
-
//# sourceMappingURL=ToastRender.js.map
|
|
35
|
+
|
|
36
|
+
export { ToastRender as default };
|
package/esm/ToastType.js
CHANGED
|
@@ -1,14 +1,11 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
1
|
const ToastType = {
|
|
3
|
-
INFO:
|
|
4
|
-
SUCCESS:
|
|
5
|
-
WARNING:
|
|
6
|
-
ERROR:
|
|
7
|
-
|
|
2
|
+
INFO: 'info',
|
|
3
|
+
SUCCESS: 'success',
|
|
4
|
+
WARNING: 'warning',
|
|
5
|
+
ERROR: 'error',
|
|
6
|
+
// TODO remove from types, it's not in spec
|
|
7
|
+
DEFAULT: 'default'
|
|
8
8
|
};
|
|
9
9
|
const toastTypes = Object.values(ToastType);
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
toastTypes
|
|
13
|
-
};
|
|
14
|
-
//# sourceMappingURL=ToastType.js.map
|
|
10
|
+
|
|
11
|
+
export { ToastType, toastTypes };
|
package/esm/index.js
CHANGED
|
@@ -1,11 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
export
|
|
3
|
-
export
|
|
4
|
-
export
|
|
5
|
-
export
|
|
6
|
-
export * from "./ToastAction";
|
|
7
|
-
import { default as default2 } from "./DSToast";
|
|
8
|
-
export {
|
|
9
|
-
default2 as default
|
|
10
|
-
};
|
|
11
|
-
//# sourceMappingURL=index.js.map
|
|
1
|
+
export { DSToast, DSToastWithSchema, DSToast as default } from './DSToast.js';
|
|
2
|
+
export { toast } from './toast.js';
|
|
3
|
+
export { ToastType, toastTypes } from './ToastType.js';
|
|
4
|
+
export { ToastPosition, toastsPositions } from './ToastPosition.js';
|
|
5
|
+
export { DSToastAction, DSToastActionLink, DSToastActionLinkWithSchema, DSToastActionWithSchema } from './ToastAction.js';
|
package/esm/toast.js
CHANGED
|
@@ -1,17 +1,37 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
1
|
+
import 'core-js/modules/esnext.async-iterator.filter.js';
|
|
2
|
+
import 'core-js/modules/esnext.iterator.constructor.js';
|
|
3
|
+
import 'core-js/modules/esnext.iterator.filter.js';
|
|
4
|
+
import 'core-js/modules/esnext.async-iterator.for-each.js';
|
|
5
|
+
import 'core-js/modules/esnext.iterator.for-each.js';
|
|
6
|
+
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
7
|
+
import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
8
|
+
import _objectWithoutProperties from '@babel/runtime/helpers/esm/objectWithoutProperties';
|
|
9
|
+
import 'react';
|
|
10
|
+
import { toast as toast$1 } from 'react-toastify';
|
|
11
|
+
import ToastRender from './ToastRender.js';
|
|
12
|
+
|
|
13
|
+
const _excluded = ["type", "messageTitle", "messageText"];
|
|
14
|
+
|
|
15
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
16
|
+
|
|
17
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
18
|
+
const toast = Object.assign((_ref, options) => {
|
|
19
|
+
let {
|
|
20
|
+
type,
|
|
21
|
+
messageTitle,
|
|
22
|
+
messageText
|
|
23
|
+
} = _ref,
|
|
24
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
|
25
|
+
|
|
26
|
+
return toast$1( /*#__PURE__*/_jsx(ToastRender, {
|
|
27
|
+
messageText: messageText,
|
|
28
|
+
messageTitle: messageTitle,
|
|
29
|
+
type: type
|
|
30
|
+
}), _objectSpread(_objectSpread(_objectSpread({}, rest), options), {}, {
|
|
31
|
+
type
|
|
32
|
+
}));
|
|
33
|
+
}, _objectSpread(_objectSpread({}, toast$1), {}, {
|
|
34
|
+
isActive: id => toast$1.isActive(id)
|
|
35
|
+
}));
|
|
36
|
+
|
|
37
|
+
export { toast };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elliemae/ds-toast",
|
|
3
|
-
"version": "2.2.0-
|
|
3
|
+
"version": "2.2.0-next.2",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "ICE MT - Dimsum - Toast",
|
|
6
6
|
"module": "./esm/index.js",
|
|
@@ -56,10 +56,10 @@
|
|
|
56
56
|
"build": "node ../../scripts/build/build.js"
|
|
57
57
|
},
|
|
58
58
|
"dependencies": {
|
|
59
|
-
"@elliemae/ds-button": "2.2.0-
|
|
60
|
-
"@elliemae/ds-classnames": "2.2.0-
|
|
61
|
-
"@elliemae/ds-icons": "2.2.0-
|
|
62
|
-
"@elliemae/ds-system": "2.2.0-
|
|
59
|
+
"@elliemae/ds-button": "2.2.0-next.2",
|
|
60
|
+
"@elliemae/ds-classnames": "2.2.0-next.2",
|
|
61
|
+
"@elliemae/ds-icons": "2.2.0-next.2",
|
|
62
|
+
"@elliemae/ds-system": "2.2.0-next.2",
|
|
63
63
|
"prop-types": "~15.7.2",
|
|
64
64
|
"react-desc": "~4.1.3",
|
|
65
65
|
"react-toastify": "~6.2.0"
|
package/cjs/DSToast.js.map
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/DSToast.tsx", "../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["import React from 'react';\nimport { PropTypes, describe } from 'react-desc';\nimport { ToastContainer, Slide } from 'react-toastify';\nimport { CloseSmall } from '@elliemae/ds-icons';\nimport DSButton from '@elliemae/ds-button';\nimport { toastsPositions } from './ToastPosition';\n\nconst CloseButton = ({ closeToast }) => (\n <DSButton buttonType=\"text\" className=\"toast-close-button\" icon={<CloseSmall />} onClick={closeToast} size=\"m\" />\n);\n\nconst DSToast = ({\n containerProps = {},\n position = 'bottom-left',\n autoClose = 5000, // can be false or a number in milliseconds\n showProgressBar = false,\n closeOnClick = false,\n enableMultiContainer = false,\n containerId = undefined,\n toastId = undefined,\n}) => (\n <ToastContainer\n {...containerProps}\n autoClose={autoClose}\n className={(showProgressBar && 'with-progressbar') || ''}\n closeButton={<CloseButton />}\n closeOnClick={closeOnClick}\n containerId={containerId}\n enableMultiContainer={enableMultiContainer}\n hideProgressBar={!showProgressBar}\n newestOnTop\n position={position}\n toastId={toastId}\n transition={Slide}\n />\n);\n\nconst props = {\n /** inject props to wrapper */\n containerProps: PropTypes.object.description('inject props to wrapper'),\n /** Position on the screen to show the toast */\n position: PropTypes.oneOf(toastsPositions).description('Position on the screen to show the toast'),\n /** ms to autoclose the toast */\n autoClose: PropTypes.number.description('ms to autoclose the toast'),\n /** Whether to show a progress bar indicating when the toast is going to be closed */\n showProgressBar: PropTypes.bool.description(\n 'Whether to show a progress bar indicating when the toast is going to be closed',\n ),\n /** Close toast handler */\n closeOnClick: PropTypes.bool.description('Close toast handler'),\n /** Allows instantiating multiple Toast containers */\n enableMultiContainer: PropTypes.bool.description('Allows instantiating multiple Toast containers'),\n /** unique id for multi container */\n containerId: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).description('unique id for multi container'),\n /** id for the toast */\n toastId: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).description('id for the toast'),\n};\n\nDSToast.propTypes = props;\nconst DSToastWithSchema = describe(DSToast);\nDSToastWithSchema.propTypes = props;\n\nexport { DSToast, DSToastWithSchema };\nexport default DSToast;\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,mBAAkB;AAClB,wBAAoC;AACpC,4BAAsC;AACtC,sBAA2B;AAC3B,uBAAqB;AACrB,2BAAgC;AAEhC,MAAM,cAAc,CAAC,EAAE,iBACrB,mDAAC,0BAAD;AAAA,EAAU,YAAW;AAAA,EAAO,WAAU;AAAA,EAAqB,MAAM,mDAAC,4BAAD;AAAA,EAAgB,SAAS;AAAA,EAAY,MAAK;AAAA;AAG7G,MAAM,UAAU,CAAC;AAAA,EACf,iBAAiB;AAAA,EACjB,WAAW;AAAA,EACX,YAAY;AAAA,EACZ,kBAAkB;AAAA,EAClB,eAAe;AAAA,EACf,uBAAuB;AAAA,EACvB,cAAc;AAAA,EACd,UAAU;AAAA,MAEV,mDAAC,sCAAD;AAAA,KACM;AAAA,EACJ;AAAA,EACA,WAAY,mBAAmB,sBAAuB;AAAA,EACtD,aAAa,mDAAC,aAAD;AAAA,EACb;AAAA,EACA;AAAA,EACA;AAAA,EACA,iBAAiB,CAAC;AAAA,EAClB,aAAW;AAAA,EACX;AAAA,EACA;AAAA,EACA,YAAY;AAAA;AAIhB,MAAM,QAAQ;AAAA,EAEZ,gBAAgB,4BAAU,OAAO,YAAY;AAAA,EAE7C,UAAU,4BAAU,MAAM,sCAAiB,YAAY;AAAA,EAEvD,WAAW,4BAAU,OAAO,YAAY;AAAA,EAExC,iBAAiB,4BAAU,KAAK,YAC9B;AAAA,EAGF,cAAc,4BAAU,KAAK,YAAY;AAAA,EAEzC,sBAAsB,4BAAU,KAAK,YAAY;AAAA,EAEjD,aAAa,4BAAU,UAAU,CAAC,4BAAU,QAAQ,4BAAU,SAAS,YAAY;AAAA,EAEnF,SAAS,4BAAU,UAAU,CAAC,4BAAU,QAAQ,4BAAU,SAAS,YAAY;AAAA;AAGjF,QAAQ,YAAY;AACpB,MAAM,oBAAoB,gCAAS;AACnC,kBAAkB,YAAY;AAG9B,IAAO,kBAAQ;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
package/cjs/ToastAction.js.map
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/ToastAction.tsx", "../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["import React from 'react';\nimport { PropTypes, describe } from 'react-desc';\nimport styled from 'styled-components';\nimport { color } from '@elliemae/ds-system';\n\nconst Link = styled.span`\n ${color('brand', '600')}\n`;\n\nconst DSToastAction = ({ children, onClick, onKeyDown }) => (\n // eslint-disable-next-line jsx-a11y/no-static-element-interactions\n <div\n onKeyDown={onKeyDown}\n onClick={onClick}\n role={onClick ? 'button' : 'textbox'}\n >\n {children}\n </div>\n);\n\n// eslint-disable-next-line jsx-a11y/anchor-is-valid\nconst DSToastActionLink = ({ children }) => <Link>{children}</Link>;\n\nconst actionprops = {\n /** DSToastActionLink component or text string */\n children: PropTypes.oneOfType([\n PropTypes.string,\n PropTypes.element,\n ]).description('DSToastActionLink component or text string'),\n /** click handler */\n onClick: PropTypes.func.description('click handler'),\n /** key down handler */\n onKeyDown: PropTypes.func.description('key down handler'),\n};\n\nconst linkprops = {\n /** link text */\n children: PropTypes.string.isRequired.description('link text'),\n};\n\nDSToastAction.propTypes = actionprops;\nDSToastActionLink.propTypes = linkprops;\nconst DSToastActionWithSchema = describe(DSToastAction);\nconst DSToastActionLinkWithSchema = describe(DSToastActionLink);\nDSToastActionLinkWithSchema.propTypes = linkprops;\nDSToastActionWithSchema.propTypes = actionprops;\n\nexport {\n DSToastAction,\n DSToastActionLink,\n DSToastActionWithSchema,\n DSToastActionLinkWithSchema,\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,mBAAkB;AAClB,wBAAoC;AACpC,+BAAmB;AACnB,uBAAsB;AAEtB,MAAM,OAAO,iCAAO;AAAA,IAChB,4BAAM,SAAS;AAAA;AAGnB,MAAM,gBAAgB,CAAC,EAAE,UAAU,SAAS,gBAE1C,mDAAC,OAAD;AAAA,EACE;AAAA,EACA;AAAA,EACA,MAAM,UAAU,WAAW;AAAA,GAE1B;AAKL,MAAM,oBAAoB,CAAC,EAAE,eAAe,mDAAC,MAAD,MAAO;AAEnD,MAAM,cAAc;AAAA,EAElB,UAAU,4BAAU,UAAU;AAAA,IAC5B,4BAAU;AAAA,IACV,4BAAU;AAAA,KACT,YAAY;AAAA,EAEf,SAAS,4BAAU,KAAK,YAAY;AAAA,EAEpC,WAAW,4BAAU,KAAK,YAAY;AAAA;AAGxC,MAAM,YAAY;AAAA,EAEhB,UAAU,4BAAU,OAAO,WAAW,YAAY;AAAA;AAGpD,cAAc,YAAY;AAC1B,kBAAkB,YAAY;AAC9B,MAAM,0BAA0B,gCAAS;AACzC,MAAM,8BAA8B,gCAAS;AAC7C,4BAA4B,YAAY;AACxC,wBAAwB,YAAY;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
package/cjs/ToastPosition.js.map
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/ToastPosition.tsx", "../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["export const ToastPosition = {\n TOP_RIGHT: 'top-right',\n TOP_CENTER: 'top-center',\n TOP_LEFT: 'top-left',\n BOTTOM_RIGHT: 'bottom-right',\n BOTTOM_CENTER: 'bottom-center',\n BOTTOM_LEFT: 'bottom-left',\n};\n\nexport const toastsPositions = Object.values(ToastPosition);\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAhB,MAAM,gBAAgB;AAAA,EAC3B,WAAW;AAAA,EACX,YAAY;AAAA,EACZ,UAAU;AAAA,EACV,cAAc;AAAA,EACd,eAAe;AAAA,EACf,aAAa;AAAA;AAGR,MAAM,kBAAkB,OAAO,OAAO;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
package/cjs/ToastRender.js.map
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/ToastRender.tsx", "../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["import React from 'react';\nimport PropTypes from 'prop-types';\nimport { aggregatedClasses } from '@elliemae/ds-classnames';\nimport { CheckmarkCircleFill, WarningCircleFill, InfoCircleFill } from '@elliemae/ds-icons';\nimport { ToastType, toastTypes } from './ToastType';\n\nconst blockName = 'toast-content';\nconst Container = aggregatedClasses('div')(blockName);\nconst IconContainer = aggregatedClasses('div')(blockName, 'icon-container');\nconst MessageContent = aggregatedClasses('div')(blockName, 'message-content');\nconst MessageHeader = aggregatedClasses('div')(blockName, 'message-header');\nconst MessageText = aggregatedClasses('span')(blockName, 'message-text');\n\nconst getIconByToastType = (type) =>\n ({\n [ToastType.SUCCESS]: CheckmarkCircleFill,\n [ToastType.WARNING]: WarningCircleFill,\n [ToastType.INFO]: InfoCircleFill,\n [ToastType.ERROR]: WarningCircleFill,\n [ToastType.DEFAULT]: 'div',\n }[type]);\n\nconst ToastRender = ({ type = ToastType.DEFAULT, messageTitle = '', messageText = '' }) => {\n const IconMessage = aggregatedClasses(getIconByToastType(type))(blockName, 'icon-message');\n return (\n <Container data-testid=\"ds-toast-render\">\n <IconContainer>\n <IconMessage size=\"m\" />\n </IconContainer>\n <MessageContent>\n <MessageHeader>{messageTitle}</MessageHeader>\n <MessageText>{messageText}</MessageText>\n </MessageContent>\n </Container>\n );\n};\n\nToastRender.propTypes = {\n /**\n * Toast title\n */\n messageTitle: PropTypes.string.isRequired,\n /**\n * Toast body, either a string or Action with ActionLink component\n */\n messageText: PropTypes.oneOfType([PropTypes.string, PropTypes.element]),\n /**\n * Toast type\n */\n type: PropTypes.oneOf(toastTypes).isRequired,\n};\n\nexport default ToastRender;\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,mBAAkB;AAClB,wBAAsB;AACtB,2BAAkC;AAClC,sBAAuE;AACvE,uBAAsC;AAEtC,MAAM,YAAY;AAClB,MAAM,YAAY,4CAAkB,OAAO;AAC3C,MAAM,gBAAgB,4CAAkB,OAAO,WAAW;AAC1D,MAAM,iBAAiB,4CAAkB,OAAO,WAAW;AAC3D,MAAM,gBAAgB,4CAAkB,OAAO,WAAW;AAC1D,MAAM,cAAc,4CAAkB,QAAQ,WAAW;AAEzD,MAAM,qBAAqB,CAAC,SACzB;AAAA,GACE,2BAAU,UAAU;AAAA,GACpB,2BAAU,UAAU;AAAA,GACpB,2BAAU,OAAO;AAAA,GACjB,2BAAU,QAAQ;AAAA,GAClB,2BAAU,UAAU;AAAA,GACrB;AAEJ,MAAM,cAAc,CAAC,EAAE,OAAO,2BAAU,SAAS,eAAe,IAAI,cAAc,SAAS;AACzF,QAAM,cAAc,4CAAkB,mBAAmB,OAAO,WAAW;AAC3E,SACE,mDAAC,WAAD;AAAA,IAAW,eAAY;AAAA,KACrB,mDAAC,eAAD,MACE,mDAAC,aAAD;AAAA,IAAa,MAAK;AAAA,OAEpB,mDAAC,gBAAD,MACE,mDAAC,eAAD,MAAgB,eAChB,mDAAC,aAAD,MAAc;AAAA;AAMtB,YAAY,YAAY;AAAA,EAItB,cAAc,0BAAU,OAAO;AAAA,EAI/B,aAAa,0BAAU,UAAU,CAAC,0BAAU,QAAQ,0BAAU;AAAA,EAI9D,MAAM,0BAAU,MAAM,6BAAY;AAAA;AAGpC,IAAO,sBAAQ;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
package/cjs/ToastType.js.map
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/ToastType.tsx", "../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["export const ToastType = {\n INFO: 'info',\n SUCCESS: 'success',\n WARNING: 'warning',\n ERROR: 'error',\n // TODO remove from types, it's not in spec\n DEFAULT: 'default',\n};\n\nexport const toastTypes = Object.values(ToastType);\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAhB,MAAM,YAAY;AAAA,EACvB,MAAM;AAAA,EACN,SAAS;AAAA,EACT,SAAS;AAAA,EACT,OAAO;AAAA,EAEP,SAAS;AAAA;AAGJ,MAAM,aAAa,OAAO,OAAO;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
package/cjs/index.js.map
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/index.tsx", "../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["export * from './DSToast';\nexport * from './toast';\nexport * from './ToastType';\nexport * from './ToastPosition';\nexport * from './ToastAction';\n\nexport { default } from './DSToast';\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,wBAAc;AACd,wBAAc;AACd,wBAAc;AACd,wBAAc;AACd,wBAAc;AAEd,qBAAwB;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|