kitzo 2.3.15 → 2.3.16
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/index.d.ts
CHANGED
|
@@ -13,6 +13,14 @@ declare type AnimationOptions = {
|
|
|
13
13
|
|
|
14
14
|
declare type CopyStatus = 'standby' | 'copying' | 'copied' | 'error';
|
|
15
15
|
|
|
16
|
+
declare type CustomToastOptions = Omit<ToastOptions, 'type' | 'showIcon' | 'icon'>;
|
|
17
|
+
|
|
18
|
+
declare type ErrorToastOptions = ToastOptionsWithoutType;
|
|
19
|
+
|
|
20
|
+
declare type InfoToastOptions = ToastOptionsWithoutType;
|
|
21
|
+
|
|
22
|
+
declare type LoadingToastOptions = ToastOptionsWithoutType;
|
|
23
|
+
|
|
16
24
|
declare type Position = 'top' | 'top-start' | 'top-end' | 'right' | 'right-start' | 'right-end' | 'bottom' | 'bottom-start' | 'bottom-end' | 'left' | 'left-start' | 'left-end';
|
|
17
25
|
|
|
18
26
|
declare type Positions = 'top-left' | 'top-center' | 'top-right' | 'bottom-left' | 'bottom-center' | 'bottom-right';
|
|
@@ -27,6 +35,8 @@ declare type PromiseToastMsgs<T, E = unknown> = {
|
|
|
27
35
|
|
|
28
36
|
declare type PromiseToastOptions = Omit<ToastOptions, 'id' | 'type'>;
|
|
29
37
|
|
|
38
|
+
declare type SuccessToastOptions = ToastOptionsWithoutType;
|
|
39
|
+
|
|
30
40
|
export declare const toast: ToastFn;
|
|
31
41
|
|
|
32
42
|
declare type ToastContent = ((dismiss: () => void) => ReactNode) | ReactNode;
|
|
@@ -44,15 +54,15 @@ declare type ToasterProps = {
|
|
|
44
54
|
|
|
45
55
|
declare type ToastFn = {
|
|
46
56
|
(content: ToastContent, options?: ToastOptions): void;
|
|
47
|
-
info: (content: ToastContent, options?:
|
|
48
|
-
success: (content: ToastContent, options?:
|
|
49
|
-
warning: (content: ToastContent, options?:
|
|
50
|
-
error: (content: ToastContent, options?:
|
|
57
|
+
info: (content: ToastContent, options?: InfoToastOptions) => void;
|
|
58
|
+
success: (content: ToastContent, options?: SuccessToastOptions) => void;
|
|
59
|
+
warning: (content: ToastContent, options?: WarningToastOptions) => void;
|
|
60
|
+
error: (content: ToastContent, options?: ErrorToastOptions) => void;
|
|
51
61
|
promise: PromiseToastFn;
|
|
52
|
-
loading: (content: ToastContent, options?:
|
|
53
|
-
custom: (content: ToastContent, options?:
|
|
62
|
+
loading: (content: ToastContent, options?: LoadingToastOptions) => void;
|
|
63
|
+
custom: (content: ToastContent, options?: CustomToastOptions) => void;
|
|
54
64
|
dismiss: (id?: string | number) => void;
|
|
55
|
-
update: (id: string | number, content: ToastContent, options?:
|
|
65
|
+
update: (id: string | number, content: ToastContent, options?: UpdateToastOptions) => void;
|
|
56
66
|
};
|
|
57
67
|
|
|
58
68
|
declare type ToastOptions = {
|
|
@@ -65,9 +75,9 @@ declare type ToastOptions = {
|
|
|
65
75
|
type?: ToastType;
|
|
66
76
|
};
|
|
67
77
|
|
|
68
|
-
declare type
|
|
78
|
+
declare type ToastOptionsWithoutType = Omit<ToastOptions, 'type'>;
|
|
69
79
|
|
|
70
|
-
declare type
|
|
80
|
+
declare type ToastType = 'default' | 'success' | 'warning' | 'error' | 'info' | 'custom' | 'loading';
|
|
71
81
|
|
|
72
82
|
export declare function Tooltip(props: TooltipProps): ReactNode;
|
|
73
83
|
|
|
@@ -89,6 +99,8 @@ declare type TooltipCoreProps = {
|
|
|
89
99
|
|
|
90
100
|
declare type TooltipProps = PropsWithChildren<TooltipCoreProps>;
|
|
91
101
|
|
|
102
|
+
declare type UpdateToastOptions = Omit<ToastOptions, 'id'>;
|
|
103
|
+
|
|
92
104
|
export declare function useCopy(options?: UseCopyOptions): UseCopyReturn;
|
|
93
105
|
|
|
94
106
|
declare type UseCopyOptions = {
|
|
@@ -116,4 +128,6 @@ declare type UseWindowSizeOptions = {
|
|
|
116
128
|
updateDelay?: number;
|
|
117
129
|
};
|
|
118
130
|
|
|
131
|
+
declare type WarningToastOptions = ToastOptionsWithoutType;
|
|
132
|
+
|
|
119
133
|
export { }
|
|
@@ -1,44 +1,44 @@
|
|
|
1
|
-
const
|
|
1
|
+
const i = {
|
|
2
2
|
duration: 2800,
|
|
3
3
|
showIcon: !0,
|
|
4
4
|
animateTransformOrigin: void 0
|
|
5
5
|
};
|
|
6
|
-
let
|
|
7
|
-
const
|
|
8
|
-
let
|
|
6
|
+
let r = 0;
|
|
7
|
+
const d = () => crypto.randomUUID?.() ?? `kitzo_toast_id_${++r}`;
|
|
8
|
+
let s = 1;
|
|
9
9
|
function c({
|
|
10
|
-
type:
|
|
11
|
-
action:
|
|
10
|
+
type: a,
|
|
11
|
+
action: e,
|
|
12
12
|
content: o,
|
|
13
13
|
options: n
|
|
14
14
|
}) {
|
|
15
15
|
const t = typeof n == "object" && n !== null ? n : {};
|
|
16
16
|
return {
|
|
17
|
-
id: t.id ??
|
|
18
|
-
duration: t.duration ??
|
|
19
|
-
showIcon: t.showIcon ??
|
|
20
|
-
animateTransformOrigin: t.animateTransformOrigin ??
|
|
17
|
+
id: t.id ?? d(),
|
|
18
|
+
duration: t.duration ?? i.duration,
|
|
19
|
+
showIcon: t.showIcon ?? i.showIcon,
|
|
20
|
+
animateTransformOrigin: t.animateTransformOrigin ?? i.animateTransformOrigin,
|
|
21
21
|
position: t.position,
|
|
22
22
|
icon: t.icon,
|
|
23
|
-
type:
|
|
23
|
+
type: a === "default" ? t.type ?? "default" : a,
|
|
24
24
|
status: "entering",
|
|
25
|
-
zIndex: ++
|
|
25
|
+
zIndex: ++s,
|
|
26
26
|
content: o,
|
|
27
|
-
action:
|
|
27
|
+
action: e
|
|
28
28
|
};
|
|
29
29
|
}
|
|
30
|
-
function T({ id:
|
|
30
|
+
function T({ id: a, content: e, options: o }) {
|
|
31
31
|
const n = typeof o == "object" && o !== null ? o : {};
|
|
32
32
|
return {
|
|
33
33
|
...n,
|
|
34
|
-
id:
|
|
35
|
-
content:
|
|
34
|
+
id: a,
|
|
35
|
+
content: e,
|
|
36
36
|
action: "update",
|
|
37
|
-
duration: n.duration ??
|
|
37
|
+
duration: n.duration ?? i.duration
|
|
38
38
|
};
|
|
39
39
|
}
|
|
40
40
|
export {
|
|
41
41
|
c as createToast,
|
|
42
|
-
|
|
42
|
+
d as genId,
|
|
43
43
|
T as updateToast
|
|
44
44
|
};
|