UNPKG

87.4 kBSource Map (JSON)View Raw
1{"version":3,"file":"react-toastify.esm.js","sources":["../src/utils/propValidator.ts","../src/utils/constant.ts","../src/utils/collapseToast.ts","../src/utils/cssTransition.tsx","../src/core/eventManager.ts","../src/hooks/useKeeper.ts","../src/hooks/toastContainerReducer.ts","../src/hooks/useToastContainer.ts","../src/hooks/useToast.ts","../src/components/CloseButton.tsx","../src/components/ProgressBar.tsx","../src/components/Icons.tsx","../src/components/Toast.tsx","../src/components/Transitions.tsx","../src/components/ToastContainer.tsx","../src/core/toast.tsx"],"sourcesContent":["import { isValidElement } from 'react';\n\nimport { Id } from '../types';\n\nexport function isNum(v: any): v is Number {\n return typeof v === 'number' && !isNaN(v);\n}\n\nexport function isBool(v: any): v is Boolean {\n return typeof v === 'boolean';\n}\n\nexport function isStr(v: any): v is String {\n return typeof v === 'string';\n}\n\nexport function isFn(v: any): v is Function {\n return typeof v === 'function';\n}\n\nexport function parseClassName(v: any) {\n return isStr(v) || isFn(v) ? v : null;\n}\n\nexport function isToastIdValid(toastId?: Id) {\n return toastId === 0 || toastId;\n}\n\nexport function getAutoCloseDelay(\n toastAutoClose?: false | number,\n containerAutoClose?: false | number\n) {\n return toastAutoClose === false ||\n (isNum(toastAutoClose) && toastAutoClose > 0)\n ? toastAutoClose\n : containerAutoClose;\n}\n\nexport const canUseDom = !!(\n typeof window !== 'undefined' &&\n window.document &&\n window.document.createElement\n);\n\nexport function canBeRendered<T>(content: T): boolean {\n return (\n isValidElement(content) || isStr(content) || isFn(content) || isNum(content)\n );\n}\n","import { ToastPosition, TypeOptions } from '../types';\n\ntype KeyOfPosition =\n | 'TOP_LEFT'\n | 'TOP_RIGHT'\n | 'TOP_CENTER'\n | 'BOTTOM_LEFT'\n | 'BOTTOM_RIGHT'\n | 'BOTTOM_CENTER';\n\ntype KeyOfType = 'INFO' | 'SUCCESS' | 'WARNING' | 'ERROR' | 'DEFAULT';\n\nexport const POSITION: { [key in KeyOfPosition]: ToastPosition } = {\n TOP_LEFT: 'top-left',\n TOP_RIGHT: 'top-right',\n TOP_CENTER: 'top-center',\n BOTTOM_LEFT: 'bottom-left',\n BOTTOM_RIGHT: 'bottom-right',\n BOTTOM_CENTER: 'bottom-center'\n};\n\nexport const TYPE: { [key in KeyOfType]: TypeOptions } = {\n INFO: 'info',\n SUCCESS: 'success',\n WARNING: 'warning',\n ERROR: 'error',\n DEFAULT: 'default'\n};\n\nexport const enum Default {\n COLLAPSE_DURATION = 300,\n DEBOUNCE_DURATION = 50,\n CSS_NAMESPACE = 'Toastify',\n DRAGGABLE_PERCENT = 80\n}\n\nexport const enum Direction {\n X = 'x',\n Y = 'y'\n}\n","import { Default } from './constant';\n\n/**\n * Used to collapse toast after exit animation\n */\nexport function collapseToast(\n node: HTMLElement,\n done: () => void,\n duration = Default.COLLAPSE_DURATION\n) {\n const { scrollHeight, style } = node;\n\n requestAnimationFrame(() => {\n style.minHeight = 'initial';\n style.height = scrollHeight + 'px';\n style.transition = `all ${duration}ms`;\n\n requestAnimationFrame(() => {\n style.height = '0';\n style.padding = '0';\n style.margin = '0';\n setTimeout(done, duration as number);\n });\n });\n}\n","import React, { useEffect, useLayoutEffect, useRef } from 'react';\nimport { ToastTransitionProps } from '../types';\n\nimport { collapseToast } from './collapseToast';\nimport { Default } from './constant';\n\nexport interface CSSTransitionProps {\n /**\n * Css class to apply when toast enter\n */\n enter: string;\n\n /**\n * Css class to apply when toast leave\n */\n exit: string;\n\n /**\n * Append current toast position to the classname.\n * If multiple classes are provided, only the last one will get the position\n * For instance `myclass--top-center`...\n * `Default: false`\n */\n appendPosition?: boolean;\n\n /**\n * Collapse toast smoothly when exit animation end\n * `Default: true`\n */\n collapse?: boolean;\n\n /**\n * Collapse transition duration\n * `Default: 300`\n */\n collapseDuration?: number;\n}\n\nconst enum AnimationStep {\n Enter,\n Exit\n}\n\n/**\n * Css animation that just work.\n * You could use animate.css for instance\n *\n *\n * ```\n * cssTransition({\n * enter: \"animate__animated animate__bounceIn\",\n * exit: \"animate__animated animate__bounceOut\"\n * })\n * ```\n *\n */\nexport function cssTransition({\n enter,\n exit,\n appendPosition = false,\n collapse = true,\n collapseDuration = Default.COLLAPSE_DURATION\n}: CSSTransitionProps) {\n return function ToastTransition({\n children,\n position,\n preventExitTransition,\n done,\n nodeRef,\n isIn\n }: ToastTransitionProps) {\n const enterClassName = appendPosition ? `${enter}--${position}` : enter;\n const exitClassName = appendPosition ? `${exit}--${position}` : exit;\n const baseClassName = useRef<string>();\n const animationStep = useRef(AnimationStep.Enter);\n\n useLayoutEffect(() => {\n onEnter();\n }, []);\n\n useEffect(() => {\n if (!isIn) preventExitTransition ? onExited() : onExit();\n }, [isIn]);\n\n function onEnter() {\n const node = nodeRef.current!;\n baseClassName.current = node.className;\n node.className += ` ${enterClassName}`;\n node.addEventListener('animationend', onEntered);\n }\n\n function onEntered(e: AnimationEvent) {\n if (e.target !== nodeRef.current) return;\n\n const node = nodeRef.current!;\n node.removeEventListener('animationend', onEntered);\n if (animationStep.current === AnimationStep.Enter) {\n node.className = baseClassName.current!;\n }\n }\n\n function onExit() {\n animationStep.current = AnimationStep.Exit;\n const node = nodeRef.current!;\n\n node.className += ` ${exitClassName}`;\n node.addEventListener('animationend', onExited);\n }\n\n function onExited() {\n const node = nodeRef.current!;\n\n node.removeEventListener('animationend', onExited);\n collapse ? collapseToast(node, done, collapseDuration) : done();\n }\n\n return <>{children}</>;\n };\n}\n","import {\n Id,\n ToastContent,\n ClearWaitingQueueParams,\n NotValidatedToastProps\n} from '../types';\nimport { ContainerInstance } from '../hooks';\n\nexport const enum Event {\n Show,\n Clear,\n DidMount,\n WillUnmount,\n Change,\n ClearWaitingQueue\n}\n\ntype OnShowCallback = (\n content: ToastContent,\n options: NotValidatedToastProps\n) => void;\ntype OnClearCallback = (id?: Id) => void;\ntype OnClearWaitingQueue = (params: ClearWaitingQueueParams) => void;\ntype OnDidMountCallback = (containerInstance: ContainerInstance) => void;\ntype OnWillUnmountCallback = OnDidMountCallback;\nexport type OnChangeCallback = (\n toast: number,\n containerId?: number | string\n) => void;\ntype Callback =\n | OnShowCallback\n | OnClearCallback\n | OnClearWaitingQueue\n | OnDidMountCallback\n | OnWillUnmountCallback\n | OnChangeCallback;\ntype TimeoutId = ReturnType<typeof setTimeout>;\n\nexport interface EventManager {\n list: Map<Event, Callback[]>;\n emitQueue: Map<Event, TimeoutId[]>;\n on(event: Event.Show, callback: OnShowCallback): EventManager;\n on(event: Event.Clear, callback: OnClearCallback): EventManager;\n on(\n event: Event.ClearWaitingQueue,\n callback: OnClearWaitingQueue\n ): EventManager;\n on(event: Event.DidMount, callback: OnDidMountCallback): EventManager;\n on(event: Event.WillUnmount, callback: OnWillUnmountCallback): EventManager;\n on(event: Event.Change, callback: OnChangeCallback): EventManager;\n off(event: Event, callback?: Callback): EventManager;\n cancelEmit(event: Event): EventManager;\n emit(\n event: Event.Show,\n content: React.ReactNode,\n options: NotValidatedToastProps\n ): void;\n emit(event: Event.Clear, id?: string | number): void;\n emit(event: Event.ClearWaitingQueue, params: ClearWaitingQueueParams): void;\n emit(event: Event.DidMount, containerInstance: ContainerInstance): void;\n emit(event: Event.WillUnmount, containerInstance: ContainerInstance): void;\n emit(event: Event.Change, toast: number, containerId?: number | string): void;\n}\n\nexport const eventManager: EventManager = {\n list: new Map(),\n emitQueue: new Map(),\n\n on(event: Event, callback: Callback) {\n this.list.has(event) || this.list.set(event, []);\n this.list.get(event)!.push(callback);\n return this;\n },\n\n off(event, callback) {\n if (callback) {\n const cb = this.list.get(event)!.filter(cb => cb !== callback);\n this.list.set(event, cb);\n return this;\n }\n this.list.delete(event);\n return this;\n },\n\n cancelEmit(event) {\n const timers = this.emitQueue.get(event);\n if (timers) {\n timers.forEach(clearTimeout);\n this.emitQueue.delete(event);\n }\n\n return this;\n },\n\n /**\n * Enqueue the event at the end of the call stack\n * Doing so let the user call toast as follow:\n * toast('1')\n * toast('2')\n * toast('3')\n * Without setTimemout the code above will not work\n */\n emit(event: Event, ...args: any[]) {\n this.list.has(event) &&\n this.list.get(event)!.forEach((callback: Callback) => {\n const timer: TimeoutId = setTimeout(() => {\n // @ts-ignore\n callback(...args);\n }, 0);\n\n this.emitQueue.has(event) || this.emitQueue.set(event, []);\n this.emitQueue.get(event)!.push(timer);\n });\n }\n};\n","import { useRef, useEffect } from 'react';\n\n/**\n * `useKeeper` is a helper around `useRef`.\n *\n * You don't need to access the `.current`property to get the value\n * If refresh is set to true. The ref will be updated every render\n */\nexport function useKeeper<T>(arg: T, refresh = false) {\n const ref = useRef<T>(arg);\n\n useEffect(() => {\n if (refresh) ref.current = arg;\n });\n\n return ref.current;\n}\n","import { Id } from '../types';\n\nimport { isToastIdValid } from '../utils';\n\nexport const enum ActionType {\n ADD,\n REMOVE\n}\nexport type State = Array<Id>;\nexport type Action =\n | { type: ActionType.ADD; toastId: Id; staleId?: Id }\n | { type: ActionType.REMOVE; toastId?: Id };\n\nexport function reducer(state: State, action: Action) {\n switch (action.type) {\n case ActionType.ADD:\n return [...state, action.toastId].filter(id => id !== action.staleId);\n case ActionType.REMOVE:\n return isToastIdValid(action.toastId)\n ? state.filter(id => id !== action.toastId)\n : [];\n }\n}\n","import {\n useEffect,\n useRef,\n useReducer,\n cloneElement,\n isValidElement\n} from 'react';\nimport {\n parseClassName,\n canBeRendered,\n isBool,\n isFn,\n isNum,\n isStr,\n isToastIdValid,\n getAutoCloseDelay,\n Direction,\n Default\n} from '../utils';\nimport { eventManager, Event } from '../core/eventManager';\n\nimport {\n Id,\n ToastContainerProps,\n ToastProps,\n ToastContent,\n Toast,\n ToastPosition,\n ClearWaitingQueueParams,\n NotValidatedToastProps,\n ToastTransition\n} from '../types';\nimport { useKeeper } from './useKeeper';\nimport { ActionType, reducer } from './toastContainerReducer';\n\ntype CollectionItem = Record<Id, Toast>;\ntype ToastToRender = Partial<Record<ToastPosition, Toast[]>>;\n\ninterface QueuedToast {\n toastContent: ToastContent;\n toastProps: ToastProps;\n staleId?: Id;\n}\n\nexport interface ContainerInstance {\n toastKey: number;\n displayedToast: number;\n props: ToastContainerProps;\n containerId?: Id | null;\n isToastActive: (toastId: Id) => boolean;\n getToast: (id: Id) => Toast | null;\n}\n\nexport function useToastContainer(props: ToastContainerProps) {\n const [, forceUpdate] = useReducer(x => x + 1, 0);\n const [toast, dispatch] = useReducer(reducer, []);\n const containerRef = useRef(null);\n let toastCount = useKeeper(0);\n let queue = useKeeper<QueuedToast[]>([]);\n const collection = useKeeper<CollectionItem>({});\n const instance = useKeeper<ContainerInstance>({\n toastKey: 1,\n displayedToast: 0,\n props,\n containerId: null,\n isToastActive: isToastActive,\n getToast: id => collection[id] || null\n });\n\n useEffect(() => {\n instance.containerId = props.containerId;\n eventManager\n .cancelEmit(Event.WillUnmount)\n .on(Event.Show, buildToast)\n .on(Event.Clear, toastId => containerRef.current && removeToast(toastId))\n .on(Event.ClearWaitingQueue, clearWaitingQueue)\n .emit(Event.DidMount, instance);\n\n return () => eventManager.emit(Event.WillUnmount, instance);\n }, []);\n\n useEffect(() => {\n instance.isToastActive = isToastActive;\n instance.displayedToast = toast.length;\n eventManager.emit(Event.Change, toast.length, props.containerId);\n }, [toast]);\n\n useEffect(() => {\n instance.props = props;\n });\n\n function isToastActive(id: Id) {\n return toast.indexOf(id) !== -1;\n }\n\n function clearWaitingQueue({ containerId }: ClearWaitingQueueParams) {\n const { limit } = instance.props;\n if (limit && (!containerId || instance.containerId === containerId)) {\n toastCount -= queue.length;\n queue = [];\n }\n }\n\n function removeToast(toastId?: Id) {\n dispatch({ type: ActionType.REMOVE, toastId });\n }\n\n function dequeueToast() {\n const { toastContent, toastProps, staleId } = queue.shift() as QueuedToast;\n appendToast(toastContent, toastProps, staleId);\n }\n\n /**\n * check if a container is attached to the dom\n * check for multi-container, build only if associated\n * check for duplicate toastId if no update\n */\n function isNotValid({\n containerId,\n toastId,\n updateId\n }: NotValidatedToastProps) {\n return !containerRef.current ||\n (instance.props.enableMultiContainer &&\n containerId !== instance.props.containerId) ||\n (collection[toastId] && updateId == null)\n ? true\n : false;\n }\n\n // this function and all the function called inside needs to rely on ref(`useKeeper`)\n function buildToast(\n content: ToastContent,\n { delay, staleId, ...options }: NotValidatedToastProps\n ) {\n if (!canBeRendered(content) || isNotValid(options)) return;\n\n const { toastId, updateId, data } = options;\n const { props } = instance;\n const closeToast = () => removeToast(toastId);\n const isNotAnUpdate = options.updateId == null;\n\n if (isNotAnUpdate) toastCount++;\n\n const toastProps: ToastProps = {\n toastId,\n updateId,\n isLoading: options.isLoading,\n theme: options.theme || props.theme!,\n icon: options.icon ?? props.icon,\n isIn: false,\n key: options.key || instance.toastKey++,\n type: options.type!,\n closeToast: closeToast,\n closeButton: options.closeButton,\n rtl: props.rtl,\n position: options.position || (props.position as ToastPosition),\n transition: options.transition || (props.transition as ToastTransition),\n className: parseClassName(options.className || props.toastClassName),\n bodyClassName: parseClassName(\n options.bodyClassName || props.bodyClassName\n ),\n style: options.style || props.toastStyle,\n bodyStyle: options.bodyStyle || props.bodyStyle,\n onClick: options.onClick || props.onClick,\n pauseOnHover: isBool(options.pauseOnHover)\n ? options.pauseOnHover\n : props.pauseOnHover,\n pauseOnFocusLoss: isBool(options.pauseOnFocusLoss)\n ? options.pauseOnFocusLoss\n : props.pauseOnFocusLoss,\n draggable: isBool(options.draggable)\n ? options.draggable\n : props.draggable,\n draggablePercent: isNum(options.draggablePercent)\n ? options.draggablePercent\n : (props.draggablePercent as number),\n draggableDirection:\n options.draggableDirection || props.draggableDirection,\n closeOnClick: isBool(options.closeOnClick)\n ? options.closeOnClick\n : props.closeOnClick,\n progressClassName: parseClassName(\n options.progressClassName || props.progressClassName\n ),\n progressStyle: options.progressStyle || props.progressStyle,\n autoClose: options.isLoading\n ? false\n : getAutoCloseDelay(options.autoClose, props.autoClose),\n hideProgressBar: isBool(options.hideProgressBar)\n ? options.hideProgressBar\n : props.hideProgressBar,\n progress: options.progress,\n role: isStr(options.role) ? options.role : props.role,\n deleteToast() {\n removeFromCollection(toastId);\n }\n };\n\n if (isFn(options.onOpen)) toastProps.onOpen = options.onOpen;\n if (isFn(options.onClose)) toastProps.onClose = options.onClose;\n\n // tweak for vertical dragging\n if (\n toastProps.draggableDirection === Direction.Y &&\n toastProps.draggablePercent === Default.DRAGGABLE_PERCENT\n ) {\n (toastProps.draggablePercent as number) *= 1.5;\n }\n\n let closeButton = props.closeButton;\n\n if (options.closeButton === false || canBeRendered(options.closeButton)) {\n closeButton = options.closeButton;\n } else if (options.closeButton === true) {\n closeButton = canBeRendered(props.closeButton) ? props.closeButton : true;\n }\n\n toastProps.closeButton = closeButton;\n\n let toastContent = content;\n\n if (isValidElement(content) && !isStr(content.type)) {\n toastContent = cloneElement(content, {\n closeToast,\n toastProps,\n data\n });\n } else if (isFn(content)) {\n toastContent = content({ closeToast, toastProps, data });\n }\n\n // not handling limit + delay by design. Waiting for user feedback first\n if (\n props.limit &&\n props.limit > 0 &&\n toastCount > props.limit &&\n isNotAnUpdate\n ) {\n queue.push({ toastContent, toastProps, staleId });\n } else if (isNum(delay) && (delay as number) > 0) {\n setTimeout(() => {\n appendToast(toastContent, toastProps, staleId);\n }, delay);\n } else {\n appendToast(toastContent, toastProps, staleId);\n }\n }\n\n function appendToast(\n content: ToastContent,\n toastProps: ToastProps,\n staleId?: Id\n ) {\n const { toastId } = toastProps;\n\n if (staleId) delete collection[staleId];\n\n collection[toastId] = {\n content,\n props: toastProps\n };\n dispatch({\n type: ActionType.ADD,\n toastId,\n staleId\n });\n }\n\n function removeFromCollection(toastId: Id) {\n delete collection[toastId];\n const queueLen = queue.length;\n toastCount = isToastIdValid(toastId)\n ? toastCount - 1\n : toastCount - instance.displayedToast;\n\n if (toastCount < 0) toastCount = 0;\n\n if (queueLen > 0) {\n const freeSlot = isToastIdValid(toastId) ? 1 : instance.props.limit!;\n\n if (queueLen === 1 || freeSlot === 1) {\n instance.displayedToast++;\n dequeueToast();\n } else {\n const toDequeue = freeSlot > queueLen ? queueLen : freeSlot;\n instance.displayedToast = toDequeue;\n\n for (let i = 0; i < toDequeue; i++) dequeueToast();\n }\n } else {\n forceUpdate();\n }\n }\n\n function getToastToRender<T>(\n cb: (position: ToastPosition, toastList: Toast[]) => T\n ) {\n const toastToRender: ToastToRender = {};\n const toastList = props.newestOnTop\n ? Object.keys(collection).reverse()\n : Object.keys(collection);\n\n for (let i = 0; i < toastList.length; i++) {\n const toast = collection[toastList[i]];\n const { position } = toast.props;\n toastToRender[position] || (toastToRender[position] = []);\n\n toastToRender[position]!.push(toast);\n }\n\n return (Object.keys(toastToRender) as Array<ToastPosition>).map(p =>\n cb(p, toastToRender[p]!)\n );\n }\n\n return {\n getToastToRender,\n collection,\n containerRef,\n isToastActive\n };\n}\n","import {\n useState,\n useRef,\n useEffect,\n isValidElement,\n DOMAttributes\n} from 'react';\n\nimport { isFn } from '../utils';\nimport { ToastProps } from '../types';\nimport { useKeeper } from './useKeeper';\nimport { Direction } from '../utils/constant';\n\ninterface Draggable {\n start: number;\n x: number;\n y: number;\n delta: number;\n removalDistance: number;\n canCloseOnClick: boolean;\n canDrag: boolean;\n boundingRect: DOMRect | null;\n}\n\ntype DragEvent = MouseEvent & TouchEvent;\n\nfunction getX(e: DragEvent) {\n return e.targetTouches && e.targetTouches.length >= 1\n ? e.targetTouches[0].clientX\n : e.clientX;\n}\n\nfunction getY(e: DragEvent) {\n return e.targetTouches && e.targetTouches.length >= 1\n ? e.targetTouches[0].clientY\n : e.clientY;\n}\n\nexport function useToast(props: ToastProps) {\n const [isRunning, setIsRunning] = useState(true);\n const [preventExitTransition, setPreventExitTransition] = useState(false);\n const toastRef = useRef<HTMLDivElement>(null);\n const drag = useKeeper<Draggable>({\n start: 0,\n x: 0,\n y: 0,\n delta: 0,\n removalDistance: 0,\n canCloseOnClick: true,\n canDrag: false,\n boundingRect: null\n });\n const syncProps = useKeeper(props, true);\n const { autoClose, pauseOnHover, closeToast, onClick, closeOnClick } = props;\n\n useEffect(() => {\n if (isFn(props.onOpen))\n props.onOpen(isValidElement(props.children) && props.children.props);\n\n return () => {\n if (isFn(syncProps.onClose))\n syncProps.onClose(\n isValidElement(syncProps.children) && syncProps.children.props\n );\n };\n }, []);\n\n useEffect(() => {\n props.draggable && bindDragEvents();\n return () => {\n props.draggable && unbindDragEvents();\n };\n }, [props.draggable]);\n\n useEffect(() => {\n props.pauseOnFocusLoss && bindFocusEvents();\n return () => {\n props.pauseOnFocusLoss && unbindFocusEvents();\n };\n }, [props.pauseOnFocusLoss]);\n\n function onDragStart(\n e: React.MouseEvent<HTMLElement, MouseEvent> | React.TouchEvent<HTMLElement>\n ) {\n if (props.draggable) {\n const toast = toastRef.current!;\n drag.canCloseOnClick = true;\n drag.canDrag = true;\n drag.boundingRect = toast.getBoundingClientRect();\n toast.style.transition = '';\n drag.x = getX(e.nativeEvent as DragEvent);\n drag.y = getY(e.nativeEvent as DragEvent);\n\n if (props.draggableDirection === Direction.X) {\n drag.start = drag.x;\n drag.removalDistance =\n toast.offsetWidth * (props.draggablePercent / 100);\n } else {\n drag.start = drag.y;\n drag.removalDistance =\n toast.offsetHeight * (props.draggablePercent / 100);\n }\n }\n }\n\n function onDragTransitionEnd() {\n if (drag.boundingRect) {\n const { top, bottom, left, right } = drag.boundingRect;\n\n if (\n props.pauseOnHover &&\n drag.x >= left &&\n drag.x <= right &&\n drag.y >= top &&\n drag.y <= bottom\n ) {\n pauseToast();\n } else {\n playToast();\n }\n }\n }\n\n function playToast() {\n setIsRunning(true);\n }\n\n function pauseToast() {\n setIsRunning(false);\n }\n\n function bindFocusEvents() {\n if (!document.hasFocus()) pauseToast();\n\n window.addEventListener('focus', playToast);\n window.addEventListener('blur', pauseToast);\n }\n\n function unbindFocusEvents() {\n window.removeEventListener('focus', playToast);\n window.removeEventListener('blur', pauseToast);\n }\n\n function bindDragEvents() {\n document.addEventListener('mousemove', onDragMove);\n document.addEventListener('mouseup', onDragEnd);\n\n document.addEventListener('touchmove', onDragMove);\n document.addEventListener('touchend', onDragEnd);\n }\n\n function unbindDragEvents() {\n document.removeEventListener('mousemove', onDragMove);\n document.removeEventListener('mouseup', onDragEnd);\n\n document.removeEventListener('touchmove', onDragMove);\n document.removeEventListener('touchend', onDragEnd);\n }\n\n function onDragMove(e: MouseEvent | TouchEvent) {\n if (drag.canDrag) {\n e.preventDefault();\n\n const toast = toastRef.current!;\n if (isRunning) pauseToast();\n\n drag.x = getX(e as DragEvent);\n drag.y = getY(e as DragEvent);\n\n if (props.draggableDirection === Direction.X) {\n drag.delta = drag.x - drag.start;\n } else {\n drag.delta = drag.y - drag.start;\n }\n\n // prevent false positif during a toast click\n if (drag.start !== drag.x) drag.canCloseOnClick = false;\n\n toast.style.transform = `translate${props.draggableDirection}(${drag.delta}px)`;\n toast.style.opacity = `${1 -\n Math.abs(drag.delta / drag.removalDistance)}`;\n }\n }\n\n function onDragEnd() {\n const toast = toastRef.current!;\n if (drag.canDrag) {\n drag.canDrag = false;\n\n if (Math.abs(drag.delta) > drag.removalDistance) {\n setPreventExitTransition(true);\n props.closeToast();\n return;\n }\n\n toast.style.transition = 'transform 0.2s, opacity 0.2s';\n toast.style.transform = `translate${props.draggableDirection}(0)`;\n toast.style.opacity = '1';\n }\n }\n\n const eventHandlers: DOMAttributes<HTMLElement> = {\n onMouseDown: onDragStart,\n onTouchStart: onDragStart,\n onMouseUp: onDragTransitionEnd,\n onTouchEnd: onDragTransitionEnd\n };\n\n if (autoClose && pauseOnHover) {\n eventHandlers.onMouseEnter = pauseToast;\n eventHandlers.onMouseLeave = playToast;\n }\n\n // prevent toast from closing when user drags the toast\n if (closeOnClick) {\n eventHandlers.onClick = (e: React.MouseEvent) => {\n onClick && onClick(e);\n drag.canCloseOnClick && closeToast();\n };\n }\n\n return {\n playToast,\n pauseToast,\n isRunning,\n preventExitTransition,\n toastRef,\n eventHandlers\n };\n}\n","import * as React from 'react';\nimport { Default } from '../utils';\nimport { Theme, TypeOptions } from '../types';\n\nexport interface CloseButtonProps {\n closeToast: (e: React.MouseEvent<HTMLElement>) => void;\n type: TypeOptions;\n ariaLabel?: string;\n theme: Theme;\n}\n\nexport function CloseButton({\n closeToast,\n theme,\n ariaLabel = 'close'\n}: CloseButtonProps) {\n return (\n <button\n className={`${Default.CSS_NAMESPACE}__close-button ${Default.CSS_NAMESPACE}__close-button--${theme}`}\n type=\"button\"\n onClick={e => {\n e.stopPropagation();\n closeToast(e);\n }}\n aria-label={ariaLabel}\n >\n <svg aria-hidden=\"true\" viewBox=\"0 0 14 16\">\n <path\n fillRule=\"evenodd\"\n 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\"\n />\n </svg>\n </button>\n );\n}\n","import * as React from 'react';\nimport cx from 'clsx';\n\nimport { TYPE, Default, isFn } from './../utils';\nimport { TypeOptions, ToastClassName, Theme } from '../types';\n\nexport interface ProgressBarProps {\n /**\n * The animation delay which determine when to close the toast\n */\n delay: number;\n\n /**\n * Whether or not the animation is running or paused\n */\n isRunning: boolean;\n\n /**\n * Func to close the current toast\n */\n closeToast: () => void;\n\n /**\n * Optional type : info, success ...\n */\n type: TypeOptions;\n\n /**\n * The theme that is currently used\n */\n theme: Theme;\n\n /**\n * Hide or not the progress bar\n */\n hide?: boolean;\n\n /**\n * Optionnal className\n */\n className?: ToastClassName;\n\n /**\n * Optionnal inline style\n */\n style?: React.CSSProperties;\n\n /**\n * Tell wether or not controlled progress bar is used\n */\n controlledProgress?: boolean;\n\n /**\n * Controlled progress value\n */\n progress?: number | string;\n\n /**\n * Support rtl content\n */\n rtl?: boolean;\n\n /**\n * Tell if the component is visible on screen or not\n */\n isIn?: boolean;\n}\n\nexport function ProgressBar({\n delay,\n isRunning,\n closeToast,\n type,\n hide,\n className,\n style: userStyle,\n controlledProgress,\n progress,\n rtl,\n isIn,\n theme\n}: ProgressBarProps) {\n const style: React.CSSProperties = {\n ...userStyle,\n animationDuration: `${delay}ms`,\n animationPlayState: isRunning ? 'running' : 'paused',\n opacity: hide ? 0 : 1\n };\n\n if (controlledProgress) style.transform = `scaleX(${progress})`;\n const defaultClassName = cx(\n `${Default.CSS_NAMESPACE}__progress-bar`,\n controlledProgress\n ? `${Default.CSS_NAMESPACE}__progress-bar--controlled`\n : `${Default.CSS_NAMESPACE}__progress-bar--animated`,\n `${Default.CSS_NAMESPACE}__progress-bar-theme--${theme}`,\n `${Default.CSS_NAMESPACE}__progress-bar--${type}`,\n {\n [`${Default.CSS_NAMESPACE}__progress-bar--rtl`]: rtl\n }\n );\n const classNames = isFn(className)\n ? className({\n rtl,\n type,\n defaultClassName\n })\n : cx(defaultClassName, className);\n\n // 🧐 controlledProgress is derived from progress\n // so if controlledProgress is set\n // it means that this is also the case for progress\n const animationEvent = {\n [controlledProgress && progress! >= 1\n ? 'onTransitionEnd'\n : 'onAnimationEnd']:\n controlledProgress && progress! < 1\n ? null\n : () => {\n isIn && closeToast();\n }\n };\n\n // TODO: add aria-valuenow, aria-valuemax, aria-valuemin\n\n return (\n <div\n role=\"progressbar\"\n aria-hidden={hide ? 'true' : 'false'}\n aria-label=\"notification timer\"\n className={classNames}\n style={style}\n {...animationEvent}\n />\n );\n}\n\nProgressBar.defaultProps = {\n type: TYPE.DEFAULT,\n hide: false\n};\n","import React from 'react';\n\nimport { Theme, TypeOptions } from '../types';\nimport { Default } from '../utils';\n\n/**\n * Used when providing custom icon\n */\nexport interface IconProps {\n theme: Theme;\n type: TypeOptions;\n}\n\nexport type BuiltInIconProps = React.SVGProps<SVGSVGElement> & IconProps;\n\nconst Svg: React.FC<BuiltInIconProps> = ({ theme, type, ...rest }) => (\n <svg\n viewBox=\"0 0 24 24\"\n width=\"100%\"\n height=\"100%\"\n fill={\n theme === 'colored'\n ? 'currentColor'\n : `var(--toastify-icon-color-${type})`\n }\n {...rest}\n />\n);\n\nfunction Warning(props: BuiltInIconProps) {\n return (\n <Svg {...props}>\n <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\" />\n </Svg>\n );\n}\n\nfunction Info(props: BuiltInIconProps) {\n return (\n <Svg {...props}>\n <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\" />\n </Svg>\n );\n}\n\nfunction Success(props: BuiltInIconProps) {\n return (\n <Svg {...props}>\n <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\" />\n </Svg>\n );\n}\n\nfunction Error(props: BuiltInIconProps) {\n return (\n <Svg {...props}>\n <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\" />\n </Svg>\n );\n}\n\nfunction Spinner() {\n return <div className={`${Default.CSS_NAMESPACE}__spinner`} />;\n}\n\nexport const Icons = {\n info: Info,\n warning: Warning,\n success: Success,\n error: Error,\n spinner: Spinner\n};\n","import * as React from 'react';\nimport cx from 'clsx';\n\nimport { ProgressBar } from './ProgressBar';\nimport { Icons } from './Icons';\nimport { ToastProps } from '../types';\nimport { Default, isFn, isStr } from '../utils';\nimport { useToast } from '../hooks';\n\nexport const Toast: React.FC<ToastProps> = props => {\n const {\n isRunning,\n preventExitTransition,\n toastRef,\n eventHandlers\n } = useToast(props);\n const {\n closeButton,\n children,\n autoClose,\n onClick,\n type,\n hideProgressBar,\n closeToast,\n transition: Transition,\n position,\n className,\n style,\n bodyClassName,\n bodyStyle,\n progressClassName,\n progressStyle,\n updateId,\n role,\n progress,\n rtl,\n toastId,\n deleteToast,\n isIn,\n isLoading,\n icon,\n theme\n } = props;\n const defaultClassName = cx(\n `${Default.CSS_NAMESPACE}__toast`,\n `${Default.CSS_NAMESPACE}__toast-theme--${theme}`,\n `${Default.CSS_NAMESPACE}__toast--${type}`,\n {\n [`${Default.CSS_NAMESPACE}__toast--rtl`]: rtl\n }\n );\n const cssClasses = isFn(className)\n ? className({\n rtl,\n position,\n type,\n defaultClassName\n })\n : cx(defaultClassName, className);\n const isProgressControlled = !!progress;\n const maybeIcon = Icons[type as keyof typeof Icons];\n const iconProps = { theme, type };\n let Icon: React.ReactNode = maybeIcon && maybeIcon(iconProps);\n\n if (icon === false) {\n Icon = void 0;\n } else if (isFn(icon)) {\n Icon = icon(iconProps);\n } else if (React.isValidElement(icon)) {\n Icon = React.cloneElement(icon, iconProps);\n } else if (isStr(icon)) {\n Icon = icon;\n } else if (isLoading) {\n Icon = Icons.spinner();\n }\n\n function renderCloseButton(closeButton: any) {\n if (!closeButton) return;\n\n const props = { closeToast, type, theme };\n\n if (isFn(closeButton)) return closeButton(props);\n\n if (React.isValidElement(closeButton))\n return React.cloneElement(closeButton, props);\n }\n\n return (\n <Transition\n isIn={isIn}\n done={deleteToast}\n position={position}\n preventExitTransition={preventExitTransition}\n nodeRef={toastRef}\n >\n <div\n id={toastId as string}\n onClick={onClick}\n className={cssClasses}\n {...eventHandlers}\n style={style}\n ref={toastRef}\n >\n <div\n {...(isIn && { role: role })}\n className={\n isFn(bodyClassName)\n ? bodyClassName({ type })\n : cx(`${Default.CSS_NAMESPACE}__toast-body`, bodyClassName)\n }\n style={bodyStyle}\n >\n {Icon && (\n <div\n className={cx(`${Default.CSS_NAMESPACE}__toast-icon`, {\n [`${Default.CSS_NAMESPACE}--animate-icon ${Default.CSS_NAMESPACE}__zoom-enter`]: !isLoading\n })}\n >\n {Icon}\n </div>\n )}\n <div>{children}</div>\n </div>\n {renderCloseButton(closeButton)}\n {(autoClose || isProgressControlled) && (\n <ProgressBar\n {...(updateId && !isProgressControlled\n ? { key: `pb-${updateId}` }\n : {})}\n rtl={rtl}\n theme={theme}\n delay={autoClose as number}\n isRunning={isRunning}\n isIn={isIn}\n closeToast={closeToast}\n hide={hideProgressBar}\n type={type}\n style={progressStyle}\n className={progressClassName}\n controlledProgress={isProgressControlled}\n progress={progress}\n />\n )}\n </div>\n </Transition>\n );\n};\n","import { Default, cssTransition } from '../utils';\n\nconst Bounce = cssTransition({\n enter: `${Default.CSS_NAMESPACE}--animate ${Default.CSS_NAMESPACE}__bounce-enter`,\n exit: `${Default.CSS_NAMESPACE}--animate ${Default.CSS_NAMESPACE}__bounce-exit`,\n appendPosition: true\n});\n\nconst Slide = cssTransition({\n enter: `${Default.CSS_NAMESPACE}--animate ${Default.CSS_NAMESPACE}__slide-enter`,\n exit: `${Default.CSS_NAMESPACE}--animate ${Default.CSS_NAMESPACE}__slide-exit`,\n appendPosition: true\n});\n\nconst Zoom = cssTransition({\n enter: `${Default.CSS_NAMESPACE}--animate ${Default.CSS_NAMESPACE}__zoom-enter`,\n exit: `${Default.CSS_NAMESPACE}--animate ${Default.CSS_NAMESPACE}__zoom-exit`\n});\n\nconst Flip = cssTransition({\n enter: `${Default.CSS_NAMESPACE}--animate ${Default.CSS_NAMESPACE}__flip-enter`,\n exit: `${Default.CSS_NAMESPACE}--animate ${Default.CSS_NAMESPACE}__flip-exit`\n});\n\nexport { Bounce, Slide, Zoom, Flip };\n","import * as React from 'react';\nimport cx from 'clsx';\n\nimport { Toast } from './Toast';\nimport { CloseButton } from './CloseButton';\nimport { Bounce } from './Transitions';\nimport { POSITION, Direction, Default, parseClassName, isFn } from '../utils';\nimport { useToastContainer } from '../hooks';\nimport { ToastContainerProps, ToastPosition } from '../types';\n\nexport const ToastContainer: React.FC<ToastContainerProps> = props => {\n const { getToastToRender, containerRef, isToastActive } = useToastContainer(\n props\n );\n const { className, style, rtl, containerId } = props;\n\n function getClassName(position: ToastPosition) {\n const defaultClassName = cx(\n `${Default.CSS_NAMESPACE}__toast-container`,\n `${Default.CSS_NAMESPACE}__toast-container--${position}`,\n { [`${Default.CSS_NAMESPACE}__toast-container--rtl`]: rtl }\n );\n return isFn(className)\n ? className({\n position,\n rtl,\n defaultClassName\n })\n : cx(defaultClassName, parseClassName(className));\n }\n\n return (\n <div\n ref={containerRef}\n className={Default.CSS_NAMESPACE as string}\n id={containerId as string}\n >\n {getToastToRender((position, toastList) => {\n const containerStyle: React.CSSProperties =\n toastList.length === 0\n ? { ...style, pointerEvents: 'none' }\n : { ...style };\n\n return (\n <div\n className={getClassName(position)}\n style={containerStyle}\n key={`container-${position}`}\n >\n {toastList.map(({ content, props: toastProps }) => {\n return (\n <Toast\n {...toastProps}\n isIn={isToastActive(toastProps.toastId)}\n key={`toast-${toastProps.key}`}\n closeButton={\n toastProps.closeButton === true\n ? CloseButton\n : toastProps.closeButton\n }\n >\n {content}\n </Toast>\n );\n })}\n </div>\n );\n })}\n </div>\n );\n};\n\nToastContainer.defaultProps = {\n position: POSITION.TOP_RIGHT as ToastPosition,\n transition: Bounce,\n rtl: false,\n autoClose: 5000,\n hideProgressBar: false,\n closeButton: CloseButton,\n pauseOnHover: true,\n pauseOnFocusLoss: true,\n closeOnClick: true,\n newestOnTop: false,\n draggable: true,\n draggablePercent: Default.DRAGGABLE_PERCENT as number,\n draggableDirection: Direction.X,\n role: 'alert',\n theme: 'light'\n};\n","import * as React from 'react';\nimport { render } from 'react-dom';\n\nimport { POSITION, TYPE, canUseDom, isStr, isNum, isFn } from '../utils';\nimport { eventManager, OnChangeCallback, Event } from './eventManager';\nimport {\n ToastContent,\n ToastOptions,\n ToastProps,\n Id,\n ToastContainerProps,\n UpdateOptions,\n ClearWaitingQueueParams,\n NotValidatedToastProps,\n TypeOptions\n} from '../types';\nimport { ContainerInstance } from '../hooks';\nimport { ToastContainer } from '../components';\n\ninterface EnqueuedToast {\n content: ToastContent;\n options: NotValidatedToastProps;\n}\n\nlet containers = new Map<ContainerInstance | Id, ContainerInstance>();\nlet latestInstance: ContainerInstance | Id;\nlet containerDomNode: HTMLElement;\nlet containerConfig: ToastContainerProps;\nlet queue: EnqueuedToast[] = [];\nlet lazy = false;\n\n/**\n * Check whether any container is currently mounted in the DOM\n */\nfunction isAnyContainerMounted() {\n return containers.size > 0;\n}\n\n/**\n * Get the toast by id, given it's in the DOM, otherwise returns null\n */\nfunction getToast(toastId: Id, { containerId }: ToastOptions) {\n const container = containers.get(containerId || latestInstance);\n if (!container) return null;\n\n return container.getToast(toastId);\n}\n\n/**\n * Generate a random toastId\n */\nfunction generateToastId() {\n return Math.random()\n .toString(36)\n .substr(2, 9);\n}\n\n/**\n * Generate a toastId or use the one provided\n */\nfunction getToastId(options?: ToastOptions) {\n if (options && (isStr(options.toastId) || isNum(options.toastId))) {\n return options.toastId;\n }\n\n return generateToastId();\n}\n\n/**\n * If the container is not mounted, the toast is enqueued and\n * the container lazy mounted\n */\nfunction dispatchToast(\n content: ToastContent,\n options: NotValidatedToastProps\n): Id {\n if (isAnyContainerMounted()) {\n eventManager.emit(Event.Show, content, options);\n } else {\n queue.push({ content, options });\n if (lazy && canUseDom) {\n lazy = false;\n containerDomNode = document.createElement('div');\n document.body.appendChild(containerDomNode);\n render(<ToastContainer {...containerConfig} />, containerDomNode);\n }\n }\n\n return options.toastId;\n}\n\n/**\n * Merge provided options with the defaults settings and generate the toastId\n */\nfunction mergeOptions(type: string, options?: ToastOptions) {\n return {\n ...options,\n type: (options && options.type) || type,\n toastId: getToastId(options)\n } as NotValidatedToastProps;\n}\n\nconst createToastByType = (type: string) => (\n content: ToastContent,\n options?: ToastOptions\n) => dispatchToast(content, mergeOptions(type, options));\n\nconst toast = (content: ToastContent, options?: ToastOptions) =>\n dispatchToast(content, mergeOptions(TYPE.DEFAULT, options));\n\ntoast.loading = (content: ToastContent, options?: ToastOptions) =>\n dispatchToast(\n content,\n mergeOptions(TYPE.DEFAULT, {\n isLoading: true,\n autoClose: false,\n closeOnClick: false,\n closeButton: false,\n draggable: false,\n ...options\n })\n );\n\ninterface ToastPromiseParams {\n pending: string | UpdateOptions;\n success: string | UpdateOptions;\n error: string | UpdateOptions;\n}\n\nfunction handlePromise<T>(\n promise: Promise<T> | (() => Promise<T>),\n { pending, error, success }: ToastPromiseParams,\n options?: ToastOptions\n) {\n const id = isStr(pending)\n ? toast.loading(pending, options)\n : toast.loading(pending.render, {\n ...options,\n ...(pending as ToastOptions)\n });\n const resetParams = {\n isLoading: null,\n autoClose: null,\n closeOnClick: null,\n closeButton: null,\n draggable: null\n };\n\n const resolver = (\n type: TypeOptions,\n input: string | UpdateOptions,\n result: T\n ) => {\n const params = isStr(input) ? { render: input } : input;\n toast.update(id, {\n type,\n ...resetParams,\n ...options,\n ...params,\n data: result\n });\n return result;\n };\n const p = isFn(promise) ? promise() : promise;\n p.then(result => resolver('success', success, result)).catch(err =>\n resolver('error', error, err)\n );\n\n return p;\n}\n\ntoast.promise = handlePromise;\ntoast.success = createToastByType(TYPE.SUCCESS);\ntoast.info = createToastByType(TYPE.INFO);\ntoast.error = createToastByType(TYPE.ERROR);\ntoast.warning = createToastByType(TYPE.WARNING);\ntoast.warn = toast.warning;\ntoast.dark = (content: ToastContent, options?: ToastOptions) =>\n dispatchToast(\n content,\n mergeOptions(TYPE.DEFAULT, {\n theme: 'dark',\n ...options\n })\n );\n\n/**\n * Remove toast programmaticaly\n */\ntoast.dismiss = (id?: Id) => eventManager.emit(Event.Clear, id);\n\n/**\n * Clear waiting queue when limit is used\n */\ntoast.clearWaitingQueue = (params: ClearWaitingQueueParams = {}) =>\n eventManager.emit(Event.ClearWaitingQueue, params);\n\n/**\n * return true if one container is displaying the toast\n */\ntoast.isActive = (id: Id) => {\n let isToastActive = false;\n\n containers.forEach(container => {\n if (container.isToastActive && container.isToastActive(id)) {\n isToastActive = true;\n }\n });\n\n return isToastActive;\n};\n\ntoast.update = (toastId: Id, options: UpdateOptions = {}) => {\n // if you call toast and toast.update directly nothing will be displayed\n // this is why I defered the update\n setTimeout(() => {\n const toast = getToast(toastId, options as ToastOptions);\n if (toast) {\n const { props: oldOptions, content: oldContent } = toast;\n\n const nextOptions = {\n ...oldOptions,\n ...options,\n toastId: options.toastId || toastId,\n updateId: generateToastId()\n } as ToastProps & UpdateOptions;\n\n if (nextOptions.toastId !== toastId) nextOptions.staleId = toastId;\n\n const content = nextOptions.render || oldContent;\n delete nextOptions.render;\n\n dispatchToast(content, nextOptions);\n }\n }, 0);\n};\n\n/**\n * Used for controlled progress bar.\n */\ntoast.done = (id: Id) => {\n toast.update(id, {\n progress: 1\n });\n};\n\n/**\n * Track changes. The callback get the number of toast displayed\n *\n */\ntoast.onChange = (callback: OnChangeCallback) => {\n if (isFn(callback)) {\n eventManager.on(Event.Change, callback);\n }\n return () => {\n isFn(callback) && eventManager.off(Event.Change, callback);\n };\n};\n\n/**\n * Configure the ToastContainer when lazy mounted\n */\ntoast.configure = (config: ToastContainerProps = {}) => {\n lazy = true;\n containerConfig = config;\n};\n\ntoast.POSITION = POSITION;\ntoast.TYPE = TYPE;\n\n/**\n * Wait until the ToastContainer is mounted to dispatch the toast\n * and attach isActive method\n */\neventManager\n .on(Event.DidMount, (containerInstance: ContainerInstance) => {\n latestInstance = containerInstance.containerId || containerInstance;\n containers.set(latestInstance, containerInstance);\n\n queue.forEach(item => {\n eventManager.emit(Event.Show, item.content, item.options);\n });\n\n queue = [];\n })\n .on(Event.WillUnmount, (containerInstance: ContainerInstance) => {\n containers.delete(containerInstance.containerId || containerInstance);\n\n if (containers.size === 0) {\n eventManager\n .off(Event.Show)\n .off(Event.Clear)\n .off(Event.ClearWaitingQueue);\n }\n\n if (canUseDom && containerDomNode) {\n document.body.removeChild(containerDomNode);\n }\n });\n\nexport { toast };\n"],"names":["isNum","v","isNaN","isBool","isStr","isFn","parseClassName","isToastIdValid","toastId","getAutoCloseDelay","toastAutoClose","containerAutoClose","canUseDom","window","document","createElement","canBeRendered","content","isValidElement","POSITION","TOP_LEFT","TOP_RIGHT","TOP_CENTER","BOTTOM_LEFT","BOTTOM_RIGHT","BOTTOM_CENTER","TYPE","INFO","SUCCESS","WARNING","ERROR","DEFAULT","collapseToast","node","done","duration","scrollHeight","style","requestAnimationFrame","minHeight","height","transition","padding","margin","setTimeout","cssTransition","enter","exit","appendPosition","collapse","collapseDuration","ToastTransition","children","position","preventExitTransition","nodeRef","isIn","enterClassName","exitClassName","baseClassName","useRef","animationStep","useLayoutEffect","onEnter","useEffect","onExited","onExit","current","className","addEventListener","onEntered","e","target","removeEventListener","React","eventManager","list","Map","emitQueue","on","event","callback","has","set","get","push","off","cb","filter","cancelEmit","timers","forEach","clearTimeout","emit","args","timer","useKeeper","arg","refresh","ref","reducer","state","action","type","id","staleId","useToastContainer","props","useReducer","x","forceUpdate","toast","dispatch","containerRef","toastCount","queue","collection","instance","toastKey","displayedToast","containerId","isToastActive","getToast","buildToast","removeToast","clearWaitingQueue","length","indexOf","limit","dequeueToast","shift","toastContent","toastProps","appendToast","isNotValid","updateId","enableMultiContainer","delay","options","data","closeToast","isNotAnUpdate","isLoading","theme","icon","key","closeButton","rtl","toastClassName","bodyClassName","toastStyle","bodyStyle","onClick","pauseOnHover","pauseOnFocusLoss","draggable","draggablePercent","draggableDirection","closeOnClick","progressClassName","progressStyle","autoClose","hideProgressBar","progress","role","deleteToast","removeFromCollection","onOpen","onClose","cloneElement","queueLen","freeSlot","toDequeue","i","getToastToRender","toastToRender","toastList","newestOnTop","Object","keys","reverse","map","p","getX","targetTouches","clientX","getY","clientY","useToast","useState","isRunning","setIsRunning","setPreventExitTransition","toastRef","drag","start","y","delta","removalDistance","canCloseOnClick","canDrag","boundingRect","syncProps","bindDragEvents","unbindDragEvents","bindFocusEvents","unbindFocusEvents","onDragStart","getBoundingClientRect","nativeEvent","offsetWidth","offsetHeight","onDragTransitionEnd","top","bottom","left","right","pauseToast","playToast","hasFocus","onDragMove","onDragEnd","preventDefault","transform","opacity","Math","abs","eventHandlers","onMouseDown","onTouchStart","onMouseUp","onTouchEnd","onMouseEnter","onMouseLeave","CloseButton","ariaLabel","stopPropagation","viewBox","fillRule","d","ProgressBar","hide","userStyle","controlledProgress","animationDuration","animationPlayState","defaultClassName","cx","classNames","animationEvent","defaultProps","Svg","rest","width","fill","Warning","Info","Success","Error","Spinner","Icons","info","warning","success","error","spinner","Toast","Transition","cssClasses","isProgressControlled","maybeIcon","iconProps","Icon","renderCloseButton","Bounce","Slide","Zoom","Flip","ToastContainer","getClassName","containerStyle","pointerEvents","containers","latestInstance","containerDomNode","containerConfig","lazy","isAnyContainerMounted","size","container","generateToastId","random","toString","substr","getToastId","dispatchToast","body","appendChild","render","mergeOptions","createToastByType","loading","handlePromise","promise","pending","resetParams","resolver","input","result","params","update","then","err","warn","dark","dismiss","isActive","oldOptions","oldContent","nextOptions","onChange","configure","config","containerInstance","item","removeChild"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;SAIgBA,MAAMC;AACpB,SAAO,OAAOA,CAAP,KAAa,QAAb,IAAyB,CAACC,KAAK,CAACD,CAAD,CAAtC;AACD;SAEeE,OAAOF;AACrB,SAAO,OAAOA,CAAP,KAAa,SAApB;AACD;SAEeG,MAAMH;AACpB,SAAO,OAAOA,CAAP,KAAa,QAApB;AACD;SAEeI,KA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