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 declare const ToastProvider: ({ children }: PropsWithChildren) => import("react/jsx-runtime").JSX.Element;
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 p, jsx as T } from "react/jsx-runtime";
2
- import { useReducer as u, useCallback as m, useMemo as E } from "react";
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 l } from "./hooks.js";
5
- import { reducer as L, initialState as A, actionCreators as c } from "./store.js";
6
- import { c as C } from "../../ProgressBar-BtLMbQrP.js";
7
- import { ToastList as S } from "./ToastList.js";
8
- const F = ({ children: d }) => {
9
- const [i, r] = u(L, A), a = m((t) => {
10
- r(c.setToasts(t));
11
- }, []), R = E(
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
- ), v = m(
23
+ ), u = c(
21
24
  (t, s) => {
22
- var n, e;
23
- (n = s == null ? void 0 : s.current) == null || n.classList.add(C["toast-out"]), (e = s == null ? void 0 : s.current) == null || e.addEventListener("animationend", () => {
24
- r(c.removeToast(t));
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__ */ p(l.Provider, { value: R, children: [
30
- d,
32
+ return /* @__PURE__ */ E(C.Provider, { value: p, children: [
33
+ R,
31
34
  /* @__PURE__ */ T(
32
- S,
35
+ U,
33
36
  {
34
- toasts: i.toasts,
35
- onToastRemove: v,
36
- position: i.position
37
+ toasts: r.toasts,
38
+ onToastRemove: u,
39
+ position: r.position
37
40
  }
38
41
  )
39
42
  ] });
40
43
  };
41
44
  export {
42
- F as ToastProvider
45
+ b as ToastProvider
43
46
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "mimir-ui-kit",
3
3
  "private": false,
4
- "version": "1.67.0",
4
+ "version": "1.67.2",
5
5
  "type": "module",
6
6
  "exports": {
7
7
  ".": {