kineto 0.1.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 (277) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +279 -0
  3. package/base.css +46 -0
  4. package/dist/accordion.d.ts +13 -0
  5. package/dist/accordion.js +161 -0
  6. package/dist/accordion.js.map +1 -0
  7. package/dist/alert.d.ts +20 -0
  8. package/dist/alert.js +137 -0
  9. package/dist/alert.js.map +1 -0
  10. package/dist/animated-number.d.ts +16 -0
  11. package/dist/animated-number.js +40 -0
  12. package/dist/animated-number.js.map +1 -0
  13. package/dist/area-chart.d.ts +16 -0
  14. package/dist/area-chart.js +138 -0
  15. package/dist/area-chart.js.map +1 -0
  16. package/dist/aspect-ratio.d.ts +6 -0
  17. package/dist/aspect-ratio.js +9 -0
  18. package/dist/aspect-ratio.js.map +1 -0
  19. package/dist/avatar.d.ts +18 -0
  20. package/dist/avatar.js +202 -0
  21. package/dist/avatar.js.map +1 -0
  22. package/dist/badge.d.ts +14 -0
  23. package/dist/badge.js +54 -0
  24. package/dist/badge.js.map +1 -0
  25. package/dist/bar-chart.d.ts +19 -0
  26. package/dist/bar-chart.js +139 -0
  27. package/dist/bar-chart.js.map +1 -0
  28. package/dist/bento-grid.d.ts +24 -0
  29. package/dist/bento-grid.js +129 -0
  30. package/dist/bento-grid.js.map +1 -0
  31. package/dist/breadcrumbs.d.ts +13 -0
  32. package/dist/breadcrumbs.js +50 -0
  33. package/dist/breadcrumbs.js.map +1 -0
  34. package/dist/button-group.d.ts +9 -0
  35. package/dist/button-group.js +29 -0
  36. package/dist/button-group.js.map +1 -0
  37. package/dist/button.d.ts +16 -0
  38. package/dist/button.js +131 -0
  39. package/dist/button.js.map +1 -0
  40. package/dist/calendar.d.ts +11 -0
  41. package/dist/calendar.js +185 -0
  42. package/dist/calendar.js.map +1 -0
  43. package/dist/card.d.ts +15 -0
  44. package/dist/card.js +131 -0
  45. package/dist/card.js.map +1 -0
  46. package/dist/carousel.d.ts +14 -0
  47. package/dist/carousel.js +143 -0
  48. package/dist/carousel.js.map +1 -0
  49. package/dist/chart-tooltip.d.ts +18 -0
  50. package/dist/chart-tooltip.js +30 -0
  51. package/dist/chart-tooltip.js.map +1 -0
  52. package/dist/checkbox.d.ts +6 -0
  53. package/dist/checkbox.js +88 -0
  54. package/dist/checkbox.js.map +1 -0
  55. package/dist/cn.d.ts +10 -0
  56. package/dist/cn.js +10 -0
  57. package/dist/cn.js.map +1 -0
  58. package/dist/code-block.d.ts +25 -0
  59. package/dist/code-block.js +155 -0
  60. package/dist/code-block.js.map +1 -0
  61. package/dist/collapsible.d.ts +12 -0
  62. package/dist/collapsible.js +125 -0
  63. package/dist/collapsible.js.map +1 -0
  64. package/dist/color-picker.d.ts +12 -0
  65. package/dist/color-picker.js +180 -0
  66. package/dist/color-picker.js.map +1 -0
  67. package/dist/command.d.ts +88 -0
  68. package/dist/command.js +277 -0
  69. package/dist/command.js.map +1 -0
  70. package/dist/confetti.d.ts +25 -0
  71. package/dist/confetti.js +109 -0
  72. package/dist/confetti.js.map +1 -0
  73. package/dist/container.d.ts +19 -0
  74. package/dist/container.js +41 -0
  75. package/dist/container.js.map +1 -0
  76. package/dist/content-divider.d.ts +7 -0
  77. package/dist/content-divider.js +35 -0
  78. package/dist/content-divider.js.map +1 -0
  79. package/dist/context-menu.d.ts +30 -0
  80. package/dist/context-menu.js +213 -0
  81. package/dist/context-menu.js.map +1 -0
  82. package/dist/copy-button.d.ts +17 -0
  83. package/dist/copy-button.js +107 -0
  84. package/dist/copy-button.js.map +1 -0
  85. package/dist/dashboard-showcase.d.ts +7 -0
  86. package/dist/dashboard-showcase.js +2560 -0
  87. package/dist/dashboard-showcase.js.map +1 -0
  88. package/dist/data-table.d.ts +130 -0
  89. package/dist/data-table.js +1620 -0
  90. package/dist/data-table.js.map +1 -0
  91. package/dist/date-picker.d.ts +12 -0
  92. package/dist/date-picker.js +261 -0
  93. package/dist/date-picker.js.map +1 -0
  94. package/dist/dialog.d.ts +23 -0
  95. package/dist/dialog.js +188 -0
  96. package/dist/dialog.js.map +1 -0
  97. package/dist/dock.d.ts +17 -0
  98. package/dist/dock.js +77 -0
  99. package/dist/dock.js.map +1 -0
  100. package/dist/donut-chart.d.ts +18 -0
  101. package/dist/donut-chart.js +92 -0
  102. package/dist/donut-chart.js.map +1 -0
  103. package/dist/drawer.d.ts +26 -0
  104. package/dist/drawer.js +166 -0
  105. package/dist/drawer.js.map +1 -0
  106. package/dist/dropdown-menu.d.ts +22 -0
  107. package/dist/dropdown-menu.js +163 -0
  108. package/dist/dropdown-menu.js.map +1 -0
  109. package/dist/empty-state.d.ts +13 -0
  110. package/dist/empty-state.js +149 -0
  111. package/dist/empty-state.js.map +1 -0
  112. package/dist/featured-icon.d.ts +16 -0
  113. package/dist/featured-icon.js +56 -0
  114. package/dist/featured-icon.js.map +1 -0
  115. package/dist/file-uploader.d.ts +11 -0
  116. package/dist/file-uploader.js +212 -0
  117. package/dist/file-uploader.js.map +1 -0
  118. package/dist/flex.d.ts +30 -0
  119. package/dist/flex.js +89 -0
  120. package/dist/flex.js.map +1 -0
  121. package/dist/form.d.ts +28 -0
  122. package/dist/form.js +139 -0
  123. package/dist/form.js.map +1 -0
  124. package/dist/format-time.d.ts +18 -0
  125. package/dist/format-time.js +54 -0
  126. package/dist/format-time.js.map +1 -0
  127. package/dist/gap.d.ts +9 -0
  128. package/dist/gap.js +34 -0
  129. package/dist/gap.js.map +1 -0
  130. package/dist/gradient-border.d.ts +15 -0
  131. package/dist/gradient-border.js +79 -0
  132. package/dist/gradient-border.js.map +1 -0
  133. package/dist/gradient-text.d.ts +12 -0
  134. package/dist/gradient-text.js +43 -0
  135. package/dist/gradient-text.js.map +1 -0
  136. package/dist/grid.d.ts +25 -0
  137. package/dist/grid.js +77 -0
  138. package/dist/grid.js.map +1 -0
  139. package/dist/hover-card.d.ts +8 -0
  140. package/dist/hover-card.js +93 -0
  141. package/dist/hover-card.js.map +1 -0
  142. package/dist/index.d.ts +93 -0
  143. package/dist/index.js +93 -0
  144. package/dist/inline-edit.d.ts +20 -0
  145. package/dist/inline-edit.js +107 -0
  146. package/dist/inline-edit.js.map +1 -0
  147. package/dist/input.d.ts +6 -0
  148. package/dist/input.js +31 -0
  149. package/dist/input.js.map +1 -0
  150. package/dist/kbd.d.ts +16 -0
  151. package/dist/kbd.js +35 -0
  152. package/dist/kbd.js.map +1 -0
  153. package/dist/label.d.ts +6 -0
  154. package/dist/label.js +31 -0
  155. package/dist/label.js.map +1 -0
  156. package/dist/line-chart.d.ts +17 -0
  157. package/dist/line-chart.js +120 -0
  158. package/dist/line-chart.js.map +1 -0
  159. package/dist/logo-cloud.d.ts +14 -0
  160. package/dist/logo-cloud.js +106 -0
  161. package/dist/logo-cloud.js.map +1 -0
  162. package/dist/masonry.d.ts +15 -0
  163. package/dist/masonry.js +63 -0
  164. package/dist/masonry.js.map +1 -0
  165. package/dist/menubar.d.ts +31 -0
  166. package/dist/menubar.js +250 -0
  167. package/dist/menubar.js.map +1 -0
  168. package/dist/motion-presets.d.ts +70 -0
  169. package/dist/motion-presets.js +71 -0
  170. package/dist/motion-presets.js.map +1 -0
  171. package/dist/navigation-menu.d.ts +15 -0
  172. package/dist/navigation-menu.js +181 -0
  173. package/dist/navigation-menu.js.map +1 -0
  174. package/dist/notification-center.d.ts +35 -0
  175. package/dist/notification-center.js +384 -0
  176. package/dist/notification-center.js.map +1 -0
  177. package/dist/page-header.d.ts +13 -0
  178. package/dist/page-header.js +37 -0
  179. package/dist/page-header.js.map +1 -0
  180. package/dist/pagination.d.ts +13 -0
  181. package/dist/pagination.js +103 -0
  182. package/dist/pagination.js.map +1 -0
  183. package/dist/popover.d.ts +9 -0
  184. package/dist/popover.js +93 -0
  185. package/dist/popover.js.map +1 -0
  186. package/dist/progress-steps.d.ts +17 -0
  187. package/dist/progress-steps.js +158 -0
  188. package/dist/progress-steps.js.map +1 -0
  189. package/dist/progress.d.ts +13 -0
  190. package/dist/progress.js +98 -0
  191. package/dist/progress.js.map +1 -0
  192. package/dist/radio-group.d.ts +7 -0
  193. package/dist/radio-group.js +94 -0
  194. package/dist/radio-group.js.map +1 -0
  195. package/dist/rating.d.ts +18 -0
  196. package/dist/rating.js +122 -0
  197. package/dist/rating.js.map +1 -0
  198. package/dist/relative-time.d.ts +19 -0
  199. package/dist/relative-time.js +187 -0
  200. package/dist/relative-time.js.map +1 -0
  201. package/dist/resizable.d.ts +27 -0
  202. package/dist/resizable.js +50 -0
  203. package/dist/resizable.js.map +1 -0
  204. package/dist/scroll-area.d.ts +20 -0
  205. package/dist/scroll-area.js +94 -0
  206. package/dist/scroll-area.js.map +1 -0
  207. package/dist/segmented-control.d.ts +16 -0
  208. package/dist/segmented-control.js +139 -0
  209. package/dist/segmented-control.js.map +1 -0
  210. package/dist/select.d.ts +13 -0
  211. package/dist/select.js +153 -0
  212. package/dist/select.js.map +1 -0
  213. package/dist/separator.d.ts +6 -0
  214. package/dist/separator.js +36 -0
  215. package/dist/separator.js.map +1 -0
  216. package/dist/sidebar.d.ts +24 -0
  217. package/dist/sidebar.js +150 -0
  218. package/dist/sidebar.js.map +1 -0
  219. package/dist/skeleton.d.ts +6 -0
  220. package/dist/skeleton.js +42 -0
  221. package/dist/skeleton.js.map +1 -0
  222. package/dist/slider.d.ts +6 -0
  223. package/dist/slider.js +44 -0
  224. package/dist/slider.js.map +1 -0
  225. package/dist/social-button.d.ts +14 -0
  226. package/dist/social-button.js +203 -0
  227. package/dist/social-button.js.map +1 -0
  228. package/dist/spacer.d.ts +19 -0
  229. package/dist/spacer.js +52 -0
  230. package/dist/spacer.js.map +1 -0
  231. package/dist/spinner.d.ts +15 -0
  232. package/dist/spinner.js +48 -0
  233. package/dist/spinner.js.map +1 -0
  234. package/dist/stack.d.ts +27 -0
  235. package/dist/stack.js +77 -0
  236. package/dist/stack.js.map +1 -0
  237. package/dist/stat-card.d.ts +26 -0
  238. package/dist/stat-card.js +198 -0
  239. package/dist/stat-card.js.map +1 -0
  240. package/dist/status-dot.d.ts +26 -0
  241. package/dist/status-dot.js +68 -0
  242. package/dist/status-dot.js.map +1 -0
  243. package/dist/switch.d.ts +6 -0
  244. package/dist/switch.js +108 -0
  245. package/dist/switch.js.map +1 -0
  246. package/dist/tabs.d.ts +13 -0
  247. package/dist/tabs.js +167 -0
  248. package/dist/tabs.js.map +1 -0
  249. package/dist/tag.d.ts +16 -0
  250. package/dist/tag.js +53 -0
  251. package/dist/tag.js.map +1 -0
  252. package/dist/textarea.d.ts +6 -0
  253. package/dist/textarea.js +30 -0
  254. package/dist/textarea.js.map +1 -0
  255. package/dist/theme-switcher.d.ts +16 -0
  256. package/dist/theme-switcher.js +170 -0
  257. package/dist/theme-switcher.js.map +1 -0
  258. package/dist/toast.d.ts +20 -0
  259. package/dist/toast.js +162 -0
  260. package/dist/toast.js.map +1 -0
  261. package/dist/tooltip.d.ts +14 -0
  262. package/dist/tooltip.js +98 -0
  263. package/dist/tooltip.js.map +1 -0
  264. package/dist/tree-view.d.ts +16 -0
  265. package/dist/tree-view.js +123 -0
  266. package/dist/tree-view.js.map +1 -0
  267. package/dist/truncate.d.ts +16 -0
  268. package/dist/truncate.js +151 -0
  269. package/dist/truncate.js.map +1 -0
  270. package/dist/use-reduced-motion.d.ts +15 -0
  271. package/dist/use-reduced-motion.js +11 -0
  272. package/dist/use-reduced-motion.js.map +1 -0
  273. package/dist/verification-code-input.d.ts +12 -0
  274. package/dist/verification-code-input.js +90 -0
  275. package/dist/verification-code-input.js.map +1 -0
  276. package/package.json +131 -0
  277. package/theme.css +343 -0
