@pos-360/horizon 0.6.2 → 0.7.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.
@@ -1,5 +1,5 @@
1
1
  import { cn, Label } from './chunk-E3UN74IA.mjs';
2
- import * as React6 from 'react';
2
+ import * as React9 from 'react';
3
3
  import { Slot } from '@radix-ui/react-slot';
4
4
  import { cva } from 'class-variance-authority';
5
5
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
@@ -37,7 +37,7 @@ var buttonVariants = cva(
37
37
  }
38
38
  }
39
39
  );
40
- var Button = React6.forwardRef(
40
+ var Button = React9.forwardRef(
41
41
  ({
42
42
  className,
43
43
  variant,
@@ -77,7 +77,7 @@ var Button = React6.forwardRef(
77
77
  }
78
78
  );
79
79
  Button.displayName = "Button";
80
- var Card = React6.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
80
+ var Card = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
81
81
  "div",
82
82
  {
83
83
  ref,
@@ -89,7 +89,7 @@ var Card = React6.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ j
89
89
  }
90
90
  ));
91
91
  Card.displayName = "Card";
92
- var CardHeader = React6.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
92
+ var CardHeader = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
93
93
  "div",
94
94
  {
95
95
  ref,
@@ -98,7 +98,7 @@ var CardHeader = React6.forwardRef(({ className, ...props }, ref) => /* @__PURE_
98
98
  }
99
99
  ));
100
100
  CardHeader.displayName = "CardHeader";
101
- var CardTitle = React6.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
101
+ var CardTitle = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
102
102
  "div",
103
103
  {
104
104
  ref,
@@ -107,7 +107,7 @@ var CardTitle = React6.forwardRef(({ className, ...props }, ref) => /* @__PURE__
107
107
  }
108
108
  ));
109
109
  CardTitle.displayName = "CardTitle";
110
- var CardDescription = React6.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
110
+ var CardDescription = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
111
111
  "div",
112
112
  {
113
113
  ref,
@@ -116,7 +116,7 @@ var CardDescription = React6.forwardRef(({ className, ...props }, ref) => /* @__
116
116
  }
117
117
  ));
118
118
  CardDescription.displayName = "CardDescription";
119
- var CardContent = React6.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
119
+ var CardContent = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
120
120
  "div",
121
121
  {
122
122
  ref,
@@ -125,7 +125,7 @@ var CardContent = React6.forwardRef(({ className, ...props }, ref) => /* @__PURE
125
125
  }
126
126
  ));
127
127
  CardContent.displayName = "CardContent";
128
- var CardFooter = React6.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
128
+ var CardFooter = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
129
129
  "div",
130
130
  {
131
131
  ref,
@@ -134,7 +134,7 @@ var CardFooter = React6.forwardRef(({ className, ...props }, ref) => /* @__PURE_
134
134
  }
135
135
  ));
136
136
  CardFooter.displayName = "CardFooter";
137
- var Checkbox = React6.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
137
+ var Checkbox = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
138
138
  CheckboxPrimitive.Root,
139
139
  {
140
140
  ref,
@@ -157,7 +157,7 @@ var Dialog = DialogPrimitive.Root;
157
157
  var DialogTrigger = DialogPrimitive.Trigger;
158
158
  var DialogPortal = DialogPrimitive.Portal;
159
159
  var DialogClose = DialogPrimitive.Close;
160
- var DialogOverlay = React6.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
160
+ var DialogOverlay = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
161
161
  DialogPrimitive.Overlay,
162
162
  {
163
163
  ref,
@@ -169,7 +169,7 @@ var DialogOverlay = React6.forwardRef(({ className, ...props }, ref) => /* @__PU
169
169
  }
170
170
  ));
171
171
  DialogOverlay.displayName = DialogPrimitive.Overlay.displayName;
172
- var DialogContent = React6.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs(DialogPortal, { children: [
172
+ var DialogContent = React9.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs(DialogPortal, { children: [
173
173
  /* @__PURE__ */ jsx(DialogOverlay, {}),
174
174
  /* @__PURE__ */ jsxs(
175
175
  DialogPrimitive.Content,
@@ -219,7 +219,7 @@ var DialogFooter = ({
219
219
  }
220
220
  );
221
221
  DialogFooter.displayName = "DialogFooter";
222
- var DialogTitle = React6.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
222
+ var DialogTitle = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
223
223
  DialogPrimitive.Title,
224
224
  {
225
225
  ref,
@@ -231,7 +231,7 @@ var DialogTitle = React6.forwardRef(({ className, ...props }, ref) => /* @__PURE
231
231
  }
232
232
  ));
233
233
  DialogTitle.displayName = DialogPrimitive.Title.displayName;
234
- var DialogDescription = React6.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
234
+ var DialogDescription = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
235
235
  DialogPrimitive.Description,
236
236
  {
237
237
  ref,
@@ -246,7 +246,7 @@ var DropdownMenuGroup = DropdownMenuPrimitive.Group;
246
246
  var DropdownMenuPortal = DropdownMenuPrimitive.Portal;
247
247
  var DropdownMenuSub = DropdownMenuPrimitive.Sub;
248
248
  var DropdownMenuRadioGroup = DropdownMenuPrimitive.RadioGroup;
249
- var DropdownMenuSubTrigger = React6.forwardRef(({ className, inset, children, ...props }, ref) => /* @__PURE__ */ jsxs(
249
+ var DropdownMenuSubTrigger = React9.forwardRef(({ className, inset, children, ...props }, ref) => /* @__PURE__ */ jsxs(
250
250
  DropdownMenuPrimitive.SubTrigger,
251
251
  {
252
252
  ref,
@@ -263,7 +263,7 @@ var DropdownMenuSubTrigger = React6.forwardRef(({ className, inset, children, ..
263
263
  }
264
264
  ));
265
265
  DropdownMenuSubTrigger.displayName = DropdownMenuPrimitive.SubTrigger.displayName;
266
- var DropdownMenuSubContent = React6.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
266
+ var DropdownMenuSubContent = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
267
267
  DropdownMenuPrimitive.SubContent,
268
268
  {
269
269
  ref,
@@ -275,7 +275,7 @@ var DropdownMenuSubContent = React6.forwardRef(({ className, ...props }, ref) =>
275
275
  }
276
276
  ));
277
277
  DropdownMenuSubContent.displayName = DropdownMenuPrimitive.SubContent.displayName;
278
- var DropdownMenuContent = React6.forwardRef(({ className, sideOffset = 4, ...props }, ref) => /* @__PURE__ */ jsx(DropdownMenuPrimitive.Portal, { children: /* @__PURE__ */ jsx(
278
+ var DropdownMenuContent = React9.forwardRef(({ className, sideOffset = 4, ...props }, ref) => /* @__PURE__ */ jsx(DropdownMenuPrimitive.Portal, { children: /* @__PURE__ */ jsx(
279
279
  DropdownMenuPrimitive.Content,
280
280
  {
281
281
  ref,
@@ -289,7 +289,7 @@ var DropdownMenuContent = React6.forwardRef(({ className, sideOffset = 4, ...pro
289
289
  }
290
290
  ) }));
291
291
  DropdownMenuContent.displayName = DropdownMenuPrimitive.Content.displayName;
292
- var DropdownMenuItem = React6.forwardRef(({ className, inset, ...props }, ref) => /* @__PURE__ */ jsx(
292
+ var DropdownMenuItem = React9.forwardRef(({ className, inset, ...props }, ref) => /* @__PURE__ */ jsx(
293
293
  DropdownMenuPrimitive.Item,
294
294
  {
295
295
  ref,
@@ -302,7 +302,7 @@ var DropdownMenuItem = React6.forwardRef(({ className, inset, ...props }, ref) =
302
302
  }
303
303
  ));
304
304
  DropdownMenuItem.displayName = DropdownMenuPrimitive.Item.displayName;
305
- var DropdownMenuCheckboxItem = React6.forwardRef(({ className, children, checked, ...props }, ref) => /* @__PURE__ */ jsxs(
305
+ var DropdownMenuCheckboxItem = React9.forwardRef(({ className, children, checked, ...props }, ref) => /* @__PURE__ */ jsxs(
306
306
  DropdownMenuPrimitive.CheckboxItem,
307
307
  {
308
308
  ref,
@@ -319,7 +319,7 @@ var DropdownMenuCheckboxItem = React6.forwardRef(({ className, children, checked
319
319
  }
320
320
  ));
321
321
  DropdownMenuCheckboxItem.displayName = DropdownMenuPrimitive.CheckboxItem.displayName;
322
- var DropdownMenuRadioItem = React6.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs(
322
+ var DropdownMenuRadioItem = React9.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs(
323
323
  DropdownMenuPrimitive.RadioItem,
324
324
  {
325
325
  ref,
@@ -335,7 +335,7 @@ var DropdownMenuRadioItem = React6.forwardRef(({ className, children, ...props }
335
335
  }
336
336
  ));
337
337
  DropdownMenuRadioItem.displayName = DropdownMenuPrimitive.RadioItem.displayName;
338
- var DropdownMenuLabel = React6.forwardRef(({ className, inset, ...props }, ref) => /* @__PURE__ */ jsx(
338
+ var DropdownMenuLabel = React9.forwardRef(({ className, inset, ...props }, ref) => /* @__PURE__ */ jsx(
339
339
  DropdownMenuPrimitive.Label,
340
340
  {
341
341
  ref,
@@ -348,7 +348,7 @@ var DropdownMenuLabel = React6.forwardRef(({ className, inset, ...props }, ref)
348
348
  }
349
349
  ));
350
350
  DropdownMenuLabel.displayName = DropdownMenuPrimitive.Label.displayName;
351
- var DropdownMenuSeparator = React6.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
351
+ var DropdownMenuSeparator = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
352
352
  DropdownMenuPrimitive.Separator,
353
353
  {
354
354
  ref,
@@ -370,19 +370,19 @@ var DropdownMenuShortcut = ({
370
370
  );
371
371
  };
372
372
  DropdownMenuShortcut.displayName = "DropdownMenuShortcut";
373
- var FormContext = React6.createContext(null);
373
+ var FormContext = React9.createContext(null);
374
374
  function useFormContext() {
375
- const context = React6.useContext(FormContext);
375
+ const context = React9.useContext(FormContext);
376
376
  if (!context) {
377
377
  throw new Error("useFormContext must be used within a Form component");
378
378
  }
379
379
  return context;
380
380
  }
381
- var FormFieldContext = React6.createContext(
381
+ var FormFieldContext = React9.createContext(
382
382
  null
383
383
  );
384
384
  function useFormFieldContext() {
385
- const context = React6.useContext(FormFieldContext);
385
+ const context = React9.useContext(FormFieldContext);
386
386
  if (!context) {
387
387
  throw new Error(
388
388
  "useFormFieldContext must be used within a FormField component"
@@ -390,24 +390,24 @@ function useFormFieldContext() {
390
390
  }
391
391
  return context;
392
392
  }
393
- var Form = React6.forwardRef(
393
+ var Form = React9.forwardRef(
394
394
  ({ className, children, onFormSubmit, ...props }, ref) => {
395
- const [errors, setErrors] = React6.useState({});
396
- const [isSubmitting, setIsSubmitting] = React6.useState(false);
397
- const setError = React6.useCallback(
395
+ const [errors, setErrors] = React9.useState({});
396
+ const [isSubmitting, setIsSubmitting] = React9.useState(false);
397
+ const setError = React9.useCallback(
398
398
  (name, message) => {
399
399
  setErrors((prev) => ({ ...prev, [name]: message }));
400
400
  },
401
401
  []
402
402
  );
403
- const clearError = React6.useCallback((name) => {
403
+ const clearError = React9.useCallback((name) => {
404
404
  setErrors((prev) => {
405
405
  const next = { ...prev };
406
406
  delete next[name];
407
407
  return next;
408
408
  });
409
409
  }, []);
410
- const clearAllErrors = React6.useCallback(() => {
410
+ const clearAllErrors = React9.useCallback(() => {
411
411
  setErrors({});
412
412
  }, []);
413
413
  const isValid = Object.keys(errors).length === 0;
@@ -426,7 +426,7 @@ var Form = React6.forwardRef(
426
426
  }
427
427
  }
428
428
  };
429
- const contextValue = React6.useMemo(
429
+ const contextValue = React9.useMemo(
430
430
  () => ({
431
431
  errors,
432
432
  setError,
@@ -450,12 +450,12 @@ var Form = React6.forwardRef(
450
450
  }
451
451
  );
452
452
  Form.displayName = "Form";
453
- var FormField = React6.forwardRef(
453
+ var FormField = React9.forwardRef(
454
454
  ({ className, name, children, ...props }, ref) => {
455
455
  const { errors } = useFormContext();
456
- const id = React6.useId();
456
+ const id = React9.useId();
457
457
  const error = errors[name];
458
- const contextValue = React6.useMemo(
458
+ const contextValue = React9.useMemo(
459
459
  () => ({ name, error, id }),
460
460
  [name, error, id]
461
461
  );
@@ -463,7 +463,7 @@ var FormField = React6.forwardRef(
463
463
  }
464
464
  );
465
465
  FormField.displayName = "FormField";
466
- var FormLabel = React6.forwardRef(({ className, ...props }, ref) => {
466
+ var FormLabel = React9.forwardRef(({ className, ...props }, ref) => {
467
467
  const { id, error } = useFormFieldContext();
468
468
  return /* @__PURE__ */ jsx(
469
469
  Label,
@@ -476,10 +476,10 @@ var FormLabel = React6.forwardRef(({ className, ...props }, ref) => {
476
476
  );
477
477
  });
478
478
  FormLabel.displayName = "FormLabel";
479
- var FormControl = React6.forwardRef(
479
+ var FormControl = React9.forwardRef(
480
480
  ({ children, ...props }, ref) => {
481
481
  const { id, error, name } = useFormFieldContext();
482
- const child = React6.cloneElement(children, {
482
+ const child = React9.cloneElement(children, {
483
483
  id,
484
484
  name,
485
485
  "aria-invalid": !!error,
@@ -490,7 +490,7 @@ var FormControl = React6.forwardRef(
490
490
  }
491
491
  );
492
492
  FormControl.displayName = "FormControl";
493
- var FormDescription = React6.forwardRef(
493
+ var FormDescription = React9.forwardRef(
494
494
  ({ className, ...props }, ref) => {
495
495
  return /* @__PURE__ */ jsx(
496
496
  "span",
@@ -506,9 +506,9 @@ var FormDescription = React6.forwardRef(
506
506
  }
507
507
  );
508
508
  FormDescription.displayName = "FormDescription";
509
- var FormMessage = React6.forwardRef(
509
+ var FormMessage = React9.forwardRef(
510
510
  ({ className, children, error: errorProp, ...props }, ref) => {
511
- const fieldContext = React6.useContext(FormFieldContext);
511
+ const fieldContext = React9.useContext(FormFieldContext);
512
512
  const error = errorProp ?? fieldContext?.error;
513
513
  const id = fieldContext?.id;
514
514
  if (!error && !children) {
@@ -532,14 +532,14 @@ var FormMessage = React6.forwardRef(
532
532
  }
533
533
  );
534
534
  FormMessage.displayName = "FormMessage";
535
- var PopoverContext = React6.createContext({ open: false });
535
+ var PopoverContext = React9.createContext({ open: false });
536
536
  var Popover = ({
537
537
  children,
538
538
  open: controlledOpen,
539
539
  onOpenChange,
540
540
  ...props
541
541
  }) => {
542
- const [uncontrolledOpen, setUncontrolledOpen] = React6.useState(false);
542
+ const [uncontrolledOpen, setUncontrolledOpen] = React9.useState(false);
543
543
  const isControlled = controlledOpen !== void 0;
544
544
  const open = isControlled ? controlledOpen : uncontrolledOpen;
545
545
  const handleOpenChange = (newOpen) => {
@@ -560,8 +560,8 @@ var Popover = ({
560
560
  };
561
561
  var PopoverTrigger = PopoverPrimitive.Trigger;
562
562
  var PopoverAnchor = PopoverPrimitive.Anchor;
563
- var PopoverContent = React6.forwardRef(({ className, align = "center", sideOffset = 4, children, ...props }, ref) => {
564
- const { open } = React6.useContext(PopoverContext);
563
+ var PopoverContent = React9.forwardRef(({ className, align = "center", sideOffset = 4, children, ...props }, ref) => {
564
+ const { open } = React9.useContext(PopoverContext);
565
565
  const {
566
566
  onOpenAutoFocus,
567
567
  onCloseAutoFocus,
@@ -621,14 +621,14 @@ var PopoverContent = React6.forwardRef(({ className, align = "center", sideOffse
621
621
  ) }) });
622
622
  });
623
623
  PopoverContent.displayName = PopoverPrimitive.Content.displayName;
624
- var SelectContext = React6.createContext({ open: false });
624
+ var SelectContext = React9.createContext({ open: false });
625
625
  var Select = ({
626
626
  children,
627
627
  open: controlledOpen,
628
628
  onOpenChange,
629
629
  ...props
630
630
  }) => {
631
- const [uncontrolledOpen, setUncontrolledOpen] = React6.useState(false);
631
+ const [uncontrolledOpen, setUncontrolledOpen] = React9.useState(false);
632
632
  const isControlled = controlledOpen !== void 0;
633
633
  const open = isControlled ? controlledOpen : uncontrolledOpen;
634
634
  const handleOpenChange = (newOpen) => {
@@ -649,7 +649,7 @@ var Select = ({
649
649
  };
650
650
  var SelectGroup = SelectPrimitive.Group;
651
651
  var SelectValue = SelectPrimitive.Value;
652
- var SelectTrigger = React6.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs(
652
+ var SelectTrigger = React9.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs(
653
653
  SelectPrimitive.Trigger,
654
654
  {
655
655
  ref,
@@ -665,7 +665,7 @@ var SelectTrigger = React6.forwardRef(({ className, children, ...props }, ref) =
665
665
  }
666
666
  ));
667
667
  SelectTrigger.displayName = SelectPrimitive.Trigger.displayName;
668
- var SelectScrollUpButton = React6.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
668
+ var SelectScrollUpButton = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
669
669
  SelectPrimitive.ScrollUpButton,
670
670
  {
671
671
  ref,
@@ -678,7 +678,7 @@ var SelectScrollUpButton = React6.forwardRef(({ className, ...props }, ref) => /
678
678
  }
679
679
  ));
680
680
  SelectScrollUpButton.displayName = SelectPrimitive.ScrollUpButton.displayName;
681
- var SelectScrollDownButton = React6.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
681
+ var SelectScrollDownButton = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
682
682
  SelectPrimitive.ScrollDownButton,
683
683
  {
684
684
  ref,
@@ -691,8 +691,8 @@ var SelectScrollDownButton = React6.forwardRef(({ className, ...props }, ref) =>
691
691
  }
692
692
  ));
693
693
  SelectScrollDownButton.displayName = SelectPrimitive.ScrollDownButton.displayName;
694
- var SelectContent = React6.forwardRef(({ className, children, position = "popper", ...props }, ref) => {
695
- const { open } = React6.useContext(SelectContext);
694
+ var SelectContent = React9.forwardRef(({ className, children, position = "popper", ...props }, ref) => {
695
+ const { open } = React9.useContext(SelectContext);
696
696
  const {
697
697
  onCloseAutoFocus,
698
698
  onEscapeKeyDown,
@@ -764,7 +764,7 @@ var SelectContent = React6.forwardRef(({ className, children, position = "popper
764
764
  ) }) });
765
765
  });
766
766
  SelectContent.displayName = SelectPrimitive.Content.displayName;
767
- var SelectLabel = React6.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
767
+ var SelectLabel = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
768
768
  SelectPrimitive.Label,
769
769
  {
770
770
  ref,
@@ -773,7 +773,7 @@ var SelectLabel = React6.forwardRef(({ className, ...props }, ref) => /* @__PURE
773
773
  }
774
774
  ));
775
775
  SelectLabel.displayName = SelectPrimitive.Label.displayName;
776
- var SelectItem = React6.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs(
776
+ var SelectItem = React9.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs(
777
777
  SelectPrimitive.Item,
778
778
  {
779
779
  ref,
@@ -789,7 +789,7 @@ var SelectItem = React6.forwardRef(({ className, children, ...props }, ref) => /
789
789
  }
790
790
  ));
791
791
  SelectItem.displayName = SelectPrimitive.Item.displayName;
792
- var SelectSeparator = React6.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
792
+ var SelectSeparator = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
793
793
  SelectPrimitive.Separator,
794
794
  {
795
795
  ref,
@@ -865,16 +865,135 @@ function SkeletonCard({ className }) {
865
865
  }
866
866
  );
867
867
  }
868
- var Table = React6.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { className: "relative w-full overflow-auto", children: /* @__PURE__ */ jsx(
869
- "table",
870
- {
871
- ref,
872
- className: cn("w-full caption-bottom text-sm", className),
868
+ var TableContext = React9.createContext(null);
869
+ var useTableContext = () => {
870
+ const context = React9.useContext(TableContext);
871
+ return context;
872
+ };
873
+ var Table = React9.forwardRef(
874
+ ({
875
+ className,
876
+ selectable = false,
877
+ selectionMode = "multiple",
878
+ selectedRows: controlledSelectedRows,
879
+ onSelectionChange,
880
+ getRowId,
881
+ rows,
873
882
  ...props
883
+ }, ref) => {
884
+ const [internalSelectedRows, setInternalSelectedRows] = React9.useState(/* @__PURE__ */ new Set());
885
+ const [registeredRowIds, setRegisteredRowIds] = React9.useState(/* @__PURE__ */ new Set());
886
+ const isControlled = controlledSelectedRows !== void 0;
887
+ const selectedRowsSet = isControlled ? new Set(controlledSelectedRows) : internalSelectedRows;
888
+ const defaultGetRowId = React9.useCallback((row) => {
889
+ if (typeof row === "string") return row;
890
+ if (typeof row === "object" && row?.id) return String(row.id);
891
+ return String(row);
892
+ }, []);
893
+ const finalGetRowId = getRowId || defaultGetRowId;
894
+ const allRowIds = React9.useMemo(() => {
895
+ if (rows) {
896
+ return new Set(rows.map(finalGetRowId));
897
+ }
898
+ return registeredRowIds;
899
+ }, [rows, finalGetRowId, registeredRowIds]);
900
+ const registerRowId = React9.useCallback((rowId) => {
901
+ if (rowId) {
902
+ setRegisteredRowIds((prev) => new Set(prev).add(rowId));
903
+ }
904
+ }, []);
905
+ const unregisterRowId = React9.useCallback((rowId) => {
906
+ if (rowId) {
907
+ setRegisteredRowIds((prev) => {
908
+ const next = new Set(prev);
909
+ next.delete(rowId);
910
+ return next;
911
+ });
912
+ }
913
+ }, []);
914
+ const toggleRow = React9.useCallback(
915
+ (rowId) => {
916
+ if (!selectable) return;
917
+ const next = new Set(selectedRowsSet);
918
+ if (selectionMode === "single") {
919
+ next.clear();
920
+ if (!next.has(rowId)) {
921
+ next.add(rowId);
922
+ }
923
+ } else {
924
+ if (next.has(rowId)) {
925
+ next.delete(rowId);
926
+ } else {
927
+ next.add(rowId);
928
+ }
929
+ }
930
+ if (isControlled) {
931
+ onSelectionChange?.(Array.from(next));
932
+ } else {
933
+ setInternalSelectedRows(next);
934
+ onSelectionChange?.(Array.from(next));
935
+ }
936
+ },
937
+ [selectable, selectionMode, selectedRowsSet, isControlled, onSelectionChange]
938
+ );
939
+ const selectAll = React9.useCallback(() => {
940
+ if (!selectable || selectionMode !== "multiple" || allRowIds.size === 0) return;
941
+ const next = new Set(allRowIds);
942
+ if (isControlled) {
943
+ onSelectionChange?.(Array.from(next));
944
+ } else {
945
+ setInternalSelectedRows(next);
946
+ onSelectionChange?.(Array.from(next));
947
+ }
948
+ }, [selectable, selectionMode, allRowIds, isControlled, onSelectionChange]);
949
+ const deselectAll = React9.useCallback(() => {
950
+ if (!selectable) return;
951
+ const next = /* @__PURE__ */ new Set();
952
+ if (isControlled) {
953
+ onSelectionChange?.(Array.from(next));
954
+ } else {
955
+ setInternalSelectedRows(next);
956
+ onSelectionChange?.(Array.from(next));
957
+ }
958
+ }, [selectable, isControlled, onSelectionChange]);
959
+ const isRowSelected = React9.useCallback(
960
+ (rowId) => selectedRowsSet.has(rowId),
961
+ [selectedRowsSet]
962
+ );
963
+ const isAllSelected = React9.useMemo(() => {
964
+ if (!selectable || allRowIds.size === 0) return false;
965
+ return allRowIds.size > 0 && Array.from(allRowIds).every((id) => selectedRowsSet.has(id));
966
+ }, [selectable, allRowIds, selectedRowsSet]);
967
+ const isSomeSelected = React9.useMemo(() => {
968
+ if (!selectable) return false;
969
+ return selectedRowsSet.size > 0 && !isAllSelected;
970
+ }, [selectable, selectedRowsSet.size, isAllSelected]);
971
+ const contextValue = {
972
+ selectable,
973
+ selectionMode,
974
+ selectedRows: selectedRowsSet,
975
+ toggleRow,
976
+ isRowSelected,
977
+ selectAll,
978
+ deselectAll,
979
+ isAllSelected,
980
+ isSomeSelected,
981
+ getRowId: finalGetRowId,
982
+ registerRowId,
983
+ unregisterRowId
984
+ };
985
+ return /* @__PURE__ */ jsx(TableContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsx("div", { className: "relative w-full overflow-auto", children: /* @__PURE__ */ jsx(
986
+ "table",
987
+ {
988
+ ref,
989
+ className: cn("w-full caption-bottom text-sm", className),
990
+ ...props
991
+ }
992
+ ) }) });
874
993
  }
875
- ) }));
994
+ );
876
995
  Table.displayName = "Table";
877
- var TableHeader = React6.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
996
+ var TableHeader = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
878
997
  "thead",
879
998
  {
880
999
  ref,
@@ -883,7 +1002,7 @@ var TableHeader = React6.forwardRef(({ className, ...props }, ref) => /* @__PURE
883
1002
  }
884
1003
  ));
885
1004
  TableHeader.displayName = "TableHeader";
886
- var TableBody = React6.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
1005
+ var TableBody = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
887
1006
  "tbody",
888
1007
  {
889
1008
  ref,
@@ -892,7 +1011,7 @@ var TableBody = React6.forwardRef(({ className, ...props }, ref) => /* @__PURE__
892
1011
  }
893
1012
  ));
894
1013
  TableBody.displayName = "TableBody";
895
- var TableFooter = React6.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
1014
+ var TableFooter = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
896
1015
  "tfoot",
897
1016
  {
898
1017
  ref,
@@ -904,19 +1023,47 @@ var TableFooter = React6.forwardRef(({ className, ...props }, ref) => /* @__PURE
904
1023
  }
905
1024
  ));
906
1025
  TableFooter.displayName = "TableFooter";
907
- var TableRow = React6.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
908
- "tr",
909
- {
910
- ref,
911
- className: cn(
912
- "border-b border-gray-200 transition-colors hover:bg-gray-50 data-[state=selected]:bg-gray-100 dark:border-neutral-700 dark:hover:bg-neutral-800/50 dark:data-[state=selected]:bg-gray-800",
913
- className
914
- ),
915
- ...props
1026
+ var TableRow = React9.forwardRef(
1027
+ ({ className, rowId, rowData, onClick, ...props }, ref) => {
1028
+ const context = useTableContext();
1029
+ const finalRowId = React9.useMemo(() => {
1030
+ if (rowId) return rowId;
1031
+ if (rowData && context?.getRowId) return context.getRowId(rowData);
1032
+ return props.id || void 0;
1033
+ }, [rowId, rowData, context, props.id]);
1034
+ React9.useEffect(() => {
1035
+ if (finalRowId && context?.selectable) {
1036
+ context.registerRowId(finalRowId);
1037
+ return () => {
1038
+ context.unregisterRowId(finalRowId);
1039
+ };
1040
+ }
1041
+ }, [finalRowId, context]);
1042
+ const isSelected = finalRowId ? context?.isRowSelected(finalRowId) : false;
1043
+ const handleClick = React9.useCallback(
1044
+ (e) => {
1045
+ onClick?.(e);
1046
+ },
1047
+ [onClick]
1048
+ );
1049
+ return /* @__PURE__ */ jsx(
1050
+ "tr",
1051
+ {
1052
+ ref,
1053
+ "data-state": isSelected ? "selected" : void 0,
1054
+ "data-row-id": finalRowId,
1055
+ className: cn(
1056
+ "border-b border-gray-200 transition-colors hover:bg-gray-50 data-[state=selected]:bg-blue-50 dark:border-neutral-700 dark:hover:bg-neutral-800/50 dark:data-[state=selected]:bg-blue-900/20",
1057
+ className
1058
+ ),
1059
+ onClick: handleClick,
1060
+ ...props
1061
+ }
1062
+ );
916
1063
  }
917
- ));
1064
+ );
918
1065
  TableRow.displayName = "TableRow";
919
- var TableHead = React6.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
1066
+ var TableHead = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
920
1067
  "th",
921
1068
  {
922
1069
  ref,
@@ -928,7 +1075,7 @@ var TableHead = React6.forwardRef(({ className, ...props }, ref) => /* @__PURE__
928
1075
  }
929
1076
  ));
930
1077
  TableHead.displayName = "TableHead";
931
- var TableCell = React6.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
1078
+ var TableCell = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
932
1079
  "td",
933
1080
  {
934
1081
  ref,
@@ -937,7 +1084,7 @@ var TableCell = React6.forwardRef(({ className, ...props }, ref) => /* @__PURE__
937
1084
  }
938
1085
  ));
939
1086
  TableCell.displayName = "TableCell";
940
- var TableCaption = React6.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
1087
+ var TableCaption = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
941
1088
  "caption",
942
1089
  {
943
1090
  ref,
@@ -946,31 +1093,88 @@ var TableCaption = React6.forwardRef(({ className, ...props }, ref) => /* @__PUR
946
1093
  }
947
1094
  ));
948
1095
  TableCaption.displayName = "TableCaption";
949
- var TabsContext = React6.createContext(null);
1096
+ var TableSelectAll = React9.forwardRef(({ className, ...props }, ref) => {
1097
+ const context = useTableContext();
1098
+ if (!context?.selectable || context.selectionMode !== "multiple") {
1099
+ return null;
1100
+ }
1101
+ const handleCheckedChange = (checked) => {
1102
+ if (checked) {
1103
+ context.selectAll();
1104
+ } else {
1105
+ context.deselectAll();
1106
+ }
1107
+ };
1108
+ return /* @__PURE__ */ jsx("div", { ref, className, ...props, children: /* @__PURE__ */ jsx(
1109
+ Checkbox,
1110
+ {
1111
+ checked: context.isAllSelected,
1112
+ onCheckedChange: handleCheckedChange,
1113
+ "aria-label": "Select all rows",
1114
+ ...context.isSomeSelected && { "data-state": "indeterminate" }
1115
+ }
1116
+ ) });
1117
+ });
1118
+ TableSelectAll.displayName = "TableSelectAll";
1119
+ var TableRowCheckbox = React9.forwardRef(({ rowId, rowData, className, ...props }, ref) => {
1120
+ const context = useTableContext();
1121
+ if (!context?.selectable) {
1122
+ return null;
1123
+ }
1124
+ const finalRowId = React9.useMemo(() => {
1125
+ if (rowId) return rowId;
1126
+ if (rowData && context?.getRowId) return context.getRowId(rowData);
1127
+ return void 0;
1128
+ }, [rowId, rowData, context]);
1129
+ if (!finalRowId) {
1130
+ return null;
1131
+ }
1132
+ const isSelected = context.isRowSelected(finalRowId);
1133
+ const handleCheckedChange = () => {
1134
+ context.toggleRow(finalRowId);
1135
+ };
1136
+ return /* @__PURE__ */ jsx("div", { ref, className, ...props, children: /* @__PURE__ */ jsx(
1137
+ Checkbox,
1138
+ {
1139
+ checked: isSelected,
1140
+ onCheckedChange: handleCheckedChange,
1141
+ "aria-label": `Select row ${finalRowId}`
1142
+ }
1143
+ ) });
1144
+ });
1145
+ TableRowCheckbox.displayName = "TableRowCheckbox";
1146
+ var useTableSelection = () => {
1147
+ const context = useTableContext();
1148
+ if (!context) {
1149
+ throw new Error("useTableSelection must be used within a Table component with selectable prop");
1150
+ }
1151
+ return context;
1152
+ };
1153
+ var TabsContext = React9.createContext(null);
950
1154
  var useTabsContext = () => {
951
- const context = React6.useContext(TabsContext);
1155
+ const context = React9.useContext(TabsContext);
952
1156
  if (!context) {
953
1157
  throw new Error("Tabs components must be used within a Tabs provider");
954
1158
  }
955
1159
  return context;
956
1160
  };
957
- var Tabs = React6.forwardRef(({ defaultValue, value, onValueChange, children, ...props }, ref) => {
958
- const [activeTab, setActiveTabState] = React6.useState(value ?? defaultValue);
959
- const tabRefs = React6.useRef(/* @__PURE__ */ new Map()).current;
960
- const listRef = React6.useRef(null);
961
- const setActiveTab = React6.useCallback(
1161
+ var Tabs = React9.forwardRef(({ defaultValue, value, onValueChange, children, ...props }, ref) => {
1162
+ const [activeTab, setActiveTabState] = React9.useState(value ?? defaultValue);
1163
+ const tabRefs = React9.useRef(/* @__PURE__ */ new Map()).current;
1164
+ const listRef = React9.useRef(null);
1165
+ const setActiveTab = React9.useCallback(
962
1166
  (newValue) => {
963
1167
  setActiveTabState(newValue);
964
1168
  onValueChange?.(newValue);
965
1169
  },
966
1170
  [onValueChange]
967
1171
  );
968
- React6.useEffect(() => {
1172
+ React9.useEffect(() => {
969
1173
  if (value !== void 0) {
970
1174
  setActiveTabState(value);
971
1175
  }
972
1176
  }, [value]);
973
- const registerTab = React6.useCallback(
1177
+ const registerTab = React9.useCallback(
974
1178
  (tabValue, element) => {
975
1179
  tabRefs.set(tabValue, element);
976
1180
  },
@@ -995,10 +1199,10 @@ var Tabs = React6.forwardRef(({ defaultValue, value, onValueChange, children, ..
995
1199
  );
996
1200
  });
997
1201
  Tabs.displayName = "Tabs";
998
- var TabsList = React6.forwardRef(({ className, children, ...props }, ref) => {
1202
+ var TabsList = React9.forwardRef(({ className, children, ...props }, ref) => {
999
1203
  const { activeTab, tabRefs, listRef } = useTabsContext();
1000
- const [indicatorStyle, setIndicatorStyle] = React6.useState(null);
1001
- React6.useEffect(() => {
1204
+ const [indicatorStyle, setIndicatorStyle] = React9.useState(null);
1205
+ React9.useEffect(() => {
1002
1206
  const updateIndicator = () => {
1003
1207
  if (!activeTab || !listRef.current) return;
1004
1208
  const activeElement = tabRefs.get(activeTab);
@@ -1050,10 +1254,10 @@ var TabsList = React6.forwardRef(({ className, children, ...props }, ref) => {
1050
1254
  );
1051
1255
  });
1052
1256
  TabsList.displayName = TabsPrimitive.List.displayName;
1053
- var TabsTrigger = React6.forwardRef(({ className, value, ...props }, ref) => {
1257
+ var TabsTrigger = React9.forwardRef(({ className, value, ...props }, ref) => {
1054
1258
  const { registerTab, activeTab } = useTabsContext();
1055
- const triggerRef = React6.useRef(null);
1056
- React6.useEffect(() => {
1259
+ const triggerRef = React9.useRef(null);
1260
+ React9.useEffect(() => {
1057
1261
  registerTab(value, triggerRef.current);
1058
1262
  return () => registerTab(value, null);
1059
1263
  }, [value, registerTab]);
@@ -1077,7 +1281,7 @@ var TabsTrigger = React6.forwardRef(({ className, value, ...props }, ref) => {
1077
1281
  );
1078
1282
  });
1079
1283
  TabsTrigger.displayName = TabsPrimitive.Trigger.displayName;
1080
- var TabsContent = React6.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
1284
+ var TabsContent = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
1081
1285
  TabsPrimitive.Content,
1082
1286
  {
1083
1287
  ref,
@@ -1089,7 +1293,7 @@ var TabsContent = React6.forwardRef(({ className, ...props }, ref) => /* @__PURE
1089
1293
  }
1090
1294
  ));
1091
1295
  TabsContent.displayName = TabsPrimitive.Content.displayName;
1092
- var Textarea = React6.forwardRef(
1296
+ var Textarea = React9.forwardRef(
1093
1297
  ({ className, ...props }, ref) => {
1094
1298
  return /* @__PURE__ */ jsx(
1095
1299
  "textarea",
@@ -1106,6 +1310,6 @@ var Textarea = React6.forwardRef(
1106
1310
  );
1107
1311
  Textarea.displayName = "Textarea";
1108
1312
 
1109
- export { Button, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Checkbox, 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, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Skeleton, SkeletonAvatar, SkeletonBadge, SkeletonButton, SkeletonCard, SkeletonIcon, SkeletonInput, SkeletonSubtitle, SkeletonTableRow, SkeletonTableRows, SkeletonText, SkeletonTitle, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, Textarea, buttonVariants, useFormContext, useFormFieldContext };
1110
- //# sourceMappingURL=chunk-MB2CYZNV.mjs.map
1111
- //# sourceMappingURL=chunk-MB2CYZNV.mjs.map
1313
+ export { Button, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Checkbox, 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, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Skeleton, SkeletonAvatar, SkeletonBadge, SkeletonButton, SkeletonCard, SkeletonIcon, SkeletonInput, SkeletonSubtitle, SkeletonTableRow, SkeletonTableRows, SkeletonText, SkeletonTitle, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, TableRowCheckbox, TableSelectAll, Tabs, TabsContent, TabsList, TabsTrigger, Textarea, buttonVariants, useFormContext, useFormFieldContext, useTableSelection };
1314
+ //# sourceMappingURL=chunk-PEL2DCBC.mjs.map
1315
+ //# sourceMappingURL=chunk-PEL2DCBC.mjs.map