@wildo-ai/saas-frontend-lib 1.1.15 → 1.1.17

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 (241) hide show
  1. package/dist/esm/components/compliance/EmbeddedSigningFrame.d.ts.map +1 -1
  2. package/dist/esm/components/compliance/EmbeddedSigningFrame.js +17 -6
  3. package/dist/esm/components/compliance/EmbeddedSigningFrame.js.map +1 -1
  4. package/dist/esm/components/data-display/approval-seal.d.ts +7 -5
  5. package/dist/esm/components/data-display/approval-seal.d.ts.map +1 -1
  6. package/dist/esm/components/data-display/approval-seal.js +10 -4
  7. package/dist/esm/components/data-display/approval-seal.js.map +1 -1
  8. package/dist/esm/components/data-display/signature-requests.d.ts +81 -0
  9. package/dist/esm/components/data-display/signature-requests.d.ts.map +1 -0
  10. package/dist/esm/components/data-display/signature-requests.js +123 -0
  11. package/dist/esm/components/data-display/signature-requests.js.map +1 -0
  12. package/dist/esm/components/flows-actors/approval.d.ts.map +1 -1
  13. package/dist/esm/components/flows-actors/approval.js +8 -15
  14. package/dist/esm/components/flows-actors/approval.js.map +1 -1
  15. package/dist/esm/components/flows-actors/approval.labels.d.ts.map +1 -1
  16. package/dist/esm/components/flows-actors/approval.labels.js +3 -0
  17. package/dist/esm/components/flows-actors/approval.labels.js.map +1 -1
  18. package/dist/esm/components/flows-actors/task-detail.d.ts +12 -1
  19. package/dist/esm/components/flows-actors/task-detail.d.ts.map +1 -1
  20. package/dist/esm/components/flows-actors/task-detail.js +2 -2
  21. package/dist/esm/components/flows-actors/task-detail.js.map +1 -1
  22. package/dist/esm/components/form/automated/ResourceAutomatedForm.d.ts.map +1 -1
  23. package/dist/esm/components/form/automated/ResourceAutomatedForm.js +44 -29
  24. package/dist/esm/components/form/automated/ResourceAutomatedForm.js.map +1 -1
  25. package/dist/esm/components/navigation/NavigationItemBadge.d.ts +16 -0
  26. package/dist/esm/components/navigation/NavigationItemBadge.d.ts.map +1 -1
  27. package/dist/esm/components/navigation/NavigationItemBadge.js +14 -2
  28. package/dist/esm/components/navigation/NavigationItemBadge.js.map +1 -1
  29. package/dist/esm/components/navigation/app-level/ApplicationLevel_NavigationBack.d.ts +3 -3
  30. package/dist/esm/components/navigation/app-level/ApplicationLevel_NavigationBack.js +3 -3
  31. package/dist/esm/components/navigation/app-level/ApplicationLevel_NavigationBack.js.map +1 -1
  32. package/dist/esm/components/navigation/app-level/SidebarResourceBrowser.d.ts +5 -13
  33. package/dist/esm/components/navigation/app-level/SidebarResourceBrowser.d.ts.map +1 -1
  34. package/dist/esm/components/navigation/app-level/SidebarResourceBrowser.js +30 -255
  35. package/dist/esm/components/navigation/app-level/SidebarResourceBrowser.js.map +1 -1
  36. package/dist/esm/components/navigation/app-level/useCommandMenuBehavior.d.ts +22 -1
  37. package/dist/esm/components/navigation/app-level/useCommandMenuBehavior.d.ts.map +1 -1
  38. package/dist/esm/components/navigation/app-level/useCommandMenuBehavior.js +57 -26
  39. package/dist/esm/components/navigation/app-level/useCommandMenuBehavior.js.map +1 -1
  40. package/dist/esm/components/navigation/app-level/useMenuBarBehavior.d.ts +1 -1
  41. package/dist/esm/components/navigation/app-level/useMenuBarBehavior.d.ts.map +1 -1
  42. package/dist/esm/components/navigation/app-level/useMenuBarBehavior.js +35 -1
  43. package/dist/esm/components/navigation/app-level/useMenuBarBehavior.js.map +1 -1
  44. package/dist/esm/components/navigation/app-level/useMenuUserOrgBehavior.d.ts +1 -1
  45. package/dist/esm/components/navigation/app-level/useMenuUserOrgBehavior.d.ts.map +1 -1
  46. package/dist/esm/components/navigation/app-level/useMenuUserOrgBehavior.js +26 -4
  47. package/dist/esm/components/navigation/app-level/useMenuUserOrgBehavior.js.map +1 -1
  48. package/dist/esm/components/navigation/app-level/useNavigationBackBehavior.d.ts +31 -0
  49. package/dist/esm/components/navigation/app-level/useNavigationBackBehavior.d.ts.map +1 -0
  50. package/dist/esm/components/navigation/app-level/useNavigationBackBehavior.js +42 -0
  51. package/dist/esm/components/navigation/app-level/useNavigationBackBehavior.js.map +1 -0
  52. package/dist/esm/components/navigation/app-level/useSidebarResourceBrowser.d.ts +76 -0
  53. package/dist/esm/components/navigation/app-level/useSidebarResourceBrowser.d.ts.map +1 -0
  54. package/dist/esm/components/navigation/app-level/useSidebarResourceBrowser.js +268 -0
  55. package/dist/esm/components/navigation/app-level/useSidebarResourceBrowser.js.map +1 -0
  56. package/dist/esm/components/navigation/command.d.ts +5 -0
  57. package/dist/esm/components/navigation/command.d.ts.map +1 -1
  58. package/dist/esm/components/navigation/command.js.map +1 -1
  59. package/dist/esm/components/resources/ResourceLayout_DangerZone.d.ts.map +1 -1
  60. package/dist/esm/components/resources/ResourceLayout_DangerZone.js +5 -2
  61. package/dist/esm/components/resources/ResourceLayout_DangerZone.js.map +1 -1
  62. package/dist/esm/components/resources/ResourceLayout_InsertedViews.d.ts.map +1 -1
  63. package/dist/esm/components/resources/ResourceLayout_InsertedViews.js +5 -1
  64. package/dist/esm/components/resources/ResourceLayout_InsertedViews.js.map +1 -1
  65. package/dist/esm/components/resources/ResourceLayout_List.d.ts.map +1 -1
  66. package/dist/esm/components/resources/ResourceLayout_List.js +4 -1
  67. package/dist/esm/components/resources/ResourceLayout_List.js.map +1 -1
  68. package/dist/esm/components/resources/ResourceLayout_RecordSharing.d.ts.map +1 -1
  69. package/dist/esm/components/resources/ResourceLayout_RecordSharing.js +4 -1
  70. package/dist/esm/components/resources/ResourceLayout_RecordSharing.js.map +1 -1
  71. package/dist/esm/components/resources/collection/board/ResourceCollectionBody_Board.d.ts.map +1 -1
  72. package/dist/esm/components/resources/collection/board/ResourceCollectionBody_Board.js +4 -1
  73. package/dist/esm/components/resources/collection/board/ResourceCollectionBody_Board.js.map +1 -1
  74. package/dist/esm/components/resources/collection/calendar/ResourceCollectionBody_Calendar.d.ts.map +1 -1
  75. package/dist/esm/components/resources/collection/calendar/ResourceCollectionBody_Calendar.js +4 -1
  76. package/dist/esm/components/resources/collection/calendar/ResourceCollectionBody_Calendar.js.map +1 -1
  77. package/dist/esm/components/resources/collection/timeline/ResourceCollectionBody_Timeline.d.ts.map +1 -1
  78. package/dist/esm/components/resources/collection/timeline/ResourceCollectionBody_Timeline.js +4 -1
  79. package/dist/esm/components/resources/collection/timeline/ResourceCollectionBody_Timeline.js.map +1 -1
  80. package/dist/esm/components/resources/skeleton/Group.d.ts.map +1 -1
  81. package/dist/esm/components/resources/skeleton/Group.js +4 -1
  82. package/dist/esm/components/resources/skeleton/Group.js.map +1 -1
  83. package/dist/esm/components/sections/ContentSectionContainer.d.ts.map +1 -1
  84. package/dist/esm/components/sections/ContentSectionContainer.js +11 -7
  85. package/dist/esm/components/sections/ContentSectionContainer.js.map +1 -1
  86. package/dist/esm/components/sections/content-section.d.ts +1 -3
  87. package/dist/esm/components/sections/content-section.d.ts.map +1 -1
  88. package/dist/esm/components/sections/content-section.js.map +1 -1
  89. package/dist/esm/components/settings/AppPage_AgentActivitySettings.d.ts +79 -0
  90. package/dist/esm/components/settings/AppPage_AgentActivitySettings.d.ts.map +1 -0
  91. package/dist/esm/components/settings/AppPage_AgentActivitySettings.js +272 -0
  92. package/dist/esm/components/settings/AppPage_AgentActivitySettings.js.map +1 -0
  93. package/dist/esm/components/settings/AppPage_AgentActivitySettings.labels.d.ts +3 -0
  94. package/dist/esm/components/settings/AppPage_AgentActivitySettings.labels.d.ts.map +1 -0
  95. package/dist/esm/components/settings/AppPage_AgentActivitySettings.labels.js +66 -0
  96. package/dist/esm/components/settings/AppPage_AgentActivitySettings.labels.js.map +1 -0
  97. package/dist/esm/components/settings/AppPage_ConnectedAccountsSettings.d.ts +12 -0
  98. package/dist/esm/components/settings/AppPage_ConnectedAccountsSettings.d.ts.map +1 -1
  99. package/dist/esm/components/settings/AppPage_ConnectedAccountsSettings.js +28 -6
  100. package/dist/esm/components/settings/AppPage_ConnectedAccountsSettings.js.map +1 -1
  101. package/dist/esm/components/settings/SettingsHub.d.ts.map +1 -1
  102. package/dist/esm/components/settings/SettingsHub.js +6 -0
  103. package/dist/esm/components/settings/SettingsHub.js.map +1 -1
  104. package/dist/esm/components/typography/document-heading-level.d.ts +28 -0
  105. package/dist/esm/components/typography/document-heading-level.d.ts.map +1 -0
  106. package/dist/esm/components/typography/document-heading-level.js +63 -0
  107. package/dist/esm/components/typography/document-heading-level.js.map +1 -0
  108. package/dist/esm/components/views/chart-view/ChartView.d.ts.map +1 -1
  109. package/dist/esm/components/views/chart-view/ChartView.js +20 -16
  110. package/dist/esm/components/views/chart-view/ChartView.js.map +1 -1
  111. package/dist/esm/components/views/chart-view/ChartView.labels.d.ts.map +1 -1
  112. package/dist/esm/components/views/chart-view/ChartView.labels.js +7 -0
  113. package/dist/esm/components/views/chart-view/ChartView.labels.js.map +1 -1
  114. package/dist/esm/components/views/chart-view/option-builder/builder-utils.d.ts +12 -3
  115. package/dist/esm/components/views/chart-view/option-builder/builder-utils.d.ts.map +1 -1
  116. package/dist/esm/components/views/chart-view/option-builder/builder-utils.js +18 -11
  117. package/dist/esm/components/views/chart-view/option-builder/builder-utils.js.map +1 -1
  118. package/dist/esm/components/views/chart-view/option-builder/builders/bar-family.builder.d.ts.map +1 -1
  119. package/dist/esm/components/views/chart-view/option-builder/builders/bar-family.builder.js +2 -1
  120. package/dist/esm/components/views/chart-view/option-builder/builders/bar-family.builder.js.map +1 -1
  121. package/dist/esm/components/views/chart-view/option-builder/builders/funnel.builder.d.ts.map +1 -1
  122. package/dist/esm/components/views/chart-view/option-builder/builders/funnel.builder.js +7 -3
  123. package/dist/esm/components/views/chart-view/option-builder/builders/funnel.builder.js.map +1 -1
  124. package/dist/esm/components/views/chart-view/option-builder/builders/gauge.builder.d.ts.map +1 -1
  125. package/dist/esm/components/views/chart-view/option-builder/builders/gauge.builder.js +6 -2
  126. package/dist/esm/components/views/chart-view/option-builder/builders/gauge.builder.js.map +1 -1
  127. package/dist/esm/components/views/chart-view/option-builder/builders/heatmap.builder.d.ts.map +1 -1
  128. package/dist/esm/components/views/chart-view/option-builder/builders/heatmap.builder.js +7 -1
  129. package/dist/esm/components/views/chart-view/option-builder/builders/heatmap.builder.js.map +1 -1
  130. package/dist/esm/components/views/chart-view/option-builder/builders/hierarchical-family.builder.d.ts.map +1 -1
  131. package/dist/esm/components/views/chart-view/option-builder/builders/hierarchical-family.builder.js +13 -9
  132. package/dist/esm/components/views/chart-view/option-builder/builders/hierarchical-family.builder.js.map +1 -1
  133. package/dist/esm/components/views/chart-view/option-builder/builders/line-family.builder.d.ts.map +1 -1
  134. package/dist/esm/components/views/chart-view/option-builder/builders/line-family.builder.js +2 -1
  135. package/dist/esm/components/views/chart-view/option-builder/builders/line-family.builder.js.map +1 -1
  136. package/dist/esm/components/views/chart-view/option-builder/builders/parallel.builder.d.ts.map +1 -1
  137. package/dist/esm/components/views/chart-view/option-builder/builders/parallel.builder.js +2 -1
  138. package/dist/esm/components/views/chart-view/option-builder/builders/parallel.builder.js.map +1 -1
  139. package/dist/esm/components/views/chart-view/option-builder/builders/pie-family.builder.d.ts.map +1 -1
  140. package/dist/esm/components/views/chart-view/option-builder/builders/pie-family.builder.js +4 -3
  141. package/dist/esm/components/views/chart-view/option-builder/builders/pie-family.builder.js.map +1 -1
  142. package/dist/esm/components/views/chart-view/option-builder/builders/radar.builder.d.ts.map +1 -1
  143. package/dist/esm/components/views/chart-view/option-builder/builders/radar.builder.js +2 -1
  144. package/dist/esm/components/views/chart-view/option-builder/builders/radar.builder.js.map +1 -1
  145. package/dist/esm/components/views/chart-view/option-builder/builders/sankey.builder.d.ts.map +1 -1
  146. package/dist/esm/components/views/chart-view/option-builder/builders/sankey.builder.js +5 -1
  147. package/dist/esm/components/views/chart-view/option-builder/builders/sankey.builder.js.map +1 -1
  148. package/dist/esm/components/views/chart-view/option-builder/builders/statistical-family.builder.d.ts.map +1 -1
  149. package/dist/esm/components/views/chart-view/option-builder/builders/statistical-family.builder.js +4 -3
  150. package/dist/esm/components/views/chart-view/option-builder/builders/statistical-family.builder.js.map +1 -1
  151. package/dist/esm/components/views/composite-view/CompositeView.d.ts +6 -0
  152. package/dist/esm/components/views/composite-view/CompositeView.d.ts.map +1 -1
  153. package/dist/esm/components/views/composite-view/CompositeView.js +12 -2
  154. package/dist/esm/components/views/composite-view/CompositeView.js.map +1 -1
  155. package/dist/esm/components/views/flows-actors-view/ConversationLinkPage.d.ts +57 -0
  156. package/dist/esm/components/views/flows-actors-view/ConversationLinkPage.d.ts.map +1 -0
  157. package/dist/esm/components/views/flows-actors-view/ConversationLinkPage.js +136 -0
  158. package/dist/esm/components/views/flows-actors-view/ConversationLinkPage.js.map +1 -0
  159. package/dist/esm/components/views/flows-actors-view/FlowsActorsView.d.ts +20 -0
  160. package/dist/esm/components/views/flows-actors-view/FlowsActorsView.d.ts.map +1 -1
  161. package/dist/esm/components/views/flows-actors-view/FlowsActorsView.js +139 -22
  162. package/dist/esm/components/views/flows-actors-view/FlowsActorsView.js.map +1 -1
  163. package/dist/esm/components/views/flows-actors-view/FlowsActorsView.labels.d.ts.map +1 -1
  164. package/dist/esm/components/views/flows-actors-view/FlowsActorsView.labels.js +5 -0
  165. package/dist/esm/components/views/flows-actors-view/FlowsActorsView.labels.js.map +1 -1
  166. package/dist/esm/components/views/flows-actors-view/held-conversation-selection.d.ts +4 -0
  167. package/dist/esm/components/views/flows-actors-view/held-conversation-selection.d.ts.map +1 -1
  168. package/dist/esm/components/views/flows-actors-view/held-conversation-selection.js +19 -0
  169. package/dist/esm/components/views/flows-actors-view/held-conversation-selection.js.map +1 -1
  170. package/dist/esm/components/views/flows-actors-view/linked-conversation.context.d.ts +26 -0
  171. package/dist/esm/components/views/flows-actors-view/linked-conversation.context.d.ts.map +1 -0
  172. package/dist/esm/components/views/flows-actors-view/linked-conversation.context.js +3 -0
  173. package/dist/esm/components/views/flows-actors-view/linked-conversation.context.js.map +1 -0
  174. package/dist/esm/core/app-shell/app-shell.schemas.d.ts +87 -16
  175. package/dist/esm/core/app-shell/app-shell.schemas.d.ts.map +1 -1
  176. package/dist/esm/core/app-shell/app-shell.schemas.js +16 -0
  177. package/dist/esm/core/app-shell/app-shell.schemas.js.map +1 -1
  178. package/dist/esm/core/components-registry/assert-registry-completeness.frontend.helper.d.ts.map +1 -1
  179. package/dist/esm/core/components-registry/assert-registry-completeness.frontend.helper.js +1 -0
  180. package/dist/esm/core/components-registry/assert-registry-completeness.frontend.helper.js.map +1 -1
  181. package/dist/esm/core/config/composite-view.schemas.d.ts +19 -0
  182. package/dist/esm/core/config/composite-view.schemas.d.ts.map +1 -1
  183. package/dist/esm/core/config/composite-view.schemas.js.map +1 -1
  184. package/dist/esm/core/config/engine-settings-destinations.d.ts.map +1 -1
  185. package/dist/esm/core/config/engine-settings-destinations.js +23 -0
  186. package/dist/esm/core/config/engine-settings-destinations.js.map +1 -1
  187. package/dist/esm/core/config/settings-hub-presentation.frontend.utils.d.ts.map +1 -1
  188. package/dist/esm/core/config/settings-hub-presentation.frontend.utils.js +3 -0
  189. package/dist/esm/core/config/settings-hub-presentation.frontend.utils.js.map +1 -1
  190. package/dist/esm/core/config/settings-hub.frontend.schemas.d.ts +12 -0
  191. package/dist/esm/core/config/settings-hub.frontend.schemas.d.ts.map +1 -1
  192. package/dist/esm/core/config/settings-hub.frontend.schemas.js +12 -0
  193. package/dist/esm/core/config/settings-hub.frontend.schemas.js.map +1 -1
  194. package/dist/esm/core/events/events.frontend.schemas.d.ts +16 -0
  195. package/dist/esm/core/events/events.frontend.schemas.d.ts.map +1 -1
  196. package/dist/esm/core/flows-actors/FlowsActorsContext.d.ts +10 -1
  197. package/dist/esm/core/flows-actors/FlowsActorsContext.d.ts.map +1 -1
  198. package/dist/esm/core/flows-actors/FlowsActorsContext.js +12 -3
  199. package/dist/esm/core/flows-actors/FlowsActorsContext.js.map +1 -1
  200. package/dist/esm/core/flows-actors/conversation-history.model.d.ts +19 -1
  201. package/dist/esm/core/flows-actors/conversation-history.model.d.ts.map +1 -1
  202. package/dist/esm/core/flows-actors/conversation-history.model.js +45 -4
  203. package/dist/esm/core/flows-actors/conversation-history.model.js.map +1 -1
  204. package/dist/esm/core/navigation/NavigationContentAreas.d.ts +0 -5
  205. package/dist/esm/core/navigation/NavigationContentAreas.d.ts.map +1 -1
  206. package/dist/esm/core/navigation/NavigationContentAreas.js +27 -1
  207. package/dist/esm/core/navigation/NavigationContentAreas.js.map +1 -1
  208. package/dist/esm/core/navigation/navigation.schemas.d.ts +20 -0
  209. package/dist/esm/core/navigation/navigation.schemas.d.ts.map +1 -1
  210. package/dist/esm/core/navigation/navigation.schemas.js +4 -0
  211. package/dist/esm/core/navigation/navigation.schemas.js.map +1 -1
  212. package/dist/esm/core/navigation/useNavigationRouterSync.d.ts.map +1 -1
  213. package/dist/esm/core/navigation/useNavigationRouterSync.js +5 -1
  214. package/dist/esm/core/navigation/useNavigationRouterSync.js.map +1 -1
  215. package/dist/esm/core/requests/wildo-http-client-manual-calls.frontend.service.d.ts +59 -5
  216. package/dist/esm/core/requests/wildo-http-client-manual-calls.frontend.service.d.ts.map +1 -1
  217. package/dist/esm/core/requests/wildo-http-client-manual-calls.frontend.service.js +58 -1
  218. package/dist/esm/core/requests/wildo-http-client-manual-calls.frontend.service.js.map +1 -1
  219. package/dist/esm/core/resources/hooks/useOperationEnabled.d.ts.map +1 -1
  220. package/dist/esm/core/resources/hooks/useOperationEnabled.js +41 -3
  221. package/dist/esm/core/resources/hooks/useOperationEnabled.js.map +1 -1
  222. package/dist/esm/core/resources/resources-repository.frontend.service.d.ts.map +1 -1
  223. package/dist/esm/core/resources/resources-repository.frontend.service.js +2 -0
  224. package/dist/esm/core/resources/resources-repository.frontend.service.js.map +1 -1
  225. package/dist/esm/core/runtime/AppRouter.d.ts.map +1 -1
  226. package/dist/esm/core/runtime/AppRouter.js +2 -1
  227. package/dist/esm/core/runtime/AppRouter.js.map +1 -1
  228. package/dist/esm/core/runtime/routes.frontend.definitions.d.ts +6 -0
  229. package/dist/esm/core/runtime/routes.frontend.definitions.d.ts.map +1 -1
  230. package/dist/esm/core/runtime/routes.frontend.definitions.js +7 -1
  231. package/dist/esm/core/runtime/routes.frontend.definitions.js.map +1 -1
  232. package/dist/esm/core/search/command-score.d.ts +33 -0
  233. package/dist/esm/core/search/command-score.d.ts.map +1 -0
  234. package/dist/esm/core/search/command-score.js +109 -0
  235. package/dist/esm/core/search/command-score.js.map +1 -0
  236. package/dist/esm/index.d.ts +5 -0
  237. package/dist/esm/index.d.ts.map +1 -1
  238. package/dist/esm/index.js +5 -0
  239. package/dist/esm/index.js.map +1 -1
  240. package/dist/tsconfig.build.tsbuildinfo +1 -1
  241. package/package.json +6 -6
