kitzo 2.3.15 → 2.3.17
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,8 @@ declare type AnimationOptions = {
|
|
|
13
13
|
|
|
14
14
|
declare type CopyStatus = 'standby' | 'copying' | 'copied' | 'error';
|
|
15
15
|
|
|
16
|
+
declare type Options = ToastOptionsWithoutType;
|
|
17
|
+
|
|
16
18
|
declare type Position = 'top' | 'top-start' | 'top-end' | 'right' | 'right-start' | 'right-end' | 'bottom' | 'bottom-start' | 'bottom-end' | 'left' | 'left-start' | 'left-end';
|
|
17
19
|
|
|
18
20
|
declare type Positions = 'top-left' | 'top-center' | 'top-right' | 'bottom-left' | 'bottom-center' | 'bottom-right';
|
|
@@ -44,15 +46,15 @@ declare type ToasterProps = {
|
|
|
44
46
|
|
|
45
47
|
declare type ToastFn = {
|
|
46
48
|
(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?:
|
|
49
|
+
info: (content: ToastContent, options?: Options) => void;
|
|
50
|
+
success: (content: ToastContent, options?: Options) => void;
|
|
51
|
+
warning: (content: ToastContent, options?: Options) => void;
|
|
52
|
+
error: (content: ToastContent, options?: Options) => void;
|
|
51
53
|
promise: PromiseToastFn;
|
|
52
|
-
loading: (content: ToastContent, options?:
|
|
53
|
-
custom: (content: ToastContent, options?:
|
|
54
|
+
loading: (content: ToastContent, options?: Options) => void;
|
|
55
|
+
custom: (content: ToastContent, options?: Options) => void;
|
|
54
56
|
dismiss: (id?: string | number) => void;
|
|
55
|
-
update: (id: string | number, content: ToastContent, options?:
|
|
57
|
+
update: (id: string | number, content: ToastContent, options?: UpdateToastOptions) => void;
|
|
56
58
|
};
|
|
57
59
|
|
|
58
60
|
declare type ToastOptions = {
|
|
@@ -65,9 +67,9 @@ declare type ToastOptions = {
|
|
|
65
67
|
type?: ToastType;
|
|
66
68
|
};
|
|
67
69
|
|
|
68
|
-
declare type
|
|
70
|
+
declare type ToastOptionsWithoutType = Omit<ToastOptions, 'type'>;
|
|
69
71
|
|
|
70
|
-
declare type
|
|
72
|
+
declare type ToastType = 'default' | 'success' | 'warning' | 'error' | 'info' | 'custom' | 'loading';
|
|
71
73
|
|
|
72
74
|
export declare function Tooltip(props: TooltipProps): ReactNode;
|
|
73
75
|
|
|
@@ -89,6 +91,8 @@ declare type TooltipCoreProps = {
|
|
|
89
91
|
|
|
90
92
|
declare type TooltipProps = PropsWithChildren<TooltipCoreProps>;
|
|
91
93
|
|
|
94
|
+
declare type UpdateToastOptions = Omit<ToastOptions, 'id'>;
|
|
95
|
+
|
|
92
96
|
export declare function useCopy(options?: UseCopyOptions): UseCopyReturn;
|
|
93
97
|
|
|
94
98
|
declare type UseCopyOptions = {
|
|
@@ -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
|
};
|