@work-rjkashyap/unified-ui 0.3.4 → 0.3.6

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 (456) hide show
  1. package/CHANGELOG.md +105 -0
  2. package/LICENSE +21 -0
  3. package/dist/components/accordion.cjs +225 -0
  4. package/dist/components/accordion.d.cts +157 -0
  5. package/dist/components/accordion.d.ts +157 -0
  6. package/dist/components/accordion.mjs +199 -0
  7. package/dist/components/alert-dialog.cjs +246 -0
  8. package/dist/components/alert-dialog.d.cts +61 -0
  9. package/dist/components/alert-dialog.d.ts +61 -0
  10. package/dist/components/alert-dialog.mjs +218 -0
  11. package/dist/components/alert.cjs +401 -0
  12. package/dist/components/alert.d.cts +217 -0
  13. package/dist/components/alert.d.ts +217 -0
  14. package/dist/components/alert.mjs +374 -0
  15. package/dist/components/aspect-ratio.cjs +45 -0
  16. package/dist/components/aspect-ratio.d.cts +10 -0
  17. package/dist/components/aspect-ratio.d.ts +10 -0
  18. package/dist/components/aspect-ratio.mjs +23 -0
  19. package/dist/components/avatar.cjs +348 -0
  20. package/dist/components/avatar.d.cts +198 -0
  21. package/dist/components/avatar.d.ts +198 -0
  22. package/dist/components/avatar.mjs +329 -0
  23. package/dist/components/badge.cjs +325 -0
  24. package/dist/components/badge.d.cts +259 -0
  25. package/dist/components/badge.d.ts +259 -0
  26. package/dist/components/badge.mjs +298 -0
  27. package/dist/components/banner.cjs +147 -0
  28. package/dist/components/banner.d.cts +31 -0
  29. package/dist/components/banner.d.ts +31 -0
  30. package/dist/components/banner.mjs +122 -0
  31. package/dist/components/breadcrumb.cjs +266 -0
  32. package/dist/components/breadcrumb.d.cts +159 -0
  33. package/dist/components/breadcrumb.d.ts +159 -0
  34. package/dist/components/breadcrumb.mjs +235 -0
  35. package/dist/components/button.cjs +254 -0
  36. package/dist/components/button.d.cts +126 -0
  37. package/dist/components/button.d.ts +126 -0
  38. package/dist/components/button.mjs +229 -0
  39. package/dist/components/calendar.cjs +511 -0
  40. package/dist/components/calendar.d.cts +94 -0
  41. package/dist/components/calendar.d.ts +94 -0
  42. package/dist/components/calendar.mjs +492 -0
  43. package/dist/components/card.cjs +234 -0
  44. package/dist/components/card.d.cts +190 -0
  45. package/dist/components/card.d.ts +190 -0
  46. package/dist/components/card.mjs +210 -0
  47. package/dist/components/carousel.cjs +234 -0
  48. package/dist/components/carousel.d.cts +30 -0
  49. package/dist/components/carousel.d.ts +30 -0
  50. package/dist/components/carousel.mjs +217 -0
  51. package/dist/components/chart.cjs +122 -0
  52. package/dist/components/chart.d.cts +103 -0
  53. package/dist/components/chart.d.ts +103 -0
  54. package/dist/components/chart.mjs +96 -0
  55. package/dist/components/checkbox.cjs +318 -0
  56. package/dist/components/checkbox.d.cts +182 -0
  57. package/dist/components/checkbox.d.ts +182 -0
  58. package/dist/components/checkbox.mjs +296 -0
  59. package/dist/components/code-highlight.cjs +335 -0
  60. package/dist/components/code-highlight.d.cts +18 -0
  61. package/dist/components/code-highlight.d.ts +18 -0
  62. package/dist/components/code-highlight.mjs +308 -0
  63. package/dist/components/code.cjs +265 -0
  64. package/dist/components/code.d.cts +40 -0
  65. package/dist/components/code.d.ts +40 -0
  66. package/dist/components/code.mjs +243 -0
  67. package/dist/components/collapsible.cjs +143 -0
  68. package/dist/components/collapsible.d.cts +159 -0
  69. package/dist/components/collapsible.d.ts +159 -0
  70. package/dist/components/collapsible.mjs +123 -0
  71. package/dist/components/color-picker.cjs +348 -0
  72. package/dist/components/color-picker.d.cts +35 -0
  73. package/dist/components/color-picker.d.ts +35 -0
  74. package/dist/components/color-picker.mjs +331 -0
  75. package/dist/components/combobox.cjs +584 -0
  76. package/dist/components/combobox.d.cts +183 -0
  77. package/dist/components/combobox.d.ts +183 -0
  78. package/dist/components/combobox.mjs +571 -0
  79. package/dist/components/command.cjs +329 -0
  80. package/dist/components/command.d.cts +97 -0
  81. package/dist/components/command.d.ts +97 -0
  82. package/dist/components/command.mjs +311 -0
  83. package/dist/components/confirm-dialog.cjs +100 -0
  84. package/dist/components/confirm-dialog.d.cts +25 -0
  85. package/dist/components/confirm-dialog.d.ts +25 -0
  86. package/dist/components/confirm-dialog.mjs +86 -0
  87. package/dist/components/context-menu.cjs +325 -0
  88. package/dist/components/context-menu.d.cts +259 -0
  89. package/dist/components/context-menu.d.ts +259 -0
  90. package/dist/components/context-menu.mjs +290 -0
  91. package/dist/components/copy-button.cjs +203 -0
  92. package/dist/components/copy-button.d.cts +22 -0
  93. package/dist/components/copy-button.d.ts +22 -0
  94. package/dist/components/copy-button.mjs +178 -0
  95. package/dist/components/data-list.cjs +140 -0
  96. package/dist/components/data-list.d.cts +36 -0
  97. package/dist/components/data-list.d.ts +36 -0
  98. package/dist/components/data-list.mjs +113 -0
  99. package/dist/components/data-table-toolbar.cjs +338 -0
  100. package/dist/components/data-table-toolbar.d.cts +84 -0
  101. package/dist/components/data-table-toolbar.d.ts +84 -0
  102. package/dist/components/data-table-toolbar.mjs +320 -0
  103. package/dist/components/data-table.cjs +1324 -0
  104. package/dist/components/data-table.d.cts +349 -0
  105. package/dist/components/data-table.d.ts +349 -0
  106. package/dist/components/data-table.mjs +1323 -0
  107. package/dist/components/date-picker.cjs +282 -0
  108. package/dist/components/date-picker.d.cts +97 -0
  109. package/dist/components/date-picker.d.ts +97 -0
  110. package/dist/components/date-picker.mjs +258 -0
  111. package/dist/components/dialog.cjs +319 -0
  112. package/dist/components/dialog.d.cts +74 -0
  113. package/dist/components/dialog.d.ts +74 -0
  114. package/dist/components/dialog.mjs +292 -0
  115. package/dist/components/drawer.cjs +262 -0
  116. package/dist/components/drawer.d.cts +113 -0
  117. package/dist/components/drawer.d.ts +113 -0
  118. package/dist/components/drawer.mjs +230 -0
  119. package/dist/components/dropdown-menu.cjs +328 -0
  120. package/dist/components/dropdown-menu.d.cts +95 -0
  121. package/dist/components/dropdown-menu.d.ts +95 -0
  122. package/dist/components/dropdown-menu.mjs +293 -0
  123. package/dist/components/empty-state.cjs +123 -0
  124. package/dist/components/empty-state.d.cts +15 -0
  125. package/dist/components/empty-state.d.ts +15 -0
  126. package/dist/components/empty-state.mjs +99 -0
  127. package/dist/components/file-upload.cjs +442 -0
  128. package/dist/components/file-upload.d.cts +35 -0
  129. package/dist/components/file-upload.d.ts +35 -0
  130. package/dist/components/file-upload.mjs +423 -0
  131. package/dist/components/form-field.cjs +191 -0
  132. package/dist/components/form-field.d.cts +163 -0
  133. package/dist/components/form-field.d.ts +163 -0
  134. package/dist/components/form-field.mjs +167 -0
  135. package/dist/components/hover-card.cjs +99 -0
  136. package/dist/components/hover-card.d.cts +28 -0
  137. package/dist/components/hover-card.d.ts +28 -0
  138. package/dist/components/hover-card.mjs +75 -0
  139. package/dist/components/image-gallery.cjs +359 -0
  140. package/dist/components/image-gallery.d.cts +46 -0
  141. package/dist/components/image-gallery.d.ts +46 -0
  142. package/dist/components/image-gallery.mjs +340 -0
  143. package/dist/components/index.cjs +719 -0
  144. package/dist/components/index.d.cts +84 -0
  145. package/dist/components/index.d.ts +84 -0
  146. package/dist/components/index.mjs +771 -0
  147. package/dist/components/infinite-scroll.cjs +95 -0
  148. package/dist/components/infinite-scroll.d.cts +54 -0
  149. package/dist/components/infinite-scroll.d.ts +54 -0
  150. package/dist/components/infinite-scroll.mjs +71 -0
  151. package/dist/components/input-group.cjs +202 -0
  152. package/dist/components/input-group.d.cts +22 -0
  153. package/dist/components/input-group.d.ts +22 -0
  154. package/dist/components/input-group.mjs +178 -0
  155. package/dist/components/input.cjs +318 -0
  156. package/dist/components/input.d.cts +99 -0
  157. package/dist/components/input.d.ts +99 -0
  158. package/dist/components/input.mjs +296 -0
  159. package/dist/components/kbd.cjs +69 -0
  160. package/dist/components/kbd.d.cts +25 -0
  161. package/dist/components/kbd.d.ts +25 -0
  162. package/dist/components/kbd.mjs +44 -0
  163. package/dist/components/label.cjs +138 -0
  164. package/dist/components/label.d.cts +91 -0
  165. package/dist/components/label.d.ts +91 -0
  166. package/dist/components/label.mjs +113 -0
  167. package/dist/components/markdown.cjs +179 -0
  168. package/dist/components/markdown.d.cts +41 -0
  169. package/dist/components/markdown.d.ts +41 -0
  170. package/dist/components/markdown.mjs +155 -0
  171. package/dist/components/menubar.cjs +365 -0
  172. package/dist/components/menubar.d.cts +88 -0
  173. package/dist/components/menubar.d.ts +88 -0
  174. package/dist/components/menubar.mjs +329 -0
  175. package/dist/components/navigation-menu.cjs +280 -0
  176. package/dist/components/navigation-menu.d.cts +123 -0
  177. package/dist/components/navigation-menu.d.ts +123 -0
  178. package/dist/components/navigation-menu.mjs +250 -0
  179. package/dist/components/number-input.cjs +419 -0
  180. package/dist/components/number-input.d.cts +111 -0
  181. package/dist/components/number-input.d.ts +111 -0
  182. package/dist/components/number-input.mjs +400 -0
  183. package/dist/components/pagination.cjs +322 -0
  184. package/dist/components/pagination.d.cts +119 -0
  185. package/dist/components/pagination.d.ts +119 -0
  186. package/dist/components/pagination.mjs +297 -0
  187. package/dist/components/pin-input.cjs +321 -0
  188. package/dist/components/pin-input.d.cts +112 -0
  189. package/dist/components/pin-input.d.ts +112 -0
  190. package/dist/components/pin-input.mjs +303 -0
  191. package/dist/components/popover.cjs +194 -0
  192. package/dist/components/popover.d.cts +108 -0
  193. package/dist/components/popover.d.ts +108 -0
  194. package/dist/components/popover.mjs +168 -0
  195. package/dist/components/progress.cjs +237 -0
  196. package/dist/components/progress.d.cts +137 -0
  197. package/dist/components/progress.d.ts +137 -0
  198. package/dist/components/progress.mjs +211 -0
  199. package/dist/components/radio.cjs +344 -0
  200. package/dist/components/radio.d.cts +145 -0
  201. package/dist/components/radio.d.ts +145 -0
  202. package/dist/components/radio.mjs +320 -0
  203. package/dist/components/resizable.cjs +121 -0
  204. package/dist/components/resizable.d.cts +23 -0
  205. package/dist/components/resizable.d.ts +23 -0
  206. package/dist/components/resizable.mjs +99 -0
  207. package/dist/components/scroll-area.cjs +168 -0
  208. package/dist/components/scroll-area.d.cts +131 -0
  209. package/dist/components/scroll-area.d.ts +131 -0
  210. package/dist/components/scroll-area.mjs +143 -0
  211. package/dist/components/search-input.cjs +261 -0
  212. package/dist/components/search-input.d.cts +26 -0
  213. package/dist/components/search-input.d.ts +26 -0
  214. package/dist/components/search-input.mjs +243 -0
  215. package/dist/components/select.cjs +320 -0
  216. package/dist/components/select.d.cts +55 -0
  217. package/dist/components/select.d.ts +55 -0
  218. package/dist/components/select.mjs +288 -0
  219. package/dist/components/separator.cjs +193 -0
  220. package/dist/components/separator.d.cts +92 -0
  221. package/dist/components/separator.d.ts +92 -0
  222. package/dist/components/separator.mjs +170 -0
  223. package/dist/components/sheet.cjs +399 -0
  224. package/dist/components/sheet.d.cts +219 -0
  225. package/dist/components/sheet.d.ts +219 -0
  226. package/dist/components/sheet.mjs +379 -0
  227. package/dist/components/sidebar.cjs +1077 -0
  228. package/dist/components/sidebar.d.cts +733 -0
  229. package/dist/components/sidebar.d.ts +733 -0
  230. package/dist/components/sidebar.mjs +1033 -0
  231. package/dist/components/skeleton.cjs +210 -0
  232. package/dist/components/skeleton.d.cts +202 -0
  233. package/dist/components/skeleton.d.ts +202 -0
  234. package/dist/components/skeleton.mjs +182 -0
  235. package/dist/components/slider.cjs +319 -0
  236. package/dist/components/slider.d.cts +82 -0
  237. package/dist/components/slider.d.ts +82 -0
  238. package/dist/components/slider.mjs +296 -0
  239. package/dist/components/sonner.cjs +119 -0
  240. package/dist/components/sonner.d.cts +60 -0
  241. package/dist/components/sonner.d.ts +60 -0
  242. package/dist/components/sonner.mjs +94 -0
  243. package/dist/components/spinner.cjs +238 -0
  244. package/dist/components/spinner.d.cts +101 -0
  245. package/dist/components/spinner.d.ts +101 -0
  246. package/dist/components/spinner.mjs +213 -0
  247. package/dist/components/stat.cjs +180 -0
  248. package/dist/components/stat.d.cts +21 -0
  249. package/dist/components/stat.d.ts +21 -0
  250. package/dist/components/stat.mjs +161 -0
  251. package/dist/components/steps.cjs +228 -0
  252. package/dist/components/steps.d.cts +76 -0
  253. package/dist/components/steps.d.ts +76 -0
  254. package/dist/components/steps.mjs +207 -0
  255. package/dist/components/switch.cjs +243 -0
  256. package/dist/components/switch.d.cts +90 -0
  257. package/dist/components/switch.d.ts +90 -0
  258. package/dist/components/switch.mjs +228 -0
  259. package/dist/components/table.cjs +381 -0
  260. package/dist/components/table.d.cts +181 -0
  261. package/dist/components/table.d.ts +181 -0
  262. package/dist/components/table.mjs +349 -0
  263. package/dist/components/tabs.cjs +326 -0
  264. package/dist/components/tabs.d.cts +154 -0
  265. package/dist/components/tabs.d.ts +154 -0
  266. package/dist/components/tabs.mjs +304 -0
  267. package/dist/components/textarea.cjs +258 -0
  268. package/dist/components/textarea.d.cts +112 -0
  269. package/dist/components/textarea.d.ts +112 -0
  270. package/dist/components/textarea.mjs +233 -0
  271. package/dist/components/theme-toggle.cjs +282 -0
  272. package/dist/components/theme-toggle.d.cts +58 -0
  273. package/dist/components/theme-toggle.d.ts +58 -0
  274. package/dist/components/theme-toggle.mjs +258 -0
  275. package/dist/components/timeline.cjs +178 -0
  276. package/dist/components/timeline.d.cts +41 -0
  277. package/dist/components/timeline.d.ts +41 -0
  278. package/dist/components/timeline.mjs +157 -0
  279. package/dist/components/toast.cjs +546 -0
  280. package/dist/components/toast.d.cts +169 -0
  281. package/dist/components/toast.d.ts +169 -0
  282. package/dist/components/toast.mjs +528 -0
  283. package/dist/components/toggle-group.cjs +204 -0
  284. package/dist/components/toggle-group.d.cts +215 -0
  285. package/dist/components/toggle-group.d.ts +215 -0
  286. package/dist/components/toggle-group.mjs +180 -0
  287. package/dist/components/toggle.cjs +155 -0
  288. package/dist/components/toggle.d.cts +100 -0
  289. package/dist/components/toggle.d.ts +100 -0
  290. package/dist/components/toggle.mjs +130 -0
  291. package/dist/components/tooltip.cjs +155 -0
  292. package/dist/components/tooltip.d.cts +129 -0
  293. package/dist/components/tooltip.d.ts +129 -0
  294. package/dist/components/tooltip.mjs +132 -0
  295. package/dist/components/tree-view.cjs +450 -0
  296. package/dist/components/tree-view.d.cts +67 -0
  297. package/dist/components/tree-view.d.ts +67 -0
  298. package/dist/components/tree-view.mjs +433 -0
  299. package/dist/components/video-player.cjs +344 -0
  300. package/dist/components/video-player.d.cts +34 -0
  301. package/dist/components/video-player.d.ts +34 -0
  302. package/dist/components/video-player.mjs +320 -0
  303. package/dist/components/virtual-list.cjs +153 -0
  304. package/dist/components/virtual-list.d.cts +53 -0
  305. package/dist/components/virtual-list.d.ts +53 -0
  306. package/dist/components/virtual-list.mjs +136 -0
  307. package/dist/components/visually-hidden.cjs +43 -0
  308. package/dist/components/visually-hidden.d.cts +9 -0
  309. package/dist/components/visually-hidden.d.ts +9 -0
  310. package/dist/components/visually-hidden.mjs +21 -0
  311. package/dist/index.cjs +1081 -1957
  312. package/dist/index.d.cts +99 -11
  313. package/dist/index.d.ts +99 -11
  314. package/dist/index.mjs +1138 -16
  315. package/dist/motion/hooks.cjs +98 -0
  316. package/dist/motion/hooks.d.cts +32 -0
  317. package/dist/motion/hooks.d.ts +32 -0
  318. package/dist/motion/hooks.mjs +70 -0
  319. package/dist/motion/index.cjs +157 -0
  320. package/dist/motion/index.d.cts +5 -0
  321. package/dist/motion/index.d.ts +5 -0
  322. package/dist/motion/index.mjs +137 -0
  323. package/dist/motion/presets.cjs +609 -0
  324. package/dist/{motion.d.ts → motion/presets.d.cts} +1 -30
  325. package/dist/{motion.d.cts → motion/presets.d.ts} +1 -30
  326. package/dist/{chunk-PLRSH37T.mjs → motion/presets.mjs} +119 -126
  327. package/dist/primitives/container.cjs +88 -0
  328. package/dist/primitives/container.d.cts +82 -0
  329. package/dist/primitives/container.d.ts +82 -0
  330. package/dist/primitives/container.mjs +64 -0
  331. package/dist/primitives/divider.cjs +74 -0
  332. package/dist/primitives/divider.d.cts +30 -0
  333. package/dist/primitives/divider.d.ts +30 -0
  334. package/dist/primitives/divider.mjs +50 -0
  335. package/dist/primitives/index.cjs +54 -0
  336. package/dist/primitives/index.d.cts +6 -0
  337. package/dist/primitives/index.d.ts +6 -0
  338. package/dist/primitives/index.mjs +33 -0
  339. package/dist/primitives/stack.cjs +167 -0
  340. package/dist/primitives/stack.d.cts +132 -0
  341. package/dist/primitives/stack.d.ts +132 -0
  342. package/dist/primitives/stack.mjs +142 -0
  343. package/dist/primitives/typography.cjs +260 -0
  344. package/dist/primitives/typography.d.cts +157 -0
  345. package/dist/primitives/typography.d.ts +157 -0
  346. package/dist/primitives/typography.mjs +229 -0
  347. package/dist/theme/contract.cjs +246 -0
  348. package/dist/theme/contract.d.cts +76 -0
  349. package/dist/theme/contract.d.ts +76 -0
  350. package/dist/theme/contract.mjs +221 -0
  351. package/dist/theme/customizer-store.cjs +266 -0
  352. package/dist/theme/customizer-store.d.cts +76 -0
  353. package/dist/theme/customizer-store.d.ts +76 -0
  354. package/dist/theme/customizer-store.mjs +261 -0
  355. package/dist/theme/customizer.cjs +812 -0
  356. package/dist/theme/customizer.d.cts +13 -0
  357. package/dist/theme/customizer.d.ts +13 -0
  358. package/dist/theme/customizer.mjs +803 -0
  359. package/dist/theme/index.cjs +105 -0
  360. package/dist/theme/index.d.cts +13 -0
  361. package/dist/theme/index.d.ts +13 -0
  362. package/dist/theme/index.mjs +87 -0
  363. package/dist/theme/presets.cjs +1205 -0
  364. package/dist/theme/presets.d.cts +232 -0
  365. package/dist/theme/presets.d.ts +232 -0
  366. package/dist/theme/presets.mjs +1175 -0
  367. package/dist/theme/provider.cjs +122 -0
  368. package/dist/theme/provider.d.cts +57 -0
  369. package/dist/theme/provider.d.ts +57 -0
  370. package/dist/theme/provider.mjs +104 -0
  371. package/dist/{chunk-AAEWG5VR.mjs → tokens/colors.cjs} +94 -94
  372. package/dist/{z-index-DmLl6FUD.d.ts → tokens/colors.d.cts} +118 -72
  373. package/dist/{z-index-DmLl6FUD.d.cts → tokens/colors.d.ts} +118 -72
  374. package/dist/{chunk-6ZZZBOCH.cjs → tokens/colors.mjs} +47 -121
  375. package/dist/tokens/index.cjs +96 -0
  376. package/dist/tokens/index.d.cts +7 -0
  377. package/dist/tokens/index.d.ts +7 -0
  378. package/dist/tokens/index.mjs +71 -0
  379. package/dist/{chunk-XCKK6P46.cjs → tokens/motion.cjs} +46 -18
  380. package/dist/{motion-D9wQbcKL.d.cts → tokens/motion.d.cts} +1 -1
  381. package/dist/{motion-D9wQbcKL.d.ts → tokens/motion.d.ts} +1 -1
  382. package/dist/{chunk-EZ2L3XPS.mjs → tokens/motion.mjs} +16 -10
  383. package/dist/tokens/radius.cjs +41 -0
  384. package/dist/tokens/radius.d.cts +18 -0
  385. package/dist/tokens/radius.d.ts +18 -0
  386. package/dist/tokens/radius.mjs +17 -0
  387. package/dist/tokens/shadows.cjs +57 -0
  388. package/dist/tokens/shadows.d.cts +32 -0
  389. package/dist/tokens/shadows.d.ts +32 -0
  390. package/dist/tokens/shadows.mjs +32 -0
  391. package/dist/tokens/spacing.cjs +51 -0
  392. package/dist/tokens/spacing.d.cts +26 -0
  393. package/dist/tokens/spacing.d.ts +26 -0
  394. package/dist/{chunk-NMPHV6ZD.mjs → tokens/spacing.mjs} +4 -4
  395. package/dist/{chunk-ECIGDEAH.cjs → tokens/typography.cjs} +43 -16
  396. package/dist/{typography-DlvVjEdE.d.ts → tokens/typography.d.cts} +1 -1
  397. package/dist/{typography-DlvVjEdE.d.cts → tokens/typography.d.ts} +1 -1
  398. package/dist/{chunk-ITBG42M5.mjs → tokens/typography.mjs} +14 -9
  399. package/dist/tokens/z-index.cjs +47 -0
  400. package/dist/tokens/z-index.d.cts +24 -0
  401. package/dist/tokens/z-index.d.ts +24 -0
  402. package/dist/tokens/z-index.mjs +23 -0
  403. package/dist/utils/cn.cjs +102 -0
  404. package/dist/utils/cn.d.cts +84 -0
  405. package/dist/utils/cn.d.ts +84 -0
  406. package/dist/{chunk-ZT3PCXDF.mjs → utils/cn.mjs} +14 -7
  407. package/dist/{chunk-33QEKXRQ.cjs → utils/contrast.cjs} +68 -38
  408. package/dist/utils/contrast.d.cts +209 -0
  409. package/dist/utils/contrast.d.ts +209 -0
  410. package/dist/{chunk-5NZDQWRV.mjs → utils/contrast.mjs} +27 -18
  411. package/dist/utils/focus-ring.cjs +81 -0
  412. package/dist/utils/focus-ring.d.cts +80 -0
  413. package/dist/utils/focus-ring.d.ts +80 -0
  414. package/dist/utils/focus-ring.mjs +47 -0
  415. package/dist/utils/index.cjs +107 -0
  416. package/dist/utils/index.d.cts +6 -0
  417. package/dist/utils/index.d.ts +6 -0
  418. package/dist/utils/index.mjs +88 -0
  419. package/dist/utils/types.cjs +38 -0
  420. package/dist/utils/types.d.cts +187 -0
  421. package/dist/utils/types.d.ts +187 -0
  422. package/dist/utils/types.mjs +13 -0
  423. package/package.json +191 -191
  424. package/dist/chunk-2JFREULQ.cjs +0 -29
  425. package/dist/chunk-3EHT6IOA.cjs +0 -49
  426. package/dist/chunk-4ON3M3OM.cjs +0 -73
  427. package/dist/chunk-A2DGHQL2.cjs +0 -21808
  428. package/dist/chunk-BJ55D5IK.mjs +0 -2433
  429. package/dist/chunk-F4JJFWWU.cjs +0 -604
  430. package/dist/chunk-FUWXGHWQ.cjs +0 -468
  431. package/dist/chunk-MBYCK2JJ.mjs +0 -37
  432. package/dist/chunk-OHEH57BV.mjs +0 -455
  433. package/dist/chunk-RUG3BW2B.cjs +0 -2471
  434. package/dist/chunk-XAIUX2YS.mjs +0 -21477
  435. package/dist/components.cjs +0 -1247
  436. package/dist/components.d.cts +0 -7881
  437. package/dist/components.d.ts +0 -7881
  438. package/dist/components.mjs +0 -6
  439. package/dist/motion.cjs +0 -264
  440. package/dist/motion.mjs +0 -3
  441. package/dist/primitives.cjs +0 -57
  442. package/dist/primitives.d.cts +0 -390
  443. package/dist/primitives.d.ts +0 -390
  444. package/dist/primitives.mjs +0 -4
  445. package/dist/theme.cjs +0 -159
  446. package/dist/theme.d.cts +0 -440
  447. package/dist/theme.d.ts +0 -440
  448. package/dist/theme.mjs +0 -6
  449. package/dist/tokens.cjs +0 -137
  450. package/dist/tokens.d.cts +0 -30
  451. package/dist/tokens.d.ts +0 -30
  452. package/dist/tokens.mjs +0 -4
  453. package/dist/utils.cjs +0 -164
  454. package/dist/utils.d.cts +0 -525
  455. package/dist/utils.d.ts +0 -525
  456. package/dist/utils.mjs +0 -3
