@elliemae/ds-legacy-toast 1.0.0-rc.1

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 (63) hide show
  1. package/dist/cjs/DSToastDefinitions.js +68 -0
  2. package/dist/cjs/DSToastDefinitions.js.map +7 -0
  3. package/dist/cjs/config/useToast.js +81 -0
  4. package/dist/cjs/config/useToast.js.map +7 -0
  5. package/dist/cjs/constants.js +79 -0
  6. package/dist/cjs/constants.js.map +7 -0
  7. package/dist/cjs/index.js +62 -0
  8. package/dist/cjs/index.js.map +7 -0
  9. package/dist/cjs/package.json +7 -0
  10. package/dist/cjs/parts/CloseButton.js +52 -0
  11. package/dist/cjs/parts/CloseButton.js.map +7 -0
  12. package/dist/cjs/parts/DSToast.js +84 -0
  13. package/dist/cjs/parts/DSToast.js.map +7 -0
  14. package/dist/cjs/parts/DSToastAction.js +63 -0
  15. package/dist/cjs/parts/DSToastAction.js.map +7 -0
  16. package/dist/cjs/parts/DSToastActionLink.js +44 -0
  17. package/dist/cjs/parts/DSToastActionLink.js.map +7 -0
  18. package/dist/cjs/parts/DSToastContent.js +57 -0
  19. package/dist/cjs/parts/DSToastContent.js.map +7 -0
  20. package/dist/cjs/parts/styled.js +379 -0
  21. package/dist/cjs/parts/styled.js.map +7 -0
  22. package/dist/cjs/react-desc-prop-types.js +78 -0
  23. package/dist/cjs/react-desc-prop-types.js.map +7 -0
  24. package/dist/cjs/toast.js +46 -0
  25. package/dist/cjs/toast.js.map +7 -0
  26. package/dist/esm/DSToastDefinitions.js +38 -0
  27. package/dist/esm/DSToastDefinitions.js.map +7 -0
  28. package/dist/esm/config/useToast.js +51 -0
  29. package/dist/esm/config/useToast.js.map +7 -0
  30. package/dist/esm/constants.js +49 -0
  31. package/dist/esm/constants.js.map +7 -0
  32. package/dist/esm/index.js +42 -0
  33. package/dist/esm/index.js.map +7 -0
  34. package/dist/esm/package.json +7 -0
  35. package/dist/esm/parts/CloseButton.js +22 -0
  36. package/dist/esm/parts/CloseButton.js.map +7 -0
  37. package/dist/esm/parts/DSToast.js +54 -0
  38. package/dist/esm/parts/DSToast.js.map +7 -0
  39. package/dist/esm/parts/DSToastAction.js +38 -0
  40. package/dist/esm/parts/DSToastAction.js.map +7 -0
  41. package/dist/esm/parts/DSToastActionLink.js +14 -0
  42. package/dist/esm/parts/DSToastActionLink.js.map +7 -0
  43. package/dist/esm/parts/DSToastContent.js +33 -0
  44. package/dist/esm/parts/DSToastContent.js.map +7 -0
  45. package/dist/esm/parts/styled.js +356 -0
  46. package/dist/esm/parts/styled.js.map +7 -0
  47. package/dist/esm/react-desc-prop-types.js +48 -0
  48. package/dist/esm/react-desc-prop-types.js.map +7 -0
  49. package/dist/esm/toast.js +16 -0
  50. package/dist/esm/toast.js.map +7 -0
  51. package/dist/types/DSToastDefinitions.d.ts +23 -0
  52. package/dist/types/config/useToast.d.ts +9 -0
  53. package/dist/types/constants.d.ts +31 -0
  54. package/dist/types/index.d.ts +7 -0
  55. package/dist/types/parts/CloseButton.d.ts +8 -0
  56. package/dist/types/parts/DSToast.d.ts +6 -0
  57. package/dist/types/parts/DSToastAction.d.ts +5 -0
  58. package/dist/types/parts/DSToastContent.d.ts +11 -0
  59. package/dist/types/react-desc-prop-types.d.ts +42 -0
  60. package/dist/types/tests/toast-axe.test.d.ts +1 -0
  61. package/dist/types/tests/toast-render.test.d.ts +1 -0
  62. package/dist/types/toast.d.ts +35 -0
  63. package/package.json +96 -0
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../src/DSToastDefinitions.ts"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { slotObjectToDataTestIds } from '@elliemae/ds-legacy-system';\n\nexport const DSToastName = 'DSToast';\n\nexport const DSToastActionLinkName = 'DSToastActionLink';\n\nexport const DSToastActionName = 'DSToastAction';\n\nexport const DSToastSlots = {\n ROOT: 'root',\n CLOSE_BUTTON: 'close-button',\n CONTAINER: 'container',\n ICON_CONTAINER: 'icon-container',\n MESSAGE_CONTENT: 'message-content',\n MESSAGE_HEADER: 'message-header',\n MESSAGE_TEXT: 'message-text',\n};\n\nexport const DSToastActionSlots = {\n ROOT: 'root',\n};\n\nexport const DSToastActionLinkSlots = {\n ROOT: 'root',\n};\n\nexport const DSToastDataTestIds = {\n ...slotObjectToDataTestIds(DSToastName, DSToastSlots),\n CONTAINER: 'ds-toast-render',\n};\n\nexport const DSToastActionDataTestIds = slotObjectToDataTestIds(DSToastActionName, DSToastActionSlots);\n\nexport const DSToastActionLinkDataTestIds = slotObjectToDataTestIds(DSToastActionLinkName, DSToastActionLinkSlots);\n"],
5
+ "mappings": "AAAA,YAAY,WAAW;ACAvB,SAAS,+BAA+B;AAEjC,MAAM,cAAc;AAEpB,MAAM,wBAAwB;AAE9B,MAAM,oBAAoB;AAE1B,MAAM,eAAe;AAAA,EAC1B,MAAM;AAAA,EACN,cAAc;AAAA,EACd,WAAW;AAAA,EACX,gBAAgB;AAAA,EAChB,iBAAiB;AAAA,EACjB,gBAAgB;AAAA,EAChB,cAAc;AAChB;AAEO,MAAM,qBAAqB;AAAA,EAChC,MAAM;AACR;AAEO,MAAM,yBAAyB;AAAA,EACpC,MAAM;AACR;AAEO,MAAM,qBAAqB;AAAA,EAChC,GAAG,wBAAwB,aAAa,YAAY;AAAA,EACpD,WAAW;AACb;AAEO,MAAM,2BAA2B,wBAAwB,mBAAmB,kBAAkB;AAE9F,MAAM,+BAA+B,wBAAwB,uBAAuB,sBAAsB;",
6
+ "names": []
7
+ }
@@ -0,0 +1,51 @@
1
+ import * as React from "react";
2
+ import { useGetGlobalAttributes, useGetXstyledProps, useMemoMergePropsWithDefault } from "@elliemae/ds-legacy-props-helpers";
3
+ import { useRef } from "react";
4
+ import { omit } from "lodash";
5
+ import { defaultProps } from "../react-desc-prop-types.js";
6
+ const useToast = (props) => {
7
+ const propsWithDefault = useMemoMergePropsWithDefault(props, defaultProps);
8
+ const globalAttributes = useGetGlobalAttributes(propsWithDefault);
9
+ const xstyledAttributes = useGetXstyledProps(omit(propsWithDefault, "position"));
10
+ const toastifyWrapperRef = useRef(null);
11
+ const onKeyDown = (event) => {
12
+ if (event.key === "Tab") {
13
+ event.preventDefault();
14
+ event.stopPropagation();
15
+ const closeButton = document.querySelector(".toast-close-button");
16
+ const actions = [...document.querySelectorAll('.toast-action-text[role="button"]')];
17
+ const activeElement = document.activeElement;
18
+ if (closeButton === activeElement) {
19
+ if (actions.length === 0)
20
+ return;
21
+ if (event.shiftKey)
22
+ actions[actions.length - 1].focus();
23
+ else
24
+ actions[0].focus();
25
+ }
26
+ const index = actions.indexOf(activeElement);
27
+ if (event.shiftKey) {
28
+ if (index === 0)
29
+ closeButton.focus();
30
+ else
31
+ actions[index - 1].focus();
32
+ } else {
33
+ if (index === actions.length - 1)
34
+ closeButton.focus();
35
+ else
36
+ actions[index + 1].focus();
37
+ }
38
+ }
39
+ };
40
+ return {
41
+ propsWithDefault,
42
+ toastifyWrapperRef,
43
+ onKeyDown,
44
+ globalAttributes,
45
+ xstyledAttributes
46
+ };
47
+ };
48
+ export {
49
+ useToast
50
+ };
51
+ //# sourceMappingURL=useToast.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../src/config/useToast.ts"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { useGetGlobalAttributes, useGetXstyledProps, useMemoMergePropsWithDefault } from '@elliemae/ds-legacy-props-helpers';\nimport { useRef } from 'react';\nimport { omit } from 'lodash';\nimport type { DSToastT } from '../react-desc-prop-types.js';\nimport { defaultProps } from '../react-desc-prop-types.js';\n\nexport const useToast = (props: DSToastT.Props) => {\n const propsWithDefault = useMemoMergePropsWithDefault<DSToastT.InternalProps>(props, defaultProps);\n\n const globalAttributes = useGetGlobalAttributes(propsWithDefault);\n\n const xstyledAttributes = useGetXstyledProps(omit(propsWithDefault, 'position'));\n\n const toastifyWrapperRef = useRef<HTMLDivElement | null>(null);\n\n const onKeyDown = (event: React.KeyboardEvent<HTMLDivElement>) => {\n if (event.key === 'Tab') {\n event.preventDefault();\n event.stopPropagation();\n\n const closeButton = document.querySelector('.toast-close-button') as HTMLButtonElement;\n const actions = [...document.querySelectorAll('.toast-action-text[role=\"button\"]')] as HTMLDivElement[];\n\n const activeElement = document.activeElement;\n\n // If the close button is focused\n // 1) No actions => we keep the focus on the close button\n // 2) Shift + Tab => we focus the last action\n // 3) Tab => we focus the first action\n if (closeButton === activeElement) {\n if (actions.length === 0) return; // We keep the focus on the close button\n if (event.shiftKey) actions[actions.length - 1].focus();\n else actions[0].focus();\n }\n\n const index = actions.indexOf(activeElement as HTMLDivElement);\n\n // If an action is focused\n // 1) Shift + Tab => we focus the previous action (closeButton if it's the first one)\n // 2) Tab => we focus the next action (closeButton if it's the last one)\n if (event.shiftKey) {\n if (index === 0) closeButton.focus();\n else actions[index - 1].focus();\n } else {\n if (index === actions.length - 1) closeButton.focus();\n else actions[index + 1].focus();\n }\n }\n };\n\n return {\n propsWithDefault,\n toastifyWrapperRef,\n onKeyDown,\n globalAttributes,\n xstyledAttributes,\n };\n};\n"],
5
+ "mappings": "AAAA,YAAY,WAAW;ACAvB,SAAS,wBAAwB,oBAAoB,oCAAoC;AACzF,SAAS,cAAc;AACvB,SAAS,YAAY;AAErB,SAAS,oBAAoB;AAEtB,MAAM,WAAW,CAAC,UAA0B;AACjD,QAAM,mBAAmB,6BAAqD,OAAO,YAAY;AAEjG,QAAM,mBAAmB,uBAAuB,gBAAgB;AAEhE,QAAM,oBAAoB,mBAAmB,KAAK,kBAAkB,UAAU,CAAC;AAE/E,QAAM,qBAAqB,OAA8B,IAAI;AAE7D,QAAM,YAAY,CAAC,UAA+C;AAChE,QAAI,MAAM,QAAQ,OAAO;AACvB,YAAM,eAAe;AACrB,YAAM,gBAAgB;AAEtB,YAAM,cAAc,SAAS,cAAc,qBAAqB;AAChE,YAAM,UAAU,CAAC,GAAG,SAAS,iBAAiB,mCAAmC,CAAC;AAElF,YAAM,gBAAgB,SAAS;AAM/B,UAAI,gBAAgB,eAAe;AACjC,YAAI,QAAQ,WAAW;AAAG;AAC1B,YAAI,MAAM;AAAU,kBAAQ,QAAQ,SAAS,CAAC,EAAE,MAAM;AAAA;AACjD,kBAAQ,CAAC,EAAE,MAAM;AAAA,MACxB;AAEA,YAAM,QAAQ,QAAQ,QAAQ,aAA+B;AAK7D,UAAI,MAAM,UAAU;AAClB,YAAI,UAAU;AAAG,sBAAY,MAAM;AAAA;AAC9B,kBAAQ,QAAQ,CAAC,EAAE,MAAM;AAAA,MAChC,OAAO;AACL,YAAI,UAAU,QAAQ,SAAS;AAAG,sBAAY,MAAM;AAAA;AAC/C,kBAAQ,QAAQ,CAAC,EAAE,MAAM;AAAA,MAChC;AAAA,IACF;AAAA,EACF;AAEA,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;",
6
+ "names": []
7
+ }
@@ -0,0 +1,49 @@
1
+ import * as React from "react";
2
+ import { CheckmarkCircleFill, WarningSquare, InfoCircleFill, AlertsDetailFill } from "@elliemae/ds-legacy-icons";
3
+ const ToastPosition = {
4
+ TOP_RIGHT: "top-right",
5
+ TOP_CENTER: "top-center",
6
+ TOP_LEFT: "top-left",
7
+ BOTTOM_RIGHT: "bottom-right",
8
+ BOTTOM_CENTER: "bottom-center",
9
+ BOTTOM_LEFT: "bottom-left"
10
+ };
11
+ const toastsPositions = [
12
+ "top-right",
13
+ "top-center",
14
+ "top-left",
15
+ "bottom-right",
16
+ "bottom-center",
17
+ "bottom-left"
18
+ ];
19
+ const ToastType = {
20
+ INFO: "info",
21
+ SUCCESS: "success",
22
+ WARNING: "warning",
23
+ ERROR: "error",
24
+ DEFAULT: "default"
25
+ };
26
+ const toastTypes = ["info", "success", "warning", "error", "default"];
27
+ const TYPE_TO_ICON = {
28
+ [ToastType.SUCCESS]: CheckmarkCircleFill,
29
+ [ToastType.WARNING]: WarningSquare,
30
+ [ToastType.INFO]: InfoCircleFill,
31
+ [ToastType.ERROR]: AlertsDetailFill,
32
+ [ToastType.DEFAULT]: () => null
33
+ };
34
+ const TYPE_TO_ICON_COLOR = {
35
+ [ToastType.SUCCESS]: ["success", "900"],
36
+ [ToastType.WARNING]: ["warning", "900"],
37
+ [ToastType.INFO]: ["brand-primary", "400"],
38
+ [ToastType.ERROR]: ["danger", "900"],
39
+ [ToastType.DEFAULT]: ["neutral", "400"]
40
+ };
41
+ export {
42
+ TYPE_TO_ICON,
43
+ TYPE_TO_ICON_COLOR,
44
+ ToastPosition,
45
+ ToastType,
46
+ toastTypes,
47
+ toastsPositions
48
+ };
49
+ //# sourceMappingURL=constants.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../src/constants.ts"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { CheckmarkCircleFill, WarningSquare, InfoCircleFill, AlertsDetailFill } from '@elliemae/ds-legacy-icons';\n\nexport 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} as const;\n\nexport const toastsPositions = [\n 'top-right',\n 'top-center',\n 'top-left',\n 'bottom-right',\n 'bottom-center',\n 'bottom-left',\n] as const;\n\nexport const ToastType = {\n INFO: 'info',\n SUCCESS: 'success',\n WARNING: 'warning',\n ERROR: 'error',\n DEFAULT: 'default',\n} as const;\n\nexport const toastTypes = ['info', 'success', 'warning', 'error', 'default'] as const;\n\nexport const TYPE_TO_ICON = {\n [ToastType.SUCCESS]: CheckmarkCircleFill,\n [ToastType.WARNING]: WarningSquare,\n [ToastType.INFO]: InfoCircleFill,\n [ToastType.ERROR]: AlertsDetailFill,\n [ToastType.DEFAULT]: () => null,\n} as const;\n\nexport const TYPE_TO_ICON_COLOR = {\n [ToastType.SUCCESS]: ['success', '900'],\n [ToastType.WARNING]: ['warning', '900'],\n [ToastType.INFO]: ['brand-primary', '400'],\n [ToastType.ERROR]: ['danger', '900'],\n [ToastType.DEFAULT]: ['neutral', '400'],\n} as const;\n"],
5
+ "mappings": "AAAA,YAAY,WAAW;ACAvB,SAAS,qBAAqB,eAAe,gBAAgB,wBAAwB;AAE9E,MAAM,gBAAgB;AAAA,EAC3B,WAAW;AAAA,EACX,YAAY;AAAA,EACZ,UAAU;AAAA,EACV,cAAc;AAAA,EACd,eAAe;AAAA,EACf,aAAa;AACf;AAEO,MAAM,kBAAkB;AAAA,EAC7B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAEO,MAAM,YAAY;AAAA,EACvB,MAAM;AAAA,EACN,SAAS;AAAA,EACT,SAAS;AAAA,EACT,OAAO;AAAA,EACP,SAAS;AACX;AAEO,MAAM,aAAa,CAAC,QAAQ,WAAW,WAAW,SAAS,SAAS;AAEpE,MAAM,eAAe;AAAA,EAC1B,CAAC,UAAU,OAAO,GAAG;AAAA,EACrB,CAAC,UAAU,OAAO,GAAG;AAAA,EACrB,CAAC,UAAU,IAAI,GAAG;AAAA,EAClB,CAAC,UAAU,KAAK,GAAG;AAAA,EACnB,CAAC,UAAU,OAAO,GAAG,MAAM;AAC7B;AAEO,MAAM,qBAAqB;AAAA,EAChC,CAAC,UAAU,OAAO,GAAG,CAAC,WAAW,KAAK;AAAA,EACtC,CAAC,UAAU,OAAO,GAAG,CAAC,WAAW,KAAK;AAAA,EACtC,CAAC,UAAU,IAAI,GAAG,CAAC,iBAAiB,KAAK;AAAA,EACzC,CAAC,UAAU,KAAK,GAAG,CAAC,UAAU,KAAK;AAAA,EACnC,CAAC,UAAU,OAAO,GAAG,CAAC,WAAW,KAAK;AACxC;",
6
+ "names": []
7
+ }
@@ -0,0 +1,42 @@
1
+ import * as React from "react";
2
+ import { DSToast, DSToastWithSchema } from "./parts/DSToast.js";
3
+ import { toast } from "./toast.js";
4
+ import { ToastType, toastTypes, ToastPosition, toastsPositions } from "./constants.js";
5
+ import { DSToastAction, DSToastActionWithSchema } from "./parts/DSToastAction.js";
6
+ import { DSToastActionLink, DSToastActionLinkWithSchema } from "./parts/DSToastActionLink.js";
7
+ import {
8
+ DSToastName,
9
+ DSToastActionName,
10
+ DSToastActionLinkName,
11
+ DSToastSlots,
12
+ DSToastActionSlots,
13
+ DSToastActionLinkSlots,
14
+ DSToastDataTestIds,
15
+ DSToastActionDataTestIds,
16
+ DSToastActionLinkDataTestIds
17
+ } from "./DSToastDefinitions.js";
18
+ import { default as default2 } from "./parts/DSToast.js";
19
+ export {
20
+ DSToast,
21
+ DSToastAction,
22
+ DSToastActionDataTestIds,
23
+ DSToastActionLink,
24
+ DSToastActionLinkDataTestIds,
25
+ DSToastActionLinkName,
26
+ DSToastActionLinkSlots,
27
+ DSToastActionLinkWithSchema,
28
+ DSToastActionName,
29
+ DSToastActionSlots,
30
+ DSToastActionWithSchema,
31
+ DSToastDataTestIds,
32
+ DSToastName,
33
+ DSToastSlots,
34
+ DSToastWithSchema,
35
+ ToastPosition,
36
+ ToastType,
37
+ default2 as default,
38
+ toast,
39
+ toastTypes,
40
+ toastsPositions
41
+ };
42
+ //# 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 { DSToast, DSToastWithSchema } from './parts/DSToast.js';\nexport { toast } from './toast.js';\nexport { ToastType, toastTypes, ToastPosition, toastsPositions } from './constants.js';\nexport { DSToastAction, DSToastActionWithSchema } from './parts/DSToastAction.js';\nexport { DSToastActionLink, DSToastActionLinkWithSchema } from './parts/DSToastActionLink.js';\nexport {\n DSToastName,\n DSToastActionName,\n DSToastActionLinkName,\n DSToastSlots,\n DSToastActionSlots,\n DSToastActionLinkSlots,\n DSToastDataTestIds,\n DSToastActionDataTestIds,\n DSToastActionLinkDataTestIds,\n} from './DSToastDefinitions.js';\nimport type {} from '@xstyled/system';\nexport { default } from './parts/DSToast.js';\n"],
5
+ "mappings": "AAAA,YAAY,WAAW;ACAvB,SAAS,SAAS,yBAAyB;AAC3C,SAAS,aAAa;AACtB,SAAS,WAAW,YAAY,eAAe,uBAAuB;AACtE,SAAS,eAAe,+BAA+B;AACvD,SAAS,mBAAmB,mCAAmC;AAC/D;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAEP,SAAS,WAAAA,gBAAe;",
6
+ "names": ["default"]
7
+ }
@@ -0,0 +1,7 @@
1
+ {
2
+ "type": "module",
3
+ "sideEffects": [
4
+ "*.css",
5
+ "*.scss"
6
+ ]
7
+ }
@@ -0,0 +1,22 @@
1
+ import * as React from "react";
2
+ import { jsx } from "react/jsx-runtime";
3
+ import { CloseSmall } from "@elliemae/ds-legacy-icons";
4
+ import { StyledButton } from "./styled.js";
5
+ const CloseButton = ({ closeButtonRef }) => {
6
+ const Comp = ({ closeToast }) => /* @__PURE__ */ jsx(
7
+ StyledButton,
8
+ {
9
+ className: "toast-close-button",
10
+ buttonType: "icon",
11
+ onClick: closeToast,
12
+ "aria-label": "close toast",
13
+ innerRef: closeButtonRef,
14
+ children: /* @__PURE__ */ jsx(CloseSmall, { size: "s" })
15
+ }
16
+ );
17
+ return Comp;
18
+ };
19
+ export {
20
+ CloseButton
21
+ };
22
+ //# sourceMappingURL=CloseButton.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../src/parts/CloseButton.tsx"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React from 'react';\nimport { CloseSmall } from '@elliemae/ds-legacy-icons';\nimport { StyledButton } from './styled.js';\nimport type { DSToastT } from '../react-desc-prop-types.js';\n\ninterface CloseButtonProps {\n closeToast: () => void;\n}\n\nexport const CloseButton = ({ closeButtonRef }: { closeButtonRef: DSToastT.Props['closeButtonRef'] }) => {\n const Comp = ({ closeToast }: CloseButtonProps) => (\n <StyledButton\n className=\"toast-close-button\"\n buttonType=\"icon\"\n onClick={closeToast}\n aria-label=\"close toast\"\n innerRef={closeButtonRef}\n >\n <CloseSmall size=\"s\" />\n </StyledButton>\n );\n\n return Comp;\n};\n"],
5
+ "mappings": "AAAA,YAAY,WAAW;ACkBjB;AAjBN,SAAS,kBAAkB;AAC3B,SAAS,oBAAoB;AAOtB,MAAM,cAAc,CAAC,EAAE,eAAe,MAA4D;AACvG,QAAM,OAAO,CAAC,EAAE,WAAW,MACzB;AAAA,IAAC;AAAA;AAAA,MACC,WAAU;AAAA,MACV,YAAW;AAAA,MACX,SAAS;AAAA,MACT,cAAW;AAAA,MACX,UAAU;AAAA,MAEV,8BAAC,cAAW,MAAK,KAAI;AAAA;AAAA,EACvB;AAGF,SAAO;AACT;",
6
+ "names": []
7
+ }
@@ -0,0 +1,54 @@
1
+ import * as React from "react";
2
+ import { jsx } from "react/jsx-runtime";
3
+ import { describe } from "@elliemae/ds-legacy-props-helpers";
4
+ import { ToastContainer, Slide } from "react-toastify";
5
+ import { DSToastPropTypes } from "../react-desc-prop-types.js";
6
+ import { DSToastName } from "../DSToastDefinitions.js";
7
+ import { CloseButton } from "./CloseButton.js";
8
+ import { ToastifyWrapper } from "./styled.js";
9
+ import { useToast } from "../config/useToast.js";
10
+ const DSToast = (props) => {
11
+ const {
12
+ propsWithDefault: {
13
+ containerProps,
14
+ position,
15
+ autoClose,
16
+ showProgressBar,
17
+ closeOnClick,
18
+ enableMultiContainer,
19
+ containerId,
20
+ closeButtonRef
21
+ },
22
+ toastifyWrapperRef,
23
+ onKeyDown,
24
+ globalAttributes,
25
+ xstyledAttributes
26
+ } = useToast(props);
27
+ return /* @__PURE__ */ jsx(ToastifyWrapper, { ref: toastifyWrapperRef, onKeyDown, ...globalAttributes, ...xstyledAttributes, children: /* @__PURE__ */ jsx(
28
+ ToastContainer,
29
+ {
30
+ ...containerProps,
31
+ autoClose,
32
+ className: showProgressBar && "with-progressbar" || "",
33
+ closeButton: CloseButton({ closeButtonRef }),
34
+ closeOnClick,
35
+ containerId,
36
+ enableMultiContainer,
37
+ hideProgressBar: !showProgressBar,
38
+ newestOnTop: true,
39
+ position,
40
+ transition: Slide
41
+ }
42
+ ) });
43
+ };
44
+ DSToast.propTypes = DSToastPropTypes;
45
+ DSToast.displayName = DSToastName;
46
+ const DSToastWithSchema = describe(DSToast);
47
+ DSToastWithSchema.propTypes = DSToastPropTypes;
48
+ var DSToast_default = DSToast;
49
+ export {
50
+ DSToast,
51
+ DSToastWithSchema,
52
+ DSToast_default as default
53
+ };
54
+ //# sourceMappingURL=DSToast.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../src/parts/DSToast.tsx"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React from 'react';\nimport { describe } from '@elliemae/ds-legacy-props-helpers';\nimport { ToastContainer, Slide } from 'react-toastify';\nimport type { DSToastT } from '../react-desc-prop-types.js';\nimport { DSToastPropTypes } from '../react-desc-prop-types.js';\nimport { DSToastName } from '../DSToastDefinitions.js';\nimport { CloseButton } from './CloseButton.js';\nimport { ToastifyWrapper } from './styled.js';\nimport { useToast } from '../config/useToast.js';\n\nconst DSToast: React.ComponentType<DSToastT.Props> = (props) => {\n const {\n propsWithDefault: {\n containerProps,\n position,\n autoClose,\n showProgressBar,\n closeOnClick,\n enableMultiContainer,\n containerId,\n closeButtonRef,\n },\n toastifyWrapperRef,\n onKeyDown,\n globalAttributes,\n xstyledAttributes,\n } = useToast(props);\n\n return (\n <ToastifyWrapper ref={toastifyWrapperRef} onKeyDown={onKeyDown} {...globalAttributes} {...xstyledAttributes}>\n <ToastContainer\n {...containerProps}\n autoClose={autoClose}\n className={(showProgressBar && 'with-progressbar') || ''}\n closeButton={CloseButton({ closeButtonRef })}\n closeOnClick={closeOnClick}\n containerId={containerId}\n enableMultiContainer={enableMultiContainer}\n hideProgressBar={!showProgressBar}\n newestOnTop\n position={position}\n transition={Slide}\n />\n </ToastifyWrapper>\n );\n};\n\nDSToast.propTypes = DSToastPropTypes;\nDSToast.displayName = DSToastName;\nconst DSToastWithSchema = describe(DSToast);\nDSToastWithSchema.propTypes = DSToastPropTypes;\n\nexport { DSToast, DSToastWithSchema };\nexport default DSToast;\n"],
5
+ "mappings": "AAAA,YAAY,WAAW;AC8BjB;AA7BN,SAAS,gBAAgB;AACzB,SAAS,gBAAgB,aAAa;AAEtC,SAAS,wBAAwB;AACjC,SAAS,mBAAmB;AAC5B,SAAS,mBAAmB;AAC5B,SAAS,uBAAuB;AAChC,SAAS,gBAAgB;AAEzB,MAAM,UAA+C,CAAC,UAAU;AAC9D,QAAM;AAAA,IACJ,kBAAkB;AAAA,MAChB;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,IAAI,SAAS,KAAK;AAElB,SACE,oBAAC,mBAAgB,KAAK,oBAAoB,WAAuB,GAAG,kBAAmB,GAAG,mBACxF;AAAA,IAAC;AAAA;AAAA,MACE,GAAG;AAAA,MACJ;AAAA,MACA,WAAY,mBAAmB,sBAAuB;AAAA,MACtD,aAAa,YAAY,EAAE,eAAe,CAAC;AAAA,MAC3C;AAAA,MACA;AAAA,MACA;AAAA,MACA,iBAAiB,CAAC;AAAA,MAClB,aAAW;AAAA,MACX;AAAA,MACA,YAAY;AAAA;AAAA,EACd,GACF;AAEJ;AAEA,QAAQ,YAAY;AACpB,QAAQ,cAAc;AACtB,MAAM,oBAAoB,SAAS,OAAO;AAC1C,kBAAkB,YAAY;AAG9B,IAAO,kBAAQ;",
6
+ "names": []
7
+ }
@@ -0,0 +1,38 @@
1
+ import * as React from "react";
2
+ import { jsx } from "react/jsx-runtime";
3
+ import {
4
+ describe,
5
+ useGetGlobalAttributes,
6
+ useGetXstyledProps,
7
+ useMemoMergePropsWithDefault
8
+ } from "@elliemae/ds-legacy-props-helpers";
9
+ import { actionDefaultProps, DSToastActionPropsTypes } from "../react-desc-prop-types.js";
10
+ import { DSToastActionName } from "../DSToastDefinitions.js";
11
+ import { StyledAction } from "./styled.js";
12
+ const DSToastAction = (props) => {
13
+ const propsWithDefault = useMemoMergePropsWithDefault(props, actionDefaultProps);
14
+ const globalAttributes = useGetGlobalAttributes(propsWithDefault);
15
+ const xstyledAttributes = useGetXstyledProps(propsWithDefault);
16
+ const { children, onClick, onKeyDown } = propsWithDefault;
17
+ return /* @__PURE__ */ jsx(
18
+ StyledAction,
19
+ {
20
+ onKeyDown,
21
+ onClick,
22
+ role: onClick ? "button" : "textbox",
23
+ tabIndex: onClick ? 0 : void 0,
24
+ className: "toast-action-text",
25
+ ...globalAttributes,
26
+ ...xstyledAttributes,
27
+ children
28
+ }
29
+ );
30
+ };
31
+ DSToastAction.displayName = DSToastActionName;
32
+ const DSToastActionWithSchema = describe(DSToastAction);
33
+ DSToastActionWithSchema.propTypes = DSToastActionPropsTypes;
34
+ export {
35
+ DSToastAction,
36
+ DSToastActionWithSchema
37
+ };
38
+ //# sourceMappingURL=DSToastAction.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../src/parts/DSToastAction.tsx"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React from 'react';\nimport {\n describe,\n useGetGlobalAttributes,\n useGetXstyledProps,\n useMemoMergePropsWithDefault,\n} from '@elliemae/ds-legacy-props-helpers';\nimport type { DSToastT } from '../react-desc-prop-types.js';\nimport { actionDefaultProps, DSToastActionPropsTypes } from '../react-desc-prop-types.js';\nimport { DSToastActionName } from '../DSToastDefinitions.js';\nimport { StyledAction } from './styled.js';\n\nconst DSToastAction: React.ComponentType<DSToastT.ActionProps> = (props) => {\n const propsWithDefault = useMemoMergePropsWithDefault<DSToastT.ActionInternalProps>(props, actionDefaultProps);\n\n const globalAttributes = useGetGlobalAttributes(propsWithDefault);\n\n const xstyledAttributes = useGetXstyledProps(propsWithDefault);\n\n const { children, onClick, onKeyDown } = propsWithDefault;\n\n return (\n <StyledAction\n onKeyDown={onKeyDown}\n onClick={onClick}\n role={onClick ? 'button' : 'textbox'}\n tabIndex={onClick ? 0 : undefined}\n className=\"toast-action-text\"\n {...globalAttributes}\n {...xstyledAttributes}\n >\n {children}\n </StyledAction>\n );\n};\n\nDSToastAction.displayName = DSToastActionName;\nconst DSToastActionWithSchema = describe(DSToastAction);\nDSToastActionWithSchema.propTypes = DSToastActionPropsTypes;\n\nexport { DSToastAction, DSToastActionWithSchema };\n"],
5
+ "mappings": "AAAA,YAAY,WAAW;ACsBnB;AArBJ;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAEP,SAAS,oBAAoB,+BAA+B;AAC5D,SAAS,yBAAyB;AAClC,SAAS,oBAAoB;AAE7B,MAAM,gBAA2D,CAAC,UAAU;AAC1E,QAAM,mBAAmB,6BAA2D,OAAO,kBAAkB;AAE7G,QAAM,mBAAmB,uBAAuB,gBAAgB;AAEhE,QAAM,oBAAoB,mBAAmB,gBAAgB;AAE7D,QAAM,EAAE,UAAU,SAAS,UAAU,IAAI;AAEzC,SACE;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA;AAAA,MACA,MAAM,UAAU,WAAW;AAAA,MAC3B,UAAU,UAAU,IAAI;AAAA,MACxB,WAAU;AAAA,MACT,GAAG;AAAA,MACH,GAAG;AAAA,MAEH;AAAA;AAAA,EACH;AAEJ;AAEA,cAAc,cAAc;AAC5B,MAAM,0BAA0B,SAAS,aAAa;AACtD,wBAAwB,YAAY;",
6
+ "names": []
7
+ }
@@ -0,0 +1,14 @@
1
+ import * as React from "react";
2
+ import { describe } from "@elliemae/ds-legacy-props-helpers";
3
+ import { DSToastActionLinkPropTypes } from "../react-desc-prop-types.js";
4
+ import { DSToastActionLinkName } from "../DSToastDefinitions.js";
5
+ import { StyledLink } from "./styled.js";
6
+ const DSToastActionLink = StyledLink;
7
+ DSToastActionLink.displayName = DSToastActionLinkName;
8
+ const DSToastActionLinkWithSchema = describe(DSToastActionLink);
9
+ DSToastActionLinkWithSchema.propTypes = DSToastActionLinkPropTypes;
10
+ export {
11
+ DSToastActionLink,
12
+ DSToastActionLinkWithSchema
13
+ };
14
+ //# sourceMappingURL=DSToastActionLink.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../src/parts/DSToastActionLink.tsx"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { describe } from '@elliemae/ds-legacy-props-helpers';\nimport { DSToastActionLinkPropTypes } from '../react-desc-prop-types.js';\nimport { DSToastActionLinkName } from '../DSToastDefinitions.js';\nimport { StyledLink } from './styled.js';\n\nexport const DSToastActionLink = StyledLink;\nDSToastActionLink.displayName = DSToastActionLinkName;\nexport const DSToastActionLinkWithSchema = describe(DSToastActionLink);\nDSToastActionLinkWithSchema.propTypes = DSToastActionLinkPropTypes;\n"],
5
+ "mappings": "AAAA,YAAY,WAAW;ACAvB,SAAS,gBAAgB;AACzB,SAAS,kCAAkC;AAC3C,SAAS,6BAA6B;AACtC,SAAS,kBAAkB;AAEpB,MAAM,oBAAoB;AACjC,kBAAkB,cAAc;AACzB,MAAM,8BAA8B,SAAS,iBAAiB;AACrE,4BAA4B,YAAY;",
6
+ "names": []
7
+ }
@@ -0,0 +1,33 @@
1
+ import * as React from "react";
2
+ import { jsx, jsxs } from "react/jsx-runtime";
3
+ import {
4
+ StyledContainer,
5
+ StyledIconContainer,
6
+ StyledMessageContent,
7
+ StyledMessageHeader,
8
+ StyledMessageText
9
+ } from "./styled.js";
10
+ import { ToastType, TYPE_TO_ICON, TYPE_TO_ICON_COLOR } from "../constants.js";
11
+ const getIconByToastType = (type) => TYPE_TO_ICON[type];
12
+ const getIconColorByToastType = (type) => TYPE_TO_ICON_COLOR[type];
13
+ const DSToastContent = ({
14
+ type = ToastType.DEFAULT,
15
+ messageTitle = "",
16
+ messageText = ""
17
+ }) => {
18
+ const IconMessage = getIconByToastType(type);
19
+ const iconColor = getIconColorByToastType(type);
20
+ return /* @__PURE__ */ jsxs(StyledContainer, { "data-testid": "ds-toast-render", className: "em-ds-toast-content", children: [
21
+ /* @__PURE__ */ jsx(StyledIconContainer, { className: "em-ds-toast-content__icon-container", children: /* @__PURE__ */ jsx(IconMessage, { size: "m", className: "em-ds-toast-content__icon-message", color: iconColor }) }),
22
+ /* @__PURE__ */ jsxs(StyledMessageContent, { className: "em-ds-toast-content__message-content", children: [
23
+ /* @__PURE__ */ jsx(StyledMessageHeader, { className: "em-ds-toast-content__message-header", children: messageTitle }),
24
+ /* @__PURE__ */ jsx(StyledMessageText, { className: "em-ds-toast-content__message-text", children: messageText })
25
+ ] })
26
+ ] });
27
+ };
28
+ export {
29
+ DSToastContent,
30
+ getIconByToastType,
31
+ getIconColorByToastType
32
+ };
33
+ //# sourceMappingURL=DSToastContent.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../src/parts/DSToastContent.tsx"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React from 'react';\nimport type { SvgIconT } from '@elliemae/ds-legacy-icons';\nimport type { DSToastT } from '../react-desc-prop-types.js';\nimport {\n StyledContainer,\n StyledIconContainer,\n StyledMessageContent,\n StyledMessageHeader,\n StyledMessageText,\n} from './styled.js';\nimport { ToastType, TYPE_TO_ICON, TYPE_TO_ICON_COLOR } from '../constants.js';\n\nexport const getIconByToastType = (type: DSToastT.ToastTypes) => TYPE_TO_ICON[type];\nexport const getIconColorByToastType = (type: DSToastT.ToastTypes): SvgIconT.ColorType =>\n TYPE_TO_ICON_COLOR[type] as SvgIconT.ColorType;\n\nexport interface DSToastContentProps {\n type?: DSToastT.ToastTypes;\n messageTitle?: string;\n messageText?: string;\n}\n\nexport const DSToastContent: React.ComponentType<DSToastContentProps> = ({\n type = ToastType.DEFAULT,\n messageTitle = '',\n messageText = '',\n}) => {\n const IconMessage = getIconByToastType(type);\n const iconColor = getIconColorByToastType(type);\n\n return (\n <StyledContainer data-testid=\"ds-toast-render\" className=\"em-ds-toast-content\">\n <StyledIconContainer className=\"em-ds-toast-content__icon-container\">\n <IconMessage size=\"m\" className=\"em-ds-toast-content__icon-message\" color={iconColor} />\n </StyledIconContainer>\n <StyledMessageContent className=\"em-ds-toast-content__message-content\">\n <StyledMessageHeader className=\"em-ds-toast-content__message-header\">{messageTitle}</StyledMessageHeader>\n <StyledMessageText className=\"em-ds-toast-content__message-text\">{messageText}</StyledMessageText>\n </StyledMessageContent>\n </StyledContainer>\n );\n};\n"],
5
+ "mappings": "AAAA,YAAY,WAAW;ACiCf,cAEF,YAFE;AA9BR;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,WAAW,cAAc,0BAA0B;AAErD,MAAM,qBAAqB,CAAC,SAA8B,aAAa,IAAI;AAC3E,MAAM,0BAA0B,CAAC,SACtC,mBAAmB,IAAI;AAQlB,MAAM,iBAA2D,CAAC;AAAA,EACvE,OAAO,UAAU;AAAA,EACjB,eAAe;AAAA,EACf,cAAc;AAChB,MAAM;AACJ,QAAM,cAAc,mBAAmB,IAAI;AAC3C,QAAM,YAAY,wBAAwB,IAAI;AAE9C,SACE,qBAAC,mBAAgB,eAAY,mBAAkB,WAAU,uBACvD;AAAA,wBAAC,uBAAoB,WAAU,uCAC7B,8BAAC,eAAY,MAAK,KAAI,WAAU,qCAAoC,OAAO,WAAW,GACxF;AAAA,IACA,qBAAC,wBAAqB,WAAU,wCAC9B;AAAA,0BAAC,uBAAoB,WAAU,uCAAuC,wBAAa;AAAA,MACnF,oBAAC,qBAAkB,WAAU,qCAAqC,uBAAY;AAAA,OAChF;AAAA,KACF;AAEJ;",
6
+ "names": []
7
+ }