mimir-ui-kit 1.67.0 → 1.67.2
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.
|
@@ -1,3 +1,9 @@
|
|
|
1
1
|
import { PropsWithChildren } from 'react';
|
|
2
|
+
import { TProps as TToastProps } from './Toast';
|
|
2
3
|
|
|
3
|
-
export
|
|
4
|
+
export type ToastProviderProps = PropsWithChildren<{
|
|
5
|
+
config?: {
|
|
6
|
+
onToastAdd?: (toast: Omit<TToastProps, 'id'>) => void;
|
|
7
|
+
};
|
|
8
|
+
}>;
|
|
9
|
+
export declare const ToastProvider: ({ children, config }: ToastProviderProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,14 +1,17 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { useReducer as
|
|
1
|
+
import { jsxs as E, jsx as T } from "react/jsx-runtime";
|
|
2
|
+
import { useReducer as l, useCallback as c, useMemo as L } from "react";
|
|
3
3
|
import { EToastVariant as o } from "./constants.js";
|
|
4
|
-
import { ToastContext as
|
|
5
|
-
import { reducer as
|
|
6
|
-
import { c as
|
|
7
|
-
import { ToastList as
|
|
8
|
-
const
|
|
9
|
-
const [
|
|
10
|
-
|
|
11
|
-
|
|
4
|
+
import { ToastContext as C } from "./hooks.js";
|
|
5
|
+
import { reducer as S, initialState as A, actionCreators as d } from "./store.js";
|
|
6
|
+
import { c as P } from "../../ProgressBar-BtLMbQrP.js";
|
|
7
|
+
import { ToastList as U } from "./ToastList.js";
|
|
8
|
+
const b = ({ children: R, config: v }) => {
|
|
9
|
+
const [r, n] = l(S, A), { onToastAdd: i } = v ?? {}, a = c(
|
|
10
|
+
(t) => {
|
|
11
|
+
n(d.setToasts(t)), i == null || i(t);
|
|
12
|
+
},
|
|
13
|
+
[i]
|
|
14
|
+
), p = L(
|
|
12
15
|
() => ({
|
|
13
16
|
[o.DEFAULT]: (t) => a({ variant: o.DEFAULT, ...t }),
|
|
14
17
|
[o.SUCCESS]: (t) => a({ variant: o.SUCCESS, ...t }),
|
|
@@ -17,27 +20,27 @@ const F = ({ children: d }) => {
|
|
|
17
20
|
[o.PURPLE]: (t) => a({ variant: o.PURPLE, ...t })
|
|
18
21
|
}),
|
|
19
22
|
[a]
|
|
20
|
-
),
|
|
23
|
+
), u = c(
|
|
21
24
|
(t, s) => {
|
|
22
|
-
var
|
|
23
|
-
(
|
|
24
|
-
|
|
25
|
+
var e, m;
|
|
26
|
+
(e = s == null ? void 0 : s.current) == null || e.classList.add(P["toast-out"]), (m = s == null ? void 0 : s.current) == null || m.addEventListener("animationend", () => {
|
|
27
|
+
n(d.removeToast(t));
|
|
25
28
|
});
|
|
26
29
|
},
|
|
27
30
|
[]
|
|
28
31
|
);
|
|
29
|
-
return /* @__PURE__ */
|
|
30
|
-
|
|
32
|
+
return /* @__PURE__ */ E(C.Provider, { value: p, children: [
|
|
33
|
+
R,
|
|
31
34
|
/* @__PURE__ */ T(
|
|
32
|
-
|
|
35
|
+
U,
|
|
33
36
|
{
|
|
34
|
-
toasts:
|
|
35
|
-
onToastRemove:
|
|
36
|
-
position:
|
|
37
|
+
toasts: r.toasts,
|
|
38
|
+
onToastRemove: u,
|
|
39
|
+
position: r.position
|
|
37
40
|
}
|
|
38
41
|
)
|
|
39
42
|
] });
|
|
40
43
|
};
|
|
41
44
|
export {
|
|
42
|
-
|
|
45
|
+
b as ToastProvider
|
|
43
46
|
};
|