{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "progress-rings",
  "type": "registry:component",
  "title": "Progress Rings",
  "description": "Concentric activity rings with rounded gradient strokes, an animated sweep, a center slot and a legend with value and goal.",
  "author": "Hyperblur <hello@hyperblur.dev>",
  "dependencies": [],
  "registryDependencies": [],
  "categories": [
    "charts",
    "rings",
    "progress",
    "activity",
    "goals",
    "fitness",
    "gradient"
  ],
  "docs": "https://hyperblur.dev/effects/progress-rings",
  "files": [
    {
      "path": "registry/hyperblur/progress-rings.tsx",
      "type": "registry:component",
      "target": "components/hyperblur/progress-rings.tsx",
      "content": "\"use client\";\n\nimport * as React from \"react\";\n\nexport interface ProgressRing {\n  label: string;\n  value: number;\n  goal: number;\n  unit?: string;\n  color?: string;\n  color2?: string;\n}\n\nexport interface ProgressRingsProps extends React.HTMLAttributes<HTMLDivElement> {\n  rings?: ProgressRing[];\n  size?: number;\n  thickness?: number;\n  colors?: string[];\n  showLegend?: boolean;\n  animate?: boolean;\n}\n\nconst PALETTE = [\"#fb7185\", \"#34d399\", \"#2f7bff\", \"#fbbf24\", \"#8b5cf6\", \"#7fb3ff\"];\n\nconst DEFAULT_RINGS: ProgressRing[] = [\n  { label: \"Move\", value: 486, goal: 600, unit: \"kcal\" },\n  { label: \"Exercise\", value: 24, goal: 30, unit: \"min\" },\n  { label: \"Stand\", value: 9, goal: 12, unit: \"h\" },\n];\n\nconst css = `\n.hb-prg { display: block; width: 100%; min-width: 0; box-sizing: border-box; container-type: inline-size; color: #ededed; font-family: inherit; }\n.hb-prg *, .hb-prg *::before, .hb-prg *::after { box-sizing: border-box; }\n.hb-prg-in { display: flex; align-items: center; justify-content: center; gap: 18px; min-width: 0; }\n.hb-prg-wrap { position: relative; flex: none; }\n.hb-prg-svg { display: block; overflow: visible; }\n.hb-prg-track { fill: none; transition: opacity .2s ease; }\n.hb-prg-arc {\n  fill: none;\n  stroke-linecap: round;\n  animation: hb-prg-sweep 1.2s cubic-bezier(.22, .8, .24, 1) backwards;\n  animation-delay: calc(var(--hb-prg-i, 0) * 160ms);\n  transition: opacity .2s ease;\n}\n.hb-prg-ring[data-dim=\"true\"] .hb-prg-arc,\n.hb-prg-ring[data-dim=\"true\"] .hb-prg-track { opacity: .3; }\n.hb-prg-ring { cursor: pointer; }\n.hb-prg-center {\n  position: absolute;\n  inset: 0;\n  display: flex;\n  align-items: center;\n  justify-content: center;\n  text-align: center;\n}\n.hb-prg-list { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1 1 auto; max-width: 240px; margin: 0; padding: 0; list-style: none; }\n.hb-prg-row {\n  display: grid;\n  grid-template-columns: auto minmax(0, 1fr) auto;\n  align-items: center;\n  column-gap: 9px;\n  width: 100%;\n  padding: 5px 8px;\n  border: 0;\n  border-radius: 8px;\n  background: transparent;\n  color: inherit;\n  font: inherit;\n  text-align: left;\n  cursor: pointer;\n  transition: background-color .15s ease, opacity .2s ease;\n}\n.hb-prg-row[data-on=\"true\"] { background: #1a1a1a; }\n.hb-prg-row[data-dim=\"true\"] { opacity: .5; }\n.hb-prg-row:focus-visible { outline: 2px solid #7fb3ff; outline-offset: 1px; }\n.hb-prg-dot { width: 8px; height: 8px; border-radius: 3px; }\n.hb-prg-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; line-height: 1.3; }\n.hb-prg-pct {\n  grid-column: 3;\n  grid-row: 1;\n  font-size: 12px;\n  font-weight: 600;\n  font-variant-numeric: tabular-nums;\n}\n.hb-prg-fig {\n  grid-column: 2 / 4;\n  grid-row: 2;\n  overflow: hidden;\n  text-overflow: ellipsis;\n  white-space: nowrap;\n  color: #8f8f8f;\n  font-size: 11px;\n  line-height: 1.3;\n  font-family: var(--font-mono, ui-monospace, SFMono-Regular, Menlo, monospace);\n  font-variant-numeric: tabular-nums;\n}\n.hb-prg-fig b { color: #ededed; font-weight: 500; }\n.hb-prg[data-animate=\"false\"] .hb-prg-arc { animation: none; }\n@keyframes hb-prg-sweep {\n  from { stroke-dasharray: 0 100; }\n}\n@container (max-width: 300px) {\n  .hb-prg-in { flex-direction: column; gap: 12px; }\n  .hb-prg-list { width: 100%; max-width: none; flex: none; }\n}\n@media (prefers-reduced-motion: reduce) {\n  .hb-prg-arc { animation: none !important; }\n  .hb-prg-arc, .hb-prg-track, .hb-prg-row { transition: none !important; }\n}\n`;\n\nfunction f(n: number) {\n  return n.toFixed(2);\n}\n\nfunction lighten(hex: string, amount: number) {\n  const m = /^#([0-9a-f]{6})$/i.exec(hex.trim());\n  if (!m) return hex;\n  const v = parseInt(m[1], 16);\n  const mix = (c: number) => Math.round(c + (255 - c) * amount);\n  const r = mix((v >> 16) & 255);\n  const g = mix((v >> 8) & 255);\n  const b = mix(v & 255);\n  return `#${((1 << 24) | (r << 16) | (g << 8) | b).toString(16).slice(1)}`;\n}\n\nconst nf = new Intl.NumberFormat(\"en-US\", { maximumFractionDigits: 1 });\n\nexport function ProgressRings({\n  rings = DEFAULT_RINGS,\n  size = 150,\n  thickness = 14,\n  colors = PALETTE,\n  showLegend = true,\n  animate = true,\n  className = \"\",\n  children,\n  ...rest\n}: ProgressRingsProps) {\n  const uid = React.useId().replace(/[^a-zA-Z0-9]/g, \"\");\n  const [active, setActive] = React.useState<number | null>(null);\n\n  const list = rings.slice(0, 3).map((r, i) => {\n    const color = r.color ?? colors[i % colors.length];\n    const goal = r.goal > 0 ? r.goal : 1;\n    const value = Number.isFinite(r.value) ? Math.max(0, r.value) : 0;\n    return { ...r, i, color, color2: r.color2 ?? lighten(color, 0.4), goal, value, frac: Math.min(1, value / goal) };\n  });\n\n  const stroke = Math.max(4, Math.min(thickness, size / 8));\n  const gap = Math.max(2, Math.round(stroke * 0.3));\n  const cx = size / 2;\n  const outer = size / 2 - stroke / 2 - 2;\n\n  const summary = list.length\n    ? `Progress rings. ${list\n        .map((r) => `${r.label} ${nf.format(r.value)} of ${nf.format(r.goal)}${r.unit ? ` ${r.unit}` : \"\"}, ${Math.round(r.frac * 100)} percent`)\n        .join(\". \")}.`\n    : \"Progress rings with no data\";\n\n  const innerSize = Math.max(0, (outer - (list.length - 1) * (stroke + gap) - stroke / 2) * 2 - 6);\n\n  return (\n    <div className={`hb-prg ${className}`} data-animate={animate ? \"true\" : \"false\"} {...rest}>\n      <style href=\"hb-progress-rings\" precedence=\"default\">{css}</style>\n      <div className=\"hb-prg-in\">\n        <div className=\"hb-prg-wrap\" style={{ width: size, height: size }} onMouseLeave={() => setActive(null)}>\n          <svg className=\"hb-prg-svg\" width={size} height={size} viewBox={`0 0 ${size} ${size}`} role=\"img\" aria-label={summary}>\n            <defs>\n              {list.map((r) => (\n                <linearGradient key={r.i} id={`hb-prg-${uid}-${r.i}`} x1=\"0\" y1=\"0\" x2=\"1\" y2=\"1\">\n                  <stop offset=\"0%\" stopColor={r.color} />\n                  <stop offset=\"100%\" stopColor={r.color2} />\n                </linearGradient>\n              ))}\n            </defs>\n            <g transform={`rotate(-90 ${f(cx)} ${f(cx)})`}>\n              {list.map((r) => {\n                const radius = outer - r.i * (stroke + gap);\n                return (\n                  <g\n                    key={r.i}\n                    className=\"hb-prg-ring\"\n                    data-dim={active !== null && active !== r.i ? \"true\" : \"false\"}\n                    onMouseEnter={() => setActive(r.i)}\n                  >\n                    <circle\n                      className=\"hb-prg-track\"\n                      cx={f(cx)}\n                      cy={f(cx)}\n                      r={f(radius)}\n                      stroke={r.color}\n                      strokeOpacity={0.16}\n                      strokeWidth={stroke}\n                    />\n                    {r.frac > 0 ? (\n                      <circle\n                        className=\"hb-prg-arc\"\n                        cx={f(cx)}\n                        cy={f(cx)}\n                        r={f(radius)}\n                        pathLength={100}\n                        stroke={`url(#hb-prg-${uid}-${r.i})`}\n                        strokeWidth={stroke}\n                        strokeDasharray={`${f(r.frac * 100)} 100`}\n                        style={{ [\"--hb-prg-i\" as string]: r.i }}\n                      />\n                    ) : null}\n                  </g>\n                );\n              })}\n            </g>\n          </svg>\n          {children ? (\n            <div className=\"hb-prg-center\">\n              <div style={{ maxWidth: innerSize, maxHeight: innerSize }}>{children}</div>\n            </div>\n          ) : null}\n        </div>\n        {showLegend ? (\n          <ul className=\"hb-prg-list\">\n            {list.map((r) => (\n              <li\n                key={r.i}\n                className=\"hb-prg-row\"\n                tabIndex={0}\n                data-on={active === r.i ? \"true\" : \"false\"}\n                data-dim={active !== null && active !== r.i ? \"true\" : \"false\"}\n                onMouseEnter={() => setActive(r.i)}\n                onMouseLeave={() => setActive(null)}\n                onFocus={() => setActive(r.i)}\n                onBlur={() => setActive(null)}\n              >\n                <span\n                  className=\"hb-prg-dot\"\n                  style={{ background: `linear-gradient(135deg, ${r.color}, ${r.color2})` }}\n                />\n                <span className=\"hb-prg-name\">{r.label}</span>\n                <span className=\"hb-prg-pct\">{Math.round((r.value / r.goal) * 100)}%</span>\n                <span className=\"hb-prg-fig\">\n                  <b>{nf.format(r.value)}</b> / {nf.format(r.goal)}\n                  {r.unit ? ` ${r.unit}` : \"\"}\n                </span>\n              </li>\n            ))}\n          </ul>\n        ) : null}\n      </div>\n    </div>\n  );\n}\n"
    }
  ]
}