toast-23 1.0.0 → 1.0.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.
- package/README.md +41 -120
- package/dist/context.d.ts +4 -0
- package/dist/context.d.ts.map +1 -0
- package/dist/icons.d.ts +16 -0
- package/dist/icons.d.ts.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +6 -119
- package/dist/index.d.ts.map +1 -0
- package/dist/index.mjs +207 -215
- package/dist/index.mjs.map +1 -1
- package/dist/provider.d.ts +3 -0
- package/dist/provider.d.ts.map +1 -0
- package/dist/standalone.d.ts +43 -0
- package/dist/standalone.d.ts.map +1 -0
- package/dist/toast-23.css +1 -0
- package/dist/toast-container.d.ts +17 -0
- package/dist/toast-container.d.ts.map +1 -0
- package/dist/toast-item.d.ts +16 -0
- package/dist/toast-item.d.ts.map +1 -0
- package/dist/types.d.ts +118 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/use-toast.d.ts +3 -0
- package/dist/use-toast.d.ts.map +1 -0
- package/dist/utils.d.ts +13 -0
- package/dist/utils.d.ts.map +1 -0
- package/package.json +10 -8
- package/dist/style.css +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,119 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
* container. Returns a callable toast object with `.success()`, `.error()`, etc.
|
|
8
|
-
*
|
|
9
|
-
* Call `.destroy()` when your application unmounts to clean up.
|
|
10
|
-
*/
|
|
11
|
-
export declare function createToast23(options?: StandaloneOptions): StandaloneToastApi;
|
|
12
|
-
|
|
13
|
-
/** Options for `toast.promise()`. */
|
|
14
|
-
export declare interface PromiseOptions<T> {
|
|
15
|
-
/** Message shown while the promise is pending. */
|
|
16
|
-
loading: string;
|
|
17
|
-
/** Message on fulfillment. Can be a function receiving the resolved value. */
|
|
18
|
-
success: string | ((data: T) => string);
|
|
19
|
-
/** Message on rejection. Can be a function receiving the error. */
|
|
20
|
-
error: string | ((err: unknown) => string);
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export declare interface StandaloneOptions {
|
|
24
|
-
/** Where on screen toasts appear. @default "top-right" */
|
|
25
|
-
position?: ToastPosition;
|
|
26
|
-
/** Max simultaneous toasts. @default 5 */
|
|
27
|
-
maxVisible?: number;
|
|
28
|
-
/** Default auto-dismiss duration in ms. @default 5000 */
|
|
29
|
-
duration?: number;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
export declare interface StandaloneToastApi {
|
|
33
|
-
/** Show a default toast. Returns the toast id. */
|
|
34
|
-
(message: string | ReactNode, options?: ToastOptions): string;
|
|
35
|
-
/** Show a success toast. */
|
|
36
|
-
success: (message: string, options?: Omit<ToastOptions, "variant">) => string;
|
|
37
|
-
/** Show an error toast. */
|
|
38
|
-
error: (message: string, options?: Omit<ToastOptions, "variant">) => string;
|
|
39
|
-
/** Show a warning toast. */
|
|
40
|
-
warning: (message: string, options?: Omit<ToastOptions, "variant">) => string;
|
|
41
|
-
/** Show an info toast. */
|
|
42
|
-
info: (message: string, options?: Omit<ToastOptions, "variant">) => string;
|
|
43
|
-
/** Show a loading toast. Returns the toast id for later update. */
|
|
44
|
-
loading: (message: string, options?: Omit<ToastOptions, "variant">) => string;
|
|
45
|
-
/** Show a custom toast with JSX content and no default styles. */
|
|
46
|
-
custom: (content: ReactNode, options?: Omit<ToastOptions, "variant">) => string;
|
|
47
|
-
/** Track an async operation with loading → success / error transitions. */
|
|
48
|
-
promise: <T>(promise: Promise<T> | (() => Promise<T>), options: PromiseOptions<T>, toastOptions?: ToastOptions) => Promise<T>;
|
|
49
|
-
/** Manually dismiss a toast by id. Omit id to dismiss all. */
|
|
50
|
-
dismiss: (id?: string) => void;
|
|
51
|
-
/** Instantly remove a toast from DOM (no exit animation). Omit id to remove all. */
|
|
52
|
-
remove: (id?: string) => void;
|
|
53
|
-
/** Unmount the React root and remove the container from the DOM. */
|
|
54
|
-
destroy: () => void;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
export declare const Toast23Provider: React.FC<Toast23ProviderProps>;
|
|
58
|
-
|
|
59
|
-
/** Props for `<Toast23Provider>`. */
|
|
60
|
-
export declare interface Toast23ProviderProps {
|
|
61
|
-
children: ReactNode;
|
|
62
|
-
/** Maximum number of simultaneously visible toasts. @default 5 */
|
|
63
|
-
maxVisible?: number;
|
|
64
|
-
/** Default position on screen. @default "top-right" */
|
|
65
|
-
position?: ToastPosition;
|
|
66
|
-
/** Default auto-dismiss duration in ms. @default 5000 */
|
|
67
|
-
duration?: number;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
/**
|
|
71
|
-
* The callable toast API returned by `useToast()`.
|
|
72
|
-
*
|
|
73
|
-
* Can be invoked directly — `toast("hi")` — or via variant helpers.
|
|
74
|
-
*/
|
|
75
|
-
export declare interface ToastApi {
|
|
76
|
-
(message: string | ReactNode, options?: ToastOptions): string;
|
|
77
|
-
success: (message: string, options?: Omit<ToastOptions, "variant">) => string;
|
|
78
|
-
error: (message: string, options?: Omit<ToastOptions, "variant">) => string;
|
|
79
|
-
warning: (message: string, options?: Omit<ToastOptions, "variant">) => string;
|
|
80
|
-
info: (message: string, options?: Omit<ToastOptions, "variant">) => string;
|
|
81
|
-
/** Show a loading toast. Returns the toast id for later update. */
|
|
82
|
-
loading: (message: string, options?: Omit<ToastOptions, "variant">) => string;
|
|
83
|
-
/** Show a custom toast with JSX content and no default styles. */
|
|
84
|
-
custom: (content: ReactNode, options?: Omit<ToastOptions, "variant">) => string;
|
|
85
|
-
/** Track an async operation with loading → success / error transitions. */
|
|
86
|
-
promise: <T>(promise: Promise<T> | (() => Promise<T>), options: PromiseOptions<T>, toastOptions?: ToastOptions) => Promise<T>;
|
|
87
|
-
/** Manually dismiss a toast by id. Omit id to dismiss all. */
|
|
88
|
-
dismiss: (id?: string) => void;
|
|
89
|
-
/** Instantly remove a toast from DOM (no exit animation). Omit id to remove all. */
|
|
90
|
-
remove: (id?: string) => void;
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
/** Options accepted when creating a toast. */
|
|
94
|
-
export declare interface ToastOptions {
|
|
95
|
-
/** Provide a fixed id to update an existing toast or prevent duplicates. */
|
|
96
|
-
id?: string;
|
|
97
|
-
/** Optional heading displayed above the message. */
|
|
98
|
-
title?: string;
|
|
99
|
-
/** Visual variant. Defaults to `"default"`. */
|
|
100
|
-
variant?: ToastVariant;
|
|
101
|
-
/** Auto-dismiss duration in ms. `0` = persistent. Defaults to provider value. */
|
|
102
|
-
duration?: number;
|
|
103
|
-
/** Screen position override. Defaults to provider value. */
|
|
104
|
-
position?: ToastPosition;
|
|
105
|
-
/** Whether the user can manually dismiss the toast. Defaults to `true`. */
|
|
106
|
-
dismissible?: boolean;
|
|
107
|
-
/** Delay in ms before removing from DOM after dismiss (for exit animation). @default 1000 */
|
|
108
|
-
removeDelay?: number;
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
/** Screen position where toasts are rendered. */
|
|
112
|
-
export declare type ToastPosition = "top-right" | "top-left" | "top-center" | "bottom-right" | "bottom-left" | "bottom-center";
|
|
113
|
-
|
|
114
|
-
/** Visual variant of a toast notification. */
|
|
115
|
-
export declare type ToastVariant = "success" | "error" | "warning" | "info" | "default";
|
|
116
|
-
|
|
117
|
-
export declare function useToast(): ToastApi;
|
|
118
|
-
|
|
119
|
-
export { }
|
|
1
|
+
export { Toast23Provider } from './provider';
|
|
2
|
+
export { useToast } from './use-toast';
|
|
3
|
+
export { createToast23 } from './standalone';
|
|
4
|
+
export type { ToastVariant, ToastPosition, ToastOptions, ToastApi, Toast23ProviderProps, PromiseOptions, } from './types';
|
|
5
|
+
export type { StandaloneOptions, StandaloneToastApi } from './standalone';
|
|
6
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,cAAc,CAAC;AAGtB,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAG7C,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAGvC,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAG7C,YAAY,EACV,YAAY,EACZ,aAAa,EACb,YAAY,EACZ,QAAQ,EACR,oBAAoB,EACpB,cAAc,GACf,MAAM,SAAS,CAAC;AAEjB,YAAY,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC"}
|