@tecsinapse/cortex-react 2.1.1-beta.3 → 2.1.2-beta.1

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.
@@ -35,38 +35,6 @@ class SnackbarSonner {
35
35
  { ...this._options, ...options }
36
36
  );
37
37
  }
38
- async promise(promise, config) {
39
- const { loading, success, error } = config;
40
- const id = this.show(loading.type ?? "info", loading.message, {
41
- ...loading.options,
42
- duration: loading.options?.duration ?? Infinity
43
- });
44
- try {
45
- await promise;
46
- if (!success) {
47
- sonner.toast.dismiss(id);
48
- } else {
49
- const msg = success?.message ?? "Opera\xE7\xE3o conclu\xEDda com sucesso.";
50
- this.show(success?.type ?? "success", msg, {
51
- ...success?.options,
52
- id,
53
- duration: success?.options?.duration ?? this._options?.duration ?? 5e3
54
- });
55
- }
56
- } catch (err) {
57
- if (!error) {
58
- sonner.toast.dismiss(id);
59
- } else {
60
- const msg = error?.message ?? "Ocorreu um erro inesperado.";
61
- this.show(error?.type ?? "error", msg, {
62
- ...error?.options,
63
- id,
64
- duration: error?.options?.duration ?? this._options?.duration ?? 5e3
65
- });
66
- }
67
- }
68
- return promise;
69
- }
70
38
  }
71
39
 
72
40
  exports.SnackbarSonner = SnackbarSonner;
@@ -33,38 +33,6 @@ class SnackbarSonner {
33
33
  { ...this._options, ...options }
34
34
  );
35
35
  }
36
- async promise(promise, config) {
37
- const { loading, success, error } = config;
38
- const id = this.show(loading.type ?? "info", loading.message, {
39
- ...loading.options,
40
- duration: loading.options?.duration ?? Infinity
41
- });
42
- try {
43
- await promise;
44
- if (!success) {
45
- toast.dismiss(id);
46
- } else {
47
- const msg = success?.message ?? "Opera\xE7\xE3o conclu\xEDda com sucesso.";
48
- this.show(success?.type ?? "success", msg, {
49
- ...success?.options,
50
- id,
51
- duration: success?.options?.duration ?? this._options?.duration ?? 5e3
52
- });
53
- }
54
- } catch (err) {
55
- if (!error) {
56
- toast.dismiss(id);
57
- } else {
58
- const msg = error?.message ?? "Ocorreu um erro inesperado.";
59
- this.show(error?.type ?? "error", msg, {
60
- ...error?.options,
61
- id,
62
- duration: error?.options?.duration ?? this._options?.duration ?? 5e3
63
- });
64
- }
65
- }
66
- return promise;
67
- }
68
36
  }
69
37
 
70
38
  export { SnackbarSonner };
@@ -1,6 +1,6 @@
1
1
  import { type DropEvent, type FileRejection } from 'react-dropzone';
2
2
  import { AcceptSpecificMap, UseDropzoneProps, type FileUpload } from '../components/Uploader/types';
3
- interface UseFileUploadOptions {
3
+ interface UseFileUploadOptions<T> {
4
4
  accept?: {
5
5
  IMAGE?: (typeof AcceptSpecificMap.IMAGE)[number][];
6
6
  APPLICATION?: (typeof AcceptSpecificMap.APPLICATION)[number][];
@@ -8,7 +8,7 @@ interface UseFileUploadOptions {
8
8
  VIDEO?: (typeof AcceptSpecificMap.VIDEO)[number][];
9
9
  TEXT?: (typeof AcceptSpecificMap.TEXT)[number][];
10
10
  };
11
- onAccept?: (files: FileUpload<unknown>[]) => Promise<FileUpload<unknown>[]>;
11
+ onAccept?: (files: FileUpload<T>[]) => Promise<FileUpload<T>[]>;
12
12
  onOpenManager?: () => void;
13
13
  onFileRejected?: (fileRejections: FileRejection[], event: DropEvent) => void;
14
14
  maxSize?: number;
@@ -22,7 +22,7 @@ interface UseFileUploadOptions {
22
22
  noClick?: boolean;
23
23
  ignoreRejections?: boolean;
24
24
  }
25
- export declare const useFileUpload: <T>({ accept, onAccept, onOpenManager, onFileRejected, maxSize, allowMultiple, preventDuplicates, onDuplicate, hasManager, isFolder, noClick, ignoreRejections, uploadProgressText, uploadSuccessText, }: UseFileUploadOptions) => {
25
+ export declare const useFileUpload: <T>({ accept, onAccept, onOpenManager, onFileRejected, maxSize, allowMultiple, preventDuplicates, onDuplicate, hasManager, isFolder, noClick, ignoreRejections, uploadProgressText, uploadSuccessText, }: UseFileUploadOptions<T>) => {
26
26
  onOpen: () => void;
27
27
  onClose: () => void;
28
28
  onDelete: (index: number) => void;
@@ -31,7 +31,7 @@ export declare const useFileUpload: <T>({ accept, onAccept, onOpenManager, onFil
31
31
  openManager: () => void;
32
32
  closeManager: () => void;
33
33
  isManagerOpen: boolean;
34
- files: FileUpload<unknown>[];
34
+ files: FileUpload<any>[];
35
35
  duplicates: File[];
36
36
  onClearFiles: () => void;
37
37
  };
@@ -16,5 +16,5 @@ interface ManagerContextProps<T> {
16
16
  export declare const ManagerProvider: ({ children }: {
17
17
  children: ReactNode;
18
18
  }) => import("react/jsx-runtime").JSX.Element;
19
- export declare const useManager: () => ManagerContextProps<unknown>;
19
+ export declare const useManager: () => ManagerContextProps<any>;
20
20
  export {};
@@ -2,28 +2,9 @@ import React from 'react';
2
2
  import { ExternalToast } from 'sonner';
3
3
  import { ISnackbar, TypeSnack } from './ISnackbar';
4
4
  import { IExternalToast } from './IExternalToast';
5
- interface PromiseSnackConfig<T = unknown> {
6
- loading: {
7
- message: string;
8
- type?: TypeSnack;
9
- options?: Omit<IExternalToast, 'className' | 'style'>;
10
- };
11
- success?: {
12
- message?: string;
13
- type?: TypeSnack;
14
- options?: Omit<IExternalToast, 'className' | 'style'>;
15
- };
16
- error?: {
17
- message?: string;
18
- type?: TypeSnack;
19
- options?: Omit<IExternalToast, 'className' | 'style'>;
20
- };
21
- }
22
5
  export declare class SnackbarSonner implements ISnackbar<IExternalToast> {
23
6
  _options?: IExternalToast;
24
7
  constructor(options?: IExternalToast);
25
8
  custom(Component: React.ReactElement, options?: ExternalToast): string | number;
26
9
  show(type: TypeSnack, message: string, options?: Omit<IExternalToast, 'className' | 'style'>): string | number;
27
- promise<T>(promise: Promise<T>, config: PromiseSnackConfig<T>): Promise<T>;
28
10
  }
29
- export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tecsinapse/cortex-react",
3
- "version": "2.1.1-beta.3",
3
+ "version": "2.1.2-beta.1",
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-icons": ">=5.2.0",
49
49
  "tailwindcss": "^4.1.16"
50
50
  },
51
- "gitHead": "4eff3b2229ad43c2e1b92f39bfd97dadd52391eb"
51
+ "gitHead": "ab8ab8f2a28965b382ecae07d997f401af35a65d"
52
52
  }