@cohesivesystems/presentation-react-shadcn 0.1.0-alpha.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 (262) hide show
  1. package/LICENSE +55 -0
  2. package/dist/document-workspace-surface-slot-renderers.d.ts +58 -0
  3. package/dist/document-workspace-surface-slot-renderers.d.ts.map +1 -0
  4. package/dist/document-workspace-surface-slot-renderers.js +206 -0
  5. package/dist/document-workspace-surface-slot-renderers.js.map +1 -0
  6. package/dist/index.d.ts +53 -0
  7. package/dist/index.d.ts.map +1 -0
  8. package/dist/index.js +53 -0
  9. package/dist/index.js.map +1 -0
  10. package/dist/navigation-shell-frame-renderer-registry.d.ts +8 -0
  11. package/dist/navigation-shell-frame-renderer-registry.d.ts.map +1 -0
  12. package/dist/navigation-shell-frame-renderer-registry.js +2 -0
  13. package/dist/navigation-shell-frame-renderer-registry.js.map +1 -0
  14. package/dist/navigation-shell-slot-renderer-registry.d.ts +9 -0
  15. package/dist/navigation-shell-slot-renderer-registry.d.ts.map +1 -0
  16. package/dist/navigation-shell-slot-renderer-registry.js +2 -0
  17. package/dist/navigation-shell-slot-renderer-registry.js.map +1 -0
  18. package/dist/page-host-unavailable-renderer.d.ts +10 -0
  19. package/dist/page-host-unavailable-renderer.d.ts.map +1 -0
  20. package/dist/page-host-unavailable-renderer.js +27 -0
  21. package/dist/page-host-unavailable-renderer.js.map +1 -0
  22. package/dist/presentation-action-group.d.ts +99 -0
  23. package/dist/presentation-action-group.d.ts.map +1 -0
  24. package/dist/presentation-action-group.js +214 -0
  25. package/dist/presentation-action-group.js.map +1 -0
  26. package/dist/presentation-badge-target-interpreter.d.ts +26 -0
  27. package/dist/presentation-badge-target-interpreter.d.ts.map +1 -0
  28. package/dist/presentation-badge-target-interpreter.js +17 -0
  29. package/dist/presentation-badge-target-interpreter.js.map +1 -0
  30. package/dist/presentation-component-groups.d.ts +968 -0
  31. package/dist/presentation-component-groups.d.ts.map +1 -0
  32. package/dist/presentation-component-groups.js +505 -0
  33. package/dist/presentation-component-groups.js.map +1 -0
  34. package/dist/presentation-component-system-diagnostics.d.ts +27 -0
  35. package/dist/presentation-component-system-diagnostics.d.ts.map +1 -0
  36. package/dist/presentation-component-system-diagnostics.js +399 -0
  37. package/dist/presentation-component-system-diagnostics.js.map +1 -0
  38. package/dist/presentation-component-system.d.ts +31 -0
  39. package/dist/presentation-component-system.d.ts.map +1 -0
  40. package/dist/presentation-component-system.js +61 -0
  41. package/dist/presentation-component-system.js.map +1 -0
  42. package/dist/presentation-icon-diagnostics.d.ts +12 -0
  43. package/dist/presentation-icon-diagnostics.d.ts.map +1 -0
  44. package/dist/presentation-icon-diagnostics.js +17 -0
  45. package/dist/presentation-icon-diagnostics.js.map +1 -0
  46. package/dist/presentation-icon-registry.d.ts +28 -0
  47. package/dist/presentation-icon-registry.d.ts.map +1 -0
  48. package/dist/presentation-icon-registry.js +80 -0
  49. package/dist/presentation-icon-registry.js.map +1 -0
  50. package/dist/presentation-projection-trace-panel.d.ts +10 -0
  51. package/dist/presentation-projection-trace-panel.d.ts.map +1 -0
  52. package/dist/presentation-projection-trace-panel.js +48 -0
  53. package/dist/presentation-projection-trace-panel.js.map +1 -0
  54. package/dist/presentation-routed-surface-host.d.ts +19 -0
  55. package/dist/presentation-routed-surface-host.d.ts.map +1 -0
  56. package/dist/presentation-routed-surface-host.js +12 -0
  57. package/dist/presentation-routed-surface-host.js.map +1 -0
  58. package/dist/presentation-shadcn-component-system.d.ts +22 -0
  59. package/dist/presentation-shadcn-component-system.d.ts.map +1 -0
  60. package/dist/presentation-shadcn-component-system.js +2 -0
  61. package/dist/presentation-shadcn-component-system.js.map +1 -0
  62. package/dist/presentation-standard-renderers.d.ts +168 -0
  63. package/dist/presentation-standard-renderers.d.ts.map +1 -0
  64. package/dist/presentation-standard-renderers.js +440 -0
  65. package/dist/presentation-standard-renderers.js.map +1 -0
  66. package/dist/presentation-surface-renderer.d.ts +23 -0
  67. package/dist/presentation-surface-renderer.d.ts.map +1 -0
  68. package/dist/presentation-surface-renderer.js +119 -0
  69. package/dist/presentation-surface-renderer.js.map +1 -0
  70. package/dist/presentation-value-renderers.d.ts +10 -0
  71. package/dist/presentation-value-renderers.d.ts.map +1 -0
  72. package/dist/presentation-value-renderers.js +14 -0
  73. package/dist/presentation-value-renderers.js.map +1 -0
  74. package/dist/process-task-icons.d.ts +49 -0
  75. package/dist/process-task-icons.d.ts.map +1 -0
  76. package/dist/process-task-icons.js +154 -0
  77. package/dist/process-task-icons.js.map +1 -0
  78. package/dist/projected-activity-state.d.ts +17 -0
  79. package/dist/projected-activity-state.d.ts.map +1 -0
  80. package/dist/projected-activity-state.js +22 -0
  81. package/dist/projected-activity-state.js.map +1 -0
  82. package/dist/projected-collection-action-runtime-diagnostics.d.ts +4 -0
  83. package/dist/projected-collection-action-runtime-diagnostics.d.ts.map +1 -0
  84. package/dist/projected-collection-action-runtime-diagnostics.js +9 -0
  85. package/dist/projected-collection-action-runtime-diagnostics.js.map +1 -0
  86. package/dist/projected-collection-view.d.ts +90 -0
  87. package/dist/projected-collection-view.d.ts.map +1 -0
  88. package/dist/projected-collection-view.js +532 -0
  89. package/dist/projected-collection-view.js.map +1 -0
  90. package/dist/projected-document-action-status-notices.d.ts +15 -0
  91. package/dist/projected-document-action-status-notices.d.ts.map +1 -0
  92. package/dist/projected-document-action-status-notices.js +33 -0
  93. package/dist/projected-document-action-status-notices.js.map +1 -0
  94. package/dist/projected-document-badges.d.ts +24 -0
  95. package/dist/projected-document-badges.d.ts.map +1 -0
  96. package/dist/projected-document-badges.js +53 -0
  97. package/dist/projected-document-badges.js.map +1 -0
  98. package/dist/projected-document-editor-surface.d.ts +46 -0
  99. package/dist/projected-document-editor-surface.d.ts.map +1 -0
  100. package/dist/projected-document-editor-surface.js +399 -0
  101. package/dist/projected-document-editor-surface.js.map +1 -0
  102. package/dist/projected-document-workspace-notices.d.ts +24 -0
  103. package/dist/projected-document-workspace-notices.d.ts.map +1 -0
  104. package/dist/projected-document-workspace-notices.js +14 -0
  105. package/dist/projected-document-workspace-notices.js.map +1 -0
  106. package/dist/projected-document-workspace-prompt-child-view-registry.d.ts +25 -0
  107. package/dist/projected-document-workspace-prompt-child-view-registry.d.ts.map +1 -0
  108. package/dist/projected-document-workspace-prompt-child-view-registry.js +41 -0
  109. package/dist/projected-document-workspace-prompt-child-view-registry.js.map +1 -0
  110. package/dist/projected-document-workspace-prompt-child-view-renderers.d.ts +32 -0
  111. package/dist/projected-document-workspace-prompt-child-view-renderers.d.ts.map +1 -0
  112. package/dist/projected-document-workspace-prompt-child-view-renderers.js +77 -0
  113. package/dist/projected-document-workspace-prompt-child-view-renderers.js.map +1 -0
  114. package/dist/projected-document-workspace-shell.d.ts +100 -0
  115. package/dist/projected-document-workspace-shell.d.ts.map +1 -0
  116. package/dist/projected-document-workspace-shell.js +153 -0
  117. package/dist/projected-document-workspace-shell.js.map +1 -0
  118. package/dist/projected-document-workspace.d.ts +39 -0
  119. package/dist/projected-document-workspace.d.ts.map +1 -0
  120. package/dist/projected-document-workspace.js +63 -0
  121. package/dist/projected-document-workspace.js.map +1 -0
  122. package/dist/projected-field-value-rendering.d.ts +94 -0
  123. package/dist/projected-field-value-rendering.d.ts.map +1 -0
  124. package/dist/projected-field-value-rendering.js +377 -0
  125. package/dist/projected-field-value-rendering.js.map +1 -0
  126. package/dist/projected-inline-list.d.ts +20 -0
  127. package/dist/projected-inline-list.d.ts.map +1 -0
  128. package/dist/projected-inline-list.js +149 -0
  129. package/dist/projected-inline-list.js.map +1 -0
  130. package/dist/projected-input-form.d.ts +143 -0
  131. package/dist/projected-input-form.d.ts.map +1 -0
  132. package/dist/projected-input-form.js +612 -0
  133. package/dist/projected-input-form.js.map +1 -0
  134. package/dist/projected-metric-dashboard.d.ts +26 -0
  135. package/dist/projected-metric-dashboard.d.ts.map +1 -0
  136. package/dist/projected-metric-dashboard.js +20 -0
  137. package/dist/projected-metric-dashboard.js.map +1 -0
  138. package/dist/projected-metric-strip.d.ts +20 -0
  139. package/dist/projected-metric-strip.d.ts.map +1 -0
  140. package/dist/projected-metric-strip.js +131 -0
  141. package/dist/projected-metric-strip.js.map +1 -0
  142. package/dist/projected-navigation-shell-view-host.d.ts +34 -0
  143. package/dist/projected-navigation-shell-view-host.d.ts.map +1 -0
  144. package/dist/projected-navigation-shell-view-host.js +75 -0
  145. package/dist/projected-navigation-shell-view-host.js.map +1 -0
  146. package/dist/projected-navigation-shell.d.ts +33 -0
  147. package/dist/projected-navigation-shell.d.ts.map +1 -0
  148. package/dist/projected-navigation-shell.js +112 -0
  149. package/dist/projected-navigation-shell.js.map +1 -0
  150. package/dist/projected-presentation-badges.d.ts +34 -0
  151. package/dist/projected-presentation-badges.d.ts.map +1 -0
  152. package/dist/projected-presentation-badges.js +22 -0
  153. package/dist/projected-presentation-badges.js.map +1 -0
  154. package/dist/projected-presentation-diagnostics.d.ts +10 -0
  155. package/dist/projected-presentation-diagnostics.d.ts.map +1 -0
  156. package/dist/projected-presentation-diagnostics.js +40 -0
  157. package/dist/projected-presentation-diagnostics.js.map +1 -0
  158. package/dist/projected-presentation-flow-layer.d.ts +33 -0
  159. package/dist/projected-presentation-flow-layer.d.ts.map +1 -0
  160. package/dist/projected-presentation-flow-layer.js +71 -0
  161. package/dist/projected-presentation-flow-layer.js.map +1 -0
  162. package/dist/projected-process-task-notices.d.ts +37 -0
  163. package/dist/projected-process-task-notices.d.ts.map +1 -0
  164. package/dist/projected-process-task-notices.js +225 -0
  165. package/dist/projected-process-task-notices.js.map +1 -0
  166. package/dist/projected-prompt-child-view-renderer.d.ts +101 -0
  167. package/dist/projected-prompt-child-view-renderer.d.ts.map +1 -0
  168. package/dist/projected-prompt-child-view-renderer.js +442 -0
  169. package/dist/projected-prompt-child-view-renderer.js.map +1 -0
  170. package/dist/projected-prompt-document-preview.d.ts +39 -0
  171. package/dist/projected-prompt-document-preview.d.ts.map +1 -0
  172. package/dist/projected-prompt-document-preview.js +50 -0
  173. package/dist/projected-prompt-document-preview.js.map +1 -0
  174. package/dist/projected-prompt-view.d.ts +35 -0
  175. package/dist/projected-prompt-view.d.ts.map +1 -0
  176. package/dist/projected-prompt-view.js +292 -0
  177. package/dist/projected-prompt-view.js.map +1 -0
  178. package/dist/projected-query-form.d.ts +56 -0
  179. package/dist/projected-query-form.d.ts.map +1 -0
  180. package/dist/projected-query-form.js +100 -0
  181. package/dist/projected-query-form.js.map +1 -0
  182. package/dist/projected-record-details.d.ts +20 -0
  183. package/dist/projected-record-details.d.ts.map +1 -0
  184. package/dist/projected-record-details.js +60 -0
  185. package/dist/projected-record-details.js.map +1 -0
  186. package/dist/projected-routed-surface-runtime.d.ts +86 -0
  187. package/dist/projected-routed-surface-runtime.d.ts.map +1 -0
  188. package/dist/projected-routed-surface-runtime.js +332 -0
  189. package/dist/projected-routed-surface-runtime.js.map +1 -0
  190. package/dist/projected-tabs-view.d.ts +21 -0
  191. package/dist/projected-tabs-view.d.ts.map +1 -0
  192. package/dist/projected-tabs-view.js +140 -0
  193. package/dist/projected-tabs-view.js.map +1 -0
  194. package/dist/projected-view-chrome.d.ts +15 -0
  195. package/dist/projected-view-chrome.d.ts.map +1 -0
  196. package/dist/projected-view-chrome.js +67 -0
  197. package/dist/projected-view-chrome.js.map +1 -0
  198. package/dist/projected-view-surface.d.ts +34 -0
  199. package/dist/projected-view-surface.d.ts.map +1 -0
  200. package/dist/projected-view-surface.js +40 -0
  201. package/dist/projected-view-surface.js.map +1 -0
  202. package/dist/standard-collection-chrome-slot-renderers.d.ts +26 -0
  203. package/dist/standard-collection-chrome-slot-renderers.d.ts.map +1 -0
  204. package/dist/standard-collection-chrome-slot-renderers.js +250 -0
  205. package/dist/standard-collection-chrome-slot-renderers.js.map +1 -0
  206. package/dist/standard-view-chrome-slot-renderers.d.ts +57 -0
  207. package/dist/standard-view-chrome-slot-renderers.d.ts.map +1 -0
  208. package/dist/standard-view-chrome-slot-renderers.js +614 -0
  209. package/dist/standard-view-chrome-slot-renderers.js.map +1 -0
  210. package/package.json +68 -0
  211. package/src/document-workspace-surface-slot-renderers.tsx +395 -0
  212. package/src/index.ts +53 -0
  213. package/src/navigation-shell-frame-renderer-registry.ts +29 -0
  214. package/src/navigation-shell-slot-renderer-registry.ts +46 -0
  215. package/src/page-host-unavailable-renderer.tsx +79 -0
  216. package/src/presentation-action-group.tsx +475 -0
  217. package/src/presentation-badge-target-interpreter.ts +54 -0
  218. package/src/presentation-component-groups.ts +2505 -0
  219. package/src/presentation-component-system-diagnostics.ts +848 -0
  220. package/src/presentation-component-system.ts +365 -0
  221. package/src/presentation-icon-diagnostics.ts +53 -0
  222. package/src/presentation-icon-registry.tsx +181 -0
  223. package/src/presentation-projection-trace-panel.tsx +140 -0
  224. package/src/presentation-routed-surface-host.tsx +48 -0
  225. package/src/presentation-shadcn-component-system.ts +102 -0
  226. package/src/presentation-standard-renderers.tsx +1290 -0
  227. package/src/presentation-surface-renderer.tsx +263 -0
  228. package/src/presentation-value-renderers.tsx +40 -0
  229. package/src/process-task-icons.tsx +258 -0
  230. package/src/projected-activity-state.tsx +63 -0
  231. package/src/projected-collection-action-runtime-diagnostics.ts +22 -0
  232. package/src/projected-collection-view.tsx +1273 -0
  233. package/src/projected-document-action-status-notices.tsx +66 -0
  234. package/src/projected-document-badges.tsx +134 -0
  235. package/src/projected-document-editor-surface.tsx +808 -0
  236. package/src/projected-document-workspace-notices.tsx +77 -0
  237. package/src/projected-document-workspace-prompt-child-view-registry.ts +99 -0
  238. package/src/projected-document-workspace-prompt-child-view-renderers.tsx +205 -0
  239. package/src/projected-document-workspace-shell.tsx +427 -0
  240. package/src/projected-document-workspace.tsx +216 -0
  241. package/src/projected-field-value-rendering.tsx +704 -0
  242. package/src/projected-inline-list.tsx +434 -0
  243. package/src/projected-input-form.tsx +1218 -0
  244. package/src/projected-metric-dashboard.tsx +106 -0
  245. package/src/projected-metric-strip.tsx +244 -0
  246. package/src/projected-navigation-shell-view-host.tsx +177 -0
  247. package/src/projected-navigation-shell.tsx +219 -0
  248. package/src/projected-presentation-badges.tsx +95 -0
  249. package/src/projected-presentation-diagnostics.tsx +120 -0
  250. package/src/projected-presentation-flow-layer.tsx +186 -0
  251. package/src/projected-process-task-notices.tsx +501 -0
  252. package/src/projected-prompt-child-view-renderer.tsx +698 -0
  253. package/src/projected-prompt-document-preview.tsx +197 -0
  254. package/src/projected-prompt-view.tsx +592 -0
  255. package/src/projected-query-form.tsx +286 -0
  256. package/src/projected-record-details.tsx +133 -0
  257. package/src/projected-routed-surface-runtime.tsx +713 -0
  258. package/src/projected-tabs-view.tsx +308 -0
  259. package/src/projected-view-chrome.tsx +148 -0
  260. package/src/projected-view-surface.tsx +131 -0
  261. package/src/standard-collection-chrome-slot-renderers.tsx +391 -0
  262. package/src/standard-view-chrome-slot-renderers.tsx +1064 -0
