@baseplate-dev/ui-components
Version:
Shared UI component library
29 lines • 1.4 kB
JavaScript
'use client';
import { jsx as _jsx } from "react/jsx-runtime";
import { Toaster as Sonner } from 'sonner';
import { buttonVariants } from '#src/styles/index.js';
/**
* A toaster component that displays toast notifications.
*
* Adapted from https://ui.shadcn.com/docs/components/sonner
*/
const Toaster = ({ ...props }) => (_jsx(Sonner, { className: "toaster group", position: "top-center", duration: 3000, closeButton: true, toastOptions: {
unstyled: true,
classNames: {
success: 'group-[.toaster]:bg-success group-[.toaster]:text-success-foreground group-[.toaster]:border-success',
error: 'group-[.toaster]:bg-error group-[.toaster]:text-error-foreground group-[.toaster]:border-error',
warning: 'group-[.toaster]:bg-warning group-[.toaster]:text-warning-foreground group-[.toaster]:border-warning',
default: 'bg-background text-foreground',
toast: 'group toast group-[.toaster]:shadow-lg p-4 rounded-lg flex items-center text-sm gap-1.5 w-(--width)',
description: 'group-[.toast]:text-muted-foreground',
actionButton: buttonVariants({
size: 'sm',
}),
cancelButton: buttonVariants({
size: 'sm',
variant: 'secondary',
}),
},
}, ...props }));
export { Toaster };
//# sourceMappingURL=toaster.js.map