{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "ds-bar-chart",
  "title": "Bar Chart",
  "description": "A fully featured bar chart with tooltips, legend, stacking, rounded corners, and brush zoom.",
  "dependencies": [
    "recharts",
    "class-variance-authority",
    "lucide-react"
  ],
  "registryDependencies": [
    "@lema-ds/skeleton",
    "@lema-ds/ui-i18n",
    "@lema-ds/format-utils",
    "@lema-ds/chart-axis-width",
    "@lema-ds/ds-locale-provider"
  ],
  "files": [
    {
      "path": "components/ds/ds-bar-chart.tsx",
      "content": "\"use client\"\n\nimport * as React from \"react\"\nimport {\n  Bar,\n  BarChart as RechartsBarChart,\n  Brush,\n  CartesianGrid,\n  Legend,\n  ResponsiveContainer,\n  Tooltip,\n  XAxis,\n  YAxis,\n} from \"recharts\"\nimport { cva } from \"class-variance-authority\"\nimport { BarChart2 } from \"lucide-react\"\nimport { cn } from \"@/lib/utils\"\nimport { Skeleton } from \"@/components/ui/skeleton\"\nimport { UI_I18N, type UILocale } from \"@/lib/ui-i18n\"\nimport { useUILocale } from \"@/components/ui/ds-locale-provider\"\nimport { formatChartValue, type FormatPreset } from \"@/lib/format-utils\"\nimport { measureAxisWidth } from \"@/lib/chart-axis-width\"\n\n// ── Types ──────────────────────────────────────────────────────────────────\n\nexport type BarOrientation = \"vertical\" | \"horizontal\"\nexport type LegendPosition = \"top\" | \"bottom\" | \"left\" | \"right\"\n\nexport interface BarChartKey {\n  key: string\n  label?: string\n  /** Defaults to the next --chart-N token */\n  color?: string\n}\n\nexport interface BarChartProps extends React.HTMLAttributes<HTMLDivElement> {\n  data: Record<string, string | number>[]\n  /** Keys to render as bars — accepts plain strings or { key, label, color } */\n  dataKeys: BarChartKey[] | string[]\n  /** Object key mapped to the category axis (X on vertical, Y on horizontal) */\n  categoryKey: string\n  title?: string\n  subtitle?: string\n  footer?: React.ReactNode\n  /** \"vertical\" = bars point up (default); \"horizontal\" = bars point right */\n  orientation?: BarOrientation\n  /** Chart canvas height in px — container width is always 100% */\n  height?: number\n  showGrid?: boolean\n  showLegend?: boolean\n  /** @default \"bottom\" */\n  legendPosition?: LegendPosition\n  showTooltip?: boolean\n  /** Stack all bars into a single column/row */\n  stacked?: boolean\n  /** Fixed bar thickness in px; recharts auto-sizes when omitted */\n  barSize?: number\n  /** Round the leading edge of each bar */\n  rounded?: boolean\n  /** Format the value axis tick labels and tooltip values */\n  valueFormatter?: (value: number) => string\n  /**\n   * Show a range brush below the chart to scroll and zoom the category axis.\n   * Works with vertical orientation only. The brush occupies ~30 px of the\n   * chart height, so increase `height` accordingly when enabling.\n   */\n  showBrush?: boolean\n  format?: FormatPreset\n  decimals?: number\n  currency?: string\n  abbreviate?: boolean\n  /** Show animated skeleton in place of the chart while data loads */\n  loading?: boolean\n  locale?: UILocale\n  /** Label centred on the horizontal (category/value) axis */\n  xAxisLabel?: string\n  /** Label centred on the vertical (value/category) axis */\n  yAxisLabel?: string\n}\n\n// ── Constants ──────────────────────────────────────────────────────────────\n\nconst CHART_COLORS = [\n  \"var(--chart-1)\",\n  \"var(--chart-2)\",\n  \"var(--chart-3)\",\n  \"var(--chart-4)\",\n  \"var(--chart-5)\",\n]\n\nconst CORNER_RADIUS = 4\n\nconst LEGEND_LAYOUT: Record<\n  LegendPosition,\n  {\n    verticalAlign: \"top\" | \"middle\" | \"bottom\"\n    align: \"left\" | \"center\" | \"right\"\n    layout: \"horizontal\" | \"vertical\"\n  }\n> = {\n  top: { verticalAlign: \"top\", align: \"center\", layout: \"horizontal\" },\n  bottom: { verticalAlign: \"bottom\", align: \"center\", layout: \"horizontal\" },\n  left: { verticalAlign: \"middle\", align: \"left\", layout: \"vertical\" },\n  right: { verticalAlign: \"middle\", align: \"right\", layout: \"vertical\" },\n}\n\n// ── Skeleton ───────────────────────────────────────────────────────────────\n\n// Vertical orientation skeleton data\nconst SKELETON_BAR_HEIGHTS = [45, 72, 54, 86, 38, 78, 62, 50]\nconst SKELETON_YAXIS_WIDTHS = [28, 20, 24, 18]\nconst SKELETON_XAXIS_WIDTHS = [28, 36, 24, 32, 28, 20, 34, 26]\n\n// Horizontal orientation skeleton data\nconst SKELETON_H_BAR_WIDTHS = [65, 42, 78, 35, 55, 82, 48]\nconst SKELETON_H_YAXIS_WIDTHS = [52, 40, 60, 44, 56, 36, 50]\nconst SKELETON_H_XAXIS_WIDTHS = [24, 20, 28, 18, 24]\n\ninterface BarChartSkeletonProps {\n  height?: number\n  hasTitle?: boolean\n  hasSubtitle?: boolean\n  hasFooter?: boolean\n  orientation?: BarOrientation\n  className?: string\n}\n\nfunction BarChartSkeleton({\n  height = 280,\n  hasTitle = false,\n  hasSubtitle = false,\n  hasFooter = false,\n  orientation = \"vertical\",\n  className,\n}: BarChartSkeletonProps) {\n  return (\n    <div\n      className={cn(\"flex w-full flex-col\", className)}\n      data-slot=\"bar-chart-skeleton\"\n    >\n      {(hasTitle || hasSubtitle) && (\n        <div className=\"flex flex-col gap-1.5 px-1 pb-4\">\n          {hasTitle && (\n            <Skeleton\n              className=\"h-3.5 w-44 rounded-md\"\n              style={{ animationDelay: \"0s\" }}\n            />\n          )}\n          {hasSubtitle && (\n            <Skeleton\n              className=\"mt-0.5 h-2.5 w-28 rounded-md\"\n              style={{ animationDelay: \"0.1s\" }}\n            />\n          )}\n        </div>\n      )}\n\n      {orientation === \"horizontal\" ? (\n        <div className=\"relative overflow-hidden\" style={{ height }}>\n          {/* Faint vertical grid lines */}\n          <div className=\"pointer-events-none absolute top-2 right-1 bottom-8 left-[92px] flex flex-row justify-around\">\n            {SKELETON_H_XAXIS_WIDTHS.map((_, i) => (\n              <Skeleton\n                key={i}\n                className=\"h-full w-px opacity-70\"\n                style={{ animationDelay: `${0.6 + i * 0.15}s` }}\n              />\n            ))}\n          </div>\n\n          {/* Y-axis category labels */}\n          <div className=\"absolute top-2 bottom-8 left-0 flex w-22 flex-col items-end justify-around pr-2\">\n            {SKELETON_H_YAXIS_WIDTHS.map((w, i) => (\n              <Skeleton\n                key={i}\n                className=\"h-2.5 rounded-sm\"\n                style={{ width: w, animationDelay: `${0.5 + i * 0.1}s` }}\n              />\n            ))}\n          </div>\n\n          {/* Horizontal bars — cascade top to bottom */}\n          <div className=\"absolute top-2 right-1 bottom-8 left-[92px] flex flex-col justify-around gap-2 py-1\">\n            {SKELETON_H_BAR_WIDTHS.map((pct, i) => (\n              <Skeleton\n                key={i}\n                className=\"flex-1 rounded-r-sm\"\n                style={{\n                  width: `${pct}%`,\n                  animationDelay: `${i * 0.1}s`,\n                }}\n              />\n            ))}\n          </div>\n\n          {/* X-axis value tick labels */}\n          <div className=\"absolute right-1 bottom-0 left-[92px] flex h-7 items-center justify-around\">\n            {SKELETON_H_XAXIS_WIDTHS.map((w, i) => (\n              <Skeleton\n                key={i}\n                className=\"h-2.5 rounded-sm\"\n                style={{ width: w, animationDelay: `${0.05 + i * 0.1}s` }}\n              />\n            ))}\n          </div>\n        </div>\n      ) : (\n        <div className=\"relative overflow-hidden\" style={{ height }}>\n          {/* Faint horizontal grid lines */}\n          <div className=\"pointer-events-none absolute top-2 right-1 bottom-8 left-11 flex flex-col justify-around\">\n            {[0, 1, 2, 3].map((i) => (\n              <Skeleton\n                key={i}\n                className=\"h-px w-full opacity-70\"\n                style={{ animationDelay: `${0.6 + i * 0.15}s` }}\n              />\n            ))}\n          </div>\n\n          {/* Y-axis tick labels */}\n          <div className=\"absolute top-2 bottom-8 left-0 flex w-9 flex-col items-end justify-between pr-1\">\n            {SKELETON_YAXIS_WIDTHS.map((w, i) => (\n              <Skeleton\n                key={i}\n                className=\"h-2.5 rounded-sm\"\n                style={{ width: w, animationDelay: `${0.5 + i * 0.12}s` }}\n              />\n            ))}\n          </div>\n\n          {/* Bars — wave cascade from left to right */}\n          <div className=\"absolute top-2 right-1 bottom-8 left-11 flex items-end gap-2 px-1\">\n            {SKELETON_BAR_HEIGHTS.map((pct, i) => (\n              <Skeleton\n                key={i}\n                className=\"flex-1 rounded-t-sm\"\n                style={{\n                  height: `${pct}%`,\n                  animationDelay: `${i * 0.1}s`,\n                }}\n              />\n            ))}\n          </div>\n\n          {/* X-axis tick labels */}\n          <div className=\"absolute right-1 bottom-0 left-11 flex h-7 items-center justify-around\">\n            {SKELETON_XAXIS_WIDTHS.map((w, i) => (\n              <Skeleton\n                key={i}\n                className=\"h-2.5 rounded-sm\"\n                style={{ width: w, animationDelay: `${0.05 + i * 0.1}s` }}\n              />\n            ))}\n          </div>\n        </div>\n      )}\n\n      {hasFooter && (\n        <div className=\"mt-4 flex items-center gap-2 border-t border-border px-1 pt-3\">\n          <Skeleton\n            className=\"h-3.5 w-3.5 shrink-0 rounded-full\"\n            style={{ animationDelay: \"0.7s\" }}\n          />\n          <Skeleton\n            className=\"h-2.5 w-36 rounded-md\"\n            style={{ animationDelay: \"0.8s\" }}\n          />\n          <Skeleton\n            className=\"ml-auto h-2.5 w-20 rounded-md\"\n            style={{ animationDelay: \"0.9s\" }}\n          />\n        </div>\n      )}\n    </div>\n  )\n}\n\n// ── Variants ───────────────────────────────────────────────────────────────\n\nconst chartWrapperVariants = cva(\"flex w-full flex-col\")\n\nconst chartHeaderVariants = cva(\"flex flex-col px-1 pb-4\")\n\nconst chartTitleVariants = cva(\n  \"text-sm leading-tight font-semibold text-foreground\"\n)\n\nconst chartSubtitleVariants = cva(\"mt-0.5 text-xs text-muted-foreground\")\n\nconst chartFooterVariants = cva(\n  \"mt-4 flex items-center gap-2 border-t border-border px-1 pt-3 text-xs text-muted-foreground\"\n)\n\n// ── Custom Tooltip ─────────────────────────────────────────────────────────\n\ninterface TooltipPayloadEntry {\n  name: string\n  value: number\n  fill: string\n}\n\nfunction ChartTooltip({\n  active,\n  payload,\n  label,\n  fmt,\n}: {\n  active?: boolean\n  payload?: TooltipPayloadEntry[]\n  label?: string\n  fmt: (v: number) => string\n}) {\n  if (!active || !payload?.length) return null\n\n  return (\n    <div className=\"min-w-32 rounded-lg border border-border bg-card px-3 py-2 shadow-md\">\n      <p className=\"mb-1.5 text-xs font-semibold text-foreground\">{label}</p>\n      <div className=\"flex flex-col gap-1\">\n        {payload.map((entry) => (\n          <div key={entry.name} className=\"flex items-center gap-2\">\n            <span\n              className=\"inline-block size-2 shrink-0 rounded-sm\"\n              style={{ backgroundColor: entry.fill }}\n            />\n            <span className=\"text-xs text-muted-foreground\">{entry.name}</span>\n            <span className=\"ml-auto pl-6 text-xs font-semibold text-foreground tabular-nums\">\n              {fmt(entry.value)}\n            </span>\n          </div>\n        ))}\n      </div>\n    </div>\n  )\n}\n\n// ── Custom Legend ──────────────────────────────────────────────────────────\n\ninterface LegendPayloadEntry {\n  value: string\n  color: string\n}\n\nfunction ChartLegend({\n  payload,\n  hiddenSeries,\n  onToggle,\n  vertical = false,\n}: {\n  payload?: LegendPayloadEntry[]\n  hiddenSeries?: Set<string>\n  onToggle?: (name: string) => void\n  vertical?: boolean\n}) {\n  if (!payload?.length) return null\n\n  return (\n    <div\n      className={cn(\n        \"flex gap-y-1\",\n        vertical\n          ? \"flex-col px-2 py-1\"\n          : \"flex-wrap items-center justify-center gap-x-4 pt-3\"\n      )}\n    >\n      {payload.map((entry, i) => {\n        const hidden = hiddenSeries?.has(entry.value)\n        return (\n          <div\n            key={entry.value ?? i}\n            role=\"button\"\n            tabIndex={0}\n            aria-pressed={hidden}\n            aria-label={entry.value}\n            onClick={() => onToggle?.(entry.value)}\n            onKeyDown={(e) =>\n              (e.key === \"Enter\" || e.key === \" \") && onToggle?.(entry.value)\n            }\n            className={cn(\n              \"flex cursor-pointer items-center gap-1.5 rounded px-1 py-0.5 select-none\",\n              \"transition-opacity focus-visible:ring-1 focus-visible:ring-ring focus-visible:outline-none\",\n              hidden ? \"opacity-40\" : \"hover:opacity-70\"\n            )}\n          >\n            <span\n              className=\"inline-block size-2 shrink-0 rounded-sm\"\n              style={{ backgroundColor: entry.color }}\n            />\n            <span className=\"text-xs text-muted-foreground\">{entry.value}</span>\n          </div>\n        )\n      })}\n    </div>\n  )\n}\n\n// ── Helpers ────────────────────────────────────────────────────────────────\n\nfunction normalizeKeys(raw: BarChartKey[] | string[]): BarChartKey[] {\n  return raw.map((k, i) => {\n    const color = CHART_COLORS[i % CHART_COLORS.length]\n    if (typeof k === \"string\") return { key: k, label: k, color }\n    return { label: k.key, ...k, color: k.color ?? color }\n  })\n}\n\n// Custom traveller handle for recharts Brush — styled with semantic tokens\nfunction BrushHandle(props: {\n  x?: number\n  y?: number\n  width?: number\n  height?: number\n}): React.ReactElement {\n  const { x = 0, y = 0, width = 8, height = 30 } = props\n  const midY = y + height / 2\n  return (\n    <g>\n      <rect\n        x={x}\n        y={y + 5}\n        width={width}\n        height={height - 10}\n        rx={3}\n        fill=\"var(--card)\"\n        stroke=\"var(--border)\"\n        strokeWidth={1.5}\n      />\n      <line\n        x1={x + 2}\n        y1={midY - 3}\n        x2={x + width - 2}\n        y2={midY - 3}\n        stroke=\"var(--muted-foreground)\"\n        strokeWidth={1}\n        opacity={0.5}\n      />\n      <line\n        x1={x + 2}\n        y1={midY + 3}\n        x2={x + width - 2}\n        y2={midY + 3}\n        stroke=\"var(--muted-foreground)\"\n        strokeWidth={1}\n        opacity={0.5}\n      />\n    </g>\n  )\n}\n\nfunction barRadius(\n  orientation: BarOrientation,\n  index: number,\n  total: number,\n  stacked: boolean,\n  rounded: boolean\n): number | [number, number, number, number] {\n  if (!rounded) return 0\n  // For stacked charts only the last bar in the stack gets rounded corners\n  if (stacked && index < total - 1) return 0\n  const r = CORNER_RADIUS\n  return orientation === \"vertical\"\n    ? [r, r, 0, 0] // top-left, top-right, bottom-right, bottom-left\n    : [0, r, r, 0] // leading edge is the right side\n}\n\n// ── BarChart ───────────────────────────────────────────────────────────────\n\nexport function BarChart({\n  data,\n  dataKeys,\n  categoryKey,\n  title,\n  subtitle,\n  footer,\n  orientation = \"vertical\",\n  height = 280,\n  showGrid = true,\n  showLegend = false,\n  legendPosition = \"bottom\",\n  showTooltip = true,\n  stacked = false,\n  barSize,\n  rounded = true,\n  valueFormatter,\n  format,\n  decimals,\n  currency,\n  abbreviate,\n  showBrush = false,\n  loading = false,\n  locale: localeProp,\n  xAxisLabel,\n  yAxisLabel,\n  className,\n  ...props\n}: BarChartProps) {\n  const locale = useUILocale(localeProp)\n  // Hooks must be called unconditionally before any early returns\n  const fmt = React.useCallback(\n    (v: number) =>\n      formatChartValue(v, {\n        format,\n        decimals,\n        locale,\n        currency,\n        abbreviate,\n        valueFormatter,\n      }),\n    [valueFormatter, format, decimals, locale, currency, abbreviate]\n  )\n\n  const [hiddenSeries, setHiddenSeries] = React.useState<Set<string>>(new Set())\n  const toggleSeries = React.useCallback((name: string) => {\n    setHiddenSeries((prev) => {\n      const next = new Set(prev)\n      if (next.has(name)) next.delete(name)\n      else next.add(name)\n      return next\n    })\n  }, [])\n\n  // Stable identity across renders — an inline arrow function here would give Recharts'\n  // Legend a new `content` type every render, forcing it to unmount/remount the legend\n  // subtree instead of reconciling it (and dropping click events along the way).\n  const renderLegendContent = React.useCallback(\n    (props: { payload?: unknown }) => (\n      <ChartLegend\n        payload={props.payload as LegendPayloadEntry[]}\n        hiddenSeries={hiddenSeries}\n        onToggle={toggleSeries}\n        vertical={legendPosition === \"left\" || legendPosition === \"right\"}\n      />\n    ),\n    [hiddenSeries, toggleSeries, legendPosition]\n  )\n\n  if (loading) {\n    return (\n      <BarChartSkeleton\n        height={height}\n        hasTitle={!!title}\n        hasSubtitle={!!subtitle}\n        hasFooter={!!footer}\n        orientation={orientation}\n        className={className}\n      />\n    )\n  }\n\n  if (data.length === 0) {\n    return (\n      <div\n        className={cn(chartWrapperVariants(), className)}\n        data-slot=\"bar-chart\"\n        {...props}\n      >\n        {(title || subtitle) && (\n          <div className={chartHeaderVariants()} data-slot=\"bar-chart-header\">\n            {title && <p className={chartTitleVariants()}>{title}</p>}\n            {subtitle && <p className={chartSubtitleVariants()}>{subtitle}</p>}\n          </div>\n        )}\n        <div\n          className=\"flex flex-col items-center justify-center gap-3 rounded-lg border border-dashed border-border text-muted-foreground\"\n          data-slot=\"bar-chart-empty\"\n          style={{ height }}\n        >\n          <div className=\"flex size-10 items-center justify-center rounded-full bg-muted\">\n            <BarChart2 className=\"size-5\" />\n          </div>\n          <div className=\"text-center\">\n            <p className=\"text-sm font-medium text-foreground\">\n              {UI_I18N[locale].emptyState.noData}\n            </p>\n            <p className=\"mt-0.5 text-xs\">\n              {UI_I18N[locale].emptyState.dataWillAppear}\n            </p>\n          </div>\n        </div>\n        {footer && (\n          <div className={chartFooterVariants()} data-slot=\"bar-chart-footer\">\n            {footer}\n          </div>\n        )}\n      </div>\n    )\n  }\n\n  const keys = normalizeKeys(dataKeys)\n  const stackId = stacked ? \"stack\" : undefined\n\n  // recharts layout axis convention is inverted relative to user mental model\n  const rechartsLayout =\n    orientation === \"horizontal\" ? \"vertical\" : \"horizontal\"\n\n  const axisStyle = {\n    fontSize: \"12px\",\n    fill: \"var(--muted-foreground)\",\n  }\n\n  const axisLabelStyle = {\n    fontSize: \"11px\",\n    fill: \"var(--muted-foreground)\",\n  }\n\n  // Expand chart margins when axis labels are present to avoid clipping\n  const marginBottom = xAxisLabel ? 28 : 4\n  const marginLeft = yAxisLabel ? 8 : 4\n  // Sized from the actual formatted tick values (not a fixed guess) so\n  // abbreviated currency (\"R$ 800,0 mi\") never wraps or clips — see\n  // lib/chart-axis-width.ts. Only feeds the vertical-orientation value axis;\n  // horizontal orientation uses a fixed width for its category axis instead.\n  const yAxisValues = [\n    0,\n    ...data.flatMap((d) => keys.map((k) => Number(d[k.key]))),\n  ]\n  const yAxisWidth = measureAxisWidth(yAxisValues, fmt, {\n    padding: yAxisLabel ? 52 : 32,\n  })\n  const yAxisLabelOffset = yAxisLabel ? 0 : 10\n\n  return (\n    <div\n      className={cn(chartWrapperVariants(), className)}\n      data-slot=\"bar-chart\"\n      {...props}\n    >\n      {(title || subtitle) && (\n        <div className={chartHeaderVariants()} data-slot=\"bar-chart-header\">\n          {title && <p className={chartTitleVariants()}>{title}</p>}\n          {subtitle && <p className={chartSubtitleVariants()}>{subtitle}</p>}\n        </div>\n      )}\n\n      <ResponsiveContainer\n        width=\"100%\"\n        height={height}\n        data-slot=\"bar-chart-chart\"\n      >\n        <RechartsBarChart\n          data={data}\n          layout={rechartsLayout}\n          margin={{ top: 4, right: 4, bottom: marginBottom, left: marginLeft }}\n          barCategoryGap=\"30%\"\n        >\n          {showGrid && (\n            <CartesianGrid\n              strokeDasharray=\"3 3\"\n              stroke=\"var(--border)\"\n              horizontal={orientation === \"vertical\"}\n              vertical={orientation === \"horizontal\"}\n            />\n          )}\n\n          {orientation === \"vertical\" ? (\n            <>\n              <XAxis\n                dataKey={categoryKey}\n                tick={axisStyle}\n                axisLine={false}\n                tickLine={false}\n                dy={6}\n                label={\n                  xAxisLabel\n                    ? {\n                        value: xAxisLabel,\n                        position: \"insideBottom\",\n                        offset: -16,\n                        style: axisLabelStyle,\n                      }\n                    : undefined\n                }\n              />\n              <YAxis\n                tick={axisStyle}\n                axisLine={false}\n                tickLine={false}\n                tickFormatter={fmt}\n                width={yAxisWidth}\n                label={\n                  yAxisLabel\n                    ? {\n                        value: yAxisLabel,\n                        angle: -90,\n                        position: \"insideLeft\",\n                        offset: yAxisLabelOffset,\n                        style: { ...axisLabelStyle, textAnchor: \"middle\" },\n                      }\n                    : undefined\n                }\n              />\n            </>\n          ) : (\n            <>\n              <YAxis\n                dataKey={categoryKey}\n                type=\"category\"\n                tick={axisStyle}\n                axisLine={false}\n                tickLine={false}\n                width={90}\n                label={\n                  yAxisLabel\n                    ? {\n                        value: yAxisLabel,\n                        angle: -90,\n                        position: \"insideLeft\",\n                        offset: yAxisLabelOffset,\n                        style: { ...axisLabelStyle, textAnchor: \"middle\" },\n                      }\n                    : undefined\n                }\n              />\n              <XAxis\n                type=\"number\"\n                tick={axisStyle}\n                axisLine={false}\n                tickLine={false}\n                tickFormatter={fmt}\n                label={\n                  xAxisLabel\n                    ? {\n                        value: xAxisLabel,\n                        position: \"insideBottom\",\n                        offset: -16,\n                        style: axisLabelStyle,\n                      }\n                    : undefined\n                }\n              />\n            </>\n          )}\n\n          {showTooltip && (\n            <Tooltip\n              content={<ChartTooltip fmt={fmt} />}\n              cursor={{\n                fill: \"var(--muted)\",\n                opacity: 0.4,\n                radius: 4,\n              }}\n            />\n          )}\n\n          {showLegend && (\n            <Legend\n              {...LEGEND_LAYOUT[legendPosition]}\n              content={renderLegendContent}\n            />\n          )}\n\n          {keys.map((k, i) => (\n            <Bar\n              key={k.key}\n              dataKey={k.key}\n              name={k.label ?? k.key}\n              fill={k.color}\n              stackId={stackId}\n              barSize={barSize}\n              radius={barRadius(\n                orientation,\n                i,\n                keys.length,\n                stacked,\n                rounded ?? true\n              )}\n              hide={hiddenSeries.has(k.label ?? k.key)}\n            />\n          ))}\n\n          {showBrush && orientation === \"vertical\" && (\n            <Brush\n              dataKey={categoryKey}\n              height={30}\n              stroke=\"var(--border)\"\n              fill=\"var(--card)\"\n              travellerWidth={8}\n              traveller={(<BrushHandle />) as React.ReactElement<SVGElement>}\n              tickFormatter={(v) => (typeof v === \"string\" ? v : String(v))}\n            />\n          )}\n        </RechartsBarChart>\n      </ResponsiveContainer>\n\n      {footer && (\n        <div className={chartFooterVariants()} data-slot=\"bar-chart-footer\">\n          {footer}\n        </div>\n      )}\n    </div>\n  )\n}\n",
      "type": "registry:ui"
    }
  ],
  "type": "registry:ui"
}
