ag-common 0.0.670 → 0.0.671
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,2 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
export declare const ModalDialog: (content: JSX.Element
|
|
1
|
+
import type { CSSProperties } from 'react';
|
|
2
|
+
export declare const ModalDialog: (content: JSX.Element, opt?: {
|
|
3
|
+
style?: CSSProperties;
|
|
4
|
+
}) => Promise<string | undefined>;
|
|
@@ -16,7 +16,7 @@ exports.ModalDialog = void 0;
|
|
|
16
16
|
const react_1 = __importDefault(require("react"));
|
|
17
17
|
const client_1 = require("react-dom/client");
|
|
18
18
|
const Modal_1 = require("./Modal");
|
|
19
|
-
const ModalDialog = (content) => __awaiter(void 0, void 0, void 0, function* () {
|
|
19
|
+
const ModalDialog = (content, opt) => __awaiter(void 0, void 0, void 0, function* () {
|
|
20
20
|
return new Promise((res) => {
|
|
21
21
|
const wrapper = document.body.appendChild(document.createElement('div'));
|
|
22
22
|
const root = (0, client_1.createRoot)(wrapper);
|
|
@@ -26,7 +26,7 @@ const ModalDialog = (content) => __awaiter(void 0, void 0, void 0, function* ()
|
|
|
26
26
|
wrapper.remove();
|
|
27
27
|
}
|
|
28
28
|
res('ok');
|
|
29
|
-
}, topPosition: "center", position: "center" }, content));
|
|
29
|
+
}, topPosition: "center", position: "center", style: opt === null || opt === void 0 ? void 0 : opt.style }, content));
|
|
30
30
|
});
|
|
31
31
|
});
|
|
32
32
|
exports.ModalDialog = ModalDialog;
|
|
@@ -4,4 +4,4 @@ export declare const ModalItem: import("@emotion/styled").StyledComponent<{
|
|
|
4
4
|
theme?: import("@emotion/react").Theme | undefined;
|
|
5
5
|
as?: React.ElementType<any, keyof React.JSX.IntrinsicElements> | undefined;
|
|
6
6
|
}, React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
7
|
-
export declare const Modal: ({ open, setOpen, children, position, topPosition, showCloseButton, closeOnMoveMouseOutside, className, closeOnClickOutside, portalId, }: IModal) => React.JSX.Element | null;
|
|
7
|
+
export declare const Modal: ({ open, setOpen, children, position, topPosition, showCloseButton, closeOnMoveMouseOutside, className, closeOnClickOutside, portalId, style, }: IModal) => React.JSX.Element | null;
|
|
@@ -84,7 +84,7 @@ exports.ModalItem = styled_1.default.div `
|
|
|
84
84
|
const CloseStyled = (0, styled_1.default)(Close_1.Close) `
|
|
85
85
|
z-index: 1;
|
|
86
86
|
`;
|
|
87
|
-
const Modal = ({ open, setOpen, children, position = 'left', topPosition = 'top', showCloseButton = true, closeOnMoveMouseOutside = false, className, closeOnClickOutside = true, portalId, }) => {
|
|
87
|
+
const Modal = ({ open, setOpen, children, position = 'left', topPosition = 'top', showCloseButton = true, closeOnMoveMouseOutside = false, className, closeOnClickOutside = true, portalId, style, }) => {
|
|
88
88
|
const [elem, setElem] = (0, react_1.useState)();
|
|
89
89
|
(0, react_1.useEffect)(() => {
|
|
90
90
|
const originalStyle = window.getComputedStyle(document.body).overflow || '';
|
|
@@ -121,7 +121,7 @@ const Modal = ({ open, setOpen, children, position = 'left', topPosition = 'top'
|
|
|
121
121
|
return react_1.default.createElement(react_1.default.Fragment, null);
|
|
122
122
|
}
|
|
123
123
|
const Content = (react_1.default.createElement(FixedBackground, null,
|
|
124
|
-
react_1.default.createElement(ModalBase, { "data-bounced": bounced, "data-position": position, "data-topposition": topPosition, ref: ref, className: className },
|
|
124
|
+
react_1.default.createElement(ModalBase, { "data-bounced": bounced, "data-position": position, "data-topposition": topPosition, ref: ref, className: className, style: style },
|
|
125
125
|
showCloseButton && (react_1.default.createElement(CloseStyled, { "data-type": "modal-close", onClick: () => setOpen(false) })),
|
|
126
126
|
children)));
|
|
127
127
|
if (portalId && elem === undefined) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
import type { CSSProperties } from 'react';
|
|
2
2
|
export interface IModal {
|
|
3
3
|
open: boolean;
|
|
4
4
|
setOpen: (b: boolean) => void;
|
|
@@ -11,4 +11,6 @@ export interface IModal {
|
|
|
11
11
|
closeOnClickOutside?: boolean;
|
|
12
12
|
/** if provided, will create inside this #id */
|
|
13
13
|
portalId?: string;
|
|
14
|
+
/**applied to modal inside fixed */
|
|
15
|
+
style?: CSSProperties;
|
|
14
16
|
}
|
package/package.json
CHANGED