@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.css +149 -58
- package/dist/index.d.mts +93 -15
- package/dist/index.d.ts +93 -15
- package/dist/index.js +1401 -934
- package/dist/index.mjs +1465 -990
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -515,6 +515,7 @@ __export(index_exports, {
|
|
|
515
515
|
BreadcrumbListBase: () => BreadcrumbListBase,
|
|
516
516
|
BreadcrumbPageBase: () => BreadcrumbPageBase,
|
|
517
517
|
BreadcrumbSeparatorBase: () => BreadcrumbSeparatorBase,
|
|
518
|
+
Brush: () => Brush_default,
|
|
518
519
|
ButtonBase: () => ButtonBase,
|
|
519
520
|
ButtonGroupBase: () => ButtonGroupBase,
|
|
520
521
|
CalendarBase: () => CalendarBase,
|
|
@@ -768,6 +769,7 @@ __export(index_exports, {
|
|
|
768
769
|
ThemeProviderBase: () => ThemeProviderBase,
|
|
769
770
|
TimePicker: () => TimePicker,
|
|
770
771
|
TimePickerInput: () => TimePickerInput,
|
|
772
|
+
TimeSeries: () => TimeSeries_default,
|
|
771
773
|
Toaster: () => Toaster,
|
|
772
774
|
TooltipBase: () => TooltipBase,
|
|
773
775
|
TooltipContentBase: () => TooltipContentBase,
|
|
@@ -863,6 +865,7 @@ __export(index_exports, {
|
|
|
863
865
|
useEventVisibilityAgenda: () => useEventVisibilityAgenda,
|
|
864
866
|
useIsMobile: () => useIsMobile,
|
|
865
867
|
useTheme: () => useTheme,
|
|
868
|
+
useTimeSeriesRange: () => useTimeSeriesRange,
|
|
866
869
|
visualForItem: () => visualForItem
|
|
867
870
|
});
|
|
868
871
|
module.exports = __toCommonJS(index_exports);
|
|
@@ -1021,18 +1024,12 @@ var DialogContentBase = React2.forwardRef(
|
|
|
1021
1024
|
{
|
|
1022
1025
|
ref,
|
|
1023
1026
|
className: cn(
|
|
1024
|
-
"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-
|
|
1027
|
+
"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",
|
|
1025
1028
|
className
|
|
1026
1029
|
),
|
|
1027
1030
|
"data-testid": dataTestId,
|
|
1028
1031
|
...props,
|
|
1029
|
-
onWheel:
|
|
1030
|
-
try {
|
|
1031
|
-
userOnWheel?.(e);
|
|
1032
|
-
} finally {
|
|
1033
|
-
e.stopPropagation();
|
|
1034
|
-
}
|
|
1035
|
-
},
|
|
1032
|
+
onWheel: userOnWheel,
|
|
1036
1033
|
children: [
|
|
1037
1034
|
children,
|
|
1038
1035
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(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: [
|
|
@@ -1349,7 +1346,7 @@ var ProgressBase = React5.forwardRef(
|
|
|
1349
1346
|
default:
|
|
1350
1347
|
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "flex flex-col gap-1 w-full min-w-[150px]", children: [
|
|
1351
1348
|
label && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(LabelBase_default, { className: "py-2", children: label }),
|
|
1352
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
1349
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "flex items-center justify-between gap-2", children: [
|
|
1353
1350
|
showValue && valuePosition === "left" && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "w-12 text-sm text-right font-extrabold", children: [
|
|
1354
1351
|
Math.round(value || 0),
|
|
1355
1352
|
"%"
|
|
@@ -1561,45 +1558,55 @@ function SkeletonBase({
|
|
|
1561
1558
|
var import_react2 = require("@phosphor-icons/react");
|
|
1562
1559
|
var import_sonner = require("sonner");
|
|
1563
1560
|
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
1564
|
-
var iconBaseClass = "w-5 h-
|
|
1561
|
+
var iconBaseClass = "w-5 h-5";
|
|
1565
1562
|
var Toaster = ({ testId, ...props }) => {
|
|
1566
1563
|
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1567
1564
|
import_sonner.Toaster,
|
|
1568
1565
|
{
|
|
1569
1566
|
className: "toaster group",
|
|
1570
1567
|
position: "top-center",
|
|
1568
|
+
duration: 4e3,
|
|
1571
1569
|
toastOptions: {
|
|
1570
|
+
style: {
|
|
1571
|
+
backdropFilter: "blur(8px)",
|
|
1572
|
+
WebkitBackdropFilter: "blur(8px)"
|
|
1573
|
+
},
|
|
1572
1574
|
classNames: {
|
|
1573
1575
|
toast: `
|
|
1574
1576
|
group toast
|
|
1575
|
-
bg-background
|
|
1577
|
+
bg-background/95
|
|
1576
1578
|
text-foreground
|
|
1577
|
-
shadow-
|
|
1579
|
+
shadow-xl rounded-lg
|
|
1578
1580
|
border-l-4
|
|
1579
1581
|
border-border
|
|
1580
1582
|
flex items-center gap-3
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
data-[type=
|
|
1584
|
-
data-[type=
|
|
1583
|
+
transition-all duration-300
|
|
1584
|
+
hover:scale-[1.02] hover:shadow-2xl
|
|
1585
|
+
data-[type=success]:border-l-green-500 data-[type=success]:bg-green-50/95 data-[type=success]:text-green-800 data-[type=success]:border-green-500
|
|
1586
|
+
data-[type=error]:border-l-red-500 data-[type=error]:bg-red-50/95 data-[type=error]:text-red-800 data-[type=error]:border-red-500
|
|
1587
|
+
data-[type=warning]:border-l-yellow-500 data-[type=warning]:bg-yellow-50/95 data-[type=warning]:text-yellow-800 data-[type=warning]:border-yellow-500
|
|
1588
|
+
data-[type=info]:border-l-blue-500 data-[type=info]:bg-blue-50/95 data-[type=info]:text-blue-800 data-[type=info]:border-blue-500
|
|
1585
1589
|
`,
|
|
1586
1590
|
description: `
|
|
1587
|
-
text-
|
|
1591
|
+
text-xs
|
|
1592
|
+
font-semibold
|
|
1588
1593
|
group-[.toast]:text-neutral-600
|
|
1589
1594
|
`,
|
|
1590
1595
|
actionButton: `
|
|
1591
1596
|
ml-auto
|
|
1592
1597
|
rounded-md px-3 py-1 text-sm font-semibold
|
|
1593
1598
|
bg-neutral-800 text-white
|
|
1594
|
-
hover:bg-neutral-700
|
|
1595
|
-
transition-
|
|
1599
|
+
hover:bg-neutral-700 hover:scale-105
|
|
1600
|
+
transition-all duration-200
|
|
1601
|
+
active:scale-95
|
|
1596
1602
|
`,
|
|
1597
1603
|
cancelButton: `
|
|
1598
1604
|
ml-2
|
|
1599
1605
|
rounded-md px-3 py-1 text-sm font-semibold
|
|
1600
1606
|
bg-neutral-100 text-neutral-700
|
|
1601
|
-
hover:bg-neutral-200
|
|
1602
|
-
transition-
|
|
1607
|
+
hover:bg-neutral-200 hover:scale-105
|
|
1608
|
+
transition-all duration-200
|
|
1609
|
+
active:scale-95
|
|
1603
1610
|
`
|
|
1604
1611
|
}
|
|
1605
1612
|
},
|
|
@@ -1609,24 +1616,52 @@ var Toaster = ({ testId, ...props }) => {
|
|
|
1609
1616
|
);
|
|
1610
1617
|
};
|
|
1611
1618
|
var toast = {
|
|
1612
|
-
success: (message) => import_sonner.toast.success(message, {
|
|
1613
|
-
|
|
1619
|
+
success: (message, description) => import_sonner.toast.success(message, {
|
|
1620
|
+
description,
|
|
1621
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1622
|
+
import_react2.CheckCircleIcon,
|
|
1623
|
+
{
|
|
1624
|
+
className: `${iconBaseClass} text-green-600`,
|
|
1625
|
+
weight: "fill"
|
|
1626
|
+
}
|
|
1627
|
+
),
|
|
1614
1628
|
className: "sonner-success"
|
|
1615
1629
|
}),
|
|
1616
|
-
error: (message) => import_sonner.toast.error(message, {
|
|
1617
|
-
|
|
1630
|
+
error: (message, description) => import_sonner.toast.error(message, {
|
|
1631
|
+
description,
|
|
1632
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1633
|
+
import_react2.XCircleIcon,
|
|
1634
|
+
{
|
|
1635
|
+
className: `${iconBaseClass} text-red-600`,
|
|
1636
|
+
weight: "fill"
|
|
1637
|
+
}
|
|
1638
|
+
),
|
|
1618
1639
|
className: "sonner-error"
|
|
1619
1640
|
}),
|
|
1620
|
-
warning: (message) => import_sonner.toast.warning(message, {
|
|
1621
|
-
|
|
1622
|
-
|
|
1641
|
+
warning: (message, description) => import_sonner.toast.warning(message, {
|
|
1642
|
+
description,
|
|
1643
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1644
|
+
import_react2.WarningIcon,
|
|
1645
|
+
{
|
|
1646
|
+
className: `${iconBaseClass} text-yellow-600`,
|
|
1647
|
+
weight: "fill"
|
|
1648
|
+
}
|
|
1649
|
+
),
|
|
1650
|
+
className: "sonner-warning"
|
|
1623
1651
|
}),
|
|
1624
|
-
info: (message) => import_sonner.toast.info(message, {
|
|
1652
|
+
info: (message, description) => import_sonner.toast.info(message, {
|
|
1653
|
+
description,
|
|
1625
1654
|
icon: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_react2.InfoIcon, { className: `${iconBaseClass} text-blue-600`, weight: "fill" }),
|
|
1626
|
-
className: "sonner-
|
|
1655
|
+
className: "sonner-info"
|
|
1627
1656
|
}),
|
|
1628
|
-
loading: (message) => (0, import_sonner.toast)(message, {
|
|
1629
|
-
|
|
1657
|
+
loading: (message, description) => (0, import_sonner.toast)(message, {
|
|
1658
|
+
description,
|
|
1659
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1660
|
+
import_react2.CircleNotchIcon,
|
|
1661
|
+
{
|
|
1662
|
+
className: `${iconBaseClass} animate-spin text-gray-600`
|
|
1663
|
+
}
|
|
1664
|
+
),
|
|
1630
1665
|
className: "sonner-loading"
|
|
1631
1666
|
})
|
|
1632
1667
|
};
|
|
@@ -1774,12 +1809,21 @@ var TooltipTriggerBase = React7.forwardRef(({ children, onPointerDown, ...props
|
|
|
1774
1809
|
},
|
|
1775
1810
|
[onPointerDown]
|
|
1776
1811
|
);
|
|
1812
|
+
const onClick = React7.useCallback(
|
|
1813
|
+
(e) => {
|
|
1814
|
+
if (onPointerDown) {
|
|
1815
|
+
onPointerDown(e);
|
|
1816
|
+
}
|
|
1817
|
+
},
|
|
1818
|
+
[onPointerDown]
|
|
1819
|
+
);
|
|
1777
1820
|
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1778
1821
|
TooltipPrimitive.Trigger,
|
|
1779
1822
|
{
|
|
1780
1823
|
ref,
|
|
1781
1824
|
tabIndex: -1,
|
|
1782
1825
|
onPointerDown: onPointerDown ? handlePointerDown : void 0,
|
|
1826
|
+
onClick,
|
|
1783
1827
|
"data-tooltip-trigger": true,
|
|
1784
1828
|
"aria-describedby": "tooltip-content",
|
|
1785
1829
|
...props,
|
|
@@ -1944,7 +1988,7 @@ var ModalContentBase = React9.forwardRef(
|
|
|
1944
1988
|
ref,
|
|
1945
1989
|
className: cn(
|
|
1946
1990
|
"fixed z-50 grid w-full gap-4 border bg-background p-6 shadow-lg sm:rounded-lg max-h-[90dvh] overflow-auto",
|
|
1947
|
-
"data-[state=open]:animate-modal-in data-[state=closed]:animate-modal-out",
|
|
1991
|
+
"data-[state=open]:animate-modal-in data-[state=closed]:animate-modal-out border-border",
|
|
1948
1992
|
positionClass,
|
|
1949
1993
|
sizeClass,
|
|
1950
1994
|
className
|
|
@@ -2024,7 +2068,7 @@ var buttonVariantsBase = (0, import_class_variance_authority2.cva)(
|
|
|
2024
2068
|
variant: {
|
|
2025
2069
|
default: "bg-primary text-primary-foreground shadow-xs hover:bg-primary/90",
|
|
2026
2070
|
destructive: "bg-destructive text-white shadow-xs hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40",
|
|
2027
|
-
outline: "border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-background dark:border-input dark:hover:bg-background/95",
|
|
2071
|
+
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",
|
|
2028
2072
|
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",
|
|
2029
2073
|
secondary: "bg-secondary text-secondary-foreground shadow-xs hover:bg-secondary/80",
|
|
2030
2074
|
ghost: "hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",
|
|
@@ -2380,6 +2424,11 @@ var PopoverContentBase = React13.forwardRef(
|
|
|
2380
2424
|
className
|
|
2381
2425
|
),
|
|
2382
2426
|
"data-testid": dataTestId,
|
|
2427
|
+
onInteractOutside: (event) => {
|
|
2428
|
+
props.onInteractOutside?.(event);
|
|
2429
|
+
if (event.defaultPrevented) return;
|
|
2430
|
+
event.stopPropagation();
|
|
2431
|
+
},
|
|
2383
2432
|
...props
|
|
2384
2433
|
}
|
|
2385
2434
|
) })
|
|
@@ -2441,7 +2490,7 @@ function ComboboxBase({
|
|
|
2441
2490
|
testIds = {},
|
|
2442
2491
|
onClear,
|
|
2443
2492
|
hasSelected = false,
|
|
2444
|
-
|
|
2493
|
+
hideClear = false
|
|
2445
2494
|
}) {
|
|
2446
2495
|
const [open, setOpen] = (0, import_react9.useState)(false);
|
|
2447
2496
|
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
|
|
@@ -2455,13 +2504,13 @@ function ComboboxBase({
|
|
|
2455
2504
|
{
|
|
2456
2505
|
open,
|
|
2457
2506
|
onOpenChange: (v) => !disabled && setOpen(v),
|
|
2458
|
-
modal:
|
|
2507
|
+
modal: false,
|
|
2459
2508
|
children: [
|
|
2460
2509
|
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
2461
2510
|
PopoverTriggerBase,
|
|
2462
2511
|
{
|
|
2463
2512
|
asChild: true,
|
|
2464
|
-
className: "flex w-full justify-between dark:bg-[hsl(231,15%,19%)]",
|
|
2513
|
+
className: "flex w-full justify-between dark:bg-[hsl(231,15%,19%)] p-3",
|
|
2465
2514
|
children: /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
|
|
2466
2515
|
ButtonBase,
|
|
2467
2516
|
{
|
|
@@ -2479,19 +2528,17 @@ function ComboboxBase({
|
|
|
2479
2528
|
children: [
|
|
2480
2529
|
renderSelected,
|
|
2481
2530
|
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_framer_motion2.motion.span, { className: "flex items-center", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "flex flex-row gap-0 items-center ", children: [
|
|
2482
|
-
hasSelected && onClear && !disabled &&
|
|
2483
|
-
|
|
2484
|
-
|
|
2485
|
-
{
|
|
2486
|
-
|
|
2487
|
-
|
|
2488
|
-
|
|
2489
|
-
|
|
2490
|
-
if (!keepOpen) setOpen(false);
|
|
2491
|
-
}
|
|
2531
|
+
hasSelected && onClear && !disabled && !hideClear && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
2532
|
+
ClearButton,
|
|
2533
|
+
{
|
|
2534
|
+
onClick: (e) => {
|
|
2535
|
+
if (e) e.stopPropagation();
|
|
2536
|
+
if (onClear && !disabled) {
|
|
2537
|
+
onClear();
|
|
2538
|
+
if (!keepOpen) setOpen(false);
|
|
2492
2539
|
}
|
|
2493
2540
|
}
|
|
2494
|
-
|
|
2541
|
+
}
|
|
2495
2542
|
),
|
|
2496
2543
|
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
2497
2544
|
import_framer_motion2.motion.div,
|
|
@@ -2607,7 +2654,8 @@ function Combobox({
|
|
|
2607
2654
|
label,
|
|
2608
2655
|
labelClassname,
|
|
2609
2656
|
testIds,
|
|
2610
|
-
error
|
|
2657
|
+
error,
|
|
2658
|
+
hideClear = false
|
|
2611
2659
|
}) {
|
|
2612
2660
|
const selectedItem = items.find((item) => item.value === selected);
|
|
2613
2661
|
const renderSelected = (0, import_react11.useMemo)(() => {
|
|
@@ -2653,7 +2701,8 @@ function Combobox({
|
|
|
2653
2701
|
testIds,
|
|
2654
2702
|
onClear: handleClear,
|
|
2655
2703
|
isMulti: false,
|
|
2656
|
-
hasSelected: !!selectedItem
|
|
2704
|
+
hasSelected: !!selectedItem,
|
|
2705
|
+
hideClear
|
|
2657
2706
|
}
|
|
2658
2707
|
)
|
|
2659
2708
|
] });
|
|
@@ -2728,14 +2777,19 @@ function MultiSelectBase({
|
|
|
2728
2777
|
onValuesChange,
|
|
2729
2778
|
disabled,
|
|
2730
2779
|
empty,
|
|
2731
|
-
error
|
|
2780
|
+
error,
|
|
2781
|
+
initialItems
|
|
2732
2782
|
}) {
|
|
2733
2783
|
const [open, setOpen] = (0, import_react13.useState)(false);
|
|
2734
2784
|
const [internalValues, setInternalValues] = (0, import_react13.useState)(
|
|
2735
2785
|
new Set(values ?? defaultValues)
|
|
2736
2786
|
);
|
|
2737
2787
|
const selectedValues = values ? new Set(values) : internalValues;
|
|
2738
|
-
const [items, setItems] = (0, import_react13.useState)(
|
|
2788
|
+
const [items, setItems] = (0, import_react13.useState)(() => {
|
|
2789
|
+
if (!initialItems) return /* @__PURE__ */ new Map();
|
|
2790
|
+
if (initialItems instanceof Map) return new Map(initialItems);
|
|
2791
|
+
return new Map(initialItems.map((it) => [it.value, it.label]));
|
|
2792
|
+
});
|
|
2739
2793
|
function toggleValue(value) {
|
|
2740
2794
|
if (disabled) return;
|
|
2741
2795
|
const getNewSet = (prev) => {
|
|
@@ -2951,41 +3005,48 @@ function MultiSelectContentBase({
|
|
|
2951
3005
|
...props
|
|
2952
3006
|
}) {
|
|
2953
3007
|
const canSearch = typeof search === "object" ? true : search;
|
|
2954
|
-
const { emptyMessage, items } = useMultiSelectContext();
|
|
2955
|
-
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_jsx_runtime20.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
2956
|
-
|
|
3008
|
+
const { emptyMessage, items, open } = useMultiSelectContext();
|
|
3009
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_jsx_runtime20.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
3010
|
+
PopoverContentBase,
|
|
2957
3011
|
{
|
|
2958
|
-
|
|
2959
|
-
|
|
2960
|
-
|
|
2961
|
-
|
|
2962
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: cn(" "), children: /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
|
|
2963
|
-
CommandBase,
|
|
3012
|
+
forceMount: true,
|
|
3013
|
+
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",
|
|
3014
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
3015
|
+
import_framer_motion3.motion.div,
|
|
2964
3016
|
{
|
|
2965
|
-
|
|
2966
|
-
|
|
2967
|
-
|
|
2968
|
-
|
|
2969
|
-
|
|
2970
|
-
|
|
2971
|
-
|
|
2972
|
-
|
|
2973
|
-
|
|
2974
|
-
|
|
2975
|
-
|
|
2976
|
-
|
|
2977
|
-
|
|
2978
|
-
|
|
2979
|
-
|
|
2980
|
-
|
|
2981
|
-
|
|
2982
|
-
|
|
2983
|
-
|
|
2984
|
-
|
|
3017
|
+
initial: { opacity: 0, scale: 0.95 },
|
|
3018
|
+
animate: { opacity: open ? 1 : 0, scale: open ? 1 : 0.95 },
|
|
3019
|
+
transition: { duration: 0.2 },
|
|
3020
|
+
style: { pointerEvents: open ? "auto" : "none" },
|
|
3021
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: cn(" "), children: /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
|
|
3022
|
+
CommandBase,
|
|
3023
|
+
{
|
|
3024
|
+
...props,
|
|
3025
|
+
filter: (value, search2) => {
|
|
3026
|
+
const labelNode = items.get(value);
|
|
3027
|
+
const label = typeof labelNode === "string" ? labelNode : value;
|
|
3028
|
+
if (label.toLowerCase().includes(search2.toLowerCase()))
|
|
3029
|
+
return 1;
|
|
3030
|
+
return 0;
|
|
3031
|
+
},
|
|
3032
|
+
children: [
|
|
3033
|
+
canSearch ? /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
3034
|
+
CommandInputBase,
|
|
3035
|
+
{
|
|
3036
|
+
placeholder: typeof search === "object" ? search.placeholder : void 0
|
|
3037
|
+
}
|
|
3038
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("button", { autoFocus: true, className: "sr-only" }),
|
|
3039
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(CommandListBase, { children: [
|
|
3040
|
+
canSearch && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(CommandEmptyBase, { children: typeof search === "object" ? search.emptyMessage ?? emptyMessage : emptyMessage }),
|
|
3041
|
+
children
|
|
3042
|
+
] })
|
|
3043
|
+
]
|
|
3044
|
+
}
|
|
3045
|
+
) })
|
|
2985
3046
|
}
|
|
2986
|
-
)
|
|
3047
|
+
)
|
|
2987
3048
|
}
|
|
2988
|
-
) })
|
|
3049
|
+
) });
|
|
2989
3050
|
}
|
|
2990
3051
|
function MultiSelectItemBase({
|
|
2991
3052
|
value,
|
|
@@ -3087,6 +3148,7 @@ function MultiCombobox({
|
|
|
3087
3148
|
disabled,
|
|
3088
3149
|
empty,
|
|
3089
3150
|
error,
|
|
3151
|
+
initialItems: items,
|
|
3090
3152
|
children: [
|
|
3091
3153
|
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
3092
3154
|
MultiSelectTriggerBase,
|
|
@@ -3127,8 +3189,7 @@ function MultiCombobox({
|
|
|
3127
3189
|
)
|
|
3128
3190
|
]
|
|
3129
3191
|
}
|
|
3130
|
-
)
|
|
3131
|
-
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ErrorMessage_default, { error })
|
|
3192
|
+
)
|
|
3132
3193
|
]
|
|
3133
3194
|
}
|
|
3134
3195
|
);
|
|
@@ -3208,6 +3269,11 @@ var SelectContentBase = React14.forwardRef(
|
|
|
3208
3269
|
),
|
|
3209
3270
|
position,
|
|
3210
3271
|
"data-testid": dataTestId,
|
|
3272
|
+
onPointerDownOutside: (event) => {
|
|
3273
|
+
props.onPointerDownOutside?.(event);
|
|
3274
|
+
if (event.defaultPrevented) return;
|
|
3275
|
+
event.stopPropagation();
|
|
3276
|
+
},
|
|
3211
3277
|
...props,
|
|
3212
3278
|
asChild: true,
|
|
3213
3279
|
children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
@@ -3356,7 +3422,7 @@ var DropDownMenuContentBase = React15.forwardRef(
|
|
|
3356
3422
|
exit: { opacity: 0, scale: 0.95, y: 5 },
|
|
3357
3423
|
transition: { duration: 0.2, ease: "easeOut" },
|
|
3358
3424
|
className: cn(
|
|
3359
|
-
"min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md",
|
|
3425
|
+
"min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md border-border",
|
|
3360
3426
|
className
|
|
3361
3427
|
),
|
|
3362
3428
|
children: props.children
|
|
@@ -3540,35 +3606,13 @@ function ModeToggleBase({
|
|
|
3540
3606
|
setTheme(newTheme);
|
|
3541
3607
|
return;
|
|
3542
3608
|
}
|
|
3543
|
-
const
|
|
3544
|
-
const rect = button.getBoundingClientRect();
|
|
3609
|
+
const rect = buttonRef.current.getBoundingClientRect();
|
|
3545
3610
|
const x = rect.left + rect.width / 2;
|
|
3546
3611
|
const y = rect.top + rect.height / 2;
|
|
3547
3612
|
const endRadius = Math.hypot(
|
|
3548
3613
|
Math.max(x, window.innerWidth - x),
|
|
3549
3614
|
Math.max(y, window.innerHeight - y)
|
|
3550
3615
|
);
|
|
3551
|
-
const styleId = "theme-transition-styles";
|
|
3552
|
-
if (!document.getElementById(styleId)) {
|
|
3553
|
-
const style = document.createElement("style");
|
|
3554
|
-
style.id = styleId;
|
|
3555
|
-
style.textContent = `
|
|
3556
|
-
::view-transition-old(root),
|
|
3557
|
-
::view-transition-new(root) {
|
|
3558
|
-
animation: none;
|
|
3559
|
-
mix-blend-mode: normal;
|
|
3560
|
-
}
|
|
3561
|
-
|
|
3562
|
-
::view-transition-old(root) {
|
|
3563
|
-
z-index: 1;
|
|
3564
|
-
}
|
|
3565
|
-
|
|
3566
|
-
::view-transition-new(root) {
|
|
3567
|
-
z-index: 2;
|
|
3568
|
-
}
|
|
3569
|
-
`;
|
|
3570
|
-
document.head.appendChild(style);
|
|
3571
|
-
}
|
|
3572
3616
|
const transition = document.startViewTransition(async () => {
|
|
3573
3617
|
setTheme(newTheme);
|
|
3574
3618
|
});
|
|
@@ -3576,14 +3620,14 @@ function ModeToggleBase({
|
|
|
3576
3620
|
document.documentElement.animate(
|
|
3577
3621
|
[
|
|
3578
3622
|
{
|
|
3579
|
-
clipPath: `circle(
|
|
3623
|
+
clipPath: `circle(0px at ${x}px ${y}px)`
|
|
3580
3624
|
},
|
|
3581
3625
|
{
|
|
3582
3626
|
clipPath: `circle(${Math.ceil(endRadius)}px at ${x}px ${y}px)`
|
|
3583
3627
|
}
|
|
3584
3628
|
],
|
|
3585
3629
|
{
|
|
3586
|
-
duration:
|
|
3630
|
+
duration: 400,
|
|
3587
3631
|
easing: "cubic-bezier(0.4, 0, 0.2, 1)",
|
|
3588
3632
|
pseudoElement: "::view-transition-new(root)"
|
|
3589
3633
|
}
|
|
@@ -3743,7 +3787,7 @@ var CardBase = React17.forwardRef(({ className, testid: dataTestId = "card-base"
|
|
|
3743
3787
|
{
|
|
3744
3788
|
ref,
|
|
3745
3789
|
className: cn(
|
|
3746
|
-
"rounded-xl border bg-card text-card-foreground shadow",
|
|
3790
|
+
"rounded-xl border border-border bg-card text-card-foreground shadow",
|
|
3747
3791
|
className
|
|
3748
3792
|
),
|
|
3749
3793
|
"data-testid": dataTestId,
|
|
@@ -7911,7 +7955,7 @@ function CalendarBase2({
|
|
|
7911
7955
|
"div",
|
|
7912
7956
|
{
|
|
7913
7957
|
className: cn(
|
|
7914
|
-
"rounded-md border
|
|
7958
|
+
"rounded-md border p-3 overflow-hidden flex flex-col",
|
|
7915
7959
|
className
|
|
7916
7960
|
),
|
|
7917
7961
|
children: /* @__PURE__ */ (0, import_jsx_runtime57.jsx)("div", { className: "relative flex-1 flex flex-col min-h-0", children: /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
|
|
@@ -7932,12 +7976,12 @@ function CalendarBase2({
|
|
|
7932
7976
|
button_previous: cn(
|
|
7933
7977
|
buttonVariantsBase({ variant: "outline" }),
|
|
7934
7978
|
"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",
|
|
7935
|
-
isMobile ? "
|
|
7979
|
+
isMobile ? "" : ""
|
|
7936
7980
|
),
|
|
7937
7981
|
button_next: cn(
|
|
7938
7982
|
buttonVariantsBase({ variant: "outline" }),
|
|
7939
7983
|
"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",
|
|
7940
|
-
isMobile ? "
|
|
7984
|
+
isMobile ? "" : ""
|
|
7941
7985
|
),
|
|
7942
7986
|
month_grid: "w-full min-w-0 flex-1 grid grid-rows-[auto_1fr] gap-2",
|
|
7943
7987
|
weekdays: "grid grid-cols-7 gap-1 mb-1",
|
|
@@ -7957,8 +8001,8 @@ function CalendarBase2({
|
|
|
7957
8001
|
),
|
|
7958
8002
|
selected: "bg-primary text-primary-foreground hover:bg-primary/90 focus:bg-primary/90 font-semibold hover:text-white rounded-md",
|
|
7959
8003
|
today: "bg-muted text-foreground font-bold ring-2 ring-primary/30 ring-inset rounded-md",
|
|
7960
|
-
outside: "text-muted-foreground
|
|
7961
|
-
disabled: "text-muted-foreground
|
|
8004
|
+
outside: "text-muted-foreground opacity-60 aria-selected:bg-muted/50 aria-selected:text-foreground",
|
|
8005
|
+
disabled: "text-muted-foreground cursor-not-allowed",
|
|
7962
8006
|
range_middle: "aria-selected:bg-muted aria-selected:text-foreground",
|
|
7963
8007
|
hidden: "invisible",
|
|
7964
8008
|
...classNames
|
|
@@ -7988,29 +8032,19 @@ var import_react46 = require("@phosphor-icons/react");
|
|
|
7988
8032
|
// src/components/ui/picker/TimeScrollPicker.tsx
|
|
7989
8033
|
var import_react43 = require("react");
|
|
7990
8034
|
var import_jsx_runtime58 = require("react/jsx-runtime");
|
|
7991
|
-
var ITEM_HEIGHT =
|
|
7992
|
-
var ITEM_HEIGHT_MOBILE = 32;
|
|
8035
|
+
var ITEM_HEIGHT = 38.5;
|
|
7993
8036
|
var VISIBLE_ITEMS = 5;
|
|
7994
|
-
var VISIBLE_ITEMS_MOBILE = 3;
|
|
7995
8037
|
var CENTER_INDEX = Math.floor(VISIBLE_ITEMS / 2);
|
|
7996
|
-
|
|
7997
|
-
function ScrollColumn({
|
|
7998
|
-
value,
|
|
7999
|
-
onChange,
|
|
8000
|
-
max,
|
|
8001
|
-
label,
|
|
8002
|
-
hideSeconds
|
|
8003
|
-
}) {
|
|
8004
|
-
const isMobile = useIsMobile();
|
|
8038
|
+
function ScrollColumn({ value, onChange, max, label }) {
|
|
8005
8039
|
const containerRef = (0, import_react43.useRef)(null);
|
|
8006
8040
|
const items = Array.from({ length: max }, (_, i) => i);
|
|
8007
8041
|
const [isDragging, setIsDragging] = (0, import_react43.useState)(false);
|
|
8008
8042
|
const [startY, setStartY] = (0, import_react43.useState)(0);
|
|
8009
8043
|
const [scrollTop, setScrollTop] = (0, import_react43.useState)(0);
|
|
8010
8044
|
const scrollTimeoutRef = (0, import_react43.useRef)(null);
|
|
8011
|
-
const itemHeight =
|
|
8012
|
-
const centerIndex =
|
|
8013
|
-
const visibleItems =
|
|
8045
|
+
const itemHeight = ITEM_HEIGHT;
|
|
8046
|
+
const centerIndex = CENTER_INDEX;
|
|
8047
|
+
const visibleItems = VISIBLE_ITEMS;
|
|
8014
8048
|
const containerHeight = visibleItems * itemHeight;
|
|
8015
8049
|
(0, import_react43.useEffect)(() => {
|
|
8016
8050
|
if (containerRef.current && !isDragging) {
|
|
@@ -8029,7 +8063,9 @@ function ScrollColumn({
|
|
|
8029
8063
|
}
|
|
8030
8064
|
};
|
|
8031
8065
|
}, []);
|
|
8032
|
-
const handleScroll = () => {
|
|
8066
|
+
const handleScroll = (e) => {
|
|
8067
|
+
e.stopPropagation();
|
|
8068
|
+
e.preventDefault();
|
|
8033
8069
|
if (!containerRef.current || isDragging) return;
|
|
8034
8070
|
if (scrollTimeoutRef.current) clearTimeout(scrollTimeoutRef.current);
|
|
8035
8071
|
scrollTimeoutRef.current = setTimeout(() => {
|
|
@@ -8067,15 +8103,18 @@ function ScrollColumn({
|
|
|
8067
8103
|
const handleMouseLeave = () => {
|
|
8068
8104
|
if (isDragging) handleMouseUp();
|
|
8069
8105
|
};
|
|
8070
|
-
const
|
|
8071
|
-
|
|
8072
|
-
|
|
8073
|
-
|
|
8106
|
+
const handleWheel = (e) => {
|
|
8107
|
+
e.stopPropagation();
|
|
8108
|
+
};
|
|
8109
|
+
return /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)("div", { className: "flex flex-col items-center", children: [
|
|
8110
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)("span", { className: "text-muted-foreground rounded-md font-semibold text-sm sm:text-sm text-center pb-2 uppercase tracking-wider", children: label }),
|
|
8111
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)("div", { className: cn("relative w-20 sm:w-16"), children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
8074
8112
|
"div",
|
|
8075
8113
|
{
|
|
8076
8114
|
ref: containerRef,
|
|
8077
|
-
className: "overflow-y-auto [&::-webkit-scrollbar]:hidden [-ms-overflow-style:none] [scrollbar-width:none]",
|
|
8115
|
+
className: "overflow-y-auto [&::-webkit-scrollbar]:hidden [-ms-overflow-style:none] [scrollbar-width:none] touch-action-pan-y",
|
|
8078
8116
|
onScroll: handleScroll,
|
|
8117
|
+
onWheel: handleWheel,
|
|
8079
8118
|
onMouseDown: handleMouseDown,
|
|
8080
8119
|
onMouseMove: handleMouseMove,
|
|
8081
8120
|
onMouseUp: handleMouseUp,
|
|
@@ -8092,9 +8131,9 @@ function ScrollColumn({
|
|
|
8092
8131
|
"div",
|
|
8093
8132
|
{
|
|
8094
8133
|
className: cn(
|
|
8095
|
-
"flex items-center justify-center select-none font-semibold tabular-nums",
|
|
8134
|
+
"flex items-center justify-center select-none font-semibold tabular-nums transition-all duration-150",
|
|
8096
8135
|
isDragging ? "cursor-grabbing" : "",
|
|
8097
|
-
isSelected ? "
|
|
8136
|
+
isSelected ? "text-lg sm:text-xl text-foreground scale-110" : "text-sm sm:text-base text-muted-foreground opacity-60"
|
|
8098
8137
|
),
|
|
8099
8138
|
style: { height: `${itemHeight}px` },
|
|
8100
8139
|
onClick: () => !isDragging && onChange(item),
|
|
@@ -8112,10 +8151,9 @@ function TimeScrollPicker({
|
|
|
8112
8151
|
setDate,
|
|
8113
8152
|
hideSeconds = false
|
|
8114
8153
|
}) {
|
|
8115
|
-
const isMobile = useIsMobile();
|
|
8116
8154
|
const currentDate = date || /* @__PURE__ */ new Date();
|
|
8117
|
-
const itemHeight =
|
|
8118
|
-
const centerIndex =
|
|
8155
|
+
const itemHeight = ITEM_HEIGHT;
|
|
8156
|
+
const centerIndex = CENTER_INDEX;
|
|
8119
8157
|
const handleTimeChange = (type, value) => {
|
|
8120
8158
|
const newDate = new Date(currentDate);
|
|
8121
8159
|
if (type === "hours") newDate.setHours(value);
|
|
@@ -8123,13 +8161,13 @@ function TimeScrollPicker({
|
|
|
8123
8161
|
else newDate.setSeconds(value);
|
|
8124
8162
|
setDate(newDate);
|
|
8125
8163
|
};
|
|
8126
|
-
return /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("div", { className: "flex items-center justify-center gap-2 p-3", children: /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)("div", { className: cn("relative flex gap-
|
|
8164
|
+
return /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("div", { className: "flex items-center justify-center gap-2 p-3 sm:p-4", children: /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)("div", { className: cn("relative flex gap-4 sm:gap-3"), children: [
|
|
8127
8165
|
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
8128
8166
|
"div",
|
|
8129
8167
|
{
|
|
8130
|
-
className: "absolute left-0 right-0
|
|
8168
|
+
className: "absolute left-0 right-0 pointer-events-none z-10 rounded-lg bg-primary/10 border border-primary/20",
|
|
8131
8169
|
style: {
|
|
8132
|
-
top: `calc(1.
|
|
8170
|
+
top: `calc(1.85rem + ${centerIndex * itemHeight}px)`,
|
|
8133
8171
|
height: `${itemHeight}px`
|
|
8134
8172
|
}
|
|
8135
8173
|
}
|
|
@@ -8217,12 +8255,17 @@ function DateTimePicker({
|
|
|
8217
8255
|
}) {
|
|
8218
8256
|
const [internalDate, setInternalDate] = (0, import_react45.useState)(date);
|
|
8219
8257
|
const [open, setOpen] = (0, import_react45.useState)(false);
|
|
8258
|
+
const [activeTab, setActiveTab] = (0, import_react45.useState)("calendar");
|
|
8220
8259
|
const isMobile = useIsMobile();
|
|
8221
8260
|
const handleSelect = (newDay) => {
|
|
8222
8261
|
if (!newDay) return;
|
|
8223
8262
|
if (!internalDate) {
|
|
8224
8263
|
const now = /* @__PURE__ */ new Date();
|
|
8225
|
-
newDay.
|
|
8264
|
+
newDay.setUTCHours(
|
|
8265
|
+
now.getUTCHours(),
|
|
8266
|
+
now.getUTCMinutes(),
|
|
8267
|
+
now.getUTCSeconds()
|
|
8268
|
+
);
|
|
8226
8269
|
setInternalDate(newDay);
|
|
8227
8270
|
onChange?.(newDay);
|
|
8228
8271
|
return;
|
|
@@ -8235,7 +8278,6 @@ function DateTimePicker({
|
|
|
8235
8278
|
};
|
|
8236
8279
|
const handleTimeChange = (newDate) => {
|
|
8237
8280
|
setInternalDate(newDate);
|
|
8238
|
-
onChange?.(newDate);
|
|
8239
8281
|
};
|
|
8240
8282
|
const getTimeFormat = () => {
|
|
8241
8283
|
if (hideTime) return "";
|
|
@@ -8252,6 +8294,9 @@ function DateTimePicker({
|
|
|
8252
8294
|
};
|
|
8253
8295
|
(0, import_react45.useEffect)(() => {
|
|
8254
8296
|
setInternalDate(date);
|
|
8297
|
+
if (open) {
|
|
8298
|
+
setActiveTab("calendar");
|
|
8299
|
+
}
|
|
8255
8300
|
}, [date, open]);
|
|
8256
8301
|
const { ref: contentRef, center } = use_auto_center_default(open);
|
|
8257
8302
|
const basePopoverClass = "w-auto max-w-[calc(100vw-16px)] p-0 border-none shadow-none";
|
|
@@ -8291,12 +8336,55 @@ function DateTimePicker({
|
|
|
8291
8336
|
]
|
|
8292
8337
|
}
|
|
8293
8338
|
);
|
|
8294
|
-
const renderPickerContent = () => /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)("div", { className: "p-3 border rounded-md", children: [
|
|
8295
|
-
/* @__PURE__ */ (0, import_jsx_runtime59.jsxs)(
|
|
8339
|
+
const renderPickerContent = () => /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)("div", { className: "p-2 sm:p-3 border border-border rounded-md", children: [
|
|
8340
|
+
isMobile && !hideTime ? /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)("div", { className: "min-h-[380px] max-h-[calc(400px)]", children: [
|
|
8341
|
+
internalDate && /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("div", { className: "flex items-center gap-3 px-4 py-3 rounded-lg ", children: /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)("span", { className: "text-md font-semibold", children: [
|
|
8342
|
+
(0, import_date_fns.format)(internalDate, "dd 'de' MMMM 'de' yyyy", {
|
|
8343
|
+
locale: import_locale2.ptBR
|
|
8344
|
+
}),
|
|
8345
|
+
" ",
|
|
8346
|
+
"- ",
|
|
8347
|
+
(0, import_date_fns.format)(internalDate, hideSeconds ? "HH:mm" : "HH:mm:ss")
|
|
8348
|
+
] }) }),
|
|
8349
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsxs)(TabsBase, { value: activeTab, onValueChange: setActiveTab, children: [
|
|
8350
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsxs)(TabsListBase, { className: "", children: [
|
|
8351
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)(TabsTriggerBase, { value: "calendar", className: "flex-1", children: "Data" }),
|
|
8352
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)(TabsTriggerBase, { value: "time", className: "flex-1", children: "Hor\xE1rio" })
|
|
8353
|
+
] }),
|
|
8354
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)(TabsContentBase, { value: "calendar", className: "mt-0", children: /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
|
|
8355
|
+
CalendarBase2,
|
|
8356
|
+
{
|
|
8357
|
+
mode: "single",
|
|
8358
|
+
locale: import_locale2.ptBR,
|
|
8359
|
+
selected: internalDate ?? void 0,
|
|
8360
|
+
onSelect: (d) => handleSelect(d ?? null),
|
|
8361
|
+
autoFocus: true,
|
|
8362
|
+
defaultMonth: fromDate ?? toDate ?? internalDate ?? void 0,
|
|
8363
|
+
...fromDate && { startMonth: fromDate },
|
|
8364
|
+
...toDate && { endMonth: toDate },
|
|
8365
|
+
...fromDate || toDate ? {
|
|
8366
|
+
disabled: [
|
|
8367
|
+
...fromDate ? [{ before: fromDate }] : [],
|
|
8368
|
+
...toDate ? [{ after: toDate }] : []
|
|
8369
|
+
]
|
|
8370
|
+
} : {},
|
|
8371
|
+
className: cn("w-full rounded-none border-none")
|
|
8372
|
+
}
|
|
8373
|
+
) }),
|
|
8374
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)(TabsContentBase, { value: "time", className: "mt-0", children: /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("div", { className: "flex flex-col items-center justify-center gap-4 py-2 min-h-[330px]", children: /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
|
|
8375
|
+
TimeScrollPicker,
|
|
8376
|
+
{
|
|
8377
|
+
setDate: (d) => handleTimeChange(d ?? null),
|
|
8378
|
+
date: internalDate,
|
|
8379
|
+
hideSeconds
|
|
8380
|
+
}
|
|
8381
|
+
) }) })
|
|
8382
|
+
] })
|
|
8383
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)(
|
|
8296
8384
|
"div",
|
|
8297
8385
|
{
|
|
8298
8386
|
ref: contentRef,
|
|
8299
|
-
className: "flex sm:flex-row max-h-auto overflow-y-auto border-none rounded-md",
|
|
8387
|
+
className: "flex flex-col sm:flex-row max-h-auto overflow-y-auto border-none rounded-md",
|
|
8300
8388
|
children: [
|
|
8301
8389
|
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
|
|
8302
8390
|
CalendarBase2,
|
|
@@ -8310,15 +8398,14 @@ function DateTimePicker({
|
|
|
8310
8398
|
...fromDate && { startMonth: fromDate },
|
|
8311
8399
|
...toDate && { endMonth: toDate },
|
|
8312
8400
|
...fromDate || toDate ? {
|
|
8313
|
-
|
|
8401
|
+
disabled: [
|
|
8314
8402
|
...fromDate ? [{ before: fromDate }] : [],
|
|
8315
8403
|
...toDate ? [{ after: toDate }] : []
|
|
8316
8404
|
]
|
|
8317
8405
|
} : {},
|
|
8318
8406
|
className: cn(
|
|
8319
8407
|
"w-max rounded-none border-none",
|
|
8320
|
-
!hideTime && "sm:rounded-r-none
|
|
8321
|
-
isMobile ? "border-b-transparent w-full" : ""
|
|
8408
|
+
!hideTime && "sm:rounded-r-none"
|
|
8322
8409
|
)
|
|
8323
8410
|
}
|
|
8324
8411
|
),
|
|
@@ -8327,7 +8414,7 @@ function DateTimePicker({
|
|
|
8327
8414
|
{
|
|
8328
8415
|
className: cn(
|
|
8329
8416
|
"flex flex-col items-center justify-center",
|
|
8330
|
-
|
|
8417
|
+
"border-l"
|
|
8331
8418
|
),
|
|
8332
8419
|
children: [
|
|
8333
8420
|
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)("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" }),
|
|
@@ -8345,60 +8432,61 @@ function DateTimePicker({
|
|
|
8345
8432
|
]
|
|
8346
8433
|
}
|
|
8347
8434
|
),
|
|
8348
|
-
/* @__PURE__ */ (0, import_jsx_runtime59.
|
|
8349
|
-
/* @__PURE__ */ (0, import_jsx_runtime59.
|
|
8350
|
-
|
|
8351
|
-
|
|
8352
|
-
|
|
8353
|
-
|
|
8354
|
-
|
|
8355
|
-
|
|
8356
|
-
|
|
8357
|
-
|
|
8358
|
-
|
|
8359
|
-
|
|
8360
|
-
now.
|
|
8361
|
-
now.
|
|
8362
|
-
now.
|
|
8435
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsxs)("div", { className: "flex rounded-md p-1.5 gap-2", children: [
|
|
8436
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
|
|
8437
|
+
ButtonBase,
|
|
8438
|
+
{
|
|
8439
|
+
variant: "outline",
|
|
8440
|
+
className: "no-active-animation",
|
|
8441
|
+
tooltip: "Hoje",
|
|
8442
|
+
size: "icon",
|
|
8443
|
+
onClick: () => {
|
|
8444
|
+
const now = /* @__PURE__ */ new Date();
|
|
8445
|
+
const selected = hideTime ? new Date(
|
|
8446
|
+
Date.UTC(
|
|
8447
|
+
now.getUTCFullYear(),
|
|
8448
|
+
now.getUTCMonth(),
|
|
8449
|
+
now.getUTCDate(),
|
|
8363
8450
|
0,
|
|
8364
8451
|
0,
|
|
8365
8452
|
0,
|
|
8366
8453
|
0
|
|
8367
|
-
)
|
|
8368
|
-
|
|
8369
|
-
|
|
8370
|
-
|
|
8371
|
-
|
|
8372
|
-
|
|
8373
|
-
}
|
|
8374
|
-
|
|
8454
|
+
)
|
|
8455
|
+
) : now;
|
|
8456
|
+
setInternalDate(selected);
|
|
8457
|
+
onChange?.(selected);
|
|
8458
|
+
onConfirm?.(selected);
|
|
8459
|
+
},
|
|
8460
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(import_react46.CalendarDotIcon, { className: "h-4 w-4" })
|
|
8461
|
+
}
|
|
8462
|
+
),
|
|
8463
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsxs)("div", { className: "grid grid-cols-2 sm:flex-row w-full gap-2", children: [
|
|
8375
8464
|
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
|
|
8376
8465
|
ButtonBase,
|
|
8377
8466
|
{
|
|
8378
|
-
className: "no-active-animation rounded-md bg-background text-
|
|
8467
|
+
className: "no-active-animation rounded-md bg-background text-primary border hover:bg-muted/50 overflow-hidden flex-1 min-w-0 border-border",
|
|
8379
8468
|
onClick: () => setOpen(false),
|
|
8380
8469
|
children: "Cancelar"
|
|
8381
8470
|
}
|
|
8471
|
+
),
|
|
8472
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
|
|
8473
|
+
ButtonBase,
|
|
8474
|
+
{
|
|
8475
|
+
className: cn(
|
|
8476
|
+
"no-active-animation rounded-md bg-emerald-600",
|
|
8477
|
+
internalDate ? "hover:bg-emerald-700" : "opacity-50 cursor-not-allowed"
|
|
8478
|
+
),
|
|
8479
|
+
disabled: !internalDate,
|
|
8480
|
+
onClick: () => {
|
|
8481
|
+
if (!internalDate) return;
|
|
8482
|
+
setOpen(false);
|
|
8483
|
+
onConfirm?.(internalDate);
|
|
8484
|
+
},
|
|
8485
|
+
children: "Confirmar"
|
|
8486
|
+
}
|
|
8382
8487
|
)
|
|
8383
|
-
] })
|
|
8384
|
-
|
|
8385
|
-
ButtonBase,
|
|
8386
|
-
{
|
|
8387
|
-
className: cn(
|
|
8388
|
-
"no-active-animation rounded-none bg-emerald-600",
|
|
8389
|
-
internalDate ? "hover:bg-emerald-700" : "opacity-50 cursor-not-allowed",
|
|
8390
|
-
isMobile ? "" : "rounded-md"
|
|
8391
|
-
),
|
|
8392
|
-
disabled: !internalDate,
|
|
8393
|
-
onClick: () => {
|
|
8394
|
-
if (!internalDate) return;
|
|
8395
|
-
setOpen(false);
|
|
8396
|
-
onConfirm?.(internalDate);
|
|
8397
|
-
},
|
|
8398
|
-
children: "Confirmar"
|
|
8399
|
-
}
|
|
8400
|
-
)
|
|
8401
|
-
] }) })
|
|
8488
|
+
] })
|
|
8489
|
+
] })
|
|
8402
8490
|
] });
|
|
8403
8491
|
return /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)("div", { className: cn("w-full sm:w-auto", className), children: [
|
|
8404
8492
|
label && /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(LabelBase_default, { children: label }),
|
|
@@ -8413,7 +8501,7 @@ function DateTimePicker({
|
|
|
8413
8501
|
}
|
|
8414
8502
|
),
|
|
8415
8503
|
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)(ErrorMessage_default, { error }),
|
|
8416
|
-
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)(DialogContentBase, { className: "p-0 max-w-[min(95vw,450px)] max-h-[
|
|
8504
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)(DialogContentBase, { className: "p-0 max-w-[min(95vw,450px)] max-h-[95vh] overflow-y-auto", children: renderPickerContent() })
|
|
8417
8505
|
] }) : /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)(PopoverBase, { open, onOpenChange: setOpen, children: [
|
|
8418
8506
|
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
|
|
8419
8507
|
PopoverTriggerBase,
|
|
@@ -8473,7 +8561,7 @@ function RangePicker({
|
|
|
8473
8561
|
const { ref: contentRef, center } = use_auto_center_default(open);
|
|
8474
8562
|
const basePopoverClass = "w-auto max-w-[calc(100vw-16px)] p-0 border shadow-none";
|
|
8475
8563
|
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";
|
|
8476
|
-
return /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)("div", { className: cn("w-full sm:w-auto", className), children: [
|
|
8564
|
+
return /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)("div", { className: cn("w-full sm:w-auto ", className), children: [
|
|
8477
8565
|
label && /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(LabelBase_default, { children: label }),
|
|
8478
8566
|
/* @__PURE__ */ (0, import_jsx_runtime60.jsxs)(PopoverBase, { open, onOpenChange: setOpen, children: [
|
|
8479
8567
|
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
@@ -8481,7 +8569,7 @@ function RangePicker({
|
|
|
8481
8569
|
{
|
|
8482
8570
|
disabled,
|
|
8483
8571
|
asChild: true,
|
|
8484
|
-
className: cn(error && "border-red-500"),
|
|
8572
|
+
className: cn(error && "border-red-500 "),
|
|
8485
8573
|
children: /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)(
|
|
8486
8574
|
ButtonBase,
|
|
8487
8575
|
{
|
|
@@ -8504,17 +8592,25 @@ function RangePicker({
|
|
|
8504
8592
|
})} - ${(0, import_date_fns2.format)(range.to, "P", { locale: dateFnsLocale })}` : "Selecione um intervalo"
|
|
8505
8593
|
}
|
|
8506
8594
|
),
|
|
8507
|
-
|
|
8508
|
-
|
|
8509
|
-
|
|
8510
|
-
|
|
8511
|
-
|
|
8512
|
-
|
|
8513
|
-
|
|
8595
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)(import_framer_motion12.motion.span, { className: "flex items-center", children: /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)("div", { className: "flex flex-row gap-0 items-center ", children: [
|
|
8596
|
+
range && /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
8597
|
+
ClearButton,
|
|
8598
|
+
{
|
|
8599
|
+
onClick: (e) => {
|
|
8600
|
+
e?.stopPropagation();
|
|
8601
|
+
handleClear();
|
|
8602
|
+
}
|
|
8514
8603
|
}
|
|
8515
|
-
|
|
8516
|
-
|
|
8517
|
-
|
|
8604
|
+
),
|
|
8605
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
8606
|
+
import_framer_motion12.motion.div,
|
|
8607
|
+
{
|
|
8608
|
+
animate: { rotate: open ? 15 : 0 },
|
|
8609
|
+
transition: { duration: 0.03 },
|
|
8610
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(import_react47.CalendarBlankIcon, { className: "h-4 w-4" })
|
|
8611
|
+
}
|
|
8612
|
+
)
|
|
8613
|
+
] }) })
|
|
8518
8614
|
]
|
|
8519
8615
|
}
|
|
8520
8616
|
)
|
|
@@ -8537,7 +8633,7 @@ function RangePicker({
|
|
|
8537
8633
|
animate: { opacity: 1, y: 0 },
|
|
8538
8634
|
exit: { opacity: 0, y: -4 },
|
|
8539
8635
|
transition: { duration: 0.18, ease: "easeOut" },
|
|
8540
|
-
className: "border rounded-md shadow-xl ",
|
|
8636
|
+
className: "border border-border rounded-md shadow-xl ",
|
|
8541
8637
|
children: [
|
|
8542
8638
|
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)("div", { className: "p-4", children: /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
8543
8639
|
import_framer_motion12.motion.div,
|
|
@@ -10266,7 +10362,7 @@ function Select({
|
|
|
10266
10362
|
labelClassname,
|
|
10267
10363
|
className,
|
|
10268
10364
|
pagination,
|
|
10269
|
-
hideClear =
|
|
10365
|
+
hideClear = false
|
|
10270
10366
|
}) {
|
|
10271
10367
|
const [page, setPage] = (0, import_react57.useState)(1);
|
|
10272
10368
|
const [animating, setAnimating] = (0, import_react57.useState)(false);
|
|
@@ -10338,7 +10434,7 @@ function Select({
|
|
|
10338
10434
|
}
|
|
10339
10435
|
),
|
|
10340
10436
|
/* @__PURE__ */ (0, import_jsx_runtime68.jsx)(import_framer_motion14.motion.span, { className: "flex items-center", children: /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)("div", { className: "flex flex-row gap-0 items-center ", children: [
|
|
10341
|
-
hideClear && selected && /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
|
|
10437
|
+
!hideClear && selected && /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
|
|
10342
10438
|
ClearButton,
|
|
10343
10439
|
{
|
|
10344
10440
|
onClick: () => {
|
|
@@ -10578,7 +10674,7 @@ function EventAgenda({
|
|
|
10578
10674
|
"div",
|
|
10579
10675
|
{
|
|
10580
10676
|
className: cn(
|
|
10581
|
-
"flex flex-col rounded-lg border has-data-[slot=month-view]:flex-1 px-6 py-2",
|
|
10677
|
+
"flex flex-col rounded-lg border has-data-[slot=month-view]:flex-1 px-6 py-2 border-border",
|
|
10582
10678
|
className
|
|
10583
10679
|
),
|
|
10584
10680
|
style: {
|
|
@@ -10623,7 +10719,8 @@ function EventAgenda({
|
|
|
10623
10719
|
},
|
|
10624
10720
|
items: selectItems,
|
|
10625
10721
|
className: "gap-2 px-3 py-1.5 max-[479px]:h-8",
|
|
10626
|
-
placeholder: viewLabel(view)
|
|
10722
|
+
placeholder: viewLabel(view),
|
|
10723
|
+
hideClear: true
|
|
10627
10724
|
}
|
|
10628
10725
|
) })
|
|
10629
10726
|
] }),
|
|
@@ -14383,6 +14480,12 @@ function MultiSelect({
|
|
|
14383
14480
|
const id = setTimeout(() => setAnimating(false), 220);
|
|
14384
14481
|
return () => clearTimeout(id);
|
|
14385
14482
|
}, [page, pagination]);
|
|
14483
|
+
const initialItems = (0, import_react86.useMemo)(() => {
|
|
14484
|
+
if (groupItems) {
|
|
14485
|
+
return Object.values(groupItems).flat();
|
|
14486
|
+
}
|
|
14487
|
+
return items ?? [];
|
|
14488
|
+
}, [items, groupItems]);
|
|
14386
14489
|
return /* @__PURE__ */ (0, import_jsx_runtime86.jsxs)("div", { "data-testid": testIds.root ?? "multiselect-root", children: [
|
|
14387
14490
|
label && /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(LabelBase_default, { className: labelClassname, children: label }),
|
|
14388
14491
|
/* @__PURE__ */ (0, import_jsx_runtime86.jsxs)(
|
|
@@ -14394,6 +14497,7 @@ function MultiSelect({
|
|
|
14394
14497
|
disabled,
|
|
14395
14498
|
empty,
|
|
14396
14499
|
error,
|
|
14500
|
+
initialItems,
|
|
14397
14501
|
children: [
|
|
14398
14502
|
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
|
|
14399
14503
|
MultiSelectTriggerBase,
|
|
@@ -14537,13 +14641,13 @@ function MultiSelect({
|
|
|
14537
14641
|
}
|
|
14538
14642
|
|
|
14539
14643
|
// src/components/ui/charts/Chart.tsx
|
|
14540
|
-
var
|
|
14541
|
-
var
|
|
14644
|
+
var import_react97 = require("react");
|
|
14645
|
+
var import_recharts2 = require("recharts");
|
|
14542
14646
|
|
|
14543
14647
|
// src/components/ui/charts/utils/helpers.ts
|
|
14544
14648
|
var formatFieldName = (fieldName) => {
|
|
14545
14649
|
return fieldName.split(/[/_-]/).filter(Boolean).map((word) => {
|
|
14546
|
-
return word.charAt(0).toUpperCase() + word.slice(1)
|
|
14650
|
+
return word.charAt(0).toUpperCase() + word.slice(1);
|
|
14547
14651
|
}).join(" ").trim();
|
|
14548
14652
|
};
|
|
14549
14653
|
var detectDataFields = (data, xAxisKey) => {
|
|
@@ -16098,8 +16202,205 @@ var TooltipSimple = ({
|
|
|
16098
16202
|
};
|
|
16099
16203
|
var TooltipSimple_default = TooltipSimple;
|
|
16100
16204
|
|
|
16101
|
-
// src/components/ui/charts/
|
|
16205
|
+
// src/components/ui/charts/components/Brush.tsx
|
|
16206
|
+
var import_recharts = require("recharts");
|
|
16102
16207
|
var import_jsx_runtime94 = require("react/jsx-runtime");
|
|
16208
|
+
var Brush = ({
|
|
16209
|
+
data,
|
|
16210
|
+
startIndex,
|
|
16211
|
+
endIndex,
|
|
16212
|
+
onMouseDown,
|
|
16213
|
+
brushRef,
|
|
16214
|
+
xAxisKey,
|
|
16215
|
+
seriesOrder,
|
|
16216
|
+
finalColors,
|
|
16217
|
+
brushHeight = 80,
|
|
16218
|
+
brushColor,
|
|
16219
|
+
miniChartOpacity = 0.3,
|
|
16220
|
+
margin = { left: 0, right: 0 }
|
|
16221
|
+
}) => {
|
|
16222
|
+
const dataLength = data.length;
|
|
16223
|
+
return /* @__PURE__ */ (0, import_jsx_runtime94.jsxs)("div", { className: "w-full px-8 pb-4", children: [
|
|
16224
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsxs)(
|
|
16225
|
+
"div",
|
|
16226
|
+
{
|
|
16227
|
+
className: "relative rounded-md border bg-muted/5 shadow-inner",
|
|
16228
|
+
style: { height: brushHeight },
|
|
16229
|
+
children: [
|
|
16230
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
|
|
16231
|
+
"div",
|
|
16232
|
+
{
|
|
16233
|
+
className: "absolute inset-0 pointer-events-none rounded-md",
|
|
16234
|
+
style: { opacity: miniChartOpacity },
|
|
16235
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(import_recharts.ResponsiveContainer, { width: "100%", height: brushHeight, children: /* @__PURE__ */ (0, import_jsx_runtime94.jsxs)(
|
|
16236
|
+
import_recharts.ComposedChart,
|
|
16237
|
+
{
|
|
16238
|
+
data: data.map((item) => ({
|
|
16239
|
+
...item,
|
|
16240
|
+
name: String(item[xAxisKey] || "N/A")
|
|
16241
|
+
})),
|
|
16242
|
+
height: brushHeight,
|
|
16243
|
+
margin: {
|
|
16244
|
+
top: 5,
|
|
16245
|
+
right: margin.right ?? 30,
|
|
16246
|
+
left: margin.left ?? 0,
|
|
16247
|
+
bottom: 5
|
|
16248
|
+
},
|
|
16249
|
+
children: [
|
|
16250
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)(import_recharts.XAxis, { dataKey: xAxisKey, hide: true }),
|
|
16251
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)(import_recharts.YAxis, { yAxisId: "left", hide: true }),
|
|
16252
|
+
seriesOrder.map((s) => {
|
|
16253
|
+
const key = s.key;
|
|
16254
|
+
const color = finalColors[key];
|
|
16255
|
+
if (s.type === "bar") {
|
|
16256
|
+
return /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
|
|
16257
|
+
import_recharts.Bar,
|
|
16258
|
+
{
|
|
16259
|
+
dataKey: key,
|
|
16260
|
+
yAxisId: "left",
|
|
16261
|
+
fill: color,
|
|
16262
|
+
radius: [2, 2, 0, 0]
|
|
16263
|
+
},
|
|
16264
|
+
`brush-bar-${key}`
|
|
16265
|
+
);
|
|
16266
|
+
}
|
|
16267
|
+
if (s.type === "line") {
|
|
16268
|
+
return /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
|
|
16269
|
+
import_recharts.Line,
|
|
16270
|
+
{
|
|
16271
|
+
type: "monotone",
|
|
16272
|
+
dataKey: key,
|
|
16273
|
+
yAxisId: "left",
|
|
16274
|
+
stroke: color,
|
|
16275
|
+
strokeWidth: 1.5,
|
|
16276
|
+
dot: false
|
|
16277
|
+
},
|
|
16278
|
+
`brush-line-${key}`
|
|
16279
|
+
);
|
|
16280
|
+
}
|
|
16281
|
+
if (s.type === "area") {
|
|
16282
|
+
return /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
|
|
16283
|
+
import_recharts.Area,
|
|
16284
|
+
{
|
|
16285
|
+
type: "monotone",
|
|
16286
|
+
dataKey: key,
|
|
16287
|
+
yAxisId: "left",
|
|
16288
|
+
stroke: color,
|
|
16289
|
+
fill: `url(#gradient-${key})`,
|
|
16290
|
+
strokeWidth: 1.5
|
|
16291
|
+
},
|
|
16292
|
+
`brush-area-${key}`
|
|
16293
|
+
);
|
|
16294
|
+
}
|
|
16295
|
+
return null;
|
|
16296
|
+
})
|
|
16297
|
+
]
|
|
16298
|
+
}
|
|
16299
|
+
) })
|
|
16300
|
+
}
|
|
16301
|
+
),
|
|
16302
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsxs)(
|
|
16303
|
+
"div",
|
|
16304
|
+
{
|
|
16305
|
+
ref: brushRef,
|
|
16306
|
+
className: "absolute inset-0 cursor-move rounded-md",
|
|
16307
|
+
style: { userSelect: "none" },
|
|
16308
|
+
children: [
|
|
16309
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
|
|
16310
|
+
"div",
|
|
16311
|
+
{
|
|
16312
|
+
className: "absolute top-0 bottom-0 left-0 bg-muted/60 pointer-events-none rounded-md",
|
|
16313
|
+
style: {
|
|
16314
|
+
width: `${startIndex / (dataLength - 1) * 100}%`
|
|
16315
|
+
}
|
|
16316
|
+
}
|
|
16317
|
+
),
|
|
16318
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
|
|
16319
|
+
"div",
|
|
16320
|
+
{
|
|
16321
|
+
className: "absolute top-0 bottom-0 right-0 bg-muted/60 pointer-events-none rounded-md",
|
|
16322
|
+
style: {
|
|
16323
|
+
width: `${(dataLength - 1 - endIndex) / (dataLength - 1) * 100}%`
|
|
16324
|
+
}
|
|
16325
|
+
}
|
|
16326
|
+
),
|
|
16327
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsxs)(
|
|
16328
|
+
"div",
|
|
16329
|
+
{
|
|
16330
|
+
className: "absolute top-0 bottom-0 border cursor-move group rounded-md border-primary/30",
|
|
16331
|
+
style: {
|
|
16332
|
+
left: `${startIndex / (dataLength - 1) * 100}%`,
|
|
16333
|
+
right: `${(dataLength - 1 - endIndex) / (dataLength - 1) * 100}%`,
|
|
16334
|
+
backgroundColor: "hsl(var(--primary) / 0.03)"
|
|
16335
|
+
},
|
|
16336
|
+
onMouseDown: (e) => onMouseDown(e, "middle"),
|
|
16337
|
+
children: [
|
|
16338
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
|
|
16339
|
+
"div",
|
|
16340
|
+
{
|
|
16341
|
+
className: "absolute top-1/2 -translate-y-1/2 -left-3 w-6 h-10 flex items-center justify-center cursor-ew-resize active:scale-95 transition-all",
|
|
16342
|
+
onMouseDown: (e) => {
|
|
16343
|
+
e.stopPropagation();
|
|
16344
|
+
onMouseDown(e, "start");
|
|
16345
|
+
},
|
|
16346
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
|
|
16347
|
+
"div",
|
|
16348
|
+
{
|
|
16349
|
+
className: "w-2 h-7 rounded-full shadow-md ring-2 ring-background flex flex-col items-center justify-center gap-0.5",
|
|
16350
|
+
style: {
|
|
16351
|
+
backgroundColor: brushColor ?? "hsl(var(--primary) / 0.7)"
|
|
16352
|
+
}
|
|
16353
|
+
}
|
|
16354
|
+
)
|
|
16355
|
+
}
|
|
16356
|
+
),
|
|
16357
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
|
|
16358
|
+
"div",
|
|
16359
|
+
{
|
|
16360
|
+
className: "absolute top-1/2 -translate-y-1/2 -right-3 w-6 h-10 flex items-center justify-center cursor-ew-resize active:scale-95 transition-all",
|
|
16361
|
+
onMouseDown: (e) => {
|
|
16362
|
+
e.stopPropagation();
|
|
16363
|
+
onMouseDown(e, "end");
|
|
16364
|
+
},
|
|
16365
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
|
|
16366
|
+
"div",
|
|
16367
|
+
{
|
|
16368
|
+
className: "w-2 h-7 rounded-full shadow-md ring-2 ring-background flex flex-col items-center justify-center gap-0.5",
|
|
16369
|
+
style: {
|
|
16370
|
+
backgroundColor: brushColor ?? "hsl(var(--primary) / 0.7)"
|
|
16371
|
+
}
|
|
16372
|
+
}
|
|
16373
|
+
)
|
|
16374
|
+
}
|
|
16375
|
+
)
|
|
16376
|
+
]
|
|
16377
|
+
}
|
|
16378
|
+
)
|
|
16379
|
+
]
|
|
16380
|
+
}
|
|
16381
|
+
)
|
|
16382
|
+
]
|
|
16383
|
+
}
|
|
16384
|
+
),
|
|
16385
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsxs)("div", { className: "flex justify-between items-center mt-2 text-xs text-muted-foreground", children: [
|
|
16386
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsxs)("span", { children: [
|
|
16387
|
+
data[startIndex]?.[xAxisKey],
|
|
16388
|
+
" - ",
|
|
16389
|
+
data[endIndex]?.[xAxisKey]
|
|
16390
|
+
] }),
|
|
16391
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsxs)("span", { children: [
|
|
16392
|
+
endIndex - startIndex + 1,
|
|
16393
|
+
" de ",
|
|
16394
|
+
dataLength,
|
|
16395
|
+
" per\xEDodos"
|
|
16396
|
+
] })
|
|
16397
|
+
] })
|
|
16398
|
+
] });
|
|
16399
|
+
};
|
|
16400
|
+
var Brush_default = Brush;
|
|
16401
|
+
|
|
16402
|
+
// src/components/ui/charts/utils/pillLabelRenderer.tsx
|
|
16403
|
+
var import_jsx_runtime95 = require("react/jsx-runtime");
|
|
16103
16404
|
var formatCompactNumber = (value) => {
|
|
16104
16405
|
const isNegative = value < 0;
|
|
16105
16406
|
const absValue = Math.abs(value);
|
|
@@ -16190,8 +16491,8 @@ var renderPillLabel = (color, variant, valueFormatter2) => {
|
|
|
16190
16491
|
} else {
|
|
16191
16492
|
textColor = "#374151";
|
|
16192
16493
|
}
|
|
16193
|
-
return /* @__PURE__ */ (0,
|
|
16194
|
-
/* @__PURE__ */ (0,
|
|
16494
|
+
return /* @__PURE__ */ (0, import_jsx_runtime95.jsxs)("g", { children: [
|
|
16495
|
+
/* @__PURE__ */ (0, import_jsx_runtime95.jsx)(
|
|
16195
16496
|
"rect",
|
|
16196
16497
|
{
|
|
16197
16498
|
x: rectX,
|
|
@@ -16204,7 +16505,7 @@ var renderPillLabel = (color, variant, valueFormatter2) => {
|
|
|
16204
16505
|
strokeWidth: rectStroke ? 1 : 0
|
|
16205
16506
|
}
|
|
16206
16507
|
),
|
|
16207
|
-
/* @__PURE__ */ (0,
|
|
16508
|
+
/* @__PURE__ */ (0, import_jsx_runtime95.jsx)(
|
|
16208
16509
|
"text",
|
|
16209
16510
|
{
|
|
16210
16511
|
x: textX,
|
|
@@ -16275,7 +16576,7 @@ var renderInsideBarLabel = (color, valueFormatter2) => {
|
|
|
16275
16576
|
const heightFactor = Math.max(0.8, Math.min(1.6, pHeight / heightRef));
|
|
16276
16577
|
fontSize = Math.min(18, Math.max(8, Math.round(fontSize * heightFactor)));
|
|
16277
16578
|
}
|
|
16278
|
-
return /* @__PURE__ */ (0,
|
|
16579
|
+
return /* @__PURE__ */ (0, import_jsx_runtime95.jsx)(
|
|
16279
16580
|
"text",
|
|
16280
16581
|
{
|
|
16281
16582
|
x: centerX,
|
|
@@ -16294,7 +16595,7 @@ var renderInsideBarLabel = (color, valueFormatter2) => {
|
|
|
16294
16595
|
|
|
16295
16596
|
// src/components/ui/charts/NoData.tsx
|
|
16296
16597
|
var import_framer_motion21 = require("framer-motion");
|
|
16297
|
-
var
|
|
16598
|
+
var import_jsx_runtime96 = require("react/jsx-runtime");
|
|
16298
16599
|
var ChartBar = ({ x, y, w, h, i, loading }) => {
|
|
16299
16600
|
const baseY = y - h;
|
|
16300
16601
|
const d = i * 0.08;
|
|
@@ -16305,8 +16606,8 @@ var ChartBar = ({ x, y, w, h, i, loading }) => {
|
|
|
16305
16606
|
ease: "easeInOut",
|
|
16306
16607
|
delay: d
|
|
16307
16608
|
};
|
|
16308
|
-
return /* @__PURE__ */ (0,
|
|
16309
|
-
/* @__PURE__ */ (0,
|
|
16609
|
+
return /* @__PURE__ */ (0, import_jsx_runtime96.jsxs)("g", { children: [
|
|
16610
|
+
/* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
|
|
16310
16611
|
import_framer_motion21.motion.rect,
|
|
16311
16612
|
{
|
|
16312
16613
|
x,
|
|
@@ -16321,7 +16622,7 @@ var ChartBar = ({ x, y, w, h, i, loading }) => {
|
|
|
16321
16622
|
style: { transformBox: "fill-box", originY: 1 }
|
|
16322
16623
|
}
|
|
16323
16624
|
),
|
|
16324
|
-
/* @__PURE__ */ (0,
|
|
16625
|
+
/* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
|
|
16325
16626
|
import_framer_motion21.motion.rect,
|
|
16326
16627
|
{
|
|
16327
16628
|
x,
|
|
@@ -16337,7 +16638,7 @@ var ChartBar = ({ x, y, w, h, i, loading }) => {
|
|
|
16337
16638
|
style: { transformBox: "fill-box", originY: 1 }
|
|
16338
16639
|
}
|
|
16339
16640
|
),
|
|
16340
|
-
/* @__PURE__ */ (0,
|
|
16641
|
+
/* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
|
|
16341
16642
|
import_framer_motion21.motion.line,
|
|
16342
16643
|
{
|
|
16343
16644
|
x1: x + w / 2,
|
|
@@ -16371,7 +16672,7 @@ var NoData = ({
|
|
|
16371
16672
|
{ x: 580, w: 100, h: h * 0.35 },
|
|
16372
16673
|
{ x: 700, w: 100, h: h * 0.3 }
|
|
16373
16674
|
];
|
|
16374
|
-
return /* @__PURE__ */ (0,
|
|
16675
|
+
return /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
|
|
16375
16676
|
"div",
|
|
16376
16677
|
{
|
|
16377
16678
|
className: cn(
|
|
@@ -16384,17 +16685,17 @@ var NoData = ({
|
|
|
16384
16685
|
},
|
|
16385
16686
|
role: "img",
|
|
16386
16687
|
"aria-label": message,
|
|
16387
|
-
children: /* @__PURE__ */ (0,
|
|
16388
|
-
/* @__PURE__ */ (0,
|
|
16688
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime96.jsx)("div", { className: "w-full flex items-center justify-center pl-[var(--pl)] p-6 h-[var(--svg-h)]", children: /* @__PURE__ */ (0, import_jsx_runtime96.jsxs)("div", { className: "w-full max-w-[900px] relative", children: [
|
|
16689
|
+
/* @__PURE__ */ (0, import_jsx_runtime96.jsxs)(
|
|
16389
16690
|
"svg",
|
|
16390
16691
|
{
|
|
16391
16692
|
className: "w-full h-[var(--svg-h)] opacity-40",
|
|
16392
16693
|
viewBox: `0 0 900 ${h}`,
|
|
16393
16694
|
preserveAspectRatio: "none",
|
|
16394
16695
|
children: [
|
|
16395
|
-
/* @__PURE__ */ (0,
|
|
16396
|
-
/* @__PURE__ */ (0,
|
|
16397
|
-
/* @__PURE__ */ (0,
|
|
16696
|
+
/* @__PURE__ */ (0, import_jsx_runtime96.jsxs)("defs", { children: [
|
|
16697
|
+
/* @__PURE__ */ (0, import_jsx_runtime96.jsxs)("linearGradient", { id: "bg", x1: "0", x2: "0", y1: "0", y2: "1", children: [
|
|
16698
|
+
/* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
|
|
16398
16699
|
"stop",
|
|
16399
16700
|
{
|
|
16400
16701
|
offset: "0%",
|
|
@@ -16402,7 +16703,7 @@ var NoData = ({
|
|
|
16402
16703
|
stopOpacity: "0.15"
|
|
16403
16704
|
}
|
|
16404
16705
|
),
|
|
16405
|
-
/* @__PURE__ */ (0,
|
|
16706
|
+
/* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
|
|
16406
16707
|
"stop",
|
|
16407
16708
|
{
|
|
16408
16709
|
offset: "100%",
|
|
@@ -16411,8 +16712,8 @@ var NoData = ({
|
|
|
16411
16712
|
}
|
|
16412
16713
|
)
|
|
16413
16714
|
] }),
|
|
16414
|
-
/* @__PURE__ */ (0,
|
|
16415
|
-
/* @__PURE__ */ (0,
|
|
16715
|
+
/* @__PURE__ */ (0, import_jsx_runtime96.jsxs)("linearGradient", { id: "gg", x1: "0", x2: "0", y1: "0", y2: "1", children: [
|
|
16716
|
+
/* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
|
|
16416
16717
|
"stop",
|
|
16417
16718
|
{
|
|
16418
16719
|
offset: "0%",
|
|
@@ -16420,7 +16721,7 @@ var NoData = ({
|
|
|
16420
16721
|
stopOpacity: "0.4"
|
|
16421
16722
|
}
|
|
16422
16723
|
),
|
|
16423
|
-
/* @__PURE__ */ (0,
|
|
16724
|
+
/* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
|
|
16424
16725
|
"stop",
|
|
16425
16726
|
{
|
|
16426
16727
|
offset: "100%",
|
|
@@ -16429,17 +16730,17 @@ var NoData = ({
|
|
|
16429
16730
|
}
|
|
16430
16731
|
)
|
|
16431
16732
|
] }),
|
|
16432
|
-
/* @__PURE__ */ (0,
|
|
16433
|
-
/* @__PURE__ */ (0,
|
|
16434
|
-
/* @__PURE__ */ (0,
|
|
16435
|
-
/* @__PURE__ */ (0,
|
|
16436
|
-
/* @__PURE__ */ (0,
|
|
16437
|
-
/* @__PURE__ */ (0,
|
|
16438
|
-
/* @__PURE__ */ (0,
|
|
16733
|
+
/* @__PURE__ */ (0, import_jsx_runtime96.jsxs)("filter", { id: "s", x: "-20%", y: "-20%", width: "140%", height: "140%", children: [
|
|
16734
|
+
/* @__PURE__ */ (0, import_jsx_runtime96.jsx)("feGaussianBlur", { in: "SourceAlpha", stdDeviation: "3" }),
|
|
16735
|
+
/* @__PURE__ */ (0, import_jsx_runtime96.jsx)("feOffset", { dx: "0", dy: "2" }),
|
|
16736
|
+
/* @__PURE__ */ (0, import_jsx_runtime96.jsx)("feComponentTransfer", { children: /* @__PURE__ */ (0, import_jsx_runtime96.jsx)("feFuncA", { type: "linear", slope: "0.2" }) }),
|
|
16737
|
+
/* @__PURE__ */ (0, import_jsx_runtime96.jsxs)("feMerge", { children: [
|
|
16738
|
+
/* @__PURE__ */ (0, import_jsx_runtime96.jsx)("feMergeNode", {}),
|
|
16739
|
+
/* @__PURE__ */ (0, import_jsx_runtime96.jsx)("feMergeNode", { in: "SourceGraphic" })
|
|
16439
16740
|
] })
|
|
16440
16741
|
] })
|
|
16441
16742
|
] }),
|
|
16442
|
-
/* @__PURE__ */ (0,
|
|
16743
|
+
/* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
|
|
16443
16744
|
"rect",
|
|
16444
16745
|
{
|
|
16445
16746
|
x: 0,
|
|
@@ -16450,7 +16751,7 @@ var NoData = ({
|
|
|
16450
16751
|
rx: 8
|
|
16451
16752
|
}
|
|
16452
16753
|
),
|
|
16453
|
-
[...Array(6)].map((_, i) => /* @__PURE__ */ (0,
|
|
16754
|
+
[...Array(6)].map((_, i) => /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
|
|
16454
16755
|
"line",
|
|
16455
16756
|
{
|
|
16456
16757
|
x1: 50,
|
|
@@ -16463,7 +16764,7 @@ var NoData = ({
|
|
|
16463
16764
|
},
|
|
16464
16765
|
i
|
|
16465
16766
|
)),
|
|
16466
|
-
/* @__PURE__ */ (0,
|
|
16767
|
+
/* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
|
|
16467
16768
|
"line",
|
|
16468
16769
|
{
|
|
16469
16770
|
x1: 50,
|
|
@@ -16475,7 +16776,7 @@ var NoData = ({
|
|
|
16475
16776
|
opacity: 0.5
|
|
16476
16777
|
}
|
|
16477
16778
|
),
|
|
16478
|
-
/* @__PURE__ */ (0,
|
|
16779
|
+
/* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
|
|
16479
16780
|
"line",
|
|
16480
16781
|
{
|
|
16481
16782
|
x1: 50,
|
|
@@ -16487,7 +16788,7 @@ var NoData = ({
|
|
|
16487
16788
|
opacity: 0.5
|
|
16488
16789
|
}
|
|
16489
16790
|
),
|
|
16490
|
-
bars.map((b, i) => /* @__PURE__ */ (0,
|
|
16791
|
+
bars.map((b, i) => /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
|
|
16491
16792
|
ChartBar,
|
|
16492
16793
|
{
|
|
16493
16794
|
x: b.x,
|
|
@@ -16502,15 +16803,15 @@ var NoData = ({
|
|
|
16502
16803
|
]
|
|
16503
16804
|
}
|
|
16504
16805
|
),
|
|
16505
|
-
/* @__PURE__ */ (0,
|
|
16806
|
+
/* @__PURE__ */ (0, import_jsx_runtime96.jsx)("div", { className: "absolute inset-0 flex items-center justify-center pointer-events-none h-[var(--svg-h)]", children: /* @__PURE__ */ (0, import_jsx_runtime96.jsx)("div", { className: "pointer-events-auto bg-card/95 backdrop-blur-sm px-8 py-6 rounded-xl border border-border/50 shadow-lg text-center max-w-md", children: isLoading ? /* @__PURE__ */ (0, import_jsx_runtime96.jsx)("div", { className: "flex flex-col items-center gap-4", children: /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
|
|
16506
16807
|
LoadingBase,
|
|
16507
16808
|
{
|
|
16508
16809
|
size: "xl",
|
|
16509
16810
|
message: loadingMessage ?? "Carregando"
|
|
16510
16811
|
}
|
|
16511
|
-
) }) : /* @__PURE__ */ (0,
|
|
16512
|
-
title && /* @__PURE__ */ (0,
|
|
16513
|
-
/* @__PURE__ */ (0,
|
|
16812
|
+
) }) : /* @__PURE__ */ (0, import_jsx_runtime96.jsxs)(import_jsx_runtime96.Fragment, { children: [
|
|
16813
|
+
title && /* @__PURE__ */ (0, import_jsx_runtime96.jsx)("h3", { className: "text-xl font-semibold text-foreground mb-2", children: title }),
|
|
16814
|
+
/* @__PURE__ */ (0, import_jsx_runtime96.jsx)("p", { className: "text-lg font-medium text-foreground/90 mb-2", children: message })
|
|
16514
16815
|
] }) }) })
|
|
16515
16816
|
] }) })
|
|
16516
16817
|
}
|
|
@@ -16731,14 +17032,132 @@ var useChartClick = ({
|
|
|
16731
17032
|
};
|
|
16732
17033
|
};
|
|
16733
17034
|
|
|
16734
|
-
// src/components/ui/charts/
|
|
16735
|
-
var
|
|
16736
|
-
|
|
16737
|
-
|
|
16738
|
-
|
|
16739
|
-
|
|
16740
|
-
|
|
16741
|
-
|
|
17035
|
+
// src/components/ui/charts/hooks/useTimeSeriesRange.ts
|
|
17036
|
+
var import_react96 = require("react");
|
|
17037
|
+
function useTimeSeriesRange({
|
|
17038
|
+
dataLength,
|
|
17039
|
+
defaultStartIndex = 0,
|
|
17040
|
+
defaultEndIndex,
|
|
17041
|
+
onRangeChange
|
|
17042
|
+
}) {
|
|
17043
|
+
const [startIndex, setStartIndex] = (0, import_react96.useState)(defaultStartIndex);
|
|
17044
|
+
const [endIndex, setEndIndex] = (0, import_react96.useState)(
|
|
17045
|
+
defaultEndIndex ?? Math.max(0, dataLength - 1)
|
|
17046
|
+
);
|
|
17047
|
+
const [isDragging, setIsDragging] = (0, import_react96.useState)(null);
|
|
17048
|
+
const [dragStartX, setDragStartX] = (0, import_react96.useState)(0);
|
|
17049
|
+
const [initialStartIndex, setInitialStartIndex] = (0, import_react96.useState)(0);
|
|
17050
|
+
const [initialEndIndex, setInitialEndIndex] = (0, import_react96.useState)(0);
|
|
17051
|
+
const brushRef = (0, import_react96.useRef)(null);
|
|
17052
|
+
(0, import_react96.useEffect)(() => {
|
|
17053
|
+
if (dataLength > 0) {
|
|
17054
|
+
setStartIndex((prev) => Math.min(prev, dataLength - 1));
|
|
17055
|
+
setEndIndex((prev) => {
|
|
17056
|
+
if (prev >= dataLength - 2 || defaultEndIndex === void 0) {
|
|
17057
|
+
return dataLength - 1;
|
|
17058
|
+
}
|
|
17059
|
+
return Math.min(prev, dataLength - 1);
|
|
17060
|
+
});
|
|
17061
|
+
}
|
|
17062
|
+
}, [dataLength, defaultEndIndex]);
|
|
17063
|
+
const handleRangeChange = (0, import_react96.useCallback)(
|
|
17064
|
+
(newStart, newEnd) => {
|
|
17065
|
+
const clampedStart = Math.max(0, Math.min(newStart, dataLength - 1));
|
|
17066
|
+
const clampedEnd = Math.max(
|
|
17067
|
+
clampedStart,
|
|
17068
|
+
Math.min(newEnd, dataLength - 1)
|
|
17069
|
+
);
|
|
17070
|
+
setStartIndex(clampedStart);
|
|
17071
|
+
setEndIndex(clampedEnd);
|
|
17072
|
+
if (onRangeChange) {
|
|
17073
|
+
onRangeChange(clampedStart, clampedEnd);
|
|
17074
|
+
}
|
|
17075
|
+
},
|
|
17076
|
+
[dataLength, onRangeChange]
|
|
17077
|
+
);
|
|
17078
|
+
const handleMouseDown = (0, import_react96.useCallback)(
|
|
17079
|
+
(e, type) => {
|
|
17080
|
+
e.preventDefault();
|
|
17081
|
+
setIsDragging(type);
|
|
17082
|
+
setDragStartX(e.clientX);
|
|
17083
|
+
setInitialStartIndex(startIndex);
|
|
17084
|
+
setInitialEndIndex(endIndex);
|
|
17085
|
+
},
|
|
17086
|
+
[startIndex, endIndex]
|
|
17087
|
+
);
|
|
17088
|
+
const handleMouseMove = (0, import_react96.useCallback)(
|
|
17089
|
+
(e) => {
|
|
17090
|
+
if (!isDragging || !brushRef.current) return;
|
|
17091
|
+
const brushWidth = brushRef.current.offsetWidth;
|
|
17092
|
+
const deltaX = e.clientX - dragStartX;
|
|
17093
|
+
const indexDelta = Math.round(deltaX / brushWidth * dataLength);
|
|
17094
|
+
if (isDragging === "start") {
|
|
17095
|
+
const newStart = Math.max(
|
|
17096
|
+
0,
|
|
17097
|
+
Math.min(initialStartIndex + indexDelta, endIndex - 1)
|
|
17098
|
+
);
|
|
17099
|
+
handleRangeChange(newStart, endIndex);
|
|
17100
|
+
} else if (isDragging === "end") {
|
|
17101
|
+
const newEnd = Math.max(
|
|
17102
|
+
startIndex + 1,
|
|
17103
|
+
Math.min(initialEndIndex + indexDelta, dataLength - 1)
|
|
17104
|
+
);
|
|
17105
|
+
handleRangeChange(startIndex, newEnd);
|
|
17106
|
+
} else if (isDragging === "middle") {
|
|
17107
|
+
const rangeSize = initialEndIndex - initialStartIndex;
|
|
17108
|
+
let newStart = initialStartIndex + indexDelta;
|
|
17109
|
+
let newEnd = initialEndIndex + indexDelta;
|
|
17110
|
+
if (newStart < 0) {
|
|
17111
|
+
newStart = 0;
|
|
17112
|
+
newEnd = rangeSize;
|
|
17113
|
+
} else if (newEnd >= dataLength) {
|
|
17114
|
+
newEnd = dataLength - 1;
|
|
17115
|
+
newStart = newEnd - rangeSize;
|
|
17116
|
+
}
|
|
17117
|
+
handleRangeChange(newStart, newEnd);
|
|
17118
|
+
}
|
|
17119
|
+
},
|
|
17120
|
+
[
|
|
17121
|
+
isDragging,
|
|
17122
|
+
dragStartX,
|
|
17123
|
+
dataLength,
|
|
17124
|
+
startIndex,
|
|
17125
|
+
endIndex,
|
|
17126
|
+
initialStartIndex,
|
|
17127
|
+
initialEndIndex,
|
|
17128
|
+
handleRangeChange
|
|
17129
|
+
]
|
|
17130
|
+
);
|
|
17131
|
+
const handleMouseUp = (0, import_react96.useCallback)(() => {
|
|
17132
|
+
setIsDragging(null);
|
|
17133
|
+
}, []);
|
|
17134
|
+
(0, import_react96.useEffect)(() => {
|
|
17135
|
+
if (isDragging) {
|
|
17136
|
+
document.addEventListener("mousemove", handleMouseMove);
|
|
17137
|
+
document.addEventListener("mouseup", handleMouseUp);
|
|
17138
|
+
return () => {
|
|
17139
|
+
document.removeEventListener("mousemove", handleMouseMove);
|
|
17140
|
+
document.removeEventListener("mouseup", handleMouseUp);
|
|
17141
|
+
};
|
|
17142
|
+
}
|
|
17143
|
+
}, [isDragging, handleMouseMove, handleMouseUp]);
|
|
17144
|
+
return {
|
|
17145
|
+
startIndex,
|
|
17146
|
+
endIndex,
|
|
17147
|
+
isDragging,
|
|
17148
|
+
brushRef,
|
|
17149
|
+
handleMouseDown
|
|
17150
|
+
};
|
|
17151
|
+
}
|
|
17152
|
+
|
|
17153
|
+
// src/components/ui/charts/Chart.tsx
|
|
17154
|
+
var import_jsx_runtime97 = require("react/jsx-runtime");
|
|
17155
|
+
var DEFAULT_COLORS2 = ["#55af7d", "#8e68ff", "#2273e1"];
|
|
17156
|
+
var Chart = ({
|
|
17157
|
+
data,
|
|
17158
|
+
series,
|
|
17159
|
+
className,
|
|
17160
|
+
height = 350,
|
|
16742
17161
|
width = "100%",
|
|
16743
17162
|
colors: colors2 = DEFAULT_COLORS2,
|
|
16744
17163
|
gridColor,
|
|
@@ -16765,9 +17184,10 @@ var Chart = ({
|
|
|
16765
17184
|
formatBR = false,
|
|
16766
17185
|
legendUppercase = false,
|
|
16767
17186
|
chartMargin,
|
|
16768
|
-
isLoading = false
|
|
17187
|
+
isLoading = false,
|
|
17188
|
+
timeSeries
|
|
16769
17189
|
}) => {
|
|
16770
|
-
const smartConfig = (0,
|
|
17190
|
+
const smartConfig = (0, import_react97.useMemo)(() => {
|
|
16771
17191
|
const resolvedXAxisKey = typeof xAxis === "string" ? xAxis : xAxis && xAxis.dataKey || detectXAxis(data);
|
|
16772
17192
|
const xAxisConfig2 = typeof xAxis === "string" ? {
|
|
16773
17193
|
dataKey: resolvedXAxisKey,
|
|
@@ -16805,15 +17225,38 @@ var Chart = ({
|
|
|
16805
17225
|
onTooltipPositionChange,
|
|
16806
17226
|
setActiveTooltips
|
|
16807
17227
|
} = useChartTooltips(maxTooltips);
|
|
16808
|
-
(0,
|
|
17228
|
+
(0, import_react97.useEffect)(() => {
|
|
16809
17229
|
if (highlightedSeries.size === 0 && showOnlyHighlighted) {
|
|
16810
17230
|
setShowOnlyHighlighted(false);
|
|
16811
17231
|
}
|
|
16812
17232
|
}, [highlightedSeries, showOnlyHighlighted, setShowOnlyHighlighted]);
|
|
16813
|
-
const
|
|
16814
|
-
|
|
16815
|
-
|
|
16816
|
-
|
|
17233
|
+
const timeSeriesConfig = (0, import_react97.useMemo)(() => {
|
|
17234
|
+
if (typeof timeSeries === "boolean") {
|
|
17235
|
+
return timeSeries ? {} : void 0;
|
|
17236
|
+
}
|
|
17237
|
+
return timeSeries;
|
|
17238
|
+
}, [timeSeries]);
|
|
17239
|
+
const {
|
|
17240
|
+
startIndex,
|
|
17241
|
+
endIndex,
|
|
17242
|
+
brushRef,
|
|
17243
|
+
handleMouseDown
|
|
17244
|
+
} = useTimeSeriesRange({
|
|
17245
|
+
dataLength: data.length,
|
|
17246
|
+
defaultStartIndex: timeSeriesConfig?.start,
|
|
17247
|
+
defaultEndIndex: timeSeriesConfig?.end,
|
|
17248
|
+
onRangeChange: timeSeriesConfig?.onRangeChange
|
|
17249
|
+
});
|
|
17250
|
+
const processedData = (0, import_react97.useMemo)(() => {
|
|
17251
|
+
const mapped = data.map((item) => ({
|
|
17252
|
+
...item,
|
|
17253
|
+
name: String(item[xAxisConfig.dataKey] || "N/A")
|
|
17254
|
+
}));
|
|
17255
|
+
if (timeSeriesConfig) {
|
|
17256
|
+
return mapped.slice(startIndex, endIndex + 1);
|
|
17257
|
+
}
|
|
17258
|
+
return mapped;
|
|
17259
|
+
}, [data, xAxisConfig.dataKey, timeSeriesConfig, startIndex, endIndex]);
|
|
16817
17260
|
const seriesOrder = [];
|
|
16818
17261
|
if (series) {
|
|
16819
17262
|
if (series.bar)
|
|
@@ -16828,17 +17271,17 @@ var Chart = ({
|
|
|
16828
17271
|
);
|
|
16829
17272
|
}
|
|
16830
17273
|
const allKeys = seriesOrder.map((s) => s.key).filter(Boolean);
|
|
16831
|
-
const finalColors = (0,
|
|
17274
|
+
const finalColors = (0, import_react97.useMemo)(
|
|
16832
17275
|
() => generateColorMap(allKeys, colors2, mapperConfig),
|
|
16833
17276
|
[allKeys, colors2, mapperConfig]
|
|
16834
17277
|
);
|
|
16835
|
-
const biaxialConfigNormalized = (0,
|
|
17278
|
+
const biaxialConfigNormalized = (0, import_react97.useMemo)(() => {
|
|
16836
17279
|
if (!biaxial) return null;
|
|
16837
17280
|
if (typeof biaxial === "string") return { key: [biaxial] };
|
|
16838
17281
|
if (Array.isArray(biaxial)) return { key: biaxial };
|
|
16839
17282
|
return biaxial;
|
|
16840
17283
|
}, [biaxial]);
|
|
16841
|
-
(0,
|
|
17284
|
+
(0, import_react97.useMemo)(() => {
|
|
16842
17285
|
if (!biaxialConfigNormalized) return;
|
|
16843
17286
|
const leftLabelMissing = !yAxisLabel || String(yAxisLabel).trim() === "";
|
|
16844
17287
|
const rightLabelMissing = !biaxialConfigNormalized.label || String(biaxialConfigNormalized.label).trim() === "";
|
|
@@ -16848,43 +17291,43 @@ var Chart = ({
|
|
|
16848
17291
|
);
|
|
16849
17292
|
}
|
|
16850
17293
|
}, [biaxialConfigNormalized, yAxisLabel]);
|
|
16851
|
-
const rightKeys = (0,
|
|
17294
|
+
const rightKeys = (0, import_react97.useMemo)(
|
|
16852
17295
|
() => biaxialConfigNormalized?.key ?? [],
|
|
16853
17296
|
[biaxialConfigNormalized]
|
|
16854
17297
|
);
|
|
16855
|
-
const leftKeys = (0,
|
|
17298
|
+
const leftKeys = (0, import_react97.useMemo)(
|
|
16856
17299
|
() => allKeys.filter((k) => !rightKeys.includes(k)),
|
|
16857
17300
|
[allKeys, rightKeys]
|
|
16858
17301
|
);
|
|
16859
|
-
const activePeriods = (0,
|
|
17302
|
+
const activePeriods = (0, import_react97.useMemo)(
|
|
16860
17303
|
() => activeTooltips.map((t) => adaptDataForTooltip(t.data, xAxisConfig.dataKey).name),
|
|
16861
17304
|
[activeTooltips, xAxisConfig.dataKey]
|
|
16862
17305
|
);
|
|
16863
|
-
const maxLeftDataValue = (0,
|
|
17306
|
+
const maxLeftDataValue = (0, import_react97.useMemo)(() => {
|
|
16864
17307
|
const numericKeys = leftKeys.length > 0 ? leftKeys : allKeys;
|
|
16865
17308
|
return getMaxDataValue(processedData, numericKeys);
|
|
16866
17309
|
}, [processedData, leftKeys, allKeys]);
|
|
16867
|
-
const minLeftDataValue = (0,
|
|
17310
|
+
const minLeftDataValue = (0, import_react97.useMemo)(() => {
|
|
16868
17311
|
const numericKeys = leftKeys.length > 0 ? leftKeys : allKeys;
|
|
16869
17312
|
return getMinDataValue(processedData, numericKeys);
|
|
16870
17313
|
}, [processedData, leftKeys, allKeys]);
|
|
16871
|
-
const maxRightDataValue = (0,
|
|
17314
|
+
const maxRightDataValue = (0, import_react97.useMemo)(() => {
|
|
16872
17315
|
if (rightKeys.length === 0) return 0;
|
|
16873
17316
|
return getMaxDataValue(processedData, rightKeys);
|
|
16874
17317
|
}, [processedData, rightKeys]);
|
|
16875
|
-
const minRightDataValue = (0,
|
|
17318
|
+
const minRightDataValue = (0, import_react97.useMemo)(() => {
|
|
16876
17319
|
if (rightKeys.length === 0) return 0;
|
|
16877
17320
|
return getMinDataValue(processedData, rightKeys);
|
|
16878
17321
|
}, [processedData, rightKeys]);
|
|
16879
|
-
const niceMaxLeft = (0,
|
|
17322
|
+
const niceMaxLeft = (0, import_react97.useMemo)(
|
|
16880
17323
|
() => computeNiceMax(maxLeftDataValue),
|
|
16881
17324
|
[maxLeftDataValue]
|
|
16882
17325
|
);
|
|
16883
|
-
const niceMaxRight = (0,
|
|
17326
|
+
const niceMaxRight = (0, import_react97.useMemo)(
|
|
16884
17327
|
() => computeNiceMax(maxRightDataValue),
|
|
16885
17328
|
[maxRightDataValue]
|
|
16886
17329
|
);
|
|
16887
|
-
const computedWidth = (0,
|
|
17330
|
+
const computedWidth = (0, import_react97.useMemo)(
|
|
16888
17331
|
() => computeChartWidth(
|
|
16889
17332
|
width,
|
|
16890
17333
|
processedData.length,
|
|
@@ -16902,32 +17345,29 @@ var Chart = ({
|
|
|
16902
17345
|
setActiveTooltips
|
|
16903
17346
|
}
|
|
16904
17347
|
);
|
|
16905
|
-
const
|
|
16906
|
-
() =>
|
|
16907
|
-
|
|
17348
|
+
const getSeriesOpacity = (0, import_react97.useCallback)(
|
|
17349
|
+
(key) => {
|
|
17350
|
+
return highlightedSeries.size > 0 ? highlightedSeries.has(key) ? 1 : 0.25 : 1;
|
|
17351
|
+
},
|
|
17352
|
+
[highlightedSeries]
|
|
16908
17353
|
);
|
|
16909
|
-
const finalValueFormatter = (0,
|
|
17354
|
+
const finalValueFormatter = (0, import_react97.useMemo)(
|
|
16910
17355
|
() => createValueFormatter(valueFormatter2, formatBR),
|
|
16911
17356
|
[valueFormatter2, formatBR]
|
|
16912
17357
|
);
|
|
16913
|
-
const yTickFormatter = (0,
|
|
17358
|
+
const yTickFormatter = (0, import_react97.useMemo)(
|
|
16914
17359
|
() => createYTickFormatter(finalValueFormatter),
|
|
16915
17360
|
[finalValueFormatter]
|
|
16916
17361
|
);
|
|
16917
|
-
const
|
|
16918
|
-
const
|
|
16919
|
-
const
|
|
16920
|
-
const
|
|
16921
|
-
const
|
|
16922
|
-
const axisLabelMargin = 56;
|
|
16923
|
-
const containerPaddingLeft = -6;
|
|
16924
|
-
const finalChartRightMargin = chartMargin?.right ?? (rightKeys.length > 0 ? axisLabelMargin : defaultChartRightMargin);
|
|
16925
|
-
const finalChartLeftMargin = chartMargin?.left ?? (yAxisLabel ? axisLabelMargin : defaultChartLeftMargin);
|
|
16926
|
-
const yAxisTickWidth = (0, import_react96.useMemo)(
|
|
17362
|
+
const AXIS_LABEL_MARGIN = 56;
|
|
17363
|
+
const CONTAINER_PADDING_LEFT = -6;
|
|
17364
|
+
const finalChartRightMargin = chartMargin?.right ?? (rightKeys.length > 0 ? AXIS_LABEL_MARGIN : 30);
|
|
17365
|
+
const finalChartLeftMargin = chartMargin?.left ?? (yAxisLabel ? AXIS_LABEL_MARGIN : 0);
|
|
17366
|
+
const yAxisTickWidth = (0, import_react97.useMemo)(
|
|
16927
17367
|
() => computeYAxisTickWidth(
|
|
16928
17368
|
chartMargin?.left,
|
|
16929
17369
|
yAxisLabel,
|
|
16930
|
-
|
|
17370
|
+
AXIS_LABEL_MARGIN,
|
|
16931
17371
|
yTickFormatter,
|
|
16932
17372
|
minLeftDataValue,
|
|
16933
17373
|
niceMaxLeft
|
|
@@ -16940,19 +17380,13 @@ var Chart = ({
|
|
|
16940
17380
|
niceMaxLeft
|
|
16941
17381
|
]
|
|
16942
17382
|
);
|
|
16943
|
-
const composedChartLeftMargin = chartMargin?.left ?? defaultChartLeftMargin;
|
|
16944
|
-
const composedChartRightMargin = chartMargin?.right ?? defaultChartRightMargin;
|
|
16945
17383
|
const finalChartTopMargin = chartMargin?.top ?? (showLabels ? 48 : 20);
|
|
16946
|
-
const
|
|
16947
|
-
const
|
|
16948
|
-
const
|
|
16949
|
-
const finalChartBottomMargin = baseBottom + extraForXAxisLabel + extraForLegend;
|
|
16950
|
-
const measuredInner = measuredWidth ? Math.max(0, measuredWidth - 32) : void 0;
|
|
16951
|
-
const effectiveChartWidth = typeof width === "number" ? width : measuredInner ?? computedWidth;
|
|
16952
|
-
const chartInnerWidth = effectiveChartWidth - composedChartLeftMargin - composedChartRightMargin;
|
|
17384
|
+
const finalChartBottomMargin = (chartMargin?.bottom ?? 5) + (xAxisLabel ? 22 : 0) + (showLegend ? 36 : 0);
|
|
17385
|
+
const effectiveChartWidth = typeof width === "number" ? width : measuredWidth ? Math.max(0, measuredWidth - 32) : computedWidth;
|
|
17386
|
+
const chartInnerWidth = effectiveChartWidth - finalChartLeftMargin - finalChartRightMargin;
|
|
16953
17387
|
const leftYAxisLabelDx = -Math.max(12, Math.round(yAxisTickWidth / 2));
|
|
16954
17388
|
const rightYAxisLabelDx = Math.max(12, Math.round(finalChartRightMargin / 2));
|
|
16955
|
-
const openTooltipForPeriod = (0,
|
|
17389
|
+
const openTooltipForPeriod = (0, import_react97.useCallback)(
|
|
16956
17390
|
(periodName) => {
|
|
16957
17391
|
if (!enableDraggableTooltips) return;
|
|
16958
17392
|
const row = processedData.find((r) => String(r.name) === periodName);
|
|
@@ -16969,7 +17403,7 @@ var Chart = ({
|
|
|
16969
17403
|
);
|
|
16970
17404
|
}
|
|
16971
17405
|
const offsetIndex = activeTooltips.length;
|
|
16972
|
-
const availableWidth =
|
|
17406
|
+
const availableWidth = effectiveChartWidth;
|
|
16973
17407
|
const gap = 28;
|
|
16974
17408
|
const leftGap = 28;
|
|
16975
17409
|
const newTooltip = {
|
|
@@ -16989,525 +17423,500 @@ var Chart = ({
|
|
|
16989
17423
|
enableDraggableTooltips,
|
|
16990
17424
|
processedData,
|
|
16991
17425
|
activeTooltips,
|
|
16992
|
-
|
|
16993
|
-
measuredInner,
|
|
16994
|
-
computedWidth,
|
|
17426
|
+
effectiveChartWidth,
|
|
16995
17427
|
maxTooltips,
|
|
16996
17428
|
setActiveTooltips
|
|
16997
17429
|
]
|
|
16998
17430
|
);
|
|
16999
17431
|
if (!data && !isLoading) return null;
|
|
17000
17432
|
if (isLoading) {
|
|
17001
|
-
return /* @__PURE__ */ (0,
|
|
17433
|
+
return /* @__PURE__ */ (0, import_jsx_runtime97.jsx)(
|
|
17002
17434
|
NoData_default,
|
|
17003
17435
|
{
|
|
17004
17436
|
title,
|
|
17005
17437
|
isLoading: true,
|
|
17006
17438
|
loadingMessage: typeof title === "string" ? `${title} \u2014 Carregando` : "Carregando",
|
|
17007
|
-
paddingLeft:
|
|
17439
|
+
paddingLeft: CONTAINER_PADDING_LEFT + finalChartLeftMargin,
|
|
17008
17440
|
height
|
|
17009
17441
|
}
|
|
17010
17442
|
);
|
|
17011
17443
|
}
|
|
17012
17444
|
if (Array.isArray(data) && data.length === 0) {
|
|
17013
|
-
return /* @__PURE__ */ (0,
|
|
17445
|
+
return /* @__PURE__ */ (0, import_jsx_runtime97.jsx)(
|
|
17014
17446
|
NoData_default,
|
|
17015
17447
|
{
|
|
17016
17448
|
title,
|
|
17017
|
-
paddingLeft:
|
|
17449
|
+
paddingLeft: CONTAINER_PADDING_LEFT + finalChartLeftMargin,
|
|
17018
17450
|
height
|
|
17019
17451
|
}
|
|
17020
17452
|
);
|
|
17021
17453
|
}
|
|
17022
|
-
return /* @__PURE__ */ (0,
|
|
17454
|
+
return /* @__PURE__ */ (0, import_jsx_runtime97.jsx)("div", { ref: wrapperRef, className: "w-full overflow-hidden min-w-0", children: /* @__PURE__ */ (0, import_jsx_runtime97.jsxs)(
|
|
17023
17455
|
"div",
|
|
17024
17456
|
{
|
|
17025
|
-
|
|
17026
|
-
|
|
17027
|
-
|
|
17028
|
-
|
|
17029
|
-
|
|
17030
|
-
|
|
17031
|
-
|
|
17032
|
-
|
|
17033
|
-
|
|
17034
|
-
|
|
17035
|
-
|
|
17036
|
-
|
|
17037
|
-
|
|
17038
|
-
title && /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
|
|
17039
|
-
"div",
|
|
17040
|
-
{
|
|
17041
|
-
style: {
|
|
17042
|
-
paddingLeft: `${containerPaddingLeft + finalChartLeftMargin}px`,
|
|
17043
|
-
width: "100%",
|
|
17044
|
-
display: "flex",
|
|
17045
|
-
justifyContent: titlePosition === "center" ? "center" : titlePosition === "right" ? "flex-end" : "flex-start",
|
|
17046
|
-
alignItems: "center",
|
|
17047
|
-
marginTop: "19px"
|
|
17048
|
-
},
|
|
17049
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime96.jsx)("div", { className: titleClassName, children: title })
|
|
17050
|
-
}
|
|
17457
|
+
className: cn(
|
|
17458
|
+
"rounded-lg bg-card relative w-full max-w-full min-w-0",
|
|
17459
|
+
className
|
|
17460
|
+
),
|
|
17461
|
+
children: [
|
|
17462
|
+
title && /* @__PURE__ */ (0, import_jsx_runtime97.jsx)(
|
|
17463
|
+
"div",
|
|
17464
|
+
{
|
|
17465
|
+
className: cn(
|
|
17466
|
+
"w-full flex items-center mt-[19px] ml-[90px]",
|
|
17467
|
+
titlePosition === "center" && "justify-center",
|
|
17468
|
+
titlePosition === "right" && "justify-end",
|
|
17469
|
+
titlePosition === "left" && "justify-start"
|
|
17051
17470
|
),
|
|
17052
|
-
|
|
17053
|
-
|
|
17471
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime97.jsx)("div", { className: "text-[1.4rem] font-semibold text-foreground mb-3", children: title })
|
|
17472
|
+
}
|
|
17473
|
+
),
|
|
17474
|
+
allKeys.length > 0 && (enableHighlights || enableShowOnly) && /* @__PURE__ */ (0, import_jsx_runtime97.jsxs)("div", { className: "flex items-center w-[98%] ml-[90px] gap-2", children: [
|
|
17475
|
+
enableHighlights && /* @__PURE__ */ (0, import_jsx_runtime97.jsx)(
|
|
17476
|
+
Highlights_default,
|
|
17477
|
+
{
|
|
17478
|
+
allKeys,
|
|
17479
|
+
mapperConfig,
|
|
17480
|
+
finalColors,
|
|
17481
|
+
highlightedSeries,
|
|
17482
|
+
toggleHighlight,
|
|
17483
|
+
containerWidth: chartInnerWidth
|
|
17484
|
+
}
|
|
17485
|
+
),
|
|
17486
|
+
enableShowOnly && /* @__PURE__ */ (0, import_jsx_runtime97.jsx)(
|
|
17487
|
+
ShowOnly_default,
|
|
17488
|
+
{
|
|
17489
|
+
showOnlyHighlighted,
|
|
17490
|
+
setShowOnlyHighlighted,
|
|
17491
|
+
highlightedSeriesSize: highlightedSeries.size,
|
|
17492
|
+
clearHighlights
|
|
17493
|
+
}
|
|
17494
|
+
),
|
|
17495
|
+
enablePeriodsDropdown && enableDraggableTooltips && /* @__PURE__ */ (0, import_jsx_runtime97.jsx)("div", { className: "ml-auto flex items-center", children: /* @__PURE__ */ (0, import_jsx_runtime97.jsx)(
|
|
17496
|
+
PeriodsDropdown_default,
|
|
17497
|
+
{
|
|
17498
|
+
processedData,
|
|
17499
|
+
onOpenPeriod: openTooltipForPeriod,
|
|
17500
|
+
rightOffset: finalChartRightMargin,
|
|
17501
|
+
activePeriods
|
|
17502
|
+
}
|
|
17503
|
+
) })
|
|
17504
|
+
] }),
|
|
17505
|
+
!(allKeys.length > 0 && (enableHighlights || enableShowOnly)) && enablePeriodsDropdown && enableDraggableTooltips && /* @__PURE__ */ (0, import_jsx_runtime97.jsx)(
|
|
17506
|
+
"div",
|
|
17507
|
+
{
|
|
17508
|
+
className: "w-full flex justify-end",
|
|
17509
|
+
style: {
|
|
17510
|
+
paddingLeft: `${CONTAINER_PADDING_LEFT + finalChartLeftMargin}px`,
|
|
17511
|
+
paddingRight: `${finalChartRightMargin}px`,
|
|
17512
|
+
maxWidth: `${chartInnerWidth}px`
|
|
17513
|
+
},
|
|
17514
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime97.jsx)(
|
|
17515
|
+
PeriodsDropdown_default,
|
|
17054
17516
|
{
|
|
17055
|
-
|
|
17056
|
-
|
|
17057
|
-
|
|
17058
|
-
width: "98%",
|
|
17059
|
-
display: "flex",
|
|
17060
|
-
alignItems: "center",
|
|
17061
|
-
gap: "0.5rem"
|
|
17062
|
-
},
|
|
17063
|
-
children: [
|
|
17064
|
-
finalEnableHighlights && /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
|
|
17065
|
-
Highlights_default,
|
|
17066
|
-
{
|
|
17067
|
-
allKeys,
|
|
17068
|
-
mapperConfig,
|
|
17069
|
-
finalColors,
|
|
17070
|
-
highlightedSeries,
|
|
17071
|
-
toggleHighlight,
|
|
17072
|
-
containerWidth: chartInnerWidth
|
|
17073
|
-
}
|
|
17074
|
-
),
|
|
17075
|
-
finalEnableShowOnly && /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
|
|
17076
|
-
ShowOnly_default,
|
|
17077
|
-
{
|
|
17078
|
-
showOnlyHighlighted,
|
|
17079
|
-
setShowOnlyHighlighted,
|
|
17080
|
-
highlightedSeriesSize: highlightedSeries.size,
|
|
17081
|
-
clearHighlights
|
|
17082
|
-
}
|
|
17083
|
-
),
|
|
17084
|
-
finalEnablePeriodsDropdown && /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
|
|
17085
|
-
"div",
|
|
17086
|
-
{
|
|
17087
|
-
style: {
|
|
17088
|
-
marginLeft: "auto",
|
|
17089
|
-
display: "flex",
|
|
17090
|
-
alignItems: "center"
|
|
17091
|
-
},
|
|
17092
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
|
|
17093
|
-
PeriodsDropdown_default,
|
|
17094
|
-
{
|
|
17095
|
-
processedData,
|
|
17096
|
-
onOpenPeriod: openTooltipForPeriod,
|
|
17097
|
-
rightOffset: finalChartRightMargin,
|
|
17098
|
-
activePeriods
|
|
17099
|
-
}
|
|
17100
|
-
)
|
|
17101
|
-
}
|
|
17102
|
-
)
|
|
17103
|
-
]
|
|
17517
|
+
processedData,
|
|
17518
|
+
onOpenPeriod: openTooltipForPeriod,
|
|
17519
|
+
rightOffset: finalChartRightMargin
|
|
17104
17520
|
}
|
|
17105
|
-
)
|
|
17106
|
-
|
|
17107
|
-
|
|
17108
|
-
|
|
17109
|
-
|
|
17110
|
-
|
|
17111
|
-
|
|
17112
|
-
|
|
17113
|
-
|
|
17114
|
-
|
|
17115
|
-
|
|
17116
|
-
|
|
17117
|
-
|
|
17118
|
-
|
|
17521
|
+
)
|
|
17522
|
+
}
|
|
17523
|
+
),
|
|
17524
|
+
/* @__PURE__ */ (0, import_jsx_runtime97.jsx)(import_recharts2.ResponsiveContainer, { width: "100%", height, children: /* @__PURE__ */ (0, import_jsx_runtime97.jsxs)(
|
|
17525
|
+
import_recharts2.ComposedChart,
|
|
17526
|
+
{
|
|
17527
|
+
data: processedData,
|
|
17528
|
+
height,
|
|
17529
|
+
margin: {
|
|
17530
|
+
top: finalChartTopMargin,
|
|
17531
|
+
right: finalChartRightMargin,
|
|
17532
|
+
left: finalChartLeftMargin,
|
|
17533
|
+
bottom: finalChartBottomMargin
|
|
17534
|
+
},
|
|
17535
|
+
onClick: handleChartClick,
|
|
17536
|
+
children: [
|
|
17537
|
+
/* @__PURE__ */ (0, import_jsx_runtime97.jsx)("defs", { children: seriesOrder.filter((s) => s.type === "area").map((s) => {
|
|
17538
|
+
const key = s.key;
|
|
17539
|
+
const color = finalColors[key];
|
|
17540
|
+
return /* @__PURE__ */ (0, import_jsx_runtime97.jsxs)(
|
|
17541
|
+
"linearGradient",
|
|
17119
17542
|
{
|
|
17120
|
-
|
|
17121
|
-
|
|
17122
|
-
|
|
17123
|
-
|
|
17124
|
-
|
|
17125
|
-
|
|
17126
|
-
|
|
17127
|
-
|
|
17128
|
-
|
|
17129
|
-
|
|
17130
|
-
|
|
17131
|
-
|
|
17132
|
-
|
|
17133
|
-
|
|
17134
|
-
|
|
17135
|
-
|
|
17136
|
-
|
|
17137
|
-
|
|
17138
|
-
|
|
17139
|
-
|
|
17140
|
-
|
|
17141
|
-
|
|
17142
|
-
|
|
17143
|
-
|
|
17144
|
-
|
|
17145
|
-
|
|
17146
|
-
|
|
17147
|
-
|
|
17148
|
-
|
|
17149
|
-
|
|
17150
|
-
|
|
17151
|
-
|
|
17152
|
-
|
|
17153
|
-
|
|
17154
|
-
|
|
17155
|
-
|
|
17156
|
-
|
|
17157
|
-
|
|
17158
|
-
|
|
17159
|
-
|
|
17160
|
-
|
|
17161
|
-
{
|
|
17162
|
-
strokeDasharray: "3 3",
|
|
17163
|
-
stroke: gridColor || "hsl(var(--muted-foreground))",
|
|
17164
|
-
opacity: 0.5
|
|
17165
|
-
}
|
|
17166
|
-
),
|
|
17167
|
-
/* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
|
|
17168
|
-
import_recharts.XAxis,
|
|
17169
|
-
{
|
|
17170
|
-
dataKey: xAxisConfig.dataKey,
|
|
17171
|
-
stroke: "hsl(var(--muted-foreground))",
|
|
17543
|
+
id: `gradient-${key}`,
|
|
17544
|
+
x1: "0",
|
|
17545
|
+
y1: "0",
|
|
17546
|
+
x2: "0",
|
|
17547
|
+
y2: "0.8",
|
|
17548
|
+
children: [
|
|
17549
|
+
/* @__PURE__ */ (0, import_jsx_runtime97.jsx)("stop", { offset: "0%", stopColor: color, stopOpacity: 0.8 }),
|
|
17550
|
+
/* @__PURE__ */ (0, import_jsx_runtime97.jsx)("stop", { offset: "90%", stopColor: color, stopOpacity: 0.1 })
|
|
17551
|
+
]
|
|
17552
|
+
},
|
|
17553
|
+
`gradient-${key}`
|
|
17554
|
+
);
|
|
17555
|
+
}) }),
|
|
17556
|
+
showGrid && /* @__PURE__ */ (0, import_jsx_runtime97.jsx)(
|
|
17557
|
+
import_recharts2.CartesianGrid,
|
|
17558
|
+
{
|
|
17559
|
+
strokeDasharray: "3 3",
|
|
17560
|
+
stroke: gridColor || "hsl(var(--muted-foreground))",
|
|
17561
|
+
opacity: 0.5
|
|
17562
|
+
}
|
|
17563
|
+
),
|
|
17564
|
+
/* @__PURE__ */ (0, import_jsx_runtime97.jsx)(
|
|
17565
|
+
import_recharts2.XAxis,
|
|
17566
|
+
{
|
|
17567
|
+
dataKey: xAxisConfig.dataKey,
|
|
17568
|
+
stroke: "hsl(var(--muted-foreground))",
|
|
17569
|
+
fontSize: 12,
|
|
17570
|
+
tickLine: false,
|
|
17571
|
+
axisLine: false,
|
|
17572
|
+
tickFormatter: (value) => {
|
|
17573
|
+
if (categoryFormatter)
|
|
17574
|
+
return categoryFormatter(value);
|
|
17575
|
+
if (xAxisConfig.valueFormatter)
|
|
17576
|
+
return xAxisConfig.valueFormatter(value);
|
|
17577
|
+
return String(value ?? "");
|
|
17578
|
+
},
|
|
17579
|
+
label: xAxisLabel ? {
|
|
17580
|
+
value: xAxisLabel,
|
|
17581
|
+
position: "insideBottomRight",
|
|
17582
|
+
offset: -5,
|
|
17583
|
+
style: {
|
|
17172
17584
|
fontSize: 12,
|
|
17173
|
-
|
|
17174
|
-
|
|
17175
|
-
tickFormatter: (value) => {
|
|
17176
|
-
if (categoryFormatter)
|
|
17177
|
-
return categoryFormatter(value);
|
|
17178
|
-
if (xAxisConfig.valueFormatter)
|
|
17179
|
-
return xAxisConfig.valueFormatter(value);
|
|
17180
|
-
return String(value ?? "");
|
|
17181
|
-
},
|
|
17182
|
-
label: xAxisLabel ? {
|
|
17183
|
-
value: xAxisLabel,
|
|
17184
|
-
position: "insideBottomRight",
|
|
17185
|
-
offset: -5,
|
|
17186
|
-
style: {
|
|
17187
|
-
fontSize: 12,
|
|
17188
|
-
fill: "hsl(var(--muted-foreground))",
|
|
17189
|
-
fontWeight: 500
|
|
17190
|
-
}
|
|
17191
|
-
} : void 0
|
|
17585
|
+
fill: "hsl(var(--muted-foreground))",
|
|
17586
|
+
fontWeight: 500
|
|
17192
17587
|
}
|
|
17193
|
-
|
|
17194
|
-
|
|
17195
|
-
|
|
17196
|
-
|
|
17197
|
-
|
|
17198
|
-
|
|
17199
|
-
|
|
17588
|
+
} : void 0
|
|
17589
|
+
}
|
|
17590
|
+
),
|
|
17591
|
+
/* @__PURE__ */ (0, import_jsx_runtime97.jsx)(
|
|
17592
|
+
import_recharts2.YAxis,
|
|
17593
|
+
{
|
|
17594
|
+
yAxisId: "left",
|
|
17595
|
+
width: yAxisTickWidth,
|
|
17596
|
+
stroke: "hsl(var(--muted-foreground))",
|
|
17597
|
+
fontSize: 12,
|
|
17598
|
+
tickLine: false,
|
|
17599
|
+
axisLine: false,
|
|
17600
|
+
tickFormatter: yTickFormatter,
|
|
17601
|
+
domain: [Math.min(minLeftDataValue, 0), niceMaxLeft],
|
|
17602
|
+
tickCount: 6,
|
|
17603
|
+
label: yAxisLabel ? {
|
|
17604
|
+
value: yAxisLabel,
|
|
17605
|
+
angle: -90,
|
|
17606
|
+
position: "left",
|
|
17607
|
+
dx: leftYAxisLabelDx,
|
|
17608
|
+
style: {
|
|
17200
17609
|
fontSize: 12,
|
|
17201
|
-
|
|
17202
|
-
|
|
17203
|
-
|
|
17204
|
-
domain: [Math.min(minLeftDataValue, 0), niceMaxLeft],
|
|
17205
|
-
tickCount: 6,
|
|
17206
|
-
label: yAxisLabel ? {
|
|
17207
|
-
value: yAxisLabel,
|
|
17208
|
-
angle: -90,
|
|
17209
|
-
position: "left",
|
|
17210
|
-
dx: leftYAxisLabelDx,
|
|
17211
|
-
style: {
|
|
17212
|
-
fontSize: 12,
|
|
17213
|
-
fill: "hsl(var(--muted-foreground))",
|
|
17214
|
-
fontWeight: 500,
|
|
17215
|
-
textAnchor: "middle"
|
|
17216
|
-
}
|
|
17217
|
-
} : void 0
|
|
17610
|
+
fill: "hsl(var(--muted-foreground))",
|
|
17611
|
+
fontWeight: 500,
|
|
17612
|
+
textAnchor: "middle"
|
|
17218
17613
|
}
|
|
17219
|
-
|
|
17220
|
-
|
|
17221
|
-
|
|
17222
|
-
|
|
17223
|
-
|
|
17224
|
-
|
|
17225
|
-
|
|
17226
|
-
|
|
17227
|
-
|
|
17228
|
-
|
|
17229
|
-
|
|
17230
|
-
|
|
17231
|
-
|
|
17232
|
-
|
|
17233
|
-
|
|
17234
|
-
|
|
17235
|
-
|
|
17236
|
-
|
|
17237
|
-
|
|
17238
|
-
|
|
17239
|
-
|
|
17240
|
-
|
|
17241
|
-
|
|
17242
|
-
|
|
17243
|
-
|
|
17244
|
-
|
|
17245
|
-
|
|
17246
|
-
|
|
17247
|
-
|
|
17248
|
-
|
|
17249
|
-
|
|
17250
|
-
|
|
17251
|
-
|
|
17252
|
-
|
|
17253
|
-
|
|
17254
|
-
|
|
17255
|
-
|
|
17256
|
-
|
|
17257
|
-
|
|
17258
|
-
|
|
17259
|
-
|
|
17260
|
-
|
|
17614
|
+
} : void 0
|
|
17615
|
+
}
|
|
17616
|
+
),
|
|
17617
|
+
minLeftDataValue < 0 && /* @__PURE__ */ (0, import_jsx_runtime97.jsx)(
|
|
17618
|
+
import_recharts2.ReferenceLine,
|
|
17619
|
+
{
|
|
17620
|
+
y: 0,
|
|
17621
|
+
yAxisId: "left",
|
|
17622
|
+
stroke: "hsl(var(--muted-foreground))",
|
|
17623
|
+
strokeWidth: 1,
|
|
17624
|
+
strokeDasharray: "4 4"
|
|
17625
|
+
}
|
|
17626
|
+
),
|
|
17627
|
+
rightKeys.length > 0 && (() => {
|
|
17628
|
+
const decimals = typeof biaxialConfigNormalized?.decimals === "number" ? Math.max(0, Math.floor(biaxialConfigNormalized.decimals)) : 2;
|
|
17629
|
+
const rightTickFormatter = (v) => {
|
|
17630
|
+
if (biaxialConfigNormalized?.percentage) {
|
|
17631
|
+
const num = Number(String(v));
|
|
17632
|
+
const nf = new Intl.NumberFormat("pt-BR", {
|
|
17633
|
+
minimumFractionDigits: decimals,
|
|
17634
|
+
maximumFractionDigits: decimals
|
|
17635
|
+
});
|
|
17636
|
+
const out = Number.isNaN(num) ? String(v ?? "") : nf.format(num);
|
|
17637
|
+
return `${out}%`;
|
|
17638
|
+
}
|
|
17639
|
+
return yTickFormatter(v);
|
|
17640
|
+
};
|
|
17641
|
+
const firstRightKey = biaxialConfigNormalized?.key && biaxialConfigNormalized.key[0];
|
|
17642
|
+
const defaultRightColor = firstRightKey && finalColors[firstRightKey] || "hsl(var(--muted-foreground))";
|
|
17643
|
+
const rightAxisColor = (() => {
|
|
17644
|
+
if (!biaxialConfigNormalized) return defaultRightColor;
|
|
17645
|
+
if (typeof biaxialConfigNormalized.stroke === "string")
|
|
17646
|
+
return biaxialConfigNormalized.stroke;
|
|
17647
|
+
if (biaxialConfigNormalized.stroke && firstRightKey && typeof biaxialConfigNormalized.stroke === "object")
|
|
17648
|
+
return biaxialConfigNormalized.stroke[firstRightKey] || defaultRightColor;
|
|
17649
|
+
return defaultRightColor;
|
|
17650
|
+
})();
|
|
17651
|
+
return /* @__PURE__ */ (0, import_jsx_runtime97.jsx)(
|
|
17652
|
+
import_recharts2.YAxis,
|
|
17653
|
+
{
|
|
17654
|
+
yAxisId: "right",
|
|
17655
|
+
width: finalChartRightMargin,
|
|
17656
|
+
orientation: "right",
|
|
17657
|
+
stroke: "hsl(var(--muted-foreground))",
|
|
17658
|
+
fontSize: 12,
|
|
17659
|
+
tickLine: false,
|
|
17660
|
+
axisLine: false,
|
|
17661
|
+
tick: { fill: rightAxisColor },
|
|
17662
|
+
tickFormatter: rightTickFormatter,
|
|
17663
|
+
domain: [Math.min(minRightDataValue, 0), niceMaxRight],
|
|
17664
|
+
tickCount: 6,
|
|
17665
|
+
label: biaxialConfigNormalized?.label ? {
|
|
17666
|
+
value: biaxialConfigNormalized.label,
|
|
17667
|
+
angle: -90,
|
|
17668
|
+
position: "right",
|
|
17669
|
+
dx: rightYAxisLabelDx,
|
|
17670
|
+
style: {
|
|
17261
17671
|
fontSize: 12,
|
|
17262
|
-
|
|
17263
|
-
|
|
17264
|
-
|
|
17265
|
-
tickFormatter: rightTickFormatter,
|
|
17266
|
-
domain: [Math.min(minRightDataValue, 0), niceMaxRight],
|
|
17267
|
-
tickCount: 6,
|
|
17268
|
-
label: biaxialConfigNormalized?.label ? {
|
|
17269
|
-
value: biaxialConfigNormalized.label,
|
|
17270
|
-
angle: -90,
|
|
17271
|
-
position: "right",
|
|
17272
|
-
dx: rightYAxisLabelDx,
|
|
17273
|
-
style: {
|
|
17274
|
-
fontSize: 12,
|
|
17275
|
-
fill: "hsl(var(--muted-foreground))",
|
|
17276
|
-
fontWeight: 500,
|
|
17277
|
-
textAnchor: "middle"
|
|
17278
|
-
}
|
|
17279
|
-
} : void 0
|
|
17672
|
+
fill: "hsl(var(--muted-foreground))",
|
|
17673
|
+
fontWeight: 500,
|
|
17674
|
+
textAnchor: "middle"
|
|
17280
17675
|
}
|
|
17281
|
-
|
|
17282
|
-
}
|
|
17283
|
-
|
|
17284
|
-
|
|
17676
|
+
} : void 0
|
|
17677
|
+
}
|
|
17678
|
+
);
|
|
17679
|
+
})(),
|
|
17680
|
+
showTooltip && /* @__PURE__ */ (0, import_jsx_runtime97.jsx)(
|
|
17681
|
+
import_recharts2.Tooltip,
|
|
17682
|
+
{
|
|
17683
|
+
content: showTooltipTotal ? /* @__PURE__ */ (0, import_jsx_runtime97.jsx)(
|
|
17684
|
+
TooltipWithTotal_default,
|
|
17285
17685
|
{
|
|
17286
|
-
|
|
17287
|
-
|
|
17288
|
-
|
|
17289
|
-
|
|
17290
|
-
valueFormatter: finalValueFormatter,
|
|
17291
|
-
categoryFormatter,
|
|
17292
|
-
periodLabel
|
|
17293
|
-
}
|
|
17294
|
-
) : /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
|
|
17295
|
-
TooltipSimple_default,
|
|
17296
|
-
{
|
|
17297
|
-
finalColors,
|
|
17298
|
-
valueFormatter: finalValueFormatter,
|
|
17299
|
-
categoryFormatter,
|
|
17300
|
-
periodLabel
|
|
17301
|
-
}
|
|
17302
|
-
),
|
|
17303
|
-
cursor: { fill: "hsl(var(--muted))", opacity: 0.1 }
|
|
17686
|
+
finalColors,
|
|
17687
|
+
valueFormatter: finalValueFormatter,
|
|
17688
|
+
categoryFormatter,
|
|
17689
|
+
periodLabel
|
|
17304
17690
|
}
|
|
17305
|
-
),
|
|
17306
|
-
|
|
17307
|
-
import_recharts.Legend,
|
|
17691
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime97.jsx)(
|
|
17692
|
+
TooltipSimple_default,
|
|
17308
17693
|
{
|
|
17309
|
-
|
|
17310
|
-
|
|
17311
|
-
|
|
17312
|
-
|
|
17313
|
-
letterSpacing: 0
|
|
17314
|
-
},
|
|
17315
|
-
formatter: (value) => {
|
|
17316
|
-
const key = String(value);
|
|
17317
|
-
const label = mapperConfig[key]?.label ?? labelMap?.[key] ?? formatFieldName(key);
|
|
17318
|
-
const displayLabel = legendUppercase ? label.toUpperCase() : label;
|
|
17319
|
-
return /* @__PURE__ */ (0, import_jsx_runtime96.jsx)("span", { style: { letterSpacing: 0 }, children: displayLabel });
|
|
17320
|
-
}
|
|
17694
|
+
finalColors,
|
|
17695
|
+
valueFormatter: finalValueFormatter,
|
|
17696
|
+
categoryFormatter,
|
|
17697
|
+
periodLabel
|
|
17321
17698
|
}
|
|
17322
17699
|
),
|
|
17323
|
-
|
|
17324
|
-
|
|
17325
|
-
|
|
17326
|
-
|
|
17700
|
+
cursor: { fill: "hsl(var(--muted))", opacity: 0.1 }
|
|
17701
|
+
}
|
|
17702
|
+
),
|
|
17703
|
+
showLegend && /* @__PURE__ */ (0, import_jsx_runtime97.jsx)(
|
|
17704
|
+
import_recharts2.Legend,
|
|
17705
|
+
{
|
|
17706
|
+
wrapperStyle: {
|
|
17707
|
+
color: "hsl(var(--foreground))",
|
|
17708
|
+
fontSize: "14px",
|
|
17709
|
+
paddingTop: "8px",
|
|
17710
|
+
letterSpacing: 0
|
|
17711
|
+
},
|
|
17712
|
+
formatter: (value) => {
|
|
17713
|
+
const key = String(value);
|
|
17327
17714
|
const label = mapperConfig[key]?.label ?? labelMap?.[key] ?? formatFieldName(key);
|
|
17328
|
-
|
|
17329
|
-
|
|
17330
|
-
|
|
17331
|
-
|
|
17332
|
-
|
|
17333
|
-
|
|
17334
|
-
|
|
17335
|
-
|
|
17336
|
-
|
|
17337
|
-
|
|
17338
|
-
|
|
17715
|
+
const displayLabel = legendUppercase ? label.toUpperCase() : label;
|
|
17716
|
+
return /* @__PURE__ */ (0, import_jsx_runtime97.jsx)("span", { className: "tracking-[0]", children: displayLabel });
|
|
17717
|
+
}
|
|
17718
|
+
}
|
|
17719
|
+
),
|
|
17720
|
+
seriesOrder.map((s) => {
|
|
17721
|
+
const key = s.key;
|
|
17722
|
+
if (showOnlyHighlighted && !highlightedSeries.has(key))
|
|
17723
|
+
return null;
|
|
17724
|
+
const label = mapperConfig[key]?.label ?? labelMap?.[key] ?? formatFieldName(key);
|
|
17725
|
+
let color = finalColors[key];
|
|
17726
|
+
if (rightKeys.includes(key) && biaxialConfigNormalized?.stroke) {
|
|
17727
|
+
if (typeof biaxialConfigNormalized.stroke === "string") {
|
|
17728
|
+
color = biaxialConfigNormalized.stroke;
|
|
17729
|
+
} else {
|
|
17730
|
+
color = biaxialConfigNormalized.stroke[key] ?? color;
|
|
17731
|
+
}
|
|
17732
|
+
}
|
|
17733
|
+
if (s.type === "bar") {
|
|
17734
|
+
return /* @__PURE__ */ (0, import_jsx_runtime97.jsx)(
|
|
17735
|
+
import_recharts2.Bar,
|
|
17736
|
+
{
|
|
17737
|
+
dataKey: key,
|
|
17738
|
+
yAxisId: rightKeys.includes(key) ? "right" : "left",
|
|
17739
|
+
name: label,
|
|
17740
|
+
fill: color,
|
|
17741
|
+
radius: [4, 4, 0, 0],
|
|
17742
|
+
onClick: handleBarClick,
|
|
17743
|
+
className: "cursor-pointer",
|
|
17744
|
+
style: { opacity: getSeriesOpacity(key) },
|
|
17745
|
+
activeBar: /* @__PURE__ */ (0, import_jsx_runtime97.jsx)(
|
|
17746
|
+
import_recharts2.Rectangle,
|
|
17339
17747
|
{
|
|
17340
|
-
dataKey: key,
|
|
17341
|
-
yAxisId: rightKeys.includes(key) ? "right" : "left",
|
|
17342
|
-
name: label,
|
|
17343
17748
|
fill: color,
|
|
17344
|
-
radius: [4, 4, 0, 0],
|
|
17345
|
-
onClick: handleBarClick,
|
|
17346
|
-
style: {
|
|
17347
|
-
cursor: "pointer",
|
|
17348
|
-
opacity: highlightedSeries.size > 0 ? highlightedSeries.has(key) ? 1 : 0.25 : 1
|
|
17349
|
-
},
|
|
17350
|
-
activeBar: /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
|
|
17351
|
-
import_recharts.Rectangle,
|
|
17352
|
-
{
|
|
17353
|
-
fill: color,
|
|
17354
|
-
stroke: color,
|
|
17355
|
-
strokeWidth: 2,
|
|
17356
|
-
opacity: 0.8
|
|
17357
|
-
}
|
|
17358
|
-
),
|
|
17359
|
-
children: showLabels && highlightedSeries.size === 0 || highlightedSeries.has(key) ? /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
|
|
17360
|
-
import_recharts.LabelList,
|
|
17361
|
-
{
|
|
17362
|
-
dataKey: key,
|
|
17363
|
-
content: (props) => {
|
|
17364
|
-
const p = props;
|
|
17365
|
-
const barHeight = typeof p.height === "number" ? p.height : typeof p.height === "string" ? Number(p.height) : 0;
|
|
17366
|
-
const barWidth = typeof p.width === "number" ? p.width : typeof p.width === "string" ? Number(p.width) : 0;
|
|
17367
|
-
const smallThreshold = 14;
|
|
17368
|
-
const needsOutside = barHeight > 0 && barHeight < smallThreshold || barWidth > 0 && barWidth < smallThreshold;
|
|
17369
|
-
if (needsOutside) {
|
|
17370
|
-
return null;
|
|
17371
|
-
}
|
|
17372
|
-
const inside = renderInsideBarLabel(
|
|
17373
|
-
color,
|
|
17374
|
-
finalValueFormatter
|
|
17375
|
-
);
|
|
17376
|
-
return inside(props);
|
|
17377
|
-
},
|
|
17378
|
-
offset: 0
|
|
17379
|
-
}
|
|
17380
|
-
) : null
|
|
17381
|
-
},
|
|
17382
|
-
`bar-${key}`
|
|
17383
|
-
);
|
|
17384
|
-
}
|
|
17385
|
-
if (s.type === "line") {
|
|
17386
|
-
return /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
|
|
17387
|
-
import_recharts.Line,
|
|
17388
|
-
{
|
|
17389
|
-
dataKey: key,
|
|
17390
|
-
yAxisId: rightKeys.includes(key) ? "right" : "left",
|
|
17391
|
-
name: label,
|
|
17392
17749
|
stroke: color,
|
|
17393
17750
|
strokeWidth: 2,
|
|
17394
|
-
|
|
17395
|
-
|
|
17396
|
-
|
|
17397
|
-
|
|
17398
|
-
|
|
17399
|
-
pointerEvents: "all",
|
|
17400
|
-
opacity: highlightedSeries.size > 0 ? highlightedSeries.has(key) ? 1 : 0.25 : 1
|
|
17401
|
-
},
|
|
17402
|
-
children: showLabels && highlightedSeries.size === 0 || highlightedSeries.has(key) ? /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
|
|
17403
|
-
import_recharts.LabelList,
|
|
17404
|
-
{
|
|
17405
|
-
dataKey: key,
|
|
17406
|
-
position: "top",
|
|
17407
|
-
content: pillLabelRenderer_default(
|
|
17408
|
-
color,
|
|
17409
|
-
"filled",
|
|
17410
|
-
finalValueFormatter
|
|
17411
|
-
),
|
|
17412
|
-
offset: 14
|
|
17413
|
-
}
|
|
17414
|
-
) : null
|
|
17415
|
-
},
|
|
17416
|
-
`line-${key}`
|
|
17417
|
-
);
|
|
17418
|
-
}
|
|
17419
|
-
if (s.type === "area") {
|
|
17420
|
-
return /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
|
|
17421
|
-
import_recharts.Area,
|
|
17751
|
+
opacity: 0.8
|
|
17752
|
+
}
|
|
17753
|
+
),
|
|
17754
|
+
children: showLabels && highlightedSeries.size === 0 || highlightedSeries.has(key) ? /* @__PURE__ */ (0, import_jsx_runtime97.jsx)(
|
|
17755
|
+
import_recharts2.LabelList,
|
|
17422
17756
|
{
|
|
17423
|
-
type: "monotone",
|
|
17424
17757
|
dataKey: key,
|
|
17425
|
-
|
|
17426
|
-
|
|
17427
|
-
|
|
17428
|
-
|
|
17429
|
-
|
|
17430
|
-
|
|
17431
|
-
|
|
17432
|
-
|
|
17433
|
-
cursor: "pointer",
|
|
17434
|
-
pointerEvents: "all",
|
|
17435
|
-
opacity: highlightedSeries.size > 0 ? highlightedSeries.has(key) ? 1 : 0.25 : 1
|
|
17436
|
-
},
|
|
17437
|
-
activeDot: {
|
|
17438
|
-
r: 6,
|
|
17439
|
-
fill: color,
|
|
17440
|
-
stroke: "hsl(var(--background))",
|
|
17441
|
-
strokeWidth: 2
|
|
17442
|
-
},
|
|
17443
|
-
children: showLabels && highlightedSeries.size === 0 || highlightedSeries.has(key) ? /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
|
|
17444
|
-
import_recharts.LabelList,
|
|
17445
|
-
{
|
|
17446
|
-
dataKey: key,
|
|
17447
|
-
position: "top",
|
|
17448
|
-
content: pillLabelRenderer_default(
|
|
17449
|
-
color,
|
|
17450
|
-
"soft",
|
|
17451
|
-
finalValueFormatter
|
|
17452
|
-
),
|
|
17453
|
-
offset: 12
|
|
17758
|
+
content: (props) => {
|
|
17759
|
+
const p = props;
|
|
17760
|
+
const barHeight = typeof p.height === "number" ? p.height : typeof p.height === "string" ? Number(p.height) : 0;
|
|
17761
|
+
const barWidth = typeof p.width === "number" ? p.width : typeof p.width === "string" ? Number(p.width) : 0;
|
|
17762
|
+
const smallThreshold = 14;
|
|
17763
|
+
const needsOutside = barHeight > 0 && barHeight < smallThreshold || barWidth > 0 && barWidth < smallThreshold;
|
|
17764
|
+
if (needsOutside) {
|
|
17765
|
+
return null;
|
|
17454
17766
|
}
|
|
17455
|
-
|
|
17456
|
-
|
|
17457
|
-
|
|
17458
|
-
|
|
17459
|
-
|
|
17460
|
-
|
|
17461
|
-
|
|
17462
|
-
|
|
17463
|
-
|
|
17464
|
-
|
|
17465
|
-
|
|
17466
|
-
|
|
17467
|
-
|
|
17468
|
-
|
|
17469
|
-
|
|
17470
|
-
|
|
17471
|
-
|
|
17472
|
-
|
|
17473
|
-
|
|
17474
|
-
|
|
17475
|
-
|
|
17476
|
-
|
|
17477
|
-
|
|
17478
|
-
|
|
17479
|
-
|
|
17480
|
-
|
|
17481
|
-
|
|
17482
|
-
|
|
17483
|
-
|
|
17484
|
-
|
|
17485
|
-
|
|
17486
|
-
|
|
17487
|
-
|
|
17488
|
-
|
|
17489
|
-
|
|
17490
|
-
|
|
17491
|
-
|
|
17492
|
-
|
|
17493
|
-
|
|
17494
|
-
|
|
17495
|
-
|
|
17496
|
-
|
|
17497
|
-
|
|
17498
|
-
|
|
17499
|
-
|
|
17500
|
-
|
|
17501
|
-
|
|
17767
|
+
const inside = renderInsideBarLabel(
|
|
17768
|
+
color,
|
|
17769
|
+
finalValueFormatter
|
|
17770
|
+
);
|
|
17771
|
+
return inside(props);
|
|
17772
|
+
},
|
|
17773
|
+
offset: 0
|
|
17774
|
+
}
|
|
17775
|
+
) : null
|
|
17776
|
+
},
|
|
17777
|
+
`bar-${key}`
|
|
17778
|
+
);
|
|
17779
|
+
}
|
|
17780
|
+
if (s.type === "line") {
|
|
17781
|
+
return /* @__PURE__ */ (0, import_jsx_runtime97.jsx)(
|
|
17782
|
+
import_recharts2.Line,
|
|
17783
|
+
{
|
|
17784
|
+
dataKey: key,
|
|
17785
|
+
yAxisId: rightKeys.includes(key) ? "right" : "left",
|
|
17786
|
+
name: label,
|
|
17787
|
+
stroke: color,
|
|
17788
|
+
strokeWidth: 2,
|
|
17789
|
+
dot: { r: 3 },
|
|
17790
|
+
activeDot: { r: 6 },
|
|
17791
|
+
onClick: handleSeriesClick,
|
|
17792
|
+
className: "cursor-pointer pointer-events-auto",
|
|
17793
|
+
style: { opacity: getSeriesOpacity(key) },
|
|
17794
|
+
children: showLabels && highlightedSeries.size === 0 || highlightedSeries.has(key) ? /* @__PURE__ */ (0, import_jsx_runtime97.jsx)(
|
|
17795
|
+
import_recharts2.LabelList,
|
|
17796
|
+
{
|
|
17797
|
+
dataKey: key,
|
|
17798
|
+
position: "top",
|
|
17799
|
+
content: pillLabelRenderer_default(
|
|
17800
|
+
color,
|
|
17801
|
+
"filled",
|
|
17802
|
+
finalValueFormatter
|
|
17803
|
+
),
|
|
17804
|
+
offset: 14
|
|
17805
|
+
}
|
|
17806
|
+
) : null
|
|
17807
|
+
},
|
|
17808
|
+
`line-${key}`
|
|
17809
|
+
);
|
|
17810
|
+
}
|
|
17811
|
+
if (s.type === "area") {
|
|
17812
|
+
return /* @__PURE__ */ (0, import_jsx_runtime97.jsx)(
|
|
17813
|
+
import_recharts2.Area,
|
|
17814
|
+
{
|
|
17815
|
+
type: "monotone",
|
|
17816
|
+
dataKey: key,
|
|
17817
|
+
yAxisId: rightKeys.includes(key) ? "right" : "left",
|
|
17818
|
+
name: label,
|
|
17819
|
+
stroke: color,
|
|
17820
|
+
fill: `url(#gradient-${key})`,
|
|
17821
|
+
fillOpacity: 1,
|
|
17822
|
+
strokeWidth: 2,
|
|
17823
|
+
onClick: handleSeriesClick,
|
|
17824
|
+
className: "cursor-pointer pointer-events-auto",
|
|
17825
|
+
style: { opacity: getSeriesOpacity(key) },
|
|
17826
|
+
activeDot: {
|
|
17827
|
+
r: 6,
|
|
17828
|
+
fill: color,
|
|
17829
|
+
stroke: "hsl(var(--background))",
|
|
17830
|
+
strokeWidth: 2
|
|
17831
|
+
},
|
|
17832
|
+
children: showLabels && highlightedSeries.size === 0 || highlightedSeries.has(key) ? /* @__PURE__ */ (0, import_jsx_runtime97.jsx)(
|
|
17833
|
+
import_recharts2.LabelList,
|
|
17834
|
+
{
|
|
17835
|
+
dataKey: key,
|
|
17836
|
+
position: "top",
|
|
17837
|
+
content: pillLabelRenderer_default(
|
|
17838
|
+
color,
|
|
17839
|
+
"soft",
|
|
17840
|
+
finalValueFormatter
|
|
17841
|
+
),
|
|
17842
|
+
offset: 12
|
|
17843
|
+
}
|
|
17844
|
+
) : null
|
|
17845
|
+
},
|
|
17846
|
+
`area-${key}`
|
|
17847
|
+
);
|
|
17848
|
+
}
|
|
17849
|
+
return null;
|
|
17850
|
+
})
|
|
17851
|
+
]
|
|
17852
|
+
}
|
|
17853
|
+
) }),
|
|
17854
|
+
enableDraggableTooltips && activeTooltips.map((tooltip) => /* @__PURE__ */ (0, import_jsx_runtime97.jsx)(
|
|
17855
|
+
DraggableTooltip_default,
|
|
17856
|
+
{
|
|
17857
|
+
id: tooltip.id,
|
|
17858
|
+
data: adaptDataForTooltip(tooltip.data, xAxisConfig.dataKey),
|
|
17859
|
+
position: tooltip.position,
|
|
17860
|
+
title,
|
|
17861
|
+
dataKeys: allKeys,
|
|
17862
|
+
finalColors,
|
|
17863
|
+
highlightedSeries,
|
|
17864
|
+
toggleHighlight,
|
|
17865
|
+
showOnlyHighlighted,
|
|
17866
|
+
onClose: (id) => setActiveTooltips((prev) => prev.filter((t) => t.id !== id)),
|
|
17867
|
+
onPositionChange: onTooltipPositionChange,
|
|
17868
|
+
periodLabel,
|
|
17869
|
+
dataLabel: "Dados do Per\xEDodo",
|
|
17870
|
+
valueFormatter: finalValueFormatter,
|
|
17871
|
+
categoryFormatter,
|
|
17872
|
+
globalTooltipCount: activeTooltips.length,
|
|
17873
|
+
onCloseAll: () => window.dispatchEvent(new Event("closeAllTooltips")),
|
|
17874
|
+
closeAllButtonPosition: "top-center",
|
|
17875
|
+
closeAllButtonVariant: "floating"
|
|
17876
|
+
},
|
|
17877
|
+
tooltip.id
|
|
17878
|
+
)),
|
|
17879
|
+
enableDraggableTooltips && activeTooltips.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime97.jsx)(
|
|
17880
|
+
CloseAllButton_default,
|
|
17881
|
+
{
|
|
17882
|
+
count: activeTooltips.length,
|
|
17883
|
+
onCloseAll: () => window.dispatchEvent(new Event("closeAllTooltips")),
|
|
17884
|
+
position: "top-center",
|
|
17885
|
+
variant: "floating"
|
|
17886
|
+
}
|
|
17887
|
+
),
|
|
17888
|
+
timeSeriesConfig && /* @__PURE__ */ (0, import_jsx_runtime97.jsx)(
|
|
17889
|
+
Brush_default,
|
|
17890
|
+
{
|
|
17891
|
+
data,
|
|
17892
|
+
startIndex,
|
|
17893
|
+
endIndex,
|
|
17894
|
+
onMouseDown: handleMouseDown,
|
|
17895
|
+
brushRef,
|
|
17896
|
+
xAxisKey: xAxisConfig.dataKey,
|
|
17897
|
+
seriesOrder,
|
|
17898
|
+
finalColors,
|
|
17899
|
+
brushHeight: timeSeriesConfig.height,
|
|
17900
|
+
brushColor: timeSeriesConfig.brushColor,
|
|
17901
|
+
miniChartOpacity: timeSeriesConfig.miniChartOpacity,
|
|
17902
|
+
showGrid,
|
|
17903
|
+
gridColor,
|
|
17904
|
+
margin: {
|
|
17905
|
+
left: finalChartLeftMargin,
|
|
17906
|
+
right: finalChartRightMargin
|
|
17907
|
+
}
|
|
17908
|
+
}
|
|
17909
|
+
)
|
|
17910
|
+
]
|
|
17502
17911
|
}
|
|
17503
|
-
);
|
|
17912
|
+
) });
|
|
17504
17913
|
};
|
|
17505
17914
|
var Chart_default = Chart;
|
|
17506
17915
|
|
|
17507
17916
|
// src/components/ui/charts/BarChart.tsx
|
|
17508
|
-
var
|
|
17509
|
-
var
|
|
17510
|
-
var
|
|
17917
|
+
var import_react98 = require("react");
|
|
17918
|
+
var import_recharts3 = require("recharts");
|
|
17919
|
+
var import_jsx_runtime98 = require("react/jsx-runtime");
|
|
17511
17920
|
var DEFAULT_COLORS3 = ["#55af7d", "#8e68ff", "#2273e1"];
|
|
17512
17921
|
var BarChart = ({
|
|
17513
17922
|
data,
|
|
@@ -17537,7 +17946,7 @@ var BarChart = ({
|
|
|
17537
17946
|
containerPaddingLeft,
|
|
17538
17947
|
16
|
|
17539
17948
|
);
|
|
17540
|
-
const smartConfig = (0,
|
|
17949
|
+
const smartConfig = (0, import_react98.useMemo)(() => {
|
|
17541
17950
|
const providedMapper = yAxis ?? mapper;
|
|
17542
17951
|
if (autoDetect === true || xAxis == null || providedMapper == null) {
|
|
17543
17952
|
const detectedXAxis = detectXAxis(data);
|
|
@@ -17587,14 +17996,14 @@ var BarChart = ({
|
|
|
17587
17996
|
return { xAxisConfig: xAxisConfig2, mapperConfig: mapperConfig2 };
|
|
17588
17997
|
}, [data, xAxis, mapper, yAxis, autoDetect, labelMap]);
|
|
17589
17998
|
const { xAxisConfig, mapperConfig } = smartConfig;
|
|
17590
|
-
const [activeTooltips, setActiveTooltips] = (0,
|
|
17591
|
-
const [isDragging, setIsDragging] = (0,
|
|
17592
|
-
const [dragOffset, setDragOffset] = (0,
|
|
17999
|
+
const [activeTooltips, setActiveTooltips] = (0, import_react98.useState)([]);
|
|
18000
|
+
const [isDragging, setIsDragging] = (0, import_react98.useState)(null);
|
|
18001
|
+
const [dragOffset, setDragOffset] = (0, import_react98.useState)({
|
|
17593
18002
|
x: 0,
|
|
17594
18003
|
y: 0
|
|
17595
18004
|
});
|
|
17596
|
-
const [globalTooltipCount, setGlobalTooltipCount] = (0,
|
|
17597
|
-
const [alignmentGuides, setAlignmentGuides] = (0,
|
|
18005
|
+
const [globalTooltipCount, setGlobalTooltipCount] = (0, import_react98.useState)(0);
|
|
18006
|
+
const [alignmentGuides, setAlignmentGuides] = (0, import_react98.useState)([]);
|
|
17598
18007
|
const processedData = data.map((item) => ({
|
|
17599
18008
|
...item,
|
|
17600
18009
|
name: String(item[xAxisConfig.dataKey] || "N/A")
|
|
@@ -17617,7 +18026,7 @@ var BarChart = ({
|
|
|
17617
18026
|
// Garantir que tem a propriedade 'name'
|
|
17618
18027
|
};
|
|
17619
18028
|
};
|
|
17620
|
-
const maxDataValue = (0,
|
|
18029
|
+
const maxDataValue = (0, import_react98.useMemo)(() => {
|
|
17621
18030
|
let max = 0;
|
|
17622
18031
|
const keys = Object.keys(mapperConfig);
|
|
17623
18032
|
for (const row of processedData) {
|
|
@@ -17630,7 +18039,7 @@ var BarChart = ({
|
|
|
17630
18039
|
}
|
|
17631
18040
|
return max;
|
|
17632
18041
|
}, [processedData, mapperConfig]);
|
|
17633
|
-
const niceMax = (0,
|
|
18042
|
+
const niceMax = (0, import_react98.useMemo)(() => {
|
|
17634
18043
|
let padding2 = 0.08;
|
|
17635
18044
|
if (maxDataValue > 1e6) padding2 = 0.05;
|
|
17636
18045
|
if (maxDataValue > 1e7) padding2 = 0.03;
|
|
@@ -17671,7 +18080,7 @@ var BarChart = ({
|
|
|
17671
18080
|
const GUIDE_THRESHOLD2 = 60;
|
|
17672
18081
|
const STRONG_SNAP_THRESHOLD2 = 35;
|
|
17673
18082
|
const PRECISION_SNAP_THRESHOLD2 = 8;
|
|
17674
|
-
const updateAlignmentGuides = (0,
|
|
18083
|
+
const updateAlignmentGuides = (0, import_react98.useCallback)(
|
|
17675
18084
|
(draggedTooltipId, currentPosition) => {
|
|
17676
18085
|
if (!isDragging) return;
|
|
17677
18086
|
const getAllTooltips = () => {
|
|
@@ -17735,7 +18144,7 @@ var BarChart = ({
|
|
|
17735
18144
|
},
|
|
17736
18145
|
[isDragging, activeTooltips]
|
|
17737
18146
|
);
|
|
17738
|
-
const snapToGuides = (0,
|
|
18147
|
+
const snapToGuides = (0, import_react98.useCallback)(
|
|
17739
18148
|
(position) => {
|
|
17740
18149
|
const snappedPosition = { ...position };
|
|
17741
18150
|
let hasSnapped = false;
|
|
@@ -17797,7 +18206,7 @@ var BarChart = ({
|
|
|
17797
18206
|
setIsDragging(tooltipId);
|
|
17798
18207
|
setDragOffset({ x: offsetX, y: offsetY });
|
|
17799
18208
|
};
|
|
17800
|
-
(0,
|
|
18209
|
+
(0, import_react98.useEffect)(() => {
|
|
17801
18210
|
let rafId;
|
|
17802
18211
|
let lastMousePosition = { x: 0, y: 0 };
|
|
17803
18212
|
const handleGlobalMouseMove = (e) => {
|
|
@@ -17855,7 +18264,7 @@ var BarChart = ({
|
|
|
17855
18264
|
updateAlignmentGuides,
|
|
17856
18265
|
snapToGuides
|
|
17857
18266
|
]);
|
|
17858
|
-
(0,
|
|
18267
|
+
(0, import_react98.useEffect)(() => {
|
|
17859
18268
|
const handleCloseAllTooltips = () => {
|
|
17860
18269
|
setActiveTooltips([]);
|
|
17861
18270
|
setGlobalTooltipCount(0);
|
|
@@ -17865,7 +18274,7 @@ var BarChart = ({
|
|
|
17865
18274
|
window.removeEventListener("closeAllTooltips", handleCloseAllTooltips);
|
|
17866
18275
|
};
|
|
17867
18276
|
}, []);
|
|
17868
|
-
(0,
|
|
18277
|
+
(0, import_react98.useEffect)(() => {
|
|
17869
18278
|
const handleTooltipCountRequest = () => {
|
|
17870
18279
|
window.dispatchEvent(
|
|
17871
18280
|
new CustomEvent("tooltipCountResponse", {
|
|
@@ -17904,7 +18313,7 @@ var BarChart = ({
|
|
|
17904
18313
|
);
|
|
17905
18314
|
};
|
|
17906
18315
|
}, [activeTooltips]);
|
|
17907
|
-
(0,
|
|
18316
|
+
(0, import_react98.useEffect)(() => {
|
|
17908
18317
|
if (isDragging) return;
|
|
17909
18318
|
let totalCount = 0;
|
|
17910
18319
|
const handleCountResponse = (event) => {
|
|
@@ -17928,25 +18337,25 @@ var BarChart = ({
|
|
|
17928
18337
|
label
|
|
17929
18338
|
}) => {
|
|
17930
18339
|
if (!active || !payload) return null;
|
|
17931
|
-
return /* @__PURE__ */ (0,
|
|
17932
|
-
/* @__PURE__ */ (0,
|
|
18340
|
+
return /* @__PURE__ */ (0, import_jsx_runtime98.jsxs)("div", { className: "bg-card border border-border rounded-lg p-3 shadow-lg", children: [
|
|
18341
|
+
/* @__PURE__ */ (0, import_jsx_runtime98.jsx)("p", { className: "font-medium text-foreground mb-2", children: label }),
|
|
17933
18342
|
payload.map(
|
|
17934
|
-
(entry, index) => /* @__PURE__ */ (0,
|
|
17935
|
-
/* @__PURE__ */ (0,
|
|
18343
|
+
(entry, index) => /* @__PURE__ */ (0, import_jsx_runtime98.jsxs)("div", { className: "flex items-center gap-2 text-sm", children: [
|
|
18344
|
+
/* @__PURE__ */ (0, import_jsx_runtime98.jsx)(
|
|
17936
18345
|
"div",
|
|
17937
18346
|
{
|
|
17938
18347
|
className: "w-3 h-3 rounded-sm",
|
|
17939
18348
|
style: { backgroundColor: entry.color }
|
|
17940
18349
|
}
|
|
17941
18350
|
),
|
|
17942
|
-
/* @__PURE__ */ (0,
|
|
18351
|
+
/* @__PURE__ */ (0, import_jsx_runtime98.jsxs)("span", { className: "text-muted-foreground", children: [
|
|
17943
18352
|
entry.name,
|
|
17944
18353
|
":"
|
|
17945
18354
|
] }),
|
|
17946
|
-
/* @__PURE__ */ (0,
|
|
18355
|
+
/* @__PURE__ */ (0, import_jsx_runtime98.jsx)("span", { className: "text-foreground font-medium", children: entry.value?.toLocaleString("pt-BR") })
|
|
17947
18356
|
] }, index)
|
|
17948
18357
|
),
|
|
17949
|
-
/* @__PURE__ */ (0,
|
|
18358
|
+
/* @__PURE__ */ (0, import_jsx_runtime98.jsx)("p", { className: "text-xs text-muted-foreground mt-1", children: "Clique para fixar este tooltip" })
|
|
17950
18359
|
] });
|
|
17951
18360
|
};
|
|
17952
18361
|
const getTitleClassName = (position) => {
|
|
@@ -17960,7 +18369,7 @@ var BarChart = ({
|
|
|
17960
18369
|
return `${baseClasses} text-left`;
|
|
17961
18370
|
}
|
|
17962
18371
|
};
|
|
17963
|
-
return /* @__PURE__ */ (0,
|
|
18372
|
+
return /* @__PURE__ */ (0, import_jsx_runtime98.jsxs)(
|
|
17964
18373
|
"div",
|
|
17965
18374
|
{
|
|
17966
18375
|
className: cn("rounded-lg bg-card p-4 relative", className),
|
|
@@ -17969,9 +18378,9 @@ var BarChart = ({
|
|
|
17969
18378
|
maxWidth: "100%"
|
|
17970
18379
|
},
|
|
17971
18380
|
children: [
|
|
17972
|
-
title && /* @__PURE__ */ (0,
|
|
17973
|
-
/* @__PURE__ */ (0,
|
|
17974
|
-
|
|
18381
|
+
title && /* @__PURE__ */ (0, import_jsx_runtime98.jsx)("div", { style: { paddingLeft: `${resolvedContainerPaddingLeft}px` }, children: /* @__PURE__ */ (0, import_jsx_runtime98.jsx)("h3", { className: getTitleClassName(titlePosition), children: title }) }),
|
|
18382
|
+
/* @__PURE__ */ (0, import_jsx_runtime98.jsxs)(
|
|
18383
|
+
import_recharts3.BarChart,
|
|
17975
18384
|
{
|
|
17976
18385
|
data: processedData,
|
|
17977
18386
|
width: typeof width === "number" ? width : 900,
|
|
@@ -17979,16 +18388,16 @@ var BarChart = ({
|
|
|
17979
18388
|
margin: resolveChartMargins(margins, chartMargins, showLabels),
|
|
17980
18389
|
onClick: handleChartClick,
|
|
17981
18390
|
children: [
|
|
17982
|
-
showGrid && /* @__PURE__ */ (0,
|
|
17983
|
-
|
|
18391
|
+
showGrid && /* @__PURE__ */ (0, import_jsx_runtime98.jsx)(
|
|
18392
|
+
import_recharts3.CartesianGrid,
|
|
17984
18393
|
{
|
|
17985
18394
|
strokeDasharray: "3 3",
|
|
17986
18395
|
stroke: gridColor || "hsl(var(--muted-foreground))",
|
|
17987
18396
|
opacity: 0.5
|
|
17988
18397
|
}
|
|
17989
18398
|
),
|
|
17990
|
-
/* @__PURE__ */ (0,
|
|
17991
|
-
|
|
18399
|
+
/* @__PURE__ */ (0, import_jsx_runtime98.jsx)(
|
|
18400
|
+
import_recharts3.XAxis,
|
|
17992
18401
|
{
|
|
17993
18402
|
dataKey: xAxisConfig.dataKey,
|
|
17994
18403
|
stroke: "hsl(var(--muted-foreground))",
|
|
@@ -17998,8 +18407,8 @@ var BarChart = ({
|
|
|
17998
18407
|
tickFormatter: xAxisConfig.valueFormatter
|
|
17999
18408
|
}
|
|
18000
18409
|
),
|
|
18001
|
-
/* @__PURE__ */ (0,
|
|
18002
|
-
|
|
18410
|
+
/* @__PURE__ */ (0, import_jsx_runtime98.jsx)(
|
|
18411
|
+
import_recharts3.YAxis,
|
|
18003
18412
|
{
|
|
18004
18413
|
stroke: "hsl(var(--muted-foreground))",
|
|
18005
18414
|
fontSize: 12,
|
|
@@ -18010,15 +18419,15 @@ var BarChart = ({
|
|
|
18010
18419
|
tickCount: 6
|
|
18011
18420
|
}
|
|
18012
18421
|
),
|
|
18013
|
-
showTooltip && /* @__PURE__ */ (0,
|
|
18014
|
-
|
|
18422
|
+
showTooltip && /* @__PURE__ */ (0, import_jsx_runtime98.jsx)(
|
|
18423
|
+
import_recharts3.Tooltip,
|
|
18015
18424
|
{
|
|
18016
|
-
content: /* @__PURE__ */ (0,
|
|
18425
|
+
content: /* @__PURE__ */ (0, import_jsx_runtime98.jsx)(CustomTooltip, {}),
|
|
18017
18426
|
cursor: { fill: "hsl(var(--muted))", opacity: 0.1 }
|
|
18018
18427
|
}
|
|
18019
18428
|
),
|
|
18020
|
-
showLegend && /* @__PURE__ */ (0,
|
|
18021
|
-
|
|
18429
|
+
showLegend && /* @__PURE__ */ (0, import_jsx_runtime98.jsx)(
|
|
18430
|
+
import_recharts3.Legend,
|
|
18022
18431
|
{
|
|
18023
18432
|
wrapperStyle: {
|
|
18024
18433
|
color: "hsl(var(--foreground))",
|
|
@@ -18028,8 +18437,8 @@ var BarChart = ({
|
|
|
18028
18437
|
),
|
|
18029
18438
|
dataKeys.map((key) => {
|
|
18030
18439
|
const fieldConfig = mapperConfig[key];
|
|
18031
|
-
return /* @__PURE__ */ (0,
|
|
18032
|
-
|
|
18440
|
+
return /* @__PURE__ */ (0, import_jsx_runtime98.jsx)(
|
|
18441
|
+
import_recharts3.Bar,
|
|
18033
18442
|
{
|
|
18034
18443
|
dataKey: key,
|
|
18035
18444
|
name: fieldConfig?.label || key,
|
|
@@ -18037,8 +18446,8 @@ var BarChart = ({
|
|
|
18037
18446
|
radius: [4, 4, 0, 0],
|
|
18038
18447
|
onClick: handleBarClick,
|
|
18039
18448
|
style: { cursor: "pointer" },
|
|
18040
|
-
activeBar: /* @__PURE__ */ (0,
|
|
18041
|
-
|
|
18449
|
+
activeBar: /* @__PURE__ */ (0, import_jsx_runtime98.jsx)(
|
|
18450
|
+
import_recharts3.Rectangle,
|
|
18042
18451
|
{
|
|
18043
18452
|
fill: finalColors[key],
|
|
18044
18453
|
stroke: finalColors[key],
|
|
@@ -18046,8 +18455,8 @@ var BarChart = ({
|
|
|
18046
18455
|
opacity: 0.8
|
|
18047
18456
|
}
|
|
18048
18457
|
),
|
|
18049
|
-
children: showLabels && /* @__PURE__ */ (0,
|
|
18050
|
-
|
|
18458
|
+
children: showLabels && /* @__PURE__ */ (0, import_jsx_runtime98.jsx)(
|
|
18459
|
+
import_recharts3.LabelList,
|
|
18051
18460
|
{
|
|
18052
18461
|
dataKey: key,
|
|
18053
18462
|
position: "top",
|
|
@@ -18083,8 +18492,8 @@ var BarChart = ({
|
|
|
18083
18492
|
guide.sourceTooltip.top + guide.sourceTooltip.height / 2,
|
|
18084
18493
|
guide.targetTooltip.top + guide.targetTooltip.height / 2
|
|
18085
18494
|
);
|
|
18086
|
-
return /* @__PURE__ */ (0,
|
|
18087
|
-
/* @__PURE__ */ (0,
|
|
18495
|
+
return /* @__PURE__ */ (0, import_jsx_runtime98.jsxs)("div", { children: [
|
|
18496
|
+
/* @__PURE__ */ (0, import_jsx_runtime98.jsx)(
|
|
18088
18497
|
"div",
|
|
18089
18498
|
{
|
|
18090
18499
|
className: "fixed pointer-events-none z-30",
|
|
@@ -18103,7 +18512,7 @@ var BarChart = ({
|
|
|
18103
18512
|
}
|
|
18104
18513
|
}
|
|
18105
18514
|
),
|
|
18106
|
-
/* @__PURE__ */ (0,
|
|
18515
|
+
/* @__PURE__ */ (0, import_jsx_runtime98.jsx)(
|
|
18107
18516
|
"div",
|
|
18108
18517
|
{
|
|
18109
18518
|
className: "fixed pointer-events-none z-31",
|
|
@@ -18119,7 +18528,7 @@ var BarChart = ({
|
|
|
18119
18528
|
}
|
|
18120
18529
|
}
|
|
18121
18530
|
),
|
|
18122
|
-
/* @__PURE__ */ (0,
|
|
18531
|
+
/* @__PURE__ */ (0, import_jsx_runtime98.jsx)(
|
|
18123
18532
|
"div",
|
|
18124
18533
|
{
|
|
18125
18534
|
className: "fixed pointer-events-none z-31",
|
|
@@ -18137,7 +18546,7 @@ var BarChart = ({
|
|
|
18137
18546
|
)
|
|
18138
18547
|
] }, index);
|
|
18139
18548
|
}),
|
|
18140
|
-
activeTooltips.map((tooltip, index) => /* @__PURE__ */ (0,
|
|
18549
|
+
activeTooltips.map((tooltip, index) => /* @__PURE__ */ (0, import_jsx_runtime98.jsx)(
|
|
18141
18550
|
DraggableTooltip_default,
|
|
18142
18551
|
{
|
|
18143
18552
|
id: tooltip.id,
|
|
@@ -18170,9 +18579,9 @@ var BarChart = ({
|
|
|
18170
18579
|
var BarChart_default = BarChart;
|
|
18171
18580
|
|
|
18172
18581
|
// src/components/ui/charts/LineChart.tsx
|
|
18173
|
-
var
|
|
18174
|
-
var
|
|
18175
|
-
var
|
|
18582
|
+
var import_react99 = require("react");
|
|
18583
|
+
var import_recharts4 = require("recharts");
|
|
18584
|
+
var import_jsx_runtime99 = require("react/jsx-runtime");
|
|
18176
18585
|
var defaultData = [
|
|
18177
18586
|
{ name: "A", value: 100 },
|
|
18178
18587
|
{ name: "B", value: 200 },
|
|
@@ -18204,14 +18613,14 @@ var CustomLineChart = ({
|
|
|
18204
18613
|
containerPaddingLeft,
|
|
18205
18614
|
16
|
|
18206
18615
|
);
|
|
18207
|
-
const [activeTooltips, setActiveTooltips] = (0,
|
|
18208
|
-
const [isDragging, setIsDragging] = (0,
|
|
18209
|
-
const [dragOffset, setDragOffset] = (0,
|
|
18616
|
+
const [activeTooltips, setActiveTooltips] = (0, import_react99.useState)([]);
|
|
18617
|
+
const [isDragging, setIsDragging] = (0, import_react99.useState)(null);
|
|
18618
|
+
const [dragOffset, setDragOffset] = (0, import_react99.useState)({
|
|
18210
18619
|
x: 0,
|
|
18211
18620
|
y: 0
|
|
18212
18621
|
});
|
|
18213
|
-
const [globalTooltipCount, setGlobalTooltipCount] = (0,
|
|
18214
|
-
const [alignmentGuides, setAlignmentGuides] = (0,
|
|
18622
|
+
const [globalTooltipCount, setGlobalTooltipCount] = (0, import_react99.useState)(0);
|
|
18623
|
+
const [alignmentGuides, setAlignmentGuides] = (0, import_react99.useState)([]);
|
|
18215
18624
|
const generateColors = (dataKeys2) => {
|
|
18216
18625
|
const colorMap = {};
|
|
18217
18626
|
const allColors = generateAdditionalColors(colors2, dataKeys2.length);
|
|
@@ -18220,12 +18629,12 @@ var CustomLineChart = ({
|
|
|
18220
18629
|
});
|
|
18221
18630
|
return colorMap;
|
|
18222
18631
|
};
|
|
18223
|
-
const dataKeys = (0,
|
|
18632
|
+
const dataKeys = (0, import_react99.useMemo)(
|
|
18224
18633
|
() => data.length > 0 ? Object.keys(data[0]).filter((key) => key !== "name") : [],
|
|
18225
18634
|
[data]
|
|
18226
18635
|
);
|
|
18227
18636
|
const finalColors = generateColors(dataKeys);
|
|
18228
|
-
const maxDataValue = (0,
|
|
18637
|
+
const maxDataValue = (0, import_react99.useMemo)(() => {
|
|
18229
18638
|
let max = 0;
|
|
18230
18639
|
for (const row of data) {
|
|
18231
18640
|
const r = row;
|
|
@@ -18237,7 +18646,7 @@ var CustomLineChart = ({
|
|
|
18237
18646
|
}
|
|
18238
18647
|
return max;
|
|
18239
18648
|
}, [data, dataKeys]);
|
|
18240
|
-
const niceMax = (0,
|
|
18649
|
+
const niceMax = (0, import_react99.useMemo)(() => {
|
|
18241
18650
|
let padding2 = 0.08;
|
|
18242
18651
|
if (maxDataValue > 1e6) padding2 = 0.05;
|
|
18243
18652
|
if (maxDataValue > 1e7) padding2 = 0.03;
|
|
@@ -18271,7 +18680,7 @@ var CustomLineChart = ({
|
|
|
18271
18680
|
setActiveTooltips((prev) => [...prev, newTooltip]);
|
|
18272
18681
|
}
|
|
18273
18682
|
};
|
|
18274
|
-
return /* @__PURE__ */ (0,
|
|
18683
|
+
return /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(
|
|
18275
18684
|
"circle",
|
|
18276
18685
|
{
|
|
18277
18686
|
cx,
|
|
@@ -18313,10 +18722,10 @@ var CustomLineChart = ({
|
|
|
18313
18722
|
const handleChartBackgroundClick = () => {
|
|
18314
18723
|
setActiveTooltips([]);
|
|
18315
18724
|
};
|
|
18316
|
-
const handleCloseAllTooltips = (0,
|
|
18725
|
+
const handleCloseAllTooltips = (0, import_react99.useCallback)(() => {
|
|
18317
18726
|
window.dispatchEvent(new CustomEvent("closeAllTooltips"));
|
|
18318
18727
|
}, []);
|
|
18319
|
-
const updateAlignmentGuides = (0,
|
|
18728
|
+
const updateAlignmentGuides = (0, import_react99.useCallback)(
|
|
18320
18729
|
(draggedTooltipId, draggedPosition) => {
|
|
18321
18730
|
const SNAP_THRESHOLD = 15;
|
|
18322
18731
|
const draggedTooltip = activeTooltips.find(
|
|
@@ -18397,7 +18806,7 @@ var CustomLineChart = ({
|
|
|
18397
18806
|
},
|
|
18398
18807
|
[activeTooltips]
|
|
18399
18808
|
);
|
|
18400
|
-
const snapToGuides = (0,
|
|
18809
|
+
const snapToGuides = (0, import_react99.useCallback)(
|
|
18401
18810
|
(position) => {
|
|
18402
18811
|
const SNAP_DISTANCE = 10;
|
|
18403
18812
|
const snappedPosition = { ...position };
|
|
@@ -18425,7 +18834,7 @@ var CustomLineChart = ({
|
|
|
18425
18834
|
setIsDragging(tooltipId);
|
|
18426
18835
|
setDragOffset({ x: offsetX, y: offsetY });
|
|
18427
18836
|
};
|
|
18428
|
-
(0,
|
|
18837
|
+
(0, import_react99.useEffect)(() => {
|
|
18429
18838
|
let rafId;
|
|
18430
18839
|
let lastMousePosition = { x: 0, y: 0 };
|
|
18431
18840
|
const handleGlobalMouseMove = (e) => {
|
|
@@ -18472,7 +18881,7 @@ var CustomLineChart = ({
|
|
|
18472
18881
|
updateAlignmentGuides,
|
|
18473
18882
|
snapToGuides
|
|
18474
18883
|
]);
|
|
18475
|
-
(0,
|
|
18884
|
+
(0, import_react99.useEffect)(() => {
|
|
18476
18885
|
const handleCloseAllTooltips2 = () => {
|
|
18477
18886
|
setActiveTooltips([]);
|
|
18478
18887
|
setGlobalTooltipCount(0);
|
|
@@ -18482,7 +18891,7 @@ var CustomLineChart = ({
|
|
|
18482
18891
|
window.removeEventListener("closeAllTooltips", handleCloseAllTooltips2);
|
|
18483
18892
|
};
|
|
18484
18893
|
}, []);
|
|
18485
|
-
(0,
|
|
18894
|
+
(0, import_react99.useEffect)(() => {
|
|
18486
18895
|
const handleTooltipCountRequest = () => {
|
|
18487
18896
|
window.dispatchEvent(
|
|
18488
18897
|
new CustomEvent("tooltipCountResponse", {
|
|
@@ -18526,7 +18935,7 @@ var CustomLineChart = ({
|
|
|
18526
18935
|
);
|
|
18527
18936
|
};
|
|
18528
18937
|
}, [activeTooltips]);
|
|
18529
|
-
(0,
|
|
18938
|
+
(0, import_react99.useEffect)(() => {
|
|
18530
18939
|
if (isDragging) return;
|
|
18531
18940
|
let totalCount = 0;
|
|
18532
18941
|
const handleCountResponse = (event) => {
|
|
@@ -18554,7 +18963,7 @@ var CustomLineChart = ({
|
|
|
18554
18963
|
return "text-left";
|
|
18555
18964
|
}
|
|
18556
18965
|
};
|
|
18557
|
-
return /* @__PURE__ */ (0,
|
|
18966
|
+
return /* @__PURE__ */ (0, import_jsx_runtime99.jsx)("div", { className: cn("relative", className), children: /* @__PURE__ */ (0, import_jsx_runtime99.jsxs)(
|
|
18558
18967
|
"div",
|
|
18559
18968
|
{
|
|
18560
18969
|
className: "rounded-lg bg-card p-4 relative border border-border",
|
|
@@ -18564,9 +18973,9 @@ var CustomLineChart = ({
|
|
|
18564
18973
|
},
|
|
18565
18974
|
onClick: handleChartBackgroundClick,
|
|
18566
18975
|
children: [
|
|
18567
|
-
title && /* @__PURE__ */ (0,
|
|
18568
|
-
/* @__PURE__ */ (0,
|
|
18569
|
-
|
|
18976
|
+
title && /* @__PURE__ */ (0, import_jsx_runtime99.jsx)("div", { style: { paddingLeft: `${resolvedContainerPaddingLeft}px` }, children: /* @__PURE__ */ (0, import_jsx_runtime99.jsx)("div", { className: cn("mb-4", getTitleClass()), children: /* @__PURE__ */ (0, import_jsx_runtime99.jsx)("h3", { className: "text-lg font-semibold text-foreground", children: title }) }) }),
|
|
18977
|
+
/* @__PURE__ */ (0, import_jsx_runtime99.jsxs)(
|
|
18978
|
+
import_recharts4.LineChart,
|
|
18570
18979
|
{
|
|
18571
18980
|
data,
|
|
18572
18981
|
width: typeof width === "number" ? width : 900,
|
|
@@ -18574,24 +18983,24 @@ var CustomLineChart = ({
|
|
|
18574
18983
|
margin: resolveChartMargins(margins, chartMargins, showLabels),
|
|
18575
18984
|
onClick: handleChartClick,
|
|
18576
18985
|
children: [
|
|
18577
|
-
showGrid && /* @__PURE__ */ (0,
|
|
18578
|
-
|
|
18986
|
+
showGrid && /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(
|
|
18987
|
+
import_recharts4.CartesianGrid,
|
|
18579
18988
|
{
|
|
18580
18989
|
strokeDasharray: "3 3",
|
|
18581
18990
|
stroke: gridColor || "hsl(var(--muted-foreground))",
|
|
18582
18991
|
opacity: 0.3
|
|
18583
18992
|
}
|
|
18584
18993
|
),
|
|
18585
|
-
/* @__PURE__ */ (0,
|
|
18586
|
-
|
|
18994
|
+
/* @__PURE__ */ (0, import_jsx_runtime99.jsx)(
|
|
18995
|
+
import_recharts4.XAxis,
|
|
18587
18996
|
{
|
|
18588
18997
|
dataKey: "name",
|
|
18589
18998
|
className: "fill-muted-foreground text-xs",
|
|
18590
18999
|
fontSize: 12
|
|
18591
19000
|
}
|
|
18592
19001
|
),
|
|
18593
|
-
/* @__PURE__ */ (0,
|
|
18594
|
-
|
|
19002
|
+
/* @__PURE__ */ (0, import_jsx_runtime99.jsx)(
|
|
19003
|
+
import_recharts4.YAxis,
|
|
18595
19004
|
{
|
|
18596
19005
|
className: "fill-muted-foreground text-xs",
|
|
18597
19006
|
fontSize: 12,
|
|
@@ -18600,9 +19009,9 @@ var CustomLineChart = ({
|
|
|
18600
19009
|
tickCount: 6
|
|
18601
19010
|
}
|
|
18602
19011
|
),
|
|
18603
|
-
showTooltip && /* @__PURE__ */ (0,
|
|
18604
|
-
showLegend && /* @__PURE__ */ (0,
|
|
18605
|
-
|
|
19012
|
+
showTooltip && /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(import_recharts4.Tooltip, { content: () => null }),
|
|
19013
|
+
showLegend && /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(
|
|
19014
|
+
import_recharts4.Legend,
|
|
18606
19015
|
{
|
|
18607
19016
|
wrapperStyle: {
|
|
18608
19017
|
fontSize: "12px",
|
|
@@ -18610,17 +19019,17 @@ var CustomLineChart = ({
|
|
|
18610
19019
|
}
|
|
18611
19020
|
}
|
|
18612
19021
|
),
|
|
18613
|
-
dataKeys.map((key) => /* @__PURE__ */ (0,
|
|
18614
|
-
|
|
19022
|
+
dataKeys.map((key) => /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(
|
|
19023
|
+
import_recharts4.Line,
|
|
18615
19024
|
{
|
|
18616
19025
|
type: "monotone",
|
|
18617
19026
|
dataKey: key,
|
|
18618
19027
|
stroke: finalColors[key],
|
|
18619
19028
|
strokeWidth,
|
|
18620
19029
|
dot: showDots ? { r: 4, cursor: "pointer" } : false,
|
|
18621
|
-
activeDot: (props) => /* @__PURE__ */ (0,
|
|
18622
|
-
children: showLabels && /* @__PURE__ */ (0,
|
|
18623
|
-
|
|
19030
|
+
activeDot: (props) => /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(ClickableDot, { ...props, dataKey: key }),
|
|
19031
|
+
children: showLabels && /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(
|
|
19032
|
+
import_recharts4.LabelList,
|
|
18624
19033
|
{
|
|
18625
19034
|
dataKey: key,
|
|
18626
19035
|
position: "top",
|
|
@@ -18656,8 +19065,8 @@ var CustomLineChart = ({
|
|
|
18656
19065
|
guide.sourceTooltip.top + guide.sourceTooltip.height / 2,
|
|
18657
19066
|
guide.targetTooltip.top + guide.targetTooltip.height / 2
|
|
18658
19067
|
);
|
|
18659
|
-
return /* @__PURE__ */ (0,
|
|
18660
|
-
/* @__PURE__ */ (0,
|
|
19068
|
+
return /* @__PURE__ */ (0, import_jsx_runtime99.jsxs)("div", { children: [
|
|
19069
|
+
/* @__PURE__ */ (0, import_jsx_runtime99.jsx)(
|
|
18661
19070
|
"div",
|
|
18662
19071
|
{
|
|
18663
19072
|
className: "fixed pointer-events-none z-30",
|
|
@@ -18676,7 +19085,7 @@ var CustomLineChart = ({
|
|
|
18676
19085
|
}
|
|
18677
19086
|
}
|
|
18678
19087
|
),
|
|
18679
|
-
/* @__PURE__ */ (0,
|
|
19088
|
+
/* @__PURE__ */ (0, import_jsx_runtime99.jsx)(
|
|
18680
19089
|
"div",
|
|
18681
19090
|
{
|
|
18682
19091
|
className: "fixed pointer-events-none z-31",
|
|
@@ -18692,7 +19101,7 @@ var CustomLineChart = ({
|
|
|
18692
19101
|
}
|
|
18693
19102
|
}
|
|
18694
19103
|
),
|
|
18695
|
-
/* @__PURE__ */ (0,
|
|
19104
|
+
/* @__PURE__ */ (0, import_jsx_runtime99.jsx)(
|
|
18696
19105
|
"div",
|
|
18697
19106
|
{
|
|
18698
19107
|
className: "fixed pointer-events-none z-31",
|
|
@@ -18710,7 +19119,7 @@ var CustomLineChart = ({
|
|
|
18710
19119
|
)
|
|
18711
19120
|
] }, index);
|
|
18712
19121
|
}),
|
|
18713
|
-
activeTooltips.map((tooltip, index) => /* @__PURE__ */ (0,
|
|
19122
|
+
activeTooltips.map((tooltip, index) => /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(
|
|
18714
19123
|
DraggableTooltip_default,
|
|
18715
19124
|
{
|
|
18716
19125
|
id: tooltip.id,
|
|
@@ -18741,8 +19150,8 @@ var CustomLineChart = ({
|
|
|
18741
19150
|
var LineChart_default = CustomLineChart;
|
|
18742
19151
|
|
|
18743
19152
|
// src/components/ui/charts/PieChart.tsx
|
|
18744
|
-
var
|
|
18745
|
-
var
|
|
19153
|
+
var import_recharts5 = require("recharts");
|
|
19154
|
+
var import_jsx_runtime100 = require("react/jsx-runtime");
|
|
18746
19155
|
var defaultData2 = [
|
|
18747
19156
|
{ name: "Vendas", value: 4e3 },
|
|
18748
19157
|
{ name: "Marketing", value: 3e3 },
|
|
@@ -18780,7 +19189,7 @@ var renderCustomizedLabel = ({
|
|
|
18780
19189
|
const radius = innerRadius + (outerRadius - innerRadius) * 0.5;
|
|
18781
19190
|
const x = cx + radius * Math.cos(-midAngle * RADIAN);
|
|
18782
19191
|
const y = cy + radius * Math.sin(-midAngle * RADIAN);
|
|
18783
|
-
return /* @__PURE__ */ (0,
|
|
19192
|
+
return /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(
|
|
18784
19193
|
"text",
|
|
18785
19194
|
{
|
|
18786
19195
|
x,
|
|
@@ -18809,9 +19218,9 @@ var CustomPieChart = ({
|
|
|
18809
19218
|
centerY = "50%"
|
|
18810
19219
|
}) => {
|
|
18811
19220
|
const finalColors = colors2 || DEFAULT_COLORS5;
|
|
18812
|
-
return /* @__PURE__ */ (0,
|
|
18813
|
-
/* @__PURE__ */ (0,
|
|
18814
|
-
|
|
19221
|
+
return /* @__PURE__ */ (0, import_jsx_runtime100.jsx)("div", { className: cn("w-full rounded-lg bg-card p-4", className), children: /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(import_recharts5.ResponsiveContainer, { width, height, children: /* @__PURE__ */ (0, import_jsx_runtime100.jsxs)(import_recharts5.PieChart, { children: [
|
|
19222
|
+
/* @__PURE__ */ (0, import_jsx_runtime100.jsx)(
|
|
19223
|
+
import_recharts5.Pie,
|
|
18815
19224
|
{
|
|
18816
19225
|
data,
|
|
18817
19226
|
cx: centerX,
|
|
@@ -18822,8 +19231,8 @@ var CustomPieChart = ({
|
|
|
18822
19231
|
innerRadius,
|
|
18823
19232
|
fill: "#8884d8",
|
|
18824
19233
|
dataKey: "value",
|
|
18825
|
-
children: data.map((entry, index) => /* @__PURE__ */ (0,
|
|
18826
|
-
|
|
19234
|
+
children: data.map((entry, index) => /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(
|
|
19235
|
+
import_recharts5.Cell,
|
|
18827
19236
|
{
|
|
18828
19237
|
fill: finalColors[index % finalColors.length]
|
|
18829
19238
|
},
|
|
@@ -18831,8 +19240,8 @@ var CustomPieChart = ({
|
|
|
18831
19240
|
))
|
|
18832
19241
|
}
|
|
18833
19242
|
),
|
|
18834
|
-
showTooltip && /* @__PURE__ */ (0,
|
|
18835
|
-
|
|
19243
|
+
showTooltip && /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(
|
|
19244
|
+
import_recharts5.Tooltip,
|
|
18836
19245
|
{
|
|
18837
19246
|
contentStyle: {
|
|
18838
19247
|
backgroundColor: "hsl(var(--popover))",
|
|
@@ -18842,96 +19251,154 @@ var CustomPieChart = ({
|
|
|
18842
19251
|
}
|
|
18843
19252
|
}
|
|
18844
19253
|
),
|
|
18845
|
-
showLegend && /* @__PURE__ */ (0,
|
|
19254
|
+
showLegend && /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(import_recharts5.Legend, {})
|
|
18846
19255
|
] }) }) });
|
|
18847
19256
|
};
|
|
18848
19257
|
var PieChart_default = CustomPieChart;
|
|
18849
19258
|
|
|
19259
|
+
// src/components/ui/charts/TimeSeries.tsx
|
|
19260
|
+
var import_jsx_runtime101 = require("react/jsx-runtime");
|
|
19261
|
+
var TimeSeries = ({
|
|
19262
|
+
data,
|
|
19263
|
+
xAxis,
|
|
19264
|
+
chartHeight = 350,
|
|
19265
|
+
height,
|
|
19266
|
+
brushHeight,
|
|
19267
|
+
className,
|
|
19268
|
+
start,
|
|
19269
|
+
end,
|
|
19270
|
+
defaultStartIndex,
|
|
19271
|
+
defaultEndIndex,
|
|
19272
|
+
onRangeChange,
|
|
19273
|
+
brushColor,
|
|
19274
|
+
brushStroke,
|
|
19275
|
+
miniChartOpacity = 0.2,
|
|
19276
|
+
...rest
|
|
19277
|
+
}) => {
|
|
19278
|
+
const brushHeightValue = brushHeight ?? height ?? 60;
|
|
19279
|
+
const startIndex = defaultStartIndex ?? start ?? 0;
|
|
19280
|
+
const endIndex = defaultEndIndex ?? end;
|
|
19281
|
+
return /* @__PURE__ */ (0, import_jsx_runtime101.jsx)("div", { className: cn("w-full flex flex-col", className), children: /* @__PURE__ */ (0, import_jsx_runtime101.jsx)(
|
|
19282
|
+
Chart_default,
|
|
19283
|
+
{
|
|
19284
|
+
...rest,
|
|
19285
|
+
data,
|
|
19286
|
+
xAxis,
|
|
19287
|
+
height: chartHeight + brushHeightValue + 40,
|
|
19288
|
+
timeSeries: {
|
|
19289
|
+
start: startIndex,
|
|
19290
|
+
end: endIndex,
|
|
19291
|
+
onRangeChange,
|
|
19292
|
+
height: brushHeightValue,
|
|
19293
|
+
brushColor,
|
|
19294
|
+
brushStroke,
|
|
19295
|
+
miniChartOpacity
|
|
19296
|
+
}
|
|
19297
|
+
}
|
|
19298
|
+
) });
|
|
19299
|
+
};
|
|
19300
|
+
var TimeSeries_default = TimeSeries;
|
|
19301
|
+
|
|
18850
19302
|
// src/components/ui/LeaderBoard.tsx
|
|
18851
|
-
var
|
|
18852
|
-
var
|
|
19303
|
+
var import_react100 = require("@phosphor-icons/react");
|
|
19304
|
+
var import_react101 = require("react");
|
|
18853
19305
|
var import_framer_motion22 = require("framer-motion");
|
|
18854
|
-
var
|
|
19306
|
+
var import_jsx_runtime102 = require("react/jsx-runtime");
|
|
18855
19307
|
function Leaderboard({
|
|
18856
19308
|
items,
|
|
18857
19309
|
order: initialOrder = "desc",
|
|
18858
19310
|
title = "LeaderBoard",
|
|
18859
19311
|
className,
|
|
18860
|
-
isLoading = false
|
|
19312
|
+
isLoading = false,
|
|
19313
|
+
legend
|
|
18861
19314
|
}) {
|
|
18862
|
-
const [order, setOrder] = (0,
|
|
19315
|
+
const [order, setOrder] = (0, import_react101.useState)(initialOrder);
|
|
18863
19316
|
const mockData = [
|
|
18864
|
-
{ name: "Ana",
|
|
18865
|
-
{ name: "Bruno",
|
|
18866
|
-
{ name: "Carla",
|
|
18867
|
-
{ name: "Daniel",
|
|
18868
|
-
{ name: "Eduardo",
|
|
18869
|
-
{ name: "Fernanda",
|
|
18870
|
-
{ name: "Gabriela",
|
|
18871
|
-
{ name: "Heitor",
|
|
18872
|
-
{ name: "Isabela",
|
|
18873
|
-
{ name: "Jo\xE3o",
|
|
19317
|
+
{ name: "Ana", value: 92 },
|
|
19318
|
+
{ name: "Bruno", value: 81 },
|
|
19319
|
+
{ name: "Carla", value: 74 },
|
|
19320
|
+
{ name: "Daniel", value: 68 },
|
|
19321
|
+
{ name: "Eduardo", value: 55 },
|
|
19322
|
+
{ name: "Fernanda", value: 44 },
|
|
19323
|
+
{ name: "Gabriela", value: 33 },
|
|
19324
|
+
{ name: "Heitor", value: 28 },
|
|
19325
|
+
{ name: "Isabela", value: 22 },
|
|
19326
|
+
{ name: "Jo\xE3o", value: 18 }
|
|
18874
19327
|
];
|
|
18875
19328
|
const data = items ?? mockData;
|
|
18876
|
-
const sortedData = [...data].sort(
|
|
18877
|
-
|
|
18878
|
-
|
|
18879
|
-
|
|
18880
|
-
|
|
18881
|
-
|
|
19329
|
+
const sortedData = [...data].sort((a, b) => {
|
|
19330
|
+
const aValue = typeof a.value === "string" ? parseFloat(a.value) || a.value : a.value;
|
|
19331
|
+
const bValue = typeof b.value === "string" ? parseFloat(b.value) || b.value : b.value;
|
|
19332
|
+
if (typeof aValue === "number" && typeof bValue === "number") {
|
|
19333
|
+
return order === "desc" ? bValue - aValue : aValue - bValue;
|
|
19334
|
+
}
|
|
19335
|
+
if (typeof aValue === "string" && typeof bValue === "string") {
|
|
19336
|
+
return order === "desc" ? bValue.localeCompare(aValue) : aValue.localeCompare(bValue);
|
|
19337
|
+
}
|
|
19338
|
+
if (typeof aValue === "number") return order === "desc" ? -1 : 1;
|
|
19339
|
+
return order === "desc" ? 1 : -1;
|
|
19340
|
+
});
|
|
19341
|
+
const getBadgeColor = (value) => {
|
|
19342
|
+
const numValue = typeof value === "string" ? parseFloat(value) : value;
|
|
19343
|
+
if (isNaN(numValue)) return "green";
|
|
19344
|
+
if (numValue >= 75) return "red";
|
|
19345
|
+
if (numValue >= 25) return "yellow";
|
|
18882
19346
|
return "green";
|
|
18883
19347
|
};
|
|
18884
|
-
return /* @__PURE__ */ (0,
|
|
19348
|
+
return /* @__PURE__ */ (0, import_jsx_runtime102.jsxs)(
|
|
18885
19349
|
"div",
|
|
18886
19350
|
{
|
|
18887
19351
|
className: `border rounded-xl flex flex-col max-h-80 w-96 ${className}`,
|
|
18888
19352
|
children: [
|
|
18889
|
-
/* @__PURE__ */ (0,
|
|
18890
|
-
/* @__PURE__ */ (0,
|
|
18891
|
-
/* @__PURE__ */ (0,
|
|
19353
|
+
/* @__PURE__ */ (0, import_jsx_runtime102.jsxs)("div", { className: "flex items-center justify-between py-2 px-4 border-b flex-shrink-0 gap-3", children: [
|
|
19354
|
+
/* @__PURE__ */ (0, import_jsx_runtime102.jsx)("h2", { className: "text-lg font-semibold px-1", children: title }),
|
|
19355
|
+
/* @__PURE__ */ (0, import_jsx_runtime102.jsx)(
|
|
18892
19356
|
ButtonBase,
|
|
18893
19357
|
{
|
|
18894
19358
|
size: "icon",
|
|
18895
19359
|
variant: "ghost",
|
|
18896
19360
|
onClick: () => setOrder(order === "desc" ? "asc" : "desc"),
|
|
18897
19361
|
disabled: isLoading || sortedData.length === 0,
|
|
18898
|
-
children: /* @__PURE__ */ (0,
|
|
19362
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime102.jsx)(import_react100.CaretUpDownIcon, {})
|
|
18899
19363
|
}
|
|
18900
19364
|
)
|
|
18901
19365
|
] }),
|
|
18902
|
-
/* @__PURE__ */ (0,
|
|
18903
|
-
/* @__PURE__ */ (0,
|
|
18904
|
-
/* @__PURE__ */ (0,
|
|
18905
|
-
/* @__PURE__ */ (0,
|
|
19366
|
+
/* @__PURE__ */ (0, import_jsx_runtime102.jsx)("div", { className: "overflow-y-auto flex-1", children: isLoading ? /* @__PURE__ */ (0, import_jsx_runtime102.jsx)("div", { className: "p-4 space-y-3", children: Array.from({ length: 5 }).map((_, idx) => /* @__PURE__ */ (0, import_jsx_runtime102.jsxs)("div", { className: "flex items-center justify-between p-1", children: [
|
|
19367
|
+
/* @__PURE__ */ (0, import_jsx_runtime102.jsxs)("div", { className: "flex items-center gap-3 flex-1", children: [
|
|
19368
|
+
/* @__PURE__ */ (0, import_jsx_runtime102.jsx)(SkeletonBase, { className: "w-8 h-8 rounded-full" }),
|
|
19369
|
+
/* @__PURE__ */ (0, import_jsx_runtime102.jsx)(SkeletonBase, { className: "h-4 w-36" })
|
|
18906
19370
|
] }),
|
|
18907
|
-
/* @__PURE__ */ (0,
|
|
18908
|
-
] }, idx)) }) : sortedData.length === 0 ? /* @__PURE__ */ (0,
|
|
18909
|
-
|
|
18910
|
-
|
|
18911
|
-
|
|
18912
|
-
|
|
18913
|
-
|
|
18914
|
-
|
|
18915
|
-
|
|
18916
|
-
|
|
18917
|
-
|
|
18918
|
-
|
|
18919
|
-
/* @__PURE__ */ (0,
|
|
18920
|
-
|
|
18921
|
-
|
|
18922
|
-
|
|
18923
|
-
|
|
18924
|
-
|
|
18925
|
-
|
|
18926
|
-
|
|
18927
|
-
|
|
18928
|
-
|
|
18929
|
-
|
|
18930
|
-
|
|
18931
|
-
|
|
18932
|
-
|
|
18933
|
-
|
|
18934
|
-
|
|
19371
|
+
/* @__PURE__ */ (0, import_jsx_runtime102.jsx)(SkeletonBase, { className: "h-6 w-12 rounded-full" })
|
|
19372
|
+
] }, idx)) }) : sortedData.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime102.jsx)("div", { className: "flex items-center justify-center h-full py-12", children: /* @__PURE__ */ (0, import_jsx_runtime102.jsx)("p", { className: "text-muted-foreground text-sm", children: "Sem dados dispon\xEDveis" }) }) : /* @__PURE__ */ (0, import_jsx_runtime102.jsxs)("div", { children: [
|
|
19373
|
+
/* @__PURE__ */ (0, import_jsx_runtime102.jsxs)("div", { className: "flex items-center justify-between py-2.5 px-4 border-b flex-shrink-0 gap-3 sticky top-0 bg-background", children: [
|
|
19374
|
+
/* @__PURE__ */ (0, import_jsx_runtime102.jsx)("div", { className: "text-xs font-medium text-muted-foreground uppercase tracking-wider pl-1", children: legend?.[0]?.[0] ?? "Participante" }),
|
|
19375
|
+
/* @__PURE__ */ (0, import_jsx_runtime102.jsx)("div", { className: "text-xs font-medium text-muted-foreground uppercase tracking-wider", children: legend?.[0]?.[1] ?? "Pontua\xE7\xE3o" })
|
|
19376
|
+
] }),
|
|
19377
|
+
/* @__PURE__ */ (0, import_jsx_runtime102.jsx)("ul", { children: sortedData.map((item, idx) => /* @__PURE__ */ (0, import_jsx_runtime102.jsx)(
|
|
19378
|
+
import_framer_motion22.motion.span,
|
|
19379
|
+
{
|
|
19380
|
+
initial: { opacity: 0, y: 10 },
|
|
19381
|
+
animate: { opacity: 1, y: 0 },
|
|
19382
|
+
transition: { delay: idx * 5e-3 },
|
|
19383
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime102.jsxs)("li", { className: "flex items-center justify-between py-3 border-b last:border-b-0 hover:bg-muted transition-colors px-4", children: [
|
|
19384
|
+
/* @__PURE__ */ (0, import_jsx_runtime102.jsxs)("div", { className: "flex items-center gap-3", children: [
|
|
19385
|
+
/* @__PURE__ */ (0, import_jsx_runtime102.jsx)("span", { className: "text-sm text-gray-400 w-6 h-6 border rounded-full text-center bg-muted/50", children: idx + 1 }),
|
|
19386
|
+
/* @__PURE__ */ (0, import_jsx_runtime102.jsx)("span", { className: "font-medium", children: item.name })
|
|
19387
|
+
] }),
|
|
19388
|
+
/* @__PURE__ */ (0, import_jsx_runtime102.jsx)(
|
|
19389
|
+
Badge,
|
|
19390
|
+
{
|
|
19391
|
+
color: getBadgeColor(item.value),
|
|
19392
|
+
size: "md",
|
|
19393
|
+
className: "font-bold",
|
|
19394
|
+
children: item.value
|
|
19395
|
+
}
|
|
19396
|
+
)
|
|
19397
|
+
] })
|
|
19398
|
+
},
|
|
19399
|
+
idx
|
|
19400
|
+
)) })
|
|
19401
|
+
] }) })
|
|
18935
19402
|
]
|
|
18936
19403
|
}
|
|
18937
19404
|
);
|