@@ -0,0 +1,2560 @@
1
+ "use client";
2
+
3
+ // src/components/application/dashboard-showcase.tsx
4
+ import * as React18 from "react";
5
+ import { motion as motion11 } from "motion/react";
6
+ import {
7
+ Bell,
8
+ CreditCard,
9
+ Home,
10
+ LayoutGrid,
11
+ Search as Search2,
12
+ Settings,
13
+ TrendingUp,
14
+ Users,
15
+ Wallet
16
+ } from "lucide-react";
17
+
18
+ // src/lib/cn.ts
19
+ import { clsx } from "clsx";
20
+ import { twMerge } from "tailwind-merge";
21
+ function cn(...inputs) {
22
+ return twMerge(clsx(inputs));
23
+ }
24
+
25
+ // src/lib/motion-presets.ts
26
+ var spring = {
27
+ /** Quick, decisive — buttons, indicators, dropdowns. */
28
+ snappy: { type: "spring", stiffness: 420, damping: 32, mass: 0.8 },
29
+ /** Calm and weighty — dialogs, cards, larger surfaces. */
30
+ soft: { type: "spring", stiffness: 180, damping: 26 },
31
+ /** Playful overshoot — badges, toggles, delight moments. Use sparingly. */
32
+ bouncy: { type: "spring", stiffness: 480, damping: 18, mass: 0.9 }
33
+ };
34
+ var tween = {
35
+ /** The signature easing — an expressive ease-out for orchestrated reveals. */
36
+ smooth: { type: "tween", duration: 0.45, ease: [0.22, 1, 0.36, 1] },
37
+ /** Faster variant for small elements. */
38
+ quick: { type: "tween", duration: 0.28, ease: [0.22, 1, 0.36, 1] },
39
+ /** Longer, settled curve for drawing charts, count-ups, and progress fills. */
40
+ draw: { type: "tween", duration: 1.1, ease: [0.16, 1, 0.3, 1] }
41
+ };
42
+ var fadeUp = {
43
+ hidden: { opacity: 0, y: 18 },
44
+ visible: { opacity: 1, y: 0, transition: tween.smooth }
45
+ };
46
+ var fadeIn = {
47
+ hidden: { opacity: 0 },
48
+ visible: { opacity: 1, transition: tween.smooth }
49
+ };
50
+ var scaleIn = {
51
+ hidden: { opacity: 0, scale: 0.96 },
52
+ visible: { opacity: 1, scale: 1, transition: spring.soft }
53
+ };
54
+ var slideInLeft = {
55
+ hidden: { opacity: 0, x: -28 },
56
+ visible: { opacity: 1, x: 0, transition: tween.smooth }
57
+ };
58
+ var slideInRight = {
59
+ hidden: { opacity: 0, x: 28 },
60
+ visible: { opacity: 1, x: 0, transition: tween.smooth }
61
+ };
62
+ var blurIn = {
63
+ hidden: { opacity: 0, filter: "blur(12px)" },
64
+ visible: { opacity: 1, filter: "blur(0px)", transition: tween.smooth }
65
+ };
66
+ var staggerContainer = (stagger = 0.08, delay = 0) => ({
67
+ hidden: {},
68
+ visible: {
69
+ transition: { staggerChildren: stagger, delayChildren: delay }
70
+ }
71
+ });
72
+ var interaction = {
73
+ /** Press feedback for buttons and clickable chips. */
74
+ tap: { scale: 0.97 },
75
+ /** Very subtle scale-up for non-anchored content surfaces (cards/tiles) — never for triggers.
76
+ * A gentle swell reads calmer than a positional lift and doesn't nudge neighbouring content. */
77
+ cardHover: { scale: 1.02 }
78
+ };
79
+ var viewportOnce = { once: true, margin: "-15%" };
80
+
81
+ // src/components/ui/badge.tsx
82
+ import * as React from "react";
83
+ import { cva } from "class-variance-authority";
84
+ import { jsx, jsxs } from "react/jsx-runtime";
85
+ var badgeVariants = cva(
86
+ "inline-flex items-center gap-1.5 rounded-full border px-2.5 py-0.5 text-xs font-medium [&_svg]:size-3",
87
+ {
88
+ variants: {
89
+ variant: {
90
+ default: "border-transparent bg-primary/10 text-primary",
91
+ brand: "border-transparent bg-brand/12 text-brand",
92
+ gradient: "border-transparent bg-gradient-brand-soft text-brand",
93
+ secondary: "border-transparent bg-secondary text-secondary-foreground",
94
+ outline: "border-border text-foreground",
95
+ success: "border-transparent bg-success/12 text-success",
96
+ warning: "border-transparent bg-warning/15 text-warning",
97
+ destructive: "border-transparent bg-destructive/10 text-destructive",
98
+ solid: "border-transparent bg-primary text-primary-foreground"
99
+ }
100
+ },
101
+ defaultVariants: {
102
+ variant: "default"
103
+ }
104
+ }
105
+ );
106
+ var Badge = React.forwardRef(
107
+ ({ className, variant, dot = false, children, ...props }, ref) => /* @__PURE__ */ jsxs(
108
+ "span",
109
+ {
110
+ ref,
111
+ className: cn(badgeVariants({ variant }), className),
112
+ ...props,
113
+ children: [
114
+ dot ? /* @__PURE__ */ jsx("span", { className: "size-1.5 shrink-0 rounded-full bg-current", "aria-hidden": true }) : null,
115
+ children
116
+ ]
117
+ }
118
+ )
119
+ );
120
+ Badge.displayName = "Badge";
121
+
122
+ // src/components/ui/avatar.tsx
123
+ import * as React3 from "react";
124
+ import * as AvatarPrimitive from "@radix-ui/react-avatar";
125
+
126
+ // src/components/ui/tooltip.tsx
127
+ import * as React2 from "react";
128
+ import * as TooltipPrimitive from "@radix-ui/react-tooltip";
129
+ import { motion } from "motion/react";
130
+ import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
131
+ var Tooltip = ({
132
+ delayDuration = 200,
133
+ children,
134
+ ...props
135
+ }) => /* @__PURE__ */ jsx2(TooltipPrimitive.Provider, { delayDuration, children: /* @__PURE__ */ jsx2(TooltipPrimitive.Root, { ...props, children }) });
136
+ Tooltip.displayName = "Tooltip";
137
+ var TooltipTrigger = TooltipPrimitive.Trigger;
138
+ var TooltipContent = React2.forwardRef(({ className, sideOffset = 6, children, ...props }, ref) => /* @__PURE__ */ jsx2(TooltipPrimitive.Portal, { children: /* @__PURE__ */ jsxs2(
139
+ TooltipPrimitive.Content,
140
+ {
141
+ ref,
142
+ sideOffset,
143
+ className: "z-50",
144
+ ...props,
145
+ children: [
146
+ /* @__PURE__ */ jsx2(
147
+ motion.div,
148
+ {
149
+ initial: { opacity: 0, scale: 0.96 },
150
+ animate: { opacity: 1, scale: 1 },
151
+ transition: spring.snappy,
152
+ style: { transformOrigin: "var(--radix-tooltip-content-transform-origin)" },
153
+ className: cn(
154
+ "max-w-xs rounded-md bg-foreground px-2.5 py-1.5 text-xs font-medium text-background shadow-lift",
155
+ className
156
+ ),
157
+ children
158
+ }
159
+ ),
160
+ /* @__PURE__ */ jsx2(TooltipPrimitive.Arrow, { className: "fill-foreground" })
161
+ ]
162
+ }
163
+ ) }));
164
+ TooltipContent.displayName = "TooltipContent";
165
+
166
+ // src/components/ui/avatar.tsx
167
+ import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
168
+ var Avatar = React3.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx3(
169
+ AvatarPrimitive.Root,
170
+ {
171
+ ref,
172
+ className: cn(
173
+ "relative flex size-10 shrink-0 overflow-hidden rounded-full",
174
+ className
175
+ ),
176
+ ...props
177
+ }
178
+ ));
179
+ Avatar.displayName = "Avatar";
180
+ var AvatarImage = React3.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx3(
181
+ AvatarPrimitive.Image,
182
+ {
183
+ ref,
184
+ className: cn("aspect-square size-full object-cover", className),
185
+ ...props
186
+ }
187
+ ));
188
+ AvatarImage.displayName = "AvatarImage";
189
+ var AvatarFallback = React3.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx3(
190
+ AvatarPrimitive.Fallback,
191
+ {
192
+ ref,
193
+ className: cn(
194
+ "flex size-full items-center justify-center rounded-full bg-muted text-sm font-medium text-muted-foreground",
195
+ className
196
+ ),
197
+ ...props
198
+ }
199
+ ));
200
+ AvatarFallback.displayName = "AvatarFallback";
201
+ var groupSizeClasses = {
202
+ sm: { avatar: "size-8", chip: "size-8 text-[10px]", space: "-space-x-2.5" },
203
+ md: { avatar: "size-10", chip: "size-10 text-xs", space: "-space-x-3" },
204
+ lg: { avatar: "size-12", chip: "size-12 text-sm", space: "-space-x-3.5" },
205
+ xl: { avatar: "size-14", chip: "size-14 text-sm", space: "-space-x-4" }
206
+ };
207
+ function avatarLabel(node) {
208
+ if (!React3.isValidElement(node)) return null;
209
+ const props = node.props;
210
+ if (typeof props.title === "string" && props.title) return props.title;
211
+ if (typeof props["aria-label"] === "string" && props["aria-label"]) {
212
+ return props["aria-label"];
213
+ }
214
+ let alt = null;
215
+ React3.Children.forEach(props.children, (child) => {
216
+ if (alt || !React3.isValidElement(child)) return;
217
+ const childAlt = child.props.alt;
218
+ if (typeof childAlt === "string" && childAlt) alt = childAlt;
219
+ });
220
+ return alt;
221
+ }
222
+ var AvatarGroup = React3.forwardRef(
223
+ ({ className, children, max, size = "md", tooltip = true, ...props }, ref) => {
224
+ const sizes = groupSizeClasses[size];
225
+ const items = React3.Children.toArray(children);
226
+ const shown = typeof max === "number" ? items.slice(0, max) : items;
227
+ const hidden = typeof max === "number" ? items.slice(max) : [];
228
+ const extra = hidden.length;
229
+ const names = hidden.map(avatarLabel).filter((n) => Boolean(n));
230
+ const unnamed = extra - names.length;
231
+ const chip = /* @__PURE__ */ jsxs3(
232
+ "div",
233
+ {
234
+ className: cn(
235
+ "flex items-center justify-center rounded-full bg-muted font-medium text-muted-foreground ring-2 ring-card",
236
+ sizes.chip
237
+ ),
238
+ children: [
239
+ "+",
240
+ extra
241
+ ]
242
+ }
243
+ );
244
+ return /* @__PURE__ */ jsxs3("div", { ref, className: cn("flex items-center", sizes.space, className), ...props, children: [
245
+ shown.map((child, index) => /* @__PURE__ */ jsx3("div", { className: "rounded-full ring-2 ring-card", children: React3.isValidElement(child) ? React3.cloneElement(child, {
246
+ // Group size first so per-avatar className still overrides it.
247
+ className: cn(sizes.avatar, child.props.className)
248
+ }) : child }, index)),
249
+ extra > 0 ? tooltip ? /* @__PURE__ */ jsxs3(Tooltip, { children: [
250
+ /* @__PURE__ */ jsx3(TooltipTrigger, { asChild: true, children: chip }),
251
+ /* @__PURE__ */ jsx3(TooltipContent, { children: names.length > 0 ? /* @__PURE__ */ jsxs3("div", { className: "flex flex-col gap-0.5", children: [
252
+ names.map((name, i) => /* @__PURE__ */ jsx3("span", { children: name }, i)),
253
+ unnamed > 0 ? /* @__PURE__ */ jsxs3("span", { className: "text-background/70", children: [
254
+ "and ",
255
+ unnamed,
256
+ " more"
257
+ ] }) : null
258
+ ] }) : `${extra} more` })
259
+ ] }) : chip : null
260
+ ] });
261
+ }
262
+ );
263
+ AvatarGroup.displayName = "AvatarGroup";
264
+
265
+ // src/components/ui/segmented-control.tsx
266
+ import * as React4 from "react";
267
+ import { motion as motion2, useReducedMotion } from "motion/react";
268
+ import { jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
269
+ function useControllableState({
270
+ prop,
271
+ defaultProp,
272
+ onChange
273
+ }) {
274
+ const [uncontrolled, setUncontrolled] = React4.useState(defaultProp);
275
+ const isControlled = prop !== void 0;
276
+ const value = isControlled ? prop : uncontrolled;
277
+ const setValue = React4.useCallback(
278
+ (next) => {
279
+ if (!isControlled) setUncontrolled(next);
280
+ onChange?.(next);
281
+ },
282
+ [isControlled, onChange]
283
+ );
284
+ return [value, setValue];
285
+ }
286
+ var SegmentedControl = React4.forwardRef(
287
+ ({
288
+ className,
289
+ options,
290
+ value,
291
+ defaultValue,
292
+ onValueChange,
293
+ size = "default",
294
+ ...props
295
+ }, ref) => {
296
+ const [active, setActive] = useControllableState({
297
+ prop: value,
298
+ defaultProp: defaultValue ?? options[0]?.value ?? "",
299
+ onChange: onValueChange
300
+ });
301
+ const layoutId = React4.useId();
302
+ const reduced = useReducedMotion();
303
+ return /* @__PURE__ */ jsx4(
304
+ "div",
305
+ {
306
+ ref,
307
+ role: "tablist",
308
+ className: cn(
309
+ "inline-flex items-center gap-1 rounded-lg bg-muted p-1",
310
+ className
311
+ ),
312
+ ...props,
313
+ children: options.map((option) => {
314
+ const isActive = option.value === active;
315
+ return /* @__PURE__ */ jsxs4(
316
+ "button",
317
+ {
318
+ type: "button",
319
+ role: "tab",
320
+ "aria-selected": isActive,
321
+ onClick: () => setActive(option.value),
322
+ className: cn(
323
+ "relative inline-flex items-center justify-center rounded-md font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
324
+ size === "sm" ? "px-2.5 py-1 text-xs" : "px-3.5 py-1.5 text-sm",
325
+ isActive ? "text-foreground" : "text-muted-foreground hover:text-foreground"
326
+ ),
327
+ children: [
328
+ isActive ? /* @__PURE__ */ jsx4(
329
+ motion2.span,
330
+ {
331
+ layoutId: `${layoutId}-segment`,
332
+ transition: reduced ? { duration: 0 } : spring.snappy,
333
+ className: "absolute inset-0 z-0 rounded-md bg-card shadow-soft"
334
+ }
335
+ ) : null,
336
+ /* @__PURE__ */ jsx4("span", { className: "relative z-10", children: option.label })
337
+ ]
338
+ },
339
+ option.value
340
+ );
341
+ })
342
+ }
343
+ );
344
+ }
345
+ );
346
+ SegmentedControl.displayName = "SegmentedControl";
347
+
348
+ // src/components/application/sidebar.tsx
349
+ import * as React5 from "react";
350
+ import { motion as motion3, useReducedMotion as useReducedMotion2 } from "motion/react";
351
+ import { jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
352
+ function useControllableState2({
353
+ prop,
354
+ defaultProp,
355
+ onChange
356
+ }) {
357
+ const [uncontrolled, setUncontrolled] = React5.useState(defaultProp);
358
+ const isControlled = prop !== void 0;
359
+ const value = isControlled ? prop : uncontrolled;
360
+ const setValue = React5.useCallback(
361
+ (next) => {
362
+ if (!isControlled) setUncontrolled(next);
363
+ onChange?.(next);
364
+ },
365
+ [isControlled, onChange]
366
+ );
367
+ return [value, setValue];
368
+ }
369
+ var Sidebar = React5.forwardRef(
370
+ ({
371
+ className,
372
+ sections,
373
+ activeValue,
374
+ defaultActiveValue,
375
+ onActiveChange,
376
+ brand,
377
+ footer,
378
+ ...props
379
+ }, ref) => {
380
+ const firstValue = sections[0]?.items[0]?.value ?? "";
381
+ const [active, setActive] = useControllableState2({
382
+ prop: activeValue,
383
+ defaultProp: defaultActiveValue ?? firstValue,
384
+ onChange: onActiveChange
385
+ });
386
+ const layoutId = React5.useId();
387
+ const reduced = useReducedMotion2();
388
+ return /* @__PURE__ */ jsxs5(
389
+ "aside",
390
+ {
391
+ ref,
392
+ className: cn(
393
+ "flex h-full w-60 flex-col gap-4 border-r border-border bg-card p-3",
394
+ className
395
+ ),
396
+ ...props,
397
+ children: [
398
+ brand ? /* @__PURE__ */ jsx5("div", { className: "px-2 py-2", children: brand }) : null,
399
+ /* @__PURE__ */ jsx5("nav", { className: "flex flex-1 flex-col gap-5", children: sections.map((section, si) => /* @__PURE__ */ jsxs5("div", { className: "flex flex-col gap-1", children: [
400
+ section.title ? /* @__PURE__ */ jsx5("p", { className: "px-3 pb-1 text-xs font-medium uppercase tracking-wider text-muted-foreground", children: section.title }) : null,
401
+ section.items.map((item) => {
402
+ const Icon2 = item.icon;
403
+ const isActive = item.value === active;
404
+ return /* @__PURE__ */ jsxs5(
405
+ "button",
406
+ {
407
+ type: "button",
408
+ onClick: () => setActive(item.value),
409
+ "aria-current": isActive ? "page" : void 0,
410
+ className: cn(
411
+ "relative flex items-center gap-3 rounded-lg px-3 py-2 text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
412
+ isActive ? "text-primary" : "text-muted-foreground hover:bg-accent hover:text-foreground"
413
+ ),
414
+ children: [
415
+ isActive ? /* @__PURE__ */ jsx5(
416
+ motion3.span,
417
+ {
418
+ layoutId: `${layoutId}-sidebar-active`,
419
+ transition: reduced ? { duration: 0 } : spring.snappy,
420
+ className: "absolute inset-0 rounded-lg bg-primary/10"
421
+ }
422
+ ) : null,
423
+ /* @__PURE__ */ jsxs5("span", { className: "relative z-10 flex flex-1 items-center gap-3", children: [
424
+ /* @__PURE__ */ jsx5(Icon2, { className: "size-4" }),
425
+ item.label,
426
+ item.badge ? /* @__PURE__ */ jsx5("span", { className: "ml-auto", children: item.badge }) : null
427
+ ] })
428
+ ]
429
+ },
430
+ item.value
431
+ );
432
+ })
433
+ ] }, si)) }),
434
+ footer ? /* @__PURE__ */ jsx5("div", { className: "mt-auto", children: footer }) : null
435
+ ]
436
+ }
437
+ );
438
+ }
439
+ );
440
+ Sidebar.displayName = "Sidebar";
441
+
442
+ // src/components/application/stat-card.tsx
443
+ import * as React7 from "react";
444
+ import { motion as motion4 } from "motion/react";
445
+ import { ArrowDownRight, ArrowUpRight } from "lucide-react";
446
+
447
+ // src/components/ui/animated-number.tsx
448
+ import * as React6 from "react";
449
+ import { animate, useInView, useReducedMotion as useReducedMotion3 } from "motion/react";
450
+ import { jsx as jsx6 } from "react/jsx-runtime";
451
+ var AnimatedNumber = React6.forwardRef(
452
+ ({ value, format, duration = 1.1, ...props }, forwardedRef) => {
453
+ const innerRef = React6.useRef(null);
454
+ React6.useImperativeHandle(forwardedRef, () => innerRef.current);
455
+ const inView = useInView(innerRef, { once: true, margin: "-10%" });
456
+ const reduced = useReducedMotion3();
457
+ const formatRef = React6.useRef(format);
458
+ formatRef.current = format;
459
+ const fmt = React6.useCallback(
460
+ (n) => (formatRef.current ?? ((x) => Math.round(x).toLocaleString()))(n),
461
+ []
462
+ );
463
+ const [display, setDisplay] = React6.useState(() => fmt(0));
464
+ React6.useEffect(() => {
465
+ if (!inView) return;
466
+ if (reduced) {
467
+ setDisplay(fmt(value));
468
+ return;
469
+ }
470
+ const controls = animate(0, value, {
471
+ duration,
472
+ ease: [0.16, 1, 0.3, 1],
473
+ onUpdate: (latest) => setDisplay(fmt(latest))
474
+ });
475
+ return () => controls.stop();
476
+ }, [inView, value, duration, reduced, fmt]);
477
+ return /* @__PURE__ */ jsx6("span", { ref: innerRef, ...props, children: display });
478
+ }
479
+ );
480
+ AnimatedNumber.displayName = "AnimatedNumber";
481
+
482
+ // src/components/application/stat-card.tsx
483
+ import { jsx as jsx7, jsxs as jsxs6 } from "react/jsx-runtime";
484
+ function TrendBadge({ value }) {
485
+ const up = value >= 0;
486
+ return /* @__PURE__ */ jsxs6(
487
+ "span",
488
+ {
489
+ className: cn(
490
+ "inline-flex items-center gap-0.5 rounded-full px-1.5 py-0.5 text-xs font-medium",
491
+ up ? "bg-success/12 text-success" : "bg-destructive/10 text-destructive"
492
+ ),
493
+ children: [
494
+ up ? /* @__PURE__ */ jsx7(ArrowUpRight, { className: "size-3" }) : /* @__PURE__ */ jsx7(ArrowDownRight, { className: "size-3" }),
495
+ Math.abs(value),
496
+ "%"
497
+ ]
498
+ }
499
+ );
500
+ }
501
+ var StatCard = React7.forwardRef(
502
+ ({
503
+ className,
504
+ label,
505
+ value,
506
+ prefix,
507
+ suffix,
508
+ format,
509
+ icon: Icon2,
510
+ iconClassName,
511
+ trend,
512
+ trendLabel,
513
+ children,
514
+ ...props
515
+ }, ref) => /* @__PURE__ */ jsxs6(
516
+ motion4.div,
517
+ {
518
+ ref,
519
+ variants: fadeUp,
520
+ className: cn(
521
+ "rounded-xl border border-border bg-card p-5 shadow-soft",
522
+ className
523
+ ),
524
+ ...props,
525
+ children: [
526
+ /* @__PURE__ */ jsxs6("div", { className: "flex items-center justify-between gap-3", children: [
527
+ /* @__PURE__ */ jsxs6("div", { className: "flex items-center gap-2.5", children: [
528
+ Icon2 ? /* @__PURE__ */ jsx7(
529
+ "span",
530
+ {
531
+ className: cn(
532
+ "flex size-9 items-center justify-center rounded-lg bg-primary/10 text-primary [&_svg]:size-4",
533
+ iconClassName
534
+ ),
535
+ children: /* @__PURE__ */ jsx7(Icon2, {})
536
+ }
537
+ ) : null,
538
+ /* @__PURE__ */ jsx7("span", { className: "text-sm font-medium text-muted-foreground", children: label })
539
+ ] }),
540
+ children
541
+ ] }),
542
+ /* @__PURE__ */ jsxs6("div", { className: "mt-4 flex items-end justify-between gap-3", children: [
543
+ /* @__PURE__ */ jsxs6("div", { className: "font-display text-3xl font-semibold tracking-tight text-foreground", children: [
544
+ prefix,
545
+ /* @__PURE__ */ jsx7(AnimatedNumber, { value, format }),
546
+ suffix
547
+ ] }),
548
+ typeof trend === "number" ? /* @__PURE__ */ jsx7(TrendBadge, { value: trend }) : null
549
+ ] }),
550
+ trendLabel ? /* @__PURE__ */ jsx7("p", { className: "mt-1.5 text-xs text-muted-foreground", children: trendLabel }) : null
551
+ ]
552
+ }
553
+ )
554
+ );
555
+ StatCard.displayName = "StatCard";
556
+ var columnClasses = {
557
+ 2: "sm:grid-cols-2",
558
+ 3: "sm:grid-cols-3",
559
+ 4: "sm:grid-cols-2 lg:grid-cols-4"
560
+ };
561
+ var StatGrid = React7.forwardRef(
562
+ ({ className, columns: columns2 = 4, children, ...props }, ref) => /* @__PURE__ */ jsx7(
563
+ motion4.div,
564
+ {
565
+ ref,
566
+ variants: staggerContainer(0.08),
567
+ initial: "hidden",
568
+ whileInView: "visible",
569
+ viewport: viewportOnce,
570
+ className: cn("grid grid-cols-1 gap-4", columnClasses[columns2], className),
571
+ ...props,
572
+ children
573
+ }
574
+ )
575
+ );
576
+ StatGrid.displayName = "StatGrid";
577
+
578
+ // src/components/charts/area-chart.tsx
579
+ import * as React8 from "react";
580
+ import { useReducedMotion as useReducedMotion4 } from "motion/react";
581
+ import {
582
+ Area,
583
+ AreaChart as RechartsAreaChart,
584
+ CartesianGrid,
585
+ Legend,
586
+ ResponsiveContainer,
587
+ Tooltip as Tooltip2,
588
+ XAxis,
589
+ YAxis
590
+ } from "recharts";
591
+
592
+ // src/components/charts/chart-tooltip.tsx
593
+ import { jsx as jsx8, jsxs as jsxs7 } from "react/jsx-runtime";
594
+ function ChartTooltip({
595
+ active,
596
+ payload,
597
+ label,
598
+ valueFormat
599
+ }) {
600
+ if (!active || !payload || payload.length === 0) return null;
601
+ return /* @__PURE__ */ jsxs7("div", { className: "rounded-lg border border-border bg-popover px-3 py-2 text-xs shadow-lift", children: [
602
+ label != null ? /* @__PURE__ */ jsx8("p", { className: "mb-1.5 font-medium text-foreground", children: label }) : null,
603
+ /* @__PURE__ */ jsx8("div", { className: "flex flex-col gap-1", children: payload.map((item, i) => /* @__PURE__ */ jsxs7("div", { className: "flex items-center gap-2 text-muted-foreground", children: [
604
+ /* @__PURE__ */ jsx8(
605
+ "span",
606
+ {
607
+ className: "size-2 shrink-0 rounded-full",
608
+ style: { background: item.color }
609
+ }
610
+ ),
611
+ /* @__PURE__ */ jsx8("span", { className: "capitalize", children: item.name }),
612
+ /* @__PURE__ */ jsx8("span", { className: "ml-auto font-medium text-foreground", children: typeof item.value === "number" && valueFormat ? valueFormat(item.value) : item.value })
613
+ ] }, i)) })
614
+ ] });
615
+ }
616
+
617
+ // src/components/charts/area-chart.tsx
618
+ import { jsx as jsx9, jsxs as jsxs8 } from "react/jsx-runtime";
619
+ var DEFAULT_COLORS = ["--chart-1", "--chart-2", "--chart-3", "--chart-4", "--chart-5"];
620
+ var color = (v) => `hsl(var(${v}))`;
621
+ var AreaChart = React8.forwardRef(
622
+ ({
623
+ className,
624
+ data,
625
+ index,
626
+ categories,
627
+ colors = DEFAULT_COLORS,
628
+ height = 240,
629
+ valueFormat = (n) => n.toLocaleString(),
630
+ showGrid = true,
631
+ showLegend = false,
632
+ showYAxis = false,
633
+ ...props
634
+ }, ref) => {
635
+ const reduced = useReducedMotion4();
636
+ const uid = React8.useId().replace(/:/g, "");
637
+ return /* @__PURE__ */ jsx9("div", { ref, className: cn("w-full", className), style: { height }, ...props, children: /* @__PURE__ */ jsx9(ResponsiveContainer, { width: "100%", height: "100%", children: /* @__PURE__ */ jsxs8(RechartsAreaChart, { data, margin: { top: 8, right: 8, bottom: 0, left: 0 }, children: [
638
+ /* @__PURE__ */ jsx9("defs", { children: categories.map((cat, i) => {
639
+ const c = color(colors[i % colors.length] ?? "--chart-1");
640
+ return /* @__PURE__ */ jsxs8("linearGradient", { id: `${uid}-${cat}`, x1: "0", y1: "0", x2: "0", y2: "1", children: [
641
+ /* @__PURE__ */ jsx9("stop", { offset: "0%", stopColor: c, stopOpacity: 0.3 }),
642
+ /* @__PURE__ */ jsx9("stop", { offset: "100%", stopColor: c, stopOpacity: 0 })
643
+ ] }, cat);
644
+ }) }),
645
+ showGrid ? /* @__PURE__ */ jsx9(
646
+ CartesianGrid,
647
+ {
648
+ vertical: false,
649
+ stroke: "hsl(var(--border))",
650
+ strokeDasharray: "3 6"
651
+ }
652
+ ) : null,
653
+ /* @__PURE__ */ jsx9(
654
+ XAxis,
655
+ {
656
+ dataKey: index,
657
+ tickLine: false,
658
+ axisLine: false,
659
+ tick: { fill: "hsl(var(--muted-foreground))", fontSize: 12 },
660
+ dy: 8
661
+ }
662
+ ),
663
+ showYAxis ? /* @__PURE__ */ jsx9(
664
+ YAxis,
665
+ {
666
+ tickLine: false,
667
+ axisLine: false,
668
+ width: 40,
669
+ tick: { fill: "hsl(var(--muted-foreground))", fontSize: 12 },
670
+ tickFormatter: (v) => valueFormat(Number(v))
671
+ }
672
+ ) : null,
673
+ /* @__PURE__ */ jsx9(
674
+ Tooltip2,
675
+ {
676
+ cursor: { stroke: "hsl(var(--muted-foreground))", strokeDasharray: "3 4" },
677
+ content: /* @__PURE__ */ jsx9(ChartTooltip, { valueFormat })
678
+ }
679
+ ),
680
+ showLegend ? /* @__PURE__ */ jsx9(Legend, { iconType: "circle" }) : null,
681
+ categories.map((cat, i) => {
682
+ const c = color(colors[i % colors.length] ?? "--chart-1");
683
+ return /* @__PURE__ */ jsx9(
684
+ Area,
685
+ {
686
+ type: "monotone",
687
+ dataKey: cat,
688
+ stroke: c,
689
+ strokeWidth: 2.5,
690
+ fill: `url(#${uid}-${cat})`,
691
+ isAnimationActive: !reduced,
692
+ animationDuration: 900,
693
+ dot: false,
694
+ activeDot: { r: 4, strokeWidth: 2, stroke: "hsl(var(--card))" }
695
+ },
696
+ cat
697
+ );
698
+ })
699
+ ] }) }) });
700
+ }
701
+ );
702
+ AreaChart.displayName = "AreaChart";
703
+
704
+ // src/components/charts/donut-chart.tsx
705
+ import * as React9 from "react";
706
+ import { useReducedMotion as useReducedMotion5 } from "motion/react";
707
+ import { Cell, Pie, PieChart, ResponsiveContainer as ResponsiveContainer2 } from "recharts";
708
+ import { jsx as jsx10, jsxs as jsxs9 } from "react/jsx-runtime";
709
+ var DEFAULT_COLORS2 = ["--chart-1", "--chart-2", "--chart-3", "--chart-4", "--chart-5"];
710
+ var color2 = (v) => `hsl(var(${v}))`;
711
+ var DonutChart = React9.forwardRef(
712
+ ({
713
+ className,
714
+ data,
715
+ colors = DEFAULT_COLORS2,
716
+ size = 184,
717
+ thickness = 22,
718
+ centerValue,
719
+ centerLabel,
720
+ showLegend = true,
721
+ ...props
722
+ }, ref) => {
723
+ const reduced = useReducedMotion5();
724
+ const total = Math.max(
725
+ 1,
726
+ data.reduce((sum, s) => sum + s.value, 0)
727
+ );
728
+ return /* @__PURE__ */ jsxs9(
729
+ "div",
730
+ {
731
+ ref,
732
+ className: cn("flex flex-col items-center gap-5 sm:flex-row sm:gap-8", className),
733
+ ...props,
734
+ children: [
735
+ /* @__PURE__ */ jsxs9("div", { className: "relative shrink-0", style: { width: size, height: size }, children: [
736
+ /* @__PURE__ */ jsx10(ResponsiveContainer2, { width: "100%", height: "100%", children: /* @__PURE__ */ jsx10(PieChart, { children: /* @__PURE__ */ jsx10(
737
+ Pie,
738
+ {
739
+ data,
740
+ dataKey: "value",
741
+ nameKey: "name",
742
+ cx: "50%",
743
+ cy: "50%",
744
+ innerRadius: size / 2 - thickness,
745
+ outerRadius: size / 2 - 2,
746
+ paddingAngle: 2,
747
+ cornerRadius: 5,
748
+ strokeWidth: 0,
749
+ startAngle: 90,
750
+ endAngle: -270,
751
+ isAnimationActive: !reduced,
752
+ animationDuration: 900,
753
+ children: data.map((_, i) => /* @__PURE__ */ jsx10(Cell, { fill: color2(colors[i % colors.length] ?? "--chart-1") }, i))
754
+ }
755
+ ) }) }),
756
+ (centerValue || centerLabel) && /* @__PURE__ */ jsxs9("div", { className: "pointer-events-none absolute inset-0 flex flex-col items-center justify-center text-center", children: [
757
+ centerValue ? /* @__PURE__ */ jsx10("span", { className: "font-display text-2xl font-semibold tracking-tight text-foreground", children: centerValue }) : null,
758
+ centerLabel ? /* @__PURE__ */ jsx10("span", { className: "text-xs text-muted-foreground", children: centerLabel }) : null
759
+ ] })
760
+ ] }),
761
+ showLegend ? /* @__PURE__ */ jsx10("ul", { className: "flex flex-col gap-2.5", children: data.map((segment, i) => /* @__PURE__ */ jsxs9("li", { className: "flex items-center gap-2.5 text-sm", children: [
762
+ /* @__PURE__ */ jsx10(
763
+ "span",
764
+ {
765
+ className: "size-2.5 shrink-0 rounded-full",
766
+ style: { background: color2(colors[i % colors.length] ?? "--chart-1") }
767
+ }
768
+ ),
769
+ /* @__PURE__ */ jsx10("span", { className: "text-muted-foreground", children: segment.name }),
770
+ /* @__PURE__ */ jsxs9("span", { className: "ml-auto font-medium text-foreground", children: [
771
+ Math.round(segment.value / total * 100),
772
+ "%"
773
+ ] })
774
+ ] }, i)) }) : null
775
+ ]
776
+ }
777
+ );
778
+ }
779
+ );
780
+ DonutChart.displayName = "DonutChart";
781
+
782
+ // src/components/application/data-table.tsx
783
+ import * as React17 from "react";
784
+ import {
785
+ DndContext,
786
+ KeyboardSensor,
787
+ MeasuringStrategy,
788
+ MouseSensor,
789
+ TouchSensor,
790
+ closestCenter,
791
+ useSensor,
792
+ useSensors
793
+ } from "@dnd-kit/core";
794
+ import {
795
+ SortableContext,
796
+ arrayMove,
797
+ defaultAnimateLayoutChanges,
798
+ horizontalListSortingStrategy,
799
+ useSortable,
800
+ verticalListSortingStrategy
801
+ } from "@dnd-kit/sortable";
802
+ import { CSS } from "@dnd-kit/utilities";
803
+ import {
804
+ columnFilteringFeature,
805
+ columnOrderingFeature,
806
+ columnPinningFeature,
807
+ columnSizingFeature,
808
+ columnVisibilityFeature,
809
+ createFilteredRowModel,
810
+ createPaginatedRowModel,
811
+ createSortedRowModel,
812
+ filterFn_equalsString,
813
+ filterFn_includesString,
814
+ filterFn_weakEquals,
815
+ flexRender,
816
+ globalFilteringFeature,
817
+ rowPaginationFeature,
818
+ rowSelectionFeature,
819
+ rowSortingFeature,
820
+ sortFn_alphanumeric,
821
+ tableFeatures,
822
+ useTable
823
+ } from "@tanstack/react-table";
824
+ import {
825
+ ArrowDown,
826
+ ArrowUp,
827
+ ArrowUpDown,
828
+ Filter,
829
+ GripVertical,
830
+ MoreHorizontal,
831
+ Pin,
832
+ Search,
833
+ X
834
+ } from "lucide-react";
835
+ import { motion as motion10 } from "motion/react";
836
+
837
+ // src/components/ui/button.tsx
838
+ import * as React10 from "react";
839
+ import { Slot } from "@radix-ui/react-slot";
840
+ import { cva as cva2 } from "class-variance-authority";
841
+ import { motion as motion5 } from "motion/react";
842
+ import { jsx as jsx11 } from "react/jsx-runtime";
843
+ var buttonVariants = cva2(
844
+ "inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-lg text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",
845
+ {
846
+ variants: {
847
+ variant: {
848
+ default: "bg-primary text-primary-foreground shadow-soft hover:bg-primary/90",
849
+ brand: "bg-brand text-brand-foreground shadow-soft hover:bg-brand/90",
850
+ /* A gradient can't be dimmed with an alpha modifier the way `bg-brand/90` is, so the
851
+ hover state lifts the whole ramp with a filter instead. */
852
+ gradient: "bg-gradient-brand text-brand-foreground shadow-soft transition-[filter,box-shadow] hover:brightness-110 hover:shadow-lift",
853
+ secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80",
854
+ outline: "border border-input bg-card hover:bg-accent hover:text-accent-foreground",
855
+ ghost: "hover:bg-accent hover:text-accent-foreground",
856
+ destructive: "bg-destructive text-destructive-foreground shadow-soft hover:bg-destructive/90",
857
+ link: "text-primary underline-offset-4 hover:underline"
858
+ },
859
+ size: {
860
+ sm: "h-9 px-3.5",
861
+ default: "h-10 px-5 py-2",
862
+ lg: "h-12 px-7 text-base",
863
+ pill: "h-11 rounded-full px-7",
864
+ icon: "size-10"
865
+ }
866
+ },
867
+ defaultVariants: {
868
+ variant: "default",
869
+ size: "default"
870
+ }
871
+ }
872
+ );
873
+ var Button = React10.forwardRef(
874
+ ({ className, variant, size, asChild = false, ...props }, ref) => {
875
+ if (asChild) {
876
+ return /* @__PURE__ */ jsx11(
877
+ Slot,
878
+ {
879
+ ref,
880
+ className: cn(
881
+ buttonVariants({ variant, size }),
882
+ // asChild has no Motion presets — give it CSS press feedback so links feel responsive too.
883
+ "transition-[transform,color,background-color,border-color,box-shadow] duration-150 ease-out active:scale-[0.98]",
884
+ className
885
+ ),
886
+ ...props
887
+ }
888
+ );
889
+ }
890
+ return /* @__PURE__ */ jsx11(
891
+ motion5.button,
892
+ {
893
+ ref,
894
+ className: cn(buttonVariants({ variant, size, className })),
895
+ whileTap: interaction.tap,
896
+ transition: spring.snappy,
897
+ ...props
898
+ }
899
+ );
900
+ }
901
+ );
902
+ Button.displayName = "Button";
903
+
904
+ // src/components/ui/checkbox.tsx
905
+ import * as React11 from "react";
906
+ import * as CheckboxPrimitive from "@radix-ui/react-checkbox";
907
+ import { Check, Minus } from "lucide-react";
908
+ import { motion as motion6 } from "motion/react";
909
+ import { jsx as jsx12, jsxs as jsxs10 } from "react/jsx-runtime";
910
+ var Checkbox = React11.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx12(
911
+ CheckboxPrimitive.Root,
912
+ {
913
+ ref,
914
+ className: cn(
915
+ "group peer size-5 shrink-0 rounded-[6px] border border-input bg-card shadow-xs transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:border-brand data-[state=checked]:bg-brand data-[state=checked]:text-brand-foreground data-[state=indeterminate]:border-brand data-[state=indeterminate]:bg-brand data-[state=indeterminate]:text-brand-foreground",
916
+ className
917
+ ),
918
+ ...props,
919
+ children: /* @__PURE__ */ jsx12(CheckboxPrimitive.Indicator, { asChild: true, children: /* @__PURE__ */ jsxs10(
920
+ motion6.span,
921
+ {
922
+ initial: { scale: 0.4, opacity: 0 },
923
+ animate: { scale: 1, opacity: 1 },
924
+ transition: spring.bouncy,
925
+ className: "flex items-center justify-center text-current",
926
+ children: [
927
+ /* @__PURE__ */ jsx12(Check, { className: "size-3.5 group-data-[state=indeterminate]:hidden", strokeWidth: 3 }),
928
+ /* @__PURE__ */ jsx12(Minus, { className: "hidden size-3.5 group-data-[state=indeterminate]:block", strokeWidth: 3 })
929
+ ]
930
+ }
931
+ ) })
932
+ }
933
+ ));
934
+ Checkbox.displayName = "Checkbox";
935
+
936
+ // src/components/ui/dropdown-menu.tsx
937
+ import * as React12 from "react";
938
+ import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu";
939
+ import { Check as Check2 } from "lucide-react";
940
+ import { motion as motion7 } from "motion/react";
941
+ import { jsx as jsx13, jsxs as jsxs11 } from "react/jsx-runtime";
942
+ var DropdownMenu = DropdownMenuPrimitive.Root;
943
+ var DropdownMenuTrigger = DropdownMenuPrimitive.Trigger;
944
+ var DropdownMenuContent = React12.forwardRef(({ className, sideOffset = 6, children, ...props }, ref) => /* @__PURE__ */ jsx13(DropdownMenuPrimitive.Portal, { children: /* @__PURE__ */ jsx13(
945
+ DropdownMenuPrimitive.Content,
946
+ {
947
+ ref,
948
+ sideOffset,
949
+ className: "z-50",
950
+ ...props,
951
+ children: /* @__PURE__ */ jsx13(
952
+ motion7.div,
953
+ {
954
+ initial: { opacity: 0, scale: 0.97 },
955
+ animate: { opacity: 1, scale: 1 },
956
+ transition: tween.quick,
957
+ style: {
958
+ transformOrigin: "var(--radix-dropdown-menu-content-transform-origin)"
959
+ },
960
+ className: cn(
961
+ "min-w-[10rem] overflow-hidden rounded-lg border border-border bg-popover p-1 text-popover-foreground shadow-lift",
962
+ className
963
+ ),
964
+ children
965
+ }
966
+ )
967
+ }
968
+ ) }));
969
+ DropdownMenuContent.displayName = "DropdownMenuContent";
970
+ var DropdownMenuItem = React12.forwardRef(({ className, inset, ...props }, ref) => /* @__PURE__ */ jsx13(
971
+ DropdownMenuPrimitive.Item,
972
+ {
973
+ ref,
974
+ className: cn(
975
+ "relative flex cursor-pointer select-none items-center gap-2 rounded-md px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:size-4 [&_svg]:shrink-0 [&_svg]:opacity-70",
976
+ inset && "pl-8",
977
+ className
978
+ ),
979
+ ...props
980
+ }
981
+ ));
982
+ DropdownMenuItem.displayName = "DropdownMenuItem";
983
+ var DropdownMenuCheckboxItem = React12.forwardRef(({ className, children, checked, ...props }, ref) => /* @__PURE__ */ jsxs11(
984
+ DropdownMenuPrimitive.CheckboxItem,
985
+ {
986
+ ref,
987
+ checked,
988
+ className: cn(
989
+ "relative flex cursor-pointer select-none items-center rounded-md py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
990
+ className
991
+ ),
992
+ ...props,
993
+ children: [
994
+ /* @__PURE__ */ jsx13("span", { className: "absolute left-2 flex size-4 items-center justify-center", children: /* @__PURE__ */ jsx13(DropdownMenuPrimitive.ItemIndicator, { children: /* @__PURE__ */ jsx13(Check2, { className: "size-4 text-primary" }) }) }),
995
+ children
996
+ ]
997
+ }
998
+ ));
999
+ DropdownMenuCheckboxItem.displayName = "DropdownMenuCheckboxItem";
1000
+ var DropdownMenuLabel = React12.forwardRef(({ className, inset, ...props }, ref) => /* @__PURE__ */ jsx13(
1001
+ DropdownMenuPrimitive.Label,
1002
+ {
1003
+ ref,
1004
+ className: cn(
1005
+ "px-2 py-1.5 text-xs font-medium text-muted-foreground",
1006
+ inset && "pl-8",
1007
+ className
1008
+ ),
1009
+ ...props
1010
+ }
1011
+ ));
1012
+ DropdownMenuLabel.displayName = "DropdownMenuLabel";
1013
+ var DropdownMenuSeparator = React12.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx13(
1014
+ DropdownMenuPrimitive.Separator,
1015
+ {
1016
+ ref,
1017
+ className: cn("-mx-1 my-1 h-px bg-border", className),
1018
+ ...props
1019
+ }
1020
+ ));
1021
+ DropdownMenuSeparator.displayName = "DropdownMenuSeparator";
1022
+ var DropdownMenuShortcut = ({
1023
+ className,
1024
+ ...props
1025
+ }) => /* @__PURE__ */ jsx13(
1026
+ "span",
1027
+ {
1028
+ className: cn("ml-auto text-xs tracking-widest text-muted-foreground", className),
1029
+ ...props
1030
+ }
1031
+ );
1032
+ DropdownMenuShortcut.displayName = "DropdownMenuShortcut";
1033
+
1034
+ // src/components/ui/input.tsx
1035
+ import * as React13 from "react";
1036
+ import { jsx as jsx14 } from "react/jsx-runtime";
1037
+ var Input = React13.forwardRef(
1038
+ ({ className, type = "text", ...props }, ref) => /* @__PURE__ */ jsx14(
1039
+ "input",
1040
+ {
1041
+ ref,
1042
+ type,
1043
+ className: cn(
1044
+ "flex h-10 w-full rounded-lg border border-input bg-card px-3.5 py-2 text-sm text-foreground shadow-xs transition-colors placeholder:text-muted-foreground focus-visible:border-ring focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/40 disabled:cursor-not-allowed disabled:opacity-50 file:border-0 file:bg-transparent file:text-sm file:font-medium",
1045
+ className
1046
+ ),
1047
+ ...props
1048
+ }
1049
+ )
1050
+ );
1051
+ Input.displayName = "Input";
1052
+
1053
+ // src/components/ui/pagination.tsx
1054
+ import * as React14 from "react";
1055
+ import { ChevronLeft, ChevronRight } from "lucide-react";
1056
+ import { jsx as jsx15, jsxs as jsxs12 } from "react/jsx-runtime";
1057
+ function range(start, end) {
1058
+ return Array.from({ length: end - start + 1 }, (_, i) => start + i);
1059
+ }
1060
+ function getPages(page, total, siblings) {
1061
+ const totalToShow = siblings * 2 + 5;
1062
+ if (total <= totalToShow) return range(1, total);
1063
+ const leftSibling = Math.max(page - siblings, 1);
1064
+ const rightSibling = Math.min(page + siblings, total);
1065
+ const showLeftDots = leftSibling > 2;
1066
+ const showRightDots = rightSibling < total - 1;
1067
+ if (!showLeftDots && showRightDots) {
1068
+ return [...range(1, siblings * 2 + 3), "\u2026", total];
1069
+ }
1070
+ if (showLeftDots && !showRightDots) {
1071
+ return [1, "\u2026", ...range(total - (siblings * 2 + 2), total)];
1072
+ }
1073
+ return [1, "\u2026", ...range(leftSibling, rightSibling), "\u2026", total];
1074
+ }
1075
+ var itemClass = "inline-flex h-9 min-w-9 items-center justify-center rounded-lg px-2 text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-40";
1076
+ var Pagination = React14.forwardRef(
1077
+ ({ className, page, total, onPageChange, siblingCount = 1, ...props }, ref) => {
1078
+ const pages = getPages(page, total, siblingCount);
1079
+ const go = (p) => {
1080
+ if (p >= 1 && p <= total && p !== page) onPageChange?.(p);
1081
+ };
1082
+ return /* @__PURE__ */ jsxs12(
1083
+ "nav",
1084
+ {
1085
+ ref,
1086
+ "aria-label": "Pagination",
1087
+ className: cn("flex items-center gap-1", className),
1088
+ ...props,
1089
+ children: [
1090
+ /* @__PURE__ */ jsx15(
1091
+ "button",
1092
+ {
1093
+ type: "button",
1094
+ "aria-label": "Previous page",
1095
+ onClick: () => go(page - 1),
1096
+ disabled: page <= 1,
1097
+ className: cn(itemClass, "gap-1 text-muted-foreground hover:bg-accent hover:text-foreground"),
1098
+ children: /* @__PURE__ */ jsx15(ChevronLeft, { className: "size-4" })
1099
+ }
1100
+ ),
1101
+ pages.map(
1102
+ (p, i) => p === "\u2026" ? /* @__PURE__ */ jsx15(
1103
+ "span",
1104
+ {
1105
+ className: "inline-flex h-9 min-w-9 items-center justify-center text-sm text-muted-foreground",
1106
+ children: "\u2026"
1107
+ },
1108
+ `dots-${i}`
1109
+ ) : /* @__PURE__ */ jsx15(
1110
+ "button",
1111
+ {
1112
+ type: "button",
1113
+ "aria-current": p === page ? "page" : void 0,
1114
+ onClick: () => go(p),
1115
+ className: cn(
1116
+ itemClass,
1117
+ p === page ? "bg-primary text-primary-foreground" : "text-muted-foreground hover:bg-accent hover:text-foreground"
1118
+ ),
1119
+ children: p
1120
+ },
1121
+ p
1122
+ )
1123
+ ),
1124
+ /* @__PURE__ */ jsx15(
1125
+ "button",
1126
+ {
1127
+ type: "button",
1128
+ "aria-label": "Next page",
1129
+ onClick: () => go(page + 1),
1130
+ disabled: page >= total,
1131
+ className: cn(itemClass, "gap-1 text-muted-foreground hover:bg-accent hover:text-foreground"),
1132
+ children: /* @__PURE__ */ jsx15(ChevronRight, { className: "size-4" })
1133
+ }
1134
+ )
1135
+ ]
1136
+ }
1137
+ );
1138
+ }
1139
+ );
1140
+ Pagination.displayName = "Pagination";
1141
+
1142
+ // src/components/ui/select.tsx
1143
+ import * as React15 from "react";
1144
+ import * as SelectPrimitive from "@radix-ui/react-select";
1145
+ import { Check as Check3, ChevronDown, ChevronUp } from "lucide-react";
1146
+ import { motion as motion8 } from "motion/react";
1147
+ import { jsx as jsx16, jsxs as jsxs13 } from "react/jsx-runtime";
1148
+ var Select = SelectPrimitive.Root;
1149
+ var SelectValue = SelectPrimitive.Value;
1150
+ var SelectTrigger = React15.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs13(
1151
+ SelectPrimitive.Trigger,
1152
+ {
1153
+ ref,
1154
+ className: cn(
1155
+ "flex h-10 w-full items-center justify-between gap-2 whitespace-nowrap rounded-lg border border-input bg-card px-3.5 py-2 text-sm text-foreground shadow-xs transition-colors data-[placeholder]:text-muted-foreground focus:border-ring focus:outline-none focus:ring-2 focus:ring-ring/40 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:truncate",
1156
+ className
1157
+ ),
1158
+ ...props,
1159
+ children: [
1160
+ children,
1161
+ /* @__PURE__ */ jsx16(SelectPrimitive.Icon, { asChild: true, children: /* @__PURE__ */ jsx16(ChevronDown, { className: "size-4 shrink-0 opacity-60" }) })
1162
+ ]
1163
+ }
1164
+ ));
1165
+ SelectTrigger.displayName = "SelectTrigger";
1166
+ var SelectContent = React15.forwardRef(({ className, children, position = "popper", ...props }, ref) => /* @__PURE__ */ jsx16(SelectPrimitive.Portal, { children: /* @__PURE__ */ jsx16(
1167
+ SelectPrimitive.Content,
1168
+ {
1169
+ ref,
1170
+ position,
1171
+ sideOffset: 6,
1172
+ className: "z-50",
1173
+ ...props,
1174
+ children: /* @__PURE__ */ jsxs13(
1175
+ motion8.div,
1176
+ {
1177
+ initial: { opacity: 0, scale: 0.97 },
1178
+ animate: { opacity: 1, scale: 1 },
1179
+ transition: tween.quick,
1180
+ style: { transformOrigin: "var(--radix-select-content-transform-origin)" },
1181
+ className: cn(
1182
+ "max-h-96 min-w-[8rem] overflow-hidden rounded-lg border border-border bg-popover text-popover-foreground shadow-lift",
1183
+ position === "popper" && "w-[var(--radix-select-trigger-width)]",
1184
+ className
1185
+ ),
1186
+ children: [
1187
+ /* @__PURE__ */ jsx16(SelectPrimitive.ScrollUpButton, { className: "flex items-center justify-center py-1 text-muted-foreground", children: /* @__PURE__ */ jsx16(ChevronUp, { className: "size-4" }) }),
1188
+ /* @__PURE__ */ jsx16(SelectPrimitive.Viewport, { className: "p-1", children }),
1189
+ /* @__PURE__ */ jsx16(SelectPrimitive.ScrollDownButton, { className: "flex items-center justify-center py-1 text-muted-foreground", children: /* @__PURE__ */ jsx16(ChevronDown, { className: "size-4" }) })
1190
+ ]
1191
+ }
1192
+ )
1193
+ }
1194
+ ) }));
1195
+ SelectContent.displayName = "SelectContent";
1196
+ var SelectLabel = React15.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx16(
1197
+ SelectPrimitive.Label,
1198
+ {
1199
+ ref,
1200
+ className: cn("px-2 py-1.5 text-xs font-medium text-muted-foreground", className),
1201
+ ...props
1202
+ }
1203
+ ));
1204
+ SelectLabel.displayName = "SelectLabel";
1205
+ var SelectItem = React15.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs13(
1206
+ SelectPrimitive.Item,
1207
+ {
1208
+ ref,
1209
+ className: cn(
1210
+ "relative flex w-full cursor-pointer select-none items-center rounded-md py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
1211
+ className
1212
+ ),
1213
+ ...props,
1214
+ children: [
1215
+ /* @__PURE__ */ jsx16("span", { className: "absolute left-2 flex size-4 items-center justify-center", children: /* @__PURE__ */ jsx16(SelectPrimitive.ItemIndicator, { children: /* @__PURE__ */ jsx16(Check3, { className: "size-4 text-primary" }) }) }),
1216
+ /* @__PURE__ */ jsx16(SelectPrimitive.ItemText, { children })
1217
+ ]
1218
+ }
1219
+ ));
1220
+ SelectItem.displayName = "SelectItem";
1221
+ var SelectSeparator = React15.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx16(
1222
+ SelectPrimitive.Separator,
1223
+ {
1224
+ ref,
1225
+ className: cn("-mx-1 my-1 h-px bg-border", className),
1226
+ ...props
1227
+ }
1228
+ ));
1229
+ SelectSeparator.displayName = "SelectSeparator";
1230
+
1231
+ // src/components/ui/spinner.tsx
1232
+ import * as React16 from "react";
1233
+ import { motion as motion9 } from "motion/react";
1234
+ import { jsx as jsx17 } from "react/jsx-runtime";
1235
+ var sizeClasses = {
1236
+ sm: "size-4 border-2",
1237
+ md: "size-6 border-2",
1238
+ lg: "size-8 border-[3px]"
1239
+ };
1240
+ var Spinner = React16.forwardRef(
1241
+ ({ className, size = "md", label = "Loading", ...props }, ref) => /* @__PURE__ */ jsx17(
1242
+ "span",
1243
+ {
1244
+ ref,
1245
+ role: "status",
1246
+ "aria-label": label,
1247
+ className: cn("inline-flex text-brand", className),
1248
+ ...props,
1249
+ children: /* @__PURE__ */ jsx17(
1250
+ motion9.span,
1251
+ {
1252
+ className: cn(
1253
+ "block rounded-full border-current border-t-transparent",
1254
+ sizeClasses[size]
1255
+ ),
1256
+ animate: { rotate: 360 },
1257
+ transition: { duration: 0.6, ease: "linear", repeat: Infinity }
1258
+ }
1259
+ )
1260
+ }
1261
+ )
1262
+ );
1263
+ Spinner.displayName = "Spinner";
1264
+
1265
+ // src/components/application/data-table.tsx
1266
+ import { Fragment, jsx as jsx18, jsxs as jsxs14 } from "react/jsx-runtime";
1267
+ var dataTableFeatures = tableFeatures({
1268
+ rowSortingFeature,
1269
+ columnFilteringFeature,
1270
+ globalFilteringFeature,
1271
+ rowPaginationFeature,
1272
+ rowSelectionFeature,
1273
+ columnOrderingFeature,
1274
+ columnPinningFeature,
1275
+ columnSizingFeature,
1276
+ columnVisibilityFeature,
1277
+ sortedRowModel: createSortedRowModel(),
1278
+ filteredRowModel: createFilteredRowModel(),
1279
+ paginatedRowModel: createPaginatedRowModel(),
1280
+ sortFns: { alphanumeric: sortFn_alphanumeric },
1281
+ filterFns: {
1282
+ includesString: filterFn_includesString,
1283
+ equalsString: filterFn_equalsString,
1284
+ weakEquals: filterFn_weakEquals
1285
+ },
1286
+ columnMeta: {}
1287
+ });
1288
+ var alignClass = {
1289
+ left: "text-left",
1290
+ center: "text-center",
1291
+ right: "text-right"
1292
+ };
1293
+ var SELECT_COL_ID = "__select";
1294
+ var REORDER_COL_ID = "__reorder";
1295
+ function getUtilityColumnIds(options) {
1296
+ const ids = [];
1297
+ if (options.enableRowOrdering) ids.push(REORDER_COL_ID);
1298
+ if (options.enableRowSelection) ids.push(SELECT_COL_ID);
1299
+ return ids;
1300
+ }
1301
+ function withPinnedUtilities(pinning, utilityIds) {
1302
+ if (!utilityIds.length) return pinning;
1303
+ const utilSet = new Set(utilityIds);
1304
+ return {
1305
+ start: [
1306
+ ...utilityIds,
1307
+ ...pinning.start.filter((id) => !utilSet.has(id))
1308
+ ],
1309
+ end: pinning.end.filter((id) => !utilSet.has(id))
1310
+ };
1311
+ }
1312
+ function withOrderedUtilities(order, utilityIds) {
1313
+ if (!utilityIds.length) return order;
1314
+ const utilSet = new Set(utilityIds);
1315
+ return [...utilityIds, ...order.filter((id) => !utilSet.has(id))];
1316
+ }
1317
+ function resolveFilterConfig(col, enableColumnFilters) {
1318
+ if (col.filter === false || col.enableColumnFilter === false) return false;
1319
+ if (typeof col.filter === "object") return { type: "text", ...col.filter };
1320
+ if (col.filter === true || col.enableColumnFilter === true || enableColumnFilters) {
1321
+ return { type: "text" };
1322
+ }
1323
+ return false;
1324
+ }
1325
+ function hasAnyColumnFilter(columns2) {
1326
+ return columns2.some(
1327
+ (col) => col.filter === true || typeof col.filter === "object" || col.enableColumnFilter === true
1328
+ );
1329
+ }
1330
+ function filterFnForType(type) {
1331
+ switch (type) {
1332
+ case "select":
1333
+ case "boolean":
1334
+ return "equalsString";
1335
+ case "number":
1336
+ return "weakEquals";
1337
+ case "custom":
1338
+ case "text":
1339
+ default:
1340
+ return "includesString";
1341
+ }
1342
+ }
1343
+ function toColumnDef(col, options) {
1344
+ const id = col.id ?? col.key;
1345
+ const filterConfig = resolveFilterConfig(
1346
+ col,
1347
+ options.enableColumnFilters
1348
+ );
1349
+ const enableColumnFilter = filterConfig !== false;
1350
+ const base = {
1351
+ id,
1352
+ header: () => col.header,
1353
+ cell: (info) => {
1354
+ if (col.cell) return col.cell(info.row.original);
1355
+ const value = info.getValue();
1356
+ if (col.format) return col.format(value, info.row.original);
1357
+ return value == null ? "" : String(value);
1358
+ },
1359
+ enableSorting: col.enableSorting ?? options.enableSorting,
1360
+ enablePinning: col.enablePinning ?? options.enablePinning,
1361
+ enableColumnFilter,
1362
+ filterFn: filterFnForType(
1363
+ filterConfig === false ? void 0 : filterConfig.type
1364
+ ),
1365
+ size: col.size,
1366
+ minSize: col.minSize,
1367
+ maxSize: col.maxSize,
1368
+ meta: {
1369
+ align: col.align ?? "left",
1370
+ className: col.className,
1371
+ enableOrdering: col.enableOrdering,
1372
+ filter: filterConfig
1373
+ }
1374
+ };
1375
+ if (col.accessorFn) {
1376
+ return { ...base, accessorFn: col.accessorFn };
1377
+ }
1378
+ if (col.accessorKey) {
1379
+ return { ...base, accessorKey: col.accessorKey };
1380
+ }
1381
+ return {
1382
+ ...base,
1383
+ accessorFn: (row) => row[col.key]
1384
+ };
1385
+ }
1386
+ function getPinnedStyles(column, isHeader, options) {
1387
+ const pinned = column.getIsPinned();
1388
+ if (!pinned) return {};
1389
+ return {
1390
+ position: "sticky",
1391
+ ...pinned === "start" ? { insetInlineStart: `${column.getStart("start")}px` } : { insetInlineEnd: `${column.getAfter("end")}px` },
1392
+ zIndex: isHeader ? 3 : 2,
1393
+ ...options?.hideShadow ? {} : {}
1394
+ };
1395
+ }
1396
+ var ROW_SORT_TRANSITION = {
1397
+ duration: 280,
1398
+ easing: "cubic-bezier(0.22, 1, 0.36, 1)"
1399
+ };
1400
+ var COL_SORT_TRANSITION = {
1401
+ duration: 280,
1402
+ easing: "cubic-bezier(0.22, 1, 0.36, 1)"
1403
+ };
1404
+ var rowAnimateLayoutChanges = (args) => {
1405
+ if (args.isSorting || args.wasDragging) {
1406
+ return defaultAnimateLayoutChanges(args);
1407
+ }
1408
+ return false;
1409
+ };
1410
+ var columnAnimateLayoutChanges = (args) => {
1411
+ if (args.isSorting || args.wasDragging) {
1412
+ return defaultAnimateLayoutChanges(args);
1413
+ }
1414
+ return false;
1415
+ };
1416
+ var ColumnDragStoreContext = React17.createContext(null);
1417
+ function framesEqual(a, b) {
1418
+ if (!a) return false;
1419
+ return a.isDragging === b.isDragging && a.transition === b.transition && a.transform?.x === b.transform?.x && a.transform?.y === b.transform?.y && a.transform?.scaleX === b.transform?.scaleX && a.transform?.scaleY === b.transform?.scaleY;
1420
+ }
1421
+ function ColumnDragBridgeProvider({ children }) {
1422
+ const store = React17.useMemo(() => {
1423
+ const frames = /* @__PURE__ */ new Map();
1424
+ const listeners = /* @__PURE__ */ new Set();
1425
+ const emit = () => {
1426
+ listeners.forEach((listener) => listener());
1427
+ };
1428
+ return {
1429
+ subscribe(onStoreChange) {
1430
+ listeners.add(onStoreChange);
1431
+ return () => {
1432
+ listeners.delete(onStoreChange);
1433
+ };
1434
+ },
1435
+ getFrame(columnId) {
1436
+ return frames.get(columnId);
1437
+ },
1438
+ setFrame(columnId, frame) {
1439
+ const current = frames.get(columnId);
1440
+ if (frame == null) {
1441
+ if (!current) return;
1442
+ frames.delete(columnId);
1443
+ emit();
1444
+ return;
1445
+ }
1446
+ if (framesEqual(current, frame)) return;
1447
+ frames.set(columnId, frame);
1448
+ emit();
1449
+ }
1450
+ };
1451
+ }, []);
1452
+ return /* @__PURE__ */ jsx18(ColumnDragStoreContext.Provider, { value: store, children });
1453
+ }
1454
+ var emptyColumnDragSubscribe = () => () => {
1455
+ };
1456
+ function useColumnDragFrame(columnId) {
1457
+ const store = React17.useContext(ColumnDragStoreContext);
1458
+ return React17.useSyncExternalStore(
1459
+ store ? store.subscribe : emptyColumnDragSubscribe,
1460
+ () => store?.getFrame(columnId),
1461
+ () => void 0
1462
+ );
1463
+ }
1464
+ function usePublishColumnDragFrame(columnId, enabled, transform, transition, isDragging) {
1465
+ const store = React17.useContext(ColumnDragStoreContext);
1466
+ React17.useLayoutEffect(() => {
1467
+ if (!enabled || !store) return;
1468
+ store.setFrame(columnId, { transform, transition, isDragging });
1469
+ }, [
1470
+ store,
1471
+ enabled,
1472
+ columnId,
1473
+ transform?.x,
1474
+ transform?.y,
1475
+ transform?.scaleX,
1476
+ transform?.scaleY,
1477
+ transition,
1478
+ isDragging
1479
+ ]);
1480
+ React17.useEffect(() => {
1481
+ if (!enabled || !store) return;
1482
+ return () => {
1483
+ store.setFrame(columnId, null);
1484
+ };
1485
+ }, [store, enabled, columnId]);
1486
+ }
1487
+ function normalizeFilterValue(value) {
1488
+ if (value == null) return void 0;
1489
+ if (typeof value === "string" && value.trim() === "") return void 0;
1490
+ return value;
1491
+ }
1492
+ function ColumnFilterControl({
1493
+ config,
1494
+ value,
1495
+ onChange,
1496
+ onClear
1497
+ }) {
1498
+ const type = config.type ?? "text";
1499
+ const placeholder = config.placeholder ?? "Filter\u2026";
1500
+ if (config.render) {
1501
+ return /* @__PURE__ */ jsx18(Fragment, { children: config.render({
1502
+ value,
1503
+ setValue: onChange,
1504
+ clear: onClear
1505
+ }) });
1506
+ }
1507
+ if (type === "select" || type === "boolean") {
1508
+ const options = config.options ?? (type === "boolean" ? [
1509
+ { label: "True", value: "true" },
1510
+ { label: "False", value: "false" }
1511
+ ] : []);
1512
+ const selectValue = value == null ? "" : String(value);
1513
+ return /* @__PURE__ */ jsxs14("div", { className: "flex items-center gap-1", children: [
1514
+ /* @__PURE__ */ jsxs14(
1515
+ Select,
1516
+ {
1517
+ value: selectValue || void 0,
1518
+ onValueChange: (next) => onChange(next),
1519
+ children: [
1520
+ /* @__PURE__ */ jsx18(SelectTrigger, { className: "h-8 px-2 text-xs font-normal normal-case tracking-normal", children: /* @__PURE__ */ jsx18(SelectValue, { placeholder }) }),
1521
+ /* @__PURE__ */ jsx18(SelectContent, { children: options.map((option) => /* @__PURE__ */ jsx18(SelectItem, { value: option.value, children: option.label }, option.value)) })
1522
+ ]
1523
+ }
1524
+ ),
1525
+ selectValue ? /* @__PURE__ */ jsx18(
1526
+ Button,
1527
+ {
1528
+ type: "button",
1529
+ variant: "ghost",
1530
+ size: "icon",
1531
+ className: "size-8 shrink-0",
1532
+ "aria-label": "Clear filter",
1533
+ onClick: onClear,
1534
+ children: /* @__PURE__ */ jsx18(X, { className: "size-3.5" })
1535
+ }
1536
+ ) : null
1537
+ ] });
1538
+ }
1539
+ return /* @__PURE__ */ jsx18(
1540
+ Input,
1541
+ {
1542
+ autoFocus: true,
1543
+ type: type === "number" ? "number" : "text",
1544
+ value: value == null ? "" : String(value),
1545
+ onChange: (e) => onChange(e.target.value),
1546
+ placeholder,
1547
+ className: "h-8 px-2 text-xs font-normal normal-case tracking-normal",
1548
+ onClick: (e) => e.stopPropagation(),
1549
+ onKeyDown: (e) => {
1550
+ if (e.key === "Escape") onClear();
1551
+ }
1552
+ }
1553
+ );
1554
+ }
1555
+ function SortableHeaderCell({
1556
+ header,
1557
+ enableOrdering,
1558
+ enablePinning,
1559
+ onFilterOpenChange,
1560
+ onFilterApply,
1561
+ onFilterClear,
1562
+ onPinColumn,
1563
+ children
1564
+ }) {
1565
+ const meta = header.column.columnDef.meta;
1566
+ const filterConfig = meta?.filter;
1567
+ const canOrder = enableOrdering && header.column.id !== SELECT_COL_ID && header.column.id !== REORDER_COL_ID && meta?.enableOrdering !== false;
1568
+ const { attributes, listeners, setNodeRef, transform, transition, isDragging } = useSortable({
1569
+ id: header.column.id,
1570
+ disabled: !canOrder,
1571
+ animateLayoutChanges: columnAnimateLayoutChanges,
1572
+ transition: COL_SORT_TRANSITION
1573
+ });
1574
+ usePublishColumnDragFrame(
1575
+ header.column.id,
1576
+ canOrder,
1577
+ transform,
1578
+ transition,
1579
+ isDragging
1580
+ );
1581
+ const [filterOpen, setFilterOpen] = React17.useState(false);
1582
+ const [menuOpen, setMenuOpen] = React17.useState(false);
1583
+ const pinned = header.column.getIsPinned();
1584
+ const canPin = enablePinning && header.column.getCanPin();
1585
+ const canFilter = header.column.getCanFilter() && filterConfig !== false;
1586
+ const showMenu = canPin || canFilter;
1587
+ const rawFilterValue = header.column.getFilterValue();
1588
+ const hasActiveFilter = normalizeFilterValue(rawFilterValue) !== void 0;
1589
+ const isUtilityCol = header.column.id === SELECT_COL_ID || header.column.id === REORDER_COL_ID;
1590
+ const setFilterOpenSafe = (open) => {
1591
+ setFilterOpen(open);
1592
+ onFilterOpenChange?.(header.column.id, open);
1593
+ };
1594
+ const applyFilterValue = (value) => {
1595
+ const next = normalizeFilterValue(value);
1596
+ header.column.setFilterValue(next);
1597
+ if (next === void 0) {
1598
+ onFilterClear?.(header.column.id);
1599
+ } else {
1600
+ onFilterApply?.(header.column.id, next);
1601
+ }
1602
+ };
1603
+ const clearFilterValue = () => {
1604
+ header.column.setFilterValue(void 0);
1605
+ setFilterOpenSafe(false);
1606
+ onFilterClear?.(header.column.id);
1607
+ };
1608
+ const pinColumn = (position) => {
1609
+ header.column.pin(position);
1610
+ onPinColumn?.(header.column.id, position);
1611
+ };
1612
+ return /* @__PURE__ */ jsx18(
1613
+ "th",
1614
+ {
1615
+ ref: setNodeRef,
1616
+ colSpan: header.colSpan,
1617
+ style: {
1618
+ width: header.getSize(),
1619
+ transform: CSS.Translate.toString(transform),
1620
+ transition,
1621
+ opacity: isDragging ? 0.92 : 1,
1622
+ zIndex: isDragging ? 20 : void 0,
1623
+ position: isDragging ? "relative" : void 0,
1624
+ boxShadow: isDragging ? "0 10px 28px -10px hsl(var(--foreground) / 0.2)" : void 0,
1625
+ ...getPinnedStyles(header.column, true, { hideShadow: isUtilityCol })
1626
+ },
1627
+ className: cn(
1628
+ "group/header relative border-b border-border bg-card text-xs font-medium uppercase tracking-wide text-muted-foreground",
1629
+ isUtilityCol ? "px-1.5 py-2.5" : "px-3 py-2.5",
1630
+ alignClass[meta?.align ?? "left"],
1631
+ meta?.className,
1632
+ pinned && !isUtilityCol && "shadow-[1px_0_0_0_hsl(var(--border))]",
1633
+ pinned === "end" && !isUtilityCol && "shadow-[-1px_0_0_0_hsl(var(--border))]"
1634
+ ),
1635
+ children: /* @__PURE__ */ jsxs14("div", { className: "flex flex-col gap-1.5", children: [
1636
+ /* @__PURE__ */ jsxs14("div", { className: "flex items-center gap-1", children: [
1637
+ canOrder ? /* @__PURE__ */ jsx18(
1638
+ "button",
1639
+ {
1640
+ type: "button",
1641
+ className: "inline-flex size-6 shrink-0 cursor-grab items-center justify-center rounded-md text-muted-foreground opacity-0 transition-opacity hover:bg-muted hover:text-foreground active:cursor-grabbing group-hover/header:opacity-100",
1642
+ "aria-label": `Reorder ${header.column.id} column`,
1643
+ ...attributes,
1644
+ ...listeners,
1645
+ children: /* @__PURE__ */ jsx18(GripVertical, { className: "size-3.5" })
1646
+ }
1647
+ ) : null,
1648
+ /* @__PURE__ */ jsx18("div", { className: "min-w-0 flex-1", children }),
1649
+ showMenu ? /* @__PURE__ */ jsxs14(DropdownMenu, { open: menuOpen, onOpenChange: setMenuOpen, children: [
1650
+ /* @__PURE__ */ jsx18(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsx18(
1651
+ Button,
1652
+ {
1653
+ type: "button",
1654
+ variant: "ghost",
1655
+ size: "icon",
1656
+ className: cn(
1657
+ "size-6 shrink-0 transition-opacity hover:bg-muted",
1658
+ menuOpen || hasActiveFilter ? "opacity-100" : "opacity-0 group-hover/header:opacity-100"
1659
+ ),
1660
+ "aria-label": `${header.column.id} column options`,
1661
+ children: /* @__PURE__ */ jsx18(MoreHorizontal, { className: "size-3.5" })
1662
+ }
1663
+ ) }),
1664
+ /* @__PURE__ */ jsxs14(DropdownMenuContent, { align: "end", className: "w-44", children: [
1665
+ /* @__PURE__ */ jsx18(DropdownMenuLabel, { children: "Column" }),
1666
+ canFilter ? /* @__PURE__ */ jsxs14(Fragment, { children: [
1667
+ /* @__PURE__ */ jsx18(DropdownMenuSeparator, {}),
1668
+ /* @__PURE__ */ jsxs14(
1669
+ DropdownMenuItem,
1670
+ {
1671
+ onSelect: () => setFilterOpenSafe(!filterOpen),
1672
+ children: [
1673
+ /* @__PURE__ */ jsx18(Filter, { className: "size-4" }),
1674
+ filterOpen ? "Hide filter" : "Filter"
1675
+ ]
1676
+ }
1677
+ ),
1678
+ hasActiveFilter ? /* @__PURE__ */ jsxs14(DropdownMenuItem, { onSelect: clearFilterValue, children: [
1679
+ /* @__PURE__ */ jsx18(X, { className: "size-4" }),
1680
+ "Clear filter"
1681
+ ] }) : null
1682
+ ] }) : null,
1683
+ canPin ? /* @__PURE__ */ jsxs14(Fragment, { children: [
1684
+ /* @__PURE__ */ jsx18(DropdownMenuSeparator, {}),
1685
+ /* @__PURE__ */ jsxs14(DropdownMenuItem, { onSelect: () => pinColumn("start"), children: [
1686
+ /* @__PURE__ */ jsx18(Pin, { className: "size-4" }),
1687
+ "Pin start"
1688
+ ] }),
1689
+ /* @__PURE__ */ jsxs14(DropdownMenuItem, { onSelect: () => pinColumn("end"), children: [
1690
+ /* @__PURE__ */ jsx18(Pin, { className: "size-4" }),
1691
+ "Pin end"
1692
+ ] }),
1693
+ pinned ? /* @__PURE__ */ jsxs14(DropdownMenuItem, { onSelect: () => pinColumn(false), children: [
1694
+ /* @__PURE__ */ jsx18(X, { className: "size-4" }),
1695
+ "Unpin"
1696
+ ] }) : null
1697
+ ] }) : null
1698
+ ] })
1699
+ ] }) : null
1700
+ ] }),
1701
+ canFilter && filterOpen && filterConfig ? /* @__PURE__ */ jsx18("div", { onClick: (e) => e.stopPropagation(), onKeyDown: (e) => e.stopPropagation(), children: /* @__PURE__ */ jsx18(
1702
+ ColumnFilterControl,
1703
+ {
1704
+ config: filterConfig,
1705
+ value: rawFilterValue,
1706
+ onChange: applyFilterValue,
1707
+ onClear: clearFilterValue
1708
+ }
1709
+ ) }) : null
1710
+ ] })
1711
+ }
1712
+ );
1713
+ }
1714
+ function BodyCell({
1715
+ cell,
1716
+ dragHandleProps,
1717
+ isDragging: isRowDragging
1718
+ }) {
1719
+ const meta = cell.column.columnDef.meta;
1720
+ const pinned = cell.column.getIsPinned();
1721
+ const isSelect = cell.column.id === SELECT_COL_ID;
1722
+ const isReorder = cell.column.id === REORDER_COL_ID;
1723
+ const isUtility = isSelect || isReorder;
1724
+ const columnDrag = useColumnDragFrame(cell.column.id);
1725
+ const isColumnDragging = columnDrag?.isDragging ?? false;
1726
+ if (isReorder) {
1727
+ return /* @__PURE__ */ jsx18(
1728
+ "td",
1729
+ {
1730
+ style: {
1731
+ ...getPinnedStyles(cell.column, false, { hideShadow: true }),
1732
+ transform: CSS.Translate.toString(columnDrag?.transform ?? null),
1733
+ transition: columnDrag?.transition
1734
+ },
1735
+ className: "w-6 px-0 py-3 align-middle bg-card",
1736
+ children: /* @__PURE__ */ jsx18(
1737
+ "button",
1738
+ {
1739
+ type: "button",
1740
+ className: cn(
1741
+ "mx-auto flex size-6 cursor-grab items-center justify-center rounded-md text-muted-foreground transition-opacity hover:bg-muted hover:text-foreground active:cursor-grabbing",
1742
+ isRowDragging ? "opacity-100" : "opacity-0 group-hover/row:opacity-100"
1743
+ ),
1744
+ "aria-label": "Reorder row",
1745
+ ...dragHandleProps,
1746
+ children: /* @__PURE__ */ jsx18(GripVertical, { className: "size-3.5" })
1747
+ }
1748
+ )
1749
+ }
1750
+ );
1751
+ }
1752
+ return /* @__PURE__ */ jsx18(
1753
+ "td",
1754
+ {
1755
+ style: {
1756
+ width: cell.column.getSize(),
1757
+ ...getPinnedStyles(cell.column, false, { hideShadow: isUtility }),
1758
+ transform: CSS.Translate.toString(columnDrag?.transform ?? null),
1759
+ transition: columnDrag?.transition,
1760
+ opacity: isColumnDragging ? 0.92 : void 0,
1761
+ zIndex: isColumnDragging ? 20 : void 0,
1762
+ position: isColumnDragging ? "relative" : void 0,
1763
+ boxShadow: isColumnDragging ? "0 10px 28px -10px hsl(var(--foreground) / 0.2)" : void 0,
1764
+ backgroundColor: isColumnDragging ? "hsl(var(--card))" : void 0
1765
+ },
1766
+ className: cn(
1767
+ "align-middle text-sm text-foreground",
1768
+ isSelect ? "w-9 bg-card px-1.5 py-3" : "px-3 py-3",
1769
+ alignClass[meta?.align ?? "left"],
1770
+ meta?.className,
1771
+ pinned && !isUtility && "bg-card shadow-[1px_0_0_0_hsl(var(--border))]",
1772
+ pinned === "end" && !isUtility && "shadow-[-1px_0_0_0_hsl(var(--border))]"
1773
+ ),
1774
+ children: flexRender(cell.column.columnDef.cell, cell.getContext())
1775
+ }
1776
+ );
1777
+ }
1778
+ function SortableBodyRow({
1779
+ row,
1780
+ enableRowOrdering,
1781
+ animateRows
1782
+ }) {
1783
+ const {
1784
+ attributes,
1785
+ listeners,
1786
+ setNodeRef,
1787
+ transform,
1788
+ transition,
1789
+ isDragging
1790
+ } = useSortable({
1791
+ id: row.id,
1792
+ disabled: !enableRowOrdering,
1793
+ animateLayoutChanges: rowAnimateLayoutChanges,
1794
+ transition: ROW_SORT_TRANSITION
1795
+ });
1796
+ const dragHandleProps = enableRowOrdering ? { ...attributes, ...listeners } : void 0;
1797
+ const isSortingTransform = !!transform && (transform.x !== 0 || transform.y !== 0 || isDragging);
1798
+ const rowStyle = {
1799
+ position: "relative",
1800
+ zIndex: isDragging ? 20 : 0,
1801
+ boxShadow: isDragging ? "0 10px 28px -10px hsl(var(--foreground) / 0.2)" : void 0,
1802
+ backgroundColor: isDragging ? "hsl(var(--card))" : void 0,
1803
+ // Only apply dnd-kit's CSS transition while actively sorting — otherwise it
1804
+ // overrides Motion's entrance tween and the stagger reads as fade-down.
1805
+ ...enableRowOrdering && isSortingTransform ? { transition } : {},
1806
+ ...isDragging ? { opacity: 0.92 } : {},
1807
+ ...!animateRows ? { transform: CSS.Transform.toString(transform) } : {}
1808
+ };
1809
+ const rowClassName = cn(
1810
+ "group/row border-b border-border last:border-0",
1811
+ !enableRowOrdering && "transition-colors",
1812
+ !isDragging && "hover:bg-muted/40",
1813
+ row.getIsSelected() && "bg-muted/50"
1814
+ );
1815
+ const cells = row.getVisibleCells().map((cell) => /* @__PURE__ */ jsx18(
1816
+ BodyCell,
1817
+ {
1818
+ cell,
1819
+ isDragging,
1820
+ dragHandleProps: cell.column.id === REORDER_COL_ID ? dragHandleProps : void 0
1821
+ },
1822
+ cell.id
1823
+ ));
1824
+ if (!animateRows) {
1825
+ return /* @__PURE__ */ jsx18(
1826
+ "tr",
1827
+ {
1828
+ ref: setNodeRef,
1829
+ style: rowStyle,
1830
+ className: rowClassName,
1831
+ "data-state": row.getIsSelected() ? "selected" : void 0,
1832
+ children: cells
1833
+ }
1834
+ );
1835
+ }
1836
+ return /* @__PURE__ */ jsx18(
1837
+ motion10.tr,
1838
+ {
1839
+ ref: setNodeRef,
1840
+ variants: fadeUp,
1841
+ style: rowStyle,
1842
+ className: rowClassName,
1843
+ "data-state": row.getIsSelected() ? "selected" : void 0,
1844
+ transformTemplate: enableRowOrdering ? (_props, generated) => {
1845
+ const dnd = CSS.Transform.toString(transform);
1846
+ return dnd ? `${generated} ${dnd}` : generated;
1847
+ } : void 0,
1848
+ children: cells
1849
+ }
1850
+ );
1851
+ }
1852
+ function InfiniteSentinel({
1853
+ hasMore,
1854
+ isLoading,
1855
+ onLoadMore,
1856
+ rootMargin = "200px"
1857
+ }) {
1858
+ const ref = React17.useRef(null);
1859
+ React17.useEffect(() => {
1860
+ const node = ref.current;
1861
+ if (!node || !hasMore) return;
1862
+ const observer = new IntersectionObserver(
1863
+ (entries) => {
1864
+ if (entries[0]?.isIntersecting && !isLoading) onLoadMore();
1865
+ },
1866
+ { rootMargin }
1867
+ );
1868
+ observer.observe(node);
1869
+ return () => observer.disconnect();
1870
+ }, [hasMore, isLoading, onLoadMore, rootMargin]);
1871
+ if (!hasMore && !isLoading) return null;
1872
+ return /* @__PURE__ */ jsx18("div", { ref, className: "flex items-center justify-center gap-2 py-4 text-sm text-muted-foreground", children: isLoading ? /* @__PURE__ */ jsxs14(Fragment, { children: [
1873
+ /* @__PURE__ */ jsx18(Spinner, { size: "sm" }),
1874
+ "Loading more\u2026"
1875
+ ] }) : "Scroll to load more" });
1876
+ }
1877
+ function DataTable({
1878
+ columns: columns2,
1879
+ data,
1880
+ getRowId,
1881
+ enableSorting = true,
1882
+ sorting: sortingProp,
1883
+ onSortingChange,
1884
+ manualSorting = false,
1885
+ enableColumnFilters = false,
1886
+ columnFilters: columnFiltersProp,
1887
+ onColumnFiltersChange,
1888
+ manualFiltering = false,
1889
+ onFilterOpenChange,
1890
+ onFilterApply,
1891
+ onFilterClear,
1892
+ enableGlobalFilter = false,
1893
+ globalFilter: globalFilterProp,
1894
+ onGlobalFilterChange,
1895
+ globalFilterPlaceholder = "Search\u2026",
1896
+ enableRowSelection = false,
1897
+ enableMultiRowSelection = true,
1898
+ rowSelection: rowSelectionProp,
1899
+ onRowSelectionChange,
1900
+ enableColumnOrdering = false,
1901
+ columnOrder: columnOrderProp,
1902
+ onColumnOrderChange,
1903
+ enableColumnPinning = false,
1904
+ columnPinning: columnPinningProp,
1905
+ onColumnPinningChange,
1906
+ onPinColumn,
1907
+ enableRowOrdering = false,
1908
+ onRowOrderChange,
1909
+ pagination = false,
1910
+ onPaginationChange,
1911
+ onNextPage,
1912
+ onPreviousPage,
1913
+ infinite,
1914
+ toolbar,
1915
+ emptyMessage = "No results.",
1916
+ animateRows = true,
1917
+ className,
1918
+ ...props
1919
+ }) {
1920
+ const paginationEnabled = Boolean(pagination) && !infinite;
1921
+ const paginationOptions = typeof pagination === "object" ? pagination : {};
1922
+ const columnFiltersActive = enableColumnFilters || hasAnyColumnFilter(columns2);
1923
+ const [sorting, setSorting] = React17.useState(sortingProp ?? []);
1924
+ const [columnFilters, setColumnFilters] = React17.useState(
1925
+ columnFiltersProp ?? []
1926
+ );
1927
+ const [globalFilter, setGlobalFilter] = React17.useState(globalFilterProp ?? "");
1928
+ const [rowSelection, setRowSelection] = React17.useState(
1929
+ rowSelectionProp ?? {}
1930
+ );
1931
+ const [columnPinning, setColumnPinning] = React17.useState(
1932
+ () => withPinnedUtilities(columnPinningProp ?? { start: [], end: [] }, getUtilityColumnIds({
1933
+ enableRowOrdering,
1934
+ enableRowSelection
1935
+ }))
1936
+ );
1937
+ const [paginationState, setPaginationState] = React17.useState({
1938
+ pageIndex: paginationOptions.pageIndex ?? 0,
1939
+ pageSize: paginationOptions.pageSize ?? (paginationEnabled ? 10 : Math.max(data.length, 1))
1940
+ });
1941
+ const [orderedData, setOrderedData] = React17.useState(data);
1942
+ React17.useEffect(() => {
1943
+ setOrderedData(data);
1944
+ }, [data]);
1945
+ React17.useEffect(() => {
1946
+ if (sortingProp) setSorting(sortingProp);
1947
+ }, [sortingProp]);
1948
+ React17.useEffect(() => {
1949
+ if (columnFiltersProp) setColumnFilters(columnFiltersProp);
1950
+ }, [columnFiltersProp]);
1951
+ React17.useEffect(() => {
1952
+ if (globalFilterProp !== void 0) setGlobalFilter(globalFilterProp);
1953
+ }, [globalFilterProp]);
1954
+ React17.useEffect(() => {
1955
+ if (rowSelectionProp) setRowSelection(rowSelectionProp);
1956
+ }, [rowSelectionProp]);
1957
+ React17.useEffect(() => {
1958
+ const utilityIds = getUtilityColumnIds({ enableRowOrdering, enableRowSelection });
1959
+ setColumnPinning((prev) => {
1960
+ const next = withPinnedUtilities(columnPinningProp ?? prev, utilityIds);
1961
+ if (next.start.length === prev.start.length && next.end.length === prev.end.length && next.start.every((id, i) => id === prev.start[i]) && next.end.every((id, i) => id === prev.end[i])) {
1962
+ return prev;
1963
+ }
1964
+ return next;
1965
+ });
1966
+ }, [columnPinningProp, enableRowOrdering, enableRowSelection]);
1967
+ React17.useEffect(() => {
1968
+ if (!paginationEnabled) {
1969
+ setPaginationState((prev) => {
1970
+ const pageSize = Math.max(orderedData.length, 1);
1971
+ if (prev.pageIndex === 0 && prev.pageSize === pageSize) return prev;
1972
+ return { pageIndex: 0, pageSize };
1973
+ });
1974
+ return;
1975
+ }
1976
+ setPaginationState((prev) => {
1977
+ const pageIndex2 = paginationOptions.pageIndex ?? prev.pageIndex;
1978
+ const pageSize = paginationOptions.pageSize ?? prev.pageSize;
1979
+ if (prev.pageIndex === pageIndex2 && prev.pageSize === pageSize) return prev;
1980
+ return { pageIndex: pageIndex2, pageSize };
1981
+ });
1982
+ }, [
1983
+ paginationEnabled,
1984
+ paginationOptions.pageIndex,
1985
+ paginationOptions.pageSize,
1986
+ orderedData.length
1987
+ ]);
1988
+ const utilityColumnIds = React17.useMemo(
1989
+ () => getUtilityColumnIds({ enableRowOrdering, enableRowSelection }),
1990
+ [enableRowOrdering, enableRowSelection]
1991
+ );
1992
+ const leafColumnIds = React17.useMemo(() => {
1993
+ const ids = columns2.map((c) => c.id ?? c.key);
1994
+ if (enableRowSelection) ids.unshift(SELECT_COL_ID);
1995
+ if (enableRowOrdering) ids.unshift(REORDER_COL_ID);
1996
+ return ids;
1997
+ }, [columns2, enableRowSelection, enableRowOrdering]);
1998
+ const [columnOrder, setColumnOrder] = React17.useState(
1999
+ () => withOrderedUtilities(columnOrderProp ?? leafColumnIds, utilityColumnIds)
2000
+ );
2001
+ React17.useEffect(() => {
2002
+ if (columnOrderProp) {
2003
+ setColumnOrder(withOrderedUtilities(columnOrderProp, utilityColumnIds));
2004
+ return;
2005
+ }
2006
+ setColumnOrder((prev) => {
2007
+ const next = leafColumnIds.filter((id) => prev.includes(id));
2008
+ const missing = leafColumnIds.filter((id) => !prev.includes(id));
2009
+ return withOrderedUtilities([...next, ...missing], utilityColumnIds);
2010
+ });
2011
+ }, [leafColumnIds, columnOrderProp, utilityColumnIds]);
2012
+ const tableColumns = React17.useMemo(() => {
2013
+ const defs = columns2.map(
2014
+ (col) => toColumnDef(col, {
2015
+ enableSorting,
2016
+ enableColumnFilters: columnFiltersActive,
2017
+ enablePinning: enableColumnPinning
2018
+ })
2019
+ );
2020
+ if (enableRowSelection) {
2021
+ defs.unshift({
2022
+ id: SELECT_COL_ID,
2023
+ size: 36,
2024
+ enableSorting: false,
2025
+ enablePinning: false,
2026
+ enableColumnFilter: false,
2027
+ meta: { enableOrdering: false },
2028
+ header: ({ table: table2 }) => /* @__PURE__ */ jsx18(
2029
+ Checkbox,
2030
+ {
2031
+ checked: table2.getIsAllPageRowsSelected() ? true : table2.getIsSomePageRowsSelected() ? "indeterminate" : false,
2032
+ onCheckedChange: (value) => table2.toggleAllPageRowsSelected(!!value),
2033
+ "aria-label": "Select all"
2034
+ }
2035
+ ),
2036
+ cell: ({ row }) => /* @__PURE__ */ jsx18(
2037
+ Checkbox,
2038
+ {
2039
+ checked: row.getIsSelected(),
2040
+ disabled: !row.getCanSelect(),
2041
+ onCheckedChange: (value) => row.toggleSelected(!!value),
2042
+ "aria-label": "Select row"
2043
+ }
2044
+ )
2045
+ });
2046
+ }
2047
+ if (enableRowOrdering) {
2048
+ defs.unshift({
2049
+ id: REORDER_COL_ID,
2050
+ size: 24,
2051
+ enableSorting: false,
2052
+ enablePinning: false,
2053
+ enableColumnFilter: false,
2054
+ header: () => /* @__PURE__ */ jsx18("span", { className: "sr-only", children: "Reorder" }),
2055
+ cell: () => null,
2056
+ meta: { enableOrdering: false }
2057
+ });
2058
+ }
2059
+ return defs;
2060
+ }, [columns2, enableSorting, columnFiltersActive, enableColumnPinning, enableRowSelection, enableRowOrdering]);
2061
+ const handleSortingChange = (updater) => {
2062
+ setSorting((old) => {
2063
+ const next = typeof updater === "function" ? updater(old) : updater;
2064
+ onSortingChange?.(next);
2065
+ return next;
2066
+ });
2067
+ };
2068
+ const handleColumnFiltersChange = (updater) => {
2069
+ setColumnFilters((old) => {
2070
+ const next = typeof updater === "function" ? updater(old) : updater;
2071
+ const cleaned = next.filter((f) => normalizeFilterValue(f.value) !== void 0);
2072
+ onColumnFiltersChange?.(cleaned);
2073
+ return cleaned;
2074
+ });
2075
+ };
2076
+ const handleGlobalFilterChange = (value) => {
2077
+ const next = value.trim() === "" ? "" : value;
2078
+ setGlobalFilter(next);
2079
+ onGlobalFilterChange?.(next);
2080
+ };
2081
+ const handleRowSelectionChange = (updater) => {
2082
+ setRowSelection((old) => {
2083
+ const next = typeof updater === "function" ? updater(old) : updater;
2084
+ onRowSelectionChange?.(next);
2085
+ return next;
2086
+ });
2087
+ };
2088
+ const handleColumnOrderChange = (updater) => {
2089
+ setColumnOrder((old) => {
2090
+ const next = typeof updater === "function" ? updater(old) : updater;
2091
+ const locked = withOrderedUtilities(next, utilityColumnIds);
2092
+ onColumnOrderChange?.(locked);
2093
+ return locked;
2094
+ });
2095
+ };
2096
+ const handleColumnPinningChange = (updater) => {
2097
+ setColumnPinning((old) => {
2098
+ const next = typeof updater === "function" ? updater(old) : updater;
2099
+ const locked = withPinnedUtilities(next, utilityColumnIds);
2100
+ onColumnPinningChange?.(locked);
2101
+ return locked;
2102
+ });
2103
+ };
2104
+ const handlePaginationChange = (updater) => {
2105
+ setPaginationState((old) => {
2106
+ const next = typeof updater === "function" ? updater(old) : updater;
2107
+ onPaginationChange?.(next);
2108
+ paginationOptions.onPageChange?.(next.pageIndex);
2109
+ if (next.pageSize !== old.pageSize) {
2110
+ paginationOptions.onPageSizeChange?.(next.pageSize);
2111
+ }
2112
+ return next;
2113
+ });
2114
+ };
2115
+ const table = useTable({
2116
+ features: dataTableFeatures,
2117
+ data: orderedData,
2118
+ columns: tableColumns,
2119
+ getRowId: getRowId ? (row, index) => String(getRowId(row, index)) : void 0,
2120
+ enableSorting,
2121
+ enableMultiRowSelection,
2122
+ enableRowSelection,
2123
+ enableColumnPinning,
2124
+ enableColumnFilters: columnFiltersActive,
2125
+ enableGlobalFilter,
2126
+ manualSorting,
2127
+ manualFiltering,
2128
+ manualPagination: paginationOptions.manualPagination,
2129
+ pageCount: paginationOptions.pageCount,
2130
+ rowCount: paginationOptions.rowCount,
2131
+ autoResetPageIndex: true,
2132
+ state: {
2133
+ sorting,
2134
+ columnFilters,
2135
+ globalFilter,
2136
+ rowSelection,
2137
+ columnOrder,
2138
+ columnPinning,
2139
+ pagination: paginationState
2140
+ },
2141
+ onSortingChange: handleSortingChange,
2142
+ onColumnFiltersChange: handleColumnFiltersChange,
2143
+ onGlobalFilterChange: handleGlobalFilterChange,
2144
+ onRowSelectionChange: handleRowSelectionChange,
2145
+ onColumnOrderChange: handleColumnOrderChange,
2146
+ onColumnPinningChange: handleColumnPinningChange,
2147
+ onPaginationChange: handlePaginationChange
2148
+ });
2149
+ const sensors = useSensors(
2150
+ useSensor(MouseSensor, { activationConstraint: { distance: 6 } }),
2151
+ useSensor(TouchSensor, { activationConstraint: { delay: 150, tolerance: 5 } }),
2152
+ useSensor(KeyboardSensor)
2153
+ );
2154
+ const handleDragEnd = (event) => {
2155
+ const { active, over } = event;
2156
+ if (!over || active.id === over.id) return;
2157
+ const activeId = String(active.id);
2158
+ const overId = String(over.id);
2159
+ const isColumnDrag = leafColumnIds.includes(activeId) && leafColumnIds.includes(overId);
2160
+ if (isColumnDrag && enableColumnOrdering) {
2161
+ if (utilityColumnIds.includes(activeId) || utilityColumnIds.includes(overId)) {
2162
+ return;
2163
+ }
2164
+ handleColumnOrderChange((order) => {
2165
+ const oldIndex = order.indexOf(activeId);
2166
+ const newIndex = order.indexOf(overId);
2167
+ if (oldIndex < 0 || newIndex < 0) return order;
2168
+ return arrayMove(order, oldIndex, newIndex);
2169
+ });
2170
+ return;
2171
+ }
2172
+ if (enableRowOrdering) {
2173
+ setOrderedData((rows2) => {
2174
+ const ids = rows2.map(
2175
+ (row, index) => getRowId ? String(getRowId(row, index)) : String(index)
2176
+ );
2177
+ const oldIndex = ids.indexOf(activeId);
2178
+ const newIndex = ids.indexOf(overId);
2179
+ if (oldIndex < 0 || newIndex < 0) return rows2;
2180
+ const next = arrayMove(rows2, oldIndex, newIndex);
2181
+ onRowOrderChange?.(next);
2182
+ return next;
2183
+ });
2184
+ }
2185
+ };
2186
+ const rows = table.getRowModel().rows;
2187
+ const selectedCount = Object.keys(table.state.rowSelection).filter(
2188
+ (id) => table.state.rowSelection[id]
2189
+ ).length;
2190
+ const pageCount = Math.max(table.getPageCount(), 1);
2191
+ const pageIndex = table.state.pagination.pageIndex;
2192
+ const headerGroups = table.getHeaderGroups();
2193
+ const sortableColumnIds = table.getAllLeafColumns().map((c) => c.id);
2194
+ const sortableRowIds = rows.map((r) => r.id);
2195
+ const bodyMotionKey = `${paginationState.pageIndex}:${JSON.stringify(columnFilters)}:${globalFilter}`;
2196
+ const Body = animateRows ? motion10.tbody : "tbody";
2197
+ const bodyMotionProps = animateRows ? {
2198
+ variants: staggerContainer(0.04),
2199
+ initial: "hidden",
2200
+ animate: "visible"
2201
+ } : {};
2202
+ return /* @__PURE__ */ jsxs14("div", { className: cn("flex w-full flex-col gap-3", className), ...props, children: [
2203
+ (enableGlobalFilter || toolbar) && /* @__PURE__ */ jsxs14("div", { className: "flex flex-wrap items-center gap-3", children: [
2204
+ enableGlobalFilter ? /* @__PURE__ */ jsxs14("div", { className: "relative min-w-[12rem] flex-1", children: [
2205
+ /* @__PURE__ */ jsx18(Search, { className: "pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-muted-foreground" }),
2206
+ /* @__PURE__ */ jsx18(
2207
+ Input,
2208
+ {
2209
+ value: globalFilter,
2210
+ onChange: (e) => handleGlobalFilterChange(e.target.value),
2211
+ placeholder: globalFilterPlaceholder,
2212
+ className: "pl-9"
2213
+ }
2214
+ )
2215
+ ] }) : null,
2216
+ typeof toolbar === "function" ? toolbar({ selectedCount }) : toolbar,
2217
+ enableRowSelection && selectedCount > 0 ? /* @__PURE__ */ jsxs14("span", { className: "text-sm text-muted-foreground", children: [
2218
+ selectedCount,
2219
+ " selected"
2220
+ ] }) : null
2221
+ ] }),
2222
+ /* @__PURE__ */ jsx18(
2223
+ DndContext,
2224
+ {
2225
+ sensors,
2226
+ collisionDetection: closestCenter,
2227
+ measuring: { droppable: { strategy: MeasuringStrategy.Always } },
2228
+ onDragEnd: handleDragEnd,
2229
+ children: /* @__PURE__ */ jsx18(ColumnDragBridgeProvider, { children: /* @__PURE__ */ jsxs14("div", { className: "w-full overflow-x-auto rounded-xl border border-border bg-card", children: [
2230
+ /* @__PURE__ */ jsxs14("table", { className: "w-full min-w-[36rem] border-collapse text-sm", children: [
2231
+ /* @__PURE__ */ jsx18("thead", { children: headerGroups.map((headerGroup) => /* @__PURE__ */ jsx18("tr", { children: /* @__PURE__ */ jsx18(
2232
+ SortableContext,
2233
+ {
2234
+ items: sortableColumnIds,
2235
+ strategy: horizontalListSortingStrategy,
2236
+ children: headerGroup.headers.map((header) => {
2237
+ if (header.isPlaceholder) {
2238
+ return /* @__PURE__ */ jsx18("th", { colSpan: header.colSpan, className: "p-0" }, header.id);
2239
+ }
2240
+ const canSort = header.column.getCanSort();
2241
+ const sorted = header.column.getIsSorted();
2242
+ return /* @__PURE__ */ jsx18(
2243
+ SortableHeaderCell,
2244
+ {
2245
+ header,
2246
+ enableOrdering: enableColumnOrdering,
2247
+ enablePinning: enableColumnPinning,
2248
+ onFilterOpenChange,
2249
+ onFilterApply,
2250
+ onFilterClear,
2251
+ onPinColumn,
2252
+ children: header.column.id === SELECT_COL_ID || header.column.id === REORDER_COL_ID ? flexRender(header.column.columnDef.header, header.getContext()) : /* @__PURE__ */ jsxs14(
2253
+ "button",
2254
+ {
2255
+ type: "button",
2256
+ className: cn(
2257
+ "inline-flex max-w-full items-center gap-1.5 rounded-md text-left transition-colors",
2258
+ canSort && "hover:text-foreground"
2259
+ ),
2260
+ onClick: canSort ? header.column.getToggleSortingHandler() : void 0,
2261
+ disabled: !canSort,
2262
+ children: [
2263
+ /* @__PURE__ */ jsx18("span", { className: "truncate", children: flexRender(header.column.columnDef.header, header.getContext()) }),
2264
+ canSort ? sorted === "asc" ? /* @__PURE__ */ jsx18(ArrowUp, { className: "size-3.5 shrink-0" }) : sorted === "desc" ? /* @__PURE__ */ jsx18(ArrowDown, { className: "size-3.5 shrink-0" }) : /* @__PURE__ */ jsx18(ArrowUpDown, { className: "size-3.5 shrink-0 opacity-40" }) : null
2265
+ ]
2266
+ }
2267
+ )
2268
+ },
2269
+ header.id
2270
+ );
2271
+ })
2272
+ }
2273
+ ) }, headerGroup.id)) }),
2274
+ /* @__PURE__ */ jsx18(SortableContext, { items: sortableRowIds, strategy: verticalListSortingStrategy, children: /* @__PURE__ */ jsx18(Body, { ...bodyMotionProps, children: rows.length === 0 ? /* @__PURE__ */ jsx18("tr", { children: /* @__PURE__ */ jsx18(
2275
+ "td",
2276
+ {
2277
+ colSpan: Math.max(table.getAllLeafColumns().length, 1),
2278
+ className: "px-4 py-10 text-center text-sm text-muted-foreground",
2279
+ children: emptyMessage
2280
+ }
2281
+ ) }) : rows.map((row) => /* @__PURE__ */ jsx18(
2282
+ SortableBodyRow,
2283
+ {
2284
+ row,
2285
+ enableRowOrdering,
2286
+ animateRows
2287
+ },
2288
+ row.id
2289
+ )) }, bodyMotionKey) })
2290
+ ] }),
2291
+ infinite ? /* @__PURE__ */ jsx18(InfiniteSentinel, { ...infinite }) : null
2292
+ ] }) })
2293
+ }
2294
+ ),
2295
+ paginationEnabled ? /* @__PURE__ */ jsxs14("div", { className: "flex flex-wrap items-center justify-between gap-3", children: [
2296
+ /* @__PURE__ */ jsxs14("p", { className: "text-sm text-muted-foreground", children: [
2297
+ "Page ",
2298
+ pageIndex + 1,
2299
+ " of ",
2300
+ pageCount,
2301
+ enableRowSelection && selectedCount > 0 ? ` \xB7 ${selectedCount} selected` : null
2302
+ ] }),
2303
+ /* @__PURE__ */ jsxs14("div", { className: "flex items-center gap-3", children: [
2304
+ paginationOptions.pageSizeOptions?.length ? /* @__PURE__ */ jsxs14("label", { className: "flex items-center gap-2 text-sm text-muted-foreground", children: [
2305
+ "Rows",
2306
+ /* @__PURE__ */ jsx18(
2307
+ "select",
2308
+ {
2309
+ className: "h-9 rounded-lg border border-input bg-card px-2 text-sm text-foreground shadow-xs",
2310
+ value: table.state.pagination.pageSize,
2311
+ onChange: (e) => table.setPageSize(Number(e.target.value)),
2312
+ children: paginationOptions.pageSizeOptions.map((size) => /* @__PURE__ */ jsx18("option", { value: size, children: size }, size))
2313
+ }
2314
+ )
2315
+ ] }) : null,
2316
+ /* @__PURE__ */ jsx18(
2317
+ Pagination,
2318
+ {
2319
+ page: pageIndex + 1,
2320
+ total: pageCount,
2321
+ onPageChange: (page) => {
2322
+ const nextIndex = page - 1;
2323
+ const current = table.state.pagination.pageIndex;
2324
+ table.setPageIndex(nextIndex);
2325
+ if (nextIndex > current) onNextPage?.(nextIndex);
2326
+ if (nextIndex < current) onPreviousPage?.(nextIndex);
2327
+ }
2328
+ }
2329
+ )
2330
+ ] })
2331
+ ] }) : null
2332
+ ] });
2333
+ }
2334
+
2335
+ // src/components/application/dashboard-showcase.tsx
2336
+ import { jsx as jsx19, jsxs as jsxs15 } from "react/jsx-runtime";
2337
+ var deals = [
2338
+ { name: "Arif Billah", handle: "@arifbillah", status: "Complete", amount: "$4,570", date: "Jul 21" },
2339
+ { name: "Sarah Kim", handle: "@sarahk", status: "In process", amount: "$2,300", date: "Jul 20" },
2340
+ { name: "David Chen", handle: "@dchen", status: "Complete", amount: "$8,120", date: "Jul 19" },
2341
+ { name: "Liam Patel", handle: "@liamp", status: "Pending", amount: "$1,040", date: "Jul 18" }
2342
+ ];
2343
+ var statusVariant = {
2344
+ Complete: "success",
2345
+ "In process": "warning",
2346
+ Pending: "secondary"
2347
+ };
2348
+ var columns = [
2349
+ {
2350
+ key: "customer",
2351
+ header: "Customer",
2352
+ cell: (row) => /* @__PURE__ */ jsxs15("div", { className: "flex items-center gap-3", children: [
2353
+ /* @__PURE__ */ jsx19(Avatar, { className: "size-8", children: /* @__PURE__ */ jsx19(AvatarFallback, { className: "text-xs", children: row.name.split(" ").map((p) => p[0]).join("") }) }),
2354
+ /* @__PURE__ */ jsxs15("div", { className: "leading-tight", children: [
2355
+ /* @__PURE__ */ jsx19("p", { className: "font-medium text-foreground", children: row.name }),
2356
+ /* @__PURE__ */ jsx19("p", { className: "text-xs text-muted-foreground", children: row.handle })
2357
+ ] })
2358
+ ] })
2359
+ },
2360
+ {
2361
+ key: "status",
2362
+ header: "Status",
2363
+ cell: (row) => /* @__PURE__ */ jsx19(Badge, { variant: statusVariant[row.status], dot: true, children: row.status })
2364
+ },
2365
+ { key: "amount", header: "Amount", align: "right", cell: (row) => /* @__PURE__ */ jsx19("span", { className: "font-medium tabular-nums", children: row.amount }) },
2366
+ { key: "date", header: "Date", align: "right", cell: (row) => /* @__PURE__ */ jsx19("span", { className: "text-muted-foreground", children: row.date }) }
2367
+ ];
2368
+ var DashboardShowcase = React18.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx19(
2369
+ motion11.div,
2370
+ {
2371
+ ref,
2372
+ variants: fadeUp,
2373
+ initial: "hidden",
2374
+ whileInView: "visible",
2375
+ viewport: viewportOnce,
2376
+ className: cn(
2377
+ "overflow-hidden rounded-2xl border border-border bg-background shadow-lift",
2378
+ className
2379
+ ),
2380
+ ...props,
2381
+ children: /* @__PURE__ */ jsxs15("div", { className: "flex", children: [
2382
+ /* @__PURE__ */ jsx19(
2383
+ Sidebar,
2384
+ {
2385
+ className: "hidden shrink-0 lg:flex",
2386
+ defaultActiveValue: "home",
2387
+ brand: /* @__PURE__ */ jsxs15("div", { className: "flex items-center gap-2", children: [
2388
+ /* @__PURE__ */ jsx19("span", { className: "flex size-8 items-center justify-center rounded-lg bg-primary text-primary-foreground", children: /* @__PURE__ */ jsx19(TrendingUp, { className: "size-4" }) }),
2389
+ /* @__PURE__ */ jsx19("span", { className: "font-display text-base font-semibold tracking-tight", children: "SealView" })
2390
+ ] }),
2391
+ sections: [
2392
+ {
2393
+ title: "Main menu",
2394
+ items: [
2395
+ { label: "Home", icon: Home, value: "home" },
2396
+ { label: "Customers", icon: Users, value: "customers" },
2397
+ { label: "Wallet", icon: Wallet, value: "wallet" },
2398
+ { label: "Products", icon: LayoutGrid, value: "products" }
2399
+ ]
2400
+ },
2401
+ {
2402
+ title: "Other",
2403
+ items: [
2404
+ { label: "Billing", icon: CreditCard, value: "billing" },
2405
+ { label: "Settings", icon: Settings, value: "settings" }
2406
+ ]
2407
+ }
2408
+ ]
2409
+ }
2410
+ ),
2411
+ /* @__PURE__ */ jsxs15("div", { className: "min-w-0 flex-1", children: [
2412
+ /* @__PURE__ */ jsxs15("div", { className: "flex items-center justify-between gap-4 border-b border-border px-5 py-3.5", children: [
2413
+ /* @__PURE__ */ jsxs15("div", { children: [
2414
+ /* @__PURE__ */ jsx19("p", { className: "font-display text-lg font-semibold tracking-tight", children: "My Dashboard" }),
2415
+ /* @__PURE__ */ jsx19("p", { className: "text-xs text-muted-foreground", children: "Welcome back, Esther" })
2416
+ ] }),
2417
+ /* @__PURE__ */ jsxs15("div", { className: "flex items-center gap-3", children: [
2418
+ /* @__PURE__ */ jsxs15("div", { className: "hidden items-center gap-2 rounded-lg border border-border bg-muted/50 px-3 py-1.5 text-sm text-muted-foreground sm:flex", children: [
2419
+ /* @__PURE__ */ jsx19(Search2, { className: "size-4" }),
2420
+ /* @__PURE__ */ jsx19("span", { children: "Search\u2026" })
2421
+ ] }),
2422
+ /* @__PURE__ */ jsxs15("span", { className: "relative flex size-9 items-center justify-center rounded-lg border border-border text-muted-foreground", children: [
2423
+ /* @__PURE__ */ jsx19(Bell, { className: "size-4" }),
2424
+ /* @__PURE__ */ jsx19("span", { className: "absolute right-2 top-2 size-1.5 rounded-full bg-brand" })
2425
+ ] }),
2426
+ /* @__PURE__ */ jsxs15(Avatar, { className: "size-9", children: [
2427
+ /* @__PURE__ */ jsx19(
2428
+ AvatarImage,
2429
+ {
2430
+ src: "https://images.unsplash.com/photo-1438761681033-6461ffad8d80?w=96&h=96&fit=crop&crop=faces&q=80&auto=format",
2431
+ alt: "Esther H."
2432
+ }
2433
+ ),
2434
+ /* @__PURE__ */ jsx19(AvatarFallback, { children: "EH" })
2435
+ ] })
2436
+ ] })
2437
+ ] }),
2438
+ /* @__PURE__ */ jsxs15("div", { className: "space-y-5 p-5", children: [
2439
+ /* @__PURE__ */ jsxs15("div", { className: "flex items-center justify-between gap-3", children: [
2440
+ /* @__PURE__ */ jsx19("h3", { className: "text-sm font-medium text-muted-foreground", children: "Overview" }),
2441
+ /* @__PURE__ */ jsx19(
2442
+ SegmentedControl,
2443
+ {
2444
+ size: "sm",
2445
+ defaultValue: "month",
2446
+ options: [
2447
+ { label: "Week", value: "week" },
2448
+ { label: "Month", value: "month" },
2449
+ { label: "Year", value: "year" }
2450
+ ]
2451
+ }
2452
+ )
2453
+ ] }),
2454
+ /* @__PURE__ */ jsxs15(StatGrid, { columns: 3, children: [
2455
+ /* @__PURE__ */ jsx19(
2456
+ StatCard,
2457
+ {
2458
+ icon: Wallet,
2459
+ iconClassName: "bg-brand/12 text-brand",
2460
+ label: "Balance",
2461
+ prefix: "$",
2462
+ value: 24006,
2463
+ trend: 27.4,
2464
+ trendLabel: "vs last month"
2465
+ }
2466
+ ),
2467
+ /* @__PURE__ */ jsx19(
2468
+ StatCard,
2469
+ {
2470
+ icon: TrendingUp,
2471
+ iconClassName: "bg-chart-2/12 text-chart-2",
2472
+ label: "Spending",
2473
+ prefix: "$",
2474
+ value: 8240,
2475
+ trend: 10,
2476
+ trendLabel: "vs last month"
2477
+ }
2478
+ ),
2479
+ /* @__PURE__ */ jsx19(
2480
+ StatCard,
2481
+ {
2482
+ icon: CreditCard,
2483
+ iconClassName: "bg-chart-4/15 text-chart-4",
2484
+ label: "Investing",
2485
+ prefix: "$",
2486
+ value: 12480,
2487
+ trend: -4.2,
2488
+ trendLabel: "vs last month"
2489
+ }
2490
+ )
2491
+ ] }),
2492
+ /* @__PURE__ */ jsxs15("div", { className: "grid grid-cols-1 gap-5 lg:grid-cols-3", children: [
2493
+ /* @__PURE__ */ jsxs15("div", { className: "rounded-xl border border-border bg-card p-5 shadow-soft lg:col-span-2", children: [
2494
+ /* @__PURE__ */ jsxs15("div", { className: "mb-4 flex items-center justify-between", children: [
2495
+ /* @__PURE__ */ jsxs15("div", { children: [
2496
+ /* @__PURE__ */ jsx19("p", { className: "text-sm font-medium text-foreground", children: "Income vs Expense" }),
2497
+ /* @__PURE__ */ jsx19("p", { className: "text-xs text-muted-foreground", children: "Last 6 months" })
2498
+ ] }),
2499
+ /* @__PURE__ */ jsxs15("div", { className: "flex items-center gap-3 text-xs text-muted-foreground", children: [
2500
+ /* @__PURE__ */ jsxs15("span", { className: "flex items-center gap-1.5", children: [
2501
+ /* @__PURE__ */ jsx19("span", { className: "size-2 rounded-full bg-chart-1" }),
2502
+ " Income"
2503
+ ] }),
2504
+ /* @__PURE__ */ jsxs15("span", { className: "flex items-center gap-1.5", children: [
2505
+ /* @__PURE__ */ jsx19("span", { className: "size-2 rounded-full bg-chart-2" }),
2506
+ " Expense"
2507
+ ] })
2508
+ ] })
2509
+ ] }),
2510
+ /* @__PURE__ */ jsx19(
2511
+ AreaChart,
2512
+ {
2513
+ height: 220,
2514
+ index: "month",
2515
+ categories: ["Income", "Expense"],
2516
+ colors: ["--chart-1", "--chart-2"],
2517
+ valueFormat: (n) => `$${n.toLocaleString()}k`,
2518
+ data: [
2519
+ { month: "Jan", Income: 12, Expense: 8 },
2520
+ { month: "Feb", Income: 19, Expense: 11 },
2521
+ { month: "Mar", Income: 15, Expense: 9 },
2522
+ { month: "Apr", Income: 27, Expense: 14 },
2523
+ { month: "May", Income: 22, Expense: 12 },
2524
+ { month: "Jun", Income: 34, Expense: 19 }
2525
+ ]
2526
+ }
2527
+ )
2528
+ ] }),
2529
+ /* @__PURE__ */ jsxs15("div", { className: "rounded-xl border border-border bg-card p-5 shadow-soft", children: [
2530
+ /* @__PURE__ */ jsx19("p", { className: "mb-4 text-sm font-medium text-foreground", children: "Spend by category" }),
2531
+ /* @__PURE__ */ jsx19(
2532
+ DonutChart,
2533
+ {
2534
+ size: 150,
2535
+ thickness: 18,
2536
+ centerValue: "$3K",
2537
+ centerLabel: "Total",
2538
+ data: [
2539
+ { name: "Essentials", value: 45 },
2540
+ { name: "Investments", value: 25 },
2541
+ { name: "Subscriptions", value: 30 }
2542
+ ]
2543
+ }
2544
+ )
2545
+ ] })
2546
+ ] }),
2547
+ /* @__PURE__ */ jsxs15("div", { children: [
2548
+ /* @__PURE__ */ jsx19("p", { className: "mb-3 text-sm font-medium text-foreground", children: "Recent deals" }),
2549
+ /* @__PURE__ */ jsx19(DataTable, { columns, data: deals })
2550
+ ] })
2551
+ ] })
2552
+ ] })
2553
+ ] })
2554
+ }
2555
+ ));
2556
+ DashboardShowcase.displayName = "DashboardShowcase";
2557
+ export {
2558
+ DashboardShowcase
2559
+ };
2560
+ //# sourceMappingURL=dashboard-showcase.js.map