import { useCallback, useRef, useState } from "react"; import { Box } from "../../box"; import { Button } from "../../button"; import { Flex } from "../../flex"; import { Icons } from "../../icons"; import { ToastProvider, ToastViewport, useToast } from "../index"; import { Toast } from "../toast"; import type { Meta, StoryObj } from "@storybook/react"; const anatomyProps = { table: { category: "Anatomy Props", }, }; const meta: Meta = { title: "Toast", component: Toast, decorators: [ (Story, context) => { return ( <> {/* @ts-expect-error: position is a ToastProvider prop */} ); }, ], argTypes: { // @ts-expect-error its used to control toast provider position prop position: { control: { type: "select" }, options: ["topRight", "topLeft", "bottomLeft", "bottomRight", "bottomCenter"], }, variant: { options: ["(none)", "success", "warning"], }, title: { type: "string", }, description: { type: "string", }, icon: { control: false, }, rootProps: anatomyProps, titleProps: anatomyProps, descriptionProps: anatomyProps, closeProps: anatomyProps, viewportProps: anatomyProps, }, args: { title: "Transaction ID copied!", description: "", closeLabel: "Close", duration: 5000, icon: , // @ts-expect-error: position is a ToastProvider prop position: "bottomRight", }, }; export default meta; type Story = StoryObj; export const Default: Story = { render: (args) => { const { publish } = useToast(); return ( {showCustomViewport && } ); }, };