@payloadcms/ui 4.0.0-internal.f15737c → 4.0.0-internal.f2a04f7

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 (330) hide show
  1. package/dist/css/preflight.css +21 -2
  2. package/dist/elements/AppHeader/index.css +1 -1
  3. package/dist/elements/AppHeader/index.d.ts.map +1 -1
  4. package/dist/elements/AppHeader/index.js +5 -1
  5. package/dist/elements/AppHeader/index.js.map +1 -1
  6. package/dist/elements/Autosave/index.d.ts.map +1 -1
  7. package/dist/elements/Autosave/index.js +10 -3
  8. package/dist/elements/Autosave/index.js.map +1 -1
  9. package/dist/elements/Button/index.css +24 -0
  10. package/dist/elements/Button/types.d.ts +1 -1
  11. package/dist/elements/Button/types.d.ts.map +1 -1
  12. package/dist/elements/Button/types.js.map +1 -1
  13. package/dist/elements/CloseModalOnRouteChange/index.d.ts.map +1 -1
  14. package/dist/elements/CloseModalOnRouteChange/index.js +27 -19
  15. package/dist/elements/CloseModalOnRouteChange/index.js.map +1 -1
  16. package/dist/elements/CodeEditor/CodeEditor.d.ts.map +1 -1
  17. package/dist/elements/CodeEditor/CodeEditor.js +5 -0
  18. package/dist/elements/CodeEditor/CodeEditor.js.map +1 -1
  19. package/dist/elements/DatePicker/DatePicker.js +6 -2
  20. package/dist/elements/DatePicker/DatePicker.js.map +1 -1
  21. package/dist/elements/DatePicker/index.css +35 -25
  22. package/dist/elements/DocumentControls/index.css +13 -10
  23. package/dist/elements/DocumentControls/index.d.ts +4 -2
  24. package/dist/elements/DocumentControls/index.d.ts.map +1 -1
  25. package/dist/elements/DocumentControls/index.js.map +1 -1
  26. package/dist/elements/DocumentDrawer/types.d.ts +1 -5
  27. package/dist/elements/DocumentDrawer/types.d.ts.map +1 -1
  28. package/dist/elements/DocumentDrawer/types.js.map +1 -1
  29. package/dist/elements/DocumentFields/index.css +7 -7
  30. package/dist/elements/DocumentFields/index.d.ts.map +1 -1
  31. package/dist/elements/DocumentFields/index.js +1 -2
  32. package/dist/elements/DocumentFields/index.js.map +1 -1
  33. package/dist/elements/DocumentHeader/Tabs/tabs/index.js.map +1 -1
  34. package/dist/elements/Drawer/types.d.ts +2 -2
  35. package/dist/elements/Drawer/types.d.ts.map +1 -1
  36. package/dist/elements/Drawer/types.js.map +1 -1
  37. package/dist/elements/EditUpload/library.css +6 -13
  38. package/dist/elements/FieldSelect/reduceFieldOptions.js.map +1 -1
  39. package/dist/elements/FileManager/index.d.ts.map +1 -1
  40. package/dist/elements/FileManager/index.js +6 -1
  41. package/dist/elements/FileManager/index.js.map +1 -1
  42. package/dist/elements/Hierarchy/ActionsMenu/index.css +18 -0
  43. package/dist/elements/Hierarchy/ActionsMenu/index.d.ts +35 -0
  44. package/dist/elements/Hierarchy/ActionsMenu/index.d.ts.map +1 -0
  45. package/dist/elements/Hierarchy/ActionsMenu/index.js +99 -0
  46. package/dist/elements/Hierarchy/ActionsMenu/index.js.map +1 -0
  47. package/dist/elements/Hierarchy/ColumnBrowser/Column/index.js +18 -16
  48. package/dist/elements/Hierarchy/ColumnBrowser/Column/index.js.map +1 -1
  49. package/dist/elements/Hierarchy/ColumnBrowser/types.d.ts +2 -0
  50. package/dist/elements/Hierarchy/ColumnBrowser/types.d.ts.map +1 -1
  51. package/dist/elements/Hierarchy/ColumnBrowser/types.js.map +1 -1
  52. package/dist/elements/Hierarchy/DocHeaderButton/index.css +12 -0
  53. package/dist/elements/Hierarchy/DocHeaderButton/index.d.ts.map +1 -1
  54. package/dist/elements/Hierarchy/DocHeaderButton/index.js +61 -14
  55. package/dist/elements/Hierarchy/DocHeaderButton/index.js.map +1 -1
  56. package/dist/elements/Hierarchy/Modal/Footer/index.css +33 -0
  57. package/dist/elements/Hierarchy/Modal/Footer/index.d.ts +21 -0
  58. package/dist/elements/Hierarchy/Modal/Footer/index.d.ts.map +1 -0
  59. package/dist/elements/Hierarchy/Modal/Footer/index.js +122 -0
  60. package/dist/elements/Hierarchy/Modal/Footer/index.js.map +1 -0
  61. package/dist/elements/Hierarchy/Modal/fetchAncestorPath.d.ts +8 -3
  62. package/dist/elements/Hierarchy/Modal/fetchAncestorPath.d.ts.map +1 -1
  63. package/dist/elements/Hierarchy/Modal/fetchAncestorPath.js +38 -12
  64. package/dist/elements/Hierarchy/Modal/fetchAncestorPath.js.map +1 -1
  65. package/dist/elements/Hierarchy/Modal/index.css +0 -56
  66. package/dist/elements/Hierarchy/Modal/index.d.ts +5 -3
  67. package/dist/elements/Hierarchy/Modal/index.d.ts.map +1 -1
  68. package/dist/elements/Hierarchy/Modal/index.js +64 -65
  69. package/dist/elements/Hierarchy/Modal/index.js.map +1 -1
  70. package/dist/elements/Hierarchy/Modal/types.d.ts +2 -0
  71. package/dist/elements/Hierarchy/Modal/types.d.ts.map +1 -1
  72. package/dist/elements/Hierarchy/Modal/types.js.map +1 -1
  73. package/dist/elements/Hierarchy/MoveMany/index.d.ts +1 -3
  74. package/dist/elements/Hierarchy/MoveMany/index.d.ts.map +1 -1
  75. package/dist/elements/Hierarchy/MoveMany/index.js +62 -84
  76. package/dist/elements/Hierarchy/MoveMany/index.js.map +1 -1
  77. package/dist/elements/ListControls/types.d.ts +0 -10
  78. package/dist/elements/ListControls/types.d.ts.map +1 -1
  79. package/dist/elements/ListControls/types.js.map +1 -1
  80. package/dist/elements/ListDrawer/DrawerContent.d.ts.map +1 -1
  81. package/dist/elements/ListDrawer/DrawerContent.js +1 -2
  82. package/dist/elements/ListDrawer/DrawerContent.js.map +1 -1
  83. package/dist/elements/ListDrawer/Provider.d.ts +0 -6
  84. package/dist/elements/ListDrawer/Provider.d.ts.map +1 -1
  85. package/dist/elements/ListDrawer/Provider.js.map +1 -1
  86. package/dist/elements/ListDrawer/index.d.ts.map +1 -1
  87. package/dist/elements/ListDrawer/index.js +1 -1
  88. package/dist/elements/ListDrawer/index.js.map +1 -1
  89. package/dist/elements/ListDrawer/types.d.ts +1 -0
  90. package/dist/elements/ListDrawer/types.d.ts.map +1 -1
  91. package/dist/elements/ListDrawer/types.js.map +1 -1
  92. package/dist/elements/ListHeader/DrawerRelationshipSelect/index.d.ts.map +1 -1
  93. package/dist/elements/ListHeader/DrawerRelationshipSelect/index.js +24 -20
  94. package/dist/elements/ListHeader/DrawerRelationshipSelect/index.js.map +1 -1
  95. package/dist/elements/LivePreview/Window/index.css +7 -1
  96. package/dist/elements/Nav/NavWrapper/index.d.ts.map +1 -1
  97. package/dist/elements/Nav/NavWrapper/index.js +19 -14
  98. package/dist/elements/Nav/NavWrapper/index.js.map +1 -1
  99. package/dist/elements/PublishButton/index.d.ts.map +1 -1
  100. package/dist/elements/PublishButton/index.js +71 -8
  101. package/dist/elements/PublishButton/index.js.map +1 -1
  102. package/dist/elements/PublishButton/validateAllLocales.d.ts +11 -0
  103. package/dist/elements/PublishButton/validateAllLocales.d.ts.map +1 -0
  104. package/dist/elements/PublishButton/validateAllLocales.js +263 -0
  105. package/dist/elements/PublishButton/validateAllLocales.js.map +1 -0
  106. package/dist/elements/RelationshipTable/AddNewButton.d.ts.map +1 -1
  107. package/dist/elements/RelationshipTable/AddNewButton.js +3 -0
  108. package/dist/elements/RelationshipTable/AddNewButton.js.map +1 -1
  109. package/dist/elements/SaveDraftButton/index.d.ts.map +1 -1
  110. package/dist/elements/SaveDraftButton/index.js +15 -2
  111. package/dist/elements/SaveDraftButton/index.js.map +1 -1
  112. package/dist/elements/SchedulePublishButton/index.js.map +1 -1
  113. package/dist/elements/SegmentedControl/index.css +50 -7
  114. package/dist/elements/Table/DefaultCell/fields/File/index.d.ts.map +1 -1
  115. package/dist/elements/Table/DefaultCell/fields/File/index.js.map +1 -1
  116. package/dist/elements/Table/DefaultCell/fields/Hierarchy/index.css +0 -9
  117. package/dist/elements/Table/DefaultCell/fields/Hierarchy/index.d.ts.map +1 -1
  118. package/dist/elements/Table/DefaultCell/fields/Hierarchy/index.js +63 -40
  119. package/dist/elements/Table/DefaultCell/fields/Hierarchy/index.js.map +1 -1
  120. package/dist/elements/Table/DefaultCell/index.d.ts.map +1 -1
  121. package/dist/elements/Table/DefaultCell/index.js +6 -1
  122. package/dist/elements/Table/DefaultCell/index.js.map +1 -1
  123. package/dist/elements/Table/index.js.map +1 -1
  124. package/dist/elements/Tabs/index.css +4 -3
  125. package/dist/elements/Upload/getEditorFileSrc.d.ts +11 -0
  126. package/dist/elements/Upload/getEditorFileSrc.d.ts.map +1 -0
  127. package/dist/elements/Upload/getEditorFileSrc.js +6 -0
  128. package/dist/elements/Upload/getEditorFileSrc.js.map +1 -0
  129. package/dist/elements/Upload/index.d.ts.map +1 -1
  130. package/dist/elements/Upload/index.js +6 -1
  131. package/dist/elements/Upload/index.js.map +1 -1
  132. package/dist/exports/client/{CodeEditor-UKD3EPUY.js → CodeEditor-I6PL55BF.js} +2 -2
  133. package/dist/exports/client/{DatePicker-POZJVQP4.js → DatePicker-XAKGIULG.js} +2 -2
  134. package/dist/exports/client/{chunk-2AY67NFV.js → chunk-36JJSMEB.js} +2 -2
  135. package/dist/exports/client/chunk-36JJSMEB.js.map +7 -0
  136. package/dist/exports/client/chunk-R7M6BG75.js +27 -0
  137. package/dist/exports/client/chunk-R7M6BG75.js.map +7 -0
  138. package/dist/exports/client/index.d.ts +3 -0
  139. package/dist/exports/client/index.d.ts.map +1 -1
  140. package/dist/exports/client/index.js +27 -27
  141. package/dist/exports/client/index.js.map +4 -4
  142. package/dist/exports/shared/index.js +2 -2
  143. package/dist/exports/shared/index.js.map +3 -3
  144. package/dist/fields/Group/index.css +3 -5
  145. package/dist/fields/Tabs/index.css +14 -14
  146. package/dist/fields/Upload/Input.d.ts.map +1 -1
  147. package/dist/fields/Upload/Input.js +3 -1
  148. package/dist/fields/Upload/Input.js.map +1 -1
  149. package/dist/forms/Form/fieldReducer.d.ts.map +1 -1
  150. package/dist/forms/Form/fieldReducer.js +6 -9
  151. package/dist/forms/Form/fieldReducer.js.map +1 -1
  152. package/dist/forms/Form/index.d.ts.map +1 -1
  153. package/dist/forms/Form/index.js +0 -1
  154. package/dist/forms/Form/index.js.map +1 -1
  155. package/dist/forms/Form/types.d.ts +0 -5
  156. package/dist/forms/Form/types.d.ts.map +1 -1
  157. package/dist/forms/Form/types.js.map +1 -1
  158. package/dist/forms/RenderFields/index.css +2 -2
  159. package/dist/forms/fieldSchemasToFormState/addFieldStatePromise.d.ts +2 -2
  160. package/dist/forms/fieldSchemasToFormState/addFieldStatePromise.d.ts.map +1 -1
  161. package/dist/forms/fieldSchemasToFormState/addFieldStatePromise.js.map +1 -1
  162. package/dist/forms/fieldSchemasToFormState/index.d.ts +2 -2
  163. package/dist/forms/fieldSchemasToFormState/index.d.ts.map +1 -1
  164. package/dist/forms/fieldSchemasToFormState/index.js.map +1 -1
  165. package/dist/forms/fieldSchemasToFormState/iterateFields.d.ts +2 -2
  166. package/dist/forms/fieldSchemasToFormState/iterateFields.d.ts.map +1 -1
  167. package/dist/forms/fieldSchemasToFormState/iterateFields.js.map +1 -1
  168. package/dist/forms/fieldSchemasToFormState/types.d.ts +2 -2
  169. package/dist/forms/fieldSchemasToFormState/types.d.ts.map +1 -1
  170. package/dist/forms/fieldSchemasToFormState/types.js.map +1 -1
  171. package/dist/forms/useField/types.d.ts +0 -4
  172. package/dist/forms/useField/types.d.ts.map +1 -1
  173. package/dist/forms/useField/types.js.map +1 -1
  174. package/dist/icons/Arrow/index.d.ts +1 -1
  175. package/dist/icons/Arrow/index.d.ts.map +1 -1
  176. package/dist/icons/Arrow/index.js +7 -1
  177. package/dist/icons/Arrow/index.js.map +1 -1
  178. package/dist/icons/Clock/index.d.ts +6 -0
  179. package/dist/icons/Clock/index.d.ts.map +1 -0
  180. package/dist/icons/Clock/index.js +18 -0
  181. package/dist/icons/Clock/index.js.map +1 -0
  182. package/dist/icons/Pin/index.d.ts +7 -0
  183. package/dist/icons/Pin/index.d.ts.map +1 -0
  184. package/dist/icons/Pin/index.js +23 -0
  185. package/dist/icons/Pin/index.js.map +1 -0
  186. package/dist/icons/Sidebar/index.d.ts.map +1 -1
  187. package/dist/icons/Sidebar/index.js +2 -0
  188. package/dist/icons/Sidebar/index.js.map +1 -1
  189. package/dist/icons/Table/index.css +5 -1
  190. package/dist/layouts/Root/getRootLayoutData.d.ts +2 -2
  191. package/dist/layouts/Root/getRootLayoutData.d.ts.map +1 -1
  192. package/dist/layouts/Root/getRootLayoutData.js +8 -4
  193. package/dist/layouts/Root/getRootLayoutData.js.map +1 -1
  194. package/dist/layouts/Root/index.d.ts +1 -1
  195. package/dist/layouts/Root/index.d.ts.map +1 -1
  196. package/dist/layouts/Root/index.js +5 -20
  197. package/dist/layouts/Root/index.js.map +1 -1
  198. package/dist/providers/ListQuery/types.d.ts +0 -4
  199. package/dist/providers/ListQuery/types.d.ts.map +1 -1
  200. package/dist/providers/ListQuery/types.js.map +1 -1
  201. package/dist/providers/RouteCache/index.d.ts.map +1 -1
  202. package/dist/providers/RouteCache/index.js +37 -25
  203. package/dist/providers/RouteCache/index.js.map +1 -1
  204. package/dist/providers/TableColumns/RenderDefaultCell/index.d.ts.map +1 -1
  205. package/dist/providers/TableColumns/RenderDefaultCell/index.js +1 -2
  206. package/dist/providers/TableColumns/RenderDefaultCell/index.js.map +1 -1
  207. package/dist/providers/TableColumns/types.d.ts +1 -34
  208. package/dist/providers/TableColumns/types.d.ts.map +1 -1
  209. package/dist/providers/TableColumns/types.js.map +1 -1
  210. package/dist/styles.css +22 -3
  211. package/dist/templates/Default/index.css +0 -1
  212. package/dist/utilities/appendCacheTag.d.ts +1 -0
  213. package/dist/utilities/appendCacheTag.d.ts.map +1 -1
  214. package/dist/utilities/appendCacheTag.js +2 -1
  215. package/dist/utilities/appendCacheTag.js.map +1 -1
  216. package/dist/utilities/buildClientFieldSchemaMap/traverseFields.d.ts.map +1 -1
  217. package/dist/utilities/buildClientFieldSchemaMap/traverseFields.js +32 -6
  218. package/dist/utilities/buildClientFieldSchemaMap/traverseFields.js.map +1 -1
  219. package/dist/utilities/getDisplayedFieldValue.d.ts +8 -2
  220. package/dist/utilities/getDisplayedFieldValue.d.ts.map +1 -1
  221. package/dist/utilities/getDisplayedFieldValue.js +11 -1
  222. package/dist/utilities/getDisplayedFieldValue.js.map +1 -1
  223. package/dist/utilities/getDocumentThumbnail.d.ts +6 -0
  224. package/dist/utilities/getDocumentThumbnail.d.ts.map +1 -0
  225. package/dist/utilities/getDocumentThumbnail.js +27 -0
  226. package/dist/utilities/getDocumentThumbnail.js.map +1 -0
  227. package/dist/utilities/getDocumentThumbnailPopulate.d.ts +7 -0
  228. package/dist/utilities/getDocumentThumbnailPopulate.d.ts.map +1 -0
  229. package/dist/utilities/getDocumentThumbnailPopulate.js +23 -0
  230. package/dist/utilities/getDocumentThumbnailPopulate.js.map +1 -0
  231. package/dist/utilities/getDocumentThumbnailSelect.d.ts +7 -0
  232. package/dist/utilities/getDocumentThumbnailSelect.d.ts.map +1 -0
  233. package/dist/utilities/getDocumentThumbnailSelect.js +24 -0
  234. package/dist/utilities/getDocumentThumbnailSelect.js.map +1 -0
  235. package/dist/utilities/getHasScheduledPublish.js.map +1 -1
  236. package/dist/utilities/handleLivePreview.js.map +1 -1
  237. package/dist/utilities/hasSavePermission.js.map +1 -1
  238. package/dist/utilities/schedulePublishHandler.js.map +1 -1
  239. package/dist/utilities/serverFunctionRegistry.d.ts.map +1 -1
  240. package/dist/utilities/serverFunctionRegistry.js +2 -0
  241. package/dist/utilities/serverFunctionRegistry.js.map +1 -1
  242. package/dist/utilities/traverseForLocalizedFields.d.ts +7 -2
  243. package/dist/utilities/traverseForLocalizedFields.d.ts.map +1 -1
  244. package/dist/utilities/traverseForLocalizedFields.js +22 -8
  245. package/dist/utilities/traverseForLocalizedFields.js.map +1 -1
  246. package/dist/views/CreateFirstUser/index.d.ts.map +1 -1
  247. package/dist/views/CreateFirstUser/index.js +4 -2
  248. package/dist/views/CreateFirstUser/index.js.map +1 -1
  249. package/dist/views/Dashboard/Default/ModularDashboard/DashboardStepNav.d.ts.map +1 -1
  250. package/dist/views/Dashboard/Default/ModularDashboard/DashboardStepNav.js +30 -21
  251. package/dist/views/Dashboard/Default/ModularDashboard/DashboardStepNav.js.map +1 -1
  252. package/dist/views/Dashboard/Default/ModularDashboard/useDashboardLayout.d.ts +1 -1
  253. package/dist/views/Dashboard/Default/ModularDashboard/useDashboardLayout.d.ts.map +1 -1
  254. package/dist/views/Dashboard/Default/ModularDashboard/useDashboardLayout.js +16 -4
  255. package/dist/views/Dashboard/Default/ModularDashboard/useDashboardLayout.js.map +1 -1
  256. package/dist/views/Edit/index.css +26 -0
  257. package/dist/views/Edit/index.d.ts.map +1 -1
  258. package/dist/views/Edit/index.js +1 -1
  259. package/dist/views/Edit/index.js.map +1 -1
  260. package/dist/views/HierarchyList/DocumentListSelection/index.d.ts.map +1 -1
  261. package/dist/views/HierarchyList/DocumentListSelection/index.js +0 -1
  262. package/dist/views/HierarchyList/DocumentListSelection/index.js.map +1 -1
  263. package/dist/views/List/DocumentGrid/index.d.ts.map +1 -1
  264. package/dist/views/List/DocumentGrid/index.js +2 -37
  265. package/dist/views/List/DocumentGrid/index.js.map +1 -1
  266. package/dist/views/List/enrichDocsWithVersionStatus.d.ts.map +1 -1
  267. package/dist/views/List/enrichDocsWithVersionStatus.js +3 -1
  268. package/dist/views/List/enrichDocsWithVersionStatus.js.map +1 -1
  269. package/dist/views/List/index.d.ts.map +1 -1
  270. package/dist/views/List/index.js +11 -24
  271. package/dist/views/List/index.js.map +1 -1
  272. package/dist/views/Version/RenderFieldsToDiff/buildVersionFields.js +2 -12
  273. package/dist/views/Version/RenderFieldsToDiff/buildVersionFields.js.map +1 -1
  274. package/dist/views/Version/RenderFieldsToDiff/fields/Checkbox/index.js +2 -2
  275. package/dist/views/Version/RenderFieldsToDiff/fields/Checkbox/index.js.map +1 -1
  276. package/dist/views/Version/RenderFieldsToDiff/fields/Collapsible/index.js +2 -2
  277. package/dist/views/Version/RenderFieldsToDiff/fields/Collapsible/index.js.map +1 -1
  278. package/dist/views/Version/RenderFieldsToDiff/fields/Date/index.js +2 -2
  279. package/dist/views/Version/RenderFieldsToDiff/fields/Date/index.js.map +1 -1
  280. package/dist/views/Version/RenderFieldsToDiff/fields/Group/index.js +2 -2
  281. package/dist/views/Version/RenderFieldsToDiff/fields/Group/index.js.map +1 -1
  282. package/dist/views/Version/RenderFieldsToDiff/fields/Iterable/index.js +2 -2
  283. package/dist/views/Version/RenderFieldsToDiff/fields/Iterable/index.js.map +1 -1
  284. package/dist/views/Version/RenderFieldsToDiff/fields/Relationship/index.js +2 -2
  285. package/dist/views/Version/RenderFieldsToDiff/fields/Relationship/index.js.map +1 -1
  286. package/dist/views/Version/RenderFieldsToDiff/fields/Select/index.d.ts.map +1 -1
  287. package/dist/views/Version/RenderFieldsToDiff/fields/Select/index.js +2 -2
  288. package/dist/views/Version/RenderFieldsToDiff/fields/Select/index.js.map +1 -1
  289. package/dist/views/Version/RenderFieldsToDiff/fields/Tabs/index.js +8 -8
  290. package/dist/views/Version/RenderFieldsToDiff/fields/Tabs/index.js.map +1 -1
  291. package/dist/views/Version/RenderFieldsToDiff/fields/Text/index.js +2 -2
  292. package/dist/views/Version/RenderFieldsToDiff/fields/Text/index.js.map +1 -1
  293. package/dist/views/Version/RenderFieldsToDiff/fields/Upload/index.d.ts.map +1 -1
  294. package/dist/views/Version/RenderFieldsToDiff/fields/Upload/index.js +2 -2
  295. package/dist/views/Version/RenderFieldsToDiff/fields/Upload/index.js.map +1 -1
  296. package/dist/widgets/RecentlyViewed/CollectionsField/index.d.ts.map +1 -1
  297. package/dist/widgets/RecentlyViewed/CollectionsField/index.js +31 -5
  298. package/dist/widgets/RecentlyViewed/CollectionsField/index.js.map +1 -1
  299. package/dist/widgets/RecentlyViewed/PinDocumentPicker/index.css +41 -0
  300. package/dist/widgets/RecentlyViewed/PinDocumentPicker/index.d.ts +19 -0
  301. package/dist/widgets/RecentlyViewed/PinDocumentPicker/index.d.ts.map +1 -0
  302. package/dist/widgets/RecentlyViewed/PinDocumentPicker/index.js +121 -0
  303. package/dist/widgets/RecentlyViewed/PinDocumentPicker/index.js.map +1 -0
  304. package/dist/widgets/RecentlyViewed/getDocuments.d.ts +20 -0
  305. package/dist/widgets/RecentlyViewed/getDocuments.d.ts.map +1 -0
  306. package/dist/widgets/RecentlyViewed/getDocuments.js +254 -0
  307. package/dist/widgets/RecentlyViewed/getDocuments.js.map +1 -0
  308. package/dist/widgets/RecentlyViewed/index.client.d.ts +41 -0
  309. package/dist/widgets/RecentlyViewed/index.client.d.ts.map +1 -0
  310. package/dist/widgets/RecentlyViewed/index.client.js +409 -0
  311. package/dist/widgets/RecentlyViewed/index.client.js.map +1 -0
  312. package/dist/widgets/RecentlyViewed/index.css +352 -0
  313. package/dist/widgets/RecentlyViewed/index.d.ts +1 -1
  314. package/dist/widgets/RecentlyViewed/index.d.ts.map +1 -1
  315. package/dist/widgets/RecentlyViewed/index.js +33 -134
  316. package/dist/widgets/RecentlyViewed/index.js.map +1 -1
  317. package/dist/widgets/RecentlyViewed/pinnedPreferences.d.ts +18 -0
  318. package/dist/widgets/RecentlyViewed/pinnedPreferences.d.ts.map +1 -0
  319. package/dist/widgets/RecentlyViewed/pinnedPreferences.js +81 -0
  320. package/dist/widgets/RecentlyViewed/pinnedPreferences.js.map +1 -0
  321. package/dist/widgets/RecentlyViewed/recents.d.ts +8 -0
  322. package/dist/widgets/RecentlyViewed/recents.d.ts.map +1 -0
  323. package/dist/widgets/RecentlyViewed/recents.js +19 -0
  324. package/dist/widgets/RecentlyViewed/recents.js.map +1 -0
  325. package/package.json +16 -16
  326. package/dist/exports/client/chunk-2AY67NFV.js.map +0 -7
  327. package/dist/exports/client/chunk-6XCSN54Q.js +0 -27
  328. package/dist/exports/client/chunk-6XCSN54Q.js.map +0 -7
  329. /package/dist/exports/client/{CodeEditor-UKD3EPUY.js.map → CodeEditor-I6PL55BF.js.map} +0 -0
  330. /package/dist/exports/client/{DatePicker-POZJVQP4.js.map → DatePicker-XAKGIULG.js.map} +0 -0