@@ -0,0 +1,391 @@
1
+ import type { ReactNode } from 'react'
2
+
3
+ import {
4
+ collectionChromeIconIds,
5
+ collectionChromeSlotProjectionAnnotationName,
6
+ createCollectionChromeSlotRendererRegistry,
7
+ findPresentationInputForm,
8
+ findPresentationQueryForm,
9
+ getCollectionChromeSlotRendererRegistryKeys,
10
+ resolveCollectionChromeSlotRenderer,
11
+ type CollectionChromeSlotDefinition,
12
+ } from '@cohesivesystems/presentation-core'
13
+ import {
14
+ renderPresentationIcon,
15
+ } from './presentation-icon-registry'
16
+ import type {
17
+ ProjectedCollectionChromeSlotRenderContext,
18
+ } from './projected-collection-view'
19
+ import {
20
+ ProjectedCollectionRowActions,
21
+ ProjectedCollectionSelectionActionToolbar,
22
+ } from './projected-collection-view'
23
+ import {
24
+ collectionChromeSlotKinds,
25
+ collectionChromeSlotPlacements,
26
+ } from '@cohesivesystems/presentation-contracts'
27
+
28
+ /**
29
+ * Default shadcn-backed renderers for the semantic collection chrome slots
30
+ * projected by Cohesive.Presentation.
31
+ *
32
+ * The registry is keyed by slot kind and optional placement so callers can
33
+ * override individual semantic slots while preserving the standard behavior
34
+ * for the rest of the collection surface.
35
+ */
36
+ export const standardCollectionChromeSlotRenderers =
37
+ createCollectionChromeSlotRendererRegistry<
38
+ ProjectedCollectionChromeSlotRenderContext<object>,
39
+ ReactNode
40
+ >([
41
+ {
42
+ kind: collectionChromeSlotKinds.queryForm,
43
+ render: renderStandardCollectionQueryForm,
44
+ },
45
+ {
46
+ kind: collectionChromeSlotKinds.summary,
47
+ render: renderStandardCollectionSummary,
48
+ },
49
+ {
50
+ kind: collectionChromeSlotKinds.pagination,
51
+ placement: collectionChromeSlotPlacements.footer,
52
+ render: renderStandardCollectionPaginationFooter,
53
+ },
54
+ {
55
+ kind: collectionChromeSlotKinds.selectionActions,
56
+ placement: collectionChromeSlotPlacements.toolbar,
57
+ render: renderStandardCollectionSelectionActionsToolbar,
58
+ },
59
+ {
60
+ kind: collectionChromeSlotKinds.detail,
61
+ render: renderStandardCollectionDetail,
62
+ },
63
+ {
64
+ kind: collectionChromeSlotKinds.rowActions,
65
+ placement: collectionChromeSlotPlacements.inline,
66
+ render: renderStandardCollectionRowActions,
67
+ },
68
+ {
69
+ kind: collectionChromeSlotKinds.body,
70
+ placement: collectionChromeSlotPlacements.inline,
71
+ render: renderStandardCollectionBody,
72
+ },
73
+ ])
74
+
75
+ /**
76
+ * Registry keys exposed for diagnostics, documentation, and composition with
77
+ * custom collection chrome slot renderer registries.
78
+ */
79
+ export const standardCollectionChromeSlotRendererKeys =
80
+ getCollectionChromeSlotRendererRegistryKeys(standardCollectionChromeSlotRenderers)
81
+
82
+ /**
83
+ * Renders a collection chrome slot with the standard renderer matching the
84
+ * slot's semantic kind and placement.
85
+ *
86
+ * @param context Rendering context for the projected collection slot.
87
+ * @returns The rendered chrome node, or `null` when no standard renderer
88
+ * matches the slot or the matching renderer elects not to render.
89
+ */
90
+ export function renderStandardCollectionChromeSlot(
91
+ context: ProjectedCollectionChromeSlotRenderContext<object>,
92
+ ) {
93
+ const renderer = resolveCollectionChromeSlotRenderer(
94
+ standardCollectionChromeSlotRenderers,
95
+ context.slot,
96
+ )
97
+ return renderer?.(context) ?? null
98
+ }
99
+
100
+ /**
101
+ * Renders footer pagination from the collection runtime paging window.
102
+ *
103
+ * The slot is omitted when pagination is disabled, no page window is available,
104
+ * or the slot requests suppression of the standard projection.
105
+ */
106
+ function renderStandardCollectionPaginationFooter({
107
+ collectionRuntime,
108
+ componentSet,
109
+ componentSystem,
110
+ module,
111
+ slot,
112
+ viewId,
113
+ }: ProjectedCollectionChromeSlotRenderContext<object>) {
114
+ if (shouldSuppressStandardCollectionChromeSlot(slot)) {
115
+ return null
116
+ }
117
+
118
+ const pagination = collectionRuntime.pagination
119
+ const window = pagination.window
120
+ if (!pagination.isFooterEnabled || !window) {
121
+ return null
122
+ }
123
+
124
+ const pageInfo = window.pageInfo
125
+ const isFetching = pagination.isFetching
126
+ const pageLabel = pageInfo.totalPageCount
127
+ ? `Page ${(pageInfo.pageIndex + 1).toLocaleString()} of ${pageInfo.totalPageCount.toLocaleString()}`
128
+ : `Page ${(pageInfo.pageIndex + 1).toLocaleString()}`
129
+ const totalLabel = typeof pageInfo.totalCount === 'number'
130
+ ? `${pageInfo.totalCount.toLocaleString()} total`
131
+ : `${pageInfo.itemCount.toLocaleString()} shown`
132
+
133
+ return componentSystem.collectionChrome.CollectionPaginationBar({
134
+ canGoNextPage: window.canGoNextPage,
135
+ canGoPreviousPage: window.canGoPreviousPage,
136
+ firstIcon: renderPresentationIcon({
137
+ componentSet,
138
+ icon: collectionChromeIconIds.paginationFirstPage,
139
+ module,
140
+ subject: slot,
141
+ }),
142
+ isFetching,
143
+ loadingIcon: renderPresentationIcon({
144
+ className: 'size-3.5 animate-spin text-sky-700',
145
+ componentSet,
146
+ icon: collectionChromeIconIds.paginationLoading,
147
+ module,
148
+ subject: slot,
149
+ }),
150
+ nextIcon: renderPresentationIcon({
151
+ componentSet,
152
+ icon: collectionChromeIconIds.paginationNextPage,
153
+ module,
154
+ subject: slot,
155
+ }),
156
+ onFirstPage: window.goToFirstPage,
157
+ onNextPage: window.goToNextPage,
158
+ onPreviousPage: window.goToPreviousPage,
159
+ pageLabel,
160
+ pageSizeLabel: `${pageInfo.pageSize.toLocaleString()} per page`,
161
+ previousIcon: renderPresentationIcon({
162
+ componentSet,
163
+ icon: collectionChromeIconIds.paginationPreviousPage,
164
+ module,
165
+ subject: slot,
166
+ }),
167
+ shownLabel: `${pageInfo.itemCount.toLocaleString()} shown`,
168
+ slotId: slot.Id,
169
+ totalLabel,
170
+ viewId,
171
+ })
172
+ }
173
+
174
+ /**
175
+ * Renders the collection query form chrome around the projected query form.
176
+ *
177
+ * Query forms without a backing input form are rendered without the standard
178
+ * chrome wrapper so the backend projection can supply a fully custom surface.
179
+ */
180
+ function renderStandardCollectionQueryForm({
181
+ componentSystem,
182
+ module,
183
+ renderQueryFormSlot,
184
+ slot,
185
+ viewId,
186
+ }: ProjectedCollectionChromeSlotRenderContext<object>) {
187
+ if (shouldSuppressStandardCollectionChromeSlot(slot)) {
188
+ return null
189
+ }
190
+
191
+ if (shouldRenderQueryFormWithoutChrome({ module, slot })) {
192
+ return renderQueryFormSlot?.(slot) ?? null
193
+ }
194
+
195
+ const children = renderQueryFormSlot?.(slot) ?? null
196
+ if (children === null || children === undefined || children === false) {
197
+ return null
198
+ }
199
+
200
+ return componentSystem.collectionChrome.CollectionQueryFormSlot({
201
+ children,
202
+ slotId: slot.Id,
203
+ viewId,
204
+ })
205
+ }
206
+
207
+ /**
208
+ * Determines whether a query-form slot represents a custom projection rather
209
+ * than a standard input form projection.
210
+ */
211
+ function shouldRenderQueryFormWithoutChrome({
212
+ module,
213
+ slot,
214
+ }: Pick<ProjectedCollectionChromeSlotRenderContext<object>, 'module' | 'slot'>) {
215
+ if (!slot.QueryFormId) {
216
+ return false
217
+ }
218
+
219
+ const queryForm = findPresentationQueryForm(module ?? null, slot.QueryFormId)
220
+ return Boolean(
221
+ queryForm &&
222
+ !findPresentationInputForm(module ?? null, queryForm.FormId),
223
+ )
224
+ }
225
+
226
+ /**
227
+ * Renders the summary slot using the component system's collection chrome
228
+ * wrapper and the caller-provided summary projection.
229
+ */
230
+ function renderStandardCollectionSummary({
231
+ componentSystem,
232
+ renderSummarySlot,
233
+ slot,
234
+ viewId,
235
+ }: ProjectedCollectionChromeSlotRenderContext<object>) {
236
+ if (shouldSuppressStandardCollectionChromeSlot(slot)) {
237
+ return null
238
+ }
239
+
240
+ return componentSystem.collectionChrome.CollectionSummarySlot({
241
+ children: renderSummarySlot?.(slot) ?? null,
242
+ slotId: slot.Id,
243
+ viewId,
244
+ })
245
+ }
246
+
247
+ /**
248
+ * Renders the toolbar surface for actions that target the current collection
249
+ * selection.
250
+ */
251
+ function renderStandardCollectionSelectionActionsToolbar({
252
+ canExecuteAction,
253
+ collectionRuntime,
254
+ componentSet,
255
+ componentSystem,
256
+ executeAction,
257
+ module,
258
+ renderActionIcon,
259
+ slot,
260
+ }: ProjectedCollectionChromeSlotRenderContext<object>) {
261
+ if (shouldSuppressStandardCollectionChromeSlot(slot)) {
262
+ return null
263
+ }
264
+
265
+ return (
266
+ <ProjectedCollectionSelectionActionToolbar
267
+ canExecuteAction={canExecuteAction}
268
+ collectionRuntime={collectionRuntime}
269
+ componentSet={componentSet}
270
+ componentSystem={componentSystem}
271
+ executeAction={executeAction}
272
+ module={module}
273
+ renderActionIcon={renderActionIcon}
274
+ slot={slot}
275
+ />
276
+ )
277
+ }
278
+
279
+ /**
280
+ * Renders the detail slot using the component system's collection chrome
281
+ * wrapper and the caller-provided detail projection.
282
+ */
283
+ function renderStandardCollectionDetail({
284
+ componentSystem,
285
+ renderDetailSlot,
286
+ slot,
287
+ viewId,
288
+ }: ProjectedCollectionChromeSlotRenderContext<object>) {
289
+ if (shouldSuppressStandardCollectionChromeSlot(slot)) {
290
+ return null
291
+ }
292
+
293
+ return componentSystem.collectionChrome.CollectionDetailSlot({
294
+ children: renderDetailSlot?.(slot) ?? null,
295
+ slotId: slot.Id,
296
+ viewId,
297
+ })
298
+ }
299
+
300
+ /**
301
+ * Renders the body slot using the component system's collection chrome wrapper
302
+ * and the caller-provided body projection.
303
+ */
304
+ function renderStandardCollectionBody({
305
+ componentSystem,
306
+ renderBodySlot,
307
+ slot,
308
+ viewId,
309
+ }: ProjectedCollectionChromeSlotRenderContext<object>) {
310
+ if (shouldSuppressStandardCollectionChromeSlot(slot)) {
311
+ return null
312
+ }
313
+
314
+ return componentSystem.collectionChrome.CollectionBodySlot({
315
+ children: renderBodySlot?.(slot) ?? null,
316
+ slotId: slot.Id,
317
+ viewId,
318
+ })
319
+ }
320
+
321
+ /**
322
+ * Renders row-scoped actions for the current collection row.
323
+ *
324
+ * A caller-provided row action slot renderer takes precedence over the standard
325
+ * projected row action component. The slot is skipped outside row context.
326
+ */
327
+ function renderStandardCollectionRowActions({
328
+ canExecuteAction,
329
+ collectionRuntime,
330
+ componentSet,
331
+ componentSystem,
332
+ executeAction,
333
+ module,
334
+ renderActionIcon,
335
+ renderRowActionsSlot,
336
+ row,
337
+ rowLabel,
338
+ slot,
339
+ viewId,
340
+ }: ProjectedCollectionChromeSlotRenderContext<object>) {
341
+ if (shouldSuppressStandardCollectionChromeSlot(slot) || !row) {
342
+ return null
343
+ }
344
+
345
+ return renderRowActionsSlot?.(slot, row, rowLabel ?? null) ?? (
346
+ <ProjectedCollectionRowActions
347
+ canExecuteAction={canExecuteAction}
348
+ collectionRuntime={collectionRuntime}
349
+ componentSet={componentSet}
350
+ componentSystem={componentSystem}
351
+ executeAction={executeAction}
352
+ module={module}
353
+ renderActionIcon={renderActionIcon}
354
+ row={row}
355
+ rowLabel={rowLabel ?? null}
356
+ slot={slot}
357
+ viewId={viewId}
358
+ />
359
+ )
360
+ }
361
+
362
+ /**
363
+ * Checks whether a slot's projection annotation opts out of the standard
364
+ * renderer.
365
+ *
366
+ * A boolean annotation value suppresses directly. Object annotation values use
367
+ * `suppressDefaultRenderer` so other projection options can share the same
368
+ * annotation payload.
369
+ */
370
+ function shouldSuppressStandardCollectionChromeSlot(
371
+ slot: CollectionChromeSlotDefinition,
372
+ ) {
373
+ return slot.Annotations.some((annotation) => {
374
+ if (annotation.Name.toLocaleLowerCase() !== collectionChromeSlotProjectionAnnotationName) {
375
+ return false
376
+ }
377
+
378
+ const value = annotation.Value
379
+ if (typeof value === 'boolean') {
380
+ return value
381
+ }
382
+
383
+ if (!value || typeof value !== 'object') {
384
+ return false
385
+ }
386
+
387
+ return Boolean(
388
+ (value as Readonly<Record<string, unknown>>).suppressDefaultRenderer,
389
+ )
390
+ })
391
+ }