@acronis-platform/ui-react 5.4.5 → 5.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (58) hide show
  1. package/dist/components/ui/area-chart/area-chart.js +114 -113
  2. package/dist/components/ui/area-chart/area-chart.js.map +1 -1
  3. package/dist/components/ui/bar-chart/bar-chart.js +53 -49
  4. package/dist/components/ui/bar-chart/bar-chart.js.map +1 -1
  5. package/dist/components/ui/chart/chart.js +52 -45
  6. package/dist/components/ui/chart/chart.js.map +1 -1
  7. package/dist/components/ui/composed-chart/composed-chart.js +134 -130
  8. package/dist/components/ui/composed-chart/composed-chart.js.map +1 -1
  9. package/dist/components/ui/confidence-cone/confidence-cone.js +36 -35
  10. package/dist/components/ui/confidence-cone/confidence-cone.js.map +1 -1
  11. package/dist/components/ui/funnel-chart/funnel-chart.js +38 -37
  12. package/dist/components/ui/funnel-chart/funnel-chart.js.map +1 -1
  13. package/dist/components/ui/line-chart/line-chart.js +35 -34
  14. package/dist/components/ui/line-chart/line-chart.js.map +1 -1
  15. package/dist/components/ui/pie-chart/pie-chart.js +28 -27
  16. package/dist/components/ui/pie-chart/pie-chart.js.map +1 -1
  17. package/dist/components/ui/radar-chart/radar-chart.js +68 -65
  18. package/dist/components/ui/radar-chart/radar-chart.js.map +1 -1
  19. package/dist/components/ui/radial-bar-chart/radial-bar-chart.js +64 -63
  20. package/dist/components/ui/radial-bar-chart/radial-bar-chart.js.map +1 -1
  21. package/dist/components/ui/scatter-chart/scatter-chart.js +26 -26
  22. package/dist/components/ui/scatter-chart/scatter-chart.js.map +1 -1
  23. package/dist/components/ui/treemap/treemap.js +22 -22
  24. package/dist/components/ui/treemap/treemap.js.map +1 -1
  25. package/dist/llms/area-chart.md +1 -0
  26. package/dist/llms/bar-chart.md +1 -0
  27. package/dist/llms/chart.md +10 -0
  28. package/dist/llms/composed-chart.md +1 -0
  29. package/dist/llms/confidence-cone.md +1 -0
  30. package/dist/llms/funnel-chart.md +1 -0
  31. package/dist/llms/line-chart.md +1 -0
  32. package/dist/llms/pie-chart.md +1 -0
  33. package/dist/llms/radar-chart.md +1 -0
  34. package/dist/llms/radial-bar-chart.md +1 -0
  35. package/dist/llms/scatter-chart.md +1 -0
  36. package/dist/llms/treemap.md +1 -0
  37. package/dist/llms.txt +1 -1
  38. package/dist/src/components/ui/area-chart/area-chart.d.ts +6 -1
  39. package/dist/src/components/ui/bar-chart/bar-chart.d.ts +8 -2
  40. package/dist/src/components/ui/category-bar/category-bar.d.ts +1 -1
  41. package/dist/src/components/ui/chart/__stories__/palette-control.d.ts +16 -0
  42. package/dist/src/components/ui/chart/chart.d.ts +12 -1
  43. package/dist/src/components/ui/chart/index.d.ts +1 -1
  44. package/dist/src/components/ui/composed-chart/composed-chart.d.ts +6 -1
  45. package/dist/src/components/ui/confidence-cone/confidence-cone.d.ts +6 -1
  46. package/dist/src/components/ui/funnel-chart/funnel-chart.d.ts +6 -1
  47. package/dist/src/components/ui/grid/grid.d.ts +1 -1
  48. package/dist/src/components/ui/line-chart/line-chart.d.ts +6 -1
  49. package/dist/src/components/ui/pie-chart/pie-chart.d.ts +6 -1
  50. package/dist/src/components/ui/progress-circle/progress-circle.d.ts +1 -1
  51. package/dist/src/components/ui/radar-chart/radar-chart.d.ts +9 -1
  52. package/dist/src/components/ui/radial-bar-chart/radial-bar-chart.d.ts +6 -1
  53. package/dist/src/components/ui/scatter-chart/scatter-chart.d.ts +6 -1
  54. package/dist/src/components/ui/spinner/spinner.d.ts +1 -1
  55. package/dist/src/components/ui/stack/stack.d.ts +1 -1
  56. package/dist/src/components/ui/treemap/treemap.d.ts +6 -1
  57. package/dist/ui-react.css +1 -1
  58. package/package.json +3 -3
@@ -43,10 +43,11 @@ function ve({ content: e, dataKeys: t, ...n }) {
43
43
  };
44
44
  return e ? typeof e == "function" ? y.createElement(e, r) : y.cloneElement(e, r) : /* @__PURE__ */ x(l, { ...r });
45
45
  }
