{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "sheet-story",
  "title": "Sheet Story",
  "author": "Lloyd Richards <lloyd.d.richards@gmail.com>",
  "description": "Interactive Storybook stories demonstrating sheet component usage and variants",
  "registryDependencies": [
    "sheet"
  ],
  "files": [
    {
      "path": "registry/ui/sheet-story/sheet-radix.stories.tsx",
      "content": "import preview from \"@/.storybook/preview\";\nimport type { ComponentProps } from \"react\";\n\nimport {\n  Sheet,\n  SheetClose,\n  SheetContent,\n  SheetDescription,\n  SheetFooter,\n  SheetHeader,\n  SheetTitle,\n  SheetTrigger,\n} from \"@/components/ui/sheet\";\nimport { expect, userEvent, within } from \"storybook/test\";\n\n/**\n * Use a sheet for supporting controls such as filters or settings. Set\n * `side` on `SheetContent` to choose which edge it opens from.\n *\n * @summary Open supporting content from the edge of the screen.\n */\nconst meta = preview\n  .type<{ args: Pick<ComponentProps<typeof SheetContent>, \"side\"> }>()\n  .meta({\n    id: \"ui-radix-sheet\",\n    title: \"ui/Sheet\",\n    component: Sheet,\n    subcomponents: { SheetContent },\n    tags: [\"autodocs\"],\n    argTypes: {\n      side: {\n        options: [\"top\", \"bottom\", \"left\", \"right\"],\n        control: {\n          type: \"radio\",\n        },\n      },\n    },\n    args: {\n      side: \"right\",\n    },\n    render: (args) => (\n      <Sheet>\n        <SheetTrigger>Open</SheetTrigger>\n        <SheetContent {...args}>\n          <SheetHeader>\n            <SheetTitle>Are you absolutely sure?</SheetTitle>\n            <SheetDescription>\n              This action cannot be undone. This will permanently delete your\n              account and remove your data from our servers.\n            </SheetDescription>\n          </SheetHeader>\n          <SheetFooter>\n            <SheetClose className=\"hover:underline\">Cancel</SheetClose>\n            <SheetClose className=\"rounded bg-primary px-4 py-2 text-primary-foreground\">\n              Submit\n            </SheetClose>\n          </SheetFooter>\n        </SheetContent>\n      </Sheet>\n    ),\n    parameters: {\n      layout: \"centered\",\n    },\n  });\n\nexport default meta;\n\n/**\n * The default form of the sheet.\n */\nexport const Default = meta.story();\n\nexport const ShouldOpenCloseWithSubmit = meta.story({\n  name: \"when clicking Submit button, should close the sheet\",\n  tags: [\"!dev\", \"!autodocs\", \"!manifest\"],\n  play: async ({ canvasElement, step }) => {\n    const canvasBody = within(canvasElement.ownerDocument.body);\n\n    await step(\"open the sheet\", async () => {\n      await userEvent.click(\n        await canvasBody.findByRole(\"button\", { name: /open/i }),\n      );\n      const sheet = await canvasBody.findByRole(\"dialog\");\n      expect(sheet).toBeInTheDocument();\n      expect(sheet).toHaveAttribute(\"data-state\", \"open\");\n    });\n\n    await step(\"close the sheet\", async () => {\n      await userEvent.click(\n        await canvasBody.findByRole(\"button\", { name: /submit/i }),\n      );\n      expect(await canvasBody.findByRole(\"dialog\")).toHaveAttribute(\n        \"data-state\",\n        \"closed\",\n      );\n    });\n  },\n});\n\nexport const ShouldOpenCloseWithCancel = meta.story({\n  name: \"when clicking Cancel button, should close the sheet\",\n  tags: [\"!dev\", \"!autodocs\", \"!manifest\"],\n  play: async ({ canvasElement, step }) => {\n    const canvasBody = within(canvasElement.ownerDocument.body);\n\n    await step(\"open the sheet\", async () => {\n      await userEvent.click(\n        await canvasBody.findByRole(\"button\", { name: /open/i }),\n      );\n      const sheet = await canvasBody.findByRole(\"dialog\");\n      expect(sheet).toBeInTheDocument();\n      expect(sheet).toHaveAttribute(\"data-state\", \"open\");\n    });\n\n    await step(\"close the sheet\", async () => {\n      await userEvent.click(\n        await canvasBody.findByRole(\"button\", { name: /cancel/i }),\n      );\n      expect(await canvasBody.findByRole(\"dialog\")).toHaveAttribute(\n        \"data-state\",\n        \"closed\",\n      );\n    });\n  },\n});\n\nexport const ShouldOpenCloseWithClose = meta.story({\n  name: \"when clicking Close icon, should close the sheet\",\n  tags: [\"!dev\", \"!autodocs\", \"!manifest\"],\n  play: async ({ canvasElement, step }) => {\n    const canvasBody = within(canvasElement.ownerDocument.body);\n\n    await step(\"open the sheet\", async () => {\n      await userEvent.click(\n        await canvasBody.findByRole(\"button\", { name: /open/i }),\n      );\n      const sheet = await canvasBody.findByRole(\"dialog\");\n      expect(sheet).toBeInTheDocument();\n      expect(sheet).toHaveAttribute(\"data-state\", \"open\");\n    });\n\n    await step(\"close the sheet\", async () => {\n      await userEvent.click(\n        await canvasBody.findByRole(\"button\", { name: /close/i }),\n      );\n      expect(await canvasBody.findByRole(\"dialog\")).toHaveAttribute(\n        \"data-state\",\n        \"closed\",\n      );\n    });\n  },\n});\n",
      "type": "registry:component",
      "target": "@ui/sheet.stories.tsx"
    }
  ],
  "categories": [
    "ui",
    "storybook",
    "sheet",
    "overlay"
  ],
  "type": "registry:component"
}