@optilogic/core 1.0.0-beta.7 → 1.0.0-beta.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +734 -289
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +109 -5
- package/dist/index.d.ts +109 -5
- package/dist/index.js +683 -239
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/data-table.tsx +735 -0
- package/src/index.ts +7 -0
package/dist/index.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { clsx } from 'clsx';
|
|
2
2
|
import { twMerge } from 'tailwind-merge';
|
|
3
|
-
import * as
|
|
3
|
+
import * as React20 from 'react';
|
|
4
4
|
import { useMemo, useState, useRef, useEffect, useCallback } from 'react';
|
|
5
5
|
import { Slot } from '@radix-ui/react-slot';
|
|
6
6
|
import { cva } from 'class-variance-authority';
|
|
7
7
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
8
8
|
import * as LabelPrimitive from '@radix-ui/react-label';
|
|
9
9
|
import * as CheckboxPrimitive from '@radix-ui/react-checkbox';
|
|
10
|
-
import { Check, ChevronDown, ChevronUp, ChevronRight, Circle,
|
|
10
|
+
import { Check, ChevronDown, ChevronUp, ChevronRight, Circle, Search, ArrowUp, ArrowDown, ArrowUpDown, ChevronsLeft, ChevronLeft, ChevronsRight, X, Calendar as Calendar$1, Filter, GripVertical, Copy, Palette } from 'lucide-react';
|
|
11
11
|
import * as SwitchPrimitive from '@radix-ui/react-switch';
|
|
12
12
|
import * as ProgressPrimitive from '@radix-ui/react-progress';
|
|
13
13
|
import * as SeparatorPrimitive from '@radix-ui/react-separator';
|
|
@@ -53,7 +53,7 @@ var buttonVariants = cva(
|
|
|
53
53
|
}
|
|
54
54
|
}
|
|
55
55
|
);
|
|
56
|
-
var Button =
|
|
56
|
+
var Button = React20.forwardRef(
|
|
57
57
|
({ className, variant, size, asChild = false, ...props }, ref) => {
|
|
58
58
|
const Comp = asChild ? Slot : "button";
|
|
59
59
|
return /* @__PURE__ */ jsx(
|
|
@@ -67,7 +67,7 @@ var Button = React34.forwardRef(
|
|
|
67
67
|
}
|
|
68
68
|
);
|
|
69
69
|
Button.displayName = "Button";
|
|
70
|
-
var Input =
|
|
70
|
+
var Input = React20.forwardRef(
|
|
71
71
|
({ className, type, ...props }, ref) => {
|
|
72
72
|
return /* @__PURE__ */ jsx(
|
|
73
73
|
"input",
|
|
@@ -87,7 +87,7 @@ Input.displayName = "Input";
|
|
|
87
87
|
var labelVariants = cva(
|
|
88
88
|
"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
|
|
89
89
|
);
|
|
90
|
-
var Label =
|
|
90
|
+
var Label = React20.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
91
91
|
LabelPrimitive.Root,
|
|
92
92
|
{
|
|
93
93
|
ref,
|
|
@@ -96,7 +96,7 @@ var Label = React34.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */
|
|
|
96
96
|
}
|
|
97
97
|
));
|
|
98
98
|
Label.displayName = LabelPrimitive.Root.displayName;
|
|
99
|
-
var Textarea =
|
|
99
|
+
var Textarea = React20.forwardRef(
|
|
100
100
|
({ className, ...props }, ref) => {
|
|
101
101
|
return /* @__PURE__ */ jsx(
|
|
102
102
|
"textarea",
|
|
@@ -135,7 +135,7 @@ var badgeVariants = cva(
|
|
|
135
135
|
function Badge({ className, variant, ...props }) {
|
|
136
136
|
return /* @__PURE__ */ jsx("div", { className: cn(badgeVariants({ variant }), className), ...props });
|
|
137
137
|
}
|
|
138
|
-
var Checkbox =
|
|
138
|
+
var Checkbox = React20.forwardRef(({ className, showBorder = true, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
139
139
|
CheckboxPrimitive.Root,
|
|
140
140
|
{
|
|
141
141
|
ref,
|
|
@@ -179,7 +179,7 @@ var Checkbox = React34.forwardRef(({ className, showBorder = true, ...props }, r
|
|
|
179
179
|
}
|
|
180
180
|
));
|
|
181
181
|
Checkbox.displayName = CheckboxPrimitive.Root.displayName;
|
|
182
|
-
var Switch =
|
|
182
|
+
var Switch = React20.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
183
183
|
SwitchPrimitive.Root,
|
|
184
184
|
{
|
|
185
185
|
className: cn(
|
|
@@ -215,7 +215,7 @@ var Switch = React34.forwardRef(({ className, ...props }, ref) => /* @__PURE__ *
|
|
|
215
215
|
}
|
|
216
216
|
));
|
|
217
217
|
Switch.displayName = SwitchPrimitive.Root.displayName;
|
|
218
|
-
var Progress =
|
|
218
|
+
var Progress = React20.forwardRef(({ className, value, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
219
219
|
ProgressPrimitive.Root,
|
|
220
220
|
{
|
|
221
221
|
ref,
|
|
@@ -234,7 +234,7 @@ var Progress = React34.forwardRef(({ className, value, ...props }, ref) => /* @_
|
|
|
234
234
|
}
|
|
235
235
|
));
|
|
236
236
|
Progress.displayName = ProgressPrimitive.Root.displayName;
|
|
237
|
-
var Separator =
|
|
237
|
+
var Separator = React20.forwardRef(
|
|
238
238
|
({ className, orientation = "horizontal", decorative = true, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
239
239
|
SeparatorPrimitive.Root,
|
|
240
240
|
{
|
|
@@ -263,7 +263,7 @@ function Skeleton({ className, ...props }) {
|
|
|
263
263
|
var Select = SelectPrimitive.Root;
|
|
264
264
|
var SelectGroup = SelectPrimitive.Group;
|
|
265
265
|
var SelectValue = SelectPrimitive.Value;
|
|
266
|
-
var SelectTrigger =
|
|
266
|
+
var SelectTrigger = React20.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs(
|
|
267
267
|
SelectPrimitive.Trigger,
|
|
268
268
|
{
|
|
269
269
|
ref,
|
|
@@ -279,7 +279,7 @@ var SelectTrigger = React34.forwardRef(({ className, children, ...props }, ref)
|
|
|
279
279
|
}
|
|
280
280
|
));
|
|
281
281
|
SelectTrigger.displayName = SelectPrimitive.Trigger.displayName;
|
|
282
|
-
var SelectScrollUpButton =
|
|
282
|
+
var SelectScrollUpButton = React20.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
283
283
|
SelectPrimitive.ScrollUpButton,
|
|
284
284
|
{
|
|
285
285
|
ref,
|
|
@@ -292,7 +292,7 @@ var SelectScrollUpButton = React34.forwardRef(({ className, ...props }, ref) =>
|
|
|
292
292
|
}
|
|
293
293
|
));
|
|
294
294
|
SelectScrollUpButton.displayName = SelectPrimitive.ScrollUpButton.displayName;
|
|
295
|
-
var SelectScrollDownButton =
|
|
295
|
+
var SelectScrollDownButton = React20.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
296
296
|
SelectPrimitive.ScrollDownButton,
|
|
297
297
|
{
|
|
298
298
|
ref,
|
|
@@ -305,7 +305,7 @@ var SelectScrollDownButton = React34.forwardRef(({ className, ...props }, ref) =
|
|
|
305
305
|
}
|
|
306
306
|
));
|
|
307
307
|
SelectScrollDownButton.displayName = SelectPrimitive.ScrollDownButton.displayName;
|
|
308
|
-
var SelectContent =
|
|
308
|
+
var SelectContent = React20.forwardRef(({ className, children, position = "popper", ...props }, ref) => /* @__PURE__ */ jsx(SelectPrimitive.Portal, { children: /* @__PURE__ */ jsxs(
|
|
309
309
|
SelectPrimitive.Content,
|
|
310
310
|
{
|
|
311
311
|
ref,
|
|
@@ -333,7 +333,7 @@ var SelectContent = React34.forwardRef(({ className, children, position = "poppe
|
|
|
333
333
|
}
|
|
334
334
|
) }));
|
|
335
335
|
SelectContent.displayName = SelectPrimitive.Content.displayName;
|
|
336
|
-
var SelectLabel =
|
|
336
|
+
var SelectLabel = React20.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
337
337
|
SelectPrimitive.Label,
|
|
338
338
|
{
|
|
339
339
|
ref,
|
|
@@ -342,7 +342,7 @@ var SelectLabel = React34.forwardRef(({ className, ...props }, ref) => /* @__PUR
|
|
|
342
342
|
}
|
|
343
343
|
));
|
|
344
344
|
SelectLabel.displayName = SelectPrimitive.Label.displayName;
|
|
345
|
-
var SelectItem =
|
|
345
|
+
var SelectItem = React20.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs(
|
|
346
346
|
SelectPrimitive.Item,
|
|
347
347
|
{
|
|
348
348
|
ref,
|
|
@@ -358,7 +358,7 @@ var SelectItem = React34.forwardRef(({ className, children, ...props }, ref) =>
|
|
|
358
358
|
}
|
|
359
359
|
));
|
|
360
360
|
SelectItem.displayName = SelectPrimitive.Item.displayName;
|
|
361
|
-
var SelectSeparator =
|
|
361
|
+
var SelectSeparator = React20.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
362
362
|
SelectPrimitive.Separator,
|
|
363
363
|
{
|
|
364
364
|
ref,
|
|
@@ -368,7 +368,7 @@ var SelectSeparator = React34.forwardRef(({ className, ...props }, ref) => /* @_
|
|
|
368
368
|
));
|
|
369
369
|
SelectSeparator.displayName = SelectPrimitive.Separator.displayName;
|
|
370
370
|
var Tabs = TabsPrimitive.Root;
|
|
371
|
-
var TabsList =
|
|
371
|
+
var TabsList = React20.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
372
372
|
TabsPrimitive.List,
|
|
373
373
|
{
|
|
374
374
|
ref,
|
|
@@ -382,7 +382,7 @@ var TabsList = React34.forwardRef(({ className, ...props }, ref) => /* @__PURE__
|
|
|
382
382
|
}
|
|
383
383
|
));
|
|
384
384
|
TabsList.displayName = TabsPrimitive.List.displayName;
|
|
385
|
-
var TabsTrigger =
|
|
385
|
+
var TabsTrigger = React20.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
386
386
|
TabsPrimitive.Trigger,
|
|
387
387
|
{
|
|
388
388
|
ref,
|
|
@@ -409,7 +409,7 @@ var TabsTrigger = React34.forwardRef(({ className, ...props }, ref) => /* @__PUR
|
|
|
409
409
|
}
|
|
410
410
|
));
|
|
411
411
|
TabsTrigger.displayName = TabsPrimitive.Trigger.displayName;
|
|
412
|
-
var TabsContent =
|
|
412
|
+
var TabsContent = React20.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
413
413
|
TabsPrimitive.Content,
|
|
414
414
|
{
|
|
415
415
|
ref,
|
|
@@ -492,7 +492,7 @@ var accordionContentInnerVariants = cva("pb-4 pt-0", {
|
|
|
492
492
|
}
|
|
493
493
|
});
|
|
494
494
|
var Accordion = AccordionPrimitive.Root;
|
|
495
|
-
var AccordionItem =
|
|
495
|
+
var AccordionItem = React20.forwardRef(({ className, variant, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
496
496
|
AccordionPrimitive.Item,
|
|
497
497
|
{
|
|
498
498
|
ref,
|
|
@@ -502,7 +502,7 @@ var AccordionItem = React34.forwardRef(({ className, variant, ...props }, ref) =
|
|
|
502
502
|
}
|
|
503
503
|
));
|
|
504
504
|
AccordionItem.displayName = "AccordionItem";
|
|
505
|
-
var AccordionTrigger =
|
|
505
|
+
var AccordionTrigger = React20.forwardRef(({ className, children, variant, ...props }, ref) => /* @__PURE__ */ jsx(AccordionPrimitive.Header, { className: "flex", children: /* @__PURE__ */ jsxs(
|
|
506
506
|
AccordionPrimitive.Trigger,
|
|
507
507
|
{
|
|
508
508
|
ref,
|
|
@@ -515,7 +515,7 @@ var AccordionTrigger = React34.forwardRef(({ className, children, variant, ...pr
|
|
|
515
515
|
}
|
|
516
516
|
) }));
|
|
517
517
|
AccordionTrigger.displayName = AccordionPrimitive.Trigger.displayName;
|
|
518
|
-
var AccordionContent =
|
|
518
|
+
var AccordionContent = React20.forwardRef(({ className, children, variant, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
519
519
|
AccordionPrimitive.Content,
|
|
520
520
|
{
|
|
521
521
|
ref,
|
|
@@ -529,7 +529,7 @@ var TooltipProvider = TooltipPrimitive.Provider;
|
|
|
529
529
|
var TooltipRoot = TooltipPrimitive.Root;
|
|
530
530
|
var TooltipTrigger = TooltipPrimitive.Trigger;
|
|
531
531
|
var TooltipPortal = TooltipPrimitive.Portal;
|
|
532
|
-
var TooltipContent =
|
|
532
|
+
var TooltipContent = React20.forwardRef(({ className, sideOffset = 6, ...props }, ref) => /* @__PURE__ */ jsx(TooltipPrimitive.Portal, { children: /* @__PURE__ */ jsx(
|
|
533
533
|
TooltipPrimitive.Content,
|
|
534
534
|
{
|
|
535
535
|
ref,
|
|
@@ -558,7 +558,7 @@ var TooltipContent = React34.forwardRef(({ className, sideOffset = 6, ...props }
|
|
|
558
558
|
}
|
|
559
559
|
) }));
|
|
560
560
|
TooltipContent.displayName = TooltipPrimitive.Content.displayName;
|
|
561
|
-
var TooltipArrow =
|
|
561
|
+
var TooltipArrow = React20.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
562
562
|
TooltipPrimitive.Arrow,
|
|
563
563
|
{
|
|
564
564
|
ref,
|
|
@@ -597,7 +597,7 @@ function Tooltip({
|
|
|
597
597
|
var Popover = PopoverPrimitive.Root;
|
|
598
598
|
var PopoverTrigger = PopoverPrimitive.Trigger;
|
|
599
599
|
var PopoverAnchor = PopoverPrimitive.Anchor;
|
|
600
|
-
var PopoverContent =
|
|
600
|
+
var PopoverContent = React20.forwardRef(({ className, align = "center", sideOffset = 4, ...props }, ref) => /* @__PURE__ */ jsx(PopoverPrimitive.Portal, { children: /* @__PURE__ */ jsx(
|
|
601
601
|
PopoverPrimitive.Content,
|
|
602
602
|
{
|
|
603
603
|
ref,
|
|
@@ -623,7 +623,7 @@ var DropdownMenuGroup = DropdownMenuPrimitive.Group;
|
|
|
623
623
|
var DropdownMenuPortal = DropdownMenuPrimitive.Portal;
|
|
624
624
|
var DropdownMenuSub = DropdownMenuPrimitive.Sub;
|
|
625
625
|
var DropdownMenuRadioGroup = DropdownMenuPrimitive.RadioGroup;
|
|
626
|
-
var DropdownMenuSubTrigger =
|
|
626
|
+
var DropdownMenuSubTrigger = React20.forwardRef(({ className, inset, children, ...props }, ref) => /* @__PURE__ */ jsxs(
|
|
627
627
|
DropdownMenuPrimitive.SubTrigger,
|
|
628
628
|
{
|
|
629
629
|
ref,
|
|
@@ -642,7 +642,7 @@ var DropdownMenuSubTrigger = React34.forwardRef(({ className, inset, children, .
|
|
|
642
642
|
}
|
|
643
643
|
));
|
|
644
644
|
DropdownMenuSubTrigger.displayName = DropdownMenuPrimitive.SubTrigger.displayName;
|
|
645
|
-
var DropdownMenuSubContent =
|
|
645
|
+
var DropdownMenuSubContent = React20.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
646
646
|
DropdownMenuPrimitive.SubContent,
|
|
647
647
|
{
|
|
648
648
|
ref,
|
|
@@ -659,7 +659,7 @@ var DropdownMenuSubContent = React34.forwardRef(({ className, ...props }, ref) =
|
|
|
659
659
|
}
|
|
660
660
|
));
|
|
661
661
|
DropdownMenuSubContent.displayName = DropdownMenuPrimitive.SubContent.displayName;
|
|
662
|
-
var DropdownMenuContent =
|
|
662
|
+
var DropdownMenuContent = React20.forwardRef(({ className, sideOffset = 4, ...props }, ref) => /* @__PURE__ */ jsx(DropdownMenuPrimitive.Portal, { children: /* @__PURE__ */ jsx(
|
|
663
663
|
DropdownMenuPrimitive.Content,
|
|
664
664
|
{
|
|
665
665
|
ref,
|
|
@@ -677,7 +677,7 @@ var DropdownMenuContent = React34.forwardRef(({ className, sideOffset = 4, ...pr
|
|
|
677
677
|
}
|
|
678
678
|
) }));
|
|
679
679
|
DropdownMenuContent.displayName = DropdownMenuPrimitive.Content.displayName;
|
|
680
|
-
var DropdownMenuItem =
|
|
680
|
+
var DropdownMenuItem = React20.forwardRef(({ className, inset, destructive, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
681
681
|
DropdownMenuPrimitive.Item,
|
|
682
682
|
{
|
|
683
683
|
ref,
|
|
@@ -693,7 +693,7 @@ var DropdownMenuItem = React34.forwardRef(({ className, inset, destructive, ...p
|
|
|
693
693
|
}
|
|
694
694
|
));
|
|
695
695
|
DropdownMenuItem.displayName = DropdownMenuPrimitive.Item.displayName;
|
|
696
|
-
var DropdownMenuCheckboxItem =
|
|
696
|
+
var DropdownMenuCheckboxItem = React20.forwardRef(({ className, children, checked, ...props }, ref) => /* @__PURE__ */ jsxs(
|
|
697
697
|
DropdownMenuPrimitive.CheckboxItem,
|
|
698
698
|
{
|
|
699
699
|
ref,
|
|
@@ -712,7 +712,7 @@ var DropdownMenuCheckboxItem = React34.forwardRef(({ className, children, checke
|
|
|
712
712
|
}
|
|
713
713
|
));
|
|
714
714
|
DropdownMenuCheckboxItem.displayName = DropdownMenuPrimitive.CheckboxItem.displayName;
|
|
715
|
-
var DropdownMenuRadioItem =
|
|
715
|
+
var DropdownMenuRadioItem = React20.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs(
|
|
716
716
|
DropdownMenuPrimitive.RadioItem,
|
|
717
717
|
{
|
|
718
718
|
ref,
|
|
@@ -730,7 +730,7 @@ var DropdownMenuRadioItem = React34.forwardRef(({ className, children, ...props
|
|
|
730
730
|
}
|
|
731
731
|
));
|
|
732
732
|
DropdownMenuRadioItem.displayName = DropdownMenuPrimitive.RadioItem.displayName;
|
|
733
|
-
var DropdownMenuLabel =
|
|
733
|
+
var DropdownMenuLabel = React20.forwardRef(({ className, inset, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
734
734
|
DropdownMenuPrimitive.Label,
|
|
735
735
|
{
|
|
736
736
|
ref,
|
|
@@ -743,7 +743,7 @@ var DropdownMenuLabel = React34.forwardRef(({ className, inset, ...props }, ref)
|
|
|
743
743
|
}
|
|
744
744
|
));
|
|
745
745
|
DropdownMenuLabel.displayName = DropdownMenuPrimitive.Label.displayName;
|
|
746
|
-
var DropdownMenuSeparator =
|
|
746
|
+
var DropdownMenuSeparator = React20.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
747
747
|
DropdownMenuPrimitive.Separator,
|
|
748
748
|
{
|
|
749
749
|
ref,
|
|
@@ -768,7 +768,7 @@ DropdownMenuShortcut.displayName = "DropdownMenuShortcut";
|
|
|
768
768
|
var AlertDialog = AlertDialogPrimitive.Root;
|
|
769
769
|
var AlertDialogTrigger = AlertDialogPrimitive.Trigger;
|
|
770
770
|
var AlertDialogPortal = AlertDialogPrimitive.Portal;
|
|
771
|
-
var AlertDialogOverlay =
|
|
771
|
+
var AlertDialogOverlay = React20.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
772
772
|
AlertDialogPrimitive.Overlay,
|
|
773
773
|
{
|
|
774
774
|
className: cn(
|
|
@@ -782,7 +782,7 @@ var AlertDialogOverlay = React34.forwardRef(({ className, ...props }, ref) => /*
|
|
|
782
782
|
}
|
|
783
783
|
));
|
|
784
784
|
AlertDialogOverlay.displayName = AlertDialogPrimitive.Overlay.displayName;
|
|
785
|
-
var AlertDialogContent =
|
|
785
|
+
var AlertDialogContent = React20.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxs(AlertDialogPortal, { children: [
|
|
786
786
|
/* @__PURE__ */ jsx(AlertDialogOverlay, {}),
|
|
787
787
|
/* @__PURE__ */ jsx(
|
|
788
788
|
AlertDialogPrimitive.Content,
|
|
@@ -825,7 +825,7 @@ var AlertDialogFooter = ({ className, ...props }) => /* @__PURE__ */ jsx(
|
|
|
825
825
|
}
|
|
826
826
|
);
|
|
827
827
|
AlertDialogFooter.displayName = "AlertDialogFooter";
|
|
828
|
-
var AlertDialogTitle =
|
|
828
|
+
var AlertDialogTitle = React20.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
829
829
|
AlertDialogPrimitive.Title,
|
|
830
830
|
{
|
|
831
831
|
ref,
|
|
@@ -834,7 +834,7 @@ var AlertDialogTitle = React34.forwardRef(({ className, ...props }, ref) => /* @
|
|
|
834
834
|
}
|
|
835
835
|
));
|
|
836
836
|
AlertDialogTitle.displayName = AlertDialogPrimitive.Title.displayName;
|
|
837
|
-
var AlertDialogDescription =
|
|
837
|
+
var AlertDialogDescription = React20.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
838
838
|
AlertDialogPrimitive.Description,
|
|
839
839
|
{
|
|
840
840
|
ref,
|
|
@@ -843,7 +843,7 @@ var AlertDialogDescription = React34.forwardRef(({ className, ...props }, ref) =
|
|
|
843
843
|
}
|
|
844
844
|
));
|
|
845
845
|
AlertDialogDescription.displayName = AlertDialogPrimitive.Description.displayName;
|
|
846
|
-
var AlertDialogAction =
|
|
846
|
+
var AlertDialogAction = React20.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
847
847
|
AlertDialogPrimitive.Action,
|
|
848
848
|
{
|
|
849
849
|
ref,
|
|
@@ -852,7 +852,7 @@ var AlertDialogAction = React34.forwardRef(({ className, ...props }, ref) => /*
|
|
|
852
852
|
}
|
|
853
853
|
));
|
|
854
854
|
AlertDialogAction.displayName = AlertDialogPrimitive.Action.displayName;
|
|
855
|
-
var AlertDialogCancel =
|
|
855
|
+
var AlertDialogCancel = React20.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
856
856
|
AlertDialogPrimitive.Cancel,
|
|
857
857
|
{
|
|
858
858
|
ref,
|
|
@@ -915,7 +915,7 @@ var cardVariants = cva(
|
|
|
915
915
|
}
|
|
916
916
|
}
|
|
917
917
|
);
|
|
918
|
-
var Card =
|
|
918
|
+
var Card = React20.forwardRef(
|
|
919
919
|
({
|
|
920
920
|
className,
|
|
921
921
|
size,
|
|
@@ -929,7 +929,7 @@ var Card = React34.forwardRef(
|
|
|
929
929
|
...props
|
|
930
930
|
}, ref) => {
|
|
931
931
|
const isInteractive = interactive || asButton || !!onClick;
|
|
932
|
-
const handleKeyDown =
|
|
932
|
+
const handleKeyDown = React20.useCallback(
|
|
933
933
|
(e) => {
|
|
934
934
|
if (isInteractive && (e.key === "Enter" || e.key === " ")) {
|
|
935
935
|
e.preventDefault();
|
|
@@ -961,7 +961,7 @@ var Card = React34.forwardRef(
|
|
|
961
961
|
}
|
|
962
962
|
);
|
|
963
963
|
Card.displayName = "Card";
|
|
964
|
-
var CardHeader =
|
|
964
|
+
var CardHeader = React20.forwardRef(
|
|
965
965
|
({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
966
966
|
"div",
|
|
967
967
|
{
|
|
@@ -972,7 +972,7 @@ var CardHeader = React34.forwardRef(
|
|
|
972
972
|
)
|
|
973
973
|
);
|
|
974
974
|
CardHeader.displayName = "CardHeader";
|
|
975
|
-
var CardTitle =
|
|
975
|
+
var CardTitle = React20.forwardRef(
|
|
976
976
|
({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
977
977
|
"div",
|
|
978
978
|
{
|
|
@@ -983,7 +983,7 @@ var CardTitle = React34.forwardRef(
|
|
|
983
983
|
)
|
|
984
984
|
);
|
|
985
985
|
CardTitle.displayName = "CardTitle";
|
|
986
|
-
var CardDescription =
|
|
986
|
+
var CardDescription = React20.forwardRef(
|
|
987
987
|
({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
988
988
|
"div",
|
|
989
989
|
{
|
|
@@ -994,11 +994,11 @@ var CardDescription = React34.forwardRef(
|
|
|
994
994
|
)
|
|
995
995
|
);
|
|
996
996
|
CardDescription.displayName = "CardDescription";
|
|
997
|
-
var CardContent =
|
|
997
|
+
var CardContent = React20.forwardRef(
|
|
998
998
|
({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn("p-6 pt-0", className), ...props })
|
|
999
999
|
);
|
|
1000
1000
|
CardContent.displayName = "CardContent";
|
|
1001
|
-
var CardFooter =
|
|
1001
|
+
var CardFooter = React20.forwardRef(
|
|
1002
1002
|
({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
1003
1003
|
"div",
|
|
1004
1004
|
{
|
|
@@ -1035,17 +1035,17 @@ var cardImageVariants = cva("w-full object-cover", {
|
|
|
1035
1035
|
position: "top"
|
|
1036
1036
|
}
|
|
1037
1037
|
});
|
|
1038
|
-
var CardImage =
|
|
1038
|
+
var CardImage = React20.forwardRef(
|
|
1039
1039
|
({ className, aspectRatio, position, fallback, alt, src, onError, ...props }, ref) => {
|
|
1040
|
-
const [hasError, setHasError] =
|
|
1041
|
-
const handleError =
|
|
1040
|
+
const [hasError, setHasError] = React20.useState(false);
|
|
1041
|
+
const handleError = React20.useCallback(
|
|
1042
1042
|
(e) => {
|
|
1043
1043
|
setHasError(true);
|
|
1044
1044
|
onError?.(e);
|
|
1045
1045
|
},
|
|
1046
1046
|
[onError]
|
|
1047
1047
|
);
|
|
1048
|
-
|
|
1048
|
+
React20.useEffect(() => {
|
|
1049
1049
|
setHasError(false);
|
|
1050
1050
|
}, [src]);
|
|
1051
1051
|
if (hasError && fallback) {
|
|
@@ -1116,7 +1116,7 @@ var cardActionsVariants = cva(
|
|
|
1116
1116
|
}
|
|
1117
1117
|
}
|
|
1118
1118
|
);
|
|
1119
|
-
var CardActions =
|
|
1119
|
+
var CardActions = React20.forwardRef(
|
|
1120
1120
|
({ className, showOn, position, variant, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
1121
1121
|
"div",
|
|
1122
1122
|
{
|
|
@@ -1128,7 +1128,7 @@ var CardActions = React34.forwardRef(
|
|
|
1128
1128
|
)
|
|
1129
1129
|
);
|
|
1130
1130
|
CardActions.displayName = "CardActions";
|
|
1131
|
-
var SelectableCard =
|
|
1131
|
+
var SelectableCard = React20.forwardRef(
|
|
1132
1132
|
({
|
|
1133
1133
|
className,
|
|
1134
1134
|
selected: controlledSelected,
|
|
@@ -1142,10 +1142,10 @@ var SelectableCard = React34.forwardRef(
|
|
|
1142
1142
|
hover = "border",
|
|
1143
1143
|
...props
|
|
1144
1144
|
}, ref) => {
|
|
1145
|
-
const [uncontrolledSelected, setUncontrolledSelected] =
|
|
1145
|
+
const [uncontrolledSelected, setUncontrolledSelected] = React20.useState(defaultSelected);
|
|
1146
1146
|
const isControlled = controlledSelected !== void 0;
|
|
1147
1147
|
const isSelected = isControlled ? controlledSelected : uncontrolledSelected;
|
|
1148
|
-
const handleClick =
|
|
1148
|
+
const handleClick = React20.useCallback(
|
|
1149
1149
|
(e) => {
|
|
1150
1150
|
if (disabled) return;
|
|
1151
1151
|
const newSelected = !isSelected;
|
|
@@ -1157,7 +1157,7 @@ var SelectableCard = React34.forwardRef(
|
|
|
1157
1157
|
},
|
|
1158
1158
|
[disabled, isSelected, isControlled, onSelectedChange, onClick]
|
|
1159
1159
|
);
|
|
1160
|
-
const handleCheckboxChange =
|
|
1160
|
+
const handleCheckboxChange = React20.useCallback(
|
|
1161
1161
|
(checked) => {
|
|
1162
1162
|
if (disabled) return;
|
|
1163
1163
|
const newSelected = checked === true;
|
|
@@ -1257,7 +1257,7 @@ var cardGridVariants = cva("grid", {
|
|
|
1257
1257
|
gap: "md"
|
|
1258
1258
|
}
|
|
1259
1259
|
});
|
|
1260
|
-
var CardGrid =
|
|
1260
|
+
var CardGrid = React20.forwardRef(
|
|
1261
1261
|
({ className, columns, gap, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
1262
1262
|
"div",
|
|
1263
1263
|
{
|
|
@@ -1292,7 +1292,7 @@ var cardListVariants = cva("flex flex-col", {
|
|
|
1292
1292
|
divided: false
|
|
1293
1293
|
}
|
|
1294
1294
|
});
|
|
1295
|
-
var CardList =
|
|
1295
|
+
var CardList = React20.forwardRef(
|
|
1296
1296
|
({ className, gap, divided, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
1297
1297
|
"div",
|
|
1298
1298
|
{
|
|
@@ -1373,7 +1373,7 @@ var boardVariants = cva("text-card-foreground", {
|
|
|
1373
1373
|
hover: "none"
|
|
1374
1374
|
}
|
|
1375
1375
|
});
|
|
1376
|
-
var Board =
|
|
1376
|
+
var Board = React20.forwardRef(
|
|
1377
1377
|
({
|
|
1378
1378
|
className,
|
|
1379
1379
|
elevation,
|
|
@@ -1409,7 +1409,7 @@ var Board = React34.forwardRef(
|
|
|
1409
1409
|
}
|
|
1410
1410
|
);
|
|
1411
1411
|
Board.displayName = "Board";
|
|
1412
|
-
var BoardHeader =
|
|
1412
|
+
var BoardHeader = React20.forwardRef(
|
|
1413
1413
|
({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
1414
1414
|
"div",
|
|
1415
1415
|
{
|
|
@@ -1420,11 +1420,11 @@ var BoardHeader = React34.forwardRef(
|
|
|
1420
1420
|
)
|
|
1421
1421
|
);
|
|
1422
1422
|
BoardHeader.displayName = "BoardHeader";
|
|
1423
|
-
var BoardContent =
|
|
1423
|
+
var BoardContent = React20.forwardRef(
|
|
1424
1424
|
({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn("p-4", className), ...props })
|
|
1425
1425
|
);
|
|
1426
1426
|
BoardContent.displayName = "BoardContent";
|
|
1427
|
-
var Table =
|
|
1427
|
+
var Table = React20.forwardRef(
|
|
1428
1428
|
({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { className: "relative w-full overflow-auto", children: /* @__PURE__ */ jsx(
|
|
1429
1429
|
"table",
|
|
1430
1430
|
{
|
|
@@ -1435,11 +1435,11 @@ var Table = React34.forwardRef(
|
|
|
1435
1435
|
) })
|
|
1436
1436
|
);
|
|
1437
1437
|
Table.displayName = "Table";
|
|
1438
|
-
var TableHeader =
|
|
1438
|
+
var TableHeader = React20.forwardRef(
|
|
1439
1439
|
({ className, ...props }, ref) => /* @__PURE__ */ jsx("thead", { ref, className: cn("[&_tr]:border-b", className), ...props })
|
|
1440
1440
|
);
|
|
1441
1441
|
TableHeader.displayName = "TableHeader";
|
|
1442
|
-
var TableBody =
|
|
1442
|
+
var TableBody = React20.forwardRef(
|
|
1443
1443
|
({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
1444
1444
|
"tbody",
|
|
1445
1445
|
{
|
|
@@ -1450,7 +1450,7 @@ var TableBody = React34.forwardRef(
|
|
|
1450
1450
|
)
|
|
1451
1451
|
);
|
|
1452
1452
|
TableBody.displayName = "TableBody";
|
|
1453
|
-
var TableFooter =
|
|
1453
|
+
var TableFooter = React20.forwardRef(
|
|
1454
1454
|
({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
1455
1455
|
"tfoot",
|
|
1456
1456
|
{
|
|
@@ -1464,7 +1464,7 @@ var TableFooter = React34.forwardRef(
|
|
|
1464
1464
|
)
|
|
1465
1465
|
);
|
|
1466
1466
|
TableFooter.displayName = "TableFooter";
|
|
1467
|
-
var TableRow =
|
|
1467
|
+
var TableRow = React20.forwardRef(
|
|
1468
1468
|
({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
1469
1469
|
"tr",
|
|
1470
1470
|
{
|
|
@@ -1478,7 +1478,7 @@ var TableRow = React34.forwardRef(
|
|
|
1478
1478
|
)
|
|
1479
1479
|
);
|
|
1480
1480
|
TableRow.displayName = "TableRow";
|
|
1481
|
-
var TableHead =
|
|
1481
|
+
var TableHead = React20.forwardRef(
|
|
1482
1482
|
({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
1483
1483
|
"th",
|
|
1484
1484
|
{
|
|
@@ -1492,7 +1492,7 @@ var TableHead = React34.forwardRef(
|
|
|
1492
1492
|
)
|
|
1493
1493
|
);
|
|
1494
1494
|
TableHead.displayName = "TableHead";
|
|
1495
|
-
var TableCell =
|
|
1495
|
+
var TableCell = React20.forwardRef(
|
|
1496
1496
|
({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
1497
1497
|
"td",
|
|
1498
1498
|
{
|
|
@@ -1506,7 +1506,7 @@ var TableCell = React34.forwardRef(
|
|
|
1506
1506
|
)
|
|
1507
1507
|
);
|
|
1508
1508
|
TableCell.displayName = "TableCell";
|
|
1509
|
-
var TableCaption =
|
|
1509
|
+
var TableCaption = React20.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
1510
1510
|
"caption",
|
|
1511
1511
|
{
|
|
1512
1512
|
ref,
|
|
@@ -1515,6 +1515,518 @@ var TableCaption = React34.forwardRef(({ className, ...props }, ref) => /* @__PU
|
|
|
1515
1515
|
}
|
|
1516
1516
|
));
|
|
1517
1517
|
TableCaption.displayName = "TableCaption";
|
|
1518
|
+
var loadingSpinnerVariants = cva("rounded-full animate-spin border-current", {
|
|
1519
|
+
variants: {
|
|
1520
|
+
/**
|
|
1521
|
+
* Size of the spinner
|
|
1522
|
+
*/
|
|
1523
|
+
size: {
|
|
1524
|
+
sm: "w-4 h-4 border-2",
|
|
1525
|
+
default: "w-8 h-8 border-2",
|
|
1526
|
+
lg: "w-12 h-12 border-[3px]",
|
|
1527
|
+
xl: "w-16 h-16 border-4"
|
|
1528
|
+
},
|
|
1529
|
+
/**
|
|
1530
|
+
* Visual variant
|
|
1531
|
+
*/
|
|
1532
|
+
variant: {
|
|
1533
|
+
/** Primary color spinner (default) */
|
|
1534
|
+
default: "border-primary/20 border-t-primary",
|
|
1535
|
+
/** Accent color spinner */
|
|
1536
|
+
accent: "border-accent/20 border-t-accent",
|
|
1537
|
+
/** Muted/subtle spinner */
|
|
1538
|
+
muted: "border-muted-foreground/20 border-t-muted-foreground",
|
|
1539
|
+
/** Inherits current text color */
|
|
1540
|
+
inherit: "border-current/20 border-t-current"
|
|
1541
|
+
}
|
|
1542
|
+
},
|
|
1543
|
+
defaultVariants: {
|
|
1544
|
+
size: "default",
|
|
1545
|
+
variant: "default"
|
|
1546
|
+
}
|
|
1547
|
+
});
|
|
1548
|
+
var LoadingSpinner = React20.forwardRef(
|
|
1549
|
+
({ className, size, variant, label, showDots = false, ...props }, ref) => {
|
|
1550
|
+
const [dots, setDots] = React20.useState("");
|
|
1551
|
+
React20.useEffect(() => {
|
|
1552
|
+
if (!showDots || !label) return;
|
|
1553
|
+
const interval = setInterval(() => {
|
|
1554
|
+
setDots((prev) => prev.length >= 3 ? "" : prev + ".");
|
|
1555
|
+
}, 500);
|
|
1556
|
+
return () => clearInterval(interval);
|
|
1557
|
+
}, [showDots, label]);
|
|
1558
|
+
if (label) {
|
|
1559
|
+
return /* @__PURE__ */ jsxs(
|
|
1560
|
+
"div",
|
|
1561
|
+
{
|
|
1562
|
+
ref,
|
|
1563
|
+
className: cn("flex flex-col items-center gap-3", className),
|
|
1564
|
+
...props,
|
|
1565
|
+
children: [
|
|
1566
|
+
/* @__PURE__ */ jsx("div", { className: loadingSpinnerVariants({ size, variant }) }),
|
|
1567
|
+
/* @__PURE__ */ jsxs("p", { className: "text-sm text-muted-foreground", children: [
|
|
1568
|
+
label,
|
|
1569
|
+
showDots && /* @__PURE__ */ jsx("span", { className: "inline-block w-4", children: dots })
|
|
1570
|
+
] })
|
|
1571
|
+
]
|
|
1572
|
+
}
|
|
1573
|
+
);
|
|
1574
|
+
}
|
|
1575
|
+
return /* @__PURE__ */ jsx(
|
|
1576
|
+
"div",
|
|
1577
|
+
{
|
|
1578
|
+
ref,
|
|
1579
|
+
className: cn(loadingSpinnerVariants({ size, variant }), className),
|
|
1580
|
+
...props
|
|
1581
|
+
}
|
|
1582
|
+
);
|
|
1583
|
+
}
|
|
1584
|
+
);
|
|
1585
|
+
LoadingSpinner.displayName = "LoadingSpinner";
|
|
1586
|
+
function getCellRawValue(row, col) {
|
|
1587
|
+
if (col.accessor) return col.accessor(row);
|
|
1588
|
+
return row[col.key];
|
|
1589
|
+
}
|
|
1590
|
+
function defaultSearch(row, query, columns) {
|
|
1591
|
+
const lowerQuery = query.toLowerCase();
|
|
1592
|
+
return columns.some((col) => {
|
|
1593
|
+
const val = getCellRawValue(row, col);
|
|
1594
|
+
if (val == null) return false;
|
|
1595
|
+
return String(val).toLowerCase().includes(lowerQuery);
|
|
1596
|
+
});
|
|
1597
|
+
}
|
|
1598
|
+
function defaultSortComparator(a, b, col, direction) {
|
|
1599
|
+
if (col.sortFn) {
|
|
1600
|
+
const result = col.sortFn(a, b);
|
|
1601
|
+
return direction === "asc" ? result : -result;
|
|
1602
|
+
}
|
|
1603
|
+
const aVal = getCellRawValue(a, col);
|
|
1604
|
+
const bVal = getCellRawValue(b, col);
|
|
1605
|
+
const aStr = aVal == null ? "" : String(aVal);
|
|
1606
|
+
const bStr = bVal == null ? "" : String(bVal);
|
|
1607
|
+
const aNum = Number(aStr);
|
|
1608
|
+
const bNum = Number(bStr);
|
|
1609
|
+
if (!isNaN(aNum) && !isNaN(bNum) && aStr !== "" && bStr !== "") {
|
|
1610
|
+
return direction === "asc" ? aNum - bNum : bNum - aNum;
|
|
1611
|
+
}
|
|
1612
|
+
const cmp = aStr.localeCompare(bStr);
|
|
1613
|
+
return direction === "asc" ? cmp : -cmp;
|
|
1614
|
+
}
|
|
1615
|
+
function DataTable({
|
|
1616
|
+
data,
|
|
1617
|
+
columns,
|
|
1618
|
+
getRowKey,
|
|
1619
|
+
// Sorting
|
|
1620
|
+
defaultSort,
|
|
1621
|
+
sort: controlledSort,
|
|
1622
|
+
onSortChange,
|
|
1623
|
+
// Search
|
|
1624
|
+
searchable = false,
|
|
1625
|
+
searchPlaceholder = "Search...",
|
|
1626
|
+
searchValue: controlledSearchValue,
|
|
1627
|
+
onSearchChange,
|
|
1628
|
+
searchFn,
|
|
1629
|
+
// Pagination
|
|
1630
|
+
pageSize: defaultPageSize,
|
|
1631
|
+
pageSizeOptions = [10, 15, 25, 50, 100],
|
|
1632
|
+
currentPage: controlledPage,
|
|
1633
|
+
onPageChange,
|
|
1634
|
+
onPageSizeChange,
|
|
1635
|
+
// Selection
|
|
1636
|
+
selectable,
|
|
1637
|
+
selectedRows: controlledSelectedRows,
|
|
1638
|
+
onSelectedRowsChange,
|
|
1639
|
+
// Row interaction
|
|
1640
|
+
onRowClick,
|
|
1641
|
+
rowClassName,
|
|
1642
|
+
// Pinned rows
|
|
1643
|
+
pinnedRows = [],
|
|
1644
|
+
// Slots
|
|
1645
|
+
toolbar,
|
|
1646
|
+
emptyState,
|
|
1647
|
+
caption,
|
|
1648
|
+
// Loading
|
|
1649
|
+
loading = false,
|
|
1650
|
+
// Styling
|
|
1651
|
+
className
|
|
1652
|
+
}) {
|
|
1653
|
+
const [internalSort, setInternalSort] = React20.useState(
|
|
1654
|
+
defaultSort ?? null
|
|
1655
|
+
);
|
|
1656
|
+
const [internalSearchValue, setInternalSearchValue] = React20.useState("");
|
|
1657
|
+
const [internalPage, setInternalPage] = React20.useState(0);
|
|
1658
|
+
const [internalPageSize, setInternalPageSize] = React20.useState(
|
|
1659
|
+
defaultPageSize ?? 10
|
|
1660
|
+
);
|
|
1661
|
+
const [internalSelectedRows, setInternalSelectedRows] = React20.useState([]);
|
|
1662
|
+
const sort = controlledSort !== void 0 ? controlledSort : internalSort;
|
|
1663
|
+
const searchQuery = controlledSearchValue !== void 0 ? controlledSearchValue : internalSearchValue;
|
|
1664
|
+
const page = controlledPage !== void 0 ? controlledPage : internalPage;
|
|
1665
|
+
const pageSize = defaultPageSize != null ? internalPageSize ?? defaultPageSize : void 0;
|
|
1666
|
+
const selectedRowKeys = controlledSelectedRows !== void 0 ? controlledSelectedRows : internalSelectedRows;
|
|
1667
|
+
const handleSortChange = React20.useCallback(
|
|
1668
|
+
(next) => {
|
|
1669
|
+
if (onSortChange) onSortChange(next);
|
|
1670
|
+
else setInternalSort(next);
|
|
1671
|
+
},
|
|
1672
|
+
[onSortChange]
|
|
1673
|
+
);
|
|
1674
|
+
const handleSearchChange = React20.useCallback(
|
|
1675
|
+
(value) => {
|
|
1676
|
+
if (onSearchChange) onSearchChange(value);
|
|
1677
|
+
else setInternalSearchValue(value);
|
|
1678
|
+
if (onPageChange) onPageChange(0);
|
|
1679
|
+
else setInternalPage(0);
|
|
1680
|
+
},
|
|
1681
|
+
[onSearchChange, onPageChange]
|
|
1682
|
+
);
|
|
1683
|
+
const handlePageChange = React20.useCallback(
|
|
1684
|
+
(p) => {
|
|
1685
|
+
if (onPageChange) onPageChange(p);
|
|
1686
|
+
else setInternalPage(p);
|
|
1687
|
+
},
|
|
1688
|
+
[onPageChange]
|
|
1689
|
+
);
|
|
1690
|
+
const handlePageSizeChange = React20.useCallback(
|
|
1691
|
+
(size) => {
|
|
1692
|
+
if (onPageSizeChange) onPageSizeChange(size);
|
|
1693
|
+
else setInternalPageSize(size);
|
|
1694
|
+
if (onPageChange) onPageChange(0);
|
|
1695
|
+
else setInternalPage(0);
|
|
1696
|
+
},
|
|
1697
|
+
[onPageSizeChange, onPageChange]
|
|
1698
|
+
);
|
|
1699
|
+
const handleSelectionChange = React20.useCallback(
|
|
1700
|
+
(keys) => {
|
|
1701
|
+
if (onSelectedRowsChange) onSelectedRowsChange(keys);
|
|
1702
|
+
else setInternalSelectedRows(keys);
|
|
1703
|
+
},
|
|
1704
|
+
[onSelectedRowsChange]
|
|
1705
|
+
);
|
|
1706
|
+
const handleHeaderClick = React20.useCallback(
|
|
1707
|
+
(colKey) => {
|
|
1708
|
+
if (sort?.key === colKey) {
|
|
1709
|
+
if (sort.direction === "asc") {
|
|
1710
|
+
handleSortChange({ key: colKey, direction: "desc" });
|
|
1711
|
+
} else {
|
|
1712
|
+
handleSortChange(null);
|
|
1713
|
+
}
|
|
1714
|
+
} else {
|
|
1715
|
+
handleSortChange({ key: colKey, direction: "asc" });
|
|
1716
|
+
}
|
|
1717
|
+
},
|
|
1718
|
+
[sort, handleSortChange]
|
|
1719
|
+
);
|
|
1720
|
+
const searchedData = React20.useMemo(() => {
|
|
1721
|
+
if (!searchable || !searchQuery) return data;
|
|
1722
|
+
if (searchFn) return data.filter((row) => searchFn(row, searchQuery));
|
|
1723
|
+
return data.filter((row) => defaultSearch(row, searchQuery, columns));
|
|
1724
|
+
}, [data, searchable, searchQuery, searchFn, columns]);
|
|
1725
|
+
const sortedData = React20.useMemo(() => {
|
|
1726
|
+
if (!sort) return searchedData;
|
|
1727
|
+
const col = columns.find((c) => c.key === sort.key);
|
|
1728
|
+
if (!col) return searchedData;
|
|
1729
|
+
return [...searchedData].sort(
|
|
1730
|
+
(a, b) => defaultSortComparator(a, b, col, sort.direction)
|
|
1731
|
+
);
|
|
1732
|
+
}, [searchedData, sort, columns]);
|
|
1733
|
+
const pinnedSet = React20.useMemo(() => new Set(pinnedRows), [pinnedRows]);
|
|
1734
|
+
const { pinnedData, unpinnedData } = React20.useMemo(() => {
|
|
1735
|
+
if (pinnedSet.size === 0) return { pinnedData: [], unpinnedData: sortedData };
|
|
1736
|
+
const pinned = [];
|
|
1737
|
+
const unpinned = [];
|
|
1738
|
+
const dataByKey = /* @__PURE__ */ new Map();
|
|
1739
|
+
data.forEach((row, i) => {
|
|
1740
|
+
dataByKey.set(getRowKey(row, i), row);
|
|
1741
|
+
});
|
|
1742
|
+
pinnedRows.forEach((key) => {
|
|
1743
|
+
const row = dataByKey.get(key);
|
|
1744
|
+
if (row) pinned.push(row);
|
|
1745
|
+
});
|
|
1746
|
+
sortedData.forEach((row, i) => {
|
|
1747
|
+
const key = getRowKey(row, i);
|
|
1748
|
+
if (!pinnedSet.has(key)) unpinned.push(row);
|
|
1749
|
+
});
|
|
1750
|
+
return { pinnedData: pinned, unpinnedData: unpinned };
|
|
1751
|
+
}, [sortedData, pinnedSet, pinnedRows, data, getRowKey]);
|
|
1752
|
+
const totalUnpinned = unpinnedData.length;
|
|
1753
|
+
const totalPages = pageSize ? Math.max(1, Math.ceil(totalUnpinned / pageSize)) : 1;
|
|
1754
|
+
const paginatedData = React20.useMemo(() => {
|
|
1755
|
+
if (!pageSize) return unpinnedData;
|
|
1756
|
+
const start = page * pageSize;
|
|
1757
|
+
return unpinnedData.slice(start, start + pageSize);
|
|
1758
|
+
}, [unpinnedData, pageSize, page]);
|
|
1759
|
+
const visibleRows = React20.useMemo(
|
|
1760
|
+
() => [...pinnedData, ...paginatedData],
|
|
1761
|
+
[pinnedData, paginatedData]
|
|
1762
|
+
);
|
|
1763
|
+
const totalItems = searchedData.length;
|
|
1764
|
+
const visibleKeys = React20.useMemo(
|
|
1765
|
+
() => visibleRows.map((row, i) => getRowKey(row, i)),
|
|
1766
|
+
[visibleRows, getRowKey]
|
|
1767
|
+
);
|
|
1768
|
+
const allVisibleSelected = visibleKeys.length > 0 && visibleKeys.every((k) => selectedRowKeys.includes(k));
|
|
1769
|
+
const someVisibleSelected = !allVisibleSelected && visibleKeys.some((k) => selectedRowKeys.includes(k));
|
|
1770
|
+
const toggleRowSelection = React20.useCallback(
|
|
1771
|
+
(key) => {
|
|
1772
|
+
const isSelected = selectedRowKeys.includes(key);
|
|
1773
|
+
const next = isSelected ? selectedRowKeys.filter((k) => k !== key) : [...selectedRowKeys, key];
|
|
1774
|
+
handleSelectionChange(next);
|
|
1775
|
+
},
|
|
1776
|
+
[selectedRowKeys, handleSelectionChange]
|
|
1777
|
+
);
|
|
1778
|
+
const toggleAllVisible = React20.useCallback(() => {
|
|
1779
|
+
if (allVisibleSelected) {
|
|
1780
|
+
const visibleSet = new Set(visibleKeys);
|
|
1781
|
+
handleSelectionChange(selectedRowKeys.filter((k) => !visibleSet.has(k)));
|
|
1782
|
+
} else {
|
|
1783
|
+
const merged = /* @__PURE__ */ new Set([...selectedRowKeys, ...visibleKeys]);
|
|
1784
|
+
handleSelectionChange(Array.from(merged));
|
|
1785
|
+
}
|
|
1786
|
+
}, [allVisibleSelected, visibleKeys, selectedRowKeys, handleSelectionChange]);
|
|
1787
|
+
const handleRowClick = React20.useCallback(
|
|
1788
|
+
(row, index, key) => {
|
|
1789
|
+
if (selectable === "highlight") {
|
|
1790
|
+
toggleRowSelection(key);
|
|
1791
|
+
}
|
|
1792
|
+
onRowClick?.(row, index);
|
|
1793
|
+
},
|
|
1794
|
+
[selectable, toggleRowSelection, onRowClick]
|
|
1795
|
+
);
|
|
1796
|
+
const renderCellContent = (row, col, rowIndex) => {
|
|
1797
|
+
if (col.cell) return col.cell(row, rowIndex);
|
|
1798
|
+
const val = getCellRawValue(row, col);
|
|
1799
|
+
if (val == null) return /* @__PURE__ */ jsx("span", { className: "text-muted-foreground italic", children: "--" });
|
|
1800
|
+
return String(val);
|
|
1801
|
+
};
|
|
1802
|
+
const alignClass = (align) => {
|
|
1803
|
+
if (align === "center") return "text-center";
|
|
1804
|
+
if (align === "right") return "text-right";
|
|
1805
|
+
return "text-left";
|
|
1806
|
+
};
|
|
1807
|
+
if (loading) {
|
|
1808
|
+
return /* @__PURE__ */ jsx("div", { className: cn("flex items-center justify-center py-16", className), children: /* @__PURE__ */ jsx(LoadingSpinner, { label: "Loading", showDots: true }) });
|
|
1809
|
+
}
|
|
1810
|
+
const showSearch = searchable;
|
|
1811
|
+
const showPagination = pageSize != null;
|
|
1812
|
+
const showCheckboxColumn = selectable === "checkbox";
|
|
1813
|
+
return /* @__PURE__ */ jsxs("div", { className: cn("flex flex-col w-full", className), children: [
|
|
1814
|
+
(showSearch || toolbar) && /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3 pb-4", children: [
|
|
1815
|
+
showSearch && /* @__PURE__ */ jsxs("div", { className: "relative flex-1 max-w-sm", children: [
|
|
1816
|
+
/* @__PURE__ */ jsx(Search, { className: "absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground" }),
|
|
1817
|
+
/* @__PURE__ */ jsx(
|
|
1818
|
+
Input,
|
|
1819
|
+
{
|
|
1820
|
+
type: "text",
|
|
1821
|
+
placeholder: searchPlaceholder,
|
|
1822
|
+
value: searchQuery,
|
|
1823
|
+
onChange: (e) => handleSearchChange(e.target.value),
|
|
1824
|
+
className: "pl-9"
|
|
1825
|
+
}
|
|
1826
|
+
)
|
|
1827
|
+
] }),
|
|
1828
|
+
toolbar && /* @__PURE__ */ jsx("div", { className: "flex items-center gap-2", children: toolbar })
|
|
1829
|
+
] }),
|
|
1830
|
+
/* @__PURE__ */ jsxs(Table, { children: [
|
|
1831
|
+
caption && /* @__PURE__ */ jsx(TableCaption, { children: caption }),
|
|
1832
|
+
/* @__PURE__ */ jsx(TableHeader, { children: /* @__PURE__ */ jsxs(TableRow, { children: [
|
|
1833
|
+
showCheckboxColumn && /* @__PURE__ */ jsx(TableHead, { className: "w-[40px]", children: /* @__PURE__ */ jsx(
|
|
1834
|
+
Checkbox,
|
|
1835
|
+
{
|
|
1836
|
+
checked: allVisibleSelected ? true : someVisibleSelected ? "indeterminate" : false,
|
|
1837
|
+
onCheckedChange: () => toggleAllVisible(),
|
|
1838
|
+
"aria-label": "Select all"
|
|
1839
|
+
}
|
|
1840
|
+
) }),
|
|
1841
|
+
columns.map((col) => {
|
|
1842
|
+
const isSorted = sort?.key === col.key;
|
|
1843
|
+
const sortDir = isSorted ? sort.direction : null;
|
|
1844
|
+
return /* @__PURE__ */ jsx(
|
|
1845
|
+
TableHead,
|
|
1846
|
+
{
|
|
1847
|
+
className: cn(
|
|
1848
|
+
col.width,
|
|
1849
|
+
col.headerClassName,
|
|
1850
|
+
alignClass(col.align),
|
|
1851
|
+
col.sortable && "cursor-pointer select-none"
|
|
1852
|
+
),
|
|
1853
|
+
onClick: col.sortable ? () => handleHeaderClick(col.key) : void 0,
|
|
1854
|
+
children: /* @__PURE__ */ jsxs(
|
|
1855
|
+
"div",
|
|
1856
|
+
{
|
|
1857
|
+
className: cn(
|
|
1858
|
+
"flex items-center gap-1",
|
|
1859
|
+
col.align === "center" && "justify-center",
|
|
1860
|
+
col.align === "right" && "justify-end"
|
|
1861
|
+
),
|
|
1862
|
+
children: [
|
|
1863
|
+
/* @__PURE__ */ jsx("span", { children: col.header }),
|
|
1864
|
+
col.sortable && /* @__PURE__ */ jsx("span", { className: "inline-flex ml-1", children: sortDir === "asc" ? /* @__PURE__ */ jsx(ArrowUp, { className: "h-3.5 w-3.5" }) : sortDir === "desc" ? /* @__PURE__ */ jsx(ArrowDown, { className: "h-3.5 w-3.5" }) : /* @__PURE__ */ jsx(ArrowUpDown, { className: "h-3.5 w-3.5 opacity-40" }) })
|
|
1865
|
+
]
|
|
1866
|
+
}
|
|
1867
|
+
)
|
|
1868
|
+
},
|
|
1869
|
+
col.key
|
|
1870
|
+
);
|
|
1871
|
+
})
|
|
1872
|
+
] }) }),
|
|
1873
|
+
pinnedData.length > 0 && /* @__PURE__ */ jsx(TableBody, { className: "bg-muted/30 border-b-2 border-border", children: pinnedData.map((row, i) => {
|
|
1874
|
+
const key = getRowKey(row, i);
|
|
1875
|
+
const isSelected = selectedRowKeys.includes(key);
|
|
1876
|
+
return /* @__PURE__ */ jsxs(
|
|
1877
|
+
TableRow,
|
|
1878
|
+
{
|
|
1879
|
+
"data-state": isSelected ? "selected" : void 0,
|
|
1880
|
+
className: cn(
|
|
1881
|
+
(onRowClick || selectable === "highlight") && "cursor-pointer",
|
|
1882
|
+
rowClassName?.(row, i)
|
|
1883
|
+
),
|
|
1884
|
+
onClick: () => handleRowClick(row, i, key),
|
|
1885
|
+
children: [
|
|
1886
|
+
showCheckboxColumn && /* @__PURE__ */ jsx(TableCell, { className: "w-[40px]", children: /* @__PURE__ */ jsx(
|
|
1887
|
+
Checkbox,
|
|
1888
|
+
{
|
|
1889
|
+
checked: isSelected,
|
|
1890
|
+
onCheckedChange: () => toggleRowSelection(key),
|
|
1891
|
+
onClick: (e) => e.stopPropagation(),
|
|
1892
|
+
"aria-label": "Select row"
|
|
1893
|
+
}
|
|
1894
|
+
) }),
|
|
1895
|
+
columns.map((col) => /* @__PURE__ */ jsx(
|
|
1896
|
+
TableCell,
|
|
1897
|
+
{
|
|
1898
|
+
className: cn(alignClass(col.align), col.className),
|
|
1899
|
+
children: renderCellContent(row, col, i)
|
|
1900
|
+
},
|
|
1901
|
+
col.key
|
|
1902
|
+
))
|
|
1903
|
+
]
|
|
1904
|
+
},
|
|
1905
|
+
key
|
|
1906
|
+
);
|
|
1907
|
+
}) }),
|
|
1908
|
+
/* @__PURE__ */ jsx(TableBody, { children: paginatedData.length === 0 && pinnedData.length === 0 ? /* @__PURE__ */ jsx(TableRow, { children: /* @__PURE__ */ jsx(
|
|
1909
|
+
TableCell,
|
|
1910
|
+
{
|
|
1911
|
+
colSpan: columns.length + (showCheckboxColumn ? 1 : 0),
|
|
1912
|
+
className: "h-24 text-center",
|
|
1913
|
+
children: emptyState ?? /* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children: "No results." })
|
|
1914
|
+
}
|
|
1915
|
+
) }) : paginatedData.map((row, i) => {
|
|
1916
|
+
const globalIndex = pageSize ? page * pageSize + i : i;
|
|
1917
|
+
const key = getRowKey(row, globalIndex);
|
|
1918
|
+
const isSelected = selectedRowKeys.includes(key);
|
|
1919
|
+
return /* @__PURE__ */ jsxs(
|
|
1920
|
+
TableRow,
|
|
1921
|
+
{
|
|
1922
|
+
"data-state": isSelected ? "selected" : void 0,
|
|
1923
|
+
className: cn(
|
|
1924
|
+
(onRowClick || selectable === "highlight") && "cursor-pointer",
|
|
1925
|
+
rowClassName?.(row, globalIndex)
|
|
1926
|
+
),
|
|
1927
|
+
onClick: () => handleRowClick(row, globalIndex, key),
|
|
1928
|
+
children: [
|
|
1929
|
+
showCheckboxColumn && /* @__PURE__ */ jsx(TableCell, { className: "w-[40px]", children: /* @__PURE__ */ jsx(
|
|
1930
|
+
Checkbox,
|
|
1931
|
+
{
|
|
1932
|
+
checked: isSelected,
|
|
1933
|
+
onCheckedChange: () => toggleRowSelection(key),
|
|
1934
|
+
onClick: (e) => e.stopPropagation(),
|
|
1935
|
+
"aria-label": "Select row"
|
|
1936
|
+
}
|
|
1937
|
+
) }),
|
|
1938
|
+
columns.map((col) => /* @__PURE__ */ jsx(
|
|
1939
|
+
TableCell,
|
|
1940
|
+
{
|
|
1941
|
+
className: cn(alignClass(col.align), col.className),
|
|
1942
|
+
children: renderCellContent(row, col, globalIndex)
|
|
1943
|
+
},
|
|
1944
|
+
col.key
|
|
1945
|
+
))
|
|
1946
|
+
]
|
|
1947
|
+
},
|
|
1948
|
+
key
|
|
1949
|
+
);
|
|
1950
|
+
}) })
|
|
1951
|
+
] }),
|
|
1952
|
+
showPagination && /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between pt-4", children: [
|
|
1953
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
1954
|
+
/* @__PURE__ */ jsx("span", { className: "text-sm text-muted-foreground", children: "Rows per page" }),
|
|
1955
|
+
/* @__PURE__ */ jsxs(
|
|
1956
|
+
Select,
|
|
1957
|
+
{
|
|
1958
|
+
value: String(pageSize),
|
|
1959
|
+
onValueChange: (val) => handlePageSizeChange(Number(val)),
|
|
1960
|
+
children: [
|
|
1961
|
+
/* @__PURE__ */ jsx(SelectTrigger, { className: "h-8 w-[70px]", children: /* @__PURE__ */ jsx(SelectValue, { placeholder: String(pageSize) }) }),
|
|
1962
|
+
/* @__PURE__ */ jsx(SelectContent, { children: pageSizeOptions.map((opt) => /* @__PURE__ */ jsx(SelectItem, { value: String(opt), children: opt }, opt)) })
|
|
1963
|
+
]
|
|
1964
|
+
}
|
|
1965
|
+
)
|
|
1966
|
+
] }),
|
|
1967
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-4", children: [
|
|
1968
|
+
/* @__PURE__ */ jsxs("span", { className: "text-sm text-muted-foreground", children: [
|
|
1969
|
+
"Page ",
|
|
1970
|
+
page + 1,
|
|
1971
|
+
" of ",
|
|
1972
|
+
totalPages,
|
|
1973
|
+
` (${totalItems} total)`
|
|
1974
|
+
] }),
|
|
1975
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1", children: [
|
|
1976
|
+
/* @__PURE__ */ jsx(
|
|
1977
|
+
Button,
|
|
1978
|
+
{
|
|
1979
|
+
variant: "ghost",
|
|
1980
|
+
size: "icon",
|
|
1981
|
+
className: "h-8 w-8",
|
|
1982
|
+
onClick: () => handlePageChange(0),
|
|
1983
|
+
disabled: page === 0,
|
|
1984
|
+
"aria-label": "First page",
|
|
1985
|
+
children: /* @__PURE__ */ jsx(ChevronsLeft, { className: "h-4 w-4" })
|
|
1986
|
+
}
|
|
1987
|
+
),
|
|
1988
|
+
/* @__PURE__ */ jsx(
|
|
1989
|
+
Button,
|
|
1990
|
+
{
|
|
1991
|
+
variant: "ghost",
|
|
1992
|
+
size: "icon",
|
|
1993
|
+
className: "h-8 w-8",
|
|
1994
|
+
onClick: () => handlePageChange(page - 1),
|
|
1995
|
+
disabled: page === 0,
|
|
1996
|
+
"aria-label": "Previous page",
|
|
1997
|
+
children: /* @__PURE__ */ jsx(ChevronLeft, { className: "h-4 w-4" })
|
|
1998
|
+
}
|
|
1999
|
+
),
|
|
2000
|
+
/* @__PURE__ */ jsx(
|
|
2001
|
+
Button,
|
|
2002
|
+
{
|
|
2003
|
+
variant: "ghost",
|
|
2004
|
+
size: "icon",
|
|
2005
|
+
className: "h-8 w-8",
|
|
2006
|
+
onClick: () => handlePageChange(page + 1),
|
|
2007
|
+
disabled: page >= totalPages - 1,
|
|
2008
|
+
"aria-label": "Next page",
|
|
2009
|
+
children: /* @__PURE__ */ jsx(ChevronRight, { className: "h-4 w-4" })
|
|
2010
|
+
}
|
|
2011
|
+
),
|
|
2012
|
+
/* @__PURE__ */ jsx(
|
|
2013
|
+
Button,
|
|
2014
|
+
{
|
|
2015
|
+
variant: "ghost",
|
|
2016
|
+
size: "icon",
|
|
2017
|
+
className: "h-8 w-8",
|
|
2018
|
+
onClick: () => handlePageChange(totalPages - 1),
|
|
2019
|
+
disabled: page >= totalPages - 1,
|
|
2020
|
+
"aria-label": "Last page",
|
|
2021
|
+
children: /* @__PURE__ */ jsx(ChevronsRight, { className: "h-4 w-4" })
|
|
2022
|
+
}
|
|
2023
|
+
)
|
|
2024
|
+
] })
|
|
2025
|
+
] })
|
|
2026
|
+
] })
|
|
2027
|
+
] });
|
|
2028
|
+
}
|
|
2029
|
+
DataTable.displayName = "DataTable";
|
|
1518
2030
|
function Modal({
|
|
1519
2031
|
isOpen,
|
|
1520
2032
|
onClose,
|
|
@@ -1525,7 +2037,7 @@ function Modal({
|
|
|
1525
2037
|
zIndex = 50,
|
|
1526
2038
|
className
|
|
1527
2039
|
}) {
|
|
1528
|
-
|
|
2040
|
+
React20.useEffect(() => {
|
|
1529
2041
|
if (!isOpen) return;
|
|
1530
2042
|
const handleEscape = (e) => {
|
|
1531
2043
|
if (e.key === "Escape") {
|
|
@@ -1535,7 +2047,7 @@ function Modal({
|
|
|
1535
2047
|
window.addEventListener("keydown", handleEscape);
|
|
1536
2048
|
return () => window.removeEventListener("keydown", handleEscape);
|
|
1537
2049
|
}, [isOpen, onClose]);
|
|
1538
|
-
|
|
2050
|
+
React20.useEffect(() => {
|
|
1539
2051
|
if (isOpen) {
|
|
1540
2052
|
document.body.style.overflow = "hidden";
|
|
1541
2053
|
} else {
|
|
@@ -1650,12 +2162,12 @@ function ConfirmationModal({
|
|
|
1650
2162
|
] }) });
|
|
1651
2163
|
}
|
|
1652
2164
|
function useConfirmation() {
|
|
1653
|
-
const [state, setState] =
|
|
2165
|
+
const [state, setState] = React20.useState({
|
|
1654
2166
|
open: false,
|
|
1655
2167
|
title: "",
|
|
1656
2168
|
description: ""
|
|
1657
2169
|
});
|
|
1658
|
-
const confirm =
|
|
2170
|
+
const confirm = React20.useCallback(
|
|
1659
2171
|
(options) => {
|
|
1660
2172
|
return new Promise((resolve) => {
|
|
1661
2173
|
setState({
|
|
@@ -1667,15 +2179,15 @@ function useConfirmation() {
|
|
|
1667
2179
|
},
|
|
1668
2180
|
[]
|
|
1669
2181
|
);
|
|
1670
|
-
const handleConfirm =
|
|
2182
|
+
const handleConfirm = React20.useCallback(() => {
|
|
1671
2183
|
state.resolve?.(true);
|
|
1672
2184
|
setState((prev) => ({ ...prev, open: false }));
|
|
1673
2185
|
}, [state.resolve]);
|
|
1674
|
-
const handleCancel =
|
|
2186
|
+
const handleCancel = React20.useCallback(() => {
|
|
1675
2187
|
state.resolve?.(false);
|
|
1676
2188
|
setState((prev) => ({ ...prev, open: false }));
|
|
1677
2189
|
}, [state.resolve]);
|
|
1678
|
-
const handleOpenChange =
|
|
2190
|
+
const handleOpenChange = React20.useCallback(
|
|
1679
2191
|
(open) => {
|
|
1680
2192
|
if (!open) {
|
|
1681
2193
|
state.resolve?.(false);
|
|
@@ -1711,11 +2223,11 @@ function ResizeHandle({
|
|
|
1711
2223
|
ariaLabel,
|
|
1712
2224
|
className
|
|
1713
2225
|
}) {
|
|
1714
|
-
const [isDragging, setIsDragging] =
|
|
1715
|
-
const [isFocused, setIsFocused] =
|
|
1716
|
-
const startXRef =
|
|
1717
|
-
const handleRef =
|
|
1718
|
-
const handleMouseDown =
|
|
2226
|
+
const [isDragging, setIsDragging] = React20.useState(false);
|
|
2227
|
+
const [isFocused, setIsFocused] = React20.useState(false);
|
|
2228
|
+
const startXRef = React20.useRef(0);
|
|
2229
|
+
const handleRef = React20.useRef(null);
|
|
2230
|
+
const handleMouseDown = React20.useCallback(
|
|
1719
2231
|
(e) => {
|
|
1720
2232
|
if (!resizable) return;
|
|
1721
2233
|
e.preventDefault();
|
|
@@ -1726,7 +2238,7 @@ function ResizeHandle({
|
|
|
1726
2238
|
},
|
|
1727
2239
|
[resizable, onDragStart]
|
|
1728
2240
|
);
|
|
1729
|
-
const handleMouseMove =
|
|
2241
|
+
const handleMouseMove = React20.useCallback(
|
|
1730
2242
|
(e) => {
|
|
1731
2243
|
if (!isDragging) return;
|
|
1732
2244
|
const deltaX = e.clientX - startXRef.current;
|
|
@@ -1735,13 +2247,13 @@ function ResizeHandle({
|
|
|
1735
2247
|
},
|
|
1736
2248
|
[isDragging, onDrag]
|
|
1737
2249
|
);
|
|
1738
|
-
const handleMouseUp =
|
|
2250
|
+
const handleMouseUp = React20.useCallback(() => {
|
|
1739
2251
|
if (!isDragging) return;
|
|
1740
2252
|
setIsDragging(false);
|
|
1741
2253
|
document.body.style.userSelect = "";
|
|
1742
2254
|
onDragEnd?.();
|
|
1743
2255
|
}, [isDragging, onDragEnd]);
|
|
1744
|
-
const handleKeyDown =
|
|
2256
|
+
const handleKeyDown = React20.useCallback(
|
|
1745
2257
|
(e) => {
|
|
1746
2258
|
if (!resizable || !onKeyboardResize) return;
|
|
1747
2259
|
let direction = null;
|
|
@@ -1760,7 +2272,7 @@ function ResizeHandle({
|
|
|
1760
2272
|
},
|
|
1761
2273
|
[resizable, onKeyboardResize, orientation]
|
|
1762
2274
|
);
|
|
1763
|
-
|
|
2275
|
+
React20.useEffect(() => {
|
|
1764
2276
|
if (isDragging) {
|
|
1765
2277
|
window.addEventListener("mousemove", handleMouseMove);
|
|
1766
2278
|
window.addEventListener("mouseup", handleMouseUp);
|
|
@@ -1830,12 +2342,12 @@ function ResizablePanel({
|
|
|
1830
2342
|
className,
|
|
1831
2343
|
dataAttributes = {}
|
|
1832
2344
|
}) {
|
|
1833
|
-
const panelRef =
|
|
1834
|
-
const [isDragging, setIsDragging] =
|
|
1835
|
-
const [localWidth, setLocalWidth] =
|
|
1836
|
-
const [localOuterWidth, setLocalOuterWidth] =
|
|
2345
|
+
const panelRef = React20.useRef(null);
|
|
2346
|
+
const [isDragging, setIsDragging] = React20.useState(false);
|
|
2347
|
+
const [localWidth, setLocalWidth] = React20.useState(null);
|
|
2348
|
+
const [localOuterWidth, setLocalOuterWidth] = React20.useState(null);
|
|
1837
2349
|
const currentWidthVW = isExpanded ? (isDragging && localWidth !== null ? localWidth : expandedWidthVW) || collapsedSizeVW : collapsedSizeVW;
|
|
1838
|
-
const clampWidth =
|
|
2350
|
+
const clampWidth = React20.useCallback(
|
|
1839
2351
|
(width) => {
|
|
1840
2352
|
let effectiveMinWidth = minWidthVW;
|
|
1841
2353
|
let effectiveMaxWidth = maxWidthVW;
|
|
@@ -1848,11 +2360,11 @@ function ResizablePanel({
|
|
|
1848
2360
|
},
|
|
1849
2361
|
[minWidthVW, maxWidthVW, orientation, leftWidthVW, isOverlay]
|
|
1850
2362
|
);
|
|
1851
|
-
const handleDragStart =
|
|
2363
|
+
const handleDragStart = React20.useCallback(() => {
|
|
1852
2364
|
setIsDragging(true);
|
|
1853
2365
|
setLocalWidth(currentWidthVW);
|
|
1854
2366
|
}, [currentWidthVW]);
|
|
1855
|
-
const handleDrag =
|
|
2367
|
+
const handleDrag = React20.useCallback(
|
|
1856
2368
|
(deltaX) => {
|
|
1857
2369
|
if (!isExpanded || isOverlay) return;
|
|
1858
2370
|
const viewportWidth = window.innerWidth;
|
|
@@ -1871,14 +2383,14 @@ function ResizablePanel({
|
|
|
1871
2383
|
clampWidth
|
|
1872
2384
|
]
|
|
1873
2385
|
);
|
|
1874
|
-
const handleDragEnd =
|
|
2386
|
+
const handleDragEnd = React20.useCallback(() => {
|
|
1875
2387
|
if (localWidth !== null && onResize) {
|
|
1876
2388
|
onResize(localWidth);
|
|
1877
2389
|
}
|
|
1878
2390
|
setIsDragging(false);
|
|
1879
2391
|
setLocalWidth(null);
|
|
1880
2392
|
}, [localWidth, onResize]);
|
|
1881
|
-
const handleKeyboardResize =
|
|
2393
|
+
const handleKeyboardResize = React20.useCallback(
|
|
1882
2394
|
(direction) => {
|
|
1883
2395
|
if (!isExpanded || isOverlay || !onResize) return;
|
|
1884
2396
|
const step = 1;
|
|
@@ -1887,13 +2399,13 @@ function ResizablePanel({
|
|
|
1887
2399
|
},
|
|
1888
2400
|
[isExpanded, isOverlay, onResize, currentWidthVW, clampWidth]
|
|
1889
2401
|
);
|
|
1890
|
-
const handleOverlayDragStart =
|
|
2402
|
+
const handleOverlayDragStart = React20.useCallback(() => {
|
|
1891
2403
|
if (outerWidthVW) {
|
|
1892
2404
|
setIsDragging(true);
|
|
1893
2405
|
setLocalOuterWidth(outerWidthVW);
|
|
1894
2406
|
}
|
|
1895
2407
|
}, [outerWidthVW]);
|
|
1896
|
-
const handleOverlayDrag =
|
|
2408
|
+
const handleOverlayDrag = React20.useCallback(
|
|
1897
2409
|
(deltaX) => {
|
|
1898
2410
|
if (!isOverlay) return;
|
|
1899
2411
|
const viewportWidth = window.innerWidth;
|
|
@@ -1904,14 +2416,14 @@ function ResizablePanel({
|
|
|
1904
2416
|
},
|
|
1905
2417
|
[isOverlay, localOuterWidth, outerWidthVW]
|
|
1906
2418
|
);
|
|
1907
|
-
const handleOverlayDragEnd =
|
|
2419
|
+
const handleOverlayDragEnd = React20.useCallback(() => {
|
|
1908
2420
|
if (localOuterWidth !== null && onResizeOverlay) {
|
|
1909
2421
|
onResizeOverlay(localOuterWidth);
|
|
1910
2422
|
}
|
|
1911
2423
|
setIsDragging(false);
|
|
1912
2424
|
setLocalOuterWidth(null);
|
|
1913
2425
|
}, [localOuterWidth, onResizeOverlay]);
|
|
1914
|
-
|
|
2426
|
+
React20.useEffect(() => {
|
|
1915
2427
|
if (isOverlay && panelRef.current) {
|
|
1916
2428
|
const focusableElement = panelRef.current.querySelector(
|
|
1917
2429
|
'button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])'
|
|
@@ -1919,7 +2431,7 @@ function ResizablePanel({
|
|
|
1919
2431
|
focusableElement?.focus();
|
|
1920
2432
|
}
|
|
1921
2433
|
}, [isOverlay]);
|
|
1922
|
-
|
|
2434
|
+
React20.useEffect(() => {
|
|
1923
2435
|
if (!isOverlay) return;
|
|
1924
2436
|
const handleEscape = (e) => {
|
|
1925
2437
|
if (e.key === "Escape") {
|
|
@@ -2105,74 +2617,6 @@ function Chip({
|
|
|
2105
2617
|
}
|
|
2106
2618
|
);
|
|
2107
2619
|
}
|
|
2108
|
-
var loadingSpinnerVariants = cva("rounded-full animate-spin border-current", {
|
|
2109
|
-
variants: {
|
|
2110
|
-
/**
|
|
2111
|
-
* Size of the spinner
|
|
2112
|
-
*/
|
|
2113
|
-
size: {
|
|
2114
|
-
sm: "w-4 h-4 border-2",
|
|
2115
|
-
default: "w-8 h-8 border-2",
|
|
2116
|
-
lg: "w-12 h-12 border-[3px]",
|
|
2117
|
-
xl: "w-16 h-16 border-4"
|
|
2118
|
-
},
|
|
2119
|
-
/**
|
|
2120
|
-
* Visual variant
|
|
2121
|
-
*/
|
|
2122
|
-
variant: {
|
|
2123
|
-
/** Primary color spinner (default) */
|
|
2124
|
-
default: "border-primary/20 border-t-primary",
|
|
2125
|
-
/** Accent color spinner */
|
|
2126
|
-
accent: "border-accent/20 border-t-accent",
|
|
2127
|
-
/** Muted/subtle spinner */
|
|
2128
|
-
muted: "border-muted-foreground/20 border-t-muted-foreground",
|
|
2129
|
-
/** Inherits current text color */
|
|
2130
|
-
inherit: "border-current/20 border-t-current"
|
|
2131
|
-
}
|
|
2132
|
-
},
|
|
2133
|
-
defaultVariants: {
|
|
2134
|
-
size: "default",
|
|
2135
|
-
variant: "default"
|
|
2136
|
-
}
|
|
2137
|
-
});
|
|
2138
|
-
var LoadingSpinner = React34.forwardRef(
|
|
2139
|
-
({ className, size, variant, label, showDots = false, ...props }, ref) => {
|
|
2140
|
-
const [dots, setDots] = React34.useState("");
|
|
2141
|
-
React34.useEffect(() => {
|
|
2142
|
-
if (!showDots || !label) return;
|
|
2143
|
-
const interval = setInterval(() => {
|
|
2144
|
-
setDots((prev) => prev.length >= 3 ? "" : prev + ".");
|
|
2145
|
-
}, 500);
|
|
2146
|
-
return () => clearInterval(interval);
|
|
2147
|
-
}, [showDots, label]);
|
|
2148
|
-
if (label) {
|
|
2149
|
-
return /* @__PURE__ */ jsxs(
|
|
2150
|
-
"div",
|
|
2151
|
-
{
|
|
2152
|
-
ref,
|
|
2153
|
-
className: cn("flex flex-col items-center gap-3", className),
|
|
2154
|
-
...props,
|
|
2155
|
-
children: [
|
|
2156
|
-
/* @__PURE__ */ jsx("div", { className: loadingSpinnerVariants({ size, variant }) }),
|
|
2157
|
-
/* @__PURE__ */ jsxs("p", { className: "text-sm text-muted-foreground", children: [
|
|
2158
|
-
label,
|
|
2159
|
-
showDots && /* @__PURE__ */ jsx("span", { className: "inline-block w-4", children: dots })
|
|
2160
|
-
] })
|
|
2161
|
-
]
|
|
2162
|
-
}
|
|
2163
|
-
);
|
|
2164
|
-
}
|
|
2165
|
-
return /* @__PURE__ */ jsx(
|
|
2166
|
-
"div",
|
|
2167
|
-
{
|
|
2168
|
-
ref,
|
|
2169
|
-
className: cn(loadingSpinnerVariants({ size, variant }), className),
|
|
2170
|
-
...props
|
|
2171
|
-
}
|
|
2172
|
-
);
|
|
2173
|
-
}
|
|
2174
|
-
);
|
|
2175
|
-
LoadingSpinner.displayName = "LoadingSpinner";
|
|
2176
2620
|
function Toaster({
|
|
2177
2621
|
position = "top-right",
|
|
2178
2622
|
expand = false,
|
|
@@ -2235,12 +2679,12 @@ function Calendar({
|
|
|
2235
2679
|
const endMonth = props.endMonth ?? props.toDate;
|
|
2236
2680
|
const fromYear = startMonth?.getFullYear();
|
|
2237
2681
|
const toYear = endMonth?.getFullYear();
|
|
2238
|
-
const years =
|
|
2239
|
-
const [internalMonth, setInternalMonth] =
|
|
2682
|
+
const years = React20.useMemo(() => getYearRange(fromYear, toYear), [fromYear, toYear]);
|
|
2683
|
+
const [internalMonth, setInternalMonth] = React20.useState(
|
|
2240
2684
|
defaultMonth ?? /* @__PURE__ */ new Date()
|
|
2241
2685
|
);
|
|
2242
2686
|
const displayedMonth = controlledMonth ?? internalMonth;
|
|
2243
|
-
const handleMonthChange =
|
|
2687
|
+
const handleMonthChange = React20.useCallback(
|
|
2244
2688
|
(newMonth) => {
|
|
2245
2689
|
if (controlledMonth === void 0) {
|
|
2246
2690
|
setInternalMonth(newMonth);
|
|
@@ -2371,8 +2815,8 @@ function DatePicker({
|
|
|
2371
2815
|
matchTriggerWidth = false,
|
|
2372
2816
|
onOpenChange
|
|
2373
2817
|
}) {
|
|
2374
|
-
const [open, setOpen] =
|
|
2375
|
-
const [internalValue, setInternalValue] =
|
|
2818
|
+
const [open, setOpen] = React20.useState(false);
|
|
2819
|
+
const [internalValue, setInternalValue] = React20.useState(
|
|
2376
2820
|
defaultValue
|
|
2377
2821
|
);
|
|
2378
2822
|
const isControlled = value !== void 0;
|
|
@@ -2474,15 +2918,15 @@ function DatePickerInput({
|
|
|
2474
2918
|
onOpenChange,
|
|
2475
2919
|
size = "default"
|
|
2476
2920
|
}) {
|
|
2477
|
-
const [open, setOpen] =
|
|
2478
|
-
const [internalValue, setInternalValue] =
|
|
2921
|
+
const [open, setOpen] = React20.useState(false);
|
|
2922
|
+
const [internalValue, setInternalValue] = React20.useState(
|
|
2479
2923
|
defaultValue
|
|
2480
2924
|
);
|
|
2481
|
-
const [inputValue, setInputValue] =
|
|
2482
|
-
const inputRef =
|
|
2925
|
+
const [inputValue, setInputValue] = React20.useState("");
|
|
2926
|
+
const inputRef = React20.useRef(null);
|
|
2483
2927
|
const isControlled = value !== void 0;
|
|
2484
2928
|
const selectedDate = isControlled ? value : internalValue;
|
|
2485
|
-
|
|
2929
|
+
React20.useEffect(() => {
|
|
2486
2930
|
if (selectedDate) {
|
|
2487
2931
|
setInputValue(format(selectedDate, dateFormat));
|
|
2488
2932
|
} else {
|
|
@@ -2643,11 +3087,11 @@ function FilterPopover({
|
|
|
2643
3087
|
onFilterChange
|
|
2644
3088
|
}) {
|
|
2645
3089
|
const filterType = column.filterType || "text";
|
|
2646
|
-
const [operator, setOperator] =
|
|
3090
|
+
const [operator, setOperator] = React20.useState(
|
|
2647
3091
|
filter?.operator || getDefaultOperator(filterType)
|
|
2648
3092
|
);
|
|
2649
|
-
const [value, setValue] =
|
|
2650
|
-
const [valueTo, setValueTo] =
|
|
3093
|
+
const [value, setValue] = React20.useState(filter?.value ?? "");
|
|
3094
|
+
const [valueTo, setValueTo] = React20.useState(filter?.valueTo ?? "");
|
|
2651
3095
|
function getDefaultOperator(type) {
|
|
2652
3096
|
switch (type) {
|
|
2653
3097
|
case "text":
|
|
@@ -2790,7 +3234,7 @@ function FilterPopover({
|
|
|
2790
3234
|
] })
|
|
2791
3235
|
] });
|
|
2792
3236
|
const renderDateFilter = () => {
|
|
2793
|
-
const dateValue =
|
|
3237
|
+
const dateValue = React20.useMemo(() => {
|
|
2794
3238
|
if (!value) return void 0;
|
|
2795
3239
|
if (value instanceof Date) return value;
|
|
2796
3240
|
if (typeof value === "string") {
|
|
@@ -2799,7 +3243,7 @@ function FilterPopover({
|
|
|
2799
3243
|
}
|
|
2800
3244
|
return void 0;
|
|
2801
3245
|
}, [value]);
|
|
2802
|
-
const dateToValue =
|
|
3246
|
+
const dateToValue = React20.useMemo(() => {
|
|
2803
3247
|
if (!valueTo) return void 0;
|
|
2804
3248
|
if (valueTo instanceof Date) return valueTo;
|
|
2805
3249
|
if (typeof valueTo === "string") {
|
|
@@ -2934,7 +3378,7 @@ function HeaderCell({
|
|
|
2934
3378
|
onResizeDoubleClick,
|
|
2935
3379
|
isResizing
|
|
2936
3380
|
}) {
|
|
2937
|
-
const [filterOpen, setFilterOpen] =
|
|
3381
|
+
const [filterOpen, setFilterOpen] = React20.useState(false);
|
|
2938
3382
|
const isSorted = sorting?.field === column.key;
|
|
2939
3383
|
const isFiltered = !!filter;
|
|
2940
3384
|
const isSortable = column.sortable && onSort;
|
|
@@ -3092,15 +3536,15 @@ function CellEditor({
|
|
|
3092
3536
|
className
|
|
3093
3537
|
}) {
|
|
3094
3538
|
const editorType = column.editorType || "text";
|
|
3095
|
-
const [internalValue, setInternalValue] =
|
|
3096
|
-
const [validationError, setValidationError] =
|
|
3539
|
+
const [internalValue, setInternalValue] = React20.useState(value);
|
|
3540
|
+
const [validationError, setValidationError] = React20.useState(
|
|
3097
3541
|
null
|
|
3098
3542
|
);
|
|
3099
|
-
const inputRef =
|
|
3100
|
-
const selectRef =
|
|
3543
|
+
const inputRef = React20.useRef(null);
|
|
3544
|
+
const selectRef = React20.useRef(null);
|
|
3101
3545
|
const currentValue = onChange ? value : internalValue;
|
|
3102
3546
|
const setValue = onChange || setInternalValue;
|
|
3103
|
-
const validate =
|
|
3547
|
+
const validate = React20.useCallback(
|
|
3104
3548
|
(val) => {
|
|
3105
3549
|
if (!column.validator) return true;
|
|
3106
3550
|
const result = column.validator(val, row);
|
|
@@ -3148,7 +3592,7 @@ function CellEditor({
|
|
|
3148
3592
|
}
|
|
3149
3593
|
handleCommit();
|
|
3150
3594
|
};
|
|
3151
|
-
|
|
3595
|
+
React20.useEffect(() => {
|
|
3152
3596
|
const timer = setTimeout(() => {
|
|
3153
3597
|
if (editorType === "select") {
|
|
3154
3598
|
selectRef.current?.focus();
|
|
@@ -3195,7 +3639,7 @@ function CellEditor({
|
|
|
3195
3639
|
}
|
|
3196
3640
|
);
|
|
3197
3641
|
const renderDateEditor = () => {
|
|
3198
|
-
const dateValue =
|
|
3642
|
+
const dateValue = React20.useMemo(() => {
|
|
3199
3643
|
if (!currentValue) return void 0;
|
|
3200
3644
|
if (currentValue instanceof Date) return currentValue;
|
|
3201
3645
|
if (typeof currentValue === "string") {
|
|
@@ -4243,15 +4687,15 @@ function DataGrid({
|
|
|
4243
4687
|
hasMore = false,
|
|
4244
4688
|
loadingMore = false
|
|
4245
4689
|
}) {
|
|
4246
|
-
const parentRef =
|
|
4247
|
-
const headerRef =
|
|
4248
|
-
const [headerHeight, setHeaderHeight] =
|
|
4249
|
-
const [hoveredCell, setHoveredCell] =
|
|
4250
|
-
const visibleColumns =
|
|
4690
|
+
const parentRef = React20.useRef(null);
|
|
4691
|
+
const headerRef = React20.useRef(null);
|
|
4692
|
+
const [headerHeight, setHeaderHeight] = React20.useState(40);
|
|
4693
|
+
const [hoveredCell, setHoveredCell] = React20.useState(null);
|
|
4694
|
+
const visibleColumns = React20.useMemo(
|
|
4251
4695
|
() => columns.filter((col) => !col.hidden),
|
|
4252
4696
|
[columns]
|
|
4253
4697
|
);
|
|
4254
|
-
const getCellValue2 =
|
|
4698
|
+
const getCellValue2 = React20.useCallback(
|
|
4255
4699
|
(row, column) => {
|
|
4256
4700
|
if (column.accessor) {
|
|
4257
4701
|
return column.accessor(row);
|
|
@@ -4280,7 +4724,7 @@ function DataGrid({
|
|
|
4280
4724
|
data,
|
|
4281
4725
|
getCellValue: getCellValue2
|
|
4282
4726
|
});
|
|
4283
|
-
const processedData =
|
|
4727
|
+
const processedData = React20.useMemo(() => {
|
|
4284
4728
|
let result = data;
|
|
4285
4729
|
if (enableInternalFiltering && !isControlled.filters && state.filters.length > 0) {
|
|
4286
4730
|
result = applyFilters(result, state.filters, visibleColumns);
|
|
@@ -4308,7 +4752,7 @@ function DataGrid({
|
|
|
4308
4752
|
onColumnResizeEnd
|
|
4309
4753
|
});
|
|
4310
4754
|
const shouldVirtualize = virtualized ?? processedData.length > 100;
|
|
4311
|
-
|
|
4755
|
+
React20.useLayoutEffect(() => {
|
|
4312
4756
|
if (headerRef.current && shouldVirtualize) {
|
|
4313
4757
|
setHeaderHeight(headerRef.current.offsetHeight);
|
|
4314
4758
|
}
|
|
@@ -4320,13 +4764,13 @@ function DataGrid({
|
|
|
4320
4764
|
overscan: DEFAULT_OVERSCAN,
|
|
4321
4765
|
enabled: shouldVirtualize
|
|
4322
4766
|
});
|
|
4323
|
-
const tableWidth =
|
|
4767
|
+
const tableWidth = React20.useMemo(() => {
|
|
4324
4768
|
return visibleColumns.reduce((acc, col) => {
|
|
4325
4769
|
const width = state.columnWidths[col.key] || col.width || estimateColumnWidth(col);
|
|
4326
4770
|
return acc + width;
|
|
4327
4771
|
}, 0);
|
|
4328
4772
|
}, [visibleColumns, state.columnWidths]);
|
|
4329
|
-
const visibleRowCount =
|
|
4773
|
+
const visibleRowCount = React20.useMemo(() => {
|
|
4330
4774
|
if (!parentRef.current) return 10;
|
|
4331
4775
|
return Math.floor(parentRef.current.clientHeight / DEFAULT_ROW_HEIGHT);
|
|
4332
4776
|
}, []);
|
|
@@ -4345,7 +4789,7 @@ function DataGrid({
|
|
|
4345
4789
|
rowVirtualizer.scrollToIndex(rowIndex, { align: "auto" });
|
|
4346
4790
|
}
|
|
4347
4791
|
});
|
|
4348
|
-
const handleBlur =
|
|
4792
|
+
const handleBlur = React20.useCallback(
|
|
4349
4793
|
(event) => {
|
|
4350
4794
|
const target = event.target;
|
|
4351
4795
|
const relatedTarget = event.relatedTarget;
|
|
@@ -4403,7 +4847,7 @@ function DataGrid({
|
|
|
4403
4847
|
},
|
|
4404
4848
|
[state.editingCell, actions]
|
|
4405
4849
|
);
|
|
4406
|
-
|
|
4850
|
+
React20.useEffect(() => {
|
|
4407
4851
|
if (!infiniteScroll || !hasMore || loadingMore || !parentRef.current) return;
|
|
4408
4852
|
const observer = new IntersectionObserver(
|
|
4409
4853
|
(entries) => {
|
|
@@ -4847,7 +5291,7 @@ function DataGrid({
|
|
|
4847
5291
|
);
|
|
4848
5292
|
}
|
|
4849
5293
|
function PaginationFooter({ pagination }) {
|
|
4850
|
-
const [goToPage, setGoToPage] =
|
|
5294
|
+
const [goToPage, setGoToPage] = React20.useState("");
|
|
4851
5295
|
const handleGoToPage = () => {
|
|
4852
5296
|
const page = parseInt(goToPage, 10);
|
|
4853
5297
|
if (!isNaN(page) && page >= 1 && page <= pagination.totalPages) {
|
|
@@ -4965,21 +5409,21 @@ function Autocomplete({
|
|
|
4965
5409
|
className,
|
|
4966
5410
|
clearable = false
|
|
4967
5411
|
}) {
|
|
4968
|
-
const [open, setOpen] =
|
|
4969
|
-
const [search, setSearch] =
|
|
4970
|
-
const inputRef =
|
|
4971
|
-
const selectedOption =
|
|
5412
|
+
const [open, setOpen] = React20.useState(false);
|
|
5413
|
+
const [search, setSearch] = React20.useState("");
|
|
5414
|
+
const inputRef = React20.useRef(null);
|
|
5415
|
+
const selectedOption = React20.useMemo(
|
|
4972
5416
|
() => options.find((opt) => opt.value === value),
|
|
4973
5417
|
[options, value]
|
|
4974
5418
|
);
|
|
4975
|
-
const filteredOptions =
|
|
5419
|
+
const filteredOptions = React20.useMemo(() => {
|
|
4976
5420
|
if (!search.trim()) return options;
|
|
4977
5421
|
const searchLower = search.toLowerCase();
|
|
4978
5422
|
return options.filter(
|
|
4979
5423
|
(opt) => opt.label.toLowerCase().includes(searchLower) || opt.description?.toLowerCase().includes(searchLower)
|
|
4980
5424
|
);
|
|
4981
5425
|
}, [options, search]);
|
|
4982
|
-
const groupedOptions =
|
|
5426
|
+
const groupedOptions = React20.useMemo(() => {
|
|
4983
5427
|
const groups = {};
|
|
4984
5428
|
const ungrouped = [];
|
|
4985
5429
|
filteredOptions.forEach((opt) => {
|
|
@@ -4993,7 +5437,7 @@ function Autocomplete({
|
|
|
4993
5437
|
return { groups, ungrouped };
|
|
4994
5438
|
}, [filteredOptions]);
|
|
4995
5439
|
const hasGroups = Object.keys(groupedOptions.groups).length > 0;
|
|
4996
|
-
const handleSelect =
|
|
5440
|
+
const handleSelect = React20.useCallback(
|
|
4997
5441
|
(optionValue) => {
|
|
4998
5442
|
onChange?.(optionValue);
|
|
4999
5443
|
setOpen(false);
|
|
@@ -5001,7 +5445,7 @@ function Autocomplete({
|
|
|
5001
5445
|
},
|
|
5002
5446
|
[onChange]
|
|
5003
5447
|
);
|
|
5004
|
-
const handleClear =
|
|
5448
|
+
const handleClear = React20.useCallback(
|
|
5005
5449
|
(e) => {
|
|
5006
5450
|
e.stopPropagation();
|
|
5007
5451
|
onChange?.(void 0);
|
|
@@ -5009,7 +5453,7 @@ function Autocomplete({
|
|
|
5009
5453
|
},
|
|
5010
5454
|
[onChange]
|
|
5011
5455
|
);
|
|
5012
|
-
|
|
5456
|
+
React20.useEffect(() => {
|
|
5013
5457
|
if (open) {
|
|
5014
5458
|
const timeout = setTimeout(() => {
|
|
5015
5459
|
inputRef.current?.focus();
|
|
@@ -5019,7 +5463,7 @@ function Autocomplete({
|
|
|
5019
5463
|
setSearch("");
|
|
5020
5464
|
}
|
|
5021
5465
|
}, [open]);
|
|
5022
|
-
const handleKeyDown =
|
|
5466
|
+
const handleKeyDown = React20.useCallback((e) => {
|
|
5023
5467
|
if (e.key === "Escape") {
|
|
5024
5468
|
setOpen(false);
|
|
5025
5469
|
}
|
|
@@ -5195,7 +5639,7 @@ var iconButtonVariants = cva(
|
|
|
5195
5639
|
}
|
|
5196
5640
|
}
|
|
5197
5641
|
);
|
|
5198
|
-
var IconButton =
|
|
5642
|
+
var IconButton = React20.forwardRef(
|
|
5199
5643
|
({ className, variant, size, isActive = false, icon, children, ...props }, ref) => {
|
|
5200
5644
|
return /* @__PURE__ */ jsx(
|
|
5201
5645
|
"button",
|
|
@@ -5219,7 +5663,7 @@ var IconButton = React34.forwardRef(
|
|
|
5219
5663
|
);
|
|
5220
5664
|
IconButton.displayName = "IconButton";
|
|
5221
5665
|
function CopyButton({ content, className, size = "md" }) {
|
|
5222
|
-
const [copied, setCopied] =
|
|
5666
|
+
const [copied, setCopied] = React20.useState(false);
|
|
5223
5667
|
const handleCopy = async () => {
|
|
5224
5668
|
try {
|
|
5225
5669
|
await navigator.clipboard.writeText(content);
|
|
@@ -5992,11 +6436,11 @@ function ThemePicker({
|
|
|
5992
6436
|
align = "end",
|
|
5993
6437
|
side = "bottom"
|
|
5994
6438
|
}) {
|
|
5995
|
-
const [open, setOpen] =
|
|
5996
|
-
const [selectedTheme, setSelectedTheme] =
|
|
6439
|
+
const [open, setOpen] = React20.useState(false);
|
|
6440
|
+
const [selectedTheme, setSelectedTheme] = React20.useState(
|
|
5997
6441
|
value || themes[0]
|
|
5998
6442
|
);
|
|
5999
|
-
|
|
6443
|
+
React20.useEffect(() => {
|
|
6000
6444
|
if (value) {
|
|
6001
6445
|
setSelectedTheme(value);
|
|
6002
6446
|
}
|
|
@@ -6106,19 +6550,19 @@ function getSafePosition(x, y, menuWidth, menuHeight) {
|
|
|
6106
6550
|
return { x: safeX, y: safeY };
|
|
6107
6551
|
}
|
|
6108
6552
|
function MenuItem({ item, onClose, depth = 0 }) {
|
|
6109
|
-
const [isSubmenuOpen, setIsSubmenuOpen] =
|
|
6110
|
-
const [submenuPosition, setSubmenuPosition] =
|
|
6111
|
-
const itemRef =
|
|
6112
|
-
const hoverTimeoutRef =
|
|
6553
|
+
const [isSubmenuOpen, setIsSubmenuOpen] = React20.useState(false);
|
|
6554
|
+
const [submenuPosition, setSubmenuPosition] = React20.useState(null);
|
|
6555
|
+
const itemRef = React20.useRef(null);
|
|
6556
|
+
const hoverTimeoutRef = React20.useRef(null);
|
|
6113
6557
|
const hasSubmenu = item.submenu && item.submenu.length > 0;
|
|
6114
|
-
|
|
6558
|
+
React20.useEffect(() => {
|
|
6115
6559
|
return () => {
|
|
6116
6560
|
if (hoverTimeoutRef.current) {
|
|
6117
6561
|
clearTimeout(hoverTimeoutRef.current);
|
|
6118
6562
|
}
|
|
6119
6563
|
};
|
|
6120
6564
|
}, []);
|
|
6121
|
-
const handleMouseEnter =
|
|
6565
|
+
const handleMouseEnter = React20.useCallback(() => {
|
|
6122
6566
|
if (hoverTimeoutRef.current) {
|
|
6123
6567
|
clearTimeout(hoverTimeoutRef.current);
|
|
6124
6568
|
}
|
|
@@ -6138,22 +6582,22 @@ function MenuItem({ item, onClose, depth = 0 }) {
|
|
|
6138
6582
|
setIsSubmenuOpen(true);
|
|
6139
6583
|
}
|
|
6140
6584
|
}, [hasSubmenu, item.submenu?.length]);
|
|
6141
|
-
const handleMouseLeave =
|
|
6585
|
+
const handleMouseLeave = React20.useCallback(() => {
|
|
6142
6586
|
hoverTimeoutRef.current = setTimeout(() => {
|
|
6143
6587
|
setIsSubmenuOpen(false);
|
|
6144
6588
|
}, 100);
|
|
6145
6589
|
}, []);
|
|
6146
|
-
const handleSubmenuMouseEnter =
|
|
6590
|
+
const handleSubmenuMouseEnter = React20.useCallback(() => {
|
|
6147
6591
|
if (hoverTimeoutRef.current) {
|
|
6148
6592
|
clearTimeout(hoverTimeoutRef.current);
|
|
6149
6593
|
}
|
|
6150
6594
|
}, []);
|
|
6151
|
-
const handleSubmenuMouseLeave =
|
|
6595
|
+
const handleSubmenuMouseLeave = React20.useCallback(() => {
|
|
6152
6596
|
hoverTimeoutRef.current = setTimeout(() => {
|
|
6153
6597
|
setIsSubmenuOpen(false);
|
|
6154
6598
|
}, 100);
|
|
6155
6599
|
}, []);
|
|
6156
|
-
const handleClick =
|
|
6600
|
+
const handleClick = React20.useCallback(() => {
|
|
6157
6601
|
if (item.disabled) return;
|
|
6158
6602
|
if (!hasSubmenu && item.action) {
|
|
6159
6603
|
item.action();
|
|
@@ -6233,12 +6677,12 @@ function ContextMenu({
|
|
|
6233
6677
|
anchorEl,
|
|
6234
6678
|
className
|
|
6235
6679
|
}) {
|
|
6236
|
-
const menuRef =
|
|
6237
|
-
const [menuPosition, setMenuPosition] =
|
|
6680
|
+
const menuRef = React20.useRef(null);
|
|
6681
|
+
const [menuPosition, setMenuPosition] = React20.useState({
|
|
6238
6682
|
x: 0,
|
|
6239
6683
|
y: 0
|
|
6240
6684
|
});
|
|
6241
|
-
|
|
6685
|
+
React20.useEffect(() => {
|
|
6242
6686
|
if (!isOpen) return;
|
|
6243
6687
|
let x = position.x;
|
|
6244
6688
|
let y = position.y;
|
|
@@ -6257,7 +6701,7 @@ function ContextMenu({
|
|
|
6257
6701
|
}
|
|
6258
6702
|
});
|
|
6259
6703
|
}, [isOpen, position, anchorEl]);
|
|
6260
|
-
|
|
6704
|
+
React20.useEffect(() => {
|
|
6261
6705
|
if (!isOpen) return;
|
|
6262
6706
|
const handleClickOutside = (e) => {
|
|
6263
6707
|
if (menuRef.current && !menuRef.current.contains(e.target)) {
|
|
@@ -6301,16 +6745,16 @@ function ContextMenu({
|
|
|
6301
6745
|
);
|
|
6302
6746
|
}
|
|
6303
6747
|
function useContextMenu() {
|
|
6304
|
-
const [isOpen, setIsOpen] =
|
|
6305
|
-
const [position, setPosition] =
|
|
6306
|
-
const [targetItem, setTargetItem] =
|
|
6307
|
-
const menuRef =
|
|
6308
|
-
const openMenu =
|
|
6748
|
+
const [isOpen, setIsOpen] = React20.useState(false);
|
|
6749
|
+
const [position, setPosition] = React20.useState({ x: 0, y: 0 });
|
|
6750
|
+
const [targetItem, setTargetItem] = React20.useState(null);
|
|
6751
|
+
const menuRef = React20.useRef(null);
|
|
6752
|
+
const openMenu = React20.useCallback((x, y, item) => {
|
|
6309
6753
|
setPosition({ x, y });
|
|
6310
6754
|
setTargetItem(item);
|
|
6311
6755
|
setIsOpen(true);
|
|
6312
6756
|
}, []);
|
|
6313
|
-
const closeMenu =
|
|
6757
|
+
const closeMenu = React20.useCallback(() => {
|
|
6314
6758
|
setIsOpen(false);
|
|
6315
6759
|
setTargetItem(null);
|
|
6316
6760
|
}, []);
|
|
@@ -6324,6 +6768,6 @@ function useContextMenu() {
|
|
|
6324
6768
|
};
|
|
6325
6769
|
}
|
|
6326
6770
|
|
|
6327
|
-
export { ALL_THEMES, Accordion, AccordionContent, AccordionItem, AccordionTrigger, AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger, Autocomplete, Badge, Board, BoardContent, BoardHeader, Button, CYBERPUNK_THEME, Calendar, Card, CardActions, CardContent, CardDescription, CardFooter, CardGrid, CardHeader, CardImage, CardList, CardTitle, CellEditor, Checkbox, Chip, ConfirmationModal, ContextMenu, CopyButton, DARK_ELEGANT_THEME, DataGrid, DatePicker, DatePickerInput, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, FOREST_THEME, FUTURISTIC_THEME, FilterPopover, GREEN_THEME, HeaderCell, IconButton, Input, Label, LoadingSpinner, MINIMALIST_LIGHT_THEME, Modal, ModalButton, NATURE_THEME, OCEAN_THEME, OPTILOGIC_LEGACY_THEME, PRESET_THEMES, Popover, PopoverAnchor, PopoverContent, PopoverTrigger, Progress, ResizablePanel, ResizeHandle, SCIFI_THEME, SUNSET_THEME, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, SelectableCard, Separator, Skeleton, Switch, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, Textarea, ThemePicker, Toaster, Tooltip, TooltipArrow, TooltipContent, TooltipPortal, TooltipProvider, TooltipRoot, TooltipTrigger, accordionContentVariants, accordionItemVariants, accordionTriggerVariants, applyFilterOperator, applyFilters, applySorting, applyTheme, areThemesEqual, badgeVariants, boardVariants, buttonVariants, cardActionsVariants, cardGridVariants, cardImageVariants, cardListVariants, cardVariants, cloneTheme, cn, exportTheme, getCellValue, getCurrentTheme, getDefaultTheme, getPresetTheme, hexToHsl, iconButtonVariants, importTheme, isPresetTheme, labelVariants, loadingSpinnerVariants, themeToHsl, useColumnResize, useColumnResizeManager, useConfirmation, useContextMenu, useDataGridState, useKeyboardNavigation, validateTheme };
|
|
6771
|
+
export { ALL_THEMES, Accordion, AccordionContent, AccordionItem, AccordionTrigger, AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger, Autocomplete, Badge, Board, BoardContent, BoardHeader, Button, CYBERPUNK_THEME, Calendar, Card, CardActions, CardContent, CardDescription, CardFooter, CardGrid, CardHeader, CardImage, CardList, CardTitle, CellEditor, Checkbox, Chip, ConfirmationModal, ContextMenu, CopyButton, DARK_ELEGANT_THEME, DataGrid, DataTable, DatePicker, DatePickerInput, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, FOREST_THEME, FUTURISTIC_THEME, FilterPopover, GREEN_THEME, HeaderCell, IconButton, Input, Label, LoadingSpinner, MINIMALIST_LIGHT_THEME, Modal, ModalButton, NATURE_THEME, OCEAN_THEME, OPTILOGIC_LEGACY_THEME, PRESET_THEMES, Popover, PopoverAnchor, PopoverContent, PopoverTrigger, Progress, ResizablePanel, ResizeHandle, SCIFI_THEME, SUNSET_THEME, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, SelectableCard, Separator, Skeleton, Switch, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, Textarea, ThemePicker, Toaster, Tooltip, TooltipArrow, TooltipContent, TooltipPortal, TooltipProvider, TooltipRoot, TooltipTrigger, accordionContentVariants, accordionItemVariants, accordionTriggerVariants, applyFilterOperator, applyFilters, applySorting, applyTheme, areThemesEqual, badgeVariants, boardVariants, buttonVariants, cardActionsVariants, cardGridVariants, cardImageVariants, cardListVariants, cardVariants, cloneTheme, cn, exportTheme, getCellValue, getCurrentTheme, getDefaultTheme, getPresetTheme, hexToHsl, iconButtonVariants, importTheme, isPresetTheme, labelVariants, loadingSpinnerVariants, themeToHsl, useColumnResize, useColumnResizeManager, useConfirmation, useContextMenu, useDataGridState, useKeyboardNavigation, validateTheme };
|
|
6328
6772
|
//# sourceMappingURL=index.js.map
|
|
6329
6773
|
//# sourceMappingURL=index.js.map
|