{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "sparkline",
  "title": "Sparkline",
  "description": "A small SVG line chart of a numeric series with an optional dot on the last value.",
  "files": [
    {
      "path": "registry/tealmac/sparkline.tsx",
      "content": "// Adapted from Ballmac UI (https://github.com/vamsiy78/ballmac-ui), MIT License, Copyright (c) 2026 Ballmac.\n\"use client\"\n\nimport * as React from \"react\"\n\nimport { cn } from \"@/lib/utils\"\n\ntype SparklineProps = Omit<React.ComponentProps<\"svg\">, \"values\"> & {\n  /** Ordered numeric samples. */ values: number[]\n  /** Accessible description of the series. */ label: string\n  /** Height in pixels. */ height?: number\n  /** Show the last data point. */ showEnd?: boolean\n}\nfunction Sparkline({\n  className,\n  values,\n  label,\n  height = 48,\n  showEnd = true,\n  ...props\n}: SparklineProps) {\n  const safe = values.filter(Number.isFinite)\n  const minimum = Math.min(...safe)\n  const maximum = Math.max(...safe)\n  const span = maximum - minimum || 1\n  const points = safe.map((value, index) => ({\n    x: safe.length === 1 ? 50 : 4 + (index / (safe.length - 1)) * 92,\n    y: 42 - ((value - minimum) / span) * 34,\n  }))\n  const path = points\n    .map(\n      (point, index) =>\n        `${index ? \"L\" : \"M\"}${point.x.toFixed(2)} ${point.y.toFixed(2)}`\n    )\n    .join(\" \")\n  const last = points.at(-1)\n  return (\n    <svg\n      data-slot=\"sparkline\"\n      role=\"img\"\n      aria-label={\n        safe.length\n          ? `${label}: from ${safe[0]} to ${safe.at(-1) ?? \"\"}`\n          : `${label}: no data`\n      }\n      viewBox=\"0 0 100 48\"\n      preserveAspectRatio=\"none\"\n      height={height}\n      className={cn(\"text-primary w-full overflow-visible\", className)}\n      {...props}\n    >\n      {safe.length > 1 && (\n        <path\n          d={path}\n          fill=\"none\"\n          stroke=\"currentColor\"\n          strokeWidth=\"2.5\"\n          strokeLinecap=\"round\"\n          strokeLinejoin=\"round\"\n          vectorEffect=\"non-scaling-stroke\"\n        />\n      )}\n      {showEnd && last && (\n        // A zero-length round-capped stroke stays circular even though the\n        // viewBox is stretched (a <circle> would turn into an ellipse).\n        <path\n          data-slot=\"sparkline-end\"\n          d={`M${last.x.toFixed(2)} ${last.y.toFixed(2)}h0`}\n          fill=\"none\"\n          stroke=\"currentColor\"\n          strokeWidth=\"7\"\n          strokeLinecap=\"round\"\n          vectorEffect=\"non-scaling-stroke\"\n        />\n      )}\n    </svg>\n  )\n}\nexport { Sparkline, type SparklineProps }\n",
      "type": "registry:ui"
    }
  ],
  "type": "registry:ui"
}