@gntik-ai/blocks 0.10.0 → 0.12.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 (248) hide show
  1. package/dist/index.d.ts +1761 -1231
  2. package/dist/index.js +3280 -1088
  3. package/dist/index.js.map +1 -1
  4. package/package.json +6 -6
  5. package/src/ai/PromptEditor/PromptEditor.tsx +2 -2
  6. package/src/ai/PromptEditor/examples/controlled-variables.tsx +1 -1
  7. package/src/ai/TraceWaterfall/TraceWaterfall.tsx +2 -2
  8. package/src/auth/ForgotPasswordForm/ForgotPasswordForm.labels.test.tsx +179 -0
  9. package/src/auth/ForgotPasswordForm/ForgotPasswordForm.test.tsx +6 -0
  10. package/src/auth/ForgotPasswordForm/ForgotPasswordForm.tsx +63 -25
  11. package/src/auth/ForgotPasswordForm/block.meta.ts +22 -1
  12. package/src/auth/ForgotPasswordForm/examples/Labels.tsx +29 -0
  13. package/src/auth/ForgotPasswordForm/examples/LargeFields.tsx +6 -0
  14. package/src/auth/MfaChallenge/MfaChallenge.labels.test.tsx +139 -0
  15. package/src/auth/MfaChallenge/MfaChallenge.test.tsx +9 -0
  16. package/src/auth/MfaChallenge/MfaChallenge.tsx +74 -25
  17. package/src/auth/MfaChallenge/block.meta.ts +29 -1
  18. package/src/auth/MfaChallenge/examples/Labels.tsx +28 -0
  19. package/src/auth/MfaChallenge/examples/LargeFields.tsx +6 -0
  20. package/src/auth/ResetPasswordForm/ResetPasswordForm.labels.test.tsx +104 -0
  21. package/src/auth/ResetPasswordForm/ResetPasswordForm.test.tsx +7 -0
  22. package/src/auth/ResetPasswordForm/ResetPasswordForm.tsx +47 -18
  23. package/src/auth/ResetPasswordForm/block.meta.ts +17 -1
  24. package/src/auth/ResetPasswordForm/examples/Labels.tsx +28 -0
  25. package/src/auth/ResetPasswordForm/examples/LargeFields.tsx +6 -0
  26. package/src/auth/SignInForm/SignInForm.labels.test.tsx +137 -0
  27. package/src/auth/SignInForm/SignInForm.test.tsx +7 -0
  28. package/src/auth/SignInForm/SignInForm.tsx +48 -17
  29. package/src/auth/SignInForm/block.meta.ts +22 -1
  30. package/src/auth/SignInForm/examples/Labels.tsx +29 -0
  31. package/src/auth/SignInForm/examples/LargeFields.tsx +6 -0
  32. package/src/auth/SignUpForm/SignUpForm.labels.test.tsx +217 -0
  33. package/src/auth/SignUpForm/SignUpForm.test.tsx +22 -0
  34. package/src/auth/SignUpForm/SignUpForm.tsx +72 -27
  35. package/src/auth/SignUpForm/block.meta.ts +27 -1
  36. package/src/auth/SignUpForm/examples/Labels.tsx +29 -0
  37. package/src/auth/SignUpForm/examples/LargeFields.tsx +6 -0
  38. package/src/auth/SsoButtons/SsoButtons.labels.test.tsx +30 -0
  39. package/src/auth/SsoButtons/SsoButtons.tsx +10 -2
  40. package/src/auth/SsoButtons/block.meta.ts +8 -1
  41. package/src/auth/SsoButtons/examples/Labels.tsx +24 -0
  42. package/src/auth/__snapshots__/field-size.test.tsx.snap +11 -0
  43. package/src/auth/field-size.test.tsx +21 -0
  44. package/src/auth/large-examples.test.tsx +30 -0
  45. package/src/auth/shared.i18n.test.tsx +71 -0
  46. package/src/auth/shared.tsx +55 -13
  47. package/src/billing/PaymentMethodCard/PaymentMethodCard.tsx +1 -1
  48. package/src/billing/PlanCard/PlanCard.baseline.test.tsx +3 -2
  49. package/src/billing/PlanCard/__snapshots__/PlanCard.baseline.test.tsx.snap +2 -2
  50. package/src/billing/PlanDefinitionCard/examples/Compact.tsx +1 -4
  51. package/src/billing/PlanDefinitionCard/examples/Full.tsx +1 -4
  52. package/src/builders/CodePanel/CodePanel.tsx +2 -2
  53. package/src/builders/FlowBuilder/FlowBuilder.tsx +4 -19
  54. package/src/builders/FlowBuilder/parts.tsx +4 -4
  55. package/src/builders/LogViewer/LogViewer.follow.test.tsx +29 -0
  56. package/src/builders/LogViewer/LogViewer.levels.test.tsx +49 -0
  57. package/src/builders/LogViewer/LogViewer.test.tsx +24 -0
  58. package/src/builders/LogViewer/LogViewer.tsx +96 -28
  59. package/src/builders/LogViewer/LogViewer.wrap.test.tsx +181 -0
  60. package/src/builders/LogViewer/block.meta.ts +7 -1
  61. package/src/builders/LogViewer/examples/Spanish.tsx +2 -1
  62. package/src/builders/LogViewer/examples/Wrap.tsx +62 -0
  63. package/src/builders/LogViewer/use-wrapped-log-rows.ts +42 -0
  64. package/src/data-display/ActivityFeed/ActivityFeed.tsx +1 -1
  65. package/src/data-display/ChartCard/ChartCard.tsx +2 -2
  66. package/src/data-display/ChartCard/examples/ContainerPanel.tsx +16 -0
  67. package/src/data-display/CommentThread/CommentThread.test.tsx +70 -1
  68. package/src/data-display/CommentThread/CommentThread.tsx +22 -6
  69. package/src/data-display/CommentThread/block.meta.ts +1 -1
  70. package/src/data-display/CommentThread/examples/RenderedBody.tsx +20 -0
  71. package/src/data-display/DescriptionListCard/DescriptionListCard.options.test.tsx +64 -0
  72. package/src/data-display/DescriptionListCard/DescriptionListCard.test.tsx +24 -1
  73. package/src/data-display/DescriptionListCard/DescriptionListCard.tsx +52 -37
  74. package/src/data-display/DescriptionListCard/block.meta.ts +2 -1
  75. package/src/data-display/DescriptionListCard/examples/Spanish.tsx +9 -1
  76. package/src/data-display/KpiRow/KpiRow.doc.ts +14 -0
  77. package/src/data-display/KpiRow/KpiRow.test.tsx +11 -0
  78. package/src/data-display/KpiRow/KpiRow.tsx +72 -55
  79. package/src/data-display/KpiRow/examples/ContainerPanel.tsx +47 -0
  80. package/src/data-display/ResourceCardGrid/ResourceCardGrid.doc.ts +19 -0
  81. package/src/data-display/ResourceCardGrid/ResourceCardGrid.test.tsx +13 -0
  82. package/src/data-display/ResourceCardGrid/ResourceCardGrid.tsx +49 -40
  83. package/src/data-display/ResourceCardGrid/examples/ContainerPanel.tsx +18 -0
  84. package/src/data-display/StatusTimeline/StatusTimeline.tsx +1 -1
  85. package/src/feedback/EmptyStates/EmptyStates.test.tsx +42 -0
  86. package/src/feedback/EmptyStates/EmptyStates.tsx +37 -17
  87. package/src/feedback/EmptyStates/NoAccessEmpty.options.test.tsx +38 -0
  88. package/src/feedback/EmptyStates/block.meta.ts +1 -1
  89. package/src/feedback/EmptyStates/examples/HiddenAction.tsx +13 -0
  90. package/src/feedback/EmptyStates/examples/Spanish.tsx +7 -0
  91. package/src/feedback/ErrorPanel/ErrorPanel.tsx +13 -15
  92. package/src/forms/CreateApiKeyDialog/CreateApiKeyDialog.labels.test.tsx +115 -0
  93. package/src/forms/CreateApiKeyDialog/CreateApiKeyDialog.lifecycle.test.tsx +123 -0
  94. package/src/forms/CreateApiKeyDialog/CreateApiKeyDialog.tsx +153 -122
  95. package/src/forms/CreateApiKeyDialog/block.meta.ts +34 -2
  96. package/src/forms/CreateApiKeyDialog/examples/Labels.tsx +29 -0
  97. package/src/forms/CredentialDisclosureDialog/CredentialDisclosureDialog.labels.test.tsx +165 -0
  98. package/src/forms/CredentialDisclosureDialog/CredentialDisclosureDialog.tsx +31 -8
  99. package/src/forms/CredentialDisclosureDialog/SecretCopy.tsx +16 -8
  100. package/src/forms/CredentialDisclosureDialog/block.meta.ts +19 -1
  101. package/src/forms/CredentialDisclosureDialog/examples/Labels.tsx +38 -0
  102. package/src/forms/DangerZone/ConfirmDestructiveDialog.tsx +17 -3
  103. package/src/forms/DangerZone/DangerZone.labels.test.tsx +87 -0
  104. package/src/forms/DangerZone/DangerZone.tsx +20 -5
  105. package/src/forms/DangerZone/block.meta.ts +10 -1
  106. package/src/forms/DangerZone/examples/Labels.tsx +29 -0
  107. package/src/forms/DateRangeFilter/DateRangeFilter.labels.test.tsx +52 -0
  108. package/src/forms/DateRangeFilter/DateRangeFilter.tsx +11 -3
  109. package/src/forms/DateRangeFilter/block.meta.ts +8 -1
  110. package/src/forms/DateRangeFilter/examples/Labels.tsx +28 -0
  111. package/src/forms/DialogWizard/DialogWizard.labels.test.tsx +37 -0
  112. package/src/forms/DialogWizard/DialogWizard.tsx +13 -2
  113. package/src/forms/DialogWizard/block.meta.ts +7 -1
  114. package/src/forms/DialogWizard/examples/Labels.tsx +39 -0
  115. package/src/forms/FileUploadPanel/FileUploadPanel.controlled.test.tsx +482 -0
  116. package/src/forms/FileUploadPanel/FileUploadPanel.drag.test.tsx +60 -0
  117. package/src/forms/FileUploadPanel/FileUploadPanel.labels.test.tsx +126 -0
  118. package/src/forms/FileUploadPanel/FileUploadPanel.lifecycle.test.tsx +165 -0
  119. package/src/forms/FileUploadPanel/FileUploadPanel.tsx +336 -75
  120. package/src/forms/FileUploadPanel/block.meta.ts +26 -1
  121. package/src/forms/FileUploadPanel/examples/AutoCancel.tsx +38 -0
  122. package/src/forms/FileUploadPanel/examples/Labels.tsx +29 -0
  123. package/src/forms/FileUploadPanel/examples/ManualForm.tsx +36 -0
  124. package/src/forms/FileUploadPanel/fixtures.ts +31 -16
  125. package/src/forms/FileUploadPanel/simulate-upload.test.ts +24 -0
  126. package/src/forms/FormSection/FormSection.labels.test.tsx +37 -0
  127. package/src/forms/FormSection/FormSection.test.tsx +11 -0
  128. package/src/forms/FormSection/FormSection.tsx +34 -25
  129. package/src/forms/FormSection/block.meta.ts +7 -1
  130. package/src/forms/FormSection/examples/ContainerPanel.tsx +16 -0
  131. package/src/forms/FormSection/examples/Labels.tsx +27 -0
  132. package/src/forms/InviteMembersDialog/InviteMembersDialog.labels.test.tsx +87 -0
  133. package/src/forms/InviteMembersDialog/InviteMembersDialog.lifecycle.test.tsx +80 -0
  134. package/src/forms/InviteMembersDialog/InviteMembersDialog.tsx +121 -105
  135. package/src/forms/InviteMembersDialog/block.meta.ts +21 -2
  136. package/src/forms/InviteMembersDialog/examples/Labels.tsx +28 -0
  137. package/src/forms/SettingsRow/SettingsRow.labels.test.tsx +33 -0
  138. package/src/forms/SettingsRow/SettingsRow.tsx +14 -3
  139. package/src/forms/SettingsRow/block.meta.ts +7 -1
  140. package/src/forms/SettingsRow/examples/Labels.tsx +27 -0
  141. package/src/forms/ValidationSummary/ValidationSummary.labels.test.tsx +47 -0
  142. package/src/forms/ValidationSummary/ValidationSummary.tsx +10 -7
  143. package/src/forms/ValidationSummary/block.meta.ts +6 -1
  144. package/src/forms/ValidationSummary/examples/Labels.tsx +24 -0
  145. package/src/forms/index.ts +5 -1
  146. package/src/forms/translated-content.tsx +12 -0
  147. package/src/hooks/index.ts +2 -0
  148. package/src/hooks/useTableData.integration.test.tsx +89 -0
  149. package/src/hooks/useTableData.test.tsx +613 -0
  150. package/src/hooks/useTableData.ts +377 -0
  151. package/src/index.ts +1 -0
  152. package/src/marketing/ComparisonTable/ComparisonTable.tsx +2 -2
  153. package/src/marketing/FeatureGrid/FeatureGrid.tsx +1 -1
  154. package/src/marketing/LogoCloud/LogoCloud.doc.ts +13 -0
  155. package/src/marketing/LogoCloud/LogoCloud.test.tsx +155 -0
  156. package/src/marketing/LogoCloud/LogoCloud.tsx +89 -0
  157. package/src/marketing/LogoCloud/block.meta.ts +10 -0
  158. package/src/marketing/LogoCloud/examples/CaptionStart.tsx +6 -0
  159. package/src/marketing/LogoCloud/examples/Custom.tsx +25 -0
  160. package/src/marketing/LogoCloud/examples/Empty.tsx +6 -0
  161. package/src/marketing/LogoCloud/examples/Grid.tsx +13 -0
  162. package/src/marketing/LogoCloud/examples/Row.tsx +6 -0
  163. package/src/marketing/LogoCloud/examples/UnderHero.tsx +13 -0
  164. package/src/marketing/LogoCloud/fixtures.ts +23 -0
  165. package/src/marketing/PricingTable/PricingTable.tsx +1 -1
  166. package/src/marketing/SiteFooter/SiteFooter.doc.ts +18 -0
  167. package/src/marketing/SiteFooter/SiteFooter.test.tsx +236 -0
  168. package/src/marketing/SiteFooter/SiteFooter.tsx +160 -0
  169. package/src/marketing/SiteFooter/block.meta.ts +10 -0
  170. package/src/marketing/SiteFooter/examples/Centered.tsx +15 -0
  171. package/src/marketing/SiteFooter/examples/Columns.tsx +15 -0
  172. package/src/marketing/SiteFooter/examples/Custom.tsx +35 -0
  173. package/src/marketing/SiteFooter/examples/Empty.tsx +6 -0
  174. package/src/marketing/SiteFooter/examples/Simple.tsx +14 -0
  175. package/src/marketing/SiteFooter/fixtures.ts +36 -0
  176. package/src/marketing/index.ts +6 -0
  177. package/src/page-chrome/PageHeader/EditableTitle.test.tsx +26 -0
  178. package/src/page-chrome/PageHeader/PageHeader.options.test.tsx +34 -0
  179. package/src/page-chrome/PageHeader/PageHeader.tsx +11 -5
  180. package/src/page-chrome/PageHeader/block.meta.ts +1 -1
  181. package/src/page-chrome/PageHeader/examples/ContainerPanel.tsx +16 -0
  182. package/src/page-chrome/PageHeader/examples/EditableTitle.tsx +23 -0
  183. package/src/page-chrome/PageHeader/examples/Spanish.tsx +11 -0
  184. package/src/page-chrome/StickyActionBar/StickyActionBar.tsx +1 -1
  185. package/src/scheduling/AgendaList/AgendaList.tsx +39 -15
  186. package/src/scheduling/AgendaList/AgendaListZone.test.tsx +38 -0
  187. package/src/scheduling/AgendaList/block.meta.ts +1 -1
  188. package/src/scheduling/AgendaList/examples/TimeZone.tsx +28 -0
  189. package/src/scheduling/MonthCalendar/MonthCalendar.tsx +51 -40
  190. package/src/scheduling/MonthCalendar/MonthCalendarZone.test.tsx +44 -0
  191. package/src/scheduling/MonthCalendar/block.meta.ts +1 -1
  192. package/src/scheduling/MonthCalendar/examples/TimeZone.tsx +28 -0
  193. package/src/scheduling/WeekCalendar/WeekCalendar.tsx +37 -28
  194. package/src/scheduling/WeekCalendar/WeekCalendarZone.test.tsx +41 -0
  195. package/src/scheduling/WeekCalendar/block.meta.ts +1 -1
  196. package/src/scheduling/WeekCalendar/examples/TimeZone.tsx +28 -0
  197. package/src/scheduling/shared/CalendarHeader.tsx +26 -1
  198. package/src/scheduling/shared/dates.ts +102 -58
  199. package/src/scheduling/shared/events.ts +2 -2
  200. package/src/shell/AppSidebar/AppSidebar.context.test.tsx +175 -0
  201. package/src/shell/AppSidebar/AppSidebar.doc.ts +29 -0
  202. package/src/shell/AppSidebar/AppSidebar.tsx +97 -25
  203. package/src/shell/AppSidebar/block.meta.ts +1 -1
  204. package/src/shell/GlobalSearch/GlobalSearch.test.tsx +1 -0
  205. package/src/shell/GlobalSearch/GlobalSearch.tsx +1 -1
  206. package/src/tables/DataTable/DataTable.cross-page-selection.test.tsx +322 -0
  207. package/src/tables/DataTable/DataTable.cursor-example.test.tsx +67 -0
  208. package/src/tables/DataTable/DataTable.export.test.tsx +511 -0
  209. package/src/tables/DataTable/DataTable.inline-edit-focus.test.tsx +32 -0
  210. package/src/tables/DataTable/DataTable.labels.test.tsx +74 -0
  211. package/src/tables/DataTable/DataTable.layout.test.tsx +6 -5
  212. package/src/tables/DataTable/DataTable.link-actions.test.tsx +18 -0
  213. package/src/tables/DataTable/DataTable.server-pagination.test.tsx +329 -15
  214. package/src/tables/DataTable/DataTable.single-select.test.tsx +47 -7
  215. package/src/tables/DataTable/DataTable.test.tsx +140 -1
  216. package/src/tables/DataTable/DataTable.tsx +241 -80
  217. package/src/tables/DataTable/block.meta.ts +31 -3
  218. package/src/tables/DataTable/column-sizing.ts +2 -2
  219. package/src/tables/DataTable/data-table-props.ts +43 -6
  220. package/src/tables/DataTable/data-table-row.tsx +9 -5
  221. package/src/tables/DataTable/data-table-utils.ts +6 -0
  222. package/src/tables/DataTable/editable-cell.tsx +20 -79
  223. package/src/tables/DataTable/examples/client-selection.tsx +33 -0
  224. package/src/tables/DataTable/examples/csv-export.tsx +74 -0
  225. package/src/tables/DataTable/examples/cursor-load-more.tsx +87 -0
  226. package/src/tables/DataTable/examples/paginated-single-selection.tsx +46 -0
  227. package/src/tables/DataTable/examples/server-pagination.tsx +91 -44
  228. package/src/tables/DataTable/export-menu.tsx +58 -0
  229. package/src/tables/DataTable/header-cell.tsx +1 -1
  230. package/src/tables/DataTable/labels.ts +11 -0
  231. package/src/tables/DataTable/resize-handle.tsx +2 -2
  232. package/src/tables/DataTable/selection-strip.tsx +31 -0
  233. package/src/tables/DataTable/single-selection.tsx +0 -7
  234. package/src/tables/DataTable/use-multiple-selection.ts +86 -0
  235. package/src/tables/DataTable/use-table-export.ts +117 -0
  236. package/src/tables/FilterBar/FilterBar.test.tsx +12 -0
  237. package/src/tables/FilterBar/FilterBar.tsx +5 -7
  238. package/src/team/ProfileHeader/ProfileHeader.picker.test.tsx +34 -0
  239. package/src/team/ProfileHeader/ProfileHeader.test.tsx +2 -2
  240. package/src/team/ProfileHeader/ProfileHeader.tsx +17 -24
  241. package/src/team/ProfileHeader/block.meta.ts +1 -1
  242. package/src/test/OptInDefaults.test.tsx +36 -0
  243. package/src/test/clipboard-fallback.test.tsx +49 -0
  244. package/src/test/copy-examples.test.tsx +29 -0
  245. package/src/test/copy-feedback.test.tsx +166 -0
  246. package/src/test/fixtures/opt-in-defaults.json +10 -0
  247. package/src/test/without-forced-colors.test.ts +44 -0
  248. package/src/test/without-forced-colors.ts +14 -0
