flashpop 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.esm.js","sources":["../src/icons.jsx","../src/ToastItem.jsx","../src/ToastContainer.jsx","../src/ToastContext.jsx"],"sourcesContent":["import React from 'react';\n\n/**\n * Success Icon SVG\n */\nexport const SuccessIcon = ({ size = 20, className = '', ...props }) => (\n <svg\n width={size}\n height={size}\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n className={`easy-toast-icon easy-toast-icon--success ${className}`}\n aria-hidden=\"true\"\n {...props}\n >\n <path d=\"M22 11.08V12a10 10 0 1 1-5.93-9.14\" />\n <polyline points=\"22 4 12 14.01 9 11.01\" />\n </svg>\n);\n\n/**\n * Error Icon SVG\n */\nexport const ErrorIcon = ({ size = 20, className = '', ...props }) => (\n <svg\n width={size}\n height={size}\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n className={`easy-toast-icon easy-toast-icon--error ${className}`}\n aria-hidden=\"true\"\n {...props}\n >\n <circle cx=\"12\" cy=\"12\" r=\"10\" />\n <line x1=\"15\" y1=\"9\" x2=\"9\" y2=\"15\" />\n <line x1=\"9\" y1=\"9\" x2=\"15\" y2=\"15\" />\n </svg>\n);\n\n/**\n * Warning Icon SVG\n */\nexport const WarningIcon = ({ size = 20, className = '', ...props }) => (\n <svg\n width={size}\n height={size}\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n className={`easy-toast-icon easy-toast-icon--warning ${className}`}\n aria-hidden=\"true\"\n {...props}\n >\n <path d=\"M10.29 3.86L1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z\" />\n <line x1=\"12\" y1=\"9\" x2=\"12\" y2=\"13\" />\n <line x1=\"12\" y1=\"17\" x2=\"12.01\" y2=\"17\" />\n </svg>\n);\n\n/**\n * Info Icon SVG\n */\nexport const InfoIcon = ({ size = 20, className = '', ...props }) => (\n <svg\n width={size}\n height={size}\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n className={`easy-toast-icon easy-toast-icon--info ${className}`}\n aria-hidden=\"true\"\n {...props}\n >\n <circle cx=\"12\" cy=\"12\" r=\"10\" />\n <line x1=\"12\" y1=\"16\" x2=\"12\" y2=\"12\" />\n <line x1=\"12\" y1=\"8\" x2=\"12.01\" y2=\"8\" />\n </svg>\n);\n\n/**\n * Loading Spinner SVG\n */\nexport const LoadingIcon = ({ size = 20, className = '', ...props }) => (\n <svg\n width={size}\n height={size}\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2.5\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n className={`easy-toast-icon easy-toast-icon--loading ${className}`}\n aria-hidden=\"true\"\n {...props}\n >\n <path d=\"M21 12a9 9 0 1 1-6.219-8.56\" />\n </svg>\n);\n\n/**\n * Close (Dismiss) Button Icon SVG\n */\nexport const CloseIcon = ({ size = 16, className = '', ...props }) => (\n <svg\n width={size}\n height={size}\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n className={`easy-toast-close-icon ${className}`}\n aria-hidden=\"true\"\n {...props}\n >\n <line x1=\"18\" y1=\"6\" x2=\"6\" y2=\"18\" />\n <line x1=\"6\" y1=\"6\" x2=\"18\" y2=\"18\" />\n </svg>\n);\n","import React, { useEffect, useRef, useState, useCallback } from 'react';\nimport {\n SuccessIcon,\n ErrorIcon,\n WarningIcon,\n InfoIcon,\n LoadingIcon,\n CloseIcon,\n} from './icons';\n\n/**\n * ToastItem Component\n * Renders an individual notification card with animations, timers, actions, and swipe to accept/cancel.\n */\nexport const ToastItem = ({\n id,\n type = 'default',\n title,\n message,\n duration = 3000,\n showProgressBar = true,\n pauseOnHover = true,\n closeButton = true,\n icon,\n action,\n onClose,\n onAccept,\n onCancel,\n acceptLabel,\n cancelLabel = 'Dismiss',\n swipeable = true,\n swipeThreshold = 70,\n theme = 'light',\n className = '',\n style = {},\n onDismiss,\n}) => {\n const [isExiting, setIsExiting] = useState(false);\n const [exitDirection, setExitDirection] = useState(null); // 'left' | 'right' | null\n const [isPaused, setIsPaused] = useState(false);\n\n // Swipe state\n const [isDragging, setIsDragging] = useState(false);\n const [dragOffset, setDragOffset] = useState(0);\n const startXRef = useRef(0);\n const isPointerDownRef = useRef(false);\n \n // Ref to track remaining duration when paused\n const remainingTimeRef = useRef(duration);\n const startTimeRef = useRef(null);\n const timerRef = useRef(null);\n\n // Check if this toast supports an \"accept\" action\n const hasAcceptAction = Boolean(onAccept || (action && action.onClick));\n const resolvedAcceptLabel = acceptLabel || (action && action.label) || 'Accept';\n\n // Trigger graceful exit animation before removal\n const handleDismiss = useCallback((direction = null) => {\n if (isExiting) return;\n setIsExiting(true);\n if (direction) {\n setExitDirection(direction);\n }\n if (onClose) {\n onClose(id);\n }\n // Match the CSS exit animation duration\n setTimeout(() => {\n onDismiss(id);\n }, 280);\n }, [id, isExiting, onClose, onDismiss]);\n\n // Trigger accept action\n const handleAccept = useCallback(() => {\n if (isExiting) return;\n if (onAccept) {\n onAccept(id);\n } else if (action && action.onClick) {\n action.onClick(id);\n }\n handleDismiss('right');\n }, [action, handleDismiss, id, isExiting, onAccept]);\n\n // Handle auto-dismiss timer\n useEffect(() => {\n if (duration === false || duration === Infinity || duration <= 0) {\n return;\n }\n\n const startTimer = (time) => {\n startTimeRef.current = Date.now();\n timerRef.current = setTimeout(() => {\n handleDismiss();\n }, time);\n };\n\n if (!isPaused && !isDragging) {\n startTimer(remainingTimeRef.current);\n }\n\n return () => {\n if (timerRef.current) {\n clearTimeout(timerRef.current);\n }\n };\n }, [duration, isPaused, isDragging, handleDismiss]);\n\n // Pause on mouse enter\n const handleMouseEnter = () => {\n if (!pauseOnHover || duration === false || duration === Infinity || duration <= 0) {\n return;\n }\n if (timerRef.current) {\n clearTimeout(timerRef.current);\n const elapsed = Date.now() - startTimeRef.current;\n remainingTimeRef.current = Math.max(0, remainingTimeRef.current - elapsed);\n }\n setIsPaused(true);\n };\n\n // Resume on mouse leave\n const handleMouseLeave = () => {\n if (!pauseOnHover || duration === false || duration === Infinity || duration <= 0 || isDragging) {\n return;\n }\n setIsPaused(false);\n };\n\n // --- Pointer Swipe Handlers ---\n const handlePointerDown = (e) => {\n if (!swipeable || isExiting) return;\n // Don't drag if clicking buttons or interactive elements\n if (e.target.closest('button') || e.target.closest('a')) return;\n if (e.button !== undefined && e.button !== 0) return; // Only primary mouse button\n\n isPointerDownRef.current = true;\n startXRef.current = e.clientX;\n setIsDragging(true);\n\n // Pause timer while swiping\n if (timerRef.current) {\n clearTimeout(timerRef.current);\n const elapsed = Date.now() - (startTimeRef.current || Date.now());\n remainingTimeRef.current = Math.max(0, remainingTimeRef.current - elapsed);\n }\n\n try {\n e.currentTarget.setPointerCapture(e.pointerId);\n } catch (err) {\n // Ignore if setPointerCapture not supported\n }\n };\n\n const handlePointerMove = (e) => {\n if (!isPointerDownRef.current || !isDragging) return;\n const currentX = e.clientX;\n const diff = currentX - startXRef.current;\n setDragOffset(diff);\n };\n\n const handlePointerUp = (e) => {\n if (!isPointerDownRef.current) return;\n isPointerDownRef.current = false;\n setIsDragging(false);\n\n try {\n e.currentTarget.releasePointerCapture(e.pointerId);\n } catch (err) {\n // Ignore\n }\n\n // Check if swipe distance exceeded threshold\n if (dragOffset >= swipeThreshold) {\n // Swiped Right\n if (hasAcceptAction) {\n handleAccept();\n } else {\n if (onCancel) onCancel(id);\n handleDismiss('right');\n }\n } else if (dragOffset <= -swipeThreshold) {\n // Swiped Left\n if (onCancel) onCancel(id);\n handleDismiss('left');\n } else {\n // Reset back to center\n setDragOffset(0);\n setIsPaused(false);\n }\n };\n\n const handlePointerCancel = () => {\n isPointerDownRef.current = false;\n setIsDragging(false);\n setDragOffset(0);\n setIsPaused(false);\n };\n\n // Resolve appropriate icon\n const renderIcon = () => {\n if (icon === false) return null;\n if (icon && React.isValidElement(icon)) {\n return <span className=\"easy-toast-custom-icon\">{icon}</span>;\n }\n\n switch (type) {\n case 'success':\n return <SuccessIcon />;\n case 'error':\n return <ErrorIcon />;\n case 'warning':\n return <WarningIcon />;\n case 'info':\n return <InfoIcon />;\n case 'loading':\n return <LoadingIcon />;\n default:\n return null;\n }\n };\n\n const hasIcon = icon !== false && (icon || type !== 'default');\n const hasProgressBar = showProgressBar && duration && duration !== Infinity && duration > 0;\n\n // Compute inline drag transform\n const getDragStyle = () => {\n if (isDragging) {\n return {\n transform: `translateX(${dragOffset}px)`,\n transition: 'none',\n opacity: Math.max(0.45, 1 - Math.abs(dragOffset) / 280),\n };\n }\n if (exitDirection === 'left') {\n return {\n transform: 'translateX(-115%) scale(0.9)',\n opacity: 0,\n transition: 'transform 0.28s cubic-bezier(0.4, 0, 1, 1), opacity 0.28s ease',\n };\n }\n if (exitDirection === 'right') {\n return {\n transform: 'translateX(115%) scale(0.9)',\n opacity: 0,\n transition: 'transform 0.28s cubic-bezier(0.4, 0, 1, 1), opacity 0.28s ease',\n };\n }\n return {\n transition: 'transform 0.24s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.24s ease',\n };\n };\n\n // Visual cues during swipe\n const isSwipingAccept = dragOffset > 25 && hasAcceptAction;\n const isSwipingDismissRight = dragOffset > 25 && !hasAcceptAction;\n const isSwipingCancel = dragOffset < -25;\n\n return (\n <div\n role={type === 'error' ? 'alert' : 'status'}\n aria-live={type === 'error' ? 'assertive' : 'polite'}\n className={`easy-toast-item easy-toast--${type} easy-toast--theme-${theme} ${\n isExiting ? 'easy-toast--exit' : 'easy-toast--enter'\n } ${swipeable ? 'easy-toast--swipeable' : ''} ${\n isDragging ? 'easy-toast--dragging' : ''\n } ${isSwipingAccept ? 'easy-toast--swipe-accept' : ''} ${\n isSwipingCancel || isSwipingDismissRight ? 'easy-toast--swipe-cancel' : ''\n } ${className}`}\n style={{\n ...style,\n ...getDragStyle(),\n }}\n onMouseEnter={handleMouseEnter}\n onMouseLeave={handleMouseLeave}\n onPointerDown={handlePointerDown}\n onPointerMove={handlePointerMove}\n onPointerUp={handlePointerUp}\n onPointerCancel={handlePointerCancel}\n >\n {/* Swipe Badges/Hints */}\n {isSwipingAccept && (\n <div className=\"easy-toast-swipe-badge easy-toast-swipe-badge--accept\">\n ✓ {resolvedAcceptLabel}\n </div>\n )}\n\n {(isSwipingCancel || isSwipingDismissRight) && (\n <div className=\"easy-toast-swipe-badge easy-toast-swipe-badge--cancel\">\n ✕ {cancelLabel}\n </div>\n )}\n\n <div className=\"easy-toast-content-wrapper\">\n {hasIcon && <div className=\"easy-toast-icon-container\">{renderIcon()}</div>}\n\n <div className=\"easy-toast-text-container\">\n {title && <div className=\"easy-toast-title\">{title}</div>}\n <div className=\"easy-toast-message\">{message}</div>\n </div>\n\n {action && (\n <div className=\"easy-toast-action-container\">\n <button\n type=\"button\"\n className=\"easy-toast-action-button\"\n onClick={() => {\n action.onClick?.(id);\n if (action.dismissOnClick !== false) {\n handleDismiss('right');\n }\n }}\n >\n {action.label}\n </button>\n </div>\n )}\n\n {closeButton && (\n <button\n type=\"button\"\n className=\"easy-toast-close-button\"\n aria-label=\"Close notification\"\n onClick={() => handleDismiss()}\n >\n <CloseIcon />\n </button>\n )}\n </div>\n\n {hasProgressBar && (\n <div className=\"easy-toast-progress-bar-track\">\n <div\n className=\"easy-toast-progress-bar\"\n style={{\n animationDuration: `${duration}ms`,\n animationPlayState: isPaused || isDragging ? 'paused' : 'running',\n }}\n />\n </div>\n )}\n </div>\n );\n};\n","import React from 'react';\nimport { createPortal } from 'react-dom';\nimport { ToastItem } from './ToastItem';\n\nconst VALID_POSITIONS = [\n 'top-left',\n 'top-center',\n 'top-right',\n 'bottom-left',\n 'bottom-center',\n 'bottom-right',\n];\n\n/**\n * ToastContainer Component\n * Renders toast groups in their respective screen positions via a React Portal.\n */\nexport const ToastContainer = ({\n toasts = [],\n onDismiss,\n position: defaultPosition = 'top-right',\n theme: defaultTheme = 'light',\n newestOnTop = false,\n pauseOnHover = true,\n showProgressBar = true,\n swipeable = true,\n swipeThreshold = 70,\n limit,\n className = '',\n style = {},\n}) => {\n // Guard for SSR (Next.js, Gatsby, Remix)\n const isMounted = typeof window !== 'undefined' && typeof document !== 'undefined';\n\n if (!isMounted) {\n return null;\n }\n\n // Filter toasts if limit is set\n const visibleToasts = limit && limit > 0 ? toasts.slice(-limit) : toasts;\n\n // Group toasts by position\n const groupedToasts = visibleToasts.reduce((acc, toast) => {\n const pos = toast.position || defaultPosition;\n const validPos = VALID_POSITIONS.includes(pos) ? pos : 'top-right';\n if (!acc[validPos]) {\n acc[validPos] = [];\n }\n acc[validPos].push(toast);\n return acc;\n }, {});\n\n const portalContent = (\n <div className={`easy-toast-portal ${className}`} style={style}>\n {Object.entries(groupedToasts).map(([pos, items]) => {\n const sortedItems = newestOnTop ? [...items].reverse() : items;\n\n return (\n <div\n key={pos}\n className={`easy-toast-container easy-toast-container--${pos}`}\n aria-live=\"polite\"\n >\n {sortedItems.map((toast) => (\n <ToastItem\n key={toast.id}\n {...toast}\n pauseOnHover={toast.pauseOnHover ?? pauseOnHover}\n showProgressBar={toast.showProgressBar ?? showProgressBar}\n swipeable={toast.swipeable ?? swipeable}\n swipeThreshold={toast.swipeThreshold ?? swipeThreshold}\n theme={toast.theme || defaultTheme}\n onDismiss={onDismiss}\n />\n ))}\n </div>\n );\n })}\n </div>\n );\n\n return createPortal(portalContent, document.body);\n};\n","import React, { createContext, useContext, useState, useCallback, useMemo, useRef } from 'react';\nimport { ToastContainer } from './ToastContainer';\n\n// Create Toast Context\nexport const ToastContext = createContext(null);\n\nlet toastCount = 0;\nconst generateId = () => {\n toastCount += 1;\n return `easy-toast-${Date.now()}-${toastCount}`;\n};\n\n/**\n * ToastProvider Component\n * Wraps your application to provide toast functionality anywhere in the component tree.\n */\nexport const ToastProvider = ({\n children,\n position = 'top-right',\n autoClose = 3000,\n pauseOnHover = true,\n showProgressBar = true,\n swipeable = true,\n swipeThreshold = 70,\n theme = 'light',\n limit,\n newestOnTop = false,\n containerClassName = '',\n containerStyle = {},\n}) => {\n const [toasts, setToasts] = useState([]);\n const toastsRef = useRef(toasts);\n toastsRef.current = toasts;\n\n // Add a new toast\n const addToast = useCallback(\n (messageOrOptions, maybeOptions = {}) => {\n let options = {};\n if (typeof messageOrOptions === 'object' && !React.isValidElement(messageOrOptions)) {\n options = { ...messageOrOptions };\n } else {\n options = { ...maybeOptions, message: messageOrOptions };\n }\n\n const id = options.id || generateId();\n const newToast = {\n id,\n type: options.type || 'default',\n message: options.message,\n title: options.title,\n duration: options.duration !== undefined ? options.duration : autoClose,\n showProgressBar: options.showProgressBar !== undefined ? options.showProgressBar : showProgressBar,\n pauseOnHover: options.pauseOnHover !== undefined ? options.pauseOnHover : pauseOnHover,\n swipeable: options.swipeable !== undefined ? options.swipeable : swipeable,\n swipeThreshold: options.swipeThreshold !== undefined ? options.swipeThreshold : swipeThreshold,\n closeButton: options.closeButton !== undefined ? options.closeButton : true,\n icon: options.icon,\n action: options.action,\n onClose: options.onClose,\n onAccept: options.onAccept,\n onCancel: options.onCancel,\n acceptLabel: options.acceptLabel,\n cancelLabel: options.cancelLabel,\n position: options.position || position,\n theme: options.theme || theme,\n className: options.className || '',\n style: options.style || {},\n };\n\n setToasts((prev) => {\n // If updating an existing toast with same id\n const existingIndex = prev.findIndex((t) => t.id === id);\n if (existingIndex > -1) {\n const updated = [...prev];\n updated[existingIndex] = { ...updated[existingIndex], ...newToast };\n return updated;\n }\n\n // Apply limit if specified\n if (limit && limit > 0 && prev.length >= limit) {\n return [...prev.slice(prev.length - limit + 1), newToast];\n }\n\n return [...prev, newToast];\n });\n\n return id;\n },\n [autoClose, showProgressBar, pauseOnHover, position, theme, limit]\n );\n\n // Update an existing toast (e.g. for promises)\n const updateToast = useCallback((id, updatedOptions) => {\n setToasts((prev) =>\n prev.map((t) => {\n if (t.id === id) {\n return {\n ...t,\n ...updatedOptions,\n id, // preserve id\n };\n }\n return t;\n })\n );\n }, []);\n\n // Dismiss a specific toast\n const dismissToast = useCallback((id) => {\n setToasts((prev) => prev.filter((t) => t.id !== id));\n }, []);\n\n // Dismiss all toasts\n const dismissAll = useCallback(() => {\n setToasts([]);\n }, []);\n\n // Context value with core functions\n const contextValue = useMemo(\n () => ({\n addToast,\n updateToast,\n dismissToast,\n dismissAll,\n toasts,\n }),\n [addToast, updateToast, dismissToast, dismissAll, toasts]\n );\n\n return (\n <ToastContext.Provider value={contextValue}>\n {children}\n <ToastContainer\n toasts={toasts}\n onDismiss={dismissToast}\n position={position}\n theme={theme}\n limit={limit}\n newestOnTop={newestOnTop}\n pauseOnHover={pauseOnHover}\n showProgressBar={showProgressBar}\n swipeable={swipeable}\n swipeThreshold={swipeThreshold}\n className={containerClassName}\n style={containerStyle}\n />\n </ToastContext.Provider>\n );\n};\n\n/**\n * Custom Hook: useToast\n * Exposes an intuitive API to trigger and manage toast notifications.\n *\n * Example:\n * const toast = useToast();\n * toast.success('Profile updated!');\n * toast.error('Something went wrong');\n */\nexport const useToast = () => {\n const context = useContext(ToastContext);\n\n if (!context) {\n throw new Error('useToast must be used within a <ToastProvider>. Please wrap your root component in <ToastProvider>.');\n }\n\n const { addToast, updateToast, dismissToast, dismissAll } = context;\n\n // Base callable toast function\n const toast = useCallback(\n (message, options) => {\n return addToast(message, options);\n },\n [addToast]\n );\n\n // Helper: toast.success\n toast.success = useCallback(\n (message, options = {}) => {\n return addToast(message, { ...options, type: 'success' });\n },\n [addToast]\n );\n\n // Helper: toast.error\n toast.error = useCallback(\n (message, options = {}) => {\n return addToast(message, { ...options, type: 'error' });\n },\n [addToast]\n );\n\n // Helper: toast.warning\n toast.warning = useCallback(\n (message, options = {}) => {\n return addToast(message, { ...options, type: 'warning' });\n },\n [addToast]\n );\n\n // Helper: toast.info\n toast.info = useCallback(\n (message, options = {}) => {\n return addToast(message, { ...options, type: 'info' });\n },\n [addToast]\n );\n\n // Helper: toast.loading\n toast.loading = useCallback(\n (message, options = {}) => {\n return addToast(message, {\n ...options,\n type: 'loading',\n duration: false, // does not auto-dismiss\n showProgressBar: false,\n });\n },\n [addToast]\n );\n\n // Helper: toast.promise\n toast.promise = useCallback(\n (promise, messages, options = {}) => {\n const id = toast.loading(messages.loading || 'Loading...', options);\n\n const p = promise instanceof Promise ? promise : Promise.resolve(promise);\n\n p.then((result) => {\n const successMsg =\n typeof messages.success === 'function' ? messages.success(result) : messages.success || 'Success!';\n updateToast(id, {\n type: 'success',\n message: successMsg,\n duration: options.duration !== undefined ? options.duration : 3000,\n showProgressBar: options.showProgressBar !== undefined ? options.showProgressBar : true,\n ...options.successOptions,\n });\n }).catch((err) => {\n const errorMsg =\n typeof messages.error === 'function' ? messages.error(err) : messages.error || 'Something went wrong';\n updateToast(id, {\n type: 'error',\n message: errorMsg,\n duration: options.duration !== undefined ? options.duration : 4000,\n showProgressBar: options.showProgressBar !== undefined ? options.showProgressBar : true,\n ...options.errorOptions,\n });\n });\n\n return p;\n },\n [toast, updateToast]\n );\n\n // Programmatic dismiss\n toast.dismiss = dismissToast;\n toast.dismissAll = dismissAll;\n toast.update = updateToast;\n\n return toast;\n};\n"],"names":["SuccessIcon","size","className","props","_jsxs","width","height","viewBox","fill","stroke","strokeWidth","strokeLinecap","strokeLinejoin","children","_jsx","d","points","ErrorIcon","cx","cy","r","x1","y1","x2","y2","WarningIcon","InfoIcon","LoadingIcon","CloseIcon","ToastItem","id","type","title","message","duration","showProgressBar","pauseOnHover","closeButton","icon","action","onClose","onAccept","onCancel","acceptLabel","cancelLabel","swipeable","swipeThreshold","theme","style","onDismiss","isExiting","setIsExiting","useState","exitDirection","setExitDirection","isPaused","setIsPaused","isDragging","setIsDragging","dragOffset","setDragOffset","startXRef","useRef","isPointerDownRef","remainingTimeRef","startTimeRef","timerRef","hasAcceptAction","Boolean","onClick","resolvedAcceptLabel","label","handleDismiss","useCallback","direction","setTimeout","handleAccept","useEffect","Infinity","startTimer","time","current","Date","now","clearTimeout","handleMouseEnter","elapsed","Math","max","handleMouseLeave","handlePointerDown","e","target","closest","button","undefined","clientX","currentTarget","setPointerCapture","pointerId","err","handlePointerMove","currentX","diff","handlePointerUp","releasePointerCapture","handlePointerCancel","renderIcon","React","isValidElement","hasIcon","hasProgressBar","getDragStyle","transform","transition","opacity","abs","isSwipingAccept","isSwipingDismissRight","isSwipingCancel","role","onMouseEnter","onMouseLeave","onPointerDown","onPointerMove","onPointerUp","onPointerCancel","dismissOnClick","animationDuration","animationPlayState","VALID_POSITIONS","ToastContainer","toasts","position","defaultPosition","defaultTheme","newestOnTop","limit","isMounted","window","document","visibleToasts","slice","groupedToasts","reduce","acc","toast","pos","validPos","includes","push","portalContent","Object","entries","map","items","sortedItems","reverse","createPortal","body","ToastContext","createContext","toastCount","generateId","ToastProvider","autoClose","containerClassName","containerStyle","setToasts","toastsRef","addToast","messageOrOptions","maybeOptions","options","newToast","prev","existingIndex","findIndex","t","updated","length","updateToast","updatedOptions","dismissToast","filter","dismissAll","contextValue","useMemo","Provider","value","useToast","context","useContext","Error","success","error","warning","info","loading","promise","messages","p","Promise","resolve","then","result","successMsg","successOptions","catch","errorMsg","errorOptions","dismiss","update"],"mappings":";;;;AAKO,MAAMA,WAAW,GAAGA,CAAC;AAAEC,EAAAA,IAAI,GAAG,EAAE;AAAEC,EAAAA,SAAS,GAAG,EAAE;EAAE,GAAGC;AAAM,CAAC,kBACjEC,IAAA,CAAA,KAAA,EAAA;AACEC,EAAAA,KAAK,EAAEJ,IAAK;AACZK,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,KAAK,CAACiE,OAAO,GAAG5B,YAAY;EAC5BrC,KAAK,CAACuC,UAAU,GAAGA,UAAU;EAC7BvC,KAAK,CAACkE,MAAM,GAAG/B,WAAW;AAE1B,EAAA,OAAOnC,KAAK;AACd;;"}
package/dist/toast.css ADDED
@@ -0,0 +1,2 @@
1
+ :root{--easy-toast-z-index:9999;--easy-toast-font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji";--easy-toast-max-width:380px;--easy-toast-min-width:280px;--easy-toast-radius:12px;--easy-toast-shadow:0 10px 25px -5px rgba(0,0,0,.1),0 8px 10px -6px rgba(0,0,0,.08);--easy-toast-bg-light:#fff;--easy-toast-text-light:#1e293b;--easy-toast-text-secondary-light:#64748b;--easy-toast-border-light:#e2e8f0;--easy-toast-bg-dark:#1e293b;--easy-toast-text-dark:#f8fafc;--easy-toast-text-secondary-dark:#94a3b8;--easy-toast-border-dark:#334155;--easy-toast-color-success:#10b981;--easy-toast-color-error:#ef4444;--easy-toast-color-warning:#f59e0b;--easy-toast-color-info:#3b82f6;--easy-toast-color-loading:#6366f1;--easy-toast-color-default:#64748b}.easy-toast-portal{position:relative}.easy-toast-container,.easy-toast-portal{pointer-events:none;z-index:var(--easy-toast-z-index)}.easy-toast-container{box-sizing:border-box;display:flex;flex-direction:column;gap:10px;max-width:100vw;padding:16px;position:fixed}.easy-toast-container--top-left{align-items:flex-start;left:0;top:0}.easy-toast-container--top-center{align-items:center;left:50%;top:0;transform:translateX(-50%)}.easy-toast-container--top-right{align-items:flex-end;right:0;top:0}.easy-toast-container--bottom-left{align-items:flex-start;bottom:0;left:0}.easy-toast-container--bottom-center{align-items:center;bottom:0;left:50%;transform:translateX(-50%)}.easy-toast-container--bottom-right{align-items:flex-end;bottom:0;right:0}.easy-toast-item{border-radius:var(--easy-toast-radius);box-shadow:var(--easy-toast-shadow);box-sizing:border-box;cursor:default;display:flex;flex-direction:column;font-family:var(--easy-toast-font-family);max-width:calc(100vw - 32px);overflow:hidden;pointer-events:auto;position:relative;transition:transform .2s ease,box-shadow .2s ease;user-select:none;width:var(--easy-toast-max-width)}.easy-toast-item:hover{box-shadow:0 14px 30px -5px rgba(0,0,0,.15),0 10px 12px -6px rgba(0,0,0,.1)}.easy-toast--swipeable{cursor:grab;touch-action:pan-y}.easy-toast--dragging{cursor:grabbing!important;user-select:none;-webkit-user-select:none}.easy-toast--swipe-accept{box-shadow:0 0 0 2px var(--easy-toast-color-success),var(--easy-toast-shadow)!important}.easy-toast--swipe-cancel{box-shadow:0 0 0 2px var(--easy-toast-color-error),var(--easy-toast-shadow)!important}.easy-toast-swipe-badge{animation:easy-toast-badge-pop .18s cubic-bezier(.16,1,.3,1) forwards;border-radius:9999px;box-shadow:0 4px 12px rgba(0,0,0,.18);font-size:.76rem;font-weight:700;letter-spacing:.02em;padding:4px 10px;pointer-events:none;position:absolute;right:14px;top:10px;z-index:10}.easy-toast-swipe-badge--accept{background:var(--easy-toast-color-success);color:#fff}.easy-toast-swipe-badge--cancel{background:var(--easy-toast-color-error);color:#fff}@keyframes easy-toast-badge-pop{0%{opacity:0;transform:scale(.85)}to{opacity:1;transform:scale(1)}}.easy-toast-content-wrapper{align-items:flex-start;box-sizing:border-box;display:flex;gap:12px;padding:14px 16px;width:100%}.easy-toast-icon-container{align-items:center;display:flex;flex-shrink:0;justify-content:center;margin-top:1px}.easy-toast-icon{height:20px;width:20px}.easy-toast-icon--success{color:var(--easy-toast-color-success)}.easy-toast-icon--error{color:var(--easy-toast-color-error)}.easy-toast-icon--warning{color:var(--easy-toast-color-warning)}.easy-toast-icon--info{color:var(--easy-toast-color-info)}.easy-toast-icon--loading{animation:easy-toast-spin .9s linear infinite;color:var(--easy-toast-color-loading)}.easy-toast-custom-icon{align-items:center;display:inline-flex;justify-content:center}.easy-toast-text-container{word-wrap:break-word;display:flex;flex:1;flex-direction:column;gap:3px;min-width:0}.easy-toast-title{font-size:.92rem;font-weight:600;line-height:1.3}.easy-toast-message{font-size:.86rem;line-height:1.4;word-break:break-word}.easy-toast-action-container{align-items:center;display:flex;flex-shrink:0;margin-left:4px}.easy-toast-action-button{background:rgba(0,0,0,.06);border:none;border-radius:6px;cursor:pointer;font-family:inherit;font-size:.8rem;font-weight:600;outline:none;padding:5px 10px;transition:background .15s ease,transform .1s ease;white-space:nowrap}.easy-toast-action-button:hover{background:rgba(0,0,0,.12)}.easy-toast-action-button:active{transform:scale(.96)}.easy-toast-close-button{align-items:center;background:transparent;border:none;border-radius:6px;color:inherit;cursor:pointer;display:inline-flex;flex-shrink:0;justify-content:center;margin-left:2px;margin-top:-2px;opacity:.55;outline:none;padding:4px;transition:opacity .15s ease,background .15s ease}.easy-toast-close-button:hover{background:rgba(0,0,0,.06);opacity:1}.easy-toast-close-icon{height:14px;width:14px}.easy-toast-progress-bar-track{background:rgba(0,0,0,.05);bottom:0;height:3px;left:0;overflow:hidden;position:absolute;right:0}.easy-toast-progress-bar{animation:easy-toast-progress-shrink linear forwards;background:currentColor;height:100%;transform-origin:left;width:100%}.easy-toast--theme-light{background-color:var(--easy-toast-bg-light);border:1px solid var(--easy-toast-border-light);color:var(--easy-toast-text-light)}.easy-toast--theme-light .easy-toast-message{color:var(--easy-toast-text-secondary-light)}.easy-toast--theme-light.easy-toast--success .easy-toast-progress-bar{background:var(--easy-toast-color-success)}.easy-toast--theme-light.easy-toast--error .easy-toast-progress-bar{background:var(--easy-toast-color-error)}.easy-toast--theme-light.easy-toast--warning .easy-toast-progress-bar{background:var(--easy-toast-color-warning)}.easy-toast--theme-light.easy-toast--info .easy-toast-progress-bar{background:var(--easy-toast-color-info)}.easy-toast--theme-light.easy-toast--loading .easy-toast-progress-bar{background:var(--easy-toast-color-loading)}.easy-toast--theme-light.easy-toast--default .easy-toast-progress-bar{background:var(--easy-toast-color-default)}.easy-toast--theme-dark{background-color:var(--easy-toast-bg-dark);border:1px solid var(--easy-toast-border-dark);color:var(--easy-toast-text-dark)}.easy-toast--theme-dark .easy-toast-message{color:var(--easy-toast-text-secondary-dark)}.easy-toast--theme-dark .easy-toast-action-button{background:hsla(0,0%,100%,.12);color:#fff}.easy-toast--theme-dark .easy-toast-action-button:hover{background:hsla(0,0%,100%,.2)}.easy-toast--theme-dark .easy-toast-close-button:hover{background:hsla(0,0%,100%,.1)}.easy-toast--theme-dark .easy-toast-progress-bar-track{background:hsla(0,0%,100%,.08)}.easy-toast--theme-dark.easy-toast--success .easy-toast-progress-bar{background:var(--easy-toast-color-success)}.easy-toast--theme-dark.easy-toast--error .easy-toast-progress-bar{background:var(--easy-toast-color-error)}.easy-toast--theme-dark.easy-toast--warning .easy-toast-progress-bar{background:var(--easy-toast-color-warning)}.easy-toast--theme-dark.easy-toast--info .easy-toast-progress-bar{background:var(--easy-toast-color-info)}.easy-toast--theme-dark.easy-toast--loading .easy-toast-progress-bar{background:var(--easy-toast-color-loading)}.easy-toast--theme-dark.easy-toast--default .easy-toast-progress-bar{background:var(--easy-toast-color-default)}.easy-toast--theme-colored{border:none;color:#fff}.easy-toast--theme-colored .easy-toast-message{color:hsla(0,0%,100%,.92)}.easy-toast--theme-colored .easy-toast-icon{color:#fff}.easy-toast--theme-colored .easy-toast-action-button{background:hsla(0,0%,100%,.22);color:#fff}.easy-toast--theme-colored .easy-toast-action-button:hover{background:hsla(0,0%,100%,.32)}.easy-toast--theme-colored .easy-toast-close-button{color:#fff}.easy-toast--theme-colored .easy-toast-close-button:hover{background:hsla(0,0%,100%,.15)}.easy-toast--theme-colored .easy-toast-progress-bar-track{background:hsla(0,0%,100%,.2)}.easy-toast--theme-colored .easy-toast-progress-bar{background:#fff}.easy-toast--theme-colored.easy-toast--success{background-color:var(--easy-toast-color-success)}.easy-toast--theme-colored.easy-toast--error{background-color:var(--easy-toast-color-error)}.easy-toast--theme-colored.easy-toast--warning{background-color:var(--easy-toast-color-warning)}.easy-toast--theme-colored.easy-toast--info{background-color:var(--easy-toast-color-info)}.easy-toast--theme-colored.easy-toast--loading{background-color:var(--easy-toast-color-loading)}.easy-toast--theme-colored.easy-toast--default{background-color:#475569}.easy-toast--enter{animation:easy-toast-enter-anim .32s cubic-bezier(.16,1,.3,1) forwards}.easy-toast--exit{animation:easy-toast-exit-anim .28s cubic-bezier(.4,0,1,1) forwards}@keyframes easy-toast-enter-anim{0%{opacity:0;transform:translateY(-16px) scale(.95)}to{opacity:1;transform:translateY(0) scale(1)}}@keyframes easy-toast-exit-anim{0%{margin-bottom:0;max-height:120px;opacity:1;transform:translateY(0) scale(1)}70%{opacity:0;transform:translateY(-8px) scale(.92)}to{margin-bottom:-10px;max-height:0;opacity:0;padding-bottom:0;padding-top:0;transform:translateY(-12px) scale(.9)}}.easy-toast-container--bottom-center .easy-toast--enter,.easy-toast-container--bottom-left .easy-toast--enter,.easy-toast-container--bottom-right .easy-toast--enter{animation-name:easy-toast-enter-bottom-anim}@keyframes easy-toast-enter-bottom-anim{0%{opacity:0;transform:translateY(16px) scale(.95)}to{opacity:1;transform:translateY(0) scale(1)}}@keyframes easy-toast-progress-shrink{0%{transform:scaleX(1)}to{transform:scaleX(0)}}@keyframes easy-toast-spin{0%{transform:rotate(0deg)}to{transform:rotate(1turn)}}@media screen and (max-width:480px){.easy-toast-container{left:0!important;padding:12px;right:0!important;transform:none!important;width:100%}.easy-toast-container--top-center,.easy-toast-container--top-left,.easy-toast-container--top-right{align-items:stretch;top:env(safe-area-inset-top,0)}.easy-toast-container--bottom-center,.easy-toast-container--bottom-left,.easy-toast-container--bottom-right{align-items:stretch;bottom:env(safe-area-inset-bottom,0)}.easy-toast-item{max-width:100%;width:100%}}
2
+ /*# sourceMappingURL=toast.css.map */
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["toast.css"],"names":[],"mappings":"AAQA,MACE,yBAA0B,CAC1B,2IAAoJ,CACpJ,4BAA6B,CAC7B,4BAA6B,CAC7B,wBAAyB,CACzB,mFAA6F,CAG7F,0BAA8B,CAC9B,+BAAgC,CAChC,yCAA0C,CAC1C,iCAAkC,CA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KA,yBACE,2CAA4C,CAE5C,+CAAgD,CADhD,kCAEF,CAEA,6CACE,4CACF,CAEA,sEACE,0CACF,CACA,oEACE,wCACF,CACA,sEACE,0CACF,CACA,mEACE,uCACF,CACA,sEACE,0CACF,CACA,sEACE,0CACF,CAKA,wBACE,0CAA2C,CAE3C,8CAA+C,CAD/C,iCAEF,CAEA,4CACE,2CACF,CAEA,kDACE,8BAAqC,CACrC,UACF,CAEA,wDACE,6BACF,CAEA,uDACE,6BACF,CAEA,uDACE,8BACF,CAEA,qEACE,0CACF,CACA,mEACE,wCACF,CACA,qEACE,0CACF,CACA,kEACE,uCACF,CACA,qEACE,0CACF,CACA,qEACE,0CACF,CAKA,2BAEE,WAAY,CADZ,UAEF,CAEA,+CACE,yBACF,CAEA,4CACE,UACF,CAEA,qDACE,8BAAqC,CACrC,UACF,CAEA,2DACE,8BACF,CAEA,oDACE,UACF,CAEA,0DACE,8BACF,CAEA,0DACE,6BACF,CAEA,oDACE,eACF,CAEA,+CACE,gDACF,CAEA,6CACE,8CACF,CAEA,+CACE,gDACF,CAEA,4CACE,6CACF,CAEA,+CACE,gDACF,CAEA,+CACE,wBACF,CAKA,mBACE,sEACF,CAEA,kBACE,mEACF,CAEA,iCACE,GACE,SAAU,CACV,sCACF,CACA,GACE,SAAU,CACV,gCACF,CACF,CAEA,gCACE,GAIE,eAAgB,CADhB,gBAAiB,CAFjB,SAAU,CACV,gCAGF,CACA,IACE,SAAU,CACV,qCACF,CACA,GAME,mBAAoB,CAHpB,YAAa,CAFb,SAAU,CAIV,gBAAiB,CADjB,aAAc,CAFd,qCAKF,CACF,CAGA,qKAGE,2CACF,CAEA,wCACE,GACE,SAAU,CACV,qCACF,CACA,GACE,SAAU,CACV,gCACF,CACF,CAGA,sCACE,GACE,mBACF,CACA,GACE,mBACF,CACF,CAGA,2BACE,GACE,sBACF,CACA,GACE,uBACF,CACF,CAKA,oCACE,sBAEE,gBAAkB,CAGlB,YAAa,CAFb,iBAAmB,CACnB,wBAA0B,CAH1B,UAKF,CAEA,mGAIE,mBAAoB,CADpB,8BAEF,CAEA,4GAIE,mBAAoB,CADpB,oCAEF,CAEA,iBAEE,cAAe,CADf,UAEF,CACF","file":"toast.css","sourcesContent":["/**\n * flashpop\n * Modern, lightweight, responsive CSS styles and animations\n */\n\n/* ==========================================================================\n CSS Variables & Design Tokens\n ========================================================================== */\n:root {\n --easy-toast-z-index: 9999;\n --easy-toast-font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji';\n --easy-toast-max-width: 380px;\n --easy-toast-min-width: 280px;\n --easy-toast-radius: 12px;\n --easy-toast-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.08);\n\n /* Light Theme Colors */\n --easy-toast-bg-light: #ffffff;\n --easy-toast-text-light: #1e293b;\n --easy-toast-text-secondary-light: #64748b;\n --easy-toast-border-light: #e2e8f0;\n\n /* Dark Theme Colors */\n --easy-toast-bg-dark: #1e293b;\n --easy-toast-text-dark: #f8fafc;\n --easy-toast-text-secondary-dark: #94a3b8;\n --easy-toast-border-dark: #334155;\n\n /* Variant Colors */\n --easy-toast-color-success: #10b981;\n --easy-toast-color-error: #ef4444;\n --easy-toast-color-warning: #f59e0b;\n --easy-toast-color-info: #3b82f6;\n --easy-toast-color-loading: #6366f1;\n --easy-toast-color-default: #64748b;\n}\n\n/* ==========================================================================\n Portal & Container Positioning\n ========================================================================== */\n.easy-toast-portal {\n pointer-events: none;\n position: relative;\n z-index: var(--easy-toast-z-index);\n}\n\n.easy-toast-container {\n position: fixed;\n display: flex;\n flex-direction: column;\n gap: 10px;\n z-index: var(--easy-toast-z-index);\n pointer-events: none;\n box-sizing: border-box;\n padding: 16px;\n max-width: 100vw;\n}\n\n/* Positions */\n.easy-toast-container--top-left {\n top: 0;\n left: 0;\n align-items: flex-start;\n}\n\n.easy-toast-container--top-center {\n top: 0;\n left: 50%;\n transform: translateX(-50%);\n align-items: center;\n}\n\n.easy-toast-container--top-right {\n top: 0;\n right: 0;\n align-items: flex-end;\n}\n\n.easy-toast-container--bottom-left {\n bottom: 0;\n left: 0;\n align-items: flex-start;\n}\n\n.easy-toast-container--bottom-center {\n bottom: 0;\n left: 50%;\n transform: translateX(-50%);\n align-items: center;\n}\n\n.easy-toast-container--bottom-right {\n bottom: 0;\n right: 0;\n align-items: flex-end;\n}\n\n/* ==========================================================================\n Toast Item Base Styles\n ========================================================================== */\n.easy-toast-item {\n position: relative;\n display: flex;\n flex-direction: column;\n width: var(--easy-toast-max-width);\n max-width: calc(100vw - 32px);\n box-sizing: border-box;\n border-radius: var(--easy-toast-radius);\n box-shadow: var(--easy-toast-shadow);\n pointer-events: auto;\n font-family: var(--easy-toast-font-family);\n overflow: hidden;\n user-select: none;\n cursor: default;\n transition: transform 0.2s ease, box-shadow 0.2s ease;\n}\n\n.easy-toast-item:hover {\n box-shadow: 0 14px 30px -5px rgba(0, 0, 0, 0.15), 0 10px 12px -6px rgba(0, 0, 0, 0.1);\n}\n\n/* Swipeable & Dragging States */\n.easy-toast--swipeable {\n touch-action: pan-y;\n cursor: grab;\n}\n\n.easy-toast--dragging {\n cursor: grabbing !important;\n user-select: none;\n -webkit-user-select: none;\n}\n\n.easy-toast--swipe-accept {\n box-shadow: 0 0 0 2px var(--easy-toast-color-success), var(--easy-toast-shadow) !important;\n}\n\n.easy-toast--swipe-cancel {\n box-shadow: 0 0 0 2px var(--easy-toast-color-error), var(--easy-toast-shadow) !important;\n}\n\n/* Swipe Badges/Hints */\n.easy-toast-swipe-badge {\n position: absolute;\n top: 10px;\n right: 14px;\n font-size: 0.76rem;\n font-weight: 700;\n padding: 4px 10px;\n border-radius: 9999px;\n z-index: 10;\n pointer-events: none;\n animation: easy-toast-badge-pop 0.18s cubic-bezier(0.16, 1, 0.3, 1) forwards;\n letter-spacing: 0.02em;\n box-shadow: 0 4px 12px rgba(0, 0, 0, 0.18);\n}\n\n.easy-toast-swipe-badge--accept {\n background: var(--easy-toast-color-success);\n color: #ffffff;\n}\n\n.easy-toast-swipe-badge--cancel {\n background: var(--easy-toast-color-error);\n color: #ffffff;\n}\n\n@keyframes easy-toast-badge-pop {\n from {\n opacity: 0;\n transform: scale(0.85);\n }\n to {\n opacity: 1;\n transform: scale(1);\n }\n}\n\n.easy-toast-content-wrapper {\n display: flex;\n align-items: flex-start;\n padding: 14px 16px;\n gap: 12px;\n box-sizing: border-box;\n width: 100%;\n}\n\n/* Icon */\n.easy-toast-icon-container {\n display: flex;\n align-items: center;\n justify-content: center;\n flex-shrink: 0;\n margin-top: 1px;\n}\n\n.easy-toast-icon {\n width: 20px;\n height: 20px;\n}\n\n.easy-toast-icon--success {\n color: var(--easy-toast-color-success);\n}\n\n.easy-toast-icon--error {\n color: var(--easy-toast-color-error);\n}\n\n.easy-toast-icon--warning {\n color: var(--easy-toast-color-warning);\n}\n\n.easy-toast-icon--info {\n color: var(--easy-toast-color-info);\n}\n\n.easy-toast-icon--loading {\n color: var(--easy-toast-color-loading);\n animation: easy-toast-spin 0.9s linear infinite;\n}\n\n.easy-toast-custom-icon {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n}\n\n/* Text Container */\n.easy-toast-text-container {\n flex: 1;\n display: flex;\n flex-direction: column;\n gap: 3px;\n min-width: 0;\n word-wrap: break-word;\n}\n\n.easy-toast-title {\n font-size: 0.92rem;\n font-weight: 600;\n line-height: 1.3;\n}\n\n.easy-toast-message {\n font-size: 0.86rem;\n line-height: 1.4;\n word-break: break-word;\n}\n\n/* Action Button */\n.easy-toast-action-container {\n display: flex;\n align-items: center;\n flex-shrink: 0;\n margin-left: 4px;\n}\n\n.easy-toast-action-button {\n background: rgba(0, 0, 0, 0.06);\n border: none;\n outline: none;\n font-family: inherit;\n font-size: 0.8rem;\n font-weight: 600;\n padding: 5px 10px;\n border-radius: 6px;\n cursor: pointer;\n transition: background 0.15s ease, transform 0.1s ease;\n white-space: nowrap;\n}\n\n.easy-toast-action-button:hover {\n background: rgba(0, 0, 0, 0.12);\n}\n\n.easy-toast-action-button:active {\n transform: scale(0.96);\n}\n\n/* Close Button */\n.easy-toast-close-button {\n background: transparent;\n border: none;\n outline: none;\n padding: 4px;\n margin-left: 2px;\n margin-top: -2px;\n border-radius: 6px;\n cursor: pointer;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n opacity: 0.55;\n color: inherit;\n transition: opacity 0.15s ease, background 0.15s ease;\n flex-shrink: 0;\n}\n\n.easy-toast-close-button:hover {\n opacity: 1;\n background: rgba(0, 0, 0, 0.06);\n}\n\n.easy-toast-close-icon {\n width: 14px;\n height: 14px;\n}\n\n/* Progress Bar */\n.easy-toast-progress-bar-track {\n position: absolute;\n bottom: 0;\n left: 0;\n right: 0;\n height: 3px;\n background: rgba(0, 0, 0, 0.05);\n overflow: hidden;\n}\n\n.easy-toast-progress-bar {\n height: 100%;\n width: 100%;\n background: currentColor;\n transform-origin: left;\n animation: easy-toast-progress-shrink linear forwards;\n}\n\n/* ==========================================================================\n Themes: Light (Default)\n ========================================================================== */\n.easy-toast--theme-light {\n background-color: var(--easy-toast-bg-light);\n color: var(--easy-toast-text-light);\n border: 1px solid var(--easy-toast-border-light);\n}\n\n.easy-toast--theme-light .easy-toast-message {\n color: var(--easy-toast-text-secondary-light);\n}\n\n.easy-toast--theme-light.easy-toast--success .easy-toast-progress-bar {\n background: var(--easy-toast-color-success);\n}\n.easy-toast--theme-light.easy-toast--error .easy-toast-progress-bar {\n background: var(--easy-toast-color-error);\n}\n.easy-toast--theme-light.easy-toast--warning .easy-toast-progress-bar {\n background: var(--easy-toast-color-warning);\n}\n.easy-toast--theme-light.easy-toast--info .easy-toast-progress-bar {\n background: var(--easy-toast-color-info);\n}\n.easy-toast--theme-light.easy-toast--loading .easy-toast-progress-bar {\n background: var(--easy-toast-color-loading);\n}\n.easy-toast--theme-light.easy-toast--default .easy-toast-progress-bar {\n background: var(--easy-toast-color-default);\n}\n\n/* ==========================================================================\n Themes: Dark\n ========================================================================== */\n.easy-toast--theme-dark {\n background-color: var(--easy-toast-bg-dark);\n color: var(--easy-toast-text-dark);\n border: 1px solid var(--easy-toast-border-dark);\n}\n\n.easy-toast--theme-dark .easy-toast-message {\n color: var(--easy-toast-text-secondary-dark);\n}\n\n.easy-toast--theme-dark .easy-toast-action-button {\n background: rgba(255, 255, 255, 0.12);\n color: #ffffff;\n}\n\n.easy-toast--theme-dark .easy-toast-action-button:hover {\n background: rgba(255, 255, 255, 0.2);\n}\n\n.easy-toast--theme-dark .easy-toast-close-button:hover {\n background: rgba(255, 255, 255, 0.1);\n}\n\n.easy-toast--theme-dark .easy-toast-progress-bar-track {\n background: rgba(255, 255, 255, 0.08);\n}\n\n.easy-toast--theme-dark.easy-toast--success .easy-toast-progress-bar {\n background: var(--easy-toast-color-success);\n}\n.easy-toast--theme-dark.easy-toast--error .easy-toast-progress-bar {\n background: var(--easy-toast-color-error);\n}\n.easy-toast--theme-dark.easy-toast--warning .easy-toast-progress-bar {\n background: var(--easy-toast-color-warning);\n}\n.easy-toast--theme-dark.easy-toast--info .easy-toast-progress-bar {\n background: var(--easy-toast-color-info);\n}\n.easy-toast--theme-dark.easy-toast--loading .easy-toast-progress-bar {\n background: var(--easy-toast-color-loading);\n}\n.easy-toast--theme-dark.easy-toast--default .easy-toast-progress-bar {\n background: var(--easy-toast-color-default);\n}\n\n/* ==========================================================================\n Themes: Colored (Solid background per type)\n ========================================================================== */\n.easy-toast--theme-colored {\n color: #ffffff;\n border: none;\n}\n\n.easy-toast--theme-colored .easy-toast-message {\n color: rgba(255, 255, 255, 0.92);\n}\n\n.easy-toast--theme-colored .easy-toast-icon {\n color: #ffffff;\n}\n\n.easy-toast--theme-colored .easy-toast-action-button {\n background: rgba(255, 255, 255, 0.22);\n color: #ffffff;\n}\n\n.easy-toast--theme-colored .easy-toast-action-button:hover {\n background: rgba(255, 255, 255, 0.32);\n}\n\n.easy-toast--theme-colored .easy-toast-close-button {\n color: #ffffff;\n}\n\n.easy-toast--theme-colored .easy-toast-close-button:hover {\n background: rgba(255, 255, 255, 0.15);\n}\n\n.easy-toast--theme-colored .easy-toast-progress-bar-track {\n background: rgba(255, 255, 255, 0.2);\n}\n\n.easy-toast--theme-colored .easy-toast-progress-bar {\n background: #ffffff;\n}\n\n.easy-toast--theme-colored.easy-toast--success {\n background-color: var(--easy-toast-color-success);\n}\n\n.easy-toast--theme-colored.easy-toast--error {\n background-color: var(--easy-toast-color-error);\n}\n\n.easy-toast--theme-colored.easy-toast--warning {\n background-color: var(--easy-toast-color-warning);\n}\n\n.easy-toast--theme-colored.easy-toast--info {\n background-color: var(--easy-toast-color-info);\n}\n\n.easy-toast--theme-colored.easy-toast--loading {\n background-color: var(--easy-toast-color-loading);\n}\n\n.easy-toast--theme-colored.easy-toast--default {\n background-color: #475569;\n}\n\n/* ==========================================================================\n Animations\n ========================================================================== */\n.easy-toast--enter {\n animation: easy-toast-enter-anim 0.32s cubic-bezier(0.16, 1, 0.3, 1) forwards;\n}\n\n.easy-toast--exit {\n animation: easy-toast-exit-anim 0.28s cubic-bezier(0.4, 0, 1, 1) forwards;\n}\n\n@keyframes easy-toast-enter-anim {\n from {\n opacity: 0;\n transform: translateY(-16px) scale(0.95);\n }\n to {\n opacity: 1;\n transform: translateY(0) scale(1);\n }\n}\n\n@keyframes easy-toast-exit-anim {\n 0% {\n opacity: 1;\n transform: translateY(0) scale(1);\n max-height: 120px;\n margin-bottom: 0;\n }\n 70% {\n opacity: 0;\n transform: translateY(-8px) scale(0.92);\n }\n 100% {\n opacity: 0;\n transform: translateY(-12px) scale(0.9);\n max-height: 0;\n padding-top: 0;\n padding-bottom: 0;\n margin-bottom: -10px;\n }\n}\n\n/* Bottom positions entrance animation adjustment */\n.easy-toast-container--bottom-left .easy-toast--enter,\n.easy-toast-container--bottom-center .easy-toast--enter,\n.easy-toast-container--bottom-right .easy-toast--enter {\n animation-name: easy-toast-enter-bottom-anim;\n}\n\n@keyframes easy-toast-enter-bottom-anim {\n from {\n opacity: 0;\n transform: translateY(16px) scale(0.95);\n }\n to {\n opacity: 1;\n transform: translateY(0) scale(1);\n }\n}\n\n/* Progress bar shrink */\n@keyframes easy-toast-progress-shrink {\n from {\n transform: scaleX(1);\n }\n to {\n transform: scaleX(0);\n }\n}\n\n/* Spinner rotation */\n@keyframes easy-toast-spin {\n from {\n transform: rotate(0deg);\n }\n to {\n transform: rotate(360deg);\n }\n}\n\n/* ==========================================================================\n Responsive Design & Mobile Viewports\n ========================================================================== */\n@media screen and (max-width: 480px) {\n .easy-toast-container {\n width: 100%;\n left: 0 !important;\n right: 0 !important;\n transform: none !important;\n padding: 12px;\n }\n\n .easy-toast-container--top-left,\n .easy-toast-container--top-center,\n .easy-toast-container--top-right {\n top: env(safe-area-inset-top, 0px);\n align-items: stretch;\n }\n\n .easy-toast-container--bottom-left,\n .easy-toast-container--bottom-center,\n .easy-toast-container--bottom-right {\n bottom: env(safe-area-inset-bottom, 0px);\n align-items: stretch;\n }\n\n .easy-toast-item {\n width: 100%;\n max-width: 100%;\n }\n}\n"]}
package/package.json ADDED
@@ -0,0 +1,73 @@
1
+ {
2
+ "name": "flashpop",
3
+ "version": "1.0.0",
4
+ "description": "A lightweight, customizable, and modern toast notification library for React applications.",
5
+ "main": "dist/index.cjs.js",
6
+ "module": "dist/index.esm.js",
7
+ "types": "dist/index.d.ts",
8
+ "style": "dist/toast.css",
9
+ "exports": {
10
+ ".": {
11
+ "import": {
12
+ "types": "./dist/index.d.ts",
13
+ "default": "./dist/index.esm.js"
14
+ },
15
+ "require": {
16
+ "types": "./dist/index.d.ts",
17
+ "default": "./dist/index.cjs.js"
18
+ }
19
+ },
20
+ "./dist/toast.css": "./dist/toast.css",
21
+ "./toast.css": "./dist/toast.css"
22
+ },
23
+ "files": [
24
+ "dist",
25
+ "src",
26
+ "README.md",
27
+ "LICENSE"
28
+ ],
29
+ "scripts": {
30
+ "build": "rollup -c",
31
+ "dev": "rollup -c -w",
32
+ "prepublishOnly": "npm run build"
33
+ },
34
+ "keywords": [
35
+ "flashpop",
36
+ "react",
37
+ "toast",
38
+ "notification",
39
+ "react-toast",
40
+ "react-notification",
41
+ "alerts",
42
+ "snackbar",
43
+ "popup",
44
+ "ui",
45
+ "component",
46
+ "lightweight",
47
+ "customizable"
48
+ ],
49
+ "author": "Shyam",
50
+ "license": "MIT",
51
+ "repository": {
52
+ "type": "git",
53
+ "url": "git+https://github.com/flashpop/flashpop.git"
54
+ },
55
+ "peerDependencies": {
56
+ "react": ">=16.8.0",
57
+ "react-dom": ">=16.8.0"
58
+ },
59
+ "devDependencies": {
60
+ "@babel/core": "^7.24.0",
61
+ "@babel/preset-env": "^7.24.0",
62
+ "@babel/preset-react": "^7.23.3",
63
+ "@rollup/plugin-babel": "^6.0.4",
64
+ "@rollup/plugin-commonjs": "^25.0.7",
65
+ "@rollup/plugin-node-resolve": "^15.2.3",
66
+ "postcss": "^8.4.35",
67
+ "react": "^18.2.0",
68
+ "react-dom": "^18.2.0",
69
+ "rollup": "^4.12.0",
70
+ "rollup-plugin-copy": "^3.5.0",
71
+ "rollup-plugin-postcss": "^4.0.2"
72
+ }
73
+ }
@@ -0,0 +1,83 @@
1
+ import React from 'react';
2
+ import { createPortal } from 'react-dom';
3
+ import { ToastItem } from './ToastItem';
4
+
5
+ const VALID_POSITIONS = [
6
+ 'top-left',
7
+ 'top-center',
8
+ 'top-right',
9
+ 'bottom-left',
10
+ 'bottom-center',
11
+ 'bottom-right',
12
+ ];
13
+
14
+ /**
15
+ * ToastContainer Component
16
+ * Renders toast groups in their respective screen positions via a React Portal.
17
+ */
18
+ export const ToastContainer = ({
19
+ toasts = [],
20
+ onDismiss,
21
+ position: defaultPosition = 'top-right',
22
+ theme: defaultTheme = 'light',
23
+ newestOnTop = false,
24
+ pauseOnHover = true,
25
+ showProgressBar = true,
26
+ swipeable = true,
27
+ swipeThreshold = 70,
28
+ limit,
29
+ className = '',
30
+ style = {},
31
+ }) => {
32
+ // Guard for SSR (Next.js, Gatsby, Remix)
33
+ const isMounted = typeof window !== 'undefined' && typeof document !== 'undefined';
34
+
35
+ if (!isMounted) {
36
+ return null;
37
+ }
38
+
39
+ // Filter toasts if limit is set
40
+ const visibleToasts = limit && limit > 0 ? toasts.slice(-limit) : toasts;
41
+
42
+ // Group toasts by position
43
+ const groupedToasts = visibleToasts.reduce((acc, toast) => {
44
+ const pos = toast.position || defaultPosition;
45
+ const validPos = VALID_POSITIONS.includes(pos) ? pos : 'top-right';
46
+ if (!acc[validPos]) {
47
+ acc[validPos] = [];
48
+ }
49
+ acc[validPos].push(toast);
50
+ return acc;
51
+ }, {});
52
+
53
+ const portalContent = (
54
+ <div className={`easy-toast-portal ${className}`} style={style}>
55
+ {Object.entries(groupedToasts).map(([pos, items]) => {
56
+ const sortedItems = newestOnTop ? [...items].reverse() : items;
57
+
58
+ return (
59
+ <div
60
+ key={pos}
61
+ className={`easy-toast-container easy-toast-container--${pos}`}
62
+ aria-live="polite"
63
+ >
64
+ {sortedItems.map((toast) => (
65
+ <ToastItem
66
+ key={toast.id}
67
+ {...toast}
68
+ pauseOnHover={toast.pauseOnHover ?? pauseOnHover}
69
+ showProgressBar={toast.showProgressBar ?? showProgressBar}
70
+ swipeable={toast.swipeable ?? swipeable}
71
+ swipeThreshold={toast.swipeThreshold ?? swipeThreshold}
72
+ theme={toast.theme || defaultTheme}
73
+ onDismiss={onDismiss}
74
+ />
75
+ ))}
76
+ </div>
77
+ );
78
+ })}
79
+ </div>
80
+ );
81
+
82
+ return createPortal(portalContent, document.body);
83
+ };
@@ -0,0 +1,262 @@
1
+ import React, { createContext, useContext, useState, useCallback, useMemo, useRef } from 'react';
2
+ import { ToastContainer } from './ToastContainer';
3
+
4
+ // Create Toast Context
5
+ export const ToastContext = createContext(null);
6
+
7
+ let toastCount = 0;
8
+ const generateId = () => {
9
+ toastCount += 1;
10
+ return `easy-toast-${Date.now()}-${toastCount}`;
11
+ };
12
+
13
+ /**
14
+ * ToastProvider Component
15
+ * Wraps your application to provide toast functionality anywhere in the component tree.
16
+ */
17
+ export const ToastProvider = ({
18
+ children,
19
+ position = 'top-right',
20
+ autoClose = 3000,
21
+ pauseOnHover = true,
22
+ showProgressBar = true,
23
+ swipeable = true,
24
+ swipeThreshold = 70,
25
+ theme = 'light',
26
+ limit,
27
+ newestOnTop = false,
28
+ containerClassName = '',
29
+ containerStyle = {},
30
+ }) => {
31
+ const [toasts, setToasts] = useState([]);
32
+ const toastsRef = useRef(toasts);
33
+ toastsRef.current = toasts;
34
+
35
+ // Add a new toast
36
+ const addToast = useCallback(
37
+ (messageOrOptions, maybeOptions = {}) => {
38
+ let options = {};
39
+ if (typeof messageOrOptions === 'object' && !React.isValidElement(messageOrOptions)) {
40
+ options = { ...messageOrOptions };
41
+ } else {
42
+ options = { ...maybeOptions, message: messageOrOptions };
43
+ }
44
+
45
+ const id = options.id || generateId();
46
+ const newToast = {
47
+ id,
48
+ type: options.type || 'default',
49
+ message: options.message,
50
+ title: options.title,
51
+ duration: options.duration !== undefined ? options.duration : autoClose,
52
+ showProgressBar: options.showProgressBar !== undefined ? options.showProgressBar : showProgressBar,
53
+ pauseOnHover: options.pauseOnHover !== undefined ? options.pauseOnHover : pauseOnHover,
54
+ swipeable: options.swipeable !== undefined ? options.swipeable : swipeable,
55
+ swipeThreshold: options.swipeThreshold !== undefined ? options.swipeThreshold : swipeThreshold,
56
+ closeButton: options.closeButton !== undefined ? options.closeButton : true,
57
+ icon: options.icon,
58
+ action: options.action,
59
+ onClose: options.onClose,
60
+ onAccept: options.onAccept,
61
+ onCancel: options.onCancel,
62
+ acceptLabel: options.acceptLabel,
63
+ cancelLabel: options.cancelLabel,
64
+ position: options.position || position,
65
+ theme: options.theme || theme,
66
+ className: options.className || '',
67
+ style: options.style || {},
68
+ };
69
+
70
+ setToasts((prev) => {
71
+ // If updating an existing toast with same id
72
+ const existingIndex = prev.findIndex((t) => t.id === id);
73
+ if (existingIndex > -1) {
74
+ const updated = [...prev];
75
+ updated[existingIndex] = { ...updated[existingIndex], ...newToast };
76
+ return updated;
77
+ }
78
+
79
+ // Apply limit if specified
80
+ if (limit && limit > 0 && prev.length >= limit) {
81
+ return [...prev.slice(prev.length - limit + 1), newToast];
82
+ }
83
+
84
+ return [...prev, newToast];
85
+ });
86
+
87
+ return id;
88
+ },
89
+ [autoClose, showProgressBar, pauseOnHover, position, theme, limit]
90
+ );
91
+
92
+ // Update an existing toast (e.g. for promises)
93
+ const updateToast = useCallback((id, updatedOptions) => {
94
+ setToasts((prev) =>
95
+ prev.map((t) => {
96
+ if (t.id === id) {
97
+ return {
98
+ ...t,
99
+ ...updatedOptions,
100
+ id, // preserve id
101
+ };
102
+ }
103
+ return t;
104
+ })
105
+ );
106
+ }, []);
107
+
108
+ // Dismiss a specific toast
109
+ const dismissToast = useCallback((id) => {
110
+ setToasts((prev) => prev.filter((t) => t.id !== id));
111
+ }, []);
112
+
113
+ // Dismiss all toasts
114
+ const dismissAll = useCallback(() => {
115
+ setToasts([]);
116
+ }, []);
117
+
118
+ // Context value with core functions
119
+ const contextValue = useMemo(
120
+ () => ({
121
+ addToast,
122
+ updateToast,
123
+ dismissToast,
124
+ dismissAll,
125
+ toasts,
126
+ }),
127
+ [addToast, updateToast, dismissToast, dismissAll, toasts]
128
+ );
129
+
130
+ return (
131
+ <ToastContext.Provider value={contextValue}>
132
+ {children}
133
+ <ToastContainer
134
+ toasts={toasts}
135
+ onDismiss={dismissToast}
136
+ position={position}
137
+ theme={theme}
138
+ limit={limit}
139
+ newestOnTop={newestOnTop}
140
+ pauseOnHover={pauseOnHover}
141
+ showProgressBar={showProgressBar}
142
+ swipeable={swipeable}
143
+ swipeThreshold={swipeThreshold}
144
+ className={containerClassName}
145
+ style={containerStyle}
146
+ />
147
+ </ToastContext.Provider>
148
+ );
149
+ };
150
+
151
+ /**
152
+ * Custom Hook: useToast
153
+ * Exposes an intuitive API to trigger and manage toast notifications.
154
+ *
155
+ * Example:
156
+ * const toast = useToast();
157
+ * toast.success('Profile updated!');
158
+ * toast.error('Something went wrong');
159
+ */
160
+ export const useToast = () => {
161
+ const context = useContext(ToastContext);
162
+
163
+ if (!context) {
164
+ throw new Error('useToast must be used within a <ToastProvider>. Please wrap your root component in <ToastProvider>.');
165
+ }
166
+
167
+ const { addToast, updateToast, dismissToast, dismissAll } = context;
168
+
169
+ // Base callable toast function
170
+ const toast = useCallback(
171
+ (message, options) => {
172
+ return addToast(message, options);
173
+ },
174
+ [addToast]
175
+ );
176
+
177
+ // Helper: toast.success
178
+ toast.success = useCallback(
179
+ (message, options = {}) => {
180
+ return addToast(message, { ...options, type: 'success' });
181
+ },
182
+ [addToast]
183
+ );
184
+
185
+ // Helper: toast.error
186
+ toast.error = useCallback(
187
+ (message, options = {}) => {
188
+ return addToast(message, { ...options, type: 'error' });
189
+ },
190
+ [addToast]
191
+ );
192
+
193
+ // Helper: toast.warning
194
+ toast.warning = useCallback(
195
+ (message, options = {}) => {
196
+ return addToast(message, { ...options, type: 'warning' });
197
+ },
198
+ [addToast]
199
+ );
200
+
201
+ // Helper: toast.info
202
+ toast.info = useCallback(
203
+ (message, options = {}) => {
204
+ return addToast(message, { ...options, type: 'info' });
205
+ },
206
+ [addToast]
207
+ );
208
+
209
+ // Helper: toast.loading
210
+ toast.loading = useCallback(
211
+ (message, options = {}) => {
212
+ return addToast(message, {
213
+ ...options,
214
+ type: 'loading',
215
+ duration: false, // does not auto-dismiss
216
+ showProgressBar: false,
217
+ });
218
+ },
219
+ [addToast]
220
+ );
221
+
222
+ // Helper: toast.promise
223
+ toast.promise = useCallback(
224
+ (promise, messages, options = {}) => {
225
+ const id = toast.loading(messages.loading || 'Loading...', options);
226
+
227
+ const p = promise instanceof Promise ? promise : Promise.resolve(promise);
228
+
229
+ p.then((result) => {
230
+ const successMsg =
231
+ typeof messages.success === 'function' ? messages.success(result) : messages.success || 'Success!';
232
+ updateToast(id, {
233
+ type: 'success',
234
+ message: successMsg,
235
+ duration: options.duration !== undefined ? options.duration : 3000,
236
+ showProgressBar: options.showProgressBar !== undefined ? options.showProgressBar : true,
237
+ ...options.successOptions,
238
+ });
239
+ }).catch((err) => {
240
+ const errorMsg =
241
+ typeof messages.error === 'function' ? messages.error(err) : messages.error || 'Something went wrong';
242
+ updateToast(id, {
243
+ type: 'error',
244
+ message: errorMsg,
245
+ duration: options.duration !== undefined ? options.duration : 4000,
246
+ showProgressBar: options.showProgressBar !== undefined ? options.showProgressBar : true,
247
+ ...options.errorOptions,
248
+ });
249
+ });
250
+
251
+ return p;
252
+ },
253
+ [toast, updateToast]
254
+ );
255
+
256
+ // Programmatic dismiss
257
+ toast.dismiss = dismissToast;
258
+ toast.dismissAll = dismissAll;
259
+ toast.update = updateToast;
260
+
261
+ return toast;
262
+ };