{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "sheet-cart-demo",
  "registryDependencies": [
    "https://ui-three-mu.vercel.app/r/sheet.json",
    "https://ui-three-mu.vercel.app/r/button.json",
    "https://ui-three-mu.vercel.app/r/separator.json"
  ],
  "files": [
    {
      "path": "registry/preskok/examples/sheet-cart-demo.tsx",
      "content": "\"use client\"\n\nimport { useState } from \"react\"\nimport { MinusIcon, PlusIcon } from \"lucide-react\"\n\nimport { Button } from \"@/components/ui/preskok-ui/button\"\nimport { Separator } from \"@/components/ui/preskok-ui/separator\"\nimport {\n  Sheet,\n  SheetBody,\n  SheetClose,\n  SheetContent,\n  SheetDescription,\n  SheetFooter,\n  SheetHeader,\n  SheetTitle,\n} from \"@/components/ui/preskok-ui/sheet\"\n\ninterface Part {\n  id: string\n  name: string\n  price: number\n  quantity: number\n}\n\nconst initialParts: Part[] = [\n  { id: \"brake-pads\", name: \"Front brake pads\", price: 64.9, quantity: 1 },\n  { id: \"oil-filter\", name: \"Oil filter\", price: 12.5, quantity: 2 },\n  { id: \"wiper-blades\", name: \"Wiper blade set\", price: 29, quantity: 1 },\n]\n\nconst delivery = 6.9\n\nconst currency = new Intl.NumberFormat(\"sl-SI\", {\n  style: \"currency\",\n  currency: \"EUR\",\n})\n\nexport default function SheetCartDemo() {\n  const [parts, setParts] = useState(initialParts)\n\n  const itemCount = parts.reduce((sum, part) => sum + part.quantity, 0)\n\n  const subtotal = parts.reduce(\n    (sum, part) => sum + part.price * part.quantity,\n    0\n  )\n\n  const deliveryFee = itemCount > 0 ? delivery : 0\n\n  const changeQuantity = (id: string, step: number) => {\n    setParts((current) =>\n      current.map((part) =>\n        part.id === id\n          ? { ...part, quantity: Math.max(0, part.quantity + step) }\n          : part\n      )\n    )\n  }\n\n  return (\n    <Sheet>\n      <Button intent=\"outline\">Parts order ({itemCount})</Button>\n      <SheetContent side=\"bottom\">\n        <SheetHeader>\n          <SheetTitle>Parts order</SheetTitle>\n          <SheetDescription>For VW Passat B8 · 2.0 TDI</SheetDescription>\n        </SheetHeader>\n        <SheetBody className=\"gap-4\">\n          <ul className=\"grid gap-3\">\n            {parts.map((part) => (\n              <li key={part.id} className=\"flex items-center gap-3\">\n                <div className=\"flex-1 text-sm\">\n                  <p className=\"font-medium\">{part.name}</p>\n                  <p className=\"text-muted-foreground tabular-nums\">\n                    {currency.format(part.price)}\n                  </p>\n                </div>\n                <Button\n                  intent=\"outline\"\n                  size=\"sq-sm\"\n                  aria-label={`Remove one ${part.name}`}\n                  isDisabled={part.quantity === 0}\n                  onPress={() => changeQuantity(part.id, -1)}\n                >\n                  <MinusIcon />\n                </Button>\n                <span\n                  aria-live=\"polite\"\n                  className=\"w-6 text-center text-sm tabular-nums\"\n                >\n                  {part.quantity}\n                </span>\n                <Button\n                  intent=\"outline\"\n                  size=\"sq-sm\"\n                  aria-label={`Add one ${part.name}`}\n                  onPress={() => changeQuantity(part.id, 1)}\n                >\n                  <PlusIcon />\n                </Button>\n              </li>\n            ))}\n          </ul>\n          <Separator />\n          <dl className=\"grid grid-cols-2 gap-y-1.5 text-sm\">\n            <dt className=\"text-muted-foreground\">Subtotal</dt>\n            <dd className=\"text-right tabular-nums\">\n              {currency.format(subtotal)}\n            </dd>\n            <dt className=\"text-muted-foreground\">Delivery</dt>\n            <dd className=\"text-right tabular-nums\">\n              {currency.format(deliveryFee)}\n            </dd>\n            <dt className=\"font-medium\">Total</dt>\n            <dd className=\"text-right font-medium tabular-nums\">\n              {currency.format(subtotal + deliveryFee)}\n            </dd>\n          </dl>\n        </SheetBody>\n        <SheetFooter>\n          <SheetClose\n            intent=\"primary\"\n            className=\"w-full\"\n            isDisabled={itemCount === 0}\n          >\n            Place order\n          </SheetClose>\n        </SheetFooter>\n      </SheetContent>\n    </Sheet>\n  )\n}\n",
      "type": "registry:example"
    }
  ],
  "type": "registry:example"
}