@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/DSToast.js
CHANGED
|
@@ -1,86 +1,102 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
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
|
+
require('react');
|
|
13
|
+
var reactDesc = require('react-desc');
|
|
14
|
+
var reactToastify = require('react-toastify');
|
|
15
|
+
var dsIcons = require('@elliemae/ds-icons');
|
|
16
|
+
var DSButton = require('@elliemae/ds-button');
|
|
17
|
+
var ToastPosition = require('./ToastPosition.js');
|
|
18
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
19
|
+
|
|
20
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
21
|
+
|
|
22
|
+
var _defineProperty__default = /*#__PURE__*/_interopDefaultLegacy(_defineProperty);
|
|
23
|
+
var _jsx__default = /*#__PURE__*/_interopDefaultLegacy(_jsx);
|
|
24
|
+
var DSButton__default = /*#__PURE__*/_interopDefaultLegacy(DSButton);
|
|
25
|
+
|
|
26
|
+
var _CloseSmall, _CloseButton;
|
|
27
|
+
|
|
28
|
+
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; }
|
|
29
|
+
|
|
30
|
+
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; }
|
|
31
|
+
|
|
32
|
+
const CloseButton = _ref => {
|
|
33
|
+
let {
|
|
34
|
+
closeToast
|
|
35
|
+
} = _ref;
|
|
36
|
+
return /*#__PURE__*/_jsx__default["default"](DSButton__default["default"], {
|
|
37
|
+
buttonType: "text",
|
|
38
|
+
className: "toast-close-button",
|
|
39
|
+
icon: _CloseSmall || (_CloseSmall = /*#__PURE__*/_jsx__default["default"](dsIcons.CloseSmall, {})),
|
|
40
|
+
onClick: closeToast,
|
|
41
|
+
size: "m"
|
|
42
|
+
});
|
|
11
43
|
};
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
44
|
+
|
|
45
|
+
const DSToast = _ref2 => {
|
|
46
|
+
let {
|
|
47
|
+
containerProps = {},
|
|
48
|
+
position = 'bottom-left',
|
|
49
|
+
autoClose = 5000,
|
|
50
|
+
// can be false or a number in milliseconds
|
|
51
|
+
showProgressBar = false,
|
|
52
|
+
closeOnClick = false,
|
|
53
|
+
enableMultiContainer = false,
|
|
54
|
+
containerId = undefined,
|
|
55
|
+
toastId = undefined
|
|
56
|
+
} = _ref2;
|
|
57
|
+
return /*#__PURE__*/jsxRuntime.jsx(reactToastify.ToastContainer, _objectSpread(_objectSpread({}, containerProps), {}, {
|
|
58
|
+
autoClose: autoClose,
|
|
59
|
+
className: showProgressBar && 'with-progressbar' || '',
|
|
60
|
+
closeButton: _CloseButton || (_CloseButton = /*#__PURE__*/_jsx__default["default"](CloseButton, {})),
|
|
61
|
+
closeOnClick: closeOnClick,
|
|
62
|
+
containerId: containerId,
|
|
63
|
+
enableMultiContainer: enableMultiContainer,
|
|
64
|
+
hideProgressBar: !showProgressBar,
|
|
65
|
+
newestOnTop: true,
|
|
66
|
+
position: position,
|
|
67
|
+
toastId: toastId,
|
|
68
|
+
transition: reactToastify.Slide
|
|
69
|
+
}));
|
|
19
70
|
};
|
|
20
|
-
|
|
21
|
-
return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
|
|
22
|
-
};
|
|
23
|
-
var __toCommonJS = /* @__PURE__ */ ((cache) => {
|
|
24
|
-
return (module2, temp) => {
|
|
25
|
-
return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
|
|
26
|
-
};
|
|
27
|
-
})(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
|
|
28
|
-
var DSToast_exports = {};
|
|
29
|
-
__export(DSToast_exports, {
|
|
30
|
-
DSToast: () => DSToast,
|
|
31
|
-
DSToastWithSchema: () => DSToastWithSchema,
|
|
32
|
-
default: () => DSToast_default
|
|
33
|
-
});
|
|
34
|
-
var React = __toESM(require("react"));
|
|
35
|
-
var import_react = __toESM(require("react"));
|
|
36
|
-
var import_react_desc = __toESM(require("react-desc"));
|
|
37
|
-
var import_react_toastify = __toESM(require("react-toastify"));
|
|
38
|
-
var import_ds_icons = __toESM(require("@elliemae/ds-icons"));
|
|
39
|
-
var import_ds_button = __toESM(require("@elliemae/ds-button"));
|
|
40
|
-
var import_ToastPosition = __toESM(require("./ToastPosition"));
|
|
41
|
-
const CloseButton = ({ closeToast }) => /* @__PURE__ */ import_react.default.createElement(import_ds_button.default, {
|
|
42
|
-
buttonType: "text",
|
|
43
|
-
className: "toast-close-button",
|
|
44
|
-
icon: /* @__PURE__ */ import_react.default.createElement(import_ds_icons.CloseSmall, null),
|
|
45
|
-
onClick: closeToast,
|
|
46
|
-
size: "m"
|
|
47
|
-
});
|
|
48
|
-
const DSToast = ({
|
|
49
|
-
containerProps = {},
|
|
50
|
-
position = "bottom-left",
|
|
51
|
-
autoClose = 5e3,
|
|
52
|
-
showProgressBar = false,
|
|
53
|
-
closeOnClick = false,
|
|
54
|
-
enableMultiContainer = false,
|
|
55
|
-
containerId = void 0,
|
|
56
|
-
toastId = void 0
|
|
57
|
-
}) => /* @__PURE__ */ import_react.default.createElement(import_react_toastify.ToastContainer, {
|
|
58
|
-
...containerProps,
|
|
59
|
-
autoClose,
|
|
60
|
-
className: showProgressBar && "with-progressbar" || "",
|
|
61
|
-
closeButton: /* @__PURE__ */ import_react.default.createElement(CloseButton, null),
|
|
62
|
-
closeOnClick,
|
|
63
|
-
containerId,
|
|
64
|
-
enableMultiContainer,
|
|
65
|
-
hideProgressBar: !showProgressBar,
|
|
66
|
-
newestOnTop: true,
|
|
67
|
-
position,
|
|
68
|
-
toastId,
|
|
69
|
-
transition: import_react_toastify.Slide
|
|
70
|
-
});
|
|
71
|
+
|
|
71
72
|
const props = {
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
73
|
+
/** inject props to wrapper */
|
|
74
|
+
containerProps: reactDesc.PropTypes.object.description('inject props to wrapper'),
|
|
75
|
+
|
|
76
|
+
/** Position on the screen to show the toast */
|
|
77
|
+
position: reactDesc.PropTypes.oneOf(ToastPosition.toastsPositions).description('Position on the screen to show the toast'),
|
|
78
|
+
|
|
79
|
+
/** ms to autoclose the toast */
|
|
80
|
+
autoClose: reactDesc.PropTypes.number.description('ms to autoclose the toast'),
|
|
81
|
+
|
|
82
|
+
/** Whether to show a progress bar indicating when the toast is going to be closed */
|
|
83
|
+
showProgressBar: reactDesc.PropTypes.bool.description('Whether to show a progress bar indicating when the toast is going to be closed'),
|
|
84
|
+
|
|
85
|
+
/** Close toast handler */
|
|
86
|
+
closeOnClick: reactDesc.PropTypes.bool.description('Close toast handler'),
|
|
87
|
+
|
|
88
|
+
/** Allows instantiating multiple Toast containers */
|
|
89
|
+
enableMultiContainer: reactDesc.PropTypes.bool.description('Allows instantiating multiple Toast containers'),
|
|
90
|
+
|
|
91
|
+
/** unique id for multi container */
|
|
92
|
+
containerId: reactDesc.PropTypes.oneOfType([reactDesc.PropTypes.string, reactDesc.PropTypes.number]).description('unique id for multi container'),
|
|
93
|
+
|
|
94
|
+
/** id for the toast */
|
|
95
|
+
toastId: reactDesc.PropTypes.oneOfType([reactDesc.PropTypes.string, reactDesc.PropTypes.number]).description('id for the toast')
|
|
80
96
|
};
|
|
81
|
-
|
|
82
|
-
const DSToastWithSchema = (0, import_react_desc.describe)(DSToast);
|
|
97
|
+
const DSToastWithSchema = reactDesc.describe(DSToast);
|
|
83
98
|
DSToastWithSchema.propTypes = props;
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
99
|
+
|
|
100
|
+
exports.DSToast = DSToast;
|
|
101
|
+
exports.DSToastWithSchema = DSToastWithSchema;
|
|
102
|
+
exports["default"] = DSToast;
|
package/cjs/ToastAction.js
CHANGED
|
@@ -1,67 +1,67 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var
|
|
6
|
-
|
|
7
|
-
var
|
|
8
|
-
var
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var _jsx = require('@babel/runtime/helpers/jsx');
|
|
6
|
+
require('react');
|
|
7
|
+
var reactDesc = require('react-desc');
|
|
8
|
+
var styled = require('styled-components');
|
|
9
|
+
var dsSystem = require('@elliemae/ds-system');
|
|
10
|
+
|
|
11
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
12
|
+
|
|
13
|
+
var _jsx__default = /*#__PURE__*/_interopDefaultLegacy(_jsx);
|
|
14
|
+
var styled__default = /*#__PURE__*/_interopDefaultLegacy(styled);
|
|
15
|
+
|
|
16
|
+
const Link = /*#__PURE__*/styled__default["default"].span.withConfig({
|
|
17
|
+
componentId: "sc-1bs5g4c-0"
|
|
18
|
+
})(["", ""], dsSystem.color('brand', '600'));
|
|
19
|
+
|
|
20
|
+
const DSToastAction = _ref => {
|
|
21
|
+
let {
|
|
22
|
+
children,
|
|
23
|
+
onClick,
|
|
24
|
+
onKeyDown
|
|
25
|
+
} = _ref;
|
|
26
|
+
return (
|
|
27
|
+
/*#__PURE__*/
|
|
28
|
+
// eslint-disable-next-line jsx-a11y/no-static-element-interactions
|
|
29
|
+
_jsx__default["default"]("div", {
|
|
30
|
+
onKeyDown: onKeyDown,
|
|
31
|
+
onClick: onClick,
|
|
32
|
+
role: onClick ? 'button' : 'textbox'
|
|
33
|
+
}, void 0, children)
|
|
34
|
+
);
|
|
35
|
+
}; // eslint-disable-next-line jsx-a11y/anchor-is-valid
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
const DSToastActionLink = _ref2 => {
|
|
39
|
+
let {
|
|
40
|
+
children
|
|
41
|
+
} = _ref2;
|
|
42
|
+
return /*#__PURE__*/_jsx__default["default"](Link, {}, void 0, children);
|
|
11
43
|
};
|
|
12
|
-
|
|
13
|
-
if (module2 && typeof module2 === "object" || typeof module2 === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(module2))
|
|
15
|
-
if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
|
|
16
|
-
__defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return target;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (module2, isNodeMode) => {
|
|
21
|
-
return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
|
|
22
|
-
};
|
|
23
|
-
var __toCommonJS = /* @__PURE__ */ ((cache) => {
|
|
24
|
-
return (module2, temp) => {
|
|
25
|
-
return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
|
|
26
|
-
};
|
|
27
|
-
})(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
|
|
28
|
-
var ToastAction_exports = {};
|
|
29
|
-
__export(ToastAction_exports, {
|
|
30
|
-
DSToastAction: () => DSToastAction,
|
|
31
|
-
DSToastActionLink: () => DSToastActionLink,
|
|
32
|
-
DSToastActionLinkWithSchema: () => DSToastActionLinkWithSchema,
|
|
33
|
-
DSToastActionWithSchema: () => DSToastActionWithSchema
|
|
34
|
-
});
|
|
35
|
-
var React = __toESM(require("react"));
|
|
36
|
-
var import_react = __toESM(require("react"));
|
|
37
|
-
var import_react_desc = __toESM(require("react-desc"));
|
|
38
|
-
var import_styled_components = __toESM(require("styled-components"));
|
|
39
|
-
var import_ds_system = __toESM(require("@elliemae/ds-system"));
|
|
40
|
-
const Link = import_styled_components.default.span`
|
|
41
|
-
${(0, import_ds_system.color)("brand", "600")}
|
|
42
|
-
`;
|
|
43
|
-
const DSToastAction = ({ children, onClick, onKeyDown }) => /* @__PURE__ */ import_react.default.createElement("div", {
|
|
44
|
-
onKeyDown,
|
|
45
|
-
onClick,
|
|
46
|
-
role: onClick ? "button" : "textbox"
|
|
47
|
-
}, children);
|
|
48
|
-
const DSToastActionLink = ({ children }) => /* @__PURE__ */ import_react.default.createElement(Link, null, children);
|
|
44
|
+
|
|
49
45
|
const actionprops = {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
onClick:
|
|
55
|
-
|
|
46
|
+
/** DSToastActionLink component or text string */
|
|
47
|
+
children: reactDesc.PropTypes.oneOfType([reactDesc.PropTypes.string, reactDesc.PropTypes.element]).description('DSToastActionLink component or text string'),
|
|
48
|
+
|
|
49
|
+
/** click handler */
|
|
50
|
+
onClick: reactDesc.PropTypes.func.description('click handler'),
|
|
51
|
+
|
|
52
|
+
/** key down handler */
|
|
53
|
+
onKeyDown: reactDesc.PropTypes.func.description('key down handler')
|
|
56
54
|
};
|
|
57
55
|
const linkprops = {
|
|
58
|
-
|
|
56
|
+
/** link text */
|
|
57
|
+
children: reactDesc.PropTypes.string.isRequired.description('link text')
|
|
59
58
|
};
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
const DSToastActionWithSchema = (0, import_react_desc.describe)(DSToastAction);
|
|
63
|
-
const DSToastActionLinkWithSchema = (0, import_react_desc.describe)(DSToastActionLink);
|
|
59
|
+
const DSToastActionWithSchema = reactDesc.describe(DSToastAction);
|
|
60
|
+
const DSToastActionLinkWithSchema = reactDesc.describe(DSToastActionLink);
|
|
64
61
|
DSToastActionLinkWithSchema.propTypes = linkprops;
|
|
65
62
|
DSToastActionWithSchema.propTypes = actionprops;
|
|
66
|
-
|
|
67
|
-
|
|
63
|
+
|
|
64
|
+
exports.DSToastAction = DSToastAction;
|
|
65
|
+
exports.DSToastActionLink = DSToastActionLink;
|
|
66
|
+
exports.DSToastActionLinkWithSchema = DSToastActionLinkWithSchema;
|
|
67
|
+
exports.DSToastActionWithSchema = DSToastActionWithSchema;
|
package/cjs/ToastPosition.js
CHANGED
|
@@ -1,44 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
|
|
8
|
-
var __export = (target, all) => {
|
|
9
|
-
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
-
};
|
|
12
|
-
var __reExport = (target, module2, copyDefault, desc) => {
|
|
13
|
-
if (module2 && typeof module2 === "object" || typeof module2 === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(module2))
|
|
15
|
-
if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
|
|
16
|
-
__defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return target;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (module2, isNodeMode) => {
|
|
21
|
-
return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
|
|
22
|
-
};
|
|
23
|
-
var __toCommonJS = /* @__PURE__ */ ((cache) => {
|
|
24
|
-
return (module2, temp) => {
|
|
25
|
-
return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
|
|
26
|
-
};
|
|
27
|
-
})(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
|
|
28
|
-
var ToastPosition_exports = {};
|
|
29
|
-
__export(ToastPosition_exports, {
|
|
30
|
-
ToastPosition: () => ToastPosition,
|
|
31
|
-
toastsPositions: () => toastsPositions
|
|
32
|
-
});
|
|
33
|
-
var React = __toESM(require("react"));
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
34
5
|
const ToastPosition = {
|
|
35
|
-
TOP_RIGHT:
|
|
36
|
-
TOP_CENTER:
|
|
37
|
-
TOP_LEFT:
|
|
38
|
-
BOTTOM_RIGHT:
|
|
39
|
-
BOTTOM_CENTER:
|
|
40
|
-
BOTTOM_LEFT:
|
|
6
|
+
TOP_RIGHT: 'top-right',
|
|
7
|
+
TOP_CENTER: 'top-center',
|
|
8
|
+
TOP_LEFT: 'top-left',
|
|
9
|
+
BOTTOM_RIGHT: 'bottom-right',
|
|
10
|
+
BOTTOM_CENTER: 'bottom-center',
|
|
11
|
+
BOTTOM_LEFT: 'bottom-left'
|
|
41
12
|
};
|
|
42
13
|
const toastsPositions = Object.values(ToastPosition);
|
|
43
|
-
|
|
44
|
-
|
|
14
|
+
|
|
15
|
+
exports.ToastPosition = ToastPosition;
|
|
16
|
+
exports.toastsPositions = toastsPositions;
|
package/cjs/ToastRender.js
CHANGED
|
@@ -1,66 +1,42 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var
|
|
4
|
-
|
|
5
|
-
var
|
|
6
|
-
var
|
|
7
|
-
var
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
};
|
|
27
|
-
})(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
|
|
28
|
-
var ToastRender_exports = {};
|
|
29
|
-
__export(ToastRender_exports, {
|
|
30
|
-
default: () => ToastRender_default
|
|
31
|
-
});
|
|
32
|
-
var React = __toESM(require("react"));
|
|
33
|
-
var import_react = __toESM(require("react"));
|
|
34
|
-
var import_prop_types = __toESM(require("prop-types"));
|
|
35
|
-
var import_ds_classnames = __toESM(require("@elliemae/ds-classnames"));
|
|
36
|
-
var import_ds_icons = __toESM(require("@elliemae/ds-icons"));
|
|
37
|
-
var import_ToastType = __toESM(require("./ToastType"));
|
|
38
|
-
const blockName = "toast-content";
|
|
39
|
-
const Container = (0, import_ds_classnames.aggregatedClasses)("div")(blockName);
|
|
40
|
-
const IconContainer = (0, import_ds_classnames.aggregatedClasses)("div")(blockName, "icon-container");
|
|
41
|
-
const MessageContent = (0, import_ds_classnames.aggregatedClasses)("div")(blockName, "message-content");
|
|
42
|
-
const MessageHeader = (0, import_ds_classnames.aggregatedClasses)("div")(blockName, "message-header");
|
|
43
|
-
const MessageText = (0, import_ds_classnames.aggregatedClasses)("span")(blockName, "message-text");
|
|
44
|
-
const getIconByToastType = (type) => ({
|
|
45
|
-
[import_ToastType.ToastType.SUCCESS]: import_ds_icons.CheckmarkCircleFill,
|
|
46
|
-
[import_ToastType.ToastType.WARNING]: import_ds_icons.WarningCircleFill,
|
|
47
|
-
[import_ToastType.ToastType.INFO]: import_ds_icons.InfoCircleFill,
|
|
48
|
-
[import_ToastType.ToastType.ERROR]: import_ds_icons.WarningCircleFill,
|
|
49
|
-
[import_ToastType.ToastType.DEFAULT]: "div"
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var _jsx = require('@babel/runtime/helpers/jsx');
|
|
4
|
+
require('react');
|
|
5
|
+
var dsClassnames = require('@elliemae/ds-classnames');
|
|
6
|
+
var dsIcons = require('@elliemae/ds-icons');
|
|
7
|
+
var ToastType = require('./ToastType.js');
|
|
8
|
+
|
|
9
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
10
|
+
|
|
11
|
+
var _jsx__default = /*#__PURE__*/_interopDefaultLegacy(_jsx);
|
|
12
|
+
|
|
13
|
+
const blockName = 'toast-content';
|
|
14
|
+
const Container = dsClassnames.aggregatedClasses('div')(blockName);
|
|
15
|
+
const IconContainer = dsClassnames.aggregatedClasses('div')(blockName, 'icon-container');
|
|
16
|
+
const MessageContent = dsClassnames.aggregatedClasses('div')(blockName, 'message-content');
|
|
17
|
+
const MessageHeader = dsClassnames.aggregatedClasses('div')(blockName, 'message-header');
|
|
18
|
+
const MessageText = dsClassnames.aggregatedClasses('span')(blockName, 'message-text');
|
|
19
|
+
|
|
20
|
+
const getIconByToastType = type => ({
|
|
21
|
+
[ToastType.ToastType.SUCCESS]: dsIcons.CheckmarkCircleFill,
|
|
22
|
+
[ToastType.ToastType.WARNING]: dsIcons.WarningCircleFill,
|
|
23
|
+
[ToastType.ToastType.INFO]: dsIcons.InfoCircleFill,
|
|
24
|
+
[ToastType.ToastType.ERROR]: dsIcons.WarningCircleFill,
|
|
25
|
+
[ToastType.ToastType.DEFAULT]: 'div'
|
|
50
26
|
})[type];
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
27
|
+
|
|
28
|
+
const ToastRender = _ref => {
|
|
29
|
+
let {
|
|
30
|
+
type = ToastType.ToastType.DEFAULT,
|
|
31
|
+
messageTitle = '',
|
|
32
|
+
messageText = ''
|
|
33
|
+
} = _ref;
|
|
34
|
+
const IconMessage = dsClassnames.aggregatedClasses(getIconByToastType(type))(blockName, 'icon-message');
|
|
35
|
+
return /*#__PURE__*/_jsx__default["default"](Container, {
|
|
54
36
|
"data-testid": "ds-toast-render"
|
|
55
|
-
},
|
|
37
|
+
}, void 0, /*#__PURE__*/_jsx__default["default"](IconContainer, {}, void 0, /*#__PURE__*/_jsx__default["default"](IconMessage, {
|
|
56
38
|
size: "m"
|
|
57
|
-
})),
|
|
58
|
-
};
|
|
59
|
-
ToastRender.propTypes = {
|
|
60
|
-
messageTitle: import_prop_types.default.string.isRequired,
|
|
61
|
-
messageText: import_prop_types.default.oneOfType([import_prop_types.default.string, import_prop_types.default.element]),
|
|
62
|
-
type: import_prop_types.default.oneOf(import_ToastType.toastTypes).isRequired
|
|
39
|
+
})), /*#__PURE__*/_jsx__default["default"](MessageContent, {}, void 0, /*#__PURE__*/_jsx__default["default"](MessageHeader, {}, void 0, messageTitle), /*#__PURE__*/_jsx__default["default"](MessageText, {}, void 0, messageText)));
|
|
63
40
|
};
|
|
64
|
-
|
|
65
|
-
module.exports =
|
|
66
|
-
//# sourceMappingURL=ToastRender.js.map
|
|
41
|
+
|
|
42
|
+
module.exports = ToastRender;
|
package/cjs/ToastType.js
CHANGED
|
@@ -1,43 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
|
|
8
|
-
var __export = (target, all) => {
|
|
9
|
-
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
-
};
|
|
12
|
-
var __reExport = (target, module2, copyDefault, desc) => {
|
|
13
|
-
if (module2 && typeof module2 === "object" || typeof module2 === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(module2))
|
|
15
|
-
if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
|
|
16
|
-
__defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return target;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (module2, isNodeMode) => {
|
|
21
|
-
return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
|
|
22
|
-
};
|
|
23
|
-
var __toCommonJS = /* @__PURE__ */ ((cache) => {
|
|
24
|
-
return (module2, temp) => {
|
|
25
|
-
return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
|
|
26
|
-
};
|
|
27
|
-
})(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
|
|
28
|
-
var ToastType_exports = {};
|
|
29
|
-
__export(ToastType_exports, {
|
|
30
|
-
ToastType: () => ToastType,
|
|
31
|
-
toastTypes: () => toastTypes
|
|
32
|
-
});
|
|
33
|
-
var React = __toESM(require("react"));
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
34
5
|
const ToastType = {
|
|
35
|
-
INFO:
|
|
36
|
-
SUCCESS:
|
|
37
|
-
WARNING:
|
|
38
|
-
ERROR:
|
|
39
|
-
|
|
6
|
+
INFO: 'info',
|
|
7
|
+
SUCCESS: 'success',
|
|
8
|
+
WARNING: 'warning',
|
|
9
|
+
ERROR: 'error',
|
|
10
|
+
// TODO remove from types, it's not in spec
|
|
11
|
+
DEFAULT: 'default'
|
|
40
12
|
};
|
|
41
13
|
const toastTypes = Object.values(ToastType);
|
|
42
|
-
|
|
43
|
-
|
|
14
|
+
|
|
15
|
+
exports.ToastType = ToastType;
|
|
16
|
+
exports.toastTypes = toastTypes;
|
package/cjs/index.js
CHANGED
|
@@ -1,40 +1,24 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var
|
|
6
|
-
var
|
|
7
|
-
var
|
|
8
|
-
var
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
|
|
26
|
-
};
|
|
27
|
-
})(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
|
|
28
|
-
var src_exports = {};
|
|
29
|
-
__export(src_exports, {
|
|
30
|
-
default: () => import_DSToast.default
|
|
31
|
-
});
|
|
32
|
-
var React = __toESM(require("react"));
|
|
33
|
-
__reExport(src_exports, __toESM(require("./DSToast")));
|
|
34
|
-
__reExport(src_exports, __toESM(require("./toast")));
|
|
35
|
-
__reExport(src_exports, __toESM(require("./ToastType")));
|
|
36
|
-
__reExport(src_exports, __toESM(require("./ToastPosition")));
|
|
37
|
-
__reExport(src_exports, __toESM(require("./ToastAction")));
|
|
38
|
-
var import_DSToast = __toESM(require("./DSToast"));
|
|
39
|
-
module.exports = __toCommonJS(src_exports);
|
|
40
|
-
//# sourceMappingURL=index.js.map
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var DSToast = require('./DSToast.js');
|
|
6
|
+
var toast = require('./toast.js');
|
|
7
|
+
var ToastType = require('./ToastType.js');
|
|
8
|
+
var ToastPosition = require('./ToastPosition.js');
|
|
9
|
+
var ToastAction = require('./ToastAction.js');
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
exports.DSToast = DSToast.DSToast;
|
|
14
|
+
exports.DSToastWithSchema = DSToast.DSToastWithSchema;
|
|
15
|
+
exports["default"] = DSToast.DSToast;
|
|
16
|
+
exports.toast = toast.toast;
|
|
17
|
+
exports.ToastType = ToastType.ToastType;
|
|
18
|
+
exports.toastTypes = ToastType.toastTypes;
|
|
19
|
+
exports.ToastPosition = ToastPosition.ToastPosition;
|
|
20
|
+
exports.toastsPositions = ToastPosition.toastsPositions;
|
|
21
|
+
exports.DSToastAction = ToastAction.DSToastAction;
|
|
22
|
+
exports.DSToastActionLink = ToastAction.DSToastActionLink;
|
|
23
|
+
exports.DSToastActionLinkWithSchema = ToastAction.DSToastActionLinkWithSchema;
|
|
24
|
+
exports.DSToastActionWithSchema = ToastAction.DSToastActionWithSchema;
|