{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "uptime-bars",
  "title": "Uptime Bars",
  "type": "registry:component",
  "description": "90-day status bars that rise in, with a per-day tooltip",
  "dependencies": [
    "motion@^12.43.0"
  ],
  "files": [
    {
      "path": "src/kavyn/uptime-bars.jsx",
      "type": "registry:file",
      "target": "@components/kavyn/uptime-bars.jsx",
      "content": "'use client'\n\nimport { useMemo, useState } from 'react'\nimport { motion, AnimatePresence } from 'motion/react'\n\nconst seed = (n) => { let s = n; return () => ((s = (s * 16807) % 2147483647) / 2147483647) }\n\n// 90-day status history. Bars rise in, hover (or tap) a day for details.\nexport default function UptimeBars({ service = 'API · Global', days = 90, incidents = [18, 57, 58] }) {\n  const [hover, setHover] = useState(null)\n  const data = useMemo(() => {\n    const r = seed(7)\n    return Array.from({ length: days }, (_, i) => {\n      const bad = incidents.includes(i)\n      const up = bad ? 96 + r() * 2.5 : 99.9 + r() * 0.1\n      return { i, up, state: bad ? (up < 97.5 ? 'down' : 'degraded') : 'ok' }\n    })\n  }, [days, incidents])\n  const avg = data.reduce((s, d) => s + d.up, 0) / Math.max(1, data.length)\n  const tone = { ok: 'bg-emerald-400/80', degraded: 'bg-amber-400', down: 'bg-rose-500' }\n  const d = hover !== null ? data[hover] : null\n  return (\n    <div className=\"w-[420px] max-w-full rounded-2xl border border-line bg-panel p-4\">\n      <div className=\"flex items-center justify-between text-sm\">\n        <span className=\"flex items-center gap-2 text-tx\"><span className=\"size-1.5 rounded-full bg-emerald-400 shadow-[0_0_8px] shadow-emerald-400\" />{service}</span>\n        <span className=\"font-mono text-xs text-mute\">{avg.toFixed(3)}% uptime</span>\n      </div>\n      <div className=\"relative mt-4 flex h-9 items-end gap-[2px]\" onMouseLeave={() => setHover(null)}>\n        {data.map((x) => (\n          <motion.button\n            key={x.i} type=\"button\" aria-label={`Day ${x.i + 1}: ${x.up.toFixed(2)}%`}\n            onMouseEnter={() => setHover(x.i)} onFocus={() => setHover(x.i)} onClick={() => setHover(x.i)}\n            initial={{ scaleY: 0 }} animate={{ scaleY: hover === x.i ? 1.15 : 1 }}\n            transition={{ type: 'spring', stiffness: 500, damping: 30, delay: hover === null ? x.i * 0.006 : 0 }}\n            className={`h-full flex-1 origin-bottom rounded-[2px] ${tone[x.state]} ${hover !== null && hover !== x.i ? 'opacity-40' : ''}`}\n          />\n        ))}\n        <AnimatePresence>\n          {d && (\n            <motion.div key=\"tip\" initial={{ opacity: 0, y: 4 }} animate={{ opacity: 1, y: 0 }} exit={{ opacity: 0 }}\n              className=\"pointer-events-none absolute -top-11 z-10 -translate-x-1/2 whitespace-nowrap rounded-md border border-line2 bg-panel2 px-2 py-1 text-[11px] text-tx\"\n              style={{ left: `${((d.i + 0.5) / data.length) * 100}%` }}>\n              {days - d.i} days ago · <span className={d.state === 'ok' ? 'text-emerald-400' : d.state === 'degraded' ? 'text-amber-400' : 'text-rose-400'}>{d.up.toFixed(2)}%</span>\n            </motion.div>\n          )}\n        </AnimatePresence>\n      </div>\n      <div className=\"mt-2 flex justify-between font-mono text-[10px] text-faint\"><span>{days} days ago</span><span>Today</span></div>\n    </div>\n  )\n}\n"
    }
  ],
  "cssVars": {
    "theme": {
      "color-bg": "var(--bg)",
      "color-panel": "var(--panel)",
      "color-panel2": "var(--panel2)",
      "color-line": "var(--line)",
      "color-line2": "var(--line2)",
      "color-tx": "var(--tx)",
      "color-mute": "var(--mute)",
      "color-faint": "var(--faint)",
      "color-acc": "var(--acc)",
      "color-acc-fg": "var(--acc-fg)"
    },
    "light": {
      "bg": "#ffffff",
      "panel": "#f5f5f7",
      "panel2": "#e8e8ed",
      "line": "#e5e5ea",
      "line2": "#d2d2d7",
      "tx": "#1d1d1f",
      "mute": "#6e6e73",
      "faint": "#a1a1a6",
      "acc": "#1d1d1f",
      "acc-fg": "#ffffff"
    },
    "dark": {
      "bg": "#000000",
      "panel": "#141416",
      "panel2": "#1f1f22",
      "line": "#262628",
      "line2": "#3a3a3d",
      "tx": "#f5f5f7",
      "mute": "#a1a1a6",
      "faint": "#6e6e73",
      "acc": "#f5f5f7",
      "acc-fg": "#000000"
    }
  },
  "css": {
    ".light": {
      "--bg": "#ffffff",
      "--panel": "#f5f5f7",
      "--panel2": "#e8e8ed",
      "--line": "#e5e5ea",
      "--line2": "#d2d2d7",
      "--tx": "#1d1d1f",
      "--mute": "#6e6e73",
      "--faint": "#a1a1a6",
      "--acc": "#1d1d1f",
      "--acc-fg": "#ffffff"
    }
  }
}
