@jsudc/react 0.0.0-stage → 0.2.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 (328) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +555 -2
  3. package/dist/all.d.ts +9 -0
  4. package/dist/all.js +14 -0
  5. package/dist/all.js.map +1 -0
  6. package/dist/calendar/CalendarRenderer.d.ts +9 -0
  7. package/dist/calendar/CalendarRenderer.js +314 -0
  8. package/dist/calendar/CalendarRenderer.js.map +1 -0
  9. package/dist/calendar/EventBlock.d.ts +16 -0
  10. package/dist/calendar/EventBlock.js +57 -0
  11. package/dist/calendar/EventBlock.js.map +1 -0
  12. package/dist/calendar/EventDetail.d.ts +20 -0
  13. package/dist/calendar/EventDetail.js +186 -0
  14. package/dist/calendar/EventDetail.js.map +1 -0
  15. package/dist/calendar/MonthGrid.d.ts +19 -0
  16. package/dist/calendar/MonthGrid.js +121 -0
  17. package/dist/calendar/MonthGrid.js.map +1 -0
  18. package/dist/calendar/TimeGrid.d.ts +24 -0
  19. package/dist/calendar/TimeGrid.js +331 -0
  20. package/dist/calendar/TimeGrid.js.map +1 -0
  21. package/dist/calendar/index.d.ts +4 -0
  22. package/dist/calendar/model.d.ts +97 -0
  23. package/dist/calendar/model.js +279 -0
  24. package/dist/calendar/model.js.map +1 -0
  25. package/dist/calendar/useCalendarUrl.d.ts +13 -0
  26. package/dist/calendar/useCalendarUrl.js +35 -0
  27. package/dist/calendar/useCalendarUrl.js.map +1 -0
  28. package/dist/calendar.d.ts +1 -0
  29. package/dist/calendar.js +22 -0
  30. package/dist/calendar.js.map +1 -0
  31. package/dist/cards/CardRenderer.d.ts +24 -0
  32. package/dist/cards/CardRenderer.js +277 -0
  33. package/dist/cards/CardRenderer.js.map +1 -0
  34. package/dist/cards/cardModel.d.ts +48 -0
  35. package/dist/cards/cardModel.js +86 -0
  36. package/dist/cards/cardModel.js.map +1 -0
  37. package/dist/cards/index.d.ts +4 -0
  38. package/dist/cards.d.ts +1 -0
  39. package/dist/cards.js +15 -0
  40. package/dist/cards.js.map +1 -0
  41. package/dist/chart/ChartRenderer.d.ts +16 -0
  42. package/dist/chart/ChartRenderer.js +531 -0
  43. package/dist/chart/ChartRenderer.js.map +1 -0
  44. package/dist/chart/ChartWindowControl.d.ts +13 -0
  45. package/dist/chart/ChartWindowControl.js +103 -0
  46. package/dist/chart/ChartWindowControl.js.map +1 -0
  47. package/dist/chart/index.d.ts +7 -0
  48. package/dist/chart/model.d.ts +45 -0
  49. package/dist/chart/model.js +184 -0
  50. package/dist/chart/model.js.map +1 -0
  51. package/dist/chart/useChartWindow.d.ts +18 -0
  52. package/dist/chart/useChartWindow.js +70 -0
  53. package/dist/chart/useChartWindow.js.map +1 -0
  54. package/dist/chart/window.d.ts +50 -0
  55. package/dist/chart/window.js +133 -0
  56. package/dist/chart/window.js.map +1 -0
  57. package/dist/chart.d.ts +1 -0
  58. package/dist/chart.js +18 -0
  59. package/dist/chart.js.map +1 -0
  60. package/dist/components/ui/button.d.ts +21 -0
  61. package/dist/components/ui/button.js +30 -0
  62. package/dist/components/ui/button.js.map +1 -0
  63. package/dist/components/ui/checkbox.d.ts +2 -0
  64. package/dist/components/ui/checkbox.js +23 -0
  65. package/dist/components/ui/checkbox.js.map +1 -0
  66. package/dist/components/ui/dialog.d.ts +14 -0
  67. package/dist/components/ui/dialog.js +52 -0
  68. package/dist/components/ui/dialog.js.map +1 -0
  69. package/dist/components/ui/dropdown-menu.d.ts +12 -0
  70. package/dist/components/ui/dropdown-menu.js +35 -0
  71. package/dist/components/ui/dropdown-menu.js.map +1 -0
  72. package/dist/components/ui/input.d.ts +4 -0
  73. package/dist/components/ui/input.js +24 -0
  74. package/dist/components/ui/input.js.map +1 -0
  75. package/dist/components/ui/misc.d.ts +6 -0
  76. package/dist/components/ui/misc.js +24 -0
  77. package/dist/components/ui/misc.js.map +1 -0
  78. package/dist/components/ui/popover.d.ts +6 -0
  79. package/dist/components/ui/popover.js +21 -0
  80. package/dist/components/ui/popover.js.map +1 -0
  81. package/dist/components/ui/segmented.d.ts +11 -0
  82. package/dist/components/ui/segmented.js +35 -0
  83. package/dist/components/ui/segmented.js.map +1 -0
  84. package/dist/components/ui/select.d.ts +12 -0
  85. package/dist/components/ui/select.js +39 -0
  86. package/dist/components/ui/select.js.map +1 -0
  87. package/dist/components/ui/toast.d.ts +10 -0
  88. package/dist/components/ui/toast.js +72 -0
  89. package/dist/components/ui/toast.js.map +1 -0
  90. package/dist/components/ui/tooltip.d.ts +9 -0
  91. package/dist/components/ui/tooltip.js +19 -0
  92. package/dist/components/ui/tooltip.js.map +1 -0
  93. package/dist/data-view/DocTab.d.ts +8 -0
  94. package/dist/data-view/DocTab.js +26 -0
  95. package/dist/data-view/DocTab.js.map +1 -0
  96. package/dist/data-view/FilePreview.d.ts +10 -0
  97. package/dist/data-view/FilePreview.js +71 -0
  98. package/dist/data-view/FilePreview.js.map +1 -0
  99. package/dist/data-view/FilterBuilder.d.ts +26 -0
  100. package/dist/data-view/FilterBuilder.js +349 -0
  101. package/dist/data-view/FilterBuilder.js.map +1 -0
  102. package/dist/data-view/FilterChips.d.ts +12 -0
  103. package/dist/data-view/FilterChips.js +296 -0
  104. package/dist/data-view/FilterChips.js.map +1 -0
  105. package/dist/data-view/FolderBar.d.ts +5 -0
  106. package/dist/data-view/FolderBar.js +46 -0
  107. package/dist/data-view/FolderBar.js.map +1 -0
  108. package/dist/data-view/FolderEntry.d.ts +13 -0
  109. package/dist/data-view/FolderEntry.js +37 -0
  110. package/dist/data-view/FolderEntry.js.map +1 -0
  111. package/dist/data-view/Freshness.d.ts +18 -0
  112. package/dist/data-view/Freshness.js +87 -0
  113. package/dist/data-view/Freshness.js.map +1 -0
  114. package/dist/data-view/SearchBox.d.ts +7 -0
  115. package/dist/data-view/SearchBox.js +65 -0
  116. package/dist/data-view/SearchBox.js.map +1 -0
  117. package/dist/data-view/SourceTab.d.ts +9 -0
  118. package/dist/data-view/SourceTab.js +104 -0
  119. package/dist/data-view/SourceTab.js.map +1 -0
  120. package/dist/data-view/UdcDataView.d.ts +12 -0
  121. package/dist/data-view/UdcDataView.js +365 -0
  122. package/dist/data-view/UdcDataView.js.map +1 -0
  123. package/dist/data-view/compose.d.ts +24 -0
  124. package/dist/data-view/compose.js +86 -0
  125. package/dist/data-view/compose.js.map +1 -0
  126. package/dist/data-view/folder.d.ts +13 -0
  127. package/dist/data-view/folder.js +52 -0
  128. package/dist/data-view/folder.js.map +1 -0
  129. package/dist/data-view/liveView.d.ts +20 -0
  130. package/dist/data-view/liveView.js +67 -0
  131. package/dist/data-view/liveView.js.map +1 -0
  132. package/dist/data-view/urlState.d.ts +44 -0
  133. package/dist/data-view/urlState.js +139 -0
  134. package/dist/data-view/urlState.js.map +1 -0
  135. package/dist/data-view/useDataViewState.d.ts +39 -0
  136. package/dist/data-view/useDataViewState.js +79 -0
  137. package/dist/data-view/useDataViewState.js.map +1 -0
  138. package/dist/headless.d.ts +31 -0
  139. package/dist/headless.js +31 -0
  140. package/dist/i18n/i18n.d.ts +71 -0
  141. package/dist/i18n/i18n.js +151 -0
  142. package/dist/i18n/i18n.js.map +1 -0
  143. package/dist/i18n/translations.d.ts +16 -0
  144. package/dist/i18n/translations.js +967 -0
  145. package/dist/i18n/translations.js.map +1 -0
  146. package/dist/icons/lucide.generated.d.ts +2 -0
  147. package/dist/icons/lucide.generated.js +32 -0
  148. package/dist/icons/lucide.generated.js.map +1 -0
  149. package/dist/icons/resolve.d.ts +9 -0
  150. package/dist/icons/resolve.js +25 -0
  151. package/dist/icons/resolve.js.map +1 -0
  152. package/dist/index.d.ts +19 -0
  153. package/dist/index.js +23 -0
  154. package/dist/kanban/CardDetailDialog.d.ts +17 -0
  155. package/dist/kanban/CardDetailDialog.js +53 -0
  156. package/dist/kanban/CardDetailDialog.js.map +1 -0
  157. package/dist/kanban/KanbanBoardSwitcher.d.ts +6 -0
  158. package/dist/kanban/KanbanBoardSwitcher.js +27 -0
  159. package/dist/kanban/KanbanBoardSwitcher.js.map +1 -0
  160. package/dist/kanban/KanbanCard.d.ts +21 -0
  161. package/dist/kanban/KanbanCard.js +189 -0
  162. package/dist/kanban/KanbanCard.js.map +1 -0
  163. package/dist/kanban/KanbanColumn.d.ts +30 -0
  164. package/dist/kanban/KanbanColumn.js +228 -0
  165. package/dist/kanban/KanbanColumn.js.map +1 -0
  166. package/dist/kanban/KanbanRenderer.d.ts +3 -0
  167. package/dist/kanban/KanbanRenderer.js +472 -0
  168. package/dist/kanban/KanbanRenderer.js.map +1 -0
  169. package/dist/kanban/index.d.ts +5 -0
  170. package/dist/kanban/model.d.ts +89 -0
  171. package/dist/kanban/model.js +159 -0
  172. package/dist/kanban/model.js.map +1 -0
  173. package/dist/kanban/persist.d.ts +27 -0
  174. package/dist/kanban/persist.js +54 -0
  175. package/dist/kanban/persist.js.map +1 -0
  176. package/dist/kanban/useKanbanBoard.d.ts +21 -0
  177. package/dist/kanban/useKanbanBoard.js +47 -0
  178. package/dist/kanban/useKanbanBoard.js.map +1 -0
  179. package/dist/kanban.d.ts +1 -0
  180. package/dist/kanban.js +17 -0
  181. package/dist/kanban.js.map +1 -0
  182. package/dist/lib/storage.d.ts +7 -0
  183. package/dist/lib/storage.js +24 -0
  184. package/dist/lib/storage.js.map +1 -0
  185. package/dist/lib/theme.d.ts +11 -0
  186. package/dist/lib/theme.js +43 -0
  187. package/dist/lib/theme.js.map +1 -0
  188. package/dist/lib/utils.d.ts +4 -0
  189. package/dist/lib/utils.js +12 -0
  190. package/dist/lib/utils.js.map +1 -0
  191. package/dist/map/MapRenderer.d.ts +13 -0
  192. package/dist/map/MapRenderer.js +405 -0
  193. package/dist/map/MapRenderer.js.map +1 -0
  194. package/dist/map/index.d.ts +4 -0
  195. package/dist/map/model.d.ts +68 -0
  196. package/dist/map/model.js +143 -0
  197. package/dist/map/model.js.map +1 -0
  198. package/dist/map.d.ts +1 -0
  199. package/dist/map.js +15 -0
  200. package/dist/map.js.map +1 -0
  201. package/dist/react-router/UdcReactRouterUrlState.d.ts +10 -0
  202. package/dist/react-router/UdcReactRouterUrlState.js +35 -0
  203. package/dist/react-router/UdcReactRouterUrlState.js.map +1 -0
  204. package/dist/react-router/index.d.ts +1 -0
  205. package/dist/react-router.d.ts +1 -0
  206. package/dist/react-router.js +1 -0
  207. package/dist/renderers/AllRowsStatus.d.ts +8 -0
  208. package/dist/renderers/AllRowsStatus.js +34 -0
  209. package/dist/renderers/AllRowsStatus.js.map +1 -0
  210. package/dist/renderers/context.d.ts +11 -0
  211. package/dist/renderers/context.js +15 -0
  212. package/dist/renderers/context.js.map +1 -0
  213. package/dist/renderers/registry.d.ts +25 -0
  214. package/dist/renderers/registry.js +40 -0
  215. package/dist/renderers/registry.js.map +1 -0
  216. package/dist/renderers/types.d.ts +90 -0
  217. package/dist/renderers/types.js +8 -0
  218. package/dist/renderers/types.js.map +1 -0
  219. package/dist/schema-editor/ColumnHeaderMenu.d.ts +11 -0
  220. package/dist/schema-editor/ColumnHeaderMenu.js +75 -0
  221. package/dist/schema-editor/ColumnHeaderMenu.js.map +1 -0
  222. package/dist/schema-editor/DeleteFieldDialog.d.ts +8 -0
  223. package/dist/schema-editor/DeleteFieldDialog.js +79 -0
  224. package/dist/schema-editor/DeleteFieldDialog.js.map +1 -0
  225. package/dist/schema-editor/FieldFormDialog.d.ts +22 -0
  226. package/dist/schema-editor/FieldFormDialog.js +312 -0
  227. package/dist/schema-editor/FieldFormDialog.js.map +1 -0
  228. package/dist/schema-editor/TagInput.d.ts +9 -0
  229. package/dist/schema-editor/TagInput.js +46 -0
  230. package/dist/schema-editor/TagInput.js.map +1 -0
  231. package/dist/schema-editor/fieldForm.d.ts +52 -0
  232. package/dist/schema-editor/fieldForm.js +132 -0
  233. package/dist/schema-editor/fieldForm.js.map +1 -0
  234. package/dist/schema-editor/index.d.ts +6 -0
  235. package/dist/schema-editor/useSchemaEditor.d.ts +15 -0
  236. package/dist/schema-editor/useSchemaEditor.js +87 -0
  237. package/dist/schema-editor/useSchemaEditor.js.map +1 -0
  238. package/dist/schema-editor.d.ts +1 -0
  239. package/dist/schema-editor.js +7 -0
  240. package/dist/styles.css +2 -0
  241. package/dist/table/CellEditor.d.ts +31 -0
  242. package/dist/table/CellEditor.js +145 -0
  243. package/dist/table/CellEditor.js.map +1 -0
  244. package/dist/table/Pager.d.ts +8 -0
  245. package/dist/table/Pager.js +90 -0
  246. package/dist/table/Pager.js.map +1 -0
  247. package/dist/table/TableRenderer.d.ts +27 -0
  248. package/dist/table/TableRenderer.js +458 -0
  249. package/dist/table/TableRenderer.js.map +1 -0
  250. package/dist/table/cells.d.ts +16 -0
  251. package/dist/table/cells.js +106 -0
  252. package/dist/table/cells.js.map +1 -0
  253. package/dist/table/format.d.ts +24 -0
  254. package/dist/table/format.js +117 -0
  255. package/dist/table/format.js.map +1 -0
  256. package/dist/table/index.d.ts +6 -0
  257. package/dist/table/sparkline.d.ts +31 -0
  258. package/dist/table/sparkline.js +105 -0
  259. package/dist/table/sparkline.js.map +1 -0
  260. package/dist/table/states.d.ts +17 -0
  261. package/dist/table/states.js +86 -0
  262. package/dist/table/states.js.map +1 -0
  263. package/dist/table/style.d.ts +15 -0
  264. package/dist/table/style.js +53 -0
  265. package/dist/table/style.js.map +1 -0
  266. package/dist/table/transforms.d.ts +17 -0
  267. package/dist/table/transforms.js +95 -0
  268. package/dist/table/transforms.js.map +1 -0
  269. package/dist/table/useInfiniteSentinel.d.ts +8 -0
  270. package/dist/table/useInfiniteSentinel.js +34 -0
  271. package/dist/table/useInfiniteSentinel.js.map +1 -0
  272. package/dist/table.d.ts +1 -0
  273. package/dist/table.js +18 -0
  274. package/dist/table.js.map +1 -0
  275. package/dist/time/timezone.d.ts +27 -0
  276. package/dist/time/timezone.js +65 -0
  277. package/dist/time/timezone.js.map +1 -0
  278. package/dist/time/zoned.d.ts +65 -0
  279. package/dist/time/zoned.js +208 -0
  280. package/dist/time/zoned.js.map +1 -0
  281. package/dist/tokens.css +457 -0
  282. package/dist/tree/TreeNode.d.ts +9 -0
  283. package/dist/tree/TreeNode.js +292 -0
  284. package/dist/tree/TreeNode.js.map +1 -0
  285. package/dist/tree/TreeRenderer.d.ts +54 -0
  286. package/dist/tree/TreeRenderer.js +446 -0
  287. package/dist/tree/TreeRenderer.js.map +1 -0
  288. package/dist/tree/expand.d.ts +31 -0
  289. package/dist/tree/expand.js +80 -0
  290. package/dist/tree/expand.js.map +1 -0
  291. package/dist/tree/index.d.ts +4 -0
  292. package/dist/tree/model.d.ts +108 -0
  293. package/dist/tree/model.js +294 -0
  294. package/dist/tree/model.js.map +1 -0
  295. package/dist/tree.d.ts +1 -0
  296. package/dist/tree.js +15 -0
  297. package/dist/tree.js.map +1 -0
  298. package/dist/udc/client.d.ts +11 -0
  299. package/dist/udc/client.js +30 -0
  300. package/dist/udc/client.js.map +1 -0
  301. package/dist/udc/hooks.d.ts +644 -0
  302. package/dist/udc/hooks.js +353 -0
  303. package/dist/udc/hooks.js.map +1 -0
  304. package/dist/udc/keys.d.ts +19 -0
  305. package/dist/udc/keys.js +30 -0
  306. package/dist/udc/keys.js.map +1 -0
  307. package/dist/udc/provider.d.ts +19 -0
  308. package/dist/udc/provider.js +29 -0
  309. package/dist/udc/provider.js.map +1 -0
  310. package/dist/ui-kit/context.d.ts +11 -0
  311. package/dist/ui-kit/context.js +19 -0
  312. package/dist/ui-kit/context.js.map +1 -0
  313. package/dist/ui-kit/default.d.ts +3 -0
  314. package/dist/ui-kit/default.js +45 -0
  315. package/dist/ui-kit/default.js.map +1 -0
  316. package/dist/ui-kit/index.d.ts +2 -0
  317. package/dist/ui-kit/types.d.ts +227 -0
  318. package/dist/ui-kit/ui.d.ts +12 -0
  319. package/dist/ui.d.ts +1 -0
  320. package/dist/ui.js +13 -0
  321. package/dist/url-state/UrlState.d.ts +20 -0
  322. package/dist/url-state/UrlState.js +27 -0
  323. package/dist/url-state/UrlState.js.map +1 -0
  324. package/dist/url-state/adapter.d.ts +24 -0
  325. package/dist/url-state/adapter.js +33 -0
  326. package/dist/url-state/adapter.js.map +1 -0
  327. package/dist/url-state/index.d.ts +2 -0
  328. package/package.json +185 -4
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 DigitalCube
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,556 @@
1
- # Temporary Holding Version
1
+ # @jsudc/react
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ [![npm](https://img.shields.io/npm/v/@jsudc/react)](https://www.npmjs.com/package/@jsudc/react)
4
+
5
+ React components for UDC (Universal Data Collection) collections. Give it a
6
+ collection name and `<UdcDataView>` asks a UDC server what the collection is
7
+ (`describe`) and draws it: search, filter chips and a filter builder, paging,
8
+ and one tab per renderer the view declares — **table**, **cards**, **kanban**,
9
+ **calendar**, **tree**, **map** and **chart** — with inline edits, drag and
10
+ drop, and a schema editor that adds, edits and deletes columns at runtime.
11
+
12
+ What is in the package:
13
+
14
+ - **`UdcProvider`** and **`createUdcQueryClient`**, and TanStack Query hooks over
15
+ the transport client of [`@jsudc/core`](https://github.com/digital-cube/jsudc-core)
16
+ (`useUdcCollections`, `useUdcDescribe`, `useUdcCollection`, `useUdcAllRows`,
17
+ `useUdcMutate`, `useUdcSchema`, `useUdcSource`);
18
+ - **`UdcDataView`** and **`createRendererRegistry`**; each renderer is a
19
+ subpath of its own (`@jsudc/react/table`, `/cards`, `/kanban`, `/calendar`,
20
+ `/tree`, `/map`, `/chart`), so a page bundles, and a host installs the peers
21
+ of, only the renderers it registers; `@jsudc/react/all` has them all
22
+ (see [Renderers](#renderers));
23
+ - **`@jsudc/react/headless`**: the hooks and every renderer's model without any
24
+ markup, for a host that draws its own (see [Headless](#headless));
25
+ - **`UdcI18nProvider`** + **`useI18n`**: the library's strings in English and
26
+ Serbian, with your own sections, overrides and locales layered over them;
27
+ - **`ThemeProvider`** + **`useTheme`** (light / dark), **`TimezoneProvider`**
28
+ (the zone instants are shown in);
29
+ - the UI primitives the renderers are built from (Radix + Tailwind, the shadcn
30
+ pattern): `Button`, `Input`, `Checkbox`, `Select`, `Dialog`, `DropdownMenu`,
31
+ `Popover`, `Tip`, `Segmented`, `Spinner`, `Skeleton`, and the `Toaster` and
32
+ `TooltipProvider` the data view needs;
33
+ - **`styles.css`**, compiled at build time with every utility `udc:`-prefixed, so
34
+ it cannot collide with a host's own Tailwind, and **`tokens.css`**, its design
35
+ tokens (see [Styling](#styling)).
36
+
37
+ ```sh
38
+ npm install @jsudc/react @jsudc/core \
39
+ react react-dom @tanstack/react-query radix-ui lucide-react
40
+ # then the peers of the renderers you register (see Renderers), all of them:
41
+ npm install @tanstack/react-table leaflet recharts @dnd-kit/core @dnd-kit/sortable @dnd-kit/utilities
42
+ # or straight from a GitHub tag:
43
+ npm install github:digital-cube/jsudc-core#v0.2.0 github:digital-cube/jsudc-react#v0.2.0
44
+ ```
45
+
46
+ ## Quick start
47
+
48
+ ```tsx
49
+ import "@jsudc/react/styles.css";
50
+ import { UdcClient } from "@jsudc/core/client";
51
+ import { createUdcQueryClient, UdcDataView, UdcI18nProvider, UdcProvider } from "@jsudc/react";
52
+ import { RENDERERS } from "@jsudc/react/all"; // every renderer; or a registry of a few, see Renderers
53
+ import { Toaster, TooltipProvider } from "@jsudc/react/ui";
54
+ import { QueryClientProvider } from "@tanstack/react-query";
55
+ import { createRoot } from "react-dom/client";
56
+
57
+ const client = new UdcClient({ httpUrl: "" }); // same origin; or "https://api.example.com"
58
+
59
+ createRoot(document.getElementById("root") as HTMLElement).render(
60
+ <UdcProvider client={client} renderers={RENDERERS}>
61
+ <QueryClientProvider client={createUdcQueryClient()}>
62
+ <UdcI18nProvider>
63
+ <TooltipProvider>
64
+ <Toaster>
65
+ <div style={{ display: "flex", flexDirection: "column", height: "100vh" }}>
66
+ <UdcDataView collection="companies" />
67
+ </div>
68
+ </Toaster>
69
+ </TooltipProvider>
70
+ </UdcI18nProvider>
71
+ </QueryClientProvider>
72
+ </UdcProvider>,
73
+ );
74
+ ```
75
+
76
+ The server is any UDC server, for example
77
+ [`@jsudc/server`](https://github.com/digital-cube/jsudc-server). It must be
78
+ same-origin, behind your dev server's proxy, or send CORS headers itself: the
79
+ client `POST`s JSON to `<httpUrl>/udc/<action>`.
80
+
81
+ `<UdcDataView>` fills its parent as a flex column (`flex: 1`, `min-height: 0`),
82
+ so give the parent a height. Key it by collection
83
+ (`<UdcDataView key={name} collection={name} />`) when one route shows many
84
+ collections, so each one starts from a fresh view.
85
+
86
+ ### The providers a host wraps
87
+
88
+ | Provider | Needed | Why |
89
+ | ----------------------------------------------------- | ------ | ----------------------------------------------------------------------------------------------------------------------------------------------------- |
90
+ | `UdcProvider client={new UdcClient(...)}` | yes | every hook reads the client from it; `renderers={…}` is what the data view draws its tabs with (none given: every tab says no renderer is registered) |
91
+ | `QueryClientProvider client={createUdcQueryClient()}` | yes | the hooks are TanStack Query; `createUdcQueryClient` retries transport failures only, never a protocol error |
92
+ | `UdcI18nProvider` | yes | every string goes through `useI18n()` |
93
+ | `TooltipProvider` | yes | Radix tooltips on headers, chips and buttons; with your own kit, `kit.TooltipProvider` (see [Bring your own primitives](#bring-your-own-primitives)) |
94
+ | `Toaster` | yes | save, conflict and schema-edit toasts (`useToast`); with your own kit, `kit.Toaster` |
95
+ | `UdcUrlStateProvider` / `UdcReactRouterUrlState` | no | where search, filters, sort, paging and the tab live; without it `window.location` (see [URL state](#url-state)) |
96
+ | `TimezoneProvider` | no | without it instants are shown in the browser's zone; with it the user's pick, kept in `localStorage` (`udc-tz`) |
97
+ | `ThemeProvider` | no | `useTheme()` toggles the `dark` class on `<html>` and keeps the choice (`udc-theme`); any other way of setting that class works too |
98
+
99
+ ## Renderers
100
+
101
+ The package root imports no renderer. A host registers the ones it shows, each
102
+ from its own subpath, and only those (with their peers) end up in its bundle:
103
+
104
+ ```tsx
105
+ import { createRendererRegistry, UdcProvider } from "@jsudc/react";
106
+ import { cardsRenderer } from "@jsudc/react/cards";
107
+ import { tableRenderer } from "@jsudc/react/table";
108
+
109
+ // A module constant: the registry should not change between renders.
110
+ const renderers = createRendererRegistry(tableRenderer, cardsRenderer);
111
+
112
+ <UdcProvider client={client} renderers={renderers}>
113
+ …
114
+ </UdcProvider>;
115
+ ```
116
+
117
+ `RENDERERS` from `@jsudc/react/all` is the registry of all seven. A view's tab
118
+ whose renderer is not registered is drawn disabled; `UdcDataView renderers={…}`
119
+ overrides the provider's registry for one view. A renderer of your own is one
120
+ more definition: `{ name: "gantt", component, icon, labelKey, paging, editMode }`
121
+ (`component` takes `RendererProps`), and a later definition of a name replaces
122
+ an earlier one, so `createRendererRegistry(tableRenderer, myTable)` swaps the
123
+ table.
124
+
125
+ | Subpath | Exports | Peers it needs (optional peers of the package) |
126
+ | ---------------------------- | ------------------------------------------------------------- | ---------------------------------------------------------- |
127
+ | `@jsudc/react/table` | `tableRenderer`, `TableRenderer`, `CellValue`, `Pager` | `@tanstack/react-table` |
128
+ | `@jsudc/react/cards` | `cardsRenderer`, `CardRenderer` | — |
129
+ | `@jsudc/react/kanban` | `kanbanRenderer`, `KanbanRenderer`, `KanbanBoardSwitcher` | `@dnd-kit/core`, `@dnd-kit/sortable`, `@dnd-kit/utilities` |
130
+ | `@jsudc/react/calendar` | `calendarRenderer`, `CalendarRenderer` | — |
131
+ | `@jsudc/react/tree` | `treeRenderer`, `TreeRenderer` | `@dnd-kit/core` |
132
+ | `@jsudc/react/map` | `mapRenderer`, `MapRenderer` | `leaflet` |
133
+ | `@jsudc/react/chart` | `chartRenderer`, `ChartRenderer` | `recharts` |
134
+ | `@jsudc/react/schema-editor` | `useSchemaEditor`, the field dialogs, the `fieldForm` helpers | — |
135
+ | `@jsudc/react/all` | `RENDERERS` and every `…Renderer` definition | all of the above |
136
+ | `@jsudc/react/headless` | hooks and models, no markup (below) | none: `react`, `@tanstack/react-query`, `@jsudc/core` only |
137
+
138
+ A subpath whose peer is not installed fails at that import and nowhere else:
139
+ Node stops with `ERR_MODULE_NOT_FOUND` for `leaflet`; Vite, which knows the
140
+ peer is optional, builds and the import throws
141
+ `Could not resolve "leaflet/dist/leaflet.css" imported by "@jsudc/react". Is it installed?`
142
+ when the module loads. The root, `/table`, `/cards`, `/calendar` and
143
+ `/headless` load without it.
144
+
145
+ ## Headless
146
+
147
+ `@jsudc/react/headless` is the data layer under the renderers, with no JSX, no
148
+ CSS and no renderer peer (a test walks its imports): a host on Material, Ant or
149
+ plain HTML builds its own renderer on it and gets the same queries, filters and
150
+ URL state.
151
+
152
+ - the client context and the hooks: `useUdcClient`, `useUdcDescribe`,
153
+ `useUdcCollection`, `useUdcAllRows`, `useUdcMutate`, `useUdcSchema`, `udcKeys`;
154
+ - the data view's state: `useDataViewState` (tab, search, chips, filter tree,
155
+ sort, paging in the URL), `composeFilter`, the URL codecs of `urlState.ts`,
156
+ `liveDescribe` / `liveSort`, the folder helpers;
157
+ - each renderer's model and state hook: `useKanbanBoard` and the drop planner,
158
+ `useChartWindow` and the chart series model, `useCalendarUrl` and the
159
+ calendar window model, the card, map and tree models (`planTreeDrop`,
160
+ `TreeDropPlan`: the tree's names, prefixed), `useTreeExpand`;
161
+ - `applyTransforms`, `displayText`, `renderKind` and the cell formatters;
162
+ the zone helpers and `useTimezone`;
163
+ - the registry functions (`createRendererRegistry`, `resolveTab`) and the URL
164
+ state adapter, so its hooks behave exactly as inside `UdcDataView`.
165
+
166
+ ## URL state
167
+
168
+ The data view keeps what the user chose in the query string, so a link or a
169
+ reload opens the same view: the tab (`?tab=`), the search (`?q=`), the chips
170
+ and the filter tree, the sort, the paging mode and the page, the kanban board
171
+ (`?board=`), the chart window (`?win=`, `?from=&to=`) and the calendar
172
+ (`?preset=&date=`). Filters, sort and windows **replace** the current history
173
+ entry; they are not a step the Back button walks through.
174
+
175
+ It reaches the address bar through a `UrlStateAdapter`:
176
+
177
+ ```ts
178
+ interface UrlStateAdapter {
179
+ get(): URLSearchParams;
180
+ set(next: URLSearchParams, opts?: { replace?: boolean }): void;
181
+ subscribe(listener: () => void): () => void; // back / forward
182
+ }
183
+ ```
184
+
185
+ **Default: no router needed.** Without a provider the view uses
186
+ `windowLocationAdapter`: `window.location.search`, written with
187
+ `history.pushState` / `replaceState`, the path and the hash left alone, read
188
+ again on `popstate`. That is all a plain React page needs.
189
+
190
+ **On react-router** (^7), mount the adapter from the subpath inside your
191
+ router, around the views. It is the only module of the package that imports
192
+ react-router, and react-router is an optional peer for it:
193
+
194
+ ```tsx
195
+ import { UdcReactRouterUrlState } from "@jsudc/react/react-router";
196
+
197
+ <BrowserRouter>
198
+ <UdcReactRouterUrlState>
199
+ <App />
200
+ </UdcReactRouterUrlState>
201
+ </BrowserRouter>;
202
+ ```
203
+
204
+ With a data router, put it in the root route's element. Use it whenever the
205
+ host navigates with react-router: the default adapter writes the History API
206
+ behind the router's back, so the router would not see the change.
207
+
208
+ **Any other router**: write the three calls and mount them with
209
+ `UdcUrlStateProvider`. `get` is called during render, so return the current
210
+ query string cheaply; `subscribe` only has to report changes the view did not
211
+ make itself, or none at all when a new adapter object is passed on every
212
+ location change (that re-renders the view's hooks too). Two sketches, to adapt
213
+ to your router's version. TanStack Router:
214
+
215
+ ```tsx
216
+ import { UdcUrlStateProvider, type UrlStateAdapter } from "@jsudc/react";
217
+ import { useLocation, useRouter } from "@tanstack/react-router";
218
+ import { useMemo } from "react";
219
+
220
+ function TanStackUrlState({ children }: { children: React.ReactNode }) {
221
+ const router = useRouter();
222
+ const searchStr = useLocation({ select: (l) => l.searchStr });
223
+ const adapter = useMemo<UrlStateAdapter>(
224
+ () => ({
225
+ get: () => new URLSearchParams(router.state.location.searchStr),
226
+ set: (next, opts) => {
227
+ const qs = next.toString();
228
+ router.history[opts?.replace ? "replace" : "push"](
229
+ `${router.state.location.pathname}${qs ? `?${qs}` : ""}`,
230
+ );
231
+ },
232
+ subscribe: () => () => {},
233
+ }),
234
+ // biome-ignore lint/correctness/useExhaustiveDependencies: a new adapter per query string
235
+ [router, searchStr],
236
+ );
237
+ return <UdcUrlStateProvider adapter={adapter}>{children}</UdcUrlStateProvider>;
238
+ }
239
+ ```
240
+
241
+ Next.js (App Router, a client component):
242
+
243
+ ```tsx
244
+ "use client";
245
+ import { UdcUrlStateProvider, type UrlStateAdapter } from "@jsudc/react";
246
+ import { usePathname, useRouter, useSearchParams } from "next/navigation";
247
+ import { useMemo } from "react";
248
+
249
+ export function NextUrlState({ children }: { children: React.ReactNode }) {
250
+ const router = useRouter();
251
+ const pathname = usePathname();
252
+ const search = useSearchParams().toString();
253
+ const adapter = useMemo<UrlStateAdapter>(
254
+ () => ({
255
+ get: () => new URLSearchParams(search),
256
+ set: (next, opts) => {
257
+ const qs = next.toString();
258
+ const url = `${pathname}${qs ? `?${qs}` : ""}`;
259
+ if (opts?.replace) router.replace(url, { scroll: false });
260
+ else router.push(url, { scroll: false });
261
+ },
262
+ subscribe: () => () => {},
263
+ }),
264
+ [router, pathname, search],
265
+ );
266
+ return <UdcUrlStateProvider adapter={adapter}>{children}</UdcUrlStateProvider>;
267
+ }
268
+ ```
269
+
270
+ `useUrlSearchParams()` gives your own components the same
271
+ `[params, setParams]` pair the view uses, over whichever adapter is in effect;
272
+ a function passed to `setParams` receives the query string as it is now.
273
+
274
+ ## Bring your own primitives
275
+
276
+ The renderers never import a button, a dialog or a menu. They take every
277
+ primitive from a **UI kit** in context: `const { Button, Popover } = useUiKit()`.
278
+ The kit the package ships, Radix primitives styled with Tailwind, is
279
+ `defaultUiKit` from `@jsudc/react/ui`, and it is what the view uses when you
280
+ pass nothing. Hand another kit to `UdcProvider` (or mount `UdcUiProvider`
281
+ yourself) to draw the same view with MUI, Ant Design, or your own shadcn
282
+ components:
283
+
284
+ ```tsx
285
+ import { UdcProvider } from "@jsudc/react";
286
+ import { myKit } from "./myKit"; // a module constant: `const myKit: UiKit = {...}`
287
+
288
+ <UdcProvider client={client} kit={myKit}>
289
+ <myKit.TooltipProvider>
290
+ <myKit.Toaster>
291
+ <UdcDataView collection="companies" />
292
+ </myKit.Toaster>
293
+ </myKit.TooltipProvider>
294
+ </UdcProvider>;
295
+ ```
296
+
297
+ `UdcProvider` without `kit` leaves the kit alone: an outer `UdcUiProvider`'s
298
+ wins, else the default. `useUiKit()` returns the kit in effect, so your own
299
+ components can draw with the same primitives.
300
+
301
+ **The contract** is the `UiKit` interface (exported from the package root
302
+ with one props type per primitive, `UiButtonProps`, `UiDialogContentProps` and
303
+ so on). It lists exactly the props the renderers pass, no more:
304
+
305
+ | Family | Members |
306
+ | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------- |
307
+ | Fields | `Button` (`variant`, `size`), `Input`, `NativeSelect`, `Checkbox`, `Select` (an options list), `Segmented` |
308
+ | Small | `Spinner`, `Skeleton`, `Kbd` |
309
+ | Dialog | `Dialog` (controlled), `DialogContent` (`title`, `description`, a close button), `DialogBody`, `DialogFooter` |
310
+ | Menu | `DropdownMenu`, `DropdownMenuTrigger`, `DropdownMenuContent`, `DropdownMenuItem` (`onSelect`, `tone`), `DropdownMenuLabel`, `DropdownMenuSeparator` |
311
+ | Popover | `Popover` (controlled or not), `PopoverTrigger`, `PopoverContent`, `PopoverAnchor` (a `virtualRef`) |
312
+ | Tooltip | `TooltipProvider`, `Tip` (`label` on its single child) |
313
+ | Toast | `Toaster` (the stack and its viewport), `useToast()` → `{ toast({ title, description?, variant? }) }` |
314
+
315
+ Three things a kit must honour: a trigger with `asChild` merges into its single
316
+ child instead of drawing a button; `DialogContent`'s `onEscapeKeyDown` /
317
+ `onInteractOutside` and `PopoverContent`'s `onOpenAutoFocus` get an event whose
318
+ `preventDefault()` keeps the dialog open or the focus in place; `useToast` is
319
+ called as a hook. Keep the kit object stable (a module constant): it is read on
320
+ every render.
321
+
322
+ **The smallest kit** is plain HTML. The package's own test suite has one,
323
+ [`test/stubKit.tsx`](test/stubKit.tsx), and renders every renderer with it;
324
+ a few of its members:
325
+
326
+ ```tsx
327
+ import type { UiKit } from "@jsudc/react";
328
+
329
+ export const stubKit: UiKit = {
330
+ Button: ({ variant, size, type, ...props }) => (
331
+ <button data-variant={variant} data-size={size} type={type ?? "button"} {...props} />
332
+ ),
333
+ Input: (props) => <input {...props} />,
334
+ Checkbox: ({ onCheckedChange, ...props }) => (
335
+ <input type="checkbox" {...props} onChange={(e) => onCheckedChange(e.target.checked)} />
336
+ ),
337
+ Spinner: ({ className }) => <span aria-hidden className={className} />,
338
+ Tip: ({ label, children }) => (
339
+ <span title={typeof label === "string" ? label : undefined}>{children}</span>
340
+ ),
341
+ // … Dialog, DropdownMenu and Popover keep their open state in a small context;
342
+ // see test/stubKit.tsx for all of it.
343
+ };
344
+ ```
345
+
346
+ **The default kit's primitives** are exported one by one from
347
+ `@jsudc/react/ui` too (`Button`, `Dialog`, `DialogContent`, `Popover`,
348
+ `Select`, `Segmented`, `Toaster`, `useToast`, `Tip`, …), for a host page that
349
+ wants the same look outside the view. Radix (`radix-ui`) is still a required
350
+ peer while the default kit is the fallback.
351
+
352
+ ## Peer dependencies
353
+
354
+ Everything the components import that a host is likely to have too is a peer,
355
+ so there is one copy of it in the bundle:
356
+
357
+ - `@jsudc/core` ^0.2.0 — one copy of the protocol, shared with the host's
358
+ own `UdcClient`;
359
+ - `react`, `react-dom` ^19 — one React, or hooks break;
360
+ - `@tanstack/react-query` ^5 — one `QueryClient` context, shared with the
361
+ host's own queries;
362
+ - `lucide-react` — the icons;
363
+ - `radix-ui` — the default UI kit (`@jsudc/react/ui`), the fallback when no
364
+ other kit is given (see [Bring your own primitives](#bring-your-own-primitives));
365
+ - **optional**, each needed only by its subpath (see [Renderers](#renderers)):
366
+ `@tanstack/react-table` (table), `@dnd-kit/core` (kanban, tree),
367
+ `@dnd-kit/sortable` and `@dnd-kit/utilities` (kanban), `leaflet` (map),
368
+ `recharts` (chart), `react-router` (`@jsudc/react/react-router`, see
369
+ [URL state](#url-state)). The package root imports none of them.
370
+
371
+ The regular dependencies are `clsx`, `tailwind-merge` and `marked` (the Doc
372
+ tab).
373
+
374
+ The map renderer imports `leaflet/dist/leaflet.css` itself; your bundler picks
375
+ it up from the `leaflet` you installed.
376
+
377
+ ## Styling
378
+
379
+ Import the compiled stylesheet once, with or without Tailwind of your own:
380
+
381
+ ```ts
382
+ import "@jsudc/react/styles.css";
383
+ ```
384
+
385
+ It holds Tailwind's preflight, every utility the components use, the design
386
+ tokens of both themes and the library's few rules of its own. Every utility is
387
+ **`udc:`-prefixed** (Tailwind v4's `prefix(udc)`: `udc:flex`,
388
+ `udc:hover:bg-hover`), so it cannot collide with a host's own Tailwind: a
389
+ host's `.flex` and `.p-4` are its own, and the library's are `.udc\:flex`,
390
+ `.udc\:p-4`. A host that runs Tailwind v4 keeps its build as it is and
391
+ imports `styles.css` beside it; it does not `@source` the package (its
392
+ classes are already compiled, and a host's unprefixed Tailwind would not
393
+ generate them anyway). The build fails if the stylesheet ever carries an
394
+ unprefixed class (`scripts/check-css.mjs`).
395
+
396
+ The stylesheet also carries the library's base rules (`border-color` on `*`,
397
+ `body` font and colours, pointer cursor on buttons) in `@layer base`; any
398
+ unlayered CSS of the host wins over them.
399
+
400
+ ### Theming
401
+
402
+ Every colour comes from a CSS variable on `:root` and `.dark`. Restyling is
403
+ redefining them after the stylesheet, no code:
404
+
405
+ ```css
406
+ :root {
407
+ --primary: oklch(0.55 0.2 150);
408
+ --primary-foreground: white;
409
+ }
410
+ .dark {
411
+ --background: oklch(0.12 0.01 150);
412
+ }
413
+ ```
414
+
415
+ The variables (`dist/tokens.css`, both themes):
416
+
417
+ | Variable | What it paints |
418
+ | --------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------- |
419
+ | `--background`, `--foreground` | the page behind the view, the text |
420
+ | `--surface`, `--surface-raised` | panels, cards, cells; popovers and dialogs |
421
+ | `--muted`, `--muted-foreground` | quiet fills (skeletons, column backgrounds), secondary text |
422
+ | `--border`, `--border-strong`, `--input`, `--ring` | hairlines, emphasised borders, inputs, focus rings |
423
+ | `--primary`, `--primary-foreground` | the accent: primary buttons, active chips, links |
424
+ | `--hover`, `--selected` | row and item hover, selection |
425
+ | `--shadow-pin` | the shadow beside a pinned table column |
426
+ | `--sem-accent`, `--sem-success`, `--sem-warning`, `--sem-danger`, `--sem-info`, `--sem-muted` | the semantic tones (badges, row colours, kanban columns, map markers) |
427
+ | `--sem-accent-bg`, `--sem-success-bg`, `--sem-warning-bg`, `--sem-danger-bg`, `--sem-info-bg`, `--sem-muted-bg` | their background pairs |
428
+ | `--chart-1` … `--chart-8` | the chart's series |
429
+
430
+ Dark mode is the `dark` class on any ancestor, usually `<html>`. The font is
431
+ `Inter Variable` when the host loads it (`@fontsource-variable/inter`), else
432
+ the system UI font.
433
+
434
+ ### Stable classes
435
+
436
+ Next to its utilities every structural element carries a class that does not
437
+ change with them, for plain-CSS overrides:
438
+
439
+ | Class | Element |
440
+ | -------------------- | ------------------------------------------------- |
441
+ | `udc-data-view` | the whole view (header, toolbar, the renderer) |
442
+ | `udc-toolbar` | the toolbar: search, chips, filter builder, count |
443
+ | `udc-search` | the search box |
444
+ | `udc-filter-chip` | one filter chip |
445
+ | `udc-table` | the table's `<table>` |
446
+ | `udc-row` | a table row (`<tr>`) |
447
+ | `udc-cell` | a table cell (`<td>`) |
448
+ | `udc-pager` | the pager under the table or the cards |
449
+ | `udc-card` | one card of the card grid |
450
+ | `udc-kanban` | the kanban board |
451
+ | `udc-kanban-column` | a kanban column |
452
+ | `udc-kanban-card` | a kanban card |
453
+ | `udc-calendar` | the calendar |
454
+ | `udc-calendar-event` | an event (time grid block, month chip) |
455
+ | `udc-tree` | the tree |
456
+ | `udc-tree-node` | one node of the tree (with its children) |
457
+ | `udc-map` | the map's Leaflet container |
458
+ | `udc-chart` | the chart tab |
459
+ | `udc-schema-editor` | the field form and the delete-field dialog |
460
+
461
+ ```css
462
+ /* Denser table rows, a bolder first column, square cards. */
463
+ .udc-table .udc-row {
464
+ height: 28px !important; /* the row height is an inline style */
465
+ }
466
+ .udc-table .udc-row .udc-cell:first-child {
467
+ font-weight: 600;
468
+ }
469
+ .udc-card {
470
+ border-radius: 0;
471
+ }
472
+ ```
473
+
474
+ A rule of the host's own (unlayered) CSS wins over the library's utilities,
475
+ which sit in Tailwind's `@layer utilities`, without `!important`; only inline
476
+ styles (row height, column widths, pinned offsets) need it.
477
+
478
+ ## i18n
479
+
480
+ `UdcI18nProvider` ships the library's strings (section `APP`) in `en` and `sr`.
481
+ `t(section, term)` looks in the field labels of the collection's schema first,
482
+ then in your `messages`, then in the library's dictionary, in the current
483
+ locale and then in English; a term found nowhere is humanised (`revenue_eur` →
484
+ `Revenue eur`).
485
+
486
+ ```tsx
487
+ import { type Messages, UdcI18nProvider } from "@jsudc/react";
488
+
489
+ const messages: Messages = {
490
+ // the collection's title, and its own field labels and strings
491
+ COLLECTIONS: { COMPANIES: { en: "Companies", sr: "Preduzeća" } },
492
+ TBL_COMPANIES: {
493
+ __DESCRIPTION: { en: "Our customers", sr: "Naši klijenti" },
494
+ REVENUE_EUR: { en: "Revenue (EUR)", sr: "Prihod (EUR)" },
495
+ },
496
+ // override one library string, in one locale
497
+ APP: { RETRY: { en: "Reload" } },
498
+ };
499
+
500
+ <UdcI18nProvider messages={messages}>…</UdcI18nProvider>;
501
+ ```
502
+
503
+ - Sections are `COLLECTIONS` (titles), `TBL_<COLLECTION>` (a collection's
504
+ field labels — term = field name upper-cased — plus `__DESCRIPTION` under
505
+ the title and `SEARCH_PLACEHOLDER`) and `APP`.
506
+ - **Another locale** is just strings in it: add `de` to the terms you translate
507
+ and it is offered (`useI18n().locales` is `en`, `sr` and every locale your
508
+ messages use); missing terms fall back to English. `Intl` formats with the
509
+ locale tag as it is (`en` → `en-US` and `sr` → `sr-Latn-RS` are mapped).
510
+ - **Who owns the locale**: by default the provider does, remembered in
511
+ `localStorage` (`udc-locale`). Pass `locale` and `onLocaleChange` to keep it in
512
+ your own state, a URL or a user profile.
513
+ - `useI18n()` gives `t`, `tMaybe` (`null` when missing), `locale`,
514
+ `intlLocale`, `locales` and `setLocale` to your own components too.
515
+
516
+ ## API
517
+
518
+ The package root (`dist/index.d.ts`) has the data view, the providers, the
519
+ registry and everything not tied to one renderer. Beyond the above:
520
+ `createRendererRegistry`, `rendererEntry`, `rendererTabs`, `resolveTab`,
521
+ `UdcRenderersProvider`, `useRendererRegistry` and the `RendererProps` /
522
+ `RendererEntry` / `RendererDefinition` / `RendererRegistry` types;
523
+ `EmptyState` / `ErrorState` / `NoRendererState`; `mergeMessages`, `makeT`,
524
+ `lookup`, `schemaLabelTerms`, `tableSection`, `TRANSLATIONS`, `LOCALES`;
525
+ `cn` (tailwind-merge set up for the `udc:` prefix), `storage`, `humanize`;
526
+ `UdcUrlStateProvider`, `useUrlSearchParams`, `windowLocationAdapter` and the
527
+ `UrlStateAdapter` type; `UdcUiProvider`, `useUiKit` and the `UiKit` type with
528
+ its props types; `resolveIcon` with the `lucide:<name>` icons the package
529
+ bundles (`LUCIDE_ICONS`); and the zone helpers `allZones`, `offsetLabel`,
530
+ `zoneCity`.
531
+
532
+ The subpaths: one per renderer and `@jsudc/react/all` (see
533
+ [Renderers](#renderers)), `@jsudc/react/headless` (see [Headless](#headless)),
534
+ `@jsudc/react/ui` (`defaultUiKit` and its primitives: `Button`, `Dialog`,
535
+ `Toaster`, `TooltipProvider`, …), `@jsudc/react/react-router`
536
+ (`UdcReactRouterUrlState`), `@jsudc/react/styles.css` and
537
+ `@jsudc/react/tokens.css`.
538
+
539
+ The build is ESM only, one file per source module (tree-shakeable), one
540
+ `dist/<subpath>.js` with its `dist/<subpath>.d.ts` per entry; every dependency
541
+ and peer stays an import.
542
+
543
+ ## Develop
544
+
545
+ ```sh
546
+ nvm use # Node 24
547
+ npm ci # also builds dist (prepare)
548
+ npm run typecheck
549
+ npm run lint # Biome
550
+ npm test # Vitest + Testing Library in jsdom, no server needed
551
+ npm run build # vite build (lib mode) + tsc (.d.ts) + Tailwind CLI (dist/styles.css)
552
+ ```
553
+
554
+ ## License
555
+
556
+ MIT, see [LICENSE](LICENSE).
package/dist/all.d.ts ADDED
@@ -0,0 +1,9 @@
1
+ export { calendarRenderer } from "./calendar/index.js";
2
+ export { cardsRenderer } from "./cards/index.js";
3
+ export { chartRenderer } from "./chart/index.js";
4
+ export { kanbanRenderer } from "./kanban/index.js";
5
+ export { mapRenderer } from "./map/index.js";
6
+ export { tableRenderer } from "./table/index.js";
7
+ export { treeRenderer } from "./tree/index.js";
8
+ /** Every renderer the package ships: `<UdcProvider renderers={RENDERERS}>`. */
9
+ export declare const RENDERERS: Readonly<Record<string, import("./headless.js").RendererEntry>>;
package/dist/all.js ADDED
@@ -0,0 +1,14 @@
1
+ import { calendarRenderer } from "./calendar.js";
2
+ import { cardsRenderer } from "./cards.js";
3
+ import { chartRenderer } from "./chart.js";
4
+ import { kanbanRenderer } from "./kanban.js";
5
+ import { mapRenderer } from "./map.js";
6
+ import { createRendererRegistry } from "./renderers/registry.js";
7
+ import { tableRenderer } from "./table.js";
8
+ import { treeRenderer } from "./tree.js";
9
+ // src/all.ts
10
+ /** Every renderer the package ships: `<UdcProvider renderers={RENDERERS}>`. */
11
+ var RENDERERS = createRendererRegistry(tableRenderer, cardsRenderer, kanbanRenderer, calendarRenderer, treeRenderer, mapRenderer, chartRenderer);
12
+ export { RENDERERS, calendarRenderer, cardsRenderer, chartRenderer, kanbanRenderer, mapRenderer, tableRenderer, treeRenderer };
13
+
14
+ //# sourceMappingURL=all.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"all.js","names":[],"sources":["../src/all.ts"],"sourcesContent":["// @jsudc/react/all: every renderer, and `RENDERERS`, the registry of all of them (what the\n// package root exported before the renderers became subpaths). Needs every optional peer:\n// `@tanstack/react-table`, `@dnd-kit/*`, `leaflet`, `recharts`.\nimport { calendarRenderer } from \"./calendar/index.js\";\nimport { cardsRenderer } from \"./cards/index.js\";\nimport { chartRenderer } from \"./chart/index.js\";\nimport { kanbanRenderer } from \"./kanban/index.js\";\nimport { mapRenderer } from \"./map/index.js\";\nimport { createRendererRegistry } from \"./renderers/registry.js\";\nimport { tableRenderer } from \"./table/index.js\";\nimport { treeRenderer } from \"./tree/index.js\";\n\nexport { calendarRenderer } from \"./calendar/index.js\";\nexport { cardsRenderer } from \"./cards/index.js\";\nexport { chartRenderer } from \"./chart/index.js\";\nexport { kanbanRenderer } from \"./kanban/index.js\";\nexport { mapRenderer } from \"./map/index.js\";\nexport { tableRenderer } from \"./table/index.js\";\nexport { treeRenderer } from \"./tree/index.js\";\n\n/** Every renderer the package ships: `<UdcProvider renderers={RENDERERS}>`. */\nexport const RENDERERS = createRendererRegistry(\n tableRenderer,\n cardsRenderer,\n kanbanRenderer,\n calendarRenderer,\n treeRenderer,\n mapRenderer,\n chartRenderer,\n);\n"],"mappings":";;;;;;;;;;AAqBA,IAAa,YAAY,uBACvB,eACA,eACA,gBACA,kBACA,cACA,aACA,aACF"}
@@ -0,0 +1,9 @@
1
+ import { type FilterNode, type SchemaDoc } from "@jsudc/core";
2
+ import type { RendererProps } from "../renderers/types.js";
3
+ /**
4
+ * Enum values the filter pins (a chip with values picked): what a new event
5
+ * gets, so an appointment added under the "Ana" chip is Ana's.
6
+ */
7
+ export declare function prefillFromFilter(filter: FilterNode | undefined, schema: SchemaDoc): Record<string, unknown>;
8
+ /** The `calendar` tab: the window of a preset, asked from the server, drawn in the header's zone. */
9
+ export declare function CalendarRenderer(props: RendererProps): import("react").JSX.Element;