{ "$schema": "https://ui.shadcn.com/schema/registry-item.json", "name": "cart-drawer", "title": "Cart Drawer", "description": "Accessible slide-over cart built on Radix Dialog, with line items and summary.", "dependencies": [ "@radix-ui/react-dialog", "lucide-react", "tw-animate-css" ], "registryDependencies": [ "https://lumo-www.vercel.app/r/lib.json", "https://lumo-www.vercel.app/r/cart-line-item.json", "https://lumo-www.vercel.app/r/cart-summary.json" ], "files": [ { "path": "packages/core/src/components/lumo/cart-drawer.tsx", "content": "\"use client\"\r\n\r\nimport * as React from \"react\"\r\nimport * as DialogPrimitive from \"@radix-ui/react-dialog\"\r\nimport { ShoppingBag, X } from \"lucide-react\"\r\nimport type { CartLine, Money } from \"@/lib/lumo/types\"\r\n\r\nimport { cn } from \"@/lib/utils\"\r\nimport { CartLineItem } from \"@/components/lumo/cart-line-item\"\r\nimport { CartSummary } from \"@/components/lumo/cart-summary\"\r\n\r\nexport interface CartDrawerProps {\r\n open?: boolean\r\n onOpenChange?: (open: boolean) => void\r\n lines: CartLine[]\r\n subtotal: Money\r\n total?: Money\r\n onQuantityChange?: (lineId: string, quantity: number) => void\r\n onRemove?: (lineId: string) => void\r\n onCheckout?: () => void\r\n locale?: string\r\n title?: string\r\n /** Element that opens the drawer, rendered as the dialog trigger. */\r\n trigger?: React.ReactNode\r\n emptyState?: React.ReactNode\r\n className?: string\r\n}\r\n\r\nfunction CartDrawer({\r\n open,\r\n onOpenChange,\r\n lines,\r\n subtotal,\r\n total,\r\n onQuantityChange,\r\n onRemove,\r\n onCheckout,\r\n locale,\r\n title = \"Your cart\",\r\n trigger,\r\n emptyState,\r\n className,\r\n}: CartDrawerProps) {\r\n return (\r\n \r\n {trigger && {trigger}}\r\n \r\n \r\n \r\n
\r\n \r\n \r\n {title}\r\n \r\n \r\n \r\n \r\n
\r\n\r\n \r\n Items in your shopping cart\r\n \r\n\r\n {lines.length === 0 ? (\r\n
\r\n {emptyState ?? (\r\n <>\r\n \r\n

Your cart is empty.

\r\n \r\n )}\r\n
\r\n ) : (\r\n
\r\n {lines.map((line) => (\r\n \r\n ))}\r\n
\r\n )}\r\n\r\n {lines.length > 0 && (\r\n
\r\n \r\n
\r\n )}\r\n \r\n
\r\n
\r\n )\r\n}\r\nCartDrawer.displayName = \"CartDrawer\"\r\n\r\nexport { CartDrawer }\r\n", "type": "registry:ui", "target": "components/lumo/cart-drawer.tsx" } ], "type": "registry:ui" }