@elliemae/ds-toast 2.3.1 → 3.0.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.
Files changed (50) hide show
  1. package/dist/cjs/DSToast.js +102 -0
  2. package/dist/cjs/DSToast.js.map +7 -0
  3. package/dist/cjs/ToastAction.js +67 -0
  4. package/dist/cjs/ToastAction.js.map +7 -0
  5. package/dist/cjs/ToastPosition.js +44 -0
  6. package/dist/cjs/ToastPosition.js.map +7 -0
  7. package/dist/cjs/ToastRender.js +66 -0
  8. package/dist/cjs/ToastRender.js.map +7 -0
  9. package/dist/cjs/ToastType.js +43 -0
  10. package/dist/cjs/ToastType.js.map +7 -0
  11. package/dist/cjs/index.js +40 -0
  12. package/dist/cjs/index.js.map +7 -0
  13. package/dist/cjs/toast.js +76 -0
  14. package/dist/cjs/toast.js.map +7 -0
  15. package/dist/esm/DSToast.js +75 -0
  16. package/dist/esm/DSToast.js.map +7 -0
  17. package/dist/esm/ToastAction.js +38 -0
  18. package/dist/esm/ToastAction.js.map +7 -0
  19. package/dist/esm/ToastPosition.js +15 -0
  20. package/dist/esm/ToastPosition.js.map +7 -0
  21. package/dist/esm/ToastRender.js +37 -0
  22. package/dist/esm/ToastRender.js.map +7 -0
  23. package/dist/esm/ToastType.js +14 -0
  24. package/dist/esm/ToastType.js.map +7 -0
  25. package/dist/esm/index.js +11 -0
  26. package/dist/esm/index.js.map +7 -0
  27. package/dist/esm/toast.js +49 -0
  28. package/dist/esm/toast.js.map +7 -0
  29. package/package.json +40 -31
  30. package/cjs/DSToast.js +0 -102
  31. package/cjs/ToastAction.js +0 -67
  32. package/cjs/ToastPosition.js +0 -16
  33. package/cjs/ToastRender.js +0 -42
  34. package/cjs/ToastType.js +0 -16
  35. package/cjs/index.js +0 -24
  36. package/cjs/toast.js +0 -47
  37. package/esm/DSToast.js +0 -90
  38. package/esm/ToastAction.js +0 -55
  39. package/esm/ToastPosition.js +0 -11
  40. package/esm/ToastRender.js +0 -36
  41. package/esm/ToastType.js +0 -11
  42. package/esm/index.js +0 -5
  43. package/esm/toast.js +0 -37
  44. package/types/DSToast.d.ts +0 -79
  45. package/types/ToastAction.d.ts +0 -52
  46. package/types/ToastPosition.d.ts +0 -9
  47. package/types/ToastRender.d.ts +0 -24
  48. package/types/ToastType.d.ts +0 -8
  49. package/types/index.d.ts +0 -6
  50. package/types/toast.d.ts +0 -38
