@pos-360/horizon 0.15.0 → 0.17.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-6YUIM6WB.mjs → chunk-2PPZNXOQ.mjs} +268 -167
- package/dist/chunk-2PPZNXOQ.mjs.map +1 -0
- package/dist/{chunk-A4QVL4JL.mjs → chunk-DWMWKMZL.mjs} +29 -33
- package/dist/chunk-DWMWKMZL.mjs.map +1 -0
- package/dist/{chunk-YO72COII.js → chunk-ED6X5VKQ.js} +71 -7
- package/dist/chunk-ED6X5VKQ.js.map +1 -0
- package/dist/{chunk-AJP6WOSY.js → chunk-M3MFFZNO.js} +345 -244
- package/dist/chunk-M3MFFZNO.js.map +1 -0
- package/dist/{chunk-6CAMHXUV.js → chunk-YYVNGWHZ.js} +104 -108
- package/dist/chunk-YYVNGWHZ.js.map +1 -0
- package/dist/{chunk-E3UN74IA.mjs → chunk-ZI4BTIPU.mjs} +71 -9
- package/dist/chunk-ZI4BTIPU.mjs.map +1 -0
- package/dist/enhanced.d.mts +3 -0
- package/dist/enhanced.d.ts +3 -0
- package/dist/enhanced.js +28 -28
- package/dist/enhanced.mjs +2 -2
- package/dist/index.d.mts +3 -9
- package/dist/index.d.ts +3 -9
- package/dist/index.js +145 -141
- package/dist/index.mjs +3 -3
- package/dist/primitives.d.mts +38 -20
- package/dist/primitives.d.ts +38 -20
- package/dist/primitives.js +117 -113
- package/dist/primitives.mjs +2 -2
- package/dist/tooltip-wUBttbwG.d.mts +25 -0
- package/dist/tooltip-wUBttbwG.d.ts +25 -0
- package/package.json +1 -1
- package/dist/chunk-6CAMHXUV.js.map +0 -1
- package/dist/chunk-6YUIM6WB.mjs.map +0 -1
- package/dist/chunk-A4QVL4JL.mjs.map +0 -1
- package/dist/chunk-AJP6WOSY.js.map +0 -1
- package/dist/chunk-E3UN74IA.mjs.map +0 -1
- package/dist/chunk-YO72COII.js.map +0 -1
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { cn, Label } from './chunk-
|
|
2
|
-
import * as
|
|
1
|
+
import { cn, Label, Tooltip } from './chunk-ZI4BTIPU.mjs';
|
|
2
|
+
import * as React10 from 'react';
|
|
3
3
|
import { useState, useEffect, useCallback } from 'react';
|
|
4
4
|
import { Slot } from '@radix-ui/react-slot';
|
|
5
5
|
import { cva } from 'class-variance-authority';
|
|
6
6
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
7
7
|
import * as CheckboxPrimitive from '@radix-ui/react-checkbox';
|
|
8
|
-
import { Check, X, ChevronRight, Circle, ChevronDown, ChevronUp, Search, SlidersHorizontal } from 'lucide-react';
|
|
8
|
+
import { Check, X, ChevronRight, Circle, ChevronDown, ChevronUp, Search, PenLine, SlidersHorizontal } from 'lucide-react';
|
|
9
9
|
import * as DialogPrimitive from '@radix-ui/react-dialog';
|
|
10
10
|
import * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';
|
|
11
11
|
import * as PopoverPrimitive from '@radix-ui/react-popover';
|
|
@@ -41,7 +41,7 @@ var buttonVariants = cva(
|
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
43
|
);
|
|
44
|
-
var Button =
|
|
44
|
+
var Button = React10.forwardRef(
|
|
45
45
|
({
|
|
46
46
|
className,
|
|
47
47
|
variant,
|
|
@@ -81,7 +81,7 @@ var Button = React9.forwardRef(
|
|
|
81
81
|
}
|
|
82
82
|
);
|
|
83
83
|
Button.displayName = "Button";
|
|
84
|
-
var Card =
|
|
84
|
+
var Card = React10.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
85
85
|
"div",
|
|
86
86
|
{
|
|
87
87
|
ref,
|
|
@@ -93,7 +93,7 @@ var Card = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ j
|
|
|
93
93
|
}
|
|
94
94
|
));
|
|
95
95
|
Card.displayName = "Card";
|
|
96
|
-
var CardHeader =
|
|
96
|
+
var CardHeader = React10.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
97
97
|
"div",
|
|
98
98
|
{
|
|
99
99
|
ref,
|
|
@@ -102,7 +102,7 @@ var CardHeader = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE_
|
|
|
102
102
|
}
|
|
103
103
|
));
|
|
104
104
|
CardHeader.displayName = "CardHeader";
|
|
105
|
-
var CardTitle =
|
|
105
|
+
var CardTitle = React10.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
106
106
|
"div",
|
|
107
107
|
{
|
|
108
108
|
ref,
|
|
@@ -111,7 +111,7 @@ var CardTitle = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__
|
|
|
111
111
|
}
|
|
112
112
|
));
|
|
113
113
|
CardTitle.displayName = "CardTitle";
|
|
114
|
-
var CardDescription =
|
|
114
|
+
var CardDescription = React10.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
115
115
|
"div",
|
|
116
116
|
{
|
|
117
117
|
ref,
|
|
@@ -120,7 +120,7 @@ var CardDescription = React9.forwardRef(({ className, ...props }, ref) => /* @__
|
|
|
120
120
|
}
|
|
121
121
|
));
|
|
122
122
|
CardDescription.displayName = "CardDescription";
|
|
123
|
-
var CardContent =
|
|
123
|
+
var CardContent = React10.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
124
124
|
"div",
|
|
125
125
|
{
|
|
126
126
|
ref,
|
|
@@ -129,7 +129,7 @@ var CardContent = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE
|
|
|
129
129
|
}
|
|
130
130
|
));
|
|
131
131
|
CardContent.displayName = "CardContent";
|
|
132
|
-
var CardFooter =
|
|
132
|
+
var CardFooter = React10.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
133
133
|
"div",
|
|
134
134
|
{
|
|
135
135
|
ref,
|
|
@@ -138,7 +138,7 @@ var CardFooter = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE_
|
|
|
138
138
|
}
|
|
139
139
|
));
|
|
140
140
|
CardFooter.displayName = "CardFooter";
|
|
141
|
-
var Checkbox =
|
|
141
|
+
var Checkbox = React10.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
142
142
|
CheckboxPrimitive.Root,
|
|
143
143
|
{
|
|
144
144
|
ref,
|
|
@@ -161,7 +161,7 @@ var Dialog = DialogPrimitive.Root;
|
|
|
161
161
|
var DialogTrigger = DialogPrimitive.Trigger;
|
|
162
162
|
var DialogPortal = DialogPrimitive.Portal;
|
|
163
163
|
var DialogClose = DialogPrimitive.Close;
|
|
164
|
-
var DialogOverlay =
|
|
164
|
+
var DialogOverlay = React10.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
165
165
|
DialogPrimitive.Overlay,
|
|
166
166
|
{
|
|
167
167
|
ref,
|
|
@@ -173,7 +173,7 @@ var DialogOverlay = React9.forwardRef(({ className, ...props }, ref) => /* @__PU
|
|
|
173
173
|
}
|
|
174
174
|
));
|
|
175
175
|
DialogOverlay.displayName = DialogPrimitive.Overlay.displayName;
|
|
176
|
-
var DialogContent =
|
|
176
|
+
var DialogContent = React10.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs(DialogPortal, { children: [
|
|
177
177
|
/* @__PURE__ */ jsx(DialogOverlay, {}),
|
|
178
178
|
/* @__PURE__ */ jsxs(
|
|
179
179
|
DialogPrimitive.Content,
|
|
@@ -223,7 +223,7 @@ var DialogFooter = ({
|
|
|
223
223
|
}
|
|
224
224
|
);
|
|
225
225
|
DialogFooter.displayName = "DialogFooter";
|
|
226
|
-
var DialogTitle =
|
|
226
|
+
var DialogTitle = React10.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
227
227
|
DialogPrimitive.Title,
|
|
228
228
|
{
|
|
229
229
|
ref,
|
|
@@ -235,7 +235,7 @@ var DialogTitle = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE
|
|
|
235
235
|
}
|
|
236
236
|
));
|
|
237
237
|
DialogTitle.displayName = DialogPrimitive.Title.displayName;
|
|
238
|
-
var DialogDescription =
|
|
238
|
+
var DialogDescription = React10.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
239
239
|
DialogPrimitive.Description,
|
|
240
240
|
{
|
|
241
241
|
ref,
|
|
@@ -250,7 +250,7 @@ var DropdownMenuGroup = DropdownMenuPrimitive.Group;
|
|
|
250
250
|
var DropdownMenuPortal = DropdownMenuPrimitive.Portal;
|
|
251
251
|
var DropdownMenuSub = DropdownMenuPrimitive.Sub;
|
|
252
252
|
var DropdownMenuRadioGroup = DropdownMenuPrimitive.RadioGroup;
|
|
253
|
-
var DropdownMenuSubTrigger =
|
|
253
|
+
var DropdownMenuSubTrigger = React10.forwardRef(({ className, inset, children, ...props }, ref) => /* @__PURE__ */ jsxs(
|
|
254
254
|
DropdownMenuPrimitive.SubTrigger,
|
|
255
255
|
{
|
|
256
256
|
ref,
|
|
@@ -267,7 +267,7 @@ var DropdownMenuSubTrigger = React9.forwardRef(({ className, inset, children, ..
|
|
|
267
267
|
}
|
|
268
268
|
));
|
|
269
269
|
DropdownMenuSubTrigger.displayName = DropdownMenuPrimitive.SubTrigger.displayName;
|
|
270
|
-
var DropdownMenuSubContent =
|
|
270
|
+
var DropdownMenuSubContent = React10.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
271
271
|
DropdownMenuPrimitive.SubContent,
|
|
272
272
|
{
|
|
273
273
|
ref,
|
|
@@ -279,7 +279,7 @@ var DropdownMenuSubContent = React9.forwardRef(({ className, ...props }, ref) =>
|
|
|
279
279
|
}
|
|
280
280
|
));
|
|
281
281
|
DropdownMenuSubContent.displayName = DropdownMenuPrimitive.SubContent.displayName;
|
|
282
|
-
var DropdownMenuContent =
|
|
282
|
+
var DropdownMenuContent = React10.forwardRef(({ className, sideOffset = 4, ...props }, ref) => /* @__PURE__ */ jsx(DropdownMenuPrimitive.Portal, { children: /* @__PURE__ */ jsx(
|
|
283
283
|
DropdownMenuPrimitive.Content,
|
|
284
284
|
{
|
|
285
285
|
ref,
|
|
@@ -293,7 +293,7 @@ var DropdownMenuContent = React9.forwardRef(({ className, sideOffset = 4, ...pro
|
|
|
293
293
|
}
|
|
294
294
|
) }));
|
|
295
295
|
DropdownMenuContent.displayName = DropdownMenuPrimitive.Content.displayName;
|
|
296
|
-
var DropdownMenuItem =
|
|
296
|
+
var DropdownMenuItem = React10.forwardRef(({ className, inset, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
297
297
|
DropdownMenuPrimitive.Item,
|
|
298
298
|
{
|
|
299
299
|
ref,
|
|
@@ -306,7 +306,7 @@ var DropdownMenuItem = React9.forwardRef(({ className, inset, ...props }, ref) =
|
|
|
306
306
|
}
|
|
307
307
|
));
|
|
308
308
|
DropdownMenuItem.displayName = DropdownMenuPrimitive.Item.displayName;
|
|
309
|
-
var DropdownMenuCheckboxItem =
|
|
309
|
+
var DropdownMenuCheckboxItem = React10.forwardRef(({ className, children, checked, ...props }, ref) => /* @__PURE__ */ jsxs(
|
|
310
310
|
DropdownMenuPrimitive.CheckboxItem,
|
|
311
311
|
{
|
|
312
312
|
ref,
|
|
@@ -323,7 +323,7 @@ var DropdownMenuCheckboxItem = React9.forwardRef(({ className, children, checked
|
|
|
323
323
|
}
|
|
324
324
|
));
|
|
325
325
|
DropdownMenuCheckboxItem.displayName = DropdownMenuPrimitive.CheckboxItem.displayName;
|
|
326
|
-
var DropdownMenuRadioItem =
|
|
326
|
+
var DropdownMenuRadioItem = React10.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs(
|
|
327
327
|
DropdownMenuPrimitive.RadioItem,
|
|
328
328
|
{
|
|
329
329
|
ref,
|
|
@@ -339,7 +339,7 @@ var DropdownMenuRadioItem = React9.forwardRef(({ className, children, ...props }
|
|
|
339
339
|
}
|
|
340
340
|
));
|
|
341
341
|
DropdownMenuRadioItem.displayName = DropdownMenuPrimitive.RadioItem.displayName;
|
|
342
|
-
var DropdownMenuLabel =
|
|
342
|
+
var DropdownMenuLabel = React10.forwardRef(({ className, inset, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
343
343
|
DropdownMenuPrimitive.Label,
|
|
344
344
|
{
|
|
345
345
|
ref,
|
|
@@ -352,7 +352,7 @@ var DropdownMenuLabel = React9.forwardRef(({ className, inset, ...props }, ref)
|
|
|
352
352
|
}
|
|
353
353
|
));
|
|
354
354
|
DropdownMenuLabel.displayName = DropdownMenuPrimitive.Label.displayName;
|
|
355
|
-
var DropdownMenuSeparator =
|
|
355
|
+
var DropdownMenuSeparator = React10.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
356
356
|
DropdownMenuPrimitive.Separator,
|
|
357
357
|
{
|
|
358
358
|
ref,
|
|
@@ -374,19 +374,19 @@ var DropdownMenuShortcut = ({
|
|
|
374
374
|
);
|
|
375
375
|
};
|
|
376
376
|
DropdownMenuShortcut.displayName = "DropdownMenuShortcut";
|
|
377
|
-
var FormContext =
|
|
377
|
+
var FormContext = React10.createContext(null);
|
|
378
378
|
function useFormContext() {
|
|
379
|
-
const context =
|
|
379
|
+
const context = React10.useContext(FormContext);
|
|
380
380
|
if (!context) {
|
|
381
381
|
throw new Error("useFormContext must be used within a Form component");
|
|
382
382
|
}
|
|
383
383
|
return context;
|
|
384
384
|
}
|
|
385
|
-
var FormFieldContext =
|
|
385
|
+
var FormFieldContext = React10.createContext(
|
|
386
386
|
null
|
|
387
387
|
);
|
|
388
388
|
function useFormFieldContext() {
|
|
389
|
-
const context =
|
|
389
|
+
const context = React10.useContext(FormFieldContext);
|
|
390
390
|
if (!context) {
|
|
391
391
|
throw new Error(
|
|
392
392
|
"useFormFieldContext must be used within a FormField component"
|
|
@@ -394,24 +394,24 @@ function useFormFieldContext() {
|
|
|
394
394
|
}
|
|
395
395
|
return context;
|
|
396
396
|
}
|
|
397
|
-
var Form =
|
|
397
|
+
var Form = React10.forwardRef(
|
|
398
398
|
({ className, children, onFormSubmit, ...props }, ref) => {
|
|
399
|
-
const [errors, setErrors] =
|
|
400
|
-
const [isSubmitting, setIsSubmitting] =
|
|
401
|
-
const setError =
|
|
399
|
+
const [errors, setErrors] = React10.useState({});
|
|
400
|
+
const [isSubmitting, setIsSubmitting] = React10.useState(false);
|
|
401
|
+
const setError = React10.useCallback(
|
|
402
402
|
(name, message) => {
|
|
403
403
|
setErrors((prev) => ({ ...prev, [name]: message }));
|
|
404
404
|
},
|
|
405
405
|
[]
|
|
406
406
|
);
|
|
407
|
-
const clearError =
|
|
407
|
+
const clearError = React10.useCallback((name) => {
|
|
408
408
|
setErrors((prev) => {
|
|
409
409
|
const next = { ...prev };
|
|
410
410
|
delete next[name];
|
|
411
411
|
return next;
|
|
412
412
|
});
|
|
413
413
|
}, []);
|
|
414
|
-
const clearAllErrors =
|
|
414
|
+
const clearAllErrors = React10.useCallback(() => {
|
|
415
415
|
setErrors({});
|
|
416
416
|
}, []);
|
|
417
417
|
const isValid = Object.keys(errors).length === 0;
|
|
@@ -430,7 +430,7 @@ var Form = React9.forwardRef(
|
|
|
430
430
|
}
|
|
431
431
|
}
|
|
432
432
|
};
|
|
433
|
-
const contextValue =
|
|
433
|
+
const contextValue = React10.useMemo(
|
|
434
434
|
() => ({
|
|
435
435
|
errors,
|
|
436
436
|
setError,
|
|
@@ -454,12 +454,12 @@ var Form = React9.forwardRef(
|
|
|
454
454
|
}
|
|
455
455
|
);
|
|
456
456
|
Form.displayName = "Form";
|
|
457
|
-
var FormField =
|
|
457
|
+
var FormField = React10.forwardRef(
|
|
458
458
|
({ className, name, children, ...props }, ref) => {
|
|
459
459
|
const { errors } = useFormContext();
|
|
460
|
-
const id =
|
|
460
|
+
const id = React10.useId();
|
|
461
461
|
const error = errors[name];
|
|
462
|
-
const contextValue =
|
|
462
|
+
const contextValue = React10.useMemo(
|
|
463
463
|
() => ({ name, error, id }),
|
|
464
464
|
[name, error, id]
|
|
465
465
|
);
|
|
@@ -467,7 +467,7 @@ var FormField = React9.forwardRef(
|
|
|
467
467
|
}
|
|
468
468
|
);
|
|
469
469
|
FormField.displayName = "FormField";
|
|
470
|
-
var FormLabel =
|
|
470
|
+
var FormLabel = React10.forwardRef(({ className, ...props }, ref) => {
|
|
471
471
|
const { id, error } = useFormFieldContext();
|
|
472
472
|
return /* @__PURE__ */ jsx(
|
|
473
473
|
Label,
|
|
@@ -480,10 +480,10 @@ var FormLabel = React9.forwardRef(({ className, ...props }, ref) => {
|
|
|
480
480
|
);
|
|
481
481
|
});
|
|
482
482
|
FormLabel.displayName = "FormLabel";
|
|
483
|
-
var FormControl =
|
|
483
|
+
var FormControl = React10.forwardRef(
|
|
484
484
|
({ children, ...props }, ref) => {
|
|
485
485
|
const { id, error, name } = useFormFieldContext();
|
|
486
|
-
const child =
|
|
486
|
+
const child = React10.cloneElement(children, {
|
|
487
487
|
id,
|
|
488
488
|
name,
|
|
489
489
|
"aria-invalid": !!error,
|
|
@@ -494,7 +494,7 @@ var FormControl = React9.forwardRef(
|
|
|
494
494
|
}
|
|
495
495
|
);
|
|
496
496
|
FormControl.displayName = "FormControl";
|
|
497
|
-
var FormDescription =
|
|
497
|
+
var FormDescription = React10.forwardRef(
|
|
498
498
|
({ className, ...props }, ref) => {
|
|
499
499
|
return /* @__PURE__ */ jsx(
|
|
500
500
|
"span",
|
|
@@ -510,9 +510,9 @@ var FormDescription = React9.forwardRef(
|
|
|
510
510
|
}
|
|
511
511
|
);
|
|
512
512
|
FormDescription.displayName = "FormDescription";
|
|
513
|
-
var FormMessage =
|
|
513
|
+
var FormMessage = React10.forwardRef(
|
|
514
514
|
({ className, children, error: errorProp, ...props }, ref) => {
|
|
515
|
-
const fieldContext =
|
|
515
|
+
const fieldContext = React10.useContext(FormFieldContext);
|
|
516
516
|
const error = errorProp ?? fieldContext?.error;
|
|
517
517
|
const id = fieldContext?.id;
|
|
518
518
|
if (!error && !children) {
|
|
@@ -536,14 +536,14 @@ var FormMessage = React9.forwardRef(
|
|
|
536
536
|
}
|
|
537
537
|
);
|
|
538
538
|
FormMessage.displayName = "FormMessage";
|
|
539
|
-
var PopoverContext =
|
|
539
|
+
var PopoverContext = React10.createContext({ open: false });
|
|
540
540
|
var Popover = ({
|
|
541
541
|
children,
|
|
542
542
|
open: controlledOpen,
|
|
543
543
|
onOpenChange,
|
|
544
544
|
...props
|
|
545
545
|
}) => {
|
|
546
|
-
const [uncontrolledOpen, setUncontrolledOpen] =
|
|
546
|
+
const [uncontrolledOpen, setUncontrolledOpen] = React10.useState(false);
|
|
547
547
|
const isControlled = controlledOpen !== void 0;
|
|
548
548
|
const open = isControlled ? controlledOpen : uncontrolledOpen;
|
|
549
549
|
const handleOpenChange = (newOpen) => {
|
|
@@ -564,8 +564,8 @@ var Popover = ({
|
|
|
564
564
|
};
|
|
565
565
|
var PopoverTrigger = PopoverPrimitive.Trigger;
|
|
566
566
|
var PopoverAnchor = PopoverPrimitive.Anchor;
|
|
567
|
-
var PopoverContent =
|
|
568
|
-
const { open } =
|
|
567
|
+
var PopoverContent = React10.forwardRef(({ className, align = "center", sideOffset = 4, children, ...props }, ref) => {
|
|
568
|
+
const { open } = React10.useContext(PopoverContext);
|
|
569
569
|
const {
|
|
570
570
|
onOpenAutoFocus,
|
|
571
571
|
onCloseAutoFocus,
|
|
@@ -625,15 +625,15 @@ var PopoverContent = React9.forwardRef(({ className, align = "center", sideOffse
|
|
|
625
625
|
) }) });
|
|
626
626
|
});
|
|
627
627
|
PopoverContent.displayName = PopoverPrimitive.Content.displayName;
|
|
628
|
-
var SelectContext =
|
|
629
|
-
var SelectSearchContext =
|
|
628
|
+
var SelectContext = React10.createContext({ open: false });
|
|
629
|
+
var SelectSearchContext = React10.createContext("");
|
|
630
630
|
var Select = ({
|
|
631
631
|
children,
|
|
632
632
|
open: controlledOpen,
|
|
633
633
|
onOpenChange,
|
|
634
634
|
...props
|
|
635
635
|
}) => {
|
|
636
|
-
const [uncontrolledOpen, setUncontrolledOpen] =
|
|
636
|
+
const [uncontrolledOpen, setUncontrolledOpen] = React10.useState(false);
|
|
637
637
|
const isControlled = controlledOpen !== void 0;
|
|
638
638
|
const open = isControlled ? controlledOpen : uncontrolledOpen;
|
|
639
639
|
const handleOpenChange = (newOpen) => {
|
|
@@ -653,9 +653,9 @@ var Select = ({
|
|
|
653
653
|
) });
|
|
654
654
|
};
|
|
655
655
|
var SelectGroup = SelectPrimitive.Group;
|
|
656
|
-
var SelectValue =
|
|
656
|
+
var SelectValue = React10.forwardRef(({ children, placeholder, ...props }, ref) => /* @__PURE__ */ jsx(SelectPrimitive.Value, { ref, placeholder, ...props, children }));
|
|
657
657
|
SelectValue.displayName = SelectPrimitive.Value.displayName;
|
|
658
|
-
var SelectTrigger =
|
|
658
|
+
var SelectTrigger = React10.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs(
|
|
659
659
|
SelectPrimitive.Trigger,
|
|
660
660
|
{
|
|
661
661
|
ref,
|
|
@@ -671,7 +671,7 @@ var SelectTrigger = React9.forwardRef(({ className, children, ...props }, ref) =
|
|
|
671
671
|
}
|
|
672
672
|
));
|
|
673
673
|
SelectTrigger.displayName = SelectPrimitive.Trigger.displayName;
|
|
674
|
-
var SelectScrollUpButton =
|
|
674
|
+
var SelectScrollUpButton = React10.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
675
675
|
SelectPrimitive.ScrollUpButton,
|
|
676
676
|
{
|
|
677
677
|
ref,
|
|
@@ -684,7 +684,7 @@ var SelectScrollUpButton = React9.forwardRef(({ className, ...props }, ref) => /
|
|
|
684
684
|
}
|
|
685
685
|
));
|
|
686
686
|
SelectScrollUpButton.displayName = SelectPrimitive.ScrollUpButton.displayName;
|
|
687
|
-
var SelectScrollDownButton =
|
|
687
|
+
var SelectScrollDownButton = React10.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
688
688
|
SelectPrimitive.ScrollDownButton,
|
|
689
689
|
{
|
|
690
690
|
ref,
|
|
@@ -697,11 +697,11 @@ var SelectScrollDownButton = React9.forwardRef(({ className, ...props }, ref) =>
|
|
|
697
697
|
}
|
|
698
698
|
));
|
|
699
699
|
SelectScrollDownButton.displayName = SelectPrimitive.ScrollDownButton.displayName;
|
|
700
|
-
var SelectContent =
|
|
701
|
-
const { open } =
|
|
702
|
-
const [search, setSearch] =
|
|
703
|
-
const searchInputRef =
|
|
704
|
-
|
|
700
|
+
var SelectContent = React10.forwardRef(({ className, children, position = "popper", searchable = false, searchPlaceholder = "Search...", ...props }, ref) => {
|
|
701
|
+
const { open } = React10.useContext(SelectContext);
|
|
702
|
+
const [search, setSearch] = React10.useState("");
|
|
703
|
+
const searchInputRef = React10.useRef(null);
|
|
704
|
+
React10.useEffect(() => {
|
|
705
705
|
if (open && searchable) {
|
|
706
706
|
const frame = requestAnimationFrame(() => {
|
|
707
707
|
searchInputRef.current?.focus();
|
|
@@ -727,6 +727,7 @@ var SelectContent = React9.forwardRef(({ className, children, position = "popper
|
|
|
727
727
|
} = props;
|
|
728
728
|
const ForceMountPortal = SelectPrimitive.Portal;
|
|
729
729
|
const ForceMountContent = SelectPrimitive.Content;
|
|
730
|
+
const AnimatedContent = React10.useMemo(() => React10.forwardRef(({ forceMount: _, ...props2 }, ref2) => /* @__PURE__ */ jsx(motion.div, { ref: ref2, ...props2 })), []);
|
|
730
731
|
return /* @__PURE__ */ jsx(ForceMountPortal, { forceMount: true, children: /* @__PURE__ */ jsx(
|
|
731
732
|
ForceMountContent,
|
|
732
733
|
{
|
|
@@ -748,7 +749,7 @@ var SelectContent = React9.forwardRef(({ className, children, position = "popper
|
|
|
748
749
|
asChild: true,
|
|
749
750
|
...{ forceMount: true },
|
|
750
751
|
children: /* @__PURE__ */ jsxs(
|
|
751
|
-
|
|
752
|
+
AnimatedContent,
|
|
752
753
|
{
|
|
753
754
|
initial: false,
|
|
754
755
|
animate: open ? { opacity: 1, scale: 1, y: 0, pointerEvents: "auto" } : { opacity: 0, scale: 0.96, y: -8, pointerEvents: "none" },
|
|
@@ -799,7 +800,7 @@ var SelectContent = React9.forwardRef(({ className, children, position = "popper
|
|
|
799
800
|
) });
|
|
800
801
|
});
|
|
801
802
|
SelectContent.displayName = SelectPrimitive.Content.displayName;
|
|
802
|
-
var SelectLabel =
|
|
803
|
+
var SelectLabel = React10.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
803
804
|
SelectPrimitive.Label,
|
|
804
805
|
{
|
|
805
806
|
ref,
|
|
@@ -808,8 +809,8 @@ var SelectLabel = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE
|
|
|
808
809
|
}
|
|
809
810
|
));
|
|
810
811
|
SelectLabel.displayName = SelectPrimitive.Label.displayName;
|
|
811
|
-
var SelectItem =
|
|
812
|
-
const search =
|
|
812
|
+
var SelectItem = React10.forwardRef(({ className, children, textValue, ...props }, ref) => {
|
|
813
|
+
const search = React10.useContext(SelectSearchContext);
|
|
813
814
|
const itemText = textValue ?? (typeof children === "string" ? children : "");
|
|
814
815
|
if (search && itemText && !itemText.toLowerCase().includes(search.toLowerCase())) {
|
|
815
816
|
return null;
|
|
@@ -832,7 +833,7 @@ var SelectItem = React9.forwardRef(({ className, children, textValue, ...props }
|
|
|
832
833
|
);
|
|
833
834
|
});
|
|
834
835
|
SelectItem.displayName = SelectPrimitive.Item.displayName;
|
|
835
|
-
var SelectSeparator =
|
|
836
|
+
var SelectSeparator = React10.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
836
837
|
SelectPrimitive.Separator,
|
|
837
838
|
{
|
|
838
839
|
ref,
|
|
@@ -935,12 +936,75 @@ function SkeletonCard({ className }) {
|
|
|
935
936
|
}
|
|
936
937
|
);
|
|
937
938
|
}
|
|
938
|
-
|
|
939
|
+
function BulkEditPopover({ column, onApply }) {
|
|
940
|
+
const [value, setValue] = React10.useState("");
|
|
941
|
+
const [open, setOpen] = React10.useState(false);
|
|
942
|
+
const { bulkEdit } = column;
|
|
943
|
+
if (!bulkEdit) return null;
|
|
944
|
+
const isValid = bulkEdit.kind === "input" ? !!value.trim() : !!value;
|
|
945
|
+
const headingLabel = bulkEdit.label ?? column.label;
|
|
946
|
+
const handleApply = () => {
|
|
947
|
+
if (!isValid) return;
|
|
948
|
+
onApply(value);
|
|
949
|
+
setValue("");
|
|
950
|
+
setOpen(false);
|
|
951
|
+
};
|
|
952
|
+
const handleOpenChange = (next) => {
|
|
953
|
+
setOpen(next);
|
|
954
|
+
if (!next) setValue("");
|
|
955
|
+
};
|
|
956
|
+
return /* @__PURE__ */ jsx(Tooltip, { content: `Apply to all ${headingLabel}`, side: "top", disabled: open, children: /* @__PURE__ */ jsx("span", { className: "inline-flex", children: /* @__PURE__ */ jsxs(Popover, { open, onOpenChange: handleOpenChange, children: [
|
|
957
|
+
/* @__PURE__ */ jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsx(
|
|
958
|
+
"button",
|
|
959
|
+
{
|
|
960
|
+
type: "button",
|
|
961
|
+
onFocus: (e) => e.stopPropagation(),
|
|
962
|
+
className: "ml-1 rounded p-0.5 text-gray-400 hover:text-gray-600 hover:bg-gray-100 dark:hover:text-gray-300 dark:hover:bg-neutral-700 transition-colors",
|
|
963
|
+
"aria-label": `Edit all ${column.label} values`,
|
|
964
|
+
children: /* @__PURE__ */ jsx(PenLine, { className: "h-3.5 w-3.5" })
|
|
965
|
+
}
|
|
966
|
+
) }),
|
|
967
|
+
/* @__PURE__ */ jsxs(PopoverContent, { align: "start", className: "w-64 p-3 space-y-3", children: [
|
|
968
|
+
/* @__PURE__ */ jsxs("p", { className: "text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wide", children: [
|
|
969
|
+
"Apply to all \u2014 ",
|
|
970
|
+
headingLabel
|
|
971
|
+
] }),
|
|
972
|
+
bulkEdit.kind === "input" ? /* @__PURE__ */ jsxs("div", { className: "relative", children: [
|
|
973
|
+
bulkEdit.leadingDecorator && /* @__PURE__ */ jsx("span", { className: "absolute inset-y-0 left-0 pl-3 flex items-center text-sm text-neutral-400 pointer-events-none", children: bulkEdit.leadingDecorator }),
|
|
974
|
+
/* @__PURE__ */ jsx(
|
|
975
|
+
"input",
|
|
976
|
+
{
|
|
977
|
+
type: bulkEdit.type ?? "text",
|
|
978
|
+
placeholder: bulkEdit.placeholder,
|
|
979
|
+
value,
|
|
980
|
+
onChange: (e) => setValue(e.target.value),
|
|
981
|
+
onKeyDown: (e) => {
|
|
982
|
+
if (e.key === "Enter") {
|
|
983
|
+
e.preventDefault();
|
|
984
|
+
handleApply();
|
|
985
|
+
}
|
|
986
|
+
},
|
|
987
|
+
autoFocus: true,
|
|
988
|
+
className: cn(
|
|
989
|
+
"w-full rounded-hz-md border border-gray-300 bg-white py-2 text-sm text-gray-900 placeholder:text-gray-400 focus:outline-none focus:ring-1 focus:ring-blue-500/50 dark:border-neutral-600 dark:bg-neutral-800 dark:text-gray-100 dark:placeholder:text-gray-500",
|
|
990
|
+
bulkEdit.leadingDecorator ? "pl-7 pr-3" : "px-3"
|
|
991
|
+
)
|
|
992
|
+
}
|
|
993
|
+
)
|
|
994
|
+
] }) : /* @__PURE__ */ jsxs(Select, { value, onValueChange: setValue, children: [
|
|
995
|
+
/* @__PURE__ */ jsx(SelectTrigger, { children: /* @__PURE__ */ jsx(SelectValue, { placeholder: bulkEdit.placeholder ?? "Select a value" }) }),
|
|
996
|
+
/* @__PURE__ */ jsx(SelectContent, { children: bulkEdit.options.map((opt) => /* @__PURE__ */ jsx(SelectItem, { value: opt.value, children: opt.label }, opt.value)) })
|
|
997
|
+
] }),
|
|
998
|
+
/* @__PURE__ */ jsx(Button, { size: "sm", className: "w-full", onClick: handleApply, disabled: !isValid, children: "Apply All" })
|
|
999
|
+
] })
|
|
1000
|
+
] }) }) });
|
|
1001
|
+
}
|
|
1002
|
+
var TableContext = React10.createContext(null);
|
|
939
1003
|
var useTableContext = () => {
|
|
940
|
-
const context =
|
|
1004
|
+
const context = React10.useContext(TableContext);
|
|
941
1005
|
return context;
|
|
942
1006
|
};
|
|
943
|
-
var TableInner =
|
|
1007
|
+
var TableInner = React10.forwardRef(
|
|
944
1008
|
({
|
|
945
1009
|
className,
|
|
946
1010
|
selectable = false,
|
|
@@ -954,28 +1018,28 @@ var TableInner = React9.forwardRef(
|
|
|
954
1018
|
visibleColumns,
|
|
955
1019
|
showDividers = false,
|
|
956
1020
|
highlightMode = "row",
|
|
1021
|
+
onBulkEdit,
|
|
957
1022
|
children,
|
|
958
1023
|
...props
|
|
959
1024
|
}, ref) => {
|
|
960
|
-
const [internalSelectedRows, setInternalSelectedRows] =
|
|
961
|
-
const [registeredRowIds, setRegisteredRowIds] =
|
|
962
|
-
const
|
|
963
|
-
const [hoveredRowIndex, setHoveredRowIndex] = React9.useState(null);
|
|
1025
|
+
const [internalSelectedRows, setInternalSelectedRows] = React10.useState(/* @__PURE__ */ new Set());
|
|
1026
|
+
const [registeredRowIds, setRegisteredRowIds] = React10.useState(/* @__PURE__ */ new Set());
|
|
1027
|
+
const wrapperRef = React10.useRef(null);
|
|
964
1028
|
const isControlled = controlledSelectedRows !== void 0;
|
|
965
1029
|
const selectedRowsSet = isControlled ? new Set(controlledSelectedRows) : internalSelectedRows;
|
|
966
|
-
const defaultGetRowId =
|
|
1030
|
+
const defaultGetRowId = React10.useCallback((row) => {
|
|
967
1031
|
if (typeof row === "string") return row;
|
|
968
1032
|
if (typeof row === "object" && row?.id) return String(row.id);
|
|
969
1033
|
return String(row);
|
|
970
1034
|
}, []);
|
|
971
1035
|
const finalGetRowId = getRowId || defaultGetRowId;
|
|
972
|
-
const allRowIds =
|
|
1036
|
+
const allRowIds = React10.useMemo(() => {
|
|
973
1037
|
if (rows) {
|
|
974
1038
|
return new Set(rows.map(finalGetRowId));
|
|
975
1039
|
}
|
|
976
1040
|
return registeredRowIds;
|
|
977
1041
|
}, [rows, finalGetRowId, registeredRowIds]);
|
|
978
|
-
const registerRowId =
|
|
1042
|
+
const registerRowId = React10.useCallback((rowId) => {
|
|
979
1043
|
if (rowId) {
|
|
980
1044
|
setRegisteredRowIds((prev) => {
|
|
981
1045
|
if (prev.has(rowId)) return prev;
|
|
@@ -983,7 +1047,7 @@ var TableInner = React9.forwardRef(
|
|
|
983
1047
|
});
|
|
984
1048
|
}
|
|
985
1049
|
}, []);
|
|
986
|
-
const unregisterRowId =
|
|
1050
|
+
const unregisterRowId = React10.useCallback((rowId) => {
|
|
987
1051
|
if (rowId) {
|
|
988
1052
|
setRegisteredRowIds((prev) => {
|
|
989
1053
|
if (!prev.has(rowId)) return prev;
|
|
@@ -993,7 +1057,7 @@ var TableInner = React9.forwardRef(
|
|
|
993
1057
|
});
|
|
994
1058
|
}
|
|
995
1059
|
}, []);
|
|
996
|
-
const toggleRow =
|
|
1060
|
+
const toggleRow = React10.useCallback(
|
|
997
1061
|
(rowId) => {
|
|
998
1062
|
if (!selectable) return;
|
|
999
1063
|
const next = new Set(selectedRowsSet);
|
|
@@ -1018,7 +1082,7 @@ var TableInner = React9.forwardRef(
|
|
|
1018
1082
|
},
|
|
1019
1083
|
[selectable, selectionMode, selectedRowsSet, isControlled, onSelectionChange]
|
|
1020
1084
|
);
|
|
1021
|
-
const selectAll =
|
|
1085
|
+
const selectAll = React10.useCallback(() => {
|
|
1022
1086
|
if (!selectable || selectionMode !== "multiple" || allRowIds.size === 0) return;
|
|
1023
1087
|
const next = new Set(allRowIds);
|
|
1024
1088
|
if (isControlled) {
|
|
@@ -1028,7 +1092,7 @@ var TableInner = React9.forwardRef(
|
|
|
1028
1092
|
onSelectionChange?.(Array.from(next));
|
|
1029
1093
|
}
|
|
1030
1094
|
}, [selectable, selectionMode, allRowIds, isControlled, onSelectionChange]);
|
|
1031
|
-
const deselectAll =
|
|
1095
|
+
const deselectAll = React10.useCallback(() => {
|
|
1032
1096
|
if (!selectable) return;
|
|
1033
1097
|
const next = /* @__PURE__ */ new Set();
|
|
1034
1098
|
if (isControlled) {
|
|
@@ -1038,19 +1102,19 @@ var TableInner = React9.forwardRef(
|
|
|
1038
1102
|
onSelectionChange?.(Array.from(next));
|
|
1039
1103
|
}
|
|
1040
1104
|
}, [selectable, isControlled, onSelectionChange]);
|
|
1041
|
-
const isRowSelected =
|
|
1105
|
+
const isRowSelected = React10.useCallback(
|
|
1042
1106
|
(rowId) => selectedRowsSet.has(rowId),
|
|
1043
1107
|
[selectedRowsSet]
|
|
1044
1108
|
);
|
|
1045
|
-
const isAllSelected =
|
|
1109
|
+
const isAllSelected = React10.useMemo(() => {
|
|
1046
1110
|
if (!selectable || allRowIds.size === 0) return false;
|
|
1047
1111
|
return allRowIds.size > 0 && Array.from(allRowIds).every((id) => selectedRowsSet.has(id));
|
|
1048
1112
|
}, [selectable, allRowIds, selectedRowsSet]);
|
|
1049
|
-
const isSomeSelected =
|
|
1113
|
+
const isSomeSelected = React10.useMemo(() => {
|
|
1050
1114
|
if (!selectable) return false;
|
|
1051
1115
|
return selectedRowsSet.size > 0 && !isAllSelected;
|
|
1052
1116
|
}, [selectable, selectedRowsSet.size, isAllSelected]);
|
|
1053
|
-
const contextValue =
|
|
1117
|
+
const contextValue = React10.useMemo(() => ({
|
|
1054
1118
|
selectable,
|
|
1055
1119
|
selectionMode,
|
|
1056
1120
|
selectedRows: selectedRowsSet,
|
|
@@ -1077,14 +1141,54 @@ var TableInner = React9.forwardRef(
|
|
|
1077
1141
|
registerRowId,
|
|
1078
1142
|
unregisterRowId
|
|
1079
1143
|
]);
|
|
1144
|
+
React10.useEffect(() => {
|
|
1145
|
+
const wrapper = wrapperRef.current;
|
|
1146
|
+
if (!wrapper || highlightMode === "none") return;
|
|
1147
|
+
let prevCell = null;
|
|
1148
|
+
let highlighted = [];
|
|
1149
|
+
const getHighlightBg = () => document.documentElement.classList.contains("dark") ? "rgba(38, 38, 38, 0.5)" : "rgb(249, 250, 251)";
|
|
1150
|
+
const clearHighlight = () => {
|
|
1151
|
+
for (const el of highlighted) el.style.removeProperty("background-color");
|
|
1152
|
+
highlighted = [];
|
|
1153
|
+
};
|
|
1154
|
+
const handleMouseMove = (e) => {
|
|
1155
|
+
const cell = e.target.closest("td, th");
|
|
1156
|
+
if (cell === prevCell) return;
|
|
1157
|
+
prevCell = cell;
|
|
1158
|
+
clearHighlight();
|
|
1159
|
+
if (!cell) return;
|
|
1160
|
+
const next = [];
|
|
1161
|
+
const tr = cell.closest("tr");
|
|
1162
|
+
const colKey = cell.getAttribute("data-col-key");
|
|
1163
|
+
if ((highlightMode === "row" || highlightMode === "cross") && tr) {
|
|
1164
|
+
next.push(...Array.from(tr.querySelectorAll("td, th")));
|
|
1165
|
+
}
|
|
1166
|
+
if ((highlightMode === "column" || highlightMode === "cross") && colKey) {
|
|
1167
|
+
for (const el of Array.from(wrapper.querySelectorAll(`[data-col-key="${colKey}"]`))) {
|
|
1168
|
+
if (!next.includes(el)) next.push(el);
|
|
1169
|
+
}
|
|
1170
|
+
}
|
|
1171
|
+
const bg = getHighlightBg();
|
|
1172
|
+
for (const el of next) el.style.setProperty("background-color", bg, "important");
|
|
1173
|
+
highlighted = next;
|
|
1174
|
+
};
|
|
1175
|
+
const handleMouseLeave = () => {
|
|
1176
|
+
prevCell = null;
|
|
1177
|
+
clearHighlight();
|
|
1178
|
+
};
|
|
1179
|
+
wrapper.addEventListener("mousemove", handleMouseMove, { passive: true });
|
|
1180
|
+
wrapper.addEventListener("mouseleave", handleMouseLeave);
|
|
1181
|
+
return () => {
|
|
1182
|
+
wrapper.removeEventListener("mousemove", handleMouseMove);
|
|
1183
|
+
wrapper.removeEventListener("mouseleave", handleMouseLeave);
|
|
1184
|
+
clearHighlight();
|
|
1185
|
+
};
|
|
1186
|
+
}, [highlightMode]);
|
|
1080
1187
|
return /* @__PURE__ */ jsx(TableContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsx(
|
|
1081
1188
|
"div",
|
|
1082
1189
|
{
|
|
1190
|
+
ref: wrapperRef,
|
|
1083
1191
|
className: "relative w-full overflow-auto",
|
|
1084
|
-
onMouseLeave: () => {
|
|
1085
|
-
setHoveredCol(null);
|
|
1086
|
-
setHoveredRowIndex(null);
|
|
1087
|
-
},
|
|
1088
1192
|
children: /* @__PURE__ */ jsx(
|
|
1089
1193
|
"table",
|
|
1090
1194
|
{
|
|
@@ -1096,50 +1200,46 @@ var TableInner = React9.forwardRef(
|
|
|
1096
1200
|
(col) => col.sticky || !visibleColumns || visibleColumns.includes(col.key)
|
|
1097
1201
|
);
|
|
1098
1202
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1099
|
-
/* @__PURE__ */ jsx("thead", { className: "[&_tr]:border-b [&_tr]:border-gray-200 dark:[&_tr]:border-gray-700", children: /* @__PURE__ */ jsx("tr", { className: "border-b border-gray-200 transition-colors dark:border-neutral-700", children: visibleCols.map((col) =>
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
"
|
|
1103
|
-
{
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1203
|
+
/* @__PURE__ */ jsx("thead", { className: "[&_tr]:border-b [&_tr]:border-gray-200 dark:[&_tr]:border-gray-700", children: /* @__PURE__ */ jsx("tr", { className: "border-b border-gray-200 transition-colors dark:border-neutral-700", children: visibleCols.map((col) => /* @__PURE__ */ jsx(
|
|
1204
|
+
"th",
|
|
1205
|
+
{
|
|
1206
|
+
"data-col-key": col.key,
|
|
1207
|
+
style: col.minWidth ? { minWidth: col.minWidth } : void 0,
|
|
1208
|
+
className: cn(
|
|
1209
|
+
"h-12 px-4 text-left align-middle font-medium text-gray-500 dark:text-gray-400",
|
|
1210
|
+
col.sticky && "sticky left-0 z-20 bg-white dark:bg-neutral-900",
|
|
1211
|
+
showDividers && "border-r border-gray-200 dark:border-neutral-700"
|
|
1212
|
+
),
|
|
1213
|
+
children: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1", children: [
|
|
1214
|
+
col.label,
|
|
1215
|
+
col.bulkEdit && onBulkEdit && /* @__PURE__ */ jsx(
|
|
1216
|
+
BulkEditPopover,
|
|
1217
|
+
{
|
|
1218
|
+
column: col,
|
|
1219
|
+
onApply: (value) => onBulkEdit(col.key, value)
|
|
1220
|
+
}
|
|
1221
|
+
)
|
|
1222
|
+
] })
|
|
1223
|
+
},
|
|
1224
|
+
col.key
|
|
1225
|
+
)) }) }),
|
|
1118
1226
|
/* @__PURE__ */ jsx("tbody", { className: "[&_tr:last-child]:border-0", children: data.map((row, rowIndex) => /* @__PURE__ */ jsx(
|
|
1119
1227
|
"tr",
|
|
1120
1228
|
{
|
|
1121
1229
|
className: "border-b border-gray-200 transition-colors dark:border-neutral-700",
|
|
1122
|
-
children: visibleCols.map((col) =>
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
col.sticky ? cn("sticky left-0 z-20", isHighlighted ? "bg-gray-50 dark:bg-neutral-800/50" : "bg-white dark:bg-neutral-900") : isHighlighted ? "bg-gray-50 dark:bg-neutral-800/50" : void 0,
|
|
1136
|
-
showDividers && "border-r border-gray-200 dark:border-neutral-700"
|
|
1137
|
-
),
|
|
1138
|
-
children: col.cell(row)
|
|
1139
|
-
},
|
|
1140
|
-
col.key
|
|
1141
|
-
);
|
|
1142
|
-
})
|
|
1230
|
+
children: visibleCols.map((col) => /* @__PURE__ */ jsx(
|
|
1231
|
+
"td",
|
|
1232
|
+
{
|
|
1233
|
+
"data-col-key": col.key,
|
|
1234
|
+
className: cn(
|
|
1235
|
+
"p-4 align-middle",
|
|
1236
|
+
col.sticky && "sticky left-0 z-20 bg-white dark:bg-neutral-900",
|
|
1237
|
+
showDividers && "border-r border-gray-200 dark:border-neutral-700"
|
|
1238
|
+
),
|
|
1239
|
+
children: col.cell(row)
|
|
1240
|
+
},
|
|
1241
|
+
col.key
|
|
1242
|
+
))
|
|
1143
1243
|
},
|
|
1144
1244
|
finalGetRowId ? finalGetRowId(row) : rowIndex
|
|
1145
1245
|
)) })
|
|
@@ -1153,7 +1253,7 @@ var TableInner = React9.forwardRef(
|
|
|
1153
1253
|
);
|
|
1154
1254
|
TableInner.displayName = "Table";
|
|
1155
1255
|
var Table = TableInner;
|
|
1156
|
-
var TableHeader =
|
|
1256
|
+
var TableHeader = React10.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
1157
1257
|
"thead",
|
|
1158
1258
|
{
|
|
1159
1259
|
ref,
|
|
@@ -1162,7 +1262,7 @@ var TableHeader = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE
|
|
|
1162
1262
|
}
|
|
1163
1263
|
));
|
|
1164
1264
|
TableHeader.displayName = "TableHeader";
|
|
1165
|
-
var TableBody =
|
|
1265
|
+
var TableBody = React10.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
1166
1266
|
"tbody",
|
|
1167
1267
|
{
|
|
1168
1268
|
ref,
|
|
@@ -1171,7 +1271,7 @@ var TableBody = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__
|
|
|
1171
1271
|
}
|
|
1172
1272
|
));
|
|
1173
1273
|
TableBody.displayName = "TableBody";
|
|
1174
|
-
var TableFooter =
|
|
1274
|
+
var TableFooter = React10.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
1175
1275
|
"tfoot",
|
|
1176
1276
|
{
|
|
1177
1277
|
ref,
|
|
@@ -1183,19 +1283,19 @@ var TableFooter = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE
|
|
|
1183
1283
|
}
|
|
1184
1284
|
));
|
|
1185
1285
|
TableFooter.displayName = "TableFooter";
|
|
1186
|
-
var TableRow =
|
|
1286
|
+
var TableRow = React10.forwardRef(
|
|
1187
1287
|
({ className, rowId, rowData, onClick, ...props }, ref) => {
|
|
1188
1288
|
const context = useTableContext();
|
|
1189
1289
|
const getRowId = context?.getRowId;
|
|
1190
1290
|
const selectable = context?.selectable;
|
|
1191
1291
|
const registerRowId = context?.registerRowId;
|
|
1192
1292
|
const unregisterRowId = context?.unregisterRowId;
|
|
1193
|
-
const finalRowId =
|
|
1293
|
+
const finalRowId = React10.useMemo(() => {
|
|
1194
1294
|
if (rowId) return rowId;
|
|
1195
1295
|
if (rowData && getRowId) return getRowId(rowData);
|
|
1196
1296
|
return props.id || void 0;
|
|
1197
1297
|
}, [rowId, rowData, getRowId, props.id]);
|
|
1198
|
-
|
|
1298
|
+
React10.useEffect(() => {
|
|
1199
1299
|
if (finalRowId && selectable) {
|
|
1200
1300
|
registerRowId?.(finalRowId);
|
|
1201
1301
|
return () => {
|
|
@@ -1204,7 +1304,7 @@ var TableRow = React9.forwardRef(
|
|
|
1204
1304
|
}
|
|
1205
1305
|
}, [finalRowId, selectable, registerRowId, unregisterRowId]);
|
|
1206
1306
|
const isSelected = finalRowId ? context?.isRowSelected(finalRowId) : false;
|
|
1207
|
-
const handleClick =
|
|
1307
|
+
const handleClick = React10.useCallback(
|
|
1208
1308
|
(e) => {
|
|
1209
1309
|
onClick?.(e);
|
|
1210
1310
|
},
|
|
@@ -1227,7 +1327,7 @@ var TableRow = React9.forwardRef(
|
|
|
1227
1327
|
}
|
|
1228
1328
|
);
|
|
1229
1329
|
TableRow.displayName = "TableRow";
|
|
1230
|
-
var TableHead =
|
|
1330
|
+
var TableHead = React10.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
1231
1331
|
"th",
|
|
1232
1332
|
{
|
|
1233
1333
|
ref,
|
|
@@ -1239,7 +1339,7 @@ var TableHead = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__
|
|
|
1239
1339
|
}
|
|
1240
1340
|
));
|
|
1241
1341
|
TableHead.displayName = "TableHead";
|
|
1242
|
-
var TableCell =
|
|
1342
|
+
var TableCell = React10.forwardRef(
|
|
1243
1343
|
({ className, variant = "default", ...props }, ref) => /* @__PURE__ */ jsx(
|
|
1244
1344
|
"td",
|
|
1245
1345
|
{
|
|
@@ -1254,7 +1354,7 @@ var TableCell = React9.forwardRef(
|
|
|
1254
1354
|
)
|
|
1255
1355
|
);
|
|
1256
1356
|
TableCell.displayName = "TableCell";
|
|
1257
|
-
var TableCaption =
|
|
1357
|
+
var TableCaption = React10.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
1258
1358
|
"caption",
|
|
1259
1359
|
{
|
|
1260
1360
|
ref,
|
|
@@ -1263,7 +1363,7 @@ var TableCaption = React9.forwardRef(({ className, ...props }, ref) => /* @__PUR
|
|
|
1263
1363
|
}
|
|
1264
1364
|
));
|
|
1265
1365
|
TableCaption.displayName = "TableCaption";
|
|
1266
|
-
var TableSelectAll =
|
|
1366
|
+
var TableSelectAll = React10.forwardRef(({ className, ...props }, ref) => {
|
|
1267
1367
|
const context = useTableContext();
|
|
1268
1368
|
if (!context?.selectable || context.selectionMode !== "multiple") {
|
|
1269
1369
|
return null;
|
|
@@ -1286,13 +1386,13 @@ var TableSelectAll = React9.forwardRef(({ className, ...props }, ref) => {
|
|
|
1286
1386
|
) });
|
|
1287
1387
|
});
|
|
1288
1388
|
TableSelectAll.displayName = "TableSelectAll";
|
|
1289
|
-
var TableRowCheckbox =
|
|
1389
|
+
var TableRowCheckbox = React10.forwardRef(({ rowId, rowData, className, ...props }, ref) => {
|
|
1290
1390
|
const context = useTableContext();
|
|
1291
1391
|
const getRowId = context?.getRowId;
|
|
1292
1392
|
if (!context?.selectable) {
|
|
1293
1393
|
return null;
|
|
1294
1394
|
}
|
|
1295
|
-
const finalRowId =
|
|
1395
|
+
const finalRowId = React10.useMemo(() => {
|
|
1296
1396
|
if (rowId) return rowId;
|
|
1297
1397
|
if (rowData && getRowId) return getRowId(rowData);
|
|
1298
1398
|
return void 0;
|
|
@@ -1370,13 +1470,14 @@ function useColumnVisibility(columns, options = {}) {
|
|
|
1370
1470
|
}, [columns, storageKey]);
|
|
1371
1471
|
return { visibleColumns, setVisibleColumns };
|
|
1372
1472
|
}
|
|
1373
|
-
function
|
|
1473
|
+
function ColumnSelection({
|
|
1374
1474
|
columns,
|
|
1375
1475
|
visibleColumns,
|
|
1376
1476
|
onVisibleColumnsChange,
|
|
1377
|
-
triggerLabel = "
|
|
1477
|
+
triggerLabel = "Manage Columns",
|
|
1478
|
+
trigger
|
|
1378
1479
|
}) {
|
|
1379
|
-
const handleToggle =
|
|
1480
|
+
const handleToggle = React10.useCallback((key, checked) => {
|
|
1380
1481
|
if (checked) {
|
|
1381
1482
|
if (!visibleColumns.includes(key)) {
|
|
1382
1483
|
onVisibleColumnsChange([...visibleColumns, key]);
|
|
@@ -1386,7 +1487,7 @@ function ColumnPicker({
|
|
|
1386
1487
|
}
|
|
1387
1488
|
}, [visibleColumns, onVisibleColumnsChange]);
|
|
1388
1489
|
return /* @__PURE__ */ jsxs(Popover, { children: [
|
|
1389
|
-
/* @__PURE__ */ jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxs(Button, { variant: "outline", size: "sm", children: [
|
|
1490
|
+
/* @__PURE__ */ jsx(PopoverTrigger, { asChild: true, children: trigger ?? /* @__PURE__ */ jsxs(Button, { variant: "outline", size: "sm", children: [
|
|
1390
1491
|
/* @__PURE__ */ jsx(SlidersHorizontal, { className: "h-4 w-4", "aria-hidden": "true" }),
|
|
1391
1492
|
triggerLabel
|
|
1392
1493
|
] }) }),
|
|
@@ -1423,33 +1524,33 @@ function ColumnPicker({
|
|
|
1423
1524
|
] })
|
|
1424
1525
|
] });
|
|
1425
1526
|
}
|
|
1426
|
-
var TabsContext =
|
|
1527
|
+
var TabsContext = React10.createContext(null);
|
|
1427
1528
|
var useTabsContext = () => {
|
|
1428
|
-
const context =
|
|
1529
|
+
const context = React10.useContext(TabsContext);
|
|
1429
1530
|
if (!context) {
|
|
1430
1531
|
throw new Error("Tabs components must be used within a Tabs provider");
|
|
1431
1532
|
}
|
|
1432
1533
|
return context;
|
|
1433
1534
|
};
|
|
1434
|
-
var TabsListContext =
|
|
1435
|
-
var useTabsListContext = () =>
|
|
1436
|
-
var Tabs =
|
|
1437
|
-
const [activeTab, setActiveTabState] =
|
|
1438
|
-
const tabRefs =
|
|
1439
|
-
const listRef =
|
|
1440
|
-
const setActiveTab =
|
|
1535
|
+
var TabsListContext = React10.createContext({ variant: "pill" });
|
|
1536
|
+
var useTabsListContext = () => React10.useContext(TabsListContext);
|
|
1537
|
+
var Tabs = React10.forwardRef(({ defaultValue, value, onValueChange, children, ...props }, ref) => {
|
|
1538
|
+
const [activeTab, setActiveTabState] = React10.useState(value ?? defaultValue);
|
|
1539
|
+
const tabRefs = React10.useRef(/* @__PURE__ */ new Map()).current;
|
|
1540
|
+
const listRef = React10.useRef(null);
|
|
1541
|
+
const setActiveTab = React10.useCallback(
|
|
1441
1542
|
(newValue) => {
|
|
1442
1543
|
setActiveTabState(newValue);
|
|
1443
1544
|
onValueChange?.(newValue);
|
|
1444
1545
|
},
|
|
1445
1546
|
[onValueChange]
|
|
1446
1547
|
);
|
|
1447
|
-
|
|
1548
|
+
React10.useEffect(() => {
|
|
1448
1549
|
if (value !== void 0) {
|
|
1449
1550
|
setActiveTabState(value);
|
|
1450
1551
|
}
|
|
1451
1552
|
}, [value]);
|
|
1452
|
-
const registerTab =
|
|
1553
|
+
const registerTab = React10.useCallback(
|
|
1453
1554
|
(tabValue, element) => {
|
|
1454
1555
|
tabRefs.set(tabValue, element);
|
|
1455
1556
|
},
|
|
@@ -1474,10 +1575,10 @@ var Tabs = React9.forwardRef(({ defaultValue, value, onValueChange, children, ..
|
|
|
1474
1575
|
);
|
|
1475
1576
|
});
|
|
1476
1577
|
Tabs.displayName = "Tabs";
|
|
1477
|
-
var TabsList =
|
|
1578
|
+
var TabsList = React10.forwardRef(({ className, children, variant = "pill", ...props }, ref) => {
|
|
1478
1579
|
const { activeTab, tabRefs, listRef } = useTabsContext();
|
|
1479
|
-
const [indicatorStyle, setIndicatorStyle] =
|
|
1480
|
-
|
|
1580
|
+
const [indicatorStyle, setIndicatorStyle] = React10.useState(null);
|
|
1581
|
+
React10.useEffect(() => {
|
|
1481
1582
|
if (variant !== "pill") return;
|
|
1482
1583
|
const updateIndicator = () => {
|
|
1483
1584
|
if (!activeTab || !listRef.current) return;
|
|
@@ -1530,11 +1631,11 @@ var TabsList = React9.forwardRef(({ className, children, variant = "pill", ...pr
|
|
|
1530
1631
|
) });
|
|
1531
1632
|
});
|
|
1532
1633
|
TabsList.displayName = TabsPrimitive.List.displayName;
|
|
1533
|
-
var TabsTrigger =
|
|
1634
|
+
var TabsTrigger = React10.forwardRef(({ className, value, icon, children, ...props }, ref) => {
|
|
1534
1635
|
const { registerTab, activeTab } = useTabsContext();
|
|
1535
1636
|
const { variant } = useTabsListContext();
|
|
1536
|
-
const triggerRef =
|
|
1537
|
-
|
|
1637
|
+
const triggerRef = React10.useRef(null);
|
|
1638
|
+
React10.useEffect(() => {
|
|
1538
1639
|
registerTab(value, triggerRef.current);
|
|
1539
1640
|
return () => registerTab(value, null);
|
|
1540
1641
|
}, [value, registerTab]);
|
|
@@ -1568,7 +1669,7 @@ var TabsTrigger = React9.forwardRef(({ className, value, icon, children, ...prop
|
|
|
1568
1669
|
);
|
|
1569
1670
|
});
|
|
1570
1671
|
TabsTrigger.displayName = TabsPrimitive.Trigger.displayName;
|
|
1571
|
-
var TabsContent =
|
|
1672
|
+
var TabsContent = React10.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
1572
1673
|
TabsPrimitive.Content,
|
|
1573
1674
|
{
|
|
1574
1675
|
ref,
|
|
@@ -1580,7 +1681,7 @@ var TabsContent = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE
|
|
|
1580
1681
|
}
|
|
1581
1682
|
));
|
|
1582
1683
|
TabsContent.displayName = TabsPrimitive.Content.displayName;
|
|
1583
|
-
var Textarea =
|
|
1684
|
+
var Textarea = React10.forwardRef(
|
|
1584
1685
|
({ className, ...props }, ref) => {
|
|
1585
1686
|
return /* @__PURE__ */ jsx(
|
|
1586
1687
|
"textarea",
|
|
@@ -1822,8 +1923,8 @@ var switchLabelVariants = cva("select-none", {
|
|
|
1822
1923
|
size: "default"
|
|
1823
1924
|
}
|
|
1824
1925
|
});
|
|
1825
|
-
var Switch =
|
|
1826
|
-
const generatedId =
|
|
1926
|
+
var Switch = React10.forwardRef(({ className, size, label, labelPosition = "right", ...props }, ref) => {
|
|
1927
|
+
const generatedId = React10.useId();
|
|
1827
1928
|
const switchId = props.id ?? generatedId;
|
|
1828
1929
|
const switchEl = /* @__PURE__ */ jsx(
|
|
1829
1930
|
SwitchPrimitive.Root,
|
|
@@ -1873,6 +1974,6 @@ var Switch = React9.forwardRef(({ className, size, label, labelPosition = "right
|
|
|
1873
1974
|
});
|
|
1874
1975
|
Switch.displayName = "Switch";
|
|
1875
1976
|
|
|
1876
|
-
export { Button, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Checkbox,
|
|
1877
|
-
//# sourceMappingURL=chunk-
|
|
1878
|
-
//# sourceMappingURL=chunk-
|
|
1977
|
+
export { Button, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Checkbox, ColumnSelection, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, Form, FormControl, FormDescription, FormField, FormLabel, FormMessage, Popover, PopoverAnchor, PopoverContent, PopoverTrigger, SegmentedControl, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator3 as Separator, Skeleton, SkeletonAvatar, SkeletonBadge, SkeletonButton, SkeletonCard, SkeletonIcon, SkeletonInput, SkeletonSubtitle, SkeletonTableRow, SkeletonTableRows, SkeletonText, SkeletonTitle, Switch, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, TableRowCheckbox, TableSelectAll, Tabs, TabsContent, TabsList, TabsTrigger, Textarea, Toggle, buttonVariants, segmentedControlItemVariants, segmentedControlVariants, separatorVariants, switchLabelVariants, switchThumbVariants, switchTrackVariants, toggleGroupVariants, toggleItemVariants, useColumnVisibility, useFormContext, useFormFieldContext, useTableSelection };
|
|
1978
|
+
//# sourceMappingURL=chunk-2PPZNXOQ.mjs.map
|
|
1979
|
+
//# sourceMappingURL=chunk-2PPZNXOQ.mjs.map
|