@acronis-platform/ui-react 5.4.1 → 5.4.3

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 (33) hide show
  1. package/dist/components/ui/area-chart/area-chart.js +107 -105
  2. package/dist/components/ui/area-chart/area-chart.js.map +1 -1
  3. package/dist/components/ui/bar-chart/bar-chart.js +135 -132
  4. package/dist/components/ui/bar-chart/bar-chart.js.map +1 -1
  5. package/dist/components/ui/chart/chart-format.js +36 -31
  6. package/dist/components/ui/chart/chart-format.js.map +1 -1
  7. package/dist/components/ui/chart/chart.js +9 -7
  8. package/dist/components/ui/chart/chart.js.map +1 -1
  9. package/dist/components/ui/chart/use-x-axis-layout.js +71 -0
  10. package/dist/components/ui/chart/use-x-axis-layout.js.map +1 -0
  11. package/dist/components/ui/composed-chart/composed-chart.js +141 -139
  12. package/dist/components/ui/composed-chart/composed-chart.js.map +1 -1
  13. package/dist/components/ui/confidence-cone/confidence-cone.js +70 -67
  14. package/dist/components/ui/confidence-cone/confidence-cone.js.map +1 -1
  15. package/dist/components/ui/histogram/histogram.js +54 -51
  16. package/dist/components/ui/histogram/histogram.js.map +1 -1
  17. package/dist/components/ui/line-chart/line-chart.js +119 -117
  18. package/dist/components/ui/line-chart/line-chart.js.map +1 -1
  19. package/dist/components/ui/scatter-chart/scatter-chart.js +53 -51
  20. package/dist/components/ui/scatter-chart/scatter-chart.js.map +1 -1
  21. package/dist/llms/area-chart.md +10 -1
  22. package/dist/llms/bar-chart.md +10 -1
  23. package/dist/llms/composed-chart.md +10 -1
  24. package/dist/llms/confidence-cone.md +10 -1
  25. package/dist/llms/histogram.md +10 -1
  26. package/dist/llms/line-chart.md +10 -1
  27. package/dist/llms/scatter-chart.md +10 -1
  28. package/dist/llms.txt +1 -1
  29. package/dist/src/components/ui/chart/chart-format.d.ts +10 -4
  30. package/dist/src/components/ui/chart/chart.d.ts +1 -1
  31. package/dist/src/components/ui/chart/use-x-axis-layout.d.ts +28 -0
  32. package/dist/ui-react.css +1 -1
  33. package/package.json +2 -2
@@ -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 resolveXAxisHeight,\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';\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\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 const xAxisHeight = resolveXAxisHeight(xAxisLabel, xAxisAngle);\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={xAxisHeight}\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 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 >\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":";;;;;;;;;;;AAwEA,IAAM,KAAmB,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,EAAyB,EACvC,YACA,aACA,GAAG,KAIF;CACD,IAAM,IAAS;EACb,GAAG;EACH,SAAS,EAAgB,EAAmB,EAAM,SAAS,CAAQ,CAAC;CACtE;CAKA,OA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G,GASjC;CAEL,CAAC,GAEG,WACJ,GAAe,KAAK,GAAK,MAAU;EACjC,IAAM,IAAQ,EAA2B,GAAK,GAAM,CAAQ;EAE5D,OADI,MAAU,KAAA,IAAkB,OAE9B,kBAAC,IAAD;GAGE,GAAG;GAEH,GAAI,GACF,EAAI,OACJ,EAAI,iBAAiB,gBACvB;EACD,GARM,GAAG,EAAI,SAAS,MAAM,GAAG,GAQ/B;CAEL,CAAC;CAEH,OACE,kBAAC,OAAD;EACO;EACL,oBAAkB;EAClB,eAAa;EACb,WAAW,EAAG,GAAiB;GAAE;GAAa;EAAO,CAAC,GAAG,CAAS;EAClE,GAAI;EAEJ,UAAA,kBAAC,GAAD;GACU;GACC;GACT,WAAU;GAEV,UAAA,kBAAC,IAAD;IACE,MAAM;IACN,QAAQ;IACC;IACG;IACJ;IACQ;IANlB,UAAA;KAQE,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 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,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;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ACpD,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,5 +1,8 @@
1
1
  //#region src/components/ui/chart/chart-format.ts
