@trackunit/react-modal 0.0.96 → 0.0.97
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/index.cjs.js +3 -2
- package/index.esm.js +3 -2
- package/package.json +1 -1
- package/src/modal/useModal.d.ts +3 -2
package/index.cjs.js
CHANGED
|
@@ -163,11 +163,11 @@ Modal.displayName = "Modal";
|
|
|
163
163
|
|
|
164
164
|
/**
|
|
165
165
|
* The useModal component should be used to inform the user of important information.
|
|
166
|
-
|
|
166
|
+
|
|
167
167
|
* @param {UseModalProps} props - The props for the useModal hook
|
|
168
168
|
* @returns {*} useModal return
|
|
169
169
|
*/
|
|
170
|
-
const useModal = ({ closeOnOutsideClick } = {}) => {
|
|
170
|
+
const useModal = ({ closeOnOutsideClick, bindTo } = {}) => {
|
|
171
171
|
const modalRef = React.useRef(null);
|
|
172
172
|
const { isOpen, togglePortal, openPortal, closePortal, Portal } = usePortal({
|
|
173
173
|
closeOnOutsideClick,
|
|
@@ -182,6 +182,7 @@ const useModal = ({ closeOnOutsideClick } = {}) => {
|
|
|
182
182
|
closePortal();
|
|
183
183
|
}
|
|
184
184
|
},
|
|
185
|
+
bindTo,
|
|
185
186
|
});
|
|
186
187
|
const PortalWrapper = (props) => (jsxRuntime.jsx(Portal, { children: jsxRuntime.jsx(Modal, { isOpen: isOpen, ref: modalRef, ...props }) }));
|
|
187
188
|
PortalWrapper.displayName = "Modal";
|
package/index.esm.js
CHANGED
|
@@ -143,11 +143,11 @@ Modal.displayName = "Modal";
|
|
|
143
143
|
|
|
144
144
|
/**
|
|
145
145
|
* The useModal component should be used to inform the user of important information.
|
|
146
|
-
|
|
146
|
+
|
|
147
147
|
* @param {UseModalProps} props - The props for the useModal hook
|
|
148
148
|
* @returns {*} useModal return
|
|
149
149
|
*/
|
|
150
|
-
const useModal = ({ closeOnOutsideClick } = {}) => {
|
|
150
|
+
const useModal = ({ closeOnOutsideClick, bindTo } = {}) => {
|
|
151
151
|
const modalRef = useRef(null);
|
|
152
152
|
const { isOpen, togglePortal, openPortal, closePortal, Portal } = usePortal({
|
|
153
153
|
closeOnOutsideClick,
|
|
@@ -162,6 +162,7 @@ const useModal = ({ closeOnOutsideClick } = {}) => {
|
|
|
162
162
|
closePortal();
|
|
163
163
|
}
|
|
164
164
|
},
|
|
165
|
+
bindTo,
|
|
165
166
|
});
|
|
166
167
|
const PortalWrapper = (props) => (jsx(Portal, { children: jsx(Modal, { isOpen: isOpen, ref: modalRef, ...props }) }));
|
|
167
168
|
PortalWrapper.displayName = "Modal";
|
package/package.json
CHANGED
package/src/modal/useModal.d.ts
CHANGED
|
@@ -2,14 +2,15 @@ import { BaseSyntheticEvent } from "react";
|
|
|
2
2
|
import { ModalProps } from "./Modal";
|
|
3
3
|
export interface UseModalProps {
|
|
4
4
|
closeOnOutsideClick?: boolean;
|
|
5
|
+
bindTo?: HTMLElement;
|
|
5
6
|
}
|
|
6
7
|
/**
|
|
7
8
|
* The useModal component should be used to inform the user of important information.
|
|
8
|
-
|
|
9
|
+
|
|
9
10
|
* @param {UseModalProps} props - The props for the useModal hook
|
|
10
11
|
* @returns {*} useModal return
|
|
11
12
|
*/
|
|
12
|
-
export declare const useModal: ({ closeOnOutsideClick }?: UseModalProps) => {
|
|
13
|
+
export declare const useModal: ({ closeOnOutsideClick, bindTo }?: UseModalProps) => {
|
|
13
14
|
Modal: {
|
|
14
15
|
(props: ModalProps): import("react/jsx-runtime").JSX.Element;
|
|
15
16
|
displayName: string;
|