{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "gauge",
  "title": "Gauge",
  "description": "A ring that fills to a percentage. Red only past a limit you set.",
  "registryDependencies": [
    "https://creance.pages.dev/r/creance-base.json"
  ],
  "files": [
    {
      "path": "gauge/Gauge.css",
      "content": ".cr-gauge {\n  position: relative;\n  display: inline-grid;\n  place-items: center;\n  color: var(--cr-color-text-default);\n  font-family: var(--cr-font-family-sans);\n}\n\n.cr-gauge > svg {\n  position: absolute;\n  inset: 0;\n  width: 100%;\n  height: 100%;\n}\n\n.cr-gauge__track,\n.cr-gauge__fill {\n  fill: none;\n  stroke-width: 3.2;\n}\n\n.cr-gauge__track {\n  stroke: var(--cr-color-border-default);\n}\n\n.cr-gauge__fill {\n  stroke: var(--cr-color-ink-bg);\n  stroke-linecap: round;\n  transition: stroke-dasharray var(--cr-motion-duration-slow) var(--cr-motion-easing-spring);\n}\n\n.cr-gauge[data-over] {\n  color: var(--cr-color-status-failed-fg);\n}\n\n.cr-gauge[data-over] .cr-gauge__fill {\n  stroke: var(--cr-color-danger-text);\n}\n\n.cr-gauge__value {\n  font-size: 18px;\n  font-weight: var(--cr-font-weight-bold);\n  font-variant-numeric: tabular-nums;\n}\n",
      "type": "registry:file",
      "target": "@components/creance/gauge/Gauge.css"
    },
    {
      "path": "gauge/Gauge.tsx",
      "content": "import type { ReactNode } from 'react';\nimport { cx } from '@/lib/creance/cx';\nimport './Gauge.css';\n\nexport interface GaugeProps {\n  /** 0 to 100. */\n  value: number;\n  /** What it measures: \"Token budget used\". */\n  label: string;\n  /** Above this, the ring turns red. Leave it out to keep the ring ink. */\n  limit?: number;\n  /** Centre text. Defaults to the rounded percentage. */\n  children?: ReactNode;\n  size?: number;\n  className?: string;\n}\n\n/** A ring that fills to a percentage. Ink by default; red only past a limit you set. */\nexport function Gauge({ value, label, limit, children, size = 96, className }: GaugeProps) {\n  const v = Math.max(0, Math.min(100, value));\n  const over = limit !== undefined && v > limit;\n  const r = 15;\n  const c = 2 * Math.PI * r;\n  return (\n    <div\n      role=\"meter\"\n      aria-label={label}\n      aria-valuenow={Math.round(v)}\n      aria-valuemin={0}\n      aria-valuemax={100}\n      aria-valuetext={`${Math.round(v)}%${over ? ', over the limit' : ''}`}\n      className={cx('cr-gauge', className)}\n      data-over={over || undefined}\n      style={{ width: size, height: size }}\n    >\n      <svg viewBox=\"0 0 36 36\" aria-hidden=\"true\">\n        <circle className=\"cr-gauge__track\" cx=\"18\" cy=\"18\" r={r} />\n        <circle className=\"cr-gauge__fill\" cx=\"18\" cy=\"18\" r={r} strokeDasharray={`${(v / 100) * c} ${c}`} transform=\"rotate(-90 18 18)\" />\n      </svg>\n      <span className=\"cr-gauge__value\" aria-hidden=\"true\">\n        {children ?? `${Math.round(v)}%`}\n      </span>\n    </div>\n  );\n}\n",
      "type": "registry:ui",
      "target": "@components/creance/gauge/Gauge.tsx"
    }
  ],
  "categories": [
    "atom",
    "data-display"
  ],
  "type": "registry:ui"
}