@beautinique/frontend-components 1.0.6 → 1.0.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/README.md +11 -13
- package/dist/toast/index.cjs +0 -142
- package/dist/toast/index.cjs.map +1 -1
- package/dist/toast/index.d.cts +0 -1
- package/dist/toast/index.d.cts.map +1 -1
- package/dist/toast/index.d.ts +0 -1
- package/dist/toast/index.d.ts.map +1 -1
- package/dist/toast/index.js +1 -142
- package/dist/toast/index.js.map +1 -1
- package/dist/toast/types.d.cts +4 -37
- package/dist/toast/types.d.cts.map +1 -1
- package/dist/toast/types.d.ts +4 -37
- package/dist/toast/types.d.ts.map +1 -1
- package/dist/toast/uploads.d.cts +1 -31
- package/dist/toast/uploads.d.cts.map +1 -1
- package/dist/toast/uploads.d.ts +1 -31
- package/dist/toast/uploads.d.ts.map +1 -1
- package/package.json +3 -3
- package/dist/toast/toaster.d.cts +0 -80
- package/dist/toast/toaster.d.cts.map +0 -1
- package/dist/toast/toaster.d.ts +0 -80
- package/dist/toast/toaster.d.ts.map +0 -1
package/dist/toast/toaster.d.ts
DELETED
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
import type { ICustomToast, IDefaultToast, ILoadingToast, IProgressToast, IUploadItem, IUploadsToast, TProgressToastOptions, TToastStore } from './types.js';
|
|
2
|
-
declare const createToasterApi: (store: TToastStore) => {
|
|
3
|
-
success: (data: Omit<IDefaultToast, "type">) => string;
|
|
4
|
-
error: (data: Omit<IDefaultToast, "type">) => string;
|
|
5
|
-
warning: (data: Omit<IDefaultToast, "type">) => string;
|
|
6
|
-
default: (data: Omit<IDefaultToast, "type">) => string;
|
|
7
|
-
loading: (data: Omit<ILoadingToast, "type">) => string;
|
|
8
|
-
custom: (data: ICustomToast) => string;
|
|
9
|
-
progress: {
|
|
10
|
-
start: (data: Omit<IProgressToast, "type">) => string;
|
|
11
|
-
update: (toastId: string, progress: number) => void;
|
|
12
|
-
end: (toastId: string) => void;
|
|
13
|
-
};
|
|
14
|
-
uploads: {
|
|
15
|
-
start: (data: Omit<IUploadsToast, "type">) => string;
|
|
16
|
-
update: (toastId: string, itemId: string, patch: Partial<Omit<IUploadItem, "id">>) => void;
|
|
17
|
-
};
|
|
18
|
-
remove: (toastId: string) => void;
|
|
19
|
-
};
|
|
20
|
-
/** Shows toasts in a store: `toaster.success({ title })`, `toaster.remove(id)`, ... */
|
|
21
|
-
export type IToaster = ReturnType<typeof createToasterApi>;
|
|
22
|
-
/**
|
|
23
|
-
* Everything that shows toasts, made for one store: the `toaster`, and the helpers for toasts that
|
|
24
|
-
* follow a request (`withProgressToast`) or several uploads (`withUploadsToast`,
|
|
25
|
-
* `runUploadsInToast`, `createUploadsToast`).
|
|
26
|
-
*
|
|
27
|
-
* The app makes the store once (`createToastStore<TToast>()` of `@beautinique/frontend-stores`),
|
|
28
|
-
* gives it to this function and to the `ToastContainer` that draws the toasts, and exports what
|
|
29
|
-
* comes out for the rest of the app to import:
|
|
30
|
-
*
|
|
31
|
-
* ```ts
|
|
32
|
-
* export const useToastStore = createToastStore<TToast>();
|
|
33
|
-
* export const { toaster, withProgressToast, withUploadsToast, runUploadsInToast } =
|
|
34
|
-
* createToaster(useToastStore);
|
|
35
|
-
* // <ToastContainer store={useToastStore} />
|
|
36
|
-
* ```
|
|
37
|
-
*
|
|
38
|
-
* It works from anywhere (an API client, a store), not only from components.
|
|
39
|
-
*/
|
|
40
|
-
export declare const createToaster: (store: TToastStore) => {
|
|
41
|
-
createUploadsToast: ({ title, description, items, }: import("./uploads.js").IUploadGroupOptions) => import("./types.js").IUploadGroup | undefined;
|
|
42
|
-
withUploadsToast: <T>({ title, description, files, request, }: {
|
|
43
|
-
title: string;
|
|
44
|
-
description?: string;
|
|
45
|
-
files: File[];
|
|
46
|
-
request: (onProgress: import("./types.js").TUploadProgressHandler) => Promise<T>;
|
|
47
|
-
}) => Promise<T>;
|
|
48
|
-
runUploadsInToast: <TId extends string, TResult>({ title, description, uploads, run, }: {
|
|
49
|
-
title: string;
|
|
50
|
-
description?: string;
|
|
51
|
-
uploads: {
|
|
52
|
-
id: TId;
|
|
53
|
-
label: string;
|
|
54
|
-
files: File[];
|
|
55
|
-
}[];
|
|
56
|
-
run: (id: TId, progress: import("./types.js").IUploadItemHandle | undefined) => Promise<TResult>;
|
|
57
|
-
}) => Promise<Record<TId, TResult>>;
|
|
58
|
-
toaster: {
|
|
59
|
-
success: (data: Omit<IDefaultToast, "type">) => string;
|
|
60
|
-
error: (data: Omit<IDefaultToast, "type">) => string;
|
|
61
|
-
warning: (data: Omit<IDefaultToast, "type">) => string;
|
|
62
|
-
default: (data: Omit<IDefaultToast, "type">) => string;
|
|
63
|
-
loading: (data: Omit<ILoadingToast, "type">) => string;
|
|
64
|
-
custom: (data: ICustomToast) => string;
|
|
65
|
-
progress: {
|
|
66
|
-
start: (data: Omit<IProgressToast, "type">) => string;
|
|
67
|
-
update: (toastId: string, progress: number) => void;
|
|
68
|
-
end: (toastId: string) => void;
|
|
69
|
-
};
|
|
70
|
-
uploads: {
|
|
71
|
-
start: (data: Omit<IUploadsToast, "type">) => string;
|
|
72
|
-
update: (toastId: string, itemId: string, patch: Partial<Omit<IUploadItem, "id">>) => void;
|
|
73
|
-
};
|
|
74
|
-
remove: (toastId: string) => void;
|
|
75
|
-
};
|
|
76
|
-
withProgressToast: <T>({ title, description, request, }: TProgressToastOptions<T>) => Promise<T>;
|
|
77
|
-
};
|
|
78
|
-
export type TToasterKit = ReturnType<typeof createToaster>;
|
|
79
|
-
export {};
|
|
80
|
-
//# sourceMappingURL=toaster.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"toaster.d.ts","sourceRoot":"","sources":["../../src/toast/toaster.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,YAAY,EACZ,aAAa,EACb,aAAa,EACb,cAAc,EACd,WAAW,EACX,aAAa,EACb,qBAAqB,EACrB,WAAW,EACZ,MAAM,YAAY,CAAC;A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