jcicl 1.0.36 → 1.0.37
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/Toast/ToastHelpers.d.ts +1 -1
- package/Toast/ToastHelpers.js +16 -16
- package/Toast/Toaster.d.ts +2 -2
- package/Toast/useRedirectToast.d.ts +1 -1
- package/Toast/useToast.d.ts +1 -1
- package/package.json +1 -1
package/Toast/ToastHelpers.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ToastItem } from '../../../../../../../../../src/components/composite/Toast/Toaster';
|
|
2
2
|
import { ToastProps } from '../../../../../../../../../src/components/composite/Toast/Toast';
|
|
3
|
-
export declare const handleDismissToast: (id:
|
|
3
|
+
export declare const handleDismissToast: (id: string, setToasts: React.Dispatch<React.SetStateAction<ToastItem[]>>) => void;
|
|
4
4
|
export declare const showToast: (toast: ToastProps, setToasts: React.Dispatch<React.SetStateAction<ToastItem[]>>) => void;
|
|
5
5
|
export declare const saveToastForRedirect: (toast: ToastProps) => void;
|
|
6
6
|
export declare const showSavedToast: (setToasts: React.Dispatch<React.SetStateAction<ToastItem[]>>) => void;
|
package/Toast/ToastHelpers.js
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
const a = (
|
|
2
|
-
|
|
3
|
-
}, n = (
|
|
4
|
-
const e =
|
|
5
|
-
|
|
6
|
-
}, r = (
|
|
7
|
-
const
|
|
8
|
-
type:
|
|
9
|
-
message:
|
|
10
|
-
duration: String(
|
|
1
|
+
const a = (t, s) => {
|
|
2
|
+
s((e) => e.filter((o) => o.id !== t));
|
|
3
|
+
}, n = (t, s) => {
|
|
4
|
+
const e = crypto.randomUUID();
|
|
5
|
+
s((o) => [...o, { ...t, id: e }]);
|
|
6
|
+
}, r = (t) => {
|
|
7
|
+
const s = {
|
|
8
|
+
type: t.type ?? "warning",
|
|
9
|
+
message: t.message ?? "Action complete",
|
|
10
|
+
duration: String(t.duration ?? 3e3)
|
|
11
11
|
};
|
|
12
|
-
sessionStorage.setItem("savedToast", JSON.stringify(
|
|
13
|
-
}, i = (
|
|
14
|
-
const
|
|
15
|
-
if (
|
|
12
|
+
sessionStorage.setItem("savedToast", JSON.stringify(s));
|
|
13
|
+
}, i = (t) => {
|
|
14
|
+
const s = JSON.parse(sessionStorage.getItem("savedToast") || "{}");
|
|
15
|
+
if (s.type !== "success" && s.type !== "warning" && s.type !== "error")
|
|
16
16
|
return;
|
|
17
|
-
const e =
|
|
18
|
-
|
|
17
|
+
const e = crypto.randomUUID();
|
|
18
|
+
t((o) => [...o, { ...s, id: e }]), sessionStorage.removeItem("savedToast");
|
|
19
19
|
};
|
|
20
20
|
export {
|
|
21
21
|
a as handleDismissToast,
|
package/Toast/Toaster.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { ToastProps } from './Toast';
|
|
2
2
|
export type ToastItem = ToastProps & {
|
|
3
|
-
id:
|
|
3
|
+
id: string;
|
|
4
4
|
};
|
|
5
5
|
export type ToasterProps = {
|
|
6
6
|
toastQueue: ToastItem[];
|
|
7
|
-
onDismiss?: (id:
|
|
7
|
+
onDismiss?: (id: string) => void;
|
|
8
8
|
};
|
|
9
9
|
export declare const Toaster: React.FC<ToasterProps>;
|
package/Toast/useToast.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "jcicl",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.37",
|
|
5
5
|
"description": "Component library for the websites of Johnson County Iowa",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"homepage": "https://devops.jc.net/JCIT/Business%20Solutions%20Delivery/_git/JCComponentLibrary?path=%2FREADME.md&version=GBmaster",
|