@postxl/ui-components 1.0.0 → 1.0.2
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/LICENSE +50 -0
- package/dist/index.d.ts +738 -388
- package/dist/index.js +762 -355
- package/dist/index.js.map +1 -1
- package/package.json +15 -15
package/dist/index.js
CHANGED
|
@@ -2,6 +2,8 @@ import { clsx } from "clsx";
|
|
|
2
2
|
import { twMerge } from "tailwind-merge";
|
|
3
3
|
import * as AccordionPrimitive from "@radix-ui/react-accordion";
|
|
4
4
|
import { ArrowLeftIcon, ArrowRightIcon, CalendarIcon, CaretSortIcon, CheckIcon, ChevronDownIcon, ChevronLeftIcon, ChevronRightIcon, ChevronUpIcon, CircleIcon, CopyIcon, Cross1Icon, Cross2Icon, DotFilledIcon, DotsHorizontalIcon, DoubleArrowLeftIcon, DoubleArrowRightIcon, DragHandleDots2Icon, DragHandleHorizontalIcon, EnterFullScreenIcon, EraserIcon, MagnifyingGlassIcon, MixerHorizontalIcon, PlusIcon, TrashIcon } from "@radix-ui/react-icons";
|
|
5
|
+
import * as React$46 from "react";
|
|
6
|
+
import * as React$45 from "react";
|
|
5
7
|
import * as React$44 from "react";
|
|
6
8
|
import * as React$43 from "react";
|
|
7
9
|
import * as React$42 from "react";
|
|
@@ -55,7 +57,7 @@ import * as AvatarPrimitive from "@radix-ui/react-avatar";
|
|
|
55
57
|
import { DayPicker, getDefaultClassNames } from "react-day-picker";
|
|
56
58
|
import * as HoverCardPrimitive from "@radix-ui/react-hover-card";
|
|
57
59
|
import useEmblaCarousel from "embla-carousel-react";
|
|
58
|
-
import { BaselineIcon, CalendarIcon as CalendarIcon$1, CheckSquareIcon, ChevronDownIcon as ChevronDownIcon$1, ChevronUpIcon as ChevronUpIcon$1, EyeOffIcon, HashIcon, ListChecksIcon, ListIcon, PinIcon, PinOffIcon, SquareIcon, TextInitialIcon, XIcon } from "lucide-react";
|
|
60
|
+
import { BaselineIcon, CalendarIcon as CalendarIcon$1, CheckSquareIcon, ChevronDownIcon as ChevronDownIcon$1, ChevronUpIcon as ChevronUpIcon$1, EyeOffIcon, HashIcon, ListChecksIcon, ListIcon, PanelLeftIcon, PinIcon, PinOffIcon, SquareIcon, TextInitialIcon, XIcon } from "lucide-react";
|
|
59
61
|
import * as CollapsePrimitive from "@radix-ui/react-collapsible";
|
|
60
62
|
import { Command as Command$1 } from "cmdk";
|
|
61
63
|
import * as DialogPrimitive from "@radix-ui/react-dialog";
|
|
@@ -91,13 +93,13 @@ function cn(...inputs) {
|
|
|
91
93
|
//#endregion
|
|
92
94
|
//#region src/accordion/accordion.tsx
|
|
93
95
|
const Accordion = AccordionPrimitive.Root;
|
|
94
|
-
const AccordionItem = React$
|
|
96
|
+
const AccordionItem = React$46.forwardRef(({ className,...props }, ref) => /* @__PURE__ */ jsx(AccordionPrimitive.Item, {
|
|
95
97
|
ref,
|
|
96
98
|
className: cn("border-b", className),
|
|
97
99
|
...props
|
|
98
100
|
}));
|
|
99
101
|
AccordionItem.displayName = "AccordionItem";
|
|
100
|
-
const AccordionTrigger = React$
|
|
102
|
+
const AccordionTrigger = React$46.forwardRef(({ className, children,...props }, ref) => /* @__PURE__ */ jsx(AccordionPrimitive.Header, {
|
|
101
103
|
className: "flex",
|
|
102
104
|
children: /* @__PURE__ */ jsxs(AccordionPrimitive.Trigger, {
|
|
103
105
|
ref,
|
|
@@ -107,7 +109,7 @@ const AccordionTrigger = React$44.forwardRef(({ className, children,...props },
|
|
|
107
109
|
})
|
|
108
110
|
}));
|
|
109
111
|
AccordionTrigger.displayName = AccordionPrimitive.Trigger.displayName;
|
|
110
|
-
const AccordionContent = React$
|
|
112
|
+
const AccordionContent = React$46.forwardRef(({ className, children,...props }, ref) => /* @__PURE__ */ jsx(AccordionPrimitive.Content, {
|
|
111
113
|
ref,
|
|
112
114
|
className: "overflow-hidden text-sm data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down",
|
|
113
115
|
...props,
|
|
@@ -127,21 +129,21 @@ const alertVariants = cva("relative w-full rounded-lg border px-4 py-3 text-sm [
|
|
|
127
129
|
} },
|
|
128
130
|
defaultVariants: { variant: "default" }
|
|
129
131
|
});
|
|
130
|
-
const Alert = React$
|
|
132
|
+
const Alert = React$45.forwardRef(({ className, variant,...props }, ref) => /* @__PURE__ */ jsx("div", {
|
|
131
133
|
ref,
|
|
132
134
|
role: "alert",
|
|
133
135
|
className: cn(alertVariants({ variant }), className),
|
|
134
136
|
...props
|
|
135
137
|
}));
|
|
136
138
|
Alert.displayName = "Alert";
|
|
137
|
-
const AlertTitle = React$
|
|
139
|
+
const AlertTitle = React$45.forwardRef(({ className, children,...props }, ref) => /* @__PURE__ */ jsx("h5", {
|
|
138
140
|
ref,
|
|
139
141
|
className: cn("mb-1 font-medium leading-none tracking-tight", className),
|
|
140
142
|
...props,
|
|
141
143
|
children
|
|
142
144
|
}));
|
|
143
145
|
AlertTitle.displayName = "AlertTitle";
|
|
144
|
-
const AlertDescription = React$
|
|
146
|
+
const AlertDescription = React$45.forwardRef(({ className,...props }, ref) => /* @__PURE__ */ jsx("div", {
|
|
145
147
|
ref,
|
|
146
148
|
className: cn("text-sm [&_p]:leading-relaxed", className),
|
|
147
149
|
...props
|
|
@@ -200,13 +202,13 @@ function Button({ className, variant, size, asChild = false, __e2e_test_id__,...
|
|
|
200
202
|
const AlertDialog = AlertDialogPrimitive.Root;
|
|
201
203
|
const AlertDialogTrigger = AlertDialogPrimitive.Trigger;
|
|
202
204
|
const AlertDialogPortal = AlertDialogPrimitive.Portal;
|
|
203
|
-
const AlertDialogOverlay = React$
|
|
205
|
+
const AlertDialogOverlay = React$44.forwardRef(({ className,...props }, ref) => /* @__PURE__ */ jsx(AlertDialogPrimitive.Overlay, {
|
|
204
206
|
className: cn("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0", className),
|
|
205
207
|
...props,
|
|
206
208
|
ref
|
|
207
209
|
}));
|
|
208
210
|
AlertDialogOverlay.displayName = AlertDialogPrimitive.Overlay.displayName;
|
|
209
|
-
const AlertDialogContent = React$
|
|
211
|
+
const AlertDialogContent = React$44.forwardRef(({ className,...props }, ref) => /* @__PURE__ */ jsxs(AlertDialogPortal, { children: [/* @__PURE__ */ jsx(AlertDialogOverlay, {}), /* @__PURE__ */ jsx(AlertDialogPrimitive.Content, {
|
|
210
212
|
ref,
|
|
211
213
|
className: cn("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg", className),
|
|
212
214
|
...props
|
|
@@ -222,25 +224,25 @@ const AlertDialogFooter = ({ className,...props }) => /* @__PURE__ */ jsx("div",
|
|
|
222
224
|
...props
|
|
223
225
|
});
|
|
224
226
|
AlertDialogFooter.displayName = "AlertDialogFooter";
|
|
225
|
-
const AlertDialogTitle = React$
|
|
227
|
+
const AlertDialogTitle = React$44.forwardRef(({ className,...props }, ref) => /* @__PURE__ */ jsx(AlertDialogPrimitive.Title, {
|
|
226
228
|
ref,
|
|
227
229
|
className: cn("text-lg font-semibold", className),
|
|
228
230
|
...props
|
|
229
231
|
}));
|
|
230
232
|
AlertDialogTitle.displayName = AlertDialogPrimitive.Title.displayName;
|
|
231
|
-
const AlertDialogDescription = React$
|
|
233
|
+
const AlertDialogDescription = React$44.forwardRef(({ className,...props }, ref) => /* @__PURE__ */ jsx(AlertDialogPrimitive.Description, {
|
|
232
234
|
ref,
|
|
233
235
|
className: cn("text-sm text-muted-foreground", className),
|
|
234
236
|
...props
|
|
235
237
|
}));
|
|
236
238
|
AlertDialogDescription.displayName = AlertDialogPrimitive.Description.displayName;
|
|
237
|
-
const AlertDialogAction = React$
|
|
239
|
+
const AlertDialogAction = React$44.forwardRef(({ className,...props }, ref) => /* @__PURE__ */ jsx(AlertDialogPrimitive.Action, {
|
|
238
240
|
ref,
|
|
239
241
|
className: cn(buttonVariants(), className),
|
|
240
242
|
...props
|
|
241
243
|
}));
|
|
242
244
|
AlertDialogAction.displayName = AlertDialogPrimitive.Action.displayName;
|
|
243
|
-
const AlertDialogCancel = React$
|
|
245
|
+
const AlertDialogCancel = React$44.forwardRef(({ className,...props }, ref) => /* @__PURE__ */ jsx(AlertDialogPrimitive.Cancel, {
|
|
244
246
|
ref,
|
|
245
247
|
className: cn(buttonVariants({ variant: "outline" }), "mt-2 sm:mt-0", className),
|
|
246
248
|
...props
|
|
@@ -249,19 +251,19 @@ AlertDialogCancel.displayName = AlertDialogPrimitive.Cancel.displayName;
|
|
|
249
251
|
|
|
250
252
|
//#endregion
|
|
251
253
|
//#region src/avatar/avatar.tsx
|
|
252
|
-
const Avatar = React$
|
|
254
|
+
const Avatar = React$43.forwardRef(({ className,...props }, ref) => /* @__PURE__ */ jsx(AvatarPrimitive.Root, {
|
|
253
255
|
ref,
|
|
254
256
|
className: cn("relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full", className),
|
|
255
257
|
...props
|
|
256
258
|
}));
|
|
257
259
|
Avatar.displayName = AvatarPrimitive.Root.displayName;
|
|
258
|
-
const AvatarImage = React$
|
|
260
|
+
const AvatarImage = React$43.forwardRef(({ className,...props }, ref) => /* @__PURE__ */ jsx(AvatarPrimitive.Image, {
|
|
259
261
|
ref,
|
|
260
262
|
className: cn("aspect-square h-full w-full", className),
|
|
261
263
|
...props
|
|
262
264
|
}));
|
|
263
265
|
AvatarImage.displayName = AvatarPrimitive.Image.displayName;
|
|
264
|
-
const AvatarFallback = React$
|
|
266
|
+
const AvatarFallback = React$43.forwardRef(({ className,...props }, ref) => /* @__PURE__ */ jsx(AvatarPrimitive.Fallback, {
|
|
265
267
|
ref,
|
|
266
268
|
className: cn("flex h-full w-full items-center justify-center rounded-full bg-muted", className),
|
|
267
269
|
...props
|
|
@@ -307,25 +309,25 @@ function Badge({ className, variant, size, asChild = false,...props }) {
|
|
|
307
309
|
|
|
308
310
|
//#endregion
|
|
309
311
|
//#region src/breadcrumb/breadcrumb.tsx
|
|
310
|
-
const Breadcrumb = React$
|
|
312
|
+
const Breadcrumb = React$42.forwardRef(({ ...props }, ref) => /* @__PURE__ */ jsx("nav", {
|
|
311
313
|
ref,
|
|
312
314
|
"aria-label": "breadcrumb",
|
|
313
315
|
...props
|
|
314
316
|
}));
|
|
315
317
|
Breadcrumb.displayName = "Breadcrumb";
|
|
316
|
-
const BreadcrumbList = React$
|
|
318
|
+
const BreadcrumbList = React$42.forwardRef(({ className,...props }, ref) => /* @__PURE__ */ jsx("ol", {
|
|
317
319
|
ref,
|
|
318
320
|
className: cn("flex flex-wrap items-center gap-1.5 break-words text-sm text-muted-foreground sm:gap-2.5", className),
|
|
319
321
|
...props
|
|
320
322
|
}));
|
|
321
323
|
BreadcrumbList.displayName = "BreadcrumbList";
|
|
322
|
-
const BreadcrumbItem = React$
|
|
324
|
+
const BreadcrumbItem = React$42.forwardRef(({ className,...props }, ref) => /* @__PURE__ */ jsx("li", {
|
|
323
325
|
ref,
|
|
324
326
|
className: cn("inline-flex items-center gap-1.5", className),
|
|
325
327
|
...props
|
|
326
328
|
}));
|
|
327
329
|
BreadcrumbItem.displayName = "BreadcrumbItem";
|
|
328
|
-
const BreadcrumbLink = React$
|
|
330
|
+
const BreadcrumbLink = React$42.forwardRef(({ asChild, className,...props }, ref) => {
|
|
329
331
|
const Comp = asChild ? Slot : "a";
|
|
330
332
|
return /* @__PURE__ */ jsx(Comp, {
|
|
331
333
|
ref,
|
|
@@ -334,7 +336,7 @@ const BreadcrumbLink = React$40.forwardRef(({ asChild, className,...props }, ref
|
|
|
334
336
|
});
|
|
335
337
|
});
|
|
336
338
|
BreadcrumbLink.displayName = "BreadcrumbLink";
|
|
337
|
-
const BreadcrumbPage = React$
|
|
339
|
+
const BreadcrumbPage = React$42.forwardRef(({ className,...props }, ref) => /* @__PURE__ */ jsx("span", {
|
|
338
340
|
ref,
|
|
339
341
|
"aria-disabled": "true",
|
|
340
342
|
"aria-current": "page",
|
|
@@ -364,8 +366,8 @@ BreadcrumbEllipsis.displayName = "BreadcrumbElipssis";
|
|
|
364
366
|
//#region src/calendar/calendar.tsx
|
|
365
367
|
function Calendar({ className, classNames, showOutsideDays = true, captionLayout = "label", buttonVariant = "ghost", showYearNavigation = false, formatters, components,...props }) {
|
|
366
368
|
const defaultClassNames = getDefaultClassNames();
|
|
367
|
-
const [rangeSelectionStep, setRangeSelectionStep] = React$
|
|
368
|
-
const handleDayClick = React$
|
|
369
|
+
const [rangeSelectionStep, setRangeSelectionStep] = React$41.useState("from");
|
|
370
|
+
const handleDayClick = React$41.useCallback((day, modifiers, e) => {
|
|
369
371
|
if (props.mode === "range") {
|
|
370
372
|
const range = props.selected;
|
|
371
373
|
if (rangeSelectionStep === "from") {
|
|
@@ -395,8 +397,8 @@ function Calendar({ className, classNames, showOutsideDays = true, captionLayout
|
|
|
395
397
|
fromMonth = props.startMonth ?? new Date(nowYear - 100, 0);
|
|
396
398
|
toMonth = props.endMonth ?? new Date(nowYear + 100, 11);
|
|
397
399
|
}
|
|
398
|
-
const [currentMonth, setCurrentMonth] = React$
|
|
399
|
-
React$
|
|
400
|
+
const [currentMonth, setCurrentMonth] = React$41.useState(props.defaultMonth ?? props.month ?? new Date());
|
|
401
|
+
React$41.useEffect(() => {
|
|
400
402
|
if (props.month) setCurrentMonth(props.month);
|
|
401
403
|
}, [props.month]);
|
|
402
404
|
const addMonths = (date, months) => {
|
|
@@ -535,8 +537,8 @@ function Calendar({ className, classNames, showOutsideDays = true, captionLayout
|
|
|
535
537
|
}
|
|
536
538
|
function CalendarDayButton({ className, day, modifiers,...props }) {
|
|
537
539
|
const defaultClassNames = getDefaultClassNames();
|
|
538
|
-
const ref = React$
|
|
539
|
-
React$
|
|
540
|
+
const ref = React$41.useRef(null);
|
|
541
|
+
React$41.useEffect(() => {
|
|
540
542
|
if (modifiers.focused) ref.current?.focus();
|
|
541
543
|
}, [modifiers.focused]);
|
|
542
544
|
return /* @__PURE__ */ jsx(Button, {
|
|
@@ -555,38 +557,38 @@ function CalendarDayButton({ className, day, modifiers,...props }) {
|
|
|
555
557
|
|
|
556
558
|
//#endregion
|
|
557
559
|
//#region src/card/card.tsx
|
|
558
|
-
const Card = React$
|
|
560
|
+
const Card = React$40.forwardRef(({ className,...props }, ref) => /* @__PURE__ */ jsx("div", {
|
|
559
561
|
ref,
|
|
560
562
|
className: cn("rounded-xl border bg-card text-card-foreground shadow", className),
|
|
561
563
|
...props
|
|
562
564
|
}));
|
|
563
565
|
Card.displayName = "Card";
|
|
564
|
-
const CardHeader = React$
|
|
566
|
+
const CardHeader = React$40.forwardRef(({ className,...props }, ref) => /* @__PURE__ */ jsx("div", {
|
|
565
567
|
ref,
|
|
566
568
|
className: cn("flex flex-col space-y-1.5 p-6", className),
|
|
567
569
|
...props
|
|
568
570
|
}));
|
|
569
571
|
CardHeader.displayName = "CardHeader";
|
|
570
|
-
const CardTitle = React$
|
|
572
|
+
const CardTitle = React$40.forwardRef(({ className, children,...props }, ref) => /* @__PURE__ */ jsx("h3", {
|
|
571
573
|
ref,
|
|
572
574
|
className: cn("font-semibold leading-none tracking-tight", className),
|
|
573
575
|
...props,
|
|
574
576
|
children
|
|
575
577
|
}));
|
|
576
578
|
CardTitle.displayName = "CardTitle";
|
|
577
|
-
const CardDescription = React$
|
|
579
|
+
const CardDescription = React$40.forwardRef(({ className,...props }, ref) => /* @__PURE__ */ jsx("p", {
|
|
578
580
|
ref,
|
|
579
581
|
className: cn("text-sm text-muted-foreground", className),
|
|
580
582
|
...props
|
|
581
583
|
}));
|
|
582
584
|
CardDescription.displayName = "CardDescription";
|
|
583
|
-
const CardContent = React$
|
|
585
|
+
const CardContent = React$40.forwardRef(({ className,...props }, ref) => /* @__PURE__ */ jsx("div", {
|
|
584
586
|
ref,
|
|
585
587
|
className: cn("p-6 pt-0", className),
|
|
586
588
|
...props
|
|
587
589
|
}));
|
|
588
590
|
CardContent.displayName = "CardContent";
|
|
589
|
-
const CardFooter = React$
|
|
591
|
+
const CardFooter = React$40.forwardRef(({ className,...props }, ref) => /* @__PURE__ */ jsx("div", {
|
|
590
592
|
ref,
|
|
591
593
|
className: cn("flex items-center p-6 pt-0", className),
|
|
592
594
|
...props
|
|
@@ -597,7 +599,7 @@ CardFooter.displayName = "CardFooter";
|
|
|
597
599
|
//#region src/card-hover/card-hover.tsx
|
|
598
600
|
const HoverCard = HoverCardPrimitive.Root;
|
|
599
601
|
const HoverCardTrigger = HoverCardPrimitive.Trigger;
|
|
600
|
-
const HoverCardContent = React$
|
|
602
|
+
const HoverCardContent = React$39.forwardRef(({ className, align = "center", sideOffset = 4,...props }, ref) => /* @__PURE__ */ jsx(HoverCardPrimitive.Content, {
|
|
601
603
|
ref,
|
|
602
604
|
align,
|
|
603
605
|
sideOffset,
|
|
@@ -608,31 +610,31 @@ HoverCardContent.displayName = HoverCardPrimitive.Content.displayName;
|
|
|
608
610
|
|
|
609
611
|
//#endregion
|
|
610
612
|
//#region src/carousel/carousel.tsx
|
|
611
|
-
const CarouselContext = React$
|
|
613
|
+
const CarouselContext = React$38.createContext(null);
|
|
612
614
|
function useCarousel() {
|
|
613
|
-
const context = React$
|
|
615
|
+
const context = React$38.useContext(CarouselContext);
|
|
614
616
|
if (!context) throw new Error("useCarousel must be used within a <Carousel />");
|
|
615
617
|
return context;
|
|
616
618
|
}
|
|
617
|
-
const Carousel = React$
|
|
619
|
+
const Carousel = React$38.forwardRef(({ orientation = "horizontal", opts, setApi, plugins, className, children,...props }, ref) => {
|
|
618
620
|
const [carouselRef, api] = useEmblaCarousel({
|
|
619
621
|
...opts,
|
|
620
622
|
axis: orientation === "horizontal" ? "x" : "y"
|
|
621
623
|
}, plugins);
|
|
622
|
-
const [canScrollPrev, setCanScrollPrev] = React$
|
|
623
|
-
const [canScrollNext, setCanScrollNext] = React$
|
|
624
|
-
const onSelect = React$
|
|
624
|
+
const [canScrollPrev, setCanScrollPrev] = React$38.useState(false);
|
|
625
|
+
const [canScrollNext, setCanScrollNext] = React$38.useState(false);
|
|
626
|
+
const onSelect = React$38.useCallback(() => {
|
|
625
627
|
if (!api) return;
|
|
626
628
|
setCanScrollPrev(api.canScrollPrev());
|
|
627
629
|
setCanScrollNext(api.canScrollNext());
|
|
628
630
|
}, [api]);
|
|
629
|
-
const scrollPrev = React$
|
|
631
|
+
const scrollPrev = React$38.useCallback(() => {
|
|
630
632
|
api?.scrollPrev();
|
|
631
633
|
}, [api]);
|
|
632
|
-
const scrollNext = React$
|
|
634
|
+
const scrollNext = React$38.useCallback(() => {
|
|
633
635
|
api?.scrollNext();
|
|
634
636
|
}, [api]);
|
|
635
|
-
const handleKeyDown = React$
|
|
637
|
+
const handleKeyDown = React$38.useCallback((event) => {
|
|
636
638
|
if (event.key === "ArrowLeft") {
|
|
637
639
|
event.preventDefault();
|
|
638
640
|
scrollPrev();
|
|
@@ -641,11 +643,11 @@ const Carousel = React$36.forwardRef(({ orientation = "horizontal", opts, setApi
|
|
|
641
643
|
scrollNext();
|
|
642
644
|
}
|
|
643
645
|
}, [scrollPrev, scrollNext]);
|
|
644
|
-
React$
|
|
646
|
+
React$38.useEffect(() => {
|
|
645
647
|
if (!api || !setApi) return;
|
|
646
648
|
setApi(api);
|
|
647
649
|
}, [api, setApi]);
|
|
648
|
-
React$
|
|
650
|
+
React$38.useEffect(() => {
|
|
649
651
|
if (!api) return;
|
|
650
652
|
onSelect();
|
|
651
653
|
api.on("reInit", onSelect);
|
|
@@ -686,7 +688,7 @@ const Carousel = React$36.forwardRef(({ orientation = "horizontal", opts, setApi
|
|
|
686
688
|
});
|
|
687
689
|
});
|
|
688
690
|
Carousel.displayName = "Carousel";
|
|
689
|
-
const CarouselContent = React$
|
|
691
|
+
const CarouselContent = React$38.forwardRef(({ className,...props }, ref) => {
|
|
690
692
|
const { carouselRef, orientation } = useCarousel();
|
|
691
693
|
return /* @__PURE__ */ jsx("div", {
|
|
692
694
|
ref: carouselRef,
|
|
@@ -699,7 +701,7 @@ const CarouselContent = React$36.forwardRef(({ className,...props }, ref) => {
|
|
|
699
701
|
});
|
|
700
702
|
});
|
|
701
703
|
CarouselContent.displayName = "CarouselContent";
|
|
702
|
-
const CarouselItem = React$
|
|
704
|
+
const CarouselItem = React$38.forwardRef(({ className,...props }, ref) => {
|
|
703
705
|
const { orientation } = useCarousel();
|
|
704
706
|
return /* @__PURE__ */ jsx("div", {
|
|
705
707
|
ref,
|
|
@@ -709,7 +711,7 @@ const CarouselItem = React$36.forwardRef(({ className,...props }, ref) => {
|
|
|
709
711
|
});
|
|
710
712
|
});
|
|
711
713
|
CarouselItem.displayName = "CarouselItem";
|
|
712
|
-
const CarouselPrevious = React$
|
|
714
|
+
const CarouselPrevious = React$38.forwardRef(({ className, variant = "outline", size = "icon",...props }, ref) => {
|
|
713
715
|
const { orientation, scrollPrev, canScrollPrev } = useCarousel();
|
|
714
716
|
return /* @__PURE__ */ jsxs(Button, {
|
|
715
717
|
ref,
|
|
@@ -726,7 +728,7 @@ const CarouselPrevious = React$36.forwardRef(({ className, variant = "outline",
|
|
|
726
728
|
});
|
|
727
729
|
});
|
|
728
730
|
CarouselPrevious.displayName = "CarouselPrevious";
|
|
729
|
-
const CarouselNext = React$
|
|
731
|
+
const CarouselNext = React$38.forwardRef(({ className, variant = "outline", size = "icon",...props }, ref) => {
|
|
730
732
|
const { orientation, scrollNext, canScrollNext } = useCarousel();
|
|
731
733
|
return /* @__PURE__ */ jsxs(Button, {
|
|
732
734
|
ref,
|
|
@@ -910,7 +912,7 @@ function DialogDescription({ className,...props }) {
|
|
|
910
912
|
|
|
911
913
|
//#endregion
|
|
912
914
|
//#region src/command-palette/command-palette.tsx
|
|
913
|
-
const CommandPalette = React$
|
|
915
|
+
const CommandPalette = React$37.forwardRef(({ className,...props }, ref) => /* @__PURE__ */ jsx(Command$1, {
|
|
914
916
|
ref,
|
|
915
917
|
className: cn("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground", className),
|
|
916
918
|
...props
|
|
@@ -928,7 +930,7 @@ const CommandPaletteDialog = ({ children,...props }) => {
|
|
|
928
930
|
})
|
|
929
931
|
});
|
|
930
932
|
};
|
|
931
|
-
const CommandPaletteInput = React$
|
|
933
|
+
const CommandPaletteInput = React$37.forwardRef(({ className,...props }, ref) => /* @__PURE__ */ jsxs("div", {
|
|
932
934
|
className: "flex items-center border-b px-3",
|
|
933
935
|
"data-cmdk-input-wrapper": "",
|
|
934
936
|
children: [/* @__PURE__ */ jsx(MagnifyingGlassIcon, { className: "mr-2 h-4 w-4 shrink-0 opacity-50" }), /* @__PURE__ */ jsx(Command$1.Input, {
|
|
@@ -938,31 +940,31 @@ const CommandPaletteInput = React$35.forwardRef(({ className,...props }, ref) =>
|
|
|
938
940
|
})]
|
|
939
941
|
}));
|
|
940
942
|
CommandPaletteInput.displayName = Command$1.Input.displayName;
|
|
941
|
-
const CommandPaletteList = React$
|
|
943
|
+
const CommandPaletteList = React$37.forwardRef(({ className,...props }, ref) => /* @__PURE__ */ jsx(Command$1.List, {
|
|
942
944
|
ref,
|
|
943
945
|
className: cn("max-h-[300px] overflow-y-auto overflow-x-hidden", className),
|
|
944
946
|
...props
|
|
945
947
|
}));
|
|
946
948
|
CommandPaletteList.displayName = Command$1.List.displayName;
|
|
947
|
-
const CommandPaletteEmpty = React$
|
|
949
|
+
const CommandPaletteEmpty = React$37.forwardRef((props, ref) => /* @__PURE__ */ jsx(Command$1.Empty, {
|
|
948
950
|
ref,
|
|
949
951
|
className: "py-6 text-center text-sm",
|
|
950
952
|
...props
|
|
951
953
|
}));
|
|
952
954
|
CommandPaletteEmpty.displayName = Command$1.Empty.displayName;
|
|
953
|
-
const CommandPaletteGroup = React$
|
|
955
|
+
const CommandPaletteGroup = React$37.forwardRef(({ className,...props }, ref) => /* @__PURE__ */ jsx(Command$1.Group, {
|
|
954
956
|
ref,
|
|
955
957
|
className: cn("overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground", className),
|
|
956
958
|
...props
|
|
957
959
|
}));
|
|
958
960
|
CommandPaletteGroup.displayName = Command$1.Group.displayName;
|
|
959
|
-
const CommandPaletteSeparator = React$
|
|
961
|
+
const CommandPaletteSeparator = React$37.forwardRef(({ className,...props }, ref) => /* @__PURE__ */ jsx(Command$1.Separator, {
|
|
960
962
|
ref,
|
|
961
963
|
className: cn("-mx-1 h-px bg-border", className),
|
|
962
964
|
...props
|
|
963
965
|
}));
|
|
964
966
|
CommandPaletteSeparator.displayName = Command$1.Separator.displayName;
|
|
965
|
-
const CommandPaletteItem = React$
|
|
967
|
+
const CommandPaletteItem = React$37.forwardRef(({ className,...props }, ref) => /* @__PURE__ */ jsx(Command$1.Item, {
|
|
966
968
|
ref,
|
|
967
969
|
className: cn("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none data-[disabled=true]:pointer-events-none data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground data-[disabled=true]:opacity-50", className),
|
|
968
970
|
...props
|
|
@@ -1038,8 +1040,8 @@ const frameworks = [
|
|
|
1038
1040
|
}
|
|
1039
1041
|
];
|
|
1040
1042
|
function ComboboxDemo() {
|
|
1041
|
-
const [open, setOpen] = React$
|
|
1042
|
-
const [value, setValue] = React$
|
|
1043
|
+
const [open, setOpen] = React$36.useState(false);
|
|
1044
|
+
const [value, setValue] = React$36.useState("");
|
|
1043
1045
|
return /* @__PURE__ */ jsxs(Popover, {
|
|
1044
1046
|
open,
|
|
1045
1047
|
onOpenChange: setOpen,
|
|
@@ -1068,6 +1070,45 @@ function ComboboxDemo() {
|
|
|
1068
1070
|
});
|
|
1069
1071
|
}
|
|
1070
1072
|
|
|
1073
|
+
//#endregion
|
|
1074
|
+
//#region src/spinner/spinner.tsx
|
|
1075
|
+
function Spinner({ classNames }) {
|
|
1076
|
+
return /* @__PURE__ */ jsx("div", {
|
|
1077
|
+
className: cn("flex justify-center items-center w-full h-full", classNames),
|
|
1078
|
+
children: /* @__PURE__ */ jsxs("svg", {
|
|
1079
|
+
className: "w-auto text-[inherit] h-full animate-spin",
|
|
1080
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1081
|
+
fill: "none",
|
|
1082
|
+
viewBox: "0 0 24 24",
|
|
1083
|
+
children: [/* @__PURE__ */ jsx("circle", {
|
|
1084
|
+
className: "opacity-25",
|
|
1085
|
+
cx: "12",
|
|
1086
|
+
cy: "12",
|
|
1087
|
+
r: "10",
|
|
1088
|
+
stroke: "currentColor",
|
|
1089
|
+
strokeWidth: "4"
|
|
1090
|
+
}), /* @__PURE__ */ jsx("path", {
|
|
1091
|
+
className: "opacity-75",
|
|
1092
|
+
fill: "currentColor",
|
|
1093
|
+
d: "M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"
|
|
1094
|
+
})]
|
|
1095
|
+
})
|
|
1096
|
+
});
|
|
1097
|
+
}
|
|
1098
|
+
function Loader({ label, disabled }) {
|
|
1099
|
+
if (disabled) return null;
|
|
1100
|
+
return /* @__PURE__ */ jsx("div", {
|
|
1101
|
+
className: "flex absolute z-1 left-0 top-0 bottom-0 right-0 bg-secondary/50",
|
|
1102
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
1103
|
+
className: "flex items-center justify-center flex-1 flex-col",
|
|
1104
|
+
children: [/* @__PURE__ */ jsx(Spinner, { classNames: "w-[24px] h-[25px]" }), label && /* @__PURE__ */ jsx("h3", {
|
|
1105
|
+
className: "pb-0 pt-3 font-medium text-xl mb-2 text-muted-foreground",
|
|
1106
|
+
children: label
|
|
1107
|
+
})]
|
|
1108
|
+
})
|
|
1109
|
+
});
|
|
1110
|
+
}
|
|
1111
|
+
|
|
1071
1112
|
//#endregion
|
|
1072
1113
|
//#region src/command/command.tsx
|
|
1073
1114
|
function Command({ className,...props }) {
|
|
@@ -1110,17 +1151,18 @@ const commandInputVariants = cva("", {
|
|
|
1110
1151
|
inputSize: "md"
|
|
1111
1152
|
}
|
|
1112
1153
|
});
|
|
1113
|
-
const CommandInput = React.forwardRef(({ className, wrapperClassName, variant, inputSize,...props }, ref) => {
|
|
1154
|
+
const CommandInput = React.forwardRef(({ className, wrapperClassName, loading, readOnly, variant, inputSize,...props }, ref) => {
|
|
1114
1155
|
return /* @__PURE__ */ jsxs("div", {
|
|
1115
1156
|
"data-slot": "command-input-wrapper",
|
|
1116
1157
|
className: cn("flex items-center gap-2 border-b px-3", commandInputVariants({
|
|
1117
1158
|
variant,
|
|
1118
1159
|
inputSize
|
|
1119
1160
|
}), wrapperClassName),
|
|
1120
|
-
children: [/* @__PURE__ */ jsx(MagnifyingGlassIcon, { className: "size-4 shrink-0 opacity-50" }), /* @__PURE__ */ jsx(Command$1.Input, {
|
|
1161
|
+
children: [loading ? /* @__PURE__ */ jsx(Spinner, { classNames: "size-4" }) : /* @__PURE__ */ jsx(MagnifyingGlassIcon, { className: "size-4 shrink-0 opacity-50" }), /* @__PURE__ */ jsx(Command$1.Input, {
|
|
1121
1162
|
ref,
|
|
1122
1163
|
"data-slot": "command-input",
|
|
1123
1164
|
className: cn("placeholder:text-muted-foreground flex w-full rounded bg-transparent text-sm outline-hidden disabled:cursor-not-allowed disabled:opacity-50", className),
|
|
1165
|
+
readOnly: loading || readOnly,
|
|
1124
1166
|
...props
|
|
1125
1167
|
})]
|
|
1126
1168
|
});
|
|
@@ -1169,45 +1211,6 @@ function CommandShortcut({ className,...props }) {
|
|
|
1169
1211
|
});
|
|
1170
1212
|
}
|
|
1171
1213
|
|
|
1172
|
-
//#endregion
|
|
1173
|
-
//#region src/spinner/spinner.tsx
|
|
1174
|
-
function Spinner({ classNames }) {
|
|
1175
|
-
return /* @__PURE__ */ jsx("div", {
|
|
1176
|
-
className: cn("flex justify-center items-center w-full h-full", classNames),
|
|
1177
|
-
children: /* @__PURE__ */ jsxs("svg", {
|
|
1178
|
-
className: "w-auto text-[inherit] h-full animate-spin",
|
|
1179
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
1180
|
-
fill: "none",
|
|
1181
|
-
viewBox: "0 0 24 24",
|
|
1182
|
-
children: [/* @__PURE__ */ jsx("circle", {
|
|
1183
|
-
className: "opacity-25",
|
|
1184
|
-
cx: "12",
|
|
1185
|
-
cy: "12",
|
|
1186
|
-
r: "10",
|
|
1187
|
-
stroke: "currentColor",
|
|
1188
|
-
strokeWidth: "4"
|
|
1189
|
-
}), /* @__PURE__ */ jsx("path", {
|
|
1190
|
-
className: "opacity-75",
|
|
1191
|
-
fill: "currentColor",
|
|
1192
|
-
d: "M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"
|
|
1193
|
-
})]
|
|
1194
|
-
})
|
|
1195
|
-
});
|
|
1196
|
-
}
|
|
1197
|
-
function Loader({ label, disabled }) {
|
|
1198
|
-
if (disabled) return null;
|
|
1199
|
-
return /* @__PURE__ */ jsx("div", {
|
|
1200
|
-
className: "flex absolute z-1 left-0 top-0 bottom-0 right-0 bg-secondary/50",
|
|
1201
|
-
children: /* @__PURE__ */ jsxs("div", {
|
|
1202
|
-
className: "flex items-center justify-center flex-1 flex-col",
|
|
1203
|
-
children: [/* @__PURE__ */ jsx(Spinner, { classNames: "w-[24px] h-[25px]" }), label && /* @__PURE__ */ jsx("h3", {
|
|
1204
|
-
className: "pb-0 pt-3 font-medium text-xl mb-2 text-muted-foreground",
|
|
1205
|
-
children: label
|
|
1206
|
-
})]
|
|
1207
|
-
})
|
|
1208
|
-
});
|
|
1209
|
-
}
|
|
1210
|
-
|
|
1211
1214
|
//#endregion
|
|
1212
1215
|
//#region src/content-frame/content-frame.tsx
|
|
1213
1216
|
const gridContentFrameVariants = cva("flex flex-col border-1 border-(--discreet-border) h-full w-full", {
|
|
@@ -1224,9 +1227,9 @@ const gridContentFrameHeaderVariants = cva("flex items-center overflow-hidden p-
|
|
|
1224
1227
|
} },
|
|
1225
1228
|
defaultVariants: { variant: "default" }
|
|
1226
1229
|
});
|
|
1227
|
-
const ContentFrame = ({ title = "", controls = [], indicators = [], children, onExpand, variant, collapsed, titleLink, isLoading = false }) => {
|
|
1230
|
+
const ContentFrame = ({ title = "", controls = [], indicators = [], children, onExpand, variant, collapsed, titleLink, isLoading = false, className }) => {
|
|
1228
1231
|
return /* @__PURE__ */ jsx("div", {
|
|
1229
|
-
className: cn(gridContentFrameVariants({ variant })),
|
|
1232
|
+
className: cn(gridContentFrameVariants({ variant }), className),
|
|
1230
1233
|
children: collapsed ? /* @__PURE__ */ jsxs("div", {
|
|
1231
1234
|
className: "flex gap-2.5 min-w-0 items-center [writing-mode:vertical-lr]",
|
|
1232
1235
|
children: [/* @__PURE__ */ jsx("h2", {
|
|
@@ -1278,32 +1281,32 @@ const ContextMenuGroup = ContextMenuPrimitive.Group;
|
|
|
1278
1281
|
const ContextMenuPortal = ContextMenuPrimitive.Portal;
|
|
1279
1282
|
const ContextMenuSub = ContextMenuPrimitive.Sub;
|
|
1280
1283
|
const ContextMenuRadioGroup = ContextMenuPrimitive.RadioGroup;
|
|
1281
|
-
const ContextMenuSubTrigger = React$
|
|
1284
|
+
const ContextMenuSubTrigger = React$35.forwardRef(({ className, inset, children,...props }, ref) => /* @__PURE__ */ jsxs(ContextMenuPrimitive.SubTrigger, {
|
|
1282
1285
|
ref,
|
|
1283
1286
|
className: cn("flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground", inset && "pl-8", className),
|
|
1284
1287
|
...props,
|
|
1285
1288
|
children: [children, /* @__PURE__ */ jsx(ChevronRightIcon, { className: "ml-auto h-4 w-4" })]
|
|
1286
1289
|
}));
|
|
1287
1290
|
ContextMenuSubTrigger.displayName = ContextMenuPrimitive.SubTrigger.displayName;
|
|
1288
|
-
const ContextMenuSubContent = React$
|
|
1291
|
+
const ContextMenuSubContent = React$35.forwardRef(({ className,...props }, ref) => /* @__PURE__ */ jsx(ContextMenuPrimitive.SubContent, {
|
|
1289
1292
|
ref,
|
|
1290
1293
|
className: cn("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2", className),
|
|
1291
1294
|
...props
|
|
1292
1295
|
}));
|
|
1293
1296
|
ContextMenuSubContent.displayName = ContextMenuPrimitive.SubContent.displayName;
|
|
1294
|
-
const ContextMenuContent = React$
|
|
1297
|
+
const ContextMenuContent = React$35.forwardRef(({ className,...props }, ref) => /* @__PURE__ */ jsx(ContextMenuPrimitive.Portal, { children: /* @__PURE__ */ jsx(ContextMenuPrimitive.Content, {
|
|
1295
1298
|
ref,
|
|
1296
1299
|
className: cn("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2", className),
|
|
1297
1300
|
...props
|
|
1298
1301
|
}) }));
|
|
1299
1302
|
ContextMenuContent.displayName = ContextMenuPrimitive.Content.displayName;
|
|
1300
|
-
const ContextMenuItem = React$
|
|
1303
|
+
const ContextMenuItem = React$35.forwardRef(({ className, inset,...props }, ref) => /* @__PURE__ */ jsx(ContextMenuPrimitive.Item, {
|
|
1301
1304
|
ref,
|
|
1302
1305
|
className: cn("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50", inset && "pl-8", className),
|
|
1303
1306
|
...props
|
|
1304
1307
|
}));
|
|
1305
1308
|
ContextMenuItem.displayName = ContextMenuPrimitive.Item.displayName;
|
|
1306
|
-
const ContextMenuCheckboxItem = React$
|
|
1309
|
+
const ContextMenuCheckboxItem = React$35.forwardRef(({ className, children, checked,...props }, ref) => /* @__PURE__ */ jsxs(ContextMenuPrimitive.CheckboxItem, {
|
|
1307
1310
|
ref,
|
|
1308
1311
|
className: cn("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50", className),
|
|
1309
1312
|
checked,
|
|
@@ -1314,7 +1317,7 @@ const ContextMenuCheckboxItem = React$33.forwardRef(({ className, children, chec
|
|
|
1314
1317
|
}), children]
|
|
1315
1318
|
}));
|
|
1316
1319
|
ContextMenuCheckboxItem.displayName = ContextMenuPrimitive.CheckboxItem.displayName;
|
|
1317
|
-
const ContextMenuRadioItem = React$
|
|
1320
|
+
const ContextMenuRadioItem = React$35.forwardRef(({ className, children,...props }, ref) => /* @__PURE__ */ jsxs(ContextMenuPrimitive.RadioItem, {
|
|
1318
1321
|
ref,
|
|
1319
1322
|
className: cn("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50", className),
|
|
1320
1323
|
...props,
|
|
@@ -1324,13 +1327,13 @@ const ContextMenuRadioItem = React$33.forwardRef(({ className, children,...props
|
|
|
1324
1327
|
}), children]
|
|
1325
1328
|
}));
|
|
1326
1329
|
ContextMenuRadioItem.displayName = ContextMenuPrimitive.RadioItem.displayName;
|
|
1327
|
-
const ContextMenuLabel = React$
|
|
1330
|
+
const ContextMenuLabel = React$35.forwardRef(({ className, inset,...props }, ref) => /* @__PURE__ */ jsx(ContextMenuPrimitive.Label, {
|
|
1328
1331
|
ref,
|
|
1329
1332
|
className: cn("px-2 py-1.5 text-sm font-semibold text-foreground", inset && "pl-8", className),
|
|
1330
1333
|
...props
|
|
1331
1334
|
}));
|
|
1332
1335
|
ContextMenuLabel.displayName = ContextMenuPrimitive.Label.displayName;
|
|
1333
|
-
const ContextMenuSeparator = React$
|
|
1336
|
+
const ContextMenuSeparator = React$35.forwardRef(({ className,...props }, ref) => /* @__PURE__ */ jsx(ContextMenuPrimitive.Separator, {
|
|
1334
1337
|
ref,
|
|
1335
1338
|
className: cn("-mx-1 my-1 h-px bg-border", className),
|
|
1336
1339
|
...props
|
|
@@ -1466,7 +1469,7 @@ function DropdownMenuSubContent({ className,...props }) {
|
|
|
1466
1469
|
const TooltipProvider = TooltipPrimitive.Provider;
|
|
1467
1470
|
const Tooltip = TooltipPrimitive.Root;
|
|
1468
1471
|
const TooltipTrigger = TooltipPrimitive.Trigger;
|
|
1469
|
-
const TooltipContent = React$
|
|
1472
|
+
const TooltipContent = React$34.forwardRef(({ className, sideOffset = 4,...props }, ref) => /* @__PURE__ */ jsx(TooltipPrimitive.Content, {
|
|
1470
1473
|
ref,
|
|
1471
1474
|
sideOffset,
|
|
1472
1475
|
className: cn("z-50 overflow-hidden rounded-md bg-primary px-3 py-1.5 text-xs text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2", className),
|
|
@@ -1620,6 +1623,11 @@ function SelectScrollDownButton({ className,...props }) {
|
|
|
1620
1623
|
|
|
1621
1624
|
//#endregion
|
|
1622
1625
|
//#region src/data-grid/cell-variants/utils/gantt-timerange-picker.tsx
|
|
1626
|
+
const isoToLocalDate = (iso) => {
|
|
1627
|
+
if (!iso) return void 0;
|
|
1628
|
+
const d = new Date(iso);
|
|
1629
|
+
return new Date(d.getUTCFullYear(), d.getUTCMonth(), d.getUTCDate());
|
|
1630
|
+
};
|
|
1623
1631
|
const convertRangeToISO = (r) => {
|
|
1624
1632
|
if (!(r?.from && r?.to)) return void 0;
|
|
1625
1633
|
const from = r.from;
|
|
@@ -1668,14 +1676,14 @@ const GanttTimerangePicker = ({ initialDateFrom, initialDateTo, onRangeChange, t
|
|
|
1668
1676
|
} : void 0);
|
|
1669
1677
|
const [isOpen, setIsOpen] = useState(false);
|
|
1670
1678
|
const [selectedPreset, setSelectedPreset] = useState(void 0);
|
|
1671
|
-
const [isSmallScreen, setIsSmallScreen] = useState(globalThis.
|
|
1679
|
+
const [isSmallScreen, setIsSmallScreen] = useState(globalThis.innerWidth === void 0 ? false : globalThis.innerWidth < 960);
|
|
1672
1680
|
useEffect(() => {
|
|
1673
1681
|
const handleResize = () => {
|
|
1674
|
-
setIsSmallScreen(globalThis.
|
|
1682
|
+
setIsSmallScreen(globalThis.innerWidth < 960);
|
|
1675
1683
|
};
|
|
1676
|
-
globalThis.
|
|
1684
|
+
globalThis.addEventListener("resize", handleResize);
|
|
1677
1685
|
return () => {
|
|
1678
|
-
globalThis.
|
|
1686
|
+
globalThis.removeEventListener("resize", handleResize);
|
|
1679
1687
|
};
|
|
1680
1688
|
}, []);
|
|
1681
1689
|
const getPresetRange = (presetName, timelineStart$1, timelineEnd$1) => {
|
|
@@ -1968,7 +1976,7 @@ function getColumnVariant(variant) {
|
|
|
1968
1976
|
}
|
|
1969
1977
|
}
|
|
1970
1978
|
function DataGridColumnHeader({ header, table, className, onPointerDown,...props }) {
|
|
1971
|
-
const [open, setOpen] = React$
|
|
1979
|
+
const [open, setOpen] = React$33.useState(false);
|
|
1972
1980
|
const column = header.column;
|
|
1973
1981
|
const label = column.columnDef.meta?.label ? column.columnDef.meta.label : typeof column.columnDef.header === "string" ? column.columnDef.header : column.id;
|
|
1974
1982
|
const isAnyColumnResizing = table.getState().columnSizingInfo.isResizingColumn;
|
|
@@ -1977,7 +1985,7 @@ function DataGridColumnHeader({ header, table, className, onPointerDown,...props
|
|
|
1977
1985
|
const pinnedPosition = column.getIsPinned();
|
|
1978
1986
|
const isPinnedLeft = pinnedPosition === "left";
|
|
1979
1987
|
const isPinnedRight = pinnedPosition === "right";
|
|
1980
|
-
const onSortingChange = React$
|
|
1988
|
+
const onSortingChange = React$33.useCallback((direction) => {
|
|
1981
1989
|
table.setSorting((prev) => {
|
|
1982
1990
|
const existingSortIndex = prev.findIndex((sort) => sort.id === column.id);
|
|
1983
1991
|
const newSort = {
|
|
@@ -1991,19 +1999,19 @@ function DataGridColumnHeader({ header, table, className, onPointerDown,...props
|
|
|
1991
1999
|
} else return [...prev, newSort];
|
|
1992
2000
|
});
|
|
1993
2001
|
}, [column.id, table]);
|
|
1994
|
-
const onSortRemove = React$
|
|
2002
|
+
const onSortRemove = React$33.useCallback(() => {
|
|
1995
2003
|
table.setSorting((prev) => prev.filter((sort) => sort.id !== column.id));
|
|
1996
2004
|
}, [column.id, table]);
|
|
1997
|
-
const onLeftPin = React$
|
|
2005
|
+
const onLeftPin = React$33.useCallback(() => {
|
|
1998
2006
|
column.pin("left");
|
|
1999
2007
|
}, [column]);
|
|
2000
|
-
const onRightPin = React$
|
|
2008
|
+
const onRightPin = React$33.useCallback(() => {
|
|
2001
2009
|
column.pin("right");
|
|
2002
2010
|
}, [column]);
|
|
2003
|
-
const onUnpin = React$
|
|
2011
|
+
const onUnpin = React$33.useCallback(() => {
|
|
2004
2012
|
column.pin(false);
|
|
2005
2013
|
}, [column]);
|
|
2006
|
-
const onTriggerPointerDown = React$
|
|
2014
|
+
const onTriggerPointerDown = React$33.useCallback((event) => {
|
|
2007
2015
|
onPointerDown?.(event);
|
|
2008
2016
|
if (event.defaultPrevented) return;
|
|
2009
2017
|
if (event.button !== 0) return;
|
|
@@ -2115,7 +2123,7 @@ function DataGridColumnHeader({ header, table, className, onPointerDown,...props
|
|
|
2115
2123
|
})
|
|
2116
2124
|
] });
|
|
2117
2125
|
}
|
|
2118
|
-
const DataGridColumnResizer = React$
|
|
2126
|
+
const DataGridColumnResizer = React$33.memo(DataGridColumnResizerImpl, (prev, next) => {
|
|
2119
2127
|
const prevColumn = prev.header.column;
|
|
2120
2128
|
const nextColumn = next.header.column;
|
|
2121
2129
|
if (prevColumn.getIsResizing() !== nextColumn.getIsResizing() || prevColumn.getSize() !== nextColumn.getSize()) return false;
|
|
@@ -2124,7 +2132,7 @@ const DataGridColumnResizer = React$31.memo(DataGridColumnResizerImpl, (prev, ne
|
|
|
2124
2132
|
});
|
|
2125
2133
|
function DataGridColumnResizerImpl({ header, table, label }) {
|
|
2126
2134
|
const defaultColumnDef = table._getDefaultColumnDef();
|
|
2127
|
-
const onDoubleClick = React$
|
|
2135
|
+
const onDoubleClick = React$33.useCallback(() => {
|
|
2128
2136
|
header.column.resetSize();
|
|
2129
2137
|
}, [header.column]);
|
|
2130
2138
|
return /* @__PURE__ */ jsx("div", {
|
|
@@ -2233,7 +2241,7 @@ function DataGridContextMenu({ table }) {
|
|
|
2233
2241
|
onRowsDelete
|
|
2234
2242
|
});
|
|
2235
2243
|
}
|
|
2236
|
-
const ContextMenu$1 = React$
|
|
2244
|
+
const ContextMenu$1 = React$32.memo(ContextMenuImpl, (prev, next) => {
|
|
2237
2245
|
if (prev.contextMenu.open !== next.contextMenu.open) return false;
|
|
2238
2246
|
if (!next.contextMenu.open) return true;
|
|
2239
2247
|
if (prev.contextMenu.x !== next.contextMenu.x) return false;
|
|
@@ -2244,7 +2252,7 @@ const ContextMenu$1 = React$30.memo(ContextMenuImpl, (prev, next) => {
|
|
|
2244
2252
|
return true;
|
|
2245
2253
|
});
|
|
2246
2254
|
function ContextMenuImpl({ table, dataGridRef, contextMenu, onContextMenuOpenChange, selectionState, onDataUpdate, onRowsDelete }) {
|
|
2247
|
-
const triggerStyle = React$
|
|
2255
|
+
const triggerStyle = React$32.useMemo(() => ({
|
|
2248
2256
|
position: "fixed",
|
|
2249
2257
|
left: `${contextMenu.x}px`,
|
|
2250
2258
|
top: `${contextMenu.y}px`,
|
|
@@ -2257,11 +2265,11 @@ function ContextMenuImpl({ table, dataGridRef, contextMenu, onContextMenuOpenCha
|
|
|
2257
2265
|
pointerEvents: "none",
|
|
2258
2266
|
opacity: 0
|
|
2259
2267
|
}), [contextMenu.x, contextMenu.y]);
|
|
2260
|
-
const onCloseAutoFocus = React$
|
|
2268
|
+
const onCloseAutoFocus = React$32.useCallback((event) => {
|
|
2261
2269
|
event.preventDefault();
|
|
2262
2270
|
dataGridRef?.current?.focus();
|
|
2263
2271
|
}, [dataGridRef]);
|
|
2264
|
-
const onCopy = React$
|
|
2272
|
+
const onCopy = React$32.useCallback(async () => {
|
|
2265
2273
|
if (!selectionState?.selectedCells || selectionState.selectedCells.size === 0) return;
|
|
2266
2274
|
const rows = table.getRowModel().rows;
|
|
2267
2275
|
const columnIds = [];
|
|
@@ -2300,7 +2308,7 @@ function ContextMenuImpl({ table, dataGridRef, contextMenu, onContextMenuOpenCha
|
|
|
2300
2308
|
await navigator.clipboard.writeText(tsvData);
|
|
2301
2309
|
toast$1.success(`${selectionState.selectedCells.size} cell${selectionState.selectedCells.size !== 1 ? "s" : ""} copied`);
|
|
2302
2310
|
}, [table, selectionState]);
|
|
2303
|
-
const canClear = React$
|
|
2311
|
+
const canClear = React$32.useMemo(() => {
|
|
2304
2312
|
if (!selectionState?.selectedCells || selectionState.selectedCells.size === 0) return false;
|
|
2305
2313
|
const visibleCols = table.getVisibleLeafColumns();
|
|
2306
2314
|
const rows = table.getRowModel().rows;
|
|
@@ -2317,7 +2325,7 @@ function ContextMenuImpl({ table, dataGridRef, contextMenu, onContextMenuOpenCha
|
|
|
2317
2325
|
}
|
|
2318
2326
|
return true;
|
|
2319
2327
|
}, [selectionState, table]);
|
|
2320
|
-
const onClear = React$
|
|
2328
|
+
const onClear = React$32.useCallback(() => {
|
|
2321
2329
|
if (!selectionState?.selectedCells || selectionState.selectedCells.size === 0) return;
|
|
2322
2330
|
if (!canClear) return;
|
|
2323
2331
|
const updates = [];
|
|
@@ -2336,7 +2344,7 @@ function ContextMenuImpl({ table, dataGridRef, contextMenu, onContextMenuOpenCha
|
|
|
2336
2344
|
selectionState,
|
|
2337
2345
|
canClear
|
|
2338
2346
|
]);
|
|
2339
|
-
const onDelete = React$
|
|
2347
|
+
const onDelete = React$32.useCallback(async () => {
|
|
2340
2348
|
if (!selectionState?.selectedCells || selectionState.selectedCells.size === 0) return;
|
|
2341
2349
|
const rowIndices = new Set();
|
|
2342
2350
|
for (const cellKey of selectionState.selectedCells) {
|
|
@@ -2413,12 +2421,12 @@ function composeRefs(...refs) {
|
|
|
2413
2421
|
* Accepts callback refs and RefObject(s)
|
|
2414
2422
|
*/
|
|
2415
2423
|
function useComposedRefs(...refs) {
|
|
2416
|
-
return React$
|
|
2424
|
+
return React$31.useCallback(composeRefs(...refs), refs);
|
|
2417
2425
|
}
|
|
2418
2426
|
|
|
2419
2427
|
//#endregion
|
|
2420
2428
|
//#region src/data-grid/data-grid-row.tsx
|
|
2421
|
-
const DataGridRow = React$
|
|
2429
|
+
const DataGridRow = React$30.memo(DataGridRowImpl, (prev, next) => {
|
|
2422
2430
|
if (prev.row.id !== next.row.id) return false;
|
|
2423
2431
|
if (prev.row.original !== next.row.original) return false;
|
|
2424
2432
|
const prevRowIndex = prev.virtualRowIndex;
|
|
@@ -2510,20 +2518,20 @@ function Input({ className, type, variant, __e2e_test_id__, onEnter,...props })
|
|
|
2510
2518
|
* prop or avoid re-executing effects when passed as a dependency
|
|
2511
2519
|
*/
|
|
2512
2520
|
function useCallbackRef(callback) {
|
|
2513
|
-
const callbackRef = React$
|
|
2514
|
-
React$
|
|
2521
|
+
const callbackRef = React$29.useRef(callback);
|
|
2522
|
+
React$29.useEffect(() => {
|
|
2515
2523
|
callbackRef.current = callback;
|
|
2516
2524
|
});
|
|
2517
|
-
return React$
|
|
2525
|
+
return React$29.useMemo(() => (...args) => callbackRef.current?.(...args), []);
|
|
2518
2526
|
}
|
|
2519
2527
|
|
|
2520
2528
|
//#endregion
|
|
2521
2529
|
//#region src/data-grid/hooks/use-debounced-callback.ts
|
|
2522
2530
|
function useDebouncedCallback(callback, delay) {
|
|
2523
2531
|
const handleCallback = useCallbackRef(callback);
|
|
2524
|
-
const debounceTimerRef = React$
|
|
2525
|
-
React$
|
|
2526
|
-
const setValue = React$
|
|
2532
|
+
const debounceTimerRef = React$28.useRef(0);
|
|
2533
|
+
React$28.useEffect(() => () => window.clearTimeout(debounceTimerRef.current), []);
|
|
2534
|
+
const setValue = React$28.useCallback((...args) => {
|
|
2527
2535
|
window.clearTimeout(debounceTimerRef.current);
|
|
2528
2536
|
debounceTimerRef.current = window.setTimeout(() => handleCallback(...args), delay);
|
|
2529
2537
|
}, [handleCallback, delay]);
|
|
@@ -2532,7 +2540,7 @@ function useDebouncedCallback(callback, delay) {
|
|
|
2532
2540
|
|
|
2533
2541
|
//#endregion
|
|
2534
2542
|
//#region src/data-grid/data-grid-search.tsx
|
|
2535
|
-
const DataGridSearch = React$
|
|
2543
|
+
const DataGridSearch = React$27.memo(DataGridSearchImpl, (prev, next) => {
|
|
2536
2544
|
if (prev.searchOpen !== next.searchOpen) return false;
|
|
2537
2545
|
if (!next.searchOpen) return true;
|
|
2538
2546
|
if (prev.searchQuery !== next.searchQuery || prev.matchIndex !== next.matchIndex) return false;
|
|
@@ -2546,13 +2554,13 @@ const DataGridSearch = React$25.memo(DataGridSearchImpl, (prev, next) => {
|
|
|
2546
2554
|
return true;
|
|
2547
2555
|
});
|
|
2548
2556
|
function DataGridSearchImpl({ searchMatches, matchIndex, searchOpen, onSearchOpenChange, searchQuery, onSearchQueryChange, onSearch, onNavigateToNextMatch, onNavigateToPrevMatch }) {
|
|
2549
|
-
const inputRef = React$
|
|
2550
|
-
React$
|
|
2557
|
+
const inputRef = React$27.useRef(null);
|
|
2558
|
+
React$27.useEffect(() => {
|
|
2551
2559
|
if (searchOpen) requestAnimationFrame(() => {
|
|
2552
2560
|
inputRef.current?.focus();
|
|
2553
2561
|
});
|
|
2554
2562
|
}, [searchOpen]);
|
|
2555
|
-
React$
|
|
2563
|
+
React$27.useEffect(() => {
|
|
2556
2564
|
if (!searchOpen) return;
|
|
2557
2565
|
function onEscape(event) {
|
|
2558
2566
|
if (event.key === "Escape") {
|
|
@@ -2563,7 +2571,7 @@ function DataGridSearchImpl({ searchMatches, matchIndex, searchOpen, onSearchOpe
|
|
|
2563
2571
|
document.addEventListener("keydown", onEscape);
|
|
2564
2572
|
return () => document.removeEventListener("keydown", onEscape);
|
|
2565
2573
|
}, [searchOpen, onSearchOpenChange]);
|
|
2566
|
-
const onKeyDown = React$
|
|
2574
|
+
const onKeyDown = React$27.useCallback((event) => {
|
|
2567
2575
|
event.stopPropagation();
|
|
2568
2576
|
if (event.key === "Enter") {
|
|
2569
2577
|
event.preventDefault();
|
|
@@ -2574,20 +2582,20 @@ function DataGridSearchImpl({ searchMatches, matchIndex, searchOpen, onSearchOpe
|
|
|
2574
2582
|
const debouncedSearch = useDebouncedCallback((query) => {
|
|
2575
2583
|
onSearch(query);
|
|
2576
2584
|
}, 150);
|
|
2577
|
-
const onChange = React$
|
|
2585
|
+
const onChange = React$27.useCallback((event) => {
|
|
2578
2586
|
const value = event.target.value;
|
|
2579
2587
|
onSearchQueryChange(value);
|
|
2580
2588
|
debouncedSearch(value);
|
|
2581
2589
|
}, [onSearchQueryChange, debouncedSearch]);
|
|
2582
|
-
const onTriggerPointerDown = React$
|
|
2590
|
+
const onTriggerPointerDown = React$27.useCallback((event) => {
|
|
2583
2591
|
const target = event.target;
|
|
2584
2592
|
if (!(target instanceof HTMLElement)) return;
|
|
2585
2593
|
if (target.hasPointerCapture(event.pointerId)) target.releasePointerCapture(event.pointerId);
|
|
2586
2594
|
if (event.button === 0 && event.ctrlKey === false && event.pointerType === "mouse" && !(event.target instanceof HTMLInputElement)) event.preventDefault();
|
|
2587
2595
|
}, []);
|
|
2588
|
-
const onPrevMatchPointerDown = React$
|
|
2589
|
-
const onNextMatchPointerDown = React$
|
|
2590
|
-
const onClose = React$
|
|
2596
|
+
const onPrevMatchPointerDown = React$27.useCallback((event) => onTriggerPointerDown(event), [onTriggerPointerDown]);
|
|
2597
|
+
const onNextMatchPointerDown = React$27.useCallback((event) => onTriggerPointerDown(event), [onTriggerPointerDown]);
|
|
2598
|
+
const onClose = React$27.useCallback(() => {
|
|
2591
2599
|
onSearchOpenChange(false);
|
|
2592
2600
|
}, [onSearchOpenChange]);
|
|
2593
2601
|
if (!searchOpen) return null;
|
|
@@ -2660,10 +2668,10 @@ function DataGrid({ dataGridRef, headerRef, rowMapRef, footerRef, table, rowVirt
|
|
|
2660
2668
|
const meta = table.options.meta;
|
|
2661
2669
|
const rowHeight = meta?.rowHeight ?? "short";
|
|
2662
2670
|
const focusedCell = meta?.focusedCell ?? null;
|
|
2663
|
-
const onGridContextMenu = React$
|
|
2671
|
+
const onGridContextMenu = React$26.useCallback((event) => {
|
|
2664
2672
|
event.preventDefault();
|
|
2665
2673
|
}, []);
|
|
2666
|
-
const onAddRowKeyDown = React$
|
|
2674
|
+
const onAddRowKeyDown = React$26.useCallback(async (event) => {
|
|
2667
2675
|
if (!onRowAdd) return;
|
|
2668
2676
|
if (event.key === "Enter" || event.key === "") {
|
|
2669
2677
|
event.preventDefault();
|
|
@@ -2798,20 +2806,20 @@ function DataGridCellWrapper({ cell, table, rowIndex, columnId, isEditing, isFoc
|
|
|
2798
2806
|
const rowOriginal = cell?.row?.original ?? {};
|
|
2799
2807
|
const colCellMeta = cell?.column?.columnDef?.meta;
|
|
2800
2808
|
const align = colCellMeta?.align ?? "left";
|
|
2801
|
-
const editableResolver = React$
|
|
2809
|
+
const editableResolver = React$25.useMemo(() => {
|
|
2802
2810
|
const v = colCellMeta?.editable;
|
|
2803
2811
|
if (v === void 0) return () => true;
|
|
2804
2812
|
return typeof v === "function" ? v : () => Boolean(v);
|
|
2805
2813
|
}, [colCellMeta?.editable]);
|
|
2806
2814
|
const isEditable = editableResolver(rowOriginal);
|
|
2807
|
-
const classNameResolver = React$
|
|
2815
|
+
const classNameResolver = React$25.useMemo(() => {
|
|
2808
2816
|
const v = colCellMeta?.className;
|
|
2809
2817
|
return typeof v === "function" ? v : () => v;
|
|
2810
2818
|
}, [colCellMeta?.className]);
|
|
2811
2819
|
const colCellClassName = classNameResolver(rowOriginal);
|
|
2812
2820
|
const isSearchMatch = meta?.getIsSearchMatch?.(rowIndex, columnId) ?? false;
|
|
2813
2821
|
const isActiveSearchMatch = meta?.getIsActiveSearchMatch?.(rowIndex, columnId) ?? false;
|
|
2814
|
-
const onClick = React$
|
|
2822
|
+
const onClick = React$25.useCallback((event) => {
|
|
2815
2823
|
if (!isEditing) {
|
|
2816
2824
|
event.preventDefault();
|
|
2817
2825
|
onClickProp?.(event);
|
|
@@ -2828,7 +2836,7 @@ function DataGridCellWrapper({ cell, table, rowIndex, columnId, isEditing, isFoc
|
|
|
2828
2836
|
onClickProp,
|
|
2829
2837
|
isEditable
|
|
2830
2838
|
]);
|
|
2831
|
-
const onContextMenu = React$
|
|
2839
|
+
const onContextMenu = React$25.useCallback((event) => {
|
|
2832
2840
|
if (!isEditing) meta?.onCellContextMenu?.(rowIndex, columnId, event);
|
|
2833
2841
|
}, [
|
|
2834
2842
|
meta,
|
|
@@ -2836,7 +2844,7 @@ function DataGridCellWrapper({ cell, table, rowIndex, columnId, isEditing, isFoc
|
|
|
2836
2844
|
columnId,
|
|
2837
2845
|
isEditing
|
|
2838
2846
|
]);
|
|
2839
|
-
const onMouseDown = React$
|
|
2847
|
+
const onMouseDown = React$25.useCallback((event) => {
|
|
2840
2848
|
if (!isEditing) meta?.onCellMouseDown?.(rowIndex, columnId, event);
|
|
2841
2849
|
}, [
|
|
2842
2850
|
meta,
|
|
@@ -2844,7 +2852,7 @@ function DataGridCellWrapper({ cell, table, rowIndex, columnId, isEditing, isFoc
|
|
|
2844
2852
|
columnId,
|
|
2845
2853
|
isEditing
|
|
2846
2854
|
]);
|
|
2847
|
-
const onMouseEnter = React$
|
|
2855
|
+
const onMouseEnter = React$25.useCallback((event) => {
|
|
2848
2856
|
if (!isEditing) meta?.onCellMouseEnter?.(rowIndex, columnId, event);
|
|
2849
2857
|
}, [
|
|
2850
2858
|
meta,
|
|
@@ -2852,10 +2860,10 @@ function DataGridCellWrapper({ cell, table, rowIndex, columnId, isEditing, isFoc
|
|
|
2852
2860
|
columnId,
|
|
2853
2861
|
isEditing
|
|
2854
2862
|
]);
|
|
2855
|
-
const onMouseUp = React$
|
|
2863
|
+
const onMouseUp = React$25.useCallback(() => {
|
|
2856
2864
|
if (!isEditing) meta?.onCellMouseUp?.();
|
|
2857
2865
|
}, [meta, isEditing]);
|
|
2858
|
-
const onDoubleClick = React$
|
|
2866
|
+
const onDoubleClick = React$25.useCallback((event) => {
|
|
2859
2867
|
if (!isEditing) {
|
|
2860
2868
|
event.preventDefault();
|
|
2861
2869
|
if (isEditable) meta?.onCellDoubleClick?.(rowIndex, columnId);
|
|
@@ -2867,7 +2875,7 @@ function DataGridCellWrapper({ cell, table, rowIndex, columnId, isEditing, isFoc
|
|
|
2867
2875
|
isEditing,
|
|
2868
2876
|
isEditable
|
|
2869
2877
|
]);
|
|
2870
|
-
const onKeyDown = React$
|
|
2878
|
+
const onKeyDown = React$25.useCallback((event) => {
|
|
2871
2879
|
onKeyDownProp?.(event);
|
|
2872
2880
|
if (event.defaultPrevented) return;
|
|
2873
2881
|
if (event.key === "ArrowUp" || event.key === "ArrowDown" || event.key === "ArrowLeft" || event.key === "ArrowRight" || event.key === "Home" || event.key === "End" || event.key === "PageUp" || event.key === "PageDown" || event.key === "Tab") return;
|
|
@@ -2937,17 +2945,17 @@ function DataGridCellWrapper({ cell, table, rowIndex, columnId, isEditing, isFoc
|
|
|
2937
2945
|
//#region src/data-grid/cell-variants/checkbox-cell.tsx
|
|
2938
2946
|
function CheckboxCell({ cell, table, rowIndex, columnId, isFocused, isSelected }) {
|
|
2939
2947
|
const initialValue = cell.getValue();
|
|
2940
|
-
const [value, setValue] = React$
|
|
2941
|
-
const containerRef = React$
|
|
2948
|
+
const [value, setValue] = React$24.useState(Boolean(initialValue));
|
|
2949
|
+
const containerRef = React$24.useRef(null);
|
|
2942
2950
|
const meta = table.options.meta;
|
|
2943
2951
|
const colMeta = cell.column.columnDef.meta;
|
|
2944
|
-
const editableResolver = React$
|
|
2952
|
+
const editableResolver = React$24.useMemo(() => {
|
|
2945
2953
|
const v = colMeta?.editable;
|
|
2946
2954
|
if (v === void 0) return () => true;
|
|
2947
2955
|
return typeof v === "function" ? v : () => Boolean(v);
|
|
2948
2956
|
}, [colMeta?.editable]);
|
|
2949
2957
|
const isEditable = editableResolver(cell.row.original);
|
|
2950
|
-
const onCheckedChange = React$
|
|
2958
|
+
const onCheckedChange = React$24.useCallback((checked) => {
|
|
2951
2959
|
setValue(checked);
|
|
2952
2960
|
meta?.onDataUpdate?.({
|
|
2953
2961
|
rowIndex,
|
|
@@ -2959,7 +2967,7 @@ function CheckboxCell({ cell, table, rowIndex, columnId, isFocused, isSelected }
|
|
|
2959
2967
|
rowIndex,
|
|
2960
2968
|
columnId
|
|
2961
2969
|
]);
|
|
2962
|
-
const onWrapperKeyDown = React$
|
|
2970
|
+
const onWrapperKeyDown = React$24.useCallback((event) => {
|
|
2963
2971
|
if (!isEditable) return;
|
|
2964
2972
|
if (isFocused && (event.key === "" || event.key === "Enter")) {
|
|
2965
2973
|
event.preventDefault();
|
|
@@ -2972,17 +2980,17 @@ function CheckboxCell({ cell, table, rowIndex, columnId, isFocused, isSelected }
|
|
|
2972
2980
|
onCheckedChange,
|
|
2973
2981
|
isEditable
|
|
2974
2982
|
]);
|
|
2975
|
-
React$
|
|
2983
|
+
React$24.useEffect(() => {
|
|
2976
2984
|
setValue(Boolean(initialValue));
|
|
2977
2985
|
}, [initialValue]);
|
|
2978
|
-
React$
|
|
2986
|
+
React$24.useEffect(() => {
|
|
2979
2987
|
if (isFocused && !meta?.searchOpen && !meta?.isScrolling && containerRef.current) containerRef.current.focus();
|
|
2980
2988
|
}, [
|
|
2981
2989
|
isFocused,
|
|
2982
2990
|
meta?.searchOpen,
|
|
2983
2991
|
meta?.isScrolling
|
|
2984
2992
|
]);
|
|
2985
|
-
const onWrapperClick = React$
|
|
2993
|
+
const onWrapperClick = React$24.useCallback((event) => {
|
|
2986
2994
|
if (!isEditable) return;
|
|
2987
2995
|
if (isFocused) {
|
|
2988
2996
|
event.preventDefault();
|
|
@@ -2995,13 +3003,13 @@ function CheckboxCell({ cell, table, rowIndex, columnId, isFocused, isSelected }
|
|
|
2995
3003
|
onCheckedChange,
|
|
2996
3004
|
isEditable
|
|
2997
3005
|
]);
|
|
2998
|
-
const onCheckboxClick = React$
|
|
3006
|
+
const onCheckboxClick = React$24.useCallback((event) => {
|
|
2999
3007
|
event.stopPropagation();
|
|
3000
3008
|
}, []);
|
|
3001
|
-
const onCheckboxMouseDown = React$
|
|
3009
|
+
const onCheckboxMouseDown = React$24.useCallback((event) => {
|
|
3002
3010
|
event.stopPropagation();
|
|
3003
3011
|
}, []);
|
|
3004
|
-
const onCheckboxDoubleClick = React$
|
|
3012
|
+
const onCheckboxDoubleClick = React$24.useCallback((event) => {
|
|
3005
3013
|
event.stopPropagation();
|
|
3006
3014
|
}, []);
|
|
3007
3015
|
return /* @__PURE__ */ jsx(DataGridCellWrapper, {
|
|
@@ -3056,16 +3064,16 @@ function formatDateToISOString(date) {
|
|
|
3056
3064
|
}
|
|
3057
3065
|
function DateCell({ cell, table, rowIndex, columnId, isFocused, isEditing, isSelected }) {
|
|
3058
3066
|
const initialValue = cell.getValue();
|
|
3059
|
-
const [value, setValue] = React$
|
|
3060
|
-
const [open, setOpen] = React$
|
|
3061
|
-
const containerRef = React$
|
|
3067
|
+
const [value, setValue] = React$23.useState(parseToLocalDate(initialValue));
|
|
3068
|
+
const [open, setOpen] = React$23.useState(false);
|
|
3069
|
+
const containerRef = React$23.useRef(null);
|
|
3062
3070
|
const meta = table.options.meta;
|
|
3063
|
-
const prevInitialValueRef = React$
|
|
3071
|
+
const prevInitialValueRef = React$23.useRef(initialValue);
|
|
3064
3072
|
if (initialValue !== prevInitialValueRef.current) {
|
|
3065
3073
|
prevInitialValueRef.current = initialValue;
|
|
3066
3074
|
setValue(parseToLocalDate(initialValue));
|
|
3067
3075
|
}
|
|
3068
|
-
const onDateSelect = React$
|
|
3076
|
+
const onDateSelect = React$23.useCallback((date) => {
|
|
3069
3077
|
if (!date) return;
|
|
3070
3078
|
setValue(date);
|
|
3071
3079
|
meta?.onDataUpdate?.({
|
|
@@ -3080,11 +3088,11 @@ function DateCell({ cell, table, rowIndex, columnId, isFocused, isEditing, isSel
|
|
|
3080
3088
|
rowIndex,
|
|
3081
3089
|
columnId
|
|
3082
3090
|
]);
|
|
3083
|
-
const onOpenChange = React$
|
|
3091
|
+
const onOpenChange = React$23.useCallback((isOpen) => {
|
|
3084
3092
|
setOpen(isOpen);
|
|
3085
3093
|
if (!isOpen && isEditing) meta?.onCellEditingStop?.();
|
|
3086
3094
|
}, [isEditing, meta]);
|
|
3087
|
-
const onWrapperKeyDown = React$
|
|
3095
|
+
const onWrapperKeyDown = React$23.useCallback((event) => {
|
|
3088
3096
|
if (isEditing) {
|
|
3089
3097
|
if (event.key === "Escape") {
|
|
3090
3098
|
event.preventDefault();
|
|
@@ -3101,10 +3109,10 @@ function DateCell({ cell, table, rowIndex, columnId, isFocused, isEditing, isSel
|
|
|
3101
3109
|
initialValue,
|
|
3102
3110
|
meta
|
|
3103
3111
|
]);
|
|
3104
|
-
React$
|
|
3112
|
+
React$23.useEffect(() => {
|
|
3105
3113
|
setOpen(isEditing);
|
|
3106
3114
|
}, [isEditing]);
|
|
3107
|
-
React$
|
|
3115
|
+
React$23.useEffect(() => {
|
|
3108
3116
|
if (isFocused && !isEditing && !meta?.searchOpen && !meta?.isScrolling && containerRef.current) containerRef.current.focus();
|
|
3109
3117
|
}, [
|
|
3110
3118
|
isFocused,
|
|
@@ -3156,7 +3164,7 @@ function DateCell({ cell, table, rowIndex, columnId, isFocused, isEditing, isSel
|
|
|
3156
3164
|
//#region src/data-grid/cell-variants/gantt-cell.tsx
|
|
3157
3165
|
function GanttCell({ cell, table, rowIndex, columnId, isFocused, isEditing, isSelected }) {
|
|
3158
3166
|
const initialValue = cell.getValue();
|
|
3159
|
-
const containerRef = React$
|
|
3167
|
+
const containerRef = React$22.useRef(null);
|
|
3160
3168
|
const cellOpts = cell.column.columnDef.meta?.cell;
|
|
3161
3169
|
const ts = cellOpts?.dateRangeFrom ?? cellOpts?.timelineStart;
|
|
3162
3170
|
const te = cellOpts?.dateRangeTo ?? cellOpts?.timelineEnd;
|
|
@@ -3215,13 +3223,13 @@ function Textarea({ className, variant, __e2e_test_id__,...props }) {
|
|
|
3215
3223
|
//#region src/data-grid/cell-variants/long-text-cell.tsx
|
|
3216
3224
|
function LongTextCell({ cell, table, rowIndex, columnId, isFocused, isEditing, isSelected }) {
|
|
3217
3225
|
const initialValue = cell.getValue();
|
|
3218
|
-
const [value, setValue] = React$
|
|
3219
|
-
const [open, setOpen] = React$
|
|
3220
|
-
const textareaRef = React$
|
|
3221
|
-
const containerRef = React$
|
|
3226
|
+
const [value, setValue] = React$21.useState(initialValue ?? "");
|
|
3227
|
+
const [open, setOpen] = React$21.useState(false);
|
|
3228
|
+
const textareaRef = React$21.useRef(null);
|
|
3229
|
+
const containerRef = React$21.useRef(null);
|
|
3222
3230
|
const meta = table.options.meta;
|
|
3223
3231
|
const sideOffset = -(containerRef.current?.clientHeight ?? 0);
|
|
3224
|
-
const prevInitialValueRef = React$
|
|
3232
|
+
const prevInitialValueRef = React$21.useRef(initialValue);
|
|
3225
3233
|
if (initialValue !== prevInitialValueRef.current) {
|
|
3226
3234
|
prevInitialValueRef.current = initialValue;
|
|
3227
3235
|
setValue(initialValue ?? "");
|
|
@@ -3233,7 +3241,7 @@ function LongTextCell({ cell, table, rowIndex, columnId, isFocused, isEditing, i
|
|
|
3233
3241
|
value: newValue
|
|
3234
3242
|
});
|
|
3235
3243
|
}, 300);
|
|
3236
|
-
const onSave = React$
|
|
3244
|
+
const onSave = React$21.useCallback(() => {
|
|
3237
3245
|
if (value !== initialValue) meta?.onDataUpdate?.({
|
|
3238
3246
|
rowIndex,
|
|
3239
3247
|
columnId,
|
|
@@ -3248,7 +3256,7 @@ function LongTextCell({ cell, table, rowIndex, columnId, isFocused, isEditing, i
|
|
|
3248
3256
|
rowIndex,
|
|
3249
3257
|
columnId
|
|
3250
3258
|
]);
|
|
3251
|
-
const onCancel = React$
|
|
3259
|
+
const onCancel = React$21.useCallback(() => {
|
|
3252
3260
|
setValue(initialValue ?? "");
|
|
3253
3261
|
meta?.onDataUpdate?.({
|
|
3254
3262
|
rowIndex,
|
|
@@ -3263,12 +3271,12 @@ function LongTextCell({ cell, table, rowIndex, columnId, isFocused, isEditing, i
|
|
|
3263
3271
|
rowIndex,
|
|
3264
3272
|
columnId
|
|
3265
3273
|
]);
|
|
3266
|
-
const onChange = React$
|
|
3274
|
+
const onChange = React$21.useCallback((event) => {
|
|
3267
3275
|
const newValue = event.target.value;
|
|
3268
3276
|
setValue(newValue);
|
|
3269
3277
|
debouncedSave(newValue);
|
|
3270
3278
|
}, [debouncedSave]);
|
|
3271
|
-
const onOpenChange = React$
|
|
3279
|
+
const onOpenChange = React$21.useCallback((isOpen) => {
|
|
3272
3280
|
setOpen(isOpen);
|
|
3273
3281
|
if (!isOpen) {
|
|
3274
3282
|
if (value !== initialValue) meta?.onDataUpdate?.({
|
|
@@ -3285,7 +3293,7 @@ function LongTextCell({ cell, table, rowIndex, columnId, isFocused, isEditing, i
|
|
|
3285
3293
|
rowIndex,
|
|
3286
3294
|
columnId
|
|
3287
3295
|
]);
|
|
3288
|
-
const onOpenAutoFocus = React$
|
|
3296
|
+
const onOpenAutoFocus = React$21.useCallback((event) => {
|
|
3289
3297
|
event.preventDefault();
|
|
3290
3298
|
if (textareaRef.current) {
|
|
3291
3299
|
textareaRef.current.focus();
|
|
@@ -3293,7 +3301,7 @@ function LongTextCell({ cell, table, rowIndex, columnId, isFocused, isEditing, i
|
|
|
3293
3301
|
textareaRef.current.setSelectionRange(length, length);
|
|
3294
3302
|
}
|
|
3295
3303
|
}, []);
|
|
3296
|
-
const onWrapperKeyDown = React$
|
|
3304
|
+
const onWrapperKeyDown = React$21.useCallback((event) => {
|
|
3297
3305
|
if (isEditing && !open) {
|
|
3298
3306
|
if (event.key === "Escape") {
|
|
3299
3307
|
event.preventDefault();
|
|
@@ -3317,7 +3325,7 @@ function LongTextCell({ cell, table, rowIndex, columnId, isFocused, isEditing, i
|
|
|
3317
3325
|
rowIndex,
|
|
3318
3326
|
columnId
|
|
3319
3327
|
]);
|
|
3320
|
-
const onTextareaKeyDown = React$
|
|
3328
|
+
const onTextareaKeyDown = React$21.useCallback((event) => {
|
|
3321
3329
|
if (event.key === "Escape") {
|
|
3322
3330
|
event.preventDefault();
|
|
3323
3331
|
onCancel();
|
|
@@ -3327,7 +3335,7 @@ function LongTextCell({ cell, table, rowIndex, columnId, isFocused, isEditing, i
|
|
|
3327
3335
|
}
|
|
3328
3336
|
event.stopPropagation();
|
|
3329
3337
|
}, [onCancel, onSave]);
|
|
3330
|
-
const onTextareaBlur = React$
|
|
3338
|
+
const onTextareaBlur = React$21.useCallback(() => {
|
|
3331
3339
|
if (value !== initialValue) meta?.onDataUpdate?.({
|
|
3332
3340
|
rowIndex,
|
|
3333
3341
|
columnId,
|
|
@@ -3342,7 +3350,7 @@ function LongTextCell({ cell, table, rowIndex, columnId, isFocused, isEditing, i
|
|
|
3342
3350
|
rowIndex,
|
|
3343
3351
|
columnId
|
|
3344
3352
|
]);
|
|
3345
|
-
React$
|
|
3353
|
+
React$21.useEffect(() => {
|
|
3346
3354
|
if (isEditing && !open) setOpen(true);
|
|
3347
3355
|
if (isFocused && !isEditing && !meta?.searchOpen && !meta?.isScrolling && containerRef.current) containerRef.current.focus();
|
|
3348
3356
|
}, [
|
|
@@ -3395,14 +3403,14 @@ function LongTextCell({ cell, table, rowIndex, columnId, isFocused, isEditing, i
|
|
|
3395
3403
|
//#endregion
|
|
3396
3404
|
//#region src/data-grid/cell-variants/multi-select-cell.tsx
|
|
3397
3405
|
function MultiSelectCell({ cell, table, rowIndex, columnId, isFocused, isEditing, isSelected }) {
|
|
3398
|
-
const cellValue = React$
|
|
3406
|
+
const cellValue = React$20.useMemo(() => cell.getValue() ?? [], [cell]);
|
|
3399
3407
|
const cellId = `${rowIndex}-${columnId}`;
|
|
3400
|
-
const prevCellIdRef = React$
|
|
3401
|
-
const [selectedValues, setSelectedValues] = React$
|
|
3402
|
-
const [open, setOpen] = React$
|
|
3403
|
-
const [searchValue, setSearchValue] = React$
|
|
3404
|
-
const containerRef = React$
|
|
3405
|
-
const inputRef = React$
|
|
3408
|
+
const prevCellIdRef = React$20.useRef(cellId);
|
|
3409
|
+
const [selectedValues, setSelectedValues] = React$20.useState(cellValue);
|
|
3410
|
+
const [open, setOpen] = React$20.useState(false);
|
|
3411
|
+
const [searchValue, setSearchValue] = React$20.useState("");
|
|
3412
|
+
const containerRef = React$20.useRef(null);
|
|
3413
|
+
const inputRef = React$20.useRef(null);
|
|
3406
3414
|
const meta = table.options.meta;
|
|
3407
3415
|
const cellOpts = cell.column.columnDef.meta?.cell;
|
|
3408
3416
|
const options = cellOpts?.variant === "multi-select" ? cellOpts.options : [];
|
|
@@ -3413,7 +3421,7 @@ function MultiSelectCell({ cell, table, rowIndex, columnId, isFocused, isEditing
|
|
|
3413
3421
|
setOpen(false);
|
|
3414
3422
|
setSearchValue("");
|
|
3415
3423
|
}
|
|
3416
|
-
const onValueChange = React$
|
|
3424
|
+
const onValueChange = React$20.useCallback((value) => {
|
|
3417
3425
|
const newValues = selectedValues.includes(value) ? selectedValues.filter((v) => v !== value) : [...selectedValues, value];
|
|
3418
3426
|
setSelectedValues(newValues);
|
|
3419
3427
|
meta?.onDataUpdate?.({
|
|
@@ -3429,7 +3437,7 @@ function MultiSelectCell({ cell, table, rowIndex, columnId, isFocused, isEditing
|
|
|
3429
3437
|
rowIndex,
|
|
3430
3438
|
columnId
|
|
3431
3439
|
]);
|
|
3432
|
-
const removeValue = React$
|
|
3440
|
+
const removeValue = React$20.useCallback((valueToRemove, event) => {
|
|
3433
3441
|
event?.stopPropagation();
|
|
3434
3442
|
event?.preventDefault();
|
|
3435
3443
|
const newValues = selectedValues.filter((v) => v !== valueToRemove);
|
|
@@ -3446,7 +3454,7 @@ function MultiSelectCell({ cell, table, rowIndex, columnId, isFocused, isEditing
|
|
|
3446
3454
|
rowIndex,
|
|
3447
3455
|
columnId
|
|
3448
3456
|
]);
|
|
3449
|
-
const clearAll = React$
|
|
3457
|
+
const clearAll = React$20.useCallback(() => {
|
|
3450
3458
|
setSelectedValues([]);
|
|
3451
3459
|
meta?.onDataUpdate?.({
|
|
3452
3460
|
rowIndex,
|
|
@@ -3459,18 +3467,18 @@ function MultiSelectCell({ cell, table, rowIndex, columnId, isFocused, isEditing
|
|
|
3459
3467
|
rowIndex,
|
|
3460
3468
|
columnId
|
|
3461
3469
|
]);
|
|
3462
|
-
const onOpenChange = React$
|
|
3470
|
+
const onOpenChange = React$20.useCallback((isOpen) => {
|
|
3463
3471
|
setOpen(isOpen);
|
|
3464
3472
|
if (!isOpen) {
|
|
3465
3473
|
setSearchValue("");
|
|
3466
3474
|
meta?.onCellEditingStop?.();
|
|
3467
3475
|
}
|
|
3468
3476
|
}, [meta]);
|
|
3469
|
-
const onOpenAutoFocus = React$
|
|
3477
|
+
const onOpenAutoFocus = React$20.useCallback((event) => {
|
|
3470
3478
|
event.preventDefault();
|
|
3471
3479
|
inputRef.current?.focus();
|
|
3472
3480
|
}, []);
|
|
3473
|
-
const onWrapperKeyDown = React$
|
|
3481
|
+
const onWrapperKeyDown = React$20.useCallback((event) => {
|
|
3474
3482
|
if (isEditing) {
|
|
3475
3483
|
if (event.key === "Escape") {
|
|
3476
3484
|
event.preventDefault();
|
|
@@ -3490,7 +3498,7 @@ function MultiSelectCell({ cell, table, rowIndex, columnId, isFocused, isEditing
|
|
|
3490
3498
|
cellValue,
|
|
3491
3499
|
meta
|
|
3492
3500
|
]);
|
|
3493
|
-
const onInputKeyDown = React$
|
|
3501
|
+
const onInputKeyDown = React$20.useCallback((event) => {
|
|
3494
3502
|
if (event.key === "Backspace" && searchValue === "" && selectedValues.length > 0) {
|
|
3495
3503
|
event.preventDefault();
|
|
3496
3504
|
const lastValue = selectedValues.at(-1);
|
|
@@ -3502,7 +3510,7 @@ function MultiSelectCell({ cell, table, rowIndex, columnId, isFocused, isEditing
|
|
|
3502
3510
|
selectedValues,
|
|
3503
3511
|
removeValue
|
|
3504
3512
|
]);
|
|
3505
|
-
React$
|
|
3513
|
+
React$20.useEffect(() => {
|
|
3506
3514
|
if (isEditing && !open) setOpen(true);
|
|
3507
3515
|
if (isFocused && !isEditing && !meta?.searchOpen && !meta?.isScrolling && containerRef.current) containerRef.current.focus();
|
|
3508
3516
|
}, [
|
|
@@ -3512,7 +3520,7 @@ function MultiSelectCell({ cell, table, rowIndex, columnId, isFocused, isEditing
|
|
|
3512
3520
|
meta?.searchOpen,
|
|
3513
3521
|
meta?.isScrolling
|
|
3514
3522
|
]);
|
|
3515
|
-
React$
|
|
3523
|
+
React$20.useEffect(() => {
|
|
3516
3524
|
if (open && inputRef.current) setTimeout(() => inputRef.current?.focus(), 0);
|
|
3517
3525
|
}, [open]);
|
|
3518
3526
|
const displayLabels = selectedValues.map((val) => options.find((opt) => opt.value === val)?.label ?? val).filter(Boolean);
|
|
@@ -3617,20 +3625,20 @@ function MultiSelectCell({ cell, table, rowIndex, columnId, isFocused, isEditing
|
|
|
3617
3625
|
//#region src/data-grid/cell-variants/number-cell.tsx
|
|
3618
3626
|
function NumberCell({ cell, table, rowIndex, columnId, isFocused, isEditing, isSelected }) {
|
|
3619
3627
|
const initialValue = cell.getValue();
|
|
3620
|
-
const inputRef = React$
|
|
3621
|
-
const containerRef = React$
|
|
3628
|
+
const inputRef = React$19.useRef(null);
|
|
3629
|
+
const containerRef = React$19.useRef(null);
|
|
3622
3630
|
const meta = table.options.meta;
|
|
3623
3631
|
const colMeta = cell.column.columnDef.meta;
|
|
3624
3632
|
const cellOptions = colMeta?.cell;
|
|
3625
|
-
const editableResolver = React$
|
|
3633
|
+
const editableResolver = React$19.useMemo(() => {
|
|
3626
3634
|
const v = colMeta?.editable;
|
|
3627
3635
|
if (v === void 0) return () => true;
|
|
3628
3636
|
return typeof v === "function" ? v : () => Boolean(v);
|
|
3629
3637
|
}, [colMeta?.editable]);
|
|
3630
3638
|
const isEditable = editableResolver(cell.row.original);
|
|
3631
3639
|
const { min, max, step, prefix = "", suffix = "", fallbackValue = "" } = cellOptions?.variant === "number" ? cellOptions : {};
|
|
3632
|
-
const [editValue, setEditValue] = React$
|
|
3633
|
-
const onBlur = React$
|
|
3640
|
+
const [editValue, setEditValue] = React$19.useState(initialValue !== null && initialValue !== void 0 ? String(initialValue) : "");
|
|
3641
|
+
const onBlur = React$19.useCallback(() => {
|
|
3634
3642
|
const numValue = editValue === "" ? null : Number(editValue);
|
|
3635
3643
|
if (numValue !== initialValue) meta?.onDataUpdate?.({
|
|
3636
3644
|
rowIndex,
|
|
@@ -3645,13 +3653,13 @@ function NumberCell({ cell, table, rowIndex, columnId, isFocused, isEditing, isS
|
|
|
3645
3653
|
initialValue,
|
|
3646
3654
|
editValue
|
|
3647
3655
|
]);
|
|
3648
|
-
const onChange = React$
|
|
3656
|
+
const onChange = React$19.useCallback((event) => {
|
|
3649
3657
|
setEditValue(event.target.value);
|
|
3650
3658
|
}, []);
|
|
3651
|
-
const parseNumValue = React$
|
|
3659
|
+
const parseNumValue = React$19.useCallback(() => {
|
|
3652
3660
|
return editValue === "" ? null : Number(editValue);
|
|
3653
3661
|
}, [editValue]);
|
|
3654
|
-
const saveAndStop = React$
|
|
3662
|
+
const saveAndStop = React$19.useCallback((options) => {
|
|
3655
3663
|
const numValue = parseNumValue();
|
|
3656
3664
|
if (numValue !== initialValue) meta?.onDataUpdate?.({
|
|
3657
3665
|
rowIndex,
|
|
@@ -3666,7 +3674,7 @@ function NumberCell({ cell, table, rowIndex, columnId, isFocused, isEditing, isS
|
|
|
3666
3674
|
rowIndex,
|
|
3667
3675
|
columnId
|
|
3668
3676
|
]);
|
|
3669
|
-
const handleEditingKeyDown = React$
|
|
3677
|
+
const handleEditingKeyDown = React$19.useCallback((event) => {
|
|
3670
3678
|
if (event.key === "Enter") {
|
|
3671
3679
|
event.preventDefault();
|
|
3672
3680
|
saveAndStop({ moveToNextRow: true });
|
|
@@ -3679,12 +3687,12 @@ function NumberCell({ cell, table, rowIndex, columnId, isFocused, isEditing, isS
|
|
|
3679
3687
|
inputRef.current?.blur();
|
|
3680
3688
|
}
|
|
3681
3689
|
}, [saveAndStop, initialValue]);
|
|
3682
|
-
const handleFocusedKeyDown = React$
|
|
3690
|
+
const handleFocusedKeyDown = React$19.useCallback((event) => {
|
|
3683
3691
|
if (!isEditable) return;
|
|
3684
3692
|
if (event.key === "Backspace") setEditValue("");
|
|
3685
3693
|
else if (event.key.length === 1 && !event.ctrlKey && !event.metaKey) setEditValue(event.key);
|
|
3686
3694
|
}, [isEditable]);
|
|
3687
|
-
const onWrapperKeyDown = React$
|
|
3695
|
+
const onWrapperKeyDown = React$19.useCallback((event) => {
|
|
3688
3696
|
if (isEditing) handleEditingKeyDown(event);
|
|
3689
3697
|
else if (isFocused) handleFocusedKeyDown(event);
|
|
3690
3698
|
}, [
|
|
@@ -3693,10 +3701,10 @@ function NumberCell({ cell, table, rowIndex, columnId, isFocused, isEditing, isS
|
|
|
3693
3701
|
handleEditingKeyDown,
|
|
3694
3702
|
handleFocusedKeyDown
|
|
3695
3703
|
]);
|
|
3696
|
-
React$
|
|
3704
|
+
React$19.useEffect(() => {
|
|
3697
3705
|
setEditValue(initialValue !== null && initialValue !== void 0 ? String(initialValue) : "");
|
|
3698
3706
|
}, [initialValue]);
|
|
3699
|
-
React$
|
|
3707
|
+
React$19.useEffect(() => {
|
|
3700
3708
|
if (isEditing && inputRef.current) {
|
|
3701
3709
|
inputRef.current.focus();
|
|
3702
3710
|
inputRef.current.select();
|
|
@@ -3744,7 +3752,7 @@ function NumberCell({ cell, table, rowIndex, columnId, isFocused, isEditing, isS
|
|
|
3744
3752
|
//#region src/data-grid/cell-variants/react-node-cell.tsx
|
|
3745
3753
|
function ReactNodeCell({ cell, table, rowIndex, columnId, isFocused, isSelected }) {
|
|
3746
3754
|
const children = cell.getValue();
|
|
3747
|
-
const containerRef = React$
|
|
3755
|
+
const containerRef = React$18.useRef(null);
|
|
3748
3756
|
return /* @__PURE__ */ jsx(DataGridCellWrapper, {
|
|
3749
3757
|
ref: containerRef,
|
|
3750
3758
|
cell,
|
|
@@ -3763,16 +3771,16 @@ function ReactNodeCell({ cell, table, rowIndex, columnId, isFocused, isSelected
|
|
|
3763
3771
|
//#region src/data-grid/cell-variants/select-cell.tsx
|
|
3764
3772
|
function SelectCell({ cell, table, rowIndex, columnId, isFocused, isEditing, isSelected }) {
|
|
3765
3773
|
const initialValue = cell.getValue();
|
|
3766
|
-
const [value, setValue] = React$
|
|
3767
|
-
const [open, setOpen] = React$
|
|
3768
|
-
const containerRef = React$
|
|
3769
|
-
const inputRef = React$
|
|
3774
|
+
const [value, setValue] = React$17.useState(initialValue);
|
|
3775
|
+
const [open, setOpen] = React$17.useState(false);
|
|
3776
|
+
const containerRef = React$17.useRef(null);
|
|
3777
|
+
const inputRef = React$17.useRef(null);
|
|
3770
3778
|
const meta = table.options.meta;
|
|
3771
3779
|
const cellOpts = cell.column.columnDef.meta?.cell;
|
|
3772
3780
|
const options = cellOpts?.variant === "select" ? cellOpts.options : [];
|
|
3773
3781
|
const hasSearch = (cellOpts?.variant === "select" && cellOpts?.hasSearch) ?? false;
|
|
3774
3782
|
const sideOffset = -(inputRef.current?.clientHeight ?? 0);
|
|
3775
|
-
const onValueChange = React$
|
|
3783
|
+
const onValueChange = React$17.useCallback((newValue) => {
|
|
3776
3784
|
setValue(newValue);
|
|
3777
3785
|
meta?.onDataUpdate?.({
|
|
3778
3786
|
rowIndex,
|
|
@@ -3785,15 +3793,15 @@ function SelectCell({ cell, table, rowIndex, columnId, isFocused, isEditing, isS
|
|
|
3785
3793
|
rowIndex,
|
|
3786
3794
|
columnId
|
|
3787
3795
|
]);
|
|
3788
|
-
const onOpenChange = React$
|
|
3796
|
+
const onOpenChange = React$17.useCallback((isOpen) => {
|
|
3789
3797
|
setOpen(isOpen);
|
|
3790
3798
|
if (!isOpen) meta?.onCellEditingStop?.();
|
|
3791
3799
|
}, [meta]);
|
|
3792
|
-
const onOpenAutoFocus = React$
|
|
3800
|
+
const onOpenAutoFocus = React$17.useCallback((event) => {
|
|
3793
3801
|
event.preventDefault();
|
|
3794
3802
|
inputRef.current?.focus();
|
|
3795
3803
|
}, []);
|
|
3796
|
-
const onWrapperKeyDown = React$
|
|
3804
|
+
const onWrapperKeyDown = React$17.useCallback((event) => {
|
|
3797
3805
|
if (isEditing) {
|
|
3798
3806
|
if (event.key === "Escape") {
|
|
3799
3807
|
event.preventDefault();
|
|
@@ -3811,10 +3819,10 @@ function SelectCell({ cell, table, rowIndex, columnId, isFocused, isEditing, isS
|
|
|
3811
3819
|
initialValue,
|
|
3812
3820
|
meta
|
|
3813
3821
|
]);
|
|
3814
|
-
React$
|
|
3822
|
+
React$17.useEffect(() => {
|
|
3815
3823
|
setValue(initialValue);
|
|
3816
3824
|
}, [initialValue]);
|
|
3817
|
-
React$
|
|
3825
|
+
React$17.useEffect(() => {
|
|
3818
3826
|
if (isEditing && !open) setOpen(true);
|
|
3819
3827
|
if (isFocused && !isEditing && !meta?.searchOpen && !meta?.isScrolling && containerRef.current) containerRef.current.focus();
|
|
3820
3828
|
}, [
|
|
@@ -3899,18 +3907,18 @@ function SelectCell({ cell, table, rowIndex, columnId, isFocused, isEditing, isS
|
|
|
3899
3907
|
//#region src/data-grid/cell-variants/short-text-cell.tsx
|
|
3900
3908
|
function ShortTextCell({ cell, table, rowIndex, columnId, isEditing, isFocused, isSelected }) {
|
|
3901
3909
|
const initialValue = cell.getValue();
|
|
3902
|
-
const [value, setValue] = React$
|
|
3903
|
-
const inputRef = React$
|
|
3904
|
-
const containerRef = React$
|
|
3910
|
+
const [value, setValue] = React$16.useState(initialValue);
|
|
3911
|
+
const inputRef = React$16.useRef(null);
|
|
3912
|
+
const containerRef = React$16.useRef(null);
|
|
3905
3913
|
const meta = table.options.meta;
|
|
3906
3914
|
const colMeta = cell.column.columnDef.meta;
|
|
3907
|
-
const editableResolver = React$
|
|
3915
|
+
const editableResolver = React$16.useMemo(() => {
|
|
3908
3916
|
const v = colMeta?.editable;
|
|
3909
3917
|
if (v === void 0) return () => true;
|
|
3910
3918
|
return typeof v === "function" ? v : () => Boolean(v);
|
|
3911
3919
|
}, [colMeta?.editable]);
|
|
3912
3920
|
const isEditable = editableResolver(cell.row.original);
|
|
3913
|
-
const onBlur = React$
|
|
3921
|
+
const onBlur = React$16.useCallback(() => {
|
|
3914
3922
|
const currentValue = inputRef.current?.value ?? "";
|
|
3915
3923
|
if (currentValue !== initialValue) meta?.onDataUpdate?.({
|
|
3916
3924
|
rowIndex,
|
|
@@ -3924,10 +3932,10 @@ function ShortTextCell({ cell, table, rowIndex, columnId, isEditing, isFocused,
|
|
|
3924
3932
|
columnId,
|
|
3925
3933
|
initialValue
|
|
3926
3934
|
]);
|
|
3927
|
-
const onChange = React$
|
|
3935
|
+
const onChange = React$16.useCallback((event) => {
|
|
3928
3936
|
setValue(event.target.value);
|
|
3929
3937
|
}, []);
|
|
3930
|
-
const handleEditingKeyDown = React$
|
|
3938
|
+
const handleEditingKeyDown = React$16.useCallback((event) => {
|
|
3931
3939
|
if (event.key === "Enter") {
|
|
3932
3940
|
event.preventDefault();
|
|
3933
3941
|
const currentValue = inputRef.current?.value ?? "";
|
|
@@ -3957,13 +3965,13 @@ function ShortTextCell({ cell, table, rowIndex, columnId, isEditing, isFocused,
|
|
|
3957
3965
|
rowIndex,
|
|
3958
3966
|
columnId
|
|
3959
3967
|
]);
|
|
3960
|
-
const handleFocusedKeyDown = React$
|
|
3968
|
+
const handleFocusedKeyDown = React$16.useCallback((event) => {
|
|
3961
3969
|
if (event.key.length === 1 && !event.ctrlKey && !event.metaKey) {
|
|
3962
3970
|
if (!isEditable) return;
|
|
3963
3971
|
setValue(event.key);
|
|
3964
3972
|
}
|
|
3965
3973
|
}, [isEditable]);
|
|
3966
|
-
const onWrapperKeyDown = React$
|
|
3974
|
+
const onWrapperKeyDown = React$16.useCallback((event) => {
|
|
3967
3975
|
if (isEditing) handleEditingKeyDown(event);
|
|
3968
3976
|
else if (isFocused) handleFocusedKeyDown(event);
|
|
3969
3977
|
}, [
|
|
@@ -3972,10 +3980,10 @@ function ShortTextCell({ cell, table, rowIndex, columnId, isEditing, isFocused,
|
|
|
3972
3980
|
handleEditingKeyDown,
|
|
3973
3981
|
handleFocusedKeyDown
|
|
3974
3982
|
]);
|
|
3975
|
-
React$
|
|
3983
|
+
React$16.useEffect(() => {
|
|
3976
3984
|
setValue(initialValue);
|
|
3977
3985
|
}, [initialValue]);
|
|
3978
|
-
React$
|
|
3986
|
+
React$16.useEffect(() => {
|
|
3979
3987
|
if (isEditing && inputRef.current) {
|
|
3980
3988
|
inputRef.current.focus();
|
|
3981
3989
|
inputRef.current.setSelectionRange(inputRef.current.value.length, inputRef.current.value.length);
|
|
@@ -4123,16 +4131,16 @@ function DataGridCell({ cell, table }) {
|
|
|
4123
4131
|
//#endregion
|
|
4124
4132
|
//#region src/data-grid/data-grid-view-menu.tsx
|
|
4125
4133
|
function DataGridViewMenu({ table,...props }) {
|
|
4126
|
-
const viewableColumns = React$
|
|
4127
|
-
const [order, setOrder] = React$
|
|
4134
|
+
const viewableColumns = React$15.useMemo(() => table.getAllColumns().filter((column) => typeof column.accessorFn !== "undefined"), [table]);
|
|
4135
|
+
const [order, setOrder] = React$15.useState(() => {
|
|
4128
4136
|
const stateOrder = table.getState().columnOrder ?? [];
|
|
4129
4137
|
if (stateOrder && stateOrder.length > 0) return stateOrder;
|
|
4130
4138
|
return table.getAllColumns().map((c) => c.id);
|
|
4131
4139
|
});
|
|
4132
|
-
const [searchQuery, setSearchQuery] = React$
|
|
4133
|
-
const [isDragging, setIsDragging] = React$
|
|
4134
|
-
const [insertionIndex, setInsertionIndex] = React$
|
|
4135
|
-
React$
|
|
4140
|
+
const [searchQuery, setSearchQuery] = React$15.useState("");
|
|
4141
|
+
const [isDragging, setIsDragging] = React$15.useState(false);
|
|
4142
|
+
const [insertionIndex, setInsertionIndex] = React$15.useState(null);
|
|
4143
|
+
React$15.useEffect(() => {
|
|
4136
4144
|
const stateOrder = table.getState().columnOrder ?? [];
|
|
4137
4145
|
if (stateOrder && stateOrder.length > 0) {
|
|
4138
4146
|
setOrder(stateOrder);
|
|
@@ -4140,8 +4148,8 @@ function DataGridViewMenu({ table,...props }) {
|
|
|
4140
4148
|
}
|
|
4141
4149
|
setOrder(table.getAllColumns().map((c) => c.id));
|
|
4142
4150
|
}, [table]);
|
|
4143
|
-
const visibleSet = React$
|
|
4144
|
-
const orderedColumns = React$
|
|
4151
|
+
const visibleSet = React$15.useMemo(() => new Set(viewableColumns.map((c) => c.id)), [viewableColumns]);
|
|
4152
|
+
const orderedColumns = React$15.useMemo(() => {
|
|
4145
4153
|
const ordered = [];
|
|
4146
4154
|
for (const id of order) {
|
|
4147
4155
|
const col = viewableColumns.find((c) => c.id === id);
|
|
@@ -4154,12 +4162,12 @@ function DataGridViewMenu({ table,...props }) {
|
|
|
4154
4162
|
viewableColumns,
|
|
4155
4163
|
table
|
|
4156
4164
|
]);
|
|
4157
|
-
const draggingRef = React$
|
|
4158
|
-
const groupRef = React$
|
|
4159
|
-
const getBaseOrder = React$
|
|
4165
|
+
const draggingRef = React$15.useRef(null);
|
|
4166
|
+
const groupRef = React$15.useRef(null);
|
|
4167
|
+
const getBaseOrder = React$15.useCallback(() => {
|
|
4160
4168
|
return table.getState().columnOrder && table.getState().columnOrder.length ? table.getState().columnOrder.slice() : table.getAllColumns().map((c) => c.id);
|
|
4161
4169
|
}, [table]);
|
|
4162
|
-
const computeInsertionIndex = React$
|
|
4170
|
+
const computeInsertionIndex = React$15.useCallback((clientY) => {
|
|
4163
4171
|
const baseOrder = getBaseOrder();
|
|
4164
4172
|
const el = groupRef.current;
|
|
4165
4173
|
if (!el) return baseOrder.length;
|
|
@@ -4181,7 +4189,7 @@ function DataGridViewMenu({ table,...props }) {
|
|
|
4181
4189
|
setIsDragging(false);
|
|
4182
4190
|
setInsertionIndex(null);
|
|
4183
4191
|
}
|
|
4184
|
-
const doDrop = React$
|
|
4192
|
+
const doDrop = React$15.useCallback((dragId, toIndex) => {
|
|
4185
4193
|
const baseOrder = table.getState().columnOrder && table.getState().columnOrder.length ? table.getState().columnOrder.slice() : table.getAllColumns().map((c) => c.id);
|
|
4186
4194
|
const fromIndex = baseOrder.indexOf(dragId);
|
|
4187
4195
|
if (fromIndex === -1) {
|
|
@@ -4198,7 +4206,7 @@ function DataGridViewMenu({ table,...props }) {
|
|
|
4198
4206
|
setOrder(copy.filter((id) => visibleSet.has(id)));
|
|
4199
4207
|
onDragEnd();
|
|
4200
4208
|
}, [table, visibleSet]);
|
|
4201
|
-
const startPointerDrag = React$
|
|
4209
|
+
const startPointerDrag = React$15.useCallback((e, id) => {
|
|
4202
4210
|
e.preventDefault();
|
|
4203
4211
|
draggingRef.current = id;
|
|
4204
4212
|
setIsDragging(true);
|
|
@@ -4208,8 +4216,8 @@ function DataGridViewMenu({ table,...props }) {
|
|
|
4208
4216
|
setInsertionIndex(idx);
|
|
4209
4217
|
};
|
|
4210
4218
|
const onUp = (ev) => {
|
|
4211
|
-
|
|
4212
|
-
|
|
4219
|
+
globalThis.removeEventListener("pointermove", onMove);
|
|
4220
|
+
globalThis.removeEventListener("pointerup", onUp);
|
|
4213
4221
|
const dragId = draggingRef.current;
|
|
4214
4222
|
const toIndex = computeInsertionIndex(ev.clientY);
|
|
4215
4223
|
if (dragId) doDrop(dragId, toIndex);
|
|
@@ -4217,8 +4225,8 @@ function DataGridViewMenu({ table,...props }) {
|
|
|
4217
4225
|
setIsDragging(false);
|
|
4218
4226
|
setInsertionIndex(null);
|
|
4219
4227
|
};
|
|
4220
|
-
|
|
4221
|
-
|
|
4228
|
+
globalThis.addEventListener("pointermove", onMove);
|
|
4229
|
+
globalThis.addEventListener("pointerup", onUp);
|
|
4222
4230
|
}, [computeInsertionIndex, doDrop]);
|
|
4223
4231
|
function insertionWouldBeNoOp(targetIndex) {
|
|
4224
4232
|
if (targetIndex === null) return false;
|
|
@@ -4231,7 +4239,7 @@ function DataGridViewMenu({ table,...props }) {
|
|
|
4231
4239
|
if (fromIndex < targetIndex) insertAt = targetIndex - 1;
|
|
4232
4240
|
return insertAt === fromIndex;
|
|
4233
4241
|
}
|
|
4234
|
-
const dragFromHandle = React$
|
|
4242
|
+
const dragFromHandle = React$15.useRef(false);
|
|
4235
4243
|
function resetTableView() {
|
|
4236
4244
|
const defaultOrder = table.getAllColumns().map((c) => c.id);
|
|
4237
4245
|
try {
|
|
@@ -4239,7 +4247,7 @@ function DataGridViewMenu({ table,...props }) {
|
|
|
4239
4247
|
} finally {
|
|
4240
4248
|
try {
|
|
4241
4249
|
if (typeof window !== "undefined") {
|
|
4242
|
-
const path =
|
|
4250
|
+
const path = globalThis.location?.pathname ?? "unknown";
|
|
4243
4251
|
const prefix = `pxl.dataGrid:${path}:`;
|
|
4244
4252
|
const keys = [];
|
|
4245
4253
|
for (let i = 0; i < localStorage.length; i++) {
|
|
@@ -4278,7 +4286,7 @@ function DataGridViewMenu({ table,...props }) {
|
|
|
4278
4286
|
const currentBase = table.getState().columnOrder && table.getState().columnOrder.length ? table.getState().columnOrder.slice() : table.getAllColumns().map((c) => c.id);
|
|
4279
4287
|
const pos = currentBase.indexOf(column.id);
|
|
4280
4288
|
const isHideable = column.getCanHide();
|
|
4281
|
-
return /* @__PURE__ */ jsxs(React$
|
|
4289
|
+
return /* @__PURE__ */ jsxs(React$15.Fragment, { children: [/* @__PURE__ */ jsxs(CommandItem, {
|
|
4282
4290
|
value: column.id,
|
|
4283
4291
|
"data-col-id": column.id,
|
|
4284
4292
|
className: cn("flex items-center gap-2 px-2 py-1 rounded", !isDragging ? "data-[selected=true]:bg-accent" : "data-[selected=true]:bg-transparent cursor-grabbing", draggingRef.current === column.id && isDragging && "bg-accent data-[selected=true]:bg-accent"),
|
|
@@ -4338,30 +4346,30 @@ const MIN_COLUMN_SIZE = 60;
|
|
|
4338
4346
|
const MAX_COLUMN_SIZE = 800;
|
|
4339
4347
|
const SEARCH_SHORTCUT_KEY = "f";
|
|
4340
4348
|
const NON_NAVIGABLE_COLUMN_IDS = ["select", "actions"];
|
|
4341
|
-
const useIsomorphicLayoutEffect = typeof window !== "undefined" ? React$
|
|
4349
|
+
const useIsomorphicLayoutEffect = typeof window !== "undefined" ? React$14.useLayoutEffect : React$14.useEffect;
|
|
4342
4350
|
function useLazyRef(fn) {
|
|
4343
|
-
const ref = React$
|
|
4351
|
+
const ref = React$14.useRef(null);
|
|
4344
4352
|
if (ref.current === null) ref.current = fn();
|
|
4345
4353
|
return ref;
|
|
4346
4354
|
}
|
|
4347
4355
|
function useAsRef(data) {
|
|
4348
|
-
const ref = React$
|
|
4356
|
+
const ref = React$14.useRef(data);
|
|
4349
4357
|
useIsomorphicLayoutEffect(() => {
|
|
4350
4358
|
ref.current = data;
|
|
4351
4359
|
});
|
|
4352
4360
|
return ref;
|
|
4353
4361
|
}
|
|
4354
4362
|
function useStore(store, selector) {
|
|
4355
|
-
const getSnapshot = React$
|
|
4356
|
-
return React$
|
|
4363
|
+
const getSnapshot = React$14.useCallback(() => selector(store.getState()), [store, selector]);
|
|
4364
|
+
return React$14.useSyncExternalStore(store.subscribe, getSnapshot, getSnapshot);
|
|
4357
4365
|
}
|
|
4358
4366
|
function useDataGrid({ columns, data, onDataChange, onRowAdd: onRowAddProp, onRowsDelete: onRowsDeleteProp, onCellFocus: onCellFocusProp, rowHeight: rowHeightProp = DEFAULT_ROW_HEIGHT, overscan = OVERSCAN, initialState, autoFocus = false, enableColumnSelection = false, enableSearch = false,...dataGridProps }) {
|
|
4359
|
-
const dataGridRef = React$
|
|
4360
|
-
const tableRef = React$
|
|
4361
|
-
const rowVirtualizerRef = React$
|
|
4362
|
-
const headerRef = React$
|
|
4363
|
-
const rowMapRef = React$
|
|
4364
|
-
const footerRef = React$
|
|
4367
|
+
const dataGridRef = React$14.useRef(null);
|
|
4368
|
+
const tableRef = React$14.useRef(null);
|
|
4369
|
+
const rowVirtualizerRef = React$14.useRef(null);
|
|
4370
|
+
const headerRef = React$14.useRef(null);
|
|
4371
|
+
const rowMapRef = React$14.useRef(new Map());
|
|
4372
|
+
const footerRef = React$14.useRef(null);
|
|
4365
4373
|
const dataGridPropsRef = useAsRef(dataGridProps);
|
|
4366
4374
|
const listenersRef = useLazyRef(() => new Set());
|
|
4367
4375
|
const stateRef = useLazyRef(() => {
|
|
@@ -4389,7 +4397,7 @@ function useDataGrid({ columns, data, onDataChange, onRowAdd: onRowAddProp, onRo
|
|
|
4389
4397
|
isScrolling: false
|
|
4390
4398
|
};
|
|
4391
4399
|
});
|
|
4392
|
-
const store = React$
|
|
4400
|
+
const store = React$14.useMemo(() => {
|
|
4393
4401
|
let isBatching = false;
|
|
4394
4402
|
let pendingNotification = false;
|
|
4395
4403
|
return {
|
|
@@ -4433,7 +4441,7 @@ function useDataGrid({ columns, data, onDataChange, onRowAdd: onRowAddProp, onRo
|
|
|
4433
4441
|
}
|
|
4434
4442
|
};
|
|
4435
4443
|
}, [listenersRef, stateRef]);
|
|
4436
|
-
React$
|
|
4444
|
+
React$14.useEffect(() => {
|
|
4437
4445
|
store.setState("rowHeight", rowHeightProp);
|
|
4438
4446
|
}, [rowHeightProp, store]);
|
|
4439
4447
|
const focusedCell = useStore(store, (state) => state.focusedCell);
|
|
@@ -4449,20 +4457,20 @@ function useDataGrid({ columns, data, onDataChange, onRowAdd: onRowAddProp, onRo
|
|
|
4449
4457
|
const rowHeight = useStore(store, (state) => state.rowHeight);
|
|
4450
4458
|
const isScrolling = useStore(store, (state) => state.isScrolling);
|
|
4451
4459
|
const rowHeightValue = getRowHeightValue(rowHeight);
|
|
4452
|
-
const columnIds = React$
|
|
4460
|
+
const columnIds = React$14.useMemo(() => {
|
|
4453
4461
|
return columns.map((c) => {
|
|
4454
4462
|
if (c.id) return c.id;
|
|
4455
4463
|
if ("accessorKey" in c) return c.accessorKey;
|
|
4456
4464
|
return void 0;
|
|
4457
4465
|
}).filter((id) => Boolean(id));
|
|
4458
4466
|
}, [columns]);
|
|
4459
|
-
const storageKey = React$
|
|
4467
|
+
const storageKey = React$14.useMemo(() => {
|
|
4460
4468
|
if (typeof window === "undefined") return void 0;
|
|
4461
|
-
const path =
|
|
4469
|
+
const path = globalThis.location?.pathname ?? "unknown";
|
|
4462
4470
|
const cols = columnIds.join("|");
|
|
4463
4471
|
return `pxl.dataGrid:${path}:${cols}`;
|
|
4464
4472
|
}, [columnIds]);
|
|
4465
|
-
const persistedState = React$
|
|
4473
|
+
const persistedState = React$14.useMemo(() => {
|
|
4466
4474
|
if (!storageKey) return void 0;
|
|
4467
4475
|
try {
|
|
4468
4476
|
const raw = localStorage.getItem(storageKey);
|
|
@@ -4473,7 +4481,7 @@ function useDataGrid({ columns, data, onDataChange, onRowAdd: onRowAddProp, onRo
|
|
|
4473
4481
|
return void 0;
|
|
4474
4482
|
}
|
|
4475
4483
|
}, [storageKey]);
|
|
4476
|
-
const mergedInitialState = React$
|
|
4484
|
+
const mergedInitialState = React$14.useMemo(() => {
|
|
4477
4485
|
const base = { ...initialState ?? {} };
|
|
4478
4486
|
if (persistedState) try {
|
|
4479
4487
|
if (persistedState.columnOrder) base.columnOrder = persistedState.columnOrder;
|
|
@@ -4482,12 +4490,12 @@ function useDataGrid({ columns, data, onDataChange, onRowAdd: onRowAddProp, onRo
|
|
|
4482
4490
|
} catch (_) {}
|
|
4483
4491
|
return base;
|
|
4484
4492
|
}, [initialState, persistedState]);
|
|
4485
|
-
const getNavigableColumnIds = React$
|
|
4493
|
+
const getNavigableColumnIds = React$14.useCallback(() => {
|
|
4486
4494
|
const t = tableRef.current;
|
|
4487
4495
|
if (t) return t.getVisibleLeafColumns().map((c) => c.id).filter((c) => !NON_NAVIGABLE_COLUMN_IDS.includes(c));
|
|
4488
4496
|
return columnIds.filter((c) => !NON_NAVIGABLE_COLUMN_IDS.includes(c));
|
|
4489
4497
|
}, [columnIds]);
|
|
4490
|
-
const onDataUpdate = React$
|
|
4498
|
+
const onDataUpdate = React$14.useCallback((updates) => {
|
|
4491
4499
|
const updateArray = Array.isArray(updates) ? updates : [updates];
|
|
4492
4500
|
if (updateArray.length === 0) return;
|
|
4493
4501
|
const currentTable = tableRef.current;
|
|
@@ -4526,10 +4534,10 @@ function useDataGrid({ columns, data, onDataChange, onRowAdd: onRowAddProp, onRo
|
|
|
4526
4534
|
});
|
|
4527
4535
|
onDataChange?.(newData);
|
|
4528
4536
|
}, [data, onDataChange]);
|
|
4529
|
-
const getIsCellSelected = React$
|
|
4537
|
+
const getIsCellSelected = React$14.useCallback((rowIndex, columnId) => {
|
|
4530
4538
|
return selectionState.selectedCells.has(getCellKey(rowIndex, columnId));
|
|
4531
4539
|
}, [selectionState.selectedCells]);
|
|
4532
|
-
const clearSelection = React$
|
|
4540
|
+
const clearSelection = React$14.useCallback(() => {
|
|
4533
4541
|
store.batch(() => {
|
|
4534
4542
|
store.setState("selectionState", {
|
|
4535
4543
|
selectedCells: new Set(),
|
|
@@ -4539,7 +4547,7 @@ function useDataGrid({ columns, data, onDataChange, onRowAdd: onRowAddProp, onRo
|
|
|
4539
4547
|
store.setState("rowSelection", {});
|
|
4540
4548
|
});
|
|
4541
4549
|
}, [store]);
|
|
4542
|
-
const selectAll = React$
|
|
4550
|
+
const selectAll = React$14.useCallback(() => {
|
|
4543
4551
|
const allCells = new Set();
|
|
4544
4552
|
const currentTable = tableRef.current;
|
|
4545
4553
|
const rows = currentTable?.getRowModel().rows ?? [];
|
|
@@ -4566,7 +4574,7 @@ function useDataGrid({ columns, data, onDataChange, onRowAdd: onRowAddProp, onRo
|
|
|
4566
4574
|
data.length,
|
|
4567
4575
|
store
|
|
4568
4576
|
]);
|
|
4569
|
-
const selectColumn = React$
|
|
4577
|
+
const selectColumn = React$14.useCallback((columnId) => {
|
|
4570
4578
|
const currentTable = tableRef.current;
|
|
4571
4579
|
const rows = currentTable?.getRowModel().rows ?? [];
|
|
4572
4580
|
const rowCount = rows.length ?? data.length;
|
|
@@ -4588,7 +4596,7 @@ function useDataGrid({ columns, data, onDataChange, onRowAdd: onRowAddProp, onRo
|
|
|
4588
4596
|
isSelecting: false
|
|
4589
4597
|
});
|
|
4590
4598
|
}, [data.length, store]);
|
|
4591
|
-
const selectRange = React$
|
|
4599
|
+
const selectRange = React$14.useCallback((start, end, isSelecting = false) => {
|
|
4592
4600
|
const visibleCols = getNavigableColumnIds();
|
|
4593
4601
|
const startColIndex = visibleCols.indexOf(start.columnId);
|
|
4594
4602
|
const endColIndex = visibleCols.indexOf(end.columnId);
|
|
@@ -4610,7 +4618,7 @@ function useDataGrid({ columns, data, onDataChange, onRowAdd: onRowAddProp, onRo
|
|
|
4610
4618
|
isSelecting
|
|
4611
4619
|
});
|
|
4612
4620
|
}, [getNavigableColumnIds, store]);
|
|
4613
|
-
const focusCell = React$
|
|
4621
|
+
const focusCell = React$14.useCallback((rowIndex, columnId) => {
|
|
4614
4622
|
store.batch(() => {
|
|
4615
4623
|
store.setState("focusedCell", {
|
|
4616
4624
|
rowIndex,
|
|
@@ -4626,7 +4634,7 @@ function useDataGrid({ columns, data, onDataChange, onRowAdd: onRowAddProp, onRo
|
|
|
4626
4634
|
if (currentState.searchOpen) return;
|
|
4627
4635
|
if (dataGridRef.current && document.activeElement !== dataGridRef.current) dataGridRef.current.focus();
|
|
4628
4636
|
}, [store, onCellFocusProp]);
|
|
4629
|
-
const onRowsDelete = React$
|
|
4637
|
+
const onRowsDelete = React$14.useCallback(async (rowIndices) => {
|
|
4630
4638
|
if (!onRowsDeleteProp || rowIndices.length === 0) return;
|
|
4631
4639
|
const currentTable = tableRef.current;
|
|
4632
4640
|
const rows = currentTable?.getRowModel().rows;
|
|
@@ -4665,7 +4673,7 @@ function useDataGrid({ columns, data, onDataChange, onRowAdd: onRowAddProp, onRo
|
|
|
4665
4673
|
getNavigableColumnIds,
|
|
4666
4674
|
focusCell
|
|
4667
4675
|
]);
|
|
4668
|
-
const navigateCell = React$
|
|
4676
|
+
const navigateCell = React$14.useCallback((direction) => {
|
|
4669
4677
|
const currentState = store.getState();
|
|
4670
4678
|
if (!currentState.focusedCell) return;
|
|
4671
4679
|
const { rowIndex, columnId } = currentState.focusedCell;
|
|
@@ -4791,7 +4799,7 @@ function useDataGrid({ columns, data, onDataChange, onRowAdd: onRowAddProp, onRo
|
|
|
4791
4799
|
data.length,
|
|
4792
4800
|
rowHeightValue
|
|
4793
4801
|
]);
|
|
4794
|
-
const onCellEditingStart = React$
|
|
4802
|
+
const onCellEditingStart = React$14.useCallback((rowIndex, columnId) => {
|
|
4795
4803
|
store.batch(() => {
|
|
4796
4804
|
store.setState("focusedCell", {
|
|
4797
4805
|
rowIndex,
|
|
@@ -4803,7 +4811,7 @@ function useDataGrid({ columns, data, onDataChange, onRowAdd: onRowAddProp, onRo
|
|
|
4803
4811
|
});
|
|
4804
4812
|
});
|
|
4805
4813
|
}, [store]);
|
|
4806
|
-
const onCellEditingStop = React$
|
|
4814
|
+
const onCellEditingStop = React$14.useCallback((opts) => {
|
|
4807
4815
|
const currentState = store.getState();
|
|
4808
4816
|
const currentEditing = currentState.editingCell;
|
|
4809
4817
|
store.setState("editingCell", null);
|
|
@@ -4829,7 +4837,7 @@ function useDataGrid({ columns, data, onDataChange, onRowAdd: onRowAddProp, onRo
|
|
|
4829
4837
|
focusCell,
|
|
4830
4838
|
navigateCell
|
|
4831
4839
|
]);
|
|
4832
|
-
const onSearchOpenChange = React$
|
|
4840
|
+
const onSearchOpenChange = React$14.useCallback((open) => {
|
|
4833
4841
|
if (open) {
|
|
4834
4842
|
store.setState("searchOpen", true);
|
|
4835
4843
|
return;
|
|
@@ -4848,7 +4856,7 @@ function useDataGrid({ columns, data, onDataChange, onRowAdd: onRowAddProp, onRo
|
|
|
4848
4856
|
});
|
|
4849
4857
|
if (dataGridRef.current && document.activeElement !== dataGridRef.current) dataGridRef.current.focus();
|
|
4850
4858
|
}, [store]);
|
|
4851
|
-
const onSearch = React$
|
|
4859
|
+
const onSearch = React$14.useCallback((query) => {
|
|
4852
4860
|
if (!query.trim()) {
|
|
4853
4861
|
store.batch(() => {
|
|
4854
4862
|
store.setState("searchMatches", []);
|
|
@@ -4883,8 +4891,8 @@ function useDataGrid({ columns, data, onDataChange, onRowAdd: onRowAddProp, onRo
|
|
|
4883
4891
|
rowVirtualizerRef.current?.scrollToIndex(firstMatch.rowIndex, { align: "center" });
|
|
4884
4892
|
}
|
|
4885
4893
|
}, [columnIds, store]);
|
|
4886
|
-
const onSearchQueryChange = React$
|
|
4887
|
-
const onNavigateToPrevMatch = React$
|
|
4894
|
+
const onSearchQueryChange = React$14.useCallback((query) => store.setState("searchQuery", query), [store]);
|
|
4895
|
+
const onNavigateToPrevMatch = React$14.useCallback(() => {
|
|
4888
4896
|
const currentState = store.getState();
|
|
4889
4897
|
if (currentState.searchMatches.length === 0) return;
|
|
4890
4898
|
const prevIndex = currentState.matchIndex - 1 < 0 ? currentState.searchMatches.length - 1 : currentState.matchIndex - 1;
|
|
@@ -4899,7 +4907,7 @@ function useDataGrid({ columns, data, onDataChange, onRowAdd: onRowAddProp, onRo
|
|
|
4899
4907
|
});
|
|
4900
4908
|
}
|
|
4901
4909
|
}, [store, focusCell]);
|
|
4902
|
-
const onNavigateToNextMatch = React$
|
|
4910
|
+
const onNavigateToNextMatch = React$14.useCallback(() => {
|
|
4903
4911
|
const currentState = store.getState();
|
|
4904
4912
|
if (currentState.searchMatches.length === 0) return;
|
|
4905
4913
|
const nextIndex = (currentState.matchIndex + 1) % currentState.searchMatches.length;
|
|
@@ -4914,15 +4922,15 @@ function useDataGrid({ columns, data, onDataChange, onRowAdd: onRowAddProp, onRo
|
|
|
4914
4922
|
});
|
|
4915
4923
|
}
|
|
4916
4924
|
}, [store, focusCell]);
|
|
4917
|
-
const getIsSearchMatch = React$
|
|
4925
|
+
const getIsSearchMatch = React$14.useCallback((rowIndex, columnId) => {
|
|
4918
4926
|
return searchMatches.some((match) => match.rowIndex === rowIndex && match.columnId === columnId);
|
|
4919
4927
|
}, [searchMatches]);
|
|
4920
|
-
const getIsActiveSearchMatch = React$
|
|
4928
|
+
const getIsActiveSearchMatch = React$14.useCallback((rowIndex, columnId) => {
|
|
4921
4929
|
if (matchIndex < 0) return false;
|
|
4922
4930
|
const currentMatch = searchMatches[matchIndex];
|
|
4923
4931
|
return currentMatch?.rowIndex === rowIndex && currentMatch?.columnId === columnId;
|
|
4924
4932
|
}, [searchMatches, matchIndex]);
|
|
4925
|
-
const blurCell = React$
|
|
4933
|
+
const blurCell = React$14.useCallback(() => {
|
|
4926
4934
|
const currentState = store.getState();
|
|
4927
4935
|
if (currentState.editingCell && document.activeElement instanceof HTMLElement) document.activeElement.blur();
|
|
4928
4936
|
store.batch(() => {
|
|
@@ -4930,7 +4938,7 @@ function useDataGrid({ columns, data, onDataChange, onRowAdd: onRowAddProp, onRo
|
|
|
4930
4938
|
store.setState("editingCell", null);
|
|
4931
4939
|
});
|
|
4932
4940
|
}, [store]);
|
|
4933
|
-
const onCellClick = React$
|
|
4941
|
+
const onCellClick = React$14.useCallback((rowIndex, columnId, event) => {
|
|
4934
4942
|
if (event?.button === 2) return;
|
|
4935
4943
|
const currentState = store.getState();
|
|
4936
4944
|
const currentFocused = currentState.focusedCell;
|
|
@@ -4978,11 +4986,11 @@ function useDataGrid({ columns, data, onDataChange, onRowAdd: onRowAddProp, onRo
|
|
|
4978
4986
|
selectRange,
|
|
4979
4987
|
clearSelection
|
|
4980
4988
|
]);
|
|
4981
|
-
const onCellDoubleClick = React$
|
|
4989
|
+
const onCellDoubleClick = React$14.useCallback((rowIndex, columnId, event) => {
|
|
4982
4990
|
if (event?.defaultPrevented) return;
|
|
4983
4991
|
onCellEditingStart(rowIndex, columnId);
|
|
4984
4992
|
}, [onCellEditingStart]);
|
|
4985
|
-
const onCellMouseDown = React$
|
|
4993
|
+
const onCellMouseDown = React$14.useCallback((rowIndex, columnId, event) => {
|
|
4986
4994
|
if (event.button === 2) return;
|
|
4987
4995
|
event.preventDefault();
|
|
4988
4996
|
if (!event.ctrlKey && !event.metaKey && !event.shiftKey) store.batch(() => {
|
|
@@ -5003,7 +5011,7 @@ function useDataGrid({ columns, data, onDataChange, onRowAdd: onRowAddProp, onRo
|
|
|
5003
5011
|
store.setState("rowSelection", {});
|
|
5004
5012
|
});
|
|
5005
5013
|
}, [store]);
|
|
5006
|
-
const onCellMouseEnter = React$
|
|
5014
|
+
const onCellMouseEnter = React$14.useCallback((rowIndex, columnId, _event) => {
|
|
5007
5015
|
const currentState = store.getState();
|
|
5008
5016
|
if (currentState.selectionState.isSelecting && currentState.selectionState.selectionRange) {
|
|
5009
5017
|
const start = currentState.selectionState.selectionRange.start;
|
|
@@ -5019,14 +5027,14 @@ function useDataGrid({ columns, data, onDataChange, onRowAdd: onRowAddProp, onRo
|
|
|
5019
5027
|
selectRange,
|
|
5020
5028
|
focusCell
|
|
5021
5029
|
]);
|
|
5022
|
-
const onCellMouseUp = React$
|
|
5030
|
+
const onCellMouseUp = React$14.useCallback(() => {
|
|
5023
5031
|
const currentState = store.getState();
|
|
5024
5032
|
store.setState("selectionState", {
|
|
5025
5033
|
...currentState.selectionState,
|
|
5026
5034
|
isSelecting: false
|
|
5027
5035
|
});
|
|
5028
5036
|
}, [store]);
|
|
5029
|
-
const onCellContextMenu = React$
|
|
5037
|
+
const onCellContextMenu = React$14.useCallback((rowIndex, columnId, event) => {
|
|
5030
5038
|
event.preventDefault();
|
|
5031
5039
|
event.stopPropagation();
|
|
5032
5040
|
const currentState = store.getState();
|
|
@@ -5058,7 +5066,7 @@ function useDataGrid({ columns, data, onDataChange, onRowAdd: onRowAddProp, onRo
|
|
|
5058
5066
|
y: event.clientY
|
|
5059
5067
|
});
|
|
5060
5068
|
}, [store]);
|
|
5061
|
-
const onContextMenuOpenChange = React$
|
|
5069
|
+
const onContextMenuOpenChange = React$14.useCallback((open) => {
|
|
5062
5070
|
if (!open) {
|
|
5063
5071
|
const currentMenu = store.getState().contextMenu;
|
|
5064
5072
|
store.setState("contextMenu", {
|
|
@@ -5068,7 +5076,7 @@ function useDataGrid({ columns, data, onDataChange, onRowAdd: onRowAddProp, onRo
|
|
|
5068
5076
|
});
|
|
5069
5077
|
}
|
|
5070
5078
|
}, [store]);
|
|
5071
|
-
const onDataGridKeyDown = React$
|
|
5079
|
+
const onDataGridKeyDown = React$14.useCallback((event) => {
|
|
5072
5080
|
const currentState = store.getState();
|
|
5073
5081
|
const { key, ctrlKey, metaKey, shiftKey } = event;
|
|
5074
5082
|
const isCtrlPressed = ctrlKey || metaKey;
|
|
@@ -5216,12 +5224,12 @@ function useDataGrid({ columns, data, onDataChange, onRowAdd: onRowAddProp, onRo
|
|
|
5216
5224
|
onNavigateToPrevMatch,
|
|
5217
5225
|
enableSearch
|
|
5218
5226
|
]);
|
|
5219
|
-
const onSortingChange = React$
|
|
5227
|
+
const onSortingChange = React$14.useCallback((updater) => {
|
|
5220
5228
|
const currentState = store.getState();
|
|
5221
5229
|
const newSorting = typeof updater === "function" ? updater(currentState.sorting) : updater;
|
|
5222
5230
|
store.setState("sorting", newSorting);
|
|
5223
5231
|
}, [store]);
|
|
5224
|
-
const onRowSelectionChange = React$
|
|
5232
|
+
const onRowSelectionChange = React$14.useCallback((updater) => {
|
|
5225
5233
|
const currentState = store.getState();
|
|
5226
5234
|
const newRowSelection = typeof updater === "function" ? updater(currentState.rowSelection) : updater;
|
|
5227
5235
|
const selectedRows = Object.keys(newRowSelection).filter((key) => newRowSelection[key]);
|
|
@@ -5243,7 +5251,7 @@ function useDataGrid({ columns, data, onDataChange, onRowAdd: onRowAddProp, onRo
|
|
|
5243
5251
|
store.setState("editingCell", null);
|
|
5244
5252
|
});
|
|
5245
5253
|
}, [store, columnIds]);
|
|
5246
|
-
const onRowSelect = React$
|
|
5254
|
+
const onRowSelect = React$14.useCallback((rowIndex, selected, shiftKey) => {
|
|
5247
5255
|
const currentState = store.getState();
|
|
5248
5256
|
const rows = tableRef.current?.getRowModel().rows ?? [];
|
|
5249
5257
|
const currentRow = rows[rowIndex];
|
|
@@ -5263,12 +5271,12 @@ function useDataGrid({ columns, data, onDataChange, onRowAdd: onRowAddProp, onRo
|
|
|
5263
5271
|
});
|
|
5264
5272
|
store.setState("lastClickedRowIndex", rowIndex);
|
|
5265
5273
|
}, [store, onRowSelectionChange]);
|
|
5266
|
-
const onRowHeightChange = React$
|
|
5274
|
+
const onRowHeightChange = React$14.useCallback((updater) => {
|
|
5267
5275
|
const currentState = store.getState();
|
|
5268
5276
|
const newRowHeight = typeof updater === "function" ? updater(currentState.rowHeight) : updater;
|
|
5269
5277
|
store.setState("rowHeight", newRowHeight);
|
|
5270
5278
|
}, [store]);
|
|
5271
|
-
const onColumnClick = React$
|
|
5279
|
+
const onColumnClick = React$14.useCallback((columnId) => {
|
|
5272
5280
|
if (!enableColumnSelection) {
|
|
5273
5281
|
clearSelection();
|
|
5274
5282
|
return;
|
|
@@ -5279,12 +5287,12 @@ function useDataGrid({ columns, data, onDataChange, onRowAdd: onRowAddProp, onRo
|
|
|
5279
5287
|
selectColumn,
|
|
5280
5288
|
clearSelection
|
|
5281
5289
|
]);
|
|
5282
|
-
const defaultColumn = React$
|
|
5290
|
+
const defaultColumn = React$14.useMemo(() => ({
|
|
5283
5291
|
cell: DataGridCell,
|
|
5284
5292
|
minSize: MIN_COLUMN_SIZE,
|
|
5285
5293
|
maxSize: MAX_COLUMN_SIZE
|
|
5286
5294
|
}), []);
|
|
5287
|
-
const tableOptions = React$
|
|
5295
|
+
const tableOptions = React$14.useMemo(() => ({
|
|
5288
5296
|
...dataGridPropsRef.current,
|
|
5289
5297
|
data,
|
|
5290
5298
|
columns,
|
|
@@ -5367,7 +5375,7 @@ function useDataGrid({ columns, data, onDataChange, onRowAdd: onRowAddProp, onRo
|
|
|
5367
5375
|
const table = useReactTable(tableOptions);
|
|
5368
5376
|
if (!tableRef.current) tableRef.current = table;
|
|
5369
5377
|
const columnSizing = table.getState().columnSizing;
|
|
5370
|
-
const columnSizeVars = React$
|
|
5378
|
+
const columnSizeVars = React$14.useMemo(() => {
|
|
5371
5379
|
const headers = table.getFlatHeaders();
|
|
5372
5380
|
const colSizes = {};
|
|
5373
5381
|
for (const header of headers) {
|
|
@@ -5400,7 +5408,7 @@ function useDataGrid({ columns, data, onDataChange, onRowAdd: onRowAddProp, onRo
|
|
|
5400
5408
|
}
|
|
5401
5409
|
});
|
|
5402
5410
|
if (!rowVirtualizerRef.current) rowVirtualizerRef.current = rowVirtualizer;
|
|
5403
|
-
const onScrollToRow = React$
|
|
5411
|
+
const onScrollToRow = React$14.useCallback((opts) => {
|
|
5404
5412
|
const rowIndex = opts?.rowIndex ?? 0;
|
|
5405
5413
|
const columnId = opts?.columnId;
|
|
5406
5414
|
rowVirtualizer.scrollToIndex(rowIndex, { align: "center" });
|
|
@@ -5424,7 +5432,7 @@ function useDataGrid({ columns, data, onDataChange, onRowAdd: onRowAddProp, onRo
|
|
|
5424
5432
|
getNavigableColumnIds,
|
|
5425
5433
|
store
|
|
5426
5434
|
]);
|
|
5427
|
-
const onRowAdd = React$
|
|
5435
|
+
const onRowAdd = React$14.useCallback(async (event) => {
|
|
5428
5436
|
if (!onRowAddProp) return;
|
|
5429
5437
|
const result = await onRowAddProp(event);
|
|
5430
5438
|
if (event?.defaultPrevented || result === null) return;
|
|
@@ -5457,7 +5465,7 @@ function useDataGrid({ columns, data, onDataChange, onRowAdd: onRowAddProp, onRo
|
|
|
5457
5465
|
table.getState().columnVisibility,
|
|
5458
5466
|
table.getState().columnPinning
|
|
5459
5467
|
]);
|
|
5460
|
-
const searchState = React$
|
|
5468
|
+
const searchState = React$14.useMemo(() => {
|
|
5461
5469
|
if (!enableSearch) return void 0;
|
|
5462
5470
|
return {
|
|
5463
5471
|
searchMatches,
|
|
@@ -5482,7 +5490,7 @@ function useDataGrid({ columns, data, onDataChange, onRowAdd: onRowAddProp, onRo
|
|
|
5482
5490
|
onNavigateToNextMatch,
|
|
5483
5491
|
onNavigateToPrevMatch
|
|
5484
5492
|
]);
|
|
5485
|
-
React$
|
|
5493
|
+
React$14.useEffect(() => {
|
|
5486
5494
|
const dataGridElement = dataGridRef.current;
|
|
5487
5495
|
if (!dataGridElement) return;
|
|
5488
5496
|
dataGridElement.addEventListener("keydown", onDataGridKeyDown);
|
|
@@ -5490,7 +5498,7 @@ function useDataGrid({ columns, data, onDataChange, onRowAdd: onRowAddProp, onRo
|
|
|
5490
5498
|
dataGridElement.removeEventListener("keydown", onDataGridKeyDown);
|
|
5491
5499
|
};
|
|
5492
5500
|
}, [onDataGridKeyDown]);
|
|
5493
|
-
React$
|
|
5501
|
+
React$14.useEffect(() => {
|
|
5494
5502
|
function onGlobalKeyDown(event) {
|
|
5495
5503
|
const dataGridElement = dataGridRef.current;
|
|
5496
5504
|
if (!dataGridElement) return;
|
|
@@ -5524,9 +5532,9 @@ function useDataGrid({ columns, data, onDataChange, onRowAdd: onRowAddProp, onRo
|
|
|
5524
5532
|
}
|
|
5525
5533
|
}
|
|
5526
5534
|
}
|
|
5527
|
-
|
|
5535
|
+
globalThis.addEventListener("keydown", onGlobalKeyDown, true);
|
|
5528
5536
|
return () => {
|
|
5529
|
-
|
|
5537
|
+
globalThis.removeEventListener("keydown", onGlobalKeyDown, true);
|
|
5530
5538
|
};
|
|
5531
5539
|
}, [
|
|
5532
5540
|
enableSearch,
|
|
@@ -5534,7 +5542,7 @@ function useDataGrid({ columns, data, onDataChange, onRowAdd: onRowAddProp, onRo
|
|
|
5534
5542
|
store,
|
|
5535
5543
|
clearSelection
|
|
5536
5544
|
]);
|
|
5537
|
-
React$
|
|
5545
|
+
React$14.useEffect(() => {
|
|
5538
5546
|
const currentState = store.getState();
|
|
5539
5547
|
if (autoFocus && data.length > 0 && columns.length > 0 && !currentState.focusedCell) {
|
|
5540
5548
|
const _nav = getNavigableColumnIds();
|
|
@@ -5560,7 +5568,7 @@ function useDataGrid({ columns, data, onDataChange, onRowAdd: onRowAddProp, onRo
|
|
|
5560
5568
|
getNavigableColumnIds,
|
|
5561
5569
|
focusCell
|
|
5562
5570
|
]);
|
|
5563
|
-
React$
|
|
5571
|
+
React$14.useEffect(() => {
|
|
5564
5572
|
function onOutsideClick(event) {
|
|
5565
5573
|
if (event.button === 2) return;
|
|
5566
5574
|
if (dataGridRef.current && !dataGridRef.current.contains(event.target)) {
|
|
@@ -5582,7 +5590,7 @@ function useDataGrid({ columns, data, onDataChange, onRowAdd: onRowAddProp, onRo
|
|
|
5582
5590
|
blurCell,
|
|
5583
5591
|
clearSelection
|
|
5584
5592
|
]);
|
|
5585
|
-
React$
|
|
5593
|
+
React$14.useEffect(() => {
|
|
5586
5594
|
function onCleanup() {
|
|
5587
5595
|
document.removeEventListener("selectstart", preventSelection);
|
|
5588
5596
|
document.removeEventListener("contextmenu", preventContextMenu);
|
|
@@ -5642,7 +5650,7 @@ function useDataGrid({ columns, data, onDataChange, onRowAdd: onRowAddProp, onRo
|
|
|
5642
5650
|
//#endregion
|
|
5643
5651
|
//#region src/date-picker/date-picker.tsx
|
|
5644
5652
|
function DatePickerDemo() {
|
|
5645
|
-
const [date, setDate] = React$
|
|
5653
|
+
const [date, setDate] = React$13.useState();
|
|
5646
5654
|
return /* @__PURE__ */ jsxs(Popover, { children: [/* @__PURE__ */ jsx(PopoverTrigger, {
|
|
5647
5655
|
asChild: true,
|
|
5648
5656
|
children: /* @__PURE__ */ jsxs(Button, {
|
|
@@ -5672,13 +5680,13 @@ Drawer.displayName = "Drawer";
|
|
|
5672
5680
|
const DrawerTrigger = Drawer$1.Trigger;
|
|
5673
5681
|
const DrawerPortal = Drawer$1.Portal;
|
|
5674
5682
|
const DrawerClose = Drawer$1.Close;
|
|
5675
|
-
const DrawerOverlay = React$
|
|
5683
|
+
const DrawerOverlay = React$12.forwardRef(({ className,...props }, ref) => /* @__PURE__ */ jsx(Drawer$1.Overlay, {
|
|
5676
5684
|
ref,
|
|
5677
5685
|
className: cn("fixed inset-0 z-50 bg-black/80", className),
|
|
5678
5686
|
...props
|
|
5679
5687
|
}));
|
|
5680
5688
|
DrawerOverlay.displayName = Drawer$1.Overlay.displayName;
|
|
5681
|
-
const DrawerContent = React$
|
|
5689
|
+
const DrawerContent = React$12.forwardRef(({ className, children,...props }, ref) => /* @__PURE__ */ jsxs(DrawerPortal, { children: [/* @__PURE__ */ jsx(DrawerOverlay, {}), /* @__PURE__ */ jsxs(Drawer$1.Content, {
|
|
5682
5690
|
ref,
|
|
5683
5691
|
className: cn("fixed inset-x-0 bottom-0 z-50 mt-24 flex h-auto flex-col rounded-t-[10px] border bg-background", className),
|
|
5684
5692
|
...props,
|
|
@@ -5695,13 +5703,13 @@ const DrawerFooter = ({ className,...props }) => /* @__PURE__ */ jsx("div", {
|
|
|
5695
5703
|
...props
|
|
5696
5704
|
});
|
|
5697
5705
|
DrawerFooter.displayName = "DrawerFooter";
|
|
5698
|
-
const DrawerTitle = React$
|
|
5706
|
+
const DrawerTitle = React$12.forwardRef(({ className,...props }, ref) => /* @__PURE__ */ jsx(Drawer$1.Title, {
|
|
5699
5707
|
ref,
|
|
5700
5708
|
className: cn("text-lg font-semibold leading-none tracking-tight", className),
|
|
5701
5709
|
...props
|
|
5702
5710
|
}));
|
|
5703
5711
|
DrawerTitle.displayName = Drawer$1.Title.displayName;
|
|
5704
|
-
const DrawerDescription = React$
|
|
5712
|
+
const DrawerDescription = React$12.forwardRef(({ className,...props }, ref) => /* @__PURE__ */ jsx(Drawer$1.Description, {
|
|
5705
5713
|
ref,
|
|
5706
5714
|
className: cn("text-sm text-muted-foreground", className),
|
|
5707
5715
|
...props
|
|
@@ -5720,7 +5728,7 @@ function Label({ className,...props }) {
|
|
|
5720
5728
|
|
|
5721
5729
|
//#endregion
|
|
5722
5730
|
//#region src/separator/separator.tsx
|
|
5723
|
-
const Separator = React$
|
|
5731
|
+
const Separator = React$11.forwardRef(({ className, orientation = "horizontal", decorative = true,...props }, ref) => /* @__PURE__ */ jsx(SeparatorPrimitive.Root, {
|
|
5724
5732
|
ref,
|
|
5725
5733
|
decorative,
|
|
5726
5734
|
orientation,
|
|
@@ -5839,6 +5847,22 @@ function FieldError({ className, children, errors,...props }) {
|
|
|
5839
5847
|
});
|
|
5840
5848
|
}
|
|
5841
5849
|
|
|
5850
|
+
//#endregion
|
|
5851
|
+
//#region src/hooks/use-is-mobile.ts
|
|
5852
|
+
function useIsMobile(mobileBreakpoint = 768) {
|
|
5853
|
+
const [isMobile, setIsMobile] = React$10.useState(false);
|
|
5854
|
+
React$10.useEffect(() => {
|
|
5855
|
+
const mql = globalThis.matchMedia(`(max-width: ${mobileBreakpoint - 1}px)`);
|
|
5856
|
+
const onChange = () => {
|
|
5857
|
+
setIsMobile(globalThis.innerWidth < mobileBreakpoint);
|
|
5858
|
+
};
|
|
5859
|
+
mql.addEventListener("change", onChange);
|
|
5860
|
+
setIsMobile(globalThis.innerWidth < mobileBreakpoint);
|
|
5861
|
+
return () => mql.removeEventListener("change", onChange);
|
|
5862
|
+
}, [mobileBreakpoint]);
|
|
5863
|
+
return isMobile;
|
|
5864
|
+
}
|
|
5865
|
+
|
|
5842
5866
|
//#endregion
|
|
5843
5867
|
//#region src/mark-value-renderer/mark-value-renderer.tsx
|
|
5844
5868
|
/**
|
|
@@ -5870,32 +5894,32 @@ const MenubarGroup = MenubarPrimitive.Group;
|
|
|
5870
5894
|
const MenubarPortal = MenubarPrimitive.Portal;
|
|
5871
5895
|
const MenubarSub = MenubarPrimitive.Sub;
|
|
5872
5896
|
const MenubarRadioGroup = MenubarPrimitive.RadioGroup;
|
|
5873
|
-
const Menubar = React$
|
|
5897
|
+
const Menubar = React$9.forwardRef(({ className,...props }, ref) => /* @__PURE__ */ jsx(MenubarPrimitive.Root, {
|
|
5874
5898
|
ref,
|
|
5875
5899
|
className: cn("flex h-9 items-center space-x-1 rounded-md border bg-background p-1 shadow-sm", className),
|
|
5876
5900
|
...props
|
|
5877
5901
|
}));
|
|
5878
5902
|
Menubar.displayName = MenubarPrimitive.Root.displayName;
|
|
5879
|
-
const MenubarTrigger = React$
|
|
5903
|
+
const MenubarTrigger = React$9.forwardRef(({ className,...props }, ref) => /* @__PURE__ */ jsx(MenubarPrimitive.Trigger, {
|
|
5880
5904
|
ref,
|
|
5881
5905
|
className: cn("flex cursor-default select-none items-center rounded-sm px-3 py-1 text-sm font-medium outline-none focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground", className),
|
|
5882
5906
|
...props
|
|
5883
5907
|
}));
|
|
5884
5908
|
MenubarTrigger.displayName = MenubarPrimitive.Trigger.displayName;
|
|
5885
|
-
const MenubarSubTrigger = React$
|
|
5909
|
+
const MenubarSubTrigger = React$9.forwardRef(({ className, inset, children,...props }, ref) => /* @__PURE__ */ jsxs(MenubarPrimitive.SubTrigger, {
|
|
5886
5910
|
ref,
|
|
5887
5911
|
className: cn("flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground", inset && "pl-8", className),
|
|
5888
5912
|
...props,
|
|
5889
5913
|
children: [children, /* @__PURE__ */ jsx(ChevronRightIcon, { className: "ml-auto h-4 w-4" })]
|
|
5890
5914
|
}));
|
|
5891
5915
|
MenubarSubTrigger.displayName = MenubarPrimitive.SubTrigger.displayName;
|
|
5892
|
-
const MenubarSubContent = React$
|
|
5916
|
+
const MenubarSubContent = React$9.forwardRef(({ className,...props }, ref) => /* @__PURE__ */ jsx(MenubarPrimitive.SubContent, {
|
|
5893
5917
|
ref,
|
|
5894
5918
|
className: cn("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2", className),
|
|
5895
5919
|
...props
|
|
5896
5920
|
}));
|
|
5897
5921
|
MenubarSubContent.displayName = MenubarPrimitive.SubContent.displayName;
|
|
5898
|
-
const MenubarContent = React$
|
|
5922
|
+
const MenubarContent = React$9.forwardRef(({ className, align = "start", alignOffset = -4, sideOffset = 8,...props }, ref) => /* @__PURE__ */ jsx(MenubarPrimitive.Portal, { children: /* @__PURE__ */ jsx(MenubarPrimitive.Content, {
|
|
5899
5923
|
ref,
|
|
5900
5924
|
align,
|
|
5901
5925
|
alignOffset,
|
|
@@ -5904,13 +5928,13 @@ const MenubarContent = React$8.forwardRef(({ className, align = "start", alignOf
|
|
|
5904
5928
|
...props
|
|
5905
5929
|
}) }));
|
|
5906
5930
|
MenubarContent.displayName = MenubarPrimitive.Content.displayName;
|
|
5907
|
-
const MenubarItem = React$
|
|
5931
|
+
const MenubarItem = React$9.forwardRef(({ className, inset,...props }, ref) => /* @__PURE__ */ jsx(MenubarPrimitive.Item, {
|
|
5908
5932
|
ref,
|
|
5909
5933
|
className: cn("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50", inset && "pl-8", className),
|
|
5910
5934
|
...props
|
|
5911
5935
|
}));
|
|
5912
5936
|
MenubarItem.displayName = MenubarPrimitive.Item.displayName;
|
|
5913
|
-
const MenubarCheckboxItem = React$
|
|
5937
|
+
const MenubarCheckboxItem = React$9.forwardRef(({ className, children, checked,...props }, ref) => /* @__PURE__ */ jsxs(MenubarPrimitive.CheckboxItem, {
|
|
5914
5938
|
ref,
|
|
5915
5939
|
className: cn("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50", className),
|
|
5916
5940
|
checked,
|
|
@@ -5921,7 +5945,7 @@ const MenubarCheckboxItem = React$8.forwardRef(({ className, children, checked,.
|
|
|
5921
5945
|
}), children]
|
|
5922
5946
|
}));
|
|
5923
5947
|
MenubarCheckboxItem.displayName = MenubarPrimitive.CheckboxItem.displayName;
|
|
5924
|
-
const MenubarRadioItem = React$
|
|
5948
|
+
const MenubarRadioItem = React$9.forwardRef(({ className, children,...props }, ref) => /* @__PURE__ */ jsxs(MenubarPrimitive.RadioItem, {
|
|
5925
5949
|
ref,
|
|
5926
5950
|
className: cn("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50", className),
|
|
5927
5951
|
...props,
|
|
@@ -5931,13 +5955,13 @@ const MenubarRadioItem = React$8.forwardRef(({ className, children,...props }, r
|
|
|
5931
5955
|
}), children]
|
|
5932
5956
|
}));
|
|
5933
5957
|
MenubarRadioItem.displayName = MenubarPrimitive.RadioItem.displayName;
|
|
5934
|
-
const MenubarLabel = React$
|
|
5958
|
+
const MenubarLabel = React$9.forwardRef(({ className, inset,...props }, ref) => /* @__PURE__ */ jsx(MenubarPrimitive.Label, {
|
|
5935
5959
|
ref,
|
|
5936
5960
|
className: cn("px-2 py-1.5 text-sm font-semibold", inset && "pl-8", className),
|
|
5937
5961
|
...props
|
|
5938
5962
|
}));
|
|
5939
5963
|
MenubarLabel.displayName = MenubarPrimitive.Label.displayName;
|
|
5940
|
-
const MenubarSeparator = React$
|
|
5964
|
+
const MenubarSeparator = React$9.forwardRef(({ className,...props }, ref) => /* @__PURE__ */ jsx(MenubarPrimitive.Separator, {
|
|
5941
5965
|
ref,
|
|
5942
5966
|
className: cn("-mx-1 my-1 h-px bg-muted", className),
|
|
5943
5967
|
...props
|
|
@@ -6074,13 +6098,13 @@ const Pagination = ({ className,...props }) => /* @__PURE__ */ jsx("nav", {
|
|
|
6074
6098
|
...props
|
|
6075
6099
|
});
|
|
6076
6100
|
Pagination.displayName = "Pagination";
|
|
6077
|
-
const PaginationContent = React$
|
|
6101
|
+
const PaginationContent = React$8.forwardRef(({ className,...props }, ref) => /* @__PURE__ */ jsx("ul", {
|
|
6078
6102
|
ref,
|
|
6079
6103
|
className: cn("flex flex-row items-center gap-1", className),
|
|
6080
6104
|
...props
|
|
6081
6105
|
}));
|
|
6082
6106
|
PaginationContent.displayName = "PaginationContent";
|
|
6083
|
-
const PaginationItem = React$
|
|
6107
|
+
const PaginationItem = React$8.forwardRef(({ className,...props }, ref) => /* @__PURE__ */ jsx("li", {
|
|
6084
6108
|
ref,
|
|
6085
6109
|
className: cn("", className),
|
|
6086
6110
|
...props
|
|
@@ -6202,7 +6226,7 @@ const ResizableHandle = ({ withHandle, className,...props }) => /* @__PURE__ */
|
|
|
6202
6226
|
|
|
6203
6227
|
//#endregion
|
|
6204
6228
|
//#region src/scroll-area/scroll-area.tsx
|
|
6205
|
-
const ScrollArea = React$
|
|
6229
|
+
const ScrollArea = React$7.forwardRef(({ className, children,...props }, ref) => /* @__PURE__ */ jsxs(ScrollAreaPrimitive.Root, {
|
|
6206
6230
|
ref,
|
|
6207
6231
|
className: cn("relative overflow-hidden", className),
|
|
6208
6232
|
...props,
|
|
@@ -6216,7 +6240,7 @@ const ScrollArea = React$6.forwardRef(({ className, children,...props }, ref) =>
|
|
|
6216
6240
|
]
|
|
6217
6241
|
}));
|
|
6218
6242
|
ScrollArea.displayName = ScrollAreaPrimitive.Root.displayName;
|
|
6219
|
-
const ScrollBar = React$
|
|
6243
|
+
const ScrollBar = React$7.forwardRef(({ className, orientation = "vertical",...props }, ref) => /* @__PURE__ */ jsx(ScrollAreaPrimitive.ScrollAreaScrollbar, {
|
|
6220
6244
|
ref,
|
|
6221
6245
|
orientation,
|
|
6222
6246
|
className: cn("flex touch-none select-none transition-colors", orientation === "vertical" && "h-full w-2.5 border-l border-l-transparent p-[1px]", orientation === "horizontal" && "h-2.5 flex-col border-t border-t-transparent p-[1px]", className),
|
|
@@ -6231,7 +6255,7 @@ const Sheet = SheetPrimitive.Root;
|
|
|
6231
6255
|
const SheetTrigger = SheetPrimitive.Trigger;
|
|
6232
6256
|
const SheetClose = SheetPrimitive.Close;
|
|
6233
6257
|
const SheetPortal = SheetPrimitive.Portal;
|
|
6234
|
-
const SheetOverlay = React$
|
|
6258
|
+
const SheetOverlay = React$6.forwardRef(({ className,...props }, ref) => /* @__PURE__ */ jsx(SheetPrimitive.Overlay, {
|
|
6235
6259
|
className: cn("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0", className),
|
|
6236
6260
|
...props,
|
|
6237
6261
|
ref
|
|
@@ -6246,7 +6270,7 @@ const sheetVariants = cva("fixed z-50 gap-4 bg-background p-6 shadow-lg transiti
|
|
|
6246
6270
|
} },
|
|
6247
6271
|
defaultVariants: { side: "right" }
|
|
6248
6272
|
});
|
|
6249
|
-
const SheetContent = React$
|
|
6273
|
+
const SheetContent = React$6.forwardRef(({ side = "right", className, children,...props }, ref) => /* @__PURE__ */ jsxs(SheetPortal, { children: [/* @__PURE__ */ jsx(SheetOverlay, {}), /* @__PURE__ */ jsxs(SheetPrimitive.Content, {
|
|
6250
6274
|
ref,
|
|
6251
6275
|
className: cn(sheetVariants({ side }), className),
|
|
6252
6276
|
...props,
|
|
@@ -6269,19 +6293,402 @@ const SheetFooter = ({ className,...props }) => /* @__PURE__ */ jsx("div", {
|
|
|
6269
6293
|
...props
|
|
6270
6294
|
});
|
|
6271
6295
|
SheetFooter.displayName = "SheetFooter";
|
|
6272
|
-
const SheetTitle = React$
|
|
6296
|
+
const SheetTitle = React$6.forwardRef(({ className,...props }, ref) => /* @__PURE__ */ jsx(SheetPrimitive.Title, {
|
|
6273
6297
|
ref,
|
|
6274
6298
|
className: cn("text-lg font-semibold text-foreground", className),
|
|
6275
6299
|
...props
|
|
6276
6300
|
}));
|
|
6277
6301
|
SheetTitle.displayName = SheetPrimitive.Title.displayName;
|
|
6278
|
-
const SheetDescription = React$
|
|
6302
|
+
const SheetDescription = React$6.forwardRef(({ className,...props }, ref) => /* @__PURE__ */ jsx(SheetPrimitive.Description, {
|
|
6279
6303
|
ref,
|
|
6280
6304
|
className: cn("text-sm text-muted-foreground", className),
|
|
6281
6305
|
...props
|
|
6282
6306
|
}));
|
|
6283
6307
|
SheetDescription.displayName = SheetPrimitive.Description.displayName;
|
|
6284
6308
|
|
|
6309
|
+
//#endregion
|
|
6310
|
+
//#region src/sidebar/sidebar.tsx
|
|
6311
|
+
const SIDEBAR_WIDTH = "16rem";
|
|
6312
|
+
const SIDEBAR_WIDTH_MOBILE = "18rem";
|
|
6313
|
+
const SIDEBAR_WIDTH_ICON = "3rem";
|
|
6314
|
+
const SIDEBAR_KEYBOARD_SHORTCUT = "b";
|
|
6315
|
+
const SidebarContext = React$5.createContext(null);
|
|
6316
|
+
function useSidebar() {
|
|
6317
|
+
const context = React$5.useContext(SidebarContext);
|
|
6318
|
+
if (!context) throw new Error("useSidebar must be used within a SidebarProvider.");
|
|
6319
|
+
return context;
|
|
6320
|
+
}
|
|
6321
|
+
function SidebarProvider({ defaultOpen = true, open: openProp, onOpenChange: setOpenProp, className, style, children,...props }) {
|
|
6322
|
+
const isMobile = useIsMobile();
|
|
6323
|
+
const [openMobile, setOpenMobile] = React$5.useState(false);
|
|
6324
|
+
const [_open, _setOpen] = React$5.useState(defaultOpen);
|
|
6325
|
+
const open = openProp ?? _open;
|
|
6326
|
+
const setOpen = React$5.useCallback((value) => {
|
|
6327
|
+
const openState = typeof value === "function" ? value(open) : value;
|
|
6328
|
+
if (setOpenProp) setOpenProp(openState);
|
|
6329
|
+
else _setOpen(openState);
|
|
6330
|
+
}, [setOpenProp]);
|
|
6331
|
+
const toggleSidebar = React$5.useCallback(() => {
|
|
6332
|
+
return isMobile ? setOpenMobile((open$1) => !open$1) : setOpen((open$1) => !open$1);
|
|
6333
|
+
}, [
|
|
6334
|
+
isMobile,
|
|
6335
|
+
setOpen,
|
|
6336
|
+
setOpenMobile
|
|
6337
|
+
]);
|
|
6338
|
+
React$5.useEffect(() => {
|
|
6339
|
+
const handleKeyDown = (event) => {
|
|
6340
|
+
if (event.key === SIDEBAR_KEYBOARD_SHORTCUT && (event.metaKey || event.ctrlKey)) {
|
|
6341
|
+
event.preventDefault();
|
|
6342
|
+
toggleSidebar();
|
|
6343
|
+
}
|
|
6344
|
+
};
|
|
6345
|
+
globalThis.addEventListener("keydown", handleKeyDown);
|
|
6346
|
+
return () => globalThis.removeEventListener("keydown", handleKeyDown);
|
|
6347
|
+
}, [toggleSidebar]);
|
|
6348
|
+
const state = open ? "expanded" : "collapsed";
|
|
6349
|
+
const contextValue = React$5.useMemo(() => ({
|
|
6350
|
+
state,
|
|
6351
|
+
open,
|
|
6352
|
+
setOpen,
|
|
6353
|
+
isMobile,
|
|
6354
|
+
openMobile,
|
|
6355
|
+
setOpenMobile,
|
|
6356
|
+
toggleSidebar
|
|
6357
|
+
}), [
|
|
6358
|
+
state,
|
|
6359
|
+
open,
|
|
6360
|
+
setOpen,
|
|
6361
|
+
isMobile,
|
|
6362
|
+
openMobile,
|
|
6363
|
+
setOpenMobile,
|
|
6364
|
+
toggleSidebar
|
|
6365
|
+
]);
|
|
6366
|
+
return /* @__PURE__ */ jsx(SidebarContext.Provider, {
|
|
6367
|
+
value: contextValue,
|
|
6368
|
+
children: /* @__PURE__ */ jsx(TooltipProvider, {
|
|
6369
|
+
delayDuration: 0,
|
|
6370
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
6371
|
+
"data-slot": "sidebar-wrapper",
|
|
6372
|
+
style: {
|
|
6373
|
+
"--sidebar-width": SIDEBAR_WIDTH,
|
|
6374
|
+
"--sidebar-width-icon": SIDEBAR_WIDTH_ICON,
|
|
6375
|
+
...style
|
|
6376
|
+
},
|
|
6377
|
+
className: cn("group/sidebar-wrapper has-data-[variant=inset]:bg-sidebar flex min-h-svh w-full", className),
|
|
6378
|
+
...props,
|
|
6379
|
+
children
|
|
6380
|
+
})
|
|
6381
|
+
})
|
|
6382
|
+
});
|
|
6383
|
+
}
|
|
6384
|
+
function Sidebar({ side = "left", variant = "sidebar", collapsible = "offcanvas", className, children,...props }) {
|
|
6385
|
+
const { isMobile, state, openMobile, setOpenMobile } = useSidebar();
|
|
6386
|
+
if (collapsible === "none") return /* @__PURE__ */ jsx("div", {
|
|
6387
|
+
"data-slot": "sidebar",
|
|
6388
|
+
className: cn("bg-sidebar text-sidebar-foreground flex h-full w-(--sidebar-width) flex-col", className),
|
|
6389
|
+
...props,
|
|
6390
|
+
children
|
|
6391
|
+
});
|
|
6392
|
+
if (isMobile) return /* @__PURE__ */ jsx(Sheet, {
|
|
6393
|
+
open: openMobile,
|
|
6394
|
+
onOpenChange: setOpenMobile,
|
|
6395
|
+
...props,
|
|
6396
|
+
children: /* @__PURE__ */ jsxs(SheetContent, {
|
|
6397
|
+
"data-sidebar": "sidebar",
|
|
6398
|
+
"data-slot": "sidebar",
|
|
6399
|
+
"data-mobile": "true",
|
|
6400
|
+
className: "bg-sidebar text-sidebar-foreground w-(--sidebar-width) p-0 [&>button]:hidden",
|
|
6401
|
+
style: { "--sidebar-width": SIDEBAR_WIDTH_MOBILE },
|
|
6402
|
+
side,
|
|
6403
|
+
children: [/* @__PURE__ */ jsxs(SheetHeader, {
|
|
6404
|
+
className: "sr-only",
|
|
6405
|
+
children: [/* @__PURE__ */ jsx(SheetTitle, { children: "Sidebar" }), /* @__PURE__ */ jsx(SheetDescription, { children: "Displays the mobile sidebar." })]
|
|
6406
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
6407
|
+
className: "flex h-full w-full flex-col",
|
|
6408
|
+
children
|
|
6409
|
+
})]
|
|
6410
|
+
})
|
|
6411
|
+
});
|
|
6412
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
6413
|
+
className: "group peer text-sidebar-foreground hidden md:block",
|
|
6414
|
+
"data-state": state,
|
|
6415
|
+
"data-collapsible": state === "collapsed" ? collapsible : "",
|
|
6416
|
+
"data-variant": variant,
|
|
6417
|
+
"data-side": side,
|
|
6418
|
+
"data-slot": "sidebar",
|
|
6419
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
6420
|
+
"data-slot": "sidebar-gap",
|
|
6421
|
+
className: cn("relative w-(--sidebar-width) bg-transparent transition-[width] duration-200 ease-linear", "group-data-[collapsible=offcanvas]:w-0", "group-data-[side=right]:rotate-180", variant === "floating" || variant === "inset" ? "group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4)))]" : "group-data-[collapsible=icon]:w-(--sidebar-width-icon)")
|
|
6422
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
6423
|
+
"data-slot": "sidebar-container",
|
|
6424
|
+
className: cn(
|
|
6425
|
+
"fixed inset-y-0 z-10 hidden h-svh w-(--sidebar-width) transition-[left,right,width] duration-200 ease-linear md:flex",
|
|
6426
|
+
side === "left" ? "left-0 group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)]" : "right-0 group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)]",
|
|
6427
|
+
// Adjust the padding for floating and inset variants.
|
|
6428
|
+
variant === "floating" || variant === "inset" ? "p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4))+2px)]" : "group-data-[collapsible=icon]:w-(--sidebar-width-icon) group-data-[side=left]:border-r group-data-[side=right]:border-l",
|
|
6429
|
+
className
|
|
6430
|
+
),
|
|
6431
|
+
...props,
|
|
6432
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
6433
|
+
"data-sidebar": "sidebar",
|
|
6434
|
+
"data-slot": "sidebar-inner",
|
|
6435
|
+
className: "bg-sidebar group-data-[variant=floating]:border-sidebar-border flex h-full w-full flex-col group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:border group-data-[variant=floating]:shadow-sm",
|
|
6436
|
+
children
|
|
6437
|
+
})
|
|
6438
|
+
})]
|
|
6439
|
+
});
|
|
6440
|
+
}
|
|
6441
|
+
function SidebarTrigger({ className, onClick,...props }) {
|
|
6442
|
+
const { toggleSidebar } = useSidebar();
|
|
6443
|
+
return /* @__PURE__ */ jsxs(Button, {
|
|
6444
|
+
"data-sidebar": "trigger",
|
|
6445
|
+
"data-slot": "sidebar-trigger",
|
|
6446
|
+
variant: "ghost",
|
|
6447
|
+
size: "icon",
|
|
6448
|
+
className: cn("size-7", className),
|
|
6449
|
+
onClick: (event) => {
|
|
6450
|
+
onClick?.(event);
|
|
6451
|
+
toggleSidebar();
|
|
6452
|
+
},
|
|
6453
|
+
...props,
|
|
6454
|
+
children: [/* @__PURE__ */ jsx(PanelLeftIcon, {}), /* @__PURE__ */ jsx("span", {
|
|
6455
|
+
className: "sr-only",
|
|
6456
|
+
children: "Toggle Sidebar"
|
|
6457
|
+
})]
|
|
6458
|
+
});
|
|
6459
|
+
}
|
|
6460
|
+
function SidebarRail({ className,...props }) {
|
|
6461
|
+
const { toggleSidebar } = useSidebar();
|
|
6462
|
+
return /* @__PURE__ */ jsx("button", {
|
|
6463
|
+
"data-sidebar": "rail",
|
|
6464
|
+
"data-slot": "sidebar-rail",
|
|
6465
|
+
"aria-label": "Toggle Sidebar",
|
|
6466
|
+
tabIndex: -1,
|
|
6467
|
+
onClick: toggleSidebar,
|
|
6468
|
+
title: "Toggle Sidebar",
|
|
6469
|
+
className: cn("hover:after:bg-sidebar-border absolute inset-y-0 z-20 hidden w-4 -translate-x-1/2 transition-all ease-linear group-data-[side=left]:-right-4 group-data-[side=right]:left-0 after:absolute after:inset-y-0 after:left-1/2 after:w-[2px] sm:flex", "in-data-[side=left]:cursor-w-resize in-data-[side=right]:cursor-e-resize", "[[data-side=left][data-state=collapsed]_&]:cursor-e-resize [[data-side=right][data-state=collapsed]_&]:cursor-w-resize", "hover:group-data-[collapsible=offcanvas]:bg-sidebar group-data-[collapsible=offcanvas]:translate-x-0 group-data-[collapsible=offcanvas]:after:left-full", "[[data-side=left][data-collapsible=offcanvas]_&]:-right-2", "[[data-side=right][data-collapsible=offcanvas]_&]:-left-2", className),
|
|
6470
|
+
...props
|
|
6471
|
+
});
|
|
6472
|
+
}
|
|
6473
|
+
function SidebarInset({ className,...props }) {
|
|
6474
|
+
return /* @__PURE__ */ jsx("main", {
|
|
6475
|
+
"data-slot": "sidebar-inset",
|
|
6476
|
+
className: cn("bg-background relative flex w-full flex-1 flex-col", "md:peer-data-[variant=inset]:m-2 md:peer-data-[variant=inset]:ml-0 md:peer-data-[variant=inset]:rounded-xl md:peer-data-[variant=inset]:shadow-sm md:peer-data-[variant=inset]:peer-data-[state=collapsed]:ml-2", className),
|
|
6477
|
+
...props
|
|
6478
|
+
});
|
|
6479
|
+
}
|
|
6480
|
+
function SidebarInput({ className,...props }) {
|
|
6481
|
+
return /* @__PURE__ */ jsx(Input, {
|
|
6482
|
+
"data-slot": "sidebar-input",
|
|
6483
|
+
"data-sidebar": "input",
|
|
6484
|
+
className: cn("bg-background h-8 w-full shadow-none", className),
|
|
6485
|
+
...props
|
|
6486
|
+
});
|
|
6487
|
+
}
|
|
6488
|
+
function SidebarHeader({ className,...props }) {
|
|
6489
|
+
return /* @__PURE__ */ jsx("div", {
|
|
6490
|
+
"data-slot": "sidebar-header",
|
|
6491
|
+
"data-sidebar": "header",
|
|
6492
|
+
className: cn("flex flex-col gap-2 p-2", className),
|
|
6493
|
+
...props
|
|
6494
|
+
});
|
|
6495
|
+
}
|
|
6496
|
+
function SidebarFooter({ className,...props }) {
|
|
6497
|
+
return /* @__PURE__ */ jsx("div", {
|
|
6498
|
+
"data-slot": "sidebar-footer",
|
|
6499
|
+
"data-sidebar": "footer",
|
|
6500
|
+
className: cn("flex flex-col gap-2 p-2", className),
|
|
6501
|
+
...props
|
|
6502
|
+
});
|
|
6503
|
+
}
|
|
6504
|
+
function SidebarSeparator({ className,...props }) {
|
|
6505
|
+
return /* @__PURE__ */ jsx(Separator, {
|
|
6506
|
+
"data-slot": "sidebar-separator",
|
|
6507
|
+
"data-sidebar": "separator",
|
|
6508
|
+
className: cn("bg-sidebar-border mx-2 w-auto", className),
|
|
6509
|
+
...props
|
|
6510
|
+
});
|
|
6511
|
+
}
|
|
6512
|
+
function SidebarContent({ className,...props }) {
|
|
6513
|
+
return /* @__PURE__ */ jsx("div", {
|
|
6514
|
+
"data-slot": "sidebar-content",
|
|
6515
|
+
"data-sidebar": "content",
|
|
6516
|
+
className: cn("flex min-h-0 flex-1 flex-col gap-2 overflow-auto group-data-[collapsible=icon]:overflow-hidden", className),
|
|
6517
|
+
...props
|
|
6518
|
+
});
|
|
6519
|
+
}
|
|
6520
|
+
function SidebarGroup({ className,...props }) {
|
|
6521
|
+
return /* @__PURE__ */ jsx("div", {
|
|
6522
|
+
"data-slot": "sidebar-group",
|
|
6523
|
+
"data-sidebar": "group",
|
|
6524
|
+
className: cn("relative flex w-full min-w-0 flex-col p-2", className),
|
|
6525
|
+
...props
|
|
6526
|
+
});
|
|
6527
|
+
}
|
|
6528
|
+
function SidebarGroupLabel({ className, asChild = false,...props }) {
|
|
6529
|
+
const Comp = asChild ? Slot : "div";
|
|
6530
|
+
return /* @__PURE__ */ jsx(Comp, {
|
|
6531
|
+
"data-slot": "sidebar-group-label",
|
|
6532
|
+
"data-sidebar": "group-label",
|
|
6533
|
+
className: cn("text-sidebar-foreground/70 ring-sidebar-ring flex h-8 shrink-0 items-center rounded-md px-2 text-xs font-medium outline-hidden transition-[margin,opacity] duration-200 ease-linear focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0", "group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0", className),
|
|
6534
|
+
...props
|
|
6535
|
+
});
|
|
6536
|
+
}
|
|
6537
|
+
function SidebarGroupAction({ className, asChild = false,...props }) {
|
|
6538
|
+
const Comp = asChild ? Slot : "button";
|
|
6539
|
+
return /* @__PURE__ */ jsx(Comp, {
|
|
6540
|
+
"data-slot": "sidebar-group-action",
|
|
6541
|
+
"data-sidebar": "group-action",
|
|
6542
|
+
className: cn(
|
|
6543
|
+
"text-sidebar-foreground ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground absolute top-3.5 right-3 flex aspect-square w-5 items-center justify-center rounded-md p-0 outline-hidden transition-transform focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0",
|
|
6544
|
+
// Increases the hit area of the button on mobile.
|
|
6545
|
+
"after:absolute after:-inset-2 md:after:hidden",
|
|
6546
|
+
"group-data-[collapsible=icon]:hidden",
|
|
6547
|
+
className
|
|
6548
|
+
),
|
|
6549
|
+
...props
|
|
6550
|
+
});
|
|
6551
|
+
}
|
|
6552
|
+
function SidebarGroupContent({ className,...props }) {
|
|
6553
|
+
return /* @__PURE__ */ jsx("div", {
|
|
6554
|
+
"data-slot": "sidebar-group-content",
|
|
6555
|
+
"data-sidebar": "group-content",
|
|
6556
|
+
className: cn("w-full text-sm", className),
|
|
6557
|
+
...props
|
|
6558
|
+
});
|
|
6559
|
+
}
|
|
6560
|
+
function SidebarMenu({ className,...props }) {
|
|
6561
|
+
return /* @__PURE__ */ jsx("ul", {
|
|
6562
|
+
"data-slot": "sidebar-menu",
|
|
6563
|
+
"data-sidebar": "menu",
|
|
6564
|
+
className: cn("flex w-full min-w-0 flex-col gap-1", className),
|
|
6565
|
+
...props
|
|
6566
|
+
});
|
|
6567
|
+
}
|
|
6568
|
+
function SidebarMenuItem({ className,...props }) {
|
|
6569
|
+
return /* @__PURE__ */ jsx("li", {
|
|
6570
|
+
"data-slot": "sidebar-menu-item",
|
|
6571
|
+
"data-sidebar": "menu-item",
|
|
6572
|
+
className: cn("group/menu-item relative", className),
|
|
6573
|
+
...props
|
|
6574
|
+
});
|
|
6575
|
+
}
|
|
6576
|
+
const sidebarMenuButtonVariants = cva("peer/menu-button flex w-full items-center gap-2 overflow-hidden rounded-md p-2 text-left text-sm outline-hidden ring-sidebar-ring transition-[width,height,padding] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 group-has-data-[sidebar=menu-action]/menu-item:pr-8 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-[active=true]:bg-sidebar-accent data-[active=true]:font-medium data-[active=true]:text-sidebar-accent-foreground data-[state=open]:hover:bg-sidebar-accent data-[state=open]:hover:text-sidebar-accent-foreground group-data-[collapsible=icon]:size-8! group-data-[collapsible=icon]:p-2! [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0", {
|
|
6577
|
+
variants: {
|
|
6578
|
+
variant: {
|
|
6579
|
+
default: "hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",
|
|
6580
|
+
outline: "bg-background shadow-[0_0_0_1px_hsl(var(--sidebar-border))] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground hover:shadow-[0_0_0_1px_hsl(var(--sidebar-accent))]"
|
|
6581
|
+
},
|
|
6582
|
+
size: {
|
|
6583
|
+
default: "h-8 text-sm",
|
|
6584
|
+
sm: "h-7 text-xs",
|
|
6585
|
+
lg: "h-12 text-sm group-data-[collapsible=icon]:p-0!"
|
|
6586
|
+
}
|
|
6587
|
+
},
|
|
6588
|
+
defaultVariants: {
|
|
6589
|
+
variant: "default",
|
|
6590
|
+
size: "default"
|
|
6591
|
+
}
|
|
6592
|
+
});
|
|
6593
|
+
function SidebarMenuButton({ asChild = false, isActive = false, variant = "default", size = "default", tooltip, className,...props }) {
|
|
6594
|
+
const Comp = asChild ? Slot : "button";
|
|
6595
|
+
const { isMobile, state } = useSidebar();
|
|
6596
|
+
const button = /* @__PURE__ */ jsx(Comp, {
|
|
6597
|
+
"data-slot": "sidebar-menu-button",
|
|
6598
|
+
"data-sidebar": "menu-button",
|
|
6599
|
+
"data-size": size,
|
|
6600
|
+
"data-active": isActive,
|
|
6601
|
+
className: cn(sidebarMenuButtonVariants({
|
|
6602
|
+
variant,
|
|
6603
|
+
size
|
|
6604
|
+
}), className),
|
|
6605
|
+
...props
|
|
6606
|
+
});
|
|
6607
|
+
if (!tooltip) return button;
|
|
6608
|
+
if (typeof tooltip === "string") tooltip = { children: tooltip };
|
|
6609
|
+
return /* @__PURE__ */ jsxs(Tooltip, { children: [/* @__PURE__ */ jsx(TooltipTrigger, {
|
|
6610
|
+
asChild: true,
|
|
6611
|
+
children: button
|
|
6612
|
+
}), /* @__PURE__ */ jsx(TooltipContent, {
|
|
6613
|
+
side: "right",
|
|
6614
|
+
align: "center",
|
|
6615
|
+
hidden: state !== "collapsed" || isMobile,
|
|
6616
|
+
...tooltip
|
|
6617
|
+
})] });
|
|
6618
|
+
}
|
|
6619
|
+
function SidebarMenuAction({ className, asChild = false, showOnHover = false,...props }) {
|
|
6620
|
+
const Comp = asChild ? Slot : "button";
|
|
6621
|
+
return /* @__PURE__ */ jsx(Comp, {
|
|
6622
|
+
"data-slot": "sidebar-menu-action",
|
|
6623
|
+
"data-sidebar": "menu-action",
|
|
6624
|
+
className: cn(
|
|
6625
|
+
"text-sidebar-foreground ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground peer-hover/menu-button:text-sidebar-accent-foreground absolute top-1.5 right-1 flex aspect-square w-5 items-center justify-center rounded-md p-0 outline-hidden transition-transform focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0",
|
|
6626
|
+
// Increases the hit area of the button on mobile.
|
|
6627
|
+
"after:absolute after:-inset-2 md:after:hidden",
|
|
6628
|
+
"peer-data-[size=sm]/menu-button:top-1",
|
|
6629
|
+
"peer-data-[size=default]/menu-button:top-1.5",
|
|
6630
|
+
"peer-data-[size=lg]/menu-button:top-2.5",
|
|
6631
|
+
"group-data-[collapsible=icon]:hidden",
|
|
6632
|
+
showOnHover && "peer-data-[active=true]/menu-button:text-sidebar-accent-foreground group-focus-within/menu-item:opacity-100 group-hover/menu-item:opacity-100 data-[state=open]:opacity-100 md:opacity-0",
|
|
6633
|
+
className
|
|
6634
|
+
),
|
|
6635
|
+
...props
|
|
6636
|
+
});
|
|
6637
|
+
}
|
|
6638
|
+
function SidebarMenuBadge({ className,...props }) {
|
|
6639
|
+
return /* @__PURE__ */ jsx("div", {
|
|
6640
|
+
"data-slot": "sidebar-menu-badge",
|
|
6641
|
+
"data-sidebar": "menu-badge",
|
|
6642
|
+
className: cn("text-sidebar-foreground pointer-events-none absolute right-1 flex h-5 min-w-5 items-center justify-center rounded-md px-1 text-xs font-medium tabular-nums select-none", "peer-hover/menu-button:text-sidebar-accent-foreground peer-data-[active=true]/menu-button:text-sidebar-accent-foreground", "peer-data-[size=sm]/menu-button:top-1", "peer-data-[size=default]/menu-button:top-1.5", "peer-data-[size=lg]/menu-button:top-2.5", "group-data-[collapsible=icon]:hidden", className),
|
|
6643
|
+
...props
|
|
6644
|
+
});
|
|
6645
|
+
}
|
|
6646
|
+
function SidebarMenuSkeleton({ className, showIcon = false, widths = [50],...props }) {
|
|
6647
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
6648
|
+
"data-slot": "sidebar-menu-skeleton",
|
|
6649
|
+
"data-sidebar": "menu-skeleton",
|
|
6650
|
+
className: cn("flex h-8 items-center gap-2 rounded-md px-2", className),
|
|
6651
|
+
...props,
|
|
6652
|
+
children: [showIcon && /* @__PURE__ */ jsx(Skeleton, {
|
|
6653
|
+
className: "size-4 rounded-md",
|
|
6654
|
+
"data-sidebar": "menu-skeleton-icon"
|
|
6655
|
+
}), widths.map((width) => {
|
|
6656
|
+
return /* @__PURE__ */ jsx(Skeleton, {
|
|
6657
|
+
className: "h-4 max-w-(--skeleton-width) flex-1",
|
|
6658
|
+
"data-sidebar": "menu-skeleton-text",
|
|
6659
|
+
style: { "--skeleton-width": width }
|
|
6660
|
+
});
|
|
6661
|
+
})]
|
|
6662
|
+
});
|
|
6663
|
+
}
|
|
6664
|
+
function SidebarMenuSub({ className,...props }) {
|
|
6665
|
+
return /* @__PURE__ */ jsx("ul", {
|
|
6666
|
+
"data-slot": "sidebar-menu-sub",
|
|
6667
|
+
"data-sidebar": "menu-sub",
|
|
6668
|
+
className: cn("border-sidebar-border mx-3.5 flex min-w-0 translate-x-px flex-col gap-1 border-l px-2.5 py-0.5", "group-data-[collapsible=icon]:hidden", className),
|
|
6669
|
+
...props
|
|
6670
|
+
});
|
|
6671
|
+
}
|
|
6672
|
+
function SidebarMenuSubItem({ className,...props }) {
|
|
6673
|
+
return /* @__PURE__ */ jsx("li", {
|
|
6674
|
+
"data-slot": "sidebar-menu-sub-item",
|
|
6675
|
+
"data-sidebar": "menu-sub-item",
|
|
6676
|
+
className: cn("group/menu-sub-item relative", className),
|
|
6677
|
+
...props
|
|
6678
|
+
});
|
|
6679
|
+
}
|
|
6680
|
+
function SidebarMenuSubButton({ asChild = false, size = "md", isActive = false, className,...props }) {
|
|
6681
|
+
const Comp = asChild ? Slot : "a";
|
|
6682
|
+
return /* @__PURE__ */ jsx(Comp, {
|
|
6683
|
+
"data-slot": "sidebar-menu-sub-button",
|
|
6684
|
+
"data-sidebar": "menu-sub-button",
|
|
6685
|
+
"data-size": size,
|
|
6686
|
+
"data-active": isActive,
|
|
6687
|
+
className: cn("text-sidebar-foreground ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground active:bg-sidebar-accent active:text-sidebar-accent-foreground [&>svg]:text-sidebar-accent-foreground flex h-7 min-w-0 -translate-x-px items-center gap-2 overflow-hidden rounded-md px-2 outline-hidden focus-visible:ring-2 disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0", "data-[active=true]:bg-sidebar-accent data-[active=true]:text-sidebar-accent-foreground", size === "sm" && "text-xs", size === "md" && "text-sm", "group-data-[collapsible=icon]:hidden", className),
|
|
6688
|
+
...props
|
|
6689
|
+
});
|
|
6690
|
+
}
|
|
6691
|
+
|
|
6285
6692
|
//#endregion
|
|
6286
6693
|
//#region src/skeleton/skeleton.tsx
|
|
6287
6694
|
function Skeleton({ className,...props }) {
|
|
@@ -6479,5 +6886,5 @@ const ToggleGroupItem = React$1.forwardRef(({ className, children, variant, size
|
|
|
6479
6886
|
ToggleGroupItem.displayName = ToggleGroupPrimitive.Item.displayName;
|
|
6480
6887
|
|
|
6481
6888
|
//#endregion
|
|
6482
|
-
export { Accordion, AccordionContent, AccordionItem, AccordionTrigger, Alert, AlertDescription, AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger, AlertTitle, Avatar, AvatarFallback, AvatarImage, Badge, Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator, Button, Calendar, CalendarDayButton, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Carousel, CarouselContent, CarouselItem, CarouselNext, CarouselPrevious, Checkbox, Collapse, CollapseContent, CollapseTrigger, ComboboxDemo, Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandPalette, CommandPaletteDialog, CommandPaletteEmpty, CommandPaletteGroup, CommandPaletteInput, CommandPaletteItem, CommandPaletteList, CommandPaletteSeparator, CommandPaletteShortcut, CommandSeparator, CommandShortcut, ContentFrame, ContextMenu, ContextMenuCheckboxItem, ContextMenuContent, ContextMenuGroup, ContextMenuItem, ContextMenuLabel, ContextMenuPortal, ContextMenuRadioGroup, ContextMenuRadioItem, ContextMenuSeparator, ContextMenuShortcut, ContextMenuSub, ContextMenuSubContent, ContextMenuSubTrigger, ContextMenuTrigger, DataGrid, DataGridCell, DataGridCellWrapper, DataGridColumnHeader, DataGridContextMenu, DataGridRow, DataGridSearch, DataGridViewMenu, DatePickerDemo, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, Drawer, DrawerClose, DrawerContent, DrawerDescription, DrawerFooter, DrawerHeader, DrawerOverlay, DrawerPortal, DrawerTitle, DrawerTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, Field, FieldContent, FieldDescription, FieldError, FieldGroup, FieldLabel, FieldLegend, FieldSeparator, FieldSet, FieldTitle, HeaderComponents, HoverCard, HoverCardContent, HoverCardTrigger, Input, Label, Loader, MarkValueRenderer, Menubar, MenubarCheckboxItem, MenubarContent, MenubarGroup, MenubarItem, MenubarLabel, MenubarMenu, MenubarPortal, MenubarRadioGroup, MenubarRadioItem, MenubarSeparator, MenubarShortcut, MenubarSub, MenubarSubContent, MenubarSubTrigger, MenubarTrigger, Modal, NavigationMenu, NavigationMenuContent, NavigationMenuIndicator, NavigationMenuItem, NavigationMenuLink, NavigationMenuList, NavigationMenuTrigger, NavigationMenuViewport, Pagination, PaginationContent, PaginationEllipsis, PaginationItem, PaginationLink, PaginationNext, PaginationPrevious, Popover, PopoverAnchor, PopoverContent, PopoverTrigger, Progress, RadioGroup, RadioGroupItem, ResizableHandle, ResizablePanel, ResizablePanelGroup, ScrollArea, ScrollBar, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetOverlay, SheetPortal, SheetTitle, SheetTrigger, Skeleton, Slider, Spinner, Switch, Tabs, TabsContent, TabsList, TabsTrigger, Textarea, Toaster, Toggle, ToggleGroup, ToggleGroupItem, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, badgeVariants, buttonVariants, checkboxVariants, cn, commandInputVariants, getCellKey, getCommonPinningStyles, getLineCount, getRowHeightValue, knobVariants, navigationMenuTriggerStyle, parseCellKey, sliderVariants, toast, toggleVariants, useDataGrid };
|
|
6889
|
+
export { Accordion, AccordionContent, AccordionItem, AccordionTrigger, Alert, AlertDescription, AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger, AlertTitle, Avatar, AvatarFallback, AvatarImage, Badge, Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator, Button, Calendar, CalendarDayButton, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Carousel, CarouselContent, CarouselItem, CarouselNext, CarouselPrevious, Checkbox, CheckboxCell, Collapse, CollapseContent, CollapseTrigger, ComboboxDemo, Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandPalette, CommandPaletteDialog, CommandPaletteEmpty, CommandPaletteGroup, CommandPaletteInput, CommandPaletteItem, CommandPaletteList, CommandPaletteSeparator, CommandPaletteShortcut, CommandSeparator, CommandShortcut, ContentFrame, ContextMenu, ContextMenuCheckboxItem, ContextMenuContent, ContextMenuGroup, ContextMenuItem, ContextMenuLabel, ContextMenuPortal, ContextMenuRadioGroup, ContextMenuRadioItem, ContextMenuSeparator, ContextMenuShortcut, ContextMenuSub, ContextMenuSubContent, ContextMenuSubTrigger, ContextMenuTrigger, DataGrid, DataGridCell, DataGridCellWrapper, DataGridColumnHeader, DataGridContextMenu, DataGridRow, DataGridSearch, DataGridViewMenu, DateCell, DatePickerDemo, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, Drawer, DrawerClose, DrawerContent, DrawerDescription, DrawerFooter, DrawerHeader, DrawerOverlay, DrawerPortal, DrawerTitle, DrawerTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, Field, FieldContent, FieldDescription, FieldError, FieldGroup, FieldLabel, FieldLegend, FieldSeparator, FieldSet, FieldTitle, GanttCell, GanttTimeline, GanttTimerangePicker, HeaderComponents, HoverCard, HoverCardContent, HoverCardTrigger, Input, Label, Loader, LongTextCell, MarkValueRenderer, Menubar, MenubarCheckboxItem, MenubarContent, MenubarGroup, MenubarItem, MenubarLabel, MenubarMenu, MenubarPortal, MenubarRadioGroup, MenubarRadioItem, MenubarSeparator, MenubarShortcut, MenubarSub, MenubarSubContent, MenubarSubTrigger, MenubarTrigger, Modal, MultiSelectCell, NavigationMenu, NavigationMenuContent, NavigationMenuIndicator, NavigationMenuItem, NavigationMenuLink, NavigationMenuList, NavigationMenuTrigger, NavigationMenuViewport, NumberCell, Pagination, PaginationContent, PaginationEllipsis, PaginationItem, PaginationLink, PaginationNext, PaginationPrevious, Popover, PopoverAnchor, PopoverContent, PopoverTrigger, Progress, RadioGroup, RadioGroupItem, ReactNodeCell, ResizableHandle, ResizablePanel, ResizablePanelGroup, ScrollArea, ScrollBar, Select, SelectCell, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetOverlay, SheetPortal, SheetTitle, SheetTrigger, ShortTextCell, Sidebar, SidebarContent, SidebarFooter, SidebarGroup, SidebarGroupAction, SidebarGroupContent, SidebarGroupLabel, SidebarHeader, SidebarInput, SidebarInset, SidebarMenu, SidebarMenuAction, SidebarMenuBadge, SidebarMenuButton, SidebarMenuItem, SidebarMenuSkeleton, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem, SidebarProvider, SidebarRail, SidebarSeparator, SidebarTrigger, Skeleton, Slider, Spinner, Switch, Tabs, TabsContent, TabsList, TabsTrigger, Textarea, Toaster, Toggle, ToggleGroup, ToggleGroupItem, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, badgeVariants, buttonVariants, checkboxVariants, cn, commandInputVariants, getCellKey, getCommonPinningStyles, getLineCount, getRowHeightValue, isoToLocalDate, knobVariants, navigationMenuTriggerStyle, parseCellKey, sliderVariants, toast, toggleVariants, useCallbackRef, useDataGrid, useDebouncedCallback, useIsMobile, useSidebar };
|
|
6483
6890
|
//# sourceMappingURL=index.js.map
|