@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.mjs CHANGED
@@ -5,7 +5,7 @@ import { Slot } from '@radix-ui/react-slot';
5
5
  import { cva } from 'class-variance-authority';
6
6
  import { clsx } from 'clsx';
7
7
  import { twMerge } from 'tailwind-merge';
8
- import { XIcon, CircleNotchIcon, MagnifyingGlassIcon, CaretUpIcon, CaretDownIcon, CheckIcon, CaretRightIcon, CircleIcon, CloudArrowUpIcon, MinusIcon, CaretUpDownIcon, PencilSimpleIcon, ArrowsLeftRightIcon, FloppyDiskIcon, PlusIcon, TrashIcon, SidebarSimpleIcon, ArrowElbowDownRightIcon, ArrowBendUpLeftIcon, CommandIcon, FilePdfIcon, FileDocIcon, FileXlsIcon, FilePptIcon, FileCsvIcon, FileTextIcon, FileImageIcon, FileVideoIcon, FileAudioIcon, FileZipIcon, FileIcon, DotsSixVerticalIcon, CopyIcon, InfoIcon, WarningIcon, XCircleIcon, CheckCircleIcon, SunIcon, MoonIcon, CaretLeftIcon, DownloadSimpleIcon, UploadSimpleIcon, ArrowClockwiseIcon, ArrowLeftIcon, GearIcon, BellIcon, DotsThreeIcon, FunnelIcon, HeartIcon, StarIcon, EyeIcon, EyeSlashIcon, LockIcon, LockOpenIcon, FolderIcon, ArrowRightIcon as ArrowRightIcon$1, ArrowsOutIcon, DownloadIcon, CalendarBlankIcon, CalendarIcon, MapPinIcon, CalendarDotsIcon, ClockIcon, AlignLeftIcon, CaretLeft, CaretRight, ArrowDownIcon, ClockUserIcon, EyeSlash, Eye, ArrowUpRightIcon, ArrowDownRightIcon, FunnelSimpleIcon, PencilIcon, ClockCounterClockwiseIcon, FileArchiveIcon, TerminalIcon, CodeIcon, CalendarDotIcon as CalendarDotIcon$1, DesktopIcon } from '@phosphor-icons/react';
8
+ import { XIcon, CircleNotchIcon, MagnifyingGlassIcon, CaretUpIcon, CaretDownIcon, CheckIcon, CaretRightIcon, CircleIcon, CloudArrowUpIcon, MinusIcon, CaretUpDownIcon, PencilSimpleIcon, ArrowsLeftRightIcon, FloppyDiskIcon, PlusIcon, TrashIcon, SidebarSimpleIcon, CommandIcon, ArrowElbowDownRightIcon, ArrowBendUpLeftIcon, FilePdfIcon, FileDocIcon, FileXlsIcon, FilePptIcon, FileCsvIcon, FileTextIcon, FileImageIcon, FileVideoIcon, FileAudioIcon, FileZipIcon, FileIcon, DotsSixVerticalIcon, CopyIcon, InfoIcon, WarningIcon, XCircleIcon, CheckCircleIcon, CaretLeftIcon, DownloadSimpleIcon, UploadSimpleIcon, ArrowClockwiseIcon, ArrowLeftIcon, GearIcon, BellIcon, DotsThreeIcon, FunnelIcon, HeartIcon, StarIcon, EyeIcon, EyeSlashIcon, LockIcon, LockOpenIcon, FolderIcon, ArrowRightIcon as ArrowRightIcon$1, ArrowsOutIcon, DownloadIcon, CalendarBlankIcon, CalendarIcon, MapPinIcon, CalendarDotsIcon, SunIcon, ClockIcon, AlignLeftIcon, CaretLeft, CaretRight, ArrowDownIcon, ClockUserIcon, EyeSlash, Eye, ArrowUpRightIcon, ArrowDownRightIcon, FunnelSimpleIcon, PencilIcon, ClockCounterClockwiseIcon, FileArchiveIcon, TerminalIcon, CodeIcon, CalendarDotIcon as CalendarDotIcon$1, MoonIcon, DesktopIcon } from '@phosphor-icons/react';
9
9
  import * as AlertDialogPrimitive from '@radix-ui/react-alert-dialog';
10
10
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
11
11
  import * as DialogPrimitive from '@radix-ui/react-dialog';
@@ -3443,58 +3443,100 @@ var ThemeIcon = ({ theme }) => {
3443
3443
  }
3444
3444
  ) });
3445
3445
  };
3446
+ function resolveOrigin(origin, buttonRef, cursorPos) {
3447
+ if (origin === "cursor" && cursorPos) {
3448
+ return cursorPos;
3449
+ }
3450
+ if (!buttonRef.current) {
3451
+ return { x: window.innerWidth / 2, y: window.innerHeight / 2 };
3452
+ }
3453
+ const rect = buttonRef.current.getBoundingClientRect();
3454
+ switch (origin) {
3455
+ case "top-left":
3456
+ return { x: rect.left, y: rect.top };
3457
+ case "top-right":
3458
+ return { x: rect.right, y: rect.top };
3459
+ case "center":
3460
+ default:
3461
+ return { x: rect.left + rect.width / 2, y: rect.top + rect.height / 2 };
3462
+ }
3463
+ }
3446
3464
  function ModeToggleBase({
3447
3465
  themes = ["light", "dark", "system"],
3448
3466
  className,
3449
3467
  directToggle = false,
3450
- variant = "ghost"
3468
+ variant = "ghost",
3469
+ showLabel = false,
3470
+ tooltip = false,
3471
+ animationOrigin = "center",
3472
+ transitionDuration = 400,
3473
+ storageKey,
3474
+ defaultTheme,
3475
+ onThemeChange
3451
3476
  }) {
3452
3477
  const [mounted, setMounted] = useState(false);
3478
+ const [isTransitioning, setIsTransitioning] = useState(false);
3479
+ const cursorPos = useRef(null);
3453
3480
  const { setTheme, theme: currentTheme } = useTheme();
3454
3481
  const buttonRef = useRef(null);
3455
3482
  useEffect(() => {
3483
+ if (storageKey && defaultTheme) {
3484
+ const stored = localStorage.getItem(storageKey);
3485
+ if (!stored) setTheme(defaultTheme);
3486
+ } else if (defaultTheme && !localStorage.getItem("theme")) {
3487
+ setTheme(defaultTheme);
3488
+ }
3456
3489
  setMounted(true);
3457
- }, []);
3490
+ }, [defaultTheme, setTheme, storageKey]);
3458
3491
  const isDark = mounted && (currentTheme?.includes("dark") || currentTheme === "system" && typeof window !== "undefined" && window.matchMedia("(prefers-color-scheme: dark)").matches);
