@mlw-packages/react-components 1.9.2 → 1.9.4

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
@@ -688,7 +688,7 @@ var DialogContentBase = React33__namespace.forwardRef(
688
688
  {
689
689
  ref,
690
690
  className: cn(
691
- "fixed left-[50%] top-[50%] z-50 w-lg grid translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg max-h-[100dvh] overflow-auto rounded-md border-border",
691
+ "fixed left-[50%] top-[50%] z-50 w-[90%] sm:w-lg grid translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg max-h-[100dvh] overflow-y-auto overflow-x-hidden rounded-md border-border",
692
692
  className
693
693
  ),
694
694
  "data-testid": dataTestId,
@@ -1954,21 +1954,28 @@ var CommandDialogBase = ({ children, open, ...props }) => {
1954
1954
  "command-dialog"
1955
1955
  ) }) }) });
1956
1956
  };
1957
- var CommandInputBase = React33__namespace.forwardRef(({ className, testid: dataTestId = "command-input", ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center border-b px-3 border-border", "cmdk-input-wrapper": "", children: [
1958
- /* @__PURE__ */ jsxRuntime.jsx(react.MagnifyingGlassIcon, { className: "mr-2 h-4 w-4 shrink-0 text-primary" }),
1959
- /* @__PURE__ */ jsxRuntime.jsx(
1960
- cmdk.Command.Input,
1961
- {
1962
- ref,
1963
- className: cn(
1964
- "flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-none text-primary placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",
1965
- className
1966
- ),
1967
- "data-testid": dataTestId,
1968
- ...props
1969
- }
1970
- )
1971
- ] }));
1957
+ var CommandInputBase = React33__namespace.forwardRef(({ className, testid: dataTestId = "command-input", ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsxs(
1958
+ "div",
1959
+ {
1960
+ className: "flex items-center border-b px-3 border-border",
1961
+ "cmdk-input-wrapper": "",
1962
+ children: [
1963
+ /* @__PURE__ */ jsxRuntime.jsx(react.MagnifyingGlassIcon, { className: "mr-2 h-4 w-4 shrink-0 text-primary" }),
1964
+ /* @__PURE__ */ jsxRuntime.jsx(
1965
+ cmdk.Command.Input,
1966
+ {
1967
+ ref,
1968
+ className: cn(
1969
+ "flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-none text-primary placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",
1970
+ className
1971
+ ),
1972
+ "data-testid": dataTestId,
1973
+ ...props
1974
+ }
1975
+ )
1976
+ ]
1977
+ }
1978
+ ));
1972
1979
  CommandInputBase.displayName = cmdk.Command.Input.displayName;
1973
1980
  var CommandListBase = React33__namespace.forwardRef(({ className, testid: dataTestId = "command-list", ...props }, ref) => {
1974
1981
  const listRef = React33__namespace.useRef(null);
@@ -1976,11 +1983,45 @@ var CommandListBase = React33__namespace.forwardRef(({ className, testid: dataTe
1976
1983
  const element = listRef.current;
1977
1984
  if (!element) return;
1978
1985
  const handleWheel = (e) => {
1986
+ const target = e.currentTarget;
1987
+ const { scrollTop, scrollHeight, clientHeight } = target;
1988
+ const isScrollingDown = e.deltaY > 0;
1989
+ const isScrollingUp = e.deltaY < 0;
1990
+ const isAtBottom = scrollTop + clientHeight >= scrollHeight - 1;
1991
+ const isAtTop = scrollTop <= 1;
1992
+ if (isScrollingDown && !isAtBottom || isScrollingUp && !isAtTop) {
1993
+ e.stopPropagation();
1994
+ }
1995
+ };
1996
+ let touchStartY = 0;
1997
+ const handleTouchStart = (e) => {
1998
+ touchStartY = e.touches[0].clientY;
1979
1999
  e.stopPropagation();
1980
2000
  };
2001
+ const handleTouchMove = (e) => {
2002
+ const target = e.currentTarget;
2003
+ const { scrollTop, scrollHeight, clientHeight } = target;
2004
+ const touchCurrentY = e.touches[0].clientY;
2005
+ const touchDeltaY = touchStartY - touchCurrentY;
2006
+ const isScrollingDown = touchDeltaY > 0;
2007
+ const isScrollingUp = touchDeltaY < 0;
2008
+ const isAtBottom = scrollTop + clientHeight >= scrollHeight - 1;
2009
+ const isAtTop = scrollTop <= 1;
2010
+ if (isScrollingDown && !isAtBottom || isScrollingUp && !isAtTop) {
2011
+ e.stopPropagation();
2012
+ } else if (isScrollingDown && isAtBottom || isScrollingUp && isAtTop) {
2013
+ e.preventDefault();
2014
+ }
2015
+ };
1981
2016
  element.addEventListener("wheel", handleWheel, { passive: false });
2017
+ element.addEventListener("touchstart", handleTouchStart, {
2018
+ passive: false
2019
+ });
2020
+ element.addEventListener("touchmove", handleTouchMove, { passive: false });
1982
2021
  return () => {
1983
2022
  element.removeEventListener("wheel", handleWheel);
2023
+ element.removeEventListener("touchmove", handleTouchMove);
2024
+ element.removeEventListener("touchstart", handleTouchStart);
1984
2025
  };
1985
2026
  }, []);
1986
2027
  const combinedRef = React33__namespace.useCallback(
@@ -2005,7 +2046,13 @@ var CommandListBase = React33__namespace.forwardRef(({ className, testid: dataTe
2005
2046
  "data-testid": dataTestId,
2006
2047
  style: {
2007
2048
  overscrollBehavior: "contain",
2008
- WebkitOverflowScrolling: "touch"
2049
+ WebkitOverflowScrolling: "touch",
2050
+ touchAction: "pan-y",
2051
+ scrollbarWidth: "thin",
2052
+ scrollbarColor: "hsl(var(--muted)) transparent",
2053
+ overflowY: "auto",
2054
+ willChange: "scroll-position",
2055
+ transform: "translateZ(0)"
2009
2056
  },
2010
2057
  ...props
2011
2058
  }
@@ -2083,6 +2130,7 @@ var PopoverContentBase = React33__namespace.forwardRef(
2083
2130
  align = "center",
2084
2131
  sideOffset = 4,
2085
2132
  testid: dataTestId = "popover-content",
2133
+ style,
2086
2134
  ...props
2087
2135
  }, ref) => /* @__PURE__ */ jsxRuntime.jsx(PopoverPrimitive__namespace.Portal, { children: /* @__PURE__ */ jsxRuntime.jsx(
2088
2136
  PopoverPrimitive__namespace.Content,
@@ -2091,10 +2139,20 @@ var PopoverContentBase = React33__namespace.forwardRef(
2091
2139
  align,
2092
2140
  sideOffset,
2093
2141
  className: cn(
2094
- "z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
2142
+ "z-[100] w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
2095
2143
  className
2096
2144
  ),
2097
2145
  "data-testid": dataTestId,
2146
+ style: {
2147
+ ...style,
2148
+ WebkitOverflowScrolling: "touch",
2149
+ overscrollBehavior: "contain",
2150
+ pointerEvents: "auto"
2151
+ },
2152
+ onWheel: (e) => {
2153
+ e.stopPropagation();
2154
+ props.onWheel?.(e);
2155
+ },
2098
2156
  onInteractOutside: (event) => {
2099
2157
  props.onInteractOutside?.(event);
2100
2158
  if (event.defaultPrevented) return;
@@ -2151,7 +2209,6 @@ function ComboboxBase({
2151
2209
  hideClear = false
2152
2210
  }) {
2153
2211
  const [open, setOpen] = React33.useState(false);
2154
- const isMobile = useIsMobile();
2155
2212
  return /* @__PURE__ */ jsxRuntime.jsxs(
2156
2213
  "div",
2157
2214
  {
@@ -2163,7 +2220,7 @@ function ComboboxBase({
2163
2220
  {
2164
2221
  open,
2165
2222
  onOpenChange: (v) => !disabled && setOpen(v),
2166
- modal: isMobile,
2223
+ modal: false,
2167
2224
  children: [
2168
2225
  /* @__PURE__ */ jsxRuntime.jsx(
2169
2226
  PopoverTriggerBase,
@@ -2895,7 +2952,7 @@ var SelectContentBase = React33__namespace.forwardRef(
2895
2952
  {
2896
2953
  ref,
2897
2954
  className: cn(
2898
- "relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md",
2955
+ "relative z-50 max-h-96 overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md",
2899
2956
  className
2900
2957
  ),
2901
2958
  position,
@@ -5436,14 +5493,29 @@ var TableCaptionBase = React33__namespace.forwardRef(({ className, ...props }, r
5436
5493
  }
5437
5494
  ));
5438
5495
  TableCaptionBase.displayName = "TableCaptionBase";
5439
- var TabsBase = TabsPrimitive__namespace.Root;
5496
+ var TabsBase = React33__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
5497
+ TabsPrimitive__namespace.Root,
5498
+ {
5499
+ ref,
5500
+ className: cn("w-full", className),
5501
+ ...props
5502
+ }
5503
+ ));
5504
+ TabsBase.displayName = TabsPrimitive__namespace.Root.displayName;
5440
5505
  var TabsListBase = React33__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
5441
5506
  TabsPrimitive__namespace.List,
5442
5507
  {
5443
5508
  ref,
5444
5509
  className: cn(
5445
5510
  "relative flex w-full items-center justify-start gap-2 border-b border-border",
5446
- "bg-transparent",
5511
+ "bg-transparent overflow-x-auto",
5512
+ "scrollbar-thin scrollbar-thumb-muted-foreground/30 scrollbar-track-transparent",
5513
+ "hover:scrollbar-thumb-muted-foreground/50",
5514
+ "[&::-webkit-scrollbar]:h-1.5",
5515
+ "[&::-webkit-scrollbar-track]:bg-transparent",
5516
+ "[&::-webkit-scrollbar-thumb]:bg-muted-foreground/30",
5517
+ "[&::-webkit-scrollbar-thumb]:rounded-full",
5518
+ "hover:[&::-webkit-scrollbar-thumb]:bg-muted-foreground/50",
5447
5519
  className
5448
5520
  ),
5449
5521
  ...props
@@ -8164,7 +8236,7 @@ function DateTimePicker({
8164
8236
  }
8165
8237
  ),
8166
8238
  /* @__PURE__ */ jsxRuntime.jsx(ErrorMessage_default, { error }),
8167
- /* @__PURE__ */ jsxRuntime.jsx(DialogContentBase, { className: "p-0 max-h-[95vh] w-[calc(100vw-24px)] sm:w-[calc(100vw-32px)] overflow-hidden flex flex-col", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "overflow-y-auto flex-1", children: renderPickerContent() }) })
8239
+ /* @__PURE__ */ jsxRuntime.jsx(DialogContentBase, { className: "p-0 max-h-[95vh] w-3/6 overflow-hidden flex flex-col", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "overflow-y-auto flex-1", children: renderPickerContent() }) })
8168
8240
  ] }) : /* @__PURE__ */ jsxRuntime.jsxs(PopoverBase, { open, onOpenChange: setOpen, children: [
8169
8241
  /* @__PURE__ */ jsxRuntime.jsx(
8170
8242
  PopoverTriggerBase,
@@ -10150,8 +10222,8 @@ function EventAgenda({
10150
10222
  setView(v);
10151
10223
  },
10152
10224
  items: selectItems,
10153
- className: "gap-2 px-3 py-1.5 max-[479px]:h-8",
10154
10225
  placeholder: viewLabel(view),
10226
+ className: "min-w-24",
10155
10227
  hideClear: true
10156
10228
  }
10157
10229
  ) })
@@ -10159,8 +10231,7 @@ function EventAgenda({
10159
10231
  /* @__PURE__ */ jsxRuntime.jsxs(
10160
10232
  "div",
10161
10233
  {
10162
- className: "flex flex-1 flex-col transition-all duration-200 ease-in-out",
10163
- "aria-live": "polite",
10234
+ className: "flex flex-col transition-all duration-200 ease-in-out",
10164
10235
  children: [
10165
10236
  view === "month" && /* @__PURE__ */ jsxRuntime.jsx(
10166
10237
  MonthViewAgenda,
@@ -14168,29 +14239,62 @@ var adaptDataForTooltip = (data, xAxisKey) => {
14168
14239
  };
14169
14240
  var createValueFormatter = (customFormatter, formatBR) => {
14170
14241
  const nf = new Intl.NumberFormat("pt-BR", {
14171
- minimumFractionDigits: 2,
14172
- maximumFractionDigits: 2
14242
+ minimumFractionDigits: 0,
14243
+ maximumFractionDigits: 0
14173
14244
  });
14245
+ const prefixFormats = ["R$", "$", "\u20AC", "\xA3"];
14246
+ const suffixFormats = ["%", "kg", "km", "m", "L", "un", "t", "h", "min", "s"];
14247
+ const getFormattedValue = (baseValue, format17) => {
14248
+ const trimmedFormat = format17.trim();
14249
+ if (prefixFormats.includes(trimmedFormat)) {
14250
+ return `${trimmedFormat} ${baseValue}`;
14251
+ }
14252
+ if (suffixFormats.includes(trimmedFormat)) {
14253
+ return `${baseValue}${trimmedFormat}`;
14254
+ }
14255
+ return `${baseValue} ${trimmedFormat}`;
14256
+ };
14174
14257
  if (customFormatter) {
14175
- if (formatBR) {
14176
- const wrapped = (props) => {
14177
- const { value, formattedValue } = props;
14258
+ if (typeof customFormatter === "object" && !Array.isArray(customFormatter)) {
14259
+ const formatterMap = customFormatter;
14260
+ return (props) => {
14261
+ const {
14262
+ value,
14263
+ formattedValue,
14264
+ dataKey: propsDataKey
14265
+ } = props;
14178
14266
  let num = NaN;
14179
14267
  if (typeof value === "number") num = value;
14180
14268
  else if (typeof value === "string" && value.trim() !== "") {
14181
14269
  const parsed = Number(value);
14182
14270
  num = Number.isNaN(parsed) ? NaN : parsed;
14183
14271
  }
14184
- const brFormatted = !Number.isNaN(num) ? nf.format(num) : String(formattedValue ?? value ?? "");
14185
- return customFormatter({
14186
- ...props,
14187
- formattedValue: brFormatted,
14188
- value: void 0
14189
- });
14272
+ const baseFormatted = formatBR && !Number.isNaN(num) ? nf.format(num) : String(formattedValue ?? value ?? "");
14273
+ const format17 = propsDataKey && formatterMap[propsDataKey] ? formatterMap[propsDataKey] : "";
14274
+ return format17 ? getFormattedValue(baseFormatted, format17) : baseFormatted;
14190
14275
  };
14191
- return wrapped;
14192
14276
  }
14193
- return customFormatter;
14277
+ if (typeof customFormatter === "function") {
14278
+ if (formatBR) {
14279
+ const wrapped = (props) => {
14280
+ const { value, formattedValue } = props;
14281
+ let num = NaN;
14282
+ if (typeof value === "number") num = value;
14283
+ else if (typeof value === "string" && value.trim() !== "") {
14284
+ const parsed = Number(value);
14285
+ num = Number.isNaN(parsed) ? NaN : parsed;
14286
+ }
14287
+ const brFormatted = !Number.isNaN(num) ? nf.format(num) : String(formattedValue ?? value ?? "");
14288
+ return customFormatter({
14289
+ ...props,
14290
+ formattedValue: brFormatted,
14291
+ value: void 0
14292
+ });
14293
+ };
14294
+ return wrapped;
14295
+ }
14296
+ return customFormatter;
14297
+ }
14194
14298
  }
14195
14299
  if (!formatBR) return void 0;
14196
14300
  const builtIn = (props) => {
@@ -14208,8 +14312,8 @@ var createValueFormatter = (customFormatter, formatBR) => {
14208
14312
  };
14209
14313
  var createYTickFormatter = (finalValueFormatter) => {
14210
14314
  const nf = new Intl.NumberFormat("pt-BR", {
14211
- minimumFractionDigits: 2,
14212
- maximumFractionDigits: 2
14315
+ minimumFractionDigits: 0,
14316
+ maximumFractionDigits: 0
14213
14317
  });
14214
14318
  const stripCurrency = (s) => String(s).replace(/^\s*R\$\s?/, "");
14215
14319
  if (finalValueFormatter) {
@@ -14242,6 +14346,42 @@ var computeYAxisTickWidth = (chartMarginLeft, yAxisLabel, axisLabelMargin, yTick
14242
14346
  const estimated = Math.max(48, Math.min(220, maxLen * 8 + 24));
14243
14347
  return estimated;
14244
14348
  };
14349
+ var CustomYAxisTick = (props) => {
14350
+ const { x = 0, y = 0, payload } = props;
14351
+ const text = String(payload?.value || "");
14352
+ const maxCharsPerLine = 20;
14353
+ const words = text.split(" ");
14354
+ const lines = [];
14355
+ let currentLine = "";
14356
+ words.forEach((word) => {
14357
+ const testLine = currentLine ? `${currentLine} ${word}` : word;
14358
+ if (testLine.length > maxCharsPerLine && currentLine) {
14359
+ lines.push(currentLine);
14360
+ currentLine = word;
14361
+ } else {
14362
+ currentLine = testLine;
14363
+ }
14364
+ });
14365
+ if (currentLine) {
14366
+ lines.push(currentLine);
14367
+ }
14368
+ const lineHeight = 12;
14369
+ const totalHeight = lines.length * lineHeight;
14370
+ const startY = y - totalHeight / 2 + lineHeight / 2;
14371
+ return /* @__PURE__ */ jsxRuntime.jsx("g", { children: lines.map((line, index) => /* @__PURE__ */ jsxRuntime.jsx(
14372
+ "text",
14373
+ {
14374
+ x,
14375
+ y: startY + index * lineHeight,
14376
+ textAnchor: "end",
14377
+ fill: "hsl(var(--muted-foreground))",
14378
+ fontSize: 11,
14379
+ children: line
14380
+ },
14381
+ index
14382
+ )) });
14383
+ };
14384
+ var CustomYAxisTick_default = CustomYAxisTick;
14245
14385
  var menuVariants = {
14246
14386
  hidden: { opacity: 0, y: -6, scale: 0.98 },
14247
14387
  visible: { opacity: 1, y: 0, scale: 1 },
@@ -15527,12 +15667,14 @@ var SystemTooltip = ({
15527
15667
  data,
15528
15668
  position,
15529
15669
  title = "Conex\xF5es",
15670
+ isLoading = false,
15530
15671
  onMouseDown,
15531
15672
  onClose,
15532
15673
  onPositionChange
15533
15674
  }) => {
15534
15675
  const [localPos, setLocalPos] = React33.useState(position);
15535
15676
  const [dragging, setDragging] = React33.useState(false);
15677
+ const [expandedId, setExpandedId] = React33.useState(null);
15536
15678
  const offsetRef = React33.useRef({ x: 0, y: 0 });
15537
15679
  const lastMouse = React33.useRef({ x: 0, y: 0 });
15538
15680
  React33.useEffect(() => setLocalPos(position), [position]);
@@ -15654,54 +15796,157 @@ var SystemTooltip = ({
15654
15796
  ]
15655
15797
  }
15656
15798
  ),
15657
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "px-4 pt-4 pb-3", children: [
15799
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "px-4 pt-4 pb-3", children: isLoading ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-2", children: [
15800
+ /* @__PURE__ */ jsxRuntime.jsx(SkeletonBase, { className: "h-6 w-3/4" }),
15801
+ /* @__PURE__ */ jsxRuntime.jsx(SkeletonBase, { className: "h-4 w-1/2" })
15802
+ ] }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
15658
15803
  /* @__PURE__ */ jsxRuntime.jsx("h3", { className: "text-xl font-bold text-foreground tracking-tight truncate", children: data.name }),
15659
- /* @__PURE__ */ jsxRuntime.jsx("h3", { className: "text-sm font-bold text-muted-foreground tracking-tight truncate", children: data.description })
15660
- ] }),
15804
+ data.description && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-muted-foreground tracking-tight truncate", children: data.description })
15805
+ ] }) }),
15661
15806
  /* @__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: [
15662
15807
  /* @__PURE__ */ jsxRuntime.jsx(SeparatorBase, { className: "w-full" }),
15663
- entries.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-2", children: [
15664
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2 px-1", children: [
15665
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-1.5 h-1.5 rounded-full bg-emerald-500" }),
15666
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[10px] font-bold text-muted-foreground uppercase", children: "Entradas" })
15808
+ isLoading ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
15809
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-2", children: [
15810
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2 px-1", children: [
15811
+ /* @__PURE__ */ jsxRuntime.jsx(SkeletonBase, { className: "w-1.5 h-1.5 rounded-full" }),
15812
+ /* @__PURE__ */ jsxRuntime.jsx(SkeletonBase, { className: "h-3 w-16" })
15813
+ ] }),
15814
+ /* @__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)) })
15667
15815
  ] }),
15668
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "space-y-1", children: entries.map((conn) => /* @__PURE__ */ jsxRuntime.jsxs(
15669
- "div",
15670
- {
15671
- 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",
15672
- children: [
15673
- /* @__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 }) }),
15674
- " ",
15675
- /* @__PURE__ */ jsxRuntime.jsx(
15676
- react.ArrowRight,
15677
- {
15678
- size: 14,
15679
- className: "text-emerald-500 shrink-0 rotate-180"
15680
- }
15681
- )
15682
- ]
15683
- },
15684
- conn.id
15685
- )) })
15686
- ] }),
15687
- exits.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-2", children: [
15688
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2 px-1", children: [
15689
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-1.5 h-1.5 rounded-full bg-blue-500" }),
15690
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[10px] font-bold text-muted-foreground uppercase", children: "Sa\xEDdas" })
15816
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-2", children: [
15817
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2 px-1", children: [
15818
+ /* @__PURE__ */ jsxRuntime.jsx(SkeletonBase, { className: "w-1.5 h-1.5 rounded-full" }),
15819
+ /* @__PURE__ */ jsxRuntime.jsx(SkeletonBase, { className: "h-3 w-16" })
15820
+ ] }),
15821
+ /* @__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)) })
15822
+ ] })
15823
+ ] }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
15824
+ entries.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-2", children: [
15825
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2 px-1", children: [
15826
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-1.5 h-1.5 rounded-full bg-emerald-500" }),
15827
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[10px] font-bold text-muted-foreground uppercase", children: "Entradas" })
15828
+ ] }),
15829
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "space-y-1", children: entries.map((conn) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-1", children: [
15830
+ /* @__PURE__ */ jsxRuntime.jsxs(
15831
+ "div",
15832
+ {
15833
+ 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",
15834
+ onClick: () => setExpandedId(expandedId === conn.id ? null : conn.id),
15835
+ children: [
15836
+ /* @__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 }) }),
15837
+ /* @__PURE__ */ jsxRuntime.jsx(
15838
+ react.ArrowRight,
15839
+ {
15840
+ size: 14,
15841
+ className: "text-emerald-500 shrink-0 rotate-180"
15842
+ }
15843
+ )
15844
+ ]
15845
+ }
15846
+ ),
15847
+ 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: [
15848
+ conn.integration.Nome && /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
15849
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-semibold", children: "Nome:" }),
15850
+ " ",
15851
+ conn.integration.Nome
15852
+ ] }),
15853
+ (conn.integration.tipo || conn.integration.Tipo) && /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
15854
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-semibold", children: "Tipo:" }),
15855
+ " ",
15856
+ conn.integration.tipo || conn.integration.Tipo
15857
+ ] }),
15858
+ conn.integration.Protocolos && /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
15859
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-semibold", children: "Protocolos:" }),
15860
+ " ",
15861
+ conn.integration.Protocolos
15862
+ ] }),
15863
+ conn.integration.Ambiente && /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
15864
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-semibold", children: "Ambiente:" }),
15865
+ " ",
15866
+ conn.integration.Ambiente
15867
+ ] }),
15868
+ conn.integration.Setor && /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
15869
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-semibold", children: "Setor:" }),
15870
+ " ",
15871
+ conn.integration.Setor
15872
+ ] }),
15873
+ conn.integration.Contato && /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
15874
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-semibold", children: "Contato:" }),
15875
+ " ",
15876
+ conn.integration.Contato
15877
+ ] }),
15878
+ conn.integration.Sustentacao && /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
15879
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-semibold", children: "Sustenta\xE7\xE3o:" }),
15880
+ " ",
15881
+ conn.integration.Sustentacao
15882
+ ] })
15883
+ ] })
15884
+ ] }, conn.id)) })
15691
15885
  ] }),
