{"$schema":"https://ui.shadcn.com/schema/registry-item.json","name":"ecommerce-ecommerce-bundle-upsells-side-by-side","type":"registry:block","title":"Side By Side","files":[{"path":"components/blocks/ecommerce/ecommerce-bundle-upsells/side-by-side.tsx","content":"import { useState } from 'react';\nimport { Card, CardContent } from '@/components/ui/card';\nimport { Checkbox } from '@/components/ui/checkbox';\nimport { Button } from '@/components/ui/button';\nimport { Badge } from '@/components/ui/badge';\n\ninterface AddOn {\n  id: string;\n  name: string;\n  price: number;\n  originalPrice?: number;\n  image: string;\n  description: string;\n}\n\ninterface UpsellBundleProps {\n  mainProduct: {\n    name: string;\n    price: number;\n    image: string;\n    description: string;\n  };\n  addOns: AddOn[];\n  bundleDiscount?: number;\n}\n\nexport default function UpsellBundleSideBySide({\n  mainProduct = {\n    name: 'Premium Wireless Headphones',\n    price: 199.99,\n    image: '/placeholder.svg?height=300&width=300',\n    description:\n      'High-quality noise-canceling headphones with 30-hour battery life',\n  },\n  addOns = [\n    {\n      id: 'case',\n      name: 'Premium Carrying Case',\n      price: 29.99,\n      originalPrice: 39.99,\n      image: '/placeholder.svg?height=120&width=120',\n      description: 'Protective hard case with custom foam insert',\n    },\n    {\n      id: 'cable',\n      name: 'USB-C Charging Cable (3ft)',\n      price: 19.99,\n      originalPrice: 24.99,\n      image: '/placeholder.svg?height=120&width=120',\n      description: 'Fast charging cable with premium braided design',\n    },\n    {\n      id: 'stand',\n      name: 'Desktop Headphone Stand',\n      price: 34.99,\n      originalPrice: 44.99,\n      image: '/placeholder.svg?height=120&width=120',\n      description: 'Elegant aluminum stand with cable management',\n    },\n  ],\n  bundleDiscount = 15,\n}: UpsellBundleProps) {\n  const [selectedAddOns, setSelectedAddOns] = useState<string[]>([]);\n\n  const handleAddOnToggle = (addOnId: string) => {\n    setSelectedAddOns((prev) =>\n      prev.includes(addOnId)\n        ? prev.filter((id) => id !== addOnId)\n        : [...prev, addOnId]\n    );\n  };\n\n  const selectedAddOnItems = addOns.filter((addOn) =>\n    selectedAddOns.includes(addOn.id)\n  );\n  const addOnsTotal = selectedAddOnItems.reduce(\n    (sum, addOn) => sum + addOn.price,\n    0\n  );\n  const subtotal = mainProduct.price + addOnsTotal;\n  const discount =\n    selectedAddOns.length > 0 ? (subtotal * bundleDiscount) / 100 : 0;\n  const bundleTotal = subtotal - discount;\n  const totalSavings =\n    selectedAddOnItems.reduce(\n      (sum, addOn) =>\n        sum + (addOn.originalPrice ? addOn.originalPrice - addOn.price : 0),\n      0\n    ) + discount;\n\n  return (\n    <div className=\"mx-auto max-w-6xl space-y-6 px-4 py-8 md:py-12\">\n      <div className=\"space-y-2 px-2 text-center\">\n        <h2 className=\"text-xl font-bold sm:text-2xl\">Complete Your Setup</h2>\n        <p className=\"text-muted-foreground text-sm\">\n          Add these recommended items and save {bundleDiscount}% on your bundle\n        </p>\n      </div>\n\n      <div className=\"grid gap-8 lg:grid-cols-2\">\n        {/* Main Product */}\n        <Card className=\"h-fit\">\n          <CardContent className=\"p-4 sm:p-6\">\n            <div className=\"space-y-4\">\n              <div className=\"bg-muted relative aspect-square overflow-hidden rounded-lg\">\n                <img\n                  src={mainProduct.image || '/placeholder.svg'}\n                  alt={mainProduct.name}\n                  className=\"object-cover\"\n                />\n              </div>\n              <div className=\"space-y-2\">\n                <h3 className=\"text-lg font-semibold sm:text-xl\">\n                  {mainProduct.name}\n                </h3>\n                <p className=\"text-muted-foreground text-xs sm:text-sm\">\n                  {mainProduct.description}\n                </p>\n                <div className=\"text-xl font-bold sm:text-2xl\">\n                  ${mainProduct.price.toFixed(2)}\n                </div>\n              </div>\n            </div>\n          </CardContent>\n        </Card>\n\n        {/* Add-ons */}\n        <div className=\"space-y-4\">\n          <h3 className=\"text-lg font-semibold\">Recommended Add-ons</h3>\n          <div className=\"space-y-3\">\n            {addOns.map((addOn) => (\n              <Card\n                key={addOn.id}\n                className=\"hover:bg-muted/50 transition-colors\"\n              >\n                <CardContent className=\"p-3 sm:p-4\">\n                  <div className=\"flex items-start space-x-2 sm:space-x-4\">\n                    <Checkbox\n                      id={addOn.id}\n                      checked={selectedAddOns.includes(addOn.id)}\n                      onCheckedChange={() => handleAddOnToggle(addOn.id)}\n                      className=\"mt-1 h-5 w-5\"\n                    />\n                    <div className=\"flex-shrink-0\">\n                      <div className=\"bg-muted relative h-12 w-12 overflow-hidden rounded-md sm:h-16 sm:w-16\">\n                        <img\n                          src={addOn.image || '/placeholder.svg'}\n                          alt={addOn.name}\n                          className=\"object-cover\"\n                        />\n                      </div>\n                    </div>\n                    <div className=\"min-w-0 flex-1\">\n                      <label\n                        htmlFor={addOn.id}\n                        className=\"block cursor-pointer text-sm font-medium sm:text-base\"\n                      >\n                        {addOn.name}\n                      </label>\n                      <p className=\"text-muted-foreground mt-1 text-xs sm:text-sm\">\n                        {addOn.description}\n                      </p>\n                      <div className=\"mt-2 flex flex-wrap items-center gap-2\">\n                        <span className=\"font-semibold\">\n                          ${addOn.price.toFixed(2)}\n                        </span>\n                        {addOn.originalPrice && (\n                          <>\n                            <span className=\"text-muted-foreground text-xs line-through sm:text-sm\">\n                              ${addOn.originalPrice.toFixed(2)}\n                            </span>\n                            <Badge variant=\"secondary\" className=\"text-xs\">\n                              Save $\n                              {(addOn.originalPrice - addOn.price).toFixed(2)}\n                            </Badge>\n                          </>\n                        )}\n                      </div>\n                    </div>\n                  </div>\n                </CardContent>\n              </Card>\n            ))}\n          </div>\n        </div>\n      </div>\n\n      {/* Bundle Summary */}\n      <Card className=\"border-2\">\n        <CardContent className=\"p-4 sm:p-6\">\n          <div className=\"space-y-4\">\n            <h3 className=\"text-lg font-semibold\">Bundle Summary</h3>\n\n            <div className=\"space-y-2 text-sm\">\n              <div className=\"flex justify-between\">\n                <span className=\"pr-2\">{mainProduct.name}</span>\n                <span>${mainProduct.price.toFixed(2)}</span>\n              </div>\n              {selectedAddOnItems.map((addOn) => (\n                <div\n                  key={addOn.id}\n                  className=\"text-muted-foreground flex justify-between\"\n                >\n                  <span className=\"pr-2\">{addOn.name}</span>\n                  <span>${addOn.price.toFixed(2)}</span>\n                </div>\n              ))}\n              {selectedAddOns.length > 0 && (\n                <>\n                  <div className=\"border-t pt-2\">\n                    <div className=\"flex justify-between\">\n                      <span>Subtotal</span>\n                      <span>${subtotal.toFixed(2)}</span>\n                    </div>\n                    <div className=\"flex justify-between text-green-600\">\n                      <span>Bundle Discount ({bundleDiscount}%)</span>\n                      <span>-${discount.toFixed(2)}</span>\n                    </div>\n                  </div>\n                </>\n              )}\n            </div>\n\n            <div className=\"border-t pt-4\">\n              <div className=\"flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between\">\n                <div>\n                  <div className=\"text-xl font-bold sm:text-2xl\">\n                    ${bundleTotal.toFixed(2)}\n                  </div>\n                  {totalSavings > 0 && (\n                    <div className=\"text-sm text-green-600\">\n                      Total savings: ${totalSavings.toFixed(2)}\n                    </div>\n                  )}\n                </div>\n                <Button\n                  size=\"lg\"\n                  className=\"w-full sm:w-auto sm:min-w-[140px]\"\n                  disabled={selectedAddOns.length === 0}\n                >\n                  {selectedAddOns.length === 0\n                    ? 'Select Add-ons'\n                    : 'Add Bundle to Cart'}\n                </Button>\n              </div>\n            </div>\n          </div>\n        </CardContent>\n      </Card>\n    </div>\n  );\n}\n","type":"registry:component","target":"components/blocks/ecommerce/ecommerce-bundle-upsells/side-by-side.tsx"},{"path":"components/ui/card.tsx","content":"import * as React from \"react\"\n\nimport { cn } from \"@/lib/utils\"\n\nfunction Card({\n  className,\n  size = \"default\",\n  ...props\n}: React.ComponentProps<\"div\"> & { size?: \"default\" | \"sm\" }) {\n  return (\n    <div\n      data-slot=\"card\"\n      data-size={size}\n      className={cn(\n        \"group/card flex flex-col gap-6 overflow-hidden rounded-xl bg-card py-6 text-sm text-card-foreground shadow-xs ring-1 ring-foreground/10 has-[>img:first-child]:pt-0 data-[size=sm]:gap-4 data-[size=sm]:py-4 *:[img:first-child]:rounded-t-xl *:[img:last-child]:rounded-b-xl\",\n        className\n      )}\n      {...props}\n    />\n  )\n}\n\nfunction CardHeader({ className, ...props }: React.ComponentProps<\"div\">) {\n  return (\n    <div\n      data-slot=\"card-header\"\n      className={cn(\n        \"group/card-header @container/card-header grid auto-rows-min items-start gap-1 rounded-t-xl px-6 group-data-[size=sm]/card:px-4 has-data-[slot=card-action]:grid-cols-[1fr_auto] has-data-[slot=card-description]:grid-rows-[auto_auto] [.border-b]:pb-6 group-data-[size=sm]/card:[.border-b]:pb-4\",\n        className\n      )}\n      {...props}\n    />\n  )\n}\n\nfunction CardTitle({ className, ...props }: React.ComponentProps<\"div\">) {\n  return (\n    <div\n      data-slot=\"card-title\"\n      className={cn(\n        \"font-heading text-base leading-normal font-medium group-data-[size=sm]/card:text-sm\",\n        className\n      )}\n      {...props}\n    />\n  )\n}\n\nfunction CardDescription({ className, ...props }: React.ComponentProps<\"div\">) {\n  return (\n    <div\n      data-slot=\"card-description\"\n      className={cn(\"text-sm text-muted-foreground\", className)}\n      {...props}\n    />\n  )\n}\n\nfunction CardAction({ className, ...props }: React.ComponentProps<\"div\">) {\n  return (\n    <div\n      data-slot=\"card-action\"\n      className={cn(\n        \"col-start-2 row-span-2 row-start-1 self-start justify-self-end\",\n        className\n      )}\n      {...props}\n    />\n  )\n}\n\nfunction CardContent({ className, ...props }: React.ComponentProps<\"div\">) {\n  return (\n    <div\n      data-slot=\"card-content\"\n      className={cn(\"px-6 group-data-[size=sm]/card:px-4\", className)}\n      {...props}\n    />\n  )\n}\n\nfunction CardFooter({ className, ...props }: React.ComponentProps<\"div\">) {\n  return (\n    <div\n      data-slot=\"card-footer\"\n      className={cn(\n        \"flex items-center rounded-b-xl px-6 group-data-[size=sm]/card:px-4 [.border-t]:pt-6 group-data-[size=sm]/card:[.border-t]:pt-4\",\n        className\n      )}\n      {...props}\n    />\n  )\n}\n\nexport {\n  Card,\n  CardHeader,\n  CardFooter,\n  CardTitle,\n  CardAction,\n  CardDescription,\n  CardContent,\n}\n","type":"registry:ui","target":"components/ui/card.tsx"},{"path":"components/ui/checkbox.tsx","content":"\"use client\"\n\nimport * as React from \"react\"\nimport { Checkbox as CheckboxPrimitive } from \"radix-ui\"\n\nimport { cn } from \"@/lib/utils\"\nimport { CheckIcon } from \"lucide-react\"\n\nfunction Checkbox({\n  className,\n  ...props\n}: React.ComponentProps<typeof CheckboxPrimitive.Root>) {\n  return (\n    <CheckboxPrimitive.Root\n      data-slot=\"checkbox\"\n      className={cn(\n        \"peer relative flex size-4 shrink-0 items-center justify-center rounded-[4px] border border-input shadow-xs transition-shadow outline-none group-has-disabled/field:opacity-50 after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 aria-invalid:aria-checked:border-primary dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:border-primary data-checked:bg-primary data-checked:text-primary-foreground dark:data-checked:bg-primary\",\n        className\n      )}\n      {...props}\n    >\n      <CheckboxPrimitive.Indicator\n        data-slot=\"checkbox-indicator\"\n        className=\"grid place-content-center text-current transition-none [&>svg]:size-3.5\"\n      >\n        <CheckIcon\n        />\n      </CheckboxPrimitive.Indicator>\n    </CheckboxPrimitive.Root>\n  )\n}\n\nexport { Checkbox }\n","type":"registry:ui","target":"components/ui/checkbox.tsx"},{"path":"components/ui/button.tsx","content":"import * as React from \"react\"\nimport { cva, type VariantProps } from \"class-variance-authority\"\nimport { Slot } from \"radix-ui\"\n\nimport { cn } from \"@/lib/utils\"\n\nconst buttonVariants = cva(\n  \"group/button inline-flex shrink-0 items-center justify-center rounded-md border border-transparent bg-clip-padding text-sm font-medium whitespace-nowrap transition-all outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 active:not-aria-[haspopup]:translate-y-px disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4\",\n  {\n    variants: {\n      variant: {\n        default: \"bg-primary text-primary-foreground hover:bg-primary/80\",\n        outline:\n          \"border-border bg-background shadow-xs hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50\",\n        secondary:\n          \"bg-secondary text-secondary-foreground hover:bg-secondary/80 aria-expanded:bg-secondary aria-expanded:text-secondary-foreground\",\n        ghost:\n          \"hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:hover:bg-muted/50\",\n        destructive:\n          \"bg-destructive/10 text-destructive hover:bg-destructive/20 focus-visible:border-destructive/40 focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:hover:bg-destructive/30 dark:focus-visible:ring-destructive/40\",\n        link: \"text-primary underline-offset-4 hover:underline\",\n      },\n      size: {\n        default:\n          \"h-9 gap-1.5 px-2.5 in-data-[slot=button-group]:rounded-md has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2\",\n        xs: \"h-6 gap-1 rounded-[min(var(--radius-md),8px)] px-2 text-xs in-data-[slot=button-group]:rounded-md has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3\",\n        sm: \"h-8 gap-1 rounded-[min(var(--radius-md),10px)] px-2.5 in-data-[slot=button-group]:rounded-md has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5\",\n        lg: \"h-10 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2\",\n        icon: \"size-9\",\n        \"icon-xs\":\n          \"size-6 rounded-[min(var(--radius-md),8px)] in-data-[slot=button-group]:rounded-md [&_svg:not([class*='size-'])]:size-3\",\n        \"icon-sm\":\n          \"size-8 rounded-[min(var(--radius-md),10px)] in-data-[slot=button-group]:rounded-md\",\n        \"icon-lg\": \"size-10\",\n      },\n    },\n    defaultVariants: {\n      variant: \"default\",\n      size: \"default\",\n    },\n  }\n)\n\nfunction Button({\n  className,\n  variant = \"default\",\n  size = \"default\",\n  asChild = false,\n  ...props\n}: React.ComponentProps<\"button\"> &\n  VariantProps<typeof buttonVariants> & {\n    asChild?: boolean\n  }) {\n  const Comp = asChild ? Slot.Root : \"button\"\n\n  return (\n    <Comp\n      data-slot=\"button\"\n      data-variant={variant}\n      data-size={size}\n      className={cn(buttonVariants({ variant, size, className }))}\n      {...props}\n    />\n  )\n}\n\nexport { Button, buttonVariants }\n","type":"registry:ui","target":"components/ui/button.tsx"},{"path":"components/ui/badge.tsx","content":"import * as React from \"react\"\nimport { cva, type VariantProps } from \"class-variance-authority\"\nimport { Slot } from \"radix-ui\"\n\nimport { cn } from \"@/lib/utils\"\n\nconst badgeVariants = cva(\n  \"group/badge inline-flex h-5 w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-4xl border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-all focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none [&>svg]:size-3!\",\n  {\n    variants: {\n      variant: {\n        default: \"bg-primary text-primary-foreground [a]:hover:bg-primary/80\",\n        secondary:\n          \"bg-secondary text-secondary-foreground [a]:hover:bg-secondary/80\",\n        destructive:\n          \"bg-destructive/10 text-destructive focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:focus-visible:ring-destructive/40 [a]:hover:bg-destructive/20\",\n        outline:\n          \"border-border text-foreground [a]:hover:bg-muted [a]:hover:text-muted-foreground\",\n        ghost:\n          \"hover:bg-muted hover:text-muted-foreground dark:hover:bg-muted/50\",\n        link: \"text-primary underline-offset-4 hover:underline\",\n      },\n    },\n    defaultVariants: {\n      variant: \"default\",\n    },\n  }\n)\n\nfunction Badge({\n  className,\n  variant = \"default\",\n  asChild = false,\n  ...props\n}: React.ComponentProps<\"span\"> &\n  VariantProps<typeof badgeVariants> & { asChild?: boolean }) {\n  const Comp = asChild ? Slot.Root : \"span\"\n\n  return (\n    <Comp\n      data-slot=\"badge\"\n      data-variant={variant}\n      className={cn(badgeVariants({ variant }), className)}\n      {...props}\n    />\n  )\n}\n\nexport { Badge, badgeVariants }\n","type":"registry:ui","target":"components/ui/badge.tsx"}],"description":"Two product cards placed next to each other with a plus sign and combined price. Use it to pair complementary items and lift the average order total.","dependencies":["class-variance-authority","lucide-react","radix-ui"]}