@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.mjs CHANGED
@@ -42,7 +42,7 @@ import ptBR3 from 'date-fns/locale/pt-BR';
42
42
  import { useSensors, useSensor, MouseSensor, TouchSensor, PointerSensor, DndContext, DragOverlay, useDroppable, useDraggable } from '@dnd-kit/core';
43
43
  import { CSS } from '@dnd-kit/utilities';
44
44
  import { RadioGroup, RadioGroupItem } from '@radix-ui/react-radio-group';
45
- import { ResponsiveContainer, ComposedChart, XAxis, YAxis, Bar, Line, Area, CartesianGrid, ReferenceLine, Tooltip, Legend, LabelList, Rectangle, PieChart, Pie, Cell } from 'recharts';
45
+ import { ResponsiveContainer, ComposedChart, XAxis, YAxis, Bar, Line, Area, CartesianGrid, Tooltip, Legend, LabelList, Rectangle, PieChart, Pie, Cell } from 'recharts';
46
46
 
47
47
  var __create = Object.create;
48
48
  var __defProp = Object.defineProperty;
@@ -15588,12 +15588,14 @@ var SystemTooltip = ({
15588
15588
  data,
15589
15589
  position,
15590
15590
  title = "Conex\xF5es",
15591
+ isLoading = false,
15591
15592
  onMouseDown,
15592
15593
  onClose,
15593
15594
  onPositionChange
15594
15595
  }) => {
15595
15596
  const [localPos, setLocalPos] = useState(position);
15596
15597
  const [dragging, setDragging] = useState(false);
15598
+ const [expandedId, setExpandedId] = useState(null);
15597
15599
  const offsetRef = useRef({ x: 0, y: 0 });
15598
15600
  const lastMouse = useRef({ x: 0, y: 0 });
15599
15601
  useEffect(() => setLocalPos(position), [position]);
@@ -15715,54 +15717,157 @@ var SystemTooltip = ({
15715
15717
  ]
15716
15718
  }
15717
15719
  ),
15718
- /* @__PURE__ */ jsxs("div", { className: "px-4 pt-4 pb-3", children: [
15720
+ /* @__PURE__ */ jsx("div", { className: "px-4 pt-4 pb-3", children: isLoading ? /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
15721
+ /* @__PURE__ */ jsx(SkeletonBase, { className: "h-6 w-3/4" }),
15722
+ /* @__PURE__ */ jsx(SkeletonBase, { className: "h-4 w-1/2" })
15723
+ ] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
15719
15724
  /* @__PURE__ */ jsx("h3", { className: "text-xl font-bold text-foreground tracking-tight truncate", children: data.name }),
15720
- /* @__PURE__ */ jsx("h3", { className: "text-sm font-bold text-muted-foreground tracking-tight truncate", children: data.description })
15721
- ] }),
15725
+ data.description && /* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground tracking-tight truncate", children: data.description })
15726
+ ] }) }),
15722
15727
  /* @__PURE__ */ 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: [
15723
15728
  /* @__PURE__ */ jsx(SeparatorBase, { className: "w-full" }),
15724
- entries.length > 0 && /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
15725
- /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 px-1", children: [
15726
- /* @__PURE__ */ jsx("div", { className: "w-1.5 h-1.5 rounded-full bg-emerald-500" }),
15727
- /* @__PURE__ */ jsx("span", { className: "text-[10px] font-bold text-muted-foreground uppercase", children: "Entradas" })
15729
+ isLoading ? /* @__PURE__ */ jsxs(Fragment, { children: [
15730
+ /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
15731
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 px-1", children: [
15732
+ /* @__PURE__ */ jsx(SkeletonBase, { className: "w-1.5 h-1.5 rounded-full" }),
15733
+ /* @__PURE__ */ jsx(SkeletonBase, { className: "h-3 w-16" })
15734
+ ] }),
15735
+ /* @__PURE__ */ jsx("div", { className: "space-y-1", children: [1, 2, 3].map((i) => /* @__PURE__ */ jsx(SkeletonBase, { className: "h-10 w-full rounded-lg" }, i)) })
15728
15736
  ] }),
15729
- /* @__PURE__ */ jsx("div", { className: "space-y-1", children: entries.map((conn) => /* @__PURE__ */ jsxs(
15730
- "div",
15731
- {
15732
- 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",
15733
- children: [
15734
- /* @__PURE__ */ jsx("div", { className: "flex items-center gap-2 overflow-hidden", children: /* @__PURE__ */ jsx("span", { className: "text-sm font-medium truncate", children: conn.name }) }),
15735
- " ",
15736
- /* @__PURE__ */ jsx(
15737
- ArrowRight,
15738
- {
15739
- size: 14,
15740
- className: "text-emerald-500 shrink-0 rotate-180"
15741
- }
15742
- )
15743
- ]
15744
- },
15745
- conn.id
15746
- )) })
15747
- ] }),
15748
- exits.length > 0 && /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
15749
- /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 px-1", children: [
15750
- /* @__PURE__ */ jsx("div", { className: "w-1.5 h-1.5 rounded-full bg-blue-500" }),
15751
- /* @__PURE__ */ jsx("span", { className: "text-[10px] font-bold text-muted-foreground uppercase", children: "Sa\xEDdas" })
15737
+ /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
15738
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 px-1", children: [
15739
+ /* @__PURE__ */ jsx(SkeletonBase, { className: "w-1.5 h-1.5 rounded-full" }),
15740
+ /* @__PURE__ */ jsx(SkeletonBase, { className: "h-3 w-16" })
15741
+ ] }),
15742
+ /* @__PURE__ */ jsx("div", { className: "space-y-1", children: [1, 2].map((i) => /* @__PURE__ */ jsx(SkeletonBase, { className: "h-10 w-full rounded-lg" }, i)) })
15743
+ ] })
15744
+ ] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
15745
+ entries.length > 0 && /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
15746
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 px-1", children: [
15747
+ /* @__PURE__ */ jsx("div", { className: "w-1.5 h-1.5 rounded-full bg-emerald-500" }),
15748
+ /* @__PURE__ */ jsx("span", { className: "text-[10px] font-bold text-muted-foreground uppercase", children: "Entradas" })
15749
+ ] }),
15750
+ /* @__PURE__ */ jsx("div", { className: "space-y-1", children: entries.map((conn) => /* @__PURE__ */ jsxs("div", { className: "space-y-1", children: [
15751
+ /* @__PURE__ */ jsxs(
15752
+ "div",
15753
+ {
15754
+ 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",
15755
+ onClick: () => setExpandedId(expandedId === conn.id ? null : conn.id),
15756
+ children: [
15757
+ /* @__PURE__ */ jsx("div", { className: "flex items-center gap-2 overflow-hidden", children: /* @__PURE__ */ jsx("span", { className: "text-sm font-medium truncate", children: conn.name }) }),
15758
+ /* @__PURE__ */ jsx(
15759
+ ArrowRight,
15760
+ {
15761
+ size: 14,
15762
+ className: "text-emerald-500 shrink-0 rotate-180"
15763
+ }
15764
+ )
15765
+ ]
15766
+ }
15767
+ ),
15768
+ expandedId === conn.id && conn.integration && /* @__PURE__ */ jsxs("div", { className: "ml-2 p-2 rounded-lg bg-muted/30 border border-border/20 text-xs space-y-1", children: [
15769
+ conn.integration.Nome && /* @__PURE__ */ jsxs("div", { children: [
15770
+ /* @__PURE__ */ jsx("span", { className: "font-semibold", children: "Nome:" }),
15771
+ " ",
15772
+ conn.integration.Nome
15773
+ ] }),
15774
+ (conn.integration.tipo || conn.integration.Tipo) && /* @__PURE__ */ jsxs("div", { children: [
15775
+ /* @__PURE__ */ jsx("span", { className: "font-semibold", children: "Tipo:" }),
15776
+ " ",
15777
+ conn.integration.tipo || conn.integration.Tipo
15778
+ ] }),
15779
+ conn.integration.Protocolos && /* @__PURE__ */ jsxs("div", { children: [
15780
+ /* @__PURE__ */ jsx("span", { className: "font-semibold", children: "Protocolos:" }),
15781
+ " ",
15782
+ conn.integration.Protocolos
15783
+ ] }),
15784
+ conn.integration.Ambiente && /* @__PURE__ */ jsxs("div", { children: [
15785
+ /* @__PURE__ */ jsx("span", { className: "font-semibold", children: "Ambiente:" }),
15786
+ " ",
15787
+ conn.integration.Ambiente
15788
+ ] }),
15789
+ conn.integration.Setor && /* @__PURE__ */ jsxs("div", { children: [
15790
+ /* @__PURE__ */ jsx("span", { className: "font-semibold", children: "Setor:" }),
15791
+ " ",
15792
+ conn.integration.Setor
15793
+ ] }),
15794
+ conn.integration.Contato && /* @__PURE__ */ jsxs("div", { children: [
15795
+ /* @__PURE__ */ jsx("span", { className: "font-semibold", children: "Contato:" }),
15796
+ " ",
15797
+ conn.integration.Contato
15798
+ ] }),
15799
+ conn.integration.Sustentacao && /* @__PURE__ */ jsxs("div", { children: [
15800
+ /* @__PURE__ */ jsx("span", { className: "font-semibold", children: "Sustenta\xE7\xE3o:" }),
15801
+ " ",
15802
+ conn.integration.Sustentacao
15803
+ ] })
15804
+ ] })
15805
+ ] }, conn.id)) })
15752
15806
  ] }),
