@activecollab/components 2.0.526 → 2.0.528
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/components/Dialog/Dialog.js +32 -187
- package/dist/cjs/components/Dialog/Dialog.js.map +1 -1
- package/dist/cjs/components/Dialog/DialogFrame.js +209 -0
- package/dist/cjs/components/Dialog/DialogFrame.js.map +1 -0
- package/dist/cjs/components/GlobalPortal/GlobalPortal.js +2 -16
- package/dist/cjs/components/GlobalPortal/GlobalPortal.js.map +1 -1
- package/dist/cjs/components/Modal/Modal.js +17 -108
- package/dist/cjs/components/Modal/Modal.js.map +1 -1
- package/dist/cjs/components/Modal/ModalBase.js +125 -0
- package/dist/cjs/components/Modal/ModalBase.js.map +1 -0
- package/dist/cjs/components/ModalRoot/ModalRoot.js +21 -1
- package/dist/cjs/components/ModalRoot/ModalRoot.js.map +1 -1
- package/dist/cjs/components/ModalRoot/modalRootStack.js +16 -1
- package/dist/cjs/components/ModalRoot/modalRootStack.js.map +1 -1
- package/dist/cjs/components/ModalRoot/useModalStackHost.js +47 -0
- package/dist/cjs/components/ModalRoot/useModalStackHost.js.map +1 -0
- package/dist/cjs/components/ObjectFormModal/ObjectFormModal.js +41 -64
- package/dist/cjs/components/ObjectFormModal/ObjectFormModal.js.map +1 -1
- package/dist/cjs/components/Sheet/Sheet.js +19 -5
- package/dist/cjs/components/Sheet/Sheet.js.map +1 -1
- package/dist/cjs/components/Sheet/useHostAboveOpenModal.js +56 -0
- package/dist/cjs/components/Sheet/useHostAboveOpenModal.js.map +1 -0
- package/dist/esm/components/Dialog/Dialog.d.ts +3 -3
- package/dist/esm/components/Dialog/Dialog.d.ts.map +1 -1
- package/dist/esm/components/Dialog/Dialog.js +34 -175
- package/dist/esm/components/Dialog/Dialog.js.map +1 -1
- package/dist/esm/components/Dialog/DialogFrame.d.ts +14 -0
- package/dist/esm/components/Dialog/DialogFrame.d.ts.map +1 -0
- package/dist/esm/components/Dialog/DialogFrame.js +180 -0
- package/dist/esm/components/Dialog/DialogFrame.js.map +1 -0
- package/dist/esm/components/GlobalPortal/GlobalPortal.d.ts.map +1 -1
- package/dist/esm/components/GlobalPortal/GlobalPortal.js +3 -17
- package/dist/esm/components/GlobalPortal/GlobalPortal.js.map +1 -1
- package/dist/esm/components/Modal/Modal.d.ts +8 -17
- package/dist/esm/components/Modal/Modal.d.ts.map +1 -1
- package/dist/esm/components/Modal/Modal.js +18 -99
- package/dist/esm/components/Modal/Modal.js.map +1 -1
- package/dist/esm/components/Modal/ModalBase.d.ts +19 -0
- package/dist/esm/components/Modal/ModalBase.d.ts.map +1 -0
- package/dist/esm/components/Modal/ModalBase.js +108 -0
- package/dist/esm/components/Modal/ModalBase.js.map +1 -0
- package/dist/esm/components/ModalRoot/ModalRoot.d.ts.map +1 -1
- package/dist/esm/components/ModalRoot/ModalRoot.js +21 -1
- package/dist/esm/components/ModalRoot/ModalRoot.js.map +1 -1
- package/dist/esm/components/ModalRoot/modalRootStack.d.ts +4 -0
- package/dist/esm/components/ModalRoot/modalRootStack.d.ts.map +1 -1
- package/dist/esm/components/ModalRoot/modalRootStack.js +13 -0
- package/dist/esm/components/ModalRoot/modalRootStack.js.map +1 -1
- package/dist/esm/components/ModalRoot/useModalStackHost.d.ts +8 -0
- package/dist/esm/components/ModalRoot/useModalStackHost.d.ts.map +1 -0
- package/dist/esm/components/ModalRoot/useModalStackHost.js +35 -0
- package/dist/esm/components/ModalRoot/useModalStackHost.js.map +1 -0
- package/dist/esm/components/ObjectFormModal/ObjectFormModal.d.ts.map +1 -1
- package/dist/esm/components/ObjectFormModal/ObjectFormModal.js +42 -65
- package/dist/esm/components/ObjectFormModal/ObjectFormModal.js.map +1 -1
- package/dist/esm/components/Sheet/Sheet.d.ts.map +1 -1
- package/dist/esm/components/Sheet/Sheet.js +19 -5
- package/dist/esm/components/Sheet/Sheet.js.map +1 -1
- package/dist/esm/components/Sheet/useHostAboveOpenModal.d.ts +13 -0
- package/dist/esm/components/Sheet/useHostAboveOpenModal.d.ts.map +1 -0
- package/dist/esm/components/Sheet/useHostAboveOpenModal.js +42 -0
- package/dist/esm/components/Sheet/useHostAboveOpenModal.js.map +1 -0
- package/dist/index.js +1115 -972
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +1 -1
- package/dist/index.min.js.map +1 -1
- package/package.json +1 -1
- package/dist/cjs/hooks/useDeprecation.js +0 -15
- package/dist/cjs/hooks/useDeprecation.js.map +0 -1
- package/dist/esm/hooks/useDeprecation.d.ts +0 -2
- package/dist/esm/hooks/useDeprecation.d.ts.map +0 -1
- package/dist/esm/hooks/useDeprecation.js +0 -9
- package/dist/esm/hooks/useDeprecation.js.map +0 -1
|
@@ -1,106 +1,25 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
};
|
|
13
|
-
export const Modal = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
14
|
-
let children = _ref.children,
|
|
15
|
-
_ref$disableFocusLock = _ref.disableFocusLock,
|
|
16
|
-
disableFocusLock = _ref$disableFocusLock === void 0 ? false : _ref$disableFocusLock,
|
|
17
|
-
_ref$disableScrollLoc = _ref.disableScrollLock,
|
|
18
|
-
disableScrollLock = _ref$disableScrollLoc === void 0 ? false : _ref$disableScrollLoc,
|
|
19
|
-
_ref$disableBackgroun = _ref.disableBackgroundClick,
|
|
20
|
-
disableBackgroundClick = _ref$disableBackgroun === void 0 ? false : _ref$disableBackgroun,
|
|
21
|
-
_ref$disableBackgroun2 = _ref.disableBackgroundColor,
|
|
22
|
-
disableBackgroundColor = _ref$disableBackgroun2 === void 0 ? false : _ref$disableBackgroun2,
|
|
23
|
-
_ref$disableCloseOnEs = _ref.disableCloseOnEsc,
|
|
24
|
-
disableCloseOnEsc = _ref$disableCloseOnEs === void 0 ? false : _ref$disableCloseOnEs,
|
|
25
|
-
_ref$open = _ref.open,
|
|
26
|
-
defaultOpen = _ref$open === void 0 ? false : _ref$open,
|
|
27
|
-
_ref$overlayTimeout = _ref.overlayTimeout,
|
|
28
|
-
overlayTimeout = _ref$overlayTimeout === void 0 ? {
|
|
29
|
-
enter: SLIDE_FROM_TOP_ENTER,
|
|
30
|
-
exit: SLIDE_FROM_TOP_EXIT
|
|
31
|
-
} : _ref$overlayTimeout,
|
|
32
|
-
onClose = _ref.onClose,
|
|
33
|
-
onClickOutside = _ref.onClickOutside,
|
|
34
|
-
rest = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
35
|
-
const _useState = useState(defaultOpen),
|
|
36
|
-
open = _useState[0],
|
|
37
|
-
setOpen = _useState[1];
|
|
38
|
-
const _useState2 = useState(true),
|
|
39
|
-
exited = _useState2[0],
|
|
40
|
-
setExited = _useState2[1];
|
|
41
|
-
const innerRef = useRef(null);
|
|
42
|
-
const handleRef = useForkRef(innerRef, ref);
|
|
43
|
-
const hasTransition = useMemo(() => {
|
|
44
|
-
return getHasTransition(children);
|
|
45
|
-
}, [children]);
|
|
2
|
+
import React, { forwardRef, useEffect } from "react";
|
|
3
|
+
import { ModalBase } from "./ModalBase";
|
|
4
|
+
let warnedAboutDeprecation = false;
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* @deprecated A modal that takes any child says nothing about what it shows. Use Dialog for a dialog, Sheet for
|
|
8
|
+
* a side or full panel, and Menu or Popper for an overlay that should not be modal. Modal is removed once nothing
|
|
9
|
+
* renders it.
|
|
10
|
+
*/
|
|
11
|
+
export const Modal = /*#__PURE__*/forwardRef((props, ref) => {
|
|
46
12
|
useEffect(() => {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
const handleClose = useCallback(() => {
|
|
50
|
-
setOpen(false);
|
|
51
|
-
if (!hasTransition) {
|
|
52
|
-
typeof onClose === "function" && onClose();
|
|
53
|
-
}
|
|
54
|
-
}, [hasTransition, onClose]);
|
|
55
|
-
const handleBackgroundClick = useCallback(event => {
|
|
56
|
-
if (!disableBackgroundClick) {
|
|
57
|
-
event.preventDefault();
|
|
58
|
-
return handleClose();
|
|
59
|
-
}
|
|
60
|
-
if (onClickOutside) {
|
|
61
|
-
onClickOutside(event);
|
|
13
|
+
if (process.env.NODE_ENV === "production" || warnedAboutDeprecation) {
|
|
14
|
+
return;
|
|
62
15
|
}
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
16
|
+
warnedAboutDeprecation = true;
|
|
17
|
+
// eslint-disable-next-line no-console
|
|
18
|
+
console.warn("Modal is deprecated and will be removed. Use Dialog for a dialog, Sheet for a side or full panel, and Menu or Popper for an overlay that should not be modal.");
|
|
66
19
|
}, []);
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
}, [onClose]);
|
|
71
|
-
const childProps = useMemo(() => {
|
|
72
|
-
let props = {};
|
|
73
|
-
|
|
74
|
-
// It's a Transition like component
|
|
75
|
-
if (hasTransition && children) {
|
|
76
|
-
props = {
|
|
77
|
-
onEnter: createChainedFunction(handleEnter, children.props.onEnter),
|
|
78
|
-
onExited: createChainedFunction(handleExited, children.props.onExited),
|
|
79
|
-
in: open,
|
|
80
|
-
forceClose: handleClose
|
|
81
|
-
};
|
|
82
|
-
}
|
|
83
|
-
return props;
|
|
84
|
-
}, [children, handleClose, handleEnter, handleExited, hasTransition, open]);
|
|
85
|
-
if (!open && (!hasTransition || exited)) {
|
|
86
|
-
return null;
|
|
87
|
-
}
|
|
88
|
-
return /*#__PURE__*/React.createElement(Window, _extends({}, rest, {
|
|
89
|
-
ref: handleRef,
|
|
90
|
-
onClose: handleClose,
|
|
91
|
-
disableFocusLock: disableFocusLock,
|
|
92
|
-
disableScrollLock: disableScrollLock,
|
|
93
|
-
disableCloseOnEsc: disableCloseOnEsc
|
|
94
|
-
}), /*#__PURE__*/React.createElement(Fade, {
|
|
95
|
-
in: open,
|
|
96
|
-
timeout: open ? overlayTimeout.enter : overlayTimeout.exit
|
|
97
|
-
}, /*#__PURE__*/React.createElement(Overlay, {
|
|
98
|
-
onClick: handleBackgroundClick,
|
|
99
|
-
disableBackgroundColor: disableBackgroundColor,
|
|
100
|
-
style: {
|
|
101
|
-
pointerEvents: open ? undefined : "none"
|
|
102
|
-
}
|
|
103
|
-
})), /*#__PURE__*/cloneElement(children, childProps));
|
|
20
|
+
return /*#__PURE__*/React.createElement(ModalBase, _extends({}, props, {
|
|
21
|
+
ref: ref
|
|
22
|
+
}));
|
|
104
23
|
});
|
|
105
24
|
Modal.displayName = "Modal";
|
|
106
25
|
//# sourceMappingURL=Modal.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Modal.js","names":["React","forwardRef","
|
|
1
|
+
{"version":3,"file":"Modal.js","names":["React","forwardRef","useEffect","ModalBase","warnedAboutDeprecation","Modal","props","ref","process","env","NODE_ENV","console","warn","createElement","_extends","displayName"],"sources":["../../../../src/components/Modal/Modal.tsx"],"sourcesContent":["import React, { forwardRef, HTMLAttributes, useEffect } from \"react\";\n\nimport { IModal, ModalBase } from \"./ModalBase\";\n\nexport type { IModal } from \"./ModalBase\";\n\nlet warnedAboutDeprecation = false;\n\n/**\n * @deprecated A modal that takes any child says nothing about what it shows. Use Dialog for a dialog, Sheet for\n * a side or full panel, and Menu or Popper for an overlay that should not be modal. Modal is removed once nothing\n * renders it.\n */\nexport const Modal = forwardRef<\n HTMLDivElement,\n IModal & HTMLAttributes<HTMLDivElement>\n>((props, ref) => {\n useEffect(() => {\n if (process.env.NODE_ENV === \"production\" || warnedAboutDeprecation) {\n return;\n }\n\n warnedAboutDeprecation = true;\n // eslint-disable-next-line no-console\n console.warn(\n \"Modal is deprecated and will be removed. Use Dialog for a dialog, Sheet for a side or full panel, and Menu or Popper for an overlay that should not be modal.\"\n );\n }, []);\n\n return <ModalBase {...props} ref={ref} />;\n});\n\nModal.displayName = \"Modal\";\n"],"mappings":";AAAA,OAAOA,KAAK,IAAIC,UAAU,EAAkBC,SAAS,QAAQ,OAAO;AAEpE,SAAiBC,SAAS,QAAQ,aAAa;AAI/C,IAAIC,sBAAsB,GAAG,KAAK;;AAElC;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,KAAK,gBAAGJ,UAAU,CAG7B,CAACK,KAAK,EAAEC,GAAG,KAAK;EAChBL,SAAS,CAAC,MAAM;IACd,IAAIM,OAAO,CAACC,GAAG,CAACC,QAAQ,KAAK,YAAY,IAAIN,sBAAsB,EAAE;MACnE;IACF;IAEAA,sBAAsB,GAAG,IAAI;IAC7B;IACAO,OAAO,CAACC,IAAI,CACV,+JACF,CAAC;EACH,CAAC,EAAE,EAAE,CAAC;EAEN,oBAAOZ,KAAA,CAAAa,aAAA,CAACV,SAAS,EAAAW,QAAA,KAAKR,KAAK;IAAEC,GAAG,EAAEA;EAAI,EAAE,CAAC;AAC3C,CAAC,CAAC;AAEFF,KAAK,CAACU,WAAW,GAAG,OAAO","ignoreList":[]}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import React, { ReactElement } from "react";
|
|
2
|
+
export interface IModal {
|
|
3
|
+
disableFocusLock?: boolean;
|
|
4
|
+
disableScrollLock?: boolean;
|
|
5
|
+
open?: boolean;
|
|
6
|
+
disableBackgroundClick?: boolean;
|
|
7
|
+
disableCloseOnEsc?: boolean;
|
|
8
|
+
disableBackgroundColor?: boolean;
|
|
9
|
+
onClose?: () => void;
|
|
10
|
+
children: ReactElement;
|
|
11
|
+
onClickOutside?: (event: any) => void;
|
|
12
|
+
/** How long the overlay takes to arrive and to leave. Match it to the animation the child runs. */
|
|
13
|
+
overlayTimeout?: {
|
|
14
|
+
enter: number;
|
|
15
|
+
exit: number;
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
export declare const ModalBase: React.ForwardRefExoticComponent<IModal & React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
|
|
19
|
+
//# sourceMappingURL=ModalBase.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ModalBase.d.ts","sourceRoot":"","sources":["../../../../src/components/Modal/ModalBase.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAOZ,YAAY,EAIb,MAAM,OAAO,CAAC;AAYf,MAAM,WAAW,MAAM;IACrB,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,sBAAsB,CAAC,EAAE,OAAO,CAAC;IACjC,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,sBAAsB,CAAC,EAAE,OAAO,CAAC;IACjC,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,QAAQ,EAAE,YAAY,CAAC;IACvB,cAAc,CAAC,EAAE,CAAC,KAAK,KAAA,KAAK,IAAI,CAAC;IACjC,mGAAmG;IACnG,cAAc,CAAC,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC;CAClD;AASD,eAAO,MAAM,SAAS,sHAgHrB,CAAC"}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
|
+
const _excluded = ["children", "disableFocusLock", "disableScrollLock", "disableBackgroundClick", "disableBackgroundColor", "disableCloseOnEsc", "open", "overlayTimeout", "onClose", "onClickOutside"];
|
|
4
|
+
import React, { forwardRef, useRef, cloneElement, useMemo, useCallback, useState, useEffect } from "react";
|
|
5
|
+
import createChainedFunction from "../../utils/createChainedFunction";
|
|
6
|
+
import useForkRef from "../../utils/useForkRef";
|
|
7
|
+
import { Overlay } from "../Overlay";
|
|
8
|
+
import { Fade, SLIDE_FROM_TOP_ENTER, SLIDE_FROM_TOP_EXIT } from "../Transitions";
|
|
9
|
+
import { Window } from "../Window";
|
|
10
|
+
const getHasTransition = children => {
|
|
11
|
+
return children.props ? Object.prototype.hasOwnProperty.call(children.props, "in") : false;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
// The modal behind Dialog and ObjectFormModal. It stays out of the package index, so only the design system renders it.
|
|
15
|
+
export const ModalBase = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
16
|
+
let children = _ref.children,
|
|
17
|
+
_ref$disableFocusLock = _ref.disableFocusLock,
|
|
18
|
+
disableFocusLock = _ref$disableFocusLock === void 0 ? false : _ref$disableFocusLock,
|
|
19
|
+
_ref$disableScrollLoc = _ref.disableScrollLock,
|
|
20
|
+
disableScrollLock = _ref$disableScrollLoc === void 0 ? false : _ref$disableScrollLoc,
|
|
21
|
+
_ref$disableBackgroun = _ref.disableBackgroundClick,
|
|
22
|
+
disableBackgroundClick = _ref$disableBackgroun === void 0 ? false : _ref$disableBackgroun,
|
|
23
|
+
_ref$disableBackgroun2 = _ref.disableBackgroundColor,
|
|
24
|
+
disableBackgroundColor = _ref$disableBackgroun2 === void 0 ? false : _ref$disableBackgroun2,
|
|
25
|
+
_ref$disableCloseOnEs = _ref.disableCloseOnEsc,
|
|
26
|
+
disableCloseOnEsc = _ref$disableCloseOnEs === void 0 ? false : _ref$disableCloseOnEs,
|
|
27
|
+
_ref$open = _ref.open,
|
|
28
|
+
defaultOpen = _ref$open === void 0 ? false : _ref$open,
|
|
29
|
+
_ref$overlayTimeout = _ref.overlayTimeout,
|
|
30
|
+
overlayTimeout = _ref$overlayTimeout === void 0 ? {
|
|
31
|
+
enter: SLIDE_FROM_TOP_ENTER,
|
|
32
|
+
exit: SLIDE_FROM_TOP_EXIT
|
|
33
|
+
} : _ref$overlayTimeout,
|
|
34
|
+
onClose = _ref.onClose,
|
|
35
|
+
onClickOutside = _ref.onClickOutside,
|
|
36
|
+
rest = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
37
|
+
const _useState = useState(defaultOpen),
|
|
38
|
+
open = _useState[0],
|
|
39
|
+
setOpen = _useState[1];
|
|
40
|
+
const _useState2 = useState(true),
|
|
41
|
+
exited = _useState2[0],
|
|
42
|
+
setExited = _useState2[1];
|
|
43
|
+
const innerRef = useRef(null);
|
|
44
|
+
const handleRef = useForkRef(innerRef, ref);
|
|
45
|
+
const hasTransition = useMemo(() => {
|
|
46
|
+
return getHasTransition(children);
|
|
47
|
+
}, [children]);
|
|
48
|
+
useEffect(() => {
|
|
49
|
+
setOpen(defaultOpen);
|
|
50
|
+
}, [defaultOpen]);
|
|
51
|
+
const handleClose = useCallback(() => {
|
|
52
|
+
setOpen(false);
|
|
53
|
+
if (!hasTransition) {
|
|
54
|
+
typeof onClose === "function" && onClose();
|
|
55
|
+
}
|
|
56
|
+
}, [hasTransition, onClose]);
|
|
57
|
+
const handleBackgroundClick = useCallback(event => {
|
|
58
|
+
if (!disableBackgroundClick) {
|
|
59
|
+
event.preventDefault();
|
|
60
|
+
return handleClose();
|
|
61
|
+
}
|
|
62
|
+
if (onClickOutside) {
|
|
63
|
+
onClickOutside(event);
|
|
64
|
+
}
|
|
65
|
+
}, [disableBackgroundClick, onClickOutside, handleClose]);
|
|
66
|
+
const handleEnter = useCallback(() => {
|
|
67
|
+
setExited(false);
|
|
68
|
+
}, []);
|
|
69
|
+
const handleExited = useCallback(() => {
|
|
70
|
+
setExited(true);
|
|
71
|
+
typeof onClose === "function" && onClose();
|
|
72
|
+
}, [onClose]);
|
|
73
|
+
const childProps = useMemo(() => {
|
|
74
|
+
let props = {};
|
|
75
|
+
|
|
76
|
+
// It's a Transition like component
|
|
77
|
+
if (hasTransition && children) {
|
|
78
|
+
props = {
|
|
79
|
+
onEnter: createChainedFunction(handleEnter, children.props.onEnter),
|
|
80
|
+
onExited: createChainedFunction(handleExited, children.props.onExited),
|
|
81
|
+
in: open,
|
|
82
|
+
forceClose: handleClose
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
return props;
|
|
86
|
+
}, [children, handleClose, handleEnter, handleExited, hasTransition, open]);
|
|
87
|
+
if (!open && (!hasTransition || exited)) {
|
|
88
|
+
return null;
|
|
89
|
+
}
|
|
90
|
+
return /*#__PURE__*/React.createElement(Window, _extends({}, rest, {
|
|
91
|
+
ref: handleRef,
|
|
92
|
+
onClose: handleClose,
|
|
93
|
+
disableFocusLock: disableFocusLock,
|
|
94
|
+
disableScrollLock: disableScrollLock,
|
|
95
|
+
disableCloseOnEsc: disableCloseOnEsc
|
|
96
|
+
}), /*#__PURE__*/React.createElement(Fade, {
|
|
97
|
+
in: open,
|
|
98
|
+
timeout: open ? overlayTimeout.enter : overlayTimeout.exit
|
|
99
|
+
}, /*#__PURE__*/React.createElement(Overlay, {
|
|
100
|
+
onClick: handleBackgroundClick,
|
|
101
|
+
disableBackgroundColor: disableBackgroundColor,
|
|
102
|
+
style: {
|
|
103
|
+
pointerEvents: open ? undefined : "none"
|
|
104
|
+
}
|
|
105
|
+
})), /*#__PURE__*/cloneElement(children, childProps));
|
|
106
|
+
});
|
|
107
|
+
ModalBase.displayName = "ModalBase";
|
|
108
|
+
//# sourceMappingURL=ModalBase.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ModalBase.js","names":["React","forwardRef","useRef","cloneElement","useMemo","useCallback","useState","useEffect","createChainedFunction","useForkRef","Overlay","Fade","SLIDE_FROM_TOP_ENTER","SLIDE_FROM_TOP_EXIT","Window","getHasTransition","children","props","Object","prototype","hasOwnProperty","call","ModalBase","_ref","ref","_ref$disableFocusLock","disableFocusLock","_ref$disableScrollLoc","disableScrollLock","_ref$disableBackgroun","disableBackgroundClick","_ref$disableBackgroun2","disableBackgroundColor","_ref$disableCloseOnEs","disableCloseOnEsc","_ref$open","open","defaultOpen","_ref$overlayTimeout","overlayTimeout","enter","exit","onClose","onClickOutside","rest","_objectWithoutPropertiesLoose","_excluded","_useState","setOpen","_useState2","exited","setExited","innerRef","handleRef","hasTransition","handleClose","handleBackgroundClick","event","preventDefault","handleEnter","handleExited","childProps","onEnter","onExited","in","forceClose","createElement","_extends","timeout","onClick","style","pointerEvents","undefined","displayName"],"sources":["../../../../src/components/Modal/ModalBase.tsx"],"sourcesContent":["import React, {\n forwardRef,\n HTMLAttributes,\n useRef,\n cloneElement,\n useMemo,\n useCallback,\n ReactElement,\n useState,\n useEffect,\n MouseEvent,\n} from \"react\";\n\nimport createChainedFunction from \"../../utils/createChainedFunction\";\nimport useForkRef from \"../../utils/useForkRef\";\nimport { Overlay } from \"../Overlay\";\nimport {\n Fade,\n SLIDE_FROM_TOP_ENTER,\n SLIDE_FROM_TOP_EXIT,\n} from \"../Transitions\";\nimport { Window } from \"../Window\";\n\nexport interface IModal {\n disableFocusLock?: boolean;\n disableScrollLock?: boolean;\n open?: boolean;\n disableBackgroundClick?: boolean;\n disableCloseOnEsc?: boolean;\n disableBackgroundColor?: boolean;\n onClose?: () => void;\n children: ReactElement;\n onClickOutside?: (event) => void;\n /** How long the overlay takes to arrive and to leave. Match it to the animation the child runs. */\n overlayTimeout?: { enter: number; exit: number };\n}\n\nconst getHasTransition = (children): boolean => {\n return children.props\n ? Object.prototype.hasOwnProperty.call(children.props, \"in\")\n : false;\n};\n\n// The modal behind Dialog and ObjectFormModal. It stays out of the package index, so only the design system renders it.\nexport const ModalBase = forwardRef<\n HTMLDivElement,\n IModal & HTMLAttributes<HTMLDivElement>\n>(\n (\n {\n children,\n disableFocusLock = false,\n disableScrollLock = false,\n disableBackgroundClick = false,\n disableBackgroundColor = false,\n disableCloseOnEsc = false,\n open: defaultOpen = false,\n overlayTimeout = {\n enter: SLIDE_FROM_TOP_ENTER,\n exit: SLIDE_FROM_TOP_EXIT,\n },\n onClose,\n onClickOutside,\n ...rest\n },\n ref\n ) => {\n const [open, setOpen] = useState(defaultOpen);\n const [exited, setExited] = useState(true);\n const innerRef = useRef<HTMLDivElement>(null);\n const handleRef = useForkRef(innerRef, ref);\n\n const hasTransition = useMemo(() => {\n return getHasTransition(children);\n }, [children]);\n\n useEffect(() => {\n setOpen(defaultOpen);\n }, [defaultOpen]);\n\n const handleClose = useCallback(() => {\n setOpen(false);\n if (!hasTransition) {\n typeof onClose === \"function\" && onClose();\n }\n }, [hasTransition, onClose]);\n\n const handleBackgroundClick = useCallback(\n (event: MouseEvent<HTMLDivElement>) => {\n if (!disableBackgroundClick) {\n event.preventDefault();\n return handleClose();\n }\n\n if (onClickOutside) {\n onClickOutside(event);\n }\n },\n [disableBackgroundClick, onClickOutside, handleClose]\n );\n\n const handleEnter = useCallback(() => {\n setExited(false);\n }, []);\n\n const handleExited = useCallback(() => {\n setExited(true);\n typeof onClose === \"function\" && onClose();\n }, [onClose]);\n\n const childProps = useMemo(() => {\n let props = {};\n\n // It's a Transition like component\n if (hasTransition && children) {\n props = {\n onEnter: createChainedFunction(handleEnter, children.props.onEnter),\n onExited: createChainedFunction(\n handleExited,\n children.props.onExited\n ),\n in: open,\n forceClose: handleClose,\n };\n }\n\n return props;\n }, [children, handleClose, handleEnter, handleExited, hasTransition, open]);\n\n if (!open && (!hasTransition || exited)) {\n return null;\n }\n\n return (\n <Window\n {...rest}\n ref={handleRef}\n onClose={handleClose}\n disableFocusLock={disableFocusLock}\n disableScrollLock={disableScrollLock}\n disableCloseOnEsc={disableCloseOnEsc}\n >\n <Fade\n in={open}\n timeout={open ? overlayTimeout.enter : overlayTimeout.exit}\n >\n <Overlay\n onClick={handleBackgroundClick}\n disableBackgroundColor={disableBackgroundColor}\n style={{ pointerEvents: open ? undefined : \"none\" }}\n />\n </Fade>\n {cloneElement(children, childProps)}\n </Window>\n );\n }\n);\n\nModalBase.displayName = \"ModalBase\";\n"],"mappings":";;;AAAA,OAAOA,KAAK,IACVC,UAAU,EAEVC,MAAM,EACNC,YAAY,EACZC,OAAO,EACPC,WAAW,EAEXC,QAAQ,EACRC,SAAS,QAEJ,OAAO;AAEd,OAAOC,qBAAqB,MAAM,mCAAmC;AACrE,OAAOC,UAAU,MAAM,wBAAwB;AAC/C,SAASC,OAAO,QA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oot = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
105
105
|
return undefined;
|
|
106
106
|
}
|
|
107
107
|
const handleKeyDown = event => {
|
|
108
|
-
var _overlayRootRef$curre;
|
|
108
|
+
var _overlayRootRef$curre, _overlayRootRef$curre2;
|
|
109
109
|
const stackId = stackIdRef.current;
|
|
110
110
|
if (stackId === undefined || !isTopModalRoot(stackId) || event.defaultPrevented || event.key !== "Escape" && event.key !== "Esc") {
|
|
111
111
|
return;
|
|
@@ -116,6 +116,12 @@ export const ModalRoot = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
116
116
|
return;
|
|
117
117
|
}
|
|
118
118
|
event.preventDefault();
|
|
119
|
+
|
|
120
|
+
// A sheet, a menu or the chat in the overlay root is a layer above the dialog. An Escape it did not take
|
|
121
|
+
// still belongs to it, so the dialog only stops the browser from closing itself.
|
|
122
|
+
if ((_overlayRootRef$curre2 = overlayRootRef.current) != null && _overlayRootRef$curre2.contains(event.target)) {
|
|
123
|
+
return;
|
|
124
|
+
}
|
|
119
125
|
if (openRef.current) {
|
|
120
126
|
dismissRef.current == null || dismissRef.current("escape");
|
|
121
127
|
}
|
|
@@ -128,7 +134,14 @@ export const ModalRoot = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
128
134
|
return undefined;
|
|
129
135
|
}
|
|
130
136
|
const handleCancel = event => {
|
|
137
|
+
var _overlayRootRef$curre3;
|
|
131
138
|
event.preventDefault();
|
|
139
|
+
|
|
140
|
+
// A layer in the overlay root may stop its Escape before the document sees it, so the cancel that follows
|
|
141
|
+
// would close the dialog under the layer. While the focus is in that layer, the close request is its own.
|
|
142
|
+
if ((_overlayRootRef$curre3 = overlayRootRef.current) != null && _overlayRootRef$curre3.contains(document.activeElement)) {
|
|
143
|
+
return;
|
|
144
|
+
}
|
|
132
145
|
if (openRef.current) {
|
|
133
146
|
dismissRef.current == null || dismissRef.current("escape");
|
|
134
147
|
}
|
|
@@ -163,12 +176,19 @@ export const ModalRoot = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
163
176
|
// React events from a portal bubble through the React tree, so an Escape from the content would reach an
|
|
164
177
|
// ancestor's handler, like an older Sheet's, before the document listener. The dialog takes it here first.
|
|
165
178
|
const handleKeyDown = useCallback(event => {
|
|
179
|
+
var _overlayRootRef$curre4;
|
|
166
180
|
onKeyDown == null || onKeyDown(event);
|
|
167
181
|
if (event.defaultPrevented || event.key !== "Escape" && event.key !== "Esc" || stackIdRef.current === undefined || !isTopModalRoot(stackIdRef.current)) {
|
|
168
182
|
return;
|
|
169
183
|
}
|
|
170
184
|
event.preventDefault();
|
|
171
185
|
event.stopPropagation();
|
|
186
|
+
|
|
187
|
+
// An Escape a layer in the overlay root did not take stops here too, so it does not close the sheet that
|
|
188
|
+
// opened this dialog, but it leaves the dialog open.
|
|
189
|
+
if ((_overlayRootRef$curre4 = overlayRootRef.current) != null && _overlayRootRef$curre4.contains(event.target)) {
|
|
190
|
+
return;
|
|
191
|
+
}
|
|
172
192
|
if (openRef.current) {
|
|
173
193
|
dismissRef.current == null || dismissRef.current("escape");
|
|
174
194
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ModalRoot.js","names":["React","forwardRef","useCallback","useEffect","useLayoutEffect","useRef","useState","RemoveScroll","classnames","isTopModalRoot","popModalRoot","pushModalRoot","StyledModalRoot","Portal","PortalContainerProvider","useForkRef","ModalRoot","_ref","ref","open","onRequestClose","onDismissBlocked","onClose","_ref$disableCloseOnEs","disableCloseOnEsc","_ref$disableBackgroun","disableBackgroundClick","_ref$disableScrollLoc","disableScrollLock","children","className","onPointerDown","onClick","onKeyDown","rest","_objectWithoutPropertiesLoose","_excluded","_useState","mounted","setMounted","_useState2","dialog","setDialog","dialogRef","setDialogNode","node","current","handleRef","hasTransition","openRef","pressStartedOnBackdrop","stackIdRef","overlayRootRef","getOverlayRoot","finishClose","_dialogRef$current","undefined","close","showModal","dismissRef","reason","event","blocked","handleKeyDown","_overlayRootRef$curre","stackId","defaultPrevented","key","target","document","body","querySelector","preventDefault","addEventListener","removeEventListener","handleCancel","handleNativeClose","handlePointerDown","currentTarget","handleClick","stopPropagation","handleExited","createElement","forwardProps","enabled","noIsolation","_extends","value","in","onExited","displayName"],"sources":["../../../../src/components/ModalRoot/ModalRoot.tsx"],"sourcesContent":["import React, {\n forwardRef,\n HTMLAttributes,\n KeyboardEvent as ReactKeyboardEvent,\n MouseEvent,\n PointerEvent,\n ReactNode,\n useCallback,\n useEffect,\n useLayoutEffect,\n useRef,\n useState,\n} from \"react\";\nimport { RemoveScroll } from \"react-remove-scroll\";\n\nimport classnames from \"classnames\";\n\nimport { isTopModalRoot, popModalRoot, pushModalRoot } from \"./modalRootStack\";\nimport { StyledModalRoot } from \"./Styles\";\nimport { Portal, PortalContainerProvider } from \"../../helpers\";\nimport useForkRef from \"../../utils/useForkRef\";\n\nexport type ModalRootDismissReason = \"escape\" | \"backdrop\";\n\nexport interface ModalRootTransition {\n in: boolean;\n onExited: () => void;\n}\n\nexport interface ModalRootProps\n extends Omit<\n HTMLAttributes<HTMLDialogElement>,\n \"children\" | \"open\" | \"onClose\" | \"onCancel\"\n > {\n open: boolean;\n /** Escape or a backdrop click asks the owner to set open to false */\n onRequestClose?: (reason: ModalRootDismissReason) => void;\n /** Escape or a backdrop click that disableCloseOnEsc or disableBackgroundClick blocked; a backdrop click passes its event */\n onDismissBlocked?: (\n reason: ModalRootDismissReason,\n event?: MouseEvent<HTMLDialogElement>\n ) => void;\n /** The exit transition is done and the dialog is closed */\n onClose?: () => void;\n disableCloseOnEsc?: boolean;\n disableBackgroundClick?: boolean;\n disableScrollLock?: boolean;\n /** A function gets the transition state, and the dialog closes when it calls onExited. A node closes at once. */\n children: ReactNode | ((transition: ModalRootTransition) => ReactNode);\n}\n\nexport const ModalRoot = forwardRef<HTMLDialogElement, ModalRootProps>(\n (\n {\n open,\n onRequestClose,\n onDismissBlocked,\n onClose,\n disableCloseOnEsc = false,\n disableBackgroundClick = false,\n disableScrollLock = false,\n children,\n className,\n onPointerDown,\n onClick,\n onKeyDown,\n ...rest\n },\n ref\n ) => {\n const [mounted, setMounted] = useState(open);\n // Inside another root the dialog mounts a render after its first one, once the outer overlay root exists,\n // so opening, the stack and the listeners wait for the node instead of the first commit.\n const [dialog, setDialog] = useState<HTMLDialogElement | null>(null);\n const dialogRef = useRef<HTMLDialogElement | null>(null);\n const setDialogNode = useCallback((node: HTMLDialogElement | null) => {\n dialogRef.current = node;\n setDialog(node);\n }, []);\n const handleRef = useForkRef(setDialogNode, ref);\n const hasTransition = typeof children === \"function\";\n const openRef = useRef(open);\n const pressStartedOnBackdrop = useRef(false);\n const stackIdRef = useRef<number>();\n const overlayRootRef = useRef<HTMLDivElement>(null);\n // Menus and pickers opened inside portal here, into the top layer with the dialog, not under it.\n const getOverlayRoot = useCallback(\n () => overlayRootRef.current as HTMLElement,\n []\n );\n\n openRef.current = open;\n\n if (open && !mounted) {\n setMounted(true);\n }\n\n const finishClose = useCallback(() => {\n // Content that sits in the overlay root moves out before the dialog hides it.\n if (stackIdRef.current !== undefined) {\n popModalRoot(stackIdRef.current);\n stackIdRef.current = undefined;\n }\n dialogRef.current?.close();\n setMounted(false);\n onClose?.();\n }, [onClose]);\n\n // The entry joins the stack with every showModal, so an owner that opens the dialog again from onClose, on the\n // same node, gets it back.\n useLayoutEffect(() => {\n if (!open || !dialog) {\n return;\n }\n\n if (stackIdRef.current === undefined) {\n stackIdRef.current = pushModalRoot(overlayRootRef.current);\n }\n\n if (!dialog.open) {\n dialog.showModal();\n }\n }, [open, dialog]);\n\n // A layout effect, so the entry leaves the stack before an unmount removes the dialog and its overlay root.\n useLayoutEffect(\n () => () => {\n if (stackIdRef.current !== undefined) {\n popModalRoot(stackIdRef.current);\n stackIdRef.current = undefined;\n }\n },\n [dialog]\n );\n\n useLayoutEffect(() => {\n if (!open && mounted && !hasTransition) {\n finishClose();\n }\n }, [open, mounted, hasTransition, finishClose]);\n\n const dismissRef =\n useRef<\n (\n reason: ModalRootDismissReason,\n event?: MouseEvent<HTMLDialogElement>\n ) => void\n >();\n\n dismissRef.current = (reason, event) => {\n const blocked =\n reason === \"escape\" ? disableCloseOnEsc : disableBackgroundClick;\n\n if (blocked) {\n onDismissBlocked?.(reason, event);\n } else {\n onRequestClose?.(reason);\n }\n };\n\n // A prevented Escape keydown starts no close request, and the browser stops honouring a prevented cancel\n // after a while, so Escape is caught here and the cancel event only covers the other close requests.\n useEffect(() => {\n if (!dialog) {\n return undefined;\n }\n\n const handleKeyDown = (event: KeyboardEvent) => {\n const stackId = stackIdRef.current;\n\n if (\n stackId === undefined ||\n !isTopModalRoot(stackId) ||\n event.defaultPrevented ||\n (event.key !== \"Escape\" && event.key !== \"Esc\")\n ) {\n return;\n }\n\n // A menu inside closes on an Escape that reaches the body, from a listener that runs after this one.\n if (\n event.target === document.body &&\n overlayRootRef.current?.querySelector(\".c-window\")\n ) {\n return;\n }\n\n event.preventDefault();\n\n if (openRef.current) {\n dismissRef.current?.(\"escape\");\n }\n };\n\n document.addEventListener(\"keydown\", handleKeyDown);\n\n return () => document.removeEventListener(\"keydown\", handleKeyDown);\n }, [dialog]);\n\n useEffect(() => {\n if (!dialog) {\n return undefined;\n }\n\n const handleCancel = (event: Event) => {\n event.preventDefault();\n\n if (openRef.current) {\n dismissRef.current?.(\"escape\");\n }\n };\n\n const handleNativeClose = () => {\n if (openRef.current && !dialog.open) {\n dialog.showModal();\n }\n };\n\n dialog.addEventListener(\"cancel\", handleCancel);\n dialog.addEventListener(\"close\", handleNativeClose);\n\n return () => {\n dialog.removeEventListener(\"cancel\", handleCancel);\n dialog.removeEventListener(\"close\", handleNativeClose);\n };\n }, [dialog]);\n\n const handlePointerDown = useCallback(\n (event: PointerEvent<HTMLDialogElement>) => {\n pressStartedOnBackdrop.current = event.target === event.currentTarget;\n onPointerDown?.(event);\n },\n [onPointerDown]\n );\n\n // The dialog covers the viewport and its content sits inside it, so a click on the dialog itself is a\n // click on the backdrop. A press that started on the content and ended outside it is a text selection.\n const handleClick = useCallback(\n (event: MouseEvent<HTMLDialogElement>) => {\n if (\n event.target === event.currentTarget &&\n pressStartedOnBackdrop.current &&\n openRef.current\n ) {\n dismissRef.current?.(\"backdrop\", event);\n }\n pressStartedOnBackdrop.current = false;\n onClick?.(event);\n },\n [onClick]\n );\n\n // React events from a portal bubble through the React tree, so an Escape from the content would reach an\n // ancestor's handler, like an older Sheet's, before the document listener. The dialog takes it here first.\n const handleKeyDown = useCallback(\n (event: ReactKeyboardEvent<HTMLDialogElement>) => {\n onKeyDown?.(event);\n\n if (\n event.defaultPrevented ||\n (event.key !== \"Escape\" && event.key !== \"Esc\") ||\n stackIdRef.current === undefined ||\n !isTopModalRoot(stackIdRef.current)\n ) {\n return;\n }\n\n event.preventDefault();\n event.stopPropagation();\n\n if (openRef.current) {\n dismissRef.current?.(\"escape\");\n }\n },\n [onKeyDown]\n );\n\n const handleExited = useCallback(() => {\n if (!open) {\n finishClose();\n }\n }, [open, finishClose]);\n\n if (!mounted) {\n return null;\n }\n\n return (\n <Portal>\n <RemoveScroll\n forwardProps\n ref={handleRef}\n enabled={!disableScrollLock}\n noIsolation\n >\n <StyledModalRoot\n {...rest}\n className={classnames(\"c-modal-root\", className)}\n data-state={open ? \"open\" : \"closing\"}\n onPointerDown={handlePointerDown}\n onClick={handleClick}\n onKeyDown={handleKeyDown}\n >\n <PortalContainerProvider value={getOverlayRoot}>\n {typeof children === \"function\"\n ? children({ in: open, onExited: handleExited })\n : children}\n </PortalContainerProvider>\n <div ref={overlayRootRef} className=\"c-modal-root__overlays\" />\n </StyledModalRoot>\n </RemoveScroll>\n </Portal>\n );\n }\n);\n\nModalRoot.displayName = \"ModalRoot\";\n"],"mappings":";;;AAAA,OAAOA,KAAK,IACVC,UAAU,EAMVC,WAAW,EACXC,SAAS,EACTC,eAAe,EACfC,MAAM,EACNC,QAAQ,QACH,OAAO;AACd,SAASC,YAAY,QAAQ,qBAAqB;AAElD,OAAOC,UAAU,MAAM,YAAY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AE,CAC/C,CACL,CACR,CAAC;AAEb,CACF,CAAC;AAEDd,SAAS,CAAC0E,WAAW,GAAG,WAAW","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"ModalRoot.js","names":["React","forwardRef","useCallback","useEffect","useLayoutEffect","useRef","useState","RemoveScroll","classnames","isTopModalRoot","popModalRoot","pushModalRoot","StyledModalRoot","Portal","PortalContainerProvider","useForkRef","ModalRoot","_ref","ref","open","onRequestClose","onDismissBlocked","onClose","_ref$disableCloseOnEs","disableCloseOnEsc","_ref$disableBackgroun","disableBackgroundClick","_ref$disableScrollLoc","disableScrollLock","children","className","onPointerDown","onClick","onKeyDown","rest","_objectWithoutPropertiesLoose","_excluded","_useState","mounted","setMounted","_useState2","dialog","setDialog","dialogRef","setDialogNode","node","current","handleRef","hasTransition","openRef","pressStartedOnBackdrop","stackIdRef","overlayRootRef","getOverlayRoot","finishClose","_dialogRef$current","undefined","close","showModal","dismissRef","reason","event","blocked","handleKeyDown","_overlayRootRef$curre","_overlayRootRef$curre2","stackId","defaultPrevented","key","target","document","body","querySelector","preventDefault","contains","addEventListener","removeEventListener","handleCancel","_overlayRootRef$curre3","activeElement","handleNativeClose","handlePointerDown","currentTarget","handleClick","_overlayRootRef$curre4","stopPropagation","handleExited","createElement","forwardProps","enabled","noIsolation","_extends","value","in","onExited","displayName"],"sources":["../../../../src/components/ModalRoot/ModalRoot.tsx"],"sourcesContent":["import React, {\n forwardRef,\n HTMLAttributes,\n KeyboardEvent as ReactKeyboardEvent,\n MouseEvent,\n PointerEvent,\n ReactNode,\n useCallback,\n useEffect,\n useLayoutEffect,\n useRef,\n useState,\n} from \"react\";\nimport { RemoveScroll } from \"react-remove-scroll\";\n\nimport classnames from \"classnames\";\n\nimport { isTopModalRoot, popModalRoot, pushModalRoot } from \"./modalRootStack\";\nimport { StyledModalRoot } from \"./Styles\";\nimport { Portal, PortalContainerProvider } from \"../../helpers\";\nimport useForkRef from \"../../utils/useForkRef\";\n\nexport type ModalRootDismissReason = \"escape\" | \"backdrop\";\n\nexport interface ModalRootTransition {\n in: boolean;\n onExited: () => void;\n}\n\nexport interface ModalRootProps\n extends Omit<\n HTMLAttributes<HTMLDialogElement>,\n \"children\" | \"open\" | \"onClose\" | \"onCancel\"\n > {\n open: boolean;\n /** Escape or a backdrop click asks the owner to set open to false */\n onRequestClose?: (reason: ModalRootDismissReason) => void;\n /** Escape or a backdrop click that disableCloseOnEsc or disableBackgroundClick blocked; a backdrop click passes its event */\n onDismissBlocked?: (\n reason: ModalRootDismissReason,\n event?: MouseEvent<HTMLDialogElement>\n ) => void;\n /** The exit transition is done and the dialog is closed */\n onClose?: () => void;\n disableCloseOnEsc?: boolean;\n disableBackgroundClick?: boolean;\n disableScrollLock?: boolean;\n /** A function gets the transition state, and the dialog closes when it calls onExited. A node closes at once. */\n children: ReactNode | ((transition: ModalRootTransition) => ReactNode);\n}\n\nexport const ModalRoot = forwardRef<HTMLDialogElement, ModalRootProps>(\n (\n {\n open,\n onRequestClose,\n onDismissBlocked,\n onClose,\n disableCloseOnEsc = false,\n disableBackgroundClick = false,\n disableScrollLock = false,\n children,\n className,\n onPointerDown,\n onClick,\n onKeyDown,\n ...rest\n },\n ref\n ) => {\n const [mounted, setMounted] = useState(open);\n // Inside another root the dialog mounts a render after its first one, once the outer overlay root exists,\n // so opening, the stack and the listeners wait for the node instead of the first commit.\n const [dialog, setDialog] = useState<HTMLDialogElement | null>(null);\n const dialogRef = useRef<HTMLDialogElement | null>(null);\n const setDialogNode = useCallback((node: HTMLDialogElement | null) => {\n dialogRef.current = node;\n setDialog(node);\n }, []);\n const handleRef = useForkRef(setDialogNode, ref);\n const hasTransition = typeof children === \"function\";\n const openRef = useRef(open);\n const pressStartedOnBackdrop = useRef(false);\n const stackIdRef = useRef<number>();\n const overlayRootRef = useRef<HTMLDivElement>(null);\n // Menus and pickers opened inside portal here, into the top layer with the dialog, not under it.\n const getOverlayRoot = useCallback(\n () => overlayRootRef.current as HTMLElement,\n []\n );\n\n openRef.current = open;\n\n if (open && !mounted) {\n setMounted(true);\n }\n\n const finishClose = useCallback(() => {\n // Content that sits in the overlay root moves out before the dialog hides it.\n if (stackIdRef.current !== undefined) {\n popModalRoot(stackIdRef.current);\n stackIdRef.current = undefined;\n }\n dialogRef.current?.close();\n setMounted(false);\n onClose?.();\n }, [onClose]);\n\n // The entry joins the stack with every showModal, so an owner that opens the dialog again from onClose, on the\n // same node, gets it back.\n useLayoutEffect(() => {\n if (!open || !dialog) {\n return;\n }\n\n if (stackIdRef.current === undefined) {\n stackIdRef.current = pushModalRoot(overlayRootRef.current);\n }\n\n if (!dialog.open) {\n dialog.showModal();\n }\n }, [open, dialog]);\n\n // A layout effect, so the entry leaves the stack before an unmount removes the dialog and its overlay root.\n useLayoutEffect(\n () => () => {\n if (stackIdRef.current !== undefined) {\n popModalRoot(stackIdRef.current);\n stackIdRef.current = undefined;\n }\n },\n [dialog]\n );\n\n useLayoutEffect(() => {\n if (!open && mounted && !hasTransition) {\n finishClose();\n }\n }, [open, mounted, hasTransition, finishClose]);\n\n const dismissRef =\n useRef<\n (\n reason: ModalRootDismissReason,\n event?: MouseEvent<HTMLDialogElement>\n ) => void\n >();\n\n dismissRef.current = (reason, event) => {\n const blocked =\n reason === \"escape\" ? disableCloseOnEsc : disableBackgroundClick;\n\n if (blocked) {\n onDismissBlocked?.(reason, event);\n } else {\n onRequestClose?.(reason);\n }\n };\n\n // A prevented Escape keydown starts no close request, and the browser stops honouring a prevented cancel\n // after a while, so Escape is caught here and the cancel event only covers the other close requests.\n useEffect(() => {\n if (!dialog) {\n return undefined;\n }\n\n const handleKeyDown = (event: KeyboardEvent) => {\n const stackId = stackIdRef.current;\n\n if (\n stackId === undefined ||\n !isTopModalRoot(stackId) ||\n event.defaultPrevented ||\n (event.key !== \"Escape\" && event.key !== \"Esc\")\n ) {\n return;\n }\n\n // A menu inside closes on an Escape that reaches the body, from a listener that runs after this one.\n if (\n event.target === document.body &&\n overlayRootRef.current?.querySelector(\".c-window\")\n ) {\n return;\n }\n\n event.preventDefault();\n\n // A sheet, a menu or the chat in the overlay root is a layer above the dialog. An Escape it did not take\n // still belongs to it, so the dialog only stops the browser from closing itself.\n if (overlayRootRef.current?.contains(event.target as Node)) {\n return;\n }\n\n if (openRef.current) {\n dismissRef.current?.(\"escape\");\n }\n };\n\n document.addEventListener(\"keydown\", handleKeyDown);\n\n return () => document.removeEventListener(\"keydown\", handleKeyDown);\n }, [dialog]);\n\n useEffect(() => {\n if (!dialog) {\n return undefined;\n }\n\n const handleCancel = (event: Event) => {\n event.preventDefault();\n\n // A layer in the overlay root may stop its Escape before the document sees it, so the cancel that follows\n // would close the dialog under the layer. While the focus is in that layer, the close request is its own.\n if (overlayRootRef.current?.contains(document.activeElement)) {\n return;\n }\n\n if (openRef.current) {\n dismissRef.current?.(\"escape\");\n }\n };\n\n const handleNativeClose = () => {\n if (openRef.current && !dialog.open) {\n dialog.showModal();\n }\n };\n\n dialog.addEventListener(\"cancel\", handleCancel);\n dialog.addEventListener(\"close\", handleNativeClose);\n\n return () => {\n dialog.removeEventListener(\"cancel\", handleCancel);\n dialog.removeEventListener(\"close\", handleNativeClose);\n };\n }, [dialog]);\n\n const handlePointerDown = useCallback(\n (event: PointerEvent<HTMLDialogElement>) => {\n pressStartedOnBackdrop.current = event.target === event.currentTarget;\n onPointerDown?.(event);\n },\n [onPointerDown]\n );\n\n // The dialog covers the viewport and its content sits inside it, so a click on the dialog itself is a\n // click on the backdrop. A press that started on the content and ended outside it is a text selection.\n const handleClick = useCallback(\n (event: MouseEvent<HTMLDialogElement>) => {\n if (\n event.target === event.currentTarget &&\n pressStartedOnBackdrop.current &&\n openRef.current\n ) {\n dismissRef.current?.(\"backdrop\", event);\n }\n pressStartedOnBackdrop.current = false;\n onClick?.(event);\n },\n [onClick]\n );\n\n // React events from a portal bubble through the React tree, so an Escape from the content would reach an\n // ancestor's handler, like an older Sheet's, before the document listener. The dialog takes it here first.\n const handleKeyDown = useCallback(\n (event: ReactKeyboardEvent<HTMLDialogElement>) => {\n onKeyDown?.(event);\n\n if (\n event.defaultPrevented ||\n (event.key !== \"Escape\" && event.key !== \"Esc\") ||\n stackIdRef.current === undefined ||\n !isTopModalRoot(stackIdRef.current)\n ) {\n return;\n }\n\n event.preventDefault();\n event.stopPropagation();\n\n // An Escape a layer in the overlay root did not take stops here too, so it does not close the sheet that\n // opened this dialog, but it leaves the dialog open.\n if (overlayRootRef.current?.contains(event.target as Node)) {\n return;\n }\n\n if (openRef.current) {\n dismissRef.current?.(\"escape\");\n }\n },\n [onKeyDown]\n );\n\n const handleExited = useCallback(() => {\n if (!open) {\n finishClose();\n }\n }, [open, finishClose]);\n\n if (!mounted) {\n return null;\n }\n\n return (\n <Portal>\n <RemoveScroll\n forwardProps\n ref={handleRef}\n enabled={!disableScrollLock}\n noIsolation\n >\n <StyledModalRoot\n {...rest}\n className={classnames(\"c-modal-root\", className)}\n data-state={open ? \"open\" : \"closing\"}\n onPointerDown={handlePointerDown}\n onClick={handleClick}\n onKeyDown={handleKeyDown}\n >\n <PortalContainerProvider value={getOverlayRoot}>\n {typeof children === \"function\"\n ? children({ in: open, onExited: handleExited })\n : children}\n </PortalContainerProvider>\n <div ref={overlayRootRef} className=\"c-modal-root__overlays\" />\n </StyledModalRoot>\n </RemoveScroll>\n </Portal>\n );\n }\n);\n\nModalRoot.displayName = \"ModalRoot\";\n"],"mappings":";;;AAAA,OAAOA,KAAK,IACVC,UAAU,EAMVC,WAAW,EACXC,SAAS,EACTC,eAAe,EACfC,MAAM,EACNC,QAAQ,QACH,OAAO;AACd,SAASC,YAAY,QAAQ,qBAAqB;AAElD,OAAOC,UAAU,MAAM,YAAY;AAEnC,SAASC,cAAc,EAAEC,YAAY,EAAEC,aAAa,QAAQ,kBAAkB;AAC9E,SAASC,eAAe,QAAQ,UAAU;AAC1C,SAASC,MAAM,EAAEC,uBAAuB,QAAQ,eAAe;AAC/D,OAAOC,UAAU,MAAM,wBAAwB;AA+B/C,OAAO,MAAMC,SAA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uF,aAAA,CAACzE,uBAAuB;IAAC8E,KAAK,EAAEvC;EAAe,GAC5C,OAAOxB,QAAQ,KAAK,UAAU,GAC3BA,QAAQ,CAAC;IAAEgE,EAAE,EAAE1E,IAAI;IAAE2E,QAAQ,EAAER;EAAa,CAAC,CAAC,GAC9CzD,QACmB,CAAC,eAC1B7B,KAAA,CAAAuF,aAAA;IAAKrE,GAAG,EAAEkC,cAAe;IAACtB,SAAS,EAAC;EAAwB,CAAE,CAC/C,CACL,CACR,CAAC;AAEb,CACF,CAAC;AAEDd,SAAS,CAAC+E,WAAW,GAAG,WAAW","ignoreList":[]}
|
|
@@ -4,6 +4,10 @@ export declare const popModalRoot: (id: number) => void;
|
|
|
4
4
|
export declare const isTopModalRoot: (id: number) => boolean;
|
|
5
5
|
/** The overlay root of the top open modal root, where content that must stay above every modal goes. */
|
|
6
6
|
export declare const getTopModalOverlayRoot: () => HTMLElement | null;
|
|
7
|
+
/** The id of the top open modal root, or undefined when none is open. */
|
|
8
|
+
export declare const getTopModalRootId: () => number | undefined;
|
|
9
|
+
/** The overlay root of the top modal root among those opened no later than the given one. */
|
|
10
|
+
export declare const getModalOverlayRootUpTo: (id: number) => HTMLElement | null;
|
|
7
11
|
export declare const subscribeToModalRoots: (listener: Listener) => (() => void);
|
|
8
12
|
export {};
|
|
9
13
|
//# sourceMappingURL=modalRootStack.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"modalRootStack.d.ts","sourceRoot":"","sources":["../../../../src/components/ModalRoot/modalRootStack.ts"],"names":[],"mappings":"AAAA,KAAK,QAAQ,GAAG,MAAM,IAAI,CAAC;AAc3B,eAAO,MAAM,aAAa,GAAI,aAAa,WAAW,GAAG,IAAI,KAAG,MAM/D,CAAC;AAEF,eAAO,MAAM,YAAY,GAAI,IAAI,MAAM,KAAG,IAOzC,CAAC;AAEF,eAAO,MAAM,cAAc,GAAI,IAAI,MAAM,KAAG,OACR,CAAC;AAErC,wGAAwG;AACxG,eAAO,MAAM,sBAAsB,QAAO,WAAW,GAAG,IACV,CAAC;AAE/C,eAAO,MAAM,qBAAqB,GAAI,UAAU,QAAQ,KAAG,CAAC,MAAM,IAAI,CAMrE,CAAC"}
|
|
1
|
+
{"version":3,"file":"modalRootStack.d.ts","sourceRoot":"","sources":["../../../../src/components/ModalRoot/modalRootStack.ts"],"names":[],"mappings":"AAAA,KAAK,QAAQ,GAAG,MAAM,IAAI,CAAC;AAc3B,eAAO,MAAM,aAAa,GAAI,aAAa,WAAW,GAAG,IAAI,KAAG,MAM/D,CAAC;AAEF,eAAO,MAAM,YAAY,GAAI,IAAI,MAAM,KAAG,IAOzC,CAAC;AAEF,eAAO,MAAM,cAAc,GAAI,IAAI,MAAM,KAAG,OACR,CAAC;AAErC,wGAAwG;AACxG,eAAO,MAAM,sBAAsB,QAAO,WAAW,GAAG,IACV,CAAC;AAE/C,yEAAyE;AACzE,eAAO,MAAM,iBAAiB,QAAO,MAAM,GAAG,SACjB,CAAC;AAE9B,6FAA6F;AAC7F,eAAO,MAAM,uBAAuB,GAAI,IAAI,MAAM,KAAG,WAAW,GAAG,IAIlE,CAAC;AAEF,eAAO,MAAM,qBAAqB,GAAI,UAAU,QAAQ,KAAG,CAAC,MAAM,IAAI,CAMrE,CAAC"}
|
|
@@ -28,6 +28,19 @@ export const getTopModalOverlayRoot = () => {
|
|
|
28
28
|
var _stack$overlayRoot, _stack2;
|
|
29
29
|
return (_stack$overlayRoot = (_stack2 = stack[stack.length - 1]) == null ? void 0 : _stack2.overlayRoot) != null ? _stack$overlayRoot : null;
|
|
30
30
|
};
|
|
31
|
+
|
|
32
|
+
/** The id of the top open modal root, or undefined when none is open. */
|
|
33
|
+
export const getTopModalRootId = () => {
|
|
34
|
+
var _stack3;
|
|
35
|
+
return (_stack3 = stack[stack.length - 1]) == null ? void 0 : _stack3.id;
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
/** The overlay root of the top modal root among those opened no later than the given one. */
|
|
39
|
+
export const getModalOverlayRootUpTo = id => {
|
|
40
|
+
var _entries$overlayRoot, _entries;
|
|
41
|
+
const entries = stack.filter(entry => entry.id <= id);
|
|
42
|
+
return (_entries$overlayRoot = (_entries = entries[entries.length - 1]) == null ? void 0 : _entries.overlayRoot) != null ? _entries$overlayRoot : null;
|
|
43
|
+
};
|
|
31
44
|
export const subscribeToModalRoots = listener => {
|
|
32
45
|
listeners.add(listener);
|
|
33
46
|
return () => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"modalRootStack.js","names":["listeners","Set","stack","lastId","notify","forEach","listener","pushModalRoot","overlayRoot","id","popModalRoot","some","entry","filter","isTopModalRoot","_stack","length","getTopModalOverlayRoot","_stack$overlayRoot","_stack2","subscribeToModalRoots","add","delete"],"sources":["../../../../src/components/ModalRoot/modalRootStack.ts"],"sourcesContent":["type Listener = () => void;\n\ninterface Entry {\n id: number;\n overlayRoot: HTMLElement | null;\n}\n\nconst listeners = new Set<Listener>();\n\nlet stack: Entry[] = [];\nlet lastId = 0;\n\nconst notify = (): void => listeners.forEach((listener) => listener());\n\nexport const pushModalRoot = (overlayRoot: HTMLElement | null): number => {\n lastId += 1;\n stack = [...stack, { id: lastId, overlayRoot }];\n notify();\n\n return lastId;\n};\n\nexport const popModalRoot = (id: number): void => {\n if (!stack.some((entry) => entry.id === id)) {\n return;\n }\n\n stack = stack.filter((entry) => entry.id !== id);\n notify();\n};\n\nexport const isTopModalRoot = (id: number): boolean =>\n stack[stack.length - 1]?.id === id;\n\n/** The overlay root of the top open modal root, where content that must stay above every modal goes. */\nexport const getTopModalOverlayRoot = (): HTMLElement | null =>\n stack[stack.length - 1]?.overlayRoot ?? null;\n\nexport const subscribeToModalRoots = (listener: Listener): (() => void) => {\n listeners.add(listener);\n\n return (): void => {\n listeners.delete(listener);\n };\n};\n"],"mappings":"AAOA,MAAMA,SAAS,GAAG,IAAIC,GAAG,CAAW,CAAC;AAErC,IAAIC,KAAc,GAAG,EAAE;AACvB,IAAIC,MAAM,GAAG,CAAC;AAEd,MAAMC,MAAM,GAAGA,CAAA,KAAYJ,SAAS,CAACK,OAAO,CAAEC,QAAQ,IAAKA,QAAQ,CAAC,CAAC,CAAC;AAEtE,OAAO,MAAMC,aAAa,GAAIC,WAA+B,IAAa;EACxEL,MAAM,IAAI,CAAC;EACXD,KAAK,GAAG,CAAC,GAAGA,KAAK,EAAE;IAAEO,EAAE,EAAEN,MAAM;IAAEK;EAAY,CAAC,CAAC;EAC/CJ,MAAM,CAAC,CAAC;EAER,OAAOD,MAAM;AACf,CAAC;AAED,OAAO,MAAMO,YAAY,GAAID,EAAU,IAAW;EAChD,IAAI,CAACP,KAAK,CAACS,IAAI,CAAEC,KAAK,IAAKA,KAAK,CAACH,EAAE,KAAKA,EAAE,CAAC,EAAE;IAC3C;EACF;EAEAP,KAAK,GAAGA,KAAK,CAACW,MAAM,CAAED,KAAK,IAAKA,KAAK,CAACH,EAAE,KAAKA,EAAE,CAAC;EAChDL,MAAM,CAAC,CAAC;AACV,CAAC;AAED,OAAO,MAAMU,cAAc,GAAIL,EAAU;EAAA,IAAAM,MAAA;EAAA,OACvC,EAAAA,MAAA,GAAAb,KAAK,CAACA,KAAK,CAACc,MAAM,GAAG,CAAC,CAAC,qBAAvBD,MAAA,CAAyBN,EAAE,MAAKA,EAAE;AAAA;;AAEpC;AACA,OAAO,MAAMQ,sBAAsB,GAAGA,CAAA;EAAA,IAAAC,kBAAA,EAAAC,OAAA;EAAA,QAAAD,kBAAA,IAAAC,OAAA,GACpCjB,KAAK,CAACA,KAAK,CAACc,MAAM,GAAG,CAAC,CAAC,qBAAvBG,OAAA,CAAyBX,WAAW,YAAAU,kBAAA,GAAI,IAAI;AAAA;
|
|
1
|
+
{"version":3,"file":"modalRootStack.js","names":["listeners","Set","stack","lastId","notify","forEach","listener","pushModalRoot","overlayRoot","id","popModalRoot","some","entry","filter","isTopModalRoot","_stack","length","getTopModalOverlayRoot","_stack$overlayRoot","_stack2","getTopModalRootId","_stack3","getModalOverlayRootUpTo","_entries$overlayRoot","_entries","entries","subscribeToModalRoots","add","delete"],"sources":["../../../../src/components/ModalRoot/modalRootStack.ts"],"sourcesContent":["type Listener = () => void;\n\ninterface Entry {\n id: number;\n overlayRoot: HTMLElement | null;\n}\n\nconst listeners = new Set<Listener>();\n\nlet stack: Entry[] = [];\nlet lastId = 0;\n\nconst notify = (): void => listeners.forEach((listener) => listener());\n\nexport const pushModalRoot = (overlayRoot: HTMLElement | null): number => {\n lastId += 1;\n stack = [...stack, { id: lastId, overlayRoot }];\n notify();\n\n return lastId;\n};\n\nexport const popModalRoot = (id: number): void => {\n if (!stack.some((entry) => entry.id === id)) {\n return;\n }\n\n stack = stack.filter((entry) => entry.id !== id);\n notify();\n};\n\nexport const isTopModalRoot = (id: number): boolean =>\n stack[stack.length - 1]?.id === id;\n\n/** The overlay root of the top open modal root, where content that must stay above every modal goes. */\nexport const getTopModalOverlayRoot = (): HTMLElement | null =>\n stack[stack.length - 1]?.overlayRoot ?? null;\n\n/** The id of the top open modal root, or undefined when none is open. */\nexport const getTopModalRootId = (): number | undefined =>\n stack[stack.length - 1]?.id;\n\n/** The overlay root of the top modal root among those opened no later than the given one. */\nexport const getModalOverlayRootUpTo = (id: number): HTMLElement | null => {\n const entries = stack.filter((entry) => entry.id <= id);\n\n return entries[entries.length - 1]?.overlayRoot ?? null;\n};\n\nexport const subscribeToModalRoots = (listener: Listener): (() => void) => {\n listeners.add(listener);\n\n return (): void => {\n listeners.delete(listener);\n };\n};\n"],"mappings":"AAOA,MAAMA,SAAS,GAAG,IAAIC,GAAG,CAAW,CAAC;AAErC,IAAIC,KAAc,GAAG,EAAE;AACvB,IAAIC,MAAM,GAAG,CAAC;AAEd,MAAMC,MAAM,GAAGA,CAAA,KAAYJ,SAAS,CAACK,OAAO,CAAEC,QAAQ,IAAKA,QAAQ,CAAC,CAAC,CAAC;AAEtE,OAAO,MAAMC,aAAa,GAAIC,WAA+B,IAAa;EACxEL,MAAM,IAAI,CAAC;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AEvD,QAAAc,oBAAA,IAAAC,QAAA,GAAOC,OAAO,CAACA,OAAO,CAACT,MAAM,GAAG,CAAC,CAAC,qBAA3BQ,QAAA,CAA6BhB,WAAW,YAAAe,oBAAA,GAAI,IAAI;AACzD,CAAC;AAED,OAAO,MAAMG,qBAAqB,GAAIpB,QAAkB,IAAmB;EACzEN,SAAS,CAAC2B,GAAG,CAACrB,QAAQ,CAAC;EAEvB,OAAO,MAAY;IACjBN,SAAS,CAAC4B,MAAM,CAACtB,QAAQ,CAAC;EAC5B,CAAC;AACH,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Keeps a host node in the overlay root of the top open modal, or of the top one opened no later than
|
|
3
|
+
* upToModalRootId, and in document.body while there is none. The node moves as modals open and close, so content
|
|
4
|
+
* portalled into it never remounts, and it leaves the page on unmount or when the host changes. Returns whether the
|
|
5
|
+
* host is in the page, which it is from a layout effect after the first render with it.
|
|
6
|
+
*/
|
|
7
|
+
export declare const useModalStackHost: (host: HTMLElement | null, upToModalRootId?: number) => boolean;
|
|
8
|
+
//# sourceMappingURL=useModalStackHost.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useModalStackHost.d.ts","sourceRoot":"","sources":["../../../../src/components/ModalRoot/useModalStackHost.ts"],"names":[],"mappings":"AAQA;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB,GAC5B,MAAM,WAAW,GAAG,IAAI,EACxB,kBAAkB,MAAM,KACvB,OA+BF,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { useLayoutEffect, useState } from "react";
|
|
2
|
+
import { getModalOverlayRootUpTo, getTopModalOverlayRoot, subscribeToModalRoots } from "./modalRootStack";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Keeps a host node in the overlay root of the top open modal, or of the top one opened no later than
|
|
6
|
+
* upToModalRootId, and in document.body while there is none. The node moves as modals open and close, so content
|
|
7
|
+
* portalled into it never remounts, and it leaves the page on unmount or when the host changes. Returns whether the
|
|
8
|
+
* host is in the page, which it is from a layout effect after the first render with it.
|
|
9
|
+
*/
|
|
10
|
+
export const useModalStackHost = (host, upToModalRootId) => {
|
|
11
|
+
const _useState = useState(null),
|
|
12
|
+
placedHost = _useState[0],
|
|
13
|
+
setPlacedHost = _useState[1];
|
|
14
|
+
useLayoutEffect(() => {
|
|
15
|
+
if (!host) {
|
|
16
|
+
return undefined;
|
|
17
|
+
}
|
|
18
|
+
const place = () => {
|
|
19
|
+
var _ref;
|
|
20
|
+
const target = (_ref = upToModalRootId === undefined ? getTopModalOverlayRoot() : getModalOverlayRootUpTo(upToModalRootId)) != null ? _ref : document.body;
|
|
21
|
+
if (host.parentElement !== target) {
|
|
22
|
+
target.appendChild(host);
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
place();
|
|
26
|
+
setPlacedHost(host);
|
|
27
|
+
const unsubscribe = subscribeToModalRoots(place);
|
|
28
|
+
return () => {
|
|
29
|
+
unsubscribe();
|
|
30
|
+
host.remove();
|
|
31
|
+
};
|
|
32
|
+
}, [host, upToModalRootId]);
|
|
33
|
+
return host !== null && placedHost === host;
|
|
34
|
+
};
|
|
35
|
+
//# sourceMappingURL=useModalStackHost.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useModalStackHost.js","names":["useLayoutEffect","useState","getModalOverlayRootUpTo","getTopModalOverlayRoot","subscribeToModalRoots","useModalStackHost","host","upToModalRootId","_useState","placedHost","setPlacedHost","undefined","place","_ref","target","document","body","parentElement","appendChild","unsubscribe","remove"],"sources":["../../../../src/components/ModalRoot/useModalStackHost.ts"],"sourcesContent":["import { useLayoutEffect, useState } from \"react\";\n\nimport {\n getModalOverlayRootUpTo,\n getTopModalOverlayRoot,\n subscribeToModalRoots,\n} from \"./modalRootStack\";\n\n/**\n * Keeps a host node in the overlay root of the top open modal, or of the top one opened no later than\n * upToModalRootId, and in document.body while there is none. The node moves as modals open and close, so content\n * portalled into it never remounts, and it leaves the page on unmount or when the host changes. Returns whether the\n * host is in the page, which it is from a layout effect after the first render with it.\n */\nexport const useModalStackHost = (\n host: HTMLElement | null,\n upToModalRootId?: number\n): boolean => {\n const [placedHost, setPlacedHost] = useState<HTMLElement | null>(null);\n\n useLayoutEffect(() => {\n if (!host) {\n return undefined;\n }\n\n const place = () => {\n const target =\n (upToModalRootId === undefined\n ? getTopModalOverlayRoot()\n : getModalOverlayRootUpTo(upToModalRootId)) ?? document.body;\n\n if (host.parentElement !== target) {\n target.appendChild(host);\n }\n };\n\n place();\n setPlacedHost(host);\n\n const unsubscribe = subscribeToModalRoots(place);\n\n return () => {\n unsubscribe();\n host.remove();\n };\n }, [host, upToModalRootId]);\n\n return host !== null && placedHost === host;\n};\n"],"mappings":"AAAA,SAASA,eAAe,EAAEC,QAAQ,QAAQ,OAAO;AAEjD,SACEC,uBAAuB,EACvBC,sBAAsB,EACtBC,qBAAqB,QAChB,kBAAkB;;AAEzB;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,iBAAiB,GAAGA,CAC/BC,IAAwB,EACxBC,eAAwB,KACZ;EACZ,MAAAC,SAAA,GAAoCP,QAAQ,CAAqB,IAAI,CAAC;IAA/DQ,UAAU,GAAAD,SAAA;IAAEE,aAAa,GAAAF,SAAA;EAEhCR,eAAe,CAAC,MAAM;IACpB,IAAI,CAACM,IAAI,EAAE;MACT,OAAOK,SAAS;IAClB;IAEA,MAAMC,KAAK,GAAGA,CAAA,KAAM;MAAA,IAAAC,IAAA;MAClB,MAAMC,MAAM,IAAAD,IAAA,GACTN,eAAe,KAAKI,SAAS,GAC1BR,sBAAsB,CAAC,CAAC,GACxBD,uBAAuB,CAACK,eAAe,CAAC,YAAAM,IAAA,GAAKE,QAAQ,CAACC,IAAI;MAEhE,IAAIV,IAAI,CAACW,aAAa,KAAKH,MAAM,EAAE;QACjCA,MAAM,CAACI,WAAW,CAACZ,IAAI,CAAC;MAC1B;IACF,CAAC;IAEDM,KAAK,CAAC,CAAC;IACPF,aAAa,CAACJ,IAAI,CAAC;IAEnB,MAAMa,WAAW,GAAGf,qBAAqB,CAACQ,KAAK,CAAC;IAEhD,OAAO,MAAM;MACXO,WAAW,CAAC,CAAC;MACbb,IAAI,CAACc,MAAM,CAAC,CAAC;IACf,CAAC;EACH,CAAC,EAAE,CAACd,IAAI,EAAEC,eAAe,CAAC,CAAC;EAE3B,OAAOD,IAAI,KAAK,IAAI,IAAIG,UAAU,KAAKH,IAAI;AAC7C,CAAC","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ObjectFormModal.d.ts","sourceRoot":"","sources":["../../../../src/components/ObjectFormModal/ObjectFormModal.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAEZ,cAAc,
|
|
1
|
+
{"version":3,"file":"ObjectFormModal.d.ts","sourceRoot":"","sources":["../../../../src/components/ObjectFormModal/ObjectFormModal.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAEZ,cAAc,EAIf,MAAM,OAAO,CAAC;AAQf,OAAO,EAAE,UAAU,EAAe,MAAM,kBAAkB,CAAC;AAI3D,MAAM,WAAW,oBAAqB,SAAQ,cAAc,CAAC,cAAc,CAAC;IAC1E,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,uFAAuF;IACvF,KAAK,EAAE,MAAM,CAAC;IACd,uEAAuE;IACvE,IAAI,CAAC,EAAE,UAAU,CAAC;IAClB,2GAA2G;IAC3G,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,iGAAiG;IACjG,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,sEAAsE;IACtE,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAKD,eAAO,MAAM,eAAe;;wCA4E3B,CAAC"}
|