@arkyn/components 1.3.125 → 1.3.126
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 +1948 -1925
- package/dist/bundle.umd.cjs +51 -51
- package/dist/provider/ToastProvider.d.ts.map +1 -1
- package/dist/provider/ToastProvider.js +26 -4
- package/package.json +1 -1
- package/src/provider/ToastProvider.tsx +26 -3
@@ -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;AAM9D,iBAAS,aAAa,CAAC,EAAE,QAAQ,EAAE,EAAE,kBAAkB,
|
1
|
+
{"version":3,"file":"ToastProvider.d.ts","sourceRoot":"","sources":["../../src/provider/ToastProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAc,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAM9D,iBAAS,aAAa,CAAC,EAAE,QAAQ,EAAE,EAAE,kBAAkB,2CAkCtD;AAED,OAAO,EAAE,aAAa,EAAE,CAAC"}
|
@@ -1,11 +1,33 @@
|
|
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
|
-
function showToast(
|
7
|
-
|
5
|
+
function showToast({ message, title, type, size }) {
|
6
|
+
switch (type) {
|
7
|
+
case "success":
|
8
|
+
toast.success(message, {
|
9
|
+
style: {
|
10
|
+
border: "1px solid rgba(var(--toast-success), 1)",
|
11
|
+
background: "rgba(var(--toast-success), 0.2)",
|
12
|
+
color: "var(--text-heading)",
|
13
|
+
},
|
14
|
+
iconTheme: {
|
15
|
+
primary: "rgba(var(--toast-success), 1)",
|
16
|
+
secondary: "#fff",
|
17
|
+
},
|
18
|
+
});
|
19
|
+
break;
|
20
|
+
case "danger":
|
21
|
+
toast.error(message);
|
22
|
+
break;
|
23
|
+
case "info":
|
24
|
+
toast(message);
|
25
|
+
break;
|
26
|
+
case "warning":
|
27
|
+
toast(message);
|
28
|
+
break;
|
29
|
+
}
|
8
30
|
}
|
9
|
-
return (_jsxs(ToastContext.Provider, { value: { showToast }, children: [_jsx(Toaster, {}), children] }));
|
31
|
+
return (_jsxs(ToastContext.Provider, { value: { showToast }, children: [_jsx(Toaster, { position: "bottom-right" }), children] }));
|
10
32
|
}
|
11
33
|
export { ToastProvider };
|
package/package.json
CHANGED
@@ -5,13 +5,36 @@ import { ToastContext } from "../context/ToastContext";
|
|
5
5
|
import { Toast } from "../components/Toast";
|
6
6
|
|
7
7
|
function ToastProvider({ children }: ToastProviderProps) {
|
8
|
-
function showToast(
|
9
|
-
|
8
|
+
function showToast({ message, title, type, size }: ToastProps) {
|
9
|
+
switch (type) {
|
10
|
+
case "success":
|
11
|
+
toast.success(message, {
|
12
|
+
style: {
|
13
|
+
border: "1px solid rgba(var(--toast-success), 1)",
|
14
|
+
background: "rgba(var(--toast-success), 0.2)",
|
15
|
+
color: "var(--text-heading)",
|
16
|
+
},
|
17
|
+
iconTheme: {
|
18
|
+
primary: "rgba(var(--toast-success), 1)",
|
19
|
+
secondary: "#fff",
|
20
|
+
},
|
21
|
+
});
|
22
|
+
break;
|
23
|
+
case "danger":
|
24
|
+
toast.error(message);
|
25
|
+
break;
|
26
|
+
case "info":
|
27
|
+
toast(message);
|
28
|
+
break;
|
29
|
+
case "warning":
|
30
|
+
toast(message);
|
31
|
+
break;
|
32
|
+
}
|
10
33
|
}
|
11
34
|
|
12
35
|
return (
|
13
36
|
<ToastContext.Provider value={{ showToast }}>
|
14
|
-
<Toaster />
|
37
|
+
<Toaster position="bottom-right" />
|
15
38
|
{children}
|
16
39
|
</ToastContext.Provider>
|
17
40
|
);
|