@mlw-packages/react-components 1.8.5 → 1.8.6

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
@@ -515,6 +515,7 @@ __export(index_exports, {
515
515
  BreadcrumbListBase: () => BreadcrumbListBase,
516
516
  BreadcrumbPageBase: () => BreadcrumbPageBase,
517
517
  BreadcrumbSeparatorBase: () => BreadcrumbSeparatorBase,
518
+ Brush: () => Brush_default,
518
519
  ButtonBase: () => ButtonBase,
519
520
  ButtonGroupBase: () => ButtonGroupBase,
520
521
  CalendarBase: () => CalendarBase,
@@ -768,6 +769,7 @@ __export(index_exports, {
768
769
  ThemeProviderBase: () => ThemeProviderBase,
769
770
  TimePicker: () => TimePicker,
770
771
  TimePickerInput: () => TimePickerInput,
772
+ TimeSeries: () => TimeSeries_default,
771
773
  Toaster: () => Toaster,
772
774
  TooltipBase: () => TooltipBase,
773
775
  TooltipContentBase: () => TooltipContentBase,
@@ -863,6 +865,7 @@ __export(index_exports, {
863
865
  useEventVisibilityAgenda: () => useEventVisibilityAgenda,
864
866
  useIsMobile: () => useIsMobile,
865
867
  useTheme: () => useTheme,
868
+ useTimeSeriesRange: () => useTimeSeriesRange,
866
869
  visualForItem: () => visualForItem
867
870
  });
868
871
  module.exports = __toCommonJS(index_exports);
@@ -1555,45 +1558,55 @@ function SkeletonBase({
1555
1558
  var import_react2 = require("@phosphor-icons/react");
1556
1559
  var import_sonner = require("sonner");
1557
1560
  var import_jsx_runtime7 = require("react/jsx-runtime");
1558
- var iconBaseClass = "w-5 h-auto";
1561
+ var iconBaseClass = "w-5 h-5";
1559
1562
  var Toaster = ({ testId, ...props }) => {
1560
1563
  return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1561
1564
  import_sonner.Toaster,
1562
1565
  {
1563
1566
  className: "toaster group",
1564
1567
  position: "top-center",
1568
+ duration: 4e3,
1565
1569
  toastOptions: {
1570
+ style: {
1571
+ backdropFilter: "blur(8px)",
1572
+ WebkitBackdropFilter: "blur(8px)"
1573
+ },
1566
1574
  classNames: {
1567
1575
  toast: `
1568
1576
  group toast
1569
- bg-background
1577
+ bg-background/95
1570
1578
  text-foreground
1571
- shadow-lg rounded-md
1579
+ shadow-xl rounded-lg
1572
1580
  border-l-4
1573
1581
  border-border
1574
1582
  flex items-center gap-3
1575
- data-[type=success]:border-l-green-500 data-[type=success]:bg-green-50 data-[type=success]:text-green-800 data-[type=success]:border-green-500
1576
- data-[type=error]:border-l-red-500 data-[type=error]:bg-red-50 data-[type=error]:text-red-800 data-[type=error]:border-red-500
1577
- data-[type=WarningIcon]:border-l-yellow-500 data-[type=WarningIcon]:bg-yellow-50 data-[type=WarningIcon]:text-yellow-800 data-[type=WarningIcon]:border-yellow-500
1578
- data-[type=InfoIcon]:border-l-blue-500 data-[type=InfoIcon]:bg-blue-50 data-[type=InfoIcon]:text-blue-800 data-[type=InfoIcon]:border-blue-500
1583
+ transition-all duration-300
1584
+ hover:scale-[1.02] hover:shadow-2xl
1585
+ data-[type=success]:border-l-green-500 data-[type=success]:bg-green-50/95 data-[type=success]:text-green-800 data-[type=success]:border-green-500
1586
+ data-[type=error]:border-l-red-500 data-[type=error]:bg-red-50/95 data-[type=error]:text-red-800 data-[type=error]:border-red-500
1587
+ data-[type=warning]:border-l-yellow-500 data-[type=warning]:bg-yellow-50/95 data-[type=warning]:text-yellow-800 data-[type=warning]:border-yellow-500
1588
+ data-[type=info]:border-l-blue-500 data-[type=info]:bg-blue-50/95 data-[type=info]:text-blue-800 data-[type=info]:border-blue-500
1579
1589
  `,
1580
1590
  description: `
1581
- text-sm
1591
+ text-xs
1592
+ font-semibold
1582
1593
  group-[.toast]:text-neutral-600
1583
1594
  `,
1584
1595
  actionButton: `
1585
1596
  ml-auto
1586
1597
  rounded-md px-3 py-1 text-sm font-semibold
1587
1598
  bg-neutral-800 text-white
1588
- hover:bg-neutral-700
1589
- transition-colors duration-200
1599
+ hover:bg-neutral-700 hover:scale-105
1600
+ transition-all duration-200
1601
+ active:scale-95
1590
1602
  `,
1591
1603
  cancelButton: `
1592
1604
  ml-2
1593
1605
  rounded-md px-3 py-1 text-sm font-semibold
1594
1606
  bg-neutral-100 text-neutral-700
1595
- hover:bg-neutral-200
1596
- transition-colors duration-200
1607
+ hover:bg-neutral-200 hover:scale-105
1608
+ transition-all duration-200
1609
+ active:scale-95
1597
1610
  `
1598
1611
  }
1599
1612
  },
@@ -1603,24 +1616,52 @@ var Toaster = ({ testId, ...props }) => {
1603
1616
  );
1604
1617
  };
1605
1618
  var toast = {
1606
- success: (message) => import_sonner.toast.success(message, {
1607
- icon: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_react2.CheckCircleIcon, { className: `${iconBaseClass} text-green-600`, weight: "fill" }),
1619
+ success: (message, description) => import_sonner.toast.success(message, {
1620
+ description,
1621
+ icon: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1622
+ import_react2.CheckCircleIcon,
1623
+ {
1624
+ className: `${iconBaseClass} text-green-600`,
1625
+ weight: "fill"
1626
+ }
1627
+ ),
1608
1628
  className: "sonner-success"
1609
1629
  }),
1610
- error: (message) => import_sonner.toast.error(message, {
1611
- icon: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_react2.XCircleIcon, { className: `${iconBaseClass} text-red-600`, weight: "fill" }),
1630
+ error: (message, description) => import_sonner.toast.error(message, {
1631
+ description,
1632
+ icon: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1633
+ import_react2.XCircleIcon,
1634
+ {
1635
+ className: `${iconBaseClass} text-red-600`,
1636
+ weight: "fill"
1637
+ }
1638
+ ),
1612
1639
  className: "sonner-error"
1613
1640
  }),
1614
- warning: (message) => import_sonner.toast.warning(message, {
1615
- icon: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_react2.WarningIcon, { className: `${iconBaseClass} text-yellow-600`, weight: "fill" }),
1616
- className: "sonner-WarningIcon"
1641
+ warning: (message, description) => import_sonner.toast.warning(message, {
1642
+ description,
1643
+ icon: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1644
+ import_react2.WarningIcon,
1645
+ {
1646
+ className: `${iconBaseClass} text-yellow-600`,
1647
+ weight: "fill"
1648
+ }
1649
+ ),
1650
+ className: "sonner-warning"
1617
1651
  }),
1618
- info: (message) => import_sonner.toast.info(message, {
1652
+ info: (message, description) => import_sonner.toast.info(message, {
1653
+ description,
1619
1654
  icon: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_react2.InfoIcon, { className: `${iconBaseClass} text-blue-600`, weight: "fill" }),
1620
- className: "sonner-InfoIcon"
1655
+ className: "sonner-info"
1621
1656
  }),
1622
- loading: (message) => (0, import_sonner.toast)(message, {
1623
- icon: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_react2.SpinnerIcon, { className: `${iconBaseClass} animate-spin text-neutral-500`, weight: "fill" }),
1657
+ loading: (message, description) => (0, import_sonner.toast)(message, {
1658
+ description,
1659
+ icon: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1660
+ import_react2.CircleNotchIcon,
1661
+ {
1662
+ className: `${iconBaseClass} animate-spin text-gray-600`
1663
+ }
1664
+ ),
1624
1665
  className: "sonner-loading"
1625
1666
  })
1626
1667
  };
@@ -1768,12 +1809,21 @@ var TooltipTriggerBase = React7.forwardRef(({ children, onPointerDown, ...props
1768
1809
  },
1769
1810
  [onPointerDown]
1770
1811
  );
1812
+ const onClick = React7.useCallback(
1813
+ (e) => {
1814
+ if (onPointerDown) {
1815
+ onPointerDown(e);
1816
+ }
1817
+ },
1818
+ [onPointerDown]
1819
+ );
1771
1820
  return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1772
1821
  TooltipPrimitive.Trigger,
1773
1822
  {
1774
1823
  ref,
1775
1824
  tabIndex: -1,
1776
1825
  onPointerDown: onPointerDown ? handlePointerDown : void 0,
1826
+ onClick,
1777
1827
  "data-tooltip-trigger": true,
1778
1828
  "aria-describedby": "tooltip-content",
1779
1829
  ...props,
@@ -3139,8 +3189,7 @@ function MultiCombobox({
3139
3189
  )
3140
3190
  ]
3141
3191
  }
3142
- ),
3143
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ErrorMessage_default, { error })
3192
+ )
3144
3193
  ]
3145
3194
  }
3146
3195
  );
@@ -7953,7 +8002,7 @@ function CalendarBase2({
7953
8002
  selected: "bg-primary text-primary-foreground hover:bg-primary/90 focus:bg-primary/90 font-semibold hover:text-white rounded-md",
7954
8003
  today: "bg-muted text-foreground font-bold ring-2 ring-primary/30 ring-inset rounded-md",
7955
8004
  outside: "text-muted-foreground opacity-60 aria-selected:bg-muted/50 aria-selected:text-foreground",
7956
- disabled: "text-muted-foreground cursor-not-allowed line-through decoration-2",
8005
+ disabled: "text-muted-foreground cursor-not-allowed",
7957
8006
  range_middle: "aria-selected:bg-muted aria-selected:text-foreground",
7958
8007
  hidden: "invisible",
7959
8008
  ...classNames
@@ -14592,13 +14641,13 @@ function MultiSelect({
14592
14641
  }
14593
14642
 
14594
14643
  // src/components/ui/charts/Chart.tsx
14595
- var import_react96 = require("react");
14596
- var import_recharts = require("recharts");
14644
+ var import_react97 = require("react");
14645
+ var import_recharts2 = require("recharts");
14597
14646
 
14598
14647
  // src/components/ui/charts/utils/helpers.ts
14599
14648
  var formatFieldName = (fieldName) => {
14600
14649
  return fieldName.split(/[/_-]/).filter(Boolean).map((word) => {
14601
- return word.charAt(0).toUpperCase() + word.slice(1).toLowerCase();
14650
+ return word.charAt(0).toUpperCase() + word.slice(1);
14602
14651
  }).join(" ").trim();
14603
14652
  };
14604
14653
  var detectDataFields = (data, xAxisKey) => {
@@ -16153,8 +16202,205 @@ var TooltipSimple = ({
16153
16202
  };
16154
16203
  var TooltipSimple_default = TooltipSimple;
16155
16204
 
16156
- // src/components/ui/charts/utils/pillLabelRenderer.tsx
16205
+ // src/components/ui/charts/components/Brush.tsx
16206
+ var import_recharts = require("recharts");
16157
16207
  var import_jsx_runtime94 = require("react/jsx-runtime");
16208
+ var Brush = ({
16209
+ data,
16210
+ startIndex,
16211
+ endIndex,
16212
+ onMouseDown,
16213
+ brushRef,
16214
+ xAxisKey,
16215
+ seriesOrder,
16216
+ finalColors,
16217
+ brushHeight = 80,
16218
+ brushColor,
16219
+ miniChartOpacity = 0.3,
16220
+ margin = { left: 0, right: 0 }
16221
+ }) => {
16222
+ const dataLength = data.length;
16223
+ return /* @__PURE__ */ (0, import_jsx_runtime94.jsxs)("div", { className: "w-full px-8 pb-4", children: [
16224
+ /* @__PURE__ */ (0, import_jsx_runtime94.jsxs)(
16225
+ "div",
16226
+ {
16227
+ className: "relative rounded-md border bg-muted/5 shadow-inner",
16228
+ style: { height: brushHeight },
16229
+ children: [
16230
+ /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
16231
+ "div",
16232
+ {
16233
+ className: "absolute inset-0 pointer-events-none rounded-md",
16234
+ style: { opacity: miniChartOpacity },
16235
+ children: /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(import_recharts.ResponsiveContainer, { width: "100%", height: brushHeight, children: /* @__PURE__ */ (0, import_jsx_runtime94.jsxs)(
16236
+ import_recharts.ComposedChart,
16237
+ {
16238
+ data: data.map((item) => ({
16239
+ ...item,
16240
+ name: String(item[xAxisKey] || "N/A")
16241
+ })),
16242
+ height: brushHeight,
16243
+ margin: {
16244
+ top: 5,
16245
+ right: margin.right ?? 30,
16246
+ left: margin.left ?? 0,
16247
+ bottom: 5
16248
+ },
16249
+ children: [
16250
+ /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(import_recharts.XAxis, { dataKey: xAxisKey, hide: true }),
16251
+ /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(import_recharts.YAxis, { yAxisId: "left", hide: true }),
16252
+ seriesOrder.map((s) => {
16253
+ const key = s.key;
16254
+ const color = finalColors[key];
16255
+ if (s.type === "bar") {
16256
+ return /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
16257
+ import_recharts.Bar,
16258
+ {
16259
+ dataKey: key,
16260
+ yAxisId: "left",
16261
+ fill: color,
16262
+ radius: [2, 2, 0, 0]
16263
+ },
16264
+ `brush-bar-${key}`
16265
+ );
16266
+ }
16267
+ if (s.type === "line") {
16268
+ return /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
16269
+ import_recharts.Line,
16270
+ {
16271
+ type: "monotone",
16272
+ dataKey: key,
16273
+ yAxisId: "left",
16274
+ stroke: color,
16275
+ strokeWidth: 1.5,
16276
+ dot: false
16277
+ },
16278
+ `brush-line-${key}`
16279
+ );
16280
+ }
16281
+ if (s.type === "area") {
16282
+ return /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
16283
+ import_recharts.Area,
16284
+ {
16285
+ type: "monotone",
16286
+ dataKey: key,
16287
+ yAxisId: "left",
16288
+ stroke: color,
16289
+ fill: `url(#gradient-${key})`,
16290
+ strokeWidth: 1.5
16291
+ },
16292
+ `brush-area-${key}`
16293
+ );
16294
+ }
16295
+ return null;
16296
+ })
16297
+ ]
16298
+ }
16299
+ ) })
16300
+ }
16301
+ ),
16302
+ /* @__PURE__ */ (0, import_jsx_runtime94.jsxs)(
16303
+ "div",
16304
+ {
16305
+ ref: brushRef,
16306
+ className: "absolute inset-0 cursor-move rounded-md",
16307
+ style: { userSelect: "none" },
16308
+ children: [
16309
+ /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
16310
+ "div",
16311
+ {
16312
+ className: "absolute top-0 bottom-0 left-0 bg-muted/60 pointer-events-none rounded-md",
16313
+ style: {
16314
+ width: `${startIndex / (dataLength - 1) * 100}%`
16315
+ }
16316
+ }
16317
+ ),
16318
+ /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
16319
+ "div",
16320
+ {
16321
+ className: "absolute top-0 bottom-0 right-0 bg-muted/60 pointer-events-none rounded-md",
16322
+ style: {
16323
+ width: `${(dataLength - 1 - endIndex) / (dataLength - 1) * 100}%`
16324
+ }
16325
+ }
16326
+ ),
16327
+ /* @__PURE__ */ (0, import_jsx_runtime94.jsxs)(
16328
+ "div",
16329
+ {
16330
+ className: "absolute top-0 bottom-0 border cursor-move group rounded-md border-primary/30",
16331
+ style: {
16332
+ left: `${startIndex / (dataLength - 1) * 100}%`,
16333
+ right: `${(dataLength - 1 - endIndex) / (dataLength - 1) * 100}%`,
16334
+ backgroundColor: "hsl(var(--primary) / 0.03)"
16335
+ },
16336
+ onMouseDown: (e) => onMouseDown(e, "middle"),
16337
+ children: [
16338
+ /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
16339
+ "div",
16340
+ {
16341
+ className: "absolute top-1/2 -translate-y-1/2 -left-3 w-6 h-10 flex items-center justify-center cursor-ew-resize active:scale-95 transition-all",
16342
+ onMouseDown: (e) => {
16343
+ e.stopPropagation();
16344
+ onMouseDown(e, "start");
16345
+ },
16346
+ children: /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
16347
+ "div",
16348
+ {
16349
+ className: "w-2 h-7 rounded-full shadow-md ring-2 ring-background flex flex-col items-center justify-center gap-0.5",
16350
+ style: {
16351
+ backgroundColor: brushColor ?? "hsl(var(--primary) / 0.7)"
16352
+ }
16353
+ }
16354
+ )
16355
+ }
16356
+ ),
16357
+ /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
16358
+ "div",
16359
+ {
16360
+ className: "absolute top-1/2 -translate-y-1/2 -right-3 w-6 h-10 flex items-center justify-center cursor-ew-resize active:scale-95 transition-all",
16361
+ onMouseDown: (e) => {
16362
+ e.stopPropagation();
16363
+ onMouseDown(e, "end");
16364
+ },
16365
+ children: /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
16366
+ "div",
16367
+ {
16368
+ className: "w-2 h-7 rounded-full shadow-md ring-2 ring-background flex flex-col items-center justify-center gap-0.5",
16369
+ style: {
16370
+ backgroundColor: brushColor ?? "hsl(var(--primary) / 0.7)"
16371
+ }
16372
+ }
16373
+ )
16374
+ }
16375
+ )
16376
+ ]
16377
+ }
16378
+ )
16379
+ ]
16380
+ }
16381
+ )
16382
+ ]
16383
+ }
16384
+ ),
16385
+ /* @__PURE__ */ (0, import_jsx_runtime94.jsxs)("div", { className: "flex justify-between items-center mt-2 text-xs text-muted-foreground", children: [
16386
+ /* @__PURE__ */ (0, import_jsx_runtime94.jsxs)("span", { children: [
16387
+ data[startIndex]?.[xAxisKey],
16388
+ " - ",
16389
+ data[endIndex]?.[xAxisKey]
16390
+ ] }),
16391
+ /* @__PURE__ */ (0, import_jsx_runtime94.jsxs)("span", { children: [
16392
+ endIndex - startIndex + 1,
16393
+ " de ",
16394
+ dataLength,
16395
+ " per\xEDodos"
16396
+ ] })
16397
+ ] })
16398
+ ] });
16399
+ };
16400
+ var Brush_default = Brush;
16401
+
16402
+ // src/components/ui/charts/utils/pillLabelRenderer.tsx
16403
+ var import_jsx_runtime95 = require("react/jsx-runtime");
16158
16404
  var formatCompactNumber = (value) => {
16159
16405
  const isNegative = value < 0;
16160
16406
  const absValue = Math.abs(value);
@@ -16245,8 +16491,8 @@ var renderPillLabel = (color, variant, valueFormatter2) => {
16245
16491
  } else {
16246
16492
  textColor = "#374151";
16247
16493
  }
16248
- return /* @__PURE__ */ (0, import_jsx_runtime94.jsxs)("g", { children: [
16249
- /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
16494
+ return /* @__PURE__ */ (0, import_jsx_runtime95.jsxs)("g", { children: [
16495
+ /* @__PURE__ */ (0, import_jsx_runtime95.jsx)(
16250
16496
  "rect",
16251
16497
  {
16252
16498
  x: rectX,
@@ -16259,7 +16505,7 @@ var renderPillLabel = (color, variant, valueFormatter2) => {
16259
16505
  strokeWidth: rectStroke ? 1 : 0
16260
16506
  }
16261
16507
  ),
16262
- /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
16508
+ /* @__PURE__ */ (0, import_jsx_runtime95.jsx)(
16263
16509
  "text",
16264
16510
  {
16265
16511
  x: textX,
@@ -16330,7 +16576,7 @@ var renderInsideBarLabel = (color, valueFormatter2) => {
16330
16576
  const heightFactor = Math.max(0.8, Math.min(1.6, pHeight / heightRef));
16331
16577
  fontSize = Math.min(18, Math.max(8, Math.round(fontSize * heightFactor)));
16332
16578
  }
16333
- return /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
16579
+ return /* @__PURE__ */ (0, import_jsx_runtime95.jsx)(
16334
16580
  "text",
16335
16581
  {
16336
16582
  x: centerX,
@@ -16349,7 +16595,7 @@ var renderInsideBarLabel = (color, valueFormatter2) => {
16349
16595
 
16350
16596
  // src/components/ui/charts/NoData.tsx
16351
16597
  var import_framer_motion21 = require("framer-motion");
16352
- var import_jsx_runtime95 = require("react/jsx-runtime");
16598
+ var import_jsx_runtime96 = require("react/jsx-runtime");
16353
16599
  var ChartBar = ({ x, y, w, h, i, loading }) => {
16354
16600
  const baseY = y - h;
16355
16601
  const d = i * 0.08;
@@ -16360,8 +16606,8 @@ var ChartBar = ({ x, y, w, h, i, loading }) => {
16360
16606
  ease: "easeInOut",
16361
16607
  delay: d
16362
16608
  };
16363
- return /* @__PURE__ */ (0, import_jsx_runtime95.jsxs)("g", { children: [
16364
- /* @__PURE__ */ (0, import_jsx_runtime95.jsx)(
16609
+ return /* @__PURE__ */ (0, import_jsx_runtime96.jsxs)("g", { children: [
16610
+ /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
16365
16611
  import_framer_motion21.motion.rect,
16366
16612
  {
16367
16613
  x,
@@ -16376,7 +16622,7 @@ var ChartBar = ({ x, y, w, h, i, loading }) => {
16376
16622
  style: { transformBox: "fill-box", originY: 1 }
16377
16623
  }
16378
16624
  ),
16379
- /* @__PURE__ */ (0, import_jsx_runtime95.jsx)(
16625
+ /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
16380
16626
  import_framer_motion21.motion.rect,
16381
16627
  {
16382
16628
  x,
@@ -16392,7 +16638,7 @@ var ChartBar = ({ x, y, w, h, i, loading }) => {
16392
16638
  style: { transformBox: "fill-box", originY: 1 }
16393
16639
  }
16394
16640
  ),
16395
- /* @__PURE__ */ (0, import_jsx_runtime95.jsx)(
16641
+ /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
16396
16642
  import_framer_motion21.motion.line,
16397
16643
  {
16398
16644
  x1: x + w / 2,
@@ -16426,7 +16672,7 @@ var NoData = ({
16426
16672
  { x: 580, w: 100, h: h * 0.35 },
16427
16673
  { x: 700, w: 100, h: h * 0.3 }
16428
16674
  ];
16429
- return /* @__PURE__ */ (0, import_jsx_runtime95.jsx)(
16675
+ return /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
16430
16676
  "div",
16431
16677
  {
16432
16678
  className: cn(
@@ -16439,17 +16685,17 @@ var NoData = ({
16439
16685
  },
16440
16686
  role: "img",
16441
16687
  "aria-label": message,
16442
- children: /* @__PURE__ */ (0, import_jsx_runtime95.jsx)("div", { className: "w-full flex items-center justify-center pl-[var(--pl)] p-6 h-[var(--svg-h)]", children: /* @__PURE__ */ (0, import_jsx_runtime95.jsxs)("div", { className: "w-full max-w-[900px] relative", children: [
16443
- /* @__PURE__ */ (0, import_jsx_runtime95.jsxs)(
16688
+ children: /* @__PURE__ */ (0, import_jsx_runtime96.jsx)("div", { className: "w-full flex items-center justify-center pl-[var(--pl)] p-6 h-[var(--svg-h)]", children: /* @__PURE__ */ (0, import_jsx_runtime96.jsxs)("div", { className: "w-full max-w-[900px] relative", children: [
16689
+ /* @__PURE__ */ (0, import_jsx_runtime96.jsxs)(
16444
16690
  "svg",
16445
16691
  {
16446
16692
  className: "w-full h-[var(--svg-h)] opacity-40",
16447
16693
  viewBox: `0 0 900 ${h}`,
16448
16694
  preserveAspectRatio: "none",
16449
16695
  children: [
16450
- /* @__PURE__ */ (0, import_jsx_runtime95.jsxs)("defs", { children: [
16451
- /* @__PURE__ */ (0, import_jsx_runtime95.jsxs)("linearGradient", { id: "bg", x1: "0", x2: "0", y1: "0", y2: "1", children: [
16452
- /* @__PURE__ */ (0, import_jsx_runtime95.jsx)(
16696
+ /* @__PURE__ */ (0, import_jsx_runtime96.jsxs)("defs", { children: [
16697
+ /* @__PURE__ */ (0, import_jsx_runtime96.jsxs)("linearGradient", { id: "bg", x1: "0", x2: "0", y1: "0", y2: "1", children: [
16698
+ /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
16453
16699
  "stop",
16454
16700
  {
16455
16701
  offset: "0%",
@@ -16457,7 +16703,7 @@ var NoData = ({
16457
16703
  stopOpacity: "0.15"
16458
16704
  }
16459
16705
  ),
16460
- /* @__PURE__ */ (0, import_jsx_runtime95.jsx)(
16706
+ /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
16461
16707
  "stop",
16462
16708
  {
16463
16709
  offset: "100%",
@@ -16466,8 +16712,8 @@ var NoData = ({
16466
16712
  }
16467
16713
  )
16468
16714
  ] }),
16469
- /* @__PURE__ */ (0, import_jsx_runtime95.jsxs)("linearGradient", { id: "gg", x1: "0", x2: "0", y1: "0", y2: "1", children: [
16470
- /* @__PURE__ */ (0, import_jsx_runtime95.jsx)(
16715
+ /* @__PURE__ */ (0, import_jsx_runtime96.jsxs)("linearGradient", { id: "gg", x1: "0", x2: "0", y1: "0", y2: "1", children: [
16716
+ /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
16471
16717
  "stop",
16472
16718
  {
16473
16719
  offset: "0%",
@@ -16475,7 +16721,7 @@ var NoData = ({
16475
16721
  stopOpacity: "0.4"
16476
16722
  }
16477
16723
  ),
16478
- /* @__PURE__ */ (0, import_jsx_runtime95.jsx)(
16724
+ /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
16479
16725
  "stop",
16480
16726
  {
16481
16727
  offset: "100%",
@@ -16484,17 +16730,17 @@ var NoData = ({
16484
16730
  }
16485
16731
  )
16486
16732
  ] }),
16487
- /* @__PURE__ */ (0, import_jsx_runtime95.jsxs)("filter", { id: "s", x: "-20%", y: "-20%", width: "140%", height: "140%", children: [
16488
- /* @__PURE__ */ (0, import_jsx_runtime95.jsx)("feGaussianBlur", { in: "SourceAlpha", stdDeviation: "3" }),
16489
- /* @__PURE__ */ (0, import_jsx_runtime95.jsx)("feOffset", { dx: "0", dy: "2" }),
16490
- /* @__PURE__ */ (0, import_jsx_runtime95.jsx)("feComponentTransfer", { children: /* @__PURE__ */ (0, import_jsx_runtime95.jsx)("feFuncA", { type: "linear", slope: "0.2" }) }),
16491
- /* @__PURE__ */ (0, import_jsx_runtime95.jsxs)("feMerge", { children: [
16492
- /* @__PURE__ */ (0, import_jsx_runtime95.jsx)("feMergeNode", {}),
16493
- /* @__PURE__ */ (0, import_jsx_runtime95.jsx)("feMergeNode", { in: "SourceGraphic" })
16733
+ /* @__PURE__ */ (0, import_jsx_runtime96.jsxs)("filter", { id: "s", x: "-20%", y: "-20%", width: "140%", height: "140%", children: [
16734
+ /* @__PURE__ */ (0, import_jsx_runtime96.jsx)("feGaussianBlur", { in: "SourceAlpha", stdDeviation: "3" }),
16735
+ /* @__PURE__ */ (0, import_jsx_runtime96.jsx)("feOffset", { dx: "0", dy: "2" }),
16736
+ /* @__PURE__ */ (0, import_jsx_runtime96.jsx)("feComponentTransfer", { children: /* @__PURE__ */ (0, import_jsx_runtime96.jsx)("feFuncA", { type: "linear", slope: "0.2" }) }),
16737
+ /* @__PURE__ */ (0, import_jsx_runtime96.jsxs)("feMerge", { children: [
16738
+ /* @__PURE__ */ (0, import_jsx_runtime96.jsx)("feMergeNode", {}),
16739
+ /* @__PURE__ */ (0, import_jsx_runtime96.jsx)("feMergeNode", { in: "SourceGraphic" })
16494
16740
  ] })
16495
16741
  ] })
16496
16742
  ] }),
16497
- /* @__PURE__ */ (0, import_jsx_runtime95.jsx)(
16743
+ /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
16498
16744
  "rect",
16499
16745
  {
16500
16746
  x: 0,
@@ -16505,7 +16751,7 @@ var NoData = ({
16505
16751
  rx: 8
16506
16752
  }
16507
16753
  ),
16508
- [...Array(6)].map((_, i) => /* @__PURE__ */ (0, import_jsx_runtime95.jsx)(
16754
+ [...Array(6)].map((_, i) => /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
16509
16755
  "line",
16510
16756
  {
16511
16757
  x1: 50,
@@ -16518,7 +16764,7 @@ var NoData = ({
16518
16764
  },
16519
16765
  i
16520
16766
  )),
16521
- /* @__PURE__ */ (0, import_jsx_runtime95.jsx)(
16767
+ /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
16522
16768
  "line",
16523
16769
  {
16524
16770
  x1: 50,
@@ -16530,7 +16776,7 @@ var NoData = ({
16530
16776
  opacity: 0.5
16531
16777
  }
16532
16778
  ),
16533
- /* @__PURE__ */ (0, import_jsx_runtime95.jsx)(
16779
+ /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
16534
16780
  "line",
16535
16781
  {
16536
16782
  x1: 50,
@@ -16542,7 +16788,7 @@ var NoData = ({
16542
16788
  opacity: 0.5
16543
16789
  }
16544
16790
  ),
16545
- bars.map((b, i) => /* @__PURE__ */ (0, import_jsx_runtime95.jsx)(
16791
+ bars.map((b, i) => /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
16546
16792
  ChartBar,
16547
16793
  {
16548
16794
  x: b.x,
@@ -16557,15 +16803,15 @@ var NoData = ({
16557
16803
  ]
16558
16804
  }
16559
16805
  ),
16560
- /* @__PURE__ */ (0, import_jsx_runtime95.jsx)("div", { className: "absolute inset-0 flex items-center justify-center pointer-events-none h-[var(--svg-h)]", children: /* @__PURE__ */ (0, import_jsx_runtime95.jsx)("div", { className: "pointer-events-auto bg-card/95 backdrop-blur-sm px-8 py-6 rounded-xl border border-border/50 shadow-lg text-center max-w-md", children: isLoading ? /* @__PURE__ */ (0, import_jsx_runtime95.jsx)("div", { className: "flex flex-col items-center gap-4", children: /* @__PURE__ */ (0, import_jsx_runtime95.jsx)(
16806
+ /* @__PURE__ */ (0, import_jsx_runtime96.jsx)("div", { className: "absolute inset-0 flex items-center justify-center pointer-events-none h-[var(--svg-h)]", children: /* @__PURE__ */ (0, import_jsx_runtime96.jsx)("div", { className: "pointer-events-auto bg-card/95 backdrop-blur-sm px-8 py-6 rounded-xl border border-border/50 shadow-lg text-center max-w-md", children: isLoading ? /* @__PURE__ */ (0, import_jsx_runtime96.jsx)("div", { className: "flex flex-col items-center gap-4", children: /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
16561
16807
  LoadingBase,
16562
16808
  {
16563
16809
  size: "xl",
16564
16810
  message: loadingMessage ?? "Carregando"
16565
16811
  }
16566
- ) }) : /* @__PURE__ */ (0, import_jsx_runtime95.jsxs)(import_jsx_runtime95.Fragment, { children: [
16567
- title && /* @__PURE__ */ (0, import_jsx_runtime95.jsx)("h3", { className: "text-xl font-semibold text-foreground mb-2", children: title }),
16568
- /* @__PURE__ */ (0, import_jsx_runtime95.jsx)("p", { className: "text-lg font-medium text-foreground/90 mb-2", children: message })
16812
+ ) }) : /* @__PURE__ */ (0, import_jsx_runtime96.jsxs)(import_jsx_runtime96.Fragment, { children: [
16813
+ title && /* @__PURE__ */ (0, import_jsx_runtime96.jsx)("h3", { className: "text-xl font-semibold text-foreground mb-2", children: title }),
16814
+ /* @__PURE__ */ (0, import_jsx_runtime96.jsx)("p", { className: "text-lg font-medium text-foreground/90 mb-2", children: message })
16569
16815
  ] }) }) })
16570
16816
  ] }) })
16571
16817
  }
@@ -16786,8 +17032,126 @@ var useChartClick = ({
16786
17032
  };
16787
17033
  };
16788
17034
 
17035
+ // src/components/ui/charts/hooks/useTimeSeriesRange.ts
17036
+ var import_react96 = require("react");
17037
+ function useTimeSeriesRange({
17038
+ dataLength,
17039
+ defaultStartIndex = 0,
17040
+ defaultEndIndex,
17041
+ onRangeChange
17042
+ }) {
17043
+ const [startIndex, setStartIndex] = (0, import_react96.useState)(defaultStartIndex);
17044
+ const [endIndex, setEndIndex] = (0, import_react96.useState)(
17045
+ defaultEndIndex ?? Math.max(0, dataLength - 1)
17046
+ );
17047
+ const [isDragging, setIsDragging] = (0, import_react96.useState)(null);
17048
+ const [dragStartX, setDragStartX] = (0, import_react96.useState)(0);
17049
+ const [initialStartIndex, setInitialStartIndex] = (0, import_react96.useState)(0);
17050
+ const [initialEndIndex, setInitialEndIndex] = (0, import_react96.useState)(0);
17051
+ const brushRef = (0, import_react96.useRef)(null);
17052
+ (0, import_react96.useEffect)(() => {
17053
+ if (dataLength > 0) {
17054
+ setStartIndex((prev) => Math.min(prev, dataLength - 1));
17055
+ setEndIndex((prev) => {
17056
+ if (prev >= dataLength - 2 || defaultEndIndex === void 0) {
17057
+ return dataLength - 1;
17058
+ }
17059
+ return Math.min(prev, dataLength - 1);
17060
+ });
17061
+ }
17062
+ }, [dataLength, defaultEndIndex]);
17063
+ const handleRangeChange = (0, import_react96.useCallback)(
17064
+ (newStart, newEnd) => {
17065
+ const clampedStart = Math.max(0, Math.min(newStart, dataLength - 1));
17066
+ const clampedEnd = Math.max(
17067
+ clampedStart,
17068
+ Math.min(newEnd, dataLength - 1)
17069
+ );
17070
+ setStartIndex(clampedStart);
17071
+ setEndIndex(clampedEnd);
17072
+ if (onRangeChange) {
17073
+ onRangeChange(clampedStart, clampedEnd);
17074
+ }
17075
+ },
17076
+ [dataLength, onRangeChange]
17077
+ );
17078
+ const handleMouseDown = (0, import_react96.useCallback)(
17079
+ (e, type) => {
17080
+ e.preventDefault();
17081
+ setIsDragging(type);
17082
+ setDragStartX(e.clientX);
17083
+ setInitialStartIndex(startIndex);
17084
+ setInitialEndIndex(endIndex);
17085
+ },
17086
+ [startIndex, endIndex]
17087
+ );
17088
+ const handleMouseMove = (0, import_react96.useCallback)(
17089
+ (e) => {
17090
+ if (!isDragging || !brushRef.current) return;
17091
+ const brushWidth = brushRef.current.offsetWidth;
17092
+ const deltaX = e.clientX - dragStartX;
17093
+ const indexDelta = Math.round(deltaX / brushWidth * dataLength);
17094
+ if (isDragging === "start") {
17095
+ const newStart = Math.max(
17096
+ 0,
17097
+ Math.min(initialStartIndex + indexDelta, endIndex - 1)
17098
+ );
17099
+ handleRangeChange(newStart, endIndex);
17100
+ } else if (isDragging === "end") {
17101
+ const newEnd = Math.max(
17102
+ startIndex + 1,
17103
+ Math.min(initialEndIndex + indexDelta, dataLength - 1)
17104
+ );
17105
+ handleRangeChange(startIndex, newEnd);
17106
+ } else if (isDragging === "middle") {
17107
+ const rangeSize = initialEndIndex - initialStartIndex;
17108
+ let newStart = initialStartIndex + indexDelta;
17109
+ let newEnd = initialEndIndex + indexDelta;
17110
+ if (newStart < 0) {
17111
+ newStart = 0;
17112
+ newEnd = rangeSize;
17113
+ } else if (newEnd >= dataLength) {
17114
+ newEnd = dataLength - 1;
17115
+ newStart = newEnd - rangeSize;
17116
+ }
17117
+ handleRangeChange(newStart, newEnd);
17118
+ }
17119
+ },
17120
+ [
17121
+ isDragging,
17122
+ dragStartX,
17123
+ dataLength,
17124
+ startIndex,
17125
+ endIndex,
17126
+ initialStartIndex,
17127
+ initialEndIndex,
17128
+ handleRangeChange
17129
+ ]
17130
+ );
17131
+ const handleMouseUp = (0, import_react96.useCallback)(() => {
17132
+ setIsDragging(null);
17133
+ }, []);
17134
+ (0, import_react96.useEffect)(() => {
17135
+ if (isDragging) {
17136
+ document.addEventListener("mousemove", handleMouseMove);
17137
+ document.addEventListener("mouseup", handleMouseUp);
17138
+ return () => {
17139
+ document.removeEventListener("mousemove", handleMouseMove);
17140
+ document.removeEventListener("mouseup", handleMouseUp);
17141
+ };
17142
+ }
17143
+ }, [isDragging, handleMouseMove, handleMouseUp]);
17144
+ return {
17145
+ startIndex,
17146
+ endIndex,
17147
+ isDragging,
17148
+ brushRef,
17149
+ handleMouseDown
17150
+ };
17151
+ }
17152
+
16789
17153
  // src/components/ui/charts/Chart.tsx
16790
- var import_jsx_runtime96 = require("react/jsx-runtime");
17154
+ var import_jsx_runtime97 = require("react/jsx-runtime");
16791
17155
  var DEFAULT_COLORS2 = ["#55af7d", "#8e68ff", "#2273e1"];
16792
17156
  var Chart = ({
16793
17157
  data,
@@ -16820,9 +17184,10 @@ var Chart = ({
16820
17184
  formatBR = false,
16821
17185
  legendUppercase = false,
16822
17186
  chartMargin,
16823
- isLoading = false
17187
+ isLoading = false,
17188
+ timeSeries
16824
17189
  }) => {
16825
- const smartConfig = (0, import_react96.useMemo)(() => {
17190
+ const smartConfig = (0, import_react97.useMemo)(() => {
16826
17191
  const resolvedXAxisKey = typeof xAxis === "string" ? xAxis : xAxis && xAxis.dataKey || detectXAxis(data);
16827
17192
  const xAxisConfig2 = typeof xAxis === "string" ? {
16828
17193
  dataKey: resolvedXAxisKey,
@@ -16860,15 +17225,38 @@ var Chart = ({
16860
17225
  onTooltipPositionChange,
16861
17226
  setActiveTooltips
16862
17227
  } = useChartTooltips(maxTooltips);
16863
- (0, import_react96.useEffect)(() => {
17228
+ (0, import_react97.useEffect)(() => {
16864
17229
  if (highlightedSeries.size === 0 && showOnlyHighlighted) {
16865
17230
  setShowOnlyHighlighted(false);
16866
17231
  }
16867
17232
  }, [highlightedSeries, showOnlyHighlighted, setShowOnlyHighlighted]);
16868
- const processedData = data.map((item) => ({
16869
- ...item,
16870
- name: String(item[xAxisConfig.dataKey] || "N/A")
16871
- }));
17233
+ const timeSeriesConfig = (0, import_react97.useMemo)(() => {
17234
+ if (typeof timeSeries === "boolean") {
17235
+ return timeSeries ? {} : void 0;
17236
+ }
17237
+ return timeSeries;
17238
+ }, [timeSeries]);
17239
+ const {
17240
+ startIndex,
17241
+ endIndex,
17242
+ brushRef,
17243
+ handleMouseDown
17244
+ } = useTimeSeriesRange({
17245
+ dataLength: data.length,
17246
+ defaultStartIndex: timeSeriesConfig?.start,
17247
+ defaultEndIndex: timeSeriesConfig?.end,
17248
+ onRangeChange: timeSeriesConfig?.onRangeChange
17249
+ });
17250
+ const processedData = (0, import_react97.useMemo)(() => {
17251
+ const mapped = data.map((item) => ({
17252
+ ...item,
17253
+ name: String(item[xAxisConfig.dataKey] || "N/A")
17254
+ }));
17255
+ if (timeSeriesConfig) {
17256
+ return mapped.slice(startIndex, endIndex + 1);
17257
+ }
17258
+ return mapped;
17259
+ }, [data, xAxisConfig.dataKey, timeSeriesConfig, startIndex, endIndex]);
16872
17260
  const seriesOrder = [];
16873
17261
  if (series) {
16874
17262
  if (series.bar)
@@ -16883,17 +17271,17 @@ var Chart = ({
16883
17271
  );
16884
17272
  }
16885
17273
  const allKeys = seriesOrder.map((s) => s.key).filter(Boolean);
16886
- const finalColors = (0, import_react96.useMemo)(
17274
+ const finalColors = (0, import_react97.useMemo)(
16887
17275
  () => generateColorMap(allKeys, colors2, mapperConfig),
16888
17276
  [allKeys, colors2, mapperConfig]
16889
17277
  );
16890
- const biaxialConfigNormalized = (0, import_react96.useMemo)(() => {
17278
+ const biaxialConfigNormalized = (0, import_react97.useMemo)(() => {
16891
17279
  if (!biaxial) return null;
16892
17280
  if (typeof biaxial === "string") return { key: [biaxial] };
16893
17281
  if (Array.isArray(biaxial)) return { key: biaxial };
16894
17282
  return biaxial;
16895
17283
  }, [biaxial]);
16896
- (0, import_react96.useMemo)(() => {
17284
+ (0, import_react97.useMemo)(() => {
16897
17285
  if (!biaxialConfigNormalized) return;
16898
17286
  const leftLabelMissing = !yAxisLabel || String(yAxisLabel).trim() === "";
16899
17287
  const rightLabelMissing = !biaxialConfigNormalized.label || String(biaxialConfigNormalized.label).trim() === "";
@@ -16903,43 +17291,43 @@ var Chart = ({
16903
17291
  );
16904
17292
  }
16905
17293
  }, [biaxialConfigNormalized, yAxisLabel]);
16906
- const rightKeys = (0, import_react96.useMemo)(
17294
+ const rightKeys = (0, import_react97.useMemo)(
16907
17295
  () => biaxialConfigNormalized?.key ?? [],
16908
17296
  [biaxialConfigNormalized]
16909
17297
  );
16910
- const leftKeys = (0, import_react96.useMemo)(
17298
+ const leftKeys = (0, import_react97.useMemo)(
16911
17299
  () => allKeys.filter((k) => !rightKeys.includes(k)),
16912
17300
  [allKeys, rightKeys]
16913
17301
  );
16914
- const activePeriods = (0, import_react96.useMemo)(
17302
+ const activePeriods = (0, import_react97.useMemo)(
16915
17303
  () => activeTooltips.map((t) => adaptDataForTooltip(t.data, xAxisConfig.dataKey).name),
16916
17304
  [activeTooltips, xAxisConfig.dataKey]
16917
17305
  );
16918
- const maxLeftDataValue = (0, import_react96.useMemo)(() => {
17306
+ const maxLeftDataValue = (0, import_react97.useMemo)(() => {
16919
17307
  const numericKeys = leftKeys.length > 0 ? leftKeys : allKeys;
16920
17308
  return getMaxDataValue(processedData, numericKeys);
16921
17309
  }, [processedData, leftKeys, allKeys]);
16922
- const minLeftDataValue = (0, import_react96.useMemo)(() => {
17310
+ const minLeftDataValue = (0, import_react97.useMemo)(() => {
16923
17311
  const numericKeys = leftKeys.length > 0 ? leftKeys : allKeys;
16924
17312
  return getMinDataValue(processedData, numericKeys);
16925
17313
  }, [processedData, leftKeys, allKeys]);
16926
- const maxRightDataValue = (0, import_react96.useMemo)(() => {
17314
+ const maxRightDataValue = (0, import_react97.useMemo)(() => {
16927
17315
  if (rightKeys.length === 0) return 0;
16928
17316
  return getMaxDataValue(processedData, rightKeys);
16929
17317
  }, [processedData, rightKeys]);
16930
- const minRightDataValue = (0, import_react96.useMemo)(() => {
17318
+ const minRightDataValue = (0, import_react97.useMemo)(() => {
16931
17319
  if (rightKeys.length === 0) return 0;
16932
17320
  return getMinDataValue(processedData, rightKeys);
16933
17321
  }, [processedData, rightKeys]);
16934
- const niceMaxLeft = (0, import_react96.useMemo)(
17322
+ const niceMaxLeft = (0, import_react97.useMemo)(
16935
17323
  () => computeNiceMax(maxLeftDataValue),
16936
17324
  [maxLeftDataValue]
16937
17325
  );
16938
- const niceMaxRight = (0, import_react96.useMemo)(
17326
+ const niceMaxRight = (0, import_react97.useMemo)(
16939
17327
  () => computeNiceMax(maxRightDataValue),
16940
17328
  [maxRightDataValue]
16941
17329
  );
16942
- const computedWidth = (0, import_react96.useMemo)(
17330
+ const computedWidth = (0, import_react97.useMemo)(
16943
17331
  () => computeChartWidth(
16944
17332
  width,
16945
17333
  processedData.length,
@@ -16957,17 +17345,17 @@ var Chart = ({
16957
17345
  setActiveTooltips
16958
17346
  }
16959
17347
  );
16960
- const getSeriesOpacity = (0, import_react96.useCallback)(
17348
+ const getSeriesOpacity = (0, import_react97.useCallback)(
16961
17349
  (key) => {
16962
17350
  return highlightedSeries.size > 0 ? highlightedSeries.has(key) ? 1 : 0.25 : 1;
16963
17351
  },
16964
17352
  [highlightedSeries]
16965
17353
  );
16966
- const finalValueFormatter = (0, import_react96.useMemo)(
17354
+ const finalValueFormatter = (0, import_react97.useMemo)(
16967
17355
  () => createValueFormatter(valueFormatter2, formatBR),
16968
17356
  [valueFormatter2, formatBR]
16969
17357
  );
16970
- const yTickFormatter = (0, import_react96.useMemo)(
17358
+ const yTickFormatter = (0, import_react97.useMemo)(
16971
17359
  () => createYTickFormatter(finalValueFormatter),
16972
17360
  [finalValueFormatter]
16973
17361
  );
@@ -16975,7 +17363,7 @@ var Chart = ({
16975
17363
  const CONTAINER_PADDING_LEFT = -6;
16976
17364
  const finalChartRightMargin = chartMargin?.right ?? (rightKeys.length > 0 ? AXIS_LABEL_MARGIN : 30);
16977
17365
  const finalChartLeftMargin = chartMargin?.left ?? (yAxisLabel ? AXIS_LABEL_MARGIN : 0);
16978
- const yAxisTickWidth = (0, import_react96.useMemo)(
17366
+ const yAxisTickWidth = (0, import_react97.useMemo)(
16979
17367
  () => computeYAxisTickWidth(
16980
17368
  chartMargin?.left,
16981
17369
  yAxisLabel,
@@ -16998,7 +17386,7 @@ var Chart = ({
16998
17386
  const chartInnerWidth = effectiveChartWidth - finalChartLeftMargin - finalChartRightMargin;
16999
17387
  const leftYAxisLabelDx = -Math.max(12, Math.round(yAxisTickWidth / 2));
17000
17388
  const rightYAxisLabelDx = Math.max(12, Math.round(finalChartRightMargin / 2));
17001
- const openTooltipForPeriod = (0, import_react96.useCallback)(
17389
+ const openTooltipForPeriod = (0, import_react97.useCallback)(
17002
17390
  (periodName) => {
17003
17391
  if (!enableDraggableTooltips) return;
17004
17392
  const row = processedData.find((r) => String(r.name) === periodName);
@@ -17042,7 +17430,7 @@ var Chart = ({
17042
17430
  );
17043
17431
  if (!data && !isLoading) return null;
17044
17432
  if (isLoading) {
17045
- return /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
17433
+ return /* @__PURE__ */ (0, import_jsx_runtime97.jsx)(
17046
17434
  NoData_default,
17047
17435
  {
17048
17436
  title,
@@ -17054,7 +17442,7 @@ var Chart = ({
17054
17442
  );
17055
17443
  }
17056
17444
  if (Array.isArray(data) && data.length === 0) {
17057
- return /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
17445
+ return /* @__PURE__ */ (0, import_jsx_runtime97.jsx)(
17058
17446
  NoData_default,
17059
17447
  {
17060
17448
  title,
@@ -17063,7 +17451,7 @@ var Chart = ({
17063
17451
  }
17064
17452
  );
17065
17453
  }
17066
- return /* @__PURE__ */ (0, import_jsx_runtime96.jsx)("div", { ref: wrapperRef, className: "w-full overflow-hidden min-w-0", children: /* @__PURE__ */ (0, import_jsx_runtime96.jsxs)(
17454
+ return /* @__PURE__ */ (0, import_jsx_runtime97.jsx)("div", { ref: wrapperRef, className: "w-full overflow-hidden min-w-0", children: /* @__PURE__ */ (0, import_jsx_runtime97.jsxs)(
17067
17455
  "div",
17068
17456
  {
17069
17457
  className: cn(
@@ -17071,7 +17459,7 @@ var Chart = ({
17071
17459
  className
17072
17460
  ),
17073
17461
  children: [
17074
- title && /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
17462
+ title && /* @__PURE__ */ (0, import_jsx_runtime97.jsx)(
17075
17463
  "div",
17076
17464
  {
17077
17465
  className: cn(
@@ -17080,11 +17468,11 @@ var Chart = ({
17080
17468
  titlePosition === "right" && "justify-end",
17081
17469
  titlePosition === "left" && "justify-start"
17082
17470
  ),
17083
- children: /* @__PURE__ */ (0, import_jsx_runtime96.jsx)("div", { className: "text-[1.4rem] font-semibold text-foreground mb-3", children: title })
17471
+ children: /* @__PURE__ */ (0, import_jsx_runtime97.jsx)("div", { className: "text-[1.4rem] font-semibold text-foreground mb-3", children: title })
17084
17472
  }
17085
17473
  ),
17086
- allKeys.length > 0 && (enableHighlights || enableShowOnly) && /* @__PURE__ */ (0, import_jsx_runtime96.jsxs)("div", { className: "flex items-center w-[98%] ml-[90px] gap-2", children: [
17087
- enableHighlights && /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
17474
+ allKeys.length > 0 && (enableHighlights || enableShowOnly) && /* @__PURE__ */ (0, import_jsx_runtime97.jsxs)("div", { className: "flex items-center w-[98%] ml-[90px] gap-2", children: [
17475
+ enableHighlights && /* @__PURE__ */ (0, import_jsx_runtime97.jsx)(
17088
17476
  Highlights_default,
17089
17477
  {
17090
17478
  allKeys,
@@ -17095,7 +17483,7 @@ var Chart = ({
17095
17483
  containerWidth: chartInnerWidth
17096
17484
  }
17097
17485
  ),
17098
- enableShowOnly && /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
17486
+ enableShowOnly && /* @__PURE__ */ (0, import_jsx_runtime97.jsx)(
17099
17487
  ShowOnly_default,
17100
17488
  {
17101
17489
  showOnlyHighlighted,
@@ -17104,7 +17492,7 @@ var Chart = ({
17104
17492
  clearHighlights
17105
17493
  }
17106
17494
  ),
17107
- enablePeriodsDropdown && enableDraggableTooltips && /* @__PURE__ */ (0, import_jsx_runtime96.jsx)("div", { className: "ml-auto flex items-center", children: /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
17495
+ enablePeriodsDropdown && enableDraggableTooltips && /* @__PURE__ */ (0, import_jsx_runtime97.jsx)("div", { className: "ml-auto flex items-center", children: /* @__PURE__ */ (0, import_jsx_runtime97.jsx)(
17108
17496
  PeriodsDropdown_default,
17109
17497
  {
17110
17498
  processedData,
@@ -17114,7 +17502,7 @@ var Chart = ({
17114
17502
  }
17115
17503
  ) })
17116
17504
  ] }),
17117
- !(allKeys.length > 0 && (enableHighlights || enableShowOnly)) && enablePeriodsDropdown && enableDraggableTooltips && /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
17505
+ !(allKeys.length > 0 && (enableHighlights || enableShowOnly)) && enablePeriodsDropdown && enableDraggableTooltips && /* @__PURE__ */ (0, import_jsx_runtime97.jsx)(
17118
17506
  "div",
17119
17507
  {
17120
17508
  className: "w-full flex justify-end",
@@ -17123,7 +17511,7 @@ var Chart = ({
17123
17511
  paddingRight: `${finalChartRightMargin}px`,
17124
17512
  maxWidth: `${chartInnerWidth}px`
17125
17513
  },
17126
- children: /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
17514
+ children: /* @__PURE__ */ (0, import_jsx_runtime97.jsx)(
17127
17515
  PeriodsDropdown_default,
17128
17516
  {
17129
17517
  processedData,
@@ -17133,8 +17521,8 @@ var Chart = ({
17133
17521
  )
17134
17522
  }
17135
17523
  ),
17136
- /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(import_recharts.ResponsiveContainer, { width: "100%", height, children: /* @__PURE__ */ (0, import_jsx_runtime96.jsxs)(
17137
- import_recharts.ComposedChart,
17524
+ /* @__PURE__ */ (0, import_jsx_runtime97.jsx)(import_recharts2.ResponsiveContainer, { width: "100%", height, children: /* @__PURE__ */ (0, import_jsx_runtime97.jsxs)(
17525
+ import_recharts2.ComposedChart,
17138
17526
  {
17139
17527
  data: processedData,
17140
17528
  height,
@@ -17146,10 +17534,10 @@ var Chart = ({
17146
17534
  },
17147
17535
  onClick: handleChartClick,
17148
17536
  children: [
17149
- /* @__PURE__ */ (0, import_jsx_runtime96.jsx)("defs", { children: seriesOrder.filter((s) => s.type === "area").map((s) => {
17537
+ /* @__PURE__ */ (0, import_jsx_runtime97.jsx)("defs", { children: seriesOrder.filter((s) => s.type === "area").map((s) => {
17150
17538
  const key = s.key;
17151
17539
  const color = finalColors[key];
17152
- return /* @__PURE__ */ (0, import_jsx_runtime96.jsxs)(
17540
+ return /* @__PURE__ */ (0, import_jsx_runtime97.jsxs)(
17153
17541
  "linearGradient",
17154
17542
  {
17155
17543
  id: `gradient-${key}`,
@@ -17158,23 +17546,23 @@ var Chart = ({
17158
17546
  x2: "0",
17159
17547
  y2: "0.8",
17160
17548
  children: [
17161
- /* @__PURE__ */ (0, import_jsx_runtime96.jsx)("stop", { offset: "0%", stopColor: color, stopOpacity: 0.8 }),
17162
- /* @__PURE__ */ (0, import_jsx_runtime96.jsx)("stop", { offset: "90%", stopColor: color, stopOpacity: 0.1 })
17549
+ /* @__PURE__ */ (0, import_jsx_runtime97.jsx)("stop", { offset: "0%", stopColor: color, stopOpacity: 0.8 }),
17550
+ /* @__PURE__ */ (0, import_jsx_runtime97.jsx)("stop", { offset: "90%", stopColor: color, stopOpacity: 0.1 })
17163
17551
  ]
17164
17552
  },
17165
17553
  `gradient-${key}`
17166
17554
  );
17167
17555
  }) }),
17168
- showGrid && /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
17169
- import_recharts.CartesianGrid,
17556
+ showGrid && /* @__PURE__ */ (0, import_jsx_runtime97.jsx)(
17557
+ import_recharts2.CartesianGrid,
17170
17558
  {
17171
17559
  strokeDasharray: "3 3",
17172
17560
  stroke: gridColor || "hsl(var(--muted-foreground))",
17173
17561
  opacity: 0.5
17174
17562
  }
17175
17563
  ),
17176
- /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
17177
- import_recharts.XAxis,
17564
+ /* @__PURE__ */ (0, import_jsx_runtime97.jsx)(
17565
+ import_recharts2.XAxis,
17178
17566
  {
17179
17567
  dataKey: xAxisConfig.dataKey,
17180
17568
  stroke: "hsl(var(--muted-foreground))",
@@ -17200,8 +17588,8 @@ var Chart = ({
17200
17588
  } : void 0
17201
17589
  }
17202
17590
  ),
17203
- /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
17204
- import_recharts.YAxis,
17591
+ /* @__PURE__ */ (0, import_jsx_runtime97.jsx)(
17592
+ import_recharts2.YAxis,
17205
17593
  {
17206
17594
  yAxisId: "left",
17207
17595
  width: yAxisTickWidth,
@@ -17226,8 +17614,8 @@ var Chart = ({
17226
17614
  } : void 0
17227
17615
  }
17228
17616
  ),
17229
- minLeftDataValue < 0 && /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
17230
- import_recharts.ReferenceLine,
17617
+ minLeftDataValue < 0 && /* @__PURE__ */ (0, import_jsx_runtime97.jsx)(
17618
+ import_recharts2.ReferenceLine,
17231
17619
  {
17232
17620
  y: 0,
17233
17621
  yAxisId: "left",
@@ -17260,8 +17648,8 @@ var Chart = ({
17260
17648
  return biaxialConfigNormalized.stroke[firstRightKey] || defaultRightColor;
17261
17649
  return defaultRightColor;
17262
17650
  })();
17263
- return /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
17264
- import_recharts.YAxis,
17651
+ return /* @__PURE__ */ (0, import_jsx_runtime97.jsx)(
17652
+ import_recharts2.YAxis,
17265
17653
  {
17266
17654
  yAxisId: "right",
17267
17655
  width: finalChartRightMargin,
@@ -17289,10 +17677,10 @@ var Chart = ({
17289
17677
  }
17290
17678
  );
17291
17679
  })(),
17292
- showTooltip && /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
17293
- import_recharts.Tooltip,
17680
+ showTooltip && /* @__PURE__ */ (0, import_jsx_runtime97.jsx)(
17681
+ import_recharts2.Tooltip,
17294
17682
  {
17295
- content: showTooltipTotal ? /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
17683
+ content: showTooltipTotal ? /* @__PURE__ */ (0, import_jsx_runtime97.jsx)(
17296
17684
  TooltipWithTotal_default,
17297
17685
  {
17298
17686
  finalColors,
@@ -17300,7 +17688,7 @@ var Chart = ({
17300
17688
  categoryFormatter,
17301
17689
  periodLabel
17302
17690
  }
17303
- ) : /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
17691
+ ) : /* @__PURE__ */ (0, import_jsx_runtime97.jsx)(
17304
17692
  TooltipSimple_default,
17305
17693
  {
17306
17694
  finalColors,
@@ -17312,8 +17700,8 @@ var Chart = ({
17312
17700
  cursor: { fill: "hsl(var(--muted))", opacity: 0.1 }
17313
17701
  }
17314
17702
  ),
17315
- showLegend && /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
17316
- import_recharts.Legend,
17703
+ showLegend && /* @__PURE__ */ (0, import_jsx_runtime97.jsx)(
17704
+ import_recharts2.Legend,
17317
17705
  {
17318
17706
  wrapperStyle: {
17319
17707
  color: "hsl(var(--foreground))",
@@ -17325,7 +17713,7 @@ var Chart = ({
17325
17713
  const key = String(value);
17326
17714
  const label = mapperConfig[key]?.label ?? labelMap?.[key] ?? formatFieldName(key);
17327
17715
  const displayLabel = legendUppercase ? label.toUpperCase() : label;
17328
- return /* @__PURE__ */ (0, import_jsx_runtime96.jsx)("span", { className: "tracking-[0]", children: displayLabel });
17716
+ return /* @__PURE__ */ (0, import_jsx_runtime97.jsx)("span", { className: "tracking-[0]", children: displayLabel });
17329
17717
  }
17330
17718
  }
17331
17719
  ),
@@ -17343,8 +17731,8 @@ var Chart = ({
17343
17731
  }
17344
17732
  }
17345
17733
  if (s.type === "bar") {
17346
- return /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
17347
- import_recharts.Bar,
17734
+ return /* @__PURE__ */ (0, import_jsx_runtime97.jsx)(
17735
+ import_recharts2.Bar,
17348
17736
  {
17349
17737
  dataKey: key,
17350
17738
  yAxisId: rightKeys.includes(key) ? "right" : "left",
@@ -17354,8 +17742,8 @@ var Chart = ({
17354
17742
  onClick: handleBarClick,
17355
17743
  className: "cursor-pointer",
17356
17744
  style: { opacity: getSeriesOpacity(key) },
17357
- activeBar: /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
17358
- import_recharts.Rectangle,
17745
+ activeBar: /* @__PURE__ */ (0, import_jsx_runtime97.jsx)(
17746
+ import_recharts2.Rectangle,
17359
17747
  {
17360
17748
  fill: color,
17361
17749
  stroke: color,
@@ -17363,8 +17751,8 @@ var Chart = ({
17363
17751
  opacity: 0.8
17364
17752
  }
17365
17753
  ),
17366
- children: showLabels && highlightedSeries.size === 0 || highlightedSeries.has(key) ? /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
17367
- import_recharts.LabelList,
17754
+ children: showLabels && highlightedSeries.size === 0 || highlightedSeries.has(key) ? /* @__PURE__ */ (0, import_jsx_runtime97.jsx)(
17755
+ import_recharts2.LabelList,
17368
17756
  {
17369
17757
  dataKey: key,
17370
17758
  content: (props) => {
@@ -17390,8 +17778,8 @@ var Chart = ({
17390
17778
  );
17391
17779
  }
17392
17780
  if (s.type === "line") {
17393
- return /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
17394
- import_recharts.Line,
17781
+ return /* @__PURE__ */ (0, import_jsx_runtime97.jsx)(
17782
+ import_recharts2.Line,
17395
17783
  {
17396
17784
  dataKey: key,
17397
17785
  yAxisId: rightKeys.includes(key) ? "right" : "left",
@@ -17403,8 +17791,8 @@ var Chart = ({
17403
17791
  onClick: handleSeriesClick,
17404
17792
  className: "cursor-pointer pointer-events-auto",
17405
17793
  style: { opacity: getSeriesOpacity(key) },
17406
- children: showLabels && highlightedSeries.size === 0 || highlightedSeries.has(key) ? /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
17407
- import_recharts.LabelList,
17794
+ children: showLabels && highlightedSeries.size === 0 || highlightedSeries.has(key) ? /* @__PURE__ */ (0, import_jsx_runtime97.jsx)(
17795
+ import_recharts2.LabelList,
17408
17796
  {
17409
17797
  dataKey: key,
17410
17798
  position: "top",
@@ -17421,8 +17809,8 @@ var Chart = ({
17421
17809
  );
17422
17810
  }
17423
17811
  if (s.type === "area") {
17424
- return /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
17425
- import_recharts.Area,
17812
+ return /* @__PURE__ */ (0, import_jsx_runtime97.jsx)(
17813
+ import_recharts2.Area,
17426
17814
  {
17427
17815
  type: "monotone",
17428
17816
  dataKey: key,
@@ -17441,8 +17829,8 @@ var Chart = ({
17441
17829
  stroke: "hsl(var(--background))",
17442
17830
  strokeWidth: 2
17443
17831
  },
17444
- children: showLabels && highlightedSeries.size === 0 || highlightedSeries.has(key) ? /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
17445
- import_recharts.LabelList,
17832
+ children: showLabels && highlightedSeries.size === 0 || highlightedSeries.has(key) ? /* @__PURE__ */ (0, import_jsx_runtime97.jsx)(
17833
+ import_recharts2.LabelList,
17446
17834
  {
17447
17835
  dataKey: key,
17448
17836
  position: "top",
@@ -17463,7 +17851,7 @@ var Chart = ({
17463
17851
  ]
17464
17852
  }
17465
17853
  ) }),
17466
- enableDraggableTooltips && activeTooltips.map((tooltip) => /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
17854
+ enableDraggableTooltips && activeTooltips.map((tooltip) => /* @__PURE__ */ (0, import_jsx_runtime97.jsx)(
17467
17855
  DraggableTooltip_default,
17468
17856
  {
17469
17857
  id: tooltip.id,
@@ -17488,7 +17876,7 @@ var Chart = ({
17488
17876
  },
17489
17877
  tooltip.id
17490
17878
  )),
17491
- enableDraggableTooltips && activeTooltips.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
17879
+ enableDraggableTooltips && activeTooltips.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime97.jsx)(
17492
17880
  CloseAllButton_default,
17493
17881
  {
17494
17882
  count: activeTooltips.length,
@@ -17496,6 +17884,28 @@ var Chart = ({
17496
17884
  position: "top-center",
17497
17885
  variant: "floating"
17498
17886
  }
17887
+ ),
17888
+ timeSeriesConfig && /* @__PURE__ */ (0, import_jsx_runtime97.jsx)(
17889
+ Brush_default,
17890
+ {
17891
+ data,
17892
+ startIndex,
17893
+ endIndex,
17894
+ onMouseDown: handleMouseDown,
17895
+ brushRef,
17896
+ xAxisKey: xAxisConfig.dataKey,
17897
+ seriesOrder,
17898
+ finalColors,
17899
+ brushHeight: timeSeriesConfig.height,
17900
+ brushColor: timeSeriesConfig.brushColor,
17901
+ miniChartOpacity: timeSeriesConfig.miniChartOpacity,
17902
+ showGrid,
17903
+ gridColor,
17904
+ margin: {
17905
+ left: finalChartLeftMargin,
17906
+ right: finalChartRightMargin
17907
+ }
17908
+ }
17499
17909
  )
17500
17910
  ]
17501
17911
  }
@@ -17504,9 +17914,9 @@ var Chart = ({
17504
17914
  var Chart_default = Chart;
17505
17915
 
17506
17916
  // src/components/ui/charts/BarChart.tsx
17507
- var import_react97 = require("react");
17508
- var import_recharts2 = require("recharts");
17509
- var import_jsx_runtime97 = require("react/jsx-runtime");
17917
+ var import_react98 = require("react");
17918
+ var import_recharts3 = require("recharts");
17919
+ var import_jsx_runtime98 = require("react/jsx-runtime");
17510
17920
  var DEFAULT_COLORS3 = ["#55af7d", "#8e68ff", "#2273e1"];
17511
17921
  var BarChart = ({
17512
17922
  data,
@@ -17536,7 +17946,7 @@ var BarChart = ({
17536
17946
  containerPaddingLeft,
17537
17947
  16
17538
17948
  );
17539
- const smartConfig = (0, import_react97.useMemo)(() => {
17949
+ const smartConfig = (0, import_react98.useMemo)(() => {
17540
17950
  const providedMapper = yAxis ?? mapper;
17541
17951
  if (autoDetect === true || xAxis == null || providedMapper == null) {
17542
17952
  const detectedXAxis = detectXAxis(data);
@@ -17586,14 +17996,14 @@ var BarChart = ({
17586
17996
  return { xAxisConfig: xAxisConfig2, mapperConfig: mapperConfig2 };
17587
17997
  }, [data, xAxis, mapper, yAxis, autoDetect, labelMap]);
17588
17998
  const { xAxisConfig, mapperConfig } = smartConfig;
17589
- const [activeTooltips, setActiveTooltips] = (0, import_react97.useState)([]);
17590
- const [isDragging, setIsDragging] = (0, import_react97.useState)(null);
17591
- const [dragOffset, setDragOffset] = (0, import_react97.useState)({
17999
+ const [activeTooltips, setActiveTooltips] = (0, import_react98.useState)([]);
18000
+ const [isDragging, setIsDragging] = (0, import_react98.useState)(null);
18001
+ const [dragOffset, setDragOffset] = (0, import_react98.useState)({
17592
18002
  x: 0,
17593
18003
  y: 0
17594
18004
  });
17595
- const [globalTooltipCount, setGlobalTooltipCount] = (0, import_react97.useState)(0);
17596
- const [alignmentGuides, setAlignmentGuides] = (0, import_react97.useState)([]);
18005
+ const [globalTooltipCount, setGlobalTooltipCount] = (0, import_react98.useState)(0);
18006
+ const [alignmentGuides, setAlignmentGuides] = (0, import_react98.useState)([]);
17597
18007
  const processedData = data.map((item) => ({
17598
18008
  ...item,
17599
18009
  name: String(item[xAxisConfig.dataKey] || "N/A")
@@ -17616,7 +18026,7 @@ var BarChart = ({
17616
18026
  // Garantir que tem a propriedade 'name'
17617
18027
  };
17618
18028
  };
17619
- const maxDataValue = (0, import_react97.useMemo)(() => {
18029
+ const maxDataValue = (0, import_react98.useMemo)(() => {
17620
18030
  let max = 0;
17621
18031
  const keys = Object.keys(mapperConfig);
17622
18032
  for (const row of processedData) {
@@ -17629,7 +18039,7 @@ var BarChart = ({
17629
18039
  }
17630
18040
  return max;
17631
18041
  }, [processedData, mapperConfig]);
17632
- const niceMax = (0, import_react97.useMemo)(() => {
18042
+ const niceMax = (0, import_react98.useMemo)(() => {
17633
18043
  let padding2 = 0.08;
17634
18044
  if (maxDataValue > 1e6) padding2 = 0.05;
17635
18045
  if (maxDataValue > 1e7) padding2 = 0.03;
@@ -17670,7 +18080,7 @@ var BarChart = ({
17670
18080
  const GUIDE_THRESHOLD2 = 60;
17671
18081
  const STRONG_SNAP_THRESHOLD2 = 35;
17672
18082
  const PRECISION_SNAP_THRESHOLD2 = 8;
17673
- const updateAlignmentGuides = (0, import_react97.useCallback)(
18083
+ const updateAlignmentGuides = (0, import_react98.useCallback)(
17674
18084
  (draggedTooltipId, currentPosition) => {
17675
18085
  if (!isDragging) return;
17676
18086
  const getAllTooltips = () => {
@@ -17734,7 +18144,7 @@ var BarChart = ({
17734
18144
  },
17735
18145
  [isDragging, activeTooltips]
17736
18146
  );
17737
- const snapToGuides = (0, import_react97.useCallback)(
18147
+ const snapToGuides = (0, import_react98.useCallback)(
17738
18148
  (position) => {
17739
18149
  const snappedPosition = { ...position };
17740
18150
  let hasSnapped = false;
@@ -17796,7 +18206,7 @@ var BarChart = ({
17796
18206
  setIsDragging(tooltipId);
17797
18207
  setDragOffset({ x: offsetX, y: offsetY });
17798
18208
  };
17799
- (0, import_react97.useEffect)(() => {
18209
+ (0, import_react98.useEffect)(() => {
17800
18210
  let rafId;
17801
18211
  let lastMousePosition = { x: 0, y: 0 };
17802
18212
  const handleGlobalMouseMove = (e) => {
@@ -17854,7 +18264,7 @@ var BarChart = ({
17854
18264
  updateAlignmentGuides,
17855
18265
  snapToGuides
17856
18266
  ]);
17857
- (0, import_react97.useEffect)(() => {
18267
+ (0, import_react98.useEffect)(() => {
17858
18268
  const handleCloseAllTooltips = () => {
17859
18269
  setActiveTooltips([]);
17860
18270
  setGlobalTooltipCount(0);
@@ -17864,7 +18274,7 @@ var BarChart = ({
17864
18274
  window.removeEventListener("closeAllTooltips", handleCloseAllTooltips);
17865
18275
  };
17866
18276
  }, []);
17867
- (0, import_react97.useEffect)(() => {
18277
+ (0, import_react98.useEffect)(() => {
17868
18278
  const handleTooltipCountRequest = () => {
17869
18279
  window.dispatchEvent(
17870
18280
  new CustomEvent("tooltipCountResponse", {
@@ -17903,7 +18313,7 @@ var BarChart = ({
17903
18313
  );
17904
18314
  };
17905
18315
  }, [activeTooltips]);
17906
- (0, import_react97.useEffect)(() => {
18316
+ (0, import_react98.useEffect)(() => {
17907
18317
  if (isDragging) return;
17908
18318
  let totalCount = 0;
17909
18319
  const handleCountResponse = (event) => {
@@ -17927,25 +18337,25 @@ var BarChart = ({
17927
18337
  label
17928
18338
  }) => {
17929
18339
  if (!active || !payload) return null;
17930
- return /* @__PURE__ */ (0, import_jsx_runtime97.jsxs)("div", { className: "bg-card border border-border rounded-lg p-3 shadow-lg", children: [
17931
- /* @__PURE__ */ (0, import_jsx_runtime97.jsx)("p", { className: "font-medium text-foreground mb-2", children: label }),
18340
+ return /* @__PURE__ */ (0, import_jsx_runtime98.jsxs)("div", { className: "bg-card border border-border rounded-lg p-3 shadow-lg", children: [
18341
+ /* @__PURE__ */ (0, import_jsx_runtime98.jsx)("p", { className: "font-medium text-foreground mb-2", children: label }),
17932
18342
  payload.map(
17933
- (entry, index) => /* @__PURE__ */ (0, import_jsx_runtime97.jsxs)("div", { className: "flex items-center gap-2 text-sm", children: [
17934
- /* @__PURE__ */ (0, import_jsx_runtime97.jsx)(
18343
+ (entry, index) => /* @__PURE__ */ (0, import_jsx_runtime98.jsxs)("div", { className: "flex items-center gap-2 text-sm", children: [
18344
+ /* @__PURE__ */ (0, import_jsx_runtime98.jsx)(
17935
18345
  "div",
17936
18346
  {
17937
18347
  className: "w-3 h-3 rounded-sm",
17938
18348
  style: { backgroundColor: entry.color }
17939
18349
  }
17940
18350
  ),
17941
- /* @__PURE__ */ (0, import_jsx_runtime97.jsxs)("span", { className: "text-muted-foreground", children: [
18351
+ /* @__PURE__ */ (0, import_jsx_runtime98.jsxs)("span", { className: "text-muted-foreground", children: [
17942
18352
  entry.name,
17943
18353
  ":"
17944
18354
  ] }),
17945
- /* @__PURE__ */ (0, import_jsx_runtime97.jsx)("span", { className: "text-foreground font-medium", children: entry.value?.toLocaleString("pt-BR") })
18355
+ /* @__PURE__ */ (0, import_jsx_runtime98.jsx)("span", { className: "text-foreground font-medium", children: entry.value?.toLocaleString("pt-BR") })
17946
18356
  ] }, index)
17947
18357
  ),
17948
- /* @__PURE__ */ (0, import_jsx_runtime97.jsx)("p", { className: "text-xs text-muted-foreground mt-1", children: "Clique para fixar este tooltip" })
18358
+ /* @__PURE__ */ (0, import_jsx_runtime98.jsx)("p", { className: "text-xs text-muted-foreground mt-1", children: "Clique para fixar este tooltip" })
17949
18359
  ] });
17950
18360
  };
17951
18361
  const getTitleClassName = (position) => {
@@ -17959,7 +18369,7 @@ var BarChart = ({
17959
18369
  return `${baseClasses} text-left`;
17960
18370
  }
17961
18371
  };
17962
- return /* @__PURE__ */ (0, import_jsx_runtime97.jsxs)(
18372
+ return /* @__PURE__ */ (0, import_jsx_runtime98.jsxs)(
17963
18373
  "div",
17964
18374
  {
17965
18375
  className: cn("rounded-lg bg-card p-4 relative", className),
@@ -17968,9 +18378,9 @@ var BarChart = ({
17968
18378
  maxWidth: "100%"
17969
18379
  },
17970
18380
  children: [
17971
- title && /* @__PURE__ */ (0, import_jsx_runtime97.jsx)("div", { style: { paddingLeft: `${resolvedContainerPaddingLeft}px` }, children: /* @__PURE__ */ (0, import_jsx_runtime97.jsx)("h3", { className: getTitleClassName(titlePosition), children: title }) }),
17972
- /* @__PURE__ */ (0, import_jsx_runtime97.jsxs)(
17973
- import_recharts2.BarChart,
18381
+ title && /* @__PURE__ */ (0, import_jsx_runtime98.jsx)("div", { style: { paddingLeft: `${resolvedContainerPaddingLeft}px` }, children: /* @__PURE__ */ (0, import_jsx_runtime98.jsx)("h3", { className: getTitleClassName(titlePosition), children: title }) }),
18382
+ /* @__PURE__ */ (0, import_jsx_runtime98.jsxs)(
18383
+ import_recharts3.BarChart,
17974
18384
  {
17975
18385
  data: processedData,
17976
18386
  width: typeof width === "number" ? width : 900,
@@ -17978,16 +18388,16 @@ var BarChart = ({
17978
18388
  margin: resolveChartMargins(margins, chartMargins, showLabels),
17979
18389
  onClick: handleChartClick,
17980
18390
  children: [
17981
- showGrid && /* @__PURE__ */ (0, import_jsx_runtime97.jsx)(
17982
- import_recharts2.CartesianGrid,
18391
+ showGrid && /* @__PURE__ */ (0, import_jsx_runtime98.jsx)(
18392
+ import_recharts3.CartesianGrid,
17983
18393
  {
17984
18394
  strokeDasharray: "3 3",
17985
18395
  stroke: gridColor || "hsl(var(--muted-foreground))",
17986
18396
  opacity: 0.5
17987
18397
  }
17988
18398
  ),
17989
- /* @__PURE__ */ (0, import_jsx_runtime97.jsx)(
17990
- import_recharts2.XAxis,
18399
+ /* @__PURE__ */ (0, import_jsx_runtime98.jsx)(
18400
+ import_recharts3.XAxis,
17991
18401
  {
17992
18402
  dataKey: xAxisConfig.dataKey,
17993
18403
  stroke: "hsl(var(--muted-foreground))",
@@ -17997,8 +18407,8 @@ var BarChart = ({
17997
18407
  tickFormatter: xAxisConfig.valueFormatter
17998
18408
  }
17999
18409
  ),
18000
- /* @__PURE__ */ (0, import_jsx_runtime97.jsx)(
18001
- import_recharts2.YAxis,
18410
+ /* @__PURE__ */ (0, import_jsx_runtime98.jsx)(
18411
+ import_recharts3.YAxis,
18002
18412
  {
18003
18413
  stroke: "hsl(var(--muted-foreground))",
18004
18414
  fontSize: 12,
@@ -18009,15 +18419,15 @@ var BarChart = ({
18009
18419
  tickCount: 6
18010
18420
  }
18011
18421
  ),
18012
- showTooltip && /* @__PURE__ */ (0, import_jsx_runtime97.jsx)(
18013
- import_recharts2.Tooltip,
18422
+ showTooltip && /* @__PURE__ */ (0, import_jsx_runtime98.jsx)(
18423
+ import_recharts3.Tooltip,
18014
18424
  {
18015
- content: /* @__PURE__ */ (0, import_jsx_runtime97.jsx)(CustomTooltip, {}),
18425
+ content: /* @__PURE__ */ (0, import_jsx_runtime98.jsx)(CustomTooltip, {}),
18016
18426
  cursor: { fill: "hsl(var(--muted))", opacity: 0.1 }
18017
18427
  }
18018
18428
  ),
18019
- showLegend && /* @__PURE__ */ (0, import_jsx_runtime97.jsx)(
18020
- import_recharts2.Legend,
18429
+ showLegend && /* @__PURE__ */ (0, import_jsx_runtime98.jsx)(
18430
+ import_recharts3.Legend,
18021
18431
  {
18022
18432
  wrapperStyle: {
18023
18433
  color: "hsl(var(--foreground))",
@@ -18027,8 +18437,8 @@ var BarChart = ({
18027
18437
  ),
18028
18438
  dataKeys.map((key) => {
18029
18439
  const fieldConfig = mapperConfig[key];
18030
- return /* @__PURE__ */ (0, import_jsx_runtime97.jsx)(
18031
- import_recharts2.Bar,
18440
+ return /* @__PURE__ */ (0, import_jsx_runtime98.jsx)(
18441
+ import_recharts3.Bar,
18032
18442
  {
18033
18443
  dataKey: key,
18034
18444
  name: fieldConfig?.label || key,
@@ -18036,8 +18446,8 @@ var BarChart = ({
18036
18446
  radius: [4, 4, 0, 0],
18037
18447
  onClick: handleBarClick,
18038
18448
  style: { cursor: "pointer" },
18039
- activeBar: /* @__PURE__ */ (0, import_jsx_runtime97.jsx)(
18040
- import_recharts2.Rectangle,
18449
+ activeBar: /* @__PURE__ */ (0, import_jsx_runtime98.jsx)(
18450
+ import_recharts3.Rectangle,
18041
18451
  {
18042
18452
  fill: finalColors[key],
18043
18453
  stroke: finalColors[key],
@@ -18045,8 +18455,8 @@ var BarChart = ({
18045
18455
  opacity: 0.8
18046
18456
  }
18047
18457
  ),
18048
- children: showLabels && /* @__PURE__ */ (0, import_jsx_runtime97.jsx)(
18049
- import_recharts2.LabelList,
18458
+ children: showLabels && /* @__PURE__ */ (0, import_jsx_runtime98.jsx)(
18459
+ import_recharts3.LabelList,
18050
18460
  {
18051
18461
  dataKey: key,
18052
18462
  position: "top",
@@ -18082,8 +18492,8 @@ var BarChart = ({
18082
18492
  guide.sourceTooltip.top + guide.sourceTooltip.height / 2,
18083
18493
  guide.targetTooltip.top + guide.targetTooltip.height / 2
18084
18494
  );
18085
- return /* @__PURE__ */ (0, import_jsx_runtime97.jsxs)("div", { children: [
18086
- /* @__PURE__ */ (0, import_jsx_runtime97.jsx)(
18495
+ return /* @__PURE__ */ (0, import_jsx_runtime98.jsxs)("div", { children: [
18496
+ /* @__PURE__ */ (0, import_jsx_runtime98.jsx)(
18087
18497
  "div",
18088
18498
  {
18089
18499
  className: "fixed pointer-events-none z-30",
@@ -18102,7 +18512,7 @@ var BarChart = ({
18102
18512
  }
18103
18513
  }
18104
18514
  ),
18105
- /* @__PURE__ */ (0, import_jsx_runtime97.jsx)(
18515
+ /* @__PURE__ */ (0, import_jsx_runtime98.jsx)(
18106
18516
  "div",
18107
18517
  {
18108
18518
  className: "fixed pointer-events-none z-31",
@@ -18118,7 +18528,7 @@ var BarChart = ({
18118
18528
  }
18119
18529
  }
18120
18530
  ),
18121
- /* @__PURE__ */ (0, import_jsx_runtime97.jsx)(
18531
+ /* @__PURE__ */ (0, import_jsx_runtime98.jsx)(
18122
18532
  "div",
18123
18533
  {
18124
18534
  className: "fixed pointer-events-none z-31",
@@ -18136,7 +18546,7 @@ var BarChart = ({
18136
18546
  )
18137
18547
  ] }, index);
18138
18548
  }),
18139
- activeTooltips.map((tooltip, index) => /* @__PURE__ */ (0, import_jsx_runtime97.jsx)(
18549
+ activeTooltips.map((tooltip, index) => /* @__PURE__ */ (0, import_jsx_runtime98.jsx)(
18140
18550
  DraggableTooltip_default,
18141
18551
  {
18142
18552
  id: tooltip.id,
@@ -18169,9 +18579,9 @@ var BarChart = ({
18169
18579
  var BarChart_default = BarChart;
18170
18580
 
18171
18581
  // src/components/ui/charts/LineChart.tsx
18172
- var import_react98 = require("react");
18173
- var import_recharts3 = require("recharts");
18174
- var import_jsx_runtime98 = require("react/jsx-runtime");
18582
+ var import_react99 = require("react");
18583
+ var import_recharts4 = require("recharts");
18584
+ var import_jsx_runtime99 = require("react/jsx-runtime");
18175
18585
  var defaultData = [
18176
18586
  { name: "A", value: 100 },
18177
18587
  { name: "B", value: 200 },
@@ -18203,14 +18613,14 @@ var CustomLineChart = ({
18203
18613
  containerPaddingLeft,
18204
18614
  16
18205
18615
  );
18206
- const [activeTooltips, setActiveTooltips] = (0, import_react98.useState)([]);
18207
- const [isDragging, setIsDragging] = (0, import_react98.useState)(null);
18208
- const [dragOffset, setDragOffset] = (0, import_react98.useState)({
18616
+ const [activeTooltips, setActiveTooltips] = (0, import_react99.useState)([]);
18617
+ const [isDragging, setIsDragging] = (0, import_react99.useState)(null);
18618
+ const [dragOffset, setDragOffset] = (0, import_react99.useState)({
18209
18619
  x: 0,
18210
18620
  y: 0
18211
18621
  });
18212
- const [globalTooltipCount, setGlobalTooltipCount] = (0, import_react98.useState)(0);
18213
- const [alignmentGuides, setAlignmentGuides] = (0, import_react98.useState)([]);
18622
+ const [globalTooltipCount, setGlobalTooltipCount] = (0, import_react99.useState)(0);
18623
+ const [alignmentGuides, setAlignmentGuides] = (0, import_react99.useState)([]);
18214
18624
  const generateColors = (dataKeys2) => {
18215
18625
  const colorMap = {};
18216
18626
  const allColors = generateAdditionalColors(colors2, dataKeys2.length);
@@ -18219,12 +18629,12 @@ var CustomLineChart = ({
18219
18629
  });
18220
18630
  return colorMap;
18221
18631
  };
18222
- const dataKeys = (0, import_react98.useMemo)(
18632
+ const dataKeys = (0, import_react99.useMemo)(
18223
18633
  () => data.length > 0 ? Object.keys(data[0]).filter((key) => key !== "name") : [],
18224
18634
  [data]
18225
18635
  );
18226
18636
  const finalColors = generateColors(dataKeys);
18227
- const maxDataValue = (0, import_react98.useMemo)(() => {
18637
+ const maxDataValue = (0, import_react99.useMemo)(() => {
18228
18638
  let max = 0;
18229
18639
  for (const row of data) {
18230
18640
  const r = row;
@@ -18236,7 +18646,7 @@ var CustomLineChart = ({
18236
18646
  }
18237
18647
  return max;
18238
18648
  }, [data, dataKeys]);
18239
- const niceMax = (0, import_react98.useMemo)(() => {
18649
+ const niceMax = (0, import_react99.useMemo)(() => {
18240
18650
  let padding2 = 0.08;
18241
18651
  if (maxDataValue > 1e6) padding2 = 0.05;
18242
18652
  if (maxDataValue > 1e7) padding2 = 0.03;
@@ -18270,7 +18680,7 @@ var CustomLineChart = ({
18270
18680
  setActiveTooltips((prev) => [...prev, newTooltip]);
18271
18681
  }
18272
18682
  };
18273
- return /* @__PURE__ */ (0, import_jsx_runtime98.jsx)(
18683
+ return /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(
18274
18684
  "circle",
18275
18685
  {
18276
18686
  cx,
@@ -18312,10 +18722,10 @@ var CustomLineChart = ({
18312
18722
  const handleChartBackgroundClick = () => {
18313
18723
  setActiveTooltips([]);
18314
18724
  };
18315
- const handleCloseAllTooltips = (0, import_react98.useCallback)(() => {
18725
+ const handleCloseAllTooltips = (0, import_react99.useCallback)(() => {
18316
18726
  window.dispatchEvent(new CustomEvent("closeAllTooltips"));
18317
18727
  }, []);
18318
- const updateAlignmentGuides = (0, import_react98.useCallback)(
18728
+ const updateAlignmentGuides = (0, import_react99.useCallback)(
18319
18729
  (draggedTooltipId, draggedPosition) => {
18320
18730
  const SNAP_THRESHOLD = 15;
18321
18731
  const draggedTooltip = activeTooltips.find(
@@ -18396,7 +18806,7 @@ var CustomLineChart = ({
18396
18806
  },
18397
18807
  [activeTooltips]
18398
18808
  );
18399
- const snapToGuides = (0, import_react98.useCallback)(
18809
+ const snapToGuides = (0, import_react99.useCallback)(
18400
18810
  (position) => {
18401
18811
  const SNAP_DISTANCE = 10;
18402
18812
  const snappedPosition = { ...position };
@@ -18424,7 +18834,7 @@ var CustomLineChart = ({
18424
18834
  setIsDragging(tooltipId);
18425
18835
  setDragOffset({ x: offsetX, y: offsetY });
18426
18836
  };
18427
- (0, import_react98.useEffect)(() => {
18837
+ (0, import_react99.useEffect)(() => {
18428
18838
  let rafId;
18429
18839
  let lastMousePosition = { x: 0, y: 0 };
18430
18840
  const handleGlobalMouseMove = (e) => {
@@ -18471,7 +18881,7 @@ var CustomLineChart = ({
18471
18881
  updateAlignmentGuides,
18472
18882
  snapToGuides
18473
18883
  ]);
18474
- (0, import_react98.useEffect)(() => {
18884
+ (0, import_react99.useEffect)(() => {
18475
18885
  const handleCloseAllTooltips2 = () => {
18476
18886
  setActiveTooltips([]);
18477
18887
  setGlobalTooltipCount(0);
@@ -18481,7 +18891,7 @@ var CustomLineChart = ({
18481
18891
  window.removeEventListener("closeAllTooltips", handleCloseAllTooltips2);
18482
18892
  };
18483
18893
  }, []);
18484
- (0, import_react98.useEffect)(() => {
18894
+ (0, import_react99.useEffect)(() => {
18485
18895
  const handleTooltipCountRequest = () => {
18486
18896
  window.dispatchEvent(
18487
18897
  new CustomEvent("tooltipCountResponse", {
@@ -18525,7 +18935,7 @@ var CustomLineChart = ({
18525
18935
  );
18526
18936
  };
18527
18937
  }, [activeTooltips]);
18528
- (0, import_react98.useEffect)(() => {
18938
+ (0, import_react99.useEffect)(() => {
18529
18939
  if (isDragging) return;
18530
18940
  let totalCount = 0;
18531
18941
  const handleCountResponse = (event) => {
@@ -18553,7 +18963,7 @@ var CustomLineChart = ({
18553
18963
  return "text-left";
18554
18964
  }
18555
18965
  };
18556
- return /* @__PURE__ */ (0, import_jsx_runtime98.jsx)("div", { className: cn("relative", className), children: /* @__PURE__ */ (0, import_jsx_runtime98.jsxs)(
18966
+ return /* @__PURE__ */ (0, import_jsx_runtime99.jsx)("div", { className: cn("relative", className), children: /* @__PURE__ */ (0, import_jsx_runtime99.jsxs)(
18557
18967
  "div",
18558
18968
  {
18559
18969
  className: "rounded-lg bg-card p-4 relative border border-border",
@@ -18563,9 +18973,9 @@ var CustomLineChart = ({
18563
18973
  },
18564
18974
  onClick: handleChartBackgroundClick,
18565
18975
  children: [
18566
- title && /* @__PURE__ */ (0, import_jsx_runtime98.jsx)("div", { style: { paddingLeft: `${resolvedContainerPaddingLeft}px` }, children: /* @__PURE__ */ (0, import_jsx_runtime98.jsx)("div", { className: cn("mb-4", getTitleClass()), children: /* @__PURE__ */ (0, import_jsx_runtime98.jsx)("h3", { className: "text-lg font-semibold text-foreground", children: title }) }) }),
18567
- /* @__PURE__ */ (0, import_jsx_runtime98.jsxs)(
18568
- import_recharts3.LineChart,
18976
+ title && /* @__PURE__ */ (0, import_jsx_runtime99.jsx)("div", { style: { paddingLeft: `${resolvedContainerPaddingLeft}px` }, children: /* @__PURE__ */ (0, import_jsx_runtime99.jsx)("div", { className: cn("mb-4", getTitleClass()), children: /* @__PURE__ */ (0, import_jsx_runtime99.jsx)("h3", { className: "text-lg font-semibold text-foreground", children: title }) }) }),
18977
+ /* @__PURE__ */ (0, import_jsx_runtime99.jsxs)(
18978
+ import_recharts4.LineChart,
18569
18979
  {
18570
18980
  data,
18571
18981
  width: typeof width === "number" ? width : 900,
@@ -18573,24 +18983,24 @@ var CustomLineChart = ({
18573
18983
  margin: resolveChartMargins(margins, chartMargins, showLabels),
18574
18984
  onClick: handleChartClick,
18575
18985
  children: [
18576
- showGrid && /* @__PURE__ */ (0, import_jsx_runtime98.jsx)(
18577
- import_recharts3.CartesianGrid,
18986
+ showGrid && /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(
18987
+ import_recharts4.CartesianGrid,
18578
18988
  {
18579
18989
  strokeDasharray: "3 3",
18580
18990
  stroke: gridColor || "hsl(var(--muted-foreground))",
18581
18991
  opacity: 0.3
18582
18992
  }
18583
18993
  ),
18584
- /* @__PURE__ */ (0, import_jsx_runtime98.jsx)(
18585
- import_recharts3.XAxis,
18994
+ /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(
18995
+ import_recharts4.XAxis,
18586
18996
  {
18587
18997
  dataKey: "name",
18588
18998
  className: "fill-muted-foreground text-xs",
18589
18999
  fontSize: 12
18590
19000
  }
18591
19001
  ),
18592
- /* @__PURE__ */ (0, import_jsx_runtime98.jsx)(
18593
- import_recharts3.YAxis,
19002
+ /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(
19003
+ import_recharts4.YAxis,
18594
19004
  {
18595
19005
  className: "fill-muted-foreground text-xs",
18596
19006
  fontSize: 12,
@@ -18599,9 +19009,9 @@ var CustomLineChart = ({
18599
19009
  tickCount: 6
18600
19010
  }
18601
19011
  ),
18602
- showTooltip && /* @__PURE__ */ (0, import_jsx_runtime98.jsx)(import_recharts3.Tooltip, { content: () => null }),
18603
- showLegend && /* @__PURE__ */ (0, import_jsx_runtime98.jsx)(
18604
- import_recharts3.Legend,
19012
+ showTooltip && /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(import_recharts4.Tooltip, { content: () => null }),
19013
+ showLegend && /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(
19014
+ import_recharts4.Legend,
18605
19015
  {
18606
19016
  wrapperStyle: {
18607
19017
  fontSize: "12px",
@@ -18609,17 +19019,17 @@ var CustomLineChart = ({
18609
19019
  }
18610
19020
  }
18611
19021
  ),
18612
- dataKeys.map((key) => /* @__PURE__ */ (0, import_jsx_runtime98.jsx)(
18613
- import_recharts3.Line,
19022
+ dataKeys.map((key) => /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(
19023
+ import_recharts4.Line,
18614
19024
  {
18615
19025
  type: "monotone",
18616
19026
  dataKey: key,
18617
19027
  stroke: finalColors[key],
18618
19028
  strokeWidth,
18619
19029
  dot: showDots ? { r: 4, cursor: "pointer" } : false,
18620
- activeDot: (props) => /* @__PURE__ */ (0, import_jsx_runtime98.jsx)(ClickableDot, { ...props, dataKey: key }),
18621
- children: showLabels && /* @__PURE__ */ (0, import_jsx_runtime98.jsx)(
18622
- import_recharts3.LabelList,
19030
+ activeDot: (props) => /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(ClickableDot, { ...props, dataKey: key }),
19031
+ children: showLabels && /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(
19032
+ import_recharts4.LabelList,
18623
19033
  {
18624
19034
  dataKey: key,
18625
19035
  position: "top",
@@ -18655,8 +19065,8 @@ var CustomLineChart = ({
18655
19065
  guide.sourceTooltip.top + guide.sourceTooltip.height / 2,
18656
19066
  guide.targetTooltip.top + guide.targetTooltip.height / 2
18657
19067
  );
18658
- return /* @__PURE__ */ (0, import_jsx_runtime98.jsxs)("div", { children: [
18659
- /* @__PURE__ */ (0, import_jsx_runtime98.jsx)(
19068
+ return /* @__PURE__ */ (0, import_jsx_runtime99.jsxs)("div", { children: [
19069
+ /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(
18660
19070
  "div",
18661
19071
  {
18662
19072
  className: "fixed pointer-events-none z-30",
@@ -18675,7 +19085,7 @@ var CustomLineChart = ({
18675
19085
  }
18676
19086
  }
18677
19087
  ),
18678
- /* @__PURE__ */ (0, import_jsx_runtime98.jsx)(
19088
+ /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(
18679
19089
  "div",
18680
19090
  {
18681
19091
  className: "fixed pointer-events-none z-31",
@@ -18691,7 +19101,7 @@ var CustomLineChart = ({
18691
19101
  }
18692
19102
  }
18693
19103
  ),
18694
- /* @__PURE__ */ (0, import_jsx_runtime98.jsx)(
19104
+ /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(
18695
19105
  "div",
18696
19106
  {
18697
19107
  className: "fixed pointer-events-none z-31",
@@ -18709,7 +19119,7 @@ var CustomLineChart = ({
18709
19119
  )
18710
19120
  ] }, index);
18711
19121
  }),
18712
- activeTooltips.map((tooltip, index) => /* @__PURE__ */ (0, import_jsx_runtime98.jsx)(
19122
+ activeTooltips.map((tooltip, index) => /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(
18713
19123
  DraggableTooltip_default,
18714
19124
  {
18715
19125
  id: tooltip.id,
@@ -18740,8 +19150,8 @@ var CustomLineChart = ({
18740
19150
  var LineChart_default = CustomLineChart;
18741
19151
 
18742
19152
  // src/components/ui/charts/PieChart.tsx
18743
- var import_recharts4 = require("recharts");
18744
- var import_jsx_runtime99 = require("react/jsx-runtime");
19153
+ var import_recharts5 = require("recharts");
19154
+ var import_jsx_runtime100 = require("react/jsx-runtime");
18745
19155
  var defaultData2 = [
18746
19156
  { name: "Vendas", value: 4e3 },
18747
19157
  { name: "Marketing", value: 3e3 },
@@ -18779,7 +19189,7 @@ var renderCustomizedLabel = ({
18779
19189
  const radius = innerRadius + (outerRadius - innerRadius) * 0.5;
18780
19190
  const x = cx + radius * Math.cos(-midAngle * RADIAN);
18781
19191
  const y = cy + radius * Math.sin(-midAngle * RADIAN);
18782
- return /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(
19192
+ return /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(
18783
19193
  "text",
18784
19194
  {
18785
19195
  x,
@@ -18808,9 +19218,9 @@ var CustomPieChart = ({
18808
19218
  centerY = "50%"
18809
19219
  }) => {
18810
19220
  const finalColors = colors2 || DEFAULT_COLORS5;
18811
- return /* @__PURE__ */ (0, import_jsx_runtime99.jsx)("div", { className: cn("w-full rounded-lg bg-card p-4", className), children: /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(import_recharts4.ResponsiveContainer, { width, height, children: /* @__PURE__ */ (0, import_jsx_runtime99.jsxs)(import_recharts4.PieChart, { children: [
18812
- /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(
18813
- import_recharts4.Pie,
19221
+ return /* @__PURE__ */ (0, import_jsx_runtime100.jsx)("div", { className: cn("w-full rounded-lg bg-card p-4", className), children: /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(import_recharts5.ResponsiveContainer, { width, height, children: /* @__PURE__ */ (0, import_jsx_runtime100.jsxs)(import_recharts5.PieChart, { children: [
19222
+ /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(
19223
+ import_recharts5.Pie,
18814
19224
  {
18815
19225
  data,
18816
19226
  cx: centerX,
@@ -18821,8 +19231,8 @@ var CustomPieChart = ({
18821
19231
  innerRadius,
18822
19232
  fill: "#8884d8",
18823
19233
  dataKey: "value",
18824
- children: data.map((entry, index) => /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(
18825
- import_recharts4.Cell,
19234
+ children: data.map((entry, index) => /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(
19235
+ import_recharts5.Cell,
18826
19236
  {
18827
19237
  fill: finalColors[index % finalColors.length]
18828
19238
  },
@@ -18830,8 +19240,8 @@ var CustomPieChart = ({
18830
19240
  ))
18831
19241
  }
18832
19242
  ),
18833
- showTooltip && /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(
18834
- import_recharts4.Tooltip,
19243
+ showTooltip && /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(
19244
+ import_recharts5.Tooltip,
18835
19245
  {
18836
19246
  contentStyle: {
18837
19247
  backgroundColor: "hsl(var(--popover))",
@@ -18841,16 +19251,59 @@ var CustomPieChart = ({
18841
19251
  }
18842
19252
  }
18843
19253
  ),
18844
- showLegend && /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(import_recharts4.Legend, {})
19254
+ showLegend && /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(import_recharts5.Legend, {})
18845
19255
  ] }) }) });
18846
19256
  };
18847
19257
  var PieChart_default = CustomPieChart;
18848
19258
 
19259
+ // src/components/ui/charts/TimeSeries.tsx
19260
+ var import_jsx_runtime101 = require("react/jsx-runtime");
19261
+ var TimeSeries = ({
19262
+ data,
19263
+ xAxis,
19264
+ chartHeight = 350,
19265
+ height,
19266
+ brushHeight,
19267
+ className,
19268
+ start,
19269
+ end,
19270
+ defaultStartIndex,
19271
+ defaultEndIndex,
19272
+ onRangeChange,
19273
+ brushColor,
19274
+ brushStroke,
19275
+ miniChartOpacity = 0.2,
19276
+ ...rest
19277
+ }) => {
19278
+ const brushHeightValue = brushHeight ?? height ?? 60;
19279
+ const startIndex = defaultStartIndex ?? start ?? 0;
19280
+ const endIndex = defaultEndIndex ?? end;
19281
+ return /* @__PURE__ */ (0, import_jsx_runtime101.jsx)("div", { className: cn("w-full flex flex-col", className), children: /* @__PURE__ */ (0, import_jsx_runtime101.jsx)(
19282
+ Chart_default,
19283
+ {
19284
+ ...rest,
19285
+ data,
19286
+ xAxis,
19287
+ height: chartHeight + brushHeightValue + 40,
19288
+ timeSeries: {
19289
+ start: startIndex,
19290
+ end: endIndex,
19291
+ onRangeChange,
19292
+ height: brushHeightValue,
19293
+ brushColor,
19294
+ brushStroke,
19295
+ miniChartOpacity
19296
+ }
19297
+ }
19298
+ ) });
19299
+ };
19300
+ var TimeSeries_default = TimeSeries;
19301
+
18849
19302
  // src/components/ui/LeaderBoard.tsx
18850
- var import_react99 = require("@phosphor-icons/react");
18851
- var import_react100 = require("react");
19303
+ var import_react100 = require("@phosphor-icons/react");
19304
+ var import_react101 = require("react");
18852
19305
  var import_framer_motion22 = require("framer-motion");
18853
- var import_jsx_runtime100 = require("react/jsx-runtime");
19306
+ var import_jsx_runtime102 = require("react/jsx-runtime");
18854
19307
  function Leaderboard({
18855
19308
  items,
18856
19309
  order: initialOrder = "desc",
@@ -18859,7 +19312,7 @@ function Leaderboard({
18859
19312
  isLoading = false,
18860
19313
  legend
18861
19314
  }) {
18862
- const [order, setOrder] = (0, import_react100.useState)(initialOrder);
19315
+ const [order, setOrder] = (0, import_react101.useState)(initialOrder);
18863
19316
  const mockData = [
18864
19317
  { name: "Ana", value: 92 },
18865
19318
  { name: "Bruno", value: 81 },
@@ -18892,47 +19345,47 @@ function Leaderboard({
18892
19345
  if (numValue >= 25) return "yellow";
18893
19346
  return "green";
18894
19347
  };
18895
- return /* @__PURE__ */ (0, import_jsx_runtime100.jsxs)(
19348
+ return /* @__PURE__ */ (0, import_jsx_runtime102.jsxs)(
18896
19349
  "div",
18897
19350
  {
18898
19351
  className: `border rounded-xl flex flex-col max-h-80 w-96 ${className}`,
18899
19352
  children: [
18900
- /* @__PURE__ */ (0, import_jsx_runtime100.jsxs)("div", { className: "flex items-center justify-between py-2 px-4 border-b flex-shrink-0 gap-3", children: [
18901
- /* @__PURE__ */ (0, import_jsx_runtime100.jsx)("h2", { className: "text-lg font-semibold px-1", children: title }),
18902
- /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(
19353
+ /* @__PURE__ */ (0, import_jsx_runtime102.jsxs)("div", { className: "flex items-center justify-between py-2 px-4 border-b flex-shrink-0 gap-3", children: [
19354
+ /* @__PURE__ */ (0, import_jsx_runtime102.jsx)("h2", { className: "text-lg font-semibold px-1", children: title }),
19355
+ /* @__PURE__ */ (0, import_jsx_runtime102.jsx)(
18903
19356
  ButtonBase,
18904
19357
  {
18905
19358
  size: "icon",
18906
19359
  variant: "ghost",
18907
19360
  onClick: () => setOrder(order === "desc" ? "asc" : "desc"),
18908
19361
  disabled: isLoading || sortedData.length === 0,
18909
- children: /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(import_react99.CaretUpDownIcon, {})
19362
+ children: /* @__PURE__ */ (0, import_jsx_runtime102.jsx)(import_react100.CaretUpDownIcon, {})
18910
19363
  }
18911
19364
  )
18912
19365
  ] }),
18913
- /* @__PURE__ */ (0, import_jsx_runtime100.jsx)("div", { className: "overflow-y-auto flex-1", children: isLoading ? /* @__PURE__ */ (0, import_jsx_runtime100.jsx)("div", { className: "p-4 space-y-3", children: Array.from({ length: 5 }).map((_, idx) => /* @__PURE__ */ (0, import_jsx_runtime100.jsxs)("div", { className: "flex items-center justify-between p-1", children: [
18914
- /* @__PURE__ */ (0, import_jsx_runtime100.jsxs)("div", { className: "flex items-center gap-3 flex-1", children: [
18915
- /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(SkeletonBase, { className: "w-8 h-8 rounded-full" }),
18916
- /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(SkeletonBase, { className: "h-4 w-36" })
19366
+ /* @__PURE__ */ (0, import_jsx_runtime102.jsx)("div", { className: "overflow-y-auto flex-1", children: isLoading ? /* @__PURE__ */ (0, import_jsx_runtime102.jsx)("div", { className: "p-4 space-y-3", children: Array.from({ length: 5 }).map((_, idx) => /* @__PURE__ */ (0, import_jsx_runtime102.jsxs)("div", { className: "flex items-center justify-between p-1", children: [
19367
+ /* @__PURE__ */ (0, import_jsx_runtime102.jsxs)("div", { className: "flex items-center gap-3 flex-1", children: [
19368
+ /* @__PURE__ */ (0, import_jsx_runtime102.jsx)(SkeletonBase, { className: "w-8 h-8 rounded-full" }),
19369
+ /* @__PURE__ */ (0, import_jsx_runtime102.jsx)(SkeletonBase, { className: "h-4 w-36" })
18917
19370
  ] }),
18918
- /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(SkeletonBase, { className: "h-6 w-12 rounded-full" })
18919
- ] }, idx)) }) : sortedData.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime100.jsx)("div", { className: "flex items-center justify-center h-full py-12", children: /* @__PURE__ */ (0, import_jsx_runtime100.jsx)("p", { className: "text-muted-foreground text-sm", children: "Sem dados dispon\xEDveis" }) }) : /* @__PURE__ */ (0, import_jsx_runtime100.jsxs)("div", { children: [
18920
- /* @__PURE__ */ (0, import_jsx_runtime100.jsxs)("div", { className: "flex items-center justify-between py-2.5 px-4 border-b flex-shrink-0 gap-3 sticky top-0 bg-background", children: [
18921
- /* @__PURE__ */ (0, import_jsx_runtime100.jsx)("div", { className: "text-xs font-medium text-muted-foreground uppercase tracking-wider pl-1", children: legend?.[0]?.[0] ?? "Participante" }),
18922
- /* @__PURE__ */ (0, import_jsx_runtime100.jsx)("div", { className: "text-xs font-medium text-muted-foreground uppercase tracking-wider", children: legend?.[0]?.[1] ?? "Pontua\xE7\xE3o" })
19371
+ /* @__PURE__ */ (0, import_jsx_runtime102.jsx)(SkeletonBase, { className: "h-6 w-12 rounded-full" })
19372
+ ] }, idx)) }) : sortedData.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime102.jsx)("div", { className: "flex items-center justify-center h-full py-12", children: /* @__PURE__ */ (0, import_jsx_runtime102.jsx)("p", { className: "text-muted-foreground text-sm", children: "Sem dados dispon\xEDveis" }) }) : /* @__PURE__ */ (0, import_jsx_runtime102.jsxs)("div", { children: [
19373
+ /* @__PURE__ */ (0, import_jsx_runtime102.jsxs)("div", { className: "flex items-center justify-between py-2.5 px-4 border-b flex-shrink-0 gap-3 sticky top-0 bg-background", children: [
19374
+ /* @__PURE__ */ (0, import_jsx_runtime102.jsx)("div", { className: "text-xs font-medium text-muted-foreground uppercase tracking-wider pl-1", children: legend?.[0]?.[0] ?? "Participante" }),
19375
+ /* @__PURE__ */ (0, import_jsx_runtime102.jsx)("div", { className: "text-xs font-medium text-muted-foreground uppercase tracking-wider", children: legend?.[0]?.[1] ?? "Pontua\xE7\xE3o" })
18923
19376
  ] }),
18924
- /* @__PURE__ */ (0, import_jsx_runtime100.jsx)("ul", { children: sortedData.map((item, idx) => /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(
19377
+ /* @__PURE__ */ (0, import_jsx_runtime102.jsx)("ul", { children: sortedData.map((item, idx) => /* @__PURE__ */ (0, import_jsx_runtime102.jsx)(
18925
19378
  import_framer_motion22.motion.span,
18926
19379
  {
18927
19380
  initial: { opacity: 0, y: 10 },
18928
19381
  animate: { opacity: 1, y: 0 },
18929
19382
  transition: { delay: idx * 5e-3 },
18930
- children: /* @__PURE__ */ (0, import_jsx_runtime100.jsxs)("li", { className: "flex items-center justify-between py-3 border-b last:border-b-0 hover:bg-muted transition-colors px-4", children: [
18931
- /* @__PURE__ */ (0, import_jsx_runtime100.jsxs)("div", { className: "flex items-center gap-3", children: [
18932
- /* @__PURE__ */ (0, import_jsx_runtime100.jsx)("span", { className: "text-sm text-gray-400 w-6 h-6 border rounded-full text-center bg-muted/50", children: idx + 1 }),
18933
- /* @__PURE__ */ (0, import_jsx_runtime100.jsx)("span", { className: "font-medium", children: item.name })
19383
+ children: /* @__PURE__ */ (0, import_jsx_runtime102.jsxs)("li", { className: "flex items-center justify-between py-3 border-b last:border-b-0 hover:bg-muted transition-colors px-4", children: [
19384
+ /* @__PURE__ */ (0, import_jsx_runtime102.jsxs)("div", { className: "flex items-center gap-3", children: [
19385
+ /* @__PURE__ */ (0, import_jsx_runtime102.jsx)("span", { className: "text-sm text-gray-400 w-6 h-6 border rounded-full text-center bg-muted/50", children: idx + 1 }),
19386
+ /* @__PURE__ */ (0, import_jsx_runtime102.jsx)("span", { className: "font-medium", children: item.name })
18934
19387
  ] }),
18935
- /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(
19388
+ /* @__PURE__ */ (0, import_jsx_runtime102.jsx)(
18936
19389
  Badge,
18937
19390
  {
18938
19391
  color: getBadgeColor(item.value),