@middag-io/react 0.44.1 → 0.45.2

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 (362) hide show
  1. package/README.md +7 -0
  2. package/dist-lib/{FormField-Bj43PjHH.js → FormField-Csx8hGAW.js} +1956 -1936
  3. package/dist-lib/{FormPanelBlock-C6eDfGoI.js → FormPanelBlock-Bmd0DpiX.js} +337 -337
  4. package/dist-lib/base/blocks/DenseTableBlock.d.ts.map +1 -1
  5. package/dist-lib/base/blocks/LinkListBlock.d.ts +2 -1
  6. package/dist-lib/base/blocks/LinkListBlock.d.ts.map +1 -1
  7. package/dist-lib/base/form/FormField.d.ts.map +1 -1
  8. package/dist-lib/base/layout/DashboardLayout.d.ts.map +1 -1
  9. package/dist-lib/base/partials/ConfirmationDialog/index.d.ts.map +1 -1
  10. package/dist-lib/base/partials/DataTable/cell-renderers.d.ts +1 -1
  11. package/dist-lib/base/partials/DataTable/cell-renderers.d.ts.map +1 -1
  12. package/dist-lib/base/partials/DataTable/index.d.ts +1 -1
  13. package/dist-lib/base/partials/DataTable/index.d.ts.map +1 -1
  14. package/dist-lib/base/partials/DataTable/sanitize-html.d.ts +17 -0
  15. package/dist-lib/base/partials/DataTable/sanitize-html.d.ts.map +1 -0
  16. package/dist-lib/base/partials/DataTable/types.d.ts +15 -0
  17. package/dist-lib/base/partials/DataTable/types.d.ts.map +1 -1
  18. package/dist-lib/base/partials/FilterBar/index.d.ts.map +1 -1
  19. package/dist-lib/base/shell/BasicShell.js +1 -1
  20. package/dist-lib/base/shell/partials/InlineEditablePanel.js +38 -24
  21. package/dist-lib/base/shell/partials/PageActionButton.d.ts.map +1 -1
  22. package/dist-lib/base/shell/partials/PageActionButton.js +1 -1
  23. package/dist-lib/chunks/subpath-Bh1MAmBT.js +165 -0
  24. package/dist-lib/chunks/{subpath-AeMdleNB.js → subpath-fEhy6n_U.js} +10 -6
  25. package/dist-lib/contracts/block-data/data-display.d.ts +51 -2
  26. package/dist-lib/contracts/block-data/data-display.d.ts.map +1 -1
  27. package/dist-lib/contracts/generated/contract-schema.d.ts +1 -1
  28. package/dist-lib/contracts/generated/contract-types.d.ts +4 -2
  29. package/dist-lib/contracts/generated/contract-types.d.ts.map +1 -1
  30. package/dist-lib/contracts/generated/index.d.ts +1 -1
  31. package/dist-lib/i18n/I18nProvider.js +1 -1
  32. package/dist-lib/i18n/instance.js +1 -1
  33. package/dist-lib/i18n/locales/en/ui.json +5 -3
  34. package/dist-lib/i18n/locales/pt-BR/ui.json +5 -3
  35. package/dist-lib/i18n/register-strings.js +1 -1
  36. package/dist-lib/index.d.ts +1 -1
  37. package/dist-lib/index.d.ts.map +1 -1
  38. package/dist-lib/middag-react.css +1 -1
  39. package/dist-lib/middag-react.js +18641 -13317
  40. package/dist-lib/primitives/reui/chart.d.ts.map +1 -1
  41. package/dist-lib/primitives/reui/chart.js +35 -31
  42. package/docs/public/schemas/ai-contract-manifest.json +1820 -0
  43. package/docs/public/schemas/blocks.json +445 -0
  44. package/docs/public/schemas/components.json +166 -0
  45. package/docs/public/schemas/connectors.json +97 -0
  46. package/docs/public/schemas/fragment.json +2329 -0
  47. package/docs/public/schemas/manifest.json +119 -0
  48. package/docs/public/schemas/navigation.json +72 -0
  49. package/docs/public/schemas/page-contract.json +2329 -0
  50. package/docs/public/schemas/shared-props.json +118 -0
  51. package/docs/public/schemas/theme-defaults.json +253 -0
  52. package/docs/public/schemas/theme.json +401 -0
  53. package/package.json +109 -3
  54. package/src/assets/lottie/calendar/schedule-1.json +1 -0
  55. package/src/assets/lottie/calendar/schedule-2.json +1 -0
  56. package/src/assets/lottie/celebration/confetti-1.json +1 -0
  57. package/src/assets/lottie/celebration/confetti-2.json +1 -0
  58. package/src/assets/lottie/celebration/confetti-3.json +1 -0
  59. package/src/assets/lottie/cloud/cloud-1.json +1 -0
  60. package/src/assets/lottie/cloud/cloud-2.json +1 -0
  61. package/src/assets/lottie/connection/network-1.json +1 -0
  62. package/src/assets/lottie/connection/network-2.json +1 -0
  63. package/src/assets/lottie/connection/network-3.json +1 -0
  64. package/src/assets/lottie/dashboard/analytics-1.json +1 -0
  65. package/src/assets/lottie/dashboard/analytics-2.json +1 -0
  66. package/src/assets/lottie/dashboard/analytics-3.json +1 -0
  67. package/src/assets/lottie/email/mail-1.json +1 -0
  68. package/src/assets/lottie/email/mail-2.json +1 -0
  69. package/src/assets/lottie/email/mail-3.json +1 -0
  70. package/src/assets/lottie/empty-state/empty-1.json +1 -0
  71. package/src/assets/lottie/empty-state/empty-2.json +1 -0
  72. package/src/assets/lottie/empty-state/empty-3.json +1 -0
  73. package/src/assets/lottie/error/warning-1.json +1 -0
  74. package/src/assets/lottie/error/warning-2.json +1 -0
  75. package/src/assets/lottie/error/warning-3.json +1 -0
  76. package/src/assets/lottie/index.ts +49 -0
  77. package/src/assets/lottie/loading/spinner-1.json +1 -0
  78. package/src/assets/lottie/loading/spinner-2.json +1 -0
  79. package/src/assets/lottie/loading/spinner-3.json +1 -0
  80. package/src/assets/lottie/maintenance/construction-1.json +1 -0
  81. package/src/assets/lottie/maintenance/construction-2.json +1 -0
  82. package/src/assets/lottie/maintenance/construction-3.json +1 -0
  83. package/src/assets/lottie/not-found/404-1.json +1 -0
  84. package/src/assets/lottie/not-found/404-2.json +1 -0
  85. package/src/assets/lottie/not-found/404-3.json +1 -0
  86. package/src/assets/lottie/notification/bell-1.json +1 -0
  87. package/src/assets/lottie/notification/bell-2.json +1 -0
  88. package/src/assets/lottie/notification/bell-3.json +1 -0
  89. package/src/assets/lottie/onboarding/welcome-1.json +1 -0
  90. package/src/assets/lottie/onboarding/welcome-2.json +1 -0
  91. package/src/assets/lottie/onboarding/welcome-3.json +1 -0
  92. package/src/assets/lottie/payment/wallet-1.json +1 -0
  93. package/src/assets/lottie/payment/wallet-2.json +1 -0
  94. package/src/assets/lottie/payment/wallet-3.json +1 -0
  95. package/src/assets/lottie/search/search-1.json +1 -0
  96. package/src/assets/lottie/search/search-2.json +1 -0
  97. package/src/assets/lottie/search/search-3.json +1 -0
  98. package/src/assets/lottie/security/lock-1.json +1 -0
  99. package/src/assets/lottie/security/lock-2.json +1 -0
  100. package/src/assets/lottie/security/lock-3.json +1 -0
  101. package/src/assets/lottie/settings/gear-1.json +1 -0
  102. package/src/assets/lottie/settings/gear-2.json +1 -0
  103. package/src/assets/lottie/settings/gear-3.json +1 -0
  104. package/src/assets/lottie/success/check-1.json +1 -0
  105. package/src/assets/lottie/success/check-2.json +1 -0
  106. package/src/assets/lottie/success/check-3.json +1 -0
  107. package/src/assets/lottie/upload/upload-1.json +1 -0
  108. package/src/assets/lottie/upload/upload-2.json +1 -0
  109. package/src/assets/lottie/upload/upload-3.json +1 -0
  110. package/src/assets/lottie/user/profile-1.json +1 -0
  111. package/src/assets/lottie/user/profile-2.json +1 -0
  112. package/src/assets/lottie/user/profile-3.json +1 -0
  113. package/src/base/blocks/ActionGridBlock.tsx +151 -0
  114. package/src/base/blocks/ActivityTimelineBlock.tsx +180 -0
  115. package/src/base/blocks/CardGridBlock.tsx +384 -0
  116. package/src/base/blocks/ChartBlock.tsx +81 -0
  117. package/src/base/blocks/DenseTableBlock.tsx +403 -0
  118. package/src/base/blocks/DetailPanelBlock.tsx +189 -0
  119. package/src/base/blocks/EmptyStateBlock.tsx +46 -0
  120. package/src/base/blocks/FormPanelBlock.lazy.tsx +38 -0
  121. package/src/base/blocks/FormPanelBlock.tsx +480 -0
  122. package/src/base/blocks/LinkListBlock.tsx +94 -0
  123. package/src/base/blocks/MarkdownPanelBlock.tsx +60 -0
  124. package/src/base/blocks/MetricCardBlock.tsx +128 -0
  125. package/src/base/blocks/StatusStripBlock.tsx +43 -0
  126. package/src/base/blocks/TabsBlock.tsx +94 -0
  127. package/src/base/form/FormField.tsx +607 -0
  128. package/src/base/form/fields/CheckboxField.tsx +56 -0
  129. package/src/base/form/fields/ColorField.tsx +76 -0
  130. package/src/base/form/fields/CurrencyField.tsx +126 -0
  131. package/src/base/form/fields/DateField.tsx +168 -0
  132. package/src/base/form/fields/DateRangeField.tsx +66 -0
  133. package/src/base/form/fields/DocumentField.tsx +222 -0
  134. package/src/base/form/fields/EntityPickerField.tsx +244 -0
  135. package/src/base/form/fields/FileUploadField.tsx +253 -0
  136. package/src/base/form/fields/MultiSelectField.tsx +286 -0
  137. package/src/base/form/fields/NativeSelectField.tsx +67 -0
  138. package/src/base/form/fields/NumberField.tsx +67 -0
  139. package/src/base/form/fields/OtpField.tsx +88 -0
  140. package/src/base/form/fields/PasswordField.tsx +69 -0
  141. package/src/base/form/fields/PhoneField.tsx +64 -0
  142. package/src/base/form/fields/RadioField.tsx +66 -0
  143. package/src/base/form/fields/RatingField.tsx +52 -0
  144. package/src/base/form/fields/SelectField.tsx +76 -0
  145. package/src/base/form/fields/SliderField.tsx +77 -0
  146. package/src/base/form/fields/SlugField.tsx +114 -0
  147. package/src/base/form/fields/StaticField.tsx +25 -0
  148. package/src/base/form/fields/SwitchField.tsx +56 -0
  149. package/src/base/form/fields/TagsField.tsx +128 -0
  150. package/src/base/form/fields/TextField.tsx +55 -0
  151. package/src/base/form/fields/TextareaField.tsx +55 -0
  152. package/src/base/form/fields/document-validation.ts +126 -0
  153. package/src/base/form/fields/field-registry.ts +53 -0
  154. package/src/base/form/fields/register-default-fields.ts +86 -0
  155. package/src/base/form/form-schema-builder.ts +192 -0
  156. package/src/base/form/form-utils.ts +71 -0
  157. package/src/base/hooks/useIsDark.ts +50 -0
  158. package/src/base/hooks/useLazyTabs.ts +98 -0
  159. package/src/base/hooks/usePolling.ts +43 -0
  160. package/src/base/hooks/useRemember.ts +58 -0
  161. package/src/base/hooks/useToast.ts +27 -0
  162. package/src/base/layout/BlockRegion.tsx +39 -0
  163. package/src/base/layout/DashboardLayout.tsx +110 -0
  164. package/src/base/layout/SidebarLayout.tsx +38 -0
  165. package/src/base/layout/StackLayout.tsx +32 -0
  166. package/src/base/layout/WizardLayout.tsx +49 -0
  167. package/src/base/partials/ActionBar/index.tsx +115 -0
  168. package/src/base/partials/ConfirmationDialog/index.tsx +128 -0
  169. package/src/base/partials/DataTable/cell-registry.ts +50 -0
  170. package/src/base/partials/DataTable/cell-renderers.tsx +372 -0
  171. package/src/base/partials/DataTable/index.tsx +1282 -0
  172. package/src/base/partials/DataTable/register-default-cells.ts +37 -0
  173. package/src/base/partials/DataTable/sanitize-html.ts +45 -0
  174. package/src/base/partials/DataTable/types.ts +229 -0
  175. package/src/base/partials/DetailSection/index.tsx +316 -0
  176. package/src/base/partials/EmptyPlaceholder/index.tsx +162 -0
  177. package/src/base/partials/EntityItem/index.tsx +154 -0
  178. package/src/base/partials/FilterBar/index.tsx +256 -0
  179. package/src/base/partials/FormSection/index.tsx +87 -0
  180. package/src/base/partials/LogViewer/JsonBlock.tsx +39 -0
  181. package/src/base/partials/LogViewer/LogEntry.tsx +68 -0
  182. package/src/base/partials/LogViewer/LogViewerToolbar.tsx +71 -0
  183. package/src/base/partials/LogViewer/index.tsx +110 -0
  184. package/src/base/partials/LogViewer/types.ts +28 -0
  185. package/src/base/partials/MarkdownContent/index.tsx +307 -0
  186. package/src/base/partials/MenuBar/index.tsx +80 -0
  187. package/src/base/partials/QuickRecordSheet/index.tsx +59 -0
  188. package/src/base/partials/ResizableSidebar/index.tsx +70 -0
  189. package/src/base/partials/StatRow/index.tsx +28 -0
  190. package/src/base/partials/StatusBar/index.tsx +126 -0
  191. package/src/base/partials/StatusIndicator/index.tsx +61 -0
  192. package/src/base/partials/StepIndicator/index.tsx +63 -0
  193. package/src/base/partials/TableOfContents/index.tsx +78 -0
  194. package/src/base/partials/TimelineList/index.tsx +273 -0
  195. package/src/base/partials/ToggleGroupControl/index.tsx +100 -0
  196. package/src/base/partials/TreeView/index.tsx +75 -0
  197. package/src/base/partials/index.ts +23 -0
  198. package/src/base/shell/AuthShell.tsx +54 -0
  199. package/src/base/shell/BasicShell.tsx +286 -0
  200. package/src/base/shell/ImmersiveShell.tsx +85 -0
  201. package/src/base/shell/partials/EditablePanelContext.tsx +82 -0
  202. package/src/base/shell/partials/EditablePanelProvider.tsx +122 -0
  203. package/src/base/shell/partials/InlineEditablePanel.tsx +239 -0
  204. package/src/base/shell/partials/InspectorContext.tsx +173 -0
  205. package/src/base/shell/partials/InspectorPanel.tsx +65 -0
  206. package/src/base/shell/partials/NavErrorBoundary.tsx +82 -0
  207. package/src/base/shell/partials/OverlayScreen.tsx +67 -0
  208. package/src/base/shell/partials/PageActionButton.tsx +203 -0
  209. package/src/base/theme/appearance.ts +133 -0
  210. package/src/base/theme/host-layout-detector.ts +119 -0
  211. package/src/base/theme/host-theme-detector.ts +146 -0
  212. package/src/base/theme/sidebar-safelist.txt +20 -0
  213. package/src/base/theme/tailwind-theme.css +136 -0
  214. package/src/base/theme/theme-bridge.css +164 -0
  215. package/src/base/theme/theme-context.tsx +142 -0
  216. package/src/base/theme/themes/classic.css +174 -0
  217. package/src/base/theme/tokens.css +290 -0
  218. package/src/base/theme/useHostTheme.ts +95 -0
  219. package/src/base/utils/clipboard.ts +39 -0
  220. package/src/base/utils/conditions.ts +27 -0
  221. package/src/base/utils/icon-registry.ts +78 -0
  222. package/src/base/utils/icons.ts +31 -0
  223. package/src/base/utils/interpolate.ts +9 -0
  224. package/src/base/utils/register-default-icons.ts +163 -0
  225. package/src/base/utils/storage.ts +65 -0
  226. package/src/base/utils/time.ts +139 -0
  227. package/src/contracts/block-data/actions.ts +73 -0
  228. package/src/contracts/block-data/data-display.ts +343 -0
  229. package/src/contracts/block-data/form.ts +164 -0
  230. package/src/contracts/block-data/index.ts +15 -0
  231. package/src/contracts/block-data/interactive.ts +34 -0
  232. package/src/contracts/block-data/shared.ts +44 -0
  233. package/src/contracts/connectors.ts +60 -0
  234. package/src/contracts/generated/contract-schema.ts +1237 -0
  235. package/src/contracts/generated/contract-types.ts +675 -0
  236. package/src/contracts/generated/index.ts +15 -0
  237. package/src/contracts/navigation.ts +59 -0
  238. package/src/contracts/page-contract-schema.ts +40 -0
  239. package/src/contracts/page-contract.ts +79 -0
  240. package/src/contracts/shared-props.ts +92 -0
  241. package/src/engine/ContractPage.tsx +178 -0
  242. package/src/engine/EntityRoutes.tsx +72 -0
  243. package/src/engine/HostSlot.tsx +126 -0
  244. package/src/engine/LazyBlock.tsx +92 -0
  245. package/src/engine/bootstrap.tsx +20 -0
  246. package/src/engine/providers/auth.tsx +87 -0
  247. package/src/engine/providers/error-reporter.tsx +89 -0
  248. package/src/engine/providers/flash.tsx +44 -0
  249. package/src/engine/providers/index.ts +18 -0
  250. package/src/engine/providers/inertia-error-reporter.tsx +61 -0
  251. package/src/engine/providers/progress.tsx +56 -0
  252. package/src/engine/providers/scope.tsx +51 -0
  253. package/src/engine/register-defaults.ts +88 -0
  254. package/src/engine/registries.ts +96 -0
  255. package/src/i18n/I18nProvider.tsx +53 -0
  256. package/src/i18n/MANIFEST.md +101 -0
  257. package/src/i18n/host-resolver.ts +18 -0
  258. package/src/i18n/instance.ts +69 -0
  259. package/src/i18n/locales/en/ui.json +277 -0
  260. package/src/i18n/locales/en/validators.json +13 -0
  261. package/src/i18n/locales/pt-BR/ui.json +277 -0
  262. package/src/i18n/locales/pt-BR/validators.json +13 -0
  263. package/src/i18n/register-strings.ts +10 -0
  264. package/src/i18n/render-label.ts +33 -0
  265. package/src/i18n/resolve-field-error.ts +29 -0
  266. package/src/i18n/useHostString.ts +50 -0
  267. package/src/i18n/useTranslation.ts +83 -0
  268. package/src/lib/actions/resolve-action-target.ts +151 -0
  269. package/src/lib/hooks/use-copy-to-clipboard.ts +37 -0
  270. package/src/lib/hooks/use-file-upload.ts +406 -0
  271. package/src/lib/hooks/use-mobile.ts +21 -0
  272. package/src/lib/host-pending.ts +76 -0
  273. package/src/lib/portal-container.ts +16 -0
  274. package/src/lib/test-ids.ts +40 -0
  275. package/src/lib/utils.ts +6 -0
  276. package/src/primitives/reui/MANIFEST.md +97 -0
  277. package/src/primitives/reui/accordion.tsx +64 -0
  278. package/src/primitives/reui/alert-dialog.tsx +196 -0
  279. package/src/primitives/reui/alert.tsx +92 -0
  280. package/src/primitives/reui/aspect-ratio.tsx +9 -0
  281. package/src/primitives/reui/autocomplete.tsx +343 -0
  282. package/src/primitives/reui/avatar.tsx +109 -0
  283. package/src/primitives/reui/badge.tsx +94 -0
  284. package/src/primitives/reui/breadcrumb.tsx +109 -0
  285. package/src/primitives/reui/button-group.tsx +83 -0
  286. package/src/primitives/reui/button.tsx +64 -0
  287. package/src/primitives/reui/calendar.tsx +220 -0
  288. package/src/primitives/reui/card.tsx +92 -0
  289. package/src/primitives/reui/carousel.tsx +239 -0
  290. package/src/primitives/reui/chart.tsx +388 -0
  291. package/src/primitives/reui/checkbox.tsx +30 -0
  292. package/src/primitives/reui/collapsible.tsx +31 -0
  293. package/src/primitives/reui/combobox.tsx +308 -0
  294. package/src/primitives/reui/command.tsx +182 -0
  295. package/src/primitives/reui/context-menu.tsx +250 -0
  296. package/src/primitives/reui/data-grid/data-grid-column-filter.tsx +172 -0
  297. package/src/primitives/reui/data-grid/data-grid-column-header.tsx +420 -0
  298. package/src/primitives/reui/data-grid/data-grid-column-visibility.tsx +51 -0
  299. package/src/primitives/reui/data-grid/data-grid-pagination.tsx +235 -0
  300. package/src/primitives/reui/data-grid/data-grid-scroll-area.tsx +427 -0
  301. package/src/primitives/reui/data-grid/data-grid-table-dnd-rows.tsx +308 -0
  302. package/src/primitives/reui/data-grid/data-grid-table-dnd.tsx +318 -0
  303. package/src/primitives/reui/data-grid/data-grid-table-virtual.tsx +491 -0
  304. package/src/primitives/reui/data-grid/data-grid-table.tsx +1430 -0
  305. package/src/primitives/reui/data-grid/data-grid.tsx +269 -0
  306. package/src/primitives/reui/data-grid-pagination.tsx +235 -0
  307. package/src/primitives/reui/date-selector.tsx +1353 -0
  308. package/src/primitives/reui/dialog.tsx +158 -0
  309. package/src/primitives/reui/drawer.tsx +133 -0
  310. package/src/primitives/reui/dropdown-menu.tsx +257 -0
  311. package/src/primitives/reui/empty.tsx +104 -0
  312. package/src/primitives/reui/field.tsx +246 -0
  313. package/src/primitives/reui/filters.tsx +1891 -0
  314. package/src/primitives/reui/frame.tsx +170 -0
  315. package/src/primitives/reui/hover-card.tsx +42 -0
  316. package/src/primitives/reui/icon-placeholder.tsx +39 -0
  317. package/src/primitives/reui/index.ts +98 -0
  318. package/src/primitives/reui/input-group.tsx +170 -0
  319. package/src/primitives/reui/input-otp.tsx +75 -0
  320. package/src/primitives/reui/input.tsx +21 -0
  321. package/src/primitives/reui/item.tsx +193 -0
  322. package/src/primitives/reui/kanban.tsx +743 -0
  323. package/src/primitives/reui/kbd.tsx +28 -0
  324. package/src/primitives/reui/label.tsx +22 -0
  325. package/src/primitives/reui/menubar.tsx +274 -0
  326. package/src/primitives/reui/native-select.tsx +62 -0
  327. package/src/primitives/reui/navigation-menu.tsx +168 -0
  328. package/src/primitives/reui/number-field.tsx +250 -0
  329. package/src/primitives/reui/pagination.tsx +127 -0
  330. package/src/primitives/reui/phone-input.tsx +231 -0
  331. package/src/primitives/reui/popover.tsx +87 -0
  332. package/src/primitives/reui/progress.tsx +31 -0
  333. package/src/primitives/reui/radio-group.tsx +43 -0
  334. package/src/primitives/reui/rating.tsx +177 -0
  335. package/src/primitives/reui/resizable.tsx +51 -0
  336. package/src/primitives/reui/scroll-area.tsx +58 -0
  337. package/src/primitives/reui/scrollspy.tsx +240 -0
  338. package/src/primitives/reui/select.tsx +188 -0
  339. package/src/primitives/reui/separator.tsx +28 -0
  340. package/src/primitives/reui/sheet.tsx +141 -0
  341. package/src/primitives/reui/sidebar.tsx +732 -0
  342. package/src/primitives/reui/skeleton.tsx +13 -0
  343. package/src/primitives/reui/slider.tsx +61 -0
  344. package/src/primitives/reui/sonner.tsx +47 -0
  345. package/src/primitives/reui/sortable.tsx +414 -0
  346. package/src/primitives/reui/spinner.tsx +16 -0
  347. package/src/primitives/reui/stepper.tsx +484 -0
  348. package/src/primitives/reui/svgs/claudeAiIcon.tsx +12 -0
  349. package/src/primitives/reui/svgs/gemini.tsx +171 -0
  350. package/src/primitives/reui/svgs/openai.tsx +9 -0
  351. package/src/primitives/reui/svgs/openaiDark.tsx +12 -0
  352. package/src/primitives/reui/switch.tsx +33 -0
  353. package/src/primitives/reui/table.tsx +114 -0
  354. package/src/primitives/reui/tabs.tsx +91 -0
  355. package/src/primitives/reui/textarea.tsx +18 -0
  356. package/src/primitives/reui/timeline.tsx +219 -0
  357. package/src/primitives/reui/toggle-group.tsx +83 -0
  358. package/src/primitives/reui/toggle.tsx +45 -0
  359. package/src/primitives/reui/tooltip.tsx +55 -0
  360. package/src/primitives/reui/tree.tsx +247 -0
  361. package/src/theme.css +71 -0
  362. package/dist-lib/chunks/subpath-q4Q2zg_p.js +0 -153