3492
+ const activeTheme = mounted ? currentTheme : defaultTheme;
3493
+ const tooltipText = tooltip === true ? themeLabels[activeTheme] ?? "Toggle theme" : typeof tooltip === "string" ? tooltip : null;
3459
3494
  const toggleTheme = async (newTheme) => {
3495
+ if (isTransitioning) return;
3460
3496
  if (!buttonRef.current) {
3461
3497
  setTheme(newTheme);
3498
+ onThemeChange?.(newTheme);
3462
3499
  return;
3463
3500
  }
3464
3501
  const supportsViewTransition = typeof document !== "undefined" && "startViewTransition" in document && typeof document.startViewTransition === "function";
3465
3502
  if (!supportsViewTransition) {
3466
3503
  setTheme(newTheme);
3504
+ onThemeChange?.(newTheme);
3467
3505
  return;
3468
3506
  }
3469
3507
  try {
3470
- const rect = buttonRef.current.getBoundingClientRect();
3471
- const x = rect.left + rect.width / 2;
3472
- const y = rect.top + rect.height / 2;
3508
+ setIsTransitioning(true);
3509
+ const { x, y } = resolveOrigin(
3510
+ animationOrigin,
3511
+ buttonRef,
3512
+ cursorPos.current
3513
+ );
3473
3514
  const endRadius = Math.hypot(
3474
3515
  Math.max(x, window.innerWidth - x),
3475
3516
  Math.max(y, window.innerHeight - y)
3476
3517
  );
3477
3518
  const transition = document.startViewTransition(async () => {
3478
3519
  setTheme(newTheme);
3520
+ onThemeChange?.(newTheme);
3479
3521
  });
3480
3522
  await transition.ready;
3481
- document.documentElement.animate(
3523
+ const animation = document.documentElement.animate(
3482
3524
  [
3483
- {
3484
- clipPath: `circle(0px at ${x}px ${y}px)`
3485
- },
3486
- {
3487
- clipPath: `circle(${Math.ceil(endRadius)}px at ${x}px ${y}px)`
3488
- }
3525
+ { clipPath: `circle(0px at ${x}px ${y}px)` },
3526
+ { clipPath: `circle(${Math.ceil(endRadius)}px at ${x}px ${y}px)` }
3489
3527
  ],
3490
3528
  {
3491
- duration: 400,
3529
+ duration: transitionDuration,
3492
3530
  easing: "cubic-bezier(0.4, 0, 0.2, 1)",
3493
3531
  pseudoElement: "::view-transition-new(root)"
3494
3532
  }
3495
3533
  );
3534
+ animation.onfinish = () => setIsTransitioning(false);
3535
+ animation.oncancel = () => setIsTransitioning(false);
3496
3536
  } catch {
3497
3537
  setTheme(newTheme);
3538
+ onThemeChange?.(newTheme);
3539
+ setIsTransitioning(false);
3498
3540
  }
3499
3541
  };
3500
3542
  const handleDirectToggle = () => {
@@ -3502,67 +3544,72 @@ function ModeToggleBase({
3502
3544
  const nextIndex = (currentIndex + 1) % themes.length;
3503
3545
  toggleTheme(themes[nextIndex]);
3504
3546
  };
3505
- if (directToggle) {
3506
- return /* @__PURE__ */ jsxs(
3507
- ButtonBase,
3547
+ const handleMouseMove = (e) => {
3548
+ cursorPos.current = { x: e.clientX, y: e.clientY };
3549
+ };
3550
+ const buttonContent = /* @__PURE__ */ jsxs(Fragment, { children: [
3551
+ /* @__PURE__ */ jsx(
3552
+ SunIcon,
3508
3553
  {
3509
- ref: buttonRef,
3510
- variant,
3511
- size: "icon",
3512
- className: cn("relative overflow-hidden group", className),
3513
- onClick: handleDirectToggle,
3514
- children: [
3515
- /* @__PURE__ */ jsxs(Fragment, { children: [
3516
- /* @__PURE__ */ jsx(
3517
- SunIcon,
3518
- {
3519
- 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"}`
3520
- }
3521
- ),
3522
- /* @__PURE__ */ jsx(
3523
- MoonIcon,
3524
- {
3525
- 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"}`
3526
- }
3527
- )
3528
- ] }),
3529
- /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Toggle theme" })
3530
- ]
3554
+ 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"}`
3555
+ }
3556
+ ),
3557
+ /* @__PURE__ */ jsx(
3558
+ MoonIcon,
3559
+ {
3560
+ 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"}`
3531
3561
  }
3562
+ ),
3563
+ showLabel && mounted && /* @__PURE__ */ jsx("span", { className: "ml-5 text-sm font-medium", children: themeLabels[activeTheme] }),
3564
+ /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Toggle theme" })
3565
+ ] });
3566
+ const wrapWithTooltip = (node) => {
3567
+ if (!tooltipText) return node;
3568
+ return /* @__PURE__ */ jsx(TooltipProviderBase, { children: /* @__PURE__ */ jsxs(TooltipBase, { children: [
3569
+ /* @__PURE__ */ jsx(TooltipTriggerBase, { asChild: true, children: node }),
3570
+ /* @__PURE__ */ jsx(TooltipContentBase, { children: tooltipText })
3571
+ ] }) });
3572
+ };
3573
+ if (directToggle) {
3574
+ return wrapWithTooltip(
3575
+ /* @__PURE__ */ jsx(
3576
+ ButtonBase,
3577
+ {
3578
+ ref: buttonRef,
3579
+ variant,
3580
+ size: showLabel ? "default" : "icon",
3581
+ className: cn("relative overflow-hidden group", className),
3582
+ onClick: handleDirectToggle,
3583
+ onMouseMove: handleMouseMove,
3584
+ onKeyDown: (e) => {
3585
+ if (e.repeat && (e.key === "Enter" || e.key === " ")) {
3586
+ e.preventDefault();
3587
+ }
3588
+ },
3589
+ children: buttonContent
3590
+ }
3591
+ )
3532
3592
  );
3533
3593
  }
3534
3594
  return /* @__PURE__ */ jsxs(DropDownMenuBase, { children: [
3535
- /* @__PURE__ */ jsx(DropDownMenuTriggerBase, { asChild: true, children: /* @__PURE__ */ jsxs(
3536
- ButtonBase,
3537
- {
3538
- ref: buttonRef,
3539
- variant,
3540
- size: "icon",
3541
- className: cn("relative overflow-hidden group", className),
3542
- children: [
3543
- /* @__PURE__ */ jsxs(Fragment, { children: [
3544
- /* @__PURE__ */ jsx(
3545
- SunIcon,
3546
- {
3547
- 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"}`
3548
- }
3549
- ),
3550
- /* @__PURE__ */ jsx(
3551
- MoonIcon,
3552
- {
3553
- 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"}`
3554
- }
3555
- )
3556
- ] }),
3557
- /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Toggle theme" })
3558
- ]
3559
- }
3595
+ /* @__PURE__ */ jsx(DropDownMenuTriggerBase, { asChild: true, children: wrapWithTooltip(
3596
+ /* @__PURE__ */ jsx(
3597
+ ButtonBase,
3598
+ {
3599
+ ref: buttonRef,
3600
+ variant,
3601
+ size: showLabel ? "default" : "icon",
3602
+ className: cn("relative overflow-hidden group", className),
3603
+ onMouseMove: handleMouseMove,
3604
+ children: buttonContent
3605
+ }
3606
+ )
3560
3607
  ) }),
3561
3608
  /* @__PURE__ */ jsx(
3562
3609
  DropDownMenuContentBase,
3563
3610
  {
3564
3611
  align: "end",
3565
- className: "border-border bg-popover text-popover-foreground min-w-[140px] ",
3612
+ className: "border-border bg-popover text-popover-foreground min-w-[140px]",
3566
3613
  children: themes.map((theme) => {
3567
3614
  const isActive = currentTheme === theme;
3568
3615
  return /* @__PURE__ */ jsxs(
@@ -9627,7 +9674,8 @@ function DayViewAgenda({
9627
9674
  events,
9628
9675
  onEventSelect,
9629
9676
  showUndatedEvents,
9630
- noTime = false
9677
+ noTime = false,
9678
+ onEventCreate
9631
9679
  }) {
9632
9680
  const hours = useMemo(() => {
9633
9681
  const dayStart = startOfDay(currentDate);
@@ -9877,6 +9925,7 @@ function DayViewAgenda({
9877
9925
  const startTime = new Date(currentDate);
9878
9926
  startTime.setHours(hourValue);
9879
9927
  startTime.setMinutes(quarter * 15);
9928
+ if (onEventCreate) onEventCreate(startTime);
9880
9929
  },
9881
9930
  time: quarterHourTime
9882
9931
  },
@@ -10139,7 +10188,8 @@ function EventAgenda({
10139
10188
  onlyMonth,
10140
10189
  onlyWeek,
10141
10190
  onlyAgenda,
10142
- onlyYear
10191
+ onlyYear,
10192
+ allowCellClick = false
10143
10193
  }) {
10144
10194
  const lockedView = onlyDay ? "day" : onlyMonth ? "month" : onlyWeek ? "week" : onlyAgenda ? "agenda" : onlyYear ? "year" : void 0;
10145
10195
  const [currentDate, setCurrentDate] = useState(
@@ -10302,7 +10352,13 @@ function EventAgenda({
10302
10352
  currentDate,
10303
10353
  events,
10304
10354
  onEventSelect: handleEventSelect,
10305
- noTime
10355
+ noTime,
10356
+ onEventCreate: allowCellClick ? (d) => onEventUpdate?.({
10357
+ start: d,
10358
+ end: d,
10359
+ title: "Novo Evento",
10360
+ id: crypto.randomUUID()
10361
+ }) : void 0
10306
10362
  }
10307
10363
  ),
10308
10364
  activeView === "week" && /* @__PURE__ */ jsx(
@@ -10311,7 +10367,13 @@ function EventAgenda({
10311
10367
  currentDate,
10312
10368
  events,
10313
10369
  onEventSelect: handleEventSelect,
10314
- noTime
10370
+ noTime,
10371
+ onEventCreate: allowCellClick ? (d) => onEventUpdate?.({
10372
+ start: d,
10373
+ end: d,
10374
+ title: "Novo Evento",
10375
+ id: crypto.randomUUID()
10376
+ }) : void 0
10315
10377
  }
10316
10378
  ),
10317
10379
  activeView === "day" && /* @__PURE__ */ jsx(
@@ -10320,7 +10382,13 @@ function EventAgenda({
10320
10382
  currentDate,
10321
10383
  events,
10322
10384
  onEventSelect: handleEventSelect,
10323
- noTime
10385
+ noTime,
10386
+ onEventCreate: allowCellClick ? (d) => onEventUpdate?.({
10387
+ start: d,
10388
+ end: d,
10389
+ title: "Novo Evento",
10390
+ id: crypto.randomUUID()
10391
+ }) : void 0
10324
10392
  }
10325
10393
  ),
10326
10394
  activeView === "agenda" && /* @__PURE__ */ jsx(
@@ -10329,7 +10397,13 @@ function EventAgenda({
10329
10397
  currentDate,
10330
10398
  events,
10331
10399
  onEventSelect: handleEventSelect,
10332
- noTime
10400
+ noTime,
10401
+ onEventCreate: allowCellClick ? (d) => onEventUpdate?.({
10402
+ start: d,
10403
+ end: d,
10404
+ title: "Novo Evento",
10405
+ id: crypto.randomUUID()
10406
+ }) : void 0
10333
10407
  }
10334
10408
  ),
10335
10409
  activeView === "year" && /* @__PURE__ */ jsx(
@@ -10592,7 +10666,8 @@ function MonthViewAgenda({
10592
10666
  events,
10593
10667
  onEventSelect,
10594
10668
  showUndatedEvents,
10595
- noTime = false
10669
+ noTime = false,
10670
+ onEventCreate
10596
10671
  }) {
10597
10672
  const days = useMemo(() => {
10598
10673
  const monthStart = startOfMonth(currentDate);
@@ -10735,6 +10810,7 @@ function MonthViewAgenda({
10735
10810
  onClick: () => {
10736
10811
  const t = new Date(day);
10737
10812
  t.setHours(DefaultStartHourAgenda, 0, 0);
10813
+ if (onEventCreate) onEventCreate(t);
10738
10814
  },
10739
10815
  children: [
10740
10816
  /* @__PURE__ */ jsx(
@@ -16073,7 +16149,8 @@ var DraggableTooltipComponent = ({
16073
16149
  highlightedSeries,
16074
16150
  toggleHighlight,
16075
16151
  finalColors,
16076
- valueFormatter
16152
+ valueFormatter,
16153
+ seriesTypeMap
16077
16154
  ]
16078
16155
  ),
16079
16156
  /* @__PURE__ */ jsx("div", { className: "mt-3 pt-2 border-t", children: /* @__PURE__ */ jsxs("p", { className: "text-xs text-muted-foreground flex items-center gap-1", children: [
@@ -16367,74 +16444,106 @@ var SystemTooltip = ({
16367
16444
  const [localPos, setLocalPos] = useState(position);
16368
16445
  const [dragging, setDragging] = useState(false);
16369
16446
  const offsetRef = useRef({ x: 0, y: 0 });
16370
- const lastMouse = useRef({ x: 0, y: 0 });
16371
- useEffect(() => setLocalPos(position), [position]);
16447
+ const lastPos = useRef({ x: 0, y: 0 });
16448
+ const tooltipRef = useRef(null);
16449
+ const currentPosRef = useRef(position);
16450
+ useEffect(() => {
16451
+ currentPosRef.current = position;
16452
+ setLocalPos(position);
16453
+ }, [position]);
16372
16454
  useEffect(() => {
16373
16455
  let rafId = null;
16374
- const handleMouseMove = (e) => {
16375
- if (!dragging) return;
16376
- lastMouse.current = { x: e.clientX, y: e.clientY };
16456
+ const applyMove = (clientX, clientY) => {
16457
+ lastPos.current = { x: clientX, y: clientY };
16377
16458
  if (rafId) cancelAnimationFrame(rafId);
16378
16459
  rafId = requestAnimationFrame(() => {
16379
- const newLeft = lastMouse.current.x - offsetRef.current.x;
16380
- const newTop = lastMouse.current.y - offsetRef.current.y;
16381
- const rawPosition = {
16382
- top: Math.max(0, Math.min(newTop, window.innerHeight - 200)),
16383
- left: Math.max(0, Math.min(newLeft, window.innerWidth - 320))
16460
+ const p = {
16461
+ top: Math.max(
16462
+ 0,
16463
+ Math.min(
16464
+ lastPos.current.y - offsetRef.current.y,
16465
+ window.innerHeight - 200
16466
+ )
16467
+ ),
16468
+ left: Math.max(
16469
+ 0,
16470
+ Math.min(
16471
+ lastPos.current.x - offsetRef.current.x,
16472
+ window.innerWidth - 320
16473
+ )
16474
+ )
16384
16475
  };
16385
- setLocalPos(rawPosition);
16386
- if (onPositionChange) onPositionChange(id, rawPosition);
16476
+ currentPosRef.current = p;
16477
+ if (tooltipRef.current) {
16478
+ tooltipRef.current.style.top = `${p.top}px`;
16479
+ tooltipRef.current.style.left = `${p.left}px`;
16480
+ }
16481
+ onPositionChange?.(id, p);
16387
16482
  });
16388
16483
  };
16389
- const handleMouseUp = () => {
16390
- if (dragging) {
16391
- setDragging(false);
16392
- if (rafId) cancelAnimationFrame(rafId);
16393
- }
16484
+ const stopDrag = () => {
16485
+ if (!dragging) return;
16486
+ setDragging(false);
16487
+ setLocalPos(currentPosRef.current);
16488
+ if (rafId) cancelAnimationFrame(rafId);
16489
+ };
16490
+ const handleMouseMove = (e) => {
16491
+ if (dragging) applyMove(e.clientX, e.clientY);
16492
+ };
16493
+ const handleTouchMove = (e) => {
16494
+ if (!dragging || !e.touches[0]) return;
16495
+ applyMove(e.touches[0].clientX, e.touches[0].clientY);
16394
16496
  };
16395
16497
  if (dragging) {
16396
16498
  document.addEventListener("mousemove", handleMouseMove, {
16397
16499
  passive: true
16398
16500
  });
16399
- document.addEventListener("mouseup", handleMouseUp);
16501
+ document.addEventListener("mouseup", stopDrag);
16502
+ document.addEventListener("touchmove", handleTouchMove, {
16503
+ passive: true
16504
+ });
16505
+ document.addEventListener("touchend", stopDrag);
16506
+ document.addEventListener("touchcancel", stopDrag);
16400
16507
  document.body.style.cursor = "grabbing";
16401
16508
  document.body.style.userSelect = "none";
16402
16509
  }
16403
16510
  return () => {
16404
16511
  if (rafId) cancelAnimationFrame(rafId);
16405
16512
  document.removeEventListener("mousemove", handleMouseMove);
16406
- document.removeEventListener("mouseup", handleMouseUp);
16513
+ document.removeEventListener("mouseup", stopDrag);
16514
+ document.removeEventListener("touchmove", handleTouchMove);
16515
+ document.removeEventListener("touchend", stopDrag);
16516
+ document.removeEventListener("touchcancel", stopDrag);
16407
16517
  document.body.style.cursor = "";
16408
16518
  document.body.style.userSelect = "";
16409
16519
  };
16410
16520
  }, [dragging, id, onPositionChange]);
16411
- const handleMouseDownLocal = useCallback(
16412
- (e) => {
16413
- e.preventDefault();
16414
- e.stopPropagation();
16415
- const rect = e.currentTarget.closest(".fixed")?.getBoundingClientRect();
16521
+ const startDrag = useCallback(
16522
+ (clientX, clientY, e) => {
16523
+ const rect = tooltipRef.current?.getBoundingClientRect();
16416
16524
  if (!rect) return;
16417
- offsetRef.current = { x: e.clientX - rect.left, y: e.clientY - rect.top };
16525
+ offsetRef.current = { x: clientX - rect.left, y: clientY - rect.top };
16418
16526
  setDragging(true);
16419
16527
  onMouseDown?.(id, e);
16420
16528
  },
16421
16529
  [id, onMouseDown]
16422
16530
  );
16531
+ const handleMouseDownLocal = useCallback(
16532
+ (e) => {
16533
+ e.preventDefault();
16534
+ e.stopPropagation();
16535
+ startDrag(e.clientX, e.clientY, e);
16536
+ },
16537
+ [startDrag]
16538
+ );
16423
16539
  const handleTouchStartLocal = useCallback(
16424
16540
  (e) => {
16425
16541
  e.stopPropagation();
16426
16542
  const touch = e.touches[0];
16427
16543
  if (!touch) return;
16428
- const rect = e.currentTarget.closest(".fixed")?.getBoundingClientRect();
16429
- if (!rect) return;
16430
- offsetRef.current = {
16431
- x: touch.clientX - rect.left,
16432
- y: touch.clientY - rect.top
16433
- };
16434
- setDragging(true);
16435
- onMouseDown?.(id, e);
16544
+ startDrag(touch.clientX, touch.clientY, e);
16436
16545
  },
16437
- [id, onMouseDown]
16546
+ [startDrag]
16438
16547
  );
16439
16548
  const handleConnClick = useCallback(
16440
16549
  (e, conn) => {
@@ -16482,15 +16591,13 @@ var SystemTooltip = ({
16482
16591
  return /* @__PURE__ */ jsx(AnimatePresence, { children: /* @__PURE__ */ jsxs(
16483
16592
  motion.div,
16484
16593
  {
16594
+ ref: tooltipRef,
16485
16595
  className: "fixed bg-card/95 backdrop-blur-md border border-border/50 rounded-xl shadow-2xl z-[10000] w-80 overflow-hidden",
16486
16596
  variants: tooltipVariants2,
16487
16597
  initial: "hidden",
16488
16598
  animate: "visible",
16489
16599
  exit: "exit",
16490
- style: {
16491
- top: localPos.top,
16492
- left: localPos.left
16493
- },
16600
+ style: { top: localPos.top, left: localPos.left },
16494
16601
  onClick: (e) => e.stopPropagation(),
16495
16602
  children: [
16496
16603
  /* @__PURE__ */ jsxs(
@@ -16505,7 +16612,7 @@ var SystemTooltip = ({
16505
16612
  },
16506
16613
  children: [
16507
16614
  /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 px-3", children: [
16508
- /* @__PURE__ */ jsx("div", { className: "rounded", children: /* @__PURE__ */ jsx(DotsSixVerticalIcon, { size: 16, className: "text-primary" }) }),
16615
+ /* @__PURE__ */ jsx(DotsSixVerticalIcon, { size: 16, className: "text-primary" }),
16509
16616
  /* @__PURE__ */ jsx("span", { className: "text-xs font-semibold text-muted-foreground uppercase tracking-wider", children: title })
16510
16617
  ] }),
16511
16618
  /* @__PURE__ */ jsx(
@@ -16531,22 +16638,19 @@ var SystemTooltip = ({
16531
16638
  ] }) }),
16532
16639
  /* @__PURE__ */ 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: [
16533
16640
  /* @__PURE__ */ jsx(SeparatorBase, { className: "w-full" }),
16534
- isLoading ? /* @__PURE__ */ jsxs(Fragment, { children: [
16535
- /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
16536
- /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 px-1", children: [
16537
- /* @__PURE__ */ jsx(SkeletonBase, { className: "w-1.5 h-1.5 rounded-full" }),
16538
- /* @__PURE__ */ jsx(SkeletonBase, { className: "h-3 w-16" })
16539
- ] }),
16540
- /* @__PURE__ */ jsx("div", { className: "space-y-1", children: [1, 2, 3].map((i) => /* @__PURE__ */ jsx(SkeletonBase, { className: "h-10 w-full rounded-lg" }, i)) })
16641
+ isLoading ? /* @__PURE__ */ jsx(Fragment, { children: [1, 2].map((g) => /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
16642
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 px-1", children: [
16643
+ /* @__PURE__ */ jsx(SkeletonBase, { className: "w-1.5 h-1.5 rounded-full" }),
16644
+ /* @__PURE__ */ jsx(SkeletonBase, { className: "h-3 w-16" })
16541
16645
  ] }),
16542
- /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
16543
- /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 px-1", children: [
16544
- /* @__PURE__ */ jsx(SkeletonBase, { className: "w-1.5 h-1.5 rounded-full" }),
16545
- /* @__PURE__ */ jsx(SkeletonBase, { className: "h-3 w-16" })
16546
- ] }),
16547
- /* @__PURE__ */ jsx("div", { className: "space-y-1", children: [1, 2].map((i) => /* @__PURE__ */ jsx(SkeletonBase, { className: "h-10 w-full rounded-lg" }, i)) })
16548
- ] })
16549
- ] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
16646
+ /* @__PURE__ */ jsx("div", { className: "space-y-1", children: [1, 2, 3].map((i) => /* @__PURE__ */ jsx(
16647
+ SkeletonBase,
16648
+ {
16649
+ className: "h-10 w-full rounded-lg"
16650
+ },
16651
+ i
16652
+ )) })
16653
+ ] }, g)) }) : /* @__PURE__ */ jsxs(Fragment, { children: [
16550
16654
  entries.length > 0 && /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
16551
16655
  /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 px-1", children: [
16552
16656
  /* @__PURE__ */ jsx("div", { className: "w-1.5 h-1.5 rounded-full bg-emerald-500" }),
@@ -16561,7 +16665,7 @@ var SystemTooltip = ({
16561
16665
  ] }),
16562
16666
  /* @__PURE__ */ jsx("div", { className: "space-y-1", children: renderConnections(exits, "blue") })
16563
16667
  ] }),
16564
- data.connections.length === 0 && !isLoading && /* @__PURE__ */ jsx("div", { className: "flex flex-col items-center justify-center p-6 text-center", children: /* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground", children: "Nenhuma conex\xE3o encontrada" }) })
16668
+ data.connections.length === 0 && /* @__PURE__ */ jsx("div", { className: "flex flex-col items-center justify-center p-6 text-center", children: /* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground", children: "Nenhuma conex\xE3o encontrada" }) })
16565
16669
  ] })
16566
16670
  ] })
16567
16671
  ]
@@ -21808,6 +21912,22 @@ function GroupLabel({ group }) {
21808
21912
  /* @__PURE__ */ jsx("span", { className: "text-[11px] font-semibold text-muted-foreground uppercase tracking-widest", children: group.label })
21809
21913
  ] });
21810
21914
  }
21915
+ function HighlightText({ text, query }) {
21916
+ if (!query || !query.trim()) return /* @__PURE__ */ jsx(Fragment, { children: text });
21917
+ const terms = query.split(/[, ]+/).map((t) => t.trim()).filter((t) => t.length > 0);
21918
+ if (terms.length === 0) return /* @__PURE__ */ jsx(Fragment, { children: text });
21919
+ const escapedTerms = terms.map(
21920
+ (t) => t.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")
21921
+ );
21922
+ const regex = new RegExp(`(${escapedTerms.join("|")})`, "gi");
21923
+ const parts = text.split(regex);
21924
+ return /* @__PURE__ */ jsx(Fragment, { children: parts.map((part, i) => {
21925
+ const isMatch = terms.some(
21926
+ (t) => t.toLowerCase() === part.toLowerCase()
21927
+ );
21928
+ return isMatch ? /* @__PURE__ */ jsx("span", { className: "text-primary font-semibold", children: part }, i) : /* @__PURE__ */ jsx("span", { children: part }, i);
21929
+ }) });
21930
+ }
21811
21931
  function mapBadgeVariantToColor(variant) {
21812
21932
  if (!variant) return void 0;
21813
21933
  switch (variant) {
@@ -21834,8 +21954,10 @@ function mapBadgeVariantToColor(variant) {
21834
21954
  function CommandItemRow({
21835
21955
  item,
21836
21956
  isActive,
21957
+ isSelected,
21837
21958
  onSelect,
21838
- onHover
21959
+ onHover,
21960
+ searchQuery
21839
21961
  }) {
21840
21962
  return /* @__PURE__ */ jsxs(
21841
21963
  motion.button,
@@ -21853,7 +21975,7 @@ function CommandItemRow({
21853
21975
  "span",
21854
21976
  {
21855
21977
  className: `relative flex-shrink-0 w-8 h-8 flex items-center justify-center rounded-md text-base
21856
- ${isActive ? "bg-primary/20 text-primary" : "bg-muted text-muted-foreground group-hover:text-foreground"}`,
21978
+ ${isSelected ? "bg-primary text-primary-foreground" : isActive ? "bg-primary/20 text-primary" : "bg-muted text-muted-foreground group-hover:text-foreground"}`,
21857
21979
  children: item.icon
21858
21980
  }
21859
21981
  ),
@@ -21863,15 +21985,22 @@ function CommandItemRow({
21863
21985
  "span",
21864
21986
  {
21865
21987
  className: `text-sm font-medium truncate ${isActive ? "text-foreground" : "text-foreground/80"}`,
21866
- children: item.label
21988
+ children: /* @__PURE__ */ jsx(HighlightText, { text: item.label, query: searchQuery })
21867
21989
  }
21868
21990
  ),
21869
21991
  item.badge && /* @__PURE__ */ jsx(Badge, { color: mapBadgeVariantToColor(item.badgeVariant), children: item.badge.toUpperCase() })
21870
21992
  ] }),
21871
- item.description && /* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground truncate", children: item.description })
21993
+ item.description && /* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground truncate", children: /* @__PURE__ */ jsx(HighlightText, { text: item.description, query: searchQuery }) })
21872
21994
  ] }),
21873
21995
  item.shortcut && /* @__PURE__ */ jsx("div", { className: "relative hidden sm:flex items-center gap-1 flex-shrink-0", children: item.shortcut.map((k, i) => /* @__PURE__ */ jsx(Kbd, { children: k }, i)) }),
21874
- isActive && /* @__PURE__ */ jsx(
21996
+ isSelected && /* @__PURE__ */ jsx(
21997
+ motion.div,
21998
+ {
21999
+ layoutId: `selected-indicator-${item.id}`,
22000
+ className: "absolute left-0 top-1/2 -translate-y-1/2 w-1 h-2/3 bg-primary rounded-r-md"
22001
+ }
22002
+ ),
22003
+ isActive && !isSelected && /* @__PURE__ */ jsx(
21875
22004
  CaretRightIcon,
21876
22005
  {
21877
22006
  className: "relative w-4 h-4 text-primary flex-shrink-0",
@@ -21891,22 +22020,40 @@ function useCommandPalette({
21891
22020
  recentItems = [],
21892
22021
  onRecentItemsChange,
21893
22022
  maxRecentItems = 5,
21894
- multiSearch = false
22023
+ multiSearch = false,
22024
+ multiSelect = false,
22025
+ onSelectMultiple
21895
22026
  }) {
21896
22027
  const [query, setQuery] = React32.useState("");
21897
22028
  const [activeIndex, setActiveIndex] = React32.useState(0);
21898
22029
  const [page, setPage] = React32.useState(0);
22030
+ const [selectedItemIds, setSelectedItemIds] = React32.useState(
22031
+ /* @__PURE__ */ new Set()
22032
+ );
22033
+ const toggleSelection = React32.useCallback((id) => {
22034
+ setSelectedItemIds((prev) => {
22035
+ const next = new Set(prev);
22036
+ if (next.has(id)) next.delete(id);
22037
+ else next.add(id);
22038
+ return next;
22039
+ });
22040
+ }, []);
22041
+ const clearSelection = React32.useCallback(
22042
+ () => setSelectedItemIds(/* @__PURE__ */ new Set()),
22043
+ []
22044
+ );
21899
22045
  const baseGroups = React32.useMemo(
21900
22046
  () => normaliseGroups(items, groups),
21901
22047
  [items, groups]
21902
22048
  );
21903
- React32.useEffect(() => {
22049
+ useEffect(() => {
21904
22050
  if (open) {
21905
22051
  setQuery("");
21906
22052
  setActiveIndex(0);
21907
22053
  setPage(0);
22054
+ clearSelection();
21908
22055
  }
21909
- }, [open]);
22056
+ }, [open, clearSelection]);
21910
22057
  const searchTerms = React32.useMemo(() => {
21911
22058
  const parts = query.split(",");
21912
22059
  if (parts.length <= 1 && !multiSearch) return [];
@@ -21969,12 +22116,35 @@ function useCommandPalette({
21969
22116
  () => displayedGroups.flatMap((g) => g.items),
21970
22117
  [displayedGroups]
21971
22118
  );
22119
+ const selectedItems = useMemo(
22120
+ () => allFlatItems.filter((i) => selectedItemIds.has(i.id)),
22121
+ [allFlatItems, selectedItemIds]
22122
+ );
21972
22123
  const pageItemCount = flatItems.length;
21973
22124
  useEffect(() => {
21974
22125
  setActiveIndex((i) => Math.min(i, Math.max(pageItemCount - 1, 0)));
21975
22126
  }, [pageItemCount]);
21976
- function handleSelect(item) {
22127
+ function executeBulkAction() {
22128
+ if (!onSelectMultiple || selectedItems.length === 0) return;
22129
+ onSelectMultiple(selectedItems);
22130
+ onOpenChange?.(false);
22131
+ }
22132
+ function handleSelect(item, event) {
21977
22133
  if (!item) return;
22134
+ if (multiSelect) {
22135
+ if (event && ("ctrlKey" in event || "metaKey" in event || "shiftKey" in event) && (event.ctrlKey || event.metaKey || event.shiftKey)) {
22136
+ toggleSelection(item.id);
22137
+ return;
22138
+ }
22139
+ if (selectedItems.length > 0) {
22140
+ const itemsToSubmit = selectedItemIds.has(item.id) ? selectedItems : [...selectedItems, item];
22141
+ if (onSelectMultiple) {
22142
+ onSelectMultiple(itemsToSubmit);
22143
+ }
22144
+ onOpenChange?.(false);
22145
+ return;
22146
+ }
22147
+ }
21978
22148
  item.onSelect();
21979
22149
  onOpenChange?.(false);
21980
22150
  if (onRecentItemsChange) {
@@ -22007,12 +22177,26 @@ function useCommandPalette({
22007
22177
  }
22008
22178
  } else if (e.key === "Enter") {
22009
22179
  e.preventDefault();
22010
- handleSelect(flatItems[activeIndex]);
22180
+ if (multiSelect && (e.ctrlKey || e.metaKey)) {
22181
+ executeBulkAction();
22182
+ return;
22183
+ }
22184
+ handleSelect(flatItems[activeIndex], e);
22011
22185
  }
22012
22186
  };
22013
22187
  document.addEventListener("keydown", handler);
22014
22188
  return () => document.removeEventListener("keydown", handler);
22015
- }, [open, flatItems, activeIndex, pageItemCount, page, totalPages]);
22189
+ }, [
22190
+ open,
22191
+ flatItems,
22192
+ activeIndex,
22193
+ pageItemCount,
22194
+ page,
22195
+ totalPages,
22196
+ executeBulkAction,
22197
+ handleSelect,
22198
+ multiSelect
22199
+ ]);
22016
22200
  return {
22017
22201
  query,
22018
22202
  setQuery,
@@ -22028,6 +22212,10 @@ function useCommandPalette({
22028
22212
  totalItems,
22029
22213
  totalPages,
22030
22214
  handleSelect,
22215
+ selectedItemIds,
22216
+ toggleSelection,
22217
+ selectedItems,
22218
+ executeBulkAction,
22031
22219
  isEmpty: totalItems === 0 && query.trim().length > 0,
22032
22220
  showList: query.trim() !== "" || recentItems.length > 0
22033
22221
  };
@@ -22087,8 +22275,12 @@ var VirtualResultList = memo(
22087
22275
  displayedGroups,
22088
22276
  flatItems,
22089
22277
  activeIndex,
22278
+ multiSelect,
22279
+ selectedItemIds,
22090
22280
  onHover,
22091
- onSelect
22281
+ onSelect,
22282
+ onToggleSelection,
22283
+ searchQuery
22092
22284
  }) => {
22093
22285
  const rows = useMemo(() => {
22094
22286
  const acc = [];
@@ -22144,8 +22336,12 @@ var VirtualResultList = memo(
22144
22336
  {
22145
22337
  item: row.item,
22146
22338
  isActive: row.globalIdx === activeIndex,
22339
+ isSelected: selectedItemIds.has(row.item.id),
22340
+ multiSelect,
22147
22341
  onHover: () => onHover(row.globalIdx),
22148
- onSelect: () => onSelect(row.item)
22342
+ onSelect: (e) => onSelect(row.item, e),
22343
+ onToggleSelection: (e) => onToggleSelection(row.item.id, e),
22344
+ searchQuery
22149
22345
  }
22150
22346
  ) })
22151
22347
  },
@@ -22157,30 +22353,55 @@ var VirtualResultList = memo(
22157
22353
  }
22158
22354
  );
22159
22355
  VirtualResultList.displayName = "VirtualResultList";
22160
- var FooterBar = memo(({ footer, totalItems }) => /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between px-4 py-2 border-t border-border bg-muted/30", children: [
22161
- footer ?? /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-4 text-[11px] text-muted-foreground", children: [
22162
- /* @__PURE__ */ jsxs("span", { className: "flex items-center gap-1.5", children: [
22163
- /* @__PURE__ */ jsx(ArrowElbowDownRightIcon, { className: "w-3 h-3" }),
22164
- "Selecionar"
22165
- ] }),
22166
- /* @__PURE__ */ jsxs("span", { className: "flex items-center gap-1.5", children: [
22167
- /* @__PURE__ */ jsx("span", { className: "font-mono", children: "\u2191\u2193" }),
22168
- "Navegar"
22169
- ] }),
22170
- /* @__PURE__ */ jsxs("span", { className: "flex items-center gap-1.5", children: [
22171
- /* @__PURE__ */ jsx(ArrowBendUpLeftIcon, { className: "w-3 h-3" }),
22172
- "Fechar"
22173
- ] })
22174
- ] }),
22175
- /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1.5 text-[11px] text-muted-foreground", children: [
22176
- /* @__PURE__ */ jsx(CommandIcon, { className: "w-3 h-3" }),
22177
- /* @__PURE__ */ jsxs("span", { children: [
22178
- totalItems,
22179
- " resultado",
22180
- totalItems !== 1 ? "s" : ""
22356
+ var FooterBar = memo(
22357
+ ({
22358
+ footer,
22359
+ totalItems,
22360
+ selectedCount = 0,
22361
+ executeBulkAction
22362
+ }) => /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between px-4 py-2 border-t border-border bg-muted/30", children: [
22363
+ footer ?? /* @__PURE__ */ jsx("div", { className: "flex items-center gap-4 text-[11px] text-muted-foreground", children: selectedCount > 0 ? /* @__PURE__ */ jsxs(Fragment, { children: [
22364
+ /* @__PURE__ */ jsxs(
22365
+ "button",
22366
+ {
22367
+ onClick: executeBulkAction,
22368
+ className: "flex items-center gap-1.5 text-primary hover:text-primary/80 transition-colors font-medium cursor-pointer",
22369
+ children: [
22370
+ /* @__PURE__ */ jsx(CommandIcon, { className: "w-3 h-3" }),
22371
+ " Confirmar (",
22372
+ selectedCount,
22373
+ ")"
22374
+ ]
22375
+ }
22376
+ ),
22377
+ /* @__PURE__ */ jsxs("span", { className: "flex items-center gap-1.5", children: [
22378
+ /* @__PURE__ */ jsx("span", { className: "font-mono", children: "Ctrl+Enter" }),
22379
+ "Finalizar sele\xE7\xE3o"
22380
+ ] })
22381
+ ] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
22382
+ /* @__PURE__ */ jsxs("span", { className: "flex items-center gap-1.5", children: [
22383
+ /* @__PURE__ */ jsx(ArrowElbowDownRightIcon, { className: "w-3 h-3" }),
22384
+ "Selecionar"
22385
+ ] }),
22386
+ /* @__PURE__ */ jsxs("span", { className: "flex items-center gap-1.5", children: [
22387
+ /* @__PURE__ */ jsx("span", { className: "font-mono", children: "\u2191\u2193" }),
22388
+ "Navegar"
22389
+ ] }),
22390
+ /* @__PURE__ */ jsxs("span", { className: "flex items-center gap-1.5", children: [
22391
+ /* @__PURE__ */ jsx(ArrowBendUpLeftIcon, { className: "w-3 h-3" }),
22392
+ "Fechar"
22393
+ ] })
22394
+ ] }) }),
22395
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1.5 text-[11px] text-muted-foreground", children: [
22396
+ /* @__PURE__ */ jsx(CommandIcon, { className: "w-3 h-3" }),
22397
+ /* @__PURE__ */ jsxs("span", { children: [
22398
+ totalItems,
22399
+ " resultado",
22400
+ totalItems !== 1 ? "s" : ""
22401
+ ] })
22181
22402
  ] })
22182
22403
  ] })
22183
- ] }));
22404
+ );
22184
22405
  FooterBar.displayName = "FooterBar";
22185
22406
  function CommandPalette(props) {
22186
22407
  const {
@@ -22190,6 +22411,7 @@ function CommandPalette(props) {
22190
22411
  footer,
22191
22412
  debounceDelay = 300,
22192
22413
  multiSearch = false,
22414
+ multiSelect = false,
22193
22415
  emptyMessage = "Nenhum resultado encontrado.",
22194
22416
  shortcut = { key: "k", ctrl: true }
22195
22417
  } = props;
@@ -22206,6 +22428,9 @@ function CommandPalette(props) {
22206
22428
  flatItems,
22207
22429
  totalItems,
22208
22430
  handleSelect,
22431
+ selectedItemIds,
22432
+ toggleSelection,
22433
+ executeBulkAction,
22209
22434
  isEmpty,
22210
22435
  showList
22211
22436
  } = useCommandPalette({
@@ -22262,8 +22487,12 @@ function CommandPalette(props) {
22262
22487
  displayedGroups,
22263
22488
  flatItems,
22264
22489
  activeIndex,
22490
+ multiSelect,
22491
+ selectedItemIds,
22265
22492
  onHover: setActiveIndex,
22266
- onSelect: handleSelect
22493
+ onSelect: handleSelect,
22494
+ onToggleSelection: toggleSelection,
22495
+ searchQuery: query
22267
22496
  };
22268
22497
  if (isMobile) {
22269
22498
  return /* @__PURE__ */ jsxs(Fragment, { children: [
@@ -22306,65 +22535,60 @@ function CommandPalette(props) {
22306
22535
  ] }) })
22307
22536
  ] });
22308
22537
  }
22309
- return /* @__PURE__ */ jsx(AnimatePresence, { children: open && /* @__PURE__ */ jsxs(Fragment, { children: [
22310
- /* @__PURE__ */ jsx(
22311
- motion.div,
22312
- {
22313
- initial: { opacity: 0 },
22314
- animate: { opacity: 1 },
22315
- exit: { opacity: 0 },
22316
- transition: ANIMATION.overlay,
22317
- className: "fixed inset-0 z-[100] bg-background/80 backdrop-blur-sm",
22318
- onClick: handleClose
22319
- }
22320
- ),
22321
- /* @__PURE__ */ jsxs(
22322
- motion.div,
22323
- {
22324
- initial: { opacity: 0, scale: 0.96, y: -8 },
22325
- animate: { opacity: 1, scale: 1, y: 0 },
22326
- exit: { opacity: 0, scale: 0.96, y: -8 },
22327
- transition: ANIMATION.panel,
22328
- className: "fixed z-[100] top-12 -translate-x-1/2 -translate-y-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",
22329
- style: { maxHeight: "min(600px, 80vh)" },
22330
- children: [
22331
- /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3 px-4 py-2 border-b border-border", children: [
22332
- /* @__PURE__ */ jsx(
22333
- MagnifyingGlassIcon,
22334
- {
22335
- className: "w-4 h-4 text-muted-foreground flex-shrink-0",
22336
- weight: "bold"
22337
- }
22338
- ),
22339
- /* @__PURE__ */ jsx(
22340
- DebouncedInput,
22341
- {
22342
- ref: inputRef,
22343
- value: query,
22344
- debounce: debounceDelay,
22345
- onChange: handleQueryChange,
22346
- placeholder: searchPlaceholder,
22347
- rightIcon: query ? /* @__PURE__ */ jsx(
22348
- ButtonBase,
22349
- {
22350
- variant: "ghost",
22351
- size: "icon",
22352
- onClick: handleClearQuery,
22353
- className: "text-muted-foreground hover:text-red-500 hover:bg-transparent transition-colors",
22354
- children: /* @__PURE__ */ jsx(XIcon, { className: "w-4 h-4" })
22355
- }
22356
- ) : void 0,
22357
- className: "flex-1 bg-transparent border-none focus-visible:ring-0 outline-none shadow-none px-0 h-7 text-sm caret-primary"
22358
- }
22359
- )
22360
- ] }),
22361
- /* @__PURE__ */ jsx(SearchBadges, { terms: searchTerms }),
22362
- showList && /* @__PURE__ */ jsx(VirtualResultList, { ...sharedListProps }),
22363
- /* @__PURE__ */ jsx(FooterBar, { footer, totalItems })
22364
- ]
22365
- }
22366
- )
22367
- ] }) });
22538
+ return /* @__PURE__ */ jsx(AnimatePresence, { children: open && /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsxs(
22539
+ motion.div,
22540
+ {
22541
+ initial: { opacity: 0, scale: 0.96, y: -8 },
22542
+ animate: { opacity: 1, scale: 1, y: 0 },
22543
+ exit: { opacity: 0, scale: 0.96, y: -8 },
22544
+ transition: ANIMATION.panel,
22545
+ 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",
22546
+ style: { maxHeight: "min(600px, 80vh)" },
22547
+ children: [
22548
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3 px-4 py-2 border-b border-border", children: [
22549
+ /* @__PURE__ */ jsx(
22550
+ MagnifyingGlassIcon,
22551
+ {
22552
+ className: "w-4 h-4 text-muted-foreground flex-shrink-0",
22553
+ weight: "bold"
22554
+ }
22555
+ ),
22556
+ /* @__PURE__ */ jsx(
22557
+ DebouncedInput,
22558
+ {
22559
+ ref: inputRef,
22560
+ value: query,
22561
+ debounce: debounceDelay,
22562
+ onChange: handleQueryChange,
22563
+ placeholder: searchPlaceholder,
22564
+ rightIcon: query ? /* @__PURE__ */ jsx(
22565
+ ButtonBase,
22566
+ {
22567
+ variant: "ghost",
22568
+ size: "icon",
22569
+ onClick: handleClearQuery,
22570
+ className: "text-muted-foreground hover:text-red-500 hover:bg-transparent transition-colors",
22571
+ children: /* @__PURE__ */ jsx(XIcon, { className: "w-4 h-4" })
22572
+ }
22573
+ ) : void 0,
22574
+ className: "flex-1 bg-transparent border-none focus-visible:ring-0 outline-none shadow-none px-0 h-7 text-sm caret-primary"
22575
+ }
22576
+ )
22577
+ ] }),
22578
+ /* @__PURE__ */ jsx(SearchBadges, { terms: searchTerms }),
22579
+ showList && /* @__PURE__ */ jsx(VirtualResultList, { ...sharedListProps }),
22580
+ /* @__PURE__ */ jsx(
22581
+ FooterBar,
22582
+ {
22583
+ footer,
22584
+ totalItems,
22585
+ selectedCount: selectedItemIds.size,
22586
+ executeBulkAction
22587
+ }
22588
+ )
22589
+ ]
22590
+ }
22591
+ ) }) });
22368
22592
  }
22369
22593
 
22370
22594
  export { AddButton, Agenda, AgendaDaysToShow, AgendaDaysToShowAgenda, AgendaView, AlertDialogActionBase, AlertDialogBase, AlertDialogCancelBase, AlertDialogContentBase, AlertDialogDescriptionBase, AlertDialogFooterBase, AlertDialogHeaderBase, AlertDialogOverlayBase, AlertDialogPortalBase, AlertDialogTitleBase, AlertDialogTriggerBase, AvatarBase, AvatarCombobox, AvatarFallbackBase, AvatarImageBase, BackButton, Badge, BreadcrumbBase, BreadcrumbEllipsisBase, BreadcrumbItemBase, BreadcrumbLinkBase, BreadcrumbListBase, BreadcrumbPageBase, BreadcrumbSeparatorBase, Brush_default as Brush, ButtonBase, ButtonGroupBase, CENTER_INDEX, CalendarBase, CalendarDndProvider, CalendarDndProviderAgenda, CardBase, CardContentBase, CardDescriptionBase, CardFooterBase, CardHeaderBase, CardTitleBase, CarouselBase, ChangeButton, Chart_default as Chart, ChartControls, ChartHeader, ChartTotalLegend_default as ChartTotalLegend, CheckButton, CheckboxBase, CheckboxTree, CircularProgress, CloseAllButton_default as CloseAllButton, CloseButton, CodeBlock, CollapsibleBase, CollapsibleContentBase, CollapsibleTriggerBase, Combobox, CommandBase, CommandDebouncedInputBase, CommandDialogBase, CommandEmptyBase, CommandGroupBase, CommandInputBase, CommandItemBase, CommandItemRow, CommandListBase, CommandPalette, CommandSeparatorBase, CommandShortcutBase, ContextMenuBase, ContextMenuCheckboxItemBase, ContextMenuContentBase, ContextMenuGroupBase, ContextMenuItemBase, ContextMenuLabelBase, ContextMenuPortalBase, ContextMenuRadioGroupBase, ContextMenuRadioItemBase, ContextMenuSeparatorBase, ContextMenuShortcutBase, ContextMenuSubBase, ContextMenuSubContentBase, ContextMenuSubTriggerBase, ContextMenuTriggerBase, ControlledCombobox, CopyButton, DateTimePicker, DayView, DayViewAgenda, DebouncedInput, DefaultEndHour, DefaultEndHourAgenda, DefaultStartHour, DefaultStartHourAgenda, DestructiveDialog, DialogBase, DialogCloseBase, DialogContentBase, DialogDescriptionBase, DialogFooterBase, DialogHeaderBase, DialogOverlayBase, DialogPortalBase, DialogTitleBase, DialogTriggerBase, DownloadButton, DraggableEvent2 as DraggableEvent, DraggableTooltip_default as DraggableTooltip, DrawerBase, DrawerCloseBase, DrawerContentBase, DrawerDescriptionBase, DrawerFooterBase, DrawerHeaderBase, DrawerOverlayBase, DrawerPortalBase, DrawerTitleBase, DrawerTriggerBase, DropDownMenuBase, DropDownMenuCheckboxItemBase, DropDownMenuContentBase, DropDownMenuGroupBase, DropDownMenuItemBase, DropDownMenuLabelBase, DropDownMenuPortalBase, DropDownMenuRadioGroupBase, DropDownMenuRadioItemBase, DropDownMenuSeparatorBase, DropDownMenuShortcutBase, DropDownMenuSubBase, DropDownMenuSubContentBase, DropDownMenuSubTriggerBase, DropDownMenuTriggerBase, DroppableCell, DroppableCellAgenda, EditButton, EndHour, EndHourAgenda, ErrorMessage_default as ErrorMessage, EventAgenda, EventCalendar, EventDetailModalAgenda, EventDialog, EventGap, EventGapAgenda, EventHeight, EventHeightAgenda, EventItem, EventItemAgenda, EventsPopup, FavoriteButton, FileAccept, FileUploader, FilterButton, GroupLabel, HideButton, Highlights_default as Highlights, HorizontalChart_default as HorizontalChart, HorizontalLegend_default as HorizontalLegend, HoverCardBase, HoverCardContentBase, HoverCardTriggerBase, ITEM_HEIGHT, InputBase, InputOTPBase, InputOTPGroupBase, InputOTPSeparatorBase, InputOTPSlotBase, IntegrationModal_default as IntegrationModal, Kbd, KbdGroup, LabelBase_default as LabelBase, Leaderboard, LikeButton, LoadingBase, LockButton, ModalBase, ModalCloseBase, ModalContentBase, ModalDescriptionBase, ModalFooterBase, ModalHeaderBase, ModalOverlayBase, ModalPortalBase, ModalTitleBase, ModalTriggerBase, ModeToggleBase, MonthView, MonthViewAgenda, MoreButton, MultiCombobox, MultiDayOverlay, MultiSelect, MultiSelectBase, MultiSelectContentBase, MultiSelectGroupBase, MultiSelectItemBase, MultiSelectSeparatorBase, MultiSelectTriggerBase, MultiSelectValueBase, NavigationMenuBase, NavigationMenuContentBase, NavigationMenuIndicatorBase, NavigationMenuItemBase, NavigationMenuLinkBase, NavigationMenuListBase, NavigationMenuTriggerBase, NavigationMenuViewportBase, NoData_default as NoData, NotificationButton, NumericInput, PeriodsDropdown_default as PeriodsDropdown, PopoverAnchorBase, PopoverBase, PopoverContentBase, PopoverTriggerBase, ProgressBase, ProgressCirclesBase, ProgressPanelsBase, ProgressSegmentsBase, RadialMenu, RangePicker, RefreshButton, SaveButton, ScrollAreaBase, ScrollBarBase, SearchButton, Select, SelectBase, SelectContentBase, SelectEmpty, SelectGroupBase, SelectItemBase, SelectLabelBase, SelectScrollDownButtonBase, SelectScrollUpButtonBase, SelectSeparatorBase, SelectTriggerBase, SelectValueBase, SeparatorBase, SettingsButton, SheetBase, SheetCloseBase, SheetContentBase, SheetDescriptionBase, SheetFooterBase, SheetHeaderBase, SheetOverlayBase, SheetPortalBase, SheetTitleBase, SheetTriggerBase, ShowOnly_default as ShowOnly, SidebarBase, SidebarContentBase, SidebarFooterBase, SidebarGroupActionBase, SidebarGroupBase, SidebarGroupContentBase, SidebarGroupLabelBase, SidebarHeaderBase, SidebarInputBase, SidebarInsetBase, SidebarMenuActionBase, SidebarMenuBadgeBase, SidebarMenuBase, SidebarMenuButtonBase, SidebarMenuItemBase, SidebarMenuSkeletonBase, SidebarMenuSubBase, SidebarMenuSubButtonBase, SidebarMenuSubItemBase, SidebarProviderBase, SidebarRailBase, SidebarSeparatorBase, SidebarTriggerBase, SkeletonBase, SlideBase, StartHour, StartHourAgenda, StatusIndicator, SwitchBase, SystemTooltip_default as SystemTooltip, TableBase, TableBodyBase, TableCaptionBase, TableCellBase, TableFooterBase, TableHeadBase, TableHeaderBase, TableRowBase, TabsBase, TabsContentBase, TabsListBase, TabsTriggerBase, TextAreaBase, ThemeProviderBase, TimePicker, TimePickerInput, TimeSeries_default as TimeSeries, Toaster, TooltipBase, TooltipContentBase, TooltipProviderBase, TooltipSimple_default as TooltipSimple, TooltipTriggerBase, TooltipWithTotal_default as TooltipWithTotal, UndatedEvents, UniversalTooltipRenderer, UnlockButton, UploadButton, UseSideBarBase, VISIBLE_ITEMS, ViewButton, VisibilityButton, WeekCellsHeight, WeekCellsHeightAgenda, WeekView, WeekViewAgenda, YearViewAgenda, adaptDataForTooltip, addHoursToDate, addHoursToDateAgenda, addMinutesToDateAgenda, badgeVariants, buttonVariantsBase, compactTick, computeChartWidth, computeNiceMax, computeYAxisTickWidth, convert12HourTo24Hour, createGroup, createItem, createValueFormatter, createYTickFormatter, detectDataFields, detectXAxis, display12HourValue, filterAndScore, formatDurationAgenda, formatDurationAgendaDays, formatFieldName, formatLinePercentage, generateAdditionalColors, generateColorMap, getAgendaEventsForDay, getAgendaEventsForDayAgenda, getAllEventsForDay, getAllEventsForDayAgenda, getArrowByType, getAutoColorAgenda, getBorderRadiusClasses, getBorderRadiusClassesAgenda, getDateByType, getEventColorClasses, getEventColorClassesAgenda, getEventEndDate, getEventStartDate, getEventsForDay, getEventsForDayAgenda, getItems, getMaxDataValue, getMinDataValue, getSpanningEventsForDay, getSpanningEventsForDayAgenda, getValid12Hour, getValidArrow12Hour, getValidArrowHour, getValidArrowMinuteOrSecond, getValidArrowNumber, getValidHour, getValidMinuteOrSecond, getValidNumber, isMultiDayEvent, isMultiDayEventAgenda, isValid12Hour, isValidHour, isValidMinuteOrSecond, niceCeil, normaliseGroups, normalizeAttendDate, normalizeStr, processIntegrationData, processNeo4jData, renderInsideBarLabel, pillLabelRenderer_default as renderPillLabel, resolveChartMargins, resolveContainerPaddingLeft, scoreMatch, set12Hours, setDateByType, setHours, setMinutes, setSeconds, sortEvents, sortEventsAgenda, startOfLocalDay, toast, unionGroups, useBiaxial, useCalendarDnd, useCalendarDndAgenda, useChartClick, useChartDimensions, useChartHighlights, useChartLayout, useChartMinMax, useChartTooltips, useCommandPalette, useCurrentTimeIndicator, useCurrentTimeIndicatorAgenda, useDrag, useEventVisibility, useEventVisibilityAgenda, useIsMobile, useIsTruncated, useOpenTooltipForPeriod, useProcessedData, useRecents, useSeriesOpacity, useTheme, useTimeSeriesRange, visualForItem };