@gears-frontx/ui-kit 0.4.0 → 0.4.1

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 (230) hide show
  1. package/NOTICE +1 -0
  2. package/README.md +2 -1
  3. package/dist/chunks/data-grid.DIkpRRaf.css +1 -0
  4. package/dist/chunks/deep-equal.js +15 -0
  5. package/dist/chunks/deep-equal.js.map +1 -0
  6. package/dist/chunks/messages.js +42 -0
  7. package/dist/chunks/messages.js.map +1 -0
  8. package/dist/chunks/order.D7Jg_Mg8.css +1 -0
  9. package/dist/chunks/pagination.Cn8tIWMX.css +1 -0
  10. package/dist/chunks/plugins-helpers.js +41 -0
  11. package/dist/chunks/plugins-helpers.js.map +1 -0
  12. package/dist/chunks/segment.js +18 -0
  13. package/dist/chunks/segment.js.map +1 -0
  14. package/dist/chunks/text-search.BeZYac6V.css +1 -0
  15. package/dist/components/data-grid/components/data-grid-content.d.ts +3 -0
  16. package/dist/components/data-grid/components/data-grid-content.d.ts.map +1 -0
  17. package/dist/components/data-grid/components/data-grid-empty-state.d.ts +3 -0
  18. package/dist/components/data-grid/components/data-grid-empty-state.d.ts.map +1 -0
  19. package/dist/components/data-grid/components/data-grid-spinner.d.ts +16 -0
  20. package/dist/components/data-grid/components/data-grid-spinner.d.ts.map +1 -0
  21. package/dist/components/data-grid/components/load-controlled.d.ts +15 -0
  22. package/dist/components/data-grid/components/load-controlled.d.ts.map +1 -0
  23. package/dist/components/data-grid/components/segment.d.ts +15 -0
  24. package/dist/components/data-grid/components/segment.d.ts.map +1 -0
  25. package/dist/components/data-grid/create-data-grid.d.ts +4 -0
  26. package/dist/components/data-grid/create-data-grid.d.ts.map +1 -0
  27. package/dist/components/data-grid/data-grid-types.d.ts +142 -0
  28. package/dist/components/data-grid/data-grid-types.d.ts.map +1 -0
  29. package/dist/components/data-grid/data-grid.d.ts +3 -0
  30. package/dist/components/data-grid/data-grid.d.ts.map +1 -0
  31. package/dist/components/data-grid/messages.d.ts +39 -0
  32. package/dist/components/data-grid/messages.d.ts.map +1 -0
  33. package/dist/components/data-grid/plugins/empty-state/empty-state-plugin.d.ts +5 -0
  34. package/dist/components/data-grid/plugins/empty-state/empty-state-plugin.d.ts.map +1 -0
  35. package/dist/components/data-grid/plugins/empty-state/empty-state-types.d.ts +14 -0
  36. package/dist/components/data-grid/plugins/empty-state/empty-state-types.d.ts.map +1 -0
  37. package/dist/components/data-grid/plugins/empty-state/public.d.ts +3 -0
  38. package/dist/components/data-grid/plugins/empty-state/public.d.ts.map +1 -0
  39. package/dist/components/data-grid/plugins/order/components/data-grid-order-button.d.ts +3 -0
  40. package/dist/components/data-grid/plugins/order/components/data-grid-order-button.d.ts.map +1 -0
  41. package/dist/components/data-grid/plugins/order/components/data-grid-order-header-cell-label.d.ts +8 -0
  42. package/dist/components/data-grid/plugins/order/components/data-grid-order-header-cell-label.d.ts.map +1 -0
  43. package/dist/components/data-grid/plugins/order/components/data-grid-order-icon.d.ts +7 -0
  44. package/dist/components/data-grid/plugins/order/components/data-grid-order-icon.d.ts.map +1 -0
  45. package/dist/components/data-grid/plugins/order/order-plugin.d.ts +4 -0
  46. package/dist/components/data-grid/plugins/order/order-plugin.d.ts.map +1 -0
  47. package/dist/components/data-grid/plugins/order/order-types.d.ts +66 -0
  48. package/dist/components/data-grid/plugins/order/order-types.d.ts.map +1 -0
  49. package/dist/components/data-grid/plugins/order/public.d.ts +5 -0
  50. package/dist/components/data-grid/plugins/order/public.d.ts.map +1 -0
  51. package/dist/components/data-grid/plugins/order/services/order-labels.d.ts +8 -0
  52. package/dist/components/data-grid/plugins/order/services/order-labels.d.ts.map +1 -0
  53. package/dist/components/data-grid/plugins/order/services/order-option.d.ts +3 -0
  54. package/dist/components/data-grid/plugins/order/services/order-option.d.ts.map +1 -0
  55. package/dist/components/data-grid/plugins/pagination/components/data-grid-pagination.d.ts +3 -0
  56. package/dist/components/data-grid/plugins/pagination/components/data-grid-pagination.d.ts.map +1 -0
  57. package/dist/components/data-grid/plugins/pagination/components/pager.d.ts +22 -0
  58. package/dist/components/data-grid/plugins/pagination/components/pager.d.ts.map +1 -0
  59. package/dist/components/data-grid/plugins/pagination/pagination-plugin.d.ts +31 -0
  60. package/dist/components/data-grid/plugins/pagination/pagination-plugin.d.ts.map +1 -0
  61. package/dist/components/data-grid/plugins/pagination/public.d.ts +3 -0
  62. package/dist/components/data-grid/plugins/pagination/public.d.ts.map +1 -0
  63. package/dist/components/data-grid/plugins/pagination/services/pagination-items.d.ts +14 -0
  64. package/dist/components/data-grid/plugins/pagination/services/pagination-items.d.ts.map +1 -0
  65. package/dist/components/data-grid/plugins/text-search/components/data-grid-text-search.d.ts +3 -0
  66. package/dist/components/data-grid/plugins/text-search/components/data-grid-text-search.d.ts.map +1 -0
  67. package/dist/components/data-grid/plugins/text-search/public.d.ts +3 -0
  68. package/dist/components/data-grid/plugins/text-search/public.d.ts.map +1 -0
  69. package/dist/components/data-grid/plugins/text-search/text-search-plugin.d.ts +38 -0
  70. package/dist/components/data-grid/plugins/text-search/text-search-plugin.d.ts.map +1 -0
  71. package/dist/components/data-grid/public.d.ts +12 -0
  72. package/dist/components/data-grid/public.d.ts.map +1 -0
  73. package/dist/components/data-grid/services/columns/create-column-auto-size.d.ts +7 -0
  74. package/dist/components/data-grid/services/columns/create-column-auto-size.d.ts.map +1 -0
  75. package/dist/components/data-grid/services/core/core-service.d.ts +3 -0
  76. package/dist/components/data-grid/services/core/core-service.d.ts.map +1 -0
  77. package/dist/components/data-grid/services/core/core-types.d.ts +28 -0
  78. package/dist/components/data-grid/services/core/core-types.d.ts.map +1 -0
  79. package/dist/components/data-grid/services/core/data-grid-context.d.ts +17 -0
  80. package/dist/components/data-grid/services/core/data-grid-context.d.ts.map +1 -0
  81. package/dist/components/data-grid/services/hooked/hooked-types.d.ts +34 -0
  82. package/dist/components/data-grid/services/hooked/hooked-types.d.ts.map +1 -0
  83. package/dist/components/data-grid/services/hooked/hooked.d.ts +4 -0
  84. package/dist/components/data-grid/services/hooked/hooked.d.ts.map +1 -0
  85. package/dist/components/data-grid/services/internal/internal-helpers.d.ts +2 -0
  86. package/dist/components/data-grid/services/internal/internal-helpers.d.ts.map +1 -0
  87. package/dist/components/data-grid/services/layout/components/data-grid-layout-content.d.ts +7 -0
  88. package/dist/components/data-grid/services/layout/components/data-grid-layout-content.d.ts.map +1 -0
  89. package/dist/components/data-grid/services/layout/components/data-grid-layout-main-slot-selector.d.ts +4 -0
  90. package/dist/components/data-grid/services/layout/components/data-grid-layout-main-slot-selector.d.ts.map +1 -0
  91. package/dist/components/data-grid/services/layout/components/data-grid-layout-main.d.ts +3 -0
  92. package/dist/components/data-grid/services/layout/components/data-grid-layout-main.d.ts.map +1 -0
  93. package/dist/components/data-grid/services/layout/components/data-grid-layout-slot.d.ts +7 -0
  94. package/dist/components/data-grid/services/layout/components/data-grid-layout-slot.d.ts.map +1 -0
  95. package/dist/components/data-grid/services/layout/components/data-grid-layout-top-default.d.ts +3 -0
  96. package/dist/components/data-grid/services/layout/components/data-grid-layout-top-default.d.ts.map +1 -0
  97. package/dist/components/data-grid/services/layout/components/data-grid-layout-top.d.ts +3 -0
  98. package/dist/components/data-grid/services/layout/components/data-grid-layout-top.d.ts.map +1 -0
  99. package/dist/components/data-grid/services/layout/data-grid-view.d.ts +16 -0
  100. package/dist/components/data-grid/services/layout/data-grid-view.d.ts.map +1 -0
  101. package/dist/components/data-grid/services/layout/layout-service.d.ts +4 -0
  102. package/dist/components/data-grid/services/layout/layout-service.d.ts.map +1 -0
  103. package/dist/components/data-grid/services/layout/layout-slot-ids.d.ts +3 -0
  104. package/dist/components/data-grid/services/layout/layout-slot-ids.d.ts.map +1 -0
  105. package/dist/components/data-grid/services/layout/layout-types.d.ts +74 -0
  106. package/dist/components/data-grid/services/layout/layout-types.d.ts.map +1 -0
  107. package/dist/components/data-grid/services/load/load-instance.d.ts +4 -0
  108. package/dist/components/data-grid/services/load/load-instance.d.ts.map +1 -0
  109. package/dist/components/data-grid/services/load/load-service.d.ts +4 -0
  110. package/dist/components/data-grid/services/load/load-service.d.ts.map +1 -0
  111. package/dist/components/data-grid/services/load/load-types.d.ts +76 -0
  112. package/dist/components/data-grid/services/load/load-types.d.ts.map +1 -0
  113. package/dist/components/data-grid/services/load/use-data-grid-loading.d.ts +16 -0
  114. package/dist/components/data-grid/services/load/use-data-grid-loading.d.ts.map +1 -0
  115. package/dist/components/data-grid/services/persistent-state/persistent-state-service.d.ts +4 -0
  116. package/dist/components/data-grid/services/persistent-state/persistent-state-service.d.ts.map +1 -0
  117. package/dist/components/data-grid/services/persistent-state/persistent-state-types.d.ts +36 -0
  118. package/dist/components/data-grid/services/persistent-state/persistent-state-types.d.ts.map +1 -0
  119. package/dist/components/data-grid/services/plugins/plugins-helpers.d.ts +49 -0
  120. package/dist/components/data-grid/services/plugins/plugins-helpers.d.ts.map +1 -0
  121. package/dist/components/data-grid/services/plugins/plugins-service.d.ts +4 -0
  122. package/dist/components/data-grid/services/plugins/plugins-service.d.ts.map +1 -0
  123. package/dist/components/data-grid/services/plugins/plugins-types.d.ts +62 -0
  124. package/dist/components/data-grid/services/plugins/plugins-types.d.ts.map +1 -0
  125. package/dist/components/data-grid/services/storage/storage-helpers.d.ts +4 -0
  126. package/dist/components/data-grid/services/storage/storage-helpers.d.ts.map +1 -0
  127. package/dist/components/data-grid/services/storage/storage-service.d.ts +4 -0
  128. package/dist/components/data-grid/services/storage/storage-service.d.ts.map +1 -0
  129. package/dist/components/data-grid/services/storage/storage-types.d.ts +93 -0
  130. package/dist/components/data-grid/services/storage/storage-types.d.ts.map +1 -0
  131. package/dist/components/data-grid/services/table/components/data-grid-body-cell-content.d.ts +9 -0
  132. package/dist/components/data-grid/services/table/components/data-grid-body-cell-content.d.ts.map +1 -0
  133. package/dist/components/data-grid/services/table/components/data-grid-cell.d.ts +57 -0
  134. package/dist/components/data-grid/services/table/components/data-grid-cell.d.ts.map +1 -0
  135. package/dist/components/data-grid/services/table/components/data-grid-content.d.ts +7 -0
  136. package/dist/components/data-grid/services/table/components/data-grid-content.d.ts.map +1 -0
  137. package/dist/components/data-grid/services/table/components/data-grid-extra-body-columns.d.ts +8 -0
  138. package/dist/components/data-grid/services/table/components/data-grid-extra-body-columns.d.ts.map +1 -0
  139. package/dist/components/data-grid/services/table/components/data-grid-extra-header-cell.d.ts +12 -0
  140. package/dist/components/data-grid/services/table/components/data-grid-extra-header-cell.d.ts.map +1 -0
  141. package/dist/components/data-grid/services/table/components/data-grid-extra-header-columns.d.ts +10 -0
  142. package/dist/components/data-grid/services/table/components/data-grid-extra-header-columns.d.ts.map +1 -0
  143. package/dist/components/data-grid/services/table/components/data-grid-header-cell-content.d.ts +7 -0
  144. package/dist/components/data-grid/services/table/components/data-grid-header-cell-content.d.ts.map +1 -0
  145. package/dist/components/data-grid/services/table/components/data-grid-header-cell-label.d.ts +8 -0
  146. package/dist/components/data-grid/services/table/components/data-grid-header-cell-label.d.ts.map +1 -0
  147. package/dist/components/data-grid/services/table/components/data-grid-header-cell.d.ts +11 -0
  148. package/dist/components/data-grid/services/table/components/data-grid-header-cell.d.ts.map +1 -0
  149. package/dist/components/data-grid/services/table/components/data-grid-header-group.d.ts +10 -0
  150. package/dist/components/data-grid/services/table/components/data-grid-header-group.d.ts.map +1 -0
  151. package/dist/components/data-grid/services/table/components/data-grid-row.d.ts +8 -0
  152. package/dist/components/data-grid/services/table/components/data-grid-row.d.ts.map +1 -0
  153. package/dist/components/data-grid/services/table/components/data-grid-table-body.d.ts +3 -0
  154. package/dist/components/data-grid/services/table/components/data-grid-table-body.d.ts.map +1 -0
  155. package/dist/components/data-grid/services/table/components/data-grid-table-header.d.ts +3 -0
  156. package/dist/components/data-grid/services/table/components/data-grid-table-header.d.ts.map +1 -0
  157. package/dist/components/data-grid/services/table/components/data-grid-table-record.d.ts +8 -0
  158. package/dist/components/data-grid/services/table/components/data-grid-table-record.d.ts.map +1 -0
  159. package/dist/components/data-grid/services/table/components/data-grid-table-records.d.ts +8 -0
  160. package/dist/components/data-grid/services/table/components/data-grid-table-records.d.ts.map +1 -0
  161. package/dist/components/data-grid/services/table/components/data-grid-table-slot.d.ts +7 -0
  162. package/dist/components/data-grid/services/table/components/data-grid-table-slot.d.ts.map +1 -0
  163. package/dist/components/data-grid/services/table/components/data-grid-table.d.ts +3 -0
  164. package/dist/components/data-grid/services/table/components/data-grid-table.d.ts.map +1 -0
  165. package/dist/components/data-grid/services/table/data-grid-record-context.d.ts +5 -0
  166. package/dist/components/data-grid/services/table/data-grid-record-context.d.ts.map +1 -0
  167. package/dist/components/data-grid/services/table/ignore-row-click.d.ts +2 -0
  168. package/dist/components/data-grid/services/table/ignore-row-click.d.ts.map +1 -0
  169. package/dist/components/data-grid/services/table/resolve-body-cell-props.d.ts +21 -0
  170. package/dist/components/data-grid/services/table/resolve-body-cell-props.d.ts.map +1 -0
  171. package/dist/components/data-grid/services/table/resolve-column-style.d.ts +62 -0
  172. package/dist/components/data-grid/services/table/resolve-column-style.d.ts.map +1 -0
  173. package/dist/components/data-grid/services/table/table-columns-persistence.d.ts +19 -0
  174. package/dist/components/data-grid/services/table/table-columns-persistence.d.ts.map +1 -0
  175. package/dist/components/data-grid/services/table/table-columns.d.ts +15 -0
  176. package/dist/components/data-grid/services/table/table-columns.d.ts.map +1 -0
  177. package/dist/components/data-grid/services/table/table-context.d.ts +4 -0
  178. package/dist/components/data-grid/services/table/table-context.d.ts.map +1 -0
  179. package/dist/components/data-grid/services/table/table-extra-columns.d.ts +12 -0
  180. package/dist/components/data-grid/services/table/table-extra-columns.d.ts.map +1 -0
  181. package/dist/components/data-grid/services/table/table-header.d.ts +11 -0
  182. package/dist/components/data-grid/services/table/table-header.d.ts.map +1 -0
  183. package/dist/components/data-grid/services/table/table-helpers.d.ts +13 -0
  184. package/dist/components/data-grid/services/table/table-helpers.d.ts.map +1 -0
  185. package/dist/components/data-grid/services/table/table-min-content-width.d.ts +36 -0
  186. package/dist/components/data-grid/services/table/table-min-content-width.d.ts.map +1 -0
  187. package/dist/components/data-grid/services/table/table-service.d.ts +4 -0
  188. package/dist/components/data-grid/services/table/table-service.d.ts.map +1 -0
  189. package/dist/components/data-grid/services/table/table-slots.d.ts +9 -0
  190. package/dist/components/data-grid/services/table/table-slots.d.ts.map +1 -0
  191. package/dist/components/data-grid/services/table/table-sticky.d.ts +35 -0
  192. package/dist/components/data-grid/services/table/table-sticky.d.ts.map +1 -0
  193. package/dist/components/data-grid/services/table/table-store.d.ts +4 -0
  194. package/dist/components/data-grid/services/table/table-store.d.ts.map +1 -0
  195. package/dist/components/data-grid/services/table/table-types.d.ts +239 -0
  196. package/dist/components/data-grid/services/table/table-types.d.ts.map +1 -0
  197. package/dist/components/data-grid/utils/debounce.d.ts +7 -0
  198. package/dist/components/data-grid/utils/debounce.d.ts.map +1 -0
  199. package/dist/components/data-grid/utils/deep-equal.d.ts +7 -0
  200. package/dist/components/data-grid/utils/deep-equal.d.ts.map +1 -0
  201. package/dist/components/data-grid/utils/hooked.d.ts +17 -0
  202. package/dist/components/data-grid/utils/hooked.d.ts.map +1 -0
  203. package/dist/components/data-grid/utils/is-record.d.ts +3 -0
  204. package/dist/components/data-grid/utils/is-record.d.ts.map +1 -0
  205. package/dist/components/data-grid/utils/load-state.d.ts +22 -0
  206. package/dist/components/data-grid/utils/load-state.d.ts.map +1 -0
  207. package/dist/components/data-grid/utils/use-latest.d.ts +4 -0
  208. package/dist/components/data-grid/utils/use-latest.d.ts.map +1 -0
  209. package/dist/data-grid/empty-state.d.ts +1 -0
  210. package/dist/data-grid/empty-state.js +27 -0
  211. package/dist/data-grid/empty-state.js.map +1 -0
  212. package/dist/data-grid/order.d.ts +1 -0
  213. package/dist/data-grid/order.js +254 -0
  214. package/dist/data-grid/order.js.map +1 -0
  215. package/dist/data-grid/pagination.d.ts +1 -0
  216. package/dist/data-grid/pagination.js +215 -0
  217. package/dist/data-grid/pagination.js.map +1 -0
  218. package/dist/data-grid/text-search.d.ts +1 -0
  219. package/dist/data-grid/text-search.js +112 -0
  220. package/dist/data-grid/text-search.js.map +1 -0
  221. package/dist/data-grid.d.ts +1 -0
  222. package/dist/data-grid.js +1650 -0
  223. package/dist/data-grid.js.map +1 -0
  224. package/dist/docs/data-grid.md +588 -0
  225. package/dist/index.d.ts +5 -0
  226. package/dist/index.d.ts.map +1 -1
  227. package/dist/index.js +385 -367
  228. package/dist/index.js.map +1 -1
  229. package/llms.txt +11 -3
  230. package/package.json +4 -2
