@hrnec06/react_utils 1.7.2 → 1.7.4
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/package.json +1 -1
- package/src/components/Dialog/Dialog.tsx +16 -12
- package/src/index.ts +4 -1
package/package.json
CHANGED
|
@@ -6,6 +6,7 @@ import DialogCloseButton from "./DialogCloseButton";
|
|
|
6
6
|
import { DialogContext } from "./DialogContext";
|
|
7
7
|
import DialogPanel from "./DialogPanel";
|
|
8
8
|
import { useEffect } from "react";
|
|
9
|
+
import { createPortal } from "react-dom";
|
|
9
10
|
|
|
10
11
|
interface DialogProps extends React.PropsWithChildren {
|
|
11
12
|
open?: boolean,
|
|
@@ -27,19 +28,22 @@ function Dialog({
|
|
|
27
28
|
onClose?.();
|
|
28
29
|
}, [pressingEsc]);
|
|
29
30
|
|
|
30
|
-
return (
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
31
|
+
return createPortal(
|
|
32
|
+
(
|
|
33
|
+
<DialogContext.Provider
|
|
34
|
+
value={{
|
|
35
|
+
open: open,
|
|
36
|
+
onClose: onClose,
|
|
35
37
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
38
|
+
options: {
|
|
39
|
+
animationDuration: duration
|
|
40
|
+
},
|
|
41
|
+
}}
|
|
42
|
+
>
|
|
43
|
+
{children}
|
|
44
|
+
</DialogContext.Provider>
|
|
45
|
+
),
|
|
46
|
+
document.body
|
|
43
47
|
);
|
|
44
48
|
}
|
|
45
49
|
|
package/src/index.ts
CHANGED
|
@@ -8,7 +8,7 @@ import useEfficientRef from "./hooks/useEfficientRef";
|
|
|
8
8
|
import useUUID from "./hooks/useUUID";
|
|
9
9
|
import useFlags from "./hooks/useFlags";
|
|
10
10
|
import useNamespacedId from "./hooks/useNamespacedId";
|
|
11
|
-
import useTransition from "./hooks/useTransition";
|
|
11
|
+
import useTransition, { transitionDataAttributes } from "./hooks/useTransition";
|
|
12
12
|
import useLocalStorage from "./hooks/useLocalStorage";
|
|
13
13
|
import useDebounce from "./hooks/useDebounce";
|
|
14
14
|
import useEvent from "./hooks/useEvent";
|
|
@@ -26,6 +26,7 @@ import Dialog from "./components/Dialog/Dialog";
|
|
|
26
26
|
import ContextMenu from "./components/ContextMenu/ContextMenu";
|
|
27
27
|
|
|
28
28
|
import * as util from './lib/utils';
|
|
29
|
+
import ContextError from "./lib/errors/ContextError";
|
|
29
30
|
|
|
30
31
|
|
|
31
32
|
export {
|
|
@@ -44,6 +45,7 @@ export {
|
|
|
44
45
|
useSyncRef,
|
|
45
46
|
useSyncRefAuto,
|
|
46
47
|
useTransition,
|
|
48
|
+
transitionDataAttributes,
|
|
47
49
|
useUpdateEffect,
|
|
48
50
|
useUUID,
|
|
49
51
|
useWindowSize,
|
|
@@ -62,4 +64,5 @@ export {
|
|
|
62
64
|
|
|
63
65
|
// Utilities
|
|
64
66
|
util,
|
|
67
|
+
ContextError
|
|
65
68
|
};
|