@12-apps/ui 6.58.0 → 6.60.0

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 (50) hide show
  1. package/dist/_internal/components/data-display/Chart/Chart.js +3 -3
  2. package/dist/_internal/components/data-display/Chart/SpecChart.js +6 -6
  3. package/dist/_internal/components/data-display/Chart/chart-context.js +1 -1
  4. package/dist/_internal/components/data-display/Chart/chart-format.js +5 -1
  5. package/dist/_internal/components/data-display/Chart/chart-renderers.js +2 -2
  6. package/dist/_internal/components/data-display/Chart/chart-spec.js +2 -2
  7. package/dist/_internal/components/data-display/Popover/Popover.js +1 -1
  8. package/dist/_internal/components/data-display/index.js +7 -7
  9. package/dist/_internal/components/index.js +7 -7
  10. package/dist/charts.js +6 -6
  11. package/dist/{chunk-UEU5NSIG.js → chunk-3FMWQQW6.js} +3 -3
  12. package/dist/chunk-3FMWQQW6.js.map +1 -0
  13. package/dist/{chunk-DZIRCD2W.js → chunk-4PPNCZWY.js} +3 -3
  14. package/dist/{chunk-QVWNK4JO.js → chunk-6GPNZSAE.js} +19 -2
  15. package/dist/chunk-6GPNZSAE.js.map +1 -0
  16. package/dist/{chunk-62E2X66R.js → chunk-72BVL6VF.js} +8 -4
  17. package/dist/{chunk-62E2X66R.js.map → chunk-72BVL6VF.js.map} +1 -1
  18. package/dist/{chunk-R6SBP5M5.js → chunk-JVOEVTCZ.js} +4 -2
  19. package/dist/chunk-JVOEVTCZ.js.map +1 -0
  20. package/dist/{chunk-7CWZI6MQ.js → chunk-W7N4ORCV.js} +12 -2
  21. package/dist/chunk-W7N4ORCV.js.map +1 -0
  22. package/dist/{chunk-AQI3UK6P.js → chunk-WBDQSBLV.js} +2 -2
  23. package/dist/data-display/Chart.js +6 -6
  24. package/dist/data-display/Popover.js +1 -1
  25. package/dist/mui/styles.js +2 -1
  26. package/dist/mui/styles.js.map +1 -1
  27. package/dist/types/components/data-display/Chart/Chart.types.d.ts +5 -0
  28. package/dist/types/components/data-display/Chart/Chart.types.d.ts.map +1 -1
  29. package/dist/types/components/data-display/Chart/chart-context.d.ts.map +1 -1
  30. package/dist/types/components/data-display/Chart/chart-format.d.ts +14 -0
  31. package/dist/types/components/data-display/Chart/chart-format.d.ts.map +1 -1
  32. package/dist/types/components/data-display/Chart/chart-spec.d.ts.map +1 -1
  33. package/dist/types/components/data-display/Popover/Popover.d.ts.map +1 -1
  34. package/dist/types/mui/styles.d.ts +1 -1
  35. package/dist/types/mui/styles.d.ts.map +1 -1
  36. package/package.json +1 -1
  37. package/src/components/data-display/Chart/Chart.md +5 -1
  38. package/src/components/data-display/Chart/Chart.types.ts +5 -0
  39. package/src/components/data-display/Chart/chart-context.ts +21 -1
  40. package/src/components/data-display/Chart/chart-format.ts +31 -0
  41. package/src/components/data-display/Chart/chart-renderers.tsx +1 -1
  42. package/src/components/data-display/Chart/chart-spec.ts +2 -1
  43. package/src/components/data-display/Popover/Popover.tsx +10 -3
  44. package/src/mui/styles.ts +1 -1
  45. package/dist/chunk-7CWZI6MQ.js.map +0 -1
  46. package/dist/chunk-QVWNK4JO.js.map +0 -1
  47. package/dist/chunk-R6SBP5M5.js.map +0 -1
  48. package/dist/chunk-UEU5NSIG.js.map +0 -1
  49. /package/dist/{chunk-DZIRCD2W.js.map → chunk-4PPNCZWY.js.map} +0 -0
  50. /package/dist/{chunk-AQI3UK6P.js.map → chunk-WBDQSBLV.js.map} +0 -0
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  Chart
3
- } from "../../../../chunk-AQI3UK6P.js";
4
- import "../../../../chunk-UEU5NSIG.js";
5
- import "../../../../chunk-7CWZI6MQ.js";
3
+ } from "../../../../chunk-WBDQSBLV.js";
4
+ import "../../../../chunk-3FMWQQW6.js";
5
+ import "../../../../chunk-W7N4ORCV.js";
6
6
  import "../../../../chunk-SOHQPPYJ.js";
7
7
  import "../../../../chunk-RIRTW5EU.js";
8
8
  import "../../../../chunk-FIMSPRKX.js";
@@ -1,15 +1,15 @@
1
1
  import {
2
2
  SpecChart
3
- } from "../../../../chunk-DZIRCD2W.js";
4
- import "../../../../chunk-AQI3UK6P.js";
5
- import "../../../../chunk-R6SBP5M5.js";
3
+ } from "../../../../chunk-4PPNCZWY.js";
4
+ import "../../../../chunk-WBDQSBLV.js";
5
+ import "../../../../chunk-JVOEVTCZ.js";
6
6
  import "../../../../chunk-WKUA6P3W.js";
7
- import "../../../../chunk-UEU5NSIG.js";
8
- import "../../../../chunk-7CWZI6MQ.js";
7
+ import "../../../../chunk-3FMWQQW6.js";
8
+ import "../../../../chunk-W7N4ORCV.js";
9
9
  import "../../../../chunk-SOHQPPYJ.js";
10
10
  import "../../../../chunk-RIRTW5EU.js";
11
11
  import "../../../../chunk-FIMSPRKX.js";
12
- import "../../../../chunk-QVWNK4JO.js";
12
+ import "../../../../chunk-6GPNZSAE.js";
13
13
  import "../../../../chunk-B7ZHEOQQ.js";
14
14
  import "../../../../chunk-BRHRK7BK.js";
15
15
  import "../../../../chunk-25MSGLNU.js";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  buildChartContext
3
- } from "../../../../chunk-7CWZI6MQ.js";
3
+ } from "../../../../chunk-W7N4ORCV.js";
4
4
  import "../../../../chunk-SOHQPPYJ.js";
5
5
  import "../../../../chunk-FIMSPRKX.js";
6
6
  import "../../../../chunk-B7ZHEOQQ.js";
@@ -1,10 +1,14 @@
1
1
  import {
2
+ chartAxisValueFormatter,
2
3
  chartValueFormatter,
4
+ formatChartAxisValue,
3
5
  formatChartValue
4
- } from "../../../../chunk-QVWNK4JO.js";
6
+ } from "../../../../chunk-6GPNZSAE.js";
5
7
  import "../../../../chunk-PZ5AY32C.js";
6
8
  export {
9
+ chartAxisValueFormatter,
7
10
  chartValueFormatter,
11
+ formatChartAxisValue,
8
12
  formatChartValue
9
13
  };
10
14
  //# sourceMappingURL=chart-format.js.map
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  renderChartByType
3
- } from "../../../../chunk-UEU5NSIG.js";
4
- import "../../../../chunk-7CWZI6MQ.js";
3
+ } from "../../../../chunk-3FMWQQW6.js";
4
+ import "../../../../chunk-W7N4ORCV.js";
5
5
  import "../../../../chunk-SOHQPPYJ.js";
6
6
  import "../../../../chunk-RIRTW5EU.js";
7
7
  import "../../../../chunk-FIMSPRKX.js";
@@ -3,9 +3,9 @@ import {
3
3
  ChartSpecError,
4
4
  parseChartSpec,
5
5
  specToChartProps
6
- } from "../../../../chunk-R6SBP5M5.js";
6
+ } from "../../../../chunk-JVOEVTCZ.js";
7
7
  import "../../../../chunk-WKUA6P3W.js";
8
- import "../../../../chunk-QVWNK4JO.js";
8
+ import "../../../../chunk-6GPNZSAE.js";
9
9
  import "../../../../chunk-PZ5AY32C.js";
10
10
  export {
11
11
  CHART_SEMANTIC_COLORS,
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  Popover
3
- } from "../../../../chunk-62E2X66R.js";
3
+ } from "../../../../chunk-72BVL6VF.js";
4
4
  import "../../../../chunk-SSX5ITPM.js";
5
5
  import "../../../../chunk-F5H2ZXST.js";
6
6
  import "../../../../chunk-N3GAFIXG.js";
@@ -113,7 +113,7 @@ import "../../../chunk-EJDOH7IN.js";
113
113
  import "../../../chunk-6CUNJ4JF.js";
114
114
  import {
115
115
  Popover
116
- } from "../../../chunk-62E2X66R.js";
116
+ } from "../../../chunk-72BVL6VF.js";
117
117
  import "../../../chunk-62FET2BM.js";
118
118
  import {
119
119
  Carousel
@@ -216,23 +216,23 @@ import "../../../chunk-3LHZCVGM.js";
216
216
  import "../../../chunk-5KLSLD72.js";
217
217
  import {
218
218
  SpecChart
219
- } from "../../../chunk-DZIRCD2W.js";
219
+ } from "../../../chunk-4PPNCZWY.js";
220
220
  import {
221
221
  Chart
222
- } from "../../../chunk-AQI3UK6P.js";
222
+ } from "../../../chunk-WBDQSBLV.js";
223
223
  import {
224
224
  CHART_SEMANTIC_COLORS,
225
225
  ChartSpecError,
226
226
  parseChartSpec,
227
227
  specToChartProps
228
- } from "../../../chunk-R6SBP5M5.js";
228
+ } from "../../../chunk-JVOEVTCZ.js";
229
229
  import {
230
230
  getChartSpecRenderer,
231
231
  getRegisteredChartSpecTypes,
232
232
  registerChartSpecRenderer
233
233
  } from "../../../chunk-WKUA6P3W.js";
234
- import "../../../chunk-UEU5NSIG.js";
235
- import "../../../chunk-7CWZI6MQ.js";
234
+ import "../../../chunk-3FMWQQW6.js";
235
+ import "../../../chunk-W7N4ORCV.js";
236
236
  import "../../../chunk-SOHQPPYJ.js";
237
237
  import {
238
238
  ChartContainer,
@@ -245,7 +245,7 @@ import "../../../chunk-FIMSPRKX.js";
245
245
  import {
246
246
  chartValueFormatter,
247
247
  formatChartValue
248
- } from "../../../chunk-QVWNK4JO.js";
248
+ } from "../../../chunk-6GPNZSAE.js";
249
249
  import {
250
250
  Avatar,
251
251
  AvatarGroup
@@ -548,7 +548,7 @@ import "../../chunk-EJDOH7IN.js";
548
548
  import "../../chunk-6CUNJ4JF.js";
549
549
  import {
550
550
  Popover
551
- } from "../../chunk-62E2X66R.js";
551
+ } from "../../chunk-72BVL6VF.js";
552
552
  import "../../chunk-62FET2BM.js";
553
553
  import {
554
554
  Carousel
@@ -788,23 +788,23 @@ import "../../chunk-IBOFASAZ.js";
788
788
  import "../../chunk-5KLSLD72.js";
789
789
  import {
790
790
  SpecChart
791
- } from "../../chunk-DZIRCD2W.js";
791
+ } from "../../chunk-4PPNCZWY.js";
792
792
  import {
793
793
  Chart
794
- } from "../../chunk-AQI3UK6P.js";
794
+ } from "../../chunk-WBDQSBLV.js";
795
795
  import {
796
796
  CHART_SEMANTIC_COLORS,
797
797
  ChartSpecError,
798
798
  parseChartSpec,
799
799
  specToChartProps
800
- } from "../../chunk-R6SBP5M5.js";
800
+ } from "../../chunk-JVOEVTCZ.js";
801
801
  import {
802
802
  getChartSpecRenderer,
803
803
  getRegisteredChartSpecTypes,
804
804
  registerChartSpecRenderer
805
805
  } from "../../chunk-WKUA6P3W.js";
806
- import "../../chunk-UEU5NSIG.js";
807
- import "../../chunk-7CWZI6MQ.js";
806
+ import "../../chunk-3FMWQQW6.js";
807
+ import "../../chunk-W7N4ORCV.js";
808
808
  import "../../chunk-SOHQPPYJ.js";
809
809
  import {
810
810
  ChartContainer,
@@ -817,7 +817,7 @@ import "../../chunk-FIMSPRKX.js";
817
817
  import {
818
818
  chartValueFormatter,
819
819
  formatChartValue
820
- } from "../../chunk-QVWNK4JO.js";
820
+ } from "../../chunk-6GPNZSAE.js";
821
821
  import "../../chunk-6GP2DOOO.js";
822
822
  import {
823
823
  Heading
package/dist/charts.js CHANGED
@@ -1,23 +1,23 @@
1
1
  import "./chunk-5KLSLD72.js";
2
2
  import {
3
3
  SpecChart
4
- } from "./chunk-DZIRCD2W.js";
4
+ } from "./chunk-4PPNCZWY.js";
5
5
  import {
6
6
  Chart
7
- } from "./chunk-AQI3UK6P.js";
7
+ } from "./chunk-WBDQSBLV.js";
8
8
  import {
9
9
  CHART_SEMANTIC_COLORS,
10
10
  ChartSpecError,
11
11
  parseChartSpec,
12
12
  specToChartProps
13
- } from "./chunk-R6SBP5M5.js";
13
+ } from "./chunk-JVOEVTCZ.js";
14
14
  import {
15
15
  getChartSpecRenderer,
16
16
  getRegisteredChartSpecTypes,
17
17
  registerChartSpecRenderer
18
18
  } from "./chunk-WKUA6P3W.js";
19
- import "./chunk-UEU5NSIG.js";
20
- import "./chunk-7CWZI6MQ.js";
19
+ import "./chunk-3FMWQQW6.js";
20
+ import "./chunk-W7N4ORCV.js";
21
21
  import "./chunk-SOHQPPYJ.js";
22
22
  import {
23
23
  ChartContainer,
@@ -30,7 +30,7 @@ import "./chunk-FIMSPRKX.js";
30
30
  import {
31
31
  chartValueFormatter,
32
32
  formatChartValue
33
- } from "./chunk-QVWNK4JO.js";
33
+ } from "./chunk-6GPNZSAE.js";
34
34
  import "./chunk-B7ZHEOQQ.js";
35
35
  import "./chunk-BRHRK7BK.js";
36
36
  import "./chunk-25MSGLNU.js";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  buildChartContext
