@mlw-packages/react-components 1.9.3 → 1.9.5

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.
package/dist/index.js CHANGED
@@ -15631,12 +15631,14 @@ var SystemTooltip = ({
15631
15631
  data,
15632
15632
  position,
15633
15633
  title = "Conex\xF5es",
15634
+ isLoading = false,
15634
15635
  onMouseDown,
15635
15636
  onClose,
15636
15637
  onPositionChange
15637
15638
  }) => {
15638
15639
  const [localPos, setLocalPos] = React33.useState(position);
15639
15640
  const [dragging, setDragging] = React33.useState(false);
15641
+ const [expandedId, setExpandedId] = React33.useState(null);
15640
15642
  const offsetRef = React33.useRef({ x: 0, y: 0 });
15641
15643
  const lastMouse = React33.useRef({ x: 0, y: 0 });
15642
15644
  React33.useEffect(() => setLocalPos(position), [position]);
@@ -15758,54 +15760,157 @@ var SystemTooltip = ({
15758
15760
  ]
15759
15761
  }
15760
15762
  ),
15761
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "px-4 pt-4 pb-3", children: [
15763
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "px-4 pt-4 pb-3", children: isLoading ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-2", children: [
15764
+ /* @__PURE__ */ jsxRuntime.jsx(SkeletonBase, { className: "h-6 w-3/4" }),
15765
+ /* @__PURE__ */ jsxRuntime.jsx(SkeletonBase, { className: "h-4 w-1/2" })
15766
+ ] }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
15762
15767
  /* @__PURE__ */ jsxRuntime.jsx("h3", { className: "text-xl font-bold text-foreground tracking-tight truncate", children: data.name }),
15763
- /* @__PURE__ */ jsxRuntime.jsx("h3", { className: "text-sm font-bold text-muted-foreground tracking-tight truncate", children: data.description })
15764
- ] }),
15768
+ data.description && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-muted-foreground tracking-tight truncate", children: data.description })
15769
+ ] }) }),
15765
15770
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "px-3 pb-4 space-y-4 max-h-[300px] overflow-y-auto [&::-webkit-scrollbar]:w- [&::-webkit-scrollbar-track]:bg-transparent [&::-webkit-scrollbar-thumb]:bg-muted-foreground/20 [&::-webkit-scrollbar-thumb]:rounded-full hover:[&::-webkit-scrollbar-thumb]:bg-muted-foreground/40 transition-colors", children: [
15766
15771
  /* @__PURE__ */ jsxRuntime.jsx(SeparatorBase, { className: "w-full" }),
15767
- entries.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-2", children: [
15768
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2 px-1", children: [
15769
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-1.5 h-1.5 rounded-full bg-emerald-500" }),
15770
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[10px] font-bold text-muted-foreground uppercase", children: "Entradas" })
15772
+ isLoading ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
15773
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-2", children: [
15774
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2 px-1", children: [
15775
+ /* @__PURE__ */ jsxRuntime.jsx(SkeletonBase, { className: "w-1.5 h-1.5 rounded-full" }),
15776
+ /* @__PURE__ */ jsxRuntime.jsx(SkeletonBase, { className: "h-3 w-16" })
15777
+ ] }),
15778
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "space-y-1", children: [1, 2, 3].map((i) => /* @__PURE__ */ jsxRuntime.jsx(SkeletonBase, { className: "h-10 w-full rounded-lg" }, i)) })
15771
15779
  ] }),
15772
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "space-y-1", children: entries.map((conn) => /* @__PURE__ */ jsxRuntime.jsxs(
15773
- "div",
15774
- {
15775
- className: "group flex items-center justify-between p-2 rounded-lg bg-emerald-500/5 border border-emerald-500/10 hover:border-emerald-500/30 transition-all",
15776
- children: [
15777
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center gap-2 overflow-hidden", children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm font-medium truncate", children: conn.name }) }),
15778
- " ",
15779
- /* @__PURE__ */ jsxRuntime.jsx(
15780
- react.ArrowRight,
15781
- {
15782
- size: 14,
15783
- className: "text-emerald-500 shrink-0 rotate-180"
15784
- }
15785
- )
15786
- ]
15787
- },
15788
- conn.id
15789
- )) })
15790
- ] }),
15791
- exits.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-2", children: [
15792
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2 px-1", children: [
15793
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-1.5 h-1.5 rounded-full bg-blue-500" }),
15794
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[10px] font-bold text-muted-foreground uppercase", children: "Sa\xEDdas" })
15780
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-2", children: [
15781
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2 px-1", children: [
15782
+ /* @__PURE__ */ jsxRuntime.jsx(SkeletonBase, { className: "w-1.5 h-1.5 rounded-full" }),
15783
+ /* @__PURE__ */ jsxRuntime.jsx(SkeletonBase, { className: "h-3 w-16" })
15784
+ ] }),
15785
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "space-y-1", children: [1, 2].map((i) => /* @__PURE__ */ jsxRuntime.jsx(SkeletonBase, { className: "h-10 w-full rounded-lg" }, i)) })
15786
+ ] })
15787
+ ] }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
15788
+ entries.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-2", children: [
15789
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2 px-1", children: [
15790
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-1.5 h-1.5 rounded-full bg-emerald-500" }),
15791
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[10px] font-bold text-muted-foreground uppercase", children: "Entradas" })
15792
+ ] }),
15793
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "space-y-1", children: entries.map((conn) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-1", children: [
15794
+ /* @__PURE__ */ jsxRuntime.jsxs(
15795
+ "div",
15796
+ {
15797
+ className: "group flex items-center justify-between p-2 rounded-lg bg-emerald-500/5 border border-emerald-500/10 hover:border-emerald-500/30 transition-all cursor-pointer",
15798
+ onClick: () => setExpandedId(expandedId === conn.id ? null : conn.id),
15799
+ children: [
15800
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center gap-2 overflow-hidden", children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm font-medium truncate", children: conn.name }) }),
15801
+ /* @__PURE__ */ jsxRuntime.jsx(
15802
+ react.ArrowRight,
15803
+ {
15804
+ size: 14,
15805
+ className: "text-emerald-500 shrink-0 rotate-180"
15806
+ }
15807
+ )
15808
+ ]
15809
+ }
15810
+ ),
15811
+ expandedId === conn.id && conn.integration && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "ml-2 p-2 rounded-lg bg-muted/30 border border-border/20 text-xs space-y-1", children: [
15812
+ conn.integration.Nome && /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
15813
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-semibold", children: "Nome:" }),
15814
+ " ",
15815
+ conn.integration.Nome
15816
+ ] }),
15817
+ (conn.integration.tipo || conn.integration.Tipo) && /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
15818
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-semibold", children: "Tipo:" }),
15819
+ " ",
15820
+ conn.integration.tipo || conn.integration.Tipo
15821
+ ] }),
15822
+ conn.integration.Protocolos && /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
15823
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-semibold", children: "Protocolos:" }),
15824
+ " ",
15825
+ conn.integration.Protocolos
15826
+ ] }),
15827
+ conn.integration.Ambiente && /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
15828
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-semibold", children: "Ambiente:" }),
15829
+ " ",
15830
+ conn.integration.Ambiente
15831
+ ] }),
15832
+ conn.integration.Setor && /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
15833
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-semibold", children: "Setor:" }),
15834
+ " ",
15835
+ conn.integration.Setor
15836
+ ] }),
15837
+ conn.integration.Contato && /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
15838
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-semibold", children: "Contato:" }),
15839
+ " ",
15840
+ conn.integration.Contato
15841
+ ] }),
15842
+ conn.integration.Sustentacao && /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
15843
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-semibold", children: "Sustenta\xE7\xE3o:" }),
15844
+ " ",
15845
+ conn.integration.Sustentacao
15846
+ ] })
15847
+ ] })
15848
+ ] }, conn.id)) })
15795
15849
  ] }),