15753
- /* @__PURE__ */ jsx("div", { className: "space-y-1", children: exits.map((conn) => /* @__PURE__ */ jsxs(
15754
- "div",
15755
- {
15756
- 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",
15757
- children: [
15758
- /* @__PURE__ */ jsx("div", { className: "flex items-center gap-2 overflow-hidden", children: /* @__PURE__ */ jsx("span", { className: "text-sm font-medium truncate", children: conn.name }) }),
15759
- /* @__PURE__ */ jsx(ArrowRight, { size: 14, className: "text-blue-500 shrink-0" })
15760
- ]
15761
- },
15762
- conn.id
15763
- )) })
15764
- ] }),
15765
- data.connections.length === 0 && /* @__PURE__ */ jsx("div", { className: "flex flex-col items-center justify-center p-6 text-center", children: /* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground", children: "Nenhuma conex\xE3o encontrada" }) })
15807
+ exits.length > 0 && /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
15808
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 px-1", children: [
15809
+ /* @__PURE__ */ jsx("div", { className: "w-1.5 h-1.5 rounded-full bg-blue-500" }),
15810
+ /* @__PURE__ */ jsx("span", { className: "text-[10px] font-bold text-muted-foreground uppercase", children: "Sa\xEDdas" })
15811
+ ] }),
15812
+ /* @__PURE__ */ jsx("div", { className: "space-y-1", children: exits.map((conn) => /* @__PURE__ */ jsxs("div", { className: "space-y-1", children: [
15813
+ /* @__PURE__ */ jsxs(
15814
+ "div",
15815
+ {
15816
+ 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",
15817
+ onClick: () => setExpandedId(expandedId === conn.id ? null : conn.id),
15818
+ children: [
15819
+ /* @__PURE__ */ jsx("div", { className: "flex items-center gap-2 overflow-hidden", children: /* @__PURE__ */ jsx("span", { className: "text-sm font-medium truncate", children: conn.name }) }),
15820
+ /* @__PURE__ */ jsx(
15821
+ ArrowRight,
15822
+ {
15823
+ size: 14,
15824
+ className: "text-blue-500 shrink-0"
15825
+ }
15826
+ )
15827
+ ]
15828
+ }
15829
+ ),
15830
+ expandedId === conn.id && conn.integration && /* @__PURE__ */ jsxs("div", { className: "ml-2 p-2 rounded-lg bg-muted/30 border border-border/20 text-xs space-y-1", children: [
15831
+ conn.integration.Nome && /* @__PURE__ */ jsxs("div", { children: [
15832
+ /* @__PURE__ */ jsx("span", { className: "font-semibold", children: "Nome:" }),
15833
+ " ",
15834
+ conn.integration.Nome
15835
+ ] }),
15836
+ (conn.integration.tipo || conn.integration.Tipo) && /* @__PURE__ */ jsxs("div", { children: [
15837
+ /* @__PURE__ */ jsx("span", { className: "font-semibold", children: "Tipo:" }),
15838
+ " ",
15839
+ conn.integration.tipo || conn.integration.Tipo
15840
+ ] }),
15841
+ conn.integration.Protocolos && /* @__PURE__ */ jsxs("div", { children: [
15842
+ /* @__PURE__ */ jsx("span", { className: "font-semibold", children: "Protocolos:" }),
15843
+ " ",
15844
+ conn.integration.Protocolos
15845
+ ] }),
15846
+ conn.integration.Ambiente && /* @__PURE__ */ jsxs("div", { children: [
15847
+ /* @__PURE__ */ jsx("span", { className: "font-semibold", children: "Ambiente:" }),
15848
+ " ",
15849
+ conn.integration.Ambiente
15850
+ ] }),
15851
+ conn.integration.Setor && /* @__PURE__ */ jsxs("div", { children: [
15852
+ /* @__PURE__ */ jsx("span", { className: "font-semibold", children: "Setor:" }),
15853
+ " ",
15854
+ conn.integration.Setor
15855
+ ] }),
15856
+ conn.integration.Contato && /* @__PURE__ */ jsxs("div", { children: [
15857
+ /* @__PURE__ */ jsx("span", { className: "font-semibold", children: "Contato:" }),
15858
+ " ",
15859
+ conn.integration.Contato
15860
+ ] }),
15861
+ conn.integration.Sustentacao && /* @__PURE__ */ jsxs("div", { children: [
15862
+ /* @__PURE__ */ jsx("span", { className: "font-semibold", children: "Sustenta\xE7\xE3o:" }),
15863
+ " ",
15864
+ conn.integration.Sustentacao
15865
+ ] })
15866
+ ] })
15867
+ ] }, conn.id)) })
15868
+ ] }),
15869
+ data.connections.length === 0 && !isLoading && /* @__PURE__ */ jsx("div", { className: "flex flex-col items-center justify-center p-6 text-center", children: /* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground", children: "Nenhuma conex\xE3o encontrada" }) })
15870
+ ] })
15766
15871
  ] })
15767
15872
  ]
15768
15873
  },
@@ -16022,10 +16127,10 @@ var HorizontalLegend = ({
16022
16127
  const label = mapperConfig[key]?.label ?? labelMap?.[key] ?? formatFieldName2(key);
16023
16128
  return legendUppercase ? label.toUpperCase() : label;
16024
16129
  };
16025
- return /* @__PURE__ */ jsx("div", { className: cn(className), children: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 sm:gap-3 md:gap-4 flex-wrap", children: [
16130
+ return /* @__PURE__ */ jsx("div", { className: cn(className), children: /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-center gap-2 sm:gap-3 md:gap-4 overflow-x-auto", children: [
16026
16131
  allKeys.map((key) => {
16027
16132
  const displayLabel = formatLegendLabel(key);
16028
- return /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1.5 sm:gap-2", children: [
16133
+ return /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1.5 sm:gap-2 flex-shrink-0", children: [
16029
16134
  /* @__PURE__ */ jsx(
16030
16135
  "div",
16031
16136
  {
@@ -16033,10 +16138,10 @@ var HorizontalLegend = ({
16033
16138
  style: { backgroundColor: finalColors[key] }
16034
16139
  }
16035
16140
  ),
16036
- /* @__PURE__ */ jsx("span", { className: "text-xs sm:text-sm tracking-[0] break-words", children: displayLabel })
16141
+ /* @__PURE__ */ jsx("span", { className: "text-xs sm:text-sm tracking-[0] whitespace-nowrap", children: displayLabel })
16037
16142
  ] }, key);
16038
16143
  }),
16039
- orderBy && maxPeriodLabel && minPeriodLabel && /* @__PURE__ */ 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: [
16144
+ orderBy && maxPeriodLabel && minPeriodLabel && /* @__PURE__ */ 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: [
16040
16145
  /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1 sm:gap-1.5", children: [
16041
16146
  /* @__PURE__ */ jsx(
16042
16147
  FunnelSimpleIcon,
@@ -16045,7 +16150,7 @@ var HorizontalLegend = ({
16045
16150
  weight: "bold"
16046
16151
  }
16047
16152
  ),
16048
- /* @__PURE__ */ jsx("span", { className: "text-xs sm:text-sm tracking-[0] font-medium truncate max-w-[120px] sm:max-w-none", children: maxPeriodLabel })
16153
+ /* @__PURE__ */ jsx("span", { className: "text-xs sm:text-sm tracking-[0] font-medium whitespace-nowrap", children: maxPeriodLabel })
16049
16154
  ] }),
16050
16155
  /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1 sm:gap-1.5", children: [
16051
16156
  /* @__PURE__ */ jsx(
@@ -16055,7 +16160,7 @@ var HorizontalLegend = ({
16055
16160
  weight: "bold"
16056
16161
  }
16057
16162
  ),
16058
- /* @__PURE__ */ jsx("span", { className: "text-xs sm:text-sm tracking-[0] font-medium truncate max-w-[120px] sm:max-w-none", children: minPeriodLabel })
16163
+ /* @__PURE__ */ jsx("span", { className: "text-xs sm:text-sm tracking-[0] font-medium whitespace-nowrap", children: minPeriodLabel })
16059
16164
  ] })
16060
16165
  ] })