@@ -0,0 +1,588 @@
1
+ # DataGrid
2
+
3
+ A server-driven data grid: a `DataGrid` that renders rows through the kit's
4
+ `Table`, a `load(ctx)` callback that fetches them, a slot-based layout around
5
+ the table, and plugins that add behavior (paging, search, sorting, a custom
6
+ empty state) by registering into those slots and hooking the load. Each concern
7
+ (load, layout, table, storage, persistence) is a service with its own store, and
8
+ a plugin reaches all of them through one context object.
9
+
10
+ Built-in plugins: pagination, text search, order and empty state, each its own
11
+ entry (see below).
12
+
13
+ ## When to use
14
+
15
+ - A list backed by an API that pages, searches and sorts on the server, where
16
+ the page, the query and the order must survive a reload or live in the URL.
17
+ - A list whose behavior you want to extend by composition: each feature is a
18
+ child component of `DataGrid`, and you can write your own the same way
19
+ (see "Custom plugins").
20
+
21
+ ## When not to use
22
+
23
+ - Static, already-loaded rows with at most client-side sorting and paging -
24
+ use `DataTable`.
25
+ - Plain tabular markup you will drive yourself - use `Table`.
26
+
27
+ ## Imports and entries
28
+
29
+ The grid is split in entries so a grid that uses no plugin ships none of their
30
+ code or CSS:
31
+
32
+ | Entry | Exports |
33
+ |-------|---------|
34
+ | `@gears-frontx/ui-kit/data-grid` | `DataGrid`, `createDataGridPlugin`, `useDataGrid`, `useDataGridPluginContext`, `useDataGridRecord`, `useDataGridActiveView`, `DATA_GRID_VIEW`, and the types |
35
+ | `@gears-frontx/ui-kit/data-grid/pagination` | `DataGridPaginationPlugin` |
36
+ | `@gears-frontx/ui-kit/data-grid/text-search` | `DataGridTextSearchPlugin` |
37
+ | `@gears-frontx/ui-kit/data-grid/order` | `DataGridOrderPlugin`, `createDataGridOrderOption` |
38
+ | `@gears-frontx/ui-kit/data-grid/empty-state` | `DataGridEmptyStatePlugin` |
39
+
40
+ The package root re-exports all of them, so
41
+ `import { DataGrid, DataGridPaginationPlugin } from '@gears-frontx/ui-kit'`
42
+ works too; a bundler that honors `sideEffects` keeps only what is used. The core
43
+ entry never imports a plugin. The core and every plugin entry carry `'use client'`,
44
+ so a Server Component can import and render them; props that are functions
45
+ (`load`, a column's `render`) have to come from a Client Component.
46
+
47
+ ## Quick start
48
+
49
+ ```tsx
50
+ import {
51
+ DataGrid,
52
+ DataGridOrderPlugin,
53
+ DataGridPaginationPlugin,
54
+ DataGridTextSearchPlugin,
55
+ type DataGridLoadContext,
56
+ type DataGridTableColumn,
57
+ } from '@gears-frontx/ui-kit';
58
+
59
+ interface User {
60
+ id: number;
61
+ name: string;
62
+ email: string;
63
+ }
64
+
65
+ async function loadUsers({ pagination, filters, order, signal }: DataGridLoadContext) {
66
+ const response = await fetchUsers({
67
+ page: pagination?.page ?? 1,
68
+ limit: pagination?.limit ?? 12,
69
+ search: filters?.textSearch?.value,
70
+ sort: order?.[0],
71
+ signal,
72
+ });
73
+
74
+ return { results: response.users, total: response.total };
75
+ }
76
+
77
+ const columns: DataGridTableColumn<User>[] = [
78
+ { id: 'name', label: 'Name' },
79
+ { id: 'email', label: 'Email' },
80
+ ];
81
+
82
+ function UsersPage() {
83
+ return (
84
+ <DataGrid<User> name="users" load={loadUsers} columns={columns} persistent="localStorage">
85
+ <DataGridTextSearchPlugin />
86
+ <DataGridOrderPlugin />
87
+ <DataGridPaginationPlugin defaultLimit={12} limits={[12, 24, 48]} />
88
+ </DataGrid>
89
+ );
90
+ }
91
+ ```
92
+
93
+ `columns` and `implicitFilterKeys` must keep their identity between renders (a
94
+ module-level constant, or `useMemo`): a new array each render is read as a
95
+ change and recomputes the grid's derived state. The built-in plugins compare
96
+ their own array props by content, so an inline `limits` or `options` is fine; a
97
+ plugin you write compares by reference unless you give it `propsAreEqual`.
98
+
99
+ ## The `load` contract
100
+
101
+ `DataGrid` calls `load` once on mount and again whenever a plugin asks for a
102
+ reload (a page change, a search, a sort). It hands it a `DataGridLoadContext`, which the
103
+ plugins fill in, and expects a `DataGridLoadResult`.
104
+
105
+ | `DataGridLoadContext` field | Set by | Shape |
106
+ |---------------------|--------|-------|
107
+ | `pagination` | pagination plugin | `{ page: number; limit: number }`, page is 1-based |
108
+ | `filters` | text search plugin, and any plugin that registers one | `Record<string, { value, ... }>` keyed by filter key; text search writes `filters.textSearch` |
109
+ | `order` | order plugin | `{ column: string; direction: 'asc' \| 'desc' }[]`, absent when nothing is sorted |
110
+ | `signal` | the grid | an `AbortSignal`, aborted when a refresh replaces the load or the grid unmounts |
111
+
112
+ `DataGridLoadResult` is `{ results: TItem[]; total?: number }`. `total` is what the pager
113
+ counts; leave it out and the pager shows one page. A result without `results` is a
114
+ failed load, not an empty grid.
115
+
116
+ A plugin is not wired to your backend: it contributes to the context, and your
117
+ `load` has to read it (`filters.textSearch?.value`, `order?.[0]`).
118
+
119
+ If the first load fails, the grid shows an error view in place of itself and
120
+ logs the error to the console in development. It has no retry and a failed first
121
+ load stays failed; a failed later load has no UI of its own. Handle failures you
122
+ want shown inside `load`.
123
+
124
+ ## Columns
125
+
126
+ Each entry of `columns` is a `DataGridTableColumn`, or a `DataGridTableGroup` holding columns
127
+ under a spanning header cell.
128
+
129
+ | Field | Type | Notes |
130
+ |-------|------|-------|
131
+ | `id` | `string` | Required, **snake_case** (`user_name`). Checked when the columns arrive and throws otherwise: ids travel into plugins, storage and analytics. |
132
+ | `key` | `string` | The item field to show. Defaults to `id`; a dotted path (`owner.name`) reads nested values. |
133
+ | `label` | `string \| () => string` | Header text. A function is called on every render, for a label that changes with locale. |
134
+ | `render` | `(item) => ReactNode \| ReactNode` | Cell content. Wins over `component` and `key`. |
135
+ | `component` | `ComponentType<{ item, column, value }>` | Cell component. |
136
+ | `formatter` | `(value) => string` | Formats the value when neither `render` nor `component` is set. |
137
+ | `headerComponent` | `ComponentType<{ column }>` | Replaces the header label (for example a select-all checkbox). |
138
+ | `width` | `number \| string \| 'min-content'` | See "Choosing column widths". |
139
+ | `minWidth`, `maxWidth` | `number` | Pixels. Independent floor and cap under `tableLayout="auto"`. |
140
+ | `headerOverflow` | `'nowrap' \| 'wrap'` | Default `'nowrap'`: one line, clipped with an ellipsis, the label in `title`. |
141
+ | `cellOverflow` | `'wrap' \| 'nowrap'` | Default `'wrap'`. `'nowrap'` clips with an ellipsis and sets `title` to the value. |
142
+ | `sticky` | `boolean` | Pins the column to the inline-start edge while the table scrolls sideways. |
143
+ | `visible` | `boolean` | Initial visibility. |
144
+ | `visibleToggleDisabled` | `boolean` | The column's visibility is not the user's to change. |
145
+ | `getClassName` | `(item) => string \| undefined` | A class for the column's cell in that row. |
146
+ | `type` | `'string' \| 'number' \| 'date'` | Declared on the type; nothing in the grid reads it yet (the order plugin's option `type` is what names the directions). |
147
+ | `groupId` | `string` | Set by the grid on columns inside a `DataGridTableGroup`; do not set it. |
148
+
149
+ A `DataGridTableGroup` is `{ id, label, columns, component?, visible?, sticky? }`; a
150
+ group's `sticky` pins all its columns. Pin a group as a whole or none of its
151
+ columns: a column pinned or unpinned on its own inside a group moves in the body
152
+ but not under the group's header, so the header labels stop matching their
153
+ columns (see "Known limitations").
154
+
155
+ Pass a component to a column as its own module-level component, not an inline
156
+ function: an inline component is a new component on every render and loses its
157
+ state.
158
+
159
+ ### `tableLayout`
160
+
161
+ `'fixed'` (the default) shares one weighted track between the columns, computed
162
+ from the header row, so content never changes an already-rendered column's width.
163
+ `'auto'` sizes columns to their content, with `minWidth` and `maxWidth` as
164
+ independent floor and cap. This is the table's CSS `table-layout`, unrelated to
165
+ the slot layout below.
166
+
167
+ In both modes the table never shrinks below its content's natural width
168
+ (`min-inline-size: max-content`), so a grid with many columns scrolls sideways
169
+ rather than squeezing every column; the floor is adjustable (see "CSS
170
+ customization").
171
+
172
+ Under `'fixed'` the three width props collapse into one track: a lone `width`,
173
+ `minWidth` or `maxWidth` is the track, and combining them logs a development-only
174
+ warning (`width` wins). Under `'auto'`, if every column has a `width` or
175
+ `maxWidth` and the container is wider than their sum, the browser grows them all
176
+ past their caps and capped columns show trailing blank space; leave at least one
177
+ column unconstrained to absorb the slack (a development-only warning says so).
178
+
179
+ ### Choosing column widths
180
+
181
+ 1. Start from `tableLayout="fixed"`: it fills the container and keeps widths
182
+ stable when the page content changes.
183
+ 2. Classify each column. Long variable text (titles, descriptions) should grow.
184
+ Bounded variable content (dates, statuses, ids) has a known range. Fixed-shape
185
+ content (action buttons, avatars, checkboxes) is always the same width. Names
186
+ look like long text but behave like bounded content.
187
+ 3. Give long text no `width` so it absorbs the slack, bounded content a pixel
188
+ `width` sized to its widest value plus padding, and fixed-shape content
189
+ `width: 'min-content'` when the header defines the width (a pixel `width` when
190
+ the body is wider than the header).
191
+ 4. Route the slack on purpose. Under `'fixed'` a track holds only while at least
192
+ one column stays flexible; give every column a `width` and they all stretch in
193
+ proportion. Several long-text columns share the slack evenly when none has a
194
+ `width`. Extra columns a plugin adds with no width are flexible too.
195
+ 5. A flexible column in a narrow container can collapse to a word per line; a
196
+ definite track (a `width`, or a lone `minWidth`) gives it a floor while the
197
+ table scrolls around it. If the grid only starves in a narrow pane, raise the
198
+ table's floor with `--data-grid-table-min-inline-size` and leave the columns
199
+ alone.
200
+ 6. Bodies default to `'wrap'` and headers to `'nowrap'`. Do not truncate
201
+ identifier or code columns: they must stay readable and copyable in full.
202
+ 7. Reach for `tableLayout="auto"` only when a grid must shrink to its content or
203
+ needs caps `'fixed'` cannot express.
204
+
205
+ Give peer columns of one type (two date columns) one identical width, so one does
206
+ not wrap while its twin does.
207
+
208
+ ### `stickyHeader`
209
+
210
+ `stickyHeader` pins the header row to the top of the grid's scroll area while the
211
+ rows scroll under it, with the cells on an opaque fill. Pinned columns keep
212
+ working, and the corner cells stick on both axes. With column groups both header
213
+ rows stay pinned.
214
+
215
+ It only takes effect when the surrounding layout bounds the grid's height, so
216
+ that the grid scrolls internally: every ancestor between an element with a
217
+ definite height and the grid must be a flex column that may shrink. On a grid
218
+ that grows to its content the header scrolls away with the rows.
219
+
220
+ ```css
221
+ .grid-host {
222
+ display: flex;
223
+ flex: 1 1 0;
224
+ flex-direction: column;
225
+ min-block-size: 0;
226
+ }
227
+ ```
228
+
229
+ The header fill is `--card`; set `--data-grid-header-background` to change it.
230
+
231
+ ## Loading
232
+
233
+ While a load is in flight the grid is dimmed behind a scrim with a spinner
234
+ centered over it. The rows stay on screen underneath, so the grid keeps its shape
235
+ and scroll position, but they read as stale. The scrim covers the grid's own
236
+ regions - toolbar, rows and pagination - and takes the pointer events over them.
237
+ The first load is the exception: there is nothing to cover yet, so the grid shows
238
+ a centered spinner in its place.
239
+
240
+ The scrim and the spinner fade in after a short delay, so a load that settles
241
+ quickly shows nothing, and the content region carries `aria-busy="true"` while
242
+ either is on screen. The block is pointer-only: the covered controls stay in the tab
243
+ order and activatable from the keyboard.
244
+
245
+ Loads that only add to the grid (and so do not replace what you are looking at)
246
+ leave it alone.
247
+
248
+ ### `loading`
249
+
250
+ Use `loading` for work the grid never reloads for, such as a bulk copy started
251
+ elsewhere:
252
+
253
+ ```tsx
254
+ <DataGrid name="terms" load={loadTerms} columns={columns} loading={isCopying} />
255
+ ```
256
+
257
+ Hold the flag on the screen that renders the grid rather than inside the thing
258
+ that started the work, so the overlay survives that thing going away. It is OR-ed
259
+ with the grid's own loads, and there is no imperative equivalent.
260
+
261
+ ## Empty state
262
+
263
+ A grid with no records shows a centered `Empty` instead of the table: "No results
264
+ found", with a "Try adjusting your search or filters" line when a filter is
265
+ applied (`hasActiveFilters`). To replace it, use `DataGridEmptyStatePlugin`.
266
+
267
+ ### `implicitFilterKeys`
268
+
269
+ `hasActiveFilters` counts every filter key in the load context, including filters
270
+ the grid always sends on its own (a tenant or team taken from outside it). List
271
+ those keys to keep them out of the count, so an empty grid reaches its unfiltered
272
+ empty state:
273
+
274
+ ```tsx
275
+ const IMPLICIT_KEYS = ['teamId'];
276
+
277
+ <DataGrid name="users" load={loadUsers} columns={columns} implicitFilterKeys={IMPLICIT_KEYS} />;
278
+ ```
279
+
280
+ Only for filters with no control in the grid to clear them: a key the user can
281
+ clear belongs nowhere near this list, or they are stranded on an unfiltered empty
282
+ state with a filter still applied. The array must be referentially stable.
283
+
284
+ ## Layout slots
285
+
286
+ The grid lays itself out in named slots, and plugins register components into
287
+ them with `registerSlot(name, { id, component, order? })`:
288
+
289
+ | Slot | Where |
290
+ |------|-------|
291
+ | `top-start` | Left of the toolbar (search, filters) |
292
+ | `top` | The whole toolbar row, replacing the two halves when its `active` option is set |
293
+ | `top-end` | Right of the toolbar (order button, actions) |
294
+ | `main` | The primary content: the table view is the default one |
295
+ | `bottom` | The footer (pagination); hidden while the grid has no records |
296
+ | `empty` | Replaces the built-in empty state |
297
+
298
+ With two or more `main` views (for example the table and a cards view) the grid
299
+ adds a view switch to `top-end` by itself. Read or set the active view with
300
+ `useDataGridActiveView()` and `DATA_GRID_VIEW`:
301
+
302
+ ```tsx
303
+ const view = useDataGridActiveView(); // 'table_layout' | 'cards_layout' | undefined
304
+ grid.setActiveSlotId('main', DATA_GRID_VIEW.cards);
305
+ ```
306
+
307
+ The `main` slot is hidden when the grid is empty and nothing is filtered, which is
308
+ why the empty state has a slot of its own.
309
+
310
+ ## Persistence
311
+
312
+ `persistent` chooses where grid state (page and limit, search, order, and the
313
+ state of plugins that register any) is kept:
314
+
315
+ | Value | Where |
316
+ |-------|-------|
317
+ | `'localStorage'` (default) | Survives sessions |
318
+ | `'sessionStorage'` | Cleared when the tab closes |
319
+ | `'router'` | The URL query: `history.replaceState` on the current path, one query key per state |
320
+ | `'memory'` | Within one mount; a remount or reload starts clean |
321
+
322
+ Storage keys are `dataGrid:${name}:${key}`, with a JSON value, so a grid's `name`
323
+ is its identity: two grids with the same name on one page share state. A stored
324
+ value is user-editable (devtools, the address bar), so a value that is not valid
325
+ JSON reads as absent, and plugins narrow what they read.
326
+
327
+ Router mode writes the URL directly with bare keys, shared by every grid on the
328
+ page, and does not listen for `popstate`; a plugin can opt a state out of it
329
+ (`registerPersistentState(key, { router: false })`) or send one state to another
330
+ backend (`{ storage: 'localStorage' }`).
331
+
332
+ `persistentColumnVisibility` remembers which columns the user showed or hid, in
333
+ `localStorage` whatever `persistent` says. The grid ships no control that changes
334
+ it; a plugin of your own calls `updateColumnVisibility`.
335
+
336
+ ## Plugins
337
+
338
+ Plugins are children of `DataGrid`. They render nothing themselves: each one
339
+ registers its UI into a slot and its behavior into the load, once, when it mounts.
340
+
341
+ ### `DataGridPaginationPlugin`
342
+
343
+ Draws a pager in the `bottom` slot and fills `DataGridLoadContext.pagination`.
344
+
345
+ | Prop | Type | Default |
346
+ |------|------|---------|
347
+ | `defaultLimit` | `number` | `12` |
348
+ | `limits` | `number[]` | `[12, 24, 48, 96]`; the page-size selector appears with more than one |
349
+ | `autoHide` | `boolean` | `false`; hides the pager when everything fits the smallest limit |
350
+
351
+ A page change updates the page, stores it and reloads. A limit change goes back to
352
+ page 1, stores the limit and reloads. A refresh resets the page to 1. The page
353
+ count comes from `total`. The loading treatment is the grid's, not the pager's.
354
+
355
+ ### `DataGridTextSearchPlugin`
356
+
357
+ Draws a search box in `top-start` and contributes the query to the load as
358
+ `filters[filterKey] = { value }` (default key `textSearch`); your `load` reads it.
359
+
360
+ | Prop | Type | Default |
361
+ |------|------|---------|
362
+ | `filterKey` | `string` | `'textSearch'` |
363
+ | `placeholder` | `string` | `Search...` |
364
+ | `fullWidth` | `boolean` | `false`; stretches across the free `top-start` space |
365
+
366
+ Typing shows at once and reloads 300 ms after the user stops. The clear button
367
+ cancels a pending reload, reloads immediately with no query, and keeps focus in
368
+ the field. A refresh that resets filters empties the box. Its API
369
+ (`getPlugin<DataGridTextSearchPluginApi>('textSearch')`) offers `useQuery`,
370
+ `usePlaceholder`, `useFullWidth`, `setSearch` (immediate) and `updateSearch`
371
+ (debounced).
372
+
373
+ ### `DataGridOrderPlugin`
374
+
375
+ Header sorting plus an optional toolbar button; fills `DataGridLoadContext.order`.
376
+
377
+ | Prop | Type | Notes |
378
+ |------|------|-------|
379
+ | `options` | `DataGridOrderOption[]` | `createDataGridOrderOption({ id, label, type? })`. With options the toolbar button appears in `top-end`; `type` (`'string'`, `'number'`, `'date'`) names the directions A-Z, 0-9 or Oldest first. |
380
+ | `excludedColumns` | `string[]` | No header sort control for these. A column in both `excludedColumns` and `options` is sortable from the button only. |
381
+ | `defaultOrder` | `{ id, direction }` | Applies when nothing usable is stored. It seeds an order, it does not keep governing one. |
382
+ | `popover` | `{ minInlineSize }` | Sizes the button's popover. |
383
+
384
+ A header label is a button: the first click sorts descending, the second
385
+ ascending, the third clears the sort (and keeps `defaultOrder` suppressed on
386
+ later visits). The sorted column shows a direction icon that advances the same
387
+ cycle. The toolbar button changes the column and the direction, and never clears.
388
+ The order is stored; one whose column is orderable nowhere (excluded and not
389
+ offered) is withheld rather than deleted, so it returns if the column is offered
390
+ again.
391
+
392
+ The plugin compares `options` and `excludedColumns` by content, so an inline
393
+ array does not count as a change.
394
+
395
+ ### `DataGridEmptyStatePlugin`
396
+
397
+ Renders your component in place of the built-in empty state, whenever the grid has
398
+ no records (it sits outside `main`, so it also renders for an empty grid with no
399
+ filters). Read `hasActiveFilters` from `useDataGrid()` inside it to tell "nothing
400
+ here yet" from "nothing matched".
401
+
402
+ ```tsx
403
+ function UsersEmptyState() {
404
+ const { useStore } = useDataGrid();
405
+ const hasActiveFilters = useStore((s) => s.hasActiveFilters);
406
+
407
+ return (
408
+ <Empty>
409
+ <EmptyHeader>
410
+ <EmptyTitle>{hasActiveFilters ? 'No matching users' : 'No users yet'}</EmptyTitle>
411
+ </EmptyHeader>
412
+ </Empty>
413
+ );
414
+ }
415
+
416
+ <DataGrid name="users" load={loadUsers} columns={columns} implicitFilterKeys={IMPLICIT_KEYS}>
417
+ <DataGridEmptyStatePlugin component={UsersEmptyState} />
418
+ </DataGrid>;
419
+ ```
420
+
421
+ ## Custom plugins
422
+
423
+ `createDataGridPlugin(name, setup, propsAreEqual?)` returns a component to use as
424
+ a child of `DataGrid`. `setup` runs once, when it first mounts, with the plugin
425
+ context, and returns the plugin's API; the optional third argument is the
426
+ comparison `React.memo` uses for the props.
427
+
428
+ ```tsx
429
+ import { createDataGridPlugin, useDataGrid, type DataGridPluginApi } from '@gears-frontx/ui-kit';
430
+ import { create } from 'zustand';
431
+
432
+ interface StatusApi extends DataGridPluginApi {
433
+ useStatus: () => string;
434
+ setStatus: (status: string) => void;
435
+ }
436
+
437
+ function StatusFilter() {
438
+ const grid = useDataGrid();
439
+ const status = grid.getPlugin<StatusApi>('status')!;
440
+ return <Select value={status.useStatus()} onValueChange={status.setStatus} /* ... */ />;
441
+ }
442
+
443
+ export const StatusPlugin = createDataGridPlugin<DataGridItem, 'status', Record<string, never>, StatusApi>(
444
+ 'status',
445
+ (context) => {
446
+ const useStore = create(() => ({ status: '' }));
447
+ const persistent = context.registerPersistentState<{ status?: unknown }>('status');
448
+
449
+ // Storage is user-editable: narrow what you read.
450
+ const stored = persistent.value?.status;
451
+ if (typeof stored === 'string') useStore.setState({ status: stored });
452
+
453
+ context.registerSlot('top-start', { id: 'status', component: StatusFilter });
454
+
455
+ context.hook('load:context', () => {
456
+ const { status } = useStore.getState();
457
+ return status ? { filters: { status: { value: status } } } : undefined;
458
+ });
459
+
460
+ return {
461
+ useStatus: () => useStore((s) => s.status),
462
+ setStatus(status) {
463
+ useStore.setState({ status });
464
+ persistent.setValue(status ? { status } : undefined);
465
+ context.triggerLoad();
466
+ },
467
+ };
468
+ },
469
+ );
470
+ ```
471
+
472
+ ### The plugin context
473
+
474
+ | Area | Members |
475
+ |------|---------|
476
+ | Plugins | `hook(name, handler)`, `getPlugin<Api>(name)` |
477
+ | Layout | `registerSlot(name, options)`, `setActiveSlotId(name, id)`, `getActiveSlotId(name)` |
478
+ | Table | `registerTableSlot(name, options)` (`subheader`, `footer`, `header-cell-end`), `registerExtraColumn(options)`, `updateExtraColumnWidth` / `Order` / `Sticky`, `registerComponent(name, component)` (override `row`, `header-cell-label`, `body-cell-content` or `content`), `updateColumns`, `updateColumnVisibility`, `updateColumnSticky`, `updateTableLayout`, `updateStickyHeader` |
479
+ | Persistent state | `registerPersistentState(key, options?)` |
480
+ | Storage | `useStore(selector)` (`visibleRecords`, `rootSections`, `hasActiveFilters`, ...), `createSection`, `clearSections`, `getRecord`, `getItemId`, ... |
481
+ | Load | `triggerLoad(config?)`, `refresh(options?)`, `abort()`, `getLoadInstances()`, `useLoadStateStore` |
482
+
483
+ ### Lifecycle hooks
484
+
485
+ | Hook | When |
486
+ |------|------|
487
+ | `init`, `destroy` | The grid mounts, and unmounts (release observers, timers and subscriptions here) |
488
+ | `load:prepare` | Before a load starts |
489
+ | `load:context` | Return a partial `DataGridLoadContext` to merge into this load: `pagination`, `filters`, `order` |
490
+ | `load:process` | Return a replacement `DataGridLoadResult` before it is stored |
491
+ | `load:store` | After the result is stored; read `instance.processResult.total`. Return `true` to claim the storing |
492
+ | `load:success`, `load:error` | The load settled |
493
+ | `refresh` | `refresh()` was called; the options say whether filters reset |
494
+
495
+ ### Conventions
496
+
497
+ - `registerSlot`, `registerTableSlot` and `registerExtraColumn` append: call them
498
+ in `setup`, not in `onPropsChange`, which runs on every props change.
499
+ - `onPropsChange(props)` mirrors props into stores. Gate each optional prop with
500
+ `!== undefined` when you collect updates, or the guard is always true.
501
+ - Call `triggerLoad()` or `refresh()` from user actions, not from a global store
502
+ `subscribe`, which fires during initialization and adds loads on top of the
503
+ first. `triggerLoad` queues a load; `refresh` aborts the loads already in flight
504
+ before it starts its own, but two `refresh()` calls in the same tick both load
505
+ (see Known limitations).
506
+ - Functions that build plugin infrastructure but are not React hooks do not use
507
+ the `use` prefix.
508
+ - Do not import from another plugin's internals; share a utility through the
509
+ grid's services.
510
+
511
+ ## Hooks
512
+
513
+ | Hook | Returns |
514
+ |------|---------|
515
+ | `useDataGrid<TItem>()` | The grid instance, inside a `DataGrid`: `getPlugin`, `useStore`, `triggerLoad`, `refresh`, `setActiveSlotId`, ... |
516
+ | `useDataGridPluginContext<TItem>()` | The plugin context above, for a component that needs it directly |
517
+ | `useDataGridRecord<TItem>()` | The record of the row being rendered, inside a cell or row component |
518
+ | `useDataGridActiveView()` | The id of the active `main` view |
519
+
520
+ ## CSS customization
521
+
522
+ Set these on the grid or any ancestor:
523
+
524
+ | Variable | Default | Description |
525
+ |----------|---------|-------------|
526
+ | `--data-grid-table-min-inline-size` | `max-content` | Floor for the table's width. Raise it for a narrow pane that starves flexible columns, set it to `0` for a grid that must fit its wrapper. |
527
+ | `--data-grid-header-background` | `var(--card)` | Fill of the header cells while `stickyHeader` is on |
528
+ | `--data-grid-text-search-inline-size` | `initial` | Width of the search box; a fixed value stops it shifting as the clear button appears |
529
+
530
+ The floor is one constraint among several: under `'fixed'` a table whose columns
531
+ declare widths cannot shrink below their sum, and under either mode not below the
532
+ columns' minimum content widths.
533
+
534
+ ## Accessibility
535
+
536
+ - The header label of an orderable column is a native `button` named "Change
537
+ sorting of '<column>' column"; Enter and Space sort. There is no `aria-sort`.
538
+ - The table's scroll container is a tab stop (it holds `tabIndex=0` so a keyboard
539
+ can scroll it).
540
+ - The pager is a `nav` named "Pagination"; the page buttons are named "Go to page
541
+ N" and carry `aria-current="page"` on the current one.
542
+ - `aria-busy` is set on the content region while a loader is on screen.
543
+ - The order popover's items are menu items without a menu popup, so they take
544
+ focus and Enter and Space, but arrow keys do not move between them.
545
+ - Strings are English and live in one module; the kit has no i18n layer yet.
546
+
547
+ ## Known limitations
548
+
549
+ - Data loading has no stale-response guard: `triggerLoad` neither aborts the load
550
+ in flight nor ignores a late result, so when two loads overlap (two quick page
551
+ clicks, a page-size change, a refresh over a page change, two `refresh()` calls
552
+ in the same tick) the older result can replace the newer one. A `load` that
553
+ ignores `signal` is not protected even by the abort `refresh()` sends. `refresh()` also defaults to `resetFilters: true`.
554
+ - Changing the page size from a later page fires two loads.
555
+ - `abort()` counts as the grid's own abort. Called during the first load, or during
556
+ the refresh the first load waits on, it ends the first load with nothing loaded:
557
+ the grid shows "No results found" and loads nothing more. A superseded
558
+ `refresh()` resolves without its data, so a caller cannot tell it was superseded.
559
+ - A failed first load has no retry; a failed refetch has no UI, and when search or
560
+ sort started it, the failure also reaches the host as an unhandled rejection.
561
+ - A search still waiting out its debounce when the grid unmounts is flushed: its
562
+ refresh runs after the grid is gone, and its load's `signal` is not aborted.
563
+ - The loading overlay blocks the pointer only, not the keyboard.
564
+ - No `aria-sort`; Previous and Next drop keyboard focus at the ends of the range.
565
+ - Renderer overrides (`registerComponent`) are last registered wins.
566
+ - `registerComponent` accepts `'header-cell'` and `'header-group'`, but the header
567
+ always renders its own cell and group components, so those two overrides have no
568
+ effect.
569
+ - A column pinned on its own inside a group, or a pinned group with one column
570
+ unpinned, moves in the body but not under the group's header, so the header
571
+ labels sit over the wrong columns. Pin a group as a whole.
572
+ - Router persistence shares bare keys across grids and does not follow `popstate`;
573
+ it also drops `history.state` and the `#hash` when it writes the URL, and it does
574
+ not work during server rendering.
575
+ - A new `columns` array identity resets user pins and visibility.
576
+ - There is no plugin unregister.
577
+
578
+ ## Anti-patterns
579
+
580
+ - Do not define a column's cell component inline in `render`: it is a new
581
+ component each render.
582
+ - Do not leave `columns`, `options` or `excludedColumns` as inline literals that
583
+ change identity every render.
584
+ - Do not use `camelCase` column ids; they must be snake_case.
585
+ - Do not put a key that the user can clear in `implicitFilterKeys`.
586
+ - Do not reach into the grid's markup from a consumer stylesheet; use the CSS
587
+ variables above.
588
+ - Do not trigger loads from a store `subscribe` in a plugin.
package/dist/index.d.ts CHANGED
@@ -46,6 +46,11 @@ export * from './components/collapsible/public.js';
46
46
  export * from './components/combobox/public.js';
47
47
  export * from './components/command/public.js';
48
48
  export * from './components/context-menu/public.js';
49
+ export * from './components/data-grid/plugins/empty-state/public.js';
50
+ export * from './components/data-grid/plugins/order/public.js';
51
+ export * from './components/data-grid/plugins/pagination/public.js';
52
+ export * from './components/data-grid/plugins/text-search/public.js';
53
+ export * from './components/data-grid/public.js';
49
54
  export * from './components/data-table/public.js';
50
55
  export * from './components/date-picker/public.js';
51
56
  export * from './components/dialog/public.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,cAAc,kCAAkC,CAAC;AACjD,cAAc,8BAA8B,CAAC;AAC7C,cAAc,qCAAqC,CAAC;AACpD,cAAc,qCAAqC,CAAC;AACpD,cAAc,mCAAmC,CAAC;AAClD,cAAc,+BAA+B,CAAC;AAC9C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,mCAAmC,CAAC;AAClD,cAAc,+BAA+B,CAAC;AAC9C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,qCAAqC,CAAC;AACpD,cAAc,iCAAiC,CAAC;AAChD,cAAc,6BAA6B,CAAC;AAC5C,cAAc,iCAAiC,CAAC;AAChD,cAAc,8BAA8B,CAAC;AAC7C,cAAc,iCAAiC,CAAC;AAChD,cAAc,oCAAoC,CAAC;AACnD,cAAc,iCAAiC,CAAC;AAChD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,qCAAqC,CAAC;AACpD,cAAc,mCAAmC,CAAC;AAClD,cAAc,oCAAoC,CAAC;AACnD,cAAc,+BAA+B,CAAC;AAC9C,cAAc,kCAAkC,CAAC;AACjD,cAAc,+BAA+B,CAAC;AAC9C,cAAc,sCAAsC,CAAC;AACrD,cAAc,8BAA8B,CAAC;AAC7C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,mCAAmC,CAAC;AAClD,cAAc,8BAA8B,CAAC;AAC7C,cAAc,oCAAoC,CAAC;AACnD,cAAc,kCAAkC,CAAC;AACjD,cAAc,6BAA6B,CAAC;AAC5C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,yCAAyC,CAAC;AACxD,cAAc,sCAAsC,CAAC;AACrD,cAAc,wCAAwC,CAAC;AACvD,cAAc,mCAAmC,CAAC;AAClD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,iCAAiC,CAAC;AAChD,cAAc,sCAAsC,CAAC;AACrD,cAAc,oCAAoC,CAAC;AACnD,cAAc,kCAAkC,CAAC;AACjD,cAAc,oCAAoC,CAAC;AACnD,cAAc,+BAA+B,CAAC;AAC9C,cAAc,kCAAkC,CAAC;AACjD,cAAc,8BAA8B,CAAC;AAC7C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,iCAAiC,CAAC;AAChD,cAAc,+BAA+B,CAAC;AAC9C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,mCAAmC,CAAC;AAClD,cAAc,+BAA+B,CAAC;AAC9C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,iCAAiC,CAAC;AAChD,cAAc,8BAA8B,CAAC;AAC7C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,qCAAqC,CAAC;AACpD,cAAc,gCAAgC,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,cAAc,kCAAkC,CAAC;AACjD,cAAc,8BAA8B,CAAC;AAC7C,cAAc,qCAAqC,CAAC;AACpD,cAAc,qCAAqC,CAAC;AACpD,cAAc,mCAAmC,CAAC;AAClD,cAAc,+BAA+B,CAAC;AAC9C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,mCAAmC,CAAC;AAClD,cAAc,+BAA+B,CAAC;AAC9C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,qCAAqC,CAAC;AACpD,cAAc,iCAAiC,CAAC;AAChD,cAAc,6BAA6B,CAAC;AAC5C,cAAc,iCAAiC,CAAC;AAChD,cAAc,8BAA8B,CAAC;AAC7C,cAAc,iCAAiC,CAAC;AAChD,cAAc,oCAAoC,CAAC;AACnD,cAAc,iCAAiC,CAAC;AAChD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,qCAAqC,CAAC;AACpD,cAAc,sDAAsD,CAAC;AACrE,cAAc,gDAAgD,CAAC;AAC/D,cAAc,qDAAqD,CAAC;AACpE,cAAc,sDAAsD,CAAC;AACrE,cAAc,kCAAkC,CAAC;AACjD,cAAc,mCAAmC,CAAC;AAClD,cAAc,oCAAoC,CAAC;AACnD,cAAc,+BAA+B,CAAC;AAC9C,cAAc,kCAAkC,CAAC;AACjD,cAAc,+BAA+B,CAAC;AAC9C,cAAc,sCAAsC,CAAC;AACrD,cAAc,8BAA8B,CAAC;AAC7C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,mCAAmC,CAAC;AAClD,cAAc,8BAA8B,CAAC;AAC7C,cAAc,oCAAoC,CAAC;AACnD,cAAc,kCAAkC,CAAC;AACjD,cAAc,6BAA6B,CAAC;AAC5C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,yCAAyC,CAAC;AACxD,cAAc,sCAAsC,CAAC;AACrD,cAAc,wCAAwC,CAAC;AACvD,cAAc,mCAAmC,CAAC;AAClD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,iCAAiC,CAAC;AAChD,cAAc,sCAAsC,CAAC;AACrD,cAAc,oCAAoC,CAAC;AACnD,cAAc,kCAAkC,CAAC;AACjD,cAAc,oCAAoC,CAAC;AACnD,cAAc,+BAA+B,CAAC;AAC9C,cAAc,kCAAkC,CAAC;AACjD,cAAc,8BAA8B,CAAC;AAC7C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,iCAAiC,CAAC;AAChD,cAAc,+BAA+B,CAAC;AAC9C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,mCAAmC,CAAC;AAClD,cAAc,+BAA+B,CAAC;AAC9C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,iCAAiC,CAAC;AAChD,cAAc,8BAA8B,CAAC;AAC7C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,qCAAqC,CAAC;AACpD,cAAc,gCAAgC,CAAC"}