import type { Meta, StoryObj } from "@storybook/react-vite"; import * as React from "react"; import { userEvent, within } from "storybook/test"; import { Button } from "../button"; import { Outline } from "../icon"; import { Breakout } from "../layout"; import { Body, P } from "../typography"; import { Tooltip } from "./tooltip"; const meta: Meta = { title: "Controls/Tooltip", component: Tooltip, decorators: [ (Story) => (
), ], play: async ({ canvasElement }) => { const canvas = within(canvasElement); const buttons = canvas.getAllByRole("button"); buttons.forEach(async (button) => { await userEvent.hover(button, { delay: 10 }); }); }, }; export default meta; type Story = StoryObj; export const TooltipComponent: Story = { args: { children: ( ), content: "This tooltip works by hovering over any react element, and it can be placed in any direction.", }, }; export const TooltipTop: Story = { args: { ...TooltipComponent.args, placement: "top", }, decorators: [ (Story) => (
), ], }; export const TooltipRight: Story = { args: { ...TooltipComponent.args, placement: "right", }, }; export const TooltipBottom: Story = { args: { ...TooltipComponent.args, placement: "bottom", }, }; export const TooltipLeft: Story = { args: { ...TooltipComponent.args, placement: "left", }, decorators: [ (Story) => (
), ], }; export const TooltipBigText: Story = { args: { ...TooltipComponent.args, content: (

This tooltip works by hovering over any react element, and it can be placed in any direction.

This tooltip works by hovering over any react element, and it can be placed in any direction.

This tooltip works by hovering over any react element, and it can be placed in any direction.

), }, }; export const TooltipStack: Story = { render: () => (

This tooltip works by hovering over any react element, and it can be placed in any direction.

This tooltip works by hovering over any react element, and it can be placed in any direction.

This tooltip works by hovering over any react element, and it can be placed in any direction.

} >
), }; export const TooltipkeepOpenOnHover: Story = { args: { ...TooltipComponent.args, keepOpenOnHover: true, }, };