@techsio/ui-kit 0.57.0 → 0.58.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 (346) hide show
  1. package/README.md +128 -133
  2. package/dist/atoms/action-icon.js +9 -8
  3. package/dist/atoms/button.js +78 -18
  4. package/dist/atoms/checkbox.js +77 -17
  5. package/dist/atoms/hotkeys.js +26 -7
  6. package/dist/atoms/icon.js +5 -5
  7. package/dist/atoms/image.js +107 -2
  8. package/dist/atoms/input.js +57 -9
  9. package/dist/atoms/label.js +13 -4
  10. package/dist/atoms/link-button.js +14 -12
  11. package/dist/atoms/link.js +18 -4
  12. package/dist/atoms/numeric-input.js +293 -76
  13. package/dist/atoms/rating.js +306 -73
  14. package/dist/atoms/skeleton.js +18 -14
  15. package/dist/atoms/status-text.js +31 -18
  16. package/dist/atoms/textarea.js +59 -12
  17. package/dist/atoms/tooltip.js +64 -43
  18. package/dist/hotkeys.js +1 -0
  19. package/dist/internal/choice-control.js +173 -0
  20. package/dist/internal/combobox-query-sync.js +11 -0
  21. package/dist/internal/date-picker-coordinator.js +56 -40
  22. package/dist/internal/date-picker-dom.js +44 -0
  23. package/dist/internal/date-picker-input.js +30 -0
  24. package/dist/internal/described-by.js +23 -18
  25. package/dist/internal/form-control-lifecycle.js +122 -0
  26. package/dist/internal/molecules/command.context.js +1 -0
  27. package/dist/internal/molecules/drawer.context.js +1 -0
  28. package/dist/internal/molecules/vertical-navigation.context.js +1 -0
  29. package/dist/internal/molecules/vertical-navigation.styles.js +9 -2
  30. package/dist/internal/numeric-input-editing.js +87 -0
  31. package/dist/internal/organisms/sidebar.context.js +1 -0
  32. package/dist/internal/organisms/sidebar.focus.js +1 -0
  33. package/dist/internal/overlay-portal.js +72 -0
  34. package/dist/internal/reduced-motion.js +1 -0
  35. package/dist/internal/use-effective-disabled.js +8 -0
  36. package/dist/molecules/accordion.js +44 -30
  37. package/dist/molecules/availability-status.js +1 -0
  38. package/dist/molecules/breadcrumb.js +11 -11
  39. package/dist/molecules/carousel.js +279 -97
  40. package/dist/molecules/cascade-select.js +327 -81
  41. package/dist/molecules/chart.js +276 -38
  42. package/dist/molecules/color-select.js +181 -62
  43. package/dist/molecules/combobox.js +535 -182
  44. package/dist/molecules/command.js +2 -1
  45. package/dist/molecules/date-picker.js +571 -119
  46. package/dist/molecules/dialog.js +81 -47
  47. package/dist/molecules/drawer.js +54 -5
  48. package/dist/molecules/file-upload.js +373 -37
  49. package/dist/molecules/form-checkbox.js +65 -22
  50. package/dist/molecules/form-error-summary.js +29 -5
  51. package/dist/molecules/form-input.js +26 -30
  52. package/dist/molecules/form-numeric-input.js +11 -9
  53. package/dist/molecules/form-textarea.js +26 -23
  54. package/dist/molecules/menu.js +170 -47
  55. package/dist/molecules/pagination.js +100 -28
  56. package/dist/molecules/phone-input.js +172 -37
  57. package/dist/molecules/popover.js +53 -26
  58. package/dist/molecules/price-block.js +1 -0
  59. package/dist/molecules/product-card.js +23 -18
  60. package/dist/molecules/quantity-field.js +4 -2
  61. package/dist/molecules/radio-card.js +102 -30
  62. package/dist/molecules/radio-group.js +108 -31
  63. package/dist/molecules/search-form.js +116 -13
  64. package/dist/molecules/select.js +226 -81
  65. package/dist/molecules/slider.js +141 -30
  66. package/dist/molecules/steps.js +181 -50
  67. package/dist/molecules/switch.js +85 -20
  68. package/dist/molecules/tabs.js +227 -31
  69. package/dist/molecules/toast.js +146 -51
  70. package/dist/molecules/totals-summary.js +2 -1
  71. package/dist/molecules/tour.js +9 -5
  72. package/dist/molecules/tree-view.js +255 -109
  73. package/dist/molecules/vertical-navigation.js +8 -4
  74. package/dist/organisms/data-table.fields.js +25 -5
  75. package/dist/organisms/data-table.helpers.js +6 -2
  76. package/dist/organisms/data-table.js +580 -151
  77. package/dist/organisms/footer.js +18 -11
  78. package/dist/organisms/gallery.js +61 -24
  79. package/dist/organisms/header.js +106 -32
  80. package/dist/organisms/line-item.js +1 -0
  81. package/dist/organisms/sidebar.js +1 -0
  82. package/dist/organisms/table.js +22 -7
  83. package/dist/src/atoms/action-icon.d.ts +10 -10
  84. package/dist/src/atoms/action-icon.d.ts.map +1 -1
  85. package/dist/src/atoms/badge.d.ts +3 -3
  86. package/dist/src/atoms/badge.d.ts.map +1 -1
  87. package/dist/src/atoms/button.d.ts +35 -24
  88. package/dist/src/atoms/button.d.ts.map +1 -1
  89. package/dist/src/atoms/checkbox.d.ts +6 -5
  90. package/dist/src/atoms/checkbox.d.ts.map +1 -1
  91. package/dist/src/atoms/hotkeys.d.ts +3 -2
  92. package/dist/src/atoms/hotkeys.d.ts.map +1 -1
  93. package/dist/src/atoms/icon.d.ts +18 -17
  94. package/dist/src/atoms/icon.d.ts.map +1 -1
  95. package/dist/src/atoms/image.d.ts +14 -6
  96. package/dist/src/atoms/image.d.ts.map +1 -1
  97. package/dist/src/atoms/input.d.ts +23 -14
  98. package/dist/src/atoms/input.d.ts.map +1 -1
  99. package/dist/src/atoms/label.d.ts +4 -4
  100. package/dist/src/atoms/label.d.ts.map +1 -1
  101. package/dist/src/atoms/link-button.d.ts +54 -31
  102. package/dist/src/atoms/link-button.d.ts.map +1 -1
  103. package/dist/src/atoms/link.d.ts +30 -9
  104. package/dist/src/atoms/link.d.ts.map +1 -1
  105. package/dist/src/atoms/numeric-input.d.ts +23 -19
  106. package/dist/src/atoms/numeric-input.d.ts.map +1 -1
  107. package/dist/src/atoms/rating.d.ts +54 -26
  108. package/dist/src/atoms/rating.d.ts.map +1 -1
  109. package/dist/src/atoms/skeleton.d.ts +9 -9
  110. package/dist/src/atoms/skeleton.d.ts.map +1 -1
  111. package/dist/src/atoms/status-text.d.ts +21 -13
  112. package/dist/src/atoms/status-text.d.ts.map +1 -1
  113. package/dist/src/atoms/textarea.d.ts +22 -20
  114. package/dist/src/atoms/textarea.d.ts.map +1 -1
  115. package/dist/src/atoms/tooltip.d.ts +5 -5
  116. package/dist/src/atoms/tooltip.d.ts.map +1 -1
  117. package/dist/src/hotkeys.d.ts +1 -1
  118. package/dist/src/hotkeys.d.ts.map +1 -1
  119. package/dist/src/internal/choice-control.d.ts +18 -0
  120. package/dist/src/internal/choice-control.d.ts.map +1 -0
  121. package/dist/src/internal/combobox-query-sync.d.ts +4 -0
  122. package/dist/src/internal/combobox-query-sync.d.ts.map +1 -0
  123. package/dist/src/internal/date-picker-coordinator.d.ts +7 -1
  124. package/dist/src/internal/date-picker-coordinator.d.ts.map +1 -1
  125. package/dist/src/internal/date-picker-dom.d.ts +10 -0
  126. package/dist/src/internal/date-picker-dom.d.ts.map +1 -0
  127. package/dist/src/internal/date-picker-input.d.ts +7 -0
  128. package/dist/src/internal/date-picker-input.d.ts.map +1 -0
  129. package/dist/src/internal/described-by.d.ts +7 -1
  130. package/dist/src/internal/described-by.d.ts.map +1 -1
  131. package/dist/src/internal/form-control-lifecycle.d.ts +22 -0
  132. package/dist/src/internal/form-control-lifecycle.d.ts.map +1 -0
  133. package/dist/src/internal/molecules/vertical-navigation.context.d.ts +1 -1
  134. package/dist/src/internal/molecules/vertical-navigation.context.d.ts.map +1 -1
  135. package/dist/src/internal/molecules/vertical-navigation.styles.d.ts +21 -0
  136. package/dist/src/internal/molecules/vertical-navigation.styles.d.ts.map +1 -1
  137. package/dist/src/internal/numeric-input-editing.d.ts +13 -0
  138. package/dist/src/internal/numeric-input-editing.d.ts.map +1 -0
  139. package/dist/src/internal/overlay-portal.d.ts +18 -0
  140. package/dist/src/internal/overlay-portal.d.ts.map +1 -0
  141. package/dist/src/internal/use-effective-disabled.d.ts +4 -0
  142. package/dist/src/internal/use-effective-disabled.d.ts.map +1 -0
  143. package/dist/src/molecules/accordion.d.ts +25 -19
  144. package/dist/src/molecules/accordion.d.ts.map +1 -1
  145. package/dist/src/molecules/availability-status.d.ts +4 -1
  146. package/dist/src/molecules/availability-status.d.ts.map +1 -1
  147. package/dist/src/molecules/breadcrumb.d.ts +2 -2
  148. package/dist/src/molecules/breadcrumb.d.ts.map +1 -1
  149. package/dist/src/molecules/carousel.d.ts +51 -52
  150. package/dist/src/molecules/carousel.d.ts.map +1 -1
  151. package/dist/src/molecules/cascade-select.d.ts +23 -8
  152. package/dist/src/molecules/cascade-select.d.ts.map +1 -1
  153. package/dist/src/molecules/chart.d.ts +7 -1
  154. package/dist/src/molecules/chart.d.ts.map +1 -1
  155. package/dist/src/molecules/color-select.d.ts +19 -3
  156. package/dist/src/molecules/color-select.d.ts.map +1 -1
  157. package/dist/src/molecules/combobox.d.ts +23 -5
  158. package/dist/src/molecules/combobox.d.ts.map +1 -1
  159. package/dist/src/molecules/command.d.ts +1 -1
  160. package/dist/src/molecules/date-picker.d.ts +7 -3
  161. package/dist/src/molecules/date-picker.d.ts.map +1 -1
  162. package/dist/src/molecules/dialog.d.ts +7 -3
  163. package/dist/src/molecules/dialog.d.ts.map +1 -1
  164. package/dist/src/molecules/drawer.d.ts +4 -4
  165. package/dist/src/molecules/drawer.d.ts.map +1 -1
  166. package/dist/src/molecules/file-upload.d.ts +11 -6
  167. package/dist/src/molecules/file-upload.d.ts.map +1 -1
  168. package/dist/src/molecules/form-checkbox.d.ts +7 -2
  169. package/dist/src/molecules/form-checkbox.d.ts.map +1 -1
  170. package/dist/src/molecules/form-error-summary.d.ts +4 -3
  171. package/dist/src/molecules/form-error-summary.d.ts.map +1 -1
  172. package/dist/src/molecules/form-input.d.ts +5 -6
  173. package/dist/src/molecules/form-input.d.ts.map +1 -1
  174. package/dist/src/molecules/form-numeric-input.d.ts +5 -5
  175. package/dist/src/molecules/form-numeric-input.d.ts.map +1 -1
  176. package/dist/src/molecules/form-textarea.d.ts +5 -6
  177. package/dist/src/molecules/form-textarea.d.ts.map +1 -1
  178. package/dist/src/molecules/menu.d.ts +17 -3
  179. package/dist/src/molecules/menu.d.ts.map +1 -1
  180. package/dist/src/molecules/pagination.d.ts +1 -1
  181. package/dist/src/molecules/pagination.d.ts.map +1 -1
  182. package/dist/src/molecules/phone-input.d.ts +4 -1
  183. package/dist/src/molecules/phone-input.d.ts.map +1 -1
  184. package/dist/src/molecules/popover.d.ts +7 -1
  185. package/dist/src/molecules/popover.d.ts.map +1 -1
  186. package/dist/src/molecules/price-block.d.ts +1 -1
  187. package/dist/src/molecules/price-block.d.ts.map +1 -1
  188. package/dist/src/molecules/product-card.d.ts +20 -25
  189. package/dist/src/molecules/product-card.d.ts.map +1 -1
  190. package/dist/src/molecules/quantity-field.d.ts +1 -1
  191. package/dist/src/molecules/quantity-field.d.ts.map +1 -1
  192. package/dist/src/molecules/radio-card.d.ts +10 -3
  193. package/dist/src/molecules/radio-card.d.ts.map +1 -1
  194. package/dist/src/molecules/radio-group.d.ts +15 -6
  195. package/dist/src/molecules/radio-group.d.ts.map +1 -1
  196. package/dist/src/molecules/search-form.d.ts +37 -12
  197. package/dist/src/molecules/search-form.d.ts.map +1 -1
  198. package/dist/src/molecules/select.d.ts +34 -29
  199. package/dist/src/molecules/select.d.ts.map +1 -1
  200. package/dist/src/molecules/slider.d.ts +23 -2
  201. package/dist/src/molecules/slider.d.ts.map +1 -1
  202. package/dist/src/molecules/steps.d.ts +30 -10
  203. package/dist/src/molecules/steps.d.ts.map +1 -1
  204. package/dist/src/molecules/switch.d.ts +54 -33
  205. package/dist/src/molecules/switch.d.ts.map +1 -1
  206. package/dist/src/molecules/tabs.d.ts +11 -11
  207. package/dist/src/molecules/tabs.d.ts.map +1 -1
  208. package/dist/src/molecules/toast.d.ts +25 -13
  209. package/dist/src/molecules/toast.d.ts.map +1 -1
  210. package/dist/src/molecules/totals-summary.d.ts +1 -1
  211. package/dist/src/molecules/totals-summary.d.ts.map +1 -1
  212. package/dist/src/molecules/tour.d.ts +1 -1
  213. package/dist/src/molecules/tour.d.ts.map +1 -1
  214. package/dist/src/molecules/tree-view.d.ts +16 -20
  215. package/dist/src/molecules/tree-view.d.ts.map +1 -1
  216. package/dist/src/molecules/vertical-navigation.d.ts +2 -2
  217. package/dist/src/molecules/vertical-navigation.d.ts.map +1 -1
  218. package/dist/src/organisms/data-table.d.ts +24 -3
  219. package/dist/src/organisms/data-table.d.ts.map +1 -1
  220. package/dist/src/organisms/data-table.fields.d.ts +4 -1
  221. package/dist/src/organisms/data-table.fields.d.ts.map +1 -1
  222. package/dist/src/organisms/data-table.helpers.d.ts +5 -12
  223. package/dist/src/organisms/data-table.helpers.d.ts.map +1 -1
  224. package/dist/src/organisms/footer.d.ts +5 -5
  225. package/dist/src/organisms/footer.d.ts.map +1 -1
  226. package/dist/src/organisms/gallery.d.ts +11 -9
  227. package/dist/src/organisms/gallery.d.ts.map +1 -1
  228. package/dist/src/organisms/header.d.ts +24 -22
  229. package/dist/src/organisms/header.d.ts.map +1 -1
  230. package/dist/src/organisms/table.d.ts +14 -14
  231. package/dist/src/organisms/table.d.ts.map +1 -1
  232. package/dist/src/templates/accordion.d.ts +8 -6
  233. package/dist/src/templates/accordion.d.ts.map +1 -1
  234. package/dist/src/templates/breadcrumb.d.ts +1 -1
  235. package/dist/src/templates/breadcrumb.d.ts.map +1 -1
  236. package/dist/src/templates/carousel.d.ts +3 -3
  237. package/dist/src/templates/carousel.d.ts.map +1 -1
  238. package/dist/src/templates/facet-filter-panel.d.ts +9 -3
  239. package/dist/src/templates/facet-filter-panel.d.ts.map +1 -1
  240. package/dist/src/templates/gallery.d.ts +2 -2
  241. package/dist/src/templates/gallery.d.ts.map +1 -1
  242. package/dist/src/templates/numeric-input.d.ts +1 -1
  243. package/dist/src/templates/numeric-input.d.ts.map +1 -1
  244. package/dist/src/templates/popover.d.ts +4 -2
  245. package/dist/src/templates/popover.d.ts.map +1 -1
  246. package/dist/src/templates/product-card.d.ts +12 -4
  247. package/dist/src/templates/product-card.d.ts.map +1 -1
  248. package/dist/src/templates/search-suggestions.d.ts +1 -1
  249. package/dist/src/templates/select.d.ts +7 -2
  250. package/dist/src/templates/select.d.ts.map +1 -1
  251. package/dist/src/templates/tabs.d.ts +8 -7
  252. package/dist/src/templates/tabs.d.ts.map +1 -1
  253. package/dist/src/theme/theme-config.d.ts +9 -16
  254. package/dist/src/theme/theme-config.d.ts.map +1 -1
  255. package/dist/src/theme/theme-provider.d.ts +16 -21
  256. package/dist/src/theme/theme-provider.d.ts.map +1 -1
  257. package/dist/src/theme/theme-toggle.d.ts.map +1 -1
  258. package/dist/src/utils.d.ts.map +1 -1
  259. package/dist/templates/accordion.js +3 -1
  260. package/dist/templates/breadcrumb.js +11 -4
  261. package/dist/templates/carousel.js +3 -6
  262. package/dist/templates/facet-filter-panel.js +121 -52
  263. package/dist/templates/gallery.js +6 -2
  264. package/dist/templates/numeric-input.js +6 -1
  265. package/dist/templates/popover.js +6 -1
  266. package/dist/templates/product-card.js +52 -26
  267. package/dist/templates/select.js +6 -1
  268. package/dist/templates/tabs.js +4 -2
  269. package/dist/theme/theme-config.js +8 -16
  270. package/dist/theme/theme-provider.js +89 -63
  271. package/dist/theme/theme-toggle.js +17 -9
  272. package/dist/utils.js +11 -1
  273. package/package.json +9 -5
  274. package/src/tokens/_base.css +4 -3
  275. package/src/tokens/_business-atoms.css +103 -0
  276. package/src/tokens/_foundation-overrides.css +251 -0
  277. package/src/tokens/_reset.css +10 -10
  278. package/src/tokens/_scheme-scopes.css +4144 -0
  279. package/src/tokens/_semantic.css +1 -23
  280. package/src/tokens/_tokens-base.css +36 -32
  281. package/src/tokens/_typography.css +2 -1
  282. package/src/tokens/components/_form-control.css +149 -6
  283. package/src/tokens/components/_popup-surface.css +15 -29
  284. package/src/tokens/components/atoms/_action-icon.css +49 -0
  285. package/src/tokens/components/atoms/_button.css +67 -0
  286. package/src/tokens/components/atoms/_checkbox.css +47 -4
  287. package/src/tokens/components/atoms/_hotkeys.css +2 -0
  288. package/src/tokens/components/atoms/_icon.css +60 -7
  289. package/src/tokens/components/atoms/_image.css +18 -0
  290. package/src/tokens/components/atoms/_input.css +20 -0
  291. package/src/tokens/components/atoms/_label.css +3 -7
  292. package/src/tokens/components/atoms/_link.css +47 -5
  293. package/src/tokens/components/atoms/_numeric-input.css +111 -2
  294. package/src/tokens/components/atoms/_rating.css +55 -6
  295. package/src/tokens/components/atoms/_skeleton.css +12 -2
  296. package/src/tokens/components/atoms/_status-text.css +35 -5
  297. package/src/tokens/components/atoms/_textarea.css +32 -3
  298. package/src/tokens/components/atoms/_tooltip.css +25 -0
  299. package/src/tokens/components/molecules/_accordion.css +46 -5
  300. package/src/tokens/components/molecules/_breadcrumb.css +15 -4
  301. package/src/tokens/components/molecules/_carousel.css +67 -0
  302. package/src/tokens/components/molecules/_cascade-select.css +104 -0
  303. package/src/tokens/components/molecules/_chart.css +12 -14
  304. package/src/tokens/components/molecules/_color-select.css +21 -0
  305. package/src/tokens/components/molecules/_combobox.css +81 -0
  306. package/src/tokens/components/molecules/_command.css +1 -0
  307. package/src/tokens/components/molecules/_date-picker.css +66 -10
  308. package/src/tokens/components/molecules/_dialog.css +36 -4
  309. package/src/tokens/components/molecules/_drawer.css +39 -3
  310. package/src/tokens/components/molecules/_file-upload.css +16 -1
  311. package/src/tokens/components/molecules/_menu.css +17 -0
  312. package/src/tokens/components/molecules/_pagination.css +19 -0
  313. package/src/tokens/components/molecules/_phone-input.css +20 -5
  314. package/src/tokens/components/molecules/_popover.css +34 -0
  315. package/src/tokens/components/molecules/_product-card.css +49 -0
  316. package/src/tokens/components/molecules/_radio-card.css +35 -0
  317. package/src/tokens/components/molecules/_radio-group.css +8 -0
  318. package/src/tokens/components/molecules/_select.css +33 -0
  319. package/src/tokens/components/molecules/_slider.css +5 -0
  320. package/src/tokens/components/molecules/_steps.css +52 -0
  321. package/src/tokens/components/molecules/_switch.css +59 -10
  322. package/src/tokens/components/molecules/_tabs.css +61 -3
  323. package/src/tokens/components/molecules/_toast.css +60 -0
  324. package/src/tokens/components/molecules/_totals-summary.css +22 -22
  325. package/src/tokens/components/molecules/_tour.css +16 -1
  326. package/src/tokens/components/molecules/_tree-view.css +27 -3
  327. package/src/tokens/components/molecules/_vertical-navigation.css +21 -3
  328. package/src/tokens/components/organisms/_data-table.css +97 -0
  329. package/src/tokens/components/organisms/_footer.css +9 -0
  330. package/src/tokens/components/organisms/_gallery.css +11 -0
  331. package/src/tokens/components/organisms/_header.css +22 -0
  332. package/src/tokens/components/organisms/_sidebar.css +1 -1
  333. package/src/tokens/components/organisms/_table.css +31 -0
  334. package/src/tokens/components/templates/_facet-filter-panel.css +11 -1
  335. package/src/tokens/figma/akros/variables.css +6 -6
  336. package/src/tokens/figma/brand-overrides.css +162 -57
  337. package/src/tokens/figma/business/variables.css +6 -6
  338. package/src/tokens/figma/cyber/variables.css +115 -38
  339. package/src/tokens/figma/cyber-dark/variables.css +115 -38
  340. package/src/tokens/figma/dark/variables.css +4 -4
  341. package/src/tokens/figma/light/variables.css +43 -40
  342. package/src/tokens/figma/{neo → n1}/variables.css +114 -114
  343. package/src/tokens/figma/variables.css +639 -240
  344. package/src/tokens/theme.css +24 -4
  345. package/src/tokens/_colors.css +0 -5
  346. package/src/tokens/figma/neo-dark/variables.css +0 -457
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
2
3
  import { CollisionPriority, CollisionType } from "@dnd-kit/abstract";
