@elliemae/ds-toast 2.2.0 → 2.3.0-alpha.3

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 CHANGED
@@ -1,102 +1,86 @@
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
- });
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
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 });
43
11
  };
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
- }));
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;
70
19
  };
71
-
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 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 = require("react-desc");
37
+ var import_react_toastify = require("react-toastify");
38
+ var import_ds_icons = require("@elliemae/ds-icons");
39
+ var import_ds_button = __toESM(require("@elliemae/ds-button"));
40
+ var import_ToastPosition = 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
+ });
72
71
  const props = {
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')
72
+ containerProps: import_react_desc.PropTypes.object.description("inject props to wrapper"),
73
+ position: import_react_desc.PropTypes.oneOf(import_ToastPosition.toastsPositions).description("Position on the screen to show the toast"),
74
+ autoClose: import_react_desc.PropTypes.number.description("ms to autoclose the toast"),
75
+ showProgressBar: import_react_desc.PropTypes.bool.description("Whether to show a progress bar indicating when the toast is going to be closed"),
76
+ closeOnClick: import_react_desc.PropTypes.bool.description("Close toast handler"),
77
+ enableMultiContainer: import_react_desc.PropTypes.bool.description("Allows instantiating multiple Toast containers"),
78
+ containerId: import_react_desc.PropTypes.oneOfType([import_react_desc.PropTypes.string, import_react_desc.PropTypes.number]).description("unique id for multi container"),
79
+ toastId: import_react_desc.PropTypes.oneOfType([import_react_desc.PropTypes.string, import_react_desc.PropTypes.number]).description("id for the toast")
96
80
  };
97
- const DSToastWithSchema = reactDesc.describe(DSToast);
81
+ DSToast.propTypes = props;
82
+ const DSToastWithSchema = (0, import_react_desc.describe)(DSToast);
98
83
  DSToastWithSchema.propTypes = props;
99
-
100
- exports.DSToast = DSToast;
101
- exports.DSToastWithSchema = DSToastWithSchema;
102
- exports["default"] = DSToast;
84
+ var DSToast_default = DSToast;
85
+ module.exports = __toCommonJS(DSToast_exports);
86
+ //# sourceMappingURL=DSToast.js.map
@@ -0,0 +1,7 @@
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
+ }
@@ -1,67 +1,67 @@
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);
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
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 });
43
11
  };
44
-
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 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 = require("react-desc");
38
+ var import_styled_components = __toESM(require("styled-components"));
39
+ var import_ds_system = 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);
45
49
  const actionprops = {
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')
50
+ children: import_react_desc.PropTypes.oneOfType([
51
+ import_react_desc.PropTypes.string,
52
+ import_react_desc.PropTypes.element
53
+ ]).description("DSToastActionLink component or text string"),
54
+ onClick: import_react_desc.PropTypes.func.description("click handler"),
55
+ onKeyDown: import_react_desc.PropTypes.func.description("key down handler")
54
56
  };
55
57
  const linkprops = {
56
- /** link text */
57
- children: reactDesc.PropTypes.string.isRequired.description('link text')
58
+ children: import_react_desc.PropTypes.string.isRequired.description("link text")
58
59
  };
59
- const DSToastActionWithSchema = reactDesc.describe(DSToastAction);
60
- const DSToastActionLinkWithSchema = reactDesc.describe(DSToastActionLink);
60
+ DSToastAction.propTypes = actionprops;
61
+ DSToastActionLink.propTypes = linkprops;
62
+ const DSToastActionWithSchema = (0, import_react_desc.describe)(DSToastAction);
63
+ const DSToastActionLinkWithSchema = (0, import_react_desc.describe)(DSToastActionLink);
61
64
  DSToastActionLinkWithSchema.propTypes = linkprops;
62
65
  DSToastActionWithSchema.propTypes = actionprops;
63
-
64
- exports.DSToastAction = DSToastAction;
65
- exports.DSToastActionLink = DSToastActionLink;
66
- exports.DSToastActionLinkWithSchema = DSToastActionLinkWithSchema;
67
- exports.DSToastActionWithSchema = DSToastActionWithSchema;
66
+ module.exports = __toCommonJS(ToastAction_exports);
67
+ //# sourceMappingURL=ToastAction.js.map
@@ -0,0 +1,7 @@
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
+ }
@@ -1,16 +1,44 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
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"));
5
34
  const ToastPosition = {
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'
35
+ TOP_RIGHT: "top-right",
36
+ TOP_CENTER: "top-center",
37
+ TOP_LEFT: "top-left",
38
+ BOTTOM_RIGHT: "bottom-right",
39
+ BOTTOM_CENTER: "bottom-center",
40
+ BOTTOM_LEFT: "bottom-left"
12
41
  };
13
42
  const toastsPositions = Object.values(ToastPosition);
14
-
15
- exports.ToastPosition = ToastPosition;
16
- exports.toastsPositions = toastsPositions;
43
+ module.exports = __toCommonJS(ToastPosition_exports);
44
+ //# sourceMappingURL=ToastPosition.js.map
@@ -0,0 +1,7 @@
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
+ }
@@ -1,42 +1,66 @@
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'
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
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 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 = require("@elliemae/ds-classnames");
36
+ var import_ds_icons = require("@elliemae/ds-icons");
37
+ var import_ToastType = 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"
26
50
  })[type];
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, {
51
+ const ToastRender = ({ type = import_ToastType.ToastType.DEFAULT, messageTitle = "", messageText = "" }) => {
52
+ const IconMessage = (0, import_ds_classnames.aggregatedClasses)(getIconByToastType(type))(blockName, "icon-message");
53
+ return /* @__PURE__ */ import_react.default.createElement(Container, {
36
54
  "data-testid": "ds-toast-render"
37
- }, void 0, /*#__PURE__*/_jsx__default["default"](IconContainer, {}, void 0, /*#__PURE__*/_jsx__default["default"](IconMessage, {
55
+ }, /* @__PURE__ */ import_react.default.createElement(IconContainer, null, /* @__PURE__ */ import_react.default.createElement(IconMessage, {
38
56
  size: "m"
39
- })), /*#__PURE__*/_jsx__default["default"](MessageContent, {}, void 0, /*#__PURE__*/_jsx__default["default"](MessageHeader, {}, void 0, messageTitle), /*#__PURE__*/_jsx__default["default"](MessageText, {}, void 0, messageText)));
57
+ })), /* @__PURE__ */ import_react.default.createElement(MessageContent, null, /* @__PURE__ */ import_react.default.createElement(MessageHeader, null, messageTitle), /* @__PURE__ */ import_react.default.createElement(MessageText, null, messageText)));
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
40
63
  };
41
-
42
- module.exports = ToastRender;
64
+ var ToastRender_default = ToastRender;
65
+ module.exports = __toCommonJS(ToastRender_exports);
66
+ //# sourceMappingURL=ToastRender.js.map
@@ -0,0 +1,7 @@
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 CHANGED
@@ -1,16 +1,43 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
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"));
5
34
  const ToastType = {
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'
35
+ INFO: "info",
36
+ SUCCESS: "success",
37
+ WARNING: "warning",
38
+ ERROR: "error",
39
+ DEFAULT: "default"
12
40
  };
13
41
  const toastTypes = Object.values(ToastType);
14
-
15
- exports.ToastType = ToastType;
16
- exports.toastTypes = toastTypes;
42
+ module.exports = __toCommonJS(ToastType_exports);
43
+ //# sourceMappingURL=ToastType.js.map
@@ -0,0 +1,7 @@
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
+ }