import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
import { toast } from 'sonner';
import { Toaster } from './sonner.js';
import { Button } from './button.js';
const meta = {
    title: 'Primitives/Toast',
    component: Toaster,
    parameters: {
        layout: 'centered',
    },
    tags: ['autodocs'],
    decorators: [
        (Story) => (_jsxs(_Fragment, { children: [_jsx(Story, {}), _jsx(Toaster, {})] })),
    ],
};
export default meta;
export const Default = {
    render: () => _jsx(Button, { onClick: () => toast('Event has been created'), children: "Show Toast" }),
};
export const Description = {
    render: () => (_jsx(Button, { onClick: () => toast('Event has been created', {
            description: 'Sunday, December 03, 2023 at 9:00 AM',
        }), children: "Show Toast with Description" })),
};
export const Success = {
    render: () => (_jsx(Button, { variant: "default", onClick: () => toast.success('Successfully saved!'), children: "Show Success Toast" })),
};
export const Error = {
    render: () => (_jsx(Button, { variant: "destructive", onClick: () => toast.error('Something went wrong'), children: "Show Error Toast" })),
};
export const WithAction = {
    render: () => (_jsx(Button, { onClick: () => toast('Event deleted', {
            action: {
                label: 'Undo',
                onClick: () => toast('Restored!'),
            },
        }), children: "Show Toast with Action" })),
};
export const PromiseToast = {
    render: () => (_jsx(Button, { onClick: () => {
            const promiseFn = () => new globalThis.Promise((resolve) => setTimeout(() => resolve({ name: 'Sonner' }), 2000));
            toast.promise(promiseFn, {
                loading: 'Loading...',
                success: () => 'Data loaded successfully!',
                error: 'Error loading data',
            });
        }, children: "Show Promise Toast" })),
};
export const AllVariants = {
    render: () => (_jsxs("div", { className: "flex flex-wrap gap-2", children: [_jsx(Button, { onClick: () => toast('Default toast'), children: "Default" }), _jsx(Button, { onClick: () => toast.success('Success!'), children: "Success" }), _jsx(Button, { onClick: () => toast.error('Error!'), children: "Error" }), _jsx(Button, { onClick: () => toast.warning('Warning!'), children: "Warning" }), _jsx(Button, { onClick: () => toast.info('Info'), children: "Info" })] })),
};
