react-flow-modal 0.4.0 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -0
- package/dist/index.cjs +10 -8
- package/dist/index.d.cts +4 -2
- package/dist/index.d.ts +4 -2
- package/dist/index.js +8 -6
- package/package.json +1 -1
- package/src/ModalHost.tsx +4 -4
- package/src/index.ts +1 -1
- package/src/useModalContext.ts +4 -2
package/README.md
CHANGED
|
@@ -113,6 +113,7 @@ function ConfirmModal({
|
|
|
113
113
|
}) {
|
|
114
114
|
return (
|
|
115
115
|
<motion.div
|
|
116
|
+
key="modal"
|
|
116
117
|
initial={{ opacity: 0 }}
|
|
117
118
|
animate={{ opacity: 1 }}
|
|
118
119
|
exit={{ opacity: 0 }}
|
|
@@ -126,6 +127,7 @@ function ConfirmModal({
|
|
|
126
127
|
}}
|
|
127
128
|
>
|
|
128
129
|
<motion.div
|
|
130
|
+
key="modal-content"
|
|
129
131
|
initial={{ scale: 0.9, opacity: 0 }}
|
|
130
132
|
animate={{ scale: 1, opacity: 1 }}
|
|
131
133
|
exit={{ scale: 0.95, opacity: 0 }}
|
package/dist/index.cjs
CHANGED
|
@@ -22,8 +22,8 @@ var index_exports = {};
|
|
|
22
22
|
__export(index_exports, {
|
|
23
23
|
ModalHost: () => ModalHost,
|
|
24
24
|
ModalProvider: () => ModalProvider,
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
useModal: () => useModal,
|
|
26
|
+
useModalHost: () => useModalHost
|
|
27
27
|
});
|
|
28
28
|
module.exports = __toCommonJS(index_exports);
|
|
29
29
|
|
|
@@ -53,9 +53,11 @@ var useModalContext = () => {
|
|
|
53
53
|
}
|
|
54
54
|
return context;
|
|
55
55
|
};
|
|
56
|
-
var
|
|
56
|
+
var useModalHost = () => {
|
|
57
57
|
const { stack } = useModalContext();
|
|
58
|
-
return
|
|
58
|
+
return {
|
|
59
|
+
render: () => stack.map((item) => item)
|
|
60
|
+
};
|
|
59
61
|
};
|
|
60
62
|
|
|
61
63
|
// src/useModal.tsx
|
|
@@ -86,13 +88,13 @@ var useModal = () => {
|
|
|
86
88
|
var import_react4 = require("react");
|
|
87
89
|
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
88
90
|
var ModalHost = () => {
|
|
89
|
-
const {
|
|
90
|
-
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_react4.Fragment, { children:
|
|
91
|
+
const { render } = useModalHost();
|
|
92
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_react4.Fragment, { children: render() });
|
|
91
93
|
};
|
|
92
94
|
// Annotate the CommonJS export names for ESM import in node:
|
|
93
95
|
0 && (module.exports = {
|
|
94
96
|
ModalHost,
|
|
95
97
|
ModalProvider,
|
|
96
|
-
|
|
97
|
-
|
|
98
|
+
useModal,
|
|
99
|
+
useModalHost
|
|
98
100
|
});
|
package/dist/index.d.cts
CHANGED
|
@@ -10,6 +10,8 @@ declare const useModal: () => {
|
|
|
10
10
|
/** @deprecated use renderModals instead */
|
|
11
11
|
declare const ModalHost: FC;
|
|
12
12
|
|
|
13
|
-
declare const
|
|
13
|
+
declare const useModalHost: () => {
|
|
14
|
+
render: () => react.ReactNode[];
|
|
15
|
+
};
|
|
14
16
|
|
|
15
|
-
export { ModalHost, ModalProvider,
|
|
17
|
+
export { ModalHost, ModalProvider, useModal, useModalHost };
|
package/dist/index.d.ts
CHANGED
|
@@ -10,6 +10,8 @@ declare const useModal: () => {
|
|
|
10
10
|
/** @deprecated use renderModals instead */
|
|
11
11
|
declare const ModalHost: FC;
|
|
12
12
|
|
|
13
|
-
declare const
|
|
13
|
+
declare const useModalHost: () => {
|
|
14
|
+
render: () => react.ReactNode[];
|
|
15
|
+
};
|
|
14
16
|
|
|
15
|
-
export { ModalHost, ModalProvider,
|
|
17
|
+
export { ModalHost, ModalProvider, useModal, useModalHost };
|
package/dist/index.js
CHANGED
|
@@ -24,9 +24,11 @@ var useModalContext = () => {
|
|
|
24
24
|
}
|
|
25
25
|
return context;
|
|
26
26
|
};
|
|
27
|
-
var
|
|
27
|
+
var useModalHost = () => {
|
|
28
28
|
const { stack } = useModalContext();
|
|
29
|
-
return
|
|
29
|
+
return {
|
|
30
|
+
render: () => stack.map((item) => item)
|
|
31
|
+
};
|
|
30
32
|
};
|
|
31
33
|
|
|
32
34
|
// src/useModal.tsx
|
|
@@ -57,12 +59,12 @@ var useModal = () => {
|
|
|
57
59
|
import { Fragment } from "react";
|
|
58
60
|
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
59
61
|
var ModalHost = () => {
|
|
60
|
-
const {
|
|
61
|
-
return /* @__PURE__ */ jsx2(Fragment, { children:
|
|
62
|
+
const { render } = useModalHost();
|
|
63
|
+
return /* @__PURE__ */ jsx2(Fragment, { children: render() });
|
|
62
64
|
};
|
|
63
65
|
export {
|
|
64
66
|
ModalHost,
|
|
65
67
|
ModalProvider,
|
|
66
|
-
|
|
67
|
-
|
|
68
|
+
useModal,
|
|
69
|
+
useModalHost
|
|
68
70
|
};
|
package/package.json
CHANGED
package/src/ModalHost.tsx
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
1
|
+
import { FC, Fragment } from 'react';
|
|
2
|
+
import { useModalHost } from './useModalContext';
|
|
3
3
|
|
|
4
4
|
/** @deprecated use renderModals instead */
|
|
5
5
|
export const ModalHost: FC = () => {
|
|
6
|
-
const {
|
|
6
|
+
const { render } = useModalHost();
|
|
7
7
|
|
|
8
8
|
return (
|
|
9
9
|
<Fragment>
|
|
10
|
-
{
|
|
10
|
+
{render()}
|
|
11
11
|
</Fragment>
|
|
12
12
|
);
|
|
13
13
|
};
|
package/src/index.ts
CHANGED
package/src/useModalContext.ts
CHANGED
|
@@ -11,8 +11,10 @@ export const useModalContext = () => {
|
|
|
11
11
|
return context;
|
|
12
12
|
};
|
|
13
13
|
|
|
14
|
-
export const
|
|
14
|
+
export const useModalHost = () => {
|
|
15
15
|
const { stack } = useModalContext();
|
|
16
16
|
|
|
17
|
-
return
|
|
17
|
+
return {
|
|
18
|
+
render: () => stack.map((item) => (item)),
|
|
19
|
+
};
|
|
18
20
|
};
|