@tecsinapse/cortex-react 1.9.42 → 1.9.43

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.
@@ -23,7 +23,12 @@ class SnackbarSonner {
23
23
  {
24
24
  text: message,
25
25
  variants: { intent: type },
26
- onDismiss: () => sonner.toast.dismiss(t)
26
+ onDismiss: () => {
27
+ sonner.toast.dismiss(t);
28
+ if (options?.onDismiss && typeof options?.onDismiss === "function") {
29
+ options.onDismiss();
30
+ }
31
+ }
27
32
  }
28
33
  );
29
34
  },
@@ -21,7 +21,12 @@ class SnackbarSonner {
21
21
  {
22
22
  text: message,
23
23
  variants: { intent: type },
24
- onDismiss: () => toast.dismiss(t)
24
+ onDismiss: () => {
25
+ toast.dismiss(t);
26
+ if (options?.onDismiss && typeof options?.onDismiss === "function") {
27
+ options.onDismiss();
28
+ }
29
+ }
25
30
  }
26
31
  );
27
32
  },
@@ -1,12 +1,12 @@
1
1
  import React, { ReactNode } from 'react';
2
- import { type ExternalToast } from 'sonner';
3
- import { SnackbarSonner } from '../service/SnackbarSonner';
2
+ import { SnackbarSonner } from '../service';
3
+ import { IExternalToast } from '../service/IExternalToast';
4
4
  interface SnackbarProviderProps {
5
5
  snackbar: SnackbarSonner;
6
6
  }
7
7
  export declare const SnackbarProvider: ({ children, options, }: {
8
8
  children: ReactNode;
9
- options?: ExternalToast;
9
+ options?: IExternalToast;
10
10
  }) => React.JSX.Element;
11
11
  export declare const useSnackbar: () => SnackbarProviderProps;
12
12
  export {};
@@ -0,0 +1,4 @@
1
+ import { ExternalToast } from 'sonner';
2
+ export type IExternalToast = Omit<ExternalToast, 'onDismiss'> & {
3
+ onDismiss?: () => void;
4
+ };
@@ -1,9 +1,10 @@
1
1
  import React from 'react';
2
2
  import { ExternalToast } from 'sonner';
3
3
  import { ISnackbar, TypeSnack } from './ISnackbar';
4
- export declare class SnackbarSonner implements ISnackbar<ExternalToast> {
5
- _options?: ExternalToast;
6
- constructor(options?: ExternalToast);
4
+ import { IExternalToast } from './IExternalToast';
5
+ export declare class SnackbarSonner implements ISnackbar<IExternalToast> {
6
+ _options?: IExternalToast;
7
+ constructor(options?: IExternalToast);
7
8
  custom(Component: React.ReactElement, options?: ExternalToast): string | number;
8
- show(type: TypeSnack, message: string, options?: Omit<ExternalToast, 'className' | 'style'>): string | number;
9
+ show(type: TypeSnack, message: string, options?: Omit<IExternalToast, 'className' | 'style'>): string | number;
9
10
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tecsinapse/cortex-react",
3
- "version": "1.9.42",
3
+ "version": "1.9.43",
4
4
  "description": "React components based in @tecsinapse/cortex-core",
5
5
  "license": "MIT",
6
6
  "main": "dist/esm/index.js",
@@ -48,5 +48,5 @@
48
48
  "react-dom": ">=18.0.0",
49
49
  "tailwind": ">=3.3.0"
50
50
  },
51
- "gitHead": "bec444ae1b59c31a86cc4e83400fdac34a61d5c2"
51
+ "gitHead": "299e6ce5270eaea541d1fe8ca18949ad6c7e0ab6"
52
52
  }