@tecsinapse/cortex-react 2.2.0-beta.5 → 2.2.0-beta.7
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/dist/cjs/components/Autocomplete/GroupedOptions.js +17 -2
- package/dist/cjs/components/Autocomplete/Option.js +5 -3
- package/dist/cjs/components/Autocomplete/Options.js +19 -11
- package/dist/cjs/components/Autocomplete/Root.js +8 -2
- package/dist/cjs/components/Autocomplete/Trigger.js +3 -4
- package/dist/cjs/components/Autocomplete/context.js +1 -3
- package/dist/cjs/components/PhoneInput/FlagIcon.js +46 -0
- package/dist/cjs/components/PhoneInput/Option.js +29 -0
- package/dist/cjs/components/PhoneInput/Options.js +121 -0
- package/dist/cjs/components/PhoneInput/Popover.js +22 -0
- package/dist/cjs/components/PhoneInput/Root.js +61 -0
- package/dist/cjs/components/PhoneInput/Trigger.js +115 -0
- package/dist/cjs/components/PhoneInput/context.js +19 -0
- package/dist/cjs/components/PhoneInput/index.js +17 -0
- package/dist/cjs/hooks/useAutocompleteGroupedOptions.js +35 -0
- package/dist/cjs/hooks/useAutocompleteOptions.js +35 -0
- package/dist/cjs/index.js +2 -0
- package/dist/cjs/provider/ManagerContext.js +5 -0
- package/dist/cjs/service/SnackbarSonner.js +32 -0
- package/dist/esm/components/Autocomplete/GroupedOptions.js +17 -2
- package/dist/esm/components/Autocomplete/Option.js +5 -3
- package/dist/esm/components/Autocomplete/Options.js +20 -12
- package/dist/esm/components/Autocomplete/Root.js +8 -2
- package/dist/esm/components/Autocomplete/Trigger.js +3 -4
- package/dist/esm/components/Autocomplete/context.js +1 -3
- package/dist/esm/components/PhoneInput/FlagIcon.js +25 -0
- package/dist/esm/components/PhoneInput/Option.js +27 -0
- package/dist/esm/components/PhoneInput/Options.js +119 -0
- package/dist/esm/components/PhoneInput/Popover.js +20 -0
- package/dist/esm/components/PhoneInput/Root.js +59 -0
- package/dist/esm/components/PhoneInput/Trigger.js +113 -0
- package/dist/esm/components/PhoneInput/context.js +16 -0
- package/dist/esm/components/PhoneInput/index.js +15 -0
- package/dist/esm/hooks/useAutocompleteGroupedOptions.js +33 -0
- package/dist/esm/hooks/useAutocompleteOptions.js +33 -0
- package/dist/esm/index.js +1 -0
- package/dist/esm/provider/ManagerContext.js +5 -0
- package/dist/esm/service/SnackbarSonner.js +32 -0
- package/dist/types/components/Autocomplete/GroupedOptions.d.ts +1 -1
- package/dist/types/components/Autocomplete/Option.d.ts +1 -1
- package/dist/types/components/Autocomplete/Options.d.ts +1 -1
- package/dist/types/components/Autocomplete/Root.d.ts +1 -1
- package/dist/types/components/Autocomplete/context.d.ts +4 -3
- package/dist/types/components/Autocomplete/index.d.ts +4 -4
- package/dist/types/components/Autocomplete/types.d.ts +16 -12
- package/dist/types/components/PhoneInput/FlagIcon.d.ts +8 -0
- package/dist/types/components/PhoneInput/Option.d.ts +6 -0
- package/dist/types/components/PhoneInput/Options.d.ts +3 -0
- package/dist/types/components/PhoneInput/Popover.d.ts +4 -0
- package/dist/types/components/PhoneInput/Root.d.ts +2 -0
- package/dist/types/components/PhoneInput/Trigger.d.ts +2 -0
- package/dist/types/components/PhoneInput/context.d.ts +15 -0
- package/dist/types/components/PhoneInput/index.d.ts +16 -0
- package/dist/types/components/PhoneInput/types.d.ts +13 -0
- package/dist/types/components/index.d.ts +1 -0
- package/dist/types/hooks/useAutocompleteGroupedOptions.d.ts +9 -0
- package/dist/types/hooks/useAutocompleteOptions.d.ts +9 -0
- package/dist/types/hooks/useFileUpload.d.ts +4 -4
- package/dist/types/provider/ManagerContext.d.ts +1 -1
- package/dist/types/service/SnackbarSonner.d.ts +19 -0
- package/package.json +5 -3
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { useState, useCallback, useEffect } from 'react';
|
|
2
|
+
|
|
3
|
+
const useAutocompleteOptions = ({
|
|
4
|
+
options: _options
|
|
5
|
+
}) => {
|
|
6
|
+
const [options, setOptions] = useState();
|
|
7
|
+
const [isLoading, setIsLoading] = useState();
|
|
8
|
+
const [error, setError] = useState();
|
|
9
|
+
const initData = useCallback(async (fetch) => {
|
|
10
|
+
setIsLoading(true);
|
|
11
|
+
try {
|
|
12
|
+
const result = await fetch();
|
|
13
|
+
if (result) {
|
|
14
|
+
setOptions(result ?? []);
|
|
15
|
+
}
|
|
16
|
+
} catch (e) {
|
|
17
|
+
setError(String(e));
|
|
18
|
+
} finally {
|
|
19
|
+
setIsLoading(false);
|
|
20
|
+
}
|
|
21
|
+
}, []);
|
|
22
|
+
useEffect(() => {
|
|
23
|
+
if (typeof _options === "function") initData(_options);
|
|
24
|
+
else setOptions(_options);
|
|
25
|
+
}, [_options]);
|
|
26
|
+
return {
|
|
27
|
+
isLoading,
|
|
28
|
+
options,
|
|
29
|
+
error
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
export { useAutocompleteOptions };
|
package/dist/esm/index.js
CHANGED
|
@@ -43,6 +43,7 @@ export { Toggle } from './components/Toggle.js';
|
|
|
43
43
|
export { Tooltip } from './components/Tooltip.js';
|
|
44
44
|
export { Uploader } from './components/Uploader/index.js';
|
|
45
45
|
export { Autocomplete } from './components/Autocomplete/index.js';
|
|
46
|
+
export { PhoneInput } from './components/PhoneInput/index.js';
|
|
46
47
|
export { useCalendar } from './hooks/useCalendar.js';
|
|
47
48
|
export { useCalendarCell } from './hooks/useCalendarCell.js';
|
|
48
49
|
export { useCalendarGrid } from './hooks/useCalendarGrid.js';
|
|
@@ -67,6 +67,11 @@ import 'react-dom';
|
|
|
67
67
|
import '../components/Autocomplete/context.js';
|
|
68
68
|
import '../components/Autocomplete/Options.js';
|
|
69
69
|
import '../components/Autocomplete/GroupedOptions.js';
|
|
70
|
+
import '../components/PhoneInput/Options.js';
|
|
71
|
+
import '../components/PhoneInput/context.js';
|
|
72
|
+
import 'react-international-phone';
|
|
73
|
+
import 'react-icons/io5';
|
|
74
|
+
import 'country-flag-icons/react/3x2';
|
|
70
75
|
|
|
71
76
|
const ManagerContext = createContext(null);
|
|
72
77
|
const ManagerProvider = ({ children }) => {
|
|
@@ -33,6 +33,38 @@ 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
|
+
}
|
|
36
68
|
}
|
|
37
69
|
|
|
38
70
|
export { SnackbarSonner };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { AutocompleteGroupedOptionsProps } from './types';
|
|
2
|
-
export declare const AutocompleteGroupedOptions: ({ onSelect, groupedLabelExtractor, options, }: AutocompleteGroupedOptionsProps) => import("react/jsx-runtime").JSX.Element;
|
|
2
|
+
export declare const AutocompleteGroupedOptions: <T>({ onSelect, groupedLabelExtractor, options, }: AutocompleteGroupedOptionsProps<T>) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { AutocompleteOptionProps } from './types';
|
|
2
|
-
export declare const AutocompleteOption: ({ option, onSelect, grouped, }: AutocompleteOptionProps) => import("react/jsx-runtime").JSX.Element;
|
|
2
|
+
export declare const AutocompleteOption: <T>({ option, onSelect, grouped, }: AutocompleteOptionProps<T>) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { AutocompleteOptionsProps } from './types';
|
|
2
|
-
export declare const AutocompleteOptions: ({ options, onSelect, children, }: AutocompleteOptionsProps) => import("react/jsx-runtime").JSX.Element;
|
|
2
|
+
export declare const AutocompleteOptions: <T>({ options, onSelect, children, }: AutocompleteOptionsProps<T>) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { AutocompleteRootProps } from './types';
|
|
2
|
-
export declare const AutocompleteRoot: ({ children }: AutocompleteRootProps) => import("react/jsx-runtime").JSX.Element;
|
|
2
|
+
export declare const AutocompleteRoot: <T>({ keyExtractor, labelExtractor, children, }: AutocompleteRootProps<T>) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { Dispatch, SetStateAction } from 'react';
|
|
2
|
-
interface AutocompleteContextType {
|
|
2
|
+
export interface AutocompleteContextType<T> {
|
|
3
3
|
open: boolean;
|
|
4
4
|
setOpen: (open: boolean) => void;
|
|
5
5
|
triggerWidth: number | undefined;
|
|
6
6
|
setTriggerWidth: Dispatch<SetStateAction<number | undefined>>;
|
|
7
|
+
keyExtractor: (option: T) => string;
|
|
8
|
+
labelExtractor: (option: T) => string;
|
|
7
9
|
}
|
|
8
|
-
export declare const AutocompleteContext: import("react").Context<AutocompleteContextType | undefined>;
|
|
9
|
-
export {};
|
|
10
|
+
export declare const AutocompleteContext: import("react").Context<AutocompleteContextType<any> | undefined>;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
export declare const Autocomplete: {
|
|
2
|
-
Root: ({ children }: import("./types").AutocompleteRootProps) => import("react/jsx-runtime").JSX.Element;
|
|
2
|
+
Root: <T>({ keyExtractor, labelExtractor, children, }: import("./types").AutocompleteRootProps<T>) => import("react/jsx-runtime").JSX.Element;
|
|
3
3
|
Trigger: ({ inputValue, onChange, label, disabled, placeholder, }: import("./types").AutocompleteTriggerProps) => import("react/jsx-runtime").JSX.Element;
|
|
4
4
|
Popover: ({ children, className, }: import("./types").AutocompletePopoverProps) => import("react/jsx-runtime").JSX.Element;
|
|
5
|
-
Options: ({ options, onSelect, children, }: import("./types").AutocompleteOptionsProps) => import("react/jsx-runtime").JSX.Element;
|
|
6
|
-
Option: ({ option, onSelect, grouped, }: import("./types").AutocompleteOptionProps) => import("react/jsx-runtime").JSX.Element;
|
|
7
|
-
GroupedOptions: ({ onSelect, groupedLabelExtractor, options, }: import("./types").AutocompleteGroupedOptionsProps) => import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
Options: <T>({ options, onSelect, children, }: import("./types").AutocompleteOptionsProps<T>) => import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
Option: <T>({ option, onSelect, grouped, }: import("./types").AutocompleteOptionProps<T>) => import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
GroupedOptions: <T>({ onSelect, groupedLabelExtractor, options, }: import("./types").AutocompleteGroupedOptionsProps<T>) => import("react/jsx-runtime").JSX.Element;
|
|
8
8
|
};
|
|
9
9
|
export * from './types';
|
|
@@ -3,7 +3,9 @@ export interface Option {
|
|
|
3
3
|
label: string;
|
|
4
4
|
value: string;
|
|
5
5
|
}
|
|
6
|
-
export interface AutocompleteRootProps {
|
|
6
|
+
export interface AutocompleteRootProps<T> {
|
|
7
|
+
keyExtractor: (option: T) => string;
|
|
8
|
+
labelExtractor: (option: T) => string;
|
|
7
9
|
children: ReactNode;
|
|
8
10
|
className?: string;
|
|
9
11
|
}
|
|
@@ -19,27 +21,29 @@ export interface AutocompletePopoverProps {
|
|
|
19
21
|
children: ReactNode;
|
|
20
22
|
className?: string;
|
|
21
23
|
}
|
|
22
|
-
export interface AutocompleteOptionsProps {
|
|
23
|
-
|
|
24
|
-
|
|
24
|
+
export interface AutocompleteOptionsProps<T> {
|
|
25
|
+
keyExtractor?: (option: T) => string;
|
|
26
|
+
options?: T[] | (() => Promise<T[]>);
|
|
27
|
+
onSelect?: (option: T) => void;
|
|
25
28
|
children?: ReactNode;
|
|
26
29
|
}
|
|
27
|
-
export interface AutocompleteGroupedOptionsProps {
|
|
28
|
-
options?: Map<string,
|
|
30
|
+
export interface AutocompleteGroupedOptionsProps<T> {
|
|
31
|
+
options?: Map<string, T[]> | (() => Promise<Map<string, T[]>>);
|
|
29
32
|
groupedLabelExtractor: (value: string) => string;
|
|
30
|
-
onSelect?: (option:
|
|
33
|
+
onSelect?: (option: T) => void;
|
|
31
34
|
}
|
|
32
|
-
export interface AutocompleteOptionProps {
|
|
33
|
-
option:
|
|
34
|
-
|
|
35
|
+
export interface AutocompleteOptionProps<T> {
|
|
36
|
+
keyExtractor?: (option: T) => string;
|
|
37
|
+
option: T;
|
|
38
|
+
onSelect?: (option: T) => void;
|
|
35
39
|
grouped?: boolean;
|
|
36
40
|
}
|
|
37
41
|
export interface AutocompleteProps<T> {
|
|
38
42
|
inputValue: string;
|
|
39
43
|
setInputValue: React.Dispatch<React.SetStateAction<string>>;
|
|
40
44
|
onChange: ChangeEventHandler<HTMLInputElement>;
|
|
41
|
-
options:
|
|
42
|
-
onSelect?: (option:
|
|
45
|
+
options: T[] | (() => Promise<T[]>);
|
|
46
|
+
onSelect?: (option: T) => void;
|
|
43
47
|
label?: string;
|
|
44
48
|
placeholder?: string;
|
|
45
49
|
disabled?: boolean;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ParsedCountry } from 'react-international-phone';
|
|
2
|
+
export declare const PhoneInputOption: ({ country, handleSelectCountry, disableClick, }: {
|
|
3
|
+
country: ParsedCountry;
|
|
4
|
+
handleSelectCountry: (country: ParsedCountry) => void;
|
|
5
|
+
disableClick?: boolean;
|
|
6
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { usePhoneInput } from 'react-international-phone';
|
|
2
|
+
export interface Country {
|
|
3
|
+
country: string;
|
|
4
|
+
iso: string;
|
|
5
|
+
code: string;
|
|
6
|
+
}
|
|
7
|
+
interface PhoneInputContextProps extends ReturnType<typeof usePhoneInput> {
|
|
8
|
+
isOpen: boolean;
|
|
9
|
+
setIsOpen: React.Dispatch<React.SetStateAction<boolean>>;
|
|
10
|
+
triggerWidth?: number;
|
|
11
|
+
setTriggerWidth?: React.Dispatch<React.SetStateAction<number | undefined>>;
|
|
12
|
+
}
|
|
13
|
+
export declare const PhoneInputContext: import("react").Context<PhoneInputContextProps | null>;
|
|
14
|
+
export declare const usePhoneContext: () => PhoneInputContextProps;
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export declare const PhoneInput: {
|
|
2
|
+
Root: ({ children, className, onChange, ...rest }: import("./types").PhoneInputRootProps) => import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
Popover: ({ children }: {
|
|
4
|
+
children: import("react").ReactNode;
|
|
5
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
Trigger: ({ disabled, label, ...rest }: import("./types").PhoneInputTriggerProps) => import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
Option: ({ country, handleSelectCountry, disableClick, }: {
|
|
8
|
+
country: import("react-international-phone").ParsedCountry;
|
|
9
|
+
handleSelectCountry: (country: import("react-international-phone").ParsedCountry) => void;
|
|
10
|
+
disableClick?: boolean;
|
|
11
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
Options: ({ hasSearch, }: {
|
|
13
|
+
hasSearch?: boolean;
|
|
14
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
};
|
|
16
|
+
export * from './types';
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ParsedCountry, UsePhoneInputConfig } from 'react-international-phone';
|
|
2
|
+
import { InputPropsBase } from '../Input';
|
|
3
|
+
import { ReactNode } from 'react';
|
|
4
|
+
export interface PhoneInputTriggerProps extends React.InputHTMLAttributes<HTMLInputElement>, InputPropsBase {
|
|
5
|
+
}
|
|
6
|
+
export interface PhoneInputRootProps extends Omit<UsePhoneInputConfig, 'onChange'> {
|
|
7
|
+
children: ReactNode;
|
|
8
|
+
className?: string;
|
|
9
|
+
onChange?: (value: string, rest: {
|
|
10
|
+
inputValue: string;
|
|
11
|
+
country: ParsedCountry;
|
|
12
|
+
}) => void;
|
|
13
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
interface useAutocompleteGroupedOptionsProps<T> {
|
|
2
|
+
options?: Map<string, T[]> | (() => Promise<Map<string, T[]>>);
|
|
3
|
+
}
|
|
4
|
+
export declare const useAutocompleteGroupedOptions: <T>({ options: _options, }: useAutocompleteGroupedOptionsProps<T>) => {
|
|
5
|
+
isLoading: boolean | undefined;
|
|
6
|
+
options: Map<string, T[]> | undefined;
|
|
7
|
+
error: string | undefined;
|
|
8
|
+
};
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
interface useAutocompleteOptionsProps<T> {
|
|
2
|
+
options?: T[] | (() => Promise<T[]>);
|
|
3
|
+
}
|
|
4
|
+
export declare const useAutocompleteOptions: <T>({ options: _options, }: useAutocompleteOptionsProps<T>) => {
|
|
5
|
+
isLoading: boolean | undefined;
|
|
6
|
+
options: T[] | undefined;
|
|
7
|
+
error: string | undefined;
|
|
8
|
+
};
|
|
9
|
+
export {};
|
|
@@ -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<
|
|
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<
|
|
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<
|
|
19
|
+
export declare const useManager: () => ManagerContextProps<any>;
|
|
20
20
|
export {};
|
|
@@ -2,9 +2,28 @@ 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
|
+
}
|
|
5
22
|
export declare class SnackbarSonner implements ISnackbar<IExternalToast> {
|
|
6
23
|
_options?: IExternalToast;
|
|
7
24
|
constructor(options?: IExternalToast);
|
|
8
25
|
custom(Component: React.ReactElement, options?: ExternalToast): string | number;
|
|
9
26
|
show(type: TypeSnack, message: string, options?: Omit<IExternalToast, 'className' | 'style'>): string | number;
|
|
27
|
+
promise<T>(promise: Promise<T>, config: PromiseSnackConfig<T>): Promise<T>;
|
|
10
28
|
}
|
|
29
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tecsinapse/cortex-react",
|
|
3
|
-
"version": "2.2.0-beta.
|
|
3
|
+
"version": "2.2.0-beta.7",
|
|
4
4
|
"description": "React components based in @tecsinapse/cortex-core",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "dist/esm/index.js",
|
|
@@ -20,14 +20,16 @@
|
|
|
20
20
|
"dependencies": {
|
|
21
21
|
"@floating-ui/react": "^0.26.18",
|
|
22
22
|
"@internationalized/date": "3.7.0",
|
|
23
|
-
"@tecsinapse/cortex-core": "2.0.
|
|
23
|
+
"@tecsinapse/cortex-core": "2.0.1",
|
|
24
24
|
"clsx": "2.1.1",
|
|
25
|
+
"country-flag-icons": "^1.6.4",
|
|
25
26
|
"currency.js": "2.0.4",
|
|
26
27
|
"embla-carousel-autoplay": "^8.0.0",
|
|
27
28
|
"embla-carousel-react": "^8.6.0",
|
|
28
29
|
"react-aria": "3.38.1",
|
|
29
30
|
"react-dropzone": "14.3.8",
|
|
30
31
|
"react-imask": "7.6.1",
|
|
32
|
+
"react-international-phone": "^4.6.1",
|
|
31
33
|
"react-spring": "9.7.5",
|
|
32
34
|
"react-stately": "3.36.1",
|
|
33
35
|
"sonner": "1.7.3",
|
|
@@ -48,5 +50,5 @@
|
|
|
48
50
|
"react-icons": ">=5.2.0",
|
|
49
51
|
"tailwindcss": "^4.1.16"
|
|
50
52
|
},
|
|
51
|
-
"gitHead": "
|
|
53
|
+
"gitHead": "5613e70671c62eb5c39356cc66e243ade324b225"
|
|
52
54
|
}
|