{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "activity-rings",
  "title": "Activity Rings",
  "description": "Concentric progress rings, one per goal, in the style of a fitness watch.",
  "files": [
    {
      "path": "registry/dashboardcn/ui/activity-rings.tsx",
      "content": "\"use client\"\n\nimport * as React from \"react\"\n\nimport { cn } from \"@/lib/utils\"\n\nexport interface ActivityRing {\n  label: string\n  /** Progress toward `max`. Values past `max` draw a full ring. */\n  value: number\n  /** Goal for the ring. Defaults to 100. */\n  max?: number\n  /** Any CSS color. Defaults to chart-1 through chart-5 in order. */\n  color?: string\n}\n\nexport interface ActivityRingsProps\n  extends Omit<React.ComponentProps<\"div\">, \"children\"> {\n  /** Outermost ring first. */\n  rings: ActivityRing[]\n  /** Diameter in pixels. */\n  size?: number\n  /** Stroke width of each ring in pixels. */\n  thickness?: number\n  /** Space between rings in pixels. */\n  gap?: number\n  /** Opacity of the unfilled track, drawn in the ring's color. */\n  trackOpacity?: number\n  /** Ring drawn at full strength while the rest dim. `null` shows every ring. */\n  activeIndex?: number | null\n  onActiveIndexChange?: (index: number | null) => void\n  /** Content rendered in the middle. */\n  children?: React.ReactNode\n}\n\nconst defaultColors = [\n  \"var(--chart-1)\",\n  \"var(--chart-2)\",\n  \"var(--chart-3)\",\n  \"var(--chart-4)\",\n  \"var(--chart-5)\",\n]\n\n// Round so server and client render identical attributes.\nconst round = (n: number) => Math.round(n * 1000) / 1000\n\n/** Concentric progress rings, one per goal, in the style of a fitness watch. */\nfunction ActivityRings({\n  rings,\n  size = 160,\n  thickness = 12,\n  gap = 4,\n  trackOpacity = 0.2,\n  activeIndex: activeProp,\n  onActiveIndexChange,\n  className,\n  children,\n  ...props\n}: ActivityRingsProps) {\n  const [activeState, setActiveState] = React.useState<number | null>(null)\n  const active = activeProp === undefined ? activeState : activeProp\n  const setActive = (index: number | null) => {\n    setActiveState(index)\n    onActiveIndexChange?.(index)\n  }\n\n  const center = size / 2\n  const label = rings\n    .map((ring) => {\n      const max = ring.max ?? 100\n      return `${ring.label} ${Math.round((ring.value / (max || 1)) * 100)}%`\n    })\n    .join(\", \")\n\n  return (\n    <div\n      data-slot=\"activity-rings\"\n      className={cn(\"relative inline-flex shrink-0\", className)}\n      style={{ width: size, height: size }}\n      {...props}\n    >\n      <svg\n        width={size}\n        height={size}\n        viewBox={`0 0 ${size} ${size}`}\n        role=\"img\"\n        aria-label={label}\n        className=\"absolute inset-0 -rotate-90\"\n      >\n        {rings.map((ring, index) => {\n          const max = ring.max ?? 100\n          const fraction = Math.min(1, Math.max(0, ring.value / (max || 1)))\n          const r = center - thickness / 2 - index * (thickness + gap)\n          if (r <= 0) return null\n          const color = ring.color ?? defaultColors[index % defaultColors.length]\n          const dimmed = active !== null && active !== index\n          return (\n            <g\n              key={ring.label}\n              data-ring=\"\"\n              data-active={active === index || undefined}\n              onMouseEnter={() => setActive(index)}\n              onMouseLeave={() => setActive(null)}\n              className=\"transition-opacity duration-200\"\n              style={{ opacity: dimmed ? 0.35 : 1 }}\n            >\n              <circle\n                cx={center}\n                cy={center}\n                r={round(r)}\n                fill=\"none\"\n                stroke={color}\n                strokeOpacity={trackOpacity}\n                strokeWidth={thickness}\n              />\n              {fraction > 0 ? (\n                <circle\n                  cx={center}\n                  cy={center}\n                  r={round(r)}\n                  fill=\"none\"\n                  stroke={color}\n                  strokeWidth={thickness}\n                  strokeLinecap=\"round\"\n                  pathLength={1}\n                  strokeDasharray=\"1 1\"\n                  strokeDashoffset={round(1 - fraction)}\n                  className=\"transition-[stroke-dashoffset] duration-700 ease-out\"\n                />\n              ) : null}\n            </g>\n          )\n        })}\n      </svg>\n      {children ? (\n        <div className=\"pointer-events-none absolute inset-0 flex flex-col items-center justify-center text-center\">\n          {children}\n        </div>\n      ) : null}\n    </div>\n  )\n}\n\nexport { ActivityRings }\n",
      "type": "registry:ui"
    }
  ],
  "type": "registry:ui"
}