import React from "react"; import { screen, userEvent } from "@storybook/testing-library"; import { expect } from "@storybook/jest"; import { theme } from "../theme"; import { Tooltip } from "./"; import type { Meta, StoryFn } from "@storybook/react"; export default { title: "Tooltip", component: Tooltip.Root, argTypes: { density: { options: ["default", "compact"], control: "select", }, offsetSide: { options: [ theme.space["025"].value, theme.space["050"].value, theme.space[100].value, theme.space[150].value, theme.space[200].value, theme.space[250].value, ], control: "select", }, }, parameters: { chromatic: { delay: 300 }, }, } as Meta; // eslint-disable-next-line @typescript-eslint/no-explicit-any const Template: StoryFn = (args) => ( avatar image i want lots of things to go here and for this to get super super long and for this to never stop and i want more fries and i want it to rain but i also want the sun and i wasnt a vacataions and it doesnt matter if this is misspelled or whatverer. ); // eslint-disable-next-line @typescript-eslint/no-explicit-any const TemplateRight: StoryFn = (args) => ( This is a tooltip trigger
My Tooltip
my link
Lorem ipsum dolor sit amet consectetur adipisicing elit. Magni sint nobis blanditiis nesciunt,
); // eslint-disable-next-line @typescript-eslint/no-explicit-any const TemplateLeft: StoryFn = (args) => ( avatar image i want lots of things to go here and for this to get super super long and for this to never stop and i want more fries and i want it to rain but i also want the sun and i wasnt a vacataions and it doesnt matter if this is misspelled or whatverer. ); // eslint-disable-next-line @typescript-eslint/no-explicit-any const TemplateBottom: StoryFn = (args) => ( This is a tooltip trigger i want lots of things to go here and for this to get super super long and for this to never stop and i want more fries and i want it to rain but i also want the sun and i wasnt a vacataions and it doesnt matter if this is misspelled or whatverer. ); // eslint-disable-next-line @typescript-eslint/no-explicit-any const TemplateDisabled: StoryFn = (args) => ( This is a tooltip trigger i want lots of things to go here and for this to get super super long and for this to never stop and i want more fries and i want it to rain but i also want the sun and i wasnt a vacataions and it doesnt matter if this is misspelled or whatverer. ); export const Default = { render: Template, args: { density: "compact", offsetSide: theme.space[100], align: "start", }, parameters: { chromatic: { delay: 100 }, }, }; export const PlacedOnRight = { render: TemplateRight, args: {}, }; export const PlacedOnLeft = { render: TemplateLeft, args: {}, parameters: { chromatic: { delay: 100 }, }, }; export const PlacedOnBottom = { render: TemplateBottom, args: {}, }; export const Disabled = { render: TemplateDisabled, args: { disabled: true }, }; // eslint-disable-next-line @typescript-eslint/no-explicit-any const InteractionsTemplate: StoryFn = () => ( Trigger
My Tooltip
); export const Interactions = { render: InteractionsTemplate, parameters: { chromatic: { disableSnapshot: true }, }, play: async () => { await userEvent.hover(screen.getAllByText("Trigger")[0]); const contentArray = await screen.findAllByTestId("tooltip-content"); await expect(contentArray[0]).toBeVisible(); }, };