@mlw-packages/react-components 1.8.4 → 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.mjs CHANGED
@@ -491,7 +491,7 @@ function cn(...inputs) {
491
491
  }
492
492
 
493
493
  // src/components/ui/form/ButtonBase.tsx
494
- import { CircleNotchIcon } from "@phosphor-icons/react";
494
+ import { CircleNotchIcon as CircleNotchIcon2 } from "@phosphor-icons/react";
495
495
 
496
496
  // src/components/ui/feedback/AlertDialogBase.tsx
497
497
  import * as React from "react";
@@ -630,18 +630,12 @@ var DialogContentBase = React2.forwardRef(
630
630
  {
631
631
  ref,
632
632
  className: cn(
633
- "fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg max-h-[100dvh] overflow-hidden rounded-md",
633
+ "fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg max-h-[100dvh] overflow-auto rounded-md border-border",
634
634
  className
635
635
  ),
636
636
  "data-testid": dataTestId,
637
637
  ...props,
638
- onWheel: (e) => {
639
- try {
640
- userOnWheel?.(e);
641
- } finally {
642
- e.stopPropagation();
643
- }
644
- },
638
+ onWheel: userOnWheel,
645
639
  children: [
646
640
  children,
647
641
  /* @__PURE__ */ jsxs2(DialogPrimitive.Close, { className: "absolute right-3 top-3 sm:right-4 sm:top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground z-10 touch-manipulation", children: [
@@ -958,7 +952,7 @@ var ProgressBase = React5.forwardRef(
958
952
  default:
959
953
  return /* @__PURE__ */ jsxs4("div", { className: "flex flex-col gap-1 w-full min-w-[150px]", children: [
960
954
  label && /* @__PURE__ */ jsx5(LabelBase_default, { className: "py-2", children: label }),
961
- /* @__PURE__ */ jsxs4("div", { className: "flex items-center gap-2", children: [
955
+ /* @__PURE__ */ jsxs4("div", { className: "flex items-center justify-between gap-2", children: [
962
956
  showValue && valuePosition === "left" && /* @__PURE__ */ jsxs4("div", { className: "w-12 text-sm text-right font-extrabold", children: [
963
957
  Math.round(value || 0),
964
958
  "%"
@@ -1172,49 +1166,59 @@ import {
1172
1166
  XCircleIcon,
1173
1167
  InfoIcon,
1174
1168
  WarningIcon,
1175
- SpinnerIcon
1169
+ CircleNotchIcon
1176
1170
  } from "@phosphor-icons/react";
1177
1171
  import { Toaster as Sonner, toast as sonnertoast } from "sonner";
1178
1172
  import { jsx as jsx7 } from "react/jsx-runtime";
1179
- var iconBaseClass = "w-5 h-auto";
1173
+ var iconBaseClass = "w-5 h-5";
1180
1174
  var Toaster = ({ testId, ...props }) => {
1181
1175
  return /* @__PURE__ */ jsx7(
1182
1176
  Sonner,
1183
1177
  {
1184
1178
  className: "toaster group",
1185
1179
  position: "top-center",
1180
+ duration: 4e3,
1186
1181
  toastOptions: {
1182
+ style: {
1183
+ backdropFilter: "blur(8px)",
1184
+ WebkitBackdropFilter: "blur(8px)"
1185
+ },
1187
1186
  classNames: {
1188
1187
  toast: `
1189
1188
  group toast
1190
- bg-background
1189
+ bg-background/95
1191
1190
  text-foreground
1192
- shadow-lg rounded-md
1191
+ shadow-xl rounded-lg
1193
1192
  border-l-4
1194
1193
  border-border
1195
1194
  flex items-center gap-3
1196
- 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
1197
- 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
1198
- 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
1199
- 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
1195
+ transition-all duration-300
1196
+ hover:scale-[1.02] hover:shadow-2xl
1197
+ 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
1198
+ 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
1199
+ 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
1200
+ 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
1200
1201
  `,
1201
1202
  description: `
1202
- text-sm
1203
+ text-xs
1204
+ font-semibold
1203
1205
  group-[.toast]:text-neutral-600
1204
1206
  `,
1205
1207
  actionButton: `
1206
1208
  ml-auto
1207
1209
  rounded-md px-3 py-1 text-sm font-semibold
1208
1210
  bg-neutral-800 text-white
1209
- hover:bg-neutral-700
1210
- transition-colors duration-200
1211
+ hover:bg-neutral-700 hover:scale-105
1212
+ transition-all duration-200
1213
+ active:scale-95
1211
1214
  `,
1212
1215
  cancelButton: `
1213
1216
  ml-2
1214
1217
  rounded-md px-3 py-1 text-sm font-semibold
1215
1218
  bg-neutral-100 text-neutral-700
1216
- hover:bg-neutral-200
1217
- transition-colors duration-200
1219
+ hover:bg-neutral-200 hover:scale-105
1220
+ transition-all duration-200
1221
+ active:scale-95
1218
1222
  `
1219
1223
  }
1220
1224
  },
@@ -1224,24 +1228,52 @@ var Toaster = ({ testId, ...props }) => {
1224
1228
  );
1225
1229
  };
1226
1230
  var toast = {
1227
- success: (message) => sonnertoast.success(message, {
1228
- icon: /* @__PURE__ */ jsx7(CheckCircleIcon, { className: `${iconBaseClass} text-green-600`, weight: "fill" }),
1231
+ success: (message, description) => sonnertoast.success(message, {
1232
+ description,
1233
+ icon: /* @__PURE__ */ jsx7(
1234
+ CheckCircleIcon,
1235
+ {
1236
+ className: `${iconBaseClass} text-green-600`,
1237
+ weight: "fill"
1238
+ }
1239
+ ),
1229
1240
  className: "sonner-success"
1230
1241
  }),
1231
- error: (message) => sonnertoast.error(message, {
1232
- icon: /* @__PURE__ */ jsx7(XCircleIcon, { className: `${iconBaseClass} text-red-600`, weight: "fill" }),
1242
+ error: (message, description) => sonnertoast.error(message, {
1243
+ description,
1244
+ icon: /* @__PURE__ */ jsx7(
1245
+ XCircleIcon,
1246
+ {
1247
+ className: `${iconBaseClass} text-red-600`,
1248
+ weight: "fill"
1249
+ }
1250
+ ),
1233
1251
  className: "sonner-error"
1234
1252
  }),
1235
- warning: (message) => sonnertoast.warning(message, {
1236
- icon: /* @__PURE__ */ jsx7(WarningIcon, { className: `${iconBaseClass} text-yellow-600`, weight: "fill" }),
1237
- className: "sonner-WarningIcon"
1253
+ warning: (message, description) => sonnertoast.warning(message, {
1254
+ description,
1255
+ icon: /* @__PURE__ */ jsx7(
1256
+ WarningIcon,
1257
+ {
1258
+ className: `${iconBaseClass} text-yellow-600`,
1259
+ weight: "fill"
1260
+ }
1261
+ ),
1262
+ className: "sonner-warning"
1238
1263
  }),
1239
- info: (message) => sonnertoast.info(message, {
1264
+ info: (message, description) => sonnertoast.info(message, {
1265
+ description,
1240
1266
  icon: /* @__PURE__ */ jsx7(InfoIcon, { className: `${iconBaseClass} text-blue-600`, weight: "fill" }),
1241
- className: "sonner-InfoIcon"
1267
+ className: "sonner-info"
1242
1268
  }),
1243
- loading: (message) => sonnertoast(message, {
1244
- icon: /* @__PURE__ */ jsx7(SpinnerIcon, { className: `${iconBaseClass} animate-spin text-neutral-500`, weight: "fill" }),
1269
+ loading: (message, description) => sonnertoast(message, {
1270
+ description,
1271
+ icon: /* @__PURE__ */ jsx7(
1272
+ CircleNotchIcon,
1273
+ {
1274
+ className: `${iconBaseClass} animate-spin text-gray-600`
1275
+ }
1276
+ ),
1245
1277
  className: "sonner-loading"
1246
1278
  })
1247
1279
  };
@@ -1389,12 +1421,21 @@ var TooltipTriggerBase = React7.forwardRef(({ children, onPointerDown, ...props
1389
1421
  },
1390
1422
  [onPointerDown]
1391
1423
  );
1424
+ const onClick = React7.useCallback(
1425
+ (e) => {
1426
+ if (onPointerDown) {
1427
+ onPointerDown(e);
1428
+ }
1429
+ },
1430
+ [onPointerDown]
1431
+ );
1392
1432
  return /* @__PURE__ */ jsx8(
1393
1433
  TooltipPrimitive.Trigger,
1394
1434
  {
1395
1435
  ref,
1396
1436
  tabIndex: -1,
1397
1437
  onPointerDown: onPointerDown ? handlePointerDown : void 0,
1438
+ onClick,
1398
1439
  "data-tooltip-trigger": true,
1399
1440
  "aria-describedby": "tooltip-content",
1400
1441
  ...props,
@@ -1559,7 +1600,7 @@ var ModalContentBase = React9.forwardRef(
1559
1600
  ref,
1560
1601
  className: cn(
1561
1602
  "fixed z-50 grid w-full gap-4 border bg-background p-6 shadow-lg sm:rounded-lg max-h-[90dvh] overflow-auto",
1562
- "data-[state=open]:animate-modal-in data-[state=closed]:animate-modal-out",
1603
+ "data-[state=open]:animate-modal-in data-[state=closed]:animate-modal-out border-border",
1563
1604
  positionClass,
1564
1605
  sizeClass,
1565
1606
  className
@@ -1639,7 +1680,7 @@ var buttonVariantsBase = cva2(
1639
1680
  variant: {
1640
1681
  default: "bg-primary text-primary-foreground shadow-xs hover:bg-primary/90",
1641
1682
  destructive: "bg-destructive text-white shadow-xs hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40",
1642
- outline: "border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-background dark:border-input dark:hover:bg-background/95",
1683
+ outline: "border border-border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-background dark:border-input dark:hover:bg-background/95",
1643
1684
  select: "box-border border border-input bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-background dark:hover:bg-background/95",
1644
1685
  secondary: "bg-secondary text-secondary-foreground shadow-xs hover:bg-secondary/80",
1645
1686
  ghost: "hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",
@@ -1691,7 +1732,7 @@ var ButtonBase = React10.forwardRef(
1691
1732
  isActivelyLoading && /* @__PURE__ */ jsxs8("span", { className: "absolute inset-0 flex items-center justify-center pointer-events-none rounded-md", children: [
1692
1733
  /* @__PURE__ */ jsx11("span", { className: "absolute inset-0 rounded-md backdrop-blur overflow-hidden" }),
1693
1734
  /* @__PURE__ */ jsx11(
1694
- CircleNotchIcon,
1735
+ CircleNotchIcon2,
1695
1736
  {
1696
1737
  weight: "bold",
1697
1738
  className: "relative animate-spin h-4 w-4 text-current"
@@ -1995,6 +2036,11 @@ var PopoverContentBase = React13.forwardRef(
1995
2036
  className
1996
2037
  ),
1997
2038
  "data-testid": dataTestId,
2039
+ onInteractOutside: (event) => {
2040
+ props.onInteractOutside?.(event);
2041
+ if (event.defaultPrevented) return;
2042
+ event.stopPropagation();
2043
+ },
1998
2044
  ...props
1999
2045
  }
2000
2046
  ) })
@@ -2056,7 +2102,7 @@ function ComboboxBase({
2056
2102
  testIds = {},
2057
2103
  onClear,
2058
2104
  hasSelected = false,
2059
- hiddenClean = (node) => node
2105
+ hideClear = false
2060
2106
  }) {
2061
2107
  const [open, setOpen] = useState4(false);
2062
2108
  return /* @__PURE__ */ jsxs11(
@@ -2070,13 +2116,13 @@ function ComboboxBase({
2070
2116
  {
2071
2117
  open,
2072
2118
  onOpenChange: (v) => !disabled && setOpen(v),
2073
- modal: true,
2119
+ modal: false,
2074
2120
  children: [
2075
2121
  /* @__PURE__ */ jsx17(
2076
2122
  PopoverTriggerBase,
2077
2123
  {
2078
2124
  asChild: true,
2079
- className: "flex w-full justify-between dark:bg-[hsl(231,15%,19%)]",
2125
+ className: "flex w-full justify-between dark:bg-[hsl(231,15%,19%)] p-3",
2080
2126
  children: /* @__PURE__ */ jsxs11(
2081
2127
  ButtonBase,
2082
2128
  {
@@ -2094,19 +2140,17 @@ function ComboboxBase({
2094
2140
  children: [
2095
2141
  renderSelected,
2096
2142
  /* @__PURE__ */ jsx17(motion2.span, { className: "flex items-center", children: /* @__PURE__ */ jsxs11("div", { className: "flex flex-row gap-0 items-center ", children: [
2097
- hasSelected && onClear && !disabled && hiddenClean(
2098
- /* @__PURE__ */ jsx17(
2099
- ClearButton,
2100
- {
2101
- onClick: (e) => {
2102
- if (e) e.stopPropagation();
2103
- if (onClear && !disabled) {
2104
- onClear();
2105
- if (!keepOpen) setOpen(false);
2106
- }
2143
+ hasSelected && onClear && !disabled && !hideClear && /* @__PURE__ */ jsx17(
2144
+ ClearButton,
2145
+ {
2146
+ onClick: (e) => {
2147
+ if (e) e.stopPropagation();
2148
+ if (onClear && !disabled) {
2149
+ onClear();
2150
+ if (!keepOpen) setOpen(false);
2107
2151
  }
2108
2152
  }
2109
- )
2153
+ }
2110
2154
  ),
2111
2155
  /* @__PURE__ */ jsx17(
2112
2156
  motion2.div,
@@ -2222,7 +2266,8 @@ function Combobox({
2222
2266
  label,
2223
2267
  labelClassname,
2224
2268
  testIds,
2225
- error
2269
+ error,
2270
+ hideClear = false
2226
2271
  }) {
2227
2272
  const selectedItem = items.find((item) => item.value === selected);
2228
2273
  const renderSelected = useMemo2(() => {
@@ -2268,7 +2313,8 @@ function Combobox({
2268
2313
  testIds,
2269
2314
  onClear: handleClear,
2270
2315
  isMulti: false,
2271
- hasSelected: !!selectedItem
2316
+ hasSelected: !!selectedItem,
2317
+ hideClear
2272
2318
  }
2273
2319
  )
2274
2320
  ] });
@@ -2350,14 +2396,19 @@ function MultiSelectBase({
2350
2396
  onValuesChange,
2351
2397
  disabled,
2352
2398
  empty,
2353
- error
2399
+ error,
2400
+ initialItems
2354
2401
  }) {
2355
2402
  const [open, setOpen] = useState5(false);
2356
2403
  const [internalValues, setInternalValues] = useState5(
2357
2404
  new Set(values ?? defaultValues)
2358
2405
  );
2359
2406
  const selectedValues = values ? new Set(values) : internalValues;
2360
- const [items, setItems] = useState5(/* @__PURE__ */ new Map());
2407
+ const [items, setItems] = useState5(() => {
2408
+ if (!initialItems) return /* @__PURE__ */ new Map();
2409
+ if (initialItems instanceof Map) return new Map(initialItems);
2410
+ return new Map(initialItems.map((it) => [it.value, it.label]));
2411
+ });
2361
2412
  function toggleValue(value) {
2362
2413
  if (disabled) return;
2363
2414
  const getNewSet = (prev) => {
@@ -2573,41 +2624,48 @@ function MultiSelectContentBase({
2573
2624
  ...props
2574
2625
  }) {
2575
2626
  const canSearch = typeof search === "object" ? true : search;
2576
- const { emptyMessage, items } = useMultiSelectContext();
2577
- return /* @__PURE__ */ jsx20(Fragment2, { children: /* @__PURE__ */ jsx20(PopoverContentBase, { className: "w-[--radix-popover-trigger-width] relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md p-0", children: /* @__PURE__ */ jsx20(
2578
- motion3.div,
2627
+ const { emptyMessage, items, open } = useMultiSelectContext();
2628
+ return /* @__PURE__ */ jsx20(Fragment2, { children: /* @__PURE__ */ jsx20(
2629
+ PopoverContentBase,
2579
2630
  {
2580
- initial: { opacity: 0, scale: 0.95 },
2581
- animate: { opacity: 1, scale: 1 },
2582
- exit: { opacity: 0, scale: 0.95 },
2583
- transition: { duration: 0.2 },
2584
- children: /* @__PURE__ */ jsx20("div", { className: cn(" "), children: /* @__PURE__ */ jsxs13(
2585
- CommandBase,
2631
+ forceMount: true,
2632
+ className: "w-[--radix-popover-trigger-width] relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md p-0",
2633
+ children: /* @__PURE__ */ jsx20(
2634
+ motion3.div,
2586
2635
  {
2587
- ...props,
2588
- filter: (value, search2) => {
2589
- const labelNode = items.get(value);
2590
- const label = typeof labelNode === "string" ? labelNode : value;
2591
- if (label.toLowerCase().includes(search2.toLowerCase()))
2592
- return 1;
2593
- return 0;
2594
- },
2595
- children: [
2596
- canSearch ? /* @__PURE__ */ jsx20(
2597
- CommandInputBase,
2598
- {
2599
- placeholder: typeof search === "object" ? search.placeholder : void 0
2600
- }
2601
- ) : /* @__PURE__ */ jsx20("button", { autoFocus: true, className: "sr-only" }),
2602
- /* @__PURE__ */ jsxs13(CommandListBase, { children: [
2603
- canSearch && /* @__PURE__ */ jsx20(CommandEmptyBase, { children: typeof search === "object" ? search.emptyMessage ?? emptyMessage : emptyMessage }),
2604
- children
2605
- ] })
2606
- ]
2636
+ initial: { opacity: 0, scale: 0.95 },
2637
+ animate: { opacity: open ? 1 : 0, scale: open ? 1 : 0.95 },
2638
+ transition: { duration: 0.2 },
2639
+ style: { pointerEvents: open ? "auto" : "none" },
2640
+ children: /* @__PURE__ */ jsx20("div", { className: cn(" "), children: /* @__PURE__ */ jsxs13(
2641
+ CommandBase,
2642
+ {
2643
+ ...props,
2644
+ filter: (value, search2) => {
2645
+ const labelNode = items.get(value);
2646
+ const label = typeof labelNode === "string" ? labelNode : value;
2647
+ if (label.toLowerCase().includes(search2.toLowerCase()))
2648
+ return 1;
2649
+ return 0;
2650
+ },
2651
+ children: [
2652
+ canSearch ? /* @__PURE__ */ jsx20(
2653
+ CommandInputBase,
2654
+ {
2655
+ placeholder: typeof search === "object" ? search.placeholder : void 0
2656
+ }
2657
+ ) : /* @__PURE__ */ jsx20("button", { autoFocus: true, className: "sr-only" }),
2658
+ /* @__PURE__ */ jsxs13(CommandListBase, { children: [
2659
+ canSearch && /* @__PURE__ */ jsx20(CommandEmptyBase, { children: typeof search === "object" ? search.emptyMessage ?? emptyMessage : emptyMessage }),
2660
+ children
2661
+ ] })
2662
+ ]
2663
+ }
2664
+ ) })
2607
2665
  }
2608
- ) })
2666
+ )
2609
2667
  }
2610
- ) }) });
2668
+ ) });
2611
2669
  }
2612
2670
  function MultiSelectItemBase({
2613
2671
  value,
@@ -2709,6 +2767,7 @@ function MultiCombobox({
2709
2767
  disabled,
2710
2768
  empty,
2711
2769
  error,
2770
+ initialItems: items,
2712
2771
  children: [
2713
2772
  /* @__PURE__ */ jsx21(
2714
2773
  MultiSelectTriggerBase,
@@ -2749,8 +2808,7 @@ function MultiCombobox({
2749
2808
  )
2750
2809
  ]
2751
2810
  }
2752
- ),
2753
- /* @__PURE__ */ jsx21(ErrorMessage_default, { error })
2811
+ )
2754
2812
  ]
2755
2813
  }
2756
2814
  );
@@ -2830,6 +2888,11 @@ var SelectContentBase = React14.forwardRef(
2830
2888
  ),
2831
2889
  position,
2832
2890
  "data-testid": dataTestId,
2891
+ onPointerDownOutside: (event) => {
2892
+ props.onPointerDownOutside?.(event);
2893
+ if (event.defaultPrevented) return;
2894
+ event.stopPropagation();
2895
+ },
2833
2896
  ...props,
2834
2897
  asChild: true,
2835
2898
  children: /* @__PURE__ */ jsx23(
@@ -2978,7 +3041,7 @@ var DropDownMenuContentBase = React15.forwardRef(
2978
3041
  exit: { opacity: 0, scale: 0.95, y: 5 },
2979
3042
  transition: { duration: 0.2, ease: "easeOut" },
2980
3043
  className: cn(
2981
- "min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md",
3044
+ "min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md border-border",
2982
3045
  className
2983
3046
  ),
2984
3047
  children: props.children
@@ -3162,35 +3225,13 @@ function ModeToggleBase({
3162
3225
  setTheme(newTheme);
3163
3226
  return;
3164
3227
  }
3165
- const button = buttonRef.current;
3166
- const rect = button.getBoundingClientRect();
3228
+ const rect = buttonRef.current.getBoundingClientRect();
3167
3229
  const x = rect.left + rect.width / 2;
3168
3230
  const y = rect.top + rect.height / 2;
3169
3231
  const endRadius = Math.hypot(
3170
3232
  Math.max(x, window.innerWidth - x),
3171
3233
  Math.max(y, window.innerHeight - y)
3172
3234
  );
3173
- const styleId = "theme-transition-styles";
3174
- if (!document.getElementById(styleId)) {
3175
- const style = document.createElement("style");
3176
- style.id = styleId;
3177
- style.textContent = `
3178
- ::view-transition-old(root),
3179
- ::view-transition-new(root) {
3180
- animation: none;
3181
- mix-blend-mode: normal;
3182
- }
3183
-
3184
- ::view-transition-old(root) {
3185
- z-index: 1;
3186
- }
3187
-
3188
- ::view-transition-new(root) {
3189
- z-index: 2;
3190
- }
3191
- `;
3192
- document.head.appendChild(style);
3193
- }
3194
3235
  const transition = document.startViewTransition(async () => {
3195
3236
  setTheme(newTheme);
3196
3237
  });
@@ -3198,14 +3239,14 @@ function ModeToggleBase({
3198
3239
  document.documentElement.animate(
3199
3240
  [
3200
3241
  {
3201
- clipPath: `circle(0% at ${x}px ${y}px)`
3242
+ clipPath: `circle(0px at ${x}px ${y}px)`
3202
3243
  },
3203
3244
  {
3204
3245
  clipPath: `circle(${Math.ceil(endRadius)}px at ${x}px ${y}px)`
3205
3246
  }
3206
3247
  ],
3207
3248
  {
3208
- duration: 600,
3249
+ duration: 400,
3209
3250
  easing: "cubic-bezier(0.4, 0, 0.2, 1)",
3210
3251
  pseudoElement: "::view-transition-new(root)"
3211
3252
  }
@@ -3365,7 +3406,7 @@ var CardBase = React17.forwardRef(({ className, testid: dataTestId = "card-base"
3365
3406
  {
3366
3407
  ref,
3367
3408
  className: cn(
3368
- "rounded-xl border bg-card text-card-foreground shadow",
3409
+ "rounded-xl border border-border bg-card text-card-foreground shadow",
3369
3410
  className
3370
3411
  ),
3371
3412
  "data-testid": dataTestId,
@@ -7352,7 +7393,7 @@ function StatusIndicator({
7352
7393
 
7353
7394
  // src/components/ui/form/DebouncedInput.tsx
7354
7395
  import { useEffect as useEffect15, useState as useState14 } from "react";
7355
- import { CircleNotchIcon as CircleNotchIcon2 } from "@phosphor-icons/react";
7396
+ import { CircleNotchIcon as CircleNotchIcon3 } from "@phosphor-icons/react";
7356
7397
  import { jsx as jsx54 } from "react/jsx-runtime";
7357
7398
  function DebouncedInput({
7358
7399
  value: initialValue,
@@ -7387,7 +7428,7 @@ function DebouncedInput({
7387
7428
  }, [debounce2, initialValue, onChange, value]);
7388
7429
  const renderRightIcon = () => {
7389
7430
  if (showLoadingIndicator && isDebouncing) {
7390
- return /* @__PURE__ */ jsx54(CircleNotchIcon2, { className: "h-4 w-4 animate-spin text-muted-foreground" });
7431
+ return /* @__PURE__ */ jsx54(CircleNotchIcon3, { className: "h-4 w-4 animate-spin text-muted-foreground" });
7391
7432
  }
7392
7433
  return rightIcon;
7393
7434
  };
@@ -7587,7 +7628,7 @@ function CalendarBase2({
7587
7628
  "div",
7588
7629
  {
7589
7630
  className: cn(
7590
- "rounded-md border bg-background p-3 overflow-hidden flex flex-col",
7631
+ "rounded-md border p-3 overflow-hidden flex flex-col",
7591
7632
  className
7592
7633
  ),
7593
7634
  children: /* @__PURE__ */ jsx57("div", { className: "relative flex-1 flex flex-col min-h-0", children: /* @__PURE__ */ jsx57(
@@ -7608,12 +7649,12 @@ function CalendarBase2({
7608
7649
  button_previous: cn(
7609
7650
  buttonVariantsBase({ variant: "outline" }),
7610
7651
  "h-8 w-8 flex items-center justify-center p-0 rounded-md transition-transform duration-150 ease-out focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-primary/40 active:scale-95 absolute right-11 top-0 z-10",
7611
- isMobile ? "mr-8" : ""
7652
+ isMobile ? "" : ""
7612
7653
  ),
7613
7654
  button_next: cn(
7614
7655
  buttonVariantsBase({ variant: "outline" }),
7615
7656
  "h-8 w-8 flex items-center justify-center p-0 rounded-md transition-transform duration-150 ease-out focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-primary/40 active:scale-95 absolute right-0 top-0 z-10",
7616
- isMobile ? "mr-8" : ""
7657
+ isMobile ? "" : ""
7617
7658
  ),
7618
7659
  month_grid: "w-full min-w-0 flex-1 grid grid-rows-[auto_1fr] gap-2",
7619
7660
  weekdays: "grid grid-cols-7 gap-1 mb-1",
@@ -7633,8 +7674,8 @@ function CalendarBase2({
7633
7674
  ),
7634
7675
  selected: "bg-primary text-primary-foreground hover:bg-primary/90 focus:bg-primary/90 font-semibold hover:text-white rounded-md",
7635
7676
  today: "bg-muted text-foreground font-bold ring-2 ring-primary/30 ring-inset rounded-md",
7636
- outside: "text-muted-foreground/40 opacity-60 aria-selected:bg-muted/50 aria-selected:text-foreground",
7637
- disabled: "text-muted-foreground/30 opacity-40 cursor-not-allowed",
7677
+ outside: "text-muted-foreground opacity-60 aria-selected:bg-muted/50 aria-selected:text-foreground",
7678
+ disabled: "text-muted-foreground cursor-not-allowed",
7638
7679
  range_middle: "aria-selected:bg-muted aria-selected:text-foreground",
7639
7680
  hidden: "invisible",
7640
7681
  ...classNames
@@ -7664,29 +7705,19 @@ import { CalendarBlankIcon, CalendarDotIcon } from "@phosphor-icons/react";
7664
7705
  // src/components/ui/picker/TimeScrollPicker.tsx
7665
7706
  import { useEffect as useEffect17, useRef as useRef10, useState as useState18 } from "react";
7666
7707
  import { jsx as jsx58, jsxs as jsxs40 } from "react/jsx-runtime";
7667
- var ITEM_HEIGHT = 39;
7668
- var ITEM_HEIGHT_MOBILE = 32;
7708
+ var ITEM_HEIGHT = 38.5;
7669
7709
  var VISIBLE_ITEMS = 5;
7670
- var VISIBLE_ITEMS_MOBILE = 3;
7671
7710
  var CENTER_INDEX = Math.floor(VISIBLE_ITEMS / 2);
7672
- var CENTER_INDEX_MOBILE = Math.floor(VISIBLE_ITEMS_MOBILE / 2);
7673
- function ScrollColumn({
7674
- value,
7675
- onChange,
7676
- max,
7677
- label,
7678
- hideSeconds
7679
- }) {
7680
- const isMobile = useIsMobile();
7711
+ function ScrollColumn({ value, onChange, max, label }) {
7681
7712
  const containerRef = useRef10(null);
7682
7713
  const items = Array.from({ length: max }, (_, i) => i);
7683
7714
  const [isDragging, setIsDragging] = useState18(false);
7684
7715
  const [startY, setStartY] = useState18(0);
7685
7716
  const [scrollTop, setScrollTop] = useState18(0);
7686
7717
  const scrollTimeoutRef = useRef10(null);
7687
- const itemHeight = isMobile ? ITEM_HEIGHT_MOBILE : ITEM_HEIGHT;
7688
- const centerIndex = isMobile ? CENTER_INDEX_MOBILE : CENTER_INDEX;
7689
- const visibleItems = isMobile ? VISIBLE_ITEMS_MOBILE : VISIBLE_ITEMS;
7718
+ const itemHeight = ITEM_HEIGHT;
7719
+ const centerIndex = CENTER_INDEX;
7720
+ const visibleItems = VISIBLE_ITEMS;
7690
7721
  const containerHeight = visibleItems * itemHeight;
7691
7722
  useEffect17(() => {
7692
7723
  if (containerRef.current && !isDragging) {
@@ -7705,7 +7736,9 @@ function ScrollColumn({
7705
7736
  }
7706
7737
  };
7707
7738
  }, []);
7708
- const handleScroll = () => {
7739
+ const handleScroll = (e) => {
7740
+ e.stopPropagation();
7741
+ e.preventDefault();
7709
7742
  if (!containerRef.current || isDragging) return;
7710
7743
  if (scrollTimeoutRef.current) clearTimeout(scrollTimeoutRef.current);
7711
7744
  scrollTimeoutRef.current = setTimeout(() => {
@@ -7743,15 +7776,18 @@ function ScrollColumn({
7743
7776
  const handleMouseLeave = () => {
7744
7777
  if (isDragging) handleMouseUp();
7745
7778
  };
7746
- const containerWidth = isMobile ? hideSeconds ? "w-16" : "w-8" : "w-16";
7747
- return /* @__PURE__ */ jsxs40("div", { className: "flex flex-col items-center gap-1", children: [
7748
- /* @__PURE__ */ jsx58("span", { className: "text-muted-foreground rounded-md font-semibold text-[clamp(0.575rem,1.2vw,0.75rem)] sm:text-[clamp(0.65rem,1.1vw,0.825rem)] text-center pb-1 uppercase tracking-wider", children: label }),
7749
- /* @__PURE__ */ jsx58("div", { className: cn("relative", containerWidth), children: /* @__PURE__ */ jsx58(
7779
+ const handleWheel = (e) => {
7780
+ e.stopPropagation();
7781
+ };
7782
+ return /* @__PURE__ */ jsxs40("div", { className: "flex flex-col items-center", children: [
7783
+ /* @__PURE__ */ jsx58("span", { className: "text-muted-foreground rounded-md font-semibold text-sm sm:text-sm text-center pb-2 uppercase tracking-wider", children: label }),
7784
+ /* @__PURE__ */ jsx58("div", { className: cn("relative w-20 sm:w-16"), children: /* @__PURE__ */ jsx58(
7750
7785
  "div",
7751
7786
  {
7752
7787
  ref: containerRef,
7753
- className: "overflow-y-auto [&::-webkit-scrollbar]:hidden [-ms-overflow-style:none] [scrollbar-width:none]",
7788
+ className: "overflow-y-auto [&::-webkit-scrollbar]:hidden [-ms-overflow-style:none] [scrollbar-width:none] touch-action-pan-y",
7754
7789
  onScroll: handleScroll,
7790
+ onWheel: handleWheel,
7755
7791
  onMouseDown: handleMouseDown,
7756
7792
  onMouseMove: handleMouseMove,
7757
7793
  onMouseUp: handleMouseUp,
@@ -7768,9 +7804,9 @@ function ScrollColumn({
7768
7804
  "div",
7769
7805
  {
7770
7806
  className: cn(
7771
- "flex items-center justify-center select-none font-semibold tabular-nums",
7807
+ "flex items-center justify-center select-none font-semibold tabular-nums transition-all duration-150",
7772
7808
  isDragging ? "cursor-grabbing" : "",
7773
- isSelected ? "sm:text-lg text-md text-foreground" : "sm:text-sm text-xs text-muted-foreground"
7809
+ isSelected ? "text-lg sm:text-xl text-foreground scale-110" : "text-sm sm:text-base text-muted-foreground opacity-60"
7774
7810
  ),
7775
7811
  style: { height: `${itemHeight}px` },
7776
7812
  onClick: () => !isDragging && onChange(item),
@@ -7788,10 +7824,9 @@ function TimeScrollPicker({
7788
7824
  setDate,
7789
7825
  hideSeconds = false
7790
7826
  }) {
7791
- const isMobile = useIsMobile();
7792
7827
  const currentDate = date || /* @__PURE__ */ new Date();
7793
- const itemHeight = isMobile ? ITEM_HEIGHT_MOBILE : ITEM_HEIGHT;
7794
- const centerIndex = isMobile ? CENTER_INDEX_MOBILE : CENTER_INDEX;
7828
+ const itemHeight = ITEM_HEIGHT;
7829
+ const centerIndex = CENTER_INDEX;
7795
7830
  const handleTimeChange = (type, value) => {
7796
7831
  const newDate = new Date(currentDate);
7797
7832
  if (type === "hours") newDate.setHours(value);
@@ -7799,13 +7834,13 @@ function TimeScrollPicker({
7799
7834
  else newDate.setSeconds(value);
7800
7835
  setDate(newDate);
7801
7836
  };
7802
- return /* @__PURE__ */ jsx58("div", { className: "flex items-center justify-center gap-2 p-3", children: /* @__PURE__ */ jsxs40("div", { className: cn("relative flex gap-2"), children: [
7837
+ return /* @__PURE__ */ jsx58("div", { className: "flex items-center justify-center gap-2 p-3 sm:p-4", children: /* @__PURE__ */ jsxs40("div", { className: cn("relative flex gap-4 sm:gap-3"), children: [
7803
7838
  /* @__PURE__ */ jsx58(
7804
7839
  "div",
7805
7840
  {
7806
- className: "absolute left-0 right-0 pointer-events-none z-10 rounded-md bg-primary/5",
7841
+ className: "absolute left-0 right-0 pointer-events-none z-10 rounded-lg bg-primary/10 border border-primary/20",
7807
7842
  style: {
7808
- top: `calc(1.75rem + ${centerIndex * itemHeight}px)`,
7843
+ top: `calc(1.85rem + ${centerIndex * itemHeight}px)`,
7809
7844
  height: `${itemHeight}px`
7810
7845
  }
7811
7846
  }
@@ -7893,12 +7928,17 @@ function DateTimePicker({
7893
7928
  }) {
7894
7929
  const [internalDate, setInternalDate] = useState20(date);
7895
7930
  const [open, setOpen] = useState20(false);
7931
+ const [activeTab, setActiveTab] = useState20("calendar");
7896
7932
  const isMobile = useIsMobile();
7897
7933
  const handleSelect = (newDay) => {
7898
7934
  if (!newDay) return;
7899
7935
  if (!internalDate) {
7900
7936
  const now = /* @__PURE__ */ new Date();
7901
- newDay.setHours(now.getHours(), now.getMinutes(), now.getSeconds());
7937
+ newDay.setUTCHours(
7938
+ now.getUTCHours(),
7939
+ now.getUTCMinutes(),
7940
+ now.getUTCSeconds()
7941
+ );
7902
7942
  setInternalDate(newDay);
7903
7943
  onChange?.(newDay);
7904
7944
  return;
@@ -7911,7 +7951,6 @@ function DateTimePicker({
7911
7951
  };
7912
7952
  const handleTimeChange = (newDate) => {
7913
7953
  setInternalDate(newDate);
7914
- onChange?.(newDate);
7915
7954
  };
7916
7955
  const getTimeFormat = () => {
7917
7956
  if (hideTime) return "";
@@ -7928,6 +7967,9 @@ function DateTimePicker({
7928
7967
  };
7929
7968
  useEffect19(() => {
7930
7969
  setInternalDate(date);
7970
+ if (open) {
7971
+ setActiveTab("calendar");
7972
+ }
7931
7973
  }, [date, open]);
7932
7974
  const { ref: contentRef, center } = use_auto_center_default(open);
7933
7975
  const basePopoverClass = "w-auto max-w-[calc(100vw-16px)] p-0 border-none shadow-none";
@@ -7967,12 +8009,55 @@ function DateTimePicker({
7967
8009
  ]
7968
8010
  }
7969
8011
  );
7970
- const renderPickerContent = () => /* @__PURE__ */ jsxs41("div", { className: "p-3 border rounded-md", children: [
7971
- /* @__PURE__ */ jsxs41(
8012
+ const renderPickerContent = () => /* @__PURE__ */ jsxs41("div", { className: "p-2 sm:p-3 border border-border rounded-md", children: [
8013
+ isMobile && !hideTime ? /* @__PURE__ */ jsxs41("div", { className: "min-h-[380px] max-h-[calc(400px)]", children: [
8014
+ internalDate && /* @__PURE__ */ jsx59("div", { className: "flex items-center gap-3 px-4 py-3 rounded-lg ", children: /* @__PURE__ */ jsxs41("span", { className: "text-md font-semibold", children: [
8015
+ format(internalDate, "dd 'de' MMMM 'de' yyyy", {
8016
+ locale: ptBR2
8017
+ }),
8018
+ " ",
8019
+ "- ",
8020
+ format(internalDate, hideSeconds ? "HH:mm" : "HH:mm:ss")
8021
+ ] }) }),
8022
+ /* @__PURE__ */ jsxs41(TabsBase, { value: activeTab, onValueChange: setActiveTab, children: [
8023
+ /* @__PURE__ */ jsxs41(TabsListBase, { className: "", children: [
8024
+ /* @__PURE__ */ jsx59(TabsTriggerBase, { value: "calendar", className: "flex-1", children: "Data" }),
8025
+ /* @__PURE__ */ jsx59(TabsTriggerBase, { value: "time", className: "flex-1", children: "Hor\xE1rio" })
8026
+ ] }),
8027
+ /* @__PURE__ */ jsx59(TabsContentBase, { value: "calendar", className: "mt-0", children: /* @__PURE__ */ jsx59(
8028
+ CalendarBase2,
8029
+ {
8030
+ mode: "single",
8031
+ locale: ptBR2,
8032
+ selected: internalDate ?? void 0,
8033
+ onSelect: (d) => handleSelect(d ?? null),
8034
+ autoFocus: true,
8035
+ defaultMonth: fromDate ?? toDate ?? internalDate ?? void 0,
8036
+ ...fromDate && { startMonth: fromDate },
8037
+ ...toDate && { endMonth: toDate },
8038
+ ...fromDate || toDate ? {
8039
+ disabled: [
8040
+ ...fromDate ? [{ before: fromDate }] : [],
8041
+ ...toDate ? [{ after: toDate }] : []
8042
+ ]
8043
+ } : {},
8044
+ className: cn("w-full rounded-none border-none")
8045
+ }
8046
+ ) }),
8047
+ /* @__PURE__ */ jsx59(TabsContentBase, { value: "time", className: "mt-0", children: /* @__PURE__ */ jsx59("div", { className: "flex flex-col items-center justify-center gap-4 py-2 min-h-[330px]", children: /* @__PURE__ */ jsx59(
8048
+ TimeScrollPicker,
8049
+ {
8050
+ setDate: (d) => handleTimeChange(d ?? null),
8051
+ date: internalDate,
8052
+ hideSeconds
8053
+ }
8054
+ ) }) })
8055
+ ] })
8056
+ ] }) : /* @__PURE__ */ jsxs41(
7972
8057
  "div",
7973
8058
  {
7974
8059
  ref: contentRef,
7975
- className: "flex sm:flex-row max-h-auto overflow-y-auto border-none rounded-md",
8060
+ className: "flex flex-col sm:flex-row max-h-auto overflow-y-auto border-none rounded-md",
7976
8061
  children: [
7977
8062
  /* @__PURE__ */ jsx59(
7978
8063
  CalendarBase2,
@@ -7986,15 +8071,14 @@ function DateTimePicker({
7986
8071
  ...fromDate && { startMonth: fromDate },
7987
8072
  ...toDate && { endMonth: toDate },
7988
8073
  ...fromDate || toDate ? {
7989
- hidden: [
8074
+ disabled: [
7990
8075
  ...fromDate ? [{ before: fromDate }] : [],
7991
8076
  ...toDate ? [{ after: toDate }] : []
7992
8077
  ]
7993
8078
  } : {},
7994
8079
  className: cn(
7995
8080
  "w-max rounded-none border-none",
7996
- !hideTime && "sm:rounded-r-none rounded-b-none",
7997
- isMobile ? "border-b-transparent w-full" : ""
8081
+ !hideTime && "sm:rounded-r-none"
7998
8082
  )
7999
8083
  }
8000
8084
  ),
@@ -8003,7 +8087,7 @@ function DateTimePicker({
8003
8087
  {
8004
8088
  className: cn(
8005
8089
  "flex flex-col items-center justify-center",
8006
- isMobile ? "border-none" : "border-l"
8090
+ "border-l"
8007
8091
  ),
8008
8092
  children: [
8009
8093
  /* @__PURE__ */ jsx59("div", { className: "text-[clamp(0.85rem,1.4vw,1.125rem)] sm:text-[clamp(0.9rem,1.6vw,1.125rem)] font-semibold capitalize text-left", children: "Hor\xE1rio" }),
@@ -8021,60 +8105,61 @@ function DateTimePicker({
8021
8105
  ]
8022
8106
  }
8023
8107
  ),
8024
- /* @__PURE__ */ jsx59("div", { className: "flex rounded-md p-1.5", children: /* @__PURE__ */ jsxs41("div", { className: "grid grid-cols-2 w-full gap-12", children: [
8025
- /* @__PURE__ */ jsxs41("div", { className: "flex items-center gap-2", children: [
8026
- /* @__PURE__ */ jsx59(
8027
- ButtonBase,
8028
- {
8029
- variant: "outline",
8030
- size: "icon",
8031
- className: "no-active-animation",
8032
- tooltip: "Hoje",
8033
- onClick: () => {
8034
- const now = /* @__PURE__ */ new Date();
8035
- const selected = hideTime ? new Date(
8036
- now.getFullYear(),
8037
- now.getMonth(),
8038
- now.getDate(),
8108
+ /* @__PURE__ */ jsxs41("div", { className: "flex rounded-md p-1.5 gap-2", children: [
8109
+ /* @__PURE__ */ jsx59(
8110
+ ButtonBase,
8111
+ {
8112
+ variant: "outline",
8113
+ className: "no-active-animation",
8114
+ tooltip: "Hoje",
8115
+ size: "icon",
8116
+ onClick: () => {
8117
+ const now = /* @__PURE__ */ new Date();
8118
+ const selected = hideTime ? new Date(
8119
+ Date.UTC(
8120
+ now.getUTCFullYear(),
8121
+ now.getUTCMonth(),
8122
+ now.getUTCDate(),
8039
8123
  0,
8040
8124
  0,
8041
8125
  0,
8042
8126
  0
8043
- ) : now;
8044
- setInternalDate(selected);
8045
- onChange?.(selected);
8046
- onConfirm?.(selected);
8047
- },
8048
- children: /* @__PURE__ */ jsx59(CalendarDotIcon, { className: "h-4 w-4" })
8049
- }
8050
- ),
8127
+ )
8128
+ ) : now;
8129
+ setInternalDate(selected);
8130
+ onChange?.(selected);
8131
+ onConfirm?.(selected);
8132
+ },
8133
+ children: /* @__PURE__ */ jsx59(CalendarDotIcon, { className: "h-4 w-4" })
8134
+ }
8135
+ ),
8136
+ /* @__PURE__ */ jsxs41("div", { className: "grid grid-cols-2 sm:flex-row w-full gap-2", children: [
8051
8137
  /* @__PURE__ */ jsx59(
8052
8138
  ButtonBase,
8053
8139
  {
8054
- className: "no-active-animation rounded-md bg-background text-gray-800 border hover:bg-muted/50 overflow-y-hidden w-full",
8140
+ className: "no-active-animation rounded-md bg-background text-primary border hover:bg-muted/50 overflow-hidden flex-1 min-w-0 border-border",
8055
8141
  onClick: () => setOpen(false),
8056
8142
  children: "Cancelar"
8057
8143
  }
8144
+ ),
8145
+ /* @__PURE__ */ jsx59(
8146
+ ButtonBase,
8147
+ {
8148
+ className: cn(
8149
+ "no-active-animation rounded-md bg-emerald-600",
8150
+ internalDate ? "hover:bg-emerald-700" : "opacity-50 cursor-not-allowed"
8151
+ ),
8152
+ disabled: !internalDate,
8153
+ onClick: () => {
8154
+ if (!internalDate) return;
8155
+ setOpen(false);
8156
+ onConfirm?.(internalDate);
8157
+ },
8158
+ children: "Confirmar"
8159
+ }
8058
8160
  )
8059
- ] }),
8060
- /* @__PURE__ */ jsx59(
8061
- ButtonBase,
8062
- {
8063
- className: cn(
8064
- "no-active-animation rounded-none bg-emerald-600",
8065
- internalDate ? "hover:bg-emerald-700" : "opacity-50 cursor-not-allowed",
8066
- isMobile ? "" : "rounded-md"
8067
- ),
8068
- disabled: !internalDate,
8069
- onClick: () => {
8070
- if (!internalDate) return;
8071
- setOpen(false);
8072
- onConfirm?.(internalDate);
8073
- },
8074
- children: "Confirmar"
8075
- }
8076
- )
8077
- ] }) })
8161
+ ] })
8162
+ ] })
8078
8163
  ] });
8079
8164
  return /* @__PURE__ */ jsxs41("div", { className: cn("w-full sm:w-auto", className), children: [
8080
8165
  label && /* @__PURE__ */ jsx59(LabelBase_default, { children: label }),
@@ -8089,7 +8174,7 @@ function DateTimePicker({
8089
8174
  }
8090
8175
  ),
8091
8176
  /* @__PURE__ */ jsx59(ErrorMessage_default, { error }),
8092
- /* @__PURE__ */ jsx59(DialogContentBase, { className: "p-0 max-w-[min(95vw,450px)] max-h-[90vh] overflow-hidden", children: renderPickerContent() })
8177
+ /* @__PURE__ */ jsx59(DialogContentBase, { className: "p-0 max-w-[min(95vw,450px)] max-h-[95vh] overflow-y-auto", children: renderPickerContent() })
8093
8178
  ] }) : /* @__PURE__ */ jsxs41(PopoverBase, { open, onOpenChange: setOpen, children: [
8094
8179
  /* @__PURE__ */ jsx59(
8095
8180
  PopoverTriggerBase,
@@ -8155,7 +8240,7 @@ function RangePicker({
8155
8240
  const { ref: contentRef, center } = use_auto_center_default(open);
8156
8241
  const basePopoverClass = "w-auto max-w-[calc(100vw-16px)] p-0 border shadow-none";
8157
8242
  const centeredPopoverClass = "w-auto max-w-[calc(100vw-16px)] p-0 border shadow-none fixed left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 z-50";
8158
- return /* @__PURE__ */ jsxs42("div", { className: cn("w-full sm:w-auto", className), children: [
8243
+ return /* @__PURE__ */ jsxs42("div", { className: cn("w-full sm:w-auto ", className), children: [
8159
8244
  label && /* @__PURE__ */ jsx60(LabelBase_default, { children: label }),
8160
8245
  /* @__PURE__ */ jsxs42(PopoverBase, { open, onOpenChange: setOpen, children: [
8161
8246
  /* @__PURE__ */ jsx60(
@@ -8163,7 +8248,7 @@ function RangePicker({
8163
8248
  {
8164
8249
  disabled,
8165
8250
  asChild: true,
8166
- className: cn(error && "border-red-500"),
8251
+ className: cn(error && "border-red-500 "),
8167
8252
  children: /* @__PURE__ */ jsxs42(
8168
8253
  ButtonBase,
8169
8254
  {
@@ -8186,17 +8271,25 @@ function RangePicker({
8186
8271
  })} - ${format2(range.to, "P", { locale: dateFnsLocale })}` : "Selecione um intervalo"
8187
8272
  }
8188
8273
  ),
8189
- range && /* @__PURE__ */ jsx60(
8190
- ClearButton,
8191
- {
8192
- className: "-mr-3",
8193
- onClick: (e) => {
8194
- e?.stopPropagation();
8195
- handleClear();
8274
+ /* @__PURE__ */ jsx60(motion12.span, { className: "flex items-center", children: /* @__PURE__ */ jsxs42("div", { className: "flex flex-row gap-0 items-center ", children: [
8275
+ range && /* @__PURE__ */ jsx60(
8276
+ ClearButton,
8277
+ {
8278
+ onClick: (e) => {
8279
+ e?.stopPropagation();
8280
+ handleClear();
8281
+ }
8196
8282
  }
8197
- }
8198
- ),
8199
- /* @__PURE__ */ jsx60(CalendarBlankIcon2, { className: "flex-shrink-0 w-5 h-5 sm:w-6 sm:h-6" })
8283
+ ),
8284
+ /* @__PURE__ */ jsx60(
8285
+ motion12.div,
8286
+ {
8287
+ animate: { rotate: open ? 15 : 0 },
8288
+ transition: { duration: 0.03 },
8289
+ children: /* @__PURE__ */ jsx60(CalendarBlankIcon2, { className: "h-4 w-4" })
8290
+ }
8291
+ )
8292
+ ] }) })
8200
8293
  ]
8201
8294
  }
8202
8295
  )
@@ -8219,7 +8312,7 @@ function RangePicker({
8219
8312
  animate: { opacity: 1, y: 0 },
8220
8313
  exit: { opacity: 0, y: -4 },
8221
8314
  transition: { duration: 0.18, ease: "easeOut" },
8222
- className: "border rounded-md shadow-xl ",
8315
+ className: "border border-border rounded-md shadow-xl ",
8223
8316
  children: [
8224
8317
  /* @__PURE__ */ jsx60("div", { className: "p-4", children: /* @__PURE__ */ jsx60(
8225
8318
  motion12.div,
@@ -9986,7 +10079,7 @@ function Select({
9986
10079
  labelClassname,
9987
10080
  className,
9988
10081
  pagination,
9989
- hideClear = true
10082
+ hideClear = false
9990
10083
  }) {
9991
10084
  const [page, setPage] = useState24(1);
9992
10085
  const [animating, setAnimating] = useState24(false);
@@ -10058,7 +10151,7 @@ function Select({
10058
10151
  }
10059
10152
  ),
10060
10153
  /* @__PURE__ */ jsx68(motion14.span, { className: "flex items-center", children: /* @__PURE__ */ jsxs49("div", { className: "flex flex-row gap-0 items-center ", children: [
10061
- hideClear && selected && /* @__PURE__ */ jsx68(
10154
+ !hideClear && selected && /* @__PURE__ */ jsx68(
10062
10155
  ClearButton,
10063
10156
  {
10064
10157
  onClick: () => {
@@ -10298,7 +10391,7 @@ function EventAgenda({
10298
10391
  "div",
10299
10392
  {
10300
10393
  className: cn(
10301
- "flex flex-col rounded-lg border has-data-[slot=month-view]:flex-1 px-6 py-2",
10394
+ "flex flex-col rounded-lg border has-data-[slot=month-view]:flex-1 px-6 py-2 border-border",
10302
10395
  className
10303
10396
  ),
10304
10397
  style: {
@@ -10343,7 +10436,8 @@ function EventAgenda({
10343
10436
  },
10344
10437
  items: selectItems,
10345
10438
  className: "gap-2 px-3 py-1.5 max-[479px]:h-8",
10346
- placeholder: viewLabel(view)
10439
+ placeholder: viewLabel(view),
10440
+ hideClear: true
10347
10441
  }
10348
10442
  ) })
10349
10443
  ] }),
@@ -14191,6 +14285,12 @@ function MultiSelect({
14191
14285
  const id = setTimeout(() => setAnimating(false), 220);
14192
14286
  return () => clearTimeout(id);
14193
14287
  }, [page, pagination]);
14288
+ const initialItems = useMemo24(() => {
14289
+ if (groupItems) {
14290
+ return Object.values(groupItems).flat();
14291
+ }
14292
+ return items ?? [];
14293
+ }, [items, groupItems]);
14194
14294
  return /* @__PURE__ */ jsxs64("div", { "data-testid": testIds.root ?? "multiselect-root", children: [
14195
14295
  label && /* @__PURE__ */ jsx86(LabelBase_default, { className: labelClassname, children: label }),
14196
14296
  /* @__PURE__ */ jsxs64(
@@ -14202,6 +14302,7 @@ function MultiSelect({
14202
14302
  disabled,
14203
14303
  empty,
14204
14304
  error,
14305
+ initialItems,
14205
14306
  children: [
14206
14307
  /* @__PURE__ */ jsx86(
14207
14308
  MultiSelectTriggerBase,
@@ -14345,27 +14446,27 @@ function MultiSelect({
14345
14446
  }
14346
14447
 
14347
14448
  // src/components/ui/charts/Chart.tsx
14348
- import { useEffect as useEffect33, useCallback as useCallback17, useMemo as useMemo26 } from "react";
14449
+ import { useEffect as useEffect34, useCallback as useCallback18, useMemo as useMemo26 } from "react";
14349
14450
  import {
14350
- ComposedChart,
14351
- Bar,
14352
- Line,
14353
- Area,
14451
+ ComposedChart as ComposedChart2,
14452
+ Bar as Bar2,
14453
+ Line as Line2,
14454
+ Area as Area2,
14354
14455
  Rectangle,
14355
14456
  ReferenceLine,
14356
- XAxis,
14357
- YAxis,
14457
+ XAxis as XAxis2,
14458
+ YAxis as YAxis2,
14358
14459
  CartesianGrid,
14359
14460
  Tooltip,
14360
14461
  Legend,
14361
14462
  LabelList,
14362
- ResponsiveContainer
14463
+ ResponsiveContainer as ResponsiveContainer2
14363
14464
  } from "recharts";
14364
14465
 
14365
14466
  // src/components/ui/charts/utils/helpers.ts
14366
14467
  var formatFieldName = (fieldName) => {
14367
14468
  return fieldName.split(/[/_-]/).filter(Boolean).map((word) => {
14368
- return word.charAt(0).toUpperCase() + word.slice(1).toLowerCase();
14469
+ return word.charAt(0).toUpperCase() + word.slice(1);
14369
14470
  }).join(" ").trim();
14370
14471
  };
14371
14472
  var detectDataFields = (data, xAxisKey) => {
@@ -15926,100 +16027,305 @@ var TooltipSimple = ({
15926
16027
  };
15927
16028
  var TooltipSimple_default = TooltipSimple;
15928
16029
 
15929
- // src/components/ui/charts/utils/pillLabelRenderer.tsx
16030
+ // src/components/ui/charts/components/Brush.tsx
16031
+ import {
16032
+ ComposedChart,
16033
+ Bar,
16034
+ Line,
16035
+ Area,
16036
+ XAxis,
16037
+ YAxis,
16038
+ ResponsiveContainer
16039
+ } from "recharts";
15930
16040
  import { jsx as jsx94, jsxs as jsxs72 } from "react/jsx-runtime";
15931
- var formatCompactNumber = (value) => {
15932
- const isNegative = value < 0;
15933
- const absValue = Math.abs(value);
15934
- let formatted;
15935
- if (absValue >= 1e9) {
15936
- formatted = (absValue / 1e9).toFixed(1).replace(/\.0$/, "") + "B";
15937
- } else if (absValue >= 1e6) {
15938
- formatted = (absValue / 1e6).toFixed(1).replace(/\.0$/, "") + "M";
15939
- } else if (absValue >= 1e3) {
15940
- formatted = (absValue / 1e3).toFixed(1).replace(/\.0$/, "") + " mil";
15941
- } else {
15942
- try {
15943
- const nf = new Intl.NumberFormat("pt-BR", {
15944
- minimumFractionDigits: 2,
15945
- maximumFractionDigits: 2
15946
- });
15947
- formatted = nf.format(absValue);
15948
- } catch {
15949
- formatted = String(absValue).replace(".", ",");
15950
- }
15951
- }
15952
- return isNegative ? `-${formatted}` : formatted;
15953
- };
15954
- var parseNumber = (v) => {
15955
- if (typeof v === "number") return v;
15956
- if (typeof v === "string" && v.trim() !== "" && !Number.isNaN(Number(v)))
15957
- return Number(v);
15958
- return void 0;
15959
- };
15960
- var renderPillLabel = (color, variant, valueFormatter2) => {
15961
- return (props) => {
15962
- const { x, y, value } = props;
15963
- const defaultFormatted = typeof value === "number" ? formatCompactNumber(value) : String(value ?? "");
15964
- const text = valueFormatter2 ? valueFormatter2({
15965
- value,
15966
- formattedValue: defaultFormatted,
15967
- ...props
15968
- }) : defaultFormatted;
15969
- const paddingX = 8;
15970
- const approxCharWidth = 7;
15971
- const pillWidth = Math.max(
15972
- 40,
15973
- String(text).length * approxCharWidth + paddingX * 2
15974
- );
15975
- const pillHeight = 14;
15976
- const xNum = parseNumber(x);
15977
- const px = parseNumber(props.x);
15978
- const pWidth = parseNumber(props.width);
15979
- const vb = props.viewBox;
15980
- const cxNum = parseNumber(props.cx);
15981
- let centerX;
15982
- let usedBarCenter = false;
15983
- if (typeof px === "number" && typeof pWidth === "number") {
15984
- centerX = px + pWidth / 2;
15985
- usedBarCenter = true;
15986
- } else if (typeof xNum === "number" && typeof pWidth === "number") {
15987
- centerX = xNum + pWidth / 2;
15988
- usedBarCenter = true;
15989
- } else if (typeof cxNum === "number") {
15990
- centerX = cxNum;
15991
- } else if (vb && typeof vb.x === "number" && typeof vb.width === "number" && typeof props.index === "number") {
15992
- const approxCols = Math.max(1, props.index + 1);
15993
- const colWidth = vb.width / approxCols;
15994
- centerX = vb.x + colWidth * (props.index + 0.5);
15995
- } else if (vb && typeof vb.x === "number" && typeof vb.width === "number") {
15996
- centerX = vb.x + vb.width / 2;
15997
- } else {
15998
- centerX = typeof props.index === "number" ? props.index * 40 + 24 : 0;
15999
- }
16000
- if (!usedBarCenter && vb && typeof vb.x === "number" && typeof vb.width === "number") {
16001
- const minX = vb.x + pillWidth / 2;
16002
- const maxX = vb.x + vb.width - pillWidth / 2;
16003
- centerX = Math.max(minX, Math.min(maxX, centerX));
16004
- }
16005
- const yNum = parseNumber(y);
16006
- const py = parseNumber(props.y);
16007
- const cyNum = parseNumber(props.cy);
16008
- const centerY = yNum ?? (typeof py === "number" ? py : vb && typeof vb.y === "number" && typeof vb.height === "number" ? vb.y + vb.height / 2 : typeof cyNum === "number" ? cyNum : 0);
16009
- const rectX = centerX - pillWidth / 2;
16010
- const rectY = centerY - pillHeight - 6;
16011
- const textX = centerX;
16012
- const textY = rectY + pillHeight / 2 + 3;
16013
- const rectFill = variant === "filled" ? color : variant === "soft" ? `${color}20` : "#ffffff";
16014
- const rectStroke = variant === "outline" ? `${color}CC` : void 0;
16015
- let textColor;
16041
+ var Brush = ({
16042
+ data,
16043
+ startIndex,
16044
+ endIndex,
16045
+ onMouseDown,
16046
+ brushRef,
16047
+ xAxisKey,
16048
+ seriesOrder,
16049
+ finalColors,
16050
+ brushHeight = 80,
16051
+ brushColor,
16052
+ miniChartOpacity = 0.3,
16053
+ margin = { left: 0, right: 0 }
16054
+ }) => {
16055
+ const dataLength = data.length;
16056
+ return /* @__PURE__ */ jsxs72("div", { className: "w-full px-8 pb-4", children: [
16057
+ /* @__PURE__ */ jsxs72(
16058
+ "div",
16059
+ {
16060
+ className: "relative rounded-md border bg-muted/5 shadow-inner",
16061
+ style: { height: brushHeight },
16062
+ children: [
16063
+ /* @__PURE__ */ jsx94(
16064
+ "div",
16065
+ {
16066
+ className: "absolute inset-0 pointer-events-none rounded-md",
16067
+ style: { opacity: miniChartOpacity },
16068
+ children: /* @__PURE__ */ jsx94(ResponsiveContainer, { width: "100%", height: brushHeight, children: /* @__PURE__ */ jsxs72(
16069
+ ComposedChart,
16070
+ {
16071
+ data: data.map((item) => ({
16072
+ ...item,
16073
+ name: String(item[xAxisKey] || "N/A")
16074
+ })),
16075
+ height: brushHeight,
16076
+ margin: {
16077
+ top: 5,
16078
+ right: margin.right ?? 30,
16079
+ left: margin.left ?? 0,
16080
+ bottom: 5
16081
+ },
16082
+ children: [
16083
+ /* @__PURE__ */ jsx94(XAxis, { dataKey: xAxisKey, hide: true }),
16084
+ /* @__PURE__ */ jsx94(YAxis, { yAxisId: "left", hide: true }),
16085
+ seriesOrder.map((s) => {
16086
+ const key = s.key;
16087
+ const color = finalColors[key];
16088
+ if (s.type === "bar") {
16089
+ return /* @__PURE__ */ jsx94(
16090
+ Bar,
16091
+ {
16092
+ dataKey: key,
16093
+ yAxisId: "left",
16094
+ fill: color,
16095
+ radius: [2, 2, 0, 0]
16096
+ },
16097
+ `brush-bar-${key}`
16098
+ );
16099
+ }
16100
+ if (s.type === "line") {
16101
+ return /* @__PURE__ */ jsx94(
16102
+ Line,
16103
+ {
16104
+ type: "monotone",
16105
+ dataKey: key,
16106
+ yAxisId: "left",
16107
+ stroke: color,
16108
+ strokeWidth: 1.5,
16109
+ dot: false
16110
+ },
16111
+ `brush-line-${key}`
16112
+ );
16113
+ }
16114
+ if (s.type === "area") {
16115
+ return /* @__PURE__ */ jsx94(
16116
+ Area,
16117
+ {
16118
+ type: "monotone",
16119
+ dataKey: key,
16120
+ yAxisId: "left",
16121
+ stroke: color,
16122
+ fill: `url(#gradient-${key})`,
16123
+ strokeWidth: 1.5
16124
+ },
16125
+ `brush-area-${key}`
16126
+ );
16127
+ }
16128
+ return null;
16129
+ })
16130
+ ]
16131
+ }
16132
+ ) })
16133
+ }
16134
+ ),
16135
+ /* @__PURE__ */ jsxs72(
16136
+ "div",
16137
+ {
16138
+ ref: brushRef,
16139
+ className: "absolute inset-0 cursor-move rounded-md",
16140
+ style: { userSelect: "none" },
16141
+ children: [
16142
+ /* @__PURE__ */ jsx94(
16143
+ "div",
16144
+ {
16145
+ className: "absolute top-0 bottom-0 left-0 bg-muted/60 pointer-events-none rounded-md",
16146
+ style: {
16147
+ width: `${startIndex / (dataLength - 1) * 100}%`
16148
+ }
16149
+ }
16150
+ ),
16151
+ /* @__PURE__ */ jsx94(
16152
+ "div",
16153
+ {
16154
+ className: "absolute top-0 bottom-0 right-0 bg-muted/60 pointer-events-none rounded-md",
16155
+ style: {
16156
+ width: `${(dataLength - 1 - endIndex) / (dataLength - 1) * 100}%`
16157
+ }
16158
+ }
16159
+ ),
16160
+ /* @__PURE__ */ jsxs72(
16161
+ "div",
16162
+ {
16163
+ className: "absolute top-0 bottom-0 border cursor-move group rounded-md border-primary/30",
16164
+ style: {
16165
+ left: `${startIndex / (dataLength - 1) * 100}%`,
16166
+ right: `${(dataLength - 1 - endIndex) / (dataLength - 1) * 100}%`,
16167
+ backgroundColor: "hsl(var(--primary) / 0.03)"
16168
+ },
16169
+ onMouseDown: (e) => onMouseDown(e, "middle"),
16170
+ children: [
16171
+ /* @__PURE__ */ jsx94(
16172
+ "div",
16173
+ {
16174
+ 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",
16175
+ onMouseDown: (e) => {
16176
+ e.stopPropagation();
16177
+ onMouseDown(e, "start");
16178
+ },
16179
+ children: /* @__PURE__ */ jsx94(
16180
+ "div",
16181
+ {
16182
+ className: "w-2 h-7 rounded-full shadow-md ring-2 ring-background flex flex-col items-center justify-center gap-0.5",
16183
+ style: {
16184
+ backgroundColor: brushColor ?? "hsl(var(--primary) / 0.7)"
16185
+ }
16186
+ }
16187
+ )
16188
+ }
16189
+ ),
16190
+ /* @__PURE__ */ jsx94(
16191
+ "div",
16192
+ {
16193
+ 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",
16194
+ onMouseDown: (e) => {
16195
+ e.stopPropagation();
16196
+ onMouseDown(e, "end");
16197
+ },
16198
+ children: /* @__PURE__ */ jsx94(
16199
+ "div",
16200
+ {
16201
+ className: "w-2 h-7 rounded-full shadow-md ring-2 ring-background flex flex-col items-center justify-center gap-0.5",
16202
+ style: {
16203
+ backgroundColor: brushColor ?? "hsl(var(--primary) / 0.7)"
16204
+ }
16205
+ }
16206
+ )
16207
+ }
16208
+ )
16209
+ ]
16210
+ }
16211
+ )
16212
+ ]
16213
+ }
16214
+ )
16215
+ ]
16216
+ }
16217
+ ),
16218
+ /* @__PURE__ */ jsxs72("div", { className: "flex justify-between items-center mt-2 text-xs text-muted-foreground", children: [
16219
+ /* @__PURE__ */ jsxs72("span", { children: [
16220
+ data[startIndex]?.[xAxisKey],
16221
+ " - ",
16222
+ data[endIndex]?.[xAxisKey]
16223
+ ] }),
16224
+ /* @__PURE__ */ jsxs72("span", { children: [
16225
+ endIndex - startIndex + 1,
16226
+ " de ",
16227
+ dataLength,
16228
+ " per\xEDodos"
16229
+ ] })
16230
+ ] })
16231
+ ] });
16232
+ };
16233
+ var Brush_default = Brush;
16234
+
16235
+ // src/components/ui/charts/utils/pillLabelRenderer.tsx
16236
+ import { jsx as jsx95, jsxs as jsxs73 } from "react/jsx-runtime";
16237
+ var formatCompactNumber = (value) => {
16238
+ const isNegative = value < 0;
16239
+ const absValue = Math.abs(value);
16240
+ let formatted;
16241
+ if (absValue >= 1e9) {
16242
+ formatted = (absValue / 1e9).toFixed(1).replace(/\.0$/, "") + "B";
16243
+ } else if (absValue >= 1e6) {
16244
+ formatted = (absValue / 1e6).toFixed(1).replace(/\.0$/, "") + "M";
16245
+ } else if (absValue >= 1e3) {
16246
+ formatted = (absValue / 1e3).toFixed(1).replace(/\.0$/, "") + " mil";
16247
+ } else {
16248
+ try {
16249
+ const nf = new Intl.NumberFormat("pt-BR", {
16250
+ minimumFractionDigits: 2,
16251
+ maximumFractionDigits: 2
16252
+ });
16253
+ formatted = nf.format(absValue);
16254
+ } catch {
16255
+ formatted = String(absValue).replace(".", ",");
16256
+ }
16257
+ }
16258
+ return isNegative ? `-${formatted}` : formatted;
16259
+ };
16260
+ var parseNumber = (v) => {
16261
+ if (typeof v === "number") return v;
16262
+ if (typeof v === "string" && v.trim() !== "" && !Number.isNaN(Number(v)))
16263
+ return Number(v);
16264
+ return void 0;
16265
+ };
16266
+ var renderPillLabel = (color, variant, valueFormatter2) => {
16267
+ return (props) => {
16268
+ const { x, y, value } = props;
16269
+ const defaultFormatted = typeof value === "number" ? formatCompactNumber(value) : String(value ?? "");
16270
+ const text = valueFormatter2 ? valueFormatter2({
16271
+ value,
16272
+ formattedValue: defaultFormatted,
16273
+ ...props
16274
+ }) : defaultFormatted;
16275
+ const paddingX = 8;
16276
+ const approxCharWidth = 7;
16277
+ const pillWidth = Math.max(
16278
+ 40,
16279
+ String(text).length * approxCharWidth + paddingX * 2
16280
+ );
16281
+ const pillHeight = 14;
16282
+ const xNum = parseNumber(x);
16283
+ const px = parseNumber(props.x);
16284
+ const pWidth = parseNumber(props.width);
16285
+ const vb = props.viewBox;
16286
+ const cxNum = parseNumber(props.cx);
16287
+ let centerX;
16288
+ let usedBarCenter = false;
16289
+ if (typeof px === "number" && typeof pWidth === "number") {
16290
+ centerX = px + pWidth / 2;
16291
+ usedBarCenter = true;
16292
+ } else if (typeof xNum === "number" && typeof pWidth === "number") {
16293
+ centerX = xNum + pWidth / 2;
16294
+ usedBarCenter = true;
16295
+ } else if (typeof cxNum === "number") {
16296
+ centerX = cxNum;
16297
+ } else if (vb && typeof vb.x === "number" && typeof vb.width === "number" && typeof props.index === "number") {
16298
+ const approxCols = Math.max(1, props.index + 1);
16299
+ const colWidth = vb.width / approxCols;
16300
+ centerX = vb.x + colWidth * (props.index + 0.5);
16301
+ } else if (vb && typeof vb.x === "number" && typeof vb.width === "number") {
16302
+ centerX = vb.x + vb.width / 2;
16303
+ } else {
16304
+ centerX = typeof props.index === "number" ? props.index * 40 + 24 : 0;
16305
+ }
16306
+ if (!usedBarCenter && vb && typeof vb.x === "number" && typeof vb.width === "number") {
16307
+ const minX = vb.x + pillWidth / 2;
16308
+ const maxX = vb.x + vb.width - pillWidth / 2;
16309
+ centerX = Math.max(minX, Math.min(maxX, centerX));
16310
+ }
16311
+ const yNum = parseNumber(y);
16312
+ const py = parseNumber(props.y);
16313
+ const cyNum = parseNumber(props.cy);
16314
+ const centerY = yNum ?? (typeof py === "number" ? py : vb && typeof vb.y === "number" && typeof vb.height === "number" ? vb.y + vb.height / 2 : typeof cyNum === "number" ? cyNum : 0);
16315
+ const rectX = centerX - pillWidth / 2;
16316
+ const rectY = centerY - pillHeight - 6;
16317
+ const textX = centerX;
16318
+ const textY = rectY + pillHeight / 2 + 3;
16319
+ const rectFill = variant === "filled" ? color : variant === "soft" ? `${color}20` : "#ffffff";
16320
+ const rectStroke = variant === "outline" ? `${color}CC` : void 0;
16321
+ let textColor;
16016
16322
  if (variant === "filled") {
16017
16323
  textColor = "#ffffff";
16018
16324
  } else {
16019
16325
  textColor = "#374151";
16020
16326
  }
16021
- return /* @__PURE__ */ jsxs72("g", { children: [
16022
- /* @__PURE__ */ jsx94(
16327
+ return /* @__PURE__ */ jsxs73("g", { children: [
16328
+ /* @__PURE__ */ jsx95(
16023
16329
  "rect",
16024
16330
  {
16025
16331
  x: rectX,
@@ -16032,7 +16338,7 @@ var renderPillLabel = (color, variant, valueFormatter2) => {
16032
16338
  strokeWidth: rectStroke ? 1 : 0
16033
16339
  }
16034
16340
  ),
16035
- /* @__PURE__ */ jsx94(
16341
+ /* @__PURE__ */ jsx95(
16036
16342
  "text",
16037
16343
  {
16038
16344
  x: textX,
@@ -16103,7 +16409,7 @@ var renderInsideBarLabel = (color, valueFormatter2) => {
16103
16409
  const heightFactor = Math.max(0.8, Math.min(1.6, pHeight / heightRef));
16104
16410
  fontSize = Math.min(18, Math.max(8, Math.round(fontSize * heightFactor)));
16105
16411
  }
16106
- return /* @__PURE__ */ jsx94(
16412
+ return /* @__PURE__ */ jsx95(
16107
16413
  "text",
16108
16414
  {
16109
16415
  x: centerX,
@@ -16122,7 +16428,7 @@ var renderInsideBarLabel = (color, valueFormatter2) => {
16122
16428
 
16123
16429
  // src/components/ui/charts/NoData.tsx
16124
16430
  import { motion as motion21 } from "framer-motion";
16125
- import { Fragment as Fragment17, jsx as jsx95, jsxs as jsxs73 } from "react/jsx-runtime";
16431
+ import { Fragment as Fragment17, jsx as jsx96, jsxs as jsxs74 } from "react/jsx-runtime";
16126
16432
  var ChartBar = ({ x, y, w, h, i, loading }) => {
16127
16433
  const baseY = y - h;
16128
16434
  const d = i * 0.08;
@@ -16133,8 +16439,8 @@ var ChartBar = ({ x, y, w, h, i, loading }) => {
16133
16439
  ease: "easeInOut",
16134
16440
  delay: d
16135
16441
  };
16136
- return /* @__PURE__ */ jsxs73("g", { children: [
16137
- /* @__PURE__ */ jsx95(
16442
+ return /* @__PURE__ */ jsxs74("g", { children: [
16443
+ /* @__PURE__ */ jsx96(
16138
16444
  motion21.rect,
16139
16445
  {
16140
16446
  x,
@@ -16149,7 +16455,7 @@ var ChartBar = ({ x, y, w, h, i, loading }) => {
16149
16455
  style: { transformBox: "fill-box", originY: 1 }
16150
16456
  }
16151
16457
  ),
16152
- /* @__PURE__ */ jsx95(
16458
+ /* @__PURE__ */ jsx96(
16153
16459
  motion21.rect,
16154
16460
  {
16155
16461
  x,
@@ -16165,7 +16471,7 @@ var ChartBar = ({ x, y, w, h, i, loading }) => {
16165
16471
  style: { transformBox: "fill-box", originY: 1 }
16166
16472
  }
16167
16473
  ),
16168
- /* @__PURE__ */ jsx95(
16474
+ /* @__PURE__ */ jsx96(
16169
16475
  motion21.line,
16170
16476
  {
16171
16477
  x1: x + w / 2,
@@ -16199,7 +16505,7 @@ var NoData = ({
16199
16505
  { x: 580, w: 100, h: h * 0.35 },
16200
16506
  { x: 700, w: 100, h: h * 0.3 }
16201
16507
  ];
16202
- return /* @__PURE__ */ jsx95(
16508
+ return /* @__PURE__ */ jsx96(
16203
16509
  "div",
16204
16510
  {
16205
16511
  className: cn(
@@ -16212,17 +16518,17 @@ var NoData = ({
16212
16518
  },
16213
16519
  role: "img",
16214
16520
  "aria-label": message,
16215
- children: /* @__PURE__ */ jsx95("div", { className: "w-full flex items-center justify-center pl-[var(--pl)] p-6 h-[var(--svg-h)]", children: /* @__PURE__ */ jsxs73("div", { className: "w-full max-w-[900px] relative", children: [
16216
- /* @__PURE__ */ jsxs73(
16521
+ children: /* @__PURE__ */ jsx96("div", { className: "w-full flex items-center justify-center pl-[var(--pl)] p-6 h-[var(--svg-h)]", children: /* @__PURE__ */ jsxs74("div", { className: "w-full max-w-[900px] relative", children: [
16522
+ /* @__PURE__ */ jsxs74(
16217
16523
  "svg",
16218
16524
  {
16219
16525
  className: "w-full h-[var(--svg-h)] opacity-40",
16220
16526
  viewBox: `0 0 900 ${h}`,
16221
16527
  preserveAspectRatio: "none",
16222
16528
  children: [
16223
- /* @__PURE__ */ jsxs73("defs", { children: [
16224
- /* @__PURE__ */ jsxs73("linearGradient", { id: "bg", x1: "0", x2: "0", y1: "0", y2: "1", children: [
16225
- /* @__PURE__ */ jsx95(
16529
+ /* @__PURE__ */ jsxs74("defs", { children: [
16530
+ /* @__PURE__ */ jsxs74("linearGradient", { id: "bg", x1: "0", x2: "0", y1: "0", y2: "1", children: [
16531
+ /* @__PURE__ */ jsx96(
16226
16532
  "stop",
16227
16533
  {
16228
16534
  offset: "0%",
@@ -16230,7 +16536,7 @@ var NoData = ({
16230
16536
  stopOpacity: "0.15"
16231
16537
  }
16232
16538
  ),
16233
- /* @__PURE__ */ jsx95(
16539
+ /* @__PURE__ */ jsx96(
16234
16540
  "stop",
16235
16541
  {
16236
16542
  offset: "100%",
@@ -16239,8 +16545,8 @@ var NoData = ({
16239
16545
  }
16240
16546
  )
16241
16547
  ] }),
16242
- /* @__PURE__ */ jsxs73("linearGradient", { id: "gg", x1: "0", x2: "0", y1: "0", y2: "1", children: [
16243
- /* @__PURE__ */ jsx95(
16548
+ /* @__PURE__ */ jsxs74("linearGradient", { id: "gg", x1: "0", x2: "0", y1: "0", y2: "1", children: [
16549
+ /* @__PURE__ */ jsx96(
16244
16550
  "stop",
16245
16551
  {
16246
16552
  offset: "0%",
@@ -16248,7 +16554,7 @@ var NoData = ({
16248
16554
  stopOpacity: "0.4"
16249
16555
  }
16250
16556
  ),
16251
- /* @__PURE__ */ jsx95(
16557
+ /* @__PURE__ */ jsx96(
16252
16558
  "stop",
16253
16559
  {
16254
16560
  offset: "100%",
@@ -16257,17 +16563,17 @@ var NoData = ({
16257
16563
  }
16258
16564
  )
16259
16565
  ] }),
16260
- /* @__PURE__ */ jsxs73("filter", { id: "s", x: "-20%", y: "-20%", width: "140%", height: "140%", children: [
16261
- /* @__PURE__ */ jsx95("feGaussianBlur", { in: "SourceAlpha", stdDeviation: "3" }),
16262
- /* @__PURE__ */ jsx95("feOffset", { dx: "0", dy: "2" }),
16263
- /* @__PURE__ */ jsx95("feComponentTransfer", { children: /* @__PURE__ */ jsx95("feFuncA", { type: "linear", slope: "0.2" }) }),
16264
- /* @__PURE__ */ jsxs73("feMerge", { children: [
16265
- /* @__PURE__ */ jsx95("feMergeNode", {}),
16266
- /* @__PURE__ */ jsx95("feMergeNode", { in: "SourceGraphic" })
16566
+ /* @__PURE__ */ jsxs74("filter", { id: "s", x: "-20%", y: "-20%", width: "140%", height: "140%", children: [
16567
+ /* @__PURE__ */ jsx96("feGaussianBlur", { in: "SourceAlpha", stdDeviation: "3" }),
16568
+ /* @__PURE__ */ jsx96("feOffset", { dx: "0", dy: "2" }),
16569
+ /* @__PURE__ */ jsx96("feComponentTransfer", { children: /* @__PURE__ */ jsx96("feFuncA", { type: "linear", slope: "0.2" }) }),
16570
+ /* @__PURE__ */ jsxs74("feMerge", { children: [
16571
+ /* @__PURE__ */ jsx96("feMergeNode", {}),
16572
+ /* @__PURE__ */ jsx96("feMergeNode", { in: "SourceGraphic" })
16267
16573
  ] })
16268
16574
  ] })
16269
16575
  ] }),
16270
- /* @__PURE__ */ jsx95(
16576
+ /* @__PURE__ */ jsx96(
16271
16577
  "rect",
16272
16578
  {
16273
16579
  x: 0,
@@ -16278,7 +16584,7 @@ var NoData = ({
16278
16584
  rx: 8
16279
16585
  }
16280
16586
  ),
16281
- [...Array(6)].map((_, i) => /* @__PURE__ */ jsx95(
16587
+ [...Array(6)].map((_, i) => /* @__PURE__ */ jsx96(
16282
16588
  "line",
16283
16589
  {
16284
16590
  x1: 50,
@@ -16291,7 +16597,7 @@ var NoData = ({
16291
16597
  },
16292
16598
  i
16293
16599
  )),
16294
- /* @__PURE__ */ jsx95(
16600
+ /* @__PURE__ */ jsx96(
16295
16601
  "line",
16296
16602
  {
16297
16603
  x1: 50,
@@ -16303,7 +16609,7 @@ var NoData = ({
16303
16609
  opacity: 0.5
16304
16610
  }
16305
16611
  ),
16306
- /* @__PURE__ */ jsx95(
16612
+ /* @__PURE__ */ jsx96(
16307
16613
  "line",
16308
16614
  {
16309
16615
  x1: 50,
@@ -16315,7 +16621,7 @@ var NoData = ({
16315
16621
  opacity: 0.5
16316
16622
  }
16317
16623
  ),
16318
- bars.map((b, i) => /* @__PURE__ */ jsx95(
16624
+ bars.map((b, i) => /* @__PURE__ */ jsx96(
16319
16625
  ChartBar,
16320
16626
  {
16321
16627
  x: b.x,
@@ -16330,15 +16636,15 @@ var NoData = ({
16330
16636
  ]
16331
16637
  }
16332
16638
  ),
16333
- /* @__PURE__ */ jsx95("div", { className: "absolute inset-0 flex items-center justify-center pointer-events-none h-[var(--svg-h)]", children: /* @__PURE__ */ jsx95("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__ */ jsx95("div", { className: "flex flex-col items-center gap-4", children: /* @__PURE__ */ jsx95(
16639
+ /* @__PURE__ */ jsx96("div", { className: "absolute inset-0 flex items-center justify-center pointer-events-none h-[var(--svg-h)]", children: /* @__PURE__ */ jsx96("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__ */ jsx96("div", { className: "flex flex-col items-center gap-4", children: /* @__PURE__ */ jsx96(
16334
16640
  LoadingBase,
16335
16641
  {
16336
16642
  size: "xl",
16337
16643
  message: loadingMessage ?? "Carregando"
16338
16644
  }
16339
- ) }) : /* @__PURE__ */ jsxs73(Fragment17, { children: [
16340
- title && /* @__PURE__ */ jsx95("h3", { className: "text-xl font-semibold text-foreground mb-2", children: title }),
16341
- /* @__PURE__ */ jsx95("p", { className: "text-lg font-medium text-foreground/90 mb-2", children: message })
16645
+ ) }) : /* @__PURE__ */ jsxs74(Fragment17, { children: [
16646
+ title && /* @__PURE__ */ jsx96("h3", { className: "text-xl font-semibold text-foreground mb-2", children: title }),
16647
+ /* @__PURE__ */ jsx96("p", { className: "text-lg font-medium text-foreground/90 mb-2", children: message })
16342
16648
  ] }) }) })
16343
16649
  ] }) })
16344
16650
  }
@@ -16559,8 +16865,126 @@ var useChartClick = ({
16559
16865
  };
16560
16866
  };
16561
16867
 
16868
+ // src/components/ui/charts/hooks/useTimeSeriesRange.ts
16869
+ import { useState as useState43, useCallback as useCallback17, useEffect as useEffect33, useRef as useRef23 } from "react";
16870
+ function useTimeSeriesRange({
16871
+ dataLength,
16872
+ defaultStartIndex = 0,
16873
+ defaultEndIndex,
16874
+ onRangeChange
16875
+ }) {
16876
+ const [startIndex, setStartIndex] = useState43(defaultStartIndex);
16877
+ const [endIndex, setEndIndex] = useState43(
16878
+ defaultEndIndex ?? Math.max(0, dataLength - 1)
16879
+ );
16880
+ const [isDragging, setIsDragging] = useState43(null);
16881
+ const [dragStartX, setDragStartX] = useState43(0);
16882
+ const [initialStartIndex, setInitialStartIndex] = useState43(0);
16883
+ const [initialEndIndex, setInitialEndIndex] = useState43(0);
16884
+ const brushRef = useRef23(null);
16885
+ useEffect33(() => {
16886
+ if (dataLength > 0) {
16887
+ setStartIndex((prev) => Math.min(prev, dataLength - 1));
16888
+ setEndIndex((prev) => {
16889
+ if (prev >= dataLength - 2 || defaultEndIndex === void 0) {
16890
+ return dataLength - 1;
16891
+ }
16892
+ return Math.min(prev, dataLength - 1);
16893
+ });
16894
+ }
16895
+ }, [dataLength, defaultEndIndex]);
16896
+ const handleRangeChange = useCallback17(
16897
+ (newStart, newEnd) => {
16898
+ const clampedStart = Math.max(0, Math.min(newStart, dataLength - 1));
16899
+ const clampedEnd = Math.max(
16900
+ clampedStart,
16901
+ Math.min(newEnd, dataLength - 1)
16902
+ );
16903
+ setStartIndex(clampedStart);
16904
+ setEndIndex(clampedEnd);
16905
+ if (onRangeChange) {
16906
+ onRangeChange(clampedStart, clampedEnd);
16907
+ }
16908
+ },
16909
+ [dataLength, onRangeChange]
16910
+ );
16911
+ const handleMouseDown = useCallback17(
16912
+ (e, type) => {
16913
+ e.preventDefault();
16914
+ setIsDragging(type);
16915
+ setDragStartX(e.clientX);
16916
+ setInitialStartIndex(startIndex);
16917
+ setInitialEndIndex(endIndex);
16918
+ },
16919
+ [startIndex, endIndex]
16920
+ );
16921
+ const handleMouseMove = useCallback17(
16922
+ (e) => {
16923
+ if (!isDragging || !brushRef.current) return;
16924
+ const brushWidth = brushRef.current.offsetWidth;
16925
+ const deltaX = e.clientX - dragStartX;
16926
+ const indexDelta = Math.round(deltaX / brushWidth * dataLength);
16927
+ if (isDragging === "start") {
16928
+ const newStart = Math.max(
16929
+ 0,
16930
+ Math.min(initialStartIndex + indexDelta, endIndex - 1)
16931
+ );
16932
+ handleRangeChange(newStart, endIndex);
16933
+ } else if (isDragging === "end") {
16934
+ const newEnd = Math.max(
16935
+ startIndex + 1,
16936
+ Math.min(initialEndIndex + indexDelta, dataLength - 1)
16937
+ );
16938
+ handleRangeChange(startIndex, newEnd);
16939
+ } else if (isDragging === "middle") {
16940
+ const rangeSize = initialEndIndex - initialStartIndex;
16941
+ let newStart = initialStartIndex + indexDelta;
16942
+ let newEnd = initialEndIndex + indexDelta;
16943
+ if (newStart < 0) {
16944
+ newStart = 0;
16945
+ newEnd = rangeSize;
16946
+ } else if (newEnd >= dataLength) {
16947
+ newEnd = dataLength - 1;
16948
+ newStart = newEnd - rangeSize;
16949
+ }
16950
+ handleRangeChange(newStart, newEnd);
16951
+ }
16952
+ },
16953
+ [
16954
+ isDragging,
16955
+ dragStartX,
16956
+ dataLength,
16957
+ startIndex,
16958
+ endIndex,
16959
+ initialStartIndex,
16960
+ initialEndIndex,
16961
+ handleRangeChange
16962
+ ]
16963
+ );
16964
+ const handleMouseUp = useCallback17(() => {
16965
+ setIsDragging(null);
16966
+ }, []);
16967
+ useEffect33(() => {
16968
+ if (isDragging) {
16969
+ document.addEventListener("mousemove", handleMouseMove);
16970
+ document.addEventListener("mouseup", handleMouseUp);
16971
+ return () => {
16972
+ document.removeEventListener("mousemove", handleMouseMove);
16973
+ document.removeEventListener("mouseup", handleMouseUp);
16974
+ };
16975
+ }
16976
+ }, [isDragging, handleMouseMove, handleMouseUp]);
16977
+ return {
16978
+ startIndex,
16979
+ endIndex,
16980
+ isDragging,
16981
+ brushRef,
16982
+ handleMouseDown
16983
+ };
16984
+ }
16985
+
16562
16986
  // src/components/ui/charts/Chart.tsx
16563
- import { jsx as jsx96, jsxs as jsxs74 } from "react/jsx-runtime";
16987
+ import { jsx as jsx97, jsxs as jsxs75 } from "react/jsx-runtime";
16564
16988
  var DEFAULT_COLORS2 = ["#55af7d", "#8e68ff", "#2273e1"];
16565
16989
  var Chart = ({
16566
16990
  data,
@@ -16593,7 +17017,8 @@ var Chart = ({
16593
17017
  formatBR = false,
16594
17018
  legendUppercase = false,
16595
17019
  chartMargin,
16596
- isLoading = false
17020
+ isLoading = false,
17021
+ timeSeries
16597
17022
  }) => {
16598
17023
  const smartConfig = useMemo26(() => {
16599
17024
  const resolvedXAxisKey = typeof xAxis === "string" ? xAxis : xAxis && xAxis.dataKey || detectXAxis(data);
@@ -16633,15 +17058,38 @@ var Chart = ({
16633
17058
  onTooltipPositionChange,
16634
17059
  setActiveTooltips
16635
17060
  } = useChartTooltips(maxTooltips);
16636
- useEffect33(() => {
17061
+ useEffect34(() => {
16637
17062
  if (highlightedSeries.size === 0 && showOnlyHighlighted) {
16638
17063
  setShowOnlyHighlighted(false);
16639
17064
  }
16640
17065
  }, [highlightedSeries, showOnlyHighlighted, setShowOnlyHighlighted]);
16641
- const processedData = data.map((item) => ({
16642
- ...item,
16643
- name: String(item[xAxisConfig.dataKey] || "N/A")
16644
- }));
17066
+ const timeSeriesConfig = useMemo26(() => {
17067
+ if (typeof timeSeries === "boolean") {
17068
+ return timeSeries ? {} : void 0;
17069
+ }
17070
+ return timeSeries;
17071
+ }, [timeSeries]);
17072
+ const {
17073
+ startIndex,
17074
+ endIndex,
17075
+ brushRef,
17076
+ handleMouseDown
17077
+ } = useTimeSeriesRange({
17078
+ dataLength: data.length,
17079
+ defaultStartIndex: timeSeriesConfig?.start,
17080
+ defaultEndIndex: timeSeriesConfig?.end,
17081
+ onRangeChange: timeSeriesConfig?.onRangeChange
17082
+ });
17083
+ const processedData = useMemo26(() => {
17084
+ const mapped = data.map((item) => ({
17085
+ ...item,
17086
+ name: String(item[xAxisConfig.dataKey] || "N/A")
17087
+ }));
17088
+ if (timeSeriesConfig) {
17089
+ return mapped.slice(startIndex, endIndex + 1);
17090
+ }
17091
+ return mapped;
17092
+ }, [data, xAxisConfig.dataKey, timeSeriesConfig, startIndex, endIndex]);
16645
17093
  const seriesOrder = [];
16646
17094
  if (series) {
16647
17095
  if (series.bar)
@@ -16730,9 +17178,11 @@ var Chart = ({
16730
17178
  setActiveTooltips
16731
17179
  }
16732
17180
  );
16733
- const titleClassName = useMemo26(
16734
- () => "text-[1.4rem] font-semibold text-foreground mb-3",
16735
- []
17181
+ const getSeriesOpacity = useCallback18(
17182
+ (key) => {
17183
+ return highlightedSeries.size > 0 ? highlightedSeries.has(key) ? 1 : 0.25 : 1;
17184
+ },
17185
+ [highlightedSeries]
16736
17186
  );
16737
17187
  const finalValueFormatter = useMemo26(
16738
17188
  () => createValueFormatter(valueFormatter2, formatBR),
@@ -16742,20 +17192,15 @@ var Chart = ({
16742
17192
  () => createYTickFormatter(finalValueFormatter),
16743
17193
  [finalValueFormatter]
16744
17194
  );
16745
- const finalEnableHighlights = enableHighlights;
16746
- const finalEnableShowOnly = enableShowOnly;
16747
- const finalEnablePeriodsDropdown = enablePeriodsDropdown && enableDraggableTooltips;
16748
- const defaultChartRightMargin = 30;
16749
- const defaultChartLeftMargin = 0;
16750
- const axisLabelMargin = 56;
16751
- const containerPaddingLeft = -6;
16752
- const finalChartRightMargin = chartMargin?.right ?? (rightKeys.length > 0 ? axisLabelMargin : defaultChartRightMargin);
16753
- const finalChartLeftMargin = chartMargin?.left ?? (yAxisLabel ? axisLabelMargin : defaultChartLeftMargin);
17195
+ const AXIS_LABEL_MARGIN = 56;
17196
+ const CONTAINER_PADDING_LEFT = -6;
17197
+ const finalChartRightMargin = chartMargin?.right ?? (rightKeys.length > 0 ? AXIS_LABEL_MARGIN : 30);
17198
+ const finalChartLeftMargin = chartMargin?.left ?? (yAxisLabel ? AXIS_LABEL_MARGIN : 0);
16754
17199
  const yAxisTickWidth = useMemo26(
16755
17200
  () => computeYAxisTickWidth(
16756
17201
  chartMargin?.left,
16757
17202
  yAxisLabel,
16758
- axisLabelMargin,
17203
+ AXIS_LABEL_MARGIN,
16759
17204
  yTickFormatter,
16760
17205
  minLeftDataValue,
16761
17206
  niceMaxLeft
@@ -16768,19 +17213,13 @@ var Chart = ({
16768
17213
  niceMaxLeft
16769
17214
  ]
16770
17215
  );
16771
- const composedChartLeftMargin = chartMargin?.left ?? defaultChartLeftMargin;
16772
- const composedChartRightMargin = chartMargin?.right ?? defaultChartRightMargin;
16773
17216
  const finalChartTopMargin = chartMargin?.top ?? (showLabels ? 48 : 20);
16774
- const baseBottom = chartMargin?.bottom ?? 5;
16775
- const extraForXAxisLabel = xAxisLabel ? 22 : 0;
16776
- const extraForLegend = showLegend ? 36 : 0;
16777
- const finalChartBottomMargin = baseBottom + extraForXAxisLabel + extraForLegend;
16778
- const measuredInner = measuredWidth ? Math.max(0, measuredWidth - 32) : void 0;
16779
- const effectiveChartWidth = typeof width === "number" ? width : measuredInner ?? computedWidth;
16780
- const chartInnerWidth = effectiveChartWidth - composedChartLeftMargin - composedChartRightMargin;
17217
+ const finalChartBottomMargin = (chartMargin?.bottom ?? 5) + (xAxisLabel ? 22 : 0) + (showLegend ? 36 : 0);
17218
+ const effectiveChartWidth = typeof width === "number" ? width : measuredWidth ? Math.max(0, measuredWidth - 32) : computedWidth;
17219
+ const chartInnerWidth = effectiveChartWidth - finalChartLeftMargin - finalChartRightMargin;
16781
17220
  const leftYAxisLabelDx = -Math.max(12, Math.round(yAxisTickWidth / 2));
16782
17221
  const rightYAxisLabelDx = Math.max(12, Math.round(finalChartRightMargin / 2));
16783
- const openTooltipForPeriod = useCallback17(
17222
+ const openTooltipForPeriod = useCallback18(
16784
17223
  (periodName) => {
16785
17224
  if (!enableDraggableTooltips) return;
16786
17225
  const row = processedData.find((r) => String(r.name) === periodName);
@@ -16797,7 +17236,7 @@ var Chart = ({
16797
17236
  );
16798
17237
  }
16799
17238
  const offsetIndex = activeTooltips.length;
16800
- const availableWidth = typeof width === "number" ? width : measuredInner ?? computedWidth;
17239
+ const availableWidth = effectiveChartWidth;
16801
17240
  const gap = 28;
16802
17241
  const leftGap = 28;
16803
17242
  const newTooltip = {
@@ -16817,535 +17256,510 @@ var Chart = ({
16817
17256
  enableDraggableTooltips,
16818
17257
  processedData,
16819
17258
  activeTooltips,
16820
- width,
16821
- measuredInner,
16822
- computedWidth,
17259
+ effectiveChartWidth,
16823
17260
  maxTooltips,
16824
17261
  setActiveTooltips
16825
17262
  ]
16826
17263
  );
16827
17264
  if (!data && !isLoading) return null;
16828
17265
  if (isLoading) {
16829
- return /* @__PURE__ */ jsx96(
17266
+ return /* @__PURE__ */ jsx97(
16830
17267
  NoData_default,
16831
17268
  {
16832
17269
  title,
16833
17270
  isLoading: true,
16834
17271
  loadingMessage: typeof title === "string" ? `${title} \u2014 Carregando` : "Carregando",
16835
- paddingLeft: containerPaddingLeft + finalChartLeftMargin,
17272
+ paddingLeft: CONTAINER_PADDING_LEFT + finalChartLeftMargin,
16836
17273
  height
16837
17274
  }
16838
17275
  );
16839
17276
  }
16840
17277
  if (Array.isArray(data) && data.length === 0) {
16841
- return /* @__PURE__ */ jsx96(
17278
+ return /* @__PURE__ */ jsx97(
16842
17279
  NoData_default,
16843
17280
  {
16844
17281
  title,
16845
- paddingLeft: containerPaddingLeft + finalChartLeftMargin,
17282
+ paddingLeft: CONTAINER_PADDING_LEFT + finalChartLeftMargin,
16846
17283
  height
16847
17284
  }
16848
17285
  );
16849
17286
  }
16850
- return /* @__PURE__ */ jsx96(
17287
+ return /* @__PURE__ */ jsx97("div", { ref: wrapperRef, className: "w-full overflow-hidden min-w-0", children: /* @__PURE__ */ jsxs75(
16851
17288
  "div",
16852
17289
  {
16853
- ref: wrapperRef,
16854
- style: {
16855
- width: "100%",
16856
- overflowX: "hidden",
16857
- overflowY: "hidden",
16858
- minWidth: 0
16859
- },
16860
- children: /* @__PURE__ */ jsxs74(
16861
- "div",
16862
- {
16863
- className: cn("rounded-lg bg-card relative", className),
16864
- style: { width: "100%", maxWidth: "100%", minWidth: 0 },
16865
- children: [
16866
- title && /* @__PURE__ */ jsx96(
16867
- "div",
16868
- {
16869
- style: {
16870
- paddingLeft: `${containerPaddingLeft + finalChartLeftMargin}px`,
16871
- width: "100%",
16872
- display: "flex",
16873
- justifyContent: titlePosition === "center" ? "center" : titlePosition === "right" ? "flex-end" : "flex-start",
16874
- alignItems: "center",
16875
- marginTop: "19px"
16876
- },
16877
- children: /* @__PURE__ */ jsx96("div", { className: titleClassName, children: title })
16878
- }
17290
+ className: cn(
17291
+ "rounded-lg bg-card relative w-full max-w-full min-w-0",
17292
+ className
17293
+ ),
17294
+ children: [
17295
+ title && /* @__PURE__ */ jsx97(
17296
+ "div",
17297
+ {
17298
+ className: cn(
17299
+ "w-full flex items-center mt-[19px] ml-[90px]",
17300
+ titlePosition === "center" && "justify-center",
17301
+ titlePosition === "right" && "justify-end",
17302
+ titlePosition === "left" && "justify-start"
16879
17303
  ),
16880
- allKeys.length > 0 && (finalEnableHighlights || finalEnableShowOnly) && /* @__PURE__ */ jsxs74(
16881
- "div",
17304
+ children: /* @__PURE__ */ jsx97("div", { className: "text-[1.4rem] font-semibold text-foreground mb-3", children: title })
17305
+ }
17306
+ ),
17307
+ allKeys.length > 0 && (enableHighlights || enableShowOnly) && /* @__PURE__ */ jsxs75("div", { className: "flex items-center w-[98%] ml-[90px] gap-2", children: [
17308
+ enableHighlights && /* @__PURE__ */ jsx97(
17309
+ Highlights_default,
17310
+ {
17311
+ allKeys,
17312
+ mapperConfig,
17313
+ finalColors,
17314
+ highlightedSeries,
17315
+ toggleHighlight,
17316
+ containerWidth: chartInnerWidth
17317
+ }
17318
+ ),
17319
+ enableShowOnly && /* @__PURE__ */ jsx97(
17320
+ ShowOnly_default,
17321
+ {
17322
+ showOnlyHighlighted,
17323
+ setShowOnlyHighlighted,
17324
+ highlightedSeriesSize: highlightedSeries.size,
17325
+ clearHighlights
17326
+ }
17327
+ ),
17328
+ enablePeriodsDropdown && enableDraggableTooltips && /* @__PURE__ */ jsx97("div", { className: "ml-auto flex items-center", children: /* @__PURE__ */ jsx97(
17329
+ PeriodsDropdown_default,
17330
+ {
17331
+ processedData,
17332
+ onOpenPeriod: openTooltipForPeriod,
17333
+ rightOffset: finalChartRightMargin,
17334
+ activePeriods
17335
+ }
17336
+ ) })
17337
+ ] }),
17338
+ !(allKeys.length > 0 && (enableHighlights || enableShowOnly)) && enablePeriodsDropdown && enableDraggableTooltips && /* @__PURE__ */ jsx97(
17339
+ "div",
17340
+ {
17341
+ className: "w-full flex justify-end",
17342
+ style: {
17343
+ paddingLeft: `${CONTAINER_PADDING_LEFT + finalChartLeftMargin}px`,
17344
+ paddingRight: `${finalChartRightMargin}px`,
17345
+ maxWidth: `${chartInnerWidth}px`
17346
+ },
17347
+ children: /* @__PURE__ */ jsx97(
17348
+ PeriodsDropdown_default,
16882
17349
  {
16883
- className: "flex items-center w-full",
16884
- style: {
16885
- paddingLeft: `${containerPaddingLeft + finalChartLeftMargin}px`,
16886
- width: "98%",
16887
- display: "flex",
16888
- alignItems: "center",
16889
- gap: "0.5rem"
16890
- },
16891
- children: [
16892
- finalEnableHighlights && /* @__PURE__ */ jsx96(
16893
- Highlights_default,
16894
- {
16895
- allKeys,
16896
- mapperConfig,
16897
- finalColors,
16898
- highlightedSeries,
16899
- toggleHighlight,
16900
- containerWidth: chartInnerWidth
16901
- }
16902
- ),
16903
- finalEnableShowOnly && /* @__PURE__ */ jsx96(
16904
- ShowOnly_default,
16905
- {
16906
- showOnlyHighlighted,
16907
- setShowOnlyHighlighted,
16908
- highlightedSeriesSize: highlightedSeries.size,
16909
- clearHighlights
16910
- }
16911
- ),
16912
- finalEnablePeriodsDropdown && /* @__PURE__ */ jsx96(
16913
- "div",
16914
- {
16915
- style: {
16916
- marginLeft: "auto",
16917
- display: "flex",
16918
- alignItems: "center"
16919
- },
16920
- children: /* @__PURE__ */ jsx96(
16921
- PeriodsDropdown_default,
16922
- {
16923
- processedData,
16924
- onOpenPeriod: openTooltipForPeriod,
16925
- rightOffset: finalChartRightMargin,
16926
- activePeriods
16927
- }
16928
- )
16929
- }
16930
- )
16931
- ]
17350
+ processedData,
17351
+ onOpenPeriod: openTooltipForPeriod,
17352
+ rightOffset: finalChartRightMargin
16932
17353
  }
16933
- ),
16934
- !(allKeys.length > 0 && (finalEnableHighlights || finalEnableShowOnly)) && finalEnablePeriodsDropdown && /* @__PURE__ */ jsx96(
16935
- "div",
16936
- {
16937
- style: {
16938
- paddingLeft: `${containerPaddingLeft + finalChartLeftMargin}px`,
16939
- paddingRight: `${finalChartRightMargin}px`,
16940
- width: "100%",
16941
- maxWidth: `${chartInnerWidth}px`,
16942
- display: "flex",
16943
- justifyContent: "flex-end"
16944
- },
16945
- children: /* @__PURE__ */ jsx96(
16946
- PeriodsDropdown_default,
17354
+ )
17355
+ }
17356
+ ),
17357
+ /* @__PURE__ */ jsx97(ResponsiveContainer2, { width: "100%", height, children: /* @__PURE__ */ jsxs75(
17358
+ ComposedChart2,
17359
+ {
17360
+ data: processedData,
17361
+ height,
17362
+ margin: {
17363
+ top: finalChartTopMargin,
17364
+ right: finalChartRightMargin,
17365
+ left: finalChartLeftMargin,
17366
+ bottom: finalChartBottomMargin
17367
+ },
17368
+ onClick: handleChartClick,
17369
+ children: [
17370
+ /* @__PURE__ */ jsx97("defs", { children: seriesOrder.filter((s) => s.type === "area").map((s) => {
17371
+ const key = s.key;
17372
+ const color = finalColors[key];
17373
+ return /* @__PURE__ */ jsxs75(
17374
+ "linearGradient",
16947
17375
  {
16948
- processedData,
16949
- onOpenPeriod: openTooltipForPeriod,
16950
- rightOffset: finalChartRightMargin
16951
- }
16952
- )
16953
- }
16954
- ),
16955
- /* @__PURE__ */ jsx96(ResponsiveContainer, { width: "100%", height, children: /* @__PURE__ */ jsxs74(
16956
- ComposedChart,
16957
- {
16958
- data: processedData,
16959
- height,
16960
- margin: {
16961
- top: finalChartTopMargin,
16962
- right: finalChartRightMargin,
16963
- left: finalChartLeftMargin,
16964
- bottom: finalChartBottomMargin
16965
- },
16966
- onClick: handleChartClick,
16967
- children: [
16968
- /* @__PURE__ */ jsx96("defs", { children: seriesOrder.filter((s) => s.type === "area").map((s) => {
16969
- const key = s.key;
16970
- const color = finalColors[key];
16971
- return /* @__PURE__ */ jsxs74(
16972
- "linearGradient",
16973
- {
16974
- id: `gradient-${key}`,
16975
- x1: "0",
16976
- y1: "0",
16977
- x2: "0",
16978
- y2: "0.8",
16979
- children: [
16980
- /* @__PURE__ */ jsx96("stop", { offset: "0%", stopColor: color, stopOpacity: 0.8 }),
16981
- /* @__PURE__ */ jsx96("stop", { offset: "90%", stopColor: color, stopOpacity: 0.1 })
16982
- ]
16983
- },
16984
- `gradient-${key}`
16985
- );
16986
- }) }),
16987
- showGrid && /* @__PURE__ */ jsx96(
16988
- CartesianGrid,
16989
- {
16990
- strokeDasharray: "3 3",
16991
- stroke: gridColor || "hsl(var(--muted-foreground))",
16992
- opacity: 0.5
17376
+ id: `gradient-${key}`,
17377
+ x1: "0",
17378
+ y1: "0",
17379
+ x2: "0",
17380
+ y2: "0.8",
17381
+ children: [
17382
+ /* @__PURE__ */ jsx97("stop", { offset: "0%", stopColor: color, stopOpacity: 0.8 }),
17383
+ /* @__PURE__ */ jsx97("stop", { offset: "90%", stopColor: color, stopOpacity: 0.1 })
17384
+ ]
17385
+ },
17386
+ `gradient-${key}`
17387
+ );
17388
+ }) }),
17389
+ showGrid && /* @__PURE__ */ jsx97(
17390
+ CartesianGrid,
17391
+ {
17392
+ strokeDasharray: "3 3",
17393
+ stroke: gridColor || "hsl(var(--muted-foreground))",
17394
+ opacity: 0.5
17395
+ }
17396
+ ),
17397
+ /* @__PURE__ */ jsx97(
17398
+ XAxis2,
17399
+ {
17400
+ dataKey: xAxisConfig.dataKey,
17401
+ stroke: "hsl(var(--muted-foreground))",
17402
+ fontSize: 12,
17403
+ tickLine: false,
17404
+ axisLine: false,
17405
+ tickFormatter: (value) => {
17406
+ if (categoryFormatter)
17407
+ return categoryFormatter(value);
17408
+ if (xAxisConfig.valueFormatter)
17409
+ return xAxisConfig.valueFormatter(value);
17410
+ return String(value ?? "");
17411
+ },
17412
+ label: xAxisLabel ? {
17413
+ value: xAxisLabel,
17414
+ position: "insideBottomRight",
17415
+ offset: -5,
17416
+ style: {
17417
+ fontSize: 12,
17418
+ fill: "hsl(var(--muted-foreground))",
17419
+ fontWeight: 500
16993
17420
  }
16994
- ),
16995
- /* @__PURE__ */ jsx96(
16996
- XAxis,
16997
- {
16998
- dataKey: xAxisConfig.dataKey,
16999
- stroke: "hsl(var(--muted-foreground))",
17421
+ } : void 0
17422
+ }
17423
+ ),
17424
+ /* @__PURE__ */ jsx97(
17425
+ YAxis2,
17426
+ {
17427
+ yAxisId: "left",
17428
+ width: yAxisTickWidth,
17429
+ stroke: "hsl(var(--muted-foreground))",
17430
+ fontSize: 12,
17431
+ tickLine: false,
17432
+ axisLine: false,
17433
+ tickFormatter: yTickFormatter,
17434
+ domain: [Math.min(minLeftDataValue, 0), niceMaxLeft],
17435
+ tickCount: 6,
17436
+ label: yAxisLabel ? {
17437
+ value: yAxisLabel,
17438
+ angle: -90,
17439
+ position: "left",
17440
+ dx: leftYAxisLabelDx,
17441
+ style: {
17000
17442
  fontSize: 12,
17001
- tickLine: false,
17002
- axisLine: false,
17003
- tickFormatter: (value) => {
17004
- if (categoryFormatter)
17005
- return categoryFormatter(value);
17006
- if (xAxisConfig.valueFormatter)
17007
- return xAxisConfig.valueFormatter(value);
17008
- return String(value ?? "");
17009
- },
17010
- label: xAxisLabel ? {
17011
- value: xAxisLabel,
17012
- position: "insideBottomRight",
17013
- offset: -5,
17014
- style: {
17015
- fontSize: 12,
17016
- fill: "hsl(var(--muted-foreground))",
17017
- fontWeight: 500
17018
- }
17019
- } : void 0
17443
+ fill: "hsl(var(--muted-foreground))",
17444
+ fontWeight: 500,
17445
+ textAnchor: "middle"
17020
17446
  }
17021
- ),
17022
- /* @__PURE__ */ jsx96(
17023
- YAxis,
17447
+ } : void 0
17448
+ }
17449
+ ),
17450
+ minLeftDataValue < 0 && /* @__PURE__ */ jsx97(
17451
+ ReferenceLine,
17452
+ {
17453
+ y: 0,
17454
+ yAxisId: "left",
17455
+ stroke: "hsl(var(--muted-foreground))",
17456
+ strokeWidth: 1,
17457
+ strokeDasharray: "4 4"
17458
+ }
17459
+ ),
17460
+ rightKeys.length > 0 && (() => {
17461
+ const decimals = typeof biaxialConfigNormalized?.decimals === "number" ? Math.max(0, Math.floor(biaxialConfigNormalized.decimals)) : 2;
17462
+ const rightTickFormatter = (v) => {
17463
+ if (biaxialConfigNormalized?.percentage) {
17464
+ const num = Number(String(v));
17465
+ const nf = new Intl.NumberFormat("pt-BR", {
17466
+ minimumFractionDigits: decimals,
17467
+ maximumFractionDigits: decimals
17468
+ });
17469
+ const out = Number.isNaN(num) ? String(v ?? "") : nf.format(num);
17470
+ return `${out}%`;
17471
+ }
17472
+ return yTickFormatter(v);
17473
+ };
17474
+ const firstRightKey = biaxialConfigNormalized?.key && biaxialConfigNormalized.key[0];
17475
+ const defaultRightColor = firstRightKey && finalColors[firstRightKey] || "hsl(var(--muted-foreground))";
17476
+ const rightAxisColor = (() => {
17477
+ if (!biaxialConfigNormalized) return defaultRightColor;
17478
+ if (typeof biaxialConfigNormalized.stroke === "string")
17479
+ return biaxialConfigNormalized.stroke;
17480
+ if (biaxialConfigNormalized.stroke && firstRightKey && typeof biaxialConfigNormalized.stroke === "object")
17481
+ return biaxialConfigNormalized.stroke[firstRightKey] || defaultRightColor;
17482
+ return defaultRightColor;
17483
+ })();
17484
+ return /* @__PURE__ */ jsx97(
17485
+ YAxis2,
17486
+ {
17487
+ yAxisId: "right",
17488
+ width: finalChartRightMargin,
17489
+ orientation: "right",
17490
+ stroke: "hsl(var(--muted-foreground))",
17491
+ fontSize: 12,
17492
+ tickLine: false,
17493
+ axisLine: false,
17494
+ tick: { fill: rightAxisColor },
17495
+ tickFormatter: rightTickFormatter,
17496
+ domain: [Math.min(minRightDataValue, 0), niceMaxRight],
17497
+ tickCount: 6,
17498
+ label: biaxialConfigNormalized?.label ? {
17499
+ value: biaxialConfigNormalized.label,
17500
+ angle: -90,
17501
+ position: "right",
17502
+ dx: rightYAxisLabelDx,
17503
+ style: {
17504
+ fontSize: 12,
17505
+ fill: "hsl(var(--muted-foreground))",
17506
+ fontWeight: 500,
17507
+ textAnchor: "middle"
17508
+ }
17509
+ } : void 0
17510
+ }
17511
+ );
17512
+ })(),
17513
+ showTooltip && /* @__PURE__ */ jsx97(
17514
+ Tooltip,
17515
+ {
17516
+ content: showTooltipTotal ? /* @__PURE__ */ jsx97(
17517
+ TooltipWithTotal_default,
17024
17518
  {
17025
- yAxisId: "left",
17026
- width: yAxisTickWidth,
17027
- stroke: "hsl(var(--muted-foreground))",
17028
- fontSize: 12,
17029
- tickLine: false,
17030
- axisLine: false,
17031
- tickFormatter: yTickFormatter,
17032
- domain: [Math.min(minLeftDataValue, 0), niceMaxLeft],
17033
- tickCount: 6,
17034
- label: yAxisLabel ? {
17035
- value: yAxisLabel,
17036
- angle: -90,
17037
- position: "left",
17038
- dx: leftYAxisLabelDx,
17039
- style: {
17040
- fontSize: 12,
17041
- fill: "hsl(var(--muted-foreground))",
17042
- fontWeight: 500,
17043
- textAnchor: "middle"
17044
- }
17045
- } : void 0
17519
+ finalColors,
17520
+ valueFormatter: finalValueFormatter,
17521
+ categoryFormatter,
17522
+ periodLabel
17046
17523
  }
17047
- ),
17048
- minLeftDataValue < 0 && /* @__PURE__ */ jsx96(
17049
- ReferenceLine,
17524
+ ) : /* @__PURE__ */ jsx97(
17525
+ TooltipSimple_default,
17050
17526
  {
17051
- y: 0,
17052
- yAxisId: "left",
17053
- stroke: "hsl(var(--muted-foreground))",
17054
- strokeWidth: 1,
17055
- strokeDasharray: "4 4"
17527
+ finalColors,
17528
+ valueFormatter: finalValueFormatter,
17529
+ categoryFormatter,
17530
+ periodLabel
17056
17531
  }
17057
17532
  ),
17058
- rightKeys.length > 0 && (() => {
17059
- const decimals = typeof biaxialConfigNormalized?.decimals === "number" ? Math.max(0, Math.floor(biaxialConfigNormalized.decimals)) : 2;
17060
- const rightTickFormatter = (v) => {
17061
- if (biaxialConfigNormalized?.percentage) {
17062
- const num = Number(String(v));
17063
- const nf = new Intl.NumberFormat("pt-BR", {
17064
- minimumFractionDigits: decimals,
17065
- maximumFractionDigits: decimals
17066
- });
17067
- const out = Number.isNaN(num) ? String(v ?? "") : nf.format(num);
17068
- return `${out}%`;
17069
- }
17070
- return yTickFormatter(v);
17071
- };
17072
- const firstRightKey = biaxialConfigNormalized?.key && biaxialConfigNormalized.key[0];
17073
- const defaultRightColor = firstRightKey && finalColors[firstRightKey] || "hsl(var(--muted-foreground))";
17074
- const rightAxisColor = (() => {
17075
- if (!biaxialConfigNormalized) return defaultRightColor;
17076
- if (typeof biaxialConfigNormalized.stroke === "string")
17077
- return biaxialConfigNormalized.stroke;
17078
- if (biaxialConfigNormalized.stroke && firstRightKey && typeof biaxialConfigNormalized.stroke === "object")
17079
- return biaxialConfigNormalized.stroke[firstRightKey] || defaultRightColor;
17080
- return defaultRightColor;
17081
- })();
17082
- return /* @__PURE__ */ jsx96(
17083
- YAxis,
17084
- {
17085
- yAxisId: "right",
17086
- width: finalChartRightMargin,
17087
- orientation: "right",
17088
- stroke: "hsl(var(--muted-foreground))",
17089
- fontSize: 12,
17090
- tickLine: false,
17091
- axisLine: false,
17092
- tick: { fill: rightAxisColor },
17093
- tickFormatter: rightTickFormatter,
17094
- domain: [Math.min(minRightDataValue, 0), niceMaxRight],
17095
- tickCount: 6,
17096
- label: biaxialConfigNormalized?.label ? {
17097
- value: biaxialConfigNormalized.label,
17098
- angle: -90,
17099
- position: "right",
17100
- dx: rightYAxisLabelDx,
17101
- style: {
17102
- fontSize: 12,
17103
- fill: "hsl(var(--muted-foreground))",
17104
- fontWeight: 500,
17105
- textAnchor: "middle"
17106
- }
17107
- } : void 0
17108
- }
17109
- );
17110
- })(),
17111
- showTooltip && /* @__PURE__ */ jsx96(
17112
- Tooltip,
17533
+ cursor: { fill: "hsl(var(--muted))", opacity: 0.1 }
17534
+ }
17535
+ ),
17536
+ showLegend && /* @__PURE__ */ jsx97(
17537
+ Legend,
17538
+ {
17539
+ wrapperStyle: {
17540
+ color: "hsl(var(--foreground))",
17541
+ fontSize: "14px",
17542
+ paddingTop: "8px",
17543
+ letterSpacing: 0
17544
+ },
17545
+ formatter: (value) => {
17546
+ const key = String(value);
17547
+ const label = mapperConfig[key]?.label ?? labelMap?.[key] ?? formatFieldName(key);
17548
+ const displayLabel = legendUppercase ? label.toUpperCase() : label;
17549
+ return /* @__PURE__ */ jsx97("span", { className: "tracking-[0]", children: displayLabel });
17550
+ }
17551
+ }
17552
+ ),
17553
+ seriesOrder.map((s) => {
17554
+ const key = s.key;
17555
+ if (showOnlyHighlighted && !highlightedSeries.has(key))
17556
+ return null;
17557
+ const label = mapperConfig[key]?.label ?? labelMap?.[key] ?? formatFieldName(key);
17558
+ let color = finalColors[key];
17559
+ if (rightKeys.includes(key) && biaxialConfigNormalized?.stroke) {
17560
+ if (typeof biaxialConfigNormalized.stroke === "string") {
17561
+ color = biaxialConfigNormalized.stroke;
17562
+ } else {
17563
+ color = biaxialConfigNormalized.stroke[key] ?? color;
17564
+ }
17565
+ }
17566
+ if (s.type === "bar") {
17567
+ return /* @__PURE__ */ jsx97(
17568
+ Bar2,
17113
17569
  {
17114
- content: showTooltipTotal ? /* @__PURE__ */ jsx96(
17115
- TooltipWithTotal_default,
17116
- {
17117
- finalColors,
17118
- valueFormatter: finalValueFormatter,
17119
- categoryFormatter,
17120
- periodLabel
17121
- }
17122
- ) : /* @__PURE__ */ jsx96(
17123
- TooltipSimple_default,
17570
+ dataKey: key,
17571
+ yAxisId: rightKeys.includes(key) ? "right" : "left",
17572
+ name: label,
17573
+ fill: color,
17574
+ radius: [4, 4, 0, 0],
17575
+ onClick: handleBarClick,
17576
+ className: "cursor-pointer",
17577
+ style: { opacity: getSeriesOpacity(key) },
17578
+ activeBar: /* @__PURE__ */ jsx97(
17579
+ Rectangle,
17124
17580
  {
17125
- finalColors,
17126
- valueFormatter: finalValueFormatter,
17127
- categoryFormatter,
17128
- periodLabel
17581
+ fill: color,
17582
+ stroke: color,
17583
+ strokeWidth: 2,
17584
+ opacity: 0.8
17129
17585
  }
17130
17586
  ),
17131
- cursor: { fill: "hsl(var(--muted))", opacity: 0.1 }
17132
- }
17133
- ),
17134
- showLegend && /* @__PURE__ */ jsx96(
17135
- Legend,
17136
- {
17137
- wrapperStyle: {
17138
- color: "hsl(var(--foreground))",
17139
- fontSize: "14px",
17140
- paddingTop: "8px",
17141
- letterSpacing: 0
17142
- },
17143
- formatter: (value) => {
17144
- const key = String(value);
17145
- const label = mapperConfig[key]?.label ?? labelMap?.[key] ?? formatFieldName(key);
17146
- const displayLabel = legendUppercase ? label.toUpperCase() : label;
17147
- return /* @__PURE__ */ jsx96("span", { style: { letterSpacing: 0 }, children: displayLabel });
17148
- }
17149
- }
17150
- ),
17151
- seriesOrder.map((s) => {
17152
- const key = s.key;
17153
- if (showOnlyHighlighted && !highlightedSeries.has(key))
17154
- return null;
17155
- const label = mapperConfig[key]?.label ?? labelMap?.[key] ?? formatFieldName(key);
17156
- let color = finalColors[key];
17157
- if (rightKeys.includes(key) && biaxialConfigNormalized?.stroke) {
17158
- if (typeof biaxialConfigNormalized.stroke === "string") {
17159
- color = biaxialConfigNormalized.stroke;
17160
- } else {
17161
- color = biaxialConfigNormalized.stroke[key] ?? color;
17162
- }
17163
- }
17164
- if (s.type === "bar") {
17165
- return /* @__PURE__ */ jsx96(
17166
- Bar,
17587
+ children: showLabels && highlightedSeries.size === 0 || highlightedSeries.has(key) ? /* @__PURE__ */ jsx97(
17588
+ LabelList,
17167
17589
  {
17168
17590
  dataKey: key,
17169
- yAxisId: rightKeys.includes(key) ? "right" : "left",
17170
- name: label,
17171
- fill: color,
17172
- radius: [4, 4, 0, 0],
17173
- onClick: handleBarClick,
17174
- style: {
17175
- cursor: "pointer",
17176
- opacity: highlightedSeries.size > 0 ? highlightedSeries.has(key) ? 1 : 0.25 : 1
17177
- },
17178
- activeBar: /* @__PURE__ */ jsx96(
17179
- Rectangle,
17180
- {
17181
- fill: color,
17182
- stroke: color,
17183
- strokeWidth: 2,
17184
- opacity: 0.8
17185
- }
17186
- ),
17187
- children: showLabels && highlightedSeries.size === 0 || highlightedSeries.has(key) ? /* @__PURE__ */ jsx96(
17188
- LabelList,
17189
- {
17190
- dataKey: key,
17191
- content: (props) => {
17192
- const p = props;
17193
- const barHeight = typeof p.height === "number" ? p.height : typeof p.height === "string" ? Number(p.height) : 0;
17194
- const barWidth = typeof p.width === "number" ? p.width : typeof p.width === "string" ? Number(p.width) : 0;
17195
- const smallThreshold = 14;
17196
- const needsOutside = barHeight > 0 && barHeight < smallThreshold || barWidth > 0 && barWidth < smallThreshold;
17197
- if (needsOutside) {
17198
- return null;
17199
- }
17200
- const inside = renderInsideBarLabel(
17201
- color,
17202
- finalValueFormatter
17203
- );
17204
- return inside(props);
17205
- },
17206
- offset: 0
17591
+ content: (props) => {
17592
+ const p = props;
17593
+ const barHeight = typeof p.height === "number" ? p.height : typeof p.height === "string" ? Number(p.height) : 0;
17594
+ const barWidth = typeof p.width === "number" ? p.width : typeof p.width === "string" ? Number(p.width) : 0;
17595
+ const smallThreshold = 14;
17596
+ const needsOutside = barHeight > 0 && barHeight < smallThreshold || barWidth > 0 && barWidth < smallThreshold;
17597
+ if (needsOutside) {
17598
+ return null;
17207
17599
  }
17208
- ) : null
17209
- },
17210
- `bar-${key}`
17211
- );
17212
- }
17213
- if (s.type === "line") {
17214
- return /* @__PURE__ */ jsx96(
17215
- Line,
17600
+ const inside = renderInsideBarLabel(
17601
+ color,
17602
+ finalValueFormatter
17603
+ );
17604
+ return inside(props);
17605
+ },
17606
+ offset: 0
17607
+ }
17608
+ ) : null
17609
+ },
17610
+ `bar-${key}`
17611
+ );
17612
+ }
17613
+ if (s.type === "line") {
17614
+ return /* @__PURE__ */ jsx97(
17615
+ Line2,
17616
+ {
17617
+ dataKey: key,
17618
+ yAxisId: rightKeys.includes(key) ? "right" : "left",
17619
+ name: label,
17620
+ stroke: color,
17621
+ strokeWidth: 2,
17622
+ dot: { r: 3 },
17623
+ activeDot: { r: 6 },
17624
+ onClick: handleSeriesClick,
17625
+ className: "cursor-pointer pointer-events-auto",
17626
+ style: { opacity: getSeriesOpacity(key) },
17627
+ children: showLabels && highlightedSeries.size === 0 || highlightedSeries.has(key) ? /* @__PURE__ */ jsx97(
17628
+ LabelList,
17216
17629
  {
17217
17630
  dataKey: key,
17218
- yAxisId: rightKeys.includes(key) ? "right" : "left",
17219
- name: label,
17220
- stroke: color,
17221
- strokeWidth: 2,
17222
- dot: { r: 3 },
17223
- activeDot: { r: 6 },
17224
- onClick: handleSeriesClick,
17225
- style: {
17226
- cursor: "pointer",
17227
- pointerEvents: "all",
17228
- opacity: highlightedSeries.size > 0 ? highlightedSeries.has(key) ? 1 : 0.25 : 1
17229
- },
17230
- children: showLabels && highlightedSeries.size === 0 || highlightedSeries.has(key) ? /* @__PURE__ */ jsx96(
17231
- LabelList,
17232
- {
17233
- dataKey: key,
17234
- position: "top",
17235
- content: pillLabelRenderer_default(
17236
- color,
17237
- "filled",
17238
- finalValueFormatter
17239
- ),
17240
- offset: 14
17241
- }
17242
- ) : null
17243
- },
17244
- `line-${key}`
17245
- );
17246
- }
17247
- if (s.type === "area") {
17248
- return /* @__PURE__ */ jsx96(
17249
- Area,
17631
+ position: "top",
17632
+ content: pillLabelRenderer_default(
17633
+ color,
17634
+ "filled",
17635
+ finalValueFormatter
17636
+ ),
17637
+ offset: 14
17638
+ }
17639
+ ) : null
17640
+ },
17641
+ `line-${key}`
17642
+ );
17643
+ }
17644
+ if (s.type === "area") {
17645
+ return /* @__PURE__ */ jsx97(
17646
+ Area2,
17647
+ {
17648
+ type: "monotone",
17649
+ dataKey: key,
17650
+ yAxisId: rightKeys.includes(key) ? "right" : "left",
17651
+ name: label,
17652
+ stroke: color,
17653
+ fill: `url(#gradient-${key})`,
17654
+ fillOpacity: 1,
17655
+ strokeWidth: 2,
17656
+ onClick: handleSeriesClick,
17657
+ className: "cursor-pointer pointer-events-auto",
17658
+ style: { opacity: getSeriesOpacity(key) },
17659
+ activeDot: {
17660
+ r: 6,
17661
+ fill: color,
17662
+ stroke: "hsl(var(--background))",
17663
+ strokeWidth: 2
17664
+ },
17665
+ children: showLabels && highlightedSeries.size === 0 || highlightedSeries.has(key) ? /* @__PURE__ */ jsx97(
17666
+ LabelList,
17250
17667
  {
17251
- type: "monotone",
17252
17668
  dataKey: key,
17253
- yAxisId: rightKeys.includes(key) ? "right" : "left",
17254
- name: label,
17255
- stroke: color,
17256
- fill: `url(#gradient-${key})`,
17257
- fillOpacity: 1,
17258
- strokeWidth: 2,
17259
- onClick: handleSeriesClick,
17260
- style: {
17261
- cursor: "pointer",
17262
- pointerEvents: "all",
17263
- opacity: highlightedSeries.size > 0 ? highlightedSeries.has(key) ? 1 : 0.25 : 1
17264
- },
17265
- activeDot: {
17266
- r: 6,
17267
- fill: color,
17268
- stroke: "hsl(var(--background))",
17269
- strokeWidth: 2
17270
- },
17271
- children: showLabels && highlightedSeries.size === 0 || highlightedSeries.has(key) ? /* @__PURE__ */ jsx96(
17272
- LabelList,
17273
- {
17274
- dataKey: key,
17275
- position: "top",
17276
- content: pillLabelRenderer_default(
17277
- color,
17278
- "soft",
17279
- finalValueFormatter
17280
- ),
17281
- offset: 12
17282
- }
17283
- ) : null
17284
- },
17285
- `area-${key}`
17286
- );
17287
- }
17288
- return null;
17289
- })
17290
- ]
17291
- }
17292
- ) }),
17293
- enableDraggableTooltips && activeTooltips.map((tooltip) => /* @__PURE__ */ jsx96(
17294
- DraggableTooltip_default,
17295
- {
17296
- id: tooltip.id,
17297
- data: adaptDataForTooltip(tooltip.data, xAxisConfig.dataKey),
17298
- position: tooltip.position,
17299
- title,
17300
- dataKeys: allKeys,
17301
- finalColors,
17302
- highlightedSeries,
17303
- toggleHighlight,
17304
- showOnlyHighlighted,
17305
- onClose: (id) => setActiveTooltips((prev) => prev.filter((t) => t.id !== id)),
17306
- onPositionChange: onTooltipPositionChange,
17307
- periodLabel,
17308
- dataLabel: "Dados do Per\xEDodo",
17309
- valueFormatter: finalValueFormatter,
17310
- categoryFormatter,
17311
- globalTooltipCount: activeTooltips.length,
17312
- onCloseAll: () => window.dispatchEvent(new Event("closeAllTooltips")),
17313
- closeAllButtonPosition: "top-center",
17314
- closeAllButtonVariant: "floating"
17315
- },
17316
- tooltip.id
17317
- )),
17318
- enableDraggableTooltips && activeTooltips.length > 1 && /* @__PURE__ */ jsx96(
17319
- CloseAllButton_default,
17320
- {
17321
- count: activeTooltips.length,
17322
- onCloseAll: () => window.dispatchEvent(new Event("closeAllTooltips")),
17323
- position: "top-center",
17324
- variant: "floating"
17325
- }
17326
- )
17327
- ]
17328
- }
17329
- )
17669
+ position: "top",
17670
+ content: pillLabelRenderer_default(
17671
+ color,
17672
+ "soft",
17673
+ finalValueFormatter
17674
+ ),
17675
+ offset: 12
17676
+ }
17677
+ ) : null
17678
+ },
17679
+ `area-${key}`
17680
+ );
17681
+ }
17682
+ return null;
17683
+ })
17684
+ ]
17685
+ }
17686
+ ) }),
17687
+ enableDraggableTooltips && activeTooltips.map((tooltip) => /* @__PURE__ */ jsx97(
17688
+ DraggableTooltip_default,
17689
+ {
17690
+ id: tooltip.id,
17691
+ data: adaptDataForTooltip(tooltip.data, xAxisConfig.dataKey),
17692
+ position: tooltip.position,
17693
+ title,
17694
+ dataKeys: allKeys,
17695
+ finalColors,
17696
+ highlightedSeries,
17697
+ toggleHighlight,
17698
+ showOnlyHighlighted,
17699
+ onClose: (id) => setActiveTooltips((prev) => prev.filter((t) => t.id !== id)),
17700
+ onPositionChange: onTooltipPositionChange,
17701
+ periodLabel,
17702
+ dataLabel: "Dados do Per\xEDodo",
17703
+ valueFormatter: finalValueFormatter,
17704
+ categoryFormatter,
17705
+ globalTooltipCount: activeTooltips.length,
17706
+ onCloseAll: () => window.dispatchEvent(new Event("closeAllTooltips")),
17707
+ closeAllButtonPosition: "top-center",
17708
+ closeAllButtonVariant: "floating"
17709
+ },
17710
+ tooltip.id
17711
+ )),
17712
+ enableDraggableTooltips && activeTooltips.length > 1 && /* @__PURE__ */ jsx97(
17713
+ CloseAllButton_default,
17714
+ {
17715
+ count: activeTooltips.length,
17716
+ onCloseAll: () => window.dispatchEvent(new Event("closeAllTooltips")),
17717
+ position: "top-center",
17718
+ variant: "floating"
17719
+ }
17720
+ ),
17721
+ timeSeriesConfig && /* @__PURE__ */ jsx97(
17722
+ Brush_default,
17723
+ {
17724
+ data,
17725
+ startIndex,
17726
+ endIndex,
17727
+ onMouseDown: handleMouseDown,
17728
+ brushRef,
17729
+ xAxisKey: xAxisConfig.dataKey,
17730
+ seriesOrder,
17731
+ finalColors,
17732
+ brushHeight: timeSeriesConfig.height,
17733
+ brushColor: timeSeriesConfig.brushColor,
17734
+ miniChartOpacity: timeSeriesConfig.miniChartOpacity,
17735
+ showGrid,
17736
+ gridColor,
17737
+ margin: {
17738
+ left: finalChartLeftMargin,
17739
+ right: finalChartRightMargin
17740
+ }
17741
+ }
17742
+ )
17743
+ ]
17330
17744
  }
17331
- );
17745
+ ) });
17332
17746
  };
17333
17747
  var Chart_default = Chart;
17334
17748
 
17335
17749
  // src/components/ui/charts/BarChart.tsx
17336
- import { useState as useState43, useEffect as useEffect34, useCallback as useCallback18, useMemo as useMemo27 } from "react";
17750
+ import { useState as useState44, useEffect as useEffect35, useCallback as useCallback19, useMemo as useMemo27 } from "react";
17337
17751
  import {
17338
17752
  BarChart as RechartsBarChart,
17339
- Bar as Bar2,
17753
+ Bar as Bar3,
17340
17754
  Rectangle as Rectangle2,
17341
- XAxis as XAxis2,
17342
- YAxis as YAxis2,
17755
+ XAxis as XAxis3,
17756
+ YAxis as YAxis3,
17343
17757
  CartesianGrid as CartesianGrid2,
17344
17758
  Tooltip as Tooltip2,
17345
17759
  Legend as Legend2,
17346
17760
  LabelList as LabelList2
17347
17761
  } from "recharts";
17348
- import { jsx as jsx97, jsxs as jsxs75 } from "react/jsx-runtime";
17762
+ import { jsx as jsx98, jsxs as jsxs76 } from "react/jsx-runtime";
17349
17763
  var DEFAULT_COLORS3 = ["#55af7d", "#8e68ff", "#2273e1"];
17350
17764
  var BarChart = ({
17351
17765
  data,
@@ -17425,14 +17839,14 @@ var BarChart = ({
17425
17839
  return { xAxisConfig: xAxisConfig2, mapperConfig: mapperConfig2 };
17426
17840
  }, [data, xAxis, mapper, yAxis, autoDetect, labelMap]);
17427
17841
  const { xAxisConfig, mapperConfig } = smartConfig;
17428
- const [activeTooltips, setActiveTooltips] = useState43([]);
17429
- const [isDragging, setIsDragging] = useState43(null);
17430
- const [dragOffset, setDragOffset] = useState43({
17842
+ const [activeTooltips, setActiveTooltips] = useState44([]);
17843
+ const [isDragging, setIsDragging] = useState44(null);
17844
+ const [dragOffset, setDragOffset] = useState44({
17431
17845
  x: 0,
17432
17846
  y: 0
17433
17847
  });
17434
- const [globalTooltipCount, setGlobalTooltipCount] = useState43(0);
17435
- const [alignmentGuides, setAlignmentGuides] = useState43([]);
17848
+ const [globalTooltipCount, setGlobalTooltipCount] = useState44(0);
17849
+ const [alignmentGuides, setAlignmentGuides] = useState44([]);
17436
17850
  const processedData = data.map((item) => ({
17437
17851
  ...item,
17438
17852
  name: String(item[xAxisConfig.dataKey] || "N/A")
@@ -17509,7 +17923,7 @@ var BarChart = ({
17509
17923
  const GUIDE_THRESHOLD2 = 60;
17510
17924
  const STRONG_SNAP_THRESHOLD2 = 35;
17511
17925
  const PRECISION_SNAP_THRESHOLD2 = 8;
17512
- const updateAlignmentGuides = useCallback18(
17926
+ const updateAlignmentGuides = useCallback19(
17513
17927
  (draggedTooltipId, currentPosition) => {
17514
17928
  if (!isDragging) return;
17515
17929
  const getAllTooltips = () => {
@@ -17573,7 +17987,7 @@ var BarChart = ({
17573
17987
  },
17574
17988
  [isDragging, activeTooltips]
17575
17989
  );
17576
- const snapToGuides = useCallback18(
17990
+ const snapToGuides = useCallback19(
17577
17991
  (position) => {
17578
17992
  const snappedPosition = { ...position };
17579
17993
  let hasSnapped = false;
@@ -17635,7 +18049,7 @@ var BarChart = ({
17635
18049
  setIsDragging(tooltipId);
17636
18050
  setDragOffset({ x: offsetX, y: offsetY });
17637
18051
  };
17638
- useEffect34(() => {
18052
+ useEffect35(() => {
17639
18053
  let rafId;
17640
18054
  let lastMousePosition = { x: 0, y: 0 };
17641
18055
  const handleGlobalMouseMove = (e) => {
@@ -17693,7 +18107,7 @@ var BarChart = ({
17693
18107
  updateAlignmentGuides,
17694
18108
  snapToGuides
17695
18109
  ]);
17696
- useEffect34(() => {
18110
+ useEffect35(() => {
17697
18111
  const handleCloseAllTooltips = () => {
17698
18112
  setActiveTooltips([]);
17699
18113
  setGlobalTooltipCount(0);
@@ -17703,7 +18117,7 @@ var BarChart = ({
17703
18117
  window.removeEventListener("closeAllTooltips", handleCloseAllTooltips);
17704
18118
  };
17705
18119
  }, []);
17706
- useEffect34(() => {
18120
+ useEffect35(() => {
17707
18121
  const handleTooltipCountRequest = () => {
17708
18122
  window.dispatchEvent(
17709
18123
  new CustomEvent("tooltipCountResponse", {
@@ -17742,7 +18156,7 @@ var BarChart = ({
17742
18156
  );
17743
18157
  };
17744
18158
  }, [activeTooltips]);
17745
- useEffect34(() => {
18159
+ useEffect35(() => {
17746
18160
  if (isDragging) return;
17747
18161
  let totalCount = 0;
17748
18162
  const handleCountResponse = (event) => {
@@ -17766,25 +18180,25 @@ var BarChart = ({
17766
18180
  label
17767
18181
  }) => {
17768
18182
  if (!active || !payload) return null;
17769
- return /* @__PURE__ */ jsxs75("div", { className: "bg-card border border-border rounded-lg p-3 shadow-lg", children: [
17770
- /* @__PURE__ */ jsx97("p", { className: "font-medium text-foreground mb-2", children: label }),
18183
+ return /* @__PURE__ */ jsxs76("div", { className: "bg-card border border-border rounded-lg p-3 shadow-lg", children: [
18184
+ /* @__PURE__ */ jsx98("p", { className: "font-medium text-foreground mb-2", children: label }),
17771
18185
  payload.map(
17772
- (entry, index) => /* @__PURE__ */ jsxs75("div", { className: "flex items-center gap-2 text-sm", children: [
17773
- /* @__PURE__ */ jsx97(
18186
+ (entry, index) => /* @__PURE__ */ jsxs76("div", { className: "flex items-center gap-2 text-sm", children: [
18187
+ /* @__PURE__ */ jsx98(
17774
18188
  "div",
17775
18189
  {
17776
18190
  className: "w-3 h-3 rounded-sm",
17777
18191
  style: { backgroundColor: entry.color }
17778
18192
  }
17779
18193
  ),
17780
- /* @__PURE__ */ jsxs75("span", { className: "text-muted-foreground", children: [
18194
+ /* @__PURE__ */ jsxs76("span", { className: "text-muted-foreground", children: [
17781
18195
  entry.name,
17782
18196
  ":"
17783
18197
  ] }),
17784
- /* @__PURE__ */ jsx97("span", { className: "text-foreground font-medium", children: entry.value?.toLocaleString("pt-BR") })
18198
+ /* @__PURE__ */ jsx98("span", { className: "text-foreground font-medium", children: entry.value?.toLocaleString("pt-BR") })
17785
18199
  ] }, index)
17786
18200
  ),
17787
- /* @__PURE__ */ jsx97("p", { className: "text-xs text-muted-foreground mt-1", children: "Clique para fixar este tooltip" })
18201
+ /* @__PURE__ */ jsx98("p", { className: "text-xs text-muted-foreground mt-1", children: "Clique para fixar este tooltip" })
17788
18202
  ] });
17789
18203
  };
17790
18204
  const getTitleClassName = (position) => {
@@ -17798,7 +18212,7 @@ var BarChart = ({
17798
18212
  return `${baseClasses} text-left`;
17799
18213
  }
17800
18214
  };
17801
- return /* @__PURE__ */ jsxs75(
18215
+ return /* @__PURE__ */ jsxs76(
17802
18216
  "div",
17803
18217
  {
17804
18218
  className: cn("rounded-lg bg-card p-4 relative", className),
@@ -17807,8 +18221,8 @@ var BarChart = ({
17807
18221
  maxWidth: "100%"
17808
18222
  },
17809
18223
  children: [
17810
- title && /* @__PURE__ */ jsx97("div", { style: { paddingLeft: `${resolvedContainerPaddingLeft}px` }, children: /* @__PURE__ */ jsx97("h3", { className: getTitleClassName(titlePosition), children: title }) }),
17811
- /* @__PURE__ */ jsxs75(
18224
+ title && /* @__PURE__ */ jsx98("div", { style: { paddingLeft: `${resolvedContainerPaddingLeft}px` }, children: /* @__PURE__ */ jsx98("h3", { className: getTitleClassName(titlePosition), children: title }) }),
18225
+ /* @__PURE__ */ jsxs76(
17812
18226
  RechartsBarChart,
17813
18227
  {
17814
18228
  data: processedData,
@@ -17817,7 +18231,7 @@ var BarChart = ({
17817
18231
  margin: resolveChartMargins(margins, chartMargins, showLabels),
17818
18232
  onClick: handleChartClick,
17819
18233
  children: [
17820
- showGrid && /* @__PURE__ */ jsx97(
18234
+ showGrid && /* @__PURE__ */ jsx98(
17821
18235
  CartesianGrid2,
17822
18236
  {
17823
18237
  strokeDasharray: "3 3",
@@ -17825,8 +18239,8 @@ var BarChart = ({
17825
18239
  opacity: 0.5
17826
18240
  }
17827
18241
  ),
17828
- /* @__PURE__ */ jsx97(
17829
- XAxis2,
18242
+ /* @__PURE__ */ jsx98(
18243
+ XAxis3,
17830
18244
  {
17831
18245
  dataKey: xAxisConfig.dataKey,
17832
18246
  stroke: "hsl(var(--muted-foreground))",
@@ -17836,8 +18250,8 @@ var BarChart = ({
17836
18250
  tickFormatter: xAxisConfig.valueFormatter
17837
18251
  }
17838
18252
  ),
17839
- /* @__PURE__ */ jsx97(
17840
- YAxis2,
18253
+ /* @__PURE__ */ jsx98(
18254
+ YAxis3,
17841
18255
  {
17842
18256
  stroke: "hsl(var(--muted-foreground))",
17843
18257
  fontSize: 12,
@@ -17848,14 +18262,14 @@ var BarChart = ({
17848
18262
  tickCount: 6
17849
18263
  }
17850
18264
  ),
17851
- showTooltip && /* @__PURE__ */ jsx97(
18265
+ showTooltip && /* @__PURE__ */ jsx98(
17852
18266
  Tooltip2,
17853
18267
  {
17854
- content: /* @__PURE__ */ jsx97(CustomTooltip, {}),
18268
+ content: /* @__PURE__ */ jsx98(CustomTooltip, {}),
17855
18269
  cursor: { fill: "hsl(var(--muted))", opacity: 0.1 }
17856
18270
  }
17857
18271
  ),
17858
- showLegend && /* @__PURE__ */ jsx97(
18272
+ showLegend && /* @__PURE__ */ jsx98(
17859
18273
  Legend2,
17860
18274
  {
17861
18275
  wrapperStyle: {
@@ -17866,8 +18280,8 @@ var BarChart = ({
17866
18280
  ),
17867
18281
  dataKeys.map((key) => {
17868
18282
  const fieldConfig = mapperConfig[key];
17869
- return /* @__PURE__ */ jsx97(
17870
- Bar2,
18283
+ return /* @__PURE__ */ jsx98(
18284
+ Bar3,
17871
18285
  {
17872
18286
  dataKey: key,
17873
18287
  name: fieldConfig?.label || key,
@@ -17875,7 +18289,7 @@ var BarChart = ({
17875
18289
  radius: [4, 4, 0, 0],
17876
18290
  onClick: handleBarClick,
17877
18291
  style: { cursor: "pointer" },
17878
- activeBar: /* @__PURE__ */ jsx97(
18292
+ activeBar: /* @__PURE__ */ jsx98(
17879
18293
  Rectangle2,
17880
18294
  {
17881
18295
  fill: finalColors[key],
@@ -17884,7 +18298,7 @@ var BarChart = ({
17884
18298
  opacity: 0.8
17885
18299
  }
17886
18300
  ),
17887
- children: showLabels && /* @__PURE__ */ jsx97(
18301
+ children: showLabels && /* @__PURE__ */ jsx98(
17888
18302
  LabelList2,
17889
18303
  {
17890
18304
  dataKey: key,
@@ -17921,8 +18335,8 @@ var BarChart = ({
17921
18335
  guide.sourceTooltip.top + guide.sourceTooltip.height / 2,
17922
18336
  guide.targetTooltip.top + guide.targetTooltip.height / 2
17923
18337
  );
17924
- return /* @__PURE__ */ jsxs75("div", { children: [
17925
- /* @__PURE__ */ jsx97(
18338
+ return /* @__PURE__ */ jsxs76("div", { children: [
18339
+ /* @__PURE__ */ jsx98(
17926
18340
  "div",
17927
18341
  {
17928
18342
  className: "fixed pointer-events-none z-30",
@@ -17941,7 +18355,7 @@ var BarChart = ({
17941
18355
  }
17942
18356
  }
17943
18357
  ),
17944
- /* @__PURE__ */ jsx97(
18358
+ /* @__PURE__ */ jsx98(
17945
18359
  "div",
17946
18360
  {
17947
18361
  className: "fixed pointer-events-none z-31",
@@ -17957,7 +18371,7 @@ var BarChart = ({
17957
18371
  }
17958
18372
  }
17959
18373
  ),
17960
- /* @__PURE__ */ jsx97(
18374
+ /* @__PURE__ */ jsx98(
17961
18375
  "div",
17962
18376
  {
17963
18377
  className: "fixed pointer-events-none z-31",
@@ -17975,7 +18389,7 @@ var BarChart = ({
17975
18389
  )
17976
18390
  ] }, index);
17977
18391
  }),
17978
- activeTooltips.map((tooltip, index) => /* @__PURE__ */ jsx97(
18392
+ activeTooltips.map((tooltip, index) => /* @__PURE__ */ jsx98(
17979
18393
  DraggableTooltip_default,
17980
18394
  {
17981
18395
  id: tooltip.id,
@@ -18008,18 +18422,18 @@ var BarChart = ({
18008
18422
  var BarChart_default = BarChart;
18009
18423
 
18010
18424
  // src/components/ui/charts/LineChart.tsx
18011
- import { useState as useState44, useEffect as useEffect35, useCallback as useCallback19, useMemo as useMemo28 } from "react";
18425
+ import { useState as useState45, useEffect as useEffect36, useCallback as useCallback20, useMemo as useMemo28 } from "react";
18012
18426
  import {
18013
18427
  LineChart as RechartsLineChart,
18014
- Line as Line2,
18015
- XAxis as XAxis3,
18016
- YAxis as YAxis3,
18428
+ Line as Line3,
18429
+ XAxis as XAxis4,
18430
+ YAxis as YAxis4,
18017
18431
  CartesianGrid as CartesianGrid3,
18018
18432
  Tooltip as Tooltip3,
18019
18433
  Legend as Legend3,
18020
18434
  LabelList as LabelList3
18021
18435
  } from "recharts";
18022
- import { jsx as jsx98, jsxs as jsxs76 } from "react/jsx-runtime";
18436
+ import { jsx as jsx99, jsxs as jsxs77 } from "react/jsx-runtime";
18023
18437
  var defaultData = [
18024
18438
  { name: "A", value: 100 },
18025
18439
  { name: "B", value: 200 },
@@ -18051,14 +18465,14 @@ var CustomLineChart = ({
18051
18465
  containerPaddingLeft,
18052
18466
  16
18053
18467
  );
18054
- const [activeTooltips, setActiveTooltips] = useState44([]);
18055
- const [isDragging, setIsDragging] = useState44(null);
18056
- const [dragOffset, setDragOffset] = useState44({
18468
+ const [activeTooltips, setActiveTooltips] = useState45([]);
18469
+ const [isDragging, setIsDragging] = useState45(null);
18470
+ const [dragOffset, setDragOffset] = useState45({
18057
18471
  x: 0,
18058
18472
  y: 0
18059
18473
  });
18060
- const [globalTooltipCount, setGlobalTooltipCount] = useState44(0);
18061
- const [alignmentGuides, setAlignmentGuides] = useState44([]);
18474
+ const [globalTooltipCount, setGlobalTooltipCount] = useState45(0);
18475
+ const [alignmentGuides, setAlignmentGuides] = useState45([]);
18062
18476
  const generateColors = (dataKeys2) => {
18063
18477
  const colorMap = {};
18064
18478
  const allColors = generateAdditionalColors(colors2, dataKeys2.length);
@@ -18118,7 +18532,7 @@ var CustomLineChart = ({
18118
18532
  setActiveTooltips((prev) => [...prev, newTooltip]);
18119
18533
  }
18120
18534
  };
18121
- return /* @__PURE__ */ jsx98(
18535
+ return /* @__PURE__ */ jsx99(
18122
18536
  "circle",
18123
18537
  {
18124
18538
  cx,
@@ -18160,10 +18574,10 @@ var CustomLineChart = ({
18160
18574
  const handleChartBackgroundClick = () => {
18161
18575
  setActiveTooltips([]);
18162
18576
  };
18163
- const handleCloseAllTooltips = useCallback19(() => {
18577
+ const handleCloseAllTooltips = useCallback20(() => {
18164
18578
  window.dispatchEvent(new CustomEvent("closeAllTooltips"));
18165
18579
  }, []);
18166
- const updateAlignmentGuides = useCallback19(
18580
+ const updateAlignmentGuides = useCallback20(
18167
18581
  (draggedTooltipId, draggedPosition) => {
18168
18582
  const SNAP_THRESHOLD = 15;
18169
18583
  const draggedTooltip = activeTooltips.find(
@@ -18244,7 +18658,7 @@ var CustomLineChart = ({
18244
18658
  },
18245
18659
  [activeTooltips]
18246
18660
  );
18247
- const snapToGuides = useCallback19(
18661
+ const snapToGuides = useCallback20(
18248
18662
  (position) => {
18249
18663
  const SNAP_DISTANCE = 10;
18250
18664
  const snappedPosition = { ...position };
@@ -18272,7 +18686,7 @@ var CustomLineChart = ({
18272
18686
  setIsDragging(tooltipId);
18273
18687
  setDragOffset({ x: offsetX, y: offsetY });
18274
18688
  };
18275
- useEffect35(() => {
18689
+ useEffect36(() => {
18276
18690
  let rafId;
18277
18691
  let lastMousePosition = { x: 0, y: 0 };
18278
18692
  const handleGlobalMouseMove = (e) => {
@@ -18319,7 +18733,7 @@ var CustomLineChart = ({
18319
18733
  updateAlignmentGuides,
18320
18734
  snapToGuides
18321
18735
  ]);
18322
- useEffect35(() => {
18736
+ useEffect36(() => {
18323
18737
  const handleCloseAllTooltips2 = () => {
18324
18738
  setActiveTooltips([]);
18325
18739
  setGlobalTooltipCount(0);
@@ -18329,7 +18743,7 @@ var CustomLineChart = ({
18329
18743
  window.removeEventListener("closeAllTooltips", handleCloseAllTooltips2);
18330
18744
  };
18331
18745
  }, []);
18332
- useEffect35(() => {
18746
+ useEffect36(() => {
18333
18747
  const handleTooltipCountRequest = () => {
18334
18748
  window.dispatchEvent(
18335
18749
  new CustomEvent("tooltipCountResponse", {
@@ -18373,7 +18787,7 @@ var CustomLineChart = ({
18373
18787
  );
18374
18788
  };
18375
18789
  }, [activeTooltips]);
18376
- useEffect35(() => {
18790
+ useEffect36(() => {
18377
18791
  if (isDragging) return;
18378
18792
  let totalCount = 0;
18379
18793
  const handleCountResponse = (event) => {
@@ -18401,7 +18815,7 @@ var CustomLineChart = ({
18401
18815
  return "text-left";
18402
18816
  }
18403
18817
  };
18404
- return /* @__PURE__ */ jsx98("div", { className: cn("relative", className), children: /* @__PURE__ */ jsxs76(
18818
+ return /* @__PURE__ */ jsx99("div", { className: cn("relative", className), children: /* @__PURE__ */ jsxs77(
18405
18819
  "div",
18406
18820
  {
18407
18821
  className: "rounded-lg bg-card p-4 relative border border-border",
@@ -18411,8 +18825,8 @@ var CustomLineChart = ({
18411
18825
  },
18412
18826
  onClick: handleChartBackgroundClick,
18413
18827
  children: [
18414
- title && /* @__PURE__ */ jsx98("div", { style: { paddingLeft: `${resolvedContainerPaddingLeft}px` }, children: /* @__PURE__ */ jsx98("div", { className: cn("mb-4", getTitleClass()), children: /* @__PURE__ */ jsx98("h3", { className: "text-lg font-semibold text-foreground", children: title }) }) }),
18415
- /* @__PURE__ */ jsxs76(
18828
+ title && /* @__PURE__ */ jsx99("div", { style: { paddingLeft: `${resolvedContainerPaddingLeft}px` }, children: /* @__PURE__ */ jsx99("div", { className: cn("mb-4", getTitleClass()), children: /* @__PURE__ */ jsx99("h3", { className: "text-lg font-semibold text-foreground", children: title }) }) }),
18829
+ /* @__PURE__ */ jsxs77(
18416
18830
  RechartsLineChart,
18417
18831
  {
18418
18832
  data,
@@ -18421,7 +18835,7 @@ var CustomLineChart = ({
18421
18835
  margin: resolveChartMargins(margins, chartMargins, showLabels),
18422
18836
  onClick: handleChartClick,
18423
18837
  children: [
18424
- showGrid && /* @__PURE__ */ jsx98(
18838
+ showGrid && /* @__PURE__ */ jsx99(
18425
18839
  CartesianGrid3,
18426
18840
  {
18427
18841
  strokeDasharray: "3 3",
@@ -18429,16 +18843,16 @@ var CustomLineChart = ({
18429
18843
  opacity: 0.3
18430
18844
  }
18431
18845
  ),
18432
- /* @__PURE__ */ jsx98(
18433
- XAxis3,
18846
+ /* @__PURE__ */ jsx99(
18847
+ XAxis4,
18434
18848
  {
18435
18849
  dataKey: "name",
18436
18850
  className: "fill-muted-foreground text-xs",
18437
18851
  fontSize: 12
18438
18852
  }
18439
18853
  ),
18440
- /* @__PURE__ */ jsx98(
18441
- YAxis3,
18854
+ /* @__PURE__ */ jsx99(
18855
+ YAxis4,
18442
18856
  {
18443
18857
  className: "fill-muted-foreground text-xs",
18444
18858
  fontSize: 12,
@@ -18447,8 +18861,8 @@ var CustomLineChart = ({
18447
18861
  tickCount: 6
18448
18862
  }
18449
18863
  ),
18450
- showTooltip && /* @__PURE__ */ jsx98(Tooltip3, { content: () => null }),
18451
- showLegend && /* @__PURE__ */ jsx98(
18864
+ showTooltip && /* @__PURE__ */ jsx99(Tooltip3, { content: () => null }),
18865
+ showLegend && /* @__PURE__ */ jsx99(
18452
18866
  Legend3,
18453
18867
  {
18454
18868
  wrapperStyle: {
@@ -18457,16 +18871,16 @@ var CustomLineChart = ({
18457
18871
  }
18458
18872
  }
18459
18873
  ),
18460
- dataKeys.map((key) => /* @__PURE__ */ jsx98(
18461
- Line2,
18874
+ dataKeys.map((key) => /* @__PURE__ */ jsx99(
18875
+ Line3,
18462
18876
  {
18463
18877
  type: "monotone",
18464
18878
  dataKey: key,
18465
18879
  stroke: finalColors[key],
18466
18880
  strokeWidth,
18467
18881
  dot: showDots ? { r: 4, cursor: "pointer" } : false,
18468
- activeDot: (props) => /* @__PURE__ */ jsx98(ClickableDot, { ...props, dataKey: key }),
18469
- children: showLabels && /* @__PURE__ */ jsx98(
18882
+ activeDot: (props) => /* @__PURE__ */ jsx99(ClickableDot, { ...props, dataKey: key }),
18883
+ children: showLabels && /* @__PURE__ */ jsx99(
18470
18884
  LabelList3,
18471
18885
  {
18472
18886
  dataKey: key,
@@ -18503,8 +18917,8 @@ var CustomLineChart = ({
18503
18917
  guide.sourceTooltip.top + guide.sourceTooltip.height / 2,
18504
18918
  guide.targetTooltip.top + guide.targetTooltip.height / 2
18505
18919
  );
18506
- return /* @__PURE__ */ jsxs76("div", { children: [
18507
- /* @__PURE__ */ jsx98(
18920
+ return /* @__PURE__ */ jsxs77("div", { children: [
18921
+ /* @__PURE__ */ jsx99(
18508
18922
  "div",
18509
18923
  {
18510
18924
  className: "fixed pointer-events-none z-30",
@@ -18523,7 +18937,7 @@ var CustomLineChart = ({
18523
18937
  }
18524
18938
  }
18525
18939
  ),
18526
- /* @__PURE__ */ jsx98(
18940
+ /* @__PURE__ */ jsx99(
18527
18941
  "div",
18528
18942
  {
18529
18943
  className: "fixed pointer-events-none z-31",
@@ -18539,7 +18953,7 @@ var CustomLineChart = ({
18539
18953
  }
18540
18954
  }
18541
18955
  ),
18542
- /* @__PURE__ */ jsx98(
18956
+ /* @__PURE__ */ jsx99(
18543
18957
  "div",
18544
18958
  {
18545
18959
  className: "fixed pointer-events-none z-31",
@@ -18557,7 +18971,7 @@ var CustomLineChart = ({
18557
18971
  )
18558
18972
  ] }, index);
18559
18973
  }),
18560
- activeTooltips.map((tooltip, index) => /* @__PURE__ */ jsx98(
18974
+ activeTooltips.map((tooltip, index) => /* @__PURE__ */ jsx99(
18561
18975
  DraggableTooltip_default,
18562
18976
  {
18563
18977
  id: tooltip.id,
@@ -18592,11 +19006,11 @@ import {
18592
19006
  PieChart as RechartsPieChart,
18593
19007
  Pie,
18594
19008
  Cell,
18595
- ResponsiveContainer as ResponsiveContainer2,
19009
+ ResponsiveContainer as ResponsiveContainer3,
18596
19010
  Tooltip as Tooltip4,
18597
19011
  Legend as Legend4
18598
19012
  } from "recharts";
18599
- import { jsx as jsx99, jsxs as jsxs77 } from "react/jsx-runtime";
19013
+ import { jsx as jsx100, jsxs as jsxs78 } from "react/jsx-runtime";
18600
19014
  var defaultData2 = [
18601
19015
  { name: "Vendas", value: 4e3 },
18602
19016
  { name: "Marketing", value: 3e3 },
@@ -18634,7 +19048,7 @@ var renderCustomizedLabel = ({
18634
19048
  const radius = innerRadius + (outerRadius - innerRadius) * 0.5;
18635
19049
  const x = cx + radius * Math.cos(-midAngle * RADIAN);
18636
19050
  const y = cy + radius * Math.sin(-midAngle * RADIAN);
18637
- return /* @__PURE__ */ jsx99(
19051
+ return /* @__PURE__ */ jsx100(
18638
19052
  "text",
18639
19053
  {
18640
19054
  x,
@@ -18663,8 +19077,8 @@ var CustomPieChart = ({
18663
19077
  centerY = "50%"
18664
19078
  }) => {
18665
19079
  const finalColors = colors2 || DEFAULT_COLORS5;
18666
- return /* @__PURE__ */ jsx99("div", { className: cn("w-full rounded-lg bg-card p-4", className), children: /* @__PURE__ */ jsx99(ResponsiveContainer2, { width, height, children: /* @__PURE__ */ jsxs77(RechartsPieChart, { children: [
18667
- /* @__PURE__ */ jsx99(
19080
+ return /* @__PURE__ */ jsx100("div", { className: cn("w-full rounded-lg bg-card p-4", className), children: /* @__PURE__ */ jsx100(ResponsiveContainer3, { width, height, children: /* @__PURE__ */ jsxs78(RechartsPieChart, { children: [
19081
+ /* @__PURE__ */ jsx100(
18668
19082
  Pie,
18669
19083
  {
18670
19084
  data,
@@ -18676,7 +19090,7 @@ var CustomPieChart = ({
18676
19090
  innerRadius,
18677
19091
  fill: "#8884d8",
18678
19092
  dataKey: "value",
18679
- children: data.map((entry, index) => /* @__PURE__ */ jsx99(
19093
+ children: data.map((entry, index) => /* @__PURE__ */ jsx100(
18680
19094
  Cell,
18681
19095
  {
18682
19096
  fill: finalColors[index % finalColors.length]
@@ -18685,7 +19099,7 @@ var CustomPieChart = ({
18685
19099
  ))
18686
19100
  }
18687
19101
  ),
18688
- showTooltip && /* @__PURE__ */ jsx99(
19102
+ showTooltip && /* @__PURE__ */ jsx100(
18689
19103
  Tooltip4,
18690
19104
  {
18691
19105
  contentStyle: {
@@ -18696,96 +19110,154 @@ var CustomPieChart = ({
18696
19110
  }
18697
19111
  }
18698
19112
  ),
18699
- showLegend && /* @__PURE__ */ jsx99(Legend4, {})
19113
+ showLegend && /* @__PURE__ */ jsx100(Legend4, {})
18700
19114
  ] }) }) });
18701
19115
  };
18702
19116
  var PieChart_default = CustomPieChart;
18703
19117
 
19118
+ // src/components/ui/charts/TimeSeries.tsx
19119
+ import { jsx as jsx101 } from "react/jsx-runtime";
19120
+ var TimeSeries = ({
19121
+ data,
19122
+ xAxis,
19123
+ chartHeight = 350,
19124
+ height,
19125
+ brushHeight,
19126
+ className,
19127
+ start,
19128
+ end,
19129
+ defaultStartIndex,
19130
+ defaultEndIndex,
19131
+ onRangeChange,
19132
+ brushColor,
19133
+ brushStroke,
19134
+ miniChartOpacity = 0.2,
19135
+ ...rest
19136
+ }) => {
19137
+ const brushHeightValue = brushHeight ?? height ?? 60;
19138
+ const startIndex = defaultStartIndex ?? start ?? 0;
19139
+ const endIndex = defaultEndIndex ?? end;
19140
+ return /* @__PURE__ */ jsx101("div", { className: cn("w-full flex flex-col", className), children: /* @__PURE__ */ jsx101(
19141
+ Chart_default,
19142
+ {
19143
+ ...rest,
19144
+ data,
19145
+ xAxis,
19146
+ height: chartHeight + brushHeightValue + 40,
19147
+ timeSeries: {
19148
+ start: startIndex,
19149
+ end: endIndex,
19150
+ onRangeChange,
19151
+ height: brushHeightValue,
19152
+ brushColor,
19153
+ brushStroke,
19154
+ miniChartOpacity
19155
+ }
19156
+ }
19157
+ ) });
19158
+ };
19159
+ var TimeSeries_default = TimeSeries;
19160
+
18704
19161
  // src/components/ui/LeaderBoard.tsx
18705
19162
  import { CaretUpDownIcon as CaretUpDownIcon3 } from "@phosphor-icons/react";
18706
- import { useState as useState45 } from "react";
19163
+ import { useState as useState46 } from "react";
18707
19164
  import { motion as motion22 } from "framer-motion";
18708
- import { jsx as jsx100, jsxs as jsxs78 } from "react/jsx-runtime";
19165
+ import { jsx as jsx102, jsxs as jsxs79 } from "react/jsx-runtime";
18709
19166
  function Leaderboard({
18710
19167
  items,
18711
19168
  order: initialOrder = "desc",
18712
19169
  title = "LeaderBoard",
18713
19170
  className,
18714
- isLoading = false
19171
+ isLoading = false,
19172
+ legend
18715
19173
  }) {
18716
- const [order, setOrder] = useState45(initialOrder);
19174
+ const [order, setOrder] = useState46(initialOrder);
18717
19175
  const mockData = [
18718
- { name: "Ana", percentage: 92 },
18719
- { name: "Bruno", percentage: 81 },
18720
- { name: "Carla", percentage: 74 },
18721
- { name: "Daniel", percentage: 68 },
18722
- { name: "Eduardo", percentage: 55 },
18723
- { name: "Fernanda", percentage: 44 },
18724
- { name: "Gabriela", percentage: 33 },
18725
- { name: "Heitor", percentage: 28 },
18726
- { name: "Isabela", percentage: 22 },
18727
- { name: "Jo\xE3o", percentage: 18 }
19176
+ { name: "Ana", value: 92 },
19177
+ { name: "Bruno", value: 81 },
19178
+ { name: "Carla", value: 74 },
19179
+ { name: "Daniel", value: 68 },
19180
+ { name: "Eduardo", value: 55 },
19181
+ { name: "Fernanda", value: 44 },
19182
+ { name: "Gabriela", value: 33 },
19183
+ { name: "Heitor", value: 28 },
19184
+ { name: "Isabela", value: 22 },
19185
+ { name: "Jo\xE3o", value: 18 }
18728
19186
  ];
18729
19187
  const data = items ?? mockData;
18730
- const sortedData = [...data].sort(
18731
- (a, b) => order === "desc" ? b.percentage - a.percentage : a.percentage - b.percentage
18732
- );
18733
- const getBadgeColor = (pct) => {
18734
- if (pct >= 75) return "red";
18735
- if (pct >= 25) return "yellow";
19188
+ const sortedData = [...data].sort((a, b) => {
19189
+ const aValue = typeof a.value === "string" ? parseFloat(a.value) || a.value : a.value;
19190
+ const bValue = typeof b.value === "string" ? parseFloat(b.value) || b.value : b.value;
19191
+ if (typeof aValue === "number" && typeof bValue === "number") {
19192
+ return order === "desc" ? bValue - aValue : aValue - bValue;
19193
+ }
19194
+ if (typeof aValue === "string" && typeof bValue === "string") {
19195
+ return order === "desc" ? bValue.localeCompare(aValue) : aValue.localeCompare(bValue);
19196
+ }
19197
+ if (typeof aValue === "number") return order === "desc" ? -1 : 1;
19198
+ return order === "desc" ? 1 : -1;
19199
+ });
19200
+ const getBadgeColor = (value) => {
19201
+ const numValue = typeof value === "string" ? parseFloat(value) : value;
19202
+ if (isNaN(numValue)) return "green";
19203
+ if (numValue >= 75) return "red";
19204
+ if (numValue >= 25) return "yellow";
18736
19205
  return "green";
18737
19206
  };
18738
- return /* @__PURE__ */ jsxs78(
19207
+ return /* @__PURE__ */ jsxs79(
18739
19208
  "div",
18740
19209
  {
18741
19210
  className: `border rounded-xl flex flex-col max-h-80 w-96 ${className}`,
18742
19211
  children: [
18743
- /* @__PURE__ */ jsxs78("div", { className: "flex items-center justify-between p-4 border-b flex-shrink-0 gap-3", children: [
18744
- /* @__PURE__ */ jsx100("h2", { className: "text-lg font-semibold px-1", children: title }),
18745
- /* @__PURE__ */ jsx100(
19212
+ /* @__PURE__ */ jsxs79("div", { className: "flex items-center justify-between py-2 px-4 border-b flex-shrink-0 gap-3", children: [
19213
+ /* @__PURE__ */ jsx102("h2", { className: "text-lg font-semibold px-1", children: title }),
19214
+ /* @__PURE__ */ jsx102(
18746
19215
  ButtonBase,
18747
19216
  {
18748
19217
  size: "icon",
18749
19218
  variant: "ghost",
18750
19219
  onClick: () => setOrder(order === "desc" ? "asc" : "desc"),
18751
19220
  disabled: isLoading || sortedData.length === 0,
18752
- children: /* @__PURE__ */ jsx100(CaretUpDownIcon3, {})
19221
+ children: /* @__PURE__ */ jsx102(CaretUpDownIcon3, {})
18753
19222
  }
18754
19223
  )
18755
19224
  ] }),
18756
- /* @__PURE__ */ jsx100("div", { className: "overflow-y-auto flex-1", children: isLoading ? /* @__PURE__ */ jsx100("div", { className: "p-4 space-y-3", children: Array.from({ length: 5 }).map((_, idx) => /* @__PURE__ */ jsxs78("div", { className: "flex items-center justify-between p-1", children: [
18757
- /* @__PURE__ */ jsxs78("div", { className: "flex items-center gap-3 flex-1", children: [
18758
- /* @__PURE__ */ jsx100(SkeletonBase, { className: "w-8 h-8 rounded-full" }),
18759
- /* @__PURE__ */ jsx100(SkeletonBase, { className: "h-4 w-36" })
19225
+ /* @__PURE__ */ jsx102("div", { className: "overflow-y-auto flex-1", children: isLoading ? /* @__PURE__ */ jsx102("div", { className: "p-4 space-y-3", children: Array.from({ length: 5 }).map((_, idx) => /* @__PURE__ */ jsxs79("div", { className: "flex items-center justify-between p-1", children: [
19226
+ /* @__PURE__ */ jsxs79("div", { className: "flex items-center gap-3 flex-1", children: [
19227
+ /* @__PURE__ */ jsx102(SkeletonBase, { className: "w-8 h-8 rounded-full" }),
19228
+ /* @__PURE__ */ jsx102(SkeletonBase, { className: "h-4 w-36" })
18760
19229
  ] }),
18761
- /* @__PURE__ */ jsx100(SkeletonBase, { className: "h-6 w-12 rounded-full" })
18762
- ] }, idx)) }) : sortedData.length === 0 ? /* @__PURE__ */ jsx100("div", { className: "flex items-center justify-center h-full py-12", children: /* @__PURE__ */ jsx100("p", { className: "text-muted-foreground text-sm", children: "Sem dados dispon\xEDveis" }) }) : /* @__PURE__ */ jsx100("ul", { children: sortedData.map((item, idx) => /* @__PURE__ */ jsx100(
18763
- motion22.span,
18764
- {
18765
- initial: { opacity: 0, y: 10 },
18766
- animate: { opacity: 1, y: 0 },
18767
- transition: { delay: idx * 5e-3 },
18768
- children: /* @__PURE__ */ jsxs78("li", { className: "flex items-center justify-between py-3 border-b last:border-b-0 hover:bg-muted transition-colors px-4", children: [
18769
- /* @__PURE__ */ jsxs78("div", { className: "flex items-center gap-3", children: [
18770
- /* @__PURE__ */ jsx100("span", { className: "text-sm text-gray-400 w-6 h-6 border rounded-full text-center bg-muted/50", children: idx + 1 }),
18771
- /* @__PURE__ */ jsx100("span", { className: "font-medium", children: item.name })
18772
- ] }),
18773
- /* @__PURE__ */ jsxs78(
18774
- Badge,
18775
- {
18776
- color: getBadgeColor(item.percentage),
18777
- size: "md",
18778
- className: "font-bold",
18779
- children: [
18780
- item.percentage,
18781
- "%"
18782
- ]
18783
- }
18784
- )
18785
- ] })
18786
- },
18787
- idx
18788
- )) }) })
19230
+ /* @__PURE__ */ jsx102(SkeletonBase, { className: "h-6 w-12 rounded-full" })
19231
+ ] }, idx)) }) : sortedData.length === 0 ? /* @__PURE__ */ jsx102("div", { className: "flex items-center justify-center h-full py-12", children: /* @__PURE__ */ jsx102("p", { className: "text-muted-foreground text-sm", children: "Sem dados dispon\xEDveis" }) }) : /* @__PURE__ */ jsxs79("div", { children: [
19232
+ /* @__PURE__ */ jsxs79("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: [
19233
+ /* @__PURE__ */ jsx102("div", { className: "text-xs font-medium text-muted-foreground uppercase tracking-wider pl-1", children: legend?.[0]?.[0] ?? "Participante" }),
19234
+ /* @__PURE__ */ jsx102("div", { className: "text-xs font-medium text-muted-foreground uppercase tracking-wider", children: legend?.[0]?.[1] ?? "Pontua\xE7\xE3o" })
19235
+ ] }),
19236
+ /* @__PURE__ */ jsx102("ul", { children: sortedData.map((item, idx) => /* @__PURE__ */ jsx102(
19237
+ motion22.span,
19238
+ {
19239
+ initial: { opacity: 0, y: 10 },
19240
+ animate: { opacity: 1, y: 0 },
19241
+ transition: { delay: idx * 5e-3 },
19242
+ children: /* @__PURE__ */ jsxs79("li", { className: "flex items-center justify-between py-3 border-b last:border-b-0 hover:bg-muted transition-colors px-4", children: [
19243
+ /* @__PURE__ */ jsxs79("div", { className: "flex items-center gap-3", children: [
19244
+ /* @__PURE__ */ jsx102("span", { className: "text-sm text-gray-400 w-6 h-6 border rounded-full text-center bg-muted/50", children: idx + 1 }),
19245
+ /* @__PURE__ */ jsx102("span", { className: "font-medium", children: item.name })
19246
+ ] }),
19247
+ /* @__PURE__ */ jsx102(
19248
+ Badge,
19249
+ {
19250
+ color: getBadgeColor(item.value),
19251
+ size: "md",
19252
+ className: "font-bold",
19253
+ children: item.value
19254
+ }
19255
+ )
19256
+ ] })
19257
+ },
19258
+ idx
19259
+ )) })
19260
+ ] }) })
18789
19261
  ]
18790
19262
  }
18791
19263
  );
@@ -18821,6 +19293,7 @@ export {
18821
19293
  BreadcrumbListBase,
18822
19294
  BreadcrumbPageBase,
18823
19295
  BreadcrumbSeparatorBase,
19296
+ Brush_default as Brush,
18824
19297
  ButtonBase,
18825
19298
  ButtonGroupBase,
18826
19299
  CalendarBase,
@@ -19074,6 +19547,7 @@ export {
19074
19547
  ThemeProviderBase,
19075
19548
  TimePicker,
19076
19549
  TimePickerInput,
19550
+ TimeSeries_default as TimeSeries,
19077
19551
  Toaster,
19078
19552
  TooltipBase,
19079
19553
  TooltipContentBase,
@@ -19169,5 +19643,6 @@ export {
19169
19643
  useEventVisibilityAgenda,
19170
19644
  useIsMobile,
19171
19645
  useTheme,
19646
+ useTimeSeriesRange,
19172
19647
  visualForItem
19173
19648
  };