@brightlocal/ui-components 3.1.0 → 3.3.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 (463) hide show
  1. package/AI_USAGE.md +10 -0
  2. package/README.md +8 -1
  3. package/component-meta.json +1591 -123
  4. package/deprecations.json +45 -1
  5. package/dist/_virtual/_rolldown/runtime.cjs +1 -0
  6. package/dist/accordion.cjs +1 -1
  7. package/dist/accordion.js +73 -102
  8. package/dist/alert-dialog.cjs +1 -1
  9. package/dist/alert-dialog.d.ts +36 -5
  10. package/dist/alert-dialog.d.ts.map +1 -1
  11. package/dist/alert-dialog.js +83 -128
  12. package/dist/alert.cjs +1 -1
  13. package/dist/alert.d.ts +4 -4
  14. package/dist/alert.d.ts.map +1 -1
  15. package/dist/alert.js +116 -177
  16. package/dist/aspect-ratio.cjs +1 -1
  17. package/dist/aspect-ratio.js +13 -16
  18. package/dist/avatar.cjs +1 -1
  19. package/dist/avatar.js +30 -45
  20. package/dist/badge.cjs +1 -1
  21. package/dist/badge.d.ts +32 -1
  22. package/dist/badge.d.ts.map +1 -1
  23. package/dist/badge.js +90 -71
  24. package/dist/banner.cjs +1 -0
  25. package/dist/banner.d.ts +81 -0
  26. package/dist/banner.d.ts.map +1 -0
  27. package/dist/banner.js +130 -0
  28. package/dist/blocks/empty-state.cjs +1 -1
  29. package/dist/blocks/empty-state.d.ts +24 -6
  30. package/dist/blocks/empty-state.d.ts.map +1 -1
  31. package/dist/blocks/empty-state.js +74 -140
  32. package/dist/blocks/input-list.cjs +2 -2
  33. package/dist/blocks/input-list.d.ts +2 -2
  34. package/dist/blocks/input-list.d.ts.map +1 -1
  35. package/dist/blocks/input-list.js +136 -176
  36. package/dist/blocks/progress-state.cjs +1 -1
  37. package/dist/blocks/progress-state.d.ts +2 -2
  38. package/dist/blocks/progress-state.js +223 -347
  39. package/dist/blocks/sidebar.cjs +1 -1
  40. package/dist/blocks/sidebar.d.ts +28 -6
  41. package/dist/blocks/sidebar.d.ts.map +1 -1
  42. package/dist/blocks/sidebar.js +763 -1086
  43. package/dist/brand-illustration-motif.cjs +1 -1
  44. package/dist/brand-illustration-motif.d.ts +1 -1
  45. package/dist/brand-illustration-motif.js +40 -61
  46. package/dist/breadcrumb.cjs +1 -1
  47. package/dist/breadcrumb.js +62 -102
  48. package/dist/button-group.cjs +1 -1
  49. package/dist/button-group.js +23 -31
  50. package/dist/button.cjs +1 -1
  51. package/dist/button.d.ts +4 -2
  52. package/dist/button.d.ts.map +1 -1
  53. package/dist/button.js +149 -189
  54. package/dist/calendar.cjs +1 -1
  55. package/dist/calendar.d.ts +87 -3
  56. package/dist/calendar.d.ts.map +1 -1
  57. package/dist/calendar.js +116 -173
  58. package/dist/callout.cjs +1 -1
  59. package/dist/callout.js +73 -96
  60. package/dist/card.cjs +1 -1
  61. package/dist/card.d.ts +92 -6
  62. package/dist/card.d.ts.map +1 -1
  63. package/dist/card.js +240 -234
  64. package/dist/carousel.cjs +1 -1
  65. package/dist/carousel.d.ts +3 -3
  66. package/dist/carousel.d.ts.map +1 -1
  67. package/dist/carousel.js +174 -268
  68. package/dist/centred-layout.cjs +1 -1
  69. package/dist/centred-layout.js +27 -48
  70. package/dist/chart-empty.cjs +1 -1
  71. package/dist/chart-empty.js +18 -27
  72. package/dist/chart.cjs +7 -7
  73. package/dist/chart.d.ts +253 -25
  74. package/dist/chart.d.ts.map +1 -1
  75. package/dist/chart.js +465 -511
  76. package/dist/checkbox.cjs +1 -1
  77. package/dist/checkbox.d.ts +1 -1
  78. package/dist/checkbox.d.ts.map +1 -1
  79. package/dist/checkbox.js +37 -69
  80. package/dist/chip.cjs +1 -1
  81. package/dist/chip.js +116 -173
  82. package/dist/collapsible.cjs +1 -1
  83. package/dist/collapsible.d.ts.map +1 -1
  84. package/dist/collapsible.js +35 -41
  85. package/dist/combobox.cjs +3 -3
  86. package/dist/combobox.d.ts +14 -4
  87. package/dist/combobox.d.ts.map +1 -1
  88. package/dist/combobox.js +440 -639
  89. package/dist/command.cjs +1 -1
  90. package/dist/command.d.ts.map +1 -1
  91. package/dist/command.js +273 -420
  92. package/dist/context-menu.cjs +1 -1
  93. package/dist/context-menu.d.ts +5 -5
  94. package/dist/context-menu.d.ts.map +1 -1
  95. package/dist/context-menu.js +121 -191
  96. package/dist/data-table.cjs +1 -1
  97. package/dist/data-table.d.ts +442 -144
  98. package/dist/data-table.d.ts.map +1 -1
  99. package/dist/data-table.js +708 -835
  100. package/dist/date-picker.cjs +1 -1
  101. package/dist/date-picker.d.ts +15 -4
  102. package/dist/date-picker.d.ts.map +1 -1
  103. package/dist/date-picker.js +156 -231
  104. package/dist/delta.cjs +1 -0
  105. package/dist/delta.d.ts +79 -0
  106. package/dist/delta.d.ts.map +1 -0
  107. package/dist/delta.js +62 -0
  108. package/dist/description.cjs +1 -1
  109. package/dist/description.js +11 -20
  110. package/dist/dialog.cjs +1 -1
  111. package/dist/dialog.d.ts +1 -1
  112. package/dist/dialog.d.ts.map +1 -1
  113. package/dist/dialog.js +76 -116
  114. package/dist/drawer.cjs +1 -1
  115. package/dist/drawer.d.ts +11 -11
  116. package/dist/drawer.d.ts.map +1 -1
  117. package/dist/drawer.js +76 -134
  118. package/dist/dropdown-menu.cjs +1 -1
  119. package/dist/dropdown-menu.d.ts +6 -6
  120. package/dist/dropdown-menu.d.ts.map +1 -1
  121. package/dist/dropdown-menu.js +179 -300
  122. package/dist/field.cjs +1 -1
  123. package/dist/field.d.ts +9 -9
  124. package/dist/field.d.ts.map +1 -1
  125. package/dist/field.js +166 -286
  126. package/dist/global-layout.cjs +1 -1
  127. package/dist/global-layout.js +203 -342
  128. package/dist/grid.cjs +1 -1
  129. package/dist/grid.d.ts +24 -1
  130. package/dist/grid.d.ts.map +1 -1
  131. package/dist/grid.js +16 -29
  132. package/dist/header.cjs +1 -1
  133. package/dist/header.js +21 -38
  134. package/dist/height-transition.cjs +1 -1
  135. package/dist/height-transition.js +38 -55
  136. package/dist/hooks/use-breakpoint.cjs +1 -1
  137. package/dist/hooks/use-breakpoint.d.ts +1 -1
  138. package/dist/hooks/use-breakpoint.d.ts.map +1 -1
  139. package/dist/hooks/use-breakpoint.js +10 -9
  140. package/dist/hooks/use-debounce.cjs +1 -1
  141. package/dist/hooks/use-debounce.js +12 -11
  142. package/dist/hooks/use-delayed-pending.cjs +1 -1
  143. package/dist/hooks/use-delayed-pending.js +8 -9
  144. package/dist/hooks/use-filter-search-params.cjs +1 -0
  145. package/dist/hooks/use-filter-search-params.d.ts +93 -0
  146. package/dist/hooks/use-filter-search-params.d.ts.map +1 -0
  147. package/dist/hooks/use-filter-search-params.js +122 -0
  148. package/dist/hooks/use-mobile.cjs +1 -1
  149. package/dist/hooks/use-mobile.js +6 -6
  150. package/dist/hooks/use-overlay-pointer-lock.cjs +1 -1
  151. package/dist/hooks/use-overlay-pointer-lock.js +8 -9
  152. package/dist/hooks/use-prefers-reduced-motion.cjs +1 -1
  153. package/dist/hooks/use-prefers-reduced-motion.js +5 -8
  154. package/dist/hover-card.cjs +1 -1
  155. package/dist/hover-card.d.ts +1 -1
  156. package/dist/hover-card.d.ts.map +1 -1
  157. package/dist/hover-card.js +30 -62
  158. package/dist/index.cjs +1 -1
  159. package/dist/index.d.ts +11 -0
  160. package/dist/index.d.ts.map +1 -1
  161. package/dist/index.js +636 -582
  162. package/dist/info-tooltip.cjs +1 -0
  163. package/dist/info-tooltip.d.ts +39 -0
  164. package/dist/info-tooltip.d.ts.map +1 -0
  165. package/dist/info-tooltip.js +27 -0
  166. package/dist/input-chip.cjs +1 -1
  167. package/dist/input-chip.d.ts +32 -3
  168. package/dist/input-chip.d.ts.map +1 -1
  169. package/dist/input-chip.js +182 -231
  170. package/dist/input-group.cjs +1 -1
  171. package/dist/input-group.d.ts +33 -2
  172. package/dist/input-group.d.ts.map +1 -1
  173. package/dist/input-group.js +188 -122
  174. package/dist/input-otp.cjs +1 -1
  175. package/dist/input-otp.d.ts +3 -3
  176. package/dist/input-otp.d.ts.map +1 -1
  177. package/dist/input-otp.js +102 -146
  178. package/dist/input-password.cjs +1 -1
  179. package/dist/input-password.d.ts +26 -8
  180. package/dist/input-password.d.ts.map +1 -1
  181. package/dist/input-password.js +139 -171
  182. package/dist/input.cjs +1 -1
  183. package/dist/input.d.ts.map +1 -1
  184. package/dist/input.js +51 -73
  185. package/dist/label.cjs +1 -1
  186. package/dist/label.js +20 -38
  187. package/dist/lib/block-illustration.cjs +1 -1
  188. package/dist/lib/block-illustration.d.ts +5 -2
  189. package/dist/lib/block-illustration.d.ts.map +1 -1
  190. package/dist/lib/block-illustration.js +16 -17
  191. package/dist/lib/compose-event-handlers.cjs +1 -0
  192. package/dist/lib/compose-event-handlers.d.ts +9 -0
  193. package/dist/lib/compose-event-handlers.d.ts.map +1 -0
  194. package/dist/lib/compose-event-handlers.js +8 -0
  195. package/dist/lib/download-file.cjs +1 -0
  196. package/dist/lib/download-file.d.ts +14 -0
  197. package/dist/lib/download-file.d.ts.map +1 -0
  198. package/dist/lib/download-file.js +40 -0
  199. package/dist/lib/empty-canvas.cjs +1 -1
  200. package/dist/lib/empty-canvas.js +28 -56
  201. package/dist/lib/empty-chip.cjs +1 -1
  202. package/dist/lib/empty-chip.d.ts +14 -3
  203. package/dist/lib/empty-chip.d.ts.map +1 -1
  204. package/dist/lib/empty-chip.js +15 -11
  205. package/dist/lib/field-aria.cjs +1 -0
  206. package/dist/lib/field-aria.d.ts +34 -0
  207. package/dist/lib/field-aria.d.ts.map +1 -0
  208. package/dist/lib/field-aria.js +52 -0
  209. package/dist/lib/image-file-info.cjs +1 -0
  210. package/dist/lib/image-file-info.d.ts +25 -0
  211. package/dist/lib/image-file-info.d.ts.map +1 -0
  212. package/dist/lib/image-file-info.js +67 -0
  213. package/dist/lib/media-viewer-content.cjs +1 -0
  214. package/dist/lib/media-viewer-content.d.ts +102 -0
  215. package/dist/lib/media-viewer-content.d.ts.map +1 -0
  216. package/dist/lib/media-viewer-content.js +650 -0
  217. package/dist/lib/media-viewer-internal.cjs +1 -0
  218. package/dist/lib/media-viewer-internal.d.ts +98 -0
  219. package/dist/lib/media-viewer-internal.d.ts.map +1 -0
  220. package/dist/lib/media-viewer-internal.js +61 -0
  221. package/dist/lib/media-viewer-motion.cjs +1 -0
  222. package/dist/lib/media-viewer-motion.d.ts +40 -0
  223. package/dist/lib/media-viewer-motion.d.ts.map +1 -0
  224. package/dist/lib/media-viewer-motion.js +37 -0
  225. package/dist/lib/motion.cjs +1 -1
  226. package/dist/lib/motion.d.ts +8 -0
  227. package/dist/lib/motion.d.ts.map +1 -1
  228. package/dist/lib/motion.js +11 -10
  229. package/dist/lib/optical-center.cjs +1 -1
  230. package/dist/lib/optical-center.d.ts +1 -1
  231. package/dist/lib/optical-center.d.ts.map +1 -1
  232. package/dist/lib/optical-center.js +12 -5
  233. package/dist/lib/spring-settle.cjs +1 -1
  234. package/dist/lib/spring-settle.js +1 -1
  235. package/dist/lib/table-internal.cjs +1 -0
  236. package/dist/lib/table-internal.d.ts +62 -0
  237. package/dist/lib/table-internal.d.ts.map +1 -0
  238. package/dist/lib/table-internal.js +18 -0
  239. package/dist/lib/use-controllable.cjs +1 -0
  240. package/dist/lib/use-controllable.d.ts +12 -0
  241. package/dist/lib/use-controllable.d.ts.map +1 -0
  242. package/dist/lib/use-controllable.js +15 -0
  243. package/dist/lib/use-dev-warning.cjs +1 -1
  244. package/dist/lib/utils.cjs +1 -1
  245. package/dist/lib/utils.d.ts.map +1 -1
  246. package/dist/lib/utils.js +29 -35
  247. package/dist/link.cjs +1 -1
  248. package/dist/link.d.ts +1 -1
  249. package/dist/link.js +78 -124
  250. package/dist/list.cjs +1 -1
  251. package/dist/list.d.ts +8 -0
  252. package/dist/list.d.ts.map +1 -1
  253. package/dist/list.js +94 -156
  254. package/dist/loading.cjs +1 -1
  255. package/dist/loading.js +124 -151
  256. package/dist/logo-mark.cjs +1 -0
  257. package/dist/logo-mark.d.ts +79 -0
  258. package/dist/logo-mark.d.ts.map +1 -0
  259. package/dist/logo-mark.js +219 -0
  260. package/dist/logo.cjs +1 -1
  261. package/dist/logo.d.ts +1 -1
  262. package/dist/logo.d.ts.map +1 -1
  263. package/dist/logo.js +51 -87
  264. package/dist/map.cjs +1 -1
  265. package/dist/map.d.ts.map +1 -1
  266. package/dist/map.js +390 -586
  267. package/dist/media-empty.cjs +1 -1
  268. package/dist/media-empty.js +27 -42
  269. package/dist/media-viewer.cjs +1 -0
  270. package/dist/media-viewer.d.ts +224 -0
  271. package/dist/media-viewer.d.ts.map +1 -0
  272. package/dist/media-viewer.js +295 -0
  273. package/dist/menubar.cjs +1 -1
  274. package/dist/menubar.d.ts +14 -14
  275. package/dist/menubar.d.ts.map +1 -1
  276. package/dist/menubar.js +130 -267
  277. package/dist/multi-select-filter.cjs +1 -0
  278. package/dist/multi-select-filter.d.ts +186 -0
  279. package/dist/multi-select-filter.d.ts.map +1 -0
  280. package/dist/multi-select-filter.js +374 -0
  281. package/dist/navigation-menu.cjs +1 -1
  282. package/dist/navigation-menu.js +108 -172
  283. package/dist/pagination.cjs +1 -1
  284. package/dist/pagination.d.ts +36 -12
  285. package/dist/pagination.d.ts.map +1 -1
  286. package/dist/pagination.js +208 -281
  287. package/dist/popover.cjs +1 -1
  288. package/dist/popover.d.ts +1 -1
  289. package/dist/popover.d.ts.map +1 -1
  290. package/dist/popover.js +34 -45
  291. package/dist/progress.cjs +1 -1
  292. package/dist/progress.d.ts +139 -17
  293. package/dist/progress.d.ts.map +1 -1
  294. package/dist/progress.js +116 -148
  295. package/dist/radio-group.cjs +1 -1
  296. package/dist/radio-group.js +90 -146
  297. package/dist/rating.cjs +1 -1
  298. package/dist/rating.d.ts +80 -13
  299. package/dist/rating.d.ts.map +1 -1
  300. package/dist/rating.js +70 -65
  301. package/dist/relative-date.cjs +1 -0
  302. package/dist/relative-date.d.ts +65 -0
  303. package/dist/relative-date.d.ts.map +1 -0
  304. package/dist/relative-date.js +112 -0
  305. package/dist/resizable.cjs +1 -1
  306. package/dist/resizable.d.ts +39 -23
  307. package/dist/resizable.d.ts.map +1 -1
  308. package/dist/resizable.js +42 -44
  309. package/dist/result-count.cjs +1 -0
  310. package/dist/result-count.d.ts +110 -0
  311. package/dist/result-count.d.ts.map +1 -0
  312. package/dist/result-count.js +49 -0
  313. package/dist/route-progress.cjs +1 -1
  314. package/dist/route-progress.js +58 -102
  315. package/dist/scroll-area.cjs +1 -1
  316. package/dist/scroll-area.d.ts +9 -1
  317. package/dist/scroll-area.d.ts.map +1 -1
  318. package/dist/scroll-area.js +44 -79
  319. package/dist/select.cjs +2 -2
  320. package/dist/select.d.ts +20 -10
  321. package/dist/select.d.ts.map +1 -1
  322. package/dist/select.js +132 -236
  323. package/dist/separator.cjs +1 -1
  324. package/dist/separator.js +90 -78
  325. package/dist/sheet.cjs +1 -1
  326. package/dist/sheet.d.ts +86 -7
  327. package/dist/sheet.d.ts.map +1 -1
  328. package/dist/sheet.js +275 -235
  329. package/dist/single-select-filter.cjs +1 -0
  330. package/dist/single-select-filter.d.ts +113 -0
  331. package/dist/single-select-filter.d.ts.map +1 -0
  332. package/dist/single-select-filter.js +224 -0
  333. package/dist/skeleton.cjs +1 -1
  334. package/dist/skeleton.js +24 -38
  335. package/dist/slider.cjs +1 -1
  336. package/dist/slider.js +51 -81
  337. package/dist/sonner.cjs +1 -1
  338. package/dist/sonner.d.ts +1 -1
  339. package/dist/sonner.d.ts.map +1 -1
  340. package/dist/sonner.js +113 -137
  341. package/dist/spinner.cjs +1 -1
  342. package/dist/spinner.js +22 -31
  343. package/dist/split-layout.cjs +1 -1
  344. package/dist/split-layout.d.ts +1 -1
  345. package/dist/split-layout.js +53 -102
  346. package/dist/status.cjs +1 -0
  347. package/dist/status.d.ts +51 -0
  348. package/dist/status.d.ts.map +1 -0
  349. package/dist/status.js +60 -0
  350. package/dist/stepper.cjs +1 -1
  351. package/dist/stepper.js +184 -316
  352. package/dist/switch.cjs +1 -1
  353. package/dist/switch.js +17 -32
  354. package/dist/table.cjs +1 -1
  355. package/dist/table.d.ts +127 -13
  356. package/dist/table.d.ts.map +1 -1
  357. package/dist/table.js +170 -192
  358. package/dist/tabs.cjs +1 -1
  359. package/dist/tabs.d.ts +12 -1
  360. package/dist/tabs.d.ts.map +1 -1
  361. package/dist/tabs.js +123 -146
  362. package/dist/text-reveal-motion.cjs +1 -1
  363. package/dist/text-reveal-motion.js +307 -363
  364. package/dist/textarea.cjs +1 -1
  365. package/dist/textarea.d.ts.map +1 -1
  366. package/dist/textarea.js +23 -36
  367. package/dist/toggle-group.cjs +1 -1
  368. package/dist/toggle-group.js +43 -62
  369. package/dist/toggle.cjs +1 -1
  370. package/dist/toggle.js +34 -46
  371. package/dist/tooltip.cjs +1 -1
  372. package/dist/tooltip.d.ts +38 -36
  373. package/dist/tooltip.d.ts.map +1 -1
  374. package/dist/tooltip.js +175 -78
  375. package/dist/typography-heading.cjs +1 -1
  376. package/dist/typography-heading.js +25 -61
  377. package/dist/typography-text.cjs +1 -1
  378. package/dist/typography-text.d.ts +1 -2
  379. package/dist/typography-text.d.ts.map +1 -1
  380. package/dist/typography-text.js +27 -57
  381. package/dist/typography.cjs +1 -1
  382. package/dist/typography.d.ts +1 -1
  383. package/dist/typography.js +132 -340
  384. package/package.json +45 -46
  385. package/src/blocks/empty-state.tsx +42 -21
  386. package/src/blocks/progress-state.tsx +2 -2
  387. package/src/blocks/sidebar.tsx +111 -32
  388. package/src/components/accordion.tsx +1 -1
  389. package/src/components/alert-dialog.tsx +52 -5
  390. package/src/components/alert.tsx +16 -8
  391. package/src/components/badge.tsx +152 -3
  392. package/src/components/banner.tsx +288 -0
  393. package/src/components/brand-illustration-motif.tsx +1 -1
  394. package/src/components/breadcrumb.tsx +1 -1
  395. package/src/components/button.tsx +8 -6
  396. package/src/components/calendar.tsx +155 -9
  397. package/src/components/card.tsx +266 -26
  398. package/src/components/carousel.tsx +4 -1
  399. package/src/components/chart.tsx +664 -42
  400. package/src/components/checkbox.tsx +2 -2
  401. package/src/components/collapsible.tsx +4 -1
  402. package/src/components/combobox.tsx +42 -9
  403. package/src/components/command.tsx +10 -11
  404. package/src/components/context-menu.tsx +4 -4
  405. package/src/components/data-table.tsx +1363 -398
  406. package/src/components/date-picker.tsx +31 -4
  407. package/src/components/delta.tsx +217 -0
  408. package/src/components/drawer.tsx +5 -5
  409. package/src/components/dropdown-menu.tsx +4 -4
  410. package/src/components/field.tsx +36 -15
  411. package/src/components/global-layout.tsx +1 -1
  412. package/src/components/grid.tsx +32 -1
  413. package/src/components/info-tooltip.tsx +94 -0
  414. package/src/components/input-chip.tsx +52 -8
  415. package/src/components/input-group.tsx +247 -12
  416. package/src/components/input-otp.tsx +1 -1
  417. package/src/components/input-password.tsx +29 -11
  418. package/src/components/input.tsx +11 -2
  419. package/src/components/list.tsx +15 -3
  420. package/src/components/logo-mark.tsx +345 -0
  421. package/src/components/map.tsx +18 -20
  422. package/src/components/media-viewer.tsx +908 -0
  423. package/src/components/multi-select-filter.tsx +1046 -0
  424. package/src/components/navigation-menu.tsx +2 -2
  425. package/src/components/pagination.tsx +86 -26
  426. package/src/components/progress.tsx +281 -54
  427. package/src/components/rating.tsx +200 -74
  428. package/src/components/relative-date.tsx +238 -0
  429. package/src/components/resizable.tsx +86 -33
  430. package/src/components/result-count.tsx +253 -0
  431. package/src/components/scroll-area.tsx +31 -5
  432. package/src/components/select.tsx +37 -7
  433. package/src/components/sheet.tsx +252 -6
  434. package/src/components/single-select-filter.tsx +538 -0
  435. package/src/components/slider.tsx +2 -2
  436. package/src/components/sonner.tsx +16 -5
  437. package/src/components/split-layout.tsx +2 -2
  438. package/src/components/status.tsx +162 -0
  439. package/src/components/switch.tsx +1 -1
  440. package/src/components/table.tsx +305 -73
  441. package/src/components/tabs.tsx +94 -46
  442. package/src/components/textarea.tsx +21 -3
  443. package/src/components/toggle.tsx +2 -2
  444. package/src/components/tooltip.tsx +431 -68
  445. package/src/components/typography-text.tsx +1 -2
  446. package/src/components/typography.tsx +1 -1
  447. package/src/hooks/use-breakpoint.ts +2 -1
  448. package/src/hooks/use-filter-search-params.ts +302 -0
  449. package/src/index.ts +11 -0
  450. package/src/lib/block-illustration.tsx +5 -1
  451. package/src/lib/compose-event-handlers.ts +14 -0
  452. package/src/lib/download-file.ts +61 -0
  453. package/src/lib/empty-chip.tsx +52 -0
  454. package/src/lib/field-aria.tsx +97 -0
  455. package/src/lib/image-file-info.ts +102 -0
  456. package/src/lib/media-viewer-content.tsx +1587 -0
  457. package/src/lib/media-viewer-internal.tsx +191 -0
  458. package/src/lib/media-viewer-motion.ts +120 -0
  459. package/src/lib/motion.ts +9 -0
  460. package/src/lib/table-internal.ts +74 -0
  461. package/src/lib/use-controllable.ts +43 -0
  462. package/src/lib/utils.ts +1 -0
  463. package/src/lib/empty-chip.ts +0 -24
