@trackunit/react-modal 0.0.5 → 0.0.7
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 +13 -4
- package/index.esm.js +13 -4
- package/package.json +1 -1
- package/src/modal/useModal.d.ts +5 -5
package/index.cjs.js
CHANGED
|
@@ -183,10 +183,19 @@ const useModal = ({ closeOnOutsideClick } = {}) => {
|
|
|
183
183
|
const WrappedModal = React.useCallback(PortalWrapper, [Portal, isOpen]);
|
|
184
184
|
return {
|
|
185
185
|
Modal: WrappedModal,
|
|
186
|
-
toggleModal:
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
186
|
+
toggleModal: (e) => {
|
|
187
|
+
togglePortal(e);
|
|
188
|
+
},
|
|
189
|
+
openModal: (e) => {
|
|
190
|
+
openPortal(e);
|
|
191
|
+
},
|
|
192
|
+
closeModal: (e) => {
|
|
193
|
+
e === null || e === void 0 ? void 0 : e.stopPropagation();
|
|
194
|
+
e === null || e === void 0 ? void 0 : e.preventDefault();
|
|
195
|
+
closePortal(e);
|
|
196
|
+
},
|
|
197
|
+
// eslint-disable-next-line local-rules/no-typescript-assertion
|
|
198
|
+
isOpen: isOpen,
|
|
190
199
|
};
|
|
191
200
|
};
|
|
192
201
|
|
package/index.esm.js
CHANGED
|
@@ -157,10 +157,19 @@ const useModal = ({ closeOnOutsideClick } = {}) => {
|
|
|
157
157
|
const WrappedModal = useCallback(PortalWrapper, [Portal, isOpen]);
|
|
158
158
|
return {
|
|
159
159
|
Modal: WrappedModal,
|
|
160
|
-
toggleModal:
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
160
|
+
toggleModal: (e) => {
|
|
161
|
+
togglePortal(e);
|
|
162
|
+
},
|
|
163
|
+
openModal: (e) => {
|
|
164
|
+
openPortal(e);
|
|
165
|
+
},
|
|
166
|
+
closeModal: (e) => {
|
|
167
|
+
e === null || e === void 0 ? void 0 : e.stopPropagation();
|
|
168
|
+
e === null || e === void 0 ? void 0 : e.preventDefault();
|
|
169
|
+
closePortal(e);
|
|
170
|
+
},
|
|
171
|
+
// eslint-disable-next-line local-rules/no-typescript-assertion
|
|
172
|
+
isOpen: isOpen,
|
|
164
173
|
};
|
|
165
174
|
};
|
|
166
175
|
|
package/package.json
CHANGED
package/src/modal/useModal.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
import { BaseSyntheticEvent } from "react";
|
|
2
2
|
import { ModalProps } from "./Modal";
|
|
3
3
|
export interface UseModalProps {
|
|
4
4
|
closeOnOutsideClick?: boolean;
|
|
@@ -14,8 +14,8 @@ export declare const useModal: ({ closeOnOutsideClick }?: UseModalProps) => {
|
|
|
14
14
|
(props: ModalProps): JSX.Element;
|
|
15
15
|
displayName: string;
|
|
16
16
|
};
|
|
17
|
-
toggleModal:
|
|
18
|
-
openModal:
|
|
19
|
-
closeModal:
|
|
20
|
-
isOpen:
|
|
17
|
+
toggleModal: (e?: BaseSyntheticEvent) => void;
|
|
18
|
+
openModal: (e?: BaseSyntheticEvent) => void;
|
|
19
|
+
closeModal: (e?: BaseSyntheticEvent) => void;
|
|
20
|
+
isOpen: boolean;
|
|
21
21
|
};
|