GoScrobble/web/node_modules/.cache/babel-loader/b48f0a644711b3952a88b71b9b39fefb.json

1 line
114 KiB
JSON

{"ast":null,"code":"import React__default, { isValidElement, useRef, useLayoutEffect, useEffect, useReducer, cloneElement, useState, createElement } from 'react';\nimport cx from 'clsx';\nimport { render } from 'react-dom';\n\nfunction _extends() {\n _extends = Object.assign || function (target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i];\n\n for (var key in source) {\n if (Object.prototype.hasOwnProperty.call(source, key)) {\n target[key] = source[key];\n }\n }\n }\n\n return target;\n };\n\n return _extends.apply(this, arguments);\n}\n\nfunction _objectWithoutPropertiesLoose(source, excluded) {\n if (source == null) return {};\n var target = {};\n var sourceKeys = Object.keys(source);\n var key, i;\n\n for (i = 0; i < sourceKeys.length; i++) {\n key = sourceKeys[i];\n if (excluded.indexOf(key) >= 0) continue;\n target[key] = source[key];\n }\n\n return target;\n}\n\nfunction isNum(v) {\n return typeof v === 'number' && !isNaN(v);\n}\n\nfunction isBool(v) {\n return typeof v === 'boolean';\n}\n\nfunction isStr(v) {\n return typeof v === 'string';\n}\n\nfunction isFn(v) {\n return typeof v === 'function';\n}\n\nfunction parseClassName(v) {\n return isStr(v) || isFn(v) ? v : null;\n}\n\nfunction isToastIdValid(toastId) {\n return toastId === 0 || toastId;\n}\n\nfunction getAutoCloseDelay(toastAutoClose, containerAutoClose) {\n return toastAutoClose === false || isNum(toastAutoClose) && toastAutoClose > 0 ? toastAutoClose : containerAutoClose;\n}\n\nvar canUseDom = !!(typeof window !== 'undefined' && window.document && window.document.createElement);\n\nfunction canBeRendered(content) {\n return isValidElement(content) || isStr(content) || isFn(content) || isNum(content);\n}\n\nvar POSITION = {\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};\nvar TYPE = {\n INFO: 'info',\n SUCCESS: 'success',\n WARNING: 'warning',\n ERROR: 'error',\n DEFAULT: 'default',\n DARK: 'dark'\n};\n/**\r\n * Used to collapse toast after exit animation\r\n */\n\nfunction collapseToast(node, done, duration\n/* COLLAPSE_DURATION */\n) {\n if (duration === void 0) {\n duration = 300;\n }\n\n var height = node.scrollHeight;\n var style = node.style;\n requestAnimationFrame(function () {\n style.minHeight = 'initial';\n style.height = height + 'px';\n style.transition = \"all \" + duration + \"ms\";\n requestAnimationFrame(function () {\n style.height = '0';\n style.padding = '0';\n style.margin = '0';\n setTimeout(done, duration);\n });\n });\n}\n/**\r\n * Css animation that just work.\r\n * You could use animate.css for instance\r\n *\r\n *\r\n * ```\r\n * cssTransition({\r\n * enter: \"animate__animated animate__bounceIn\",\r\n * exit: \"animate__animated animate__bounceOut\"\r\n * })\r\n * ```\r\n *\r\n */\n\n\nfunction cssTransition(_ref) {\n var enter = _ref.enter,\n exit = _ref.exit,\n _ref$appendPosition = _ref.appendPosition,\n appendPosition = _ref$appendPosition === void 0 ? false : _ref$appendPosition,\n _ref$collapse = _ref.collapse,\n collapse = _ref$collapse === void 0 ? true : _ref$collapse,\n _ref$collapseDuration = _ref.collapseDuration,\n collapseDuration = _ref$collapseDuration === void 0 ? 300 : _ref$collapseDuration;\n return function ToastTransition(_ref2) {\n var children = _ref2.children,\n position = _ref2.position,\n preventExitTransition = _ref2.preventExitTransition,\n done = _ref2.done,\n nodeRef = _ref2.nodeRef,\n isIn = _ref2.isIn;\n var enterClassName = appendPosition ? enter + \"--\" + position : enter;\n var exitClassName = appendPosition ? exit + \"--\" + position : exit;\n var baseClassName = useRef();\n var animationStep = useRef(0\n /* Enter */\n );\n useLayoutEffect(function () {\n onEnter();\n }, []);\n useEffect(function () {\n if (!isIn) preventExitTransition ? onExited() : onExit();\n }, [isIn]);\n\n function onEnter() {\n var node = nodeRef.current;\n baseClassName.current = node.className;\n node.className += \" \" + enterClassName;\n node.addEventListener('animationend', onEntered);\n }\n\n function onEntered() {\n var node = nodeRef.current;\n node.removeEventListener('animationend', onEntered);\n\n if (animationStep.current === 0\n /* Enter */\n ) {\n node.className = baseClassName.current;\n }\n }\n\n function onExit() {\n animationStep.current = 1\n /* Exit */\n ;\n var node = nodeRef.current;\n node.className += \" \" + exitClassName;\n node.addEventListener('animationend', onExited);\n }\n\n function onExited() {\n var node = nodeRef.current;\n node.removeEventListener('animationend', onExited);\n collapse ? collapseToast(node, done, collapseDuration) : done();\n }\n\n return React__default.createElement(React__default.Fragment, null, children);\n };\n}\n\nvar eventManager = {\n list: /*#__PURE__*/new Map(),\n emitQueue: /*#__PURE__*/new Map(),\n on: function on(event, callback) {\n this.list.has(event) || this.list.set(event, []);\n this.list.get(event).push(callback);\n return this;\n },\n off: function off(event, callback) {\n if (callback) {\n var cb = this.list.get(event).filter(function (cb) {\n return cb !== callback;\n });\n this.list.set(event, cb);\n return this;\n }\n\n this.list[\"delete\"](event);\n return this;\n },\n cancelEmit: function cancelEmit(event) {\n var timers = this.emitQueue.get(event);\n\n if (timers) {\n timers.forEach(clearTimeout);\n this.emitQueue[\"delete\"](event);\n }\n\n return this;\n },\n\n /**\r\n * Enqueue the event at the end of the call stack\r\n * Doing so let the user call toast as follow:\r\n * toast('1')\r\n * toast('2')\r\n * toast('3')\r\n * Without setTimemout the code above will not work\r\n */\n emit: function emit(event) {\n var _this = this;\n\n for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {\n args[_key - 1] = arguments[_key];\n }\n\n this.list.has(event) && this.list.get(event).forEach(function (callback) {\n var timer = setTimeout(function () {\n // @ts-ignore\n callback.apply(void 0, args);\n }, 0);\n _this.emitQueue.has(event) || _this.emitQueue.set(event, []);\n\n _this.emitQueue.get(event).push(timer);\n });\n }\n};\n/**\r\n * `useKeeper` is a helper around `useRef`.\r\n *\r\n * You don't need to access the `.current`property to get the value\r\n * If refresh is set to true. The ref will be updated every render\r\n */\n\nfunction useKeeper(arg, refresh) {\n if (refresh === void 0) {\n refresh = false;\n }\n\n var ref = useRef(arg);\n useEffect(function () {\n if (refresh) ref.current = arg;\n });\n return ref.current;\n}\n\nfunction reducer(state, action) {\n switch (action.type) {\n case 0\n /* ADD */\n :\n return [].concat(state, [action.toastId]).filter(function (id) {\n return id !== action.staleId;\n });\n\n case 1\n /* REMOVE */\n :\n return isToastIdValid(action.toastId) ? state.filter(function (id) {\n return id !== action.toastId;\n }) : [];\n }\n}\n\nfunction useToastContainer(props) {\n var _useReducer = useReducer(function (x) {\n return x + 1;\n }, 0),\n forceUpdate = _useReducer[1];\n\n var _useReducer2 = useReducer(reducer, []),\n toast = _useReducer2[0],\n dispatch = _useReducer2[1];\n\n var containerRef = useRef(null);\n var toastCount = useKeeper(0);\n var queue = useKeeper([]);\n var collection = useKeeper({});\n var instance = useKeeper({\n toastKey: 1,\n displayedToast: 0,\n props: props,\n containerId: null,\n isToastActive: isToastActive,\n getToast: function getToast(id) {\n return collection[id] || null;\n }\n });\n useEffect(function () {\n instance.containerId = props.containerId;\n eventManager.cancelEmit(3\n /* WillUnmount */\n ).on(0\n /* Show */\n , buildToast).on(1\n /* Clear */\n , function (toastId) {\n return containerRef.current && removeToast(toastId);\n }).on(5\n /* ClearWaitingQueue */\n , clearWaitingQueue).emit(2\n /* DidMount */\n , instance);\n return function () {\n return eventManager.emit(3\n /* WillUnmount */\n , instance);\n };\n }, []);\n useEffect(function () {\n instance.isToastActive = isToastActive;\n instance.displayedToast = toast.length;\n eventManager.emit(4\n /* Change */\n , toast.length, props.containerId);\n }, [toast]);\n useEffect(function () {\n instance.props = props;\n });\n\n function isToastActive(id) {\n return toast.indexOf(id) !== -1;\n }\n\n function clearWaitingQueue(_ref) {\n var containerId = _ref.containerId;\n var limit = instance.props.limit;\n\n if (limit && (!containerId || instance.containerId === containerId)) {\n toastCount -= queue.length;\n queue = [];\n }\n }\n\n function removeToast(toastId) {\n dispatch({\n type: 1\n /* REMOVE */\n ,\n toastId: toastId\n });\n }\n\n function dequeueToast() {\n var _queue$shift = queue.shift(),\n toastContent = _queue$shift.toastContent,\n toastProps = _queue$shift.toastProps,\n staleId = _queue$shift.staleId;\n\n appendToast(toastContent, toastProps, staleId);\n }\n /**\r\n * check if a container is attached to the dom\r\n * check for multi-container, build only if associated\r\n * check for duplicate toastId if no update\r\n */\n\n\n function isNotValid(_ref2) {\n var containerId = _ref2.containerId,\n toastId = _ref2.toastId,\n updateId = _ref2.updateId;\n return !containerRef.current || instance.props.enableMultiContainer && containerId !== instance.props.containerId || collection[toastId] && updateId == null ? true : false;\n } // this function and all the function called inside needs to rely on ref(`useKeeper`)\n\n\n function buildToast(content, _ref3) {\n var delay = _ref3.delay,\n staleId = _ref3.staleId,\n options = _objectWithoutPropertiesLoose(_ref3, [\"delay\", \"staleId\"]);\n\n if (!canBeRendered(content) || isNotValid(options)) return;\n var toastId = options.toastId,\n updateId = options.updateId;\n var props = instance.props;\n\n var closeToast = function closeToast() {\n return removeToast(toastId);\n };\n\n var isNotAnUpdate = options.updateId == null;\n if (isNotAnUpdate) toastCount++;\n var toastProps = {\n toastId: toastId,\n updateId: 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,\n transition: options.transition || props.transition,\n className: parseClassName(options.className || props.toastClassName),\n bodyClassName: parseClassName(options.bodyClassName || props.bodyClassName),\n style: options.style || props.toastStyle,\n bodyStyle: options.bodyStyle || props.bodyStyle,\n onClick: options.onClick || props.onClick,\n pauseOnHover: isBool(options.pauseOnHover) ? options.pauseOnHover : props.pauseOnHover,\n pauseOnFocusLoss: isBool(options.pauseOnFocusLoss) ? options.pauseOnFocusLoss : props.pauseOnFocusLoss,\n draggable: isBool(options.draggable) ? options.draggable : props.draggable,\n draggablePercent: isNum(options.draggablePercent) ? options.draggablePercent : props.draggablePercent,\n draggableDirection: options.draggableDirection || props.draggableDirection,\n closeOnClick: isBool(options.closeOnClick) ? options.closeOnClick : props.closeOnClick,\n progressClassName: parseClassName(options.progressClassName || props.progressClassName),\n progressStyle: options.progressStyle || props.progressStyle,\n autoClose: getAutoCloseDelay(options.autoClose, props.autoClose),\n hideProgressBar: isBool(options.hideProgressBar) ? options.hideProgressBar : props.hideProgressBar,\n progress: options.progress,\n role: isStr(options.role) ? options.role : props.role,\n deleteToast: function deleteToast() {\n removeFromCollection(toastId);\n }\n };\n if (isFn(options.onOpen)) toastProps.onOpen = options.onOpen;\n if (isFn(options.onClose)) toastProps.onClose = options.onClose; // tweak for vertical dragging\n\n if (toastProps.draggableDirection === \"y\"\n /* Y */\n && toastProps.draggablePercent === 80\n /* DRAGGABLE_PERCENT */\n ) {\n toastProps.draggablePercent *= 1.5;\n }\n\n var 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 var toastContent = content;\n\n if (isValidElement(content) && !isStr(content.type)) {\n toastContent = cloneElement(content, {\n closeToast: closeToast,\n toastProps: toastProps\n });\n } else if (isFn(content)) {\n toastContent = content({\n closeToast: closeToast,\n toastProps: toastProps\n });\n } // not handling limit + delay by design. Waiting for user feedback first\n\n\n if (props.limit && props.limit > 0 && toastCount > props.limit && isNotAnUpdate) {\n queue.push({\n toastContent: toastContent,\n toastProps: toastProps,\n staleId: staleId\n });\n } else if (isNum(delay) && delay > 0) {\n setTimeout(function () {\n appendToast(toastContent, toastProps, staleId);\n }, delay);\n } else {\n appendToast(toastContent, toastProps, staleId);\n }\n }\n\n function appendToast(content, toastProps, staleId) {\n var toastId = toastProps.toastId;\n if (staleId) delete collection[staleId];\n collection[toastId] = {\n content: content,\n props: toastProps\n };\n dispatch({\n type: 0\n /* ADD */\n ,\n toastId: toastId,\n staleId: staleId\n });\n }\n\n function removeFromCollection(toastId) {\n delete collection[toastId];\n var queueLen = queue.length;\n toastCount = isToastIdValid(toastId) ? toastCount - 1 : toastCount - instance.displayedToast;\n if (toastCount < 0) toastCount = 0;\n\n if (queueLen > 0) {\n var freeSlot = isToastIdValid(toastId) ? 1 : instance.props.limit;\n\n if (queueLen === 1 || freeSlot === 1) {\n instance.displayedToast++;\n dequeueToast();\n } else {\n var toDequeue = freeSlot > queueLen ? queueLen : freeSlot;\n instance.displayedToast = toDequeue;\n\n for (var i = 0; i < toDequeue; i++) {\n dequeueToast();\n }\n }\n } else {\n forceUpdate();\n }\n }\n\n function getToastToRender(cb) {\n var toastToRender = {};\n var toastList = props.newestOnTop ? Object.keys(collection).reverse() : Object.keys(collection);\n\n for (var i = 0; i < toastList.length; i++) {\n var _toast = collection[toastList[i]];\n var position = _toast.props.position;\n toastToRender[position] || (toastToRender[position] = []);\n toastToRender[position].push(_toast);\n }\n\n return Object.keys(toastToRender).map(function (p) {\n return cb(p, toastToRender[p]);\n });\n }\n\n return {\n getToastToRender: getToastToRender,\n collection: collection,\n containerRef: containerRef,\n isToastActive: isToastActive\n };\n}\n\nfunction getX(e) {\n return e.targetTouches && e.targetTouches.length >= 1 ? e.targetTouches[0].clientX : e.clientX;\n}\n\nfunction getY(e) {\n return e.targetTouches && e.targetTouches.length >= 1 ? e.targetTouches[0].clientY : e.clientY;\n}\n\nfunction useToast(props) {\n var _useState = useState(true),\n isRunning = _useState[0],\n setIsRunning = _useState[1];\n\n var _useState2 = useState(false),\n preventExitTransition = _useState2[0],\n setPreventExitTransition = _useState2[1];\n\n var toastRef = useRef(null);\n var 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 var syncProps = useKeeper(props, true);\n var autoClose = props.autoClose,\n pauseOnHover = props.pauseOnHover,\n closeToast = props.closeToast,\n onClick = props.onClick,\n closeOnClick = props.closeOnClick;\n useEffect(function () {\n if (isFn(props.onOpen)) props.onOpen(isValidElement(props.children) && props.children.props);\n return function () {\n if (isFn(syncProps.onClose)) syncProps.onClose(isValidElement(syncProps.children) && syncProps.children.props);\n };\n }, []);\n useEffect(function () {\n props.draggable && bindDragEvents();\n return function () {\n props.draggable && unbindDragEvents();\n };\n }, [props.draggable]);\n useEffect(function () {\n props.pauseOnFocusLoss && bindFocusEvents();\n return function () {\n props.pauseOnFocusLoss && unbindFocusEvents();\n };\n }, [props.pauseOnFocusLoss]);\n\n function onDragStart(e) {\n if (props.draggable) {\n var 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);\n drag.y = getY(e.nativeEvent);\n\n if (props.draggableDirection === \"x\"\n /* X */\n ) {\n drag.start = drag.x;\n drag.removalDistance = toast.offsetWidth * (props.draggablePercent / 100);\n } else {\n drag.start = drag.y;\n drag.removalDistance = toast.offsetHeight * (props.draggablePercent / 100);\n }\n }\n }\n\n function onDragTransitionEnd() {\n if (drag.boundingRect) {\n var _drag$boundingRect = drag.boundingRect,\n top = _drag$boundingRect.top,\n bottom = _drag$boundingRect.bottom,\n left = _drag$boundingRect.left,\n right = _drag$boundingRect.right;\n\n if (props.pauseOnHover && drag.x >= left && drag.x <= right && drag.y >= top && drag.y <= bottom) {\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 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 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 document.removeEventListener('touchmove', onDragMove);\n document.removeEventListener('touchend', onDragEnd);\n }\n\n function onDragMove(e) {\n if (drag.canDrag) {\n e.preventDefault();\n var toast = toastRef.current;\n if (isRunning) pauseToast();\n drag.x = getX(e);\n drag.y = getY(e);\n\n if (props.draggableDirection === \"x\"\n /* X */\n ) {\n drag.delta = drag.x - drag.start;\n } else {\n drag.delta = drag.y - drag.start;\n } // prevent false positif during a toast click\n\n\n if (drag.start !== drag.x) drag.canCloseOnClick = false;\n toast.style.transform = \"translate\" + props.draggableDirection + \"(\" + drag.delta + \"px)\";\n toast.style.opacity = \"\" + (1 - Math.abs(drag.delta / drag.removalDistance));\n }\n }\n\n function onDragEnd() {\n var toast = toastRef.current;\n\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 var eventHandlers = {\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 } // prevent toast from closing when user drags the toast\n\n\n if (closeOnClick) {\n eventHandlers.onClick = function (e) {\n onClick && onClick(e);\n drag.canCloseOnClick && closeToast();\n };\n }\n\n return {\n playToast: playToast,\n pauseToast: pauseToast,\n isRunning: isRunning,\n preventExitTransition: preventExitTransition,\n toastRef: toastRef,\n eventHandlers: eventHandlers\n };\n}\n\nfunction CloseButton(_ref) {\n var closeToast = _ref.closeToast,\n type = _ref.type,\n _ref$ariaLabel = _ref.ariaLabel,\n ariaLabel = _ref$ariaLabel === void 0 ? 'close' : _ref$ariaLabel;\n return createElement(\"button\", {\n className: \"Toastify\"\n /* CSS_NAMESPACE */\n + \"__close-button \" + \"Toastify\"\n /* CSS_NAMESPACE */\n + \"__close-button--\" + type,\n type: \"button\",\n onClick: function onClick(e) {\n e.stopPropagation();\n closeToast(e);\n },\n \"aria-label\": ariaLabel\n }, createElement(\"svg\", {\n \"aria-hidden\": \"true\",\n viewBox: \"0 0 14 16\"\n }, createElement(\"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}\n\nfunction ProgressBar(_ref) {\n var _cx, _animationEvent;\n\n var delay = _ref.delay,\n isRunning = _ref.isRunning,\n closeToast = _ref.closeToast,\n type = _ref.type,\n hide = _ref.hide,\n className = _ref.className,\n userStyle = _ref.style,\n controlledProgress = _ref.controlledProgress,\n progress = _ref.progress,\n rtl = _ref.rtl,\n isIn = _ref.isIn;\n\n var style = _extends({}, 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 var defaultClassName = cx(\"Toastify\"\n /* CSS_NAMESPACE */\n + \"__progress-bar\", controlledProgress ? \"Toastify\"\n /* CSS_NAMESPACE */\n + \"__progress-bar--controlled\" : \"Toastify\"\n /* CSS_NAMESPACE */\n + \"__progress-bar--animated\", \"Toastify\"\n /* CSS_NAMESPACE */\n + \"__progress-bar--\" + type, (_cx = {}, _cx[\"Toastify\"\n /* CSS_NAMESPACE */\n + \"__progress-bar--rtl\"] = rtl, _cx));\n var classNames = isFn(className) ? className({\n rtl: rtl,\n type: type,\n defaultClassName: defaultClassName\n }) : cx(defaultClassName, className); // 🧐 controlledProgress is derived from progress\n // so if controlledProgress is set\n // it means that this is also the case for progress\n\n var animationEvent = (_animationEvent = {}, _animationEvent[controlledProgress && progress >= 1 ? 'onTransitionEnd' : 'onAnimationEnd'] = controlledProgress && progress < 1 ? null : function () {\n isIn && closeToast();\n }, _animationEvent); // TODO: add aria-valuenow, aria-valuemax, aria-valuemin\n\n return createElement(\"div\", Object.assign({\n role: \"progressbar\",\n \"aria-hidden\": hide ? 'true' : 'false',\n \"aria-label\": \"notification timer\",\n className: classNames,\n style: style\n }, animationEvent));\n}\n\nProgressBar.defaultProps = {\n type: TYPE.DEFAULT,\n hide: false\n};\n\nvar Toast = function Toast(props) {\n var _cx;\n\n var _useToast = useToast(props),\n isRunning = _useToast.isRunning,\n preventExitTransition = _useToast.preventExitTransition,\n toastRef = _useToast.toastRef,\n eventHandlers = _useToast.eventHandlers;\n\n var closeButton = props.closeButton,\n children = props.children,\n autoClose = props.autoClose,\n onClick = props.onClick,\n type = props.type,\n hideProgressBar = props.hideProgressBar,\n closeToast = props.closeToast,\n Transition = props.transition,\n position = props.position,\n className = props.className,\n style = props.style,\n bodyClassName = props.bodyClassName,\n bodyStyle = props.bodyStyle,\n progressClassName = props.progressClassName,\n progressStyle = props.progressStyle,\n updateId = props.updateId,\n role = props.role,\n progress = props.progress,\n rtl = props.rtl,\n toastId = props.toastId,\n deleteToast = props.deleteToast,\n isIn = props.isIn;\n var defaultClassName = cx(\"Toastify\"\n /* CSS_NAMESPACE */\n + \"__toast\", \"Toastify\"\n /* CSS_NAMESPACE */\n + \"__toast--\" + type, (_cx = {}, _cx[\"Toastify\"\n /* CSS_NAMESPACE */\n + \"__toast--rtl\"] = rtl, _cx));\n var cssClasses = isFn(className) ? className({\n rtl: rtl,\n position: position,\n type: type,\n defaultClassName: defaultClassName\n }) : cx(defaultClassName, className);\n var isProgressControlled = !!progress;\n\n function renderCloseButton(closeButton) {\n if (!closeButton) return;\n var props = {\n closeToast: closeToast,\n type: type\n };\n if (isFn(closeButton)) return closeButton(props);\n if (isValidElement(closeButton)) return cloneElement(closeButton, props);\n }\n\n return createElement(Transition, {\n isIn: isIn,\n done: deleteToast,\n position: position,\n preventExitTransition: preventExitTransition,\n nodeRef: toastRef\n }, createElement(\"div\", Object.assign({\n id: toastId,\n onClick: onClick,\n className: cssClasses\n }, eventHandlers, {\n style: style,\n ref: toastRef\n }), createElement(\"div\", Object.assign({}, isIn && {\n role: role\n }, {\n className: isFn(bodyClassName) ? bodyClassName({\n type: type\n }) : cx(\"Toastify\"\n /* CSS_NAMESPACE */\n + \"__toast-body\", bodyClassName),\n style: bodyStyle\n }), children), renderCloseButton(closeButton), (autoClose || isProgressControlled) && createElement(ProgressBar, Object.assign({}, updateId && !isProgressControlled ? {\n key: \"pb-\" + updateId\n } : {}, {\n rtl: rtl,\n delay: autoClose,\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\nvar Bounce = /*#__PURE__*/cssTransition({\n enter: \"Toastify\"\n /* CSS_NAMESPACE */\n + \"--animate \" + \"Toastify\"\n /* CSS_NAMESPACE */\n + \"__bounce-enter\",\n exit: \"Toastify\"\n /* CSS_NAMESPACE */\n + \"--animate \" + \"Toastify\"\n /* CSS_NAMESPACE */\n + \"__bounce-exit\",\n appendPosition: true\n});\nvar Slide = /*#__PURE__*/cssTransition({\n enter: \"Toastify\"\n /* CSS_NAMESPACE */\n + \"--animate \" + \"Toastify\"\n /* CSS_NAMESPACE */\n + \"__slide-enter\",\n exit: \"Toastify\"\n /* CSS_NAMESPACE */\n + \"--animate \" + \"Toastify\"\n /* CSS_NAMESPACE */\n + \"__slide-exit\",\n appendPosition: true\n});\nvar Zoom = /*#__PURE__*/cssTransition({\n enter: \"Toastify\"\n /* CSS_NAMESPACE */\n + \"--animate \" + \"Toastify\"\n /* CSS_NAMESPACE */\n + \"__zoom-enter\",\n exit: \"Toastify\"\n /* CSS_NAMESPACE */\n + \"--animate \" + \"Toastify\"\n /* CSS_NAMESPACE */\n + \"__zoom-exit\"\n});\nvar Flip = /*#__PURE__*/cssTransition({\n enter: \"Toastify\"\n /* CSS_NAMESPACE */\n + \"--animate \" + \"Toastify\"\n /* CSS_NAMESPACE */\n + \"__flip-enter\",\n exit: \"Toastify\"\n /* CSS_NAMESPACE */\n + \"--animate \" + \"Toastify\"\n /* CSS_NAMESPACE */\n + \"__flip-exit\"\n});\n\nvar ToastContainer = function ToastContainer(props) {\n var _useToastContainer = useToastContainer(props),\n getToastToRender = _useToastContainer.getToastToRender,\n containerRef = _useToastContainer.containerRef,\n isToastActive = _useToastContainer.isToastActive;\n\n var className = props.className,\n style = props.style,\n rtl = props.rtl,\n containerId = props.containerId;\n\n function getClassName(position) {\n var _cx;\n\n var defaultClassName = cx(\"Toastify\"\n /* CSS_NAMESPACE */\n + \"__toast-container\", \"Toastify\"\n /* CSS_NAMESPACE */\n + \"__toast-container--\" + position, (_cx = {}, _cx[\"Toastify\"\n /* CSS_NAMESPACE */\n + \"__toast-container--rtl\"] = rtl, _cx));\n return isFn(className) ? className({\n position: position,\n rtl: rtl,\n defaultClassName: defaultClassName\n }) : cx(defaultClassName, parseClassName(className));\n }\n\n return createElement(\"div\", {\n ref: containerRef,\n className: \"Toastify\"\n /* CSS_NAMESPACE */\n ,\n id: containerId\n }, getToastToRender(function (position, toastList) {\n var containerStyle = toastList.length === 0 ? _extends({}, style, {\n pointerEvents: 'none'\n }) : _extends({}, style);\n return createElement(\"div\", {\n className: getClassName(position),\n style: containerStyle,\n key: \"container-\" + position\n }, toastList.map(function (_ref) {\n var content = _ref.content,\n toastProps = _ref.props;\n return createElement(Toast, Object.assign({}, toastProps, {\n isIn: isToastActive(toastProps.toastId),\n key: \"toast-\" + toastProps.key,\n closeButton: toastProps.closeButton === true ? CloseButton : toastProps.closeButton\n }), content);\n }));\n }));\n};\n\nToastContainer.defaultProps = {\n position: POSITION.TOP_RIGHT,\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: 80\n /* DRAGGABLE_PERCENT */\n ,\n draggableDirection: \"x\"\n /* X */\n ,\n role: 'alert'\n};\nvar containers = /*#__PURE__*/new Map();\nvar latestInstance;\nvar containerDomNode;\nvar containerConfig;\nvar queue = [];\nvar lazy = false;\n/**\r\n * Check whether any container is currently mounted in the DOM\r\n */\n\nfunction isAnyContainerMounted() {\n return containers.size > 0;\n}\n/**\r\n * Get the toast by id, given it's in the DOM, otherwise returns null\r\n */\n\n\nfunction getToast(toastId, _ref) {\n var containerId = _ref.containerId;\n var container = containers.get(containerId || latestInstance);\n if (!container) return null;\n return container.getToast(toastId);\n}\n/**\r\n * Generate a random toastId\r\n */\n\n\nfunction generateToastId() {\n return Math.random().toString(36).substr(2, 9);\n}\n/**\r\n * Generate a toastId or use the one provided\r\n */\n\n\nfunction getToastId(options) {\n if (options && (isStr(options.toastId) || isNum(options.toastId))) {\n return options.toastId;\n }\n\n return generateToastId();\n}\n/**\r\n * If the container is not mounted, the toast is enqueued and\r\n * the container lazy mounted\r\n */\n\n\nfunction dispatchToast(content, options) {\n if (isAnyContainerMounted()) {\n eventManager.emit(0\n /* Show */\n , content, options);\n } else {\n queue.push({\n content: content,\n options: options\n });\n\n if (lazy && canUseDom) {\n lazy = false;\n containerDomNode = document.createElement('div');\n document.body.appendChild(containerDomNode);\n render(createElement(ToastContainer, Object.assign({}, containerConfig)), containerDomNode);\n }\n }\n\n return options.toastId;\n}\n/**\r\n * Merge provided options with the defaults settings and generate the toastId\r\n */\n\n\nfunction mergeOptions(type, options) {\n return _extends({}, options, {\n type: options && options.type || type,\n toastId: getToastId(options)\n });\n}\n\nvar createToastByType = function createToastByType(type) {\n return function (content, options) {\n return dispatchToast(content, mergeOptions(type, options));\n };\n};\n\nvar toast = function toast(content, options) {\n return dispatchToast(content, mergeOptions(TYPE.DEFAULT, options));\n};\n\ntoast.success = /*#__PURE__*/createToastByType(TYPE.SUCCESS);\ntoast.info = /*#__PURE__*/createToastByType(TYPE.INFO);\ntoast.error = /*#__PURE__*/createToastByType(TYPE.ERROR);\ntoast.warning = /*#__PURE__*/createToastByType(TYPE.WARNING);\ntoast.dark = /*#__PURE__*/createToastByType(TYPE.DARK);\ntoast.warn = toast.warning;\n/**\r\n * Remove toast programmaticaly\r\n */\n\ntoast.dismiss = function (id) {\n return eventManager.emit(1\n /* Clear */\n , id);\n};\n/**\r\n * Clear waiting queue when limit is used\r\n */\n\n\ntoast.clearWaitingQueue = function (params) {\n if (params === void 0) {\n params = {};\n }\n\n return eventManager.emit(5\n /* ClearWaitingQueue */\n , params);\n};\n/**\r\n * return true if one container is displaying the toast\r\n */\n\n\ntoast.isActive = function (id) {\n var isToastActive = false;\n containers.forEach(function (container) {\n if (container.isToastActive && container.isToastActive(id)) {\n isToastActive = true;\n }\n });\n return isToastActive;\n};\n\ntoast.update = function (toastId, options) {\n if (options === void 0) {\n options = {};\n } // if you call toast and toast.update directly nothing will be displayed\n // this is why I defered the update\n\n\n setTimeout(function () {\n var toast = getToast(toastId, options);\n\n if (toast) {\n var oldOptions = toast.props,\n oldContent = toast.content;\n\n var nextOptions = _extends({}, oldOptions, options, {\n toastId: options.toastId || toastId,\n updateId: generateToastId()\n });\n\n if (nextOptions.toastId !== toastId) nextOptions.staleId = toastId;\n var content = nextOptions.render || oldContent;\n delete nextOptions.render;\n dispatchToast(content, nextOptions);\n }\n }, 0);\n};\n/**\r\n * Used for controlled progress bar.\r\n */\n\n\ntoast.done = function (id) {\n toast.update(id, {\n progress: 1\n });\n};\n/**\r\n * Track changes. The callback get the number of toast displayed\r\n *\r\n */\n\n\ntoast.onChange = function (callback) {\n if (isFn(callback)) {\n eventManager.on(4\n /* Change */\n , callback);\n }\n\n return function () {\n isFn(callback) && eventManager.off(4\n /* Change */\n , callback);\n };\n};\n/**\r\n * Configure the ToastContainer when lazy mounted\r\n */\n\n\ntoast.configure = function (config) {\n if (config === void 0) {\n config = {};\n }\n\n lazy = true;\n containerConfig = config;\n};\n\ntoast.POSITION = POSITION;\ntoast.TYPE = TYPE;\n/**\r\n * Wait until the ToastContainer is mounted to dispatch the toast\r\n * and attach isActive method\r\n */\n\neventManager.on(2\n/* DidMount */\n, function (containerInstance) {\n latestInstance = containerInstance.containerId || containerInstance;\n containers.set(latestInstance, containerInstance);\n queue.forEach(function (item) {\n eventManager.emit(0\n /* Show */\n , item.content, item.options);\n });\n queue = [];\n}).on(3\n/* WillUnmount */\n, function (containerInstance) {\n containers[\"delete\"](containerInstance.containerId || containerInstance);\n\n if (containers.size === 0) {\n eventManager.off(0\n /* Show */\n ).off(1\n /* Clear */\n ).off(5\n /* ClearWaitingQueue */\n );\n }\n\n if (canUseDom && containerDomNode) {\n document.body.removeChild(containerDomNode);\n }\n});\nexport { Bounce, Flip, Slide, ToastContainer, Zoom, collapseToast, cssTransition, toast, useToast, useToastContainer };","map":{"version":3,"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"],"names":["isNum","v","isNaN","isBool","isStr","isFn","parseClassName","isToastIdValid","toastId","getAutoCloseDelay","toastAutoClose","containerAutoClose","canUseDom","window","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","style","requestAnimationFrame","setTimeout","cssTransition","enter","exit","appendPosition","collapse","collapseDuration","children","position","preventExitTransition","nodeRef","isIn","enterClassName","exitClassName","baseClassName","useRef","animationStep","useLayoutEffect","onEnter","useEffect","onExited","onExit","React","eventManager","list","emitQueue","on","off","cb","cancelEmit","timers","emit","args","timer","callback","useKeeper","arg","refresh","ref","reducer","state","action","id","useToastContainer","props","forceUpdate","useReducer","x","toast","dispatch","containerRef","toastCount","queue","collection","instance","toastKey","displayedToast","containerId","isToastActive","getToast","removeToast","limit","type","toastContent","toastProps","staleId","appendToast","updateId","delay","options","isNotValid","closeToast","isNotAnUpdate","key","closeButton","rtl","transition","className","bodyClassName","bodyStyle","onClick","pauseOnHover","pauseOnFocusLoss","draggable","draggablePercent","draggableDirection","closeOnClick","progressClassName","progressStyle","autoClose","hideProgressBar","progress","role","deleteToast","removeFromCollection","cloneElement","queueLen","freeSlot","dequeueToast","toDequeue","i","toastToRender","toastList","Object","getToastToRender","e","useToast","isRunning","setIsRunning","useState","setPreventExitTransition","toastRef","drag","start","y","delta","removalDistance","canCloseOnClick","canDrag","boundingRect","syncProps","bindDragEvents","unbindDragEvents","bindFocusEvents","unbindFocusEvents","getX","getY","top","bottom","left","right","pauseToast","playToast","document","Math","eventHandlers","onMouseDown","onTouchStart","onMouseUp","onTouchEnd","onDragTransitionEnd","CloseButton","ariaLabel","viewBox","fillRule","d","ProgressBar","hide","userStyle","controlledProgress","animationDuration","animationPlayState","opacity","defaultClassName","cx","classNames","animationEvent","Toast","Transition","cssClasses","isProgressControlled","renderCloseButton","Bounce","Slide","Zoom","Flip","ToastContainer","containerStyle","pointerEvents","getClassName","newestOnTop","containers","lazy","container","generateToastId","isAnyContainerMounted","containerDomNode","render","getToastId","createToastByType","dispatchToast","mergeOptions","params","oldOptions","oldContent","nextOptions","config","containerConfig","latestInstance","containerInstance","item"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;SAIgBA,K,CAAMC,C,EAAAA;AACpB,SAAO,OAAA,CAAA,KAAA,QAAA,IAAyB,CAACC,KAAK,CAAtC,CAAsC,CAAtC;AACD;;SAEeC,M,CAAOF,C,EAAAA;AACrB,SAAO,OAAA,CAAA,KAAP,SAAA;AACD;;SAEeG,K,CAAMH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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' | '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<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() {\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 window.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 = 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 } = 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<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 { TypeOptions } from '../types';\n\nexport interface CloseButtonProps {\n closeToast: (e: React.MouseEvent<HTMLElement>) => void;\n type: TypeOptions;\n ariaLabel?: string;\n}\n\nexport function CloseButton({\n closeToast,\n type,\n ariaLabel = 'close'\n}: CloseButtonProps) {\n return (\n <button\n className={`${Default.CSS_NAMESPACE}__close-button ${Default.CSS_NAMESPACE}__close-button--${type}`}\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 } 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 <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 * 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<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 } = 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 <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 {children}\n </div>\n {renderCloseButton(closeButton)}\n {(autoClose || isProgressControlled) && (\n <ProgressBar\n {...(updateId && !isProgressControlled\n ? { key: `pb-${updateId}` }\n : {})}\n rtl={rtl}\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};\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<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.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"]},"metadata":{},"sourceType":"module"}