15692
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "space-y-1", children: exits.map((conn) => /* @__PURE__ */ jsxRuntime.jsxs(
15693
- "div",
15694
- {
15695
- 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",
15696
- children: [
15697
- /* @__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 }) }),
15698
- /* @__PURE__ */ jsxRuntime.jsx(react.ArrowRight, { size: 14, className: "text-blue-500 shrink-0" })
15699
- ]
15700
- },
15701
- conn.id
15702
- )) })
15703
- ] }),
15704
- 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" }) })
15886
+ exits.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-2", children: [
15887
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2 px-1", children: [
15888
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-1.5 h-1.5 rounded-full bg-blue-500" }),
15889
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[10px] font-bold text-muted-foreground uppercase", children: "Sa\xEDdas" })
15890
+ ] }),
15891
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "space-y-1", children: exits.map((conn) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-1", children: [
15892
+ /* @__PURE__ */ jsxRuntime.jsxs(
15893
+ "div",
15894
+ {
15895
+ 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",
15896
+ onClick: () => setExpandedId(expandedId === conn.id ? null : conn.id),
15897
+ children: [
15898
+ /* @__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 }) }),
15899
+ /* @__PURE__ */ jsxRuntime.jsx(
15900
+ react.ArrowRight,
15901
+ {
15902
+ size: 14,
15903
+ className: "text-blue-500 shrink-0"
15904
+ }
15905
+ )
15906
+ ]
15907
+ }
15908
+ ),
15909
+ 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: [
15910
+ conn.integration.Nome && /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
15911
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-semibold", children: "Nome:" }),
15912
+ " ",
15913
+ conn.integration.Nome
15914
+ ] }),
15915
+ (conn.integration.tipo || conn.integration.Tipo) && /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
15916
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-semibold", children: "Tipo:" }),
15917
+ " ",
15918
+ conn.integration.tipo || conn.integration.Tipo
15919
+ ] }),
15920
+ conn.integration.Protocolos && /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
15921
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-semibold", children: "Protocolos:" }),
15922
+ " ",
15923
+ conn.integration.Protocolos
15924
+ ] }),
15925
+ conn.integration.Ambiente && /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
15926
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-semibold", children: "Ambiente:" }),
15927
+ " ",
15928
+ conn.integration.Ambiente
15929
+ ] }),
15930
+ conn.integration.Setor && /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
15931
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-semibold", children: "Setor:" }),
15932
+ " ",
15933
+ conn.integration.Setor
15934
+ ] }),
15935
+ conn.integration.Contato && /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
15936
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-semibold", children: "Contato:" }),
15937
+ " ",
15938
+ conn.integration.Contato
15939
+ ] }),
15940
+ conn.integration.Sustentacao && /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
15941
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-semibold", children: "Sustenta\xE7\xE3o:" }),
15942
+ " ",
15943
+ conn.integration.Sustentacao
15944
+ ] })
15945
+ ] })
15946
+ ] }, conn.id)) })
15947
+ ] }),
15948
+ 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" }) })
15949
+ ] })
15705
15950
  ] })
