@lminii/material-react-table 4.0.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 (349) hide show
  1. package/LICENSE +22 -0
  2. package/README.md +234 -0
  3. package/dist/index.d.mts +2408 -0
  4. package/dist/index.d.ts +2408 -0
  5. package/dist/index.js +4825 -0
  6. package/dist/index.js.map +1 -0
  7. package/dist/index.mjs +4631 -0
  8. package/dist/index.mjs.map +1 -0
  9. package/locales/ar/index.d.mts +3 -0
  10. package/locales/ar/index.d.ts +3 -0
  11. package/locales/ar/index.js +100 -0
  12. package/locales/ar/index.mjs +96 -0
  13. package/locales/ar/package.json +6 -0
  14. package/locales/az/index.d.mts +3 -0
  15. package/locales/az/index.d.ts +3 -0
  16. package/locales/az/index.js +100 -0
  17. package/locales/az/index.mjs +96 -0
  18. package/locales/az/package.json +6 -0
  19. package/locales/bg/index.d.mts +3 -0
  20. package/locales/bg/index.d.ts +3 -0
  21. package/locales/bg/index.js +100 -0
  22. package/locales/bg/index.mjs +96 -0
  23. package/locales/bg/package.json +6 -0
  24. package/locales/cs/index.d.mts +3 -0
  25. package/locales/cs/index.d.ts +3 -0
  26. package/locales/cs/index.js +100 -0
  27. package/locales/cs/index.mjs +96 -0
  28. package/locales/cs/package.json +6 -0
  29. package/locales/da/index.d.mts +3 -0
  30. package/locales/da/index.d.ts +3 -0
  31. package/locales/da/index.js +100 -0
  32. package/locales/da/index.mjs +96 -0
  33. package/locales/da/package.json +6 -0
  34. package/locales/de/index.d.mts +3 -0
  35. package/locales/de/index.d.ts +3 -0
  36. package/locales/de/index.js +100 -0
  37. package/locales/de/index.mjs +96 -0
  38. package/locales/de/package.json +6 -0
  39. package/locales/el/index.d.mts +3 -0
  40. package/locales/el/index.d.ts +3 -0
  41. package/locales/el/index.js +100 -0
  42. package/locales/el/index.mjs +96 -0
  43. package/locales/el/package.json +6 -0
  44. package/locales/en/index.d.mts +3 -0
  45. package/locales/en/index.d.ts +3 -0
  46. package/locales/en/index.js +100 -0
  47. package/locales/en/index.mjs +96 -0
  48. package/locales/en/package.json +6 -0
  49. package/locales/es/index.d.mts +3 -0
  50. package/locales/es/index.d.ts +3 -0
  51. package/locales/es/index.js +100 -0
  52. package/locales/es/index.mjs +96 -0
  53. package/locales/es/package.json +6 -0
  54. package/locales/et/index.d.mts +3 -0
  55. package/locales/et/index.d.ts +3 -0
  56. package/locales/et/index.js +100 -0
  57. package/locales/et/index.mjs +96 -0
  58. package/locales/et/package.json +6 -0
  59. package/locales/fa/index.d.mts +3 -0
  60. package/locales/fa/index.d.ts +3 -0
  61. package/locales/fa/index.js +100 -0
  62. package/locales/fa/index.mjs +96 -0
  63. package/locales/fa/package.json +6 -0
  64. package/locales/fi/index.d.mts +3 -0
  65. package/locales/fi/index.d.ts +3 -0
  66. package/locales/fi/index.js +100 -0
  67. package/locales/fi/index.mjs +96 -0
  68. package/locales/fi/package.json +6 -0
  69. package/locales/fr/index.d.mts +3 -0
  70. package/locales/fr/index.d.ts +3 -0
  71. package/locales/fr/index.js +100 -0
  72. package/locales/fr/index.mjs +96 -0
  73. package/locales/fr/package.json +6 -0
  74. package/locales/he/index.d.mts +3 -0
  75. package/locales/he/index.d.ts +3 -0
  76. package/locales/he/index.js +100 -0
  77. package/locales/he/index.mjs +96 -0
  78. package/locales/he/package.json +6 -0
  79. package/locales/hr/index.d.mts +3 -0
  80. package/locales/hr/index.d.ts +3 -0
  81. package/locales/hr/index.js +100 -0
  82. package/locales/hr/index.mjs +96 -0
  83. package/locales/hr/package.json +6 -0
  84. package/locales/hu/index.d.mts +3 -0
  85. package/locales/hu/index.d.ts +3 -0
  86. package/locales/hu/index.js +100 -0
  87. package/locales/hu/index.mjs +96 -0
  88. package/locales/hu/package.json +6 -0
  89. package/locales/hy/index.d.mts +3 -0
  90. package/locales/hy/index.d.ts +3 -0
  91. package/locales/hy/index.js +100 -0
  92. package/locales/hy/index.mjs +96 -0
  93. package/locales/hy/package.json +6 -0
  94. package/locales/id/index.d.mts +3 -0
  95. package/locales/id/index.d.ts +3 -0
  96. package/locales/id/index.js +100 -0
  97. package/locales/id/index.mjs +96 -0
  98. package/locales/id/package.json +6 -0
  99. package/locales/it/index.d.mts +3 -0
  100. package/locales/it/index.d.ts +3 -0
  101. package/locales/it/index.js +100 -0
  102. package/locales/it/index.mjs +96 -0
  103. package/locales/it/package.json +6 -0
  104. package/locales/ja/index.d.mts +3 -0
  105. package/locales/ja/index.d.ts +3 -0
  106. package/locales/ja/index.js +100 -0
  107. package/locales/ja/index.mjs +96 -0
  108. package/locales/ja/package.json +6 -0
  109. package/locales/ko/index.d.mts +3 -0
  110. package/locales/ko/index.d.ts +3 -0
  111. package/locales/ko/index.js +100 -0
  112. package/locales/ko/index.mjs +96 -0
  113. package/locales/ko/package.json +6 -0
  114. package/locales/nl/index.d.mts +3 -0
  115. package/locales/nl/index.d.ts +3 -0
  116. package/locales/nl/index.js +100 -0
  117. package/locales/nl/index.mjs +96 -0
  118. package/locales/nl/package.json +6 -0
  119. package/locales/no/index.d.mts +3 -0
  120. package/locales/no/index.d.ts +3 -0
  121. package/locales/no/index.js +100 -0
  122. package/locales/no/index.mjs +96 -0
  123. package/locales/no/package.json +6 -0
  124. package/locales/np/index.d.mts +3 -0
  125. package/locales/np/index.d.ts +3 -0
  126. package/locales/np/index.js +100 -0
  127. package/locales/np/index.mjs +96 -0
  128. package/locales/np/package.json +6 -0
  129. package/locales/pl/index.d.mts +3 -0
  130. package/locales/pl/index.d.ts +3 -0
  131. package/locales/pl/index.js +100 -0
  132. package/locales/pl/index.mjs +96 -0
  133. package/locales/pl/package.json +6 -0
  134. package/locales/pt/index.d.mts +3 -0
  135. package/locales/pt/index.d.ts +3 -0
  136. package/locales/pt/index.js +100 -0
  137. package/locales/pt/index.mjs +96 -0
  138. package/locales/pt/package.json +6 -0
  139. package/locales/pt-BR/index.d.mts +3 -0
  140. package/locales/pt-BR/index.d.ts +3 -0
  141. package/locales/pt-BR/index.js +100 -0
  142. package/locales/pt-BR/index.mjs +96 -0
  143. package/locales/pt-BR/package.json +6 -0
  144. package/locales/ro/index.d.mts +3 -0
  145. package/locales/ro/index.d.ts +3 -0
  146. package/locales/ro/index.js +100 -0
  147. package/locales/ro/index.mjs +96 -0
  148. package/locales/ro/package.json +6 -0
  149. package/locales/ru/index.d.mts +3 -0
  150. package/locales/ru/index.d.ts +3 -0
  151. package/locales/ru/index.js +100 -0
  152. package/locales/ru/index.mjs +96 -0
  153. package/locales/ru/package.json +6 -0
  154. package/locales/sk/index.d.mts +3 -0
  155. package/locales/sk/index.d.ts +3 -0
  156. package/locales/sk/index.js +100 -0
  157. package/locales/sk/index.mjs +96 -0
  158. package/locales/sk/package.json +6 -0
  159. package/locales/sr-Cyrl-RS/index.d.mts +3 -0
  160. package/locales/sr-Cyrl-RS/index.d.ts +3 -0
  161. package/locales/sr-Cyrl-RS/index.js +100 -0
  162. package/locales/sr-Cyrl-RS/index.mjs +96 -0
  163. package/locales/sr-Cyrl-RS/package.json +6 -0
  164. package/locales/sr-Latn-RS/index.d.mts +3 -0
  165. package/locales/sr-Latn-RS/index.d.ts +3 -0
  166. package/locales/sr-Latn-RS/index.js +100 -0
  167. package/locales/sr-Latn-RS/index.mjs +96 -0
  168. package/locales/sr-Latn-RS/package.json +6 -0
  169. package/locales/sv/index.d.mts +3 -0
  170. package/locales/sv/index.d.ts +3 -0
  171. package/locales/sv/index.js +100 -0
  172. package/locales/sv/index.mjs +96 -0
  173. package/locales/sv/package.json +6 -0
  174. package/locales/tr/index.d.mts +3 -0
  175. package/locales/tr/index.d.ts +3 -0
  176. package/locales/tr/index.js +100 -0
  177. package/locales/tr/index.mjs +96 -0
  178. package/locales/tr/package.json +6 -0
  179. package/locales/uk/index.d.mts +3 -0
  180. package/locales/uk/index.d.ts +3 -0
  181. package/locales/uk/index.js +100 -0
  182. package/locales/uk/index.mjs +96 -0
  183. package/locales/uk/package.json +6 -0
  184. package/locales/vi/index.d.mts +3 -0
  185. package/locales/vi/index.d.ts +3 -0
  186. package/locales/vi/index.js +100 -0
  187. package/locales/vi/index.mjs +96 -0
  188. package/locales/vi/package.json +6 -0
  189. package/locales/zh-Hans/index.d.mts +3 -0
  190. package/locales/zh-Hans/index.d.ts +3 -0
  191. package/locales/zh-Hans/index.js +100 -0
  192. package/locales/zh-Hans/index.mjs +96 -0
  193. package/locales/zh-Hans/package.json +6 -0
  194. package/locales/zh-Hant/index.d.mts +3 -0
  195. package/locales/zh-Hant/index.d.ts +3 -0
  196. package/locales/zh-Hant/index.js +100 -0
  197. package/locales/zh-Hant/index.mjs +96 -0
  198. package/locales/zh-Hant/package.json +6 -0
  199. package/package.json +147 -0
  200. package/skills/README.md +81 -0
  201. package/skills/composable-components/SKILL.md +189 -0
  202. package/skills/customization/SKILL.md +190 -0
  203. package/skills/drag-and-drop-ordering/SKILL.md +227 -0
  204. package/skills/editing/SKILL.md +243 -0
  205. package/skills/filtering/SKILL.md +213 -0
  206. package/skills/getting-started/SKILL.md +213 -0
  207. package/skills/localization/SKILL.md +182 -0
  208. package/skills/migrate-v3-to-v4/SKILL.md +161 -0
  209. package/skills/state-and-server-data/SKILL.md +200 -0
  210. package/skills/virtualization/SKILL.md +203 -0
  211. package/src/components/MaterialReactTable.tsx +36 -0
  212. package/src/components/body/MRT_TableBody.tsx +221 -0
  213. package/src/components/body/MRT_TableBodyCell.tsx +351 -0
  214. package/src/components/body/MRT_TableBodyCellValue.tsx +130 -0
  215. package/src/components/body/MRT_TableBodyRow.tsx +288 -0
  216. package/src/components/body/MRT_TableBodyRowGrabHandle.tsx +61 -0
  217. package/src/components/body/MRT_TableBodyRowPinButton.tsx +58 -0
  218. package/src/components/body/MRT_TableDetailPanel.tsx +110 -0
  219. package/src/components/buttons/MRT_ColumnPinningButtons.tsx +72 -0
  220. package/src/components/buttons/MRT_CopyButton.tsx +87 -0
  221. package/src/components/buttons/MRT_EditActionButtons.tsx +134 -0
  222. package/src/components/buttons/MRT_ExpandAllButton.tsx +78 -0
  223. package/src/components/buttons/MRT_ExpandButton.tsx +102 -0
  224. package/src/components/buttons/MRT_GrabHandleButton.tsx +65 -0
  225. package/src/components/buttons/MRT_RowPinButton.tsx +84 -0
  226. package/src/components/buttons/MRT_ShowHideColumnsButton.tsx +50 -0
  227. package/src/components/buttons/MRT_ToggleDensePaddingButton.tsx +52 -0
  228. package/src/components/buttons/MRT_ToggleFiltersButton.tsx +40 -0
  229. package/src/components/buttons/MRT_ToggleFullScreenButton.tsx +51 -0
  230. package/src/components/buttons/MRT_ToggleGlobalFilterButton.tsx +46 -0
  231. package/src/components/buttons/MRT_ToggleRowActionMenuButton.tsx +126 -0
  232. package/src/components/footer/MRT_TableFooter.tsx +88 -0
  233. package/src/components/footer/MRT_TableFooterCell.tsx +107 -0
  234. package/src/components/footer/MRT_TableFooterRow.tsx +95 -0
  235. package/src/components/head/MRT_TableHead.tsx +91 -0
  236. package/src/components/head/MRT_TableHeadCell.tsx +351 -0
  237. package/src/components/head/MRT_TableHeadCellColumnActionsButton.tsx +96 -0
  238. package/src/components/head/MRT_TableHeadCellFilterContainer.tsx +52 -0
  239. package/src/components/head/MRT_TableHeadCellFilterLabel.tsx +178 -0
  240. package/src/components/head/MRT_TableHeadCellGrabHandle.tsx +91 -0
  241. package/src/components/head/MRT_TableHeadCellResizeHandle.tsx +96 -0
  242. package/src/components/head/MRT_TableHeadCellSortLabel.tsx +101 -0
  243. package/src/components/head/MRT_TableHeadRow.tsx +90 -0
  244. package/src/components/inputs/MRT_EditCellTextField.tsx +202 -0
  245. package/src/components/inputs/MRT_FilterCheckbox.tsx +90 -0
  246. package/src/components/inputs/MRT_FilterRangeFields.tsx +41 -0
  247. package/src/components/inputs/MRT_FilterRangeSlider.tsx +143 -0
  248. package/src/components/inputs/MRT_FilterTextField.tsx +592 -0
  249. package/src/components/inputs/MRT_GlobalFilterTextField.tsx +167 -0
  250. package/src/components/inputs/MRT_SelectCheckbox.tsx +135 -0
  251. package/src/components/menus/MRT_ActionMenuItem.tsx +62 -0
  252. package/src/components/menus/MRT_CellActionMenu.tsx +107 -0
  253. package/src/components/menus/MRT_ColumnActionMenu.tsx +352 -0
  254. package/src/components/menus/MRT_FilterOptionMenu.tsx +292 -0
  255. package/src/components/menus/MRT_RowActionMenu.tsx +88 -0
  256. package/src/components/menus/MRT_ShowHideColumnsMenu.tsx +181 -0
  257. package/src/components/menus/MRT_ShowHideColumnsMenuItems.tsx +203 -0
  258. package/src/components/modals/MRT_EditRowModal.tsx +114 -0
  259. package/src/components/table/MRT_Table.tsx +84 -0
  260. package/src/components/table/MRT_TableContainer.tsx +111 -0
  261. package/src/components/table/MRT_TableLoadingOverlay.tsx +58 -0
  262. package/src/components/table/MRT_TablePaper.tsx +89 -0
  263. package/src/components/toolbar/MRT_BottomToolbar.tsx +111 -0
  264. package/src/components/toolbar/MRT_LinearProgressBar.tsx +53 -0
  265. package/src/components/toolbar/MRT_TablePagination.tsx +241 -0
  266. package/src/components/toolbar/MRT_ToolbarAlertBanner.tsx +184 -0
  267. package/src/components/toolbar/MRT_ToolbarDropZone.tsx +83 -0
  268. package/src/components/toolbar/MRT_ToolbarInternalButtons.tsx +72 -0
  269. package/src/components/toolbar/MRT_TopToolbar.tsx +130 -0
  270. package/src/features/mrtCellActionsFeature.ts +67 -0
  271. package/src/features/mrtColumnDraggingFeature.ts +83 -0
  272. package/src/features/mrtDensityFeature.ts +64 -0
  273. package/src/features/mrtEditingFeature.ts +102 -0
  274. package/src/features/mrtFeatures.ts +103 -0
  275. package/src/features/mrtFilterModesFeature.ts +99 -0
  276. package/src/features/mrtFnsFeature.ts +46 -0
  277. package/src/features/mrtFullScreenFeature.ts +63 -0
  278. package/src/features/mrtLoadingFeature.ts +35 -0
  279. package/src/features/mrtRefsFeature.ts +60 -0
  280. package/src/features/mrtRowDraggingFeature.ts +81 -0
  281. package/src/features/mrtStateCompatFeature.ts +43 -0
  282. package/src/features/mrtToolbarsFeature.ts +76 -0
  283. package/src/fns/aggregationFns.ts +3 -0
  284. package/src/fns/filterFns.ts +196 -0
  285. package/src/fns/sortingFns.ts +31 -0
  286. package/src/hooks/display-columns/getMRT_RowActionsColumnDef.tsx +28 -0
  287. package/src/hooks/display-columns/getMRT_RowDragColumnDef.tsx +29 -0
  288. package/src/hooks/display-columns/getMRT_RowExpandColumnDef.tsx +97 -0
  289. package/src/hooks/display-columns/getMRT_RowNumbersColumnDef.tsx +30 -0
  290. package/src/hooks/display-columns/getMRT_RowPinningColumnDef.tsx +24 -0
  291. package/src/hooks/display-columns/getMRT_RowSelectColumnDef.tsx +34 -0
  292. package/src/hooks/display-columns/getMRT_RowSpacerColumnDef.tsx +33 -0
  293. package/src/hooks/useMRT_ColumnVirtualizer.ts +124 -0
  294. package/src/hooks/useMRT_Effects.ts +108 -0
  295. package/src/hooks/useMRT_RowVirtualizer.ts +88 -0
  296. package/src/hooks/useMRT_Rows.ts +44 -0
  297. package/src/hooks/useMRT_TableInstance.ts +181 -0
  298. package/src/hooks/useMRT_TableOptions.ts +241 -0
  299. package/src/hooks/useMaterialReactTable.ts +12 -0
  300. package/src/icons.ts +73 -0
  301. package/src/index.ts +91 -0
  302. package/src/locales/ar.ts +97 -0
  303. package/src/locales/az.ts +97 -0
  304. package/src/locales/bg.ts +97 -0
  305. package/src/locales/cs.ts +98 -0
  306. package/src/locales/da.ts +97 -0
  307. package/src/locales/de.ts +97 -0
  308. package/src/locales/el.ts +97 -0
  309. package/src/locales/en.ts +97 -0
  310. package/src/locales/es.ts +97 -0
  311. package/src/locales/et.ts +98 -0
  312. package/src/locales/fa.ts +97 -0
  313. package/src/locales/fi.ts +98 -0
  314. package/src/locales/fr.ts +97 -0
  315. package/src/locales/he.ts +97 -0
  316. package/src/locales/hr.ts +97 -0
  317. package/src/locales/hu.ts +97 -0
  318. package/src/locales/hy.ts +97 -0
  319. package/src/locales/id.ts +98 -0
  320. package/src/locales/it.ts +97 -0
  321. package/src/locales/ja.ts +97 -0
  322. package/src/locales/ko.ts +97 -0
  323. package/src/locales/mk.ts +96 -0
  324. package/src/locales/nl.ts +97 -0
  325. package/src/locales/no.ts +99 -0
  326. package/src/locales/np.ts +98 -0
  327. package/src/locales/pl.ts +97 -0
  328. package/src/locales/pt-BR.ts +97 -0
  329. package/src/locales/pt.ts +97 -0
  330. package/src/locales/ro.ts +97 -0
  331. package/src/locales/ru.ts +97 -0
  332. package/src/locales/sk.ts +98 -0
  333. package/src/locales/sr-Cyrl-RS.ts +97 -0
  334. package/src/locales/sr-Latn-RS.ts +97 -0
  335. package/src/locales/sv.ts +97 -0
  336. package/src/locales/tr.ts +97 -0
  337. package/src/locales/uk.ts +97 -0
  338. package/src/locales/vi.ts +97 -0
  339. package/src/locales/zh-Hans.ts +96 -0
  340. package/src/locales/zh-Hant.ts +96 -0
  341. package/src/types.ts +1314 -0
  342. package/src/utils/cell.utils.ts +234 -0
  343. package/src/utils/column.utils.ts +204 -0
  344. package/src/utils/displayColumn.utils.ts +152 -0
  345. package/src/utils/row.utils.ts +258 -0
  346. package/src/utils/style.utils.ts +211 -0
  347. package/src/utils/tanstack.helpers.ts +64 -0
  348. package/src/utils/utils.ts +34 -0
  349. package/src/utils/virtualization.utils.ts +24 -0