46
- function ye({ dataKeys: e, ...t }) {
46
+ function ye({ dataKeys: e, fontSize: t, ...n }) {
47
47
  return /* @__PURE__ */ x(s, {
48
- verticalAlign: t.verticalAlign,
49
- payload: A(k(t.payload, e))
48
+ verticalAlign: n.verticalAlign,
49
+ fontSize: t,
50
+ payload: A(k(n.payload, e))
50
51
  });
51
52
  }
52
53
  function j({ bar: e, track: t, trackFill: n, paint: r }) {
@@ -279,16 +280,16 @@ var I = y.forwardRef((t, n) => {
279
280
  ref: n
280
281
  });
281
282
  }
282
- let { className: T, config: E, palette: k, data: A, dataKeys: j, xKey: M, referenceLine: xe, referenceArea: N, barSettings: P, xAxisLabel: I, yAxisLabel: Ee, yUnit: De, orientation: Oe = "vertical", layout: L = "grouped", barRadius: R = 8, barShape: z = "rounded", barSize: ke = 8, maxBarSize: Ae, barGap: je = 4, barCategoryGap: Me, minPointSize: B, showBackground: Ne = !1, backgroundFill: V = "var(--ui-background-surface-secondary)", showActiveBar: Pe = !1, activeBar: H, showGrid: Fe = !0, showTooltip: Ie = !0, showLegend: Le = !0, showXAxis: Re = !0, showYAxis: ze = !0, xTickFormatter: U, yTickFormatter: Be, xAxisAngle: W, xAxisInterval: Ve, yAxisTickCount: He, yAxisDomain: Ue, gridDashed: We = !0, gridHorizontal: Ge, gridVertical: Ke, tooltipContent: qe, animate: Je, animationDuration: Ye, animationBegin: Xe, animationEasing: Ze, showLabels: Qe = !1, labelPosition: $e, labelFormatter: et, showBrush: tt = !1, brushHeight: nt, brushAriaLabel: rt, ...it } = t, G = f({
283
- animate: Je,
284
- animationDuration: Ye,
285
- animationBegin: Xe,
286
- animationEasing: Ze
283
+ let { className: T, config: E, palette: k, data: A, dataKeys: j, xKey: M, referenceLine: xe, referenceArea: N, barSettings: P, xAxisLabel: I, yAxisLabel: Ee, yUnit: De, orientation: Oe = "vertical", layout: L = "grouped", barRadius: R = 8, barShape: z = "rounded", barSize: ke = 8, maxBarSize: Ae, barGap: je = 4, barCategoryGap: Me, minPointSize: B, showBackground: Ne = !1, backgroundFill: V = "var(--ui-background-surface-secondary)", showActiveBar: Pe = !1, activeBar: H, showGrid: Fe = !0, showTooltip: Ie = !0, showLegend: Le = !0, legendFontSize: Re, showXAxis: ze = !0, showYAxis: Be = !0, xTickFormatter: U, yTickFormatter: Ve, xAxisAngle: W, xAxisInterval: He, yAxisTickCount: Ue, yAxisDomain: We, gridDashed: Ge = !0, gridHorizontal: Ke, gridVertical: qe, tooltipContent: Je, animate: Ye, animationDuration: Xe, animationBegin: Ze, animationEasing: Qe, showLabels: $e = !1, labelPosition: et, labelFormatter: tt, showBrush: nt = !1, brushHeight: rt, brushAriaLabel: it, ...at } = t, G = f({
284
+ animate: Ye,
285
+ animationDuration: Xe,
286
+ animationBegin: Ze,
287
+ animationEasing: Qe
287
288
  }), K = L === "stacked", q = h({
288
- labelPosition: $e,
289
+ labelPosition: et,
289
290
  isStacked: K,
290
291
  growingEnd: "top"
291
- }), at = oe(xe), J = (N ? Array.isArray(N) ? N : [N] : []).map((e) => ({
292
+ }), ot = oe(xe), J = (N ? Array.isArray(N) ? N : [N] : []).map((e) => ({
292
293
  area: e,
293
294
  range: g(e, A, M)
294
295
  })).filter((e) => e.range !== void 0), Y = new Map(j.flatMap((e) => {
@@ -310,62 +311,65 @@ var I = y.forwardRef((t, n) => {
310
311
  ...e,
311
312
  ...n
312
313
  };
313
- }) : A, ot = new Set(J.filter(({ area: e }) => e.highlightTicks !== !1).flatMap(({ range: e }) => A.slice(e[0], e[1] + 1).map((e) => e[M]))), st = ot.size ? ({ payload: t, index: n, ...r }) => {
314
+ }) : A, st = new Set(J.filter(({ area: e }) => e.highlightTicks !== !1).flatMap(({ range: e }) => A.slice(e[0], e[1] + 1).map((e) => e[M]))), ct = st.size ? ({ payload: t, index: n, ...r }) => {
314
315
  let i = U ? U(t.value, n) : t.value;
315
316
  return /* @__PURE__ */ x(he, {
316
317
  ...r,
317
- className: e("fill-muted-foreground", ot.has(t.value) && "fill-primary italic"),
318
+ className: e("fill-muted-foreground", st.has(t.value) && "fill-primary italic"),
318
319
  fontSize: 12,
319
320
  children: i
320
321
  });
321
- } : void 0, ct = Pe ? {
322
+ } : void 0, lt = Pe ? {
322
323
  ...H?.fill === void 0 ? {} : { fill: H.fill },
323
324
  fillOpacity: H?.opacity ?? .85
324
- } : !1, Q = `bar-${r}`, lt = /* @__PURE__ */ new Set([z]);
325
+ } : !1, Q = `bar-${r}`, ut = /* @__PURE__ */ new Set([z]);
325
326
  Y.forEach(({ settings: e }) => {
326
- e.shape && lt.add(e.shape);
327
+ e.shape && ut.add(e.shape);
327
328
  });
328
- let ut = (e) => B === void 0 ? void 0 : (t, n) => {
329
+ let dt = (e) => B === void 0 ? void 0 : (t, n) => {
329
330
  let r = K ? Z[n]?.[e] : t;
330
331
  return typeof r == "number" && r !== 0 ? B : 0;
331
- }, dt = (e, t) => t === "gradient" ? `url(#${Q}-gradient-${d(e)})` : t === "pattern" ? `url(#${Q}-pattern-${d(e)})` : `var(--color-${d(e)})`, ft = re(I), pt = ie(Ee), mt = p(Ue), ht = [
332
+ }, ft = (e, t) => t === "gradient" ? `url(#${Q}-gradient-${d(e)})` : t === "pattern" ? `url(#${Q}-pattern-${d(e)})` : `var(--color-${d(e)})`, pt = re(I), mt = ie(Ee), ht = p(We), gt = [
332
333
  R,
333
334
  R,
334
335
  0,
335
336
  0
336
- ], $ = (e, t) => e === "pill" ? 9999 : R > 0 && t ? ht : void 0, gt = /* @__PURE__ */ x(ve, {
337
- content: qe,
337
+ ], $ = (e, t) => e === "pill" ? 9999 : R > 0 && t ? gt : void 0, _t = /* @__PURE__ */ x(ve, {
338
+ content: Je,
338
339
  dataKeys: j
339
- }), _t = /* @__PURE__ */ x(ye, { dataKeys: j }), vt = () => /* @__PURE__ */ S(b, { children: [/* @__PURE__ */ x(ge, {
340
+ }), vt = /* @__PURE__ */ x(ye, {
341
+ dataKeys: j,
342
+ fontSize: Re
343
+ }), yt = () => /* @__PURE__ */ S(b, { children: [/* @__PURE__ */ x(ge, {
340
344
  dataKey: M,
341
345
  type: "category",
342
- hide: !Re,
346
+ hide: !ze,
343
347
  tickLine: !1,
344
348
  axisLine: !1,
345
- tick: st,
349
+ tick: ct,
346
350
  tickFormatter: U,
347
351
  angle: W,
348
- interval: Ve,
352
+ interval: He,
349
353
  textAnchor: te(W),
350
354
  height: w.height,
351
- label: ft
355
+ label: pt
352
356
  }), /* @__PURE__ */ x(_e, {
353
357
  type: "number",
354
- hide: !ze,
358
+ hide: !Be,
355
359
  tickLine: !1,
356
360
  axisLine: !1,
357
361
  unit: De,
358
- tickFormatter: Be,
359
- tickCount: He,
360
- domain: mt,
362
+ tickFormatter: Ve,
363
+ tickCount: Ue,
364
+ domain: ht,
361
365
  width: Ee ? 72 : void 0,
362
- label: pt
363
- })] }), yt = () => j.map((e, t) => {
366
+ label: mt
367
+ })] }), bt = () => j.map((e, t) => {
364
368
  let n = !K || t === j.length - 1, r = Y.get(e), i = (e) => r !== void 0 && e >= r.range[0] && e <= r.range[1], a = X.get(e), { shape: o, activeBar: s } = be({
365
369
  rangeBackground: r?.settings.background === !0,
366
370
  inRange: i,
367
371
  trackFill: V,
368
- activeBarOption: ct
372
+ activeBarOption: lt
369
373
  }), c = r && Te({
370
374
  data: A,
371
375
  chartData: Z,
@@ -376,21 +380,21 @@ var I = y.forwardRef((t, n) => {
376
380
  headroomKey: a,
377
381
  barShape: z,
378
382
  rounded: n,
379
- fillOf: dt,
383
+ fillOf: ft,
380
384
  radiusFor: $
381
- }), l = Qe && /* @__PURE__ */ x(fe, {
385
+ }), l = $e && /* @__PURE__ */ x(fe, {
382
386
  dataKey: e,
383
387
  position: q,
384
- formatter: ae(et),
388
+ formatter: ae(tt),
385
389
  className: v(q),
386
390
  fontSize: 12
387
391
  });
388
392
  return /* @__PURE__ */ S(y.Fragment, { children: [/* @__PURE__ */ S(C, {
389
393
  dataKey: e,
390
- fill: dt(e, z),
394
+ fill: ft(e, z),
391
395
  stackId: K ? "a" : a ? e : void 0,
392
396
  radius: $(z, n),
393
- minPointSize: ut(e),
397
+ minPointSize: dt(e),
394
398
  background: Ne ? { fill: V } : void 0,
395
399
  shape: o,
396
400
  activeBar: s,
@@ -406,7 +410,7 @@ var I = y.forwardRef((t, n) => {
406
410
  tooltipType: "none",
407
411
  ...G
408
412
  })] }, e);
409
- }), bt = () => J.map(({ area: e, range: t }, n) => {
413
+ }), xt = () => J.map(({ area: e, range: t }, n) => {
410
414
  let [r, i] = t;
411
415
  return /* @__PURE__ */ x(pe, {
412
416
  x1: A[r]?.[M],
@@ -417,7 +421,7 @@ var I = y.forwardRef((t, n) => {
417
421
  shape: Se(e.divider),
418
422
  label: Ce(e.label)
419
423
  }, `${e.label ?? "area"}-${n}`);
420
- }), xt = () => at.map((e, t) => {
424
+ }), St = () => ot.map((e, t) => {
421
425
  let n = _(e, A, j);
422
426
  return n === void 0 ? null : /* @__PURE__ */ x(me, {
423
427
  y: n,
@@ -432,7 +436,7 @@ var I = y.forwardRef((t, n) => {
432
436
  orientation: Oe,
433
437
  layout: L
434
438
  }), T),
435
- ...it,
439
+ ...at,
436
440
  children: /* @__PURE__ */ x(a, {
437
441
  ref: i,
438
442
  config: E,
@@ -450,25 +454,25 @@ var I = y.forwardRef((t, n) => {
450
454
  /* @__PURE__ */ x(we, {
451
455
  id: Q,
452
456
  dataKeys: j,
453
- shapes: lt
457
+ shapes: ut
454
458
  }),
455
459
  Fe && /* @__PURE__ */ x(de, {
456
- horizontal: Ge ?? !0,
457
- vertical: Ke ?? !1,
458
- strokeDasharray: We ? "3 3" : void 0
460
+ horizontal: Ke ?? !0,
461
+ vertical: qe ?? !1,
462
+ strokeDasharray: Ge ? "3 3" : void 0
459
463
  }),
460
- vt(),
461
- Ie && /* @__PURE__ */ x(c, { content: gt }),
462
- Le && /* @__PURE__ */ x(o, { content: _t }),
463
464
  yt(),
465
+ Ie && /* @__PURE__ */ x(c, { content: _t }),
466
+ Le && /* @__PURE__ */ x(o, { content: vt }),
464
467
  bt(),
465
468
  xt(),
466
- tt && /* @__PURE__ */ x(ue, {
469
+ St(),
470
+ nt && /* @__PURE__ */ x(ue, {
467
471
  dataKey: M,
468
472
  tickFormatter: U,
469
473
  ...m({
470
- brushHeight: nt,
471
- brushAriaLabel: rt
474
+ brushHeight: rt,
475
+ brushAriaLabel: it
472
476
  })
473
477
  })
474
478
  ]
@@ -1 +1 @@
1
- {"version":3,"file":"bar-chart.js","names":[],"sources":["../../../../src/components/ui/bar-chart/bar-chart.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { cva, type VariantProps } from 'class-variance-authority';\nimport {\n Bar,\n BarChart as RechartsBarChart,\n Brush,\n CartesianGrid,\n Cell,\n LabelList,\n ReferenceArea,\n ReferenceLine,\n Rectangle,\n Text,\n XAxis,\n YAxis,\n} from 'recharts';\n\nimport type { BarShapeProps } from 'recharts/types/cartesian/Bar';\nimport { Meter as MeterPrimitive } from '@base-ui/react/meter';\n\nimport { cn } from '@/lib/utils';\nimport { Tooltip, TooltipContent, TooltipTrigger } from '../tooltip';\nimport {\n CHART_LABEL_FONT_SIZE,\n ChartContainer,\n ChartLegend,\n ChartLegendContent,\n ChartTooltip,\n ChartTooltipContent,\n resolveAnimation,\n resolveAxisDomain,\n resolveBrushProps,\n resolveCartesianLabelPosition,\n resolveCategoryRange,\n resolveChartReferenceValue,\n resolveLabelFillClass,\n resolveReferenceLineProps,\n resolveRotatedTickAnchor,\n resolveXAxisTitle,\n resolveYAxisTitle,\n resolveChartColors,\n toLabelFormatter,\n toReferenceLineList,\n type ChartConfig,\n type ChartPalette,\n type ChartStatusTone,\n type ChartReferenceLine,\n type ChartLegendContentProps,\n type ChartTooltipContentProps,\n toCssKey,\n type CartesianChartProps,\n type ChartAnimationProps,\n type ChartBrushProps,\n type ChartCategoryRange,\n type ChartDataLabelProps,\n type CartesianLabelPosition,\n} from '../chart';\nimport {\n mergeXAxisLayoutMargin,\n useXAxisLayout,\n} from '../chart/use-x-axis-layout';\nimport { resolveXAxisTickLabels } from '../chart/chart-format';\n\n// The two CVA axes are the design's Bar-chart variant set (B2): `orientation`\n// and `layout` (grouped side-by-side vs stacked). `orientation` is the\n// discriminant for *which component this is*: `vertical` renders the typed\n// recharts composition over the shared `Chart` primitives (bars rising from a\n// category X axis), `horizontal` renders the labelled proportional bar list\n// below, which has no axes, grid, or recharts at all. The classes stay empty\n// because neither mode is styled by a variant class — the recharts SVG draws\n// the vertical bars, and the horizontal list carries its own layout. CVA is\n// kept so the variant set is a first-class, spec-conformant part of the API\n// (matched against ui-spec's api.yaml enums); the resolved values are mirrored\n// onto `data-orientation` / `data-layout` for styling hooks and tests.\nconst barChartVariants = cva('', {\n variants: {\n orientation: {\n vertical: '',\n horizontal: '',\n },\n layout: {\n grouped: '',\n stacked: '',\n },\n },\n defaultVariants: {\n orientation: 'vertical',\n layout: 'grouped',\n },\n});\n\n/**\n * How a bar is painted. `rounded` rounds the growing end by `barRadius`; `pill`\n * rounds every corner to a capsule; `gradient` fades the series color down the\n * bar; `pattern` fills it with diagonal hatching in the series color (a\n * colorblind-safe way to set a subset of bars apart).\n */\nexport type BarChartBarShape = 'rounded' | 'pill' | 'gradient' | 'pattern';\n\n/**\n * Style override for one series over a range of categories — e.g. \"the forecast\n * tail from September onward reads translucent and dashed\". Anything left unset\n * keeps the series' normal painting.\n */\nexport interface BarChartBarSettings extends ChartCategoryRange {\n /** Fill for the matched bars. Defaults to the series color. */\n fill?: string;\n /** Fill opacity for the matched bars. */\n opacity?: number;\n /** Outline the matched bars with a dashed stroke in the series color. */\n dashed?: boolean;\n /** Shape for the matched bars, overriding the chart's `barShape`. */\n shape?: BarChartBarShape;\n /**\n * Track behind the matched bars: `true` fills the plot height, while a data\n * field name caps it at that row's value — the headroom between a projection\n * and its upper bound. A capped track stacks on its bar, so it needs the\n * default `layout=\"grouped\"`; under `layout=\"stacked\"` it is ignored.\n */\n background?: boolean | string;\n}\n\n/** A shaded band behind a range of categories. */\nexport interface BarChartReferenceArea extends ChartCategoryRange {\n /** Caption above the band. */\n label?: string;\n /**\n * Mark the category ticks under the band — accent color, italic — so the\n * highlighted range reads on the axis too. On by default.\n */\n highlightTicks?: boolean;\n /**\n * Draw a dashed rule at the band's leading edge — the hand-off into a\n * forecast. Off by default.\n */\n divider?: boolean;\n}\n\n// Reserved field prefix for the synthetic headroom series a capped track\n// stacks onto its bar. It must never surface in the tooltip or the legend.\nconst HEADROOM_FIELD_PREFIX = '__headroom_';\n\n/**\n * Drop the synthetic headroom series from a recharts tooltip/legend payload,\n * keeping the real series (and their order). `legendType`/`tooltipType=\"none\"`\n * are set on those bars too, but recharts still lists them, so this filter is\n * what actually keeps them out — hence it's unit-tested.\n */\nexport function dropHeadroomSeries<T extends { dataKey?: unknown }>(\n payload: readonly T[] | undefined,\n dataKeys?: string[]\n): T[] | undefined {\n const real = payload?.filter(\n (item) => !String(item.dataKey).startsWith(HEADROOM_FIELD_PREFIX)\n );\n // recharts sorts the legend payload alphabetically by series name by default\n // (its `itemSorter: 'value'`), so passing `dataKeys` puts the entries back in\n // the order the caller declared them.\n return dataKeys\n ? real?.slice().sort(\n (a, b) =>\n dataKeys.indexOf(String(a.dataKey)) -\n dataKeys.indexOf(String(b.dataKey))\n )\n : real;\n}\n\n/**\n * Swap a paint-server fill back to the series color for the chrome. A\n * `gradient` / `pattern` bar fills from `url(#…)`, which paints SVG but means\n * nothing as a CSS background — the legend swatch and the tooltip dot would\n * render blank — so they fall back to the series' own `--color-<key>`.\n */\nexport function withSeriesColor<T extends { dataKey?: unknown; color?: string }>(\n payload: readonly T[] | undefined\n): T[] | undefined {\n return payload?.map((item) =>\n item.color?.startsWith('url(')\n ? { ...item, color: `var(--color-${toCssKey(String(item.dataKey))})` }\n : item\n );\n}\n\ntype TooltipContentType = NonNullable<\n React.ComponentProps<typeof ChartTooltip>['content']\n>;\ntype TooltipContentFn = Extract<\n TooltipContentType,\n (...args: never[]) => unknown\n>;\ntype TooltipRenderProps = Parameters<TooltipContentFn>[0];\n\ntype LegendContentType = NonNullable<\n React.ComponentProps<typeof ChartLegend>['content']\n>;\ntype LegendContentFn = Extract<LegendContentType, (...args: never[]) => unknown>;\ntype LegendRenderProps = Parameters<LegendContentFn>[0];\n\n/**\n * Tooltip content that normalizes recharts' payload before anything renders it:\n * the synthetic headroom series stripped, the rows put back in `dataKeys` order,\n * and paint-server fills swapped back to the series color. Falls through to a\n * caller-supplied `content`, preserving recharts' own mount semantics — a\n * function via `createElement` (its own component identity + hook state), an\n * element via `cloneElement`.\n *\n * This is a component rather than a per-render wrapper factory on purpose:\n * recharts renders `content` by cloning the element it is given\n * (`Tooltip.js:27-28`), so a stable module-level type here means the subtree is\n * never remounted, whatever the caller passes.\n */\nexport function NormalizedTooltipContent({\n content,\n dataKeys,\n ...props\n}: Partial<TooltipRenderProps> & {\n content?: TooltipContentType;\n dataKeys?: string[];\n}) {\n const merged = {\n ...props,\n payload: withSeriesColor(dropHeadroomSeries(props.payload, dataKeys)),\n } as TooltipRenderProps;\n\n if (!content) {\n return <ChartTooltipContent {...(merged as ChartTooltipContentProps)} />;\n }\n return typeof content === 'function'\n ? React.createElement(\n content as React.FunctionComponent<TooltipRenderProps>,\n merged\n )\n : React.cloneElement(content, merged);\n}\n\n/**\n * Legend content over the same normalization. Ordering is the reason this\n * applies unconditionally: recharts sorts legend entries alphabetically by\n * series name by default (`itemSorter: 'value'`), so without putting them back\n * in `dataKeys` order the legend would silently reorder itself depending on\n * which bar-styling props happen to be set.\n */\nexport function NormalizedLegendContent({\n dataKeys,\n ...props\n}: Partial<LegendRenderProps> & { dataKeys: string[] }) {\n return (\n <ChartLegendContent\n verticalAlign={props.verticalAlign}\n payload={\n withSeriesColor(\n dropHeadroomSeries(props.payload, dataKeys)\n ) as ChartLegendContentProps['payload']\n }\n />\n );\n}\n\n/** Paint overrides recharts spreads over a bar to mark it as the active one. */\ninterface BarPaintOverride {\n fill?: string;\n fillOpacity?: number;\n}\n\n/**\n * Draw a bar, optionally over its full-height track (recharts hands a custom\n * `<Bar shape>` the track geometry alongside the bar's). Only geometry and\n * paint props are forwarded — recharts also passes the whole data entry, and\n * spreading that onto an SVG node would leak data fields into the DOM.\n *\n * `paint` is how the active bar keeps its track: recharts swaps a custom\n * `shape` out for the `activeBar` option while a bar is hovered\n * (`Bar.js` `BarRectangleWithActiveState`), so the active option has to be a\n * shape of its own that redraws the track and applies the highlight itself.\n */\nfunction renderBarWithTrack({\n bar,\n track,\n trackFill,\n paint,\n}: {\n bar: Omit<BarShapeProps, 'background' | 'index'>;\n track?: BarShapeProps['background'];\n trackFill: string;\n paint?: BarPaintOverride;\n}) {\n return (\n <>\n {track && (\n <Rectangle\n className=\"recharts-bar-background-rectangle\"\n x={track.x ?? undefined}\n y={track.y ?? undefined}\n width={track.width ?? undefined}\n height={track.height ?? undefined}\n fill={trackFill}\n />\n )}\n <Rectangle\n x={bar.x ?? undefined}\n y={bar.y ?? undefined}\n width={bar.width ?? undefined}\n height={bar.height ?? undefined}\n radius={bar.radius}\n fill={paint?.fill ?? bar.fill}\n fillOpacity={paint?.fillOpacity ?? bar.fillOpacity}\n stroke={bar.stroke}\n strokeWidth={bar.strokeWidth}\n strokeDasharray={bar.strokeDasharray}\n />\n </>\n );\n}\n\n/**\n * Build the `<Bar shape>` that draws a range-scoped track. recharts' own\n * `background` is all-or-nothing per series, so the track is drawn per row and\n * hidden where the range doesn't apply.\n */\nexport function createTrackShape({\n inRange,\n trackFill,\n paint,\n}: {\n inRange: (row: number) => boolean;\n trackFill: string;\n paint?: BarPaintOverride;\n}) {\n return ({ background: track, index: row, ...bar }: BarShapeProps) =>\n renderBarWithTrack({\n bar,\n track: inRange(row) ? track : undefined,\n trackFill,\n paint,\n });\n}\n\n/**\n * The `shape` / `activeBar` pair one series' `<Bar>` is given.\n *\n * They resolve together because recharts swaps a custom `shape` out for the\n * `activeBar` option while a bar is hovered: a range-scoped track has to be\n * redrawn by the active option too, or the track blinks out under the cursor.\n */\nfunction resolveBarShapes({\n rangeBackground,\n inRange,\n trackFill,\n activeBarOption,\n}: {\n /**\n * recharts takes one `background` per series, so a range-scoped one is drawn\n * per row by a custom shape instead: hidden where it doesn't apply.\n */\n rangeBackground: boolean;\n inRange: (row: number) => boolean;\n trackFill: string;\n activeBarOption: BarPaintOverride | false;\n}) {\n if (!rangeBackground) {\n return { shape: undefined, activeBar: activeBarOption };\n }\n return {\n shape: createTrackShape({ inRange, trackFill }),\n activeBar: activeBarOption\n ? createTrackShape({ inRange, trackFill, paint: activeBarOption })\n : activeBarOption,\n };\n}\n\n/**\n * Draw a highlight band plus a dashed rule on its leading edge — the left edge,\n * since the category axis runs along X.\n *\n * The band's own paint comes from the props recharts hands the shape — a\n * `<ReferenceArea shape>` still receives the element's `fill`/`fillOpacity`\n * (`ReferenceArea.js` `renderRect`), so hardcoding them here would quietly\n * ignore whatever the caller set.\n */\nfunction renderBandWithDivider(band: {\n x?: number;\n y?: number;\n width?: number;\n height?: number;\n fill?: string;\n fillOpacity?: number;\n}) {\n const { x = 0, y = 0, width = 0, height = 0, fill, fillOpacity } = band;\n return (\n <>\n <Rectangle\n className=\"recharts-reference-area-rect\"\n x={x}\n y={y}\n width={width}\n height={height}\n fill={fill}\n fillOpacity={fillOpacity}\n />\n <line\n x1={x}\n y1={y}\n x2={x}\n y2={y + height}\n stroke=\"var(--ui-border-on-surface-border)\"\n strokeDasharray=\"4 4\"\n />\n </>\n );\n}\n\n/**\n * The `<ReferenceArea shape>` for a band, or `undefined` so recharts draws its\n * own rect. A custom shape is only needed for the leading-edge rule: a\n * `ReferenceLine` would sit on the tick's centre, and only the band knows where\n * its own edge is.\n */\nfunction resolveBandShape(divider: boolean | undefined) {\n if (!divider) return undefined;\n return renderBandWithDivider;\n}\n\n/**\n * A band's caption as recharts' native `label`. `'insideTop'` is asserted\n * because, read outside the JSX attribute, it would widen to `string` and stop\n * matching recharts' `Position` union.\n */\nfunction resolveBandLabel(label: string | undefined) {\n return label\n ? {\n value: label,\n position: 'insideTop' as const,\n fill: 'var(--ui-text-on-surface-secondary)',\n fontSize: 12,\n }\n : undefined;\n}\n\n/**\n * The `<defs>` a `gradient` / `pattern` bar fills from — one paint server per\n * series, since each is painted in that series' own color. Ids are namespaced\n * by the chart instance so two charts on a page can't collide.\n *\n * Safe to render as a component: unlike `Bar`'s cells, the chart renders its\n * children straight through rather than looking them up by type.\n */\nfunction BarPaintServers({\n id,\n dataKeys,\n shapes,\n}: {\n id: string;\n dataKeys: string[];\n shapes: ReadonlySet<BarChartBarShape>;\n}) {\n const hasGradient = shapes.has('gradient');\n const hasPattern = shapes.has('pattern');\n if (!hasGradient && !hasPattern) return null;\n\n return (\n <defs>\n {dataKeys.map((key) => (\n <React.Fragment key={key}>\n {/* Bars grow up, so a gradient runs top-down. */}\n {hasGradient && (\n <linearGradient id={`${id}-gradient-${toCssKey(key)}`} x1=\"0\" y1=\"0\" x2=\"0\" y2=\"1\">\n <stop\n offset=\"0%\"\n stopColor={`var(--color-${toCssKey(key)})`}\n stopOpacity={1}\n />\n <stop\n offset=\"100%\"\n stopColor={`var(--color-${toCssKey(key)})`}\n stopOpacity={0.35}\n />\n </linearGradient>\n )}\n {hasPattern && (\n <pattern\n id={`${id}-pattern-${toCssKey(key)}`}\n patternUnits=\"userSpaceOnUse\"\n width={6}\n height={6}\n patternTransform=\"rotate(45)\"\n >\n <rect\n width={6}\n height={6}\n fill={`var(--color-${toCssKey(key)})`}\n fillOpacity={0.25}\n />\n <line\n x1={0}\n y1={0}\n x2={0}\n y2={6}\n stroke={`var(--color-${toCssKey(key)})`}\n strokeWidth={3}\n />\n </pattern>\n )}\n </React.Fragment>\n ))}\n </defs>\n );\n}\n\n/** Corner radius as recharts' `Rectangle` takes it: one value or a 4-tuple. */\ntype BarRadius = number | [number, number, number, number] | undefined;\n\ninterface RangeCellsOptions {\n data: ReadonlyArray<Record<string, string | number>>;\n /** `data` plus the synthetic headroom fields, if any were added. */\n chartData: ReadonlyArray<Record<string, string | number>>;\n xKey: string;\n seriesKey: string;\n settings: BarChartBarSettings;\n /** Inclusive row bounds the settings apply to. */\n range: [number, number];\n headroomKey: string | undefined;\n barShape: BarChartBarShape;\n rounded: boolean;\n fillOf: (key: string, shape: BarChartBarShape) => string;\n radiusFor: (shape: BarChartBarShape, rounded: boolean) => BarRadius;\n}\n\n/**\n * The `<Cell>` list that applies a series' `barSettings` over its range: the\n * matched rows take the override fill/opacity/dash/shape, the rest keep the\n * series' normal painting.\n *\n * A plain function returning the elements, deliberately not a component:\n * `Bar` discovers its cells with `findAllByType(props.children, Cell)`\n * (recharts `Bar.js`), which matches each direct child on its own display\n * name. Wrapping these in a component would make that lookup find nothing and\n * silently drop every per-range style — no error, just unstyled bars.\n * Returning an array keeps them direct children, since recharts' `toArray`\n * flattens arrays and unwraps fragments.\n */\nfunction rangeCells({\n data,\n chartData,\n xKey,\n seriesKey,\n settings,\n range,\n headroomKey,\n barShape,\n rounded,\n fillOf,\n radiusFor,\n}: RangeCellsOptions) {\n const { fill, opacity, dashed } = settings;\n\n return data.map((row, rowIndex) => {\n const on = rowIndex >= range[0] && rowIndex <= range[1];\n const shape = (on && settings.shape) || barShape;\n // Only a row that actually carries headroom gives up its rounded end — a\n // row in range whose upper bound is missing, or no higher than its value,\n // keeps it.\n const stacksHeadroom =\n headroomKey !== undefined &&\n Number(\n (chartData[rowIndex] as Record<string, unknown>)?.[\n `${HEADROOM_FIELD_PREFIX}${seriesKey}`\n ]\n ) > 0;\n\n return (\n <Cell\n key={`${seriesKey}-${String(row[xKey])}-${rowIndex}`}\n fill={\n on ? (fill ?? fillOf(seriesKey, shape)) : fillOf(seriesKey, barShape)\n }\n fillOpacity={on ? opacity : undefined}\n stroke={on && dashed ? `var(--color-${toCssKey(seriesKey)})` : undefined}\n strokeWidth={on && dashed ? 1 : undefined}\n strokeDasharray={on && dashed ? '4 3' : undefined}\n // Cell types `radius` as the SVG attribute, but it feeds recharts'\n // Rectangle, which takes the 4-tuple. A bar with headroom stacked on it\n // hands the rounded end to that segment instead.\n radius={\n (stacksHeadroom ? undefined : radiusFor(shape, rounded)) as\n | number\n | undefined\n }\n />\n );\n });\n}\n\n/**\n * The recharts bar chart: bars rising from a category X axis, with axes, grid,\n * tooltip and legend. This is the default — `orientation` is only spelled out\n * to discriminate it from the horizontal mode below.\n */\nexport interface BarChartVerticalProps\n extends Omit<React.ComponentProps<'div'>, 'children'>,\n Omit<VariantProps<typeof barChartVariants>, 'orientation'>,\n CartesianChartProps,\n ChartAnimationProps,\n ChartBrushProps,\n ChartDataLabelProps {\n /** Selects the recharts bar chart. Omit it — this is the default. */\n orientation?: 'vertical';\n /**\n * The dataviz palette this chart's series are painted from. Series that\n * state no `color` of their own take a stop of it. See `ChartPalette`.\n */\n palette?: ChartPalette;\n /** Row-per-category data. Each object holds the category key + one numeric field per series. */\n data: ReadonlyArray<Record<string, string | number>>;\n /**\n * Per-series map of `label` / `icon` / `tone` (from the shared `Chart`\n * primitives). Series take their colour from the container's `palette`; each\n * entry maps a key to a `label` and an optional `tone`.\n */\n config: ChartConfig;\n /** Series to plot — one `<Bar>` per key. Each must exist in `config` and in every data row. */\n dataKeys: string[];\n /** Category axis key (the shared dimension across rows, e.g. `\"month\"`). */\n xKey: string;\n /**\n * One or more dashed reference/average lines on the value (Y) axis. Each is\n * driven by a fixed `value` or a computed series `average`. Pass a single\n * object or an array to draw several at once.\n */\n referenceLine?: ChartReferenceLine | ChartReferenceLine[];\n /**\n * One or more shaded bands behind a range of categories — e.g. a forecast\n * period. Pass a single object or an array to draw several.\n */\n referenceArea?: BarChartReferenceArea | BarChartReferenceArea[];\n /**\n * Per-series style override for a range of categories, keyed by `dataKeys`\n * entry. Bars outside a series' range — and series with no entry — render\n * normally.\n */\n barSettings?: Record<string, BarChartBarSettings>;\n /** Corner radius applied to the growing end of each bar. */\n barRadius?: number;\n /** How every bar is painted. Per-range overrides come from `barSettings`. */\n barShape?: BarChartBarShape;\n /** Fixed bar thickness, in px. Unset, recharts sizes bars from the available width. */\n barSize?: number;\n /** Upper bound on the computed bar thickness, in px. */\n maxBarSize?: number;\n /** Gap between bars of the same category, in px or a percentage string. */\n barGap?: number | string;\n /** Gap between category groups, in px or a percentage string. */\n barCategoryGap?: number | string;\n /**\n * Minimum rendered length for a bar, in px, so a tiny value stays visible. A\n * value of exactly `0` still renders nothing — a floor on it would read as a\n * small positive.\n */\n minPointSize?: number;\n /** Draw a full-height track behind every bar. */\n showBackground?: boolean;\n /** Fill for the track background. Defaults to the secondary surface. */\n backgroundFill?: string;\n /** Highlight the hovered bar. */\n showActiveBar?: boolean;\n /** Painting of the hovered bar when `showActiveBar` is on. */\n activeBar?: {\n /** Fill for the hovered bar. Defaults to the series color. */\n fill?: string;\n /** Fill opacity for the hovered bar. */\n opacity?: number;\n };\n showLegend?: boolean;\n /**\n * Position of the value labels when `showLabels` is on. Defaults to the bar's\n * growing end (`top`), or the segment centre when the layout is stacked.\n */\n labelPosition?: CartesianLabelPosition;\n}\n\n/** One row of the horizontal bar list. */\nexport interface BarChartItem {\n /** Row label, shown at the start of the row. */\n label: string;\n /** The value this row represents. */\n value: number;\n /**\n * Fill color — any CSS color; prefer an existing `--ui-*` token. Required\n * when no `palette` is passed to the chart. Omit when supplying `tone`\n * together with `palette`.\n */\n color?: string;\n /**\n * Palette tone for this row. Resolved against the `palette` prop on the\n * enclosing `BarChart`; ignored when `palette` is omitted and `color` is set.\n */\n tone?: { status: ChartStatusTone };\n /**\n * Projected/forecast total value. When set and greater than `value`, renders\n * a translucent bar (same color, 30% opacity) extending from the actual\n * value's edge to the forecast value. The actual bar renders solid on top.\n * ARIA values always reflect the actual value; `aria-valuetext` also\n * mentions the forecast value. Ignored when `<= value`.\n */\n forecast?: number;\n}\n\n/**\n * The labelled proportional bar list: one row per `items` entry carrying its\n * label, value, share of `max`, and a track bar. No axes, grid, or recharts.\n */\nexport interface BarChartHorizontalProps\n extends Omit<React.ComponentProps<'div'>, 'children'> {\n /** Selects the labelled bar list. */\n orientation: 'horizontal';\n /** Rows to render — one labelled bar per item. */\n items: BarChartItem[];\n /** Upper bound the values are shares of. Defaults to the sum of every item's value. */\n max?: number;\n /** Format the numeric value in the label. Defaults to `toLocaleString()`. */\n valueFormatter?: (value: number) => string;\n /** Show the hover tooltip per row. On by default. */\n showTooltip?: boolean;\n /** Tooltip content shared by every row (replaces the default). Ignored when `showTooltip` is false. */\n tooltip?: React.ReactNode;\n /**\n * Dataviz palette to resolve each item's color from. When provided, each\n * `items` entry should carry a `tone` (and can omit `color`). The colors are\n * resolved in the same order and with the same tone rules as the vertical\n * chart — `status` tones pick a specific palette stop, slot-less items\n * consume the next available stop.\n */\n palette?: ChartPalette;\n}\n\n/**\n * Unified BarChart props — `orientation` selects what gets rendered:\n * - omitted / `'vertical'`: the recharts bar chart (axes, grid, legend).\n * - `'horizontal'`: the labelled proportional bar list.\n */\nexport type BarChartProps = BarChartVerticalProps | BarChartHorizontalProps;\n\nconst defaultFormat = (value: number) => value.toLocaleString();\n\n/**\n * One labelled bar. Base UI's `Meter` primitive supplies `role=\"meter\"` and the\n * indicator's proportional width; the row is not a control, so the only reason\n * it takes focus is to make the tooltip reachable without a pointer.\n */\nfunction HorizontalBarRow({\n item,\n resolvedColor,\n max,\n valueFormatter,\n showTooltip,\n tooltip,\n}: {\n item: BarChartItem;\n resolvedColor: string;\n max: number;\n valueFormatter: (value: number) => string;\n showTooltip: boolean;\n tooltip?: React.ReactNode;\n}) {\n const { label, value, forecast } = item;\n const color = resolvedColor;\n const pct = max > 0 ? Math.round((value / max) * 100) : 0;\n const hasForecast = forecast != null && forecast > value;\n\n const root = (\n <MeterPrimitive.Root\n value={value}\n max={max}\n aria-valuemax={max}\n aria-valuetext={\n hasForecast\n ? `${valueFormatter(value)} of ${valueFormatter(max)} (${pct}%), forecast ${valueFormatter(forecast)}`\n : `${valueFormatter(value)} of ${valueFormatter(max)} (${pct}%)`\n }\n tabIndex={showTooltip ? 0 : undefined}\n className=\"flex w-full flex-col gap-1.5\"\n >\n <div className=\"flex items-baseline justify-between gap-2 text-sm leading-none\">\n <MeterPrimitive.Label className=\"truncate font-semibold\">\n {label}\n </MeterPrimitive.Label>\n <span className=\"shrink-0 tabular-nums\">\n <span className=\"font-semibold text-[var(--ui-text-on-surface-link-idle)]\">\n {valueFormatter(value)}\n </span>\n <span className=\"text-muted-foreground\"> {pct}%</span>\n </span>\n </div>\n <MeterPrimitive.Track className=\"relative h-2 w-full overflow-hidden rounded-full bg-[var(--ui-background-status-neutral-pressed)]\">\n {hasForecast && (\n <div\n data-forecast\n className=\"absolute inset-y-0 start-0 rounded-full\"\n style={{\n backgroundColor: color,\n opacity: 0.3,\n width: `${(forecast / max) * 100}%`,\n }}\n />\n )}\n <MeterPrimitive.Indicator\n className=\"relative rounded-full\"\n style={{ backgroundColor: color }}\n />\n </MeterPrimitive.Track>\n </MeterPrimitive.Root>\n );\n\n if (!showTooltip) return root;\n\n return (\n <Tooltip>\n <TooltipTrigger render={root} />\n <TooltipContent\n className={cn(\n 'border border-border bg-background text-foreground shadow-md',\n !tooltip && 'flex items-center gap-2'\n )}\n >\n {tooltip ?? (\n <>\n <span\n className=\"size-2.5 shrink-0 rounded-full\"\n style={{ backgroundColor: color }}\n />\n <span className=\"font-semibold\">{label}</span>\n <span className=\"text-muted-foreground\">\n {valueFormatter(value)} of {valueFormatter(max)} · {pct}%\n </span>\n </>\n )}\n </TooltipContent>\n </Tooltip>\n );\n}\n\nconst HorizontalBarLayout = React.forwardRef<\n HTMLDivElement,\n Omit<BarChartHorizontalProps, 'orientation'>\n>(\n (\n {\n items,\n max,\n palette,\n valueFormatter = defaultFormat,\n showTooltip = true,\n tooltip,\n className,\n ...props\n },\n ref\n ) => {\n // A max of 0 (or a negative one) would make every share meaningless, so it\n // falls back to the total — and to 1 when even that is 0, so the rows read\n // as empty rather than dividing by zero.\n const safeMax =\n max !== undefined && max > 0\n ? max\n : items.reduce((sum, item) => sum + item.value, 0) || 1;\n\n // When a palette is supplied, resolve each item's color through the same\n // palette machinery as the vertical chart — a synthetic config maps each\n // item's index key to its tone (or explicit color as a pinned stop).\n const resolvedColors = React.useMemo(() => {\n if (!palette) return null;\n // Items with an explicit `color` bypass the palette; items with `tone`\n // (or neither) are resolved through `resolveChartColors`.\n const config: ChartConfig = Object.fromEntries(\n items.map((item, i) => [\n `item${i}`,\n { label: item.label, ...(item.tone ? { tone: item.tone } : {}) },\n ])\n );\n const resolved = resolveChartColors(config, palette);\n return items.map((item, i) => item.color ?? resolved[`item${i}`]?.color ?? '');\n }, [items, palette]);\n\n return (\n <div\n ref={ref}\n data-orientation=\"horizontal\"\n className={cn('flex flex-col gap-4', className)}\n {...props}\n >\n {items.map((item, i) => (\n <HorizontalBarRow\n key={`${i}-${item.label}`}\n item={item}\n resolvedColor={resolvedColors ? (resolvedColors[i] ?? '') : (item.color ?? '')}\n max={safeMax}\n valueFormatter={valueFormatter}\n showTooltip={showTooltip}\n tooltip={tooltip}\n />\n ))}\n </div>\n );\n }\n);\nHorizontalBarLayout.displayName = 'HorizontalBarLayout';\n\nconst BarChart = React.forwardRef<HTMLDivElement, BarChartProps>(\n (rawProps, ref) => {\n // useId must be called unconditionally before any early return (Rules of Hooks).\n const instanceId = React.useId().replace(/:/g, '');\n const chartContainerRef = React.useRef<HTMLDivElement>(null);\n const verticalProps = rawProps as Partial<BarChartVerticalProps>;\n const rawXAxisKey = verticalProps.xKey;\n const rawXAxisTickLabels = resolveXAxisTickLabels(\n verticalProps.data && rawXAxisKey\n ? verticalProps.data.map((row) => row[rawXAxisKey])\n : [],\n verticalProps.xTickFormatter\n );\n const xAxisLayout = useXAxisLayout(\n chartContainerRef,\n verticalProps.xAxisAngle,\n verticalProps.xAxisLabel,\n rawXAxisTickLabels.join('\\u0000')\n );\n\n if (rawProps.orientation === 'horizontal') {\n const { orientation: _orientation, ...horizontalProps } = rawProps;\n return <HorizontalBarLayout {...horizontalProps} ref={ref} />;\n }\n\n const {\n className,\n config,\n palette,\n data,\n dataKeys,\n xKey,\n referenceLine,\n referenceArea,\n barSettings,\n xAxisLabel,\n yAxisLabel,\n yUnit,\n // Consumed rather than spread: a literal `orientation` attribute on the\n // wrapper `<div>` is not a valid DOM prop.\n orientation = 'vertical',\n layout = 'grouped',\n barRadius = 8,\n barShape = 'rounded',\n barSize = 8,\n maxBarSize,\n barGap = 4,\n barCategoryGap,\n minPointSize,\n showBackground = false,\n backgroundFill = 'var(--ui-background-surface-secondary)',\n showActiveBar = false,\n activeBar,\n showGrid = true,\n showTooltip = true,\n showLegend = true,\n showXAxis = true,\n showYAxis = true,\n xTickFormatter,\n yTickFormatter,\n xAxisAngle,\n xAxisInterval,\n yAxisTickCount,\n yAxisDomain,\n gridDashed = true,\n gridHorizontal,\n gridVertical,\n tooltipContent,\n animate,\n animationDuration,\n animationBegin,\n animationEasing,\n showLabels = false,\n labelPosition,\n labelFormatter,\n showBrush = false,\n brushHeight,\n brushAriaLabel,\n ...props\n } = rawProps;\n\n const animation = resolveAnimation({\n animate,\n animationDuration,\n animationBegin,\n animationEasing,\n });\n // recharts' `layout` names the axis the *categories* run along, which for\n // bars rising out of an X axis is its `'horizontal'`.\n const rechartsLayout = 'horizontal';\n const isStacked = layout === 'stacked';\n // Labels sit at the growing end of the bar — above it — or centred in the\n // segment when stacked.\n const barLabelPosition = resolveCartesianLabelPosition({\n labelPosition,\n isStacked,\n growingEnd: 'top',\n });\n\n const referenceLines = toReferenceLineList(referenceLine);\n\n // Bands + the per-series overrides resolved to inclusive row indices once,\n // so the Cells below are a lookup rather than a search per bar.\n const referenceAreas = (\n referenceArea\n ? Array.isArray(referenceArea)\n ? referenceArea\n : [referenceArea]\n : []\n )\n .map((area) => ({ area, range: resolveCategoryRange(area, data, xKey) }))\n .filter(\n (entry): entry is { area: BarChartReferenceArea; range: [number, number] } =>\n entry.range !== undefined\n );\n\n const settingsByKey = new Map(\n dataKeys.flatMap((key) => {\n const settings = barSettings?.[key];\n const range = settings\n ? resolveCategoryRange(settings, data, xKey)\n : undefined;\n return settings && range ? [[key, { settings, range }] as const] : [];\n })\n );\n\n // A capped track is drawn as a synthetic remainder (upper bound minus the\n // bar's own value) stacked on the bar, so recharts scales and animates it\n // rather than us guessing the axis scale from a mid-animation geometry.\n const headroomKeys = new Map(\n isStacked\n ? []\n : Array.from(settingsByKey, ([key, entry]) =>\n typeof entry.settings.background === 'string'\n ? ([key, entry.settings.background] as const)\n : undefined\n ).filter((pair): pair is readonly [string, string] => pair !== undefined)\n );\n\n const chartData = headroomKeys.size\n ? data.map((row, rowIndex) => {\n const extra: Record<string, number> = {};\n headroomKeys.forEach((upperKey, key) => {\n const entry = settingsByKey.get(key);\n if (!entry) return;\n const [start, end] = entry.range;\n if (rowIndex < start || rowIndex > end) return;\n const value = row[key];\n const upper = row[upperKey];\n if (typeof value !== 'number' || typeof upper !== 'number') return;\n extra[`${HEADROOM_FIELD_PREFIX}${key}`] = Math.max(0, upper - value);\n });\n return { ...row, ...extra };\n })\n : data;\n\n // The ticks under a band pick up the accent styling unless the band opts\n // out. Resolved to the categories' own values rather than kept as row\n // indices, because neither index a tick carries can be trusted here: the\n // `index` prop is a position in the list recharts actually renders, which\n // a numeric `interval` (and the default `preserveEnd`, dropping labels that\n // don't fit) has already filtered, and `payload.index` is relative to the\n // slice a `showBrush` selection leaves. The value survives both.\n const highlightedValues = new Set(\n referenceAreas\n .filter(({ area }) => area.highlightTicks !== false)\n .flatMap(({ range }) =>\n data.slice(range[0], range[1] + 1).map((row) => row[xKey])\n )\n );\n\n // recharts places the tick and hands the element its final geometry; we\n // reuse its own <Text> so angle/anchor behavior is unchanged and only add\n // the accent styling for the highlighted range. The formatter still takes\n // the rendered position, since that is what recharts passes its own\n // `tickFormatter`.\n const categoryTick = highlightedValues.size\n ? ({\n payload,\n index,\n ...tickProps\n }: {\n payload: { value: string | number };\n index: number;\n }) => {\n const value = xTickFormatter\n ? xTickFormatter(payload.value as never, index)\n : payload.value;\n return (\n <Text\n {...tickProps}\n className={cn(\n 'fill-muted-foreground',\n highlightedValues.has(payload.value) && 'fill-primary italic'\n )}\n fontSize={12}\n >\n {value}\n </Text>\n );\n }\n : undefined;\n\n // recharts spreads this over the bar's own props, so an explicitly\n // `undefined` fill would wipe the series color (an unfilled path paints\n // black). Only set what the caller asked for, and dim by default so\n // `showActiveBar` alone is visible.\n const activeBarOption = showActiveBar\n ? {\n ...(activeBar?.fill !== undefined ? { fill: activeBar.fill } : {}),\n fillOpacity: activeBar?.opacity ?? 0.85,\n }\n : false;\n\n // `gradient` and `pattern` paint from an SVG def, so the ids have to be\n // unique per chart instance — same guard the shared container applies.\n const defsId = `bar-${instanceId}`;\n const usedShapes = new Set<BarChartBarShape>([barShape]);\n settingsByKey.forEach(({ settings }) => {\n if (settings.shape) usedShapes.add(settings.shape);\n });\n // recharts applies a flat minPointSize to zeroes too, which would draw a\n // sliver where there is nothing to show. For a grouped bar it hands the\n // callback the row's own value, but inside a stack it hands the running\n // total, so a zero segment riding on a non-zero stack would slip through —\n // there the value is read back off the row instead. That read uses the\n // index recharts counts from the *displayed* slice, so a stacked chart\n // whose brush has been dragged off its full range falls back to flooring\n // the zero; the plain (unbrushed) stack, which is what the prop is for, is\n // exact.\n const minPointSizeFor = (key: string) =>\n minPointSize === undefined\n ? undefined\n : (top: number | undefined | null, row: number) => {\n const own = isStacked ? chartData[row]?.[key] : top;\n return typeof own === 'number' && own !== 0 ? minPointSize : 0;\n };\n\n const fillOf = (key: string, shape: BarChartBarShape) =>\n shape === 'gradient'\n ? `url(#${defsId}-gradient-${toCssKey(key)})`\n : shape === 'pattern'\n ? `url(#${defsId}-pattern-${toCssKey(key)})`\n : `var(--color-${toCssKey(key)})`;\n\n // Axis titles: the X title sits below the ticks; the Y title is rotated in\n // the left gutter. Passed to recharts' native `label` (themed via the\n // `.recharts-label` fill selector on the container).\n const xAxisTitle = resolveXAxisTitle(xAxisLabel);\n const yAxisTitle = resolveYAxisTitle(yAxisLabel);\n\n const yDomain = resolveAxisDomain(yAxisDomain);\n\n\n // Round only the growing end — the top of the bar.\n const endRadius: [number, number, number, number] = [\n barRadius,\n barRadius,\n 0,\n 0,\n ];\n // A pill rounds every corner; recharts clamps the radius to half the bar's\n // shorter side, so an oversized number gives a true capsule at any width.\n const radiusFor = (shape: BarChartBarShape, rounded: boolean) =>\n shape === 'pill'\n ? 9999\n : barRadius > 0 && rounded\n ? endRadius\n : undefined;\n\n // Both take the normalization unconditionally: gating it on \"is a\n // headroom/paint-server series in play\" is what let the legend's ordering\n // drift between otherwise identical charts. The helpers are no-ops when\n // there is nothing to strip or recolor.\n const tooltipElement = (\n <NormalizedTooltipContent content={tooltipContent} dataKeys={dataKeys} />\n );\n const legendElement = <NormalizedLegendContent dataKeys={dataKeys} />;\n\n // The long chart children are lifted into these renderers so the returned\n // tree reads as a flat list. They are plain functions, not components:\n // recharts looks some of its children up by element type (see `rangeCells`\n // above), so what they return has to stay a *direct* child — an array or a\n // fragment is flattened, a component wrapper would not be.\n\n // The categories run along X and the values along Y, so the category props\n // (dataKey/tick) belong to the X axis and the value props\n // (unit/tickCount/domain) to the Y axis — recharts ignores each set on the\n // other axis.\n const renderAxes = () => (\n <>\n <XAxis\n dataKey={xKey}\n type=\"category\"\n hide={!showXAxis}\n tickLine={false}\n axisLine={false}\n tick={categoryTick}\n tickFormatter={xTickFormatter}\n angle={xAxisAngle}\n interval={xAxisInterval}\n textAnchor={resolveRotatedTickAnchor(xAxisAngle)}\n height={xAxisLayout.height}\n label={xAxisTitle}\n />\n <YAxis\n type=\"number\"\n hide={!showYAxis}\n tickLine={false}\n axisLine={false}\n unit={yUnit}\n tickFormatter={yTickFormatter}\n tickCount={yAxisTickCount}\n domain={yDomain}\n width={yAxisLabel ? 72 : undefined}\n label={yAxisTitle}\n />\n </>\n );\n\n const renderSeries = () =>\n dataKeys.map((key, index) => {\n // In a stack only the last segment's end is rounded; grouped bars\n // each round their own end.\n const rounded = isStacked ? index === dataKeys.length - 1 : true;\n const entry = settingsByKey.get(key);\n const inRange = (row: number) =>\n entry !== undefined && row >= entry.range[0] && row <= entry.range[1];\n const headroomKey = headroomKeys.get(key);\n const { shape, activeBar: activeBarShape } = resolveBarShapes({\n rangeBackground: entry?.settings.background === true,\n inRange,\n trackFill: backgroundFill,\n activeBarOption,\n });\n const cells =\n entry &&\n rangeCells({\n data,\n chartData,\n xKey,\n seriesKey: key,\n settings: entry.settings,\n range: entry.range,\n headroomKey,\n barShape,\n rounded,\n fillOf,\n radiusFor,\n });\n const labels = showLabels && (\n <LabelList\n dataKey={key}\n position={barLabelPosition}\n formatter={toLabelFormatter(labelFormatter)}\n className={resolveLabelFillClass(barLabelPosition)}\n fontSize={CHART_LABEL_FONT_SIZE}\n />\n );\n return (\n <React.Fragment key={key}>\n <Bar\n dataKey={key}\n fill={fillOf(key, barShape)}\n // Its own stack, so the headroom sits on this series' bar\n // while the series stay side by side.\n stackId={isStacked ? 'a' : headroomKey ? key : undefined}\n radius={radiusFor(barShape, rounded)}\n minPointSize={minPointSizeFor(key)}\n background={showBackground ? { fill: backgroundFill } : undefined}\n shape={shape}\n activeBar={activeBarShape}\n {...animation}\n >\n {cells}\n {labels}\n </Bar>\n {headroomKey && (\n <Bar\n dataKey={`${HEADROOM_FIELD_PREFIX}${key}`}\n stackId={key}\n fill={`var(--color-${toCssKey(key)})`}\n fillOpacity={0.25}\n radius={radiusFor(barShape, true)}\n // Decoration for the bar below it — never its own row in the\n // tooltip or entry in the legend.\n legendType=\"none\"\n tooltipType=\"none\"\n {...animation}\n />\n )}\n </React.Fragment>\n );\n });\n\n const renderReferenceAreas = () =>\n referenceAreas.map(({ area, range }, index) => {\n const [start, end] = range;\n return (\n <ReferenceArea\n key={`${area.label ?? 'area'}-${index}`}\n // Bands run along the category axis, which is X.\n x1={data[start]?.[xKey]}\n x2={data[end]?.[xKey]}\n fill=\"var(--ui-background-surface-secondary)\"\n fillOpacity={0.6}\n ifOverflow=\"extendDomain\"\n shape={resolveBandShape(area.divider)}\n label={resolveBandLabel(area.label)}\n />\n );\n });\n\n const renderReferenceLines = () =>\n referenceLines.map((ref, index) => {\n const value = resolveChartReferenceValue(ref, data, dataKeys);\n if (value === undefined) return null;\n return (\n <ReferenceLine\n key={`${ref.label ?? 'ref'}-${index}`}\n // Drawn on the value axis, which is Y.\n y={value}\n // By default the caption sits above the line's right end.\n {...resolveReferenceLineProps(\n ref.label,\n ref.labelPosition ?? 'insideTopRight'\n )}\n />\n );\n });\n\n return (\n <div\n ref={ref}\n data-orientation={orientation}\n data-layout={layout}\n className={cn(barChartVariants({ orientation, layout }), className)}\n {...props}\n >\n <ChartContainer\n ref={chartContainerRef}\n config={config}\n palette={palette}\n className=\"size-full [&_.recharts-label]:fill-foreground\"\n >\n <RechartsBarChart\n data={chartData as readonly unknown[]}\n layout={rechartsLayout}\n barSize={barSize}\n maxBarSize={maxBarSize}\n barGap={barGap}\n barCategoryGap={barCategoryGap}\n margin={mergeXAxisLayoutMargin(undefined, xAxisLayout.margin)}\n >\n <BarPaintServers id={defsId} dataKeys={dataKeys} shapes={usedShapes} />\n {showGrid && (\n <CartesianGrid\n horizontal={gridHorizontal ?? true}\n vertical={gridVertical ?? false}\n strokeDasharray={gridDashed ? '3 3' : undefined}\n />\n )}\n {renderAxes()}\n {showTooltip && <ChartTooltip content={tooltipElement} />}\n {showLegend && <ChartLegend content={legendElement} />}\n {renderSeries()}\n {renderReferenceAreas()}\n {renderReferenceLines()}\n {showBrush && (\n <Brush\n dataKey={xKey}\n // The brush slices rows by index, so its captions come from the\n // axis holding the categories — X.\n tickFormatter={xTickFormatter}\n {...resolveBrushProps({ brushHeight, brushAriaLabel })}\n />\n )}\n </RechartsBarChart>\n </ChartContainer>\n </div>\n );\n }\n);\nBarChart.displayName = 'BarChart';\n\nexport { BarChart, barChartVariants };\n"],"mappings":";;;;;;;;;;;;AA4EA,IAAM,IAAmB,EAAI,IAAI;CAC/B,UAAU;EACR,aAAa;GACX,UAAU;GACV,YAAY;EACd;EACA,QAAQ;GACN,SAAS;GACT,SAAS;EACX;CACF;CACA,iBAAiB;EACf,aAAa;EACb,QAAQ;CACV;AACF,CAAC,GAmDK,IAAwB;AAQ9B,SAAgB,EACd,G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;GACT,WAAU;GAEV,UAAA,kBAAC,IAAD;IACE,MAAM;IACN,QAAQ;IACC;IACG;IACJ;IACQ;IAChB,QAAQ,GAAuB,KAAA,GAAW,EAAY,MAAM;IAP9D,UAAA;KASE,kBAAC,IAAD;MAAiB,IAAI;MAAkB;MAAU,QAAQ;KAAa,CAAA;KACrE,MACC,kBAAC,IAAD;MACE,YAAY,MAAkB;MAC9B,UAAU,MAAgB;MAC1B,iBAAiB,KAAa,QAAQ,KAAA;KACvC,CAAA;KAEF,GAAW;KACX,MAAe,kBAAC,GAAD,EAAc,SAAS,GAAiB,CAAA;KACvD,MAAc,kBAAC,GAAD,EAAa,SAAS,GAAgB,CAAA;KACpD,GAAa;KACb,GAAqB;KACrB,GAAqB;KACrB,MACC,kBAAC,IAAD;MACE,SAAS;MAGT,eAAe;MACf,GAAI,EAAkB;OAAE;OAAa;MAAe,CAAC;KACtD,CAAA;IAEa;;EACJ,CAAA;CACb,CAAA;AAET,CACF;AACA,EAAS,cAAc"}
1
+ {"version":3,"file":"bar-chart.js","names":[],"sources":["../../../../src/components/ui/bar-chart/bar-chart.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { cva, type VariantProps } from 'class-variance-authority';\nimport {\n Bar,\n BarChart as RechartsBarChart,\n Brush,\n CartesianGrid,\n Cell,\n LabelList,\n ReferenceArea,\n ReferenceLine,\n Rectangle,\n Text,\n XAxis,\n YAxis,\n} from 'recharts';\n\nimport type { BarShapeProps } from 'recharts/types/cartesian/Bar';\nimport { Meter as MeterPrimitive } from '@base-ui/react/meter';\n\nimport { cn } from '@/lib/utils';\nimport { Tooltip, TooltipContent, TooltipTrigger } from '../tooltip';\nimport {\n CHART_LABEL_FONT_SIZE,\n ChartContainer,\n ChartLegend,\n ChartLegendContent,\n ChartTooltip,\n ChartTooltipContent,\n resolveAnimation,\n resolveAxisDomain,\n resolveBrushProps,\n resolveCartesianLabelPosition,\n resolveCategoryRange,\n resolveChartReferenceValue,\n resolveLabelFillClass,\n resolveReferenceLineProps,\n resolveRotatedTickAnchor,\n resolveXAxisTitle,\n resolveYAxisTitle,\n resolveChartColors,\n toLabelFormatter,\n toReferenceLineList,\n type ChartConfig,\n type ChartLegendFontSize,\n type ChartPalette,\n type ChartStatusTone,\n type ChartReferenceLine,\n type ChartLegendContentProps,\n type ChartTooltipContentProps,\n toCssKey,\n type CartesianChartProps,\n type ChartAnimationProps,\n type ChartBrushProps,\n type ChartCategoryRange,\n type ChartDataLabelProps,\n type CartesianLabelPosition,\n} from '../chart';\nimport {\n mergeXAxisLayoutMargin,\n useXAxisLayout,\n} from '../chart/use-x-axis-layout';\nimport { resolveXAxisTickLabels } from '../chart/chart-format';\n\n// The two CVA axes are the design's Bar-chart variant set (B2): `orientation`\n// and `layout` (grouped side-by-side vs stacked). `orientation` is the\n// discriminant for *which component this is*: `vertical` renders the typed\n// recharts composition over the shared `Chart` primitives (bars rising from a\n// category X axis), `horizontal` renders the labelled proportional bar list\n// below, which has no axes, grid, or recharts at all. The classes stay empty\n// because neither mode is styled by a variant class — the recharts SVG draws\n// the vertical bars, and the horizontal list carries its own layout. CVA is\n// kept so the variant set is a first-class, spec-conformant part of the API\n// (matched against ui-spec's api.yaml enums); the resolved values are mirrored\n// onto `data-orientation` / `data-layout` for styling hooks and tests.\nconst barChartVariants = cva('', {\n variants: {\n orientation: {\n vertical: '',\n horizontal: '',\n },\n layout: {\n grouped: '',\n stacked: '',\n },\n },\n defaultVariants: {\n orientation: 'vertical',\n layout: 'grouped',\n },\n});\n\n/**\n * How a bar is painted. `rounded` rounds the growing end by `barRadius`; `pill`\n * rounds every corner to a capsule; `gradient` fades the series color down the\n * bar; `pattern` fills it with diagonal hatching in the series color (a\n * colorblind-safe way to set a subset of bars apart).\n */\nexport type BarChartBarShape = 'rounded' | 'pill' | 'gradient' | 'pattern';\n\n/**\n * Style override for one series over a range of categories — e.g. \"the forecast\n * tail from September onward reads translucent and dashed\". Anything left unset\n * keeps the series' normal painting.\n */\nexport interface BarChartBarSettings extends ChartCategoryRange {\n /** Fill for the matched bars. Defaults to the series color. */\n fill?: string;\n /** Fill opacity for the matched bars. */\n opacity?: number;\n /** Outline the matched bars with a dashed stroke in the series color. */\n dashed?: boolean;\n /** Shape for the matched bars, overriding the chart's `barShape`. */\n shape?: BarChartBarShape;\n /**\n * Track behind the matched bars: `true` fills the plot height, while a data\n * field name caps it at that row's value — the headroom between a projection\n * and its upper bound. A capped track stacks on its bar, so it needs the\n * default `layout=\"grouped\"`; under `layout=\"stacked\"` it is ignored.\n */\n background?: boolean | string;\n}\n\n/** A shaded band behind a range of categories. */\nexport interface BarChartReferenceArea extends ChartCategoryRange {\n /** Caption above the band. */\n label?: string;\n /**\n * Mark the category ticks under the band — accent color, italic — so the\n * highlighted range reads on the axis too. On by default.\n */\n highlightTicks?: boolean;\n /**\n * Draw a dashed rule at the band's leading edge — the hand-off into a\n * forecast. Off by default.\n */\n divider?: boolean;\n}\n\n// Reserved field prefix for the synthetic headroom series a capped track\n// stacks onto its bar. It must never surface in the tooltip or the legend.\nconst HEADROOM_FIELD_PREFIX = '__headroom_';\n\n/**\n * Drop the synthetic headroom series from a recharts tooltip/legend payload,\n * keeping the real series (and their order). `legendType`/`tooltipType=\"none\"`\n * are set on those bars too, but recharts still lists them, so this filter is\n * what actually keeps them out — hence it's unit-tested.\n */\nexport function dropHeadroomSeries<T extends { dataKey?: unknown }>(\n payload: readonly T[] | undefined,\n dataKeys?: string[]\n): T[] | undefined {\n const real = payload?.filter(\n (item) => !String(item.dataKey).startsWith(HEADROOM_FIELD_PREFIX)\n );\n // recharts sorts the legend payload alphabetically by series name by default\n // (its `itemSorter: 'value'`), so passing `dataKeys` puts the entries back in\n // the order the caller declared them.\n return dataKeys\n ? real?.slice().sort(\n (a, b) =>\n dataKeys.indexOf(String(a.dataKey)) -\n dataKeys.indexOf(String(b.dataKey))\n )\n : real;\n}\n\n/**\n * Swap a paint-server fill back to the series color for the chrome. A\n * `gradient` / `pattern` bar fills from `url(#…)`, which paints SVG but means\n * nothing as a CSS background — the legend swatch and the tooltip dot would\n * render blank — so they fall back to the series' own `--color-<key>`.\n */\nexport function withSeriesColor<T extends { dataKey?: unknown; color?: string }>(\n payload: readonly T[] | undefined\n): T[] | undefined {\n return payload?.map((item) =>\n item.color?.startsWith('url(')\n ? { ...item, color: `var(--color-${toCssKey(String(item.dataKey))})` }\n : item\n );\n}\n\ntype TooltipContentType = NonNullable<\n React.ComponentProps<typeof ChartTooltip>['content']\n>;\ntype TooltipContentFn = Extract<\n TooltipContentType,\n (...args: never[]) => unknown\n>;\ntype TooltipRenderProps = Parameters<TooltipContentFn>[0];\n\ntype LegendContentType = NonNullable<\n React.ComponentProps<typeof ChartLegend>['content']\n>;\ntype LegendContentFn = Extract<LegendContentType, (...args: never[]) => unknown>;\ntype LegendRenderProps = Parameters<LegendContentFn>[0];\n\n/**\n * Tooltip content that normalizes recharts' payload before anything renders it:\n * the synthetic headroom series stripped, the rows put back in `dataKeys` order,\n * and paint-server fills swapped back to the series color. Falls through to a\n * caller-supplied `content`, preserving recharts' own mount semantics — a\n * function via `createElement` (its own component identity + hook state), an\n * element via `cloneElement`.\n *\n * This is a component rather than a per-render wrapper factory on purpose:\n * recharts renders `content` by cloning the element it is given\n * (`Tooltip.js:27-28`), so a stable module-level type here means the subtree is\n * never remounted, whatever the caller passes.\n */\nexport function NormalizedTooltipContent({\n content,\n dataKeys,\n ...props\n}: Partial<TooltipRenderProps> & {\n content?: TooltipContentType;\n dataKeys?: string[];\n}) {\n const merged = {\n ...props,\n payload: withSeriesColor(dropHeadroomSeries(props.payload, dataKeys)),\n } as TooltipRenderProps;\n\n if (!content) {\n return <ChartTooltipContent {...(merged as ChartTooltipContentProps)} />;\n }\n return typeof content === 'function'\n ? React.createElement(\n content as React.FunctionComponent<TooltipRenderProps>,\n merged\n )\n : React.cloneElement(content, merged);\n}\n\n/**\n * Legend content over the same normalization. Ordering is the reason this\n * applies unconditionally: recharts sorts legend entries alphabetically by\n * series name by default (`itemSorter: 'value'`), so without putting them back\n * in `dataKeys` order the legend would silently reorder itself depending on\n * which bar-styling props happen to be set.\n */\nexport function NormalizedLegendContent({\n dataKeys,\n fontSize,\n ...props\n}: Partial<LegendRenderProps> & {\n dataKeys: string[];\n fontSize?: ChartLegendFontSize;\n}) {\n return (\n <ChartLegendContent\n verticalAlign={props.verticalAlign}\n fontSize={fontSize}\n payload={\n withSeriesColor(\n dropHeadroomSeries(props.payload, dataKeys)\n ) as ChartLegendContentProps['payload']\n }\n />\n );\n}\n\n/** Paint overrides recharts spreads over a bar to mark it as the active one. */\ninterface BarPaintOverride {\n fill?: string;\n fillOpacity?: number;\n}\n\n/**\n * Draw a bar, optionally over its full-height track (recharts hands a custom\n * `<Bar shape>` the track geometry alongside the bar's). Only geometry and\n * paint props are forwarded — recharts also passes the whole data entry, and\n * spreading that onto an SVG node would leak data fields into the DOM.\n *\n * `paint` is how the active bar keeps its track: recharts swaps a custom\n * `shape` out for the `activeBar` option while a bar is hovered\n * (`Bar.js` `BarRectangleWithActiveState`), so the active option has to be a\n * shape of its own that redraws the track and applies the highlight itself.\n */\nfunction renderBarWithTrack({\n bar,\n track,\n trackFill,\n paint,\n}: {\n bar: Omit<BarShapeProps, 'background' | 'index'>;\n track?: BarShapeProps['background'];\n trackFill: string;\n paint?: BarPaintOverride;\n}) {\n return (\n <>\n {track && (\n <Rectangle\n className=\"recharts-bar-background-rectangle\"\n x={track.x ?? undefined}\n y={track.y ?? undefined}\n width={track.width ?? undefined}\n height={track.height ?? undefined}\n fill={trackFill}\n />\n )}\n <Rectangle\n x={bar.x ?? undefined}\n y={bar.y ?? undefined}\n width={bar.width ?? undefined}\n height={bar.height ?? undefined}\n radius={bar.radius}\n fill={paint?.fill ?? bar.fill}\n fillOpacity={paint?.fillOpacity ?? bar.fillOpacity}\n stroke={bar.stroke}\n strokeWidth={bar.strokeWidth}\n strokeDasharray={bar.strokeDasharray}\n />\n </>\n );\n}\n\n/**\n * Build the `<Bar shape>` that draws a range-scoped track. recharts' own\n * `background` is all-or-nothing per series, so the track is drawn per row and\n * hidden where the range doesn't apply.\n */\nexport function createTrackShape({\n inRange,\n trackFill,\n paint,\n}: {\n inRange: (row: number) => boolean;\n trackFill: string;\n paint?: BarPaintOverride;\n}) {\n return ({ background: track, index: row, ...bar }: BarShapeProps) =>\n renderBarWithTrack({\n bar,\n track: inRange(row) ? track : undefined,\n trackFill,\n paint,\n });\n}\n\n/**\n * The `shape` / `activeBar` pair one series' `<Bar>` is given.\n *\n * They resolve together because recharts swaps a custom `shape` out for the\n * `activeBar` option while a bar is hovered: a range-scoped track has to be\n * redrawn by the active option too, or the track blinks out under the cursor.\n */\nfunction resolveBarShapes({\n rangeBackground,\n inRange,\n trackFill,\n activeBarOption,\n}: {\n /**\n * recharts takes one `background` per series, so a range-scoped one is drawn\n * per row by a custom shape instead: hidden where it doesn't apply.\n */\n rangeBackground: boolean;\n inRange: (row: number) => boolean;\n trackFill: string;\n activeBarOption: BarPaintOverride | false;\n}) {\n if (!rangeBackground) {\n return { shape: undefined, activeBar: activeBarOption };\n }\n return {\n shape: createTrackShape({ inRange, trackFill }),\n activeBar: activeBarOption\n ? createTrackShape({ inRange, trackFill, paint: activeBarOption })\n : activeBarOption,\n };\n}\n\n/**\n * Draw a highlight band plus a dashed rule on its leading edge — the left edge,\n * since the category axis runs along X.\n *\n * The band's own paint comes from the props recharts hands the shape — a\n * `<ReferenceArea shape>` still receives the element's `fill`/`fillOpacity`\n * (`ReferenceArea.js` `renderRect`), so hardcoding them here would quietly\n * ignore whatever the caller set.\n */\nfunction renderBandWithDivider(band: {\n x?: number;\n y?: number;\n width?: number;\n height?: number;\n fill?: string;\n fillOpacity?: number;\n}) {\n const { x = 0, y = 0, width = 0, height = 0, fill, fillOpacity } = band;\n return (\n <>\n <Rectangle\n className=\"recharts-reference-area-rect\"\n x={x}\n y={y}\n width={width}\n height={height}\n fill={fill}\n fillOpacity={fillOpacity}\n />\n <line\n x1={x}\n y1={y}\n x2={x}\n y2={y + height}\n stroke=\"var(--ui-border-on-surface-border)\"\n strokeDasharray=\"4 4\"\n />\n </>\n );\n}\n\n/**\n * The `<ReferenceArea shape>` for a band, or `undefined` so recharts draws its\n * own rect. A custom shape is only needed for the leading-edge rule: a\n * `ReferenceLine` would sit on the tick's centre, and only the band knows where\n * its own edge is.\n */\nfunction resolveBandShape(divider: boolean | undefined) {\n if (!divider) return undefined;\n return renderBandWithDivider;\n}\n\n/**\n * A band's caption as recharts' native `label`. `'insideTop'` is asserted\n * because, read outside the JSX attribute, it would widen to `string` and stop\n * matching recharts' `Position` union.\n */\nfunction resolveBandLabel(label: string | undefined) {\n return label\n ? {\n value: label,\n position: 'insideTop' as const,\n fill: 'var(--ui-text-on-surface-secondary)',\n fontSize: 12,\n }\n : undefined;\n}\n\n/**\n * The `<defs>` a `gradient` / `pattern` bar fills from — one paint server per\n * series, since each is painted in that series' own color. Ids are namespaced\n * by the chart instance so two charts on a page can't collide.\n *\n * Safe to render as a component: unlike `Bar`'s cells, the chart renders its\n * children straight through rather than looking them up by type.\n */\nfunction BarPaintServers({\n id,\n dataKeys,\n shapes,\n}: {\n id: string;\n dataKeys: string[];\n shapes: ReadonlySet<BarChartBarShape>;\n}) {\n const hasGradient = shapes.has('gradient');\n const hasPattern = shapes.has('pattern');\n if (!hasGradient && !hasPattern) return null;\n\n return (\n <defs>\n {dataKeys.map((key) => (\n <React.Fragment key={key}>\n {/* Bars grow up, so a gradient runs top-down. */}\n {hasGradient && (\n <linearGradient id={`${id}-gradient-${toCssKey(key)}`} x1=\"0\" y1=\"0\" x2=\"0\" y2=\"1\">\n <stop\n offset=\"0%\"\n stopColor={`var(--color-${toCssKey(key)})`}\n stopOpacity={1}\n />\n <stop\n offset=\"100%\"\n stopColor={`var(--color-${toCssKey(key)})`}\n stopOpacity={0.35}\n />\n </linearGradient>\n )}\n {hasPattern && (\n <pattern\n id={`${id}-pattern-${toCssKey(key)}`}\n patternUnits=\"userSpaceOnUse\"\n width={6}\n height={6}\n patternTransform=\"rotate(45)\"\n >\n <rect\n width={6}\n height={6}\n fill={`var(--color-${toCssKey(key)})`}\n fillOpacity={0.25}\n />\n <line\n x1={0}\n y1={0}\n x2={0}\n y2={6}\n stroke={`var(--color-${toCssKey(key)})`}\n strokeWidth={3}\n />\n </pattern>\n )}\n </React.Fragment>\n ))}\n </defs>\n );\n}\n\n/** Corner radius as recharts' `Rectangle` takes it: one value or a 4-tuple. */\ntype BarRadius = number | [number, number, number, number] | undefined;\n\ninterface RangeCellsOptions {\n data: ReadonlyArray<Record<string, string | number>>;\n /** `data` plus the synthetic headroom fields, if any were added. */\n chartData: ReadonlyArray<Record<string, string | number>>;\n xKey: string;\n seriesKey: string;\n settings: BarChartBarSettings;\n /** Inclusive row bounds the settings apply to. */\n range: [number, number];\n headroomKey: string | undefined;\n barShape: BarChartBarShape;\n rounded: boolean;\n fillOf: (key: string, shape: BarChartBarShape) => string;\n radiusFor: (shape: BarChartBarShape, rounded: boolean) => BarRadius;\n}\n\n/**\n * The `<Cell>` list that applies a series' `barSettings` over its range: the\n * matched rows take the override fill/opacity/dash/shape, the rest keep the\n * series' normal painting.\n *\n * A plain function returning the elements, deliberately not a component:\n * `Bar` discovers its cells with `findAllByType(props.children, Cell)`\n * (recharts `Bar.js`), which matches each direct child on its own display\n * name. Wrapping these in a component would make that lookup find nothing and\n * silently drop every per-range style — no error, just unstyled bars.\n * Returning an array keeps them direct children, since recharts' `toArray`\n * flattens arrays and unwraps fragments.\n */\nfunction rangeCells({\n data,\n chartData,\n xKey,\n seriesKey,\n settings,\n range,\n headroomKey,\n barShape,\n rounded,\n fillOf,\n radiusFor,\n}: RangeCellsOptions) {\n const { fill, opacity, dashed } = settings;\n\n return data.map((row, rowIndex) => {\n const on = rowIndex >= range[0] && rowIndex <= range[1];\n const shape = (on && settings.shape) || barShape;\n // Only a row that actually carries headroom gives up its rounded end — a\n // row in range whose upper bound is missing, or no higher than its value,\n // keeps it.\n const stacksHeadroom =\n headroomKey !== undefined &&\n Number(\n (chartData[rowIndex] as Record<string, unknown>)?.[\n `${HEADROOM_FIELD_PREFIX}${seriesKey}`\n ]\n ) > 0;\n\n return (\n <Cell\n key={`${seriesKey}-${String(row[xKey])}-${rowIndex}`}\n fill={\n on ? (fill ?? fillOf(seriesKey, shape)) : fillOf(seriesKey, barShape)\n }\n fillOpacity={on ? opacity : undefined}\n stroke={on && dashed ? `var(--color-${toCssKey(seriesKey)})` : undefined}\n strokeWidth={on && dashed ? 1 : undefined}\n strokeDasharray={on && dashed ? '4 3' : undefined}\n // Cell types `radius` as the SVG attribute, but it feeds recharts'\n // Rectangle, which takes the 4-tuple. A bar with headroom stacked on it\n // hands the rounded end to that segment instead.\n radius={\n (stacksHeadroom ? undefined : radiusFor(shape, rounded)) as\n | number\n | undefined\n }\n />\n );\n });\n}\n\n/**\n * The recharts bar chart: bars rising from a category X axis, with axes, grid,\n * tooltip and legend. This is the default — `orientation` is only spelled out\n * to discriminate it from the horizontal mode below.\n */\nexport interface BarChartVerticalProps\n extends Omit<React.ComponentProps<'div'>, 'children'>,\n Omit<VariantProps<typeof barChartVariants>, 'orientation'>,\n CartesianChartProps,\n ChartAnimationProps,\n ChartBrushProps,\n ChartDataLabelProps {\n /** Selects the recharts bar chart. Omit it — this is the default. */\n orientation?: 'vertical';\n /**\n * The dataviz palette this chart's series are painted from. Series that\n * state no `color` of their own take a stop of it. See `ChartPalette`.\n */\n palette?: ChartPalette;\n /** Row-per-category data. Each object holds the category key + one numeric field per series. */\n data: ReadonlyArray<Record<string, string | number>>;\n /**\n * Per-series map of `label` / `icon` / `tone` (from the shared `Chart`\n * primitives). Series take their colour from the container's `palette`; each\n * entry maps a key to a `label` and an optional `tone`.\n */\n config: ChartConfig;\n /** Series to plot — one `<Bar>` per key. Each must exist in `config` and in every data row. */\n dataKeys: string[];\n /** Category axis key (the shared dimension across rows, e.g. `\"month\"`). */\n xKey: string;\n /**\n * One or more dashed reference/average lines on the value (Y) axis. Each is\n * driven by a fixed `value` or a computed series `average`. Pass a single\n * object or an array to draw several at once.\n */\n referenceLine?: ChartReferenceLine | ChartReferenceLine[];\n /**\n * One or more shaded bands behind a range of categories — e.g. a forecast\n * period. Pass a single object or an array to draw several.\n */\n referenceArea?: BarChartReferenceArea | BarChartReferenceArea[];\n /**\n * Per-series style override for a range of categories, keyed by `dataKeys`\n * entry. Bars outside a series' range — and series with no entry — render\n * normally.\n */\n barSettings?: Record<string, BarChartBarSettings>;\n /** Corner radius applied to the growing end of each bar. */\n barRadius?: number;\n /** How every bar is painted. Per-range overrides come from `barSettings`. */\n barShape?: BarChartBarShape;\n /** Fixed bar thickness, in px. Unset, recharts sizes bars from the available width. */\n barSize?: number;\n /** Upper bound on the computed bar thickness, in px. */\n maxBarSize?: number;\n /** Gap between bars of the same category, in px or a percentage string. */\n barGap?: number | string;\n /** Gap between category groups, in px or a percentage string. */\n barCategoryGap?: number | string;\n /**\n * Minimum rendered length for a bar, in px, so a tiny value stays visible. A\n * value of exactly `0` still renders nothing — a floor on it would read as a\n * small positive.\n */\n minPointSize?: number;\n /** Draw a full-height track behind every bar. */\n showBackground?: boolean;\n /** Fill for the track background. Defaults to the secondary surface. */\n backgroundFill?: string;\n /** Highlight the hovered bar. */\n showActiveBar?: boolean;\n /** Painting of the hovered bar when `showActiveBar` is on. */\n activeBar?: {\n /** Fill for the hovered bar. Defaults to the series color. */\n fill?: string;\n /** Fill opacity for the hovered bar. */\n opacity?: number;\n };\n showLegend?: boolean;\n /**\n * Font size of the legend text. Defaults to `'xs'` — the size the legend has\n * always rendered at. See `ChartLegendFontSize`.\n */\n legendFontSize?: ChartLegendFontSize;\n /**\n * Position of the value labels when `showLabels` is on. Defaults to the bar's\n * growing end (`top`), or the segment centre when the layout is stacked.\n */\n labelPosition?: CartesianLabelPosition;\n}\n\n/** One row of the horizontal bar list. */\nexport interface BarChartItem {\n /** Row label, shown at the start of the row. */\n label: string;\n /** The value this row represents. */\n value: number;\n /**\n * Fill color — any CSS color; prefer an existing `--ui-*` token. Required\n * when no `palette` is passed to the chart. Omit when supplying `tone`\n * together with `palette`.\n */\n color?: string;\n /**\n * Palette tone for this row. Resolved against the `palette` prop on the\n * enclosing `BarChart`; ignored when `palette` is omitted and `color` is set.\n */\n tone?: { status: ChartStatusTone };\n /**\n * Projected/forecast total value. When set and greater than `value`, renders\n * a translucent bar (same color, 30% opacity) extending from the actual\n * value's edge to the forecast value. The actual bar renders solid on top.\n * ARIA values always reflect the actual value; `aria-valuetext` also\n * mentions the forecast value. Ignored when `<= value`.\n */\n forecast?: number;\n}\n\n/**\n * The labelled proportional bar list: one row per `items` entry carrying its\n * label, value, share of `max`, and a track bar. No axes, grid, or recharts.\n */\nexport interface BarChartHorizontalProps\n extends Omit<React.ComponentProps<'div'>, 'children'> {\n /** Selects the labelled bar list. */\n orientation: 'horizontal';\n /** Rows to render — one labelled bar per item. */\n items: BarChartItem[];\n /** Upper bound the values are shares of. Defaults to the sum of every item's value. */\n max?: number;\n /** Format the numeric value in the label. Defaults to `toLocaleString()`. */\n valueFormatter?: (value: number) => string;\n /** Show the hover tooltip per row. On by default. */\n showTooltip?: boolean;\n /** Tooltip content shared by every row (replaces the default). Ignored when `showTooltip` is false. */\n tooltip?: React.ReactNode;\n /**\n * Dataviz palette to resolve each item's color from. When provided, each\n * `items` entry should carry a `tone` (and can omit `color`). The colors are\n * resolved in the same order and with the same tone rules as the vertical\n * chart — `status` tones pick a specific palette stop, slot-less items\n * consume the next available stop.\n */\n palette?: ChartPalette;\n}\n\n/**\n * Unified BarChart props — `orientation` selects what gets rendered:\n * - omitted / `'vertical'`: the recharts bar chart (axes, grid, legend).\n * - `'horizontal'`: the labelled proportional bar list.\n */\nexport type BarChartProps = BarChartVerticalProps | BarChartHorizontalProps;\n\nconst defaultFormat = (value: number) => value.toLocaleString();\n\n/**\n * One labelled bar. Base UI's `Meter` primitive supplies `role=\"meter\"` and the\n * indicator's proportional width; the row is not a control, so the only reason\n * it takes focus is to make the tooltip reachable without a pointer.\n */\nfunction HorizontalBarRow({\n item,\n resolvedColor,\n max,\n valueFormatter,\n showTooltip,\n tooltip,\n}: {\n item: BarChartItem;\n resolvedColor: string;\n max: number;\n valueFormatter: (value: number) => string;\n showTooltip: boolean;\n tooltip?: React.ReactNode;\n}) {\n const { label, value, forecast } = item;\n const color = resolvedColor;\n const pct = max > 0 ? Math.round((value / max) * 100) : 0;\n const hasForecast = forecast != null && forecast > value;\n\n const root = (\n <MeterPrimitive.Root\n value={value}\n max={max}\n aria-valuemax={max}\n aria-valuetext={\n hasForecast\n ? `${valueFormatter(value)} of ${valueFormatter(max)} (${pct}%), forecast ${valueFormatter(forecast)}`\n : `${valueFormatter(value)} of ${valueFormatter(max)} (${pct}%)`\n }\n tabIndex={showTooltip ? 0 : undefined}\n className=\"flex w-full flex-col gap-1.5\"\n >\n <div className=\"flex items-baseline justify-between gap-2 text-sm leading-none\">\n <MeterPrimitive.Label className=\"truncate font-semibold\">\n {label}\n </MeterPrimitive.Label>\n <span className=\"shrink-0 tabular-nums\">\n <span className=\"font-semibold text-[var(--ui-text-on-surface-link-idle)]\">\n {valueFormatter(value)}\n </span>\n <span className=\"text-muted-foreground\"> {pct}%</span>\n </span>\n </div>\n <MeterPrimitive.Track className=\"relative h-2 w-full overflow-hidden rounded-full bg-[var(--ui-background-status-neutral-pressed)]\">\n {hasForecast && (\n <div\n data-forecast\n className=\"absolute inset-y-0 start-0 rounded-full\"\n style={{\n backgroundColor: color,\n opacity: 0.3,\n width: `${(forecast / max) * 100}%`,\n }}\n />\n )}\n <MeterPrimitive.Indicator\n className=\"relative rounded-full\"\n style={{ backgroundColor: color }}\n />\n </MeterPrimitive.Track>\n </MeterPrimitive.Root>\n );\n\n if (!showTooltip) return root;\n\n return (\n <Tooltip>\n <TooltipTrigger render={root} />\n <TooltipContent\n className={cn(\n 'border border-border bg-background text-foreground shadow-md',\n !tooltip && 'flex items-center gap-2'\n )}\n >\n {tooltip ?? (\n <>\n <span\n className=\"size-2.5 shrink-0 rounded-full\"\n style={{ backgroundColor: color }}\n />\n <span className=\"font-semibold\">{label}</span>\n <span className=\"text-muted-foreground\">\n {valueFormatter(value)} of {valueFormatter(max)} · {pct}%\n </span>\n </>\n )}\n </TooltipContent>\n </Tooltip>\n );\n}\n\nconst HorizontalBarLayout = React.forwardRef<\n HTMLDivElement,\n Omit<BarChartHorizontalProps, 'orientation'>\n>(\n (\n {\n items,\n max,\n palette,\n valueFormatter = defaultFormat,\n showTooltip = true,\n tooltip,\n className,\n ...props\n },\n ref\n ) => {\n // A max of 0 (or a negative one) would make every share meaningless, so it\n // falls back to the total — and to 1 when even that is 0, so the rows read\n // as empty rather than dividing by zero.\n const safeMax =\n max !== undefined && max > 0\n ? max\n : items.reduce((sum, item) => sum + item.value, 0) || 1;\n\n // When a palette is supplied, resolve each item's color through the same\n // palette machinery as the vertical chart — a synthetic config maps each\n // item's index key to its tone (or explicit color as a pinned stop).\n const resolvedColors = React.useMemo(() => {\n if (!palette) return null;\n // Items with an explicit `color` bypass the palette; items with `tone`\n // (or neither) are resolved through `resolveChartColors`.\n const config: ChartConfig = Object.fromEntries(\n items.map((item, i) => [\n `item${i}`,\n { label: item.label, ...(item.tone ? { tone: item.tone } : {}) },\n ])\n );\n const resolved = resolveChartColors(config, palette);\n return items.map((item, i) => item.color ?? resolved[`item${i}`]?.color ?? '');\n }, [items, palette]);\n\n return (\n <div\n ref={ref}\n data-orientation=\"horizontal\"\n className={cn('flex flex-col gap-4', className)}\n {...props}\n >\n {items.map((item, i) => (\n <HorizontalBarRow\n key={`${i}-${item.label}`}\n item={item}\n resolvedColor={resolvedColors ? (resolvedColors[i] ?? '') : (item.color ?? '')}\n max={safeMax}\n valueFormatter={valueFormatter}\n showTooltip={showTooltip}\n tooltip={tooltip}\n />\n ))}\n </div>\n );\n }\n);\nHorizontalBarLayout.displayName = 'HorizontalBarLayout';\n\nconst BarChart = React.forwardRef<HTMLDivElement, BarChartProps>(\n (rawProps, ref) => {\n // useId must be called unconditionally before any early return (Rules of Hooks).\n const instanceId = React.useId().replace(/:/g, '');\n const chartContainerRef = React.useRef<HTMLDivElement>(null);\n const verticalProps = rawProps as Partial<BarChartVerticalProps>;\n const rawXAxisKey = verticalProps.xKey;\n const rawXAxisTickLabels = resolveXAxisTickLabels(\n verticalProps.data && rawXAxisKey\n ? verticalProps.data.map((row) => row[rawXAxisKey])\n : [],\n verticalProps.xTickFormatter\n );\n const xAxisLayout = useXAxisLayout(\n chartContainerRef,\n verticalProps.xAxisAngle,\n verticalProps.xAxisLabel,\n rawXAxisTickLabels.join('\\u0000')\n );\n\n if (rawProps.orientation === 'horizontal') {\n const { orientation: _orientation, ...horizontalProps } = rawProps;\n return <HorizontalBarLayout {...horizontalProps} ref={ref} />;\n }\n\n const {\n className,\n config,\n palette,\n data,\n dataKeys,\n xKey,\n referenceLine,\n referenceArea,\n barSettings,\n xAxisLabel,\n yAxisLabel,\n yUnit,\n // Consumed rather than spread: a literal `orientation` attribute on the\n // wrapper `<div>` is not a valid DOM prop.\n orientation = 'vertical',\n layout = 'grouped',\n barRadius = 8,\n barShape = 'rounded',\n barSize = 8,\n maxBarSize,\n barGap = 4,\n barCategoryGap,\n minPointSize,\n showBackground = false,\n backgroundFill = 'var(--ui-background-surface-secondary)',\n showActiveBar = false,\n activeBar,\n showGrid = true,\n showTooltip = true,\n showLegend = true,\n legendFontSize,\n showXAxis = true,\n showYAxis = true,\n xTickFormatter,\n yTickFormatter,\n xAxisAngle,\n xAxisInterval,\n yAxisTickCount,\n yAxisDomain,\n gridDashed = true,\n gridHorizontal,\n gridVertical,\n tooltipContent,\n animate,\n animationDuration,\n animationBegin,\n animationEasing,\n showLabels = false,\n labelPosition,\n labelFormatter,\n showBrush = false,\n brushHeight,\n brushAriaLabel,\n ...props\n } = rawProps;\n\n const animation = resolveAnimation({\n animate,\n animationDuration,\n animationBegin,\n animationEasing,\n });\n // recharts' `layout` names the axis the *categories* run along, which for\n // bars rising out of an X axis is its `'horizontal'`.\n const rechartsLayout = 'horizontal';\n const isStacked = layout === 'stacked';\n // Labels sit at the growing end of the bar — above it — or centred in the\n // segment when stacked.\n const barLabelPosition = resolveCartesianLabelPosition({\n labelPosition,\n isStacked,\n growingEnd: 'top',\n });\n\n const referenceLines = toReferenceLineList(referenceLine);\n\n // Bands + the per-series overrides resolved to inclusive row indices once,\n // so the Cells below are a lookup rather than a search per bar.\n const referenceAreas = (\n referenceArea\n ? Array.isArray(referenceArea)\n ? referenceArea\n : [referenceArea]\n : []\n )\n .map((area) => ({ area, range: resolveCategoryRange(area, data, xKey) }))\n .filter(\n (entry): entry is { area: BarChartReferenceArea; range: [number, number] } =>\n entry.range !== undefined\n );\n\n const settingsByKey = new Map(\n dataKeys.flatMap((key) => {\n const settings = barSettings?.[key];\n const range = settings\n ? resolveCategoryRange(settings, data, xKey)\n : undefined;\n return settings && range ? [[key, { settings, range }] as const] : [];\n })\n );\n\n // A capped track is drawn as a synthetic remainder (upper bound minus the\n // bar's own value) stacked on the bar, so recharts scales and animates it\n // rather than us guessing the axis scale from a mid-animation geometry.\n const headroomKeys = new Map(\n isStacked\n ? []\n : Array.from(settingsByKey, ([key, entry]) =>\n typeof entry.settings.background === 'string'\n ? ([key, entry.settings.background] as const)\n : undefined\n ).filter((pair): pair is readonly [string, string] => pair !== undefined)\n );\n\n const chartData = headroomKeys.size\n ? data.map((row, rowIndex) => {\n const extra: Record<string, number> = {};\n headroomKeys.forEach((upperKey, key) => {\n const entry = settingsByKey.get(key);\n if (!entry) return;\n const [start, end] = entry.range;\n if (rowIndex < start || rowIndex > end) return;\n const value = row[key];\n const upper = row[upperKey];\n if (typeof value !== 'number' || typeof upper !== 'number') return;\n extra[`${HEADROOM_FIELD_PREFIX}${key}`] = Math.max(0, upper - value);\n });\n return { ...row, ...extra };\n })\n : data;\n\n // The ticks under a band pick up the accent styling unless the band opts\n // out. Resolved to the categories' own values rather than kept as row\n // indices, because neither index a tick carries can be trusted here: the\n // `index` prop is a position in the list recharts actually renders, which\n // a numeric `interval` (and the default `preserveEnd`, dropping labels that\n // don't fit) has already filtered, and `payload.index` is relative to the\n // slice a `showBrush` selection leaves. The value survives both.\n const highlightedValues = new Set(\n referenceAreas\n .filter(({ area }) => area.highlightTicks !== false)\n .flatMap(({ range }) =>\n data.slice(range[0], range[1] + 1).map((row) => row[xKey])\n )\n );\n\n // recharts places the tick and hands the element its final geometry; we\n // reuse its own <Text> so angle/anchor behavior is unchanged and only add\n // the accent styling for the highlighted range. The formatter still takes\n // the rendered position, since that is what recharts passes its own\n // `tickFormatter`.\n const categoryTick = highlightedValues.size\n ? ({\n payload,\n index,\n ...tickProps\n }: {\n payload: { value: string | number };\n index: number;\n }) => {\n const value = xTickFormatter\n ? xTickFormatter(payload.value as never, index)\n : payload.value;\n return (\n <Text\n {...tickProps}\n className={cn(\n 'fill-muted-foreground',\n highlightedValues.has(payload.value) && 'fill-primary italic'\n )}\n fontSize={12}\n >\n {value}\n </Text>\n );\n }\n : undefined;\n\n // recharts spreads this over the bar's own props, so an explicitly\n // `undefined` fill would wipe the series color (an unfilled path paints\n // black). Only set what the caller asked for, and dim by default so\n // `showActiveBar` alone is visible.\n const activeBarOption = showActiveBar\n ? {\n ...(activeBar?.fill !== undefined ? { fill: activeBar.fill } : {}),\n fillOpacity: activeBar?.opacity ?? 0.85,\n }\n : false;\n\n // `gradient` and `pattern` paint from an SVG def, so the ids have to be\n // unique per chart instance — same guard the shared container applies.\n const defsId = `bar-${instanceId}`;\n const usedShapes = new Set<BarChartBarShape>([barShape]);\n settingsByKey.forEach(({ settings }) => {\n if (settings.shape) usedShapes.add(settings.shape);\n });\n // recharts applies a flat minPointSize to zeroes too, which would draw a\n // sliver where there is nothing to show. For a grouped bar it hands the\n // callback the row's own value, but inside a stack it hands the running\n // total, so a zero segment riding on a non-zero stack would slip through —\n // there the value is read back off the row instead. That read uses the\n // index recharts counts from the *displayed* slice, so a stacked chart\n // whose brush has been dragged off its full range falls back to flooring\n // the zero; the plain (unbrushed) stack, which is what the prop is for, is\n // exact.\n const minPointSizeFor = (key: string) =>\n minPointSize === undefined\n ? undefined\n : (top: number | undefined | null, row: number) => {\n const own = isStacked ? chartData[row]?.[key] : top;\n return typeof own === 'number' && own !== 0 ? minPointSize : 0;\n };\n\n const fillOf = (key: string, shape: BarChartBarShape) =>\n shape === 'gradient'\n ? `url(#${defsId}-gradient-${toCssKey(key)})`\n : shape === 'pattern'\n ? `url(#${defsId}-pattern-${toCssKey(key)})`\n : `var(--color-${toCssKey(key)})`;\n\n // Axis titles: the X title sits below the ticks; the Y title is rotated in\n // the left gutter. Passed to recharts' native `label` (themed via the\n // `.recharts-label` fill selector on the container).\n const xAxisTitle = resolveXAxisTitle(xAxisLabel);\n const yAxisTitle = resolveYAxisTitle(yAxisLabel);\n\n const yDomain = resolveAxisDomain(yAxisDomain);\n\n\n // Round only the growing end — the top of the bar.\n const endRadius: [number, number, number, number] = [\n barRadius,\n barRadius,\n 0,\n 0,\n ];\n // A pill rounds every corner; recharts clamps the radius to half the bar's\n // shorter side, so an oversized number gives a true capsule at any width.\n const radiusFor = (shape: BarChartBarShape, rounded: boolean) =>\n shape === 'pill'\n ? 9999\n : barRadius > 0 && rounded\n ? endRadius\n : undefined;\n\n // Both take the normalization unconditionally: gating it on \"is a\n // headroom/paint-server series in play\" is what let the legend's ordering\n // drift between otherwise identical charts. The helpers are no-ops when\n // there is nothing to strip or recolor.\n const tooltipElement = (\n <NormalizedTooltipContent content={tooltipContent} dataKeys={dataKeys} />\n );\n const legendElement = (\n <NormalizedLegendContent dataKeys={dataKeys} fontSize={legendFontSize} />\n );\n\n // The long chart children are lifted into these renderers so the returned\n // tree reads as a flat list. They are plain functions, not components:\n // recharts looks some of its children up by element type (see `rangeCells`\n // above), so what they return has to stay a *direct* child — an array or a\n // fragment is flattened, a component wrapper would not be.\n\n // The categories run along X and the values along Y, so the category props\n // (dataKey/tick) belong to the X axis and the value props\n // (unit/tickCount/domain) to the Y axis — recharts ignores each set on the\n // other axis.\n const renderAxes = () => (\n <>\n <XAxis\n dataKey={xKey}\n type=\"category\"\n hide={!showXAxis}\n tickLine={false}\n axisLine={false}\n tick={categoryTick}\n tickFormatter={xTickFormatter}\n angle={xAxisAngle}\n interval={xAxisInterval}\n textAnchor={resolveRotatedTickAnchor(xAxisAngle)}\n height={xAxisLayout.height}\n label={xAxisTitle}\n />\n <YAxis\n type=\"number\"\n hide={!showYAxis}\n tickLine={false}\n axisLine={false}\n unit={yUnit}\n tickFormatter={yTickFormatter}\n tickCount={yAxisTickCount}\n domain={yDomain}\n width={yAxisLabel ? 72 : undefined}\n label={yAxisTitle}\n />\n </>\n );\n\n const renderSeries = () =>\n dataKeys.map((key, index) => {\n // In a stack only the last segment's end is rounded; grouped bars\n // each round their own end.\n const rounded = isStacked ? index === dataKeys.length - 1 : true;\n const entry = settingsByKey.get(key);\n const inRange = (row: number) =>\n entry !== undefined && row >= entry.range[0] && row <= entry.range[1];\n const headroomKey = headroomKeys.get(key);\n const { shape, activeBar: activeBarShape } = resolveBarShapes({\n rangeBackground: entry?.settings.background === true,\n inRange,\n trackFill: backgroundFill,\n activeBarOption,\n });\n const cells =\n entry &&\n rangeCells({\n data,\n chartData,\n xKey,\n seriesKey: key,\n settings: entry.settings,\n range: entry.range,\n headroomKey,\n barShape,\n rounded,\n fillOf,\n radiusFor,\n });\n const labels = showLabels && (\n <LabelList\n dataKey={key}\n position={barLabelPosition}\n formatter={toLabelFormatter(labelFormatter)}\n className={resolveLabelFillClass(barLabelPosition)}\n fontSize={CHART_LABEL_FONT_SIZE}\n />\n );\n return (\n <React.Fragment key={key}>\n <Bar\n dataKey={key}\n fill={fillOf(key, barShape)}\n // Its own stack, so the headroom sits on this series' bar\n // while the series stay side by side.\n stackId={isStacked ? 'a' : headroomKey ? key : undefined}\n radius={radiusFor(barShape, rounded)}\n minPointSize={minPointSizeFor(key)}\n background={showBackground ? { fill: backgroundFill } : undefined}\n shape={shape}\n activeBar={activeBarShape}\n {...animation}\n >\n {cells}\n {labels}\n </Bar>\n {headroomKey && (\n <Bar\n dataKey={`${HEADROOM_FIELD_PREFIX}${key}`}\n stackId={key}\n fill={`var(--color-${toCssKey(key)})`}\n fillOpacity={0.25}\n radius={radiusFor(barShape, true)}\n // Decoration for the bar below it — never its own row in the\n // tooltip or entry in the legend.\n legendType=\"none\"\n tooltipType=\"none\"\n {...animation}\n />\n )}\n </React.Fragment>\n );\n });\n\n const renderReferenceAreas = () =>\n referenceAreas.map(({ area, range }, index) => {\n const [start, end] = range;\n return (\n <ReferenceArea\n key={`${area.label ?? 'area'}-${index}`}\n // Bands run along the category axis, which is X.\n x1={data[start]?.[xKey]}\n x2={data[end]?.[xKey]}\n fill=\"var(--ui-background-surface-secondary)\"\n fillOpacity={0.6}\n ifOverflow=\"extendDomain\"\n shape={resolveBandShape(area.divider)}\n label={resolveBandLabel(area.label)}\n />\n );\n });\n\n const renderReferenceLines = () =>\n referenceLines.map((ref, index) => {\n const value = resolveChartReferenceValue(ref, data, dataKeys);\n if (value === undefined) return null;\n return (\n <ReferenceLine\n key={`${ref.label ?? 'ref'}-${index}`}\n // Drawn on the value axis, which is Y.\n y={value}\n // By default the caption sits above the line's right end.\n {...resolveReferenceLineProps(\n ref.label,\n ref.labelPosition ?? 'insideTopRight'\n )}\n />\n );\n });\n\n return (\n <div\n ref={ref}\n data-orientation={orientation}\n data-layout={layout}\n className={cn(barChartVariants({ orientation, layout }), className)}\n {...props}\n >\n <ChartContainer\n ref={chartContainerRef}\n config={config}\n palette={palette}\n className=\"size-full [&_.recharts-label]:fill-foreground\"\n >\n <RechartsBarChart\n data={chartData as readonly unknown[]}\n layout={rechartsLayout}\n barSize={barSize}\n maxBarSize={maxBarSize}\n barGap={barGap}\n barCategoryGap={barCategoryGap}\n margin={mergeXAxisLayoutMargin(undefined, xAxisLayout.margin)}\n >\n <BarPaintServers id={defsId} dataKeys={dataKeys} shapes={usedShapes} />\n {showGrid && (\n <CartesianGrid\n horizontal={gridHorizontal ?? true}\n vertical={gridVertical ?? false}\n strokeDasharray={gridDashed ? '3 3' : undefined}\n />\n )}\n {renderAxes()}\n {showTooltip && <ChartTooltip content={tooltipElement} />}\n {showLegend && <ChartLegend content={legendElement} />}\n {renderSeries()}\n {renderReferenceAreas()}\n {renderReferenceLines()}\n {showBrush && (\n <Brush\n dataKey={xKey}\n // The brush slices rows by index, so its captions come from the\n // axis holding the categories — X.\n tickFormatter={xTickFormatter}\n {...resolveBrushProps({ brushHeight, brushAriaLabel })}\n />\n )}\n </RechartsBarChart>\n </ChartContainer>\n </div>\n );\n }\n);\nBarChart.displayName = 'BarChart';\n\nexport { BarChart, barChartVariants };\n"],"mappings":";;;;;;;;;;;;AA6EA,IAAM,IAAmB,EAAI,IAAI;CAC/B,UAAU;EACR,aAAa;GACX,UAAU;GACV,YAAY;EACd;EACA,QAAQ;GACN,SAAS;GACT,SAAS;EACX;CACF;CACA,iBAAiB;EACf,aAAa;EACb,QAAQ;CACV;AACF,CAAC,GAmDK,IAAwB;AAQ9B,SAAgB,EACd,GACA,GACiB;CACjB,IAAM,IAAO,GAAS,QACnB,MAAS,CAAC,OAAO,EAAK,OAAO,CAAC,CAAC,WAAW,CAAqB,CAClE;CAIA,OAAO,IACH,GAAM,MAAM,CAAC,CAAC,MACX,GAAG,MACF,EAAS,QAAQ,OAAO,EAAE,OAAO,CAAC,IAClC,EAAS,QAAQ,OAAO,EAAE,OAAO,CAAC,CACtC,IACA;AACN;AAQA,SAAgB,EACd,GACiB;CACjB,OAAO,GAAS,KAAK,MACnB,EAAK,OAAO,WAAW,MAAM,IACzB;EAAE,GAAG;EAAM,OAAO,eAAe,EAAS,OAAO,EAAK,OAAO,CAAC,EAAE;CAAG,IACnE,CACN;AACF;AA8BA,SAAgB,GAAyB,EACvC,YACA,aACA,GAAG,KAIF;CACD,IAAM,IAAS;EACb,GAAG;EACH,SAAS,EAAgB,EAAmB,EAAM,SAAS,CAAQ,CAAC;CACtE;CAKA,OAHK,IAGE,OAAO,KAAY,aACtB,EAAM,cACJ,GACA,CACF,IACA,E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