@mlw-packages/react-components 1.10.20 → 1.10.21
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 +6 -3
- package/dist/index.d.mts +30 -8
- package/dist/index.d.ts +30 -8
- package/dist/index.js +446 -222
- package/dist/index.mjs +447 -223
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -3485,58 +3485,100 @@ var ThemeIcon = ({ theme }) => {
|
|
|
3485
3485
|
}
|
|
3486
3486
|
) });
|
|
3487
3487
|
};
|
|
3488
|
+
function resolveOrigin(origin, buttonRef, cursorPos) {
|
|
3489
|
+
if (origin === "cursor" && cursorPos) {
|
|
3490
|
+
return cursorPos;
|
|
3491
|
+
}
|
|
3492
|
+
if (!buttonRef.current) {
|
|
3493
|
+
return { x: window.innerWidth / 2, y: window.innerHeight / 2 };
|
|
3494
|
+
}
|
|
3495
|
+
const rect = buttonRef.current.getBoundingClientRect();
|
|
3496
|
+
switch (origin) {
|
|
3497
|
+
case "top-left":
|
|
3498
|
+
return { x: rect.left, y: rect.top };
|
|
3499
|
+
case "top-right":
|
|
3500
|
+
return { x: rect.right, y: rect.top };
|
|
3501
|
+
case "center":
|
|
3502
|
+
default:
|
|
3503
|
+
return { x: rect.left + rect.width / 2, y: rect.top + rect.height / 2 };
|
|
3504
|
+
}
|
|
3505
|
+
}
|
|
3488
3506
|
function ModeToggleBase({
|
|
3489
3507
|
themes = ["light", "dark", "system"],
|
|
3490
3508
|
className,
|
|
3491
3509
|
directToggle = false,
|
|
3492
|
-
variant = "ghost"
|
|
3510
|
+
variant = "ghost",
|
|
3511
|
+
showLabel = false,
|
|
3512
|
+
tooltip = false,
|
|
3513
|
+
animationOrigin = "center",
|
|
3514
|
+
transitionDuration = 400,
|
|
3515
|
+
storageKey,
|
|
3516
|
+
defaultTheme,
|
|
3517
|
+
onThemeChange
|
|
3493
3518
|
}) {
|
|
3494
3519
|
const [mounted, setMounted] = React32.useState(false);
|
|
3520
|
+
const [isTransitioning, setIsTransitioning] = React32.useState(false);
|
|
3521
|
+
const cursorPos = React32.useRef(null);
|
|
3495
3522
|
const { setTheme, theme: currentTheme } = useTheme();
|
|
3496
3523
|
const buttonRef = React32.useRef(null);
|
|
3497
3524
|
React32.useEffect(() => {
|
|
3525
|
+
if (storageKey && defaultTheme) {
|
|
3526
|
+
const stored = localStorage.getItem(storageKey);
|
|
3527
|
+
if (!stored) setTheme(defaultTheme);
|
|
3528
|
+
} else if (defaultTheme && !localStorage.getItem("theme")) {
|
|
3529
|
+
setTheme(defaultTheme);
|
|
3530
|
+
}
|
|
3498
3531
|
setMounted(true);
|
|
3499
|
-
}, []);
|
|
3532
|
+
}, [defaultTheme, setTheme, storageKey]);
|
|
3500
3533
|
const isDark = mounted && (currentTheme?.includes("dark") || currentTheme === "system" && typeof window !== "undefined" && window.matchMedia("(prefers-color-scheme: dark)").matches);
|
|
3534
|
+
const activeTheme = mounted ? currentTheme : defaultTheme;
|
|
3535
|
+
const tooltipText = tooltip === true ? themeLabels[activeTheme] ?? "Toggle theme" : typeof tooltip === "string" ? tooltip : null;
|
|
3501
3536
|
const toggleTheme = async (newTheme) => {
|
|
3537
|
+
if (isTransitioning) return;
|
|
3502
3538
|
if (!buttonRef.current) {
|
|
3503
3539
|
setTheme(newTheme);
|
|
3540
|
+
onThemeChange?.(newTheme);
|
|
3504
3541
|
return;
|
|
3505
3542
|
}
|
|
3506
3543
|
const supportsViewTransition = typeof document !== "undefined" && "startViewTransition" in document && typeof document.startViewTransition === "function";
|
|
3507
3544
|
if (!supportsViewTransition) {
|
|
3508
3545
|
setTheme(newTheme);
|
|
3546
|
+
onThemeChange?.(newTheme);
|
|
3509
3547
|
return;
|
|
3510
3548
|
}
|
|
3511
3549
|
try {
|
|
3512
|
-
|
|
3513
|
-
const x
|
|
3514
|
-
|
|
3550
|
+
setIsTransitioning(true);
|
|
3551
|
+
const { x, y } = resolveOrigin(
|
|
3552
|
+
animationOrigin,
|
|
3553
|
+
buttonRef,
|
|
3554
|
+
cursorPos.current
|
|
3555
|
+
);
|
|
3515
3556
|
const endRadius = Math.hypot(
|
|
3516
3557
|
Math.max(x, window.innerWidth - x),
|
|
3517
3558
|
Math.max(y, window.innerHeight - y)
|
|
3518
3559
|
);
|
|
3519
3560
|
const transition = document.startViewTransition(async () => {
|
|
3520
3561
|
setTheme(newTheme);
|
|
3562
|
+
onThemeChange?.(newTheme);
|
|
3521
3563
|
});
|
|
3522
3564
|
await transition.ready;
|
|
3523
|
-
document.documentElement.animate(
|
|
3565
|
+
const animation = document.documentElement.animate(
|
|
3524
3566
|
[
|
|
3525
|
-
{
|
|
3526
|
-
|
|
3527
|
-
},
|
|
3528
|
-
{
|
|
3529
|
-
clipPath: `circle(${Math.ceil(endRadius)}px at ${x}px ${y}px)`
|
|
3530
|
-
}
|
|
3567
|
+
{ clipPath: `circle(0px at ${x}px ${y}px)` },
|
|
3568
|
+
{ clipPath: `circle(${Math.ceil(endRadius)}px at ${x}px ${y}px)` }
|
|
3531
3569
|
],
|
|
3532
3570
|
{
|
|
3533
|
-
duration:
|
|
3571
|
+
duration: transitionDuration,
|
|
3534
3572
|
easing: "cubic-bezier(0.4, 0, 0.2, 1)",
|
|
3535
3573
|
pseudoElement: "::view-transition-new(root)"
|
|
3536
3574
|
}
|
|
3537
3575
|
);
|
|
3576
|
+
animation.onfinish = () => setIsTransitioning(false);
|
|
3577
|
+
animation.oncancel = () => setIsTransitioning(false);
|
|
3538
3578
|
} catch {
|
|
3539
3579
|
setTheme(newTheme);
|
|
3580
|
+
onThemeChange?.(newTheme);
|
|
3581
|
+
setIsTransitioning(false);
|
|
3540
3582
|
}
|
|
3541
3583
|
};
|
|
3542
3584
|
const handleDirectToggle = () => {
|
|
@@ -3544,67 +3586,72 @@ function ModeToggleBase({
|
|
|
3544
3586
|
const nextIndex = (currentIndex + 1) % themes.length;
|
|
3545
3587
|
toggleTheme(themes[nextIndex]);
|
|
3546
3588
|
};
|
|
3547
|
-
|
|
3548
|
-
|
|
3549
|
-
|
|
3589
|
+
const handleMouseMove = (e) => {
|
|
3590
|
+
cursorPos.current = { x: e.clientX, y: e.clientY };
|
|
3591
|
+
};
|
|
3592
|
+
const buttonContent = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
3593
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3594
|
+
react.SunIcon,
|
|
3550
3595
|
{
|
|
3551
|
-
|
|
3552
|
-
|
|
3553
|
-
|
|
3554
|
-
|
|
3555
|
-
|
|
3556
|
-
|
|
3557
|
-
|
|
3558
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3559
|
-
react.SunIcon,
|
|
3560
|
-
{
|
|
3561
|
-
className: `h-[1.2rem] w-[1.2rem] transition-all duration-500 ${isDark ? "rotate-90 scale-0 opacity-0" : "rotate-0 scale-100 opacity-100 group-hover:rotate-12"}`
|
|
3562
|
-
}
|
|
3563
|
-
),
|
|
3564
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3565
|
-
react.MoonIcon,
|
|
3566
|
-
{
|
|
3567
|
-
className: `absolute h-[1.2rem] w-[1.2rem] transition-all duration-500 ${isDark ? "rotate-0 scale-100 opacity-100 group-hover:-rotate-12" : "rotate-90 scale-0 opacity-0"}`
|
|
3568
|
-
}
|
|
3569
|
-
)
|
|
3570
|
-
] }),
|
|
3571
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Toggle theme" })
|
|
3572
|
-
]
|
|
3596
|
+
className: `h-[1.2rem] w-[1.2rem] transition-all duration-500 ${isDark ? "rotate-90 scale-0 opacity-0" : "rotate-0 scale-100 opacity-100 group-hover:rotate-12"}`
|
|
3597
|
+
}
|
|
3598
|
+
),
|
|
3599
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3600
|
+
react.MoonIcon,
|
|
3601
|
+
{
|
|
3602
|
+
className: `absolute h-[1.2rem] w-[1.2rem] transition-all duration-500 ${isDark ? "rotate-0 scale-100 opacity-100 group-hover:-rotate-12" : "rotate-90 scale-0 opacity-0"}`
|
|
3573
3603
|
}
|
|
3604
|
+
),
|
|
3605
|
+
showLabel && mounted && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "ml-5 text-sm font-medium", children: themeLabels[activeTheme] }),
|
|
3606
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Toggle theme" })
|
|
3607
|
+
] });
|
|
3608
|
+
const wrapWithTooltip = (node) => {
|
|
3609
|
+
if (!tooltipText) return node;
|
|
3610
|
+
return /* @__PURE__ */ jsxRuntime.jsx(TooltipProviderBase, { children: /* @__PURE__ */ jsxRuntime.jsxs(TooltipBase, { children: [
|
|
3611
|
+
/* @__PURE__ */ jsxRuntime.jsx(TooltipTriggerBase, { asChild: true, children: node }),
|
|
3612
|
+
/* @__PURE__ */ jsxRuntime.jsx(TooltipContentBase, { children: tooltipText })
|
|
3613
|
+
] }) });
|
|
3614
|
+
};
|
|
3615
|
+
if (directToggle) {
|
|
3616
|
+
return wrapWithTooltip(
|
|
3617
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3618
|
+
ButtonBase,
|
|
3619
|
+
{
|
|
3620
|
+
ref: buttonRef,
|
|
3621
|
+
variant,
|
|
3622
|
+
size: showLabel ? "default" : "icon",
|
|
3623
|
+
className: cn("relative overflow-hidden group", className),
|
|
3624
|
+
onClick: handleDirectToggle,
|
|
3625
|
+
onMouseMove: handleMouseMove,
|
|
3626
|
+
onKeyDown: (e) => {
|
|
3627
|
+
if (e.repeat && (e.key === "Enter" || e.key === " ")) {
|
|
3628
|
+
e.preventDefault();
|
|
3629
|
+
}
|
|
3630
|
+
},
|
|
3631
|
+
children: buttonContent
|
|
3632
|
+
}
|
|
3633
|
+
)
|
|
3574
3634
|
);
|
|
3575
3635
|
}
|
|
3576
3636
|
return /* @__PURE__ */ jsxRuntime.jsxs(DropDownMenuBase, { children: [
|
|
3577
|
-
/* @__PURE__ */ jsxRuntime.jsx(DropDownMenuTriggerBase, { asChild: true, children:
|
|
3578
|
-
|
|
3579
|
-
|
|
3580
|
-
|
|
3581
|
-
|
|
3582
|
-
|
|
3583
|
-
|
|
3584
|
-
|
|
3585
|
-
|
|
3586
|
-
|
|
3587
|
-
|
|
3588
|
-
|
|
3589
|
-
className: `h-[1.2rem] w-[1.2rem] transition-all duration-500 ${isDark ? "rotate-90 scale-0 opacity-0" : "rotate-0 scale-100 opacity-100 group-hover:rotate-12"}`
|
|
3590
|
-
}
|
|
3591
|
-
),
|
|
3592
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3593
|
-
react.MoonIcon,
|
|
3594
|
-
{
|
|
3595
|
-
className: `absolute h-[1.2rem] w-[1.2rem] transition-all duration-500 ${isDark ? "rotate-0 scale-100 opacity-100 group-hover:-rotate-12" : "rotate-90 scale-0 opacity-0"}`
|
|
3596
|
-
}
|
|
3597
|
-
)
|
|
3598
|
-
] }),
|
|
3599
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Toggle theme" })
|
|
3600
|
-
]
|
|
3601
|
-
}
|
|
3637
|
+
/* @__PURE__ */ jsxRuntime.jsx(DropDownMenuTriggerBase, { asChild: true, children: wrapWithTooltip(
|
|
3638
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3639
|
+
ButtonBase,
|
|
3640
|
+
{
|
|
3641
|
+
ref: buttonRef,
|
|
3642
|
+
variant,
|
|
3643
|
+
size: showLabel ? "default" : "icon",
|
|
3644
|
+
className: cn("relative overflow-hidden group", className),
|
|
3645
|
+
onMouseMove: handleMouseMove,
|
|
3646
|
+
children: buttonContent
|
|
3647
|
+
}
|
|
3648
|
+
)
|
|
3602
3649
|
) }),
|
|
3603
3650
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3604
3651
|
DropDownMenuContentBase,
|
|
3605
3652
|
{
|
|
3606
3653
|
align: "end",
|
|
3607
|
-
className: "border-border bg-popover text-popover-foreground min-w-[140px]
|
|
3654
|
+
className: "border-border bg-popover text-popover-foreground min-w-[140px]",
|
|
3608
3655
|
children: themes.map((theme) => {
|
|
3609
3656
|
const isActive = currentTheme === theme;
|
|
3610
3657
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
@@ -9669,7 +9716,8 @@ function DayViewAgenda({
|
|
|
9669
9716
|
events,
|
|
9670
9717
|
onEventSelect,
|
|
9671
9718
|
showUndatedEvents,
|
|
9672
|
-
noTime = false
|
|
9719
|
+
noTime = false,
|
|
9720
|
+
onEventCreate
|
|
9673
9721
|
}) {
|
|
9674
9722
|
const hours = React32.useMemo(() => {
|
|
9675
9723
|
const dayStart = dateFns.startOfDay(currentDate);
|
|
@@ -9919,6 +9967,7 @@ function DayViewAgenda({
|
|
|
9919
9967
|
const startTime = new Date(currentDate);
|
|
9920
9968
|
startTime.setHours(hourValue);
|
|
9921
9969
|
startTime.setMinutes(quarter * 15);
|
|
9970
|
+
if (onEventCreate) onEventCreate(startTime);
|
|
9922
9971
|
},
|
|
9923
9972
|
time: quarterHourTime
|
|
9924
9973
|
},
|
|
@@ -10181,7 +10230,8 @@ function EventAgenda({
|
|
|
10181
10230
|
onlyMonth,
|
|
10182
10231
|
onlyWeek,
|
|
10183
10232
|
onlyAgenda,
|
|
10184
|
-
onlyYear
|
|
10233
|
+
onlyYear,
|
|
10234
|
+
allowCellClick = false
|
|
10185
10235
|
}) {
|
|
10186
10236
|
const lockedView = onlyDay ? "day" : onlyMonth ? "month" : onlyWeek ? "week" : onlyAgenda ? "agenda" : onlyYear ? "year" : void 0;
|
|
10187
10237
|
const [currentDate, setCurrentDate] = React32.useState(
|
|
@@ -10344,7 +10394,13 @@ function EventAgenda({
|
|
|
10344
10394
|
currentDate,
|
|
10345
10395
|
events,
|
|
10346
10396
|
onEventSelect: handleEventSelect,
|
|
10347
|
-
noTime
|
|
10397
|
+
noTime,
|
|
10398
|
+
onEventCreate: allowCellClick ? (d) => onEventUpdate?.({
|
|
10399
|
+
start: d,
|
|
10400
|
+
end: d,
|
|
10401
|
+
title: "Novo Evento",
|
|
10402
|
+
id: crypto.randomUUID()
|
|
10403
|
+
}) : void 0
|
|
10348
10404
|
}
|
|
10349
10405
|
),
|
|
10350
10406
|
activeView === "week" && /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -10353,7 +10409,13 @@ function EventAgenda({
|
|
|
10353
10409
|
currentDate,
|
|
10354
10410
|
events,
|
|
10355
10411
|
onEventSelect: handleEventSelect,
|
|
10356
|
-
noTime
|
|
10412
|
+
noTime,
|
|
10413
|
+
onEventCreate: allowCellClick ? (d) => onEventUpdate?.({
|
|
10414
|
+
start: d,
|
|
10415
|
+
end: d,
|
|
10416
|
+
title: "Novo Evento",
|
|
10417
|
+
id: crypto.randomUUID()
|
|
10418
|
+
}) : void 0
|
|
10357
10419
|
}
|
|
10358
10420
|
),
|
|
10359
10421
|
activeView === "day" && /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -10362,7 +10424,13 @@ function EventAgenda({
|
|
|
10362
10424
|
currentDate,
|
|
10363
10425
|
events,
|
|
10364
10426
|
onEventSelect: handleEventSelect,
|
|
10365
|
-
noTime
|
|
10427
|
+
noTime,
|
|
10428
|
+
onEventCreate: allowCellClick ? (d) => onEventUpdate?.({
|
|
10429
|
+
start: d,
|
|
10430
|
+
end: d,
|
|
10431
|
+
title: "Novo Evento",
|
|
10432
|
+
id: crypto.randomUUID()
|
|
10433
|
+
}) : void 0
|
|
10366
10434
|
}
|
|
10367
10435
|
),
|
|
10368
10436
|
activeView === "agenda" && /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -10371,7 +10439,13 @@ function EventAgenda({
|
|
|
10371
10439
|
currentDate,
|
|
10372
10440
|
events,
|
|
10373
10441
|
onEventSelect: handleEventSelect,
|
|
10374
|
-
noTime
|
|
10442
|
+
noTime,
|
|
10443
|
+
onEventCreate: allowCellClick ? (d) => onEventUpdate?.({
|
|
10444
|
+
start: d,
|
|
10445
|
+
end: d,
|
|
10446
|
+
title: "Novo Evento",
|
|
10447
|
+
id: crypto.randomUUID()
|
|
10448
|
+
}) : void 0
|
|
10375
10449
|
}
|
|
10376
10450
|
),
|
|
10377
10451
|
activeView === "year" && /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -10634,7 +10708,8 @@ function MonthViewAgenda({
|
|
|
10634
10708
|
events,
|
|
10635
10709
|
onEventSelect,
|
|
10636
10710
|
showUndatedEvents,
|
|
10637
|
-
noTime = false
|
|
10711
|
+
noTime = false,
|
|
10712
|
+
onEventCreate
|
|
10638
10713
|
}) {
|
|
10639
10714
|
const days = React32.useMemo(() => {
|
|
10640
10715
|
const monthStart = dateFns.startOfMonth(currentDate);
|
|
@@ -10777,6 +10852,7 @@ function MonthViewAgenda({
|
|
|
10777
10852
|
onClick: () => {
|
|
10778
10853
|
const t = new Date(day);
|
|
10779
10854
|
t.setHours(DefaultStartHourAgenda, 0, 0);
|
|
10855
|
+
if (onEventCreate) onEventCreate(t);
|
|
10780
10856
|
},
|
|
10781
10857
|
children: [
|
|
10782
10858
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -16115,7 +16191,8 @@ var DraggableTooltipComponent = ({
|
|
|
16115
16191
|
highlightedSeries,
|
|
16116
16192
|
toggleHighlight,
|
|
16117
16193
|
finalColors,
|
|
16118
|
-
valueFormatter
|
|
16194
|
+
valueFormatter,
|
|
16195
|
+
seriesTypeMap
|
|
16119
16196
|
]
|
|
16120
16197
|
),
|
|
16121
16198
|
/* @__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: [
|
|
@@ -16409,74 +16486,106 @@ var SystemTooltip = ({
|
|
|
16409
16486
|
const [localPos, setLocalPos] = React32.useState(position);
|
|
16410
16487
|
const [dragging, setDragging] = React32.useState(false);
|
|
16411
16488
|
const offsetRef = React32.useRef({ x: 0, y: 0 });
|
|
16412
|
-
const
|
|
16413
|
-
React32.
|
|
16489
|
+
const lastPos = React32.useRef({ x: 0, y: 0 });
|
|
16490
|
+
const tooltipRef = React32.useRef(null);
|
|
16491
|
+
const currentPosRef = React32.useRef(position);
|
|
16492
|
+
React32.useEffect(() => {
|
|
16493
|
+
currentPosRef.current = position;
|
|
16494
|
+
setLocalPos(position);
|
|
16495
|
+
}, [position]);
|
|
16414
16496
|
React32.useEffect(() => {
|
|
16415
16497
|
let rafId = null;
|
|
16416
|
-
const
|
|
16417
|
-
|
|
16418
|
-
lastMouse.current = { x: e.clientX, y: e.clientY };
|
|
16498
|
+
const applyMove = (clientX, clientY) => {
|
|
16499
|
+
lastPos.current = { x: clientX, y: clientY };
|
|
16419
16500
|
if (rafId) cancelAnimationFrame(rafId);
|
|
16420
16501
|
rafId = requestAnimationFrame(() => {
|
|
16421
|
-
const
|
|
16422
|
-
|
|
16423
|
-
|
|
16424
|
-
|
|
16425
|
-
|
|
16502
|
+
const p = {
|
|
16503
|
+
top: Math.max(
|
|
16504
|
+
0,
|
|
16505
|
+
Math.min(
|
|
16506
|
+
lastPos.current.y - offsetRef.current.y,
|
|
16507
|
+
window.innerHeight - 200
|
|
16508
|
+
)
|
|
16509
|
+
),
|
|
16510
|
+
left: Math.max(
|
|
16511
|
+
0,
|
|
16512
|
+
Math.min(
|
|
16513
|
+
lastPos.current.x - offsetRef.current.x,
|
|
16514
|
+
window.innerWidth - 320
|
|
16515
|
+
)
|
|
16516
|
+
)
|
|
16426
16517
|
};
|
|
16427
|
-
|
|
16428
|
-
if (
|
|
16518
|
+
currentPosRef.current = p;
|
|
16519
|
+
if (tooltipRef.current) {
|
|
16520
|
+
tooltipRef.current.style.top = `${p.top}px`;
|
|
16521
|
+
tooltipRef.current.style.left = `${p.left}px`;
|
|
16522
|
+
}
|
|
16523
|
+
onPositionChange?.(id, p);
|
|
16429
16524
|
});
|
|
16430
16525
|
};
|
|
16431
|
-
const
|
|
16432
|
-
if (dragging)
|
|
16433
|
-
|
|
16434
|
-
|
|
16435
|
-
|
|
16526
|
+
const stopDrag = () => {
|
|
16527
|
+
if (!dragging) return;
|
|
16528
|
+
setDragging(false);
|
|
16529
|
+
setLocalPos(currentPosRef.current);
|
|
16530
|
+
if (rafId) cancelAnimationFrame(rafId);
|
|
16531
|
+
};
|
|
16532
|
+
const handleMouseMove = (e) => {
|
|
16533
|
+
if (dragging) applyMove(e.clientX, e.clientY);
|
|
16534
|
+
};
|
|
16535
|
+
const handleTouchMove = (e) => {
|
|
16536
|
+
if (!dragging || !e.touches[0]) return;
|
|
16537
|
+
applyMove(e.touches[0].clientX, e.touches[0].clientY);
|
|
16436
16538
|
};
|
|
16437
16539
|
if (dragging) {
|
|
16438
16540
|
document.addEventListener("mousemove", handleMouseMove, {
|
|
16439
16541
|
passive: true
|
|
16440
16542
|
});
|
|
16441
|
-
document.addEventListener("mouseup",
|
|
16543
|
+
document.addEventListener("mouseup", stopDrag);
|
|
16544
|
+
document.addEventListener("touchmove", handleTouchMove, {
|
|
16545
|
+
passive: true
|
|
16546
|
+
});
|
|
16547
|
+
document.addEventListener("touchend", stopDrag);
|
|
16548
|
+
document.addEventListener("touchcancel", stopDrag);
|
|
16442
16549
|
document.body.style.cursor = "grabbing";
|
|
16443
16550
|
document.body.style.userSelect = "none";
|
|
16444
16551
|
}
|
|
16445
16552
|
return () => {
|
|
16446
16553
|
if (rafId) cancelAnimationFrame(rafId);
|
|
16447
16554
|
document.removeEventListener("mousemove", handleMouseMove);
|
|
16448
|
-
document.removeEventListener("mouseup",
|
|
16555
|
+
document.removeEventListener("mouseup", stopDrag);
|
|
16556
|
+
document.removeEventListener("touchmove", handleTouchMove);
|
|
16557
|
+
document.removeEventListener("touchend", stopDrag);
|
|
16558
|
+
document.removeEventListener("touchcancel", stopDrag);
|
|
16449
16559
|
document.body.style.cursor = "";
|
|
16450
16560
|
document.body.style.userSelect = "";
|
|
16451
16561
|
};
|
|
16452
16562
|
}, [dragging, id, onPositionChange]);
|
|
16453
|
-
const
|
|
16454
|
-
(e) => {
|
|
16455
|
-
|
|
16456
|
-
e.stopPropagation();
|
|
16457
|
-
const rect = e.currentTarget.closest(".fixed")?.getBoundingClientRect();
|
|
16563
|
+
const startDrag = React32.useCallback(
|
|
16564
|
+
(clientX, clientY, e) => {
|
|
16565
|
+
const rect = tooltipRef.current?.getBoundingClientRect();
|
|
16458
16566
|
if (!rect) return;
|
|
16459
|
-
offsetRef.current = { x:
|
|
16567
|
+
offsetRef.current = { x: clientX - rect.left, y: clientY - rect.top };
|
|
16460
16568
|
setDragging(true);
|
|
16461
16569
|
onMouseDown?.(id, e);
|
|
16462
16570
|
},
|
|
16463
16571
|
[id, onMouseDown]
|
|
16464
16572
|
);
|
|
16573
|
+
const handleMouseDownLocal = React32.useCallback(
|
|
16574
|
+
(e) => {
|
|
16575
|
+
e.preventDefault();
|
|
16576
|
+
e.stopPropagation();
|
|
16577
|
+
startDrag(e.clientX, e.clientY, e);
|
|
16578
|
+
},
|
|
16579
|
+
[startDrag]
|
|
16580
|
+
);
|
|
16465
16581
|
const handleTouchStartLocal = React32.useCallback(
|
|
16466
16582
|
(e) => {
|
|
16467
16583
|
e.stopPropagation();
|
|
16468
16584
|
const touch = e.touches[0];
|
|
16469
16585
|
if (!touch) return;
|
|
16470
|
-
|
|
16471
|
-
if (!rect) return;
|
|
16472
|
-
offsetRef.current = {
|
|
16473
|
-
x: touch.clientX - rect.left,
|
|
16474
|
-
y: touch.clientY - rect.top
|
|
16475
|
-
};
|
|
16476
|
-
setDragging(true);
|
|
16477
|
-
onMouseDown?.(id, e);
|
|
16586
|
+
startDrag(touch.clientX, touch.clientY, e);
|
|
16478
16587
|
},
|
|
16479
|
-
[
|
|
16588
|
+
[startDrag]
|
|
16480
16589
|
);
|
|
16481
16590
|
const handleConnClick = React32.useCallback(
|
|
16482
16591
|
(e, conn) => {
|
|
@@ -16524,15 +16633,13 @@ var SystemTooltip = ({
|
|
|
16524
16633
|
return /* @__PURE__ */ jsxRuntime.jsx(framerMotion.AnimatePresence, { children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
16525
16634
|
framerMotion.motion.div,
|
|
16526
16635
|
{
|
|
16636
|
+
ref: tooltipRef,
|
|
16527
16637
|
className: "fixed bg-card/95 backdrop-blur-md border border-border/50 rounded-xl shadow-2xl z-[10000] w-80 overflow-hidden",
|
|
16528
16638
|
variants: tooltipVariants2,
|
|
16529
16639
|
initial: "hidden",
|
|
16530
16640
|
animate: "visible",
|
|
16531
16641
|
exit: "exit",
|
|
16532
|
-
style: {
|
|
16533
|
-
top: localPos.top,
|
|
16534
|
-
left: localPos.left
|
|
16535
|
-
},
|
|
16642
|
+
style: { top: localPos.top, left: localPos.left },
|
|
16536
16643
|
onClick: (e) => e.stopPropagation(),
|
|
16537
16644
|
children: [
|
|
16538
16645
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
@@ -16547,7 +16654,7 @@ var SystemTooltip = ({
|
|
|
16547
16654
|
},
|
|
16548
16655
|
children: [
|
|
16549
16656
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2 px-3", children: [
|
|
16550
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
16657
|
+
/* @__PURE__ */ jsxRuntime.jsx(react.DotsSixVerticalIcon, { size: 16, className: "text-primary" }),
|
|
16551
16658
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-xs font-semibold text-muted-foreground uppercase tracking-wider", children: title })
|
|
16552
16659
|
] }),
|
|
16553
16660
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -16573,22 +16680,19 @@ var SystemTooltip = ({
|
|
|
16573
16680
|
] }) }),
|
|
16574
16681
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "px-3 pb-4 space-y-4 max-h-[300px] overflow-y-auto [&::-webkit-scrollbar]:w-1 [&::-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: [
|
|
16575
16682
|
/* @__PURE__ */ jsxRuntime.jsx(SeparatorBase, { className: "w-full" }),
|
|
16576
|
-
isLoading ? /* @__PURE__ */ jsxRuntime.
|
|
16577
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "
|
|
16578
|
-
/* @__PURE__ */ jsxRuntime.
|
|
16579
|
-
|
|
16580
|
-
/* @__PURE__ */ jsxRuntime.jsx(SkeletonBase, { className: "h-3 w-16" })
|
|
16581
|
-
] }),
|
|
16582
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "space-y-1", children: [1, 2, 3].map((i) => /* @__PURE__ */ jsxRuntime.jsx(SkeletonBase, { className: "h-10 w-full rounded-lg" }, i)) })
|
|
16683
|
+
isLoading ? /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: [1, 2].map((g) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-2", children: [
|
|
16684
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2 px-1", children: [
|
|
16685
|
+
/* @__PURE__ */ jsxRuntime.jsx(SkeletonBase, { className: "w-1.5 h-1.5 rounded-full" }),
|
|
16686
|
+
/* @__PURE__ */ jsxRuntime.jsx(SkeletonBase, { className: "h-3 w-16" })
|
|
16583
16687
|
] }),
|
|
16584
|
-
/* @__PURE__ */ jsxRuntime.
|
|
16585
|
-
|
|
16586
|
-
|
|
16587
|
-
|
|
16588
|
-
|
|
16589
|
-
|
|
16590
|
-
|
|
16591
|
-
] }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
16688
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "space-y-1", children: [1, 2, 3].map((i) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
16689
|
+
SkeletonBase,
|
|
16690
|
+
{
|
|
16691
|
+
className: "h-10 w-full rounded-lg"
|
|
16692
|
+
},
|
|
16693
|
+
i
|
|
16694
|
+
)) })
|
|
16695
|
+
] }, g)) }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
16592
16696
|
entries.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-2", children: [
|
|
16593
16697
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2 px-1", children: [
|
|
16594
16698
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-1.5 h-1.5 rounded-full bg-emerald-500" }),
|
|
@@ -16603,7 +16707,7 @@ var SystemTooltip = ({
|
|
|
16603
16707
|
] }),
|
|
16604
16708
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "space-y-1", children: renderConnections(exits, "blue") })
|
|
16605
16709
|
] }),
|
|
16606
|
-
data.connections.length === 0 &&
|
|
16710
|
+
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" }) })
|
|
16607
16711
|
] })
|
|
16608
16712
|
] })
|
|
16609
16713
|
]
|
|
@@ -21850,6 +21954,22 @@ function GroupLabel({ group }) {
|
|
|
21850
21954
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[11px] font-semibold text-muted-foreground uppercase tracking-widest", children: group.label })
|
|
21851
21955
|
] });
|
|
21852
21956
|
}
|
|
21957
|
+
function HighlightText({ text, query }) {
|
|
21958
|
+
if (!query || !query.trim()) return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: text });
|
|
21959
|
+
const terms = query.split(/[, ]+/).map((t) => t.trim()).filter((t) => t.length > 0);
|
|
21960
|
+
if (terms.length === 0) return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: text });
|
|
21961
|
+
const escapedTerms = terms.map(
|
|
21962
|
+
(t) => t.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")
|
|
21963
|
+
);
|
|
21964
|
+
const regex = new RegExp(`(${escapedTerms.join("|")})`, "gi");
|
|
21965
|
+
const parts = text.split(regex);
|
|
21966
|
+
return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: parts.map((part, i) => {
|
|
21967
|
+
const isMatch = terms.some(
|
|
21968
|
+
(t) => t.toLowerCase() === part.toLowerCase()
|
|
21969
|
+
);
|
|
21970
|
+
return isMatch ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-primary font-semibold", children: part }, i) : /* @__PURE__ */ jsxRuntime.jsx("span", { children: part }, i);
|
|
21971
|
+
}) });
|
|
21972
|
+
}
|
|
21853
21973
|
function mapBadgeVariantToColor(variant) {
|
|
21854
21974
|
if (!variant) return void 0;
|
|
21855
21975
|
switch (variant) {
|
|
@@ -21876,8 +21996,10 @@ function mapBadgeVariantToColor(variant) {
|
|
|
21876
21996
|
function CommandItemRow({
|
|
21877
21997
|
item,
|
|
21878
21998
|
isActive,
|
|
21999
|
+
isSelected,
|
|
21879
22000
|
onSelect,
|
|
21880
|
-
onHover
|
|
22001
|
+
onHover,
|
|
22002
|
+
searchQuery
|
|
21881
22003
|
}) {
|
|
21882
22004
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
21883
22005
|
framerMotion.motion.button,
|
|
@@ -21895,7 +22017,7 @@ function CommandItemRow({
|
|
|
21895
22017
|
"span",
|
|
21896
22018
|
{
|
|
21897
22019
|
className: `relative flex-shrink-0 w-8 h-8 flex items-center justify-center rounded-md text-base
|
|
21898
|
-
${isActive ? "bg-primary/20 text-primary" : "bg-muted text-muted-foreground group-hover:text-foreground"}`,
|
|
22020
|
+
${isSelected ? "bg-primary text-primary-foreground" : isActive ? "bg-primary/20 text-primary" : "bg-muted text-muted-foreground group-hover:text-foreground"}`,
|
|
21899
22021
|
children: item.icon
|
|
21900
22022
|
}
|
|
21901
22023
|
),
|
|
@@ -21905,15 +22027,22 @@ function CommandItemRow({
|
|
|
21905
22027
|
"span",
|
|
21906
22028
|
{
|
|
21907
22029
|
className: `text-sm font-medium truncate ${isActive ? "text-foreground" : "text-foreground/80"}`,
|
|
21908
|
-
children: item.label
|
|
22030
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(HighlightText, { text: item.label, query: searchQuery })
|
|
21909
22031
|
}
|
|
21910
22032
|
),
|
|
21911
22033
|
item.badge && /* @__PURE__ */ jsxRuntime.jsx(Badge, { color: mapBadgeVariantToColor(item.badgeVariant), children: item.badge.toUpperCase() })
|
|
21912
22034
|
] }),
|
|
21913
|
-
item.description && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-muted-foreground truncate", children: item.description })
|
|
22035
|
+
item.description && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-muted-foreground truncate", children: /* @__PURE__ */ jsxRuntime.jsx(HighlightText, { text: item.description, query: searchQuery }) })
|
|
21914
22036
|
] }),
|
|
21915
22037
|
item.shortcut && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "relative hidden sm:flex items-center gap-1 flex-shrink-0", children: item.shortcut.map((k, i) => /* @__PURE__ */ jsxRuntime.jsx(Kbd, { children: k }, i)) }),
|
|
21916
|
-
|
|
22038
|
+
isSelected && /* @__PURE__ */ jsxRuntime.jsx(
|
|
22039
|
+
framerMotion.motion.div,
|
|
22040
|
+
{
|
|
22041
|
+
layoutId: `selected-indicator-${item.id}`,
|
|
22042
|
+
className: "absolute left-0 top-1/2 -translate-y-1/2 w-1 h-2/3 bg-primary rounded-r-md"
|
|
22043
|
+
}
|
|
22044
|
+
),
|
|
22045
|
+
isActive && !isSelected && /* @__PURE__ */ jsxRuntime.jsx(
|
|
21917
22046
|
react.CaretRightIcon,
|
|
21918
22047
|
{
|
|
21919
22048
|
className: "relative w-4 h-4 text-primary flex-shrink-0",
|
|
@@ -21933,22 +22062,40 @@ function useCommandPalette({
|
|
|
21933
22062
|
recentItems = [],
|
|
21934
22063
|
onRecentItemsChange,
|
|
21935
22064
|
maxRecentItems = 5,
|
|
21936
|
-
multiSearch = false
|
|
22065
|
+
multiSearch = false,
|
|
22066
|
+
multiSelect = false,
|
|
22067
|
+
onSelectMultiple
|
|
21937
22068
|
}) {
|
|
21938
22069
|
const [query, setQuery] = React32__namespace.useState("");
|
|
21939
22070
|
const [activeIndex, setActiveIndex] = React32__namespace.useState(0);
|
|
21940
22071
|
const [page, setPage] = React32__namespace.useState(0);
|
|
22072
|
+
const [selectedItemIds, setSelectedItemIds] = React32__namespace.useState(
|
|
22073
|
+
/* @__PURE__ */ new Set()
|
|
22074
|
+
);
|
|
22075
|
+
const toggleSelection = React32__namespace.useCallback((id) => {
|
|
22076
|
+
setSelectedItemIds((prev) => {
|
|
22077
|
+
const next = new Set(prev);
|
|
22078
|
+
if (next.has(id)) next.delete(id);
|
|
22079
|
+
else next.add(id);
|
|
22080
|
+
return next;
|
|
22081
|
+
});
|
|
22082
|
+
}, []);
|
|
22083
|
+
const clearSelection = React32__namespace.useCallback(
|
|
22084
|
+
() => setSelectedItemIds(/* @__PURE__ */ new Set()),
|
|
22085
|
+
[]
|
|
22086
|
+
);
|
|
21941
22087
|
const baseGroups = React32__namespace.useMemo(
|
|
21942
22088
|
() => normaliseGroups(items, groups),
|
|
21943
22089
|
[items, groups]
|
|
21944
22090
|
);
|
|
21945
|
-
|
|
22091
|
+
React32.useEffect(() => {
|
|
21946
22092
|
if (open) {
|
|
21947
22093
|
setQuery("");
|
|
21948
22094
|
setActiveIndex(0);
|
|
21949
22095
|
setPage(0);
|
|
22096
|
+
clearSelection();
|
|
21950
22097
|
}
|
|
21951
|
-
}, [open]);
|
|
22098
|
+
}, [open, clearSelection]);
|
|
21952
22099
|
const searchTerms = React32__namespace.useMemo(() => {
|
|
21953
22100
|
const parts = query.split(",");
|
|
21954
22101
|
if (parts.length <= 1 && !multiSearch) return [];
|
|
@@ -22011,12 +22158,35 @@ function useCommandPalette({
|
|
|
22011
22158
|
() => displayedGroups.flatMap((g) => g.items),
|
|
22012
22159
|
[displayedGroups]
|
|
22013
22160
|
);
|
|
22161
|
+
const selectedItems = React32.useMemo(
|
|
22162
|
+
() => allFlatItems.filter((i) => selectedItemIds.has(i.id)),
|
|
22163
|
+
[allFlatItems, selectedItemIds]
|
|
22164
|
+
);
|
|
22014
22165
|
const pageItemCount = flatItems.length;
|
|
22015
22166
|
React32.useEffect(() => {
|
|
22016
22167
|
setActiveIndex((i) => Math.min(i, Math.max(pageItemCount - 1, 0)));
|
|
22017
22168
|
}, [pageItemCount]);
|
|
22018
|
-
function
|
|
22169
|
+
function executeBulkAction() {
|
|
22170
|
+
if (!onSelectMultiple || selectedItems.length === 0) return;
|
|
22171
|
+
onSelectMultiple(selectedItems);
|
|
22172
|
+
onOpenChange?.(false);
|
|
22173
|
+
}
|
|
22174
|
+
function handleSelect(item, event) {
|
|
22019
22175
|
if (!item) return;
|
|
22176
|
+
if (multiSelect) {
|
|
22177
|
+
if (event && ("ctrlKey" in event || "metaKey" in event || "shiftKey" in event) && (event.ctrlKey || event.metaKey || event.shiftKey)) {
|
|
22178
|
+
toggleSelection(item.id);
|
|
22179
|
+
return;
|
|
22180
|
+
}
|
|
22181
|
+
if (selectedItems.length > 0) {
|
|
22182
|
+
const itemsToSubmit = selectedItemIds.has(item.id) ? selectedItems : [...selectedItems, item];
|
|
22183
|
+
if (onSelectMultiple) {
|
|
22184
|
+
onSelectMultiple(itemsToSubmit);
|
|
22185
|
+
}
|
|
22186
|
+
onOpenChange?.(false);
|
|
22187
|
+
return;
|
|
22188
|
+
}
|
|
22189
|
+
}
|
|
22020
22190
|
item.onSelect();
|
|
22021
22191
|
onOpenChange?.(false);
|
|
22022
22192
|
if (onRecentItemsChange) {
|
|
@@ -22049,12 +22219,26 @@ function useCommandPalette({
|
|
|
22049
22219
|
}
|
|
22050
22220
|
} else if (e.key === "Enter") {
|
|
22051
22221
|
e.preventDefault();
|
|
22052
|
-
|
|
22222
|
+
if (multiSelect && (e.ctrlKey || e.metaKey)) {
|
|
22223
|
+
executeBulkAction();
|
|
22224
|
+
return;
|
|
22225
|
+
}
|
|
22226
|
+
handleSelect(flatItems[activeIndex], e);
|
|
22053
22227
|
}
|
|
22054
22228
|
};
|
|
22055
22229
|
document.addEventListener("keydown", handler);
|
|
22056
22230
|
return () => document.removeEventListener("keydown", handler);
|
|
22057
|
-
}, [
|
|
22231
|
+
}, [
|
|
22232
|
+
open,
|
|
22233
|
+
flatItems,
|
|
22234
|
+
activeIndex,
|
|
22235
|
+
pageItemCount,
|
|
22236
|
+
page,
|
|
22237
|
+
totalPages,
|
|
22238
|
+
executeBulkAction,
|
|
22239
|
+
handleSelect,
|
|
22240
|
+
multiSelect
|
|
22241
|
+
]);
|
|
22058
22242
|
return {
|
|
22059
22243
|
query,
|
|
22060
22244
|
setQuery,
|
|
@@ -22070,6 +22254,10 @@ function useCommandPalette({
|
|
|
22070
22254
|
totalItems,
|
|
22071
22255
|
totalPages,
|
|
22072
22256
|
handleSelect,
|
|
22257
|
+
selectedItemIds,
|
|
22258
|
+
toggleSelection,
|
|
22259
|
+
selectedItems,
|
|
22260
|
+
executeBulkAction,
|
|
22073
22261
|
isEmpty: totalItems === 0 && query.trim().length > 0,
|
|
22074
22262
|
showList: query.trim() !== "" || recentItems.length > 0
|
|
22075
22263
|
};
|
|
@@ -22129,8 +22317,12 @@ var VirtualResultList = React32.memo(
|
|
|
22129
22317
|
displayedGroups,
|
|
22130
22318
|
flatItems,
|
|
22131
22319
|
activeIndex,
|
|
22320
|
+
multiSelect,
|
|
22321
|
+
selectedItemIds,
|
|
22132
22322
|
onHover,
|
|
22133
|
-
onSelect
|
|
22323
|
+
onSelect,
|
|
22324
|
+
onToggleSelection,
|
|
22325
|
+
searchQuery
|
|
22134
22326
|
}) => {
|
|
22135
22327
|
const rows = React32.useMemo(() => {
|
|
22136
22328
|
const acc = [];
|
|
@@ -22186,8 +22378,12 @@ var VirtualResultList = React32.memo(
|
|
|
22186
22378
|
{
|
|
22187
22379
|
item: row.item,
|
|
22188
22380
|
isActive: row.globalIdx === activeIndex,
|
|
22381
|
+
isSelected: selectedItemIds.has(row.item.id),
|
|
22382
|
+
multiSelect,
|
|
22189
22383
|
onHover: () => onHover(row.globalIdx),
|
|
22190
|
-
onSelect: () => onSelect(row.item)
|
|
22384
|
+
onSelect: (e) => onSelect(row.item, e),
|
|
22385
|
+
onToggleSelection: (e) => onToggleSelection(row.item.id, e),
|
|
22386
|
+
searchQuery
|
|
22191
22387
|
}
|
|
22192
22388
|
) })
|
|
22193
22389
|
},
|
|
@@ -22199,30 +22395,55 @@ var VirtualResultList = React32.memo(
|
|
|
22199
22395
|
}
|
|
22200
22396
|
);
|
|
22201
22397
|
VirtualResultList.displayName = "VirtualResultList";
|
|
22202
|
-
var FooterBar = React32.memo(
|
|
22203
|
-
|
|
22204
|
-
|
|
22205
|
-
|
|
22206
|
-
|
|
22207
|
-
|
|
22208
|
-
|
|
22209
|
-
|
|
22210
|
-
|
|
22211
|
-
|
|
22212
|
-
|
|
22213
|
-
|
|
22214
|
-
|
|
22215
|
-
|
|
22216
|
-
|
|
22217
|
-
|
|
22218
|
-
|
|
22219
|
-
|
|
22220
|
-
|
|
22221
|
-
|
|
22222
|
-
|
|
22398
|
+
var FooterBar = React32.memo(
|
|
22399
|
+
({
|
|
22400
|
+
footer,
|
|
22401
|
+
totalItems,
|
|
22402
|
+
selectedCount = 0,
|
|
22403
|
+
executeBulkAction
|
|
22404
|
+
}) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between px-4 py-2 border-t border-border bg-muted/30", children: [
|
|
22405
|
+
footer ?? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center gap-4 text-[11px] text-muted-foreground", children: selectedCount > 0 ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
22406
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
22407
|
+
"button",
|
|
22408
|
+
{
|
|
22409
|
+
onClick: executeBulkAction,
|
|
22410
|
+
className: "flex items-center gap-1.5 text-primary hover:text-primary/80 transition-colors font-medium cursor-pointer",
|
|
22411
|
+
children: [
|
|
22412
|
+
/* @__PURE__ */ jsxRuntime.jsx(react.CommandIcon, { className: "w-3 h-3" }),
|
|
22413
|
+
" Confirmar (",
|
|
22414
|
+
selectedCount,
|
|
22415
|
+
")"
|
|
22416
|
+
]
|
|
22417
|
+
}
|
|
22418
|
+
),
|
|
22419
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "flex items-center gap-1.5", children: [
|
|
22420
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-mono", children: "Ctrl+Enter" }),
|
|
22421
|
+
"Finalizar sele\xE7\xE3o"
|
|
22422
|
+
] })
|
|
22423
|
+
] }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
22424
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "flex items-center gap-1.5", children: [
|
|
22425
|
+
/* @__PURE__ */ jsxRuntime.jsx(react.ArrowElbowDownRightIcon, { className: "w-3 h-3" }),
|
|
22426
|
+
"Selecionar"
|
|
22427
|
+
] }),
|
|
22428
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "flex items-center gap-1.5", children: [
|
|
22429
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-mono", children: "\u2191\u2193" }),
|
|
22430
|
+
"Navegar"
|
|
22431
|
+
] }),
|
|
22432
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "flex items-center gap-1.5", children: [
|
|
22433
|
+
/* @__PURE__ */ jsxRuntime.jsx(react.ArrowBendUpLeftIcon, { className: "w-3 h-3" }),
|
|
22434
|
+
"Fechar"
|
|
22435
|
+
] })
|
|
22436
|
+
] }) }),
|
|
22437
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-1.5 text-[11px] text-muted-foreground", children: [
|
|
22438
|
+
/* @__PURE__ */ jsxRuntime.jsx(react.CommandIcon, { className: "w-3 h-3" }),
|
|
22439
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { children: [
|
|
22440
|
+
totalItems,
|
|
22441
|
+
" resultado",
|
|
22442
|
+
totalItems !== 1 ? "s" : ""
|
|
22443
|
+
] })
|
|
22223
22444
|
] })
|
|
22224
22445
|
] })
|
|
22225
|
-
|
|
22446
|
+
);
|
|
22226
22447
|
FooterBar.displayName = "FooterBar";
|
|
22227
22448
|
function CommandPalette(props) {
|
|
22228
22449
|
const {
|
|
@@ -22232,6 +22453,7 @@ function CommandPalette(props) {
|
|
|
22232
22453
|
footer,
|
|
22233
22454
|
debounceDelay = 300,
|
|
22234
22455
|
multiSearch = false,
|
|
22456
|
+
multiSelect = false,
|
|
22235
22457
|
emptyMessage = "Nenhum resultado encontrado.",
|
|
22236
22458
|
shortcut = { key: "k", ctrl: true }
|
|
22237
22459
|
} = props;
|
|
@@ -22248,6 +22470,9 @@ function CommandPalette(props) {
|
|
|
22248
22470
|
flatItems,
|
|
22249
22471
|
totalItems,
|
|
22250
22472
|
handleSelect,
|
|
22473
|
+
selectedItemIds,
|
|
22474
|
+
toggleSelection,
|
|
22475
|
+
executeBulkAction,
|
|
22251
22476
|
isEmpty,
|
|
22252
22477
|
showList
|
|
22253
22478
|
} = useCommandPalette({
|
|
@@ -22304,8 +22529,12 @@ function CommandPalette(props) {
|
|
|
22304
22529
|
displayedGroups,
|
|
22305
22530
|
flatItems,
|
|
22306
22531
|
activeIndex,
|
|
22532
|
+
multiSelect,
|
|
22533
|
+
selectedItemIds,
|
|
22307
22534
|
onHover: setActiveIndex,
|
|
22308
|
-
onSelect: handleSelect
|
|
22535
|
+
onSelect: handleSelect,
|
|
22536
|
+
onToggleSelection: toggleSelection,
|
|
22537
|
+
searchQuery: query
|
|
22309
22538
|
};
|
|
22310
22539
|
if (isMobile) {
|
|
22311
22540
|
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
@@ -22348,65 +22577,60 @@ function CommandPalette(props) {
|
|
|
22348
22577
|
] }) })
|
|
22349
22578
|
] });
|
|
22350
22579
|
}
|
|
22351
|
-
return /* @__PURE__ */ jsxRuntime.jsx(framerMotion.AnimatePresence, { children: open && /* @__PURE__ */ jsxRuntime.
|
|
22352
|
-
|
|
22353
|
-
|
|
22354
|
-
{
|
|
22355
|
-
|
|
22356
|
-
|
|
22357
|
-
|
|
22358
|
-
|
|
22359
|
-
|
|
22360
|
-
|
|
22361
|
-
|
|
22362
|
-
|
|
22363
|
-
|
|
22364
|
-
|
|
22365
|
-
|
|
22366
|
-
|
|
22367
|
-
|
|
22368
|
-
|
|
22369
|
-
|
|
22370
|
-
|
|
22371
|
-
|
|
22372
|
-
|
|
22373
|
-
|
|
22374
|
-
|
|
22375
|
-
|
|
22376
|
-
|
|
22377
|
-
|
|
22378
|
-
|
|
22379
|
-
|
|
22380
|
-
|
|
22381
|
-
|
|
22382
|
-
|
|
22383
|
-
|
|
22384
|
-
|
|
22385
|
-
|
|
22386
|
-
|
|
22387
|
-
|
|
22388
|
-
|
|
22389
|
-
|
|
22390
|
-
|
|
22391
|
-
|
|
22392
|
-
|
|
22393
|
-
|
|
22394
|
-
|
|
22395
|
-
|
|
22396
|
-
|
|
22397
|
-
|
|
22398
|
-
|
|
22399
|
-
|
|
22400
|
-
|
|
22401
|
-
|
|
22402
|
-
|
|
22403
|
-
|
|
22404
|
-
|
|
22405
|
-
/* @__PURE__ */ jsxRuntime.jsx(FooterBar, { footer, totalItems })
|
|
22406
|
-
]
|
|
22407
|
-
}
|
|
22408
|
-
)
|
|
22409
|
-
] }) });
|
|
22580
|
+
return /* @__PURE__ */ jsxRuntime.jsx(framerMotion.AnimatePresence, { children: open && /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
22581
|
+
framerMotion.motion.div,
|
|
22582
|
+
{
|
|
22583
|
+
initial: { opacity: 0, scale: 0.96, y: -8 },
|
|
22584
|
+
animate: { opacity: 1, scale: 1, y: 0 },
|
|
22585
|
+
exit: { opacity: 0, scale: 0.96, y: -8 },
|
|
22586
|
+
transition: ANIMATION.panel,
|
|
22587
|
+
className: "fixed z-[100] top-4 -translate-x-1/2 w-full max-w-xl rounded-xl border border-border overflow-hidden shadow-2xl shadow-black/20 dark:shadow-black/60 bg-popover/95 backdrop-blur-xl",
|
|
22588
|
+
style: { maxHeight: "min(600px, 80vh)" },
|
|
22589
|
+
children: [
|
|
22590
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-3 px-4 py-2 border-b border-border", children: [
|
|
22591
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
22592
|
+
react.MagnifyingGlassIcon,
|
|
22593
|
+
{
|
|
22594
|
+
className: "w-4 h-4 text-muted-foreground flex-shrink-0",
|
|
22595
|
+
weight: "bold"
|
|
22596
|
+
}
|
|
22597
|
+
),
|
|
22598
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
22599
|
+
DebouncedInput,
|
|
22600
|
+
{
|
|
22601
|
+
ref: inputRef,
|
|
22602
|
+
value: query,
|
|
22603
|
+
debounce: debounceDelay,
|
|
22604
|
+
onChange: handleQueryChange,
|
|
22605
|
+
placeholder: searchPlaceholder,
|
|
22606
|
+
rightIcon: query ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
22607
|
+
ButtonBase,
|
|
22608
|
+
{
|
|
22609
|
+
variant: "ghost",
|
|
22610
|
+
size: "icon",
|
|
22611
|
+
onClick: handleClearQuery,
|
|
22612
|
+
className: "text-muted-foreground hover:text-red-500 hover:bg-transparent transition-colors",
|
|
22613
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(react.XIcon, { className: "w-4 h-4" })
|
|
22614
|
+
}
|
|
22615
|
+
) : void 0,
|
|
22616
|
+
className: "flex-1 bg-transparent border-none focus-visible:ring-0 outline-none shadow-none px-0 h-7 text-sm caret-primary"
|
|
22617
|
+
}
|
|
22618
|
+
)
|
|
22619
|
+
] }),
|
|
22620
|
+
/* @__PURE__ */ jsxRuntime.jsx(SearchBadges, { terms: searchTerms }),
|
|
22621
|
+
showList && /* @__PURE__ */ jsxRuntime.jsx(VirtualResultList, { ...sharedListProps }),
|
|
22622
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
22623
|
+
FooterBar,
|
|
22624
|
+
{
|
|
22625
|
+
footer,
|
|
22626
|
+
totalItems,
|
|
22627
|
+
selectedCount: selectedItemIds.size,
|
|
22628
|
+
executeBulkAction
|
|
22629
|
+
}
|
|
22630
|
+
)
|
|
22631
|
+
]
|
|
22632
|
+
}
|
|
22633
|
+
) }) });
|
|
22410
22634
|
}
|
|
22411
22635
|
|
|
22412
22636
|
exports.AddButton = AddButton;
|