@caffeinebounce/ui 0.62.3 → 0.63.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.
Files changed (96) hide show
  1. package/README.md +1 -1
  2. package/dist/blog.js +7 -6
  3. package/dist/blog.mjs +2 -1
  4. package/dist/charts.d.cts +1 -1
  5. package/dist/charts.d.ts +1 -1
  6. package/dist/{chunk-6DVWMJ3H.mjs → chunk-2EFVMX6V.mjs} +3 -3
  7. package/dist/{chunk-6ZJCK6KH.js → chunk-375DECW4.js} +31 -31
  8. package/dist/{chunk-PZRI43EZ.js → chunk-46JYKBRX.js} +0 -43
  9. package/dist/chunk-5D55OVD5.js +75 -0
  10. package/dist/{chunk-JORVSG52.js → chunk-663CFAHS.js} +211 -269
  11. package/dist/chunk-6HKJDV43.mjs +48 -0
  12. package/dist/chunk-6NCRGHV3.mjs +64 -0
  13. package/dist/{chunk-OLAAXLXY.mjs → chunk-6QAKQG57.mjs} +4 -4
  14. package/dist/{chunk-N6AFNFZR.mjs → chunk-7ERVZXIN.mjs} +214 -270
  15. package/dist/chunk-APFEP5B7.mjs +100 -0
  16. package/dist/chunk-C3OADNSG.js +348 -0
  17. package/dist/{chunk-GIJQE3JR.js → chunk-DH5Z3ETN.js} +66 -45
  18. package/dist/chunk-DYWZ23QT.mjs +90 -0
  19. package/dist/{chunk-DTVWRRFN.mjs → chunk-E67IR6HU.mjs} +30 -9
  20. package/dist/{chunk-OVNLC5RD.mjs → chunk-EXQSWHLD.mjs} +6 -6
  21. package/dist/{chunk-ZOA7B32D.js → chunk-F35KL6TX.js} +9 -9
  22. package/dist/{chunk-YSLD2HLP.mjs → chunk-FFJC66KO.mjs} +1 -1
  23. package/dist/{chunk-MPZFPU4X.js → chunk-GMBLPQ3I.js} +3 -3
  24. package/dist/chunk-IJFPPLQW.js +50 -0
  25. package/dist/{chunk-BMFQG6RA.mjs → chunk-KJIX6V32.mjs} +107 -1885
  26. package/dist/chunk-LABHD4PU.js +109 -0
  27. package/dist/{chunk-GAIQJCAZ.js → chunk-LT5VD4KR.js} +149 -1953
  28. package/dist/{chunk-7DHKQODW.mjs → chunk-LTLCIRZY.mjs} +256 -474
  29. package/dist/chunk-N5BHXWR3.mjs +34 -0
  30. package/dist/chunk-OCO3Z5YA.js +37 -0
  31. package/dist/chunk-OIJ7XMDV.mjs +71 -0
  32. package/dist/chunk-ORBH4IBC.mjs +316 -0
  33. package/dist/chunk-OWWOAYIY.js +2652 -0
  34. package/dist/chunk-PFHOXDSW.mjs +10 -0
  35. package/dist/chunk-QRS7DJGS.js +103 -0
  36. package/dist/{chunk-NXPEJ2UR.mjs → chunk-R3X4B4JJ.mjs} +53 -6
  37. package/dist/chunk-RM7ACPTM.mjs +2601 -0
  38. package/dist/chunk-RODSGPBB.mjs +75 -0
  39. package/dist/{chunk-T6ZBA6VJ.js → chunk-UHAV34YX.js} +8 -8
  40. package/dist/{chunk-GUSTCU2W.mjs → chunk-ULANYJ7Y.mjs} +1 -59
  41. package/dist/chunk-ULDE7QSN.js +70 -0
  42. package/dist/chunk-UT36VNVZ.mjs +47 -0
  43. package/dist/chunk-UY3H4PKB.js +71 -0
  44. package/dist/{chunk-KB7UXIQZ.mjs → chunk-VIVWFQG5.mjs} +2 -1
  45. package/dist/{chunk-ESZ7CBA2.js → chunk-VKBJ3SGT.js} +6 -5
  46. package/dist/{chunk-UM7WMXIU.js → chunk-W3YOQ5ZD.js} +264 -505
  47. package/dist/{chunk-GHOFYK2E.js → chunk-XGJL6DLV.js} +55 -5
  48. package/dist/chunk-YRIBFIQ5.js +116 -0
  49. package/dist/chunk-ZWWJ3RRA.js +15 -0
  50. package/dist/data-grid.d.cts +241 -0
  51. package/dist/data-grid.d.ts +241 -0
  52. package/dist/data-grid.js +6486 -0
  53. package/dist/data-grid.mjs +6459 -0
  54. package/dist/data-table-CDQBo-Ve.d.ts +818 -0
  55. package/dist/data-table-jLzt6plY.d.cts +818 -0
  56. package/dist/data-table.d.cts +8 -42
  57. package/dist/data-table.d.ts +8 -42
  58. package/dist/data-table.js +61 -187
  59. package/dist/data-table.mjs +11 -5
  60. package/dist/finance.d.cts +534 -0
  61. package/dist/finance.d.ts +534 -0
  62. package/dist/finance.js +188 -0
  63. package/dist/finance.mjs +15 -0
  64. package/dist/forms.js +9 -6
  65. package/dist/forms.mjs +7 -4
  66. package/dist/{hooks-B2jU1GVT.d.ts → hooks-A55E0fgf.d.ts} +3 -2
  67. package/dist/{hooks-8ORd7T1A.d.cts → hooks-Bys_AZPI.d.cts} +3 -2
  68. package/dist/hooks.d.cts +1 -1
  69. package/dist/hooks.d.ts +1 -1
  70. package/dist/hooks.js +26 -23
  71. package/dist/hooks.mjs +6 -3
  72. package/dist/index.d.cts +536 -665
  73. package/dist/index.d.ts +536 -665
  74. package/dist/index.js +3829 -3408
  75. package/dist/index.mjs +2067 -1767
  76. package/dist/layouts.js +25 -25
  77. package/dist/layouts.mjs +4 -4
  78. package/dist/marketing.js +74 -74
  79. package/dist/marketing.mjs +4 -4
  80. package/dist/navigation.js +28 -28
  81. package/dist/navigation.mjs +6 -6
  82. package/dist/primitives.d.cts +72 -109
  83. package/dist/primitives.d.ts +72 -109
  84. package/dist/primitives.js +78 -72
  85. package/dist/primitives.mjs +8 -6
  86. package/dist/settings.js +9 -9
  87. package/dist/settings.mjs +4 -4
  88. package/package.json +17 -1
  89. package/dist/UnifiedTableControls-CG299y9h.d.ts +0 -1233
  90. package/dist/UnifiedTableControls-CIjRpNhy.d.cts +0 -1233
  91. package/dist/chunk-GMBGWOCR.mjs +0 -49
  92. package/dist/chunk-HBLKVQIQ.mjs +0 -23
  93. package/dist/chunk-HMAMMC72.js +0 -26
  94. package/dist/chunk-MVYRNJA6.js +0 -75
  95. /package/dist/{chunk-RVEFPVZF.mjs → chunk-C57MX3BG.mjs} +0 -0
  96. /package/dist/{chunk-C4UT5V3P.js → chunk-OWHI5VGJ.js} +0 -0
@@ -1,25 +1,21 @@
1
1
  "use client";
2
2
  'use strict';
3
3
 
4
- var chunkKGGQ5NZV_js = require('./chunk-KGGQ5NZV.js');
5
- var chunk33JR5SYE_js = require('./chunk-33JR5SYE.js');
6
- var chunkUM7WMXIU_js = require('./chunk-UM7WMXIU.js');
4
+ var chunkW3YOQ5ZD_js = require('./chunk-W3YOQ5ZD.js');
5
+ var chunkZWWJ3RRA_js = require('./chunk-ZWWJ3RRA.js');
6
+ var chunkC3OADNSG_js = require('./chunk-C3OADNSG.js');
7
+ var chunkQRS7DJGS_js = require('./chunk-QRS7DJGS.js');
7
8
  var chunkWOITB4JL_js = require('./chunk-WOITB4JL.js');
8
- var chunk7IKHZKAC_js = require('./chunk-7IKHZKAC.js');
9
- var chunkHMAMMC72_js = require('./chunk-HMAMMC72.js');
10
9
  var chunk6TGV2DNP_js = require('./chunk-6TGV2DNP.js');
10
+ var chunk7IKHZKAC_js = require('./chunk-7IKHZKAC.js');
11
11
  var chunkJ6OLBSZR_js = require('./chunk-J6OLBSZR.js');
12
12
  var chunkSORWLKOK_js = require('./chunk-SORWLKOK.js');
13
- var chunkDQWHYBV2_js = require('./chunk-DQWHYBV2.js');
14
13
  var chunkADIDI7AJ_js = require('./chunk-ADIDI7AJ.js');
14
+ var SwitchPrimitive = require('@radix-ui/react-switch');
15
15
  var jsxRuntime = require('react/jsx-runtime');
16
16
  var lucideReact = require('lucide-react');
17
- var reactDayPicker = require('react-day-picker');
18
- var React12 = require('react');
17
+ var React5 = require('react');
19
18
  var dateFns = require('date-fns');
20
- var classVarianceAuthority = require('class-variance-authority');
21
- var sharedUtils = require('@caffeinebounce/shared-utils');
22
- var cmdk = require('cmdk');
23
19
  var recharts = require('recharts');
24
20
 
25
21
  function _interopNamespace(e) {
@@ -40,8 +36,36 @@ function _interopNamespace(e) {
40
36
  return Object.freeze(n);
41
37
  }
42
38
 
43
- var React12__namespace = /*#__PURE__*/_interopNamespace(React12);
39
+ var SwitchPrimitive__namespace = /*#__PURE__*/_interopNamespace(SwitchPrimitive);
40
+ var React5__namespace = /*#__PURE__*/_interopNamespace(React5);
44
41
 
42
+ function Switch({
43
+ className,
44
+ size = "default",
45
+ ...props
46
+ }) {
47
+ return /* @__PURE__ */ jsxRuntime.jsx(
48
+ SwitchPrimitive__namespace.Root,
49
+ {
50
+ "data-slot": "switch",
51
+ "data-size": size,
52
+ className: chunkADIDI7AJ_js.cn(
53
+ "peer group/switch inline-flex shrink-0 items-center rounded-full border border-transparent shadow-xs transition-all outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-[1.15rem] data-[size=default]:w-8 data-[size=sm]:h-3.5 data-[size=sm]:w-6 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input dark:data-[state=unchecked]:bg-input/80",
54
+ className
55
+ ),
56
+ ...props,
57
+ children: /* @__PURE__ */ jsxRuntime.jsx(
58
+ SwitchPrimitive__namespace.Thumb,
59
+ {
60
+ "data-slot": "switch-thumb",
61
+ className: chunkADIDI7AJ_js.cn(
62
+ "pointer-events-none block rounded-full bg-background ring-0 transition-transform group-data-[size=default]/switch:size-4 group-data-[size=sm]/switch:size-3 data-[state=checked]:translate-x-[calc(100%-2px)] data-[state=unchecked]:translate-x-0 dark:data-[state=checked]:bg-primary-foreground dark:data-[state=unchecked]:bg-foreground"
63
+ )
64
+ }
65
+ )
66
+ }
67
+ );
68
+ }
45
69
  function ChartTooltipShell({
46
70
  children,
47
71
  className
@@ -89,62 +113,6 @@ function ChartTooltipRow({
89
113
  )
90
114
  ] });
91
115
  }