@@ -27,7 +27,7 @@ import {
27
27
  type PinnedColumns,
28
28
  } from './column-sizing';
29
29
  import { DataTableBody, flattenBody, type DataTableBodyGroup } from './data-table-body';
30
- import type { DataTableProps } from './data-table-props';
30
+ import type { DataTableProps, DataTableQuery } from './data-table-props';
31
31
  import {
32
32
  groupKeyOf,
33
33
  groupRows,
@@ -44,12 +44,21 @@ import { DensityToggle } from './density-toggle';
44
44
  import { DEPLOYMENT_COLUMNS, DEPLOYMENT_ROWS } from './fixtures';
45
45
  import { DataTableHeadCell } from './header-cell';
46
46
  import { SelectionGroup, useSingleSelection, useSingleSelectionWarnings } from './single-selection';
47
+ import { SelectionStrip } from './selection-strip';
47
48
  import { useControllable, useTableViews } from './use-table-views';
49
+ import { useMultipleSelection } from './use-multiple-selection';
48
50
  import { useVirtualRows } from './use-virtual-rows';
49
51
  import { ViewSwitcher, type DataTableViewState } from './views';
52
+ import { ExportMenu } from './export-menu';
53
+ import { useTableExport } from './use-table-export';
50
54
 
51
55
  export type { DataTableLabels } from './labels';
52
- export type { DataTableProps } from './data-table-props';
56
+ export type {
57
+ DataTableProps,
58
+ DataTableQuery,
59
+ DataTableCsvExportOptions,
60
+ DataTableExportRequest,
61
+ } from './data-table-props';
53
62
 
54
63
  const defaultRowId = (row: unknown): string => {
55
64
  const id = (row as { id?: unknown }).id;
@@ -70,7 +79,7 @@ export function DataTable<T = (typeof DEPLOYMENT_ROWS)[number]>({
70
79
  columns = DEPLOYMENT_COLUMNS as unknown as ReadonlyArray<DataTableColumn<T>>,
71
80
  getRowId = defaultRowId,
72
81
  getRowLabel,
73
- caption = 'Deployments',
82
+ caption: captionProp,
74
83
  showCaption = false,
75
84
  selectable: selectableProp = true,
76
85
  selectionMode,
@@ -85,12 +94,18 @@ export function DataTable<T = (typeof DEPLOYMENT_ROWS)[number]>({
85
94
  selectedIds,
86
95
  defaultSelectedIds = [],
87
96
  onSelectionChange,
97
+ preserveSelection,
98
+ selectAllMatching = false,
99
+ hideSelectAll = false,
100
+ selectionModel,
101
+ onSelectionModelChange,
88
102
  bulkActions,
89
103
  selectionSummary = true,
90
104
  rowActions,
91
105
  sort: sortProp,
92
106
  defaultSort = null,
93
107
  onSortChange,
108
+ onQueryChange,
94
109
  manualSorting = false,
95
110
  paginated: paginatedProp,
96
111
  paginationMode = 'client',
@@ -141,17 +156,22 @@ export function DataTable<T = (typeof DEPLOYMENT_ROWS)[number]>({
141
156
  filters,
142
157
  onFiltersChange,
143
158
  toolbar,
159
+ csvExport = false,
160
+ onExport,
144
161
  className,
145
162
  labels,
146
163
  }: DataTableProps<T>) {
147
- const { t } = useI18n();
164
+ const caption = captionProp ?? 'Deployments';
165
+ const { t, formatNumber } = useI18n();
148
166
  const singleMode = selectionMode === 'single';
149
167
  const serverMode = paginationMode === 'server';
168
+ const sortingEnabled = !serverMode || onSortChange != null || onQueryChange != null;
150
169
  const selectable = selectionMode === undefined ? selectableProp : selectionMode === 'multiple';
151
170
  const selectionColumn = selectable || singleMode;
152
- const paginated = !singleMode && (paginatedProp ?? true);
171
+ const paginated = paginatedProp ?? (serverMode || !singleMode);
153
172
  const editHintId = useId();
154
173
  const tableRef = useRef<HTMLTableElement>(null);
174
+ const pageCheckboxRef = useRef<HTMLElement>(null);
155
175
  // A view active at mount seeds the initial state.
156
176
  const [initialView] = useState(() =>
157
177
  (viewsProp ?? defaultViews ?? []).find((v) => v.id === (activeViewId ?? defaultActiveViewId)),
@@ -161,7 +181,6 @@ export function DataTable<T = (typeof DEPLOYMENT_ROWS)[number]>({
161
181
  const defaultHidden = columns.filter((c) => c.defaultHidden).map((c) => c.id);
162
182
 
163
183
  const [innerSort, setInnerSort] = useState<SortState | null>(seed.sort !== undefined ? seed.sort : defaultSort);
164
- const [innerSelected, setInnerSelected] = useState<ReadonlySet<string>>(() => new Set(defaultSelectedIds));
165
184
  const [innerDensity, setInnerDensity] = useState<TableDensity | null>(defaultDensity ?? null);
166
185
  const contextDensity = useDensity();
167
186
  const [hiddenList, setHiddenList] = useControllable<readonly string[]>(
@@ -188,7 +207,30 @@ export function DataTable<T = (typeof DEPLOYMENT_ROWS)[number]>({
188
207
  const effectiveGroupBy: DataTableGroupBy<T> | undefined =
189
208
  groupOverride === undefined ? groupBy : ((groupOverride ?? undefined) as DataTableGroupBy<T> | undefined);
190
209
  const sort = sortProp === undefined ? innerSort : sortProp;
191
- const selected: ReadonlySet<string> = selectedIds ? new Set(selectedIds) : innerSelected;
210
+ const enabledIds = rows.filter((row) => !isRowDisabled?.(row)).map(getRowId);
211
+ const {
212
+ selected,
213
+ selectedList,
214
+ setSelected,
215
+ model,
216
+ selectedCount,
217
+ allMatchingSelected,
218
+ selectAllMatching: selectMatching,
219
+ clear,
220
+ } = useMultipleSelection({
221
+ rowIds: rows.map(getRowId),
222
+ selectedIds,
223
+ defaultSelectedIds,
224
+ onSelectionChange,
225
+ preserveSelection: preserveSelection ?? serverMode,
226
+ enabledIds,
227
+ selectionModel,
228
+ onSelectionModelChange,
229
+ serverMode,
230
+ selectAllMatching: selectable && selectAllMatching,
231
+ total: rowCount ?? rows.length,
232
+ filters,
233
+ });
192
234
  const density = densityProp ?? innerDensity ?? contextDensity;
193
235
  const visibleColumns = orderColumns(
194
236
  columns.filter((c) => !hidden.has(c.id)),
@@ -212,20 +254,48 @@ export function DataTable<T = (typeof DEPLOYMENT_ROWS)[number]>({
212
254
  // Rows in collapsed groups are hidden, so select-all leaves them alone.
213
255
  const pageIds = (
214
256
  effectiveGroupBy ? pageRows.filter((row) => !collapsed.has(groupKeyOf(row, effectiveGroupBy))) : pageRows
215
- ).map(getRowId);
257
+ )
258
+ .filter((row) => !isRowDisabled?.(row))
259
+ .map(getRowId);
216
260
  const header = selectionState(pageIds, selected);
217
- const selectedList = rows.map(getRowId).filter((id) => selected.has(id));
218
-
219
- const setSelected = (next: Set<string>) => {
220
- setInnerSelected(next);
221
- onSelectionChange?.(rows.map(getRowId).filter((id) => next.has(id)));
261
+ const queryPage = serverMode ? (controlledPage ?? 1) : page;
262
+ const queryPageSize = serverMode ? (controlledPageSize ?? defaultPageSize) : pageSize;
263
+ const reportQuery = (cause: DataTableQuery['cause'], next: Partial<DataTableQuery>) =>
264
+ onQueryChange?.({ page: queryPage, pageSize: queryPageSize, sort, filters, ...next, cause });
265
+ // A resize that moves the page finishes in the footer's synchronous changePage
266
+ // callback, so one query follows the legacy callbacks without scheduling or batching.
267
+ const resizingTo = useRef<number | undefined>(undefined);
268
+ const changePage = (next: number) => {
269
+ if (serverMode) onPageChange?.(next);
270
+ else setPage(next);
271
+ const nextSize = resizingTo.current;
272
+ resizingTo.current = undefined;
273
+ reportQuery(nextSize === undefined ? 'page' : 'pageSize', {
274
+ page: next,
275
+ pageSize: nextSize ?? queryPageSize,
276
+ });
277
+ };
278
+ const changePageSize = (next: number) => {
279
+ const total = serverMode ? (rowCount ?? 0) : rows.length;
280
+ const pageCount = Math.max(1, Math.ceil(total / Math.max(1, queryPageSize)));
281
+ const displayedPage = Math.min(Math.max(1, queryPage), pageCount);
282
+ const from = total === 0 ? 0 : (displayedPage - 1) * queryPageSize + 1;
283
+ // Match the footer's comparison before goTo clamps the page (empty results yield 0).
284
+ const nextPage = Math.floor((from - 1) / next) + 1;
285
+ if (serverMode) onPageSizeChange?.(next);
286
+ else setPageSize(next);
287
+ if (nextPage !== displayedPage) resizingTo.current = next;
288
+ else reportQuery('pageSize', { page: nextPage, pageSize: next });
222
289
  };
223
290
  const changeSort = (columnId: string, direction: SortState['direction']) => {
224
- if (serverMode) return;
291
+ if (!sortingEnabled) return;
225
292
  const next: SortState = { columnId, direction: sort?.columnId === columnId ? direction : 'ascending' };
226
293
  setInnerSort(next);
227
294
  onSortChange?.(next);
228
- setPage(1);
295
+ if (serverMode) {
296
+ if (queryPage !== 1) onPageChange?.(1);
297
+ } else setPage(1);
298
+ reportQuery('sort', { page: 1, sort: next });
229
299
  };
230
300
  const toggleGroup = (key: string) => {
231
301
  const next = new Set(collapsed);
@@ -244,6 +314,7 @@ export function DataTable<T = (typeof DEPLOYMENT_ROWS)[number]>({
244
314
  name: nameOf(g.key),
245
315
  rows: pageRows.filter((row) => groupKeyOf(row, effectiveGroupBy) === g.key),
246
316
  ids: g.rows.map(getRowId),
317
+ selectableIds: g.rows.filter((row) => !isRowDisabled?.(row)).map(getRowId),
247
318
  }))
248
319
  .filter((g) => g.rows.length > 0)
249
320
  : undefined;
@@ -264,7 +335,6 @@ export function DataTable<T = (typeof DEPLOYMENT_ROWS)[number]>({
264
335
  useSingleSelectionWarnings({
265
336
  single: singleMode,
266
337
  selectionName,
267
- paginated: paginatedProp,
268
338
  hasLabel:
269
339
  Boolean(legend || ariaLabel?.trim() || ariaLabelledBy?.trim()) ||
270
340
  typeof legend === 'number' ||
@@ -301,7 +371,9 @@ export function DataTable<T = (typeof DEPLOYMENT_ROWS)[number]>({
301
371
  const applyState = (state: DataTableViewState) => {
302
372
  const nextSort = state.sort ?? null;
303
373
  setInnerSort(nextSort);
304
- if (nextSort && !serverMode) onSortChange?.(nextSort);
374
+ const sortChanged =
375
+ sortingEnabled && (sort?.columnId !== nextSort?.columnId || sort?.direction !== nextSort?.direction);
376
+ if (nextSort && (!serverMode || sortChanged)) onSortChange?.(nextSort);
305
377
  setHiddenList(state.hiddenColumns ?? defaultHidden);
306
378
  setWidths(state.columnWidths ?? defaultColumnWidths);
307
379
  setPinned(state.pinnedColumns ?? defaultPinnedColumns);
@@ -310,6 +382,12 @@ export function DataTable<T = (typeof DEPLOYMENT_ROWS)[number]>({
310
382
  if (nextGroup !== currentState.groupBy) onGroupByChange?.(nextGroup);
311
383
  if (state.filters !== filters) onFiltersChange?.(state.filters);
312
384
  if (!serverMode) setPage(1);
385
+ else if (sortChanged && queryPage !== 1) onPageChange?.(1);
386
+ reportQuery('view', {
387
+ page: !serverMode || sortChanged ? 1 : queryPage,
388
+ sort: nextSort,
389
+ filters: state.filters,
390
+ });
313
391
  };
314
392
  const viewsApi = useTableViews({
315
393
  views: viewsProp,
@@ -341,66 +419,143 @@ export function DataTable<T = (typeof DEPLOYMENT_ROWS)[number]>({
341
419
  const rowHeight = rowHeightProp ?? ROW_HEIGHT[density];
342
420
  const virtual = useVirtualRows({ enabled: virtualOn, count: items, rowHeight, tableRef, viewportHeight: 512 });
343
421
 
344
- const hasSelection = selectable && selectedList.length > 0 && (selectionSummary || bulkActions != null);
345
- const showToolbar = toolbar != null || showDensityToggle || showColumnMenu || showViews || hasSelection;
422
+ const exportSelectedIds = singleMode
423
+ ? singleSelection.selectedId == null
424
+ ? []
425
+ : [singleSelection.selectedId]
426
+ : selectable
427
+ ? selectedList
428
+ : [];
429
+ const exportSelectedCount = singleMode ? exportSelectedIds.length : selectable ? selectedCount : 0;
430
+ const exportApi = useTableExport({
431
+ csvExport,
432
+ onExport,
433
+ serverMode,
434
+ caption: captionProp ?? '',
435
+ columns: visibleColumns,
436
+ sortedRows,
437
+ pageRows,
438
+ selectedIds: exportSelectedIds,
439
+ getRowId,
440
+ sort,
441
+ filters,
442
+ labels,
443
+ });
444
+ const hasSelection = selectable && selectedCount > 0 && (selectionSummary || bulkActions != null);
445
+ const showToolbar =
446
+ toolbar != null || showDensityToggle || showColumnMenu || showViews || hasSelection || exportApi.enabled;
346
447
  const anyEditable = onCellEdit != null && columns.some((c) => c.editable);
448
+ const showSelectionStrip =
449
+ selectable &&
450
+ selectAllMatching &&
451
+ (!serverMode || !!onSelectionModelChange) &&
452
+ (header.checked || model.type === 'exclude' || (!serverMode && allMatchingSelected)) &&
453
+ (serverMode ? (rowCount ?? 0) > rows.length : enabledIds.length > pageIds.length);
454
+ const allMatching = serverMode ? model.type === 'exclude' : allMatchingSelected;
455
+ const matchingCount = serverMode ? selectedCount : enabledIds.length;
456
+ const stripMessage = allMatching
457
+ ? (labels?.allMatchingSelected?.(matchingCount) ??
458
+ t('table.allMatchingSelected', { count: formatNumber(matchingCount) }))
459
+ : (labels?.pageSelected?.(pageIds.length) ?? t('table.pageSelected', { count: formatNumber(pageIds.length) }));
460
+ const selectionCount = labels?.selectionCount ? labels.selectionCount(selectedCount) : <>{selectedCount} selected</>;
347
461
 
348
462
  return (
349
- <div className={cn('overflow-hidden rounded-xl border border-border bg-card shadow-sm', className)}>
350
- {showToolbar && (
351
- <div
352
- className={cn(
353
- 'flex min-h-12 flex-wrap items-center gap-2 border-b border-border px-3 py-2 transition-colors motion-reduce:transition-none',
354
- hasSelection ? 'bg-primary/8' : 'bg-secondary/30',
463
+ <div
464
+ className={cn('overflow-hidden rounded-xl border border-border bg-card shadow-sm', className)}
465
+ onKeyDown={exportApi.enabled ? exportApi.onCopyKeyDown : undefined}
466
+ >
467
+ <div
468
+ className={cn(
469
+ !showToolbar && 'sr-only',
470
+ 'flex min-h-12 flex-wrap items-center gap-2 border-b border-border px-3 py-2 transition-colors motion-reduce:transition-none',
471
+ hasSelection ? 'bg-primary/8' : 'bg-secondary/30',
472
+ )}
473
+ >
474
+ <div className="flex min-w-0 flex-1 flex-wrap items-center gap-2">
475
+ {/* Matching selection needs a mounted announcer; default tables retain their published surface. */}
476
+ {selectable && (selectAllMatching || (hasSelection && selectionSummary)) && (
477
+ <span
478
+ className={
479
+ hasSelection && selectionSummary && !showSelectionStrip
480
+ ? 'text-[12.5px] font-semibold text-foreground'
481
+ : 'sr-only'
482
+ }
483
+ aria-live="polite"
484
+ aria-atomic="true"
485
+ >
486
+ {showSelectionStrip ? stripMessage : hasSelection && selectionSummary ? selectionCount : null}
487
+ </span>
488
+ )}
489
+ {hasSelection ? (
490
+ <>
491
+ {selectionSummary && showSelectionStrip && (
492
+ <span className="text-[12.5px] font-semibold text-foreground">{selectionCount}</span>
493
+ )}
494
+ {selectionSummary && bulkActions && <span aria-hidden className="h-4 w-px bg-border" />}
495
+ {bulkActions?.(selectedList, model)}
496
+ </>
497
+ ) : (
498
+ toolbar
499
+ )}
500
+ </div>
501
+ <div className="flex items-center gap-2">
502
+ {exportApi.enabled && (
503
+ <ExportMenu
504
+ count={rowCount ?? rows.length}
505
+ selectedCount={serverMode ? exportSelectedCount : exportApi.selectedRowCount}
506
+ scopes={exportApi.scopes}
507
+ busy={exportApi.busy}
508
+ onExport={exportApi.exportRows}
509
+ onCopy={serverMode ? undefined : exportApi.copySelected}
510
+ labels={labels}
511
+ />
512
+ )}
513
+ {showViews && (
514
+ <ViewSwitcher
515
+ labels={labels}
516
+ views={viewsApi.views}
517
+ activeId={viewsApi.activeId}
518
+ dirty={viewsApi.dirty}
519
+ onSelect={viewsApi.select}
520
+ onSaveAs={viewsApi.saveAs}
521
+ onSave={viewsApi.save}
522
+ onRename={viewsApi.rename}
523
+ onDelete={viewsApi.remove}
524
+ onReset={viewsApi.reset}
525
+ />
526
+ )}
527
+ {showDensityToggle && <DensityToggle labels={labels} value={density} onChange={changeDensity} />}
528
+ {showColumnMenu && (
529
+ <ColumnVisibilityMenu
530
+ labels={labels}
531
+ columns={columns}
532
+ hidden={hidden}
533
+ onToggle={toggleColumn}
534
+ pinOf={pinning ? (id) => pinSideOf(id, pinned) : undefined}
535
+ onPin={pinning ? (id, side) => setPinned(setColumnPin(pinned, id, side)) : undefined}
536
+ />
355
537
  )}
356
- >
357
- <div className="flex min-w-0 flex-1 flex-wrap items-center gap-2">
358
- {hasSelection ? (
359
- <>
360
- {selectionSummary && (
361
- <span className="text-[12.5px] font-semibold text-foreground" aria-live="polite">
362
- {labels?.selectionCount ? (
363
- labels.selectionCount(selectedList.length)
364
- ) : (
365
- <>{selectedList.length} selected</>
366
- )}
367
- </span>
368
- )}
369
- {selectionSummary && bulkActions && <span aria-hidden className="h-4 w-px bg-border" />}
370
- {bulkActions?.(selectedList)}
371
- </>
372
- ) : (
373
- toolbar
374
- )}
375
- </div>
376
- <div className="flex items-center gap-2">
377
- {showViews && (
378
- <ViewSwitcher
379
- labels={labels}
380
- views={viewsApi.views}
381
- activeId={viewsApi.activeId}
382
- dirty={viewsApi.dirty}
383
- onSelect={viewsApi.select}
384
- onSaveAs={viewsApi.saveAs}
385
- onSave={viewsApi.save}
386
- onRename={viewsApi.rename}
387
- onDelete={viewsApi.remove}
388
- onReset={viewsApi.reset}
389
- />
390
- )}
391
- {showDensityToggle && <DensityToggle labels={labels} value={density} onChange={changeDensity} />}
392
- {showColumnMenu && (
393
- <ColumnVisibilityMenu
394
- labels={labels}
395
- columns={columns}
396
- hidden={hidden}
397
- onToggle={toggleColumn}
398
- pinOf={pinning ? (id) => pinSideOf(id, pinned) : undefined}
399
- onPin={pinning ? (id, side) => setPinned(setColumnPin(pinned, id, side)) : undefined}
400
- />
401
- )}
402
- </div>
403
538
  </div>
539
+ </div>
540
+ {showSelectionStrip && (
541
+ <SelectionStrip
542
+ labels={labels}
543
+ all={allMatching}
544
+ message={stripMessage}
545
+ total={serverMode ? (rowCount ?? 0) : enabledIds.length}
546
+ onSelectAll={selectMatching}
547
+ onClear={() => {
548
+ // Restore focus before clearing removes the strip and its focused button.
549
+ const target = hideSelectAll || loading || pageIds.length === 0 ? tableRef : pageCheckboxRef;
550
+ target.current?.focus();
551
+ clear();
552
+ }}
553
+ />
554
+ )}
555
+ {exportApi.enabled && (
556
+ <span role="status" aria-live="polite" className="sr-only">
557
+ {exportApi.announcement}
558
+ </span>
404
559
  )}
405
560
  {anyEditable && (
406
561
  <span id={editHintId} className="sr-only">
@@ -412,6 +567,7 @@ export function DataTable<T = (typeof DEPLOYMENT_ROWS)[number]>({
412
567
  <DensityProvider density={density}>
413
568
  <Table
414
569
  ref={tableRef}
570
+ tabIndex={selectable && selectAllMatching ? -1 : undefined}
415
571
  aria-busy={loading || undefined}
416
572
  aria-rowcount={virtual ? items + 1 : undefined}
417
573
  stickyHeader={virtualOn}
@@ -421,6 +577,7 @@ export function DataTable<T = (typeof DEPLOYMENT_ROWS)[number]>({
421
577
  // final column would add a scroll-container stop before the header.
422
578
  className={cn(
423
579
  layout.tableClassName,
580
+ selectable && selectAllMatching && 'focus-visible:outline-2 focus-visible:outline-focus-ring',
424
581
  singleMode && '[&_[data-column-resizer]]:end-0 [&_[data-column-resizer]]:justify-end',
425
582
  )}
426
583
  style={layout.tableStyle}
@@ -434,14 +591,17 @@ export function DataTable<T = (typeof DEPLOYMENT_ROWS)[number]>({
434
591
  className={cn(
435
592
  'w-10 pe-0',
436
593
  layout.lead.className,
437
- layout.lead.pinned && 'z-[11] bg-card',
594
+ layout.lead.pinned && 'z-sticky-pinned bg-card',
438
595
  stickyTint(layout.lead, { head: true }),
439
596
  )}
440
597
  style={layout.lead.style}
441
598
  >
442
- {singleMode && <span className="sr-only">{labels?.selection ?? t('table.selection')}</span>}
443
- {selectable && (
599
+ {(singleMode || hideSelectAll) && (
600
+ <span className="sr-only">{labels?.selection ?? t('table.selection')}</span>
601
+ )}
602
+ {selectable && !hideSelectAll && (
444
603
  <Checkbox
604
+ ref={pageCheckboxRef}
445
605
  aria-label={labels?.selectAll ?? t('table.selectAllPage')}
446
606
  checked={header.checked}
447
607
  indeterminate={header.indeterminate}
@@ -457,9 +617,9 @@ export function DataTable<T = (typeof DEPLOYMENT_ROWS)[number]>({
457
617
  <DataTableHeadCell
458
618
  labels={labels}
459
619
  key={c.id}
460
- column={serverMode ? { ...c, sortable: false } : c}
620
+ column={sortingEnabled ? c : { ...c, sortable: false }}
461
621
  layout={layout.columns.get(c.id)}
462
- sortDirection={!serverMode && sort?.columnId === c.id ? sort.direction : 'none'}
622
+ sortDirection={sortingEnabled && sort?.columnId === c.id ? sort.direction : 'none'}
463
623
  onSortChange={(dir) => changeSort(c.id, dir)}
464
624
  resize={
465
625
  resizable && c.resizable !== false
@@ -479,7 +639,7 @@ export function DataTable<T = (typeof DEPLOYMENT_ROWS)[number]>({
479
639
  className={cn(
480
640
  'w-12',
481
641
  layout.trail.className,
482
- layout.trail.pinned && 'z-[11] bg-card',
642
+ layout.trail.pinned && 'z-sticky-pinned bg-card',
483
643
  stickyTint(layout.trail, { head: true }),
484
644
  )}
485
645
  style={layout.trail.style}
@@ -496,6 +656,7 @@ export function DataTable<T = (typeof DEPLOYMENT_ROWS)[number]>({
496
656
  getRowId={getRowId}
497
657
  getRowLabel={labelOf}
498
658
  selectable={selectable}
659
+ isRowDisabled={isRowDisabled}
499
660
  selected={selected}
500
661
  singleSelection={singleMode ? singleSelection : undefined}
501
662
  onToggleRow={(id) => setSelected(toggleOne(id, selected))}
@@ -527,9 +688,9 @@ export function DataTable<T = (typeof DEPLOYMENT_ROWS)[number]>({
527
688
  className="border-t border-border px-4 py-3"
528
689
  total={serverMode ? rowCount : rows.length}
529
690
  page={serverMode ? controlledPage : page}
530
- onPageChange={serverMode ? onPageChange : setPage}
691
+ onPageChange={changePage}
531
692
  pageSize={serverMode ? controlledPageSize : pageSize}
532
- onPageSizeChange={serverMode ? onPageSizeChange : setPageSize}
693
+ onPageSizeChange={changePageSize}
533
694
  pageSizeOptions={pageSizeOptions}
534
695
  noun={caption}
535
696
  />
@@ -6,12 +6,24 @@ export const meta: BlockMeta = {
6
6
  family: 'tables',
7
7
  status: 'beta',
8
8
  description:
9
+ 'Typed data table with sorting, selection, pagination and saved views. ' +
10
+ 'Optional npm-only useTableData<T, F> from @gntik-ai/blocks owns abortable, per-instance cached server requests. Copy-install DataTable items do not include the hook. Supply getRows({ page, pageSize, sort, filters, cursor, signal }) returning a Promise of { rows, rowCount } for numbered pages or { rows, nextCursor } for cursor lists. Wrap another fetcher in getRows, for example async ({ signal, ...query }) => { const response = await fetchPage(query, { signal }); return { rows: response.items, rowCount: response.total }; }. Spread tableProps into DataTable: rows, server pagination, rowCount, page, pageSize, sort, manualSorting, loading, filters for selection/saved views and the query callbacks are included. Requests start after commit, so synchronous resize and sort callbacks coalesce into one call. Saved views can clear sort through onQueryChange. Options default to initialPage=1, initialPageSize=20, initialSort=null, cacheTime=30000 ms, keepPreviousData=true, revalidateInterval=0 and enabled=true. Filters compare by JSON.stringify value (key-order sensitive); use serialisable values without cycles or BigInt. Dates and class instances compare by their JSON form. Changing filters or sort requests page 1; resizing preserves the page computed by DataTable to keep the first visible row on screen. Changing callback identities does not refetch. rows, rowCount, nextCursor, isLoading, isFetching, error and params expose the request state. Retained rows keep their confirmed page and pageSize until success, while params describes the requested page and sort reflects the requested order immediately, rolling back on failure. There is no built-in fetching cue over retained rows yet. keepPreviousData=false shows empty rows for an uncached pending query; the last known total remains. Rejections and synchronous throws retain the last rows and call the latest onError once; nullish failures become an Error with the message Unable to load rows. Aborts stay silent. refetch retries the current failed params and bypasses fresh cache; repeating a failed page callback also retries. invalidate clears cache and reloads after edits. Both explicit reloads abort and replace any active request; their cache bypass applies only to that reload. Fresh cache hits clear errors and skip fetching; expired entries render immediately with one background refresh; cacheTime=0 disables caching. Cache entries, including expired ones, remain until invalidation or unmount, so memory grows with distinct queries. revalidateInterval pauses while document.hidden or a request is active, and polls only confirmed queries: failed query changes or cursor appends need an explicit retry. enabled=false aborts work, restores the last confirmed rows and sort, and clears loading; unmount aborts and ignores later settles. For cursors, use paginated=false and spread loadMoreProps into a separate LoadMoreFooter; loadMore appends, repeated calls in flight are ignored, and onRetry retries the failed cursor. An upstream AbortError stays silent and the next loadMore retries the aborted cursor. After a query failure, loadMore waits for a successful retry so a new sort or filter cannot use an old cursor. A null or empty nextCursor exhausts the list. lastAppend increases only when a successful append adds a segment, never when re-enabling or refreshing an already displayed segment, and footer result/loading settle together. Background polls and expired-cache refreshes set isFetching without showing Loading more in the footer; loadMore still ignores calls while any request is active. Cursor refetch starts from the first page; background revalidation preserves the prefix instead of appending duplicates. After a deletion empties an out-of-range page, the consumer chooses whether to request the last valid page: DataTable only clamps the displayed footer. See examples/server-pagination.tsx for endpoint wrapping, selection and errors, and examples/cursor-load-more.tsx for filters, enabled, keepPreviousData, polling, cache invalidation and retry, including a failed refresh after exhaustion. ' +
11
+ 'Opt-in csvExport adds an Export menu: All rows in current sort order across pages (before grouping), Current page in grouped display order, Selected rows and Copy selected rows (also Ctrl/Cmd+C on non-editable table content without a document text selection). csvExport accepts fileName and scopes (rows/page/selected). The filename defaults to the slugged caption, or table.csv without a supplied caption. Visible exportable columns keep display order; exportValue overrides accessor (nullish results fall back), columns without either are omitted, and exportable=false opts out. Values stay raw: ISO dates, booleans, numbers and empty null cells. CSV includes a BOM; CSV and clipboard TSV both use shared toCsv formula protection for headers and values. Single selection exports selectedId; multiple selection resolves include/exclude models across loaded rows. onExport receives scope, exported column ids, selected ids, sort and opaque filters; while pending the trigger stays focusable and busy and repeat exports are ignored. Use onExport for large result sets, and handle errors in the callback. Server pagination requires onExport and labels All rows with rowCount; clipboard copying and its shortcut are unavailable in server mode because unloaded selections cannot be copied completely. See examples/csv-export.tsx for client, delegated server and single-row previews. ' +
9
12
  'Generic typed table: sortable headers with aria-sort, row selection with select-all and indeterminate by default (selectionMode="multiple"), selectionMode="none" to hide selection, column visibility menu, density toggle, row actions, loading and empty states, client-side sort and pagination, optional row groups (groupBy) with rowgroup header rows, counts, keyboard-accessible collapse buttons and group selection; column resize (pointer drag or a focusable role="separator" handle with arrow keys, min/max widths, controlled columnWidths), column pinning to either edge with sticky cells (column menu or pinnedColumns), row virtualization for large datasets (aria-rowcount/aria-rowindex, works with selection and grouping), inline cell editing (text, number and select editors; Enter/F2 to edit, Enter/Tab to commit, Escape to cancel, onCellEdit can reject with an inline error) and saved views (filters, sort, visible columns, widths, pinning and grouping) with a view switcher to save as, rename, delete and reset. ' +
10
- 'Opt-in selectionMode="single" uses native radios in a labelled fieldset (never paginated or virtualized; paginated defaults to false and paginated=true is a type error). Single mode uses selectedId/onSelectedIdChange or defaultSelectedId; isRowDisabled skips unavailable rows and preserves a checked disabled choice without callbacks. Supply legend, aria-label or aria-labelledby for the group and getRowLabel for each radio (otherwise the first column labels it). selectionName is used verbatim and must be unique per page; omitted names use an instance-unique useId name, and duplicate supplied names or missing group labels warn in development. Tab enters once on the checked enabled row or first enabled row; arrows wrap and skip disabled rows, Space selects, Shift+Tab exits, and all-disabled groups have no tab stop. No select-all, group checkboxes, bulk actions or selection summary appear in single mode. ' +
13
+ 'Opt-in selectionMode="single" uses native radios in a labelled fieldset (never virtualized; client pagination defaults to false, and paginated=true or paginationMode="server" enables pagination). Single mode uses selectedId/onSelectedIdChange or defaultSelectedId; isRowDisabled skips unavailable rows and preserves a checked disabled choice without callbacks. Supply legend, aria-label or aria-labelledby for the group and getRowLabel for each radio (otherwise the first column labels it). selectionName is used verbatim and must be unique per page; omitted names use an instance-unique useId name, and duplicate supplied names or missing group labels warn in development. Tab enters once on the checked enabled row or first enabled row; arrows wrap and skip disabled rows, Space selects, Shift+Tab exits, and all-disabled groups have no tab stop. No select-all, group checkboxes, bulk actions or selection summary appear in single mode. ' +
11
14
  'Examples in examples/single-selection.tsx: an uncontrolled non-paginated list with legend="Available items" and a controlled versions table with legend="Available versions", selectedId="v2" and a checked disabled version. ' +
12
- 'Opt-in paginationMode="server" accepts a controlled 1-based page, pageSize and required rowCount (known total), with onPageChange/onPageSizeChange requests. Supplied rows render in order without client sorting or slicing, and headers have no sort affordance. Single selection cannot use server mode. The footer stays visible for empty results, clamps stale pages for display without callbacks, and hides during loading. Page-size changes may also request a page to keep the first visible row on screen. The consumer owns fetching and reconciles stale pages. See examples/server-pagination.tsx for an items/total/page/pageSize envelope consumer that handles both callbacks.',
15
+ 'Opt-in paginationMode="server" accepts a controlled 1-based page, pageSize and required rowCount (known total), with onPageChange/onPageSizeChange requests. Supplied rows render in order without client sorting or slicing. Sortable columns show sort buttons and aria-sort when onSortChange or onQueryChange is supplied; without either, headers stay plain. Sorting toggles ascending/descending, updates uncontrolled sort (controlled sort waits for the prop), and requests page 1 when not already there. aria-sort reflects the requested order before rows arrive; reset controlled sort to the last confirmed order if a request fails. Saved views restore changed sort and request page 1; views that only change filters keep the current server page. Clearing sort is reported as null through onQueryChange, since onSortChange accepts only a non-null SortState. Single selection keeps its chosen id across pages. Off-page choices leave every visible radio unchecked and the first enabled radio is the tab stop; name the current choice in the legend. See examples/paginated-single-selection.tsx for client and server pagination. The footer stays visible for empty results, clamps stale pages for display without callbacks, and hides during loading. Page-size changes may also request a page to keep the first visible row on screen. The consumer owns fetching and reconciles stale pages. onQueryChange receives one synchronous DataTableQuery per user page, pageSize, sort or view action in both modes: { page, pageSize, sort, filters, cause }. It includes the next page and size together on resize, and the restored filters on a view; consumer filter prop changes do not emit queries. Use onQueryChange OR the separate callbacks for fetching to avoid duplicate requests; existing callbacks retain their order and arguments. See examples/server-pagination.tsx for sortable columns and one request per query, with controlled sort reset on failure. ' +
16
+ 'Multiple selection preserves ids from other server pages by default; preserveSelection=false restores page-only reporting, and client tables can opt in with preserveSelection=true. selectedIds remains supported. A controlled selectionModel takes precedence and uses { type: "include", ids: string[] } for selected ids or { type: "exclude", ids: string[] } for every match except those ids. bulkActions(ids, model) receives the full include list; in exclude mode ids contains enabled selections in the current rows and the model is authoritative. One-argument actions remain compatible. ' +
17
+ 'selectAllMatching defaults to false and offers a strip after the page is fully selected: client mode includes every enabled row, while server mode requires onSelectionModelChange and reports an exclude model. The same button becomes Clear selection without moving focus; clearing returns focus to the page checkbox, or to the table when the checkbox is hidden or unavailable. An exclude model resets through both callbacks when filters changes by JSON value; filters must include every narrowing input, including search text. Paging, page size and sorting preserve selection. An exclude action covers the matching result set at action time, including later-created rows; the consumer executes it. isRowDisabled disables multiple-selection checkboxes and page/group/all-matching toggles skip known disabled rows. Server counts use rowCount minus explicit excluded ids, including disabled ids on the page where Select all is activated. isRowDisabled cannot evaluate unloaded rows, so the server must enforce eligibility for the complete matching result set; return only eligible matches and their rowCount when counts must exclude all unavailable rows. hideSelectAll defaults to false and hides just the header checkbox, retaining an accessible Selection heading. See examples/client-selection.tsx for client preservation, disabled rows and select-all-matching, and examples/server-pagination.tsx for controlled models, cross-page actions and the preservation/header options.',
13
18
 
14
19
  labels: [
20
+ { key: 'export', type: 'string', state: 'CSV export menu trigger text and name' },
21
+ { key: 'exportAll', type: '(count: number) => string', state: 'CSV all rows item; server mode uses rowCount' },
22
+ { key: 'exportPage', type: 'string', state: 'CSV current page item' },
23
+ { key: 'exportSelected', type: '(count: number) => string', state: 'CSV selected rows item, only with selection' },
24
+ { key: 'copySelected', type: 'string', state: 'Copy selected rows menu item, only with selection' },
25
+ { key: 'copiedToClipboard', type: 'string', state: 'Polite status after copying selected rows' },
26
+ { key: 'copyFailed', type: 'string', state: 'Polite status after clipboard failure' },
15
27
  { key: 'booleanTrue', type: 'string', state: 'Default cell text for a true boolean value' },
16
28
  { key: 'booleanFalse', type: 'string', state: 'Default cell text for a false boolean value' },
17
29
  {
@@ -24,6 +36,22 @@ export const meta: BlockMeta = {
24
36
  type: '(count: number) => string',
25
37
  state: 'Multiple selection: toolbar count and polite live region',
26
38
  },
39
+ {
40
+ key: 'pageSelected',
41
+ type: '(count: number) => string',
42
+ state: 'Matching-selection strip: selected page announcement',
43
+ },
44
+ {
45
+ key: 'selectAllMatching',
46
+ type: '(count: number) => string',
47
+ state: 'Matching-selection strip: select every enabled match',
48
+ },
49
+ {
50
+ key: 'allMatchingSelected',
51
+ type: '(count: number) => string',
52
+ state: 'Matching-selection strip: all-matching announcement',
53
+ },
54
+ { key: 'clearSelection', type: 'string', state: 'Matching-selection strip: clear action' },
27
55
  { key: 'columns', type: 'string', state: 'Column visibility trigger text and name' },
28
56
  { key: 'visibleColumns', type: 'string', state: 'Open column menu: visibility heading' },
29
57
  { key: 'pinColumns', type: 'string', state: 'Open column menu with pinning: pin heading' },
@@ -61,7 +89,7 @@ export const meta: BlockMeta = {
61
89
  { key: 'saveView', type: 'string', state: 'Save as dialog: submit button' },
62
90
  { key: 'rename', type: 'string', state: 'Rename dialog: submit button' },
63
91
  { key: 'closeDialog', type: 'string', state: 'Save as and Rename dialogs: close button name' },
64
- { key: 'selection', type: 'string', state: 'Single selection: screen reader column heading' },
92
+ { key: 'selection', type: 'string', state: 'Single selection or hideSelectAll: screen reader column heading' },
65
93
  { key: 'selectAll', type: 'string', state: 'Multiple selection: header checkbox name' },
66
94
  {
67
95
  key: 'selectRow',
@@ -85,7 +85,7 @@ export interface TableLayout {
85
85
  }
86
86
 
87
87
  // Sticky cells need an opaque surface; the row tint (hover, selected) is layered under the content.
88
- const STICKY = 'sticky z-[1] bg-card';
88
+ const STICKY = 'sticky z-raised bg-card';
89
89
  const START_EDGE = 'border-e border-border';
90
90
  const END_EDGE = 'border-s border-border';
91
91
 
@@ -160,7 +160,7 @@ export function stickyTint(
160
160
  { selected = false, head = false } = {},
161
161
  ): string | undefined {
162
162
  if (!layout?.pinned) return undefined;
163
- const base = 'before:pointer-events-none before:absolute before:inset-0 before:-z-10';
163
+ const base = 'before:pointer-events-none before:absolute before:inset-0 before:z-behind';
164
164
  if (head) return `${base} before:bg-secondary/30`;
165
165
  return `${base} ${selected ? 'before:bg-primary/8' : '[tr:hover>&]:before:bg-accent/30'}`;
166
166
  }