3
- } from "./chunk-7CWZI6MQ.js";
3
+ } from "./chunk-W7N4ORCV.js";
4
4
  import {
5
5
  ChartLegendContent,
6
6
  ChartTooltipContent
@@ -78,7 +78,7 @@ function cartesianAxes(ctx) {
78
78
  label: props.yAxisLabel,
79
79
  width: "auto",
80
80
  tickMargin: axisConfig.tickMargin,
81
- tickFormatter: props.valueFormatter,
81
+ tickFormatter: props.axisValueFormatter ?? props.valueFormatter,
82
82
  allowDecimals: props.allowDecimalTicks !== false
83
83
  },
84
84
  "y"
@@ -318,4 +318,4 @@ function renderChartByType(props, theme) {
318
318
  export {
319
319
  renderChartByType
320
320
  };
321
- //# sourceMappingURL=chunk-UEU5NSIG.js.map
321
+ //# sourceMappingURL=chunk-3FMWQQW6.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/components/data-display/Chart/chart-renderers.tsx"],"sourcesContent":["import type { Theme } from '@mui/material/styles/index.js';\nimport React from 'react';\nimport {\n Area,\n AreaChart,\n Bar,\n BarChart,\n CartesianGrid,\n Cell,\n ComposedChart,\n Legend,\n Line,\n LineChart,\n Pie,\n PieChart,\n PolarAngleAxis,\n PolarGrid,\n PolarRadiusAxis,\n Radar,\n RadarChart,\n Scatter,\n ScatterChart,\n Tooltip,\n XAxis,\n YAxis,\n} from 'recharts';\n\nimport type { ChartProps, ChartSeries } from './Chart.types';\nimport { ChartLegendContent, ChartTooltipContent } from './ChartComposables';\nimport { buildChartContext, type ChartRenderContext } from './chart-context';\nimport { uiInk } from '../../../tokens/ink';\nimport { remPx } from '../../../tokens/relative';\n\n/**\n * Per-type Recharts renderers for the prop-driven Chart, dispatched from a\n * registry keyed by `ChartProps['type']`. Each renderer reads a prepared\n * {@link ChartRenderContext} so every function stays small.\n */\n\nfunction chartExtras(ctx: ChartRenderContext): React.ReactNode[] {\n const { props } = ctx;\n const nodes: React.ReactNode[] = [];\n if (props.showTooltip !== false) {\n nodes.push(\n <Tooltip key=\"tooltip\" content={<ChartTooltipContent valueFormatter={props.valueFormatter} />} />,\n );\n }\n if (props.showLegend !== false) {\n nodes.push(<Legend key=\"legend\" content={<ChartLegendContent />} />);\n }\n return nodes;\n}\n\n/**\n * Gridlines: solid, and one step below the card border. A dashed line at the\n * border's own weight competes with the data drawn over it.\n */\nfunction chartGrid(ctx: ChartRenderContext): React.ReactElement {\n return <CartesianGrid key=\"grid\" stroke={ctx.gridStroke} strokeOpacity={ctx.gridOpacity} />;\n}\n\nfunction cartesianAxes(ctx: ChartRenderContext): React.ReactNode[] {\n const { props, axisConfig } = ctx;\n const nodes: React.ReactNode[] = [];\n if (props.showCartesianGrid !== false) nodes.push(chartGrid(ctx));\n nodes.push(\n <XAxis\n key=\"x\"\n dataKey={props.xAxisKey ?? 'name'}\n style={ctx.axisStyle}\n label={props.xAxisLabel}\n tickMargin={axisConfig.tickMargin}\n ticks={axisConfig.categoryTicks}\n tickFormatter={axisConfig.tickFormatter}\n />,\n <YAxis\n key=\"y\"\n style={ctx.axisStyle}\n label={props.yAxisLabel}\n // Sized from its own widest tick: a fixed 60px lets \"R$ 1.234,56\" spill\n // out of the card, which is the other way axis text ends up on top of\n // something.\n width=\"auto\"\n tickMargin={axisConfig.tickMargin}\n tickFormatter={props.axisValueFormatter ?? props.valueFormatter}\n allowDecimals={props.allowDecimalTicks !== false}\n />,\n );\n return nodes;\n}\n\nfunction renderLine(ctx: ChartRenderContext): React.ReactElement {\n return (\n <LineChart {...ctx.commonProps}>\n {cartesianAxes(ctx)}\n {chartExtras(ctx)}\n {ctx.chartSeries.map((s, index) => (\n <Line\n key={s.dataKey}\n type={ctx.strokeType}\n dataKey={s.dataKey}\n name={s.name}\n stroke={s.color ?? ctx.chartColors[index % ctx.chartColors.length]}\n strokeWidth={s.strokeWidth ?? 2}\n dot={s.dot !== false}\n activeDot={s.activeDot !== false ? { r: 8 } : false}\n animationDuration={ctx.animationDuration}\n />\n ))}\n </LineChart>\n );\n}\n\nfunction renderBar(ctx: ChartRenderContext): React.ReactElement {\n return (\n <BarChart {...ctx.commonProps}>\n {cartesianAxes(ctx)}\n {chartExtras(ctx)}\n {ctx.chartSeries.map((s, index) => (\n <Bar\n key={s.dataKey}\n dataKey={s.dataKey}\n name={s.name}\n fill={s.fill ?? s.color ?? ctx.chartColors[index % ctx.chartColors.length]}\n stackId={ctx.props.stacked ? 'stack' : undefined}\n radius={ctx.barGeometry.radius}\n maxBarSize={ctx.barGeometry.maxBarSize}\n animationDuration={ctx.animationDuration}\n />\n ))}\n </BarChart>\n );\n}\n\nfunction renderArea(ctx: ChartRenderContext): React.ReactElement {\n return (\n <AreaChart {...ctx.commonProps}>\n {cartesianAxes(ctx)}\n {chartExtras(ctx)}\n {ctx.chartSeries.map((s, index) => (\n <Area\n key={s.dataKey}\n type={ctx.strokeType}\n dataKey={s.dataKey}\n name={s.name}\n stroke={s.color ?? ctx.chartColors[index % ctx.chartColors.length]}\n fill={s.fill ?? s.color ?? ctx.chartColors[index % ctx.chartColors.length]}\n fillOpacity={s.fillOpacity ?? 0.6}\n stackId={ctx.props.stacked ? 'stack' : undefined}\n animationDuration={ctx.animationDuration}\n />\n ))}\n </AreaChart>\n );\n}\n\nfunction pieCenterLabel(ctx: ChartRenderContext): React.ReactNode {\n const { centerLabel } = ctx.props;\n const innerRadius = ctx.props.innerRadius ?? 0;\n if (!centerLabel || innerRadius <= 0) return null;\n const fill = ctx.props.variant === 'neon' ? uiInk(ctx.theme).dataVizNeon.accent : ctx.theme.palette.text.primary;\n return (\n <text\n x=\"50%\"\n y=\"50%\"\n textAnchor=\"middle\"\n dominantBaseline=\"middle\"\n style={{ fontSize: ctx.sizeStyles.fontSize, fill, fontWeight: 600 }}\n >\n {typeof centerLabel === 'string' ? (\n centerLabel\n ) : (\n <>\n <tspan\n x=\"50%\"\n dy=\"-0.6em\"\n style={{ fontSize: '0.875em', fontWeight: 500, fill: ctx.theme.palette.text.secondary }}\n >\n {centerLabel.label}\n </tspan>\n <tspan x=\"50%\" dy=\"1.4em\" style={{ fontSize: '1.5em', fontWeight: 700 }}>\n {centerLabel.value}\n </tspan>\n </>\n )}\n </text>\n );\n}\n\nfunction renderPie(ctx: ChartRenderContext): React.ReactElement {\n const { props } = ctx;\n return (\n <PieChart>\n {chartExtras(ctx)}\n <Pie\n data={props.data}\n dataKey={ctx.chartSeries[0]?.dataKey ?? 'value'}\n nameKey={props.xAxisKey ?? 'name'}\n cx=\"50%\"\n cy=\"50%\"\n outerRadius={ctx.sizeStyles.height / 3}\n innerRadius={remPx(ctx.theme, props.innerRadius ?? 0)}\n fill={ctx.chartColors[0]}\n label={props.showValues ?? false}\n animationDuration={ctx.animationDuration}\n >\n {props.data.map((entry, index) => (\n <Cell key={`cell-${index}`} fill={ctx.chartColors[index % ctx.chartColors.length]} />\n ))}\n </Pie>\n {pieCenterLabel(ctx)}\n </PieChart>\n );\n}\n\nfunction renderRadar(ctx: ChartRenderContext): React.ReactElement {\n return (\n <RadarChart {...ctx.commonProps}>\n <PolarGrid stroke={ctx.gridStroke} />\n <PolarAngleAxis dataKey={ctx.props.xAxisKey ?? 'name'} style={ctx.axisStyle} />\n <PolarRadiusAxis style={ctx.axisStyle} />\n {chartExtras(ctx)}\n {ctx.chartSeries.map((s, index) => (\n <Radar\n key={s.dataKey}\n dataKey={s.dataKey}\n name={s.name}\n stroke={s.color ?? ctx.chartColors[index % ctx.chartColors.length]}\n fill={s.fill ?? s.color ?? ctx.chartColors[index % ctx.chartColors.length]}\n fillOpacity={s.fillOpacity ?? 0.6}\n animationDuration={ctx.animationDuration}\n />\n ))}\n </RadarChart>\n );\n}\n\nfunction renderScatter(ctx: ChartRenderContext): React.ReactElement {\n const { props } = ctx;\n return (\n <ScatterChart {...ctx.commonProps}>\n {props.showCartesianGrid !== false && chartGrid(ctx)}\n <XAxis\n dataKey={props.xAxisKey ?? 'name'}\n style={ctx.axisStyle}\n label={props.xAxisLabel}\n tickMargin={ctx.axisConfig.tickMargin}\n />\n <YAxis\n dataKey={ctx.chartSeries[0]?.dataKey}\n style={ctx.axisStyle}\n label={props.yAxisLabel}\n tickMargin={ctx.axisConfig.tickMargin}\n />\n {chartExtras(ctx)}\n <Scatter\n name={ctx.chartSeries[0]?.name ?? 'Data'}\n data={props.data}\n fill={ctx.chartColors[0]}\n animationDuration={ctx.animationDuration}\n />\n </ScatterChart>\n );\n}\n\nfunction composedSeries(ctx: ChartRenderContext, s: ChartSeries, index: number): React.ReactElement {\n const color = s.color ?? ctx.chartColors[index % ctx.chartColors.length];\n if (s.type === 'bar') {\n return (\n <Bar\n key={s.dataKey}\n dataKey={s.dataKey}\n name={s.name}\n fill={color}\n radius={ctx.barGeometry.radius}\n maxBarSize={ctx.barGeometry.maxBarSize}\n animationDuration={ctx.animationDuration}\n />\n );\n }\n if (s.type === 'area') {\n return (\n <Area\n key={s.dataKey}\n type={ctx.strokeType}\n dataKey={s.dataKey}\n name={s.name}\n stroke={color}\n fill={color}\n fillOpacity={0.6}\n animationDuration={ctx.animationDuration}\n />\n );\n }\n return (\n <Line\n key={s.dataKey}\n type={ctx.strokeType}\n dataKey={s.dataKey}\n name={s.name}\n stroke={color}\n animationDuration={ctx.animationDuration}\n />\n );\n}\n\nfunction renderComposed(ctx: ChartRenderContext): React.ReactElement {\n return (\n <ComposedChart {...ctx.commonProps}>\n {cartesianAxes(ctx)}\n {chartExtras(ctx)}\n {ctx.chartSeries.map((s, index) => composedSeries(ctx, s, index))}\n </ComposedChart>\n );\n}\n\nconst RENDERERS: Record<string, (ctx: ChartRenderContext) => React.ReactElement> = {\n line: renderLine,\n bar: renderBar,\n area: renderArea,\n pie: renderPie,\n radar: renderRadar,\n scatter: renderScatter,\n composed: renderComposed,\n};\n\n/** Render the Recharts element for the requested chart type. */\nexport function renderChartByType(props: ChartProps, theme: Theme): React.ReactElement {\n const renderer = RENDERERS[props.type ?? 'line'];\n const ctx = buildChartContext(props, theme);\n return renderer ? renderer(ctx) : <></>;\n}\n"],"mappings":";;;;;;;;;;;;;;;AAEA;AAAA,EACE;AAAA,EACA;AAA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AA,QACR,QAAQ;AAAA,QACR,MAAM;AAAA,QACN,aAAa;AAAA,QACb,mBAAmB,IAAI;AAAA;AAAA,MAPlB,EAAE;AAAA,IAQT;AAAA,EAEJ;AACA,SACE;AAAA,IAAC;AAAA;AAAA,MAEC,MAAM,IAAI;AAAA,MACV,SAAS,EAAE;AAAA,MACX,MAAM,EAAE;AAAA,MACR,QAAQ;AAAA,MACR,mBAAmB,IAAI;AAAA;AAAA,IALlB,EAAE;AAAA,EAMT;AAEJ;AAEA,SAAS,eAAe,KAA6C;AACnE,SACE,qBAAC,iBAAe,GAAG,IAAI,aACpB;AAAA,kBAAc,GAAG;AAAA,IACjB,YAAY,GAAG;AAAA,IACf,IAAI,YAAY,IAAI,CAAC,GAAG,UAAU,eAAe,KAAK,GAAG,KAAK,CAAC;AAAA,KAClE;AAEJ;AAEA,IAAM,YAA6E;AAAA,EACjF,MAAM;AAAA,EACN,KAAK;AAAA,EACL,MAAM;AAAA,EACN,KAAK;AAAA,EACL,OAAO;AAAA,EACP,SAAS;AAAA,EACT,UAAU;AACZ;AAGO,SAAS,kBAAkB,OAAmB,OAAkC;AACrF,QAAM,WAAW,UAAU,MAAM,QAAQ,MAAM;AAC/C,QAAM,MAAM,kBAAkB,OAAO,KAAK;AAC1C,SAAO,WAAW,SAAS,GAAG,IAAI,gCAAE;AACtC;","names":[]}
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  Chart
3
- } from "./chunk-AQI3UK6P.js";
3
+ } from "./chunk-WBDQSBLV.js";
4
4
  import {
5
5
  CHART_SEMANTIC_COLORS,
6
6
  specToChartProps
7
- } from "./chunk-R6SBP5M5.js";
7
+ } from "./chunk-JVOEVTCZ.js";
8
8
  import {
9
9
  accentFor
10
10
  } from "./chunk-B7ZHEOQQ.js";
