@elliemae/ds-toast 3.55.0-next.8 → 3.55.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.
- package/dist/cjs/config/useToast.js +6 -4
- package/dist/cjs/config/useToast.js.map +2 -2
- package/dist/cjs/index.js.map +2 -2
- package/dist/cjs/parts/DSToastContent.js +2 -2
- package/dist/cjs/parts/DSToastContent.js.map +2 -2
- package/dist/cjs/typescript-testing/typescript-toast-valid.js.map +2 -2
- package/dist/esm/config/useToast.js +6 -4
- package/dist/esm/config/useToast.js.map +2 -2
- package/dist/esm/index.js.map +2 -2
- package/dist/esm/parts/DSToastContent.js +2 -2
- package/dist/esm/parts/DSToastContent.js.map +2 -2
- package/dist/esm/typescript-testing/typescript-toast-valid.js.map +2 -2
- package/dist/types/config/useToast.d.ts +1 -1
- package/package.json +8 -8
|
@@ -35,8 +35,8 @@ var React = __toESM(require("react"));
|
|
|
35
35
|
var import_ds_props_helpers = require("@elliemae/ds-props-helpers");
|
|
36
36
|
var import_react = require("react");
|
|
37
37
|
var import_lodash_es = require("lodash-es");
|
|
38
|
-
var import_ds_system = require("@elliemae/ds-system");
|
|
39
38
|
var import_react_desc_prop_types = require("../react-desc-prop-types.js");
|
|
39
|
+
var import_ds_system = require("@elliemae/ds-system");
|
|
40
40
|
const useToast = (props) => {
|
|
41
41
|
const propsWithDefault = (0, import_ds_props_helpers.useMemoMergePropsWithDefault)(
|
|
42
42
|
props,
|
|
@@ -54,7 +54,7 @@ const useToast = (props) => {
|
|
|
54
54
|
const container = toastifyWrapperRef.current;
|
|
55
55
|
const closeButton = document.querySelector(".toast-close-button");
|
|
56
56
|
const actions = [...document.querySelectorAll('.toast-action-text[role="button"]')];
|
|
57
|
-
const
|
|
57
|
+
const activeElement = document.activeElement;
|
|
58
58
|
if (closeButton === activeElement) {
|
|
59
59
|
if (actions.length === 0) return;
|
|
60
60
|
if (event.shiftKey) actions[actions.length - 1].focus();
|
|
@@ -70,8 +70,10 @@ const useToast = (props) => {
|
|
|
70
70
|
if (event.shiftKey) {
|
|
71
71
|
if (index === 0) closeButton.focus();
|
|
72
72
|
else actions[index - 1].focus();
|
|
73
|
-
} else
|
|
74
|
-
|
|
73
|
+
} else {
|
|
74
|
+
if (index === actions.length - 1) closeButton.focus();
|
|
75
|
+
else actions[index + 1].focus();
|
|
76
|
+
}
|
|
75
77
|
} else if (event.key === "Escape") {
|
|
76
78
|
const closeButton = toastCloseButtonRef.current;
|
|
77
79
|
if (closeButton) closeButton.click();
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/config/useToast.ts", "../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["/* eslint-disable complexity */\nimport { useGetGlobalAttributes, useGetXstyledProps, useMemoMergePropsWithDefault } from '@elliemae/ds-props-helpers';\nimport { useRef } from 'react';\nimport { omit } from 'lodash-es';\nimport
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADCvB,8BAAyF;AACzF,mBAAuB;AACvB,uBAAqB;
|
|
4
|
+
"sourcesContent": ["/* eslint-disable complexity */\nimport { useGetGlobalAttributes, useGetXstyledProps, useMemoMergePropsWithDefault } from '@elliemae/ds-props-helpers';\nimport { useRef } from 'react';\nimport { omit } from 'lodash-es';\nimport type { DSToastT } from '../react-desc-prop-types.js';\nimport { defaultProps } from '../react-desc-prop-types.js';\nimport { mergeRefs } from '@elliemae/ds-system';\n\nexport const useToast = (props: DSToastT.Props) => {\n const propsWithDefault = useMemoMergePropsWithDefault<DSToastT.InternalProps>(\n props,\n defaultProps as Partial<DSToastT.InternalProps>,\n );\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 toastCloseButtonRef = useRef<HTMLButtonElement | null>(null);\n\n const closeButtonRef = mergeRefs(toastCloseButtonRef, propsWithDefault.closeButtonRef);\n\n const onKeyDown = (event: React.KeyboardEvent<HTMLDivElement>) => {\n if (event.key === 'Tab') {\n event.preventDefault();\n event.stopPropagation();\n\n const container = toastifyWrapperRef.current;\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 return;\n }\n\n // If the container is focused\n // No actions => we focus the close button\n // 2) Shift + Tab => we focus the last action\n // 3) Tab => we focus the close button\n if (container === activeElement) {\n if (actions.length === 0 || !event.shiftKey) closeButton.focus();\n else actions[actions.length - 1].focus();\n return;\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 } else if (event.key === 'Escape') {\n const closeButton = toastCloseButtonRef.current;\n if (closeButton) closeButton.click();\n }\n };\n\n return {\n propsWithDefault,\n toastifyWrapperRef,\n onKeyDown,\n globalAttributes,\n xstyledAttributes,\n closeButtonRef,\n };\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADCvB,8BAAyF;AACzF,mBAAuB;AACvB,uBAAqB;AAErB,mCAA6B;AAC7B,uBAA0B;AAEnB,MAAM,WAAW,CAAC,UAA0B;AACjD,QAAM,uBAAmB;AAAA,IACvB;AAAA,IACA;AAAA,EACF;AAEA,QAAM,uBAAmB,gDAAuB,gBAAgB;AAEhE,QAAM,wBAAoB,gDAAmB,uBAAK,kBAAkB,UAAU,CAAC;AAE/E,QAAM,yBAAqB,qBAA8B,IAAI;AAE7D,QAAM,0BAAsB,qBAAiC,IAAI;AAEjE,QAAM,qBAAiB,4BAAU,qBAAqB,iBAAiB,cAAc;AAErF,QAAM,YAAY,CAAC,UAA+C;AAChE,QAAI,MAAM,QAAQ,OAAO;AACvB,YAAM,eAAe;AACrB,YAAM,gBAAgB;AAEtB,YAAM,YAAY,mBAAmB;AACrC,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,EAAG;AAC1B,YAAI,MAAM,SAAU,SAAQ,QAAQ,SAAS,CAAC,EAAE,MAAM;AAAA,YACjD,SAAQ,CAAC,EAAE,MAAM;AACtB;AAAA,MACF;AAMA,UAAI,cAAc,eAAe;AAC/B,YAAI,QAAQ,WAAW,KAAK,CAAC,MAAM,SAAU,aAAY,MAAM;AAAA,YAC1D,SAAQ,QAAQ,SAAS,CAAC,EAAE,MAAM;AACvC;AAAA,MACF;AAEA,YAAM,QAAQ,QAAQ,QAAQ,aAA+B;AAK7D,UAAI,MAAM,UAAU;AAClB,YAAI,UAAU,EAAG,aAAY,MAAM;AAAA,YAC9B,SAAQ,QAAQ,CAAC,EAAE,MAAM;AAAA,MAChC,OAAO;AACL,YAAI,UAAU,QAAQ,SAAS,EAAG,aAAY,MAAM;AAAA,YAC/C,SAAQ,QAAQ,CAAC,EAAE,MAAM;AAAA,MAChC;AAAA,IACF,WAAW,MAAM,QAAQ,UAAU;AACjC,YAAM,cAAc,oBAAoB;AACxC,UAAI,YAAa,aAAY,MAAM;AAAA,IACrC;AAAA,EACF;AAEA,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/cjs/index.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/index.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;
|
|
4
|
+
"sourcesContent": ["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 { DSToastContent, DSToastContentWithSchema } from './parts/DSToastContent.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 type { DSToastT } from './react-desc-prop-types.js';\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,qBAA2C;AAC3C,mBAAsB;AACtB,uBAAsE;AACtE,2BAAuD;AACvD,+BAA+D;AAC/D,4BAAyD;AACzD,gCAUO;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -36,8 +36,8 @@ __export(DSToastContent_exports, {
|
|
|
36
36
|
module.exports = __toCommonJS(DSToastContent_exports);
|
|
37
37
|
var React = __toESM(require("react"));
|
|
38
38
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
39
|
-
var import_ds_props_helpers = require("@elliemae/ds-props-helpers");
|
|
40
39
|
var import_react_desc_prop_types = require("../react-desc-prop-types.js");
|
|
40
|
+
var import_ds_props_helpers = require("@elliemae/ds-props-helpers");
|
|
41
41
|
var import_styled = require("./styled.js");
|
|
42
42
|
var import_constants = require("../constants.js");
|
|
43
43
|
var import_DSToastDefinitions = require("../DSToastDefinitions.js");
|
|
@@ -55,7 +55,7 @@ const DSToastContent = ({
|
|
|
55
55
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_styled.StyledIconContainer, { className: "em-ds-toast-content__icon-container", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(IconMessage, { size: "m", className: "em-ds-toast-content__icon-message", color: iconColor }) }),
|
|
56
56
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_styled.StyledMessageContent, { className: "em-ds-toast-content__message-content", children: [
|
|
57
57
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_styled.StyledMessageHeader, { className: "em-ds-toast-content__message-header", children: messageTitle }),
|
|
58
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_styled.StyledMessageText, { className: "em-ds-toast-content__message-text", children: messageComponent
|
|
58
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_styled.StyledMessageText, { className: "em-ds-toast-content__message-text", children: messageComponent ? messageComponent : messageText })
|
|
59
59
|
] })
|
|
60
60
|
] });
|
|
61
61
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/parts/DSToastContent.tsx", "../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["import React from 'react';\nimport type { SvgIconT } from '@elliemae/ds-icons';\nimport {
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADqCf;AAnCR,8BAAyB;AACzB,
|
|
4
|
+
"sourcesContent": ["import React from 'react';\nimport type { SvgIconT } from '@elliemae/ds-icons';\nimport { DSToastContentPropTypes, type DSToastT } from '../react-desc-prop-types.js';\nimport { describe } from '@elliemae/ds-props-helpers';\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';\nimport { DSToastContentName } from '../DSToastDefinitions.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 messageComponent?: React.ReactNode;\n}\n\nconst DSToastContent: React.ComponentType<DSToastContentProps> = ({\n type = ToastType.DEFAULT,\n messageTitle = '',\n messageText = '',\n messageComponent,\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\">\n {messageComponent ? messageComponent : messageText}\n </StyledMessageText>\n </StyledMessageContent>\n </StyledContainer>\n );\n};\n\nDSToastContent.displayName = DSToastContentName;\nconst DSToastContentWithSchema = describe(DSToastContent);\nDSToastContentWithSchema.propTypes = DSToastContentPropTypes;\n\nexport { DSToastContent, DSToastContentWithSchema };\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADqCf;AAnCR,mCAAuD;AACvD,8BAAyB;AACzB,oBAMO;AACP,uBAA4D;AAC5D,gCAAmC;AAE5B,MAAM,qBAAqB,CAAC,SAA8B,8BAAa,IAAI;AAC3E,MAAM,0BAA0B,CAAC,SACtC,oCAAmB,IAAI;AASzB,MAAM,iBAA2D,CAAC;AAAA,EAChE,OAAO,2BAAU;AAAA,EACjB,eAAe;AAAA,EACf,cAAc;AAAA,EACd;AACF,MAAM;AACJ,QAAM,cAAc,mBAAmB,IAAI;AAC3C,QAAM,YAAY,wBAAwB,IAAI;AAE9C,SACE,6CAAC,iCAAgB,eAAY,mBAAkB,WAAU,uBACvD;AAAA,gDAAC,qCAAoB,WAAU,uCAC7B,sDAAC,eAAY,MAAK,KAAI,WAAU,qCAAoC,OAAO,WAAW,GACxF;AAAA,IACA,6CAAC,sCAAqB,WAAU,wCAC9B;AAAA,kDAAC,qCAAoB,WAAU,uCAAuC,wBAAa;AAAA,MACnF,4CAAC,mCAAkB,WAAU,qCAC1B,6BAAmB,mBAAmB,aACzC;AAAA,OACF;AAAA,KACF;AAEJ;AAEA,eAAe,cAAc;AAC7B,MAAM,+BAA2B,kCAAS,cAAc;AACxD,yBAAyB,YAAY;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../src/typescript-testing/typescript-toast-valid.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable @typescript-eslint/no-unused-vars, no-unused-vars */\nimport { createRef } from 'react';\nimport { DSToast } from '../index.js';\nimport type { DSToastT } from '../index.js';\n\n// test we expose the namespace and the namespace follows our deliverable conventions\ntype ComponentPropsForApp = DSToastT.Props;\ntype ComponentPropsInternals = DSToastT.InternalProps;\ntype ComponentPropsDefaultProps = DSToastT.DefaultProps;\ntype ComponentPropsOptionalProps = DSToastT.OptionalProps;\ntype ComponentPropsRequiredProps = DSToastT.RequiredProps;\n\nconst closeButtonRef = createRef<HTMLButtonElement>();\n\nconst testRequiredProps: ComponentPropsRequiredProps = {};\n\nconst testOptionalProps: ComponentPropsOptionalProps = {\n containerId: '',\n closeButtonRef,\n};\n\n// difference Props and InternalProps is that InternalProps has all the default props filled in\n// Props allows for partial defaults\nconst testPartialDefaults: Partial<ComponentPropsDefaultProps> = {\n containerProps: { 'data-testid': 'ds-toast-1' },\n position: 'top-center',\n showProgressBar: false,\n};\n\nconst testProps: ComponentPropsForApp = {\n ...testRequiredProps,\n ...testOptionalProps,\n ...testPartialDefaults,\n};\n\nconst testPropsAsSyntax = {\n ...testRequiredProps,\n ...testOptionalProps,\n ...testPartialDefaults,\n} as ComponentPropsForApp;\n\n// InternalProps requires all defaults to be filled in\nconst testCompleteDefaults: Required<ComponentPropsDefaultProps> = {\n containerProps: { 'data-testid': 'ds-toast-1' },\n position: 'top-center',\n autoClose: 2000,\n showProgressBar: true,\n closeOnClick: true,\n enableMultiContainer: false,\n};\n\nconst testInternalProps: ComponentPropsInternals = {\n ...testRequiredProps,\n ...testOptionalProps,\n ...testCompleteDefaults,\n};\n\nconst testInternalPropsAsSyntax = {\n ...testRequiredProps,\n ...testOptionalProps,\n ...testCompleteDefaults,\n} as ComponentPropsInternals;\n\n// using the explicit type definition, if there is an error, it will be marked on the key that is wrong\nconst testExplicitDefinition: ComponentPropsForApp = {\n containerProps: { 'data-testid': 'ds-toast-1' },\n position: 'top-left',\n autoClose: 5000,\n showProgressBar: true,\n closeOnClick: false,\n enableMultiContainer: false,\n};\n\n// using the \"as\" syntax, if there is an error, it will be marking the whole object as wrong because it is not compatible with the type\nconst testInferedTypeCompatibility = {\n containerProps: { 'data-testid': 'ds-toast-1' },\n position: 'top-left',\n autoClose: 5000,\n showProgressBar: true,\n closeOnClick: false,\n enableMultiContainer: false,\n} as ComponentPropsForApp;\n\nconst testDefinitionAsConst = {\n containerProps: { 'data-testid': 'ds-toast-1' },\n position: 'top-left',\n autoClose: 5000,\n showProgressBar: true,\n closeOnClick: false,\n enableMultiContainer: false,\n} as const;\n\nconst ExampleUsageComponent = () => (\n <>\n {/* works with explicitly casted props, all syntaxes */}\n <DSToast {...testExplicitDefinition} />\n <DSToast {...testInferedTypeCompatibility} />\n <DSToast {...testDefinitionAsConst} />\n {/* works with inline values */}\n <DSToast\n containerProps={{ 'data-testid': 'ds-toast-1' }}\n position=\"top-left\"\n autoClose={5000}\n showProgressBar\n closeOnClick={false}\n enableMultiContainer={false}\n />\n </>\n);\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;AAAA,YAAuB;AC6FrB;AA5FF,mBAA0B;AAC1B,eAAwB;AAUxB,MAAM,qBAAiB,wBAA6B;AAEpD,MAAM,oBAAiD,CAAC;AAExD,MAAM,oBAAiD;AAAA,EACrD,aAAa;AAAA,EACb;AACF;AAIA,MAAM,sBAA2D;AAAA,EAC/D,gBAAgB,EAAE,eAAe,aAAa;AAAA,EAC9C,UAAU;AAAA,EACV,iBAAiB;AACnB;AAEA,MAAM,YAAkC;AAAA,EACtC,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AACL;AAEA,MAAM,oBAAoB;AAAA,EACxB,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AACL;AAGA,MAAM,uBAA6D;AAAA,EACjE,gBAAgB,EAAE,eAAe,aAAa;AAAA,EAC9C,UAAU;AAAA,EACV,WAAW;AAAA,EACX,iBAAiB;AAAA,EACjB,cAAc;AAAA,EACd,sBAAsB;AACxB;AAEA,MAAM,oBAA6C;AAAA,EACjD,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AACL;AAEA,MAAM,4BAA4B;AAAA,EAChC,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AACL;AAGA,MAAM,yBAA+C;AAAA,EACnD,gBAAgB,EAAE,eAAe,aAAa;AAAA,EAC9C,UAAU;AAAA,EACV,WAAW;AAAA,EACX,iBAAiB;AAAA,EACjB,cAAc;AAAA,EACd,sBAAsB;AACxB;AAGA,MAAM,+BAA+B;AAAA,EACnC,gBAAgB,EAAE,eAAe,aAAa;AAAA,EAC9C,UAAU;AAAA,EACV,WAAW;AAAA,EACX,iBAAiB;AAAA,EACjB,cAAc;AAAA,EACd,sBAAsB;AACxB;AAEA,MAAM,wBAAwB;AAAA,EAC5B,gBAAgB,EAAE,eAAe,aAAa;AAAA,EAC9C,UAAU;AAAA,EACV,WAAW;AAAA,EACX,iBAAiB;AAAA,EACjB,cAAc;AAAA,EACd,sBAAsB;AACxB;AAEA,MAAM,wBAAwB,MAC5B,4EAEE;AAAA,8CAAC,oBAAS,GAAG,wBAAwB;AAAA,EACrC,4CAAC,oBAAS,GAAG,8BAA8B;AAAA,EAC3C,4CAAC,oBAAS,GAAG,uBAAuB;AAAA,EAEpC;AAAA,IAAC;AAAA;AAAA,MACC,gBAAgB,EAAE,eAAe,aAAa;AAAA,MAC9C,UAAS;AAAA,MACT,WAAW;AAAA,MACX,
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable @typescript-eslint/no-unused-vars, no-unused-vars */\nimport { createRef } from 'react';\nimport { DSToast } from '../index.js';\nimport type { DSToastT } from '../index.js';\n\n// test we expose the namespace and the namespace follows our deliverable conventions\ntype ComponentPropsForApp = DSToastT.Props;\ntype ComponentPropsInternals = DSToastT.InternalProps;\ntype ComponentPropsDefaultProps = DSToastT.DefaultProps;\ntype ComponentPropsOptionalProps = DSToastT.OptionalProps;\ntype ComponentPropsRequiredProps = DSToastT.RequiredProps;\n\nconst closeButtonRef = createRef<HTMLButtonElement>();\n\nconst testRequiredProps: ComponentPropsRequiredProps = {};\n\nconst testOptionalProps: ComponentPropsOptionalProps = {\n containerId: '',\n closeButtonRef: closeButtonRef,\n};\n\n// difference Props and InternalProps is that InternalProps has all the default props filled in\n// Props allows for partial defaults\nconst testPartialDefaults: Partial<ComponentPropsDefaultProps> = {\n containerProps: { 'data-testid': 'ds-toast-1' },\n position: 'top-center',\n showProgressBar: false,\n};\n\nconst testProps: ComponentPropsForApp = {\n ...testRequiredProps,\n ...testOptionalProps,\n ...testPartialDefaults,\n};\n\nconst testPropsAsSyntax = {\n ...testRequiredProps,\n ...testOptionalProps,\n ...testPartialDefaults,\n} as ComponentPropsForApp;\n\n// InternalProps requires all defaults to be filled in\nconst testCompleteDefaults: Required<ComponentPropsDefaultProps> = {\n containerProps: { 'data-testid': 'ds-toast-1' },\n position: 'top-center',\n autoClose: 2000,\n showProgressBar: true,\n closeOnClick: true,\n enableMultiContainer: false,\n};\n\nconst testInternalProps: ComponentPropsInternals = {\n ...testRequiredProps,\n ...testOptionalProps,\n ...testCompleteDefaults,\n};\n\nconst testInternalPropsAsSyntax = {\n ...testRequiredProps,\n ...testOptionalProps,\n ...testCompleteDefaults,\n} as ComponentPropsInternals;\n\n// using the explicit type definition, if there is an error, it will be marked on the key that is wrong\nconst testExplicitDefinition: ComponentPropsForApp = {\n containerProps: { 'data-testid': 'ds-toast-1' },\n position: 'top-left',\n autoClose: 5000,\n showProgressBar: true,\n closeOnClick: false,\n enableMultiContainer: false,\n};\n\n// using the \"as\" syntax, if there is an error, it will be marking the whole object as wrong because it is not compatible with the type\nconst testInferedTypeCompatibility = {\n containerProps: { 'data-testid': 'ds-toast-1' },\n position: 'top-left',\n autoClose: 5000,\n showProgressBar: true,\n closeOnClick: false,\n enableMultiContainer: false,\n} as ComponentPropsForApp;\n\nconst testDefinitionAsConst = {\n containerProps: { 'data-testid': 'ds-toast-1' },\n position: 'top-left',\n autoClose: 5000,\n showProgressBar: true,\n closeOnClick: false,\n enableMultiContainer: false,\n} as const;\n\nconst ExampleUsageComponent = () => (\n <>\n {/* works with explicitly casted props, all syntaxes */}\n <DSToast {...testExplicitDefinition} />\n <DSToast {...testInferedTypeCompatibility} />\n <DSToast {...testDefinitionAsConst} />\n {/* works with inline values */}\n <DSToast\n containerProps={{ 'data-testid': 'ds-toast-1' }}\n position=\"top-left\"\n autoClose={5000}\n showProgressBar={true}\n closeOnClick={false}\n enableMultiContainer={false}\n />\n </>\n);\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;AAAA,YAAuB;AC6FrB;AA5FF,mBAA0B;AAC1B,eAAwB;AAUxB,MAAM,qBAAiB,wBAA6B;AAEpD,MAAM,oBAAiD,CAAC;AAExD,MAAM,oBAAiD;AAAA,EACrD,aAAa;AAAA,EACb;AACF;AAIA,MAAM,sBAA2D;AAAA,EAC/D,gBAAgB,EAAE,eAAe,aAAa;AAAA,EAC9C,UAAU;AAAA,EACV,iBAAiB;AACnB;AAEA,MAAM,YAAkC;AAAA,EACtC,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AACL;AAEA,MAAM,oBAAoB;AAAA,EACxB,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AACL;AAGA,MAAM,uBAA6D;AAAA,EACjE,gBAAgB,EAAE,eAAe,aAAa;AAAA,EAC9C,UAAU;AAAA,EACV,WAAW;AAAA,EACX,iBAAiB;AAAA,EACjB,cAAc;AAAA,EACd,sBAAsB;AACxB;AAEA,MAAM,oBAA6C;AAAA,EACjD,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AACL;AAEA,MAAM,4BAA4B;AAAA,EAChC,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AACL;AAGA,MAAM,yBAA+C;AAAA,EACnD,gBAAgB,EAAE,eAAe,aAAa;AAAA,EAC9C,UAAU;AAAA,EACV,WAAW;AAAA,EACX,iBAAiB;AAAA,EACjB,cAAc;AAAA,EACd,sBAAsB;AACxB;AAGA,MAAM,+BAA+B;AAAA,EACnC,gBAAgB,EAAE,eAAe,aAAa;AAAA,EAC9C,UAAU;AAAA,EACV,WAAW;AAAA,EACX,iBAAiB;AAAA,EACjB,cAAc;AAAA,EACd,sBAAsB;AACxB;AAEA,MAAM,wBAAwB;AAAA,EAC5B,gBAAgB,EAAE,eAAe,aAAa;AAAA,EAC9C,UAAU;AAAA,EACV,WAAW;AAAA,EACX,iBAAiB;AAAA,EACjB,cAAc;AAAA,EACd,sBAAsB;AACxB;AAEA,MAAM,wBAAwB,MAC5B,4EAEE;AAAA,8CAAC,oBAAS,GAAG,wBAAwB;AAAA,EACrC,4CAAC,oBAAS,GAAG,8BAA8B;AAAA,EAC3C,4CAAC,oBAAS,GAAG,uBAAuB;AAAA,EAEpC;AAAA,IAAC;AAAA;AAAA,MACC,gBAAgB,EAAE,eAAe,aAAa;AAAA,MAC9C,UAAS;AAAA,MACT,WAAW;AAAA,MACX,iBAAiB;AAAA,MACjB,cAAc;AAAA,MACd,sBAAsB;AAAA;AAAA,EACxB;AAAA,GACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -2,8 +2,8 @@ import * as React from "react";
|
|
|
2
2
|
import { useGetGlobalAttributes, useGetXstyledProps, useMemoMergePropsWithDefault } from "@elliemae/ds-props-helpers";
|
|
3
3
|
import { useRef } from "react";
|
|
4
4
|
import { omit } from "lodash-es";
|
|
5
|
-
import { mergeRefs } from "@elliemae/ds-system";
|
|
6
5
|
import { defaultProps } from "../react-desc-prop-types.js";
|
|
6
|
+
import { mergeRefs } from "@elliemae/ds-system";
|
|
7
7
|
const useToast = (props) => {
|
|
8
8
|
const propsWithDefault = useMemoMergePropsWithDefault(
|
|
9
9
|
props,
|
|
@@ -21,7 +21,7 @@ const useToast = (props) => {
|
|
|
21
21
|
const container = toastifyWrapperRef.current;
|
|
22
22
|
const closeButton = document.querySelector(".toast-close-button");
|
|
23
23
|
const actions = [...document.querySelectorAll('.toast-action-text[role="button"]')];
|
|
24
|
-
const
|
|
24
|
+
const activeElement = document.activeElement;
|
|
25
25
|
if (closeButton === activeElement) {
|
|
26
26
|
if (actions.length === 0) return;
|
|
27
27
|
if (event.shiftKey) actions[actions.length - 1].focus();
|
|
@@ -37,8 +37,10 @@ const useToast = (props) => {
|
|
|
37
37
|
if (event.shiftKey) {
|
|
38
38
|
if (index === 0) closeButton.focus();
|
|
39
39
|
else actions[index - 1].focus();
|
|
40
|
-
} else
|
|
41
|
-
|
|
40
|
+
} else {
|
|
41
|
+
if (index === actions.length - 1) closeButton.focus();
|
|
42
|
+
else actions[index + 1].focus();
|
|
43
|
+
}
|
|
42
44
|
} else if (event.key === "Escape") {
|
|
43
45
|
const closeButton = toastCloseButtonRef.current;
|
|
44
46
|
if (closeButton) closeButton.click();
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../src/config/useToast.ts"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable complexity */\nimport { useGetGlobalAttributes, useGetXstyledProps, useMemoMergePropsWithDefault } from '@elliemae/ds-props-helpers';\nimport { useRef } from 'react';\nimport { omit } from 'lodash-es';\nimport
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;ACCvB,SAAS,wBAAwB,oBAAoB,oCAAoC;AACzF,SAAS,cAAc;AACvB,SAAS,YAAY;
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable complexity */\nimport { useGetGlobalAttributes, useGetXstyledProps, useMemoMergePropsWithDefault } from '@elliemae/ds-props-helpers';\nimport { useRef } from 'react';\nimport { omit } from 'lodash-es';\nimport type { DSToastT } from '../react-desc-prop-types.js';\nimport { defaultProps } from '../react-desc-prop-types.js';\nimport { mergeRefs } from '@elliemae/ds-system';\n\nexport const useToast = (props: DSToastT.Props) => {\n const propsWithDefault = useMemoMergePropsWithDefault<DSToastT.InternalProps>(\n props,\n defaultProps as Partial<DSToastT.InternalProps>,\n );\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 toastCloseButtonRef = useRef<HTMLButtonElement | null>(null);\n\n const closeButtonRef = mergeRefs(toastCloseButtonRef, propsWithDefault.closeButtonRef);\n\n const onKeyDown = (event: React.KeyboardEvent<HTMLDivElement>) => {\n if (event.key === 'Tab') {\n event.preventDefault();\n event.stopPropagation();\n\n const container = toastifyWrapperRef.current;\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 return;\n }\n\n // If the container is focused\n // No actions => we focus the close button\n // 2) Shift + Tab => we focus the last action\n // 3) Tab => we focus the close button\n if (container === activeElement) {\n if (actions.length === 0 || !event.shiftKey) closeButton.focus();\n else actions[actions.length - 1].focus();\n return;\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 } else if (event.key === 'Escape') {\n const closeButton = toastCloseButtonRef.current;\n if (closeButton) closeButton.click();\n }\n };\n\n return {\n propsWithDefault,\n toastifyWrapperRef,\n onKeyDown,\n globalAttributes,\n xstyledAttributes,\n closeButtonRef,\n };\n};\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACCvB,SAAS,wBAAwB,oBAAoB,oCAAoC;AACzF,SAAS,cAAc;AACvB,SAAS,YAAY;AAErB,SAAS,oBAAoB;AAC7B,SAAS,iBAAiB;AAEnB,MAAM,WAAW,CAAC,UAA0B;AACjD,QAAM,mBAAmB;AAAA,IACvB;AAAA,IACA;AAAA,EACF;AAEA,QAAM,mBAAmB,uBAAuB,gBAAgB;AAEhE,QAAM,oBAAoB,mBAAmB,KAAK,kBAAkB,UAAU,CAAC;AAE/E,QAAM,qBAAqB,OAA8B,IAAI;AAE7D,QAAM,sBAAsB,OAAiC,IAAI;AAEjE,QAAM,iBAAiB,UAAU,qBAAqB,iBAAiB,cAAc;AAErF,QAAM,YAAY,CAAC,UAA+C;AAChE,QAAI,MAAM,QAAQ,OAAO;AACvB,YAAM,eAAe;AACrB,YAAM,gBAAgB;AAEtB,YAAM,YAAY,mBAAmB;AACrC,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,EAAG;AAC1B,YAAI,MAAM,SAAU,SAAQ,QAAQ,SAAS,CAAC,EAAE,MAAM;AAAA,YACjD,SAAQ,CAAC,EAAE,MAAM;AACtB;AAAA,MACF;AAMA,UAAI,cAAc,eAAe;AAC/B,YAAI,QAAQ,WAAW,KAAK,CAAC,MAAM,SAAU,aAAY,MAAM;AAAA,YAC1D,SAAQ,QAAQ,SAAS,CAAC,EAAE,MAAM;AACvC;AAAA,MACF;AAEA,YAAM,QAAQ,QAAQ,QAAQ,aAA+B;AAK7D,UAAI,MAAM,UAAU;AAClB,YAAI,UAAU,EAAG,aAAY,MAAM;AAAA,YAC9B,SAAQ,QAAQ,CAAC,EAAE,MAAM;AAAA,MAChC,OAAO;AACL,YAAI,UAAU,QAAQ,SAAS,EAAG,aAAY,MAAM;AAAA,YAC/C,SAAQ,QAAQ,CAAC,EAAE,MAAM;AAAA,MAChC;AAAA,IACF,WAAW,MAAM,QAAQ,UAAU;AACjC,YAAM,cAAc,oBAAoB;AACxC,UAAI,YAAa,aAAY,MAAM;AAAA,IACrC;AAAA,EACF;AAEA,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/esm/index.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../src/index.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;
|
|
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 { DSToastContent, DSToastContentWithSchema } from './parts/DSToastContent.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 type { DSToastT } from './react-desc-prop-types.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,SAAS,gBAAgB,gCAAgC;AACzD;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { describe } from "@elliemae/ds-props-helpers";
|
|
4
3
|
import { DSToastContentPropTypes } from "../react-desc-prop-types.js";
|
|
4
|
+
import { describe } from "@elliemae/ds-props-helpers";
|
|
5
5
|
import {
|
|
6
6
|
StyledContainer,
|
|
7
7
|
StyledIconContainer,
|
|
@@ -25,7 +25,7 @@ const DSToastContent = ({
|
|
|
25
25
|
/* @__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 }) }),
|
|
26
26
|
/* @__PURE__ */ jsxs(StyledMessageContent, { className: "em-ds-toast-content__message-content", children: [
|
|
27
27
|
/* @__PURE__ */ jsx(StyledMessageHeader, { className: "em-ds-toast-content__message-header", children: messageTitle }),
|
|
28
|
-
/* @__PURE__ */ jsx(StyledMessageText, { className: "em-ds-toast-content__message-text", children: messageComponent
|
|
28
|
+
/* @__PURE__ */ jsx(StyledMessageText, { className: "em-ds-toast-content__message-text", children: messageComponent ? messageComponent : messageText })
|
|
29
29
|
] })
|
|
30
30
|
] });
|
|
31
31
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
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-icons';\nimport {
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;ACqCf,cAEF,YAFE;AAnCR,SAAS,gBAAgB;AACzB
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React from 'react';\nimport type { SvgIconT } from '@elliemae/ds-icons';\nimport { DSToastContentPropTypes, type DSToastT } from '../react-desc-prop-types.js';\nimport { describe } from '@elliemae/ds-props-helpers';\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';\nimport { DSToastContentName } from '../DSToastDefinitions.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 messageComponent?: React.ReactNode;\n}\n\nconst DSToastContent: React.ComponentType<DSToastContentProps> = ({\n type = ToastType.DEFAULT,\n messageTitle = '',\n messageText = '',\n messageComponent,\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\">\n {messageComponent ? messageComponent : messageText}\n </StyledMessageText>\n </StyledMessageContent>\n </StyledContainer>\n );\n};\n\nDSToastContent.displayName = DSToastContentName;\nconst DSToastContentWithSchema = describe(DSToastContent);\nDSToastContentWithSchema.propTypes = DSToastContentPropTypes;\n\nexport { DSToastContent, DSToastContentWithSchema };\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACqCf,cAEF,YAFE;AAnCR,SAAS,+BAA8C;AACvD,SAAS,gBAAgB;AACzB;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,WAAW,cAAc,0BAA0B;AAC5D,SAAS,0BAA0B;AAE5B,MAAM,qBAAqB,CAAC,SAA8B,aAAa,IAAI;AAC3E,MAAM,0BAA0B,CAAC,SACtC,mBAAmB,IAAI;AASzB,MAAM,iBAA2D,CAAC;AAAA,EAChE,OAAO,UAAU;AAAA,EACjB,eAAe;AAAA,EACf,cAAc;AAAA,EACd;AACF,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,qCAC1B,6BAAmB,mBAAmB,aACzC;AAAA,OACF;AAAA,KACF;AAEJ;AAEA,eAAe,cAAc;AAC7B,MAAM,2BAA2B,SAAS,cAAc;AACxD,yBAAyB,YAAY;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../src/typescript-testing/typescript-toast-valid.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable @typescript-eslint/no-unused-vars, no-unused-vars */\nimport { createRef } from 'react';\nimport { DSToast } from '../index.js';\nimport type { DSToastT } from '../index.js';\n\n// test we expose the namespace and the namespace follows our deliverable conventions\ntype ComponentPropsForApp = DSToastT.Props;\ntype ComponentPropsInternals = DSToastT.InternalProps;\ntype ComponentPropsDefaultProps = DSToastT.DefaultProps;\ntype ComponentPropsOptionalProps = DSToastT.OptionalProps;\ntype ComponentPropsRequiredProps = DSToastT.RequiredProps;\n\nconst closeButtonRef = createRef<HTMLButtonElement>();\n\nconst testRequiredProps: ComponentPropsRequiredProps = {};\n\nconst testOptionalProps: ComponentPropsOptionalProps = {\n containerId: '',\n closeButtonRef,\n};\n\n// difference Props and InternalProps is that InternalProps has all the default props filled in\n// Props allows for partial defaults\nconst testPartialDefaults: Partial<ComponentPropsDefaultProps> = {\n containerProps: { 'data-testid': 'ds-toast-1' },\n position: 'top-center',\n showProgressBar: false,\n};\n\nconst testProps: ComponentPropsForApp = {\n ...testRequiredProps,\n ...testOptionalProps,\n ...testPartialDefaults,\n};\n\nconst testPropsAsSyntax = {\n ...testRequiredProps,\n ...testOptionalProps,\n ...testPartialDefaults,\n} as ComponentPropsForApp;\n\n// InternalProps requires all defaults to be filled in\nconst testCompleteDefaults: Required<ComponentPropsDefaultProps> = {\n containerProps: { 'data-testid': 'ds-toast-1' },\n position: 'top-center',\n autoClose: 2000,\n showProgressBar: true,\n closeOnClick: true,\n enableMultiContainer: false,\n};\n\nconst testInternalProps: ComponentPropsInternals = {\n ...testRequiredProps,\n ...testOptionalProps,\n ...testCompleteDefaults,\n};\n\nconst testInternalPropsAsSyntax = {\n ...testRequiredProps,\n ...testOptionalProps,\n ...testCompleteDefaults,\n} as ComponentPropsInternals;\n\n// using the explicit type definition, if there is an error, it will be marked on the key that is wrong\nconst testExplicitDefinition: ComponentPropsForApp = {\n containerProps: { 'data-testid': 'ds-toast-1' },\n position: 'top-left',\n autoClose: 5000,\n showProgressBar: true,\n closeOnClick: false,\n enableMultiContainer: false,\n};\n\n// using the \"as\" syntax, if there is an error, it will be marking the whole object as wrong because it is not compatible with the type\nconst testInferedTypeCompatibility = {\n containerProps: { 'data-testid': 'ds-toast-1' },\n position: 'top-left',\n autoClose: 5000,\n showProgressBar: true,\n closeOnClick: false,\n enableMultiContainer: false,\n} as ComponentPropsForApp;\n\nconst testDefinitionAsConst = {\n containerProps: { 'data-testid': 'ds-toast-1' },\n position: 'top-left',\n autoClose: 5000,\n showProgressBar: true,\n closeOnClick: false,\n enableMultiContainer: false,\n} as const;\n\nconst ExampleUsageComponent = () => (\n <>\n {/* works with explicitly casted props, all syntaxes */}\n <DSToast {...testExplicitDefinition} />\n <DSToast {...testInferedTypeCompatibility} />\n <DSToast {...testDefinitionAsConst} />\n {/* works with inline values */}\n <DSToast\n containerProps={{ 'data-testid': 'ds-toast-1' }}\n position=\"top-left\"\n autoClose={5000}\n showProgressBar\n closeOnClick={false}\n enableMultiContainer={false}\n />\n </>\n);\n"],
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;AC6FrB,mBAEE,KAFF;AA5FF,SAAS,iBAAiB;AAC1B,SAAS,eAAe;AAUxB,MAAM,iBAAiB,UAA6B;AAEpD,MAAM,oBAAiD,CAAC;AAExD,MAAM,oBAAiD;AAAA,EACrD,aAAa;AAAA,EACb;AACF;AAIA,MAAM,sBAA2D;AAAA,EAC/D,gBAAgB,EAAE,eAAe,aAAa;AAAA,EAC9C,UAAU;AAAA,EACV,iBAAiB;AACnB;AAEA,MAAM,YAAkC;AAAA,EACtC,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AACL;AAEA,MAAM,oBAAoB;AAAA,EACxB,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AACL;AAGA,MAAM,uBAA6D;AAAA,EACjE,gBAAgB,EAAE,eAAe,aAAa;AAAA,EAC9C,UAAU;AAAA,EACV,WAAW;AAAA,EACX,iBAAiB;AAAA,EACjB,cAAc;AAAA,EACd,sBAAsB;AACxB;AAEA,MAAM,oBAA6C;AAAA,EACjD,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AACL;AAEA,MAAM,4BAA4B;AAAA,EAChC,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AACL;AAGA,MAAM,yBAA+C;AAAA,EACnD,gBAAgB,EAAE,eAAe,aAAa;AAAA,EAC9C,UAAU;AAAA,EACV,WAAW;AAAA,EACX,iBAAiB;AAAA,EACjB,cAAc;AAAA,EACd,sBAAsB;AACxB;AAGA,MAAM,+BAA+B;AAAA,EACnC,gBAAgB,EAAE,eAAe,aAAa;AAAA,EAC9C,UAAU;AAAA,EACV,WAAW;AAAA,EACX,iBAAiB;AAAA,EACjB,cAAc;AAAA,EACd,sBAAsB;AACxB;AAEA,MAAM,wBAAwB;AAAA,EAC5B,gBAAgB,EAAE,eAAe,aAAa;AAAA,EAC9C,UAAU;AAAA,EACV,WAAW;AAAA,EACX,iBAAiB;AAAA,EACjB,cAAc;AAAA,EACd,sBAAsB;AACxB;AAEA,MAAM,wBAAwB,MAC5B,iCAEE;AAAA,sBAAC,WAAS,GAAG,wBAAwB;AAAA,EACrC,oBAAC,WAAS,GAAG,8BAA8B;AAAA,EAC3C,oBAAC,WAAS,GAAG,uBAAuB;AAAA,EAEpC;AAAA,IAAC;AAAA;AAAA,MACC,gBAAgB,EAAE,eAAe,aAAa;AAAA,MAC9C,UAAS;AAAA,MACT,WAAW;AAAA,MACX,
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable @typescript-eslint/no-unused-vars, no-unused-vars */\nimport { createRef } from 'react';\nimport { DSToast } from '../index.js';\nimport type { DSToastT } from '../index.js';\n\n// test we expose the namespace and the namespace follows our deliverable conventions\ntype ComponentPropsForApp = DSToastT.Props;\ntype ComponentPropsInternals = DSToastT.InternalProps;\ntype ComponentPropsDefaultProps = DSToastT.DefaultProps;\ntype ComponentPropsOptionalProps = DSToastT.OptionalProps;\ntype ComponentPropsRequiredProps = DSToastT.RequiredProps;\n\nconst closeButtonRef = createRef<HTMLButtonElement>();\n\nconst testRequiredProps: ComponentPropsRequiredProps = {};\n\nconst testOptionalProps: ComponentPropsOptionalProps = {\n containerId: '',\n closeButtonRef: closeButtonRef,\n};\n\n// difference Props and InternalProps is that InternalProps has all the default props filled in\n// Props allows for partial defaults\nconst testPartialDefaults: Partial<ComponentPropsDefaultProps> = {\n containerProps: { 'data-testid': 'ds-toast-1' },\n position: 'top-center',\n showProgressBar: false,\n};\n\nconst testProps: ComponentPropsForApp = {\n ...testRequiredProps,\n ...testOptionalProps,\n ...testPartialDefaults,\n};\n\nconst testPropsAsSyntax = {\n ...testRequiredProps,\n ...testOptionalProps,\n ...testPartialDefaults,\n} as ComponentPropsForApp;\n\n// InternalProps requires all defaults to be filled in\nconst testCompleteDefaults: Required<ComponentPropsDefaultProps> = {\n containerProps: { 'data-testid': 'ds-toast-1' },\n position: 'top-center',\n autoClose: 2000,\n showProgressBar: true,\n closeOnClick: true,\n enableMultiContainer: false,\n};\n\nconst testInternalProps: ComponentPropsInternals = {\n ...testRequiredProps,\n ...testOptionalProps,\n ...testCompleteDefaults,\n};\n\nconst testInternalPropsAsSyntax = {\n ...testRequiredProps,\n ...testOptionalProps,\n ...testCompleteDefaults,\n} as ComponentPropsInternals;\n\n// using the explicit type definition, if there is an error, it will be marked on the key that is wrong\nconst testExplicitDefinition: ComponentPropsForApp = {\n containerProps: { 'data-testid': 'ds-toast-1' },\n position: 'top-left',\n autoClose: 5000,\n showProgressBar: true,\n closeOnClick: false,\n enableMultiContainer: false,\n};\n\n// using the \"as\" syntax, if there is an error, it will be marking the whole object as wrong because it is not compatible with the type\nconst testInferedTypeCompatibility = {\n containerProps: { 'data-testid': 'ds-toast-1' },\n position: 'top-left',\n autoClose: 5000,\n showProgressBar: true,\n closeOnClick: false,\n enableMultiContainer: false,\n} as ComponentPropsForApp;\n\nconst testDefinitionAsConst = {\n containerProps: { 'data-testid': 'ds-toast-1' },\n position: 'top-left',\n autoClose: 5000,\n showProgressBar: true,\n closeOnClick: false,\n enableMultiContainer: false,\n} as const;\n\nconst ExampleUsageComponent = () => (\n <>\n {/* works with explicitly casted props, all syntaxes */}\n <DSToast {...testExplicitDefinition} />\n <DSToast {...testInferedTypeCompatibility} />\n <DSToast {...testDefinitionAsConst} />\n {/* works with inline values */}\n <DSToast\n containerProps={{ 'data-testid': 'ds-toast-1' }}\n position=\"top-left\"\n autoClose={5000}\n showProgressBar={true}\n closeOnClick={false}\n enableMultiContainer={false}\n />\n </>\n);\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;AC6FrB,mBAEE,KAFF;AA5FF,SAAS,iBAAiB;AAC1B,SAAS,eAAe;AAUxB,MAAM,iBAAiB,UAA6B;AAEpD,MAAM,oBAAiD,CAAC;AAExD,MAAM,oBAAiD;AAAA,EACrD,aAAa;AAAA,EACb;AACF;AAIA,MAAM,sBAA2D;AAAA,EAC/D,gBAAgB,EAAE,eAAe,aAAa;AAAA,EAC9C,UAAU;AAAA,EACV,iBAAiB;AACnB;AAEA,MAAM,YAAkC;AAAA,EACtC,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AACL;AAEA,MAAM,oBAAoB;AAAA,EACxB,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AACL;AAGA,MAAM,uBAA6D;AAAA,EACjE,gBAAgB,EAAE,eAAe,aAAa;AAAA,EAC9C,UAAU;AAAA,EACV,WAAW;AAAA,EACX,iBAAiB;AAAA,EACjB,cAAc;AAAA,EACd,sBAAsB;AACxB;AAEA,MAAM,oBAA6C;AAAA,EACjD,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AACL;AAEA,MAAM,4BAA4B;AAAA,EAChC,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AACL;AAGA,MAAM,yBAA+C;AAAA,EACnD,gBAAgB,EAAE,eAAe,aAAa;AAAA,EAC9C,UAAU;AAAA,EACV,WAAW;AAAA,EACX,iBAAiB;AAAA,EACjB,cAAc;AAAA,EACd,sBAAsB;AACxB;AAGA,MAAM,+BAA+B;AAAA,EACnC,gBAAgB,EAAE,eAAe,aAAa;AAAA,EAC9C,UAAU;AAAA,EACV,WAAW;AAAA,EACX,iBAAiB;AAAA,EACjB,cAAc;AAAA,EACd,sBAAsB;AACxB;AAEA,MAAM,wBAAwB;AAAA,EAC5B,gBAAgB,EAAE,eAAe,aAAa;AAAA,EAC9C,UAAU;AAAA,EACV,WAAW;AAAA,EACX,iBAAiB;AAAA,EACjB,cAAc;AAAA,EACd,sBAAsB;AACxB;AAEA,MAAM,wBAAwB,MAC5B,iCAEE;AAAA,sBAAC,WAAS,GAAG,wBAAwB;AAAA,EACrC,oBAAC,WAAS,GAAG,8BAA8B;AAAA,EAC3C,oBAAC,WAAS,GAAG,uBAAuB;AAAA,EAEpC;AAAA,IAAC;AAAA;AAAA,MACC,gBAAgB,EAAE,eAAe,aAAa;AAAA,MAC9C,UAAS;AAAA,MACT,WAAW;AAAA,MACX,iBAAiB;AAAA,MACjB,cAAc;AAAA,MACd,sBAAsB;AAAA;AAAA,EACxB;AAAA,GACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -79,7 +79,7 @@ export declare const useToast: (props: DSToastT.Props) => {
|
|
|
79
79
|
onBlurCapture?: import("react").FocusEventHandler<Element> | undefined;
|
|
80
80
|
onChange?: import("react").FormEventHandler<Element> | undefined;
|
|
81
81
|
onChangeCapture?: import("react").FormEventHandler<Element> | undefined;
|
|
82
|
-
onBeforeInput?: import("react").
|
|
82
|
+
onBeforeInput?: import("react").FormEventHandler<Element> | undefined;
|
|
83
83
|
onBeforeInputCapture?: import("react").FormEventHandler<Element> | undefined;
|
|
84
84
|
onInput?: import("react").FormEventHandler<Element> | undefined;
|
|
85
85
|
onInputCapture?: import("react").FormEventHandler<Element> | undefined;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elliemae/ds-toast",
|
|
3
|
-
"version": "3.55.
|
|
3
|
+
"version": "3.55.1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "ICE MT - Dimsum - Toast",
|
|
6
6
|
"files": [
|
|
@@ -39,18 +39,18 @@
|
|
|
39
39
|
"@xstyled/system": "~3.7.3",
|
|
40
40
|
"@xstyled/util": "~3.7.0",
|
|
41
41
|
"react-toastify": "~6.2.0",
|
|
42
|
-
"@elliemae/ds-button-v2": "3.55.
|
|
43
|
-
"@elliemae/ds-
|
|
44
|
-
"@elliemae/ds-
|
|
45
|
-
"@elliemae/ds-system": "3.55.
|
|
46
|
-
"@elliemae/ds-typescript-helpers": "3.55.
|
|
42
|
+
"@elliemae/ds-button-v2": "3.55.1",
|
|
43
|
+
"@elliemae/ds-props-helpers": "3.55.1",
|
|
44
|
+
"@elliemae/ds-icons": "3.55.1",
|
|
45
|
+
"@elliemae/ds-system": "3.55.1",
|
|
46
|
+
"@elliemae/ds-typescript-helpers": "3.55.1"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
49
|
"@elliemae/pui-cli": "9.0.0-next.65",
|
|
50
50
|
"jest": "~29.7.0",
|
|
51
51
|
"styled-components": "~5.3.9",
|
|
52
|
-
"@elliemae/ds-
|
|
53
|
-
"@elliemae/ds-
|
|
52
|
+
"@elliemae/ds-monorepo-devops": "3.55.1",
|
|
53
|
+
"@elliemae/ds-test-utils": "3.55.1"
|
|
54
54
|
},
|
|
55
55
|
"peerDependencies": {
|
|
56
56
|
"lodash-es": "^4.17.21",
|