@@ -0,0 +1,1323 @@
1
+ "use client";
2
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
3
+ import {
4
+ flexRender,
5
+ getCoreRowModel,
6
+ getFacetedRowModel,
7
+ getFacetedUniqueValues,
8
+ getFilteredRowModel,
9
+ getPaginationRowModel,
10
+ getSortedRowModel,
11
+ useReactTable
12
+ } from "@tanstack/react-table";
13
+ import { cn } from "../utils/cn.mjs";
14
+ import {
15
+ forwardRef,
16
+ useCallback,
17
+ useEffect,
18
+ useMemo,
19
+ useRef,
20
+ useState
21
+ } from "react";
22
+ import {
23
+ Table,
24
+ TableBody,
25
+ TableCaption,
26
+ TableCell,
27
+ TableFooter,
28
+ TableHead,
29
+ TableHeader,
30
+ TableRow
31
+ } from "./table.mjs";
32
+ import { createColumnHelper } from "@tanstack/react-table";
33
+ function Dropdown({
34
+ trigger,
35
+ children,
36
+ align = "start"
37
+ }) {
38
+ const [open, setOpen] = useState(false);
39
+ const ref = useRef(null);
40
+ useEffect(() => {
41
+ if (!open) return;
42
+ function handleClick(e) {
43
+ if (ref.current && !ref.current.contains(e.target)) {
44
+ setOpen(false);
45
+ }
46
+ }
47
+ function handleKey(e) {
48
+ if (e.key === "Escape") setOpen(false);
49
+ }
50
+ document.addEventListener("mousedown", handleClick);
51
+ document.addEventListener("keydown", handleKey);
52
+ return () => {
53
+ document.removeEventListener("mousedown", handleClick);
54
+ document.removeEventListener("keydown", handleKey);
55
+ };
56
+ }, [open]);
57
+ return /* @__PURE__ */ jsxs("div", { ref, className: "relative", children: [
58
+ /* @__PURE__ */ jsx(
59
+ "div",
60
+ {
61
+ onClick: () => setOpen((v) => !v),
62
+ onKeyDown: (e) => {
63
+ if (e.key === "Enter" || e.key === " ") {
64
+ e.preventDefault();
65
+ setOpen((v) => !v);
66
+ }
67
+ },
68
+ children: trigger
69
+ }
70
+ ),
71
+ open && /* @__PURE__ */ jsx(
72
+ "div",
73
+ {
74
+ className: cn(
75
+ "absolute top-full z-[var(--z-dropdown)] mt-1",
76
+ align === "end" ? "right-0" : "left-0",
77
+ "min-w-[8rem] rounded-md py-1",
78
+ "border border-border bg-popover text-popover-foreground",
79
+ "shadow-md"
80
+ ),
81
+ role: "menu",
82
+ "data-ds": "",
83
+ "data-ds-component": "data-table-dropdown",
84
+ children
85
+ }
86
+ )
87
+ ] });
88
+ }
89
+ function DropdownItem({
90
+ children,
91
+ onClick,
92
+ active
93
+ }) {
94
+ return /* @__PURE__ */ jsx(
95
+ "button",
96
+ {
97
+ type: "button",
98
+ role: "menuitem",
99
+ onClick,
100
+ className: cn(
101
+ "flex w-full items-center gap-2 px-2 py-1.5 text-sm",
102
+ "cursor-pointer rounded-sm",
103
+ active ? "bg-muted text-foreground" : "text-foreground hover:bg-muted/50",
104
+ "transition-colors duration-fast"
105
+ ),
106
+ children
107
+ }
108
+ );
109
+ }
110
+ function DataTableColumnHeaderMenu({
111
+ column,
112
+ title
113
+ }) {
114
+ const isSorted = column.getIsSorted();
115
+ return /* @__PURE__ */ jsx(
116
+ Dropdown,
117
+ {
118
+ trigger: /* @__PURE__ */ jsxs(
119
+ "button",
120
+ {
121
+ type: "button",
122
+ className: cn(
123
+ "inline-flex items-center gap-1 -ml-1 px-1 py-0.5",
124
+ "cursor-pointer select-none rounded-sm",
125
+ "hover:bg-muted/50",
126
+ "transition-colors duration-fast",
127
+ "text-muted-foreground font-semibold whitespace-nowrap"
128
+ ),
129
+ children: [
130
+ title,
131
+ isSorted === "asc" ? /* @__PURE__ */ jsxs(
132
+ "svg",
133
+ {
134
+ className: "size-3.5",
135
+ viewBox: "0 0 24 24",
136
+ fill: "none",
137
+ stroke: "currentColor",
138
+ strokeWidth: "2",
139
+ strokeLinecap: "round",
140
+ strokeLinejoin: "round",
141
+ "aria-hidden": "true",
142
+ children: [
143
+ /* @__PURE__ */ jsx("path", { d: "m5 12 7-7 7 7" }),
144
+ /* @__PURE__ */ jsx("path", { d: "M12 19V5" })
145
+ ]
146
+ }
147
+ ) : isSorted === "desc" ? /* @__PURE__ */ jsxs(
148
+ "svg",
149
+ {
150
+ className: "size-3.5",
151
+ viewBox: "0 0 24 24",
152
+ fill: "none",
153
+ stroke: "currentColor",
154
+ strokeWidth: "2",
155
+ strokeLinecap: "round",
156
+ strokeLinejoin: "round",
157
+ "aria-hidden": "true",
158
+ children: [
159
+ /* @__PURE__ */ jsx("path", { d: "M12 5v14" }),
160
+ /* @__PURE__ */ jsx("path", { d: "m19 12-7 7-7-7" })
161
+ ]
162
+ }
163
+ ) : /* @__PURE__ */ jsxs(
164
+ "svg",
165
+ {
166
+ className: "size-3.5 opacity-40",
167
+ viewBox: "0 0 24 24",
168
+ fill: "none",
169
+ stroke: "currentColor",
170
+ strokeWidth: "2",
171
+ strokeLinecap: "round",
172
+ strokeLinejoin: "round",
173
+ "aria-hidden": "true",
174
+ children: [
175
+ /* @__PURE__ */ jsx("path", { d: "m7 15 5 5 5-5" }),
176
+ /* @__PURE__ */ jsx("path", { d: "m7 9 5-5 5 5" })
177
+ ]
178
+ }
179
+ )
180
+ ]
181
+ }
182
+ ),
183
+ children: /* @__PURE__ */ jsxs("div", { className: "px-1", children: [
184
+ /* @__PURE__ */ jsxs(
185
+ DropdownItem,
186
+ {
187
+ onClick: () => column.toggleSorting(false),
188
+ active: isSorted === "asc",
189
+ children: [
190
+ /* @__PURE__ */ jsxs(
191
+ "svg",
192
+ {
193
+ className: "size-3.5",
194
+ viewBox: "0 0 24 24",
195
+ fill: "none",
196
+ stroke: "currentColor",
197
+ strokeWidth: "2",
198
+ strokeLinecap: "round",
199
+ strokeLinejoin: "round",
200
+ "aria-hidden": "true",
201
+ children: [
202
+ /* @__PURE__ */ jsx("path", { d: "m5 12 7-7 7 7" }),
203
+ /* @__PURE__ */ jsx("path", { d: "M12 19V5" })
204
+ ]
205
+ }
206
+ ),
207
+ "Asc"
208
+ ]
209
+ }
210
+ ),
211
+ /* @__PURE__ */ jsxs(
212
+ DropdownItem,
213
+ {
214
+ onClick: () => column.toggleSorting(true),
215
+ active: isSorted === "desc",
216
+ children: [
217
+ /* @__PURE__ */ jsxs(
218
+ "svg",
219
+ {
220
+ className: "size-3.5",
221
+ viewBox: "0 0 24 24",
222
+ fill: "none",
223
+ stroke: "currentColor",
224
+ strokeWidth: "2",
225
+ strokeLinecap: "round",
226
+ strokeLinejoin: "round",
227
+ "aria-hidden": "true",
228
+ children: [
229
+ /* @__PURE__ */ jsx("path", { d: "M12 5v14" }),
230
+ /* @__PURE__ */ jsx("path", { d: "m19 12-7 7-7-7" })
231
+ ]
232
+ }
233
+ ),
234
+ "Desc"
235
+ ]
236
+ }
237
+ ),
238
+ column.getCanHide() && /* @__PURE__ */ jsxs(Fragment, { children: [
239
+ /* @__PURE__ */ jsx("div", { className: "my-1 h-px bg-border" }),
240
+ /* @__PURE__ */ jsxs(DropdownItem, { onClick: () => column.toggleVisibility(false), children: [
241
+ /* @__PURE__ */ jsxs(
242
+ "svg",
243
+ {
244
+ className: "size-3.5",
245
+ viewBox: "0 0 24 24",
246
+ fill: "none",
247
+ stroke: "currentColor",
248
+ strokeWidth: "2",
249
+ strokeLinecap: "round",
250
+ strokeLinejoin: "round",
251
+ "aria-hidden": "true",
252
+ children: [
253
+ /* @__PURE__ */ jsx("path", { d: "M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49" }),
254
+ /* @__PURE__ */ jsx("path", { d: "M14.084 14.158a3 3 0 0 1-4.242-4.242" }),
255
+ /* @__PURE__ */ jsx("path", { d: "M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.749 10.749 0 0 1 4.446-5.143" }),
256
+ /* @__PURE__ */ jsx("path", { d: "m2 2 20 20" })
257
+ ]
258
+ }
259
+ ),
260
+ "Hide"
261
+ ] })
262
+ ] })
263
+ ] })
264
+ }
265
+ );
266
+ }
267
+ function DataTableFacetedFilterButton({
268
+ column,
269
+ title,
270
+ icon,
271
+ options: explicitOptions
272
+ }) {
273
+ if (!column) return null;
274
+ const facets = column.getFacetedUniqueValues();
275
+ const selectedValues = new Set(column.getFilterValue() ?? []);
276
+ const options = explicitOptions ?? Array.from(facets.keys()).sort().map((value) => ({ label: String(value), value: String(value) }));
277
+ const toggleValue = (value) => {
278
+ const next = new Set(selectedValues);
279
+ if (next.has(value)) {
280
+ next.delete(value);
281
+ } else {
282
+ next.add(value);
283
+ }
284
+ const filterValue = next.size > 0 ? Array.from(next) : void 0;
285
+ column.setFilterValue(filterValue);
286
+ };
287
+ const clearFilter = () => {
288
+ column.setFilterValue(void 0);
289
+ };
290
+ return /* @__PURE__ */ jsx(
291
+ Dropdown,
292
+ {
293
+ trigger: /* @__PURE__ */ jsxs(
294
+ "button",
295
+ {
296
+ type: "button",
297
+ className: cn(
298
+ "inline-flex items-center gap-1.5 rounded-md px-3 h-8",
299
+ "text-xs font-medium text-foreground",
300
+ "border border-dashed border-border bg-background",
301
+ "hover:bg-muted/50",
302
+ "focus-visible:outline-none focus-visible:border-border-strong",
303
+ "transition-colors duration-fast"
304
+ ),
305
+ "data-ds": "",
306
+ "data-ds-component": "data-table-faceted-filter",
307
+ children: [
308
+ icon && /* @__PURE__ */ jsx("span", { className: "size-3.5", children: icon }),
309
+ title,
310
+ selectedValues.size > 0 && /* @__PURE__ */ jsxs(Fragment, { children: [
311
+ /* @__PURE__ */ jsx("span", { className: "mx-0.5 h-4 w-px bg-border" }),
312
+ /* @__PURE__ */ jsx("span", { className: "inline-flex items-center justify-center rounded-sm bg-muted px-1.5 text-[10px] font-semibold", children: selectedValues.size })
313
+ ] })
314
+ ]
315
+ }
316
+ ),
317
+ children: /* @__PURE__ */ jsxs("div", { className: "px-1 max-h-64 overflow-y-auto", children: [
318
+ options.map((option) => {
319
+ const isSelected = selectedValues.has(option.value);
320
+ const count = facets.get(option.value);
321
+ return /* @__PURE__ */ jsxs(
322
+ "label",
323
+ {
324
+ className: cn(
325
+ "flex cursor-pointer items-center gap-2 rounded-sm px-2 py-1.5",
326
+ "text-sm text-foreground",
327
+ "hover:bg-muted/50",
328
+ "transition-colors duration-fast"
329
+ ),
330
+ children: [
331
+ /* @__PURE__ */ jsx(
332
+ "input",
333
+ {
334
+ type: "checkbox",
335
+ checked: isSelected,
336
+ onChange: () => toggleValue(option.value),
337
+ className: "size-3.5 rounded-sm accent-primary"
338
+ }
339
+ ),
340
+ option.icon && /* @__PURE__ */ jsx("span", { className: "size-3.5 shrink-0", children: option.icon }),
341
+ /* @__PURE__ */ jsx("span", { className: "flex-1 truncate", children: option.label }),
342
+ count !== void 0 && /* @__PURE__ */ jsx("span", { className: "ml-auto text-xs text-muted-foreground tabular-nums", children: count })
343
+ ]
344
+ },
345
+ option.value
346
+ );
347
+ }),
348
+ selectedValues.size > 0 && /* @__PURE__ */ jsxs(Fragment, { children: [
349
+ /* @__PURE__ */ jsx("div", { className: "my-1 h-px bg-border" }),
350
+ /* @__PURE__ */ jsx(
351
+ "button",
352
+ {
353
+ type: "button",
354
+ onClick: clearFilter,
355
+ className: cn(
356
+ "w-full rounded-sm px-2 py-1.5 text-center text-sm",
357
+ "text-foreground hover:bg-muted/50",
358
+ "transition-colors duration-fast"
359
+ ),
360
+ children: "Clear filter"
361
+ }
362
+ )
363
+ ] })
364
+ ] })
365
+ }
366
+ );
367
+ }
368
+ function DataTableSortBadge({ table }) {
369
+ const sorting = table.getState().sorting;
370
+ if (sorting.length === 0) return null;
371
+ return /* @__PURE__ */ jsx(
372
+ Dropdown,
373
+ {
374
+ align: "end",
375
+ trigger: /* @__PURE__ */ jsxs(
376
+ "button",
377
+ {
378
+ type: "button",
379
+ className: cn(
380
+ "inline-flex items-center gap-1.5 rounded-md px-3 h-8",
381
+ "text-xs font-medium text-foreground",
382
+ "border border-border bg-background",
383
+ "hover:bg-muted/50",
384
+ "focus-visible:outline-none focus-visible:border-border-strong",
385
+ "transition-colors duration-fast"
386
+ ),
387
+ "data-ds": "",
388
+ "data-ds-component": "data-table-sort-badge",
389
+ children: [
390
+ /* @__PURE__ */ jsxs(
391
+ "svg",
392
+ {
393
+ className: "size-3.5",
394
+ viewBox: "0 0 24 24",
395
+ fill: "none",
396
+ stroke: "currentColor",
397
+ strokeWidth: "2",
398
+ strokeLinecap: "round",
399
+ strokeLinejoin: "round",
400
+ "aria-hidden": "true",
401
+ children: [
402
+ /* @__PURE__ */ jsx("path", { d: "m21 16-4 4-4-4" }),
403
+ /* @__PURE__ */ jsx("path", { d: "M17 20V4" }),
404
+ /* @__PURE__ */ jsx("path", { d: "m3 8 4-4 4 4" }),
405
+ /* @__PURE__ */ jsx("path", { d: "M7 4v16" })
406
+ ]
407
+ }
408
+ ),
409
+ "Sort",
410
+ /* @__PURE__ */ jsx("span", { className: "inline-flex size-4 items-center justify-center rounded-full bg-foreground text-background text-[10px] font-bold", children: sorting.length })
411
+ ]
412
+ }
413
+ ),
414
+ children: /* @__PURE__ */ jsxs("div", { className: "px-1", children: [
415
+ sorting.map((sort) => {
416
+ const col = table.getColumn(sort.id);
417
+ const label = col && typeof col.columnDef.header === "string" ? col.columnDef.header : sort.id;
418
+ return /* @__PURE__ */ jsxs(DropdownItem, { onClick: () => col?.clearSorting(), children: [
419
+ sort.desc ? /* @__PURE__ */ jsxs(
420
+ "svg",
421
+ {
422
+ className: "size-3.5",
423
+ viewBox: "0 0 24 24",
424
+ fill: "none",
425
+ stroke: "currentColor",
426
+ strokeWidth: "2",
427
+ strokeLinecap: "round",
428
+ strokeLinejoin: "round",
429
+ "aria-hidden": "true",
430
+ children: [
431
+ /* @__PURE__ */ jsx("path", { d: "M12 5v14" }),
432
+ /* @__PURE__ */ jsx("path", { d: "m19 12-7 7-7-7" })
433
+ ]
434
+ }
435
+ ) : /* @__PURE__ */ jsxs(
436
+ "svg",
437
+ {
438
+ className: "size-3.5",
439
+ viewBox: "0 0 24 24",
440
+ fill: "none",
441
+ stroke: "currentColor",
442
+ strokeWidth: "2",
443
+ strokeLinecap: "round",
444
+ strokeLinejoin: "round",
445
+ "aria-hidden": "true",
446
+ children: [
447
+ /* @__PURE__ */ jsx("path", { d: "m5 12 7-7 7 7" }),
448
+ /* @__PURE__ */ jsx("path", { d: "M12 19V5" })
449
+ ]
450
+ }
451
+ ),
452
+ /* @__PURE__ */ jsx("span", { className: "flex-1", children: label }),
453
+ /* @__PURE__ */ jsx("span", { className: "text-xs text-muted-foreground", children: sort.desc ? "desc" : "asc" })
454
+ ] }, sort.id);
455
+ }),
456
+ sorting.length > 0 && /* @__PURE__ */ jsxs(Fragment, { children: [
457
+ /* @__PURE__ */ jsx("div", { className: "my-1 h-px bg-border" }),
458
+ /* @__PURE__ */ jsx(DropdownItem, { onClick: () => table.resetSorting(), children: "Clear all sorts" })
459
+ ] })
460
+ ] })
461
+ }
462
+ );
463
+ }
464
+ function DataTableViewButton({
465
+ table
466
+ }) {
467
+ return /* @__PURE__ */ jsx(
468
+ Dropdown,
469
+ {
470
+ align: "end",
471
+ trigger: /* @__PURE__ */ jsxs(
472
+ "button",
473
+ {
474
+ type: "button",
475
+ className: cn(
476
+ "inline-flex items-center gap-1.5 rounded-md px-3 h-8",
477
+ "text-xs font-medium text-foreground",
478
+ "border border-border bg-background",
479
+ "hover:bg-muted/50",
480
+ "focus-visible:outline-none focus-visible:border-border-strong",
481
+ "transition-colors duration-fast"
482
+ ),
483
+ "data-ds": "",
484
+ "data-ds-component": "data-table-view-button",
485
+ children: [
486
+ /* @__PURE__ */ jsxs(
487
+ "svg",
488
+ {
489
+ className: "size-3.5",
490
+ viewBox: "0 0 24 24",
491
+ fill: "none",
492
+ stroke: "currentColor",
493
+ strokeWidth: "2",
494
+ strokeLinecap: "round",
495
+ strokeLinejoin: "round",
496
+ "aria-hidden": "true",
497
+ children: [
498
+ /* @__PURE__ */ jsx("line", { x1: "21", x2: "14", y1: "4", y2: "4" }),
499
+ /* @__PURE__ */ jsx("line", { x1: "10", x2: "3", y1: "4", y2: "4" }),
500
+ /* @__PURE__ */ jsx("line", { x1: "21", x2: "12", y1: "12", y2: "12" }),
501
+ /* @__PURE__ */ jsx("line", { x1: "8", x2: "3", y1: "12", y2: "12" }),
502
+ /* @__PURE__ */ jsx("line", { x1: "21", x2: "16", y1: "20", y2: "20" }),
503
+ /* @__PURE__ */ jsx("line", { x1: "12", x2: "3", y1: "20", y2: "20" })
504
+ ]
505
+ }
506
+ ),
507
+ "View"
508
+ ]
509
+ }
510
+ ),
511
+ children: /* @__PURE__ */ jsx("div", { className: "px-1", children: table.getAllLeafColumns().map((column) => {
512
+ if (column.id === "select" || !column.getCanHide()) return null;
513
+ return /* @__PURE__ */ jsxs(
514
+ "label",
515
+ {
516
+ className: cn(
517
+ "flex cursor-pointer items-center gap-2 rounded-sm px-2 py-1.5",
518
+ "text-sm text-foreground",
519
+ "hover:bg-muted/50",
520
+ "transition-colors duration-fast"
521
+ ),
522
+ children: [
523
+ /* @__PURE__ */ jsx(
524
+ "input",
525
+ {
526
+ type: "checkbox",
527
+ checked: column.getIsVisible(),
528
+ onChange: column.getToggleVisibilityHandler(),
529
+ className: "size-3.5 rounded-sm accent-primary"
530
+ }
531
+ ),
532
+ typeof column.columnDef.header === "string" ? column.columnDef.header : column.id
533
+ ]
534
+ },
535
+ column.id
536
+ );
537
+ }) })
538
+ }
539
+ );
540
+ }
541
+ function DataTableCheckbox({
542
+ checked,
543
+ indeterminate,
544
+ onChange,
545
+ disabled,
546
+ "aria-label": ariaLabel
547
+ }) {
548
+ const ref = useCallback(
549
+ (el) => {
550
+ if (el) {
551
+ el.indeterminate = indeterminate ?? false;
552
+ }
553
+ },
554
+ [indeterminate]
555
+ );
556
+ return /* @__PURE__ */ jsx(
557
+ "input",
558
+ {
559
+ type: "checkbox",
560
+ ref,
561
+ checked,
562
+ onChange,
563
+ disabled,
564
+ "aria-label": ariaLabel,
565
+ className: cn(
566
+ "size-4 cursor-pointer rounded-sm",
567
+ "border border-border",
568
+ "accent-primary",
569
+ "focus-visible:outline-none focus-visible:border-border-strong",
570
+ "disabled:cursor-not-allowed disabled:opacity-50"
571
+ )
572
+ }
573
+ );
574
+ }
575
+ function DataTableGlobalFilter({
576
+ value,
577
+ onChange,
578
+ placeholder
579
+ }) {
580
+ return /* @__PURE__ */ jsx(
581
+ "input",
582
+ {
583
+ type: "text",
584
+ value,
585
+ onChange: (e) => onChange(e.target.value),
586
+ placeholder: placeholder ?? "Search...",
587
+ className: cn(
588
+ "h-9 w-full max-w-xs rounded-md px-3 text-sm",
589
+ "border border-border bg-background text-foreground",
590
+ "placeholder:text-muted-foreground",
591
+ "focus-visible:outline-none focus-visible:border-border-strong",
592
+ "transition-colors duration-fast"
593
+ ),
594
+ "data-ds": "",
595
+ "data-ds-component": "data-table-search"
596
+ }
597
+ );
598
+ }
599
+ function DataTableColumnFilter({
600
+ value,
601
+ onChange,
602
+ placeholder
603
+ }) {
604
+ return /* @__PURE__ */ jsx(
605
+ "input",
606
+ {
607
+ type: "text",
608
+ value,
609
+ onChange: (e) => onChange(e.target.value),
610
+ placeholder: placeholder ?? "Filter...",
611
+ className: cn(
612
+ "mt-1 h-7 w-full rounded-sm px-2 text-xs",
613
+ "border border-border-muted bg-background text-foreground",
614
+ "placeholder:text-muted-foreground",
615
+ "focus-visible:outline-none focus-visible:border-border-strong",
616
+ "transition-colors duration-fast"
617
+ ),
618
+ "data-ds": "",
619
+ "data-ds-component": "data-table-column-filter"
620
+ }
621
+ );
622
+ }
623
+ function _DataTableColumnVisibility({
624
+ table
625
+ }) {
626
+ const [open, setOpen] = useState(false);
627
+ return /* @__PURE__ */ jsxs("div", { className: "relative", children: [
628
+ /* @__PURE__ */ jsxs(
629
+ "button",
630
+ {
631
+ type: "button",
632
+ onClick: () => setOpen(!open),
633
+ className: cn(
634
+ "inline-flex items-center gap-1.5 rounded-md px-3 py-1.5",
635
+ "text-sm font-medium text-foreground",
636
+ "border border-border bg-background",
637
+ "hover:bg-muted/50",
638
+ "focus-visible:outline-none focus-visible:border-border-strong",
639
+ "transition-colors duration-fast"
640
+ ),
641
+ "data-ds": "",
642
+ "data-ds-component": "data-table-column-toggle",
643
+ children: [
644
+ /* @__PURE__ */ jsxs(
645
+ "svg",
646
+ {
647
+ className: "size-4",
648
+ xmlns: "http://www.w3.org/2000/svg",
649
+ viewBox: "0 0 24 24",
650
+ fill: "none",
651
+ stroke: "currentColor",
652
+ strokeWidth: "2",
653
+ strokeLinecap: "round",
654
+ strokeLinejoin: "round",
655
+ "aria-hidden": "true",
656
+ children: [
657
+ /* @__PURE__ */ jsx("path", { d: "M12 3v18" }),
658
+ /* @__PURE__ */ jsx("rect", { width: "6", height: "18", x: "3", y: "3", rx: "2" }),
659
+ /* @__PURE__ */ jsx("rect", { width: "6", height: "18", x: "15", y: "3", rx: "2" })
660
+ ]
661
+ }
662
+ ),
663
+ "Columns"
664
+ ]
665
+ }
666
+ ),
667
+ open && /* @__PURE__ */ jsxs(Fragment, { children: [
668
+ /* @__PURE__ */ jsx(
669
+ "div",
670
+ {
671
+ className: "fixed inset-0 z-[var(--z-dropdown)]",
672
+ onClick: () => setOpen(false),
673
+ onKeyDown: (e) => {
674
+ if (e.key === "Escape") setOpen(false);
675
+ },
676
+ "aria-hidden": "true"
677
+ }
678
+ ),
679
+ /* @__PURE__ */ jsx(
680
+ "div",
681
+ {
682
+ className: cn(
683
+ "absolute right-0 top-full z-[var(--z-dropdown)] mt-1",
684
+ "min-w-[10rem] rounded-md p-1",
685
+ "border border-border bg-popover text-popover-foreground",
686
+ "shadow-md",
687
+ "animate-in fade-in-0 zoom-in-95"
688
+ ),
689
+ role: "menu",
690
+ "data-ds": "",
691
+ "data-ds-component": "data-table-column-menu",
692
+ children: table.getAllLeafColumns().map((column) => {
693
+ if (column.id === "select") return null;
694
+ return /* @__PURE__ */ jsxs(
695
+ "label",
696
+ {
697
+ className: cn(
698
+ "flex cursor-pointer items-center gap-2 rounded-sm px-2 py-1.5",
699
+ "text-sm text-foreground",
700
+ "hover:bg-muted/50",
701
+ "transition-colors duration-fast"
702
+ ),
703
+ children: [
704
+ /* @__PURE__ */ jsx(
705
+ "input",
706
+ {
707
+ type: "checkbox",
708
+ checked: column.getIsVisible(),
709
+ onChange: column.getToggleVisibilityHandler(),
710
+ className: cn("size-3.5 rounded-sm", "accent-primary")
711
+ }
712
+ ),
713
+ typeof column.columnDef.header === "string" ? column.columnDef.header : column.id
714
+ ]
715
+ },
716
+ column.id
717
+ );
718
+ })
719
+ }
720
+ )
721
+ ] })
722
+ ] });
723
+ }
724
+ function DataTablePagination({
725
+ table,
726
+ pageSizeOptions
727
+ }) {
728
+ const pageIndex = table.getState().pagination.pageIndex;
729
+ const pageCount = table.getPageCount();
730
+ const pageSize = table.getState().pagination.pageSize;
731
+ const totalRows = table.getFilteredRowModel().rows.length;
732
+ const selectedCount = table.getFilteredSelectedRowModel().rows.length;
733
+ return /* @__PURE__ */ jsxs(
734
+ "div",
735
+ {
736
+ className: cn(
737
+ "flex flex-col gap-3 px-2 py-3",
738
+ "sm:flex-row sm:items-center sm:justify-between"
739
+ ),
740
+ "data-ds": "",
741
+ "data-ds-component": "data-table-pagination",
742
+ children: [
743
+ /* @__PURE__ */ jsxs("div", { className: "text-xs text-muted-foreground", children: [
744
+ selectedCount,
745
+ " of ",
746
+ totalRows,
747
+ " row(s) selected."
748
+ ] }),
749
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-6", children: [
750
+ pageSizeOptions !== false && /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 text-xs text-foreground", children: [
751
+ /* @__PURE__ */ jsx("span", { className: "whitespace-nowrap", children: "Rows per page" }),
752
+ /* @__PURE__ */ jsx(
753
+ "select",
754
+ {
755
+ value: pageSize,
756
+ onChange: (e) => table.setPageSize(Number(e.target.value)),
757
+ className: cn(
758
+ "h-8 rounded-md border border-border bg-background px-2 text-xs text-foreground",
759
+ "focus-visible:outline-none focus-visible:border-border-strong",
760
+ "appearance-none cursor-pointer pr-6",
761
+ "bg-[url('data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2212%22%20height%3D%2212%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22%23888%22%20stroke-width%3D%222%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Cpath%20d%3D%22m6%209%206%206%206-6%22%2F%3E%3C%2Fsvg%3E')]",
762
+ "bg-[position:right_0.4rem_center] bg-no-repeat"
763
+ ),
764
+ children: (pageSizeOptions || [10, 20, 30, 50, 100]).map((size) => /* @__PURE__ */ jsx("option", { value: size, children: size }, size))
765
+ }
766
+ )
767
+ ] }),
768
+ /* @__PURE__ */ jsxs("span", { className: "text-xs text-foreground whitespace-nowrap", children: [
769
+ "Page ",
770
+ pageIndex + 1,
771
+ " of ",
772
+ pageCount || 1
773
+ ] }),
774
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1", children: [
775
+ /* @__PURE__ */ jsx(
776
+ PaginationButton,
777
+ {
778
+ onClick: () => table.firstPage(),
779
+ disabled: !table.getCanPreviousPage(),
780
+ "aria-label": "Go to first page",
781
+ children: /* @__PURE__ */ jsxs(
782
+ "svg",
783
+ {
784
+ className: "size-3.5",
785
+ viewBox: "0 0 24 24",
786
+ fill: "none",
787
+ stroke: "currentColor",
788
+ strokeWidth: "2",
789
+ strokeLinecap: "round",
790
+ strokeLinejoin: "round",
791
+ "aria-hidden": "true",
792
+ children: [
793
+ /* @__PURE__ */ jsx("path", { d: "m11 17-5-5 5-5" }),
794
+ /* @__PURE__ */ jsx("path", { d: "m18 17-5-5 5-5" })
795
+ ]
796
+ }
797
+ )
798
+ }
799
+ ),
800
+ /* @__PURE__ */ jsx(
801
+ PaginationButton,
802
+ {
803
+ onClick: () => table.previousPage(),
804
+ disabled: !table.getCanPreviousPage(),
805
+ "aria-label": "Go to previous page",
806
+ children: /* @__PURE__ */ jsx(
807
+ "svg",
808
+ {
809
+ className: "size-3.5",
810
+ viewBox: "0 0 24 24",
811
+ fill: "none",
812
+ stroke: "currentColor",
813
+ strokeWidth: "2",
814
+ strokeLinecap: "round",
815
+ strokeLinejoin: "round",
816
+ "aria-hidden": "true",
817
+ children: /* @__PURE__ */ jsx("path", { d: "m15 18-6-6 6-6" })
818
+ }
819
+ )
820
+ }
821
+ ),
822
+ /* @__PURE__ */ jsx(
823
+ PaginationButton,
824
+ {
825
+ onClick: () => table.nextPage(),
826
+ disabled: !table.getCanNextPage(),
827
+ "aria-label": "Go to next page",
828
+ children: /* @__PURE__ */ jsx(
829
+ "svg",
830
+ {
831
+ className: "size-3.5",
832
+ viewBox: "0 0 24 24",
833
+ fill: "none",
834
+ stroke: "currentColor",
835
+ strokeWidth: "2",
836
+ strokeLinecap: "round",
837
+ strokeLinejoin: "round",
838
+ "aria-hidden": "true",
839
+ children: /* @__PURE__ */ jsx("path", { d: "m9 18 6-6-6-6" })
840
+ }
841
+ )
842
+ }
843
+ ),
844
+ /* @__PURE__ */ jsx(
845
+ PaginationButton,
846
+ {
847
+ onClick: () => table.lastPage(),
848
+ disabled: !table.getCanNextPage(),
849
+ "aria-label": "Go to last page",
850
+ children: /* @__PURE__ */ jsxs(
851
+ "svg",
852
+ {
853
+ className: "size-3.5",
854
+ viewBox: "0 0 24 24",
855
+ fill: "none",
856
+ stroke: "currentColor",
857
+ strokeWidth: "2",
858
+ strokeLinecap: "round",
859
+ strokeLinejoin: "round",
860
+ "aria-hidden": "true",
861
+ children: [
862
+ /* @__PURE__ */ jsx("path", { d: "m13 17 5-5-5-5" }),
863
+ /* @__PURE__ */ jsx("path", { d: "m6 17 5-5-5-5" })
864
+ ]
865
+ }
866
+ )
867
+ }
868
+ )
869
+ ] })
870
+ ] })
871
+ ]
872
+ }
873
+ );
874
+ }
875
+ function PaginationButton({
876
+ children,
877
+ ...props
878
+ }) {
879
+ return /* @__PURE__ */ jsx(
880
+ "button",
881
+ {
882
+ type: "button",
883
+ ...props,
884
+ className: cn(
885
+ "inline-flex size-8 items-center justify-center rounded-md",
886
+ "border border-border bg-background text-foreground",
887
+ "hover:bg-muted/50",
888
+ "focus-visible:outline-none focus-visible:border-border-strong",
889
+ "disabled:pointer-events-none disabled:opacity-50",
890
+ "transition-colors duration-fast"
891
+ ),
892
+ children
893
+ }
894
+ );
895
+ }
896
+ function DataTableSkeleton({
897
+ columnCount,
898
+ rowCount = 5,
899
+ density
900
+ }) {
901
+ const heightClass = density === "compact" ? "h-3" : "h-4";
902
+ return /* @__PURE__ */ jsx(Fragment, { children: Array.from({ length: rowCount }).map((_, rowIndex) => /* @__PURE__ */ jsx(TableRow, { className: "animate-pulse", children: Array.from({ length: columnCount }).map((_2, colIndex) => /* @__PURE__ */ jsx(TableCell, { children: /* @__PURE__ */ jsx(
903
+ "div",
904
+ {
905
+ className: cn(
906
+ heightClass,
907
+ "rounded-sm bg-muted",
908
+ colIndex === 0 ? "w-3/4" : colIndex === columnCount - 1 ? "w-1/3" : "w-2/3"
909
+ )
910
+ }
911
+ ) }, colIndex)) }, rowIndex)) });
912
+ }
913
+ const DataTable = forwardRef(
914
+ function DataTable2({
915
+ // Data
916
+ data,
917
+ columns: userColumns,
918
+ // Faceted filters
919
+ facetedFilters,
920
+ // Sorting
921
+ sorting: enableSorting = false,
922
+ sortingState: controlledSorting,
923
+ onSortingChange: onControlledSortingChange,
924
+ multiSort = false,
925
+ // Filtering
926
+ filtering: enableFiltering = false,
927
+ globalFilter: controlledGlobalFilter,
928
+ onGlobalFilterChange: onControlledGlobalFilterChange,
929
+ columnFilters: controlledColumnFilters,
930
+ onColumnFiltersChange: onControlledColumnFiltersChange,
931
+ showGlobalFilter = false,
932
+ globalFilterPlaceholder,
933
+ // Pagination
934
+ pagination: enablePagination = false,
935
+ pageSize = 10,
936
+ paginationState: controlledPagination,
937
+ onPaginationChange: onControlledPaginationChange,
938
+ pageSizeOptions,
939
+ // Row selection
940
+ rowSelection: rowSelectionMode = false,
941
+ rowSelectionState: controlledRowSelection,
942
+ onRowSelectionChange: onControlledRowSelectionChange,
943
+ onSelectedRowsChange,
944
+ enableRowSelection = true,
945
+ getRowId,
946
+ // Column visibility
947
+ columnVisibility: enableColumnVisibility = false,
948
+ columnVisibilityState: controlledColumnVisibility,
949
+ onColumnVisibilityChange: onControlledColumnVisibilityChange,
950
+ // Column pinning
951
+ columnPinning: controlledColumnPinning,
952
+ onColumnPinningChange: onControlledColumnPinningChange,
953
+ // Faceted filtering requires filtering to be enabled
954
+ // (handled below in table config)
955
+ // Appearance
956
+ density = "comfortable",
957
+ striped = false,
958
+ hoverable = true,
959
+ bordered = false,
960
+ responsive = true,
961
+ // States
962
+ loading = false,
963
+ emptyState,
964
+ caption,
965
+ showFooter = false,
966
+ // Slots
967
+ toolbar,
968
+ footer,
969
+ // Classes
970
+ className,
971
+ tableClassName,
972
+ wrapperClassName,
973
+ // Events
974
+ onRowClick,
975
+ onTableInstance
976
+ }, ref) {
977
+ const [internalSorting, setInternalSorting] = useState([]);
978
+ const [internalGlobalFilter, setInternalGlobalFilter] = useState("");
979
+ const [internalColumnFilters, setInternalColumnFilters] = useState([]);
980
+ const [internalPagination, setInternalPagination] = useState({
981
+ pageIndex: 0,
982
+ pageSize
983
+ });
984
+ const [internalRowSelection, setInternalRowSelection] = useState({});
985
+ const [internalColumnVisibility, setInternalColumnVisibility] = useState({});
986
+ const [internalColumnPinning, setInternalColumnPinning] = useState({});
987
+ const sortingValue = controlledSorting ?? internalSorting;
988
+ const onSortingChange = onControlledSortingChange ?? setInternalSorting;
989
+ const globalFilterValue = controlledGlobalFilter ?? internalGlobalFilter;
990
+ const onGlobalFilterChange = onControlledGlobalFilterChange ?? setInternalGlobalFilter;
991
+ const columnFiltersValue = controlledColumnFilters ?? internalColumnFilters;
992
+ const onColumnFiltersChange = onControlledColumnFiltersChange ?? setInternalColumnFilters;
993
+ const paginationValue = controlledPagination ?? internalPagination;
994
+ const onPaginationChange = onControlledPaginationChange ?? setInternalPagination;
995
+ const rowSelectionValue = controlledRowSelection ?? internalRowSelection;
996
+ const onRowSelectionChange = onControlledRowSelectionChange ?? setInternalRowSelection;
997
+ const columnVisibilityValue = controlledColumnVisibility ?? internalColumnVisibility;
998
+ const onColumnVisibilityChange = onControlledColumnVisibilityChange ?? setInternalColumnVisibility;
999
+ const columnPinningValue = controlledColumnPinning ?? internalColumnPinning;
1000
+ const onColumnPinningChange = onControlledColumnPinningChange ?? setInternalColumnPinning;
1001
+ const columns = useMemo(() => {
1002
+ if (!rowSelectionMode) return userColumns;
1003
+ const selectionColumn = {
1004
+ id: "select",
1005
+ header: rowSelectionMode === "multi" ? ({ table: t }) => /* @__PURE__ */ jsx(
1006
+ DataTableCheckbox,
1007
+ {
1008
+ checked: t.getIsAllPageRowsSelected(),
1009
+ indeterminate: t.getIsSomePageRowsSelected(),
1010
+ onChange: t.getToggleAllPageRowsSelectedHandler(),
1011
+ "aria-label": "Select all rows"
1012
+ }
1013
+ ) : void 0,
1014
+ cell: ({ row }) => /* @__PURE__ */ jsx(
1015
+ DataTableCheckbox,
1016
+ {
1017
+ checked: row.getIsSelected(),
1018
+ disabled: !row.getCanSelect(),
1019
+ indeterminate: row.getIsSomeSelected(),
1020
+ onChange: row.getToggleSelectedHandler(),
1021
+ "aria-label": `Select row ${row.index + 1}`
1022
+ }
1023
+ ),
1024
+ size: 40,
1025
+ enableSorting: false,
1026
+ enableHiding: false
1027
+ };
1028
+ return [selectionColumn, ...userColumns];
1029
+ }, [userColumns, rowSelectionMode]);
1030
+ const hasFacetedFilters = !!(facetedFilters && facetedFilters.length > 0);
1031
+ const table = useReactTable({
1032
+ data,
1033
+ columns,
1034
+ getRowId,
1035
+ state: {
1036
+ sorting: sortingValue,
1037
+ globalFilter: globalFilterValue,
1038
+ columnFilters: columnFiltersValue,
1039
+ pagination: paginationValue,
1040
+ rowSelection: rowSelectionValue,
1041
+ columnVisibility: columnVisibilityValue,
1042
+ columnPinning: columnPinningValue
1043
+ },
1044
+ // Sorting
1045
+ onSortingChange,
1046
+ enableSorting,
1047
+ enableMultiSort: multiSort,
1048
+ getSortedRowModel: enableSorting ? getSortedRowModel() : void 0,
1049
+ // Filtering
1050
+ onGlobalFilterChange,
1051
+ onColumnFiltersChange,
1052
+ enableFilters: enableFiltering || hasFacetedFilters,
1053
+ getFilteredRowModel: enableFiltering || hasFacetedFilters ? getFilteredRowModel() : void 0,
1054
+ // Faceted models (for unique value counts in filter popovers)
1055
+ ...hasFacetedFilters ? {
1056
+ getFacetedRowModel: getFacetedRowModel(),
1057
+ getFacetedUniqueValues: getFacetedUniqueValues()
1058
+ } : {},
1059
+ // Pagination
1060
+ onPaginationChange,
1061
+ getPaginationRowModel: enablePagination ? getPaginationRowModel() : void 0,
1062
+ // Row selection
1063
+ onRowSelectionChange: (updater) => {
1064
+ onRowSelectionChange(updater);
1065
+ if (onSelectedRowsChange) {
1066
+ const next = typeof updater === "function" ? updater(rowSelectionValue) : updater;
1067
+ setTimeout(() => {
1068
+ const selectedRows = table.getRowModel().rows.filter((row) => next[row.id]);
1069
+ onSelectedRowsChange(selectedRows);
1070
+ }, 0);
1071
+ }
1072
+ },
1073
+ enableRowSelection: rowSelectionMode === false ? false : enableRowSelection,
1074
+ enableMultiRowSelection: rowSelectionMode === "multi",
1075
+ // Column visibility
1076
+ onColumnVisibilityChange,
1077
+ // Column pinning
1078
+ onColumnPinningChange,
1079
+ // Core
1080
+ getCoreRowModel: getCoreRowModel()
1081
+ });
1082
+ if (onTableInstance) {
1083
+ onTableInstance(table);
1084
+ }
1085
+ const headerGroups = table.getHeaderGroups();
1086
+ const rows = table.getRowModel().rows;
1087
+ const footerGroups = table.getFooterGroups();
1088
+ const visibleColumnCount = table.getVisibleLeafColumns().length;
1089
+ const hasToolbar = showGlobalFilter || enableColumnVisibility || toolbar || hasFacetedFilters || enableSorting && sortingValue.length > 0;
1090
+ const toSortDir = (dir) => {
1091
+ if (dir === "asc") return "asc";
1092
+ if (dir === "desc") return "desc";
1093
+ return void 0;
1094
+ };
1095
+ return /* @__PURE__ */ jsxs(
1096
+ "div",
1097
+ {
1098
+ ref,
1099
+ className: cn("not-prose", "flex flex-col gap-3", className),
1100
+ "data-ds": "",
1101
+ "data-ds-component": "data-table",
1102
+ children: [
1103
+ hasToolbar && /* @__PURE__ */ jsxs(
1104
+ "div",
1105
+ {
1106
+ className: "flex flex-wrap items-center gap-2",
1107
+ "data-ds": "",
1108
+ "data-ds-component": "data-table-toolbar",
1109
+ children: [
1110
+ showGlobalFilter && (enableFiltering || hasFacetedFilters) && /* @__PURE__ */ jsx(
1111
+ DataTableGlobalFilter,
1112
+ {
1113
+ value: globalFilterValue,
1114
+ onChange: onGlobalFilterChange,
1115
+ placeholder: globalFilterPlaceholder
1116
+ }
1117
+ ),
1118
+ hasFacetedFilters && facetedFilters.map((filter) => /* @__PURE__ */ jsx(
1119
+ DataTableFacetedFilterButton,
1120
+ {
1121
+ column: table.getColumn(filter.columnId),
1122
+ title: filter.title,
1123
+ icon: filter.icon,
1124
+ options: filter.options
1125
+ },
1126
+ filter.columnId
1127
+ )),
1128
+ /* @__PURE__ */ jsx("div", { className: "flex-1" }),
1129
+ typeof toolbar === "function" ? toolbar(table) : toolbar,
1130
+ enableSorting && sortingValue.length > 0 && /* @__PURE__ */ jsx(DataTableSortBadge, { table }),
1131
+ enableColumnVisibility && /* @__PURE__ */ jsx(DataTableViewButton, { table })
1132
+ ]
1133
+ }
1134
+ ),
1135
+ /* @__PURE__ */ jsxs(
1136
+ Table,
1137
+ {
1138
+ density,
1139
+ striped,
1140
+ hoverable,
1141
+ bordered,
1142
+ responsive,
1143
+ wrapperClassName,
1144
+ className: tableClassName,
1145
+ children: [
1146
+ caption && /* @__PURE__ */ jsx(TableCaption, { children: caption }),
1147
+ /* @__PURE__ */ jsx(TableHeader, { children: headerGroups.map((headerGroup) => /* @__PURE__ */ jsx(TableRow, { children: headerGroup.headers.map((header) => {
1148
+ const meta = header.column.columnDef.meta;
1149
+ const canSort = header.column.getCanSort();
1150
+ const sortDir = header.column.getIsSorted();
1151
+ const canFilter = enableFiltering && header.column.getCanFilter() && meta?.filterable !== false;
1152
+ const showColumnFilter = canFilter && meta?.filterable === true;
1153
+ const useHeaderMenu = meta?.enableHeaderMenu && canSort;
1154
+ return /* @__PURE__ */ jsxs(
1155
+ TableHead,
1156
+ {
1157
+ colSpan: header.colSpan > 1 ? header.colSpan : void 0,
1158
+ align: meta?.align,
1159
+ sortable: !useHeaderMenu && canSort,
1160
+ sorted: !useHeaderMenu ? toSortDir(sortDir) : void 0,
1161
+ onSort: !useHeaderMenu && canSort ? () => header.column.toggleSorting() : void 0,
1162
+ sticky: meta?.sticky,
1163
+ className: cn(
1164
+ header.column.id === "select" && "w-[40px]",
1165
+ meta?.headerClassName
1166
+ ),
1167
+ style: header.column.getSize() !== 150 ? {
1168
+ width: header.column.getSize(),
1169
+ minWidth: header.column.getSize()
1170
+ } : void 0,
1171
+ children: [
1172
+ header.isPlaceholder ? null : useHeaderMenu ? /* @__PURE__ */ jsx(
1173
+ DataTableColumnHeaderMenu,
1174
+ {
1175
+ column: header.column,
1176
+ title: typeof header.column.columnDef.header === "string" ? header.column.columnDef.header : header.column.id
1177
+ }
1178
+ ) : flexRender(
1179
+ header.column.columnDef.header,
1180
+ header.getContext()
1181
+ ),
1182
+ showColumnFilter && /* @__PURE__ */ jsx(
1183
+ DataTableColumnFilter,
1184
+ {
1185
+ value: header.column.getFilterValue() ?? "",
1186
+ onChange: (val) => header.column.setFilterValue(val || void 0),
1187
+ placeholder: meta?.filterPlaceholder
1188
+ }
1189
+ )
1190
+ ]
1191
+ },
1192
+ header.id
1193
+ );
1194
+ }) }, headerGroup.id)) }),
1195
+ /* @__PURE__ */ jsx(TableBody, { children: loading ? /* @__PURE__ */ jsx(
1196
+ DataTableSkeleton,
1197
+ {
1198
+ columnCount: visibleColumnCount,
1199
+ density
1200
+ }
1201
+ ) : rows.length === 0 ? /* @__PURE__ */ jsx(TableRow, { children: /* @__PURE__ */ jsx(
1202
+ TableCell,
1203
+ {
1204
+ colSpan: visibleColumnCount,
1205
+ className: "h-24 text-center",
1206
+ children: emptyState ?? /* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children: "No results." })
1207
+ }
1208
+ ) }) : rows.map((row, rowIndex) => /* @__PURE__ */ jsx(
1209
+ TableRow,
1210
+ {
1211
+ selected: row.getIsSelected(),
1212
+ onClick: onRowClick ? (e) => onRowClick(row, e) : void 0,
1213
+ className: cn(onRowClick && "cursor-pointer"),
1214
+ "data-ds-row-index": rowIndex % 2 === 0 ? "even" : "odd",
1215
+ children: row.getVisibleCells().map((cell) => {
1216
+ const meta = cell.column.columnDef.meta;
1217
+ return /* @__PURE__ */ jsx(
1218
+ TableCell,
1219
+ {
1220
+ align: meta?.align,
1221
+ className: meta?.cellClassName,
1222
+ style: cell.column.getSize() !== 150 ? {
1223
+ width: cell.column.getSize(),
1224
+ minWidth: cell.column.getSize()
1225
+ } : void 0,
1226
+ children: flexRender(
1227
+ cell.column.columnDef.cell,
1228
+ cell.getContext()
1229
+ )
1230
+ },
1231
+ cell.id
1232
+ );
1233
+ })
1234
+ },
1235
+ row.id
1236
+ )) }),
1237
+ showFooter && /* @__PURE__ */ jsx(TableFooter, { children: footerGroups.map((footerGroup) => /* @__PURE__ */ jsx(TableRow, { children: footerGroup.headers.map((header) => /* @__PURE__ */ jsx(TableCell, { children: header.isPlaceholder ? null : flexRender(
1238
+ header.column.columnDef.footer,
1239
+ header.getContext()
1240
+ ) }, header.id)) }, footerGroup.id)) })
1241
+ ]
1242
+ }
1243
+ ),
1244
+ enablePagination && /* @__PURE__ */ jsx(
1245
+ DataTablePagination,
1246
+ {
1247
+ table,
1248
+ pageSizeOptions
1249
+ }
1250
+ ),
1251
+ footer && (typeof footer === "function" ? footer(table) : footer)
1252
+ ]
1253
+ }
1254
+ );
1255
+ }
1256
+ );
1257
+ DataTable.displayName = "DataTable";
1258
+ function useDataTable(options) {
1259
+ const [sorting, onSortingChange] = useState(
1260
+ options.initialSorting ?? []
1261
+ );
1262
+ const [globalFilter, onGlobalFilterChange] = useState(
1263
+ options.initialGlobalFilter ?? ""
1264
+ );
1265
+ const [columnFilters, onColumnFiltersChange] = useState(
1266
+ options.initialColumnFilters ?? []
1267
+ );
1268
+ const [pagination, onPaginationChange] = useState({
1269
+ pageIndex: 0,
1270
+ pageSize: 10,
1271
+ ...options.initialPagination
1272
+ });
1273
+ const [rowSelection, onRowSelectionChange] = useState(
1274
+ options.initialRowSelection ?? {}
1275
+ );
1276
+ const [columnVisibility, onColumnVisibilityChange] = useState(options.initialColumnVisibility ?? {});
1277
+ const reset = useCallback(() => {
1278
+ onSortingChange(options.initialSorting ?? []);
1279
+ onGlobalFilterChange(options.initialGlobalFilter ?? "");
1280
+ onColumnFiltersChange(options.initialColumnFilters ?? []);
1281
+ onPaginationChange({
1282
+ pageIndex: 0,
1283
+ pageSize: 10,
1284
+ ...options.initialPagination
1285
+ });
1286
+ onRowSelectionChange(options.initialRowSelection ?? {});
1287
+ onColumnVisibilityChange(options.initialColumnVisibility ?? {});
1288
+ }, [options]);
1289
+ return {
1290
+ sorting,
1291
+ onSortingChange,
1292
+ globalFilter,
1293
+ onGlobalFilterChange,
1294
+ columnFilters,
1295
+ onColumnFiltersChange,
1296
+ pagination,
1297
+ onPaginationChange,
1298
+ rowSelection,
1299
+ onRowSelectionChange,
1300
+ columnVisibility,
1301
+ onColumnVisibilityChange,
1302
+ tableProps: {
1303
+ sortingState: sorting,
1304
+ onSortingChange,
1305
+ globalFilter,
1306
+ onGlobalFilterChange,
1307
+ columnFilters,
1308
+ onColumnFiltersChange,
1309
+ paginationState: pagination,
1310
+ onPaginationChange,
1311
+ rowSelectionState: rowSelection,
1312
+ onRowSelectionChange,
1313
+ columnVisibilityState: columnVisibility,
1314
+ onColumnVisibilityChange
1315
+ },
1316
+ reset
1317
+ };
1318
+ }
1319
+ export {
1320
+ DataTable,
1321
+ createColumnHelper,
1322
+ useDataTable
1323
+ };