{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "tooltip-story",
  "title": "Tooltip Story",
  "author": "Lloyd Richards <lloyd.d.richards@gmail.com>",
  "description": "Interactive Storybook stories demonstrating tooltip component usage and variants",
  "dependencies": [
    "lucide-react",
    "react-aria-components"
  ],
  "registryDependencies": [
    "button",
    "tooltip"
  ],
  "files": [
    {
      "path": "registry/ui/tooltip-story/tooltip-aria.stories.tsx",
      "content": "import { Button } from \"@/components/ui/button\";\nimport type { Meta, StoryObj } from \"@storybook/nextjs-vite\";\nimport { Plus } from \"lucide-react\";\n\nimport { Tooltip, TooltipTrigger } from \"@/components/ui/tooltip\";\nimport { expect, userEvent, waitFor, within } from \"storybook/test\";\n\n/**\n * A popup that displays information related to an element when the element\n * receives keyboard focus or the mouse hovers over it.\n */\nconst meta: Meta<typeof Tooltip> = {\n  id: \"ui-aria-tooltip\",\n  title: \"ui/Tooltip\",\n  component: Tooltip,\n  tags: [\"autodocs\"],\n  argTypes: {\n    placement: {\n      options: [\"top\", \"bottom\", \"left\", \"right\"],\n      control: {\n        type: \"radio\",\n      },\n    },\n    children: {\n      control: \"text\",\n    },\n  },\n  args: {\n    placement: \"top\",\n    children: \"Add to library\",\n  },\n  parameters: {\n    layout: \"centered\",\n  },\n  render: (args) => (\n    <TooltipTrigger>\n      <Button>\n        <Plus className=\"h-4 w-4\" />\n        <span className=\"sr-only\">Add</span>\n      </Button>\n      <Tooltip {...args} />\n    </TooltipTrigger>\n  ),\n} satisfies Meta<typeof Tooltip>;\n\nexport default meta;\n\ntype Story = StoryObj<typeof meta>;\n\n/**\n * The default form of the tooltip.\n */\nexport const Default: Story = {};\n\n/**\n * Use the `bottom` side to display the tooltip below the element.\n */\nexport const Bottom: Story = {\n  args: {\n    placement: \"bottom\",\n  },\n};\n\n/**\n * Use the `left` side to display the tooltip to the left of the element.\n */\nexport const Left: Story = {\n  args: {\n    placement: \"left\",\n  },\n};\n\n/**\n * Use the `right` side to display the tooltip to the right of the element.\n */\nexport const Right: Story = {\n  args: {\n    placement: \"right\",\n  },\n};\n\n/** Reveal the hint with keyboard focus and dismiss it with Escape. */\nexport const ShouldShowOnFocus: Story = {\n  tags: [\"!dev\", \"!autodocs\"],\n  play: async ({ canvas, canvasElement }) => {\n    const body = within(canvasElement.ownerDocument.body);\n    await userEvent.tab();\n    await expect(canvas.getByRole(\"button\", { name: \"Add\" })).toHaveFocus();\n    await expect(await body.findByRole(\"tooltip\")).toHaveTextContent(\n      \"Add to library\",\n    );\n    await userEvent.keyboard(\"{Escape}\");\n    await waitFor(() => expect(body.queryByRole(\"tooltip\")).toBeNull());\n  },\n};\n",
      "type": "registry:component",
      "target": "@ui/tooltip.stories.tsx"
    }
  ],
  "categories": [
    "ui",
    "storybook",
    "tooltip",
    "overlay"
  ],
  "type": "registry:component"
}