{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "chart",
  "title": "Chart",
  "description": "Charts on recharts, as the reference: series colours by role from the data tokens (focal, comparison, rest, mark, alert) as --color-<key>; solid hairline grid, Code-voice ticks, square marks and keys, an inverse tooltip with tabular figures. ChartFigure adds a title and a Chart / Table switch over the same rows. RTL axes and reduced motion are applied for you.",
  "dependencies": [
    "@base-ui/react@1.9.0",
    "recharts@3.10.1"
  ],
  "registryDependencies": [
    "@keyline-ui/keyline",
    "@keyline-ui/table",
    "utils",
    "@keyline-ui/segmented",
    "@keyline-ui/keyline-scope",
    "@keyline-ui/keyline-render"
  ],
  "files": [
    {
      "path": "src/registry/keyline/ui/chart.tsx",
      "content": "\"use client\";\n\nimport * as React from \"react\";\nimport { mergeProps } from \"@base-ui/react/merge-props\";\nimport { useRender } from \"@base-ui/react/use-render\";\nimport * as Recharts from \"recharts\";\n\nimport { cn } from \"@/lib/utils\";\nimport { Segmented, SegmentedItem } from \"./segmented\";\nimport { Table, TableBody, TableCell, TableHead, TableHeader } from \"./table\";\nimport { domDir } from \"../lib/keyline-scope\";\nimport { resolveClassName, resolveStyle, type PartProps } from \"../lib/keyline-render\";\n\n/* Charts are recharts (as in shadcn and neobrutalism.dev): scales, shapes, keyboard (the accessibility\n   layer: Tab to the plot, arrows step through the points) and tooltips are the library's. Keyline adds:\n   - series colours by role from the data tokens (`--kl-data-1` focal, `-2` comparison, `-3` the rest,\n     `-mark`, `-alert`), written as `--color-<key>` so marks use `var(--color-<key>)` as in shadcn;\n   - the construction: recessive solid hairline grid, Code-voice ticks, square marks (no radius: a chart\n     never takes the cut), an inverse tooltip with tabular figures, square legend keys;\n   - a Table view of the same rows (ChartFigure), so no reading depends on colour or on seeing the plot;\n   - RTL (the category axis runs from the inline start, the value axis sits at the start edge) and reduced\n     motion (prefers-reduced-motion or data-kl-motion=\"reduce\" turns every series animation off). */\n\nexport type ChartConfig = Record<\n  string,\n  {\n    label?: React.ReactNode;\n    /** Any CSS colour; Keyline's roles are \"var(--kl-data-1)\" … Defaults by order: data-1, data-2, data-3. */\n    color?: string;\n    /** Unit printed after values in the tooltip and table, in the Code voice. */\n    unit?: string;\n  }\n>;\n\nconst ROLE = [\"var(--kl-data-1)\", \"var(--kl-data-2)\", \"var(--kl-data-3)\"];\n\n/** A data value as text: anything but a number is shown, and announced, by its string form. */\nfunction shown(v: unknown, empty: string): string {\n  // oxlint-disable-next-line typescript/no-base-to-string -- see above; a data value has no better text\n  return String(v ?? empty);\n}\n\n/** The text a screen reader hears for a label: a string or number as is; an element has no text to read. */\nfunction spoken(n: React.ReactNode): string {\n  return typeof n === \"string\" || typeof n === \"number\" ? String(n) : \"\";\n}\n\nconst ChartContext = React.createContext<{\n  config: ChartConfig;\n  format: (v: number) => string;\n  announce: (text: string) => void;\n} | null>(null);\n\nfunction useChart() {\n  const ctx = React.useContext(ChartContext);\n  if (!ctx) throw new Error(\"useChart must be used within a <ChartContainer />\");\n  return ctx;\n}\n\nconst SERIES = new Set<unknown>([\n  Recharts.Bar,\n  Recharts.Line,\n  Recharts.Area,\n  Recharts.Pie,\n  Recharts.Scatter,\n  Recharts.Radar,\n  Recharts.RadialBar,\n]);\n\n/** Walks the composed chart and sets what the reader's settings ask for, unless the author set it. */\nfunction adapt(node: React.ReactNode, o: { still: boolean; rtl: boolean }): React.ReactNode {\n  return React.Children.map(node, (el) => {\n    if (!React.isValidElement(el)) return el;\n    const p = el.props as Record<string, unknown> & { children?: React.ReactNode };\n    const extra: Record<string, unknown> = {};\n    if (o.still && SERIES.has(el.type) && p[\"isAnimationActive\"] === undefined) extra[\"isAnimationActive\"] = false;\n    // an Operate chart updates, it does not perform: data changes and the first draw take the unfold time, not\n    // recharts' 1.5s (switching Table → Chart replayed a 1.5s line draw every time)\n    else if (SERIES.has(el.type) && p[\"animationDuration\"] === undefined) extra[\"animationDuration\"] = 220;\n    if (o.rtl && el.type === Recharts.XAxis && p[\"reversed\"] === undefined) extra[\"reversed\"] = true;\n    if (o.rtl && el.type === Recharts.YAxis && p[\"orientation\"] === undefined) extra[\"orientation\"] = \"right\";\n    const kids = p.children !== undefined && typeof p.children !== \"function\" ? adapt(p.children, o) : undefined;\n    return Object.keys(extra).length || kids !== undefined\n      ? React.cloneElement(el, extra, ...(kids !== undefined ? [kids] : []))\n      : el;\n  });\n}\n\n/* ------------------------------------------------------------------ *\n * CLASSES\n * recharts draws the plot's SVG; Keyline sets the chrome around the marks through the library's own class names,\n * from the container. kl-type keeps each root the outermost Keyline element (it carries Keyline's type and ink).\n * ------------------------------------------------------------------ */\n\nconst plot = cn(\n  \"kl-type relative aspect-video w-full min-w-0 text-[11px]\",\n  \"[&_.recharts-surface]:[outline:0] [&_.recharts-wrapper]:[outline:0]\",\n  // recharts lays out in physical coordinates and mirrors through the axes (ChartContainer reverses them in RTL); an\n  // inherited rtl direction would also flip every SVG text-anchor, pushing labels into the marks\n  \"[&_.recharts-surface]:[direction:ltr]\",\n  // the accessibility layer makes the plot one tab stop; its ring is the system's focus ring\n  \"[&_.recharts-wrapper:has(.recharts-surface:focus-visible)]:[outline:var(--kl-ring)_solid_var(--kl-focus)]\",\n  \"[&_.recharts-wrapper:has(.recharts-surface:focus-visible)]:outline-offset-(--kl-ring-out)\",\n  \"[&_.recharts-wrapper:focus-visible]:[outline:var(--kl-ring)_solid_var(--kl-focus)]\",\n  \"[&_.recharts-wrapper:focus-visible]:outline-offset-(--kl-ring-out)\",\n  // ticks are the Code voice in supporting ink; never the series colour\n  \"[&_:is(.recharts-cartesian-axis-tick-value,.recharts-polar-angle-axis-tick-value,.recharts-label)]:fill-kl-ink-3\",\n  \"[&_:is(.recharts-cartesian-axis-tick-value,.recharts-polar-angle-axis-tick-value,.recharts-label)]:font-(family-name:--kl-font-mono)\",\n  \"[&_:is(.recharts-cartesian-axis-tick-value,.recharts-polar-angle-axis-tick-value,.recharts-label)]:text-[11px]\",\n  \"[&_:is(.recharts-cartesian-axis-tick-value,.recharts-polar-angle-axis-tick-value,.recharts-label)]:font-medium\",\n  \"[&_:is(.recharts-cartesian-axis-tick-value,.recharts-polar-angle-axis-tick-value,.recharts-label)]:tabular-nums\",\n  // recessive structure: solid hairlines, one shade off the surface; the baseline is the one ink rule\n  \"[&_:is(.recharts-cartesian-grid_line,.recharts-polar-grid_:is(line,polygon,circle))]:stroke-kl-line-soft\",\n  \"[&_:is(.recharts-cartesian-grid_line,.recharts-polar-grid_:is(line,polygon,circle))]:[stroke-dasharray:none]\",\n  \"[&_.recharts-cartesian-axis-line]:stroke-kl-line [&_.recharts-cartesian-axis-tick-line]:stroke-kl-line-soft\",\n  \"[&_.recharts-reference-line_line]:stroke-kl-ink-2\",\n  // hover: the category band is a tint (bars); the crosshair a hairline in supporting ink (lines, areas)\n  \"[&_.recharts-tooltip-cursor:is(.recharts-rectangle,path[fill]:not([fill=none]))]:fill-kl-tint\",\n  \"[&_.recharts-tooltip-cursor:is(.recharts-curve,line)]:stroke-kl-ink-3\",\n  \"[&_.recharts-tooltip-cursor:is(.recharts-curve,line)]:stroke-1\",\n  // markers sit on a 2px surface ring, so they read over a crossing line\n  \"[&_:is(.recharts-active-dot_circle,.recharts-dot)]:stroke-kl-cell [&_:is(.recharts-active-dot_circle,.recharts-dot)]:stroke-2\",\n  // adjacent fills (slices; stacked segments when the container has data-kl-stack) are split by a 2px surface gap\n  \"[&_.recharts-sector]:stroke-kl-cell [&_.recharts-sector]:stroke-2 [&_.recharts-sector:focus-visible]:[outline:0]\",\n  \"data-kl-stack:[&_.recharts-bar-rectangle_path]:stroke-kl-cell data-kl-stack:[&_.recharts-bar-rectangle_path]:stroke-2\",\n  \"[&_.recharts-default-legend]:hidden [&_.recharts-tooltip-wrapper]:z-2\",\n);\n\n/* legend and keys: squares (a chart never takes the cut, and keys match the square marks) */\nconst key_ = cn(\n  \"inline-block size-2.5 flex-none\",\n  \"forced-colors:outline-1 forced-colors:outline-[CanvasText] forced-colors:[forced-color-adjust:none] forced-colors:outline-solid\",\n);\n\n/* tooltip: the inverse surface (as Tooltip), figures tabular and end-aligned */\nconst tip = cn(\n  \"grid max-w-[260px] min-w-[140px] grid-cols-[auto_1fr_auto] gap-x-2 gap-y-[3px] px-2.5 pt-[7px] pb-2\",\n  \"bg-kl-inverse font-(family-name:--kl-font) text-[13px]/[1.3] text-kl-on-inverse tabular-nums\",\n  \"forced-colors:border forced-colors:border-[CanvasText]\",\n);\nconst tipHead = cn(\n  \"col-span-full mb-0.5 border-b-(length:--kl-k1) border-b-[color-mix(in_oklab,var(--kl-on-inverse)_35%,transparent)] pb-1\",\n  \"font-(family-name:--kl-font-mono) text-[11px]/[1.2] font-medium not-italic normal-nums\",\n);\nconst unit = \"font-(family-name:--kl-font-mono) text-[11px]/none font-medium normal-nums not-italic opacity-85\";\n\n/* figure: a title row with the Chart / Table switch; the view below */\nconst figure = \"kl-type m-0 grid min-w-0 gap-3\";\n\nconst table = cn(\n  \"kl-type overflow-x-auto border-(length:--kl-k1) border-kl-line\",\n  \"[&_tbody_tr:last-child>*]:border-b-0\",\n);\n\ntype ChartContainerState = Record<string, never>;\nconst PART_STATE: ChartContainerState = {};\n\ntype ChartContainerProps = Omit<PartProps<\"div\", ChartContainerState>, \"children\"> & {\n  config: ChartConfig;\n  /** A recharts chart (BarChart, LineChart, AreaChart …). */\n  children: React.ReactElement;\n  /** Formats values in the tooltip and table. Default: the locale's grouping, at most two decimals. */\n  format?: (v: number) => string;\n  locale?: string;\n};\n\n/**\n * The plot area. Sized by CSS (default aspect 16/9; set a height or aspect-ratio with className or style).\n * Name it: `aria-label`, or `aria-labelledby` pointing at a visible title (ChartFigure does this).\n */\nfunction ChartContainer({\n  config,\n  children,\n  render,\n  className,\n  style,\n  format,\n  locale,\n  \"aria-label\": label,\n  \"aria-labelledby\": labelledBy,\n  ...props\n}: ChartContainerProps): React.ReactElement {\n  const ref = React.useRef<HTMLDivElement>(null);\n  const live = React.useRef<HTMLSpanElement>(null);\n  const hint = React.useId();\n  // the tooltip is drawn for pointer and keyboard alike; it is read out only while focus is on the plot,\n  // so arrowing through the points announces each category's figures\n  const announce = React.useCallback((text: string) => {\n    if (live.current && ref.current?.contains(document.activeElement) && live.current.textContent !== text)\n      live.current.textContent = text;\n  }, []);\n  // first guess from the page, so a reduced-motion or RTL page does not draw (and start animating) twice\n  const [env, setEnv] = React.useState(() =>\n    typeof document === \"undefined\"\n      ? { still: false, rtl: false }\n      : {\n          still:\n            window.matchMedia(\"(prefers-reduced-motion: reduce)\").matches ||\n            document.documentElement.dataset[\"klMotion\"] === \"reduce\",\n          rtl: document.documentElement.dir === \"rtl\",\n        },\n  );\n  React.useLayoutEffect(() => {\n    const el = ref.current;\n    if (!el) return;\n    const read = () => {\n      const still =\n        window.matchMedia(\"(prefers-reduced-motion: reduce)\").matches || !!el.closest('[data-kl-motion=\"reduce\"]');\n      const rtl = domDir(el) === \"rtl\";\n      setEnv((e) => (e.still === still && e.rtl === rtl ? e : { still, rtl }));\n    };\n    read();\n    const mq = window.matchMedia(\"(prefers-reduced-motion: reduce)\");\n    mq.addEventListener(\"change\", read);\n    // the motion and direction settings are attributes on an ancestor; follow them if they change\n    const mo = new MutationObserver(read);\n    mo.observe(document.documentElement, {\n      attributes: true,\n      subtree: true,\n      attributeFilter: [\"data-kl-motion\", \"dir\"],\n    });\n    return () => {\n      mq.removeEventListener(\"change\", read);\n      mo.disconnect();\n    };\n  }, []);\n  const vars = Object.fromEntries(\n    Object.entries(config).map(([k, c], i) => [`--color-${k}`, c.color ?? ROLE[Math.min(i, ROLE.length - 1)]]),\n  );\n  const fmt = React.useMemo(\n    () => format ?? ((v: number) => new Intl.NumberFormat(locale, { maximumFractionDigits: 2 }).format(v)),\n    [format, locale],\n  );\n  const chart = React.Children.toArray(adapt(children, env))[0] as React.ReactElement<\n    Record<string, string | undefined>\n  >;\n  const own = {\n    \"data-slot\": \"chart\",\n    className: resolveClassName(plot, className)(PART_STATE),\n    style: resolveStyle(vars as React.CSSProperties, style)(PART_STATE),\n    children: (\n      <>\n        <Recharts.ResponsiveContainer initialDimension={{ width: 320, height: 180 }}>\n          {/* the plot is the library's one tab stop (role application); it carries the chart's name */}\n          {React.cloneElement(chart, {\n            \"aria-label\": chart.props[\"aria-label\"] ?? label,\n            \"aria-labelledby\": chart.props[\"aria-labelledby\"] ?? labelledBy,\n            \"aria-describedby\": chart.props[\"aria-describedby\"] ?? hint,\n          })}\n        </Recharts.ResponsiveContainer>\n        <span className=\"kl-sr\" id={hint}>\n          Arrow keys step through the points.\n        </span>\n        <span className=\"kl-sr\" role=\"status\" ref={live} />\n      </>\n    ),\n  };\n  const el = useRender({ defaultTagName: \"div\", render, ref, state: PART_STATE, props: mergeProps<\"div\">(props, own) });\n  return <ChartContext.Provider value={{ config, format: fmt, announce }}>{el}</ChartContext.Provider>;\n}\n\nconst ChartTooltip = Recharts.Tooltip;\n\ntype TooltipItem = {\n  dataKey?: string | number | ((o: unknown) => unknown);\n  name?: string | number;\n  value?: unknown;\n  color?: string;\n  payload?: Record<string, unknown>;\n};\n\n/** The tooltip body: the category in the Code voice, then one row per series (key, name, figure). */\nfunction ChartTooltipContent({\n  active,\n  payload,\n  label,\n  hideLabel,\n  labelFormatter,\n  nameKey,\n  className,\n}: {\n  active?: boolean;\n  payload?: readonly TooltipItem[];\n  label?: React.ReactNode;\n  hideLabel?: boolean;\n  labelFormatter?: (label: React.ReactNode, payload: readonly TooltipItem[]) => React.ReactNode;\n  /** For one-series-per-row data (pie): the row field that names the item. */\n  nameKey?: string;\n  className?: string;\n}) {\n  const { config, format, announce } = useChart();\n  const said =\n    active && payload?.length\n      ? [\n          spoken(label),\n          ...payload.map((it) =>\n            `${spoken(config[String(it.dataKey)]?.label ?? it.name)} ${typeof it.value === \"number\" ? format(it.value) : shown(it.value, \"–\")} ${config[String(it.dataKey)]?.unit ?? \"\"}`.trim(),\n          ),\n        ]\n          .filter((x) => x !== \"\")\n          .join(\", \")\n      : \"\";\n  React.useEffect(() => {\n    if (said) announce(said);\n  }, [said, announce]);\n  if (!active || !payload?.length) return null;\n  const head = hideLabel ? null : labelFormatter ? labelFormatter(label, payload) : label;\n  return (\n    <div data-slot=\"chart-tooltip\" className={cn(tip, className)}>\n      {head != null && head !== \"\" ? (\n        <div data-slot=\"chart-tooltip-label\" className={tipHead}>\n          {head}\n        </div>\n      ) : null}\n      {payload.map((it, i) => {\n        const key = String(nameKey ? it.payload?.[nameKey] : (it.dataKey ?? it.name ?? i));\n        const c = config[key];\n        const v = typeof it.value === \"number\" ? format(it.value) : shown(it.value, \"–\");\n        return (\n          <div data-slot=\"chart-tooltip-item\" className=\"contents\" key={key + i}>\n            <span\n              data-slot=\"chart-key\"\n              className={cn(key_, \"self-center shadow-[0_0_0_1px_var(--kl-on-inverse)]\")}\n              style={{ background: c?.color ?? `var(--color-${key}, ${it.color})` }}\n              aria-hidden\n            />\n            <span data-slot=\"chart-tooltip-name\" className=\"min-w-0 truncate\">\n              {c?.label ?? it.name ?? key}\n            </span>\n            <span data-slot=\"chart-tooltip-value\" className=\"text-end font-(--kl-weight-strong) whitespace-nowrap\">\n              {v}\n              {c?.unit ? <span className={unit}> {c.unit}</span> : null}\n            </span>\n          </div>\n        );\n      })}\n    </div>\n  );\n}\n\nconst ChartLegend = Recharts.Legend;\n\n/** Square keys with the series names, in config order. Recharts passes `payload`; without it, the config is the legend. */\nfunction ChartLegendContent({\n  payload,\n  className,\n}: {\n  payload?: readonly { dataKey?: unknown; value?: unknown }[];\n  className?: string;\n}) {\n  const { config } = useChart();\n  // config order, so a stacked chart's legend reads in the author's order whatever order recharts draws\n  const shown = new Set(payload?.map((p) => String(p.dataKey ?? p.value)));\n  const keys = payload?.length\n    ? [...Object.keys(config).filter((k) => shown.has(k)), ...[...shown].filter((k) => !(k in config))]\n    : Object.keys(config);\n  return (\n    <ul\n      data-slot=\"chart-legend\"\n      className={cn(\n        \"m-0 flex list-none flex-wrap justify-center gap-x-4 gap-y-1 p-0 pt-2 text-[13px] text-kl-ink-2\",\n        className,\n      )}\n    >\n      {keys.map((k) => (\n        <li key={k} data-slot=\"chart-legend-item\" className=\"inline-flex items-center gap-1.5\">\n          <span data-slot=\"chart-key\" className={key_} style={{ background: `var(--color-${k})` }} aria-hidden />\n          {config[k]?.label ?? k}\n        </li>\n      ))}\n    </ul>\n  );\n}\n\ntype ChartTableProps = PartProps<\"div\", ChartContainerState> & {\n  data: readonly Record<string, unknown>[];\n  config: ChartConfig;\n  /** The row field that names each category (the x axis). */\n  labelKey: string;\n  /** Header of the category column. */\n  labelHeader?: React.ReactNode;\n  caption?: React.ReactNode;\n  format?: (v: number) => string;\n  locale?: string;\n};\n\n/** The same rows as a table: a category column, then one column per series, figures right-aligned. */\nfunction ChartTable({\n  data,\n  config,\n  labelKey,\n  labelHeader,\n  caption,\n  format,\n  locale,\n  render,\n  className,\n  style,\n  ...props\n}: ChartTableProps): React.ReactElement {\n  const fmt = format ?? ((v: number) => new Intl.NumberFormat(locale, { maximumFractionDigits: 2 }).format(v));\n  const keys = Object.keys(config);\n  const body = (\n    <Table className=\"text-[13px]\">\n      {caption ? <caption className=\"kl-sr\">{caption}</caption> : null}\n      <TableHeader>\n        <tr>\n          <TableHead scope=\"col\">{labelHeader ?? labelKey}</TableHead>\n          {Object.entries(config).map(([k, c]) => (\n            <TableHead align=\"end\" scope=\"col\" key={k}>\n              <span\n                data-slot=\"chart-key\"\n                className={cn(key_, \"me-1.5 align-[-1px]\")}\n                style={{ background: c.color ?? ROLE[Math.min(keys.indexOf(k), ROLE.length - 1)] }}\n                aria-hidden\n              />\n              {c.label ?? k}\n              {c.unit ? <span className=\"kl-code\"> {c.unit}</span> : null}\n            </TableHead>\n          ))}\n        </tr>\n      </TableHeader>\n      <TableBody>\n        {data.map((row, i) => (\n          <tr key={i}>\n            <TableCell render={<th scope=\"row\" />} className=\"text-start font-normal\">\n              {shown(row[labelKey], \"\")}\n            </TableCell>\n            {keys.map((k) => (\n              <TableCell align=\"end\" key={k}>\n                {typeof row[k] === \"number\" ? fmt(row[k] as number) : shown(row[k], \"–\")}\n              </TableCell>\n            ))}\n          </tr>\n        ))}\n      </TableBody>\n    </Table>\n  );\n  const own = {\n    \"data-slot\": \"chart-table\",\n    className: resolveClassName(table, className)(PART_STATE),\n    style: resolveStyle(undefined, style)(PART_STATE),\n    children: body,\n  };\n  return useRender({ defaultTagName: \"div\", render, state: PART_STATE, props: mergeProps<\"div\">(props, own) });\n}\n\ntype ChartFigureProps = Omit<PartProps<\"figure\", ChartContainerState>, \"title\"> & {\n  title: React.ReactNode;\n  description?: React.ReactNode;\n  /** The rows behind the chart, for the Table view. */\n  data: readonly Record<string, unknown>[];\n  config: ChartConfig;\n  labelKey: string;\n  labelHeader?: React.ReactNode;\n  format?: (v: number) => string;\n  locale?: string;\n  /** Starting view. */\n  defaultView?: \"chart\" | \"table\";\n  /** The plot (a ChartContainer); it is named by the title. */\n  children: React.ReactElement<ChartContainerProps>;\n};\n\n/**\n * A titled chart with a Chart / Table switch. The table carries the same rows, so every value is\n * readable without the plot (screen readers, forced colours, print, copying figures).\n */\nfunction ChartFigure({\n  title,\n  description,\n  data,\n  config,\n  labelKey,\n  labelHeader,\n  format,\n  locale,\n  defaultView = \"chart\",\n  children,\n  render,\n  className,\n  style,\n  ...props\n}: ChartFigureProps): React.ReactElement {\n  const [view, setView] = React.useState(defaultView);\n  const id = React.useId();\n  const body = (\n    <>\n      <figcaption data-slot=\"chart-figure-caption\" className=\"flex flex-wrap items-start gap-3\">\n        <span className=\"grid min-w-0 flex-[1_1_200px] gap-0.5\">\n          <span data-slot=\"chart-figure-title\" className=\"text-[15px]/[1.25] font-(--kl-weight-strong)\" id={`${id}t`}>\n            {title}\n          </span>\n          {description ? (\n            <span data-slot=\"chart-figure-description\" className=\"text-[13px] text-kl-ink-2\">\n              {description}\n            </span>\n          ) : null}\n        </span>\n        <Segmented size=\"compact\" value={view} onValueChange={(v) => setView(v as \"chart\" | \"table\")} aria-label=\"View\">\n          <SegmentedItem value=\"chart\">Chart</SegmentedItem>\n          <SegmentedItem value=\"table\">Table</SegmentedItem>\n        </Segmented>\n      </figcaption>\n      {view === \"chart\" ? (\n        React.cloneElement(children, {\n          \"aria-labelledby\": children.props[\"aria-labelledby\"] ?? `${id}t`,\n        } as Partial<ChartContainerProps>)\n      ) : (\n        <ChartTable\n          data={data}\n          config={config}\n          labelKey={labelKey}\n          labelHeader={labelHeader}\n          caption={title}\n          format={format}\n          locale={locale}\n        />\n      )}\n    </>\n  );\n  const own = {\n    \"data-slot\": \"chart-figure\",\n    className: resolveClassName(figure, className)(PART_STATE),\n    style: resolveStyle(undefined, style)(PART_STATE),\n    children: body,\n  };\n  // the title names the figure unless the consumer names it\n  return useRender({\n    defaultTagName: \"figure\",\n    render,\n    state: PART_STATE,\n    props: mergeProps<\"figure\">({ \"aria-labelledby\": `${id}t` }, props, own),\n  });\n}\n\nexport {\n  ChartContainer,\n  ChartTooltip,\n  ChartTooltipContent,\n  ChartLegend,\n  ChartLegendContent,\n  ChartTable,\n  ChartFigure,\n  useChart,\n};\n",
      "type": "registry:ui",
      "target": "components/keyline/ui/chart.tsx"
    }
  ],
  "type": "registry:ui"
}