@mlw-packages/react-components 1.8.8 → 1.8.10
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 +161 -3
- package/dist/index.d.mts +115 -89
- package/dist/index.d.ts +115 -89
- package/dist/index.js +549 -237
- package/dist/index.mjs +550 -239
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -688,7 +688,7 @@ var DialogContentBase = React33__namespace.forwardRef(
|
|
|
688
688
|
{
|
|
689
689
|
ref,
|
|
690
690
|
className: cn(
|
|
691
|
-
"fixed left-[50%] top-[50%] z-50
|
|
691
|
+
"fixed left-[50%] top-[50%] z-50 w-lg grid translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg max-h-[100dvh] overflow-auto rounded-md border-border",
|
|
692
692
|
className
|
|
693
693
|
),
|
|
694
694
|
"data-testid": dataTestId,
|
|
@@ -697,7 +697,7 @@ var DialogContentBase = React33__namespace.forwardRef(
|
|
|
697
697
|
children: [
|
|
698
698
|
children,
|
|
699
699
|
/* @__PURE__ */ jsxRuntime.jsxs(DialogPrimitive__namespace.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: [
|
|
700
|
-
/* @__PURE__ */ jsxRuntime.jsx(react.XIcon, { className: "h-
|
|
700
|
+
/* @__PURE__ */ jsxRuntime.jsx(react.XIcon, { className: "h-6 w-6 sm:h-4 sm:w-4 hover:text-red-500 font-extrabold" }),
|
|
701
701
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Close" })
|
|
702
702
|
] })
|
|
703
703
|
]
|
|
@@ -1070,7 +1070,7 @@ var ProgressBase = React33__namespace.forwardRef(
|
|
|
1070
1070
|
]
|
|
1071
1071
|
}
|
|
1072
1072
|
),
|
|
1073
|
-
showValue && valuePosition === "right" && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "
|
|
1073
|
+
showValue && valuePosition === "right" && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: " text-sm font-bold text-left", children: [
|
|
1074
1074
|
Math.round(value || 0),
|
|
1075
1075
|
"%"
|
|
1076
1076
|
] }),
|
|
@@ -1332,35 +1332,55 @@ var useDrag = (options = {}) => {
|
|
|
1332
1332
|
const [positions, setPositions] = React33.useState({});
|
|
1333
1333
|
const dragStartPos = React33.useRef(null);
|
|
1334
1334
|
const dragId = React33.useRef(null);
|
|
1335
|
-
const
|
|
1336
|
-
e
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
[
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1335
|
+
const handleDragStart = React33.useCallback(
|
|
1336
|
+
(id, e) => {
|
|
1337
|
+
const isTouchEvent = "touches" in e;
|
|
1338
|
+
const clientX = isTouchEvent ? e.touches[0].clientX : e.clientX;
|
|
1339
|
+
const clientY = isTouchEvent ? e.touches[0].clientY : e.clientY;
|
|
1340
|
+
if (!isTouchEvent) {
|
|
1341
|
+
e.preventDefault();
|
|
1342
|
+
}
|
|
1343
|
+
const currentPosition = positions[id] || { top: 0, left: 0 };
|
|
1344
|
+
dragStartPos.current = {
|
|
1345
|
+
x: clientX,
|
|
1346
|
+
y: clientY,
|
|
1347
|
+
elementX: currentPosition.left,
|
|
1348
|
+
elementY: currentPosition.top
|
|
1349
|
+
};
|
|
1350
|
+
dragId.current = id;
|
|
1351
|
+
setIsDragging(id);
|
|
1352
|
+
options.onDragStart?.(id);
|
|
1353
|
+
},
|
|
1354
|
+
[positions, options]
|
|
1355
|
+
);
|
|
1356
|
+
const handleMouseMove = React33.useCallback(
|
|
1357
|
+
(e) => {
|
|
1358
|
+
if (!isDragging || !dragStartPos.current || !dragId.current) return;
|
|
1359
|
+
const isTouchEvent = "touches" in e;
|
|
1360
|
+
const clientX = isTouchEvent ? e.touches[0].clientX : e.clientX;
|
|
1361
|
+
const clientY = isTouchEvent ? e.touches[0].clientY : e.clientY;
|
|
1362
|
+
const deltaX = clientX - dragStartPos.current.x;
|
|
1363
|
+
const deltaY = clientY - dragStartPos.current.y;
|
|
1364
|
+
const newPosition = {
|
|
1365
|
+
left: dragStartPos.current.elementX + deltaX,
|
|
1366
|
+
top: dragStartPos.current.elementY + deltaY
|
|
1367
|
+
};
|
|
1368
|
+
newPosition.left = Math.max(
|
|
1369
|
+
0,
|
|
1370
|
+
Math.min(window.innerWidth - 300, newPosition.left)
|
|
1371
|
+
);
|
|
1372
|
+
newPosition.top = Math.max(
|
|
1373
|
+
0,
|
|
1374
|
+
Math.min(window.innerHeight - 200, newPosition.top)
|
|
1375
|
+
);
|
|
1376
|
+
setPositions((prev) => ({
|
|
1377
|
+
...prev,
|
|
1378
|
+
[dragId.current]: newPosition
|
|
1379
|
+
}));
|
|
1380
|
+
options.onDrag?.(dragId.current, newPosition);
|
|
1381
|
+
},
|
|
1382
|
+
[isDragging, options]
|
|
1383
|
+
);
|
|
1364
1384
|
const handleMouseUp = React33.useCallback(() => {
|
|
1365
1385
|
if (dragId.current) {
|
|
1366
1386
|
options.onDragEnd?.(dragId.current);
|
|
@@ -1373,10 +1393,16 @@ var useDrag = (options = {}) => {
|
|
|
1373
1393
|
if (isDragging) {
|
|
1374
1394
|
document.addEventListener("mousemove", handleMouseMove);
|
|
1375
1395
|
document.addEventListener("mouseup", handleMouseUp);
|
|
1396
|
+
document.addEventListener("touchmove", handleMouseMove, {
|
|
1397
|
+
passive: false
|
|
1398
|
+
});
|
|
1399
|
+
document.addEventListener("touchend", handleMouseUp);
|
|
1376
1400
|
document.body.style.userSelect = "none";
|
|
1377
1401
|
return () => {
|
|
1378
1402
|
document.removeEventListener("mousemove", handleMouseMove);
|
|
1379
1403
|
document.removeEventListener("mouseup", handleMouseUp);
|
|
1404
|
+
document.removeEventListener("touchmove", handleMouseMove);
|
|
1405
|
+
document.removeEventListener("touchend", handleMouseUp);
|
|
1380
1406
|
document.body.style.userSelect = "";
|
|
1381
1407
|
};
|
|
1382
1408
|
}
|
|
@@ -1387,14 +1413,20 @@ var useDrag = (options = {}) => {
|
|
|
1387
1413
|
[id]: position
|
|
1388
1414
|
}));
|
|
1389
1415
|
}, []);
|
|
1390
|
-
const getPosition = React33.useCallback(
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1416
|
+
const getPosition = React33.useCallback(
|
|
1417
|
+
(id) => {
|
|
1418
|
+
return positions[id] || { top: 0, left: 0 };
|
|
1419
|
+
},
|
|
1420
|
+
[positions]
|
|
1421
|
+
);
|
|
1422
|
+
const isElementDragging = React33.useCallback(
|
|
1423
|
+
(id) => {
|
|
1424
|
+
return isDragging === id;
|
|
1425
|
+
},
|
|
1426
|
+
[isDragging]
|
|
1427
|
+
);
|
|
1396
1428
|
return {
|
|
1397
|
-
handleMouseDown,
|
|
1429
|
+
handleMouseDown: handleDragStart,
|
|
1398
1430
|
getPosition,
|
|
1399
1431
|
setPosition,
|
|
1400
1432
|
isElementDragging,
|
|
@@ -1435,7 +1467,8 @@ var TooltipBase = ({ children, delayDuration = TOOLTIP_DELAY_DURATION, ...props
|
|
|
1435
1467
|
) });
|
|
1436
1468
|
};
|
|
1437
1469
|
TooltipBase.displayName = "TooltipBase";
|
|
1438
|
-
var TooltipTriggerBase = React33__namespace.forwardRef(({ children, onPointerDown, ...props }, ref) => {
|
|
1470
|
+
var TooltipTriggerBase = React33__namespace.forwardRef(({ children, onPointerDown, onClick: propOnClick, ...props }, ref) => {
|
|
1471
|
+
const { setOpen, isMobile } = React33__namespace.useContext(TooltipClickContext);
|
|
1439
1472
|
const handlePointerDown = React33__namespace.useCallback(
|
|
1440
1473
|
(e) => {
|
|
1441
1474
|
if (onPointerDown) {
|
|
@@ -1446,11 +1479,26 @@ var TooltipTriggerBase = React33__namespace.forwardRef(({ children, onPointerDow
|
|
|
1446
1479
|
);
|
|
1447
1480
|
const onClick = React33__namespace.useCallback(
|
|
1448
1481
|
(e) => {
|
|
1482
|
+
if (propOnClick) {
|
|
1483
|
+
propOnClick(e);
|
|
1484
|
+
}
|
|
1449
1485
|
if (onPointerDown) {
|
|
1450
1486
|
onPointerDown(e);
|
|
1451
1487
|
}
|
|
1488
|
+
if (isMobile && setOpen) {
|
|
1489
|
+
e.preventDefault();
|
|
1490
|
+
setOpen((prev) => !prev);
|
|
1491
|
+
}
|
|
1452
1492
|
},
|
|
1453
|
-
[onPointerDown]
|
|
1493
|
+
[onPointerDown, isMobile, setOpen, propOnClick]
|
|
1494
|
+
);
|
|
1495
|
+
const preventDefaultOnMobile = React33__namespace.useCallback(
|
|
1496
|
+
(e) => {
|
|
1497
|
+
if (isMobile) {
|
|
1498
|
+
e.preventDefault();
|
|
1499
|
+
}
|
|
1500
|
+
},
|
|
1501
|
+
[isMobile]
|
|
1454
1502
|
);
|
|
1455
1503
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1456
1504
|
TooltipPrimitive__namespace.Trigger,
|
|
@@ -1459,6 +1507,9 @@ var TooltipTriggerBase = React33__namespace.forwardRef(({ children, onPointerDow
|
|
|
1459
1507
|
tabIndex: -1,
|
|
1460
1508
|
onPointerDown: onPointerDown ? handlePointerDown : void 0,
|
|
1461
1509
|
onClick,
|
|
1510
|
+
onFocus: preventDefaultOnMobile,
|
|
1511
|
+
onMouseEnter: preventDefaultOnMobile,
|
|
1512
|
+
onMouseLeave: preventDefaultOnMobile,
|
|
1462
1513
|
"data-tooltip-trigger": true,
|
|
1463
1514
|
"aria-describedby": "tooltip-content",
|
|
1464
1515
|
...props,
|
|
@@ -3161,9 +3212,13 @@ function ModeToggleBase({
|
|
|
3161
3212
|
className,
|
|
3162
3213
|
variant = "ghost"
|
|
3163
3214
|
}) {
|
|
3215
|
+
const [mounted, setMounted] = React33.useState(false);
|
|
3164
3216
|
const { setTheme, theme: currentTheme } = useTheme();
|
|
3165
3217
|
const buttonRef = React33.useRef(null);
|
|
3166
|
-
|
|
3218
|
+
React33.useEffect(() => {
|
|
3219
|
+
setMounted(true);
|
|
3220
|
+
}, []);
|
|
3221
|
+
const isDark = mounted && (currentTheme?.includes("dark") || currentTheme === "system" && typeof window !== "undefined" && window.matchMedia("(prefers-color-scheme: dark)").matches);
|
|
3167
3222
|
const toggleTheme = async (newTheme) => {
|
|
3168
3223
|
if (!buttonRef.current || !document.startViewTransition) {
|
|
3169
3224
|
setTheme(newTheme);
|
|
@@ -3204,7 +3259,7 @@ function ModeToggleBase({
|
|
|
3204
3259
|
variant,
|
|
3205
3260
|
size: "icon",
|
|
3206
3261
|
className: cn(
|
|
3207
|
-
"relative overflow-hidden
|
|
3262
|
+
"relative overflow-hidden group",
|
|
3208
3263
|
className
|
|
3209
3264
|
),
|
|
3210
3265
|
children: [
|
|
@@ -3230,7 +3285,7 @@ function ModeToggleBase({
|
|
|
3230
3285
|
DropDownMenuContentBase,
|
|
3231
3286
|
{
|
|
3232
3287
|
align: "end",
|
|
3233
|
-
className: "border-border bg-popover text-popover-foreground min-w-[140px]",
|
|
3288
|
+
className: "border-border bg-popover text-popover-foreground min-w-[140px] ",
|
|
3234
3289
|
children: themes.map((theme) => {
|
|
3235
3290
|
const isActive = currentTheme === theme;
|
|
3236
3291
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
@@ -3238,8 +3293,8 @@ function ModeToggleBase({
|
|
|
3238
3293
|
{
|
|
3239
3294
|
onClick: () => toggleTheme(theme),
|
|
3240
3295
|
className: cn(
|
|
3241
|
-
"gap-
|
|
3242
|
-
isActive ? "bg-accent/80 text-accent-foreground border-l-2 border-primary font-medium pl-1.5" : "hover:bg-accent hover:text-accent-foreground"
|
|
3296
|
+
"gap-2 transition-all duration-200",
|
|
3297
|
+
isActive ? "bg-accent/80 text-accent-foreground border-l-2 border-primary font-medium pl-1.5 my-0.5" : "hover:bg-accent hover:text-accent-foreground"
|
|
3243
3298
|
),
|
|
3244
3299
|
children: [
|
|
3245
3300
|
/* @__PURE__ */ jsxRuntime.jsx(ThemeIcon, { theme }),
|
|
@@ -7471,18 +7526,17 @@ function ScrollColumn({ value, onChange, max, label }) {
|
|
|
7471
7526
|
}
|
|
7472
7527
|
}, 100);
|
|
7473
7528
|
};
|
|
7474
|
-
const
|
|
7529
|
+
const handleStart = (pageY) => {
|
|
7475
7530
|
if (!containerRef.current) return;
|
|
7476
7531
|
setIsDragging(true);
|
|
7477
|
-
setStartY(
|
|
7532
|
+
setStartY(pageY);
|
|
7478
7533
|
setScrollTop(containerRef.current.scrollTop);
|
|
7479
7534
|
};
|
|
7480
|
-
const
|
|
7535
|
+
const handleMove = (pageY) => {
|
|
7481
7536
|
if (!isDragging || !containerRef.current) return;
|
|
7482
|
-
|
|
7483
|
-
containerRef.current.scrollTop = scrollTop + (startY - e.pageY) * 2;
|
|
7537
|
+
containerRef.current.scrollTop = scrollTop + (startY - pageY) * 2;
|
|
7484
7538
|
};
|
|
7485
|
-
const
|
|
7539
|
+
const handleEnd = () => {
|
|
7486
7540
|
if (!containerRef.current) return;
|
|
7487
7541
|
setIsDragging(false);
|
|
7488
7542
|
requestAnimationFrame(() => {
|
|
@@ -7494,8 +7548,32 @@ function ScrollColumn({ value, onChange, max, label }) {
|
|
|
7494
7548
|
}
|
|
7495
7549
|
});
|
|
7496
7550
|
};
|
|
7551
|
+
const handleMouseDown = (e) => {
|
|
7552
|
+
handleStart(e.pageY);
|
|
7553
|
+
};
|
|
7554
|
+
const handleMouseMove = (e) => {
|
|
7555
|
+
if (isDragging) {
|
|
7556
|
+
e.preventDefault();
|
|
7557
|
+
handleMove(e.pageY);
|
|
7558
|
+
}
|
|
7559
|
+
};
|
|
7560
|
+
const handleMouseUp = () => {
|
|
7561
|
+
handleEnd();
|
|
7562
|
+
};
|
|
7497
7563
|
const handleMouseLeave = () => {
|
|
7498
|
-
if (isDragging)
|
|
7564
|
+
if (isDragging) handleEnd();
|
|
7565
|
+
};
|
|
7566
|
+
const handleTouchStart = (e) => {
|
|
7567
|
+
handleStart(e.touches[0].pageY);
|
|
7568
|
+
};
|
|
7569
|
+
const handleTouchMove = (e) => {
|
|
7570
|
+
if (isDragging) {
|
|
7571
|
+
if (e.cancelable) e.preventDefault();
|
|
7572
|
+
handleMove(e.touches[0].pageY);
|
|
7573
|
+
}
|
|
7574
|
+
};
|
|
7575
|
+
const handleTouchEnd = () => {
|
|
7576
|
+
handleEnd();
|
|
7499
7577
|
};
|
|
7500
7578
|
const handleWheel = (e) => {
|
|
7501
7579
|
e.stopPropagation();
|
|
@@ -7513,6 +7591,9 @@ function ScrollColumn({ value, onChange, max, label }) {
|
|
|
7513
7591
|
onMouseMove: handleMouseMove,
|
|
7514
7592
|
onMouseUp: handleMouseUp,
|
|
7515
7593
|
onMouseLeave: handleMouseLeave,
|
|
7594
|
+
onTouchStart: handleTouchStart,
|
|
7595
|
+
onTouchMove: handleTouchMove,
|
|
7596
|
+
onTouchEnd: handleTouchEnd,
|
|
7516
7597
|
style: {
|
|
7517
7598
|
height: `${containerHeight}px`,
|
|
7518
7599
|
paddingTop: `${centerIndex * itemHeight}px`,
|
|
@@ -13826,7 +13907,7 @@ function MultiSelect({
|
|
|
13826
13907
|
|
|
13827
13908
|
// src/components/ui/charts/utils/helpers.ts
|
|
13828
13909
|
var formatFieldName = (fieldName) => {
|
|
13829
|
-
return fieldName.
|
|
13910
|
+
return (fieldName.match(/[^/_-]+/g) || []).map((word) => {
|
|
13830
13911
|
return word.charAt(0).toUpperCase() + word.slice(1);
|
|
13831
13912
|
}).join(" ").trim();
|
|
13832
13913
|
};
|
|
@@ -14553,7 +14634,7 @@ var DraggableTooltipComponent = ({
|
|
|
14553
14634
|
highlightedSeries,
|
|
14554
14635
|
toggleHighlight,
|
|
14555
14636
|
showOnlyHighlighted,
|
|
14556
|
-
valueFormatter
|
|
14637
|
+
valueFormatter,
|
|
14557
14638
|
categoryFormatter
|
|
14558
14639
|
}) => {
|
|
14559
14640
|
const visibleKeys = React33.useMemo(
|
|
@@ -14969,7 +15050,7 @@ var DraggableTooltipComponent = ({
|
|
|
14969
15050
|
{
|
|
14970
15051
|
data,
|
|
14971
15052
|
visibleKeys,
|
|
14972
|
-
valueFormatter
|
|
15053
|
+
valueFormatter
|
|
14973
15054
|
}
|
|
14974
15055
|
) })
|
|
14975
15056
|
] }) }),
|
|
@@ -14988,7 +15069,7 @@ var DraggableTooltipComponent = ({
|
|
|
14988
15069
|
);
|
|
14989
15070
|
const val = typeof value === "number" ? value : Number(value) || 0;
|
|
14990
15071
|
const defaultFormatted = val.toLocaleString("pt-BR");
|
|
14991
|
-
const displayValue =
|
|
15072
|
+
const displayValue = valueFormatter ? valueFormatter({
|
|
14992
15073
|
value,
|
|
14993
15074
|
formattedValue: defaultFormatted,
|
|
14994
15075
|
dataKey: key,
|
|
@@ -15069,7 +15150,7 @@ var DraggableTooltipComponent = ({
|
|
|
15069
15150
|
highlightedSeries,
|
|
15070
15151
|
toggleHighlight,
|
|
15071
15152
|
finalColors,
|
|
15072
|
-
|
|
15153
|
+
valueFormatter
|
|
15073
15154
|
]
|
|
15074
15155
|
),
|
|
15075
15156
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-3 pt-2 border-t", children: /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "text-xs text-muted-foreground flex items-center gap-1", children: [
|
|
@@ -15103,7 +15184,7 @@ var RechartTooltipWithTotal = ({
|
|
|
15103
15184
|
finalColors = {},
|
|
15104
15185
|
periodLabel = "Per\xEDodo",
|
|
15105
15186
|
totalLabel = "Total",
|
|
15106
|
-
valueFormatter
|
|
15187
|
+
valueFormatter,
|
|
15107
15188
|
categoryFormatter,
|
|
15108
15189
|
yAxisMap,
|
|
15109
15190
|
isBiaxial = false
|
|
@@ -15127,7 +15208,7 @@ var RechartTooltipWithTotal = ({
|
|
|
15127
15208
|
}
|
|
15128
15209
|
return total.toLocaleString("pt-BR");
|
|
15129
15210
|
})();
|
|
15130
|
-
const displayTotal =
|
|
15211
|
+
const displayTotal = valueFormatter ? valueFormatter({
|
|
15131
15212
|
value: total,
|
|
15132
15213
|
formattedValue: defaultTotalFormatted,
|
|
15133
15214
|
dataKey: "total",
|
|
@@ -15190,7 +15271,7 @@ var RechartTooltipWithTotal = ({
|
|
|
15190
15271
|
}
|
|
15191
15272
|
return value.toLocaleString("pt-BR");
|
|
15192
15273
|
})();
|
|
15193
|
-
const displayValue =
|
|
15274
|
+
const displayValue = valueFormatter ? valueFormatter({
|
|
15194
15275
|
value: entry.value,
|
|
15195
15276
|
formattedValue: defaultFormatted,
|
|
15196
15277
|
dataKey: entry.dataKey,
|
|
@@ -15255,7 +15336,7 @@ var TooltipSimple = ({
|
|
|
15255
15336
|
label,
|
|
15256
15337
|
finalColors = {},
|
|
15257
15338
|
periodLabel = "Per\xEDodo",
|
|
15258
|
-
valueFormatter
|
|
15339
|
+
valueFormatter,
|
|
15259
15340
|
categoryFormatter,
|
|
15260
15341
|
yAxisMap,
|
|
15261
15342
|
isBiaxial = false
|
|
@@ -15303,7 +15384,7 @@ var TooltipSimple = ({
|
|
|
15303
15384
|
}
|
|
15304
15385
|
return value.toLocaleString("pt-BR");
|
|
15305
15386
|
})();
|
|
15306
|
-
const displayValue =
|
|
15387
|
+
const displayValue = valueFormatter ? valueFormatter({
|
|
15307
15388
|
value: entry.value,
|
|
15308
15389
|
formattedValue: defaultFormatted,
|
|
15309
15390
|
dataKey: entry.dataKey,
|
|
@@ -15345,6 +15426,210 @@ var TooltipSimple = ({
|
|
|
15345
15426
|
);
|
|
15346
15427
|
};
|
|
15347
15428
|
var TooltipSimple_default = TooltipSimple;
|
|
15429
|
+
var tooltipVariants2 = {
|
|
15430
|
+
hidden: {
|
|
15431
|
+
opacity: 0,
|
|
15432
|
+
scale: 0.96,
|
|
15433
|
+
transition: { type: "spring", stiffness: 400, damping: 28 }
|
|
15434
|
+
},
|
|
15435
|
+
visible: {
|
|
15436
|
+
opacity: 1,
|
|
15437
|
+
scale: 1,
|
|
15438
|
+
transition: { type: "spring", stiffness: 300, damping: 28 }
|
|
15439
|
+
},
|
|
15440
|
+
exit: {
|
|
15441
|
+
opacity: 0,
|
|
15442
|
+
scale: 0.96,
|
|
15443
|
+
transition: { type: "spring", stiffness: 400, damping: 28 }
|
|
15444
|
+
}
|
|
15445
|
+
};
|
|
15446
|
+
var SystemTooltip = ({
|
|
15447
|
+
id,
|
|
15448
|
+
data,
|
|
15449
|
+
position,
|
|
15450
|
+
title = "Conex\xF5es",
|
|
15451
|
+
onMouseDown,
|
|
15452
|
+
onClose,
|
|
15453
|
+
onPositionChange
|
|
15454
|
+
}) => {
|
|
15455
|
+
const [localPos, setLocalPos] = React33.useState(position);
|
|
15456
|
+
const [dragging, setDragging] = React33.useState(false);
|
|
15457
|
+
const offsetRef = React33.useRef({ x: 0, y: 0 });
|
|
15458
|
+
const lastMouse = React33.useRef({ x: 0, y: 0 });
|
|
15459
|
+
React33.useEffect(() => setLocalPos(position), [position]);
|
|
15460
|
+
React33.useEffect(() => {
|
|
15461
|
+
let rafId = null;
|
|
15462
|
+
const handleMouseMove = (e) => {
|
|
15463
|
+
if (!dragging) return;
|
|
15464
|
+
lastMouse.current = { x: e.clientX, y: e.clientY };
|
|
15465
|
+
if (rafId) cancelAnimationFrame(rafId);
|
|
15466
|
+
rafId = requestAnimationFrame(() => {
|
|
15467
|
+
const newLeft = lastMouse.current.x - offsetRef.current.x;
|
|
15468
|
+
const newTop = lastMouse.current.y - offsetRef.current.y;
|
|
15469
|
+
const rawPosition = {
|
|
15470
|
+
top: Math.max(0, Math.min(newTop, window.innerHeight - 200)),
|
|
15471
|
+
left: Math.max(0, Math.min(newLeft, window.innerWidth - 320))
|
|
15472
|
+
};
|
|
15473
|
+
setLocalPos(rawPosition);
|
|
15474
|
+
if (onPositionChange) onPositionChange(id, rawPosition);
|
|
15475
|
+
});
|
|
15476
|
+
};
|
|
15477
|
+
const handleMouseUp = () => {
|
|
15478
|
+
if (dragging) {
|
|
15479
|
+
setDragging(false);
|
|
15480
|
+
if (rafId) cancelAnimationFrame(rafId);
|
|
15481
|
+
}
|
|
15482
|
+
};
|
|
15483
|
+
if (dragging) {
|
|
15484
|
+
document.addEventListener("mousemove", handleMouseMove, {
|
|
15485
|
+
passive: true
|
|
15486
|
+
});
|
|
15487
|
+
document.addEventListener("mouseup", handleMouseUp);
|
|
15488
|
+
document.body.style.cursor = "grabbing";
|
|
15489
|
+
document.body.style.userSelect = "none";
|
|
15490
|
+
}
|
|
15491
|
+
return () => {
|
|
15492
|
+
if (rafId) cancelAnimationFrame(rafId);
|
|
15493
|
+
document.removeEventListener("mousemove", handleMouseMove);
|
|
15494
|
+
document.removeEventListener("mouseup", handleMouseUp);
|
|
15495
|
+
document.body.style.cursor = "";
|
|
15496
|
+
document.body.style.userSelect = "";
|
|
15497
|
+
};
|
|
15498
|
+
}, [dragging, id, onPositionChange]);
|
|
15499
|
+
const handleMouseDownLocal = React33.useCallback(
|
|
15500
|
+
(e) => {
|
|
15501
|
+
e.preventDefault();
|
|
15502
|
+
e.stopPropagation();
|
|
15503
|
+
const rect = e.currentTarget.closest(".fixed")?.getBoundingClientRect();
|
|
15504
|
+
if (!rect) return;
|
|
15505
|
+
offsetRef.current = { x: e.clientX - rect.left, y: e.clientY - rect.top };
|
|
15506
|
+
setDragging(true);
|
|
15507
|
+
onMouseDown?.(id, e);
|
|
15508
|
+
},
|
|
15509
|
+
[id, onMouseDown]
|
|
15510
|
+
);
|
|
15511
|
+
const handleTouchStartLocal = React33.useCallback(
|
|
15512
|
+
(e) => {
|
|
15513
|
+
e.stopPropagation();
|
|
15514
|
+
const touch = e.touches[0];
|
|
15515
|
+
if (!touch) return;
|
|
15516
|
+
const rect = e.currentTarget.closest(".fixed")?.getBoundingClientRect();
|
|
15517
|
+
if (!rect) return;
|
|
15518
|
+
offsetRef.current = {
|
|
15519
|
+
x: touch.clientX - rect.left,
|
|
15520
|
+
y: touch.clientY - rect.top
|
|
15521
|
+
};
|
|
15522
|
+
setDragging(true);
|
|
15523
|
+
onMouseDown?.(id, e);
|
|
15524
|
+
},
|
|
15525
|
+
[id, onMouseDown]
|
|
15526
|
+
);
|
|
15527
|
+
const entries = React33.useMemo(
|
|
15528
|
+
() => data.connections.filter((c) => c.type === "entrada"),
|
|
15529
|
+
[data.connections]
|
|
15530
|
+
);
|
|
15531
|
+
const exits = React33.useMemo(
|
|
15532
|
+
() => data.connections.filter((c) => c.type === "saida"),
|
|
15533
|
+
[data.connections]
|
|
15534
|
+
);
|
|
15535
|
+
return /* @__PURE__ */ jsxRuntime.jsx(framerMotion.AnimatePresence, { children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
15536
|
+
framerMotion.motion.div,
|
|
15537
|
+
{
|
|
15538
|
+
className: "fixed bg-card/95 backdrop-blur-md border border-border/50 rounded-xl shadow-2xl z-50 w-80 overflow-hidden",
|
|
15539
|
+
variants: tooltipVariants2,
|
|
15540
|
+
initial: "hidden",
|
|
15541
|
+
animate: "visible",
|
|
15542
|
+
exit: "exit",
|
|
15543
|
+
style: {
|
|
15544
|
+
top: localPos.top,
|
|
15545
|
+
left: localPos.left
|
|
15546
|
+
},
|
|
15547
|
+
onClick: (e) => e.stopPropagation(),
|
|
15548
|
+
children: [
|
|
15549
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
15550
|
+
"div",
|
|
15551
|
+
{
|
|
15552
|
+
className: "flex items-center justify-between py-1 border-b border-border/10 bg-muted/30 ",
|
|
15553
|
+
onMouseDown: handleMouseDownLocal,
|
|
15554
|
+
onTouchStart: handleTouchStartLocal,
|
|
15555
|
+
style: {
|
|
15556
|
+
touchAction: "none",
|
|
15557
|
+
cursor: dragging ? "grabbing" : "grab"
|
|
15558
|
+
},
|
|
15559
|
+
children: [
|
|
15560
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2 px-3", children: [
|
|
15561
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "rounded", children: /* @__PURE__ */ jsxRuntime.jsx(react.DotsSixVerticalIcon, { size: 16, className: "text-primary" }) }),
|
|
15562
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-xs font-semibold text-muted-foreground uppercase tracking-wider", children: title })
|
|
15563
|
+
] }),
|
|
15564
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
15565
|
+
ButtonBase,
|
|
15566
|
+
{
|
|
15567
|
+
variant: "ghost",
|
|
15568
|
+
size: "icon",
|
|
15569
|
+
onClick: () => onClose(id),
|
|
15570
|
+
className: "text-muted-foreground hover:text-destructive transition-colors hover:bg-destructive/10 mr-1",
|
|
15571
|
+
style: { cursor: "pointer" },
|
|
15572
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(ssr.XIcon, { size: 16 })
|
|
15573
|
+
}
|
|
15574
|
+
)
|
|
15575
|
+
]
|
|
15576
|
+
}
|
|
15577
|
+
),
|
|
15578
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "px-4 pt-4 pb-3", children: [
|
|
15579
|
+
/* @__PURE__ */ jsxRuntime.jsx("h3", { className: "text-xl font-bold text-foreground tracking-tight truncate", children: data.name }),
|
|
15580
|
+
/* @__PURE__ */ jsxRuntime.jsx("h3", { className: "text-sm font-bold text-muted-foreground tracking-tight truncate", children: data.description })
|
|
15581
|
+
] }),
|
|
15582
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "px-3 pb-4 space-y-4 max-h-[300px] overflow-y-auto [&::-webkit-scrollbar]:w- [&::-webkit-scrollbar-track]:bg-transparent [&::-webkit-scrollbar-thumb]:bg-muted-foreground/20 [&::-webkit-scrollbar-thumb]:rounded-full hover:[&::-webkit-scrollbar-thumb]:bg-muted-foreground/40 transition-colors", children: [
|
|
15583
|
+
/* @__PURE__ */ jsxRuntime.jsx(SeparatorBase, { className: "w-full" }),
|
|
15584
|
+
entries.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-2", children: [
|
|
15585
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2 px-1", children: [
|
|
15586
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-1.5 h-1.5 rounded-full bg-emerald-500" }),
|
|
15587
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[10px] font-bold text-muted-foreground uppercase", children: "Entradas" })
|
|
15588
|
+
] }),
|
|
15589
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "space-y-1", children: entries.map((conn) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
15590
|
+
"div",
|
|
15591
|
+
{
|
|
15592
|
+
className: "group flex items-center justify-between p-2 rounded-lg bg-emerald-500/5 border border-emerald-500/10 hover:border-emerald-500/30 transition-all",
|
|
15593
|
+
children: [
|
|
15594
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center gap-2 overflow-hidden", children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm font-medium truncate", children: conn.name }) }),
|
|
15595
|
+
" ",
|
|
15596
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
15597
|
+
react.ArrowRight,
|
|
15598
|
+
{
|
|
15599
|
+
size: 14,
|
|
15600
|
+
className: "text-emerald-500 shrink-0 rotate-180"
|
|
15601
|
+
}
|
|
15602
|
+
)
|
|
15603
|
+
]
|
|
15604
|
+
},
|
|
15605
|
+
conn.id
|
|
15606
|
+
)) })
|
|
15607
|
+
] }),
|
|
15608
|
+
exits.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-2", children: [
|
|
15609
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2 px-1", children: [
|
|
15610
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-1.5 h-1.5 rounded-full bg-blue-500" }),
|
|
15611
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[10px] font-bold text-muted-foreground uppercase", children: "Sa\xEDdas" })
|
|
15612
|
+
] }),
|
|
15613
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "space-y-1", children: exits.map((conn) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
15614
|
+
"div",
|
|
15615
|
+
{
|
|
15616
|
+
className: "group flex items-center justify-between p-2 rounded-lg bg-blue-500/5 border border-blue-500/10 hover:border-blue-500/30 transition-all",
|
|
15617
|
+
children: [
|
|
15618
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center gap-2 overflow-hidden", children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm font-medium truncate", children: conn.name }) }),
|
|
15619
|
+
/* @__PURE__ */ jsxRuntime.jsx(react.ArrowRight, { size: 14, className: "text-blue-500 shrink-0" })
|
|
15620
|
+
]
|
|
15621
|
+
},
|
|
15622
|
+
conn.id
|
|
15623
|
+
)) })
|
|
15624
|
+
] }),
|
|
15625
|
+
data.connections.length === 0 && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-col items-center justify-center p-6 text-center", children: /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-muted-foreground", children: "Nenhuma conex\xE3o encontrada" }) })
|
|
15626
|
+
] })
|
|
15627
|
+
]
|
|
15628
|
+
},
|
|
15629
|
+
id
|
|
15630
|
+
) });
|
|
15631
|
+
};
|
|
15632
|
+
var SystemTooltip_default = SystemTooltip;
|
|
15348
15633
|
var Brush = ({
|
|
15349
15634
|
data,
|
|
15350
15635
|
legend,
|
|
@@ -15599,11 +15884,11 @@ var parseNumber = (v) => {
|
|
|
15599
15884
|
return Number(v);
|
|
15600
15885
|
return void 0;
|
|
15601
15886
|
};
|
|
15602
|
-
var renderPillLabel = (color, variant,
|
|
15887
|
+
var renderPillLabel = (color, variant, valueFormatter) => {
|
|
15603
15888
|
return (props) => {
|
|
15604
15889
|
const { x, y, value } = props;
|
|
15605
15890
|
const defaultFormatted = typeof value === "number" ? formatCompactNumber(value) : String(value ?? "");
|
|
15606
|
-
const text =
|
|
15891
|
+
const text = valueFormatter ? valueFormatter({
|
|
15607
15892
|
value,
|
|
15608
15893
|
formattedValue: defaultFormatted,
|
|
15609
15894
|
...props
|
|
@@ -15692,11 +15977,11 @@ var renderPillLabel = (color, variant, valueFormatter2) => {
|
|
|
15692
15977
|
};
|
|
15693
15978
|
};
|
|
15694
15979
|
var pillLabelRenderer_default = renderPillLabel;
|
|
15695
|
-
var renderInsideBarLabel = (color,
|
|
15980
|
+
var renderInsideBarLabel = (color, valueFormatter) => {
|
|
15696
15981
|
return (props) => {
|
|
15697
15982
|
const { x, y, value, width, height, viewBox, cx, cy, index } = props;
|
|
15698
15983
|
const defaultFormatted = typeof value === "number" ? formatCompactNumber(value) : String(value ?? "");
|
|
15699
|
-
const text =
|
|
15984
|
+
const text = valueFormatter ? valueFormatter({ value, formattedValue: defaultFormatted, ...props }) : defaultFormatted;
|
|
15700
15985
|
const parseNumberLocal = (v) => {
|
|
15701
15986
|
if (typeof v === "number") return v;
|
|
15702
15987
|
if (typeof v === "string" && v.trim() !== "" && !Number.isNaN(Number(v)))
|
|
@@ -15841,7 +16126,7 @@ var NoData = ({
|
|
|
15841
16126
|
"div",
|
|
15842
16127
|
{
|
|
15843
16128
|
className: cn(
|
|
15844
|
-
"rounded-xl bg-card relative overflow-hidden w-full border border-border/50 shadow-sm",
|
|
16129
|
+
"rounded-xl bg-card relative overflow-hidden w-full border border-border/50 shadow-sm h-full",
|
|
15845
16130
|
className
|
|
15846
16131
|
),
|
|
15847
16132
|
style: {
|
|
@@ -16298,6 +16583,128 @@ function useTimeSeriesRange({
|
|
|
16298
16583
|
handleMouseDown
|
|
16299
16584
|
};
|
|
16300
16585
|
}
|
|
16586
|
+
var filtersOrder = (mapperConfig, series) => {
|
|
16587
|
+
const seriesOrder = [];
|
|
16588
|
+
if (series) {
|
|
16589
|
+
if (series.bar)
|
|
16590
|
+
series.bar.forEach((k) => seriesOrder.push({ type: "bar", key: k }));
|
|
16591
|
+
if (series.line)
|
|
16592
|
+
series.line.forEach((k) => seriesOrder.push({ type: "line", key: k }));
|
|
16593
|
+
if (series.area)
|
|
16594
|
+
series.area.forEach((k) => seriesOrder.push({ type: "area", key: k }));
|
|
16595
|
+
} else {
|
|
16596
|
+
Object.keys(mapperConfig).forEach(
|
|
16597
|
+
(k) => seriesOrder.push({ type: "bar", key: k })
|
|
16598
|
+
);
|
|
16599
|
+
}
|
|
16600
|
+
return seriesOrder;
|
|
16601
|
+
};
|
|
16602
|
+
var fnOpenTooltipForPeriod = (enableDraggableTooltips, processedData, periodName, activeTooltips, setActiveTooltips, maxTooltips, effectiveChartWidth) => {
|
|
16603
|
+
if (!enableDraggableTooltips) return;
|
|
16604
|
+
const row = processedData.find((r) => String(r.name) === periodName);
|
|
16605
|
+
if (!row) return;
|
|
16606
|
+
const tooltipId = String(periodName);
|
|
16607
|
+
const existingIndex = activeTooltips.findIndex((t) => t.id === tooltipId);
|
|
16608
|
+
if (existingIndex !== -1) {
|
|
16609
|
+
setActiveTooltips((prev) => prev.filter((t) => t.id !== tooltipId));
|
|
16610
|
+
return;
|
|
16611
|
+
}
|
|
16612
|
+
if (activeTooltips.length >= maxTooltips) {
|
|
16613
|
+
sonner.toast.warning(
|
|
16614
|
+
`Limite de ${maxTooltips} janelas de informa\xE7\xE3o atingido. A mais antiga ser\xE1 substitu\xEDda.`
|
|
16615
|
+
);
|
|
16616
|
+
}
|
|
16617
|
+
const offsetIndex = activeTooltips.length;
|
|
16618
|
+
const availableWidth = effectiveChartWidth;
|
|
16619
|
+
const gap = 28;
|
|
16620
|
+
const leftGap = 28;
|
|
16621
|
+
const newTooltip = {
|
|
16622
|
+
id: tooltipId,
|
|
16623
|
+
data: row,
|
|
16624
|
+
position: {
|
|
16625
|
+
top: 48 + offsetIndex * gap,
|
|
16626
|
+
left: Math.max(120, availableWidth - 280 - offsetIndex * leftGap)
|
|
16627
|
+
}
|
|
16628
|
+
};
|
|
16629
|
+
setActiveTooltips((prev) => {
|
|
16630
|
+
const next = [...prev, newTooltip];
|
|
16631
|
+
return next.length > maxTooltips ? next.slice(1) : next;
|
|
16632
|
+
});
|
|
16633
|
+
};
|
|
16634
|
+
var fnSmartConfig = ({ xAxis, data, labelMap }) => {
|
|
16635
|
+
const resolvedXAxisKey = typeof xAxis === "string" ? xAxis : xAxis && xAxis.dataKey || detectXAxis(data);
|
|
16636
|
+
const xAxisConfig = typeof xAxis === "string" ? {
|
|
16637
|
+
dataKey: resolvedXAxisKey,
|
|
16638
|
+
label: formatFieldName(resolvedXAxisKey),
|
|
16639
|
+
autoLabel: true
|
|
16640
|
+
} : {
|
|
16641
|
+
dataKey: resolvedXAxisKey,
|
|
16642
|
+
label: xAxis?.label ?? formatFieldName(resolvedXAxisKey),
|
|
16643
|
+
valueFormatter: xAxis?.valueFormatter,
|
|
16644
|
+
autoLabel: xAxis?.autoLabel ?? true
|
|
16645
|
+
};
|
|
16646
|
+
const detectedFields = detectDataFields(data, xAxisConfig.dataKey);
|
|
16647
|
+
const mapperConfig = detectedFields.reduce((acc, field) => {
|
|
16648
|
+
acc[field] = {
|
|
16649
|
+
label: labelMap?.[field] ?? formatFieldName(field),
|
|
16650
|
+
type: "number",
|
|
16651
|
+
visible: true
|
|
16652
|
+
};
|
|
16653
|
+
return acc;
|
|
16654
|
+
}, {});
|
|
16655
|
+
return { xAxisConfig, mapperConfig };
|
|
16656
|
+
};
|
|
16657
|
+
var fnConfigRightKeys = (biaxialConfigNormalized, yTickFormatter, finalColors) => {
|
|
16658
|
+
const decimals = typeof biaxialConfigNormalized?.decimals === "number" ? Math.max(0, Math.floor(biaxialConfigNormalized.decimals)) : 2;
|
|
16659
|
+
const rightTickFormatter = (v) => {
|
|
16660
|
+
if (biaxialConfigNormalized?.percentage) {
|
|
16661
|
+
const num = Number(String(v));
|
|
16662
|
+
const nf = new Intl.NumberFormat("pt-BR", {
|
|
16663
|
+
minimumFractionDigits: decimals,
|
|
16664
|
+
maximumFractionDigits: decimals
|
|
16665
|
+
});
|
|
16666
|
+
const out = Number.isNaN(num) ? String(v ?? "") : nf.format(num);
|
|
16667
|
+
return `${out}%`;
|
|
16668
|
+
}
|
|
16669
|
+
return yTickFormatter(v);
|
|
16670
|
+
};
|
|
16671
|
+
const firstRightKey = biaxialConfigNormalized?.key && biaxialConfigNormalized.key[0];
|
|
16672
|
+
const defaultRightColor = firstRightKey && finalColors[firstRightKey] || "hsl(var(--muted-foreground))";
|
|
16673
|
+
const rightAxisColor = (() => {
|
|
16674
|
+
if (!biaxialConfigNormalized) return defaultRightColor;
|
|
16675
|
+
if (typeof biaxialConfigNormalized.stroke === "string")
|
|
16676
|
+
return biaxialConfigNormalized.stroke;
|
|
16677
|
+
if (biaxialConfigNormalized.stroke && firstRightKey && typeof biaxialConfigNormalized.stroke === "object")
|
|
16678
|
+
return biaxialConfigNormalized.stroke[firstRightKey] || defaultRightColor;
|
|
16679
|
+
return defaultRightColor;
|
|
16680
|
+
})();
|
|
16681
|
+
return { rightAxisColor, rightTickFormatter };
|
|
16682
|
+
};
|
|
16683
|
+
var fnFormatterValueLegend = (value, mapperConfig, labelMap, legendUppercase) => {
|
|
16684
|
+
const key = String(value);
|
|
16685
|
+
const label = mapperConfig[key]?.label ?? labelMap?.[key] ?? formatFieldName(key);
|
|
16686
|
+
return legendUppercase ? label.toUpperCase() : label;
|
|
16687
|
+
};
|
|
16688
|
+
var fnBuildConfigData = (s, mapperConfig, labelMap, finalColors, rightKeys, biaxialConfigNormalized) => {
|
|
16689
|
+
const key = s.key;
|
|
16690
|
+
const label = mapperConfig[key]?.label ?? labelMap?.[key] ?? formatFieldName(key);
|
|
16691
|
+
let color = finalColors[key];
|
|
16692
|
+
if (rightKeys.includes(key) && biaxialConfigNormalized?.stroke) {
|
|
16693
|
+
if (typeof biaxialConfigNormalized.stroke === "string") {
|
|
16694
|
+
color = biaxialConfigNormalized.stroke;
|
|
16695
|
+
} else {
|
|
16696
|
+
color = biaxialConfigNormalized.stroke[key] ?? color;
|
|
16697
|
+
}
|
|
16698
|
+
}
|
|
16699
|
+
return { label, color, key };
|
|
16700
|
+
};
|
|
16701
|
+
var fnContentLabelList = (p) => {
|
|
16702
|
+
const barHeight = typeof p.height === "number" ? p.height : typeof p.height === "string" ? Number(p.height) : 0;
|
|
16703
|
+
const barWidth = typeof p.width === "number" ? p.width : typeof p.width === "string" ? Number(p.width) : 0;
|
|
16704
|
+
const smallThreshold = 14;
|
|
16705
|
+
const needsOutside = barHeight > 0 && barHeight < smallThreshold || barWidth > 0 && barWidth < smallThreshold;
|
|
16706
|
+
return needsOutside ? null : true;
|
|
16707
|
+
};
|
|
16301
16708
|
var DEFAULT_COLORS2 = ["#55af7d", "#8e68ff", "#2273e1"];
|
|
16302
16709
|
var Chart = ({
|
|
16303
16710
|
data,
|
|
@@ -16319,7 +16726,7 @@ var Chart = ({
|
|
|
16319
16726
|
xAxisLabel,
|
|
16320
16727
|
yAxisLabel,
|
|
16321
16728
|
labelMap,
|
|
16322
|
-
valueFormatter
|
|
16729
|
+
valueFormatter,
|
|
16323
16730
|
categoryFormatter,
|
|
16324
16731
|
enableHighlights = false,
|
|
16325
16732
|
enableShowOnly = false,
|
|
@@ -16336,30 +16743,9 @@ var Chart = ({
|
|
|
16336
16743
|
timeSeriesLegend,
|
|
16337
16744
|
customLegend
|
|
16338
16745
|
}) => {
|
|
16339
|
-
const
|
|
16340
|
-
|
|
16341
|
-
const xAxisConfig2 = typeof xAxis === "string" ? {
|
|
16342
|
-
dataKey: resolvedXAxisKey,
|
|
16343
|
-
label: formatFieldName(resolvedXAxisKey),
|
|
16344
|
-
autoLabel: true
|
|
16345
|
-
} : {
|
|
16346
|
-
dataKey: resolvedXAxisKey,
|
|
16347
|
-
label: xAxis?.label ?? formatFieldName(resolvedXAxisKey),
|
|
16348
|
-
valueFormatter: xAxis?.valueFormatter,
|
|
16349
|
-
autoLabel: xAxis?.autoLabel ?? true
|
|
16350
|
-
};
|
|
16351
|
-
const detectedFields = detectDataFields(data, xAxisConfig2.dataKey);
|
|
16352
|
-
const mapperConfig2 = detectedFields.reduce((acc, field) => {
|
|
16353
|
-
acc[field] = {
|
|
16354
|
-
label: labelMap?.[field] ?? formatFieldName(field),
|
|
16355
|
-
type: "number",
|
|
16356
|
-
visible: true
|
|
16357
|
-
};
|
|
16358
|
-
return acc;
|
|
16359
|
-
}, {});
|
|
16360
|
-
return { xAxisConfig: xAxisConfig2, mapperConfig: mapperConfig2 };
|
|
16746
|
+
const { xAxisConfig, mapperConfig } = React33.useMemo(() => {
|
|
16747
|
+
return fnSmartConfig({ xAxis, data, labelMap });
|
|
16361
16748
|
}, [data, xAxis, labelMap]);
|
|
16362
|
-
const { xAxisConfig, mapperConfig } = smartConfig;
|
|
16363
16749
|
const {
|
|
16364
16750
|
highlightedSeries,
|
|
16365
16751
|
showOnlyHighlighted,
|
|
@@ -16401,19 +16787,7 @@ var Chart = ({
|
|
|
16401
16787
|
}
|
|
16402
16788
|
return mapped;
|
|
16403
16789
|
}, [data, xAxisConfig.dataKey, timeSeriesConfig, startIndex, endIndex]);
|
|
16404
|
-
const seriesOrder =
|
|
16405
|
-
if (series) {
|
|
16406
|
-
if (series.bar)
|
|
16407
|
-
series.bar.forEach((k) => seriesOrder.push({ type: "bar", key: k }));
|
|
16408
|
-
if (series.line)
|
|
16409
|
-
series.line.forEach((k) => seriesOrder.push({ type: "line", key: k }));
|
|
16410
|
-
if (series.area)
|
|
16411
|
-
series.area.forEach((k) => seriesOrder.push({ type: "area", key: k }));
|
|
16412
|
-
} else {
|
|
16413
|
-
Object.keys(mapperConfig).forEach(
|
|
16414
|
-
(k) => seriesOrder.push({ type: "bar", key: k })
|
|
16415
|
-
);
|
|
16416
|
-
}
|
|
16790
|
+
const seriesOrder = filtersOrder(mapperConfig, series);
|
|
16417
16791
|
const allKeys = seriesOrder.map((s) => s.key).filter(Boolean);
|
|
16418
16792
|
const finalColors = React33.useMemo(
|
|
16419
16793
|
() => generateColorMap(allKeys, colors2, mapperConfig),
|
|
@@ -16496,8 +16870,8 @@ var Chart = ({
|
|
|
16496
16870
|
[highlightedSeries]
|
|
16497
16871
|
);
|
|
16498
16872
|
const finalValueFormatter = React33.useMemo(
|
|
16499
|
-
() => createValueFormatter(
|
|
16500
|
-
[
|
|
16873
|
+
() => createValueFormatter(valueFormatter, formatBR),
|
|
16874
|
+
[valueFormatter, formatBR]
|
|
16501
16875
|
);
|
|
16502
16876
|
const yTickFormatter = React33.useMemo(
|
|
16503
16877
|
() => createYTickFormatter(finalValueFormatter),
|
|
@@ -16532,36 +16906,15 @@ var Chart = ({
|
|
|
16532
16906
|
const rightYAxisLabelDx = Math.max(12, Math.round(finalChartRightMargin / 2));
|
|
16533
16907
|
const openTooltipForPeriod = React33.useCallback(
|
|
16534
16908
|
(periodName) => {
|
|
16535
|
-
|
|
16536
|
-
|
|
16537
|
-
|
|
16538
|
-
|
|
16539
|
-
|
|
16540
|
-
|
|
16541
|
-
|
|
16542
|
-
|
|
16543
|
-
|
|
16544
|
-
if (activeTooltips.length >= maxTooltips) {
|
|
16545
|
-
sonner.toast.warning(
|
|
16546
|
-
`Limite de ${maxTooltips} janelas de informa\xE7\xE3o atingido. A mais antiga ser\xE1 substitu\xEDda.`
|
|
16547
|
-
);
|
|
16548
|
-
}
|
|
16549
|
-
const offsetIndex = activeTooltips.length;
|
|
16550
|
-
const availableWidth = effectiveChartWidth;
|
|
16551
|
-
const gap = 28;
|
|
16552
|
-
const leftGap = 28;
|
|
16553
|
-
const newTooltip = {
|
|
16554
|
-
id: tooltipId,
|
|
16555
|
-
data: row,
|
|
16556
|
-
position: {
|
|
16557
|
-
top: 48 + offsetIndex * gap,
|
|
16558
|
-
left: Math.max(120, availableWidth - 280 - offsetIndex * leftGap)
|
|
16559
|
-
}
|
|
16560
|
-
};
|
|
16561
|
-
setActiveTooltips((prev) => {
|
|
16562
|
-
const next = [...prev, newTooltip];
|
|
16563
|
-
return next.length > maxTooltips ? next.slice(1) : next;
|
|
16564
|
-
});
|
|
16909
|
+
fnOpenTooltipForPeriod(
|
|
16910
|
+
enableDraggableTooltips,
|
|
16911
|
+
processedData,
|
|
16912
|
+
periodName,
|
|
16913
|
+
activeTooltips,
|
|
16914
|
+
setActiveTooltips,
|
|
16915
|
+
maxTooltips,
|
|
16916
|
+
effectiveChartWidth
|
|
16917
|
+
);
|
|
16565
16918
|
},
|
|
16566
16919
|
[
|
|
16567
16920
|
enableDraggableTooltips,
|
|
@@ -16800,29 +17153,7 @@ var Chart = ({
|
|
|
16800
17153
|
}
|
|
16801
17154
|
),
|
|
16802
17155
|
rightKeys.length > 0 && (() => {
|
|
16803
|
-
const
|
|
16804
|
-
const rightTickFormatter = (v) => {
|
|
16805
|
-
if (biaxialConfigNormalized?.percentage) {
|
|
16806
|
-
const num = Number(String(v));
|
|
16807
|
-
const nf = new Intl.NumberFormat("pt-BR", {
|
|
16808
|
-
minimumFractionDigits: decimals,
|
|
16809
|
-
maximumFractionDigits: decimals
|
|
16810
|
-
});
|
|
16811
|
-
const out = Number.isNaN(num) ? String(v ?? "") : nf.format(num);
|
|
16812
|
-
return `${out}%`;
|
|
16813
|
-
}
|
|
16814
|
-
return yTickFormatter(v);
|
|
16815
|
-
};
|
|
16816
|
-
const firstRightKey = biaxialConfigNormalized?.key && biaxialConfigNormalized.key[0];
|
|
16817
|
-
const defaultRightColor = firstRightKey && finalColors[firstRightKey] || "hsl(var(--muted-foreground))";
|
|
16818
|
-
const rightAxisColor = (() => {
|
|
16819
|
-
if (!biaxialConfigNormalized) return defaultRightColor;
|
|
16820
|
-
if (typeof biaxialConfigNormalized.stroke === "string")
|
|
16821
|
-
return biaxialConfigNormalized.stroke;
|
|
16822
|
-
if (biaxialConfigNormalized.stroke && firstRightKey && typeof biaxialConfigNormalized.stroke === "object")
|
|
16823
|
-
return biaxialConfigNormalized.stroke[firstRightKey] || defaultRightColor;
|
|
16824
|
-
return defaultRightColor;
|
|
16825
|
-
})();
|
|
17156
|
+
const { rightAxisColor, rightTickFormatter } = fnConfigRightKeys(biaxialConfigNormalized, yTickFormatter, finalColors);
|
|
16826
17157
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
16827
17158
|
recharts.YAxis,
|
|
16828
17159
|
{
|
|
@@ -16880,38 +17211,26 @@ var Chart = ({
|
|
|
16880
17211
|
{
|
|
16881
17212
|
iconSize: 12,
|
|
16882
17213
|
formatter: (value) => {
|
|
16883
|
-
|
|
16884
|
-
|
|
16885
|
-
|
|
16886
|
-
|
|
16887
|
-
|
|
16888
|
-
|
|
16889
|
-
className: "inline-flex items-center gap-2 px-1 py-1.5",
|
|
16890
|
-
style: {
|
|
16891
|
-
fontSize: "13px",
|
|
16892
|
-
fontWeight: 600,
|
|
16893
|
-
letterSpacing: "0.01em",
|
|
16894
|
-
color: "hsl(var(--foreground))"
|
|
16895
|
-
},
|
|
16896
|
-
children: displayLabel
|
|
16897
|
-
}
|
|
16898
|
-
);
|
|
17214
|
+
return /* @__PURE__ */ jsxRuntime.jsx("span", { className: "tracking-[0]", children: fnFormatterValueLegend(
|
|
17215
|
+
value,
|
|
17216
|
+
mapperConfig,
|
|
17217
|
+
labelMap,
|
|
17218
|
+
legendUppercase
|
|
17219
|
+
) });
|
|
16899
17220
|
}
|
|
16900
17221
|
}
|
|
16901
17222
|
),
|
|
16902
17223
|
seriesOrder.map((s) => {
|
|
16903
|
-
|
|
16904
|
-
if (showOnlyHighlighted && !highlightedSeries.has(key))
|
|
17224
|
+
if (showOnlyHighlighted && !highlightedSeries.has(s.key))
|
|
16905
17225
|
return null;
|
|
16906
|
-
const label
|
|
16907
|
-
|
|
16908
|
-
|
|
16909
|
-
|
|
16910
|
-
|
|
16911
|
-
|
|
16912
|
-
|
|
16913
|
-
|
|
16914
|
-
}
|
|
17226
|
+
const { label, color, key } = fnBuildConfigData(
|
|
17227
|
+
s,
|
|
17228
|
+
mapperConfig,
|
|
17229
|
+
labelMap,
|
|
17230
|
+
finalColors,
|
|
17231
|
+
rightKeys,
|
|
17232
|
+
biaxialConfigNormalized
|
|
17233
|
+
);
|
|
16915
17234
|
if (s.type === "bar") {
|
|
16916
17235
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
16917
17236
|
recharts.Bar,
|
|
@@ -16938,14 +17257,8 @@ var Chart = ({
|
|
|
16938
17257
|
{
|
|
16939
17258
|
dataKey: key,
|
|
16940
17259
|
content: (props) => {
|
|
16941
|
-
|
|
16942
|
-
const barHeight = typeof p.height === "number" ? p.height : typeof p.height === "string" ? Number(p.height) : 0;
|
|
16943
|
-
const barWidth = typeof p.width === "number" ? p.width : typeof p.width === "string" ? Number(p.width) : 0;
|
|
16944
|
-
const smallThreshold = 14;
|
|
16945
|
-
const needsOutside = barHeight > 0 && barHeight < smallThreshold || barWidth > 0 && barWidth < smallThreshold;
|
|
16946
|
-
if (needsOutside) {
|
|
17260
|
+
if (!fnContentLabelList(props))
|
|
16947
17261
|
return null;
|
|
16948
|
-
}
|
|
16949
17262
|
const inside = renderInsideBarLabel(
|
|
16950
17263
|
color,
|
|
16951
17264
|
finalValueFormatter
|
|
@@ -18469,8 +18782,7 @@ function Leaderboard({
|
|
|
18469
18782
|
title = "LeaderBoard",
|
|
18470
18783
|
className,
|
|
18471
18784
|
isLoading = false,
|
|
18472
|
-
legend
|
|
18473
|
-
best = false
|
|
18785
|
+
legend
|
|
18474
18786
|
}) {
|
|
18475
18787
|
const [order, setOrder] = React33.useState(initialOrder);
|
|
18476
18788
|
const [searchTerm, setSearchTerm] = React33.useState("");
|
|
@@ -18502,55 +18814,54 @@ function Leaderboard({
|
|
|
18502
18814
|
if (typeof aValue === "number") return order === "desc" ? -1 : 1;
|
|
18503
18815
|
return order === "desc" ? 1 : -1;
|
|
18504
18816
|
});
|
|
18505
|
-
const getBadgeColor = (value
|
|
18506
|
-
if (best) {
|
|
18507
|
-
const third = total / 3;
|
|
18508
|
-
if (best) {
|
|
18509
|
-
if (index < third) return "green";
|
|
18510
|
-
if (index < 2 * third) return "yellow";
|
|
18511
|
-
return "red";
|
|
18512
|
-
}
|
|
18513
|
-
}
|
|
18817
|
+
const getBadgeColor = (value) => {
|
|
18514
18818
|
const numValue = typeof value === "string" ? parseFloat(value) : value;
|
|
18515
18819
|
if (isNaN(numValue)) return "green";
|
|
18516
|
-
if (numValue
|
|
18517
|
-
if (numValue >=
|
|
18518
|
-
return "
|
|
18820
|
+
if (numValue > 100) return "green";
|
|
18821
|
+
if (numValue >= 95) return "yellow";
|
|
18822
|
+
return "red";
|
|
18519
18823
|
};
|
|
18520
18824
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
18521
18825
|
"div",
|
|
18522
18826
|
{
|
|
18523
|
-
className: `border rounded-xl flex flex-col max-h-80 w-
|
|
18827
|
+
className: `border rounded-xl flex flex-col max-h-80 w-[52rem] ${className}`,
|
|
18524
18828
|
children: [
|
|
18525
18829
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between py-2 px-4 border-b flex-shrink-0 gap-3 ", children: [
|
|
18526
18830
|
/* @__PURE__ */ jsxRuntime.jsx("h2", { className: "text-lg font-semibold px-1 whitespace-nowrap", children: title }),
|
|
18527
|
-
/* @__PURE__ */ jsxRuntime.
|
|
18528
|
-
|
|
18529
|
-
|
|
18530
|
-
|
|
18531
|
-
|
|
18532
|
-
|
|
18533
|
-
|
|
18534
|
-
|
|
18535
|
-
|
|
18536
|
-
|
|
18537
|
-
|
|
18538
|
-
|
|
18539
|
-
|
|
18540
|
-
|
|
18541
|
-
|
|
18542
|
-
|
|
18543
|
-
|
|
18544
|
-
|
|
18545
|
-
|
|
18546
|
-
|
|
18547
|
-
|
|
18548
|
-
|
|
18549
|
-
|
|
18550
|
-
|
|
18551
|
-
|
|
18552
|
-
|
|
18553
|
-
|
|
18831
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [
|
|
18832
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
18833
|
+
InputBase,
|
|
18834
|
+
{
|
|
18835
|
+
value: searchTerm,
|
|
18836
|
+
onChange: (e) => {
|
|
18837
|
+
const value = e.target.value;
|
|
18838
|
+
if (/^[a-zA-Z0-9\s()À-ÿ~^´`]*$/.test(value)) {
|
|
18839
|
+
setSearchTerm(value);
|
|
18840
|
+
}
|
|
18841
|
+
},
|
|
18842
|
+
placeholder: "Pesquisar...",
|
|
18843
|
+
leftIcon: /* @__PURE__ */ jsxRuntime.jsx(react.MagnifyingGlassIcon, { size: 16 }),
|
|
18844
|
+
className: "h-8 py-1 w-24"
|
|
18845
|
+
}
|
|
18846
|
+
),
|
|
18847
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
18848
|
+
ButtonBase,
|
|
18849
|
+
{
|
|
18850
|
+
size: "icon",
|
|
18851
|
+
variant: "outline",
|
|
18852
|
+
onClick: () => setOrder(order === "desc" ? "asc" : "desc"),
|
|
18853
|
+
disabled: isLoading || sortedData.length === 0,
|
|
18854
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
18855
|
+
framerMotion.motion.div,
|
|
18856
|
+
{
|
|
18857
|
+
animate: { rotate: order === "asc" ? 180 : 0 },
|
|
18858
|
+
transition: { type: "spring", stiffness: 300, damping: 20 },
|
|
18859
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(react.CaretUpDownIcon, {})
|
|
18860
|
+
}
|
|
18861
|
+
)
|
|
18862
|
+
}
|
|
18863
|
+
)
|
|
18864
|
+
] })
|
|
18554
18865
|
] }),
|
|
18555
18866
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "overflow-y-auto flex-1 [&::-webkit-scrollbar]:w-1.5 [&::-webkit-scrollbar-track]:bg-transparent [&::-webkit-scrollbar-thumb]:bg-muted-foreground/20 [&::-webkit-scrollbar-thumb]:rounded-full hover:[&::-webkit-scrollbar-thumb]:bg-muted-foreground/40 transition-colors", children: isLoading ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "p-4 space-y-3", children: Array.from({ length: 5 }).map((_, idx) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between p-1", children: [
|
|
18556
18867
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-3 flex-1", children: [
|
|
@@ -18577,7 +18888,7 @@ function Leaderboard({
|
|
|
18577
18888
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
18578
18889
|
Badge,
|
|
18579
18890
|
{
|
|
18580
|
-
color: getBadgeColor(item.value
|
|
18891
|
+
color: getBadgeColor(item.value),
|
|
18581
18892
|
size: "md",
|
|
18582
18893
|
className: "font-bold",
|
|
18583
18894
|
children: item.value
|
|
@@ -18862,6 +19173,7 @@ exports.StartHour = StartHour;
|
|
|
18862
19173
|
exports.StartHourAgenda = StartHourAgenda;
|
|
18863
19174
|
exports.StatusIndicator = StatusIndicator;
|
|
18864
19175
|
exports.SwitchBase = SwitchBase;
|
|
19176
|
+
exports.SystemTooltip = SystemTooltip_default;
|
|
18865
19177
|
exports.TableBase = TableBase;
|
|
18866
19178
|
exports.TableBodyBase = TableBodyBase;
|
|
18867
19179
|
exports.TableCaptionBase = TableCaptionBase;
|