@samline/notify 1.0.2 → 2.0.1
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/{LICENSE → LICENSE.md} +2 -2
- package/README.md +27 -163
- package/dist/_runtime.d.mts +87 -0
- package/dist/_runtime.d.ts +87 -0
- package/dist/_runtime.js +97 -0
- package/dist/_runtime.mjs +83 -0
- package/dist/browser/assets-client-B-VVPPYQ.js +114 -0
- package/dist/browser/assets-client-CUzxHubR.mjs +108 -0
- package/dist/browser/index-client-BBOQyMFk.mjs +173 -0
- package/dist/browser/index-client-Czb7hTpD.js +181 -0
- package/dist/browser/index.cjs +24716 -0
- package/dist/browser/index.d.mts +134 -0
- package/dist/browser/index.d.ts +134 -0
- package/dist/browser/index.js +24718 -0
- package/dist/browser/index.mjs +24707 -0
- package/dist/browser/render-client-CjcQoukB.js +981 -0
- package/dist/browser/render-client-bGRSTd-L.mjs +974 -0
- package/dist/core/index.d.mts +68 -0
- package/dist/core/index.d.ts +68 -0
- package/dist/core/index.js +1 -0
- package/dist/core/index.mjs +1 -0
- package/dist/index.d.mts +131 -0
- package/dist/index.d.ts +131 -0
- package/dist/index.js +24700 -0
- package/dist/index.mjs +24693 -0
- package/dist/react/index.d.mts +158 -0
- package/dist/react/index.d.ts +158 -0
- package/dist/react/index.js +1116 -0
- package/dist/react/index.mjs +1107 -0
- package/dist/styles.css +589 -422
- package/dist/svelte/assets-client-B-VVPPYQ.js +114 -0
- package/dist/svelte/assets-client-CUzxHubR.mjs +108 -0
- package/dist/svelte/index-client-DbXbWMIe.js +177 -0
- package/dist/svelte/index-client-Dj_WfPK9.mjs +170 -0
- package/dist/svelte/index.d.mts +14 -0
- package/dist/svelte/index.d.ts +14 -0
- package/dist/svelte/index.js +24722 -0
- package/dist/svelte/index.mjs +24713 -0
- package/dist/svelte/render-client-CjcQoukB.js +981 -0
- package/dist/svelte/render-client-bGRSTd-L.mjs +974 -0
- package/dist/vue/assets-client-B-VVPPYQ.js +114 -0
- package/dist/vue/assets-client-CUzxHubR.mjs +108 -0
- package/dist/vue/index-client-DbXbWMIe.js +177 -0
- package/dist/vue/index-client-Dj_WfPK9.mjs +170 -0
- package/dist/vue/index.d.mts +50 -0
- package/dist/vue/index.d.ts +50 -0
- package/dist/vue/index.js +24777 -0
- package/dist/vue/index.mjs +24770 -0
- package/dist/vue/render-client-CjcQoukB.js +981 -0
- package/dist/vue/render-client-bGRSTd-L.mjs +974 -0
- package/package.json +141 -95
- package/dist/browser-notify.js +0 -68
- package/dist/cc-2Yt7NqMX.mjs +0 -21
- package/dist/cc-B6peeNak.mjs +0 -33
- package/dist/cc-BWuAzFJ6.js +0 -12
- package/dist/cc-CaBHsjUt.js +0 -34
- package/dist/cc-DGff5sSY.js +0 -21
- package/dist/cc-he3fHS3P.mjs +0 -12
- package/dist/notify.d.mts +0 -48
- package/dist/notify.d.mts.map +0 -1
- package/dist/notify.d.ts +0 -48
- package/dist/notify.d.ts.map +0 -1
- package/dist/notify.js +0 -206
- package/dist/notify.mjs +0 -202
- package/dist/react-notify-12s--2JK5UjB.mjs +0 -1244
- package/dist/react-notify-12s-Kv2M6zlv.js +0 -1247
- package/dist/react.d.mts +0 -70
- package/dist/react.d.mts.map +0 -1
- package/dist/react.d.ts +0 -70
- package/dist/react.d.ts.map +0 -1
- package/dist/react.js +0 -19
- package/dist/react.mjs +0 -10
- package/dist/render-notify-toasts.js +0 -213
- package/dist/svelte.d.mts +0 -49
- package/dist/svelte.d.mts.map +0 -1
- package/dist/svelte.d.ts +0 -49
- package/dist/svelte.d.ts.map +0 -1
- package/dist/svelte.js +0 -284
- package/dist/svelte.mjs +0 -280
- package/dist/vue.d.mts +0 -107
- package/dist/vue.d.mts.map +0 -1
- package/dist/vue.d.ts +0 -107
- package/dist/vue.d.ts.map +0 -1
- package/dist/vue.js +0 -2215
- package/dist/vue.mjs +0 -2211
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
type ToastTypes = 'normal' | 'action' | 'success' | 'info' | 'warning' | 'error' | 'loading' | 'default';
|
|
4
|
+
type PromiseT<Data = any> = Promise<Data> | (() => Promise<Data>);
|
|
5
|
+
interface PromiseIExtendedResult extends ExternalToast {
|
|
6
|
+
message: React.ReactNode;
|
|
7
|
+
}
|
|
8
|
+
type PromiseTExtendedResult<Data = any> = PromiseIExtendedResult | ((data: Data) => PromiseIExtendedResult | Promise<PromiseIExtendedResult>);
|
|
9
|
+
type PromiseTResult<Data = any> = string | React.ReactNode | ((data: Data) => React.ReactNode | string | Promise<React.ReactNode | string>);
|
|
10
|
+
type PromiseExternalToast = Omit<ExternalToast, 'description'>;
|
|
11
|
+
type PromiseData<ToastData = any> = PromiseExternalToast & {
|
|
12
|
+
loading?: string | React.ReactNode;
|
|
13
|
+
success?: PromiseTResult<ToastData> | PromiseTExtendedResult<ToastData>;
|
|
14
|
+
error?: PromiseTResult | PromiseTExtendedResult;
|
|
15
|
+
description?: PromiseTResult;
|
|
16
|
+
finally?: () => void | Promise<void>;
|
|
17
|
+
};
|
|
18
|
+
interface ToastClassnames {
|
|
19
|
+
toast?: string;
|
|
20
|
+
title?: string;
|
|
21
|
+
description?: string;
|
|
22
|
+
loader?: string;
|
|
23
|
+
closeButton?: string;
|
|
24
|
+
cancelButton?: string;
|
|
25
|
+
actionButton?: string;
|
|
26
|
+
success?: string;
|
|
27
|
+
error?: string;
|
|
28
|
+
info?: string;
|
|
29
|
+
warning?: string;
|
|
30
|
+
loading?: string;
|
|
31
|
+
default?: string;
|
|
32
|
+
content?: string;
|
|
33
|
+
icon?: string;
|
|
34
|
+
}
|
|
35
|
+
interface ToastIcons {
|
|
36
|
+
success?: React.ReactNode;
|
|
37
|
+
info?: React.ReactNode;
|
|
38
|
+
warning?: React.ReactNode;
|
|
39
|
+
error?: React.ReactNode;
|
|
40
|
+
loading?: React.ReactNode;
|
|
41
|
+
close?: React.ReactNode;
|
|
42
|
+
}
|
|
43
|
+
interface Action {
|
|
44
|
+
label: React.ReactNode;
|
|
45
|
+
onClick: (event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void;
|
|
46
|
+
actionButtonStyle?: React.CSSProperties;
|
|
47
|
+
}
|
|
48
|
+
interface ToastT {
|
|
49
|
+
id: number | string;
|
|
50
|
+
toasterId?: string;
|
|
51
|
+
title?: (() => React.ReactNode) | React.ReactNode;
|
|
52
|
+
type?: ToastTypes;
|
|
53
|
+
icon?: React.ReactNode;
|
|
54
|
+
jsx?: React.ReactNode;
|
|
55
|
+
richColors?: boolean;
|
|
56
|
+
invert?: boolean;
|
|
57
|
+
closeButton?: boolean;
|
|
58
|
+
dismissible?: boolean;
|
|
59
|
+
description?: (() => React.ReactNode) | React.ReactNode;
|
|
60
|
+
duration?: number;
|
|
61
|
+
delete?: boolean;
|
|
62
|
+
action?: Action | React.ReactNode;
|
|
63
|
+
cancel?: Action | React.ReactNode;
|
|
64
|
+
onDismiss?: (toast: ToastT) => void;
|
|
65
|
+
onAutoClose?: (toast: ToastT) => void;
|
|
66
|
+
promise?: PromiseT;
|
|
67
|
+
cancelButtonStyle?: React.CSSProperties;
|
|
68
|
+
actionButtonStyle?: React.CSSProperties;
|
|
69
|
+
style?: React.CSSProperties;
|
|
70
|
+
unstyled?: boolean;
|
|
71
|
+
className?: string;
|
|
72
|
+
classNames?: ToastClassnames;
|
|
73
|
+
descriptionClassName?: string;
|
|
74
|
+
position?: Position;
|
|
75
|
+
testId?: string;
|
|
76
|
+
}
|
|
77
|
+
type Position = 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right' | 'top-center' | 'bottom-center';
|
|
78
|
+
interface ToastOptions {
|
|
79
|
+
className?: string;
|
|
80
|
+
closeButton?: boolean;
|
|
81
|
+
descriptionClassName?: string;
|
|
82
|
+
style?: React.CSSProperties;
|
|
83
|
+
cancelButtonStyle?: React.CSSProperties;
|
|
84
|
+
actionButtonStyle?: React.CSSProperties;
|
|
85
|
+
duration?: number;
|
|
86
|
+
unstyled?: boolean;
|
|
87
|
+
classNames?: ToastClassnames;
|
|
88
|
+
closeButtonAriaLabel?: string;
|
|
89
|
+
toasterId?: string;
|
|
90
|
+
}
|
|
91
|
+
type Offset = {
|
|
92
|
+
top?: string | number;
|
|
93
|
+
right?: string | number;
|
|
94
|
+
bottom?: string | number;
|
|
95
|
+
left?: string | number;
|
|
96
|
+
} | string | number;
|
|
97
|
+
interface ToasterProps {
|
|
98
|
+
id?: string;
|
|
99
|
+
invert?: boolean;
|
|
100
|
+
theme?: 'light' | 'dark' | 'system';
|
|
101
|
+
position?: Position;
|
|
102
|
+
hotkey?: string[];
|
|
103
|
+
richColors?: boolean;
|
|
104
|
+
expand?: boolean;
|
|
105
|
+
duration?: number;
|
|
106
|
+
gap?: number;
|
|
107
|
+
visibleToasts?: number;
|
|
108
|
+
closeButton?: boolean;
|
|
109
|
+
toastOptions?: ToastOptions;
|
|
110
|
+
className?: string;
|
|
111
|
+
style?: React.CSSProperties;
|
|
112
|
+
offset?: Offset;
|
|
113
|
+
mobileOffset?: Offset;
|
|
114
|
+
dir?: 'rtl' | 'ltr' | 'auto';
|
|
115
|
+
swipeDirections?: SwipeDirection[];
|
|
116
|
+
icons?: ToastIcons;
|
|
117
|
+
customAriaLabel?: string;
|
|
118
|
+
containerAriaLabel?: string;
|
|
119
|
+
}
|
|
120
|
+
type SwipeDirection = 'top' | 'right' | 'bottom' | 'left';
|
|
121
|
+
interface ToastToDismiss {
|
|
122
|
+
id: number | string;
|
|
123
|
+
dismiss: boolean;
|
|
124
|
+
}
|
|
125
|
+
type ExternalToast = Omit<ToastT, 'id' | 'type' | 'title' | 'jsx' | 'delete' | 'promise'> & {
|
|
126
|
+
id?: number | string;
|
|
127
|
+
toasterId?: string;
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
type titleT = (() => React.ReactNode) | React.ReactNode;
|
|
131
|
+
declare const toast: ((message: titleT, data?: ExternalToast) => string | number) & {
|
|
132
|
+
success: (message: titleT | React.ReactNode, data?: ExternalToast) => string | number;
|
|
133
|
+
info: (message: titleT | React.ReactNode, data?: ExternalToast) => string | number;
|
|
134
|
+
warning: (message: titleT | React.ReactNode, data?: ExternalToast) => string | number;
|
|
135
|
+
error: (message: titleT | React.ReactNode, data?: ExternalToast) => string | number;
|
|
136
|
+
custom: (jsx: (id: number | string) => React.ReactElement, data?: ExternalToast) => string | number;
|
|
137
|
+
message: (message: titleT | React.ReactNode, data?: ExternalToast) => string | number;
|
|
138
|
+
promise: <ToastData>(promise: PromiseT<ToastData>, data?: PromiseData<ToastData>) => (string & {
|
|
139
|
+
unwrap: () => Promise<ToastData>;
|
|
140
|
+
}) | (number & {
|
|
141
|
+
unwrap: () => Promise<ToastData>;
|
|
142
|
+
}) | {
|
|
143
|
+
unwrap: () => Promise<ToastData>;
|
|
144
|
+
};
|
|
145
|
+
dismiss: (id?: number | string) => string | number;
|
|
146
|
+
loading: (message: titleT | React.ReactNode, data?: ExternalToast) => string | number;
|
|
147
|
+
} & {
|
|
148
|
+
getHistory: () => (ToastT | ToastToDismiss)[];
|
|
149
|
+
getToasts: () => (ToastT | ToastToDismiss)[];
|
|
150
|
+
};
|
|
151
|
+
|
|
152
|
+
declare function useNotify(): {
|
|
153
|
+
toasts: ToastT[];
|
|
154
|
+
};
|
|
155
|
+
declare const Toaster: React.ForwardRefExoticComponent<ToasterProps & React.RefAttributes<HTMLElement>>;
|
|
156
|
+
|
|
157
|
+
export { Toaster, toast, useNotify };
|
|
158
|
+
export type { Action, ExternalToast, ToastClassnames, ToastT, ToastToDismiss, ToasterProps };
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
type ToastTypes = 'normal' | 'action' | 'success' | 'info' | 'warning' | 'error' | 'loading' | 'default';
|
|
4
|
+
type PromiseT<Data = any> = Promise<Data> | (() => Promise<Data>);
|
|
5
|
+
interface PromiseIExtendedResult extends ExternalToast {
|
|
6
|
+
message: React.ReactNode;
|
|
7
|
+
}
|
|
8
|
+
type PromiseTExtendedResult<Data = any> = PromiseIExtendedResult | ((data: Data) => PromiseIExtendedResult | Promise<PromiseIExtendedResult>);
|
|
9
|
+
type PromiseTResult<Data = any> = string | React.ReactNode | ((data: Data) => React.ReactNode | string | Promise<React.ReactNode | string>);
|
|
10
|
+
type PromiseExternalToast = Omit<ExternalToast, 'description'>;
|
|
11
|
+
type PromiseData<ToastData = any> = PromiseExternalToast & {
|
|
12
|
+
loading?: string | React.ReactNode;
|
|
13
|
+
success?: PromiseTResult<ToastData> | PromiseTExtendedResult<ToastData>;
|
|
14
|
+
error?: PromiseTResult | PromiseTExtendedResult;
|
|
15
|
+
description?: PromiseTResult;
|
|
16
|
+
finally?: () => void | Promise<void>;
|
|
17
|
+
};
|
|
18
|
+
interface ToastClassnames {
|
|
19
|
+
toast?: string;
|
|
20
|
+
title?: string;
|
|
21
|
+
description?: string;
|
|
22
|
+
loader?: string;
|
|
23
|
+
closeButton?: string;
|
|
24
|
+
cancelButton?: string;
|
|
25
|
+
actionButton?: string;
|
|
26
|
+
success?: string;
|
|
27
|
+
error?: string;
|
|
28
|
+
info?: string;
|
|
29
|
+
warning?: string;
|
|
30
|
+
loading?: string;
|
|
31
|
+
default?: string;
|
|
32
|
+
content?: string;
|
|
33
|
+
icon?: string;
|
|
34
|
+
}
|
|
35
|
+
interface ToastIcons {
|
|
36
|
+
success?: React.ReactNode;
|
|
37
|
+
info?: React.ReactNode;
|
|
38
|
+
warning?: React.ReactNode;
|
|
39
|
+
error?: React.ReactNode;
|
|
40
|
+
loading?: React.ReactNode;
|
|
41
|
+
close?: React.ReactNode;
|
|
42
|
+
}
|
|
43
|
+
interface Action {
|
|
44
|
+
label: React.ReactNode;
|
|
45
|
+
onClick: (event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void;
|
|
46
|
+
actionButtonStyle?: React.CSSProperties;
|
|
47
|
+
}
|
|
48
|
+
interface ToastT {
|
|
49
|
+
id: number | string;
|
|
50
|
+
toasterId?: string;
|
|
51
|
+
title?: (() => React.ReactNode) | React.ReactNode;
|
|
52
|
+
type?: ToastTypes;
|
|
53
|
+
icon?: React.ReactNode;
|
|
54
|
+
jsx?: React.ReactNode;
|
|
55
|
+
richColors?: boolean;
|
|
56
|
+
invert?: boolean;
|
|
57
|
+
closeButton?: boolean;
|
|
58
|
+
dismissible?: boolean;
|
|
59
|
+
description?: (() => React.ReactNode) | React.ReactNode;
|
|
60
|
+
duration?: number;
|
|
61
|
+
delete?: boolean;
|
|
62
|
+
action?: Action | React.ReactNode;
|
|
63
|
+
cancel?: Action | React.ReactNode;
|
|
64
|
+
onDismiss?: (toast: ToastT) => void;
|
|
65
|
+
onAutoClose?: (toast: ToastT) => void;
|
|
66
|
+
promise?: PromiseT;
|
|
67
|
+
cancelButtonStyle?: React.CSSProperties;
|
|
68
|
+
actionButtonStyle?: React.CSSProperties;
|
|
69
|
+
style?: React.CSSProperties;
|
|
70
|
+
unstyled?: boolean;
|
|
71
|
+
className?: string;
|
|
72
|
+
classNames?: ToastClassnames;
|
|
73
|
+
descriptionClassName?: string;
|
|
74
|
+
position?: Position;
|
|
75
|
+
testId?: string;
|
|
76
|
+
}
|
|
77
|
+
type Position = 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right' | 'top-center' | 'bottom-center';
|
|
78
|
+
interface ToastOptions {
|
|
79
|
+
className?: string;
|
|
80
|
+
closeButton?: boolean;
|
|
81
|
+
descriptionClassName?: string;
|
|
82
|
+
style?: React.CSSProperties;
|
|
83
|
+
cancelButtonStyle?: React.CSSProperties;
|
|
84
|
+
actionButtonStyle?: React.CSSProperties;
|
|
85
|
+
duration?: number;
|
|
86
|
+
unstyled?: boolean;
|
|
87
|
+
classNames?: ToastClassnames;
|
|
88
|
+
closeButtonAriaLabel?: string;
|
|
89
|
+
toasterId?: string;
|
|
90
|
+
}
|
|
91
|
+
type Offset = {
|
|
92
|
+
top?: string | number;
|
|
93
|
+
right?: string | number;
|
|
94
|
+
bottom?: string | number;
|
|
95
|
+
left?: string | number;
|
|
96
|
+
} | string | number;
|
|
97
|
+
interface ToasterProps {
|
|
98
|
+
id?: string;
|
|
99
|
+
invert?: boolean;
|
|
100
|
+
theme?: 'light' | 'dark' | 'system';
|
|
101
|
+
position?: Position;
|
|
102
|
+
hotkey?: string[];
|
|
103
|
+
richColors?: boolean;
|
|
104
|
+
expand?: boolean;
|
|
105
|
+
duration?: number;
|
|
106
|
+
gap?: number;
|
|
107
|
+
visibleToasts?: number;
|
|
108
|
+
closeButton?: boolean;
|
|
109
|
+
toastOptions?: ToastOptions;
|
|
110
|
+
className?: string;
|
|
111
|
+
style?: React.CSSProperties;
|
|
112
|
+
offset?: Offset;
|
|
113
|
+
mobileOffset?: Offset;
|
|
114
|
+
dir?: 'rtl' | 'ltr' | 'auto';
|
|
115
|
+
swipeDirections?: SwipeDirection[];
|
|
116
|
+
icons?: ToastIcons;
|
|
117
|
+
customAriaLabel?: string;
|
|
118
|
+
containerAriaLabel?: string;
|
|
119
|
+
}
|
|
120
|
+
type SwipeDirection = 'top' | 'right' | 'bottom' | 'left';
|
|
121
|
+
interface ToastToDismiss {
|
|
122
|
+
id: number | string;
|
|
123
|
+
dismiss: boolean;
|
|
124
|
+
}
|
|
125
|
+
type ExternalToast = Omit<ToastT, 'id' | 'type' | 'title' | 'jsx' | 'delete' | 'promise'> & {
|
|
126
|
+
id?: number | string;
|
|
127
|
+
toasterId?: string;
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
type titleT = (() => React.ReactNode) | React.ReactNode;
|
|
131
|
+
declare const toast: ((message: titleT, data?: ExternalToast) => string | number) & {
|
|
132
|
+
success: (message: titleT | React.ReactNode, data?: ExternalToast) => string | number;
|
|
133
|
+
info: (message: titleT | React.ReactNode, data?: ExternalToast) => string | number;
|
|
134
|
+
warning: (message: titleT | React.ReactNode, data?: ExternalToast) => string | number;
|
|
135
|
+
error: (message: titleT | React.ReactNode, data?: ExternalToast) => string | number;
|
|
136
|
+
custom: (jsx: (id: number | string) => React.ReactElement, data?: ExternalToast) => string | number;
|
|
137
|
+
message: (message: titleT | React.ReactNode, data?: ExternalToast) => string | number;
|
|
138
|
+
promise: <ToastData>(promise: PromiseT<ToastData>, data?: PromiseData<ToastData>) => (string & {
|
|
139
|
+
unwrap: () => Promise<ToastData>;
|
|
140
|
+
}) | (number & {
|
|
141
|
+
unwrap: () => Promise<ToastData>;
|
|
142
|
+
}) | {
|
|
143
|
+
unwrap: () => Promise<ToastData>;
|
|
144
|
+
};
|
|
145
|
+
dismiss: (id?: number | string) => string | number;
|
|
146
|
+
loading: (message: titleT | React.ReactNode, data?: ExternalToast) => string | number;
|
|
147
|
+
} & {
|
|
148
|
+
getHistory: () => (ToastT | ToastToDismiss)[];
|
|
149
|
+
getToasts: () => (ToastT | ToastToDismiss)[];
|
|
150
|
+
};
|
|
151
|
+
|
|
152
|
+
declare function useNotify(): {
|
|
153
|
+
toasts: ToastT[];
|
|
154
|
+
};
|
|
155
|
+
declare const Toaster: React.ForwardRefExoticComponent<ToasterProps & React.RefAttributes<HTMLElement>>;
|
|
156
|
+
|
|
157
|
+
export { Toaster, toast, useNotify };
|
|
158
|
+
export type { Action, ExternalToast, ToastClassnames, ToastT, ToastToDismiss, ToasterProps };
|