@@ -0,0 +1,1430 @@
1
+ import {
2
+ CSSProperties,
3
+ Fragment,
4
+ memo,
5
+ MouseEvent as ReactMouseEvent,
6
+ ReactNode,
7
+ TouchEvent as ReactTouchEvent,
8
+ Ref,
9
+ useCallback,
10
+ useEffect,
11
+ useMemo,
12
+ useState,
13
+ } from "react";
14
+ import { useDataGrid } from "@/primitives/reui/data-grid/data-grid";
15
+ import {
16
+ Cell,
17
+ Column,
18
+ flexRender,
19
+ Header,
20
+ HeaderGroup,
21
+ Row,
22
+ Table,
23
+ } from "@tanstack/react-table";
24
+ import { cva } from "class-variance-authority";
25
+
26
+ import { cn } from "@/lib/utils";
27
+ import { Checkbox } from "@/primitives/reui/checkbox";
28
+ import { Spinner } from "@/primitives/reui/spinner";
29
+
30
+ const headerCellSpacingVariants = cva("", {
31
+ variants: {
32
+ size: {
33
+ dense: "px-2.5 h-9",
34
+ default: "px-4",
35
+ },
36
+ },
37
+ defaultVariants: {
38
+ size: "default",
39
+ },
40
+ });
41
+
42
+ const bodyCellSpacingVariants = cva("", {
43
+ variants: {
44
+ size: {
45
+ dense: "px-2.5 py-2",
46
+ default: "px-4 py-2.5",
47
+ },
48
+ },
49
+ defaultVariants: {
50
+ size: "default",
51
+ },
52
+ });
53
+
54
+ const footerCellSpacingVariants = cva("", {
55
+ variants: {
56
+ size: {
57
+ dense: "px-2.5 py-2",
58
+ default: "px-4 py-2.5",
59
+ },
60
+ },
61
+ defaultVariants: {
62
+ size: "default",
63
+ },
64
+ });
65
+
66
+ function getPinningStyles<TData>(column: Column<TData>): CSSProperties {
67
+ const isPinned = column.getIsPinned();
68
+
69
+ return {
70
+ left: isPinned === "left" ? `${column.getStart("left")}px` : undefined,
71
+ right: isPinned === "right" ? `${column.getAfter("right")}px` : undefined,
72
+ position: isPinned ? "sticky" : "relative",
73
+ width: column.getSize(),
74
+ zIndex: isPinned ? 1 : 0,
75
+ };
76
+ }
77
+
78
+ function assignRef<T>(ref: Ref<T> | undefined, value: T | null) {
79
+ if (!ref) return;
80
+
81
+ if (typeof ref === "function") {
82
+ ref(value);
83
+ return;
84
+ }
85
+
86
+ (ref as { current: T | null }).current = value;
87
+ }
88
+
89
+ type DataGridResizeStartEvent =
90
+ | ReactMouseEvent<HTMLDivElement>
91
+ | ReactTouchEvent<HTMLDivElement>;
92
+
93
+ type DataGridResizeDocumentEvent =
94
+ | globalThis.MouseEvent
95
+ | globalThis.TouchEvent;
96
+
97
+ function isDataGridTouchEvent(
98
+ event: DataGridResizeStartEvent | DataGridResizeDocumentEvent,
99
+ ): event is ReactTouchEvent<HTMLDivElement> | globalThis.TouchEvent {
100
+ return "touches" in event;
101
+ }
102
+
103
+ function getDataGridResizeEventClientX(
104
+ event: DataGridResizeStartEvent | DataGridResizeDocumentEvent,
105
+ ) {
106
+ if (isDataGridTouchEvent(event)) {
107
+ return event.touches[0]?.clientX ?? event.changedTouches[0]?.clientX;
108
+ }
109
+
110
+ return event.clientX;
111
+ }
112
+
113
+ function startDataGridColumnResizeOnEnd<TData>(
114
+ event: DataGridResizeStartEvent,
115
+ header: Header<TData, unknown>,
116
+ table: Table<TData>,
117
+ ) {
118
+ const column = table.getColumn(header.column.id);
119
+
120
+ if (!column || !column.getCanResize()) return;
121
+ if (isDataGridTouchEvent(event) && event.touches.length > 1) return;
122
+
123
+ event.persist?.();
124
+
125
+ const ownerDocument = event.currentTarget.ownerDocument;
126
+ const previousBodyCursor = ownerDocument.body.style.cursor;
127
+ const previousDocumentCursor = ownerDocument.documentElement.style.cursor;
128
+ const startSize = header.getSize();
129
+ const dragStartClientX = getDataGridResizeEventClientX(event);
130
+ const headerCell = event.currentTarget.closest("th");
131
+ const headerRect = headerCell?.getBoundingClientRect();
132
+ const startOffset =
133
+ headerRect &&
134
+ Number.isFinite(
135
+ table.options.columnResizeDirection === "rtl"
136
+ ? headerRect.left
137
+ : headerRect.right,
138
+ )
139
+ ? table.options.columnResizeDirection === "rtl"
140
+ ? headerRect.left
141
+ : headerRect.right
142
+ : dragStartClientX;
143
+
144
+ if (typeof dragStartClientX !== "number" || typeof startOffset !== "number") {
145
+ return;
146
+ }
147
+
148
+ ownerDocument.body.style.cursor = "col-resize";
149
+ ownerDocument.documentElement.style.cursor = "col-resize";
150
+
151
+ const columnSizingStart = header
152
+ .getLeafHeaders()
153
+ .map(
154
+ (leafHeader) =>
155
+ [leafHeader.column.id, leafHeader.column.getSize()] as [string, number],
156
+ );
157
+ const directionMultiplier =
158
+ table.options.columnResizeDirection === "rtl" ? -1 : 1;
159
+
160
+ const updateOffset = (clientXPos?: number, commit = false) => {
161
+ if (typeof clientXPos !== "number") return;
162
+
163
+ let nextColumnSizing: Record<string, number> = {};
164
+ const deltaOffset = (clientXPos - dragStartClientX) * directionMultiplier;
165
+ const deltaPercentage = Math.max(deltaOffset / startSize, -0.999999);
166
+
167
+ columnSizingStart.forEach(([columnId, headerSize]) => {
168
+ nextColumnSizing[columnId] =
169
+ Math.round(
170
+ Math.max(headerSize + headerSize * deltaPercentage, 0) * 100,
171
+ ) / 100;
172
+ });
173
+
174
+ table.setColumnSizingInfo((old) => ({
175
+ ...old,
176
+ startOffset,
177
+ startSize,
178
+ deltaOffset,
179
+ deltaPercentage,
180
+ columnSizingStart,
181
+ isResizingColumn: column.id,
182
+ }));
183
+
184
+ if (commit) {
185
+ table.setColumnSizing((old) => ({
186
+ ...old,
187
+ ...nextColumnSizing,
188
+ }));
189
+ }
190
+ };
191
+
192
+ const endResize = (clientXPos?: number) => {
193
+ updateOffset(clientXPos, true);
194
+ table.setColumnSizingInfo((old) => ({
195
+ ...old,
196
+ isResizingColumn: false,
197
+ startOffset: null,
198
+ startSize: null,
199
+ deltaOffset: null,
200
+ deltaPercentage: null,
201
+ columnSizingStart: [],
202
+ }));
203
+ ownerDocument.body.style.cursor = previousBodyCursor;
204
+ ownerDocument.documentElement.style.cursor = previousDocumentCursor;
205
+ };
206
+
207
+ const mouseMoveHandler = (moveEvent: globalThis.MouseEvent) => {
208
+ updateOffset(moveEvent.clientX);
209
+ };
210
+ const mouseUpHandler = (upEvent: globalThis.MouseEvent) => {
211
+ ownerDocument.removeEventListener("mousemove", mouseMoveHandler);
212
+ ownerDocument.removeEventListener("mouseup", mouseUpHandler);
213
+ endResize(upEvent.clientX);
214
+ };
215
+ const touchMoveHandler = (moveEvent: globalThis.TouchEvent) => {
216
+ if (moveEvent.cancelable) {
217
+ moveEvent.preventDefault();
218
+ moveEvent.stopPropagation();
219
+ }
220
+
221
+ updateOffset(getDataGridResizeEventClientX(moveEvent));
222
+ };
223
+ const touchEndHandler = (endEvent: globalThis.TouchEvent) => {
224
+ ownerDocument.removeEventListener("touchmove", touchMoveHandler);
225
+ ownerDocument.removeEventListener("touchend", touchEndHandler);
226
+
227
+ if (endEvent.cancelable) {
228
+ endEvent.preventDefault();
229
+ endEvent.stopPropagation();
230
+ }
231
+
232
+ endResize(getDataGridResizeEventClientX(endEvent));
233
+ };
234
+
235
+ const passiveIfSupported = { passive: false } as const;
236
+
237
+ if (isDataGridTouchEvent(event)) {
238
+ ownerDocument.addEventListener(
239
+ "touchmove",
240
+ touchMoveHandler,
241
+ passiveIfSupported,
242
+ );
243
+ ownerDocument.addEventListener(
244
+ "touchend",
245
+ touchEndHandler,
246
+ passiveIfSupported,
247
+ );
248
+ } else {
249
+ ownerDocument.addEventListener(
250
+ "mousemove",
251
+ mouseMoveHandler,
252
+ passiveIfSupported,
253
+ );
254
+ ownerDocument.addEventListener(
255
+ "mouseup",
256
+ mouseUpHandler,
257
+ passiveIfSupported,
258
+ );
259
+ }
260
+
261
+ table.setColumnSizingInfo((old) => ({
262
+ ...old,
263
+ startOffset,
264
+ startSize,
265
+ deltaOffset: 0,
266
+ deltaPercentage: 0,
267
+ columnSizingStart,
268
+ isResizingColumn: column.id,
269
+ }));
270
+ }
271
+
272
+ type DataGridTablePinnedBoundary = "top" | "bottom";
273
+
274
+ function getDataGridTableRowSections<TData>(
275
+ table: Table<TData>,
276
+ rowsPinnable?: boolean,
277
+ ) {
278
+ if (!rowsPinnable) {
279
+ return {
280
+ topRows: [] as Row<TData>[],
281
+ centerRows: table.getRowModel().rows as Row<TData>[],
282
+ bottomRows: [] as Row<TData>[],
283
+ };
284
+ }
285
+
286
+ return {
287
+ topRows: table.getTopRows() as Row<TData>[],
288
+ centerRows: table.getCenterRows() as Row<TData>[],
289
+ bottomRows: table.getBottomRows() as Row<TData>[],
290
+ };
291
+ }
292
+
293
+ function getDataGridTableResolvedRows<TData>(
294
+ table: Table<TData>,
295
+ rowsPinnable?: boolean,
296
+ ) {
297
+ const { topRows, centerRows, bottomRows } = getDataGridTableRowSections(
298
+ table,
299
+ rowsPinnable,
300
+ );
301
+ const resolvedRows: Array<{
302
+ row: Row<TData>;
303
+ pinnedBoundary?: DataGridTablePinnedBoundary;
304
+ }> = [];
305
+
306
+ topRows.forEach((row, index) => {
307
+ resolvedRows.push({
308
+ row,
309
+ pinnedBoundary:
310
+ index === topRows.length - 1 &&
311
+ (centerRows.length > 0 || bottomRows.length > 0)
312
+ ? "top"
313
+ : undefined,
314
+ });
315
+ });
316
+
317
+ centerRows.forEach((row) => {
318
+ resolvedRows.push({ row });
319
+ });
320
+
321
+ bottomRows.forEach((row, index) => {
322
+ resolvedRows.push({
323
+ row,
324
+ pinnedBoundary:
325
+ index === 0 && (centerRows.length > 0 || topRows.length > 0)
326
+ ? "bottom"
327
+ : undefined,
328
+ });
329
+ });
330
+
331
+ return resolvedRows;
332
+ }
333
+
334
+ function DataGridTableFillCol() {
335
+ const { props } = useDataGrid();
336
+
337
+ if (!props.tableLayout?.columnsResizable) return null;
338
+
339
+ return (
340
+ <col
341
+ data-slot="data-grid-table-fill-col"
342
+ style={{ width: "var(--data-grid-fill-size, 0px)" }}
343
+ />
344
+ );
345
+ }
346
+
347
+ function DataGridTableFillHeadCell() {
348
+ const { props } = useDataGrid();
349
+
350
+ if (!props.tableLayout?.columnsResizable) return null;
351
+
352
+ return (
353
+ <th
354
+ aria-hidden="true"
355
+ data-slot="data-grid-table-fill-head-cell"
356
+ style={{ width: "var(--data-grid-fill-size, 0px)" }}
357
+ className="p-0"
358
+ />
359
+ );
360
+ }
361
+
362
+ function DataGridTableFillBodyCell() {
363
+ const { props } = useDataGrid();
364
+
365
+ if (!props.tableLayout?.columnsResizable) return null;
366
+
367
+ return (
368
+ <td
369
+ aria-hidden="true"
370
+ data-slot="data-grid-table-fill-body-cell"
371
+ style={{ width: "var(--data-grid-fill-size, 0px)" }}
372
+ className="p-0"
373
+ />
374
+ );
375
+ }
376
+
377
+ function DataGridTableFillFootCell() {
378
+ const { props } = useDataGrid();
379
+
380
+ if (!props.tableLayout?.columnsResizable) return null;
381
+
382
+ return (
383
+ <td
384
+ aria-hidden="true"
385
+ data-slot="data-grid-table-fill-foot-cell"
386
+ style={{ width: "var(--data-grid-fill-size, 0px)" }}
387
+ className="border-t p-0"
388
+ />
389
+ );
390
+ }
391
+
392
+ function DataGridTableBase({ children }: { children: ReactNode }) {
393
+ const { props, table } = useDataGrid();
394
+ const visibleColumns = table.getVisibleLeafColumns();
395
+
396
+ /**
397
+ * Compute column widths as CSS custom properties once upfront (memoized).
398
+ * Cells reference these via calc(var(--col-X-size) * 1px) so the browser
399
+ * handles width propagation without per-cell getSize() calls or React
400
+ * re-renders of the body.
401
+ */
402
+ const columnSizeVars = useMemo(() => {
403
+ if (!props.tableLayout?.columnsResizable) return undefined;
404
+ const headers = table.getFlatHeaders();
405
+ const colSizes: Record<string, number> = {};
406
+ for (let i = 0; i < headers.length; i++) {
407
+ const header = headers[i]!;
408
+ colSizes[`--header-${header.id}-size`] = header.getSize();
409
+ colSizes[`--col-${header.column.id}-size`] = header.column.getSize();
410
+ }
411
+ return colSizes;
412
+ // eslint-disable-next-line react-hooks/exhaustive-deps
413
+ }, [
414
+ props.tableLayout?.columnsResizable,
415
+ // eslint-disable-next-line react-hooks/exhaustive-deps
416
+ table.getState().columnSizingInfo,
417
+ // eslint-disable-next-line react-hooks/exhaustive-deps
418
+ table.getState().columnSizing,
419
+ ]);
420
+
421
+ return (
422
+ <table
423
+ data-slot="data-grid-table"
424
+ className={cn(
425
+ "text-foreground text-sm caption-bottom text-left align-middle font-normal rtl:text-right",
426
+ props.tableLayout?.columnsResizable ? "min-w-0" : "w-full min-w-full",
427
+ props.tableLayout?.width === "auto" ? "table-auto" : "table-fixed",
428
+ !props.tableLayout?.columnsResizable && "",
429
+ !props.tableLayout?.columnsDraggable &&
430
+ "border-separate border-spacing-0",
431
+ props.tableClassNames?.base,
432
+ )}
433
+ style={
434
+ props.tableLayout?.columnsResizable
435
+ ? {
436
+ ...columnSizeVars,
437
+ width: `calc(${table.getTotalSize()}px + var(--data-grid-fill-size, 0px))`,
438
+ }
439
+ : undefined
440
+ }
441
+ >
442
+ <colgroup>
443
+ {visibleColumns.map((column) => (
444
+ <col
445
+ key={column.id}
446
+ style={
447
+ props.tableLayout?.columnsResizable
448
+ ? { width: `calc(var(--col-${column.id}-size) * 1px)` }
449
+ : props.tableLayout?.width === "fixed"
450
+ ? { width: column.getSize() }
451
+ : undefined
452
+ }
453
+ />
454
+ ))}
455
+ <DataGridTableFillCol />
456
+ </colgroup>
457
+ {children}
458
+ </table>
459
+ );
460
+ }
461
+
462
+ function DataGridTableViewport({
463
+ children,
464
+ className,
465
+ viewportRef,
466
+ style,
467
+ }: {
468
+ children: ReactNode;
469
+ className?: string;
470
+ viewportRef?: Ref<HTMLDivElement>;
471
+ style?: CSSProperties;
472
+ }) {
473
+ const { props, table } = useDataGrid();
474
+ const [viewportElement, setViewportElement] = useState<HTMLDivElement | null>(
475
+ null,
476
+ );
477
+ const [containerWidth, setContainerWidth] = useState(0);
478
+ const handleViewportRef = useCallback(
479
+ (node: HTMLDivElement | null) => {
480
+ setViewportElement(node);
481
+ assignRef(viewportRef, node);
482
+ },
483
+ [viewportRef],
484
+ );
485
+ const fillWidth =
486
+ props.tableLayout?.columnsResizable && containerWidth > 0
487
+ ? Math.max(0, containerWidth - table.getTotalSize())
488
+ : 0;
489
+
490
+ useEffect(() => {
491
+ if (!viewportElement || !props.tableLayout?.columnsResizable) {
492
+ setContainerWidth(0);
493
+ return;
494
+ }
495
+
496
+ const scrollViewport =
497
+ (viewportElement.closest(
498
+ '[data-slot="scroll-area-viewport"]',
499
+ ) as HTMLElement | null) ?? viewportElement.parentElement;
500
+ const measurementTarget = scrollViewport ?? viewportElement;
501
+
502
+ const syncContainerWidth = () => {
503
+ setContainerWidth(measurementTarget.clientWidth);
504
+ };
505
+
506
+ syncContainerWidth();
507
+
508
+ if (typeof ResizeObserver === "undefined") return;
509
+
510
+ const observer = new ResizeObserver(syncContainerWidth);
511
+ observer.observe(measurementTarget);
512
+
513
+ return () => {
514
+ observer.disconnect();
515
+ };
516
+ }, [props.tableLayout?.columnsResizable, viewportElement]);
517
+
518
+ return (
519
+ <div
520
+ data-slot="data-grid-table-viewport"
521
+ ref={handleViewportRef}
522
+ className={cn("relative min-w-full align-top", className)}
523
+ style={{
524
+ ...(props.tableLayout?.columnsResizable
525
+ ? {
526
+ width: `calc(${table.getTotalSize()}px + var(--data-grid-fill-size, 0px))`,
527
+ ["--data-grid-fill-size" as string]: `${fillWidth}px`,
528
+ }
529
+ : undefined),
530
+ ...style,
531
+ }}
532
+ >
533
+ {children}
534
+ <DataGridTableResizeIndicator viewportElement={viewportElement} />
535
+ </div>
536
+ );
537
+ }
538
+
539
+ function DataGridTableHead({ children }: { children: ReactNode }) {
540
+ const { props } = useDataGrid();
541
+
542
+ return (
543
+ <thead
544
+ className={cn(
545
+ props.tableClassNames?.header,
546
+ props.tableLayout?.headerSticky && props.tableClassNames?.headerSticky,
547
+ )}
548
+ >
549
+ {children}
550
+ </thead>
551
+ );
552
+ }
553
+
554
+ function DataGridTableHeadRow<TData>({
555
+ children,
556
+ headerGroup,
557
+ }: {
558
+ children: ReactNode;
559
+ headerGroup: HeaderGroup<TData>;
560
+ }) {
561
+ const { props } = useDataGrid();
562
+
563
+ return (
564
+ <tr
565
+ key={headerGroup.id}
566
+ className={cn(
567
+ "bg-muted/40",
568
+ props.tableLayout?.headerBorder && "[&>th]:border-b",
569
+ props.tableLayout?.cellBorder && "*:last:border-e-0",
570
+ props.tableLayout?.stripped && "bg-transparent",
571
+ props.tableLayout?.headerBackground === false && "bg-transparent",
572
+ props.tableClassNames?.headerRow,
573
+ )}
574
+ >
575
+ {children}
576
+ <DataGridTableFillHeadCell />
577
+ </tr>
578
+ );
579
+ }
580
+
581
+ function DataGridTableHeadRowCell<TData>({
582
+ children,
583
+ header,
584
+ dndRef,
585
+ dndStyle,
586
+ }: {
587
+ children: ReactNode;
588
+ header: Header<TData, unknown>;
589
+ dndRef?: Ref<HTMLTableCellElement>;
590
+ dndStyle?: CSSProperties;
591
+ }) {
592
+ const { props } = useDataGrid();
593
+
594
+ const { column } = header;
595
+ const isPinned = column.getIsPinned();
596
+ const isLastLeftPinned =
597
+ isPinned === "left" && column.getIsLastColumn("left");
598
+ const isFirstRightPinned =
599
+ isPinned === "right" && column.getIsFirstColumn("right");
600
+ const isLastVisibleColumn =
601
+ column.getIndex() ===
602
+ header.getContext().table.getVisibleLeafColumns().length - 1;
603
+ const headerCellSpacing = headerCellSpacingVariants({
604
+ size: props.tableLayout?.dense ? "dense" : "default",
605
+ });
606
+
607
+ return (
608
+ <th
609
+ key={header.id}
610
+ ref={dndRef}
611
+ style={{
612
+ ...(props.tableLayout?.width === "fixed" &&
613
+ !props.tableLayout?.columnsResizable && {
614
+ width: header.getSize(),
615
+ }),
616
+ ...(props.tableLayout?.columnsPinnable &&
617
+ column.getCanPin() &&
618
+ getPinningStyles(column)),
619
+ ...(props.tableLayout?.columnsResizable && {
620
+ width: `calc(var(--header-${header.id}-size) * 1px)`,
621
+ }),
622
+ ...(dndStyle ? dndStyle : null),
623
+ }}
624
+ data-pinned={isPinned || undefined}
625
+ data-last-col={
626
+ isLastLeftPinned ? "left" : isFirstRightPinned ? "right" : undefined
627
+ }
628
+ className={cn(
629
+ "text-secondary-foreground/80 h-10 relative text-left align-middle font-normal rtl:text-right [&:has([role=checkbox])]:pe-0",
630
+ headerCellSpacing,
631
+ props.tableLayout?.cellBorder && "border-e",
632
+ props.tableLayout?.columnsResizable &&
633
+ column.getCanResize() &&
634
+ "overflow-visible",
635
+ props.tableLayout?.columnsResizable &&
636
+ column.getCanResize() &&
637
+ isLastVisibleColumn &&
638
+ "pe-8",
639
+ props.tableLayout?.columnsPinnable &&
640
+ column.getCanPin() &&
641
+ "[&[data-pinned][data-last-col]]:border-border data-pinned:bg-muted/90 data-pinned:backdrop-blur-xs [&:not([data-pinned]):has(+[data-pinned])_div.cursor-col-resize:last-child]:opacity-0 [&[data-last-col=left]_div.cursor-col-resize:last-child]:opacity-0 [&[data-pinned=left][data-last-col=left]]:border-e! [&[data-pinned=right]:last-child_div.cursor-col-resize:last-child]:opacity-0 [&[data-pinned=right][data-last-col=right]]:border-s!",
642
+ header.column.columnDef.meta?.headerClassName,
643
+ column.getIndex() === 0 ||
644
+ column.getIndex() === header.headerGroup.headers.length - 1
645
+ ? props.tableClassNames?.edgeCell
646
+ : "",
647
+ )}
648
+ >
649
+ {children}
650
+ </th>
651
+ );
652
+ }
653
+
654
+ function DataGridTableHeadRowCellResize<TData>({
655
+ header,
656
+ }: {
657
+ header: Header<TData, unknown>;
658
+ }) {
659
+ const { props, table } = useDataGrid();
660
+ const { column } = header;
661
+ const isLastVisibleColumn =
662
+ column.getIndex() ===
663
+ header.getContext().table.getVisibleLeafColumns().length - 1;
664
+ const isResizeModeOnEnd =
665
+ (props.tableLayout?.columnsResizeMode ?? table.options.columnResizeMode) ===
666
+ "onEnd";
667
+
668
+ const handleMouseDown = (event: ReactMouseEvent<HTMLDivElement>) => {
669
+ event.preventDefault();
670
+ event.stopPropagation();
671
+
672
+ if (isResizeModeOnEnd) {
673
+ startDataGridColumnResizeOnEnd(event, header, table);
674
+ return;
675
+ }
676
+
677
+ header.getResizeHandler()(event);
678
+ };
679
+
680
+ const handleTouchStart = (event: ReactTouchEvent<HTMLDivElement>) => {
681
+ event.preventDefault();
682
+ event.stopPropagation();
683
+
684
+ if (isResizeModeOnEnd) {
685
+ startDataGridColumnResizeOnEnd(event, header, table);
686
+ return;
687
+ }
688
+
689
+ header.getResizeHandler()(event);
690
+ };
691
+
692
+ return (
693
+ <div
694
+ {...{
695
+ onDoubleClick: () => column.resetSize(),
696
+ onMouseDown: handleMouseDown,
697
+ onTouchStart: handleTouchStart,
698
+ className: cn(
699
+ "absolute top-0 h-full cursor-col-resize user-select-none touch-none z-10 flex",
700
+ isLastVisibleColumn
701
+ ? "end-0 w-5 justify-end before:hidden"
702
+ : "-end-2 w-5 justify-center before:absolute before:inset-y-0 before:w-px before:-translate-x-px before:bg-border",
703
+ column.getIsResizing() &&
704
+ (isResizeModeOnEnd
705
+ ? "opacity-100"
706
+ : isLastVisibleColumn
707
+ ? "before:absolute before:end-0 before:block before:inset-y-0 before:w-0.5 before:bg-primary opacity-100"
708
+ : "before:block before:bg-primary before:w-0.5 opacity-100"),
709
+ ),
710
+ }}
711
+ />
712
+ );
713
+ }
714
+
715
+ function DataGridTableResizeIndicator({
716
+ viewportElement,
717
+ }: {
718
+ viewportElement: HTMLDivElement | null;
719
+ }) {
720
+ const { props, table } = useDataGrid();
721
+ const columnSizingInfo = table.getState().columnSizingInfo;
722
+ const resizingColumnId = columnSizingInfo.isResizingColumn;
723
+ const resizeMode =
724
+ props.tableLayout?.columnsResizeMode ?? table.options.columnResizeMode;
725
+
726
+ if (
727
+ !props.tableLayout?.columnsResizable ||
728
+ resizeMode !== "onEnd" ||
729
+ !resizingColumnId
730
+ ) {
731
+ return null;
732
+ }
733
+
734
+ const resizingHeader = table
735
+ .getFlatHeaders()
736
+ .find(
737
+ (header) =>
738
+ header.column.id === resizingColumnId || header.id === resizingColumnId,
739
+ );
740
+
741
+ if (!resizingHeader) return null;
742
+
743
+ const deltaOffset = columnSizingInfo.deltaOffset ?? 0;
744
+ const headerHeight =
745
+ viewportElement
746
+ ?.querySelector('[data-slot="data-grid-table"] thead')
747
+ ?.getBoundingClientRect().height ?? 0;
748
+ const indicatorLeft =
749
+ typeof columnSizingInfo.startOffset === "number" && viewportElement
750
+ ? columnSizingInfo.startOffset -
751
+ viewportElement.getBoundingClientRect().left
752
+ : resizingHeader.getStart() + resizingHeader.getSize();
753
+
754
+ return (
755
+ <div
756
+ aria-hidden="true"
757
+ className="pointer-events-none absolute inset-y-0 z-20"
758
+ style={{
759
+ left: indicatorLeft,
760
+ transform: `translateX(${deltaOffset}px)`,
761
+ }}
762
+ >
763
+ <div className="bg-primary/85 absolute inset-y-0 left-0 w-px -translate-x-1/2" />
764
+ <div
765
+ className="bg-primary absolute top-0 left-0 -translate-x-1/2 rounded-b-sm shadow-xs"
766
+ style={{
767
+ width: 5,
768
+ height: Math.max(headerHeight, 6),
769
+ }}
770
+ />
771
+ </div>
772
+ );
773
+ }
774
+
775
+ function DataGridTableRowSpacer() {
776
+ return <tbody aria-hidden="true" className="h-2"></tbody>;
777
+ }
778
+
779
+ function DataGridTableBody({ children }: { children: ReactNode }) {
780
+ const { props } = useDataGrid();
781
+
782
+ return (
783
+ <tbody
784
+ className={cn(
785
+ "[&_tr:last-child]:border-0",
786
+ props.tableLayout?.rowRounded && "[&_td:first-child]:rounded-l-none",
787
+ props.tableLayout?.rowRounded && "[&_td:last-child]:rounded-r-none",
788
+ props.tableClassNames?.body,
789
+ )}
790
+ >
791
+ {children}
792
+ </tbody>
793
+ );
794
+ }
795
+
796
+ function DataGridTableFoot({ children }: { children: ReactNode }) {
797
+ const { props } = useDataGrid();
798
+ return (
799
+ <tfoot className={cn("border-t", props.tableClassNames?.footer)}>
800
+ {children}
801
+ </tfoot>
802
+ );
803
+ }
804
+
805
+ function DataGridTableFootRow({ children }: { children: ReactNode }) {
806
+ const { props } = useDataGrid();
807
+ return (
808
+ <tr
809
+ className={cn(
810
+ "bg-muted/40 dark:bg-background",
811
+ props.tableLayout?.cellBorder && "*:last:border-e-0",
812
+ )}
813
+ >
814
+ {children}
815
+ <DataGridTableFillFootCell />
816
+ </tr>
817
+ );
818
+ }
819
+
820
+ function DataGridTableFootRowCell({
821
+ children,
822
+ colSpan,
823
+ className,
824
+ }: {
825
+ children?: ReactNode;
826
+ colSpan?: number;
827
+ className?: string;
828
+ }) {
829
+ const { props } = useDataGrid();
830
+ const spacing = footerCellSpacingVariants({
831
+ size: props.tableLayout?.dense ? "dense" : "default",
832
+ });
833
+ return (
834
+ <td
835
+ colSpan={colSpan}
836
+ className={cn(
837
+ "text-secondary-foreground/80 border-t align-middle font-medium",
838
+ spacing,
839
+ props.tableLayout?.cellBorder && "border-e",
840
+ className,
841
+ )}
842
+ >
843
+ {children}
844
+ </td>
845
+ );
846
+ }
847
+
848
+ function DataGridTableBodyRowSkeleton({ children }: { children: ReactNode }) {
849
+ const { table, props } = useDataGrid();
850
+
851
+ return (
852
+ <tr
853
+ className={cn(
854
+ "hover:bg-muted/40 data-[state=selected]:bg-muted/50",
855
+ props.onRowClick && "cursor-pointer",
856
+ !props.tableLayout?.stripped &&
857
+ props.tableLayout?.rowBorder &&
858
+ "border-border border-b [&:not(:last-child)>td]:border-b",
859
+ props.tableLayout?.cellBorder && "*:last:border-e-0",
860
+ props.tableLayout?.stripped &&
861
+ "odd:bg-muted/90 odd:hover:bg-muted hover:bg-transparent",
862
+ table.options.enableRowSelection && "*:first:relative",
863
+ props.tableClassNames?.bodyRow,
864
+ )}
865
+ >
866
+ {children}
867
+ <DataGridTableFillBodyCell />
868
+ </tr>
869
+ );
870
+ }
871
+
872
+ function DataGridTableBodyRowSkeletonCell<TData>({
873
+ children,
874
+ column,
875
+ }: {
876
+ children: ReactNode;
877
+ column: Column<TData>;
878
+ }) {
879
+ const { props, table } = useDataGrid();
880
+ const bodyCellSpacing = bodyCellSpacingVariants({
881
+ size: props.tableLayout?.dense ? "dense" : "default",
882
+ });
883
+
884
+ return (
885
+ <td
886
+ style={
887
+ props.tableLayout?.columnsResizable
888
+ ? { width: `calc(var(--col-${column.id}-size) * 1px)` }
889
+ : undefined
890
+ }
891
+ className={cn(
892
+ "align-middle",
893
+ bodyCellSpacing,
894
+ props.tableLayout?.cellBorder && "border-e",
895
+ props.tableLayout?.columnsResizable &&
896
+ column.getCanResize() &&
897
+ "truncate",
898
+ column.columnDef.meta?.cellClassName,
899
+ props.tableLayout?.columnsPinnable &&
900
+ column.getCanPin() &&
901
+ '[&[data-pinned][data-last-col]]:border-border data-pinned:bg-background/90 data-pinned:backdrop-blur-xs" [&[data-pinned=left][data-last-col=left]]:border-e! [&[data-pinned=right][data-last-col=right]]:border-s!',
902
+ column.getIndex() === 0 ||
903
+ column.getIndex() === table.getVisibleFlatColumns().length - 1
904
+ ? props.tableClassNames?.edgeCell
905
+ : "",
906
+ )}
907
+ >
908
+ {children}
909
+ </td>
910
+ );
911
+ }
912
+
913
+ function DataGridTableBodyRow<TData>({
914
+ children,
915
+ row,
916
+ pinnedBoundary,
917
+ rowRef,
918
+ dndRef,
919
+ dndStyle,
920
+ }: {
921
+ children: ReactNode;
922
+ row: Row<TData>;
923
+ pinnedBoundary?: DataGridTablePinnedBoundary;
924
+ rowRef?: Ref<HTMLTableRowElement>;
925
+ dndRef?: Ref<HTMLTableRowElement>;
926
+ dndStyle?: CSSProperties;
927
+ }) {
928
+ const { props, table } = useDataGrid();
929
+ const isRowPinned = row.getIsPinned();
930
+
931
+ return (
932
+ <tr
933
+ ref={(node) => {
934
+ assignRef(rowRef, node);
935
+ assignRef(dndRef, node);
936
+ }}
937
+ style={{ ...(dndStyle ? dndStyle : null) }}
938
+ data-state={
939
+ table.options.enableRowSelection && row.getIsSelected()
940
+ ? "selected"
941
+ : undefined
942
+ }
943
+ data-row-pinned={isRowPinned || undefined}
944
+ data-row-pinned-boundary={pinnedBoundary}
945
+ onClick={() => props.onRowClick && props.onRowClick(row.original)}
946
+ className={cn(
947
+ "hover:bg-muted/40 data-[state=selected]:bg-muted/50",
948
+ props.onRowClick && "cursor-pointer",
949
+ !props.tableLayout?.stripped &&
950
+ props.tableLayout?.rowBorder &&
951
+ "border-border border-b [&:not(:last-child)>td]:border-b",
952
+ props.tableLayout?.cellBorder && "*:last:border-e-0",
953
+ props.tableLayout?.stripped &&
954
+ "odd:bg-muted/90 odd:hover:bg-muted hover:bg-transparent",
955
+ table.options.enableRowSelection && "*:first:relative",
956
+ props.tableLayout?.rowsPinnable &&
957
+ isRowPinned &&
958
+ "bg-muted/30 hover:bg-muted/50",
959
+ pinnedBoundary === "top" && "[&>td]:shadow-[0_2px_0_rgba(0,0,0,0.03)]",
960
+ pinnedBoundary === "bottom" &&
961
+ "[&>td]:shadow-[0_2px_0_rgba(0,0,0,0.03)]",
962
+ props.tableClassNames?.bodyRow,
963
+ )}
964
+ >
965
+ {children}
966
+ <DataGridTableFillBodyCell />
967
+ </tr>
968
+ );
969
+ }
970
+
971
+ function DataGridTableBodyRowExpandded<TData>({ row }: { row: Row<TData> }) {
972
+ const { props, table } = useDataGrid();
973
+
974
+ return (
975
+ <tr
976
+ className={cn(
977
+ props.tableLayout?.rowBorder && "[&:not(:last-child)>td]:border-b",
978
+ )}
979
+ >
980
+ <td
981
+ colSpan={
982
+ row.getVisibleCells().length +
983
+ (props.tableLayout?.columnsResizable ? 1 : 0)
984
+ }
985
+ >
986
+ {table
987
+ .getAllColumns()
988
+ .find((column) => column.columnDef.meta?.expandedContent)
989
+ ?.columnDef.meta?.expandedContent?.(row.original)}
990
+ </td>
991
+ </tr>
992
+ );
993
+ }
994
+
995
+ function DataGridTableBodyRowCell<TData>({
996
+ children,
997
+ cell,
998
+ dndRef,
999
+ dndStyle,
1000
+ }: {
1001
+ children: ReactNode;
1002
+ cell: Cell<TData, unknown>;
1003
+ dndRef?: Ref<HTMLTableCellElement>;
1004
+ dndStyle?: CSSProperties;
1005
+ }) {
1006
+ const { props } = useDataGrid();
1007
+
1008
+ const { column, row } = cell;
1009
+ const isPinned = column.getIsPinned();
1010
+ const isLastLeftPinned =
1011
+ isPinned === "left" && column.getIsLastColumn("left");
1012
+ const isFirstRightPinned =
1013
+ isPinned === "right" && column.getIsFirstColumn("right");
1014
+ const bodyCellSpacing = bodyCellSpacingVariants({
1015
+ size: props.tableLayout?.dense ? "dense" : "default",
1016
+ });
1017
+
1018
+ return (
1019
+ <td
1020
+ key={cell.id}
1021
+ ref={dndRef}
1022
+ {...(props.tableLayout?.columnsDraggable && !isPinned ? { cell } : {})}
1023
+ style={{
1024
+ ...(props.tableLayout?.columnsPinnable &&
1025
+ column.getCanPin() &&
1026
+ getPinningStyles(column)),
1027
+ ...(props.tableLayout?.columnsResizable && {
1028
+ width: `calc(var(--col-${column.id}-size) * 1px)`,
1029
+ }),
1030
+ ...(dndStyle ? dndStyle : null),
1031
+ }}
1032
+ data-pinned={isPinned || undefined}
1033
+ data-last-col={
1034
+ isLastLeftPinned ? "left" : isFirstRightPinned ? "right" : undefined
1035
+ }
1036
+ className={cn(
1037
+ "align-middle",
1038
+ bodyCellSpacing,
1039
+ props.tableLayout?.cellBorder && "border-e",
1040
+ props.tableLayout?.columnsResizable &&
1041
+ column.getCanResize() &&
1042
+ "truncate",
1043
+ cell.column.columnDef.meta?.cellClassName,
1044
+ props.tableLayout?.columnsPinnable &&
1045
+ column.getCanPin() &&
1046
+ '[&[data-pinned][data-last-col]]:border-border data-pinned:bg-background/90 data-pinned:backdrop-blur-xs" [&[data-pinned=left][data-last-col=left]]:border-e! [&[data-pinned=right][data-last-col=right]]:border-s!',
1047
+ column.getIndex() === 0 ||
1048
+ column.getIndex() === row.getVisibleCells().length - 1
1049
+ ? props.tableClassNames?.edgeCell
1050
+ : "",
1051
+ )}
1052
+ >
1053
+ {children}
1054
+ </td>
1055
+ );
1056
+ }
1057
+
1058
+ function DataGridTableRenderedRow<TData>({
1059
+ row,
1060
+ pinnedBoundary,
1061
+ rowRef,
1062
+ }: {
1063
+ row: Row<TData>;
1064
+ pinnedBoundary?: DataGridTablePinnedBoundary;
1065
+ rowRef?: Ref<HTMLTableRowElement>;
1066
+ }) {
1067
+ return (
1068
+ <Fragment>
1069
+ <DataGridTableBodyRow
1070
+ row={row}
1071
+ pinnedBoundary={pinnedBoundary}
1072
+ rowRef={rowRef}
1073
+ >
1074
+ {row.getVisibleCells().map((cell: Cell<TData, unknown>) => (
1075
+ <DataGridTableBodyRowCell cell={cell} key={cell.id}>
1076
+ {flexRender(cell.column.columnDef.cell, cell.getContext())}
1077
+ </DataGridTableBodyRowCell>
1078
+ ))}
1079
+ </DataGridTableBodyRow>
1080
+ {row.getIsExpanded() && <DataGridTableBodyRowExpandded row={row} />}
1081
+ </Fragment>
1082
+ );
1083
+ }
1084
+
1085
+ function DataGridTableEmpty() {
1086
+ const { table, props } = useDataGrid();
1087
+ const visibleColumnCount =
1088
+ table.getVisibleLeafColumns().length +
1089
+ (props.tableLayout?.columnsResizable ? 1 : 0);
1090
+
1091
+ return (
1092
+ <tr>
1093
+ <td
1094
+ colSpan={Math.max(visibleColumnCount, 1)}
1095
+ className="text-muted-foreground text-sm py-6 text-center"
1096
+ >
1097
+ {props.emptyMessage || "No data available"}
1098
+ </td>
1099
+ </tr>
1100
+ );
1101
+ }
1102
+
1103
+ function DataGridTableLoader() {
1104
+ const { props } = useDataGrid();
1105
+
1106
+ return (
1107
+ <div className="absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2">
1108
+ <div className="text-muted-foreground bg-card rounded-2xl text-sm flex items-center gap-2 border px-4 py-2 leading-none font-medium">
1109
+ <Spinner className="size-5 opacity-60" />
1110
+ {props.loadingMessage || "Loading..."}
1111
+ </div>
1112
+ </div>
1113
+ );
1114
+ }
1115
+
1116
+ function DataGridTableRowPin<TData>({ row }: { row: Row<TData> }) {
1117
+ const isPinned = row.getIsPinned();
1118
+
1119
+ return (
1120
+ <button
1121
+ type="button"
1122
+ aria-label={isPinned ? "Unpin row" : "Pin row"}
1123
+ onClick={() => {
1124
+ if (isPinned) {
1125
+ row.pin(false);
1126
+ } else {
1127
+ row.pin("top");
1128
+ }
1129
+ }}
1130
+ className={cn(
1131
+ "text-muted-foreground hover:text-foreground inline-flex size-7 items-center justify-center rounded-md transition-colors",
1132
+ isPinned && "text-primary hover:text-primary/80",
1133
+ )}
1134
+ >
1135
+ {isPinned ? (
1136
+ <svg
1137
+ xmlns="http://www.w3.org/2000/svg"
1138
+ width="16"
1139
+ height="16"
1140
+ viewBox="0 0 24 24"
1141
+ fill="currentColor"
1142
+ stroke="none"
1143
+ >
1144
+ <path d="M16 2l4.585 4.586-2.122 2.121L17.05 7.293l-3.535 3.536 1.413 5.658-2.12 2.121-4.244-4.243L4.322 18.6l-1.414-1.41 4.242-4.244-4.243-4.243 2.122-2.121 5.656 1.414 3.536-3.536-1.414-1.414z" />
1145
+ </svg>
1146
+ ) : (
1147
+ <svg
1148
+ xmlns="http://www.w3.org/2000/svg"
1149
+ width="16"
1150
+ height="16"
1151
+ viewBox="0 0 24 24"
1152
+ fill="none"
1153
+ stroke="currentColor"
1154
+ strokeWidth="2"
1155
+ strokeLinecap="round"
1156
+ strokeLinejoin="round"
1157
+ >
1158
+ <line x1="12" y1="17" x2="12" y2="22" />
1159
+ <path d="M5 17h14v-1.76a2 2 0 00-1.11-1.79l-1.78-.9A2 2 0 0115 10.76V6h1a2 2 0 000-4H8a2 2 0 000 4h1v4.76a2 2 0 01-1.11 1.79l-1.78.9A2 2 0 005 15.24z" />
1160
+ </svg>
1161
+ )}
1162
+ </button>
1163
+ );
1164
+ }
1165
+
1166
+ function DataGridTableRowSelect<TData>({ row }: { row: Row<TData> }) {
1167
+ return (
1168
+ <>
1169
+ <div
1170
+ className={cn(
1171
+ "bg-primary absolute inset-s-0 top-0 bottom-0 hidden w-[2px]",
1172
+ row.getIsSelected() && "block",
1173
+ )}
1174
+ ></div>
1175
+ <Checkbox
1176
+ checked={row.getIsSelected()}
1177
+ onCheckedChange={(value) => row.toggleSelected(!!value)}
1178
+ aria-label="Select row"
1179
+ className="align-[inherit]"
1180
+ />
1181
+ </>
1182
+ );
1183
+ }
1184
+
1185
+ function DataGridTableRowSelectAll() {
1186
+ const { table, recordCount, isLoading } = useDataGrid();
1187
+
1188
+ const isAllSelected = table.getIsAllPageRowsSelected();
1189
+ const isSomeSelected = table.getIsSomePageRowsSelected();
1190
+
1191
+ return (
1192
+ <Checkbox
1193
+ checked={
1194
+ isSomeSelected && !isAllSelected ? "indeterminate" : isAllSelected
1195
+ }
1196
+ disabled={isLoading || recordCount === 0}
1197
+ onCheckedChange={(value) => table.toggleAllPageRowsSelected(!!value)}
1198
+ aria-label="Select all"
1199
+ className="align-[inherit]"
1200
+ />
1201
+ );
1202
+ }
1203
+
1204
+ function DataGridTableBodyRows<TData>({ table }: { table: Table<TData> }) {
1205
+ const { isLoading, props } = useDataGrid();
1206
+ const pagination = table.getState().pagination;
1207
+
1208
+ if (isLoading && props.loadingMode === "skeleton" && pagination?.pageSize) {
1209
+ return (
1210
+ <>
1211
+ {Array.from({ length: pagination.pageSize }).map((_, rowIndex) => (
1212
+ <DataGridTableBodyRowSkeleton key={rowIndex}>
1213
+ {table.getVisibleFlatColumns().map((column, colIndex) => (
1214
+ <DataGridTableBodyRowSkeletonCell column={column} key={colIndex}>
1215
+ {column.columnDef.meta?.skeleton}
1216
+ </DataGridTableBodyRowSkeletonCell>
1217
+ ))}
1218
+ </DataGridTableBodyRowSkeleton>
1219
+ ))}
1220
+ </>
1221
+ );
1222
+ }
1223
+
1224
+ if (isLoading && props.loadingMode === "spinner") {
1225
+ return (
1226
+ <tr>
1227
+ <td colSpan={table.getVisibleFlatColumns().length} className="p-8">
1228
+ <div className="flex items-center justify-center">
1229
+ <svg
1230
+ className="text-muted-foreground mr-3 -ml-1 h-5 w-5 animate-spin"
1231
+ xmlns="http://www.w3.org/2000/svg"
1232
+ fill="none"
1233
+ viewBox="0 0 24 24"
1234
+ >
1235
+ <circle
1236
+ className="opacity-25"
1237
+ cx="12"
1238
+ cy="12"
1239
+ r="10"
1240
+ stroke="currentColor"
1241
+ strokeWidth="4"
1242
+ ></circle>
1243
+ <path
1244
+ className="opacity-75"
1245
+ fill="currentColor"
1246
+ d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"
1247
+ ></path>
1248
+ </svg>
1249
+ {props.loadingMessage || "Loading..."}
1250
+ </div>
1251
+ </td>
1252
+ </tr>
1253
+ );
1254
+ }
1255
+
1256
+ const resolvedRows = getDataGridTableResolvedRows(
1257
+ table,
1258
+ props.tableLayout?.rowsPinnable,
1259
+ );
1260
+
1261
+ if (!resolvedRows.length) return <DataGridTableEmpty />;
1262
+
1263
+ return (
1264
+ <>
1265
+ {resolvedRows.map(({ row, pinnedBoundary }) => (
1266
+ <DataGridTableRenderedRow
1267
+ key={row.id}
1268
+ row={row}
1269
+ pinnedBoundary={pinnedBoundary}
1270
+ />
1271
+ ))}
1272
+ </>
1273
+ );
1274
+ }
1275
+
1276
+ /**
1277
+ * Memoized body rows: skip re-renders during active column resize.
1278
+ * Column widths update via CSS variables on the <table> element,
1279
+ * so the browser handles width changes without React re-renders.
1280
+ */
1281
+ const MemoizedDataGridTableBodyRows = memo(
1282
+ DataGridTableBodyRows,
1283
+ (_prev, next) => !!next.table.getState().columnSizingInfo.isResizingColumn,
1284
+ ) as typeof DataGridTableBodyRows;
1285
+
1286
+ function DataGridTableHeader<TData>() {
1287
+ const { table, props } = useDataGrid();
1288
+
1289
+ return (
1290
+ <DataGridTableViewport>
1291
+ <DataGridTableBase>
1292
+ <DataGridTableHead>
1293
+ {table
1294
+ .getHeaderGroups()
1295
+ .map((headerGroup: HeaderGroup<TData>, index) => {
1296
+ return (
1297
+ <DataGridTableHeadRow headerGroup={headerGroup} key={index}>
1298
+ {headerGroup.headers.map((header, index) => {
1299
+ const { column } = header;
1300
+
1301
+ return (
1302
+ <DataGridTableHeadRowCell header={header} key={index}>
1303
+ {header.isPlaceholder ? null : props.tableLayout
1304
+ ?.columnsResizable && column.getCanResize() ? (
1305
+ <div className="truncate">
1306
+ {flexRender(
1307
+ header.column.columnDef.header,
1308
+ header.getContext(),
1309
+ )}
1310
+ </div>
1311
+ ) : (
1312
+ flexRender(
1313
+ header.column.columnDef.header,
1314
+ header.getContext(),
1315
+ )
1316
+ )}
1317
+ {props.tableLayout?.columnsResizable &&
1318
+ column.getCanResize() && (
1319
+ <DataGridTableHeadRowCellResize header={header} />
1320
+ )}
1321
+ </DataGridTableHeadRowCell>
1322
+ );
1323
+ })}
1324
+ </DataGridTableHeadRow>
1325
+ );
1326
+ })}
1327
+ </DataGridTableHead>
1328
+ </DataGridTableBase>
1329
+ </DataGridTableViewport>
1330
+ );
1331
+ }
1332
+
1333
+ function DataGridTable<TData>({
1334
+ footerContent,
1335
+ renderHeader = true,
1336
+ }: {
1337
+ footerContent?: ReactNode;
1338
+ renderHeader?: boolean;
1339
+ }) {
1340
+ const { table, props } = useDataGrid();
1341
+
1342
+ return (
1343
+ <DataGridTableViewport>
1344
+ <DataGridTableBase>
1345
+ {renderHeader && (
1346
+ <DataGridTableHead>
1347
+ {table
1348
+ .getHeaderGroups()
1349
+ .map((headerGroup: HeaderGroup<TData>, index) => {
1350
+ return (
1351
+ <DataGridTableHeadRow headerGroup={headerGroup} key={index}>
1352
+ {headerGroup.headers.map((header, index) => {
1353
+ const { column } = header;
1354
+
1355
+ return (
1356
+ <DataGridTableHeadRowCell header={header} key={index}>
1357
+ {header.isPlaceholder ? null : props.tableLayout
1358
+ ?.columnsResizable && column.getCanResize() ? (
1359
+ <div className="truncate">
1360
+ {flexRender(
1361
+ header.column.columnDef.header,
1362
+ header.getContext(),
1363
+ )}
1364
+ </div>
1365
+ ) : (
1366
+ flexRender(
1367
+ header.column.columnDef.header,
1368
+ header.getContext(),
1369
+ )
1370
+ )}
1371
+ {props.tableLayout?.columnsResizable &&
1372
+ column.getCanResize() && (
1373
+ <DataGridTableHeadRowCellResize header={header} />
1374
+ )}
1375
+ </DataGridTableHeadRowCell>
1376
+ );
1377
+ })}
1378
+ </DataGridTableHeadRow>
1379
+ );
1380
+ })}
1381
+ </DataGridTableHead>
1382
+ )}
1383
+
1384
+ {renderHeader &&
1385
+ (props.tableLayout?.stripped || !props.tableLayout?.rowBorder) && (
1386
+ <DataGridTableRowSpacer />
1387
+ )}
1388
+
1389
+ <DataGridTableBody>
1390
+ <MemoizedDataGridTableBodyRows table={table} />
1391
+ </DataGridTableBody>
1392
+
1393
+ {footerContent && (
1394
+ <DataGridTableFoot>{footerContent}</DataGridTableFoot>
1395
+ )}
1396
+ </DataGridTableBase>
1397
+ </DataGridTableViewport>
1398
+ );
1399
+ }
1400
+
1401
+ export {
1402
+ DataGridTable,
1403
+ DataGridTableBase,
1404
+ DataGridTableBody,
1405
+ DataGridTableBodyRow,
1406
+ DataGridTableBodyRowCell,
1407
+ DataGridTableBodyRowExpandded,
1408
+ DataGridTableRenderedRow,
1409
+ DataGridTableBodyRowSkeleton,
1410
+ DataGridTableBodyRowSkeletonCell,
1411
+ DataGridTableEmpty,
1412
+ DataGridTableFoot,
1413
+ DataGridTableFootRow,
1414
+ DataGridTableFootRowCell,
1415
+ DataGridTableHeader,
1416
+ DataGridTableHead,
1417
+ DataGridTableHeadRow,
1418
+ DataGridTableHeadRowCell,
1419
+ DataGridTableHeadRowCellResize,
1420
+ DataGridTableLoader,
1421
+ DataGridTableRowPin,
1422
+ DataGridTableRowSelect,
1423
+ DataGridTableRowSelectAll,
1424
+ DataGridTableRowSpacer,
1425
+ DataGridTableViewport,
1426
+ getDataGridTableResolvedRows,
1427
+ getDataGridTableRowSections,
1428
+ };
1429
+
1430
+ export type { DataGridTablePinnedBoundary };