{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "hover-card-story",
  "title": "Hover Card Story",
  "author": "Lloyd Richards <lloyd.d.richards@gmail.com>",
  "description": "Interactive Storybook stories demonstrating hover card component usage and variants",
  "dependencies": [
    "react-aria-components"
  ],
  "registryDependencies": [
    "hover-card"
  ],
  "files": [
    {
      "path": "registry/ui/hover-card-story/hover-card-aria.stories.tsx",
      "content": "import { expect, userEvent, waitFor, within } from \"storybook/test\";\nimport { Focusable } from \"react-aria-components\";\nimport type { Meta, StoryObj } from \"@storybook/nextjs-vite\";\n\nimport {\n  HoverCard,\n  HoverCardTrigger,\n} from \"@/components/ui/hover-card\";\n\n/**\n * For sighted users to preview content available behind a link.\n */\nconst meta = {\n  id: \"ui-aria-hovercard\",\n  title: \"ui/HoverCard\",\n  component: HoverCard,\n  tags: [\"autodocs\"],\n  argTypes: {},\n  args: { children: null },\n  render: (args) => (\n    <HoverCardTrigger>\n      <Focusable>\n        <button type=\"button\" className=\"rounded-md border px-3 py-2\">\n          Hover\n        </button>\n      </Focusable>\n      <HoverCard {...args}>\n        The React Framework - created and maintained by @vercel.\n      </HoverCard>\n    </HoverCardTrigger>\n  ),\n  parameters: {\n    layout: \"centered\",\n  },\n} satisfies Meta<typeof HoverCard>;\n\nexport default meta;\n\ntype Story = StoryObj<typeof meta>;\n\n/**\n * The default form of the hover card.\n */\nexport const Default: Story = {};\n\n/**\n * Use the `delay` and `closeDelay` props to control the delay before the\n * hover card opens and closes.\n */\nexport const Instant: Story = {\n  render: (args) => (\n    <HoverCardTrigger delay={0} closeDelay={0}>\n      <Focusable>\n        <button type=\"button\" className=\"rounded-md border px-3 py-2\">\n          Hover\n        </button>\n      </Focusable>\n      <HoverCard {...args}>\n        The React Framework - created and maintained by @vercel.\n      </HoverCard>\n    </HoverCardTrigger>\n  ),\n};\n\nexport const ShouldShowOnHover: Story = {\n  ...Instant,\n  name: \"when hovering over trigger, should show hover card content\",\n  tags: [\"!dev\", \"!autodocs\"],\n  play: async ({ canvasElement, step }) => {\n    const canvasBody = within(canvasElement.ownerDocument.body);\n\n    await step(\"Hover over the trigger element\", async () => {\n      await userEvent.click(canvasElement);\n      await userEvent.hover(await canvasBody.findByText(/hover/i));\n      await waitFor(() =>\n        expect(\n          canvasBody.queryByText(/created and maintained by @vercel/i),\n        ).toBeVisible(),\n      );\n    });\n    await step(\"Dismiss the preview by clicking outside\", async () => {\n      await userEvent.click(canvasElement);\n      await waitFor(() =>\n        expect(\n          canvasBody.queryByText(/created and maintained by @vercel/i),\n        ).toBeNull(),\n      );\n    });\n  },\n};\n",
      "type": "registry:component",
      "target": "@ui/hover-card.stories.tsx"
    }
  ],
  "categories": [
    "ui",
    "storybook",
    "hover",
    "popover"
  ],
  "type": "registry:component"
}