@arkyn/components 1.3.138 → 1.3.140
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/bundle.js +1294 -1300
- package/dist/bundle.umd.cjs +42 -42
- package/dist/components/Toast/index.d.ts.map +1 -1
- package/dist/components/Toast/index.js +4 -8
- package/dist/hooks/useAutomation.d.ts.map +1 -1
- package/dist/hooks/useAutomation.js +2 -9
- package/dist/provider/ToastProvider.d.ts.map +1 -1
- package/dist/provider/ToastProvider.js +7 -9
- package/package.json +1 -1
- package/src/components/Toast/index.tsx +4 -8
- package/src/hooks/useAutomation.ts +2 -9
- package/src/provider/ToastProvider.tsx +10 -9
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Toast/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAG1C,OAAO,cAAc,CAAC;AAEtB,iBAAS,KAAK,CAAC,KAAK,EAAE,UAAU,
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Toast/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAG1C,OAAO,cAAc,CAAC;AAEtB,iBAAS,KAAK,CAAC,KAAK,EAAE,UAAU,2CA4B/B;AAED,OAAO,EAAE,KAAK,EAAE,CAAC"}
|
@@ -1,23 +1,19 @@
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
2
|
-
import {
|
2
|
+
import { CheckCircle2, Info, XCircle } from "lucide-react";
|
3
3
|
import "./styles.css";
|
4
4
|
function Toast(props) {
|
5
|
-
const { message,
|
6
|
-
const className = `arkynToast ${type}
|
5
|
+
const { message, type } = props;
|
6
|
+
const className = `arkynToast ${type}}`;
|
7
7
|
function Icon() {
|
8
8
|
switch (type) {
|
9
|
-
case "info":
|
10
|
-
return _jsx(Info, {});
|
11
9
|
case "success":
|
12
10
|
return _jsx(CheckCircle2, {});
|
13
11
|
case "danger":
|
14
12
|
return _jsx(XCircle, {});
|
15
|
-
case "warning":
|
16
|
-
return _jsx(AlertCircle, {});
|
17
13
|
default:
|
18
14
|
return _jsx(Info, {});
|
19
15
|
}
|
20
16
|
}
|
21
|
-
return (_jsxs("div", { className: className, children: [_jsxs("div", { children: [_jsx("div", { className: "bg" }), _jsx(Icon, {})] }),
|
17
|
+
return (_jsxs("div", { className: className, children: [_jsxs("div", { children: [_jsx("div", { className: "bg" }), _jsx(Icon, {})] }), _jsx("p", { children: _jsx("span", { children: message }) })] }));
|
22
18
|
}
|
23
19
|
export { Toast };
|
@@ -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":"AAmBA,iBAAS,aAAa,SAuCrB;AAED,OAAO,EAAE,aAAa,EAAE,CAAC"}
|
@@ -9,10 +9,7 @@ function isToastProps(obj) {
|
|
9
9
|
typeof obj.title === "string" &&
|
10
10
|
typeof obj.message === "string" &&
|
11
11
|
(obj.size === undefined || obj.size === "md" || obj.size === "lg") &&
|
12
|
-
(obj.type === "
|
13
|
-
obj.type === "success" ||
|
14
|
-
obj.type === "danger" ||
|
15
|
-
obj.type === "warning"));
|
12
|
+
(obj.type === "success" || obj.type === "danger"));
|
16
13
|
}
|
17
14
|
function useAutomation() {
|
18
15
|
const actionData = useActionData();
|
@@ -39,11 +36,7 @@ function useAutomation() {
|
|
39
36
|
if (isToastProps(existsToast))
|
40
37
|
showToast(existsToast);
|
41
38
|
if (!isToastProps(existsToast) && existsMessage) {
|
42
|
-
showToast({
|
43
|
-
message: existsMessage,
|
44
|
-
title: "Atenção!",
|
45
|
-
type: "warning",
|
46
|
-
});
|
39
|
+
showToast({ message: existsMessage, type: "danger" });
|
47
40
|
}
|
48
41
|
}, [actionData]);
|
49
42
|
useEffect(() => {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"ToastProvider.d.ts","sourceRoot":"","sources":["../../src/provider/ToastProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAc,kBAAkB,EAAE,MAAM,cAAc,CAAC;
|
1
|
+
{"version":3,"file":"ToastProvider.d.ts","sourceRoot":"","sources":["../../src/provider/ToastProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAc,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAK9D,iBAAS,aAAa,CAAC,EAAE,QAAQ,EAAE,EAAE,kBAAkB,2CAmBtD;AAED,OAAO,EAAE,aAAa,EAAE,CAAC"}
|
@@ -1,17 +1,15 @@
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
2
2
|
import toast, { Toaster } from "react-hot-toast";
|
3
3
|
import { ToastContext } from "../context/ToastContext";
|
4
|
-
import { Toast } from "../components/Toast";
|
5
4
|
function ToastProvider({ children }) {
|
6
5
|
function showToast(props) {
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
});
|
6
|
+
switch (props.type) {
|
7
|
+
case "success":
|
8
|
+
return toast.success(props.message);
|
9
|
+
case "danger":
|
10
|
+
return toast.error(props.message);
|
11
|
+
}
|
14
12
|
}
|
15
|
-
return (_jsxs(ToastContext.Provider, { value: { showToast }, children: [_jsx(Toaster, { position: "top-right" }), children] }));
|
13
|
+
return (_jsxs(ToastContext.Provider, { value: { showToast }, children: [_jsx(Toaster, { position: "top-right", containerStyle: { zIndex: 999999999999999 } }), children] }));
|
16
14
|
}
|
17
15
|
export { ToastProvider };
|
package/package.json
CHANGED
@@ -1,23 +1,19 @@
|
|
1
1
|
import { ToastProps } from "@arkyn/types";
|
2
|
-
import {
|
2
|
+
import { CheckCircle2, Info, XCircle } from "lucide-react";
|
3
3
|
|
4
4
|
import "./styles.css";
|
5
5
|
|
6
6
|
function Toast(props: ToastProps) {
|
7
|
-
const { message,
|
7
|
+
const { message, type } = props;
|
8
8
|
|
9
|
-
const className = `arkynToast ${type}
|
9
|
+
const className = `arkynToast ${type}}`;
|
10
10
|
|
11
11
|
function Icon() {
|
12
12
|
switch (type) {
|
13
|
-
case "info":
|
14
|
-
return <Info />;
|
15
13
|
case "success":
|
16
14
|
return <CheckCircle2 />;
|
17
15
|
case "danger":
|
18
16
|
return <XCircle />;
|
19
|
-
case "warning":
|
20
|
-
return <AlertCircle />;
|
21
17
|
default:
|
22
18
|
return <Info />;
|
23
19
|
}
|
@@ -30,7 +26,7 @@ function Toast(props: ToastProps) {
|
|
30
26
|
<Icon />
|
31
27
|
</div>
|
32
28
|
<p>
|
33
|
-
<strong title={title}>{title}</strong>
|
29
|
+
{/* <strong title={title}>{title}</strong> */}
|
34
30
|
<span>{message}</span>
|
35
31
|
</p>
|
36
32
|
</div>
|
@@ -13,10 +13,7 @@ function isToastProps(obj: any): obj is ToastProps {
|
|
13
13
|
typeof obj.title === "string" &&
|
14
14
|
typeof obj.message === "string" &&
|
15
15
|
(obj.size === undefined || obj.size === "md" || obj.size === "lg") &&
|
16
|
-
(obj.type === "
|
17
|
-
obj.type === "success" ||
|
18
|
-
obj.type === "danger" ||
|
19
|
-
obj.type === "warning")
|
16
|
+
(obj.type === "success" || obj.type === "danger")
|
20
17
|
);
|
21
18
|
}
|
22
19
|
|
@@ -49,11 +46,7 @@ function useAutomation() {
|
|
49
46
|
|
50
47
|
if (isToastProps(existsToast)) showToast(existsToast);
|
51
48
|
if (!isToastProps(existsToast) && existsMessage) {
|
52
|
-
showToast({
|
53
|
-
message: existsMessage,
|
54
|
-
title: "Atenção!",
|
55
|
-
type: "warning",
|
56
|
-
});
|
49
|
+
showToast({ message: existsMessage, type: "danger" });
|
57
50
|
}
|
58
51
|
}, [actionData]);
|
59
52
|
|
@@ -2,22 +2,23 @@ import { ToastProps, ToastProviderProps } from "@arkyn/types";
|
|
2
2
|
import toast, { Toaster } from "react-hot-toast";
|
3
3
|
|
4
4
|
import { ToastContext } from "../context/ToastContext";
|
5
|
-
import { Toast } from "../components/Toast";
|
6
5
|
|
7
6
|
function ToastProvider({ children }: ToastProviderProps) {
|
8
7
|
function showToast(props: ToastProps) {
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
});
|
8
|
+
switch (props.type) {
|
9
|
+
case "success":
|
10
|
+
return toast.success(props.message);
|
11
|
+
case "danger":
|
12
|
+
return toast.error(props.message);
|
13
|
+
}
|
16
14
|
}
|
17
15
|
|
18
16
|
return (
|
19
17
|
<ToastContext.Provider value={{ showToast }}>
|
20
|
-
<Toaster
|
18
|
+
<Toaster
|
19
|
+
position="top-right"
|
20
|
+
containerStyle={{ zIndex: 999999999999999 }}
|
21
|
+
/>
|
21
22
|
{children}
|
22
23
|
</ToastContext.Provider>
|
23
24
|
);
|