{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "alert-dialog-story",
  "title": "Alert Dialog Story",
  "author": "Lloyd Richards <lloyd.d.richards@gmail.com>",
  "description": "Interactive Storybook stories demonstrating alert dialog component usage and variants",
  "registryDependencies": [
    "alert-dialog"
  ],
  "files": [
    {
      "path": "registry/ui/alert-dialog-story/alert-dialog-radix.stories.tsx",
      "content": "import preview from \"@/.storybook/preview\";\n\nimport {\n  AlertDialog,\n  AlertDialogAction,\n  AlertDialogCancel,\n  AlertDialogContent,\n  AlertDialogDescription,\n  AlertDialogFooter,\n  AlertDialogHeader,\n  AlertDialogTitle,\n  AlertDialogTrigger,\n} from \"@/components/ui/alert-dialog\";\nimport { expect, waitFor, within } from \"storybook/test\";\n\n/**\n * A modal dialog that interrupts the user with important content and expects\n * a response.\n */\nconst meta = preview.meta({\n  id: \"ui-radix-alertdialog\",\n  title: \"ui/AlertDialog\",\n  component: AlertDialog,\n  tags: [\"autodocs\"],\n  argTypes: {},\n  render: (args) => (\n    <AlertDialog {...args}>\n      <AlertDialogTrigger>Open</AlertDialogTrigger>\n      <AlertDialogContent>\n        <AlertDialogHeader>\n          <AlertDialogTitle>Are you absolutely sure?</AlertDialogTitle>\n          <AlertDialogDescription>\n            This action cannot be undone. This will permanently delete your\n            account and remove your data from our servers.\n          </AlertDialogDescription>\n        </AlertDialogHeader>\n        <AlertDialogFooter>\n          <AlertDialogCancel>Cancel</AlertDialogCancel>\n          <AlertDialogAction>Continue</AlertDialogAction>\n        </AlertDialogFooter>\n      </AlertDialogContent>\n    </AlertDialog>\n  ),\n  parameters: {\n    layout: \"centered\",\n  },\n});\n\nexport default meta;\n\n/**\n * The default form of the alert dialog.\n */\nexport const Default = meta.story();\n\nexport const ShouldOpenClose = meta.story({\n  name: \"when alert dialog trigger is pressed, should open the dialog and be able to close it\",\n  tags: [\"!dev\", \"!autodocs\", \"!manifest\"],\n  play: async ({ canvasElement, canvas, step, userEvent }) => {\n    const body = within(canvasElement.ownerDocument.body);\n    const trigger = canvas.getByRole(\"button\", { name: \"Open\" });\n\n    await step(\"Open the alert dialog\", async () => {\n      await userEvent.click(trigger);\n      await waitFor(() =>\n        expect(\n          body.getByRole(\"alertdialog\", { name: \"Are you absolutely sure?\" }),\n        ).toBeVisible(),\n      );\n    });\n\n    await step(\"Cancel to dismiss the dialog and return focus\", async () => {\n      const dialog = body.getByRole(\"alertdialog\");\n      await userEvent.click(\n        within(dialog).getByRole(\"button\", { name: \"Cancel\" }),\n      );\n      await waitFor(() => expect(dialog).not.toBeInTheDocument());\n      await expect(trigger).toHaveFocus();\n    });\n  },\n});\n",
      "type": "registry:component",
      "target": "@ui/alert-dialog.stories.tsx"
    }
  ],
  "categories": [
    "ui",
    "storybook",
    "dialog",
    "modal"
  ],
  "type": "registry:component"
}