@@ -0,0 +1,182 @@
1
+ ---
2
+ name: localization
3
+ description: >
4
+ Translate Material React Table V4 with the localization option: import a built-in locale from @lminii/material-react-table/locales/<code>, override individual MRT_Localization strings, write a full custom locale with the language BCP 47 tag, keep {column} placeholders, and pair it with Material UI theme locales and the date pickers adapterLocale. Load for i18n, translating toolbar and menu text, number formatting in pagination, or a locale import that fails to resolve.
5
+ metadata:
6
+ type: framework
7
+ library: '@lminii/material-react-table'
8
+ library_version: '4.0.0'
9
+ framework: react
10
+ requires:
11
+ - getting-started
12
+ sources:
13
+ - 'lminii/material-react-table:apps/material-react-table-docs/pages/docs/guides/localization.mdx'
14
+ - 'lminii/material-react-table:apps/material-react-table-docs/examples/localization-i18n-de/sandbox/src/TS.tsx'
15
+ - 'lminii/material-react-table:packages/material-react-table/src/locales/en.ts'
16
+ - 'lminii/material-react-table:packages/material-react-table/src/hooks/useMRT_TableOptions.ts'
17
+ - 'lminii/material-react-table:packages/material-react-table/src/types.ts'
18
+ ---
19
+
20
+ This skill builds on `getting-started`. Every user-facing string MRT renders comes from one `MRT_Localization` object. The `localization` option takes a partial object that is merged over the English defaults, so a locale file or a handful of overrides both work.
21
+
22
+ ## Setup
23
+
24
+ ```tsx
25
+ import { MRT_Localization_DE } from '@lminii/material-react-table/locales/de'
26
+
27
+ const table = useMaterialReactTable({
28
+ columns,
29
+ data,
30
+ localization: MRT_Localization_DE,
31
+ })
32
+ ```
33
+
34
+ Built-in locales, imported from `@lminii/material-react-table/locales/<code>`: `ar`, `az`, `bg`, `cs`, `da`, `de`, `el`, `en`, `es`, `et`, `fa`, `fi`, `fr`, `he`, `hr`, `hu`, `hy`, `id`, `it`, `ja`, `ko`, `mk`, `nl`, `no`, `np`, `pl`, `pt`, `pt-BR`, `ro`, `ru`, `sk`, `sr-Cyrl-RS`, `sr-Latn-RS`, `sv`, `tr`, `uk`, `vi`, `zh-Hans`, `zh-Hant`. Each exports `MRT_Localization_<CODE>` with hyphens replaced by underscores, for example `MRT_Localization_PT_BR` and `MRT_Localization_ZH_HANS`. Column headers, cell content, and your own toolbar buttons are not translated by MRT; those come from your column definitions and render slots.
35
+
36
+ ## Core Patterns
37
+
38
+ ### Override a few strings
39
+
40
+ ```tsx
41
+ const table = useMaterialReactTable({
42
+ columns,
43
+ data,
44
+ localization: {
45
+ ...MRT_Localization_DE,
46
+ noRecordsToDisplay: 'Keine Personen gefunden',
47
+ rowsPerPage: 'Personen pro Seite',
48
+ },
49
+ })
50
+ ```
51
+
52
+ Partial objects are merged over English, so an override object without a base locale still renders every other string. Keep the `localization` object stable (module scope or `useMemo`); MRT memoizes the merge on its identity.
53
+
54
+ ### Write a custom locale
55
+
56
+ ```tsx
57
+ import { type MRT_Localization } from '@lminii/material-react-table'
58
+
59
+ export const MRT_Localization_GA: MRT_Localization = {
60
+ ...MRT_Localization_EN, // start from English so nothing is missing
61
+ language: 'ga', // BCP 47 tag used for number formatting
62
+ actions: 'Gníomhartha',
63
+ filterByColumn: 'Scag de réir {column}',
64
+ sortByColumnAsc: 'Sórtáil de réir {column} in ord ardaitheach',
65
+ noRecordsToDisplay: 'Níl aon taifid le taispeáint',
66
+ }
67
+ ```
68
+
69
+ `MRT_Localization` has around 90 keys; `language` is required on the type and feeds `toLocaleString` for the row counts in pagination and the selection banner. Strings such as `filterByColumn`, `sortByColumnAsc`, `dropToGroupBy`, and `filteringByColumn` contain `{column}` placeholders that MRT replaces with the column header, so keep the token verbatim. Fully translated locales are welcome as pull requests to `packages/material-react-table/src/locales`.
70
+
71
+ ### Pair with Material UI and the date pickers
72
+
73
+ ```tsx
74
+ import { createTheme, ThemeProvider, useTheme } from '@mui/material'
75
+ import { deDE } from '@mui/material/locale'
76
+ import { LocalizationProvider } from '@mui/x-date-pickers/LocalizationProvider'
77
+ import { AdapterDayjs } from '@mui/x-date-pickers/AdapterDayjs'
78
+ import { deDE as pickersDeDE } from '@mui/x-date-pickers/locales'
79
+ import 'dayjs/locale/de'
80
+
81
+ const theme = useTheme()
82
+
83
+ <ThemeProvider theme={createTheme(theme, deDE, pickersDeDE)}>
84
+ <LocalizationProvider dateAdapter={AdapterDayjs} adapterLocale="de">
85
+ <MaterialReactTable table={table} />
86
+ </LocalizationProvider>
87
+ </ThemeProvider>
88
+ ```
89
+
90
+ MRT's `localization` covers MRT strings only. Material UI's own component text (pagination select labels, accessibility labels) comes from the theme locale, and the date and time filter pickers take their month names and formats from the pickers locale and `adapterLocale`.
91
+
92
+ ### Switch locales at runtime
93
+
94
+ ```tsx
95
+ const locales = { en: MRT_Localization_EN, de: MRT_Localization_DE, ja: MRT_Localization_JA }
96
+
97
+ const table = useMaterialReactTable({
98
+ columns,
99
+ data,
100
+ localization: locales[currentLanguage],
101
+ })
102
+ ```
103
+
104
+ The table re-renders with the new strings; no state is reset.
105
+
106
+ ## Common Mistakes
107
+
108
+ ### HIGH Importing a locale from the upstream package name
109
+
110
+ Wrong:
111
+
112
+ ```tsx
113
+ import { MRT_Localization_ES } from 'material-react-table/locales/es'
114
+ ```
115
+
116
+ Correct:
117
+
118
+ ```tsx
119
+ import { MRT_Localization_ES } from '@lminii/material-react-table/locales/es'
120
+ ```
121
+
122
+ The fork publishes locales under its own `exports` map. The upstream path resolves only if the upstream package is also installed, which produces two copies of MRT.
123
+
124
+ Source: `MIGRATION.md`
125
+
126
+ ### MEDIUM Custom locale without the language tag
127
+
128
+ Wrong:
129
+
130
+ ```tsx
131
+ localization: { actions: 'Ações', cancel: 'Cancelar', rowsPerPage: 'Linhas por página' }
132
+ ```
133
+
134
+ Correct:
135
+
136
+ ```tsx
137
+ localization: { language: 'pt', actions: 'Ações', cancel: 'Cancelar', rowsPerPage: 'Linhas por página' }
138
+ ```
139
+
140
+ Without `language`, the English `en` tag from the merged defaults formats row counts, so `1.234` renders as `1,234`.
141
+
142
+ Source: `packages/material-react-table/src/locales/en.ts`
143
+
144
+ ### MEDIUM Dropping the {column} placeholder
145
+
146
+ Wrong:
147
+
148
+ ```tsx
149
+ localization: { filterByColumn: 'Filtrer' }
150
+ ```
151
+
152
+ Correct:
153
+
154
+ ```tsx
155
+ localization: { filterByColumn: 'Filtrer par {column}' }
156
+ ```
157
+
158
+ MRT substitutes the header into `{column}`; without it the tooltip and placeholder no longer say which column they apply to.
159
+
160
+ Source: `packages/material-react-table/src/locales/en.ts`
161
+
162
+ ### LOW Passing an unstable localization object
163
+
164
+ Wrong:
165
+
166
+ ```tsx
167
+ localization: { ...MRT_Localization_FR, noRecordsToDisplay: t('empty') }, // new object each render
168
+ ```
169
+
170
+ Correct:
171
+
172
+ ```tsx
173
+ const localization = useMemo(() => ({ ...MRT_Localization_FR, noRecordsToDisplay: t('empty') }), [t])
174
+ ```
175
+
176
+ A fresh object every render re-runs the merge and invalidates the memoized table options.
177
+
178
+ Source: `packages/material-react-table/src/hooks/useMRT_TableOptions.ts`
179
+
180
+ ## API Discovery
181
+
182
+ `MRT_Localization` in `node_modules/@lminii/material-react-table/dist/index.d.ts` lists every key; `en.ts` in `packages/material-react-table/src/locales` is the reference translation. `ls node_modules/@lminii/material-react-table/locales` shows the shipped locale folders. The Localization guide at `/docs/guides/localization` renders an example per locale.
@@ -0,0 +1,161 @@
1
+ ---
2
+ name: migrate-v3-to-v4
3
+ description: >
4
+ Migrate an application from material-react-table V3 to @lminii/material-react-table V4: switch the package and imports, upgrade Material UI and X Date Pickers to V9, move text field props to slotProps, and apply every TanStack Table V9 rename and behaviour change (column pinning start/end, columnResizing, sortFn, getPaginatedRowModel, rowSelection true values, removed getCoreRowModel options and onStateChange). Load for migration plans, implementation, or audits of a V3 codebase.
5
+ metadata:
6
+ type: lifecycle
7
+ library: '@lminii/material-react-table'
8
+ library_version: '4.0.0'
9
+ framework: react
10
+ requires:
11
+ - getting-started
12
+ sources:
13
+ - 'lminii/material-react-table:MIGRATION.md'
14
+ - 'lminii/material-react-table:apps/material-react-table-docs/pages/docs/getting-started/migrating-to-v4.mdx'
15
+ - 'lminii/material-react-table:packages/material-react-table/src/types.ts'
16
+ - 'lminii/material-react-table:packages/material-react-table/src/hooks/useMRT_TableOptions.ts'
17
+ ---
18
+
19
+ This skill builds on `getting-started`. V4 keeps the V3 API: `useMaterialReactTable`, the `table` prop, every `mui*Props`, `render*`, and `enable*` option. Breaking changes come from three sources only: the package rename, Material UI V9, and TanStack Table V9. Do them in that order.
20
+
21
+ ## Setup
22
+
23
+ ```bash
24
+ npx @mui/codemod@latest v9.0.0/system-props src
25
+ npx @mui/codemod@latest deprecations/all src
26
+ npm uninstall material-react-table
27
+ npm install @lminii/material-react-table @mui/material@^9 @mui/icons-material@^9 @mui/x-date-pickers@^9
28
+ ```
29
+
30
+ Then rewrite imports:
31
+
32
+ ```diff
33
+ -import { MaterialReactTable } from 'material-react-table';
34
+ -import { MRT_Localization_DE } from 'material-react-table/locales/de';
35
+ +import { MaterialReactTable } from '@lminii/material-react-table';
36
+ +import { MRT_Localization_DE } from '@lminii/material-react-table/locales/de';
37
+ ```
38
+
39
+ Peer floors are `@mui/material`, `@mui/icons-material`, and `@mui/x-date-pickers` at 9.0 or newer; React 18 and Emotion 11.13 are unchanged. Node 22.12 or newer is required for the CommonJS build.
40
+
41
+ ## Core Patterns
42
+
43
+ ### Renames from TanStack Table V9
44
+
45
+ Each of these is a find and replace across the codebase:
46
+
47
+ | V3 | V4 |
48
+ | --- | --- |
49
+ | `columnPinning: { left, right }` | `columnPinning: { start, end }` |
50
+ | `column.pin('left')`, `getIsPinned() === 'left'` | `column.pin('start')`, `getIsPinned() === 'start'` |
51
+ | `table.getLeftLeafColumns()`, `getRight*`, `row.getLeftVisibleCells()` | `getStartLeafColumns()`, `getEnd*`, `row.getStartVisibleCells()` |
52
+ | `columnSizingInfo`, `onColumnSizingInfoChange`, `setColumnSizingInfo` | `columnResizing`, `onColumnResizingChange`, `setColumnResizing` |
53
+ | `sortingFn`, `sortingFns`, `column.getSortingFn()` | `sortFn`, `sortFns`, `column.getSortFn()` |
54
+ | `table.getPrePaginationRowModel()`, `getPaginationRowModel()` | `getPrePaginatedRowModel()`, `getPaginatedRowModel()` |
55
+ | `column.getAggregationFn()` | `column.getAggregationFns()` |
56
+ | `MRT_SortingFn`, `MRT_ColumnSizingInfoState` | `MRT_SortFn`, `MRT_ColumnResizingState` (old names remain as deprecated aliases) |
57
+
58
+ ### Behaviour changes to audit
59
+
60
+ - `rowSelection` values are `true`, never `false`. Deselect by deleting the key.
61
+ - `rowPinning` needs both `top` and `bottom`; `columnPinning` needs both `start` and `end` when passed through `initialState` or `state`.
62
+ - `table.getIsSomeRowsSelected()` is `true` when all rows are selected. Indeterminate is `getIsSomeRowsSelected() && !getIsAllRowsSelected()`.
63
+ - A custom `aggregationFn` is `{ aggregate: (context) => value }`, not a callable. Built-in names still work.
64
+ - `getCoreRowModel`, `getFilteredRowModel`, `getSortedRowModel`, `getPaginationRowModel`, `getExpandedRowModel`, `getGroupedRowModel`, and `getFaceted*` options are gone; the models are always registered. Use `manual*` to take over a stage.
65
+ - Rows with `renderDetailPanel` report `row.getCanExpand()` as `true`. Pass `getRowCanExpand` to restrict it.
66
+ - `onStateChange` and `table.setState()` are gone. Control slices individually.
67
+ - `table.getState()` still returns the full state; `table.state` is reactive in render code.
68
+ - Pinned cells use `insetInlineStart` and `insetInlineEnd`, so RTL pins to the logical start and end.
69
+
70
+ ### Material UI V9 changes inside MRT options
71
+
72
+ ```diff
73
+ muiFilterTextFieldProps: {
74
+ - InputProps: { sx: { minWidth: 120 } },
75
+ + slotProps: { input: { sx: { minWidth: 120 } } },
76
+ },
77
+ -const pickerProps: DatePickerProps<Dayjs> = { ... };
78
+ +const pickerProps: DatePickerProps = { ... };
79
+ ```
80
+
81
+ `muiFilterDatePickerProps`, `muiFilterDateTimePickerProps`, and `muiFilterTimePickerProps` are no longer generic, and the filter pickers render `PickersTextField`, so a custom `slots.textField` must accept `PickersTextFieldProps`. Everything else in `mui*Props` passes straight to Material UI, so Material UI's own V7 and V9 notes apply.
82
+
83
+ ### Package entry points
84
+
85
+ The package ships an `exports` map with `.mjs` and `.js` builds. Only `@lminii/material-react-table`, `@lminii/material-react-table/locales/<code>`, and `@lminii/material-react-table/package.json` resolve; deep imports into `dist/` or `src/` fail at build time and must be replaced with root exports.
86
+
87
+ ## Common Mistakes
88
+
89
+ ### HIGH Keeping v8 pinning literals
90
+
91
+ Wrong:
92
+
93
+ ```tsx
94
+ initialState: { columnPinning: { left: ['mrt-row-select'], right: ['mrt-row-actions'] } }
95
+ ```
96
+
97
+ Correct:
98
+
99
+ ```tsx
100
+ initialState: { columnPinning: { start: ['mrt-row-select'], end: ['mrt-row-actions'] } }
101
+ ```
102
+
103
+ `left` and `right` are no longer valid keys, so the pinning state is silently empty.
104
+
105
+ Source: `MIGRATION.md`
106
+
107
+ ### HIGH Passing row model factories
108
+
109
+ Wrong:
110
+
111
+ ```tsx
112
+ useMaterialReactTable({ columns, data, getSortedRowModel: getSortedRowModel() })
113
+ ```
114
+
115
+ Correct:
116
+
117
+ ```tsx
118
+ useMaterialReactTable({ columns, data })
119
+ ```
120
+
121
+ The options no longer exist in `MRT_TableOptions`; MRT registers every row model itself.
122
+
123
+ Source: `packages/material-react-table/src/features/mrtFeatures.ts`
124
+
125
+ ### MEDIUM Treating the migration as a TanStack useTable rewrite
126
+
127
+ Wrong:
128
+
129
+ ```tsx
130
+ const table = useTable({ features: tableFeatures({ rowSortingFeature }), columns, data })
131
+ ```
132
+
133
+ Correct:
134
+
135
+ ```tsx
136
+ const table = useMaterialReactTable({ columns, data })
137
+ ```
138
+
139
+ The `@tanstack/react-table#migrate-v8-to-v9` skill describes migrating a headless table. MRT applications stay on `useMaterialReactTable`; only the renamed instance methods and state shapes from that skill apply.
140
+
141
+ Source: `MIGRATION.md`
142
+
143
+ ### LOW Deep-importing a locale file
144
+
145
+ Wrong:
146
+
147
+ ```tsx
148
+ import { MRT_Localization_FR } from '@lminii/material-react-table/dist/locales/fr'
149
+ ```
150
+
151
+ Correct:
152
+
153
+ ```tsx
154
+ import { MRT_Localization_FR } from '@lminii/material-react-table/locales/fr'
155
+ ```
156
+
157
+ Source: `packages/material-react-table/package.json` exports map
158
+
159
+ ## API Discovery
160
+
161
+ Compare `node_modules/@lminii/material-react-table/dist/index.d.ts` against the V3 declarations for renamed members; the deprecated `MRT_SortingFn` and `MRT_ColumnSizingInfoState` aliases carry JSDoc pointing to the new names. The full guide with tables is at `/docs/getting-started/migrating-to-v4`.
@@ -0,0 +1,200 @@
1
+ ---
2
+ name: state-and-server-data
3
+ description: >
4
+ Control Material React Table V4 state with initialState, the state option plus on*Change callbacks, MRT_Updater handlers, table.getState and table.state, and move filtering, sorting, pagination, grouping, or expanding to the server with manual* options and rowCount. Load for controlled tables, persisted state, side effects on state change, TanStack Query integration, or infinite scrolling.
5
+ metadata:
6
+ type: framework
7
+ library: '@lminii/material-react-table'
8
+ library_version: '4.0.0'
9
+ framework: react
10
+ requires:
11
+ - getting-started
12
+ - '@tanstack/table-core#client-vs-server'
13
+ sources:
14
+ - 'lminii/material-react-table:apps/material-react-table-docs/pages/docs/guides/state-management.mdx'
15
+ - 'lminii/material-react-table:apps/material-react-table-docs/pages/docs/guides/pagination.mdx'
16
+ - 'lminii/material-react-table:apps/material-react-table-docs/pages/docs/guides/async-loading.mdx'
17
+ - 'lminii/material-react-table:apps/material-react-table-docs/examples/react-query/sandbox/src/TS.tsx'
18
+ - 'lminii/material-react-table:packages/material-react-table/src/types.ts'
19
+ ---
20
+
21
+ This skill builds on `getting-started` and `@tanstack/table-core#client-vs-server`. MRT manages every state slice internally by default. Take over only the slices you need to read or persist, and only through the `state` option paired with the matching `on*Change` callback.
22
+
23
+ ## Setup
24
+
25
+ ```tsx
26
+ const [pagination, setPagination] = useState<MRT_PaginationState>({ pageIndex: 0, pageSize: 25 })
27
+ const [sorting, setSorting] = useState<MRT_SortingState>([])
28
+
29
+ const table = useMaterialReactTable({
30
+ columns,
31
+ data,
32
+ initialState: { density: 'compact', showColumnFilters: true },
33
+ state: { pagination, sorting },
34
+ onPaginationChange: setPagination,
35
+ onSortingChange: setSorting,
36
+ })
37
+ ```
38
+
39
+ `initialState` seeds slices MRT keeps managing. `state` hands a slice over to you; from then on MRT calls `on<Slice>Change` and reads only what you pass back. Do not put the same slice in both.
40
+
41
+ ## Core Patterns
42
+
43
+ ### Handle updaters like React setState
44
+
45
+ ```tsx
46
+ import { type MRT_Updater, type MRT_RowSelectionState } from '@lminii/material-react-table'
47
+
48
+ const handleRowSelectionChange = (updater: MRT_Updater<MRT_RowSelectionState>) => {
49
+ setRowSelection((previous) => {
50
+ const next = updater instanceof Function ? updater(previous) : updater
51
+ onSelectionChanged(Object.keys(next)) // side effect runs once, even in Strict Mode
52
+ return next
53
+ })
54
+ }
55
+ ```
56
+
57
+ Callbacks receive either a value or an updater function, exactly like `useState`. Use `getRowId` so selection keys are stable ids instead of row indexes.
58
+
59
+ ### Server-side data with manual* options
60
+
61
+ ```tsx
62
+ const { data: page, isLoading, isError, isRefetching } = useQuery({
63
+ queryKey: ['people', pagination, sorting, columnFilters, globalFilter],
64
+ queryFn: () => fetchPeople({ pagination, sorting, columnFilters, globalFilter }),
65
+ placeholderData: keepPreviousData,
66
+ })
67
+
68
+ const table = useMaterialReactTable({
69
+ columns,
70
+ data: page?.rows ?? EMPTY,
71
+ rowCount: page?.total ?? 0,
72
+ manualFiltering: true,
73
+ manualPagination: true,
74
+ manualSorting: true,
75
+ state: { pagination, sorting, columnFilters, globalFilter, isLoading, showAlertBanner: isError, showProgressBars: isRefetching },
76
+ onPaginationChange: setPagination,
77
+ onSortingChange: setSorting,
78
+ onColumnFiltersChange: setColumnFilters,
79
+ onGlobalFilterChange: setGlobalFilter,
80
+ muiToolbarAlertBannerProps: isError ? { color: 'error', children: 'Error loading data' } : undefined,
81
+ })
82
+ ```
83
+
84
+ Each `manual*` option tells MRT that stage already happened on the server, so the client row model passes rows through. `rowCount` (or `pageCount`) drives the pagination controls. `isLoading`, `showProgressBars`, `showSkeletons`, and `showLoadingOverlay` are MRT state slices meant to be set from fetch status.
85
+
86
+ ### Read state without controlling it
87
+
88
+ ```tsx
89
+ const table = useMaterialReactTable({ columns, data })
90
+
91
+ <Button onClick={() => save(table.getState().columnVisibility)}>Save layout</Button>
92
+ ```
93
+
94
+ `table.getState()` returns the complete state, including MRT-only slices such as `density`, `isFullScreen`, `showColumnFilters`, `editingRow`, and `creatingRow`. In render code `table.state` is reactive. Setters such as `table.setPagination`, `table.resetSorting`, `table.setShowColumnFilters`, and `table.setDensity` exist for every slice.
95
+
96
+ ### Persist state
97
+
98
+ ```tsx
99
+ const [columnVisibility, setColumnVisibility] = useState<MRT_VisibilityState>(
100
+ () => JSON.parse(localStorage.getItem('people-columns') ?? '{}'),
101
+ )
102
+ useEffect(() => {
103
+ localStorage.setItem('people-columns', JSON.stringify(columnVisibility))
104
+ }, [columnVisibility])
105
+
106
+ const table = useMaterialReactTable({
107
+ columns,
108
+ data,
109
+ state: { columnVisibility },
110
+ onColumnVisibilityChange: setColumnVisibility,
111
+ })
112
+ ```
113
+
114
+ ## Common Mistakes
115
+
116
+ ### HIGH Passing on*Change without state
117
+
118
+ Wrong:
119
+
120
+ ```tsx
121
+ const table = useMaterialReactTable({ columns, data, onSortingChange: setSorting })
122
+ ```
123
+
124
+ Correct:
125
+
126
+ ```tsx
127
+ const table = useMaterialReactTable({
128
+ columns,
129
+ data,
130
+ state: { sorting },
131
+ onSortingChange: setSorting,
132
+ })
133
+ ```
134
+
135
+ Once a callback is supplied, MRT stops updating that slice itself. Without `state`, the table never sorts.
136
+
137
+ Source: `docs/guides/state-management.mdx`
138
+
139
+ ### HIGH Toggling row selection with false
140
+
141
+ Wrong:
142
+
143
+ ```tsx
144
+ setRowSelection((old) => ({ ...old, [id]: false }))
145
+ ```
146
+
147
+ Correct:
148
+
149
+ ```tsx
150
+ setRowSelection(({ [id]: _removed, ...rest }) => rest)
151
+ ```
152
+
153
+ TanStack Table V9 types `rowSelection` as `Record<string, true>`, so a `false` entry is a type error; absence of the key is the only deselected state.
154
+
155
+ Source: `MIGRATION.md`
156
+
157
+ ### MEDIUM Using onStateChange or table.setState
158
+
159
+ Wrong:
160
+
161
+ ```tsx
162
+ onStateChange: (updater) => setTableState(updater)
163
+ ```
164
+
165
+ Correct:
166
+
167
+ ```tsx
168
+ state: { pagination, sorting },
169
+ onPaginationChange: setPagination,
170
+ onSortingChange: setSorting,
171
+ ```
172
+
173
+ `onStateChange` and `table.setState` were removed with TanStack Table V9. Control slices individually.
174
+
175
+ Source: `MIGRATION.md`
176
+
177
+ ### MEDIUM Forgetting rowCount with manualPagination
178
+
179
+ Wrong:
180
+
181
+ ```tsx
182
+ manualPagination: true,
183
+ data: page.rows,
184
+ ```
185
+
186
+ Correct:
187
+
188
+ ```tsx
189
+ manualPagination: true,
190
+ data: page.rows,
191
+ rowCount: page.total,
192
+ ```
193
+
194
+ Without a total, MRT assumes the current page is all the data and disables the next page button.
195
+
196
+ Source: `docs/guides/pagination.mdx`
197
+
198
+ ## API Discovery
199
+
200
+ `MRT_TableState` in `node_modules/@lminii/material-react-table/dist/index.d.ts` lists every slice; each has an `on<Slice>Change` option and `table.set<Slice>` method. The State Options table at `/docs/api/state-options` shows defaults, and the `manual*` and `rowCount` options are in `/docs/api/table-options`.