import * as React from 'react'
import { Toast as ToastPrimitive } from '@base-ui/react/toast'
import { cn } from '@/client/lib/cn'
import { Button } from '@/client/components/ui/button'
import {
IconX,
IconCircleCheck,
IconInfoCircle,
IconAlertTriangle,
IconAlertOctagon,
IconLoader
} from '@tabler/icons-react'
const toast = ToastPrimitive.createToastManager()
function ToastProvider({ ...props }: ToastPrimitive.Provider.Props) {
return
}
function ToastPortal({ ...props }: ToastPrimitive.Portal.Props) {
return
}
function ToastViewport({ className, ...props }: ToastPrimitive.Viewport.Props) {
return (
)
}
function Toast({ className, ...props }: ToastPrimitive.Root.Props) {
return (
)
}
function ToastContent({ className, ...props }: ToastPrimitive.Content.Props) {
return (
)
}
function ToastTitle({ className, ...props }: ToastPrimitive.Title.Props) {
return (
)
}
function ToastDescription({ className, ...props }: ToastPrimitive.Description.Props) {
return (
)
}
function ToastAction({
className,
render = ,
...props
}: ToastPrimitive.Action.Props) {
return (
)
}
function ToastClose({
className,
children,
render = ,
...props
}: ToastPrimitive.Close.Props) {
return (
{children ?? }
)
}
function ToastIcon({ type }: { type: string | undefined }) {
let icon: React.ReactNode = null
if (type === 'success') {
icon =
}
if (type === 'info') {
icon =
}
if (type === 'warning') {
icon =
}
if (type === 'error') {
icon =
}
if (type === 'loading') {
icon =
}
if (!icon) {
return null
}
return (
{icon}
)
}
function ToastList() {
const { toasts } = ToastPrimitive.useToastManager()
return toasts.map(toastItem => (
))
}
function Toaster({ children, toastManager = toast, ...props }: ToastPrimitive.Provider.Props) {
return (
{children}
)
}
const createToastManager = ToastPrimitive.createToastManager
const useToastManager = ToastPrimitive.useToastManager
export {
Toaster,
Toast,
ToastAction,
ToastClose,
ToastContent,
ToastDescription,
ToastPortal,
ToastProvider,
ToastTitle,
ToastViewport,
createToastManager,
toast,
useToastManager
}