@mlw-packages/react-components 1.8.8 → 1.8.9
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 +157 -3
- package/dist/index.d.mts +115 -89
- package/dist/index.d.ts +115 -89
- package/dist/index.js +512 -226
- package/dist/index.mjs +513 -228
- package/package.json +1 -1
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
|
]
|
|
@@ -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: [
|
|
@@ -13826,7 +13881,7 @@ function MultiSelect({
|
|
|
13826
13881
|
|
|
13827
13882
|
// src/components/ui/charts/utils/helpers.ts
|
|
13828
13883
|
var formatFieldName = (fieldName) => {
|
|
13829
|
-
return fieldName.
|
|
13884
|
+
return (fieldName.match(/[^/_-]+/g) || []).map((word) => {
|
|
13830
13885
|
return word.charAt(0).toUpperCase() + word.slice(1);
|
|
13831
13886
|
}).join(" ").trim();
|
|
13832
13887
|
};
|
|
@@ -14553,7 +14608,7 @@ var DraggableTooltipComponent = ({
|
|
|
14553
14608
|
highlightedSeries,
|
|
14554
14609
|
toggleHighlight,
|
|
14555
14610
|
showOnlyHighlighted,
|
|
14556
|
-
valueFormatter
|
|
14611
|
+
valueFormatter,
|
|
14557
14612
|
categoryFormatter
|
|
14558
14613
|
}) => {
|
|
14559
14614
|
const visibleKeys = React33.useMemo(
|
|
@@ -14969,7 +15024,7 @@ var DraggableTooltipComponent = ({
|
|
|
14969
15024
|
{
|
|
14970
15025
|
data,
|
|
14971
15026
|
visibleKeys,
|
|
14972
|
-
valueFormatter
|
|
15027
|
+
valueFormatter
|
|
14973
15028
|
}
|
|
14974
15029
|
) })
|
|
14975
15030
|
] }) }),
|
|
@@ -14988,7 +15043,7 @@ var DraggableTooltipComponent = ({
|
|
|
14988
15043
|
);
|
|
14989
15044
|
const val = typeof value === "number" ? value : Number(value) || 0;
|
|
14990
15045
|
const defaultFormatted = val.toLocaleString("pt-BR");
|
|
14991
|
-
const displayValue =
|
|
15046
|
+
const displayValue = valueFormatter ? valueFormatter({
|
|
14992
15047
|
value,
|
|
14993
15048
|
formattedValue: defaultFormatted,
|
|
14994
15049
|
dataKey: key,
|
|
@@ -15069,7 +15124,7 @@ var DraggableTooltipComponent = ({
|
|
|
15069
15124
|
highlightedSeries,
|
|
15070
15125
|
toggleHighlight,
|
|
15071
15126
|
finalColors,
|
|
15072
|
-
|
|
15127
|
+
valueFormatter
|
|
15073
15128
|
]
|
|
15074
15129
|
),
|
|
15075
15130
|
/* @__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 +15158,7 @@ var RechartTooltipWithTotal = ({
|
|
|
15103
15158
|
finalColors = {},
|
|
15104
15159
|
periodLabel = "Per\xEDodo",
|
|
15105
15160
|
totalLabel = "Total",
|
|
15106
|
-
valueFormatter
|
|
15161
|
+
valueFormatter,
|
|
15107
15162
|
categoryFormatter,
|
|
15108
15163
|
yAxisMap,
|
|
15109
15164
|
isBiaxial = false
|
|
@@ -15127,7 +15182,7 @@ var RechartTooltipWithTotal = ({
|
|
|
15127
15182
|
}
|
|
15128
15183
|
return total.toLocaleString("pt-BR");
|
|
15129
15184
|
})();
|
|
15130
|
-
const displayTotal =
|
|
15185
|
+
const displayTotal = valueFormatter ? valueFormatter({
|
|
15131
15186
|
value: total,
|
|
15132
15187
|
formattedValue: defaultTotalFormatted,
|
|
15133
15188
|
dataKey: "total",
|
|
@@ -15190,7 +15245,7 @@ var RechartTooltipWithTotal = ({
|
|
|
15190
15245
|
}
|
|
15191
15246
|
return value.toLocaleString("pt-BR");
|
|
15192
15247
|
})();
|
|
15193
|
-
const displayValue =
|
|
15248
|
+
const displayValue = valueFormatter ? valueFormatter({
|
|
15194
15249
|
value: entry.value,
|
|
15195
15250
|
formattedValue: defaultFormatted,
|
|
15196
15251
|
dataKey: entry.dataKey,
|
|
@@ -15255,7 +15310,7 @@ var TooltipSimple = ({
|
|
|
15255
15310
|
label,
|
|
15256
15311
|
finalColors = {},
|
|
15257
15312
|
periodLabel = "Per\xEDodo",
|
|
15258
|
-
valueFormatter
|
|
15313
|
+
valueFormatter,
|
|
15259
15314
|
categoryFormatter,
|
|
15260
15315
|
yAxisMap,
|
|
15261
15316
|
isBiaxial = false
|
|
@@ -15303,7 +15358,7 @@ var TooltipSimple = ({
|
|
|
15303
15358
|
}
|
|
15304
15359
|
return value.toLocaleString("pt-BR");
|
|
15305
15360
|
})();
|
|
15306
|
-
const displayValue =
|
|
15361
|
+
const displayValue = valueFormatter ? valueFormatter({
|
|
15307
15362
|
value: entry.value,
|
|
15308
15363
|
formattedValue: defaultFormatted,
|
|
15309
15364
|
dataKey: entry.dataKey,
|
|
@@ -15345,6 +15400,210 @@ var TooltipSimple = ({
|
|
|
15345
15400
|
);
|
|
15346
15401
|
};
|
|
15347
15402
|
var TooltipSimple_default = TooltipSimple;
|
|
15403
|
+
var tooltipVariants2 = {
|
|
15404
|
+
hidden: {
|
|
15405
|
+
opacity: 0,
|
|
15406
|
+
scale: 0.96,
|
|
15407
|
+
transition: { type: "spring", stiffness: 400, damping: 28 }
|
|
15408
|
+
},
|
|
15409
|
+
visible: {
|
|
15410
|
+
opacity: 1,
|
|
15411
|
+
scale: 1,
|
|
15412
|
+
transition: { type: "spring", stiffness: 300, damping: 28 }
|
|
15413
|
+
},
|
|
15414
|
+
exit: {
|
|
15415
|
+
opacity: 0,
|
|
15416
|
+
scale: 0.96,
|
|
15417
|
+
transition: { type: "spring", stiffness: 400, damping: 28 }
|
|
15418
|
+
}
|
|
15419
|
+
};
|
|
15420
|
+
var SystemTooltip = ({
|
|
15421
|
+
id,
|
|
15422
|
+
data,
|
|
15423
|
+
position,
|
|
15424
|
+
title = "Conex\xF5es",
|
|
15425
|
+
onMouseDown,
|
|
15426
|
+
onClose,
|
|
15427
|
+
onPositionChange
|
|
15428
|
+
}) => {
|
|
15429
|
+
const [localPos, setLocalPos] = React33.useState(position);
|
|
15430
|
+
const [dragging, setDragging] = React33.useState(false);
|
|
15431
|
+
const offsetRef = React33.useRef({ x: 0, y: 0 });
|
|
15432
|
+
const lastMouse = React33.useRef({ x: 0, y: 0 });
|
|
15433
|
+
React33.useEffect(() => setLocalPos(position), [position]);
|
|
15434
|
+
React33.useEffect(() => {
|
|
15435
|
+
let rafId = null;
|
|
15436
|
+
const handleMouseMove = (e) => {
|
|
15437
|
+
if (!dragging) return;
|
|
15438
|
+
lastMouse.current = { x: e.clientX, y: e.clientY };
|
|
15439
|
+
if (rafId) cancelAnimationFrame(rafId);
|
|
15440
|
+
rafId = requestAnimationFrame(() => {
|
|
15441
|
+
const newLeft = lastMouse.current.x - offsetRef.current.x;
|
|
15442
|
+
const newTop = lastMouse.current.y - offsetRef.current.y;
|
|
15443
|
+
const rawPosition = {
|
|
15444
|
+
top: Math.max(0, Math.min(newTop, window.innerHeight - 200)),
|
|
15445
|
+
left: Math.max(0, Math.min(newLeft, window.innerWidth - 320))
|
|
15446
|
+
};
|
|
15447
|
+
setLocalPos(rawPosition);
|
|
15448
|
+
if (onPositionChange) onPositionChange(id, rawPosition);
|
|
15449
|
+
});
|
|
15450
|
+
};
|
|
15451
|
+
const handleMouseUp = () => {
|
|
15452
|
+
if (dragging) {
|
|
15453
|
+
setDragging(false);
|
|
15454
|
+
if (rafId) cancelAnimationFrame(rafId);
|
|
15455
|
+
}
|
|
15456
|
+
};
|
|
15457
|
+
if (dragging) {
|
|
15458
|
+
document.addEventListener("mousemove", handleMouseMove, {
|
|
15459
|
+
passive: true
|
|
15460
|
+
});
|
|
15461
|
+
document.addEventListener("mouseup", handleMouseUp);
|
|
15462
|
+
document.body.style.cursor = "grabbing";
|
|
15463
|
+
document.body.style.userSelect = "none";
|
|
15464
|
+
}
|
|
15465
|
+
return () => {
|
|
15466
|
+
if (rafId) cancelAnimationFrame(rafId);
|
|
15467
|
+
document.removeEventListener("mousemove", handleMouseMove);
|
|
15468
|
+
document.removeEventListener("mouseup", handleMouseUp);
|
|
15469
|
+
document.body.style.cursor = "";
|
|
15470
|
+
document.body.style.userSelect = "";
|
|
15471
|
+
};
|
|
15472
|
+
}, [dragging, id, onPositionChange]);
|
|
15473
|
+
const handleMouseDownLocal = React33.useCallback(
|
|
15474
|
+
(e) => {
|
|
15475
|
+
e.preventDefault();
|
|
15476
|
+
e.stopPropagation();
|
|
15477
|
+
const rect = e.currentTarget.closest(".fixed")?.getBoundingClientRect();
|
|
15478
|
+
if (!rect) return;
|
|
15479
|
+
offsetRef.current = { x: e.clientX - rect.left, y: e.clientY - rect.top };
|
|
15480
|
+
setDragging(true);
|
|
15481
|
+
onMouseDown?.(id, e);
|
|
15482
|
+
},
|
|
15483
|
+
[id, onMouseDown]
|
|
15484
|
+
);
|
|
15485
|
+
const handleTouchStartLocal = React33.useCallback(
|
|
15486
|
+
(e) => {
|
|
15487
|
+
e.stopPropagation();
|
|
15488
|
+
const touch = e.touches[0];
|
|
15489
|
+
if (!touch) return;
|
|
15490
|
+
const rect = e.currentTarget.closest(".fixed")?.getBoundingClientRect();
|
|
15491
|
+
if (!rect) return;
|
|
15492
|
+
offsetRef.current = {
|
|
15493
|
+
x: touch.clientX - rect.left,
|
|
15494
|
+
y: touch.clientY - rect.top
|
|
15495
|
+
};
|
|
15496
|
+
setDragging(true);
|
|
15497
|
+
onMouseDown?.(id, e);
|
|
15498
|
+
},
|
|
15499
|
+
[id, onMouseDown]
|
|
15500
|
+
);
|
|
15501
|
+
const entries = React33.useMemo(
|
|
15502
|
+
() => data.connections.filter((c) => c.type === "entrada"),
|
|
15503
|
+
[data.connections]
|
|
15504
|
+
);
|
|
15505
|
+
const exits = React33.useMemo(
|
|
15506
|
+
() => data.connections.filter((c) => c.type === "saida"),
|
|
15507
|
+
[data.connections]
|
|
15508
|
+
);
|
|
15509
|
+
return /* @__PURE__ */ jsxRuntime.jsx(framerMotion.AnimatePresence, { children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
15510
|
+
framerMotion.motion.div,
|
|
15511
|
+
{
|
|
15512
|
+
className: "fixed bg-card/95 backdrop-blur-md border border-border/50 rounded-xl shadow-2xl z-50 w-80 overflow-hidden",
|
|
15513
|
+
variants: tooltipVariants2,
|
|
15514
|
+
initial: "hidden",
|
|
15515
|
+
animate: "visible",
|
|
15516
|
+
exit: "exit",
|
|
15517
|
+
style: {
|
|
15518
|
+
top: localPos.top,
|
|
15519
|
+
left: localPos.left
|
|
15520
|
+
},
|
|
15521
|
+
onClick: (e) => e.stopPropagation(),
|
|
15522
|
+
children: [
|
|
15523
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
15524
|
+
"div",
|
|
15525
|
+
{
|
|
15526
|
+
className: "flex items-center justify-between py-1 border-b border-border/10 bg-muted/30 ",
|
|
15527
|
+
onMouseDown: handleMouseDownLocal,
|
|
15528
|
+
onTouchStart: handleTouchStartLocal,
|
|
15529
|
+
style: {
|
|
15530
|
+
touchAction: "none",
|
|
15531
|
+
cursor: dragging ? "grabbing" : "grab"
|
|
15532
|
+
},
|
|
15533
|
+
children: [
|
|
15534
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2 px-3", children: [
|
|
15535
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "rounded", children: /* @__PURE__ */ jsxRuntime.jsx(react.DotsSixVerticalIcon, { size: 16, className: "text-primary" }) }),
|
|
15536
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-xs font-semibold text-muted-foreground uppercase tracking-wider", children: title })
|
|
15537
|
+
] }),
|
|
15538
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
15539
|
+
ButtonBase,
|
|
15540
|
+
{
|
|
15541
|
+
variant: "ghost",
|
|
15542
|
+
size: "icon",
|
|
15543
|
+
onClick: () => onClose(id),
|
|
15544
|
+
className: "text-muted-foreground hover:text-destructive transition-colors hover:bg-destructive/10 mr-1",
|
|
15545
|
+
style: { cursor: "pointer" },
|
|
15546
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(ssr.XIcon, { size: 16 })
|
|
15547
|
+
}
|
|
15548
|
+
)
|
|
15549
|
+
]
|
|
15550
|
+
}
|
|
15551
|
+
),
|
|
15552
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "px-4 pt-4 pb-3", children: [
|
|
15553
|
+
/* @__PURE__ */ jsxRuntime.jsx("h3", { className: "text-xl font-bold text-foreground tracking-tight truncate", children: data.name }),
|
|
15554
|
+
/* @__PURE__ */ jsxRuntime.jsx("h3", { className: "text-sm font-bold text-muted-foreground tracking-tight truncate", children: data.description })
|
|
15555
|
+
] }),
|
|
15556
|
+
/* @__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: [
|
|
15557
|
+
/* @__PURE__ */ jsxRuntime.jsx(SeparatorBase, { className: "w-full" }),
|
|
15558
|
+
entries.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-2", children: [
|
|
15559
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2 px-1", children: [
|
|
15560
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-1.5 h-1.5 rounded-full bg-emerald-500" }),
|
|
15561
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[10px] font-bold text-muted-foreground uppercase", children: "Entradas" })
|
|
15562
|
+
] }),
|
|
15563
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "space-y-1", children: entries.map((conn) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
15564
|
+
"div",
|
|
15565
|
+
{
|
|
15566
|
+
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",
|
|
15567
|
+
children: [
|
|
15568
|
+
/* @__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 }) }),
|
|
15569
|
+
" ",
|
|
15570
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
15571
|
+
react.ArrowRight,
|
|
15572
|
+
{
|
|
15573
|
+
size: 14,
|
|
15574
|
+
className: "text-emerald-500 shrink-0 rotate-180"
|
|
15575
|
+
}
|
|
15576
|
+
)
|
|
15577
|
+
]
|
|
15578
|
+
},
|
|
15579
|
+
conn.id
|
|
15580
|
+
)) })
|
|
15581
|
+
] }),
|
|
15582
|
+
exits.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-2", children: [
|
|
15583
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2 px-1", children: [
|
|
15584
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-1.5 h-1.5 rounded-full bg-blue-500" }),
|
|
15585
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[10px] font-bold text-muted-foreground uppercase", children: "Sa\xEDdas" })
|
|
15586
|
+
] }),
|
|
15587
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "space-y-1", children: exits.map((conn) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
15588
|
+
"div",
|
|
15589
|
+
{
|
|
15590
|
+
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",
|
|
15591
|
+
children: [
|
|
15592
|
+
/* @__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 }) }),
|
|
15593
|
+
/* @__PURE__ */ jsxRuntime.jsx(react.ArrowRight, { size: 14, className: "text-blue-500 shrink-0" })
|
|
15594
|
+
]
|
|
15595
|
+
},
|
|
15596
|
+
conn.id
|
|
15597
|
+
)) })
|
|
15598
|
+
] }),
|
|
15599
|
+
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" }) })
|
|
15600
|
+
] })
|
|
15601
|
+
]
|
|
15602
|
+
},
|
|
15603
|
+
id
|
|
15604
|
+
) });
|
|
15605
|
+
};
|
|
15606
|
+
var SystemTooltip_default = SystemTooltip;
|
|
15348
15607
|
var Brush = ({
|
|
15349
15608
|
data,
|
|
15350
15609
|
legend,
|
|
@@ -15599,11 +15858,11 @@ var parseNumber = (v) => {
|
|
|
15599
15858
|
return Number(v);
|
|
15600
15859
|
return void 0;
|
|
15601
15860
|
};
|
|
15602
|
-
var renderPillLabel = (color, variant,
|
|
15861
|
+
var renderPillLabel = (color, variant, valueFormatter) => {
|
|
15603
15862
|
return (props) => {
|
|
15604
15863
|
const { x, y, value } = props;
|
|
15605
15864
|
const defaultFormatted = typeof value === "number" ? formatCompactNumber(value) : String(value ?? "");
|
|
15606
|
-
const text =
|
|
15865
|
+
const text = valueFormatter ? valueFormatter({
|
|
15607
15866
|
value,
|
|
15608
15867
|
formattedValue: defaultFormatted,
|
|
15609
15868
|
...props
|
|
@@ -15692,11 +15951,11 @@ var renderPillLabel = (color, variant, valueFormatter2) => {
|
|
|
15692
15951
|
};
|
|
15693
15952
|
};
|
|
15694
15953
|
var pillLabelRenderer_default = renderPillLabel;
|
|
15695
|
-
var renderInsideBarLabel = (color,
|
|
15954
|
+
var renderInsideBarLabel = (color, valueFormatter) => {
|
|
15696
15955
|
return (props) => {
|
|
15697
15956
|
const { x, y, value, width, height, viewBox, cx, cy, index } = props;
|
|
15698
15957
|
const defaultFormatted = typeof value === "number" ? formatCompactNumber(value) : String(value ?? "");
|
|
15699
|
-
const text =
|
|
15958
|
+
const text = valueFormatter ? valueFormatter({ value, formattedValue: defaultFormatted, ...props }) : defaultFormatted;
|
|
15700
15959
|
const parseNumberLocal = (v) => {
|
|
15701
15960
|
if (typeof v === "number") return v;
|
|
15702
15961
|
if (typeof v === "string" && v.trim() !== "" && !Number.isNaN(Number(v)))
|
|
@@ -15841,7 +16100,7 @@ var NoData = ({
|
|
|
15841
16100
|
"div",
|
|
15842
16101
|
{
|
|
15843
16102
|
className: cn(
|
|
15844
|
-
"rounded-xl bg-card relative overflow-hidden w-full border border-border/50 shadow-sm",
|
|
16103
|
+
"rounded-xl bg-card relative overflow-hidden w-full border border-border/50 shadow-sm h-full",
|
|
15845
16104
|
className
|
|
15846
16105
|
),
|
|
15847
16106
|
style: {
|
|
@@ -16298,6 +16557,128 @@ function useTimeSeriesRange({
|
|
|
16298
16557
|
handleMouseDown
|
|
16299
16558
|
};
|
|
16300
16559
|
}
|
|
16560
|
+
var filtersOrder = (mapperConfig, series) => {
|
|
16561
|
+
const seriesOrder = [];
|
|
16562
|
+
if (series) {
|
|
16563
|
+
if (series.bar)
|
|
16564
|
+
series.bar.forEach((k) => seriesOrder.push({ type: "bar", key: k }));
|
|
16565
|
+
if (series.line)
|
|
16566
|
+
series.line.forEach((k) => seriesOrder.push({ type: "line", key: k }));
|
|
16567
|
+
if (series.area)
|
|
16568
|
+
series.area.forEach((k) => seriesOrder.push({ type: "area", key: k }));
|
|
16569
|
+
} else {
|
|
16570
|
+
Object.keys(mapperConfig).forEach(
|
|
16571
|
+
(k) => seriesOrder.push({ type: "bar", key: k })
|
|
16572
|
+
);
|
|
16573
|
+
}
|
|
16574
|
+
return seriesOrder;
|
|
16575
|
+
};
|
|
16576
|
+
var fnOpenTooltipForPeriod = (enableDraggableTooltips, processedData, periodName, activeTooltips, setActiveTooltips, maxTooltips, effectiveChartWidth) => {
|
|
16577
|
+
if (!enableDraggableTooltips) return;
|
|
16578
|
+
const row = processedData.find((r) => String(r.name) === periodName);
|
|
16579
|
+
if (!row) return;
|
|
16580
|
+
const tooltipId = String(periodName);
|
|
16581
|
+
const existingIndex = activeTooltips.findIndex((t) => t.id === tooltipId);
|
|
16582
|
+
if (existingIndex !== -1) {
|
|
16583
|
+
setActiveTooltips((prev) => prev.filter((t) => t.id !== tooltipId));
|
|
16584
|
+
return;
|
|
16585
|
+
}
|
|
16586
|
+
if (activeTooltips.length >= maxTooltips) {
|
|
16587
|
+
sonner.toast.warning(
|
|
16588
|
+
`Limite de ${maxTooltips} janelas de informa\xE7\xE3o atingido. A mais antiga ser\xE1 substitu\xEDda.`
|
|
16589
|
+
);
|
|
16590
|
+
}
|
|
16591
|
+
const offsetIndex = activeTooltips.length;
|
|
16592
|
+
const availableWidth = effectiveChartWidth;
|
|
16593
|
+
const gap = 28;
|
|
16594
|
+
const leftGap = 28;
|
|
16595
|
+
const newTooltip = {
|
|
16596
|
+
id: tooltipId,
|
|
16597
|
+
data: row,
|
|
16598
|
+
position: {
|
|
16599
|
+
top: 48 + offsetIndex * gap,
|
|
16600
|
+
left: Math.max(120, availableWidth - 280 - offsetIndex * leftGap)
|
|
16601
|
+
}
|
|
16602
|
+
};
|
|
16603
|
+
setActiveTooltips((prev) => {
|
|
16604
|
+
const next = [...prev, newTooltip];
|
|
16605
|
+
return next.length > maxTooltips ? next.slice(1) : next;
|
|
16606
|
+
});
|
|
16607
|
+
};
|
|
16608
|
+
var fnSmartConfig = ({ xAxis, data, labelMap }) => {
|
|
16609
|
+
const resolvedXAxisKey = typeof xAxis === "string" ? xAxis : xAxis && xAxis.dataKey || detectXAxis(data);
|
|
16610
|
+
const xAxisConfig = typeof xAxis === "string" ? {
|
|
16611
|
+
dataKey: resolvedXAxisKey,
|
|
16612
|
+
label: formatFieldName(resolvedXAxisKey),
|
|
16613
|
+
autoLabel: true
|
|
16614
|
+
} : {
|
|
16615
|
+
dataKey: resolvedXAxisKey,
|
|
16616
|
+
label: xAxis?.label ?? formatFieldName(resolvedXAxisKey),
|
|
16617
|
+
valueFormatter: xAxis?.valueFormatter,
|
|
16618
|
+
autoLabel: xAxis?.autoLabel ?? true
|
|
16619
|
+
};
|
|
16620
|
+
const detectedFields = detectDataFields(data, xAxisConfig.dataKey);
|
|
16621
|
+
const mapperConfig = detectedFields.reduce((acc, field) => {
|
|
16622
|
+
acc[field] = {
|
|
16623
|
+
label: labelMap?.[field] ?? formatFieldName(field),
|
|
16624
|
+
type: "number",
|
|
16625
|
+
visible: true
|
|
16626
|
+
};
|
|
16627
|
+
return acc;
|
|
16628
|
+
}, {});
|
|
16629
|
+
return { xAxisConfig, mapperConfig };
|
|
16630
|
+
};
|
|
16631
|
+
var fnConfigRightKeys = (biaxialConfigNormalized, yTickFormatter, finalColors) => {
|
|
16632
|
+
const decimals = typeof biaxialConfigNormalized?.decimals === "number" ? Math.max(0, Math.floor(biaxialConfigNormalized.decimals)) : 2;
|
|
16633
|
+
const rightTickFormatter = (v) => {
|
|
16634
|
+
if (biaxialConfigNormalized?.percentage) {
|
|
16635
|
+
const num = Number(String(v));
|
|
16636
|
+
const nf = new Intl.NumberFormat("pt-BR", {
|
|
16637
|
+
minimumFractionDigits: decimals,
|
|
16638
|
+
maximumFractionDigits: decimals
|
|
16639
|
+
});
|
|
16640
|
+
const out = Number.isNaN(num) ? String(v ?? "") : nf.format(num);
|
|
16641
|
+
return `${out}%`;
|
|
16642
|
+
}
|
|
16643
|
+
return yTickFormatter(v);
|
|
16644
|
+
};
|
|
16645
|
+
const firstRightKey = biaxialConfigNormalized?.key && biaxialConfigNormalized.key[0];
|
|
16646
|
+
const defaultRightColor = firstRightKey && finalColors[firstRightKey] || "hsl(var(--muted-foreground))";
|
|
16647
|
+
const rightAxisColor = (() => {
|
|
16648
|
+
if (!biaxialConfigNormalized) return defaultRightColor;
|
|
16649
|
+
if (typeof biaxialConfigNormalized.stroke === "string")
|
|
16650
|
+
return biaxialConfigNormalized.stroke;
|
|
16651
|
+
if (biaxialConfigNormalized.stroke && firstRightKey && typeof biaxialConfigNormalized.stroke === "object")
|
|
16652
|
+
return biaxialConfigNormalized.stroke[firstRightKey] || defaultRightColor;
|
|
16653
|
+
return defaultRightColor;
|
|
16654
|
+
})();
|
|
16655
|
+
return { rightAxisColor, rightTickFormatter };
|
|
16656
|
+
};
|
|
16657
|
+
var fnFormatterValueLegend = (value, mapperConfig, labelMap, legendUppercase) => {
|
|
16658
|
+
const key = String(value);
|
|
16659
|
+
const label = mapperConfig[key]?.label ?? labelMap?.[key] ?? formatFieldName(key);
|
|
16660
|
+
return legendUppercase ? label.toUpperCase() : label;
|
|
16661
|
+
};
|
|
16662
|
+
var fnBuildConfigData = (s, mapperConfig, labelMap, finalColors, rightKeys, biaxialConfigNormalized) => {
|
|
16663
|
+
const key = s.key;
|
|
16664
|
+
const label = mapperConfig[key]?.label ?? labelMap?.[key] ?? formatFieldName(key);
|
|
16665
|
+
let color = finalColors[key];
|
|
16666
|
+
if (rightKeys.includes(key) && biaxialConfigNormalized?.stroke) {
|
|
16667
|
+
if (typeof biaxialConfigNormalized.stroke === "string") {
|
|
16668
|
+
color = biaxialConfigNormalized.stroke;
|
|
16669
|
+
} else {
|
|
16670
|
+
color = biaxialConfigNormalized.stroke[key] ?? color;
|
|
16671
|
+
}
|
|
16672
|
+
}
|
|
16673
|
+
return { label, color, key };
|
|
16674
|
+
};
|
|
16675
|
+
var fnContentLabelList = (p) => {
|
|
16676
|
+
const barHeight = typeof p.height === "number" ? p.height : typeof p.height === "string" ? Number(p.height) : 0;
|
|
16677
|
+
const barWidth = typeof p.width === "number" ? p.width : typeof p.width === "string" ? Number(p.width) : 0;
|
|
16678
|
+
const smallThreshold = 14;
|
|
16679
|
+
const needsOutside = barHeight > 0 && barHeight < smallThreshold || barWidth > 0 && barWidth < smallThreshold;
|
|
16680
|
+
return needsOutside ? null : true;
|
|
16681
|
+
};
|
|
16301
16682
|
var DEFAULT_COLORS2 = ["#55af7d", "#8e68ff", "#2273e1"];
|
|
16302
16683
|
var Chart = ({
|
|
16303
16684
|
data,
|
|
@@ -16319,7 +16700,7 @@ var Chart = ({
|
|
|
16319
16700
|
xAxisLabel,
|
|
16320
16701
|
yAxisLabel,
|
|
16321
16702
|
labelMap,
|
|
16322
|
-
valueFormatter
|
|
16703
|
+
valueFormatter,
|
|
16323
16704
|
categoryFormatter,
|
|
16324
16705
|
enableHighlights = false,
|
|
16325
16706
|
enableShowOnly = false,
|
|
@@ -16336,30 +16717,9 @@ var Chart = ({
|
|
|
16336
16717
|
timeSeriesLegend,
|
|
16337
16718
|
customLegend
|
|
16338
16719
|
}) => {
|
|
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 };
|
|
16720
|
+
const { xAxisConfig, mapperConfig } = React33.useMemo(() => {
|
|
16721
|
+
return fnSmartConfig({ xAxis, data, labelMap });
|
|
16361
16722
|
}, [data, xAxis, labelMap]);
|
|
16362
|
-
const { xAxisConfig, mapperConfig } = smartConfig;
|
|
16363
16723
|
const {
|
|
16364
16724
|
highlightedSeries,
|
|
16365
16725
|
showOnlyHighlighted,
|
|
@@ -16401,19 +16761,7 @@ var Chart = ({
|
|
|
16401
16761
|
}
|
|
16402
16762
|
return mapped;
|
|
16403
16763
|
}, [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
|
-
}
|
|
16764
|
+
const seriesOrder = filtersOrder(mapperConfig, series);
|
|
16417
16765
|
const allKeys = seriesOrder.map((s) => s.key).filter(Boolean);
|
|
16418
16766
|
const finalColors = React33.useMemo(
|
|
16419
16767
|
() => generateColorMap(allKeys, colors2, mapperConfig),
|
|
@@ -16496,8 +16844,8 @@ var Chart = ({
|
|
|
16496
16844
|
[highlightedSeries]
|
|
16497
16845
|
);
|
|
16498
16846
|
const finalValueFormatter = React33.useMemo(
|
|
16499
|
-
() => createValueFormatter(
|
|
16500
|
-
[
|
|
16847
|
+
() => createValueFormatter(valueFormatter, formatBR),
|
|
16848
|
+
[valueFormatter, formatBR]
|
|
16501
16849
|
);
|
|
16502
16850
|
const yTickFormatter = React33.useMemo(
|
|
16503
16851
|
() => createYTickFormatter(finalValueFormatter),
|
|
@@ -16532,36 +16880,15 @@ var Chart = ({
|
|
|
16532
16880
|
const rightYAxisLabelDx = Math.max(12, Math.round(finalChartRightMargin / 2));
|
|
16533
16881
|
const openTooltipForPeriod = React33.useCallback(
|
|
16534
16882
|
(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
|
-
});
|
|
16883
|
+
fnOpenTooltipForPeriod(
|
|
16884
|
+
enableDraggableTooltips,
|
|
16885
|
+
processedData,
|
|
16886
|
+
periodName,
|
|
16887
|
+
activeTooltips,
|
|
16888
|
+
setActiveTooltips,
|
|
16889
|
+
maxTooltips,
|
|
16890
|
+
effectiveChartWidth
|
|
16891
|
+
);
|
|
16565
16892
|
},
|
|
16566
16893
|
[
|
|
16567
16894
|
enableDraggableTooltips,
|
|
@@ -16800,29 +17127,7 @@ var Chart = ({
|
|
|
16800
17127
|
}
|
|
16801
17128
|
),
|
|
16802
17129
|
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
|
-
})();
|
|
17130
|
+
const { rightAxisColor, rightTickFormatter } = fnConfigRightKeys(biaxialConfigNormalized, yTickFormatter, finalColors);
|
|
16826
17131
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
16827
17132
|
recharts.YAxis,
|
|
16828
17133
|
{
|
|
@@ -16880,38 +17185,26 @@ var Chart = ({
|
|
|
16880
17185
|
{
|
|
16881
17186
|
iconSize: 12,
|
|
16882
17187
|
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
|
-
);
|
|
17188
|
+
return /* @__PURE__ */ jsxRuntime.jsx("span", { className: "tracking-[0]", children: fnFormatterValueLegend(
|
|
17189
|
+
value,
|
|
17190
|
+
mapperConfig,
|
|
17191
|
+
labelMap,
|
|
17192
|
+
legendUppercase
|
|
17193
|
+
) });
|
|
16899
17194
|
}
|
|
16900
17195
|
}
|
|
16901
17196
|
),
|
|
16902
17197
|
seriesOrder.map((s) => {
|
|
16903
|
-
|
|
16904
|
-
if (showOnlyHighlighted && !highlightedSeries.has(key))
|
|
17198
|
+
if (showOnlyHighlighted && !highlightedSeries.has(s.key))
|
|
16905
17199
|
return null;
|
|
16906
|
-
const label
|
|
16907
|
-
|
|
16908
|
-
|
|
16909
|
-
|
|
16910
|
-
|
|
16911
|
-
|
|
16912
|
-
|
|
16913
|
-
|
|
16914
|
-
}
|
|
17200
|
+
const { label, color, key } = fnBuildConfigData(
|
|
17201
|
+
s,
|
|
17202
|
+
mapperConfig,
|
|
17203
|
+
labelMap,
|
|
17204
|
+
finalColors,
|
|
17205
|
+
rightKeys,
|
|
17206
|
+
biaxialConfigNormalized
|
|
17207
|
+
);
|
|
16915
17208
|
if (s.type === "bar") {
|
|
16916
17209
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
16917
17210
|
recharts.Bar,
|
|
@@ -16938,14 +17231,8 @@ var Chart = ({
|
|
|
16938
17231
|
{
|
|
16939
17232
|
dataKey: key,
|
|
16940
17233
|
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) {
|
|
17234
|
+
if (!fnContentLabelList(props))
|
|
16947
17235
|
return null;
|
|
16948
|
-
}
|
|
16949
17236
|
const inside = renderInsideBarLabel(
|
|
16950
17237
|
color,
|
|
16951
17238
|
finalValueFormatter
|
|
@@ -18469,8 +18756,7 @@ function Leaderboard({
|
|
|
18469
18756
|
title = "LeaderBoard",
|
|
18470
18757
|
className,
|
|
18471
18758
|
isLoading = false,
|
|
18472
|
-
legend
|
|
18473
|
-
best = false
|
|
18759
|
+
legend
|
|
18474
18760
|
}) {
|
|
18475
18761
|
const [order, setOrder] = React33.useState(initialOrder);
|
|
18476
18762
|
const [searchTerm, setSearchTerm] = React33.useState("");
|
|
@@ -18502,55 +18788,54 @@ function Leaderboard({
|
|
|
18502
18788
|
if (typeof aValue === "number") return order === "desc" ? -1 : 1;
|
|
18503
18789
|
return order === "desc" ? 1 : -1;
|
|
18504
18790
|
});
|
|
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
|
-
}
|
|
18791
|
+
const getBadgeColor = (value) => {
|
|
18514
18792
|
const numValue = typeof value === "string" ? parseFloat(value) : value;
|
|
18515
18793
|
if (isNaN(numValue)) return "green";
|
|
18516
|
-
if (numValue
|
|
18517
|
-
if (numValue >=
|
|
18518
|
-
return "
|
|
18794
|
+
if (numValue > 100) return "green";
|
|
18795
|
+
if (numValue >= 95) return "yellow";
|
|
18796
|
+
return "red";
|
|
18519
18797
|
};
|
|
18520
18798
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
18521
18799
|
"div",
|
|
18522
18800
|
{
|
|
18523
|
-
className: `border rounded-xl flex flex-col max-h-80 w-
|
|
18801
|
+
className: `border rounded-xl flex flex-col max-h-80 w-[52rem] ${className}`,
|
|
18524
18802
|
children: [
|
|
18525
18803
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between py-2 px-4 border-b flex-shrink-0 gap-3 ", children: [
|
|
18526
18804
|
/* @__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
|
-
|
|
18805
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [
|
|
18806
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
18807
|
+
InputBase,
|
|
18808
|
+
{
|
|
18809
|
+
value: searchTerm,
|
|
18810
|
+
onChange: (e) => {
|
|
18811
|
+
const value = e.target.value;
|
|
18812
|
+
if (/^[a-zA-Z0-9\s()À-ÿ~^´`]*$/.test(value)) {
|
|
18813
|
+
setSearchTerm(value);
|
|
18814
|
+
}
|
|
18815
|
+
},
|
|
18816
|
+
placeholder: "Pesquisar...",
|
|
18817
|
+
leftIcon: /* @__PURE__ */ jsxRuntime.jsx(react.MagnifyingGlassIcon, { size: 16 }),
|
|
18818
|
+
className: "h-8 py-1 w-24"
|
|
18819
|
+
}
|
|
18820
|
+
),
|
|
18821
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
18822
|
+
ButtonBase,
|
|
18823
|
+
{
|
|
18824
|
+
size: "icon",
|
|
18825
|
+
variant: "outline",
|
|
18826
|
+
onClick: () => setOrder(order === "desc" ? "asc" : "desc"),
|
|
18827
|
+
disabled: isLoading || sortedData.length === 0,
|
|
18828
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
18829
|
+
framerMotion.motion.div,
|
|
18830
|
+
{
|
|
18831
|
+
animate: { rotate: order === "asc" ? 180 : 0 },
|
|
18832
|
+
transition: { type: "spring", stiffness: 300, damping: 20 },
|
|
18833
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(react.CaretUpDownIcon, {})
|
|
18834
|
+
}
|
|
18835
|
+
)
|
|
18836
|
+
}
|
|
18837
|
+
)
|
|
18838
|
+
] })
|
|
18554
18839
|
] }),
|
|
18555
18840
|
/* @__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
18841
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-3 flex-1", children: [
|
|
@@ -18577,7 +18862,7 @@ function Leaderboard({
|
|
|
18577
18862
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
18578
18863
|
Badge,
|
|
18579
18864
|
{
|
|
18580
|
-
color: getBadgeColor(item.value
|
|
18865
|
+
color: getBadgeColor(item.value),
|
|
18581
18866
|
size: "md",
|
|
18582
18867
|
className: "font-bold",
|
|
18583
18868
|
children: item.value
|
|
@@ -18862,6 +19147,7 @@ exports.StartHour = StartHour;
|
|
|
18862
19147
|
exports.StartHourAgenda = StartHourAgenda;
|
|
18863
19148
|
exports.StatusIndicator = StatusIndicator;
|
|
18864
19149
|
exports.SwitchBase = SwitchBase;
|
|
19150
|
+
exports.SystemTooltip = SystemTooltip_default;
|
|
18865
19151
|
exports.TableBase = TableBase;
|
|
18866
19152
|
exports.TableBodyBase = TableBodyBase;
|
|
18867
19153
|
exports.TableCaptionBase = TableCaptionBase;
|