@@ -3,21 +3,22 @@ import * as qs from 'qs-esm';
3
3
  const MAX_HIERARCHY_DEPTH = 20;
4
4
  /**
5
5
  * Fetches the ancestor path for an item using a single API call with depth.
6
- * Returns array of ancestor IDs from root to item's parent.
7
- * Example: item at level 3 returns [grandparentId, parentId]
6
+ * Returns the ancestor IDs used to expand the browser and a titled path for the footer.
8
7
  */
9
8
  export async function fetchAncestorPath({
10
9
  api,
11
10
  collectionSlug,
12
11
  itemId,
13
12
  parentFieldName,
14
- serverURL
13
+ serverURL,
14
+ useAsTitle
15
15
  }) {
16
16
  const queryString = qs.stringify({
17
17
  depth: MAX_HIERARCHY_DEPTH,
18
18
  limit: 1,
19
19
  select: {
20
- [parentFieldName]: true
20
+ [parentFieldName]: true,
21
+ [useAsTitle]: true
21
22
  },
22
23
  where: {
23
24
  id: {
@@ -36,25 +37,50 @@ export async function fetchAncestorPath({
36
37
  credentials: 'include'
37
38
  });
38
39
  if (!response.ok) {
39
- return [];
40
+ return {
41
+ ancestorIds: [],
42
+ path: []
43
+ };
40
44
  }
41
45
  const data = await response.json();
42
46
  const doc = data.docs?.[0];
43
47
  if (!doc) {
44
- return [];
48
+ return {
49
+ ancestorIds: [],
50
+ path: []
51
+ };
45
52
  }
46
- // Walk the nested parent chain to build path from root to immediate parent
47
- const path = [];
53
+ const path = [toPathSegment({
54
+ id: itemId,
55
+ doc,
56
+ useAsTitle
57
+ })];
48
58
  let current = doc[parentFieldName];
49
59
  while (current !== null && current !== undefined) {
50
- // Parent could be an ID (number/string) or a populated object
51
60
  const parentId = typeof current === 'object' ? current.id : current;
52
61
  if (parentId !== null && parentId !== undefined) {
53
- path.unshift(parentId);
62
+ path.unshift(toPathSegment({
63
+ id: parentId,
64
+ doc: typeof current === 'object' ? current : undefined,
65
+ useAsTitle
66
+ }));
54
67
  }
55
- // Move to next parent (only if current is populated object)
56
68
  current = typeof current === 'object' ? current[parentFieldName] : null;
57
69
  }
58
- return path;
70
+ return {
71
+ ancestorIds: path.slice(0, -1).map(segment => segment.id),
72
+ path
73
+ };
74
+ }
75
+ function toPathSegment({
76
+ id,
77
+ doc,
78
+ useAsTitle
79
+ }) {
80
+ const title = doc?.[useAsTitle];
81
+ return {
82
+ id,
83
+ title: typeof title === 'number' || typeof title === 'string' ? String(title) : String(id)
84
+ };
59
85
  }
60
86
  //# sourceMappingURL=fetchAncestorPath.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"fetchAncestorPath.js","names":["formatAdminURL","qs","MAX_HIERARCHY_DEPTH","fetchAncestorPath","api","collectionSlug","itemId","parentFieldName","serverURL","queryString","stringify","depth","limit","select","where","id","equals","addQueryPrefix","url","apiRoute","path","response","fetch","credentials","ok","data","json","doc","docs","current","undefined","parentId","unshift"],"sources":["../../../../src/elements/Hierarchy/Modal/fetchAncestorPath.ts"],"sourcesContent":["import { formatAdminURL } from 'payload/shared'\nimport * as qs from 'qs-esm'\n\ntype FetchAncestorPathArgs = {\n api: string\n collectionSlug: string\n itemId: number | string\n parentFieldName: string\n serverURL: string\n}\n\nconst MAX_HIERARCHY_DEPTH = 20\n\n/**\n * Fetches the ancestor path for an item using a single API call with depth.\n * Returns array of ancestor IDs from root to item's parent.\n * Example: item at level 3 returns [grandparentId, parentId]\n */\nexport async function fetchAncestorPath({\n api,\n collectionSlug,\n itemId,\n parentFieldName,\n serverURL,\n}: FetchAncestorPathArgs): Promise<(number | string)[]> {\n const queryString = qs.stringify(\n {\n depth: MAX_HIERARCHY_DEPTH,\n limit: 1,\n select: { [parentFieldName]: true },\n where: { id: { equals: itemId } },\n },\n { addQueryPrefix: true },\n )\n\n const url = formatAdminURL({\n apiRoute: api,\n path: `/${collectionSlug}${queryString}`,\n serverURL,\n })\n\n const response = await fetch(url, { credentials: 'include' })\n\n if (!response.ok) {\n return []\n }\n\n const data = await response.json()\n const doc = data.docs?.[0]\n\n if (!doc) {\n return []\n }\n\n // Walk the nested parent chain to build path from root to immediate parent\n const path: (number | string)[] = []\n let current = doc[parentFieldName]\n\n while (current !== null && current !== undefined) {\n // Parent could be an ID (number/string) or a populated object\n const parentId = typeof current === 'object' ? current.id : current\n\n if (parentId !== null && parentId !== undefined) {\n path.unshift(parentId)\n }\n\n // Move to next parent (only if current is populated object)\n current = typeof current === 'object' ? current[parentFieldName] : null\n }\n\n return path\n}\n"],"mappings":"AAAA,SAASA,cAAc,QAAQ;AAC/B,YAAYC,EAAA,MAAQ;AAUpB,MAAMC,mBAAA,GAAsB;AAE5B;;;;;AAKA,OAAO,eAAeC,kBAAkB;EACtCC,GAAG;EACHC,cAAc;EACdC,MAAM;EACNC,eAAe;EACfC;AAAS,CACa;EACtB,MAAMC,WAAA,GAAcR,EAAA,CAAGS,SAAS,CAC9B;IACEC,KAAA,EAAOT,mBAAA;IACPU,KAAA,EAAO;IACPC,MAAA,EAAQ;MAAE,CAACN,eAAA,GAAkB;IAAK;IAClCO,KAAA,EAAO;MAAEC,EAAA,EAAI;QAAEC,MAAA,EAAQV;MAAO;IAAE;EAClC,GACA;IAAEW,cAAA,EAAgB;EAAK;EAGzB,MAAMC,GAAA,GAAMlB,cAAA,CAAe;IACzBmB,QAAA,EAAUf,GAAA;IACVgB,IAAA,EAAM,IAAIf,cAAA,GAAiBI,WAAA,EAAa;IACxCD;EACF;EAEA,MAAMa,QAAA,GAAW,MAAMC,KAAA,CAAMJ,GAAA,EAAK;IAAEK,WAAA,EAAa;EAAU;EAE3D,IAAI,CAACF,QAAA,CAASG,EAAE,EAAE;IAChB,OAAO,EAAE;EACX;EAEA,MAAMC,IAAA,GAAO,MAAMJ,QAAA,CAASK,IAAI;EAChC,MAAMC,GAAA,GAAMF,IAAA,CAAKG,IAAI,GAAG,EAAE;EAE1B,IAAI,CAACD,GAAA,EAAK;IACR,OAAO,EAAE;EACX;EAEA;EACA,MAAMP,IAAA,GAA4B,EAAE;EACpC,IAAIS,OAAA,GAAUF,GAAG,CAACpB,eAAA,CAAgB;EAElC,OAAOsB,OAAA,KAAY,QAAQA,OAAA,KAAYC,SAAA,EAAW;IAChD;IACA,MAAMC,QAAA,GAAW,OAAOF,OAAA,KAAY,WAAWA,OAAA,CAAQd,EAAE,GAAGc,OAAA;IAE5D,IAAIE,QAAA,KAAa,QAAQA,QAAA,KAAaD,SAAA,EAAW;MAC/CV,IAAA,CAAKY,OAAO,CAACD,QAAA;IACf;IAEA;IACAF,OAAA,GAAU,OAAOA,OAAA,KAAY,WAAWA,OAAO,CAACtB,eAAA,CAAgB,GAAG;EACrE;EAEA,OAAOa,IAAA;AACT","ignoreList":[]}
1
+ {"version":3,"file":"fetchAncestorPath.js","names":["formatAdminURL","qs","MAX_HIERARCHY_DEPTH","fetchAncestorPath","api","collectionSlug","itemId","parentFieldName","serverURL","useAsTitle","queryString","stringify","depth","limit","select","where","id","equals","addQueryPrefix","url","apiRoute","path","response","fetch","credentials","ok","ancestorIds","data","json","doc","docs","toPathSegment","current","undefined","parentId","unshift","slice","map","segment","title","String"],"sources":["../../../../src/elements/Hierarchy/Modal/fetchAncestorPath.ts"],"sourcesContent":["import { formatAdminURL } from 'payload/shared'\nimport * as qs from 'qs-esm'\n\nimport type { PathSegment } from '../ColumnBrowser/types.js'\n\ntype FetchAncestorPathArgs = {\n api: string\n collectionSlug: string\n itemId: number | string\n parentFieldName: string\n serverURL: string\n useAsTitle: string\n}\n\nexport type AncestorPathResult = {\n ancestorIds: (number | string)[]\n path: PathSegment[]\n}\n\nconst MAX_HIERARCHY_DEPTH = 20\n\n/**\n * Fetches the ancestor path for an item using a single API call with depth.\n * Returns the ancestor IDs used to expand the browser and a titled path for the footer.\n */\nexport async function fetchAncestorPath({\n api,\n collectionSlug,\n itemId,\n parentFieldName,\n serverURL,\n useAsTitle,\n}: FetchAncestorPathArgs): Promise<AncestorPathResult> {\n const queryString = qs.stringify(\n {\n depth: MAX_HIERARCHY_DEPTH,\n limit: 1,\n select: { [parentFieldName]: true, [useAsTitle]: true },\n where: { id: { equals: itemId } },\n },\n { addQueryPrefix: true },\n )\n\n const url = formatAdminURL({\n apiRoute: api,\n path: `/${collectionSlug}${queryString}`,\n serverURL,\n })\n\n const response = await fetch(url, { credentials: 'include' })\n\n if (!response.ok) {\n return { ancestorIds: [], path: [] }\n }\n\n const data = await response.json()\n const doc = data.docs?.[0]\n\n if (!doc) {\n return { ancestorIds: [], path: [] }\n }\n\n const path: PathSegment[] = [toPathSegment({ id: itemId, doc, useAsTitle })]\n let current = doc[parentFieldName] as null | number | Record<string, unknown> | string\n\n while (current !== null && current !== undefined) {\n const parentId = typeof current === 'object' ? current.id : current\n\n if (parentId !== null && parentId !== undefined) {\n path.unshift(\n toPathSegment({\n id: parentId as number | string,\n doc: typeof current === 'object' ? current : undefined,\n useAsTitle,\n }),\n )\n }\n\n current =\n typeof current === 'object'\n ? (current[parentFieldName] as null | number | Record<string, unknown> | string)\n : null\n }\n\n return {\n ancestorIds: path.slice(0, -1).map((segment) => segment.id),\n path,\n }\n}\n\nfunction toPathSegment({\n id,\n doc,\n useAsTitle,\n}: {\n doc?: Record<string, unknown>\n id: number | string\n useAsTitle: string\n}): PathSegment {\n const title = doc?.[useAsTitle]\n\n return {\n id,\n title: typeof title === 'number' || typeof title === 'string' ? String(title) : String(id),\n }\n}\n"],"mappings":"AAAA,SAASA,cAAc,QAAQ;AAC/B,YAAYC,EAAA,MAAQ;AAkBpB,MAAMC,mBAAA,GAAsB;AAE5B;;;;AAIA,OAAO,eAAeC,kBAAkB;EACtCC,GAAG;EACHC,cAAc;EACdC,MAAM;EACNC,eAAe;EACfC,SAAS;EACTC;AAAU,CACY;EACtB,MAAMC,WAAA,GAAcT,EAAA,CAAGU,SAAS,CAC9B;IACEC,KAAA,EAAOV,mBAAA;IACPW,KAAA,EAAO;IACPC,MAAA,EAAQ;MAAE,CAACP,eAAA,GAAkB;MAAM,CAACE,UAAA,GAAa;IAAK;IACtDM,KAAA,EAAO;MAAEC,EAAA,EAAI;QAAEC,MAAA,EAAQX;MAAO;IAAE;EAClC,GACA;IAAEY,cAAA,EAAgB;EAAK;EAGzB,MAAMC,GAAA,GAAMnB,cAAA,CAAe;IACzBoB,QAAA,EAAUhB,GAAA;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c;EACrBf,EAAE;EACFa,GAAG;EACHpB;AAAU,CAKX;EACC,MAAM8B,KAAA,GAAQV,GAAA,GAAMpB,UAAA,CAAW;EAE/B,OAAO;IACLO,EAAA;IACAuB,KAAA,EAAO,OAAOA,KAAA,KAAU,YAAY,OAAOA,KAAA,KAAU,WAAWC,MAAA,CAAOD,KAAA,IAASC,MAAA,CAAOxB,EAAA;EACzF;AACF","ignoreList":[]}
@@ -14,68 +14,12 @@
14
14
  overflow: clip;
15
15
  }
16
16
 
17
- .hierarchy-modal__header-actions {
18
- display: flex;
19
- gap: var(--spacer-2);
20
- }
21
-
22
17
  .dialog.hierarchy-modal .dialog__body {
23
18
  display: flex;
24
19
  flex-direction: column;
25
20
  padding: 0;
26
21
  }
27
22
 
28
- .hierarchy-modal__subheader {
29
- display: flex;
30
- justify-content: space-between;
31
- align-items: center;
32
- padding: var(--spacer-1) var(--spacer-3);
33
- padding-inline-start: var(--spacer-2-5);
34
- border-bottom: var(--stroke-width-small) solid var(--color-border);
35
- flex-shrink: 0;
36
- }
37
-
38
- .hierarchy-modal__subheader-left {
39
- display: flex;
40
- align-items: center;
41
- gap: var(--spacer-1);
42
- font-weight: 500;
43
- color: var(--color-text);
44
- }
45
-
46
- .hierarchy-modal__subheader-right {
47
- display: flex;
48
- align-items: center;
49
- gap: var(--spacer-2);
50
- }
51
-
52
- .hierarchy-modal__selection-info {
53
- color: var(--color-text-secondary);
54
- }
55
-
56
- .hierarchy-modal__move-to-root,
57
- .hierarchy-modal__clear-all {
58
- height: auto;
59
- padding: 0;
60
- border: 0;
61
- border-radius: 0;
62
- background: transparent;
63
- color: var(--color-text-secondary);
64
- text-decoration: underline;
65
- text-underline-offset: 2px;
66
- }
67
-
68
- .hierarchy-modal__move-to-root:hover:not(.btn--disabled),
69
- .hierarchy-modal__clear-all:hover:not(.btn--disabled) {
70
- background: transparent;
71
- color: var(--color-text);
72
- }
73
-
74
- .hierarchy-modal__move-to-root:active:not(.btn--disabled),
75
- .hierarchy-modal__clear-all:active:not(.btn--disabled) {
76
- background: transparent;
77
- }
78
-
79
23
  .hierarchy-modal__columns {
80
24
  flex: 1;
81
25
  overflow: hidden;
@@ -1,18 +1,20 @@
1
1
  import React from 'react';
2
2
  import type { HierarchyColumnBrowserRef } from '../ColumnBrowser/index.js';
3
- import type { HierarchyModalInternalProps } from './types.js';
3
+ import type { PathSegment } from '../ColumnBrowser/types.js';
4
+ import type { HierarchyModalInternalProps, SelectionWithPath } from './types.js';
4
5
  import './index.css';
5
6
  export declare const baseClass = "hierarchy-modal";
6
7
  type HierarchyModalContentProps = {
7
8
  columnBrowserRef?: React.RefObject<HierarchyColumnBrowserRef | null>;
8
9
  onCreateNew?: (params: {
9
10
  parentId: null | number | string;
11
+ path: PathSegment[];
10
12
  }) => void;
11
13
  } & HierarchyModalInternalProps;
12
14
  export type HierarchyModalContentRef = {
13
- selectItem: (id: number | string) => void;
15
+ selectItem: (selection: SelectionWithPath) => void;
14
16
  };
15
- export declare const HierarchyModalContent: ({ baseFilter, closeModal, columnBrowserRef, confirmLabel, disabledIds, filterByCollection, hasMany, hierarchyCollectionSlug, Icon, initialSelections, onCreateNew, onMoveToRoot, onSave, parentFieldName, ref, showMoveToRoot, title, useAsTitle, }: {
17
+ export declare const HierarchyModalContent: ({ baseFilter, closeModal, columnBrowserRef, confirmLabel, disabledIds, filterByCollection, hasMany, hierarchyCollectionSlug, Icon, initialSelections, isBusy, onCreateNew, onMoveToRoot, onSave, parentFieldName, ref, showMoveToRoot, title, useAsTitle, }: {
16
18
  ref?: React.RefObject<HierarchyModalContentRef | null>;
17
19
  } & HierarchyModalContentProps) => React.JSX.Element;
18
20
  export declare const HierarchyModal: React.FC<HierarchyModalInternalProps>;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/elements/Hierarchy/Modal/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAON,MAAM,OAAO,CAAA;AAEd,OAAO,KAAK,EAAE,yBAAyB,EA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,CAAA;IACpE,WAAW,CAAC,EAAE,CAAC,MAAM,EAAE;QAAE,QAAQ,EAAE,IAAI,GAAG,MAAM,GAAG,MAAM,CAAC;QAAC,IAAI,EAAE,WAAW,EAAE,CAAA;KAAE,KAAK,IAAI,CAAA;CAC1F,GAAG,2BAA2B,CAAA;AAE/B,MAAM,MAAM,wBAAwB,GAAG;IACrC,UAAU,EAAE,CAAC,SAAS,EAAE,iBAAiB,KAAK,IAAI,CAAA;CACnD,CAAA;AAED,eAAO,MAAM,qBAAqB,gQAoB/B;IAAE,GAAG,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,wBAAwB,GAAG,IAAI,CAAC,CAAA;CAAE,GAAG,0BAA0B,sBAkLzF,CAAA;AAED,eAAO,MAAM,cAAc,EAAE,KAAK,CAAC,EAAE,CAAC,2BAA2B,CAsHhE,CAAA"}
@@ -4,16 +4,15 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
4
4
  import { getTranslation } from '@payloadcms/translations';
5
5
  import React, { useCallback, useEffect, useImperativeHandle, useMemo, useRef, useState } from 'react';
6
6
  import { useEffectEvent } from '../../../hooks/useEffectEvent.js';
7
- import { TagIcon } from '../../../icons/Tag/index.js';
8
7
  import { useConfig } from '../../../providers/Config/index.js';
9
8
  import { useHierarchy } from '../../../providers/Hierarchy/index.js';
10
9
  import { useTranslation } from '../../../providers/Translation/index.js';
11
- import { Button } from '../../Button/index.js';
12
10
  import { DialogBody, DialogHeader, DialogModal } from '../../Dialog/index.js';
13
11
  import { useDocumentDrawer } from '../../DocumentDrawer/index.js';
14
12
  import { DrawerDepthProvider } from '../../Drawer/index.js';
15
13
  import { HierarchyColumnBrowser } from '../ColumnBrowser/index.js';
16
14
  import { fetchAncestorPath } from './fetchAncestorPath.js';
15
+ import { HierarchyModalFooter } from './Footer/index.js';
17
16
  import { createHierarchySelections, selectHierarchyItem } from './selection.js';
18
17
  import './index.css';
19
18
  export const baseClass = 'hierarchy-modal';
@@ -28,6 +27,7 @@ export const HierarchyModalContent = function HierarchyModalContent({
28
27
  hierarchyCollectionSlug,
29
28
  Icon,
30
29
  initialSelections,
30
+ isBusy,
31
31
  onCreateNew,
32
32
  onMoveToRoot,
33
33
  onSave,
@@ -56,9 +56,12 @@ export const HierarchyModalContent = function HierarchyModalContent({
56
56
  collectionSlug: hierarchyCollectionSlug
57
57
  });
58
58
  const collectionLabel = collectionConfig ? getTranslation(collectionConfig.labels?.plural || hierarchyCollectionSlug, i18n) : hierarchyCollectionSlug;
59
+ const collectionLabelSingular = collectionConfig ? getTranslation(collectionConfig.labels?.singular || hierarchyCollectionSlug, i18n) : hierarchyCollectionSlug;
59
60
  const parentFieldName_internal = collectionConfig?.hierarchy && typeof collectionConfig.hierarchy === 'object' ? collectionConfig.hierarchy.parentFieldName : parentFieldName;
60
61
  const [initialExpandedPath, setInitialExpandedPath] = useState();
62
+ const [previousPath, setPreviousPath] = useState();
61
63
  const [isLoadingPath, setIsLoadingPath] = useState(Boolean(initialSelections?.length));
64
+ const [hasSelectedDestination, setHasSelectedDestination] = useState(false);
62
65
  const hasLoadedPathRef = React.useRef(false);
63
66
  const firstSelection = initialSelections?.[0];
64
67
  const loadAncestorPath = useEffectEvent(async itemId => {
@@ -67,14 +70,19 @@ export const HierarchyModalContent = function HierarchyModalContent({
67
70
  return;
68
71
  }
69
72
  try {
70
- const path = await fetchAncestorPath({
73
+ const {
74
+ ancestorIds,
75
+ path
76
+ } = await fetchAncestorPath({
71
77
  api,
72
78
  collectionSlug: hierarchyCollectionSlug,
73
79
  itemId,
74
80
  parentFieldName: parentFieldName_internal,
75
- serverURL
81
+ serverURL,
82
+ useAsTitle: useAsTitle || 'id'
76
83
  });
77
- setInitialExpandedPath(path);
84
+ setInitialExpandedPath(ancestorIds);
85
+ setPreviousPath(path);
78
86
  } catch {
79
87
  // Silently handle fetch errors - will just start at root
80
88
  } finally {
@@ -106,6 +114,7 @@ export const HierarchyModalContent = function HierarchyModalContent({
106
114
  id,
107
115
  path: path_0
108
116
  }) => {
117
+ setHasSelectedDestination(true);
109
118
  setSelections(prev => {
110
119
  return selectHierarchyItem({
111
120
  id,
@@ -123,84 +132,43 @@ export const HierarchyModalContent = function HierarchyModalContent({
123
132
  hasMany,
124
133
  initialSelections
125
134
  }));
135
+ setHasSelectedDestination(false);
126
136
  closeModal();
127
137
  }, [closeModal, hasMany, initialSelections]);
128
138
  // Expose selectItem for programmatic selection (e.g., after creating a new item)
129
139
  useImperativeHandle(ref, () => ({
130
- selectItem: id_0 => {
140
+ selectItem: ({
141
+ id: id_0,
142
+ path: path_1
143
+ }) => {
144
+ setHasSelectedDestination(true);
131
145
  setSelections(prev_0 => {
132
146
  const next = new Map(prev_0);
133
147
  if (!hasMany) {
134
148
  next.clear();
135
149
  }
136
- // Path will be empty for newly created items - could be enhanced later
137
150
  next.set(id_0, {
138
151
  id: id_0,
139
- path: []
152
+ path: path_1
140
153
  });
141
154
  return next;
142
155
  });
143
156
  }
144
157
  }), [hasMany]);
145
158
  const selectionCount = selections.size;
159
+ const destination = hasMany || !hasSelectedDestination ? undefined : selections.values().next().value;
160
+ const destinationPath = destination?.path;
161
+ const isDestinationUnchanged = destination !== undefined && destination.id === firstSelection;
146
162
  return /*#__PURE__*/_jsxs("div", {
147
163
  className: `${baseClass}__content`,
148
164
  children: [/*#__PURE__*/_jsx(DialogHeader, {
165
+ onClose: handleCancel,
166
+ showClose: true,
149
167
  title: title || t('general:selectValue', {
150
168
  label: collectionLabel
151
- }),
152
- children: /*#__PURE__*/_jsxs("div", {
153
- className: `${baseClass}__header-actions`,
154
- children: [/*#__PURE__*/_jsx(Button, {
155
- buttonStyle: "secondary",
156
- margin: false,
157
- onClick: handleCancel,
158
- size: "medium",
159
- children: t('general:cancel')
160
- }), /*#__PURE__*/_jsx(Button, {
161
- margin: false,
162
- onClick: handleSave,
163
- size: "medium",
164
- children: confirmLabel || t('general:select')
165
- })]
166
169
  })
167
- }), /*#__PURE__*/_jsxs(DialogBody, {
168
- children: [/*#__PURE__*/_jsxs("div", {
169
- className: `${baseClass}__subheader`,
170
- children: [/*#__PURE__*/_jsxs("div", {
171
- className: `${baseClass}__subheader-left`,
172
- children: [Icon || /*#__PURE__*/_jsx(TagIcon, {}), /*#__PURE__*/_jsx("h4", {
173
- children: collectionLabel
174
- })]
175
- }), /*#__PURE__*/_jsxs("div", {
176
- className: `${baseClass}__subheader-right`,
177
- children: [showMoveToRoot && onMoveToRoot && /*#__PURE__*/_jsx(Button, {
178
- buttonStyle: "ghost",
179
- className: `${baseClass}__move-to-root`,
180
- margin: false,
181
- onClick: onMoveToRoot,
182
- size: "medium",
183
- children: t('hierarchy:moveToRoot')
184
- }), Boolean(selectionCount) && /*#__PURE__*/_jsxs(_Fragment, {
185
- children: [/*#__PURE__*/_jsx("span", {
186
- className: `${baseClass}__selection-info`,
187
- children: t('general:selectedCount', {
188
- count: selectionCount,
189
- label: ''
190
- })
191
- }), /*#__PURE__*/_jsx("span", {
192
- children: "—"
193
- }), /*#__PURE__*/_jsx(Button, {
194
- buttonStyle: "ghost",
195
- className: `${baseClass}__clear-all`,
196
- margin: false,
197
- onClick: handleClearAll,
198
- size: "medium",
199
- children: t('general:clear')
200
- })]
201
- })]
202
- })]
203
- }), /*#__PURE__*/_jsx("div", {
170
+ }), /*#__PURE__*/_jsx(DialogBody, {
171
+ children: /*#__PURE__*/_jsx("div", {
204
172
  className: `${baseClass}__columns`,
205
173
  children: /*#__PURE__*/_jsx(HierarchyColumnBrowser, {
206
174
  ancestorsWithSelections: ancestorsWithSelections,
@@ -217,7 +185,27 @@ export const HierarchyModalContent = function HierarchyModalContent({
217
185
  selectedIds: selectedIds,
218
186
  useAsTitle: useAsTitle
219
187
  })
220
- })]
188
+ })
189
+ }), /*#__PURE__*/_jsx(HierarchyModalFooter, {
190
+ confirmLabel: confirmLabel || t('general:confirm'),
191
+ destinationPath: destinationPath,
192
+ Icon: Icon,
193
+ isBusy: isBusy,
194
+ isConfirmDisabled: !hasMany && (!hasSelectedDestination || selectionCount === 0 || isDestinationUnchanged),
195
+ isMultiSelect: hasMany,
196
+ onClear: handleClearAll,
197
+ onConfirm: handleSave,
198
+ onMoveToRoot: onMoveToRoot,
199
+ placeholderLabel: t('general:selectLabel', {
200
+ label: collectionLabelSingular
201
+ }),
202
+ previousPath: hasMany ? undefined : previousPath,
203
+ selectionCount: selectionCount,
204
+ selectionCountLabel: t('general:selectedCount', {
205
+ count: selectionCount,
206
+ label: selectionCount === 1 ? collectionLabelSingular : collectionLabel
207
+ }),
208
+ showMoveToRoot: showMoveToRoot
221
209
  })]
222
210
  });
223
211
  };
@@ -226,7 +214,8 @@ export const HierarchyModal = props => {
226
214
  hierarchyCollectionSlug,
227
215
  modalSlug,
228
216
  parentFieldName,
229
- reopenCount
217
+ reopenCount,
218
+ useAsTitle
230
219
  } = props;
231
220
  const {
232
221
  refreshTree
@@ -241,6 +230,7 @@ export const HierarchyModal = props => {
241
230
  const parentFieldName_internal = collectionConfig?.hierarchy && typeof collectionConfig.hierarchy === 'object' ? collectionConfig.hierarchy.parentFieldName : parentFieldName;
242
231
  // Track which parentId is being used for the document drawer - use state to trigger re-render
243
232
  const [createParentId, setCreateParentId] = useState(null);
233
+ const [createParentPath, setCreateParentPath] = useState([]);
244
234
  // Ref to access column browser's refresh function
245
235
  const columnBrowserRef = useRef(null);
246
236
  // Ref to access drawer content's selectItem function
@@ -258,11 +248,13 @@ export const HierarchyModal = props => {
258
248
  drawerSlug: documentDrawerSlug
259
249
  });
260
250
  const handleCreateNew = useCallback(({
261
- parentId
251
+ parentId,
252
+ path = []
262
253
  }) => {
263
254
  // Increment key to force DocumentDrawer remount with new initialData
264
255
  setDocumentDrawerKey(prev => prev + 1);
265
256
  setCreateParentId(parentId);
257
+ setCreateParentPath(path);
266
258
  // Use setTimeout to ensure state update triggers re-render before opening drawer
267
259
  setTimeout(() => {
268
260
  openDocumentDrawer();
@@ -276,11 +268,18 @@ export const HierarchyModal = props => {
276
268
  void columnBrowserRef.current.refreshColumn(createParentId);
277
269
  }
278
270
  if (modalContentRef.current && doc?.id) {
279
- modalContentRef.current.selectItem(doc.id);
271
+ const title = useAsTitle ? doc[useAsTitle] : undefined;
272
+ modalContentRef.current.selectItem({
273
+ id: doc.id,
274
+ path: [...createParentPath, {
275
+ id: doc.id,
276
+ title: typeof title === 'number' || typeof title === 'string' ? String(title) : String(doc.id)
277
+ }]
278
+ });
280
279
  }
281
280
  refreshTree(hierarchyCollectionSlug);
282
281
  closeDocumentDrawer();
283
- }, [closeDocumentDrawer, createParentId, hierarchyCollectionSlug, refreshTree]);
282
+ }, [closeDocumentDrawer, createParentId, createParentPath, hierarchyCollectionSlug, refreshTree, useAsTitle]);
284
283
  // Memoize the content - only depends on stable values
285
284
  const modalContent = useMemo(() => /*#__PURE__*/_jsx(HierarchyModalContent, {
286
285
  ...props,
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["getTranslation","React","useCallback","useEffect","useImperativeHandle","useMemo","useRef","useState","useEffectEvent","TagIcon","useConfig","useHierarchy","useTranslation","Button","DialogBody","DialogHeader","DialogModal","useDocumentDrawer","DrawerDepthProvider","HierarchyColumnBrowser","fetchAncestorPath","createHierarchySelections","selectHierarchyItem","baseClass","HierarchyModalContent","baseFilter","closeModal","columnBrowserRef","confirmLabel","disabledIds","filterByCollection","hasMany","hierarchyCollectionSlug","Icon","initialSelections","onCreateNew","onMoveToRoot","onSave","parentFieldName","ref","showMoveToRoot","title","useAsTitle","i18n","t","config","routes","api","serverURL","getEntityConfig","collectionConfig","collectionSlug","collectionLabel","labels","plural","parentFieldName_internal","hierarchy","initialExpandedPath","setInitialExpandedPath","isLoadingPath","setIsLoadingPath","Boolean","length","hasLoadedPathRef","firstSelection","loadAncestorPath","itemId","undefined","path","current","selections","setSelections","selectedIds","Set","keys","ancestorsWithSelections","handleSave","handleSelect","id","prev","handleClearAll","Map","handleCancel","selectItem","next","clear","set","selectionCount","size","_jsxs","className","_jsx","label","buttonStyle","margin","onClick","_Fragment","count","onSelect","HierarchyModal","props","modalSlug","reopenCount","refreshTree","createParentId","setCreateParentId","modalContentRef","documentDrawerKey","setDocumentDrawerKey","documentDrawerSlug","DocumentDrawer","closeDrawer","closeDocumentDrawer","openDrawer","openDocumentDrawer","drawerSlug","handleCreateNew","parentId","setTimeout","handleDocumentSave","doc","refreshColumn","modalContent","closeOnBlur","slug","initialData"],"sources":["../../../../src/elements/Hierarchy/Modal/index.tsx"],"sourcesContent":["'use client'\nimport { getTranslation } from '@payloadcms/translations'\nimport React, {\n useCallback,\n useEffect,\n useImperativeHandle,\n useMemo,\n useRef,\n useState,\n} from 'react'\n\nimport type { HierarchyColumnBrowserRef } from '../ColumnBrowser/index.js'\nimport type { HierarchyModalInternalProps, SelectionWithPath } from './types.js'\n\nimport { useEffectEvent } from '../../../hooks/useEffectEvent.js'\nimport { TagIcon } from '../../../icons/Tag/index.js'\nimport { useConfig } from '../../../providers/Config/index.js'\nimport { useHierarchy } from '../../../providers/Hierarchy/index.js'\nimport { useTranslation } from '../../../providers/Translation/index.js'\nimport { Button } from '../../Button/index.js'\nimport { DialogBody, DialogHeader, DialogModal } from '../../Dialog/index.js'\nimport { useDocumentDrawer } from '../../DocumentDrawer/index.js'\nimport { DrawerDepthProvider } from '../../Drawer/index.js'\nimport { HierarchyColumnBrowser } from '../ColumnBrowser/index.js'\nimport { fetchAncestorPath } from './fetchAncestorPath.js'\nimport { createHierarchySelections, selectHierarchyItem } from './selection.js'\nimport './index.css'\n\nexport const baseClass = 'hierarchy-modal'\n\ntype HierarchyModalContentProps = {\n columnBrowserRef?: React.RefObject<HierarchyColumnBrowserRef | null>\n onCreateNew?: (params: { parentId: null | number | string }) => void\n} & HierarchyModalInternalProps\n\nexport type HierarchyModalContentRef = {\n selectItem: (id: number | string) => void\n}\n\nexport const HierarchyModalContent = function HierarchyModalContent({\n baseFilter,\n closeModal,\n columnBrowserRef,\n confirmLabel,\n disabledIds,\n filterByCollection,\n hasMany = false,\n hierarchyCollectionSlug,\n Icon,\n initialSelections,\n onCreateNew,\n onMoveToRoot,\n onSave,\n parentFieldName,\n ref,\n showMoveToRoot,\n title,\n useAsTitle,\n}: { ref?: React.RefObject<HierarchyModalContentRef | null> } & HierarchyModalContentProps) {\n const { i18n, t } = useTranslation()\n // NOTE: Do NOT use useModal() here - it causes re-renders when any modal state changes\n // Use closeModal prop instead which already handles closing the modal\n const {\n config: {\n routes: { api },\n serverURL,\n },\n getEntityConfig,\n } = useConfig()\n\n const collectionConfig = getEntityConfig({ collectionSlug: hierarchyCollectionSlug })\n const collectionLabel = collectionConfig\n ? getTranslation(collectionConfig.labels?.plural || hierarchyCollectionSlug, i18n)\n : hierarchyCollectionSlug\n\n const parentFieldName_internal =\n collectionConfig?.hierarchy && typeof collectionConfig.hierarchy === 'object'\n ? collectionConfig.hierarchy.parentFieldName\n : parentFieldName\n\n const [initialExpandedPath, setInitialExpandedPath] = useState<(number | string)[] | undefined>()\n const [isLoadingPath, setIsLoadingPath] = useState(Boolean(initialSelections?.length))\n const hasLoadedPathRef = React.useRef(false)\n const firstSelection = initialSelections?.[0]\n\n const loadAncestorPath = useEffectEvent(async (itemId?: number | string) => {\n if (itemId === undefined || itemId === null) {\n setIsLoadingPath(false)\n return\n }\n\n try {\n const path = await fetchAncestorPath({\n api,\n collectionSlug: hierarchyCollectionSlug,\n itemId,\n parentFieldName: parentFieldName_internal,\n serverURL,\n })\n setInitialExpandedPath(path)\n } catch {\n // Silently handle fetch errors - will just start at root\n } finally {\n setIsLoadingPath(false)\n }\n })\n\n // Load ancestor path on mount\n useEffect(() => {\n if (hasLoadedPathRef.current) {\n return\n }\n hasLoadedPathRef.current = true\n void loadAncestorPath(firstSelection)\n }, [firstSelection])\n\n const [selections, setSelections] = useState<Map<number | string, SelectionWithPath>>(() =>\n createHierarchySelections({ hasMany, initialSelections }),\n )\n\n const selectedIds = useMemo(() => new Set(selections.keys()), [selections])\n\n // For now, ancestorsWithSelections is empty - will be computed when we have path tracking\n const ancestorsWithSelections = useMemo(() => new Set<number | string>(), [])\n\n const handleSave = useCallback(() => {\n onSave({ closeModal, selections })\n }, [onSave, selections, closeModal])\n\n const handleSelect = useCallback(\n ({\n id,\n path,\n }: {\n id: number | string\n path: Array<{ id: number | string; title: string }>\n }) => {\n setSelections((prev) => {\n return selectHierarchyItem({ id, current: prev, hasMany, path })\n })\n },\n [hasMany],\n )\n\n const handleClearAll = useCallback(() => {\n setSelections(new Map())\n }, [])\n\n const handleCancel = useCallback(() => {\n setSelections(createHierarchySelections({ hasMany, initialSelections }))\n closeModal()\n }, [closeModal, hasMany, initialSelections])\n\n // Expose selectItem for programmatic selection (e.g., after creating a new item)\n useImperativeHandle(\n ref,\n () => ({\n selectItem: (id: number | string) => {\n setSelections((prev) => {\n const next = new Map(prev)\n if (!hasMany) {\n next.clear()\n }\n // Path will be empty for newly created items - could be enhanced later\n next.set(id, { id, path: [] })\n return next\n })\n },\n }),\n [hasMany],\n )\n\n const selectionCount = selections.size\n\n return (\n <div className={`${baseClass}__content`}>\n <DialogHeader title={title || t('general:selectValue', { label: collectionLabel })}>\n <div className={`${baseClass}__header-actions`}>\n <Button buttonStyle=\"secondary\" margin={false} onClick={handleCancel} size=\"medium\">\n {t('general:cancel')}\n </Button>\n <Button margin={false} onClick={handleSave} size=\"medium\">\n {confirmLabel || t('general:select')}\n </Button>\n </div>\n </DialogHeader>\n <DialogBody>\n <div className={`${baseClass}__subheader`}>\n <div className={`${baseClass}__subheader-left`}>\n {Icon || <TagIcon />}\n <h4>{collectionLabel}</h4>\n </div>\n <div className={`${baseClass}__subheader-right`}>\n {showMoveToRoot && onMoveToRoot && (\n <Button\n buttonStyle=\"ghost\"\n className={`${baseClass}__move-to-root`}\n margin={false}\n onClick={onMoveToRoot}\n size=\"medium\"\n >\n {t('hierarchy:moveToRoot')}\n </Button>\n )}\n {Boolean(selectionCount) && (\n <>\n {\n <span className={`${baseClass}__selection-info`}>\n {t('general:selectedCount', { count: selectionCount, label: '' })}\n </span>\n }\n <span>—</span>\n <Button\n buttonStyle=\"ghost\"\n className={`${baseClass}__clear-all`}\n margin={false}\n onClick={handleClearAll}\n size=\"medium\"\n >\n {t('general:clear')}\n </Button>\n </>\n )}\n </div>\n </div>\n <div className={`${baseClass}__columns`}>\n <HierarchyColumnBrowser\n ancestorsWithSelections={ancestorsWithSelections}\n baseFilter={baseFilter}\n disabledIds={disabledIds}\n filterByCollection={filterByCollection}\n hierarchyCollectionSlug={hierarchyCollectionSlug}\n initialExpandedPath={initialExpandedPath}\n isLoadingPath={isLoadingPath}\n onCreateNew={onCreateNew}\n onSelect={handleSelect}\n parentFieldName={parentFieldName}\n ref={columnBrowserRef}\n selectedIds={selectedIds}\n useAsTitle={useAsTitle}\n />\n </div>\n </DialogBody>\n </div>\n )\n}\n\nexport const HierarchyModal: React.FC<HierarchyModalInternalProps> = (props) => {\n const { hierarchyCollectionSlug, modalSlug, parentFieldName, reopenCount } = props\n\n const { refreshTree } = useHierarchy()\n\n // Get parentFieldName from hierarchy config\n const { getEntityConfig } = useConfig()\n const collectionConfig = getEntityConfig({ collectionSlug: hierarchyCollectionSlug })\n const parentFieldName_internal =\n collectionConfig?.hierarchy && typeof collectionConfig.hierarchy === 'object'\n ? collectionConfig.hierarchy.parentFieldName\n : parentFieldName\n\n // Track which parentId is being used for the document drawer - use state to trigger re-render\n const [createParentId, setCreateParentId] = useState<null | number | string>(null)\n\n // Ref to access column browser's refresh function\n const columnBrowserRef = useRef<HierarchyColumnBrowserRef | null>(null)\n\n // Ref to access drawer content's selectItem function\n const modalContentRef = useRef<HierarchyModalContentRef | null>(null)\n\n // Key for DocumentDrawer to force remount when parentId changes\n const [documentDrawerKey, setDocumentDrawerKey] = useState(0)\n\n // Stable drawer slug for the document drawer - must not change on remount\n const documentDrawerSlug = `${modalSlug}-create-doc`\n\n // Document drawer for creating new items - rendered OUTSIDE the modal to avoid nested modal issues\n const [DocumentDrawer, , { closeDrawer: closeDocumentDrawer, openDrawer: openDocumentDrawer }] =\n useDocumentDrawer({\n collectionSlug: hierarchyCollectionSlug,\n drawerSlug: documentDrawerSlug,\n })\n\n const handleCreateNew = useCallback(\n ({ parentId }: { parentId: null | number | string }) => {\n // Increment key to force DocumentDrawer remount with new initialData\n setDocumentDrawerKey((prev) => prev + 1)\n setCreateParentId(parentId)\n // Use setTimeout to ensure state update triggers re-render before opening drawer\n setTimeout(() => {\n openDocumentDrawer()\n }, 0)\n },\n [openDocumentDrawer],\n )\n\n // Refresh the column, select the new item, and close the document drawer after creation\n const handleDocumentSave = useCallback<\n NonNullable<React.ComponentProps<typeof DocumentDrawer>['onSave']>\n >(\n ({ doc }) => {\n if (columnBrowserRef.current && createParentId !== undefined) {\n void columnBrowserRef.current.refreshColumn(createParentId)\n }\n if (modalContentRef.current && doc?.id) {\n modalContentRef.current.selectItem(doc.id)\n }\n refreshTree(hierarchyCollectionSlug)\n closeDocumentDrawer()\n },\n [closeDocumentDrawer, createParentId, hierarchyCollectionSlug, refreshTree],\n )\n\n // Memoize the content - only depends on stable values\n const modalContent = useMemo(\n () => (\n <HierarchyModalContent\n key={reopenCount}\n {...props}\n columnBrowserRef={columnBrowserRef}\n onCreateNew={handleCreateNew}\n ref={modalContentRef}\n />\n ),\n [handleCreateNew, props, reopenCount],\n )\n\n return (\n <>\n <DialogModal className={baseClass} closeOnBlur size=\"large\" slug={modalSlug}>\n {modalContent}\n </DialogModal>\n <DrawerDepthProvider>\n <DocumentDrawer\n initialData={\n createParentId !== null ? { [parentFieldName_internal]: createParentId } : undefined\n }\n key={documentDrawerKey}\n onSave={handleDocumentSave}\n />\n </DrawerDepthProvider>\n </>\n )\n}\n"],"mappings":"AAAA;;;AACA,SAASA,cAAc,QAAQ;AAC/B,OAAOC,KAAA,IACLC,WAAW,EACXC,SAAS,EACTC,mBAAmB,EACnBC,OAAO,EACPC,MAAM,EACNC,QAAQ,QACH;AAKP,SAASC,cAAc,QAAQ;AAC/B,SAASC,OAAO,QAAQ;AACxB,SAASC,SAAS,QAAQ;AAC1B,SAASC,Y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AAQoC,IAAA,EAAMvB,SAAA;gBAC/DqB;qBAEH/B,IAAA,CAACzE,mBAAA;gBACC,aAAAyE,IAAA,CAACmB,cAAA;QACCe,WAAA,EACErB,cAAA,KAAmB,OAAO;UAAE,CAACjD,wBAAA,GAA2BiD;QAAe,IAAIrC,SAAA;QAG7E9B,MAAA,EAAQkF;SADHZ,iBAAA;;;AAMf","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["getTranslation","React","useCallback","useEffect","useImperativeHandle","useMemo","useRef","useState","useEffectEvent","useConfig","useHierarchy","useTranslation","DialogBody","DialogHeader","DialogModal","useDocumentDrawer","DrawerDepthProvider","HierarchyColumnBrowser","fetchAncestorPath","HierarchyModalFooter","createHierarchySelections","selectHierarchyItem","baseClass","HierarchyModalContent","baseFilter","closeModal","columnBrowserRef","confirmLabel","disabledIds","filterByCollection","hasMany","hierarchyCollectionSlug","Icon","initialSelections","isBusy","onCreateNew","onMoveToRoot","onSave","parentFieldName","ref","showMoveToRoot","title","useAsTitle","i18n","t","config","routes","api","serverURL","getEntityConfig","collectionConfig","collectionSlug","collectionLabel","labels","plural","collectionLabelSingular","singular","parentFieldName_internal","hierarchy","initialExpandedPath","setInitialExpandedPath","previousPath","setPreviousPath","isLoadingPath","setIsLoadingPath","Boolean","length","hasSelectedDestination","setHasSelectedDestination","hasLoadedPathRef","firstSelection","loadAncestorPath","itemId","undefined","ancestorIds","path","current","selections","setSelections","selectedIds","Set","keys","ancestorsWithSelections","handleSave","handleSelect","id","prev","handleClearAll","Map","handleCancel","selectItem","next","clear","set","selectionCount","size","destination","values","value","destinationPath","isDestinationUnchanged","_jsxs","className","_jsx","onClose","showClose","label","onSelect","isConfirmDisabled","isMultiSelect","onClear","onConfirm","placeholderLabel","selectionCountLabel","count","HierarchyModal","props","modalSlug","reopenCount","refreshTree","createParentId","setCreateParentId","createParentPath","setCreateParentPath","modalContentRef","documentDrawerKey","setDocumentDrawerKey","documentDrawerSlug","DocumentDrawer","closeDrawer","closeDocumentDrawer","openDrawer","openDocumentDrawer","drawerSlug","handleCreateNew","parentId","setTimeout","handleDocumentSave","doc","refreshColumn","String","modalContent","_Fragment","closeOnBlur","slug","initialData"],"sources":["../../../../src/elements/Hierarchy/Modal/index.tsx"],"sourcesContent":["'use client'\nimport { getTranslation } from '@payloadcms/translations'\nimport React, {\n useCallback,\n useEffect,\n useImperativeHandle,\n useMemo,\n useRef,\n useState,\n} from 'react'\n\nimport type { HierarchyColumnBrowserRef } from '../ColumnBrowser/index.js'\nimport type { PathSegment } from '../ColumnBrowser/types.js'\nimport type { HierarchyModalInternalProps, SelectionWithPath } from './types.js'\n\nimport { useEffectEvent } from '../../../hooks/useEffectEvent.js'\nimport { useConfig } from '../../../providers/Config/index.js'\nimport { useHierarchy } from '../../../providers/Hierarchy/index.js'\nimport { useTranslation } from '../../../providers/Translation/index.js'\nimport { DialogBody, DialogHeader, DialogModal } from '../../Dialog/index.js'\nimport { useDocumentDrawer } from '../../DocumentDrawer/index.js'\nimport { DrawerDepthProvider } from '../../Drawer/index.js'\nimport { HierarchyColumnBrowser } from '../ColumnBrowser/index.js'\nimport { fetchAncestorPath } from './fetchAncestorPath.js'\nimport { HierarchyModalFooter } from './Footer/index.js'\nimport { createHierarchySelections, selectHierarchyItem } from './selection.js'\nimport './index.css'\n\nexport const baseClass = 'hierarchy-modal'\n\ntype HierarchyModalContentProps = {\n columnBrowserRef?: React.RefObject<HierarchyColumnBrowserRef | null>\n onCreateNew?: (params: { parentId: null | number | string; path: PathSegment[] }) => void\n} & HierarchyModalInternalProps\n\nexport type HierarchyModalContentRef = {\n selectItem: (selection: SelectionWithPath) => void\n}\n\nexport const HierarchyModalContent = function HierarchyModalContent({\n baseFilter,\n closeModal,\n columnBrowserRef,\n confirmLabel,\n disabledIds,\n filterByCollection,\n hasMany = false,\n hierarchyCollectionSlug,\n Icon,\n initialSelections,\n isBusy,\n onCreateNew,\n onMoveToRoot,\n onSave,\n parentFieldName,\n ref,\n showMoveToRoot,\n title,\n useAsTitle,\n}: { ref?: React.RefObject<HierarchyModalContentRef | null> } & HierarchyModalContentProps) {\n const { i18n, t } = useTranslation()\n // NOTE: Do NOT use useModal() here - it causes re-renders when any modal state changes\n // Use closeModal prop instead which already handles closing the modal\n const {\n config: {\n routes: { api },\n serverURL,\n },\n getEntityConfig,\n } = useConfig()\n\n const collectionConfig = getEntityConfig({ collectionSlug: hierarchyCollectionSlug })\n const collectionLabel = collectionConfig\n ? getTranslation(collectionConfig.labels?.plural || hierarchyCollectionSlug, i18n)\n : hierarchyCollectionSlug\n const collectionLabelSingular = collectionConfig\n ? getTranslation(collectionConfig.labels?.singular || hierarchyCollectionSlug, i18n)\n : hierarchyCollectionSlug\n\n const parentFieldName_internal =\n collectionConfig?.hierarchy && typeof collectionConfig.hierarchy === 'object'\n ? collectionConfig.hierarchy.parentFieldName\n : parentFieldName\n\n const [initialExpandedPath, setInitialExpandedPath] = useState<(number | string)[] | undefined>()\n const [previousPath, setPreviousPath] = useState<PathSegment[] | undefined>()\n const [isLoadingPath, setIsLoadingPath] = useState(Boolean(initialSelections?.length))\n const [hasSelectedDestination, setHasSelectedDestination] = useState(false)\n const hasLoadedPathRef = React.useRef(false)\n const firstSelection = initialSelections?.[0]\n\n const loadAncestorPath = useEffectEvent(async (itemId?: number | string) => {\n if (itemId === undefined || itemId === null) {\n setIsLoadingPath(false)\n return\n }\n\n try {\n const { ancestorIds, path } = await fetchAncestorPath({\n api,\n collectionSlug: hierarchyCollectionSlug,\n itemId,\n parentFieldName: parentFieldName_internal,\n serverURL,\n useAsTitle: useAsTitle || 'id',\n })\n setInitialExpandedPath(ancestorIds)\n setPreviousPath(path)\n } catch {\n // Silently handle fetch errors - will just start at root\n } finally {\n setIsLoadingPath(false)\n }\n })\n\n // Load ancestor path on mount\n useEffect(() => {\n if (hasLoadedPathRef.current) {\n return\n }\n hasLoadedPathRef.current = true\n void loadAncestorPath(firstSelection)\n }, [firstSelection])\n\n const [selections, setSelections] = useState<Map<number | string, SelectionWithPath>>(() =>\n createHierarchySelections({ hasMany, initialSelections }),\n )\n\n const selectedIds = useMemo(() => new Set(selections.keys()), [selections])\n\n // For now, ancestorsWithSelections is empty - will be computed when we have path tracking\n const ancestorsWithSelections = useMemo(() => new Set<number | string>(), [])\n\n const handleSave = useCallback(() => {\n onSave({ closeModal, selections })\n }, [onSave, selections, closeModal])\n\n const handleSelect = useCallback(\n ({\n id,\n path,\n }: {\n id: number | string\n path: Array<{ id: number | string; title: string }>\n }) => {\n setHasSelectedDestination(true)\n setSelections((prev) => {\n return selectHierarchyItem({ id, current: prev, hasMany, path })\n })\n },\n [hasMany],\n )\n\n const handleClearAll = useCallback(() => {\n setSelections(new Map())\n }, [])\n\n const handleCancel = useCallback(() => {\n setSelections(createHierarchySelections({ hasMany, initialSelections }))\n setHasSelectedDestination(false)\n closeModal()\n }, [closeModal, hasMany, initialSelections])\n\n // Expose selectItem for programmatic selection (e.g., after creating a new item)\n useImperativeHandle(\n ref,\n () => ({\n selectItem: ({ id, path }: SelectionWithPath) => {\n setHasSelectedDestination(true)\n setSelections((prev) => {\n const next = new Map(prev)\n if (!hasMany) {\n next.clear()\n }\n next.set(id, { id, path })\n return next\n })\n },\n }),\n [hasMany],\n )\n\n const selectionCount = selections.size\n const destination =\n hasMany || !hasSelectedDestination ? undefined : selections.values().next().value\n const destinationPath = destination?.path\n const isDestinationUnchanged = destination !== undefined && destination.id === firstSelection\n\n return (\n <div className={`${baseClass}__content`}>\n <DialogHeader\n onClose={handleCancel}\n showClose\n title={title || t('general:selectValue', { label: collectionLabel })}\n />\n <DialogBody>\n <div className={`${baseClass}__columns`}>\n <HierarchyColumnBrowser\n ancestorsWithSelections={ancestorsWithSelections}\n baseFilter={baseFilter}\n disabledIds={disabledIds}\n filterByCollection={filterByCollection}\n hierarchyCollectionSlug={hierarchyCollectionSlug}\n initialExpandedPath={initialExpandedPath}\n isLoadingPath={isLoadingPath}\n onCreateNew={onCreateNew}\n onSelect={handleSelect}\n parentFieldName={parentFieldName}\n ref={columnBrowserRef}\n selectedIds={selectedIds}\n useAsTitle={useAsTitle}\n />\n </div>\n </DialogBody>\n <HierarchyModalFooter\n confirmLabel={confirmLabel || t('general:confirm')}\n destinationPath={destinationPath}\n Icon={Icon}\n isBusy={isBusy}\n isConfirmDisabled={\n !hasMany && (!hasSelectedDestination || selectionCount === 0 || isDestinationUnchanged)\n }\n isMultiSelect={hasMany}\n onClear={handleClearAll}\n onConfirm={handleSave}\n onMoveToRoot={onMoveToRoot}\n placeholderLabel={t('general:selectLabel', { label: collectionLabelSingular })}\n previousPath={hasMany ? undefined : previousPath}\n selectionCount={selectionCount}\n selectionCountLabel={t('general:selectedCount', {\n count: selectionCount,\n label: selectionCount === 1 ? collectionLabelSingular : collectionLabel,\n })}\n showMoveToRoot={showMoveToRoot}\n />\n </div>\n )\n}\n\nexport const HierarchyModal: React.FC<HierarchyModalInternalProps> = (props) => {\n const { hierarchyCollectionSlug, modalSlug, parentFieldName, reopenCount, useAsTitle } = props\n\n const { refreshTree } = useHierarchy()\n\n // Get parentFieldName from hierarchy config\n const { getEntityConfig } = useConfig()\n const collectionConfig = getEntityConfig({ collectionSlug: hierarchyCollectionSlug })\n const parentFieldName_internal =\n collectionConfig?.hierarchy && typeof collectionConfig.hierarchy === 'object'\n ? collectionConfig.hierarchy.parentFieldName\n : parentFieldName\n\n // Track which parentId is being used for the document drawer - use state to trigger re-render\n const [createParentId, setCreateParentId] = useState<null | number | string>(null)\n const [createParentPath, setCreateParentPath] = useState<PathSegment[]>([])\n\n // Ref to access column browser's refresh function\n const columnBrowserRef = useRef<HierarchyColumnBrowserRef | null>(null)\n\n // Ref to access drawer content's selectItem function\n const modalContentRef = useRef<HierarchyModalContentRef | null>(null)\n\n // Key for DocumentDrawer to force remount when parentId changes\n const [documentDrawerKey, setDocumentDrawerKey] = useState(0)\n\n // Stable drawer slug for the document drawer - must not change on remount\n const documentDrawerSlug = `${modalSlug}-create-doc`\n\n // Document drawer for creating new items - rendered OUTSIDE the modal to avoid nested modal issues\n const [DocumentDrawer, , { closeDrawer: closeDocumentDrawer, openDrawer: openDocumentDrawer }] =\n useDocumentDrawer({\n collectionSlug: hierarchyCollectionSlug,\n drawerSlug: documentDrawerSlug,\n })\n\n const handleCreateNew = useCallback(\n ({ parentId, path = [] }: { parentId: null | number | string; path?: PathSegment[] }) => {\n // Increment key to force DocumentDrawer remount with new initialData\n setDocumentDrawerKey((prev) => prev + 1)\n setCreateParentId(parentId)\n setCreateParentPath(path)\n // Use setTimeout to ensure state update triggers re-render before opening drawer\n setTimeout(() => {\n openDocumentDrawer()\n }, 0)\n },\n [openDocumentDrawer],\n )\n\n // Refresh the column, select the new item, and close the document drawer after creation\n const handleDocumentSave = useCallback<\n NonNullable<React.ComponentProps<typeof DocumentDrawer>['onSave']>\n >(\n ({ doc }) => {\n if (columnBrowserRef.current && createParentId !== undefined) {\n void columnBrowserRef.current.refreshColumn(createParentId)\n }\n if (modalContentRef.current && doc?.id) {\n const title = useAsTitle ? doc[useAsTitle] : undefined\n\n modalContentRef.current.selectItem({\n id: doc.id,\n path: [\n ...createParentPath,\n {\n id: doc.id,\n title:\n typeof title === 'number' || typeof title === 'string'\n ? String(title)\n : String(doc.id),\n },\n ],\n })\n }\n refreshTree(hierarchyCollectionSlug)\n closeDocumentDrawer()\n },\n [\n closeDocumentDrawer,\n createParentId,\n createParentPath,\n hierarchyCollectionSlug,\n refreshTree,\n useAsTitle,\n ],\n )\n\n // Memoize the content - only depends on stable values\n const modalContent = useMemo(\n () => (\n <HierarchyModalContent\n key={reopenCount}\n {...props}\n columnBrowserRef={columnBrowserRef}\n onCreateNew={handleCreateNew}\n ref={modalContentRef}\n />\n ),\n [handleCreateNew, props, reopenCount],\n )\n\n return (\n <>\n <DialogModal className={baseClass} closeOnBlur size=\"large\" slug={modalSlug}>\n {modalContent}\n </DialogModal>\n <DrawerDepthProvider>\n <DocumentDrawer\n initialData={\n createParentId !== null ? { [parentFieldName_internal]: createParentId } : undefined\n }\n key={docum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SAAA;QAG7EpC,MAAA,EAAQoG;SADHZ,iBAAA;;;AAMf","ignoreList":[]}
@@ -23,6 +23,8 @@ export type HierarchyModalProps = {
23
23
  readonly confirmLabel?: string;
24
24
  readonly hasMany?: boolean;
25
25
  readonly initialSelections?: (number | string)[];
26
+ /** Disables the confirm and move to root actions while a save is running */
27
+ readonly isBusy?: boolean;
26
28
  readonly onMoveToRoot?: () => void;
27
29
  readonly onSave: (params: {
28
30
  closeModal: () => void;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/elements/Hierarchy/Modal/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AACpC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAA;AAE3C,MAAM,MAAM,iBAAiB,GAAG;IAC9B,EAAE,EAAE,MAAM,GAAG,MAAM,CAAA;IACnB,IAAI,EAAE,KAAK,CAAC;QAAE,EAAE,EAAE,MAAM,GAAG,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;CACpD,CAAA;AAED,MAAM,MAAM,qBAAqB,GAAG;IAClC,6FAA6F;IAC7F,WAAW,CAAC,EAAE,GAAG,CAAC,MAAM,GAAG,MAAM,CAAC,CAAA;IAClC;;;OAGG;IACH,kBAAkB,CAAC,EAAE,MAAM,EAAE,CAAA;IAC7B,uBAAuB,EAAE,MAAM,CAAA;IAC/B,IAAI,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;CACvB,CAAA;AAED,MAAM,MAAM,mBAAmB,GAAG;IAChC,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAA;IAC9B,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAA;IAC1B,QAAQ,CAAC,iBAAiB,CAAC,EAAE,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,CAAA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CAAA;IAChC,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAA;IAC7B,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAA;CAC7B,GAAG,mBAAmB,CAAA;AAEvB,MAAM,MAAM,0BAA0B,GAAG;IACvC,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IAC1B,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB,GAAG,cAAc,CAAC,iBAAiB,CAAC,CAAA;AAErC,MAAM,MAAM,iBAAiB,GAAG,CAAC,IAAI,EAAE,qBAAqB,KAAK;IAC/D,KAAK,CAAC,EAAE,CAAC,mBAAmB,CAAC;IAC7B,KAAK,CAAC,EAAE,CAAC,IAAI,CAAC,0BAA0B,EAAE,WAAW,CAAC,CAAC;IACvD;QACE,UAAU,EAAE,MAAM,IAAI,CAAA;QACtB,WAAW,EAAE,OAAO,CAAA;QACpB,UAAU,EAAE,MAAM,CAAA;QAClB,SAAS,EAAE,MAAM,CAAA;QACjB,SAAS,EAAE,MAAM,IAAI,CAAA;QACrB,WAAW,EAAE,MAAM,IAAI,CAAA;KACxB;CACF,CAAA;AAGD,MAAM,MAAM,oBAAoB,GAAG,mBAAmB,CAAA;AACtD,MAAM,MAAM,4BAA4B,GAAG,2BAA2B,CAAA;AACtE,MAAM,MAAM,2BAA2B,GAAG,0BAA0B,CAAA;AAGpE,YAAY,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","names":[],"sources":["../../../../src/elements/Hierarchy/Modal/types.ts"],"sourcesContent":["import type { Where } from 'payload'\nimport type React from 'react'\nimport type { HTMLAttributes } from 'react'\n\nexport type SelectionWithPath = {\n id: number | string\n path: Array<{ id: number | string; title: string }>\n}\n\nexport type UseHierarchyModalArgs = {\n /** IDs that should be disabled (e.g., items being moved can't be selected as destination) */\n disabledIds?: Set<number | string>\n /**\n * When provided, filters hierarchy items to only show those that accept these collections.\n * Used with collectionSpecific hierarchy config.\n */\n filterByCollection?: string[]\n hierarchyCollectionSlug: string\n Icon?: React.ReactNode\n}\n\nexport type HierarchyModalProps = {\n readonly confirmLabel?: string\n readonly hasMany?: boolean\n readonly initialSelections?: (number | string)[]\n readonly onMoveToRoot?: () => void\n readonly onSave: (params: {\n closeModal: () => void\n selections: Map<number | string, SelectionWithPath>\n }) => void\n readonly showMoveToRoot?: boolean\n readonly title?: string\n}\n\nexport type HierarchyModalInternalProps = {\n /** Base filter constraint (e.g., tenant filter) to apply to all queries */\n readonly baseFilter?: null | Where\n readonly closeModal: () => void\n /** IDs that should be disabled (e.g., items being moved can't be selected as destination) */\n readonly disabledIds?: Set<number | string>\n /**\n * When provided, filters hierarchy items to only show those that accept these collections.\n * Used with collectionSpecific hierarchy config.\n */\n readonly filterByCollection?: string[]\n readonly hierarchyCollectionSlug: string\n readonly Icon?: React.ReactNode\n readonly modalSlug: string\n readonly parentFieldName: string\n readonly reopenCount?: number\n readonly useAsTitle?: string\n} & HierarchyModalProps\n\nexport type HierarchyModalTogglerProps = {\n children?: React.ReactNode\n className?: string\n disabled?: boolean\n modalSlug?: string\n} & HTMLAttributes<HTMLButtonElement>\n\nexport type UseHierarchyModal = (args: UseHierarchyModalArgs) => [\n React.FC<HierarchyModalProps>,\n React.FC<Omit<HierarchyModalTogglerProps, 'modalSlug'>>,\n {\n closeModal: () => void\n isModalOpen: boolean\n modalDepth: number\n modalSlug: string\n openModal: () => void\n toggleModal: () => void\n },\n]\n\n// Backward-compatible aliases\nexport type HierarchyDrawerProps = HierarchyModalProps\nexport type HierarchyDrawerInternalProps = HierarchyModalInternalProps\nexport type HierarchyDrawerTogglerProps = HierarchyModalTogglerProps\n\n// Re-export column browser types for backwards compatibility\nexport type { ColumnItemData } from '../ColumnBrowser/types.js'\n"],"mappings":"AA8EA;AACA","ignoreList":[]}
1
+ {"version":3,"file":"types.js","names":[],"sources":["../../../../src/elements/Hierarchy/Modal/types.ts"],"sourcesContent":["import type { Where } from 'payload'\nimport type React from 'react'\nimport type { HTMLAttributes } from 'react'\n\nexport type SelectionWithPath = {\n id: number | string\n path: Array<{ id: number | string; title: string }>\n}\n\nexport type UseHierarchyModalArgs = {\n /** IDs that should be disabled (e.g., items being moved can't be selected as destination) */\n disabledIds?: Set<number | string>\n /**\n * When provided, filters hierarchy items to only show those that accept these collections.\n * Used with collectionSpecific hierarchy config.\n */\n filterByCollection?: string[]\n hierarchyCollectionSlug: string\n Icon?: React.ReactNode\n}\n\nexport type HierarchyModalProps = {\n readonly confirmLabel?: string\n readonly hasMany?: boolean\n readonly initialSelections?: (number | string)[]\n /** Disables the confirm and move to root actions while a save is running */\n readonly isBusy?: boolean\n readonly onMoveToRoot?: () => void\n readonly onSave: (params: {\n closeModal: () => void\n selections: Map<number | string, SelectionWithPath>\n }) => void\n readonly showMoveToRoot?: boolean\n readonly title?: string\n}\n\nexport type HierarchyModalInternalProps = {\n /** Base filter constraint (e.g., tenant filter) to apply to all queries */\n readonly baseFilter?: null | Where\n readonly closeModal: () => void\n /** IDs that should be disabled (e.g., items being moved can't be selected as destination) */\n readonly disabledIds?: Set<number | string>\n /**\n * When provided, filters hierarchy items to only show those that accept these collections.\n * Used with collectionSpecific hierarchy config.\n */\n readonly filterByCollection?: string[]\n readonly hierarchyCollectionSlug: string\n readonly Icon?: React.ReactNode\n readonly modalSlug: string\n readonly parentFieldName: string\n readonly reopenCount?: number\n readonly useAsTitle?: string\n} & HierarchyModalProps\n\nexport type HierarchyModalTogglerProps = {\n children?: React.ReactNode\n className?: string\n disabled?: boolean\n modalSlug?: string\n} & HTMLAttributes<HTMLButtonElement>\n\nexport type UseHierarchyModal = (args: UseHierarchyModalArgs) => [\n React.FC<HierarchyModalProps>,\n React.FC<Omit<HierarchyModalTogglerProps, 'modalSlug'>>,\n {\n closeModal: () => void\n isModalOpen: boolean\n modalDepth: number\n modalSlug: string\n openModal: () => void\n toggleModal: () => void\n },\n]\n\n// Backward-compatible aliases\nexport type HierarchyDrawerProps = HierarchyModalProps\nexport type HierarchyDrawerInternalProps = HierarchyModalInternalProps\nexport type HierarchyDrawerTogglerProps = HierarchyModalTogglerProps\n\n// Re-export column browser types for backwards compatibility\nexport type { ColumnItemData } from '../ColumnBrowser/types.js'\n"],"mappings":"AAgFA;AACA","ignoreList":[]}
@@ -7,8 +7,6 @@ type MoveManyProps = {
7
7
  hierarchySlug: string;
8
8
  /** Icon to display in the hierarchy modal */
9
9
  Icon?: React.ReactNode;
10
- /** When multiple MoveMany components are rendered on the page, this will differentiate them */
11
- modalPrefix?: string;
12
10
  /** Callback after successful move */
13
11
  onSuccess?: () => void;
14
12
  /** Collection slugs required by the selected documents at the destination. */
@@ -18,6 +16,6 @@ type MoveManyProps = {
18
16
  ids: (number | string)[];
19
17
  }>;
20
18
  };
21
- export declare function MoveMany({ currentParentID, hierarchySlug, Icon, modalPrefix, onSuccess, requiredCollections: requiredCollectionsProp, selections, }: MoveManyProps): React.JSX.Element;
19
+ export declare function MoveMany({ currentParentID, hierarchySlug, Icon, onSuccess, requiredCollections: requiredCollectionsProp, selections, }: MoveManyProps): React.JSX.Element;
22
20
  export {};
23
21
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/elements/Hierarchy/MoveMany/index.tsx"],"names":[],"mappings":"AAOA,OAAO,KAAyC,MAAM,OAAO,CAAA;AAmB7D,eAAO,MAAM,SAAS,cAAc,CAAA;AAEpC,KAAK,aAAa,GAAG;IACnB,oEAAoE;IACpE,eAAe,CAAC,EAAE,IAAI,GAAG,MAAM,GAAG,MAAM,CAAA;IACxC,sDAAsD;IACtD,aAAa,EAAE,MAAM,CAAA;IACrB,6CAA6C;IAC7C,IAAI,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IACtB,+FAA+F;IAC/F,WAAW,CAAC,EAAE,MAAM,CAAA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