@xsolla/xui-toast 0.84.0-pr132.1770082296

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.
@@ -0,0 +1,69 @@
1
+ import * as React from 'react';
2
+ import React__default, { ReactNode } from 'react';
3
+
4
+ type ToastVariant = "success" | "info" | "warning" | "error";
5
+ type ToastPosition = "top" | "bottom";
6
+ interface ToastData {
7
+ id: string;
8
+ variant: ToastVariant;
9
+ message: string;
10
+ icon?: ReactNode;
11
+ duration?: number;
12
+ }
13
+ interface ToastProps {
14
+ id: string;
15
+ variant?: ToastVariant;
16
+ message: string;
17
+ icon?: ReactNode;
18
+ onClose?: () => void;
19
+ }
20
+ interface ToastOptions {
21
+ variant?: ToastVariant;
22
+ message: string;
23
+ icon?: ReactNode;
24
+ duration?: number;
25
+ }
26
+ interface ToastGroupProps {
27
+ toasts: ToastData[];
28
+ position?: ToastPosition;
29
+ onDismiss: (id: string) => void;
30
+ }
31
+ interface ToastContextType {
32
+ toasts: ToastData[];
33
+ addToast: (options: ToastOptions) => string;
34
+ dismissToast: (id: string) => void;
35
+ dismissAllToasts: () => void;
36
+ }
37
+ interface ToastProviderProps {
38
+ children: ReactNode;
39
+ position?: ToastPosition;
40
+ defaultDuration?: number;
41
+ }
42
+
43
+ declare const Toast: React__default.FC<ToastProps>;
44
+
45
+ declare const ToastGroup: React__default.MemoExoticComponent<({ toasts, position, onDismiss }: ToastGroupProps) => React__default.ReactPortal | null>;
46
+
47
+ declare const ToastProvider: React__default.FC<ToastProviderProps>;
48
+
49
+ declare const ToastContext: React.Context<ToastContextType | null>;
50
+
51
+ interface UseToastReturn {
52
+ /** Show a toast with custom options */
53
+ toast: (options: ToastOptions) => string;
54
+ /** Show a success toast */
55
+ success: (message: string, options?: Omit<ToastOptions, "message" | "variant">) => string;
56
+ /** Show an info toast */
57
+ info: (message: string, options?: Omit<ToastOptions, "message" | "variant">) => string;
58
+ /** Show a warning toast */
59
+ warning: (message: string, options?: Omit<ToastOptions, "message" | "variant">) => string;
60
+ /** Show an error toast */
61
+ error: (message: string, options?: Omit<ToastOptions, "message" | "variant">) => string;
62
+ /** Dismiss a specific toast by ID */
63
+ dismiss: (id: string) => void;
64
+ /** Dismiss all toasts */
65
+ dismissAll: () => void;
66
+ }
67
+ declare const useToast: () => UseToastReturn;
68
+
69
+ export { Toast, ToastContext, type ToastContextType, type ToastData, ToastGroup, type ToastGroupProps, type ToastOptions, type ToastPosition, type ToastProps, ToastProvider, type ToastProviderProps, type ToastVariant, type UseToastReturn, useToast };
@@ -0,0 +1,69 @@
1
+ import * as React from 'react';
2
+ import React__default, { ReactNode } from 'react';
3
+
4
+ type ToastVariant = "success" | "info" | "warning" | "error";
5
+ type ToastPosition = "top" | "bottom";
6
+ interface ToastData {
7
+ id: string;
8
+ variant: ToastVariant;
9
+ message: string;
10
+ icon?: ReactNode;
11
+ duration?: number;
12
+ }
13
+ interface ToastProps {
14
+ id: string;
15
+ variant?: ToastVariant;
16
+ message: string;
17
+ icon?: ReactNode;
18
+ onClose?: () => void;
19
+ }
20
+ interface ToastOptions {
21
+ variant?: ToastVariant;
22
+ message: string;
23
+ icon?: ReactNode;
24
+ duration?: number;
25
+ }
26
+ interface ToastGroupProps {
27
+ toasts: ToastData[];
28
+ position?: ToastPosition;
29
+ onDismiss: (id: string) => void;
30
+ }
31
+ interface ToastContextType {
32
+ toasts: ToastData[];
33
+ addToast: (options: ToastOptions) => string;
34
+ dismissToast: (id: string) => void;
35
+ dismissAllToasts: () => void;
36
+ }
37
+ interface ToastProviderProps {
38
+ children: ReactNode;
39
+ position?: ToastPosition;
40
+ defaultDuration?: number;
41
+ }
42
+
43
+ declare const Toast: React__default.FC<ToastProps>;
44
+
45
+ declare const ToastGroup: React__default.MemoExoticComponent<({ toasts, position, onDismiss }: ToastGroupProps) => React__default.ReactPortal | null>;
46
+
47
+ declare const ToastProvider: React__default.FC<ToastProviderProps>;
48
+
49
+ declare const ToastContext: React.Context<ToastContextType | null>;
50
+
51
+ interface UseToastReturn {
52
+ /** Show a toast with custom options */
53
+ toast: (options: ToastOptions) => string;
54
+ /** Show a success toast */
55
+ success: (message: string, options?: Omit<ToastOptions, "message" | "variant">) => string;
56
+ /** Show an info toast */
57
+ info: (message: string, options?: Omit<ToastOptions, "message" | "variant">) => string;
58
+ /** Show a warning toast */
59
+ warning: (message: string, options?: Omit<ToastOptions, "message" | "variant">) => string;
60
+ /** Show an error toast */
61
+ error: (message: string, options?: Omit<ToastOptions, "message" | "variant">) => string;
62
+ /** Dismiss a specific toast by ID */
63
+ dismiss: (id: string) => void;
64
+ /** Dismiss all toasts */
65
+ dismissAll: () => void;
66
+ }
67
+ declare const useToast: () => UseToastReturn;
68
+
69
+ export { Toast, ToastContext, type ToastContextType, type ToastData, ToastGroup, type ToastGroupProps, type ToastOptions, type ToastPosition, type ToastProps, ToastProvider, type ToastProviderProps, type ToastVariant, type UseToastReturn, useToast };