@arkyn/components 1.4.15 → 1.4.16
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/bundle.js +35651 -23977
- package/dist/bundle.umd.cjs +646 -386
- package/dist/hooks/useAutomation.d.ts.map +1 -1
- package/dist/hooks/useAutomation.js +9 -2
- package/package.json +1 -1
- package/src/hooks/useAutomation.ts +16 -2
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"useAutomation.d.ts","sourceRoot":"","sources":["../../src/hooks/useAutomation.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"useAutomation.d.ts","sourceRoot":"","sources":["../../src/hooks/useAutomation.ts"],"names":[],"mappings":"AAwBA,iBAAS,aAAa,SAqDrB;AAED,OAAO,EAAE,aAAa,EAAE,CAAC"}
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { useActionData, useLocation, useNavigate } from "@remix-run/react";
|
1
|
+
import { useActionData, useFetchers, useLocation, useNavigate, } from "@remix-run/react";
|
2
2
|
import { useContext, useEffect } from "react";
|
3
3
|
import { animateScroll } from "react-scroll";
|
4
4
|
import { ModalContext } from "../context/ModalContext";
|
@@ -13,12 +13,19 @@ function isToastProps(obj) {
|
|
13
13
|
}
|
14
14
|
function useAutomation() {
|
15
15
|
const actionData = useActionData();
|
16
|
-
const { closeModal, closeAll } = useContext(ModalContext);
|
16
|
+
const { closeModal, closeAll, modalIsOpen } = useContext(ModalContext);
|
17
17
|
const { showToast } = useToast();
|
18
18
|
const { getParam } = useScopedParams();
|
19
19
|
const { pathname } = useLocation();
|
20
20
|
const navigate = useNavigate();
|
21
21
|
const closeAllModals = getParam("closeAllModals");
|
22
|
+
const fetchers = useFetchers();
|
23
|
+
useEffect(() => {
|
24
|
+
const modalKey = fetchers[0]?.data?.closeModalKey || "";
|
25
|
+
const isOpen = modalIsOpen(modalKey);
|
26
|
+
if (modalKey && isOpen)
|
27
|
+
closeModal(modalKey);
|
28
|
+
}, [fetchers]);
|
22
29
|
useEffect(() => {
|
23
30
|
if (closeAllModals === "true") {
|
24
31
|
closeAll();
|
package/package.json
CHANGED
@@ -1,5 +1,10 @@
|
|
1
1
|
import { ToastProps } from "@arkyn/types";
|
2
|
-
import {
|
2
|
+
import {
|
3
|
+
useActionData,
|
4
|
+
useFetchers,
|
5
|
+
useLocation,
|
6
|
+
useNavigate,
|
7
|
+
} from "@remix-run/react";
|
3
8
|
import { useContext, useEffect } from "react";
|
4
9
|
import { animateScroll } from "react-scroll";
|
5
10
|
|
@@ -19,7 +24,7 @@ function isToastProps(obj: any): obj is ToastProps {
|
|
19
24
|
|
20
25
|
function useAutomation() {
|
21
26
|
const actionData = useActionData<any>();
|
22
|
-
const { closeModal, closeAll } = useContext(ModalContext);
|
27
|
+
const { closeModal, closeAll, modalIsOpen } = useContext(ModalContext);
|
23
28
|
const { showToast } = useToast();
|
24
29
|
|
25
30
|
const { getParam } = useScopedParams();
|
@@ -28,6 +33,15 @@ function useAutomation() {
|
|
28
33
|
|
29
34
|
const closeAllModals = getParam("closeAllModals");
|
30
35
|
|
36
|
+
const fetchers = useFetchers();
|
37
|
+
|
38
|
+
useEffect(() => {
|
39
|
+
const modalKey = fetchers[0]?.data?.closeModalKey || "";
|
40
|
+
const isOpen = modalIsOpen(modalKey);
|
41
|
+
|
42
|
+
if (modalKey && isOpen) closeModal(modalKey);
|
43
|
+
}, [fetchers]);
|
44
|
+
|
31
45
|
useEffect(() => {
|
32
46
|
if (closeAllModals === "true") {
|
33
47
|
closeAll();
|