15796
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "space-y-1", children: exits.map((conn) => /* @__PURE__ */ jsxRuntime.jsxs(
15797
- "div",
15798
- {
15799
- className: "group flex items-center justify-between p-2 rounded-lg bg-blue-500/5 border border-blue-500/10 hover:border-blue-500/30 transition-all",
15800
- children: [
15801
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center gap-2 overflow-hidden", children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm font-medium truncate", children: conn.name }) }),
15802
- /* @__PURE__ */ jsxRuntime.jsx(react.ArrowRight, { size: 14, className: "text-blue-500 shrink-0" })
15803
- ]
15804
- },
15805
- conn.id
15806
- )) })
15807
- ] }),
15808
- data.connections.length === 0 && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-col items-center justify-center p-6 text-center", children: /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-muted-foreground", children: "Nenhuma conex\xE3o encontrada" }) })
15850
+ exits.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-2", children: [
15851
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2 px-1", children: [
15852
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-1.5 h-1.5 rounded-full bg-blue-500" }),
15853
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[10px] font-bold text-muted-foreground uppercase", children: "Sa\xEDdas" })
15854
+ ] }),
15855
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "space-y-1", children: exits.map((conn) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-1", children: [
15856
+ /* @__PURE__ */ jsxRuntime.jsxs(
15857
+ "div",
15858
+ {
15859
+ className: "group flex items-center justify-between p-2 rounded-lg bg-blue-500/5 border border-blue-500/10 hover:border-blue-500/30 transition-all cursor-pointer",
15860
+ onClick: () => setExpandedId(expandedId === conn.id ? null : conn.id),
15861
+ children: [
15862
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center gap-2 overflow-hidden", children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm font-medium truncate", children: conn.name }) }),
15863
+ /* @__PURE__ */ jsxRuntime.jsx(
15864
+ react.ArrowRight,
15865
+ {
15866
+ size: 14,
15867
+ className: "text-blue-500 shrink-0"
15868
+ }
15869
+ )
15870
+ ]
15871
+ }
15872
+ ),
15873
+ expandedId === conn.id && conn.integration && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "ml-2 p-2 rounded-lg bg-muted/30 border border-border/20 text-xs space-y-1", children: [
15874
+ conn.integration.Nome && /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
15875
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-semibold", children: "Nome:" }),
15876
+ " ",
15877
+ conn.integration.Nome
15878
+ ] }),
15879
+ (conn.integration.tipo || conn.integration.Tipo) && /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
15880
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-semibold", children: "Tipo:" }),
15881
+ " ",
15882
+ conn.integration.tipo || conn.integration.Tipo
15883
+ ] }),
15884
+ conn.integration.Protocolos && /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
15885
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-semibold", children: "Protocolos:" }),
15886
+ " ",
15887
+ conn.integration.Protocolos
15888
+ ] }),
15889
+ conn.integration.Ambiente && /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
15890
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-semibold", children: "Ambiente:" }),
15891
+ " ",
15892
+ conn.integration.Ambiente
15893
+ ] }),
15894
+ conn.integration.Setor && /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
15895
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-semibold", children: "Setor:" }),
15896
+ " ",
15897
+ conn.integration.Setor
15898
+ ] }),
15899
+ conn.integration.Contato && /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
15900
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-semibold", children: "Contato:" }),
15901
+ " ",
15902
+ conn.integration.Contato
15903
+ ] }),
15904
+ conn.integration.Sustentacao && /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
15905
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-semibold", children: "Sustenta\xE7\xE3o:" }),
15906
+ " ",
15907
+ conn.integration.Sustentacao
15908
+ ] })
15909
+ ] })
15910
+ ] }, conn.id)) })
15911
+ ] }),
15912
+ data.connections.length === 0 && !isLoading && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-col items-center justify-center p-6 text-center", children: /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-muted-foreground", children: "Nenhuma conex\xE3o encontrada" }) })
15913
+ ] })
15809
15914
  ] })
15810
15915
  ]
15811
15916
  },
@@ -16065,10 +16170,10 @@ var HorizontalLegend = ({
16065
16170
  const label = mapperConfig[key]?.label ?? labelMap?.[key] ?? formatFieldName2(key);
16066
16171
  return legendUppercase ? label.toUpperCase() : label;
16067
16172
  };
16068
- return /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn(className), children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2 sm:gap-3 md:gap-4 flex-wrap", children: [
16173
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn(className), children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-center gap-2 sm:gap-3 md:gap-4 overflow-x-auto", children: [
16069
16174
  allKeys.map((key) => {
16070
16175
  const displayLabel = formatLegendLabel(key);
16071
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-1.5 sm:gap-2", children: [
16176
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-1.5 sm:gap-2 flex-shrink-0", children: [
16072
16177
  /* @__PURE__ */ jsxRuntime.jsx(
16073
16178
  "div",
16074
16179
  {
@@ -16076,10 +16181,10 @@ var HorizontalLegend = ({
16076
16181
  style: { backgroundColor: finalColors[key] }
16077
16182
  }
16078
16183
  ),
16079
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-xs sm:text-sm tracking-[0] break-words", children: displayLabel })
16184
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-xs sm:text-sm tracking-[0] whitespace-nowrap", children: displayLabel })
16080
16185
  ] }, key);
16081
16186
  }),
16082
- orderBy && maxPeriodLabel && minPeriodLabel && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2 sm:gap-3 md:gap-4 w-full sm:w-auto justify-center mt-2 sm:mt-0 sm:ml-3 sm:pl-3 md:ml-4 md:pl-4 sm:border-l border-border", children: [
16187
+ orderBy && maxPeriodLabel && minPeriodLabel && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2 sm:gap-3 md:gap-4 ml-3 pl-3 md:ml-4 md:pl-4 border-l border-border flex-shrink-0", children: [
16083
16188
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-1 sm:gap-1.5", children: [
16084
16189
  /* @__PURE__ */ jsxRuntime.jsx(
16085
16190
  react.FunnelSimpleIcon,
@@ -16088,7 +16193,7 @@ var HorizontalLegend = ({
16088
16193
  weight: "bold"
16089
16194
  }
16090
16195
  ),
16091
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-xs sm:text-sm tracking-[0] font-medium truncate max-w-[120px] sm:max-w-none", children: maxPeriodLabel })
16196
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-xs sm:text-sm tracking-[0] font-medium whitespace-nowrap", children: maxPeriodLabel })
16092
16197
  ] }),
