{"version":3,"file":"ToastManager-31b55738.js","sources":["../../../../../../app/node_modules/react-bootstrap/esm/ToastFade.js","../../../../../../app/node_modules/react-bootstrap/esm/ToastContext.js","../../../../../../app/node_modules/react-bootstrap/esm/ToastHeader.js","../../../../../../app/node_modules/react-bootstrap/esm/ToastBody.js","../../../../../../app/node_modules/react-bootstrap/esm/Toast.js","../../../../../../app/node_modules/react-bootstrap/esm/ToastContainer.js","../../../app/javascript/components_shared/Toast/ToastComponent.tsx","../../../app/javascript/components_shared/Toast/ToastManager.tsx"],"sourcesContent":["import * as React from 'react';\nimport { ENTERING, EXITING } from 'react-transition-group/Transition';\nimport Fade from './Fade';\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nconst fadeStyles = {\n [ENTERING]: 'showing',\n [EXITING]: 'showing show'\n};\nconst ToastFade = /*#__PURE__*/React.forwardRef((props, ref) => /*#__PURE__*/_jsx(Fade, {\n ...props,\n ref: ref,\n transitionClasses: fadeStyles\n}));\nToastFade.displayName = 'ToastFade';\nexport default ToastFade;","\"use client\";\n\nimport * as React from 'react';\nconst ToastContext = /*#__PURE__*/React.createContext({\n // eslint-disable-next-line @typescript-eslint/no-empty-function\n onClose() {}\n});\nexport default ToastContext;","\"use client\";\n\nimport classNames from 'classnames';\nimport * as React from 'react';\nimport { useContext } from 'react';\nimport useEventCallback from '@restart/hooks/useEventCallback';\nimport { useBootstrapPrefix } from './ThemeProvider';\nimport CloseButton from './CloseButton';\nimport ToastContext from './ToastContext';\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nimport { jsxs as _jsxs } from \"react/jsx-runtime\";\nconst ToastHeader = /*#__PURE__*/React.forwardRef(({\n bsPrefix,\n closeLabel = 'Close',\n closeVariant,\n closeButton = true,\n className,\n children,\n ...props\n}, ref) => {\n bsPrefix = useBootstrapPrefix(bsPrefix, 'toast-header');\n const context = useContext(ToastContext);\n const handleClick = useEventCallback(e => {\n context == null ? void 0 : context.onClose == null ? void 0 : context.onClose(e);\n });\n return /*#__PURE__*/_jsxs(\"div\", {\n ref: ref,\n ...props,\n className: classNames(bsPrefix, className),\n children: [children, closeButton && /*#__PURE__*/_jsx(CloseButton, {\n \"aria-label\": closeLabel,\n variant: closeVariant,\n onClick: handleClick,\n \"data-dismiss\": \"toast\"\n })]\n });\n});\nToastHeader.displayName = 'ToastHeader';\nexport default ToastHeader;","\"use client\";\n\nimport * as React from 'react';\nimport classNames from 'classnames';\nimport { useBootstrapPrefix } from './ThemeProvider';\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nconst ToastBody = /*#__PURE__*/React.forwardRef(({\n className,\n bsPrefix,\n as: Component = 'div',\n ...props\n}, ref) => {\n bsPrefix = useBootstrapPrefix(bsPrefix, 'toast-body');\n return /*#__PURE__*/_jsx(Component, {\n ref: ref,\n className: classNames(className, bsPrefix),\n ...props\n });\n});\nToastBody.displayName = 'ToastBody';\nexport default ToastBody;","\"use client\";\n\nimport * as React from 'react';\nimport { useEffect, useMemo, useRef, useCallback } from 'react';\nimport classNames from 'classnames';\nimport useTimeout from '@restart/hooks/useTimeout';\nimport ToastFade from './ToastFade';\nimport ToastHeader from './ToastHeader';\nimport ToastBody from './ToastBody';\nimport { useBootstrapPrefix } from './ThemeProvider';\nimport ToastContext from './ToastContext';\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nconst Toast = /*#__PURE__*/React.forwardRef(({\n bsPrefix,\n className,\n transition: Transition = ToastFade,\n show = true,\n animation = true,\n delay = 5000,\n autohide = false,\n onClose,\n onEntered,\n onExit,\n onExiting,\n onEnter,\n onEntering,\n onExited,\n bg,\n ...props\n}, ref) => {\n bsPrefix = useBootstrapPrefix(bsPrefix, 'toast');\n\n // We use refs for these, because we don't want to restart the autohide\n // timer in case these values change.\n const delayRef = useRef(delay);\n const onCloseRef = useRef(onClose);\n useEffect(() => {\n delayRef.current = delay;\n onCloseRef.current = onClose;\n }, [delay, onClose]);\n const autohideTimeout = useTimeout();\n const autohideToast = !!(autohide && show);\n const autohideFunc = useCallback(() => {\n if (autohideToast) {\n onCloseRef.current == null ? void 0 : onCloseRef.current();\n }\n }, [autohideToast]);\n useEffect(() => {\n // Only reset timer if show or autohide changes.\n autohideTimeout.set(autohideFunc, delayRef.current);\n }, [autohideTimeout, autohideFunc]);\n const toastContext = useMemo(() => ({\n onClose\n }), [onClose]);\n const hasAnimation = !!(Transition && animation);\n const toast = /*#__PURE__*/_jsx(\"div\", {\n ...props,\n ref: ref,\n className: classNames(bsPrefix, className, bg && `bg-${bg}`, !hasAnimation && (show ? 'show' : 'hide')),\n role: \"alert\",\n \"aria-live\": \"assertive\",\n \"aria-atomic\": \"true\"\n });\n return /*#__PURE__*/_jsx(ToastContext.Provider, {\n value: toastContext,\n children: hasAnimation && Transition ? /*#__PURE__*/_jsx(Transition, {\n in: show,\n onEnter: onEnter,\n onEntering: onEntering,\n onEntered: onEntered,\n onExit: onExit,\n onExiting: onExiting,\n onExited: onExited,\n unmountOnExit: true,\n children: toast\n }) : toast\n });\n});\nToast.displayName = 'Toast';\nexport default Object.assign(Toast, {\n Body: ToastBody,\n Header: ToastHeader\n});","\"use client\";\n\nimport classNames from 'classnames';\nimport * as React from 'react';\nimport { useBootstrapPrefix } from './ThemeProvider';\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nconst positionClasses = {\n 'top-start': 'top-0 start-0',\n 'top-center': 'top-0 start-50 translate-middle-x',\n 'top-end': 'top-0 end-0',\n 'middle-start': 'top-50 start-0 translate-middle-y',\n 'middle-center': 'top-50 start-50 translate-middle',\n 'middle-end': 'top-50 end-0 translate-middle-y',\n 'bottom-start': 'bottom-0 start-0',\n 'bottom-center': 'bottom-0 start-50 translate-middle-x',\n 'bottom-end': 'bottom-0 end-0'\n};\nconst ToastContainer = /*#__PURE__*/React.forwardRef(({\n bsPrefix,\n position,\n containerPosition,\n className,\n // Need to define the default \"as\" during prop destructuring to be compatible with styled-components github.com/react-bootstrap/react-bootstrap/issues/3595\n as: Component = 'div',\n ...props\n}, ref) => {\n bsPrefix = useBootstrapPrefix(bsPrefix, 'toast-container');\n return /*#__PURE__*/_jsx(Component, {\n ref: ref,\n ...props,\n className: classNames(bsPrefix, position && positionClasses[position], containerPosition && `position-${containerPosition}`, className)\n });\n});\nToastContainer.displayName = 'ToastContainer';\nexport default ToastContainer;","import React, { FC } from 'react'\nimport { Toast as BootstrapToast } from 'react-bootstrap'\nimport CloseButton from 'components_shared/CloseButton/CloseButton'\nimport Toast from 'components_shared/Toast/Toast'\nimport classNames from 'classnames'\nimport './ToastComponent.scss'\n\ninterface Props {\n toast: Toast\n onClose: () => void\n}\n\nconst TYPE_MAPPING = {\n error: 'danger',\n warning: 'warning',\n info: 'info',\n success: 'success',\n}\n\nconst ToastComponent: FC = ({\n toast: {\n type,\n icon,\n message,\n title,\n persistent = false,\n delay = 12000,\n }, onClose,\n}) => {\n const toastType = type ? TYPE_MAPPING[type] || type : type\n\n return (\n \n \n {icon &&
}\n
\n {title}\n {' '}\n {message}\n
\n \n
\n \n )\n}\n\nexport default ToastComponent\n","import React, { FC, useCallback, useMemo, useState } from 'react'\nimport Toast from 'components_shared/Toast/Toast'\nimport { v4 as uuid } from 'uuid'\nimport { ToastContainer } from 'react-bootstrap'\nimport { ToastContext } from 'components_shared/Toast/ToastContext'\nimport ToastComponent from 'components_shared/Toast/ToastComponent'\n\nconst POSITION_OFFSET = 'position-fixed mt-4'\n\ndeclare global {\n interface Window {\n INITIAL_TOAST_NOTIFICATIONS?: Toast[]\n }\n}\n\ninterface Props {\n initialToasts?: Toast[]\n}\n\ninterface ToastWithId {\n toast: Toast\n id: string\n}\n\nexport const ToastManager: FC = (\n { initialToasts = window.INITIAL_TOAST_NOTIFICATIONS || [], children },\n) => {\n const [toasts, setToasts] = useState(initialToasts.map((toast) => ({\n toast,\n id: uuid(),\n })))\n\n const removeToast = (id: string) => {\n setToasts((prevToasts) => prevToasts.filter((toast) => toast.id !== id))\n }\n\n const showToast = useCallback((toast: Toast) => {\n setToasts((prevToasts) => [...prevToasts, { toast, id: uuid() }])\n }, [setToasts])\n\n const toastContext: ToastContext = useMemo(() => ({ showToast }), [showToast])\n\n return (\n \n \n {toasts.map((toast) => (\n removeToast(toast.id)} />\n ))}\n \n {children}\n \n )\n}\n\nexport default ToastManager\n"],"names":["fadeStyles","ENTERING","EXITING","ToastFade","React.forwardRef","props","ref","_jsx","Fade","ToastFade$1","ToastContext","React.createContext","ToastContext$1","ToastHeader","bsPrefix","closeLabel","closeVariant","closeButton","className","children","useBootstrapPrefix","context","useContext","handleClick","useEventCallback","e","_jsxs","classNames","CloseButton","ToastHeader$1","ToastBody","Component","ToastBody$1","Toast","Transition","show","animation","delay","autohide","onClose","onEntered","onExit","onExiting","onEnter","onEntering","onExited","bg","delayRef","useRef","onCloseRef","useEffect","autohideTimeout","useTimeout","autohideToast","autohideFunc","useCallback","toastContext","useMemo","hasAnimation","toast","BootstrapToast","positionClasses","ToastContainer","position","containerPosition","ToastContainer$1","TYPE_MAPPING","ToastComponent","type","icon","message","title","persistent","toastType","React","POSITION_OFFSET","ToastManager","initialToasts","toasts","setToasts","useState","uuid","removeToast","id","prevToasts","showToast","ToastManager$1"],"mappings":"suBAIA,MAAMA,EAAa,CACjB,CAACC,CAAQ,EAAG,UACZ,CAACC,CAAO,EAAG,cACb,EACMC,EAAyBC,EAAgB,WAAC,CAACC,EAAOC,IAAqBC,EAAAA,IAAKC,EAAM,CACtF,GAAGH,EACH,IAAKC,EACL,kBAAmBN,CACrB,CAAC,CAAC,EACFG,EAAU,YAAc,YACxB,MAAAM,EAAeN,ECXTO,EAA4BC,EAAAA,cAAoB,CAEpD,SAAU,CAAE,CACd,CAAC,EACDC,EAAeF,ECITG,EAA2BT,EAAgB,WAAC,CAAC,CACjD,SAAAU,EACA,WAAAC,EAAa,QACb,aAAAC,EACA,YAAAC,EAAc,GACd,UAAAC,EACA,SAAAC,EACA,GAAGd,CACL,EAAGC,IAAQ,CACTQ,EAAWM,EAAmBN,EAAU,cAAc,EACtD,MAAMO,EAAUC,aAAWZ,CAAY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