@payloadcms/ui 4.0.0-internal.af6aad0 → 4.0.0-internal.b8e7c89

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 (510) hide show
  1. package/dist/elements/AddNewRelation/index.css +4 -0
  2. package/dist/elements/AddNewRelation/index.js +2 -2
  3. package/dist/elements/AddNewRelation/index.js.map +1 -1
  4. package/dist/elements/AppHeader/index.css +0 -4
  5. package/dist/elements/AppHeader/index.d.ts +8 -1
  6. package/dist/elements/AppHeader/index.d.ts.map +1 -1
  7. package/dist/elements/AppHeader/index.js +14 -5
  8. package/dist/elements/AppHeader/index.js.map +1 -1
  9. package/dist/elements/Autosave/index.d.ts.map +1 -1
  10. package/dist/elements/Autosave/index.js +2 -3
  11. package/dist/elements/Autosave/index.js.map +1 -1
  12. package/dist/elements/BulkUpload/FormsManager/index.d.ts.map +1 -1
  13. package/dist/elements/BulkUpload/FormsManager/index.js +2 -3
  14. package/dist/elements/BulkUpload/FormsManager/index.js.map +1 -1
  15. package/dist/elements/Button/index.css +0 -23
  16. package/dist/elements/Button/types.d.ts +1 -1
  17. package/dist/elements/Button/types.d.ts.map +1 -1
  18. package/dist/elements/Button/types.js.map +1 -1
  19. package/dist/elements/CopyLocaleData/index.d.ts.map +1 -1
  20. package/dist/elements/CopyLocaleData/index.js +8 -9
  21. package/dist/elements/CopyLocaleData/index.js.map +1 -1
  22. package/dist/elements/DefaultListViewTabs/index.css +0 -1
  23. package/dist/elements/DefaultListViewTabs/index.d.ts.map +1 -1
  24. package/dist/elements/DefaultListViewTabs/index.js +62 -84
  25. package/dist/elements/DefaultListViewTabs/index.js.map +1 -1
  26. package/dist/elements/DeleteMany/index.d.ts.map +1 -1
  27. package/dist/elements/DeleteMany/index.js +2 -3
  28. package/dist/elements/DeleteMany/index.js.map +1 -1
  29. package/dist/elements/DocumentDrawer/types.d.ts +1 -1
  30. package/dist/elements/DocumentDrawer/types.d.ts.map +1 -1
  31. package/dist/elements/DocumentDrawer/types.js.map +1 -1
  32. package/dist/elements/Drawer/types.d.ts +2 -2
  33. package/dist/elements/Drawer/types.d.ts.map +1 -1
  34. package/dist/elements/Drawer/types.js.map +1 -1
  35. package/dist/elements/DuplicateDocument/index.d.ts.map +1 -1
  36. package/dist/elements/DuplicateDocument/index.js +2 -3
  37. package/dist/elements/DuplicateDocument/index.js.map +1 -1
  38. package/dist/elements/EditMany/DrawerContent.d.ts.map +1 -1
  39. package/dist/elements/EditMany/DrawerContent.js +2 -3
  40. package/dist/elements/EditMany/DrawerContent.js.map +1 -1
  41. package/dist/elements/Hierarchy/ColumnBrowser/Column/index.css +4 -22
  42. package/dist/elements/Hierarchy/ColumnBrowser/Column/index.d.ts.map +1 -1
  43. package/dist/elements/Hierarchy/ColumnBrowser/Column/index.js +49 -68
  44. package/dist/elements/Hierarchy/ColumnBrowser/Column/index.js.map +1 -1
  45. package/dist/elements/Hierarchy/ColumnBrowser/ColumnItem/index.css +15 -100
  46. package/dist/elements/Hierarchy/ColumnBrowser/ColumnItem/index.d.ts.map +1 -1
  47. package/dist/elements/Hierarchy/ColumnBrowser/ColumnItem/index.js +137 -97
  48. package/dist/elements/Hierarchy/ColumnBrowser/ColumnItem/index.js.map +1 -1
  49. package/dist/elements/Hierarchy/ColumnBrowser/index.d.ts +1 -1
  50. package/dist/elements/Hierarchy/ColumnBrowser/index.d.ts.map +1 -1
  51. package/dist/elements/Hierarchy/ColumnBrowser/index.js +23 -51
  52. package/dist/elements/Hierarchy/ColumnBrowser/index.js.map +1 -1
  53. package/dist/elements/Hierarchy/ColumnBrowser/types.d.ts +3 -26
  54. package/dist/elements/Hierarchy/ColumnBrowser/types.d.ts.map +1 -1
  55. package/dist/elements/Hierarchy/ColumnBrowser/types.js.map +1 -1
  56. package/dist/elements/Hierarchy/DocHeaderButton/index.d.ts.map +1 -1
  57. package/dist/elements/Hierarchy/DocHeaderButton/index.js +1 -6
  58. package/dist/elements/Hierarchy/DocHeaderButton/index.js.map +1 -1
  59. package/dist/elements/Hierarchy/DocHeaderButton/index.server.js +3 -1
  60. package/dist/elements/Hierarchy/DocHeaderButton/index.server.js.map +1 -1
  61. package/dist/elements/Hierarchy/Field/SelectedHierarchies.css +36 -0
  62. package/dist/elements/Hierarchy/Field/SelectedHierarchies.d.ts +13 -0
  63. package/dist/elements/Hierarchy/Field/SelectedHierarchies.d.ts.map +1 -0
  64. package/dist/elements/Hierarchy/Field/SelectedHierarchies.js +141 -0
  65. package/dist/elements/Hierarchy/Field/SelectedHierarchies.js.map +1 -0
  66. package/dist/elements/Hierarchy/Field/index.client.d.ts +0 -5
  67. package/dist/elements/Hierarchy/Field/index.client.d.ts.map +1 -1
  68. package/dist/elements/Hierarchy/Field/index.client.js +95 -120
  69. package/dist/elements/Hierarchy/Field/index.client.js.map +1 -1
  70. package/dist/elements/Hierarchy/Field/index.css +34 -3
  71. package/dist/elements/Hierarchy/Modal/fetchAncestorPath.d.ts +4 -18
  72. package/dist/elements/Hierarchy/Modal/fetchAncestorPath.d.ts.map +1 -1
  73. package/dist/elements/Hierarchy/Modal/fetchAncestorPath.js +24 -88
  74. package/dist/elements/Hierarchy/Modal/fetchAncestorPath.js.map +1 -1
  75. package/dist/elements/Hierarchy/Modal/index.css +53 -4
  76. package/dist/elements/Hierarchy/Modal/index.d.ts +2 -5
  77. package/dist/elements/Hierarchy/Modal/index.d.ts.map +1 -1
  78. package/dist/elements/Hierarchy/Modal/index.js +99 -136
  79. package/dist/elements/Hierarchy/Modal/index.js.map +1 -1
  80. package/dist/elements/Hierarchy/Modal/types.d.ts +0 -15
  81. package/dist/elements/Hierarchy/Modal/types.d.ts.map +1 -1
  82. package/dist/elements/Hierarchy/Modal/types.js.map +1 -1
  83. package/dist/elements/Hierarchy/MoveMany/index.d.ts +3 -7
  84. package/dist/elements/Hierarchy/MoveMany/index.d.ts.map +1 -1
  85. package/dist/elements/Hierarchy/MoveMany/index.js +171 -45
  86. package/dist/elements/Hierarchy/MoveMany/index.js.map +1 -1
  87. package/dist/elements/Hierarchy/Search/index.css +9 -2
  88. package/dist/elements/Hierarchy/Search/index.d.ts.map +1 -1
  89. package/dist/elements/Hierarchy/Search/index.js +73 -6
  90. package/dist/elements/Hierarchy/Search/index.js.map +1 -1
  91. package/dist/elements/Hierarchy/Search/types.d.ts +6 -2
  92. package/dist/elements/Hierarchy/Search/types.d.ts.map +1 -1
  93. package/dist/elements/Hierarchy/Search/types.js.map +1 -1
  94. package/dist/elements/Hierarchy/Search/useHierarchySearch.d.ts.map +1 -1
  95. package/dist/elements/Hierarchy/Search/useHierarchySearch.js +2 -3
  96. package/dist/elements/Hierarchy/Search/useHierarchySearch.js.map +1 -1
  97. package/dist/elements/Hierarchy/Tree/HierarchySidebarTab.d.ts +4 -0
  98. package/dist/elements/Hierarchy/Tree/HierarchySidebarTab.d.ts.map +1 -1
  99. package/dist/elements/Hierarchy/Tree/HierarchySidebarTab.js +186 -101
  100. package/dist/elements/Hierarchy/Tree/HierarchySidebarTab.js.map +1 -1
  101. package/dist/elements/Hierarchy/Tree/HierarchySidebarTab.server.d.ts.map +1 -1
  102. package/dist/elements/Hierarchy/Tree/HierarchySidebarTab.server.js +21 -1
  103. package/dist/elements/Hierarchy/Tree/HierarchySidebarTab.server.js.map +1 -1
  104. package/dist/elements/Hierarchy/Tree/LoadMore/index.css +3 -3
  105. package/dist/elements/Hierarchy/Tree/TreeNode/index.css +29 -59
  106. package/dist/elements/Hierarchy/Tree/TreeNode/index.d.ts +1 -1
  107. package/dist/elements/Hierarchy/Tree/TreeNode/index.d.ts.map +1 -1
  108. package/dist/elements/Hierarchy/Tree/TreeNode/index.js +10 -54
  109. package/dist/elements/Hierarchy/Tree/TreeNode/index.js.map +1 -1
  110. package/dist/elements/Hierarchy/Tree/index.css +9 -8
  111. package/dist/elements/Hierarchy/Tree/index.d.ts.map +1 -1
  112. package/dist/elements/Hierarchy/Tree/index.js +47 -29
  113. package/dist/elements/Hierarchy/Tree/index.js.map +1 -1
  114. package/dist/elements/Hierarchy/Tree/types.d.ts +1 -9
  115. package/dist/elements/Hierarchy/Tree/types.d.ts.map +1 -1
  116. package/dist/elements/Hierarchy/Tree/types.js.map +1 -1
  117. package/dist/elements/Hierarchy/Tree/useChildren.d.ts.map +1 -1
  118. package/dist/elements/Hierarchy/Tree/useChildren.js +1 -11
  119. package/dist/elements/Hierarchy/Tree/useChildren.js.map +1 -1
  120. package/dist/elements/ListControls/index.d.ts.map +1 -1
  121. package/dist/elements/ListControls/index.js +2 -3
  122. package/dist/elements/ListControls/index.js.map +1 -1
  123. package/dist/elements/ListControls/types.d.ts +0 -4
  124. package/dist/elements/ListControls/types.d.ts.map +1 -1
  125. package/dist/elements/ListControls/types.js.map +1 -1
  126. package/dist/elements/ListHeader/TitleActions/ListEmptyTrashButton.d.ts.map +1 -1
  127. package/dist/elements/ListHeader/TitleActions/ListEmptyTrashButton.js +2 -3
  128. package/dist/elements/ListHeader/TitleActions/ListEmptyTrashButton.js.map +1 -1
  129. package/dist/elements/LivePreview/Window/index.js +1 -1
  130. package/dist/elements/LivePreview/Window/index.js.map +1 -1
  131. package/dist/elements/Localizer/index.js +1 -1
  132. package/dist/elements/Localizer/index.js.map +1 -1
  133. package/dist/elements/Nav/NavSidebarToggle/index.js +1 -1
  134. package/dist/elements/Nav/NavSidebarToggle/index.js.map +1 -1
  135. package/dist/elements/Nav/NavWrapper/index.d.ts +0 -1
  136. package/dist/elements/Nav/NavWrapper/index.d.ts.map +1 -1
  137. package/dist/elements/Nav/NavWrapper/index.js +18 -12
  138. package/dist/elements/Nav/NavWrapper/index.js.map +1 -1
  139. package/dist/elements/Nav/SidebarTabs/index.css +2 -1
  140. package/dist/elements/Nav/context.d.ts +1 -0
  141. package/dist/elements/Nav/context.d.ts.map +1 -1
  142. package/dist/elements/Nav/context.js +67 -92
  143. package/dist/elements/Nav/context.js.map +1 -1
  144. package/dist/elements/Nav/index.css +42 -47
  145. package/dist/elements/Nav/index.d.ts +0 -4
  146. package/dist/elements/Nav/index.d.ts.map +1 -1
  147. package/dist/elements/Nav/index.js +1 -16
  148. package/dist/elements/Nav/index.js.map +1 -1
  149. package/dist/elements/NavGroup/index.css +15 -29
  150. package/dist/elements/Popup/PopupButtonList/index.css +16 -32
  151. package/dist/elements/Popup/index.css +0 -6
  152. package/dist/elements/Popup/index.d.ts +0 -10
  153. package/dist/elements/Popup/index.d.ts.map +1 -1
  154. package/dist/elements/Popup/index.js +5 -12
  155. package/dist/elements/Popup/index.js.map +1 -1
  156. package/dist/elements/PublishButton/ScheduleDrawer/index.d.ts.map +1 -1
  157. package/dist/elements/PublishButton/ScheduleDrawer/index.js +8 -30
  158. package/dist/elements/PublishButton/ScheduleDrawer/index.js.map +1 -1
  159. package/dist/elements/PublishButton/ScheduleDrawer/types.d.ts +1 -1
  160. package/dist/elements/PublishButton/ScheduleDrawer/types.d.ts.map +1 -1
  161. package/dist/elements/PublishButton/ScheduleDrawer/types.js.map +1 -1
  162. package/dist/elements/PublishButton/index.d.ts.map +1 -1
  163. package/dist/elements/PublishButton/index.js +5 -6
  164. package/dist/elements/PublishButton/index.js.map +1 -1
  165. package/dist/elements/PublishMany/DrawerContent.d.ts.map +1 -1
  166. package/dist/elements/PublishMany/DrawerContent.js +2 -3
  167. package/dist/elements/PublishMany/DrawerContent.js.map +1 -1
  168. package/dist/elements/ReactSelect/types.d.ts +0 -5
  169. package/dist/elements/ReactSelect/types.d.ts.map +1 -1
  170. package/dist/elements/ReactSelect/types.js.map +1 -1
  171. package/dist/elements/RestoreMany/index.d.ts.map +1 -1
  172. package/dist/elements/RestoreMany/index.js +2 -3
  173. package/dist/elements/RestoreMany/index.js.map +1 -1
  174. package/dist/elements/SaveDraftButton/index.d.ts.map +1 -1
  175. package/dist/elements/SaveDraftButton/index.js +2 -3
  176. package/dist/elements/SaveDraftButton/index.js.map +1 -1
  177. package/dist/elements/SelectAll/index.d.ts.map +1 -1
  178. package/dist/elements/SelectAll/index.js +2 -1
  179. package/dist/elements/SelectAll/index.js.map +1 -1
  180. package/dist/elements/SelectRow/index.d.ts.map +1 -1
  181. package/dist/elements/SelectRow/index.js +2 -1
  182. package/dist/elements/SelectRow/index.js.map +1 -1
  183. package/dist/elements/SidebarRow/index.css +5 -1
  184. package/dist/elements/SidebarToggle/index.css +1 -3
  185. package/dist/elements/Status/index.d.ts.map +1 -1
  186. package/dist/elements/Status/index.js +2 -3
  187. package/dist/elements/Status/index.js.map +1 -1
  188. package/dist/elements/StepNav/index.d.ts.map +1 -1
  189. package/dist/elements/StepNav/index.js +10 -14
  190. package/dist/elements/StepNav/index.js.map +1 -1
  191. package/dist/elements/StepNav/types.d.ts +0 -6
  192. package/dist/elements/StepNav/types.d.ts.map +1 -1
  193. package/dist/elements/StepNav/types.js.map +1 -1
  194. package/dist/elements/Table/DefaultCell/fields/Hierarchy/index.css +7 -5
  195. package/dist/elements/Table/DefaultCell/fields/Hierarchy/index.d.ts.map +1 -1
  196. package/dist/elements/Table/DefaultCell/fields/Hierarchy/index.js +3 -14
  197. package/dist/elements/Table/DefaultCell/fields/Hierarchy/index.js.map +1 -1
  198. package/dist/elements/Table/OrderableTable.d.ts.map +1 -1
  199. package/dist/elements/Table/OrderableTable.js +2 -3
  200. package/dist/elements/Table/OrderableTable.js.map +1 -1
  201. package/dist/elements/Table/RelationshipProvider/index.d.ts.map +1 -1
  202. package/dist/elements/Table/RelationshipProvider/index.js +2 -3
  203. package/dist/elements/Table/RelationshipProvider/index.js.map +1 -1
  204. package/dist/elements/UnpublishButton/index.d.ts.map +1 -1
  205. package/dist/elements/UnpublishButton/index.js +3 -4
  206. package/dist/elements/UnpublishButton/index.js.map +1 -1
  207. package/dist/elements/UnpublishMany/DrawerContent.d.ts.map +1 -1
  208. package/dist/elements/UnpublishMany/DrawerContent.js +2 -3
  209. package/dist/elements/UnpublishMany/DrawerContent.js.map +1 -1
  210. package/dist/elements/UserMenu/LanguageMenu/index.d.ts.map +1 -1
  211. package/dist/elements/UserMenu/LanguageMenu/index.js +39 -83
  212. package/dist/elements/UserMenu/LanguageMenu/index.js.map +1 -1
  213. package/dist/elements/UserMenu/SettingsMenu/index.d.ts.map +1 -1
  214. package/dist/elements/UserMenu/SettingsMenu/index.js +21 -57
  215. package/dist/elements/UserMenu/SettingsMenu/index.js.map +1 -1
  216. package/dist/elements/UserMenu/ThemeMenu/index.d.ts.map +1 -1
  217. package/dist/elements/UserMenu/ThemeMenu/index.js +39 -83
  218. package/dist/elements/UserMenu/ThemeMenu/index.js.map +1 -1
  219. package/dist/elements/UserMenu/index.css +2 -32
  220. package/dist/elements/UserMenu/index.d.ts +0 -1
  221. package/dist/elements/UserMenu/index.d.ts.map +1 -1
  222. package/dist/elements/UserMenu/index.js +51 -77
  223. package/dist/elements/UserMenu/index.js.map +1 -1
  224. package/dist/elements/WhereBuilder/Condition/Relationship/index.js +1 -1
  225. package/dist/elements/WhereBuilder/Condition/Relationship/index.js.map +1 -1
  226. package/dist/exports/client/index.d.ts +0 -4
  227. package/dist/exports/client/index.d.ts.map +1 -1
  228. package/dist/exports/client/index.js +1 -1
  229. package/dist/exports/client/index.js.map +3 -3
  230. package/dist/fields/Array/index.d.ts.map +1 -1
  231. package/dist/fields/Array/index.js +2 -3
  232. package/dist/fields/Array/index.js.map +1 -1
  233. package/dist/fields/Blocks/index.d.ts.map +1 -1
  234. package/dist/fields/Blocks/index.js +2 -3
  235. package/dist/fields/Blocks/index.js.map +1 -1
  236. package/dist/fields/Checkbox/Input.d.ts +2 -2
  237. package/dist/fields/Checkbox/Input.d.ts.map +1 -1
  238. package/dist/fields/Checkbox/Input.js +152 -134
  239. package/dist/fields/Checkbox/Input.js.map +1 -1
  240. package/dist/fields/Checkbox/index.css +155 -168
  241. package/dist/fields/FieldLabel/index.d.ts.map +1 -1
  242. package/dist/fields/FieldLabel/index.js +4 -5
  243. package/dist/fields/FieldLabel/index.js.map +1 -1
  244. package/dist/fields/Relationship/Input.d.ts.map +1 -1
  245. package/dist/fields/Relationship/Input.js +8 -27
  246. package/dist/fields/Relationship/Input.js.map +1 -1
  247. package/dist/fields/Relationship/optionsReducer.d.ts.map +1 -1
  248. package/dist/fields/Relationship/optionsReducer.js +0 -2
  249. package/dist/fields/Relationship/optionsReducer.js.map +1 -1
  250. package/dist/fields/Relationship/types.d.ts +0 -24
  251. package/dist/fields/Relationship/types.d.ts.map +1 -1
  252. package/dist/fields/Relationship/types.js.map +1 -1
  253. package/dist/fields/Slug/index.d.ts.map +1 -1
  254. package/dist/fields/Slug/index.js +2 -3
  255. package/dist/fields/Slug/index.js.map +1 -1
  256. package/dist/fields/Upload/Input.d.ts.map +1 -1
  257. package/dist/fields/Upload/Input.js +2 -3
  258. package/dist/fields/Upload/Input.js.map +1 -1
  259. package/dist/fields/Upload/Input.spec.js +2 -1
  260. package/dist/fields/Upload/Input.spec.js.map +1 -1
  261. package/dist/fields/shared/index.d.ts +1 -1
  262. package/dist/fields/shared/index.d.ts.map +1 -1
  263. package/dist/fields/shared/index.js.map +1 -1
  264. package/dist/forms/Form/index.d.ts.map +1 -1
  265. package/dist/forms/Form/index.js +2 -3
  266. package/dist/forms/Form/index.js.map +1 -1
  267. package/dist/forms/NullifyField/index.d.ts.map +1 -1
  268. package/dist/forms/NullifyField/index.js +2 -3
  269. package/dist/forms/NullifyField/index.js.map +1 -1
  270. package/dist/hooks/usePayloadAPI.d.ts.map +1 -1
  271. package/dist/hooks/usePayloadAPI.js +2 -3
  272. package/dist/hooks/usePayloadAPI.js.map +1 -1
  273. package/dist/providers/DocumentInfo/index.d.ts.map +1 -1
  274. package/dist/providers/DocumentInfo/index.js +2 -3
  275. package/dist/providers/DocumentInfo/index.js.map +1 -1
  276. package/dist/providers/Hierarchy/index.d.ts.map +1 -1
  277. package/dist/providers/Hierarchy/index.js +24 -53
  278. package/dist/providers/Hierarchy/index.js.map +1 -1
  279. package/dist/providers/Hierarchy/types.d.ts +0 -2
  280. package/dist/providers/Hierarchy/types.d.ts.map +1 -1
  281. package/dist/providers/Hierarchy/types.js.map +1 -1
  282. package/dist/providers/LivePreview/index.d.ts.map +1 -1
  283. package/dist/providers/LivePreview/index.js +13 -6
  284. package/dist/providers/LivePreview/index.js.map +1 -1
  285. package/dist/providers/Locale/index.d.ts +1 -5
  286. package/dist/providers/Locale/index.d.ts.map +1 -1
  287. package/dist/providers/Locale/index.js +61 -139
  288. package/dist/providers/Locale/index.js.map +1 -1
  289. package/dist/providers/Selection/index.d.ts.map +1 -1
  290. package/dist/providers/Selection/index.js +2 -3
  291. package/dist/providers/Selection/index.js.map +1 -1
  292. package/dist/providers/ServerFunctions/index.d.ts +5 -1
  293. package/dist/providers/ServerFunctions/index.d.ts.map +1 -1
  294. package/dist/providers/ServerFunctions/index.js +15 -0
  295. package/dist/providers/ServerFunctions/index.js.map +1 -1
  296. package/dist/providers/TableColumns/buildColumnState/index.d.ts.map +1 -1
  297. package/dist/providers/TableColumns/buildColumnState/index.js +0 -1
  298. package/dist/providers/TableColumns/buildColumnState/index.js.map +1 -1
  299. package/dist/styles.css +1 -1
  300. package/dist/templates/Default/Wrapper/index.css +1 -2
  301. package/dist/templates/Default/Wrapper/index.d.ts +0 -2
  302. package/dist/templates/Default/Wrapper/index.d.ts.map +1 -1
  303. package/dist/templates/Default/Wrapper/index.js +6 -12
  304. package/dist/templates/Default/Wrapper/index.js.map +1 -1
  305. package/dist/templates/Default/index.css +1 -3
  306. package/dist/templates/Default/index.d.ts.map +1 -1
  307. package/dist/templates/Default/index.js +15 -17
  308. package/dist/templates/Default/index.js.map +1 -1
  309. package/dist/utilities/formatAbsoluteURL.d.ts +1 -1
  310. package/dist/utilities/formatAbsoluteURL.d.ts.map +1 -1
  311. package/dist/utilities/formatAbsoluteURL.js +18 -8
  312. package/dist/utilities/formatAbsoluteURL.js.map +1 -1
  313. package/dist/utilities/formatAbsoluteURL.spec.js +27 -0
  314. package/dist/utilities/formatAbsoluteURL.spec.js.map +1 -0
  315. package/dist/utilities/getHasScheduledPublish.d.ts +2 -3
  316. package/dist/utilities/getHasScheduledPublish.d.ts.map +1 -1
  317. package/dist/utilities/getHasScheduledPublish.js +2 -5
  318. package/dist/utilities/getHasScheduledPublish.js.map +1 -1
  319. package/dist/utilities/isAbsoluteURL.d.ts +3 -0
  320. package/dist/utilities/isAbsoluteURL.d.ts.map +1 -0
  321. package/dist/utilities/isAbsoluteURL.js +15 -0
  322. package/dist/utilities/isAbsoluteURL.js.map +1 -0
  323. package/dist/utilities/isAbsoluteURL.spec.js +11 -0
  324. package/dist/utilities/isAbsoluteURL.spec.js.map +1 -0
  325. package/dist/utilities/isHttpURL.d.ts +3 -0
  326. package/dist/utilities/isHttpURL.d.ts.map +1 -0
  327. package/dist/utilities/isHttpURL.js +12 -0
  328. package/dist/utilities/isHttpURL.js.map +1 -0
  329. package/dist/utilities/isHttpURL.spec.js +25 -0
  330. package/dist/utilities/isHttpURL.spec.js.map +1 -0
  331. package/dist/utilities/schedulePublishHandler.d.ts +8 -1
  332. package/dist/utilities/schedulePublishHandler.d.ts.map +1 -1
  333. package/dist/utilities/schedulePublishHandler.js +68 -4
  334. package/dist/utilities/schedulePublishHandler.js.map +1 -1
  335. package/dist/utilities/serverFunctionRegistry.d.ts.map +1 -1
  336. package/dist/utilities/serverFunctionRegistry.js +2 -1
  337. package/dist/utilities/serverFunctionRegistry.js.map +1 -1
  338. package/dist/utilities/slugify.d.ts.map +1 -1
  339. package/dist/utilities/slugify.js +2 -0
  340. package/dist/utilities/slugify.js.map +1 -1
  341. package/dist/views/API/index.client.d.ts.map +1 -1
  342. package/dist/views/API/index.client.js +2 -3
  343. package/dist/views/API/index.client.js.map +1 -1
  344. package/dist/views/Document/index.d.ts.map +1 -1
  345. package/dist/views/Document/index.js +1 -2
  346. package/dist/views/Document/index.js.map +1 -1
  347. package/dist/views/HierarchyList/DocumentListSelection/index.d.ts.map +1 -1
  348. package/dist/views/HierarchyList/DocumentListSelection/index.js +105 -100
  349. package/dist/views/HierarchyList/DocumentListSelection/index.js.map +1 -1
  350. package/dist/views/HierarchyList/HierarchyListHeader/index.d.ts +1 -6
  351. package/dist/views/HierarchyList/HierarchyListHeader/index.d.ts.map +1 -1
  352. package/dist/views/HierarchyList/HierarchyListHeader/index.js +8 -10
  353. package/dist/views/HierarchyList/HierarchyListHeader/index.js.map +1 -1
  354. package/dist/views/HierarchyList/HierarchyTable/ChildNameCell.d.ts.map +1 -1
  355. package/dist/views/HierarchyList/HierarchyTable/ChildNameCell.js +10 -11
  356. package/dist/views/HierarchyList/HierarchyTable/ChildNameCell.js.map +1 -1
  357. package/dist/views/HierarchyList/HierarchyTable/SlotTable.d.ts.map +1 -1
  358. package/dist/views/HierarchyList/HierarchyTable/SlotTable.js +6 -3
  359. package/dist/views/HierarchyList/HierarchyTable/SlotTable.js.map +1 -1
  360. package/dist/views/HierarchyList/HierarchyTable/index.css +0 -51
  361. package/dist/views/HierarchyList/HierarchyTable/index.d.ts +1 -13
  362. package/dist/views/HierarchyList/HierarchyTable/index.d.ts.map +1 -1
  363. package/dist/views/HierarchyList/HierarchyTable/index.js +38 -156
  364. package/dist/views/HierarchyList/HierarchyTable/index.js.map +1 -1
  365. package/dist/views/HierarchyList/HierarchyTable/types.d.ts +0 -6
  366. package/dist/views/HierarchyList/HierarchyTable/types.d.ts.map +1 -1
  367. package/dist/views/HierarchyList/HierarchyTable/types.js.map +1 -1
  368. package/dist/views/HierarchyList/index.d.ts.map +1 -1
  369. package/dist/views/HierarchyList/index.js +20 -103
  370. package/dist/views/HierarchyList/index.js.map +1 -1
  371. package/dist/views/List/ListSelection/index.d.ts.map +1 -1
  372. package/dist/views/List/ListSelection/index.js +122 -138
  373. package/dist/views/List/ListSelection/index.js.map +1 -1
  374. package/dist/views/List/handleHierarchy.d.ts +1 -6
  375. package/dist/views/List/handleHierarchy.d.ts.map +1 -1
  376. package/dist/views/List/handleHierarchy.js +3 -34
  377. package/dist/views/List/handleHierarchy.js.map +1 -1
  378. package/dist/views/List/index.client.d.ts.map +1 -1
  379. package/dist/views/List/index.client.js +5 -129
  380. package/dist/views/List/index.client.js.map +1 -1
  381. package/dist/views/List/index.d.ts.map +1 -1
  382. package/dist/views/List/index.js +16 -27
  383. package/dist/views/List/index.js.map +1 -1
  384. package/dist/views/Root/getRouteData.d.ts.map +1 -1
  385. package/dist/views/Root/getRouteData.js +2 -8
  386. package/dist/views/Root/getRouteData.js.map +1 -1
  387. package/dist/views/Version/Default/SetStepNav.d.ts.map +1 -1
  388. package/dist/views/Version/Default/SetStepNav.js +10 -13
  389. package/dist/views/Version/Default/SetStepNav.js.map +1 -1
  390. package/dist/views/Version/Default/index.d.ts.map +1 -1
  391. package/dist/views/Version/Default/index.js +12 -13
  392. package/dist/views/Version/Default/index.js.map +1 -1
  393. package/dist/views/Version/RenderFieldsToDiff/DiffCollapser/index.d.ts +1 -0
  394. package/dist/views/Version/RenderFieldsToDiff/DiffCollapser/index.d.ts.map +1 -1
  395. package/dist/views/Version/RenderFieldsToDiff/DiffCollapser/index.js +56 -50
  396. package/dist/views/Version/RenderFieldsToDiff/DiffCollapser/index.js.map +1 -1
  397. package/dist/views/Version/RenderFieldsToDiff/buildVersionFields.d.ts.map +1 -1
  398. package/dist/views/Version/RenderFieldsToDiff/buildVersionFields.js +41 -27
  399. package/dist/views/Version/RenderFieldsToDiff/buildVersionFields.js.map +1 -1
  400. package/dist/views/Version/RenderFieldsToDiff/buildVersionFields.spec.js +258 -0
  401. package/dist/views/Version/RenderFieldsToDiff/buildVersionFields.spec.js.map +1 -0
  402. package/dist/views/Version/RenderFieldsToDiff/fields/Iterable/index.d.ts.map +1 -1
  403. package/dist/views/Version/RenderFieldsToDiff/fields/Iterable/index.js +10 -0
  404. package/dist/views/Version/RenderFieldsToDiff/fields/Iterable/index.js.map +1 -1
  405. package/dist/views/Version/RenderFieldsToDiff/utilities/countChangedFields.d.ts.map +1 -1
  406. package/dist/views/Version/RenderFieldsToDiff/utilities/countChangedFields.js +33 -1
  407. package/dist/views/Version/RenderFieldsToDiff/utilities/countChangedFields.js.map +1 -1
  408. package/dist/views/Version/RenderFieldsToDiff/utilities/countChangedFields.spec.js +56 -2
  409. package/dist/views/Version/RenderFieldsToDiff/utilities/countChangedFields.spec.js.map +1 -1
  410. package/dist/views/Version/RenderFieldsToDiff/utilities/getFieldsForRowComparison.d.ts +8 -2
  411. package/dist/views/Version/RenderFieldsToDiff/utilities/getFieldsForRowComparison.d.ts.map +1 -1
  412. package/dist/views/Version/RenderFieldsToDiff/utilities/getFieldsForRowComparison.js +17 -19
  413. package/dist/views/Version/RenderFieldsToDiff/utilities/getFieldsForRowComparison.js.map +1 -1
  414. package/dist/views/Version/RenderFieldsToDiff/utilities/getFieldsForRowComparison.spec.js +3 -13
  415. package/dist/views/Version/RenderFieldsToDiff/utilities/getFieldsForRowComparison.spec.js.map +1 -1
  416. package/dist/views/Versions/VersionPillLabel/VersionPillLabel.d.ts.map +1 -1
  417. package/dist/views/Versions/VersionPillLabel/VersionPillLabel.js +2 -3
  418. package/dist/views/Versions/VersionPillLabel/VersionPillLabel.js.map +1 -1
  419. package/package.json +6 -5
  420. package/dist/elements/Hierarchy/CreateNewButton/index.css +0 -9
  421. package/dist/elements/Hierarchy/CreateNewButton/index.d.ts +0 -9
  422. package/dist/elements/Hierarchy/CreateNewButton/index.d.ts.map +0 -1
  423. package/dist/elements/Hierarchy/CreateNewButton/index.js +0 -111
  424. package/dist/elements/Hierarchy/CreateNewButton/index.js.map +0 -1
  425. package/dist/elements/Hierarchy/Modal/Footer/index.css +0 -45
  426. package/dist/elements/Hierarchy/Modal/Footer/index.d.ts +0 -28
  427. package/dist/elements/Hierarchy/Modal/Footer/index.d.ts.map +0 -1
  428. package/dist/elements/Hierarchy/Modal/Footer/index.js +0 -166
  429. package/dist/elements/Hierarchy/Modal/Footer/index.js.map +0 -1
  430. package/dist/elements/Hierarchy/getFolderHierarchySlug.d.ts +0 -22
  431. package/dist/elements/Hierarchy/getFolderHierarchySlug.d.ts.map +0 -1
  432. package/dist/elements/Hierarchy/getFolderHierarchySlug.js +0 -17
  433. package/dist/elements/Hierarchy/getFolderHierarchySlug.js.map +0 -1
  434. package/dist/elements/Hierarchy/move/moveDocuments.d.ts +0 -34
  435. package/dist/elements/Hierarchy/move/moveDocuments.d.ts.map +0 -1
  436. package/dist/elements/Hierarchy/move/moveDocuments.js +0 -94
  437. package/dist/elements/Hierarchy/move/moveDocuments.js.map +0 -1
  438. package/dist/elements/SegmentedControl/index.css +0 -58
  439. package/dist/elements/SegmentedControl/index.d.ts +0 -19
  440. package/dist/elements/SegmentedControl/index.d.ts.map +0 -1
  441. package/dist/elements/SegmentedControl/index.js +0 -104
  442. package/dist/elements/SegmentedControl/index.js.map +0 -1
  443. package/dist/elements/StepNav/DropTarget/index.css +0 -20
  444. package/dist/elements/StepNav/DropTarget/index.d.ts +0 -16
  445. package/dist/elements/StepNav/DropTarget/index.d.ts.map +0 -1
  446. package/dist/elements/StepNav/DropTarget/index.js +0 -71
  447. package/dist/elements/StepNav/DropTarget/index.js.map +0 -1
  448. package/dist/elements/UserMenu/HoverSubmenuGroup.d.ts +0 -18
  449. package/dist/elements/UserMenu/HoverSubmenuGroup.d.ts.map +0 -1
  450. package/dist/elements/UserMenu/HoverSubmenuGroup.js +0 -38
  451. package/dist/elements/UserMenu/HoverSubmenuGroup.js.map +0 -1
  452. package/dist/elements/UserMenu/useHoverSubmenu.d.ts +0 -21
  453. package/dist/elements/UserMenu/useHoverSubmenu.d.ts.map +0 -1
  454. package/dist/elements/UserMenu/useHoverSubmenu.js +0 -260
  455. package/dist/elements/UserMenu/useHoverSubmenu.js.map +0 -1
  456. package/dist/elements/ViewModeToggle/index.d.ts +0 -8
  457. package/dist/elements/ViewModeToggle/index.d.ts.map +0 -1
  458. package/dist/elements/ViewModeToggle/index.js +0 -29
  459. package/dist/elements/ViewModeToggle/index.js.map +0 -1
  460. package/dist/icons/CollapseLayers/index.css +0 -5
  461. package/dist/icons/CollapseLayers/index.d.ts +0 -7
  462. package/dist/icons/CollapseLayers/index.d.ts.map +0 -1
  463. package/dist/icons/CollapseLayers/index.js +0 -23
  464. package/dist/icons/CollapseLayers/index.js.map +0 -1
  465. package/dist/icons/Table/index.css +0 -5
  466. package/dist/icons/Table/index.d.ts +0 -7
  467. package/dist/icons/Table/index.d.ts.map +0 -1
  468. package/dist/icons/Table/index.js +0 -25
  469. package/dist/icons/Table/index.js.map +0 -1
  470. package/dist/providers/HierarchyDnd/index.css +0 -51
  471. package/dist/providers/HierarchyDnd/index.d.ts +0 -21
  472. package/dist/providers/HierarchyDnd/index.d.ts.map +0 -1
  473. package/dist/providers/HierarchyDnd/index.js +0 -163
  474. package/dist/providers/HierarchyDnd/index.js.map +0 -1
  475. package/dist/providers/HierarchyDnd/types.d.ts +0 -56
  476. package/dist/providers/HierarchyDnd/types.d.ts.map +0 -1
  477. package/dist/providers/HierarchyDnd/types.js +0 -21
  478. package/dist/providers/HierarchyDnd/types.js.map +0 -1
  479. package/dist/views/HierarchyList/HierarchyCards/DocumentCard/index.css +0 -216
  480. package/dist/views/HierarchyList/HierarchyCards/DocumentCard/index.d.ts +0 -20
  481. package/dist/views/HierarchyList/HierarchyCards/DocumentCard/index.d.ts.map +0 -1
  482. package/dist/views/HierarchyList/HierarchyCards/DocumentCard/index.js +0 -182
  483. package/dist/views/HierarchyList/HierarchyCards/DocumentCard/index.js.map +0 -1
  484. package/dist/views/HierarchyList/HierarchyCards/DragPreviewItem/index.css +0 -38
  485. package/dist/views/HierarchyList/HierarchyCards/DragPreviewItem/index.d.ts +0 -15
  486. package/dist/views/HierarchyList/HierarchyCards/DragPreviewItem/index.d.ts.map +0 -1
  487. package/dist/views/HierarchyList/HierarchyCards/DragPreviewItem/index.js +0 -85
  488. package/dist/views/HierarchyList/HierarchyCards/DragPreviewItem/index.js.map +0 -1
  489. package/dist/views/HierarchyList/HierarchyCards/FolderCard/index.css +0 -98
  490. package/dist/views/HierarchyList/HierarchyCards/FolderCard/index.d.ts +0 -27
  491. package/dist/views/HierarchyList/HierarchyCards/FolderCard/index.d.ts.map +0 -1
  492. package/dist/views/HierarchyList/HierarchyCards/FolderCard/index.js +0 -84
  493. package/dist/views/HierarchyList/HierarchyCards/FolderCard/index.js.map +0 -1
  494. package/dist/views/HierarchyList/HierarchyCards/HierarchyCard/index.d.ts +0 -19
  495. package/dist/views/HierarchyList/HierarchyCards/HierarchyCard/index.d.ts.map +0 -1
  496. package/dist/views/HierarchyList/HierarchyCards/HierarchyCard/index.js +0 -100
  497. package/dist/views/HierarchyList/HierarchyCards/HierarchyCard/index.js.map +0 -1
  498. package/dist/views/HierarchyList/HierarchyCards/PlaneItem/index.d.ts +0 -53
  499. package/dist/views/HierarchyList/HierarchyCards/PlaneItem/index.d.ts.map +0 -1
  500. package/dist/views/HierarchyList/HierarchyCards/PlaneItem/index.js +0 -145
  501. package/dist/views/HierarchyList/HierarchyCards/PlaneItem/index.js.map +0 -1
  502. package/dist/views/HierarchyList/HierarchyCards/getThumbnailSrc.d.ts +0 -8
  503. package/dist/views/HierarchyList/HierarchyCards/getThumbnailSrc.d.ts.map +0 -1
  504. package/dist/views/HierarchyList/HierarchyCards/getThumbnailSrc.js +0 -21
  505. package/dist/views/HierarchyList/HierarchyCards/getThumbnailSrc.js.map +0 -1
  506. package/dist/views/HierarchyList/HierarchyCards/index.css +0 -115
  507. package/dist/views/HierarchyList/HierarchyCards/index.d.ts +0 -80
  508. package/dist/views/HierarchyList/HierarchyCards/index.d.ts.map +0 -1
  509. package/dist/views/HierarchyList/HierarchyCards/index.js +0 -457
  510. package/dist/views/HierarchyList/HierarchyCards/index.js.map +0 -1
