dry-ux 1.56.0 → 1.58.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/ui-utils/Modal.d.ts
CHANGED
|
@@ -11,6 +11,8 @@ export interface IModalProps {
|
|
|
11
11
|
defaultModalStyles?: boolean;
|
|
12
12
|
setBackdropHeight?: boolean;
|
|
13
13
|
centered?: boolean;
|
|
14
|
+
onOpen?: (modal: Pick<PopUpOptions, "title" | "trackingId">) => void;
|
|
15
|
+
onClose?: (modal: Pick<PopUpOptions, "title" | "trackingId">) => void;
|
|
14
16
|
};
|
|
15
17
|
}
|
|
16
18
|
declare const Modal: React.FC<IModalProps & {
|
package/dist/ui-utils/Modal.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const React = require("react");
|
|
4
4
|
const react_bootstrap_1 = require("react-bootstrap");
|
|
5
|
-
const Modal = React.memo(({ handleClose, shown, options: { content, footerContent, cssClass, closeBtn, title, width, onClose, titleCloseBtn = true, centered }, config: { defaultModalStyles = false, styles = {}, setBackdropHeight = true, centered: globalCentered }, }) => {
|
|
5
|
+
const Modal = React.memo(({ handleClose, shown, options: { content, footerContent, cssClass, closeBtn, title, width, onClose, titleCloseBtn = true, centered, trackingId, }, config: { defaultModalStyles = false, styles = {}, setBackdropHeight = true, centered: globalCentered, onOpen, onClose: globalOnClose, }, }) => {
|
|
6
6
|
const isCentered = centered !== null && centered !== void 0 ? centered : globalCentered;
|
|
7
7
|
const applyStyles = React.useCallback(() => {
|
|
8
8
|
document.querySelectorAll(".modal-dialog").forEach((el) => {
|
|
@@ -38,6 +38,10 @@ const Modal = React.memo(({ handleClose, shown, options: { content, footerConten
|
|
|
38
38
|
React.useEffect(() => {
|
|
39
39
|
if (shown) {
|
|
40
40
|
applyStyles();
|
|
41
|
+
onOpen === null || onOpen === void 0 ? void 0 : onOpen({ title, trackingId });
|
|
42
|
+
}
|
|
43
|
+
else {
|
|
44
|
+
globalOnClose === null || globalOnClose === void 0 ? void 0 : globalOnClose({ title, trackingId });
|
|
41
45
|
}
|
|
42
46
|
}, [shown, width, defaultModalStyles]);
|
|
43
47
|
const onHide = () => {
|
|
@@ -53,8 +53,12 @@ export type PopUpOptions = {
|
|
|
53
53
|
* If true, the modal will be centered vertically.
|
|
54
54
|
*/
|
|
55
55
|
centered?: boolean;
|
|
56
|
+
/**
|
|
57
|
+
* The tracking ID for the modal.
|
|
58
|
+
*/
|
|
59
|
+
trackingId?: string;
|
|
56
60
|
};
|
|
57
|
-
export type ButtonType = "primary" | "info" | "success" | "warning" | "danger";
|
|
61
|
+
export type ButtonType = "primary" | "secondary" | "info" | "success" | "warning" | "danger";
|
|
58
62
|
export type PopUpAction = {
|
|
59
63
|
/**
|
|
60
64
|
* The content to display in the modal.
|