triafly-ui-kit 1.0.102 → 1.0.103
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.
|
@@ -3,15 +3,15 @@ import { useRef as c, useEffect as u, createElement as b } from "react";
|
|
|
3
3
|
import { createPortal as y } from "react-dom";
|
|
4
4
|
import '../../../assets/src/components/Ui/ModalWindow/ModalWindow.css';/* empty css */
|
|
5
5
|
import { Button as z } from "../Button/Button.js";
|
|
6
|
-
import { IconX as
|
|
6
|
+
import { IconX as k } from "../Icons/Icons.js";
|
|
7
7
|
import { modalManager as f } from "./ModalManger.js";
|
|
8
8
|
const B = ({
|
|
9
|
-
isOpen:
|
|
10
|
-
onClose:
|
|
9
|
+
isOpen: n,
|
|
10
|
+
onClose: r,
|
|
11
11
|
width: w,
|
|
12
12
|
size: h = "md",
|
|
13
13
|
iconHeader: o,
|
|
14
|
-
title:
|
|
14
|
+
title: a,
|
|
15
15
|
children: _,
|
|
16
16
|
usePortal: p = !1,
|
|
17
17
|
foolHeight: v,
|
|
@@ -21,19 +21,19 @@ const B = ({
|
|
|
21
21
|
}) => {
|
|
22
22
|
const e = c(
|
|
23
23
|
g || `modal-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`
|
|
24
|
-
),
|
|
24
|
+
), l = c(r);
|
|
25
25
|
if (u(() => {
|
|
26
|
-
|
|
27
|
-
}, [
|
|
28
|
-
if (
|
|
29
|
-
const s = () =>
|
|
26
|
+
l.current = r;
|
|
27
|
+
}, [r]), u(() => {
|
|
28
|
+
if (n && m) {
|
|
29
|
+
const s = () => l.current(!1);
|
|
30
30
|
f.addModal(e.current, s);
|
|
31
31
|
}
|
|
32
32
|
return () => {
|
|
33
33
|
f.removeModal(e.current);
|
|
34
34
|
};
|
|
35
|
-
}, [
|
|
36
|
-
const M = (o == null ? void 0 : o.size) ?? 20,
|
|
35
|
+
}, [n, m]), !n) return null;
|
|
36
|
+
const M = (o == null ? void 0 : o.size) ?? 20, d = /* @__PURE__ */ t(N, { children: /* @__PURE__ */ t("div", { className: `modal-window overlay position-${$}`, onClick: () => r(!1), children: /* @__PURE__ */ i(
|
|
37
37
|
"div",
|
|
38
38
|
{
|
|
39
39
|
className: `modal-window__body size-${h} ${v ? "foolHeight" : ""}`,
|
|
@@ -45,14 +45,14 @@ const B = ({
|
|
|
45
45
|
children: [
|
|
46
46
|
/* @__PURE__ */ i("div", { className: "modal-window__header", children: [
|
|
47
47
|
(o == null ? void 0 : o.view) && /* @__PURE__ */ t("div", { className: `modal-window__header__icon status-${o.status}`, children: b(o.icon, { size: M }) }),
|
|
48
|
-
|
|
48
|
+
a != null && a.toString() ? /* @__PURE__ */ t("span", { className: "modal-window__header__title", children: a }) : a,
|
|
49
49
|
/* @__PURE__ */ t(
|
|
50
50
|
z,
|
|
51
51
|
{
|
|
52
52
|
type: "button",
|
|
53
|
-
icon: /* @__PURE__ */ t(
|
|
53
|
+
icon: /* @__PURE__ */ t(k, { size: 24 }),
|
|
54
54
|
className: "icon-button",
|
|
55
|
-
onClick: () =>
|
|
55
|
+
onClick: () => r(!1)
|
|
56
56
|
}
|
|
57
57
|
)
|
|
58
58
|
] }),
|
|
@@ -60,7 +60,7 @@ const B = ({
|
|
|
60
60
|
]
|
|
61
61
|
}
|
|
62
62
|
) }) });
|
|
63
|
-
return p ? y(
|
|
63
|
+
return p ? y(d, document.body) : d;
|
|
64
64
|
};
|
|
65
65
|
export {
|
|
66
66
|
B as ModalWindow
|
package/package.json
CHANGED