@pos-360/horizon 0.16.0 → 0.18.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-7WVGPVSG.js → chunk-5XF7Y25B.js} +63 -6
- package/dist/chunk-5XF7Y25B.js.map +1 -0
- package/dist/{chunk-UWBZTH6L.js → chunk-6KBCME37.js} +445 -331
- package/dist/chunk-6KBCME37.js.map +1 -0
- package/dist/{chunk-G36NTARE.mjs → chunk-AORFIAS4.mjs} +29 -33
- package/dist/chunk-AORFIAS4.mjs.map +1 -0
- package/dist/{chunk-KQYOZC7B.mjs → chunk-DNRDNWUF.mjs} +369 -255
- package/dist/chunk-DNRDNWUF.mjs.map +1 -0
- package/dist/{chunk-QCQOCLJH.js → chunk-T7ITROJS.js} +104 -108
- package/dist/chunk-T7ITROJS.js.map +1 -0
- package/dist/{chunk-THQLVDXH.mjs → chunk-UQ66UPWH.mjs} +63 -8
- package/dist/chunk-UQ66UPWH.mjs.map +1 -0
- package/dist/enhanced.d.mts +2 -0
- package/dist/enhanced.d.ts +2 -0
- package/dist/enhanced.js +28 -28
- package/dist/enhanced.mjs +2 -2
- package/dist/index.d.mts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +144 -140
- package/dist/index.mjs +3 -3
- package/dist/primitives.d.mts +28 -2
- package/dist/primitives.d.ts +28 -2
- package/dist/primitives.js +116 -112
- 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-7WVGPVSG.js.map +0 -1
- package/dist/chunk-G36NTARE.mjs.map +0 -1
- package/dist/chunk-KQYOZC7B.mjs.map +0 -1
- package/dist/chunk-QCQOCLJH.js.map +0 -1
- package/dist/chunk-THQLVDXH.mjs.map +0 -1
- package/dist/chunk-UWBZTH6L.js.map +0 -1
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import { cn, Label } from './chunk-
|
|
2
|
-
import * as
|
|
1
|
+
import { cn, Label, Tooltip } from './chunk-UQ66UPWH.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';
|
|
12
12
|
import { AnimatePresence, motion } from 'framer-motion';
|
|
13
13
|
import * as SelectPrimitive from '@radix-ui/react-select';
|
|
14
|
+
import * as RadioGroupPrimitive from '@radix-ui/react-radio-group';
|
|
14
15
|
import * as TabsPrimitive from '@radix-ui/react-tabs';
|
|
15
16
|
import * as ToggleGroupPrimitive from '@radix-ui/react-toggle-group';
|
|
16
|
-
import * as RadioGroupPrimitive from '@radix-ui/react-radio-group';
|
|
17
17
|
import * as SwitchPrimitive from '@radix-ui/react-switch';
|
|
18
18
|
|
|
19
19
|
var buttonVariants = cva(
|
|
@@ -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,
|
|
@@ -615,7 +615,7 @@ var PopoverContent = React9.forwardRef(({ className, align = "center", sideOffse
|
|
|
615
615
|
mass: 0.8
|
|
616
616
|
},
|
|
617
617
|
className: cn(
|
|
618
|
-
"z-50 w-72 rounded-
|
|
618
|
+
"z-50 w-72 rounded-md border border-white/20 bg-white/80 backdrop-blur-xl p-4 text-gray-900 shadow-lg outline-none dark:border-neutral-700/50 dark:bg-neutral-900/80 dark:text-neutral-100 origin-[--radix-popover-content-transform-origin]",
|
|
619
619
|
className
|
|
620
620
|
),
|
|
621
621
|
children
|
|
@@ -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,173 @@ function SkeletonCard({ className }) {
|
|
|
935
936
|
}
|
|
936
937
|
);
|
|
937
938
|
}
|
|
938
|
-
var
|
|
939
|
+
var segmentedControlVariants = cva(
|
|
940
|
+
"inline-flex w-fit items-stretch border border-gray-200 bg-white dark:border-neutral-700 dark:bg-neutral-900",
|
|
941
|
+
{
|
|
942
|
+
variants: {
|
|
943
|
+
size: {
|
|
944
|
+
default: "h-[52px]",
|
|
945
|
+
sm: "h-10",
|
|
946
|
+
lg: "h-[60px]"
|
|
947
|
+
}
|
|
948
|
+
},
|
|
949
|
+
defaultVariants: {
|
|
950
|
+
size: "default"
|
|
951
|
+
}
|
|
952
|
+
}
|
|
953
|
+
);
|
|
954
|
+
var segmentedControlItemVariants = cva(
|
|
955
|
+
"inline-flex flex-1 cursor-pointer items-center justify-center whitespace-nowrap px-6 text-sm font-medium transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-blue-500 focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 disabled:cursor-not-allowed",
|
|
956
|
+
{
|
|
957
|
+
variants: {
|
|
958
|
+
size: {
|
|
959
|
+
default: "h-full min-w-[120px]",
|
|
960
|
+
sm: "h-full min-w-[90px] text-xs",
|
|
961
|
+
lg: "h-full min-w-[140px] text-base"
|
|
962
|
+
}
|
|
963
|
+
},
|
|
964
|
+
defaultVariants: {
|
|
965
|
+
size: "default"
|
|
966
|
+
}
|
|
967
|
+
}
|
|
968
|
+
);
|
|
969
|
+
var containerRadiusClass = {
|
|
970
|
+
none: "rounded-hz-lg",
|
|
971
|
+
sm: "rounded-sm",
|
|
972
|
+
md: "rounded-md",
|
|
973
|
+
lg: "rounded-lg",
|
|
974
|
+
full: "rounded-full"
|
|
975
|
+
};
|
|
976
|
+
var itemRadiusClass = {
|
|
977
|
+
none: "first:rounded-l-hz-lg last:rounded-r-hz-lg",
|
|
978
|
+
sm: "first:rounded-l-sm last:rounded-r-sm",
|
|
979
|
+
md: "first:rounded-l-md last:rounded-r-md",
|
|
980
|
+
lg: "first:rounded-l-lg last:rounded-r-lg",
|
|
981
|
+
full: "rounded-full"
|
|
982
|
+
};
|
|
983
|
+
function SegmentedControl({
|
|
984
|
+
className,
|
|
985
|
+
options,
|
|
986
|
+
value,
|
|
987
|
+
onChange,
|
|
988
|
+
size,
|
|
989
|
+
radius = "none",
|
|
990
|
+
...props
|
|
991
|
+
}) {
|
|
992
|
+
return /* @__PURE__ */ jsx(
|
|
993
|
+
RadioGroupPrimitive.Root,
|
|
994
|
+
{
|
|
995
|
+
...props,
|
|
996
|
+
...value !== void 0 ? { value, onValueChange: onChange } : {},
|
|
997
|
+
className: cn(
|
|
998
|
+
segmentedControlVariants({ size }),
|
|
999
|
+
containerRadiusClass[radius],
|
|
1000
|
+
className
|
|
1001
|
+
),
|
|
1002
|
+
children: options.map((option) => /* @__PURE__ */ jsxs(
|
|
1003
|
+
RadioGroupPrimitive.Item,
|
|
1004
|
+
{
|
|
1005
|
+
value: option.value,
|
|
1006
|
+
disabled: option.disabled,
|
|
1007
|
+
className: cn(
|
|
1008
|
+
segmentedControlItemVariants({ size }),
|
|
1009
|
+
itemRadiusClass[radius],
|
|
1010
|
+
"border border-transparent text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-200",
|
|
1011
|
+
"data-[state=checked]:!bg-blue-50 data-[state=checked]:border-blue-500 data-[state=checked]:text-blue-600",
|
|
1012
|
+
"dark:data-[state=checked]:!bg-blue-950/40 dark:data-[state=checked]:border-blue-400 dark:data-[state=checked]:text-blue-400"
|
|
1013
|
+
),
|
|
1014
|
+
children: [
|
|
1015
|
+
/* @__PURE__ */ jsx(RadioGroupPrimitive.Indicator, { className: "hidden" }),
|
|
1016
|
+
option.label
|
|
1017
|
+
]
|
|
1018
|
+
},
|
|
1019
|
+
option.value
|
|
1020
|
+
))
|
|
1021
|
+
}
|
|
1022
|
+
);
|
|
1023
|
+
}
|
|
1024
|
+
function BulkEditPopover({ column, onApply }) {
|
|
1025
|
+
const [value, setValue] = React10.useState("");
|
|
1026
|
+
const [open, setOpen] = React10.useState(false);
|
|
1027
|
+
const { bulkEdit } = column;
|
|
1028
|
+
if (!bulkEdit) return null;
|
|
1029
|
+
const isValid = bulkEdit.kind === "input" ? !!value.trim() : !!value;
|
|
1030
|
+
const headingLabel = bulkEdit.label ?? column.label;
|
|
1031
|
+
const handleApply = () => {
|
|
1032
|
+
if (!isValid) return;
|
|
1033
|
+
onApply(value);
|
|
1034
|
+
setValue("");
|
|
1035
|
+
setOpen(false);
|
|
1036
|
+
};
|
|
1037
|
+
const handleOpenChange = (next) => {
|
|
1038
|
+
setOpen(next);
|
|
1039
|
+
if (next && bulkEdit.kind === "segmented-control") {
|
|
1040
|
+
setValue(bulkEdit.options[0]?.value ?? "");
|
|
1041
|
+
}
|
|
1042
|
+
if (!next) setValue("");
|
|
1043
|
+
};
|
|
1044
|
+
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: [
|
|
1045
|
+
/* @__PURE__ */ jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsx(
|
|
1046
|
+
"button",
|
|
1047
|
+
{
|
|
1048
|
+
type: "button",
|
|
1049
|
+
onFocus: (e) => e.stopPropagation(),
|
|
1050
|
+
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",
|
|
1051
|
+
"aria-label": `Edit all ${column.label} values`,
|
|
1052
|
+
children: /* @__PURE__ */ jsx(PenLine, { className: "h-3.5 w-3.5" })
|
|
1053
|
+
}
|
|
1054
|
+
) }),
|
|
1055
|
+
/* @__PURE__ */ jsxs(PopoverContent, { align: "start", className: cn("p-3 space-y-3", bulkEdit.kind === "segmented-control" ? "w-auto" : "w-64"), children: [
|
|
1056
|
+
/* @__PURE__ */ jsxs("p", { className: "text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wide", children: [
|
|
1057
|
+
"Apply to all \u2014 ",
|
|
1058
|
+
headingLabel
|
|
1059
|
+
] }),
|
|
1060
|
+
bulkEdit.kind === "input" ? /* @__PURE__ */ jsxs("div", { className: "relative", children: [
|
|
1061
|
+
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 }),
|
|
1062
|
+
/* @__PURE__ */ jsx(
|
|
1063
|
+
"input",
|
|
1064
|
+
{
|
|
1065
|
+
type: bulkEdit.type ?? "text",
|
|
1066
|
+
placeholder: bulkEdit.placeholder,
|
|
1067
|
+
value,
|
|
1068
|
+
onChange: (e) => setValue(e.target.value),
|
|
1069
|
+
onKeyDown: (e) => {
|
|
1070
|
+
if (e.key === "Enter") {
|
|
1071
|
+
e.preventDefault();
|
|
1072
|
+
handleApply();
|
|
1073
|
+
}
|
|
1074
|
+
},
|
|
1075
|
+
autoFocus: true,
|
|
1076
|
+
className: cn(
|
|
1077
|
+
"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",
|
|
1078
|
+
bulkEdit.leadingDecorator ? "pl-7 pr-3" : "px-3"
|
|
1079
|
+
)
|
|
1080
|
+
}
|
|
1081
|
+
)
|
|
1082
|
+
] }) : bulkEdit.kind === "select" ? /* @__PURE__ */ jsxs(Select, { value, onValueChange: setValue, children: [
|
|
1083
|
+
/* @__PURE__ */ jsx(SelectTrigger, { className: "rounded-md", children: /* @__PURE__ */ jsx(SelectValue, { placeholder: bulkEdit.placeholder ?? "Select a value" }) }),
|
|
1084
|
+
/* @__PURE__ */ jsx(SelectContent, { children: bulkEdit.options.map((opt) => /* @__PURE__ */ jsx(SelectItem, { value: opt.value, children: opt.label }, opt.value)) })
|
|
1085
|
+
] }) : /* @__PURE__ */ jsx(
|
|
1086
|
+
SegmentedControl,
|
|
1087
|
+
{
|
|
1088
|
+
className: "w-full",
|
|
1089
|
+
size: "sm",
|
|
1090
|
+
value,
|
|
1091
|
+
onChange: setValue,
|
|
1092
|
+
options: bulkEdit.options
|
|
1093
|
+
}
|
|
1094
|
+
),
|
|
1095
|
+
bulkEdit.kind === "input" && bulkEdit.renderPreview && value && bulkEdit.renderPreview(value),
|
|
1096
|
+
/* @__PURE__ */ jsx(Button, { size: "sm", className: "w-full rounded-md", onClick: handleApply, disabled: !isValid, children: "Apply All" })
|
|
1097
|
+
] })
|
|
1098
|
+
] }) }) });
|
|
1099
|
+
}
|
|
1100
|
+
var TableContext = React10.createContext(null);
|
|
939
1101
|
var useTableContext = () => {
|
|
940
|
-
const context =
|
|
1102
|
+
const context = React10.useContext(TableContext);
|
|
941
1103
|
return context;
|
|
942
1104
|
};
|
|
943
|
-
var TableInner =
|
|
1105
|
+
var TableInner = React10.forwardRef(
|
|
944
1106
|
({
|
|
945
1107
|
className,
|
|
946
1108
|
selectable = false,
|
|
@@ -954,28 +1116,28 @@ var TableInner = React9.forwardRef(
|
|
|
954
1116
|
visibleColumns,
|
|
955
1117
|
showDividers = false,
|
|
956
1118
|
highlightMode = "row",
|
|
1119
|
+
onBulkEdit,
|
|
957
1120
|
children,
|
|
958
1121
|
...props
|
|
959
1122
|
}, ref) => {
|
|
960
|
-
const [internalSelectedRows, setInternalSelectedRows] =
|
|
961
|
-
const [registeredRowIds, setRegisteredRowIds] =
|
|
962
|
-
const
|
|
963
|
-
const [hoveredRowIndex, setHoveredRowIndex] = React9.useState(null);
|
|
1123
|
+
const [internalSelectedRows, setInternalSelectedRows] = React10.useState(/* @__PURE__ */ new Set());
|
|
1124
|
+
const [registeredRowIds, setRegisteredRowIds] = React10.useState(/* @__PURE__ */ new Set());
|
|
1125
|
+
const wrapperRef = React10.useRef(null);
|
|
964
1126
|
const isControlled = controlledSelectedRows !== void 0;
|
|
965
1127
|
const selectedRowsSet = isControlled ? new Set(controlledSelectedRows) : internalSelectedRows;
|
|
966
|
-
const defaultGetRowId =
|
|
1128
|
+
const defaultGetRowId = React10.useCallback((row) => {
|
|
967
1129
|
if (typeof row === "string") return row;
|
|
968
1130
|
if (typeof row === "object" && row?.id) return String(row.id);
|
|
969
1131
|
return String(row);
|
|
970
1132
|
}, []);
|
|
971
1133
|
const finalGetRowId = getRowId || defaultGetRowId;
|
|
972
|
-
const allRowIds =
|
|
1134
|
+
const allRowIds = React10.useMemo(() => {
|
|
973
1135
|
if (rows) {
|
|
974
1136
|
return new Set(rows.map(finalGetRowId));
|
|
975
1137
|
}
|
|
976
1138
|
return registeredRowIds;
|
|
977
1139
|
}, [rows, finalGetRowId, registeredRowIds]);
|
|
978
|
-
const registerRowId =
|
|
1140
|
+
const registerRowId = React10.useCallback((rowId) => {
|
|
979
1141
|
if (rowId) {
|
|
980
1142
|
setRegisteredRowIds((prev) => {
|
|
981
1143
|
if (prev.has(rowId)) return prev;
|
|
@@ -983,7 +1145,7 @@ var TableInner = React9.forwardRef(
|
|
|
983
1145
|
});
|
|
984
1146
|
}
|
|
985
1147
|
}, []);
|
|
986
|
-
const unregisterRowId =
|
|
1148
|
+
const unregisterRowId = React10.useCallback((rowId) => {
|
|
987
1149
|
if (rowId) {
|
|
988
1150
|
setRegisteredRowIds((prev) => {
|
|
989
1151
|
if (!prev.has(rowId)) return prev;
|
|
@@ -993,7 +1155,7 @@ var TableInner = React9.forwardRef(
|
|
|
993
1155
|
});
|
|
994
1156
|
}
|
|
995
1157
|
}, []);
|
|
996
|
-
const toggleRow =
|
|
1158
|
+
const toggleRow = React10.useCallback(
|
|
997
1159
|
(rowId) => {
|
|
998
1160
|
if (!selectable) return;
|
|
999
1161
|
const next = new Set(selectedRowsSet);
|
|
@@ -1018,7 +1180,7 @@ var TableInner = React9.forwardRef(
|
|
|
1018
1180
|
},
|
|
1019
1181
|
[selectable, selectionMode, selectedRowsSet, isControlled, onSelectionChange]
|
|
1020
1182
|
);
|
|
1021
|
-
const selectAll =
|
|
1183
|
+
const selectAll = React10.useCallback(() => {
|
|
1022
1184
|
if (!selectable || selectionMode !== "multiple" || allRowIds.size === 0) return;
|
|
1023
1185
|
const next = new Set(allRowIds);
|
|
1024
1186
|
if (isControlled) {
|
|
@@ -1028,7 +1190,7 @@ var TableInner = React9.forwardRef(
|
|
|
1028
1190
|
onSelectionChange?.(Array.from(next));
|
|
1029
1191
|
}
|
|
1030
1192
|
}, [selectable, selectionMode, allRowIds, isControlled, onSelectionChange]);
|
|
1031
|
-
const deselectAll =
|
|
1193
|
+
const deselectAll = React10.useCallback(() => {
|
|
1032
1194
|
if (!selectable) return;
|
|
1033
1195
|
const next = /* @__PURE__ */ new Set();
|
|
1034
1196
|
if (isControlled) {
|
|
@@ -1038,19 +1200,19 @@ var TableInner = React9.forwardRef(
|
|
|
1038
1200
|
onSelectionChange?.(Array.from(next));
|
|
1039
1201
|
}
|
|
1040
1202
|
}, [selectable, isControlled, onSelectionChange]);
|
|
1041
|
-
const isRowSelected =
|
|
1203
|
+
const isRowSelected = React10.useCallback(
|
|
1042
1204
|
(rowId) => selectedRowsSet.has(rowId),
|
|
1043
1205
|
[selectedRowsSet]
|
|
1044
1206
|
);
|
|
1045
|
-
const isAllSelected =
|
|
1207
|
+
const isAllSelected = React10.useMemo(() => {
|
|
1046
1208
|
if (!selectable || allRowIds.size === 0) return false;
|
|
1047
1209
|
return allRowIds.size > 0 && Array.from(allRowIds).every((id) => selectedRowsSet.has(id));
|
|
1048
1210
|
}, [selectable, allRowIds, selectedRowsSet]);
|
|
1049
|
-
const isSomeSelected =
|
|
1211
|
+
const isSomeSelected = React10.useMemo(() => {
|
|
1050
1212
|
if (!selectable) return false;
|
|
1051
1213
|
return selectedRowsSet.size > 0 && !isAllSelected;
|
|
1052
1214
|
}, [selectable, selectedRowsSet.size, isAllSelected]);
|
|
1053
|
-
const contextValue =
|
|
1215
|
+
const contextValue = React10.useMemo(() => ({
|
|
1054
1216
|
selectable,
|
|
1055
1217
|
selectionMode,
|
|
1056
1218
|
selectedRows: selectedRowsSet,
|
|
@@ -1077,14 +1239,54 @@ var TableInner = React9.forwardRef(
|
|
|
1077
1239
|
registerRowId,
|
|
1078
1240
|
unregisterRowId
|
|
1079
1241
|
]);
|
|
1242
|
+
React10.useEffect(() => {
|
|
1243
|
+
const wrapper = wrapperRef.current;
|
|
1244
|
+
if (!wrapper || highlightMode === "none") return;
|
|
1245
|
+
let prevCell = null;
|
|
1246
|
+
let highlighted = [];
|
|
1247
|
+
const getHighlightBg = () => document.documentElement.classList.contains("dark") ? "rgba(38, 38, 38, 0.5)" : "rgb(249, 250, 251)";
|
|
1248
|
+
const clearHighlight = () => {
|
|
1249
|
+
for (const el of highlighted) el.style.removeProperty("background-color");
|
|
1250
|
+
highlighted = [];
|
|
1251
|
+
};
|
|
1252
|
+
const handleMouseMove = (e) => {
|
|
1253
|
+
const cell = e.target.closest("td, th");
|
|
1254
|
+
if (cell === prevCell) return;
|
|
1255
|
+
prevCell = cell;
|
|
1256
|
+
clearHighlight();
|
|
1257
|
+
if (!cell) return;
|
|
1258
|
+
const next = [];
|
|
1259
|
+
const tr = cell.closest("tr");
|
|
1260
|
+
const colKey = cell.getAttribute("data-col-key");
|
|
1261
|
+
if ((highlightMode === "row" || highlightMode === "cross") && tr) {
|
|
1262
|
+
next.push(...Array.from(tr.querySelectorAll("td, th")));
|
|
1263
|
+
}
|
|
1264
|
+
if ((highlightMode === "column" || highlightMode === "cross") && colKey) {
|
|
1265
|
+
for (const el of Array.from(wrapper.querySelectorAll(`[data-col-key="${colKey}"]`))) {
|
|
1266
|
+
if (!next.includes(el)) next.push(el);
|
|
1267
|
+
}
|
|
1268
|
+
}
|
|
1269
|
+
const bg = getHighlightBg();
|
|
1270
|
+
for (const el of next) el.style.setProperty("background-color", bg, "important");
|
|
1271
|
+
highlighted = next;
|
|
1272
|
+
};
|
|
1273
|
+
const handleMouseLeave = () => {
|
|
1274
|
+
prevCell = null;
|
|
1275
|
+
clearHighlight();
|
|
1276
|
+
};
|
|
1277
|
+
wrapper.addEventListener("mousemove", handleMouseMove, { passive: true });
|
|
1278
|
+
wrapper.addEventListener("mouseleave", handleMouseLeave);
|
|
1279
|
+
return () => {
|
|
1280
|
+
wrapper.removeEventListener("mousemove", handleMouseMove);
|
|
1281
|
+
wrapper.removeEventListener("mouseleave", handleMouseLeave);
|
|
1282
|
+
clearHighlight();
|
|
1283
|
+
};
|
|
1284
|
+
}, [highlightMode]);
|
|
1080
1285
|
return /* @__PURE__ */ jsx(TableContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsx(
|
|
1081
1286
|
"div",
|
|
1082
1287
|
{
|
|
1288
|
+
ref: wrapperRef,
|
|
1083
1289
|
className: "relative w-full overflow-auto",
|
|
1084
|
-
onMouseLeave: () => {
|
|
1085
|
-
setHoveredCol(null);
|
|
1086
|
-
setHoveredRowIndex(null);
|
|
1087
|
-
},
|
|
1088
1290
|
children: /* @__PURE__ */ jsx(
|
|
1089
1291
|
"table",
|
|
1090
1292
|
{
|
|
@@ -1096,50 +1298,47 @@ var TableInner = React9.forwardRef(
|
|
|
1096
1298
|
(col) => col.sticky || !visibleColumns || visibleColumns.includes(col.key)
|
|
1097
1299
|
);
|
|
1098
1300
|
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
|
-
|
|
1301
|
+
/* @__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(
|
|
1302
|
+
"th",
|
|
1303
|
+
{
|
|
1304
|
+
"data-col-key": col.key,
|
|
1305
|
+
style: col.minWidth ? { minWidth: col.minWidth } : void 0,
|
|
1306
|
+
className: cn(
|
|
1307
|
+
"h-12 px-4 text-left align-middle font-medium text-gray-500 dark:text-gray-400",
|
|
1308
|
+
col.sticky && "sticky left-0 z-20 bg-white dark:bg-neutral-900",
|
|
1309
|
+
showDividers && "border-r border-gray-200 dark:border-neutral-700"
|
|
1310
|
+
),
|
|
1311
|
+
children: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1", children: [
|
|
1312
|
+
col.label,
|
|
1313
|
+
col.bulkEdit && onBulkEdit && /* @__PURE__ */ jsx(
|
|
1314
|
+
BulkEditPopover,
|
|
1315
|
+
{
|
|
1316
|
+
column: col,
|
|
1317
|
+
onApply: (value) => onBulkEdit(col.key, value)
|
|
1318
|
+
}
|
|
1319
|
+
)
|
|
1320
|
+
] })
|
|
1321
|
+
},
|
|
1322
|
+
col.key
|
|
1323
|
+
)) }) }),
|
|
1118
1324
|
/* @__PURE__ */ jsx("tbody", { className: "[&_tr:last-child]:border-0", children: data.map((row, rowIndex) => /* @__PURE__ */ jsx(
|
|
1119
1325
|
"tr",
|
|
1120
1326
|
{
|
|
1121
1327
|
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
|
-
|
|
1136
|
-
showDividers && "border-r border-gray-200 dark:border-neutral-700"
|
|
1137
|
-
),
|
|
1138
|
-
children: col.cell(row)
|
|
1139
|
-
},
|
|
1140
|
-
col.key
|
|
1141
|
-
);
|
|
1142
|
-
})
|
|
1328
|
+
children: visibleCols.map((col) => /* @__PURE__ */ jsx(
|
|
1329
|
+
"td",
|
|
1330
|
+
{
|
|
1331
|
+
"data-col-key": col.key,
|
|
1332
|
+
className: cn(
|
|
1333
|
+
"p-4 align-middle",
|
|
1334
|
+
col.sticky && "sticky left-0 z-20 bg-white dark:bg-neutral-900",
|
|
1335
|
+
showDividers && "border-r border-gray-200 dark:border-neutral-700",
|
|
1336
|
+
typeof col.cellClassName === "function" ? col.cellClassName(row) : col.cellClassName
|
|
1337
|
+
),
|
|
1338
|
+
children: col.cell(row)
|
|
1339
|
+
},
|
|
1340
|
+
col.key
|
|
1341
|
+
))
|
|
1143
1342
|
},
|
|
1144
1343
|
finalGetRowId ? finalGetRowId(row) : rowIndex
|
|
1145
1344
|
)) })
|
|
@@ -1153,7 +1352,7 @@ var TableInner = React9.forwardRef(
|
|
|
1153
1352
|
);
|
|
1154
1353
|
TableInner.displayName = "Table";
|
|
1155
1354
|
var Table = TableInner;
|
|
1156
|
-
var TableHeader =
|
|
1355
|
+
var TableHeader = React10.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
1157
1356
|
"thead",
|
|
1158
1357
|
{
|
|
1159
1358
|
ref,
|
|
@@ -1162,7 +1361,7 @@ var TableHeader = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE
|
|
|
1162
1361
|
}
|
|
1163
1362
|
));
|
|
1164
1363
|
TableHeader.displayName = "TableHeader";
|
|
1165
|
-
var TableBody =
|
|
1364
|
+
var TableBody = React10.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
1166
1365
|
"tbody",
|
|
1167
1366
|
{
|
|
1168
1367
|
ref,
|
|
@@ -1171,7 +1370,7 @@ var TableBody = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__
|
|
|
1171
1370
|
}
|
|
1172
1371
|
));
|
|
1173
1372
|
TableBody.displayName = "TableBody";
|
|
1174
|
-
var TableFooter =
|
|
1373
|
+
var TableFooter = React10.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
1175
1374
|
"tfoot",
|
|
1176
1375
|
{
|
|
1177
1376
|
ref,
|
|
@@ -1183,19 +1382,19 @@ var TableFooter = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE
|
|
|
1183
1382
|
}
|
|
1184
1383
|
));
|
|
1185
1384
|
TableFooter.displayName = "TableFooter";
|
|
1186
|
-
var TableRow =
|
|
1385
|
+
var TableRow = React10.forwardRef(
|
|
1187
1386
|
({ className, rowId, rowData, onClick, ...props }, ref) => {
|
|
1188
1387
|
const context = useTableContext();
|
|
1189
1388
|
const getRowId = context?.getRowId;
|
|
1190
1389
|
const selectable = context?.selectable;
|
|
1191
1390
|
const registerRowId = context?.registerRowId;
|
|
1192
1391
|
const unregisterRowId = context?.unregisterRowId;
|
|
1193
|
-
const finalRowId =
|
|
1392
|
+
const finalRowId = React10.useMemo(() => {
|
|
1194
1393
|
if (rowId) return rowId;
|
|
1195
1394
|
if (rowData && getRowId) return getRowId(rowData);
|
|
1196
1395
|
return props.id || void 0;
|
|
1197
1396
|
}, [rowId, rowData, getRowId, props.id]);
|
|
1198
|
-
|
|
1397
|
+
React10.useEffect(() => {
|
|
1199
1398
|
if (finalRowId && selectable) {
|
|
1200
1399
|
registerRowId?.(finalRowId);
|
|
1201
1400
|
return () => {
|
|
@@ -1204,7 +1403,7 @@ var TableRow = React9.forwardRef(
|
|
|
1204
1403
|
}
|
|
1205
1404
|
}, [finalRowId, selectable, registerRowId, unregisterRowId]);
|
|
1206
1405
|
const isSelected = finalRowId ? context?.isRowSelected(finalRowId) : false;
|
|
1207
|
-
const handleClick =
|
|
1406
|
+
const handleClick = React10.useCallback(
|
|
1208
1407
|
(e) => {
|
|
1209
1408
|
onClick?.(e);
|
|
1210
1409
|
},
|
|
@@ -1227,7 +1426,7 @@ var TableRow = React9.forwardRef(
|
|
|
1227
1426
|
}
|
|
1228
1427
|
);
|
|
1229
1428
|
TableRow.displayName = "TableRow";
|
|
1230
|
-
var TableHead =
|
|
1429
|
+
var TableHead = React10.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
1231
1430
|
"th",
|
|
1232
1431
|
{
|
|
1233
1432
|
ref,
|
|
@@ -1239,7 +1438,7 @@ var TableHead = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__
|
|
|
1239
1438
|
}
|
|
1240
1439
|
));
|
|
1241
1440
|
TableHead.displayName = "TableHead";
|
|
1242
|
-
var TableCell =
|
|
1441
|
+
var TableCell = React10.forwardRef(
|
|
1243
1442
|
({ className, variant = "default", ...props }, ref) => /* @__PURE__ */ jsx(
|
|
1244
1443
|
"td",
|
|
1245
1444
|
{
|
|
@@ -1254,7 +1453,7 @@ var TableCell = React9.forwardRef(
|
|
|
1254
1453
|
)
|
|
1255
1454
|
);
|
|
1256
1455
|
TableCell.displayName = "TableCell";
|
|
1257
|
-
var TableCaption =
|
|
1456
|
+
var TableCaption = React10.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
1258
1457
|
"caption",
|
|
1259
1458
|
{
|
|
1260
1459
|
ref,
|
|
@@ -1263,7 +1462,7 @@ var TableCaption = React9.forwardRef(({ className, ...props }, ref) => /* @__PUR
|
|
|
1263
1462
|
}
|
|
1264
1463
|
));
|
|
1265
1464
|
TableCaption.displayName = "TableCaption";
|
|
1266
|
-
var TableSelectAll =
|
|
1465
|
+
var TableSelectAll = React10.forwardRef(({ className, ...props }, ref) => {
|
|
1267
1466
|
const context = useTableContext();
|
|
1268
1467
|
if (!context?.selectable || context.selectionMode !== "multiple") {
|
|
1269
1468
|
return null;
|
|
@@ -1286,13 +1485,13 @@ var TableSelectAll = React9.forwardRef(({ className, ...props }, ref) => {
|
|
|
1286
1485
|
) });
|
|
1287
1486
|
});
|
|
1288
1487
|
TableSelectAll.displayName = "TableSelectAll";
|
|
1289
|
-
var TableRowCheckbox =
|
|
1488
|
+
var TableRowCheckbox = React10.forwardRef(({ rowId, rowData, className, ...props }, ref) => {
|
|
1290
1489
|
const context = useTableContext();
|
|
1291
1490
|
const getRowId = context?.getRowId;
|
|
1292
1491
|
if (!context?.selectable) {
|
|
1293
1492
|
return null;
|
|
1294
1493
|
}
|
|
1295
|
-
const finalRowId =
|
|
1494
|
+
const finalRowId = React10.useMemo(() => {
|
|
1296
1495
|
if (rowId) return rowId;
|
|
1297
1496
|
if (rowData && getRowId) return getRowId(rowData);
|
|
1298
1497
|
return void 0;
|
|
@@ -1374,10 +1573,10 @@ function ColumnSelection({
|
|
|
1374
1573
|
columns,
|
|
1375
1574
|
visibleColumns,
|
|
1376
1575
|
onVisibleColumnsChange,
|
|
1377
|
-
triggerLabel = "Columns",
|
|
1576
|
+
triggerLabel = "Manage Columns",
|
|
1378
1577
|
trigger
|
|
1379
1578
|
}) {
|
|
1380
|
-
const handleToggle =
|
|
1579
|
+
const handleToggle = React10.useCallback((key, checked) => {
|
|
1381
1580
|
if (checked) {
|
|
1382
1581
|
if (!visibleColumns.includes(key)) {
|
|
1383
1582
|
onVisibleColumnsChange([...visibleColumns, key]);
|
|
@@ -1424,33 +1623,33 @@ function ColumnSelection({
|
|
|
1424
1623
|
] })
|
|
1425
1624
|
] });
|
|
1426
1625
|
}
|
|
1427
|
-
var TabsContext =
|
|
1626
|
+
var TabsContext = React10.createContext(null);
|
|
1428
1627
|
var useTabsContext = () => {
|
|
1429
|
-
const context =
|
|
1628
|
+
const context = React10.useContext(TabsContext);
|
|
1430
1629
|
if (!context) {
|
|
1431
1630
|
throw new Error("Tabs components must be used within a Tabs provider");
|
|
1432
1631
|
}
|
|
1433
1632
|
return context;
|
|
1434
1633
|
};
|
|
1435
|
-
var TabsListContext =
|
|
1436
|
-
var useTabsListContext = () =>
|
|
1437
|
-
var Tabs =
|
|
1438
|
-
const [activeTab, setActiveTabState] =
|
|
1439
|
-
const tabRefs =
|
|
1440
|
-
const listRef =
|
|
1441
|
-
const setActiveTab =
|
|
1634
|
+
var TabsListContext = React10.createContext({ variant: "pill" });
|
|
1635
|
+
var useTabsListContext = () => React10.useContext(TabsListContext);
|
|
1636
|
+
var Tabs = React10.forwardRef(({ defaultValue, value, onValueChange, children, ...props }, ref) => {
|
|
1637
|
+
const [activeTab, setActiveTabState] = React10.useState(value ?? defaultValue);
|
|
1638
|
+
const tabRefs = React10.useRef(/* @__PURE__ */ new Map()).current;
|
|
1639
|
+
const listRef = React10.useRef(null);
|
|
1640
|
+
const setActiveTab = React10.useCallback(
|
|
1442
1641
|
(newValue) => {
|
|
1443
1642
|
setActiveTabState(newValue);
|
|
1444
1643
|
onValueChange?.(newValue);
|
|
1445
1644
|
},
|
|
1446
1645
|
[onValueChange]
|
|
1447
1646
|
);
|
|
1448
|
-
|
|
1647
|
+
React10.useEffect(() => {
|
|
1449
1648
|
if (value !== void 0) {
|
|
1450
1649
|
setActiveTabState(value);
|
|
1451
1650
|
}
|
|
1452
1651
|
}, [value]);
|
|
1453
|
-
const registerTab =
|
|
1652
|
+
const registerTab = React10.useCallback(
|
|
1454
1653
|
(tabValue, element) => {
|
|
1455
1654
|
tabRefs.set(tabValue, element);
|
|
1456
1655
|
},
|
|
@@ -1475,10 +1674,10 @@ var Tabs = React9.forwardRef(({ defaultValue, value, onValueChange, children, ..
|
|
|
1475
1674
|
);
|
|
1476
1675
|
});
|
|
1477
1676
|
Tabs.displayName = "Tabs";
|
|
1478
|
-
var TabsList =
|
|
1677
|
+
var TabsList = React10.forwardRef(({ className, children, variant = "pill", ...props }, ref) => {
|
|
1479
1678
|
const { activeTab, tabRefs, listRef } = useTabsContext();
|
|
1480
|
-
const [indicatorStyle, setIndicatorStyle] =
|
|
1481
|
-
|
|
1679
|
+
const [indicatorStyle, setIndicatorStyle] = React10.useState(null);
|
|
1680
|
+
React10.useEffect(() => {
|
|
1482
1681
|
if (variant !== "pill") return;
|
|
1483
1682
|
const updateIndicator = () => {
|
|
1484
1683
|
if (!activeTab || !listRef.current) return;
|
|
@@ -1531,11 +1730,11 @@ var TabsList = React9.forwardRef(({ className, children, variant = "pill", ...pr
|
|
|
1531
1730
|
) });
|
|
1532
1731
|
});
|
|
1533
1732
|
TabsList.displayName = TabsPrimitive.List.displayName;
|
|
1534
|
-
var TabsTrigger =
|
|
1733
|
+
var TabsTrigger = React10.forwardRef(({ className, value, icon, children, ...props }, ref) => {
|
|
1535
1734
|
const { registerTab, activeTab } = useTabsContext();
|
|
1536
1735
|
const { variant } = useTabsListContext();
|
|
1537
|
-
const triggerRef =
|
|
1538
|
-
|
|
1736
|
+
const triggerRef = React10.useRef(null);
|
|
1737
|
+
React10.useEffect(() => {
|
|
1539
1738
|
registerTab(value, triggerRef.current);
|
|
1540
1739
|
return () => registerTab(value, null);
|
|
1541
1740
|
}, [value, registerTab]);
|
|
@@ -1569,7 +1768,7 @@ var TabsTrigger = React9.forwardRef(({ className, value, icon, children, ...prop
|
|
|
1569
1768
|
);
|
|
1570
1769
|
});
|
|
1571
1770
|
TabsTrigger.displayName = TabsPrimitive.Trigger.displayName;
|
|
1572
|
-
var TabsContent =
|
|
1771
|
+
var TabsContent = React10.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
1573
1772
|
TabsPrimitive.Content,
|
|
1574
1773
|
{
|
|
1575
1774
|
ref,
|
|
@@ -1581,7 +1780,7 @@ var TabsContent = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE
|
|
|
1581
1780
|
}
|
|
1582
1781
|
));
|
|
1583
1782
|
TabsContent.displayName = TabsPrimitive.Content.displayName;
|
|
1584
|
-
var Textarea =
|
|
1783
|
+
var Textarea = React10.forwardRef(
|
|
1585
1784
|
({ className, ...props }, ref) => {
|
|
1586
1785
|
return /* @__PURE__ */ jsx(
|
|
1587
1786
|
"textarea",
|
|
@@ -1636,14 +1835,14 @@ var toggleItemVariants = cva(
|
|
|
1636
1835
|
}
|
|
1637
1836
|
}
|
|
1638
1837
|
);
|
|
1639
|
-
var
|
|
1838
|
+
var containerRadiusClass2 = {
|
|
1640
1839
|
none: "rounded-hz-lg",
|
|
1641
1840
|
sm: "rounded-sm",
|
|
1642
1841
|
md: "rounded-md",
|
|
1643
1842
|
lg: "rounded-lg",
|
|
1644
1843
|
full: "rounded-full"
|
|
1645
1844
|
};
|
|
1646
|
-
var
|
|
1845
|
+
var itemRadiusClass2 = {
|
|
1647
1846
|
none: "first:rounded-l-hz-lg last:rounded-r-hz-lg",
|
|
1648
1847
|
sm: "first:rounded-l-sm last:rounded-r-sm",
|
|
1649
1848
|
md: "first:rounded-l-md last:rounded-r-md",
|
|
@@ -1667,7 +1866,7 @@ function Toggle({
|
|
|
1667
1866
|
...value !== void 0 ? { value, onValueChange: onChange } : {},
|
|
1668
1867
|
className: cn(
|
|
1669
1868
|
toggleGroupVariants({ size }),
|
|
1670
|
-
|
|
1869
|
+
containerRadiusClass2[radius],
|
|
1671
1870
|
className
|
|
1672
1871
|
),
|
|
1673
1872
|
children: options.map((option) => {
|
|
@@ -1680,7 +1879,7 @@ function Toggle({
|
|
|
1680
1879
|
"aria-label": iconOnly ? option.ariaLabel ?? option.value : void 0,
|
|
1681
1880
|
className: cn(
|
|
1682
1881
|
toggleItemVariants({ size, iconOnly }),
|
|
1683
|
-
|
|
1882
|
+
itemRadiusClass2[radius],
|
|
1684
1883
|
"border border-transparent text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-200",
|
|
1685
1884
|
"data-[state=on]:!bg-blue-50 data-[state=on]:border-blue-500 data-[state=on]:text-blue-600",
|
|
1686
1885
|
"dark:data-[state=on]:!bg-blue-950/40 dark:data-[state=on]:border-blue-400 dark:data-[state=on]:text-blue-400"
|
|
@@ -1696,91 +1895,6 @@ function Toggle({
|
|
|
1696
1895
|
}
|
|
1697
1896
|
);
|
|
1698
1897
|
}
|
|
1699
|
-
var segmentedControlVariants = cva(
|
|
1700
|
-
"inline-flex w-fit items-stretch border border-gray-200 bg-white dark:border-neutral-700 dark:bg-neutral-900",
|
|
1701
|
-
{
|
|
1702
|
-
variants: {
|
|
1703
|
-
size: {
|
|
1704
|
-
default: "h-[52px]",
|
|
1705
|
-
sm: "h-10",
|
|
1706
|
-
lg: "h-[60px]"
|
|
1707
|
-
}
|
|
1708
|
-
},
|
|
1709
|
-
defaultVariants: {
|
|
1710
|
-
size: "default"
|
|
1711
|
-
}
|
|
1712
|
-
}
|
|
1713
|
-
);
|
|
1714
|
-
var segmentedControlItemVariants = cva(
|
|
1715
|
-
"inline-flex flex-1 cursor-pointer items-center justify-center whitespace-nowrap px-6 text-sm font-medium transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-blue-500 focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 disabled:cursor-not-allowed",
|
|
1716
|
-
{
|
|
1717
|
-
variants: {
|
|
1718
|
-
size: {
|
|
1719
|
-
default: "h-full min-w-[120px]",
|
|
1720
|
-
sm: "h-full min-w-[90px] text-xs",
|
|
1721
|
-
lg: "h-full min-w-[140px] text-base"
|
|
1722
|
-
}
|
|
1723
|
-
},
|
|
1724
|
-
defaultVariants: {
|
|
1725
|
-
size: "default"
|
|
1726
|
-
}
|
|
1727
|
-
}
|
|
1728
|
-
);
|
|
1729
|
-
var containerRadiusClass2 = {
|
|
1730
|
-
none: "rounded-hz-lg",
|
|
1731
|
-
sm: "rounded-sm",
|
|
1732
|
-
md: "rounded-md",
|
|
1733
|
-
lg: "rounded-lg",
|
|
1734
|
-
full: "rounded-full"
|
|
1735
|
-
};
|
|
1736
|
-
var itemRadiusClass2 = {
|
|
1737
|
-
none: "first:rounded-l-hz-lg last:rounded-r-hz-lg",
|
|
1738
|
-
sm: "first:rounded-l-sm last:rounded-r-sm",
|
|
1739
|
-
md: "first:rounded-l-md last:rounded-r-md",
|
|
1740
|
-
lg: "first:rounded-l-lg last:rounded-r-lg",
|
|
1741
|
-
full: "rounded-full"
|
|
1742
|
-
};
|
|
1743
|
-
function SegmentedControl({
|
|
1744
|
-
className,
|
|
1745
|
-
options,
|
|
1746
|
-
value,
|
|
1747
|
-
onChange,
|
|
1748
|
-
size,
|
|
1749
|
-
radius = "none",
|
|
1750
|
-
...props
|
|
1751
|
-
}) {
|
|
1752
|
-
return /* @__PURE__ */ jsx(
|
|
1753
|
-
RadioGroupPrimitive.Root,
|
|
1754
|
-
{
|
|
1755
|
-
...props,
|
|
1756
|
-
...value !== void 0 ? { value, onValueChange: onChange } : {},
|
|
1757
|
-
className: cn(
|
|
1758
|
-
segmentedControlVariants({ size }),
|
|
1759
|
-
containerRadiusClass2[radius],
|
|
1760
|
-
className
|
|
1761
|
-
),
|
|
1762
|
-
children: options.map((option) => /* @__PURE__ */ jsxs(
|
|
1763
|
-
RadioGroupPrimitive.Item,
|
|
1764
|
-
{
|
|
1765
|
-
value: option.value,
|
|
1766
|
-
disabled: option.disabled,
|
|
1767
|
-
className: cn(
|
|
1768
|
-
segmentedControlItemVariants({ size }),
|
|
1769
|
-
itemRadiusClass2[radius],
|
|
1770
|
-
"border border-transparent text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-200",
|
|
1771
|
-
"data-[state=checked]:!bg-blue-50 data-[state=checked]:border-blue-500 data-[state=checked]:text-blue-600",
|
|
1772
|
-
"dark:data-[state=checked]:!bg-blue-950/40 dark:data-[state=checked]:border-blue-400 dark:data-[state=checked]:text-blue-400"
|
|
1773
|
-
),
|
|
1774
|
-
children: [
|
|
1775
|
-
/* @__PURE__ */ jsx(RadioGroupPrimitive.Indicator, { className: "hidden" }),
|
|
1776
|
-
option.label
|
|
1777
|
-
]
|
|
1778
|
-
},
|
|
1779
|
-
option.value
|
|
1780
|
-
))
|
|
1781
|
-
}
|
|
1782
|
-
);
|
|
1783
|
-
}
|
|
1784
1898
|
var switchTrackVariants = cva(
|
|
1785
1899
|
"peer inline-flex shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-blue-500 focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-blue-600 data-[state=unchecked]:bg-gray-200 dark:data-[state=checked]:bg-blue-500 dark:data-[state=unchecked]:bg-neutral-700",
|
|
1786
1900
|
{
|
|
@@ -1823,8 +1937,8 @@ var switchLabelVariants = cva("select-none", {
|
|
|
1823
1937
|
size: "default"
|
|
1824
1938
|
}
|
|
1825
1939
|
});
|
|
1826
|
-
var Switch =
|
|
1827
|
-
const generatedId =
|
|
1940
|
+
var Switch = React10.forwardRef(({ className, size, label, labelPosition = "right", ...props }, ref) => {
|
|
1941
|
+
const generatedId = React10.useId();
|
|
1828
1942
|
const switchId = props.id ?? generatedId;
|
|
1829
1943
|
const switchEl = /* @__PURE__ */ jsx(
|
|
1830
1944
|
SwitchPrimitive.Root,
|
|
@@ -1875,5 +1989,5 @@ var Switch = React9.forwardRef(({ className, size, label, labelPosition = "right
|
|
|
1875
1989
|
Switch.displayName = "Switch";
|
|
1876
1990
|
|
|
1877
1991
|
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 };
|
|
1878
|
-
//# sourceMappingURL=chunk-
|
|
1879
|
-
//# sourceMappingURL=chunk-
|
|
1992
|
+
//# sourceMappingURL=chunk-DNRDNWUF.mjs.map
|
|
1993
|
+
//# sourceMappingURL=chunk-DNRDNWUF.mjs.map
|