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

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 (855) hide show
  1. package/dist/css/app.css +1 -0
  2. package/dist/css/colors.css +9 -8
  3. package/dist/css/forms.css +1 -0
  4. package/dist/css/preflight.css +1 -0
  5. package/dist/css/spacing.css +12 -0
  6. package/dist/css/typography.css +158 -14
  7. package/dist/elements/APIKeyInput/index.d.ts +2 -0
  8. package/dist/elements/APIKeyInput/index.d.ts.map +1 -1
  9. package/dist/elements/APIKeyInput/index.js +27 -29
  10. package/dist/elements/APIKeyInput/index.js.map +1 -1
  11. package/dist/elements/AddNewRelation/index.css +4 -0
  12. package/dist/elements/AddNewRelation/index.js +2 -2
  13. package/dist/elements/AddNewRelation/index.js.map +1 -1
  14. package/dist/elements/AppHeader/EditViewWidthSettings/index.css +5 -0
  15. package/dist/elements/AppHeader/EditViewWidthSettings/index.d.ts +4 -0
  16. package/dist/elements/AppHeader/EditViewWidthSettings/index.d.ts.map +1 -0
  17. package/dist/elements/AppHeader/EditViewWidthSettings/index.js +77 -0
  18. package/dist/elements/AppHeader/EditViewWidthSettings/index.js.map +1 -0
  19. package/dist/{icons/CollapseLayers → elements/AppHeader/SettingsMenu}/index.css +1 -1
  20. package/dist/elements/AppHeader/SettingsMenu/index.d.ts +4 -0
  21. package/dist/elements/AppHeader/SettingsMenu/index.d.ts.map +1 -0
  22. package/dist/elements/AppHeader/SettingsMenu/index.js +59 -0
  23. package/dist/elements/AppHeader/SettingsMenu/index.js.map +1 -0
  24. package/dist/elements/AppHeader/TypeSizeSettings/index.d.ts +3 -0
  25. package/dist/elements/AppHeader/TypeSizeSettings/index.d.ts.map +1 -0
  26. package/dist/elements/AppHeader/TypeSizeSettings/index.js +58 -0
  27. package/dist/elements/AppHeader/TypeSizeSettings/index.js.map +1 -0
  28. package/dist/elements/AppHeader/index.css +3 -4
  29. package/dist/elements/AppHeader/index.d.ts +8 -1
  30. package/dist/elements/AppHeader/index.d.ts.map +1 -1
  31. package/dist/elements/AppHeader/index.js +16 -6
  32. package/dist/elements/AppHeader/index.js.map +1 -1
  33. package/dist/elements/Autosave/index.d.ts.map +1 -1
  34. package/dist/elements/Autosave/index.js +2 -3
  35. package/dist/elements/Autosave/index.js.map +1 -1
  36. package/dist/elements/Banner/index.css +4 -0
  37. package/dist/elements/Banner/index.d.ts.map +1 -1
  38. package/dist/elements/Banner/index.js +1 -0
  39. package/dist/elements/Banner/index.js.map +1 -1
  40. package/dist/elements/BulkUpload/ActionsBar/index.css +1 -0
  41. package/dist/elements/BulkUpload/AddingFilesView/index.css +2 -4
  42. package/dist/elements/BulkUpload/FileSidebar/index.css +1 -0
  43. package/dist/elements/BulkUpload/FormsManager/createFormData.d.ts +1 -1
  44. package/dist/elements/BulkUpload/FormsManager/createFormData.d.ts.map +1 -1
  45. package/dist/elements/BulkUpload/FormsManager/createFormData.js +7 -3
  46. package/dist/elements/BulkUpload/FormsManager/createFormData.js.map +1 -1
  47. package/dist/elements/BulkUpload/FormsManager/index.d.ts.map +1 -1
  48. package/dist/elements/BulkUpload/FormsManager/index.js +18 -12
  49. package/dist/elements/BulkUpload/FormsManager/index.js.map +1 -1
  50. package/dist/elements/BulkUpload/index.css +2 -0
  51. package/dist/elements/Button/index.css +0 -23
  52. package/dist/elements/Button/types.d.ts +1 -1
  53. package/dist/elements/Button/types.d.ts.map +1 -1
  54. package/dist/elements/Button/types.js.map +1 -1
  55. package/dist/elements/Collapsible/index.css +1 -0
  56. package/dist/elements/CopyLocaleData/index.d.ts.map +1 -1
  57. package/dist/elements/CopyLocaleData/index.js +8 -9
  58. package/dist/elements/CopyLocaleData/index.js.map +1 -1
  59. package/dist/elements/DatePicker/index.css +2 -0
  60. package/dist/elements/DefaultListViewTabs/index.css +0 -1
  61. package/dist/elements/DefaultListViewTabs/index.d.ts.map +1 -1
  62. package/dist/elements/DefaultListViewTabs/index.js +62 -84
  63. package/dist/elements/DefaultListViewTabs/index.js.map +1 -1
  64. package/dist/elements/DeleteMany/index.d.ts.map +1 -1
  65. package/dist/elements/DeleteMany/index.js +2 -3
  66. package/dist/elements/DeleteMany/index.js.map +1 -1
  67. package/dist/elements/Dialog/index.css +1 -0
  68. package/dist/elements/DocumentControls/index.css +1 -0
  69. package/dist/elements/DocumentDrawer/types.d.ts +1 -1
  70. package/dist/elements/DocumentDrawer/types.d.ts.map +1 -1
  71. package/dist/elements/DocumentDrawer/types.js.map +1 -1
  72. package/dist/elements/DocumentFields/index.css +2 -0
  73. package/dist/elements/DocumentHeader/Tabs/Tab/index.d.ts +1 -0
  74. package/dist/elements/DocumentHeader/Tabs/Tab/index.d.ts.map +1 -1
  75. package/dist/elements/DocumentHeader/Tabs/Tab/index.js +3 -2
  76. package/dist/elements/DocumentHeader/Tabs/Tab/index.js.map +1 -1
  77. package/dist/elements/DocumentHeader/Tabs/index.css +1 -0
  78. package/dist/elements/DocumentHeader/Tabs/index.d.ts +1 -0
  79. package/dist/elements/DocumentHeader/Tabs/index.d.ts.map +1 -1
  80. package/dist/elements/DocumentHeader/Tabs/index.js +5 -3
  81. package/dist/elements/DocumentHeader/Tabs/index.js.map +1 -1
  82. package/dist/elements/DocumentHeader/index.css +1 -0
  83. package/dist/elements/DocumentHeader/index.d.ts +1 -0
  84. package/dist/elements/DocumentHeader/index.d.ts.map +1 -1
  85. package/dist/elements/DocumentHeader/index.js +4 -2
  86. package/dist/elements/DocumentHeader/index.js.map +1 -1
  87. package/dist/elements/Drawer/types.d.ts +2 -2
  88. package/dist/elements/Drawer/types.d.ts.map +1 -1
  89. package/dist/elements/Drawer/types.js.map +1 -1
  90. package/dist/elements/DuplicateDocument/index.d.ts.map +1 -1
  91. package/dist/elements/DuplicateDocument/index.js +2 -3
  92. package/dist/elements/DuplicateDocument/index.js.map +1 -1
  93. package/dist/elements/EditMany/DrawerContent.d.ts.map +1 -1
  94. package/dist/elements/EditMany/DrawerContent.js +2 -3
  95. package/dist/elements/EditMany/DrawerContent.js.map +1 -1
  96. package/dist/elements/EditUpload/index.css +1 -1
  97. package/dist/elements/FieldDiffContainer/index.css +1 -0
  98. package/dist/elements/FieldDiffLabel/index.css +1 -0
  99. package/dist/elements/FileDetails/StaticFileDetails/index.css +2 -0
  100. package/dist/elements/HTMLDiff/index.css +1 -0
  101. package/dist/elements/Hierarchy/ColumnBrowser/Column/index.css +4 -22
  102. package/dist/elements/Hierarchy/ColumnBrowser/Column/index.d.ts.map +1 -1
  103. package/dist/elements/Hierarchy/ColumnBrowser/Column/index.js +49 -68
  104. package/dist/elements/Hierarchy/ColumnBrowser/Column/index.js.map +1 -1
  105. package/dist/elements/Hierarchy/ColumnBrowser/ColumnItem/index.css +15 -100
  106. package/dist/elements/Hierarchy/ColumnBrowser/ColumnItem/index.d.ts.map +1 -1
  107. package/dist/elements/Hierarchy/ColumnBrowser/ColumnItem/index.js +137 -97
  108. package/dist/elements/Hierarchy/ColumnBrowser/ColumnItem/index.js.map +1 -1
  109. package/dist/elements/Hierarchy/ColumnBrowser/index.d.ts +1 -1
  110. package/dist/elements/Hierarchy/ColumnBrowser/index.d.ts.map +1 -1
  111. package/dist/elements/Hierarchy/ColumnBrowser/index.js +23 -51
  112. package/dist/elements/Hierarchy/ColumnBrowser/index.js.map +1 -1
  113. package/dist/elements/Hierarchy/ColumnBrowser/types.d.ts +3 -26
  114. package/dist/elements/Hierarchy/ColumnBrowser/types.d.ts.map +1 -1
  115. package/dist/elements/Hierarchy/ColumnBrowser/types.js.map +1 -1
  116. package/dist/elements/Hierarchy/DocHeaderButton/index.d.ts.map +1 -1
  117. package/dist/elements/Hierarchy/DocHeaderButton/index.js +1 -6
  118. package/dist/elements/Hierarchy/DocHeaderButton/index.js.map +1 -1
  119. package/dist/elements/Hierarchy/DocHeaderButton/index.server.js +3 -1
  120. package/dist/elements/Hierarchy/DocHeaderButton/index.server.js.map +1 -1
  121. package/dist/elements/Hierarchy/Field/SelectedHierarchies.css +36 -0
  122. package/dist/elements/Hierarchy/Field/SelectedHierarchies.d.ts +13 -0
  123. package/dist/elements/Hierarchy/Field/SelectedHierarchies.d.ts.map +1 -0
  124. package/dist/elements/Hierarchy/Field/SelectedHierarchies.js +141 -0
  125. package/dist/elements/Hierarchy/Field/SelectedHierarchies.js.map +1 -0
  126. package/dist/elements/Hierarchy/Field/index.client.d.ts +0 -5
  127. package/dist/elements/Hierarchy/Field/index.client.d.ts.map +1 -1
  128. package/dist/elements/Hierarchy/Field/index.client.js +95 -120
  129. package/dist/elements/Hierarchy/Field/index.client.js.map +1 -1
  130. package/dist/elements/Hierarchy/Field/index.css +34 -3
  131. package/dist/elements/Hierarchy/Modal/fetchAncestorPath.d.ts +4 -18
  132. package/dist/elements/Hierarchy/Modal/fetchAncestorPath.d.ts.map +1 -1
  133. package/dist/elements/Hierarchy/Modal/fetchAncestorPath.js +24 -88
  134. package/dist/elements/Hierarchy/Modal/fetchAncestorPath.js.map +1 -1
  135. package/dist/elements/Hierarchy/Modal/index.css +53 -4
  136. package/dist/elements/Hierarchy/Modal/index.d.ts +2 -5
  137. package/dist/elements/Hierarchy/Modal/index.d.ts.map +1 -1
  138. package/dist/elements/Hierarchy/Modal/index.js +99 -136
  139. package/dist/elements/Hierarchy/Modal/index.js.map +1 -1
  140. package/dist/elements/Hierarchy/Modal/types.d.ts +0 -15
  141. package/dist/elements/Hierarchy/Modal/types.d.ts.map +1 -1
  142. package/dist/elements/Hierarchy/Modal/types.js.map +1 -1
  143. package/dist/elements/Hierarchy/MoveMany/index.d.ts +3 -7
  144. package/dist/elements/Hierarchy/MoveMany/index.d.ts.map +1 -1
  145. package/dist/elements/Hierarchy/MoveMany/index.js +171 -45
  146. package/dist/elements/Hierarchy/MoveMany/index.js.map +1 -1
  147. package/dist/elements/Hierarchy/Search/index.css +9 -2
  148. package/dist/elements/Hierarchy/Search/index.d.ts.map +1 -1
  149. package/dist/elements/Hierarchy/Search/index.js +73 -6
  150. package/dist/elements/Hierarchy/Search/index.js.map +1 -1
  151. package/dist/elements/Hierarchy/Search/types.d.ts +6 -2
  152. package/dist/elements/Hierarchy/Search/types.d.ts.map +1 -1
  153. package/dist/elements/Hierarchy/Search/types.js.map +1 -1
  154. package/dist/elements/Hierarchy/Search/useHierarchySearch.d.ts.map +1 -1
  155. package/dist/elements/Hierarchy/Search/useHierarchySearch.js +2 -3
  156. package/dist/elements/Hierarchy/Search/useHierarchySearch.js.map +1 -1
  157. package/dist/elements/Hierarchy/Tree/HierarchySidebarTab.d.ts +4 -0
  158. package/dist/elements/Hierarchy/Tree/HierarchySidebarTab.d.ts.map +1 -1
  159. package/dist/elements/Hierarchy/Tree/HierarchySidebarTab.js +186 -101
  160. package/dist/elements/Hierarchy/Tree/HierarchySidebarTab.js.map +1 -1
  161. package/dist/elements/Hierarchy/Tree/HierarchySidebarTab.server.d.ts.map +1 -1
  162. package/dist/elements/Hierarchy/Tree/HierarchySidebarTab.server.js +21 -1
  163. package/dist/elements/Hierarchy/Tree/HierarchySidebarTab.server.js.map +1 -1
  164. package/dist/elements/Hierarchy/Tree/LoadMore/index.css +3 -3
  165. package/dist/elements/Hierarchy/Tree/TreeNode/index.css +29 -59
  166. package/dist/elements/Hierarchy/Tree/TreeNode/index.d.ts +1 -1
  167. package/dist/elements/Hierarchy/Tree/TreeNode/index.d.ts.map +1 -1
  168. package/dist/elements/Hierarchy/Tree/TreeNode/index.js +10 -54
  169. package/dist/elements/Hierarchy/Tree/TreeNode/index.js.map +1 -1
  170. package/dist/elements/Hierarchy/Tree/index.css +9 -8
  171. package/dist/elements/Hierarchy/Tree/index.d.ts.map +1 -1
  172. package/dist/elements/Hierarchy/Tree/index.js +47 -29
  173. package/dist/elements/Hierarchy/Tree/index.js.map +1 -1
  174. package/dist/elements/Hierarchy/Tree/types.d.ts +1 -9
  175. package/dist/elements/Hierarchy/Tree/types.d.ts.map +1 -1
  176. package/dist/elements/Hierarchy/Tree/types.js.map +1 -1
  177. package/dist/elements/Hierarchy/Tree/useChildren.d.ts.map +1 -1
  178. package/dist/elements/Hierarchy/Tree/useChildren.js +1 -11
  179. package/dist/elements/Hierarchy/Tree/useChildren.js.map +1 -1
  180. package/dist/elements/ItemsDrawer/index.css +3 -0
  181. package/dist/elements/ListControls/index.css +1 -0
  182. package/dist/elements/ListControls/index.d.ts.map +1 -1
  183. package/dist/elements/ListControls/index.js +7 -2
  184. package/dist/elements/ListControls/index.js.map +1 -1
  185. package/dist/elements/ListControls/types.d.ts +3 -5
  186. package/dist/elements/ListControls/types.d.ts.map +1 -1
  187. package/dist/elements/ListControls/types.js.map +1 -1
  188. package/dist/elements/ListControlsBar/index.css +1 -0
  189. package/dist/elements/ListHeader/TitleActions/ListEmptyTrashButton.d.ts.map +1 -1
  190. package/dist/elements/ListHeader/TitleActions/ListEmptyTrashButton.js +3 -4
  191. package/dist/elements/ListHeader/TitleActions/ListEmptyTrashButton.js.map +1 -1
  192. package/dist/elements/LivePreview/Window/index.css +1 -0
  193. package/dist/elements/LivePreview/Window/index.js +1 -1
  194. package/dist/elements/LivePreview/Window/index.js.map +1 -1
  195. package/dist/elements/Localizer/index.js +1 -1
  196. package/dist/elements/Localizer/index.js.map +1 -1
  197. package/dist/elements/Nav/NavSidebarToggle/index.js +1 -1
  198. package/dist/elements/Nav/NavSidebarToggle/index.js.map +1 -1
  199. package/dist/elements/Nav/NavWrapper/index.d.ts +0 -1
  200. package/dist/elements/Nav/NavWrapper/index.d.ts.map +1 -1
  201. package/dist/elements/Nav/NavWrapper/index.js +18 -12
  202. package/dist/elements/Nav/NavWrapper/index.js.map +1 -1
  203. package/dist/elements/Nav/SidebarTabs/index.css +2 -1
  204. package/dist/elements/Nav/SidebarTabs/renderTabServerFn.js +3 -2
  205. package/dist/elements/Nav/SidebarTabs/renderTabServerFn.js.map +1 -1
  206. package/dist/elements/Nav/context.d.ts +1 -0
  207. package/dist/elements/Nav/context.d.ts.map +1 -1
  208. package/dist/elements/Nav/context.js +67 -92
  209. package/dist/elements/Nav/context.js.map +1 -1
  210. package/dist/elements/Nav/index.css +44 -47
  211. package/dist/elements/Nav/index.d.ts +0 -4
  212. package/dist/elements/Nav/index.d.ts.map +1 -1
  213. package/dist/elements/Nav/index.js +1 -16
  214. package/dist/elements/Nav/index.js.map +1 -1
  215. package/dist/elements/NavGroup/index.css +15 -29
  216. package/dist/elements/PageControls/index.css +1 -0
  217. package/dist/elements/PillSelector/index.css +1 -0
  218. package/dist/elements/Popup/PopupButtonList/index.css +16 -32
  219. package/dist/elements/Popup/index.css +0 -6
  220. package/dist/elements/Popup/index.d.ts +0 -10
  221. package/dist/elements/Popup/index.d.ts.map +1 -1
  222. package/dist/elements/Popup/index.js +5 -12
  223. package/dist/elements/Popup/index.js.map +1 -1
  224. package/dist/elements/PreviewSizes/index.css +2 -0
  225. package/dist/elements/PublishButton/ScheduleDrawer/index.d.ts.map +1 -1
  226. package/dist/elements/PublishButton/ScheduleDrawer/index.js +8 -30
  227. package/dist/elements/PublishButton/ScheduleDrawer/index.js.map +1 -1
  228. package/dist/elements/PublishButton/ScheduleDrawer/types.d.ts +1 -1
  229. package/dist/elements/PublishButton/ScheduleDrawer/types.d.ts.map +1 -1
  230. package/dist/elements/PublishButton/ScheduleDrawer/types.js.map +1 -1
  231. package/dist/elements/PublishButton/index.css +1 -0
  232. package/dist/elements/PublishButton/index.d.ts.map +1 -1
  233. package/dist/elements/PublishButton/index.js +16 -31
  234. package/dist/elements/PublishButton/index.js.map +1 -1
  235. package/dist/elements/PublishMany/DrawerContent.d.ts.map +1 -1
  236. package/dist/elements/PublishMany/DrawerContent.js +2 -3
  237. package/dist/elements/PublishMany/DrawerContent.js.map +1 -1
  238. package/dist/elements/QueryPresets/QueryPresetBar/index.d.ts.map +1 -1
  239. package/dist/elements/QueryPresets/QueryPresetBar/index.js +14 -1
  240. package/dist/elements/QueryPresets/QueryPresetBar/index.js.map +1 -1
  241. package/dist/elements/QueryPresets/fields/Heading/index.css +1 -0
  242. package/dist/elements/ReactSelect/types.d.ts +0 -5
  243. package/dist/elements/ReactSelect/types.d.ts.map +1 -1
  244. package/dist/elements/ReactSelect/types.js.map +1 -1
  245. package/dist/elements/RenderTitle/index.css +1 -0
  246. package/dist/elements/RestoreMany/index.d.ts.map +1 -1
  247. package/dist/elements/RestoreMany/index.js +2 -3
  248. package/dist/elements/RestoreMany/index.js.map +1 -1
  249. package/dist/elements/SaveDraftButton/index.d.ts.map +1 -1
  250. package/dist/elements/SaveDraftButton/index.js +2 -3
  251. package/dist/elements/SaveDraftButton/index.js.map +1 -1
  252. package/dist/elements/SelectAll/index.d.ts.map +1 -1
  253. package/dist/elements/SelectAll/index.js +2 -1
  254. package/dist/elements/SelectAll/index.js.map +1 -1
  255. package/dist/elements/SelectRow/index.d.ts.map +1 -1
  256. package/dist/elements/SelectRow/index.js +2 -1
  257. package/dist/elements/SelectRow/index.js.map +1 -1
  258. package/dist/elements/SidebarRow/index.css +5 -1
  259. package/dist/elements/SidebarToggle/index.css +1 -3
  260. package/dist/elements/Status/index.d.ts.map +1 -1
  261. package/dist/elements/Status/index.js +2 -3
  262. package/dist/elements/Status/index.js.map +1 -1
  263. package/dist/elements/StepNav/index.d.ts.map +1 -1
  264. package/dist/elements/StepNav/index.js +10 -14
  265. package/dist/elements/StepNav/index.js.map +1 -1
  266. package/dist/elements/StepNav/types.d.ts +0 -6
  267. package/dist/elements/StepNav/types.d.ts.map +1 -1
  268. package/dist/elements/StepNav/types.js.map +1 -1
  269. package/dist/elements/Table/DefaultCell/fields/Hierarchy/index.css +7 -5
  270. package/dist/elements/Table/DefaultCell/fields/Hierarchy/index.d.ts.map +1 -1
  271. package/dist/elements/Table/DefaultCell/fields/Hierarchy/index.js +3 -14
  272. package/dist/elements/Table/DefaultCell/fields/Hierarchy/index.js.map +1 -1
  273. package/dist/elements/Table/OrderableTable.d.ts.map +1 -1
  274. package/dist/elements/Table/OrderableTable.js +2 -3
  275. package/dist/elements/Table/OrderableTable.js.map +1 -1
  276. package/dist/elements/Table/RelationshipProvider/index.d.ts.map +1 -1
  277. package/dist/elements/Table/RelationshipProvider/index.js +2 -3
  278. package/dist/elements/Table/RelationshipProvider/index.js.map +1 -1
  279. package/dist/elements/Table/index.css +1 -0
  280. package/dist/elements/TableSection/index.css +1 -0
  281. package/dist/elements/Tabs/index.css +1 -0
  282. package/dist/elements/Thumbnail/index.css +1 -0
  283. package/dist/elements/TimezonePicker/index.css +1 -0
  284. package/dist/elements/Tooltip/index.css +7 -0
  285. package/dist/elements/UnpublishButton/index.d.ts.map +1 -1
  286. package/dist/elements/UnpublishButton/index.js +3 -4
  287. package/dist/elements/UnpublishButton/index.js.map +1 -1
  288. package/dist/elements/UnpublishMany/DrawerContent.d.ts.map +1 -1
  289. package/dist/elements/UnpublishMany/DrawerContent.js +2 -3
  290. package/dist/elements/UnpublishMany/DrawerContent.js.map +1 -1
  291. package/dist/elements/UserMenu/LanguageMenu/index.d.ts.map +1 -1
  292. package/dist/elements/UserMenu/LanguageMenu/index.js +39 -83
  293. package/dist/elements/UserMenu/LanguageMenu/index.js.map +1 -1
  294. package/dist/elements/UserMenu/SettingsMenu/index.d.ts.map +1 -1
  295. package/dist/elements/UserMenu/SettingsMenu/index.js +21 -57
  296. package/dist/elements/UserMenu/SettingsMenu/index.js.map +1 -1
  297. package/dist/elements/UserMenu/ThemeMenu/index.d.ts.map +1 -1
  298. package/dist/elements/UserMenu/ThemeMenu/index.js +39 -83
  299. package/dist/elements/UserMenu/ThemeMenu/index.js.map +1 -1
  300. package/dist/elements/UserMenu/index.css +2 -32
  301. package/dist/elements/UserMenu/index.d.ts +0 -1
  302. package/dist/elements/UserMenu/index.d.ts.map +1 -1
  303. package/dist/elements/UserMenu/index.js +51 -77
  304. package/dist/elements/UserMenu/index.js.map +1 -1
  305. package/dist/elements/WhereBuilder/Condition/Relationship/index.js +1 -1
  306. package/dist/elements/WhereBuilder/Condition/Relationship/index.js.map +1 -1
  307. package/dist/elements/WhereBuilder/Condition/index.css +1 -0
  308. package/dist/elements/WhereBuilder/index.css +2 -0
  309. package/dist/exports/client/index.d.ts +2 -4
  310. package/dist/exports/client/index.d.ts.map +1 -1
  311. package/dist/exports/client/index.js +1 -1
  312. package/dist/exports/client/index.js.map +3 -3
  313. package/dist/exports/rsc/index.d.ts +2 -0
  314. package/dist/exports/rsc/index.d.ts.map +1 -1
  315. package/dist/exports/rsc/index.js +2 -0
  316. package/dist/exports/rsc/index.js.map +1 -1
  317. package/dist/fields/Array/index.css +1 -0
  318. package/dist/fields/Array/index.d.ts.map +1 -1
  319. package/dist/fields/Array/index.js +2 -3
  320. package/dist/fields/Array/index.js.map +1 -1
  321. package/dist/fields/Blocks/index.css +1 -0
  322. package/dist/fields/Blocks/index.d.ts.map +1 -1
  323. package/dist/fields/Blocks/index.js +2 -3
  324. package/dist/fields/Blocks/index.js.map +1 -1
  325. package/dist/fields/Checkbox/Input.d.ts +2 -2
  326. package/dist/fields/Checkbox/Input.d.ts.map +1 -1
  327. package/dist/fields/Checkbox/Input.js +152 -134
  328. package/dist/fields/Checkbox/Input.js.map +1 -1
  329. package/dist/fields/Checkbox/index.css +163 -168
  330. package/dist/fields/FieldDescription/index.css +5 -0
  331. package/dist/fields/FieldLabel/index.css +8 -27
  332. package/dist/fields/FieldLabel/index.d.ts.map +1 -1
  333. package/dist/fields/FieldLabel/index.js +4 -5
  334. package/dist/fields/FieldLabel/index.js.map +1 -1
  335. package/dist/fields/Group/index.css +1 -0
  336. package/dist/fields/RadioGroup/Radio/index.css +1 -0
  337. package/dist/fields/RadioGroup/index.css +1 -1
  338. package/dist/fields/Relationship/Input.d.ts.map +1 -1
  339. package/dist/fields/Relationship/Input.js +8 -27
  340. package/dist/fields/Relationship/Input.js.map +1 -1
  341. package/dist/fields/Relationship/optionsReducer.d.ts.map +1 -1
  342. package/dist/fields/Relationship/optionsReducer.js +0 -2
  343. package/dist/fields/Relationship/optionsReducer.js.map +1 -1
  344. package/dist/fields/Relationship/types.d.ts +0 -24
  345. package/dist/fields/Relationship/types.d.ts.map +1 -1
  346. package/dist/fields/Relationship/types.js.map +1 -1
  347. package/dist/fields/Row/index.css +2 -0
  348. package/dist/fields/Slug/index.d.ts.map +1 -1
  349. package/dist/fields/Slug/index.js +2 -3
  350. package/dist/fields/Slug/index.js.map +1 -1
  351. package/dist/fields/Tabs/index.css +1 -0
  352. package/dist/fields/Textarea/index.css +1 -1
  353. package/dist/fields/Upload/Input.d.ts.map +1 -1
  354. package/dist/fields/Upload/Input.js +2 -3
  355. package/dist/fields/Upload/Input.js.map +1 -1
  356. package/dist/fields/shared/index.d.ts +1 -1
  357. package/dist/fields/shared/index.d.ts.map +1 -1
  358. package/dist/fields/shared/index.js.map +1 -1
  359. package/dist/forms/Form/context.d.ts +3 -1
  360. package/dist/forms/Form/context.d.ts.map +1 -1
  361. package/dist/forms/Form/context.js +3 -1
  362. package/dist/forms/Form/context.js.map +1 -1
  363. package/dist/forms/Form/index.d.ts.map +1 -1
  364. package/dist/forms/Form/index.js +15 -7
  365. package/dist/forms/Form/index.js.map +1 -1
  366. package/dist/forms/NullifyField/index.d.ts.map +1 -1
  367. package/dist/forms/NullifyField/index.js +2 -3
  368. package/dist/forms/NullifyField/index.js.map +1 -1
  369. package/dist/forms/RenderFields/index.css +1 -7
  370. package/dist/forms/fieldSchemasToFormState/renderField.d.ts.map +1 -1
  371. package/dist/forms/fieldSchemasToFormState/renderField.js +3 -2
  372. package/dist/forms/fieldSchemasToFormState/renderField.js.map +1 -1
  373. package/dist/forms/fieldSchemasToFormState/serverFunctions/mergeAllowedFieldOverrides.d.ts +12 -0
  374. package/dist/forms/fieldSchemasToFormState/serverFunctions/mergeAllowedFieldOverrides.d.ts.map +1 -0
  375. package/dist/forms/fieldSchemasToFormState/serverFunctions/mergeAllowedFieldOverrides.js +42 -0
  376. package/dist/forms/fieldSchemasToFormState/serverFunctions/mergeAllowedFieldOverrides.js.map +1 -0
  377. package/dist/forms/fieldSchemasToFormState/serverFunctions/renderFieldServerFn.d.ts +8 -6
  378. package/dist/forms/fieldSchemasToFormState/serverFunctions/renderFieldServerFn.d.ts.map +1 -1
  379. package/dist/forms/fieldSchemasToFormState/serverFunctions/renderFieldServerFn.js +22 -9
  380. package/dist/forms/fieldSchemasToFormState/serverFunctions/renderFieldServerFn.js.map +1 -1
  381. package/dist/forms/fieldSchemasToFormState/types.d.ts +1 -0
  382. package/dist/forms/fieldSchemasToFormState/types.d.ts.map +1 -1
  383. package/dist/forms/fieldSchemasToFormState/types.js.map +1 -1
  384. package/dist/hooks/useControllableState.js +3 -3
  385. package/dist/hooks/useControllableState.js.map +1 -1
  386. package/dist/hooks/usePayloadAPI.d.ts.map +1 -1
  387. package/dist/hooks/usePayloadAPI.js +2 -3
  388. package/dist/hooks/usePayloadAPI.js.map +1 -1
  389. package/dist/layouts/Root/index.d.ts.map +1 -1
  390. package/dist/layouts/Root/index.js +19 -5
  391. package/dist/layouts/Root/index.js.map +1 -1
  392. package/dist/providers/DocumentInfo/index.d.ts.map +1 -1
  393. package/dist/providers/DocumentInfo/index.js +32 -22
  394. package/dist/providers/DocumentInfo/index.js.map +1 -1
  395. package/dist/providers/Hierarchy/index.d.ts.map +1 -1
  396. package/dist/providers/Hierarchy/index.js +24 -53
  397. package/dist/providers/Hierarchy/index.js.map +1 -1
  398. package/dist/providers/Hierarchy/types.d.ts +0 -2
  399. package/dist/providers/Hierarchy/types.d.ts.map +1 -1
  400. package/dist/providers/Hierarchy/types.js.map +1 -1
  401. package/dist/providers/LivePreview/index.d.ts.map +1 -1
  402. package/dist/providers/LivePreview/index.js +13 -6
  403. package/dist/providers/LivePreview/index.js.map +1 -1
  404. package/dist/providers/Locale/index.d.ts +1 -5
  405. package/dist/providers/Locale/index.d.ts.map +1 -1
  406. package/dist/providers/Locale/index.js +61 -140
  407. package/dist/providers/Locale/index.js.map +1 -1
  408. package/dist/providers/Root/index.d.ts +4 -1
  409. package/dist/providers/Root/index.d.ts.map +1 -1
  410. package/dist/providers/Root/index.js +25 -16
  411. package/dist/providers/Root/index.js.map +1 -1
  412. package/dist/providers/Selection/index.d.ts.map +1 -1
  413. package/dist/providers/Selection/index.js +2 -3
  414. package/dist/providers/Selection/index.js.map +1 -1
  415. package/dist/providers/ServerFunctions/index.d.ts +5 -1
  416. package/dist/providers/ServerFunctions/index.d.ts.map +1 -1
  417. package/dist/providers/ServerFunctions/index.js +15 -0
  418. package/dist/providers/ServerFunctions/index.js.map +1 -1
  419. package/dist/providers/TableColumns/buildColumnState/index.d.ts.map +1 -1
  420. package/dist/providers/TableColumns/buildColumnState/index.js +0 -1
  421. package/dist/providers/TableColumns/buildColumnState/index.js.map +1 -1
  422. package/dist/providers/Theme/index.d.ts +17 -1
  423. package/dist/providers/Theme/index.d.ts.map +1 -1
  424. package/dist/providers/Theme/index.js +253 -81
  425. package/dist/providers/Theme/index.js.map +1 -1
  426. package/dist/providers/Theme/shared.d.ts +8 -0
  427. package/dist/providers/Theme/shared.d.ts.map +1 -1
  428. package/dist/providers/Theme/shared.js +6 -0
  429. package/dist/providers/Theme/shared.js.map +1 -1
  430. package/dist/styles.css +182 -23
  431. package/dist/templates/Default/Wrapper/index.css +3 -2
  432. package/dist/templates/Default/Wrapper/index.d.ts +0 -2
  433. package/dist/templates/Default/Wrapper/index.d.ts.map +1 -1
  434. package/dist/templates/Default/Wrapper/index.js +6 -12
  435. package/dist/templates/Default/Wrapper/index.js.map +1 -1
  436. package/dist/templates/Default/index.css +2 -3
  437. package/dist/templates/Default/index.d.ts.map +1 -1
  438. package/dist/templates/Default/index.js +15 -17
  439. package/dist/templates/Default/index.js.map +1 -1
  440. package/dist/utilities/buildFormState.d.ts.map +1 -1
  441. package/dist/utilities/buildFormState.js +6 -2
  442. package/dist/utilities/buildFormState.js.map +1 -1
  443. package/dist/utilities/formatAbsoluteURL.d.ts +1 -1
  444. package/dist/utilities/formatAbsoluteURL.d.ts.map +1 -1
  445. package/dist/utilities/formatAbsoluteURL.js +18 -8
  446. package/dist/utilities/formatAbsoluteURL.js.map +1 -1
  447. package/dist/utilities/getHasScheduledPublish.d.ts +2 -3
  448. package/dist/utilities/getHasScheduledPublish.d.ts.map +1 -1
  449. package/dist/utilities/getHasScheduledPublish.js +2 -5
  450. package/dist/utilities/getHasScheduledPublish.js.map +1 -1
  451. package/dist/utilities/handleAuthRedirect.d.ts.map +1 -1
  452. package/dist/utilities/handleAuthRedirect.js +4 -1
  453. package/dist/utilities/handleAuthRedirect.js.map +1 -1
  454. package/dist/utilities/handleServerFunctions.d.ts.map +1 -1
  455. package/dist/utilities/handleServerFunctions.js +4 -2
  456. package/dist/utilities/handleServerFunctions.js.map +1 -1
  457. package/dist/utilities/initReq.d.ts.map +1 -1
  458. package/dist/utilities/initReq.js +40 -5
  459. package/dist/utilities/initReq.js.map +1 -1
  460. package/dist/utilities/isAbsoluteURL.d.ts +3 -0
  461. package/dist/utilities/isAbsoluteURL.d.ts.map +1 -0
  462. package/dist/utilities/isAbsoluteURL.js +15 -0
  463. package/dist/utilities/isAbsoluteURL.js.map +1 -0
  464. package/dist/utilities/isHttpURL.d.ts +3 -0
  465. package/dist/utilities/isHttpURL.d.ts.map +1 -0
  466. package/dist/utilities/isHttpURL.js +12 -0
  467. package/dist/utilities/isHttpURL.js.map +1 -0
  468. package/dist/utilities/isPathMatchingRoute.d.ts.map +1 -1
  469. package/dist/utilities/isPathMatchingRoute.js +7 -5
  470. package/dist/utilities/isPathMatchingRoute.js.map +1 -1
  471. package/dist/utilities/isPublicAdminRoute.d.ts.map +1 -1
  472. package/dist/utilities/isPublicAdminRoute.js +9 -6
  473. package/dist/utilities/isPublicAdminRoute.js.map +1 -1
  474. package/dist/utilities/schedulePublishHandler.d.ts +8 -1
  475. package/dist/utilities/schedulePublishHandler.d.ts.map +1 -1
  476. package/dist/utilities/schedulePublishHandler.js +72 -5
  477. package/dist/utilities/schedulePublishHandler.js.map +1 -1
  478. package/dist/utilities/serverFunctionRegistry.d.ts.map +1 -1
  479. package/dist/utilities/serverFunctionRegistry.js +2 -1
  480. package/dist/utilities/serverFunctionRegistry.js.map +1 -1
  481. package/dist/utilities/slugify.d.ts.map +1 -1
  482. package/dist/utilities/slugify.js +2 -0
  483. package/dist/utilities/slugify.js.map +1 -1
  484. package/dist/views/API/index.client.d.ts.map +1 -1
  485. package/dist/views/API/index.client.js +2 -3
  486. package/dist/views/API/index.client.js.map +1 -1
  487. package/dist/views/API/index.css +1 -0
  488. package/dist/views/Account/index.d.ts +1 -1
  489. package/dist/views/Account/index.d.ts.map +1 -1
  490. package/dist/views/Account/index.js +8 -5
  491. package/dist/views/Account/index.js.map +1 -1
  492. package/dist/views/Dashboard/Default/ModularDashboard/index.css +2 -0
  493. package/dist/views/Dashboard/Default/ModularDashboard/index.d.ts.map +1 -1
  494. package/dist/views/Dashboard/Default/ModularDashboard/index.js +1 -0
  495. package/dist/views/Dashboard/Default/ModularDashboard/index.js.map +1 -1
  496. package/dist/views/Dashboard/Default/ModularDashboard/renderWidget/getDefaultLayoutServerFn.d.ts.map +1 -1
  497. package/dist/views/Dashboard/Default/ModularDashboard/renderWidget/getDefaultLayoutServerFn.js +3 -1
  498. package/dist/views/Dashboard/Default/ModularDashboard/renderWidget/getDefaultLayoutServerFn.js.map +1 -1
  499. package/dist/views/Dashboard/Default/ModularDashboard/renderWidget/renderWidgetServerFn.d.ts.map +1 -1
  500. package/dist/views/Dashboard/Default/ModularDashboard/renderWidget/renderWidgetServerFn.js +2 -0
  501. package/dist/views/Dashboard/Default/ModularDashboard/renderWidget/renderWidgetServerFn.js.map +1 -1
  502. package/dist/views/Dashboard/index.d.ts.map +1 -1
  503. package/dist/views/Dashboard/index.js +2 -3
  504. package/dist/views/Dashboard/index.js.map +1 -1
  505. package/dist/views/Document/handleServerFunction.d.ts.map +1 -1
  506. package/dist/views/Document/handleServerFunction.js +2 -0
  507. package/dist/views/Document/handleServerFunction.js.map +1 -1
  508. package/dist/views/Document/index.d.ts +1 -1
  509. package/dist/views/Document/index.d.ts.map +1 -1
  510. package/dist/views/Document/index.js +10 -6
  511. package/dist/views/Document/index.js.map +1 -1
  512. package/dist/views/Document/renderDocumentSlots.d.ts +1 -0
  513. package/dist/views/Document/renderDocumentSlots.d.ts.map +1 -1
  514. package/dist/views/Document/renderDocumentSlots.js +7 -4
  515. package/dist/views/Document/renderDocumentSlots.js.map +1 -1
  516. package/dist/views/Edit/Auth/APIKey.d.ts +1 -1
  517. package/dist/views/Edit/Auth/APIKey.d.ts.map +1 -1
  518. package/dist/views/Edit/Auth/APIKey.js +233 -59
  519. package/dist/views/Edit/Auth/APIKey.js.map +1 -1
  520. package/dist/views/Edit/Auth/APIKeyGenerationModal.d.ts +12 -0
  521. package/dist/views/Edit/Auth/APIKeyGenerationModal.d.ts.map +1 -0
  522. package/dist/views/Edit/Auth/APIKeyGenerationModal.js +117 -0
  523. package/dist/views/Edit/Auth/APIKeyGenerationModal.js.map +1 -0
  524. package/dist/views/Edit/Auth/index.css +91 -0
  525. package/dist/views/Edit/Auth/index.d.ts.map +1 -1
  526. package/dist/views/Edit/Auth/index.js +10 -28
  527. package/dist/views/Edit/Auth/index.js.map +1 -1
  528. package/dist/views/Edit/Auth/types.d.ts +3 -1
  529. package/dist/views/Edit/Auth/types.d.ts.map +1 -1
  530. package/dist/views/Edit/Auth/types.js.map +1 -1
  531. package/dist/views/Edit/index.css +44 -0
  532. package/dist/views/Edit/index.d.ts.map +1 -1
  533. package/dist/views/Edit/index.js +13 -0
  534. package/dist/views/Edit/index.js.map +1 -1
  535. package/dist/views/Edit/useEditViewWidth.d.ts +8 -0
  536. package/dist/views/Edit/useEditViewWidth.d.ts.map +1 -0
  537. package/dist/views/Edit/useEditViewWidth.js +56 -0
  538. package/dist/views/Edit/useEditViewWidth.js.map +1 -0
  539. package/dist/views/ForgotPassword/ForgotPasswordForm/index.css +14 -0
  540. package/dist/views/ForgotPassword/ForgotPasswordForm/index.d.ts.map +1 -1
  541. package/dist/views/ForgotPassword/ForgotPasswordForm/index.js +209 -161
  542. package/dist/views/ForgotPassword/ForgotPasswordForm/index.js.map +1 -1
  543. package/dist/views/ForgotPassword/index.d.ts.map +1 -1
  544. package/dist/views/ForgotPassword/index.js +2 -11
  545. package/dist/views/ForgotPassword/index.js.map +1 -1
  546. package/dist/views/HierarchyList/DocumentListSelection/index.d.ts.map +1 -1
  547. package/dist/views/HierarchyList/DocumentListSelection/index.js +105 -100
  548. package/dist/views/HierarchyList/DocumentListSelection/index.js.map +1 -1
  549. package/dist/views/HierarchyList/HierarchyListHeader/index.d.ts +1 -6
  550. package/dist/views/HierarchyList/HierarchyListHeader/index.d.ts.map +1 -1
  551. package/dist/views/HierarchyList/HierarchyListHeader/index.js +8 -10
  552. package/dist/views/HierarchyList/HierarchyListHeader/index.js.map +1 -1
  553. package/dist/views/HierarchyList/HierarchyTable/ChildNameCell.d.ts.map +1 -1
  554. package/dist/views/HierarchyList/HierarchyTable/ChildNameCell.js +10 -11
  555. package/dist/views/HierarchyList/HierarchyTable/ChildNameCell.js.map +1 -1
  556. package/dist/views/HierarchyList/HierarchyTable/SlotTable.css +1 -0
  557. package/dist/views/HierarchyList/HierarchyTable/SlotTable.d.ts.map +1 -1
  558. package/dist/views/HierarchyList/HierarchyTable/SlotTable.js +6 -3
  559. package/dist/views/HierarchyList/HierarchyTable/SlotTable.js.map +1 -1
  560. package/dist/views/HierarchyList/HierarchyTable/index.css +0 -51
  561. package/dist/views/HierarchyList/HierarchyTable/index.d.ts +1 -13
  562. package/dist/views/HierarchyList/HierarchyTable/index.d.ts.map +1 -1
  563. package/dist/views/HierarchyList/HierarchyTable/index.js +38 -156
  564. package/dist/views/HierarchyList/HierarchyTable/index.js.map +1 -1
  565. package/dist/views/HierarchyList/HierarchyTable/types.d.ts +0 -6
  566. package/dist/views/HierarchyList/HierarchyTable/types.d.ts.map +1 -1
  567. package/dist/views/HierarchyList/HierarchyTable/types.js.map +1 -1
  568. package/dist/views/HierarchyList/index.css +1 -0
  569. package/dist/views/HierarchyList/index.d.ts.map +1 -1
  570. package/dist/views/HierarchyList/index.js +20 -103
  571. package/dist/views/HierarchyList/index.js.map +1 -1
  572. package/dist/views/List/ListHeader/index.css +1 -0
  573. package/dist/views/List/ListHeader/index.d.ts +0 -1
  574. package/dist/views/List/ListHeader/index.d.ts.map +1 -1
  575. package/dist/views/List/ListHeader/index.js +2 -6
  576. package/dist/views/List/ListHeader/index.js.map +1 -1
  577. package/dist/views/List/ListSelection/index.d.ts.map +1 -1
  578. package/dist/views/List/ListSelection/index.js +122 -138
  579. package/dist/views/List/ListSelection/index.js.map +1 -1
  580. package/dist/views/List/handleHierarchy.d.ts +1 -6
  581. package/dist/views/List/handleHierarchy.d.ts.map +1 -1
  582. package/dist/views/List/handleHierarchy.js +3 -34
  583. package/dist/views/List/handleHierarchy.js.map +1 -1
  584. package/dist/views/List/handleServerFunction.d.ts.map +1 -1
  585. package/dist/views/List/handleServerFunction.js +3 -1
  586. package/dist/views/List/handleServerFunction.js.map +1 -1
  587. package/dist/views/List/index.client.d.ts.map +1 -1
  588. package/dist/views/List/index.client.js +6 -129
  589. package/dist/views/List/index.client.js.map +1 -1
  590. package/dist/views/List/index.css +2 -0
  591. package/dist/views/List/index.d.ts.map +1 -1
  592. package/dist/views/List/index.js +18 -28
  593. package/dist/views/List/index.js.map +1 -1
  594. package/dist/views/NotFound/client.d.ts +2 -0
  595. package/dist/views/NotFound/client.d.ts.map +1 -0
  596. package/dist/views/NotFound/client.js +4 -0
  597. package/dist/views/NotFound/client.js.map +1 -0
  598. package/dist/views/NotFound/page.d.ts.map +1 -1
  599. package/dist/views/NotFound/page.js +4 -3
  600. package/dist/views/NotFound/page.js.map +1 -1
  601. package/dist/views/Root/getRouteData.d.ts.map +1 -1
  602. package/dist/views/Root/getRouteData.js +2 -8
  603. package/dist/views/Root/getRouteData.js.map +1 -1
  604. package/dist/views/Root/index.d.ts.map +1 -1
  605. package/dist/views/Root/index.js +31 -22
  606. package/dist/views/Root/index.js.map +1 -1
  607. package/dist/views/Verify/index.d.ts +1 -1
  608. package/dist/views/Verify/index.d.ts.map +1 -1
  609. package/dist/views/Verify/index.js +4 -4
  610. package/dist/views/Verify/index.js.map +1 -1
  611. package/dist/views/Version/Default/SetStepNav.d.ts.map +1 -1
  612. package/dist/views/Version/Default/SetStepNav.js +10 -13
  613. package/dist/views/Version/Default/SetStepNav.js.map +1 -1
  614. package/dist/views/Version/Default/index.css +2 -0
  615. package/dist/views/Version/Default/index.d.ts.map +1 -1
  616. package/dist/views/Version/Default/index.js +12 -13
  617. package/dist/views/Version/Default/index.js.map +1 -1
  618. package/dist/views/Version/RenderFieldsToDiff/DiffCollapser/index.d.ts +1 -0
  619. package/dist/views/Version/RenderFieldsToDiff/DiffCollapser/index.d.ts.map +1 -1
  620. package/dist/views/Version/RenderFieldsToDiff/DiffCollapser/index.js +56 -50
  621. package/dist/views/Version/RenderFieldsToDiff/DiffCollapser/index.js.map +1 -1
  622. package/dist/views/Version/RenderFieldsToDiff/buildVersionFields.d.ts.map +1 -1
  623. package/dist/views/Version/RenderFieldsToDiff/buildVersionFields.js +41 -27
  624. package/dist/views/Version/RenderFieldsToDiff/buildVersionFields.js.map +1 -1
  625. package/dist/views/Version/RenderFieldsToDiff/fields/Date/index.css +8 -0
  626. package/dist/views/Version/RenderFieldsToDiff/fields/Iterable/index.d.ts.map +1 -1
  627. package/dist/views/Version/RenderFieldsToDiff/fields/Iterable/index.js +10 -0
  628. package/dist/views/Version/RenderFieldsToDiff/fields/Iterable/index.js.map +1 -1
  629. package/dist/views/Version/RenderFieldsToDiff/fields/Relationship/index.css +1 -0
  630. package/dist/views/Version/RenderFieldsToDiff/fields/Upload/index.css +1 -0
  631. package/dist/views/Version/RenderFieldsToDiff/index.css +2 -0
  632. package/dist/views/Version/RenderFieldsToDiff/utilities/countChangedFields.d.ts.map +1 -1
  633. package/dist/views/Version/RenderFieldsToDiff/utilities/countChangedFields.js +33 -1
  634. package/dist/views/Version/RenderFieldsToDiff/utilities/countChangedFields.js.map +1 -1
  635. package/dist/views/Version/RenderFieldsToDiff/utilities/getFieldsForRowComparison.d.ts +8 -2
  636. package/dist/views/Version/RenderFieldsToDiff/utilities/getFieldsForRowComparison.d.ts.map +1 -1
  637. package/dist/views/Version/RenderFieldsToDiff/utilities/getFieldsForRowComparison.js +17 -19
  638. package/dist/views/Version/RenderFieldsToDiff/utilities/getFieldsForRowComparison.js.map +1 -1
  639. package/dist/views/Version/Restore/index.d.ts.map +1 -1
  640. package/dist/views/Version/Restore/index.js +9 -6
  641. package/dist/views/Version/Restore/index.js.map +1 -1
  642. package/dist/views/Versions/VersionPillLabel/VersionPillLabel.d.ts.map +1 -1
  643. package/dist/views/Versions/VersionPillLabel/VersionPillLabel.js +2 -3
  644. package/dist/views/Versions/VersionPillLabel/VersionPillLabel.js.map +1 -1
  645. package/dist/views/Versions/VersionPillLabel/index.css +1 -0
  646. package/dist/views/Versions/index.css +1 -0
  647. package/dist/widgets/CollectionCards/index.client.js +1 -1
  648. package/dist/widgets/CollectionCards/index.client.js.map +1 -1
  649. package/dist/widgets/CollectionCards/index.css +43 -33
  650. package/dist/widgets/CollectionCards/index.js +1 -1
  651. package/dist/widgets/CollectionCards/index.js.map +1 -1
  652. package/dist/widgets/RecentlyViewed/DocumentActivity/index.css +193 -0
  653. package/dist/widgets/RecentlyViewed/DocumentActivity/index.d.ts +5 -0
  654. package/dist/widgets/RecentlyViewed/DocumentActivity/index.d.ts.map +1 -0
  655. package/dist/widgets/RecentlyViewed/DocumentActivity/index.js +225 -0
  656. package/dist/widgets/RecentlyViewed/DocumentActivity/index.js.map +1 -0
  657. package/dist/widgets/RecentlyViewed/DocumentItem/index.css +181 -0
  658. package/dist/widgets/RecentlyViewed/DocumentItem/index.d.ts +11 -0
  659. package/dist/widgets/RecentlyViewed/DocumentItem/index.d.ts.map +1 -0
  660. package/dist/widgets/RecentlyViewed/DocumentItem/index.js +104 -0
  661. package/dist/widgets/RecentlyViewed/DocumentItem/index.js.map +1 -0
  662. package/dist/widgets/RecentlyViewed/getDocumentThumbnail.d.ts +10 -0
  663. package/dist/widgets/RecentlyViewed/getDocumentThumbnail.d.ts.map +1 -0
  664. package/dist/widgets/RecentlyViewed/getDocumentThumbnail.js +85 -0
  665. package/dist/widgets/RecentlyViewed/getDocumentThumbnail.js.map +1 -0
  666. package/dist/widgets/RecentlyViewed/getDocumentWidgetData.d.ts +7 -0
  667. package/dist/widgets/RecentlyViewed/getDocumentWidgetData.d.ts.map +1 -0
  668. package/dist/widgets/RecentlyViewed/getDocumentWidgetData.js +206 -0
  669. package/dist/widgets/RecentlyViewed/getDocumentWidgetData.js.map +1 -0
  670. package/dist/widgets/RecentlyViewed/index.d.ts +3 -5
  671. package/dist/widgets/RecentlyViewed/index.d.ts.map +1 -1
  672. package/dist/widgets/RecentlyViewed/index.js +10 -140
  673. package/dist/widgets/RecentlyViewed/index.js.map +1 -1
  674. package/dist/widgets/RecentlyViewed/shared.d.ts +38 -0
  675. package/dist/widgets/RecentlyViewed/shared.d.ts.map +1 -0
  676. package/dist/widgets/RecentlyViewed/shared.js +70 -0
  677. package/dist/widgets/RecentlyViewed/shared.js.map +1 -0
  678. package/dist/widgets/UploadDropzone/index.client.d.ts +7 -0
  679. package/dist/widgets/UploadDropzone/index.client.d.ts.map +1 -0
  680. package/dist/widgets/UploadDropzone/index.client.js +134 -0
  681. package/dist/widgets/UploadDropzone/index.client.js.map +1 -0
  682. package/dist/widgets/UploadDropzone/index.css +50 -0
  683. package/dist/widgets/UploadDropzone/index.d.ts +8 -0
  684. package/dist/widgets/UploadDropzone/index.d.ts.map +1 -0
  685. package/dist/widgets/UploadDropzone/index.js +29 -0
  686. package/dist/widgets/UploadDropzone/index.js.map +1 -0
  687. package/dist/widgets/Welcome/index.css +13 -0
  688. package/dist/widgets/Welcome/index.d.ts +5 -0
  689. package/dist/widgets/Welcome/index.d.ts.map +1 -0
  690. package/dist/widgets/Welcome/index.js +26 -0
  691. package/dist/widgets/Welcome/index.js.map +1 -0
  692. package/dist/widgets/WidgetIcon/assets/images.svg +3 -0
  693. package/dist/widgets/WidgetIcon/assets/pin-solid.svg +3 -0
  694. package/dist/widgets/WidgetIcon/assets/pin.svg +3 -0
  695. package/dist/widgets/WidgetIcon/assets/table.svg +3 -0
  696. package/dist/widgets/WidgetIcon/index.css +23 -0
  697. package/dist/widgets/WidgetIcon/index.d.ts +6 -0
  698. package/dist/widgets/WidgetIcon/index.d.ts.map +1 -0
  699. package/dist/widgets/WidgetIcon/index.js +10 -0
  700. package/dist/widgets/WidgetIcon/index.js.map +1 -0
  701. package/package.json +11 -5
  702. package/dist/elements/ClipboardAction/clipboardUtilities.spec.js +0 -120
  703. package/dist/elements/ClipboardAction/clipboardUtilities.spec.js.map +0 -1
  704. package/dist/elements/ClipboardAction/isClipboardDataValid.spec.js +0 -144
  705. package/dist/elements/ClipboardAction/isClipboardDataValid.spec.js.map +0 -1
  706. package/dist/elements/ClipboardAction/mergeFormStateFromClipboard.spec.js +0 -885
  707. package/dist/elements/ClipboardAction/mergeFormStateFromClipboard.spec.js.map +0 -1
  708. package/dist/elements/ColumnSelection/matchesColumnSearch.spec.js +0 -87
  709. package/dist/elements/ColumnSelection/matchesColumnSearch.spec.js.map +0 -1
  710. package/dist/elements/CommandPalette/buildActions.spec.js +0 -158
  711. package/dist/elements/CommandPalette/buildActions.spec.js.map +0 -1
  712. package/dist/elements/CommandPalette/highlightLabel.spec.js +0 -78
  713. package/dist/elements/CommandPalette/highlightLabel.spec.js.map +0 -1
  714. package/dist/elements/FieldSelect/reduceFieldOptions.spec.js +0 -143
  715. package/dist/elements/FieldSelect/reduceFieldOptions.spec.js.map +0 -1
  716. package/dist/elements/Hierarchy/CreateNewButton/index.css +0 -9
  717. package/dist/elements/Hierarchy/CreateNewButton/index.d.ts +0 -9
  718. package/dist/elements/Hierarchy/CreateNewButton/index.d.ts.map +0 -1
  719. package/dist/elements/Hierarchy/CreateNewButton/index.js +0 -111
  720. package/dist/elements/Hierarchy/CreateNewButton/index.js.map +0 -1
  721. package/dist/elements/Hierarchy/Modal/Footer/index.css +0 -45
  722. package/dist/elements/Hierarchy/Modal/Footer/index.d.ts +0 -28
  723. package/dist/elements/Hierarchy/Modal/Footer/index.d.ts.map +0 -1
  724. package/dist/elements/Hierarchy/Modal/Footer/index.js +0 -166
  725. package/dist/elements/Hierarchy/Modal/Footer/index.js.map +0 -1
  726. package/dist/elements/Hierarchy/getFolderHierarchySlug.d.ts +0 -22
  727. package/dist/elements/Hierarchy/getFolderHierarchySlug.d.ts.map +0 -1
  728. package/dist/elements/Hierarchy/getFolderHierarchySlug.js +0 -17
  729. package/dist/elements/Hierarchy/getFolderHierarchySlug.js.map +0 -1
  730. package/dist/elements/Hierarchy/move/moveDocuments.d.ts +0 -34
  731. package/dist/elements/Hierarchy/move/moveDocuments.d.ts.map +0 -1
  732. package/dist/elements/Hierarchy/move/moveDocuments.js +0 -94
  733. package/dist/elements/Hierarchy/move/moveDocuments.js.map +0 -1
  734. package/dist/elements/SegmentedControl/index.css +0 -58
  735. package/dist/elements/SegmentedControl/index.d.ts +0 -19
  736. package/dist/elements/SegmentedControl/index.d.ts.map +0 -1
  737. package/dist/elements/SegmentedControl/index.js +0 -104
  738. package/dist/elements/SegmentedControl/index.js.map +0 -1
  739. package/dist/elements/StepNav/DropTarget/index.css +0 -20
  740. package/dist/elements/StepNav/DropTarget/index.d.ts +0 -16
  741. package/dist/elements/StepNav/DropTarget/index.d.ts.map +0 -1
  742. package/dist/elements/StepNav/DropTarget/index.js +0 -71
  743. package/dist/elements/StepNav/DropTarget/index.js.map +0 -1
  744. package/dist/elements/Toasts/fieldErrors.spec.js +0 -46
  745. package/dist/elements/Toasts/fieldErrors.spec.js.map +0 -1
  746. package/dist/elements/UserMenu/HoverSubmenuGroup.d.ts +0 -18
  747. package/dist/elements/UserMenu/HoverSubmenuGroup.d.ts.map +0 -1
  748. package/dist/elements/UserMenu/HoverSubmenuGroup.js +0 -38
  749. package/dist/elements/UserMenu/HoverSubmenuGroup.js.map +0 -1
  750. package/dist/elements/UserMenu/useHoverSubmenu.d.ts +0 -21
  751. package/dist/elements/UserMenu/useHoverSubmenu.d.ts.map +0 -1
  752. package/dist/elements/UserMenu/useHoverSubmenu.js +0 -260
  753. package/dist/elements/UserMenu/useHoverSubmenu.js.map +0 -1
  754. package/dist/elements/ViewModeToggle/index.d.ts +0 -8
  755. package/dist/elements/ViewModeToggle/index.d.ts.map +0 -1
  756. package/dist/elements/ViewModeToggle/index.js +0 -29
  757. package/dist/elements/ViewModeToggle/index.js.map +0 -1
  758. package/dist/elements/WhereBuilder/Condition/Relationship/optionsReducer.spec.js +0 -152
  759. package/dist/elements/WhereBuilder/Condition/Relationship/optionsReducer.spec.js.map +0 -1
  760. package/dist/elements/WhereBuilder/conditionValue.spec.js +0 -65
  761. package/dist/elements/WhereBuilder/conditionValue.spec.js.map +0 -1
  762. package/dist/fields/Upload/Input.spec.js +0 -241
  763. package/dist/fields/Upload/Input.spec.js.map +0 -1
  764. package/dist/forms/fieldSchemasToFormState/fieldSchemasToFormState.spec.d.ts +0 -2
  765. package/dist/forms/fieldSchemasToFormState/fieldSchemasToFormState.spec.d.ts.map +0 -1
  766. package/dist/forms/fieldSchemasToFormState/fieldSchemasToFormState.spec.js +0 -67
  767. package/dist/forms/fieldSchemasToFormState/fieldSchemasToFormState.spec.js.map +0 -1
  768. package/dist/icons/CollapseLayers/index.d.ts +0 -7
  769. package/dist/icons/CollapseLayers/index.d.ts.map +0 -1
  770. package/dist/icons/CollapseLayers/index.js +0 -23
  771. package/dist/icons/CollapseLayers/index.js.map +0 -1
  772. package/dist/icons/Table/index.css +0 -5
  773. package/dist/icons/Table/index.d.ts +0 -7
  774. package/dist/icons/Table/index.d.ts.map +0 -1
  775. package/dist/icons/Table/index.js +0 -25
  776. package/dist/icons/Table/index.js.map +0 -1
  777. package/dist/layouts/Root/index.spec.js +0 -20
  778. package/dist/layouts/Root/index.spec.js.map +0 -1
  779. package/dist/providers/Auth/authSessionRequests.spec.js +0 -121
  780. package/dist/providers/Auth/authSessionRequests.spec.js.map +0 -1
  781. package/dist/providers/Auth/sessionActivity.spec.js +0 -44
  782. package/dist/providers/Auth/sessionActivity.spec.js.map +0 -1
  783. package/dist/providers/Auth/tabSessionSync/index.spec.js +0 -463
  784. package/dist/providers/Auth/tabSessionSync/index.spec.js.map +0 -1
  785. package/dist/providers/Auth/useAuthSessionTimers.spec.js +0 -311
  786. package/dist/providers/Auth/useAuthSessionTimers.spec.js.map +0 -1
  787. package/dist/providers/HierarchyDnd/index.css +0 -51
  788. package/dist/providers/HierarchyDnd/index.d.ts +0 -21
  789. package/dist/providers/HierarchyDnd/index.d.ts.map +0 -1
  790. package/dist/providers/HierarchyDnd/index.js +0 -163
  791. package/dist/providers/HierarchyDnd/index.js.map +0 -1
  792. package/dist/providers/HierarchyDnd/types.d.ts +0 -56
  793. package/dist/providers/HierarchyDnd/types.d.ts.map +0 -1
  794. package/dist/providers/HierarchyDnd/types.js +0 -21
  795. package/dist/providers/HierarchyDnd/types.js.map +0 -1
  796. package/dist/providers/RouteTransition/ProgressBar/index.spec.js +0 -44
  797. package/dist/providers/RouteTransition/ProgressBar/index.spec.js.map +0 -1
  798. package/dist/providers/TableColumns/buildColumnState/index.spec.js +0 -40
  799. package/dist/providers/TableColumns/buildColumnState/index.spec.js.map +0 -1
  800. package/dist/utilities/appendCacheTag.spec.js +0 -34
  801. package/dist/utilities/appendCacheTag.spec.js.map +0 -1
  802. package/dist/utilities/formatMetadata.spec.js +0 -83
  803. package/dist/utilities/formatMetadata.spec.js.map +0 -1
  804. package/dist/utilities/fuzzyMatch.spec.js +0 -38
  805. package/dist/utilities/fuzzyMatch.spec.js.map +0 -1
  806. package/dist/utilities/isCustomAdminView.spec.js +0 -90
  807. package/dist/utilities/isCustomAdminView.spec.js.map +0 -1
  808. package/dist/utilities/isPathMatchingRoute.spec.js +0 -178
  809. package/dist/utilities/isPathMatchingRoute.spec.js.map +0 -1
  810. package/dist/utilities/normalizeRelationshipValue.spec.js +0 -373
  811. package/dist/utilities/normalizeRelationshipValue.spec.js.map +0 -1
  812. package/dist/utilities/recentlyViewed.spec.js +0 -92
  813. package/dist/utilities/recentlyViewed.spec.js.map +0 -1
  814. package/dist/views/HierarchyList/HierarchyCards/DocumentCard/index.css +0 -216
  815. package/dist/views/HierarchyList/HierarchyCards/DocumentCard/index.d.ts +0 -20
  816. package/dist/views/HierarchyList/HierarchyCards/DocumentCard/index.d.ts.map +0 -1
  817. package/dist/views/HierarchyList/HierarchyCards/DocumentCard/index.js +0 -182
  818. package/dist/views/HierarchyList/HierarchyCards/DocumentCard/index.js.map +0 -1
  819. package/dist/views/HierarchyList/HierarchyCards/DragPreviewItem/index.css +0 -38
  820. package/dist/views/HierarchyList/HierarchyCards/DragPreviewItem/index.d.ts +0 -15
  821. package/dist/views/HierarchyList/HierarchyCards/DragPreviewItem/index.d.ts.map +0 -1
  822. package/dist/views/HierarchyList/HierarchyCards/DragPreviewItem/index.js +0 -85
  823. package/dist/views/HierarchyList/HierarchyCards/DragPreviewItem/index.js.map +0 -1
  824. package/dist/views/HierarchyList/HierarchyCards/FolderCard/index.css +0 -98
  825. package/dist/views/HierarchyList/HierarchyCards/FolderCard/index.d.ts +0 -27
  826. package/dist/views/HierarchyList/HierarchyCards/FolderCard/index.d.ts.map +0 -1
  827. package/dist/views/HierarchyList/HierarchyCards/FolderCard/index.js +0 -84
  828. package/dist/views/HierarchyList/HierarchyCards/FolderCard/index.js.map +0 -1
  829. package/dist/views/HierarchyList/HierarchyCards/HierarchyCard/index.d.ts +0 -19
  830. package/dist/views/HierarchyList/HierarchyCards/HierarchyCard/index.d.ts.map +0 -1
  831. package/dist/views/HierarchyList/HierarchyCards/HierarchyCard/index.js +0 -100
  832. package/dist/views/HierarchyList/HierarchyCards/HierarchyCard/index.js.map +0 -1
  833. package/dist/views/HierarchyList/HierarchyCards/PlaneItem/index.d.ts +0 -53
  834. package/dist/views/HierarchyList/HierarchyCards/PlaneItem/index.d.ts.map +0 -1
  835. package/dist/views/HierarchyList/HierarchyCards/PlaneItem/index.js +0 -145
  836. package/dist/views/HierarchyList/HierarchyCards/PlaneItem/index.js.map +0 -1
  837. package/dist/views/HierarchyList/HierarchyCards/getThumbnailSrc.d.ts +0 -8
  838. package/dist/views/HierarchyList/HierarchyCards/getThumbnailSrc.d.ts.map +0 -1
  839. package/dist/views/HierarchyList/HierarchyCards/getThumbnailSrc.js +0 -21
  840. package/dist/views/HierarchyList/HierarchyCards/getThumbnailSrc.js.map +0 -1
  841. package/dist/views/HierarchyList/HierarchyCards/index.css +0 -115
  842. package/dist/views/HierarchyList/HierarchyCards/index.d.ts +0 -80
  843. package/dist/views/HierarchyList/HierarchyCards/index.d.ts.map +0 -1
  844. package/dist/views/HierarchyList/HierarchyCards/index.js +0 -457
  845. package/dist/views/HierarchyList/HierarchyCards/index.js.map +0 -1
  846. package/dist/views/Root/getCustomCollectionViewByRoute.spec.js +0 -168
  847. package/dist/views/Root/getCustomCollectionViewByRoute.spec.js.map +0 -1
  848. package/dist/views/Version/RenderFieldsToDiff/utilities/countChangedFields.spec.js +0 -861
  849. package/dist/views/Version/RenderFieldsToDiff/utilities/countChangedFields.spec.js.map +0 -1
  850. package/dist/views/Version/RenderFieldsToDiff/utilities/fieldHasChanges.spec.js +0 -47
  851. package/dist/views/Version/RenderFieldsToDiff/utilities/fieldHasChanges.spec.js.map +0 -1
  852. package/dist/views/Version/RenderFieldsToDiff/utilities/getFieldsForRowComparison.spec.js +0 -135
  853. package/dist/views/Version/RenderFieldsToDiff/utilities/getFieldsForRowComparison.spec.js.map +0 -1
  854. package/dist/widgets/CollectionQuery/getCollectionFieldPaths.spec.js +0 -100
  855. package/dist/widgets/CollectionQuery/getCollectionFieldPaths.spec.js.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SelectedHierarchies.js","names":["formatAdminURL","qs","React","useEffect","useMemo","useRef","useState","useConfig","useTranslation","Chip","Spinner","baseClass","SelectedHierarchies","hierarchySlug","Icon","onRemove","readOnly","selectedIds","config","getEntityConfig","i18n","items","setItems","isInitialLoad","setIsInitialLoad","prevSelectedIdsRef","routes","api","serverURL","collectionConfig","collectionSlug","selectedIdsKey","slice","sort","join","length","current","fetchItems","useAsTitle","admin","query","depth","limit","select","where","id","in","queryString","stringify","url","apiRoute","path","response","fetch","credentials","headers","language","ok","data","json","fetchedItems","docs","map","doc","docId","titleValue","title","String","orderedItems","find","item","filter","undefined","_jsx","className","size","SelectedPill","disabled","icon"],"sources":["../../../../src/elements/Hierarchy/Field/SelectedHierarchies.tsx"],"sourcesContent":["'use client'\nimport { formatAdminURL } from 'payload/shared'\nimport * as qs from 'qs-esm'\nimport React, { useEffect, useMemo, useRef, useState } from 'react'\n\nimport { useConfig } from '../../../providers/Config/index.js'\nimport { useTranslation } from '../../../providers/Translation/index.js'\nimport { Chip } from '../../Chip/index.js'\nimport { Spinner } from '../../Spinner/index.js'\nimport './SelectedHierarchies.css'\n\nconst baseClass = 'selected-hierarchies'\n\ntype HierarchyItem = {\n id: number | string\n title: string\n}\n\nexport type SelectedHierarchiesProps = {\n hierarchySlug: string\n Icon?: React.ReactNode\n onRemove: ({ id }: { id: number | string }) => void\n readOnly?: boolean\n selectedIds: (number | string)[]\n}\n\nexport const SelectedHierarchies: React.FC<SelectedHierarchiesProps> = ({\n hierarchySlug,\n Icon,\n onRemove,\n readOnly = false,\n selectedIds,\n}) => {\n const { config, getEntityConfig } = useConfig()\n const { i18n } = useTranslation()\n const [items, setItems] = useState<HierarchyItem[]>([])\n const [isInitialLoad, setIsInitialLoad] = useState(true)\n\n const prevSelectedIdsRef = useRef<string>('')\n\n const {\n routes: { api },\n serverURL,\n } = config\n\n const collectionConfig = getEntityConfig({ collectionSlug: hierarchySlug })\n\n const selectedIdsKey = useMemo(() => selectedIds.slice().sort().join(','), [selectedIds])\n\n useEffect(() => {\n if (!selectedIds || selectedIds.length === 0) {\n setItems([])\n setIsInitialLoad(false)\n return\n }\n\n if (prevSelectedIdsRef.current === selectedIdsKey) {\n return\n }\n prevSelectedIdsRef.current = selectedIdsKey\n\n const fetchItems = async () => {\n const useAsTitle = collectionConfig?.admin?.useAsTitle || 'id'\n\n const query = {\n depth: 0,\n limit: selectedIds.length,\n select: {\n [useAsTitle]: true,\n },\n where: {\n id: {\n in: selectedIds,\n },\n },\n }\n\n const queryString = qs.stringify(query)\n\n try {\n const url = formatAdminURL({\n apiRoute: api,\n path: `/${hierarchySlug}?${queryString}`,\n serverURL,\n })\n\n const response = await fetch(url, {\n credentials: 'include',\n headers: {\n 'Accept-Language': i18n.language,\n },\n })\n\n if (response.ok) {\n const data = await response.json()\n const fetchedItems: HierarchyItem[] = data.docs.map((doc: Record<string, unknown>) => {\n const docId = doc.id as number | string\n const titleValue = doc[useAsTitle] ?? docId\n const title =\n typeof titleValue === 'string' || typeof titleValue === 'number'\n ? String(titleValue)\n : String(docId)\n return {\n id: docId,\n title,\n }\n })\n\n // Order by selectedIds to preserve selection order\n const orderedItems = selectedIds\n .map((id) => fetchedItems.find((item) => item.id === id))\n .filter((item): item is HierarchyItem => item !== undefined)\n\n setItems(orderedItems)\n }\n } catch {\n // Silently fail - items will remain empty\n } finally {\n setIsInitialLoad(false)\n }\n }\n\n void fetchItems()\n }, [selectedIds, selectedIdsKey, hierarchySlug, collectionConfig, serverURL, api, i18n.language])\n\n if (isInitialLoad) {\n return (\n <div className={`${baseClass}__loading`}>\n <Spinner size=\"sm\" />\n </div>\n )\n }\n\n if (items.length === 0) {\n return null\n }\n\n return (\n <div className={baseClass}>\n <div className={`${baseClass}__pills`}>\n {items.map((item) => (\n <SelectedPill\n Icon={Icon}\n item={item}\n key={item.id}\n onRemove={onRemove}\n readOnly={readOnly}\n />\n ))}\n </div>\n </div>\n )\n}\n\ntype SelectedPillProps = {\n Icon?: React.ReactNode\n item: HierarchyItem\n onRemove: ({ id }: { id: number | string }) => void\n readOnly: boolean\n}\n\nconst SelectedPill: React.FC<SelectedPillProps> = ({ Icon, item, onRemove, readOnly }) => {\n return (\n <Chip\n className={`${baseClass}__pill`}\n disabled={readOnly}\n icon={Icon}\n onRemove={() => onRemove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AA,CAAKzB;IAAG;IACvC8B,IAAA,EAAK;cAEJL,IAAA,CAAKJ;;AAGZ","ignoreList":[]}
@@ -4,10 +4,5 @@ import './index.css';
4
4
  export type HierarchyFieldClientProps = {
5
5
  Icon?: React.ReactNode;
6
6
  } & RelationshipFieldClientProps;
7
- /**
8
- * Renders a hierarchy relationship (e.g. tags) as a standard relationship input, swapping the
9
- * "create new document" button for one that opens the hierarchy column browser. Options are
10
- * labelled with their full ancestor path while browsing so same-named items stay distinguishable.
11
- */
12
7
  export declare const HierarchyFieldClient: React.FC<HierarchyFieldClientProps>;
13
8
  //# sourceMappingURL=index.client.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.client.d.ts","sourceRoot":"","sources":["../../../../src/elements/Hierarchy/Field/index.client.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,4BAA4B,EAAqB,MAAM,SAAS,CAAA;AAG9E,OAAO,KAAyC,MAAM,OAAO,CAAA;AAc7D,OAAO,aAAa,CAAA;AAUpB,MAAM,MAAM,yBAAyB,GAAG;IACtC,IAAI,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;CACvB,GAAG,4BAA4B,CAAA;AAEhC;;;;GAIG;AACH,eAAO,MAAM,oBAAoB,EAAE,KAAK,CAAC,EAAE,CAAC,yBAAyB,CAoPpE,CAAA"}
1
+ {"version":3,"file":"index.client.d.ts","sourceRoot":"","sources":["../../../../src/elements/Hierarchy/Field/index.client.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,SAAS,CAAA;AAG3D,OAAO,KAA+B,MAAM,OAAO,CAAA;AAkBnD,OAAO,aAAa,CAAA;AAMpB,MAAM,MAAM,yBAAyB,GAAG;IACtC,IAAI,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;CACvB,GAAG,4BAA4B,CAAA;AAEhC,eAAO,MAAM,oBAAoB,EAAE,KAAK,CAAC,EAAE,CAAC,yBAAyB,CA2LpE,CAAA"}
@@ -2,34 +2,30 @@
2
2
 
3
3
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
4
4
  import { getTranslation } from '@payloadcms/translations';
5
- import React, { Fragment, useCallback, useMemo } from 'react';
5
+ import React, { useCallback, useMemo } from 'react';
6
+ import { FieldDescription } from '../../../fields/FieldDescription/index.js';
7
+ import { FieldError } from '../../../fields/FieldError/index.js';
8
+ import { FieldLabel } from '../../../fields/FieldLabel/index.js';
6
9
  import { mergeFieldStyles } from '../../../fields/mergeFieldStyles.js';
7
- import { RelationshipInput } from '../../../fields/Relationship/Input.js';
10
+ import { fieldBaseClass } from '../../../fields/shared/index.js';
8
11
  import { useField } from '../../../forms/useField/index.js';
9
- import { TagIcon } from '../../../icons/Tag/index.js';
12
+ import { CirclePlusIcon } from '../../../icons/CirclePlus/index.js';
10
13
  import { useConfig } from '../../../providers/Config/index.js';
11
14
  import { useDocumentInfo } from '../../../providers/DocumentInfo/index.js';
12
15
  import { useTranslation } from '../../../providers/Translation/index.js';
13
16
  import { Button } from '../../Button/index.js';
17
+ import { RenderCustomComponent } from '../../RenderCustomComponent/index.js';
14
18
  import { useHierarchyModal } from '../Modal/useHierarchyModal.js';
19
+ import { SelectedHierarchies } from './SelectedHierarchies.js';
15
20
  import './index.css';
16
21
  const baseClass = 'hierarchy-field';
17
- /** The hierarchy is monomorphic, so the grouped options can be flattened into a single list */
18
- const flattenOptionGroups = groups => groups.map(group => group.options).flat();
19
- /**
20
- * Renders a hierarchy relationship (e.g. tags) as a standard relationship input, swapping the
21
- * "create new document" button for one that opens the hierarchy column browser. Options are
22
- * labelled with their full ancestor path while browsing so same-named items stay distinguishable.
23
- */
24
22
  export const HierarchyFieldClient = props => {
25
23
  const {
26
24
  field,
27
25
  field: {
28
26
  admin: {
29
27
  className,
30
- description,
31
- isSortable = true,
32
- placeholder
28
+ description
33
29
  } = {},
34
30
  hasMany,
35
31
  label,
@@ -56,8 +52,6 @@ export const HierarchyFieldClient = props => {
56
52
  const collectionConfig = getEntityConfig({
57
53
  collectionSlug: hierarchySlug
58
54
  });
59
- const hierarchyConfig = collectionConfig?.hierarchy && typeof collectionConfig.hierarchy === 'object' ? collectionConfig.hierarchy : undefined;
60
- const titlePathFieldName = hierarchyConfig?.titlePathFieldName;
61
55
  const memoizedValidate = useCallback((value, validationOptions) => {
62
56
  if (typeof validate === 'function') {
63
57
  return validate(value, {
@@ -75,8 +69,6 @@ export const HierarchyFieldClient = props => {
75
69
  Label
76
70
  } = {},
77
71
  disabled,
78
- filterOptions,
79
- initialValue,
80
72
  path,
81
73
  setValue,
82
74
  showError,
@@ -85,49 +77,27 @@ export const HierarchyFieldClient = props => {
85
77
  potentiallyStalePath: pathFromProps,
86
78
  validate: memoizedValidate
87
79
  });
88
- const [relationTo] = React.useState(() => [hierarchySlug]);
89
80
  const styles = useMemo(() => mergeFieldStyles(field), [field]);
90
- const toRelationValues = useCallback(ids => {
91
- if (hasMany) {
92
- return Array.isArray(ids) ? ids.map(id => ({
93
- relationTo: hierarchySlug,
94
- value: id
95
- })) : null;
81
+ // Normalize value to array of IDs for display
82
+ const selectedIds = useMemo(() => {
83
+ if (!value_0) {
84
+ return [];
96
85
  }
97
- return ids ? {
98
- relationTo: hierarchySlug,
99
- value: ids
100
- } : null;
101
- }, [hasMany, hierarchySlug]);
102
- const memoizedValue = useMemo(() => toRelationValues(value_0), [toRelationValues, value_0]);
103
- const memoizedInitialValue = useMemo(() => toRelationValues(initialValue), [initialValue, toRelationValues]);
104
- const handleChangeHasMany = useCallback(newValue => {
105
- const ids_0 = Array.isArray(newValue) ? newValue.map(relation => relation.value) : [];
106
- const isUnchanged = Array.isArray(value_0) && value_0.length === ids_0.length && value_0.every((id_0, index) => id_0 === ids_0[index]);
107
- setValue(ids_0, isUnchanged);
108
- }, [setValue, value_0]);
109
- const handleChangeSingle = useCallback(newValue_0 => {
110
- const id_1 = newValue_0?.value ?? null;
111
- setValue(id_1, value_0 === id_1);
112
- }, [setValue, value_0]);
113
- // Selecting the virtual path field is what triggers the server to compute it
114
- const selectOptionFields = useMemo(() => titlePathFieldName ? {
115
- [titlePathFieldName]: true
116
- } : undefined, [titlePathFieldName]);
117
- const formatOptionLabel = useCallback(({
118
- context,
119
- defaultLabel,
120
- doc
121
- }) => {
122
- if (context !== 'menu' || !titlePathFieldName) {
123
- return defaultLabel;
86
+ if (Array.isArray(value_0)) {
87
+ return value_0;
124
88
  }
125
- const titlePath = doc?.[titlePathFieldName];
126
- if (typeof titlePath !== 'string' || !titlePath) {
127
- return defaultLabel;
89
+ return [value_0];
90
+ }, [value_0]);
91
+ // Initialize selections for the modal - use current value so modal expands to current selection
92
+ const initialSelections = useMemo(() => {
93
+ if (!value_0) {
94
+ return [];
95
+ }
96
+ if (Array.isArray(value_0)) {
97
+ return value_0;
128
98
  }
129
- return titlePath.split('/').map(segment => segment.trim()).join(' / ');
130
- }, [titlePathFieldName]);
99
+ return [value_0];
100
+ }, [value_0]);
131
101
  // Memoize to prevent new array references on every render
132
102
  const filterByCollection = useMemo(() => documentCollectionSlug ? [documentCollectionSlug] : undefined, [documentCollectionSlug]);
133
103
  const [HierarchyModal,, {
@@ -137,78 +107,83 @@ export const HierarchyFieldClient = props => {
137
107
  hierarchyCollectionSlug: hierarchySlug,
138
108
  Icon
139
109
  });
140
- // Pass the current value so the browser opens expanded to what is already selected
141
- const initialSelections = useMemo(() => {
142
- if (!value_0) {
143
- return [];
144
- }
145
- return Array.isArray(value_0) ? value_0 : [value_0];
146
- }, [value_0]);
147
110
  const handleModalSave = useCallback(({
148
111
  closeModal,
149
112
  selections
150
113
  }) => {
151
- const ids_1 = Array.from(selections.keys());
152
- setValue(hasMany ? ids_1 : ids_1[0] ?? null);
114
+ const ids = Array.from(selections.keys());
115
+ const newValue = hasMany ? ids : ids[0] ?? null;
116
+ setValue(newValue);
153
117
  closeModal();
154
118
  }, [hasMany, setValue]);
119
+ const handleRemove = useCallback(({
120
+ id: idToRemove
121
+ }) => {
122
+ if (hasMany) {
123
+ const newIds = selectedIds.filter(id => id !== idToRemove);
124
+ setValue(newIds.length > 0 ? newIds : null);
125
+ } else {
126
+ setValue(null);
127
+ }
128
+ }, [hasMany, selectedIds, setValue]);
129
+ const handleOpenModal = useCallback(() => {
130
+ openModal();
131
+ }, [openModal]);
155
132
  const hierarchyLabel = getTranslation(hasMany ? collectionConfig?.labels?.plural : collectionConfig?.labels?.singular, i18n) || hierarchySlug;
156
- const selectLabel = t('general:selectLabel', {
157
- label: hierarchyLabel
158
- });
159
- const BrowseButton = useMemo(() => /*#__PURE__*/_jsx(Button, {
160
- "aria-label": selectLabel,
161
- buttonStyle: "secondary",
162
- className: `${baseClass}__browse-button`,
163
- disabled: disabled,
164
- icon: Icon ?? /*#__PURE__*/_jsx(TagIcon, {}),
165
- margin: false,
166
- onClick: openModal,
167
- size: "large",
168
- tooltip: selectLabel
169
- }), [disabled, Icon, openModal, selectLabel]);
170
- return /*#__PURE__*/_jsx(RelationshipInput, {
171
- AfterInput: /*#__PURE__*/_jsxs(Fragment, {
172
- children: [AfterInput, /*#__PURE__*/_jsx(HierarchyModal, {
173
- hasMany: hasMany,
174
- initialSelections: initialSelections,
175
- onSave: handleModalSave
176
- })]
177
- }),
178
- allowEdit: false,
179
- BeforeInput: BeforeInput,
180
- className: [baseClass, className].filter(Boolean).join(' '),
181
- CreateButton: BrowseButton,
182
- Description: Description,
183
- description: description,
184
- Error: Error,
185
- filterOptions: filterOptions,
186
- formatDisplayedOptions: flattenOptionGroups,
187
- formatOptionLabel: formatOptionLabel,
188
- isSortable: isSortable,
189
- Label: Label,
190
- label: label,
191
- localized: localized,
192
- maxResultsPerRequest: 10,
193
- path: path,
194
- placeholder: placeholder,
195
- readOnly: readOnly || disabled,
196
- relationTo: relationTo,
197
- required: required,
198
- selectOptionFields: selectOptionFields,
199
- showError: showError,
133
+ return /*#__PURE__*/_jsxs("div", {
134
+ className: [fieldBaseClass, baseClass, className, showError && 'error', readOnly && `${baseClass}--read-only`].filter(Boolean).join(' '),
135
+ id: `field-${path?.replace(/\./g, '__')}`,
200
136
  style: styles,
201
- ...(hasMany === true ? {
202
- hasMany: true,
203
- initialValue: memoizedInitialValue,
204
- onChange: handleChangeHasMany,
205
- value: memoizedValue
206
- } : {
207
- hasMany: false,
208
- initialValue: memoizedInitialValue,
209
- onChange: handleChangeSingle,
210
- value: memoizedValue
211
- })
137
+ children: [/*#__PURE__*/_jsx(RenderCustomComponent, {
138
+ CustomComponent: Label,
139
+ Fallback: /*#__PURE__*/_jsx(FieldLabel, {
140
+ label: label,
141
+ localized: localized,
142
+ path: path,
143
+ required: required
144
+ })
145
+ }), /*#__PURE__*/_jsxs("div", {
146
+ className: `${fieldBaseClass}__wrap`,
147
+ children: [/*#__PURE__*/_jsx(RenderCustomComponent, {
148
+ CustomComponent: Error,
149
+ Fallback: /*#__PURE__*/_jsx(FieldError, {
150
+ path: path,
151
+ showError: showError
152
+ })
153
+ }), BeforeInput, /*#__PURE__*/_jsxs("div", {
154
+ className: `${baseClass}__content`,
155
+ children: [selectedIds.length > 0 && /*#__PURE__*/_jsx(SelectedHierarchies, {
156
+ hierarchySlug: hierarchySlug,
157
+ onRemove: handleRemove,
158
+ readOnly: readOnly || disabled,
159
+ selectedIds: selectedIds
160
+ }), !readOnly && (hasMany || selectedIds.length === 0) && /*#__PURE__*/_jsx(Button, {
161
+ buttonStyle: "dashed",
162
+ className: `${baseClass}__manage-button`,
163
+ disabled: disabled,
164
+ icon: /*#__PURE__*/_jsx(CirclePlusIcon, {
165
+ size: 24
166
+ }),
167
+ iconPosition: "left",
168
+ margin: false,
169
+ onClick: handleOpenModal,
170
+ size: "medium",
171
+ children: t('general:selectLabel', {
172
+ label: hierarchyLabel
173
+ })
174
+ })]
175
+ }), AfterInput, /*#__PURE__*/_jsx(RenderCustomComponent, {
176
+ CustomComponent: Description,
177
+ Fallback: /*#__PURE__*/_jsx(FieldDescription, {
178
+ description: description,
179
+ path: path
180
+ })
181
+ })]
182
+ }), /*#__PURE__*/_jsx(HierarchyModal, {
183
+ hasMany: hasMany,
184
+ initialSelections: initialSelections,
185
+ onSave: handleModalSave
186
+ })]
212
187
  });
213
188
  };
214
189
  //# sourceMappingURL=index.client.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.client.js","names":["getTranslation","React","Fragment","useCallback","useMemo","mergeFieldStyles","RelationshipInput","useField","TagIcon","useConfig","useDocumentInfo","useTranslation","Button","useHierarchyModal","baseClass","flattenOptionGroups","groups","map","group","options","flat","HierarchyFieldClient","props","field","admin","className","description","isSortable","placeholder","hasMany","label","localized","relationTo","relationToProp","required","Icon","path","pathFromProps","readOnly","validate","hierarchySlug","Array","isArray","getEntityConfig","collectionSlug","documentCollectionSlug","i18n","t","collectionConfig","hierarchyConfig","hierarchy","undefined","titlePathFieldName","memoizedValidate","value","validationOptions","customComponents","AfterInput","BeforeInput","Description","Error","Label","disabled","filterOptions","initialValue","setValue","showError","potentiallyStalePath","useState","styles","toRelationValues","ids","id","memoizedValue","memoizedInitialValue","handleChangeHasMany","newValue","relation","isUnchanged","length","every","index","handleChangeSingle","selectOptionFields","formatOptionLabel","context","defaultLabel","doc","titlePath","split","segment","trim","join","filterByCollection","HierarchyModal","openModal","hierarchyCollectionSlug","initialSelections","handleModalSave","closeModal","selections","from","keys","hierarchyLabel","labels","plural","singular","selectLabel","BrowseButton","_jsx","buttonStyle","icon","margin","onClick","size","tooltip","_jsxs","onSave","allowEdit","filter","Boolean","CreateButton","formatDisplayedOptions","maxResultsPerRequest","style","onChange"],"sources":["../../../../src/elements/Hierarchy/Field/index.client.tsx"],"sourcesContent":["'use client'\nimport type { RelationshipFieldClientProps, ValueWithRelation } from 'payload'\n\nimport { getTranslation } from '@payloadcms/translations'\nimport React, { Fragment, useCallback, useMemo } from 'react'\n\nimport type { Option, OptionGroup } from '../../../fields/Relationship/types.js'\nimport type { SelectionWithPath } from '../Modal/types.js'\n\nimport { mergeFieldStyles } from '../../../fields/mergeFieldStyles.js'\nimport { RelationshipInput } from '../../../fields/Relationship/Input.js'\nimport { useField } from '../../../forms/useField/index.js'\nimport { TagIcon } from '../../../icons/Tag/index.js'\nimport { useConfig } from '../../../providers/Config/index.js'\nimport { useDocumentInfo } from '../../../providers/DocumentInfo/index.js'\nimport { useTranslation } from '../../../providers/Translation/index.js'\nimport { Button } from '../../Button/index.js'\nimport { useHierarchyModal } from '../Modal/useHierarchyModal.js'\nimport './index.css'\n\nconst baseClass = 'hierarchy-field'\n\ntype Value = (number | string)[] | null | (number | string)\n\n/** The hierarchy is monomorphic, so the grouped options can be flattened into a single list */\nconst flattenOptionGroups = (groups: OptionGroup[]): Option[] =>\n groups.map((group) => group.options).flat()\n\nexport type HierarchyFieldClientProps = {\n Icon?: React.ReactNode\n} & RelationshipFieldClientProps\n\n/**\n * Renders a hierarchy relationship (e.g. tags) as a standard relationship input, swapping the\n * \"create new document\" button for one that opens the hierarchy column browser. Options are\n * labelled with their full ancestor path while browsing so same-named items stay distinguishable.\n */\nexport const HierarchyFieldClient: React.FC<HierarchyFieldClientProps> = (props) => {\n const {\n field,\n field: {\n admin: { className, description, isSortable = true, placeholder } = {},\n hasMany,\n label,\n localized,\n relationTo: relationToProp,\n required,\n },\n Icon,\n path: pathFromProps,\n readOnly,\n validate,\n } = props\n\n const hierarchySlug = Array.isArray(relationToProp) ? relationToProp[0] : relationToProp\n\n const { getEntityConfig } = useConfig()\n const { collectionSlug: documentCollectionSlug } = useDocumentInfo()\n const { i18n, t } = useTranslation()\n\n const collectionConfig = getEntityConfig({ collectionSlug: hierarchySlug })\n const hierarchyConfig =\n collectionConfig?.hierarchy && typeof collectionConfig.hierarchy === 'object'\n ? collectionConfig.hierarchy\n : undefined\n const titlePathFieldName = hierarchyConfig?.titlePathFieldName\n\n const memoizedValidate = useCallback(\n (value: Value, validationOptions: Parameters<typeof validate>[1]) => {\n if (typeof validate === 'function') {\n return validate(value, { ...validationOptions, required })\n }\n },\n [validate, required],\n )\n\n const {\n customComponents: { AfterInput, BeforeInput, Description, Error, Label } = {},\n disabled,\n filterOptions,\n initialValue,\n path,\n setValue,\n showError,\n value,\n } = useField<Value>({\n potentiallyStalePath: pathFromProps,\n validate: memoizedValidate,\n })\n\n const [relationTo] = React.useState(() => [hierarchySlug])\n\n const styles = useMemo(() => mergeFieldStyles(field), [field])\n\n const toRelationValues = useCallback(\n (ids: Value): null | ValueWithRelation | ValueWithRelation[] => {\n if (hasMany) {\n return Array.isArray(ids)\n ? ids.map((id) => ({ relationTo: hierarchySlug, value: id }))\n : null\n }\n\n return ids ? { relationTo: hierarchySlug, value: ids as number | string } : null\n },\n [hasMany, hierarchySlug],\n )\n\n const memoizedValue = useMemo(() => toRelationValues(value), [toRelationValues, value])\n\n const memoizedInitialValue = useMemo(\n () => toRelationValues(initialValue),\n [initialValue, toRelationValues],\n )\n\n const handleChangeHasMany = useCallback(\n (newValue: ValueWithRelation[]) => {\n const ids = Array.isArray(newValue) ? newValue.map((relation) => relation.value) : []\n\n const isUnchanged =\n Array.isArray(value) &&\n value.length === ids.length &&\n value.every((id, index) => id === ids[index])\n\n setValue(ids, isUnchanged)\n },\n [setValue, value],\n )\n\n const handleChangeSingle = useCallback(\n (newValue: ValueWithRelation) => {\n const id = newValue?.value ?? null\n setValue(id, value === id)\n },\n [setValue, value],\n )\n\n // Selecting the virtual path field is what triggers the server to compute it\n const selectOptionFields = useMemo(\n () => (titlePathFieldName ? { [titlePathFieldName]: true } : undefined),\n [titlePathFieldName],\n )\n\n const formatOptionLabel = useCallback(\n ({\n context,\n defaultLabel,\n doc,\n }: {\n context: 'menu' | 'value'\n defaultLabel: string\n doc?: Record<string, unknown>\n }) => {\n if (context !== 'menu' || !titlePathFieldName) {\n return defaultLabel\n }\n\n const titlePath = doc?.[titlePathFieldName]\n\n if (typeof titlePath !== 'string' || !titlePath) {\n return defaultLabel\n }\n\n return titlePath\n .split('/')\n .map((segment) => segment.trim())\n .join(' / ')\n },\n [titlePathFieldName],\n )\n\n // Memoize to prevent new array references on every render\n const filterByCollection = useMemo(\n () => (documentCollectionSlug ? [documentCollectionSlug] : undefined),\n [documentCollectionSlug],\n )\n\n const [HierarchyModal, , { openModal }] = useHierarchyModal({\n filterByCollection,\n hierarchyCollectionSlug: hierarchySlug,\n Icon,\n })\n\n // Pass the current value so the browser opens expanded to what is already selected\n const initialSelections = useMemo((): (number | string)[] => {\n if (!value) {\n return []\n }\n\n return Array.isArray(value) ? value : [value]\n }, [value])\n\n const handleModalSave = useCallback(\n ({\n closeModal,\n selections,\n }: {\n closeModal: () => void\n selections: Map<number | string, SelectionWithPath>\n }) => {\n const ids = Array.from(selections.keys())\n setValue(hasMany ? ids : (ids[0] ?? null))\n closeModal()\n },\n [hasMany, setValue],\n )\n\n const hierarchyLabel =\n getTranslation(\n hasMany ? collectionConfig?.labels?.plural : collectionConfig?.labels?.singular,\n i18n,\n ) || hierarchySlug\n\n const selectLabel = t('general:selectLabel', { label: hierarchyLabel })\n\n const BrowseButton = useMemo(\n () => (\n <Button\n aria-label={selectLabel}\n buttonStyle=\"secondary\"\n className={`${baseClass}__browse-button`}\n disabled={disabled}\n icon={Icon ?? <TagIcon />}\n margin={false}\n onClick={openModal}\n size=\"large\"\n tooltip={selectLabel}\n />\n ),\n [disabled, Icon, openModal, selectLabel],\n )\n\n return (\n <RelationshipInput\n AfterInput={\n <Fragment>\n {AfterInput}\n <HierarchyModal\n hasMany={hasMany}\n initialSelections={initialSelections}\n onSave={handleModalSave}\n />\n </Fragment>\n }\n allowEdit={false}\n BeforeInput={BeforeInput}\n className={[baseClass, className].filter(Boolean).join(' ')}\n CreateButton={BrowseButton}\n Description={Description}\n description={description}\n Error={Error}\n filterOptions={filterOptions}\n formatDisplayedOptions={flattenOptionGroups}\n formatOptionLabel={formatOptionLabel}\n isSortable={isSortable}\n Label={Label}\n label={label}\n localized={localized}\n maxResultsPerRequest={10}\n path={path}\n placeholder={placeholder}\n readOnly={readOnly || disabled}\n relationTo={relationTo}\n required={required}\n selectOptionFields={selectOptionFields}\n showError={showError}\n style={styles}\n {...(hasMany === true\n ? {\n hasMany: true,\n initialValue: memoizedInitialValue as ValueWithRelation[],\n onChange: handleChangeHasMany,\n value: memoizedValue as ValueWithRelation[],\n }\n : {\n hasMany: false,\n initialValue: memoizedInitialValue as ValueWithRelation,\n onChange: handleChangeSingle,\n value: memoizedValue as ValueWithRelation,\n })}\n />\n )\n}\n"],"mappings":"AAAA;;;AAGA,SAASA,cAAc,QAAQ;AAC/B,OAAOC,KAAA,IAASC,QAAQ,EAAEC,WAAW,EAAEC,OAAO,QAAQ;AAKtD,SAASC,gBAAgB,QAAQ;AACjC,SAASC,iBAAiB,QAAQ;AAClC,SAASC,QAAQ,QAAQ;AACzB,SAASC,OAAO,QAAQ;AACxB,SAASC,SAAS,QAAQ;AAC1B,SAASC,eAAe,QAAQ;AAChC,SAASC,cAAc,QAAQ;AAC/B,SAASC,MAAM,QAAQ;AACvB,SAASC,iBAAiB,QAAQ;AAClC,OAAO;AAEP,MAAMC,SAAA,GAAY;AAIlB;AACA,MAAMC,mBAAA,GAAuBC,MAAA,IAC3BA,MAAA,CAAOC,GAAG,CAAEC,KAAA,IAAUA,KAAA,CAAMC,OAAO,EAAEC,IAAI;AAM3C;;;;;AAKA,OAAO,MAAMC,oBAAA,GAA6DC,KAAA;EACxE,MAAM;IACJC,KAAK;IACLA,KAAA,EAAO;MACLC,KAAA,EAAO;QAAEC,SAAS;QAAEC,WAAW;QAAEC,UAAA,GAAa,IAAI;QAAEC;MAAW,CAAE,GAAG,CAAC,CAAC;MACtEC,OAAO;MACPC,KAAK;MACLC,SAAS;MACTC,UAAA,EAAYC,cAAc;MAC1BC;IAAQ,CACT;IACDC,IAAI;IACJC,IAAA,EAAMC,aAAa;IACnBC,QAAQ;IACRC;EAAQ,CACT,GAAGjB,KAAA;EAEJ,MAAMkB,aAAA,GAAgBC,KAAA,CAAMC,OAAO,CAACT,cAAA,IAAkBA,cAAc,CAAC,EAAE,GAAGA,cAAA;EAE1E,MAAM;IAAEU;EAAe,CAAE,GAAGlC,SAAA;EAC5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AA;IACnBzD,UAAA,EAAYA,UAAA;IACZkC,KAAA,EAAOA,KAAA;IACP/B,KAAA,EAAOA,KAAA;IACPC,SAAA,EAAWA,SAAA;IACX4F,oBAAA,EAAsB;IACtBvF,IAAA,EAAMA,IAAA;IACNR,WAAA,EAAaA,WAAA;IACbU,QAAA,EAAUA,QAAA,IAAYwB,QAAA;IACtB9B,UAAA,EAAYA,UAAA;IACZE,QAAA,EAAUA,QAAA;IACViD,kBAAA,EAAoBA,kBAAA;IACpBjB,SAAA,EAAWA,SAAA;IACX0D,KAAA,EAAOvD,MAAA;IACN,IAAIxC,OAAA,KAAY,OACb;MACEA,OAAA,EAAS;MACTmC,YAAA,EAAcU,oBAAA;MACdmD,QAAA,EAAUlD,mBAAA;MACVrB,KAAA,EAAOmB;IACT,IACA;MACE5C,OAAA,EAAS;MACTmC,YAAA,EAAcU,oBAAA;MACdmD,QAAA,EAAU3C,kBAAA;MACV5B,KAAA,EAAOmB;IACT,CAAC;;AAGX","ignoreList":[]}
1
+ {"version":3,"file":"index.client.js","names":["getTranslation","React","useCallback","useMemo","FieldDescription","FieldError","FieldLabel","mergeFieldStyles","fieldBaseClass","useField","CirclePlusIcon","useConfig","useDocumentInfo","useTranslation","Button","RenderCustomComponent","useHierarchyModal","SelectedHierarchies","baseClass","HierarchyFieldClient","props","field","admin","className","description","hasMany","label","localized","relationTo","relationToProp","required","Icon","path","pathFromProps","readOnly","validate","hierarchySlug","Array","isArray","getEntityConfig","collectionSlug","documentCollectionSlug","i18n","t","collectionConfig","memoizedValidate","value","validationOptions","customComponents","AfterInput","BeforeInput","Description","Error","Label","disabled","setValue","showError","potentiallyStalePath","styles","selectedIds","initialSelections","filterByCollection","undefined","HierarchyModal","openModal","hierarchyCollectionSlug","handleModalSave","closeModal","selections","ids","from","keys","newValue","handleRemove","id","idToRemove","newIds","filter","length","handleOpenModal","hierarchyLabel","labels","plural","singular","_jsxs","Boolean","join","replace","style","_jsx","CustomComponent","Fallback","onRemove","buttonStyle","icon","size","iconPosition","margin","onClick","onSave"],"sources":["../../../../src/elements/Hierarchy/Field/index.client.tsx"],"sourcesContent":["'use client'\nimport type { RelationshipFieldClientProps } from 'payload'\n\nimport { getTranslation } from '@payloadcms/translations'\nimport React, { useCallback, useMemo } from 'react'\n\nimport type { SelectionWithPath } from '../Modal/types.js'\n\nimport { FieldDescription } from '../../../fields/FieldDescription/index.js'\nimport { FieldError } from '../../../fields/FieldError/index.js'\nimport { FieldLabel } from '../../../fields/FieldLabel/index.js'\nimport { mergeFieldStyles } from '../../../fields/mergeFieldStyles.js'\nimport { fieldBaseClass } from '../../../fields/shared/index.js'\nimport { useField } from '../../../forms/useField/index.js'\nimport { CirclePlusIcon } from '../../../icons/CirclePlus/index.js'\nimport { useConfig } from '../../../providers/Config/index.js'\nimport { useDocumentInfo } from '../../../providers/DocumentInfo/index.js'\nimport { useTranslation } from '../../../providers/Translation/index.js'\nimport { Button } from '../../Button/index.js'\nimport { RenderCustomComponent } from '../../RenderCustomComponent/index.js'\nimport { useHierarchyModal } from '../Modal/useHierarchyModal.js'\nimport { SelectedHierarchies } from './SelectedHierarchies.js'\nimport './index.css'\n\nconst baseClass = 'hierarchy-field'\n\ntype Value = (number | string)[] | null | (number | string)\n\nexport type HierarchyFieldClientProps = {\n Icon?: React.ReactNode\n} & RelationshipFieldClientProps\n\nexport const HierarchyFieldClient: React.FC<HierarchyFieldClientProps> = (props) => {\n const {\n field,\n field: {\n admin: { className, description } = {},\n hasMany,\n label,\n localized,\n relationTo: relationToProp,\n required,\n },\n Icon,\n path: pathFromProps,\n readOnly,\n validate,\n } = props\n\n const hierarchySlug = Array.isArray(relationToProp) ? relationToProp[0] : relationToProp\n\n const { getEntityConfig } = useConfig()\n const { collectionSlug: documentCollectionSlug } = useDocumentInfo()\n const { i18n, t } = useTranslation()\n\n const collectionConfig = getEntityConfig({ collectionSlug: hierarchySlug })\n\n const memoizedValidate = useCallback(\n (value: Value, validationOptions: Parameters<typeof validate>[1]) => {\n if (typeof validate === 'function') {\n return validate(value, { ...validationOptions, required })\n }\n },\n [validate, required],\n )\n\n const {\n customComponents: { AfterInput, BeforeInput, Description, Error, Label } = {},\n disabled,\n path,\n setValue,\n showError,\n value,\n } = useField<Value>({\n potentiallyStalePath: pathFromProps,\n validate: memoizedValidate,\n })\n\n const styles = useMemo(() => mergeFieldStyles(field), [field])\n\n // Normalize value to array of IDs for display\n const selectedIds = useMemo((): (number | string)[] => {\n if (!value) {\n return []\n }\n\n if (Array.isArray(value)) {\n return value\n }\n\n return [value]\n }, [value])\n\n // Initialize selections for the modal - use current value so modal expands to current selection\n const initialSelections = useMemo(() => {\n if (!value) {\n return []\n }\n\n if (Array.isArray(value)) {\n return value\n }\n\n return [value] as (number | string)[]\n }, [value])\n\n // Memoize to prevent new array references on every render\n const filterByCollection = useMemo(\n () => (documentCollectionSlug ? [documentCollectionSlug] : undefined),\n [documentCollectionSlug],\n )\n\n const [HierarchyModal, , { openModal }] = useHierarchyModal({\n filterByCollection,\n hierarchyCollectionSlug: hierarchySlug,\n Icon,\n })\n\n const handleModalSave = useCallback(\n ({\n closeModal,\n selections,\n }: {\n closeModal: () => void\n selections: Map<number | string, SelectionWithPath>\n }) => {\n const ids = Array.from(selections.keys())\n const newValue = hasMany ? ids : (ids[0] ?? null)\n setValue(newValue)\n closeModal()\n },\n [hasMany, setValue],\n )\n\n const handleRemove = useCallback(\n ({ id: idToRemove }: { id: number | string }) => {\n if (hasMany) {\n const newIds = selectedIds.filter((id) => id !== idToRemove)\n setValue(newIds.length > 0 ? newIds : null)\n } else {\n setValue(null)\n }\n },\n [hasMany, selectedIds, setValue],\n )\n\n const handleOpenModal = useCallback(() => {\n openModal()\n }, [openModal])\n\n const hierarchyLabel =\n getTranslation(\n hasMany ? collectionConfig?.labels?.plural : collectionConfig?.labels?.singular,\n i18n,\n ) || hierarchySlug\n\n return (\n <div\n className={[\n fieldBaseClass,\n baseClass,\n className,\n showError && 'error',\n readOnly && `${baseClass}--read-only`,\n ]\n .filter(Boolean)\n .join(' ')}\n id={`field-${path?.replace(/\\./g, '__')}`}\n style={styles}\n >\n <RenderCustomComponent\n CustomComponent={Label}\n Fallback={\n <FieldLabel label={label} localized={localized} path={path} required={required} />\n }\n />\n <div className={`${fieldBaseClass}__wrap`}>\n <RenderCustomComponent\n CustomComponent={Error}\n Fallback={<FieldError path={path} showError={showError} />}\n />\n {BeforeInput}\n <div className={`${baseClass}__content`}>\n {selectedIds.length > 0 && (\n <SelectedHierarchies\n hierarchySlug={hierarchySlug}\n onRemove={handleRemove}\n readOnly={readOnly || disabled}\n selectedIds={selectedIds}\n />\n )}\n {!readOnly && (hasMany || selectedIds.length === 0) && (\n <Button\n buttonStyle=\"dashed\"\n className={`${baseClass}__manage-button`}\n disabled={disabled}\n icon={<CirclePlusIcon size={24} />}\n iconPosition=\"left\"\n margin={false}\n onClick={handleOpenModal}\n size=\"medium\"\n >\n {t('general:selectLabel', { label: hierarchyLabel })}\n </Button>\n )}\n </div>\n {AfterInput}\n <RenderCustomComponent\n CustomComponent={Description}\n Fallback={<FieldDescription description={description} path={path} />}\n />\n </div>\n <HierarchyModal\n hasMany={hasMany}\n initialSelections={initialSelections}\n onSave={handleModalSave}\n />\n </div>\n )\n}\n"],"mappings":"AAAA;;;AAGA,SAASA,cAAc,QAAQ;AAC/B,OAAOC,KAAA,IAASC,WAAW,EAAEC,OAAO,QAAQ;AAI5C,SAASC,gBAAgB,QAAQ;AACjC,SAASC,UAAU,QAAQ;AAC3B,SAASC,UAAU,QAAQ;AAC3B,SAASC,gBAAgB,QAAQ;AACjC,SAASC,cAAc,QAAQ;AAC/B,SAASC,QAAQ,QAAQ;AACzB,SAASC,cAAc,QAAQ;AAC/B,SAASC,SAAS,QAAQ;AAC1B,SAASC,eAAe,QAAQ;AAChC,SAASC,cAAc,QAAQ;AAC/B,SAASC,MAAM,QAAQ;AACvB,SAASC,qBAAqB,QAAQ;AACtC,SAASC,iBAAiB,QAAQ;AAClC,SAASC,mBAAmB,QAAQ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UAE9CN,WAAA,E,aACDkC,KAAA,CAAC;QAAI7D,SAAA,EAAW,GAAGL,SAAA,WAAoB;mBACpCyC,WAAA,CAAYmB,MAAM,GAAG,kBACpBW,IAAA,CAACxE,mBAAA;UACCmB,aAAA,EAAeA,aAAA;UACfwD,QAAA,EAAUnB,YAAA;UACVvC,QAAA,EAAUA,QAAA,IAAYoB,QAAA;UACtBK,WAAA,EAAaA;YAGhB,CAACzB,QAAA,KAAaT,OAAA,IAAWkC,WAAA,CAAYmB,MAAM,KAAK,mBAC/CW,IAAA,CAAC3E,MAAA;UACC+E,WAAA,EAAY;UACZtE,SAAA,EAAW,GAAGL,SAAA,iBAA0B;UACxCoC,QAAA,EAAUA,QAAA;UACVwC,IAAA,eAAML,IAAA,CAAC/E,cAAA;YAAeqF,IAAA,EAAM;;UAC5BC,YAAA,EAAa;UACbC,MAAA,EAAQ;UACRC,OAAA,EAASnB,eAAA;UACTgB,IAAA,EAAK;oBAEJpD,CAAA,CAAE,uBAAuB;YAAEjB,KAAA,EAAOsD;UAAe;;UAIvD/B,UAAA,E,aACDwC,IAAA,CAAC1E,qBAAA;QACC2E,eAAA,EAAiBvC,WAAA;QACjBwC,QAAA,eAAUF,IAAA,CAACrF,gBAAA;UAAiBoB,WAAA,EAAaA,WAAA;UAAaQ,IAAA,EAAMA;;;qBAGhEyD,IAAA,CAAC1B,cAAA;MACCtC,OAAA,EAASA,OAAA;MACTmC,iBAAA,EAAmBA,iBAAA;MACnBuC,MAAA,EAAQjC;;;AAIhB","ignoreList":[]}
@@ -1,6 +1,37 @@
1
1
  @layer payload-default {
2
- /* Matches the icon weight of the default relationship "add new" button this stands in for */
3
- .hierarchy-field__browse-button {
4
- color: var(--color-icon);
2
+ .hierarchy-field .field-type__wrap {
3
+ gap: var(--spacer-2);
4
+ flex-direction: column;
5
+ display: flex;
6
+ }
7
+
8
+ .hierarchy-field .field-label {
9
+ display: flex;
10
+ font-family: var(--text-body-large-font-family);
11
+ font-size: var(--text-body-large-font-size);
12
+ font-weight: var(--text-body-large-font-weight);
13
+ line-height: var(--text-body-large-line-height);
14
+ letter-spacing: var(--text-body-large-letter-spacing);
15
+ margin: unset;
16
+ }
17
+
18
+ .hierarchy-field__label {
19
+ display: flex;
20
+ align-items: center;
21
+ gap: var(--spacer-1);
22
+ }
23
+
24
+ .hierarchy-field__content {
25
+ display: flex;
26
+ flex-direction: column;
27
+ gap: var(--spacer-2-5);
28
+ }
29
+
30
+ .hierarchy-field__manage-button {
31
+ align-self: flex-start;
32
+ }
33
+
34
+ .hierarchy-field--read-only .hierarchy-field__content {
35
+ opacity: 0.75;
5
36
  }
6
37
  }
@@ -1,29 +1,15 @@
1
- import type { PathSegment } from '../ColumnBrowser/types.js';
2
1
  type FetchAncestorPathArgs = {
3
2
  api: string;
4
3
  collectionSlug: string;
5
4
  itemId: number | string;
6
5
  parentFieldName: string;
7
6
  serverURL: string;
8
- useAsTitle: string;
9
7
  };
10
- type FetchAncestorPathsArgs = {
11
- itemIds: (number | string)[];
12
- } & Omit<FetchAncestorPathArgs, 'itemId'>;
13
- export type AncestorPathResult = {
14
- /** Ancestor IDs from root down to the item's immediate parent, excluding the item itself */
15
- ancestorIds: (number | string)[];
16
- /** Full path from root down to the item itself, with titles */
17
- path: PathSegment[];
18
- };
19
- /**
20
- * Fetches the ancestor paths for several items in a single API call with depth.
21
- * Each populated parent chain is walked to build a titled breadcrumb from root to the item.
22
- */
23
- export declare function fetchAncestorPaths({ api, collectionSlug, itemIds, parentFieldName, serverURL, useAsTitle, }: FetchAncestorPathsArgs): Promise<Map<number | string, AncestorPathResult>>;
24
8
  /**
25
- * Fetches the ancestor path for a single item. See {@link fetchAncestorPaths}.
9
+ * Fetches the ancestor path for an item using a single API call with depth.
10
+ * Returns array of ancestor IDs from root to item's parent.
11
+ * Example: item at level 3 returns [grandparentId, parentId]
26
12
  */
27
- export declare function fetchAncestorPath({ itemId, ...rest }: FetchAncestorPathArgs): Promise<AncestorPathResult>;
13
+ export declare function fetchAncestorPath({ api, collectionSlug, itemId, parentFieldName, serverURL, }: FetchAncestorPathArgs): Promise<(number | string)[]>;
28
14
  export {};
29
15
  //# sourceMappingURL=fetchAncestorPath.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"fetchAncestorPath.d.ts","sourceRoot":"","sources":["../../../../src/elements/Hierarchy/Modal/fetchAncestorPath.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAA;AAE5D,KAAK,qBAAqB,GAAG;IAC3B,GAAG,EAAE,MAAM,CAAA;IACX,cAAc,EAAE,MAAM,CAAA;IACtB,MAAM,EAAE,MAAM,GAAG,MAAM,CAAA;IACvB,eAAe,EAAE,MAAM,CAAA;IACvB,SAAS,EAAE,MAAM,CAAA;IACjB,UAAU,EAAE,MAAM,CAAA;CACnB,CAAA;AAED,KAAK,sBAAsB,GAAG;IAC5B,OAAO,EAAE,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,CAAA;CAC7B,GAAG,IAAI,CAAC,qBAAqB,EAAE,QAAQ,CAAC,CAAA;AAEzC,MAAM,MAAM,kBAAkB,GAAG;IAC/B,4FAA4F;IAC5F,WAAW,EAAE,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,CAAA;IAChC,+DAA+D;IAC/D,IAAI,EAAE,WAAW,EAAE,CAAA;CACpB,CAAA;AAMD;;;GAGG;AACH,wBAAsB,kBAAkB,CAAC,EACvC,GAAG,EACH,cAAc,EACd,OAAO,EACP,eAAe,EACf,SAAS,EACT,UAAU,GACX,EAAE,sBAAsB,GAAG,OAAO,CAAC,GAAG,CAAC,MAAM,GAAG,MAAM,EAAE,kBAAkB,CAAC,CAAC,CA0C5E;AAED;;GAEG;AACH,wBAAsB,iBAAiB,CAAC,EACtC,MAAM,EACN,GAAG,IAAI,EACR,EAAE,qBAAqB,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAIrD"}
1
+ {"version":3,"file":"fetchAncestorPath.d.ts","sourceRoot":"","sources":["../../../../src/elements/Hierarchy/Modal/fetchAncestorPath.ts"],"names":[],"mappings":"AAGA,KAAK,qBAAqB,GAAG;IAC3B,GAAG,EAAE,MAAM,CAAA;IACX,cAAc,EAAE,MAAM,CAAA;IACtB,MAAM,EAAE,MAAM,GAAG,MAAM,CAAA;IACvB,eAAe,EAAE,MAAM,CAAA;IACvB,SAAS,EAAE,MAAM,CAAA;CAClB,CAAA;AAID;;;;GAIG;AACH,wBAAsB,iBAAiB,CAAC,EACtC,GAAG,EACH,cAAc,EACd,MAAM,EACN,eAAe,EACf,SAAS,GACV,EAAE,qBAAqB,GAAG,OAAO,CAAC,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,CAAC,CA+CtD"}
@@ -1,36 +1,27 @@
1
1
  import { formatAdminURL } from 'payload/shared';
2
2
  import * as qs from 'qs-esm';
3
3
  const MAX_HIERARCHY_DEPTH = 20;
4
- const EMPTY_RESULT = {
5
- ancestorIds: [],
6
- path: []
7
- };
8
4
  /**
9
- * Fetches the ancestor paths for several items in a single API call with depth.
10
- * Each populated parent chain is walked to build a titled breadcrumb from root to the item.
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]
11
8
  */
12
- export async function fetchAncestorPaths({
9
+ export async function fetchAncestorPath({
13
10
  api,
14
11
  collectionSlug,
15
- itemIds,
12
+ itemId,
16
13
  parentFieldName,
17
- serverURL,
18
- useAsTitle
14
+ serverURL
19
15
  }) {
20
- const results = new Map();
21
- if (itemIds.length === 0) {
22
- return results;
23
- }
24
16
  const queryString = qs.stringify({
25
17
  depth: MAX_HIERARCHY_DEPTH,
26
- limit: itemIds.length,
18
+ limit: 1,
27
19
  select: {
28
- [parentFieldName]: true,
29
- [useAsTitle]: true
20
+ [parentFieldName]: true
30
21
  },
31
22
  where: {
32
23
  id: {
33
- in: itemIds
24
+ equals: itemId
34
25
  }
35
26
  }
36
27
  }, {
@@ -45,80 +36,25 @@ export async function fetchAncestorPaths({
45
36
  credentials: 'include'
46
37
  });
47
38
  if (!response.ok) {
48
- return results;
39
+ return [];
49
40
  }
50
41
  const data = await response.json();
51
- for (const doc of data.docs || []) {
52
- const id = doc.id;
53
- if (id === null || id === undefined) {
54
- continue;
55
- }
56
- results.set(id, buildAncestorPath({
57
- id,
58
- doc,
59
- parentFieldName,
60
- useAsTitle
61
- }));
42
+ const doc = data.docs?.[0];
43
+ if (!doc) {
44
+ return [];
62
45
  }
63
- return results;
64
- }
65
- /**
66
- * Fetches the ancestor path for a single item. See {@link fetchAncestorPaths}.
67
- */
68
- export async function fetchAncestorPath({
69
- itemId,
70
- ...rest
71
- }) {
72
- const results = await fetchAncestorPaths({
73
- ...rest,
74
- itemIds: [itemId]
75
- });
76
- return results.get(itemId) ?? EMPTY_RESULT;
77
- }
78
- function buildAncestorPath({
79
- id,
80
- doc,
81
- parentFieldName,
82
- useAsTitle
83
- }) {
84
- const toTitle = (value, segmentID) => {
85
- const rawTitle = value?.[useAsTitle];
86
- return typeof rawTitle === 'string' || typeof rawTitle === 'number' ? String(rawTitle) : String(segmentID);
87
- };
88
- const path = [{
89
- id,
90
- title: toTitle(doc, id)
91
- }];
92
- let current = doc;
93
- for (let depth = 0; depth < MAX_HIERARCHY_DEPTH; depth++) {
94
- const parent = current?.[parentFieldName];
95
- if (parent === null || parent === undefined) {
96
- break;
97
- }
98
- // Parent is either a populated document or a bare ID once the depth limit is hit
99
- if (typeof parent === 'object') {
100
- const parentDoc = parent;
101
- const parentID = parentDoc.id;
102
- if (parentID === null || parentID === undefined) {
103
- break;
104
- }
105
- path.unshift({
106
- id: parentID,
107
- title: toTitle(parentDoc, parentID)
108
- });
109
- current = parentDoc;
110
- } else {
111
- const parentID = parent;
112
- path.unshift({
113
- id: parentID,
114
- title: String(parentID)
115
- });
116
- break;
46
+ // Walk the nested parent chain to build path from root to immediate parent
47
+ const path = [];
48
+ let current = doc[parentFieldName];
49
+ while (current !== null && current !== undefined) {
50
+ // Parent could be an ID (number/string) or a populated object
51
+ const parentId = typeof current === 'object' ? current.id : current;
52
+ if (parentId !== null && parentId !== undefined) {
53
+ path.unshift(parentId);
117
54
  }
55
+ // Move to next parent (only if current is populated object)
56
+ current = typeof current === 'object' ? current[parentFieldName] : null;
118
57
  }
119
- return {
120
- ancestorIds: path.slice(0, -1).map(segment => segment.id),
121
- path
122
- };
58
+ return path;
123
59
  }
124
60
  //# sourceMappingURL=fetchAncestorPath.js.map