15706
15951
  ]
15707
15952
  },
@@ -15719,7 +15964,7 @@ var Brush = ({
15719
15964
  xAxisKey,
15720
15965
  seriesOrder,
15721
15966
  finalColors,
15722
- brushHeight = 80,
15967
+ brushHeight = 40,
15723
15968
  brushColor,
15724
15969
  miniChartOpacity = 0.3
15725
15970
  }) => {
@@ -15943,16 +16188,76 @@ var ChartTotalLegend = ({ items }) => {
15943
16188
  ] }, index)) });
15944
16189
  };
15945
16190
  var ChartTotalLegend_default = ChartTotalLegend;
16191
+ var formatFieldName2 = (key) => {
16192
+ return key.replace(/([A-Z])/g, " $1").replace(/^./, (str) => str.toUpperCase()).trim();
16193
+ };
16194
+ var HorizontalLegend = ({
16195
+ allKeys,
16196
+ mapperConfig,
16197
+ finalColors,
16198
+ labelMap,
16199
+ legendUppercase = false,
16200
+ orderBy,
16201
+ maxPeriodLabel,
16202
+ minPeriodLabel,
16203
+ className
16204
+ }) => {
16205
+ const formatLegendLabel = (key) => {
16206
+ const label = mapperConfig[key]?.label ?? labelMap?.[key] ?? formatFieldName2(key);
16207
+ return legendUppercase ? label.toUpperCase() : label;
16208
+ };
16209
+ 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: [
16210
+ allKeys.map((key) => {
16211
+ const displayLabel = formatLegendLabel(key);
16212
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-1.5 sm:gap-2 flex-shrink-0", children: [
16213
+ /* @__PURE__ */ jsxRuntime.jsx(
16214
+ "div",
16215
+ {
16216
+ className: "w-2.5 h-2.5 sm:w-3 sm:h-3 rounded-sm flex-shrink-0",
16217
+ style: { backgroundColor: finalColors[key] }
16218
+ }
16219
+ ),
16220
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-xs sm:text-sm tracking-[0] whitespace-nowrap", children: displayLabel })
16221
+ ] }, key);
16222
+ }),
16223
+ 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: [
16224
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-1 sm:gap-1.5", children: [
16225
+ /* @__PURE__ */ jsxRuntime.jsx(
16226
+ react.FunnelSimpleIcon,
16227
+ {
16228
+ className: "w-3 h-3 sm:w-4 sm:h-4 text-green-600 flex-shrink-0",
16229
+ weight: "bold"
16230
+ }
16231
+ ),
16232
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-xs sm:text-sm tracking-[0] font-medium whitespace-nowrap", children: maxPeriodLabel })
16233
+ ] }),
16234
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-1 sm:gap-1.5", children: [
16235
+ /* @__PURE__ */ jsxRuntime.jsx(
16236
+ react.FunnelSimpleIcon,
16237
+ {
16238
+ className: "w-3 h-3 sm:w-4 sm:h-4 text-red-600 rotate-180 flex-shrink-0",
16239
+ weight: "bold"
16240
+ }
16241
+ ),
16242
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-xs sm:text-sm tracking-[0] font-medium whitespace-nowrap", children: minPeriodLabel })
16243
+ ] })
16244
+ ] })
16245
+ ] }) });
16246
+ };
16247
+ var HorizontalLegend_default = HorizontalLegend;
15946
16248
  var formatCompactNumber = (value) => {
15947
16249
  const isNegative = value < 0;
15948
16250
  const absValue = Math.abs(value);
15949
16251
  let formatted;
15950
16252
  if (absValue >= 1e9) {
15951
- formatted = (absValue / 1e9).toFixed(1).replace(/\.0$/, "") + "B";
16253
+ const billions = absValue / 1e9;
16254
+ formatted = (billions % 1 === 0 ? billions.toFixed(0) : billions.toFixed(1)) + "B";
15952
16255
  } else if (absValue >= 1e6) {
15953
- formatted = (absValue / 1e6).toFixed(1).replace(/\.0$/, "") + "M";
16256
+ const millions = absValue / 1e6;
16257
+ formatted = (millions % 1 === 0 ? millions.toFixed(0) : millions.toFixed(1)) + "M";
15954
16258
  } else if (absValue >= 1e3) {
15955
- formatted = (absValue / 1e3).toFixed(1).replace(/\.0$/, "") + " mil";
16259
+ const thousands = absValue / 1e3;
16260
+ formatted = (thousands % 1 === 0 ? thousands.toFixed(0) : thousands.toFixed(1)) + " mil";
15956
16261
  } else {
15957
16262
  try {
15958
16263
  const nf = new Intl.NumberFormat("pt-BR", {
@@ -16679,6 +16984,42 @@ function useTimeSeriesRange({
16679
16984
  handleMouseDown
16680
16985
  };
16681
16986
  }
16987
+ var useChartMinMax = ({
16988
+ processedData,
16989
+ orderBy,
16990
+ xAxisDataKey,
16991
+ categoryFormatter
16992
+ }) => {
16993
+ return React33.useMemo(() => {
16994
+ if (!processedData || processedData.length === 0 || !orderBy) {
16995
+ return {
16996
+ maxPeriodLabel: "",
16997
+ minPeriodLabel: ""
16998
+ };
16999
+ }
17000
+ let maxValue = -Infinity;
17001
+ let minValue = Infinity;
17002
+ let maxPeriodLabel = "";
17003
+ let minPeriodLabel = "";
17004
+ processedData.forEach((item) => {
17005
+ const value = Number(item[orderBy]) || 0;
17006
+ const periodName = String(item[xAxisDataKey] || "N/A");
17007
+ const formattedPeriod = categoryFormatter ? categoryFormatter(periodName) : periodName;
17008
+ if (value > maxValue) {
17009
+ maxValue = value;
17010
+ maxPeriodLabel = formattedPeriod;
17011
+ }
17012
+ if (value < minValue) {
17013
+ minValue = value;
17014
+ minPeriodLabel = formattedPeriod;
17015
+ }
17016
+ });
17017
+ return {
17018
+ maxPeriodLabel,
17019
+ minPeriodLabel
17020
+ };
17021
+ }, [processedData, orderBy, xAxisDataKey, categoryFormatter]);
17022
+ };
16682
17023
  var filtersOrder = (mapperConfig, series) => {
16683
17024
  const seriesOrder = [];
16684
17025
  if (series) {
@@ -16751,7 +17092,7 @@ var fnSmartConfig = ({ xAxis, data, labelMap }) => {
16751
17092
  return { xAxisConfig, mapperConfig };
16752
17093
  };
16753
17094
  var fnConfigRightKeys = (biaxialConfigNormalized, yTickFormatter, finalColors) => {
16754
- const decimals = typeof biaxialConfigNormalized?.decimals === "number" ? Math.max(0, Math.floor(biaxialConfigNormalized.decimals)) : 2;
17095
+ const decimals = typeof biaxialConfigNormalized?.decimals === "number" ? Math.max(0, Math.floor(biaxialConfigNormalized.decimals)) : 1;
16755
17096
  const rightTickFormatter = (v) => {
16756
17097
  if (biaxialConfigNormalized?.percentage) {
16757
17098
  const num = Number(String(v));
@@ -16801,6 +17142,11 @@ var fnContentLabelList = (p) => {
16801
17142
  const needsOutside = barHeight > 0 && barHeight < smallThreshold || barWidth > 0 && barWidth < smallThreshold;
16802
17143
  return needsOutside ? null : true;
16803
17144
  };
17145
+
17146
+ // src/utils/calcDivision.ts
17147
+ var calcDivision = (dividend, divisor) => {
17148
+ return dividend / divisor;
17149
+ };
16804
17150
  var DEFAULT_COLORS2 = ["#55af7d", "#8e68ff", "#2273e1"];
16805
17151
  var Chart = ({
16806
17152
  data,
@@ -16837,7 +17183,9 @@ var Chart = ({
16837
17183
  isLoading = false,
16838
17184
  timeSeries,
16839
17185
  timeSeriesLegend,
16840
- customLegend
17186
+ customLegend,
17187
+ horizontal = false,
17188
+ orderBy
16841
17189
  }) => {
16842
17190
  const { xAxisConfig, mapperConfig } = React33.useMemo(() => {
16843
17191
  return fnSmartConfig({ xAxis, data, labelMap });
@@ -16873,16 +17221,38 @@ var Chart = ({
16873
17221
  defaultEndIndex: timeSeriesConfig?.end,
16874
17222
  onRangeChange: timeSeriesConfig?.onRangeChange
16875
17223
  });
17224
+ const { maxPeriodLabel, minPeriodLabel } = useChartMinMax({
17225
+ processedData: data,
17226
+ orderBy,
17227
+ xAxisDataKey: xAxisConfig.dataKey,
17228
+ categoryFormatter
17229
+ });
16876
17230
  const processedData = React33.useMemo(() => {
16877
17231
  const mapped = data.map((item) => ({
16878
17232
  ...item,
16879
17233
  name: String(item[xAxisConfig.dataKey] || "N/A")
16880
17234
  }));
17235
+ let result = mapped;
16881
17236
  if (timeSeriesConfig) {
16882
- return mapped.slice(startIndex, endIndex + 1);
17237
+ result = mapped.slice(startIndex, endIndex + 1);
17238
+ }
17239
+ if (orderBy && horizontal) {
17240
+ result = [...result].sort((a, b) => {
17241
+ const valueA = Number(a[orderBy]) || 0;
17242
+ const valueB = Number(b[orderBy]) || 0;
17243
+ return valueB - valueA;
17244
+ });
16883
17245
  }
16884
- return mapped;
16885
- }, [data, xAxisConfig.dataKey, timeSeriesConfig, startIndex, endIndex]);
17246
+ return result;
17247
+ }, [
17248
+ data,
17249
+ xAxisConfig.dataKey,
17250
+ timeSeriesConfig,
17251
+ startIndex,
17252
+ endIndex,
17253
+ orderBy,
17254
+ horizontal
17255
+ ]);
16886
17256
  const seriesOrder = filtersOrder(mapperConfig, series);
16887
17257
  const allKeys = seriesOrder.map((s) => s.key).filter(Boolean);
16888
17258
  const finalColors = React33.useMemo(
@@ -16977,23 +17347,27 @@ var Chart = ({
16977
17347
  const CONTAINER_PADDING_LEFT = -6;
16978
17348
  const finalChartRightMargin = chartMargin?.right ?? (rightKeys.length > 0 ? AXIS_LABEL_MARGIN : 30);
16979
17349
  const finalChartLeftMargin = chartMargin?.left ?? (yAxisLabel ? AXIS_LABEL_MARGIN : 0);
16980
- const yAxisTickWidth = React33.useMemo(
16981
- () => computeYAxisTickWidth(
17350
+ const yAxisTickWidth = React33.useMemo(() => {
17351
+ if (horizontal) {
17352
+ if (typeof chartMargin?.left === "number") return chartMargin.left;
17353
+ return 130;
17354
+ }
17355
+ return computeYAxisTickWidth(
16982
17356
  chartMargin?.left,
16983
17357
  yAxisLabel,
16984
17358
  AXIS_LABEL_MARGIN,
16985
17359
  yTickFormatter,
16986
17360
  minLeftDataValue,
16987
17361
  niceMaxLeft
16988
- ),
16989
- [
16990
- chartMargin?.left,
16991
- yAxisLabel,
16992
- yTickFormatter,
16993
- minLeftDataValue,
16994
- niceMaxLeft
16995
- ]
16996
- );
17362
+ );
17363
+ }, [
17364
+ horizontal,
17365
+ chartMargin?.left,
17366
+ yAxisLabel,
17367
+ yTickFormatter,
17368
+ minLeftDataValue,
17369
+ niceMaxLeft
17370
+ ]);
16997
17371
  const HORIZONTAL_PADDING_CLASS = "px-24";
16998
17372
  const teste = "pl-24 pr-4";
16999
17373
  const effectiveChartWidth = typeof width === "number" ? width : measuredWidth ? Math.max(0, measuredWidth - 32) : computedWidth;
@@ -17035,20 +17409,52 @@ var Chart = ({
17035
17409
  );
17036
17410
  }
17037
17411
  if (Array.isArray(data) && data.length === 0) {
17038
- return /* @__PURE__ */ jsxRuntime.jsx(
17039
- NoData_default,
17040
- {
17041
- title,
17042
- paddingLeft: CONTAINER_PADDING_LEFT + finalChartLeftMargin,
17043
- height
17044
- }
17045
- );
17412
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
17413
+ /* @__PURE__ */ jsxRuntime.jsx(
17414
+ NoData_default,
17415
+ {
17416
+ title,
17417
+ paddingLeft: CONTAINER_PADDING_LEFT + finalChartLeftMargin,
17418
+ height
17419
+ }
17420
+ ),
17421
+ /* @__PURE__ */ jsxRuntime.jsx("div", { style: { height: 0 }, children: /* @__PURE__ */ jsxRuntime.jsxs("svg", { width: effectiveChartWidth, height, children: [
17422
+ xAxisLabel && /* @__PURE__ */ jsxRuntime.jsx(
17423
+ "text",
17424
+ {
17425
+ x: effectiveChartWidth - 40,
17426
+ y: height - 10,
17427
+ fontSize: 12,
17428
+ fill: "hsl(var(--muted-foreground))",
17429
+ fontWeight: 500,
17430
+ textAnchor: "end",
17431
+ children: xAxisLabel
17432
+ }
17433
+ ),
17434
+ yAxisLabel && /* @__PURE__ */ jsxRuntime.jsx(
17435
+ "text",
17436
+ {
17437
+ x: 20,
17438
+ y: 40,
17439
+ fontSize: 12,
17440
+ fill: "hsl(var(--muted-foreground))",
17441
+ fontWeight: 500,
17442
+ textAnchor: "start",
17443
+ transform: `rotate(-90 20 40)`,
17444
+ children: yAxisLabel
17445
+ }
17446
+ )
17447
+ ] }) })
17448
+ ] });
17046
17449
  }
17047
17450
  return /* @__PURE__ */ jsxRuntime.jsx(
17048
17451
  "div",
17049
17452
  {
17050
17453
  ref: wrapperRef,
17051
- className: cn("w-full overflow-hidden min-w-0 rounded-lg border-border", className),
17454
+ className: cn(
17455
+ "w-full overflow-hidden min-w-0 rounded-lg border-border",
17456
+ className
17457
+ ),
17052
17458
  children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-lg bg-card relative w-full max-w-full min-w-0 py-1", children: [
17053
17459
  title && /* @__PURE__ */ jsxRuntime.jsx(
17054
17460
  "div",
@@ -17145,303 +17551,417 @@ var Chart = ({
17145
17551
  )
17146
17552
  }
17147
17553
  ),
17148
- /* @__PURE__ */ jsxRuntime.jsx(recharts.ResponsiveContainer, { width: "100%", height, children: /* @__PURE__ */ jsxRuntime.jsxs(
17149
- recharts.ComposedChart,
17554
+ showLegend && horizontal && /* @__PURE__ */ jsxRuntime.jsx(
17555
+ HorizontalLegend_default,
17150
17556
  {
17151
- data: processedData,
17152
- height,
17153
- margin: {
17154
- top: 10,
17155
- right: finalChartRightMargin,
17156
- left: finalChartLeftMargin,
17157
- bottom: 10
17557
+ allKeys,
17558
+ mapperConfig,
17559
+ finalColors,
17560
+ labelMap,
17561
+ legendUppercase,
17562
+ orderBy,
17563
+ maxPeriodLabel,
17564
+ minPeriodLabel,
17565
+ className: cn(HORIZONTAL_PADDING_CLASS)
17566
+ }
17567
+ ),
17568
+ /* @__PURE__ */ jsxRuntime.jsx(
17569
+ "div",
17570
+ {
17571
+ className: cn(
17572
+ horizontal && "overflow-y-auto overflow-x-hidden px-6",
17573
+ horizontal && "scrollbar-thin scrollbar-thumb-muted scrollbar-track-transparent"
17574
+ ),
17575
+ style: {
17576
+ maxHeight: horizontal ? height : void 0
17158
17577
  },
17159
- onClick: handleChartClick,
17160
- children: [
17161
- /* @__PURE__ */ jsxRuntime.jsx("defs", { children: seriesOrder.filter((s) => s.type === "area").map((s) => {
17162
- const key = s.key;
17163
- const color = finalColors[key];
17164
- return /* @__PURE__ */ jsxRuntime.jsxs(
17165
- "linearGradient",
17578
+ children: /* @__PURE__ */ jsxRuntime.jsx(
17579
+ recharts.ResponsiveContainer,
17580
+ {
17581
+ width: "100%",
17582
+ height: horizontal ? Math.max(height, processedData.length * 50) : height,
17583
+ children: /* @__PURE__ */ jsxRuntime.jsxs(
17584
+ recharts.ComposedChart,
17166
17585
  {
17167
- id: `gradient-${key}`,
17168
- x1: "0",
17169
- y1: "0",
17170
- x2: "0",
17171
- y2: "0.8",
17586
+ data: processedData,
17587
+ height: horizontal ? Math.max(height, processedData.length * 50) : height,
17588
+ layout: horizontal ? "vertical" : "horizontal",
17589
+ margin: {
17590
+ top: 10,
17591
+ right: finalChartRightMargin,
17592
+ left: finalChartLeftMargin,
17593
+ bottom: 10
17594
+ },
17595
+ onClick: handleChartClick,
17172
17596
  children: [
17173
- /* @__PURE__ */ jsxRuntime.jsx("stop", { offset: "0%", stopColor: color, stopOpacity: 0.8 }),
17174
- /* @__PURE__ */ jsxRuntime.jsx("stop", { offset: "90%", stopColor: color, stopOpacity: 0.1 })
17175
- ]
17176
- },
17177
- `gradient-${key}`
17178
- );
17179
- }) }),
17180
- showGrid && /* @__PURE__ */ jsxRuntime.jsx(
17181
- recharts.CartesianGrid,
17182
- {
17183
- strokeDasharray: "3 3",
17184
- stroke: gridColor || "hsl(var(--muted-foreground))",
17185
- opacity: 0.5
17186
- }
17187
- ),
17188
- /* @__PURE__ */ jsxRuntime.jsx(
17189
- recharts.XAxis,
17190
- {
17191
- dataKey: xAxisConfig.dataKey,
17192
- stroke: "hsl(var(--muted-foreground))",
17193
- fontSize: 12,
17194
- tickLine: false,
17195
- axisLine: false,
17196
- tickFormatter: (value) => {
17197
- if (categoryFormatter)
17198
- return categoryFormatter(value);
17199
- if (xAxisConfig.valueFormatter)
17200
- return xAxisConfig.valueFormatter(value);
17201
- return String(value ?? "");
17202
- },
17203
- label: xAxisLabel ? {
17204
- value: xAxisLabel,
17205
- position: "insideBottomRight",
17206
- offset: -5,
17207
- style: {
17208
- fontSize: 12,
17209
- fill: "hsl(var(--muted-foreground))",
17210
- fontWeight: 500
17211
- }
17212
- } : void 0
17213
- }
17214
- ),
17215
- /* @__PURE__ */ jsxRuntime.jsx(
17216
- recharts.YAxis,
17217
- {
17218
- yAxisId: "left",
17219
- width: yAxisTickWidth,
17220
- stroke: "hsl(var(--muted-foreground))",
17221
- fontSize: 12,
17222
- tickLine: false,
17223
- axisLine: false,
17224
- tickFormatter: yTickFormatter,
17225
- domain: [Math.min(minLeftDataValue, 0), niceMaxLeft],
17226
- tickCount: 6,
17227
- label: yAxisLabel ? {
17228
- value: yAxisLabel,
17229
- angle: -90,
17230
- position: "left",
17231
- dx: leftYAxisLabelDx,
17232
- style: {
17233
- fontSize: 12,
17234
- fill: "hsl(var(--muted-foreground))",
17235
- fontWeight: 500,
17236
- textAnchor: "middle"
17237
- }
17238
- } : void 0
17239
- }
17240
- ),
17241
- minLeftDataValue < 0 && /* @__PURE__ */ jsxRuntime.jsx(
17242
- recharts.ReferenceLine,
17243
- {
17244
- y: 0,
17245
- yAxisId: "left",
17246
- stroke: "hsl(var(--muted-foreground))",
17247
- strokeWidth: 1,
17248
- strokeDasharray: "4 4"
17249
- }
17250
- ),
17251
- rightKeys.length > 0 && (() => {
17252
- const { rightAxisColor, rightTickFormatter } = fnConfigRightKeys(biaxialConfigNormalized, yTickFormatter, finalColors);
17253
- return /* @__PURE__ */ jsxRuntime.jsx(
17254
- recharts.YAxis,
17255
- {
17256
- yAxisId: "right",
17257
- width: finalChartRightMargin,
17258
- orientation: "right",
17259
- stroke: "hsl(var(--muted-foreground))",
17260
- fontSize: 12,
17261
- tickLine: false,
17262
- axisLine: false,
17263
- tick: { fill: rightAxisColor },
17264
- tickFormatter: rightTickFormatter,
17265
- domain: [Math.min(minRightDataValue, 0), niceMaxRight],
17266
- tickCount: 6,
17267
- label: biaxialConfigNormalized?.label ? {
17268
- value: biaxialConfigNormalized.label,
17269
- angle: -90,
17270
- position: "right",
17271
- dx: rightYAxisLabelDx,
17272
- style: {
17273
- fontSize: 12,
17274
- fill: "hsl(var(--muted-foreground))",
17275
- fontWeight: 500,
17276
- textAnchor: "middle"
17277
- }
17278
- } : void 0
17279
- }
17280
- );
17281
- })(),
17282
- showTooltip && /* @__PURE__ */ jsxRuntime.jsx(
17283
- recharts.Tooltip,
17284
- {
17285
- content: showTooltipTotal ? /* @__PURE__ */ jsxRuntime.jsx(
17286
- TooltipWithTotal_default,
17287
- {
17288
- finalColors,
17289
- valueFormatter: finalValueFormatter,
17290
- categoryFormatter,
17291
- periodLabel
17292
- }
17293
- ) : /* @__PURE__ */ jsxRuntime.jsx(
17294
- TooltipSimple_default,
17295
- {
17296
- finalColors,
17297
- valueFormatter: finalValueFormatter,
17298
- categoryFormatter,
17299
- periodLabel
17300
- }
17301
- ),
17302
- cursor: { fill: "hsl(var(--muted))", opacity: 0.1 }
17303
- }
17304
- ),
17305
- showLegend && /* @__PURE__ */ jsxRuntime.jsx(
17306
- recharts.Legend,
17307
- {
17308
- iconSize: 12,
17309
- formatter: (value) => {
17310
- return /* @__PURE__ */ jsxRuntime.jsx("span", { className: "tracking-[0]", children: fnFormatterValueLegend(
17311
- value,
17312
- mapperConfig,
17313
- labelMap,
17314
- legendUppercase
17315
- ) });
17316
- }
17317
- }
17318
- ),
17319
- seriesOrder.map((s) => {
17320
- if (showOnlyHighlighted && !highlightedSeries.has(s.key))
17321
- return null;
17322
- const { label, color, key } = fnBuildConfigData(
17323
- s,
17324
- mapperConfig,
17325
- labelMap,
17326
- finalColors,
17327
- rightKeys,
17328
- biaxialConfigNormalized
17329
- );
17330
- if (s.type === "bar") {
17331
- return /* @__PURE__ */ jsxRuntime.jsx(
17332
- recharts.Bar,
17333
- {
17334
- dataKey: key,
17335
- yAxisId: rightKeys.includes(key) ? "right" : "left",
17336
- name: label,
17337
- fill: color,
17338
- radius: [4, 4, 0, 0],
17339
- onClick: handleBarClick,
17340
- className: "cursor-pointer",
17341
- style: { opacity: getSeriesOpacity(key) },
17342
- activeBar: /* @__PURE__ */ jsxRuntime.jsx(
17343
- recharts.Rectangle,
17597
+ /* @__PURE__ */ jsxRuntime.jsx("defs", { children: seriesOrder.filter((s) => s.type === "area").map((s) => {
17598
+ const key = s.key;
17599
+ const color = finalColors[key];
17600
+ return /* @__PURE__ */ jsxRuntime.jsxs(
17601
+ "linearGradient",
17602
+ {
17603
+ id: `gradient-${key}`,
17604
+ x1: "0",
17605
+ y1: "0",
17606
+ x2: "0",
17607
+ y2: "0.8",
17608
+ children: [
17609
+ /* @__PURE__ */ jsxRuntime.jsx("stop", { offset: "0%", stopColor: color, stopOpacity: 0.8 }),
17610
+ /* @__PURE__ */ jsxRuntime.jsx(
17611
+ "stop",
17612
+ {
17613
+ offset: "90%",
17614
+ stopColor: color,
17615
+ stopOpacity: 0.1
17616
+ }
17617
+ )
17618
+ ]
17619
+ },
17620
+ `gradient-${key}`
17621
+ );
17622
+ }) }),
17623
+ showGrid && /* @__PURE__ */ jsxRuntime.jsx(
17624
+ recharts.CartesianGrid,
17344
17625
  {
17345
- fill: color,
17346
- stroke: color,
17347
- strokeWidth: 2,
17348
- opacity: 0.8
17626
+ strokeDasharray: "3 3",
17627
+ stroke: gridColor || "hsl(var(--muted-foreground))",
17628
+ opacity: 0.5
17349
17629
  }
17350
17630
  ),
17351
- children: showLabels && labelsVisibility.bar !== false && highlightedSeries.size === 0 || highlightedSeries.has(key) ? /* @__PURE__ */ jsxRuntime.jsx(
17352
- recharts.LabelList,
17631
+ horizontal ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
17632
+ /* @__PURE__ */ jsxRuntime.jsx(
17633
+ recharts.XAxis,
17634
+ {
17635
+ type: "number",
17636
+ orientation: "top",
17637
+ stroke: "hsl(var(--muted-foreground))",
17638
+ fontSize: 12,
17639
+ tickLine: false,
17640
+ axisLine: false,
17641
+ tickFormatter: yTickFormatter,
17642
+ domain: [Math.min(minLeftDataValue, 0), niceMaxLeft],
17643
+ tickCount: 6,
17644
+ label: yAxisLabel ? {
17645
+ value: yAxisLabel,
17646
+ position: "insideTopRight",
17647
+ offset: -5,
17648
+ style: {
17649
+ fontSize: 12,
17650
+ fill: "hsl(var(--muted-foreground))",
17651
+ fontWeight: 500
17652
+ }
17653
+ } : void 0
17654
+ }
17655
+ ),
17656
+ /* @__PURE__ */ jsxRuntime.jsx(
17657
+ recharts.YAxis,
17658
+ {
17659
+ type: "category",
17660
+ dataKey: xAxisConfig.dataKey,
17661
+ yAxisId: "left",
17662
+ width: yAxisTickWidth,
17663
+ stroke: "hsl(var(--muted-foreground))",
17664
+ fontSize: 11,
17665
+ tickLine: false,
17666
+ axisLine: false,
17667
+ tick: /* @__PURE__ */ jsxRuntime.jsx(CustomYAxisTick_default, { width: yAxisTickWidth - 10 }),
17668
+ tickFormatter: (value) => {
17669
+ if (categoryFormatter)
17670
+ return categoryFormatter(value);
17671
+ if (xAxisConfig.valueFormatter)
17672
+ return xAxisConfig.valueFormatter(
17673
+ value
17674
+ );
17675
+ return String(value ?? "");
17676
+ },
17677
+ label: xAxisLabel ? {
17678
+ value: xAxisLabel,
17679
+ angle: -90,
17680
+ position: "insideTop",
17681
+ dx: leftYAxisLabelDx,
17682
+ style: {
17683
+ fontSize: 12,
17684
+ fill: "hsl(var(--muted-foreground))",
17685
+ fontWeight: 500,
17686
+ textAnchor: "middle"
17687
+ }
17688
+ } : void 0
17689
+ }
17690
+ )
17691
+ ] }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
17692
+ /* @__PURE__ */ jsxRuntime.jsx(
17693
+ recharts.XAxis,
17694
+ {
17695
+ dataKey: xAxisConfig.dataKey,
17696
+ stroke: "hsl(var(--muted-foreground))",
17697
+ fontSize: 12,
17698
+ tickLine: false,
17699
+ axisLine: false,
17700
+ tickFormatter: (value) => {
17701
+ if (categoryFormatter)
17702
+ return categoryFormatter(value);
17703
+ if (xAxisConfig.valueFormatter)
17704
+ return xAxisConfig.valueFormatter(
17705
+ value
17706
+ );
17707
+ return String(value ?? "");
17708
+ },
17709
+ label: xAxisLabel ? {
17710
+ value: xAxisLabel,
17711
+ position: "insideBottomRight",
17712
+ offset: -5,
17713
+ style: {
17714
+ fontSize: 12,
17715
+ fill: "hsl(var(--muted-foreground))",
17716
+ fontWeight: 500
17717
+ }
17718
+ } : void 0
17719
+ }
17720
+ ),
17721
+ /* @__PURE__ */ jsxRuntime.jsx(
17722
+ recharts.YAxis,
17723
+ {
17724
+ yAxisId: "left",
17725
+ width: yAxisTickWidth,
17726
+ stroke: "hsl(var(--muted-foreground))",
17727
+ fontSize: 12,
17728
+ tickLine: false,
17729
+ axisLine: false,
17730
+ tickFormatter: yTickFormatter,
17731
+ domain: [Math.min(minLeftDataValue, 0), niceMaxLeft],
17732
+ tickCount: 6,
17733
+ label: yAxisLabel ? {
17734
+ value: yAxisLabel,
17735
+ angle: -90,
17736
+ position: "left",
17737
+ dx: leftYAxisLabelDx,
17738
+ style: {
17739
+ fontSize: 12,
17740
+ fill: "hsl(var(--muted-foreground))",
17741
+ fontWeight: 500,
17742
+ textAnchor: "middle"
17743
+ }
17744
+ } : void 0
17745
+ }
17746
+ )
17747
+ ] }),
17748
+ minLeftDataValue < 0 && /* @__PURE__ */ jsxRuntime.jsx(
17749
+ recharts.ReferenceLine,
17353
17750
  {
17354
- dataKey: key,
17355
- content: (props) => {
17356
- if (!fnContentLabelList(props))
17357
- return null;
17358
- const inside = renderInsideBarLabel(
17359
- color,
17360
- finalValueFormatter
17361
- );
17362
- return inside(props);
17363
- },
17364
- offset: 0
17751
+ y: 0,
17752
+ yAxisId: "left",
17753
+ stroke: "hsl(var(--muted-foreground))",
17754
+ strokeWidth: 1,
17755
+ strokeDasharray: "4 4"
17365
17756
  }
17366
- ) : null
17367
- },
17368
- `bar-${key}`
17369
- );
17370
- }
17371
- if (s.type === "line") {
17372
- return /* @__PURE__ */ jsxRuntime.jsx(
17373
- recharts.Line,
17374
- {
17375
- dataKey: key,
17376
- yAxisId: rightKeys.includes(key) ? "right" : "left",
17377
- name: label,
17378
- stroke: color,
17379
- strokeWidth: 2,
17380
- dot: { r: 3 },
17381
- activeDot: { r: 6 },
17382
- onClick: handleSeriesClick,
17383
- className: "cursor-pointer pointer-events-auto",
17384
- style: { opacity: getSeriesOpacity(key) },
17385
- children: showLabels && labelsVisibility.line !== false && highlightedSeries.size === 0 || highlightedSeries.has(key) ? /* @__PURE__ */ jsxRuntime.jsx(
17386
- recharts.LabelList,
17757
+ ),
17758
+ rightKeys.length > 0 && (() => {
17759
+ const { rightAxisColor, rightTickFormatter } = fnConfigRightKeys(
17760
+ biaxialConfigNormalized,
17761
+ yTickFormatter,
17762
+ finalColors
17763
+ );
17764
+ return /* @__PURE__ */ jsxRuntime.jsx(
17765
+ recharts.YAxis,
17766
+ {
17767
+ yAxisId: "right",
17768
+ width: finalChartRightMargin,
17769
+ orientation: "right",
17770
+ stroke: "hsl(var(--muted-foreground))",
17771
+ fontSize: 12,
17772
+ tickLine: false,
17773
+ axisLine: false,
17774
+ tick: { fill: rightAxisColor },
17775
+ tickFormatter: rightTickFormatter,
17776
+ domain: [Math.min(minRightDataValue, 0), niceMaxRight],
17777
+ tickCount: 6,
17778
+ label: biaxialConfigNormalized?.label ? {
17779
+ value: biaxialConfigNormalized.label,
17780
+ angle: -90,
17781
+ position: "right",
17782
+ dx: rightYAxisLabelDx,
17783
+ style: {
17784
+ fontSize: 12,
17785
+ fill: "hsl(var(--muted-foreground))",
17786
+ fontWeight: 500,
17787
+ textAnchor: "middle"
17788
+ }
17789
+ } : void 0
17790
+ }
17791
+ );
17792
+ })(),
17793
+ showTooltip && /* @__PURE__ */ jsxRuntime.jsx(
17794
+ recharts.Tooltip,
17387
17795
  {
17388
- dataKey: key,
17389
- position: "top",
17390
- content: pillLabelRenderer_default(
17391
- color,
17392
- "filled",
17393
- finalValueFormatter
17796
+ content: showTooltipTotal ? /* @__PURE__ */ jsxRuntime.jsx(
17797
+ TooltipWithTotal_default,
17798
+ {
17799
+ finalColors,
17800
+ valueFormatter: finalValueFormatter,
17801
+ categoryFormatter,
17802
+ periodLabel
17803
+ }
17804
+ ) : /* @__PURE__ */ jsxRuntime.jsx(
17805
+ TooltipSimple_default,
17806
+ {
17807
+ finalColors,
17808
+ valueFormatter: finalValueFormatter,
17809
+ categoryFormatter,
17810
+ periodLabel
17811
+ }
17394
17812
  ),
17395
- offset: 14
17813
+ cursor: { fill: "hsl(var(--muted))", opacity: 0.1 }
17396
17814
  }
17397
- ) : null
17398
- },
17399
- `line-${key}`
17400
- );
17401
- }
17402
- if (s.type === "area") {
17403
- return /* @__PURE__ */ jsxRuntime.jsx(
17404
- recharts.Area,
17405
- {
17406
- type: "monotone",
17407
- dataKey: key,
17408
- yAxisId: rightKeys.includes(key) ? "right" : "left",
17409
- name: label,
17410
- stroke: color,
17411
- fill: `url(#gradient-${key})`,
17412
- fillOpacity: 1,
17413
- strokeWidth: 2,
17414
- onClick: handleSeriesClick,
17415
- className: "cursor-pointer pointer-events-auto",
17416
- style: { opacity: getSeriesOpacity(key) },
17417
- activeDot: {
17418
- r: 6,
17419
- fill: color,
17420
- stroke: "hsl(var(--background))",
17421
- strokeWidth: 2
17422
- },
17423
- children: showLabels && labelsVisibility.area !== false && highlightedSeries.size === 0 || highlightedSeries.has(key) ? /* @__PURE__ */ jsxRuntime.jsx(
17424
- recharts.LabelList,
17815
+ ),
17816
+ showLegend && !horizontal && /* @__PURE__ */ jsxRuntime.jsx(
17817
+ recharts.Legend,
17425
17818
  {
17426
- dataKey: key,
17427
- position: "top",
17428
- content: pillLabelRenderer_default(
17429
- color,
17430
- "soft",
17431
- finalValueFormatter
17432
- ),
17433
- offset: 12
17819
+ iconSize: 12,
17820
+ formatter: (value) => {
17821
+ return /* @__PURE__ */ jsxRuntime.jsx("span", { className: "tracking-[0] rounded-sm", children: fnFormatterValueLegend(
17822
+ value,
17823
+ mapperConfig,
17824
+ labelMap,
17825
+ legendUppercase
17826
+ ) });
17827
+ }
17434
17828
  }
17435
- ) : null
17436
- },
17437
- `area-${key}`
17438
- );
17439
- }
17440
- return null;
17441
- })
17442
- ]
17829
+ ),
17830
+ seriesOrder.map((s) => {
17831
+ if (showOnlyHighlighted && !highlightedSeries.has(s.key))
17832
+ return null;
17833
+ const { label, color, key } = fnBuildConfigData(
17834
+ s,
17835
+ mapperConfig,
17836
+ labelMap,
17837
+ finalColors,
17838
+ rightKeys,
17839
+ biaxialConfigNormalized
17840
+ );
17841
+ if (s.type === "bar") {
17842
+ return /* @__PURE__ */ jsxRuntime.jsx(
17843
+ recharts.Bar,
17844
+ {
17845
+ dataKey: key,
17846
+ yAxisId: rightKeys.includes(key) ? "right" : "left",
17847
+ name: label,
17848
+ fill: color,
17849
+ radius: horizontal ? [0, 4, 4, 0] : [4, 4, 0, 0],
17850
+ onClick: handleBarClick,
17851
+ className: "cursor-pointer",
17852
+ style: { opacity: getSeriesOpacity(key) },
17853
+ activeBar: /* @__PURE__ */ jsxRuntime.jsx(
17854
+ recharts.Rectangle,
17855
+ {
17856
+ fill: color,
17857
+ stroke: color,
17858
+ strokeWidth: 2,
17859
+ opacity: 0.8
17860
+ }
17861
+ ),
17862
+ children: showLabels && labelsVisibility.bar !== false && highlightedSeries.size === 0 || highlightedSeries.has(key) ? /* @__PURE__ */ jsxRuntime.jsx(
17863
+ recharts.LabelList,
17864
+ {
17865
+ dataKey: key,
17866
+ content: (props) => {
17867
+ if (!fnContentLabelList(props)) return null;
17868
+ const inside = renderInsideBarLabel(
17869
+ color,
17870
+ finalValueFormatter
17871
+ );
17872
+ return inside(props);
17873
+ },
17874
+ offset: 0
17875
+ }
17876
+ ) : null
17877
+ },
17878
+ `bar-${key}`
17879
+ );
17880
+ }
17881
+ if (s.type === "line") {
17882
+ const lineFormatter = (props) => {
17883
+ const numValue = typeof props.value === "number" ? props.value : typeof props.value === "string" ? parseFloat(props.value) : 0;
17884
+ const percentage = calcDivision(numValue, 100);
17885
+ const formattedPercentage = typeof percentage === "number" ? percentage.toFixed(1).replace(".", ",") : String(percentage).replace(".", ",");
17886
+ return `${formattedPercentage}%`;
17887
+ };
17888
+ return /* @__PURE__ */ jsxRuntime.jsx(
17889
+ recharts.Line,
17890
+ {
17891
+ dataKey: key,
17892
+ yAxisId: rightKeys.includes(key) ? "right" : "left",
17893
+ name: label,
17894
+ stroke: color,
17895
+ strokeWidth: 2,
17896
+ dot: { r: 3 },
17897
+ activeDot: { r: 6 },
17898
+ onClick: handleSeriesClick,
17899
+ className: "cursor-pointer pointer-events-auto",
17900
+ style: { opacity: getSeriesOpacity(key) },
17901
+ children: showLabels && labelsVisibility.line !== false && highlightedSeries.size === 0 || highlightedSeries.has(key) ? /* @__PURE__ */ jsxRuntime.jsx(
17902
+ recharts.LabelList,
17903
+ {
17904
+ dataKey: key,
17905
+ position: "top",
17906
+ content: pillLabelRenderer_default(
17907
+ color,
17908
+ "filled",
17909
+ lineFormatter
17910
+ ),
17911
+ offset: 14
17912
+ }
17913
+ ) : null
17914
+ },
17915
+ `line-${key}`
17916
+ );
17917
+ }
17918
+ if (s.type === "area") {
17919
+ return /* @__PURE__ */ jsxRuntime.jsx(
17920
+ recharts.Area,
17921
+ {
17922
+ type: "monotone",
17923
+ dataKey: key,
17924
+ yAxisId: rightKeys.includes(key) ? "right" : "left",
17925
+ name: label,
17926
+ stroke: color,
17927
+ fill: `url(#gradient-${key})`,
17928
+ fillOpacity: 1,
17929
+ strokeWidth: 2,
17930
+ onClick: handleSeriesClick,
17931
+ className: "cursor-pointer pointer-events-auto",
17932
+ style: { opacity: getSeriesOpacity(key) },
17933
+ activeDot: {
17934
+ r: 6,
17935
+ fill: color,
17936
+ stroke: "hsl(var(--background))",
17937
+ strokeWidth: 2
17938
+ },
17939
+ children: showLabels && labelsVisibility.area !== false && highlightedSeries.size === 0 || highlightedSeries.has(key) ? /* @__PURE__ */ jsxRuntime.jsx(
17940
+ recharts.LabelList,
17941
+ {
17942
+ dataKey: key,
17943
+ position: "top",
17944
+ content: pillLabelRenderer_default(
17945
+ color,
17946
+ "soft",
17947
+ finalValueFormatter
17948
+ ),
17949
+ offset: 12
17950
+ }
17951
+ ) : null
17952
+ },
17953
+ `area-${key}`
17954
+ );
17955
+ }
17956
+ return null;
17957
+ })
17958
+ ]
17959
+ }
17960
+ )
17961
+ }
17962
+ )
17443
17963
  }
17444
- ) }),
17964
+ ),
17445
17965
  enableDraggableTooltips && activeTooltips.map((tooltip) => /* @__PURE__ */ jsxRuntime.jsx(
17446
17966
  DraggableTooltip_default,
17447
17967
  {
@@ -18019,6 +18539,7 @@ exports.FileUploader = FileUploader;
18019
18539
  exports.FilterButton = FilterButton;
18020
18540
  exports.HideButton = HideButton;
18021
18541
  exports.Highlights = Highlights_default;
18542
+ exports.HorizontalLegend = HorizontalLegend_default;
18022
18543
  exports.HoverCardBase = HoverCardBase;
18023
18544
  exports.HoverCardContentBase = HoverCardContentBase;
18024
18545
  exports.HoverCardTriggerBase = HoverCardTriggerBase;
@@ -18244,6 +18765,7 @@ exports.useCalendarDndAgenda = useCalendarDndAgenda;
18244
18765
  exports.useChartClick = useChartClick;
18245
18766
  exports.useChartDimensions = useChartDimensions;
18246
18767
  exports.useChartHighlights = useChartHighlights;
18768
+ exports.useChartMinMax = useChartMinMax;
18247
18769
  exports.useChartTooltips = useChartTooltips;
18248
18770
  exports.useCurrentTimeIndicator = useCurrentTimeIndicator;
18249
18771
  exports.useCurrentTimeIndicatorAgenda = useCurrentTimeIndicatorAgenda;