{"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/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(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' | 'DARK';\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 DARK: 'dark'\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 height = node.scrollHeight;\n const style = node.style;\n\n requestAnimationFrame(() => {\n style.minHeight = 'initial';\n style.height = height + '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();\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() {\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;\n\nexport interface EventManager {\n list: Map;\n emitQueue: Map;\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 = 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(arg: T, refresh = false) {\n const ref = useRef(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;\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;\ntype ToastToRender = Partial>;\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([]);\n const collection = useKeeper({});\n const instance = useKeeper({\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 } = 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 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: 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 });\n } else if (isFn(content)) {\n toastContent = content({ closeToast, toastProps });\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(\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).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(null);\n const drag = useKeeper({\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 | React.TouchEvent\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 = {\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 { TypeOptions } from '../types';\n\nexport interface CloseButtonProps {\n closeToast: (e: React.MouseEvent) => void;\n type: TypeOptions;\n ariaLabel?: string;\n}\n\nexport function CloseButton({\n closeToast,\n type,\n ariaLabel = 'close'\n}: CloseButtonProps) {\n return (\n {\n e.stopPropagation();\n closeToast(e);\n }}\n aria-label={ariaLabel}\n >\n \n \n \n \n );\n}\n","import * as React from 'react';\nimport cx from 'clsx';\n\nimport { TYPE, Default, isFn } from './../utils';\nimport { TypeOptions, ToastClassName } 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 * 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}: 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--${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 \n );\n}\n\nProgressBar.defaultProps = {\n type: TYPE.DEFAULT,\n hide: false\n};\n","import * as React from 'react';\nimport cx from 'clsx';\n\nimport { ProgressBar } from './ProgressBar';\nimport { ToastProps } from '../types';\nimport { Default, isFn } from '../utils';\nimport { useToast } from '../hooks';\n\nexport const Toast: React.FC = 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 } = props;\n const defaultClassName = cx(\n `${Default.CSS_NAMESPACE}__toast`,\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\n function renderCloseButton(closeButton: any) {\n if (!closeButton) return;\n\n const props = { closeToast, type };\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 \n \n \n {children}\n \n {renderCloseButton(closeButton)}\n {(autoClose || isProgressControlled) && (\n \n )}\n \n \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 = 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 \n {getToastToRender((position, toastList) => {\n const containerStyle: React.CSSProperties =\n toastList.length === 0\n ? { ...style, pointerEvents: 'none' }\n : { ...style };\n\n return (\n \n {toastList.map(({ content, props: toastProps }) => {\n return (\n \n {content}\n \n );\n })}\n \n );\n })}\n \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};\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} 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();\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(, 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.success = createToastByType(TYPE.SUCCESS);\ntoast.info = createToastByType(TYPE.INFO);\ntoast.error = createToastByType(TYPE.ERROR);\ntoast.warning = createToastByType(TYPE.WARNING);\ntoast.dark = createToastByType(TYPE.DARK);\ntoast.warn = toast.warning;\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","DARK","collapseToast","node","done","duration","height","scrollHeight","style","requestAnimationFrame","minHeight","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","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","closeToast","isNotAnUpdate","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","e","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","Toast","Transition","cssClasses","isProgressControlled","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","success","info","error","warning","dark","warn","dismiss","params","isActive","update","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,MAA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