@@ -1 +1 @@
1
- {"version":3,"file":"ResourceLayout_RecordSharing.d.ts","sourceRoot":"","sources":["../../../../src/components/resources/ResourceLayout_RecordSharing.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAwC,MAAM,OAAO,CAAC;AAS7D,OAAO,EAAuD,KAAK,kBAAkB,EAAE,MAAM,qCAAqC,CAAC;AAYnI,OAAO,KAAK,EAA2C,yBAAyB,EAAE,MAAM,+DAA+D,CAAC;AAWxJ,OAAO,EAA6B,KAAK,sBAAsB,EAAE,MAAM,yDAAyD,CAAC;AAEjI,OAAO,EAAE,oBAAoB,EAAE,MAAM,kFAAkF,CAAC;AAExH,OAAO,EAAE,wBAAwB,EAAE,MAAM,qDAAqD,CAAC;AAG/F,MAAM,WAAW,+CAAgD,SAAQ,wBAAwB;IAC/F,uEAAuE;IACvE,aAAa,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IACpC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,+HAA+H;IAC/H,kBAAkB,CAAC,EAAE,kBAAkB,CAAC;CACzC;AAQD;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,sBAAsB,CAAC,KAAK,EAAE;IAC5C,QAAQ,CAAC,QAAQ,EAAE,yBAAyB,GAAG,SAAS,CAAC;IACzD,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,QAAQ,EAAE,MAAM,G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,KAAK,EAAE;IAC5C,QAAQ,CAAC,QAAQ,EAAE,yBAAyB,GAAG,SAAS,CAAC;IACzD,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAC;IACtC,QAAQ,CAAC,oBAAoB,EAAE,MAAM,GAAG,SAAS,CAAC;IAClD,QAAQ,CAAC,qBAAqB,EAAE,MAAM,GAAG,SAAS,CAAC;IACnD,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;IACzB,QAAQ,CAAC,MAAM,EAAE,sBAAsB,CAAC;CACzC,GAAG,OAAO,CAcV;AAED;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,0CAA0C,GAAI,oEAKxD,+CAA+C,KAAG,KAAK,CAAC,GAAG,CAAC,OAAO,GAAG,IAuMxE,CAAC;AAEF,wBAAgB,4BAA4B,CAAC,EAAE,MAAgC,EAAE,GAAG,KAAK,EAAE,EAAE,+CAA+C,GAAG,oBAAoB,GAAG,KAAK,CAAC,GAAG,CAAC,OAAO,CAGtL"}
@@ -8,6 +8,7 @@ import { Select } from '../../components/form/controls/enum/select.js';
8
8
  import { Card } from '../../components/sections/card.js';
9
9
  import { optionalMaxInlineSizeStyle } from '../../components/sections/surface.js';
10
10
  import { Heading } from '../../components/typography/heading.js';
11
+ import { useDocumentHeadingLevel } from '../../components/typography/document-heading-level.js';
11
12
  import { Strong, Text, TextSize, TextVariant } from '../../components/typography/text.js';
12
13
  import { OperationsConfirmCritical } from '../../components/feedback/operations-confirm-critical.js';
13
14
  import { useI18n } from '../../core/i18n/useI18n.js';
@@ -75,6 +76,8 @@ export function isRecordSharingOffered(input) {
75
76
  */
76
77
  export const ResourceLayoutPreset_RecordSharing_Default = ({ resourceContext, currentObject, className, responsiveMaxWidth, }) => {
77
78
  const { resourceType } = resourceContext;
79
+ // The panel's title takes the outline's level on the record page, never a fixed `h3` under the title's `h1` (#3867).
80
+ const headingLevel = useDocumentHeadingLevel();
78
81
  const { tComponent, formatList } = useI18n({ component: FrontendComponentType.RESOURCES_LAYOUTS_RECORD_SHARING, resource: resourceType });
79
82
  // Every word here is a declared label (`ResourceLayout_RecordSharing.labels.ts`); an ungenerated one renders as its key.
80
83
  const label = (key, params) => tComponent(FrontendComponentType.RESOURCES_LAYOUTS_RECORD_SHARING, key, params);
@@ -166,7 +169,7 @@ export const ResourceLayoutPreset_RecordSharing_Default = ({ resourceContext, cu
166
169
  else
167
170
  run(() => sharing.share(relationshipId));
168
171
  };
169
- return (_jsxs("section", { "data-slot": "record-sharing-section", "data-inline-size-tier": responsiveMaxWidth, className: cn('mr-auto w-full flex flex-col gap-field-sm', className), style: optionalMaxInlineSizeStyle(responsiveMaxWidth), children: [_jsx(Heading, { level: 3, children: label('title') }), _jsx(Card, { className: "rounded-xl p-0 overflow-hidden divide-y divide-border", children: sharing.readState === RecordSharingReadState.FAILED ? (_jsx("div", { className: "px-card py-card", children: _jsx(Text, { variant: TextVariant.MUTED, size: TextSize.SM, children: label('readFailed') }) })) : (_jsxs(_Fragment, { children: [_jsxs("div", { className: "flex flex-col gap-element-xs px-card py-card", children: [_jsx(Text, { size: TextSize.SM, children: sharing.viaRelationshipId === null ? label('ownRecord') : label('createdThrough', { relationship: nameOf(sharing.viaRelationshipId) }) }), sharing.viaRelationshipId !== null && !creatingRelationship?.confersNow && (_jsx(Text, { variant: TextVariant.MUTED, size: TextSize.SM, children: label('relationshipInactive') })), sharing.viaRelationshipId !== null && creatingRelationship?.confersNow && !creatingRelationship.rolesReachRecord && (_jsx(Text, { variant: TextVariant.MUTED, size: TextSize.SM, children: label('creatorCannotRead') })), _jsx(Text, { variant: TextVariant.MUTED, size: TextSize.SM, children: sharing.commonToEveryRelationship ? label('commonToEveryRelationship') : unreadable ? label('notReadableByRelationships') : label('description') }), alreadyReading.length > 0 && !sharing.commonToEveryRelationship && (_jsx(Text, { variant: TextVariant.MUTED, size: TextSize.SM, children: label('alreadyReadBy', { relationships: formatList(alreadyReading.map((relationship) => nameOf(relationship.relationshipId))) }) }))] }), sharing.sharedWithRelationshipIds.length === 0 ? (_jsx("div", { className: "px-card py-card", children: _jsx(Text, { variant: TextVariant.MUTED, size: TextSize.SM, children: label('notShared') }) })) : sharing.sharedWithRelationshipIds.map((relationshipId) => {
172
+ return (_jsxs("section", { "data-slot": "record-sharing-section", "data-inline-size-tier": responsiveMaxWidth, className: cn('mr-auto w-full flex flex-col gap-field-sm', className), style: optionalMaxInlineSizeStyle(responsiveMaxWidth), children: [_jsx(Heading, { level: headingLevel, children: label('title') }), _jsx(Card, { className: "rounded-xl p-0 overflow-hidden divide-y divide-border", children: sharing.readState === RecordSharingReadState.FAILED ? (_jsx("div", { className: "px-card py-card", children: _jsx(Text, { variant: TextVariant.MUTED, size: TextSize.SM, children: label('readFailed') }) })) : (_jsxs(_Fragment, { children: [_jsxs("div", { className: "flex flex-col gap-element-xs px-card py-card", children: [_jsx(Text, { size: TextSize.SM, children: sharing.viaRelationshipId === null ? label('ownRecord') : label('createdThrough', { relationship: nameOf(sharing.viaRelationshipId) }) }), sharing.viaRelationshipId !== null && !creatingRelationship?.confersNow && (_jsx(Text, { variant: TextVariant.MUTED, size: TextSize.SM, children: label('relationshipInactive') })), sharing.viaRelationshipId !== null && creatingRelationship?.confersNow && !creatingRelationship.rolesReachRecord && (_jsx(Text, { variant: TextVariant.MUTED, size: TextSize.SM, children: label('creatorCannotRead') })), _jsx(Text, { variant: TextVariant.MUTED, size: TextSize.SM, children: sharing.commonToEveryRelationship ? label('commonToEveryRelationship') : unreadable ? label('notReadableByRelationships') : label('description') }), alreadyReading.length > 0 && !sharing.commonToEveryRelationship && (_jsx(Text, { variant: TextVariant.MUTED, size: TextSize.SM, children: label('alreadyReadBy', { relationships: formatList(alreadyReading.map((relationship) => nameOf(relationship.relationshipId))) }) }))] }), sharing.sharedWithRelationshipIds.length === 0 ? (_jsx("div", { className: "px-card py-card", children: _jsx(Text, { variant: TextVariant.MUTED, size: TextSize.SM, children: label('notShared') }) })) : sharing.sharedWithRelationshipIds.map((relationshipId) => {
170
173
  const note = shareNote(relationshipId);
171
174
  return (_jsxs("div", { "data-slot": "record-sharing-share", className: "flex flex-col gap-field px-card py-card sm:flex-row sm:items-center sm:justify-between", children: [_jsxs("div", { className: "flex flex-col gap-element-xs", children: [_jsx(Strong, { children: nameOf(relationshipId) }), note !== undefined && _jsx(Text, { variant: TextVariant.MUTED, size: TextSize.SM, children: note })] }), _jsx(Button, { variant: ButtonVariants_Variant.OUTLINE, disabled: disabled, onClick: () => run(() => sharing.unshare(relationshipId)), className: "shrink-0 self-start sm:self-auto", children: label('withdraw') })] }, relationshipId));
172
175
  }), shareable.length > 0 && (_jsxs("div", { className: "flex flex-col gap-field px-card py-card sm:flex-row sm:items-center", children: [_jsx(Select, { name: "recordSharingRelationship", schema: z.string(), options: shareable.map((relationship) => ({ value: relationship.relationshipId, label: nameOf(relationship.relationshipId) })), value: chosenRelationshipId, onChange: setChosenRelationshipId, placeholder: label('chooseRelationship'), size: ControlSize.SM, disabled: disabled }), _jsx(Button, { variant: ButtonVariants_Variant.SECONDARY, disabled: disabled || !chosenRelationshipId, onClick: () => { if (chosenRelationshipId)
@@ -1 +1 @@
1
- {"version":3,"file":"ResourceLayout_RecordSharing.js","sourceRoot":"","sources":["../../../../src/components/resources/ResourceLayout_RecordSharing.tsx"],"names":[],"mappings":";AAAA,OAAc,EAAE,UAAU,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC7D,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EACL,gBAAgB,EAChB,oCAAoC,EACpC,+CAA+C,EAC/C,qCAAqC,GACtC,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,qBAAqB,EAA2B,MAAM,qCAAqC,CAAC;AAEnI,OAAO,EAAE,MAAM,EAAE,sBAAsB,EAAE,MAAM,+CAA+C,CAAC;AAC/F,OAAO,E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E,CAAC,OAAO,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC,CAAC;gBAC3C,CAAC,EACD,KAAK,EAAE,KAAK,CAAC,mBAAmB,EAAE,EAAE,YAAY,EAAE,MAAM,CAAC,wBAAwB,CAAC,EAAE,CAAC,EACrF,WAAW,EAAE,KAAK,CAAC,yBAAyB,CAAC,EAC7C,YAAY,EAAE,KAAK,CAAC,OAAO,CAAC,GAC5B,CACH,IACO,CACX,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,UAAU,4BAA4B,CAAC,EAAE,MAAM,GAAG,eAAe,CAAC,OAAO,EAAE,GAAG,KAAK,EAA0E;IACjK,MAAM,SAAS,GAAG,uBAAuB,CAAkD,qBAAqB,CAAC,gCAAgC,EAAE,8BAA8B,CAAC,CAAC,MAAM,CAAC,CAAC;IAC3L,OAAO,KAAC,SAAS,OAAK,KAAK,GAAI,CAAC;AAClC,CAAC","sourcesContent":["import React, { useContext, useMemo, useState } from 'react';\nimport { z } from 'zod';\n\nimport {\n CoreResourceType,\n OrganizationRelationships_Operations,\n RELATIONSHIP_COMMON_RECORDS_FORBIDDEN_RESOURCES,\n resourceCarriesRelationshipProvenance,\n} from '@wildo-ai/saas-models';\nimport { ControlSize, CorePresetNames, FrontendComponentType, type ResponsiveMaxWidth } from '@wildo-ai/presets-components-models';\n\nimport { Button, ButtonVariants_Variant } from '~wildo-frontend-lib/components/actions/button';\nimport { Select } from '~wildo-frontend-lib/components/form/controls/enum/select';\nimport { Card } from '~wildo-frontend-lib/components/sections/card';\nimport { optionalMaxInlineSizeStyle } from '~wildo-frontend-lib/components/sections/surface';\nimport { Heading } from '~wildo-frontend-lib/components/typography/heading';\nimport { Strong, Text, TextSize, TextVariant } from '~wildo-frontend-lib/components/typography/text';\nimport { OperationsConfirmCritical } from '~wildo-frontend-lib/components/feedback/operations-confirm-critical';\nimport { useI18n } from '~wildo-frontend-lib/core/i18n/useI18n';\nimport { cn } from '~wildo-frontend-lib/core/ui/cn';\nimport { ResourceRegistryContext } from '~wildo-frontend-lib/core/resources/ResourceRegistryContext';\nimport type { FrontendResourceConfiguration_Operation, FrontendResourcesRegistry } from '~wildo-frontend-lib/core/resources/resources.frontend.schemas';\nimport { isRiskyResourceOperation } from '~wildo-frontend-lib/core/resources/operation-semantics.frontend.utils';\nimport { resolveRecordOrganizationId } from '~wildo-frontend-lib/core/resources/resource-addressability.frontend.utils';\nimport {\n RecordSharingReadState,\n findRelationshipOperation,\n useRecordSharing,\n type RecordSharingRelationship,\n} from '~wildo-frontend-lib/core/resources/useRecordSharing';\nimport { useAppScopeSafe } from '~wildo-frontend-lib/core/scope/useAppScope';\nimport { useRelationshipSideCapabilities, useViewerEffectiveRolesInOrganization } from '~wildo-frontend-lib/core/navigation/launcher-runtime-availability';\nimport { viewerMayPerformOperation, type LauncherEffectiveRoles } from '~wildo-frontend-lib/core/navigation/launcher-resolution';\nimport { RelationshipSideCapability } from '~wildo-frontend-lib/core/config/relationship-side-capabilities.frontend.utils';\nimport { ComponentPresetProps } from '~wildo-frontend-lib/core/components-registry/component-registry.frontend.schemas';\nimport { createComponentResolver } from '~wildo-frontend-lib/core/components-registry/component-resolver.frontend.helper';\nimport { BaseResourcesLayoutProps } from './component-props.resources-layout.frontend.schemas';\n\n// --- Contract ---\nexport interface ResourceLayoutPreset_RecordSharing_DefaultProps extends BaseResourcesLayoutProps {\n /** The loaded record: its id names the record the sharing is about. */\n currentObject?: Record<string, any>;\n className?: string;\n /** How wide the section may grow, in the framework's shared width vocabulary; unset, the host decides (as the danger zone). */\n responsiveMaxWidth?: ResponsiveMaxWidth;\n}\n\n/** The record's id as the read page loaded it: `_id`, else the resource's own identifier field. */\nfunction recordIdOf(currentObject: Record<string, unknown> | undefined, resourceFieldIdentifier: string | undefined): string | undefined {\n const candidate = currentObject?._id ?? (resourceFieldIdentifier ? currentObject?.[resourceFieldIdentifier] : undefined);\n return (typeof candidate === 'string' || typeof candidate === 'number') && String(candidate).length > 0 ? String(candidate) : undefined;\n}\n\n/**\n * Whether the record page offers its sharing section (#2736). Every condition is one the backend also decides, so the\n * section never offers what the verbs would refuse:\n *\n * - the resource separates its records between relationships (`resourceCarriesRelationshipProvenance`) and is not one\n * that issues or attests authority (`RELATIONSHIP_COMMON_RECORDS_FORBIDDEN_RESOURCES`), exactly the share verbs' rule;\n * - the record belongs to the CURRENT organization and that organization's type grants in some relationship kind: the\n * side capability is derived for the current organization, so a record of another organization (a platform operator\n * reading a tenant from the directory) is not offered;\n * - the sharing read and both share verbs are registered in this frontend;\n * - the viewer may perform the read and the share there, by the registry's own roles (organization administrators,\n * which no relationship confers).\n *\n * A resource the backend still declines (a system of record's rows) is found by the read itself, which answers\n * `RELATIONSHIP_RECORD_NOT_SHAREABLE`: the section then stays hidden.\n */\nexport function isRecordSharingOffered(input: {\n readonly registry: FrontendResourcesRegistry | undefined;\n readonly resourceType: string;\n readonly recordId: string | undefined;\n readonly recordOrganizationId: string | undefined;\n readonly currentOrganizationId: string | undefined;\n readonly grants: boolean;\n readonly viewer: LauncherEffectiveRoles;\n}): boolean {\n const configuration = input.registry?.resourceConfigurations[input.resourceType];\n if (!configuration || !resourceCarriesRelationshipProvenance(input.resourceType, configuration.resourcePrimaryScope)) return false;\n if (RELATIONSHIP_COMMON_RECORDS_FORBIDDEN_RESOURCES.includes(input.resourceType)) return false;\n if (!input.recordId || !input.currentOrganizationId || input.recordOrganizationId !== input.currentOrganizationId) return false;\n if (!input.grants) return false;\n const relationshipsScope = input.registry?.resourceConfigurations[CoreResourceType.ORGANIZATION_RELATIONSHIPS]?.resourcePrimaryScope;\n const may = (operation: FrontendResourceConfiguration_Operation | undefined): boolean => !!operation && viewerMayPerformOperation(\n { ...operation, resourceType: CoreResourceType.ORGANIZATION_RELATIONSHIPS, resourcePrimaryScope: relationshipsScope },\n input.viewer,\n );\n return may(findRelationshipOperation(input.registry, OrganizationRelationships_Operations.READ_RECORD_SHARING))\n && may(findRelationshipOperation(input.registry, OrganizationRelationships_Operations.SHARE_RECORD))\n && !!findRelationshipOperation(input.registry, OrganizationRelationships_Operations.UNSHARE_RECORD);\n}\n\n/**\n * The record page's sharing section (#2736): whose the record is, which of the organization's relationships it is\n * shared with, and the administrator's share / withdraw. Mounted by the default read layout beside the danger zone, and\n * hidden wherever {@link isRecordSharingOffered} is false, while the read is in flight, for a resource the backend does\n * not share, and where there is nothing to say: the organization's own record, with no share to withdraw, none to offer\n * and no relationship reading it. A failed read says so and offers nothing.\n *\n * Every claim is the read's answer, decided by the engine per relationship (`describeRelationshipRecordReach`, #2736\n * review N1, N2): a share is offered only to a relationship whose people it would let read the record (#2617: the\n * organization may share one representing organization's record with another), confirmed first when the share verb is\n * risky (HIGH). A relationship that reads the record without a share (the one it was created through, one whose kind\n * reads the organization's own records, every one for a resource declared common) is named as reading it. A share\n * already made is always listed with its withdraw, marked when it changes nothing: its relationship confers nothing\n * now, reads the record anyway, or cannot read this record at all (its roles, or its units, do not reach it).\n */\nexport const ResourceLayoutPreset_RecordSharing_Default = ({\n resourceContext,\n currentObject,\n className,\n responsiveMaxWidth,\n}: ResourceLayoutPreset_RecordSharing_DefaultProps): React.JSX.Element | null => {\n const { resourceType } = resourceContext;\n const { tComponent, formatList } = useI18n({ component: FrontendComponentType.RESOURCES_LAYOUTS_RECORD_SHARING, resource: resourceType });\n // Every word here is a declared label (`ResourceLayout_RecordSharing.labels.ts`); an ungenerated one renders as its key.\n const label = (key: string, params?: Record<string, string>): string => tComponent(FrontendComponentType.RESOURCES_LAYOUTS_RECORD_SHARING, key, params);\n\n // The context itself rather than the throwing hook: a read layout rendered outside the registry provider offers nothing.\n const registry = useContext(ResourceRegistryContext)?.registry;\n const currentOrganizationId = useAppScopeSafe()?.currentOrganizationId ?? undefined;\n const recordId = recordIdOf(currentObject, registry?.resourceConfigurations[resourceType]?.resourceFieldIdentifier);\n // The row's own organization, else the one the page's context names. Never assumed to be the current organization: a\n // record nothing places is not offered (#2736 review F6, N9).\n const recordOrganizationId = (typeof currentObject?.organizationId === 'string' && currentObject.organizationId.length > 0 ? currentObject.organizationId : undefined)\n ?? resolveRecordOrganizationId(resourceType, recordId, resourceContext.contextResourceIdentifiers);\n const viewer = useViewerEffectiveRolesInOrganization(recordOrganizationId);\n const grants = useRelationshipSideCapabilities()[RelationshipSideCapability.GRANTS];\n const offered = isRecordSharingOffered({ registry, resourceType, recordId, recordOrganizationId, currentOrganizationId, grants, viewer });\n\n const sharing = useRecordSharing({ enabled: offered, organizationId: recordOrganizationId, resourceType, recordId });\n const [chosen, setChosenRelationshipId] = useState<string | undefined>(undefined);\n const [confirming, setConfirmingRelationshipId] = useState<string | undefined>(undefined);\n const [busy, setBusy] = useState(false);\n // A choice, and an open confirmation, belong to the record they were made on (#2736 review N6, I4, re-review F1). They\n // are cleared DURING the render that meets another record, which React redoes before committing, so no frame shows\n // them there, and coming back to the first record does not bring them back.\n const recordKey = `${resourceType}|${recordId ?? ''}`;\n const [choiceRecordKey, setChoiceRecordKey] = useState(recordKey);\n if (choiceRecordKey !== recordKey) {\n setChoiceRecordKey(recordKey);\n setChosenRelationshipId(undefined);\n setConfirmingRelationshipId(undefined);\n }\n\n const byId = useMemo(\n () => new Map<string, RecordSharingRelationship>(sharing.relationships.map((relationship) => [relationship.relationshipId, relationship])),\n [sharing.relationships],\n );\n const nameOf = (relationshipId: string): string => byId.get(relationshipId)?.name ?? label('unnamedRelationship');\n const shareable = sharing.relationships.filter((relationship) => relationship.wouldReadIfShared\n && !sharing.sharedWithRelationshipIds.includes(relationship.relationshipId));\n // A choice counts only while the latest answer still offers it, so Share never acts on a relationship the screen no\n // longer offers. Once an answer has SETTLED (not loading, not mid re-read), a choice or an open confirmation it does not\n // offer is CLEARED, during this render, not merely hidden: hidden, a later answer offering the relationship again\n // would bring the choice back and reopen the HIGH-risk confirmation with nobody asking (#2736 re-review R1).\n const isOffered = (relationshipId: string | undefined): relationshipId is string =>\n relationshipId !== undefined && shareable.some((relationship) => relationship.relationshipId === relationshipId);\n // Settled: not another record's read, and not a re-read. The hook keeps the last answer unchanged while it re-reads, so\n // today a re-read never withdraws an offer; the condition is kept so a future hook that does cannot clear a choice the\n // person is still looking at (#2736 re-review C).\n const answerSettled = sharing.readState !== RecordSharingReadState.LOADING && !sharing.refreshing;\n if (answerSettled && chosen !== undefined && !isOffered(chosen)) setChosenRelationshipId(undefined);\n if (answerSettled && confirming !== undefined && !isOffered(confirming)) setConfirmingRelationshipId(undefined);\n // No separate filter at read: React redoes this render with the cleared state before committing it, and while an\n // answer is not settled the last one stays on screen (a re-read) or nothing is shown (another record's read), so a\n // choice the screen does not offer is never drawn.\n const chosenRelationshipId = chosen;\n const confirmingRelationshipId = confirming;\n // Those reading the record without a share, the one it was created through aside: its own line names it.\n const alreadyReading = sharing.relationships.filter((relationship) => relationship.readsWithoutShare\n && relationship.relationshipId !== sharing.viaRelationshipId);\n const conferring = sharing.relationships.filter((relationship) => relationship.confersNow);\n const unreadable = !sharing.commonToEveryRelationship && conferring.length > 0 && conferring.every((relationship) => !relationship.rolesReachRecord);\n const creatingRelationship = sharing.viaRelationshipId === null ? undefined : byId.get(sharing.viaRelationshipId);\n /** Why a share already made changes nothing, when it does not. */\n const shareNote = (relationshipId: string): string | undefined => {\n const relationship = byId.get(relationshipId);\n if (!relationship?.confersNow) return label('relationshipInactive');\n if (relationship.readsWithoutShare) return label('readsWithoutShare');\n if (!relationship.rolesReachRecord) return label('shareHasNoEffect');\n return undefined;\n };\n\n if (!offered) return null;\n if (sharing.readState !== RecordSharingReadState.READY && sharing.readState !== RecordSharingReadState.FAILED) return null;\n // The organization's own record, shared with nobody, offered to nobody and read by no relationship: nothing to say.\n if (sharing.readState === RecordSharingReadState.READY && sharing.viaRelationshipId === null\n && sharing.sharedWithRelationshipIds.length === 0 && shareable.length === 0 && alreadyReading.length === 0) return null;\n\n const disabled = busy || sharing.refreshing;\n const run = (action: () => Promise<void>): void => {\n setBusy(true);\n action()\n .then(() => setChosenRelationshipId(undefined))\n // A refusal was reported by the request's own error handling; the section re-reads either way.\n .catch(() => undefined)\n .finally(() => setBusy(false));\n };\n const shareOperation = findRelationshipOperation(registry, OrganizationRelationships_Operations.SHARE_RECORD);\n const requestShare = (relationshipId: string): void => {\n if (isRiskyResourceOperation(shareOperation?.riskLevel)) setConfirmingRelationshipId(relationshipId);\n else run(() => sharing.share(relationshipId));\n };\n\n return (\n <section\n data-slot=\"record-sharing-section\"\n data-inline-size-tier={responsiveMaxWidth}\n className={cn('mr-auto w-full flex flex-col gap-field-sm', className)}\n style={optionalMaxInlineSizeStyle(responsiveMaxWidth)}\n >\n <Heading level={3}>{label('title')}</Heading>\n <Card className=\"rounded-xl p-0 overflow-hidden divide-y divide-border\">\n {sharing.readState === RecordSharingReadState.FAILED ? (\n <div className=\"px-card py-card\">\n <Text variant={TextVariant.MUTED} size={TextSize.SM}>{label('readFailed')}</Text>\n </div>\n ) : (\n <>\n <div className=\"flex flex-col gap-element-xs px-card py-card\">\n <Text size={TextSize.SM}>\n {sharing.viaRelationshipId === null ? label('ownRecord') : label('createdThrough', { relationship: nameOf(sharing.viaRelationshipId) })}\n </Text>\n {sharing.viaRelationshipId !== null && !creatingRelationship?.confersNow && (\n <Text variant={TextVariant.MUTED} size={TextSize.SM}>{label('relationshipInactive')}</Text>\n )}\n {/* It confers, and its people still cannot read the record (#2736 review I6): created through it is not read by it. */}\n {sharing.viaRelationshipId !== null && creatingRelationship?.confersNow && !creatingRelationship.rolesReachRecord && (\n <Text variant={TextVariant.MUTED} size={TextSize.SM}>{label('creatorCannotRead')}</Text>\n )}\n <Text variant={TextVariant.MUTED} size={TextSize.SM}>\n {sharing.commonToEveryRelationship ? label('commonToEveryRelationship') : unreadable ? label('notReadableByRelationships') : label('description')}\n </Text>\n {alreadyReading.length > 0 && !sharing.commonToEveryRelationship && (\n <Text variant={TextVariant.MUTED} size={TextSize.SM}>\n {label('alreadyReadBy', { relationships: formatList(alreadyReading.map((relationship) => nameOf(relationship.relationshipId))) })}\n </Text>\n )}\n </div>\n {sharing.sharedWithRelationshipIds.length === 0 ? (\n <div className=\"px-card py-card\">\n <Text variant={TextVariant.MUTED} size={TextSize.SM}>{label('notShared')}</Text>\n </div>\n ) : sharing.sharedWithRelationshipIds.map((relationshipId) => {\n const note = shareNote(relationshipId);\n return (\n <div\n key={relationshipId}\n data-slot=\"record-sharing-share\"\n className=\"flex flex-col gap-field px-card py-card sm:flex-row sm:items-center sm:justify-between\"\n >\n <div className=\"flex flex-col gap-element-xs\">\n <Strong>{nameOf(relationshipId)}</Strong>\n {note !== undefined && <Text variant={TextVariant.MUTED} size={TextSize.SM}>{note}</Text>}\n </div>\n <Button\n variant={ButtonVariants_Variant.OUTLINE}\n disabled={disabled}\n onClick={() => run(() => sharing.unshare(relationshipId))}\n className=\"shrink-0 self-start sm:self-auto\"\n >\n {label('withdraw')}\n </Button>\n </div>\n );\n })}\n {shareable.length > 0 && (\n <div className=\"flex flex-col gap-field px-card py-card sm:flex-row sm:items-center\">\n <Select\n name=\"recordSharingRelationship\"\n schema={z.string()}\n options={shareable.map((relationship) => ({ value: relationship.relationshipId, label: nameOf(relationship.relationshipId) }))}\n value={chosenRelationshipId}\n onChange={setChosenRelationshipId}\n placeholder={label('chooseRelationship')}\n size={ControlSize.SM}\n disabled={disabled}\n />\n <Button\n variant={ButtonVariants_Variant.SECONDARY}\n disabled={disabled || !chosenRelationshipId}\n onClick={() => { if (chosenRelationshipId) requestShare(chosenRelationshipId); }}\n className=\"shrink-0 self-start sm:self-auto\"\n >\n {label('share')}\n </Button>\n </div>\n )}\n </>\n )}\n </Card>\n {confirmingRelationshipId !== undefined && (\n <OperationsConfirmCritical\n open\n onOpenChange={(open: boolean) => { if (!open) setConfirmingRelationshipId(undefined); }}\n cancelCallback={() => setConfirmingRelationshipId(undefined)}\n validationCallback={() => {\n const relationshipId = confirmingRelationshipId;\n setConfirmingRelationshipId(undefined);\n run(() => sharing.share(relationshipId));\n }}\n label={label('confirmShareTitle', { relationship: nameOf(confirmingRelationshipId) })}\n description={label('confirmShareDescription')}\n confirmLabel={label('share')}\n />\n )}\n </section>\n );\n};\n\nexport function ResourceLayout_RecordSharing({ preset = CorePresetNames.DEFAULT, ...props }: ResourceLayoutPreset_RecordSharing_DefaultProps & ComponentPresetProps): React.JSX.Element {\n const Component = createComponentResolver<ResourceLayoutPreset_RecordSharing_DefaultProps>(FrontendComponentType.RESOURCES_LAYOUTS_RECORD_SHARING, 'ResourceLayout_RecordSharing')(preset);\n return <Component {...props} />;\n}\n"]}
1
+ {"version":3,"file":"ResourceLayout_RecordSharing.js","sourceRoot":"","sources":["../../../../src/components/resources/ResourceLayout_RecordSharing.tsx"],"names":[],"mappings":";AAAA,OAAc,EAAE,UAAU,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC7D,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EACL,gBAAgB,EAChB,oCAAoC,EACpC,+CAA+C,EAC/C,qCAAqC,GACtC,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,qBAAqB,EAA2B,MAAM,qCAAqC,CAAC;AAEnI,OAAO,EAAE,MAAM,EAAE,sBAAsB,EAAE,MAAM,+CAA+C,CAAC;AAC/F,OAAO,EAAE,MAAM,EAAE,MAAM,0DAA0D,CAAC;AAClF,OAAO,EAAE,IAAI,EAAE,MAAM,8CAA8C,CAAC;AACpE,OAAO,EAAE,0BAA0B,EAAE,MAAM,iDAAiD,CAAC;AAC7F,OAAO,EAAE,OAAO,EAAE,MAAM,mDAAmD,CAAC;AAC5E,OAAO,EAAE,uBAAuB,EAAE,MAAM,kEAAkE,CAAC;AAC3G,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,gDAAgD,CAAC;AACrG,OAAO,EAAE,yBAAyB,EAAE,MAAM,qEAAqE,CAAC;AAChH,OAAO,EAAE,OAAO,EAAE,MAAM,uCAAuC,CAAC;AAChE,OAAO,EAAE,EAAE,EAAE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eAAe,CAAC,OAAO,EAAE,GAAG,KAAK,EAA0E;IACjK,MAAM,SAAS,GAAG,uBAAuB,CAAkD,qBAAqB,CAAC,gCAAgC,EAAE,8BAA8B,CAAC,CAAC,MAAM,CAAC,CAAC;IAC3L,OAAO,KAAC,SAAS,OAAK,KAAK,GAAI,CAAC;AAClC,CAAC","sourcesContent":["import React, { useContext, useMemo, useState } from 'react';\nimport { z } from 'zod';\n\nimport {\n CoreResourceType,\n OrganizationRelationships_Operations,\n RELATIONSHIP_COMMON_RECORDS_FORBIDDEN_RESOURCES,\n resourceCarriesRelationshipProvenance,\n} from '@wildo-ai/saas-models';\nimport { ControlSize, CorePresetNames, FrontendComponentType, type ResponsiveMaxWidth } from '@wildo-ai/presets-components-models';\n\nimport { Button, ButtonVariants_Variant } from '~wildo-frontend-lib/components/actions/button';\nimport { Select } from '~wildo-frontend-lib/components/form/controls/enum/select';\nimport { Card } from '~wildo-frontend-lib/components/sections/card';\nimport { optionalMaxInlineSizeStyle } from '~wildo-frontend-lib/components/sections/surface';\nimport { Heading } from '~wildo-frontend-lib/components/typography/heading';\nimport { useDocumentHeadingLevel } from '~wildo-frontend-lib/components/typography/document-heading-level';\nimport { Strong, Text, TextSize, TextVariant } from '~wildo-frontend-lib/components/typography/text';\nimport { OperationsConfirmCritical } from '~wildo-frontend-lib/components/feedback/operations-confirm-critical';\nimport { useI18n } from '~wildo-frontend-lib/core/i18n/useI18n';\nimport { cn } from '~wildo-frontend-lib/core/ui/cn';\nimport { ResourceRegistryContext } from '~wildo-frontend-lib/core/resources/ResourceRegistryContext';\nimport type { FrontendResourceConfiguration_Operation, FrontendResourcesRegistry } from '~wildo-frontend-lib/core/resources/resources.frontend.schemas';\nimport { isRiskyResourceOperation } from '~wildo-frontend-lib/core/resources/operation-semantics.frontend.utils';\nimport { resolveRecordOrganizationId } from '~wildo-frontend-lib/core/resources/resource-addressability.frontend.utils';\nimport {\n RecordSharingReadState,\n findRelationshipOperation,\n useRecordSharing,\n type RecordSharingRelationship,\n} from '~wildo-frontend-lib/core/resources/useRecordSharing';\nimport { useAppScopeSafe } from '~wildo-frontend-lib/core/scope/useAppScope';\nimport { useRelationshipSideCapabilities, useViewerEffectiveRolesInOrganization } from '~wildo-frontend-lib/core/navigation/launcher-runtime-availability';\nimport { viewerMayPerformOperation, type LauncherEffectiveRoles } from '~wildo-frontend-lib/core/navigation/launcher-resolution';\nimport { RelationshipSideCapability } from '~wildo-frontend-lib/core/config/relationship-side-capabilities.frontend.utils';\nimport { ComponentPresetProps } from '~wildo-frontend-lib/core/components-registry/component-registry.frontend.schemas';\nimport { createComponentResolver } from '~wildo-frontend-lib/core/components-registry/component-resolver.frontend.helper';\nimport { BaseResourcesLayoutProps } from './component-props.resources-layout.frontend.schemas';\n\n// --- Contract ---\nexport interface ResourceLayoutPreset_RecordSharing_DefaultProps extends BaseResourcesLayoutProps {\n /** The loaded record: its id names the record the sharing is about. */\n currentObject?: Record<string, any>;\n className?: string;\n /** How wide the section may grow, in the framework's shared width vocabulary; unset, the host decides (as the danger zone). */\n responsiveMaxWidth?: ResponsiveMaxWidth;\n}\n\n/** The record's id as the read page loaded it: `_id`, else the resource's own identifier field. */\nfunction recordIdOf(currentObject: Record<string, unknown> | undefined, resourceFieldIdentifier: string | undefined): string | undefined {\n const candidate = currentObject?._id ?? (resourceFieldIdentifier ? currentObject?.[resourceFieldIdentifier] : undefined);\n return (typeof candidate === 'string' || typeof candidate === 'number') && String(candidate).length > 0 ? String(candidate) : undefined;\n}\n\n/**\n * Whether the record page offers its sharing section (#2736). Every condition is one the backend also decides, so the\n * section never offers what the verbs would refuse:\n *\n * - the resource separates its records between relationships (`resourceCarriesRelationshipProvenance`) and is not one\n * that issues or attests authority (`RELATIONSHIP_COMMON_RECORDS_FORBIDDEN_RESOURCES`), exactly the share verbs' rule;\n * - the record belongs to the CURRENT organization and that organization's type grants in some relationship kind: the\n * side capability is derived for the current organization, so a record of another organization (a platform operator\n * reading a tenant from the directory) is not offered;\n * - the sharing read and both share verbs are registered in this frontend;\n * - the viewer may perform the read and the share there, by the registry's own roles (organization administrators,\n * which no relationship confers).\n *\n * A resource the backend still declines (a system of record's rows) is found by the read itself, which answers\n * `RELATIONSHIP_RECORD_NOT_SHAREABLE`: the section then stays hidden.\n */\nexport function isRecordSharingOffered(input: {\n readonly registry: FrontendResourcesRegistry | undefined;\n readonly resourceType: string;\n readonly recordId: string | undefined;\n readonly recordOrganizationId: string | undefined;\n readonly currentOrganizationId: string | undefined;\n readonly grants: boolean;\n readonly viewer: LauncherEffectiveRoles;\n}): boolean {\n const configuration = input.registry?.resourceConfigurations[input.resourceType];\n if (!configuration || !resourceCarriesRelationshipProvenance(input.resourceType, configuration.resourcePrimaryScope)) return false;\n if (RELATIONSHIP_COMMON_RECORDS_FORBIDDEN_RESOURCES.includes(input.resourceType)) return false;\n if (!input.recordId || !input.currentOrganizationId || input.recordOrganizationId !== input.currentOrganizationId) return false;\n if (!input.grants) return false;\n const relationshipsScope = input.registry?.resourceConfigurations[CoreResourceType.ORGANIZATION_RELATIONSHIPS]?.resourcePrimaryScope;\n const may = (operation: FrontendResourceConfiguration_Operation | undefined): boolean => !!operation && viewerMayPerformOperation(\n { ...operation, resourceType: CoreResourceType.ORGANIZATION_RELATIONSHIPS, resourcePrimaryScope: relationshipsScope },\n input.viewer,\n );\n return may(findRelationshipOperation(input.registry, OrganizationRelationships_Operations.READ_RECORD_SHARING))\n && may(findRelationshipOperation(input.registry, OrganizationRelationships_Operations.SHARE_RECORD))\n && !!findRelationshipOperation(input.registry, OrganizationRelationships_Operations.UNSHARE_RECORD);\n}\n\n/**\n * The record page's sharing section (#2736): whose the record is, which of the organization's relationships it is\n * shared with, and the administrator's share / withdraw. Mounted by the default read layout beside the danger zone, and\n * hidden wherever {@link isRecordSharingOffered} is false, while the read is in flight, for a resource the backend does\n * not share, and where there is nothing to say: the organization's own record, with no share to withdraw, none to offer\n * and no relationship reading it. A failed read says so and offers nothing.\n *\n * Every claim is the read's answer, decided by the engine per relationship (`describeRelationshipRecordReach`, #2736\n * review N1, N2): a share is offered only to a relationship whose people it would let read the record (#2617: the\n * organization may share one representing organization's record with another), confirmed first when the share verb is\n * risky (HIGH). A relationship that reads the record without a share (the one it was created through, one whose kind\n * reads the organization's own records, every one for a resource declared common) is named as reading it. A share\n * already made is always listed with its withdraw, marked when it changes nothing: its relationship confers nothing\n * now, reads the record anyway, or cannot read this record at all (its roles, or its units, do not reach it).\n */\nexport const ResourceLayoutPreset_RecordSharing_Default = ({\n resourceContext,\n currentObject,\n className,\n responsiveMaxWidth,\n}: ResourceLayoutPreset_RecordSharing_DefaultProps): React.JSX.Element | null => {\n const { resourceType } = resourceContext;\n // The panel's title takes the outline's level on the record page, never a fixed `h3` under the title's `h1` (#3867).\n const headingLevel = useDocumentHeadingLevel();\n const { tComponent, formatList } = useI18n({ component: FrontendComponentType.RESOURCES_LAYOUTS_RECORD_SHARING, resource: resourceType });\n // Every word here is a declared label (`ResourceLayout_RecordSharing.labels.ts`); an ungenerated one renders as its key.\n const label = (key: string, params?: Record<string, string>): string => tComponent(FrontendComponentType.RESOURCES_LAYOUTS_RECORD_SHARING, key, params);\n\n // The context itself rather than the throwing hook: a read layout rendered outside the registry provider offers nothing.\n const registry = useContext(ResourceRegistryContext)?.registry;\n const currentOrganizationId = useAppScopeSafe()?.currentOrganizationId ?? undefined;\n const recordId = recordIdOf(currentObject, registry?.resourceConfigurations[resourceType]?.resourceFieldIdentifier);\n // The row's own organization, else the one the page's context names. Never assumed to be the current organization: a\n // record nothing places is not offered (#2736 review F6, N9).\n const recordOrganizationId = (typeof currentObject?.organizationId === 'string' && currentObject.organizationId.length > 0 ? currentObject.organizationId : undefined)\n ?? resolveRecordOrganizationId(resourceType, recordId, resourceContext.contextResourceIdentifiers);\n const viewer = useViewerEffectiveRolesInOrganization(recordOrganizationId);\n const grants = useRelationshipSideCapabilities()[RelationshipSideCapability.GRANTS];\n const offered = isRecordSharingOffered({ registry, resourceType, recordId, recordOrganizationId, currentOrganizationId, grants, viewer });\n\n const sharing = useRecordSharing({ enabled: offered, organizationId: recordOrganizationId, resourceType, recordId });\n const [chosen, setChosenRelationshipId] = useState<string | undefined>(undefined);\n const [confirming, setConfirmingRelationshipId] = useState<string | undefined>(undefined);\n const [busy, setBusy] = useState(false);\n // A choice, and an open confirmation, belong to the record they were made on (#2736 review N6, I4, re-review F1). They\n // are cleared DURING the render that meets another record, which React redoes before committing, so no frame shows\n // them there, and coming back to the first record does not bring them back.\n const recordKey = `${resourceType}|${recordId ?? ''}`;\n const [choiceRecordKey, setChoiceRecordKey] = useState(recordKey);\n if (choiceRecordKey !== recordKey) {\n setChoiceRecordKey(recordKey);\n setChosenRelationshipId(undefined);\n setConfirmingRelationshipId(undefined);\n }\n\n const byId = useMemo(\n () => new Map<string, RecordSharingRelationship>(sharing.relationships.map((relationship) => [relationship.relationshipId, relationship])),\n [sharing.relationships],\n );\n const nameOf = (relationshipId: string): string => byId.get(relationshipId)?.name ?? label('unnamedRelationship');\n const shareable = sharing.relationships.filter((relationship) => relationship.wouldReadIfShared\n && !sharing.sharedWithRelationshipIds.includes(relationship.relationshipId));\n // A choice counts only while the latest answer still offers it, so Share never acts on a relationship the screen no\n // longer offers. Once an answer has SETTLED (not loading, not mid re-read), a choice or an open confirmation it does not\n // offer is CLEARED, during this render, not merely hidden: hidden, a later answer offering the relationship again\n // would bring the choice back and reopen the HIGH-risk confirmation with nobody asking (#2736 re-review R1).\n const isOffered = (relationshipId: string | undefined): relationshipId is string =>\n relationshipId !== undefined && shareable.some((relationship) => relationship.relationshipId === relationshipId);\n // Settled: not another record's read, and not a re-read. The hook keeps the last answer unchanged while it re-reads, so\n // today a re-read never withdraws an offer; the condition is kept so a future hook that does cannot clear a choice the\n // person is still looking at (#2736 re-review C).\n const answerSettled = sharing.readState !== RecordSharingReadState.LOADING && !sharing.refreshing;\n if (answerSettled && chosen !== undefined && !isOffered(chosen)) setChosenRelationshipId(undefined);\n if (answerSettled && confirming !== undefined && !isOffered(confirming)) setConfirmingRelationshipId(undefined);\n // No separate filter at read: React redoes this render with the cleared state before committing it, and while an\n // answer is not settled the last one stays on screen (a re-read) or nothing is shown (another record's read), so a\n // choice the screen does not offer is never drawn.\n const chosenRelationshipId = chosen;\n const confirmingRelationshipId = confirming;\n // Those reading the record without a share, the one it was created through aside: its own line names it.\n const alreadyReading = sharing.relationships.filter((relationship) => relationship.readsWithoutShare\n && relationship.relationshipId !== sharing.viaRelationshipId);\n const conferring = sharing.relationships.filter((relationship) => relationship.confersNow);\n const unreadable = !sharing.commonToEveryRelationship && conferring.length > 0 && conferring.every((relationship) => !relationship.rolesReachRecord);\n const creatingRelationship = sharing.viaRelationshipId === null ? undefined : byId.get(sharing.viaRelationshipId);\n /** Why a share already made changes nothing, when it does not. */\n const shareNote = (relationshipId: string): string | undefined => {\n const relationship = byId.get(relationshipId);\n if (!relationship?.confersNow) return label('relationshipInactive');\n if (relationship.readsWithoutShare) return label('readsWithoutShare');\n if (!relationship.rolesReachRecord) return label('shareHasNoEffect');\n return undefined;\n };\n\n if (!offered) return null;\n if (sharing.readState !== RecordSharingReadState.READY && sharing.readState !== RecordSharingReadState.FAILED) return null;\n // The organization's own record, shared with nobody, offered to nobody and read by no relationship: nothing to say.\n if (sharing.readState === RecordSharingReadState.READY && sharing.viaRelationshipId === null\n && sharing.sharedWithRelationshipIds.length === 0 && shareable.length === 0 && alreadyReading.length === 0) return null;\n\n const disabled = busy || sharing.refreshing;\n const run = (action: () => Promise<void>): void => {\n setBusy(true);\n action()\n .then(() => setChosenRelationshipId(undefined))\n // A refusal was reported by the request's own error handling; the section re-reads either way.\n .catch(() => undefined)\n .finally(() => setBusy(false));\n };\n const shareOperation = findRelationshipOperation(registry, OrganizationRelationships_Operations.SHARE_RECORD);\n const requestShare = (relationshipId: string): void => {\n if (isRiskyResourceOperation(shareOperation?.riskLevel)) setConfirmingRelationshipId(relationshipId);\n else run(() => sharing.share(relationshipId));\n };\n\n return (\n <section\n data-slot=\"record-sharing-section\"\n data-inline-size-tier={responsiveMaxWidth}\n className={cn('mr-auto w-full flex flex-col gap-field-sm', className)}\n style={optionalMaxInlineSizeStyle(responsiveMaxWidth)}\n >\n <Heading level={headingLevel}>{label('title')}</Heading>\n <Card className=\"rounded-xl p-0 overflow-hidden divide-y divide-border\">\n {sharing.readState === RecordSharingReadState.FAILED ? (\n <div className=\"px-card py-card\">\n <Text variant={TextVariant.MUTED} size={TextSize.SM}>{label('readFailed')}</Text>\n </div>\n ) : (\n <>\n <div className=\"flex flex-col gap-element-xs px-card py-card\">\n <Text size={TextSize.SM}>\n {sharing.viaRelationshipId === null ? label('ownRecord') : label('createdThrough', { relationship: nameOf(sharing.viaRelationshipId) })}\n </Text>\n {sharing.viaRelationshipId !== null && !creatingRelationship?.confersNow && (\n <Text variant={TextVariant.MUTED} size={TextSize.SM}>{label('relationshipInactive')}</Text>\n )}\n {/* It confers, and its people still cannot read the record (#2736 review I6): created through it is not read by it. */}\n {sharing.viaRelationshipId !== null && creatingRelationship?.confersNow && !creatingRelationship.rolesReachRecord && (\n <Text variant={TextVariant.MUTED} size={TextSize.SM}>{label('creatorCannotRead')}</Text>\n )}\n <Text variant={TextVariant.MUTED} size={TextSize.SM}>\n {sharing.commonToEveryRelationship ? label('commonToEveryRelationship') : unreadable ? label('notReadableByRelationships') : label('description')}\n </Text>\n {alreadyReading.length > 0 && !sharing.commonToEveryRelationship && (\n <Text variant={TextVariant.MUTED} size={TextSize.SM}>\n {label('alreadyReadBy', { relationships: formatList(alreadyReading.map((relationship) => nameOf(relationship.relationshipId))) })}\n </Text>\n )}\n </div>\n {sharing.sharedWithRelationshipIds.length === 0 ? (\n <div className=\"px-card py-card\">\n <Text variant={TextVariant.MUTED} size={TextSize.SM}>{label('notShared')}</Text>\n </div>\n ) : sharing.sharedWithRelationshipIds.map((relationshipId) => {\n const note = shareNote(relationshipId);\n return (\n <div\n key={relationshipId}\n data-slot=\"record-sharing-share\"\n className=\"flex flex-col gap-field px-card py-card sm:flex-row sm:items-center sm:justify-between\"\n >\n <div className=\"flex flex-col gap-element-xs\">\n <Strong>{nameOf(relationshipId)}</Strong>\n {note !== undefined && <Text variant={TextVariant.MUTED} size={TextSize.SM}>{note}</Text>}\n </div>\n <Button\n variant={ButtonVariants_Variant.OUTLINE}\n disabled={disabled}\n onClick={() => run(() => sharing.unshare(relationshipId))}\n className=\"shrink-0 self-start sm:self-auto\"\n >\n {label('withdraw')}\n </Button>\n </div>\n );\n })}\n {shareable.length > 0 && (\n <div className=\"flex flex-col gap-field px-card py-card sm:flex-row sm:items-center\">\n <Select\n name=\"recordSharingRelationship\"\n schema={z.string()}\n options={shareable.map((relationship) => ({ value: relationship.relationshipId, label: nameOf(relationship.relationshipId) }))}\n value={chosenRelationshipId}\n onChange={setChosenRelationshipId}\n placeholder={label('chooseRelationship')}\n size={ControlSize.SM}\n disabled={disabled}\n />\n <Button\n variant={ButtonVariants_Variant.SECONDARY}\n disabled={disabled || !chosenRelationshipId}\n onClick={() => { if (chosenRelationshipId) requestShare(chosenRelationshipId); }}\n className=\"shrink-0 self-start sm:self-auto\"\n >\n {label('share')}\n </Button>\n </div>\n )}\n </>\n )}\n </Card>\n {confirmingRelationshipId !== undefined && (\n <OperationsConfirmCritical\n open\n onOpenChange={(open: boolean) => { if (!open) setConfirmingRelationshipId(undefined); }}\n cancelCallback={() => setConfirmingRelationshipId(undefined)}\n validationCallback={() => {\n const relationshipId = confirmingRelationshipId;\n setConfirmingRelationshipId(undefined);\n run(() => sharing.share(relationshipId));\n }}\n label={label('confirmShareTitle', { relationship: nameOf(confirmingRelationshipId) })}\n description={label('confirmShareDescription')}\n confirmLabel={label('share')}\n />\n )}\n </section>\n );\n};\n\nexport function ResourceLayout_RecordSharing({ preset = CorePresetNames.DEFAULT, ...props }: ResourceLayoutPreset_RecordSharing_DefaultProps & ComponentPresetProps): React.JSX.Element {\n const Component = createComponentResolver<ResourceLayoutPreset_RecordSharing_DefaultProps>(FrontendComponentType.RESOURCES_LAYOUTS_RECORD_SHARING, 'ResourceLayout_RecordSharing')(preset);\n return <Component {...props} />;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"ResourceCollectionBody_Board.d.ts","sourceRoot":"","sources":["../../../../../../src/components/resources/collection/board/ResourceCollectionBody_Board.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,KAAuC,MAAM,OAAO,CAAC;AAC5D,OAAO,EAA+B,KAAK,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAKnF,OAAO,KAAK,EAAE,uCAAuC,EAAE,MAAM,+DAA+D,CAAC;AAC7H,OAAO,EAGL,KAAK,qBAAqB,EAC3B,MAAM,2FAA2F,CAAC;AAEnG,MAAM,WAAW,iCAAiC,CAAC,KAAK,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IACtF,oHAAoH;IACpH,OAAO,EAAE,SAAS,qBAAqB,CAAC,KAAK,CAAC,EAAE,CAAC;IACjD,wDAAwD;IACxD,UAAU,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACpC,yEAAyE;IACzE,aAAa,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,MAAM,CAAC;IAC7C,6EAA6E;IAC7E,qBAAqB,EAAE,MAAM,CAAC;IAC9B,yGAAyG;IACzG,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC;IACzC,4GAA4G;IAC5G,UAAU,EAAE,CAAC,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,KAAK,KAAK,CAAC,SAAS,CAAC;IAC5D,2EAA2E;IAC3E,SAAS,EAAE,CAAC,IAAI,EAAE,KAAK,KAAK,MAAM,CAAC;IACnC;;;;OAIG;IACH,UAAU,EAAE,eAAe,GAAG,SAAS,CAAC;IACxC;;;OAGG;IACH,UAAU,EAAE,CAAC,IAAI,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,EAAE,SAAS,EAAE,wBAAwB,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACrG,0CAA0C;IAC1C,UAAU,EAAE,MAAM,CAAC;IACnB,4EAA4E;IAC5E,cAAc,EAAE,MAAM,CAAC;IACvB,sEAAsE;IACtE,gBAAgB,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC;IAC5C,uFAAuF;IACvF,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,mDAAmD;AACnD,MAAM,MAAM,wBAAwB,GAAG,uCAAuC,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC;AAE9F,+FAA+F;AAC/F,MAAM,WAAW,eAAe;IAC9B;;;;OAIG;IACH,UAAU,EAAE,SAAS,wBAAwB,EAAE,CAAC;IAChD,YAAY,EAAE,MAAM,CAAC;IACrB,8GAA8G;IAC9G,eAAe,CAAC,EAAE,QAAQ,CAAC;IAC3B,sFAAsF;IACtF,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAuFD,wBAAgB,4BAA4B,CAAC,KAAK,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,EAClF,OAAO,EACP,UAAU,EACV,aAAa,EACb,qBAAqB,EACrB,aAAa,EACb,UAAU,EACV,SAAS,EACT,UAAU,EACV,UAAU,EACV,UAAU,EACV,cAAc,EACd,gBAAgB,EAChB,QAAQ,GACT,EAAE,iCAAiC,CAAC,KAAK,CAAC,GAAG,KAAK,CAAC,GAAG,CAAC,OAAO,CA+H9D"}
1
+ {"version":3,"file":"ResourceCollectionBody_Board.d.ts","sourceRoot":"","sources":["../../../../../../src/components/resources/collection/board/ResourceCollectionBody_Board.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,KAAuC,MAAM,OAAO,CAAC;AAE5D,OAAO,EAA+B,KAAK,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAKnF,OAAO,KAAK,EAAE,uCAAuC,EAAE,MAAM,+DAA+D,CAAC;AAC7H,OA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AAe;IAC9B;;;;OAIG;IACH,UAAU,EAAE,SAAS,wBAAwB,EAAE,CAAC;IAChD,YAAY,EAAE,MAAM,CAAC;IACrB,8GAA8G;IAC9G,eAAe,CAAC,EAAE,QAAQ,CAAC;IAC3B,sFAAsF;IACtF,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAuFD,wBAAgB,4BAA4B,CAAC,KAAK,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,EAClF,OAAO,EACP,UAAU,EACV,aAAa,EACb,qBAAqB,EACrB,aAAa,EACb,UAAU,EACV,SAAS,EACT,UAAU,EACV,UAAU,EACV,UAAU,EACV,cAAc,EACd,gBAAgB,EAChB,QAAQ,GACT,EAAE,iCAAiC,CAAC,KAAK,CAAC,GAAG,KAAK,CAAC,GAAG,CAAC,OAAO,CAiI9D"}
@@ -21,6 +21,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
21
21
  * move to undo.
22
22
  */
23
23
  import { useCallback, useId, useState } from 'react';
24
+ import { documentHeadingTag, useDocumentHeadingLevel } from '../../../../components/typography/document-heading-level.js';
24
25
  import { selectHighestRightsVariants } from '@wildo-ai/saas-models';
25
26
  import { ButtonSize } from '@wildo-ai/presets-components-models';
26
27
  import { cn } from '../../../../core/ui/cn.js';
@@ -69,6 +70,8 @@ function BoardCard({ item, index, itemId, columnValue, transition, isMoving, hin
69
70
  }, children: renderCard(item, index) }));
70
71
  }
71
72
  export function ResourceCollectionBody_Board({ columns, onLoadMore, loadMoreLabel, columnLoadFailedLabel, ungroupedNote, renderCard, getItemId, transition, onMoveItem, boardLabel, ungroupedLabel, columnCountLabel, moveHint, }) {
73
+ // A column's heading takes the outline's level under the page's `h1`; a fixed `h3` skipped one (#3867).
74
+ const ColumnHeadingTag = documentHeadingTag(useDocumentHeadingLevel());
72
75
  const hintId = useId();
73
76
  /**
74
77
  * The card being dragged, and the column it came from — kept in state because `dragover` cannot read the payload.
@@ -134,7 +137,7 @@ export function ResourceCollectionBody_Board({ columns, onLoadMore, loadMoreLabe
134
137
  const item = itemId ? findItem(itemId) : undefined;
135
138
  if (item && operation)
136
139
  void move(item, column.value, operation);
137
- }, children: [_jsxs("header", { className: "flex items-baseline justify-between gap-item-sm px-item-xs", children: [_jsx("h3", { className: "truncate text-xs font-medium text-muted-foreground", children: heading }), _jsx("span", { className: "shrink-0 text-xs text-muted-foreground", children: column.failed ? null : columnCountLabel(column.total) })] }), column.value === null && (
140
+ }, children: [_jsxs("header", { className: "flex items-baseline justify-between gap-item-sm px-item-xs", children: [_jsx(ColumnHeadingTag, { className: "truncate text-xs font-medium text-muted-foreground", children: heading }), _jsx("span", { className: "shrink-0 text-xs text-muted-foreground", children: column.failed ? null : columnCountLabel(column.total) })] }), column.value === null && (
138
141
  // The trailing column COUNTS the rows holding no value of the field: they are not on the board, and it
139
142
  // says how many there are and where they are seen, so none of them is dropped without a word.
140
143
  _jsx("p", { className: "px-item-xs text-xs text-muted-foreground", children: ungroupedNote(column.total) })), column.failed && _jsx("p", { role: "alert", className: "px-item-xs text-xs text-destructive", children: columnLoadFailedLabel }), _jsx("ul", { role: "list", "aria-label": heading, "aria-busy": column.loading ? true : undefined, className: "flex min-h-16 flex-col gap-item-sm", children: column.items.map((item) => {
@@ -1 +1 @@
1
- {"version":3,"file":"ResourceCollectionBody_Board.js","sourceRoot":"","sources":["../../../../../../src/components/resources/collection/board/ResourceCollectionBody_Board.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAc,EAAE,WAAW,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC5D,OAAO,EAAE,2BAA2B,EAAiB,MAAM,uBAAuB,CAAC;AACnF,OAAO,EAAE,UAAU,EAAE,MAAM,qCAAqC,CAAC;AACjE,OAAO,EAAE,EAAE,EAAE,MAAM,gCAAgC,CAAC;AACpD,OAAO,EAAE,MAAM,EAAE,sBAAsB,EAAE,MAAM,+CAA+C,C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AS,EAAE,OAAO,EAClB,cAAc,EAAE,YAAY,IAXvB,MAAM,IAAI,KAAK,CAYpB,CACH,CAAC;4BACJ,CAAC,CAAC,GACC,EACJ,MAAM,CAAC,KAAK,KAAK,IAAI,IAAI,CAAC,MAAM,CAAC,MAAM,IAAI,MAAM,CAAC,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC,KAAK,IAAI,CAChF,KAAC,MAAM,IACL,OAAO,EAAE,sBAAsB,CAAC,KAAK,EACrC,IAAI,EAAE,UAAU,CAAC,EAAE,EACnB,QAAQ,EAAE,MAAM,CAAC,OAAO,0BACF,MAAM,CAAC,GAAG,EAChC,OAAO,EAAE,GAAG,EAAE,CAAC,UAAU,CAAC,MAAM,CAAC,KAAe,CAAC,YAEhD,aAAa,CAAC,MAAM,CAAC,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,GAC3C,CACV,KAtEI,MAAM,CAAC,GAAG,CAuEP,CACX,CAAC;YACJ,CAAC,CAAC,IACE,CACP,CAAC;AACJ,CAAC","sourcesContent":["/**\n * The BOARD body of a resource collection (`CollectionDisplayMode.BOARD`, #2298): one column per value of an enum\n * field, and moving a card between columns calls the operation the collection declared for it.\n *\n * Like `ResourceCollectionBody_Table`, the list host owns the fetched rows, the per-column reads (`useBoardColumnPages`),\n * the card renderer it shares with CARDS, the viewer's ROLE decision and the operation call. This component owns the\n * gesture, and asks each card's row which of the admitted variants' `enabledCondition` admits it, choosing the\n * highest-rights one (`useCardMoveOperation`): a member moves the rows their variant admits, an administrator any.\n *\n * ## The two ways to move a card, and why both\n *\n * - **Drag** (native HTML drag and drop): a card the host allows to move is `draggable`; a column accepts it when it\n * is a different value of the field. The trailing column of rows holding no value is never a target.\n * - **Keyboard**: a movable card is focusable, and Left / Right move it to the neighbouring column. Drag alone would\n * leave the board unusable without a pointer (WCAG 2.1.1). The keys are read only when the CARD itself has focus, so\n * the arrow keys keep their meaning inside the card's own controls.\n *\n * Nothing moves until the host's `onMoveItem` settles: the host updates the row only after the operation succeeded, so\n * a refused move leaves the card exactly where it was (the host reports the backend's refusal). There is no optimistic\n * move to undo.\n */\n\nimport React, { useCallback, useId, useState } from 'react';\nimport { selectHighestRightsVariants, type DataMode } from '@wildo-ai/saas-models';\nimport { ButtonSize } from '@wildo-ai/presets-components-models';\nimport { cn } from '~wildo-frontend-lib/core/ui/cn';\nimport { Button, ButtonVariants_Variant } from '~wildo-frontend-lib/components/actions/button';\nimport { buildOperationEnabledKey, useOperationsEnabled } from '~wildo-frontend-lib/core/resources/hooks/useOperationEnabled';\nimport type { FrontendResourceConfiguration_Operation } from '~wildo-frontend-lib/core/resources/resources.frontend.schemas';\nimport {\n adjacentBoardColumnValue,\n selectBoardMoveOperation,\n type CollectionBoardColumn,\n} from '~wildo-frontend-lib/components/resources/collection/board/collection-board.frontend.utils';\n\nexport interface ResourceCollectionBody_BoardProps<TItem extends Record<string, unknown>> {\n /** The columns, in vocabulary order, from `boardColumnsFromPages`: each column's loaded rows and its full count. */\n columns: readonly CollectionBoardColumn<TItem>[];\n /** Load the next page of the column holding `value`. */\n onLoadMore: (value: string) => void;\n /** The button under a column that holds more rows than it has loaded. */\n loadMoreLabel: (remaining: number) => string;\n /** Shown in a column whose read failed: its rows and count are not known. */\n columnLoadFailedLabel: string;\n /** The trailing column's words: how many rows hold no value of the field, and where they can be seen. */\n ungroupedNote: (count: number) => string;\n /** The row's card — the same renderer CARDS uses, without its list item (this body supplies the `<li>`). */\n renderCard: (item: TItem, index: number) => React.ReactNode;\n /** The row's stable identifier (the resource's addressable identifier). */\n getItemId: (item: TItem) => string;\n /**\n * The operations a move may call, or `undefined` when the collection declared none or the viewer's roles admit none\n * of its variants (the board is then read-only). Each card adds the operations' own `enabledCondition` against its\n * row, so a card the backend would refuse to move is never draggable.\n */\n transition: BoardTransition | undefined;\n /**\n * Move the row to the column holding `targetValue` through `operation`, the variant this card chose for this viewer\n * and this row. Resolves once the operation has settled, refused or not.\n */\n onMoveItem: (item: TItem, targetValue: string, operation: BoardTransitionOperation) => Promise<void>;\n /** Accessible name of the whole board. */\n boardLabel: string;\n /** Heading of the trailing column of rows holding no value of the field. */\n ungroupedLabel: string;\n /** How many cards a column holds in all (loaded or not), in words. */\n columnCountLabel: (count: number) => string;\n /** The instruction a screen reader gives for a movable card (Left / Right move it). */\n moveHint: string;\n}\n\n/** One operation variant a board move may call. */\nexport type BoardTransitionOperation = FrontendResourceConfiguration_Operation<any, any, any>;\n\n/** The operations a board move may call, and what decides whether a given card may make it. */\nexport interface BoardTransition {\n /**\n * The declared transition's single-row variants whose roles the viewer holds in the organization the collection\n * addresses (`resolveBoardTransitionOperations`, then the host's `viewerMayPerformOperation`). Never empty: a viewer\n * admitted to none gets no transition at all.\n */\n operations: readonly BoardTransitionOperation[];\n resourceType: string;\n /** The data mode the rows were fetched in, so a condition reading a field a summary row lacks is reported. */\n subjectDataMode?: DataMode;\n /** The organization the collection addresses, which the condition is evaluated in. */\n organizationId?: string;\n}\n\n/** The data-transfer type a dragged card carries; scoped so a drag from elsewhere on the page is never accepted. */\nconst BOARD_CARD_DRAG_TYPE = 'application/x-wildo-board-card';\n\nconst NO_OPERATIONS: readonly BoardTransitionOperation[] = [];\n\n/**\n * The variant this card's move calls, or `undefined` when it cannot move: no transition the viewer may perform, or none\n * whose own `enabledCondition` admits THIS row. Among the variants that admit it, the highest-rights one wins, as on\n * the action bar (`selectBoardMoveOperation`). A hook per card, because the condition is evaluated against the row.\n */\nfunction useCardMoveOperation(transition: BoardTransition | undefined, item: Record<string, unknown>): BoardTransitionOperation | undefined {\n const operations = transition?.operations ?? NO_OPERATIONS;\n const enabledMap = useOperationsEnabled(operations as BoardTransitionOperation[], {\n currentObject: item,\n resourceType: transition?.resourceType,\n subjectDataMode: transition?.subjectDataMode,\n organizationId: transition?.organizationId,\n });\n const enabled = operations.filter((operation) => enabledMap.get(buildOperationEnabledKey(operation))?.isEnabled === true);\n return selectBoardMoveOperation(enabled, (variants) => selectHighestRightsVariants(variants as never[]) as BoardTransitionOperation[]);\n}\n\ninterface BoardCardProps<TItem extends Record<string, unknown>> {\n item: TItem;\n index: number;\n itemId: string;\n columnValue: string | null;\n transition: BoardTransition | undefined;\n isMoving: boolean;\n hintId: string;\n renderCard: (item: TItem, index: number) => React.ReactNode;\n onDragStart: (itemId: string, fromValue: string | null, operation: BoardTransitionOperation) => void;\n onDragEnd: () => void;\n /** Move to the neighbouring column in `direction`; the board knows the columns. */\n onKeyboardMove: (item: TItem, fromValue: string | null, direction: -1 | 1, operation: BoardTransitionOperation) => void;\n}\n\nfunction BoardCard<TItem extends Record<string, unknown>>({\n item,\n index,\n itemId,\n columnValue,\n transition,\n isMoving,\n hintId,\n renderCard,\n onDragStart,\n onDragEnd,\n onKeyboardMove,\n}: BoardCardProps<TItem>): React.JSX.Element {\n const moveOperation = useCardMoveOperation(transition, item);\n const movable = moveOperation !== undefined && !isMoving;\n return (\n <li\n className={cn('list-none rounded-md border bg-background', movable && 'cursor-grab', isMoving && 'opacity-60')}\n data-board-card={itemId}\n data-board-card-movable={movable ? 'true' : undefined}\n draggable={movable}\n tabIndex={movable ? 0 : undefined}\n aria-describedby={movable ? hintId : undefined}\n aria-busy={isMoving ? true : undefined}\n onDragStart={(event) => {\n if (!movable || !moveOperation) {\n event.preventDefault();\n return;\n }\n event.dataTransfer.setData(BOARD_CARD_DRAG_TYPE, itemId);\n event.dataTransfer.effectAllowed = 'move';\n onDragStart(itemId, columnValue, moveOperation);\n }}\n onDragEnd={onDragEnd}\n onKeyDown={(event) => {\n // Only the card itself: an arrow key inside the card's own controls keeps its meaning there.\n if (!movable || !moveOperation || event.target !== event.currentTarget) return;\n const direction = event.key === 'ArrowRight' ? 1 : event.key === 'ArrowLeft' ? -1 : 0;\n if (direction === 0) return;\n event.preventDefault();\n onKeyboardMove(item, columnValue, direction, moveOperation);\n }}\n >\n {renderCard(item, index)}\n </li>\n );\n}\n\nexport function ResourceCollectionBody_Board<TItem extends Record<string, unknown>>({\n columns,\n onLoadMore,\n loadMoreLabel,\n columnLoadFailedLabel,\n ungroupedNote,\n renderCard,\n getItemId,\n transition,\n onMoveItem,\n boardLabel,\n ungroupedLabel,\n columnCountLabel,\n moveHint,\n}: ResourceCollectionBody_BoardProps<TItem>): React.JSX.Element {\n const hintId = useId();\n /**\n * The card being dragged, and the column it came from — kept in state because `dragover` cannot read the payload.\n * A drag is only ever STARTED by a card that may move (`BoardCard`), which also chose the variant its move calls, so\n * a drop needs no second permission check.\n */\n const [dragging, setDragging] = useState<{ itemId: string; fromValue: string | null; operation: BoardTransitionOperation } | null>(null);\n const [dropTargetValue, setDropTargetValue] = useState<string | null>(null);\n /** The row whose move is in flight: it cannot be moved again until the first move settles. */\n const [movingItemId, setMovingItemId] = useState<string | null>(null);\n\n const findItem = useCallback((itemId: string): TItem | undefined => {\n for (const column of columns) {\n const found = column.items.find((item) => getItemId(item) === itemId);\n if (found) return found;\n }\n return undefined;\n }, [columns, getItemId]);\n\n const move = useCallback(async (item: TItem, targetValue: string, operation: BoardTransitionOperation) => {\n setMovingItemId(getItemId(item));\n try {\n await onMoveItem(item, targetValue, operation);\n } finally {\n setMovingItemId(null);\n }\n }, [getItemId, onMoveItem]);\n\n const endDrag = useCallback(() => {\n setDragging(null);\n setDropTargetValue(null);\n }, []);\n\n const keyboardMove = useCallback((item: TItem, fromValue: string | null, direction: -1 | 1, operation: BoardTransitionOperation) => {\n const targetValue = adjacentBoardColumnValue(columns, fromValue, direction);\n if (targetValue !== undefined) void move(item, targetValue, operation);\n }, [columns, move]);\n\n let rowIndex = 0;\n return (\n <div role=\"group\" aria-label={boardLabel} className=\"flex gap-group overflow-x-auto pb-item-sm\" data-slot=\"collection-board\">\n <span id={hintId} className=\"sr-only\">{moveHint}</span>\n {columns.map((column) => {\n // A column receives a card from ANOTHER column, and only when it names a value: the trailing column of rows\n // holding none has nothing to set the field to.\n const accepts = column.value !== null && dragging !== null && dragging.fromValue !== column.value;\n const isDropTarget = accepts && dropTargetValue === column.value;\n const heading = column.label ?? ungroupedLabel;\n return (\n <section\n key={column.key}\n aria-label={heading}\n data-board-column={column.key}\n data-drop-target={isDropTarget ? 'true' : undefined}\n className={cn(\n 'flex w-72 shrink-0 flex-col gap-item-sm rounded-lg border bg-muted/20 p-item-sm',\n isDropTarget && 'border-primary bg-muted/40',\n )}\n onDragOver={(event) => {\n if (!accepts) return;\n event.preventDefault();\n event.dataTransfer.dropEffect = 'move';\n if (dropTargetValue !== column.value) setDropTargetValue(column.value);\n }}\n onDragLeave={(event) => {\n if (event.currentTarget.contains(event.relatedTarget as Node | null)) return;\n if (dropTargetValue === column.value) setDropTargetValue(null);\n }}\n onDrop={(event) => {\n if (!accepts || column.value === null) return;\n event.preventDefault();\n const itemId = event.dataTransfer.getData(BOARD_CARD_DRAG_TYPE) || dragging?.itemId;\n const operation = dragging?.itemId === itemId ? dragging?.operation : undefined;\n endDrag();\n const item = itemId ? findItem(itemId) : undefined;\n if (item && operation) void move(item, column.value, operation);\n }}\n >\n <header className=\"flex items-baseline justify-between gap-item-sm px-item-xs\">\n <h3 className=\"truncate text-xs font-medium text-muted-foreground\">{heading}</h3>\n <span className=\"shrink-0 text-xs text-muted-foreground\">{column.failed ? null : columnCountLabel(column.total)}</span>\n </header>\n {column.value === null && (\n // The trailing column COUNTS the rows holding no value of the field: they are not on the board, and it\n // says how many there are and where they are seen, so none of them is dropped without a word.\n <p className=\"px-item-xs text-xs text-muted-foreground\">{ungroupedNote(column.total)}</p>\n )}\n {column.failed && <p role=\"alert\" className=\"px-item-xs text-xs text-destructive\">{columnLoadFailedLabel}</p>}\n <ul role=\"list\" aria-label={heading} aria-busy={column.loading ? true : undefined} className=\"flex min-h-16 flex-col gap-item-sm\">\n {column.items.map((item) => {\n const index = rowIndex++;\n const itemId = getItemId(item);\n return (\n <BoardCard<TItem>\n key={itemId || index}\n item={item}\n index={index}\n itemId={itemId}\n columnValue={column.value}\n transition={transition}\n isMoving={movingItemId === itemId}\n hintId={hintId}\n renderCard={renderCard}\n onDragStart={(id, fromValue, operation) => setDragging({ itemId: id, fromValue, operation })}\n onDragEnd={endDrag}\n onKeyboardMove={keyboardMove}\n />\n );\n })}\n </ul>\n {column.value !== null && !column.failed && column.items.length < column.total && (\n <Button\n variant={ButtonVariants_Variant.GHOST}\n size={ButtonSize.SM}\n disabled={column.loading}\n data-board-load-more={column.key}\n onClick={() => onLoadMore(column.value as string)}\n >\n {loadMoreLabel(column.total - column.items.length)}\n </Button>\n )}\n </section>\n );\n })}\n </div>\n );\n}\n"]}
1
+ {"version":3,"file":"ResourceCollectionBody_Board.js","sourceRoot":"","sources":["../../../../../../src/components/resources/collection/board/ResourceCollectionBody_Board.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAc,EAAE,WAAW,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC5D,OAAO,EAAE,kBAAkB,EAAE,uBAAuB,EAAE,MAAM,kEAAkE,CAAC;AAC/H,OAAO,EAAE,2BAA2B,EAAiB,MAAM,uBAAuB,CAAC;AACnF,OAAO,EAAE,UAAU,EAAE,MAAM,qCAAqC,CAAC;AACjE,OAAO,EAAE,EAAE,EAAE,MAAM,gCAAgC,CAAC;AACpD,OAAO,EAAE,MAAM,EAAE,sBAAsB,EAAE,MAAM,+CAA+C,CAAC;AAC/F,OAAO,EAAE,wBAAwB,EAAE,oBAAoB,EAAE,MAAM,8DAA8D,CAAC;AAE9H,OAAO,EACL,wBAAwB,EACxB,wBAAwB,GAEzB,MAAM,2FAA2F,CAAC;AAwDnG,oHAAoH;AACpH,MAAM,oBAAoB,GAAG,gCAAgC,CAAC;AAE9D,MAAM,aAAa,GAAwC,EAAE,CAAC;AAE9D;;;;GAIG;AACH,SAAS,oBAAoB,CAAC,UAAuC,EAAE,IAA6B;IAClG,MAAM,UAAU,GAAG,UAAU,EAAE,UAAU,IAAI,aAAa,CAAC;IAC3D,MAAM,UAAU,GAAG,oBAAoB,CAAC,UAAwC,EAAE;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AU,CAAC,EAAE,EACnB,QAAQ,EAAE,MAAM,CAAC,OAAO,0BACF,MAAM,CAAC,GAAG,EAChC,OAAO,EAAE,GAAG,EAAE,CAAC,UAAU,CAAC,MAAM,CAAC,KAAe,CAAC,YAEhD,aAAa,CAAC,MAAM,CAAC,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,GAC3C,CACV,KAtEI,MAAM,CAAC,GAAG,CAuEP,CACX,CAAC;YACJ,CAAC,CAAC,IACE,CACP,CAAC;AACJ,CAAC","sourcesContent":["/**\n * The BOARD body of a resource collection (`CollectionDisplayMode.BOARD`, #2298): one column per value of an enum\n * field, and moving a card between columns calls the operation the collection declared for it.\n *\n * Like `ResourceCollectionBody_Table`, the list host owns the fetched rows, the per-column reads (`useBoardColumnPages`),\n * the card renderer it shares with CARDS, the viewer's ROLE decision and the operation call. This component owns the\n * gesture, and asks each card's row which of the admitted variants' `enabledCondition` admits it, choosing the\n * highest-rights one (`useCardMoveOperation`): a member moves the rows their variant admits, an administrator any.\n *\n * ## The two ways to move a card, and why both\n *\n * - **Drag** (native HTML drag and drop): a card the host allows to move is `draggable`; a column accepts it when it\n * is a different value of the field. The trailing column of rows holding no value is never a target.\n * - **Keyboard**: a movable card is focusable, and Left / Right move it to the neighbouring column. Drag alone would\n * leave the board unusable without a pointer (WCAG 2.1.1). The keys are read only when the CARD itself has focus, so\n * the arrow keys keep their meaning inside the card's own controls.\n *\n * Nothing moves until the host's `onMoveItem` settles: the host updates the row only after the operation succeeded, so\n * a refused move leaves the card exactly where it was (the host reports the backend's refusal). There is no optimistic\n * move to undo.\n */\n\nimport React, { useCallback, useId, useState } from 'react';\nimport { documentHeadingTag, useDocumentHeadingLevel } from '~wildo-frontend-lib/components/typography/document-heading-level';\nimport { selectHighestRightsVariants, type DataMode } from '@wildo-ai/saas-models';\nimport { ButtonSize } from '@wildo-ai/presets-components-models';\nimport { cn } from '~wildo-frontend-lib/core/ui/cn';\nimport { Button, ButtonVariants_Variant } from '~wildo-frontend-lib/components/actions/button';\nimport { buildOperationEnabledKey, useOperationsEnabled } from '~wildo-frontend-lib/core/resources/hooks/useOperationEnabled';\nimport type { FrontendResourceConfiguration_Operation } from '~wildo-frontend-lib/core/resources/resources.frontend.schemas';\nimport {\n adjacentBoardColumnValue,\n selectBoardMoveOperation,\n type CollectionBoardColumn,\n} from '~wildo-frontend-lib/components/resources/collection/board/collection-board.frontend.utils';\n\nexport interface ResourceCollectionBody_BoardProps<TItem extends Record<string, unknown>> {\n /** The columns, in vocabulary order, from `boardColumnsFromPages`: each column's loaded rows and its full count. */\n columns: readonly CollectionBoardColumn<TItem>[];\n /** Load the next page of the column holding `value`. */\n onLoadMore: (value: string) => void;\n /** The button under a column that holds more rows than it has loaded. */\n loadMoreLabel: (remaining: number) => string;\n /** Shown in a column whose read failed: its rows and count are not known. */\n columnLoadFailedLabel: string;\n /** The trailing column's words: how many rows hold no value of the field, and where they can be seen. */\n ungroupedNote: (count: number) => string;\n /** The row's card — the same renderer CARDS uses, without its list item (this body supplies the `<li>`). */\n renderCard: (item: TItem, index: number) => React.ReactNode;\n /** The row's stable identifier (the resource's addressable identifier). */\n getItemId: (item: TItem) => string;\n /**\n * The operations a move may call, or `undefined` when the collection declared none or the viewer's roles admit none\n * of its variants (the board is then read-only). Each card adds the operations' own `enabledCondition` against its\n * row, so a card the backend would refuse to move is never draggable.\n */\n transition: BoardTransition | undefined;\n /**\n * Move the row to the column holding `targetValue` through `operation`, the variant this card chose for this viewer\n * and this row. Resolves once the operation has settled, refused or not.\n */\n onMoveItem: (item: TItem, targetValue: string, operation: BoardTransitionOperation) => Promise<void>;\n /** Accessible name of the whole board. */\n boardLabel: string;\n /** Heading of the trailing column of rows holding no value of the field. */\n ungroupedLabel: string;\n /** How many cards a column holds in all (loaded or not), in words. */\n columnCountLabel: (count: number) => string;\n /** The instruction a screen reader gives for a movable card (Left / Right move it). */\n moveHint: string;\n}\n\n/** One operation variant a board move may call. */\nexport type BoardTransitionOperation = FrontendResourceConfiguration_Operation<any, any, any>;\n\n/** The operations a board move may call, and what decides whether a given card may make it. */\nexport interface BoardTransition {\n /**\n * The declared transition's single-row variants whose roles the viewer holds in the organization the collection\n * addresses (`resolveBoardTransitionOperations`, then the host's `viewerMayPerformOperation`). Never empty: a viewer\n * admitted to none gets no transition at all.\n */\n operations: readonly BoardTransitionOperation[];\n resourceType: string;\n /** The data mode the rows were fetched in, so a condition reading a field a summary row lacks is reported. */\n subjectDataMode?: DataMode;\n /** The organization the collection addresses, which the condition is evaluated in. */\n organizationId?: string;\n}\n\n/** The data-transfer type a dragged card carries; scoped so a drag from elsewhere on the page is never accepted. */\nconst BOARD_CARD_DRAG_TYPE = 'application/x-wildo-board-card';\n\nconst NO_OPERATIONS: readonly BoardTransitionOperation[] = [];\n\n/**\n * The variant this card's move calls, or `undefined` when it cannot move: no transition the viewer may perform, or none\n * whose own `enabledCondition` admits THIS row. Among the variants that admit it, the highest-rights one wins, as on\n * the action bar (`selectBoardMoveOperation`). A hook per card, because the condition is evaluated against the row.\n */\nfunction useCardMoveOperation(transition: BoardTransition | undefined, item: Record<string, unknown>): BoardTransitionOperation | undefined {\n const operations = transition?.operations ?? NO_OPERATIONS;\n const enabledMap = useOperationsEnabled(operations as BoardTransitionOperation[], {\n currentObject: item,\n resourceType: transition?.resourceType,\n subjectDataMode: transition?.subjectDataMode,\n organizationId: transition?.organizationId,\n });\n const enabled = operations.filter((operation) => enabledMap.get(buildOperationEnabledKey(operation))?.isEnabled === true);\n return selectBoardMoveOperation(enabled, (variants) => selectHighestRightsVariants(variants as never[]) as BoardTransitionOperation[]);\n}\n\ninterface BoardCardProps<TItem extends Record<string, unknown>> {\n item: TItem;\n index: number;\n itemId: string;\n columnValue: string | null;\n transition: BoardTransition | undefined;\n isMoving: boolean;\n hintId: string;\n renderCard: (item: TItem, index: number) => React.ReactNode;\n onDragStart: (itemId: string, fromValue: string | null, operation: BoardTransitionOperation) => void;\n onDragEnd: () => void;\n /** Move to the neighbouring column in `direction`; the board knows the columns. */\n onKeyboardMove: (item: TItem, fromValue: string | null, direction: -1 | 1, operation: BoardTransitionOperation) => void;\n}\n\nfunction BoardCard<TItem extends Record<string, unknown>>({\n item,\n index,\n itemId,\n columnValue,\n transition,\n isMoving,\n hintId,\n renderCard,\n onDragStart,\n onDragEnd,\n onKeyboardMove,\n}: BoardCardProps<TItem>): React.JSX.Element {\n const moveOperation = useCardMoveOperation(transition, item);\n const movable = moveOperation !== undefined && !isMoving;\n return (\n <li\n className={cn('list-none rounded-md border bg-background', movable && 'cursor-grab', isMoving && 'opacity-60')}\n data-board-card={itemId}\n data-board-card-movable={movable ? 'true' : undefined}\n draggable={movable}\n tabIndex={movable ? 0 : undefined}\n aria-describedby={movable ? hintId : undefined}\n aria-busy={isMoving ? true : undefined}\n onDragStart={(event) => {\n if (!movable || !moveOperation) {\n event.preventDefault();\n return;\n }\n event.dataTransfer.setData(BOARD_CARD_DRAG_TYPE, itemId);\n event.dataTransfer.effectAllowed = 'move';\n onDragStart(itemId, columnValue, moveOperation);\n }}\n onDragEnd={onDragEnd}\n onKeyDown={(event) => {\n // Only the card itself: an arrow key inside the card's own controls keeps its meaning there.\n if (!movable || !moveOperation || event.target !== event.currentTarget) return;\n const direction = event.key === 'ArrowRight' ? 1 : event.key === 'ArrowLeft' ? -1 : 0;\n if (direction === 0) return;\n event.preventDefault();\n onKeyboardMove(item, columnValue, direction, moveOperation);\n }}\n >\n {renderCard(item, index)}\n </li>\n );\n}\n\nexport function ResourceCollectionBody_Board<TItem extends Record<string, unknown>>({\n columns,\n onLoadMore,\n loadMoreLabel,\n columnLoadFailedLabel,\n ungroupedNote,\n renderCard,\n getItemId,\n transition,\n onMoveItem,\n boardLabel,\n ungroupedLabel,\n columnCountLabel,\n moveHint,\n}: ResourceCollectionBody_BoardProps<TItem>): React.JSX.Element {\n // A column's heading takes the outline's level under the page's `h1`; a fixed `h3` skipped one (#3867).\n const ColumnHeadingTag = documentHeadingTag(useDocumentHeadingLevel());\n const hintId = useId();\n /**\n * The card being dragged, and the column it came from — kept in state because `dragover` cannot read the payload.\n * A drag is only ever STARTED by a card that may move (`BoardCard`), which also chose the variant its move calls, so\n * a drop needs no second permission check.\n */\n const [dragging, setDragging] = useState<{ itemId: string; fromValue: string | null; operation: BoardTransitionOperation } | null>(null);\n const [dropTargetValue, setDropTargetValue] = useState<string | null>(null);\n /** The row whose move is in flight: it cannot be moved again until the first move settles. */\n const [movingItemId, setMovingItemId] = useState<string | null>(null);\n\n const findItem = useCallback((itemId: string): TItem | undefined => {\n for (const column of columns) {\n const found = column.items.find((item) => getItemId(item) === itemId);\n if (found) return found;\n }\n return undefined;\n }, [columns, getItemId]);\n\n const move = useCallback(async (item: TItem, targetValue: string, operation: BoardTransitionOperation) => {\n setMovingItemId(getItemId(item));\n try {\n await onMoveItem(item, targetValue, operation);\n } finally {\n setMovingItemId(null);\n }\n }, [getItemId, onMoveItem]);\n\n const endDrag = useCallback(() => {\n setDragging(null);\n setDropTargetValue(null);\n }, []);\n\n const keyboardMove = useCallback((item: TItem, fromValue: string | null, direction: -1 | 1, operation: BoardTransitionOperation) => {\n const targetValue = adjacentBoardColumnValue(columns, fromValue, direction);\n if (targetValue !== undefined) void move(item, targetValue, operation);\n }, [columns, move]);\n\n let rowIndex = 0;\n return (\n <div role=\"group\" aria-label={boardLabel} className=\"flex gap-group overflow-x-auto pb-item-sm\" data-slot=\"collection-board\">\n <span id={hintId} className=\"sr-only\">{moveHint}</span>\n {columns.map((column) => {\n // A column receives a card from ANOTHER column, and only when it names a value: the trailing column of rows\n // holding none has nothing to set the field to.\n const accepts = column.value !== null && dragging !== null && dragging.fromValue !== column.value;\n const isDropTarget = accepts && dropTargetValue === column.value;\n const heading = column.label ?? ungroupedLabel;\n return (\n <section\n key={column.key}\n aria-label={heading}\n data-board-column={column.key}\n data-drop-target={isDropTarget ? 'true' : undefined}\n className={cn(\n 'flex w-72 shrink-0 flex-col gap-item-sm rounded-lg border bg-muted/20 p-item-sm',\n isDropTarget && 'border-primary bg-muted/40',\n )}\n onDragOver={(event) => {\n if (!accepts) return;\n event.preventDefault();\n event.dataTransfer.dropEffect = 'move';\n if (dropTargetValue !== column.value) setDropTargetValue(column.value);\n }}\n onDragLeave={(event) => {\n if (event.currentTarget.contains(event.relatedTarget as Node | null)) return;\n if (dropTargetValue === column.value) setDropTargetValue(null);\n }}\n onDrop={(event) => {\n if (!accepts || column.value === null) return;\n event.preventDefault();\n const itemId = event.dataTransfer.getData(BOARD_CARD_DRAG_TYPE) || dragging?.itemId;\n const operation = dragging?.itemId === itemId ? dragging?.operation : undefined;\n endDrag();\n const item = itemId ? findItem(itemId) : undefined;\n if (item && operation) void move(item, column.value, operation);\n }}\n >\n <header className=\"flex items-baseline justify-between gap-item-sm px-item-xs\">\n <ColumnHeadingTag className=\"truncate text-xs font-medium text-muted-foreground\">{heading}</ColumnHeadingTag>\n <span className=\"shrink-0 text-xs text-muted-foreground\">{column.failed ? null : columnCountLabel(column.total)}</span>\n </header>\n {column.value === null && (\n // The trailing column COUNTS the rows holding no value of the field: they are not on the board, and it\n // says how many there are and where they are seen, so none of them is dropped without a word.\n <p className=\"px-item-xs text-xs text-muted-foreground\">{ungroupedNote(column.total)}</p>\n )}\n {column.failed && <p role=\"alert\" className=\"px-item-xs text-xs text-destructive\">{columnLoadFailedLabel}</p>}\n <ul role=\"list\" aria-label={heading} aria-busy={column.loading ? true : undefined} className=\"flex min-h-16 flex-col gap-item-sm\">\n {column.items.map((item) => {\n const index = rowIndex++;\n const itemId = getItemId(item);\n return (\n <BoardCard<TItem>\n key={itemId || index}\n item={item}\n index={index}\n itemId={itemId}\n columnValue={column.value}\n transition={transition}\n isMoving={movingItemId === itemId}\n hintId={hintId}\n renderCard={renderCard}\n onDragStart={(id, fromValue, operation) => setDragging({ itemId: id, fromValue, operation })}\n onDragEnd={endDrag}\n onKeyboardMove={keyboardMove}\n />\n );\n })}\n </ul>\n {column.value !== null && !column.failed && column.items.length < column.total && (\n <Button\n variant={ButtonVariants_Variant.GHOST}\n size={ButtonSize.SM}\n disabled={column.loading}\n data-board-load-more={column.key}\n onClick={() => onLoadMore(column.value as string)}\n >\n {loadMoreLabel(column.total - column.items.length)}\n </Button>\n )}\n </section>\n );\n })}\n </div>\n );\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"ResourceCollectionBody_Calendar.d.ts","sourceRoot":"","sources":["../../../../../../src/components/resources/collection/calendar/ResourceCollectionBody_Calendar.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAA0D,MAAM,OAAO,CAAC;AAO/E,OAAO,EAML,KAAK,eAAe,EACrB,MAAM,iGAAiG,CAAC;AAEzG,MAAM,WAAW,oCAAoC,CAAC,KAAK,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IACzF,mEAAmE;IACnE,KAAK,EAAE,SAAS,CAAC,SAAS,eAAe,EAAE,CAAC,EAAE,CAAC;IAC/C,mFAAmF;IACnF,UAAU,EAAE,WAAW,CAAC,MAAM,EAAE,SAAS,KAAK,EAAE,CAAC,CAAC;IAClD,6DAA6D;IAC7D,KAAK,EAAE,IAAI,CAAC;IACZ,kDAAkD;IAClD,KAAK,EAAE,IAAI,CAAC;IACZ,qEAAqE;IACrE,cAAc,EAAE,MAAM,CAAC;IACvB,oEAAoE;IACpE,aAAa,EAAE,CAAC,KAAK,EAAE,IAAI,KAAK,IAAI,CAAC;IACrC,4DAA4D;IAC5D,YAAY,EAAE,MAAM,CAAC;IACrB,wDAAwD;IACxD,aAAa,EAAE,SAAS,MAAM,EAAE,CAAC;IACjC,sCAAsC;IACtC,cAAc,EAAE,CAAC,GAAG,EAAE,IAAI,KAAK,MAAM,CAAC;IACtC,4EAA4E;IAC5E,QAAQ,EAAE,CAAC,GAAG,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC;IAC/C,SAAS,EAAE,CAAC,IAAI,EAAE,KAAK,KAAK,MAAM,CAAC;IACnC,yCAAyC;IACzC,YAAY,EAAE,CAAC,IAAI,EAAE,KAAK,KAAK,MAAM,CAAC;IACtC,2FAA2F;IAC3F,WAAW,EAAE,CAAC,IAAI,EAAE,KAAK,KAAK,OAAO,CAAC;IACtC,UAAU,EAAE,CAAC,IAAI,EAAE,KAAK,KAAK,IAAI,CAAC;IAClC,aAAa,EAAE,MAAM,CAAC;IACtB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,cAAc,EAAE,MAAM,CAAC;IACvB,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;CACtB;AAID,wBAAgB,+BAA+B,CAAC,KAAK,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,EACrF,KAAK,EACL,UAAU,EACV,KAAK,EACL,KAAK,EACL,cAAc,EACd,aAAa,EACb,YAAY,EACZ,aAAa,EACb,cAAc,EACd,QAAQ,EACR,SAAS,EACT,YAAY,EACZ,WAAW,EACX,UAAU,EACV,aAAa,EACb,kBAAkB,EAClB,cAAc,EACd,UAAU,EACV,YAAY,GACb,EAAE,oCAAoC,CAAC,KAAK,CAAC,GAAG,KAAK,CAAC,GAAG,CAAC,OAAO,CAuJjE"}
1
+ {"version":3,"file":"ResourceCollectionBody_Calendar.d.ts","sourceRoot":"","sources":["../../../../../../src/components/resources/collection/calendar/ResourceCollectionBody_Calendar.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAA0D,MAAM,OAAO,CAAC;AAQ/E,OAAO,EAML,KAAK,eAAe,EACrB,MAAM,iGAAiG,CAAC;AAEzG,MAAM,WAAW,oCAAoC,CAAC,KAAK,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IACzF,mEAAmE;IACnE,KAAK,EAAE,SAAS,CAAC,SAAS,eAAe,EAAE,CAAC,EAAE,CAAC;IAC/C,mFAAmF;IACnF,UAAU,EAAE,WAAW,CAAC,MAAM,EAAE,SAAS,KAAK,EAAE,CAAC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,oCAAoC,CAAC,KAAK,CAAC,GAAG,KAAK,CAAC,GAAG,CAAC,OAAO,CAyJjE"}
@@ -15,6 +15,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
15
15
  * items of other days are reached by moving to their day first, so a month of rows does not become a hundred tab stops.
16
16
  */
17
17
  import { useCallback, useEffect, useId, useRef, useState } from 'react';
18
+ import { documentHeadingTag, useDocumentHeadingLevel } from '../../../../components/typography/document-heading-level.js';
18
19
  import { ButtonSize } from '@wildo-ai/presets-components-models';
19
20
  import { cn } from '../../../../core/ui/cn.js';
20
21
  import { focusIndicatorClasses, FocusIndicatorShape } from '../../../../core/ui/themes/focus-indicator.js';
@@ -24,6 +25,8 @@ import { IconSize, StandardIconReference } from '../../../../core/icons/icon-reg
24
25
  import { calendarDayKey, calendarKeyboardStep, calendarMonthOf, moveCalendarFocus, shiftCalendarMonth, } from '../../../../components/resources/collection/calendar/collection-calendar.frontend.utils.js';
25
26
  const NO_ITEMS = [];
26
27
  export function ResourceCollectionBody_Calendar({ weeks, itemsByDay, month, today, firstDayOfWeek, onMonthChange, monthHeading, weekdayLabels, dayNumberLabel, dayLabel, getItemId, getItemLabel, canOpenItem, onOpenItem, calendarLabel, previousMonthLabel, nextMonthLabel, todayLabel, keyboardHint, }) {
28
+ // The month heading takes the outline's level under the page's `h1`; a fixed `h3` skipped one (#3867).
29
+ const MonthHeadingTag = documentHeadingTag(useDocumentHeadingLevel());
27
30
  const hintId = useId();
28
31
  const headingId = useId();
29
32
  const { renderIcon } = useIconRegistry();
@@ -61,7 +64,7 @@ export function ResourceCollectionBody_Calendar({ weeks, itemsByDay, month, toda
61
64
  focusDay(moveCalendarFocus(day, step, firstDayOfWeek));
62
65
  };
63
66
  const todayKey = calendarDayKey(today);
64
- return (_jsxs("div", { className: "flex flex-col gap-item-sm", "data-slot": "collection-calendar", children: [_jsxs("div", { className: "flex items-center gap-item-sm", children: [_jsx(Button, { variant: ButtonVariants_Variant.OUTLINE, size: ButtonSize.ICON_SM, "aria-label": previousMonthLabel, title: previousMonthLabel, onClick: () => onMonthChange(shiftCalendarMonth(month, -1)), children: _jsx("span", { "aria-hidden": "true", children: renderIcon(StandardIconReference.CHEVRON_LEFT, { size: IconSize.SM }) }) }), _jsx(Button, { variant: ButtonVariants_Variant.OUTLINE, size: ButtonSize.ICON_SM, "aria-label": nextMonthLabel, title: nextMonthLabel, onClick: () => onMonthChange(shiftCalendarMonth(month, 1)), children: _jsx("span", { "aria-hidden": "true", children: renderIcon(StandardIconReference.CHEVRON_RIGHT, { size: IconSize.SM }) }) }), _jsx("h3", { id: headingId, className: "text-sm font-medium", "aria-live": "polite", children: monthHeading }), _jsx(Button, { variant: ButtonVariants_Variant.GHOST, size: ButtonSize.SM, className: "ms-auto", onClick: () => focusDay(today), children: todayLabel })] }), _jsx("span", { id: hintId, className: "sr-only", children: keyboardHint }), _jsxs("table", { ref: gridRef, role: "grid", "aria-label": calendarLabel, "aria-describedby": hintId, className: "w-full table-fixed border-collapse", children: [_jsx("caption", { className: "sr-only", children: monthHeading }), _jsx("thead", { children: _jsx("tr", { children: weekdayLabels.map((label, index) => (_jsx("th", { scope: "col", className: "pb-item-xs text-xs font-medium text-muted-foreground", children: label }, index))) }) }), _jsx("tbody", { children: weeks.map((week) => (_jsx("tr", { children: week.map(({ day, key, inMonth }) => {
67
+ return (_jsxs("div", { className: "flex flex-col gap-item-sm", "data-slot": "collection-calendar", children: [_jsxs("div", { className: "flex items-center gap-item-sm", children: [_jsx(Button, { variant: ButtonVariants_Variant.OUTLINE, size: ButtonSize.ICON_SM, "aria-label": previousMonthLabel, title: previousMonthLabel, onClick: () => onMonthChange(shiftCalendarMonth(month, -1)), children: _jsx("span", { "aria-hidden": "true", children: renderIcon(StandardIconReference.CHEVRON_LEFT, { size: IconSize.SM }) }) }), _jsx(Button, { variant: ButtonVariants_Variant.OUTLINE, size: ButtonSize.ICON_SM, "aria-label": nextMonthLabel, title: nextMonthLabel, onClick: () => onMonthChange(shiftCalendarMonth(month, 1)), children: _jsx("span", { "aria-hidden": "true", children: renderIcon(StandardIconReference.CHEVRON_RIGHT, { size: IconSize.SM }) }) }), _jsx(MonthHeadingTag, { id: headingId, className: "text-sm font-medium", "aria-live": "polite", children: monthHeading }), _jsx(Button, { variant: ButtonVariants_Variant.GHOST, size: ButtonSize.SM, className: "ms-auto", onClick: () => focusDay(today), children: todayLabel })] }), _jsx("span", { id: hintId, className: "sr-only", children: keyboardHint }), _jsxs("table", { ref: gridRef, role: "grid", "aria-label": calendarLabel, "aria-describedby": hintId, className: "w-full table-fixed border-collapse", children: [_jsx("caption", { className: "sr-only", children: monthHeading }), _jsx("thead", { children: _jsx("tr", { children: weekdayLabels.map((label, index) => (_jsx("th", { scope: "col", className: "pb-item-xs text-xs font-medium text-muted-foreground", children: label }, index))) }) }), _jsx("tbody", { children: weeks.map((week) => (_jsx("tr", { children: week.map(({ day, key, inMonth }) => {
65
68
  const items = itemsByDay.get(key) ?? NO_ITEMS;
66
69
  const isFocused = key === focusedKey;
67
70
  return (_jsxs("td", { role: "gridcell", "data-calendar-day": key, "data-in-month": inMonth ? 'true' : undefined, "data-today": key === todayKey ? 'true' : undefined, "aria-label": dayLabel(day, items.length), "aria-current": key === todayKey ? 'date' : undefined, tabIndex: isFocused ? 0 : -1, onKeyDown: (event) => onDayKeyDown(event, day), onFocus: (event) => { if (event.target === event.currentTarget && !isFocused)
@@ -1 +1 @@
1
- {"version":3,"file":"ResourceCollectionBody_Calendar.js","sourceRoot":"","sources":["../../../../../../src/components/resources/collection/calendar/ResourceCollectionBody_Calendar.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAc,EAAE,WAAW,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC/E,OAAO,EAAE,UAAU,EAAE,MAAM,qCAAqC,CAAC;AACjE,OAAO,EAAE,EAAE,EAAE,MAAM,gCAAgC,CAAC;AACpD,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,KAAK,GAAQ,CACjF,IAdM,MAAM,CAeV,CACN,CAAC;4CACJ,CAAC,CAAC,GACC,CACN,KApDI,GAAG,CAqDL,CACN,CAAC;4BACJ,CAAC,CAAC,IA7DK,IAAI,CAAC,CAAC,CAAE,CAAC,GAAG,CA8DhB,CACN,CAAC,GACI,IACF,IACJ,CACP,CAAC;AACJ,CAAC","sourcesContent":["/**\n * The CALENDAR body of a resource collection (`CollectionDisplayMode.CALENDAR`, #2298): a month grid, each row on the\n * day its date field falls on.\n *\n * Like the table and board bodies, the list host owns the fetch (whose window on the date field IS the visible weeks,\n * so moving to another month refetches), the bucketing by day, the row's label and what opening a row does. This\n * component owns the grid, the month navigation and the keyboard.\n *\n * ## Keyboard (the WAI-ARIA date-grid pattern)\n *\n * The grid is one tab stop: the FOCUSED day. Arrow keys move between days (Left/Right a day, Up/Down a week), Home/End\n * to the start and end of the week, Page Up/Page Down a month. Moving past the displayed month shows the neighbouring\n * month, and the focus follows. Tab from the focused day reaches that day's items (buttons), and only that day's: the\n * items of other days are reached by moving to their day first, so a month of rows does not become a hundred tab stops.\n */\n\nimport React, { useCallback, useEffect, useId, useRef, useState } from 'react';\nimport { ButtonSize } from '@wildo-ai/presets-components-models';\nimport { cn } from '~wildo-frontend-lib/core/ui/cn';\nimport { focusIndicatorClasses, FocusIndicatorShape } from '~wildo-frontend-lib/core/ui/themes/focus-indicator';\nimport { Button, ButtonVariants_Variant } from '~wildo-frontend-lib/components/actions/button';\nimport { useIconRegistry } from '~wildo-frontend-lib/core/icons/useIconRegistry';\nimport { IconSize, StandardIconReference } from '~wildo-frontend-lib/core/icons/icon-registry.frontend.schemas';\nimport {\n calendarDayKey,\n calendarKeyboardStep,\n calendarMonthOf,\n moveCalendarFocus,\n shiftCalendarMonth,\n type CalendarGridDay,\n} from '~wildo-frontend-lib/components/resources/collection/calendar/collection-calendar.frontend.utils';\n\nexport interface ResourceCollectionBody_CalendarProps<TItem extends Record<string, unknown>> {\n /** The weeks of the displayed month (`buildCalendarMonthGrid`). */\n weeks: readonly (readonly CalendarGridDay[])[];\n /** The rows of each day, keyed by `calendarDayKey` (`groupItemsByCalendarDay`). */\n itemsByDay: ReadonlyMap<string, readonly TItem[]>;\n /** The first day of the displayed month, as UTC midnight. */\n month: Date;\n /** Today, as UTC midnight of the reader's day. */\n today: Date;\n /** The first day of the reader's week, `0` Sunday … `6` Saturday. */\n firstDayOfWeek: number;\n /** Show another month (the host moves its fetch window with it). */\n onMonthChange: (month: Date) => void;\n /** The heading of the displayed month (\"November 2026\"). */\n monthHeading: string;\n /** The seven weekday column headings, in grid order. */\n weekdayLabels: readonly string[];\n /** The day number shown in a cell. */\n dayNumberLabel: (day: Date) => string;\n /** A day cell's accessible name: its date and how many items fall on it. */\n dayLabel: (day: Date, count: number) => string;\n getItemId: (item: TItem) => string;\n /** The row's name as a list shows it. */\n getItemLabel: (item: TItem) => string;\n /** Whether the row can be opened; one that cannot is shown and not offered as a button. */\n canOpenItem: (item: TItem) => boolean;\n onOpenItem: (item: TItem) => void;\n calendarLabel: string;\n previousMonthLabel: string;\n nextMonthLabel: string;\n todayLabel: string;\n keyboardHint: string;\n}\n\nconst NO_ITEMS: readonly unknown[] = [];\n\nexport function ResourceCollectionBody_Calendar<TItem extends Record<string, unknown>>({\n weeks,\n itemsByDay,\n month,\n today,\n firstDayOfWeek,\n onMonthChange,\n monthHeading,\n weekdayLabels,\n dayNumberLabel,\n dayLabel,\n getItemId,\n getItemLabel,\n canOpenItem,\n onOpenItem,\n calendarLabel,\n previousMonthLabel,\n nextMonthLabel,\n todayLabel,\n keyboardHint,\n}: ResourceCollectionBody_CalendarProps<TItem>): React.JSX.Element {\n const hintId = useId();\n const headingId = useId();\n const { renderIcon } = useIconRegistry();\n const gridRef = useRef<HTMLTableElement>(null);\n /** The day holding the grid's single tab stop. Kept inside the displayed month when the month changes. */\n const [focusedDay, setFocusedDay] = useState<Date>(() => (calendarMonthOf(today).getTime() === calendarMonthOf(month).getTime() ? today : calendarMonthOf(month)));\n /** Set by a keyboard move, so the focus follows the move once the grid has re-rendered (the month may change). */\n const moveFocusRef = useRef(false);\n\n // A month changed by the buttons (or by the host) brings the tab stop with it.\n useEffect(() => {\n setFocusedDay((current) => (calendarMonthOf(current).getTime() === calendarMonthOf(month).getTime() ? current : calendarMonthOf(month)));\n }, [month]);\n\n const focusedKey = calendarDayKey(focusedDay);\n useEffect(() => {\n if (!moveFocusRef.current) return;\n moveFocusRef.current = false;\n gridRef.current?.querySelector<HTMLElement>(`[data-calendar-day=\"${focusedKey}\"]`)?.focus();\n }, [focusedKey, weeks]);\n\n const focusDay = useCallback((day: Date) => {\n moveFocusRef.current = true;\n setFocusedDay(day);\n const target = calendarMonthOf(day);\n if (target.getTime() !== calendarMonthOf(month).getTime()) onMonthChange(target);\n }, [month, onMonthChange]);\n\n const onDayKeyDown = (event: React.KeyboardEvent<HTMLElement>, day: Date) => {\n // Only the day cell itself: the arrow keys keep their meaning on the items inside it.\n if (event.target !== event.currentTarget) return;\n const step = calendarKeyboardStep(event.key);\n if (!step) return;\n event.preventDefault();\n focusDay(moveCalendarFocus(day, step, firstDayOfWeek));\n };\n\n const todayKey = calendarDayKey(today);\n return (\n <div className=\"flex flex-col gap-item-sm\" data-slot=\"collection-calendar\">\n <div className=\"flex items-center gap-item-sm\">\n <Button\n variant={ButtonVariants_Variant.OUTLINE}\n size={ButtonSize.ICON_SM}\n aria-label={previousMonthLabel}\n title={previousMonthLabel}\n onClick={() => onMonthChange(shiftCalendarMonth(month, -1))}\n >\n <span aria-hidden=\"true\">{renderIcon(StandardIconReference.CHEVRON_LEFT, { size: IconSize.SM })}</span>\n </Button>\n <Button\n variant={ButtonVariants_Variant.OUTLINE}\n size={ButtonSize.ICON_SM}\n aria-label={nextMonthLabel}\n title={nextMonthLabel}\n onClick={() => onMonthChange(shiftCalendarMonth(month, 1))}\n >\n <span aria-hidden=\"true\">{renderIcon(StandardIconReference.CHEVRON_RIGHT, { size: IconSize.SM })}</span>\n </Button>\n <h3 id={headingId} className=\"text-sm font-medium\" aria-live=\"polite\">{monthHeading}</h3>\n <Button variant={ButtonVariants_Variant.GHOST} size={ButtonSize.SM} className=\"ms-auto\" onClick={() => focusDay(today)}>\n {todayLabel}\n </Button>\n </div>\n <span id={hintId} className=\"sr-only\">{keyboardHint}</span>\n <table\n ref={gridRef}\n role=\"grid\"\n aria-label={calendarLabel}\n aria-describedby={hintId}\n className=\"w-full table-fixed border-collapse\"\n >\n <caption className=\"sr-only\">{monthHeading}</caption>\n <thead>\n <tr>\n {weekdayLabels.map((label, index) => (\n <th key={index} scope=\"col\" className=\"pb-item-xs text-xs font-medium text-muted-foreground\">{label}</th>\n ))}\n </tr>\n </thead>\n <tbody>\n {weeks.map((week) => (\n <tr key={week[0]!.key}>\n {week.map(({ day, key, inMonth }) => {\n const items = itemsByDay.get(key) ?? (NO_ITEMS as readonly TItem[]);\n const isFocused = key === focusedKey;\n return (\n <td\n key={key}\n role=\"gridcell\"\n data-calendar-day={key}\n data-in-month={inMonth ? 'true' : undefined}\n data-today={key === todayKey ? 'true' : undefined}\n aria-label={dayLabel(day, items.length)}\n aria-current={key === todayKey ? 'date' : undefined}\n tabIndex={isFocused ? 0 : -1}\n onKeyDown={(event) => onDayKeyDown(event, day)}\n onFocus={(event) => { if (event.target === event.currentTarget && !isFocused) setFocusedDay(day); }}\n className={cn(\n // A day cell sits packed in the grid, its neighbours flush against it: the INSET shape draws\n // inside the box so no neighbour or clipping ancestor covers it.\n 'h-24 border align-top p-item-xs',\n focusIndicatorClasses(FocusIndicatorShape.INSET),\n !inMonth && 'bg-muted/30 text-muted-foreground',\n )}\n >\n <span\n aria-hidden=\"true\"\n className={cn(\n 'mb-item-xs inline-flex size-6 items-center justify-center rounded-full text-xs',\n key === todayKey && 'bg-primary text-primary-foreground',\n )}\n >\n {dayNumberLabel(day)}\n </span>\n {items.length > 0 && (\n <ul role=\"list\" className=\"flex max-h-28 flex-col gap-px overflow-y-auto\">\n {items.map((item) => {\n const itemId = getItemId(item);\n const label = getItemLabel(item);\n return (\n <li key={itemId} className=\"list-none\" data-calendar-item={itemId}>\n {canOpenItem(item) ? (\n <Button\n variant={ButtonVariants_Variant.GHOST}\n size={ButtonSize.XS}\n tabIndex={isFocused ? 0 : -1}\n className=\"h-auto w-full justify-start truncate px-item-xs py-px text-start text-xs font-normal\"\n title={label}\n onClick={() => onOpenItem(item)}\n >\n {label}\n </Button>\n ) : (\n <span className=\"block truncate px-item-xs text-xs\" title={label}>{label}</span>\n )}\n </li>\n );\n })}\n </ul>\n )}\n </td>\n );\n })}\n </tr>\n ))}\n </tbody>\n </table>\n </div>\n );\n}\n"]}
1
+ {"version":3,"file":"ResourceCollectionBody_Calendar.js","sourceRoot":"","sources":["../../../../../../src/components/resources/collection/calendar/ResourceCollectionBody_Calendar.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAc,EAAE,WAAW,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC/E,OAAO,EAAE,kBAAkB,EAAE,uBAAuB,EAAE,MAAM,kEAAkE,CAAC;AAC/H,OAAO,EAAE,UAAU,EAAE,MAAM,qCAAqC,CAAC;AACjE,OAAO,EAAE,EAAE,EAAE,MAAM,gCAAgC,CAAC;AACpD,OAAO,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,MAAM,oDAAoD,CAAC;AAChH,OAAO,EAAE,MAAM,EAAE,sBAAsB,EAAE,MAAM,+CAA+C,CAAC;AAC/F,OAAO,EAAE,eAAe,EAAE,MAAM,gDAAgD,CAAC;AACjF,OAAO,EAAE,QAAQ,EAAE,qBAAqB,EAAE,MAAM,+DAA+D,CAAC;AAChH,OAAO,EACL,cAAc,EACd,oBAAoB,EACpB,eAAe,EACf,iBAAiB,EACjB,kBAAkB,GAEnB,MAAM,iGAAiG,CAAC;AAoCzG,MAAM,QAAQ,GAAuB,EAAE,CAAC;AAExC,MAAM,UAAU,+BAA+B,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IAAI,mCAAmC,CAChD,aAED,8BACc,MAAM,EAClB,SAAS,EAAE,EAAE,CACX,gFAAgF,EAChF,GAAG,KAAK,QAAQ,IAAI,oCAAoC,CACzD,YAEA,cAAc,CAAC,GAAG,CAAC,GACf,EACN,KAAK,CAAC,MAAM,GAAG,CAAC,IAAI,CACnB,aAAI,IAAI,EAAC,MAAM,EAAC,SAAS,EAAC,+CAA+C,YACtE,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE;gDAClB,MAAM,MAAM,GAAG,SAAS,CAAC,IAAI,CAAC,CAAC;gDAC/B,MAAM,KAAK,GAAG,YAAY,CAAC,IAAI,CAAC,CAAC;gDACjC,OAAO,CACL,aAAiB,SAAS,EAAC,WAAW,wBAAqB,MAAM,YAC9D,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CACnB,KAAC,MAAM,IACL,OAAO,EAAE,sBAAsB,CAAC,KAAK,EACrC,IAAI,EAAE,UAAU,CAAC,EAAE,EACnB,QAAQ,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAC5B,SAAS,EAAC,sFAAsF,EAChG,KAAK,EAAE,KAAK,EACZ,OAAO,EAAE,GAAG,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,YAE9B,KAAK,GACC,CACV,CAAC,CAAC,CAAC,CACF,eAAM,SAAS,EAAC,mCAAmC,EAAC,KAAK,EAAE,KAAK,YAAG,KAAK,GAAQ,CACjF,IAdM,MAAM,CAeV,CACN,CAAC;4CACJ,CAAC,CAAC,GACC,CACN,KApDI,GAAG,CAqDL,CACN,CAAC;4BACJ,CAAC,CAAC,IA7DK,IAAI,CAAC,CAAC,CAAE,CAAC,GAAG,CA8DhB,CACN,CAAC,GACI,IACF,IACJ,CACP,CAAC;AACJ,CAAC","sourcesContent":["/**\n * The CALENDAR body of a resource collection (`CollectionDisplayMode.CALENDAR`, #2298): a month grid, each row on the\n * day its date field falls on.\n *\n * Like the table and board bodies, the list host owns the fetch (whose window on the date field IS the visible weeks,\n * so moving to another month refetches), the bucketing by day, the row's label and what opening a row does. This\n * component owns the grid, the month navigation and the keyboard.\n *\n * ## Keyboard (the WAI-ARIA date-grid pattern)\n *\n * The grid is one tab stop: the FOCUSED day. Arrow keys move between days (Left/Right a day, Up/Down a week), Home/End\n * to the start and end of the week, Page Up/Page Down a month. Moving past the displayed month shows the neighbouring\n * month, and the focus follows. Tab from the focused day reaches that day's items (buttons), and only that day's: the\n * items of other days are reached by moving to their day first, so a month of rows does not become a hundred tab stops.\n */\n\nimport React, { useCallback, useEffect, useId, useRef, useState } from 'react';\nimport { documentHeadingTag, useDocumentHeadingLevel } from '~wildo-frontend-lib/components/typography/document-heading-level';\nimport { ButtonSize } from '@wildo-ai/presets-components-models';\nimport { cn } from '~wildo-frontend-lib/core/ui/cn';\nimport { focusIndicatorClasses, FocusIndicatorShape } from '~wildo-frontend-lib/core/ui/themes/focus-indicator';\nimport { Button, ButtonVariants_Variant } from '~wildo-frontend-lib/components/actions/button';\nimport { useIconRegistry } from '~wildo-frontend-lib/core/icons/useIconRegistry';\nimport { IconSize, StandardIconReference } from '~wildo-frontend-lib/core/icons/icon-registry.frontend.schemas';\nimport {\n calendarDayKey,\n calendarKeyboardStep,\n calendarMonthOf,\n moveCalendarFocus,\n shiftCalendarMonth,\n type CalendarGridDay,\n} from '~wildo-frontend-lib/components/resources/collection/calendar/collection-calendar.frontend.utils';\n\nexport interface ResourceCollectionBody_CalendarProps<TItem extends Record<string, unknown>> {\n /** The weeks of the displayed month (`buildCalendarMonthGrid`). */\n weeks: readonly (readonly CalendarGridDay[])[];\n /** The rows of each day, keyed by `calendarDayKey` (`groupItemsByCalendarDay`). */\n itemsByDay: ReadonlyMap<string, readonly TItem[]>;\n /** The first day of the displayed month, as UTC midnight. */\n month: Date;\n /** Today, as UTC midnight of the reader's day. */\n today: Date;\n /** The first day of the reader's week, `0` Sunday … `6` Saturday. */\n firstDayOfWeek: number;\n /** Show another month (the host moves its fetch window with it). */\n onMonthChange: (month: Date) => void;\n /** The heading of the displayed month (\"November 2026\"). */\n monthHeading: string;\n /** The seven weekday column headings, in grid order. */\n weekdayLabels: readonly string[];\n /** The day number shown in a cell. */\n dayNumberLabel: (day: Date) => string;\n /** A day cell's accessible name: its date and how many items fall on it. */\n dayLabel: (day: Date, count: number) => string;\n getItemId: (item: TItem) => string;\n /** The row's name as a list shows it. */\n getItemLabel: (item: TItem) => string;\n /** Whether the row can be opened; one that cannot is shown and not offered as a button. */\n canOpenItem: (item: TItem) => boolean;\n onOpenItem: (item: TItem) => void;\n calendarLabel: string;\n previousMonthLabel: string;\n nextMonthLabel: string;\n todayLabel: string;\n keyboardHint: string;\n}\n\nconst NO_ITEMS: readonly unknown[] = [];\n\nexport function ResourceCollectionBody_Calendar<TItem extends Record<string, unknown>>({\n weeks,\n itemsByDay,\n month,\n today,\n firstDayOfWeek,\n onMonthChange,\n monthHeading,\n weekdayLabels,\n dayNumberLabel,\n dayLabel,\n getItemId,\n getItemLabel,\n canOpenItem,\n onOpenItem,\n calendarLabel,\n previousMonthLabel,\n nextMonthLabel,\n todayLabel,\n keyboardHint,\n}: ResourceCollectionBody_CalendarProps<TItem>): React.JSX.Element {\n // The month heading takes the outline's level under the page's `h1`; a fixed `h3` skipped one (#3867).\n const MonthHeadingTag = documentHeadingTag(useDocumentHeadingLevel());\n const hintId = useId();\n const headingId = useId();\n const { renderIcon } = useIconRegistry();\n const gridRef = useRef<HTMLTableElement>(null);\n /** The day holding the grid's single tab stop. Kept inside the displayed month when the month changes. */\n const [focusedDay, setFocusedDay] = useState<Date>(() => (calendarMonthOf(today).getTime() === calendarMonthOf(month).getTime() ? today : calendarMonthOf(month)));\n /** Set by a keyboard move, so the focus follows the move once the grid has re-rendered (the month may change). */\n const moveFocusRef = useRef(false);\n\n // A month changed by the buttons (or by the host) brings the tab stop with it.\n useEffect(() => {\n setFocusedDay((current) => (calendarMonthOf(current).getTime() === calendarMonthOf(month).getTime() ? current : calendarMonthOf(month)));\n }, [month]);\n\n const focusedKey = calendarDayKey(focusedDay);\n useEffect(() => {\n if (!moveFocusRef.current) return;\n moveFocusRef.current = false;\n gridRef.current?.querySelector<HTMLElement>(`[data-calendar-day=\"${focusedKey}\"]`)?.focus();\n }, [focusedKey, weeks]);\n\n const focusDay = useCallback((day: Date) => {\n moveFocusRef.current = true;\n setFocusedDay(day);\n const target = calendarMonthOf(day);\n if (target.getTime() !== calendarMonthOf(month).getTime()) onMonthChange(target);\n }, [month, onMonthChange]);\n\n const onDayKeyDown = (event: React.KeyboardEvent<HTMLElement>, day: Date) => {\n // Only the day cell itself: the arrow keys keep their meaning on the items inside it.\n if (event.target !== event.currentTarget) return;\n const step = calendarKeyboardStep(event.key);\n if (!step) return;\n event.preventDefault();\n focusDay(moveCalendarFocus(day, step, firstDayOfWeek));\n };\n\n const todayKey = calendarDayKey(today);\n return (\n <div className=\"flex flex-col gap-item-sm\" data-slot=\"collection-calendar\">\n <div className=\"flex items-center gap-item-sm\">\n <Button\n variant={ButtonVariants_Variant.OUTLINE}\n size={ButtonSize.ICON_SM}\n aria-label={previousMonthLabel}\n title={previousMonthLabel}\n onClick={() => onMonthChange(shiftCalendarMonth(month, -1))}\n >\n <span aria-hidden=\"true\">{renderIcon(StandardIconReference.CHEVRON_LEFT, { size: IconSize.SM })}</span>\n </Button>\n <Button\n variant={ButtonVariants_Variant.OUTLINE}\n size={ButtonSize.ICON_SM}\n aria-label={nextMonthLabel}\n title={nextMonthLabel}\n onClick={() => onMonthChange(shiftCalendarMonth(month, 1))}\n >\n <span aria-hidden=\"true\">{renderIcon(StandardIconReference.CHEVRON_RIGHT, { size: IconSize.SM })}</span>\n </Button>\n <MonthHeadingTag id={headingId} className=\"text-sm font-medium\" aria-live=\"polite\">{monthHeading}</MonthHeadingTag>\n <Button variant={ButtonVariants_Variant.GHOST} size={ButtonSize.SM} className=\"ms-auto\" onClick={() => focusDay(today)}>\n {todayLabel}\n </Button>\n </div>\n <span id={hintId} className=\"sr-only\">{keyboardHint}</span>\n <table\n ref={gridRef}\n role=\"grid\"\n aria-label={calendarLabel}\n aria-describedby={hintId}\n className=\"w-full table-fixed border-collapse\"\n >\n <caption className=\"sr-only\">{monthHeading}</caption>\n <thead>\n <tr>\n {weekdayLabels.map((label, index) => (\n <th key={index} scope=\"col\" className=\"pb-item-xs text-xs font-medium text-muted-foreground\">{label}</th>\n ))}\n </tr>\n </thead>\n <tbody>\n {weeks.map((week) => (\n <tr key={week[0]!.key}>\n {week.map(({ day, key, inMonth }) => {\n const items = itemsByDay.get(key) ?? (NO_ITEMS as readonly TItem[]);\n const isFocused = key === focusedKey;\n return (\n <td\n key={key}\n role=\"gridcell\"\n data-calendar-day={key}\n data-in-month={inMonth ? 'true' : undefined}\n data-today={key === todayKey ? 'true' : undefined}\n aria-label={dayLabel(day, items.length)}\n aria-current={key === todayKey ? 'date' : undefined}\n tabIndex={isFocused ? 0 : -1}\n onKeyDown={(event) => onDayKeyDown(event, day)}\n onFocus={(event) => { if (event.target === event.currentTarget && !isFocused) setFocusedDay(day); }}\n className={cn(\n // A day cell sits packed in the grid, its neighbours flush against it: the INSET shape draws\n // inside the box so no neighbour or clipping ancestor covers it.\n 'h-24 border align-top p-item-xs',\n focusIndicatorClasses(FocusIndicatorShape.INSET),\n !inMonth && 'bg-muted/30 text-muted-foreground',\n )}\n >\n <span\n aria-hidden=\"true\"\n className={cn(\n 'mb-item-xs inline-flex size-6 items-center justify-center rounded-full text-xs',\n key === todayKey && 'bg-primary text-primary-foreground',\n )}\n >\n {dayNumberLabel(day)}\n </span>\n {items.length > 0 && (\n <ul role=\"list\" className=\"flex max-h-28 flex-col gap-px overflow-y-auto\">\n {items.map((item) => {\n const itemId = getItemId(item);\n const label = getItemLabel(item);\n return (\n <li key={itemId} className=\"list-none\" data-calendar-item={itemId}>\n {canOpenItem(item) ? (\n <Button\n variant={ButtonVariants_Variant.GHOST}\n size={ButtonSize.XS}\n tabIndex={isFocused ? 0 : -1}\n className=\"h-auto w-full justify-start truncate px-item-xs py-px text-start text-xs font-normal\"\n title={label}\n onClick={() => onOpenItem(item)}\n >\n {label}\n </Button>\n ) : (\n <span className=\"block truncate px-item-xs text-xs\" title={label}>{label}</span>\n )}\n </li>\n );\n })}\n </ul>\n )}\n </td>\n );\n })}\n </tr>\n ))}\n </tbody>\n </table>\n </div>\n );\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"ResourceCollectionBody_Timeline.d.ts","sourceRoot":"","sources":["../../../../../../src/components/resources/collection/timeline/ResourceCollectionBody_Timeline.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAiB,MAAM,OAAO,CAAC;AAOtC,OAAO,EAAkB,KAAK,iBAAiB,EAAE,MAAM,iGAAiG,CAAC;AAEzJ,MAAM,WAAW,oCAAoC,CAAC,KAAK,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IACzF,6DAA6D;IAC7D,IAAI,EAAE,SAAS,IAAI,EAAE,CAAC;IACtB,4DAA4D;IAC5D,UAAU,EAAE,SAAS,iBAAiB,CAAC,KAAK,CAAC,EAAE,CAAC;IAChD,6DAA6D;IAC7D,KAAK,EAAE,IAAI,CAAC;IACZ,kDAAkD;IAClD,KAAK,EAAE,IAAI,CAAC;IACZ,qEAAqE;IACrE,aAAa,EAAE,CAAC,KAAK,EAAE,IAAI,KAAK,IAAI,CAAC;IACrC,4DAA4D;IAC5D,YAAY,EAAE,MAAM,CAAC;IACrB,+CAA+C;IAC/C,cAAc,EAAE,CAAC,GAAG,EAAE,IAAI,KAAK,MAAM,CAAC;IACtC,SAAS,EAAE,CAAC,IAAI,EAAE,KAAK,KAAK,MAAM,CAAC;IACnC,yCAAyC;IACzC,YAAY,EAAE,CAAC,IAAI,EAAE,KAAK,KAAK,MAAM,CAAC;IACtC,+EAA+E;IAC/E,QAAQ,EAAE,CAAC,IAAI,EAAE,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,KAAK,MAAM,CAAC;IAChE,WAAW,EAAE,CAAC,IAAI,EAAE,KAAK,KAAK,OAAO,CAAC;IACtC,UAAU,EAAE,CAAC,IAAI,EAAE,KAAK,KAAK,IAAI,CAAC;IAClC,aAAa,EAAE,MAAM,CAAC;IACtB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,cAAc,EAAE,MAAM,CAAC;IACvB,UAAU,EAAE,MAAM,CAAC;IACnB,sDAAsD;IACtD,eAAe,EAAE,MAAM,CAAC;CACzB;AAOD,wBAAgB,+BAA+B,CAAC,KAAK,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,EACrF,IAAI,EACJ,UAAU,EACV,KAAK,EACL,KAAK,EACL,aAAa,EACb,YAAY,EACZ,cAAc,EACd,SAAS,EACT,YAAY,EACZ,QAAQ,EACR,WAAW,EACX,UAAU,EACV,aAAa,EACb,kBAAkB,EAClB,cAAc,EACd,UAAU,EACV,eAAe,GAChB,EAAE,oCAAoC,CAAC,KAAK,CAAC,GAAG,KAAK,CAAC,GAAG,CAAC,OAAO,CA2HjE"}
1
+ {"version":3,"file":"ResourceCollectionBody_Timeline.d.ts","sourceRoot":"","sources":["../../../../../../src/components/resources/collection/timeline/ResourceCollectionBody_Timeline.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAiB,MAAM,OAAO,CAAC;AAQtC,OAAO,EAAkB,KAAK,iBAAiB,EAAE,MAAM,iGAAiG,CAAC;AAEzJ,MAAM,WAAW,oCAAoC,CAAC,KAAK,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IACzF,6DAA6D;IAC7D,IAAI,EAAE,SAAS,IAAI,EAAE,CAAC;IACtB,4DAA4D;IAC5D,UAAU,EAAE,SAAS,iBAAiB,CAAC,KAAK,CAAC,EAAE,CAAC;IAChD,6DAA6D;IAC7D,KAAK,EAAE,IAAI,CAAC;IACZ,kDAAkD;IAClD,KAAK,EAAE,IAAI,CAAC;IACZ,qEAAqE;IACrE,aAAa,EAAE,CAAC,KAAK,EAAE,IAAI,KAAK,IAAI,CAAC;IACrC,4DAA4D;IAC5D,YAAY,EAAE,MAAM,CAAC;IACrB,+CAA+C;IAC/C,cAAc,EAAE,CAAC,GAAG,EAAE,IAAI,KAAK,MAAM,CAAC;IACtC,SAAS,EAAE,CAAC,IAAI,EAAE,KAAK,KAAK,MAAM,CAAC;IACnC,yCAAyC;IACzC,YAAY,EAAE,CAAC,IAAI,EAAE,KAAK,KAAK,MAAM,CAAC;IACtC,+EAA+E;IAC/E,QAAQ,EAAE,CAAC,IAAI,EAAE,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,KAAK,MAAM,CAAC;IAChE,WAAW,EAAE,CAAC,IAAI,EAAE,KAAK,KAAK,OAAO,CAAC;IACtC,UAAU,EAAE,CAAC,IAAI,EAAE,KAAK,KAAK,IAAI,CAAC;IAClC,aAAa,EAAE,MAAM,CAAC;IACtB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,cAAc,EAAE,MAAM,CAAC;IACvB,UAAU,EAAE,MAAM,CAAC;IACnB,sDAAsD;IACtD,eAAe,EAAE,MAAM,CAAC;CACzB;AAOD,wBAAgB,+BAA+B,CAAC,KAAK,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,EACrF,IAAI,EACJ,UAAU,EACV,KAAK,EACL,KAAK,EACL,aAAa,EACb,YAAY,EACZ,cAAc,EACd,SAAS,EACT,YAAY,EACZ,QAAQ,EACR,WAAW,EACX,UAAU,EACV,aAAa,EACb,kBAAkB,EAClB,cAAc,EACd,UAAU,EACV,eAAe,GAChB,EAAE,oCAAoC,CAAC,KAAK,CAAC,GAAG,KAAK,CAAC,GAAG,CAAC,OAAO,CA6HjE"}
@@ -14,6 +14,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
14
14
  * through every row's other controls. A row that cannot be opened is shown, not offered.
15
15
  */
16
16
  import { useRef } from 'react';
17
+ import { documentHeadingTag, useDocumentHeadingLevel } from '../../../../components/typography/document-heading-level.js';
17
18
  import { ButtonSize } from '@wildo-ai/presets-components-models';
18
19
  import { cn } from '../../../../core/ui/cn.js';
19
20
  import { Button, ButtonVariants_Variant } from '../../../../components/actions/button.js';
@@ -26,6 +27,8 @@ function timelineColumns(dayCount) {
26
27
  return { gridTemplateColumns: `minmax(8rem, 12rem) repeat(${dayCount}, minmax(1.5rem, 1fr))` };
27
28
  }
28
29
  export function ResourceCollectionBody_Timeline({ days, placements, month, today, onMonthChange, monthHeading, dayNumberLabel, getItemId, getItemLabel, barLabel, canOpenItem, onOpenItem, timelineLabel, previousMonthLabel, nextMonthLabel, todayLabel, emptyMonthLabel, }) {
30
+ // The month heading takes the outline's level under the page's `h1`; a fixed `h3` skipped one (#3867).
31
+ const MonthHeadingTag = documentHeadingTag(useDocumentHeadingLevel());
29
32
  const { renderIcon } = useIconRegistry();
30
33
  const listRef = useRef(null);
31
34
  const todayKey = timelineDayKey(today);
@@ -41,7 +44,7 @@ export function ResourceCollectionBody_Timeline({ days, placements, month, today
41
44
  event.preventDefault();
42
45
  next.focus();
43
46
  };
44
- return (_jsxs("div", { className: "flex flex-col gap-item-sm", "data-slot": "collection-timeline", children: [_jsxs("div", { className: "flex items-center gap-item-sm", children: [_jsx(Button, { variant: ButtonVariants_Variant.OUTLINE, size: ButtonSize.ICON_SM, "aria-label": previousMonthLabel, title: previousMonthLabel, onClick: () => onMonthChange(shiftCalendarMonth(month, -1)), children: _jsx("span", { "aria-hidden": "true", children: renderIcon(StandardIconReference.CHEVRON_LEFT, { size: IconSize.SM }) }) }), _jsx(Button, { variant: ButtonVariants_Variant.OUTLINE, size: ButtonSize.ICON_SM, "aria-label": nextMonthLabel, title: nextMonthLabel, onClick: () => onMonthChange(shiftCalendarMonth(month, 1)), children: _jsx("span", { "aria-hidden": "true", children: renderIcon(StandardIconReference.CHEVRON_RIGHT, { size: IconSize.SM }) }) }), _jsx("h3", { className: "text-sm font-medium", "aria-live": "polite", children: monthHeading }), _jsx(Button, { variant: ButtonVariants_Variant.GHOST, size: ButtonSize.SM, className: "ms-auto", onClick: () => onMonthChange(today), children: todayLabel })] }), _jsx("div", { className: "overflow-x-auto", children: _jsxs("div", { className: "min-w-max", children: [_jsxs("div", { className: "grid border-b pb-item-xs", style: columns, "aria-hidden": "true", children: [_jsx("span", {}), days.map((day) => {
47
+ return (_jsxs("div", { className: "flex flex-col gap-item-sm", "data-slot": "collection-timeline", children: [_jsxs("div", { className: "flex items-center gap-item-sm", children: [_jsx(Button, { variant: ButtonVariants_Variant.OUTLINE, size: ButtonSize.ICON_SM, "aria-label": previousMonthLabel, title: previousMonthLabel, onClick: () => onMonthChange(shiftCalendarMonth(month, -1)), children: _jsx("span", { "aria-hidden": "true", children: renderIcon(StandardIconReference.CHEVRON_LEFT, { size: IconSize.SM }) }) }), _jsx(Button, { variant: ButtonVariants_Variant.OUTLINE, size: ButtonSize.ICON_SM, "aria-label": nextMonthLabel, title: nextMonthLabel, onClick: () => onMonthChange(shiftCalendarMonth(month, 1)), children: _jsx("span", { "aria-hidden": "true", children: renderIcon(StandardIconReference.CHEVRON_RIGHT, { size: IconSize.SM }) }) }), _jsx(MonthHeadingTag, { className: "text-sm font-medium", "aria-live": "polite", children: monthHeading }), _jsx(Button, { variant: ButtonVariants_Variant.GHOST, size: ButtonSize.SM, className: "ms-auto", onClick: () => onMonthChange(today), children: todayLabel })] }), _jsx("div", { className: "overflow-x-auto", children: _jsxs("div", { className: "min-w-max", children: [_jsxs("div", { className: "grid border-b pb-item-xs", style: columns, "aria-hidden": "true", children: [_jsx("span", {}), days.map((day) => {
45
48
  const key = timelineDayKey(day);
46
49
  return (_jsx("span", { "data-timeline-day": key, "data-today": key === todayKey ? 'true' : undefined, className: cn('text-center text-xs text-muted-foreground', key === todayKey && 'font-semibold text-foreground'), children: dayNumberLabel(day) }, key));
47
50
  })] }), placements.length === 0 ? (_jsx("p", { role: "status", className: "py-section text-center text-sm text-muted-foreground", children: emptyMonthLabel })) : (_jsx("ul", { ref: listRef, role: "list", "aria-label": timelineLabel, className: "flex flex-col", children: placements.map((placement) => {