@megha-ui/react 1.2.669 → 1.2.670
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.
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useEffect, useState, useRef } from "react";
|
|
3
3
|
import { MdClose } from "react-icons/md";
|
|
4
|
-
const Modal = ({ isOpen, onClose, title, subTitle, titleAlign = "left", children, footer, className = "", width, minHeight = 300, padding = "1rem", borderRadius = 6, backgroundColor = "var(--modal-bg)", paddingBottom = "1rem", paddingLeft = "1rem", paddingRight = "1rem", paddingTop = "1rem", contentHeight = "calc(100vh - 180)", overlayClose = false, alignItems, justifyContent, modalContentClass, modalBodyClass, bodyOverflow = "auto", }) => {
|
|
4
|
+
const Modal = ({ isOpen, onClose, title, subTitle, titleHtml = null, titleAlign = "left", children, footer, className = "", width, minHeight = 300, padding = "1rem", borderRadius = 6, backgroundColor = "var(--modal-bg)", paddingBottom = "1rem", paddingLeft = "1rem", paddingRight = "1rem", paddingTop = "1rem", contentHeight = "calc(100vh - 180)", overlayClose = false, alignItems, justifyContent, modalContentClass, modalBodyClass, bodyOverflow = "auto", }) => {
|
|
5
5
|
const [removelHeight, setRemovalHeight] = useState(0);
|
|
6
6
|
const footerRef = useRef(null);
|
|
7
7
|
useEffect(() => {
|
|
@@ -55,15 +55,15 @@ const Modal = ({ isOpen, onClose, title, subTitle, titleAlign = "left", children
|
|
|
55
55
|
justifyContent,
|
|
56
56
|
backgroundColor: "rgba(0, 0, 0, 0.5)",
|
|
57
57
|
zIndex: 1050,
|
|
58
|
-
}, onClick: () => overlayClose && onClose(), children: _jsxs("div", { style: modalContentStyle, className: `${modalContentClass} flex flex-col`, onClick: (e) => e.stopPropagation(), children: [
|
|
58
|
+
}, onClick: () => overlayClose && onClose(), children: _jsxs("div", { style: modalContentStyle, className: `${modalContentClass} flex flex-col`, onClick: (e) => e.stopPropagation(), children: [_jsxs("div", { style: {
|
|
59
59
|
marginBottom: 0,
|
|
60
60
|
paddingLeft: modalContentStyle.paddingLeft === 0 ? "1rem" : 0,
|
|
61
61
|
paddingRight: modalContentStyle.paddingRight === 0 ? "1rem" : 0,
|
|
62
62
|
paddingBottom: "1rem",
|
|
63
63
|
display: "flex",
|
|
64
64
|
alignItems: "center",
|
|
65
|
-
justifyContent: "space-between"
|
|
66
|
-
}, children: [_jsxs("div", { style: { textAlign: titleAlign }, children: [_jsx("h4", { style: { fontSize: "1.25rem" }, children: title }), _jsx("p", { style: { margin: 0 }, children: subTitle })] }), _jsx("button", { type: "button", "aria-label": "Close", style: {
|
|
65
|
+
justifyContent: "space-between",
|
|
66
|
+
}, children: [title && (_jsxs("div", { style: { textAlign: titleAlign }, children: [_jsx("h4", { style: { fontSize: "1.25rem" }, children: title }), _jsx("p", { style: { margin: 0 }, children: subTitle })] })), titleHtml, _jsx("button", { type: "button", "aria-label": "Close", style: {
|
|
67
67
|
background: "transparent",
|
|
68
68
|
border: "none",
|
|
69
69
|
cursor: "pointer",
|
|
@@ -71,7 +71,7 @@ const Modal = ({ isOpen, onClose, title, subTitle, titleAlign = "left", children
|
|
|
71
71
|
alignItems: "center",
|
|
72
72
|
justifyContent: "center",
|
|
73
73
|
padding: 4,
|
|
74
|
-
}, onClick: onClose, children: _jsx(MdClose, { size: 18 }) })] })
|
|
74
|
+
}, onClick: onClose, children: _jsx(MdClose, { size: 18 }) })] }), _jsx("div", { className: `${modalBodyClass} flex-grow overflow-auto`, style: {
|
|
75
75
|
overflowY: bodyOverflow,
|
|
76
76
|
}, children: children }), footer && (_jsx("div", { ref: footerRef, style: { marginTop: "auto", paddingTop: "1rem" }, children: footer }))] }) }));
|
|
77
77
|
};
|
package/package.json
CHANGED