react-toastify-v2 11.0.5
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 +21 -0
- package/README.md +115 -0
- package/addons/use-notification-center/index.d.mts +395 -0
- package/addons/use-notification-center/index.d.ts +395 -0
- package/addons/use-notification-center/index.js +3 -0
- package/addons/use-notification-center/index.js.map +1 -0
- package/addons/use-notification-center/index.mjs +3 -0
- package/addons/use-notification-center/index.mjs.map +1 -0
- package/dist/ReactToastify.css +800 -0
- package/dist/index.d.mts +431 -0
- package/dist/index.d.ts +431 -0
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +4 -0
- package/dist/index.mjs.map +1 -0
- package/dist/unstyled.d.mts +431 -0
- package/dist/unstyled.d.ts +431 -0
- package/dist/unstyled.js +3 -0
- package/dist/unstyled.js.map +1 -0
- package/dist/unstyled.mjs +3 -0
- package/dist/unstyled.mjs.map +1 -0
- package/package.json +108 -0
@@ -0,0 +1,431 @@
|
|
1
|
+
import * as React from 'react';
|
2
|
+
import React__default, { HTMLAttributes } from 'react';
|
3
|
+
|
4
|
+
interface CloseButtonProps {
|
5
|
+
closeToast: CloseToastFunc;
|
6
|
+
type: TypeOptions;
|
7
|
+
ariaLabel?: string;
|
8
|
+
theme: Theme;
|
9
|
+
}
|
10
|
+
declare function CloseButton({ closeToast, theme, ariaLabel }: CloseButtonProps): React__default.JSX.Element;
|
11
|
+
|
12
|
+
declare function ToastContainer(props: ToastContainerProps): React__default.JSX.Element;
|
13
|
+
|
14
|
+
declare const Bounce: ({ children, position, preventExitTransition, done, nodeRef, isIn, playToast }: ToastTransitionProps) => React.JSX.Element;
|
15
|
+
declare const Slide: ({ children, position, preventExitTransition, done, nodeRef, isIn, playToast }: ToastTransitionProps) => React.JSX.Element;
|
16
|
+
declare const Zoom: ({ children, position, preventExitTransition, done, nodeRef, isIn, playToast }: ToastTransitionProps) => React.JSX.Element;
|
17
|
+
declare const Flip: ({ children, position, preventExitTransition, done, nodeRef, isIn, playToast }: ToastTransitionProps) => React.JSX.Element;
|
18
|
+
|
19
|
+
/**
|
20
|
+
* Used when providing custom icon
|
21
|
+
*/
|
22
|
+
interface IconProps {
|
23
|
+
theme: Theme;
|
24
|
+
type: TypeOptions;
|
25
|
+
isLoading?: boolean;
|
26
|
+
}
|
27
|
+
type BuiltInIconProps = React__default.SVGProps<SVGSVGElement> & IconProps;
|
28
|
+
declare function Warning(props: BuiltInIconProps): React__default.JSX.Element;
|
29
|
+
declare function Info(props: BuiltInIconProps): React__default.JSX.Element;
|
30
|
+
declare function Success(props: BuiltInIconProps): React__default.JSX.Element;
|
31
|
+
declare function Error(props: BuiltInIconProps): React__default.JSX.Element;
|
32
|
+
declare function Spinner(): React__default.JSX.Element;
|
33
|
+
declare const Icons: {
|
34
|
+
info: typeof Info;
|
35
|
+
warning: typeof Warning;
|
36
|
+
success: typeof Success;
|
37
|
+
error: typeof Error;
|
38
|
+
spinner: typeof Spinner;
|
39
|
+
};
|
40
|
+
|
41
|
+
declare function isToastActive(id: Id, containerId?: Id): boolean;
|
42
|
+
declare const clearWaitingQueue: (p?: ClearWaitingQueueParams) => void;
|
43
|
+
|
44
|
+
type Nullable<T> = {
|
45
|
+
[P in keyof T]: T[P] | null;
|
46
|
+
};
|
47
|
+
type TypeOptions = 'info' | 'success' | 'warning' | 'error' | 'default';
|
48
|
+
type Theme = 'light' | 'dark' | 'colored' | (string & {});
|
49
|
+
type ToastPosition = 'top-right' | 'top-center' | 'top-left' | 'bottom-right' | 'bottom-center' | 'bottom-left';
|
50
|
+
type CloseToastFunc = ((reason?: boolean | string) => void) & ((e: React__default.MouseEvent) => void);
|
51
|
+
interface ToastContentProps<Data = unknown> {
|
52
|
+
closeToast: CloseToastFunc;
|
53
|
+
toastProps: ToastProps;
|
54
|
+
isPaused: boolean;
|
55
|
+
data: Data;
|
56
|
+
}
|
57
|
+
type ToastContent<T = unknown> = React__default.ReactNode | ((props: ToastContentProps<T>) => React__default.ReactNode);
|
58
|
+
type ToastIcon = false | ((props: IconProps) => React__default.ReactNode) | React__default.ReactElement<IconProps>;
|
59
|
+
type Id = number | string;
|
60
|
+
type ToastTransition = React__default.FC<ToastTransitionProps> | React__default.ComponentClass<ToastTransitionProps>;
|
61
|
+
/**
|
62
|
+
* ClassName for the elements - can take a function to build a classname or a raw string that is cx'ed to defaults
|
63
|
+
*/
|
64
|
+
type ToastClassName = ((context?: {
|
65
|
+
type?: TypeOptions;
|
66
|
+
defaultClassName?: string;
|
67
|
+
position?: ToastPosition;
|
68
|
+
rtl?: boolean;
|
69
|
+
}) => string) | string;
|
70
|
+
interface ClearWaitingQueueParams {
|
71
|
+
containerId?: Id;
|
72
|
+
}
|
73
|
+
type DraggableDirection = 'x' | 'y';
|
74
|
+
interface CommonOptions {
|
75
|
+
/**
|
76
|
+
* Pause the timer when the mouse hover the toast.
|
77
|
+
* `Default: true`
|
78
|
+
*/
|
79
|
+
pauseOnHover?: boolean;
|
80
|
+
/**
|
81
|
+
* Pause the toast when the window loses focus.
|
82
|
+
* `Default: true`
|
83
|
+
*/
|
84
|
+
pauseOnFocusLoss?: boolean;
|
85
|
+
/**
|
86
|
+
* Remove the toast when clicked.
|
87
|
+
* `Default: false`
|
88
|
+
*/
|
89
|
+
closeOnClick?: boolean;
|
90
|
+
/**
|
91
|
+
* Set the delay in ms to close the toast automatically.
|
92
|
+
* Use `false` to prevent the toast from closing.
|
93
|
+
* `Default: 5000`
|
94
|
+
*/
|
95
|
+
autoClose?: number | false;
|
96
|
+
/**
|
97
|
+
* Set the default position to use.
|
98
|
+
* `One of: 'top-right', 'top-center', 'top-left', 'bottom-right', 'bottom-center', 'bottom-left'`
|
99
|
+
* `Default: 'top-right'`
|
100
|
+
*/
|
101
|
+
position?: ToastPosition;
|
102
|
+
/**
|
103
|
+
* Pass a custom close button.
|
104
|
+
* To remove the close button pass `false`
|
105
|
+
*/
|
106
|
+
closeButton?: boolean | ((props: CloseButtonProps) => React__default.ReactNode) | React__default.ReactElement<CloseButtonProps>;
|
107
|
+
/**
|
108
|
+
* An optional css class to set for the progress bar.
|
109
|
+
*/
|
110
|
+
progressClassName?: ToastClassName;
|
111
|
+
/**
|
112
|
+
* Hide or show the progress bar.
|
113
|
+
* `Default: false`
|
114
|
+
*/
|
115
|
+
hideProgressBar?: boolean;
|
116
|
+
/**
|
117
|
+
* Pass a custom transition see https://fkhadra.github.io/react-toastify-v2/custom-animation/
|
118
|
+
*/
|
119
|
+
transition?: ToastTransition;
|
120
|
+
/**
|
121
|
+
* Allow toast to be draggable
|
122
|
+
* `Default: 'touch'`
|
123
|
+
*/
|
124
|
+
draggable?: boolean | 'mouse' | 'touch';
|
125
|
+
/**
|
126
|
+
* The percentage of the toast's width it takes for a drag to dismiss a toast
|
127
|
+
* `Default: 80`
|
128
|
+
*/
|
129
|
+
draggablePercent?: number;
|
130
|
+
/**
|
131
|
+
* Specify in which direction should you swipe to dismiss the toast
|
132
|
+
* `Default: "x"`
|
133
|
+
*/
|
134
|
+
draggableDirection?: DraggableDirection;
|
135
|
+
/**
|
136
|
+
* Define the ARIA role for the toast
|
137
|
+
* `Default: alert`
|
138
|
+
* https://www.w3.org/WAI/PF/aria/roles
|
139
|
+
*/
|
140
|
+
role?: string;
|
141
|
+
/**
|
142
|
+
* Set id to handle multiple container
|
143
|
+
*/
|
144
|
+
containerId?: Id;
|
145
|
+
/**
|
146
|
+
* Fired when clicking inside toaster
|
147
|
+
*/
|
148
|
+
onClick?: (event: React__default.MouseEvent) => void;
|
149
|
+
/**
|
150
|
+
* Support right to left display.
|
151
|
+
* `Default: false`
|
152
|
+
*/
|
153
|
+
rtl?: boolean;
|
154
|
+
/**
|
155
|
+
* Used to display a custom icon. Set it to `false` to prevent
|
156
|
+
* the icons from being displayed
|
157
|
+
*/
|
158
|
+
icon?: ToastIcon;
|
159
|
+
/**
|
160
|
+
* Theme to use.
|
161
|
+
* `One of: 'light', 'dark', 'colored'`
|
162
|
+
* `Default: 'light'`
|
163
|
+
*/
|
164
|
+
theme?: Theme;
|
165
|
+
/**
|
166
|
+
* When set to `true` the built-in progress bar won't be rendered at all. Autoclose delay won't have any effect as well
|
167
|
+
* This is only used when you want to replace the progress bar with your own.
|
168
|
+
*
|
169
|
+
* See https://stackblitz.com/edit/react-toastify-v2-custom-progress-bar?file=src%2FApp.tsx for an example.
|
170
|
+
*/
|
171
|
+
customProgressBar?: boolean;
|
172
|
+
}
|
173
|
+
interface ToastOptions<Data = unknown> extends CommonOptions {
|
174
|
+
/**
|
175
|
+
* An optional css class to set.
|
176
|
+
*/
|
177
|
+
className?: ToastClassName;
|
178
|
+
/**
|
179
|
+
* Called when toast is mounted.
|
180
|
+
*/
|
181
|
+
onOpen?: () => void;
|
182
|
+
/**
|
183
|
+
* Called when toast is unmounted.
|
184
|
+
* The callback first argument is the closure reason.
|
185
|
+
* It is "true" when the notification is closed by a user action like clicking on the close button.
|
186
|
+
*/
|
187
|
+
onClose?: (reason?: boolean | string) => void;
|
188
|
+
/**
|
189
|
+
* An optional inline style to apply.
|
190
|
+
*/
|
191
|
+
style?: React__default.CSSProperties;
|
192
|
+
/**
|
193
|
+
* Set the toast type.
|
194
|
+
* `One of: 'info', 'success', 'warning', 'error', 'default'`
|
195
|
+
*/
|
196
|
+
type?: TypeOptions;
|
197
|
+
/**
|
198
|
+
* Set a custom `toastId`
|
199
|
+
*/
|
200
|
+
toastId?: Id;
|
201
|
+
/**
|
202
|
+
* Used during update
|
203
|
+
*/
|
204
|
+
updateId?: Id;
|
205
|
+
/**
|
206
|
+
* Set the percentage for the controlled progress bar. `Value must be between 0 and 1.`
|
207
|
+
*/
|
208
|
+
progress?: number;
|
209
|
+
/**
|
210
|
+
* Let you provide any data, useful when you are using your own component
|
211
|
+
*/
|
212
|
+
data?: Data;
|
213
|
+
/**
|
214
|
+
* Let you specify the aria-label
|
215
|
+
*/
|
216
|
+
ariaLabel?: string;
|
217
|
+
/**
|
218
|
+
* Add a delay in ms before the toast appear.
|
219
|
+
*/
|
220
|
+
delay?: number;
|
221
|
+
isLoading?: boolean;
|
222
|
+
}
|
223
|
+
interface UpdateOptions<T = unknown> extends Nullable<ToastOptions<T>> {
|
224
|
+
/**
|
225
|
+
* Used to update a toast.
|
226
|
+
* Pass any valid ReactNode(string, number, component)
|
227
|
+
*/
|
228
|
+
render?: ToastContent<T>;
|
229
|
+
}
|
230
|
+
interface ToastContainerProps extends CommonOptions, Pick<HTMLAttributes<HTMLElement>, 'aria-label'> {
|
231
|
+
/**
|
232
|
+
* An optional css class to set.
|
233
|
+
*/
|
234
|
+
className?: ToastClassName;
|
235
|
+
/**
|
236
|
+
* Will stack the toast with the newest on the top.
|
237
|
+
*/
|
238
|
+
stacked?: boolean;
|
239
|
+
/**
|
240
|
+
* Whether or not to display the newest toast on top.
|
241
|
+
* `Default: false`
|
242
|
+
*/
|
243
|
+
newestOnTop?: boolean;
|
244
|
+
/**
|
245
|
+
* An optional inline style to apply.
|
246
|
+
*/
|
247
|
+
style?: React__default.CSSProperties;
|
248
|
+
/**
|
249
|
+
* An optional inline style to apply for the toast.
|
250
|
+
*/
|
251
|
+
toastStyle?: React__default.CSSProperties;
|
252
|
+
/**
|
253
|
+
* An optional css class for the toast.
|
254
|
+
*/
|
255
|
+
toastClassName?: ToastClassName;
|
256
|
+
/**
|
257
|
+
* Limit the number of toast displayed at the same time
|
258
|
+
*/
|
259
|
+
limit?: number;
|
260
|
+
/**
|
261
|
+
* Shortcut to focus the first notification with the keyboard
|
262
|
+
* `default: Alt+t`
|
263
|
+
*
|
264
|
+
* ```
|
265
|
+
* // focus when user presses ⌘ + F
|
266
|
+
* const matchShortcut = (e: KeyboardEvent) => e.metaKey && e.key === 'f'
|
267
|
+
* ```
|
268
|
+
*/
|
269
|
+
hotKeys?: (e: KeyboardEvent) => boolean;
|
270
|
+
/**
|
271
|
+
* Children to be rendered under the toasts
|
272
|
+
*/
|
273
|
+
underToastChildren?: React__default.ReactNode;
|
274
|
+
}
|
275
|
+
interface ToastTransitionProps {
|
276
|
+
isIn: boolean;
|
277
|
+
done: () => void;
|
278
|
+
position: ToastPosition | string;
|
279
|
+
preventExitTransition: boolean;
|
280
|
+
nodeRef: React__default.RefObject<HTMLElement>;
|
281
|
+
children?: React__default.ReactNode;
|
282
|
+
playToast(): void;
|
283
|
+
}
|
284
|
+
/**
|
285
|
+
* @INTERNAL
|
286
|
+
*/
|
287
|
+
interface ToastProps extends ToastOptions {
|
288
|
+
isIn: boolean;
|
289
|
+
staleId?: Id;
|
290
|
+
toastId: Id;
|
291
|
+
key: Id;
|
292
|
+
transition: ToastTransition;
|
293
|
+
closeToast: CloseToastFunc;
|
294
|
+
position: ToastPosition;
|
295
|
+
children?: ToastContent;
|
296
|
+
draggablePercent: number;
|
297
|
+
draggableDirection?: DraggableDirection;
|
298
|
+
progressClassName?: ToastClassName;
|
299
|
+
className?: ToastClassName;
|
300
|
+
deleteToast: () => void;
|
301
|
+
theme: Theme;
|
302
|
+
type: TypeOptions;
|
303
|
+
collapseAll: () => void;
|
304
|
+
stacked?: boolean;
|
305
|
+
}
|
306
|
+
/**
|
307
|
+
* @INTERNAL
|
308
|
+
*/
|
309
|
+
interface Toast {
|
310
|
+
content: ToastContent;
|
311
|
+
props: ToastProps;
|
312
|
+
toggle?: (v: boolean) => void;
|
313
|
+
removalReason?: true | undefined;
|
314
|
+
isActive: boolean;
|
315
|
+
staleId?: Id;
|
316
|
+
}
|
317
|
+
type ToastItemStatus = 'added' | 'removed' | 'updated';
|
318
|
+
interface ToastItem<Data = {}> {
|
319
|
+
content: ToastContent<Data>;
|
320
|
+
id: Id;
|
321
|
+
theme?: Theme;
|
322
|
+
type?: TypeOptions;
|
323
|
+
isLoading?: boolean;
|
324
|
+
containerId?: Id;
|
325
|
+
data: Data;
|
326
|
+
icon?: ToastIcon;
|
327
|
+
status: ToastItemStatus;
|
328
|
+
reason?: boolean | string;
|
329
|
+
}
|
330
|
+
type OnChangeCallback = (toast: ToastItem) => void;
|
331
|
+
type IdOpts = {
|
332
|
+
id?: Id;
|
333
|
+
containerId?: Id;
|
334
|
+
};
|
335
|
+
type ClearWaitingQueueFunc = typeof clearWaitingQueue;
|
336
|
+
|
337
|
+
declare const enum Default {
|
338
|
+
COLLAPSE_DURATION = 300,
|
339
|
+
DEBOUNCE_DURATION = 50,
|
340
|
+
CSS_NAMESPACE = "Toastify",
|
341
|
+
DRAGGABLE_PERCENT = 80,
|
342
|
+
CONTAINER_ID = 1
|
343
|
+
}
|
344
|
+
|
345
|
+
interface CSSTransitionProps {
|
346
|
+
/**
|
347
|
+
* Css class to apply when toast enter
|
348
|
+
*/
|
349
|
+
enter: string;
|
350
|
+
/**
|
351
|
+
* Css class to apply when toast leave
|
352
|
+
*/
|
353
|
+
exit: string;
|
354
|
+
/**
|
355
|
+
* Append current toast position to the classname.
|
356
|
+
* If multiple classes are provided, only the last one will get the position
|
357
|
+
* For instance `myclass--top-center`...
|
358
|
+
* `Default: false`
|
359
|
+
*/
|
360
|
+
appendPosition?: boolean;
|
361
|
+
/**
|
362
|
+
* Collapse toast smoothly when exit animation end
|
363
|
+
* `Default: true`
|
364
|
+
*/
|
365
|
+
collapse?: boolean;
|
366
|
+
/**
|
367
|
+
* Collapse transition duration
|
368
|
+
* `Default: 300`
|
369
|
+
*/
|
370
|
+
collapseDuration?: number;
|
371
|
+
}
|
372
|
+
/**
|
373
|
+
* Css animation that just work.
|
374
|
+
* You could use animate.css for instance
|
375
|
+
*
|
376
|
+
*
|
377
|
+
* ```
|
378
|
+
* cssTransition({
|
379
|
+
* enter: "animate__animated animate__bounceIn",
|
380
|
+
* exit: "animate__animated animate__bounceOut"
|
381
|
+
* })
|
382
|
+
* ```
|
383
|
+
*
|
384
|
+
*/
|
385
|
+
declare function cssTransition({ enter, exit, appendPosition, collapse, collapseDuration }: CSSTransitionProps): ({ children, position, preventExitTransition, done, nodeRef, isIn, playToast }: ToastTransitionProps) => React__default.JSX.Element;
|
386
|
+
|
387
|
+
/**
|
388
|
+
* Used to collapse toast after exit animation
|
389
|
+
*/
|
390
|
+
declare function collapseToast(node: HTMLElement, done: () => void, duration?: Default): void;
|
391
|
+
|
392
|
+
declare function toast<TData = unknown>(content: ToastContent<TData>, options?: ToastOptions<TData>): Id;
|
393
|
+
declare namespace toast {
|
394
|
+
var loading: <TData = unknown>(content: ToastContent<TData>, options?: ToastOptions<TData>) => Id;
|
395
|
+
var promise: typeof handlePromise;
|
396
|
+
var success: <TData = unknown>(content: ToastContent<TData>, options?: ToastOptions<TData>) => Id;
|
397
|
+
var info: <TData = unknown>(content: ToastContent<TData>, options?: ToastOptions<TData>) => Id;
|
398
|
+
var error: <TData = unknown>(content: ToastContent<TData>, options?: ToastOptions<TData>) => Id;
|
399
|
+
var warning: <TData = unknown>(content: ToastContent<TData>, options?: ToastOptions<TData>) => Id;
|
400
|
+
var warn: <TData = unknown>(content: ToastContent<TData>, options?: ToastOptions<TData>) => Id;
|
401
|
+
var dark: (content: ToastContent, options?: ToastOptions) => Id;
|
402
|
+
var dismiss: {
|
403
|
+
(params: RemoveParams): void;
|
404
|
+
(params?: Id): void;
|
405
|
+
};
|
406
|
+
var clearWaitingQueue: (p?: ClearWaitingQueueParams) => void;
|
407
|
+
var isActive: typeof isToastActive;
|
408
|
+
var update: <TData = unknown>(toastId: Id, options?: UpdateOptions<TData>) => void;
|
409
|
+
var done: (id: Id) => void;
|
410
|
+
var onChange: (cb: OnChangeCallback) => () => void;
|
411
|
+
var play: (opts?: IdOpts) => void;
|
412
|
+
var pause: (opts?: IdOpts) => void;
|
413
|
+
}
|
414
|
+
interface ToastPromiseParams<TData = unknown, TError = unknown, TPending = unknown> {
|
415
|
+
pending?: string | UpdateOptions<TPending>;
|
416
|
+
success?: string | UpdateOptions<TData>;
|
417
|
+
error?: string | UpdateOptions<TError>;
|
418
|
+
}
|
419
|
+
declare function handlePromise<TData = unknown, TError = unknown, TPending = unknown>(promise: Promise<TData> | (() => Promise<TData>), { pending, error, success }: ToastPromiseParams<TData, TError, TPending>, options?: ToastOptions<TData>): Promise<TData>;
|
420
|
+
interface RemoveParams {
|
421
|
+
id?: Id;
|
422
|
+
containerId: Id;
|
423
|
+
}
|
424
|
+
|
425
|
+
declare function useToastContainer(props: ToastContainerProps): {
|
426
|
+
getToastToRender: <T>(cb: (position: ToastPosition, toastList: Toast[]) => T) => T[];
|
427
|
+
isToastActive: typeof isToastActive;
|
428
|
+
count: number;
|
429
|
+
};
|
430
|
+
|
431
|
+
export { Bounce, type ClearWaitingQueueFunc, type ClearWaitingQueueParams, CloseButton, type CloseButtonProps, type DraggableDirection, Flip, type IconProps, Icons, type Id, type OnChangeCallback, Slide, type Theme, type ToastClassName, ToastContainer, type ToastContainerProps, type ToastContent, type ToastContentProps, type ToastIcon, type ToastItem, type ToastOptions, type ToastPosition, type ToastPromiseParams, type ToastTransition, type ToastTransitionProps, type TypeOptions, type UpdateOptions, Zoom, collapseToast, cssTransition, toast, useToastContainer };
|
package/dist/unstyled.js
ADDED
@@ -0,0 +1,3 @@
|
|
1
|
+
"use client";
|
2
|
+
var Xt=Object.create;var Z=Object.defineProperty;var Qt=Object.getOwnPropertyDescriptor;var Wt=Object.getOwnPropertyNames;var Gt=Object.getPrototypeOf,qt=Object.prototype.hasOwnProperty;var Kt=(t,o)=>{for(var e in o)Z(t,e,{get:o[e],enumerable:!0})},xt=(t,o,e,i)=>{if(o&&typeof o=="object"||typeof o=="function")for(let a of Wt(o))!qt.call(t,a)&&a!==e&&Z(t,a,{get:()=>o[a],enumerable:!(i=Qt(o,a))||i.enumerable});return t};var $=(t,o,e)=>(e=t!=null?Xt(Gt(t)):{},xt(o||!t||!t.__esModule?Z(e,"default",{value:t,enumerable:!0}):e,t)),Yt=t=>xt(Z({},"__esModule",{value:!0}),t);var po={};Kt(po,{Bounce:()=>mt,Flip:()=>Vt,Icons:()=>K,Slide:()=>Ut,ToastContainer:()=>Ct,Zoom:()=>Ht,collapseToast:()=>J,cssTransition:()=>X,toast:()=>u,useToastContainer:()=>it});module.exports=Yt(po);var Et=require("react"),V=t=>typeof t=="number"&&!isNaN(t),R=t=>typeof t=="string",I=t=>typeof t=="function",Pt=t=>R(t)||V(t),Q=t=>R(t)||I(t)?t:null,It=(t,o)=>t===!1||V(t)&&t>0?t:o,W=t=>(0,Et.isValidElement)(t)||R(t)||I(t)||V(t);var z=$(require("react"));function J(t,o,e=300){let{scrollHeight:i,style:a}=t;requestAnimationFrame(()=>{a.minHeight="initial",a.height=i+"px",a.transition=`all ${e}ms`,requestAnimationFrame(()=>{a.height="0",a.padding="0",a.margin="0",setTimeout(o,e)})})}function X({enter:t,exit:o,appendPosition:e=!1,collapse:i=!0,collapseDuration:a=300}){return function({children:s,position:c,preventExitTransition:d,done:T,nodeRef:y,isIn:h,playToast:C}){let x=e?`${t}--${c}`:t,w=e?`${o}--${c}`:o,E=(0,z.useRef)(0);return(0,z.useLayoutEffect)(()=>{let _=y.current,b=x.split(" "),g=r=>{r.target===y.current&&(C(),_.removeEventListener("animationend",g),_.removeEventListener("animationcancel",g),E.current===0&&r.type!=="animationcancel"&&_.classList.remove(...b))};(()=>{_.classList.add(...b),_.addEventListener("animationend",g),_.addEventListener("animationcancel",g)})()},[]),(0,z.useEffect)(()=>{let _=y.current,b=()=>{_.removeEventListener("animationend",b),i?J(_,T,a):T()};h||(d?b():(()=>{E.current=1,_.className+=` ${w}`,_.addEventListener("animationend",b)})())},[h]),z.default.createElement(z.default.Fragment,null,s)}}var tt=require("react");function ut(t,o){return{content:yt(t.content,t.props),containerId:t.props.containerId,id:t.props.toastId,theme:t.props.theme,type:t.props.type,data:t.props.data||{},isLoading:t.props.isLoading,icon:t.props.icon,reason:t.removalReason,status:o}}function yt(t,o,e=!1){return(0,tt.isValidElement)(t)&&!R(t.type)?(0,tt.cloneElement)(t,{closeToast:o.closeToast,toastProps:o,data:o.data,isPaused:e}):I(t)?t({closeToast:o.closeToast,toastProps:o,data:o.data,isPaused:e}):t}var ot=$(require("react"));function St({closeToast:t,theme:o,ariaLabel:e="close"}){return ot.default.createElement("button",{className:`Toastify__close-button Toastify__close-button--${o}`,type:"button",onClick:i=>{i.stopPropagation(),t(!0)},"aria-label":e},ot.default.createElement("svg",{"aria-hidden":"true",viewBox:"0 0 14 16"},ot.default.createElement("path",{fillRule:"evenodd",d:"M7.71 8.23l3.75 3.75-1.48 1.48-3.75-3.75-3.75 3.75L1 11.98l3.75-3.75L1 4.48 2.48 3l3.75 3.75L9.98 3l1.48 1.48-3.75 3.75z"})))}var et=$(require("react")),Tt=$(require("clsx"));function kt({delay:t,isRunning:o,closeToast:e,type:i="default",hide:a,className:l,controlledProgress:s,progress:c,rtl:d,isIn:T,theme:y}){let h=a||s&&c===0,C={animationDuration:`${t}ms`,animationPlayState:o?"running":"paused"};s&&(C.transform=`scaleX(${c})`);let x=(0,Tt.default)("Toastify__progress-bar",s?"Toastify__progress-bar--controlled":"Toastify__progress-bar--animated",`Toastify__progress-bar-theme--${y}`,`Toastify__progress-bar--${i}`,{["Toastify__progress-bar--rtl"]:d}),w=I(l)?l({rtl:d,type:i,defaultClassName:x}):(0,Tt.default)(x,l),E={[s&&c>=1?"onTransitionEnd":"onAnimationEnd"]:s&&c<1?null:()=>{T&&e()}};return et.default.createElement("div",{className:"Toastify__progress-bar--wrp","data-hidden":h},et.default.createElement("div",{className:`Toastify__progress-bar--bg Toastify__progress-bar-theme--${y} Toastify__progress-bar--${i}`}),et.default.createElement("div",{role:"progressbar","aria-hidden":h?"true":"false","aria-label":"notification timer",className:w,style:C,...E}))}var ht=$(require("clsx")),A=$(require("react"));var Zt=1,gt=()=>`${Zt++}`;function At(t,o,e){let i=1,a=0,l=[],s=[],c=o,d=new Map,T=new Set,y=n=>(T.add(n),()=>T.delete(n)),h=()=>{s=Array.from(d.values()),T.forEach(n=>n())},C=({containerId:n,toastId:r,updateId:f})=>{let p=n?n!==t:t!==1,m=d.has(r)&&f==null;return p||m},x=(n,r)=>{d.forEach(f=>{var p;(r==null||r===f.props.toastId)&&((p=f.toggle)==null||p.call(f,n))})},w=n=>{var r,f;(f=(r=n.props)==null?void 0:r.onClose)==null||f.call(r,n.removalReason),n.isActive=!1},E=n=>{if(n==null)d.forEach(w);else{let r=d.get(n);r&&w(r)}h()},_=()=>{a-=l.length,l=[]},b=n=>{var m,v;let{toastId:r,updateId:f}=n.props,p=f==null;n.staleId&&d.delete(n.staleId),n.isActive=!0,d.set(r,n),h(),e(ut(n,p?"added":"updated")),p&&((v=(m=n.props).onOpen)==null||v.call(m))};return{id:t,props:c,observe:y,toggle:x,removeToast:E,toasts:d,clearQueue:_,buildToast:(n,r)=>{if(C(r))return;let{toastId:f,updateId:p,data:m,staleId:v,delay:O}=r,M=p==null;M&&a++;let D={...c,style:c.toastStyle,key:i++,...Object.fromEntries(Object.entries(r).filter(([P,N])=>N!=null)),toastId:f,updateId:p,data:m,isIn:!1,className:Q(r.className||c.toastClassName),progressClassName:Q(r.progressClassName||c.progressClassName),autoClose:r.isLoading?!1:It(r.autoClose,c.autoClose),closeToast(P){d.get(f).removalReason=P,E(f)},deleteToast(){let P=d.get(f);if(P!=null){if(e(ut(P,"removed")),d.delete(f),a--,a<0&&(a=0),l.length>0){b(l.shift());return}h()}}};D.closeButton=c.closeButton,r.closeButton===!1||W(r.closeButton)?D.closeButton=r.closeButton:r.closeButton===!0&&(D.closeButton=W(c.closeButton)?c.closeButton:!0);let L={content:n,props:D,staleId:v};c.limit&&c.limit>0&&a>c.limit&&M?l.push(L):V(O)?setTimeout(()=>{b(L)},O):b(L)},setProps(n){c=n},setToggle:(n,r)=>{let f=d.get(n);f&&(f.toggle=r)},isToastActive:n=>{var r;return(r=d.get(n))==null?void 0:r.isActive},getSnapshot:()=>s}}var S=new Map,G=[],_t=new Set,Jt=t=>_t.forEach(o=>o(t)),Ot=()=>S.size>0;function to(){G.forEach(t=>bt(t.content,t.options)),G=[]}var Nt=(t,{containerId:o})=>{var e;return(e=S.get(o||1))==null?void 0:e.toasts.get(t)};function at(t,o){var i;if(o)return!!((i=S.get(o))!=null&&i.isToastActive(t));let e=!1;return S.forEach(a=>{a.isToastActive(t)&&(e=!0)}),e}function wt(t){if(!Ot()){G=G.filter(o=>t!=null&&o.options.toastId!==t);return}if(t==null||Pt(t))S.forEach(o=>{o.removeToast(t)});else if(t&&("containerId"in t||"id"in t)){let o=S.get(t.containerId);o?o.removeToast(t.id):S.forEach(e=>{e.removeToast(t.id)})}}var Dt=(t={})=>{S.forEach(o=>{o.props.limit&&(!t.containerId||o.id===t.containerId)&&o.clearQueue()})};function bt(t,o){W(t)&&(Ot()||G.push({content:t,options:o}),S.forEach(e=>{e.buildToast(t,o)}))}function Lt(t){var o;(o=S.get(t.containerId||1))==null||o.setToggle(t.id,t.fn)}function vt(t,o){S.forEach(e=>{(o==null||!(o!=null&&o.containerId)||(o==null?void 0:o.containerId)===e.id)&&e.toggle(t,o==null?void 0:o.id)})}function Mt(t){let o=t.containerId||1;return{subscribe(e){let i=At(o,t,Jt);S.set(o,i);let a=i.observe(e);return to(),()=>{a(),S.delete(o)}},setProps(e){var i;(i=S.get(o))==null||i.setProps(e)},getSnapshot(){var e;return(e=S.get(o))==null?void 0:e.getSnapshot()}}}function $t(t){return _t.add(t),()=>{_t.delete(t)}}function oo(t){return t&&(R(t.toastId)||V(t.toastId))?t.toastId:gt()}function q(t,o){return bt(t,o),o.toastId}function st(t,o){return{...o,type:o&&o.type||t,toastId:oo(o)}}function rt(t){return(o,e)=>q(o,st(t,e))}function u(t,o){return q(t,st("default",o))}u.loading=(t,o)=>q(t,st("default",{isLoading:!0,autoClose:!1,closeOnClick:!1,closeButton:!1,draggable:!1,...o}));function eo(t,{pending:o,error:e,success:i},a){let l;o&&(l=R(o)?u.loading(o,a):u.loading(o.render,{...a,...o}));let s={isLoading:null,autoClose:null,closeOnClick:null,closeButton:null,draggable:null},c=(T,y,h)=>{if(y==null){u.dismiss(l);return}let C={type:T,...s,...a,data:h},x=R(y)?{render:y}:y;return l?u.update(l,{...C,...x}):u(x.render,{...C,...x}),h},d=I(t)?t():t;return d.then(T=>c("success",i,T)).catch(T=>c("error",e,T)),d}u.promise=eo;u.success=rt("success");u.info=rt("info");u.error=rt("error");u.warning=rt("warning");u.warn=u.warning;u.dark=(t,o)=>q(t,st("default",{theme:"dark",...o}));function ao(t){wt(t)}u.dismiss=ao;u.clearWaitingQueue=Dt;u.isActive=at;u.update=(t,o={})=>{let e=Nt(t,o);if(e){let{props:i,content:a}=e,l={delay:100,...i,...o,toastId:o.toastId||t,updateId:gt()};l.toastId!==t&&(l.staleId=t);let s=l.render||a;delete l.render,q(s,l)}};u.done=t=>{u.update(t,{progress:1})};u.onChange=$t;u.play=t=>vt(!0,t);u.pause=t=>vt(!1,t);var nt=require("react");function it(t){var s;let{subscribe:o,getSnapshot:e,setProps:i}=(0,nt.useRef)(Mt(t)).current;i(t);let a=(s=(0,nt.useSyncExternalStore)(o,e,e))==null?void 0:s.slice();function l(c){if(!a)return[];let d=new Map;return t.newestOnTop&&a.reverse(),a.forEach(T=>{let{position:y}=T.props;d.has(y)||d.set(y,[]),d.get(y).push(T)}),Array.from(d,T=>c(T[0],T[1]))}return{getToastToRender:l,isToastActive:at,count:a==null?void 0:a.length}}var U=require("react");function Rt(t){let[o,e]=(0,U.useState)(!1),[i,a]=(0,U.useState)(!1),l=(0,U.useRef)(null),s=(0,U.useRef)({start:0,delta:0,removalDistance:0,canCloseOnClick:!0,canDrag:!1,didMove:!1}).current,{autoClose:c,pauseOnHover:d,closeToast:T,onClick:y,closeOnClick:h}=t;Lt({id:t.toastId,containerId:t.containerId,fn:e}),(0,U.useEffect)(()=>{if(t.pauseOnFocusLoss)return C(),()=>{x()}},[t.pauseOnFocusLoss]);function C(){document.hasFocus()||b(),window.addEventListener("focus",_),window.addEventListener("blur",b)}function x(){window.removeEventListener("focus",_),window.removeEventListener("blur",b)}function w(m){if(t.draggable===!0||t.draggable===m.pointerType){g();let v=l.current;s.canCloseOnClick=!0,s.canDrag=!0,v.style.transition="none",t.draggableDirection==="x"?(s.start=m.clientX,s.removalDistance=v.offsetWidth*(t.draggablePercent/100)):(s.start=m.clientY,s.removalDistance=v.offsetHeight*(t.draggablePercent===80?t.draggablePercent*1.5:t.draggablePercent)/100)}}function E(m){let{top:v,bottom:O,left:M,right:D}=l.current.getBoundingClientRect();m.nativeEvent.type!=="touchend"&&t.pauseOnHover&&m.clientX>=M&&m.clientX<=D&&m.clientY>=v&&m.clientY<=O?b():_()}function _(){e(!0)}function b(){e(!1)}function g(){s.didMove=!1,document.addEventListener("pointermove",r),document.addEventListener("pointerup",f)}function n(){document.removeEventListener("pointermove",r),document.removeEventListener("pointerup",f)}function r(m){let v=l.current;if(s.canDrag&&v){s.didMove=!0,o&&b(),t.draggableDirection==="x"?s.delta=m.clientX-s.start:s.delta=m.clientY-s.start,s.start!==m.clientX&&(s.canCloseOnClick=!1);let O=t.draggableDirection==="x"?`${s.delta}px, var(--y)`:`0, calc(${s.delta}px + var(--y))`;v.style.transform=`translate3d(${O},0)`,v.style.opacity=`${1-Math.abs(s.delta/s.removalDistance)}`}}function f(){n();let m=l.current;if(s.canDrag&&s.didMove&&m){if(s.canDrag=!1,Math.abs(s.delta)>s.removalDistance){a(!0),t.closeToast(!0),t.collapseAll();return}m.style.transition="transform 0.2s, opacity 0.2s",m.style.removeProperty("transform"),m.style.removeProperty("opacity")}}let p={onPointerDown:w,onPointerUp:E};return c&&d&&(p.onMouseEnter=b,t.stacked||(p.onMouseLeave=_)),h&&(p.onClick=m=>{y&&y(m),s.canCloseOnClick&&T(!0)}),{playToast:_,pauseToast:b,isRunning:o,preventExitTransition:i,toastRef:l,eventHandlers:p}}var lt=require("react"),Bt=typeof window!="undefined"?lt.useLayoutEffect:lt.useEffect;var ct=$(require("clsx")),F=$(require("react"));var k=$(require("react"));var ft=({theme:t,type:o,isLoading:e,...i})=>k.default.createElement("svg",{viewBox:"0 0 24 24",width:"100%",height:"100%",fill:t==="colored"?"currentColor":`var(--toastify-icon-color-${o})`,...i});function ro(t){return k.default.createElement(ft,{...t},k.default.createElement("path",{d:"M23.32 17.191L15.438 2.184C14.728.833 13.416 0 11.996 0c-1.42 0-2.733.833-3.443 2.184L.533 17.448a4.744 4.744 0 000 4.368C1.243 23.167 2.555 24 3.975 24h16.05C22.22 24 24 22.044 24 19.632c0-.904-.251-1.746-.68-2.44zm-9.622 1.46c0 1.033-.724 1.823-1.698 1.823s-1.698-.79-1.698-1.822v-.043c0-1.028.724-1.822 1.698-1.822s1.698.79 1.698 1.822v.043zm.039-12.285l-.84 8.06c-.057.581-.408.943-.897.943-.49 0-.84-.367-.896-.942l-.84-8.065c-.057-.624.25-1.095.779-1.095h1.91c.528.005.84.476.784 1.1z"}))}function no(t){return k.default.createElement(ft,{...t},k.default.createElement("path",{d:"M12 0a12 12 0 1012 12A12.013 12.013 0 0012 0zm.25 5a1.5 1.5 0 11-1.5 1.5 1.5 1.5 0 011.5-1.5zm2.25 13.5h-4a1 1 0 010-2h.75a.25.25 0 00.25-.25v-4.5a.25.25 0 00-.25-.25h-.75a1 1 0 010-2h1a2 2 0 012 2v4.75a.25.25 0 00.25.25h.75a1 1 0 110 2z"}))}function io(t){return k.default.createElement(ft,{...t},k.default.createElement("path",{d:"M12 0a12 12 0 1012 12A12.014 12.014 0 0012 0zm6.927 8.2l-6.845 9.289a1.011 1.011 0 01-1.43.188l-4.888-3.908a1 1 0 111.25-1.562l4.076 3.261 6.227-8.451a1 1 0 111.61 1.183z"}))}function lo(t){return k.default.createElement(ft,{...t},k.default.createElement("path",{d:"M11.983 0a12.206 12.206 0 00-8.51 3.653A11.8 11.8 0 000 12.207 11.779 11.779 0 0011.8 24h.214A12.111 12.111 0 0024 11.791 11.766 11.766 0 0011.983 0zM10.5 16.542a1.476 1.476 0 011.449-1.53h.027a1.527 1.527 0 011.523 1.47 1.475 1.475 0 01-1.449 1.53h-.027a1.529 1.529 0 01-1.523-1.47zM11 12.5v-6a1 1 0 012 0v6a1 1 0 11-2 0z"}))}function fo(){return k.default.createElement("div",{className:"Toastify__spinner"})}var K={info:no,warning:ro,success:io,error:lo,spinner:fo},co=t=>t in K;function zt({theme:t,type:o,isLoading:e,icon:i}){let a=null,l={theme:t,type:o};return i===!1||(I(i)?a=i({...l,isLoading:e}):(0,k.isValidElement)(i)?a=(0,k.cloneElement)(i,l):e?a=K.spinner():co(o)&&(a=K[o](l))),a}var Ft=t=>{let{isRunning:o,preventExitTransition:e,toastRef:i,eventHandlers:a,playToast:l}=Rt(t),{closeButton:s,children:c,autoClose:d,onClick:T,type:y,hideProgressBar:h,closeToast:C,transition:x,position:w,className:E,style:_,progressClassName:b,updateId:g,role:n,progress:r,rtl:f,toastId:p,deleteToast:m,isIn:v,isLoading:O,closeOnClick:M,theme:D,ariaLabel:L}=t,P=(0,ct.default)("Toastify__toast",`Toastify__toast-theme--${D}`,`Toastify__toast--${y}`,{["Toastify__toast--rtl"]:f},{["Toastify__toast--close-on-click"]:M}),N=I(E)?E({rtl:f,position:w,type:y,defaultClassName:P}):(0,ct.default)(P,E),H=zt(t),Y=!!r||!d,pt={closeToast:C,type:y,theme:D},j=null;return s===!1||(I(s)?j=s(pt):(0,F.isValidElement)(s)?j=(0,F.cloneElement)(s,pt):j=St(pt)),F.default.createElement(x,{isIn:v,done:m,position:w,preventExitTransition:e,nodeRef:i,playToast:l},F.default.createElement("div",{id:p,tabIndex:0,onClick:T,"data-in":v,className:N,...a,style:_,ref:i,...v&&{role:n,"aria-label":L}},H!=null&&F.default.createElement("div",{className:(0,ct.default)("Toastify__toast-icon",{["Toastify--animate-icon Toastify__zoom-enter"]:!O})},H),yt(c,t,!o),j,!t.customProgressBar&&F.default.createElement(kt,{...g&&!Y?{key:`p-${g}`}:{},rtl:f,theme:D,delay:d,isRunning:o,isIn:v,closeToast:C,hide:h,type:y,className:b,controlledProgress:Y,progress:r||0})))};var dt=(t,o=!1)=>({enter:`Toastify--animate Toastify__${t}-enter`,exit:`Toastify--animate Toastify__${t}-exit`,appendPosition:o}),mt=X(dt("bounce",!0)),Ut=X(dt("slide",!0)),Ht=X(dt("zoom")),Vt=X(dt("flip"));var mo={position:"top-right",transition:mt,autoClose:5e3,closeButton:!0,pauseOnHover:!0,pauseOnFocusLoss:!0,draggable:"touch",draggablePercent:80,draggableDirection:"x",role:"alert",theme:"light","aria-label":"Notifications Alt+T",hotKeys:t=>t.altKey&&t.code==="KeyT"};function Ct(t){let o={...mo,...t},e=t.underToastChildren||null,i=t.stacked,[a,l]=(0,A.useState)(!0),s=(0,A.useRef)(null),c=(0,A.useRef)(null),{getToastToRender:d,isToastActive:T,count:y}=it(o),{className:h,style:C,rtl:x,containerId:w,hotKeys:E}=o;function _(g){let n=(0,ht.default)("Toastify__toast-container",`Toastify__toast-container--${g}`,{["Toastify__toast-container--rtl"]:x});return I(h)?h({position:g,rtl:x,defaultClassName:n}):(0,ht.default)(n,Q(h))}function b(){i&&(l(!0),u.play())}return Bt(()=>{var g,n,r;if(i){let f=s.current.querySelectorAll('[data-in="true"]'),p=c==null?void 0:c.current,m=(p==null?void 0:p.getBoundingClientRect().height)||0,v=12,O=(g=o.position)==null?void 0:g.includes("top"),M=0,D=0;if(Array.from(f).reverse().forEach((L,P)=>{let N=L;N.classList.add("Toastify__toast--stacked"),P>0&&(N.dataset.collapsed=`${a}`),N.dataset.pos||(N.dataset.pos=O?"top":"bot");let H=M*(a?.2:1)+(a?0:v*P);!O&&f.length>1&&(H+=m),N.style.setProperty("--y",`${O?H:H*-1}px`),N.style.setProperty("--g",`${v}`),N.style.setProperty("--s",`${1-(a?D:0)}`),M+=N.offsetHeight,D+=.025}),p&&O&&a){let L=M*.2,P=((r=(n=f==null?void 0:f[0])==null?void 0:n.getBoundingClientRect())==null?void 0:r.height)||0;p.style.marginTop=`${L+P}px`}if(p&&O&&!a){let L=Array.from(f).reduce((P,N)=>{let Y=N.offsetHeight;return P+Y+v},0);p.style.marginTop=`${L}px`}}},[a,y,i]),(0,A.useEffect)(()=>{function g(n){var f;let r=s.current;E(n)&&((f=r.querySelector('[tabIndex="0"]'))==null||f.focus(),l(!1),u.pause()),n.key==="Escape"&&(document.activeElement===r||r!=null&&r.contains(document.activeElement))&&(l(!0),u.play())}return document.addEventListener("keydown",g),()=>{document.removeEventListener("keydown",g)}},[E]),A.default.createElement("section",{ref:s,className:"Toastify",id:w,onMouseEnter:()=>{i&&(l(!1),u.pause())},onMouseLeave:b,"aria-live":"polite","aria-atomic":"false","aria-relevant":"additions text","aria-label":o["aria-label"]},d((g,n)=>{let r=n.length?{...C}:{...C,pointerEvents:"none"};return A.default.createElement(A.Fragment,{key:`f-${g}`},A.default.createElement("div",{tabIndex:-1,className:_(g),"data-stacked":i,style:r,key:`c-${g}`},n.map(({content:f,props:p})=>A.default.createElement(Ft,{...p,stacked:i,collapseAll:b,isIn:T(p.toastId,p.containerId),key:`t-${p.key}`},f)),A.default.createElement("div",{ref:c,id:"underToastChildren",className:"Toastify__under-toast-children",style:{width:"100%",opacity:n.length>1?1:0,transition:"all 0.3s ease-in-out"}},e)))}))}0&&(module.exports={Bounce,Flip,Icons,Slide,ToastContainer,Zoom,collapseToast,cssTransition,toast,useToastContainer});
|
3
|
+
//# sourceMappingURL=unstyled.js.map
|