@elliemae/ds-dialog 3.60.0-next.53 → 3.60.0-next.55
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/index.js +4 -3
- package/dist/cjs/index.js.map +2 -2
- package/dist/cjs/parts/DSDialogContent/DSDialogContent.js +3 -3
- package/dist/cjs/parts/DSDialogContent/DSDialogContent.js.map +2 -2
- package/dist/cjs/parts/DSDialogContent/useDialogContent.js +11 -3
- package/dist/cjs/parts/DSDialogContent/useDialogContent.js.map +2 -2
- package/dist/esm/index.js +4 -2
- package/dist/esm/index.js.map +2 -2
- package/dist/esm/parts/DSDialogContent/DSDialogContent.js +3 -3
- package/dist/esm/parts/DSDialogContent/DSDialogContent.js.map +2 -2
- package/dist/esm/parts/DSDialogContent/useDialogContent.js +12 -4
- package/dist/esm/parts/DSDialogContent/useDialogContent.js.map +2 -2
- package/dist/types/index.d.ts +1 -1
- package/dist/types/parts/DSDialogContent/useDialogContent.d.ts +2 -1
- package/dist/types/tests/DSDialog.events.test.d.ts +1 -0
- package/dist/types/tests/DSDialog.exports.test.d.ts +1 -0
- package/dist/types/tests/DSDialog.keyboard.test.d.ts +1 -0
- package/dist/types/tests/playwright/DSDialog.on-click-outside.test.playwright.d.ts +1 -0
- package/dist/types/tests/playwright/DSDialogOnClickOutsideRenderer.d.ts +2 -0
- package/package.json +12 -9
- /package/dist/types/tests/{DSDialog.test.d.ts → DSDialog.PUI-7832.test.d.ts} +0 -0
package/dist/cjs/index.js
CHANGED
|
@@ -17,7 +17,6 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
17
|
}
|
|
18
18
|
return to;
|
|
19
19
|
};
|
|
20
|
-
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
21
20
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
22
21
|
// If the importer is in node compatibility mode or this is not an ESM
|
|
23
22
|
// file that has been converted to a CommonJS file using a Babel-
|
|
@@ -31,6 +30,7 @@ var index_exports = {};
|
|
|
31
30
|
__export(index_exports, {
|
|
32
31
|
DIALOG_DATA_TESTID: () => import_constants.DIALOG_DATA_TESTID,
|
|
33
32
|
DIALOG_SLOTS: () => import_constants.DIALOG_SLOTS,
|
|
33
|
+
DSDialog: () => import_DSDialog.DSDialog,
|
|
34
34
|
DSDialogAddon: () => import_parts.DSDialogAddon,
|
|
35
35
|
DSDialogAddonWithSchema: () => import_parts.DSDialogAddonWithSchema,
|
|
36
36
|
DSDialogBody: () => import_parts.DSDialogBody,
|
|
@@ -51,11 +51,12 @@ __export(index_exports, {
|
|
|
51
51
|
DSDialogSeparatorWithSchema: () => import_parts.DSDialogSeparatorWithSchema,
|
|
52
52
|
DSDialogSizes: () => import_utils.DSDialogSizes,
|
|
53
53
|
DSDialogTitle: () => import_parts.DSDialogTitle,
|
|
54
|
-
DSDialogTitleWithSchema: () => import_parts.DSDialogTitleWithSchema
|
|
54
|
+
DSDialogTitleWithSchema: () => import_parts.DSDialogTitleWithSchema,
|
|
55
|
+
DSDialogWithSchema: () => import_DSDialog.DSDialogWithSchema
|
|
55
56
|
});
|
|
56
57
|
module.exports = __toCommonJS(index_exports);
|
|
57
58
|
var React = __toESM(require("react"));
|
|
58
|
-
|
|
59
|
+
var import_DSDialog = require("./DSDialog.js");
|
|
59
60
|
var import_constants = require("./constants/index.js");
|
|
60
61
|
var import_utils = require("./utils.js");
|
|
61
62
|
var import_parts = require("./parts/index.js");
|
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": ["import type {} from '@xstyled/system';\nimport type {} from '@xstyled/util';\n\nexport
|
|
5
|
-
"mappings": "
|
|
4
|
+
"sourcesContent": ["import type {} from '@xstyled/system';\nimport type {} from '@xstyled/util';\n\nexport { DSDialog, DSDialogWithSchema } from './DSDialog.js';\nexport { DIALOG_DATA_TESTID, DIALOG_SLOTS, DSDialogName, DSDialogDatatestid } from './constants/index.js';\nexport { DSDialogSizes } from './utils.js';\nexport {\n DSDialogBody,\n DSDialogBodyWithSchema,\n DSDialogHeader,\n DSDialogHeaderWithSchema,\n DSDialogFooter,\n DSDialogFooterWithSchema,\n DSDialogSeparator,\n DSDialogSeparatorWithSchema,\n DSDialogTitle,\n DSDialogTitleWithSchema,\n DSDialogAddon,\n DSDialogAddonWithSchema,\n DSDialogDefaultLayout,\n DSDialogDefaultLayoutWithSchema,\n DSDialogPrimaryMessage,\n DSDialogPrimaryMessageWithSchema,\n DSDialogSecondaryMessage,\n DSDialogSecondaryMessageWithSchema,\n} from './parts/index.js';\nexport type { DSDialogT } 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;AAAA;AAAA;AAAA;ACAA,YAAuB;ADGvB,sBAA6C;AAC7C,uBAAmF;AACnF,mBAA8B;AAC9B,mBAmBO;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -41,11 +41,10 @@ var import_constants = require("../../constants/index.js");
|
|
|
41
41
|
var import_DSDialogCTX = require("../../DSDialogCTX.js");
|
|
42
42
|
var import_useDialogContent = require("./useDialogContent.js");
|
|
43
43
|
const DSDialogContent = () => {
|
|
44
|
-
const {
|
|
44
|
+
const { handleBackgroundMouseDown, handleBackgroundMouseUp, handleOnKeyDown } = (0, import_useDialogContent.useDialogContent)();
|
|
45
45
|
const { props, containerRef, portalInfo, portalClassName } = (0, import_react.useContext)(import_DSDialogCTX.DSDialogContext);
|
|
46
46
|
const { removeAutoFocus, zIndex, centered, size, width, children, ...rest } = props;
|
|
47
47
|
const { className, ...restOfGlobalAttributes } = (0, import_ds_props_helpers.useGetGlobalAttributes)(props, {
|
|
48
|
-
onClick: handleOutsideClick,
|
|
49
48
|
onKeyDown: handleOnKeyDown
|
|
50
49
|
});
|
|
51
50
|
const getOwnerProps = (0, import_react.useCallback)(() => props, [props]);
|
|
@@ -63,7 +62,8 @@ const DSDialogContent = () => {
|
|
|
63
62
|
import_styles.StyledDialogBackground,
|
|
64
63
|
{
|
|
65
64
|
className,
|
|
66
|
-
|
|
65
|
+
onMouseDown: handleBackgroundMouseDown,
|
|
66
|
+
onMouseUp: handleBackgroundMouseUp,
|
|
67
67
|
"data-portalbg": true,
|
|
68
68
|
"data-testid": import_constants.DSDialogDatatestid.BACKGROUND,
|
|
69
69
|
getOwnerProps,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/parts/DSDialogContent/DSDialogContent.tsx", "../../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["import React, { useCallback, useContext } from 'react';\nimport { useGetGlobalAttributes } from '@elliemae/ds-props-helpers';\nimport { PortalStyles, StyledDialogBackground, StyledDialogContainer } from '../../styles.js';\nimport { getSpaceProps } from '../../utils.js';\nimport { DSDialogDatatestid } from '../../constants/index.js';\nimport { DSDialogContext } from '../../DSDialogCTX.js';\nimport { useDialogContent } from './useDialogContent.js';\n\nexport const DSDialogContent = () => {\n const {
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;
|
|
4
|
+
"sourcesContent": ["import React, { useCallback, useContext } from 'react';\nimport { useGetGlobalAttributes } from '@elliemae/ds-props-helpers';\nimport { PortalStyles, StyledDialogBackground, StyledDialogContainer } from '../../styles.js';\nimport { getSpaceProps } from '../../utils.js';\nimport { DSDialogDatatestid } from '../../constants/index.js';\nimport { DSDialogContext } from '../../DSDialogCTX.js';\nimport { useDialogContent } from './useDialogContent.js';\n\nexport const DSDialogContent = () => {\n const { handleBackgroundMouseDown, handleBackgroundMouseUp, handleOnKeyDown } = useDialogContent();\n const { props, containerRef, portalInfo, portalClassName } = useContext(DSDialogContext);\n\n const { removeAutoFocus, zIndex, centered, size, width, children, ...rest } = props;\n\n const { className, ...restOfGlobalAttributes } = useGetGlobalAttributes(props, {\n onKeyDown: handleOnKeyDown,\n });\n\n const getOwnerProps = useCallback(() => props, [props]);\n const getOwnerPropsArguments = useCallback(() => ({}), []);\n\n const refCallback = useCallback(\n (_ref: HTMLDivElement | null) => {\n if (_ref) {\n containerRef.current = _ref;\n if (!removeAutoFocus) _ref.focus();\n }\n },\n [containerRef, removeAutoFocus],\n );\n\n return (\n <StyledDialogBackground\n className={className}\n onMouseDown={handleBackgroundMouseDown}\n onMouseUp={handleBackgroundMouseUp}\n data-portalbg\n data-testid={DSDialogDatatestid.BACKGROUND}\n getOwnerProps={getOwnerProps}\n getOwnerPropsArguments={getOwnerPropsArguments}\n zIndex={zIndex}\n >\n <PortalStyles portalInfo={portalInfo} portalClassName={portalClassName} />\n <StyledDialogContainer\n role=\"dialog\"\n aria-modal\n innerRef={refCallback}\n tabIndex={!removeAutoFocus ? 0 : undefined}\n onKeyDown={handleOnKeyDown}\n {...getSpaceProps(rest as unknown as Record<string, unknown>)}\n centered={centered}\n data-testid={DSDialogDatatestid.CONTAINER}\n getOwnerProps={getOwnerProps}\n getOwnerPropsArguments={getOwnerPropsArguments}\n {...restOfGlobalAttributes}\n size={size}\n width={width}\n >\n {children}\n </StyledDialogContainer>\n </StyledDialogBackground>\n );\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADgCnB;AAhCJ,mBAA+C;AAC/C,8BAAuC;AACvC,oBAA4E;AAC5E,mBAA8B;AAC9B,uBAAmC;AACnC,yBAAgC;AAChC,8BAAiC;AAE1B,MAAM,kBAAkB,MAAM;AACnC,QAAM,EAAE,2BAA2B,yBAAyB,gBAAgB,QAAI,0CAAiB;AACjG,QAAM,EAAE,OAAO,cAAc,YAAY,gBAAgB,QAAI,yBAAW,kCAAe;AAEvF,QAAM,EAAE,iBAAiB,QAAQ,UAAU,MAAM,OAAO,UAAU,GAAG,KAAK,IAAI;AAE9E,QAAM,EAAE,WAAW,GAAG,uBAAuB,QAAI,gDAAuB,OAAO;AAAA,IAC7E,WAAW;AAAA,EACb,CAAC;AAED,QAAM,oBAAgB,0BAAY,MAAM,OAAO,CAAC,KAAK,CAAC;AACtD,QAAM,6BAAyB,0BAAY,OAAO,CAAC,IAAI,CAAC,CAAC;AAEzD,QAAM,kBAAc;AAAA,IAClB,CAAC,SAAgC;AAC/B,UAAI,MAAM;AACR,qBAAa,UAAU;AACvB,YAAI,CAAC,gBAAiB,MAAK,MAAM;AAAA,MACnC;AAAA,IACF;AAAA,IACA,CAAC,cAAc,eAAe;AAAA,EAChC;AAEA,SACE;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA,aAAa;AAAA,MACb,WAAW;AAAA,MACX,iBAAa;AAAA,MACb,eAAa,oCAAmB;AAAA,MAChC;AAAA,MACA;AAAA,MACA;AAAA,MAEA;AAAA,oDAAC,8BAAa,YAAwB,iBAAkC;AAAA,QACxE;AAAA,UAAC;AAAA;AAAA,YACC,MAAK;AAAA,YACL,cAAU;AAAA,YACV,UAAU;AAAA,YACV,UAAU,CAAC,kBAAkB,IAAI;AAAA,YACjC,WAAW;AAAA,YACV,OAAG,4BAAc,IAA0C;AAAA,YAC5D;AAAA,YACA,eAAa,oCAAmB;AAAA,YAChC;AAAA,YACA;AAAA,YACC,GAAG;AAAA,YACJ;AAAA,YACA;AAAA,YAEC;AAAA;AAAA,QACH;AAAA;AAAA;AAAA,EACF;AAEJ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -38,9 +38,16 @@ const useDialogContent = () => {
|
|
|
38
38
|
const {
|
|
39
39
|
props: { onClickOutside, onClose }
|
|
40
40
|
} = (0, import_react.useContext)(import_DSDialogCTX.DSDialogContext);
|
|
41
|
-
const
|
|
41
|
+
const mouseDownOnOverlayRef = (0, import_react.useRef)(false);
|
|
42
|
+
const handleBackgroundMouseDown = (0, import_react.useCallback)((e) => {
|
|
43
|
+
mouseDownOnOverlayRef.current = Boolean(e.target.dataset.portalbg);
|
|
44
|
+
}, []);
|
|
45
|
+
const handleBackgroundMouseUp = (0, import_react.useCallback)(
|
|
42
46
|
(e) => {
|
|
43
|
-
if (e.target.dataset.portalbg)
|
|
47
|
+
if (mouseDownOnOverlayRef.current && e.target.dataset.portalbg) {
|
|
48
|
+
onClickOutside();
|
|
49
|
+
}
|
|
50
|
+
mouseDownOnOverlayRef.current = false;
|
|
44
51
|
},
|
|
45
52
|
[onClickOutside]
|
|
46
53
|
);
|
|
@@ -51,7 +58,8 @@ const useDialogContent = () => {
|
|
|
51
58
|
[onClose]
|
|
52
59
|
);
|
|
53
60
|
return {
|
|
54
|
-
|
|
61
|
+
handleBackgroundMouseDown,
|
|
62
|
+
handleBackgroundMouseUp,
|
|
55
63
|
handleOnKeyDown
|
|
56
64
|
};
|
|
57
65
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/parts/DSDialogContent/useDialogContent.tsx", "../../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["import type React from 'react';\nimport { useCallback, useContext } from 'react';\nimport { DSDialogContext } from '../../DSDialogCTX.js';\n\nexport const useDialogContent = () => {\n const {\n props: { onClickOutside, onClose },\n } = useContext(DSDialogContext);\n\n const
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADCvB,
|
|
4
|
+
"sourcesContent": ["import type React from 'react';\nimport { useCallback, useContext, useRef } from 'react';\nimport { DSDialogContext } from '../../DSDialogCTX.js';\n\nexport const useDialogContent = () => {\n const {\n props: { onClickOutside, onClose },\n } = useContext(DSDialogContext);\n\n /**\n * PUI-15050 https://jira.elliemae.io/browse/PUI-15050\n * Tracks whether the current press sequence started on the overlay.\n * onClickOutside fires only when both mousedown AND mouseup land on the overlay,\n * preventing false triggers when the user presses the overlay and releases inside the dialog.\n *\n * Lifecycle note: this ref is intentionally not reset on dialog close because DSDialogContent\n * is fully unmounted when isOpen=false (via DSDialogPortal returning null). The ref is\n * destroyed with the component, so stale state across open/close cycles is not possible.\n */\n\n const mouseDownOnOverlayRef = useRef(false);\n\n const handleBackgroundMouseDown = useCallback((e: React.MouseEvent) => {\n mouseDownOnOverlayRef.current = Boolean((e.target as HTMLElement).dataset.portalbg);\n }, []);\n\n const handleBackgroundMouseUp = useCallback(\n (e: React.MouseEvent) => {\n if (mouseDownOnOverlayRef.current && (e.target as HTMLElement).dataset.portalbg) {\n onClickOutside();\n }\n mouseDownOnOverlayRef.current = false;\n },\n [onClickOutside],\n );\n\n const handleOnKeyDown = useCallback(\n (e: React.KeyboardEvent) => {\n if (e.key === 'Escape') onClose();\n },\n [onClose],\n );\n\n return {\n handleBackgroundMouseDown,\n handleBackgroundMouseUp,\n handleOnKeyDown,\n };\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADCvB,mBAAgD;AAChD,yBAAgC;AAEzB,MAAM,mBAAmB,MAAM;AACpC,QAAM;AAAA,IACJ,OAAO,EAAE,gBAAgB,QAAQ;AAAA,EACnC,QAAI,yBAAW,kCAAe;AAa9B,QAAM,4BAAwB,qBAAO,KAAK;AAE1C,QAAM,gCAA4B,0BAAY,CAAC,MAAwB;AACrE,0BAAsB,UAAU,QAAS,EAAE,OAAuB,QAAQ,QAAQ;AAAA,EACpF,GAAG,CAAC,CAAC;AAEL,QAAM,8BAA0B;AAAA,IAC9B,CAAC,MAAwB;AACvB,UAAI,sBAAsB,WAAY,EAAE,OAAuB,QAAQ,UAAU;AAC/E,uBAAe;AAAA,MACjB;AACA,4BAAsB,UAAU;AAAA,IAClC;AAAA,IACA,CAAC,cAAc;AAAA,EACjB;AAEA,QAAM,sBAAkB;AAAA,IACtB,CAAC,MAA2B;AAC1B,UAAI,EAAE,QAAQ,SAAU,SAAQ;AAAA,IAClC;AAAA,IACA,CAAC,OAAO;AAAA,EACV;AAEA,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/esm/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
|
|
2
|
+
import { DSDialog, DSDialogWithSchema } from "./DSDialog.js";
|
|
3
3
|
import { DIALOG_DATA_TESTID, DIALOG_SLOTS, DSDialogName, DSDialogDatatestid } from "./constants/index.js";
|
|
4
4
|
import { DSDialogSizes } from "./utils.js";
|
|
5
5
|
import {
|
|
@@ -25,6 +25,7 @@ import {
|
|
|
25
25
|
export {
|
|
26
26
|
DIALOG_DATA_TESTID,
|
|
27
27
|
DIALOG_SLOTS,
|
|
28
|
+
DSDialog,
|
|
28
29
|
DSDialogAddon,
|
|
29
30
|
DSDialogAddonWithSchema,
|
|
30
31
|
DSDialogBody,
|
|
@@ -45,6 +46,7 @@ export {
|
|
|
45
46
|
DSDialogSeparatorWithSchema,
|
|
46
47
|
DSDialogSizes,
|
|
47
48
|
DSDialogTitle,
|
|
48
|
-
DSDialogTitleWithSchema
|
|
49
|
+
DSDialogTitleWithSchema,
|
|
50
|
+
DSDialogWithSchema
|
|
49
51
|
};
|
|
50
52
|
//# sourceMappingURL=index.js.map
|
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", "import type {} from '@xstyled/system';\nimport type {} from '@xstyled/util';\n\nexport
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;ACGvB,
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import type {} from '@xstyled/system';\nimport type {} from '@xstyled/util';\n\nexport { DSDialog, DSDialogWithSchema } from './DSDialog.js';\nexport { DIALOG_DATA_TESTID, DIALOG_SLOTS, DSDialogName, DSDialogDatatestid } from './constants/index.js';\nexport { DSDialogSizes } from './utils.js';\nexport {\n DSDialogBody,\n DSDialogBodyWithSchema,\n DSDialogHeader,\n DSDialogHeaderWithSchema,\n DSDialogFooter,\n DSDialogFooterWithSchema,\n DSDialogSeparator,\n DSDialogSeparatorWithSchema,\n DSDialogTitle,\n DSDialogTitleWithSchema,\n DSDialogAddon,\n DSDialogAddonWithSchema,\n DSDialogDefaultLayout,\n DSDialogDefaultLayoutWithSchema,\n DSDialogPrimaryMessage,\n DSDialogPrimaryMessageWithSchema,\n DSDialogSecondaryMessage,\n DSDialogSecondaryMessageWithSchema,\n} from './parts/index.js';\nexport type { DSDialogT } from './react-desc-prop-types.js';\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACGvB,SAAS,UAAU,0BAA0B;AAC7C,SAAS,oBAAoB,cAAc,cAAc,0BAA0B;AACnF,SAAS,qBAAqB;AAC9B;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -8,11 +8,10 @@ import { DSDialogDatatestid } from "../../constants/index.js";
|
|
|
8
8
|
import { DSDialogContext } from "../../DSDialogCTX.js";
|
|
9
9
|
import { useDialogContent } from "./useDialogContent.js";
|
|
10
10
|
const DSDialogContent = () => {
|
|
11
|
-
const {
|
|
11
|
+
const { handleBackgroundMouseDown, handleBackgroundMouseUp, handleOnKeyDown } = useDialogContent();
|
|
12
12
|
const { props, containerRef, portalInfo, portalClassName } = useContext(DSDialogContext);
|
|
13
13
|
const { removeAutoFocus, zIndex, centered, size, width, children, ...rest } = props;
|
|
14
14
|
const { className, ...restOfGlobalAttributes } = useGetGlobalAttributes(props, {
|
|
15
|
-
onClick: handleOutsideClick,
|
|
16
15
|
onKeyDown: handleOnKeyDown
|
|
17
16
|
});
|
|
18
17
|
const getOwnerProps = useCallback(() => props, [props]);
|
|
@@ -30,7 +29,8 @@ const DSDialogContent = () => {
|
|
|
30
29
|
StyledDialogBackground,
|
|
31
30
|
{
|
|
32
31
|
className,
|
|
33
|
-
|
|
32
|
+
onMouseDown: handleBackgroundMouseDown,
|
|
33
|
+
onMouseUp: handleBackgroundMouseUp,
|
|
34
34
|
"data-portalbg": true,
|
|
35
35
|
"data-testid": DSDialogDatatestid.BACKGROUND,
|
|
36
36
|
getOwnerProps,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../../scripts/build/transpile/react-shim.js", "../../../../src/parts/DSDialogContent/DSDialogContent.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React, { useCallback, useContext } from 'react';\nimport { useGetGlobalAttributes } from '@elliemae/ds-props-helpers';\nimport { PortalStyles, StyledDialogBackground, StyledDialogContainer } from '../../styles.js';\nimport { getSpaceProps } from '../../utils.js';\nimport { DSDialogDatatestid } from '../../constants/index.js';\nimport { DSDialogContext } from '../../DSDialogCTX.js';\nimport { useDialogContent } from './useDialogContent.js';\n\nexport const DSDialogContent = () => {\n const {
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React, { useCallback, useContext } from 'react';\nimport { useGetGlobalAttributes } from '@elliemae/ds-props-helpers';\nimport { PortalStyles, StyledDialogBackground, StyledDialogContainer } from '../../styles.js';\nimport { getSpaceProps } from '../../utils.js';\nimport { DSDialogDatatestid } from '../../constants/index.js';\nimport { DSDialogContext } from '../../DSDialogCTX.js';\nimport { useDialogContent } from './useDialogContent.js';\n\nexport const DSDialogContent = () => {\n const { handleBackgroundMouseDown, handleBackgroundMouseUp, handleOnKeyDown } = useDialogContent();\n const { props, containerRef, portalInfo, portalClassName } = useContext(DSDialogContext);\n\n const { removeAutoFocus, zIndex, centered, size, width, children, ...rest } = props;\n\n const { className, ...restOfGlobalAttributes } = useGetGlobalAttributes(props, {\n onKeyDown: handleOnKeyDown,\n });\n\n const getOwnerProps = useCallback(() => props, [props]);\n const getOwnerPropsArguments = useCallback(() => ({}), []);\n\n const refCallback = useCallback(\n (_ref: HTMLDivElement | null) => {\n if (_ref) {\n containerRef.current = _ref;\n if (!removeAutoFocus) _ref.focus();\n }\n },\n [containerRef, removeAutoFocus],\n );\n\n return (\n <StyledDialogBackground\n className={className}\n onMouseDown={handleBackgroundMouseDown}\n onMouseUp={handleBackgroundMouseUp}\n data-portalbg\n data-testid={DSDialogDatatestid.BACKGROUND}\n getOwnerProps={getOwnerProps}\n getOwnerPropsArguments={getOwnerPropsArguments}\n zIndex={zIndex}\n >\n <PortalStyles portalInfo={portalInfo} portalClassName={portalClassName} />\n <StyledDialogContainer\n role=\"dialog\"\n aria-modal\n innerRef={refCallback}\n tabIndex={!removeAutoFocus ? 0 : undefined}\n onKeyDown={handleOnKeyDown}\n {...getSpaceProps(rest as unknown as Record<string, unknown>)}\n centered={centered}\n data-testid={DSDialogDatatestid.CONTAINER}\n getOwnerProps={getOwnerProps}\n getOwnerPropsArguments={getOwnerPropsArguments}\n {...restOfGlobalAttributes}\n size={size}\n width={width}\n >\n {children}\n </StyledDialogContainer>\n </StyledDialogBackground>\n );\n};\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACgCnB,SAUE,KAVF;AAhCJ,SAAgB,aAAa,kBAAkB;AAC/C,SAAS,8BAA8B;AACvC,SAAS,cAAc,wBAAwB,6BAA6B;AAC5E,SAAS,qBAAqB;AAC9B,SAAS,0BAA0B;AACnC,SAAS,uBAAuB;AAChC,SAAS,wBAAwB;AAE1B,MAAM,kBAAkB,MAAM;AACnC,QAAM,EAAE,2BAA2B,yBAAyB,gBAAgB,IAAI,iBAAiB;AACjG,QAAM,EAAE,OAAO,cAAc,YAAY,gBAAgB,IAAI,WAAW,eAAe;AAEvF,QAAM,EAAE,iBAAiB,QAAQ,UAAU,MAAM,OAAO,UAAU,GAAG,KAAK,IAAI;AAE9E,QAAM,EAAE,WAAW,GAAG,uBAAuB,IAAI,uBAAuB,OAAO;AAAA,IAC7E,WAAW;AAAA,EACb,CAAC;AAED,QAAM,gBAAgB,YAAY,MAAM,OAAO,CAAC,KAAK,CAAC;AACtD,QAAM,yBAAyB,YAAY,OAAO,CAAC,IAAI,CAAC,CAAC;AAEzD,QAAM,cAAc;AAAA,IAClB,CAAC,SAAgC;AAC/B,UAAI,MAAM;AACR,qBAAa,UAAU;AACvB,YAAI,CAAC,gBAAiB,MAAK,MAAM;AAAA,MACnC;AAAA,IACF;AAAA,IACA,CAAC,cAAc,eAAe;AAAA,EAChC;AAEA,SACE;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA,aAAa;AAAA,MACb,WAAW;AAAA,MACX,iBAAa;AAAA,MACb,eAAa,mBAAmB;AAAA,MAChC;AAAA,MACA;AAAA,MACA;AAAA,MAEA;AAAA,4BAAC,gBAAa,YAAwB,iBAAkC;AAAA,QACxE;AAAA,UAAC;AAAA;AAAA,YACC,MAAK;AAAA,YACL,cAAU;AAAA,YACV,UAAU;AAAA,YACV,UAAU,CAAC,kBAAkB,IAAI;AAAA,YACjC,WAAW;AAAA,YACV,GAAG,cAAc,IAA0C;AAAA,YAC5D;AAAA,YACA,eAAa,mBAAmB;AAAA,YAChC;AAAA,YACA;AAAA,YACC,GAAG;AAAA,YACJ;AAAA,YACA;AAAA,YAEC;AAAA;AAAA,QACH;AAAA;AAAA;AAAA,EACF;AAEJ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,13 +1,20 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import { useCallback, useContext } from "react";
|
|
2
|
+
import { useCallback, useContext, useRef } from "react";
|
|
3
3
|
import { DSDialogContext } from "../../DSDialogCTX.js";
|
|
4
4
|
const useDialogContent = () => {
|
|
5
5
|
const {
|
|
6
6
|
props: { onClickOutside, onClose }
|
|
7
7
|
} = useContext(DSDialogContext);
|
|
8
|
-
const
|
|
8
|
+
const mouseDownOnOverlayRef = useRef(false);
|
|
9
|
+
const handleBackgroundMouseDown = useCallback((e) => {
|
|
10
|
+
mouseDownOnOverlayRef.current = Boolean(e.target.dataset.portalbg);
|
|
11
|
+
}, []);
|
|
12
|
+
const handleBackgroundMouseUp = useCallback(
|
|
9
13
|
(e) => {
|
|
10
|
-
if (e.target.dataset.portalbg)
|
|
14
|
+
if (mouseDownOnOverlayRef.current && e.target.dataset.portalbg) {
|
|
15
|
+
onClickOutside();
|
|
16
|
+
}
|
|
17
|
+
mouseDownOnOverlayRef.current = false;
|
|
11
18
|
},
|
|
12
19
|
[onClickOutside]
|
|
13
20
|
);
|
|
@@ -18,7 +25,8 @@ const useDialogContent = () => {
|
|
|
18
25
|
[onClose]
|
|
19
26
|
);
|
|
20
27
|
return {
|
|
21
|
-
|
|
28
|
+
handleBackgroundMouseDown,
|
|
29
|
+
handleBackgroundMouseUp,
|
|
22
30
|
handleOnKeyDown
|
|
23
31
|
};
|
|
24
32
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../../scripts/build/transpile/react-shim.js", "../../../../src/parts/DSDialogContent/useDialogContent.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import type React from 'react';\nimport { useCallback, useContext } from 'react';\nimport { DSDialogContext } from '../../DSDialogCTX.js';\n\nexport const useDialogContent = () => {\n const {\n props: { onClickOutside, onClose },\n } = useContext(DSDialogContext);\n\n const
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;ACCvB,SAAS,aAAa,
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import type React from 'react';\nimport { useCallback, useContext, useRef } from 'react';\nimport { DSDialogContext } from '../../DSDialogCTX.js';\n\nexport const useDialogContent = () => {\n const {\n props: { onClickOutside, onClose },\n } = useContext(DSDialogContext);\n\n /**\n * PUI-15050 https://jira.elliemae.io/browse/PUI-15050\n * Tracks whether the current press sequence started on the overlay.\n * onClickOutside fires only when both mousedown AND mouseup land on the overlay,\n * preventing false triggers when the user presses the overlay and releases inside the dialog.\n *\n * Lifecycle note: this ref is intentionally not reset on dialog close because DSDialogContent\n * is fully unmounted when isOpen=false (via DSDialogPortal returning null). The ref is\n * destroyed with the component, so stale state across open/close cycles is not possible.\n */\n\n const mouseDownOnOverlayRef = useRef(false);\n\n const handleBackgroundMouseDown = useCallback((e: React.MouseEvent) => {\n mouseDownOnOverlayRef.current = Boolean((e.target as HTMLElement).dataset.portalbg);\n }, []);\n\n const handleBackgroundMouseUp = useCallback(\n (e: React.MouseEvent) => {\n if (mouseDownOnOverlayRef.current && (e.target as HTMLElement).dataset.portalbg) {\n onClickOutside();\n }\n mouseDownOnOverlayRef.current = false;\n },\n [onClickOutside],\n );\n\n const handleOnKeyDown = useCallback(\n (e: React.KeyboardEvent) => {\n if (e.key === 'Escape') onClose();\n },\n [onClose],\n );\n\n return {\n handleBackgroundMouseDown,\n handleBackgroundMouseUp,\n handleOnKeyDown,\n };\n};\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACCvB,SAAS,aAAa,YAAY,cAAc;AAChD,SAAS,uBAAuB;AAEzB,MAAM,mBAAmB,MAAM;AACpC,QAAM;AAAA,IACJ,OAAO,EAAE,gBAAgB,QAAQ;AAAA,EACnC,IAAI,WAAW,eAAe;AAa9B,QAAM,wBAAwB,OAAO,KAAK;AAE1C,QAAM,4BAA4B,YAAY,CAAC,MAAwB;AACrE,0BAAsB,UAAU,QAAS,EAAE,OAAuB,QAAQ,QAAQ;AAAA,EACpF,GAAG,CAAC,CAAC;AAEL,QAAM,0BAA0B;AAAA,IAC9B,CAAC,MAAwB;AACvB,UAAI,sBAAsB,WAAY,EAAE,OAAuB,QAAQ,UAAU;AAC/E,uBAAe;AAAA,MACjB;AACA,4BAAsB,UAAU;AAAA,IAClC;AAAA,IACA,CAAC,cAAc;AAAA,EACjB;AAEA,QAAM,kBAAkB;AAAA,IACtB,CAAC,MAA2B;AAC1B,UAAI,EAAE,QAAQ,SAAU,SAAQ;AAAA,IAClC;AAAA,IACA,CAAC,OAAO;AAAA,EACV;AAEA,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export
|
|
1
|
+
export { DSDialog, DSDialogWithSchema } from './DSDialog.js';
|
|
2
2
|
export { DIALOG_DATA_TESTID, DIALOG_SLOTS, DSDialogName, DSDialogDatatestid } from './constants/index.js';
|
|
3
3
|
export { DSDialogSizes } from './utils.js';
|
|
4
4
|
export { DSDialogBody, DSDialogBodyWithSchema, DSDialogHeader, DSDialogHeaderWithSchema, DSDialogFooter, DSDialogFooterWithSchema, DSDialogSeparator, DSDialogSeparatorWithSchema, DSDialogTitle, DSDialogTitleWithSchema, DSDialogAddon, DSDialogAddonWithSchema, DSDialogDefaultLayout, DSDialogDefaultLayoutWithSchema, DSDialogPrimaryMessage, DSDialogPrimaryMessageWithSchema, DSDialogSecondaryMessage, DSDialogSecondaryMessageWithSchema, } from './parts/index.js';
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type React from 'react';
|
|
2
2
|
export declare const useDialogContent: () => {
|
|
3
|
-
|
|
3
|
+
handleBackgroundMouseDown: (e: React.MouseEvent) => void;
|
|
4
|
+
handleBackgroundMouseUp: (e: React.MouseEvent) => void;
|
|
4
5
|
handleOnKeyDown: (e: React.KeyboardEvent) => void;
|
|
5
6
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elliemae/ds-dialog",
|
|
3
|
-
"version": "3.60.0-next.
|
|
3
|
+
"version": "3.60.0-next.55",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "ICE MT - Dimsum - Dialog",
|
|
6
6
|
"files": [
|
|
@@ -38,19 +38,22 @@
|
|
|
38
38
|
"dependencies": {
|
|
39
39
|
"lodash-es": "^4.17.21",
|
|
40
40
|
"uid": "^2.0.2",
|
|
41
|
-
"@elliemae/ds-
|
|
42
|
-
"@elliemae/ds-system": "3.60.0-next.
|
|
43
|
-
"@elliemae/ds-
|
|
44
|
-
"@elliemae/ds-props-helpers": "3.60.0-next.53",
|
|
45
|
-
"@elliemae/ds-typescript-helpers": "3.60.0-next.53"
|
|
41
|
+
"@elliemae/ds-props-helpers": "3.60.0-next.55",
|
|
42
|
+
"@elliemae/ds-system": "3.60.0-next.55",
|
|
43
|
+
"@elliemae/ds-typescript-helpers": "3.60.0-next.55"
|
|
46
44
|
},
|
|
47
45
|
"devDependencies": {
|
|
46
|
+
"@playwright/experimental-ct-react": "^1.51.1",
|
|
47
|
+
"@xstyled/system": "~3.8.1",
|
|
48
|
+
"@xstyled/util": "~3.7.0",
|
|
48
49
|
"jest": "^30.0.0",
|
|
49
50
|
"styled-components": "~5.3.9",
|
|
50
|
-
"@elliemae/ds-monorepo-devops": "3.60.0-next.
|
|
51
|
-
"@elliemae/ds-test-utils": "3.60.0-next.
|
|
51
|
+
"@elliemae/ds-monorepo-devops": "3.60.0-next.55",
|
|
52
|
+
"@elliemae/ds-test-utils": "3.60.0-next.55"
|
|
52
53
|
},
|
|
53
54
|
"peerDependencies": {
|
|
55
|
+
"@xstyled/system": "~3.8.1",
|
|
56
|
+
"@xstyled/util": "~3.7.0",
|
|
54
57
|
"react": "^18.3.1",
|
|
55
58
|
"react-dom": "^18.3.1",
|
|
56
59
|
"styled-components": "~5.3.9"
|
|
@@ -61,7 +64,7 @@
|
|
|
61
64
|
},
|
|
62
65
|
"scripts": {
|
|
63
66
|
"dev": "cross-env NODE_ENV=development node ../../../scripts/build/build.mjs --watch",
|
|
64
|
-
"test": "ds-monorepo-devops test --passWithNoTests --coverage=\"false\"",
|
|
67
|
+
"test": "playwright test -c ./playwright.config.mjs && ds-monorepo-devops test --passWithNoTests --coverage=\"false\"",
|
|
65
68
|
"lint": "node ../../../scripts/lint.mjs --fix",
|
|
66
69
|
"lint:strict": "node ../../../scripts/lint-strict.mjs",
|
|
67
70
|
"dts": "node ../../../scripts/dts.mjs",
|
|
File without changes
|