92
- function Calendar({
93
- className,
94
- classNames,
95
- showOutsideDays = true,
96
- captionLayout = "dropdown",
97
- ...props
98
- }) {
99
- return /* @__PURE__ */ jsxRuntime.jsx(
100
- reactDayPicker.DayPicker,
101
- {
102
- showOutsideDays,
103
- captionLayout,
104
- className: chunkADIDI7AJ_js.cn("p-3", className),
105
- classNames: {
106
- months: "flex flex-col sm:flex-row gap-2",
107
- month: "flex flex-col gap-4",
108
- dropdown_root: "relative",
109
- nav: "absolute inset-x-0 top-0 flex h-8 items-center justify-between",
110
- button_previous: chunkADIDI7AJ_js.cn(
111
- chunk6TGV2DNP_js.buttonVariants({ variant: "outline" }),
112
- "absolute left-1 top-1/2 h-7 w-7 -translate-y-1/2 bg-background p-0 opacity-70 hover:opacity-100"
113
- ),
114
- button_next: chunkADIDI7AJ_js.cn(
115
- chunk6TGV2DNP_js.buttonVariants({ variant: "outline" }),
116
- "absolute right-1 top-1/2 h-7 w-7 -translate-y-1/2 bg-background p-0 opacity-70 hover:opacity-100"
117
- ),
118
- month_grid: "w-full border-collapse",
119
- weekdays: "flex",
120
- weekday: "text-muted-foreground rounded-md w-8 font-normal text-[0.8rem]",
121
- week: "flex w-full mt-2",
122
- day: chunkADIDI7AJ_js.cn(
123
- "relative p-0 text-center text-sm focus-within:relative focus-within:z-20 [&:has([aria-selected])]:bg-accent [&:has([aria-selected].day-range-end)]:rounded-r-md [&:has([aria-selected].day-outside)]:bg-accent/50",
124
- props.mode === "range" ? "[&:has(>.day-range-end)]:rounded-r-md [&:has(>.day-range-start)]:rounded-l-md first:[&:has([aria-selected])]:rounded-l-md last:[&:has([aria-selected])]:rounded-r-md" : "[&:has([aria-selected])]:rounded-md"
125
- ),
126
- day_button: chunkADIDI7AJ_js.cn(
127
- chunk6TGV2DNP_js.buttonVariants({ variant: "ghost" }),
128
- "h-8 w-8 p-0 font-normal aria-selected:opacity-100"
129
- ),
130
- range_start: "day-range-start aria-selected:bg-primary aria-selected:text-primary-foreground",
131
- range_end: "day-range-end aria-selected:bg-primary aria-selected:text-primary-foreground",
132
- selected: "bg-primary text-primary-foreground hover:bg-primary hover:text-primary-foreground focus:bg-primary focus:text-primary-foreground",
133
- today: "bg-accent text-accent-foreground",
134
- outside: "day-outside text-muted-foreground opacity-50 aria-selected:bg-accent/50 aria-selected:text-muted-foreground aria-selected:opacity-30",
135
- disabled: "text-muted-foreground opacity-50",
136
- range_middle: "aria-selected:bg-accent aria-selected:text-accent-foreground",
137
- hidden: "invisible",
138
- ...classNames
139
- },
140
- components: {
141
- Chevron: ({ orientation }) => orientation === "left" ? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronLeft, { className: "h-4 w-4" }) : /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronRight, { className: "h-4 w-4" })
142
- },
143
- ...props
144
- }
145
- );
146
- }
147
- Calendar.displayName = "Calendar";
148
116
  var MONTHS = [
149
117
  "Jan",
150
118
  "Feb",
@@ -183,9 +151,9 @@ function ModernCalendar({
183
151
  disabled = false
184
152
  }) {
185
153
  const today = /* @__PURE__ */ new Date();
186
- const [viewDate, setViewDate] = React12__namespace.useState(selected || today);
187
- const [viewMode, setViewMode] = React12__namespace.useState("days");
188
- const [yearRangeStart, setYearRangeStart] = React12__namespace.useState(
154
+ const [viewDate, setViewDate] = React5__namespace.useState(selected || today);
155
+ const [viewMode, setViewMode] = React5__namespace.useState("days");
156
+ const [yearRangeStart, setYearRangeStart] = React5__namespace.useState(
189
157
  Math.floor((selected?.getFullYear() || today.getFullYear()) / 12) * 12
190
158
  );
191
159
  const getDaysInMonth = (year, month) => {
@@ -481,13 +449,13 @@ function DatePicker({
481
449
  align = "start",
482
450
  error = false
483
451
  }) {
484
- const [open, setOpen] = React12__namespace.useState(false);
452
+ const [open, setOpen] = React5__namespace.useState(false);
485
453
  const handleSelect = (date) => {
486
454
  onChange?.(date);
487
455
  setOpen(false);
488
456
  };
489
- return /* @__PURE__ */ jsxRuntime.jsxs(chunkUM7WMXIU_js.Popover, { open, onOpenChange: setOpen, children: [
490
- /* @__PURE__ */ jsxRuntime.jsx(chunkUM7WMXIU_js.PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsxs(
457
+ return /* @__PURE__ */ jsxRuntime.jsxs(chunkQRS7DJGS_js.Popover, { open, onOpenChange: setOpen, children: [
458
+ /* @__PURE__ */ jsxRuntime.jsx(chunkQRS7DJGS_js.PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsxs(
491
459
  chunk6TGV2DNP_js.Button,
492
460
  {
493
461
  variant: "outline",
@@ -505,7 +473,7 @@ function DatePicker({
505
473
  ]
506
474
  }
507
475
  ) }),
508
- /* @__PURE__ */ jsxRuntime.jsx(chunkUM7WMXIU_js.PopoverContent, { className: "w-auto p-0", align, children: /* @__PURE__ */ jsxRuntime.jsx(
476
+ /* @__PURE__ */ jsxRuntime.jsx(chunkQRS7DJGS_js.PopoverContent, { className: "w-auto p-0", align, children: /* @__PURE__ */ jsxRuntime.jsx(
509
477
  ModernCalendar,
510
478
  {
511
479
  selected: value,
@@ -529,8 +497,8 @@ function DateRangePicker({
529
497
  numberOfMonths = 2,
530
498
  align = "start"
531
499
  }) {
532
- const [open, setOpen] = React12__namespace.useState(false);
533
- const disabledMatcher = React12__namespace.useMemo(() => {
500
+ const [open, setOpen] = React5__namespace.useState(false);
501
+ const disabledMatcher = React5__namespace.useMemo(() => {
534
502
  const matchers = [];
535
503
  if (fromDate) {
536
504
  matchers.push({ before: fromDate });
@@ -540,8 +508,8 @@ function DateRangePicker({
540
508
  }
541
509
  return matchers.length > 0 ? matchers : void 0;
542
510
  }, [fromDate, toDate]);
543
- return /* @__PURE__ */ jsxRuntime.jsxs(chunkUM7WMXIU_js.Popover, { open, onOpenChange: setOpen, children: [
544
- /* @__PURE__ */ jsxRuntime.jsx(chunkUM7WMXIU_js.PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsxs(
511
+ return /* @__PURE__ */ jsxRuntime.jsxs(chunkQRS7DJGS_js.Popover, { open, onOpenChange: setOpen, children: [
512
+ /* @__PURE__ */ jsxRuntime.jsx(chunkQRS7DJGS_js.PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsxs(
545
513
  chunk6TGV2DNP_js.Button,
546
514
  {
547
515
  variant: "outline",
@@ -563,10 +531,11 @@ function DateRangePicker({
563
531
  ]
564
532
  }
565
533
  ) }),
566
- /* @__PURE__ */ jsxRuntime.jsx(chunkUM7WMXIU_js.PopoverContent, { className: "w-auto p-0", align, children: /* @__PURE__ */ jsxRuntime.jsx(
567
- Calendar,
534
+ /* @__PURE__ */ jsxRuntime.jsx(chunkQRS7DJGS_js.PopoverContent, { className: "w-auto p-0", align, children: /* @__PURE__ */ jsxRuntime.jsx(
535
+ chunkC3OADNSG_js.Calendar,
568
536
  {
569
537
  mode: "range",
538
+ captionLayout: "dropdown",
570
539
  selected: value,
571
540
  onSelect: onChange,
572
541
  disabled: disabledMatcher,
@@ -610,8 +579,8 @@ function ComparisonSelector({
610
579
  customEnd
611
580
  });
612
581
  };
613
- return /* @__PURE__ */ jsxRuntime.jsxs(chunkUM7WMXIU_js.Popover, { children: [
614
- /* @__PURE__ */ jsxRuntime.jsx(chunkUM7WMXIU_js.PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsxs(
582
+ return /* @__PURE__ */ jsxRuntime.jsxs(chunkQRS7DJGS_js.Popover, { children: [
583
+ /* @__PURE__ */ jsxRuntime.jsx(chunkQRS7DJGS_js.PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsxs(
615
584
  chunk6TGV2DNP_js.Button,
616
585
  {
617
586
  variant: "outline",
@@ -627,7 +596,7 @@ function ComparisonSelector({
627
596
  }
628
597
  ) }),
629
598
  /* @__PURE__ */ jsxRuntime.jsx(
630
- chunkUM7WMXIU_js.PopoverContent,
599
+ chunkQRS7DJGS_js.PopoverContent,
631
600
  {
632
601
  align: "start",
633
602
  className: "w-[380px] p-2",
@@ -771,597 +740,9 @@ function ComparisonSelector({
771
740
  )
772
741
  ] });
773
742
  }
774
-
775
- // src/blocks/data-table/data-table-styles.ts
776
- var dataTableTopperButtonProps = {
777
- variant: "ghost-icon",
778
- size: "icon-sm"
779
- };
780
- var dataTableTopperResponsiveClasses = "w-8 @min-[450px]:w-auto @min-[450px]:px-2";
781
- var dataTableTopperOpenStateClasses = "data-[state=open]:text-foreground";
782
- var dataTableTopperIconClasses = "text-icon hover:text-icon-hover [&_svg]:transition-transform [&_svg]:duration-200 hover:[&_svg]:scale-110";
783
- function DataTableAddButton({
784
- label = "Add",
785
- icon,
786
- responsiveLabel = true,
787
- className,
788
- children,
789
- ...props
790
- }) {
791
- const context = chunkUM7WMXIU_js.useDataTableContext();
792
- const fontSizeClass = context?.fontSizeClass ?? "text-xs";
793
- const iconElement = icon ?? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Plus, { className: "size-4" });
794
- return /* @__PURE__ */ jsxRuntime.jsxs(
795
- chunk6TGV2DNP_js.Button,
796
- {
797
- ...dataTableTopperButtonProps,
798
- className: chunkADIDI7AJ_js.cn(
799
- fontSizeClass,
800
- responsiveLabel ? dataTableTopperResponsiveClasses : "px-2 w-auto",
801
- className
802
- ),
803
- ...props,
804
- children: [
805
- iconElement,
806
- responsiveLabel ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "hidden @min-[450px]:inline", children: children ?? label }) : /* @__PURE__ */ jsxRuntime.jsx("span", { children: children ?? label })
807
- ]
808
- }
809
- );
810
- }
811
- function DataTableColumnMenuSub({
812
- label,
813
- icon,
814
- children
815
- }) {
816
- return /* @__PURE__ */ jsxRuntime.jsxs(chunkJ6OLBSZR_js.DropdownMenuSub, { children: [
817
- /* @__PURE__ */ jsxRuntime.jsxs(chunkJ6OLBSZR_js.DropdownMenuSubTrigger, { className: "flex items-center gap-2", children: [
818
- icon ?? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ListOrdered, { className: "size-4 text-muted-foreground" }),
819
- label
820
- ] }),
821
- /* @__PURE__ */ jsxRuntime.jsx(chunkJ6OLBSZR_js.DropdownMenuSubContent, { alignOffset: -5, sideOffset: 5, children })
822
- ] });
823
- }
824
- function escapeCsvField(value) {
825
- if (value.includes(",") || value.includes('"') || value.includes("\n") || value.includes("\r")) {
826
- return `"${value.replace(/"/g, '""')}"`;
827
- }
828
- return value;
829
- }
830
- function formatCsvValue(value) {
831
- if (value === null || value === void 0) {
832
- return "";
833
- }
834
- if (typeof value === "boolean") {
835
- return value ? "Yes" : "No";
836
- }
837
- if (value instanceof Date) {
838
- return value.toISOString();
839
- }
840
- if (typeof value === "object") {
841
- try {
842
- return JSON.stringify(value);
843
- } catch {
844
- return String(value);
845
- }
846
- }
847
- return String(value);
848
- }
849
- function serializeTableExport({
850
- table,
851
- visibleColumnsOnly = true,
852
- selectedRowsOnly = false,
853
- customHeaders = {},
854
- excludeColumns = [],
855
- formatters = {}
856
- }) {
857
- const allColumns = visibleColumnsOnly ? table.getVisibleLeafColumns() : table.getAllLeafColumns();
858
- const columns = allColumns.filter((col) => {
859
- const colId = col.id;
860
- if (["select", "selection", "actions", "_actions"].includes(colId)) {
861
- return false;
862
- }
863
- return !excludeColumns.includes(colId);
864
- });
865
- const tableRows = selectedRowsOnly ? table.getFilteredSelectedRowModel().rows : table.getFilteredRowModel().rows;
866
- return {
867
- headers: columns.map((col) => customHeaders[col.id] ?? col.id),
868
- rows: tableRows.map(
869
- (row) => columns.map((col) => {
870
- const cellValue = row.getValue(col.id);
871
- const formatter = formatters[col.id];
872
- return formatter ? formatter(cellValue) : formatCsvValue(cellValue);
873
- })
874
- )
875
- };
876
- }
877
- function exportToCsv({
878
- table,
879
- filename = "export",
880
- visibleColumnsOnly = true,
881
- selectedRowsOnly = false,
882
- customHeaders = {},
883
- excludeColumns = [],
884
- formatters = {}
885
- }) {
886
- const { headers, rows } = serializeTableExport({
887
- table,
888
- visibleColumnsOnly,
889
- selectedRowsOnly,
890
- customHeaders,
891
- excludeColumns,
892
- formatters
893
- });
894
- const csvContent = [
895
- headers.map(escapeCsvField).join(","),
896
- ...rows.map((row) => row.map(escapeCsvField).join(","))
897
- ].join("\n");
898
- const blob = new Blob([csvContent], { type: "text/csv;charset=utf-8;" });
899
- const url = URL.createObjectURL(blob);
900
- const link = document.createElement("a");
901
- link.setAttribute("href", url);
902
- link.setAttribute("download", `${filename}.csv`);
903
- link.style.visibility = "hidden";
904
- document.body.appendChild(link);
905
- link.click();
906
- document.body.removeChild(link);
907
- URL.revokeObjectURL(url);
908
- }
909
- function exportToExcel({
910
- table,
911
- filename = "export",
912
- visibleColumnsOnly = true,
913
- selectedRowsOnly = false,
914
- customHeaders = {},
915
- excludeColumns = [],
916
- formatters = {}
917
- }) {
918
- const { headers, rows } = serializeTableExport({
919
- table,
920
- visibleColumnsOnly,
921
- selectedRowsOnly,
922
- customHeaders,
923
- excludeColumns,
924
- formatters
925
- });
926
- const sheetRows = [
927
- headers.map((header) => ({ value: header, style: "header" })),
928
- ...rows.map(
929
- (row) => row.map((cell) => {
930
- const trimmed = cell.trim();
931
- const isNumericPattern = trimmed !== "" && /^-?\d+(\.\d+)?$/.test(trimmed);
932
- const hasLeadingZero = /^0\d+$/.test(trimmed) || /^-0\d+$/.test(trimmed);
933
- const numValue = Number(trimmed);
934
- const isNumber = isNumericPattern && !hasLeadingZero && !Number.isNaN(numValue);
935
- if (isNumber) {
936
- return {
937
- value: numValue,
938
- type: "Number",
939
- style: "number"
940
- };
941
- }
942
- return { value: cell, style: "text" };
943
- })
944
- )
945
- ];
946
- const xmlContent = chunkUM7WMXIU_js.buildSpreadsheetWorkbookXml({
947
- worksheetName: "Data",
948
- rows: sheetRows
949
- });
950
- chunkUM7WMXIU_js.downloadExcelXml(xmlContent, filename);
951
- }
952
- function DataTableExportButton({
953
- table,
954
- onExportCsv,
955
- onExportExcel,
956
- onExport,
957
- // deprecated, maps to CSV
958
- filename = "export",
959
- label = "Export",
960
- disabled = false,
961
- selectedRowsOnly = false,
962
- excludeColumns = [],
963
- customHeaders = {},
964
- formatters = {}
965
- }) {
966
- const context = chunkUM7WMXIU_js.useDataTableContext();
967
- const fontSizeClass = context?.fontSizeClass ?? "text-xs";
968
- const [isExporting, setIsExporting] = React12__namespace.useState(false);
969
- const [exportingFormat, setExportingFormat] = React12__namespace.useState(null);
970
- const handleExport = React12__namespace.useCallback(
971
- async (format3) => {
972
- if (disabled) return;
973
- setIsExporting(true);
974
- setExportingFormat(format3);
975
- try {
976
- if (table) {
977
- if (format3 === "csv") {
978
- exportToCsv({
979
- table,
980
- filename,
981
- selectedRowsOnly,
982
- excludeColumns,
983
- customHeaders,
984
- formatters
985
- });
986
- } else {
987
- exportToExcel({
988
- table,
989
- filename,
990
- selectedRowsOnly,
991
- excludeColumns,
992
- customHeaders,
993
- formatters
994
- });
995
- }
996
- } else {
997
- if (format3 === "csv") {
998
- await (onExportCsv ?? onExport)?.();
999
- } else {
1000
- await onExportExcel?.();
1001
- }
1002
- }
1003
- } finally {
1004
- setIsExporting(false);
1005
- setExportingFormat(null);
1006
- }
1007
- },
1008
- [
1009
- table,
1010
- onExportCsv,
1011
- onExportExcel,
1012
- onExport,
1013
- filename,
1014
- selectedRowsOnly,
1015
- excludeColumns,
1016
- customHeaders,
1017
- formatters,
1018
- disabled
1019
- ]
1020
- );
1021
- return /* @__PURE__ */ jsxRuntime.jsxs(chunkJ6OLBSZR_js.DropdownMenu, { children: [
1022
- /* @__PURE__ */ jsxRuntime.jsxs(chunkSORWLKOK_js.Tooltip, { children: [
1023
- /* @__PURE__ */ jsxRuntime.jsx(chunkSORWLKOK_js.TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(chunkJ6OLBSZR_js.DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(
1024
- chunk6TGV2DNP_js.Button,
1025
- {
1026
- ...dataTableTopperButtonProps,
1027
- disabled: isExporting || disabled,
1028
- "aria-label": label,
1029
- className: dataTableTopperOpenStateClasses,
1030
- children: isExporting ? /* @__PURE__ */ jsxRuntime.jsx(chunkHMAMMC72_js.Spinner, { className: "size-4" }) : /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Download, { className: "size-4" })
1031
- }
1032
- ) }) }),
1033
- /* @__PURE__ */ jsxRuntime.jsx(chunkSORWLKOK_js.TooltipContent, { className: fontSizeClass, children: label })
1034
- ] }),
1035
- /* @__PURE__ */ jsxRuntime.jsxs(chunkJ6OLBSZR_js.DropdownMenuContent, { align: "end", className: "w-44", children: [
1036
- /* @__PURE__ */ jsxRuntime.jsx(
1037
- chunkJ6OLBSZR_js.DropdownMenuLabel,
1038
- {
1039
- className: chunkADIDI7AJ_js.cn("font-normal text-muted-foreground", fontSizeClass),
1040
- children: "Export Data"
1041
- }
1042
- ),
1043
- /* @__PURE__ */ jsxRuntime.jsx(chunkJ6OLBSZR_js.DropdownMenuSeparator, {}),
1044
- /* @__PURE__ */ jsxRuntime.jsxs(
1045
- chunkJ6OLBSZR_js.DropdownMenuItem,
1046
- {
1047
- onClick: () => handleExport("csv"),
1048
- disabled: isExporting,
1049
- className: chunkADIDI7AJ_js.cn("gap-2", fontSizeClass),
1050
- children: [
1051
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.FileText, { className: dataTableTopperIconClasses }),
1052
- /* @__PURE__ */ jsxRuntime.jsx("span", { children: "CSV" }),
1053
- exportingFormat === "csv" && /* @__PURE__ */ jsxRuntime.jsx(chunkHMAMMC72_js.Spinner, { className: "size-3 ml-auto" })
1054
- ]
1055
- }
1056
- ),
1057
- /* @__PURE__ */ jsxRuntime.jsxs(
1058
- chunkJ6OLBSZR_js.DropdownMenuItem,
1059
- {
1060
- onClick: () => handleExport("excel"),
1061
- disabled: isExporting,
1062
- className: chunkADIDI7AJ_js.cn("gap-2", fontSizeClass),
1063
- children: [
1064
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.FileSpreadsheet, { className: dataTableTopperIconClasses }),
1065
- /* @__PURE__ */ jsxRuntime.jsx("span", { children: "Excel" }),
1066
- exportingFormat === "excel" && /* @__PURE__ */ jsxRuntime.jsx(chunkHMAMMC72_js.Spinner, { className: "size-3 ml-auto" })
1067
- ]
1068
- }
1069
- )
1070
- ] })
1071
- ] });
1072
- }
1073
- function DataTablePagination({
1074
- page,
1075
- pageSize,
1076
- pageCount,
1077
- totalCount,
1078
- selectedCount = 0,
1079
- pageSizeOptions = [10, 20, 30, 40, 50],
1080
- onPageChange,
1081
- onPageSizeChange,
1082
- className,
1083
- ...props
1084
- }) {
1085
- const displayPageCount = Math.max(1, pageCount);
1086
- const canGoPrevious = page > 1;
1087
- const canGoNext = page < displayPageCount;
1088
- return /* @__PURE__ */ jsxRuntime.jsxs(
1089
- "div",
1090
- {
1091
- className: chunkADIDI7AJ_js.cn(
1092
- "flex w-full flex-row items-center justify-between gap-3 overflow-auto p-1 sm:gap-8",
1093
- className
1094
- ),
1095
- ...props,
1096
- children: [
1097
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex-1" }),
1098
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-end gap-1 sm:gap-2 lg:gap-6", children: [
1099
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center space-x-2", children: [
1100
- /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "whitespace-nowrap text-[length:var(--text-xs)] font-light text-muted-foreground", children: [
1101
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "hidden lg:inline", children: "Rows per page" }),
1102
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "lg:hidden", children: "Rows" })
1103
- ] }),
1104
- /* @__PURE__ */ jsxRuntime.jsxs(
1105
- chunkWOITB4JL_js.Select,
1106
- {
1107
- value: `${pageSize}`,
1108
- onValueChange: (value) => onPageSizeChange(Number(value)),
1109
- children: [
1110
- /* @__PURE__ */ jsxRuntime.jsx(chunkWOITB4JL_js.SelectTrigger, { className: "h-6 w-[60px] px-2 text-[length:var(--text-xs)] focus:ring-0 focus:ring-offset-0 hover:bg-accent transition-colors", children: /* @__PURE__ */ jsxRuntime.jsx(chunkWOITB4JL_js.SelectValue, { placeholder: pageSize }) }),
1111
- /* @__PURE__ */ jsxRuntime.jsx(chunkWOITB4JL_js.SelectContent, { side: "top", children: pageSizeOptions.map((size) => /* @__PURE__ */ jsxRuntime.jsx(
1112
- chunkWOITB4JL_js.SelectItem,
1113
- {
1114
- value: `${size}`,
1115
- className: "text-[length:var(--text-xs)] h-7",
1116
- children: size
1117
- },
1118
- size
1119
- )) })
1120
- ]
1121
- }
1122
- )
1123
- ] }),
1124
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center space-x-1", children: [
1125
- /* @__PURE__ */ jsxRuntime.jsx(
1126
- chunk6TGV2DNP_js.Button,
1127
- {
1128
- "aria-label": "Go to first page",
1129
- variant: "ghost",
1130
- className: "hidden size-7 p-0 lg:flex hover:bg-accent",
1131
- onClick: () => onPageChange(1),
1132
- disabled: !canGoPrevious,
1133
- children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronsLeft, { className: "size-3.5" })
1134
- }
1135
- ),
1136
- /* @__PURE__ */ jsxRuntime.jsx(
1137
- chunk6TGV2DNP_js.Button,
1138
- {
1139
- "aria-label": "Go to previous page",
1140
- variant: "ghost",
1141
- className: "size-7 p-0 hover:bg-accent",
1142
- onClick: () => onPageChange(page - 1),
1143
- disabled: !canGoPrevious,
1144
- children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronLeft, { className: "size-3.5" })
1145
- }
1146
- ),
1147
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-center text-[length:var(--text-xs)] font-light text-muted-foreground whitespace-nowrap px-1", children: [
1148
- /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "hidden lg:inline", children: [
1149
- "Page ",
1150
- page,
1151
- " of ",
1152
- displayPageCount
1153
- ] }),
1154
- /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "lg:hidden", children: [
1155
- page,
1156
- " / ",
1157
- displayPageCount
1158
- ] })
1159
- ] }),
1160
- /* @__PURE__ */ jsxRuntime.jsx(
1161
- chunk6TGV2DNP_js.Button,
1162
- {
1163
- "aria-label": "Go to next page",
1164
- variant: "ghost",
1165
- className: "size-7 p-0 hover:bg-accent",
1166
- onClick: () => onPageChange(page + 1),
1167
- disabled: !canGoNext,
1168
- children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronRight, { className: "size-3.5" })
1169
- }
1170
- ),
1171
- /* @__PURE__ */ jsxRuntime.jsx(
1172
- chunk6TGV2DNP_js.Button,
1173
- {
1174
- "aria-label": "Go to last page",
1175
- variant: "ghost",
1176
- className: "hidden size-7 p-0 lg:flex hover:bg-accent",
1177
- onClick: () => onPageChange(displayPageCount),
1178
- disabled: !canGoNext,
1179
- children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronsRight, { className: "size-3.5" })
1180
- }
1181
- )
1182
- ] })
1183
- ] })
1184
- ]
1185
- }
1186
- );
1187
- }
1188
- var iconButtonVariants = classVarianceAuthority.cva(
1189
- "inline-flex items-center justify-center rounded-box transition-colors duration-200 cursor-pointer disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
1190
- {
1191
- variants: {
1192
- variant: {
1193
- default: "text-muted-foreground hover:text-foreground hover:bg-accent",
1194
- ghost: "text-muted-foreground/50 hover:text-foreground hover:bg-transparent",
1195
- delete: "text-muted-foreground/50 hover:text-destructive hover:bg-transparent",
1196
- edit: "text-muted-foreground/50 hover:text-foreground hover:bg-transparent",
1197
- destructive: "text-muted-foreground/50 hover:text-destructive hover:bg-transparent",
1198
- success: "text-muted-foreground/50 hover:text-green-600 hover:bg-transparent",
1199
- successActive: "text-green-600 hover:text-muted-foreground/60 hover:bg-transparent"
1200
- },
1201
- size: {
1202
- default: "h-8 w-8 [&_svg]:size-4",
1203
- sm: "h-6 w-6 [&_svg]:size-3.5",
1204
- xs: "h-5 w-5 [&_svg]:size-3",
1205
- lg: "h-10 w-10 [&_svg]:size-5"
1206
- }
1207
- },
1208
- defaultVariants: {
1209
- variant: "default",
1210
- size: "default"
1211
- }
1212
- }
1213
- );
1214
- function IconButton({ className, variant, size, ...props }) {
1215
- return /* @__PURE__ */ jsxRuntime.jsx(
1216
- "button",
1217
- {
1218
- type: "button",
1219
- "data-slot": "icon-button",
1220
- className: chunkADIDI7AJ_js.cn(iconButtonVariants({ variant, size, className })),
1221
- ...props
1222
- }
1223
- );
1224
- }
1225
- function useIsDesktop() {
1226
- const [isDesktop, setIsDesktop] = React12__namespace.useState(false);
1227
- React12__namespace.useEffect(() => {
1228
- const mediaQuery = window.matchMedia("(min-width: 768px)");
1229
- setIsDesktop(mediaQuery.matches);
1230
- const handler = (e) => setIsDesktop(e.matches);
1231
- mediaQuery.addEventListener("change", handler);
1232
- return () => mediaQuery.removeEventListener("change", handler);
1233
- }, []);
1234
- return isDesktop;
1235
- }
1236
- function ActionsDropdown({
1237
- actions,
1238
- fontSizeClass,
1239
- density
1240
- }) {
1241
- const isCompact = density === "compact";
1242
- return /* @__PURE__ */ jsxRuntime.jsxs(chunkJ6OLBSZR_js.DropdownMenu, { children: [
1243
- /* @__PURE__ */ jsxRuntime.jsx(chunkJ6OLBSZR_js.DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsxs(
1244
- IconButton,
1245
- {
1246
- variant: "ghost",
1247
- size: isCompact ? "xs" : "sm",
1248
- className: "data-[state=open]:bg-muted",
1249
- children: [
1250
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.MoreHorizontal, { className: isCompact ? "size-3.5" : "size-4" }),
1251
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Open menu" })
1252
- ]
1253
- }
1254
- ) }),
1255
- /* @__PURE__ */ jsxRuntime.jsx(chunkJ6OLBSZR_js.DropdownMenuContent, { align: "end", className: "w-40", children: actions.map((action, index) => /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
1256
- action.separatorBefore && index > 0 && /* @__PURE__ */ jsxRuntime.jsx(chunkJ6OLBSZR_js.DropdownMenuSeparator, {}),
1257
- /* @__PURE__ */ jsxRuntime.jsxs(
1258
- chunkJ6OLBSZR_js.DropdownMenuItem,
1259
- {
1260
- onClick: action.onClick,
1261
- disabled: action.disabled,
1262
- className: chunkADIDI7AJ_js.cn(
1263
- fontSizeClass,
1264
- action.destructive && "hover:text-destructive hover:bg-destructive/10",
1265
- action.success && "hover:text-success hover:bg-success/10",
1266
- action.successActive && "text-green-600 hover:text-muted-foreground hover:bg-accent"
1267
- ),
1268
- children: [
1269
- action.icon && /* @__PURE__ */ jsxRuntime.jsx(
1270
- "span",
1271
- {
1272
- className: chunkADIDI7AJ_js.cn(
1273
- "mr-2",
1274
- action.destructive && "group-hover:text-destructive",
1275
- action.success && "group-hover:text-success",
1276
- action.successActive && "text-green-600 group-hover:text-muted-foreground"
1277
- ),
1278
- children: action.icon
1279
- }
1280
- ),
1281
- action.label
1282
- ]
1283
- }
1284
- )
1285
- ] }, action.label)) })
1286
- ] });
1287
- }
1288
- function ActionsInline({
1289
- actions,
1290
- fontSizeClass,
1291
- density
1292
- }) {
1293
- const isCompact = density === "compact";
1294
- return /* @__PURE__ */ jsxRuntime.jsx("div", { className: chunkADIDI7AJ_js.cn("flex items-center", isCompact ? "gap-0.5" : "gap-1"), children: actions.map((action) => {
1295
- const variant = action.destructive ? "delete" : action.successActive ? "successActive" : action.success ? "success" : "ghost";
1296
- return /* @__PURE__ */ jsxRuntime.jsxs(chunkSORWLKOK_js.Tooltip, { children: [
1297
- /* @__PURE__ */ jsxRuntime.jsx(chunkSORWLKOK_js.TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsxs(
1298
- IconButton,
1299
- {
1300
- variant,
1301
- size: isCompact ? "xs" : "default",
1302
- onClick: action.onClick,
1303
- disabled: action.disabled,
1304
- children: [
1305
- action.icon,
1306
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: action.label })
1307
- ]
1308
- }
1309
- ) }),
1310
- /* @__PURE__ */ jsxRuntime.jsx(chunkSORWLKOK_js.TooltipContent, { className: fontSizeClass, children: action.label })
1311
- ] }, action.label);
1312
- }) });
1313
- }
1314
- function DataTableRowActions({
1315
- actions,
1316
- mode = "dropdown"
1317
- }) {
1318
- const context = chunkUM7WMXIU_js.useDataTableContext();
1319
- const fontSizeClass = context?.fontSizeClass ?? "text-xs";
1320
- const density = context?.density ?? "comfy";
1321
- const isDesktop = useIsDesktop();
1322
- if (actions.length === 0) return null;
1323
- if (mode === "dropdown") {
1324
- return /* @__PURE__ */ jsxRuntime.jsx(
1325
- ActionsDropdown,
1326
- {
1327
- actions,
1328
- fontSizeClass,
1329
- density
1330
- }
1331
- );
1332
- }
1333
- if (mode === "inline") {
1334
- return /* @__PURE__ */ jsxRuntime.jsx(
1335
- ActionsInline,
1336
- {
1337
- actions,
1338
- fontSizeClass,
1339
- density
1340
- }
1341
- );
1342
- }
1343
- if (isDesktop) {
1344
- return /* @__PURE__ */ jsxRuntime.jsx(
1345
- ActionsInline,
1346
- {
1347
- actions,
1348
- fontSizeClass,
1349
- density
1350
- }
1351
- );
1352
- }
1353
- return /* @__PURE__ */ jsxRuntime.jsx(
1354
- ActionsDropdown,
1355
- {
1356
- actions,
1357
- fontSizeClass,
1358
- density
1359
- }
1360
- );
1361
- }
1362
743
  var STORAGE_PREFIX = "dt-settings-";
1363
744
  function useDataTableSettings(tableId, settings) {
1364
- const [values, setValues] = React12__namespace.useState(() => {
745
+ const [values, setValues] = React5__namespace.useState(() => {
1365
746
  const defaults = {};
1366
747
  for (const s of settings) {
1367
748
  defaults[s.id] = s.defaultValue;
@@ -1378,7 +759,7 @@ function useDataTableSettings(tableId, settings) {
1378
759
  }
1379
760
  return defaults;
1380
761
  });
1381
- const onChange = React12__namespace.useCallback(
762
+ const onChange = React5__namespace.useCallback(
1382
763
  (id, value) => {
1383
764
  setValues((prev) => {
1384
765
  const next = { ...prev, [id]: value };
@@ -1396,7 +777,7 @@ function useDataTableSettings(tableId, settings) {
1396
777
  },
1397
778
  [tableId]
1398
779
  );
1399
- const getSetting = React12__namespace.useCallback(
780
+ const getSetting = React5__namespace.useCallback(
1400
781
  (id) => values[id],
1401
782
  [values]
1402
783
  );
@@ -1409,18 +790,18 @@ function DataTableSettings({
1409
790
  className
1410
791
  }) {
1411
792
  if (!settings.length) return null;
1412
- return /* @__PURE__ */ jsxRuntime.jsx(chunkSORWLKOK_js.Tooltip, { children: /* @__PURE__ */ jsxRuntime.jsxs(chunkUM7WMXIU_js.Popover, { children: [
1413
- /* @__PURE__ */ jsxRuntime.jsx(chunkSORWLKOK_js.TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(chunkUM7WMXIU_js.PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(
793
+ return /* @__PURE__ */ jsxRuntime.jsx(chunkSORWLKOK_js.Tooltip, { children: /* @__PURE__ */ jsxRuntime.jsxs(chunkQRS7DJGS_js.Popover, { children: [
794
+ /* @__PURE__ */ jsxRuntime.jsx(chunkSORWLKOK_js.TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(chunkQRS7DJGS_js.PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(
1414
795
  chunk6TGV2DNP_js.Button,
1415
796
  {
1416
- ...dataTableTopperButtonProps,
797
+ ...chunkZWWJ3RRA_js.dataTableTopperButtonProps,
1417
798
  "aria-label": "Table settings",
1418
- className: chunkADIDI7AJ_js.cn(dataTableTopperOpenStateClasses, className),
799
+ className: chunkADIDI7AJ_js.cn(chunkZWWJ3RRA_js.dataTableTopperOpenStateClasses, className),
1419
800
  children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Settings, { className: "size-4" })
1420
801
  }
1421
802
  ) }) }),
1422
803
  /* @__PURE__ */ jsxRuntime.jsx(chunkSORWLKOK_js.TooltipContent, { children: "Settings" }),
1423
- /* @__PURE__ */ jsxRuntime.jsx(chunkUM7WMXIU_js.PopoverContent, { align: "end", className: "w-56 p-2", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-1", children: [
804
+ /* @__PURE__ */ jsxRuntime.jsx(chunkQRS7DJGS_js.PopoverContent, { align: "end", className: "w-56 p-2", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-1", children: [
1424
805
  /* @__PURE__ */ jsxRuntime.jsx("p", { className: "px-2 py-1 text-xs font-medium text-muted-foreground", children: "Display Settings" }),
1425
806
  settings.map((setting) => {
1426
807
  if (setting.type === "boolean") {
@@ -1462,1143 +843,19 @@ function DataTableSettings({
1462
843
  ] }) })
1463
844
  ] }) });
1464
845
  }
1465
- function Skeleton({ className, ...props }) {
1466
- return /* @__PURE__ */ jsxRuntime.jsx(
1467
- "div",
1468
- {
1469
- "data-slot": "skeleton",
1470
- className: chunkADIDI7AJ_js.cn("bg-accent animate-pulse rounded-box", className),
1471
- ...props
1472
- }
1473
- );
1474
- }
1475
- function DataTableSkeleton({
1476
- columnCount,
1477
- rowCount = 10,
1478
- filterCount = 0,
1479
- cellWidths = ["auto"],
1480
- withViewOptions = true,
1481
- withPagination = true,
1482
- shrinkZero = false,
1483
- className,
1484
- ...props
1485
- }) {
1486
- const widths = Array.from(
1487
- { length: columnCount },
1488
- (_, index) => cellWidths[index % cellWidths.length] ?? "auto"
1489
- );
1490
- return /* @__PURE__ */ jsxRuntime.jsxs(
1491
- "div",
1492
- {
1493
- className: chunkADIDI7AJ_js.cn("flex w-full flex-col gap-2.5 overflow-auto", className),
1494
- ...props,
1495
- children: [
1496
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex w-full items-center justify-between gap-2 overflow-auto p-1", children: [
1497
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-1 items-center gap-2", children: [
1498
- /* @__PURE__ */ jsxRuntime.jsx(Skeleton, { className: "h-8 w-[150px] lg:w-[250px]" }),
1499
- filterCount > 0 && Array.from({ length: filterCount }).map((_, i) => /* @__PURE__ */ jsxRuntime.jsx(
1500
- Skeleton,
1501
- {
1502
- className: "h-8 w-20 border-dashed"
1503
- },
1504
- `filter-${i}`
1505
- ))
1506
- ] }),
1507
- withViewOptions && /* @__PURE__ */ jsxRuntime.jsx(Skeleton, { className: "hidden h-8 w-20 lg:block" })
1508
- ] }),
1509
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "overflow-hidden rounded-md border", children: /* @__PURE__ */ jsxRuntime.jsxs(chunkUM7WMXIU_js.Table, { children: [
1510
- /* @__PURE__ */ jsxRuntime.jsx(chunkUM7WMXIU_js.TableHeader, { children: /* @__PURE__ */ jsxRuntime.jsx(chunkUM7WMXIU_js.TableRow, { className: "hover:bg-transparent", children: widths.map((width, index) => /* @__PURE__ */ jsxRuntime.jsx(
1511
- chunkUM7WMXIU_js.TableHead,
1512
- {
1513
- style: {
1514
- width: shrinkZero && width === "auto" ? 0 : width,
1515
- minWidth: shrinkZero ? 0 : void 0
1516
- },
1517
- children: /* @__PURE__ */ jsxRuntime.jsx(Skeleton, { className: "h-6 w-full" })
1518
- },
1519
- `header-${index}`
1520
- )) }) }),
1521
- /* @__PURE__ */ jsxRuntime.jsx(chunkUM7WMXIU_js.TableBody, { children: Array.from({ length: rowCount }).map((_, rowIndex) => /* @__PURE__ */ jsxRuntime.jsx(
1522
- chunkUM7WMXIU_js.TableRow,
1523
- {
1524
- className: "hover:bg-transparent",
1525
- children: widths.map((width, cellIndex) => /* @__PURE__ */ jsxRuntime.jsx(
1526
- chunkUM7WMXIU_js.TableCell,
1527
- {
1528
- style: {
1529
- width: shrinkZero && width === "auto" ? 0 : width,
1530
- minWidth: shrinkZero ? 0 : void 0
1531
- },
1532
- children: /* @__PURE__ */ jsxRuntime.jsx(Skeleton, { className: "h-6 w-full" })
1533
- },
1534
- `cell-${rowIndex}-${cellIndex}`
1535
- ))
1536
- },
1537
- `row-${rowIndex}`
1538
- )) })
1539
- ] }) }),
1540
- withPagination && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex w-full items-center justify-between gap-4 overflow-auto p-1 sm:gap-8", children: [
1541
- /* @__PURE__ */ jsxRuntime.jsx(Skeleton, { className: "h-8 w-40 shrink-0" }),
1542
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-4 sm:gap-6 lg:gap-8", children: [
1543
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [
1544
- /* @__PURE__ */ jsxRuntime.jsx(Skeleton, { className: "h-8 w-24" }),
1545
- /* @__PURE__ */ jsxRuntime.jsx(Skeleton, { className: "h-8 w-[70px]" })
1546
- ] }),
1547
- /* @__PURE__ */ jsxRuntime.jsx(Skeleton, { className: "h-8 w-20" }),
1548
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [
1549
- /* @__PURE__ */ jsxRuntime.jsx(Skeleton, { className: "hidden size-8 lg:block" }),
1550
- /* @__PURE__ */ jsxRuntime.jsx(Skeleton, { className: "size-8" }),
1551
- /* @__PURE__ */ jsxRuntime.jsx(Skeleton, { className: "size-8" }),
1552
- /* @__PURE__ */ jsxRuntime.jsx(Skeleton, { className: "hidden size-8 lg:block" })
1553
- ] })
1554
- ] })
1555
- ] })
1556
- ]
1557
- }
1558
- );
1559
- }
1560
- var summaryOptions = {
1561
- text: [
1562
- { value: "none", label: "None" },
1563
- { value: "count", label: "Count" },
1564
- { value: "count_unique", label: "Count unique" },
1565
- { value: "percent_empty", label: "% Empty" },
1566
- { value: "percent_filled", label: "% Filled" }
1567
- ],
1568
- number: [
1569
- { value: "none", label: "None" },
1570
- { value: "count", label: "Count" },
1571
- { value: "sum", label: "Sum" },
1572
- { value: "average", label: "Average" },
1573
- { value: "median", label: "Median" },
1574
- { value: "min", label: "Min" },
1575
- { value: "max", label: "Max" },
1576
- { value: "range", label: "Range" },
1577
- { value: "percent_empty", label: "% Empty" },
1578
- { value: "percent_filled", label: "% Filled" }
1579
- ],
1580
- boolean: [
1581
- { value: "none", label: "None" },
1582
- { value: "count", label: "Count" },
1583
- { value: "percent_empty", label: "% Empty" },
1584
- { value: "percent_filled", label: "% Filled" }
1585
- ],
1586
- date: [
1587
- { value: "none", label: "None" },
1588
- { value: "count", label: "Count" },
1589
- { value: "min", label: "Earliest" },
1590
- { value: "max", label: "Latest" },
1591
- { value: "range", label: "Date range" },
1592
- { value: "percent_empty", label: "% Empty" },
1593
- { value: "percent_filled", label: "% Filled" }
1594
- ]
1595
- };
1596
- function calculateSummary(column, allData, type, dataType) {
1597
- if (type === "none") return "";
1598
- const accessor = column.accessorFn;
1599
- if (!accessor) return "";
1600
- const allValues = allData.map((row) => accessor(row, 0)).filter((v) => v !== null && v !== void 0 && v !== "");
1601
- const totalCount = allData.length;
1602
- const filledCount = allValues.length;
1603
- const emptyCount = totalCount - filledCount;
1604
- switch (type) {
1605
- case "count":
1606
- return `Count: ${filledCount.toLocaleString()}`;
1607
- case "count_unique": {
1608
- const uniqueValues = new Set(allValues.map((v) => String(v)));
1609
- return `Unique: ${uniqueValues.size.toLocaleString()}`;
1610
- }
1611
- case "percent_empty":
1612
- return totalCount > 0 ? `Empty: ${(emptyCount / totalCount * 100).toFixed(1)}%` : "Empty: 0%";
1613
- case "percent_filled":
1614
- return totalCount > 0 ? `Filled: ${(filledCount / totalCount * 100).toFixed(1)}%` : "Filled: 0%";
1615
- case "sum":
1616
- case "average":
1617
- case "median":
1618
- case "min":
1619
- case "max":
1620
- case "range": {
1621
- if (dataType === "number") {
1622
- const numericValues = allValues.map((v) => Number(v)).filter((n) => !Number.isNaN(n));
1623
- if (numericValues.length === 0) return "\u2014";
1624
- switch (type) {
1625
- case "sum": {
1626
- const sum = numericValues.reduce((a, b) => a + b, 0);
1627
- return `Sum: ${formatNumber(sum)}`;
1628
- }
1629
- case "average": {
1630
- const avg = numericValues.reduce((a, b) => a + b, 0) / numericValues.length;
1631
- return `Avg: ${formatNumber(avg)}`;
1632
- }
1633
- case "median": {
1634
- const sorted = [...numericValues].sort((a, b) => a - b);
1635
- const mid = Math.floor(sorted.length / 2);
1636
- const median = sorted.length % 2 !== 0 ? sorted[mid] : (sorted[mid - 1] + sorted[mid]) / 2;
1637
- return `Median: ${formatNumber(median)}`;
1638
- }
1639
- case "min":
1640
- return `Min: ${formatNumber(Math.min(...numericValues))}`;
1641
- case "max":
1642
- return `Max: ${formatNumber(Math.max(...numericValues))}`;
1643
- case "range": {
1644
- const min = Math.min(...numericValues);
1645
- const max = Math.max(...numericValues);
1646
- return `${formatNumber(min)} \u2013 ${formatNumber(max)}`;
1647
- }
1648
- }
1649
- }
1650
- if (dataType === "date") {
1651
- const dateValues = allValues.map((v) => {
1652
- const d = v instanceof Date ? v : new Date(String(v));
1653
- return d.getTime();
1654
- }).filter((t) => !Number.isNaN(t));
1655
- if (dateValues.length === 0) return "\u2014";
1656
- switch (type) {
1657
- case "min":
1658
- return sharedUtils.formatDate(new Date(Math.min(...dateValues)));
1659
- case "max":
1660
- return sharedUtils.formatDate(new Date(Math.max(...dateValues)));
1661
- case "range": {
1662
- const min = new Date(Math.min(...dateValues));
1663
- const max = new Date(Math.max(...dateValues));
1664
- return `${sharedUtils.formatDate(min)} \u2013 ${sharedUtils.formatDate(max)}`;
1665
- }
1666
- default:
1667
- return "\u2014";
1668
- }
1669
- }
1670
- return "\u2014";
1671
- }
1672
- default:
1673
- return "";
1674
- }
1675
- }
1676
- function formatNumber(n) {
1677
- if (Number.isInteger(n)) {
1678
- return n.toLocaleString();
1679
- }
1680
- return n.toLocaleString(void 0, {
1681
- minimumFractionDigits: 2,
1682
- maximumFractionDigits: 2
1683
- });
1684
- }
1685
- function DataTableSummary({
1686
- table,
1687
- allData,
1688
- summaryConfig,
1689
- onSummaryChange,
1690
- getColumnDataType,
1691
- gutterWidth = 0,
1692
- className
1693
- }) {
1694
- const visibleColumns = table.getVisibleLeafColumns().filter((col) => col.id !== "select" && col.id !== "actions");
1695
- const [hoveredColumnId, setHoveredColumnId] = React12__namespace.useState(
1696
- null
1697
- );
1698
- const detectDataType = React12__namespace.useCallback(
1699
- (columnId) => {
1700
- if (getColumnDataType) return getColumnDataType(columnId);
1701
- const column = table.getColumn(columnId);
1702
- if (!column) return "text";
1703
- const meta = column.columnDef.meta;
1704
- if (meta?.filterType === "number") return "number";
1705
- if (meta?.filterType === "boolean") return "boolean";
1706
- const accessor = column.accessorFn;
1707
- if (!accessor) return "text";
1708
- for (const row of allData) {
1709
- const value = accessor(row, 0);
1710
- if (value === null || value === void 0) continue;
1711
- if (typeof value === "number") return "number";
1712
- if (typeof value === "boolean") return "boolean";
1713
- if (value instanceof Date) return "date";
1714
- if (typeof value === "string" && !Number.isNaN(Date.parse(value))) {
1715
- const parsed = new Date(value);
1716
- if (parsed.getFullYear() > 1900 && parsed.getFullYear() < 2100) {
1717
- return "date";
1718
- }
1719
- }
1720
- break;
1721
- }
1722
- return "text";
1723
- },
1724
- [getColumnDataType, table, allData]
1725
- );
1726
- return /* @__PURE__ */ jsxRuntime.jsxs(
1727
- chunkUM7WMXIU_js.TableRow,
1728
- {
1729
- className: chunkADIDI7AJ_js.cn("hover:bg-transparent border-0 bg-transparent", className),
1730
- children: [
1731
- gutterWidth > 0 && /* @__PURE__ */ jsxRuntime.jsx(chunkUM7WMXIU_js.TableCell, { className: "p-0 border-0", style: { width: gutterWidth } }),
1732
- visibleColumns.map((column, index) => {
1733
- const columnId = column.id;
1734
- const dataType = detectDataType(columnId);
1735
- const currentType = summaryConfig[columnId] ?? "none";
1736
- const options = summaryOptions[dataType] ?? summaryOptions.text;
1737
- const summaryValue = calculateSummary(
1738
- column,
1739
- allData,
1740
- currentType,
1741
- dataType
1742
- );
1743
- const isHovered = hoveredColumnId === columnId;
1744
- const isLastColumn = index === visibleColumns.length - 1;
1745
- const isFirstColumn = index === 0;
1746
- return /* @__PURE__ */ jsxRuntime.jsx(
1747
- chunkUM7WMXIU_js.TableCell,
1748
- {
1749
- className: chunkADIDI7AJ_js.cn(
1750
- "p-0 border-0",
1751
- isLastColumn && "rounded-br-md",
1752
- isFirstColumn && "rounded-bl-md"
1753
- ),
1754
- style: { width: column.getSize(), minWidth: column.getSize() },
1755
- children: /* @__PURE__ */ jsxRuntime.jsx(
1756
- SummaryCell,
1757
- {
1758
- columnId,
1759
- column,
1760
- currentType,
1761
- summaryValue,
1762
- options,
1763
- isHovered,
1764
- onSummaryChange,
1765
- onMouseEnter: () => setHoveredColumnId(columnId),
1766
- onMouseLeave: () => setHoveredColumnId(null)
1767
- }
1768
- )
1769
- },
1770
- columnId
1771
- );
1772
- })
1773
- ]
1774
- }
1775
- );
1776
- }
1777
- function SummaryCell({
1778
- columnId,
1779
- currentType,
1780
- summaryValue,
1781
- options,
1782
- isHovered,
1783
- onSummaryChange,
1784
- onMouseEnter,
1785
- onMouseLeave
1786
- }) {
1787
- const [isOpen, setIsOpen] = React12__namespace.useState(false);
1788
- const showCalculate = currentType === "none" && (isHovered || isOpen);
1789
- const context = chunkUM7WMXIU_js.useDataTableContext();
1790
- const isCompact = context?.density === "compact";
1791
- return (
1792
- // biome-ignore lint/a11y/noStaticElementInteractions: Hover state for visual feedback only
1793
- /* @__PURE__ */ jsxRuntime.jsx(
1794
- "div",
1795
- {
1796
- className: chunkADIDI7AJ_js.cn(
1797
- "flex items-center min-w-0",
1798
- isCompact ? "px-1.5 py-0.5" : "px-2 py-1"
1799
- ),
1800
- onMouseEnter,
1801
- onMouseLeave,
1802
- role: "presentation",
1803
- children: /* @__PURE__ */ jsxRuntime.jsxs(chunkJ6OLBSZR_js.DropdownMenu, { open: isOpen, onOpenChange: setIsOpen, children: [
1804
- /* @__PURE__ */ jsxRuntime.jsx(chunkJ6OLBSZR_js.DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsxs(
1805
- "button",
1806
- {
1807
- type: "button",
1808
- className: chunkADIDI7AJ_js.cn(
1809
- "group flex items-center gap-1 text-xs transition-colors rounded px-1 py-0.5 -mx-1 focus:outline-none focus-visible:outline-none",
1810
- currentType === "none" ? "text-muted-foreground/50 hover:text-muted-foreground" : "text-muted-foreground hover:text-foreground"
1811
- ),
1812
- children: [
1813
- currentType === "none" ? /* @__PURE__ */ jsxRuntime.jsx(
1814
- "span",
1815
- {
1816
- className: chunkADIDI7AJ_js.cn(
1817
- "italic transition-opacity",
1818
- showCalculate ? "opacity-100" : "opacity-0"
1819
- ),
1820
- children: "Calculate"
1821
- }
1822
- ) : /* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate italic pr-1", children: summaryValue }),
1823
- /* @__PURE__ */ jsxRuntime.jsx(
1824
- lucideReact.ChevronDown,
1825
- {
1826
- className: chunkADIDI7AJ_js.cn(
1827
- "size-3 shrink-0 transition-opacity",
1828
- currentType !== "none" ? "opacity-0 group-hover:opacity-50" : "opacity-0"
1829
- )
1830
- }
1831
- )
1832
- ]
1833
- }
1834
- ) }),
1835
- /* @__PURE__ */ jsxRuntime.jsx(chunkJ6OLBSZR_js.DropdownMenuContent, { align: "start", className: "w-40", children: options.map((option) => /* @__PURE__ */ jsxRuntime.jsx(
1836
- chunkJ6OLBSZR_js.DropdownMenuItem,
1837
- {
1838
- onClick: () => onSummaryChange(columnId, option.value),
1839
- className: chunkADIDI7AJ_js.cn(
1840
- "text-xs",
1841
- currentType === option.value && "bg-accent"
1842
- ),
1843
- children: option.label
1844
- },
1845
- option.value
1846
- )) })
1847
- ] })
1848
- }
1849
- )
1850
- );
1851
- }
1852
- function DataTableSearch({
1853
- searchValue = "",
1854
- searchPlaceholder = "Search...",
1855
- onSearchChange,
1856
- className
1857
- }) {
1858
- const context = chunkUM7WMXIU_js.useDataTableContext();
1859
- const fontSizeClass = context?.fontSizeClass ?? "text-xs";
1860
- const [isExpanded, setIsExpanded] = React12__namespace.useState(false);
1861
- const inputRef = React12__namespace.useRef(null);
1862
- React12__namespace.useEffect(() => {
1863
- if (searchValue && !isExpanded) {
1864
- setIsExpanded(true);
1865
- }
1866
- }, [searchValue, isExpanded]);
1867
- React12__namespace.useEffect(() => {
1868
- if (isExpanded && inputRef.current) {
1869
- inputRef.current.focus();
1870
- }
1871
- }, [isExpanded]);
1872
- const handleBlur = () => {
1873
- if (!searchValue) {
1874
- setIsExpanded(false);
1875
- }
1876
- };
1877
- const handleClear = () => {
1878
- onSearchChange?.("");
1879
- setIsExpanded(false);
1880
- };
1881
- return /* @__PURE__ */ jsxRuntime.jsx("div", { className: chunkADIDI7AJ_js.cn("relative flex items-center", className), children: /* @__PURE__ */ jsxRuntime.jsxs(
1882
- "div",
1883
- {
1884
- className: chunkADIDI7AJ_js.cn(
1885
- "flex items-center rounded-md border border-transparent transition-all duration-200 ease-out",
1886
- isExpanded ? "w-48 border-input bg-background" : "w-8 cursor-pointer"
1887
- ),
1888
- children: [
1889
- /* @__PURE__ */ jsxRuntime.jsx(
1890
- "button",
1891
- {
1892
- type: "button",
1893
- onClick: () => !isExpanded && setIsExpanded(true),
1894
- className: chunkADIDI7AJ_js.cn(
1895
- "flex items-center justify-center shrink-0 transition-colors rounded-md",
1896
- dataTableTopperIconClasses,
1897
- isExpanded ? "size-8 cursor-default" : "size-8"
1898
- ),
1899
- "aria-label": isExpanded ? void 0 : "Search",
1900
- children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Search, { className: "size-4" })
1901
- }
1902
- ),
1903
- /* @__PURE__ */ jsxRuntime.jsx(
1904
- "input",
1905
- {
1906
- ref: inputRef,
1907
- type: "text",
1908
- placeholder: searchPlaceholder,
1909
- value: searchValue,
1910
- onChange: (e) => onSearchChange?.(e.target.value),
1911
- onBlur: handleBlur,
1912
- className: chunkADIDI7AJ_js.cn(
1913
- "h-8 bg-transparent outline-none placeholder:text-muted-foreground transition-all duration-200",
1914
- fontSizeClass,
1915
- isExpanded ? "w-full pr-7 opacity-100" : "w-0 opacity-0"
1916
- )
1917
- }
1918
- ),
1919
- isExpanded && searchValue && /* @__PURE__ */ jsxRuntime.jsx(
1920
- "button",
1921
- {
1922
- type: "button",
1923
- onClick: handleClear,
1924
- className: "absolute right-1.5 flex items-center justify-center size-5 rounded-sm hover:bg-accent/50",
1925
- "aria-label": "Clear search",
1926
- children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.X, { className: "size-3.5 text-muted-foreground" })
1927
- }
1928
- )
1929
- ]
1930
- }
1931
- ) });
1932
- }
1933
- function DataTableToolbar({
1934
- searchValue = "",
1935
- searchPlaceholder = "Search...",
1936
- onSearchChange,
1937
- className,
1938
- children,
1939
- ...props
1940
- }) {
1941
- return /* @__PURE__ */ jsxRuntime.jsxs(
1942
- "div",
1943
- {
1944
- role: "toolbar",
1945
- "aria-orientation": "horizontal",
1946
- className: chunkADIDI7AJ_js.cn(
1947
- "flex w-full items-center justify-end gap-1 px-1",
1948
- className
1949
- ),
1950
- ...props,
1951
- children: [
1952
- onSearchChange && /* @__PURE__ */ jsxRuntime.jsx(
1953
- DataTableSearch,
1954
- {
1955
- searchValue,
1956
- searchPlaceholder,
1957
- onSearchChange
1958
- }
1959
- ),
1960
- children
1961
- ]
1962
- }
1963
- );
1964
- }
1965
- function DataTableTopper({
1966
- tabs,
1967
- activeTab,
1968
- onTabChange,
1969
- gutterWidth = 0,
1970
- className,
1971
- children,
1972
- ...props
1973
- }) {
1974
- return /* @__PURE__ */ jsxRuntime.jsx(
1975
- "div",
1976
- {
1977
- className: chunkADIDI7AJ_js.cn(
1978
- // Container context for responsive layout based on available width
1979
- "@container w-full min-w-0 shrink-0",
1980
- // Visual styling
1981
- "border-b border-border/40 pb-1",
1982
- className
1983
- ),
1984
- ...props,
1985
- children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex w-full flex-row items-center justify-between gap-3", children: [
1986
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex min-w-0 shrink-0 items-center gap-0.5", children: [
1987
- gutterWidth > 0 && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "shrink-0", style: { width: gutterWidth } }),
1988
- tabs && tabs.length > 0 && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "block @min-[450px]:hidden", children: /* @__PURE__ */ jsxRuntime.jsxs(chunkWOITB4JL_js.Select, { value: activeTab, onValueChange: onTabChange, children: [
1989
- /* @__PURE__ */ jsxRuntime.jsx(chunkWOITB4JL_js.SelectTrigger, { className: "h-7 w-[100px] text-xs", children: /* @__PURE__ */ jsxRuntime.jsx(chunkWOITB4JL_js.SelectValue, { placeholder: "Select tab" }) }),
1990
- /* @__PURE__ */ jsxRuntime.jsx(chunkWOITB4JL_js.SelectContent, { children: tabs.map((tab) => /* @__PURE__ */ jsxRuntime.jsx(chunkWOITB4JL_js.SelectItem, { value: tab.id, children: /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "flex items-center gap-2", children: [
1991
- tab.label,
1992
- tab.count !== void 0 && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground text-xs", children: tab.count })
1993
- ] }) }, tab.id)) })
1994
- ] }) }),
1995
- /* @__PURE__ */ jsxRuntime.jsx(
1996
- "div",
1997
- {
1998
- className: chunkADIDI7AJ_js.cn(
1999
- "items-center gap-0.5 overflow-x-auto no-scrollbar",
2000
- tabs && tabs.length > 0 ? "hidden @min-[450px]:flex" : "flex"
2001
- ),
2002
- children: tabs?.map((tab) => /* @__PURE__ */ jsxRuntime.jsxs(
2003
- "button",
2004
- {
2005
- type: "button",
2006
- onClick: () => onTabChange?.(tab.id),
2007
- className: chunkADIDI7AJ_js.cn(
2008
- "relative flex items-center gap-1.5 px-2 py-1 text-sm transition-colors rounded-md whitespace-nowrap",
2009
- activeTab === tab.id ? "text-foreground font-medium" : "text-muted-foreground hover:text-foreground hover:bg-accent/50"
2010
- ),
2011
- children: [
2012
- tab.label,
2013
- tab.count !== void 0 && /* @__PURE__ */ jsxRuntime.jsx(
2014
- "span",
2015
- {
2016
- className: chunkADIDI7AJ_js.cn(
2017
- "text-xs tabular-nums",
2018
- activeTab === tab.id ? "text-muted-foreground" : "text-muted-foreground/60"
2019
- ),
2020
- children: tab.count
2021
- }
2022
- ),
2023
- activeTab === tab.id && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "absolute bottom-0 left-2 right-2 h-0.5 bg-foreground rounded-full" })
2024
- ]
2025
- },
2026
- tab.id
2027
- ))
2028
- }
2029
- )
2030
- ] }),
2031
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center gap-2", children })
2032
- ] })
2033
- }
2034
- );
2035
- }
2036
- function getColumnDisplayName(column) {
2037
- const meta = column.columnDef.meta;
2038
- if (meta?.displayName) {
2039
- return meta.displayName;
2040
- }
2041
- if (typeof column.columnDef.header === "string") {
2042
- return column.columnDef.header;
2043
- }
2044
- return column.id;
2045
- }
2046
- function DataTableViewOptions({
2047
- table
2048
- }) {
2049
- const context = chunkUM7WMXIU_js.useDataTableContext();
2050
- const fontSizeClass = context?.fontSizeClass ?? "text-xs";
2051
- const [draggedId, setDraggedId] = React12__namespace.useState(null);
2052
- const [dragOverId, setDragOverId] = React12__namespace.useState(null);
2053
- const columns = React12__namespace.useMemo(
2054
- () => table.getAllColumns().filter(
2055
- (column) => typeof column.accessorFn !== "undefined" && column.getCanHide()
2056
- ),
2057
- [table]
2058
- );
2059
- const columnOrder = table.getState().columnOrder;
2060
- const orderedColumns = React12__namespace.useMemo(() => {
2061
- if (!columnOrder || columnOrder.length === 0) {
2062
- return columns;
2063
- }
2064
- return [...columns].sort((a, b) => {
2065
- const aIndex = columnOrder.indexOf(a.id);
2066
- const bIndex = columnOrder.indexOf(b.id);
2067
- if (aIndex === -1 && bIndex === -1) return 0;
2068
- if (aIndex === -1) return 1;
2069
- if (bIndex === -1) return -1;
2070
- return aIndex - bIndex;
2071
- });
2072
- }, [columns, columnOrder]);
2073
- const handleDragStart = (e, columnId) => {
2074
- setDraggedId(columnId);
2075
- e.dataTransfer.effectAllowed = "move";
2076
- e.dataTransfer.setData("text/plain", columnId);
2077
- };
2078
- const handleDragOver = (e, columnId) => {
2079
- e.preventDefault();
2080
- if (draggedId && draggedId !== columnId) {
2081
- setDragOverId(columnId);
2082
- }
2083
- };
2084
- const handleDragLeave = () => {
2085
- setDragOverId(null);
2086
- };
2087
- const handleDrop = (e, targetColumnId) => {
2088
- e.preventDefault();
2089
- if (!draggedId || draggedId === targetColumnId) {
2090
- setDraggedId(null);
2091
- setDragOverId(null);
2092
- return;
2093
- }
2094
- const allColumnIds = table.getAllColumns().map((c) => c.id);
2095
- const currentOrder = columnOrder && columnOrder.length > 0 ? [...columnOrder] : [...allColumnIds];
2096
- const draggedIndex = currentOrder.indexOf(draggedId);
2097
- const targetIndex = currentOrder.indexOf(targetColumnId);
2098
- if (draggedIndex === -1 || targetIndex === -1) {
2099
- setDraggedId(null);
2100
- setDragOverId(null);
2101
- return;
2102
- }
2103
- currentOrder.splice(draggedIndex, 1);
2104
- currentOrder.splice(targetIndex, 0, draggedId);
2105
- table.setColumnOrder(currentOrder);
2106
- setDraggedId(null);
2107
- setDragOverId(null);
2108
- };
2109
- const handleDragEnd = () => {
2110
- setDraggedId(null);
2111
- setDragOverId(null);
2112
- };
2113
- return /* @__PURE__ */ jsxRuntime.jsxs(chunkJ6OLBSZR_js.DropdownMenu, { children: [
2114
- /* @__PURE__ */ jsxRuntime.jsx(chunkJ6OLBSZR_js.DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(
2115
- chunk6TGV2DNP_js.Button,
2116
- {
2117
- ...dataTableTopperButtonProps,
2118
- "aria-label": "View columns",
2119
- className: dataTableTopperOpenStateClasses,
2120
- children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Settings2, { className: "size-4" })
2121
- }
2122
- ) }),
2123
- /* @__PURE__ */ jsxRuntime.jsxs(chunkJ6OLBSZR_js.DropdownMenuContent, { align: "end", className: "w-52", children: [
2124
- /* @__PURE__ */ jsxRuntime.jsx(
2125
- chunkJ6OLBSZR_js.DropdownMenuLabel,
2126
- {
2127
- className: chunkADIDI7AJ_js.cn("font-normal text-muted-foreground", fontSizeClass),
2128
- children: "View Columns"
2129
- }
2130
- ),
2131
- /* @__PURE__ */ jsxRuntime.jsx(chunkJ6OLBSZR_js.DropdownMenuSeparator, {}),
2132
- /* @__PURE__ */ jsxRuntime.jsx("div", { role: "list", className: "max-h-64 overflow-y-auto", children: orderedColumns.map((column) => {
2133
- const label = getColumnDisplayName(column);
2134
- const isVisible = column.getIsVisible();
2135
- const isDragging = draggedId === column.id;
2136
- const isDragOver = dragOverId === column.id;
2137
- return (
2138
- // biome-ignore lint/a11y/useSemanticElements: Using div with role for dropdown menu compatibility
2139
- /* @__PURE__ */ jsxRuntime.jsxs(
2140
- "div",
2141
- {
2142
- role: "listitem",
2143
- draggable: true,
2144
- onDragStart: (e) => handleDragStart(e, column.id),
2145
- onDragOver: (e) => handleDragOver(e, column.id),
2146
- onDragLeave: handleDragLeave,
2147
- onDrop: (e) => handleDrop(e, column.id),
2148
- onDragEnd: handleDragEnd,
2149
- className: chunkADIDI7AJ_js.cn(
2150
- "flex items-center gap-2 px-2 py-1.5 rounded-sm cursor-default",
2151
- fontSizeClass,
2152
- "hover:bg-accent hover:text-accent-foreground",
2153
- isDragging && "opacity-50",
2154
- isDragOver && "bg-accent/50"
2155
- ),
2156
- children: [
2157
- /* @__PURE__ */ jsxRuntime.jsx(
2158
- "div",
2159
- {
2160
- className: chunkADIDI7AJ_js.cn(
2161
- "flex items-center justify-center size-5 cursor-grab active:cursor-grabbing shrink-0",
2162
- dataTableTopperIconClasses
2163
- ),
2164
- children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.GripVertical, { className: "size-3.5" })
2165
- }
2166
- ),
2167
- /* @__PURE__ */ jsxRuntime.jsx(
2168
- "span",
2169
- {
2170
- className: chunkADIDI7AJ_js.cn(
2171
- "flex-1",
2172
- !isVisible && "text-muted-foreground"
2173
- ),
2174
- children: label
2175
- }
2176
- ),
2177
- /* @__PURE__ */ jsxRuntime.jsx(
2178
- "button",
2179
- {
2180
- type: "button",
2181
- onClick: () => column.toggleVisibility(!isVisible),
2182
- className: chunkADIDI7AJ_js.cn(
2183
- "flex items-center justify-center size-5 rounded-sm shrink-0",
2184
- dataTableTopperIconClasses
2185
- ),
2186
- "aria-label": isVisible ? "Hide column" : "Show column",
2187
- children: isVisible ? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Eye, { className: "size-3.5" }) : /* @__PURE__ */ jsxRuntime.jsx(lucideReact.EyeOff, { className: "size-3.5" })
2188
- }
2189
- )
2190
- ]
2191
- },
2192
- column.id
2193
- )
2194
- );
2195
- }) })
2196
- ] })
2197
- ] });
2198
- }
2199
- function hasUnsavedChanges(currentState, activeView) {
2200
- if (!activeView) return false;
2201
- const visA = JSON.stringify(currentState.columnVisibility ?? {});
2202
- const visB = JSON.stringify(activeView.columnVisibility ?? {});
2203
- if (visA !== visB) return true;
2204
- const filtA = JSON.stringify(currentState.filters ?? []);
2205
- const filtB = JSON.stringify(activeView.filters ?? []);
2206
- if (filtA !== filtB) return true;
2207
- const sortA = JSON.stringify(currentState.sorting ?? []);
2208
- const sortB = JSON.stringify(activeView.sorting ?? []);
2209
- if (sortA !== sortB) return true;
2210
- const orderA = JSON.stringify(currentState.columnOrder ?? []);
2211
- const orderB = JSON.stringify(activeView.columnOrder ?? []);
2212
- if (orderA !== orderB) return true;
2213
- const wrapA = JSON.stringify(currentState.columnWrapping ?? {});
2214
- const wrapB = JSON.stringify(activeView.columnWrapping ?? {});
2215
- if (wrapA !== wrapB) return true;
2216
- const rowA = JSON.stringify(currentState.rowOrder ?? []);
2217
- const rowB = JSON.stringify(activeView.rowOrder ?? []);
2218
- if (rowA !== rowB) return true;
2219
- return false;
2220
- }
2221
- function DataTableViews({
2222
- views,
2223
- activeViewId,
2224
- currentState,
2225
- onSelectView,
2226
- onSaveView,
2227
- onUpdateView,
2228
- onDeleteView,
2229
- onSetDefaultView,
2230
- className
2231
- }) {
2232
- const context = chunkUM7WMXIU_js.useDataTableContext();
2233
- const fontSizeClass = context?.fontSizeClass ?? "text-xs";
2234
- const [saveDialogOpen, setSaveDialogOpen] = React12__namespace.useState(false);
2235
- const [newViewName, setNewViewName] = React12__namespace.useState("");
2236
- const [setAsDefault, setSetAsDefault] = React12__namespace.useState(false);
2237
- const [nameError, setNameError] = React12__namespace.useState(null);
2238
- const activeView = views.find((v) => v.id === activeViewId);
2239
- views.find((v) => v.isDefault);
2240
- const hasChanges = hasUnsavedChanges(currentState, activeView);
2241
- const checkDuplicateName = (name) => {
2242
- const trimmedName = name.trim();
2243
- if (!trimmedName) {
2244
- setNameError(null);
2245
- return;
2246
- }
2247
- const isDuplicate = views.some(
2248
- (v) => v.name.toLowerCase() === trimmedName.toLowerCase()
2249
- );
2250
- setNameError(isDuplicate ? "A view with this name already exists" : null);
2251
- };
2252
- const handleSaveNewView = () => {
2253
- if (!newViewName.trim()) return;
2254
- const trimmedName = newViewName.trim();
2255
- const isDuplicate = views.some(
2256
- (v) => v.name.toLowerCase() === trimmedName.toLowerCase()
2257
- );
2258
- if (isDuplicate) {
2259
- setNameError("A view with this name already exists");
2260
- return;
2261
- }
2262
- if (onSaveView) {
2263
- onSaveView({
2264
- name: trimmedName,
2265
- columnVisibility: currentState.columnVisibility,
2266
- columnOrder: currentState.columnOrder,
2267
- filters: currentState.filters,
2268
- sorting: currentState.sorting,
2269
- isDefault: setAsDefault
2270
- });
2271
- }
2272
- setNewViewName("");
2273
- setSetAsDefault(false);
2274
- setNameError(null);
2275
- setSaveDialogOpen(false);
2276
- };
2277
- const handleUpdateCurrentView = () => {
2278
- if (!activeViewId || !onUpdateView) return;
2279
- onUpdateView(activeViewId, {
2280
- columnVisibility: currentState.columnVisibility,
2281
- columnOrder: currentState.columnOrder,
2282
- filters: currentState.filters,
2283
- sorting: currentState.sorting,
2284
- updatedAt: (/* @__PURE__ */ new Date()).toISOString()
2285
- });
2286
- };
2287
- return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
2288
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: chunkADIDI7AJ_js.cn("flex items-center gap-1", className), children: /* @__PURE__ */ jsxRuntime.jsxs(chunkJ6OLBSZR_js.DropdownMenu, { children: [
2289
- /* @__PURE__ */ jsxRuntime.jsx(chunkJ6OLBSZR_js.DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsxs(
2290
- chunk6TGV2DNP_js.Button,
2291
- {
2292
- ...dataTableTopperButtonProps,
2293
- className: chunkADIDI7AJ_js.cn(
2294
- fontSizeClass,
2295
- dataTableTopperOpenStateClasses,
2296
- dataTableTopperResponsiveClasses
2297
- ),
2298
- children: [
2299
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.LayoutGrid, { className: "size-4" }),
2300
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "hidden @min-[450px]:inline", children: activeView?.name ?? "Default View" })
2301
- ]
2302
- }
2303
- ) }),
2304
- /* @__PURE__ */ jsxRuntime.jsxs(chunkJ6OLBSZR_js.DropdownMenuContent, { align: "start", className: "w-56", children: [
2305
- views.length > 0 ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
2306
- views.map((view) => /* @__PURE__ */ jsxRuntime.jsxs(
2307
- "div",
2308
- {
2309
- className: "group relative flex items-center",
2310
- children: [
2311
- /* @__PURE__ */ jsxRuntime.jsxs(
2312
- chunkJ6OLBSZR_js.DropdownMenuItem,
2313
- {
2314
- onClick: () => onSelectView(view),
2315
- className: chunkADIDI7AJ_js.cn(
2316
- "flex-1 flex items-center justify-between pr-16",
2317
- fontSizeClass
2318
- ),
2319
- children: [
2320
- /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "flex items-center gap-2", children: [
2321
- view.isDefault && /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Star, { className: "size-3 fill-yellow-400 text-yellow-400" }),
2322
- /* @__PURE__ */ jsxRuntime.jsx("span", { children: view.name })
2323
- ] }),
2324
- activeViewId === view.id && /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Check, { className: "size-3.5 text-primary" })
2325
- ]
2326
- }
2327
- ),
2328
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "absolute right-2 flex items-center gap-1 opacity-0 group-hover:opacity-100 transition-opacity", children: [
2329
- !view.isDefault && onSetDefaultView && /* @__PURE__ */ jsxRuntime.jsx(
2330
- "button",
2331
- {
2332
- type: "button",
2333
- onClick: (e) => {
2334
- e.stopPropagation();
2335
- onSetDefaultView(view.id);
2336
- },
2337
- className: "p-1 rounded hover:bg-accent text-muted-foreground hover:text-foreground",
2338
- title: "Set as default",
2339
- children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Star, { className: "size-3" })
2340
- }
2341
- ),
2342
- views.length > 1 && onDeleteView && /* @__PURE__ */ jsxRuntime.jsx(
2343
- "button",
2344
- {
2345
- type: "button",
2346
- onClick: (e) => {
2347
- e.stopPropagation();
2348
- onDeleteView(view.id);
2349
- },
2350
- className: "p-1 rounded hover:bg-accent text-muted-foreground hover:text-destructive",
2351
- title: "Delete view",
2352
- children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Trash2, { className: "size-3" })
2353
- }
2354
- )
2355
- ] })
2356
- ]
2357
- },
2358
- view.id
2359
- )),
2360
- /* @__PURE__ */ jsxRuntime.jsx(chunkJ6OLBSZR_js.DropdownMenuSeparator, {})
2361
- ] }) : null,
2362
- onUpdateView && hasChanges && activeView && /* @__PURE__ */ jsxRuntime.jsxs(
2363
- chunkJ6OLBSZR_js.DropdownMenuItem,
2364
- {
2365
- onClick: handleUpdateCurrentView,
2366
- className: fontSizeClass,
2367
- children: [
2368
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Save, { className: "mr-2 size-3.5" }),
2369
- "Save changes"
2370
- ]
2371
- }
2372
- ),
2373
- onSaveView && /* @__PURE__ */ jsxRuntime.jsxs(
2374
- chunkJ6OLBSZR_js.DropdownMenuItem,
2375
- {
2376
- onClick: () => setSaveDialogOpen(true),
2377
- className: fontSizeClass,
2378
- children: [
2379
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Plus, { className: "mr-2 size-3.5" }),
2380
- "Save as new view"
2381
- ]
2382
- }
2383
- )
2384
- ] })
2385
- ] }) }),
2386
- /* @__PURE__ */ jsxRuntime.jsx(
2387
- chunkKGGQ5NZV_js.Dialog,
2388
- {
2389
- open: saveDialogOpen,
2390
- onOpenChange: (open) => {
2391
- setSaveDialogOpen(open);
2392
- if (!open) {
2393
- setNewViewName("");
2394
- setSetAsDefault(false);
2395
- setNameError(null);
2396
- }
2397
- },
2398
- children: /* @__PURE__ */ jsxRuntime.jsxs(chunkKGGQ5NZV_js.DialogContent, { className: "sm:max-w-md", children: [
2399
- /* @__PURE__ */ jsxRuntime.jsxs(chunkKGGQ5NZV_js.DialogHeader, { children: [
2400
- /* @__PURE__ */ jsxRuntime.jsx(chunkKGGQ5NZV_js.DialogTitle, { children: "Save View" }),
2401
- /* @__PURE__ */ jsxRuntime.jsx(chunkKGGQ5NZV_js.DialogDescription, { children: "Save your current table configuration as a reusable view." })
2402
- ] }),
2403
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-4 py-4", children: [
2404
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-2", children: [
2405
- /* @__PURE__ */ jsxRuntime.jsx(chunk33JR5SYE_js.Label, { htmlFor: "view-name", children: "View name" }),
2406
- /* @__PURE__ */ jsxRuntime.jsx(
2407
- chunkDQWHYBV2_js.Input,
2408
- {
2409
- id: "view-name",
2410
- placeholder: "e.g., Active Users, Recent Signups",
2411
- value: newViewName,
2412
- onChange: (e) => {
2413
- setNewViewName(e.target.value);
2414
- checkDuplicateName(e.target.value);
2415
- },
2416
- onKeyDown: (e) => {
2417
- if (e.key === "Enter") handleSaveNewView();
2418
- },
2419
- className: nameError ? "border-destructive" : "",
2420
- autoFocus: true
2421
- }
2422
- ),
2423
- nameError && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-destructive", children: nameError })
2424
- ] }),
2425
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [
2426
- /* @__PURE__ */ jsxRuntime.jsx(
2427
- "input",
2428
- {
2429
- type: "checkbox",
2430
- id: "set-default",
2431
- checked: setAsDefault,
2432
- onChange: (e) => setSetAsDefault(e.target.checked),
2433
- className: "size-4 rounded border-muted-foreground/30"
2434
- }
2435
- ),
2436
- /* @__PURE__ */ jsxRuntime.jsx(
2437
- chunk33JR5SYE_js.Label,
2438
- {
2439
- htmlFor: "set-default",
2440
- className: "text-sm font-normal cursor-pointer",
2441
- children: "Set as default view"
2442
- }
2443
- )
2444
- ] })
2445
- ] }),
2446
- /* @__PURE__ */ jsxRuntime.jsxs(chunkKGGQ5NZV_js.DialogFooter, { children: [
2447
- /* @__PURE__ */ jsxRuntime.jsx(chunk6TGV2DNP_js.Button, { variant: "outline", onClick: () => setSaveDialogOpen(false), children: "Cancel" }),
2448
- /* @__PURE__ */ jsxRuntime.jsx(
2449
- chunk6TGV2DNP_js.Button,
2450
- {
2451
- onClick: handleSaveNewView,
2452
- disabled: !newViewName.trim() || !!nameError,
2453
- children: "Save View"
2454
- }
2455
- )
2456
- ] })
2457
- ] })
2458
- }
2459
- )
2460
- ] });
2461
- }
2462
- function Command({
2463
- className,
2464
- ...props
2465
- }) {
2466
- return /* @__PURE__ */ jsxRuntime.jsx(
2467
- cmdk.Command,
2468
- {
2469
- className: chunkADIDI7AJ_js.cn(
2470
- "bg-popover text-popover-foreground flex h-full w-full flex-col overflow-hidden rounded-box",
2471
- className
2472
- ),
2473
- ...props
2474
- }
2475
- );
2476
- }
2477
- function CommandDialog({
2478
- children,
2479
- title = "Command palette",
2480
- ...props
2481
- }) {
2482
- return /* @__PURE__ */ jsxRuntime.jsx(chunkKGGQ5NZV_js.Dialog, { ...props, children: /* @__PURE__ */ jsxRuntime.jsxs(chunkKGGQ5NZV_js.DialogContent, { className: "overflow-hidden p-0", children: [
2483
- /* @__PURE__ */ jsxRuntime.jsx(chunkKGGQ5NZV_js.DialogTitle, { className: "sr-only", children: title }),
2484
- /* @__PURE__ */ jsxRuntime.jsx(Command, { className: "[&_[cmdk-group-heading]]:text-muted-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-group]]:px-2 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5", children })
2485
- ] }) });
2486
- }
2487
- function CommandInput({
2488
- className,
2489
- ...props
2490
- }) {
2491
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center border-b px-3", "cmdk-input-wrapper": "", children: [
2492
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Search, { className: "mr-2 h-4 w-4 shrink-0 opacity-50" }),
2493
- /* @__PURE__ */ jsxRuntime.jsx(
2494
- cmdk.Command.Input,
2495
- {
2496
- className: chunkADIDI7AJ_js.cn(
2497
- "placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground flex h-10 w-full rounded-box bg-transparent py-3 text-sm outline-none disabled:cursor-not-allowed disabled:opacity-50",
2498
- className
2499
- ),
2500
- ...props
2501
- }
2502
- )
2503
- ] });
2504
- }
2505
- function CommandList({
2506
- className,
2507
- ...props
2508
- }) {
2509
- return /* @__PURE__ */ jsxRuntime.jsx(
2510
- cmdk.Command.List,
2511
- {
2512
- className: chunkADIDI7AJ_js.cn(
2513
- "max-h-[300px] overflow-y-auto overflow-x-hidden scroll-py-1",
2514
- className
2515
- ),
2516
- ...props
2517
- }
2518
- );
2519
- }
2520
- function CommandEmpty({
2521
- className,
2522
- ...props
2523
- }) {
2524
- return /* @__PURE__ */ jsxRuntime.jsx(
2525
- cmdk.Command.Empty,
2526
- {
2527
- className: chunkADIDI7AJ_js.cn("py-6 text-center text-sm", className),
2528
- ...props
2529
- }
2530
- );
2531
- }
2532
- function CommandGroup({
2533
- className,
2534
- ...props
2535
- }) {
2536
- return /* @__PURE__ */ jsxRuntime.jsx(
2537
- cmdk.Command.Group,
2538
- {
2539
- className: chunkADIDI7AJ_js.cn(
2540
- "text-foreground [&_[cmdk-group-heading]]:text-muted-foreground overflow-hidden p-1 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium",
2541
- className
2542
- ),
2543
- ...props
2544
- }
2545
- );
2546
- }
2547
- function CommandSeparator({
2548
- className,
2549
- ...props
2550
- }) {
2551
- return /* @__PURE__ */ jsxRuntime.jsx(
2552
- cmdk.Command.Separator,
2553
- {
2554
- className: chunkADIDI7AJ_js.cn("bg-border -mx-1 h-px", className),
2555
- ...props
2556
- }
2557
- );
2558
- }
2559
- function CommandItem({
2560
- className,
2561
- ...props
2562
- }) {
2563
- return /* @__PURE__ */ jsxRuntime.jsx(
2564
- cmdk.Command.Item,
2565
- {
2566
- className: chunkADIDI7AJ_js.cn(
2567
- "data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
2568
- className
2569
- ),
2570
- ...props
2571
- }
2572
- );
2573
- }
2574
- function CommandShortcut({
2575
- className,
2576
- ...props
2577
- }) {
2578
- return /* @__PURE__ */ jsxRuntime.jsx(
2579
- "span",
2580
- {
2581
- className: chunkADIDI7AJ_js.cn(
2582
- "text-muted-foreground ml-auto text-xs tracking-widest",
2583
- className
2584
- ),
2585
- ...props
2586
- }
2587
- );
2588
- }
2589
- function Combobox({
2590
- options,
2591
- value,
2592
- onValueChange,
2593
- placeholder = "Select...",
2594
- mutedPlaceholder = true,
2595
- searchPlaceholder = "Search...",
2596
- emptyText = "No results found.",
2597
- disabled = false,
2598
- allowCreate = false,
2599
- createLabel = "Create new",
2600
- onCreateNew,
2601
- loading = false,
846
+ function Combobox({
847
+ options,
848
+ value,
849
+ onValueChange,
850
+ placeholder = "Select...",
851
+ mutedPlaceholder = true,
852
+ searchPlaceholder = "Search...",
853
+ emptyText = "No results found.",
854
+ disabled = false,
855
+ allowCreate = false,
856
+ createLabel = "Create new",
857
+ onCreateNew,
858
+ loading = false,
2602
859
  className,
2603
860
  size = "default",
2604
861
  align = "start",
@@ -2606,43 +863,43 @@ function Combobox({
2606
863
  icon,
2607
864
  "aria-label": ariaLabel
2608
865
  }) {
2609
- const [open, setOpen] = React12.useState(false);
2610
- const [searchValue, setSearchValue] = React12.useState("");
2611
- const triggerRef = React12.useRef(null);
2612
- const selectedOption = React12.useMemo(
866
+ const [open, setOpen] = React5.useState(false);
867
+ const [searchValue, setSearchValue] = React5.useState("");
868
+ const triggerRef = React5.useRef(null);
869
+ const selectedOption = React5.useMemo(
2613
870
  () => options.find((opt) => opt.value === value),
2614
871
  [options, value]
2615
872
  );
2616
- const filteredOptions = React12.useMemo(() => {
873
+ const filteredOptions = React5.useMemo(() => {
2617
874
  if (!searchValue) return options;
2618
875
  const search = searchValue.toLowerCase();
2619
876
  return options.filter(
2620
877
  (opt) => opt.label.toLowerCase().includes(search) || opt.description?.toLowerCase().includes(search)
2621
878
  );
2622
879
  }, [options, searchValue]);
2623
- const exactMatch = React12.useMemo(() => {
880
+ const exactMatch = React5.useMemo(() => {
2624
881
  if (!searchValue) return true;
2625
882
  const search = searchValue.toLowerCase();
2626
883
  return options.some((opt) => opt.label.toLowerCase() === search);
2627
884
  }, [options, searchValue]);
2628
- React12.useEffect(() => {
885
+ React5.useEffect(() => {
2629
886
  if (!open) {
2630
887
  setSearchValue("");
2631
888
  }
2632
889
  }, [open]);
2633
- const handleSelect = React12.useCallback(
890
+ const handleSelect = React5.useCallback(
2634
891
  (selectedValue) => {
2635
892
  onValueChange?.(selectedValue === value ? "" : selectedValue);
2636
893
  setOpen(false);
2637
894
  },
2638
895
  [onValueChange, value]
2639
896
  );
2640
- const handleCreateNew = React12.useCallback(() => {
897
+ const handleCreateNew = React5.useCallback(() => {
2641
898
  onCreateNew?.(searchValue);
2642
899
  setOpen(false);
2643
900
  setSearchValue("");
2644
901
  }, [onCreateNew, searchValue]);
2645
- const handleKeyDown = React12.useCallback(
902
+ const handleKeyDown = React5.useCallback(
2646
903
  (e) => {
2647
904
  if (e.key === "Enter" && allowCreate && !exactMatch && filteredOptions.length === 0 && searchValue) {
2648
905
  e.preventDefault();
@@ -2657,8 +914,8 @@ function Combobox({
2657
914
  handleCreateNew
2658
915
  ]
2659
916
  );
2660
- return /* @__PURE__ */ jsxRuntime.jsxs(chunkUM7WMXIU_js.Popover, { open, onOpenChange: setOpen, children: [
2661
- /* @__PURE__ */ jsxRuntime.jsx(chunkUM7WMXIU_js.PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsxs(
917
+ return /* @__PURE__ */ jsxRuntime.jsxs(chunkQRS7DJGS_js.Popover, { open, onOpenChange: setOpen, children: [
918
+ /* @__PURE__ */ jsxRuntime.jsx(chunkQRS7DJGS_js.PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsxs(
2662
919
  chunk6TGV2DNP_js.Button,
2663
920
  {
2664
921
  ref: triggerRef,
@@ -2686,21 +943,21 @@ function Combobox({
2686
943
  }
2687
944
  ) }),
2688
945
  /* @__PURE__ */ jsxRuntime.jsx(
2689
- chunkUM7WMXIU_js.PopoverContent,
946
+ chunkQRS7DJGS_js.PopoverContent,
2690
947
  {
2691
948
  className: "w-[--radix-popover-trigger-width] p-0",
2692
949
  align,
2693
- children: /* @__PURE__ */ jsxRuntime.jsxs(Command, { onKeyDown: handleKeyDown, children: [
950
+ children: /* @__PURE__ */ jsxRuntime.jsxs(chunkC3OADNSG_js.Command, { onKeyDown: handleKeyDown, children: [
2694
951
  /* @__PURE__ */ jsxRuntime.jsx(
2695
- CommandInput,
952
+ chunkC3OADNSG_js.CommandInput,
2696
953
  {
2697
954
  placeholder: searchPlaceholder,
2698
955
  value: searchValue,
2699
956
  onValueChange: setSearchValue
2700
957
  }
2701
958
  ),
2702
- /* @__PURE__ */ jsxRuntime.jsxs(CommandList, { children: [
2703
- /* @__PURE__ */ jsxRuntime.jsx(CommandEmpty, { children: allowCreate && searchValue ? /* @__PURE__ */ jsxRuntime.jsxs(
959
+ /* @__PURE__ */ jsxRuntime.jsxs(chunkC3OADNSG_js.CommandList, { children: [
960
+ /* @__PURE__ */ jsxRuntime.jsx(chunkC3OADNSG_js.CommandEmpty, { children: allowCreate && searchValue ? /* @__PURE__ */ jsxRuntime.jsxs(
2704
961
  "button",
2705
962
  {
2706
963
  type: "button",
@@ -2717,8 +974,8 @@ function Combobox({
2717
974
  ]
2718
975
  }
2719
976
  ) : emptyText }),
2720
- /* @__PURE__ */ jsxRuntime.jsx(CommandGroup, { children: filteredOptions.map((option) => /* @__PURE__ */ jsxRuntime.jsxs(
2721
- CommandItem,
977
+ /* @__PURE__ */ jsxRuntime.jsx(chunkC3OADNSG_js.CommandGroup, { children: filteredOptions.map((option) => /* @__PURE__ */ jsxRuntime.jsxs(
978
+ chunkC3OADNSG_js.CommandItem,
2722
979
  {
2723
980
  value: option.label,
2724
981
  onSelect: () => handleSelect(option.value),
@@ -2751,9 +1008,9 @@ function Combobox({
2751
1008
  option.value
2752
1009
  )) }),
2753
1010
  allowCreate && searchValue && !exactMatch && filteredOptions.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
2754
- /* @__PURE__ */ jsxRuntime.jsx(CommandSeparator, {}),
2755
- /* @__PURE__ */ jsxRuntime.jsx(CommandGroup, { children: /* @__PURE__ */ jsxRuntime.jsxs(
2756
- CommandItem,
1011
+ /* @__PURE__ */ jsxRuntime.jsx(chunkC3OADNSG_js.CommandSeparator, {}),
1012
+ /* @__PURE__ */ jsxRuntime.jsx(chunkC3OADNSG_js.CommandGroup, { children: /* @__PURE__ */ jsxRuntime.jsxs(
1013
+ chunkC3OADNSG_js.CommandItem,
2757
1014
  {
2758
1015
  onSelect: handleCreateNew,
2759
1016
  className: "cursor-pointer",
@@ -2775,40 +1032,6 @@ function Combobox({
2775
1032
  )
2776
1033
  ] });
2777
1034
  }
2778
- var Switch = React12__namespace.forwardRef(
2779
- ({ className, checked = false, onCheckedChange, disabled, ...props }, ref) => {
2780
- return /* @__PURE__ */ jsxRuntime.jsx(
2781
- "button",
2782
- {
2783
- type: "button",
2784
- role: "switch",
2785
- "aria-checked": checked,
2786
- "data-state": checked ? "checked" : "unchecked",
2787
- disabled,
2788
- ref,
2789
- onClick: () => onCheckedChange?.(!checked),
2790
- className: chunkADIDI7AJ_js.cn(
2791
- "peer inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent shadow-sm transition-colors",
2792
- "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background",
2793
- "disabled:cursor-not-allowed disabled:opacity-50",
2794
- checked ? "bg-primary" : "bg-input",
2795
- className
2796
- ),
2797
- ...props,
2798
- children: /* @__PURE__ */ jsxRuntime.jsx(
2799
- "span",
2800
- {
2801
- className: chunkADIDI7AJ_js.cn(
2802
- "pointer-events-none block h-4 w-4 rounded-full bg-background shadow-lg ring-0 transition-transform",
2803
- checked ? "translate-x-4" : "translate-x-0"
2804
- )
2805
- }
2806
- )
2807
- }
2808
- );
2809
- }
2810
- );
2811
- Switch.displayName = "Switch";
2812
1035
  function MobilePeriodStepper({
2813
1036
  periodLabel,
2814
1037
  onPrev,
@@ -3074,11 +1297,11 @@ function PeriodSelector({
3074
1297
  className
3075
1298
  }) {
3076
1299
  const fiscalMonth = normalizeFiscalYearEndMonth(fiscalYearEndMonth);
3077
- const now = React12__namespace.useMemo(() => /* @__PURE__ */ new Date(), []);
1300
+ const now = React5__namespace.useMemo(() => /* @__PURE__ */ new Date(), []);
3078
1301
  const selectedStart = safeParseDate(periodStart, now);
3079
1302
  const selectedEnd = safeParseDate(periodEnd, now);
3080
1303
  const anchorDate = granularity === "custom" ? selectedEnd : selectedStart;
3081
- const ranges = React12__namespace.useMemo(() => {
1304
+ const ranges = React5__namespace.useMemo(() => {
3082
1305
  const map = /* @__PURE__ */ new Map();
3083
1306
  for (const row of GRANULARITY_ROWS) {
3084
1307
  const rowAnchor = row.key === granularity ? anchorDate : now;
@@ -3090,7 +1313,7 @@ function PeriodSelector({
3090
1313
  return map;
3091
1314
  }, [anchorDate, fiscalMonth, granularity, now]);
3092
1315
  const activeLabel = allDates ? "All dates" : formatRangeLabel(granularity, selectedStart, selectedEnd);
3093
- const applyRange = React12__namespace.useCallback(
1316
+ const applyRange = React5__namespace.useCallback(
3094
1317
  (nextGranularity, nextRange) => {
3095
1318
  onChange({
3096
1319
  granularity: nextGranularity,
@@ -3102,7 +1325,7 @@ function PeriodSelector({
3102
1325
  },
3103
1326
  [onChange]
3104
1327
  );
3105
- const applyAllDates = React12__namespace.useCallback(() => {
1328
+ const applyAllDates = React5__namespace.useCallback(() => {
3106
1329
  onChange({
3107
1330
  granularity,
3108
1331
  periodStart: "",
@@ -3111,7 +1334,7 @@ function PeriodSelector({
3111
1334
  allDates: true
3112
1335
  });
3113
1336
  }, [granularity, onChange]);
3114
- const selectGranularity = React12__namespace.useCallback(
1337
+ const selectGranularity = React5__namespace.useCallback(
3115
1338
  (nextGranularity) => {
3116
1339
  const range = ranges.get(nextGranularity);
3117
1340
  if (!range) return;
@@ -3119,7 +1342,7 @@ function PeriodSelector({
3119
1342
  },
3120
1343
  [applyRange, ranges]
3121
1344
  );
3122
- const navigate = React12__namespace.useCallback(
1345
+ const navigate = React5__namespace.useCallback(
3123
1346
  (rowGranularity, direction) => {
3124
1347
  const current = !allDates && granularity === rowGranularity ? { start: selectedStart, end: selectedEnd } : ranges.get(rowGranularity);
3125
1348
  if (!current) return;
@@ -3128,8 +1351,8 @@ function PeriodSelector({
3128
1351
  },
3129
1352
  [allDates, applyRange, granularity, ranges, selectedEnd, selectedStart]
3130
1353
  );
3131
- return /* @__PURE__ */ jsxRuntime.jsxs(chunkUM7WMXIU_js.Popover, { children: [
3132
- /* @__PURE__ */ jsxRuntime.jsx(chunkUM7WMXIU_js.PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsxs(
1354
+ return /* @__PURE__ */ jsxRuntime.jsxs(chunkQRS7DJGS_js.Popover, { children: [
1355
+ /* @__PURE__ */ jsxRuntime.jsx(chunkQRS7DJGS_js.PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsxs(
3133
1356
  chunk6TGV2DNP_js.Button,
3134
1357
  {
3135
1358
  type: "button",
@@ -3146,7 +1369,7 @@ function PeriodSelector({
3146
1369
  }
3147
1370
  ) }),
3148
1371
  /* @__PURE__ */ jsxRuntime.jsx(
3149
- chunkUM7WMXIU_js.PopoverContent,
1372
+ chunkQRS7DJGS_js.PopoverContent,
3150
1373
  {
3151
1374
  align: "start",
3152
1375
  className: "w-[380px] p-2",
@@ -3348,9 +1571,9 @@ function FinancialStatementControls({
3348
1571
  showSettings = true,
3349
1572
  showMobilePeriodStepper = true
3350
1573
  }) {
3351
- const desktopToolbarRef = React12.useRef(null);
3352
- const [useCompactFilters, setUseCompactFilters] = React12.useState(false);
3353
- React12.useEffect(() => {
1574
+ const desktopToolbarRef = React5.useRef(null);
1575
+ const [useCompactFilters, setUseCompactFilters] = React5.useState(false);
1576
+ React5.useEffect(() => {
3354
1577
  if (typeof window === "undefined") return;
3355
1578
  const updateCompactFilters = () => {
3356
1579
  const width = window.innerWidth;
@@ -3456,12 +1679,12 @@ function FinancialStatementControls({
3456
1679
  }
3457
1680
  ),
3458
1681
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "ml-auto" }),
3459
- /* @__PURE__ */ jsxRuntime.jsxs(chunkUM7WMXIU_js.Popover, { children: [
1682
+ /* @__PURE__ */ jsxRuntime.jsxs(chunkQRS7DJGS_js.Popover, { children: [
3460
1683
  /* @__PURE__ */ jsxRuntime.jsxs(chunkSORWLKOK_js.Tooltip, { children: [
3461
- /* @__PURE__ */ jsxRuntime.jsx(chunkSORWLKOK_js.TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(chunkUM7WMXIU_js.PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "inline-flex h-8 w-8 cursor-pointer items-center justify-center rounded-md text-muted-foreground transition-colors hover:text-foreground", children: exportIcon ?? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Download, { size: 16 }) }) }) }),
1684
+ /* @__PURE__ */ jsxRuntime.jsx(chunkSORWLKOK_js.TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(chunkQRS7DJGS_js.PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "inline-flex h-8 w-8 cursor-pointer items-center justify-center rounded-md text-muted-foreground transition-colors hover:text-foreground", children: exportIcon ?? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Download, { size: 16 }) }) }) }),
3462
1685
  /* @__PURE__ */ jsxRuntime.jsx(chunkSORWLKOK_js.TooltipContent, { className: "text-xs", children: "Export" })
3463
1686
  ] }),
3464
- /* @__PURE__ */ jsxRuntime.jsxs(chunkUM7WMXIU_js.PopoverContent, { align: "end", className: "w-40 p-1", children: [
1687
+ /* @__PURE__ */ jsxRuntime.jsxs(chunkQRS7DJGS_js.PopoverContent, { align: "end", className: "w-40 p-1", children: [
3465
1688
  /* @__PURE__ */ jsxRuntime.jsxs(
3466
1689
  "button",
3467
1690
  {
@@ -3488,12 +1711,12 @@ function FinancialStatementControls({
3488
1711
  )
3489
1712
  ] })
3490
1713
  ] }),
3491
- showSettings ? /* @__PURE__ */ jsxRuntime.jsxs(chunkUM7WMXIU_js.Popover, { children: [
1714
+ showSettings ? /* @__PURE__ */ jsxRuntime.jsxs(chunkQRS7DJGS_js.Popover, { children: [
3492
1715
  /* @__PURE__ */ jsxRuntime.jsxs(chunkSORWLKOK_js.Tooltip, { children: [
3493
- /* @__PURE__ */ jsxRuntime.jsx(chunkSORWLKOK_js.TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(chunkUM7WMXIU_js.PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "inline-flex h-8 w-8 cursor-pointer items-center justify-center rounded-md text-muted-foreground transition-colors hover:text-foreground", children: settingsIcon ?? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Settings2, { size: 16 }) }) }) }),
1716
+ /* @__PURE__ */ jsxRuntime.jsx(chunkSORWLKOK_js.TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(chunkQRS7DJGS_js.PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "inline-flex h-8 w-8 cursor-pointer items-center justify-center rounded-md text-muted-foreground transition-colors hover:text-foreground", children: settingsIcon ?? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Settings2, { size: 16 }) }) }) }),
3494
1717
  /* @__PURE__ */ jsxRuntime.jsx(chunkSORWLKOK_js.TooltipContent, { className: "text-xs", children: "Settings" })
3495
1718
  ] }),
3496
- /* @__PURE__ */ jsxRuntime.jsx(chunkUM7WMXIU_js.PopoverContent, { align: "end", className: "w-52 p-2", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-1", children: [
1719
+ /* @__PURE__ */ jsxRuntime.jsx(chunkQRS7DJGS_js.PopoverContent, { align: "end", className: "w-52 p-2", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-1", children: [
3497
1720
  /* @__PURE__ */ jsxRuntime.jsx("p", { className: "px-2 py-1 text-xs font-medium text-muted-foreground", children: "Display Settings" }),
3498
1721
  /* @__PURE__ */ jsxRuntime.jsxs(
3499
1722
  "button",
@@ -3580,7 +1803,7 @@ function FinancialStatementControls({
3580
1803
  onChange: onComparisonChange,
3581
1804
  className: "w-full justify-start"
3582
1805
  }
3583
- ) : /* @__PURE__ */ jsxRuntime.jsx(React12.Fragment, {})
1806
+ ) : /* @__PURE__ */ jsxRuntime.jsx(React5.Fragment, {})
3584
1807
  ] }),
3585
1808
  /* @__PURE__ */ jsxRuntime.jsx(
3586
1809
  StatementFilterCombobox,
@@ -3940,7 +2163,7 @@ function PieChartView({
3940
2163
  fill: card.color
3941
2164
  }));
3942
2165
  const pieTotal = pieData.reduce((sum, item) => sum + item.value, 0);
3943
- const activeSliceKeys = React12__namespace.useMemo(() => {
2166
+ const activeSliceKeys = React5__namespace.useMemo(() => {
3944
2167
  if (!activeMetric) return /* @__PURE__ */ new Set();
3945
2168
  const computed = computedMetrics?.find((m) => m.key === activeMetric);
3946
2169
  if (computed) {
@@ -3948,7 +2171,7 @@ function PieChartView({
3948
2171
  }
3949
2172
  return /* @__PURE__ */ new Set([activeMetric]);
3950
2173
  }, [activeMetric, computedMetrics]);
3951
- const renderSlice = React12__namespace.useCallback(
2174
+ const renderSlice = React5__namespace.useCallback(
3952
2175
  (props) => {
3953
2176
  const {
3954
2177
  cx,
@@ -4148,38 +2371,38 @@ function FinancialSummaryChart({
4148
2371
  periodLabel: periodLabelProp,
4149
2372
  className
4150
2373
  }) {
4151
- const [expanded, setExpanded] = React12__namespace.useState(
2374
+ const [expanded, setExpanded] = React5__namespace.useState(
4152
2375
  () => resolveDefaultExpanded(config.defaultExpanded)
4153
2376
  );
4154
- const [activeChartType, setActiveChartType] = React12__namespace.useState(
2377
+ const [activeChartType, setActiveChartType] = React5__namespace.useState(
4155
2378
  config.chartType ?? "area"
4156
2379
  );
4157
- const [activeMetric, setActiveMetric] = React12__namespace.useState(null);
4158
- const [flippedCards, setFlippedCards] = React12__namespace.useState(
2380
+ const [activeMetric, setActiveMetric] = React5__namespace.useState(null);
2381
+ const [flippedCards, setFlippedCards] = React5__namespace.useState(
4159
2382
  /* @__PURE__ */ new Set()
4160
2383
  );
4161
- const [mobileCardIndex, setMobileCardIndex] = React12__namespace.useState(0);
4162
- const [useSwipeCards, setUseSwipeCards] = React12__namespace.useState(false);
4163
- const touchStartRef = React12__namespace.useRef(null);
4164
- const touchDeltaRef = React12__namespace.useRef({ x: 0, y: 0 });
4165
- const divisor = config.chartDisplayUnits && config.chartDisplayUnits !== "auto" ? chunkUM7WMXIU_js.getUnitDivisor(config.chartDisplayUnits) : 1;
4166
- const { chartData, summaryCards } = React12__namespace.useMemo(
2384
+ const [mobileCardIndex, setMobileCardIndex] = React5__namespace.useState(0);
2385
+ const [useSwipeCards, setUseSwipeCards] = React5__namespace.useState(false);
2386
+ const touchStartRef = React5__namespace.useRef(null);
2387
+ const touchDeltaRef = React5__namespace.useRef({ x: 0, y: 0 });
2388
+ const divisor = config.chartDisplayUnits && config.chartDisplayUnits !== "auto" ? chunkW3YOQ5ZD_js.getUnitDivisor(config.chartDisplayUnits) : 1;
2389
+ const { chartData, summaryCards } = React5__namespace.useMemo(
4167
2390
  () => buildChartData(data, config, timeUnit, priorTotalsProp),
4168
2391
  [data, config, timeUnit, priorTotalsProp]
4169
2392
  );
4170
- const visibleSummaryCards = React12__namespace.useMemo(() => {
2393
+ const visibleSummaryCards = React5__namespace.useMemo(() => {
4171
2394
  if (!config.statCardKeys?.length) return summaryCards;
4172
2395
  const cardByKey = new Map(summaryCards.map((card) => [card.key, card]));
4173
2396
  return config.statCardKeys.map((key) => cardByKey.get(key)).filter((card) => Boolean(card));
4174
2397
  }, [config.statCardKeys, summaryCards]);
4175
2398
  const cardFlipEnabled = config.enableCardFlip ?? true;
4176
- React12__namespace.useEffect(() => {
2399
+ React5__namespace.useEffect(() => {
4177
2400
  setExpanded(resolveDefaultExpanded(config.defaultExpanded));
4178
2401
  }, [config.defaultExpanded]);
4179
- React12__namespace.useEffect(() => {
2402
+ React5__namespace.useEffect(() => {
4180
2403
  setActiveChartType(config.chartType ?? "area");
4181
2404
  }, [config.chartType]);
4182
- const allMetrics = React12__namespace.useMemo(() => {
2405
+ const allMetrics = React5__namespace.useMemo(() => {
4183
2406
  const baseChartType = config.chartType && config.chartType !== "pie" ? config.chartType : "area";
4184
2407
  return [
4185
2408
  ...config.metrics.map((m) => ({
@@ -4200,7 +2423,7 @@ function FinancialSummaryChart({
4200
2423
  }))
4201
2424
  ];
4202
2425
  }, [config]);
4203
- const axisValueDisplay = React12__namespace.useMemo(() => {
2426
+ const axisValueDisplay = React5__namespace.useMemo(() => {
4204
2427
  if (allMetrics.length === 0) return { format: "currency" };
4205
2428
  const first = allMetrics[0]?.valueDisplay ?? { format: "currency" };
4206
2429
  const firstFormat = first.format ?? "currency";
@@ -4211,12 +2434,12 @@ function FinancialSummaryChart({
4211
2434
  });
4212
2435
  return sameBase ? first : { format: "currency" };
4213
2436
  }, [allMetrics]);
4214
- React12__namespace.useEffect(() => {
2437
+ React5__namespace.useEffect(() => {
4215
2438
  setMobileCardIndex(
4216
2439
  (prev) => Math.min(Math.max(prev, 0), Math.max(visibleSummaryCards.length - 1, 0))
4217
2440
  );
4218
2441
  }, [visibleSummaryCards.length]);
4219
- React12__namespace.useEffect(() => {
2442
+ React5__namespace.useEffect(() => {
4220
2443
  if (typeof window === "undefined") return;
4221
2444
  const coarsePointerQuery = window.matchMedia(
4222
2445
  "(hover: none) and (pointer: coarse)"
@@ -4235,10 +2458,10 @@ function FinancialSummaryChart({
4235
2458
  desktopWidthQuery.removeEventListener("change", syncSwipeMode);
4236
2459
  };
4237
2460
  }, []);
4238
- const handleCardClick = React12__namespace.useCallback((key) => {
2461
+ const handleCardClick = React5__namespace.useCallback((key) => {
4239
2462
  setActiveMetric((prev) => prev === key ? null : key);
4240
2463
  }, []);
4241
- const handleFlip = React12__namespace.useCallback(
2464
+ const handleFlip = React5__namespace.useCallback(
4242
2465
  (e, key) => {
4243
2466
  e.stopPropagation();
4244
2467
  setFlippedCards((prev) => {
@@ -4250,7 +2473,7 @@ function FinancialSummaryChart({
4250
2473
  },
4251
2474
  []
4252
2475
  );
4253
- const goToMobileCard = React12__namespace.useCallback(
2476
+ const goToMobileCard = React5__namespace.useCallback(
4254
2477
  (nextIndex) => {
4255
2478
  setMobileCardIndex(
4256
2479
  Math.min(
@@ -4261,7 +2484,7 @@ function FinancialSummaryChart({
4261
2484
  },
4262
2485
  [visibleSummaryCards.length]
4263
2486
  );
4264
- const handleTouchStart = React12__namespace.useCallback(
2487
+ const handleTouchStart = React5__namespace.useCallback(
4265
2488
  (e) => {
4266
2489
  if (visibleSummaryCards.length <= 1) return;
4267
2490
  const touch = e.touches[0];
@@ -4270,7 +2493,7 @@ function FinancialSummaryChart({
4270
2493
  },
4271
2494
  [visibleSummaryCards.length]
4272
2495
  );
4273
- const handleTouchMove = React12__namespace.useCallback(
2496
+ const handleTouchMove = React5__namespace.useCallback(
4274
2497
  (e) => {
4275
2498
  if (!touchStartRef.current || visibleSummaryCards.length <= 1) return;
4276
2499
  const touch = e.touches[0];
@@ -4281,7 +2504,7 @@ function FinancialSummaryChart({
4281
2504
  },
4282
2505
  [visibleSummaryCards.length]
4283
2506
  );
4284
- const handleTouchEnd = React12__namespace.useCallback(() => {
2507
+ const handleTouchEnd = React5__namespace.useCallback(() => {
4285
2508
  if (!touchStartRef.current || visibleSummaryCards.length <= 1) return;
4286
2509
  const { x, y } = touchDeltaRef.current;
4287
2510
  const swipeThreshold = 40;
@@ -4292,7 +2515,7 @@ function FinancialSummaryChart({
4292
2515
  touchStartRef.current = null;
4293
2516
  touchDeltaRef.current = { x: 0, y: 0 };
4294
2517
  }, [goToMobileCard, mobileCardIndex, visibleSummaryCards.length]);
4295
- const getMetricOpacity = React12__namespace.useCallback(
2518
+ const getMetricOpacity = React5__namespace.useCallback(
4296
2519
  (key) => {
4297
2520
  if (!activeMetric) return 1;
4298
2521
  if (key === activeMetric) return 1;
@@ -4308,7 +2531,7 @@ function FinancialSummaryChart({
4308
2531
  [activeMetric, config.computedMetrics]
4309
2532
  );
4310
2533
  const hasChartToggle = !!config.chartTypes && config.chartTypes.length > 1;
4311
- const renderSummaryCard = React12__namespace.useCallback(
2534
+ const renderSummaryCard = React5__namespace.useCallback(
4312
2535
  (card) => {
4313
2536
  const cardValueDisplay = card.valueDisplay ?? axisValueDisplay;
4314
2537
  const isPositiveTrend = card.key === "expenses" ? (card.trend ?? 0) < 0 : (card.trend ?? 0) > 0;
@@ -5206,8 +3429,8 @@ function SummaryPanel({
5206
3429
  renderChart,
5207
3430
  chartControls
5208
3431
  }) {
5209
- const [expanded, setExpanded] = React12__namespace.useState(defaultExpanded);
5210
- const [activeChartType, setActiveChartType] = React12__namespace.useState(defaultChartType);
3432
+ const [expanded, setExpanded] = React5__namespace.useState(defaultExpanded);
3433
+ const [activeChartType, setActiveChartType] = React5__namespace.useState(defaultChartType);
5211
3434
  const formatFn = formatValue ?? defaultFormat;
5212
3435
  const hasChart = !!chartData && chartData.length > 0 && !!chartSeries || !!renderChart;
5213
3436
  const hasChartToggle = chartTypes && chartTypes.length > 1;
@@ -5379,7 +3602,7 @@ function SummaryPanel({
5379
3602
  ] });
5380
3603
  }
5381
3604
 
5382
- // src/blocks/data-table/UnifiedTableControls.schema.ts
3605
+ // src/blocks/finance/UnifiedTableControls.schema.ts
5383
3606
  var unifiedTableControlOrder = [
5384
3607
  "period",
5385
3608
  "comparison",
@@ -5424,11 +3647,11 @@ function useUnifiedTableSettings(tableId, settings) {
5424
3647
  );
5425
3648
  }
5426
3649
  function useIsMobile(breakpoint = 768) {
5427
- const [isMobile, setIsMobile] = React12__namespace.useState(() => {
3650
+ const [isMobile, setIsMobile] = React5__namespace.useState(() => {
5428
3651
  if (typeof window === "undefined") return false;
5429
3652
  return window.innerWidth < breakpoint;
5430
3653
  });
5431
- React12__namespace.useEffect(() => {
3654
+ React5__namespace.useEffect(() => {
5432
3655
  const onResize = () => setIsMobile(window.innerWidth < breakpoint);
5433
3656
  onResize();
5434
3657
  window.addEventListener("resize", onResize);
@@ -5442,12 +3665,12 @@ function UnifiedTableControls({
5442
3665
  className,
5443
3666
  ...props
5444
3667
  }) {
5445
- const normalized = React12__namespace.useMemo(
3668
+ const normalized = React5__namespace.useMemo(
5446
3669
  () => normalizeUnifiedTableControls(controls),
5447
3670
  [controls]
5448
3671
  );
5449
3672
  const isMobile = useIsMobile();
5450
- const [mobileOpen, setMobileOpen] = React12__namespace.useState(false);
3673
+ const [mobileOpen, setMobileOpen] = React5__namespace.useState(false);
5451
3674
  if (!normalized.length) return null;
5452
3675
  if (!isMobile) {
5453
3676
  return /* @__PURE__ */ jsxRuntime.jsx(
@@ -5558,55 +3781,28 @@ function UnifiedTableControls({
5558
3781
 
5559
3782
  exports.AreaLineChart = AreaLineChart;
5560
3783
  exports.CASH_FLOW_CHART_CONFIG = CASH_FLOW_CHART_CONFIG;
5561
- exports.Calendar = Calendar;
5562
3784
  exports.ChartTooltipRow = ChartTooltipRow;
5563
3785
  exports.ChartTooltipShell = ChartTooltipShell;
5564
3786
  exports.ChartTooltipTitle = ChartTooltipTitle;
5565
3787
  exports.ColumnChart = ColumnChart;
5566
3788
  exports.Combobox = Combobox;
5567
- exports.Command = Command;
5568
- exports.CommandDialog = CommandDialog;
5569
- exports.CommandEmpty = CommandEmpty;
5570
- exports.CommandGroup = CommandGroup;
5571
- exports.CommandInput = CommandInput;
5572
- exports.CommandItem = CommandItem;
5573
- exports.CommandList = CommandList;
5574
- exports.CommandSeparator = CommandSeparator;
5575
- exports.CommandShortcut = CommandShortcut;
5576
3789
  exports.ComparisonSelector = ComparisonSelector;
5577
- exports.DataTableAddButton = DataTableAddButton;
5578
- exports.DataTableColumnMenuSub = DataTableColumnMenuSub;
5579
- exports.DataTableExportButton = DataTableExportButton;
5580
- exports.DataTablePagination = DataTablePagination;
5581
- exports.DataTableRowActions = DataTableRowActions;
5582
- exports.DataTableSearch = DataTableSearch;
5583
3790
  exports.DataTableSettings = DataTableSettings;
5584
- exports.DataTableSkeleton = DataTableSkeleton;
5585
- exports.DataTableSummary = DataTableSummary;
5586
- exports.DataTableToolbar = DataTableToolbar;
5587
- exports.DataTableTopper = DataTableTopper;
5588
- exports.DataTableViewOptions = DataTableViewOptions;
5589
- exports.DataTableViews = DataTableViews;
5590
3791
  exports.DatePicker = DatePicker;
5591
3792
  exports.DateRangePicker = DateRangePicker;
5592
3793
  exports.FinancialStatementControls = FinancialStatementControls;
5593
3794
  exports.FinancialSummaryChart = FinancialSummaryChart;
5594
3795
  exports.INCOME_STATEMENT_CHART_CONFIG = INCOME_STATEMENT_CHART_CONFIG;
5595
- exports.IconButton = IconButton;
5596
3796
  exports.MobilePeriodStepper = MobilePeriodStepper;
5597
3797
  exports.MobileStatementActions = MobileStatementActions;
5598
3798
  exports.MobileStatementFilters = MobileStatementFilters;
5599
3799
  exports.ModernCalendar = ModernCalendar;
5600
3800
  exports.PeriodSelector = PeriodSelector;
5601
3801
  exports.PieChartView = PieChartView2;
5602
- exports.Skeleton = Skeleton;
5603
3802
  exports.SummaryPanel = SummaryPanel;
5604
3803
  exports.Switch = Switch;
5605
3804
  exports.UnifiedTableControls = UnifiedTableControls;
5606
3805
  exports.createFinanceTableSettingsItems = createFinanceTableSettingsItems;
5607
- exports.exportToCsv = exportToCsv;
5608
- exports.exportToExcel = exportToExcel;
5609
- exports.iconButtonVariants = iconButtonVariants;
5610
3806
  exports.normalizeUnifiedTableControls = normalizeUnifiedTableControls;
5611
3807
  exports.unifiedTableControlOrder = unifiedTableControlOrder;
5612
3808
  exports.useDataTableSettings = useDataTableSettings;