dry-ux 1.69.0 → 1.70.0
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/styles/modal.css
CHANGED
|
@@ -59,6 +59,16 @@
|
|
|
59
59
|
left: 50%!important;
|
|
60
60
|
}
|
|
61
61
|
|
|
62
|
+
.dry-ux-modal-backdrop {
|
|
63
|
+
position: fixed!important;
|
|
64
|
+
top: 0!important;
|
|
65
|
+
left: 0!important;
|
|
66
|
+
width: 100vw!important;
|
|
67
|
+
height: 100vh!important;
|
|
68
|
+
z-index: 1040!important;
|
|
69
|
+
opacity: 0.5!important;
|
|
70
|
+
}
|
|
71
|
+
|
|
62
72
|
@media only screen and (max-width: 767px) {
|
|
63
73
|
.dry-ux-overlay-content {
|
|
64
74
|
width: 90%;
|
package/dist/ui-utils/Modal.d.ts
CHANGED
|
@@ -9,7 +9,6 @@ export type ModalProps = {
|
|
|
9
9
|
[selector: string]: React.CSSProperties;
|
|
10
10
|
};
|
|
11
11
|
defaultModalStyles?: boolean;
|
|
12
|
-
setBackdropHeight?: boolean;
|
|
13
12
|
centered?: boolean;
|
|
14
13
|
onOpen?: (modal: Pick<PopUpOptions, "title" | "trackingId">) => void;
|
|
15
14
|
onClose?: (modal: Pick<PopUpOptions, "title" | "trackingId">) => void;
|
package/dist/ui-utils/Modal.js
CHANGED
|
@@ -5,19 +5,12 @@ const react_bootstrap_1 = require("react-bootstrap");
|
|
|
5
5
|
require("../styles/modal.css");
|
|
6
6
|
const classSet_1 = require("../helpers/classSet");
|
|
7
7
|
const ActionsOverlay_1 = require("./ActionsOverlay");
|
|
8
|
-
const
|
|
9
|
-
const Modal = ({ id, instance: { handleClose, toggleOverlay, shown, overlay, options: { content, footerContent, cssClass = "", closeBtn, title, width, onClose, titleCloseBtn = true, centered, trackingId, actions = [], }, }, config: { defaultModalStyles = false, styles = {}, setBackdropHeight = true, centered: globalCentered, onOpen, onClose: globalOnClose, }, }) => {
|
|
8
|
+
const Modal = ({ id, instance: { handleClose, toggleOverlay, shown, overlay, options: { content, footerContent, cssClass = "", closeBtn, title, width, onClose, titleCloseBtn = true, centered, trackingId, actions = [], }, }, config: { defaultModalStyles = false, styles = {}, centered: globalCentered, onOpen, onClose: globalOnClose }, }) => {
|
|
10
9
|
const isCentered = centered !== null && centered !== void 0 ? centered : globalCentered;
|
|
11
|
-
const { height: documentHeight } = (0, utilities_1.useDimensions)();
|
|
12
10
|
const applyStyles = React.useCallback(() => {
|
|
13
11
|
document.querySelectorAll(".modal-dialog").forEach((el) => {
|
|
14
12
|
el.style.width = typeof width == "number" ? `${width}px` : width;
|
|
15
13
|
});
|
|
16
|
-
if (setBackdropHeight) {
|
|
17
|
-
document
|
|
18
|
-
.querySelectorAll(".modal-backdrop")
|
|
19
|
-
.forEach((el) => (el.style.height = `${document.documentElement.clientHeight}px`));
|
|
20
|
-
}
|
|
21
14
|
Object.keys(styles).forEach(selector => {
|
|
22
15
|
document.querySelectorAll(selector).forEach((el) => {
|
|
23
16
|
Object.keys(styles[selector]).forEach(style => {
|
|
@@ -25,7 +18,7 @@ const Modal = ({ id, instance: { handleClose, toggleOverlay, shown, overlay, opt
|
|
|
25
18
|
});
|
|
26
19
|
});
|
|
27
20
|
});
|
|
28
|
-
}, [width, styles
|
|
21
|
+
}, [width, styles]);
|
|
29
22
|
React.useEffect(() => {
|
|
30
23
|
if (shown) {
|
|
31
24
|
applyStyles();
|
|
@@ -35,13 +28,6 @@ const Modal = ({ id, instance: { handleClose, toggleOverlay, shown, overlay, opt
|
|
|
35
28
|
globalOnClose === null || globalOnClose === void 0 ? void 0 : globalOnClose({ title, trackingId });
|
|
36
29
|
}
|
|
37
30
|
}, [shown, width, defaultModalStyles]);
|
|
38
|
-
React.useEffect(() => {
|
|
39
|
-
if (setBackdropHeight) {
|
|
40
|
-
document
|
|
41
|
-
.querySelectorAll(".modal-backdrop")
|
|
42
|
-
.forEach((el) => (el.style.height = `${documentHeight}px`));
|
|
43
|
-
}
|
|
44
|
-
}, [documentHeight, setBackdropHeight]);
|
|
45
31
|
const onHide = () => {
|
|
46
32
|
handleClose(id, false, true);
|
|
47
33
|
onClose && onClose();
|
|
@@ -75,7 +61,7 @@ const Modal = ({ id, instance: { handleClose, toggleOverlay, shown, overlay, opt
|
|
|
75
61
|
}
|
|
76
62
|
} }, content)));
|
|
77
63
|
}, [actions, toggleOverlay, onHide, closeBtn]);
|
|
78
|
-
return (React.createElement(react_bootstrap_1.Modal, { onHide: onHide, show: shown, animation: true, autoFocus: true, keyboard: false, className: modalCssClass,
|
|
64
|
+
return (React.createElement(react_bootstrap_1.Modal, { onHide: onHide, show: shown, animation: true, autoFocus: true, keyboard: false, className: modalCssClass, backdropClassName: "dry-ux-modal-backdrop", backdrop: "static" },
|
|
79
65
|
overlay && (React.createElement("div", { className: "dry-ux-overlay" },
|
|
80
66
|
React.createElement("div", { className: "dry-ux-overlay-content" }, overlay))),
|
|
81
67
|
!!title && (React.createElement(react_bootstrap_1.Modal.Header, { closeButton: titleCloseBtn, onHide: onHide },
|
|
@@ -174,8 +174,8 @@ class UIUtilProvider extends React.PureComponent {
|
|
|
174
174
|
}
|
|
175
175
|
render() {
|
|
176
176
|
return (React.createElement(exports.UIUtilContext.Provider, { value: this.state },
|
|
177
|
-
this.props.
|
|
178
|
-
this.props.
|
|
177
|
+
this.props.children,
|
|
178
|
+
this.props.viewportDetect && React.createElement(ViewportDetect_1.ViewportDetect, { onChange: viewport => this.setState({ viewport }) })));
|
|
179
179
|
}
|
|
180
180
|
}
|
|
181
181
|
exports.UIUtilProvider = UIUtilProvider;
|