@@ -4,22 +4,22 @@ 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';
7
8
  import { useConfig } from '../../../providers/Config/index.js';
8
9
  import { useHierarchy } from '../../../providers/Hierarchy/index.js';
9
10
  import { useTranslation } from '../../../providers/Translation/index.js';
11
+ import { Button } from '../../Button/index.js';
10
12
  import { DialogBody, DialogHeader, DialogModal } from '../../Dialog/index.js';
11
13
  import { useDocumentDrawer } from '../../DocumentDrawer/index.js';
12
14
  import { DrawerDepthProvider } from '../../Drawer/index.js';
13
15
  import { HierarchyColumnBrowser } from '../ColumnBrowser/index.js';
14
- import { fetchAncestorPaths } from './fetchAncestorPath.js';
15
- import { HierarchyModalFooter } from './Footer/index.js';
16
+ import { fetchAncestorPath } from './fetchAncestorPath.js';
16
17
  import './index.css';
17
18
  export const baseClass = 'hierarchy-modal';
18
19
  export const HierarchyModalContent = function HierarchyModalContent({
19
20
  baseFilter,
20
21
  closeModal,
21
22
  columnBrowserRef,
22
- confirmLabel,
23
23
  disabledIds,
24
24
  filterByCollection,
25
25
  hasMany = false,
@@ -32,7 +32,6 @@ export const HierarchyModalContent = function HierarchyModalContent({
32
32
  parentFieldName,
33
33
  ref,
34
34
  showMoveToRoot,
35
- title,
36
35
  useAsTitle
37
36
  }) {
38
37
  const {
@@ -54,17 +53,14 @@ export const HierarchyModalContent = function HierarchyModalContent({
54
53
  collectionSlug: hierarchyCollectionSlug
55
54
  });
56
55
  const collectionLabel = collectionConfig ? getTranslation(collectionConfig.labels?.plural || hierarchyCollectionSlug, i18n) : hierarchyCollectionSlug;
57
- const collectionLabelSingular = collectionConfig ? getTranslation(collectionConfig.labels?.singular || hierarchyCollectionSlug, i18n) : hierarchyCollectionSlug;
58
56
  const parentFieldName_internal = collectionConfig?.hierarchy && typeof collectionConfig.hierarchy === 'object' ? collectionConfig.hierarchy.parentFieldName : parentFieldName;
59
57
  const [initialExpandedPath, setInitialExpandedPath] = useState();
60
- const [previousPath, setPreviousPath] = useState();
61
58
  const [isLoadingPath, setIsLoadingPath] = useState(Boolean(initialSelections?.length));
62
59
  const hasLoadedPathRef = React.useRef(false);
60
+ const firstSelection = initialSelections?.[0];
63
61
  const mapSelections = useCallback(ids => {
64
62
  const map = new Map();
65
- // Single-select is a move: the existing value is the origin shown in the footer, not a
66
- // pre-made choice. Multi-select edits a set, so existing values start checked.
67
- if (ids && hasMany) {
63
+ if (ids) {
68
64
  for (const id of ids) {
69
65
  map.set(id, {
70
66
  id,
@@ -73,78 +69,39 @@ export const HierarchyModalContent = function HierarchyModalContent({
73
69
  }
74
70
  }
75
71
  return map;
76
- }, [hasMany]);
77
- const [selections, setSelections] = useState(() => mapSelections(initialSelections));
78
- const loadAncestorPaths = useEffectEvent(async ids_0 => {
79
- const firstId = ids_0?.[0];
80
- if (!firstId) {
72
+ }, []);
73
+ const loadAncestorPath = useEffectEvent(async itemId => {
74
+ if (!itemId) {
81
75
  setIsLoadingPath(false);
82
76
  return;
83
77
  }
84
- // Multi-select marks the ancestors of every checked item as partially selected, so all of
85
- // their paths are needed. Single-select only needs the origin of the move.
86
- const itemIds = hasMany ? ids_0 : [firstId];
87
78
  try {
88
- const paths = await fetchAncestorPaths({
79
+ const path = await fetchAncestorPath({
89
80
  api,
90
81
  collectionSlug: hierarchyCollectionSlug,
91
- itemIds,
82
+ itemId,
92
83
  parentFieldName: parentFieldName_internal,
93
- serverURL,
94
- useAsTitle: useAsTitle || 'id'
84
+ serverURL
95
85
  });
96
- const firstPath = paths.get(firstId);
97
- setInitialExpandedPath(firstPath?.ancestorIds);
98
- setPreviousPath(firstPath?.path);
99
- // Selections seeded from the field's value start without a path - backfill them so their
100
- // ancestors can be marked, and so the footer breadcrumbs read correctly
101
- if (hasMany) {
102
- setSelections(prev => {
103
- const next = new Map(prev);
104
- for (const [id_0, {
105
- path
106
- }] of paths) {
107
- if (next.has(id_0)) {
108
- next.set(id_0, {
109
- id: id_0,
110
- path
111
- });
112
- }
113
- }
114
- return next;
115
- });
116
- }
86
+ setInitialExpandedPath(path);
117
87
  } catch {
118
88
  // Silently handle fetch errors - will just start at root
119
89
  } finally {
120
90
  setIsLoadingPath(false);
121
91
  }
122
92
  });
123
- // Load ancestor paths on mount
93
+ // Load ancestor path on mount
124
94
  useEffect(() => {
125
95
  if (hasLoadedPathRef.current) {
126
96
  return;
127
97
  }
128
98
  hasLoadedPathRef.current = true;
129
- void loadAncestorPaths(initialSelections);
130
- }, [initialSelections]);
99
+ void loadAncestorPath(firstSelection);
100
+ }, [firstSelection]);
101
+ const [selections, setSelections] = useState(() => mapSelections(initialSelections));
131
102
  const selectedIds = useMemo(() => new Set(selections.keys()), [selections]);
132
- // Every ancestor of a checked item gets a badge counting the picks below it, so a collapsed
133
- // branch still shows how much is selected inside
134
- const selectedDescendantCounts = useMemo(() => {
135
- const counts = new Map();
136
- for (const {
137
- id: id_1,
138
- path: path_0
139
- } of selections.values()) {
140
- for (const segment of path_0) {
141
- if (segment.id !== id_1) {
142
- counts.set(segment.id, (counts.get(segment.id) ?? 0) + 1);
143
- }
144
- }
145
- }
146
- return counts;
147
- }, [selections]);
103
+ // For now, ancestorsWithSelections is empty - will be computed when we have path tracking
104
+ const ancestorsWithSelections = useMemo(() => new Set(), []);
148
105
  const handleSave = useCallback(() => {
149
106
  onSave({
150
107
  closeModal,
@@ -152,83 +109,115 @@ export const HierarchyModalContent = function HierarchyModalContent({
152
109
  });
153
110
  }, [onSave, selections, closeModal]);
154
111
  const handleSelect = useCallback(({
155
- id: id_2,
156
- path: path_1
112
+ id: id_0,
113
+ path: path_0
157
114
  }) => {
158
- setSelections(prev_0 => {
159
- const next_0 = new Map(prev_0);
160
- // Single select replaces rather than toggles - clicking an item always makes it the
161
- // destination, so re-clicking the open folder cannot leave the move with no target
162
- if (!hasMany) {
163
- next_0.clear();
164
- next_0.set(id_2, {
165
- id: id_2,
166
- path: path_1
167
- });
168
- return next_0;
169
- }
170
- if (next_0.has(id_2)) {
171
- next_0.delete(id_2);
115
+ setSelections(prev => {
116
+ const next = new Map(prev);
117
+ if (next.has(id_0)) {
118
+ next.delete(id_0);
172
119
  } else {
173
- next_0.set(id_2, {
174
- id: id_2,
175
- path: path_1
120
+ if (!hasMany) {
121
+ // Single select: clear previous selections
122
+ next.clear();
123
+ }
124
+ next.set(id_0, {
125
+ id: id_0,
126
+ path: path_0
176
127
  });
177
128
  }
178
- return next_0;
129
+ return next;
179
130
  });
180
131
  }, [hasMany]);
181
132
  const handleClearAll = useCallback(() => {
182
133
  setSelections(new Map());
183
134
  }, []);
184
- const handleRevealPath = useCallback(path_2 => {
185
- void columnBrowserRef?.current?.revealPath(path_2);
186
- }, [columnBrowserRef]);
187
135
  const handleCancel = useCallback(() => {
188
136
  setSelections(mapSelections(initialSelections));
189
137
  closeModal();
190
138
  }, [closeModal, initialSelections, mapSelections]);
191
139
  // Expose selectItem for programmatic selection (e.g., after creating a new item)
192
140
  useImperativeHandle(ref, () => ({
193
- selectItem: ({
194
- id: id_3,
195
- title: itemTitle
196
- }) => {
197
- setSelections(prev_1 => {
198
- const next_1 = new Map(prev_1);
141
+ selectItem: id_1 => {
142
+ setSelections(prev_0 => {
143
+ const next_0 = new Map(prev_0);
199
144
  if (!hasMany) {
200
- next_1.clear();
145
+ next_0.clear();
201
146
  }
202
- // A newly created item has no browsed path, so its own title is the whole breadcrumb
203
- next_1.set(id_3, {
204
- id: id_3,
205
- path: itemTitle ? [{
206
- id: id_3,
207
- title: itemTitle
208
- }] : []
147
+ // Path will be empty for newly created items - could be enhanced later
148
+ next_0.set(id_1, {
149
+ id: id_1,
150
+ path: []
209
151
  });
210
- return next_1;
152
+ return next_0;
211
153
  });
212
154
  }
213
155
  }), [hasMany]);
214
156
  const selectionCount = selections.size;
215
- const destinationPath = hasMany ? undefined : selections.values().next().value?.path;
216
157
  return /*#__PURE__*/_jsxs("div", {
217
158
  className: `${baseClass}__content`,
218
159
  children: [/*#__PURE__*/_jsx(DialogHeader, {
219
- onClose: handleCancel,
220
- showClose: true,
221
- title: title || t('general:selectLabel', {
160
+ title: t('general:selectValue', {
222
161
  label: collectionLabel
162
+ }),
163
+ children: /*#__PURE__*/_jsxs("div", {
164
+ className: `${baseClass}__header-actions`,
165
+ children: [/*#__PURE__*/_jsx(Button, {
166
+ buttonStyle: "secondary",
167
+ margin: false,
168
+ onClick: handleCancel,
169
+ size: "medium",
170
+ children: t('general:cancel')
171
+ }), /*#__PURE__*/_jsx(Button, {
172
+ margin: false,
173
+ onClick: handleSave,
174
+ size: "medium",
175
+ children: t('general:select')
176
+ })]
223
177
  })
224
- }), /*#__PURE__*/_jsx(DialogBody, {
225
- children: /*#__PURE__*/_jsx("div", {
178
+ }), /*#__PURE__*/_jsxs(DialogBody, {
179
+ children: [/*#__PURE__*/_jsxs("div", {
180
+ className: `${baseClass}__subheader`,
181
+ children: [/*#__PURE__*/_jsxs("div", {
182
+ className: `${baseClass}__subheader-left`,
183
+ children: [Icon || /*#__PURE__*/_jsx(TagIcon, {}), /*#__PURE__*/_jsx("h4", {
184
+ children: collectionLabel
185
+ })]
186
+ }), /*#__PURE__*/_jsxs("div", {
187
+ className: `${baseClass}__subheader-right`,
188
+ children: [showMoveToRoot && onMoveToRoot && /*#__PURE__*/_jsx(Button, {
189
+ buttonStyle: "ghost",
190
+ className: `${baseClass}__move-to-root`,
191
+ margin: false,
192
+ onClick: onMoveToRoot,
193
+ size: "medium",
194
+ children: t('hierarchy:moveToRoot')
195
+ }), Boolean(selectionCount) && /*#__PURE__*/_jsxs(_Fragment, {
196
+ children: [/*#__PURE__*/_jsx("span", {
197
+ className: `${baseClass}__selection-info`,
198
+ children: t('general:selectedCount', {
199
+ count: selectionCount,
200
+ label: ''
201
+ })
202
+ }), /*#__PURE__*/_jsx("span", {
203
+ children: "—"
204
+ }), /*#__PURE__*/_jsx(Button, {
205
+ buttonStyle: "ghost",
206
+ className: `${baseClass}__clear-all`,
207
+ margin: false,
208
+ onClick: handleClearAll,
209
+ size: "medium",
210
+ children: t('general:clear')
211
+ })]
212
+ })]
213
+ })]
214
+ }), /*#__PURE__*/_jsx("div", {
226
215
  className: `${baseClass}__columns`,
227
216
  children: /*#__PURE__*/_jsx(HierarchyColumnBrowser, {
217
+ ancestorsWithSelections: ancestorsWithSelections,
228
218
  baseFilter: baseFilter,
229
219
  disabledIds: disabledIds,
230
220
  filterByCollection: filterByCollection,
231
- hasMany: hasMany,
232
221
  hierarchyCollectionSlug: hierarchyCollectionSlug,
233
222
  initialExpandedPath: initialExpandedPath,
234
223
  isLoadingPath: isLoadingPath,
@@ -236,31 +225,10 @@ export const HierarchyModalContent = function HierarchyModalContent({
236
225
  onSelect: handleSelect,
237
226
  parentFieldName: parentFieldName,
238
227
  ref: columnBrowserRef,
239
- selectedDescendantCounts: selectedDescendantCounts,
240
228
  selectedIds: selectedIds,
241
229
  useAsTitle: useAsTitle
242
230
  })
243
- })
244
- }), /*#__PURE__*/_jsx(HierarchyModalFooter, {
245
- confirmLabel: confirmLabel || (hasMany ? t('general:confirm') : t('general:move')),
246
- destinationPath: destinationPath,
247
- Icon: Icon,
248
- isConfirmDisabled: selectionCount === 0,
249
- isMultiSelect: hasMany,
250
- onClear: handleClearAll,
251
- onConfirm: handleSave,
252
- onMoveToRoot: onMoveToRoot,
253
- onRevealPath: handleRevealPath,
254
- placeholderLabel: t('general:selectLabel', {
255
- label: hasMany ? collectionLabel : collectionLabelSingular
256
- }),
257
- previousPath: hasMany ? undefined : previousPath,
258
- selectionCount: selectionCount,
259
- selectionCountLabel: t('general:selectedCount', {
260
- count: selectionCount,
261
- label: collectionLabel
262
- }),
263
- showMoveToRoot: showMoveToRoot
231
+ })]
264
232
  })]
265
233
  });
266
234
  };
@@ -269,8 +237,7 @@ export const HierarchyModal = props => {
269
237
  hierarchyCollectionSlug,
270
238
  modalSlug,
271
239
  parentFieldName,
272
- reopenCount,
273
- useAsTitle
240
+ reopenCount
274
241
  } = props;
275
242
  const {
276
243
  refreshTree
@@ -320,15 +287,11 @@ export const HierarchyModal = props => {
320
287
  void columnBrowserRef.current.refreshColumn(createParentId);
321
288
  }
322
289
  if (modalContentRef.current && doc?.id) {
323
- const newItemTitle = useAsTitle ? doc[useAsTitle] : undefined;
324
- modalContentRef.current.selectItem({
325
- id: doc.id,
326
- title: typeof newItemTitle === 'string' ? newItemTitle : undefined
327
- });
290
+ modalContentRef.current.selectItem(doc.id);
328
291
  }
329
292
  refreshTree(hierarchyCollectionSlug);
330
293
  closeDocumentDrawer();
331
- }, [closeDocumentDrawer, createParentId, hierarchyCollectionSlug, refreshTree, useAsTitle]);
294
+ }, [closeDocumentDrawer, createParentId, hierarchyCollectionSlug, refreshTree]);
332
295
  // Memoize the content - only depends on stable values
333
296
  const modalContent = useMemo(() => /*#__PURE__*/_jsx(HierarchyModalContent, {
334
297
  ...props,
@@ -1 +1 @@
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","fetchAncestorPaths","HierarchyModalFooter","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","collectionLabelSingular","singular","parentFieldName_internal","hierarchy","initialExpandedPath","setInitialExpandedPath","previousPath","setPreviousPath","isLoadingPath","setIsLoadingPath","Boolean","length","hasLoadedPathRef","mapSelections","ids","map","Map","id","set","path","selections","setSelections","loadAncestorPaths","firstId","itemIds","paths","firstPath","get","ancestorIds","prev","next","has","current","selectedIds","Set","keys","selectedDescendantCounts","counts","values","segment","handleSave","handleSelect","clear","delete","handleClearAll","handleRevealPath","revealPath","handleCancel","selectItem","itemTitle","selectionCount","size","destinationPath","undefined","value","_jsxs","className","_jsx","onClose","showClose","label","onSelect","isConfirmDisabled","isMultiSelect","onClear","onConfirm","onRevealPath","placeholderLabel","selectionCountLabel","count","HierarchyModal","props","modalSlug","reopenCount","refreshTree","createParentId","setCreateParentId","modalContentRef","documentDrawerKey","setDocumentDrawerKey","documentDrawerSlug","DocumentDrawer","closeDrawer","closeDocumentDrawer","openDrawer","openDocumentDrawer","drawerSlug","handleCreateNew","parentId","setTimeout","handleDocumentSave","doc","refreshColumn","newItemTitle","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 { fetchAncestorPaths } from './fetchAncestorPath.js'\nimport { HierarchyModalFooter } from './Footer/index.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: (params: { id: number | string; title?: 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 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 hasLoadedPathRef = React.useRef(false)\n\n const mapSelections = useCallback(\n (ids?: (number | string)[]) => {\n const map = new Map<number | string, SelectionWithPath>()\n\n // Single-select is a move: the existing value is the origin shown in the footer, not a\n // pre-made choice. Multi-select edits a set, so existing values start checked.\n if (ids && hasMany) {\n for (const id of ids) {\n map.set(id, { id, path: [] })\n }\n }\n\n return map\n },\n [hasMany],\n )\n\n const [selections, setSelections] = useState<Map<number | string, SelectionWithPath>>(() =>\n mapSelections(initialSelections),\n )\n\n const loadAncestorPaths = useEffectEvent(async (ids?: (number | string)[]) => {\n const firstId = ids?.[0]\n\n if (!firstId) {\n setIsLoadingPath(false)\n return\n }\n\n // Multi-select marks the ancestors of every checked item as partially selected, so all of\n // their paths are needed. Single-select only needs the origin of the move.\n const itemIds = hasMany ? ids : [firstId]\n\n try {\n const paths = await fetchAncestorPaths({\n api,\n collectionSlug: hierarchyCollectionSlug,\n itemIds,\n parentFieldName: parentFieldName_internal,\n serverURL,\n useAsTitle: useAsTitle || 'id',\n })\n\n const firstPath = paths.get(firstId)\n setInitialExpandedPath(firstPath?.ancestorIds)\n setPreviousPath(firstPath?.path)\n\n // Selections seeded from the field's value start without a path - backfill them so their\n // ancestors can be marked, and so the footer breadcrumbs read correctly\n if (hasMany) {\n setSelections((prev) => {\n const next = new Map(prev)\n\n for (const [id, { path }] of paths) {\n if (next.has(id)) {\n next.set(id, { id, path })\n }\n }\n\n return next\n })\n }\n } catch {\n // Silently handle fetch errors - will just start at root\n } finally {\n setIsLoadingPath(false)\n }\n })\n\n // Load ancestor paths on mount\n useEffect(() => {\n if (hasLoadedPathRef.current) {\n return\n }\n hasLoadedPathRef.current = true\n void loadAncestorPaths(initialSelections)\n }, [initialSelections])\n\n const selectedIds = useMemo(() => new Set(selections.keys()), [selections])\n\n // Every ancestor of a checked item gets a badge counting the picks below it, so a collapsed\n // branch still shows how much is selected inside\n const selectedDescendantCounts = useMemo(() => {\n const counts = new Map<number | string, number>()\n\n for (const { id, path } of selections.values()) {\n for (const segment of path) {\n if (segment.id !== id) {\n counts.set(segment.id, (counts.get(segment.id) ?? 0) + 1)\n }\n }\n }\n\n return counts\n }, [selections])\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 const next = new Map(prev)\n\n // Single select replaces rather than toggles - clicking an item always makes it the\n // destination, so re-clicking the open folder cannot leave the move with no target\n if (!hasMany) {\n next.clear()\n next.set(id, { id, path })\n return next\n }\n\n if (next.has(id)) {\n next.delete(id)\n } else {\n next.set(id, { id, path })\n }\n\n return next\n })\n },\n [hasMany],\n )\n\n const handleClearAll = useCallback(() => {\n setSelections(new Map())\n }, [])\n\n const handleRevealPath = useCallback(\n (path: PathSegment[]) => {\n void columnBrowserRef?.current?.revealPath(path)\n },\n [columnBrowserRef],\n )\n\n const handleCancel = useCallback(() => {\n setSelections(mapSelections(initialSelections))\n closeModal()\n }, [closeModal, initialSelections, mapSelections])\n\n // Expose selectItem for programmatic selection (e.g., after creating a new item)\n useImperativeHandle(\n ref,\n () => ({\n selectItem: ({ id, title: itemTitle }: { id: number | string; title?: string }) => {\n setSelections((prev) => {\n const next = new Map(prev)\n if (!hasMany) {\n next.clear()\n }\n // A newly created item has no browsed path, so its own title is the whole breadcrumb\n next.set(id, { id, path: itemTitle ? [{ id, title: itemTitle }] : [] })\n return next\n })\n },\n }),\n [hasMany],\n )\n\n const selectionCount = selections.size\n const destinationPath = hasMany ? undefined : selections.values().next().value?.path\n\n return (\n <div className={`${baseClass}__content`}>\n <DialogHeader\n onClose={handleCancel}\n showClose\n title={title || t('general:selectLabel', { label: collectionLabel })}\n />\n <DialogBody>\n <div className={`${baseClass}__columns`}>\n <HierarchyColumnBrowser\n baseFilter={baseFilter}\n disabledIds={disabledIds}\n filterByCollection={filterByCollection}\n hasMany={hasMany}\n hierarchyCollectionSlug={hierarchyCollectionSlug}\n initialExpandedPath={initialExpandedPath}\n isLoadingPath={isLoadingPath}\n onCreateNew={onCreateNew}\n onSelect={handleSelect}\n parentFieldName={parentFieldName}\n ref={columnBrowserRef}\n selectedDescendantCounts={selectedDescendantCounts}\n selectedIds={selectedIds}\n useAsTitle={useAsTitle}\n />\n </div>\n </DialogBody>\n <HierarchyModalFooter\n confirmLabel={confirmLabel || (hasMany ? t('general:confirm') : t('general:move'))}\n destinationPath={destinationPath}\n Icon={Icon}\n isConfirmDisabled={selectionCount === 0}\n isMultiSelect={hasMany}\n onClear={handleClearAll}\n onConfirm={handleSave}\n onMoveToRoot={onMoveToRoot}\n onRevealPath={handleRevealPath}\n placeholderLabel={t('general:selectLabel', {\n label: hasMany ? collectionLabel : collectionLabelSingular,\n })}\n previousPath={hasMany ? undefined : previousPath}\n selectionCount={selectionCount}\n selectionCountLabel={t('general:selectedCount', {\n count: selectionCount,\n label: 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\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 const newItemTitle = useAsTitle ? doc[useAsTitle] : undefined\n\n modalContentRef.current.selectItem({\n id: doc.id,\n title: typeof newItemTitle === 'string' ? newItemTitle : undefined,\n })\n }\n refreshTree(hierarchyCollectionSlug)\n closeDocumentDrawer()\n },\n [closeDocumentDrawer, createParentId, hierarchyCollectionSlug, refreshTree, useAsTitle],\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;AAMP,SAASC,cAAc,QAAQ;AAC/B,SAASC,SAAS,QAAQ;AAC1B,SAASC,YAAY,QAAQ;AAC7B,SAASC,cAAc,QAAQ;AAC/B,SAASC,UAAU,EAAEC,YAAY,EAAEC,WAAW,QAAQ;AACtD,SAASC,iBAAiB,QAAQ;AAClC,SAASC,mBAAmB,QAAQ;AACpC,SAASC,sBAAsB,QAAQ;AACvC,SAASC,kBAAkB,QAAQ;AACnC,SAASC,oBAAoB,QAAQ;AACrC,OAAO;AAEP,OAAO,MAAMC,SAAA,GAAY;AAWzB,OAA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CAACA,mBAAA,EAAqBR,cAAA,EAAgBlG,uBAAA,EAAyBiG,WAAA,EAAavF,UAAA,CAAW;EAGzF;EACA,MAAM2G,YAAA,GAAe7I,OAAA,CACnB,mBACEwG,IAAA,CAACxF,qBAAA;IAEE,GAAGsG,KAAK;IACTnG,gBAAA,EAAkBA,gBAAA;IAClBQ,WAAA,EAAa2G,eAAA;IACbvG,GAAA,EAAK6F;KAJAJ,WAAA,GAOT,CAACc,eAAA,EAAiBhB,KAAA,EAAOE,WAAA,CAAY;EAGvC,oBACElB,KAAA,CAAAwC,SAAA;4BACEtC,IAAA,CAAC/F,WAAA;MAAY8F,SAAA,EAAWxF,SAAA;MAAWgI,WAAW;MAAC7C,IAAA,EAAK;MAAQ8C,IAAA,EAAMzB,SAAA;gBAC/DsB;qBAEHrC,IAAA,CAAC7F,mBAAA;gBACC,aAAA6F,IAAA,CAACwB,cAAA;QACCiB,WAAA,EACEvB,cAAA,KAAmB,OAAO;UAAE,CAACzE,wBAAA,GAA2ByE;QAAe,IAAItB,SAAA;QAG7EvE,MAAA,EAAQ4G;SADHZ,iBAAA;;;AAMf","ignoreList":[]}
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","baseClass","HierarchyModalContent","baseFilter","closeModal","columnBrowserRef","disabledIds","filterByCollection","hasMany","hierarchyCollectionSlug","Icon","initialSelections","onCreateNew","onMoveToRoot","onSave","parentFieldName","ref","showMoveToRoot","useAsTitle","i18n","t","config","routes","api","serverURL","getEntityConfig","collectionConfig","collectionSlug","collectionLabel","labels","plural","parentFieldName_internal","hierarchy","initialExpandedPath","setInitialExpandedPath","isLoadingPath","setIsLoadingPath","Boolean","length","hasLoadedPathRef","firstSelection","mapSelections","ids","map","Map","id","set","path","loadAncestorPath","itemId","current","selections","setSelections","selectedIds","Set","keys","ancestorsWithSelections","handleSave","handleSelect","prev","next","has","delete","clear","handleClearAll","handleCancel","selectItem","selectionCount","size","_jsxs","className","_jsx","title","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","undefined","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 './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 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 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 mapSelections = useCallback((ids?: (number | string)[]) => {\n const map = new Map<number | string, SelectionWithPath>()\n\n if (ids) {\n for (const id of ids) {\n map.set(id, { id, path: [] })\n }\n }\n\n return map\n }, [])\n\n const loadAncestorPath = useEffectEvent(async (itemId?: number | string) => {\n if (!itemId) {\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 mapSelections(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 const next = new Map(prev)\n\n if (next.has(id)) {\n next.delete(id)\n } else {\n if (!hasMany) {\n // Single select: clear previous selections\n next.clear()\n }\n next.set(id, { id, path })\n }\n\n return next\n })\n },\n [hasMany],\n )\n\n const handleClearAll = useCallback(() => {\n setSelections(new Map())\n }, [])\n\n const handleCancel = useCallback(() => {\n setSelections(mapSelections(initialSelections))\n closeModal()\n }, [closeModal, initialSelections, mapSelections])\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={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 {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={handleDocument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CAAClB,cAAA;IAC9C;IACA,IAAIE,eAAA,CAAgBrC,OAAO,IAAImD,GAAA,EAAKxD,EAAA,EAAI;MACtC0C,eAAA,CAAgBrC,OAAO,CAACgB,UAAU,CAACmC,GAAA,CAAIxD,EAAE;IAC3C;IACAuC,WAAA,CAAY3E,uBAAA;IACZoF,mBAAA;EACF,GACA,CAACA,mBAAA,EAAqBR,cAAA,EAAgB5E,uBAAA,EAAyB2E,WAAA,CAAY;EAG7E;EACA,MAAMoB,YAAA,GAAevH,OAAA,CACnB,mBACEsF,IAAA,CAACrE,qBAAA;IAEE,GAAG+E,KAAK;IACT5E,gBAAA,EAAkBA,gBAAA;IAClBO,WAAA,EAAaqF,eAAA;IACbjF,GAAA,EAAKuE;KAJAJ,WAAA,GAOT,CAACc,eAAA,EAAiBhB,KAAA,EAAOE,WAAA,CAAY;EAGvC,oBACEd,KAAA,CAAAQ,SAAA;4BACEN,IAAA,CAAC3E,WAAA;MAAY0E,SAAA,EAAWrE,SAAA;MAAWwG,WAAW;MAACrC,IAAA,EAAK;MAAQsC,IAAA,EAAMxB,SAAA;gBAC/DsB;qBAEHjC,IAAA,CAACzE,mBAAA;gBACC,aAAAyE,IAAA,CAACoB,cAAA;QACCgB,WAAA,EACEtB,cAAA,KAAmB,OAAO;UAAE,CAACtD,wBAAA,GAA2BsD;QAAe,IAAIiB,SAAA;QAG7ExF,MAAA,EAAQsF;SADHZ,iBAAA;;;AAMf","ignoreList":[]}
@@ -20,17 +20,7 @@ export type UseHierarchyModalArgs = {
20
20
  Icon?: React.ReactNode;
21
21
  };
22
22
  export type HierarchyModalProps = {
23
- /**
24
- * Label for the footer's primary action.
25
- * Defaults to "Confirm" when `hasMany`, otherwise "Move".
26
- */
27
- readonly confirmLabel?: string;
28
23
  readonly hasMany?: boolean;
29
- /**
30
- * The item(s) already assigned when the modal opens.
31
- * In multi-select mode these start checked; in single-select mode the first entry is shown
32
- * in the footer as the origin of the move and the browser expands to reveal it.
33
- */
34
24
  readonly initialSelections?: (number | string)[];
35
25
  readonly onMoveToRoot?: () => void;
36
26
  readonly onSave: (params: {
@@ -38,11 +28,6 @@ export type HierarchyModalProps = {
38
28
  selections: Map<number | string, SelectionWithPath>;
39
29
  }) => void;
40
30
  readonly showMoveToRoot?: boolean;
41
- /**
42
- * Header title, e.g. `Move "My Post"` or "Move 3 Documents".
43
- * Defaults to "Select {collection label}".
44
- */
45
- readonly title?: string;
46
31
  };
47
32
  export type HierarchyModalInternalProps = {
48
33
  /** Base filter constraint (e.g., tenant filter) to apply to all queries */
@@ -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;;;OAGG;IACH,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAA;IAC9B,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAA;IAC1B;;;;OAIG;IACH,Q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AU,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 /**\n * Label for the footer's primary action.\n * Defaults to \"Confirm\" when `hasMany`, otherwise \"Move\".\n */\n readonly confirmLabel?: string\n readonly hasMany?: boolean\n /**\n * The item(s) already assigned when the modal opens.\n * In multi-select mode these start checked; in single-select mode the first entry is shown\n * in the footer as the origin of the move and the browser expands to reveal it.\n */\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 /**\n * Header title, e.g. `Move \"My Post\"` or \"Move 3 Documents\".\n * Defaults to \"Select {collection label}\".\n */\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":"AA2FA;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 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}\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":"AA4EA;AACA","ignoreList":[]}
@@ -7,19 +7,15 @@ 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;
10
12
  /** Callback after successful move */
11
13
  onSuccess?: () => void;
12
- /**
13
- * Collection slugs the destination folder must accept (via its `allowedCollections` config).
14
- * Pass the selected items' own collection slugs, plus any `allowedCollections` of selected
15
- * folders, so the picker only shows folders that can hold every selected item.
16
- */
17
- requiredCollections?: string[];
18
14
  /** Selections grouped by collection slug */
19
15
  selections: Record<string, {
20
16
  ids: (number | string)[];
21
17
  }>;
22
18
  };
23
- export declare function MoveMany({ currentParentID, hierarchySlug, Icon, onSuccess, requiredCollections, selections, }: MoveManyProps): React.JSX.Element;
19
+ export declare function MoveMany({ currentParentID, hierarchySlug, Icon, modalPrefix, onSuccess, selections, }: MoveManyProps): React.JSX.Element;
24
20
  export {};
25
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":"AAIA,OAAO,KAA+B,MAAM,OAAO,CAAA;AAWnD,eAAO,MAAM,SAAS,cAAc,CAAA;AAEpC,KAAK,aAAa,GAAG;IACnB,oEAAoE;IACpE,eAAe,CAAC,EAAE,IAAI,GAAG,MAAM,GAAG,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