@arkyn/components 1.3.126 → 1.3.127
Sign up to get free protection for your applications and to get access to all the features.
@@ -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,2CAsEtD;AAED,OAAO,EAAE,aAAa,EAAE,CAAC"}
|
@@ -2,11 +2,12 @@ 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
4
|
function ToastProvider({ children }) {
|
5
|
-
function showToast({ message,
|
5
|
+
function showToast({ message, type, size }) {
|
6
6
|
switch (type) {
|
7
7
|
case "success":
|
8
8
|
toast.success(message, {
|
9
9
|
style: {
|
10
|
+
padding: "8px 16px",
|
10
11
|
border: "1px solid rgba(var(--toast-success), 1)",
|
11
12
|
background: "rgba(var(--toast-success), 0.2)",
|
12
13
|
color: "var(--text-heading)",
|
@@ -18,13 +19,48 @@ function ToastProvider({ children }) {
|
|
18
19
|
});
|
19
20
|
break;
|
20
21
|
case "danger":
|
21
|
-
toast.error(message
|
22
|
+
toast.error(message, {
|
23
|
+
style: {
|
24
|
+
padding: "8px 16px",
|
25
|
+
border: "1px solid rgba(var(--toast-danger), 1)",
|
26
|
+
background: "rgba(var(--toast-danger), 0.2)",
|
27
|
+
color: "var(--text-heading)",
|
28
|
+
},
|
29
|
+
iconTheme: {
|
30
|
+
primary: "rgba(var(--toast-danger), 1)",
|
31
|
+
secondary: "#fff",
|
32
|
+
},
|
33
|
+
});
|
22
34
|
break;
|
23
35
|
case "info":
|
24
|
-
toast(message
|
36
|
+
toast(message, {
|
37
|
+
icon: "ℹ️",
|
38
|
+
style: {
|
39
|
+
padding: "8px 16px",
|
40
|
+
border: "1px solid rgba(var(--toast-info), 1)",
|
41
|
+
background: "rgba(var(--toast-info), 0.2)",
|
42
|
+
color: "var(--text-heading)",
|
43
|
+
},
|
44
|
+
iconTheme: {
|
45
|
+
primary: "rgba(var(--toast-info), 1)",
|
46
|
+
secondary: "#fff",
|
47
|
+
},
|
48
|
+
});
|
25
49
|
break;
|
26
50
|
case "warning":
|
27
|
-
toast(message
|
51
|
+
toast(message, {
|
52
|
+
icon: "⚠️",
|
53
|
+
style: {
|
54
|
+
padding: "8px 16px",
|
55
|
+
border: "1px solid rgba(var(--toast-warning), 1)",
|
56
|
+
background: "rgba(var(--toast-warning), 0.2)",
|
57
|
+
color: "var(--text-heading)",
|
58
|
+
},
|
59
|
+
iconTheme: {
|
60
|
+
primary: "rgba(var(--toast-warning), 1)",
|
61
|
+
secondary: "#fff",
|
62
|
+
},
|
63
|
+
});
|
28
64
|
break;
|
29
65
|
}
|
30
66
|
}
|
package/package.json
CHANGED
@@ -2,14 +2,14 @@ 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
|
-
function showToast({ message,
|
7
|
+
function showToast({ message, type, size }: ToastProps) {
|
9
8
|
switch (type) {
|
10
9
|
case "success":
|
11
10
|
toast.success(message, {
|
12
11
|
style: {
|
12
|
+
padding: "8px 16px",
|
13
13
|
border: "1px solid rgba(var(--toast-success), 1)",
|
14
14
|
background: "rgba(var(--toast-success), 0.2)",
|
15
15
|
color: "var(--text-heading)",
|
@@ -21,13 +21,48 @@ function ToastProvider({ children }: ToastProviderProps) {
|
|
21
21
|
});
|
22
22
|
break;
|
23
23
|
case "danger":
|
24
|
-
toast.error(message
|
24
|
+
toast.error(message, {
|
25
|
+
style: {
|
26
|
+
padding: "8px 16px",
|
27
|
+
border: "1px solid rgba(var(--toast-danger), 1)",
|
28
|
+
background: "rgba(var(--toast-danger), 0.2)",
|
29
|
+
color: "var(--text-heading)",
|
30
|
+
},
|
31
|
+
iconTheme: {
|
32
|
+
primary: "rgba(var(--toast-danger), 1)",
|
33
|
+
secondary: "#fff",
|
34
|
+
},
|
35
|
+
});
|
25
36
|
break;
|
26
37
|
case "info":
|
27
|
-
toast(message
|
38
|
+
toast(message, {
|
39
|
+
icon: "ℹ️",
|
40
|
+
style: {
|
41
|
+
padding: "8px 16px",
|
42
|
+
border: "1px solid rgba(var(--toast-info), 1)",
|
43
|
+
background: "rgba(var(--toast-info), 0.2)",
|
44
|
+
color: "var(--text-heading)",
|
45
|
+
},
|
46
|
+
iconTheme: {
|
47
|
+
primary: "rgba(var(--toast-info), 1)",
|
48
|
+
secondary: "#fff",
|
49
|
+
},
|
50
|
+
});
|
28
51
|
break;
|
29
52
|
case "warning":
|
30
|
-
toast(message
|
53
|
+
toast(message, {
|
54
|
+
icon: "⚠️",
|
55
|
+
style: {
|
56
|
+
padding: "8px 16px",
|
57
|
+
border: "1px solid rgba(var(--toast-warning), 1)",
|
58
|
+
background: "rgba(var(--toast-warning), 0.2)",
|
59
|
+
color: "var(--text-heading)",
|
60
|
+
},
|
61
|
+
iconTheme: {
|
62
|
+
primary: "rgba(var(--toast-warning), 1)",
|
63
|
+
secondary: "#fff",
|
64
|
+
},
|
65
|
+
});
|
31
66
|
break;
|
32
67
|
}
|
33
68
|
}
|