16093
16198
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-1 sm:gap-1.5", children: [
16094
16199
  /* @__PURE__ */ jsxRuntime.jsx(
@@ -16098,7 +16203,7 @@ var HorizontalLegend = ({
16098
16203
  weight: "bold"
16099
16204
  }
16100
16205
  ),
16101
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-xs sm:text-sm tracking-[0] font-medium truncate max-w-[120px] sm:max-w-none", children: minPeriodLabel })
16206
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-xs sm:text-sm tracking-[0] font-medium whitespace-nowrap", children: minPeriodLabel })
16102
16207
  ] })
16103
16208
  ] })
16104
16209
  ] }) });
@@ -17042,9 +17147,9 @@ var Chart = ({
17042
17147
  isLoading = false,
17043
17148
  timeSeries,
17044
17149
  timeSeriesLegend,
17045
- customLegend,
17046
- horizontal = false,
17047
- orderBy
17150
+ customLegend
17151
+ // horizontal removido
17152
+ // orderBy removido
17048
17153
  }) => {
17049
17154
  const { xAxisConfig, mapperConfig } = React33.useMemo(() => {
17050
17155
  return fnSmartConfig({ xAxis, data, labelMap });
@@ -17080,12 +17185,6 @@ var Chart = ({
17080
17185
  defaultEndIndex: timeSeriesConfig?.end,
17081
17186
  onRangeChange: timeSeriesConfig?.onRangeChange
17082
17187
  });
17083
- const { maxPeriodLabel, minPeriodLabel } = useChartMinMax({
17084
- processedData: data,
17085
- orderBy,
17086
- xAxisDataKey: xAxisConfig.dataKey,
17087
- categoryFormatter
17088
- });
17089
17188
  const processedData = React33.useMemo(() => {
17090
17189
  const mapped = data.map((item) => ({
17091
17190
  ...item,
@@ -17095,23 +17194,8 @@ var Chart = ({
17095
17194
  if (timeSeriesConfig) {
17096
17195
  result = mapped.slice(startIndex, endIndex + 1);
17097
17196
  }
17098
- if (orderBy && horizontal) {
17099
- result = [...result].sort((a, b) => {
17100
- const valueA = Number(a[orderBy]) || 0;
17101
- const valueB = Number(b[orderBy]) || 0;
17102
- return valueB - valueA;
17103
- });
17104
- }
17105
17197
  return result;
17106
- }, [
17107
- data,
17108
- xAxisConfig.dataKey,
17109
- timeSeriesConfig,
17110
- startIndex,
17111
- endIndex,
17112
- orderBy,
17113
- horizontal
17114
- ]);
17198
+ }, [data, xAxisConfig.dataKey, timeSeriesConfig, startIndex, endIndex]);
17115
17199
  const seriesOrder = filtersOrder(mapperConfig, series);
17116
17200
  const allKeys = seriesOrder.map((s) => s.key).filter(Boolean);
17117
17201
  const finalColors = React33.useMemo(
@@ -17206,23 +17290,22 @@ var Chart = ({
17206
17290
  const CONTAINER_PADDING_LEFT = -6;
17207
17291
  const finalChartRightMargin = chartMargin?.right ?? (rightKeys.length > 0 ? AXIS_LABEL_MARGIN : 30);
17208
17292
  const finalChartLeftMargin = chartMargin?.left ?? (yAxisLabel ? AXIS_LABEL_MARGIN : 0);
17209
- const yAxisTickWidth = React33.useMemo(
17210
- () => computeYAxisTickWidth(
17293
+ const yAxisTickWidth = React33.useMemo(() => {
17294
+ return computeYAxisTickWidth(
17211
17295
  chartMargin?.left,
17212
17296
  yAxisLabel,
17213
17297
  AXIS_LABEL_MARGIN,
17214
17298
  yTickFormatter,
17215
17299
  minLeftDataValue,
17216
17300
  niceMaxLeft
17217
- ),
17218
- [
17219
- chartMargin?.left,
17220
- yAxisLabel,
17221
- yTickFormatter,
17222
- minLeftDataValue,
17223
- niceMaxLeft
17224
- ]
17225
- );
17301
+ );
17302
+ }, [
17303
+ chartMargin?.left,
17304
+ yAxisLabel,
17305
+ yTickFormatter,
17306
+ minLeftDataValue,
17307
+ niceMaxLeft
17308
+ ]);
17226
17309
  const HORIZONTAL_PADDING_CLASS = "px-24";
17227
17310
  const teste = "pl-24 pr-4";
17228
17311
  const effectiveChartWidth = typeof width === "number" ? width : measuredWidth ? Math.max(0, measuredWidth - 32) : computedWidth;
@@ -17264,16 +17347,45 @@ var Chart = ({
17264
17347
  );
17265
17348
  }
17266
17349
  if (Array.isArray(data) && data.length === 0) {
17267
- return /* @__PURE__ */ jsxRuntime.jsx(
17268
- NoData_default,
17269
- {
17270
- title,
17271
- paddingLeft: CONTAINER_PADDING_LEFT + finalChartLeftMargin,
17272
- height
17273
- }
17274
- );
17350
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
17351
+ /* @__PURE__ */ jsxRuntime.jsx(
17352
+ NoData_default,
17353
+ {
17354
+ title,
17355
+ paddingLeft: CONTAINER_PADDING_LEFT + finalChartLeftMargin,
17356
+ height
17357
+ }
17358
+ ),
17359
+ /* @__PURE__ */ jsxRuntime.jsx("div", { style: { height: 0 }, children: /* @__PURE__ */ jsxRuntime.jsxs("svg", { width: effectiveChartWidth, height, children: [
17360
+ xAxisLabel && /* @__PURE__ */ jsxRuntime.jsx(
17361
+ "text",
17362
+ {
17363
+ x: effectiveChartWidth - 40,
17364
+ y: height - 10,
17365
+ fontSize: 12,
17366
+ fill: "hsl(var(--muted-foreground))",
17367
+ fontWeight: 500,
17368
+ textAnchor: "end",
17369
+ children: xAxisLabel
17370
+ }
17371
+ ),
17372
+ yAxisLabel && /* @__PURE__ */ jsxRuntime.jsx(
17373
+ "text",
17374
+ {
17375
+ x: 20,
17376
+ y: 40,
17377
+ fontSize: 12,
17378
+ fill: "hsl(var(--muted-foreground))",
17379
+ fontWeight: 500,
17380
+ textAnchor: "start",
17381
+ transform: `rotate(-90 20 40)`,
17382
+ children: yAxisLabel
17383
+ }
17384
+ )
17385
+ ] }) })
17386
+ ] });
17275
17387
  }
17276
- return /* @__PURE__ */ jsxRuntime.jsx(
17388
+ return /* @__PURE__ */ jsxRuntime.jsxs(
17277
17389
  "div",
17278
17390
  {
17279
17391
  ref: wrapperRef,
@@ -17281,512 +17393,400 @@ var Chart = ({
17281
17393
  "w-full overflow-hidden min-w-0 rounded-lg border-border",
17282
17394
  className
17283
17395
  ),
17284
- children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-lg bg-card relative w-full max-w-full min-w-0 py-1", children: [
17285
- title && /* @__PURE__ */ jsxRuntime.jsx(
17286
- "div",
17287
- {
17288
- className: cn(
17289
- "w-full flex items-center mt-3 mb-2",
17290
- HORIZONTAL_PADDING_CLASS,
17291
- titlePosition === "center" && "justify-center",
17292
- titlePosition === "right" && "justify-end",
17293
- titlePosition === "left" && "justify-start"
17294
- ),
17295
- children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-[1.4rem] font-semibold text-foreground", children: title })
17296
- }
17297
- ),
17298
- customLegend && !!data.length && /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("px-6 mb-2", HORIZONTAL_PADDING_CLASS), children: /* @__PURE__ */ jsxRuntime.jsx(
17299
- ChartTotalLegend_default,
17300
- {
17301
- items: allKeys.map((key) => {
17302
- const values = processedData.map(
17303
- (d) => Number(d[key] || 0)
17304
- );
17305
- const total = values.reduce((a, b) => a + b, 0);
17306
- const first = values[0] || 0;
17307
- const last = values[values.length - 1] || 0;
17308
- const trendValue = first !== 0 ? Math.round((last - first) / first * 100) : 0;
17309
- const formattedTotal = finalValueFormatter ? finalValueFormatter({
17310
- value: total,
17311
- formattedValue: String(total)
17312
- }) : new Intl.NumberFormat(formatBR ? "pt-BR" : "en-US").format(
17313
- total
17314
- );
17315
- return {
17316
- label: mapperConfig[key]?.label || key,
17317
- value: formattedTotal,
17318
- color: finalColors[key],
17319
- trend: {
17320
- value: Math.abs(trendValue),
17321
- positive: trendValue >= 0,
17322
- neutral: trendValue === 0
17323
- }
17324
- };
17325
- })
17326
- }
17327
- ) }),
17328
- allKeys.length > 0 && (enableHighlights || enableShowOnly) && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn("flex items-center gap-2", teste), children: [
17329
- enableHighlights && /* @__PURE__ */ jsxRuntime.jsx(
17330
- Highlights_default,
17331
- {
17332
- allKeys,
17333
- mapperConfig,
17334
- finalColors,
17335
- highlightedSeries,
17336
- toggleHighlight,
17337
- containerWidth: chartInnerWidth
17338
- }
17339
- ),
17340
- enableShowOnly && /* @__PURE__ */ jsxRuntime.jsx(
17341
- ShowOnly_default,
17396
+ children: [
17397
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-lg bg-card relative w-full max-w-full min-w-0 py-1", children: [
17398
+ title && /* @__PURE__ */ jsxRuntime.jsx(
17399
+ "div",
17342
17400
  {
17343
- showOnlyHighlighted,
17344
- setShowOnlyHighlighted,
17345
- highlightedSeriesSize: highlightedSeries.size,
17346
- clearHighlights
17401
+ className: cn(
17402
+ "w-full flex items-center mt-3 mb-2",
17403
+ HORIZONTAL_PADDING_CLASS,
17404
+ titlePosition === "center" && "justify-center",
17405
+ titlePosition === "right" && "justify-end",
17406
+ titlePosition === "left" && "justify-start"
17407
+ ),
17408
+ children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-[1.4rem] font-semibold text-foreground", children: title })
17347
17409
  }
17348
17410
  ),
17349
- enablePeriodsDropdown && enableDraggableTooltips && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "ml-auto flex items-center", children: /* @__PURE__ */ jsxRuntime.jsx(
17350
- PeriodsDropdown_default,
17411
+ customLegend && !!data.length && /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("px-6 mb-2", HORIZONTAL_PADDING_CLASS), children: /* @__PURE__ */ jsxRuntime.jsx(
17412
+ ChartTotalLegend_default,
17351
17413
  {
17352
- processedData,
17353
- onOpenPeriod: openTooltipForPeriod,
17354
- rightOffset: finalChartRightMargin,
17355
- activePeriods
17414
+ items: allKeys.map((key) => {
17415
+ const values = processedData.map(
17416
+ (d) => Number(d[key] || 0)
17417
+ );
17418
+ const total = values.reduce((a, b) => a + b, 0);
17419
+ const first = values[0] || 0;
17420
+ const last = values[values.length - 1] || 0;
17421
+ const trendValue = first !== 0 ? Math.round((last - first) / first * 100) : 0;
17422
+ const formattedTotal = finalValueFormatter ? finalValueFormatter({
17423
+ value: total,
17424
+ formattedValue: String(total)
17425
+ }) : new Intl.NumberFormat(formatBR ? "pt-BR" : "en-US").format(
17426
+ total
17427
+ );
17428
+ return {
17429
+ label: mapperConfig[key]?.label || key,
17430
+ value: formattedTotal,
17431
+ color: finalColors[key],
17432
+ trend: {
17433
+ value: Math.abs(trendValue),
17434
+ positive: trendValue >= 0,
17435
+ neutral: trendValue === 0
17436
+ }
17437
+ };
17438
+ })
17356
17439
  }
17357
- ) })
17358
- ] }),
17359
- !(allKeys.length > 0 && (enableHighlights || enableShowOnly)) && enablePeriodsDropdown && enableDraggableTooltips && /* @__PURE__ */ jsxRuntime.jsx(
17360
- "div",
17361
- {
17362
- className: cn(
17363
- "w-full flex justify-end mb-2",
17364
- HORIZONTAL_PADDING_CLASS
17440
+ ) }),
17441
+ allKeys.length > 0 && (enableHighlights || enableShowOnly) && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn("flex items-center gap-2", teste), children: [
17442
+ enableHighlights && /* @__PURE__ */ jsxRuntime.jsx(
17443
+ Highlights_default,
17444
+ {
17445
+ allKeys,
17446
+ mapperConfig,
17447
+ finalColors,
17448
+ highlightedSeries,
17449
+ toggleHighlight,
17450
+ containerWidth: chartInnerWidth
17451
+ }
17365
17452
  ),
17366
- style: {
17367
- paddingRight: `${finalChartRightMargin}px`,
17368
- maxWidth: `${chartInnerWidth}px`
17369
- },
17370
- children: /* @__PURE__ */ jsxRuntime.jsx(
17453
+ enableShowOnly && /* @__PURE__ */ jsxRuntime.jsx(
17454
+ ShowOnly_default,
17455
+ {
17456
+ showOnlyHighlighted,
17457
+ setShowOnlyHighlighted,
17458
+ highlightedSeriesSize: highlightedSeries.size,
17459
+ clearHighlights
17460
+ }
17461
+ ),
17462
+ enablePeriodsDropdown && enableDraggableTooltips && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "ml-auto flex items-center", children: /* @__PURE__ */ jsxRuntime.jsx(
17371
17463
  PeriodsDropdown_default,
17372
17464
  {
17373
17465
  processedData,
17374
17466
  onOpenPeriod: openTooltipForPeriod,
17375
- rightOffset: finalChartRightMargin
17467
+ rightOffset: finalChartRightMargin,
17468
+ activePeriods
17376
17469
  }
17377
- )
17378
- }
17379
- ),
17380
- showLegend && horizontal && /* @__PURE__ */ jsxRuntime.jsx(
17381
- HorizontalLegend_default,
17382
- {
17383
- allKeys,
17384
- mapperConfig,
17385
- finalColors,
17386
- labelMap,
17387
- legendUppercase,
17388
- orderBy,
17389
- maxPeriodLabel,
17390
- minPeriodLabel,
17391
- className: cn(HORIZONTAL_PADDING_CLASS)
17392
- }
17393
- ),
17394
- /* @__PURE__ */ jsxRuntime.jsx(
17395
- "div",
17396
- {
17397
- className: cn(
17398
- horizontal && "overflow-y-auto overflow-x-hidden px-6",
17399
- horizontal && "scrollbar-thin scrollbar-thumb-muted scrollbar-track-transparent"
17400
- ),
17401
- style: {
17402
- maxHeight: horizontal ? height : void 0
17403
- },
17404
- children: /* @__PURE__ */ jsxRuntime.jsx(
17405
- recharts.ResponsiveContainer,
17406
- {
17407
- width: "100%",
17408
- height: horizontal ? Math.max(height, processedData.length * 50) : height,
17409
- children: /* @__PURE__ */ jsxRuntime.jsxs(
17410
- recharts.ComposedChart,
17470
+ ) })
17471
+ ] }),
17472
+ !(allKeys.length > 0 && (enableHighlights || enableShowOnly)) && enablePeriodsDropdown && enableDraggableTooltips && /* @__PURE__ */ jsxRuntime.jsx(
17473
+ "div",
17474
+ {
17475
+ className: cn(
17476
+ "w-full flex justify-end mb-2",
17477
+ HORIZONTAL_PADDING_CLASS
17478
+ ),
17479
+ style: {
17480
+ paddingRight: `${finalChartRightMargin}px`,
17481
+ maxWidth: `${chartInnerWidth}px`
17482
+ },
17483
+ children: /* @__PURE__ */ jsxRuntime.jsx(
17484
+ PeriodsDropdown_default,
17485
+ {
17486
+ processedData,
17487
+ onOpenPeriod: openTooltipForPeriod,
17488
+ rightOffset: finalChartRightMargin
17489
+ }
17490
+ )
17491
+ }
17492
+ ),
17493
+ /* @__PURE__ */ jsxRuntime.jsx(recharts.ResponsiveContainer, { width: "100%", height, children: /* @__PURE__ */ jsxRuntime.jsxs(
17494
+ recharts.ComposedChart,
17495
+ {
17496
+ data: processedData,
17497
+ height,
17498
+ margin: {
17499
+ top: 10,
17500
+ right: finalChartRightMargin,
17501
+ left: finalChartLeftMargin,
17502
+ bottom: 10
17503
+ },
17504
+ onClick: handleChartClick,
17505
+ children: [
17506
+ /* @__PURE__ */ jsxRuntime.jsx("defs", { children: seriesOrder.filter((s) => s.type === "area").map((s) => {
17507
+ const key = s.key;
17508
+ const color = finalColors[key];
17509
+ return /* @__PURE__ */ jsxRuntime.jsxs(
17510
+ "linearGradient",
17511
+ {
17512
+ id: `gradient-${key}`,
17513
+ x1: "0",
17514
+ y1: "0",
17515
+ x2: "0",
17516
+ y2: "0.8",
17517
+ children: [
17518
+ /* @__PURE__ */ jsxRuntime.jsx("stop", { offset: "0%", stopColor: color, stopOpacity: 0.8 }),
17519
+ /* @__PURE__ */ jsxRuntime.jsx("stop", { offset: "90%", stopColor: color, stopOpacity: 0.1 })
17520
+ ]
17521
+ },
17522
+ `gradient-${key}`
17523
+ );
17524
+ }) }),
17525
+ showGrid && /* @__PURE__ */ jsxRuntime.jsx(
17526
+ recharts.CartesianGrid,
17527
+ {
17528
+ strokeDasharray: "3 3",
17529
+ stroke: gridColor || "hsl(var(--muted-foreground))",
17530
+ opacity: 0.5
17531
+ }
17532
+ ),
17533
+ /* @__PURE__ */ jsxRuntime.jsx(
17534
+ recharts.XAxis,
17411
17535
  {
17412
- data: processedData,
17413
- height: horizontal ? Math.max(height, processedData.length * 50) : height,
17414
- layout: horizontal ? "vertical" : "horizontal",
17415
- margin: {
17416
- top: 10,
17417
- right: finalChartRightMargin,
17418
- left: finalChartLeftMargin,
17419
- bottom: 10
17536
+ dataKey: xAxisConfig.dataKey,
17537
+ stroke: "hsl(var(--muted-foreground))",
17538
+ fontSize: 12,
17539
+ tickLine: false,
17540
+ axisLine: false,
17541
+ tickFormatter: (value) => {
17542
+ if (categoryFormatter)
17543
+ return categoryFormatter(value);
17544
+ if (xAxisConfig.valueFormatter)
17545
+ return xAxisConfig.valueFormatter(value);
17546
+ return String(value ?? "");
17420
17547
  },
17421
- onClick: handleChartClick,
17422
- children: [
17423
- /* @__PURE__ */ jsxRuntime.jsx("defs", { children: seriesOrder.filter((s) => s.type === "area").map((s) => {
17424
- const key = s.key;
17425
- const color = finalColors[key];
17426
- return /* @__PURE__ */ jsxRuntime.jsxs(
17427
- "linearGradient",
17428
- {
17429
- id: `gradient-${key}`,
17430
- x1: "0",
17431
- y1: "0",
17432
- x2: "0",
17433
- y2: "0.8",
17434
- children: [
17435
- /* @__PURE__ */ jsxRuntime.jsx("stop", { offset: "0%", stopColor: color, stopOpacity: 0.8 }),
17436
- /* @__PURE__ */ jsxRuntime.jsx(
17437
- "stop",
17438
- {
17439
- offset: "90%",
17440
- stopColor: color,
17441
- stopOpacity: 0.1
17442
- }
17443
- )
17444
- ]
17445
- },
17446
- `gradient-${key}`
17447
- );
17448
- }) }),
17449
- showGrid && /* @__PURE__ */ jsxRuntime.jsx(
17450
- recharts.CartesianGrid,
17451
- {
17452
- strokeDasharray: "3 3",
17453
- stroke: gridColor || "hsl(var(--muted-foreground))",
17454
- opacity: 0.5
17548
+ label: xAxisLabel ? {
17549
+ value: xAxisLabel,
17550
+ position: "insideBottomRight",
17551
+ offset: -5,
17552
+ style: {
17553
+ fontSize: 12,
17554
+ fill: "hsl(var(--muted-foreground))",
17555
+ fontWeight: 500
17556
+ }
17557
+ } : void 0
17558
+ }
17559
+ ),
17560
+ /* @__PURE__ */ jsxRuntime.jsx(
17561
+ recharts.YAxis,
17562
+ {
17563
+ yAxisId: "left",
17564
+ width: yAxisTickWidth,
17565
+ stroke: "hsl(var(--muted-foreground))",
17566
+ fontSize: 12,
17567
+ tickLine: false,
17568
+ axisLine: false,
17569
+ tickFormatter: yTickFormatter,
17570
+ domain: [Math.min(minLeftDataValue, 0), niceMaxLeft],
17571
+ tickCount: 6,
17572
+ label: yAxisLabel ? {
17573
+ value: yAxisLabel,
17574
+ angle: -90,
17575
+ position: "left",
17576
+ dx: leftYAxisLabelDx,
17577
+ style: {
17578
+ fontSize: 12,
17579
+ fill: "hsl(var(--muted-foreground))",
17580
+ fontWeight: 500,
17581
+ textAnchor: "middle"
17582
+ }
17583
+ } : void 0
17584
+ }
17585
+ ),
17586
+ rightKeys.length > 0 && (() => {
17587
+ const { rightAxisColor, rightTickFormatter } = fnConfigRightKeys(
17588
+ biaxialConfigNormalized,
17589
+ yTickFormatter,
17590
+ finalColors
17591
+ );
17592
+ return /* @__PURE__ */ jsxRuntime.jsx(
17593
+ recharts.YAxis,
17594
+ {
17595
+ yAxisId: "right",
17596
+ width: finalChartRightMargin,
17597
+ orientation: "right",
17598
+ stroke: "hsl(var(--muted-foreground))",
17599
+ fontSize: 12,
17600
+ tickLine: false,
17601
+ axisLine: false,
17602
+ tick: { fill: rightAxisColor },
17603
+ tickFormatter: rightTickFormatter,
17604
+ domain: [Math.min(minRightDataValue, 0), niceMaxRight],
17605
+ tickCount: 6,
17606
+ label: biaxialConfigNormalized?.label ? {
17607
+ value: biaxialConfigNormalized.label,
17608
+ angle: -90,
17609
+ position: "right",
17610
+ dx: rightYAxisLabelDx,
17611
+ style: {
17612
+ fontSize: 12,
17613
+ fill: "hsl(var(--muted-foreground))",
17614
+ fontWeight: 500,
17615
+ textAnchor: "middle"
17455
17616
  }
17456
- ),
17457
- horizontal ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
17458
- /* @__PURE__ */ jsxRuntime.jsx(
17459
- recharts.XAxis,
17617
+ } : void 0
17618
+ }
17619
+ );
17620
+ })(),
17621
+ showTooltip && /* @__PURE__ */ jsxRuntime.jsx(
17622
+ recharts.Tooltip,
17623
+ {
17624
+ content: showTooltipTotal ? /* @__PURE__ */ jsxRuntime.jsx(
17625
+ TooltipWithTotal_default,
17626
+ {
17627
+ finalColors,
17628
+ valueFormatter: finalValueFormatter,
17629
+ categoryFormatter,
17630
+ periodLabel
17631
+ }
17632
+ ) : /* @__PURE__ */ jsxRuntime.jsx(
17633
+ TooltipSimple_default,
17634
+ {
17635
+ finalColors,
17636
+ valueFormatter: finalValueFormatter,
17637
+ categoryFormatter,
17638
+ periodLabel
17639
+ }
17640
+ ),
17641
+ cursor: { fill: "hsl(var(--muted))", opacity: 0.1 }
17642
+ }
17643
+ ),
17644
+ showLegend && /* @__PURE__ */ jsxRuntime.jsx(
17645
+ recharts.Legend,
17646
+ {
17647
+ iconSize: 12,
17648
+ formatter: (value) => {
17649
+ return /* @__PURE__ */ jsxRuntime.jsx("span", { className: "tracking-[0] rounded-sm", children: fnFormatterValueLegend(
17650
+ value,
17651
+ mapperConfig,
17652
+ labelMap,
17653
+ legendUppercase
17654
+ ) });
17655
+ }
17656
+ }
17657
+ ),
17658
+ seriesOrder.map((s) => {
17659
+ if (showOnlyHighlighted && !highlightedSeries.has(s.key))
17660
+ return null;
17661
+ const { label, color, key } = fnBuildConfigData(
17662
+ s,
17663
+ mapperConfig,
17664
+ labelMap,
17665
+ finalColors,
17666
+ rightKeys,
17667
+ biaxialConfigNormalized
17668
+ );
17669
+ if (s.type === "bar") {
17670
+ return /* @__PURE__ */ jsxRuntime.jsx(
17671
+ recharts.Bar,
17672
+ {
17673
+ dataKey: key,
17674
+ yAxisId: rightKeys.includes(key) ? "right" : "left",
17675
+ name: label,
17676
+ fill: color,
17677
+ radius: [4, 4, 0, 0],
17678
+ onClick: handleBarClick,
17679
+ className: "cursor-pointer",
17680
+ style: { opacity: getSeriesOpacity(key) },
17681
+ activeBar: /* @__PURE__ */ jsxRuntime.jsx(
17682
+ recharts.Rectangle,
17460
17683
  {
17461
- type: "number",
17462
- orientation: "top",
17463
- stroke: "hsl(var(--muted-foreground))",
17464
- fontSize: 12,
17465
- tickLine: false,
17466
- axisLine: false,
17467
- tickFormatter: yTickFormatter,
17468
- domain: [Math.min(minLeftDataValue, 0), niceMaxLeft],
17469
- tickCount: 6,
17470
- label: yAxisLabel ? {
17471
- value: yAxisLabel,
17472
- position: "insideTopRight",
17473
- offset: -5,
17474
- style: {
17475
- fontSize: 12,
17476
- fill: "hsl(var(--muted-foreground))",
17477
- fontWeight: 500
17478
- }
17479
- } : void 0
17684
+ fill: color,
17685
+ stroke: color,
17686
+ strokeWidth: 2,
17687
+ opacity: 0.8
17480
17688
  }
17481
17689
  ),
17482
- /* @__PURE__ */ jsxRuntime.jsx(
17483
- recharts.YAxis,
17690
+ children: showLabels && labelsVisibility.bar !== false && highlightedSeries.size === 0 || highlightedSeries.has(key) ? /* @__PURE__ */ jsxRuntime.jsx(
17691
+ recharts.LabelList,
17484
17692
  {
17485
- type: "category",
17486
- dataKey: xAxisConfig.dataKey,
17487
- yAxisId: "left",
17488
- width: yAxisTickWidth,
17489
- stroke: "hsl(var(--muted-foreground))",
17490
- fontSize: 12,
17491
- tickLine: false,
17492
- axisLine: false,
17493
- tickFormatter: (value) => {
17494
- if (categoryFormatter)
17495
- return categoryFormatter(value);
17496
- if (xAxisConfig.valueFormatter)
17497
- return xAxisConfig.valueFormatter(
17498
- value
17499
- );
17500
- return String(value ?? "");
17501
- },
17502
- label: xAxisLabel ? {
17503
- value: xAxisLabel,
17504
- angle: -90,
17505
- position: "insideTop",
17506
- dx: leftYAxisLabelDx,
17507
- style: {
17508
- fontSize: 12,
17509
- fill: "hsl(var(--muted-foreground))",
17510
- fontWeight: 500,
17511
- textAnchor: "middle"
17512
- }
17513
- } : void 0
17514
- }
17515
- )
17516
- ] }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
17517
- /* @__PURE__ */ jsxRuntime.jsx(
17518
- recharts.XAxis,
17519
- {
17520
- dataKey: xAxisConfig.dataKey,
17521
- stroke: "hsl(var(--muted-foreground))",
17522
- fontSize: 12,
17523
- tickLine: false,
17524
- axisLine: false,
17525
- tickFormatter: (value) => {
17526
- if (categoryFormatter)
17527
- return categoryFormatter(value);
17528
- if (xAxisConfig.valueFormatter)
17529
- return xAxisConfig.valueFormatter(
17530
- value
17531
- );
17532
- return String(value ?? "");
17693
+ dataKey: key,
17694
+ content: (props) => {
17695
+ if (!fnContentLabelList(props)) return null;
17696
+ const inside = renderInsideBarLabel(
17697
+ color,
17698
+ finalValueFormatter
17699
+ );
17700
+ return inside(props);
17533
17701
  },
17534
- label: xAxisLabel ? {
17535
- value: xAxisLabel,
17536
- position: "insideBottomRight",
17537
- offset: -5,
17538
- style: {
17539
- fontSize: 12,
17540
- fill: "hsl(var(--muted-foreground))",
17541
- fontWeight: 500
17542
- }
17543
- } : void 0
17702
+ offset: 0
17544
17703
  }
17545
- ),
17546
- /* @__PURE__ */ jsxRuntime.jsx(
17547
- recharts.YAxis,
17704
+ ) : null
17705
+ },
17706
+ `bar-${key}`
17707
+ );
17708
+ }
17709
+ if (s.type === "line") {
17710
+ const lineFormatter = (props) => {
17711
+ const numValue = typeof props.value === "number" ? props.value : typeof props.value === "string" ? parseFloat(props.value) : 0;
17712
+ const percentage = calcDivision(numValue, 100);
17713
+ const formattedPercentage = typeof percentage === "number" ? percentage.toFixed(1).replace(".", ",") : String(percentage).replace(".", ",");
17714
+ return `${formattedPercentage}%`;
17715
+ };
17716
+ return /* @__PURE__ */ jsxRuntime.jsx(
17717
+ recharts.Line,
17718
+ {
17719
+ dataKey: key,
17720
+ yAxisId: rightKeys.includes(key) ? "right" : "left",
17721
+ name: label,
17722
+ stroke: color,
17723
+ strokeWidth: 2,
17724
+ dot: { r: 3 },
17725
+ activeDot: { r: 6 },
17726
+ onClick: handleSeriesClick,
17727
+ className: "cursor-pointer pointer-events-auto",
17728
+ style: { opacity: getSeriesOpacity(key) },
17729
+ children: showLabels && labelsVisibility.line !== false && highlightedSeries.size === 0 || highlightedSeries.has(key) ? /* @__PURE__ */ jsxRuntime.jsx(
17730
+ recharts.LabelList,
17548
17731
  {
17549
- yAxisId: "left",
17550
- width: yAxisTickWidth,
17551
- stroke: "hsl(var(--muted-foreground))",
17552
- fontSize: 12,
17553
- tickLine: false,
17554
- axisLine: false,
17555
- tickFormatter: yTickFormatter,
17556
- domain: [Math.min(minLeftDataValue, 0), niceMaxLeft],
17557
- tickCount: 6,
17558
- label: yAxisLabel ? {
17559
- value: yAxisLabel,
17560
- angle: -90,
17561
- position: "left",
17562
- dx: leftYAxisLabelDx,
17563
- style: {
17564
- fontSize: 12,
17565
- fill: "hsl(var(--muted-foreground))",
17566
- fontWeight: 500,
17567
- textAnchor: "middle"
17568
- }
17569
- } : void 0
17732
+ dataKey: key,
17733
+ position: "top",
17734
+ content: pillLabelRenderer_default(
17735
+ color,
17736
+ "filled",
17737
+ lineFormatter
17738
+ ),
17739
+ offset: 14
17570
17740
  }
17571
- )
17572
- ] }),
17573
- minLeftDataValue < 0 && /* @__PURE__ */ jsxRuntime.jsx(
17574
- recharts.ReferenceLine,
17575
- {
17576
- y: 0,
17577
- yAxisId: "left",
17578
- stroke: "hsl(var(--muted-foreground))",
17579
- strokeWidth: 1,
17580
- strokeDasharray: "4 4"
17581
- }
17582
- ),
17583
- rightKeys.length > 0 && (() => {
17584
- const { rightAxisColor, rightTickFormatter } = fnConfigRightKeys(
17585
- biaxialConfigNormalized,
17586
- yTickFormatter,
17587
- finalColors
17588
- );
17589
- return /* @__PURE__ */ jsxRuntime.jsx(
17590
- recharts.YAxis,
17741
+ ) : null
17742
+ },
17743
+ `line-${key}`
17744
+ );
17745
+ }
17746
+ if (s.type === "area") {
17747
+ return /* @__PURE__ */ jsxRuntime.jsx(
17748
+ recharts.Area,
17749
+ {
17750
+ type: "monotone",
17751
+ dataKey: key,
17752
+ yAxisId: rightKeys.includes(key) ? "right" : "left",
17753
+ name: label,
17754
+ stroke: color,
17755
+ fill: `url(#gradient-${key})`,
17756
+ fillOpacity: 1,
17757
+ strokeWidth: 2,
17758
+ onClick: handleSeriesClick,
17759
+ className: "cursor-pointer pointer-events-auto",
17760
+ style: { opacity: getSeriesOpacity(key) },
17761
+ activeDot: {
17762
+ r: 6,
17763
+ fill: color,
17764
+ stroke: "hsl(var(--background))",
17765
+ strokeWidth: 2
17766
+ },
17767
+ children: showLabels && labelsVisibility.area !== false && highlightedSeries.size === 0 || highlightedSeries.has(key) ? /* @__PURE__ */ jsxRuntime.jsx(
17768
+ recharts.LabelList,
17591
17769
  {
17592
- yAxisId: "right",
17593
- width: finalChartRightMargin,
17594
- orientation: "right",
17595
- stroke: "hsl(var(--muted-foreground))",
17596
- fontSize: 12,
17597
- tickLine: false,
17598
- axisLine: false,
17599
- tick: { fill: rightAxisColor },
17600
- tickFormatter: rightTickFormatter,
17601
- domain: [Math.min(minRightDataValue, 0), niceMaxRight],
17602
- tickCount: 6,
17603
- label: biaxialConfigNormalized?.label ? {
17604
- value: biaxialConfigNormalized.label,
17605
- angle: -90,
17606
- position: "right",
17607
- dx: rightYAxisLabelDx,
17608
- style: {
17609
- fontSize: 12,
17610
- fill: "hsl(var(--muted-foreground))",
17611
- fontWeight: 500,
17612
- textAnchor: "middle"
17613
- }
17614
- } : void 0
17615
- }
17616
- );
17617
- })(),
17618
- showTooltip && /* @__PURE__ */ jsxRuntime.jsx(
17619
- recharts.Tooltip,
17620
- {
17621
- content: showTooltipTotal ? /* @__PURE__ */ jsxRuntime.jsx(
17622
- TooltipWithTotal_default,
17623
- {
17624
- finalColors,
17625
- valueFormatter: finalValueFormatter,
17626
- categoryFormatter,
17627
- periodLabel
17628
- }
17629
- ) : /* @__PURE__ */ jsxRuntime.jsx(
17630
- TooltipSimple_default,
17631
- {
17632
- finalColors,
17633
- valueFormatter: finalValueFormatter,
17634
- categoryFormatter,
17635
- periodLabel
17636
- }
17637
- ),
17638
- cursor: { fill: "hsl(var(--muted))", opacity: 0.1 }
17639
- }
17640
- ),
17641
- showLegend && !horizontal && /* @__PURE__ */ jsxRuntime.jsx(
17642
- recharts.Legend,
17643
- {
17644
- iconSize: 12,
17645
- formatter: (value) => {
17646
- return /* @__PURE__ */ jsxRuntime.jsx("span", { className: "tracking-[0] rounded-sm", children: fnFormatterValueLegend(
17647
- value,
17648
- mapperConfig,
17649
- labelMap,
17650
- legendUppercase
17651
- ) });
17770
+ dataKey: key,
17771
+ position: "top",
17772
+ content: pillLabelRenderer_default(
17773
+ color,
17774
+ "soft",
17775
+ finalValueFormatter
17776
+ ),
17777
+ offset: 12
17652
17778
  }
17653
- }
17654
- ),
17655
- seriesOrder.map((s) => {
17656
- if (showOnlyHighlighted && !highlightedSeries.has(s.key))
17657
- return null;
17658
- const { label, color, key } = fnBuildConfigData(
17659
- s,
17660
- mapperConfig,
17661
- labelMap,
17662
- finalColors,
17663
- rightKeys,
17664
- biaxialConfigNormalized
17665
- );
17666
- if (s.type === "bar") {
17667
- return /* @__PURE__ */ jsxRuntime.jsx(
17668
- recharts.Bar,
17669
- {
17670
- dataKey: key,
17671
- yAxisId: rightKeys.includes(key) ? "right" : "left",
17672
- name: label,
17673
- fill: color,
17674
- radius: horizontal ? [0, 4, 4, 0] : [4, 4, 0, 0],
17675
- onClick: handleBarClick,
17676
- className: "cursor-pointer",
17677
- style: { opacity: getSeriesOpacity(key) },
17678
- activeBar: /* @__PURE__ */ jsxRuntime.jsx(
17679
- recharts.Rectangle,
17680
- {
17681
- fill: color,
17682
- stroke: color,
17683
- strokeWidth: 2,
17684
- opacity: 0.8
17685
- }
17686
- ),
17687
- children: showLabels && labelsVisibility.bar !== false && highlightedSeries.size === 0 || highlightedSeries.has(key) ? /* @__PURE__ */ jsxRuntime.jsx(
17688
- recharts.LabelList,
17689
- {
17690
- dataKey: key,
17691
- content: (props) => {
17692
- if (!fnContentLabelList(props)) return null;
17693
- const inside = renderInsideBarLabel(
17694
- color,
17695
- finalValueFormatter
17696
- );
17697
- return inside(props);
17698
- },
17699
- offset: 0
17700
- }
17701
- ) : null
17702
- },
17703
- `bar-${key}`
17704
- );
17705
- }
17706
- if (s.type === "line") {
17707
- const lineFormatter = (props) => {
17708
- const numValue = typeof props.value === "number" ? props.value : typeof props.value === "string" ? parseFloat(props.value) : 0;
17709
- const percentage = calcDivision(numValue, 100);
17710
- const formattedPercentage = typeof percentage === "number" ? percentage.toFixed(1).replace(".", ",") : String(percentage).replace(".", ",");
17711
- return `${formattedPercentage}%`;
17712
- };
17713
- return /* @__PURE__ */ jsxRuntime.jsx(
17714
- recharts.Line,
17715
- {
17716
- dataKey: key,
17717
- yAxisId: rightKeys.includes(key) ? "right" : "left",
17718
- name: label,
17719
- stroke: color,
17720
- strokeWidth: 2,
17721
- dot: { r: 3 },
17722
- activeDot: { r: 6 },
17723
- onClick: handleSeriesClick,
17724
- className: "cursor-pointer pointer-events-auto",
17725
- style: { opacity: getSeriesOpacity(key) },
17726
- children: showLabels && labelsVisibility.line !== false && highlightedSeries.size === 0 || highlightedSeries.has(key) ? /* @__PURE__ */ jsxRuntime.jsx(
17727
- recharts.LabelList,
17728
- {
17729
- dataKey: key,
17730
- position: "top",
17731
- content: pillLabelRenderer_default(
17732
- color,
17733
- "filled",
17734
- lineFormatter
17735
- ),
17736
- offset: 14
17737
- }
17738
- ) : null
17739
- },
17740
- `line-${key}`
17741
- );
17742
- }
17743
- if (s.type === "area") {
17744
- return /* @__PURE__ */ jsxRuntime.jsx(
17745
- recharts.Area,
17746
- {
17747
- type: "monotone",
17748
- dataKey: key,
17749
- yAxisId: rightKeys.includes(key) ? "right" : "left",
17750
- name: label,
17751
- stroke: color,
17752
- fill: `url(#gradient-${key})`,
17753
- fillOpacity: 1,
17754
- strokeWidth: 2,
17755
- onClick: handleSeriesClick,
17756
- className: "cursor-pointer pointer-events-auto",
17757
- style: { opacity: getSeriesOpacity(key) },
17758
- activeDot: {
17759
- r: 6,
17760
- fill: color,
17761
- stroke: "hsl(var(--background))",
17762
- strokeWidth: 2
17763
- },
17764
- children: showLabels && labelsVisibility.area !== false && highlightedSeries.size === 0 || highlightedSeries.has(key) ? /* @__PURE__ */ jsxRuntime.jsx(
17765
- recharts.LabelList,
17766
- {
17767
- dataKey: key,
17768
- position: "top",
17769
- content: pillLabelRenderer_default(
17770
- color,
17771
- "soft",
17772
- finalValueFormatter
17773
- ),
17774
- offset: 12
17775
- }
17776
- ) : null
17777
- },
17778
- `area-${key}`
17779
- );
17780
- }
17781
- return null;
17782
- })
17783
- ]
17779
+ ) : null
17780
+ },
17781
+ `area-${key}`
17782
+ );
17784
17783
  }
17785
- )
17786
- }
17787
- )
17788
- }
17789
- ),
17784
+ return null;
17785
+ })
17786
+ ]
17787
+ }
17788
+ ) })
17789
+ ] }),
17790
17790
  enableDraggableTooltips && activeTooltips.map((tooltip) => /* @__PURE__ */ jsxRuntime.jsx(
17791
17791
  DraggableTooltip_default,
17792
17792
  {
@@ -17844,7 +17844,7 @@ var Chart = ({
17844
17844
  }
17845
17845
  }
17846
17846
  )
17847
- ] })
17847
+ ]
17848
17848
  }
17849
17849
  );
17850
17850
  };