{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "files": [
    {
      "content": "\"use client\";\n\nimport { MinusIcon, PlusIcon } from \"lucide-react\";\nimport { useCallback, useState } from \"react\";\nimport { Bar, BarChart, ResponsiveContainer } from \"recharts\";\nimport { Button } from \"~/registry/ui/button\";\nimport { Drawer } from \"~/registry/ui/drawer\";\n\nconst data = [\n  {\n    goal: 400,\n  },\n  {\n    goal: 300,\n  },\n  {\n    goal: 200,\n  },\n  {\n    goal: 300,\n  },\n  {\n    goal: 200,\n  },\n  {\n    goal: 278,\n  },\n  {\n    goal: 189,\n  },\n  {\n    goal: 239,\n  },\n  {\n    goal: 300,\n  },\n  {\n    goal: 200,\n  },\n  {\n    goal: 278,\n  },\n  {\n    goal: 189,\n  },\n  {\n    goal: 349,\n  },\n];\n\nexport function DrawerDemo() {\n  return (\n    <div className=\"flex flex-wrap items-start gap-4\">\n      <DrawerBottom />\n      <DrawerScrollableContent />\n      <DrawerDirections />\n    </div>\n  );\n}\n\nfunction DrawerBottom() {\n  const [goal, setGoal] = useState(350);\n\n  const onClick = useCallback((adjustment: number) => {\n    setGoal((prevGoal) => Math.max(200, Math.min(400, prevGoal + adjustment)));\n  }, []);\n\n  return (\n    <Drawer.Root>\n      <Button variant=\"outline\">Open Drawer</Button>\n\n      <Drawer.Overlay>\n        <div className=\"mx-auto w-full max-w-sm\">\n          <Drawer.Header>\n            <Drawer.Title>Move Goal</Drawer.Title>\n            <Drawer.Description>\n              Set your daily activity goal.\n            </Drawer.Description>\n          </Drawer.Header>\n          <div className=\"p-4 pb-0\">\n            <div className=\"flex items-center justify-center space-x-2\">\n              <Button\n                className=\"h-8 w-8 shrink-0 rounded-full\"\n                isDisabled={goal <= 200}\n                onPress={() => onClick(-10)}\n                size=\"icon\"\n                variant=\"outline\"\n              >\n                <MinusIcon />\n                <span className=\"sr-only\">Decrease</span>\n              </Button>\n              <div className=\"flex-1 text-center\">\n                <div className=\"font-bold text-7xl tracking-tighter\">\n                  {goal}\n                </div>\n                <div className=\"text-[0.70rem] text-muted-foreground uppercase\">\n                  Calories/day\n                </div>\n              </div>\n              <Button\n                className=\"h-8 w-8 shrink-0 rounded-full\"\n                isDisabled={goal >= 400}\n                onPress={() => onClick(10)}\n                size=\"icon\"\n                variant=\"outline\"\n              >\n                <PlusIcon />\n                <span className=\"sr-only\">Increase</span>\n              </Button>\n            </div>\n            <div className=\"mt-3 h-[120px]\">\n              <ResponsiveContainer height=\"100%\" width=\"100%\">\n                <BarChart data={data}>\n                  <Bar\n                    dataKey=\"goal\"\n                    style={\n                      {\n                        fill: \"var(--primary)\",\n                        opacity: 0.9,\n                      } as React.CSSProperties\n                    }\n                  />\n                </BarChart>\n              </ResponsiveContainer>\n            </div>\n          </div>\n          <Drawer.Footer className=\"gap-2 sm:flex-col sm:space-x-0\">\n            <Button>Submit</Button>\n            <Button slot=\"close\" variant=\"outline\">\n              Cancel\n            </Button>\n          </Drawer.Footer>\n        </div>\n      </Drawer.Overlay>\n    </Drawer.Root>\n  );\n}\n\nfunction DrawerScrollableContent() {\n  return (\n    <Drawer.Root>\n      <Button variant=\"outline\">Scrollable Content</Button>\n\n      <Drawer.Overlay side=\"right\">\n        <Drawer.Header>\n          <Drawer.Title>Move Goal</Drawer.Title>\n          <Drawer.Description>Set your daily activity goal.</Drawer.Description>\n        </Drawer.Header>\n        <div className=\"overflow-y-auto px-4 text-sm\">\n          <h4 className=\"mb-4 font-medium text-lg leading-none\">Lorem Ipsum</h4>\n          {Array.from({ length: 10 }).map((_, index) => (\n            // biome-ignore lint/suspicious/noArrayIndexKey: This is fine.\n            <p className=\"mb-4 leading-normal\" key={index}>\n              Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do\n              eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut\n              enim ad minim veniam, quis nostrud exercitation ullamco laboris\n              nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in\n              reprehenderit in voluptate velit esse cillum dolore eu fugiat\n              nulla pariatur. Excepteur sint occaecat cupidatat non proident,\n              sunt in culpa qui officia deserunt mollit anim id est laborum.\n            </p>\n          ))}\n        </div>\n        <Drawer.Footer>\n          <Button>Submit</Button>\n          <Button slot=\"close\" variant=\"outline\">\n            Cancel\n          </Button>\n        </Drawer.Footer>\n      </Drawer.Overlay>\n    </Drawer.Root>\n  );\n}\n\nconst directions = [\"top\", \"right\", \"bottom\", \"left\"] as const;\n\nfunction DrawerDirections() {\n  return (\n    <>\n      {directions.map((direction) => (\n        <Drawer.Root key={direction}>\n          <Button className=\"capitalize\" variant=\"outline\">\n            {direction}\n          </Button>\n\n          <Drawer.Overlay side={direction}>\n            <Drawer.Header>\n              <Drawer.Title>Move Goal</Drawer.Title>\n              <Drawer.Description>\n                Set your daily activity goal.\n              </Drawer.Description>\n            </Drawer.Header>\n            <div className=\"overflow-y-auto px-4 text-sm group-orientation-vertical:max-h-[60dvh]\">\n              {Array.from({ length: 10 }).map((_, index) => (\n                // biome-ignore lint/suspicious/noArrayIndexKey: This is fine.\n                <p className=\"mb-4 leading-normal\" key={index}>\n                  Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed\n                  do eiusmod tempor incididunt ut labore et dolore magna aliqua.\n                  Ut enim ad minim veniam, quis nostrud exercitation ullamco\n                  laboris nisi ut aliquip ex ea commodo consequat. Duis aute\n                  irure dolor in reprehenderit in voluptate velit esse cillum\n                  dolore eu fugiat nulla pariatur. Excepteur sint occaecat\n                  cupidatat non proident, sunt in culpa qui officia deserunt\n                  mollit anim id est laborum.\n                </p>\n              ))}\n            </div>\n            <Drawer.Footer>\n              <Button>Submit</Button>\n              <Button slot=\"close\" variant=\"outline\">\n                Cancel\n              </Button>\n            </Drawer.Footer>\n          </Drawer.Overlay>\n        </Drawer.Root>\n      ))}\n    </>\n  );\n}\n",
      "path": "src/registry/examples/drawer/drawer-demo.tsx",
      "type": "registry:example"
    }
  ],
  "name": "drawer-demo",
  "registryDependencies": [
    "@kanpeki/drawer"
  ],
  "type": "registry:example"
}