16061
16166
  ] }) });
@@ -16999,9 +17104,9 @@ var Chart = ({
16999
17104
  isLoading = false,
17000
17105
  timeSeries,
17001
17106
  timeSeriesLegend,
17002
- customLegend,
17003
- horizontal = false,
17004
- orderBy
17107
+ customLegend
17108
+ // horizontal removido
17109
+ // orderBy removido
17005
17110
  }) => {
17006
17111
  const { xAxisConfig, mapperConfig } = useMemo(() => {
17007
17112
  return fnSmartConfig({ xAxis, data, labelMap });
@@ -17037,12 +17142,6 @@ var Chart = ({
17037
17142
  defaultEndIndex: timeSeriesConfig?.end,
17038
17143
  onRangeChange: timeSeriesConfig?.onRangeChange
17039
17144
  });
17040
- const { maxPeriodLabel, minPeriodLabel } = useChartMinMax({
17041
- processedData: data,
17042
- orderBy,
17043
- xAxisDataKey: xAxisConfig.dataKey,
17044
- categoryFormatter
17045
- });
17046
17145
  const processedData = useMemo(() => {
17047
17146
  const mapped = data.map((item) => ({
17048
17147
  ...item,
@@ -17052,23 +17151,8 @@ var Chart = ({
17052
17151
  if (timeSeriesConfig) {
17053
17152
  result = mapped.slice(startIndex, endIndex + 1);
17054
17153
  }
17055
- if (orderBy && horizontal) {
17056
- result = [...result].sort((a, b) => {
17057
- const valueA = Number(a[orderBy]) || 0;
17058
- const valueB = Number(b[orderBy]) || 0;
17059
- return valueB - valueA;
17060
- });
17061
- }
17062
17154
  return result;
17063
- }, [
17064
- data,
17065
- xAxisConfig.dataKey,
17066
- timeSeriesConfig,
17067
- startIndex,
17068
- endIndex,
17069
- orderBy,
17070
- horizontal
17071
- ]);
17155
+ }, [data, xAxisConfig.dataKey, timeSeriesConfig, startIndex, endIndex]);
17072
17156
  const seriesOrder = filtersOrder(mapperConfig, series);
17073
17157
  const allKeys = seriesOrder.map((s) => s.key).filter(Boolean);
17074
17158
  const finalColors = useMemo(
@@ -17163,23 +17247,22 @@ var Chart = ({
17163
17247
  const CONTAINER_PADDING_LEFT = -6;
17164
17248
  const finalChartRightMargin = chartMargin?.right ?? (rightKeys.length > 0 ? AXIS_LABEL_MARGIN : 30);
17165
17249
  const finalChartLeftMargin = chartMargin?.left ?? (yAxisLabel ? AXIS_LABEL_MARGIN : 0);
17166
- const yAxisTickWidth = useMemo(
17167
- () => computeYAxisTickWidth(
17250
+ const yAxisTickWidth = useMemo(() => {
17251
+ return computeYAxisTickWidth(
17168
17252
  chartMargin?.left,
17169
17253
  yAxisLabel,
17170
17254
  AXIS_LABEL_MARGIN,
17171
17255
  yTickFormatter,
17172
17256
  minLeftDataValue,
17173
17257
  niceMaxLeft
17174
- ),
17175
- [
17176
- chartMargin?.left,
17177
- yAxisLabel,
17178
- yTickFormatter,
17179
- minLeftDataValue,
17180
- niceMaxLeft
17181
- ]
17182
- );
17258
+ );
17259
+ }, [
17260
+ chartMargin?.left,
17261
+ yAxisLabel,
17262
+ yTickFormatter,
17263
+ minLeftDataValue,
17264
+ niceMaxLeft
17265
+ ]);
17183
17266
  const HORIZONTAL_PADDING_CLASS = "px-24";
17184
17267
  const teste = "pl-24 pr-4";
17185
17268
  const effectiveChartWidth = typeof width === "number" ? width : measuredWidth ? Math.max(0, measuredWidth - 32) : computedWidth;
@@ -17221,16 +17304,45 @@ var Chart = ({
17221
17304
  );
17222
17305
  }
17223
17306
  if (Array.isArray(data) && data.length === 0) {
17224
- return /* @__PURE__ */ jsx(
17225
- NoData_default,
17226
- {
17227
- title,
17228
- paddingLeft: CONTAINER_PADDING_LEFT + finalChartLeftMargin,
17229
- height
17230
- }
17231
- );
17307
+ return /* @__PURE__ */ jsxs("div", { children: [
17308
+ /* @__PURE__ */ jsx(
17309
+ NoData_default,
17310
+ {
17311
+ title,
17312
+ paddingLeft: CONTAINER_PADDING_LEFT + finalChartLeftMargin,
17313
+ height
17314
+ }
17315
+ ),
17316
+ /* @__PURE__ */ jsx("div", { style: { height: 0 }, children: /* @__PURE__ */ jsxs("svg", { width: effectiveChartWidth, height, children: [
17317
+ xAxisLabel && /* @__PURE__ */ jsx(
17318
+ "text",
17319
+ {
17320
+ x: effectiveChartWidth - 40,
17321
+ y: height - 10,
17322
+ fontSize: 12,
17323
+ fill: "hsl(var(--muted-foreground))",
17324
+ fontWeight: 500,
17325
+ textAnchor: "end",
17326
+ children: xAxisLabel
17327
+ }
17328
+ ),
17329
+ yAxisLabel && /* @__PURE__ */ jsx(
17330
+ "text",
17331
+ {
17332
+ x: 20,
17333
+ y: 40,
17334
+ fontSize: 12,
17335
+ fill: "hsl(var(--muted-foreground))",
17336
+ fontWeight: 500,
17337
+ textAnchor: "start",
17338
+ transform: `rotate(-90 20 40)`,
17339
+ children: yAxisLabel
17340
+ }
17341
+ )
17342
+ ] }) })
17343
+ ] });
17232
17344
  }
17233
- return /* @__PURE__ */ jsx(
17345
+ return /* @__PURE__ */ jsxs(
17234
17346
  "div",
17235
17347
  {
17236
17348
  ref: wrapperRef,
@@ -17238,512 +17350,400 @@ var Chart = ({
17238
17350
  "w-full overflow-hidden min-w-0 rounded-lg border-border",
17239
17351
  className
17240
17352
  ),
17241
- children: /* @__PURE__ */ jsxs("div", { className: "rounded-lg bg-card relative w-full max-w-full min-w-0 py-1", children: [
17242
- title && /* @__PURE__ */ jsx(
17243
- "div",
17244
- {
17245
- className: cn(
17246
- "w-full flex items-center mt-3 mb-2",
17247
- HORIZONTAL_PADDING_CLASS,
17248
- titlePosition === "center" && "justify-center",
17249
- titlePosition === "right" && "justify-end",
17250
- titlePosition === "left" && "justify-start"
17251
- ),
17252
- children: /* @__PURE__ */ jsx("div", { className: "text-[1.4rem] font-semibold text-foreground", children: title })
17253
- }
17254
- ),
17255
- customLegend && !!data.length && /* @__PURE__ */ jsx("div", { className: cn("px-6 mb-2", HORIZONTAL_PADDING_CLASS), children: /* @__PURE__ */ jsx(
17256
- ChartTotalLegend_default,
17257
- {
17258
- items: allKeys.map((key) => {
17259
- const values = processedData.map(
17260
- (d) => Number(d[key] || 0)
17261
- );
17262
- const total = values.reduce((a, b) => a + b, 0);
17263
- const first = values[0] || 0;
17264
- const last = values[values.length - 1] || 0;
17265
- const trendValue = first !== 0 ? Math.round((last - first) / first * 100) : 0;
17266
- const formattedTotal = finalValueFormatter ? finalValueFormatter({
17267
- value: total,
17268
- formattedValue: String(total)
17269
- }) : new Intl.NumberFormat(formatBR ? "pt-BR" : "en-US").format(
17270
- total
17271
- );
17272
- return {
17273
- label: mapperConfig[key]?.label || key,
17274
- value: formattedTotal,
17275
- color: finalColors[key],
17276
- trend: {
17277
- value: Math.abs(trendValue),
17278
- positive: trendValue >= 0,
17279
- neutral: trendValue === 0
17280
- }
17281
- };
17282
- })
17283
- }
17284
- ) }),
17285
- allKeys.length > 0 && (enableHighlights || enableShowOnly) && /* @__PURE__ */ jsxs("div", { className: cn("flex items-center gap-2", teste), children: [
17286
- enableHighlights && /* @__PURE__ */ jsx(
17287
- Highlights_default,
17288
- {
17289
- allKeys,
17290
- mapperConfig,
17291
- finalColors,
17292
- highlightedSeries,
17293
- toggleHighlight,
17294
- containerWidth: chartInnerWidth
17295
- }
17296
- ),
17297
- enableShowOnly && /* @__PURE__ */ jsx(
17298
- ShowOnly_default,
17353
+ children: [
17354
+ /* @__PURE__ */ jsxs("div", { className: "rounded-lg bg-card relative w-full max-w-full min-w-0 py-1", children: [
17355
+ title && /* @__PURE__ */ jsx(
17356
+ "div",
17299
17357
  {
17300
- showOnlyHighlighted,
17301
- setShowOnlyHighlighted,
17302
- highlightedSeriesSize: highlightedSeries.size,
17303
- clearHighlights
17358
+ className: cn(
17359
+ "w-full flex items-center mt-3 mb-2",
17360
+ HORIZONTAL_PADDING_CLASS,
17361
+ titlePosition === "center" && "justify-center",
17362
+ titlePosition === "right" && "justify-end",
17363
+ titlePosition === "left" && "justify-start"
17364
+ ),
17365
+ children: /* @__PURE__ */ jsx("div", { className: "text-[1.4rem] font-semibold text-foreground", children: title })
17304
17366
  }
17305
17367
  ),
17306
- enablePeriodsDropdown && enableDraggableTooltips && /* @__PURE__ */ jsx("div", { className: "ml-auto flex items-center", children: /* @__PURE__ */ jsx(
17307
- PeriodsDropdown_default,
17368
+ customLegend && !!data.length && /* @__PURE__ */ jsx("div", { className: cn("px-6 mb-2", HORIZONTAL_PADDING_CLASS), children: /* @__PURE__ */ jsx(
17369
+ ChartTotalLegend_default,
17308
17370
  {
17309
- processedData,
17310
- onOpenPeriod: openTooltipForPeriod,
17311
- rightOffset: finalChartRightMargin,
17312
- activePeriods
17371
+ items: allKeys.map((key) => {
17372
+ const values = processedData.map(
17373
+ (d) => Number(d[key] || 0)
17374
+ );
17375
+ const total = values.reduce((a, b) => a + b, 0);
17376
+ const first = values[0] || 0;
17377
+ const last = values[values.length - 1] || 0;
17378
+ const trendValue = first !== 0 ? Math.round((last - first) / first * 100) : 0;
17379
+ const formattedTotal = finalValueFormatter ? finalValueFormatter({
17380
+ value: total,
17381
+ formattedValue: String(total)
17382
+ }) : new Intl.NumberFormat(formatBR ? "pt-BR" : "en-US").format(
17383
+ total
17384
+ );
17385
+ return {
17386
+ label: mapperConfig[key]?.label || key,
17387
+ value: formattedTotal,
17388
+ color: finalColors[key],
17389
+ trend: {
17390
+ value: Math.abs(trendValue),
17391
+ positive: trendValue >= 0,
17392
+ neutral: trendValue === 0
17393
+ }
17394
+ };
17395
+ })
17313
17396
  }
17314
- ) })
17315
- ] }),
17316
- !(allKeys.length > 0 && (enableHighlights || enableShowOnly)) && enablePeriodsDropdown && enableDraggableTooltips && /* @__PURE__ */ jsx(
17317
- "div",
17318
- {
17319
- className: cn(
17320
- "w-full flex justify-end mb-2",
17321
- HORIZONTAL_PADDING_CLASS
17397
+ ) }),
17398
+ allKeys.length > 0 && (enableHighlights || enableShowOnly) && /* @__PURE__ */ jsxs("div", { className: cn("flex items-center gap-2", teste), children: [
17399
+ enableHighlights && /* @__PURE__ */ jsx(
17400
+ Highlights_default,
17401
+ {
17402
+ allKeys,
17403
+ mapperConfig,
17404
+ finalColors,
17405
+ highlightedSeries,
17406
+ toggleHighlight,
17407
+ containerWidth: chartInnerWidth
17408
+ }
17322
17409
  ),
17323
- style: {
17324
- paddingRight: `${finalChartRightMargin}px`,
17325
- maxWidth: `${chartInnerWidth}px`
17326
- },
17327
- children: /* @__PURE__ */ jsx(
17410
+ enableShowOnly && /* @__PURE__ */ jsx(
17411
+ ShowOnly_default,
17412
+ {
17413
+ showOnlyHighlighted,
17414
+ setShowOnlyHighlighted,
17415
+ highlightedSeriesSize: highlightedSeries.size,
17416
+ clearHighlights
17417
+ }
17418
+ ),
17419
+ enablePeriodsDropdown && enableDraggableTooltips && /* @__PURE__ */ jsx("div", { className: "ml-auto flex items-center", children: /* @__PURE__ */ jsx(
17328
17420
  PeriodsDropdown_default,
17329
17421
  {
17330
17422
  processedData,
17331
17423
  onOpenPeriod: openTooltipForPeriod,
17332
- rightOffset: finalChartRightMargin
17424
+ rightOffset: finalChartRightMargin,
17425
+ activePeriods
17333
17426
  }
17334
- )
17335
- }
17336
- ),
17337
- showLegend && horizontal && /* @__PURE__ */ jsx(
17338
- HorizontalLegend_default,
17339
- {
17340
- allKeys,
17341
- mapperConfig,
17342
- finalColors,
17343
- labelMap,
17344
- legendUppercase,
17345
- orderBy,
17346
- maxPeriodLabel,
17347
- minPeriodLabel,
17348
- className: cn(HORIZONTAL_PADDING_CLASS)
17349
- }
17350
- ),
17351
- /* @__PURE__ */ jsx(
17352
- "div",
17353
- {
17354
- className: cn(
17355
- horizontal && "overflow-y-auto overflow-x-hidden px-6",
17356
- horizontal && "scrollbar-thin scrollbar-thumb-muted scrollbar-track-transparent"
17357
- ),
17358
- style: {
17359
- maxHeight: horizontal ? height : void 0
17360
- },
17361
- children: /* @__PURE__ */ jsx(
17362
- ResponsiveContainer,
17363
- {
17364
- width: "100%",
17365
- height: horizontal ? Math.max(height, processedData.length * 50) : height,
17366
- children: /* @__PURE__ */ jsxs(
17367
- ComposedChart,
17427
+ ) })
17428
+ ] }),
17429
+ !(allKeys.length > 0 && (enableHighlights || enableShowOnly)) && enablePeriodsDropdown && enableDraggableTooltips && /* @__PURE__ */ jsx(
17430
+ "div",
17431
+ {
17432
+ className: cn(
17433
+ "w-full flex justify-end mb-2",
17434
+ HORIZONTAL_PADDING_CLASS
17435
+ ),
17436
+ style: {
17437
+ paddingRight: `${finalChartRightMargin}px`,
17438
+ maxWidth: `${chartInnerWidth}px`
17439
+ },
17440
+ children: /* @__PURE__ */ jsx(
17441
+ PeriodsDropdown_default,
17442
+ {
17443
+ processedData,
17444
+ onOpenPeriod: openTooltipForPeriod,
17445
+ rightOffset: finalChartRightMargin
17446
+ }
17447
+ )
17448
+ }
17449
+ ),
17450
+ /* @__PURE__ */ jsx(ResponsiveContainer, { width: "100%", height, children: /* @__PURE__ */ jsxs(
17451
+ ComposedChart,
17452
+ {
17453
+ data: processedData,
17454
+ height,
17455
+ margin: {
17456
+ top: 10,
17457
+ right: finalChartRightMargin,
17458
+ left: finalChartLeftMargin,
17459
+ bottom: 10
17460
+ },
17461
+ onClick: handleChartClick,
17462
+ children: [
17463
+ /* @__PURE__ */ jsx("defs", { children: seriesOrder.filter((s) => s.type === "area").map((s) => {
17464
+ const key = s.key;
17465
+ const color = finalColors[key];
17466
+ return /* @__PURE__ */ jsxs(
17467
+ "linearGradient",
17468
+ {
17469
+ id: `gradient-${key}`,
17470
+ x1: "0",
17471
+ y1: "0",
17472
+ x2: "0",
17473
+ y2: "0.8",
17474
+ children: [
17475
+ /* @__PURE__ */ jsx("stop", { offset: "0%", stopColor: color, stopOpacity: 0.8 }),
17476
+ /* @__PURE__ */ jsx("stop", { offset: "90%", stopColor: color, stopOpacity: 0.1 })
17477
+ ]
17478
+ },
17479
+ `gradient-${key}`
17480
+ );
17481
+ }) }),
17482
+ showGrid && /* @__PURE__ */ jsx(
17483
+ CartesianGrid,
17484
+ {
17485
+ strokeDasharray: "3 3",
17486
+ stroke: gridColor || "hsl(var(--muted-foreground))",
17487
+ opacity: 0.5
17488
+ }
17489
+ ),
17490
+ /* @__PURE__ */ jsx(
17491
+ XAxis,
17368
17492
  {
17369
- data: processedData,
17370
- height: horizontal ? Math.max(height, processedData.length * 50) : height,
17371
- layout: horizontal ? "vertical" : "horizontal",
17372
- margin: {
17373
- top: 10,
17374
- right: finalChartRightMargin,
17375
- left: finalChartLeftMargin,
17376
- bottom: 10
17493
+ dataKey: xAxisConfig.dataKey,
17494
+ stroke: "hsl(var(--muted-foreground))",
17495
+ fontSize: 12,
17496
+ tickLine: false,
17497
+ axisLine: false,
17498
+ tickFormatter: (value) => {
17499
+ if (categoryFormatter)
17500
+ return categoryFormatter(value);
17501
+ if (xAxisConfig.valueFormatter)
17502
+ return xAxisConfig.valueFormatter(value);
17503
+ return String(value ?? "");
17377
17504
  },
17378
- onClick: handleChartClick,
17379
- children: [
17380
- /* @__PURE__ */ jsx("defs", { children: seriesOrder.filter((s) => s.type === "area").map((s) => {
17381
- const key = s.key;
17382
- const color = finalColors[key];
17383
- return /* @__PURE__ */ jsxs(
17384
- "linearGradient",
17385
- {
17386
- id: `gradient-${key}`,
17387
- x1: "0",
17388
- y1: "0",
17389
- x2: "0",
17390
- y2: "0.8",
17391
- children: [
17392
- /* @__PURE__ */ jsx("stop", { offset: "0%", stopColor: color, stopOpacity: 0.8 }),
17393
- /* @__PURE__ */ jsx(
17394
- "stop",
17395
- {
17396
- offset: "90%",
17397
- stopColor: color,
17398
- stopOpacity: 0.1
17399
- }
17400
- )
17401
- ]
17402
- },
17403
- `gradient-${key}`
17404
- );
17405
- }) }),
17406
- showGrid && /* @__PURE__ */ jsx(
17407
- CartesianGrid,
17408
- {
17409
- strokeDasharray: "3 3",
17410
- stroke: gridColor || "hsl(var(--muted-foreground))",
17411
- opacity: 0.5
17505
+ label: xAxisLabel ? {
17506
+ value: xAxisLabel,
17507
+ position: "insideBottomRight",
17508
+ offset: -5,
17509
+ style: {
17510
+ fontSize: 12,
17511
+ fill: "hsl(var(--muted-foreground))",
17512
+ fontWeight: 500
17513
+ }
17514
+ } : void 0
17515
+ }
17516
+ ),
17517
+ /* @__PURE__ */ jsx(
17518
+ YAxis,
17519
+ {
17520
+ yAxisId: "left",
17521
+ width: yAxisTickWidth,
17522
+ stroke: "hsl(var(--muted-foreground))",
17523
+ fontSize: 12,
17524
+ tickLine: false,
17525
+ axisLine: false,
17526
+ tickFormatter: yTickFormatter,
17527
+ domain: [Math.min(minLeftDataValue, 0), niceMaxLeft],
17528
+ tickCount: 6,
17529
+ label: yAxisLabel ? {
17530
+ value: yAxisLabel,
17531
+ angle: -90,
17532
+ position: "left",
17533
+ dx: leftYAxisLabelDx,
17534
+ style: {
17535
+ fontSize: 12,
17536
+ fill: "hsl(var(--muted-foreground))",
17537
+ fontWeight: 500,
17538
+ textAnchor: "middle"
17539
+ }
17540
+ } : void 0
17541
+ }
17542
+ ),
17543
+ rightKeys.length > 0 && (() => {
17544
+ const { rightAxisColor, rightTickFormatter } = fnConfigRightKeys(
17545
+ biaxialConfigNormalized,
17546
+ yTickFormatter,
17547
+ finalColors
17548
+ );
17549
+ return /* @__PURE__ */ jsx(
17550
+ YAxis,
17551
+ {
17552
+ yAxisId: "right",
17553
+ width: finalChartRightMargin,
17554
+ orientation: "right",
17555
+ stroke: "hsl(var(--muted-foreground))",
17556
+ fontSize: 12,
17557
+ tickLine: false,
17558
+ axisLine: false,
17559
+ tick: { fill: rightAxisColor },
17560
+ tickFormatter: rightTickFormatter,
17561
+ domain: [Math.min(minRightDataValue, 0), niceMaxRight],
17562
+ tickCount: 6,
17563
+ label: biaxialConfigNormalized?.label ? {
17564
+ value: biaxialConfigNormalized.label,
17565
+ angle: -90,
17566
+ position: "right",
17567
+ dx: rightYAxisLabelDx,
17568
+ style: {
17569
+ fontSize: 12,
17570
+ fill: "hsl(var(--muted-foreground))",
17571
+ fontWeight: 500,
17572
+ textAnchor: "middle"
17412
17573
  }
17413
- ),
17414
- horizontal ? /* @__PURE__ */ jsxs(Fragment, { children: [
17415
- /* @__PURE__ */ jsx(
17416
- XAxis,
17574
+ } : void 0
17575
+ }
17576
+ );
17577
+ })(),
17578
+ showTooltip && /* @__PURE__ */ jsx(
17579
+ Tooltip,
17580
+ {
17581
+ content: showTooltipTotal ? /* @__PURE__ */ jsx(
17582
+ TooltipWithTotal_default,
17583
+ {
17584
+ finalColors,
17585
+ valueFormatter: finalValueFormatter,
17586
+ categoryFormatter,
17587
+ periodLabel
17588
+ }
17589
+ ) : /* @__PURE__ */ jsx(
17590
+ TooltipSimple_default,
17591
+ {
17592
+ finalColors,
17593
+ valueFormatter: finalValueFormatter,
17594
+ categoryFormatter,
17595
+ periodLabel
17596
+ }
17597
+ ),
17598
+ cursor: { fill: "hsl(var(--muted))", opacity: 0.1 }
17599
+ }
17600
+ ),
17601
+ showLegend && /* @__PURE__ */ jsx(
17602
+ Legend,
17603
+ {
17604
+ iconSize: 12,
17605
+ formatter: (value) => {
17606
+ return /* @__PURE__ */ jsx("span", { className: "tracking-[0] rounded-sm", children: fnFormatterValueLegend(
17607
+ value,
17608
+ mapperConfig,
17609
+ labelMap,
17610
+ legendUppercase
17611
+ ) });
17612
+ }
17613
+ }
17614
+ ),
17615
+ seriesOrder.map((s) => {
17616
+ if (showOnlyHighlighted && !highlightedSeries.has(s.key))
17617
+ return null;
17618
+ const { label, color, key } = fnBuildConfigData(
17619
+ s,
17620
+ mapperConfig,
17621
+ labelMap,
17622
+ finalColors,
17623
+ rightKeys,
17624
+ biaxialConfigNormalized
17625
+ );
17626
+ if (s.type === "bar") {
17627
+ return /* @__PURE__ */ jsx(
17628
+ Bar,
17629
+ {
17630
+ dataKey: key,
17631
+ yAxisId: rightKeys.includes(key) ? "right" : "left",
17632
+ name: label,
17633
+ fill: color,
17634
+ radius: [4, 4, 0, 0],
17635
+ onClick: handleBarClick,
17636
+ className: "cursor-pointer",
17637
+ style: { opacity: getSeriesOpacity(key) },
17638
+ activeBar: /* @__PURE__ */ jsx(
17639
+ Rectangle,
17417
17640
  {
17418
- type: "number",
17419
- orientation: "top",
17420
- stroke: "hsl(var(--muted-foreground))",
17421
- fontSize: 12,
17422
- tickLine: false,
17423
- axisLine: false,
17424
- tickFormatter: yTickFormatter,
17425
- domain: [Math.min(minLeftDataValue, 0), niceMaxLeft],
17426
- tickCount: 6,
17427
- label: yAxisLabel ? {
17428
- value: yAxisLabel,
17429
- position: "insideTopRight",
17430
- offset: -5,
17431
- style: {
17432
- fontSize: 12,
17433
- fill: "hsl(var(--muted-foreground))",
17434
- fontWeight: 500
17435
- }
17436
- } : void 0
17641
+ fill: color,
17642
+ stroke: color,
17643
+ strokeWidth: 2,
17644
+ opacity: 0.8
17437
17645
  }
17438
17646
  ),
17439
- /* @__PURE__ */ jsx(
17440
- YAxis,
17647
+ children: showLabels && labelsVisibility.bar !== false && highlightedSeries.size === 0 || highlightedSeries.has(key) ? /* @__PURE__ */ jsx(
17648
+ LabelList,
17441
17649
  {
17442
- type: "category",
17443
- dataKey: xAxisConfig.dataKey,
17444
- yAxisId: "left",
17445
- width: yAxisTickWidth,
17446
- stroke: "hsl(var(--muted-foreground))",
17447
- fontSize: 12,
17448
- tickLine: false,
17449
- axisLine: false,
17450
- tickFormatter: (value) => {
17451
- if (categoryFormatter)
17452
- return categoryFormatter(value);
17453
- if (xAxisConfig.valueFormatter)
17454
- return xAxisConfig.valueFormatter(
17455
- value
17456
- );
17457
- return String(value ?? "");
17458
- },
17459
- label: xAxisLabel ? {
17460
- value: xAxisLabel,
17461
- angle: -90,
17462
- position: "insideTop",
17463
- dx: leftYAxisLabelDx,
17464
- style: {
17465
- fontSize: 12,
17466
- fill: "hsl(var(--muted-foreground))",
17467
- fontWeight: 500,
17468
- textAnchor: "middle"
17469
- }
17470
- } : void 0
17471
- }
17472
- )
17473
- ] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
17474
- /* @__PURE__ */ jsx(
17475
- XAxis,
17476
- {
17477
- dataKey: xAxisConfig.dataKey,
17478
- stroke: "hsl(var(--muted-foreground))",
17479
- fontSize: 12,
17480
- tickLine: false,
17481
- axisLine: false,
17482
- tickFormatter: (value) => {
17483
- if (categoryFormatter)
17484
- return categoryFormatter(value);
17485
- if (xAxisConfig.valueFormatter)
17486
- return xAxisConfig.valueFormatter(
17487
- value
17488
- );
17489
- return String(value ?? "");
17650
+ dataKey: key,
17651
+ content: (props) => {
17652
+ if (!fnContentLabelList(props)) return null;
17653
+ const inside = renderInsideBarLabel(
17654
+ color,
17655
+ finalValueFormatter
17656
+ );
17657
+ return inside(props);
17490
17658
  },
17491
- label: xAxisLabel ? {
17492
- value: xAxisLabel,
17493
- position: "insideBottomRight",
17494
- offset: -5,
17495
- style: {
17496
- fontSize: 12,
17497
- fill: "hsl(var(--muted-foreground))",
17498
- fontWeight: 500
17499
- }
17500
- } : void 0
17659
+ offset: 0
17501
17660
  }
17502
- ),
17503
- /* @__PURE__ */ jsx(
17504
- YAxis,
17661
+ ) : null
17662
+ },
17663
+ `bar-${key}`
17664
+ );
17665
+ }
17666
+ if (s.type === "line") {
17667
+ const lineFormatter = (props) => {
17668
+ const numValue = typeof props.value === "number" ? props.value : typeof props.value === "string" ? parseFloat(props.value) : 0;
17669
+ const percentage = calcDivision(numValue, 100);
17670
+ const formattedPercentage = typeof percentage === "number" ? percentage.toFixed(1).replace(".", ",") : String(percentage).replace(".", ",");
17671
+ return `${formattedPercentage}%`;
17672
+ };
17673
+ return /* @__PURE__ */ jsx(
17674
+ Line,
17675
+ {
17676
+ dataKey: key,
17677
+ yAxisId: rightKeys.includes(key) ? "right" : "left",
17678
+ name: label,
17679
+ stroke: color,
17680
+ strokeWidth: 2,
17681
+ dot: { r: 3 },
17682
+ activeDot: { r: 6 },
17683
+ onClick: handleSeriesClick,
17684
+ className: "cursor-pointer pointer-events-auto",
17685
+ style: { opacity: getSeriesOpacity(key) },
17686
+ children: showLabels && labelsVisibility.line !== false && highlightedSeries.size === 0 || highlightedSeries.has(key) ? /* @__PURE__ */ jsx(
17687
+ LabelList,
17505
17688
  {
17506
- yAxisId: "left",
17507
- width: yAxisTickWidth,
17508
- stroke: "hsl(var(--muted-foreground))",
17509
- fontSize: 12,
17510
- tickLine: false,
17511
- axisLine: false,
17512
- tickFormatter: yTickFormatter,
17513
- domain: [Math.min(minLeftDataValue, 0), niceMaxLeft],
17514
- tickCount: 6,
17515
- label: yAxisLabel ? {
17516
- value: yAxisLabel,
17517
- angle: -90,
17518
- position: "left",
17519
- dx: leftYAxisLabelDx,
17520
- style: {
17521
- fontSize: 12,
17522
- fill: "hsl(var(--muted-foreground))",
17523
- fontWeight: 500,
17524
- textAnchor: "middle"
17525
- }
17526
- } : void 0
17689
+ dataKey: key,
17690
+ position: "top",
17691
+ content: pillLabelRenderer_default(
17692
+ color,
17693
+ "filled",
17694
+ lineFormatter
17695
+ ),
17696
+ offset: 14
17527
17697
  }
17528
- )
17529
- ] }),
17530
- minLeftDataValue < 0 && /* @__PURE__ */ jsx(
17531
- ReferenceLine,
17532
- {
17533
- y: 0,
17534
- yAxisId: "left",
17535
- stroke: "hsl(var(--muted-foreground))",
17536
- strokeWidth: 1,
17537
- strokeDasharray: "4 4"
17538
- }
17539
- ),
17540
- rightKeys.length > 0 && (() => {
17541
- const { rightAxisColor, rightTickFormatter } = fnConfigRightKeys(
17542
- biaxialConfigNormalized,
17543
- yTickFormatter,
17544
- finalColors
17545
- );
17546
- return /* @__PURE__ */ jsx(
17547
- YAxis,
17698
+ ) : null
17699
+ },
17700
+ `line-${key}`
17701
+ );
17702
+ }
17703
+ if (s.type === "area") {
17704
+ return /* @__PURE__ */ jsx(
17705
+ Area,
17706
+ {
17707
+ type: "monotone",
17708
+ dataKey: key,
17709
+ yAxisId: rightKeys.includes(key) ? "right" : "left",
17710
+ name: label,
17711
+ stroke: color,
17712
+ fill: `url(#gradient-${key})`,
17713
+ fillOpacity: 1,
17714
+ strokeWidth: 2,
17715
+ onClick: handleSeriesClick,
17716
+ className: "cursor-pointer pointer-events-auto",
17717
+ style: { opacity: getSeriesOpacity(key) },
17718
+ activeDot: {
17719
+ r: 6,
17720
+ fill: color,
17721
+ stroke: "hsl(var(--background))",
17722
+ strokeWidth: 2
17723
+ },
17724
+ children: showLabels && labelsVisibility.area !== false && highlightedSeries.size === 0 || highlightedSeries.has(key) ? /* @__PURE__ */ jsx(
17725
+ LabelList,
17548
17726
  {
17549
- yAxisId: "right",
17550
- width: finalChartRightMargin,
17551
- orientation: "right",
17552
- stroke: "hsl(var(--muted-foreground))",
17553
- fontSize: 12,
17554
- tickLine: false,
17555
- axisLine: false,
17556
- tick: { fill: rightAxisColor },
17557
- tickFormatter: rightTickFormatter,
17558
- domain: [Math.min(minRightDataValue, 0), niceMaxRight],
17559
- tickCount: 6,
17560
- label: biaxialConfigNormalized?.label ? {
17561
- value: biaxialConfigNormalized.label,
17562
- angle: -90,
17563
- position: "right",
17564
- dx: rightYAxisLabelDx,
17565
- style: {
17566
- fontSize: 12,
17567
- fill: "hsl(var(--muted-foreground))",
17568
- fontWeight: 500,
17569
- textAnchor: "middle"
17570
- }
17571
- } : void 0
17572
- }
17573
- );
17574
- })(),
17575
- showTooltip && /* @__PURE__ */ jsx(
17576
- Tooltip,
17577
- {
17578
- content: showTooltipTotal ? /* @__PURE__ */ jsx(
17579
- TooltipWithTotal_default,
17580
- {
17581
- finalColors,
17582
- valueFormatter: finalValueFormatter,
17583
- categoryFormatter,
17584
- periodLabel
17585
- }
17586
- ) : /* @__PURE__ */ jsx(
17587
- TooltipSimple_default,
17588
- {
17589
- finalColors,
17590
- valueFormatter: finalValueFormatter,
17591
- categoryFormatter,
17592
- periodLabel
17593
- }
17594
- ),
17595
- cursor: { fill: "hsl(var(--muted))", opacity: 0.1 }
17596
- }
17597
- ),
17598
- showLegend && !horizontal && /* @__PURE__ */ jsx(
17599
- Legend,
17600
- {
17601
- iconSize: 12,
17602
- formatter: (value) => {
17603
- return /* @__PURE__ */ jsx("span", { className: "tracking-[0] rounded-sm", children: fnFormatterValueLegend(
17604
- value,
17605
- mapperConfig,
17606
- labelMap,
17607
- legendUppercase
17608
- ) });
17727
+ dataKey: key,
17728
+ position: "top",
17729
+ content: pillLabelRenderer_default(
17730
+ color,
17731
+ "soft",
17732
+ finalValueFormatter
17733
+ ),
17734
+ offset: 12
17609
17735
  }
17610
- }
17611
- ),
17612
- seriesOrder.map((s) => {
17613
- if (showOnlyHighlighted && !highlightedSeries.has(s.key))
17614
- return null;
17615
- const { label, color, key } = fnBuildConfigData(
17616
- s,
17617
- mapperConfig,
17618
- labelMap,
17619
- finalColors,
17620
- rightKeys,
17621
- biaxialConfigNormalized
17622
- );
17623
- if (s.type === "bar") {
17624
- return /* @__PURE__ */ jsx(
17625
- Bar,
17626
- {
17627
- dataKey: key,
17628
- yAxisId: rightKeys.includes(key) ? "right" : "left",
17629
- name: label,
17630
- fill: color,
17631
- radius: horizontal ? [0, 4, 4, 0] : [4, 4, 0, 0],
17632
- onClick: handleBarClick,
17633
- className: "cursor-pointer",
17634
- style: { opacity: getSeriesOpacity(key) },
17635
- activeBar: /* @__PURE__ */ jsx(
17636
- Rectangle,
17637
- {
17638
- fill: color,
17639
- stroke: color,
17640
- strokeWidth: 2,
17641
- opacity: 0.8
17642
- }
17643
- ),
17644
- children: showLabels && labelsVisibility.bar !== false && highlightedSeries.size === 0 || highlightedSeries.has(key) ? /* @__PURE__ */ jsx(
17645
- LabelList,
17646
- {
17647
- dataKey: key,
17648
- content: (props) => {
17649
- if (!fnContentLabelList(props)) return null;
17650
- const inside = renderInsideBarLabel(
17651
- color,
17652
- finalValueFormatter
17653
- );
17654
- return inside(props);
17655
- },
17656
- offset: 0
17657
- }
17658
- ) : null
17659
- },
17660
- `bar-${key}`
17661
- );
17662
- }
17663
- if (s.type === "line") {
17664
- const lineFormatter = (props) => {
17665
- const numValue = typeof props.value === "number" ? props.value : typeof props.value === "string" ? parseFloat(props.value) : 0;
17666
- const percentage = calcDivision(numValue, 100);
17667
- const formattedPercentage = typeof percentage === "number" ? percentage.toFixed(1).replace(".", ",") : String(percentage).replace(".", ",");
17668
- return `${formattedPercentage}%`;
17669
- };
17670
- return /* @__PURE__ */ jsx(
17671
- Line,
17672
- {
17673
- dataKey: key,
17674
- yAxisId: rightKeys.includes(key) ? "right" : "left",
17675
- name: label,
17676
- stroke: color,
17677
- strokeWidth: 2,
17678
- dot: { r: 3 },
17679
- activeDot: { r: 6 },
17680
- onClick: handleSeriesClick,
17681
- className: "cursor-pointer pointer-events-auto",
17682
- style: { opacity: getSeriesOpacity(key) },
17683
- children: showLabels && labelsVisibility.line !== false && highlightedSeries.size === 0 || highlightedSeries.has(key) ? /* @__PURE__ */ jsx(
17684
- LabelList,
17685
- {
17686
- dataKey: key,
17687
- position: "top",
17688
- content: pillLabelRenderer_default(
17689
- color,
17690
- "filled",
17691
- lineFormatter
17692
- ),
17693
- offset: 14
17694
- }
17695
- ) : null
17696
- },
17697
- `line-${key}`
17698
- );
17699
- }
17700
- if (s.type === "area") {
17701
- return /* @__PURE__ */ jsx(
17702
- Area,
17703
- {
17704
- type: "monotone",
17705
- dataKey: key,
17706
- yAxisId: rightKeys.includes(key) ? "right" : "left",
17707
- name: label,
17708
- stroke: color,
17709
- fill: `url(#gradient-${key})`,
17710
- fillOpacity: 1,
17711
- strokeWidth: 2,
17712
- onClick: handleSeriesClick,
17713
- className: "cursor-pointer pointer-events-auto",
17714
- style: { opacity: getSeriesOpacity(key) },
17715
- activeDot: {
17716
- r: 6,
17717
- fill: color,
17718
- stroke: "hsl(var(--background))",
17719
- strokeWidth: 2
17720
- },
17721
- children: showLabels && labelsVisibility.area !== false && highlightedSeries.size === 0 || highlightedSeries.has(key) ? /* @__PURE__ */ jsx(
17722
- LabelList,
17723
- {
17724
- dataKey: key,
17725
- position: "top",
17726
- content: pillLabelRenderer_default(
17727
- color,
17728
- "soft",
17729
- finalValueFormatter
17730
- ),
17731
- offset: 12
17732
- }
17733
- ) : null
17734
- },
17735
- `area-${key}`
17736
- );
17737
- }
17738
- return null;
17739
- })
17740
- ]
17736
+ ) : null
17737
+ },
17738
+ `area-${key}`
17739
+ );
17741
17740
  }
17742
- )
17743
- }
17744
- )
17745
- }
17746
- ),
17741
+ return null;
17742
+ })
17743
+ ]
17744
+ }
17745
+ ) })
17746
+ ] }),
17747
17747
  enableDraggableTooltips && activeTooltips.map((tooltip) => /* @__PURE__ */ jsx(
17748
17748
  DraggableTooltip_default,
17749
17749
  {
@@ -17801,7 +17801,7 @@ var Chart = ({
17801
17801
  }
17802
17802
  }
17803
17803
  )
17804
- ] })
17804
+ ]
17805
17805
  }
17806
17806
  );
17807
17807
  };