{"$schema":"https://ui.shadcn.com/schema/registry-item.json","name":"radial-bar-chart","title":"Radial Bar Chart","description":"Show progress toward a goal as a ring that fills, or compare a few measures as concentric rings against one maximum. Search terms: progress circle, progress ring, activity rings, gauge.","dependencies":[],"registryDependencies":["@siteplane/base","@siteplane/motion","@siteplane/chart"],"files":[{"path":"packages/ui/src/components/radial-bar-chart/radial-bar-chart.tsx","content":"\"use client\";\n\nimport * as React from \"react\";\n\nimport {\n  useFormatLocale,\n  useSiteplaneMessages,\n} from \"../../system/locale/messages-context\";\nimport { cn } from \"../../system/utils/cn\";\nimport { slotClass } from \"../../system/utils/slot-class\";\nimport { ChartEmptyState } from \"../chart/chart-cartesian\";\nimport {\n  CHART_DEFAULT_LOCALE,\n  chartFigureFormatter,\n  chartLabels,\n  chartNumberFormatter,\n} from \"../chart/chart-format\";\nimport { useChartInteraction } from \"../chart/chart-interaction\";\nimport { ChartLegend } from \"../chart/chart-legend\";\nimport { chartEmptyColor, chartPaletteColors } from \"../chart/chart-palette\";\nimport { chartCirclePath, ringCenterFit } from \"../chart/chart-ring\";\nimport { ChartTooltip, chartTooltipText } from \"../chart/chart-tooltip\";\nimport type { ChartLabels, ChartPalette } from \"../chart/chart-types\";\nimport { MotionNumber, useTweenedRows } from \"../motion\";\nimport {\n  RADIAL_BAR_CHART_SIZES,\n  RADIAL_LARGE_CAPTION_HOLE,\n  barAnchor,\n  barDash,\n  radialCenterLine,\n  radialCenterSteps,\n  radialLayout,\n  radialShare,\n  ringAtPoint,\n  type RadialBarChartSize,\n  type RadialCenterStep,\n} from \"./radial-geometry\";\n\nexport type { RadialBarChartSize } from \"./radial-geometry\";\n\nexport type RadialBarChartDatum = {\n  id: string;\n  label: string;\n  /** The value of the bar, drawn as its share of the chart's `max`. */\n  value: number;\n  /** A CSS colour or token. The chart's `palette` gives one for its place when omitted. */\n  color?: string;\n};\n\nexport type RadialBarChartProps = {\n  /**\n   * The bars, one ring each, from the outer ring inwards: the first bar is the\n   * outer ring and takes the first colour of the palette.\n   */\n  data: readonly RadialBarChartDatum[];\n  /** The accessible name of the chart. */\n  label: string;\n  /**\n   * The id of an element that describes the chart, read after what the chart\n   * gives assistive technology itself.\n   */\n  \"aria-describedby\"?: string;\n  /**\n   * The value of a full ring: every bar is drawn as its share of it, from 12\n   * o'clock clockwise. A value beyond it fills the ring, and one below 0 leaves\n   * it empty; the tooltip names the value itself. 100 by default.\n   */\n  max?: number;\n  /**\n   * The diameter of the outer ring, a size name (`xs` 176 px, `sm` 220 px, `md`\n   * 264 px, `lg` 308 px) or a number of px. The default is `sm`.\n   */\n  size?: number | RadialBarChartSize;\n  /**\n   * `brand` (the default) shades the brand colour from strong to light, spread\n   * over the number of bars (up to eight), the outer ring strongest;\n   * `categorical` gives each bar its own chart colour, `--chart-1` to\n   * `--chart-8` in order. Both start over from the ninth bar. A bar that names\n   * its `color` keeps it.\n   */\n  palette?: ChartPalette;\n  /** Writes a value in the tooltip and in what screen readers read for each bar. A number in the format of `locale` by default. */\n  formatValue?: (value: number) => string;\n  /** The locale of the numbers: the SiteplaneLocaleProvider's unless set, en-US without one. */\n  locale?: string;\n  /** Shown in the hole when there is no bar to draw. */\n  emptyLabel?: string;\n  /**\n   * Replaces words that the chart gives screen readers, merged with the\n   * English defaults: its role description and the keyboard hint.\n   */\n  labels?: Partial<ChartLabels> | undefined;\n  /**\n   * Content of your own in the hole, in place of `centerValue` and\n   * `centerLabel`. It is laid out in the square around the hole and cut off at\n   * the hole's edge, so it never covers a ring. It lies over the chart without\n   * taking the pointer and is not part of the chart's accessible name.\n   */\n  center?: React.ReactNode;\n  /**\n   * A figure in the hole, such as a share or a total, which the chart fits into\n   * the hole: in the largest text step the hole offers, from 48 px for a hole\n   * of 240 px down to 20 px for one of 96 px, or a smaller step it fits in, and\n   * in compact notation, such as 1.2M, when it does not fit in full. Screen\n   * readers read it in full. It rolls to a new value.\n   */\n  centerValue?: number;\n  /** A caption above `centerValue`, such as Active users: one line of muted text, 14 px in a hole of 150 px or more and 12 px in a smaller one, that ends in an ellipsis when the hole is too narrow for it. */\n  centerLabel?: string;\n  /** How `centerValue` is written, as Intl.NumberFormat options in `locale`, such as a percentage. The chart adds compact notation when the figure needs it. */\n  centerFormat?: Intl.NumberFormatOptions;\n  /**\n   * Lists the bars below the rings, each with its colour. On when there is more\n   * than one bar. Without it screen readers still read each bar and its value,\n   * as the description of the chart.\n   */\n  legend?: boolean;\n  /**\n   * Rolls the value in the tooltip to the next bar's, digit by digit\n   * (MotionNumber), as the other charts' `rollingNumbers` does. Off by\n   * default: it changes at once. `centerValue` rolls either way.\n   */\n  rollingNumbers?: boolean;\n  className?: string;\n};\n\n// The text classes of the steps of a figure in the hole, written whole for\n// Tailwind: the size of each step on the height of its line.\nconst figureStepClassName: Record<RadialCenterStep, string> = {\n  12: \"text-xs leading-4.5\",\n  14: \"text-sm leading-5\",\n  16: \"text-base leading-6\",\n  20: \"text-xl leading-7.5\",\n  24: \"text-2xl leading-8\",\n  30: \"text-3xl leading-9.5\",\n  36: \"text-4xl leading-11\",\n  48: \"text-5xl leading-15\",\n};\n\n// The figure keeps all its digits in the three largest steps its hole offers;\n// below them it is written compact first, as in the Pie Chart.\nconst fullSteps = 3;\n\n/**\n * A figure in the hole, with an optional caption above it: in the largest step\n * the hole offers that it fits in, in full or in compact notation, which the\n * chart picks from its size and the text alone (`ringCenterFit`), so that the\n * server and the client agree. A compact figure is read in full. The caption\n * stays on one line and ends in an ellipsis where the hole narrows (rulebook\n * K5).\n */\nfunction RadialCenterFigure({\n  caption,\n  format,\n  holeRadius,\n  locale,\n  value,\n}: {\n  caption: string | undefined;\n  format: Intl.NumberFormatOptions | undefined;\n  holeRadius: number;\n  locale: string;\n  value: number;\n}): React.ReactElement {\n  const full = chartFigureFormatter(locale, format)(value);\n  const short = chartFigureFormatter(locale, format, true)(value);\n  const largeCaption = holeRadius * 2 >= RADIAL_LARGE_CAPTION_HOLE;\n  const fit = ringCenterFit({\n    caption,\n    captionHeight: largeCaption ? 20 : 18,\n    compact: short,\n    figureHeight: radialCenterLine,\n    full,\n    fullSteps,\n    holeRadius,\n    steps: radialCenterSteps(holeRadius * 2),\n  });\n  const text = fit.compact ? short : full;\n  return (\n    <>\n      {caption ? (\n        <span\n          className={cn(\n            slotClass(\"radial-bar-chart-center-label\"),\n            \"truncate text-muted-foreground\",\n            largeCaption ? \"text-sm leading-5\" : \"text-xs leading-4.5\",\n          )}\n          data-slot=\"radial-bar-chart-center-label\"\n          style={{ maxWidth: `${fit.captionWidth}%` }}\n          title={caption}\n        >\n          {caption}\n        </span>\n      ) : null}\n      <span\n        className={cn(\n          slotClass(\"radial-bar-chart-center-value\"),\n          \"max-w-full font-(--sp-rw-font-weight-strong) tabular-nums\",\n          figureStepClassName[fit.size as RadialCenterStep],\n        )}\n        data-compact={fit.compact ? \"\" : undefined}\n        data-size={fit.size}\n        data-slot=\"radial-bar-chart-center-value\"\n      >\n        {text === full ? (\n          <MotionNumber value={text} />\n        ) : (\n          <>\n            <span className=\"sr-only\">{full}</span>\n            <MotionNumber aria-hidden=\"true\" value={text} />\n          </>\n        )}\n      </span>\n    </>\n  );\n}\n\n// A bar as the chart keeps it: its own value and the colour it keeps even\n// while it shrinks away after it has left the data.\ntype RadialRow = RadialBarChartDatum & { color: string };\n\n/**\n * Bars that each fill a ring of their own by their share of `max`, from 12\n * o'clock clockwise, concentric from the outer ring inwards over a neutral\n * track, with round ends: one bar for a progress circle, several for an\n * activity gauge. The hole takes a figure with a caption above it, a legend\n * below lists the bars, and a tooltip trails beside the bar under the pointer;\n * the chart is one focus stop whose arrow keys step from ring to ring. No bar\n * fades while another is active: the bars are shades of one hue. New data\n * glides in: a bar is told by its id, grows from nothing, glides to a new value\n * and shrinks away in its ring when it leaves.\n */\nexport function RadialBarChart({\n  data,\n  label,\n  \"aria-describedby\": describedBy,\n  max = 100,\n  size: sizeProp = \"sm\",\n  palette = \"brand\",\n  formatValue: givenFormat,\n  locale: localeProp,\n  emptyLabel: emptyLabelProp,\n  labels,\n  center,\n  centerValue,\n  centerLabel,\n  centerFormat,\n  legend = data.length > 1,\n  rollingNumbers = false,\n  className,\n}: RadialBarChartProps): React.ReactElement {\n  const messages = useSiteplaneMessages(\"chart\");\n  const emptyLabel = emptyLabelProp ?? messages.noData;\n  // The chart's own locale, else the provider's, else en-US.\n  const locale = useFormatLocale(localeProp, CHART_DEFAULT_LOCALE);\n  const chart = React.useRef<SVGSVGElement>(null);\n  const size = Math.max(\n    0,\n    typeof sizeProp === \"number\" ? sizeProp : RADIAL_BAR_CHART_SIZES[sizeProp],\n  );\n  const words = chartLabels(labels, messages);\n  // Numbers as the other charts write them: in the format of the locale.\n  const formatValue = givenFormat ?? chartNumberFormatter(locale);\n  const full = Number.isFinite(max) && max > 0 ? max : 100;\n  const colors = chartPaletteColors(palette, data.length);\n  const rows: RadialRow[] = data.map((item, index) => ({\n    ...item,\n    color: item.color ?? colors[index]!,\n    value: Number.isFinite(item.value) ? item.value : 0,\n  }));\n  // The bars as they are drawn now, as shares of a full ring: when the data\n  // changes each bar glides to its new share, a new bar grows from nothing and\n  // a bar that is gone shrinks away in its ring before the rings close up. At\n  // rest this is the data itself.\n  const bars = useTweenedRows(rows, (row) => radialShare(row.value, full), {\n    container: chart,\n  });\n  const empty = rows.length === 0;\n  // Every bar has a ring while it is drawn, one that is leaving included; a\n  // chart with no bars keeps one empty ring.\n  const layout = radialLayout(size, Math.max(1, bars.length));\n  const middle = size / 2;\n\n  // The bar under a point, from its distance to the centre. One lookup for the\n  // whole chart keeps the active bar steady while the pointer crosses from one\n  // ring to the next.\n  const barAt = (clientX: number, clientY: number): string | null => {\n    const box = chart.current?.getBoundingClientRect();\n    if (!box || !box.width || empty) return null;\n    const scale = size / box.width;\n    const ring = ringAtPoint(\n      layout,\n      (clientX - box.x - box.width / 2) * scale,\n      (clientY - box.y - box.height / 2) * scale,\n    );\n    const bar = bars[ring];\n    return bar && !bar.leaving ? bar.key : null;\n  };\n  // The chart core keeps the active bar, the pointer, the tap that pins, the\n  // arrow keys and the tooltip; the rings only say which bar is under a point.\n  const interaction = useChartInteraction({\n    itemAt: barAt,\n    keys: rows.map((row) => row.id),\n  });\n  const selected =\n    interaction.activeKey === null\n      ? undefined\n      : rows.find((row) => row.id === interaction.activeKey);\n  // The card sits beside the middle of the bar, on its ring.\n  const anchorFor = (key: string) => {\n    const index = bars.findIndex((bar) => bar.key === key);\n    const ring = layout.rings[index];\n    const box = chart.current?.getBoundingClientRect();\n    if (index < 0 || !ring || !box) return null;\n    const point = barAnchor(bars[index]!.value, ring, size);\n    return {\n      x: box.x + box.width * point.x,\n      y: box.y + box.height * point.y,\n    };\n  };\n  // What the chart says about its bars to assistive technology when it takes\n  // focus: its empty label when there is none, and without a legend each bar\n  // and its value, which the legend reads out otherwise.\n  const showLegend = legend && !empty;\n  const description = empty\n    ? emptyLabel\n    : showLegend\n      ? undefined\n      : // A full stop ends it, so that the keyboard hint after it is heard\n        // as a sentence of its own.\n        `${rows.map((row) => `${row.label}: ${formatValue(row.value)}`).join(\"; \")}.`;\n  const hasFigure = centerValue !== undefined && Number.isFinite(centerValue);\n  // The hole, as a share of the box from each edge: the square around it.\n  const holeInset = size > 0 ? (0.5 - layout.holeRadius / size) * 100 : 50;\n  return (\n    // The figure holds the rings and the legend. The focus stop inside is the\n    // chart for assistive technology, named by the label alone.\n    <figure\n      className={cn(\n        \"sp-radial-bar-chart\",\n        \"flex max-w-full flex-col items-center\",\n        className,\n      )}\n      data-slot=\"radial-bar-chart\"\n    >\n      <ChartTooltip\n        // The rings fill their box, so the card has room beside a bar only\n        // outside the chart: it stays inside the window instead.\n        align=\"center\"\n        anchorFor={anchorFor}\n        announcement={\n          selected\n            ? chartTooltipText(undefined, [\n                { label: selected.label, value: formatValue(selected.value) },\n              ])\n            : undefined\n        }\n        boundary=\"viewport\"\n        className=\"relative max-w-full rounded-full\"\n        content={\n          selected && (\n            <>\n              <strong className=\"tabular-nums\">\n                {rollingNumbers ? (\n                  <MotionNumber value={formatValue(selected.value)} />\n                ) : (\n                  formatValue(selected.value)\n                )}\n              </strong>\n              <div>{selected.label}</div>\n            </>\n          )\n        }\n        describedBy={describedBy}\n        description={description}\n        interaction={interaction}\n        keyboardHint={words.keyboardHint}\n        label={label}\n        roleDescription={words.roleDescription}\n        style={{ height: size, width: size }}\n      >\n        {/* The rings are a picture that the focus stop describes, so they are\n            hidden from assistive technology. No SVG titles: the browser would\n            show its own tooltip next to the chart's. Each ring is first its\n            track, the whole circle in the neutral of an empty share, and then\n            its bar over it. */}\n        <svg\n          aria-hidden=\"true\"\n          className=\"size-full\"\n          ref={chart}\n          viewBox={`0 0 ${size} ${size}`}\n        >\n          {layout.rings.map((ring, index) => (\n            <circle\n              className=\"sp-radial-bar-chart-track\"\n              cx={middle}\n              cy={middle}\n              data-slot=\"radial-bar-chart-track\"\n              fill=\"none\"\n              key={`track-${index}`}\n              r={ring.radius}\n              stroke={chartEmptyColor}\n              strokeWidth={ring.width}\n            />\n          ))}\n          {bars.map((bar, index) => {\n            const ring = layout.rings[index];\n            const dash = ring ? barDash(bar.value, ring) : null;\n            return ring && dash ? (\n              <path\n                className=\"sp-radial-bar-chart-bar\"\n                d={chartCirclePath(middle, middle, ring.radius)}\n                data-active={interaction.activeKey === bar.key ? \"\" : undefined}\n                data-slot=\"radial-bar-chart-bar\"\n                fill=\"none\"\n                key={bar.key}\n                pathLength=\"100\"\n                stroke={bar.row.color}\n                strokeDasharray={dash.dasharray}\n                strokeDashoffset={dash.dashoffset}\n                strokeLinecap=\"round\"\n                strokeWidth={ring.width}\n              />\n            ) : null;\n          })}\n        </svg>\n        {/* The empty label is the charts' own empty state, in HTML over the\n            rings, so that it keeps its 14 px at any size of the chart. */}\n        {empty && <ChartEmptyState label={emptyLabel} />}\n        {/* The centre is HTML over the rings, in the square around the hole,\n            cut off at its round edge, so that nothing in it covers a ring. It\n            sits inside the focus stop, whose name is the label alone, and\n            never takes the pointer, so the lookup sees every point. */}\n        {!empty && (center != null || hasFigure) && (\n          <div\n            className=\"sp-radial-bar-chart-center pointer-events-none absolute flex flex-col items-center justify-center overflow-hidden rounded-full text-center\"\n            data-slot=\"radial-bar-chart-center\"\n            style={{ inset: `${holeInset}%` }}\n          >\n            {center ?? (\n              <RadialCenterFigure\n                caption={centerLabel}\n                format={centerFormat}\n                holeRadius={layout.holeRadius}\n                locale={locale}\n                value={centerValue!}\n              />\n            )}\n          </div>\n        )}\n      </ChartTooltip>\n      {showLegend && (\n        <ChartLegend\n          className=\"pt-3\"\n          fade={false}\n          items={rows.map((row) => ({\n            color: row.color,\n            key: row.id,\n            label: row.label,\n            value: formatValue(row.value),\n          }))}\n          layout=\"row\"\n        />\n      )}\n    </figure>\n  );\n}\n","type":"registry:ui","target":"~/src/siteplane/components/radial-bar-chart/radial-bar-chart.tsx"},{"path":"packages/ui/src/components/radial-bar-chart/radial-geometry.ts","content":"/*\n * The geometry of the Radial Bar Chart: concentric rings, one bar on each, drawn\n * in a box as many px across as the chart. A bar fills its ring from 12 o'clock\n * clockwise by its share of the chart's `max`, and its round ends stay inside\n * that share, so a bar of 40 % covers 40 % of the circle. The rings, the\n * pointer, the tooltip and the figure in the hole all read the same layout.\n */\n\n/**\n * The named sizes of the chart, by the diameter of its outer ring: 176, 220,\n * 264 and 308 px, a lone ring of 80, 100, 120 and 140 px radius at its centre\n * line with a 16 to 28 px bar.\n */\nexport type RadialBarChartSize = \"xs\" | \"sm\" | \"md\" | \"lg\";\n\nexport const RADIAL_BAR_CHART_SIZES: Readonly<\n  Record<RadialBarChartSize, number>\n> = {\n  xs: 176,\n  sm: 220,\n  md: 264,\n  lg: 308,\n};\n\n/** One ring of the chart: the radius of its centre line and its thickness, in px. */\nexport type RadialRing = { radius: number; width: number };\n\n/** Where the rings of a chart sit, from the outer ring inwards. */\nexport type RadialLayout = {\n  /** The side of the box, in px: the diameter of the outer ring. */\n  size: number;\n  rings: RadialRing[];\n  /** The space between two rings, in px. */\n  gap: number;\n  /** The radius of the hole inside the inner ring, in px. */\n  holeRadius: number;\n};\n\n/**\n * The rings of a chart `size` px across with `count` bars, from the outer ring\n * inwards. A lone ring is an eleventh of the size thick, 16, 20, 24 and 28 px\n * at `xs` to `lg`; each further ring thins them all, to a seventeenth of the\n * size for three (10, 13, 16 and 18 px), so that the hole keeps room for its\n * figure. Rings stand a quarter of their thickness apart. Both are whole px,\n * at least 1 px, so every ring paints as thick as the others.\n */\nexport function radialLayout(size: number, count: number): RadialLayout {\n  const box = Math.max(0, size);\n  const rings = Math.max(1, Math.floor(count));\n  const width = Math.max(1, Math.round(box / (11 + 3 * (rings - 1))));\n  const gap = Math.max(1, Math.round(width / 4));\n  const outer = box / 2;\n  return {\n    gap,\n    holeRadius: Math.max(0, outer - rings * width - (rings - 1) * gap),\n    rings: Array.from({ length: rings }, (_, index) => ({\n      radius: outer - index * (width + gap) - width / 2,\n      width,\n    })),\n    size: box,\n  };\n}\n\n/**\n * The ring under a point, by its distance from the centre: the ring and half the\n * gap on either side of it, so that the pointer finds a ring between two rings.\n * The point is an offset from the centre in px of the box. -1 for none: in the\n * hole or outside the chart.\n */\nexport function ringAtPoint(\n  layout: RadialLayout,\n  dx: number,\n  dy: number,\n): number {\n  const distance = Math.hypot(dx, dy);\n  return layout.rings.findIndex(\n    (ring) =>\n      Math.abs(distance - ring.radius) <= ring.width / 2 + layout.gap / 2,\n  );\n}\n\n/** A share of a ring, 0 to 1, from a value and the value of a full ring: a value beyond either end is held to it. */\nexport function radialShare(value: number, max: number): number {\n  if (!Number.isFinite(value) || !(max > 0)) return 0;\n  return Math.min(1, Math.max(0, value / max));\n}\n\n// The smallest dash drawn, in percent of the circle: a bar too short for its\n// round ends is a dot, which a browser draws for a dash of some length only.\nconst dotDash = 0.001;\n\n/**\n * The dash of a bar along its ring's circle (drawn with `pathLength` 100 and\n * round ends): where it starts and how long it is, in percent of the circle.\n * The round ends reach half the ring's thickness beyond the dash, so the dash\n * is shortened by them and starts half of one in, and the bar covers its share\n * exactly; a bar shorter than its two ends is a dot in the middle of its share.\n * Null for a bar with nothing in it.\n */\nexport function barDash(\n  share: number,\n  ring: RadialRing,\n): { dasharray: string; dashoffset: number } | null {\n  const percent = Math.min(1, Math.max(0, share)) * 100;\n  if (!(percent > 0) || !(ring.radius > 0)) return null;\n  const ends = (ring.width / (2 * Math.PI * ring.radius)) * 100;\n  const length = Math.max(dotDash, percent - ends);\n  const round = (value: number) => Math.round(value * 1000) / 1000;\n  return {\n    dasharray: `${round(length)} ${round(100 - length)}`,\n    dashoffset: round(-Math.min(ends, percent) / 2) || 0,\n  };\n}\n\n/**\n * Where the tooltip of a bar sits, as fractions of the box: the middle of the\n * bar on its ring's centre line, or 12 o'clock on its ring for a bar with\n * nothing in it.\n */\nexport function barAnchor(\n  share: number,\n  ring: RadialRing,\n  size: number,\n): { x: number; y: number } {\n  if (!(size > 0)) return { x: 0.5, y: 0.5 };\n  const angle = Math.min(1, Math.max(0, share)) * Math.PI;\n  return {\n    x: 0.5 + (ring.radius * Math.sin(angle)) / size,\n    y: 0.5 - (ring.radius * Math.cos(angle)) / size,\n  };\n}\n\n/**\n * The text steps of a figure in the hole, in px, from the largest, with the\n * height of its line and the least hole, in px across, that takes it as its\n * largest step: a lone ring at `xs` to `lg` leaves a hole of 144, 180, 216 and\n * 252 px for a figure of 24, 30, 36 and 48 px, and three rings at `xs` leave\n * 104 px for 20 px.\n */\nexport const RADIAL_CENTER_STEPS = [\n  { hole: 240, line: 60, size: 48 },\n  { hole: 200, line: 44, size: 36 },\n  { hole: 150, line: 38, size: 30 },\n  { hole: 128, line: 32, size: 24 },\n  { hole: 96, line: 30, size: 20 },\n  { hole: 0, line: 24, size: 16 },\n  { hole: 0, line: 20, size: 14 },\n  { hole: 0, line: 18, size: 12 },\n] as const;\n\nexport type RadialCenterStep = (typeof RADIAL_CENTER_STEPS)[number][\"size\"];\n\n/** The least hole, in px across, whose caption is 14 px on a 20 px line; a smaller one's is 12 px on 18. */\nexport const RADIAL_LARGE_CAPTION_HOLE = 150;\n\n/** The steps a hole of `diameter` px offers its figure: its largest step and every smaller one. */\nexport function radialCenterSteps(diameter: number): RadialCenterStep[] {\n  const first = RADIAL_CENTER_STEPS.findIndex((step) => diameter >= step.hole);\n  return RADIAL_CENTER_STEPS.slice(Math.max(0, first)).map((step) => step.size);\n}\n\n/** The height of a figure's line at a step, in px. */\nexport function radialCenterLine(size: number): number {\n  return RADIAL_CENTER_STEPS.find((step) => step.size === size)?.line ?? size;\n}\n","type":"registry:ui","target":"~/src/siteplane/components/radial-bar-chart/radial-geometry.ts"},{"path":"packages/ui/src/components/radial-bar-chart/index.ts","content":"export * from \"./radial-bar-chart\";\n","type":"registry:ui","target":"~/src/siteplane/components/radial-bar-chart/index.ts"}],"type":"registry:ui","docs":"https://ui.siteplane.io/docs-markdown/components/radial-bar-chart.md","categories":["Charts"],"meta":{"avoidWhen":["Avoid for comparing many categories or following change over time; use a Bar Chart, a Bar List or a Line Chart.","Avoid for the shares of one total; use a Pie Chart, whose shares add up to the whole."],"description":"Show progress toward a goal as a ring that fills, or compare a few measures as concentric rings against one maximum.","knownLimitations":["Every bar is measured against the same max, 100 by default: a value above it fills its ring and a value below 0 leaves it empty, while the tooltip names the value itself.","The rings thin as bars are added, to a seventeenth of the chart's size for three, so more than four bars leave thin rings and a small hole; the thickness follows the size and the number of bars, not each bar.","centerValue is fitted into the hole from the chart's size and the text alone, the same on the server and the client: the full figure in the three largest text steps the hole offers, from 48 px in a hole of 240 px down to 20 px in one of 96 px, otherwise compact (1.2M); screen readers read it in full. centerLabel stands above it on one line and ends in an ellipsis.","Content of your own in center is laid out in the square around the hole and cut off at the hole's round edge, so it never covers a ring but can be cut: keep it short, or pass the figure as centerValue.","The chart is one focus stop; the arrow keys step from ring to ring and stop at the outer and the inner ring. Bars have no click or selection props, no bar fades while another is active, and the legend neither toggles bars nor reacts to the mouse.","When the data changes, the bars glide to their new values and a bar is told by its id: give each bar a stable id. A change in the number of bars sets the thickness and the places of the rings at once."],"providerNotes":["The tooltip comes from the installed Tooltip. The chart opens and closes it itself, so it needs no TooltipProvider.","The glide uses the installed Motion component and its tokens. SiteplaneMotionProvider preset=\"reduced\" and the system setting show new data at once."],"releaseStatus":"preview","searchTerms":["radial bar chart","radial","progress circle","progress ring","activity rings","gauge","goal"],"useWhen":["Use for progress toward a goal or a quota, such as seats or storage used, as a ring with a figure and a caption in its hole.","Use for up to three or four measures against one maximum, such as the goals reached this quarter, as concentric rings with a legend."]}}