3
4
  import { RestrictToHorizontalAxis, RestrictToVerticalAxis } from "@dnd-kit/abstract/modifiers";
@@ -16,6 +17,7 @@ import { Button } from "../atoms/button.js";
16
17
  import { Checkbox } from "../atoms/checkbox.js";
17
18
  import { Icon } from "../atoms/icon.js";
18
19
  import { Skeleton } from "../atoms/skeleton.js";
20
+ import { StatusText } from "../atoms/status-text.js";
19
21
  import { Menu } from "../molecules/menu.js";
20
22
  import { Pagination } from "../molecules/pagination.js";
21
23
  import { SearchForm } from "../molecules/search-form.js";
@@ -26,27 +28,34 @@ import { Table } from "./table.js";
26
28
  const dataTableVariants = tv({
27
29
  slots: {
28
30
  wrapper: [
29
- "flex w-full flex-col overflow-hidden rounded-data-table",
31
+ "isolate flex w-full flex-col overflow-hidden rounded-data-table",
30
32
  "border-(length:--border-width-data-table) border-data-table-border"
31
33
  ],
32
34
  toolbar: [
33
- "flex items-center justify-between gap-data-table-toolbar",
35
+ "flex flex-wrap items-center justify-between gap-data-table-toolbar",
34
36
  "bg-data-table-toolbar-bg text-data-table-toolbar-fg",
35
37
  "p-data-table-toolbar",
36
38
  "border-b-(length:--border-width-data-table) border-data-table-border"
37
39
  ],
38
40
  toolbarSearch: [
39
- "min-w-0 flex-1"
41
+ "min-w-0 flex-1 basis-data-table-search"
40
42
  ],
41
43
  toolbarActions: [
42
- "flex shrink-0 items-center gap-data-table-toolbar"
44
+ "flex min-w-0 max-w-full flex-wrap items-center justify-end gap-data-table-toolbar"
43
45
  ],
44
46
  scroll: [
45
- "relative w-full overflow-auto"
47
+ "@container/data-table relative w-full overflow-auto"
46
48
  ],
47
49
  headerLabel: [
48
50
  "inline-flex items-center gap-100 whitespace-nowrap"
49
51
  ],
52
+ cellContent: [
53
+ "min-w-0 max-w-full"
54
+ ],
55
+ columnDropIndicator: [
56
+ "after:pointer-events-none after:absolute after:inset-y-0 after:border-data-table-sort-icon-fg-active after:border-s-2",
57
+ "data-[drop-side=end]:after:inset-e-0 data-[drop-side=start]:after:inset-s-0"
58
+ ],
50
59
  sortButton: [
51
60
  "inline-flex items-center gap-100 whitespace-nowrap",
52
61
  "cursor-pointer select-none bg-transparent text-start",
@@ -76,17 +85,19 @@ const dataTableVariants = tv({
76
85
  ],
77
86
  filterCell: [
78
87
  "p-data-table-filter-cell",
79
- "min-w-fit",
80
88
  "border-b-(length:--border-width-data-table) border-data-table-border"
81
89
  ],
90
+ filterViewport: [
91
+ "data-table-filter-viewport"
92
+ ],
82
93
  filterControl: [
83
- "flex flex-wrap items-center gap-data-table-filter-control"
94
+ "data-table-filter-control flex items-center gap-data-table-filter-control"
84
95
  ],
85
96
  editorControl: [
86
- "flex flex-col gap-data-table-editor"
97
+ "data-table-editor flex min-w-0 max-w-full flex-col gap-data-table-editor"
87
98
  ],
88
- editorError: [
89
- "text-data-table-editor-error-fg text-data-table-sm"
99
+ emptyViewport: [
100
+ "data-table-empty-viewport wrap-anywhere min-w-0"
90
101
  ],
91
102
  actionsCell: [
92
103
  "flex items-center justify-end gap-100"
@@ -116,6 +127,14 @@ const dataTableVariants = tv({
116
127
  true: {
117
128
  wrapper: "shadow-data-table-outline"
118
129
  }
130
+ },
131
+ fixedLayout: {
132
+ true: {
133
+ headerLabel: "min-w-0 max-w-full whitespace-normal",
134
+ sortButton: "wrap-anywhere min-w-0 max-w-full whitespace-normal",
135
+ sortIcon: "shrink-0",
136
+ cellContent: "wrap-anywhere"
137
+ }
119
138
  }
120
139
  }
121
140
  });
@@ -332,6 +351,7 @@ function useDataTableContext() {
332
351
  return ctx;
333
352
  }
334
353
  const DEFAULT_TRANSLATIONS = {
354
+ scrollLabel: "Scrollable records",
335
355
  searchPlaceholder: "Search…",
336
356
  searchLabel: "Search",
337
357
  clearSearchLabel: "Clear search",
@@ -349,7 +369,14 @@ const DEFAULT_TRANSLATIONS = {
349
369
  operatorLabels: {},
350
370
  editingLabel: "Editing a row — other table controls are locked",
351
371
  rangeLabel: ({ start, end, total })=>`${start}–${end} of ${total}`,
352
- requiredLabel: "Required"
372
+ requiredLabel: "Enter a value before saving this row.",
373
+ pageLabel: ({ page, pageCount })=>null == pageCount ? `Page ${page}` : `Page ${page} of ${pageCount}`,
374
+ previousPageLabel: "Previous page",
375
+ nextPageLabel: "Next page",
376
+ paginationPendingLabel: "Page unavailable — requesting an available page.",
377
+ invalidRangeLabel: "Enter valid dates with the start on or before the end.",
378
+ savePendingLabel: "Saving row…",
379
+ saveErrorLabel: "Could not save this row. Your changes are kept; try Save again."
353
380
  };
354
381
  const SELECTION_COLUMN_ID = "__select";
355
382
  const EMPTY_COLUMN_PINNING = {
@@ -387,7 +414,7 @@ function HeaderSortLabel({ header, styles, enableSorting, locked }) {
387
414
  const canSort = enableSorting && column.getCanSort();
388
415
  const sortDir = column.getIsSorted();
389
416
  const label = header.isPlaceholder ? null : flexRender(column.columnDef.header, header.getContext());
390
- if (!canSort) return /*#__PURE__*/ jsx(Fragment, {
417
+ if (header.isPlaceholder || !canSort) return /*#__PURE__*/ jsx(Fragment, {
391
418
  children: label
392
419
  });
393
420
  let sortIconName = "icon-[mdi--unfold-more-horizontal]";
@@ -410,7 +437,7 @@ function HeaderSortLabel({ header, styles, enableSorting, locked }) {
410
437
  ]
411
438
  });
412
439
  }
413
- function renderCellContent({ cell, column, styles, enableRowReorder, dnd, editor, editorError, editorErrorId, isDragCol, rowLabel }) {
440
+ function renderCellContent({ cell, column, styles, enableRowReorder, dnd, editor, editorError, editorErrorId, size, tableLayout, isDragCol, rowLabel }) {
414
441
  if (isDragCol && enableRowReorder && dnd) return /*#__PURE__*/ jsx("button", {
415
442
  "aria-label": `Drag to reorder ${rowLabel}`,
416
443
  className: styles.dragHandle(),
@@ -425,17 +452,27 @@ function renderCellContent({ cell, column, styles, enableRowReorder, dnd, editor
425
452
  if (editor) return /*#__PURE__*/ jsxs("div", {
426
453
  className: styles.editorControl(),
427
454
  "data-editor-control": "",
455
+ "data-layout": tableLayout,
456
+ "data-type": resolveColumnType(column.columnDef.meta),
428
457
  children: [
429
- editor,
430
- editorError ? /*#__PURE__*/ jsx("span", {
431
- className: styles.editorError(),
458
+ /*#__PURE__*/ jsx("div", {
459
+ className: "data-table-editor-value",
460
+ "data-size": size,
461
+ children: editor
462
+ }),
463
+ editorError ? /*#__PURE__*/ jsx(StatusText, {
432
464
  id: editorErrorId,
433
- role: "alert",
465
+ size: size,
466
+ status: "error",
434
467
  children: editorError
435
468
  }) : null
436
469
  ]
437
470
  });
438
- return flexRender(column.columnDef.cell, cell.getContext());
471
+ const content = flexRender(column.columnDef.cell, cell.getContext());
472
+ return "fixed" === tableLayout ? /*#__PURE__*/ jsx("div", {
473
+ className: styles.cellContent(),
474
+ children: content
475
+ }) : content;
439
476
  }
440
477
  function stickyRowOffset(stickyHeader, offsets, groupIndex) {
441
478
  if (!stickyHeader) return;
@@ -443,7 +480,8 @@ function stickyRowOffset(stickyHeader, offsets, groupIndex) {
443
480
  top: offsets[groupIndex] ?? 0
444
481
  };
445
482
  }
446
- function DataTableBodyCell({ cell, span, row, styles, columnSizing, enableColumnResizing, enableRowReorder, dnd, editor, editorError, editorErrorId, indentColumnId, rowLabel }) {
483
+ function DataTableBodyCell({ cell, span, row, styles, columnSizing, enableColumnResizing, enableRowReorder, dnd, editor, editorError, editorErrorId, size, indentColumnId, rowLabel, pinningStyle }) {
484
+ const tableLayout = useContext(FieldTableLayoutContext);
447
485
  const column = cell.column;
448
486
  const pinned = column.getIsPinned();
449
487
  const isDragCol = column.id === DRAG_COLUMN_ID;
@@ -458,6 +496,7 @@ function DataTableBodyCell({ cell, span, row, styles, columnSizing, enableColumn
458
496
  rowSpan: span?.rowSpan,
459
497
  style: {
460
498
  ...getPinningStyles(column),
499
+ ...pinningStyle,
461
500
  ...getColumnSizeStyles(column, enableColumnResizing, columnSizing),
462
501
  ...indent
463
502
  },
@@ -470,31 +509,46 @@ function DataTableBodyCell({ cell, span, row, styles, columnSizing, enableColumn
470
509
  editor,
471
510
  editorError,
472
511
  editorErrorId,
512
+ size,
513
+ tableLayout,
473
514
  isDragCol,
474
515
  rowLabel
475
516
  })
476
517
  });
477
518
  }
478
- function validateDraft(columns, draft, requiredLabel) {
519
+ const DATE_RANGE_BOUND_RE = /^\d{4}-\d{2}-\d{2}$/;
520
+ function validDateRange(value) {
521
+ const validDate = (raw)=>!raw || DATE_RANGE_BOUND_RE.test(raw) && Number.isFinite(Date.parse(`${raw}T00:00:00Z`)) && new Date(`${raw}T00:00:00Z`).toISOString().slice(0, 10) === raw;
522
+ return validDate(value.from) && validDate(value.to) && !(value.from && value.to && value.from > value.to);
523
+ }
524
+ function validateDraft(columns, draft, requiredLabel, invalidRangeLabel) {
479
525
  const errors = {};
480
526
  for (const column of columns){
481
527
  const meta = column.columnDef.meta;
482
528
  if (!meta?.editable) continue;
483
529
  const value = draft[column.id];
484
- const empty = isBlank(value) || "number" == typeof value && Number.isNaN(value) || Array.isArray(value) && 0 === value.length;
530
+ const dateRange = "dateRange" === resolveColumnType(meta) ? value : void 0;
531
+ const empty = "dateRange" === resolveColumnType(meta) && isBlank(dateRange?.from) && isBlank(dateRange?.to) || isBlank(value) || "number" == typeof value && Number.isNaN(value) || Array.isArray(value) && 0 === value.length;
485
532
  if (meta.required && empty) {
486
533
  errors[column.id] = requiredLabel;
487
534
  continue;
488
535
  }
536
+ if (dateRange && !validDateRange(dateRange)) {
537
+ errors[column.id] = invalidRangeLabel;
538
+ continue;
539
+ }
489
540
  const message = meta.validate?.(value, draft);
490
541
  if (message) errors[column.id] = message;
491
542
  }
492
543
  return errors;
493
544
  }
494
- function renderExpandedDetailRow({ row, renderExpandedRow, colSpan, instanceId, styles, tintNestedRows }) {
545
+ function renderExpandedDetailRow({ row, renderExpandedRow, colSpan, instanceId, styles, tintNestedRows, rowIndex, virtualIndex, measureElement }) {
495
546
  return /*#__PURE__*/ jsx(Table.Row, {
547
+ "aria-rowindex": rowIndex,
496
548
  className: tintNestedRows ? "data-table-row-nested-tint" : void 0,
497
549
  "data-depth": row.depth + 1,
550
+ "data-index": virtualIndex,
551
+ ref: measureElement,
498
552
  children: /*#__PURE__*/ jsx(Table.Cell, {
499
553
  colSpan: colSpan,
500
554
  children: /*#__PURE__*/ jsx("div", {
@@ -566,6 +620,8 @@ function buildRowKeyDownHandler(row, onRowClick, blocked) {
566
620
  function buildRowClickHandler(row, rowOnClick, onRowClick, blocked) {
567
621
  return (event)=>{
568
622
  rowOnClick?.(event);
623
+ const interactive = event.target.closest?.('button, a[href], input, select, textarea, summary, [contenteditable]:not([contenteditable="false"]), [role="button"], [role="link"], [role="checkbox"], [role="switch"], [role="combobox"], [tabindex]');
624
+ if (event.defaultPrevented || interactive && interactive !== event.currentTarget) return;
569
625
  if (onRowClick && !blocked("rowClick")) onRowClick(row, event);
570
626
  };
571
627
  }
@@ -588,7 +644,7 @@ function DataTable(props) {
588
644
  25,
589
645
  50,
590
646
  100
591
- ], manualSorting, manualFiltering, manualPagination, rowCount, pageCount, onRowClick, onReachEnd, onColumnReorder, onRowReorder, onCellEditCommit, onReady, renderToolbar, toolbarActions, renderEmpty, renderRowActions, renderHeaderFilter, renderExpandedRow, slotProps, translations: translationsProp, estimateRowHeight = 44, reachEndThreshold = 240, enableInlineEdit = false, editingRowId: editingRowIdProp, onEditingRowIdChange, onEditStart, onEditChange, onEditCommit, onEditCancel, onEditValidationError, lockInteractionsWhileEditing = true, onInteractionBlocked, filterRenderers, editorRenderers, stickyActions = true, paginationProps, canEditRow, rowActions, getRowLabel, striped = false, tintNestedRows = false, loading = false, loadingRowCount = 5, loadingMore = false, selectionMode = "multiple", maxSelectedRows, canSelectRow, onSelectionLimitReached } = props;
647
+ ], manualSorting, manualFiltering, manualPagination, rowCount, pageCount, hasNextPage, onRowClick, onReachEnd, onColumnReorder, onRowReorder, onCellEditCommit, onReady, renderToolbar, toolbarActions, renderEmpty, renderRowActions, renderHeaderFilter, renderExpandedRow, slotProps, translations: translationsProp, estimateRowHeight = 44, reachEndThreshold = 240, enableInlineEdit = false, editingRowId: editingRowIdProp, onEditingRowIdChange, onEditStart, onEditChange, onEditCommit, onEditCancel, onEditValidationError, lockInteractionsWhileEditing = true, onInteractionBlocked, filterRenderers, editorRenderers, stickyActions = true, paginationProps, canEditRow, rowActions, getRowLabel, striped = false, tintNestedRows = false, loading = false, loadingRowCount = 5, loadingMore = false, selectionMode = "multiple", maxSelectedRows, canSelectRow, onSelectionLimitReached } = props;
592
648
  const translations = {
593
649
  ...DEFAULT_TRANSLATIONS
594
650
  };
@@ -598,11 +654,29 @@ function DataTable(props) {
598
654
  const outlined = "outline" === variant;
599
655
  const effectiveStriped = striped || "striped" === variant;
600
656
  const styles = dataTableVariants({
601
- outlined
657
+ outlined,
658
+ fixedLayout: "fixed" === tableLayout
602
659
  });
603
660
  const generatedId = useId();
604
661
  const instanceId = idProp ?? generatedId;
605
662
  const scrollRef = useRef(null);
663
+ const [direction, setDirection] = useState("ltr");
664
+ useIsomorphicLayoutEffect(()=>{
665
+ const element = scrollRef.current;
666
+ if (!element) return;
667
+ const update = ()=>setDirection("rtl" === getComputedStyle(element).direction ? "rtl" : "ltr");
668
+ const observer = new MutationObserver(update);
669
+ for(let ancestor = element; ancestor; ancestor = ancestor.parentElement)observer.observe(ancestor, {
670
+ attributes: true,
671
+ attributeFilter: [
672
+ "dir",
673
+ "class",
674
+ "style"
675
+ ]
676
+ });
677
+ update();
678
+ return ()=>observer.disconnect();
679
+ }, []);
606
680
  const reachedEndRef = useRef(false);
607
681
  const lastReachEndCountRef = useRef(-1);
608
682
  const reportedSelectionLimitRef = useRef(null);
@@ -687,6 +761,15 @@ function DataTable(props) {
687
761
  draftRef.current = draft;
688
762
  const [editErrors, setEditErrors] = useState({});
689
763
  const [dirty, setDirty] = useState(false);
764
+ const [savePending, setSavePending] = useState(false);
765
+ const [saveError, setSaveError] = useState();
766
+ const savingRef = useRef(false);
767
+ useEffect(()=>{
768
+ if (savePending || saveError) scrollRef.current?.querySelector('[aria-label="Save row"]')?.focus();
769
+ }, [
770
+ saveError,
771
+ savePending
772
+ ]);
690
773
  const isEditing = null != editingRowId;
691
774
  const locked = isEditing && lockInteractionsWhileEditing;
692
775
  const blocked = (action)=>{
@@ -702,6 +785,7 @@ function DataTable(props) {
702
785
  const selectionLimitReached = null != maxSelectedRows && selectedCount >= maxSelectedRows;
703
786
  const rowSelectionPredicate = (row)=>{
704
787
  const isSelected = true === rowSelection[row.id];
788
+ if (isSelected) return true;
705
789
  if (canSelectRow && !canSelectRow(row, {
706
790
  selectedCount,
707
791
  isSelected
@@ -769,6 +853,7 @@ function DataTable(props) {
769
853
  enableColumnPinning,
770
854
  enableColumnResizing,
771
855
  columnResizeMode: "onChange",
856
+ columnResizeDirection: direction,
772
857
  manualSorting,
773
858
  manualFiltering,
774
859
  manualPagination: manualPagination || !enablePagination,
@@ -848,12 +933,19 @@ function DataTable(props) {
848
933
  0
849
934
  ];
850
935
  for (const node of nodes)offsets.push((offsets.at(-1) ?? 0) + node.getBoundingClientRect().height);
851
- setHeaderOffsets(offsets);
936
+ setHeaderOffsets((old)=>old.length === offsets.length && offsets.every((offset, index)=>offset === old[index]) ? old : offsets);
852
937
  };
853
- const observer = new ResizeObserver(measure);
854
- for (const node of nodes)observer.observe(node);
938
+ let frame = 0;
939
+ const observer = "u" < typeof ResizeObserver ? void 0 : new ResizeObserver(()=>{
940
+ cancelAnimationFrame(frame);
941
+ frame = requestAnimationFrame(measure);
942
+ });
943
+ for (const node of nodes)observer?.observe(node);
855
944
  measure();
856
- return ()=>observer.disconnect();
945
+ return ()=>{
946
+ observer?.disconnect();
947
+ cancelAnimationFrame(frame);
948
+ };
857
949
  }, [
858
950
  stickyHeader,
859
951
  headerGroupCount
@@ -864,6 +956,7 @@ function DataTable(props) {
864
956
  draftRowIdRef.current = row.id;
865
957
  setDraft(initial);
866
958
  setEditErrors({});
959
+ setSaveError(void 0);
867
960
  setDirty(false);
868
961
  };
869
962
  const startEdit = (row)=>{
@@ -877,6 +970,7 @@ function DataTable(props) {
877
970
  });
878
971
  };
879
972
  const setDraftValue = (rowId, columnId, value)=>{
973
+ if (savingRef.current) return;
880
974
  const next = {
881
975
  ...draftRef.current,
882
976
  [columnId]: value
@@ -896,16 +990,17 @@ function DataTable(props) {
896
990
  } : old);
897
991
  };
898
992
  const cancelEdit = ()=>{
899
- if (!isEditing) return;
993
+ if (!isEditing || savingRef.current) return;
900
994
  const rowId = editingRowId;
901
995
  setEditingRowId(null);
996
+ setSaveError(void 0);
902
997
  onEditCancel?.({
903
998
  rowId,
904
999
  dirty
905
1000
  });
906
1001
  };
907
- const commitEdit = ()=>{
908
- if (!isEditing) return;
1002
+ const commitEdit = async ()=>{
1003
+ if (!isEditing || savingRef.current) return;
909
1004
  const rowId = editingRowId;
910
1005
  const row = table.getCoreRowModel().rowsById[rowId];
911
1006
  if (!row) return void cancelEdit();
@@ -916,7 +1011,7 @@ function DataTable(props) {
916
1011
  return Boolean(meta.renderEditor || editorRenderers?.custom);
917
1012
  });
918
1013
  const committed = draftRef.current;
919
- const errors = validateDraft(editableColumns, committed, translations.requiredLabel);
1014
+ const errors = validateDraft(editableColumns, committed, translations.requiredLabel, translations.invalidRangeLabel);
920
1015
  if (Object.keys(errors).length > 0) {
921
1016
  setEditErrors(errors);
922
1017
  onEditValidationError?.({
@@ -925,13 +1020,48 @@ function DataTable(props) {
925
1020
  });
926
1021
  return;
927
1022
  }
928
- onEditCommit?.({
929
- rowId,
930
- draft: committed,
931
- row: row.original
932
- });
933
- setEditingRowId(null);
1023
+ savingRef.current = true;
1024
+ setSavePending(true);
1025
+ setSaveError(void 0);
1026
+ try {
1027
+ await onEditCommit?.({
1028
+ rowId,
1029
+ draft: committed,
1030
+ row: row.original
1031
+ });
1032
+ if (draftRowIdRef.current === rowId) setEditingRowId(null);
1033
+ } catch {
1034
+ if (draftRowIdRef.current === rowId) setSaveError(translations.saveErrorLabel);
1035
+ } finally{
1036
+ savingRef.current = false;
1037
+ setSavePending(false);
1038
+ }
934
1039
  };
1040
+ const lastCorrection = useRef(void 0);
1041
+ const settledPageCount = null == rowCount ? pageCount : Math.ceil(rowCount / pagination.pageSize);
1042
+ const invalidPage = enablePagination && null != settledPageCount && settledPageCount >= 0 && pagination.pageIndex > Math.max(0, settledPageCount - 1);
1043
+ useEffect(()=>{
1044
+ if (loading || loadingMore || !invalidPage) {
1045
+ if (!invalidPage) lastCorrection.current = void 0;
1046
+ return;
1047
+ }
1048
+ const corrected = Math.max(0, (settledPageCount ?? 0) - 1);
1049
+ const key = `${pagination.pageIndex}:${pagination.pageSize}:${corrected}`;
1050
+ if (lastCorrection.current === key) return;
1051
+ lastCorrection.current = key;
1052
+ setPagination({
1053
+ pageSize: pagination.pageSize,
1054
+ pageIndex: corrected
1055
+ });
1056
+ }, [
1057
+ invalidPage,
1058
+ loading,
1059
+ loadingMore,
1060
+ pagination.pageIndex,
1061
+ pagination.pageSize,
1062
+ settledPageCount,
1063
+ setPagination
1064
+ ]);
935
1065
  const rows = table.getRowModel().rows;
936
1066
  const rootRowIds = useMemo(()=>rows.filter((r)=>0 === r.depth).map((r)=>r.id), [
937
1067
  rows
@@ -941,6 +1071,24 @@ function DataTable(props) {
941
1071
  headerGroups
942
1072
  ]);
943
1073
  const columnCount = leafColumns.length;
1074
+ const logicalRows = rows.flatMap((row, index)=>[
1075
+ {
1076
+ row,
1077
+ index,
1078
+ detail: false
1079
+ },
1080
+ ...renderExpandedRow && row.getIsExpanded() ? [
1081
+ {
1082
+ row,
1083
+ index,
1084
+ detail: true
1085
+ }
1086
+ ] : []
1087
+ ]);
1088
+ const logicalRowPosition = new Map();
1089
+ logicalRows.forEach((item, index)=>{
1090
+ if (!item.detail) logicalRowPosition.set(item.row.id, index);
1091
+ });
944
1092
  const virtualizationUsable = enableVirtualization && !!maxHeight;
945
1093
  const hasWarnedAboutUnboundedVirtualization = useRef(false);
946
1094
  const hasWarnedAboutVirtualizedCellSpan = useRef(false);
@@ -974,10 +1122,12 @@ function DataTable(props) {
974
1122
  maxHeight
975
1123
  ]);
976
1124
  const rowVirtualizer = useVirtualizer({
977
- count: rows.length,
1125
+ count: logicalRows.length,
1126
+ getItemKey: (index)=>`${logicalRows[index]?.row.id}:${logicalRows[index]?.detail ? "detail" : "record"}`,
978
1127
  getScrollElement: ()=>scrollRef.current,
979
1128
  estimateSize: ()=>estimateRowHeight,
980
1129
  overscan: 12,
1130
+ useAnimationFrameWithResizeObserver: true,
981
1131
  enabled: virtualizationUsable
982
1132
  });
983
1133
  const virtualItems = virtualizationUsable ? rowVirtualizer.getVirtualItems() : [];
@@ -986,17 +1136,11 @@ function DataTable(props) {
986
1136
  const paddingTop = firstVirtual ? firstVirtual.start : 0;
987
1137
  const paddingBottom = lastVirtual ? rowVirtualizer.getTotalSize() - lastVirtual.end : 0;
988
1138
  const renderRows = virtualizationUsable ? virtualItems.flatMap((vi)=>{
989
- const row = rows[vi.index];
990
- return row ? [
991
- {
992
- row,
993
- index: vi.index
994
- }
1139
+ const item = logicalRows[vi.index];
1140
+ return item ? [
1141
+ item
995
1142
  ] : [];
996
- }) : rows.map((row, index)=>({
997
- row,
998
- index
999
- }));
1143
+ }) : logicalRows;
1000
1144
  useEffect(()=>{
1001
1145
  if (!onReachEnd || maxHeight) return;
1002
1146
  const onWindowScroll = ()=>{
@@ -1109,28 +1253,90 @@ function DataTable(props) {
1109
1253
  const width = Math.ceil(widest + Number.parseFloat(cellStyle.paddingLeft) + Number.parseFloat(cellStyle.paddingRight));
1110
1254
  if (width !== fixedActionsWidth) setFixedActionsWidth(width);
1111
1255
  });
1112
- const hasWarnedAboutPinnedActionsOverlap = useRef(false);
1113
- useEffect(()=>{
1114
- const endPinned = enableColumnPinning && table.getAllLeafColumns().some((c)=>"end" === c.getIsPinned());
1115
- if (!(endPinned && stickyActions && hasActionsColumn) || hasWarnedAboutPinnedActionsOverlap.current || "u" < typeof process || process.env?.NODE_ENV === "production") return;
1116
- hasWarnedAboutPinnedActionsOverlap.current = true;
1117
- console.warn("DataTable: a column pinned to 'end' and the sticky actions cell both freeze at the trailing edge, so they overlap — the actions column is not part of the column model, so end-pinned offsets cannot account for its width. Use stickyActions={false}, or pin to 'start' instead.");
1256
+ const [renderedWidths, setRenderedWidths] = useState({});
1257
+ const [renderedActionsWidth, setRenderedActionsWidth] = useState(0);
1258
+ const [viewportWidth, setViewportWidth] = useState(0);
1259
+ useIsomorphicLayoutEffect(()=>{
1260
+ const host = scrollRef.current;
1261
+ if (!host) return;
1262
+ const cells = host.querySelectorAll("thead [data-leaf-column], thead [data-actions-column]");
1263
+ const measure = ()=>{
1264
+ setViewportWidth(host.clientWidth);
1265
+ const widths = {};
1266
+ for (const cell of cells){
1267
+ const width = cell.getBoundingClientRect().width;
1268
+ const id = cell.dataset.leafColumn;
1269
+ if (null == id) {
1270
+ const offsetWidth = "auto" === getComputedStyle(cell).insetInlineEnd ? 0 : width;
1271
+ setRenderedActionsWidth((old)=>Math.abs(old - offsetWidth) < 0.5 ? old : offsetWidth);
1272
+ } else widths[id] = width;
1273
+ }
1274
+ setRenderedWidths((old)=>Object.keys(widths).length === Object.keys(old).length && Object.entries(widths).every(([id, width])=>Math.abs((old[id] ?? 0) - width) < 0.5) ? old : widths);
1275
+ };
1276
+ let frame = 0;
1277
+ const observer = "u" < typeof ResizeObserver ? void 0 : new ResizeObserver(()=>{
1278
+ cancelAnimationFrame(frame);
1279
+ frame = requestAnimationFrame(measure);
1280
+ });
1281
+ observer?.observe(host);
1282
+ for (const cell of cells)observer?.observe(cell);
1283
+ measure();
1284
+ return ()=>{
1285
+ observer?.disconnect();
1286
+ cancelAnimationFrame(frame);
1287
+ };
1118
1288
  }, [
1119
- enableColumnPinning,
1120
- stickyActions,
1289
+ leafColumns,
1290
+ headerGroupCount,
1121
1291
  hasActionsColumn,
1122
- table
1123
- ]);
1124
- const hasWarnedAboutPinnedStringWidth = useRef(false);
1125
- useEffect(()=>{
1126
- const offender = enableColumnPinning && table.getAllLeafColumns().find((c)=>c.getIsPinned() && "string" == typeof c.columnDef.meta?.width);
1127
- if (!offender || hasWarnedAboutPinnedStringWidth.current || "u" < typeof process || process.env?.NODE_ENV === "production") return;
1128
- hasWarnedAboutPinnedStringWidth.current = true;
1129
- console.warn(`DataTable: pinned column "${offender.id}" declares a string meta.width, which cannot be mirrored into TanStack's numeric \`size\`. Frozen offsets are computed from \`size\`, so this column will be positioned as if it were the default width and overlap its neighbours. Give pinned columns a numeric meta.width.`);
1130
- }, [
1131
- enableColumnPinning,
1132
- table
1292
+ stickyActions
1133
1293
  ]);
1294
+ const renderedTableWidth = leafColumns.reduce((sum, leaf)=>sum + (renderedWidths[leaf.id] ?? leaf.getSize()), renderedActionsWidth);
1295
+ const scrollableBudget = renderedTableWidth > viewportWidth ? 0.4 * viewportWidth : 0;
1296
+ const fittingPins = new Set();
1297
+ let pinnedWidth = renderedActionsWidth;
1298
+ const pinCandidates = [
1299
+ ...leafColumns.filter((leaf)=>"start" === leaf.getIsPinned()),
1300
+ ...leafColumns.filter((leaf)=>"end" === leaf.getIsPinned()).reverse()
1301
+ ];
1302
+ for (const leaf of pinCandidates){
1303
+ const width = renderedWidths[leaf.id] ?? leaf.getSize();
1304
+ if (0 === viewportWidth || pinnedWidth + width + scrollableBudget < viewportWidth) {
1305
+ fittingPins.add(leaf.id);
1306
+ pinnedWidth += width;
1307
+ }
1308
+ }
1309
+ const unpinnedPosition = {
1310
+ header: stickyHeader ? "sticky" : "relative",
1311
+ body: "static"
1312
+ };
1313
+ const pinningStyles = (column, kind = "body")=>{
1314
+ const pinned = column.getIsPinned();
1315
+ if (!pinned) return {};
1316
+ const descendants = column.columns.length > 0 ? column.getLeafColumns() : [
1317
+ column
1318
+ ];
1319
+ if (!descendants.every((leaf)=>fittingPins.has(leaf.id))) return {
1320
+ position: unpinnedPosition[kind],
1321
+ insetInlineStart: "auto",
1322
+ insetInlineEnd: "auto",
1323
+ zIndex: void 0
1324
+ };
1325
+ const siblings = leafColumns.filter((leaf)=>leaf.getIsPinned() === pinned && fittingPins.has(leaf.id));
1326
+ const target = "start" === pinned ? descendants[0] : descendants.at(-1);
1327
+ const index = siblings.findIndex((leaf)=>leaf.id === target?.id);
1328
+ const preceding = "start" === pinned ? siblings.slice(0, index) : siblings.slice(index + 1);
1329
+ const offset = preceding.reduce((sum, leaf)=>sum + (renderedWidths[leaf.id] ?? leaf.getSize()), 0);
1330
+ const actionsOffset = stickyActions && hasActionsColumn ? renderedActionsWidth : 0;
1331
+ return {
1332
+ ...getPinningStyles(column, kind),
1333
+ ..."start" === pinned ? {
1334
+ insetInlineStart: offset
1335
+ } : {
1336
+ insetInlineEnd: offset + actionsOffset
1337
+ }
1338
+ };
1339
+ };
1134
1340
  const renderColumnFilter = (column)=>{
1135
1341
  const meta = column.columnDef.meta;
1136
1342
  const type = resolveColumnType(meta);
@@ -1150,26 +1356,67 @@ function DataTable(props) {
1150
1356
  const renderer = filterRenderers?.[type] ?? DEFAULT_FILTER_RENDERERS[type];
1151
1357
  return renderer?.(ctx) ?? null;
1152
1358
  };
1359
+ const handleColumnResizeKeyDown = (event, column)=>{
1360
+ if ([
1361
+ "Enter",
1362
+ "Home"
1363
+ ].includes(event.key)) {
1364
+ event.preventDefault();
1365
+ column.resetSize();
1366
+ return;
1367
+ }
1368
+ const arrowDirection = {
1369
+ ArrowLeft: -1,
1370
+ ArrowRight: 1
1371
+ }[event.key];
1372
+ if (!arrowDirection) return;
1373
+ event.preventDefault();
1374
+ const delta = (event.shiftKey ? 50 : 10) * arrowDirection * ("rtl" === table.options.columnResizeDirection ? -1 : 1);
1375
+ const min = column.columnDef.minSize ?? 20;
1376
+ const max = column.columnDef.maxSize ?? Number.MAX_SAFE_INTEGER;
1377
+ const renderedSize = event.currentTarget.closest("th")?.getBoundingClientRect().width;
1378
+ const currentSize = columnSizing[column.id] ?? renderedSize ?? column.getSize();
1379
+ const nextSize = Math.min(max, Math.max(min, currentSize + delta));
1380
+ table.setColumnSizing((current)=>({
1381
+ ...current,
1382
+ [column.id]: nextSize
1383
+ }));
1384
+ };
1385
+ const handleColumnResizeStart = (event, header)=>{
1386
+ const renderedSize = event.currentTarget.closest("th")?.getBoundingClientRect().width;
1387
+ header.getResizeHandler()(event);
1388
+ if (null == renderedSize || renderedSize <= 0) return;
1389
+ table.setColumnResizing((current)=>current.isResizingColumn === header.column.id ? {
1390
+ ...current,
1391
+ startSize: renderedSize,
1392
+ columnSizingStart: [
1393
+ [
1394
+ header.column.id,
1395
+ renderedSize
1396
+ ]
1397
+ ]
1398
+ } : current);
1399
+ };
1153
1400
  const renderHeaderCell = (header, groupIndex, dnd)=>{
1154
1401
  const column = header.column;
1155
- const ariaSort = sortState(column, enableSorting);
1156
- let dropClass = "";
1157
- if (dnd?.dropSide === "start") dropClass = "border-primary border-s-2";
1158
- else if (dnd?.dropSide === "end") dropClass = "border-primary border-e-2";
1402
+ const ariaSort = header.isPlaceholder ? void 0 : sortState(column, enableSorting);
1403
+ const dropClass = dnd?.dropSide ? styles.columnDropIndicator() : "";
1159
1404
  return /*#__PURE__*/ jsxs(Table.ColumnHeader, {
1160
1405
  align: column.columnDef.meta?.align,
1161
1406
  "aria-sort": ariaSort,
1162
1407
  className: `group/header ${stickyHeader ? "" : "relative"} ${pinClass(column, "header") ?? ""} ${dropClass}`,
1163
1408
  colSpan: header.colSpan,
1164
1409
  "data-dragging": dnd?.isDragging || void 0,
1410
+ "data-drop-side": dnd?.dropSide,
1411
+ "data-leaf-column": 0 === column.columns.length ? column.id : void 0,
1165
1412
  "data-pinned": column.getIsPinned() || void 0,
1166
1413
  ref: dnd?.nodeRef,
1167
1414
  style: {
1168
1415
  ...OPAQUE_HEADER_BG,
1169
1416
  ...stickyRowOffset(stickyHeader, headerOffsets, groupIndex),
1170
- ...getPinningStyles(column, "header"),
1417
+ ...pinningStyles(column, "header"),
1171
1418
  ...dnd?.style,
1172
- ...getColumnSizeStyles(column, enableColumnResizing, columnSizing)
1419
+ ...0 === column.columns.length ? getColumnSizeStyles(column, enableColumnResizing, columnSizing) : void 0
1173
1420
  },
1174
1421
  children: [
1175
1422
  /*#__PURE__*/ jsxs("div", {
@@ -1188,12 +1435,14 @@ function DataTable(props) {
1188
1435
  })
1189
1436
  ]
1190
1437
  }),
1191
- enableColumnResizing && column.getCanResize() ? /*#__PURE__*/ jsx("button", {
1438
+ enableColumnResizing && !header.isPlaceholder && 0 === column.columns.length && column.getCanResize() ? /*#__PURE__*/ jsx("button", {
1439
+ "aria-description": "Use Left and Right arrows to resize; Shift changes by 50 pixels. Enter resets the width.",
1192
1440
  "aria-label": `Resize ${columnLabel(column)}`,
1193
1441
  className: styles.resizeHandle(),
1194
1442
  onDoubleClick: ()=>column.resetSize(),
1195
- onMouseDown: header.getResizeHandler(),
1196
- onTouchStart: header.getResizeHandler(),
1443
+ onKeyDown: (event)=>handleColumnResizeKeyDown(event, column),
1444
+ onMouseDown: (event)=>handleColumnResizeStart(event, header),
1445
+ onTouchStart: (event)=>handleColumnResizeStart(event, header),
1197
1446
  type: "button"
1198
1447
  }) : null
1199
1448
  ]
@@ -1218,7 +1467,8 @@ function DataTable(props) {
1218
1467
  }, header.id) : renderHeaderCell(header, groupIndex);
1219
1468
  }),
1220
1469
  hasActionsColumn && 0 === groupIndex && /*#__PURE__*/ jsx(Table.ColumnHeader, {
1221
- className: stickyActions ? "sticky inset-e-0" : void 0,
1470
+ className: stickyActions ? "data-table-actions-sticky sticky" : void 0,
1471
+ "data-actions-column": "",
1222
1472
  numeric: true,
1223
1473
  rowSpan: table.getHeaderGroups().length,
1224
1474
  style: {
@@ -1243,7 +1493,7 @@ function DataTable(props) {
1243
1493
  "data-pinned": column.getIsPinned() || void 0,
1244
1494
  style: {
1245
1495
  ...OPAQUE_FILTER_ROW_BG,
1246
- ...getPinningStyles(column, "header"),
1496
+ ...pinningStyles(column, "header"),
1247
1497
  ...stickyHeader ? {
1248
1498
  position: "sticky",
1249
1499
  top: headerHeight,
@@ -1253,13 +1503,18 @@ function DataTable(props) {
1253
1503
  zIndex: DATA_TABLE_Z.pinnedHeaderCell
1254
1504
  } : void 0
1255
1505
  },
1256
- children: /*#__PURE__*/ jsx("div", {
1257
- className: styles.filterControl(),
1258
- children: column.getCanFilter() ? renderColumnFilter(column) : null
1259
- })
1506
+ children: column.getCanFilter() ? /*#__PURE__*/ jsx("div", {
1507
+ className: styles.filterViewport(),
1508
+ "data-layout": tableLayout,
1509
+ children: /*#__PURE__*/ jsx("div", {
1510
+ className: styles.filterControl(),
1511
+ "data-size": size,
1512
+ children: renderColumnFilter(column)
1513
+ })
1514
+ }) : null
1260
1515
  }, column.id)),
1261
1516
  hasActionsColumn && /*#__PURE__*/ jsx("td", {
1262
- className: stickyActions ? `${styles.filterCell()} sticky inset-e-0 bg-data-table-filter-row-bg` : styles.filterCell(),
1517
+ className: stickyActions ? `${styles.filterCell()} data-table-actions-sticky sticky bg-data-table-filter-row-bg` : styles.filterCell(),
1263
1518
  style: {
1264
1519
  ...OPAQUE_FILTER_ROW_BG,
1265
1520
  ...stickyHeader ? {
@@ -1285,7 +1540,7 @@ function DataTable(props) {
1285
1540
  type,
1286
1541
  value: draft[column.id],
1287
1542
  setValue: (next)=>setDraftValue(row.id, column.id, next),
1288
- disabled: false,
1543
+ disabled: savePending,
1289
1544
  size,
1290
1545
  options: meta.options ?? meta.filterOptions ?? [],
1291
1546
  error: editErrors[column.id] || void 0,
@@ -1301,27 +1556,29 @@ function DataTable(props) {
1301
1556
  if (!enableInlineEdit) return null;
1302
1557
  if (editingRowId === row.id) return /*#__PURE__*/ jsxs(Fragment, {
1303
1558
  children: [
1304
- /*#__PURE__*/ jsx(Button, {
1305
- "aria-label": "Save row",
1306
- icon: "token-icon-check",
1307
- onClick: (e)=>{
1308
- e.stopPropagation();
1309
- commitEdit();
1310
- },
1311
- size: "sm",
1312
- theme: "borderless",
1313
- variant: "primary"
1314
- }),
1315
1559
  /*#__PURE__*/ jsx(Button, {
1316
1560
  "aria-label": "Cancel edit",
1561
+ disabled: savePending,
1317
1562
  icon: "token-icon-close",
1318
- onClick: (e)=>{
1319
- e.stopPropagation();
1563
+ onClick: (event)=>{
1564
+ event.stopPropagation();
1320
1565
  cancelEdit();
1321
1566
  },
1322
- size: "sm",
1323
- theme: "borderless",
1567
+ size: size,
1568
+ theme: "outlined",
1324
1569
  variant: "secondary"
1570
+ }),
1571
+ /*#__PURE__*/ jsx(Button, {
1572
+ "aria-describedby": saveError ? `${instanceId}-save-error` : void 0,
1573
+ "aria-label": "Save row",
1574
+ icon: "token-icon-check",
1575
+ isLoading: savePending,
1576
+ onClick: (event)=>{
1577
+ event.stopPropagation();
1578
+ commitEdit();
1579
+ },
1580
+ size: size,
1581
+ variant: "primary"
1325
1582
  })
1326
1583
  ]
1327
1584
  });
@@ -1343,6 +1600,8 @@ function DataTable(props) {
1343
1600
  isEditing: editingRowId === row.id,
1344
1601
  startEdit: ()=>startEdit(row),
1345
1602
  commitEdit,
1603
+ pending: savePending,
1604
+ error: saveError,
1346
1605
  cancelEdit,
1347
1606
  disabled: locked && editingRowId !== row.id
1348
1607
  });
@@ -1350,7 +1609,7 @@ function DataTable(props) {
1350
1609
  };
1351
1610
  const expandAriaControls = (rowId)=>renderExpandedRow ? `${instanceId}-detail-${rowId}` : void 0;
1352
1611
  const renderActionsCell = (row)=>/*#__PURE__*/ jsx(Table.Cell, {
1353
- className: stickyActions ? "data-table-frozen-cell sticky inset-e-0" : void 0,
1612
+ className: stickyActions ? "data-table-frozen-cell data-table-actions-sticky sticky" : void 0,
1354
1613
  numeric: true,
1355
1614
  style: stickyActions ? {
1356
1615
  zIndex: DATA_TABLE_Z.stickyActionsCell
@@ -1386,7 +1645,18 @@ function DataTable(props) {
1386
1645
  theme: "borderless",
1387
1646
  variant: "danger" === action.tone ? "danger" : "secondary"
1388
1647
  }, action.id)),
1389
- rowActionsContent(row)
1648
+ rowActionsContent(row),
1649
+ editingRowId === row.id && savePending && /*#__PURE__*/ jsx(StatusText, {
1650
+ role: "status",
1651
+ size: size,
1652
+ children: translations.savePendingLabel
1653
+ }),
1654
+ editingRowId === row.id && saveError && /*#__PURE__*/ jsx(StatusText, {
1655
+ id: `${instanceId}-save-error`,
1656
+ size: size,
1657
+ status: "error",
1658
+ children: saveError
1659
+ })
1390
1660
  ]
1391
1661
  })
1392
1662
  });
@@ -1401,28 +1671,44 @@ function DataTable(props) {
1401
1671
  });
1402
1672
  if (span?.hidden) return null;
1403
1673
  const column = cell.column;
1674
+ const meta = column.columnDef.meta;
1675
+ const type = resolveColumnType(meta);
1676
+ const ownsFeedback = !(meta?.renderEditor || editorRenderers?.[type]) && ("boolean" === type || "enum" === type || "multiEnum" === type);
1404
1677
  return /*#__PURE__*/ jsx(DataTableBodyCell, {
1405
1678
  cell: cell,
1406
1679
  columnSizing: columnSizing,
1407
1680
  dnd: dnd,
1408
1681
  editor: renderCellEditor(row, column),
1409
- editorError: editingRowId === row.id ? editErrors[column.id] || void 0 : void 0,
1682
+ editorError: editingRowId !== row.id || ownsFeedback ? void 0 : editErrors[column.id] || void 0,
1410
1683
  editorErrorId: `${instanceId}-err-${row.id}-${column.id}`,
1411
1684
  enableColumnResizing: enableColumnResizing,
1412
1685
  enableRowReorder: enableRowReorder,
1413
1686
  indentColumnId: indentColumnId,
1687
+ pinningStyle: pinningStyles(column),
1414
1688
  row: row,
1415
1689
  rowLabel: rowLabel,
1690
+ size: size,
1416
1691
  span: span,
1417
1692
  styles: styles
1418
1693
  }, cell.id);
1419
1694
  });
1420
1695
  };
1421
1696
  const headerRowCount = table.getHeaderGroups().length + (enableColumnFilters ? 1 : 0);
1422
- const pageRowOffset = enablePagination ? pagination.pageIndex * pagination.pageSize : 0;
1697
+ const pageRecordOffset = enablePagination ? pagination.pageIndex * pagination.pageSize : 0;
1698
+ const allClientRows = table.getPrePaginatedRowModel().rows;
1699
+ const detailCount = (modelRows)=>renderExpandedRow ? modelRows.filter((row)=>row.getIsExpanded()).length : 0;
1700
+ const pageRowOffset = manualPagination && renderExpandedRow ? 0 : pageRecordOffset + detailCount(allClientRows.slice(0, pageRecordOffset));
1701
+ const footerRowCount = hasFooter ? table.getFooterGroups().length : 0;
1702
+ const knownRecordCount = manualPagination ? rowCount : table.getRowCount();
1703
+ let accessibleBodyCount = knownRecordCount;
1704
+ if (renderExpandedRow) accessibleBodyCount = manualPagination ? logicalRows.length : allClientRows.length + detailCount(allClientRows);
1705
+ if (null != accessibleBodyCount && pageRowOffset + logicalRows.length > accessibleBodyCount) accessibleBodyCount = void 0;
1706
+ const accessibleRowCount = null == accessibleBodyCount ? -1 : headerRowCount + accessibleBodyCount + footerRowCount;
1707
+ const footerRowOffset = accessibleBodyCount ?? pageRowOffset + logicalRows.length;
1423
1708
  const buildMainRow = (row, rowIndex, dnd, opts)=>/*#__PURE__*/ jsxs(Table.Row, {
1424
1709
  ...restRowProps,
1425
- "aria-rowindex": headerRowCount + pageRowOffset + rowIndex + 1,
1710
+ "aria-busy": editingRowId === row.id && savePending || void 0,
1711
+ "aria-rowindex": headerRowCount + pageRowOffset + (logicalRowPosition.get(row.id) ?? rowIndex) + 1,
1426
1712
  className: rowDragClass(dnd, {
1427
1713
  className: restRowProps.className,
1428
1714
  striped: effectiveStriped,
@@ -1431,13 +1717,17 @@ function DataTable(props) {
1431
1717
  }),
1432
1718
  "data-depth": row.depth || void 0,
1433
1719
  "data-dragging": dnd?.isDragging || void 0,
1720
+ "data-index": logicalRowPosition.get(row.id),
1434
1721
  id: opts.rowElementId ?? restRowProps.id,
1435
1722
  onClick: buildRowClickHandler(row, rowOnClick, onRowClick, blocked),
1436
1723
  onKeyDown: (event)=>{
1437
1724
  restRowProps.onKeyDown?.(event);
1438
1725
  opts.rowKeyDown?.(event);
1439
1726
  },
1440
- ref: composeRowRef(dnd, rowRef),
1727
+ ref: (node)=>{
1728
+ composeRowRef(dnd, rowRef)(node);
1729
+ if (virtualizationUsable) rowVirtualizer.measureElement(node);
1730
+ },
1441
1731
  selected: enableRowSelection ? row.getIsSelected() : void 0,
1442
1732
  style: {
1443
1733
  ...rowStyle,
@@ -1451,7 +1741,6 @@ function DataTable(props) {
1451
1741
  });
1452
1742
  const renderBodyRow = (row, rowIndex, dnd)=>{
1453
1743
  const rowIsClickable = !!onRowClick && !locked;
1454
- const actionsColumn = hasActionsColumn ? 1 : 0;
1455
1744
  const rowElementId = editingRowElementId(editingRowId, instanceId, row.id);
1456
1745
  const rowKeyDown = rowIsClickable ? buildRowKeyDownHandler(row, onRowClick, blocked) : void 0;
1457
1746
  const mainRow = buildMainRow(row, rowIndex, dnd, {
@@ -1459,28 +1748,35 @@ function DataTable(props) {
1459
1748
  rowElementId,
1460
1749
  rowKeyDown
1461
1750
  });
1462
- const expandedRow = renderExpandedRow && row.getIsExpanded() ? renderExpandedDetailRow({
1463
- row,
1464
- renderExpandedRow,
1465
- colSpan: columnCount + actionsColumn,
1466
- instanceId,
1467
- styles,
1468
- tintNestedRows
1469
- }) : null;
1470
- return /*#__PURE__*/ jsxs(external_react_Fragment, {
1471
- children: [
1472
- mainRow,
1473
- expandedRow
1474
- ]
1751
+ return /*#__PURE__*/ jsx(external_react_Fragment, {
1752
+ children: mainRow
1475
1753
  }, row.id);
1476
1754
  };
1477
1755
  const rowReorderActive = enableRowReorder && !locked && 0 === sorting.length && 0 === columnFilters.length && !globalFilter;
1478
- const bodyRows = renderRows.map(({ row, index: rowIndex })=>rowReorderActive && 0 === row.depth ? /*#__PURE__*/ jsx(SortableRow, {
1756
+ const bodyRows = renderRows.map(({ row, index: rowIndex, detail })=>{
1757
+ if (detail && renderExpandedRow) {
1758
+ const index = (logicalRowPosition.get(row.id) ?? rowIndex) + 1;
1759
+ return /*#__PURE__*/ jsx(external_react_Fragment, {
1760
+ children: renderExpandedDetailRow({
1761
+ row,
1762
+ renderExpandedRow,
1763
+ colSpan: columnCount + (hasActionsColumn ? 1 : 0),
1764
+ instanceId,
1765
+ styles,
1766
+ tintNestedRows,
1767
+ rowIndex: headerRowCount + pageRowOffset + index + 1,
1768
+ virtualIndex: index,
1769
+ measureElement: virtualizationUsable ? rowVirtualizer.measureElement : void 0
1770
+ })
1771
+ }, `${row.id}-detail`);
1772
+ }
1773
+ return rowReorderActive && 0 === row.depth ? /*#__PURE__*/ jsx(SortableRow, {
1479
1774
  index: rootRowIds.indexOf(row.id),
1480
1775
  label: getRowLabel?.(row) ?? `row ${row.id}`,
1481
1776
  row: row,
1482
1777
  children: (dnd)=>renderBodyRow(row, rowIndex, dnd)
1483
- }, row.id) : renderBodyRow(row, rowIndex));
1778
+ }, row.id) : renderBodyRow(row, rowIndex);
1779
+ });
1484
1780
  const skeletonRows = (count, keyPrefix)=>Array.from({
1485
1781
  length: count
1486
1782
  }, (_, i)=>`${keyPrefix}-${i}`).map((rowKey)=>/*#__PURE__*/ jsxs(Table.Row, {
@@ -1488,24 +1784,26 @@ function DataTable(props) {
1488
1784
  children: [
1489
1785
  leafColumns.map((column)=>/*#__PURE__*/ jsx(Table.Cell, {
1490
1786
  children: /*#__PURE__*/ jsx(Skeleton.Text, {
1787
+ className: "data-table-skeleton",
1491
1788
  noOfLines: 1,
1492
1789
  size: size
1493
1790
  })
1494
1791
  }, `${rowKey}-${column.id}`)),
1495
1792
  hasActionsColumn && /*#__PURE__*/ jsx(Table.Cell, {
1496
- className: stickyActions ? "data-table-frozen-cell sticky inset-e-0" : void 0,
1793
+ className: stickyActions ? "data-table-frozen-cell data-table-actions-sticky sticky" : void 0,
1497
1794
  numeric: true,
1498
1795
  style: stickyActions ? {
1499
1796
  zIndex: DATA_TABLE_Z.stickyActionsCell
1500
1797
  } : void 0,
1501
1798
  children: /*#__PURE__*/ jsx(Skeleton.Text, {
1799
+ className: "data-table-skeleton",
1502
1800
  noOfLines: 1,
1503
1801
  size: size
1504
1802
  })
1505
1803
  })
1506
1804
  ]
1507
1805
  }, rowKey));
1508
- const emptyState = renderEmpty ? renderEmpty() : /*#__PURE__*/ jsxs("div", {
1806
+ let emptyState = /*#__PURE__*/ jsxs("div", {
1509
1807
  className: styles.empty(),
1510
1808
  children: [
1511
1809
  /*#__PURE__*/ jsx(Icon, {
@@ -1525,14 +1823,23 @@ function DataTable(props) {
1525
1823
  })
1526
1824
  ]
1527
1825
  });
1826
+ if (invalidPage) emptyState = /*#__PURE__*/ jsx(StatusText, {
1827
+ children: translations.paginationPendingLabel
1828
+ });
1829
+ if (renderEmpty) emptyState = renderEmpty();
1528
1830
  let statusMessage = "";
1529
- if (loading) statusMessage = translations.loadingLabel;
1530
- else if (0 === rows.length) statusMessage = translations.emptyTitle;
1831
+ if (loading || loadingMore) statusMessage = translations.loadingLabel;
1832
+ else if (invalidPage) statusMessage = translations.paginationPendingLabel;
1833
+ else if (0 === rows.length) statusMessage = renderEmpty ? "" : translations.emptyTitle;
1531
1834
  else if (isEditing) statusMessage = translations.editingLabel;
1532
1835
  const emptyRow = /*#__PURE__*/ jsx("tr", {
1533
1836
  children: /*#__PURE__*/ jsx(Table.Cell, {
1837
+ className: "p-0!",
1534
1838
  colSpan: columnCount + (hasActionsColumn ? 1 : 0),
1535
- children: emptyState
1839
+ children: /*#__PURE__*/ jsx("div", {
1840
+ className: styles.emptyViewport(),
1841
+ children: emptyState
1842
+ })
1536
1843
  })
1537
1844
  });
1538
1845
  let bodyState = "rows";
@@ -1546,6 +1853,8 @@ function DataTable(props) {
1546
1853
  "rows" === bodyState && /*#__PURE__*/ jsxs(Fragment, {
1547
1854
  children: [
1548
1855
  paddingTop > 0 && /*#__PURE__*/ jsx("tr", {
1856
+ "aria-hidden": "true",
1857
+ tabIndex: -1,
1549
1858
  children: /*#__PURE__*/ jsx("td", {
1550
1859
  colSpan: columnCount + (hasActionsColumn ? 1 : 0),
1551
1860
  style: {
@@ -1556,6 +1865,8 @@ function DataTable(props) {
1556
1865
  bodyRows,
1557
1866
  loadingMore && skeletonRows(1, "skeleton-more"),
1558
1867
  paddingBottom > 0 && /*#__PURE__*/ jsx("tr", {
1868
+ "aria-hidden": "true",
1869
+ tabIndex: -1,
1559
1870
  children: /*#__PURE__*/ jsx("td", {
1560
1871
  colSpan: columnCount + (hasActionsColumn ? 1 : 0),
1561
1872
  style: {
@@ -1568,13 +1879,15 @@ function DataTable(props) {
1568
1879
  ]
1569
1880
  });
1570
1881
  const footerContent = hasFooter ? /*#__PURE__*/ jsx(Table.Footer, {
1571
- children: table.getFooterGroups().map((footerGroup)=>/*#__PURE__*/ jsxs(Table.Row, {
1882
+ children: table.getFooterGroups().map((footerGroup, footerIndex)=>/*#__PURE__*/ jsxs(Table.Row, {
1883
+ "aria-rowindex": headerRowCount + footerRowOffset + footerIndex + 1,
1572
1884
  children: [
1573
1885
  footerGroup.headers.map((header)=>/*#__PURE__*/ jsx(Table.Cell, {
1886
+ colSpan: header.colSpan,
1574
1887
  children: header.isPlaceholder ? null : flexRender(header.column.columnDef.footer, header.getContext())
1575
1888
  }, header.id)),
1576
1889
  hasActionsColumn && /*#__PURE__*/ jsx(Table.Cell, {
1577
- className: stickyActions ? "sticky inset-e-0 bg-data-table-footer-bg" : void 0,
1890
+ className: stickyActions ? "data-table-actions-sticky sticky bg-data-table-footer-bg" : void 0,
1578
1891
  numeric: true,
1579
1892
  style: stickyActions ? {
1580
1893
  zIndex: DATA_TABLE_Z.stickyActionsCell
@@ -1583,11 +1896,21 @@ function DataTable(props) {
1583
1896
  ]
1584
1897
  }, footerGroup.id))
1585
1898
  }) : null;
1899
+ const fixedTableMinWidth = "fixed" === tableLayout ? `calc(${[
1900
+ ...leafColumns.map((column)=>{
1901
+ const sizing = getColumnSizeStyles(column, enableColumnResizing, columnSizing);
1902
+ const minimum = String(sizing.minWidth ?? `${column.getSize()}px`);
1903
+ return minimum.includes("%") ? `${column.getSize()}px` : minimum;
1904
+ }),
1905
+ ...hasActionsColumn ? [
1906
+ `${fixedActionsWidth ?? 0}px`
1907
+ ] : []
1908
+ ].join(" + ")})` : void 0;
1586
1909
  const tableEl = /*#__PURE__*/ jsx(FieldTableLayoutContext.Provider, {
1587
1910
  value: tableLayout,
1588
1911
  children: /*#__PURE__*/ jsxs(Table, {
1589
- "aria-busy": loading || loadingMore || void 0,
1590
- "aria-rowcount": headerRowCount + table.getRowCount(),
1912
+ "aria-busy": loading || loadingMore || invalidPage || void 0,
1913
+ "aria-rowcount": accessibleRowCount,
1591
1914
  interactive: (interactive || !!onRowClick) && !locked,
1592
1915
  showColumnBorder: showColumnBorder,
1593
1916
  size: size,
@@ -1596,12 +1919,28 @@ function DataTable(props) {
1596
1919
  ...slotProps?.root,
1597
1920
  style: {
1598
1921
  tableLayout,
1922
+ minWidth: fixedTableMinWidth,
1599
1923
  ...slotProps?.root?.style
1600
1924
  },
1601
1925
  children: [
1602
1926
  caption && /*#__PURE__*/ jsx(Table.Caption, {
1927
+ id: `${instanceId}-caption`,
1603
1928
  children: caption
1604
1929
  }),
1930
+ /*#__PURE__*/ jsxs("colgroup", {
1931
+ children: [
1932
+ leafColumns.map((column)=>/*#__PURE__*/ jsx("col", {
1933
+ style: {
1934
+ width: getColumnSizeStyles(column, enableColumnResizing, columnSizing).width
1935
+ }
1936
+ }, column.id)),
1937
+ hasActionsColumn && /*#__PURE__*/ jsx("col", {
1938
+ style: fixedActionsWidth ? {
1939
+ width: fixedActionsWidth
1940
+ } : void 0
1941
+ })
1942
+ ]
1943
+ }),
1605
1944
  headerContent,
1606
1945
  bodyContent,
1607
1946
  footerContent
@@ -1629,6 +1968,8 @@ function DataTable(props) {
1629
1968
  blocked,
1630
1969
  size,
1631
1970
  paginationProps,
1971
+ hasNextPage,
1972
+ paginationBusy: loading || loadingMore || invalidPage,
1632
1973
  toolbarActions
1633
1974
  };
1634
1975
  return /*#__PURE__*/ jsx(DataTableContext.Provider, {
@@ -1657,13 +1998,18 @@ function DataTable(props) {
1657
1998
  })
1658
1999
  ]
1659
2000
  })),
1660
- /*#__PURE__*/ jsx("div", {
1661
- className: styles.scroll(),
2001
+ /*#__PURE__*/ jsx("section", {
2002
+ "aria-label": caption ? void 0 : translations.scrollLabel,
2003
+ "aria-labelledby": caption ? `${instanceId}-caption` : void 0,
2004
+ className: styles.scroll({
2005
+ className: "focus-visible:data-table-scroll-focus"
2006
+ }),
1662
2007
  onScroll: handleScroll,
1663
2008
  ref: scrollRef,
1664
2009
  style: maxHeight ? {
1665
2010
  maxHeight
1666
2011
  } : void 0,
2012
+ tabIndex: 0,
1667
2013
  children: scrollBody
1668
2014
  }),
1669
2015
  enablePagination && /*#__PURE__*/ jsx(DataTable.Pagination, {})
@@ -1817,13 +2163,58 @@ DataTable.ColumnVisibility = function() {
1817
2163
  size: size
1818
2164
  });
1819
2165
  };
1820
- DataTable.Pagination = function() {
1821
- const { table, pageSizeOptions, translations, locked, blocked, size, paginationProps } = useDataTableContext();
2166
+ function paginationSummary(table, translations) {
1822
2167
  const state = table.state.pagination;
1823
2168
  const declaredPageCount = table.options.pageCount;
1824
- const total = table.options.rowCount ?? (null != declaredPageCount && declaredPageCount >= 0 ? declaredPageCount * state.pageSize : table.getRowCount());
1825
- const start = 0 === total ? 0 : state.pageIndex * state.pageSize + 1;
1826
- const end = Math.min((state.pageIndex + 1) * state.pageSize, total);
2169
+ const isManual = table.options.manualPagination;
2170
+ const manualEmptyTotal = 0 === declaredPageCount ? 0 : void 0;
2171
+ const exactTotal = table.options.rowCount ?? (isManual ? manualEmptyTotal : table.getRowCount());
2172
+ const unknownTotal = isManual && null == exactTotal && -1 === declaredPageCount;
2173
+ const total = exactTotal ?? (null != declaredPageCount && declaredPageCount >= 0 ? declaredPageCount * state.pageSize : table.getRowCount());
2174
+ const returnedCount = table.getRowModel().rows.length;
2175
+ const start = 0 === returnedCount ? 0 : state.pageIndex * state.pageSize + 1;
2176
+ const end = 0 === returnedCount ? 0 : Math.min(state.pageIndex * state.pageSize + returnedCount, exactTotal ?? 1 / 0);
2177
+ const rangeText = null == exactTotal ? translations.pageLabel({
2178
+ page: state.pageIndex + 1,
2179
+ pageCount: null != declaredPageCount && declaredPageCount >= 0 ? declaredPageCount : void 0
2180
+ }) : translations.rangeLabel({
2181
+ start: end < start ? 0 : start,
2182
+ end,
2183
+ total: exactTotal
2184
+ });
2185
+ return {
2186
+ total,
2187
+ unknownTotal,
2188
+ rangeText
2189
+ };
2190
+ }
2191
+ DataTable.Pagination = function() {
2192
+ const { table, pageSizeOptions, translations, locked, blocked, size, paginationProps, hasNextPage, paginationBusy } = useDataTableContext();
2193
+ const state = table.state.pagination;
2194
+ const summary = paginationSummary(table, translations);
2195
+ const settledPager = useRef({
2196
+ ...summary,
2197
+ ...state,
2198
+ canNext: hasNextPage ?? table.getCanNextPage()
2199
+ });
2200
+ const currentPager = {
2201
+ ...summary,
2202
+ ...state,
2203
+ canNext: hasNextPage ?? table.getCanNextPage()
2204
+ };
2205
+ const pager = paginationBusy ? settledPager.current : currentPager;
2206
+ const controlsRef = useRef(null);
2207
+ const focusedControl = useRef(null);
2208
+ useLayoutEffect(()=>{
2209
+ if (!paginationBusy) settledPager.current = currentPager;
2210
+ const previous = focusedControl.current;
2211
+ const controls = controlsRef.current;
2212
+ const doc = controls?.ownerDocument;
2213
+ if (previous && !previous.isConnected && doc && doc.activeElement === doc.body) {
2214
+ const successor = controls?.querySelector('[aria-current="page"][href]') ?? controls?.querySelector("a[href], button:not(:disabled)");
2215
+ successor?.focus();
2216
+ }
2217
+ });
1827
2218
  const styles = dataTableVariants();
1828
2219
  const pageSizeItems = pageSizeOptions.map((n)=>({
1829
2220
  label: String(n),
@@ -1835,40 +2226,78 @@ DataTable.Pagination = function() {
1835
2226
  children: [
1836
2227
  /*#__PURE__*/ jsx("span", {
1837
2228
  className: styles.paginationInfo(),
1838
- children: translations.rangeLabel({
1839
- start,
1840
- end,
1841
- total
1842
- })
2229
+ children: paginationBusy ? translations.loadingLabel : summary.rangeText
1843
2230
  }),
1844
2231
  /*#__PURE__*/ jsxs("div", {
2232
+ "aria-busy": paginationBusy || void 0,
1845
2233
  className: styles.paginationControls(),
2234
+ onBlurCapture: (event)=>{
2235
+ if (event.relatedTarget && !event.currentTarget.contains(event.relatedTarget)) focusedControl.current = null;
2236
+ },
2237
+ onFocusCapture: (event)=>{
2238
+ focusedControl.current = event.target;
2239
+ },
2240
+ ref: controlsRef,
1846
2241
  children: [
1847
- /*#__PURE__*/ jsx(Pagination, {
2242
+ pager.unknownTotal ? /*#__PURE__*/ jsxs(Fragment, {
2243
+ children: [
2244
+ /*#__PURE__*/ jsx(Button, {
2245
+ "aria-disabled": paginationBusy || void 0,
2246
+ disabled: locked || 0 === pager.pageIndex,
2247
+ onClick: ()=>{
2248
+ if (!(paginationBusy || blocked("paginate"))) table.previousPage();
2249
+ },
2250
+ size: size,
2251
+ theme: "outlined",
2252
+ variant: "secondary",
2253
+ children: translations.previousPageLabel
2254
+ }),
2255
+ /*#__PURE__*/ jsx(Button, {
2256
+ "aria-disabled": paginationBusy || void 0,
2257
+ disabled: locked || !pager.canNext,
2258
+ onClick: ()=>{
2259
+ if (!(paginationBusy || blocked("paginate"))) table.nextPage();
2260
+ },
2261
+ size: size,
2262
+ theme: "outlined",
2263
+ variant: "secondary",
2264
+ children: translations.nextPageLabel
2265
+ })
2266
+ ]
2267
+ }) : /*#__PURE__*/ jsx(Pagination, {
1848
2268
  size: size,
1849
2269
  ...paginationProps,
1850
- count: total,
2270
+ "aria-disabled": paginationBusy || locked || void 0,
2271
+ count: pager.total,
1851
2272
  getPageUrl: ()=>"#",
1852
2273
  linkProps: {
1853
2274
  ...paginationProps?.linkProps,
1854
2275
  onClick: (event)=>{
1855
- paginationProps?.linkProps?.onClick?.(event);
1856
- event.preventDefault();
2276
+ if (paginationBusy) event.preventDefault();
2277
+ else paginationProps?.linkProps?.onClick?.(event);
1857
2278
  }
1858
2279
  },
2280
+ onClick: (event)=>{
2281
+ paginationProps?.onClick?.(event);
2282
+ event.preventDefault();
2283
+ },
1859
2284
  onPageChange: (page)=>{
1860
- if (!blocked("paginate")) table.setPageIndex(page - 1);
2285
+ if (!(paginationBusy || blocked("paginate"))) table.setPageIndex(page - 1);
1861
2286
  },
1862
- page: state.pageIndex + 1,
1863
- pageSize: state.pageSize
2287
+ page: pager.pageIndex + 1,
2288
+ pageSize: pager.pageSize
1864
2289
  }),
1865
2290
  /*#__PURE__*/ jsx(FieldSelect, {
1866
2291
  ariaLabel: translations.pageSizeLabel,
1867
2292
  disabled: locked,
1868
2293
  items: pageSizeItems,
1869
2294
  onChange: (v)=>{
1870
- if (!blocked("paginate")) table.setPageSize(Number(v));
2295
+ if (!(paginationBusy || blocked("paginate"))) table.setPagination({
2296
+ pageIndex: 0,
2297
+ pageSize: Number(v)
2298
+ });
1871
2299
  },
2300
+ readOnly: paginationBusy,
1872
2301
  size: size,
1873
2302
  value: String(state.pageSize)
1874
2303
  })