@@ -0,0 +1,38 @@
1
+ import * as React from "react";
2
+ import React2 from "react";
3
+ import { PropTypes, describe } from "react-desc";
4
+ import styled from "styled-components";
5
+ import { color } from "@elliemae/ds-system";
6
+ const Link = styled.span`
7
+ ${color("brand", "600")}
8
+ `;
9
+ const DSToastAction = ({ children, onClick, onKeyDown }) => /* @__PURE__ */ React2.createElement("div", {
10
+ onKeyDown,
11
+ onClick,
12
+ role: onClick ? "button" : "textbox"
13
+ }, children);
14
+ const DSToastActionLink = ({ children }) => /* @__PURE__ */ React2.createElement(Link, null, children);
15
+ const actionprops = {
16
+ children: PropTypes.oneOfType([
17
+ PropTypes.string,
18
+ PropTypes.element
19
+ ]).description("DSToastActionLink component or text string"),
20
+ onClick: PropTypes.func.description("click handler"),
21
+ onKeyDown: PropTypes.func.description("key down handler")
22
+ };
23
+ const linkprops = {
24
+ children: PropTypes.string.isRequired.description("link text")
25
+ };
26
+ DSToastAction.propTypes = actionprops;
27
+ DSToastActionLink.propTypes = linkprops;
28
+ const DSToastActionWithSchema = describe(DSToastAction);
29
+ const DSToastActionLinkWithSchema = describe(DSToastActionLink);
30
+ DSToastActionLinkWithSchema.propTypes = linkprops;
31
+ DSToastActionWithSchema.propTypes = actionprops;
32
+ export {
33
+ DSToastAction,
34
+ DSToastActionLink,
35
+ DSToastActionLinkWithSchema,
36
+ DSToastActionWithSchema
37
+ };
38
+ //# sourceMappingURL=ToastAction.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/ToastAction.tsx"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "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"],
5
+ "mappings": "AAAA;ACAA;AACA;AACA;AACA;AAEA,MAAM,OAAO,OAAO;AAAA,IAChB,MAAM,SAAS;AAAA;AAGnB,MAAM,gBAAgB,CAAC,EAAE,UAAU,SAAS,gBAE1C,qCAAC,OAAD;AAAA,EACE;AAAA,EACA;AAAA,EACA,MAAM,UAAU,WAAW;AAAA,GAE1B;AAKL,MAAM,oBAAoB,CAAC,EAAE,eAAe,qCAAC,MAAD,MAAO;AAEnD,MAAM,cAAc;AAAA,EAElB,UAAU,UAAU,UAAU;AAAA,IAC5B,UAAU;AAAA,IACV,UAAU;AAAA,KACT,YAAY;AAAA,EAEf,SAAS,UAAU,KAAK,YAAY;AAAA,EAEpC,WAAW,UAAU,KAAK,YAAY;AAAA;AAGxC,MAAM,YAAY;AAAA,EAEhB,UAAU,UAAU,OAAO,WAAW,YAAY;AAAA;AAGpD,cAAc,YAAY;AAC1B,kBAAkB,YAAY;AAC9B,MAAM,0BAA0B,SAAS;AACzC,MAAM,8BAA8B,SAAS;AAC7C,4BAA4B,YAAY;AACxC,wBAAwB,YAAY;",
6
+ "names": []
7
+ }
@@ -0,0 +1,15 @@
1
+ import * as React from "react";
2
+ const ToastPosition = {
3
+ TOP_RIGHT: "top-right",
4
+ TOP_CENTER: "top-center",
5
+ TOP_LEFT: "top-left",
6
+ BOTTOM_RIGHT: "bottom-right",
7
+ BOTTOM_CENTER: "bottom-center",
8
+ BOTTOM_LEFT: "bottom-left"
9
+ };
10
+ const toastsPositions = Object.values(ToastPosition);
11
+ export {
12
+ ToastPosition,
13
+ toastsPositions
14
+ };
15
+ //# sourceMappingURL=ToastPosition.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/ToastPosition.tsx"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "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"],
5
+ "mappings": "AAAA;ACAO,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
+ }
@@ -0,0 +1,37 @@
1
+ import * as React from "react";
2
+ import React2 from "react";
3
+ import PropTypes from "prop-types";
4
+ import { aggregatedClasses } from "@elliemae/ds-classnames";
5
+ import { CheckmarkCircleFill, WarningCircleFill, InfoCircleFill } from "@elliemae/ds-icons";
6
+ import { ToastType, toastTypes } from "./ToastType";
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
+ const getIconByToastType = (type) => ({
14
+ [ToastType.SUCCESS]: CheckmarkCircleFill,
15
+ [ToastType.WARNING]: WarningCircleFill,
16
+ [ToastType.INFO]: InfoCircleFill,
17
+ [ToastType.ERROR]: WarningCircleFill,
18
+ [ToastType.DEFAULT]: "div"
19
+ })[type];
20
+ const ToastRender = ({ type = ToastType.DEFAULT, messageTitle = "", messageText = "" }) => {
21
+ const IconMessage = aggregatedClasses(getIconByToastType(type))(blockName, "icon-message");
22
+ return /* @__PURE__ */ React2.createElement(Container, {
23
+ "data-testid": "ds-toast-render"
24
+ }, /* @__PURE__ */ React2.createElement(IconContainer, null, /* @__PURE__ */ React2.createElement(IconMessage, {
25
+ size: "m"
26
+ })), /* @__PURE__ */ React2.createElement(MessageContent, null, /* @__PURE__ */ React2.createElement(MessageHeader, null, messageTitle), /* @__PURE__ */ React2.createElement(MessageText, null, messageText)));
27
+ };
28
+ ToastRender.propTypes = {
29
+ messageTitle: PropTypes.string.isRequired,
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
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/ToastRender.tsx"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "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"],
5
+ "mappings": "AAAA;ACAA;AACA;AACA;AACA;AACA;AAEA,MAAM,YAAY;AAClB,MAAM,YAAY,kBAAkB,OAAO;AAC3C,MAAM,gBAAgB,kBAAkB,OAAO,WAAW;AAC1D,MAAM,iBAAiB,kBAAkB,OAAO,WAAW;AAC3D,MAAM,gBAAgB,kBAAkB,OAAO,WAAW;AAC1D,MAAM,cAAc,kBAAkB,QAAQ,WAAW;AAEzD,MAAM,qBAAqB,CAAC,SACzB;AAAA,GACE,UAAU,UAAU;AAAA,GACpB,UAAU,UAAU;AAAA,GACpB,UAAU,OAAO;AAAA,GACjB,UAAU,QAAQ;AAAA,GAClB,UAAU,UAAU;AAAA,GACrB;AAEJ,MAAM,cAAc,CAAC,EAAE,OAAO,UAAU,SAAS,eAAe,IAAI,cAAc,SAAS;AACzF,QAAM,cAAc,kBAAkB,mBAAmB,OAAO,WAAW;AAC3E,SACE,qCAAC,WAAD;AAAA,IAAW,eAAY;AAAA,KACrB,qCAAC,eAAD,MACE,qCAAC,aAAD;AAAA,IAAa,MAAK;AAAA,OAEpB,qCAAC,gBAAD,MACE,qCAAC,eAAD,MAAgB,eAChB,qCAAC,aAAD,MAAc;AAAA;AAMtB,YAAY,YAAY;AAAA,EAItB,cAAc,UAAU,OAAO;AAAA,EAI/B,aAAa,UAAU,UAAU,CAAC,UAAU,QAAQ,UAAU;AAAA,EAI9D,MAAM,UAAU,MAAM,YAAY;AAAA;AAGpC,IAAO,sBAAQ;",
6
+ "names": []
7
+ }
@@ -0,0 +1,14 @@
1
+ import * as React from "react";
2
+ const ToastType = {
3
+ INFO: "info",
4
+ SUCCESS: "success",
5
+ WARNING: "warning",
6
+ ERROR: "error",
7
+ DEFAULT: "default"
8
+ };
9
+ const toastTypes = Object.values(ToastType);
10
+ export {
11
+ ToastType,
12
+ toastTypes
13
+ };
14
+ //# sourceMappingURL=ToastType.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/ToastType.tsx"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "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"],
5
+ "mappings": "AAAA;ACAO,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
+ }
@@ -0,0 +1,11 @@
1
+ import * as React from "react";
2
+ export * from "./DSToast";
3
+ export * from "./toast";
4
+ export * from "./ToastType";
5
+ export * from "./ToastPosition";
6
+ export * from "./ToastAction";
7
+ import { default as default2 } from "./DSToast";
8
+ export {
9
+ default2 as default
10
+ };
11
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/index.tsx"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "export * from './DSToast';\nexport * from './toast';\nexport * from './ToastType';\nexport * from './ToastPosition';\nexport * from './ToastAction';\n\nexport { default } from './DSToast';\n"],
5
+ "mappings": "AAAA;ACAA;AACA;AACA;AACA;AACA;AAEA;",
6
+ "names": []
7
+ }
@@ -0,0 +1,49 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __defProps = Object.defineProperties;
3
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
4
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
7
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8
+ var __spreadValues = (a, b) => {
9
+ for (var prop in b || (b = {}))
10
+ if (__hasOwnProp.call(b, prop))
11
+ __defNormalProp(a, prop, b[prop]);
12
+ if (__getOwnPropSymbols)
13
+ for (var prop of __getOwnPropSymbols(b)) {
14
+ if (__propIsEnum.call(b, prop))
15
+ __defNormalProp(a, prop, b[prop]);
16
+ }
17
+ return a;
18
+ };
19
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
+ var __objRest = (source, exclude) => {
21
+ var target = {};
22
+ for (var prop in source)
23
+ if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
24
+ target[prop] = source[prop];
25
+ if (source != null && __getOwnPropSymbols)
26
+ for (var prop of __getOwnPropSymbols(source)) {
27
+ if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
28
+ target[prop] = source[prop];
29
+ }
30
+ return target;
31
+ };
32
+ import * as React from "react";
33
+ import React2 from "react";
34
+ import { toast as toastifyToast } from "react-toastify";
35
+ import ToastRender from "./ToastRender";
36
+ const toast = Object.assign((_a, options) => {
37
+ var _b = _a, { type, messageTitle, messageText } = _b, rest = __objRest(_b, ["type", "messageTitle", "messageText"]);
38
+ return toastifyToast(/* @__PURE__ */ React2.createElement(ToastRender, {
39
+ messageText,
40
+ messageTitle,
41
+ type
42
+ }), __spreadProps(__spreadValues(__spreadValues({}, rest), options), {
43
+ type
44
+ }));
45
+ }, __spreadProps(__spreadValues({}, toastifyToast), { isActive: (id) => toastifyToast.isActive(id) }));
46
+ export {
47
+ toast
48
+ };
49
+ //# sourceMappingURL=toast.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/toast.tsx"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React from 'react';\nimport { toast as toastifyToast } from 'react-toastify';\nimport ToastRender from './ToastRender';\n\nconst toast = Object.assign(\n ({ type, messageTitle, messageText, ...rest }, options) =>\n toastifyToast(\n <ToastRender\n messageText={messageText}\n messageTitle={messageTitle}\n type={type}\n />,\n {\n ...rest,\n ...options,\n type,\n },\n ),\n { ...toastifyToast, isActive: (id) => toastifyToast.isActive(id) },\n);\nexport { toast };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;ACAA;AACA;AACA;AAEA,MAAM,QAAQ,OAAO,OACnB,CAAC,IAA8C,YAAS;AAAvD,eAAE,QAAM,cAAc,gBAAtB,IAAsC,iBAAtC,IAAsC,CAApC,QAAM,gBAAc;AACrB,uBACE,qCAAC,aAAD;AAAA,IACE;AAAA,IACA;AAAA,IACA;AAAA,MAEF,gDACK,OACA,UAFL;AAAA,IAGE;AAAA;AAAA,GAGN,iCAAK,gBAAL,EAAoB,UAAU,CAAC,OAAO,cAAc,SAAS;",
6
+ "names": []
7
+ }
package/package.json CHANGED
@@ -1,39 +1,42 @@
1
1
  {
2
2
  "name": "@elliemae/ds-toast",
3
- "version": "2.3.1",
3
+ "version": "3.0.0-alpha.3",
4
4
  "license": "MIT",
5
5
  "description": "ICE MT - Dimsum - Toast",
6
- "module": "./esm/index.js",
7
- "main": "./cjs/index.js",
8
- "types": "./types/index.d.ts",
6
+ "files": [
7
+ "dist"
8
+ ],
9
+ "module": "./dist/esm/index.js",
10
+ "main": "./dist/cjs/index.js",
11
+ "types": "./dist/types/index.d.ts",
9
12
  "exports": {
10
13
  ".": {
11
- "import": "./esm/index.js",
12
- "require": "./cjs/index.js"
14
+ "import": "./dist/esm/index.js",
15
+ "require": "./dist/cjs/index.js"
13
16
  },
14
17
  "./ToastType": {
15
- "import": "./esm/ToastType.js",
16
- "require": "./cjs/ToastType.js"
18
+ "import": "./dist/esm/ToastType.js",
19
+ "require": "./dist/cjs/ToastType.js"
17
20
  },
18
21
  "./ToastRender": {
19
- "import": "./esm/ToastRender.js",
20
- "require": "./cjs/ToastRender.js"
22
+ "import": "./dist/esm/ToastRender.js",
23
+ "require": "./dist/cjs/ToastRender.js"
21
24
  },
22
25
  "./ToastPosition": {
23
- "import": "./esm/ToastPosition.js",
24
- "require": "./cjs/ToastPosition.js"
26
+ "import": "./dist/esm/ToastPosition.js",
27
+ "require": "./dist/cjs/ToastPosition.js"
25
28
  },
26
29
  "./ToastAction": {
27
- "import": "./esm/ToastAction.js",
28
- "require": "./cjs/ToastAction.js"
30
+ "import": "./dist/esm/ToastAction.js",
31
+ "require": "./dist/cjs/ToastAction.js"
29
32
  },
30
33
  "./toast": {
31
- "import": "./esm/toast.js",
32
- "require": "./cjs/toast.js"
34
+ "import": "./dist/esm/toast.js",
35
+ "require": "./dist/cjs/toast.js"
33
36
  },
34
37
  "./DSToast": {
35
- "import": "./esm/DSToast.js",
36
- "require": "./cjs/DSToast.js"
38
+ "import": "./dist/esm/DSToast.js",
39
+ "require": "./dist/cjs/DSToast.js"
37
40
  }
38
41
  },
39
42
  "sideEffects": [
@@ -45,21 +48,21 @@
45
48
  "url": "https://git.elliemae.io/platform-ui/dimsum.git"
46
49
  },
47
50
  "engines": {
48
- "npm": ">=7",
49
- "node": ">=14"
51
+ "pnpm": ">=6",
52
+ "node": ">=16"
50
53
  },
51
54
  "author": "ICE MT",
52
- "scripts": {
53
- "dev": "cross-env NODE_ENV=development && node ../../scripts/build/build.js -w",
54
- "prebuild": "exit 0",
55
- "predev": "exit 0",
56
- "build": "node ../../scripts/build/build.js"
55
+ "jestSonar": {
56
+ "sonar56x": true,
57
+ "reportPath": "reports",
58
+ "reportFile": "tests.xml",
59
+ "indent": 4
57
60
  },
58
61
  "dependencies": {
59
- "@elliemae/ds-button": "2.3.1",
60
- "@elliemae/ds-classnames": "2.3.1",
61
- "@elliemae/ds-icons": "2.3.1",
62
- "@elliemae/ds-system": "2.3.1",
62
+ "@elliemae/ds-button": "3.0.0-alpha.3",
63
+ "@elliemae/ds-classnames": "3.0.0-alpha.3",
64
+ "@elliemae/ds-icons": "3.0.0-alpha.3",
65
+ "@elliemae/ds-system": "3.0.0-alpha.3",
63
66
  "prop-types": "~15.7.2",
64
67
  "react-desc": "~4.1.3",
65
68
  "react-toastify": "~6.2.0"
@@ -75,7 +78,13 @@
75
78
  },
76
79
  "publishConfig": {
77
80
  "access": "public",
78
- "directory": "dist",
79
- "generateSubmodules": true
81
+ "typeSafety": false
82
+ },
83
+ "scripts": {
84
+ "dev": "cross-env NODE_ENV=development node ../../scripts/build/build.mjs --watch",
85
+ "test": "node ../../scripts/testing/test.mjs",
86
+ "lint": "node ../../scripts/lint.mjs",
87
+ "dts": "node ../../scripts/dts.mjs",
88
+ "build": "cross-env NODE_ENV=production node ../../scripts/build/build.mjs"
80
89
  }
81
90
  }
package/cjs/DSToast.js DELETED
@@ -1,102 +0,0 @@
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
- });
43
- };
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
- }));
70
- };
71
-
72
- 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')
96
- };
97
- const DSToastWithSchema = reactDesc.describe(DSToast);
98
- DSToastWithSchema.propTypes = props;
99
-
100
- exports.DSToast = DSToast;
101
- exports.DSToastWithSchema = DSToastWithSchema;
102
- exports["default"] = DSToast;
@@ -1,67 +0,0 @@
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);
43
- };
44
-
45
- 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')
54
- };
55
- const linkprops = {
56
- /** link text */
57
- children: reactDesc.PropTypes.string.isRequired.description('link text')
58
- };
59
- const DSToastActionWithSchema = reactDesc.describe(DSToastAction);
60
- const DSToastActionLinkWithSchema = reactDesc.describe(DSToastActionLink);
61
- DSToastActionLinkWithSchema.propTypes = linkprops;
62
- DSToastActionWithSchema.propTypes = actionprops;
63
-
64
- exports.DSToastAction = DSToastAction;
65
- exports.DSToastActionLink = DSToastActionLink;
66
- exports.DSToastActionLinkWithSchema = DSToastActionLinkWithSchema;
67
- exports.DSToastActionWithSchema = DSToastActionWithSchema;
@@ -1,16 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- 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'
12
- };
13
- const toastsPositions = Object.values(ToastPosition);
14
-
15
- exports.ToastPosition = ToastPosition;
16
- exports.toastsPositions = toastsPositions;
@@ -1,42 +0,0 @@
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'
26
- })[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, {
36
- "data-testid": "ds-toast-render"
37
- }, void 0, /*#__PURE__*/_jsx__default["default"](IconContainer, {}, void 0, /*#__PURE__*/_jsx__default["default"](IconMessage, {
38
- 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)));
40
- };
41
-
42
- module.exports = ToastRender;
package/cjs/ToastType.js DELETED
@@ -1,16 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- 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'
12
- };
13
- const toastTypes = Object.values(ToastType);
14
-
15
- exports.ToastType = ToastType;
16
- exports.toastTypes = toastTypes;
package/cjs/index.js DELETED
@@ -1,24 +0,0 @@
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;