@optilogic/core 1.0.0-beta.1 → 1.0.0-beta.11
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/README.md +10 -7
- package/dist/index.cjs +1244 -284
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +412 -6
- package/dist/index.d.ts +412 -6
- package/dist/index.js +1179 -234
- package/dist/index.js.map +1 -1
- package/dist/styles.css +61 -0
- package/package.json +20 -56
- package/src/components/board.tsx +251 -0
- package/src/components/card.tsx +656 -12
- package/src/components/context-menu.tsx +1 -1
- package/src/components/data-grid/hooks/useKeyboardNavigation.ts +1 -1
- package/src/components/data-table.tsx +735 -0
- package/src/index.ts +40 -0
- package/src/styles.css +61 -0
package/dist/index.cjs
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
var clsx = require('clsx');
|
|
4
4
|
var tailwindMerge = require('tailwind-merge');
|
|
5
|
-
var
|
|
5
|
+
var React20 = require('react');
|
|
6
6
|
var reactSlot = require('@radix-ui/react-slot');
|
|
7
7
|
var classVarianceAuthority = require('class-variance-authority');
|
|
8
8
|
var jsxRuntime = require('react/jsx-runtime');
|
|
@@ -42,7 +42,7 @@ function _interopNamespace(e) {
|
|
|
42
42
|
return Object.freeze(n);
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
-
var
|
|
45
|
+
var React20__namespace = /*#__PURE__*/_interopNamespace(React20);
|
|
46
46
|
var LabelPrimitive__namespace = /*#__PURE__*/_interopNamespace(LabelPrimitive);
|
|
47
47
|
var CheckboxPrimitive__namespace = /*#__PURE__*/_interopNamespace(CheckboxPrimitive);
|
|
48
48
|
var SwitchPrimitive__namespace = /*#__PURE__*/_interopNamespace(SwitchPrimitive);
|
|
@@ -86,7 +86,7 @@ var buttonVariants = classVarianceAuthority.cva(
|
|
|
86
86
|
}
|
|
87
87
|
}
|
|
88
88
|
);
|
|
89
|
-
var Button =
|
|
89
|
+
var Button = React20__namespace.forwardRef(
|
|
90
90
|
({ className, variant, size, asChild = false, ...props }, ref) => {
|
|
91
91
|
const Comp = asChild ? reactSlot.Slot : "button";
|
|
92
92
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -100,7 +100,7 @@ var Button = React33__namespace.forwardRef(
|
|
|
100
100
|
}
|
|
101
101
|
);
|
|
102
102
|
Button.displayName = "Button";
|
|
103
|
-
var Input =
|
|
103
|
+
var Input = React20__namespace.forwardRef(
|
|
104
104
|
({ className, type, ...props }, ref) => {
|
|
105
105
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
106
106
|
"input",
|
|
@@ -120,7 +120,7 @@ Input.displayName = "Input";
|
|
|
120
120
|
var labelVariants = classVarianceAuthority.cva(
|
|
121
121
|
"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
|
|
122
122
|
);
|
|
123
|
-
var Label =
|
|
123
|
+
var Label = React20__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
124
124
|
LabelPrimitive__namespace.Root,
|
|
125
125
|
{
|
|
126
126
|
ref,
|
|
@@ -129,7 +129,7 @@ var Label = React33__namespace.forwardRef(({ className, ...props }, ref) => /* @
|
|
|
129
129
|
}
|
|
130
130
|
));
|
|
131
131
|
Label.displayName = LabelPrimitive__namespace.Root.displayName;
|
|
132
|
-
var Textarea =
|
|
132
|
+
var Textarea = React20__namespace.forwardRef(
|
|
133
133
|
({ className, ...props }, ref) => {
|
|
134
134
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
135
135
|
"textarea",
|
|
@@ -168,7 +168,7 @@ var badgeVariants = classVarianceAuthority.cva(
|
|
|
168
168
|
function Badge({ className, variant, ...props }) {
|
|
169
169
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn(badgeVariants({ variant }), className), ...props });
|
|
170
170
|
}
|
|
171
|
-
var Checkbox =
|
|
171
|
+
var Checkbox = React20__namespace.forwardRef(({ className, showBorder = true, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
172
172
|
CheckboxPrimitive__namespace.Root,
|
|
173
173
|
{
|
|
174
174
|
ref,
|
|
@@ -212,7 +212,7 @@ var Checkbox = React33__namespace.forwardRef(({ className, showBorder = true, ..
|
|
|
212
212
|
}
|
|
213
213
|
));
|
|
214
214
|
Checkbox.displayName = CheckboxPrimitive__namespace.Root.displayName;
|
|
215
|
-
var Switch =
|
|
215
|
+
var Switch = React20__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
216
216
|
SwitchPrimitive__namespace.Root,
|
|
217
217
|
{
|
|
218
218
|
className: cn(
|
|
@@ -248,7 +248,7 @@ var Switch = React33__namespace.forwardRef(({ className, ...props }, ref) => /*
|
|
|
248
248
|
}
|
|
249
249
|
));
|
|
250
250
|
Switch.displayName = SwitchPrimitive__namespace.Root.displayName;
|
|
251
|
-
var Progress =
|
|
251
|
+
var Progress = React20__namespace.forwardRef(({ className, value, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
252
252
|
ProgressPrimitive__namespace.Root,
|
|
253
253
|
{
|
|
254
254
|
ref,
|
|
@@ -267,7 +267,7 @@ var Progress = React33__namespace.forwardRef(({ className, value, ...props }, re
|
|
|
267
267
|
}
|
|
268
268
|
));
|
|
269
269
|
Progress.displayName = ProgressPrimitive__namespace.Root.displayName;
|
|
270
|
-
var Separator =
|
|
270
|
+
var Separator = React20__namespace.forwardRef(
|
|
271
271
|
({ className, orientation = "horizontal", decorative = true, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
272
272
|
SeparatorPrimitive__namespace.Root,
|
|
273
273
|
{
|
|
@@ -296,7 +296,7 @@ function Skeleton({ className, ...props }) {
|
|
|
296
296
|
var Select = SelectPrimitive__namespace.Root;
|
|
297
297
|
var SelectGroup = SelectPrimitive__namespace.Group;
|
|
298
298
|
var SelectValue = SelectPrimitive__namespace.Value;
|
|
299
|
-
var SelectTrigger =
|
|
299
|
+
var SelectTrigger = React20__namespace.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
300
300
|
SelectPrimitive__namespace.Trigger,
|
|
301
301
|
{
|
|
302
302
|
ref,
|
|
@@ -312,7 +312,7 @@ var SelectTrigger = React33__namespace.forwardRef(({ className, children, ...pro
|
|
|
312
312
|
}
|
|
313
313
|
));
|
|
314
314
|
SelectTrigger.displayName = SelectPrimitive__namespace.Trigger.displayName;
|
|
315
|
-
var SelectScrollUpButton =
|
|
315
|
+
var SelectScrollUpButton = React20__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
316
316
|
SelectPrimitive__namespace.ScrollUpButton,
|
|
317
317
|
{
|
|
318
318
|
ref,
|
|
@@ -325,7 +325,7 @@ var SelectScrollUpButton = React33__namespace.forwardRef(({ className, ...props
|
|
|
325
325
|
}
|
|
326
326
|
));
|
|
327
327
|
SelectScrollUpButton.displayName = SelectPrimitive__namespace.ScrollUpButton.displayName;
|
|
328
|
-
var SelectScrollDownButton =
|
|
328
|
+
var SelectScrollDownButton = React20__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
329
329
|
SelectPrimitive__namespace.ScrollDownButton,
|
|
330
330
|
{
|
|
331
331
|
ref,
|
|
@@ -338,7 +338,7 @@ var SelectScrollDownButton = React33__namespace.forwardRef(({ className, ...prop
|
|
|
338
338
|
}
|
|
339
339
|
));
|
|
340
340
|
SelectScrollDownButton.displayName = SelectPrimitive__namespace.ScrollDownButton.displayName;
|
|
341
|
-
var SelectContent =
|
|
341
|
+
var SelectContent = React20__namespace.forwardRef(({ className, children, position = "popper", ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(SelectPrimitive__namespace.Portal, { children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
342
342
|
SelectPrimitive__namespace.Content,
|
|
343
343
|
{
|
|
344
344
|
ref,
|
|
@@ -366,7 +366,7 @@ var SelectContent = React33__namespace.forwardRef(({ className, children, positi
|
|
|
366
366
|
}
|
|
367
367
|
) }));
|
|
368
368
|
SelectContent.displayName = SelectPrimitive__namespace.Content.displayName;
|
|
369
|
-
var SelectLabel =
|
|
369
|
+
var SelectLabel = React20__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
370
370
|
SelectPrimitive__namespace.Label,
|
|
371
371
|
{
|
|
372
372
|
ref,
|
|
@@ -375,7 +375,7 @@ var SelectLabel = React33__namespace.forwardRef(({ className, ...props }, ref) =
|
|
|
375
375
|
}
|
|
376
376
|
));
|
|
377
377
|
SelectLabel.displayName = SelectPrimitive__namespace.Label.displayName;
|
|
378
|
-
var SelectItem =
|
|
378
|
+
var SelectItem = React20__namespace.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
379
379
|
SelectPrimitive__namespace.Item,
|
|
380
380
|
{
|
|
381
381
|
ref,
|
|
@@ -391,7 +391,7 @@ var SelectItem = React33__namespace.forwardRef(({ className, children, ...props
|
|
|
391
391
|
}
|
|
392
392
|
));
|
|
393
393
|
SelectItem.displayName = SelectPrimitive__namespace.Item.displayName;
|
|
394
|
-
var SelectSeparator =
|
|
394
|
+
var SelectSeparator = React20__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
395
395
|
SelectPrimitive__namespace.Separator,
|
|
396
396
|
{
|
|
397
397
|
ref,
|
|
@@ -401,7 +401,7 @@ var SelectSeparator = React33__namespace.forwardRef(({ className, ...props }, re
|
|
|
401
401
|
));
|
|
402
402
|
SelectSeparator.displayName = SelectPrimitive__namespace.Separator.displayName;
|
|
403
403
|
var Tabs = TabsPrimitive__namespace.Root;
|
|
404
|
-
var TabsList =
|
|
404
|
+
var TabsList = React20__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
405
405
|
TabsPrimitive__namespace.List,
|
|
406
406
|
{
|
|
407
407
|
ref,
|
|
@@ -415,7 +415,7 @@ var TabsList = React33__namespace.forwardRef(({ className, ...props }, ref) => /
|
|
|
415
415
|
}
|
|
416
416
|
));
|
|
417
417
|
TabsList.displayName = TabsPrimitive__namespace.List.displayName;
|
|
418
|
-
var TabsTrigger =
|
|
418
|
+
var TabsTrigger = React20__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
419
419
|
TabsPrimitive__namespace.Trigger,
|
|
420
420
|
{
|
|
421
421
|
ref,
|
|
@@ -442,7 +442,7 @@ var TabsTrigger = React33__namespace.forwardRef(({ className, ...props }, ref) =
|
|
|
442
442
|
}
|
|
443
443
|
));
|
|
444
444
|
TabsTrigger.displayName = TabsPrimitive__namespace.Trigger.displayName;
|
|
445
|
-
var TabsContent =
|
|
445
|
+
var TabsContent = React20__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
446
446
|
TabsPrimitive__namespace.Content,
|
|
447
447
|
{
|
|
448
448
|
ref,
|
|
@@ -525,7 +525,7 @@ var accordionContentInnerVariants = classVarianceAuthority.cva("pb-4 pt-0", {
|
|
|
525
525
|
}
|
|
526
526
|
});
|
|
527
527
|
var Accordion = AccordionPrimitive__namespace.Root;
|
|
528
|
-
var AccordionItem =
|
|
528
|
+
var AccordionItem = React20__namespace.forwardRef(({ className, variant, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
529
529
|
AccordionPrimitive__namespace.Item,
|
|
530
530
|
{
|
|
531
531
|
ref,
|
|
@@ -535,7 +535,7 @@ var AccordionItem = React33__namespace.forwardRef(({ className, variant, ...prop
|
|
|
535
535
|
}
|
|
536
536
|
));
|
|
537
537
|
AccordionItem.displayName = "AccordionItem";
|
|
538
|
-
var AccordionTrigger =
|
|
538
|
+
var AccordionTrigger = React20__namespace.forwardRef(({ className, children, variant, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(AccordionPrimitive__namespace.Header, { className: "flex", children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
539
539
|
AccordionPrimitive__namespace.Trigger,
|
|
540
540
|
{
|
|
541
541
|
ref,
|
|
@@ -548,7 +548,7 @@ var AccordionTrigger = React33__namespace.forwardRef(({ className, children, var
|
|
|
548
548
|
}
|
|
549
549
|
) }));
|
|
550
550
|
AccordionTrigger.displayName = AccordionPrimitive__namespace.Trigger.displayName;
|
|
551
|
-
var AccordionContent =
|
|
551
|
+
var AccordionContent = React20__namespace.forwardRef(({ className, children, variant, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
552
552
|
AccordionPrimitive__namespace.Content,
|
|
553
553
|
{
|
|
554
554
|
ref,
|
|
@@ -562,7 +562,7 @@ var TooltipProvider = TooltipPrimitive__namespace.Provider;
|
|
|
562
562
|
var TooltipRoot = TooltipPrimitive__namespace.Root;
|
|
563
563
|
var TooltipTrigger = TooltipPrimitive__namespace.Trigger;
|
|
564
564
|
var TooltipPortal = TooltipPrimitive__namespace.Portal;
|
|
565
|
-
var TooltipContent =
|
|
565
|
+
var TooltipContent = React20__namespace.forwardRef(({ className, sideOffset = 6, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(TooltipPrimitive__namespace.Portal, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
566
566
|
TooltipPrimitive__namespace.Content,
|
|
567
567
|
{
|
|
568
568
|
ref,
|
|
@@ -591,7 +591,7 @@ var TooltipContent = React33__namespace.forwardRef(({ className, sideOffset = 6,
|
|
|
591
591
|
}
|
|
592
592
|
) }));
|
|
593
593
|
TooltipContent.displayName = TooltipPrimitive__namespace.Content.displayName;
|
|
594
|
-
var TooltipArrow =
|
|
594
|
+
var TooltipArrow = React20__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
595
595
|
TooltipPrimitive__namespace.Arrow,
|
|
596
596
|
{
|
|
597
597
|
ref,
|
|
@@ -630,7 +630,7 @@ function Tooltip({
|
|
|
630
630
|
var Popover = PopoverPrimitive__namespace.Root;
|
|
631
631
|
var PopoverTrigger = PopoverPrimitive__namespace.Trigger;
|
|
632
632
|
var PopoverAnchor = PopoverPrimitive__namespace.Anchor;
|
|
633
|
-
var PopoverContent =
|
|
633
|
+
var PopoverContent = React20__namespace.forwardRef(({ className, align = "center", sideOffset = 4, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(PopoverPrimitive__namespace.Portal, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
634
634
|
PopoverPrimitive__namespace.Content,
|
|
635
635
|
{
|
|
636
636
|
ref,
|
|
@@ -656,7 +656,7 @@ var DropdownMenuGroup = DropdownMenuPrimitive__namespace.Group;
|
|
|
656
656
|
var DropdownMenuPortal = DropdownMenuPrimitive__namespace.Portal;
|
|
657
657
|
var DropdownMenuSub = DropdownMenuPrimitive__namespace.Sub;
|
|
658
658
|
var DropdownMenuRadioGroup = DropdownMenuPrimitive__namespace.RadioGroup;
|
|
659
|
-
var DropdownMenuSubTrigger =
|
|
659
|
+
var DropdownMenuSubTrigger = React20__namespace.forwardRef(({ className, inset, children, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
660
660
|
DropdownMenuPrimitive__namespace.SubTrigger,
|
|
661
661
|
{
|
|
662
662
|
ref,
|
|
@@ -675,7 +675,7 @@ var DropdownMenuSubTrigger = React33__namespace.forwardRef(({ className, inset,
|
|
|
675
675
|
}
|
|
676
676
|
));
|
|
677
677
|
DropdownMenuSubTrigger.displayName = DropdownMenuPrimitive__namespace.SubTrigger.displayName;
|
|
678
|
-
var DropdownMenuSubContent =
|
|
678
|
+
var DropdownMenuSubContent = React20__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
679
679
|
DropdownMenuPrimitive__namespace.SubContent,
|
|
680
680
|
{
|
|
681
681
|
ref,
|
|
@@ -692,7 +692,7 @@ var DropdownMenuSubContent = React33__namespace.forwardRef(({ className, ...prop
|
|
|
692
692
|
}
|
|
693
693
|
));
|
|
694
694
|
DropdownMenuSubContent.displayName = DropdownMenuPrimitive__namespace.SubContent.displayName;
|
|
695
|
-
var DropdownMenuContent =
|
|
695
|
+
var DropdownMenuContent = React20__namespace.forwardRef(({ className, sideOffset = 4, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(DropdownMenuPrimitive__namespace.Portal, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
696
696
|
DropdownMenuPrimitive__namespace.Content,
|
|
697
697
|
{
|
|
698
698
|
ref,
|
|
@@ -710,7 +710,7 @@ var DropdownMenuContent = React33__namespace.forwardRef(({ className, sideOffset
|
|
|
710
710
|
}
|
|
711
711
|
) }));
|
|
712
712
|
DropdownMenuContent.displayName = DropdownMenuPrimitive__namespace.Content.displayName;
|
|
713
|
-
var DropdownMenuItem =
|
|
713
|
+
var DropdownMenuItem = React20__namespace.forwardRef(({ className, inset, destructive, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
714
714
|
DropdownMenuPrimitive__namespace.Item,
|
|
715
715
|
{
|
|
716
716
|
ref,
|
|
@@ -726,7 +726,7 @@ var DropdownMenuItem = React33__namespace.forwardRef(({ className, inset, destru
|
|
|
726
726
|
}
|
|
727
727
|
));
|
|
728
728
|
DropdownMenuItem.displayName = DropdownMenuPrimitive__namespace.Item.displayName;
|
|
729
|
-
var DropdownMenuCheckboxItem =
|
|
729
|
+
var DropdownMenuCheckboxItem = React20__namespace.forwardRef(({ className, children, checked, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
730
730
|
DropdownMenuPrimitive__namespace.CheckboxItem,
|
|
731
731
|
{
|
|
732
732
|
ref,
|
|
@@ -745,7 +745,7 @@ var DropdownMenuCheckboxItem = React33__namespace.forwardRef(({ className, child
|
|
|
745
745
|
}
|
|
746
746
|
));
|
|
747
747
|
DropdownMenuCheckboxItem.displayName = DropdownMenuPrimitive__namespace.CheckboxItem.displayName;
|
|
748
|
-
var DropdownMenuRadioItem =
|
|
748
|
+
var DropdownMenuRadioItem = React20__namespace.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
749
749
|
DropdownMenuPrimitive__namespace.RadioItem,
|
|
750
750
|
{
|
|
751
751
|
ref,
|
|
@@ -763,7 +763,7 @@ var DropdownMenuRadioItem = React33__namespace.forwardRef(({ className, children
|
|
|
763
763
|
}
|
|
764
764
|
));
|
|
765
765
|
DropdownMenuRadioItem.displayName = DropdownMenuPrimitive__namespace.RadioItem.displayName;
|
|
766
|
-
var DropdownMenuLabel =
|
|
766
|
+
var DropdownMenuLabel = React20__namespace.forwardRef(({ className, inset, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
767
767
|
DropdownMenuPrimitive__namespace.Label,
|
|
768
768
|
{
|
|
769
769
|
ref,
|
|
@@ -776,7 +776,7 @@ var DropdownMenuLabel = React33__namespace.forwardRef(({ className, inset, ...pr
|
|
|
776
776
|
}
|
|
777
777
|
));
|
|
778
778
|
DropdownMenuLabel.displayName = DropdownMenuPrimitive__namespace.Label.displayName;
|
|
779
|
-
var DropdownMenuSeparator =
|
|
779
|
+
var DropdownMenuSeparator = React20__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
780
780
|
DropdownMenuPrimitive__namespace.Separator,
|
|
781
781
|
{
|
|
782
782
|
ref,
|
|
@@ -801,7 +801,7 @@ DropdownMenuShortcut.displayName = "DropdownMenuShortcut";
|
|
|
801
801
|
var AlertDialog = AlertDialogPrimitive__namespace.Root;
|
|
802
802
|
var AlertDialogTrigger = AlertDialogPrimitive__namespace.Trigger;
|
|
803
803
|
var AlertDialogPortal = AlertDialogPrimitive__namespace.Portal;
|
|
804
|
-
var AlertDialogOverlay =
|
|
804
|
+
var AlertDialogOverlay = React20__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
805
805
|
AlertDialogPrimitive__namespace.Overlay,
|
|
806
806
|
{
|
|
807
807
|
className: cn(
|
|
@@ -815,7 +815,7 @@ var AlertDialogOverlay = React33__namespace.forwardRef(({ className, ...props },
|
|
|
815
815
|
}
|
|
816
816
|
));
|
|
817
817
|
AlertDialogOverlay.displayName = AlertDialogPrimitive__namespace.Overlay.displayName;
|
|
818
|
-
var AlertDialogContent =
|
|
818
|
+
var AlertDialogContent = React20__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsxs(AlertDialogPortal, { children: [
|
|
819
819
|
/* @__PURE__ */ jsxRuntime.jsx(AlertDialogOverlay, {}),
|
|
820
820
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
821
821
|
AlertDialogPrimitive__namespace.Content,
|
|
@@ -858,7 +858,7 @@ var AlertDialogFooter = ({ className, ...props }) => /* @__PURE__ */ jsxRuntime.
|
|
|
858
858
|
}
|
|
859
859
|
);
|
|
860
860
|
AlertDialogFooter.displayName = "AlertDialogFooter";
|
|
861
|
-
var AlertDialogTitle =
|
|
861
|
+
var AlertDialogTitle = React20__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
862
862
|
AlertDialogPrimitive__namespace.Title,
|
|
863
863
|
{
|
|
864
864
|
ref,
|
|
@@ -867,7 +867,7 @@ var AlertDialogTitle = React33__namespace.forwardRef(({ className, ...props }, r
|
|
|
867
867
|
}
|
|
868
868
|
));
|
|
869
869
|
AlertDialogTitle.displayName = AlertDialogPrimitive__namespace.Title.displayName;
|
|
870
|
-
var AlertDialogDescription =
|
|
870
|
+
var AlertDialogDescription = React20__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
871
871
|
AlertDialogPrimitive__namespace.Description,
|
|
872
872
|
{
|
|
873
873
|
ref,
|
|
@@ -876,7 +876,7 @@ var AlertDialogDescription = React33__namespace.forwardRef(({ className, ...prop
|
|
|
876
876
|
}
|
|
877
877
|
));
|
|
878
878
|
AlertDialogDescription.displayName = AlertDialogPrimitive__namespace.Description.displayName;
|
|
879
|
-
var AlertDialogAction =
|
|
879
|
+
var AlertDialogAction = React20__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
880
880
|
AlertDialogPrimitive__namespace.Action,
|
|
881
881
|
{
|
|
882
882
|
ref,
|
|
@@ -885,7 +885,7 @@ var AlertDialogAction = React33__namespace.forwardRef(({ className, ...props },
|
|
|
885
885
|
}
|
|
886
886
|
));
|
|
887
887
|
AlertDialogAction.displayName = AlertDialogPrimitive__namespace.Action.displayName;
|
|
888
|
-
var AlertDialogCancel =
|
|
888
|
+
var AlertDialogCancel = React20__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
889
889
|
AlertDialogPrimitive__namespace.Cancel,
|
|
890
890
|
{
|
|
891
891
|
ref,
|
|
@@ -894,21 +894,107 @@ var AlertDialogCancel = React33__namespace.forwardRef(({ className, ...props },
|
|
|
894
894
|
}
|
|
895
895
|
));
|
|
896
896
|
AlertDialogCancel.displayName = AlertDialogPrimitive__namespace.Cancel.displayName;
|
|
897
|
-
var
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
{
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
897
|
+
var cardVariants = classVarianceAuthority.cva(
|
|
898
|
+
"rounded-xl border bg-card text-card-foreground shadow",
|
|
899
|
+
{
|
|
900
|
+
variants: {
|
|
901
|
+
/**
|
|
902
|
+
* Card width size presets
|
|
903
|
+
*/
|
|
904
|
+
size: {
|
|
905
|
+
auto: "",
|
|
906
|
+
sm: "w-64",
|
|
907
|
+
md: "w-80",
|
|
908
|
+
lg: "w-96",
|
|
909
|
+
xl: "w-[28rem]",
|
|
910
|
+
full: "w-full"
|
|
911
|
+
},
|
|
912
|
+
/**
|
|
913
|
+
* Hover effect styles
|
|
914
|
+
*/
|
|
915
|
+
hover: {
|
|
916
|
+
none: "",
|
|
917
|
+
lift: "transition-all duration-200 hover:-translate-y-1 hover:shadow-lg",
|
|
918
|
+
glow: "transition-shadow duration-200 hover:shadow-lg hover:shadow-accent/20",
|
|
919
|
+
border: "transition-colors duration-200 hover:border-accent",
|
|
920
|
+
"border-success": "transition-colors duration-200 hover:border-success",
|
|
921
|
+
"border-warning": "transition-colors duration-200 hover:border-warning",
|
|
922
|
+
"border-destructive": "transition-colors duration-200 hover:border-destructive",
|
|
923
|
+
"border-muted": "transition-colors duration-200 hover:border-muted-foreground",
|
|
924
|
+
scale: "transition-transform duration-200 hover:scale-[1.02]"
|
|
925
|
+
},
|
|
926
|
+
/**
|
|
927
|
+
* Whether the card is interactive (clickable)
|
|
928
|
+
*/
|
|
929
|
+
interactive: {
|
|
930
|
+
true: "cursor-pointer focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
|
|
931
|
+
false: ""
|
|
932
|
+
},
|
|
933
|
+
/**
|
|
934
|
+
* Card padding density
|
|
935
|
+
*/
|
|
936
|
+
padding: {
|
|
937
|
+
none: "",
|
|
938
|
+
sm: "[&>*:not(img)]:p-3 [&>*:not(img)]:pt-3",
|
|
939
|
+
md: "",
|
|
940
|
+
lg: "[&>*:not(img)]:p-8 [&>*:not(img)]:pt-8"
|
|
941
|
+
}
|
|
942
|
+
},
|
|
943
|
+
defaultVariants: {
|
|
944
|
+
size: "auto",
|
|
945
|
+
hover: "none",
|
|
946
|
+
interactive: false,
|
|
947
|
+
padding: "md"
|
|
907
948
|
}
|
|
908
|
-
|
|
949
|
+
}
|
|
950
|
+
);
|
|
951
|
+
var Card = React20__namespace.forwardRef(
|
|
952
|
+
({
|
|
953
|
+
className,
|
|
954
|
+
size,
|
|
955
|
+
hover,
|
|
956
|
+
interactive,
|
|
957
|
+
padding,
|
|
958
|
+
asButton,
|
|
959
|
+
hoverBorderClass,
|
|
960
|
+
onClick,
|
|
961
|
+
onKeyDown,
|
|
962
|
+
...props
|
|
963
|
+
}, ref) => {
|
|
964
|
+
const isInteractive = interactive || asButton || !!onClick;
|
|
965
|
+
const handleKeyDown = React20__namespace.useCallback(
|
|
966
|
+
(e) => {
|
|
967
|
+
if (isInteractive && (e.key === "Enter" || e.key === " ")) {
|
|
968
|
+
e.preventDefault();
|
|
969
|
+
onClick?.(e);
|
|
970
|
+
}
|
|
971
|
+
onKeyDown?.(e);
|
|
972
|
+
},
|
|
973
|
+
[isInteractive, onClick, onKeyDown]
|
|
974
|
+
);
|
|
975
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
976
|
+
"div",
|
|
977
|
+
{
|
|
978
|
+
ref,
|
|
979
|
+
role: isInteractive ? "button" : void 0,
|
|
980
|
+
tabIndex: isInteractive ? 0 : void 0,
|
|
981
|
+
className: cn(
|
|
982
|
+
cardVariants({ size, hover, interactive: isInteractive, padding }),
|
|
983
|
+
"group relative",
|
|
984
|
+
// Custom hover border color overrides variant if provided
|
|
985
|
+
hoverBorderClass && "transition-colors duration-200",
|
|
986
|
+
hoverBorderClass,
|
|
987
|
+
className
|
|
988
|
+
),
|
|
989
|
+
onClick,
|
|
990
|
+
onKeyDown: handleKeyDown,
|
|
991
|
+
...props
|
|
992
|
+
}
|
|
993
|
+
);
|
|
994
|
+
}
|
|
909
995
|
);
|
|
910
996
|
Card.displayName = "Card";
|
|
911
|
-
var CardHeader =
|
|
997
|
+
var CardHeader = React20__namespace.forwardRef(
|
|
912
998
|
({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
913
999
|
"div",
|
|
914
1000
|
{
|
|
@@ -919,7 +1005,7 @@ var CardHeader = React33__namespace.forwardRef(
|
|
|
919
1005
|
)
|
|
920
1006
|
);
|
|
921
1007
|
CardHeader.displayName = "CardHeader";
|
|
922
|
-
var CardTitle =
|
|
1008
|
+
var CardTitle = React20__namespace.forwardRef(
|
|
923
1009
|
({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
924
1010
|
"div",
|
|
925
1011
|
{
|
|
@@ -930,7 +1016,7 @@ var CardTitle = React33__namespace.forwardRef(
|
|
|
930
1016
|
)
|
|
931
1017
|
);
|
|
932
1018
|
CardTitle.displayName = "CardTitle";
|
|
933
|
-
var CardDescription =
|
|
1019
|
+
var CardDescription = React20__namespace.forwardRef(
|
|
934
1020
|
({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
935
1021
|
"div",
|
|
936
1022
|
{
|
|
@@ -941,11 +1027,11 @@ var CardDescription = React33__namespace.forwardRef(
|
|
|
941
1027
|
)
|
|
942
1028
|
);
|
|
943
1029
|
CardDescription.displayName = "CardDescription";
|
|
944
|
-
var CardContent =
|
|
1030
|
+
var CardContent = React20__namespace.forwardRef(
|
|
945
1031
|
({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx("div", { ref, className: cn("p-6 pt-0", className), ...props })
|
|
946
1032
|
);
|
|
947
1033
|
CardContent.displayName = "CardContent";
|
|
948
|
-
var CardFooter =
|
|
1034
|
+
var CardFooter = React20__namespace.forwardRef(
|
|
949
1035
|
({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
950
1036
|
"div",
|
|
951
1037
|
{
|
|
@@ -956,7 +1042,422 @@ var CardFooter = React33__namespace.forwardRef(
|
|
|
956
1042
|
)
|
|
957
1043
|
);
|
|
958
1044
|
CardFooter.displayName = "CardFooter";
|
|
959
|
-
var
|
|
1045
|
+
var cardImageVariants = classVarianceAuthority.cva("w-full object-cover", {
|
|
1046
|
+
variants: {
|
|
1047
|
+
/**
|
|
1048
|
+
* Image aspect ratio
|
|
1049
|
+
*/
|
|
1050
|
+
aspectRatio: {
|
|
1051
|
+
auto: "",
|
|
1052
|
+
square: "aspect-square",
|
|
1053
|
+
video: "aspect-video",
|
|
1054
|
+
wide: "aspect-[2/1]",
|
|
1055
|
+
portrait: "aspect-[3/4]"
|
|
1056
|
+
},
|
|
1057
|
+
/**
|
|
1058
|
+
* Image position in the card
|
|
1059
|
+
*/
|
|
1060
|
+
position: {
|
|
1061
|
+
top: "rounded-t-xl",
|
|
1062
|
+
bottom: "rounded-b-xl",
|
|
1063
|
+
fill: "rounded-xl"
|
|
1064
|
+
}
|
|
1065
|
+
},
|
|
1066
|
+
defaultVariants: {
|
|
1067
|
+
aspectRatio: "video",
|
|
1068
|
+
position: "top"
|
|
1069
|
+
}
|
|
1070
|
+
});
|
|
1071
|
+
var CardImage = React20__namespace.forwardRef(
|
|
1072
|
+
({ className, aspectRatio, position, fallback, alt, src, onError, ...props }, ref) => {
|
|
1073
|
+
const [hasError, setHasError] = React20__namespace.useState(false);
|
|
1074
|
+
const handleError = React20__namespace.useCallback(
|
|
1075
|
+
(e) => {
|
|
1076
|
+
setHasError(true);
|
|
1077
|
+
onError?.(e);
|
|
1078
|
+
},
|
|
1079
|
+
[onError]
|
|
1080
|
+
);
|
|
1081
|
+
React20__namespace.useEffect(() => {
|
|
1082
|
+
setHasError(false);
|
|
1083
|
+
}, [src]);
|
|
1084
|
+
if (hasError && fallback) {
|
|
1085
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1086
|
+
"div",
|
|
1087
|
+
{
|
|
1088
|
+
className: cn(
|
|
1089
|
+
"flex items-center justify-center bg-muted",
|
|
1090
|
+
cardImageVariants({ aspectRatio, position }),
|
|
1091
|
+
className
|
|
1092
|
+
),
|
|
1093
|
+
children: fallback
|
|
1094
|
+
}
|
|
1095
|
+
);
|
|
1096
|
+
}
|
|
1097
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1098
|
+
"img",
|
|
1099
|
+
{
|
|
1100
|
+
ref,
|
|
1101
|
+
src,
|
|
1102
|
+
alt,
|
|
1103
|
+
className: cn(cardImageVariants({ aspectRatio, position }), className),
|
|
1104
|
+
onError: handleError,
|
|
1105
|
+
...props
|
|
1106
|
+
}
|
|
1107
|
+
);
|
|
1108
|
+
}
|
|
1109
|
+
);
|
|
1110
|
+
CardImage.displayName = "CardImage";
|
|
1111
|
+
var cardActionsVariants = classVarianceAuthority.cva(
|
|
1112
|
+
"absolute flex items-center gap-1 transition-opacity duration-200 z-10",
|
|
1113
|
+
{
|
|
1114
|
+
variants: {
|
|
1115
|
+
/**
|
|
1116
|
+
* When to show the actions
|
|
1117
|
+
*/
|
|
1118
|
+
showOn: {
|
|
1119
|
+
hover: "opacity-0 group-hover:opacity-100",
|
|
1120
|
+
always: "opacity-100"
|
|
1121
|
+
},
|
|
1122
|
+
/**
|
|
1123
|
+
* Position of the actions overlay
|
|
1124
|
+
*/
|
|
1125
|
+
position: {
|
|
1126
|
+
"top-right": "top-2 right-2",
|
|
1127
|
+
"top-left": "top-2 left-2",
|
|
1128
|
+
"bottom-right": "bottom-2 right-2",
|
|
1129
|
+
"bottom-left": "bottom-2 left-2"
|
|
1130
|
+
},
|
|
1131
|
+
/**
|
|
1132
|
+
* Visual style of the actions container
|
|
1133
|
+
*/
|
|
1134
|
+
variant: {
|
|
1135
|
+
/** Solid background with backdrop blur */
|
|
1136
|
+
floating: "bg-background/90 backdrop-blur-sm rounded-md shadow-sm p-1",
|
|
1137
|
+
/** No background, just spacing */
|
|
1138
|
+
ghost: "p-1",
|
|
1139
|
+
/** Muted bar background */
|
|
1140
|
+
bar: "bg-muted/80 backdrop-blur-sm rounded-md p-1.5",
|
|
1141
|
+
/** No background on container, icons get background on hover */
|
|
1142
|
+
"icon-hover": "p-0 [&>button]:bg-transparent [&>button]:hover:bg-background/90 [&>button]:hover:shadow-sm [&>button]:transition-all"
|
|
1143
|
+
}
|
|
1144
|
+
},
|
|
1145
|
+
defaultVariants: {
|
|
1146
|
+
showOn: "hover",
|
|
1147
|
+
position: "top-right",
|
|
1148
|
+
variant: "floating"
|
|
1149
|
+
}
|
|
1150
|
+
}
|
|
1151
|
+
);
|
|
1152
|
+
var CardActions = React20__namespace.forwardRef(
|
|
1153
|
+
({ className, showOn, position, variant, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
1154
|
+
"div",
|
|
1155
|
+
{
|
|
1156
|
+
ref,
|
|
1157
|
+
className: cn(cardActionsVariants({ showOn, position, variant }), className),
|
|
1158
|
+
onClick: (e) => e.stopPropagation(),
|
|
1159
|
+
...props
|
|
1160
|
+
}
|
|
1161
|
+
)
|
|
1162
|
+
);
|
|
1163
|
+
CardActions.displayName = "CardActions";
|
|
1164
|
+
var SelectableCard = React20__namespace.forwardRef(
|
|
1165
|
+
({
|
|
1166
|
+
className,
|
|
1167
|
+
selected: controlledSelected,
|
|
1168
|
+
defaultSelected = false,
|
|
1169
|
+
onSelectedChange,
|
|
1170
|
+
showCheckbox = false,
|
|
1171
|
+
checkboxPosition = "top-right",
|
|
1172
|
+
disabled = false,
|
|
1173
|
+
children,
|
|
1174
|
+
onClick,
|
|
1175
|
+
hover = "border",
|
|
1176
|
+
...props
|
|
1177
|
+
}, ref) => {
|
|
1178
|
+
const [uncontrolledSelected, setUncontrolledSelected] = React20__namespace.useState(defaultSelected);
|
|
1179
|
+
const isControlled = controlledSelected !== void 0;
|
|
1180
|
+
const isSelected = isControlled ? controlledSelected : uncontrolledSelected;
|
|
1181
|
+
const handleClick = React20__namespace.useCallback(
|
|
1182
|
+
(e) => {
|
|
1183
|
+
if (disabled) return;
|
|
1184
|
+
const newSelected = !isSelected;
|
|
1185
|
+
if (!isControlled) {
|
|
1186
|
+
setUncontrolledSelected(newSelected);
|
|
1187
|
+
}
|
|
1188
|
+
onSelectedChange?.(newSelected);
|
|
1189
|
+
onClick?.(e);
|
|
1190
|
+
},
|
|
1191
|
+
[disabled, isSelected, isControlled, onSelectedChange, onClick]
|
|
1192
|
+
);
|
|
1193
|
+
const handleCheckboxChange = React20__namespace.useCallback(
|
|
1194
|
+
(checked) => {
|
|
1195
|
+
if (disabled) return;
|
|
1196
|
+
const newSelected = checked === true;
|
|
1197
|
+
if (!isControlled) {
|
|
1198
|
+
setUncontrolledSelected(newSelected);
|
|
1199
|
+
}
|
|
1200
|
+
onSelectedChange?.(newSelected);
|
|
1201
|
+
},
|
|
1202
|
+
[disabled, isControlled, onSelectedChange]
|
|
1203
|
+
);
|
|
1204
|
+
const isInline = checkboxPosition === "inline-left";
|
|
1205
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1206
|
+
Card,
|
|
1207
|
+
{
|
|
1208
|
+
ref,
|
|
1209
|
+
className: cn(
|
|
1210
|
+
// Selection styling
|
|
1211
|
+
isSelected && "ring-2 ring-accent border-accent",
|
|
1212
|
+
disabled && "opacity-50 cursor-not-allowed",
|
|
1213
|
+
className
|
|
1214
|
+
),
|
|
1215
|
+
interactive: !disabled,
|
|
1216
|
+
hover: disabled ? "none" : hover,
|
|
1217
|
+
onClick: handleClick,
|
|
1218
|
+
"aria-selected": isSelected,
|
|
1219
|
+
"aria-disabled": disabled,
|
|
1220
|
+
...props,
|
|
1221
|
+
children: [
|
|
1222
|
+
showCheckbox && isInline && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1223
|
+
"div",
|
|
1224
|
+
{
|
|
1225
|
+
className: "flex items-center gap-3 px-4 py-3 border-b border-border/50",
|
|
1226
|
+
onClick: (e) => e.stopPropagation(),
|
|
1227
|
+
children: [
|
|
1228
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1229
|
+
Checkbox,
|
|
1230
|
+
{
|
|
1231
|
+
checked: isSelected,
|
|
1232
|
+
onCheckedChange: handleCheckboxChange,
|
|
1233
|
+
disabled
|
|
1234
|
+
}
|
|
1235
|
+
),
|
|
1236
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-xs text-muted-foreground", children: isSelected ? "Selected" : "Click to select" })
|
|
1237
|
+
]
|
|
1238
|
+
}
|
|
1239
|
+
),
|
|
1240
|
+
showCheckbox && !isInline && /* @__PURE__ */ jsxRuntime.jsx(
|
|
1241
|
+
"div",
|
|
1242
|
+
{
|
|
1243
|
+
className: cn(
|
|
1244
|
+
"absolute z-10 p-1 bg-background/90 backdrop-blur-sm rounded-md",
|
|
1245
|
+
checkboxPosition === "top-left" ? "top-2 left-2" : "top-2 right-2"
|
|
1246
|
+
),
|
|
1247
|
+
onClick: (e) => e.stopPropagation(),
|
|
1248
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1249
|
+
Checkbox,
|
|
1250
|
+
{
|
|
1251
|
+
checked: isSelected,
|
|
1252
|
+
onCheckedChange: handleCheckboxChange,
|
|
1253
|
+
disabled
|
|
1254
|
+
}
|
|
1255
|
+
)
|
|
1256
|
+
}
|
|
1257
|
+
),
|
|
1258
|
+
children
|
|
1259
|
+
]
|
|
1260
|
+
}
|
|
1261
|
+
);
|
|
1262
|
+
}
|
|
1263
|
+
);
|
|
1264
|
+
SelectableCard.displayName = "SelectableCard";
|
|
1265
|
+
var cardGridVariants = classVarianceAuthority.cva("grid", {
|
|
1266
|
+
variants: {
|
|
1267
|
+
/**
|
|
1268
|
+
* Number of columns
|
|
1269
|
+
*/
|
|
1270
|
+
columns: {
|
|
1271
|
+
1: "grid-cols-1",
|
|
1272
|
+
2: "grid-cols-1 sm:grid-cols-2",
|
|
1273
|
+
3: "grid-cols-1 sm:grid-cols-2 lg:grid-cols-3",
|
|
1274
|
+
4: "grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4",
|
|
1275
|
+
auto: "grid-cols-[repeat(auto-fill,minmax(280px,1fr))]"
|
|
1276
|
+
},
|
|
1277
|
+
/**
|
|
1278
|
+
* Gap between cards
|
|
1279
|
+
*/
|
|
1280
|
+
gap: {
|
|
1281
|
+
none: "gap-0",
|
|
1282
|
+
sm: "gap-3",
|
|
1283
|
+
md: "gap-4",
|
|
1284
|
+
lg: "gap-6",
|
|
1285
|
+
xl: "gap-8"
|
|
1286
|
+
}
|
|
1287
|
+
},
|
|
1288
|
+
defaultVariants: {
|
|
1289
|
+
columns: "auto",
|
|
1290
|
+
gap: "md"
|
|
1291
|
+
}
|
|
1292
|
+
});
|
|
1293
|
+
var CardGrid = React20__namespace.forwardRef(
|
|
1294
|
+
({ className, columns, gap, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
1295
|
+
"div",
|
|
1296
|
+
{
|
|
1297
|
+
ref,
|
|
1298
|
+
className: cn(cardGridVariants({ columns, gap }), className),
|
|
1299
|
+
...props
|
|
1300
|
+
}
|
|
1301
|
+
)
|
|
1302
|
+
);
|
|
1303
|
+
CardGrid.displayName = "CardGrid";
|
|
1304
|
+
var cardListVariants = classVarianceAuthority.cva("flex flex-col", {
|
|
1305
|
+
variants: {
|
|
1306
|
+
/**
|
|
1307
|
+
* Gap between cards
|
|
1308
|
+
*/
|
|
1309
|
+
gap: {
|
|
1310
|
+
none: "gap-0",
|
|
1311
|
+
sm: "gap-2",
|
|
1312
|
+
md: "gap-4",
|
|
1313
|
+
lg: "gap-6"
|
|
1314
|
+
},
|
|
1315
|
+
/**
|
|
1316
|
+
* Whether to show dividers between cards
|
|
1317
|
+
*/
|
|
1318
|
+
divided: {
|
|
1319
|
+
true: "[&>*:not(:last-child)]:border-b [&>*:not(:last-child)]:pb-4 [&>*:not(:last-child)]:rounded-b-none",
|
|
1320
|
+
false: ""
|
|
1321
|
+
}
|
|
1322
|
+
},
|
|
1323
|
+
defaultVariants: {
|
|
1324
|
+
gap: "md",
|
|
1325
|
+
divided: false
|
|
1326
|
+
}
|
|
1327
|
+
});
|
|
1328
|
+
var CardList = React20__namespace.forwardRef(
|
|
1329
|
+
({ className, gap, divided, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
1330
|
+
"div",
|
|
1331
|
+
{
|
|
1332
|
+
ref,
|
|
1333
|
+
className: cn(cardListVariants({ gap, divided }), className),
|
|
1334
|
+
...props
|
|
1335
|
+
}
|
|
1336
|
+
)
|
|
1337
|
+
);
|
|
1338
|
+
CardList.displayName = "CardList";
|
|
1339
|
+
var boardVariants = classVarianceAuthority.cva("text-card-foreground", {
|
|
1340
|
+
variants: {
|
|
1341
|
+
/**
|
|
1342
|
+
* Elevation (shadow depth) - similar to MUI Paper
|
|
1343
|
+
*/
|
|
1344
|
+
elevation: {
|
|
1345
|
+
none: "",
|
|
1346
|
+
sm: "shadow-sm",
|
|
1347
|
+
md: "shadow",
|
|
1348
|
+
lg: "shadow-lg",
|
|
1349
|
+
xl: "shadow-xl"
|
|
1350
|
+
},
|
|
1351
|
+
/**
|
|
1352
|
+
* Border style
|
|
1353
|
+
*/
|
|
1354
|
+
border: {
|
|
1355
|
+
none: "",
|
|
1356
|
+
default: "border",
|
|
1357
|
+
muted: "border border-muted"
|
|
1358
|
+
},
|
|
1359
|
+
/**
|
|
1360
|
+
* Padding size
|
|
1361
|
+
*/
|
|
1362
|
+
padding: {
|
|
1363
|
+
none: "",
|
|
1364
|
+
sm: "p-2",
|
|
1365
|
+
md: "p-4",
|
|
1366
|
+
lg: "p-6",
|
|
1367
|
+
xl: "p-8"
|
|
1368
|
+
},
|
|
1369
|
+
/**
|
|
1370
|
+
* Border radius
|
|
1371
|
+
*/
|
|
1372
|
+
radius: {
|
|
1373
|
+
none: "rounded-none",
|
|
1374
|
+
sm: "rounded-sm",
|
|
1375
|
+
md: "rounded-md",
|
|
1376
|
+
lg: "rounded-lg",
|
|
1377
|
+
xl: "rounded-xl",
|
|
1378
|
+
full: "rounded-full"
|
|
1379
|
+
},
|
|
1380
|
+
/**
|
|
1381
|
+
* Background color
|
|
1382
|
+
*/
|
|
1383
|
+
background: {
|
|
1384
|
+
default: "bg-card",
|
|
1385
|
+
muted: "bg-muted",
|
|
1386
|
+
transparent: "bg-transparent"
|
|
1387
|
+
},
|
|
1388
|
+
/**
|
|
1389
|
+
* Hover effect styles
|
|
1390
|
+
*/
|
|
1391
|
+
hover: {
|
|
1392
|
+
none: "",
|
|
1393
|
+
border: "transition-colors duration-200 hover:border-accent",
|
|
1394
|
+
elevate: "transition-shadow duration-200 hover:shadow-lg",
|
|
1395
|
+
"border-success": "transition-colors duration-200 hover:border-success",
|
|
1396
|
+
"border-warning": "transition-colors duration-200 hover:border-warning",
|
|
1397
|
+
"border-destructive": "transition-colors duration-200 hover:border-destructive"
|
|
1398
|
+
}
|
|
1399
|
+
},
|
|
1400
|
+
defaultVariants: {
|
|
1401
|
+
elevation: "none",
|
|
1402
|
+
border: "default",
|
|
1403
|
+
padding: "none",
|
|
1404
|
+
radius: "lg",
|
|
1405
|
+
background: "default",
|
|
1406
|
+
hover: "none"
|
|
1407
|
+
}
|
|
1408
|
+
});
|
|
1409
|
+
var Board = React20__namespace.forwardRef(
|
|
1410
|
+
({
|
|
1411
|
+
className,
|
|
1412
|
+
elevation,
|
|
1413
|
+
border,
|
|
1414
|
+
padding,
|
|
1415
|
+
radius,
|
|
1416
|
+
background,
|
|
1417
|
+
hover,
|
|
1418
|
+
hoverBorderClass,
|
|
1419
|
+
...props
|
|
1420
|
+
}, ref) => {
|
|
1421
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1422
|
+
"div",
|
|
1423
|
+
{
|
|
1424
|
+
ref,
|
|
1425
|
+
className: cn(
|
|
1426
|
+
boardVariants({
|
|
1427
|
+
elevation,
|
|
1428
|
+
border,
|
|
1429
|
+
padding,
|
|
1430
|
+
radius,
|
|
1431
|
+
background,
|
|
1432
|
+
hover
|
|
1433
|
+
}),
|
|
1434
|
+
// Custom hover border color overrides variant if provided
|
|
1435
|
+
hoverBorderClass && "transition-colors duration-200",
|
|
1436
|
+
hoverBorderClass,
|
|
1437
|
+
className
|
|
1438
|
+
),
|
|
1439
|
+
...props
|
|
1440
|
+
}
|
|
1441
|
+
);
|
|
1442
|
+
}
|
|
1443
|
+
);
|
|
1444
|
+
Board.displayName = "Board";
|
|
1445
|
+
var BoardHeader = React20__namespace.forwardRef(
|
|
1446
|
+
({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
1447
|
+
"div",
|
|
1448
|
+
{
|
|
1449
|
+
ref,
|
|
1450
|
+
className: cn("flex items-center p-4 border-b", className),
|
|
1451
|
+
...props
|
|
1452
|
+
}
|
|
1453
|
+
)
|
|
1454
|
+
);
|
|
1455
|
+
BoardHeader.displayName = "BoardHeader";
|
|
1456
|
+
var BoardContent = React20__namespace.forwardRef(
|
|
1457
|
+
({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx("div", { ref, className: cn("p-4", className), ...props })
|
|
1458
|
+
);
|
|
1459
|
+
BoardContent.displayName = "BoardContent";
|
|
1460
|
+
var Table = React20__namespace.forwardRef(
|
|
960
1461
|
({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx("div", { className: "relative w-full overflow-auto", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
961
1462
|
"table",
|
|
962
1463
|
{
|
|
@@ -967,11 +1468,11 @@ var Table = React33__namespace.forwardRef(
|
|
|
967
1468
|
) })
|
|
968
1469
|
);
|
|
969
1470
|
Table.displayName = "Table";
|
|
970
|
-
var TableHeader =
|
|
1471
|
+
var TableHeader = React20__namespace.forwardRef(
|
|
971
1472
|
({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx("thead", { ref, className: cn("[&_tr]:border-b", className), ...props })
|
|
972
1473
|
);
|
|
973
1474
|
TableHeader.displayName = "TableHeader";
|
|
974
|
-
var TableBody =
|
|
1475
|
+
var TableBody = React20__namespace.forwardRef(
|
|
975
1476
|
({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
976
1477
|
"tbody",
|
|
977
1478
|
{
|
|
@@ -982,7 +1483,7 @@ var TableBody = React33__namespace.forwardRef(
|
|
|
982
1483
|
)
|
|
983
1484
|
);
|
|
984
1485
|
TableBody.displayName = "TableBody";
|
|
985
|
-
var TableFooter =
|
|
1486
|
+
var TableFooter = React20__namespace.forwardRef(
|
|
986
1487
|
({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
987
1488
|
"tfoot",
|
|
988
1489
|
{
|
|
@@ -996,7 +1497,7 @@ var TableFooter = React33__namespace.forwardRef(
|
|
|
996
1497
|
)
|
|
997
1498
|
);
|
|
998
1499
|
TableFooter.displayName = "TableFooter";
|
|
999
|
-
var TableRow =
|
|
1500
|
+
var TableRow = React20__namespace.forwardRef(
|
|
1000
1501
|
({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
1001
1502
|
"tr",
|
|
1002
1503
|
{
|
|
@@ -1010,7 +1511,7 @@ var TableRow = React33__namespace.forwardRef(
|
|
|
1010
1511
|
)
|
|
1011
1512
|
);
|
|
1012
1513
|
TableRow.displayName = "TableRow";
|
|
1013
|
-
var TableHead =
|
|
1514
|
+
var TableHead = React20__namespace.forwardRef(
|
|
1014
1515
|
({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
1015
1516
|
"th",
|
|
1016
1517
|
{
|
|
@@ -1024,7 +1525,7 @@ var TableHead = React33__namespace.forwardRef(
|
|
|
1024
1525
|
)
|
|
1025
1526
|
);
|
|
1026
1527
|
TableHead.displayName = "TableHead";
|
|
1027
|
-
var TableCell =
|
|
1528
|
+
var TableCell = React20__namespace.forwardRef(
|
|
1028
1529
|
({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
1029
1530
|
"td",
|
|
1030
1531
|
{
|
|
@@ -1038,7 +1539,7 @@ var TableCell = React33__namespace.forwardRef(
|
|
|
1038
1539
|
)
|
|
1039
1540
|
);
|
|
1040
1541
|
TableCell.displayName = "TableCell";
|
|
1041
|
-
var TableCaption =
|
|
1542
|
+
var TableCaption = React20__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
1042
1543
|
"caption",
|
|
1043
1544
|
{
|
|
1044
1545
|
ref,
|
|
@@ -1047,6 +1548,518 @@ var TableCaption = React33__namespace.forwardRef(({ className, ...props }, ref)
|
|
|
1047
1548
|
}
|
|
1048
1549
|
));
|
|
1049
1550
|
TableCaption.displayName = "TableCaption";
|
|
1551
|
+
var loadingSpinnerVariants = classVarianceAuthority.cva("rounded-full animate-spin border-current", {
|
|
1552
|
+
variants: {
|
|
1553
|
+
/**
|
|
1554
|
+
* Size of the spinner
|
|
1555
|
+
*/
|
|
1556
|
+
size: {
|
|
1557
|
+
sm: "w-4 h-4 border-2",
|
|
1558
|
+
default: "w-8 h-8 border-2",
|
|
1559
|
+
lg: "w-12 h-12 border-[3px]",
|
|
1560
|
+
xl: "w-16 h-16 border-4"
|
|
1561
|
+
},
|
|
1562
|
+
/**
|
|
1563
|
+
* Visual variant
|
|
1564
|
+
*/
|
|
1565
|
+
variant: {
|
|
1566
|
+
/** Primary color spinner (default) */
|
|
1567
|
+
default: "border-primary/20 border-t-primary",
|
|
1568
|
+
/** Accent color spinner */
|
|
1569
|
+
accent: "border-accent/20 border-t-accent",
|
|
1570
|
+
/** Muted/subtle spinner */
|
|
1571
|
+
muted: "border-muted-foreground/20 border-t-muted-foreground",
|
|
1572
|
+
/** Inherits current text color */
|
|
1573
|
+
inherit: "border-current/20 border-t-current"
|
|
1574
|
+
}
|
|
1575
|
+
},
|
|
1576
|
+
defaultVariants: {
|
|
1577
|
+
size: "default",
|
|
1578
|
+
variant: "default"
|
|
1579
|
+
}
|
|
1580
|
+
});
|
|
1581
|
+
var LoadingSpinner = React20__namespace.forwardRef(
|
|
1582
|
+
({ className, size, variant, label, showDots = false, ...props }, ref) => {
|
|
1583
|
+
const [dots, setDots] = React20__namespace.useState("");
|
|
1584
|
+
React20__namespace.useEffect(() => {
|
|
1585
|
+
if (!showDots || !label) return;
|
|
1586
|
+
const interval = setInterval(() => {
|
|
1587
|
+
setDots((prev) => prev.length >= 3 ? "" : prev + ".");
|
|
1588
|
+
}, 500);
|
|
1589
|
+
return () => clearInterval(interval);
|
|
1590
|
+
}, [showDots, label]);
|
|
1591
|
+
if (label) {
|
|
1592
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1593
|
+
"div",
|
|
1594
|
+
{
|
|
1595
|
+
ref,
|
|
1596
|
+
className: cn("flex flex-col items-center gap-3", className),
|
|
1597
|
+
...props,
|
|
1598
|
+
children: [
|
|
1599
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: loadingSpinnerVariants({ size, variant }) }),
|
|
1600
|
+
/* @__PURE__ */ jsxRuntime.jsxs("p", { className: "text-sm text-muted-foreground", children: [
|
|
1601
|
+
label,
|
|
1602
|
+
showDots && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "inline-block w-4", children: dots })
|
|
1603
|
+
] })
|
|
1604
|
+
]
|
|
1605
|
+
}
|
|
1606
|
+
);
|
|
1607
|
+
}
|
|
1608
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1609
|
+
"div",
|
|
1610
|
+
{
|
|
1611
|
+
ref,
|
|
1612
|
+
className: cn(loadingSpinnerVariants({ size, variant }), className),
|
|
1613
|
+
...props
|
|
1614
|
+
}
|
|
1615
|
+
);
|
|
1616
|
+
}
|
|
1617
|
+
);
|
|
1618
|
+
LoadingSpinner.displayName = "LoadingSpinner";
|
|
1619
|
+
function getCellRawValue(row, col) {
|
|
1620
|
+
if (col.accessor) return col.accessor(row);
|
|
1621
|
+
return row[col.key];
|
|
1622
|
+
}
|
|
1623
|
+
function defaultSearch(row, query, columns) {
|
|
1624
|
+
const lowerQuery = query.toLowerCase();
|
|
1625
|
+
return columns.some((col) => {
|
|
1626
|
+
const val = getCellRawValue(row, col);
|
|
1627
|
+
if (val == null) return false;
|
|
1628
|
+
return String(val).toLowerCase().includes(lowerQuery);
|
|
1629
|
+
});
|
|
1630
|
+
}
|
|
1631
|
+
function defaultSortComparator(a, b, col, direction) {
|
|
1632
|
+
if (col.sortFn) {
|
|
1633
|
+
const result = col.sortFn(a, b);
|
|
1634
|
+
return direction === "asc" ? result : -result;
|
|
1635
|
+
}
|
|
1636
|
+
const aVal = getCellRawValue(a, col);
|
|
1637
|
+
const bVal = getCellRawValue(b, col);
|
|
1638
|
+
const aStr = aVal == null ? "" : String(aVal);
|
|
1639
|
+
const bStr = bVal == null ? "" : String(bVal);
|
|
1640
|
+
const aNum = Number(aStr);
|
|
1641
|
+
const bNum = Number(bStr);
|
|
1642
|
+
if (!isNaN(aNum) && !isNaN(bNum) && aStr !== "" && bStr !== "") {
|
|
1643
|
+
return direction === "asc" ? aNum - bNum : bNum - aNum;
|
|
1644
|
+
}
|
|
1645
|
+
const cmp = aStr.localeCompare(bStr);
|
|
1646
|
+
return direction === "asc" ? cmp : -cmp;
|
|
1647
|
+
}
|
|
1648
|
+
function DataTable({
|
|
1649
|
+
data,
|
|
1650
|
+
columns,
|
|
1651
|
+
getRowKey,
|
|
1652
|
+
// Sorting
|
|
1653
|
+
defaultSort,
|
|
1654
|
+
sort: controlledSort,
|
|
1655
|
+
onSortChange,
|
|
1656
|
+
// Search
|
|
1657
|
+
searchable = false,
|
|
1658
|
+
searchPlaceholder = "Search...",
|
|
1659
|
+
searchValue: controlledSearchValue,
|
|
1660
|
+
onSearchChange,
|
|
1661
|
+
searchFn,
|
|
1662
|
+
// Pagination
|
|
1663
|
+
pageSize: defaultPageSize,
|
|
1664
|
+
pageSizeOptions = [10, 15, 25, 50, 100],
|
|
1665
|
+
currentPage: controlledPage,
|
|
1666
|
+
onPageChange,
|
|
1667
|
+
onPageSizeChange,
|
|
1668
|
+
// Selection
|
|
1669
|
+
selectable,
|
|
1670
|
+
selectedRows: controlledSelectedRows,
|
|
1671
|
+
onSelectedRowsChange,
|
|
1672
|
+
// Row interaction
|
|
1673
|
+
onRowClick,
|
|
1674
|
+
rowClassName,
|
|
1675
|
+
// Pinned rows
|
|
1676
|
+
pinnedRows = [],
|
|
1677
|
+
// Slots
|
|
1678
|
+
toolbar,
|
|
1679
|
+
emptyState,
|
|
1680
|
+
caption,
|
|
1681
|
+
// Loading
|
|
1682
|
+
loading = false,
|
|
1683
|
+
// Styling
|
|
1684
|
+
className
|
|
1685
|
+
}) {
|
|
1686
|
+
const [internalSort, setInternalSort] = React20__namespace.useState(
|
|
1687
|
+
defaultSort ?? null
|
|
1688
|
+
);
|
|
1689
|
+
const [internalSearchValue, setInternalSearchValue] = React20__namespace.useState("");
|
|
1690
|
+
const [internalPage, setInternalPage] = React20__namespace.useState(0);
|
|
1691
|
+
const [internalPageSize, setInternalPageSize] = React20__namespace.useState(
|
|
1692
|
+
defaultPageSize ?? 10
|
|
1693
|
+
);
|
|
1694
|
+
const [internalSelectedRows, setInternalSelectedRows] = React20__namespace.useState([]);
|
|
1695
|
+
const sort = controlledSort !== void 0 ? controlledSort : internalSort;
|
|
1696
|
+
const searchQuery = controlledSearchValue !== void 0 ? controlledSearchValue : internalSearchValue;
|
|
1697
|
+
const page = controlledPage !== void 0 ? controlledPage : internalPage;
|
|
1698
|
+
const pageSize = defaultPageSize != null ? internalPageSize ?? defaultPageSize : void 0;
|
|
1699
|
+
const selectedRowKeys = controlledSelectedRows !== void 0 ? controlledSelectedRows : internalSelectedRows;
|
|
1700
|
+
const handleSortChange = React20__namespace.useCallback(
|
|
1701
|
+
(next) => {
|
|
1702
|
+
if (onSortChange) onSortChange(next);
|
|
1703
|
+
else setInternalSort(next);
|
|
1704
|
+
},
|
|
1705
|
+
[onSortChange]
|
|
1706
|
+
);
|
|
1707
|
+
const handleSearchChange = React20__namespace.useCallback(
|
|
1708
|
+
(value) => {
|
|
1709
|
+
if (onSearchChange) onSearchChange(value);
|
|
1710
|
+
else setInternalSearchValue(value);
|
|
1711
|
+
if (onPageChange) onPageChange(0);
|
|
1712
|
+
else setInternalPage(0);
|
|
1713
|
+
},
|
|
1714
|
+
[onSearchChange, onPageChange]
|
|
1715
|
+
);
|
|
1716
|
+
const handlePageChange = React20__namespace.useCallback(
|
|
1717
|
+
(p) => {
|
|
1718
|
+
if (onPageChange) onPageChange(p);
|
|
1719
|
+
else setInternalPage(p);
|
|
1720
|
+
},
|
|
1721
|
+
[onPageChange]
|
|
1722
|
+
);
|
|
1723
|
+
const handlePageSizeChange = React20__namespace.useCallback(
|
|
1724
|
+
(size) => {
|
|
1725
|
+
if (onPageSizeChange) onPageSizeChange(size);
|
|
1726
|
+
else setInternalPageSize(size);
|
|
1727
|
+
if (onPageChange) onPageChange(0);
|
|
1728
|
+
else setInternalPage(0);
|
|
1729
|
+
},
|
|
1730
|
+
[onPageSizeChange, onPageChange]
|
|
1731
|
+
);
|
|
1732
|
+
const handleSelectionChange = React20__namespace.useCallback(
|
|
1733
|
+
(keys) => {
|
|
1734
|
+
if (onSelectedRowsChange) onSelectedRowsChange(keys);
|
|
1735
|
+
else setInternalSelectedRows(keys);
|
|
1736
|
+
},
|
|
1737
|
+
[onSelectedRowsChange]
|
|
1738
|
+
);
|
|
1739
|
+
const handleHeaderClick = React20__namespace.useCallback(
|
|
1740
|
+
(colKey) => {
|
|
1741
|
+
if (sort?.key === colKey) {
|
|
1742
|
+
if (sort.direction === "asc") {
|
|
1743
|
+
handleSortChange({ key: colKey, direction: "desc" });
|
|
1744
|
+
} else {
|
|
1745
|
+
handleSortChange(null);
|
|
1746
|
+
}
|
|
1747
|
+
} else {
|
|
1748
|
+
handleSortChange({ key: colKey, direction: "asc" });
|
|
1749
|
+
}
|
|
1750
|
+
},
|
|
1751
|
+
[sort, handleSortChange]
|
|
1752
|
+
);
|
|
1753
|
+
const searchedData = React20__namespace.useMemo(() => {
|
|
1754
|
+
if (!searchable || !searchQuery) return data;
|
|
1755
|
+
if (searchFn) return data.filter((row) => searchFn(row, searchQuery));
|
|
1756
|
+
return data.filter((row) => defaultSearch(row, searchQuery, columns));
|
|
1757
|
+
}, [data, searchable, searchQuery, searchFn, columns]);
|
|
1758
|
+
const sortedData = React20__namespace.useMemo(() => {
|
|
1759
|
+
if (!sort) return searchedData;
|
|
1760
|
+
const col = columns.find((c) => c.key === sort.key);
|
|
1761
|
+
if (!col) return searchedData;
|
|
1762
|
+
return [...searchedData].sort(
|
|
1763
|
+
(a, b) => defaultSortComparator(a, b, col, sort.direction)
|
|
1764
|
+
);
|
|
1765
|
+
}, [searchedData, sort, columns]);
|
|
1766
|
+
const pinnedSet = React20__namespace.useMemo(() => new Set(pinnedRows), [pinnedRows]);
|
|
1767
|
+
const { pinnedData, unpinnedData } = React20__namespace.useMemo(() => {
|
|
1768
|
+
if (pinnedSet.size === 0) return { pinnedData: [], unpinnedData: sortedData };
|
|
1769
|
+
const pinned = [];
|
|
1770
|
+
const unpinned = [];
|
|
1771
|
+
const dataByKey = /* @__PURE__ */ new Map();
|
|
1772
|
+
data.forEach((row, i) => {
|
|
1773
|
+
dataByKey.set(getRowKey(row, i), row);
|
|
1774
|
+
});
|
|
1775
|
+
pinnedRows.forEach((key) => {
|
|
1776
|
+
const row = dataByKey.get(key);
|
|
1777
|
+
if (row) pinned.push(row);
|
|
1778
|
+
});
|
|
1779
|
+
sortedData.forEach((row, i) => {
|
|
1780
|
+
const key = getRowKey(row, i);
|
|
1781
|
+
if (!pinnedSet.has(key)) unpinned.push(row);
|
|
1782
|
+
});
|
|
1783
|
+
return { pinnedData: pinned, unpinnedData: unpinned };
|
|
1784
|
+
}, [sortedData, pinnedSet, pinnedRows, data, getRowKey]);
|
|
1785
|
+
const totalUnpinned = unpinnedData.length;
|
|
1786
|
+
const totalPages = pageSize ? Math.max(1, Math.ceil(totalUnpinned / pageSize)) : 1;
|
|
1787
|
+
const paginatedData = React20__namespace.useMemo(() => {
|
|
1788
|
+
if (!pageSize) return unpinnedData;
|
|
1789
|
+
const start = page * pageSize;
|
|
1790
|
+
return unpinnedData.slice(start, start + pageSize);
|
|
1791
|
+
}, [unpinnedData, pageSize, page]);
|
|
1792
|
+
const visibleRows = React20__namespace.useMemo(
|
|
1793
|
+
() => [...pinnedData, ...paginatedData],
|
|
1794
|
+
[pinnedData, paginatedData]
|
|
1795
|
+
);
|
|
1796
|
+
const totalItems = searchedData.length;
|
|
1797
|
+
const visibleKeys = React20__namespace.useMemo(
|
|
1798
|
+
() => visibleRows.map((row, i) => getRowKey(row, i)),
|
|
1799
|
+
[visibleRows, getRowKey]
|
|
1800
|
+
);
|
|
1801
|
+
const allVisibleSelected = visibleKeys.length > 0 && visibleKeys.every((k) => selectedRowKeys.includes(k));
|
|
1802
|
+
const someVisibleSelected = !allVisibleSelected && visibleKeys.some((k) => selectedRowKeys.includes(k));
|
|
1803
|
+
const toggleRowSelection = React20__namespace.useCallback(
|
|
1804
|
+
(key) => {
|
|
1805
|
+
const isSelected = selectedRowKeys.includes(key);
|
|
1806
|
+
const next = isSelected ? selectedRowKeys.filter((k) => k !== key) : [...selectedRowKeys, key];
|
|
1807
|
+
handleSelectionChange(next);
|
|
1808
|
+
},
|
|
1809
|
+
[selectedRowKeys, handleSelectionChange]
|
|
1810
|
+
);
|
|
1811
|
+
const toggleAllVisible = React20__namespace.useCallback(() => {
|
|
1812
|
+
if (allVisibleSelected) {
|
|
1813
|
+
const visibleSet = new Set(visibleKeys);
|
|
1814
|
+
handleSelectionChange(selectedRowKeys.filter((k) => !visibleSet.has(k)));
|
|
1815
|
+
} else {
|
|
1816
|
+
const merged = /* @__PURE__ */ new Set([...selectedRowKeys, ...visibleKeys]);
|
|
1817
|
+
handleSelectionChange(Array.from(merged));
|
|
1818
|
+
}
|
|
1819
|
+
}, [allVisibleSelected, visibleKeys, selectedRowKeys, handleSelectionChange]);
|
|
1820
|
+
const handleRowClick = React20__namespace.useCallback(
|
|
1821
|
+
(row, index, key) => {
|
|
1822
|
+
if (selectable === "highlight") {
|
|
1823
|
+
toggleRowSelection(key);
|
|
1824
|
+
}
|
|
1825
|
+
onRowClick?.(row, index);
|
|
1826
|
+
},
|
|
1827
|
+
[selectable, toggleRowSelection, onRowClick]
|
|
1828
|
+
);
|
|
1829
|
+
const renderCellContent = (row, col, rowIndex) => {
|
|
1830
|
+
if (col.cell) return col.cell(row, rowIndex);
|
|
1831
|
+
const val = getCellRawValue(row, col);
|
|
1832
|
+
if (val == null) return /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground italic", children: "--" });
|
|
1833
|
+
return String(val);
|
|
1834
|
+
};
|
|
1835
|
+
const alignClass = (align) => {
|
|
1836
|
+
if (align === "center") return "text-center";
|
|
1837
|
+
if (align === "right") return "text-right";
|
|
1838
|
+
return "text-left";
|
|
1839
|
+
};
|
|
1840
|
+
if (loading) {
|
|
1841
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("flex items-center justify-center py-16", className), children: /* @__PURE__ */ jsxRuntime.jsx(LoadingSpinner, { label: "Loading", showDots: true }) });
|
|
1842
|
+
}
|
|
1843
|
+
const showSearch = searchable;
|
|
1844
|
+
const showPagination = pageSize != null;
|
|
1845
|
+
const showCheckboxColumn = selectable === "checkbox";
|
|
1846
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn("flex flex-col w-full", className), children: [
|
|
1847
|
+
(showSearch || toolbar) && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-3 pb-4", children: [
|
|
1848
|
+
showSearch && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative flex-1 max-w-sm", children: [
|
|
1849
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.Search, { className: "absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground" }),
|
|
1850
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1851
|
+
Input,
|
|
1852
|
+
{
|
|
1853
|
+
type: "text",
|
|
1854
|
+
placeholder: searchPlaceholder,
|
|
1855
|
+
value: searchQuery,
|
|
1856
|
+
onChange: (e) => handleSearchChange(e.target.value),
|
|
1857
|
+
className: "pl-9"
|
|
1858
|
+
}
|
|
1859
|
+
)
|
|
1860
|
+
] }),
|
|
1861
|
+
toolbar && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center gap-2", children: toolbar })
|
|
1862
|
+
] }),
|
|
1863
|
+
/* @__PURE__ */ jsxRuntime.jsxs(Table, { children: [
|
|
1864
|
+
caption && /* @__PURE__ */ jsxRuntime.jsx(TableCaption, { children: caption }),
|
|
1865
|
+
/* @__PURE__ */ jsxRuntime.jsx(TableHeader, { children: /* @__PURE__ */ jsxRuntime.jsxs(TableRow, { children: [
|
|
1866
|
+
showCheckboxColumn && /* @__PURE__ */ jsxRuntime.jsx(TableHead, { className: "w-[40px]", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1867
|
+
Checkbox,
|
|
1868
|
+
{
|
|
1869
|
+
checked: allVisibleSelected ? true : someVisibleSelected ? "indeterminate" : false,
|
|
1870
|
+
onCheckedChange: () => toggleAllVisible(),
|
|
1871
|
+
"aria-label": "Select all"
|
|
1872
|
+
}
|
|
1873
|
+
) }),
|
|
1874
|
+
columns.map((col) => {
|
|
1875
|
+
const isSorted = sort?.key === col.key;
|
|
1876
|
+
const sortDir = isSorted ? sort.direction : null;
|
|
1877
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1878
|
+
TableHead,
|
|
1879
|
+
{
|
|
1880
|
+
className: cn(
|
|
1881
|
+
col.width,
|
|
1882
|
+
col.headerClassName,
|
|
1883
|
+
alignClass(col.align),
|
|
1884
|
+
col.sortable && "cursor-pointer select-none"
|
|
1885
|
+
),
|
|
1886
|
+
onClick: col.sortable ? () => handleHeaderClick(col.key) : void 0,
|
|
1887
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1888
|
+
"div",
|
|
1889
|
+
{
|
|
1890
|
+
className: cn(
|
|
1891
|
+
"flex items-center gap-1",
|
|
1892
|
+
col.align === "center" && "justify-center",
|
|
1893
|
+
col.align === "right" && "justify-end"
|
|
1894
|
+
),
|
|
1895
|
+
children: [
|
|
1896
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { children: col.header }),
|
|
1897
|
+
col.sortable && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "inline-flex ml-1", children: sortDir === "asc" ? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ArrowUp, { className: "h-3.5 w-3.5" }) : sortDir === "desc" ? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ArrowDown, { className: "h-3.5 w-3.5" }) : /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ArrowUpDown, { className: "h-3.5 w-3.5 opacity-40" }) })
|
|
1898
|
+
]
|
|
1899
|
+
}
|
|
1900
|
+
)
|
|
1901
|
+
},
|
|
1902
|
+
col.key
|
|
1903
|
+
);
|
|
1904
|
+
})
|
|
1905
|
+
] }) }),
|
|
1906
|
+
pinnedData.length > 0 && /* @__PURE__ */ jsxRuntime.jsx(TableBody, { className: "bg-muted/30 border-b-2 border-border", children: pinnedData.map((row, i) => {
|
|
1907
|
+
const key = getRowKey(row, i);
|
|
1908
|
+
const isSelected = selectedRowKeys.includes(key);
|
|
1909
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1910
|
+
TableRow,
|
|
1911
|
+
{
|
|
1912
|
+
"data-state": isSelected ? "selected" : void 0,
|
|
1913
|
+
className: cn(
|
|
1914
|
+
(onRowClick || selectable === "highlight") && "cursor-pointer",
|
|
1915
|
+
rowClassName?.(row, i)
|
|
1916
|
+
),
|
|
1917
|
+
onClick: () => handleRowClick(row, i, key),
|
|
1918
|
+
children: [
|
|
1919
|
+
showCheckboxColumn && /* @__PURE__ */ jsxRuntime.jsx(TableCell, { className: "w-[40px]", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1920
|
+
Checkbox,
|
|
1921
|
+
{
|
|
1922
|
+
checked: isSelected,
|
|
1923
|
+
onCheckedChange: () => toggleRowSelection(key),
|
|
1924
|
+
onClick: (e) => e.stopPropagation(),
|
|
1925
|
+
"aria-label": "Select row"
|
|
1926
|
+
}
|
|
1927
|
+
) }),
|
|
1928
|
+
columns.map((col) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
1929
|
+
TableCell,
|
|
1930
|
+
{
|
|
1931
|
+
className: cn(alignClass(col.align), col.className),
|
|
1932
|
+
children: renderCellContent(row, col, i)
|
|
1933
|
+
},
|
|
1934
|
+
col.key
|
|
1935
|
+
))
|
|
1936
|
+
]
|
|
1937
|
+
},
|
|
1938
|
+
key
|
|
1939
|
+
);
|
|
1940
|
+
}) }),
|
|
1941
|
+
/* @__PURE__ */ jsxRuntime.jsx(TableBody, { children: paginatedData.length === 0 && pinnedData.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx(TableRow, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1942
|
+
TableCell,
|
|
1943
|
+
{
|
|
1944
|
+
colSpan: columns.length + (showCheckboxColumn ? 1 : 0),
|
|
1945
|
+
className: "h-24 text-center",
|
|
1946
|
+
children: emptyState ?? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground", children: "No results." })
|
|
1947
|
+
}
|
|
1948
|
+
) }) : paginatedData.map((row, i) => {
|
|
1949
|
+
const globalIndex = pageSize ? page * pageSize + i : i;
|
|
1950
|
+
const key = getRowKey(row, globalIndex);
|
|
1951
|
+
const isSelected = selectedRowKeys.includes(key);
|
|
1952
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1953
|
+
TableRow,
|
|
1954
|
+
{
|
|
1955
|
+
"data-state": isSelected ? "selected" : void 0,
|
|
1956
|
+
className: cn(
|
|
1957
|
+
(onRowClick || selectable === "highlight") && "cursor-pointer",
|
|
1958
|
+
rowClassName?.(row, globalIndex)
|
|
1959
|
+
),
|
|
1960
|
+
onClick: () => handleRowClick(row, globalIndex, key),
|
|
1961
|
+
children: [
|
|
1962
|
+
showCheckboxColumn && /* @__PURE__ */ jsxRuntime.jsx(TableCell, { className: "w-[40px]", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1963
|
+
Checkbox,
|
|
1964
|
+
{
|
|
1965
|
+
checked: isSelected,
|
|
1966
|
+
onCheckedChange: () => toggleRowSelection(key),
|
|
1967
|
+
onClick: (e) => e.stopPropagation(),
|
|
1968
|
+
"aria-label": "Select row"
|
|
1969
|
+
}
|
|
1970
|
+
) }),
|
|
1971
|
+
columns.map((col) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
1972
|
+
TableCell,
|
|
1973
|
+
{
|
|
1974
|
+
className: cn(alignClass(col.align), col.className),
|
|
1975
|
+
children: renderCellContent(row, col, globalIndex)
|
|
1976
|
+
},
|
|
1977
|
+
col.key
|
|
1978
|
+
))
|
|
1979
|
+
]
|
|
1980
|
+
},
|
|
1981
|
+
key
|
|
1982
|
+
);
|
|
1983
|
+
}) })
|
|
1984
|
+
] }),
|
|
1985
|
+
showPagination && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between pt-4", children: [
|
|
1986
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [
|
|
1987
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm text-muted-foreground", children: "Rows per page" }),
|
|
1988
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
1989
|
+
Select,
|
|
1990
|
+
{
|
|
1991
|
+
value: String(pageSize),
|
|
1992
|
+
onValueChange: (val) => handlePageSizeChange(Number(val)),
|
|
1993
|
+
children: [
|
|
1994
|
+
/* @__PURE__ */ jsxRuntime.jsx(SelectTrigger, { className: "h-8 w-[70px]", children: /* @__PURE__ */ jsxRuntime.jsx(SelectValue, { placeholder: String(pageSize) }) }),
|
|
1995
|
+
/* @__PURE__ */ jsxRuntime.jsx(SelectContent, { children: pageSizeOptions.map((opt) => /* @__PURE__ */ jsxRuntime.jsx(SelectItem, { value: String(opt), children: opt }, opt)) })
|
|
1996
|
+
]
|
|
1997
|
+
}
|
|
1998
|
+
)
|
|
1999
|
+
] }),
|
|
2000
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-4", children: [
|
|
2001
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "text-sm text-muted-foreground", children: [
|
|
2002
|
+
"Page ",
|
|
2003
|
+
page + 1,
|
|
2004
|
+
" of ",
|
|
2005
|
+
totalPages,
|
|
2006
|
+
` (${totalItems} total)`
|
|
2007
|
+
] }),
|
|
2008
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-1", children: [
|
|
2009
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2010
|
+
Button,
|
|
2011
|
+
{
|
|
2012
|
+
variant: "ghost",
|
|
2013
|
+
size: "icon",
|
|
2014
|
+
className: "h-8 w-8",
|
|
2015
|
+
onClick: () => handlePageChange(0),
|
|
2016
|
+
disabled: page === 0,
|
|
2017
|
+
"aria-label": "First page",
|
|
2018
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronsLeft, { className: "h-4 w-4" })
|
|
2019
|
+
}
|
|
2020
|
+
),
|
|
2021
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2022
|
+
Button,
|
|
2023
|
+
{
|
|
2024
|
+
variant: "ghost",
|
|
2025
|
+
size: "icon",
|
|
2026
|
+
className: "h-8 w-8",
|
|
2027
|
+
onClick: () => handlePageChange(page - 1),
|
|
2028
|
+
disabled: page === 0,
|
|
2029
|
+
"aria-label": "Previous page",
|
|
2030
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronLeft, { className: "h-4 w-4" })
|
|
2031
|
+
}
|
|
2032
|
+
),
|
|
2033
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2034
|
+
Button,
|
|
2035
|
+
{
|
|
2036
|
+
variant: "ghost",
|
|
2037
|
+
size: "icon",
|
|
2038
|
+
className: "h-8 w-8",
|
|
2039
|
+
onClick: () => handlePageChange(page + 1),
|
|
2040
|
+
disabled: page >= totalPages - 1,
|
|
2041
|
+
"aria-label": "Next page",
|
|
2042
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronRight, { className: "h-4 w-4" })
|
|
2043
|
+
}
|
|
2044
|
+
),
|
|
2045
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2046
|
+
Button,
|
|
2047
|
+
{
|
|
2048
|
+
variant: "ghost",
|
|
2049
|
+
size: "icon",
|
|
2050
|
+
className: "h-8 w-8",
|
|
2051
|
+
onClick: () => handlePageChange(totalPages - 1),
|
|
2052
|
+
disabled: page >= totalPages - 1,
|
|
2053
|
+
"aria-label": "Last page",
|
|
2054
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronsRight, { className: "h-4 w-4" })
|
|
2055
|
+
}
|
|
2056
|
+
)
|
|
2057
|
+
] })
|
|
2058
|
+
] })
|
|
2059
|
+
] })
|
|
2060
|
+
] });
|
|
2061
|
+
}
|
|
2062
|
+
DataTable.displayName = "DataTable";
|
|
1050
2063
|
function Modal({
|
|
1051
2064
|
isOpen,
|
|
1052
2065
|
onClose,
|
|
@@ -1057,7 +2070,7 @@ function Modal({
|
|
|
1057
2070
|
zIndex = 50,
|
|
1058
2071
|
className
|
|
1059
2072
|
}) {
|
|
1060
|
-
|
|
2073
|
+
React20__namespace.useEffect(() => {
|
|
1061
2074
|
if (!isOpen) return;
|
|
1062
2075
|
const handleEscape = (e) => {
|
|
1063
2076
|
if (e.key === "Escape") {
|
|
@@ -1067,7 +2080,7 @@ function Modal({
|
|
|
1067
2080
|
window.addEventListener("keydown", handleEscape);
|
|
1068
2081
|
return () => window.removeEventListener("keydown", handleEscape);
|
|
1069
2082
|
}, [isOpen, onClose]);
|
|
1070
|
-
|
|
2083
|
+
React20__namespace.useEffect(() => {
|
|
1071
2084
|
if (isOpen) {
|
|
1072
2085
|
document.body.style.overflow = "hidden";
|
|
1073
2086
|
} else {
|
|
@@ -1182,12 +2195,12 @@ function ConfirmationModal({
|
|
|
1182
2195
|
] }) });
|
|
1183
2196
|
}
|
|
1184
2197
|
function useConfirmation() {
|
|
1185
|
-
const [state, setState] =
|
|
2198
|
+
const [state, setState] = React20__namespace.useState({
|
|
1186
2199
|
open: false,
|
|
1187
2200
|
title: "",
|
|
1188
2201
|
description: ""
|
|
1189
2202
|
});
|
|
1190
|
-
const confirm =
|
|
2203
|
+
const confirm = React20__namespace.useCallback(
|
|
1191
2204
|
(options) => {
|
|
1192
2205
|
return new Promise((resolve) => {
|
|
1193
2206
|
setState({
|
|
@@ -1199,15 +2212,15 @@ function useConfirmation() {
|
|
|
1199
2212
|
},
|
|
1200
2213
|
[]
|
|
1201
2214
|
);
|
|
1202
|
-
const handleConfirm =
|
|
2215
|
+
const handleConfirm = React20__namespace.useCallback(() => {
|
|
1203
2216
|
state.resolve?.(true);
|
|
1204
2217
|
setState((prev) => ({ ...prev, open: false }));
|
|
1205
2218
|
}, [state.resolve]);
|
|
1206
|
-
const handleCancel =
|
|
2219
|
+
const handleCancel = React20__namespace.useCallback(() => {
|
|
1207
2220
|
state.resolve?.(false);
|
|
1208
2221
|
setState((prev) => ({ ...prev, open: false }));
|
|
1209
2222
|
}, [state.resolve]);
|
|
1210
|
-
const handleOpenChange =
|
|
2223
|
+
const handleOpenChange = React20__namespace.useCallback(
|
|
1211
2224
|
(open) => {
|
|
1212
2225
|
if (!open) {
|
|
1213
2226
|
state.resolve?.(false);
|
|
@@ -1243,11 +2256,11 @@ function ResizeHandle({
|
|
|
1243
2256
|
ariaLabel,
|
|
1244
2257
|
className
|
|
1245
2258
|
}) {
|
|
1246
|
-
const [isDragging, setIsDragging] =
|
|
1247
|
-
const [isFocused, setIsFocused] =
|
|
1248
|
-
const startXRef =
|
|
1249
|
-
const handleRef =
|
|
1250
|
-
const handleMouseDown =
|
|
2259
|
+
const [isDragging, setIsDragging] = React20__namespace.useState(false);
|
|
2260
|
+
const [isFocused, setIsFocused] = React20__namespace.useState(false);
|
|
2261
|
+
const startXRef = React20__namespace.useRef(0);
|
|
2262
|
+
const handleRef = React20__namespace.useRef(null);
|
|
2263
|
+
const handleMouseDown = React20__namespace.useCallback(
|
|
1251
2264
|
(e) => {
|
|
1252
2265
|
if (!resizable) return;
|
|
1253
2266
|
e.preventDefault();
|
|
@@ -1258,7 +2271,7 @@ function ResizeHandle({
|
|
|
1258
2271
|
},
|
|
1259
2272
|
[resizable, onDragStart]
|
|
1260
2273
|
);
|
|
1261
|
-
const handleMouseMove =
|
|
2274
|
+
const handleMouseMove = React20__namespace.useCallback(
|
|
1262
2275
|
(e) => {
|
|
1263
2276
|
if (!isDragging) return;
|
|
1264
2277
|
const deltaX = e.clientX - startXRef.current;
|
|
@@ -1267,13 +2280,13 @@ function ResizeHandle({
|
|
|
1267
2280
|
},
|
|
1268
2281
|
[isDragging, onDrag]
|
|
1269
2282
|
);
|
|
1270
|
-
const handleMouseUp =
|
|
2283
|
+
const handleMouseUp = React20__namespace.useCallback(() => {
|
|
1271
2284
|
if (!isDragging) return;
|
|
1272
2285
|
setIsDragging(false);
|
|
1273
2286
|
document.body.style.userSelect = "";
|
|
1274
2287
|
onDragEnd?.();
|
|
1275
2288
|
}, [isDragging, onDragEnd]);
|
|
1276
|
-
const handleKeyDown =
|
|
2289
|
+
const handleKeyDown = React20__namespace.useCallback(
|
|
1277
2290
|
(e) => {
|
|
1278
2291
|
if (!resizable || !onKeyboardResize) return;
|
|
1279
2292
|
let direction = null;
|
|
@@ -1292,7 +2305,7 @@ function ResizeHandle({
|
|
|
1292
2305
|
},
|
|
1293
2306
|
[resizable, onKeyboardResize, orientation]
|
|
1294
2307
|
);
|
|
1295
|
-
|
|
2308
|
+
React20__namespace.useEffect(() => {
|
|
1296
2309
|
if (isDragging) {
|
|
1297
2310
|
window.addEventListener("mousemove", handleMouseMove);
|
|
1298
2311
|
window.addEventListener("mouseup", handleMouseUp);
|
|
@@ -1362,12 +2375,12 @@ function ResizablePanel({
|
|
|
1362
2375
|
className,
|
|
1363
2376
|
dataAttributes = {}
|
|
1364
2377
|
}) {
|
|
1365
|
-
const panelRef =
|
|
1366
|
-
const [isDragging, setIsDragging] =
|
|
1367
|
-
const [localWidth, setLocalWidth] =
|
|
1368
|
-
const [localOuterWidth, setLocalOuterWidth] =
|
|
2378
|
+
const panelRef = React20__namespace.useRef(null);
|
|
2379
|
+
const [isDragging, setIsDragging] = React20__namespace.useState(false);
|
|
2380
|
+
const [localWidth, setLocalWidth] = React20__namespace.useState(null);
|
|
2381
|
+
const [localOuterWidth, setLocalOuterWidth] = React20__namespace.useState(null);
|
|
1369
2382
|
const currentWidthVW = isExpanded ? (isDragging && localWidth !== null ? localWidth : expandedWidthVW) || collapsedSizeVW : collapsedSizeVW;
|
|
1370
|
-
const clampWidth =
|
|
2383
|
+
const clampWidth = React20__namespace.useCallback(
|
|
1371
2384
|
(width) => {
|
|
1372
2385
|
let effectiveMinWidth = minWidthVW;
|
|
1373
2386
|
let effectiveMaxWidth = maxWidthVW;
|
|
@@ -1380,11 +2393,11 @@ function ResizablePanel({
|
|
|
1380
2393
|
},
|
|
1381
2394
|
[minWidthVW, maxWidthVW, orientation, leftWidthVW, isOverlay]
|
|
1382
2395
|
);
|
|
1383
|
-
const handleDragStart =
|
|
2396
|
+
const handleDragStart = React20__namespace.useCallback(() => {
|
|
1384
2397
|
setIsDragging(true);
|
|
1385
2398
|
setLocalWidth(currentWidthVW);
|
|
1386
2399
|
}, [currentWidthVW]);
|
|
1387
|
-
const handleDrag =
|
|
2400
|
+
const handleDrag = React20__namespace.useCallback(
|
|
1388
2401
|
(deltaX) => {
|
|
1389
2402
|
if (!isExpanded || isOverlay) return;
|
|
1390
2403
|
const viewportWidth = window.innerWidth;
|
|
@@ -1403,14 +2416,14 @@ function ResizablePanel({
|
|
|
1403
2416
|
clampWidth
|
|
1404
2417
|
]
|
|
1405
2418
|
);
|
|
1406
|
-
const handleDragEnd =
|
|
2419
|
+
const handleDragEnd = React20__namespace.useCallback(() => {
|
|
1407
2420
|
if (localWidth !== null && onResize) {
|
|
1408
2421
|
onResize(localWidth);
|
|
1409
2422
|
}
|
|
1410
2423
|
setIsDragging(false);
|
|
1411
2424
|
setLocalWidth(null);
|
|
1412
2425
|
}, [localWidth, onResize]);
|
|
1413
|
-
const handleKeyboardResize =
|
|
2426
|
+
const handleKeyboardResize = React20__namespace.useCallback(
|
|
1414
2427
|
(direction) => {
|
|
1415
2428
|
if (!isExpanded || isOverlay || !onResize) return;
|
|
1416
2429
|
const step = 1;
|
|
@@ -1419,13 +2432,13 @@ function ResizablePanel({
|
|
|
1419
2432
|
},
|
|
1420
2433
|
[isExpanded, isOverlay, onResize, currentWidthVW, clampWidth]
|
|
1421
2434
|
);
|
|
1422
|
-
const handleOverlayDragStart =
|
|
2435
|
+
const handleOverlayDragStart = React20__namespace.useCallback(() => {
|
|
1423
2436
|
if (outerWidthVW) {
|
|
1424
2437
|
setIsDragging(true);
|
|
1425
2438
|
setLocalOuterWidth(outerWidthVW);
|
|
1426
2439
|
}
|
|
1427
2440
|
}, [outerWidthVW]);
|
|
1428
|
-
const handleOverlayDrag =
|
|
2441
|
+
const handleOverlayDrag = React20__namespace.useCallback(
|
|
1429
2442
|
(deltaX) => {
|
|
1430
2443
|
if (!isOverlay) return;
|
|
1431
2444
|
const viewportWidth = window.innerWidth;
|
|
@@ -1436,14 +2449,14 @@ function ResizablePanel({
|
|
|
1436
2449
|
},
|
|
1437
2450
|
[isOverlay, localOuterWidth, outerWidthVW]
|
|
1438
2451
|
);
|
|
1439
|
-
const handleOverlayDragEnd =
|
|
2452
|
+
const handleOverlayDragEnd = React20__namespace.useCallback(() => {
|
|
1440
2453
|
if (localOuterWidth !== null && onResizeOverlay) {
|
|
1441
2454
|
onResizeOverlay(localOuterWidth);
|
|
1442
2455
|
}
|
|
1443
2456
|
setIsDragging(false);
|
|
1444
2457
|
setLocalOuterWidth(null);
|
|
1445
2458
|
}, [localOuterWidth, onResizeOverlay]);
|
|
1446
|
-
|
|
2459
|
+
React20__namespace.useEffect(() => {
|
|
1447
2460
|
if (isOverlay && panelRef.current) {
|
|
1448
2461
|
const focusableElement = panelRef.current.querySelector(
|
|
1449
2462
|
'button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])'
|
|
@@ -1451,7 +2464,7 @@ function ResizablePanel({
|
|
|
1451
2464
|
focusableElement?.focus();
|
|
1452
2465
|
}
|
|
1453
2466
|
}, [isOverlay]);
|
|
1454
|
-
|
|
2467
|
+
React20__namespace.useEffect(() => {
|
|
1455
2468
|
if (!isOverlay) return;
|
|
1456
2469
|
const handleEscape = (e) => {
|
|
1457
2470
|
if (e.key === "Escape") {
|
|
@@ -1637,74 +2650,6 @@ function Chip({
|
|
|
1637
2650
|
}
|
|
1638
2651
|
);
|
|
1639
2652
|
}
|
|
1640
|
-
var loadingSpinnerVariants = classVarianceAuthority.cva("rounded-full animate-spin border-current", {
|
|
1641
|
-
variants: {
|
|
1642
|
-
/**
|
|
1643
|
-
* Size of the spinner
|
|
1644
|
-
*/
|
|
1645
|
-
size: {
|
|
1646
|
-
sm: "w-4 h-4 border-2",
|
|
1647
|
-
default: "w-8 h-8 border-2",
|
|
1648
|
-
lg: "w-12 h-12 border-[3px]",
|
|
1649
|
-
xl: "w-16 h-16 border-4"
|
|
1650
|
-
},
|
|
1651
|
-
/**
|
|
1652
|
-
* Visual variant
|
|
1653
|
-
*/
|
|
1654
|
-
variant: {
|
|
1655
|
-
/** Primary color spinner (default) */
|
|
1656
|
-
default: "border-primary/20 border-t-primary",
|
|
1657
|
-
/** Accent color spinner */
|
|
1658
|
-
accent: "border-accent/20 border-t-accent",
|
|
1659
|
-
/** Muted/subtle spinner */
|
|
1660
|
-
muted: "border-muted-foreground/20 border-t-muted-foreground",
|
|
1661
|
-
/** Inherits current text color */
|
|
1662
|
-
inherit: "border-current/20 border-t-current"
|
|
1663
|
-
}
|
|
1664
|
-
},
|
|
1665
|
-
defaultVariants: {
|
|
1666
|
-
size: "default",
|
|
1667
|
-
variant: "default"
|
|
1668
|
-
}
|
|
1669
|
-
});
|
|
1670
|
-
var LoadingSpinner = React33__namespace.forwardRef(
|
|
1671
|
-
({ className, size, variant, label, showDots = false, ...props }, ref) => {
|
|
1672
|
-
const [dots, setDots] = React33__namespace.useState("");
|
|
1673
|
-
React33__namespace.useEffect(() => {
|
|
1674
|
-
if (!showDots || !label) return;
|
|
1675
|
-
const interval = setInterval(() => {
|
|
1676
|
-
setDots((prev) => prev.length >= 3 ? "" : prev + ".");
|
|
1677
|
-
}, 500);
|
|
1678
|
-
return () => clearInterval(interval);
|
|
1679
|
-
}, [showDots, label]);
|
|
1680
|
-
if (label) {
|
|
1681
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1682
|
-
"div",
|
|
1683
|
-
{
|
|
1684
|
-
ref,
|
|
1685
|
-
className: cn("flex flex-col items-center gap-3", className),
|
|
1686
|
-
...props,
|
|
1687
|
-
children: [
|
|
1688
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: loadingSpinnerVariants({ size, variant }) }),
|
|
1689
|
-
/* @__PURE__ */ jsxRuntime.jsxs("p", { className: "text-sm text-muted-foreground", children: [
|
|
1690
|
-
label,
|
|
1691
|
-
showDots && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "inline-block w-4", children: dots })
|
|
1692
|
-
] })
|
|
1693
|
-
]
|
|
1694
|
-
}
|
|
1695
|
-
);
|
|
1696
|
-
}
|
|
1697
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1698
|
-
"div",
|
|
1699
|
-
{
|
|
1700
|
-
ref,
|
|
1701
|
-
className: cn(loadingSpinnerVariants({ size, variant }), className),
|
|
1702
|
-
...props
|
|
1703
|
-
}
|
|
1704
|
-
);
|
|
1705
|
-
}
|
|
1706
|
-
);
|
|
1707
|
-
LoadingSpinner.displayName = "LoadingSpinner";
|
|
1708
2653
|
function Toaster({
|
|
1709
2654
|
position = "top-right",
|
|
1710
2655
|
expand = false,
|
|
@@ -1767,12 +2712,12 @@ function Calendar({
|
|
|
1767
2712
|
const endMonth = props.endMonth ?? props.toDate;
|
|
1768
2713
|
const fromYear = startMonth?.getFullYear();
|
|
1769
2714
|
const toYear = endMonth?.getFullYear();
|
|
1770
|
-
const years =
|
|
1771
|
-
const [internalMonth, setInternalMonth] =
|
|
2715
|
+
const years = React20__namespace.useMemo(() => getYearRange(fromYear, toYear), [fromYear, toYear]);
|
|
2716
|
+
const [internalMonth, setInternalMonth] = React20__namespace.useState(
|
|
1772
2717
|
defaultMonth ?? /* @__PURE__ */ new Date()
|
|
1773
2718
|
);
|
|
1774
2719
|
const displayedMonth = controlledMonth ?? internalMonth;
|
|
1775
|
-
const handleMonthChange =
|
|
2720
|
+
const handleMonthChange = React20__namespace.useCallback(
|
|
1776
2721
|
(newMonth) => {
|
|
1777
2722
|
if (controlledMonth === void 0) {
|
|
1778
2723
|
setInternalMonth(newMonth);
|
|
@@ -1903,8 +2848,8 @@ function DatePicker({
|
|
|
1903
2848
|
matchTriggerWidth = false,
|
|
1904
2849
|
onOpenChange
|
|
1905
2850
|
}) {
|
|
1906
|
-
const [open, setOpen] =
|
|
1907
|
-
const [internalValue, setInternalValue] =
|
|
2851
|
+
const [open, setOpen] = React20__namespace.useState(false);
|
|
2852
|
+
const [internalValue, setInternalValue] = React20__namespace.useState(
|
|
1908
2853
|
defaultValue
|
|
1909
2854
|
);
|
|
1910
2855
|
const isControlled = value !== void 0;
|
|
@@ -2006,15 +2951,15 @@ function DatePickerInput({
|
|
|
2006
2951
|
onOpenChange,
|
|
2007
2952
|
size = "default"
|
|
2008
2953
|
}) {
|
|
2009
|
-
const [open, setOpen] =
|
|
2010
|
-
const [internalValue, setInternalValue] =
|
|
2954
|
+
const [open, setOpen] = React20__namespace.useState(false);
|
|
2955
|
+
const [internalValue, setInternalValue] = React20__namespace.useState(
|
|
2011
2956
|
defaultValue
|
|
2012
2957
|
);
|
|
2013
|
-
const [inputValue, setInputValue] =
|
|
2014
|
-
const inputRef =
|
|
2958
|
+
const [inputValue, setInputValue] = React20__namespace.useState("");
|
|
2959
|
+
const inputRef = React20__namespace.useRef(null);
|
|
2015
2960
|
const isControlled = value !== void 0;
|
|
2016
2961
|
const selectedDate = isControlled ? value : internalValue;
|
|
2017
|
-
|
|
2962
|
+
React20__namespace.useEffect(() => {
|
|
2018
2963
|
if (selectedDate) {
|
|
2019
2964
|
setInputValue(dateFns.format(selectedDate, dateFormat));
|
|
2020
2965
|
} else {
|
|
@@ -2175,11 +3120,11 @@ function FilterPopover({
|
|
|
2175
3120
|
onFilterChange
|
|
2176
3121
|
}) {
|
|
2177
3122
|
const filterType = column.filterType || "text";
|
|
2178
|
-
const [operator, setOperator] =
|
|
3123
|
+
const [operator, setOperator] = React20__namespace.useState(
|
|
2179
3124
|
filter?.operator || getDefaultOperator(filterType)
|
|
2180
3125
|
);
|
|
2181
|
-
const [value, setValue] =
|
|
2182
|
-
const [valueTo, setValueTo] =
|
|
3126
|
+
const [value, setValue] = React20__namespace.useState(filter?.value ?? "");
|
|
3127
|
+
const [valueTo, setValueTo] = React20__namespace.useState(filter?.valueTo ?? "");
|
|
2183
3128
|
function getDefaultOperator(type) {
|
|
2184
3129
|
switch (type) {
|
|
2185
3130
|
case "text":
|
|
@@ -2322,7 +3267,7 @@ function FilterPopover({
|
|
|
2322
3267
|
] })
|
|
2323
3268
|
] });
|
|
2324
3269
|
const renderDateFilter = () => {
|
|
2325
|
-
const dateValue =
|
|
3270
|
+
const dateValue = React20__namespace.useMemo(() => {
|
|
2326
3271
|
if (!value) return void 0;
|
|
2327
3272
|
if (value instanceof Date) return value;
|
|
2328
3273
|
if (typeof value === "string") {
|
|
@@ -2331,7 +3276,7 @@ function FilterPopover({
|
|
|
2331
3276
|
}
|
|
2332
3277
|
return void 0;
|
|
2333
3278
|
}, [value]);
|
|
2334
|
-
const dateToValue =
|
|
3279
|
+
const dateToValue = React20__namespace.useMemo(() => {
|
|
2335
3280
|
if (!valueTo) return void 0;
|
|
2336
3281
|
if (valueTo instanceof Date) return valueTo;
|
|
2337
3282
|
if (typeof valueTo === "string") {
|
|
@@ -2466,7 +3411,7 @@ function HeaderCell({
|
|
|
2466
3411
|
onResizeDoubleClick,
|
|
2467
3412
|
isResizing
|
|
2468
3413
|
}) {
|
|
2469
|
-
const [filterOpen, setFilterOpen] =
|
|
3414
|
+
const [filterOpen, setFilterOpen] = React20__namespace.useState(false);
|
|
2470
3415
|
const isSorted = sorting?.field === column.key;
|
|
2471
3416
|
const isFiltered = !!filter;
|
|
2472
3417
|
const isSortable = column.sortable && onSort;
|
|
@@ -2624,15 +3569,15 @@ function CellEditor({
|
|
|
2624
3569
|
className
|
|
2625
3570
|
}) {
|
|
2626
3571
|
const editorType = column.editorType || "text";
|
|
2627
|
-
const [internalValue, setInternalValue] =
|
|
2628
|
-
const [validationError, setValidationError] =
|
|
3572
|
+
const [internalValue, setInternalValue] = React20__namespace.useState(value);
|
|
3573
|
+
const [validationError, setValidationError] = React20__namespace.useState(
|
|
2629
3574
|
null
|
|
2630
3575
|
);
|
|
2631
|
-
const inputRef =
|
|
2632
|
-
const selectRef =
|
|
3576
|
+
const inputRef = React20__namespace.useRef(null);
|
|
3577
|
+
const selectRef = React20__namespace.useRef(null);
|
|
2633
3578
|
const currentValue = onChange ? value : internalValue;
|
|
2634
3579
|
const setValue = onChange || setInternalValue;
|
|
2635
|
-
const validate =
|
|
3580
|
+
const validate = React20__namespace.useCallback(
|
|
2636
3581
|
(val) => {
|
|
2637
3582
|
if (!column.validator) return true;
|
|
2638
3583
|
const result = column.validator(val, row);
|
|
@@ -2680,7 +3625,7 @@ function CellEditor({
|
|
|
2680
3625
|
}
|
|
2681
3626
|
handleCommit();
|
|
2682
3627
|
};
|
|
2683
|
-
|
|
3628
|
+
React20__namespace.useEffect(() => {
|
|
2684
3629
|
const timer = setTimeout(() => {
|
|
2685
3630
|
if (editorType === "select") {
|
|
2686
3631
|
selectRef.current?.focus();
|
|
@@ -2727,7 +3672,7 @@ function CellEditor({
|
|
|
2727
3672
|
}
|
|
2728
3673
|
);
|
|
2729
3674
|
const renderDateEditor = () => {
|
|
2730
|
-
const dateValue =
|
|
3675
|
+
const dateValue = React20__namespace.useMemo(() => {
|
|
2731
3676
|
if (!currentValue) return void 0;
|
|
2732
3677
|
if (currentValue instanceof Date) return currentValue;
|
|
2733
3678
|
if (typeof currentValue === "string") {
|
|
@@ -2915,7 +3860,7 @@ function useDataGridState(options) {
|
|
|
2915
3860
|
data,
|
|
2916
3861
|
getCellValue: getCellValue2
|
|
2917
3862
|
} = options;
|
|
2918
|
-
const isControlled =
|
|
3863
|
+
const isControlled = React20.useMemo(
|
|
2919
3864
|
() => ({
|
|
2920
3865
|
sorting: controlledSorting !== void 0,
|
|
2921
3866
|
filters: controlledFilters !== void 0,
|
|
@@ -2929,15 +3874,15 @@ function useDataGridState(options) {
|
|
|
2929
3874
|
controlledFocusedCell
|
|
2930
3875
|
]
|
|
2931
3876
|
);
|
|
2932
|
-
const [internalSorting, setInternalSorting] =
|
|
2933
|
-
const [internalFilters, setInternalFilters] =
|
|
2934
|
-
const [internalColumnWidths, setInternalColumnWidths] =
|
|
2935
|
-
const [internalFocusedCell, setInternalFocusedCell] =
|
|
2936
|
-
const [editingCell, setEditingCell] =
|
|
3877
|
+
const [internalSorting, setInternalSorting] = React20.useState(defaultSorting);
|
|
3878
|
+
const [internalFilters, setInternalFilters] = React20.useState(defaultFilters);
|
|
3879
|
+
const [internalColumnWidths, setInternalColumnWidths] = React20.useState(defaultColumnWidths);
|
|
3880
|
+
const [internalFocusedCell, setInternalFocusedCell] = React20.useState(null);
|
|
3881
|
+
const [editingCell, setEditingCell] = React20.useState(null);
|
|
2937
3882
|
const sorting = isControlled.sorting ? controlledSorting : internalSorting;
|
|
2938
3883
|
const filters = isControlled.filters ? controlledFilters : internalFilters;
|
|
2939
3884
|
const focusedCell = isControlled.focusedCell ? controlledFocusedCell : internalFocusedCell;
|
|
2940
|
-
const columnWidths =
|
|
3885
|
+
const columnWidths = React20.useMemo(() => {
|
|
2941
3886
|
const controlled = isControlled.columnWidths ? controlledColumnWidths : internalColumnWidths;
|
|
2942
3887
|
const result = {};
|
|
2943
3888
|
for (const column of columns) {
|
|
@@ -2945,8 +3890,8 @@ function useDataGridState(options) {
|
|
|
2945
3890
|
}
|
|
2946
3891
|
return result;
|
|
2947
3892
|
}, [isControlled.columnWidths, controlledColumnWidths, internalColumnWidths, columns]);
|
|
2948
|
-
const prevStateRef =
|
|
2949
|
-
const state =
|
|
3893
|
+
const prevStateRef = React20.useRef(null);
|
|
3894
|
+
const state = React20.useMemo(
|
|
2950
3895
|
() => ({
|
|
2951
3896
|
sorting,
|
|
2952
3897
|
filters,
|
|
@@ -2956,7 +3901,7 @@ function useDataGridState(options) {
|
|
|
2956
3901
|
}),
|
|
2957
3902
|
[sorting, filters, columnWidths, focusedCell, editingCell]
|
|
2958
3903
|
);
|
|
2959
|
-
|
|
3904
|
+
React20.useEffect(() => {
|
|
2960
3905
|
if (onStateChange) {
|
|
2961
3906
|
const currentState = {
|
|
2962
3907
|
sorting,
|
|
@@ -2971,7 +3916,7 @@ function useDataGridState(options) {
|
|
|
2971
3916
|
}
|
|
2972
3917
|
}
|
|
2973
3918
|
}, [sorting, filters, columnWidths, focusedCell, editingCell, onStateChange]);
|
|
2974
|
-
const setSorting =
|
|
3919
|
+
const setSorting = React20.useCallback(
|
|
2975
3920
|
(newSorting) => {
|
|
2976
3921
|
if (isControlled.sorting) {
|
|
2977
3922
|
onSortChange?.(newSorting);
|
|
@@ -2982,7 +3927,7 @@ function useDataGridState(options) {
|
|
|
2982
3927
|
},
|
|
2983
3928
|
[isControlled.sorting, onSortChange]
|
|
2984
3929
|
);
|
|
2985
|
-
const toggleSort =
|
|
3930
|
+
const toggleSort = React20.useCallback(
|
|
2986
3931
|
(columnKey) => {
|
|
2987
3932
|
const currentSort = sorting.find((s) => s.field === columnKey);
|
|
2988
3933
|
let newSorting;
|
|
@@ -2997,7 +3942,7 @@ function useDataGridState(options) {
|
|
|
2997
3942
|
},
|
|
2998
3943
|
[sorting, setSorting]
|
|
2999
3944
|
);
|
|
3000
|
-
const setFilters =
|
|
3945
|
+
const setFilters = React20.useCallback(
|
|
3001
3946
|
(newFilters) => {
|
|
3002
3947
|
if (isControlled.filters) {
|
|
3003
3948
|
onFilterChange?.(newFilters);
|
|
@@ -3008,7 +3953,7 @@ function useDataGridState(options) {
|
|
|
3008
3953
|
},
|
|
3009
3954
|
[isControlled.filters, onFilterChange]
|
|
3010
3955
|
);
|
|
3011
|
-
const setFilter =
|
|
3956
|
+
const setFilter = React20.useCallback(
|
|
3012
3957
|
(filter, columnKey) => {
|
|
3013
3958
|
const newFilters = filters.filter((f) => f.columnKey !== columnKey);
|
|
3014
3959
|
if (filter) {
|
|
@@ -3018,10 +3963,10 @@ function useDataGridState(options) {
|
|
|
3018
3963
|
},
|
|
3019
3964
|
[filters, setFilters]
|
|
3020
3965
|
);
|
|
3021
|
-
const clearFilters =
|
|
3966
|
+
const clearFilters = React20.useCallback(() => {
|
|
3022
3967
|
setFilters([]);
|
|
3023
3968
|
}, [setFilters]);
|
|
3024
|
-
const setColumnWidth =
|
|
3969
|
+
const setColumnWidth = React20.useCallback(
|
|
3025
3970
|
(columnKey, width) => {
|
|
3026
3971
|
if (isControlled.columnWidths) {
|
|
3027
3972
|
onColumnResize?.(columnKey, width);
|
|
@@ -3035,7 +3980,7 @@ function useDataGridState(options) {
|
|
|
3035
3980
|
},
|
|
3036
3981
|
[isControlled.columnWidths, onColumnResize]
|
|
3037
3982
|
);
|
|
3038
|
-
const setFocusedCell =
|
|
3983
|
+
const setFocusedCell = React20.useCallback(
|
|
3039
3984
|
(cell) => {
|
|
3040
3985
|
if (isControlled.focusedCell) {
|
|
3041
3986
|
onFocusedCellChange?.(cell);
|
|
@@ -3046,7 +3991,7 @@ function useDataGridState(options) {
|
|
|
3046
3991
|
},
|
|
3047
3992
|
[isControlled.focusedCell, onFocusedCellChange]
|
|
3048
3993
|
);
|
|
3049
|
-
const startEditing =
|
|
3994
|
+
const startEditing = React20.useCallback(
|
|
3050
3995
|
(rowIndex, columnKey) => {
|
|
3051
3996
|
if (onCellEditStart) {
|
|
3052
3997
|
const allowed = onCellEditStart(rowIndex, columnKey);
|
|
@@ -3067,10 +4012,10 @@ function useDataGridState(options) {
|
|
|
3067
4012
|
},
|
|
3068
4013
|
[columns, data, getCellValue2, onCellEditStart, setFocusedCell]
|
|
3069
4014
|
);
|
|
3070
|
-
const updateEditingValue =
|
|
4015
|
+
const updateEditingValue = React20.useCallback((value) => {
|
|
3071
4016
|
setEditingCell((prev) => prev ? { ...prev, value } : null);
|
|
3072
4017
|
}, []);
|
|
3073
|
-
const commitEdit =
|
|
4018
|
+
const commitEdit = React20.useCallback((valueOverride) => {
|
|
3074
4019
|
if (!editingCell) return;
|
|
3075
4020
|
const { rowIndex, columnKey, originalValue } = editingCell;
|
|
3076
4021
|
const value = valueOverride !== void 0 ? valueOverride : editingCell.value;
|
|
@@ -3087,7 +4032,7 @@ function useDataGridState(options) {
|
|
|
3087
4032
|
}
|
|
3088
4033
|
setEditingCell(null);
|
|
3089
4034
|
}, [editingCell, columns, data, onCellEdit]);
|
|
3090
|
-
const cancelEdit =
|
|
4035
|
+
const cancelEdit = React20.useCallback(() => {
|
|
3091
4036
|
if (editingCell) {
|
|
3092
4037
|
onCellEditCancel?.(editingCell.rowIndex, editingCell.columnKey);
|
|
3093
4038
|
}
|
|
@@ -3129,22 +4074,22 @@ function useKeyboardNavigation(options) {
|
|
|
3129
4074
|
onScrollToRow,
|
|
3130
4075
|
onScrollToColumn
|
|
3131
4076
|
} = options;
|
|
3132
|
-
const containerRef =
|
|
4077
|
+
const containerRef = React20.useRef(null);
|
|
3133
4078
|
const visibleColumns = getVisibleColumns(columns);
|
|
3134
|
-
const getColumnIndex =
|
|
4079
|
+
const getColumnIndex = React20.useCallback(
|
|
3135
4080
|
(columnKey) => {
|
|
3136
4081
|
return visibleColumns.findIndex((col) => col.key === columnKey);
|
|
3137
4082
|
},
|
|
3138
4083
|
[visibleColumns]
|
|
3139
4084
|
);
|
|
3140
|
-
const getColumnKey =
|
|
4085
|
+
const getColumnKey = React20.useCallback(
|
|
3141
4086
|
(index) => {
|
|
3142
4087
|
const column = visibleColumns[index];
|
|
3143
4088
|
return column ? column.key : null;
|
|
3144
4089
|
},
|
|
3145
4090
|
[visibleColumns]
|
|
3146
4091
|
);
|
|
3147
|
-
const navigateToCell =
|
|
4092
|
+
const navigateToCell = React20.useCallback(
|
|
3148
4093
|
(rowIndex, columnKey) => {
|
|
3149
4094
|
const clampedRow = Math.max(0, Math.min(rowIndex, rowCount - 1));
|
|
3150
4095
|
onFocusedCellChange({ rowIndex: clampedRow, columnKey });
|
|
@@ -3153,7 +4098,7 @@ function useKeyboardNavigation(options) {
|
|
|
3153
4098
|
},
|
|
3154
4099
|
[rowCount, onFocusedCellChange, onScrollToRow, onScrollToColumn]
|
|
3155
4100
|
);
|
|
3156
|
-
const moveFocus =
|
|
4101
|
+
const moveFocus = React20.useCallback(
|
|
3157
4102
|
(rowDelta, colDelta) => {
|
|
3158
4103
|
if (!focusedCell || visibleColumns.length === 0 || rowCount === 0) return;
|
|
3159
4104
|
const currentColIndex = getColumnIndex(focusedCell.columnKey);
|
|
@@ -3193,35 +4138,35 @@ function useKeyboardNavigation(options) {
|
|
|
3193
4138
|
navigateToCell
|
|
3194
4139
|
]
|
|
3195
4140
|
);
|
|
3196
|
-
const jumpToRowStart =
|
|
4141
|
+
const jumpToRowStart = React20.useCallback(() => {
|
|
3197
4142
|
if (!focusedCell || visibleColumns.length === 0) return;
|
|
3198
4143
|
const firstColumnKey = getColumnKey(0);
|
|
3199
4144
|
if (firstColumnKey) {
|
|
3200
4145
|
navigateToCell(focusedCell.rowIndex, firstColumnKey);
|
|
3201
4146
|
}
|
|
3202
4147
|
}, [focusedCell, visibleColumns.length, getColumnKey, navigateToCell]);
|
|
3203
|
-
const jumpToRowEnd =
|
|
4148
|
+
const jumpToRowEnd = React20.useCallback(() => {
|
|
3204
4149
|
if (!focusedCell || visibleColumns.length === 0) return;
|
|
3205
4150
|
const lastColumnKey = getColumnKey(visibleColumns.length - 1);
|
|
3206
4151
|
if (lastColumnKey) {
|
|
3207
4152
|
navigateToCell(focusedCell.rowIndex, lastColumnKey);
|
|
3208
4153
|
}
|
|
3209
4154
|
}, [focusedCell, visibleColumns.length, getColumnKey, navigateToCell]);
|
|
3210
|
-
const jumpToGridStart =
|
|
4155
|
+
const jumpToGridStart = React20.useCallback(() => {
|
|
3211
4156
|
if (visibleColumns.length === 0 || rowCount === 0) return;
|
|
3212
4157
|
const firstColumnKey = getColumnKey(0);
|
|
3213
4158
|
if (firstColumnKey) {
|
|
3214
4159
|
navigateToCell(0, firstColumnKey);
|
|
3215
4160
|
}
|
|
3216
4161
|
}, [visibleColumns.length, rowCount, getColumnKey, navigateToCell]);
|
|
3217
|
-
const jumpToGridEnd =
|
|
4162
|
+
const jumpToGridEnd = React20.useCallback(() => {
|
|
3218
4163
|
if (visibleColumns.length === 0 || rowCount === 0) return;
|
|
3219
4164
|
const lastColumnKey = getColumnKey(visibleColumns.length - 1);
|
|
3220
4165
|
if (lastColumnKey) {
|
|
3221
4166
|
navigateToCell(rowCount - 1, lastColumnKey);
|
|
3222
4167
|
}
|
|
3223
4168
|
}, [visibleColumns.length, rowCount, getColumnKey, navigateToCell]);
|
|
3224
|
-
const handleKeyDown =
|
|
4169
|
+
const handleKeyDown = React20.useCallback(
|
|
3225
4170
|
(event) => {
|
|
3226
4171
|
if (!enabled) return;
|
|
3227
4172
|
const { key, ctrlKey, metaKey, shiftKey } = event;
|
|
@@ -3324,7 +4269,7 @@ function useKeyboardNavigation(options) {
|
|
|
3324
4269
|
onFocusedCellChange
|
|
3325
4270
|
]
|
|
3326
4271
|
);
|
|
3327
|
-
const focusContainer =
|
|
4272
|
+
const focusContainer = React20.useCallback(() => {
|
|
3328
4273
|
containerRef.current?.focus();
|
|
3329
4274
|
}, []);
|
|
3330
4275
|
return {
|
|
@@ -3345,18 +4290,18 @@ function useColumnResize(options) {
|
|
|
3345
4290
|
onResizeStart,
|
|
3346
4291
|
onResizeEnd
|
|
3347
4292
|
} = options;
|
|
3348
|
-
const [isDragging, setIsDragging] =
|
|
3349
|
-
const startXRef =
|
|
3350
|
-
const startWidthRef =
|
|
4293
|
+
const [isDragging, setIsDragging] = React20.useState(false);
|
|
4294
|
+
const startXRef = React20.useRef(0);
|
|
4295
|
+
const startWidthRef = React20.useRef(0);
|
|
3351
4296
|
const minWidth = column.minWidth ?? DEFAULT_MIN_WIDTH;
|
|
3352
4297
|
const maxWidth = column.maxWidth ?? DEFAULT_MAX_WIDTH;
|
|
3353
|
-
const clampWidth =
|
|
4298
|
+
const clampWidth = React20.useCallback(
|
|
3354
4299
|
(width) => {
|
|
3355
4300
|
return Math.max(minWidth, Math.min(maxWidth, width));
|
|
3356
4301
|
},
|
|
3357
4302
|
[minWidth, maxWidth]
|
|
3358
4303
|
);
|
|
3359
|
-
const handleMouseDown =
|
|
4304
|
+
const handleMouseDown = React20.useCallback(
|
|
3360
4305
|
(event) => {
|
|
3361
4306
|
if (!enabled) return;
|
|
3362
4307
|
event.preventDefault();
|
|
@@ -3370,7 +4315,7 @@ function useColumnResize(options) {
|
|
|
3370
4315
|
},
|
|
3371
4316
|
[enabled, currentWidth, onResizeStart]
|
|
3372
4317
|
);
|
|
3373
|
-
const handleMouseMove =
|
|
4318
|
+
const handleMouseMove = React20.useCallback(
|
|
3374
4319
|
(event) => {
|
|
3375
4320
|
if (!isDragging) return;
|
|
3376
4321
|
const deltaX = event.clientX - startXRef.current;
|
|
@@ -3379,7 +4324,7 @@ function useColumnResize(options) {
|
|
|
3379
4324
|
},
|
|
3380
4325
|
[isDragging, clampWidth, onResize]
|
|
3381
4326
|
);
|
|
3382
|
-
const handleMouseUp =
|
|
4327
|
+
const handleMouseUp = React20.useCallback(() => {
|
|
3383
4328
|
if (!isDragging) return;
|
|
3384
4329
|
setIsDragging(false);
|
|
3385
4330
|
document.body.style.userSelect = "";
|
|
@@ -3387,7 +4332,7 @@ function useColumnResize(options) {
|
|
|
3387
4332
|
const finalWidth = clampWidth(currentWidth);
|
|
3388
4333
|
onResizeEnd?.(finalWidth);
|
|
3389
4334
|
}, [isDragging, currentWidth, clampWidth, onResizeEnd]);
|
|
3390
|
-
const handleDoubleClick =
|
|
4335
|
+
const handleDoubleClick = React20.useCallback(
|
|
3391
4336
|
(event) => {
|
|
3392
4337
|
if (!enabled) return;
|
|
3393
4338
|
event.preventDefault();
|
|
@@ -3399,7 +4344,7 @@ function useColumnResize(options) {
|
|
|
3399
4344
|
},
|
|
3400
4345
|
[enabled, column.width, clampWidth, onResize, onResizeEnd]
|
|
3401
4346
|
);
|
|
3402
|
-
|
|
4347
|
+
React20.useEffect(() => {
|
|
3403
4348
|
if (isDragging) {
|
|
3404
4349
|
window.addEventListener("mousemove", handleMouseMove);
|
|
3405
4350
|
window.addEventListener("mouseup", handleMouseUp);
|
|
@@ -3409,7 +4354,7 @@ function useColumnResize(options) {
|
|
|
3409
4354
|
};
|
|
3410
4355
|
}
|
|
3411
4356
|
}, [isDragging, handleMouseMove, handleMouseUp]);
|
|
3412
|
-
|
|
4357
|
+
React20.useEffect(() => {
|
|
3413
4358
|
return () => {
|
|
3414
4359
|
if (isDragging) {
|
|
3415
4360
|
document.body.style.userSelect = "";
|
|
@@ -3441,16 +4386,16 @@ function useColumnResizeManager(options) {
|
|
|
3441
4386
|
onColumnResizeStart,
|
|
3442
4387
|
onColumnResizeEnd
|
|
3443
4388
|
} = options;
|
|
3444
|
-
const [resizingColumn, setResizingColumn] =
|
|
3445
|
-
const startXRef =
|
|
3446
|
-
const startWidthRef =
|
|
3447
|
-
const getColumn =
|
|
4389
|
+
const [resizingColumn, setResizingColumn] = React20.useState(null);
|
|
4390
|
+
const startXRef = React20.useRef(0);
|
|
4391
|
+
const startWidthRef = React20.useRef(0);
|
|
4392
|
+
const getColumn = React20.useCallback(
|
|
3448
4393
|
(columnKey) => {
|
|
3449
4394
|
return columns.find((c) => c.key === columnKey);
|
|
3450
4395
|
},
|
|
3451
4396
|
[columns]
|
|
3452
4397
|
);
|
|
3453
|
-
const clampWidth =
|
|
4398
|
+
const clampWidth = React20.useCallback(
|
|
3454
4399
|
(columnKey, width) => {
|
|
3455
4400
|
const column = getColumn(columnKey);
|
|
3456
4401
|
const minWidth = column?.minWidth ?? DEFAULT_MIN_WIDTH;
|
|
@@ -3459,7 +4404,7 @@ function useColumnResizeManager(options) {
|
|
|
3459
4404
|
},
|
|
3460
4405
|
[getColumn]
|
|
3461
4406
|
);
|
|
3462
|
-
const handleMouseMove =
|
|
4407
|
+
const handleMouseMove = React20.useCallback(
|
|
3463
4408
|
(event) => {
|
|
3464
4409
|
if (!resizingColumn) return;
|
|
3465
4410
|
const deltaX = event.clientX - startXRef.current;
|
|
@@ -3471,7 +4416,7 @@ function useColumnResizeManager(options) {
|
|
|
3471
4416
|
},
|
|
3472
4417
|
[resizingColumn, clampWidth, onColumnResize]
|
|
3473
4418
|
);
|
|
3474
|
-
const handleMouseUp =
|
|
4419
|
+
const handleMouseUp = React20.useCallback(() => {
|
|
3475
4420
|
if (!resizingColumn) return;
|
|
3476
4421
|
const finalWidth = columnWidths[resizingColumn] ?? 200;
|
|
3477
4422
|
setResizingColumn(null);
|
|
@@ -3479,7 +4424,7 @@ function useColumnResizeManager(options) {
|
|
|
3479
4424
|
document.body.style.cursor = "";
|
|
3480
4425
|
onColumnResizeEnd?.(resizingColumn, finalWidth);
|
|
3481
4426
|
}, [resizingColumn, columnWidths, onColumnResizeEnd]);
|
|
3482
|
-
|
|
4427
|
+
React20.useEffect(() => {
|
|
3483
4428
|
if (resizingColumn) {
|
|
3484
4429
|
window.addEventListener("mousemove", handleMouseMove);
|
|
3485
4430
|
window.addEventListener("mouseup", handleMouseUp);
|
|
@@ -3489,7 +4434,7 @@ function useColumnResizeManager(options) {
|
|
|
3489
4434
|
};
|
|
3490
4435
|
}
|
|
3491
4436
|
}, [resizingColumn, handleMouseMove, handleMouseUp]);
|
|
3492
|
-
const getResizeProps =
|
|
4437
|
+
const getResizeProps = React20.useCallback(
|
|
3493
4438
|
(columnKey) => {
|
|
3494
4439
|
const column = getColumn(columnKey);
|
|
3495
4440
|
const isResizable = resizableColumns && column?.resizable !== false;
|
|
@@ -3775,15 +4720,15 @@ function DataGrid({
|
|
|
3775
4720
|
hasMore = false,
|
|
3776
4721
|
loadingMore = false
|
|
3777
4722
|
}) {
|
|
3778
|
-
const parentRef =
|
|
3779
|
-
const headerRef =
|
|
3780
|
-
const [headerHeight, setHeaderHeight] =
|
|
3781
|
-
const [hoveredCell, setHoveredCell] =
|
|
3782
|
-
const visibleColumns =
|
|
4723
|
+
const parentRef = React20__namespace.useRef(null);
|
|
4724
|
+
const headerRef = React20__namespace.useRef(null);
|
|
4725
|
+
const [headerHeight, setHeaderHeight] = React20__namespace.useState(40);
|
|
4726
|
+
const [hoveredCell, setHoveredCell] = React20__namespace.useState(null);
|
|
4727
|
+
const visibleColumns = React20__namespace.useMemo(
|
|
3783
4728
|
() => columns.filter((col) => !col.hidden),
|
|
3784
4729
|
[columns]
|
|
3785
4730
|
);
|
|
3786
|
-
const getCellValue2 =
|
|
4731
|
+
const getCellValue2 = React20__namespace.useCallback(
|
|
3787
4732
|
(row, column) => {
|
|
3788
4733
|
if (column.accessor) {
|
|
3789
4734
|
return column.accessor(row);
|
|
@@ -3812,7 +4757,7 @@ function DataGrid({
|
|
|
3812
4757
|
data,
|
|
3813
4758
|
getCellValue: getCellValue2
|
|
3814
4759
|
});
|
|
3815
|
-
const processedData =
|
|
4760
|
+
const processedData = React20__namespace.useMemo(() => {
|
|
3816
4761
|
let result = data;
|
|
3817
4762
|
if (enableInternalFiltering && !isControlled.filters && state.filters.length > 0) {
|
|
3818
4763
|
result = applyFilters(result, state.filters, visibleColumns);
|
|
@@ -3840,7 +4785,7 @@ function DataGrid({
|
|
|
3840
4785
|
onColumnResizeEnd
|
|
3841
4786
|
});
|
|
3842
4787
|
const shouldVirtualize = virtualized ?? processedData.length > 100;
|
|
3843
|
-
|
|
4788
|
+
React20__namespace.useLayoutEffect(() => {
|
|
3844
4789
|
if (headerRef.current && shouldVirtualize) {
|
|
3845
4790
|
setHeaderHeight(headerRef.current.offsetHeight);
|
|
3846
4791
|
}
|
|
@@ -3852,13 +4797,13 @@ function DataGrid({
|
|
|
3852
4797
|
overscan: DEFAULT_OVERSCAN,
|
|
3853
4798
|
enabled: shouldVirtualize
|
|
3854
4799
|
});
|
|
3855
|
-
const tableWidth =
|
|
4800
|
+
const tableWidth = React20__namespace.useMemo(() => {
|
|
3856
4801
|
return visibleColumns.reduce((acc, col) => {
|
|
3857
4802
|
const width = state.columnWidths[col.key] || col.width || estimateColumnWidth(col);
|
|
3858
4803
|
return acc + width;
|
|
3859
4804
|
}, 0);
|
|
3860
4805
|
}, [visibleColumns, state.columnWidths]);
|
|
3861
|
-
const visibleRowCount =
|
|
4806
|
+
const visibleRowCount = React20__namespace.useMemo(() => {
|
|
3862
4807
|
if (!parentRef.current) return 10;
|
|
3863
4808
|
return Math.floor(parentRef.current.clientHeight / DEFAULT_ROW_HEIGHT);
|
|
3864
4809
|
}, []);
|
|
@@ -3877,7 +4822,7 @@ function DataGrid({
|
|
|
3877
4822
|
rowVirtualizer.scrollToIndex(rowIndex, { align: "auto" });
|
|
3878
4823
|
}
|
|
3879
4824
|
});
|
|
3880
|
-
const handleBlur =
|
|
4825
|
+
const handleBlur = React20__namespace.useCallback(
|
|
3881
4826
|
(event) => {
|
|
3882
4827
|
const target = event.target;
|
|
3883
4828
|
const relatedTarget = event.relatedTarget;
|
|
@@ -3935,7 +4880,7 @@ function DataGrid({
|
|
|
3935
4880
|
},
|
|
3936
4881
|
[state.editingCell, actions]
|
|
3937
4882
|
);
|
|
3938
|
-
|
|
4883
|
+
React20__namespace.useEffect(() => {
|
|
3939
4884
|
if (!infiniteScroll || !hasMore || loadingMore || !parentRef.current) return;
|
|
3940
4885
|
const observer = new IntersectionObserver(
|
|
3941
4886
|
(entries) => {
|
|
@@ -4379,7 +5324,7 @@ function DataGrid({
|
|
|
4379
5324
|
);
|
|
4380
5325
|
}
|
|
4381
5326
|
function PaginationFooter({ pagination }) {
|
|
4382
|
-
const [goToPage, setGoToPage] =
|
|
5327
|
+
const [goToPage, setGoToPage] = React20__namespace.useState("");
|
|
4383
5328
|
const handleGoToPage = () => {
|
|
4384
5329
|
const page = parseInt(goToPage, 10);
|
|
4385
5330
|
if (!isNaN(page) && page >= 1 && page <= pagination.totalPages) {
|
|
@@ -4497,21 +5442,21 @@ function Autocomplete({
|
|
|
4497
5442
|
className,
|
|
4498
5443
|
clearable = false
|
|
4499
5444
|
}) {
|
|
4500
|
-
const [open, setOpen] =
|
|
4501
|
-
const [search, setSearch] =
|
|
4502
|
-
const inputRef =
|
|
4503
|
-
const selectedOption =
|
|
5445
|
+
const [open, setOpen] = React20__namespace.useState(false);
|
|
5446
|
+
const [search, setSearch] = React20__namespace.useState("");
|
|
5447
|
+
const inputRef = React20__namespace.useRef(null);
|
|
5448
|
+
const selectedOption = React20__namespace.useMemo(
|
|
4504
5449
|
() => options.find((opt) => opt.value === value),
|
|
4505
5450
|
[options, value]
|
|
4506
5451
|
);
|
|
4507
|
-
const filteredOptions =
|
|
5452
|
+
const filteredOptions = React20__namespace.useMemo(() => {
|
|
4508
5453
|
if (!search.trim()) return options;
|
|
4509
5454
|
const searchLower = search.toLowerCase();
|
|
4510
5455
|
return options.filter(
|
|
4511
5456
|
(opt) => opt.label.toLowerCase().includes(searchLower) || opt.description?.toLowerCase().includes(searchLower)
|
|
4512
5457
|
);
|
|
4513
5458
|
}, [options, search]);
|
|
4514
|
-
const groupedOptions =
|
|
5459
|
+
const groupedOptions = React20__namespace.useMemo(() => {
|
|
4515
5460
|
const groups = {};
|
|
4516
5461
|
const ungrouped = [];
|
|
4517
5462
|
filteredOptions.forEach((opt) => {
|
|
@@ -4525,7 +5470,7 @@ function Autocomplete({
|
|
|
4525
5470
|
return { groups, ungrouped };
|
|
4526
5471
|
}, [filteredOptions]);
|
|
4527
5472
|
const hasGroups = Object.keys(groupedOptions.groups).length > 0;
|
|
4528
|
-
const handleSelect =
|
|
5473
|
+
const handleSelect = React20__namespace.useCallback(
|
|
4529
5474
|
(optionValue) => {
|
|
4530
5475
|
onChange?.(optionValue);
|
|
4531
5476
|
setOpen(false);
|
|
@@ -4533,7 +5478,7 @@ function Autocomplete({
|
|
|
4533
5478
|
},
|
|
4534
5479
|
[onChange]
|
|
4535
5480
|
);
|
|
4536
|
-
const handleClear =
|
|
5481
|
+
const handleClear = React20__namespace.useCallback(
|
|
4537
5482
|
(e) => {
|
|
4538
5483
|
e.stopPropagation();
|
|
4539
5484
|
onChange?.(void 0);
|
|
@@ -4541,7 +5486,7 @@ function Autocomplete({
|
|
|
4541
5486
|
},
|
|
4542
5487
|
[onChange]
|
|
4543
5488
|
);
|
|
4544
|
-
|
|
5489
|
+
React20__namespace.useEffect(() => {
|
|
4545
5490
|
if (open) {
|
|
4546
5491
|
const timeout = setTimeout(() => {
|
|
4547
5492
|
inputRef.current?.focus();
|
|
@@ -4551,7 +5496,7 @@ function Autocomplete({
|
|
|
4551
5496
|
setSearch("");
|
|
4552
5497
|
}
|
|
4553
5498
|
}, [open]);
|
|
4554
|
-
const handleKeyDown =
|
|
5499
|
+
const handleKeyDown = React20__namespace.useCallback((e) => {
|
|
4555
5500
|
if (e.key === "Escape") {
|
|
4556
5501
|
setOpen(false);
|
|
4557
5502
|
}
|
|
@@ -4727,7 +5672,7 @@ var iconButtonVariants = classVarianceAuthority.cva(
|
|
|
4727
5672
|
}
|
|
4728
5673
|
}
|
|
4729
5674
|
);
|
|
4730
|
-
var IconButton =
|
|
5675
|
+
var IconButton = React20__namespace.forwardRef(
|
|
4731
5676
|
({ className, variant, size, isActive = false, icon, children, ...props }, ref) => {
|
|
4732
5677
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
4733
5678
|
"button",
|
|
@@ -4751,7 +5696,7 @@ var IconButton = React33__namespace.forwardRef(
|
|
|
4751
5696
|
);
|
|
4752
5697
|
IconButton.displayName = "IconButton";
|
|
4753
5698
|
function CopyButton({ content, className, size = "md" }) {
|
|
4754
|
-
const [copied, setCopied] =
|
|
5699
|
+
const [copied, setCopied] = React20__namespace.useState(false);
|
|
4755
5700
|
const handleCopy = async () => {
|
|
4756
5701
|
try {
|
|
4757
5702
|
await navigator.clipboard.writeText(content);
|
|
@@ -5524,11 +6469,11 @@ function ThemePicker({
|
|
|
5524
6469
|
align = "end",
|
|
5525
6470
|
side = "bottom"
|
|
5526
6471
|
}) {
|
|
5527
|
-
const [open, setOpen] =
|
|
5528
|
-
const [selectedTheme, setSelectedTheme] =
|
|
6472
|
+
const [open, setOpen] = React20__namespace.useState(false);
|
|
6473
|
+
const [selectedTheme, setSelectedTheme] = React20__namespace.useState(
|
|
5529
6474
|
value || themes[0]
|
|
5530
6475
|
);
|
|
5531
|
-
|
|
6476
|
+
React20__namespace.useEffect(() => {
|
|
5532
6477
|
if (value) {
|
|
5533
6478
|
setSelectedTheme(value);
|
|
5534
6479
|
}
|
|
@@ -5638,19 +6583,19 @@ function getSafePosition(x, y, menuWidth, menuHeight) {
|
|
|
5638
6583
|
return { x: safeX, y: safeY };
|
|
5639
6584
|
}
|
|
5640
6585
|
function MenuItem({ item, onClose, depth = 0 }) {
|
|
5641
|
-
const [isSubmenuOpen, setIsSubmenuOpen] =
|
|
5642
|
-
const [submenuPosition, setSubmenuPosition] =
|
|
5643
|
-
const itemRef =
|
|
5644
|
-
const hoverTimeoutRef =
|
|
6586
|
+
const [isSubmenuOpen, setIsSubmenuOpen] = React20__namespace.useState(false);
|
|
6587
|
+
const [submenuPosition, setSubmenuPosition] = React20__namespace.useState(null);
|
|
6588
|
+
const itemRef = React20__namespace.useRef(null);
|
|
6589
|
+
const hoverTimeoutRef = React20__namespace.useRef(null);
|
|
5645
6590
|
const hasSubmenu = item.submenu && item.submenu.length > 0;
|
|
5646
|
-
|
|
6591
|
+
React20__namespace.useEffect(() => {
|
|
5647
6592
|
return () => {
|
|
5648
6593
|
if (hoverTimeoutRef.current) {
|
|
5649
6594
|
clearTimeout(hoverTimeoutRef.current);
|
|
5650
6595
|
}
|
|
5651
6596
|
};
|
|
5652
6597
|
}, []);
|
|
5653
|
-
const handleMouseEnter =
|
|
6598
|
+
const handleMouseEnter = React20__namespace.useCallback(() => {
|
|
5654
6599
|
if (hoverTimeoutRef.current) {
|
|
5655
6600
|
clearTimeout(hoverTimeoutRef.current);
|
|
5656
6601
|
}
|
|
@@ -5670,22 +6615,22 @@ function MenuItem({ item, onClose, depth = 0 }) {
|
|
|
5670
6615
|
setIsSubmenuOpen(true);
|
|
5671
6616
|
}
|
|
5672
6617
|
}, [hasSubmenu, item.submenu?.length]);
|
|
5673
|
-
const handleMouseLeave =
|
|
6618
|
+
const handleMouseLeave = React20__namespace.useCallback(() => {
|
|
5674
6619
|
hoverTimeoutRef.current = setTimeout(() => {
|
|
5675
6620
|
setIsSubmenuOpen(false);
|
|
5676
6621
|
}, 100);
|
|
5677
6622
|
}, []);
|
|
5678
|
-
const handleSubmenuMouseEnter =
|
|
6623
|
+
const handleSubmenuMouseEnter = React20__namespace.useCallback(() => {
|
|
5679
6624
|
if (hoverTimeoutRef.current) {
|
|
5680
6625
|
clearTimeout(hoverTimeoutRef.current);
|
|
5681
6626
|
}
|
|
5682
6627
|
}, []);
|
|
5683
|
-
const handleSubmenuMouseLeave =
|
|
6628
|
+
const handleSubmenuMouseLeave = React20__namespace.useCallback(() => {
|
|
5684
6629
|
hoverTimeoutRef.current = setTimeout(() => {
|
|
5685
6630
|
setIsSubmenuOpen(false);
|
|
5686
6631
|
}, 100);
|
|
5687
6632
|
}, []);
|
|
5688
|
-
const handleClick =
|
|
6633
|
+
const handleClick = React20__namespace.useCallback(() => {
|
|
5689
6634
|
if (item.disabled) return;
|
|
5690
6635
|
if (!hasSubmenu && item.action) {
|
|
5691
6636
|
item.action();
|
|
@@ -5765,12 +6710,12 @@ function ContextMenu({
|
|
|
5765
6710
|
anchorEl,
|
|
5766
6711
|
className
|
|
5767
6712
|
}) {
|
|
5768
|
-
const menuRef =
|
|
5769
|
-
const [menuPosition, setMenuPosition] =
|
|
6713
|
+
const menuRef = React20__namespace.useRef(null);
|
|
6714
|
+
const [menuPosition, setMenuPosition] = React20__namespace.useState({
|
|
5770
6715
|
x: 0,
|
|
5771
6716
|
y: 0
|
|
5772
6717
|
});
|
|
5773
|
-
|
|
6718
|
+
React20__namespace.useEffect(() => {
|
|
5774
6719
|
if (!isOpen) return;
|
|
5775
6720
|
let x = position.x;
|
|
5776
6721
|
let y = position.y;
|
|
@@ -5789,7 +6734,7 @@ function ContextMenu({
|
|
|
5789
6734
|
}
|
|
5790
6735
|
});
|
|
5791
6736
|
}, [isOpen, position, anchorEl]);
|
|
5792
|
-
|
|
6737
|
+
React20__namespace.useEffect(() => {
|
|
5793
6738
|
if (!isOpen) return;
|
|
5794
6739
|
const handleClickOutside = (e) => {
|
|
5795
6740
|
if (menuRef.current && !menuRef.current.contains(e.target)) {
|
|
@@ -5833,16 +6778,16 @@ function ContextMenu({
|
|
|
5833
6778
|
);
|
|
5834
6779
|
}
|
|
5835
6780
|
function useContextMenu() {
|
|
5836
|
-
const [isOpen, setIsOpen] =
|
|
5837
|
-
const [position, setPosition] =
|
|
5838
|
-
const [targetItem, setTargetItem] =
|
|
5839
|
-
const menuRef =
|
|
5840
|
-
const openMenu =
|
|
6781
|
+
const [isOpen, setIsOpen] = React20__namespace.useState(false);
|
|
6782
|
+
const [position, setPosition] = React20__namespace.useState({ x: 0, y: 0 });
|
|
6783
|
+
const [targetItem, setTargetItem] = React20__namespace.useState(null);
|
|
6784
|
+
const menuRef = React20__namespace.useRef(null);
|
|
6785
|
+
const openMenu = React20__namespace.useCallback((x, y, item) => {
|
|
5841
6786
|
setPosition({ x, y });
|
|
5842
6787
|
setTargetItem(item);
|
|
5843
6788
|
setIsOpen(true);
|
|
5844
6789
|
}, []);
|
|
5845
|
-
const closeMenu =
|
|
6790
|
+
const closeMenu = React20__namespace.useCallback(() => {
|
|
5846
6791
|
setIsOpen(false);
|
|
5847
6792
|
setTargetItem(null);
|
|
5848
6793
|
}, []);
|
|
@@ -5874,14 +6819,21 @@ exports.AlertDialogTitle = AlertDialogTitle;
|
|
|
5874
6819
|
exports.AlertDialogTrigger = AlertDialogTrigger;
|
|
5875
6820
|
exports.Autocomplete = Autocomplete;
|
|
5876
6821
|
exports.Badge = Badge;
|
|
6822
|
+
exports.Board = Board;
|
|
6823
|
+
exports.BoardContent = BoardContent;
|
|
6824
|
+
exports.BoardHeader = BoardHeader;
|
|
5877
6825
|
exports.Button = Button;
|
|
5878
6826
|
exports.CYBERPUNK_THEME = CYBERPUNK_THEME;
|
|
5879
6827
|
exports.Calendar = Calendar;
|
|
5880
6828
|
exports.Card = Card;
|
|
6829
|
+
exports.CardActions = CardActions;
|
|
5881
6830
|
exports.CardContent = CardContent;
|
|
5882
6831
|
exports.CardDescription = CardDescription;
|
|
5883
6832
|
exports.CardFooter = CardFooter;
|
|
6833
|
+
exports.CardGrid = CardGrid;
|
|
5884
6834
|
exports.CardHeader = CardHeader;
|
|
6835
|
+
exports.CardImage = CardImage;
|
|
6836
|
+
exports.CardList = CardList;
|
|
5885
6837
|
exports.CardTitle = CardTitle;
|
|
5886
6838
|
exports.CellEditor = CellEditor;
|
|
5887
6839
|
exports.Checkbox = Checkbox;
|
|
@@ -5891,6 +6843,7 @@ exports.ContextMenu = ContextMenu;
|
|
|
5891
6843
|
exports.CopyButton = CopyButton;
|
|
5892
6844
|
exports.DARK_ELEGANT_THEME = DARK_ELEGANT_THEME;
|
|
5893
6845
|
exports.DataGrid = DataGrid;
|
|
6846
|
+
exports.DataTable = DataTable;
|
|
5894
6847
|
exports.DatePicker = DatePicker;
|
|
5895
6848
|
exports.DatePickerInput = DatePickerInput;
|
|
5896
6849
|
exports.DropdownMenu = DropdownMenu;
|
|
@@ -5943,6 +6896,7 @@ exports.SelectScrollUpButton = SelectScrollUpButton;
|
|
|
5943
6896
|
exports.SelectSeparator = SelectSeparator;
|
|
5944
6897
|
exports.SelectTrigger = SelectTrigger;
|
|
5945
6898
|
exports.SelectValue = SelectValue;
|
|
6899
|
+
exports.SelectableCard = SelectableCard;
|
|
5946
6900
|
exports.Separator = Separator;
|
|
5947
6901
|
exports.Skeleton = Skeleton;
|
|
5948
6902
|
exports.Switch = Switch;
|
|
@@ -5977,7 +6931,13 @@ exports.applySorting = applySorting;
|
|
|
5977
6931
|
exports.applyTheme = applyTheme;
|
|
5978
6932
|
exports.areThemesEqual = areThemesEqual;
|
|
5979
6933
|
exports.badgeVariants = badgeVariants;
|
|
6934
|
+
exports.boardVariants = boardVariants;
|
|
5980
6935
|
exports.buttonVariants = buttonVariants;
|
|
6936
|
+
exports.cardActionsVariants = cardActionsVariants;
|
|
6937
|
+
exports.cardGridVariants = cardGridVariants;
|
|
6938
|
+
exports.cardImageVariants = cardImageVariants;
|
|
6939
|
+
exports.cardListVariants = cardListVariants;
|
|
6940
|
+
exports.cardVariants = cardVariants;
|
|
5981
6941
|
exports.cloneTheme = cloneTheme;
|
|
5982
6942
|
exports.cn = cn;
|
|
5983
6943
|
exports.exportTheme = exportTheme;
|