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