@mlw-packages/react-components 1.10.16 → 1.10.17
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 +71 -0
- package/dist/index.d.mts +104 -3
- package/dist/index.d.ts +104 -3
- package/dist/index.js +689 -7
- package/dist/index.mjs +678 -9
- package/package.json +3 -2
package/dist/index.mjs
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import './index.css';
|
|
2
2
|
import * as React32 from 'react';
|
|
3
|
-
import React32__default, { forwardRef, useState, useEffect, createContext, useRef, useCallback, useMemo, useId, useContext, useLayoutEffect } from 'react';
|
|
3
|
+
import React32__default, { forwardRef, useState, useEffect, createContext, useRef, useCallback, memo, useMemo, useId, useContext, useLayoutEffect } from 'react';
|
|
4
4
|
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, 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, 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, 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';
|
|
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';
|
|
@@ -37,12 +37,12 @@ import * as ContextMenuPrimitive from '@radix-ui/react-context-menu';
|
|
|
37
37
|
import { Prism } from 'react-syntax-highlighter';
|
|
38
38
|
import { format, startOfMonth, endOfMonth, eachDayOfInterval, isToday, isSameDay, differenceInCalendarDays, differenceInMinutes, isPast, startOfDay, eachHourOfInterval, addHours, getHours, getMinutes, areIntervalsOverlapping, startOfWeek, endOfWeek, isSameMonth, addDays, startOfYear, endOfYear, eachMonthOfInterval, differenceInDays, isBefore, addMinutes, subMonths, subWeeks, subYears, addMonths, addWeeks, addYears, isWithinInterval, add, max, min } from 'date-fns';
|
|
39
39
|
import { ptBR } from 'date-fns/locale';
|
|
40
|
-
import ptBR3 from 'date-fns/locale/pt-BR';
|
|
41
40
|
import { useSensors, useSensor, MouseSensor, TouchSensor, PointerSensor, DndContext, DragOverlay, useDroppable, useDraggable } from '@dnd-kit/core';
|
|
42
41
|
import { CSS } from '@dnd-kit/utilities';
|
|
43
42
|
import { RadioGroup, RadioGroupItem } from '@radix-ui/react-radio-group';
|
|
44
43
|
import { ResponsiveContainer, ComposedChart, XAxis, YAxis, Bar, Line, Area, CartesianGrid, Tooltip, Legend, LabelList, Rectangle } from 'recharts';
|
|
45
44
|
import useEmblaCarousel from 'embla-carousel-react';
|
|
45
|
+
import { useVirtualizer } from '@tanstack/react-virtual';
|
|
46
46
|
|
|
47
47
|
var __create = Object.create;
|
|
48
48
|
var __defProp = Object.defineProperty;
|
|
@@ -2513,7 +2513,7 @@ function Combobox({
|
|
|
2513
2513
|
] });
|
|
2514
2514
|
}
|
|
2515
2515
|
var badgeVariants = cva(
|
|
2516
|
-
"inline-flex items-center justify-center rounded-md border text-xs font-medium w-fit whitespace-nowrap shrink-0 [&>svg]:size-3 gap-1 [&>svg]:pointer-events-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive transition-[color,box-shadow] overflow-hidden",
|
|
2516
|
+
"inline-flex items-center justify-center rounded-md border text-xs font-medium w-fit whitespace-nowrap shrink-0 [&>svg]:size-3 gap-1 [&>svg]:pointer-events-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive transition-[color,box-shadow] overflow-hidden border-border",
|
|
2517
2517
|
{
|
|
2518
2518
|
variants: {
|
|
2519
2519
|
size: {
|
|
@@ -8088,7 +8088,6 @@ function DateTimePicker({
|
|
|
8088
8088
|
] })
|
|
8089
8089
|
] });
|
|
8090
8090
|
}
|
|
8091
|
-
var dateFnsLocale = ptBR3?.default ?? ptBR3;
|
|
8092
8091
|
function RangePicker({
|
|
8093
8092
|
value,
|
|
8094
8093
|
onChange,
|
|
@@ -8143,8 +8142,8 @@ function RangePicker({
|
|
|
8143
8142
|
!range && "text-muted-foreground"
|
|
8144
8143
|
),
|
|
8145
8144
|
children: range?.from && range?.to ? `${format(range.from, "P", {
|
|
8146
|
-
locale:
|
|
8147
|
-
})} - ${format(range.to, "P", { locale:
|
|
8145
|
+
locale: ptBR
|
|
8146
|
+
})} - ${format(range.to, "P", { locale: ptBR })}` : "Selecione um intervalo"
|
|
8148
8147
|
}
|
|
8149
8148
|
),
|
|
8150
8149
|
/* @__PURE__ */ jsx(motion.span, { className: "flex items-center", children: /* @__PURE__ */ jsxs("div", { className: "flex flex-row gap-0 items-center ", children: [
|
|
@@ -8204,7 +8203,7 @@ function RangePicker({
|
|
|
8204
8203
|
mode: "range",
|
|
8205
8204
|
selected: range,
|
|
8206
8205
|
onSelect: handleSelect,
|
|
8207
|
-
locale:
|
|
8206
|
+
locale: ptBR,
|
|
8208
8207
|
showOutsideDays: true,
|
|
8209
8208
|
fixedWeeks: true,
|
|
8210
8209
|
weekStartsOn: 1,
|
|
@@ -21475,5 +21474,675 @@ function processIntegrationData(integrations, targetSystemName) {
|
|
|
21475
21474
|
connections
|
|
21476
21475
|
};
|
|
21477
21476
|
}
|
|
21477
|
+
function normalizeStr(s) {
|
|
21478
|
+
return s.toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g, "");
|
|
21479
|
+
}
|
|
21480
|
+
function scoreMatch(item, query) {
|
|
21481
|
+
const q = normalizeStr(query);
|
|
21482
|
+
const label = normalizeStr(item.label);
|
|
21483
|
+
const desc = normalizeStr(item.description ?? "");
|
|
21484
|
+
const keywords = (item.keywords ?? []).map(normalizeStr);
|
|
21485
|
+
if (label === q) return 100;
|
|
21486
|
+
if (label.startsWith(q)) return 90;
|
|
21487
|
+
if (label.includes(q)) return 70;
|
|
21488
|
+
if (desc.includes(q)) return 50;
|
|
21489
|
+
if (keywords.some((k) => k.includes(q))) return 40;
|
|
21490
|
+
return -1;
|
|
21491
|
+
}
|
|
21492
|
+
function filterAndScore(groups, query) {
|
|
21493
|
+
if (!query.trim()) return groups;
|
|
21494
|
+
return groups.map((g) => ({
|
|
21495
|
+
...g,
|
|
21496
|
+
items: g.items.map((item) => ({ item, score: scoreMatch(item, query) })).filter(({ score }) => score >= 0).sort((a, b) => b.score - a.score).map(({ item }) => item)
|
|
21497
|
+
})).filter((g) => g.items.length > 0).sort((a, b) => (b.priority ?? 0) - (a.priority ?? 0));
|
|
21498
|
+
}
|
|
21499
|
+
function normaliseGroups(items = [], groups = []) {
|
|
21500
|
+
const result = [];
|
|
21501
|
+
if (items.length > 0) {
|
|
21502
|
+
result.push({ id: "__flat__", label: "", items });
|
|
21503
|
+
}
|
|
21504
|
+
result.push(...groups);
|
|
21505
|
+
return result;
|
|
21506
|
+
}
|
|
21507
|
+
function unionGroups(base, terms) {
|
|
21508
|
+
if (terms.length === 0) return base;
|
|
21509
|
+
const allMatchedIds = /* @__PURE__ */ new Set();
|
|
21510
|
+
terms.forEach((term) => {
|
|
21511
|
+
const filtered = filterAndScore(base, term);
|
|
21512
|
+
filtered.forEach((g) => g.items.forEach((i) => allMatchedIds.add(i.id)));
|
|
21513
|
+
});
|
|
21514
|
+
return base.map((group) => ({
|
|
21515
|
+
...group,
|
|
21516
|
+
items: group.items.filter((item) => allMatchedIds.has(item.id))
|
|
21517
|
+
})).filter((group) => group.items.length > 0);
|
|
21518
|
+
}
|
|
21519
|
+
function createGroup(id, label, items, opts) {
|
|
21520
|
+
return { id, label, items, ...opts };
|
|
21521
|
+
}
|
|
21522
|
+
function createItem(item) {
|
|
21523
|
+
return item;
|
|
21524
|
+
}
|
|
21525
|
+
var STORAGE_KEY = "cmd:recents";
|
|
21526
|
+
var MAX_RECENTS = 5;
|
|
21527
|
+
function readStorage() {
|
|
21528
|
+
try {
|
|
21529
|
+
return JSON.parse(localStorage.getItem(STORAGE_KEY) ?? "[]");
|
|
21530
|
+
} catch {
|
|
21531
|
+
return [];
|
|
21532
|
+
}
|
|
21533
|
+
}
|
|
21534
|
+
function writeStorage(ids) {
|
|
21535
|
+
try {
|
|
21536
|
+
localStorage.setItem(STORAGE_KEY, JSON.stringify(ids));
|
|
21537
|
+
} catch {
|
|
21538
|
+
console.error("Failed to write to localStorage");
|
|
21539
|
+
}
|
|
21540
|
+
}
|
|
21541
|
+
function useRecents(allItems) {
|
|
21542
|
+
const [recentIds, setRecentIds] = useState(readStorage);
|
|
21543
|
+
const push = useCallback((item) => {
|
|
21544
|
+
setRecentIds((prev) => {
|
|
21545
|
+
const next = [item.id, ...prev.filter((id) => id !== item.id)].slice(
|
|
21546
|
+
0,
|
|
21547
|
+
MAX_RECENTS
|
|
21548
|
+
);
|
|
21549
|
+
writeStorage(next);
|
|
21550
|
+
return next;
|
|
21551
|
+
});
|
|
21552
|
+
}, []);
|
|
21553
|
+
const clear = useCallback(() => {
|
|
21554
|
+
setRecentIds([]);
|
|
21555
|
+
writeStorage([]);
|
|
21556
|
+
}, []);
|
|
21557
|
+
const items = recentIds.map((id) => allItems.find((i) => i.id === id)).filter(Boolean);
|
|
21558
|
+
return { items, push, clear };
|
|
21559
|
+
}
|
|
21560
|
+
function Kbd({ className, ...props }) {
|
|
21561
|
+
return /* @__PURE__ */ jsx(
|
|
21562
|
+
"kbd",
|
|
21563
|
+
{
|
|
21564
|
+
"data-slot": "kbd",
|
|
21565
|
+
className: cn(
|
|
21566
|
+
"bg-muted text-muted-foreground in-data-[slot=tooltip-content]:bg-background/20 in-data-[slot=tooltip-content]:text-background dark:in-data-[slot=tooltip-content]:bg-background/10 h-5 w-fit min-w-5 gap-1 rounded-sm px-1 font-sans text-xs font-medium [&_svg:not([class*='size-'])]:size-3 pointer-events-none inline-flex items-center justify-center select-none",
|
|
21567
|
+
className
|
|
21568
|
+
),
|
|
21569
|
+
...props
|
|
21570
|
+
}
|
|
21571
|
+
);
|
|
21572
|
+
}
|
|
21573
|
+
function KbdGroup({ className, ...props }) {
|
|
21574
|
+
return /* @__PURE__ */ jsx(
|
|
21575
|
+
"kbd",
|
|
21576
|
+
{
|
|
21577
|
+
"data-slot": "kbd-group",
|
|
21578
|
+
className: cn("gap-1 inline-flex items-center", className),
|
|
21579
|
+
...props
|
|
21580
|
+
}
|
|
21581
|
+
);
|
|
21582
|
+
}
|
|
21583
|
+
function GroupLabel({ group }) {
|
|
21584
|
+
return /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 px-3 py-1.5 mb-1", children: [
|
|
21585
|
+
group.icon && /* @__PURE__ */ jsx("span", { className: "text-muted-foreground w-3.5 h-3.5", children: group.icon }),
|
|
21586
|
+
/* @__PURE__ */ jsx("span", { className: "text-[11px] font-semibold text-muted-foreground uppercase tracking-widest", children: group.label })
|
|
21587
|
+
] });
|
|
21588
|
+
}
|
|
21589
|
+
function mapBadgeVariantToColor(variant) {
|
|
21590
|
+
if (!variant) return void 0;
|
|
21591
|
+
switch (variant) {
|
|
21592
|
+
case "success":
|
|
21593
|
+
return "green";
|
|
21594
|
+
case "warning":
|
|
21595
|
+
return "yellow";
|
|
21596
|
+
case "danger":
|
|
21597
|
+
return "red";
|
|
21598
|
+
case "primary":
|
|
21599
|
+
return "blue";
|
|
21600
|
+
case "secondary":
|
|
21601
|
+
return "purple";
|
|
21602
|
+
case "destructive":
|
|
21603
|
+
return "red";
|
|
21604
|
+
case "muted":
|
|
21605
|
+
return "gray";
|
|
21606
|
+
case "default":
|
|
21607
|
+
return "gray";
|
|
21608
|
+
default:
|
|
21609
|
+
return void 0;
|
|
21610
|
+
}
|
|
21611
|
+
}
|
|
21612
|
+
function CommandItemRow({
|
|
21613
|
+
item,
|
|
21614
|
+
isActive,
|
|
21615
|
+
onSelect,
|
|
21616
|
+
onHover
|
|
21617
|
+
}) {
|
|
21618
|
+
return /* @__PURE__ */ jsxs(
|
|
21619
|
+
motion.button,
|
|
21620
|
+
{
|
|
21621
|
+
layout: true,
|
|
21622
|
+
onClick: onSelect,
|
|
21623
|
+
onMouseEnter: onHover,
|
|
21624
|
+
className: `
|
|
21625
|
+
w-full flex items-center gap-1 px-2 py-1 rounded-md text-left cursor-pointer
|
|
21626
|
+
transition-colors duration-75 group relative
|
|
21627
|
+
${isActive ? "text-accent-foreground hover:bg-accent" : "hover:bg-accent hover:text-accent-foreground"}
|
|
21628
|
+
`,
|
|
21629
|
+
children: [
|
|
21630
|
+
item.icon && /* @__PURE__ */ jsx(
|
|
21631
|
+
"span",
|
|
21632
|
+
{
|
|
21633
|
+
className: `relative flex-shrink-0 w-8 h-8 flex items-center justify-center rounded-md text-base
|
|
21634
|
+
${isActive ? "bg-primary/20 text-primary" : "bg-muted text-muted-foreground group-hover:text-foreground"}`,
|
|
21635
|
+
children: item.icon
|
|
21636
|
+
}
|
|
21637
|
+
),
|
|
21638
|
+
/* @__PURE__ */ jsxs("div", { className: "relative flex-1 min-w-0 px-1", children: [
|
|
21639
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3 flex-wrap", children: [
|
|
21640
|
+
/* @__PURE__ */ jsx(
|
|
21641
|
+
"span",
|
|
21642
|
+
{
|
|
21643
|
+
className: `text-sm font-medium truncate ${isActive ? "text-foreground" : "text-foreground/80"}`,
|
|
21644
|
+
children: item.label
|
|
21645
|
+
}
|
|
21646
|
+
),
|
|
21647
|
+
item.badge && /* @__PURE__ */ jsx(Badge, { color: mapBadgeVariantToColor(item.badgeVariant), children: item.badge.toUpperCase() })
|
|
21648
|
+
] }),
|
|
21649
|
+
item.description && /* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground truncate", children: item.description })
|
|
21650
|
+
] }),
|
|
21651
|
+
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)) }),
|
|
21652
|
+
isActive && /* @__PURE__ */ jsx(
|
|
21653
|
+
CaretRightIcon,
|
|
21654
|
+
{
|
|
21655
|
+
className: "relative w-4 h-4 text-primary flex-shrink-0",
|
|
21656
|
+
weight: "bold"
|
|
21657
|
+
}
|
|
21658
|
+
)
|
|
21659
|
+
]
|
|
21660
|
+
}
|
|
21661
|
+
);
|
|
21662
|
+
}
|
|
21663
|
+
var PAGE_SIZE = 8;
|
|
21664
|
+
function useCommandPalette({
|
|
21665
|
+
items = [],
|
|
21666
|
+
groups = [],
|
|
21667
|
+
open,
|
|
21668
|
+
onOpenChange,
|
|
21669
|
+
recentItems = [],
|
|
21670
|
+
onRecentItemsChange,
|
|
21671
|
+
maxRecentItems = 5,
|
|
21672
|
+
multiSearch = false
|
|
21673
|
+
}) {
|
|
21674
|
+
const [query, setQuery] = React32.useState("");
|
|
21675
|
+
const [activeIndex, setActiveIndex] = React32.useState(0);
|
|
21676
|
+
const [page, setPage] = React32.useState(0);
|
|
21677
|
+
const baseGroups = React32.useMemo(
|
|
21678
|
+
() => normaliseGroups(items, groups),
|
|
21679
|
+
[items, groups]
|
|
21680
|
+
);
|
|
21681
|
+
React32.useEffect(() => {
|
|
21682
|
+
if (open) {
|
|
21683
|
+
setQuery("");
|
|
21684
|
+
setActiveIndex(0);
|
|
21685
|
+
setPage(0);
|
|
21686
|
+
}
|
|
21687
|
+
}, [open]);
|
|
21688
|
+
const searchTerms = React32.useMemo(() => {
|
|
21689
|
+
const parts = query.split(",");
|
|
21690
|
+
if (parts.length <= 1 && !multiSearch) return [];
|
|
21691
|
+
return parts.map((t) => t.trim().toLowerCase()).filter(Boolean);
|
|
21692
|
+
}, [query, multiSearch]);
|
|
21693
|
+
const allMatchedGroups = React32.useMemo(() => {
|
|
21694
|
+
if (!query.trim()) {
|
|
21695
|
+
if (recentItems.length > 0) {
|
|
21696
|
+
return [
|
|
21697
|
+
{
|
|
21698
|
+
id: "__recent__",
|
|
21699
|
+
label: "Recent",
|
|
21700
|
+
icon: React32.createElement(ClockCounterClockwiseIcon),
|
|
21701
|
+
items: recentItems,
|
|
21702
|
+
priority: 999
|
|
21703
|
+
},
|
|
21704
|
+
...baseGroups
|
|
21705
|
+
];
|
|
21706
|
+
}
|
|
21707
|
+
return baseGroups;
|
|
21708
|
+
}
|
|
21709
|
+
if (searchTerms.length > 1 || multiSearch && searchTerms.length > 0) {
|
|
21710
|
+
return unionGroups(baseGroups, searchTerms);
|
|
21711
|
+
}
|
|
21712
|
+
return filterAndScore(baseGroups, query);
|
|
21713
|
+
}, [query, baseGroups, recentItems, multiSearch, searchTerms]);
|
|
21714
|
+
const allFlatItems = useMemo(
|
|
21715
|
+
() => allMatchedGroups.flatMap((g) => g.items),
|
|
21716
|
+
[allMatchedGroups]
|
|
21717
|
+
);
|
|
21718
|
+
const totalItems = allFlatItems.length;
|
|
21719
|
+
const totalPages = Math.max(1, Math.ceil(totalItems / PAGE_SIZE));
|
|
21720
|
+
useEffect(() => {
|
|
21721
|
+
setPage(0);
|
|
21722
|
+
setActiveIndex(0);
|
|
21723
|
+
}, [query]);
|
|
21724
|
+
useEffect(() => {
|
|
21725
|
+
setActiveIndex(0);
|
|
21726
|
+
}, [page]);
|
|
21727
|
+
const displayedGroups = React32.useMemo(() => {
|
|
21728
|
+
const start = page * PAGE_SIZE;
|
|
21729
|
+
const end = start + PAGE_SIZE;
|
|
21730
|
+
let count = 0;
|
|
21731
|
+
const result = [];
|
|
21732
|
+
for (const group of allMatchedGroups) {
|
|
21733
|
+
const slicedItems = [];
|
|
21734
|
+
for (const item of group.items) {
|
|
21735
|
+
if (count >= start && count < end) slicedItems.push(item);
|
|
21736
|
+
count++;
|
|
21737
|
+
if (count >= end) break;
|
|
21738
|
+
}
|
|
21739
|
+
if (slicedItems.length > 0) {
|
|
21740
|
+
result.push({ ...group, items: slicedItems });
|
|
21741
|
+
}
|
|
21742
|
+
if (count >= end) break;
|
|
21743
|
+
}
|
|
21744
|
+
return result;
|
|
21745
|
+
}, [allMatchedGroups, page]);
|
|
21746
|
+
const flatItems = React32.useMemo(
|
|
21747
|
+
() => displayedGroups.flatMap((g) => g.items),
|
|
21748
|
+
[displayedGroups]
|
|
21749
|
+
);
|
|
21750
|
+
const pageItemCount = flatItems.length;
|
|
21751
|
+
React32.useEffect(() => {
|
|
21752
|
+
setActiveIndex((i) => Math.min(i, Math.max(pageItemCount - 1, 0)));
|
|
21753
|
+
}, [pageItemCount]);
|
|
21754
|
+
function handleSelect(item) {
|
|
21755
|
+
if (!item) return;
|
|
21756
|
+
item.onSelect();
|
|
21757
|
+
onOpenChange?.(false);
|
|
21758
|
+
if (onRecentItemsChange) {
|
|
21759
|
+
const next = [item, ...recentItems.filter((r) => r.id !== item.id)].slice(
|
|
21760
|
+
0,
|
|
21761
|
+
maxRecentItems
|
|
21762
|
+
);
|
|
21763
|
+
onRecentItemsChange(next);
|
|
21764
|
+
}
|
|
21765
|
+
}
|
|
21766
|
+
useEffect(() => {
|
|
21767
|
+
if (!open) return;
|
|
21768
|
+
const handler = (e) => {
|
|
21769
|
+
if (e.key === "ArrowDown") {
|
|
21770
|
+
e.preventDefault();
|
|
21771
|
+
if (activeIndex === pageItemCount - 1 && page < totalPages - 1) {
|
|
21772
|
+
setPage((p) => p + 1);
|
|
21773
|
+
} else {
|
|
21774
|
+
setActiveIndex((i) => (i + 1) % Math.max(pageItemCount, 1));
|
|
21775
|
+
}
|
|
21776
|
+
} else if (e.key === "ArrowUp") {
|
|
21777
|
+
e.preventDefault();
|
|
21778
|
+
if (activeIndex === 0 && page > 0) {
|
|
21779
|
+
setPage((p) => p - 1);
|
|
21780
|
+
setActiveIndex(PAGE_SIZE - 1);
|
|
21781
|
+
} else {
|
|
21782
|
+
setActiveIndex(
|
|
21783
|
+
(i) => (i - 1 + Math.max(pageItemCount, 1)) % Math.max(pageItemCount, 1)
|
|
21784
|
+
);
|
|
21785
|
+
}
|
|
21786
|
+
} else if (e.key === "Enter") {
|
|
21787
|
+
e.preventDefault();
|
|
21788
|
+
handleSelect(flatItems[activeIndex]);
|
|
21789
|
+
}
|
|
21790
|
+
};
|
|
21791
|
+
document.addEventListener("keydown", handler);
|
|
21792
|
+
return () => document.removeEventListener("keydown", handler);
|
|
21793
|
+
}, [open, flatItems, activeIndex, pageItemCount, page, totalPages]);
|
|
21794
|
+
return {
|
|
21795
|
+
query,
|
|
21796
|
+
setQuery,
|
|
21797
|
+
activeIndex,
|
|
21798
|
+
setActiveIndex,
|
|
21799
|
+
page,
|
|
21800
|
+
setPage,
|
|
21801
|
+
searchTerms,
|
|
21802
|
+
allMatchedGroups,
|
|
21803
|
+
allFlatItems,
|
|
21804
|
+
displayedGroups,
|
|
21805
|
+
flatItems,
|
|
21806
|
+
totalItems,
|
|
21807
|
+
totalPages,
|
|
21808
|
+
handleSelect,
|
|
21809
|
+
isEmpty: totalItems === 0 && query.trim().length > 0,
|
|
21810
|
+
showList: query.trim() !== "" || recentItems.length > 0
|
|
21811
|
+
};
|
|
21812
|
+
}
|
|
21813
|
+
function useKeyboardShortcut(key, callback, options = {}) {
|
|
21814
|
+
useEffect(() => {
|
|
21815
|
+
const handleKeyDown = (event) => {
|
|
21816
|
+
const { ctrl, meta, shift, alt } = options;
|
|
21817
|
+
const isKeyMatch = event.key.toLowerCase() === key.toLowerCase();
|
|
21818
|
+
const isCtrlMatch = ctrl === void 0 || event.ctrlKey === ctrl;
|
|
21819
|
+
const isMetaMatch = meta === void 0 || event.metaKey === meta;
|
|
21820
|
+
const isShiftMatch = shift === void 0 || event.shiftKey === shift;
|
|
21821
|
+
const isAltMatch = alt === void 0 || event.altKey === alt;
|
|
21822
|
+
if (isKeyMatch && isCtrlMatch && isMetaMatch && isShiftMatch && isAltMatch) {
|
|
21823
|
+
event.preventDefault();
|
|
21824
|
+
callback();
|
|
21825
|
+
}
|
|
21826
|
+
};
|
|
21827
|
+
window.addEventListener("keydown", handleKeyDown);
|
|
21828
|
+
return () => window.removeEventListener("keydown", handleKeyDown);
|
|
21829
|
+
}, [key, callback, options]);
|
|
21830
|
+
}
|
|
21831
|
+
var ITEM_HEIGHT2 = 40;
|
|
21832
|
+
var LABEL_HEIGHT = 28;
|
|
21833
|
+
var LIST_MAX_HEIGHT = 460;
|
|
21834
|
+
var ANIMATION = {
|
|
21835
|
+
overlay: { duration: 0.18 },
|
|
21836
|
+
panel: { duration: 0.2, ease: [0.16, 1, 0.3, 1] },
|
|
21837
|
+
mobilePanel: { duration: 0.18, ease: [0.16, 1, 0.3, 1] },
|
|
21838
|
+
empty: { initial: { opacity: 0, y: 8 }, animate: { opacity: 1, y: 0 } }
|
|
21839
|
+
};
|
|
21840
|
+
var SearchBadges = memo(({ terms }) => {
|
|
21841
|
+
if (terms.length === 0) return null;
|
|
21842
|
+
return /* @__PURE__ */ jsx("div", { className: "flex items-center gap-1.5 px-4 py-1.5 border-b border-border flex-wrap", children: terms.map((term, i) => /* @__PURE__ */ jsx(Badge, { children: term }, i)) });
|
|
21843
|
+
});
|
|
21844
|
+
SearchBadges.displayName = "SearchBadges";
|
|
21845
|
+
var EmptyState = memo(({ message }) => /* @__PURE__ */ jsxs(
|
|
21846
|
+
motion.div,
|
|
21847
|
+
{
|
|
21848
|
+
...ANIMATION.empty,
|
|
21849
|
+
className: "flex flex-col items-center justify-center py-14 text-center gap-3",
|
|
21850
|
+
children: [
|
|
21851
|
+
/* @__PURE__ */ jsx("div", { className: "w-12 h-12 rounded-md bg-muted flex items-center justify-center", children: /* @__PURE__ */ jsx(MagnifyingGlassIcon, { className: "w-6 h-6 text-muted-foreground" }) }),
|
|
21852
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
21853
|
+
/* @__PURE__ */ jsx("p", { className: "text-sm font-medium text-muted-foreground", children: message }),
|
|
21854
|
+
/* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground/60 mt-1", children: "Try a different search term" })
|
|
21855
|
+
] })
|
|
21856
|
+
]
|
|
21857
|
+
}
|
|
21858
|
+
));
|
|
21859
|
+
EmptyState.displayName = "EmptyState";
|
|
21860
|
+
var VirtualResultList = memo(
|
|
21861
|
+
({
|
|
21862
|
+
listRef,
|
|
21863
|
+
isEmpty,
|
|
21864
|
+
emptyMessage,
|
|
21865
|
+
displayedGroups,
|
|
21866
|
+
flatItems,
|
|
21867
|
+
activeIndex,
|
|
21868
|
+
onHover,
|
|
21869
|
+
onSelect
|
|
21870
|
+
}) => {
|
|
21871
|
+
const rows = useMemo(() => {
|
|
21872
|
+
const acc = [];
|
|
21873
|
+
for (const group of displayedGroups) {
|
|
21874
|
+
if (group.label) acc.push({ kind: "label", group });
|
|
21875
|
+
for (const item of group.items) {
|
|
21876
|
+
const globalIdx = flatItems.findIndex((f) => f.id === item.id);
|
|
21877
|
+
acc.push({ kind: "item", item, globalIdx });
|
|
21878
|
+
}
|
|
21879
|
+
}
|
|
21880
|
+
return acc;
|
|
21881
|
+
}, [displayedGroups, flatItems]);
|
|
21882
|
+
const virtualizer = useVirtualizer({
|
|
21883
|
+
count: rows.length,
|
|
21884
|
+
getScrollElement: () => listRef.current,
|
|
21885
|
+
estimateSize: (i) => rows[i].kind === "label" ? LABEL_HEIGHT : ITEM_HEIGHT2,
|
|
21886
|
+
overscan: 8
|
|
21887
|
+
});
|
|
21888
|
+
const virtualItems = virtualizer.getVirtualItems();
|
|
21889
|
+
const totalSize = virtualizer.getTotalSize();
|
|
21890
|
+
if (isEmpty) {
|
|
21891
|
+
return /* @__PURE__ */ jsx(
|
|
21892
|
+
"div",
|
|
21893
|
+
{
|
|
21894
|
+
ref: listRef,
|
|
21895
|
+
className: "overflow-y-auto overscroll-contain px-2 py-1",
|
|
21896
|
+
style: { maxHeight: `min(${LIST_MAX_HEIGHT}px, 60vh)` },
|
|
21897
|
+
children: /* @__PURE__ */ jsx(EmptyState, { message: emptyMessage })
|
|
21898
|
+
}
|
|
21899
|
+
);
|
|
21900
|
+
}
|
|
21901
|
+
return /* @__PURE__ */ jsx(
|
|
21902
|
+
"div",
|
|
21903
|
+
{
|
|
21904
|
+
ref: listRef,
|
|
21905
|
+
className: "overflow-y-auto overscroll-contain px-2 py-1 [&::-webkit-scrollbar]:w-1.5 [&::-webkit-scrollbar-track]:bg-transparent [&::-webkit-scrollbar-thumb]:bg-muted-foreground/30 [&::-webkit-scrollbar-thumb]:rounded-full hover:[&::-webkit-scrollbar-thumb]:bg-muted-foreground/50 transition-colors",
|
|
21906
|
+
style: { maxHeight: `min(${LIST_MAX_HEIGHT}px, 60vh)` },
|
|
21907
|
+
children: /* @__PURE__ */ jsx("div", { style: { height: totalSize, position: "relative" }, children: virtualItems.map((vItem) => {
|
|
21908
|
+
const row = rows[vItem.index];
|
|
21909
|
+
return /* @__PURE__ */ jsx(
|
|
21910
|
+
"div",
|
|
21911
|
+
{
|
|
21912
|
+
"data-index": vItem.index,
|
|
21913
|
+
ref: virtualizer.measureElement,
|
|
21914
|
+
style: {
|
|
21915
|
+
position: "absolute",
|
|
21916
|
+
top: vItem.start,
|
|
21917
|
+
left: 0,
|
|
21918
|
+
right: 0
|
|
21919
|
+
},
|
|
21920
|
+
children: row.kind === "label" ? /* @__PURE__ */ jsx(GroupLabel, { group: row.group }) : /* @__PURE__ */ jsx("div", { "data-active": row.globalIdx === activeIndex, children: /* @__PURE__ */ jsx(
|
|
21921
|
+
CommandItemRow,
|
|
21922
|
+
{
|
|
21923
|
+
item: row.item,
|
|
21924
|
+
isActive: row.globalIdx === activeIndex,
|
|
21925
|
+
onHover: () => onHover(row.globalIdx),
|
|
21926
|
+
onSelect: () => onSelect(row.item)
|
|
21927
|
+
}
|
|
21928
|
+
) })
|
|
21929
|
+
},
|
|
21930
|
+
vItem.key
|
|
21931
|
+
);
|
|
21932
|
+
}) })
|
|
21933
|
+
}
|
|
21934
|
+
);
|
|
21935
|
+
}
|
|
21936
|
+
);
|
|
21937
|
+
VirtualResultList.displayName = "VirtualResultList";
|
|
21938
|
+
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: [
|
|
21939
|
+
footer ?? /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-4 text-[11px] text-muted-foreground", children: [
|
|
21940
|
+
/* @__PURE__ */ jsxs("span", { className: "flex items-center gap-1.5", children: [
|
|
21941
|
+
/* @__PURE__ */ jsx(ArrowElbowDownRightIcon, { className: "w-3 h-3" }),
|
|
21942
|
+
"Selecionar"
|
|
21943
|
+
] }),
|
|
21944
|
+
/* @__PURE__ */ jsxs("span", { className: "flex items-center gap-1.5", children: [
|
|
21945
|
+
/* @__PURE__ */ jsx("span", { className: "font-mono", children: "\u2191\u2193" }),
|
|
21946
|
+
"Navegar"
|
|
21947
|
+
] }),
|
|
21948
|
+
/* @__PURE__ */ jsxs("span", { className: "flex items-center gap-1.5", children: [
|
|
21949
|
+
/* @__PURE__ */ jsx(ArrowBendUpLeftIcon, { className: "w-3 h-3" }),
|
|
21950
|
+
"Fechar"
|
|
21951
|
+
] })
|
|
21952
|
+
] }),
|
|
21953
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1.5 text-[11px] text-muted-foreground", children: [
|
|
21954
|
+
/* @__PURE__ */ jsx(CommandIcon, { className: "w-3 h-3" }),
|
|
21955
|
+
/* @__PURE__ */ jsxs("span", { children: [
|
|
21956
|
+
totalItems,
|
|
21957
|
+
" resultado",
|
|
21958
|
+
totalItems !== 1 ? "s" : ""
|
|
21959
|
+
] })
|
|
21960
|
+
] })
|
|
21961
|
+
] }));
|
|
21962
|
+
FooterBar.displayName = "FooterBar";
|
|
21963
|
+
function CommandPalette(props) {
|
|
21964
|
+
const {
|
|
21965
|
+
placeholder = "Buscar comandos\u2026",
|
|
21966
|
+
open,
|
|
21967
|
+
onOpenChange,
|
|
21968
|
+
footer,
|
|
21969
|
+
debounceDelay = 300,
|
|
21970
|
+
multiSearch = false,
|
|
21971
|
+
emptyMessage = "Nenhum resultado encontrado.",
|
|
21972
|
+
shortcut = { key: "k", ctrl: true }
|
|
21973
|
+
} = props;
|
|
21974
|
+
const inputRef = useRef(null);
|
|
21975
|
+
const listRef = useRef(null);
|
|
21976
|
+
const isMobile = useIsMobile();
|
|
21977
|
+
const {
|
|
21978
|
+
query,
|
|
21979
|
+
setQuery,
|
|
21980
|
+
activeIndex,
|
|
21981
|
+
setActiveIndex,
|
|
21982
|
+
searchTerms,
|
|
21983
|
+
displayedGroups,
|
|
21984
|
+
flatItems,
|
|
21985
|
+
totalItems,
|
|
21986
|
+
handleSelect,
|
|
21987
|
+
isEmpty,
|
|
21988
|
+
showList
|
|
21989
|
+
} = useCommandPalette({
|
|
21990
|
+
...props,
|
|
21991
|
+
open: isMobile ? true : props.open
|
|
21992
|
+
});
|
|
21993
|
+
useKeyboardShortcut(shortcut.key, () => onOpenChange(!open), {
|
|
21994
|
+
ctrl: shortcut.ctrl,
|
|
21995
|
+
meta: shortcut.meta,
|
|
21996
|
+
shift: shortcut.shift,
|
|
21997
|
+
alt: shortcut.alt
|
|
21998
|
+
});
|
|
21999
|
+
useEffect(() => {
|
|
22000
|
+
if (!open) return;
|
|
22001
|
+
const handleEscape = (e) => {
|
|
22002
|
+
if (e.key === "Escape") onOpenChange(false);
|
|
22003
|
+
};
|
|
22004
|
+
document.addEventListener("keydown", handleEscape);
|
|
22005
|
+
return () => document.removeEventListener("keydown", handleEscape);
|
|
22006
|
+
}, [open, onOpenChange]);
|
|
22007
|
+
useEffect(() => {
|
|
22008
|
+
if (!open) return;
|
|
22009
|
+
const timer = setTimeout(() => inputRef.current?.focus(), 50);
|
|
22010
|
+
return () => clearTimeout(timer);
|
|
22011
|
+
}, [open]);
|
|
22012
|
+
useEffect(() => {
|
|
22013
|
+
const el = listRef.current?.querySelector(
|
|
22014
|
+
`[data-active="true"]`
|
|
22015
|
+
);
|
|
22016
|
+
el?.scrollIntoView({ block: "nearest" });
|
|
22017
|
+
}, [activeIndex]);
|
|
22018
|
+
const handleQueryChange = useCallback(
|
|
22019
|
+
(val) => {
|
|
22020
|
+
setQuery(val);
|
|
22021
|
+
setActiveIndex(0);
|
|
22022
|
+
},
|
|
22023
|
+
[setQuery, setActiveIndex]
|
|
22024
|
+
);
|
|
22025
|
+
const handleQueryChangeMobile = useCallback(
|
|
22026
|
+
(val) => {
|
|
22027
|
+
setQuery(val);
|
|
22028
|
+
setActiveIndex(0);
|
|
22029
|
+
if (!open && val.trim() !== "") onOpenChange(true);
|
|
22030
|
+
},
|
|
22031
|
+
[setQuery, setActiveIndex, open, onOpenChange]
|
|
22032
|
+
);
|
|
22033
|
+
const handleClose = useCallback(() => onOpenChange(false), [onOpenChange]);
|
|
22034
|
+
const handleClearQuery = useCallback(() => setQuery(""), [setQuery]);
|
|
22035
|
+
const searchPlaceholder = multiSearch ? "Buscar\u2026 (separe termos por v\xEDrgula)" : placeholder;
|
|
22036
|
+
const sharedListProps = {
|
|
22037
|
+
listRef,
|
|
22038
|
+
isEmpty,
|
|
22039
|
+
emptyMessage,
|
|
22040
|
+
displayedGroups,
|
|
22041
|
+
flatItems,
|
|
22042
|
+
activeIndex,
|
|
22043
|
+
onHover: setActiveIndex,
|
|
22044
|
+
onSelect: handleSelect
|
|
22045
|
+
};
|
|
22046
|
+
if (isMobile) {
|
|
22047
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
22048
|
+
/* @__PURE__ */ jsx("div", { className: "fixed top-0 left-0 right-0 z-[100] px-3 py-2 bg-background", children: /* @__PURE__ */ jsx(
|
|
22049
|
+
DebouncedInput,
|
|
22050
|
+
{
|
|
22051
|
+
ref: inputRef,
|
|
22052
|
+
value: query,
|
|
22053
|
+
debounce: debounceDelay,
|
|
22054
|
+
onChange: handleQueryChangeMobile,
|
|
22055
|
+
placeholder: searchPlaceholder
|
|
22056
|
+
}
|
|
22057
|
+
) }),
|
|
22058
|
+
/* @__PURE__ */ jsx(AnimatePresence, { children: showList && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
22059
|
+
/* @__PURE__ */ jsx(
|
|
22060
|
+
motion.div,
|
|
22061
|
+
{
|
|
22062
|
+
initial: { opacity: 0 },
|
|
22063
|
+
animate: { opacity: 1 },
|
|
22064
|
+
exit: { opacity: 0 },
|
|
22065
|
+
transition: ANIMATION.overlay,
|
|
22066
|
+
className: "fixed inset-0 z-[98] bg-background/60 backdrop-blur-[2px]",
|
|
22067
|
+
onClick: handleClose
|
|
22068
|
+
}
|
|
22069
|
+
),
|
|
22070
|
+
/* @__PURE__ */ jsxs(
|
|
22071
|
+
motion.div,
|
|
22072
|
+
{
|
|
22073
|
+
initial: { opacity: 0, y: -6 },
|
|
22074
|
+
animate: { opacity: 1, y: 0 },
|
|
22075
|
+
exit: { opacity: 0, y: -6 },
|
|
22076
|
+
transition: ANIMATION.mobilePanel,
|
|
22077
|
+
className: "fixed left-3 right-3 z-[99] bg-popover border border-border rounded-lg shadow-2xl shadow-black/20 dark:shadow-black/50 overflow-hidden top-14",
|
|
22078
|
+
children: [
|
|
22079
|
+
/* @__PURE__ */ jsx(SearchBadges, { terms: searchTerms }),
|
|
22080
|
+
/* @__PURE__ */ jsx(VirtualResultList, { ...sharedListProps })
|
|
22081
|
+
]
|
|
22082
|
+
}
|
|
22083
|
+
)
|
|
22084
|
+
] }) })
|
|
22085
|
+
] });
|
|
22086
|
+
}
|
|
22087
|
+
return /* @__PURE__ */ jsx(AnimatePresence, { children: open && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
22088
|
+
/* @__PURE__ */ jsx(
|
|
22089
|
+
motion.div,
|
|
22090
|
+
{
|
|
22091
|
+
initial: { opacity: 0 },
|
|
22092
|
+
animate: { opacity: 1 },
|
|
22093
|
+
exit: { opacity: 0 },
|
|
22094
|
+
transition: ANIMATION.overlay,
|
|
22095
|
+
className: "fixed inset-0 z-[100] bg-background/80 backdrop-blur-sm",
|
|
22096
|
+
onClick: handleClose
|
|
22097
|
+
}
|
|
22098
|
+
),
|
|
22099
|
+
/* @__PURE__ */ jsxs(
|
|
22100
|
+
motion.div,
|
|
22101
|
+
{
|
|
22102
|
+
initial: { opacity: 0, scale: 0.96, y: -8 },
|
|
22103
|
+
animate: { opacity: 1, scale: 1, y: 0 },
|
|
22104
|
+
exit: { opacity: 0, scale: 0.96, y: -8 },
|
|
22105
|
+
transition: ANIMATION.panel,
|
|
22106
|
+
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",
|
|
22107
|
+
style: { maxHeight: "min(600px, 80vh)" },
|
|
22108
|
+
children: [
|
|
22109
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3 px-4 py-2 border-b border-border", children: [
|
|
22110
|
+
/* @__PURE__ */ jsx(
|
|
22111
|
+
MagnifyingGlassIcon,
|
|
22112
|
+
{
|
|
22113
|
+
className: "w-4 h-4 text-muted-foreground flex-shrink-0",
|
|
22114
|
+
weight: "bold"
|
|
22115
|
+
}
|
|
22116
|
+
),
|
|
22117
|
+
/* @__PURE__ */ jsx(
|
|
22118
|
+
DebouncedInput,
|
|
22119
|
+
{
|
|
22120
|
+
ref: inputRef,
|
|
22121
|
+
value: query,
|
|
22122
|
+
debounce: debounceDelay,
|
|
22123
|
+
onChange: handleQueryChange,
|
|
22124
|
+
placeholder: searchPlaceholder,
|
|
22125
|
+
rightIcon: query ? /* @__PURE__ */ jsx(
|
|
22126
|
+
ButtonBase,
|
|
22127
|
+
{
|
|
22128
|
+
variant: "ghost",
|
|
22129
|
+
size: "icon",
|
|
22130
|
+
onClick: handleClearQuery,
|
|
22131
|
+
className: "text-muted-foreground hover:text-red-500 hover:bg-transparent transition-colors",
|
|
22132
|
+
children: /* @__PURE__ */ jsx(XIcon, { className: "w-4 h-4" })
|
|
22133
|
+
}
|
|
22134
|
+
) : void 0,
|
|
22135
|
+
className: "flex-1 bg-transparent border-none focus-visible:ring-0 outline-none shadow-none px-0 h-7 text-sm caret-primary"
|
|
22136
|
+
}
|
|
22137
|
+
)
|
|
22138
|
+
] }),
|
|
22139
|
+
/* @__PURE__ */ jsx(SearchBadges, { terms: searchTerms }),
|
|
22140
|
+
showList && /* @__PURE__ */ jsx(VirtualResultList, { ...sharedListProps }),
|
|
22141
|
+
/* @__PURE__ */ jsx(FooterBar, { footer, totalItems })
|
|
22142
|
+
]
|
|
22143
|
+
}
|
|
22144
|
+
)
|
|
22145
|
+
] }) });
|
|
22146
|
+
}
|
|
21478
22147
|
|
|
21479
|
-
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, CommandListBase, 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, 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, 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, createValueFormatter, createYTickFormatter, detectDataFields, detectXAxis, display12HourValue, 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, normalizeAttendDate, processIntegrationData, processNeo4jData, renderInsideBarLabel, pillLabelRenderer_default as renderPillLabel, resolveChartMargins, resolveContainerPaddingLeft, set12Hours, setDateByType, setHours, setMinutes, setSeconds, sortEvents, sortEventsAgenda, startOfLocalDay, toast, useBiaxial, useCalendarDnd, useCalendarDndAgenda, useChartClick, useChartDimensions, useChartHighlights, useChartLayout, useChartMinMax, useChartTooltips, useCurrentTimeIndicator, useCurrentTimeIndicatorAgenda, useDrag, useEventVisibility, useEventVisibilityAgenda, useIsMobile, useIsTruncated, useOpenTooltipForPeriod, useProcessedData, useSeriesOpacity, useTheme, useTimeSeriesRange, visualForItem };
|
|
22148
|
+
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 };
|