@@ -1,886 +1,759 @@
1
- import { jsx as a, jsxs as x, Fragment as T } from "react/jsx-runtime";
2
- import * as p from "react";
3
- import { useReactTable as se, getExpandedRowModel as ce, getFilteredRowModel as de, getSortedRowModel as ue, getPaginationRowModel as ge, getCoreRowModel as pe, flexRender as L } from "@tanstack/react-table";
4
- import { useVirtualizer as me } from "@tanstack/react-virtual";
5
- import { ArrowDown as he, ArrowUp as be, ArrowUpDown as fe, ChevronRight as xe, Search as we, X as Se } from "@brightlocal/icons";
6
- import { cn as g } from "@brightlocal/ui-components/lib/utils";
7
- import { useIsBelowBreakpoint as V } from "@brightlocal/ui-components/hooks/use-breakpoint";
8
- import { Button as j } from "./button.js";
9
- import { Checkbox as _ } from "./checkbox.js";
10
- import { InputGroup as Ce, InputGroupAddon as G, InputGroupInput as ke } from "./input-group.js";
11
- import { usePagination as ve, Pagination as Te, PaginationContent as Pe, PaginationItem as $, PaginationPrevious as ye, PaginationNext as Re, PaginationEllipsis as De, PaginationLink as Ne } from "./pagination.js";
12
- import { Skeleton as B } from "./skeleton.js";
13
- import { Table as U, TableBody as W, TableRow as k, TableCell as v, TableHeader as ze, TableHead as Ae } from "./table.js";
14
- import { TypographyMuted as Ie } from "./typography.js";
15
- function R(e, n, o) {
16
- const [t, r] = p.useState(n), l = e !== void 0 ? e : t, i = p.useRef(l);
17
- p.useEffect(() => {
18
- i.current = l;
19
- });
20
- const s = e !== void 0, d = p.useCallback(
21
- (c) => {
22
- const u = typeof c == "function" ? c(i.current) : c;
23
- s || r(u), o?.(u);
24
- },
25
- [s, o]
26
- );
27
- return [l, d];
28
- }
29
- function da(e) {
30
- const {
31
- columns: n,
32
- data: o,
33
- enableSorting: t = !0,
34
- enableGlobalFiltering: r = !1,
35
- enableRowSelection: l = !1,
36
- enablePagination: i = !1,
37
- pageSize: s = 10,
38
- manualSorting: d = !1,
39
- manualFiltering: c = !1,
40
- manualPagination: u = !1,
41
- rowCount: h,
42
- pageCount: b,
43
- enableExpanding: m = !1,
44
- getSubRows: w,
45
- getRowCanExpand: S,
46
- paginateExpandedRows: P = !1,
47
- getRowId: f,
48
- pagination: E,
49
- onPaginationChange: D,
50
- sorting: y,
51
- onSortingChange: N,
52
- globalFilter: C,
53
- onGlobalFilterChange: M,
54
- rowSelection: z,
55
- onRowSelectionChange: A,
56
- expanded: F,
57
- onExpandedChange: I
58
- } = e, [Y, Z] = R(
59
- E,
60
- { pageIndex: 0, pageSize: s },
61
- D
62
- ), [ee, ae] = R(
63
- y,
64
- [],
65
- N
66
- ), [te, ne] = R(
67
- C,
68
- "",
69
- M
70
- ), [oe, le] = R(z, {}, A), [ie, re] = R(
71
- F,
72
- {},
73
- I
74
- );
75
- return se({
76
- data: o,
77
- columns: n,
78
- getCoreRowModel: pe(),
79
- ...f && { getRowId: f },
80
- ...(i || u) && {
81
- onPaginationChange: Z
82
- },
1
+ "use client";
2
+ import { Button as te } from "./button.js";
3
+ import { Checkbox as ae } from "./checkbox.js";
4
+ import { useControllable as _ } from "./lib/use-controllable.js";
5
+ import { InputGroup as me, InputGroupAddon as he, InputGroupClear as ve, InputGroupInput as Se } from "./input-group.js";
6
+ import { ResultCount as xe } from "./result-count.js";
7
+ import { Pagination as we, PaginationContent as Ce, PaginationEllipsis as ye, PaginationItem as G, PaginationLink as ke, PaginationNext as Te, PaginationPrevious as De, usePagination as Pe } from "./pagination.js";
8
+ import { Skeleton as X } from "./skeleton.js";
9
+ import { Spinner as ne } from "./spinner.js";
10
+ import { EmptyState as Re } from "./blocks/empty-state.js";
11
+ import { TABLE_ROW_MIN_HEIGHT as Ne, scrollRegionProps as oe } from "./lib/table-internal.js";
12
+ import { Table as le, TableBody as re, TableCell as L, TableEmpty as se, TableHead as Ee, TableHeader as Ie, TableRow as B } from "./table.js";
13
+ import { TypographyMuted as Ae } from "./typography.js";
14
+ import * as d from "react";
15
+ import { ArrowDown as ze, ArrowUp as Me, ArrowUpDown as Fe, ChevronRight as Be, Search as $e, SearchX as He } from "@brightlocal/icons";
16
+ import { cn as h } from "@brightlocal/ui-components/lib/utils";
17
+ import { Fragment as $, jsx as t, jsxs as T } from "react/jsx-runtime";
18
+ import { useVirtualizer as _e } from "@tanstack/react-virtual";
19
+ import { flexRender as ie, getCoreRowModel as Le, getExpandedRowModel as Oe, getFilteredRowModel as Ve, getPaginationRowModel as je, getSortedRowModel as Ge, useReactTable as qe } from "@tanstack/react-table";
20
+ import { useIsBelowBreakpoint as Q } from "@brightlocal/ui-components/hooks/use-breakpoint";
21
+ var ce = "sticky left-0 shadow-[inset_-1px_0_0_var(--border)]", We = h(ce, "z-2"), Ue = h(ce, "z-1 bg-(--dt-row-bg,var(--background))");
22
+ function Mt(e) {
23
+ const { columns: a, data: s, enableSorting: o = !0, enableGlobalFiltering: l = !1, enableRowSelection: r = !1, enablePagination: n = !1, pageSize: c = 20, manualSorting: u = !1, manualFiltering: g = !1, manualPagination: i = !1, rowCount: b, pageCount: p, enableExpanding: v = !1, getSubRows: f, getRowCanExpand: m, paginateExpandedRows: k = !1, getRowId: x, pagination: C, onPaginationChange: w, sorting: A, onSortingChange: z, globalFilter: S, onGlobalFilterChange: y, rowSelection: R, onRowSelectionChange: H, expanded: P, onExpandedChange: D } = e, [N, M] = _(C, {
24
+ pageIndex: 0,
25
+ pageSize: c
26
+ }, w), [E, F] = _(A, [], z), [I, W] = _(S, "", y), [O, V] = _(R, {}, H), [U, j] = _(P, {}, D);
27
+ return qe({
28
+ data: s,
29
+ columns: a,
30
+ getCoreRowModel: Le(),
31
+ ...x && { getRowId: x },
32
+ ...(n || i) && { onPaginationChange: M },
33
+ ...n && { ...!i && { getPaginationRowModel: je() } },
83
34
  ...i && {
84
- ...!u && {
85
- getPaginationRowModel: ge()
86
- }
87
- },
88
- ...u && {
89
35
  manualPagination: !0,
90
- ...h != null && { rowCount: h },
91
- ...b != null && { pageCount: b }
36
+ ...b != null && { rowCount: b },
37
+ ...p != null && { pageCount: p }
92
38
  },
93
- // Always forward the flag — TanStack defaults `enableSorting` to true,
94
- // so omitting it would leave `column.getCanSort()` returning true even
95
- // when the consumer disabled sorting table-wide.
96
- enableSorting: t,
97
- ...t && {
98
- ...!d && {
99
- getSortedRowModel: ue()
100
- },
101
- onSortingChange: ae,
102
- ...d && { manualSorting: !0 }
39
+ enableSorting: o,
40
+ ...o && {
41
+ ...!u && { getSortedRowModel: Ge() },
42
+ onSortingChange: F,
43
+ ...u && { manualSorting: !0 }
103
44
  },
104
- ...r && {
105
- ...!c && {
106
- getFilteredRowModel: de()
107
- },
108
- ...c && { manualFiltering: !0 },
109
- onGlobalFilterChange: ne,
45
+ ...l && {
46
+ ...!g && { getFilteredRowModel: Ve() },
47
+ ...g && { manualFiltering: !0 },
48
+ onGlobalFilterChange: W,
110
49
  globalFilterFn: "includesString"
111
50
  },
112
- // Always forward — TanStack defaults `enableRowSelection` to true, so
113
- // omitting it would leave `row.getCanSelect()` returning true and
114
- // `DataTableSelectRowCheckbox` enabled on tables without selection.
115
- enableRowSelection: l,
116
- // A predicate turns selection on for the table as a whole; individual rows
117
- // opt out through `row.getCanSelect()`, so the state wiring is still needed.
118
- ...l !== !1 && {
119
- onRowSelectionChange: le
120
- },
121
- // Always forward the flag — TanStack defaults `enableExpanding` to true,
122
- // so omitting it would leave `row.getCanExpand()` returning true and
123
- // `DataTableExpandRowButton` interactive on tables without expanding.
124
- enableExpanding: m,
125
- ...m && {
126
- getExpandedRowModel: ce(),
127
- onExpandedChange: re,
128
- getSubRows: w,
129
- ...S && { getRowCanExpand: S },
130
- // Forward only with client-side pagination: `paginateExpandedRows:
131
- // false` defers expansion to the pagination row model, so without one
132
- // it would suppress row expansion entirely.
133
- ...i && !u && { paginateExpandedRows: P }
51
+ enableRowSelection: r,
52
+ ...r !== !1 && { onRowSelectionChange: V },
53
+ enableExpanding: v,
54
+ ...v && {
55
+ getExpandedRowModel: Oe(),
56
+ onExpandedChange: j,
57
+ getSubRows: f,
58
+ ...m && { getRowCanExpand: m },
59
+ ...n && !i && { paginateExpandedRows: k }
134
60
  },
135
61
  state: {
136
- pagination: Y,
137
- sorting: ee,
138
- globalFilter: te,
139
- rowSelection: oe,
140
- expanded: ie
62
+ pagination: N,
63
+ sorting: E,
64
+ globalFilter: I,
65
+ rowSelection: O,
66
+ expanded: U
141
67
  }
142
68
  });
143
69
  }
144
- function $e({
145
- table: e,
146
- dataHook: n,
147
- trackingEl: o,
148
- trackingLabel: t,
149
- isLoading: r = !1,
150
- skeletonRowCount: l,
151
- noResultsMessage: i = "No results.",
152
- stickyHeader: s = !1,
153
- className: d,
154
- layout: c,
155
- minWidth: u,
156
- scrollRegionLabel: h,
157
- footer: b,
158
- getRowClassName: m,
159
- renderExpandedContent: w
160
- }) {
161
- const S = e.getVisibleLeafColumns().length, P = l ?? e.getState().pagination.pageSize ?? 10;
162
- return /* @__PURE__ */ a(
163
- "div",
164
- {
165
- "aria-busy": r || void 0,
166
- className: g("border-border overflow-auto rounded-md border", d),
167
- "data-hook": n,
168
- "data-slot": "data-table-view",
169
- "data-tracking-el": o,
170
- "data-tracking-label": t,
171
- children: /* @__PURE__ */ x(
172
- U,
173
- {
174
- dataHook: `${n}-table`,
175
- layout: c,
176
- minWidth: u,
177
- scrollRegionLabel: h,
178
- children: [
179
- /* @__PURE__ */ a(O, { stickyHeader: s, table: e }),
180
- /* @__PURE__ */ a(W, { children: r ? /* @__PURE__ */ x(T, { children: [
181
- /* @__PURE__ */ a(
182
- q,
183
- {
184
- colCount: S,
185
- rowCount: P
186
- }
187
- ),
188
- /* @__PURE__ */ a(k, { className: "sr-only", children: /* @__PURE__ */ a(v, { colSpan: S, children: /* @__PURE__ */ a("div", { "aria-live": "polite", role: "status", children: "Loading data…" }) }) })
189
- ] }) : /* @__PURE__ */ a(T, { children: e.getRowModel().rows.length > 0 ? e.getRowModel().rows.map((f) => /* @__PURE__ */ a(
190
- X,
191
- {
192
- columnCount: S,
193
- getRowClassName: m,
194
- renderExpandedContent: w,
195
- row: f
196
- },
197
- f.id
198
- )) : /* @__PURE__ */ a(k, { children: /* @__PURE__ */ a(v, { align: "center", colSpan: S, size: "lg", children: /* @__PURE__ */ a("div", { "aria-live": "polite", className: "py-6", role: "status", children: i }) }) }) }) }),
199
- b
200
- ]
201
- }
202
- )
70
+ var q = d.createContext(!1);
71
+ function de({ table: e, dataHook: a, title: s, description: o }) {
72
+ const l = e.getState().globalFilter, r = typeof l == "string" ? l.trim() : "", n = (s ?? (r ? 'No results for "{query}"' : "No results")).replace("{query}", r);
73
+ return /* @__PURE__ */ t(Re, {
74
+ dataHook: `${a}-no-results`,
75
+ description: o ?? "Try a different search, or clear the filters.",
76
+ icon: /* @__PURE__ */ t(He, {}),
77
+ title: n
78
+ });
79
+ }
80
+ function Xe(e, a) {
81
+ const [s, o] = d.useState(!1);
82
+ return d.useLayoutEffect(() => {
83
+ const l = e.current, r = l?.querySelector('[data-slot="table"]');
84
+ if (!a || !l || !r) {
85
+ o(!1);
86
+ return;
203
87
  }
204
- );
88
+ const n = () => o(r.offsetWidth > l.clientWidth + 1);
89
+ n();
90
+ const c = new ResizeObserver(n);
91
+ return c.observe(l), c.observe(r), () => c.disconnect();
92
+ }, [e, a]), s;
205
93
  }
206
- $e.displayName = "DataTable";
207
- function O({
208
- table: e,
209
- stickyHeader: n
210
- }) {
211
- return /* @__PURE__ */ a(ze, { className: g(n && "sticky top-0 z-10"), children: e.getHeaderGroups().map((o) => /* @__PURE__ */ a(k, { children: o.headers.map((t) => {
212
- const r = t.column.getCanSort() ? t.column.getIsSorted() : !1, l = r === "asc" ? "ascending" : r === "desc" ? "descending" : t.column.getCanSort() ? "none" : void 0, i = t.column.columnDef.meta;
213
- return /* @__PURE__ */ a(
214
- Ae,
215
- {
216
- "aria-sort": l,
217
- colSpan: t.colSpan,
218
- minWidth: i?.minWidth,
219
- width: i?.width,
220
- children: t.isPlaceholder ? null : L(
221
- t.column.columnDef.header,
222
- t.getContext()
223
- )
94
+ function Ye({ table: e, dataHook: a, trackingEl: s, trackingLabel: o, size: l = "default", frame: r = "own", rowDividers: n = !1, isLoading: c = !1, refetching: u = !1, refetchingLabel: g, loadingLabel: i, skeletonRowCount: b, noResultsMessage: p, noResultsTitle: v, noResultsDescription: f, stickyHeader: m = !1, className: k, layout: x, minWidth: C, scrollRegionLabel: w, footer: A, getRowClassName: z, renderExpandedContent: S }, y) {
95
+ const R = e.getVisibleLeafColumns().length, H = b ?? e.getState().pagination.pageSize ?? 20, P = m === "page", D = d.useRef(null);
96
+ d.useImperativeHandle(y, () => D.current, []);
97
+ const N = Xe(D, P), M = !P || N, E = P ? N : !!C || m === !0 || w !== void 0;
98
+ return /* @__PURE__ */ T("div", {
99
+ ref: D,
100
+ className: h("relative", M ? "scrollbar overflow-auto" : "overflow-clip", r === "own" && "border-border rounded-md border", E && "focus-visible:shadow-default outline-none", k),
101
+ "data-frame": r,
102
+ "data-hook": a,
103
+ "data-overflowing": P && N ? "" : void 0,
104
+ "data-slot": "data-table-view",
105
+ "data-sticky-header": m === !1 ? void 0 : P ? "page" : "self",
106
+ "data-tracking-el": s,
107
+ "data-tracking-label": o,
108
+ ...E ? oe(w) : void 0,
109
+ children: [/* @__PURE__ */ t("div", {
110
+ "aria-live": "polite",
111
+ className: "sr-only",
112
+ role: "status",
113
+ children: u ? g ?? "Loading results…" : null
114
+ }), /* @__PURE__ */ t(q.Provider, {
115
+ value: u,
116
+ children: /* @__PURE__ */ T(le, {
117
+ "aria-busy": c || u || void 0,
118
+ dataHook: `${a}-table`,
119
+ frame: r,
120
+ layout: x,
121
+ minWidth: C,
122
+ rowDividers: n,
123
+ scrollOwner: "parent",
124
+ size: l,
125
+ children: [
126
+ /* @__PURE__ */ t(ue, {
127
+ sticky: P ? !N && "page" : m === !0 && "self",
128
+ table: e
129
+ }),
130
+ /* @__PURE__ */ t(re, { children: c ? /* @__PURE__ */ T($, { children: [/* @__PURE__ */ t(fe, {
131
+ colCount: R,
132
+ rowCount: H
133
+ }), /* @__PURE__ */ t(B, {
134
+ className: "sr-only",
135
+ children: /* @__PURE__ */ t(L, {
136
+ colSpan: R,
137
+ children: /* @__PURE__ */ t("div", {
138
+ "aria-live": "polite",
139
+ role: "status",
140
+ children: i ?? "Loading data…"
141
+ })
142
+ })
143
+ })] }) : /* @__PURE__ */ t($, { children: e.getRowModel().rows.length > 0 ? e.getRowModel().rows.map((F) => /* @__PURE__ */ t(ge, {
144
+ columnCount: R,
145
+ getRowClassName: z,
146
+ renderExpandedContent: S,
147
+ row: F
148
+ }, F.id)) : /* @__PURE__ */ t(se, {
149
+ colSpan: R,
150
+ children: p ?? /* @__PURE__ */ t(de, {
151
+ dataHook: a,
152
+ description: f,
153
+ table: e,
154
+ title: v
155
+ })
156
+ }) }) }),
157
+ A
158
+ ]
159
+ })
160
+ })]
161
+ });
162
+ }
163
+ var Je = d.forwardRef(Ye);
164
+ Je.displayName = "DataTable";
165
+ var Z = d.createContext(null), Y = () => () => {
166
+ };
167
+ function Ke() {
168
+ const [e] = d.useState(() => {
169
+ const a = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Set(), o = (l) => a.get(l) ?? null;
170
+ return {
171
+ set: (l, r) => {
172
+ const n = o(l);
173
+ n === r || n !== null && r !== null && n.displayed === r.displayed && n.live === r.live || (r === null ? a.delete(l) : a.set(l, r), s.forEach((c) => c()));
224
174
  },
225
- t.id
226
- );
227
- }) }, o.id)) });
175
+ get: o,
176
+ anyHeld: () => {
177
+ for (const l of a.values()) if (l.displayed !== l.live) return !0;
178
+ return !1;
179
+ },
180
+ subscribe: (l) => (s.add(l), () => {
181
+ s.delete(l);
182
+ })
183
+ };
184
+ });
185
+ return e;
186
+ }
187
+ function ue({ table: e, sticky: a }) {
188
+ const s = Ke();
189
+ return /* @__PURE__ */ t(Z.Provider, {
190
+ value: s,
191
+ children: /* @__PURE__ */ t(Ie, {
192
+ className: h(a === "self" && "sticky top-0 z-10", a === "page" && "sticky top-[var(--content-sticky-top,0px)] z-9"),
193
+ children: e.getHeaderGroups().map((o) => /* @__PURE__ */ t(B, { children: o.headers.map((l) => /* @__PURE__ */ t(Qe, { header: l }, l.id)) }, o.id))
194
+ })
195
+ });
228
196
  }
229
- function X({
230
- row: e,
231
- columnCount: n,
232
- getRowClassName: o,
233
- renderExpandedContent: t
234
- }) {
235
- const r = e.getCanExpand(), l = e.getIsExpanded(), i = t && r && l ? t(e) : null;
236
- return /* @__PURE__ */ x(T, { children: [
237
- /* @__PURE__ */ a(
238
- k,
239
- {
240
- className: g(
241
- // Rows have no hover of their own — the chevron/action buttons are
242
- // the interactive elements. Ghost buttons (the only bg-transparent
243
- // variant) get bg-secondary on hover because their default
244
- // hover:bg-accent is invisible on bg-muted rows (accent equals
245
- // muted in light mode). Scoped to .bg-transparent so variant
246
- // buttons in cells (primary, destructive, …) keep their own hover.
247
- "[&_[data-slot=button].bg-transparent:hover]:bg-secondary",
248
- // Surfaces are mutually exclusive: an expanded parent shares the
249
- // table head's bg-muted at ANY depth; other expanded-zone rows
250
- // (sub-rows) get the lighter accent wash.
251
- r && l ? "bg-muted" : e.depth > 0 && "bg-accent/50",
252
- o?.(e)
253
- ),
254
- "data-depth": e.depth,
255
- "data-expanded": r ? String(l) : void 0,
256
- "data-state": e.getIsSelected() ? "selected" : void 0,
257
- children: e.getVisibleCells().map((s) => /* @__PURE__ */ a(v, { children: L(s.column.columnDef.cell, s.getContext()) }, s.id))
258
- }
259
- ),
260
- i != null && // No data-depth here: panels are not data rows, and sharing the
261
- // parent's depth would break depth-based selectors and counts.
262
- /* @__PURE__ */ a(
263
- k,
264
- {
265
- className: "bg-accent/50 [&_[data-slot=button].bg-transparent:hover]:bg-secondary",
266
- "data-slot": "data-table-expanded-row",
267
- children: /* @__PURE__ */ a(v, { colSpan: n, children: i })
268
- }
269
- )
270
- ] });
197
+ function Qe({ header: e }) {
198
+ const a = d.useContext(Z), s = d.useSyncExternalStore(a ? a.subscribe : Y, () => a ? a.get(e.column.id)?.displayed ?? null : null, () => null), o = e.column.getCanSort(), l = o ? s ?? e.column.getIsSorted() : !1, r = l === "asc" ? "ascending" : l === "desc" ? "descending" : o ? "none" : void 0, n = e.column.columnDef.meta;
199
+ return /* @__PURE__ */ t(Ee, {
200
+ "aria-sort": r,
201
+ className: n?.pinned === "left" ? We : void 0,
202
+ colSpan: e.colSpan,
203
+ "data-pinned": n?.pinned === "left" ? "left" : void 0,
204
+ minWidth: n?.minWidth,
205
+ width: n?.width,
206
+ children: e.isPlaceholder ? null : ie(e.column.columnDef.header, e.getContext())
207
+ });
271
208
  }
272
- function q({
273
- rowCount: e,
274
- colCount: n
275
- }) {
276
- return /* @__PURE__ */ a(T, { children: Array.from({ length: e }).map((o, t) => /* @__PURE__ */ a(k, { children: Array.from({ length: n }).map((r, l) => /* @__PURE__ */ a(v, { children: /* @__PURE__ */ a(B, { className: "h-4 w-full" }) }, `skeleton-${t}-${l}`)) }, `skeleton-${t}`)) });
209
+ function ge({ row: e, columnCount: a, getRowClassName: s, renderExpandedContent: o }) {
210
+ const l = e.getCanExpand(), r = e.getIsExpanded(), n = o && l && r ? o(e) : null;
211
+ return /* @__PURE__ */ T($, { children: [/* @__PURE__ */ t(B, {
212
+ className: h("[&_[data-slot=button].bg-transparent:hover]:bg-secondary", l && r ? "bg-muted" : e.depth > 0 && "bg-accent/50", "data-[state=selected]:[--dt-row-bg:var(--muted)]", l && r ? "[--dt-row-bg:var(--muted)]" : e.depth > 0 && "[--dt-row-bg:color-mix(in_oklab,var(--accent)_50%,var(--background))]", s?.(e)),
213
+ "data-depth": e.depth,
214
+ "data-expanded": l ? String(r) : void 0,
215
+ "data-state": e.getIsSelected() ? "selected" : void 0,
216
+ children: e.getVisibleCells().map((c) => {
217
+ const u = c.column.columnDef.meta?.pinned === "left";
218
+ return /* @__PURE__ */ t(L, {
219
+ className: u ? Ue : void 0,
220
+ "data-pinned": u ? "left" : void 0,
221
+ groupStart: c.column.columnDef.meta?.groupStart,
222
+ children: ie(c.column.columnDef.cell, c.getContext())
223
+ }, c.id);
224
+ })
225
+ }), n != null && /* @__PURE__ */ t(B, {
226
+ className: "bg-accent/50 [&_[data-slot=button].bg-transparent:hover]:bg-secondary",
227
+ "data-slot": "data-table-expanded-row",
228
+ children: /* @__PURE__ */ t(L, {
229
+ colSpan: a,
230
+ children: n
231
+ })
232
+ })] });
277
233
  }
278
- function Ee({
279
- table: e,
280
- dataHook: n,
281
- trackingEl: o,
282
- trackingLabel: t,
283
- isLoading: r = !1,
284
- skeletonRowCount: l,
285
- noResultsMessage: i = "No results.",
286
- stickyHeader: s = !1,
287
- className: d,
288
- layout: c,
289
- minWidth: u,
290
- scrollRegionLabel: h,
291
- footer: b,
292
- getRowClassName: m,
293
- height: w,
294
- estimateSize: S = 48,
295
- overscan: P = 5
296
- }) {
297
- const f = e.getVisibleLeafColumns().length, E = l ?? e.getState().pagination.pageSize ?? 10, D = p.useRef(null), y = e.getRowModel().rows, N = me({
298
- count: y.length,
299
- getScrollElement: () => D.current,
300
- estimateSize: () => S,
301
- overscan: P
302
- }), C = N.getVirtualItems(), M = N.getTotalSize(), z = C.length > 0 ? C[0].start : 0, A = C.length > 0 ? M - C[C.length - 1].end : 0;
303
- return /* @__PURE__ */ a(
304
- "div",
305
- {
306
- ref: D,
307
- "aria-busy": r || void 0,
308
- className: g("border-border overflow-auto rounded-md border", d),
309
- "data-hook": n,
310
- "data-slot": "data-table-view",
311
- "data-tracking-el": o,
312
- "data-tracking-label": t,
313
- style: w != null ? { height: w } : void 0,
314
- children: /* @__PURE__ */ x(
315
- U,
316
- {
317
- dataHook: `${n}-table`,
318
- layout: c,
319
- minWidth: u,
320
- scrollRegionLabel: h,
321
- children: [
322
- /* @__PURE__ */ a(O, { stickyHeader: s, table: e }),
323
- /* @__PURE__ */ a(W, { children: r ? /* @__PURE__ */ x(T, { children: [
324
- /* @__PURE__ */ a(
325
- q,
326
- {
327
- colCount: f,
328
- rowCount: E
329
- }
330
- ),
331
- /* @__PURE__ */ a(k, { className: "sr-only", children: /* @__PURE__ */ a(v, { colSpan: f, children: /* @__PURE__ */ a("div", { "aria-live": "polite", role: "status", children: "Loading data…" }) }) })
332
- ] }) : y.length > 0 ? /* @__PURE__ */ x(T, { children: [
333
- z > 0 && /* @__PURE__ */ a("tr", { "aria-hidden": "true", children: /* @__PURE__ */ a("td", { colSpan: f, style: { height: z } }) }),
334
- C.map((F) => {
335
- const I = y[F.index];
336
- return /* @__PURE__ */ a(
337
- X,
338
- {
339
- columnCount: f,
340
- getRowClassName: m,
341
- row: I
342
- },
343
- I.id
344
- );
345
- }),
346
- A > 0 && /* @__PURE__ */ a("tr", { "aria-hidden": "true", children: /* @__PURE__ */ a("td", { colSpan: f, style: { height: A } }) })
347
- ] }) : /* @__PURE__ */ a(k, { children: /* @__PURE__ */ a(v, { align: "center", colSpan: f, size: "lg", children: /* @__PURE__ */ a("div", { "aria-live": "polite", className: "py-6", role: "status", children: i }) }) }) }),
348
- b
349
- ]
350
- }
351
- )
352
- }
353
- );
234
+ function fe({ rowCount: e, colCount: a }) {
235
+ return /* @__PURE__ */ t($, { children: Array.from({ length: e }).map((s, o) => /* @__PURE__ */ t(B, { children: Array.from({ length: a }).map((l, r) => /* @__PURE__ */ t(L, { children: /* @__PURE__ */ t(X, { className: "h-4 w-full" }) }, `skeleton-${o}-${r}`)) }, `skeleton-${o}`)) });
354
236
  }
355
- Ee.displayName = "VirtualizedDataTable";
356
- function Me({
357
- column: e,
358
- title: n,
359
- className: o,
360
- dataHook: t,
361
- trackingEl: r,
362
- trackingLabel: l,
363
- align: i = "left",
364
- getSortLabel: s
365
- }) {
366
- if (!e.getCanSort())
367
- return /* @__PURE__ */ a(
368
- "div",
369
- {
370
- className: g(
371
- "text-muted-foreground text-label text-left font-semibold",
372
- i === "right" && "text-right",
373
- i === "center" && "text-center",
374
- o
375
- ),
376
- "data-hook": t,
377
- "data-slot": "data-table-column-header",
378
- "data-tracking-el": r,
379
- "data-tracking-label": l,
380
- children: n
381
- }
382
- );
383
- const d = e.getIsSorted(), c = d === !1 ? e.columnDef.sortDescFirst === !0 : d === "asc", u = s ? s(n, d) : d === "desc" ? `Sort by ${n}, currently descending` : d === "asc" ? `Sort by ${n}, currently ascending` : `Sort by ${n}`;
384
- return /* @__PURE__ */ a(
385
- "div",
386
- {
387
- className: g(
388
- "flex items-center",
389
- i === "right" && "justify-end",
390
- i === "center" && "justify-center",
391
- o
392
- ),
393
- "data-slot": "data-table-column-header",
394
- "data-tracking-el": r,
395
- "data-tracking-label": l,
396
- children: /* @__PURE__ */ x(
397
- j,
398
- {
399
- "aria-label": u,
400
- className: "text-muted-foreground text-label h-auto p-0 font-semibold",
401
- dataHook: t || `column-header-${e.id}`,
402
- size: "sm",
403
- variant: "ghost",
404
- onClick: () => e.toggleSorting(c),
405
- children: [
406
- /* @__PURE__ */ a("span", { "aria-hidden": "true", children: n }),
407
- /* @__PURE__ */ a(
408
- "span",
409
- {
410
- "aria-hidden": "true",
411
- className: "flex size-3 items-center justify-center",
412
- children: d === "desc" ? /* @__PURE__ */ a(he, { size: 12 }) : d === "asc" ? /* @__PURE__ */ a(be, { size: 12 }) : /* @__PURE__ */ a(fe, { size: 12 })
413
- }
414
- )
415
- ]
416
- }
417
- )
418
- }
419
- );
237
+ function Ze({ table: e, dataHook: a, trackingEl: s, trackingLabel: o, size: l = "default", frame: r = "own", rowDividers: n = !1, isLoading: c = !1, refetching: u = !1, refetchingLabel: g, loadingLabel: i, skeletonRowCount: b, noResultsMessage: p, noResultsTitle: v, noResultsDescription: f, stickyHeader: m = !1, className: k, layout: x, minWidth: C, scrollRegionLabel: w, footer: A, getRowClassName: z, height: S, estimateSize: y, overscan: R = 5 }, H) {
238
+ const P = y ?? Ne[l], D = e.getVisibleLeafColumns().length, N = b ?? e.getState().pagination.pageSize ?? 20, M = d.useRef(null);
239
+ d.useImperativeHandle(H, () => M.current, []);
240
+ const E = e.getRowModel().rows, F = _e({
241
+ count: E.length,
242
+ getScrollElement: () => M.current,
243
+ estimateSize: () => P,
244
+ overscan: R
245
+ }), I = F.getVirtualItems(), W = F.getTotalSize(), O = I.length > 0 ? I[0].start : 0, V = I.length > 0 ? W - I[I.length - 1].end : 0;
246
+ return /* @__PURE__ */ T("div", {
247
+ ref: M,
248
+ className: h("scrollbar relative overflow-auto", r === "own" && "border-border rounded-md border", "focus-visible:shadow-default outline-none", k),
249
+ "data-frame": r,
250
+ "data-hook": a,
251
+ "data-slot": "data-table-view",
252
+ "data-tracking-el": s,
253
+ "data-tracking-label": o,
254
+ style: S != null ? { height: S } : void 0,
255
+ ...oe(w),
256
+ children: [/* @__PURE__ */ t("div", {
257
+ "aria-live": "polite",
258
+ className: "sr-only",
259
+ role: "status",
260
+ children: u ? g ?? "Loading results…" : null
261
+ }), /* @__PURE__ */ t(q.Provider, {
262
+ value: u,
263
+ children: /* @__PURE__ */ T(le, {
264
+ "aria-busy": c || u || void 0,
265
+ dataHook: `${a}-table`,
266
+ frame: r,
267
+ layout: x,
268
+ minWidth: C,
269
+ rowDividers: n,
270
+ scrollOwner: "parent",
271
+ size: l,
272
+ children: [
273
+ /* @__PURE__ */ t(ue, {
274
+ sticky: m && "self",
275
+ table: e
276
+ }),
277
+ /* @__PURE__ */ t(re, { children: c ? /* @__PURE__ */ T($, { children: [/* @__PURE__ */ t(fe, {
278
+ colCount: D,
279
+ rowCount: N
280
+ }), /* @__PURE__ */ t(B, {
281
+ className: "sr-only",
282
+ children: /* @__PURE__ */ t(L, {
283
+ colSpan: D,
284
+ children: /* @__PURE__ */ t("div", {
285
+ "aria-live": "polite",
286
+ role: "status",
287
+ children: i ?? "Loading data…"
288
+ })
289
+ })
290
+ })] }) : E.length > 0 ? /* @__PURE__ */ T($, { children: [
291
+ O > 0 && /* @__PURE__ */ t("tr", {
292
+ "aria-hidden": "true",
293
+ children: /* @__PURE__ */ t("td", {
294
+ colSpan: D,
295
+ style: { height: O }
296
+ })
297
+ }),
298
+ I.map((U) => {
299
+ const j = E[U.index];
300
+ return /* @__PURE__ */ t(ge, {
301
+ columnCount: D,
302
+ getRowClassName: z,
303
+ row: j
304
+ }, j.id);
305
+ }),
306
+ V > 0 && /* @__PURE__ */ t("tr", {
307
+ "aria-hidden": "true",
308
+ children: /* @__PURE__ */ t("td", {
309
+ colSpan: D,
310
+ style: { height: V }
311
+ })
312
+ })
313
+ ] }) : /* @__PURE__ */ t(se, {
314
+ colSpan: D,
315
+ children: p ?? /* @__PURE__ */ t(de, {
316
+ dataHook: a,
317
+ description: f,
318
+ table: e,
319
+ title: v
320
+ })
321
+ }) }),
322
+ A
323
+ ]
324
+ })
325
+ })]
326
+ });
327
+ }
328
+ var et = d.forwardRef(Ze);
329
+ et.displayName = "VirtualizedDataTable";
330
+ function tt({ column: e, title: a, className: s, dataHook: o, trackingEl: l, trackingLabel: r, align: n = "left", getSortLabel: c, loading: u = !1 }) {
331
+ const g = e.getIsSorted(), i = d.useContext(Z), b = d.useSyncExternalStore(i ? i.subscribe : Y, () => i ? i.get(e.id)?.displayed ?? null : null, () => null), [p, v] = d.useState(g);
332
+ !i && !u && p !== g && v(g);
333
+ const f = u ? i ? b ?? g : p : g, m = f !== g, k = d.useSyncExternalStore(i ? i.subscribe : Y, () => i ? i.anyHeld() : !1, () => !1), x = u && (m || !(i ? k : m) && g !== !1);
334
+ if (d.useLayoutEffect(() => {
335
+ if (i)
336
+ return i.set(e.id, {
337
+ displayed: f,
338
+ live: g
339
+ }), () => {
340
+ i.set(e.id, null);
341
+ };
342
+ }, [
343
+ i,
344
+ e.id,
345
+ f,
346
+ g
347
+ ]), !e.getCanSort()) return /* @__PURE__ */ t("div", {
348
+ className: h("text-muted-foreground text-label text-left font-semibold", n === "right" && "text-right", n === "center" && "text-center", s),
349
+ "data-hook": o,
350
+ "data-slot": "data-table-column-header",
351
+ "data-tracking-el": l,
352
+ "data-tracking-label": r,
353
+ children: a
354
+ });
355
+ const C = g === !1 ? e.columnDef.sortDescFirst === !0 : g === "asc", w = c ? c(a, f) : f === "desc" ? `Sort by ${a}, currently descending` : f === "asc" ? `Sort by ${a}, currently ascending` : `Sort by ${a}`;
356
+ return /* @__PURE__ */ t("div", {
357
+ className: h("flex items-center", n === "right" && "justify-end", n === "center" && "justify-center", s),
358
+ "data-slot": "data-table-column-header",
359
+ "data-tracking-el": l,
360
+ "data-tracking-label": r,
361
+ children: /* @__PURE__ */ T(te, {
362
+ "aria-busy": u ? "true" : void 0,
363
+ "aria-label": w,
364
+ className: "text-muted-foreground text-label h-auto p-0 font-semibold",
365
+ dataHook: o || `column-header-${e.id}`,
366
+ size: "sm",
367
+ variant: "ghost",
368
+ onClick: () => {
369
+ u || e.toggleSorting(C);
370
+ },
371
+ children: [/* @__PURE__ */ t("span", {
372
+ "aria-hidden": "true",
373
+ children: a
374
+ }), /* @__PURE__ */ t("span", {
375
+ "aria-hidden": "true",
376
+ className: "flex size-3 items-center justify-center",
377
+ children: x ? /* @__PURE__ */ t(ne, { size: "sm" }) : f === "desc" ? /* @__PURE__ */ t(ze, { size: 12 }) : f === "asc" ? /* @__PURE__ */ t(Me, { size: 12 }) : /* @__PURE__ */ t(Fe, { size: 12 })
378
+ })]
379
+ })
380
+ });
420
381
  }
421
- Me.displayName = "DataTableColumnHeader";
422
- function Fe({
423
- table: e,
424
- ariaLabel: n,
425
- placeholder: o,
426
- clearSearchAriaLabel: t,
427
- ...r
428
- }) {
429
- const l = e.getState().globalFilter ?? "", i = (s) => {
430
- e.setGlobalFilter(s);
382
+ tt.displayName = "DataTableColumnHeader";
383
+ var at = d.forwardRef(function({ table: a, ariaLabel: s, placeholder: o, clearSearchAriaLabel: l, disabled: r = !1, loading: n = !1, debounceMs: c, ...u }, g) {
384
+ const i = a.getState().globalFilter ?? "", [b, p] = d.useState(i), v = c ?? (a.options.manualFiltering === !0 ? 300 : 0), f = d.useRef(null), m = d.useCallback(() => {
385
+ f.current !== null && (clearTimeout(f.current), f.current = null);
386
+ }, []);
387
+ d.useEffect(() => m, [m]), d.useEffect(() => {
388
+ r && m();
389
+ }, [r, m]);
390
+ const k = d.useRef(b);
391
+ d.useEffect(() => {
392
+ k.current = b;
393
+ });
394
+ const [x, C] = d.useState({
395
+ filter: i,
396
+ pushed: []
397
+ }), w = (S) => {
398
+ (a.getState().globalFilter ?? "") !== S && (C((y) => ({
399
+ filter: y.filter,
400
+ pushed: [...y.pushed, S].slice(-10)
401
+ })), a.setGlobalFilter(S));
402
+ }, A = (S) => {
403
+ m(), v > 0 ? f.current = setTimeout(() => {
404
+ f.current = null, k.current === S && w(S);
405
+ }, v) : w(S);
406
+ };
407
+ if (i !== x.filter) {
408
+ const S = x.pushed.lastIndexOf(i), y = S !== -1;
409
+ C({
410
+ filter: i,
411
+ pushed: y ? x.pushed.slice(S + 1) : x.pushed
412
+ }), !y && i !== b && p(i);
413
+ }
414
+ const z = () => {
415
+ m(), p(""), w("");
431
416
  };
432
- return /* @__PURE__ */ x(Ce, { "data-slot": "data-table-search", ...r, children: [
433
- /* @__PURE__ */ a(G, { className: "pl-3", children: /* @__PURE__ */ a(we, {}) }),
434
- /* @__PURE__ */ a(
435
- ke,
436
- {
437
- "aria-label": n ?? "Search table",
417
+ return /* @__PURE__ */ T(me, {
418
+ "aria-busy": n ? "true" : void 0,
419
+ "data-slot": "data-table-search",
420
+ ...u,
421
+ children: [
422
+ /* @__PURE__ */ t(he, {
423
+ className: "pl-3",
424
+ children: n ? /* @__PURE__ */ t(ne, { dataHook: `${u.dataHook}-loading` }) : /* @__PURE__ */ t($e, {})
425
+ }),
426
+ /* @__PURE__ */ t(Se, {
427
+ ref: g,
428
+ "aria-label": s ?? "Search table",
429
+ disabled: r,
438
430
  placeholder: o ?? "Search...",
439
431
  type: "text",
440
- value: l,
441
- onChange: (s) => i(s.target.value)
442
- }
443
- ),
444
- l && /* @__PURE__ */ a(G, { className: "pr-1", children: /* @__PURE__ */ a(
445
- j,
446
- {
447
- "aria-label": t ?? "Clear search",
448
- className: "size-6 p-0",
432
+ value: b,
433
+ onChange: (S) => {
434
+ const y = S.target.value;
435
+ p(y), A(y);
436
+ }
437
+ }),
438
+ /* @__PURE__ */ t(ve, {
439
+ clearSearchAriaLabel: l,
449
440
  "data-slot": "data-table-search-clear",
450
- dataHook: `${r.dataHook}-clear`,
451
- variant: "ghost",
452
- onClick: () => i(""),
453
- children: /* @__PURE__ */ a(Se, { size: 14 })
454
- }
455
- ) })
456
- ] });
457
- }
458
- Fe.displayName = "DataTableSearch";
459
- function Be(e) {
460
- const { pageIndex: n, pageSize: o } = e.getState().pagination, t = e.getRowCount(), r = e.getPageCount(), l = e.getCanPreviousPage(), i = e.getCanNextPage(), s = n + 1, d = t === 0 ? 0 : n * o + 1, c = Math.min(s * o, t), u = p.useCallback(
461
- (w) => e.setPageIndex(w - 1),
462
- [e]
463
- ), h = p.useCallback(() => e.nextPage(), [e]), b = p.useCallback(() => e.previousPage(), [e]), m = p.useCallback(
464
- (w) => e.setPageSize(w),
465
- [e]
466
- );
467
- return p.useMemo(
468
- () => ({
469
- pageIndex: n,
470
- pageSize: o,
471
- totalRows: t,
472
- totalPages: r,
473
- startRow: d,
474
- endRow: c,
475
- currentPage: s,
476
- canPrev: l,
477
- canNext: i,
478
- goToPage: u,
479
- nextPage: h,
480
- previousPage: b,
481
- setPageSize: m
482
- }),
483
- [
484
- n,
485
- o,
486
- t,
487
- r,
488
- d,
489
- c,
490
- s,
491
- l,
492
- i,
493
- u,
494
- h,
495
- b,
496
- m
441
+ dataHook: `${u.dataHook}-clear`,
442
+ onClear: v > 0 ? z : void 0
443
+ })
497
444
  ]
498
- );
445
+ });
446
+ });
447
+ at.displayName = "DataTableSearch";
448
+ function nt(e) {
449
+ const { pageIndex: a, pageSize: s } = e.getState().pagination, o = e.getRowCount(), l = e.getPageCount(), r = e.getCanPreviousPage(), n = e.getCanNextPage(), c = a + 1, u = o === 0 ? 0 : a * s + 1, g = Math.min(c * s, o), i = d.useCallback((f) => e.setPageIndex(f - 1), [e]), b = d.useCallback(() => e.nextPage(), [e]), p = d.useCallback(() => e.previousPage(), [e]), v = d.useCallback((f) => e.setPageSize(f), [e]);
450
+ return d.useMemo(() => ({
451
+ pageIndex: a,
452
+ pageSize: s,
453
+ totalRows: o,
454
+ totalPages: l,
455
+ startRow: u,
456
+ endRow: g,
457
+ currentPage: c,
458
+ canPrev: r,
459
+ canNext: n,
460
+ goToPage: i,
461
+ nextPage: b,
462
+ previousPage: p,
463
+ setPageSize: v
464
+ }), [
465
+ a,
466
+ s,
467
+ o,
468
+ l,
469
+ u,
470
+ g,
471
+ c,
472
+ r,
473
+ n,
474
+ i,
475
+ b,
476
+ p,
477
+ v
478
+ ]);
499
479
  }
500
- const H = p.createContext(null);
501
- function J() {
502
- const e = p.useContext(H);
503
- if (!e)
504
- throw new Error(
505
- "DataTablePagination sub-components must be used within <DataTablePagination>"
506
- );
480
+ var J = d.createContext(null);
481
+ function pe() {
482
+ const e = d.useContext(J);
483
+ if (!e) throw new Error("DataTablePagination sub-components must be used within <DataTablePagination>");
507
484
  return e;
508
485
  }
509
- function He({
510
- renderText: e,
511
- className: n
512
- }) {
513
- const { info: o } = J(), t = V("sm"), { startRow: r, endRow: l, totalRows: i, pageIndex: s, pageSize: d } = o;
514
- if (t) return null;
515
- const c = e ? e({ startRow: r, endRow: l, totalRows: i, pageIndex: s, pageSize: d }) : i === 0 ? null : `${r}-${l} of ${i}`;
516
- return c == null ? null : /* @__PURE__ */ a(
517
- "span",
518
- {
519
- className: g(
520
- "text-body-sm text-muted-foreground whitespace-nowrap",
521
- n
522
- ),
486
+ function K({ label: e, labelOne: a, emptyLabel: s, renderText: o, dataHook: l, className: r }) {
487
+ const { info: n, dataHook: c } = pe(), u = Q("sm"), { startRow: g, endRow: i, totalRows: b, pageIndex: p, pageSize: v } = n;
488
+ if (u) return null;
489
+ if (o) {
490
+ const f = o({
491
+ startRow: g,
492
+ endRow: i,
493
+ totalRows: b,
494
+ pageIndex: p,
495
+ pageSize: v
496
+ });
497
+ return f == null ? null : /* @__PURE__ */ t("span", {
498
+ className: h("text-body-sm text-muted-foreground whitespace-nowrap", r),
499
+ "data-hook": l ?? `${c}-row-count`,
523
500
  "data-slot": "data-table-pagination-row-count",
524
- children: c
525
- }
526
- );
501
+ children: f
502
+ });
503
+ }
504
+ return /* @__PURE__ */ t(xe, {
505
+ className: h("whitespace-nowrap", r),
506
+ dataHook: l ?? `${c}-row-count`,
507
+ emptyLabel: s,
508
+ from: g,
509
+ rangeLabel: e,
510
+ rangeLabelOne: a,
511
+ to: i,
512
+ total: b
513
+ });
527
514
  }
528
- He.displayName = "DataTablePaginationRowCount";
529
- function K({
530
- ariaLabel: e = "Table pagination",
531
- dataHook: n,
532
- className: o
533
- }) {
534
- const { info: t } = J(), r = V("sm"), l = ve({
535
- page: t.currentPage,
536
- totalPages: t.totalPages
515
+ K.displayName = "DataTablePaginationRowCount";
516
+ function be({ ariaLabel: e = "Table pagination", dataHook: a, className: s }) {
517
+ const { info: o } = pe(), l = Q("sm"), r = Pe({
518
+ page: o.currentPage,
519
+ totalPages: o.totalPages
520
+ });
521
+ return o.totalPages <= 1 ? null : /* @__PURE__ */ t(we, {
522
+ ariaLabel: e,
523
+ className: h(!l && "mx-0 w-auto justify-end", s),
524
+ dataHook: a ?? "pagination-nav",
525
+ children: /* @__PURE__ */ t(Ce, { children: r.map((n, c) => n === "previous" ? /* @__PURE__ */ t(G, { children: /* @__PURE__ */ t(De, {
526
+ disabled: !o.canPrev,
527
+ onClick: () => o.previousPage()
528
+ }) }, "previous") : n === "next" ? /* @__PURE__ */ t(G, { children: /* @__PURE__ */ t(Te, {
529
+ disabled: !o.canNext,
530
+ onClick: () => o.nextPage()
531
+ }) }, "next") : n === "ellipsis" ? /* @__PURE__ */ t(G, { children: /* @__PURE__ */ t(ye, {}) }, `ellipsis-${c}`) : /* @__PURE__ */ t(G, { children: /* @__PURE__ */ t(ke, {
532
+ isActive: n === o.currentPage,
533
+ page: n,
534
+ onClick: () => o.goToPage(n)
535
+ }) }, n)) })
537
536
  });
538
- return t.totalPages <= 1 ? null : /* @__PURE__ */ a(
539
- Te,
540
- {
541
- ariaLabel: e,
542
- className: g(!r && "mx-0 w-auto justify-end", o),
543
- dataHook: n ?? "pagination-nav",
544
- children: /* @__PURE__ */ a(Pe, { children: l.map((i, s) => i === "previous" ? /* @__PURE__ */ a($, { children: /* @__PURE__ */ a(
545
- ye,
546
- {
547
- disabled: !t.canPrev,
548
- onClick: () => t.previousPage()
549
- }
550
- ) }, "previous") : i === "next" ? /* @__PURE__ */ a($, { children: /* @__PURE__ */ a(
551
- Re,
552
- {
553
- disabled: !t.canNext,
554
- onClick: () => t.nextPage()
555
- }
556
- ) }, "next") : i === "ellipsis" ? /* @__PURE__ */ a($, { children: /* @__PURE__ */ a(De, {}) }, `ellipsis-${s}`) : /* @__PURE__ */ a($, { children: /* @__PURE__ */ a(
557
- Ne,
558
- {
559
- isActive: i === t.currentPage,
560
- page: i,
561
- onClick: () => t.goToPage(i)
562
- }
563
- ) }, i)) })
564
- }
565
- );
566
537
  }
567
- K.displayName = "DataTablePaginationNav";
568
- function Ve({
569
- table: e,
570
- dataHook: n,
571
- showRowCount: o = !0,
572
- renderRowCount: t,
573
- trackingEl: r,
574
- trackingLabel: l,
575
- className: i,
576
- ariaLabel: s = "Table pagination",
577
- children: d
578
- }) {
579
- const c = Be(e), u = V("sm"), h = p.useMemo(
580
- () => ({ info: c }),
581
- [c]
582
- ), b = {
583
- "data-hook": n,
538
+ be.displayName = "DataTablePaginationNav";
539
+ function ot({ table: e, dataHook: a, showRowCount: s = !0, rowCountLabel: o, rowCountLabelOne: l, rowCountEmptyLabel: r, renderRowCount: n, trackingEl: c, trackingLabel: u, className: g, ariaLabel: i = "Table pagination", children: b }) {
540
+ const p = nt(e), v = Q("sm"), f = d.useMemo(() => ({
541
+ info: p,
542
+ dataHook: a
543
+ }), [p, a]), m = {
544
+ "data-hook": a,
584
545
  "data-slot": "data-table-pagination",
585
- "data-tracking-el": r,
586
- "data-tracking-label": l
546
+ "data-tracking-el": c,
547
+ "data-tracking-label": u
587
548
  };
588
- if (d)
589
- return /* @__PURE__ */ a(H.Provider, { value: h, children: /* @__PURE__ */ a(
590
- "div",
591
- {
592
- className: g(
593
- "flex w-full flex-wrap items-center gap-x-4 gap-y-2",
594
- i
595
- ),
596
- ...b,
597
- children: d
598
- }
599
- ) });
600
- const m = u || !o || t === null ? null : t ? t({
601
- startRow: c.startRow,
602
- endRow: c.endRow,
603
- totalRows: c.totalRows,
604
- pageIndex: c.pageIndex,
605
- pageSize: c.pageSize
606
- }) : c.totalRows === 0 ? null : `${c.startRow}-${c.endRow} of ${c.totalRows}`;
607
- return m == null && c.totalPages <= 1 ? null : /* @__PURE__ */ a(H.Provider, { value: h, children: /* @__PURE__ */ x(
608
- "div",
609
- {
610
- className: g(
611
- "flex min-h-9 w-full flex-wrap items-center gap-x-4 gap-y-2",
612
- m != null ? "justify-between" : "justify-end",
613
- i
614
- ),
615
- ...b,
616
- children: [
617
- m != null && /* @__PURE__ */ a("span", { className: "text-body-sm text-muted-foreground whitespace-nowrap", children: m }),
618
- /* @__PURE__ */ a(
619
- K,
620
- {
621
- ariaLabel: s,
622
- className: "grow",
623
- dataHook: `${n}-nav`
624
- }
625
- )
626
- ]
627
- }
628
- ) });
549
+ if (b) return /* @__PURE__ */ t(J.Provider, {
550
+ value: f,
551
+ children: /* @__PURE__ */ t("div", {
552
+ className: h("flex w-full flex-wrap items-center gap-x-4 gap-y-2", g),
553
+ ...m,
554
+ children: b
555
+ })
556
+ });
557
+ const k = n && s && !v ? n({
558
+ startRow: p.startRow,
559
+ endRow: p.endRow,
560
+ totalRows: p.totalRows,
561
+ pageIndex: p.pageIndex,
562
+ pageSize: p.pageSize
563
+ }) : null, x = !v && s && n !== null && (n ? k != null : !0), C = x && (!!n || p.totalRows > 0), w = p.totalPages > 1;
564
+ return !x && !w ? null : /* @__PURE__ */ t(J.Provider, {
565
+ value: f,
566
+ children: /* @__PURE__ */ T("div", {
567
+ className: h("flex w-full flex-wrap items-center gap-x-4 gap-y-2", (C || w) && "min-h-9", C ? "justify-between" : "justify-end", g),
568
+ ...m,
569
+ children: [x && (n ? /* @__PURE__ */ t(K, { renderText: () => k }) : /* @__PURE__ */ t(K, {
570
+ emptyLabel: r,
571
+ label: o,
572
+ labelOne: l
573
+ })), /* @__PURE__ */ t(be, {
574
+ ariaLabel: i,
575
+ className: "grow",
576
+ dataHook: `${a}-nav`
577
+ })]
578
+ })
579
+ });
629
580
  }
630
- Ve.displayName = "DataTablePagination";
631
- function je({
632
- table: e,
633
- dataHook: n,
634
- trackingEl: o,
635
- trackingLabel: t,
636
- selectAllAriaLabel: r
637
- }) {
638
- return /* @__PURE__ */ a(
639
- _,
640
- {
641
- "aria-label": r ?? "Select all",
642
- checked: e.getIsAllPageRowsSelected() || e.getIsSomePageRowsSelected() && "indeterminate",
643
- dataHook: n || "select-all-checkbox",
644
- trackingEl: o,
645
- trackingLabel: t,
646
- onCheckedChange: (l) => e.toggleAllPageRowsSelected(!!l)
581
+ ot.displayName = "DataTablePagination";
582
+ function lt({ table: e, dataHook: a, trackingEl: s, trackingLabel: o, selectAllAriaLabel: l }) {
583
+ const r = d.useContext(q);
584
+ return /* @__PURE__ */ t(ae, {
585
+ "aria-disabled": r || void 0,
586
+ "aria-label": l ?? "Select all",
587
+ checked: e.getIsAllPageRowsSelected(),
588
+ dataHook: a || "select-all-checkbox",
589
+ trackingEl: s,
590
+ trackingLabel: o,
591
+ onCheckedChange: (n) => {
592
+ r || e.toggleAllPageRowsSelected(!!n);
647
593
  }
648
- );
594
+ });
649
595
  }
650
- je.displayName = "DataTableSelectAllCheckbox";
651
- function Ge({
652
- row: e,
653
- dataHook: n,
654
- trackingEl: o,
655
- trackingLabel: t,
656
- selectRowAriaLabel: r
657
- }) {
658
- return /* @__PURE__ */ a(
659
- _,
660
- {
661
- "aria-label": r ?? "Select row",
662
- checked: e.getIsSelected(),
663
- dataHook: n || `select-row-${e.id}`,
664
- disabled: !e.getCanSelect(),
665
- trackingEl: o,
666
- trackingLabel: t,
667
- onCheckedChange: (l) => e.toggleSelected(!!l)
596
+ lt.displayName = "DataTableSelectAllCheckbox";
597
+ function rt({ row: e, dataHook: a, trackingEl: s, trackingLabel: o, selectRowAriaLabel: l }) {
598
+ const r = d.useContext(q);
599
+ return /* @__PURE__ */ t(ae, {
600
+ "aria-disabled": r || void 0,
601
+ "aria-label": l ?? "Select row",
602
+ checked: e.getIsSelected(),
603
+ dataHook: a || `select-row-${e.id}`,
604
+ disabled: !e.getCanSelect(),
605
+ trackingEl: s,
606
+ trackingLabel: o,
607
+ onCheckedChange: (n) => {
608
+ r || e.toggleSelected(!!n);
668
609
  }
669
- );
610
+ });
670
611
  }
671
- Ge.displayName = "DataTableSelectRowCheckbox";
672
- function Le({
673
- row: e,
674
- rowName: n,
675
- dataHook: o,
676
- trackingEl: t,
677
- trackingLabel: r,
678
- expandLabel: l,
679
- collapseLabel: i,
680
- className: s
681
- }) {
682
- if (!e.getCanExpand())
683
- return /* @__PURE__ */ a(
684
- "span",
685
- {
686
- "aria-hidden": "true",
687
- className: g("inline-block size-9", s),
688
- "data-slot": "data-table-expand-row-spacer"
689
- }
690
- );
691
- const d = e.getIsExpanded(), c = d ? i : l;
692
- let u;
693
- return c && (n !== void 0 || !c.includes("{name}")) ? u = c.replaceAll("{name}", n ?? "") : n !== void 0 ? u = d ? `Collapse details for ${n}` : `Expand details for ${n}` : u = d ? "Collapse row" : "Expand row", /* @__PURE__ */ a(
694
- j,
695
- {
696
- iconOnly: !0,
697
- "aria-expanded": d,
698
- "aria-label": u,
699
- className: s,
700
- "data-state": d ? "open" : "closed",
701
- dataHook: o || `expand-row-${e.id}`,
702
- size: "sm",
703
- trackingEl: t,
704
- trackingLabel: r,
705
- variant: "ghost",
706
- onClick: e.getToggleExpandedHandler(),
707
- children: /* @__PURE__ */ a(
708
- xe,
709
- {
710
- "aria-hidden": "true",
711
- className: g(
712
- "duration-base transition-transform ease-in-out",
713
- d && "rotate-90"
714
- )
715
- }
716
- )
717
- }
718
- );
612
+ rt.displayName = "DataTableSelectRowCheckbox";
613
+ function st({ row: e, rowName: a, dataHook: s, trackingEl: o, trackingLabel: l, expandLabel: r, collapseLabel: n, className: c }) {
614
+ if (!e.getCanExpand()) return /* @__PURE__ */ t("span", {
615
+ "aria-hidden": "true",
616
+ className: h("inline-block size-9", c),
617
+ "data-slot": "data-table-expand-row-spacer"
618
+ });
619
+ const u = e.getIsExpanded(), g = u ? n : r;
620
+ let i;
621
+ return g && (a !== void 0 || !g.includes("{name}")) ? i = g.replaceAll("{name}", a ?? "") : a !== void 0 ? i = u ? `Collapse details for ${a}` : `Expand details for ${a}` : i = u ? "Collapse row" : "Expand row", /* @__PURE__ */ t(te, {
622
+ iconOnly: !0,
623
+ "aria-expanded": u,
624
+ "aria-label": i,
625
+ className: c,
626
+ "data-state": u ? "open" : "closed",
627
+ dataHook: s || `expand-row-${e.id}`,
628
+ size: "sm",
629
+ trackingEl: o,
630
+ trackingLabel: l,
631
+ variant: "ghost",
632
+ onClick: e.getToggleExpandedHandler(),
633
+ children: /* @__PURE__ */ t(Be, {
634
+ "aria-hidden": "true",
635
+ className: h("duration-base transition-transform ease-in-out", u && "rotate-90")
636
+ })
637
+ });
719
638
  }
720
- Le.displayName = "DataTableExpandRowButton";
721
- function _e({
722
- fields: e = 3,
723
- loadingLabel: n,
724
- dataHook: o,
725
- className: t
726
- }) {
727
- return /* @__PURE__ */ x(
728
- "div",
729
- {
730
- className: g("relative flex flex-col gap-2 py-1", t),
731
- "data-hook": o || "data-table-expanded-skeleton",
732
- "data-slot": "data-table-expanded-skeleton",
733
- role: "status",
734
- children: [
735
- /* @__PURE__ */ a("span", { className: "sr-only", children: n ?? "Loading details" }),
736
- Array.from({ length: e }, (r, l) => /* @__PURE__ */ x("div", { "aria-hidden": "true", className: "flex items-center gap-4", children: [
737
- /* @__PURE__ */ a(B, { className: "h-4 w-24 shrink-0" }),
738
- /* @__PURE__ */ a(B, { className: "h-4 w-48 max-w-full" })
739
- ] }, l))
740
- ]
741
- }
742
- );
639
+ st.displayName = "DataTableExpandRowButton";
640
+ function it({ fields: e = 3, loadingLabel: a, dataHook: s, className: o }) {
641
+ return /* @__PURE__ */ T("div", {
642
+ className: h("relative flex flex-col gap-2 py-1", o),
643
+ "data-hook": s || "data-table-expanded-skeleton",
644
+ "data-slot": "data-table-expanded-skeleton",
645
+ role: "status",
646
+ children: [/* @__PURE__ */ t("span", {
647
+ className: "sr-only",
648
+ children: a ?? "Loading details"
649
+ }), Array.from({ length: e }, (l, r) => /* @__PURE__ */ T("div", {
650
+ "aria-hidden": "true",
651
+ className: "flex items-center gap-4",
652
+ children: [/* @__PURE__ */ t(X, { className: "h-4 w-24 shrink-0" }), /* @__PURE__ */ t(X, { className: "h-4 w-48 max-w-full" })]
653
+ }, r))]
654
+ });
743
655
  }
744
- _e.displayName = "DataTableExpandedSkeleton";
745
- const Q = p.createContext(null);
746
- function Ue() {
747
- const e = p.useContext(Q);
748
- if (!e)
749
- throw new Error(
750
- "DataTableBulkActions components must be used within <DataTableBulkActions>"
751
- );
656
+ it.displayName = "DataTableExpandedSkeleton";
657
+ var ee = d.createContext(null);
658
+ function ct() {
659
+ const e = d.useContext(ee);
660
+ if (!e) throw new Error("DataTableBulkActions components must be used within <DataTableBulkActions>");
752
661
  return e;
753
662
  }
754
- function We({
755
- table: e,
756
- dataHook: n,
757
- trackingEl: o,
758
- trackingLabel: t,
759
- className: r,
760
- children: l
761
- }) {
762
- const i = e.getFilteredSelectedRowModel().rows.length, s = e.getRowCount(), d = p.useMemo(
763
- () => ({ selectedCount: i, totalCount: s }),
764
- [i, s]
765
- );
766
- return i === 0 ? null : /* @__PURE__ */ a(Q.Provider, { value: d, children: /* @__PURE__ */ a(
767
- "div",
768
- {
769
- className: g("flex items-center gap-2.5", r),
770
- "data-hook": n,
663
+ function dt({ table: e, dataHook: a, trackingEl: s, trackingLabel: o, className: l, children: r, refetching: n = !1 }) {
664
+ const c = e.getFilteredSelectedRowModel().rows.length, u = e.getRowCount(), g = d.useMemo(() => ({
665
+ selectedCount: c,
666
+ totalCount: u,
667
+ refetching: n
668
+ }), [
669
+ c,
670
+ u,
671
+ n
672
+ ]);
673
+ return c === 0 ? null : /* @__PURE__ */ t(ee.Provider, {
674
+ value: g,
675
+ children: /* @__PURE__ */ t("div", {
676
+ "aria-busy": n || void 0,
677
+ className: h("flex items-center gap-2.5", l),
678
+ "data-hook": a,
771
679
  "data-slot": "data-table-bulk-actions",
772
- "data-tracking-el": o ?? "data-table-bulk-actions",
773
- "data-tracking-label": t,
774
- children: l
775
- }
776
- ) });
680
+ "data-tracking-el": s ?? "data-table-bulk-actions",
681
+ "data-tracking-label": o,
682
+ children: r
683
+ })
684
+ });
777
685
  }
778
- We.displayName = "DataTableBulkActions";
779
- function Oe({
780
- dataHook: e = "data-table-bulk-actions-summary",
781
- className: n,
782
- children: o
783
- }) {
784
- const { selectedCount: t, totalCount: r } = Ue();
785
- let l;
786
- return typeof o == "function" ? l = o({ selectedCount: t, totalCount: r }) : o != null ? l = o : l = `${t} of ${r} row(s) selected.`, /* @__PURE__ */ a(
787
- Ie,
788
- {
789
- asChild: !0,
790
- className: g("min-w-0", n),
791
- dataHook: e,
792
- children: /* @__PURE__ */ a("span", { "data-slot": "data-table-bulk-actions-summary", role: "status", children: l })
793
- }
794
- );
686
+ dt.displayName = "DataTableBulkActions";
687
+ function ut({ dataHook: e = "data-table-bulk-actions-summary", className: a, children: s }) {
688
+ const o = ct(), { selectedCount: l, totalCount: r } = o;
689
+ let n;
690
+ return typeof s == "function" ? n = s(o) : s != null ? n = s : n = `${l} of ${r} row(s) selected.`, /* @__PURE__ */ t(Ae, {
691
+ asChild: !0,
692
+ className: h("min-w-0", a),
693
+ dataHook: e,
694
+ children: /* @__PURE__ */ t("span", {
695
+ "data-slot": "data-table-bulk-actions-summary",
696
+ role: "status",
697
+ children: n
698
+ })
699
+ });
795
700
  }
796
- Oe.displayName = "DataTableBulkActionsSummary";
797
- function Xe({
798
- dataHook: e = "data-table-bulk-actions-actions",
799
- className: n,
800
- children: o
801
- }) {
802
- return /* @__PURE__ */ a(
803
- "div",
804
- {
805
- className: g("flex shrink-0 items-center gap-2", n),
806
- "data-hook": e,
807
- "data-slot": "data-table-bulk-actions-actions",
808
- children: o
809
- }
810
- );
701
+ ut.displayName = "DataTableBulkActionsSummary";
702
+ function gt({ dataHook: e = "data-table-bulk-actions-actions", className: a, children: s }) {
703
+ const o = d.useContext(ee)?.refetching ?? !1;
704
+ return /* @__PURE__ */ t("div", {
705
+ className: h("flex shrink-0 items-center gap-2", a),
706
+ "data-hook": e,
707
+ "data-slot": "data-table-bulk-actions-actions",
708
+ inert: o || void 0,
709
+ children: s
710
+ });
811
711
  }
812
- Xe.displayName = "DataTableBulkActionsActions";
813
- function qe({
814
- dataHook: e,
815
- className: n,
816
- children: o
817
- }) {
818
- return /* @__PURE__ */ a(
819
- "div",
820
- {
821
- className: g(
822
- "flex flex-col gap-3 py-4 sm:flex-row sm:items-center",
823
- n
824
- ),
825
- "data-hook": e,
826
- "data-slot": "data-table-toolbar",
827
- children: o
828
- }
829
- );
712
+ gt.displayName = "DataTableBulkActionsActions";
713
+ function ft({ dataHook: e, className: a, children: s }) {
714
+ return /* @__PURE__ */ t("div", {
715
+ className: h("flex flex-col gap-3 py-4 sm:flex-row sm:flex-wrap sm:items-center", a),
716
+ "data-hook": e,
717
+ "data-slot": "data-table-toolbar",
718
+ children: s
719
+ });
830
720
  }
831
- qe.displayName = "DataTableToolbar";
832
- function Je({
833
- className: e,
834
- children: n
835
- }) {
836
- return /* @__PURE__ */ a(
837
- "div",
838
- {
839
- className: g(
840
- "flex w-full min-w-0 items-center gap-2 sm:w-auto sm:flex-1",
841
- e
842
- ),
843
- "data-slot": "data-table-toolbar-left",
844
- children: n
845
- }
846
- );
721
+ ft.displayName = "DataTableToolbar";
722
+ function pt({ className: e, children: a }) {
723
+ return /* @__PURE__ */ t("div", {
724
+ className: h("flex w-full min-w-0 items-center gap-2 sm:w-auto sm:flex-auto", e),
725
+ "data-slot": "data-table-toolbar-left",
726
+ children: a
727
+ });
847
728
  }
848
- Je.displayName = "DataTableToolbarLeft";
849
- function Ke({
850
- className: e,
851
- children: n
852
- }) {
853
- return /* @__PURE__ */ a(
854
- "div",
855
- {
856
- className: g(
857
- "flex w-full items-center justify-end gap-2 sm:w-auto",
858
- e
859
- ),
860
- "data-slot": "data-table-toolbar-right",
861
- children: n
862
- }
863
- );
729
+ pt.displayName = "DataTableToolbarLeft";
730
+ function bt({ className: e, children: a }) {
731
+ return /* @__PURE__ */ t("div", {
732
+ className: h("flex w-full items-center justify-end gap-2 sm:ml-auto sm:w-auto", e),
733
+ "data-slot": "data-table-toolbar-right",
734
+ children: a
735
+ });
864
736
  }
865
- Ke.displayName = "DataTableToolbarRight";
737
+ bt.displayName = "DataTableToolbarRight";
866
738
  export {
867
- $e as DataTable,
868
- We as DataTableBulkActions,
869
- Xe as DataTableBulkActionsActions,
870
- Oe as DataTableBulkActionsSummary,
871
- Me as DataTableColumnHeader,
872
- Le as DataTableExpandRowButton,
873
- _e as DataTableExpandedSkeleton,
874
- Ve as DataTablePagination,
875
- K as DataTablePaginationNav,
876
- He as DataTablePaginationRowCount,
877
- Fe as DataTableSearch,
878
- je as DataTableSelectAllCheckbox,
879
- Ge as DataTableSelectRowCheckbox,
880
- qe as DataTableToolbar,
881
- Je as DataTableToolbarLeft,
882
- Ke as DataTableToolbarRight,
883
- Ee as VirtualizedDataTable,
884
- da as useDataTable,
885
- Ue as useDataTableBulkActionsContext
739
+ Je as DataTable,
740
+ dt as DataTableBulkActions,
741
+ gt as DataTableBulkActionsActions,
742
+ ut as DataTableBulkActionsSummary,
743
+ tt as DataTableColumnHeader,
744
+ st as DataTableExpandRowButton,
745
+ it as DataTableExpandedSkeleton,
746
+ ot as DataTablePagination,
747
+ be as DataTablePaginationNav,
748
+ K as DataTablePaginationRowCount,
749
+ at as DataTableSearch,
750
+ lt as DataTableSelectAllCheckbox,
751
+ rt as DataTableSelectRowCheckbox,
752
+ ft as DataTableToolbar,
753
+ pt as DataTableToolbarLeft,
754
+ bt as DataTableToolbarRight,
755
+ et as VirtualizedDataTable,
756
+ Mt as useDataTable,
757
+ ct as useDataTableBulkActionsContext,
758
+ nt as useDataTablePagination
886
759
  };