@@ -46,4 +46,4 @@ var SpecChart = ({
46
46
  export {
47
47
  SpecChart
48
48
  };
49
- //# sourceMappingURL=chunk-DZIRCD2W.js.map
49
+ //# sourceMappingURL=chunk-4PPNCZWY.js.map
@@ -14,9 +14,26 @@ function formatChartValue(value, format = "decimal") {
14
14
  function chartValueFormatter(format) {
15
15
  return (value) => formatChartValue(value, format);
16
16
  }
17
+ var brlWhole = new Intl.NumberFormat("pt-BR", {
18
+ style: "currency",
19
+ currency: "BRL",
20
+ minimumFractionDigits: 0,
21
+ maximumFractionDigits: 0
22
+ });
23
+ function formatChartAxisValue(value, format = "decimal") {
24
+ if (format === "brl" && Number.isFinite(value) && value % 100 === 0) {
25
+ return brlWhole.format(value / 100);
26
+ }
27
+ return formatChartValue(value, format);
28
+ }
29
+ function chartAxisValueFormatter(format) {
30
+ return (value) => formatChartAxisValue(value, format);
31
+ }
17
32
 
18
33
  export {
19
34
  formatChartValue,
20
- chartValueFormatter
35
+ chartValueFormatter,
36
+ formatChartAxisValue,
37
+ chartAxisValueFormatter
21
38
  };
22
- //# sourceMappingURL=chunk-QVWNK4JO.js.map
39
+ //# sourceMappingURL=chunk-6GPNZSAE.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/components/data-display/Chart/chart-format.ts"],"sourcesContent":["import type { ChartNumberFormat } from './ChartSpec.types';\n\nconst formatters: Record<ChartNumberFormat, Intl.NumberFormat> = {\n brl: new Intl.NumberFormat('pt-BR', { style: 'currency', currency: 'BRL' }),\n percent: new Intl.NumberFormat('pt-BR', { style: 'percent', maximumFractionDigits: 1 }),\n compact: new Intl.NumberFormat('pt-BR', { notation: 'compact', maximumFractionDigits: 1 }),\n integer: new Intl.NumberFormat('pt-BR', { maximumFractionDigits: 0 }),\n decimal: new Intl.NumberFormat('pt-BR', { maximumFractionDigits: 2 }),\n};\n\n/**\n * Format a chart value with one of the serializable number formats.\n * `brl` expects integer centavos (repo-wide money convention); `percent`\n * expects a fraction (0.15 → \"15%\"). Non-finite values render as an empty\n * string so a null-ish row never draws \"NaN\" into a tooltip or axis.\n */\nexport function formatChartValue(value: number, format: ChartNumberFormat = 'decimal'): string {\n if (!Number.isFinite(value)) return '';\n if (format === 'brl') return formatters.brl.format(value / 100);\n return formatters[format].format(value);\n}\n\n/** Curried {@link formatChartValue}, memo-friendly for tooltip/axis props. */\nexport function chartValueFormatter(format?: ChartNumberFormat): (value: number) => string {\n return (value: number) => formatChartValue(value, format);\n}\n\n/** Whole reais, for an axis tick that has no centavos to show. */\nconst brlWhole = new Intl.NumberFormat('pt-BR', {\n style: 'currency',\n currency: 'BRL',\n minimumFractionDigits: 0,\n maximumFractionDigits: 0,\n});\n\n/**\n * Format a value-AXIS tick: {@link formatChartValue}, except that a `brl` tick\n * on a whole real drops its \",00\".\n *\n * An axis tick is a gridline's name, not an amount anybody reads to the\n * centavo. Recharts picks round ticks (R$ 45, R$ 90, R$ 135…), so on a phone\n * \"R$ 180,00\" spent a fifth of the card on two zeros and squeezed the plot it\n * labels to ~160px at 390. A tick that does fall between reais keeps its\n * centavos, so no tick is ever rounded into a value it is not. Tooltips keep\n * the full amount: they ARE read to the centavo.\n */\nexport function formatChartAxisValue(value: number, format: ChartNumberFormat = 'decimal'): string {\n if (format === 'brl' && Number.isFinite(value) && value % 100 === 0) {\n return brlWhole.format(value / 100);\n }\n return formatChartValue(value, format);\n}\n\n/** Curried {@link formatChartAxisValue}, memo-friendly for the value axis. */\nexport function chartAxisValueFormatter(format?: ChartNumberFormat): (value: number) => string {\n return (value: number) => formatChartAxisValue(value, format);\n}\n"],"mappings":";AAEA,IAAM,aAA2D;AAAA,EAC/D,KAAK,IAAI,KAAK,aAAa,SAAS,EAAE,OAAO,YAAY,UAAU,MAAM,CAAC;AAAA,EAC1E,SAAS,IAAI,KAAK,aAAa,SAAS,EAAE,OAAO,WAAW,uBAAuB,EAAE,CAAC;AAAA,EACtF,SAAS,IAAI,KAAK,aAAa,SAAS,EAAE,UAAU,WAAW,uBAAuB,EAAE,CAAC;AAAA,EACzF,SAAS,IAAI,KAAK,aAAa,SAAS,EAAE,uBAAuB,EAAE,CAAC;AAAA,EACpE,SAAS,IAAI,KAAK,aAAa,SAAS,EAAE,uBAAuB,EAAE,CAAC;AACtE;AAQO,SAAS,iBAAiB,OAAe,SAA4B,WAAmB;AAC7F,MAAI,CAAC,OAAO,SAAS,KAAK,EAAG,QAAO;AACpC,MAAI,WAAW,MAAO,QAAO,WAAW,IAAI,OAAO,QAAQ,GAAG;AAC9D,SAAO,WAAW,MAAM,EAAE,OAAO,KAAK;AACxC;AAGO,SAAS,oBAAoB,QAAuD;AACzF,SAAO,CAAC,UAAkB,iBAAiB,OAAO,MAAM;AAC1D;AAGA,IAAM,WAAW,IAAI,KAAK,aAAa,SAAS;AAAA,EAC9C,OAAO;AAAA,EACP,UAAU;AAAA,EACV,uBAAuB;AAAA,EACvB,uBAAuB;AACzB,CAAC;AAaM,SAAS,qBAAqB,OAAe,SAA4B,WAAmB;AACjG,MAAI,WAAW,SAAS,OAAO,SAAS,KAAK,KAAK,QAAQ,QAAQ,GAAG;AACnE,WAAO,SAAS,OAAO,QAAQ,GAAG;AAAA,EACpC;AACA,SAAO,iBAAiB,OAAO,MAAM;AACvC;AAGO,SAAS,wBAAwB,QAAuD;AAC7F,SAAO,CAAC,UAAkB,qBAAqB,OAAO,MAAM;AAC9D;","names":[]}
@@ -106,21 +106,25 @@ var Popover = React.forwardRef(
106
106
  maxWidth,
107
107
  dataTestId,
108
108
  children,
109
+ PaperProps: callerPaper,
109
110
  ...props
110
111
  }, ref) => /* @__PURE__ */ jsx(
111
112
  MuiPopover,
112
113
  {
113
114
  ref,
114
115
  "data-testid": dataTestId || "popover-content",
116
+ ...props,
115
117
  PaperProps: {
118
+ ...callerPaper,
116
119
  component: StyledPaper,
117
120
  customVariant: variant,
118
121
  glow,
119
122
  pulse,
120
- sx: { maxWidth: popoverCap(maxWidth) },
121
- ...props.PaperProps
123
+ sx: [
124
+ { maxWidth: popoverCap(maxWidth) },
125
+ ...Array.isArray(callerPaper?.sx) ? callerPaper.sx : [callerPaper?.sx ?? {}]
126
+ ]
122
127
  },
123
- ...props,
124
128
  children
125
129
  }
126
130
  )
@@ -130,4 +134,4 @@ Popover.displayName = "Popover";
130
134
  export {
131
135
  Popover
132
136
  };
133
- //# sourceMappingURL=chunk-62E2X66R.js.map
137
+ //# sourceMappingURL=chunk-72BVL6VF.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/components/data-display/Popover/Popover.tsx"],"sourcesContent":["import type { PaperProps } from '@mui/material/Paper/index.js';\nimport Paper from '@mui/material/Paper/index.js';\nimport MuiPopover from '@mui/material/Popover/index.js';\nimport { alpha, keyframes, styled, type Theme } from '@mui/material/styles/index.js';\nimport React from 'react';\n\nimport type { PopoverProps } from './Popover.types';\nimport { shadowInk } from '../../../tokens/ink';\nimport { rem, rems } from '../../../tokens/relative';\n\n// Define pulse animation\nconst pulseAnimation = (theme: Theme) => keyframes`\n 0% {\n box-shadow: 0 0 0 0 currentColor;\n opacity: 1;\n }\n 70% {\n box-shadow: 0 0 0 ${rem(theme, 10)} currentColor;\n opacity: 0;\n }\n 100% {\n box-shadow: 0 0 0 0 currentColor;\n opacity: 0;\n }\n`;\n\nconst StyledPaper = styled(Paper, {\n shouldForwardProp: (prop) => \n !['customVariant', 'glow', 'pulse'].includes(prop as string),\n})<{ \n customVariant?: string; \n glow?: boolean; \n pulse?: boolean; \n}>(({ theme, customVariant, glow, pulse }) => ({\n borderRadius: theme.spacing(1.5),\n transition: 'all 0.3s ease',\n position: 'relative',\n overflow: 'hidden',\n\n // Variant styles\n ...(customVariant === 'default' && {\n backgroundColor: theme.palette.background.paper,\n border: `1px solid ${alpha(theme.palette.divider, 0.2)}`,\n boxShadow: theme.shadows[8],\n }),\n\n ...(customVariant === 'glass' && {\n backgroundColor: alpha(theme.palette.background.paper, 0.1),\n backdropFilter: `blur(${rem(theme, 20)})`,\n border: `1px solid ${alpha(theme.palette.divider, 0.2)}`,\n boxShadow: `${rems(theme, 0, 8, 32)} ${shadowInk(theme, 0.1)}`,\n }),\n\n ...(customVariant === 'arrow' && {\n backgroundColor: theme.palette.background.paper,\n border: `1px solid ${alpha(theme.palette.divider, 0.2)}`,\n boxShadow: theme.shadows[12],\n }),\n\n // Glow effect\n ...(glow && !pulse && {\n boxShadow: `${rems(theme, 0, 0, 20, 5)} ${alpha(theme.palette.primary.main, 0.3)} !important`,\n filter: 'brightness(1.05)',\n }),\n\n // Pulse animation\n ...(pulse && !glow && {\n position: 'relative',\n '&::after': {\n content: '\"\"',\n position: 'absolute',\n top: 0,\n left: 0,\n right: 0,\n bottom: 0,\n borderRadius: 'inherit',\n backgroundColor: theme.palette.primary.main,\n opacity: 0.1,\n animation: `${pulseAnimation(theme)} 2s infinite`,\n pointerEvents: 'none',\n zIndex: -1,\n },\n }),\n\n // Both glow and pulse\n ...(glow && pulse && {\n position: 'relative',\n boxShadow: `${rems(theme, 0, 0, 20, 5)} ${alpha(theme.palette.primary.main, 0.3)} !important`,\n filter: 'brightness(1.05)',\n '&::after': {\n content: '\"\"',\n position: 'absolute',\n top: 0,\n left: 0,\n right: 0,\n bottom: 0,\n borderRadius: 'inherit',\n backgroundColor: theme.palette.primary.main,\n opacity: 0.1,\n animation: `${pulseAnimation(theme)} 2s infinite`,\n pointerEvents: 'none',\n zIndex: -1,\n },\n }),\n}));\n\n/**\n * The paper's cap: 400 design px unless the caller says otherwise. `sx` has\n * always read a number of 1 or less as a fraction of the parent, and that stays so.\n */\nconst popoverCap =\n (maxWidth: number | undefined) =>\n (theme: Theme): string => {\n const cap = maxWidth ?? 400;\n return cap <= 1 && cap !== 0 ? `${cap * 100}%` : rem(theme, cap);\n };\n\nexport const Popover = React.forwardRef<HTMLDivElement, PopoverProps>(\n ({\n variant = 'default',\n glow = false,\n pulse = false,\n maxWidth,\n dataTestId,\n children,\n ...props\n }, ref) => (\n <MuiPopover\n ref={ref}\n data-testid={dataTestId || 'popover-content'}\n PaperProps={{\n component: StyledPaper as React.ComponentType<PaperProps>,\n customVariant: variant,\n glow,\n pulse,\n sx: { maxWidth: popoverCap(maxWidth) },\n ...props.PaperProps,\n } as PaperProps & { customVariant?: string; glow?: boolean; pulse?: bo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ACjE;AAEK,IAAM,UAAU,MAAM;AAAA,EAC3B,CAAC;AAAA,IACC,UAAU;AAAA,IACV,OAAO;AAAA,IACP,QAAQ;AAAA,IACR;AAAA,IACA;AAAA,IACA;AAAA,IACA,GAAG;AAAA,EACL,GAAG,QACC;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA,eAAa,cAAc;AAAA,MAC3B,YAAY;AAAA,QACV,WAAW;AAAA,QACX,eAAe;AAAA,QACf;AAAA,QACA;AAAA,QACA,IAAI,EAAE,UAAU,WAAW,QAAQ,EAAE;AAAA,QACrC,GAAG,MAAM;AAAA,MACX;AAAA,MACC,GAAG;AAAA,MAEH;AAAA;AAAA,EACH;AAEN;AAEA,QAAQ,cAAc;","names":[]}
1
+ {"version":3,"sources":["../src/components/data-display/Popover/Popover.tsx"],"sourcesContent":["import type { PaperProps } from '@mui/material/Paper/index.js';\nimport Paper from '@mui/material/Paper/index.js';\nimport MuiPopover from '@mui/material/Popover/index.js';\nimport { alpha, keyframes, styled, type Theme } from '@mui/material/styles/index.js';\nimport React from 'react';\n\nimport type { PopoverProps } from './Popover.types';\nimport { shadowInk } from '../../../tokens/ink';\nimport { rem, rems } from '../../../tokens/relative';\n\n// Define pulse animation\nconst pulseAnimation = (theme: Theme) => keyframes`\n 0% {\n box-shadow: 0 0 0 0 currentColor;\n opacity: 1;\n }\n 70% {\n box-shadow: 0 0 0 ${rem(theme, 10)} currentColor;\n opacity: 0;\n }\n 100% {\n box-shadow: 0 0 0 0 currentColor;\n opacity: 0;\n }\n`;\n\nconst StyledPaper = styled(Paper, {\n shouldForwardProp: (prop) => \n !['customVariant', 'glow', 'pulse'].includes(prop as string),\n})<{ \n customVariant?: string; \n glow?: boolean; \n pulse?: boolean; \n}>(({ theme, customVariant, glow, pulse }) => ({\n borderRadius: theme.spacing(1.5),\n transition: 'all 0.3s ease',\n position: 'relative',\n overflow: 'hidden',\n\n // Variant styles\n ...(customVariant === 'default' && {\n backgroundColor: theme.palette.background.paper,\n border: `1px solid ${alpha(theme.palette.divider, 0.2)}`,\n boxShadow: theme.shadows[8],\n }),\n\n ...(customVariant === 'glass' && {\n backgroundColor: alpha(theme.palette.background.paper, 0.1),\n backdropFilter: `blur(${rem(theme, 20)})`,\n border: `1px solid ${alpha(theme.palette.divider, 0.2)}`,\n boxShadow: `${rems(theme, 0, 8, 32)} ${shadowInk(theme, 0.1)}`,\n }),\n\n ...(customVariant === 'arrow' && {\n backgroundColor: theme.palette.background.paper,\n border: `1px solid ${alpha(theme.palette.divider, 0.2)}`,\n boxShadow: theme.shadows[12],\n }),\n\n // Glow effect\n ...(glow && !pulse && {\n boxShadow: `${rems(theme, 0, 0, 20, 5)} ${alpha(theme.palette.primary.main, 0.3)} !important`,\n filter: 'brightness(1.05)',\n }),\n\n // Pulse animation\n ...(pulse && !glow && {\n position: 'relative',\n '&::after': {\n content: '\"\"',\n position: 'absolute',\n top: 0,\n left: 0,\n right: 0,\n bottom: 0,\n borderRadius: 'inherit',\n backgroundColor: theme.palette.primary.main,\n opacity: 0.1,\n animation: `${pulseAnimation(theme)} 2s infinite`,\n pointerEvents: 'none',\n zIndex: -1,\n },\n }),\n\n // Both glow and pulse\n ...(glow && pulse && {\n position: 'relative',\n boxShadow: `${rems(theme, 0, 0, 20, 5)} ${alpha(theme.palette.primary.main, 0.3)} !important`,\n filter: 'brightness(1.05)',\n '&::after': {\n content: '\"\"',\n position: 'absolute',\n top: 0,\n left: 0,\n right: 0,\n bottom: 0,\n borderRadius: 'inherit',\n backgroundColor: theme.palette.primary.main,\n opacity: 0.1,\n animation: `${pulseAnimation(theme)} 2s infinite`,\n pointerEvents: 'none',\n zIndex: -1,\n },\n }),\n}));\n\n/**\n * The paper's cap: 400 design px unless the caller says otherwise. `sx` has\n * always read a number of 1 or less as a fraction of the parent, and that stays so.\n */\nconst popoverCap =\n (maxWidth: number | undefined) =>\n (theme: Theme): string => {\n const cap = maxWidth ?? 400;\n return cap <= 1 && cap !== 0 ? `${cap * 100}%` : rem(theme, cap);\n };\n\nexport const Popover = React.forwardRef<HTMLDivElement, PopoverProps>(\n ({\n variant = 'default',\n glow = false,\n pulse = false,\n maxWidth,\n dataTestId,\n children,\n PaperProps: callerPaper,\n ...props\n }, ref) => (\n <MuiPopover\n ref={ref}\n data-testid={dataTestId || 'popover-content'}\n {...props}\n // After the spread, and merged rather than replaced: a caller's\n // `PaperProps` used to land last and drop the styled paper, its variant\n // and the width cap; and its `sx` now adds to the cap instead.\n PaperProps={{\n ...callerPaper,\n component: StyledPaper as React.ComponentType<PaperProps>,\n customVariant: variant,\n glow,\n pulse,\n sx: [\n { maxWidth: popoverCap(maxWidth) },\n ...(Array.isArray(callerPaper?.sx) ? callerPaper.sx : [callerPaper?.sx ?? {}]),\n ],\n } as PaperProps & { customVariant?: string; glow?: boolean; pulse?: boolean }}\n >\n {children}\n </MuiPopover>\n )\n);\n\nPopover.displayName = 'Popover';"],"mappings":";;;;;;;;;AACA,OAAO,WAAW;AAClB,OAAO,gBAAgB;AACvB,SAAS,OAAO,WAAW,cAA0B;AACrD,OAAO,WAAW;AA4HZ;AArHN,IAAM,iBAAiB,CAAC,UAAiB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,wBAMjB,IAAI,OAAO,EAAE,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAStC,IAAM,cAAc,OAAO,OAAO;AAAA,EAChC,mBAAmB,CAAC,SAClB,CAAC,CAAC,iBAAiB,QAAQ,OAAO,EAAE,SAAS,IAAc;AAC/D,CAAC,EAIE,CAAC,EAAE,OAAO,eAAe,MAAM,MAAM,OAAO;AAAA,EAC7C,cAAc,MAAM,QAAQ,GAAG;AAAA,EAC/B,YAAY;AAAA,EACZ,UAAU;AAAA,EACV,UAAU;AAAA;AAAA,EAGV,GAAI,kBAAkB,aAAa;AAAA,IACjC,iBAAiB,MAAM,QAAQ,WAAW;AAAA,IAC1C,QAAQ,aAAa,MAAM,MAAM,QAAQ,SAAS,GAAG,CAAC;AAAA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,QAAQ,MAAM,GAAG,CAAC;AAAA,IAChF,QAAQ;AAAA,IACR,YAAY;AAAA,MACV,SAAS;AAAA,MACT,UAAU;AAAA,MACV,KAAK;AAAA,MACL,MAAM;AAAA,MACN,OAAO;AAAA,MACP,QAAQ;AAAA,MACR,cAAc;AAAA,MACd,iBAAiB,MAAM,QAAQ,QAAQ;AAAA,MACvC,SAAS;AAAA,MACT,WAAW,GAAG,eAAe,KAAK,CAAC;AAAA,MACnC,eAAe;AAAA,MACf,QAAQ;AAAA,IACV;AAAA,EACF;AACF,EAAE;AAMF,IAAM,aACJ,CAAC,aACD,CAAC,UAAyB;AACxB,QAAM,MAAM,YAAY;AACxB,SAAO,OAAO,KAAK,QAAQ,IAAI,GAAG,MAAM,GAAG,MAAM,IAAI,OAAO,GAAG;AACjE;AAEK,IAAM,UAAU,MAAM;AAAA,EAC3B,CAAC;AAAA,IACC,UAAU;AAAA,IACV,OAAO;AAAA,IACP,QAAQ;AAAA,IACR;AAAA,IACA;AAAA,IACA;AAAA,IACA,YAAY;AAAA,IACZ,GAAG;AAAA,EACL,GAAG,QACC;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA,eAAa,cAAc;AAAA,MAC1B,GAAG;AAAA,MAIJ,YAAY;AAAA,QACV,GAAG;AAAA,QACH,WAAW;AAAA,QACX,eAAe;AAAA,QACf;AAAA,QACA;AAAA,QACA,IAAI;AAAA,UACF,EAAE,UAAU,WAAW,QAAQ,EAAE;AAAA,UACjC,GAAI,MAAM,QAAQ,aAAa,EAAE,IAAI,YAAY,KAAK,CAAC,aAAa,MAAM,CAAC,CAAC;AAAA,QAC9E;AAAA,MACF;AAAA,MAEC;AAAA;AAAA,EACH;AAEN;AAEA,QAAQ,cAAc;","names":[]}
@@ -3,8 +3,9 @@ import {
3
3
  getRegisteredChartSpecTypes
4
4
  } from "./chunk-WKUA6P3W.js";
5
5
  import {
6
+ chartAxisValueFormatter,
6
7
  chartValueFormatter
7
- } from "./chunk-QVWNK4JO.js";
8
+ } from "./chunk-6GPNZSAE.js";
8
9
 
9
10
  // src/components/data-display/Chart/chart-spec.ts
10
11
  var CHART_SEMANTIC_COLORS = [
@@ -136,6 +137,7 @@ function specToChartProps(spec, data, ctx) {
136
137
  showTooltip: spec.tooltip ?? true,
137
138
  height: spec.height,
138
139
  valueFormatter: chartValueFormatter(spec.numberFormat),
140
+ axisValueFormatter: chartAxisValueFormatter(spec.numberFormat),
139
141
  // An integer metric is a COUNT: half a row does not exist, so the axis must
140
142
  // not offer half-steps it would then round into duplicates (FUT-755).
141
143
  allowDecimalTicks: spec.numberFormat !== "integer",
@@ -149,4 +151,4 @@ export {
149
151
  parseChartSpec,
150
152
  specToChartProps
151
153
  };
152
- //# sourceMappingURL=chunk-R6SBP5M5.js.map
154
+ //# sourceMappingURL=chunk-JVOEVTCZ.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/components/data-display/Chart/chart-spec.ts"],"sourcesContent":["import type { ChartDataPoint, ChartProps } from './Chart.types';\nimport type { ChartSemanticColor, ChartSpec, ChartSpecSeries } from './ChartSpec.types';\nimport { chartAxisValueFormatter, chartValueFormatter } from './chart-format';\nimport {\n getChartSpecRenderer,\n getRegisteredChartSpecTypes,\n type ChartSpecRenderContext,\n} from './chart-spec-registry';\n\n/**\n * BREAKING FOR STORED SPECS, not just for types.\n *\n * A chart spec is DATA — it is authored as JSON and can be persisted — and this\n * list is validated at runtime, so a saved spec carrying `\"error\"` now throws\n * `ChartSpecError` instead of silently drawing. That is the right failure (the\n * alternative is a series quietly losing its colour), but unlike the rest of\n * this migration a type-check will not find the affected specs: anything stored\n * outside the repo has to be rewritten `error` → `danger`.\n */\nexport const CHART_SEMANTIC_COLORS: readonly ChartSemanticColor[] = [\n 'primary',\n 'secondary',\n 'success',\n 'warning',\n 'danger',\n 'info',\n];\n\nconst NUMBER_FORMATS = ['brl', 'percent', 'compact', 'integer', 'decimal'];\n\n/** Error thrown when an unknown/invalid spec is parsed. Message is written to\n * be actionable for programmatic authors (builders, LLMs). */\nexport class ChartSpecError extends Error {\n constructor(message: string) {\n super(message);\n this.name = 'ChartSpecError';\n }\n}\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' && value !== null && !Array.isArray(value);\n}\n\nfunction assertColor(value: unknown, where: string): void {\n if (value === undefined) return;\n if (!CHART_SEMANTIC_COLORS.includes(value as ChartSemanticColor)) {\n throw new ChartSpecError(\n `${where} must be a semantic color token (${CHART_SEMANTIC_COLORS.join(', ')}), got ${JSON.stringify(value)}. Raw color values are not allowed.`,\n );\n }\n}\n\nfunction parseAxis(value: unknown): { key: string; label?: string } {\n if (!isRecord(value) || typeof value.key !== 'string' || value.key.length === 0) {\n throw new ChartSpecError('\"xAxis\" must be an object with a non-empty string \"key\" naming the row property for the category axis.');\n }\n if (value.label !== undefined && typeof value.label !== 'string') {\n throw new ChartSpecError('\"xAxis.label\" must be a string when provided.');\n }\n return { key: value.key, label: value.label };\n}\n\nfunction parseSeries(value: unknown): ChartSpecSeries[] {\n if (!Array.isArray(value) || value.length === 0) {\n throw new ChartSpecError('\"series\" must be a non-empty array of { key, label?, color? } objects.');\n }\n return value.map((entry, index) => {\n if (!isRecord(entry) || typeof entry.key !== 'string' || entry.key.length === 0) {\n throw new ChartSpecError(`\"series[${index}]\" must be an object with a non-empty string \"key\" naming the row property holding its values.`);\n }\n assertColor(entry.color, `\"series[${index}].color\"`);\n if (entry.label !== undefined && typeof entry.label !== 'string') {\n throw new ChartSpecError(`\"series[${index}].label\" must be a string when provided.`);\n }\n return { key: entry.key, label: entry.label, color: entry.color as ChartSemanticColor | undefined };\n });\n}\n\nfunction assertFieldType(\n spec: Record<string, unknown>,\n field: string,\n expected: 'string' | 'boolean' | 'number',\n): void {\n const value = spec[field];\n if (value !== undefined && typeof value !== expected) {\n throw new ChartSpecError(`\"${field}\" must be a ${expected} when provided.`);\n }\n}\n\nfunction parseColorScheme(value: unknown): ChartSemanticColor[] | undefined {\n if (value === undefined) return undefined;\n if (!Array.isArray(value) || value.length === 0) {\n throw new ChartSpecError('\"colorScheme\" must be a non-empty array of semantic color tokens when provided.');\n }\n value.forEach((token, index) => assertColor(token, `\"colorScheme[${index}]\"`));\n return value as ChartSemanticColor[];\n}\n\nfunction parseOptionalFields(spec: Record<string, unknown>): Partial<ChartSpec> {\n for (const field of ['title', 'subtitle'] as const) assertFieldType(spec, field, 'string');\n for (const field of ['stacked', 'legend', 'tooltip', 'curved'] as const) {\n assertFieldType(spec, field, 'boolean');\n }\n assertFieldType(spec, 'height', 'number');\n if (spec.numberFormat !== undefined && !NUMBER_FORMATS.includes(spec.numberFormat as string)) {\n throw new ChartSpecError(\n `\"numberFormat\" must be one of ${NUMBER_FORMATS.join(', ')}, got ${JSON.stringify(spec.numberFormat)}.`,\n );\n }\n return {\n title: spec.title as string | undefined,\n subtitle: spec.subtitle as string | undefined,\n stacked: spec.stacked as boolean | undefined,\n legend: spec.legend as boolean | undefined,\n tooltip: spec.tooltip as boolean | undefined,\n curved: spec.curved as boolean | undefined,\n height: spec.height as number | undefined,\n numberFormat: spec.numberFormat as ChartSpec['numberFormat'],\n colorScheme: parseColorScheme(spec.colorScheme),\n };\n}\n\n/**\n * Validate an untrusted value (e.g. JSON from storage or an LLM) into a\n * `ChartSpec`. Throws {@link ChartSpecError} with an actionable message on\n * the first problem found.\n */\nexport function parseChartSpec(input: unknown): ChartSpec {\n if (!isRecord(input)) {\n throw new ChartSpecError('A chart spec must be a JSON object.');\n }\n const type = input.type;\n if (typeof type !== 'string' || !getChartSpecRenderer(type)) {\n throw new ChartSpecError(\n `\"type\" must be one of the registered chart types (${getRegisteredChartSpecTypes().join(', ')}), got ${JSON.stringify(type)}.`,\n );\n }\n const yAxis = input.yAxis;\n if (yAxis !== undefined && (!isRecord(yAxis) || (yAxis.label !== undefined && typeof yAxis.label !== 'string'))) {\n throw new ChartSpecError('\"yAxis\" must be an object with an optional string \"label\" when provided.');\n }\n const centerLabel = input.centerLabel;\n return {\n ...parseOptionalFields(input),\n type: type as ChartSpec['type'],\n xAxis: parseAxis(input.xAxis),\n yAxis: yAxis as ChartSpec['yAxis'],\n series: parseSeries(input.series),\n centerLabel: centerLabel as ChartSpec['centerLabel'],\n };\n}\n\n/**\n * Derive the prop-driven `Chart` props for a validated spec. The spec API is\n * layered on top of the existing component — one rendering implementation.\n */\nexport function specToChartProps(\n spec: ChartSpec,\n data: ChartDataPoint[],\n ctx: ChartSpecRenderContext,\n): ChartProps {\n const renderer = getChartSpecRenderer(spec.type);\n if (!renderer) {\n throw new ChartSpecError(\n `Unknown chart type \"${spec.type}\". Registered types: ${getRegisteredChartSpecTypes().join(', ')}.`,\n );\n }\n return {\n data,\n title: spec.title,\n subtitle: spec.subtitle,\n xAxisKey: spec.xAxis.key,\n xAxisLabel: spec.xAxis.label,\n yAxisLabel: spec.yAxis?.label,\n showLegend: spec.legend ?? true,\n showTooltip: spec.tooltip ?? true,\n height: spec.height,\n valueFormatter: chartValueFormatter(spec.numberFormat),\n axisValueFormatter: chartAxisValueFormatter(spec.numberFormat),\n // An integer metric is a COUNT: half a row does not exist, so the axis must\n // not offer half-steps it would then round into duplicates (FUT-755).\n allowDecimalTicks: spec.numberFormat !== 'integer',\n ...renderer(spec, ctx),\n };\n}\n"],"mappings":";;;;;;;;;;AAmBO,IAAM,wBAAuD;AAAA,EAClE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAEA,IAAM,iBAAiB,CAAC,OAAO,WAAW,WAAW,WAAW,SAAS;AAIlE,IAAM,iBAAN,cAA6B,MAAM;AAAA,EACxC,YAAY,SAAiB;AAC3B,UAAM,OAAO;AACb,SAAK,OAAO;AAAA,EACd;AACF;AAEA,SAAS,SAAS,OAAkD;AAClE,SAAO,OAAO,UAAU,YAAY,UAAU,QAAQ,CAAC,MAAM,QAAQ,KAAK;AAC5E;AAEA,SAAS,YAAY,OAAgB,OAAqB;AACxD,MAAI,UAAU,OAAW;AACzB,MAAI,CAAC,s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EACF;AACA,QAAM,QAAQ,MAAM;AACpB,MAAI,UAAU,WAAc,CAAC,SAAS,KAAK,KAAM,MAAM,UAAU,UAAa,OAAO,MAAM,UAAU,WAAY;AAC/G,UAAM,IAAI,eAAe,0EAA0E;AAAA,EACrG;AACA,QAAM,cAAc,MAAM;AAC1B,SAAO;AAAA,IACL,GAAG,oBAAoB,KAAK;AAAA,IAC5B;AAAA,IACA,OAAO,UAAU,MAAM,KAAK;AAAA,IAC5B;AAAA,IACA,QAAQ,YAAY,MAAM,MAAM;AAAA,IAChC;AAAA,EACF;AACF;AAMO,SAAS,iBACd,MACA,MACA,KACY;AACZ,QAAM,WAAW,qBAAqB,KAAK,IAAI;AAC/C,MAAI,CAAC,UAAU;AACb,UAAM,IAAI;AAAA,MACR,uBAAuB,KAAK,IAAI,wBAAwB,4BAA4B,EAAE,KAAK,IAAI,CAAC;AAAA,IAClG;AAAA,EACF;AACA,SAAO;AAAA,IACL;AAAA,IACA,OAAO,KAAK;AAAA,IACZ,UAAU,KAAK;AAAA,IACf,UAAU,KAAK,MAAM;AAAA,IACrB,YAAY,KAAK,MAAM;AAAA,IACvB,YAAY,KAAK,OAAO;AAAA,IACxB,YAAY,KAAK,UAAU;AAAA,IAC3B,aAAa,KAAK,WAAW;AAAA,IAC7B,QAAQ,KAAK;AAAA,IACb,gBAAgB,oBAAoB,KAAK,YAAY;AAAA,IACrD,oBAAoB,wBAAwB,KAAK,YAAY;AAAA;AAAA;AAAA,IAG7D,mBAAmB,KAAK,iBAAiB;AAAA,IACzC,GAAG,SAAS,MAAM,GAAG;AAAA,EACvB;AACF;","names":[]}
@@ -13,6 +13,16 @@ import {
13
13
  } from "./chunk-YKCAJ2TN.js";
14
14
 
15
15
  // src/components/data-display/Chart/chart-context.ts
16
+ var AUTO_WIDTH_VALUE_AXIS = /* @__PURE__ */ new Set([
17
+ "line",
18
+ "bar",
19
+ "area",
20
+ "composed"
21
+ ]);
22
+ function leftMarginDesignPx(props) {
23
+ const autoWidthAxis = AUTO_WIDTH_VALUE_AXIS.has(props.type ?? "line");
24
+ return autoWidthAxis && !props.yAxisLabel ? 0 : 20;
25
+ }
16
26
  function buildChartContext(props, theme) {
17
27
  const sizeStyles = getSizeStyles(theme, props.size, props.height);
18
28
  const chartColors = getDefaultColors(theme, props.variant ?? "default", props.colors);
@@ -45,7 +55,7 @@ function buildChartContext(props, theme) {
45
55
  margin: {
46
56
  top: remPx(theme, 20),
47
57
  right: remPx(theme, 30),
48
- left: remPx(theme, 20),
58
+ left: remPx(theme, leftMarginDesignPx(props)),
49
59
  bottom: remPx(theme, 20),
50
60
  ...marginPx(theme, props.margin)
51
61
  },
@@ -63,4 +73,4 @@ function marginPx(theme, margin) {
63
73
  export {
64
74
  buildChartContext
65
75
  };
66
- //# sourceMappingURL=chunk-7CWZI6MQ.js.map
76
+ //# sourceMappingURL=chunk-W7N4ORCV.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/components/data-display/Chart/chart-context.ts"],"sourcesContent":["import type { Theme } from '@mui/material/styles/index.js';\nimport type { CSSProperties } from 'react';\n\nimport type { ChartDataPoint, ChartProps, ChartSeries } from './Chart.types';\nimport { resolveAxisConfig, resolveBarGeometry, type BarGeometry, type CartesianAxisConfig } from './chart-axis';\nimport {\n getAxisStyles,\n getDefaultColors,\n getSizeStyles,\n resolveSeries,\n type SizeStyles,\n} from './chart-internals';\nimport { remPx } from '../../../tokens/relative';\n\n/**\n * Everything the per-type renderers in `chart-renderers.tsx` read, resolved\n * once from props + theme. Kept out of that file so each renderer is a small\n * JSX function over already-decided values — palette, series, axis geometry,\n * bar geometry — rather than a place where those decisions get made again\n * slightly differently.\n */\nexport interface ChartRenderContext {\n props: ChartProps;\n theme: Theme;\n sizeStyles: SizeStyles;\n chartColors: string[];\n chartSeries: ChartSeries[];\n strokeType: 'monotone' | 'linear';\n axisStyle: CSSProperties;\n gridStroke: string;\n /** Multiplier on `gridStroke`'s alpha — see `getAxisStyles`. */\n gridOpacity: number;\n axisConfig: CartesianAxisConfig;\n barGeometry: BarGeometry;\n animationDuration: number;\n commonProps: {\n data: ChartDataPoint[];\n margin: { top?: number; right?: number; bottom?: number; left?: number };\n onClick: (payload: unknown) => void;\n };\n}\n\n/**\n * The chart types whose value axis sizes itself to its widest tick\n * (`width=\"auto\"`, `cartesianAxes`). Their left margin is only room for a\n * rotated axis TITLE; without one it was 20px of nothing beside the ticks,\n * taken out of the plot on a phone. Pie, radar and scatter keep it: a pie is\n * centred between both margins, and scatter's axis is still fixed-width.\n */\nconst AUTO_WIDTH_VALUE_AXIS: ReadonlySet<NonNullable<ChartProps['type']>> = new Set([\n 'line',\n 'bar',\n 'area',\n 'composed',\n]);\n\n/** The default left margin in design px — see {@link AUTO_WIDTH_VALUE_AXIS}. */\nfunction leftMarginDesignPx(props: ChartProps): number {\n const autoWidthAxis = AUTO_WIDTH_VALUE_AXIS.has(props.type ?? 'line');\n return autoWidthAxis && !props.yAxisLabel ? 0 : 20;\n}\n\nexport function buildChartContext(props: ChartProps, theme: Theme): ChartRenderContext {\n const sizeStyles = getSizeStyles(theme, props.size, props.height);\n const chartColors = getDefaultColors(theme, props.variant ?? 'default', props.colors);\n const { axisStyle, gridStroke, gridOpacity } = getAxisStyles(\n theme,\n props.variant ?? 'default',\n sizeStyles.fontSize,\n );\n const handleChartClick = (payload: unknown): void => {\n const chartData = payload as { activePayload?: Array<{ payload: ChartDataPoint }> };\n if (props.onClick && chartData?.activePayload?.[0]) {\n props.onClick(chartData.activePayload[0].payload);\n }\n };\n return {\n props,\n theme,\n sizeStyles,\n chartColors,\n chartSeries: resolveSeries(props.data, props.series, props.xAxisKey ?? 'name', chartColors),\n strokeType: (props.curved ?? true) ? 'monotone' : 'linear',\n axisStyle: { ...axisStyle, fontSize: sizeStyles.fontSize },\n gridStroke,\n gridOpacity,\n axisConfig: resolveAxisConfig(props, sizeStyles.tickMargin),\n barGeometry: resolveBarGeometry(props, theme),\n animationDuration: (props.animate ?? true) ? (props.animationDuration ?? 1500) : 0,\n commonProps: {\n data: props.data,\n margin: {\n top: remPx(theme, 20),\n right: remPx(theme, 30),\n left: remPx(theme, leftMarginDesignPx(props)),\n bottom: remPx(theme, 20),\n ...marginPx(theme, props.margin),\n },\n onClick: handleChartClick,\n },\n };\n}\n\n/** A caller's margin is in design px (the prop's contract); Recharts takes px numbers. */\nfunction marginPx(theme: Theme, margin: ChartProps['margin']): ChartProps['margin'] {\n if (!margin) return undefined;\n return Object.fromEntries(\n Object.entries(margin).map(([side, px]) => [side, typeof px === 'number' ? remPx(theme, px) : px]),\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;AAiDA,IAAM,wBAAsE,oBAAI,IAAI;AAAA,EAClF;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAGD,SAAS,mBAAmB,OAA2B;AACrD,QAAM,gBAAgB,sBAAsB,IAAI,MAAM,QAAQ,MAAM;AACpE,SAAO,iBAAiB,CAAC,MAAM,aAAa,IAAI;AAClD;AAEO,SAAS,kBAAkB,OAAmB,OAAkC;AACrF,QAAM,aAAa,cAAc,OAAO,MAAM,MAAM,MAAM,MAAM;AAChE,QAAM,cAAc,iBAAiB,OAAO,MAAM,WAAW,WAAW,MAAM,MAAM;AACpF,QAAM,EAAE,WAAW,YAAY,YAAY,IAAI;AAAA,IAC7C;AAAA,IACA,MAAM,WAAW;AAAA,IACjB,WAAW;AAAA,EACb;AACA,QAAM,mBAAmB,CAAC,YAA2B;AACnD,UAAM,YAAY;AAClB,QAAI,MAAM,WAAW,WAAW,gBAAgB,CAAC,GAAG;AAClD,YAAM,QAAQ,UAAU,cAAc,CAAC,EAAE,OAAO;AAAA,IAClD;AAAA,EACF;AACA,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,aAAa,cAAc,MAAM,MAAM,MAAM,QAAQ,MAAM,YAAY,QAAQ,WAAW;AAAA,IAC1F,YAAa,MAAM,UAAU,OAAQ,aAAa;AAAA,IAClD,WAAW,EAAE,GAAG,WAAW,UAAU,WAAW,SAAS;AAAA,IACzD;AAAA,IACA;AAAA,IACA,YAAY,kBAAkB,OAAO,WAAW,UAAU;AAAA,IAC1D,aAAa,mBAAmB,OAAO,KAAK;AAAA,IAC5C,mBAAoB,MAAM,WAAW,OAAS,MAAM,qBAAqB,OAAQ;AAAA,IACjF,aAAa;AAAA,MACX,MAAM,MAAM;AAAA,MACZ,QAAQ;AAAA,QACN,KAAK,MAAM,OAAO,EAAE;AAAA,QACpB,OAAO,MAAM,OAAO,EAAE;AAAA,QACtB,MAAM,MAAM,OAAO,mBAAmB,KAAK,CAAC;AAAA,QAC5C,QAAQ,MAAM,OAAO,EAAE;AAAA,QACvB,GAAG,SAAS,OAAO,MAAM,MAAM;AAAA,MACjC;AAAA,MACA,SAAS;AAAA,IACX;AAAA,EACF;AACF;AAGA,SAAS,SAAS,OAAc,QAAoD;AAClF,MAAI,CAAC,OAAQ,QAAO;AACpB,SAAO,OAAO;AAAA,IACZ,OAAO,QAAQ,MAAM,EAAE,IAAI,CAAC,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,OAAO,OAAO,WAAW,MAAM,OAAO,EAAE,IAAI,EAAE,CAAC;AAAA,EACnG;AACF;","names":[]}
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  renderChartByType
3
- } from "./chunk-UEU5NSIG.js";
3
+ } from "./chunk-3FMWQQW6.js";
4
4
  import {
5
5
  ChartContainer
6
6
  } from "./chunk-RIRTW5EU.js";
@@ -111,4 +111,4 @@ var Chart = (props) => {
111
111
  export {
112
112
  Chart
113
113
  };
114
- //# sourceMappingURL=chunk-AQI3UK6P.js.map
114
+ //# sourceMappingURL=chunk-WBDQSBLV.js.map
@@ -1,23 +1,23 @@
1
1
  import "../chunk-5KLSLD72.js";
2
2
  import {
3
3
  SpecChart
4
- } from "../chunk-DZIRCD2W.js";
4
+ } from "../chunk-4PPNCZWY.js";
5
5
  import {
6
6
  Chart
7
- } from "../chunk-AQI3UK6P.js";
7
+ } from "../chunk-WBDQSBLV.js";
8
8
  import {
9
9
  CHART_SEMANTIC_COLORS,
10
10
  ChartSpecError,
11
11
  parseChartSpec,
12
12
  specToChartProps
13
- } from "../chunk-R6SBP5M5.js";
13
+ } from "../chunk-JVOEVTCZ.js";
14
14
  import {
15
15
  getChartSpecRenderer,
16
16
  getRegisteredChartSpecTypes,
17
17
  registerChartSpecRenderer
18
18
  } from "../chunk-WKUA6P3W.js";
19
- import "../chunk-UEU5NSIG.js";
20
- import "../chunk-7CWZI6MQ.js";
19
+ import "../chunk-3FMWQQW6.js";
20
+ import "../chunk-W7N4ORCV.js";
21
21
  import "../chunk-SOHQPPYJ.js";
22
22
  import {
23
23
  ChartContainer,
@@ -30,7 +30,7 @@ import "../chunk-FIMSPRKX.js";
30
30
  import {
31
31
  chartValueFormatter,
32
32
  formatChartValue
33
- } from "../chunk-QVWNK4JO.js";
33
+ } from "../chunk-6GPNZSAE.js";
34
34
  import "../chunk-B7ZHEOQQ.js";
35
35
  import "../chunk-BRHRK7BK.js";
36
36
  import "../chunk-25MSGLNU.js";
@@ -1,7 +1,7 @@
1
1
  import "../chunk-6CUNJ4JF.js";
2
2
  import {
3
3
  Popover
4
- } from "../chunk-62E2X66R.js";
4
+ } from "../chunk-72BVL6VF.js";
5
5
  import "../chunk-SSX5ITPM.js";
6
6
  import "../chunk-F5H2ZXST.js";
7
7
  import "../chunk-N3GAFIXG.js";
@@ -1,11 +1,12 @@
1
1
  import "../chunk-PZ5AY32C.js";
2
2
 
3
3
  // src/mui/styles.ts
4
- import { alpha, styled, useTheme, createTheme, ThemeProvider } from "@mui/material/styles/index.js";
4
+ import { alpha, keyframes, styled, useTheme, createTheme, ThemeProvider } from "@mui/material/styles/index.js";
5
5
  export {
6
6
  ThemeProvider,
7
7
  alpha,
8
8
  createTheme,
9
+ keyframes,
9
10
  styled,
10
11
  useTheme
11
12
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/mui/styles.ts"],"sourcesContent":["export type { SxProps, Theme } from '@mui/material/styles/index.js';\nexport { alpha, styled, useTheme, createTheme, ThemeProvider } from '@mui/material/styles/index.js';\n"],"mappings":";;;AACA,SAAS,OAAO,QAAQ,UAAU,aAAa,qBAAqB;","names":[]}
1
+ {"version":3,"sources":["../../src/mui/styles.ts"],"sourcesContent":["export type { SxProps, Theme } from '@mui/material/styles/index.js';\nexport { alpha, keyframes, styled, useTheme, createTheme, ThemeProvider } from '@mui/material/styles/index.js';\n"],"mappings":";;;AACA,SAAS,OAAO,WAAW,QAAQ,UAAU,aAAa,qBAAqB;","names":[]}
@@ -68,6 +68,11 @@ export interface ChartProps {
68
68
  };
69
69
  /** Formats numeric tooltip values and y-axis ticks (e.g. centavos → BRL). */
70
70
  valueFormatter?: (value: number) => string;
71
+ /**
72
+ * Formats the value-axis ticks only, when they should read shorter than a
73
+ * tooltip (whole reais without ",00"). Falls back to `valueFormatter`.
74
+ */
75
+ axisValueFormatter?: (value: number) => string;
71
76
  /**
72
77
  * Whether the value axis may place ticks between whole numbers. Default true.
73
78
  *
@@ -1 +1 @@
1
- {"version":3,"file":"Chart.types.d.ts","sourceRoot":"","sources":["../../../../../src/components/data-display/Chart/Chart.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACpE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAE3C,MAAM,MAAM,SAAS,GAAG,MAAM,GAAG,KAAK,GAAG,MAAM,GAAG,KAAK,GAAG,OAAO,GAAG,SAAS,GAAG,UAAU,CAAC;AAE3F,MAAM,WAAW,cAAc;IAC7B,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC;CACvC;AAED,MAAM,WAAW,WAAW;IAC1B,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CA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,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB"}
1
+ {"version":3,"file":"Chart.types.d.ts","sourceRoot":"","sources":["../../../../../src/components/data-display/Chart/Chart.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACpE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAE3C,MAAM,MAAM,SAAS,GAAG,MAAM,GAAG,KAAK,GAAG,MAAM,GAAG,KAAK,GAAG,OAAO,GAAG,SAAS,GAAG,UAAU,CAAC;AAE3F,MAAM,WAAW,cAAc;IAC7B,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC;CACvC;AAED,MAAM,WAAW,WAAW;IAC1B,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,GAAG,KAAK,GAAG,MAAM,CAAC;IAC/B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,cAAc,EAAE,CAAC;IACvB,MAAM,CAAC,EAAE,WAAW,EAAE,CAAC;IACvB,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,OAAO,CAAC,EAAE,SAAS,GAAG,OAAO,GAAG,UAAU,GAA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AAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,GAAG;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAC;IACjE,6EAA6E;IAC7E,cAAc,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC;IAC3C;;;OAGG;IACH,kBAAkB,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC;IAC/C;;;;;;;;;OASG;IACH,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B;;;;OAIG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,wFAAwF;IACxF,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B;;;;;;;;OAQG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,2FAA2F;IAC3F,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB"}
@@ -1 +1 @@
1
- {"version":3,"file":"chart-context.d.ts","sourceRoot":"","sources":["../../../../../src/components/data-display/Chart/chart-context.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,+BAA+B,CAAC;AAC3D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAE3C,OAAO,KAAK,EAAE,cAAc,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC7E,OAAO,EAAyC,KAAK,WAAW,EAAE,KAAK,mBAAmB,EAAE,MAAM,cAAc,CAAC;AACjH,OAAO,EAKL,KAAK,UAAU,EAChB,MAAM,mBAAmB,CAAC;AAG3B;;;;;;GAMG;AACH,MAAM,WAAW,kBAAkB;IACjC,KAAK,EAAE,UAAU,CAAC;IAClB,KAAK,EAAE,KAAK,CAAC;IACb,UAAU,EAAE,UAAU,CAAC;IACvB,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,WAAW,EAAE,WAAW,EAAE,CAAC;IAC3B,UAAU,EAAE,UAAU,GAAG,QAAQ,CAAC;IAClC,SAAS,EAAE,aAAa,CAAC;IACzB,UAAU,EAAE,MAAM,CAAC;IACnB,gEAAgE;IAChE,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,mBAAmB,CAAC;IAChC,WAAW,EAAE,WAAW,CAAC;IACzB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,WAAW,EAAE;QACX,IAAI,EAAE,cAAc,EAAE,CAAC;QACvB,MAAM,EAAE;YAAE,GAAG,CAAC,EAAE,MAAM,CAAC;YAAC,KAAK,CAAC,EAAE,MAAM,CAAC;YAAC,MAAM,CAAC,EAAE,MAAM,CAAC;YAAC,IAAI,CAAC,EAAE,MAAM,CAAA;SAAE,CAAC;QACzE,OAAO,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;KACrC,CAAC;CACH;AAED,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,KAAK,GAAG,kBAAkB,CAuCrF"}
1
+ {"version":3,"file":"chart-context.d.ts","sourceRoot":"","sources":["../../../../../src/components/data-display/Chart/chart-context.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,+BAA+B,CAAC;AAC3D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAE3C,OAAO,KAAK,EAAE,cAAc,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC7E,OAAO,EAAyC,KAAK,WAAW,EAAE,KAAK,mBAAmB,EAAE,MAAM,cAAc,CAAC;AACjH,OAAO,EAKL,KAAK,UAAU,EAChB,MAAM,mBAAmB,CAAC;AAG3B;;;;;;GAMG;AACH,MAAM,WAAW,kBAAkB;IACjC,KAAK,EAAE,UAAU,CAAC;IAClB,KAAK,EAAE,KAAK,CAAC;IACb,UAAU,EAAE,UAAU,CAAC;IACvB,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,WAAW,EAAE,WAAW,EAAE,CAAC;IAC3B,UAAU,EAAE,UAAU,GAAG,QAAQ,CAAC;IAClC,SAAS,EAAE,aAAa,CAAC;IACzB,UAAU,EAAE,MAAM,CAAC;IACnB,gEAAgE;IAChE,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,mBAAmB,CAAC;IAChC,WAAW,EAAE,WAAW,CAAC;IACzB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,WAAW,EAAE;QACX,IAAI,EAAE,cAAc,EAAE,CAAC;QACvB,MAAM,EAAE;YAAE,GAAG,CAAC,EAAE,MAAM,CAAC;YAAC,KAAK,CAAC,EAAE,MAAM,CAAC;YAAC,MAAM,CAAC,EAAE,MAAM,CAAC;YAAC,IAAI,CAAC,EAAE,MAAM,CAAA;SAAE,CAAC;QACzE,OAAO,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;KACrC,CAAC;CACH;AAsBD,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,KAAK,GAAG,kBAAkB,CAuCrF"}
@@ -8,4 +8,18 @@ import type { ChartNumberFormat } from './ChartSpec.types';
8
8
  export declare function formatChartValue(value: number, format?: ChartNumberFormat): string;
9
9
  /** Curried {@link formatChartValue}, memo-friendly for tooltip/axis props. */
10
10
  export declare function chartValueFormatter(format?: ChartNumberFormat): (value: number) => string;
11
+ /**
12
+ * Format a value-AXIS tick: {@link formatChartValue}, except that a `brl` tick
13
+ * on a whole real drops its ",00".
14
+ *
15
+ * An axis tick is a gridline's name, not an amount anybody reads to the
16
+ * centavo. Recharts picks round ticks (R$ 45, R$ 90, R$ 135…), so on a phone
17
+ * "R$ 180,00" spent a fifth of the card on two zeros and squeezed the plot it
18
+ * labels to ~160px at 390. A tick that does fall between reais keeps its
19
+ * centavos, so no tick is ever rounded into a value it is not. Tooltips keep
20
+ * the full amount: they ARE read to the centavo.
21
+ */
22
+ export declare function formatChartAxisValue(value: number, format?: ChartNumberFormat): string;
23
+ /** Curried {@link formatChartAxisValue}, memo-friendly for the value axis. */
24
+ export declare function chartAxisValueFormatter(format?: ChartNumberFormat): (value: number) => string;
11
25
  //# sourceMappingURL=chart-format.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"chart-format.d.ts","sourceRoot":"","sources":["../../../../../src/components/data-display/Chart/chart-format.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAU3D;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,GAAE,iBAA6B,GAAG,MAAM,CAI7F;AAED,8EAA8E;AAC9E,wBAAgB,mBAAmB,CAAC,MAAM,CAAC,EAAE,iBAAiB,GAAG,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAEzF"}
1
+ {"version":3,"file":"chart-format.d.ts","sourceRoot":"","sources":["../../../../../src/components/data-display/Chart/chart-format.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAU3D;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,GAAE,iBAA6B,GAAG,MAAM,CAI7F;AAED,8EAA8E;AAC9E,wBAAgB,mBAAmB,CAAC,MAAM,CAAC,EAAE,iBAAiB,GAAG,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAEzF;AAUD;;;;;;;;;;GAUG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,GAAE,iBAA6B,GAAG,MAAM,CAKjG;AAED,8EAA8E;AAC9E,wBAAgB,uBAAuB,CAAC,MAAM,CAAC,EAAE,iBAAiB,GAAG,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAE7F"}
@@ -1 +1 @@
1
- {"version":3,"file":"chart-spec.d.ts","sourceRoot":"","sources":["../../../../../src/components/data-display/Chart/chart-spec.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAChE,OAAO,KAAK,EAAE,kBAAkB,EAAE,SAAS,EAAmB,MAAM,mBAAmB,CAAC;AAExF,OAAO,EAGL,KAAK,sBAAsB,EAC5B,MAAM,uBAAuB,CAAC;AAE/B;;;;;;;;;GASG;AACH,eAAO,MAAM,qBAAqB,EAAE,SAAS,kBAAkB,EAO9D,CAAC;AAIF;8DAC8D;AAC9D,qBAAa,cAAe,SAAQ,KAAK;gBAC3B,OAAO,EAAE,MAAM;CAI5B;AAqFD;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,OAAO,GAAG,SAAS,CAuBxD;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,SAAS,EACf,IAAI,EAAE,cAAc,EAAE,EACtB,GAAG,EAAE,sBAAsB,GAC1B,UAAU,CAuBZ"}
1
+ {"version":3,"file":"chart-spec.d.ts","sourceRoot":"","sources":["../../../../../src/components/data-display/Chart/chart-spec.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAChE,OAAO,KAAK,EAAE,kBAAkB,EAAE,SAAS,EAAmB,MAAM,mBAAmB,CAAC;AAExF,OAAO,EAGL,KAAK,sBAAsB,EAC5B,MAAM,uBAAuB,CAAC;AAE/B;;;;;;;;;GASG;AACH,eAAO,MAAM,qBAAqB,EAAE,SAAS,kBAAkB,EAO9D,CAAC;AAIF;8DAC8D;AAC9D,qBAAa,cAAe,SAAQ,KAAK;gBAC3B,OAAO,EAAE,MAAM;CAI5B;AAqFD;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,OAAO,GAAG,SAAS,CAuBxD;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,SAAS,EACf,IAAI,EAAE,cAAc,EAAE,EACtB,GAAG,EAAE,sBAAsB,GAC1B,UAAU,CAwBZ"}
@@ -1 +1 @@
1
- {"version":3,"file":"Popover.d.ts","sourceRoot":"","sources":["../../../../../src/components/data-display/Popover/Popover.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AA+GpD,eAAO,MAAM,OAAO,kGA0BnB,CAAC"}
1
+ {"version":3,"file":"Popover.d.ts","sourceRoot":"","sources":["../../../../../src/components/data-display/Popover/Popover.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AA+GpD,eAAO,MAAM,OAAO,kGAiCnB,CAAC"}
@@ -1,3 +1,3 @@
1
1
  export type { SxProps, Theme } from '@mui/material/styles/index.js';
2
- export { alpha, styled, useTheme, createTheme, ThemeProvider } from '@mui/material/styles/index.js';
2
+ export { alpha, keyframes, styled, useTheme, createTheme, ThemeProvider } from '@mui/material/styles/index.js';
3
3
  //# sourceMappingURL=styles.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../src/mui/styles.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,+BAA+B,CAAC;AACpE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC"}
1
+ {"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../src/mui/styles.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,+BAA+B,CAAC;AACpE,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@12-apps/ui",
3
- "version": "6.58.0",
3
+ "version": "6.60.0",
4
4
  "license": "MIT",
5
5
  "packageManager": "pnpm@10.34.5",
6
6
  "type": "module",
@@ -68,6 +68,9 @@ import { Chart } from '@procurement/ui';
68
68
  - `stacked` (boolean): Stack data series for bar/area charts
69
69
  - `showValues` (boolean): Display data values on chart
70
70
  - `valueFormatter` (function): Formats tooltip values and value-axis ticks
71
+ - `axisValueFormatter` (function): Formats the value-axis ticks only, when they should read
72
+ shorter than the tooltip; falls back to `valueFormatter`. `SpecChart` sets it, so a `brl`
73
+ axis reads "R$ 180" while the tooltip keeps "R$ 180,00"
71
74
  - `allowDecimalTicks` (boolean): Allow half-steps on the value axis (default: true; set
72
75
  false for a COUNT metric, or the axis repeats itself — `0, 1, 1, 2, 2`)
73
76
 
@@ -97,7 +100,8 @@ axis corner, at every viewport.
97
100
  - `showLegend` (boolean): Show chart legend (default: true)
98
101
  - `showTooltip` (boolean): Show hover tooltips (default: true)
99
102
  - `showCartesianGrid` (boolean): Show grid lines (default: true)
100
- - `margin` (object): Chart margins configuration
103
+ - `margin` (object): Chart margins configuration. A line, bar, area or composed chart
104
+ defaults to no left margin (its value axis sizes itself) unless it has a `yAxisLabel`
101
105
  - `colors` (string[]): Custom color palette
102
106
  - `responsive` (boolean): Enable responsive behavior (default: true)
103
107
 
@@ -64,6 +64,11 @@ export interface ChartProps {
64
64
  centerLabel?: string | { label: string; value: string | number };
65
65
  /** Formats numeric tooltip values and y-axis ticks (e.g. centavos → BRL). */
66
66
  valueFormatter?: (value: number) => string;
67
+ /**
68
+ * Formats the value-axis ticks only, when they should read shorter than a
69
+ * tooltip (whole reais without ",00"). Falls back to `valueFormatter`.
70
+ */
71
+ axisValueFormatter?: (value: number) => string;
67
72
  /**
68
73
  * Whether the value axis may place ticks between whole numbers. Default true.
69
74
  *
@@ -40,6 +40,26 @@ export interface ChartRenderContext {
40
40
  };
41
41
  }
42
42
 
43
+ /**
44
+ * The chart types whose value axis sizes itself to its widest tick
45
+ * (`width="auto"`, `cartesianAxes`). Their left margin is only room for a
46
+ * rotated axis TITLE; without one it was 20px of nothing beside the ticks,
47
+ * taken out of the plot on a phone. Pie, radar and scatter keep it: a pie is
48
+ * centred between both margins, and scatter's axis is still fixed-width.
49
+ */
50
+ const AUTO_WIDTH_VALUE_AXIS: ReadonlySet<NonNullable<ChartProps['type']>> = new Set([
51
+ 'line',
52
+ 'bar',
53
+ 'area',
54
+ 'composed',
55
+ ]);
56
+
57
+ /** The default left margin in design px — see {@link AUTO_WIDTH_VALUE_AXIS}. */
58
+ function leftMarginDesignPx(props: ChartProps): number {
59
+ const autoWidthAxis = AUTO_WIDTH_VALUE_AXIS.has(props.type ?? 'line');
60
+ return autoWidthAxis && !props.yAxisLabel ? 0 : 20;
61
+ }
62
+
43
63
  export function buildChartContext(props: ChartProps, theme: Theme): ChartRenderContext {
44
64
  const sizeStyles = getSizeStyles(theme, props.size, props.height);
45
65
  const chartColors = getDefaultColors(theme, props.variant ?? 'default', props.colors);
@@ -72,7 +92,7 @@ export function buildChartContext(props: ChartProps, theme: Theme): ChartRenderC
72
92
  margin: {
73
93
  top: remPx(theme, 20),
74
94
  right: remPx(theme, 30),
75
- left: remPx(theme, 20),
95
+ left: remPx(theme, leftMarginDesignPx(props)),
76
96
  bottom: remPx(theme, 20),
77
97
  ...marginPx(theme, props.margin),
78
98
  },
@@ -24,3 +24,34 @@ export function formatChartValue(value: number, format: ChartNumberFormat = 'dec
24
24
  export function chartValueFormatter(format?: ChartNumberFormat): (value: number) => string {
25
25
  return (value: number) => formatChartValue(value, format);
26
26
  }
27
+
28
+ /** Whole reais, for an axis tick that has no centavos to show. */
29
+ const brlWhole = new Intl.NumberFormat('pt-BR', {
30
+ style: 'currency',
31
+ currency: 'BRL',
32
+ minimumFractionDigits: 0,
33
+ maximumFractionDigits: 0,
34
+ });
35
+
36
+ /**
37
+ * Format a value-AXIS tick: {@link formatChartValue}, except that a `brl` tick
38
+ * on a whole real drops its ",00".
39
+ *
40
+ * An axis tick is a gridline's name, not an amount anybody reads to the
41
+ * centavo. Recharts picks round ticks (R$ 45, R$ 90, R$ 135…), so on a phone
42
+ * "R$ 180,00" spent a fifth of the card on two zeros and squeezed the plot it
43
+ * labels to ~160px at 390. A tick that does fall between reais keeps its
44
+ * centavos, so no tick is ever rounded into a value it is not. Tooltips keep
45
+ * the full amount: they ARE read to the centavo.
46
+ */
47
+ export function formatChartAxisValue(value: number, format: ChartNumberFormat = 'decimal'): string {
48
+ if (format === 'brl' && Number.isFinite(value) && value % 100 === 0) {
49
+ return brlWhole.format(value / 100);
50
+ }
51
+ return formatChartValue(value, format);
52
+ }
53
+
54
+ /** Curried {@link formatChartAxisValue}, memo-friendly for the value axis. */
55
+ export function chartAxisValueFormatter(format?: ChartNumberFormat): (value: number) => string {
56
+ return (value: number) => formatChartAxisValue(value, format);
57
+ }
@@ -82,7 +82,7 @@ function cartesianAxes(ctx: ChartRenderContext): React.ReactNode[] {
82
82
  // something.
83
83
  width="auto"
84
84
  tickMargin={axisConfig.tickMargin}
85
- tickFormatter={props.valueFormatter}
85
+ tickFormatter={props.axisValueFormatter ?? props.valueFormatter}
86
86
  allowDecimals={props.allowDecimalTicks !== false}
87
87
  />,
88
88
  );
@@ -1,6 +1,6 @@
1
1
  import type { ChartDataPoint, ChartProps } from './Chart.types';
2
2
  import type { ChartSemanticColor, ChartSpec, ChartSpecSeries } from './ChartSpec.types';
3
- import { chartValueFormatter } from './chart-format';
3
+ import { chartAxisValueFormatter, chartValueFormatter } from './chart-format';
4
4
  import {
5
5
  getChartSpecRenderer,
6
6
  getRegisteredChartSpecTypes,
@@ -176,6 +176,7 @@ export function specToChartProps(
176
176
  showTooltip: spec.tooltip ?? true,
177
177
  height: spec.height,
178
178
  valueFormatter: chartValueFormatter(spec.numberFormat),
179
+ axisValueFormatter: chartAxisValueFormatter(spec.numberFormat),
179
180
  // An integer metric is a COUNT: half a row does not exist, so the axis must
180
181
  // not offer half-steps it would then round into duplicates (FUT-755).
181
182
  allowDecimalTicks: spec.numberFormat !== 'integer',
@@ -123,20 +123,27 @@ export const Popover = React.forwardRef<HTMLDivElement, PopoverProps>(
123
123
  maxWidth,
124
124
  dataTestId,
125
125
  children,
126
+ PaperProps: callerPaper,
126
127
  ...props
127
128
  }, ref) => (
128
129
  <MuiPopover
129
130
  ref={ref}
130
131
  data-testid={dataTestId || 'popover-content'}
132
+ {...props}
133
+ // After the spread, and merged rather than replaced: a caller's
134
+ // `PaperProps` used to land last and drop the styled paper, its variant
135
+ // and the width cap; and its `sx` now adds to the cap instead.
131
136
  PaperProps={{
137
+ ...callerPaper,
132
138
  component: StyledPaper as React.ComponentType<PaperProps>,
133
139
  customVariant: variant,
134
140
  glow,
135
141
  pulse,
136
- sx: { maxWidth: popoverCap(maxWidth) },
137
- ...props.PaperProps,
142
+ sx: [
143
+ { maxWidth: popoverCap(maxWidth) },
144
+ ...(Array.isArray(callerPaper?.sx) ? callerPaper.sx : [callerPaper?.sx ?? {}]),
145
+ ],
138
146
  } as PaperProps & { customVariant?: string; glow?: boolean; pulse?: boolean }}
139
- {...props}
140
147
  >
141
148
  {children}
142
149
  </MuiPopover>
package/src/mui/styles.ts CHANGED
@@ -1,2 +1,2 @@
1
1
  export type { SxProps, Theme } from '@mui/material/styles/index.js';
2
- export { alpha, styled, useTheme, createTheme, ThemeProvider } from '@mui/material/styles/index.js';
2
+ export { alpha, keyframes, styled, useTheme, createTheme, ThemeProvider } from '@mui/material/styles/index.js';
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/components/data-display/Chart/chart-context.ts"],"sourcesContent":["import type { Theme } from '@mui/material/styles/index.js';\nimport type { CSSProperties } from 'react';\n\nimport type { ChartDataPoint, ChartProps, ChartSeries } from './Chart.types';\nimport { resolveAxisConfig, resolveBarGeometry, type BarGeometry, type CartesianAxisConfig } from './chart-axis';\nimport {\n getAxisStyles,\n getDefaultColors,\n getSizeStyles,\n resolveSeries,\n type SizeStyles,\n} from './chart-internals';\nimport { remPx } from '../../../tokens/relative';\n\n/**\n * Everything the per-type renderers in `chart-renderers.tsx` read, resolved\n * once from props + theme. Kept out of that file so each renderer is a small\n * JSX function over already-decided values — palette, series, axis geometry,\n * bar geometry — rather than a place where those decisions get made again\n * slightly differently.\n */\nexport interface ChartRenderContext {\n props: ChartProps;\n theme: Theme;\n sizeStyles: SizeStyles;\n chartColors: string[];\n chartSeries: ChartSeries[];\n strokeType: 'monotone' | 'linear';\n axisStyle: CSSProperties;\n gridStroke: string;\n /** Multiplier on `gridStroke`'s alpha — see `getAxisStyles`. */\n gridOpacity: number;\n axisConfig: CartesianAxisConfig;\n barGeometry: BarGeometry;\n animationDuration: number;\n commonProps: {\n data: ChartDataPoint[];\n margin: { top?: number; right?: number; bottom?: number; left?: number };\n onClick: (payload: unknown) => void;\n };\n}\n\nexport function buildChartContext(props: ChartProps, theme: Theme): ChartRenderContext {\n const sizeStyles = getSizeStyles(theme, props.size, props.height);\n const chartColors = getDefaultColors(theme, props.variant ?? 'default', props.colors);\n const { axisStyle, gridStroke, gridOpacity } = getAxisStyles(\n theme,\n props.variant ?? 'default',\n sizeStyles.fontSize,\n );\n const handleChartClick = (payload: unknown): void => {\n const chartData = payload as { activePayload?: Array<{ payload: ChartDataPoint }> };\n if (props.onClick && chartData?.activePayload?.[0]) {\n props.onClick(chartData.activePayload[0].payload);\n }\n };\n return {\n props,\n theme,\n sizeStyles,\n chartColors,\n chartSeries: resolveSeries(props.data, props.series, props.xAxisKey ?? 'name', chartColors),\n strokeType: (props.curved ?? true) ? 'monotone' : 'linear',\n axisStyle: { ...axisStyle, fontSize: sizeStyles.fontSize },\n gridStroke,\n gridOpacity,\n axisConfig: resolveAxisConfig(props, sizeStyles.tickMargin),\n barGeometry: resolveBarGeometry(props, theme),\n animationDuration: (props.animate ?? true) ? (props.animationDuration ?? 1500) : 0,\n commonProps: {\n data: props.data,\n margin: {\n top: remPx(theme, 20),\n right: remPx(theme, 30),\n left: remPx(theme, 20),\n bottom: remPx(theme, 20),\n ...marginPx(theme, props.margin),\n },\n onClick: handleChartClick,\n },\n };\n}\n\n/** A caller's margin is in design px (the prop's contract); Recharts takes px numbers. */\nfunction marginPx(theme: Theme, margin: ChartProps['margin']): ChartProps['margin'] {\n if (!margin) return undefined;\n return Object.fromEntries(\n Object.entries(margin).map(([side, px]) => [side, typeof px === 'number' ? remPx(theme, px) : px]),\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;AA0CO,SAAS,kBAAkB,OAAmB,OAAkC;AACrF,QAAM,aAAa,cAAc,OAAO,MAAM,MAAM,MAAM,MAAM;AAChE,QAAM,cAAc,iBAAiB,OAAO,MAAM,WAAW,WAAW,MAAM,MAAM;AACpF,QAAM,EAAE,WAAW,YAAY,YAAY,IAAI;AAAA,IAC7C;AAAA,IACA,MAAM,WAAW;AAAA,IACjB,WAAW;AAAA,EACb;AACA,QAAM,mBAAmB,CAAC,YAA2B;AACnD,UAAM,YAAY;AAClB,QAAI,MAAM,WAAW,WAAW,gBAAgB,CAAC,GAAG;AAClD,YAAM,QAAQ,UAAU,cAAc,CAAC,EAAE,OAAO;AAAA,IAClD;AAAA,EACF;AACA,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,aAAa,cAAc,MAAM,MAAM,MAAM,QAAQ,MAAM,YAAY,QAAQ,WAAW;AAAA,IAC1F,YAAa,MAAM,UAAU,OAAQ,aAAa;AAAA,IAClD,WAAW,EAAE,GAAG,WAAW,UAAU,WAAW,SAAS;AAAA,IACzD;AAAA,IACA;AAAA,IACA,YAAY,kBAAkB,OAAO,WAAW,UAAU;AAAA,IAC1D,aAAa,mBAAmB,OAAO,KAAK;AAAA,IAC5C,mBAAoB,MAAM,WAAW,OAAS,MAAM,qBAAqB,OAAQ;AAAA,IACjF,aAAa;AAAA,MACX,MAAM,MAAM;AAAA,MACZ,QAAQ;AAAA,QACN,KAAK,MAAM,OAAO,EAAE;AAAA,QACpB,OAAO,MAAM,OAAO,EAAE;AAAA,QACtB,MAAM,MAAM,OAAO,EAAE;AAAA,QACrB,QAAQ,MAAM,OAAO,EAAE;AAAA,QACvB,GAAG,SAAS,OAAO,MAAM,MAAM;AAAA,MACjC;AAAA,MACA,SAAS;AAAA,IACX;AAAA,EACF;AACF;AAGA,SAAS,SAAS,OAAc,QAAoD;AAClF,MAAI,CAAC,OAAQ,QAAO;AACpB,SAAO,OAAO;AAAA,IACZ,OAAO,QAAQ,MAAM,EAAE,IAAI,CAAC,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,OAAO,OAAO,WAAW,MAAM,OAAO,EAAE,IAAI,EAAE,CAAC;AAAA,EACnG;AACF;","names":[]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/components/data-display/Chart/chart-format.ts"],"sourcesContent":["import type { ChartNumberFormat } from './ChartSpec.types';\n\nconst formatters: Record<ChartNumberFormat, Intl.NumberFormat> = {\n brl: new Intl.NumberFormat('pt-BR', { style: 'currency', currency: 'BRL' }),\n percent: new Intl.NumberFormat('pt-BR', { style: 'percent', maximumFractionDigits: 1 }),\n compact: new Intl.NumberFormat('pt-BR', { notation: 'compact', maximumFractionDigits: 1 }),\n integer: new Intl.NumberFormat('pt-BR', { maximumFractionDigits: 0 }),\n decimal: new Intl.NumberFormat('pt-BR', { maximumFractionDigits: 2 }),\n};\n\n/**\n * Format a chart value with one of the serializable number formats.\n * `brl` expects integer centavos (repo-wide money convention); `percent`\n * expects a fraction (0.15 → \"15%\"). Non-finite values render as an empty\n * string so a null-ish row never draws \"NaN\" into a tooltip or axis.\n */\nexport function formatChartValue(value: number, format: ChartNumberFormat = 'decimal'): string {\n if (!Number.isFinite(value)) return '';\n if (format === 'brl') return formatters.brl.format(value / 100);\n return formatters[format].format(value);\n}\n\n/** Curried {@link formatChartValue}, memo-friendly for tooltip/axis props. */\nexport function chartValueFormatter(format?: ChartNumberFormat): (value: number) => string {\n return (value: number) => formatChartValue(value, format);\n}\n"],"mappings":";AAEA,IAAM,aAA2D;AAAA,EAC/D,KAAK,IAAI,KAAK,aAAa,SAAS,EAAE,OAAO,YAAY,UAAU,MAAM,CAAC;AAAA,EAC1E,SAAS,IAAI,KAAK,aAAa,SAAS,EAAE,OAAO,WAAW,uBAAuB,EAAE,CAAC;AAAA,EACtF,SAAS,IAAI,KAAK,aAAa,SAAS,EAAE,UAAU,WAAW,uBAAuB,EAAE,CAAC;AAAA,EACzF,SAAS,IAAI,KAAK,aAAa,SAAS,EAAE,uBAAuB,EAAE,CAAC;AAAA,EACpE,SAAS,IAAI,KAAK,aAAa,SAAS,EAAE,uBAAuB,EAAE,CAAC;AACtE;AAQO,SAAS,iBAAiB,OAAe,SAA4B,WAAmB;AAC7F,MAAI,CAAC,OAAO,SAAS,KAAK,EAAG,QAAO;AACpC,MAAI,WAAW,MAAO,QAAO,WAAW,IAAI,OAAO,QAAQ,GAAG;AAC9D,SAAO,WAAW,MAAM,EAAE,OAAO,KAAK;AACxC;AAGO,SAAS,oBAAoB,QAAuD;AACzF,SAAO,CAAC,UAAkB,iBAAiB,OAAO,MAAM;AAC1D;","names":[]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/components/data-display/Chart/chart-spec.ts"],"sourcesContent":["import type { ChartDataPoint, ChartProps } from './Chart.types';\nimport type { ChartSemanticColor, ChartSpec, ChartSpecSeries } from './ChartSpec.types';\nimport { chartValueFormatter } from './chart-format';\nimport {\n getChartSpecRenderer,\n getRegisteredChartSpecTypes,\n type ChartSpecRenderContext,\n} from './chart-spec-registry';\n\n/**\n * BREAKING FOR STORED SPECS, not just for types.\n *\n * A chart spec is DATA — it is authored as JSON and can be persisted — and this\n * list is validated at runtime, so a saved spec carrying `\"error\"` now throws\n * `ChartSpecError` instead of silently drawing. That is the right failure (the\n * alternative is a series quietly losing its colour), but unlike the rest of\n * this migration a type-check will not find the affected specs: anything stored\n * outside the repo has to be rewritten `error` → `danger`.\n */\nexport const CHART_SEMANTIC_COLORS: readonly ChartSemanticColor[] = [\n 'primary',\n 'secondary',\n 'success',\n 'warning',\n 'danger',\n 'info',\n];\n\nconst NUMBER_FORMATS = ['brl', 'percent', 'compact', 'integer', 'decimal'];\n\n/** Error thrown when an unknown/invalid spec is parsed. Message is written to\n * be actionable for programmatic authors (builders, LLMs). */\nexport class ChartSpecError extends Error {\n constructor(message: string) {\n super(message);\n this.name = 'ChartSpecError';\n }\n}\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' && value !== null && !Array.isArray(value);\n}\n\nfunction assertColor(value: unknown, where: string): void {\n if (value === undefined) return;\n if (!CHART_SEMANTIC_COLORS.includes(value as ChartSemanticColor)) {\n throw new ChartSpecError(\n `${where} must be a semantic color token (${CHART_SEMANTIC_COLORS.join(', ')}), got ${JSON.stringify(value)}. Raw color values are not allowed.`,\n );\n }\n}\n\nfunction parseAxis(value: unknown): { key: string; label?: string } {\n if (!isRecord(value) || typeof value.key !== 'string' || value.key.length === 0) {\n throw new ChartSpecError('\"xAxis\" must be an object with a non-empty string \"key\" naming the row property for the category axis.');\n }\n if (value.label !== undefined && typeof value.label !== 'string') {\n throw new ChartSpecError('\"xAxis.label\" must be a string when provided.');\n }\n return { key: value.key, label: value.label };\n}\n\nfunction parseSeries(value: unknown): ChartSpecSeries[] {\n if (!Array.isArray(value) || value.length === 0) {\n throw new ChartSpecError('\"series\" must be a non-empty array of { key, label?, color? } objects.');\n }\n return value.map((entry, index) => {\n if (!isRecord(entry) || typeof entry.key !== 'string' || entry.key.length === 0) {\n throw new ChartSpecError(`\"series[${index}]\" must be an object with a non-empty string \"key\" naming the row property holding its values.`);\n }\n assertColor(entry.color, `\"series[${index}].color\"`);\n if (entry.label !== undefined && typeof entry.label !== 'string') {\n throw new ChartSpecError(`\"series[${index}].label\" must be a string when provided.`);\n }\n return { key: entry.key, label: entry.label, color: entry.color as ChartSemanticColor | undefined };\n });\n}\n\nfunction assertFieldType(\n spec: Record<string, unknown>,\n field: string,\n expected: 'string' | 'boolean' | 'number',\n): void {\n const value = spec[field];\n if (value !== undefined && typeof value !== expected) {\n throw new ChartSpecError(`\"${field}\" must be a ${expected} when provided.`);\n }\n}\n\nfunction parseColorScheme(value: unknown): ChartSemanticColor[] | undefined {\n if (value === undefined) return undefined;\n if (!Array.isArray(value) || value.length === 0) {\n throw new ChartSpecError('\"colorScheme\" must be a non-empty array of semantic color tokens when provided.');\n }\n value.forEach((token, index) => assertColor(token, `\"colorScheme[${index}]\"`));\n return value as ChartSemanticColor[];\n}\n\nfunction parseOptionalFields(spec: Record<string, unknown>): Partial<ChartSpec> {\n for (const field of ['title', 'subtitle'] as const) assertFieldType(spec, field, 'string');\n for (const field of ['stacked', 'legend', 'tooltip', 'curved'] as const) {\n assertFieldType(spec, field, 'boolean');\n }\n assertFieldType(spec, 'height', 'number');\n if (spec.numberFormat !== undefined && !NUMBER_FORMATS.includes(spec.numberFormat as string)) {\n throw new ChartSpecError(\n `\"numberFormat\" must be one of ${NUMBER_FORMATS.join(', ')}, got ${JSON.stringify(spec.numberFormat)}.`,\n );\n }\n return {\n title: spec.title as string | undefined,\n subtitle: spec.subtitle as string | undefined,\n stacked: spec.stacked as boolean | undefined,\n legend: spec.legend as boolean | undefined,\n tooltip: spec.tooltip as boolean | undefined,\n curved: spec.curved as boolean | undefined,\n height: spec.height as number | undefined,\n numberFormat: spec.numberFormat as ChartSpec['numberFormat'],\n colorScheme: parseColorScheme(spec.colorScheme),\n };\n}\n\n/**\n * Validate an untrusted value (e.g. JSON from storage or an LLM) into a\n * `ChartSpec`. Throws {@link ChartSpecError} with an actionable message on\n * the first problem found.\n */\nexport function parseChartSpec(input: unknown): ChartSpec {\n if (!isRecord(input)) {\n throw new ChartSpecError('A chart spec must be a JSON object.');\n }\n const type = input.type;\n if (typeof type !== 'string' || !getChartSpecRenderer(type)) {\n throw new ChartSpecError(\n `\"type\" must be one of the registered chart types (${getRegisteredChartSpecTypes().join(', ')}), got ${JSON.stringify(type)}.`,\n );\n }\n const yAxis = input.yAxis;\n if (yAxis !== undefined && (!isRecord(yAxis) || (yAxis.label !== undefined && typeof yAxis.label !== 'string'))) {\n throw new ChartSpecError('\"yAxis\" must be an object with an optional string \"label\" when provided.');\n }\n const centerLabel = input.centerLabel;\n return {\n ...parseOptionalFields(input),\n type: type as ChartSpec['type'],\n xAxis: parseAxis(input.xAxis),\n yAxis: yAxis as ChartSpec['yAxis'],\n series: parseSeries(input.series),\n centerLabel: centerLabel as ChartSpec['centerLabel'],\n };\n}\n\n/**\n * Derive the prop-driven `Chart` props for a validated spec. The spec API is\n * layered on top of the existing component — one rendering implementation.\n */\nexport function specToChartProps(\n spec: ChartSpec,\n data: ChartDataPoint[],\n ctx: ChartSpecRenderContext,\n): ChartProps {\n const renderer = getChartSpecRenderer(spec.type);\n if (!renderer) {\n throw new ChartSpecError(\n `Unknown chart type \"${spec.type}\". Registered types: ${getRegisteredChartSpecTypes().join(', ')}.`,\n );\n }\n return {\n data,\n title: spec.title,\n subtitle: spec.subtitle,\n xAxisKey: spec.xAxis.key,\n xAxisLabel: spec.xAxis.label,\n yAxisLabel: spec.yAxis?.label,\n showLegend: spec.legend ?? true,\n showTooltip: spec.tooltip ?? true,\n height: spec.height,\n valueFormatter: chartValueFormatter(spec.numberFormat),\n // An integer metric is a COUNT: half a row does not exist, so the axis must\n // not offer half-steps it would then round into duplicates (FUT-755).\n allowDecimalTicks: spec.numberFormat !== 'integer',\n ...renderer(spec, ctx),\n };\n}\n"],"mappings":";;;;;;;;;A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,QAAQ,KAAK;AAAA,IACb,gBAAgB,oBAAoB,KAAK,YAAY;AAAA;AAAA;AAAA,IAGrD,mBAAmB,KAAK,iBAAiB;AAAA,IACzC,GAAG,SAAS,MAAM,GAAG;AAAA,EACvB;AACF;","names":[]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/components/data-display/Chart/chart-renderers.tsx"],"sourcesContent":["import type { Theme } from '@mui/material/styles/index.js';\nimport React from 'react';\nimport {\n Area,\n AreaChart,\n Bar,\n BarChart,\n CartesianGrid,\n Cell,\n ComposedChart,\n Legend,\n Line,\n LineChart,\n Pie,\n PieChart,\n PolarAngleAxis,\n PolarGrid,\n PolarRadiusAxis,\n Radar,\n RadarChart,\n Scatter,\n ScatterChart,\n Tooltip,\n XAxis,\n YAxis,\n} from 'recharts';\n\nimport type { ChartProps, ChartSeries } from './Chart.types';\nimport { ChartLegendContent, ChartTooltipContent } from './ChartComposables';\nimport { buildChartContext, type ChartRenderContext } from './chart-context';\nimport { uiInk } from '../../../tokens/ink';\nimport { remPx } from '../../../tokens/relative';\n\n/**\n * Per-type Recharts renderers for the prop-driven Chart, dispatched from a\n * registry keyed by `ChartProps['type']`. Each renderer reads a prepared\n * {@link ChartRenderContext} so every function stays small.\n */\n\nfunction chartExtras(ctx: ChartRenderContext): React.ReactNode[] {\n const { props } = ctx;\n const nodes: React.ReactNode[] = [];\n if (props.showTooltip !== false) {\n nodes.push(\n <Tooltip key=\"tooltip\" content={<ChartTooltipContent valueFormatter={props.valueFormatter} />} />,\n );\n }\n if (props.showLegend !== false) {\n nodes.push(<Legend key=\"legend\" content={<ChartLegendContent />} />);\n }\n return nodes;\n}\n\n/**\n * Gridlines: solid, and one step below the card border. A dashed line at the\n * border's own weight competes with the data drawn over it.\n */\nfunction chartGrid(ctx: ChartRenderContext): React.ReactElement {\n return <CartesianGrid key=\"grid\" stroke={ctx.gridStroke} strokeOpacity={ctx.gridOpacity} />;\n}\n\nfunction cartesianAxes(ctx: ChartRenderContext): React.ReactNode[] {\n const { props, axisConfig } = ctx;\n const nodes: React.ReactNode[] = [];\n if (props.showCartesianGrid !== false) nodes.push(chartGrid(ctx));\n nodes.push(\n <XAxis\n key=\"x\"\n dataKey={props.xAxisKey ?? 'name'}\n style={ctx.axisStyle}\n label={props.xAxisLabel}\n tickMargin={axisConfig.tickMargin}\n ticks={axisConfig.categoryTicks}\n tickFormatter={axisConfig.tickFormatter}\n />,\n <YAxis\n key=\"y\"\n style={ctx.axisStyle}\n label={props.yAxisLabel}\n // Sized from its own widest tick: a fixed 60px lets \"R$ 1.234,56\" spill\n // out of the card, which is the other way axis text ends up on top of\n // something.\n width=\"auto\"\n tickMargin={axisConfig.tickMargin}\n tickFormatter={props.valueFormatter}\n allowDecimals={props.allowDecimalTicks !== false}\n />,\n );\n return nodes;\n}\n\nfunction renderLine(ctx: ChartRenderContext): React.ReactElement {\n return (\n <LineChart {...ctx.commonProps}>\n {cartesianAxes(ctx)}\n {chartExtras(ctx)}\n {ctx.chartSeries.map((s, index) => (\n <Line\n key={s.dataKey}\n type={ctx.strokeType}\n dataKey={s.dataKey}\n name={s.name}\n stroke={s.color ?? ctx.chartColors[index % ctx.chartColors.length]}\n strokeWidth={s.strokeWidth ?? 2}\n dot={s.dot !== false}\n activeDot={s.activeDot !== false ? { r: 8 } : false}\n animationDuration={ctx.animationDuration}\n />\n ))}\n </LineChart>\n );\n}\n\nfunction renderBar(ctx: ChartRenderContext): React.ReactElement {\n return (\n <BarChart {...ctx.commonProps}>\n {cartesianAxes(ctx)}\n {chartExtras(ctx)}\n {ctx.chartSeries.map((s, index) => (\n <Bar\n key={s.dataKey}\n dataKey={s.dataKey}\n name={s.name}\n fill={s.fill ?? s.color ?? ctx.chartColors[index % ctx.chartColors.length]}\n stackId={ctx.props.stacked ? 'stack' : undefined}\n radius={ctx.barGeometry.radius}\n maxBarSize={ctx.barGeometry.maxBarSize}\n animationDuration={ctx.animationDuration}\n />\n ))}\n </BarChart>\n );\n}\n\nfunction renderArea(ctx: ChartRenderContext): React.ReactElement {\n return (\n <AreaChart {...ctx.commonProps}>\n {cartesianAxes(ctx)}\n {chartExtras(ctx)}\n {ctx.chartSeries.map((s, index) => (\n <Area\n key={s.dataKey}\n type={ctx.strokeType}\n dataKey={s.dataKey}\n name={s.name}\n stroke={s.color ?? ctx.chartColors[index % ctx.chartColors.length]}\n fill={s.fill ?? s.color ?? ctx.chartColors[index % ctx.chartColors.length]}\n fillOpacity={s.fillOpacity ?? 0.6}\n stackId={ctx.props.stacked ? 'stack' : undefined}\n animationDuration={ctx.animationDuration}\n />\n ))}\n </AreaChart>\n );\n}\n\nfunction pieCenterLabel(ctx: ChartRenderContext): React.ReactNode {\n const { centerLabel } = ctx.props;\n const innerRadius = ctx.props.innerRadius ?? 0;\n if (!centerLabel || innerRadius <= 0) return null;\n const fill = ctx.props.variant === 'neon' ? uiInk(ctx.theme).dataVizNeon.accent : ctx.theme.palette.text.primary;\n return (\n <text\n x=\"50%\"\n y=\"50%\"\n textAnchor=\"middle\"\n dominantBaseline=\"middle\"\n style={{ fontSize: ctx.sizeStyles.fontSize, fill, fontWeight: 600 }}\n >\n {typeof centerLabel === 'string' ? (\n centerLabel\n ) : (\n <>\n <tspan\n x=\"50%\"\n dy=\"-0.6em\"\n style={{ fontSize: '0.875em', fontWeight: 500, fill: ctx.theme.palette.text.secondary }}\n >\n {centerLabel.label}\n </tspan>\n <tspan x=\"50%\" dy=\"1.4em\" style={{ fontSize: '1.5em', fontWeight: 700 }}>\n {centerLabel.value}\n </tspan>\n </>\n )}\n </text>\n );\n}\n\nfunction renderPie(ctx: ChartRenderContext): React.ReactElement {\n const { props } = ctx;\n return (\n <PieChart>\n {chartExtras(ctx)}\n <Pie\n data={props.data}\n dataKey={ctx.chartSeries[0]?.dataKey ?? 'value'}\n nameKey={props.xAxisKey ?? 'name'}\n cx=\"50%\"\n cy=\"50%\"\n outerRadius={ctx.sizeStyles.height / 3}\n innerRadius={remPx(ctx.theme, props.innerRadius ?? 0)}\n fill={ctx.chartColors[0]}\n label={props.showValues ?? false}\n animationDuration={ctx.animationDuration}\n >\n {props.data.map((entry, index) => (\n <Cell key={`cell-${index}`} fill={ctx.chartColors[index % ctx.chartColors.length]} />\n ))}\n </Pie>\n {pieCenterLabel(ctx)}\n </PieChart>\n );\n}\n\nfunction renderRadar(ctx: ChartRenderContext): React.ReactElement {\n return (\n <RadarChart {...ctx.commonProps}>\n <PolarGrid stroke={ctx.gridStroke} />\n <PolarAngleAxis dataKey={ctx.props.xAxisKey ?? 'name'} style={ctx.axisStyle} />\n <PolarRadiusAxis style={ctx.axisStyle} />\n {chartExtras(ctx)}\n {ctx.chartSeries.map((s, index) => (\n <Radar\n key={s.dataKey}\n dataKey={s.dataKey}\n name={s.name}\n stroke={s.color ?? ctx.chartColors[index % ctx.chartColors.length]}\n fill={s.fill ?? s.color ?? ctx.chartColors[index % ctx.chartColors.length]}\n fillOpacity={s.fillOpacity ?? 0.6}\n animationDuration={ctx.animationDuration}\n />\n ))}\n </RadarChart>\n );\n}\n\nfunction renderScatter(ctx: ChartRenderContext): React.ReactElement {\n const { props } = ctx;\n return (\n <ScatterChart {...ctx.commonProps}>\n {props.showCartesianGrid !== false && chartGrid(ctx)}\n <XAxis\n dataKey={props.xAxisKey ?? 'name'}\n style={ctx.axisStyle}\n label={props.xAxisLabel}\n tickMargin={ctx.axisConfig.tickMargin}\n />\n <YAxis\n dataKey={ctx.chartSeries[0]?.dataKey}\n style={ctx.axisStyle}\n label={props.yAxisLabel}\n tickMargin={ctx.axisConfig.tickMargin}\n />\n {chartExtras(ctx)}\n <Scatter\n name={ctx.chartSeries[0]?.name ?? 'Data'}\n data={props.data}\n fill={ctx.chartColors[0]}\n animationDuration={ctx.animationDuration}\n />\n </ScatterChart>\n );\n}\n\nfunction composedSeries(ctx: ChartRenderContext, s: ChartSeries, index: number): React.ReactElement {\n const color = s.color ?? ctx.chartColors[index % ctx.chartColors.length];\n if (s.type === 'bar') {\n return (\n <Bar\n key={s.dataKey}\n dataKey={s.dataKey}\n name={s.name}\n fill={color}\n radius={ctx.barGeometry.radius}\n maxBarSize={ctx.barGeometry.maxBarSize}\n animationDuration={ctx.animationDuration}\n />\n );\n }\n if (s.type === 'area') {\n return (\n <Area\n key={s.dataKey}\n type={ctx.strokeType}\n dataKey={s.dataKey}\n name={s.name}\n stroke={color}\n fill={color}\n fillOpacity={0.6}\n animationDuration={ctx.animationDuration}\n />\n );\n }\n return (\n <Line\n key={s.dataKey}\n type={ctx.strokeType}\n dataKey={s.dataKey}\n name={s.name}\n stroke={color}\n animationDuration={ctx.animationDuration}\n />\n );\n}\n\nfunction renderComposed(ctx: ChartRenderContext): React.ReactElement {\n return (\n <ComposedChart {...ctx.commonProps}>\n {cartesianAxes(ctx)}\n {chartExtras(ctx)}\n {ctx.chartSeries.map((s, index) => composedSeries(ctx, s, index))}\n </ComposedChart>\n );\n}\n\nconst RENDERERS: Record<string, (ctx: ChartRenderContext) => React.ReactElement> = {\n line: renderLine,\n bar: renderBar,\n area: renderArea,\n pie: renderPie,\n radar: renderRadar,\n scatter: renderScatter,\n composed: renderComposed,\n};\n\n/** Render the Recharts element for the requested chart type. */\nexport function renderChartByType(props: ChartProps, theme: Theme): React.ReactElement {\n const renderer = RENDERERS[props.type ?? 'line'];\n const ctx = buildChartContext(props, theme);\n return renderer ? renderer(ctx) : <></>;\n}\n"],"mappings":";;;;;;;;;;;;;;;AAEA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAmB+B,SAgI9B,UAhI8B,KAiDlC,YAjDkC;AALtC,SAAS,YAAY,KAA4C;AAC/D,QAAM,EAAE,MAAM,IAAI;AAClB,QAAM,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