2
- function e(e) {
2
+ function e(e, t) {
3
+ return e.map((e, n) => typeof e != "string" && typeof e != "number" ? "" : t ? t(e, n) : e);
4
+ }
5
+ function t(e) {
3
6
  switch (e) {
4
7
  case "auto": return ["auto", "auto"];
5
8
  case "zero": return [0, "auto"];
@@ -7,20 +10,22 @@ function e(e) {
7
10
  default: return;
8
11
  }
9
12
  }
10
- function t(e) {
13
+ function n(e) {
11
14
  if (e != null) return e < 0 ? "end" : "start";
12
15
  }
13
- function n(e, t) {
14
- if (!(!e && t == null)) return 30 + (t == null ? 0 : 20) + (e ? 18 : 0);
16
+ function r(e, t) {
17
+ if (!e && t == null) return;
18
+ let n = e ? 18 : 0;
19
+ return t == null ? 30 + n : 50 + n;
15
20
  }
16
- function r(e, t = "insideBottom", n = 0) {
21
+ function i(e, t = "insideBottom", n = 0) {
17
22
  if (e) return {
18
23
  value: e,
19
24
  position: t,
20
25
  offset: n
21
26
  };
22
27
  }
23
- function i(e, t = "left") {
28
+ function a(e, t = "left") {
24
29
  if (e) return {
25
30
  value: e,
26
31
  angle: t === "left" ? -90 : 90,
@@ -28,7 +33,7 @@ function i(e, t = "left") {
28
33
  style: { textAnchor: "middle" }
29
34
  };
30
35
  }
31
- function a(e, t, n) {
36
+ function o(e, t, n) {
32
37
  if (t.length === 0) return;
33
38
  let r = (e, r) => {
34
39
  if (e === void 0) return r;
@@ -37,7 +42,7 @@ function a(e, t, n) {
37
42
  }, i = r(e.from, 0), a = r(e.to, t.length - 1);
38
43
  if (!(i === -1 || a === -1 || i > a)) return [i, a];
39
44
  }
40
- function o(e) {
45
+ function s(e) {
41
46
  let { animate: t = !1, animationDuration: n, animationBegin: r, animationEasing: i } = e;
42
47
  return {
43
48
  isAnimationActive: t ? "auto" : !1,
@@ -46,15 +51,15 @@ function o(e) {
46
51
  ...i === void 0 ? {} : { animationEasing: i }
47
52
  };
48
53
  }
49
- function s(e) {
54
+ function c(e) {
50
55
  return e?.filter((e) => !(typeof e.dataKey == "string" && e.dataKey.startsWith("_proj_")));
51
56
  }
52
- var c = "fill-[var(--ui-text-on-surface-primary)]!", l = "fill-[var(--ui-text-on-status-strong-neutral)]!", u = 12, d = {
57
+ var l = "fill-[var(--ui-text-on-surface-primary)]!", u = "fill-[var(--ui-text-on-status-strong-neutral)]!", d = 12, f = {
53
58
  top: 16,
54
59
  right: 24,
55
60
  bottom: 5,
56
61
  left: 12
57
- }, f = /* @__PURE__ */ new Set([
62
+ }, p = /* @__PURE__ */ new Set([
58
63
  "center",
59
64
  "centerTop",
60
65
  "centerBottom",
@@ -66,42 +71,42 @@ var c = "fill-[var(--ui-text-on-surface-primary)]!", l = "fill-[var(--ui-text-on
66
71
  "insideEnd",
67
72
  "end"
68
73
  ]);
69
- function p(e) {
74
+ function m(e) {
70
75
  let { labelPosition: t, isStacked: n = !1, growingEnd: r = "top" } = e;
71
76
  return t === void 0 ? n ? "center" : r : t;
72
77
  }
73
- function m(e, t = {}) {
74
- return t.translucentSeries ? c : f.has(e) ? l : c;
78
+ function h(e, t = {}) {
79
+ return t.translucentSeries ? l : p.has(e) ? u : l;
75
80
  }
76
- function h(e) {
81
+ function g(e) {
77
82
  if (e) return (t) => t == null ? "" : e(t);
78
83
  }
79
- function g(e) {
84
+ function _(e) {
80
85
  return e ? Array.isArray(e) ? e : [e] : [];
81
86
  }
82
- function _(e, t, n) {
87
+ function v(e, t, n) {
83
88
  if (!e) return;
84
89
  if (typeof e.value == "number") return e.value;
85
90
  if (!e.average) return;
86
91
  let r = typeof e.average == "string" ? [e.average] : n, i = t.flatMap((e) => r.map((t) => e[t]).filter((e) => typeof e == "number"));
87
92
  if (i.length !== 0) return i.reduce((e, t) => e + t, 0) / i.length;
88
93
  }
89
- var v = "var(--ui-text-on-surface-secondary)";
90
- function y(e, t = "insideTopRight") {
94
+ var y = "var(--ui-text-on-surface-secondary)";
95
+ function b(e, t = "insideTopRight") {
91
96
  return {
92
- stroke: v,
97
+ stroke: y,
93
98
  strokeDasharray: "4 4",
94
99
  ifOverflow: "extendDomain",
95
100
  label: e ? {
96
101
  value: e,
97
102
  position: t,
98
- fill: v,
103
+ fill: y,
99
104
  fontSize: 12
100
105
  } : void 0
101
106
  };
102
107
  }
103
- var b = 28, x = "Chart range selector";
104
- function S({ brushHeight: e, brushAriaLabel: t = x }) {
108
+ var x = 28, S = "Chart range selector";
109
+ function C({ brushHeight: e, brushAriaLabel: t = S }) {
105
110
  return {
106
111
  height: e != null && e > 0 ? e : 28,
107
112
  fill: "var(--ui-background-surface-secondary)",
@@ -110,28 +115,28 @@ function S({ brushHeight: e, brushAriaLabel: t = x }) {
110
115
  ariaLabel: t
111
116
  };
112
117
  }
113
- var C = (e) => {
118
+ var w = (e) => {
114
119
  if (typeof e == "string" && e.trim() === "") return null;
115
120
  let t = typeof e == "number" ? e : Number(e);
116
121
  return Number.isFinite(t) ? t : null;
117
- }, w = (e) => {
118
- let t = C(e);
122
+ }, T = (e) => {
123
+ let t = w(e);
119
124
  return t === null ? String(e) : new Intl.NumberFormat("en", {
120
125
  notation: "compact",
121
126
  maximumFractionDigits: 1
122
127
  }).format(t);
123
- }, T = (e) => {
124
- let t = C(e);
128
+ }, E = (e) => {
129
+ let t = w(e);
125
130
  return t === null ? String(e) : `${t}%`;
126
131
  };
127
- function E(e, t = "en") {
132
+ function D(e, t = "en") {
128
133
  let n = new Intl.NumberFormat(t, e);
129
134
  return (e) => {
130
- let t = C(e);
135
+ let t = w(e);
131
136
  return t === null ? String(e) : n.format(t);
132
137
  };
133
138
  }
134
139
  //#endregion
135
- export { x as CHART_BRUSH_ARIA_LABEL, b as CHART_BRUSH_HEIGHT, c as CHART_LABEL_FILL_CLASS, l as CHART_LABEL_FILL_ON_SERIES_CLASS, u as CHART_LABEL_FONT_SIZE, d as CHART_LABEL_MARGIN, v as CHART_REFERENCE_LINE_STROKE, E as createTickFormatter, s as dropProjectionPayload, w as formatCompactNumber, T as formatPercent, o as resolveAnimation, e as resolveAxisDomain, S as resolveBrushProps, p as resolveCartesianLabelPosition, a as resolveCategoryRange, _ as resolveChartReferenceValue, m as resolveLabelFillClass, y as resolveReferenceLineProps, t as resolveRotatedTickAnchor, n as resolveXAxisHeight, r as resolveXAxisTitle, i as resolveYAxisTitle, h as toLabelFormatter, g as toReferenceLineList };
140
+ export { S as CHART_BRUSH_ARIA_LABEL, x as CHART_BRUSH_HEIGHT, l as CHART_LABEL_FILL_CLASS, u as CHART_LABEL_FILL_ON_SERIES_CLASS, d as CHART_LABEL_FONT_SIZE, f as CHART_LABEL_MARGIN, y as CHART_REFERENCE_LINE_STROKE, D as createTickFormatter, c as dropProjectionPayload, T as formatCompactNumber, E as formatPercent, s as resolveAnimation, t as resolveAxisDomain, C as resolveBrushProps, m as resolveCartesianLabelPosition, o as resolveCategoryRange, v as resolveChartReferenceValue, h as resolveLabelFillClass, b as resolveReferenceLineProps, n as resolveRotatedTickAnchor, r as resolveXAxisHeight, e as resolveXAxisTickLabels, i as resolveXAxisTitle, a as resolveYAxisTitle, g as toLabelFormatter, _ as toReferenceLineList };
136
141
 
137
142
  //# sourceMappingURL=chart-format.js.map