{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "dot-plot",
  "type": "registry:ui",
  "title": "Dot Plot",
  "description": "One dot per value on a shared axis, one row per thing compared: support for a policy by age group in two years, life expectancy by country for women and men, a price in three cities. With two or more series, a line joins each row's dots, so the length of…",
  "author": "ofri-peretz <https://github.com/ofri-peretz>",
  "categories": [
    "data",
    "chart"
  ],
  "dependencies": [],
  "registryDependencies": [
    "https://ds.interlace.tools/r/interlace-base.json",
    "https://ds.interlace.tools/r/cn.json",
    "https://ds.interlace.tools/r/skeleton.json",
    "https://ds.interlace.tools/r/use-reduced-motion.json"
  ],
  "files": [
    {
      "path": "registry/interlace-ui/charts/dot-plot.tsx",
      "target": "components/ui/charts/dot-plot.tsx",
      "type": "registry:ui",
      "content": "'use client';\n\nimport * as React from 'react';\n\n// @interlace/dot-plot v1.2.1 — Interlace design system.\n// Docs, props and live preview: https://ds.interlace.tools/c/dot-plot\n// What changed since: https://ds.interlace.tools/c/dot-plot#history\n// Generated banner — keep it, the upgrade diff reads this version.\n\n/**\n * @interlace/ui — DotPlot\n *\n * One dot per value on a shared axis, one row per thing compared: support\n * for a policy by age group in two years, life expectancy by country for\n * women and men, a price in three cities. With two or more series, a line\n * joins each row's dots, so the length of the line is the gap and its\n * direction is the change.\n *\n * ## Why dots and not bars\n *\n * A bar says \"this much, from zero\". A dot says \"here\", so the axis does not\n * have to start at zero, and the reader compares positions, not lengths.\n * That makes a dot plot the honest choice for values that cluster far from\n * zero (60–80%) and for comparing two values per row: two bars side by side\n * make the reader subtract; two dots on one line show the gap.\n *\n * ## The axis\n *\n * The domain is the data's range rounded out to round numbers, unless you\n * pass `domain`. Ticks are those round numbers, as HTML-sized text in an SVG\n * that is never scaled, so 12px stays 12px at any width. `niceTicks()` is\n * exported and pure.\n *\n * ## Colour is never the only channel\n *\n * Series take the chart hues in order. The first series is a hollow ring and\n * the others are filled, so \"before\" and \"after\" differ in shape as well as\n * colour. The legend names them; each row has a sentence with every value;\n * a table sits behind the picture (`showTable` shows it). The value of the\n * last series is printed at the end of each row.\n *\n * ## Pointing at a series\n *\n * Hovering a dot or a legend entry, or focusing a legend entry, dims the\n * other series and prints that series' value at the end of every row. A\n * click on a legend entry pins it.\n *\n * ## Motion\n *\n * On first view, the line in each row draws from the first series towards\n * the last and the later dots arrive after it, once, in 400ms: the motion is\n * the change the chart is about. Under reduced motion it is all simply there.\n *\n * ## Container, not viewport\n *\n * Label beside the plot when the chart's own box is 28rem or wider, above it\n * when narrower. In a right-to-left page the axis runs right to left.\n *\n * ## MIN_VIEWPORT — 320\n *\n * | Rule | Concept                    | Where in this file                                     |\n * | ---- | -------------------------- | ------------------------------------------------------ |\n * | R4   | Extends native el          | `React.ComponentProps<'figure'>`                        |\n * | R6   | data-slot on every part    | `dot-plot` / `-row` / `-dot` / `-link` / `-axis` / `-legend` |\n * | R8   | Enums, not booleans        | `order`                                                 |\n * | R13  | Ecosystem first            | no charting dep: `niceTicks` + SVG percentages          |\n * | R14  | Declares min viewport      | `data-min-viewport={String(MIN_VIEWPORT)}`              |\n * | R18  | Tailwind only              | zero inline `style`; positions are SVG attributes       |\n * | R19  | Tokens only                | `--chart-1..5`, `--border`, `--muted-foreground`        |\n * | R23  | Loading reserves its box   | `loading` → `<Skeleton variant=\"chart\">`                |\n * | R26  | A11y                       | sentence per row + named legend + shapes + table        |\n */\n\nimport { cn } from '@/lib/utils';\nimport { useReducedMotion } from '@/hooks/use-reduced-motion';\nimport { Skeleton } from '@/components/ui/skeleton';\n\nexport const MIN_VIEWPORT = 320 as const;\n\nexport type DotTone = 1 | 2 | 3 | 4 | 5;\n\nexport type DotSeries = {\n  /** What rows key their values by. */\n  id: string;\n  /** The series' name, such as a year. */\n  label: string;\n  /** Its colour. @default the next of 1..5 */\n  tone?: DotTone;\n};\n\nexport type DotRow = {\n  /** The row's name. */\n  label: string;\n  /** A value per series id. Missing or null draws no dot. */\n  values: Readonly<Record<string, number | null | undefined>>;\n  /** A short line under the label. */\n  note?: string;\n};\n\nconst FILL: Record<DotTone, string> = {\n  1: 'fill-chart-1',\n  2: 'fill-chart-2',\n  3: 'fill-chart-3',\n  4: 'fill-chart-4',\n  5: 'fill-chart-5',\n};\nconst STROKE: Record<DotTone, string> = {\n  1: 'stroke-chart-1',\n  2: 'stroke-chart-2',\n  3: 'stroke-chart-3',\n  4: 'stroke-chart-4',\n  5: 'stroke-chart-5',\n};\n\nconst finite = (v: number | null | undefined): v is number => typeof v === 'number' && Number.isFinite(v);\n\n// ─────────────────────────────────────────────────────────────────\n// Pure axis\n// ─────────────────────────────────────────────────────────────────\n\n/** The round step nearest `span / count`: 1, 2, 5 or 10 times a power of ten. */\nfunction niceStep(span: number, count: number): number {\n  const raw = span / Math.max(1, count);\n  const power = 10 ** Math.floor(Math.log10(raw));\n  const unit = raw / power;\n  return (unit < 1.5 ? 1 : unit < 3 ? 2 : unit < 7 ? 5 : 10) * power;\n}\n\n/**\n * Round ticks that cover `min` to `max`: the domain is rounded out to the\n * nearest step, so the first and last tick are the axis ends. A single value\n * gets one step either side of it.\n */\nexport function niceTicks(min: number, max: number, count = 4): number[] {\n  if (!Number.isFinite(min) || !Number.isFinite(max)) return [];\n  if (min === max) {\n    const step = niceStep(Math.abs(min) || 1, count);\n    return [min - step, min, min + step];\n  }\n  const [lo, hi] = min < max ? [min, max] : [max, min];\n  let step = niceStep(hi - lo, count);\n  // Rounding both ends out can add two steps; past `count + 1` the labels crowd, so take a coarser step.\n  if (Math.ceil(hi / step) - Math.floor(lo / step) > count + 1) step = niceStep(hi - lo, count - 1);\n  const start = Math.floor(lo / step) * step;\n  const end = Math.ceil(hi / step) * step;\n  const n = Math.round((end - start) / step);\n  // Rounded to the step's precision, so 0.1 + 0.2 prints as 0.3.\n  const digits = Math.max(0, -Math.floor(Math.log10(step)));\n  return Array.from({ length: n + 1 }, (_, i) => Number((start + i * step).toFixed(digits)));\n}\n\n/**\n * Which tick labels to show, given where each one lands on screen as\n * `[left, right]`. The two ends are always shown; an inner label is shown\n * only when it keeps `gap` pixels from the last one shown and from the far\n * end. Order is by position, so a mirrored (right-to-left) axis works the same.\n */\nexport function thinTicks(extents: ReadonlyArray<readonly [number, number]>, gap = 6): boolean[] {\n  const show = extents.map(() => false);\n  if (extents.length === 0) return show;\n  const order = extents.map((_, i) => i).sort((a, b) => extents[a]![0] - extents[b]![0]);\n  const first = order[0]!;\n  const last = order.at(-1)!;\n  show[first] = true;\n  show[last] = true;\n  let edge = extents[first]![1];\n  const stop = extents[last]![0];\n  for (const i of order.slice(1, -1)) {\n    const [left, right] = extents[i]!;\n    if (left >= edge + gap && right <= stop - gap) {\n      show[i] = true;\n      edge = right;\n    }\n  }\n  return show;\n}\n\n/**\n * The fixed words a reader meets, for a page in another language. Sentences are\n * functions, so each language can order and inflect them its own way.\n */\nexport type DotPlotLabels = {\n  /** A missing value in the table. */\n  noData: string;\n  /** The name of the legend, for screen readers. */\n  series: string;\n  /** The table's first column, for screen readers. */\n  row: string;\n  /** Shown when there is nothing to plot. */\n  empty: string;\n  /** The table's caption, given the chart's `label` when it is a string. */\n  tableCaption: (label?: string) => string;\n  /**\n   * The sentence for one row. Each value is formatted, or null when missing. It words a missing\n   * value itself, so set it alongside `noData` when translating.\n   */\n  rowSentence: (row: string, values: ReadonlyArray<{ series: string; value: string | null }>) => string;\n};\n\nconst LABELS: DotPlotLabels = {\n  noData: 'No data',\n  series: 'Series',\n  row: 'Row',\n  empty: 'No values to show yet.',\n  tableCaption: (label) => (label ? `${label}: values by row` : 'Values by row'),\n  rowSentence: (row, values) => `${row}: ${values.map((v) => `${v.series} ${v.value ?? 'no data'}`).join(', ')}.`,\n};\n\n/** One sentence for a row: its label, then every series' value. */\nexport function describeDotRow(\n  row: DotRow,\n  series: readonly DotSeries[],\n  format: (v: number) => string,\n  sentence: DotPlotLabels['rowSentence'] = LABELS.rowSentence,\n): string {\n  return sentence(\n    row.label,\n    series.map((s) => {\n      const v = row.values[s.id];\n      return { series: s.label, value: finite(v) ? format(v) : null };\n    }),\n  );\n}\n\n// ─────────────────────────────────────────────────────────────────\n// Component\n// ─────────────────────────────────────────────────────────────────\n\nconst GROW_MS = 400;\nconst SPREAD_MS = 150;\nconst EASE_ENTER = 'cubic-bezier(0.16, 1, 0.3, 1)';\nconst ROW_HEIGHT = 24;\nconst R = 6;\n\nexport interface DotPlotProps extends Omit<React.ComponentProps<'figure'>, 'children'> {\n  /** The series, in order. A line joins each row's first and last dots. */\n  series: readonly DotSeries[];\n  /** One line of dots per row. */\n  rows: readonly DotRow[];\n  /** The axis range. @default the data's range, rounded out to round numbers */\n  domain?: readonly [number, number];\n  /** Keep the given order, sort by the last series' value, or by the change from first to last. @default 'given' */\n  order?: 'given' | 'descending' | 'change';\n  /** How values print, as `Intl.NumberFormat` options. */\n  format?: Intl.NumberFormatOptions;\n  /** A BCP 47 locale for the numbers. @default the reader's */\n  locale?: string;\n  /** The chart's title. */\n  label?: React.ReactNode;\n  /** Show the table of values, which otherwise is for screen readers only. */\n  showTable?: boolean;\n  /** Reserve the chart's box while the data loads. */\n  loading?: boolean;\n  /** Fixed words, for pages in another language. */\n  labels?: Partial<DotPlotLabels>;\n}\n\nexport const DotPlot = React.forwardRef<HTMLElement, DotPlotProps>(function DotPlot(\n  {\n    series,\n    rows,\n    domain,\n    order = 'given',\n    format: formatOptions,\n    locale,\n    label,\n    showTable = false,\n    loading = false,\n    labels: labelsProp,\n    className,\n    ...props\n  },\n  ref,\n) {\n  const labels = { ...LABELS, ...labelsProp };\n  const reduced = useReducedMotion();\n  const labelId = React.useId();\n  const listRef = React.useRef<HTMLUListElement>(null);\n  const axisRef = React.useRef<SVGSVGElement>(null);\n  const [hovered, setHovered] = React.useState<number | null>(null);\n  const [pinned, setPinned] = React.useState<number | null>(null);\n\n  const number = React.useMemo(() => new Intl.NumberFormat(locale, formatOptions), [locale, formatOptions]);\n  const format = (v: number) => number.format(v);\n\n  // Unnamed series take the hues no series names, in order, so no two share a colour while hues last.\n  const tones = React.useMemo(() => {\n    const named = new Set(series.map((s) => s.tone));\n    const free = ([1, 2, 3, 4, 5] as const).filter((t) => !named.has(t));\n    let next = 0;\n    return series.map((s) => s.tone ?? free[next++ % free.length] ?? 1);\n  }, [series]);\n\n  // With no series, `last` is undefined and sorting stops before `first` is read.\n  const first = series[0]?.id;\n  const last = series.at(-1)?.id;\n  const sorted = React.useMemo(() => {\n    const indexed = rows.map((row, index) => ({ row, index }));\n    if (order === 'given' || last === undefined) return indexed;\n    const score = (row: DotRow) => {\n      const end = row.values[last];\n      const start = row.values[first!];\n      if (!finite(end)) return -Infinity;\n      return order === 'change' ? (finite(start) ? end - start : -Infinity) : end;\n    };\n    return indexed\n      .map((x) => ({ ...x, score: score(x.row) }))\n      .sort((a, b) => b.score - a.score || a.index - b.index);\n  }, [rows, order, first, last]);\n\n  const ticks = React.useMemo(() => {\n    if (domain) {\n      // The given ends are the axis ends; round ticks fill in between.\n      const [a, b] = domain[0] <= domain[1] ? domain : [domain[1], domain[0]];\n      if (!(a < b)) return [];\n      return [a, ...niceTicks(a, b).filter((t) => t > a && t < b), b];\n    }\n    const all = rows.flatMap((row) => series.map((s) => row.values[s.id])).filter(finite);\n    return all.length > 0 ? niceTicks(Math.min(...all), Math.max(...all)) : [];\n  }, [domain, rows, series]);\n\n  // Tick labels are text-sized at any width, so a narrow column or 150% text can make them\n  // touch. After layout, inner labels that would touch a neighbour are hidden; the server\n  // HTML keeps them all.\n  React.useLayoutEffect(() => {\n    const axis = axisRef.current;\n    if (!axis) return;\n    const fit = () => {\n      const labels = Array.from(axis.querySelectorAll<SVGTextElement>('text'));\n      labels.forEach((l) => l.removeAttribute('visibility'));\n      const shown = thinTicks(labels.map((l) => {\n        const r = l.getBoundingClientRect();\n        return [r.left, r.right] as const;\n      }));\n      labels.forEach((l, i) => {\n        if (!shown[i]) l.setAttribute('visibility', 'hidden');\n      });\n    };\n    fit();\n    if (typeof ResizeObserver === 'undefined') return;\n    const observer = new ResizeObserver(fit);\n    observer.observe(axis);\n    return () => observer.disconnect();\n  }, [ticks, number]);\n\n  // The first view draws each row's line from its first dot, then the later dots arrive.\n  React.useLayoutEffect(() => {\n    const list = listRef.current;\n    if (!list || reduced || typeof IntersectionObserver === 'undefined') return;\n    const parts = Array.from(list.querySelectorAll<SVGElement>('[data-slot=\"dot-plot-link\"],[data-later]'));\n    if (parts.length === 0 || typeof parts[0]!.animate !== 'function') return;\n    for (const part of parts) part.style.opacity = '0';\n    const io = new IntersectionObserver(\n      (entries) => {\n        if (!entries.some((e) => e.isIntersecting)) return;\n        io.disconnect();\n        const rowsOut = Array.from(list.querySelectorAll('[data-slot=\"dot-plot-row\"]'));\n        const lastRow = Math.max(1, rowsOut.length - 1);\n        for (const part of parts) {\n          part.style.opacity = '';\n          const row = rowsOut.indexOf(part.closest('[data-slot=\"dot-plot-row\"]')!);\n          const delay = (row / lastRow) * SPREAD_MS;\n          if (part.getAttribute('data-slot') === 'dot-plot-link') {\n            part.style.transformOrigin = `${part.getAttribute('data-from')} 50%`;\n            part.animate([{ transform: 'scaleX(0)' }, { transform: 'scaleX(1)' }], {\n              duration: GROW_MS,\n              delay,\n              easing: EASE_ENTER,\n              fill: 'backwards',\n            });\n          } else {\n            part.animate([{ opacity: 0 }, { opacity: 1 }], {\n              duration: GROW_MS / 2,\n              delay: delay + GROW_MS / 2,\n              easing: EASE_ENTER,\n              fill: 'backwards',\n            });\n          }\n        }\n      },\n      { threshold: 0.25 },\n    );\n    io.observe(list);\n    return () => {\n      io.disconnect();\n      for (const part of parts) {\n        part.style.opacity = '';\n        for (const animation of part.getAnimations()) animation.cancel();\n      }\n    };\n  }, [reduced, rows.length, series.length]);\n\n  if (loading) {\n    return (\n      <figure\n        ref={ref}\n        data-slot=\"dot-plot\"\n        data-state=\"loading\"\n        data-min-viewport={String(MIN_VIEWPORT)}\n        aria-busy=\"true\"\n        className={cn('m-0 w-full', className)}\n        {...props}\n      >\n        <Skeleton variant=\"chart\" />\n      </figure>\n    );\n  }\n\n  if (rows.length === 0 || series.length === 0 || ticks.length === 0) {\n    return (\n      <figure\n        ref={ref}\n        data-slot=\"dot-plot\"\n        data-state=\"empty\"\n        data-min-viewport={String(MIN_VIEWPORT)}\n        className={cn('m-0 w-full rounded-xl border border-border p-6', className)}\n        {...props}\n      >\n        <p className=\"text-sm text-muted-foreground\">{labels.empty}</p>\n      </figure>\n    );\n  }\n\n  const lo = ticks[0]!;\n  const hi = ticks.at(-1)!;\n  const span = hi - lo;\n  // The track is inset by a dot's radius (`px-1.5`), so a dot at either end is never clipped.\n  const pct = (v: number) => `${Number((Math.min(1, Math.max(0, (v - lo) / span)) * 100).toFixed(3))}%`;\n  // A pin or hover can outlive its series when `series` shrinks; then nothing is picked out.\n  const picked = hovered ?? pinned;\n  const active = picked !== null && picked < series.length ? picked : null;\n  const endId = active === null ? last! : series[active]!.id;\n\n  const point = (event: React.PointerEvent<SVGSVGElement>) => {\n    const s = (event.target as Element).getAttribute('data-series');\n    setHovered(s === null ? null : Number(s));\n  };\n\n  const GRID =\n    'grid-cols-[minmax(0,1fr)_auto] @md/dots:grid-cols-[minmax(6rem,14rem)_minmax(0,1fr)_auto]';\n\n  return (\n    <figure\n      ref={ref}\n      data-slot=\"dot-plot\"\n      data-min-viewport={String(MIN_VIEWPORT)}\n      aria-labelledby={label ? labelId : undefined}\n      className={cn('@container/dots m-0 flex w-full min-w-0 flex-col gap-4', className)}\n      {...props}\n    >\n      {label ? (\n        <figcaption id={labelId} data-slot=\"dot-plot-label\" className=\"text-foreground text-ui-sm font-medium\">\n          {label}\n        </figcaption>\n      ) : null}\n\n      <ul data-slot=\"dot-plot-legend\" aria-label={labels.series} className=\"m-0 flex list-none flex-wrap gap-x-4 gap-y-1 p-0 text-ui-sm\">\n        {series.map((s, i) => (\n          <li key={s.id}>\n            <button\n              type=\"button\"\n              aria-pressed={pinned === i}\n              data-slot=\"dot-plot-legend-item\"\n              data-active={active === i ? '' : undefined}\n              onPointerEnter={() => setHovered(i)}\n              onPointerLeave={() => setHovered(null)}\n              onFocus={() => setHovered(i)}\n              onBlur={() => setHovered(null)}\n              onClick={() => setPinned((current) => (current === i ? null : i))}\n              className={cn(\n                '-mx-1.5 flex min-h-target items-center gap-2 rounded-md px-1.5 py-0.5',\n                'hover:bg-muted data-[active]:bg-muted aria-pressed:bg-muted',\n                'focus-visible:ring-ring focus-visible:ring-offset-background focus-visible:ring-2 focus-visible:ring-offset-1 focus-visible:outline-hidden',\n              )}\n            >\n              <svg aria-hidden viewBox=\"0 0 14 14\" className=\"size-3.5 shrink-0\">\n                <circle\n                  cx=\"7\"\n                  cy=\"7\"\n                  r={i === 0 ? 5 : 6}\n                  strokeWidth={i === 0 ? 2 : 0}\n                  className={i === 0 ? cn('fill-background', STROKE[tones[i]!]) : FILL[tones[i]!]}\n                />\n              </svg>\n              <span className=\"text-foreground\">{s.label}</span>\n            </button>\n          </li>\n        ))}\n      </ul>\n\n      <ul ref={listRef} data-slot=\"dot-plot-rows\" className={cn('m-0 grid list-none gap-y-2 p-0', GRID)}>\n        {sorted.map(({ row, index }) => {\n          const known = series\n            .map((s, i) => ({ i, v: row.values[s.id] }))\n            .filter((d): d is { i: number; v: number } => finite(d.v));\n          const firstDot = known[0];\n          const lastDot = known.at(-1);\n          const endValue = row.values[endId];\n          return (\n            <li\n              key={`${row.label}-${index}`}\n              data-slot=\"dot-plot-row\"\n              className=\"col-span-full grid grid-cols-subgrid items-center gap-x-3\"\n            >\n              <span aria-hidden className=\"col-span-full flex min-w-0 flex-col @md/dots:col-span-1\">\n                <span className=\"text-foreground text-ui-sm break-words\">{row.label}</span>\n                {row.note ? <span className=\"text-muted-foreground text-caption\">{row.note}</span> : null}\n              </span>\n              <span className=\"relative block min-w-0 px-1.5\">\n                <svg\n                  aria-hidden\n                  width=\"100%\"\n                  height={ROW_HEIGHT}\n                  className=\"block h-6 w-full overflow-visible rtl:-scale-x-100\"\n                  onPointerMove={point}\n                  onPointerLeave={() => setHovered(null)}\n                >\n                  {ticks.map((t) => (\n                    <line\n                      key={t}\n                      x1={pct(t)}\n                      x2={pct(t)}\n                      y1={0}\n                      y2={ROW_HEIGHT}\n                      strokeWidth={1}\n                      className=\"stroke-border\"\n                    />\n                  ))}\n                  {firstDot && lastDot && firstDot !== lastDot ? (\n                    <line\n                      data-slot=\"dot-plot-link\"\n                      data-from={pct(firstDot.v)}\n                      x1={pct(firstDot.v)}\n                      x2={pct(lastDot.v)}\n                      y1={ROW_HEIGHT / 2}\n                      y2={ROW_HEIGHT / 2}\n                      strokeWidth={2}\n                      strokeLinecap=\"round\"\n                      className={cn(\n                        '[transform-box:view-box] stroke-muted-foreground/60',\n                        active !== null && 'opacity-40',\n                      )}\n                    />\n                  ) : null}\n                  {known.map(({ i, v }) => (\n                    <circle\n                      key={i}\n                      data-slot=\"dot-plot-dot\"\n                      data-series={i}\n                      data-later={i > 0 ? '' : undefined}\n                      cx={pct(v)}\n                      cy={ROW_HEIGHT / 2}\n                      r={i === 0 ? R - 1 : R}\n                      strokeWidth={2}\n                      className={cn(\n                        'motion-safe:transition-opacity motion-safe:duration-(--duration-fast)',\n                        i === 0 ? cn('fill-background', STROKE[tones[i]!]) : cn(FILL[tones[i]!], 'stroke-background'),\n                        active !== null && i !== active && 'opacity-25',\n                      )}\n                    />\n                  ))}\n                </svg>\n              </span>\n              <span\n                data-slot=\"dot-plot-end\"\n                aria-hidden\n                className=\"text-foreground min-w-[4ch] text-end text-ui-sm font-medium tabular-nums\"\n              >\n                {finite(endValue) ? format(endValue) : '–'}\n              </span>\n              <span className=\"sr-only\">\n                {describeDotRow(row, series, format, labels.rowSentence)}\n                {row.note ? ` ${row.note}.` : ''}\n              </span>\n            </li>\n          );\n        })}\n        <li\n          aria-hidden\n          data-slot=\"dot-plot-axis\"\n          className=\"col-span-full grid grid-cols-subgrid gap-x-3 text-caption text-muted-foreground tabular-nums\"\n        >\n          <span className=\"hidden @md/dots:block\" />\n          <span className=\"block min-w-0 px-1.5\">\n            {/* Mirrored with the rows in a right-to-left page; each label is mirrored back so it reads. */}\n            <svg ref={axisRef} width=\"100%\" height=\"16\" className=\"block h-4 w-full overflow-visible rtl:-scale-x-100\">\n              {ticks.map((t, i) => (\n                <text\n                  key={t}\n                  x={pct(t)}\n                  y={12}\n                  textAnchor={i === 0 ? 'start' : i === ticks.length - 1 ? 'end' : 'middle'}\n                  className=\"fill-muted-foreground origin-center [transform-box:fill-box] rtl:-scale-x-100\"\n                >\n                  {format(t)}\n                </text>\n              ))}\n            </svg>\n          </span>\n          <span />\n        </li>\n      </ul>\n\n      <div data-slot=\"dot-plot-table\" className={cn(showTable ? 'overflow-x-auto' : 'sr-only')}>\n        <table className=\"w-full text-ui-sm tabular-nums\">\n          <caption className=\"text-muted-foreground pb-2 text-start text-caption\">\n            {labels.tableCaption(typeof label === 'string' ? label : undefined)}\n          </caption>\n          <thead>\n            <tr className=\"border-border border-b\">\n              <th scope=\"col\" className=\"py-1.5 pe-4 text-start font-medium\">\n                <span className=\"sr-only\">{labels.row}</span>\n              </th>\n              {series.map((s) => (\n                <th key={s.id} scope=\"col\" className=\"py-1.5 pe-4 text-end font-medium last:pe-0\">\n                  {s.label}\n                </th>\n              ))}\n            </tr>\n          </thead>\n          <tbody>\n            {sorted.map(({ row, index }) => (\n              <tr key={`${row.label}-${index}`} className=\"border-border border-b\">\n                <th scope=\"row\" className=\"py-1.5 pe-4 text-start font-normal\">\n                  {row.label}\n                </th>\n                {series.map((s) => {\n                  const v = row.values[s.id];\n                  return (\n                    <td key={s.id} className=\"py-1.5 pe-4 text-end last:pe-0\">\n                      {finite(v) ? format(v) : labels.noData}\n                    </td>\n                  );\n                })}\n              </tr>\n            ))}\n          </tbody>\n        </table>\n      </div>\n    </figure>\n  );\n});\nDotPlot.displayName = 'DotPlot';\n"
    }
  ],
  "meta": {
    "tier": "chart",
    "client": true,
    "minViewport": 320,
    "loading": true,
    "version": "1.2.1",
    "since": "2.0.0"
  },
  "docs": "## @interlace/dot-plot\n\nInstalled to `components/ui/charts/dot-plot.tsx`.\n\n```tsx\nimport { /* … */ } from '@/components/ui/charts/dot-plot';\n```\n\nProps, a11y contract, live preview and source: https://ds.interlace.tools/c/dot-plot\n\nRequires the `@interlace/interlace-base` CSS baseline (installed automatically as a registry dependency). For the Interlace look, also add `@interlace/theme`."
}
