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

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 (558) hide show
  1. package/dist/elements/AddNewRelation/index.css +0 -4
  2. package/dist/elements/AddNewRelation/index.js +2 -2
  3. package/dist/elements/AddNewRelation/index.js.map +1 -1
  4. package/dist/elements/AppHeader/index.css +5 -0
  5. package/dist/elements/AppHeader/index.d.ts +1 -8
  6. package/dist/elements/AppHeader/index.d.ts.map +1 -1
  7. package/dist/elements/AppHeader/index.js +4 -13
  8. package/dist/elements/AppHeader/index.js.map +1 -1
  9. package/dist/elements/ArrayAction/index.d.ts +1 -0
  10. package/dist/elements/ArrayAction/index.d.ts.map +1 -1
  11. package/dist/elements/ArrayAction/index.js +45 -32
  12. package/dist/elements/ArrayAction/index.js.map +1 -1
  13. package/dist/elements/BulkUpload/AddFilesView/index.css +10 -4
  14. package/dist/elements/BulkUpload/AddFilesView/index.d.ts.map +1 -1
  15. package/dist/elements/BulkUpload/AddFilesView/index.js +71 -51
  16. package/dist/elements/BulkUpload/AddFilesView/index.js.map +1 -1
  17. package/dist/elements/Button/index.css +25 -2
  18. package/dist/elements/Button/index.d.ts.map +1 -1
  19. package/dist/elements/Button/index.js +2 -0
  20. package/dist/elements/Button/index.js.map +1 -1
  21. package/dist/elements/Button/types.d.ts +1 -1
  22. package/dist/elements/Button/types.d.ts.map +1 -1
  23. package/dist/elements/Button/types.js.map +1 -1
  24. package/dist/elements/ClipboardAction/mergeFormStateFromClipboard.d.ts +10 -0
  25. package/dist/elements/ClipboardAction/mergeFormStateFromClipboard.d.ts.map +1 -1
  26. package/dist/elements/ClipboardAction/mergeFormStateFromClipboard.js +65 -3
  27. package/dist/elements/ClipboardAction/mergeFormStateFromClipboard.js.map +1 -1
  28. package/dist/elements/ClipboardAction/mergeFormStateFromClipboard.spec.js +345 -1
  29. package/dist/elements/ClipboardAction/mergeFormStateFromClipboard.spec.js.map +1 -1
  30. package/dist/elements/DefaultListViewTabs/index.css +1 -0
  31. package/dist/elements/DefaultListViewTabs/index.d.ts.map +1 -1
  32. package/dist/elements/DefaultListViewTabs/index.js +84 -62
  33. package/dist/elements/DefaultListViewTabs/index.js.map +1 -1
  34. package/dist/elements/DocumentDrawer/types.d.ts +1 -1
  35. package/dist/elements/DocumentDrawer/types.d.ts.map +1 -1
  36. package/dist/elements/DocumentDrawer/types.js.map +1 -1
  37. package/dist/elements/Drawer/index.css +10 -4
  38. package/dist/elements/Drawer/types.d.ts +2 -2
  39. package/dist/elements/Drawer/types.d.ts.map +1 -1
  40. package/dist/elements/Drawer/types.js.map +1 -1
  41. package/dist/elements/Dropzone/index.css +10 -4
  42. package/dist/elements/DuplicateDocument/SelectLocalesDrawer/index.js +3 -2
  43. package/dist/elements/DuplicateDocument/SelectLocalesDrawer/index.js.map +1 -1
  44. package/dist/elements/FileManager/index.css +0 -30
  45. package/dist/elements/FileManager/index.d.ts.map +1 -1
  46. package/dist/elements/FileManager/index.js +379 -287
  47. package/dist/elements/FileManager/index.js.map +1 -1
  48. package/dist/elements/Hierarchy/ColumnBrowser/Column/index.css +22 -4
  49. package/dist/elements/Hierarchy/ColumnBrowser/Column/index.d.ts.map +1 -1
  50. package/dist/elements/Hierarchy/ColumnBrowser/Column/index.js +68 -49
  51. package/dist/elements/Hierarchy/ColumnBrowser/Column/index.js.map +1 -1
  52. package/dist/elements/Hierarchy/ColumnBrowser/ColumnItem/index.css +100 -15
  53. package/dist/elements/Hierarchy/ColumnBrowser/ColumnItem/index.d.ts.map +1 -1
  54. package/dist/elements/Hierarchy/ColumnBrowser/ColumnItem/index.js +97 -137
  55. package/dist/elements/Hierarchy/ColumnBrowser/ColumnItem/index.js.map +1 -1
  56. package/dist/elements/Hierarchy/ColumnBrowser/index.d.ts +1 -1
  57. package/dist/elements/Hierarchy/ColumnBrowser/index.d.ts.map +1 -1
  58. package/dist/elements/Hierarchy/ColumnBrowser/index.js +51 -23
  59. package/dist/elements/Hierarchy/ColumnBrowser/index.js.map +1 -1
  60. package/dist/elements/Hierarchy/ColumnBrowser/types.d.ts +26 -3
  61. package/dist/elements/Hierarchy/ColumnBrowser/types.d.ts.map +1 -1
  62. package/dist/elements/Hierarchy/ColumnBrowser/types.js.map +1 -1
  63. package/dist/elements/Hierarchy/CreateNewButton/index.css +9 -0
  64. package/dist/elements/Hierarchy/CreateNewButton/index.d.ts +9 -0
  65. package/dist/elements/Hierarchy/CreateNewButton/index.d.ts.map +1 -0
  66. package/dist/elements/Hierarchy/CreateNewButton/index.js +111 -0
  67. package/dist/elements/Hierarchy/CreateNewButton/index.js.map +1 -0
  68. package/dist/elements/Hierarchy/DocHeaderButton/index.d.ts.map +1 -1
  69. package/dist/elements/Hierarchy/DocHeaderButton/index.js +6 -1
  70. package/dist/elements/Hierarchy/DocHeaderButton/index.js.map +1 -1
  71. package/dist/elements/Hierarchy/DocHeaderButton/index.server.js +1 -3
  72. package/dist/elements/Hierarchy/DocHeaderButton/index.server.js.map +1 -1
  73. package/dist/elements/Hierarchy/Field/index.client.d.ts +5 -0
  74. package/dist/elements/Hierarchy/Field/index.client.d.ts.map +1 -1
  75. package/dist/elements/Hierarchy/Field/index.client.js +120 -95
  76. package/dist/elements/Hierarchy/Field/index.client.js.map +1 -1
  77. package/dist/elements/Hierarchy/Field/index.css +3 -34
  78. package/dist/elements/Hierarchy/Modal/Footer/index.css +45 -0
  79. package/dist/elements/Hierarchy/Modal/Footer/index.d.ts +28 -0
  80. package/dist/elements/Hierarchy/Modal/Footer/index.d.ts.map +1 -0
  81. package/dist/elements/Hierarchy/Modal/Footer/index.js +166 -0
  82. package/dist/elements/Hierarchy/Modal/Footer/index.js.map +1 -0
  83. package/dist/elements/Hierarchy/Modal/fetchAncestorPath.d.ts +18 -4
  84. package/dist/elements/Hierarchy/Modal/fetchAncestorPath.d.ts.map +1 -1
  85. package/dist/elements/Hierarchy/Modal/fetchAncestorPath.js +88 -24
  86. package/dist/elements/Hierarchy/Modal/fetchAncestorPath.js.map +1 -1
  87. package/dist/elements/Hierarchy/Modal/index.css +4 -53
  88. package/dist/elements/Hierarchy/Modal/index.d.ts +5 -2
  89. package/dist/elements/Hierarchy/Modal/index.d.ts.map +1 -1
  90. package/dist/elements/Hierarchy/Modal/index.js +136 -99
  91. package/dist/elements/Hierarchy/Modal/index.js.map +1 -1
  92. package/dist/elements/Hierarchy/Modal/types.d.ts +15 -0
  93. package/dist/elements/Hierarchy/Modal/types.d.ts.map +1 -1
  94. package/dist/elements/Hierarchy/Modal/types.js.map +1 -1
  95. package/dist/elements/Hierarchy/MoveMany/index.d.ts +7 -3
  96. package/dist/elements/Hierarchy/MoveMany/index.d.ts.map +1 -1
  97. package/dist/elements/Hierarchy/MoveMany/index.js +43 -170
  98. package/dist/elements/Hierarchy/MoveMany/index.js.map +1 -1
  99. package/dist/elements/Hierarchy/Search/index.css +2 -9
  100. package/dist/elements/Hierarchy/Search/index.d.ts.map +1 -1
  101. package/dist/elements/Hierarchy/Search/index.js +6 -73
  102. package/dist/elements/Hierarchy/Search/index.js.map +1 -1
  103. package/dist/elements/Hierarchy/Search/types.d.ts +2 -6
  104. package/dist/elements/Hierarchy/Search/types.d.ts.map +1 -1
  105. package/dist/elements/Hierarchy/Search/types.js.map +1 -1
  106. package/dist/elements/Hierarchy/Tree/HierarchySidebarTab.d.ts +0 -4
  107. package/dist/elements/Hierarchy/Tree/HierarchySidebarTab.d.ts.map +1 -1
  108. package/dist/elements/Hierarchy/Tree/HierarchySidebarTab.js +101 -186
  109. package/dist/elements/Hierarchy/Tree/HierarchySidebarTab.js.map +1 -1
  110. package/dist/elements/Hierarchy/Tree/HierarchySidebarTab.server.d.ts.map +1 -1
  111. package/dist/elements/Hierarchy/Tree/HierarchySidebarTab.server.js +1 -21
  112. package/dist/elements/Hierarchy/Tree/HierarchySidebarTab.server.js.map +1 -1
  113. package/dist/elements/Hierarchy/Tree/LoadMore/index.css +3 -3
  114. package/dist/elements/Hierarchy/Tree/TreeNode/index.css +59 -29
  115. package/dist/elements/Hierarchy/Tree/TreeNode/index.d.ts +1 -1
  116. package/dist/elements/Hierarchy/Tree/TreeNode/index.d.ts.map +1 -1
  117. package/dist/elements/Hierarchy/Tree/TreeNode/index.js +54 -10
  118. package/dist/elements/Hierarchy/Tree/TreeNode/index.js.map +1 -1
  119. package/dist/elements/Hierarchy/Tree/index.css +8 -9
  120. package/dist/elements/Hierarchy/Tree/index.d.ts.map +1 -1
  121. package/dist/elements/Hierarchy/Tree/index.js +29 -47
  122. package/dist/elements/Hierarchy/Tree/index.js.map +1 -1
  123. package/dist/elements/Hierarchy/Tree/types.d.ts +9 -1
  124. package/dist/elements/Hierarchy/Tree/types.d.ts.map +1 -1
  125. package/dist/elements/Hierarchy/Tree/types.js.map +1 -1
  126. package/dist/elements/Hierarchy/Tree/useChildren.d.ts.map +1 -1
  127. package/dist/elements/Hierarchy/Tree/useChildren.js +11 -1
  128. package/dist/elements/Hierarchy/Tree/useChildren.js.map +1 -1
  129. package/dist/elements/Hierarchy/getFolderHierarchySlug.d.ts +22 -0
  130. package/dist/elements/Hierarchy/getFolderHierarchySlug.d.ts.map +1 -0
  131. package/dist/elements/Hierarchy/getFolderHierarchySlug.js +17 -0
  132. package/dist/elements/Hierarchy/getFolderHierarchySlug.js.map +1 -0
  133. package/dist/elements/Hierarchy/move/moveDocuments.d.ts +34 -0
  134. package/dist/elements/Hierarchy/move/moveDocuments.d.ts.map +1 -0
  135. package/dist/elements/Hierarchy/move/moveDocuments.js +94 -0
  136. package/dist/elements/Hierarchy/move/moveDocuments.js.map +1 -0
  137. package/dist/elements/IDLabel/index.css +6 -0
  138. package/dist/elements/IDLabel/index.d.ts +1 -1
  139. package/dist/elements/IDLabel/index.d.ts.map +1 -1
  140. package/dist/elements/IDLabel/index.js +16 -21
  141. package/dist/elements/IDLabel/index.js.map +1 -1
  142. package/dist/elements/ListControls/index.d.ts.map +1 -1
  143. package/dist/elements/ListControls/index.js +3 -2
  144. package/dist/elements/ListControls/index.js.map +1 -1
  145. package/dist/elements/ListControls/types.d.ts +4 -0
  146. package/dist/elements/ListControls/types.d.ts.map +1 -1
  147. package/dist/elements/ListControls/types.js.map +1 -1
  148. package/dist/elements/ListHeader/TitleActions/ListBulkUploadButton.d.ts +1 -7
  149. package/dist/elements/ListHeader/TitleActions/ListBulkUploadButton.d.ts.map +1 -1
  150. package/dist/elements/ListHeader/TitleActions/ListBulkUploadButton.js +26 -32
  151. package/dist/elements/ListHeader/TitleActions/ListBulkUploadButton.js.map +1 -1
  152. package/dist/elements/Nav/NavSidebarToggle/index.js +1 -1
  153. package/dist/elements/Nav/NavSidebarToggle/index.js.map +1 -1
  154. package/dist/elements/Nav/NavWrapper/index.d.ts +1 -0
  155. package/dist/elements/Nav/NavWrapper/index.d.ts.map +1 -1
  156. package/dist/elements/Nav/NavWrapper/index.js +12 -18
  157. package/dist/elements/Nav/NavWrapper/index.js.map +1 -1
  158. package/dist/elements/Nav/SidebarTabs/index.css +1 -2
  159. package/dist/elements/Nav/context.d.ts +0 -1
  160. package/dist/elements/Nav/context.d.ts.map +1 -1
  161. package/dist/elements/Nav/context.js +92 -67
  162. package/dist/elements/Nav/context.js.map +1 -1
  163. package/dist/elements/Nav/index.css +47 -42
  164. package/dist/elements/Nav/index.d.ts +4 -0
  165. package/dist/elements/Nav/index.d.ts.map +1 -1
  166. package/dist/elements/Nav/index.js +16 -1
  167. package/dist/elements/Nav/index.js.map +1 -1
  168. package/dist/elements/NavGroup/index.css +29 -15
  169. package/dist/elements/Popup/PopupButtonList/index.css +33 -17
  170. package/dist/elements/Popup/index.css +6 -0
  171. package/dist/elements/Popup/index.d.ts +10 -0
  172. package/dist/elements/Popup/index.d.ts.map +1 -1
  173. package/dist/elements/Popup/index.js +13 -6
  174. package/dist/elements/Popup/index.js.map +1 -1
  175. package/dist/elements/PublishButton/ScheduleDrawer/index.js +1 -1
  176. package/dist/elements/PublishButton/ScheduleDrawer/index.js.map +1 -1
  177. package/dist/elements/QueryPresets/QueryPresetBar/index.js +1 -3
  178. package/dist/elements/QueryPresets/QueryPresetBar/index.js.map +1 -1
  179. package/dist/elements/ReactSelect/types.d.ts +5 -0
  180. package/dist/elements/ReactSelect/types.d.ts.map +1 -1
  181. package/dist/elements/ReactSelect/types.js.map +1 -1
  182. package/dist/elements/RelationshipTable/index.d.ts.map +1 -1
  183. package/dist/elements/RelationshipTable/index.js +5 -2
  184. package/dist/elements/RelationshipTable/index.js.map +1 -1
  185. package/dist/elements/SegmentedControl/index.css +58 -0
  186. package/dist/elements/SegmentedControl/index.d.ts +19 -0
  187. package/dist/elements/SegmentedControl/index.d.ts.map +1 -0
  188. package/dist/elements/SegmentedControl/index.js +104 -0
  189. package/dist/elements/SegmentedControl/index.js.map +1 -0
  190. package/dist/elements/SelectAll/index.d.ts.map +1 -1
  191. package/dist/elements/SelectAll/index.js +1 -2
  192. package/dist/elements/SelectAll/index.js.map +1 -1
  193. package/dist/elements/SelectRow/index.d.ts.map +1 -1
  194. package/dist/elements/SelectRow/index.js +1 -2
  195. package/dist/elements/SelectRow/index.js.map +1 -1
  196. package/dist/elements/SidebarRow/index.css +1 -5
  197. package/dist/elements/SidebarToggle/index.css +3 -1
  198. package/dist/elements/SortHeader/index.d.ts.map +1 -1
  199. package/dist/elements/SortHeader/index.js +29 -26
  200. package/dist/elements/SortHeader/index.js.map +1 -1
  201. package/dist/elements/StepNav/DropTarget/index.css +20 -0
  202. package/dist/elements/StepNav/DropTarget/index.d.ts +16 -0
  203. package/dist/elements/StepNav/DropTarget/index.d.ts.map +1 -0
  204. package/dist/elements/StepNav/DropTarget/index.js +71 -0
  205. package/dist/elements/StepNav/DropTarget/index.js.map +1 -0
  206. package/dist/elements/StepNav/index.css +64 -14
  207. package/dist/elements/StepNav/index.d.ts.map +1 -1
  208. package/dist/elements/StepNav/index.js +147 -69
  209. package/dist/elements/StepNav/index.js.map +1 -1
  210. package/dist/elements/StepNav/types.d.ts +6 -0
  211. package/dist/elements/StepNav/types.d.ts.map +1 -1
  212. package/dist/elements/StepNav/types.js.map +1 -1
  213. package/dist/elements/Table/DefaultCell/fields/Hierarchy/index.css +5 -7
  214. package/dist/elements/Table/DefaultCell/fields/Hierarchy/index.d.ts.map +1 -1
  215. package/dist/elements/Table/DefaultCell/fields/Hierarchy/index.js +14 -3
  216. package/dist/elements/Table/DefaultCell/fields/Hierarchy/index.js.map +1 -1
  217. package/dist/elements/Table/DefaultCell/index.d.ts.map +1 -1
  218. package/dist/elements/Table/DefaultCell/index.js +3 -11
  219. package/dist/elements/Table/DefaultCell/index.js.map +1 -1
  220. package/dist/elements/Upload/UploadFromURLModal/index.d.ts +1 -1
  221. package/dist/elements/Upload/UploadFromURLModal/index.d.ts.map +1 -1
  222. package/dist/elements/Upload/UploadFromURLModal/index.js.map +1 -1
  223. package/dist/elements/Upload/index.css +39 -32
  224. package/dist/elements/Upload/index.d.ts.map +1 -1
  225. package/dist/elements/Upload/index.js +37 -99
  226. package/dist/elements/Upload/index.js.map +1 -1
  227. package/dist/elements/Upload/usePasteFromClipboard.d.ts +14 -0
  228. package/dist/elements/Upload/usePasteFromClipboard.d.ts.map +1 -0
  229. package/dist/elements/Upload/usePasteFromClipboard.js +93 -0
  230. package/dist/elements/Upload/usePasteFromClipboard.js.map +1 -0
  231. package/dist/elements/Upload/useUploadFromUrl.d.ts +20 -0
  232. package/dist/elements/Upload/useUploadFromUrl.d.ts.map +1 -0
  233. package/dist/elements/Upload/useUploadFromUrl.js +201 -0
  234. package/dist/elements/Upload/useUploadFromUrl.js.map +1 -0
  235. package/dist/elements/UploadDropzoneContent/index.css +31 -0
  236. package/dist/elements/UploadDropzoneContent/index.d.ts +17 -0
  237. package/dist/elements/UploadDropzoneContent/index.d.ts.map +1 -0
  238. package/dist/elements/UploadDropzoneContent/index.js +62 -0
  239. package/dist/elements/UploadDropzoneContent/index.js.map +1 -0
  240. package/dist/elements/UserMenu/HoverSubmenuGroup.d.ts +18 -0
  241. package/dist/elements/UserMenu/HoverSubmenuGroup.d.ts.map +1 -0
  242. package/dist/elements/UserMenu/HoverSubmenuGroup.js +38 -0
  243. package/dist/elements/UserMenu/HoverSubmenuGroup.js.map +1 -0
  244. package/dist/elements/UserMenu/LanguageMenu/index.d.ts.map +1 -1
  245. package/dist/elements/UserMenu/LanguageMenu/index.js +83 -39
  246. package/dist/elements/UserMenu/LanguageMenu/index.js.map +1 -1
  247. package/dist/elements/UserMenu/SettingsMenu/index.d.ts.map +1 -1
  248. package/dist/elements/UserMenu/SettingsMenu/index.js +57 -21
  249. package/dist/elements/UserMenu/SettingsMenu/index.js.map +1 -1
  250. package/dist/elements/UserMenu/ThemeMenu/index.d.ts.map +1 -1
  251. package/dist/elements/UserMenu/ThemeMenu/index.js +83 -39
  252. package/dist/elements/UserMenu/ThemeMenu/index.js.map +1 -1
  253. package/dist/elements/UserMenu/index.css +32 -2
  254. package/dist/elements/UserMenu/index.d.ts +1 -0
  255. package/dist/elements/UserMenu/index.d.ts.map +1 -1
  256. package/dist/elements/UserMenu/index.js +77 -51
  257. package/dist/elements/UserMenu/index.js.map +1 -1
  258. package/dist/elements/UserMenu/useHoverSubmenu.d.ts +21 -0
  259. package/dist/elements/UserMenu/useHoverSubmenu.d.ts.map +1 -0
  260. package/dist/elements/UserMenu/useHoverSubmenu.js +260 -0
  261. package/dist/elements/UserMenu/useHoverSubmenu.js.map +1 -0
  262. package/dist/elements/ViewModeToggle/index.d.ts +8 -0
  263. package/dist/elements/ViewModeToggle/index.d.ts.map +1 -0
  264. package/dist/elements/ViewModeToggle/index.js +29 -0
  265. package/dist/elements/ViewModeToggle/index.js.map +1 -0
  266. package/dist/elements/WhereBuilder/conditionValue.d.ts +32 -0
  267. package/dist/elements/WhereBuilder/conditionValue.d.ts.map +1 -0
  268. package/dist/elements/WhereBuilder/conditionValue.js +32 -0
  269. package/dist/elements/WhereBuilder/conditionValue.js.map +1 -0
  270. package/dist/elements/WhereBuilder/conditionValue.spec.js +65 -0
  271. package/dist/elements/WhereBuilder/conditionValue.spec.js.map +1 -0
  272. package/dist/elements/WhereBuilder/index.d.ts.map +1 -1
  273. package/dist/elements/WhereBuilder/index.js +15 -4
  274. package/dist/elements/WhereBuilder/index.js.map +1 -1
  275. package/dist/exports/client/index.d.ts +6 -1
  276. package/dist/exports/client/index.d.ts.map +1 -1
  277. package/dist/exports/client/index.js +1 -1
  278. package/dist/exports/client/index.js.map +3 -3
  279. package/dist/fields/Array/ArrayRow.d.ts +1 -0
  280. package/dist/fields/Array/ArrayRow.d.ts.map +1 -1
  281. package/dist/fields/Array/ArrayRow.js +2 -0
  282. package/dist/fields/Array/ArrayRow.js.map +1 -1
  283. package/dist/fields/Array/index.d.ts.map +1 -1
  284. package/dist/fields/Array/index.js +38 -10
  285. package/dist/fields/Array/index.js.map +1 -1
  286. package/dist/fields/Blocks/BlockRow.d.ts +1 -0
  287. package/dist/fields/Blocks/BlockRow.d.ts.map +1 -1
  288. package/dist/fields/Blocks/BlockRow.js +2 -0
  289. package/dist/fields/Blocks/BlockRow.js.map +1 -1
  290. package/dist/fields/Blocks/RowActions.d.ts +1 -0
  291. package/dist/fields/Blocks/RowActions.d.ts.map +1 -1
  292. package/dist/fields/Blocks/RowActions.js +22 -19
  293. package/dist/fields/Blocks/RowActions.js.map +1 -1
  294. package/dist/fields/Blocks/index.d.ts.map +1 -1
  295. package/dist/fields/Blocks/index.js +35 -7
  296. package/dist/fields/Blocks/index.js.map +1 -1
  297. package/dist/fields/Checkbox/Input.d.ts +2 -2
  298. package/dist/fields/Checkbox/Input.d.ts.map +1 -1
  299. package/dist/fields/Checkbox/Input.js +134 -152
  300. package/dist/fields/Checkbox/Input.js.map +1 -1
  301. package/dist/fields/Checkbox/index.css +168 -155
  302. package/dist/fields/Relationship/Input.d.ts.map +1 -1
  303. package/dist/fields/Relationship/Input.js +24 -6
  304. package/dist/fields/Relationship/Input.js.map +1 -1
  305. package/dist/fields/Relationship/optionsReducer.d.ts.map +1 -1
  306. package/dist/fields/Relationship/optionsReducer.js +2 -0
  307. package/dist/fields/Relationship/optionsReducer.js.map +1 -1
  308. package/dist/fields/Relationship/types.d.ts +24 -0
  309. package/dist/fields/Relationship/types.d.ts.map +1 -1
  310. package/dist/fields/Relationship/types.js.map +1 -1
  311. package/dist/fields/Upload/Input.d.ts.map +1 -1
  312. package/dist/fields/Upload/Input.js +44 -16
  313. package/dist/fields/Upload/Input.js.map +1 -1
  314. package/dist/fields/Upload/Input.spec.js +241 -0
  315. package/dist/fields/Upload/Input.spec.js.map +1 -0
  316. package/dist/forms/Form/index.d.ts.map +1 -1
  317. package/dist/forms/Form/index.js +4 -1
  318. package/dist/forms/Form/index.js.map +1 -1
  319. package/dist/forms/fieldSchemasToFormState/addFieldStatePromise.d.ts.map +1 -1
  320. package/dist/forms/fieldSchemasToFormState/addFieldStatePromise.js +1 -0
  321. package/dist/forms/fieldSchemasToFormState/addFieldStatePromise.js.map +1 -1
  322. package/dist/icons/CollapseLayers/index.css +5 -0
  323. package/dist/icons/CollapseLayers/index.d.ts +7 -0
  324. package/dist/icons/CollapseLayers/index.d.ts.map +1 -0
  325. package/dist/icons/CollapseLayers/index.js +23 -0
  326. package/dist/icons/CollapseLayers/index.js.map +1 -0
  327. package/dist/icons/Edit/index.d.ts +0 -1
  328. package/dist/icons/Edit/index.d.ts.map +1 -1
  329. package/dist/icons/Edit/index.js +4 -4
  330. package/dist/icons/Edit/index.js.map +1 -1
  331. package/dist/icons/Table/index.css +5 -0
  332. package/dist/icons/Table/index.d.ts +7 -0
  333. package/dist/icons/Table/index.d.ts.map +1 -0
  334. package/dist/icons/Table/index.js +25 -0
  335. package/dist/icons/Table/index.js.map +1 -0
  336. package/dist/providers/Actions/index.d.ts +1 -0
  337. package/dist/providers/Actions/index.d.ts.map +1 -1
  338. package/dist/providers/Actions/index.js +43 -11
  339. package/dist/providers/Actions/index.js.map +1 -1
  340. package/dist/providers/Auth/AuthSessionDebug/index.css +48 -0
  341. package/dist/providers/Auth/AuthSessionDebug/index.d.ts +13 -0
  342. package/dist/providers/Auth/AuthSessionDebug/index.d.ts.map +1 -0
  343. package/dist/providers/Auth/AuthSessionDebug/index.js +93 -0
  344. package/dist/providers/Auth/AuthSessionDebug/index.js.map +1 -0
  345. package/dist/providers/Auth/AuthSessionDebug/utilities.d.ts +21 -0
  346. package/dist/providers/Auth/AuthSessionDebug/utilities.d.ts.map +1 -0
  347. package/dist/providers/Auth/AuthSessionDebug/utilities.js +53 -0
  348. package/dist/providers/Auth/AuthSessionDebug/utilities.js.map +1 -0
  349. package/dist/providers/Auth/authSessionRequests.d.ts +27 -0
  350. package/dist/providers/Auth/authSessionRequests.d.ts.map +1 -0
  351. package/dist/providers/Auth/authSessionRequests.js +119 -0
  352. package/dist/providers/Auth/authSessionRequests.js.map +1 -0
  353. package/dist/providers/Auth/authSessionRequests.spec.js +121 -0
  354. package/dist/providers/Auth/authSessionRequests.spec.js.map +1 -0
  355. package/dist/providers/Auth/index.d.ts +2 -56
  356. package/dist/providers/Auth/index.d.ts.map +1 -1
  357. package/dist/providers/Auth/index.js +283 -135
  358. package/dist/providers/Auth/index.js.map +1 -1
  359. package/dist/providers/Auth/sessionActivity.d.ts +23 -0
  360. package/dist/providers/Auth/sessionActivity.d.ts.map +1 -0
  361. package/dist/providers/Auth/sessionActivity.js +49 -0
  362. package/dist/providers/Auth/sessionActivity.js.map +1 -0
  363. package/dist/providers/Auth/sessionActivity.spec.js +44 -0
  364. package/dist/providers/Auth/sessionActivity.spec.js.map +1 -0
  365. package/dist/providers/Auth/sessionTiming.d.ts +11 -0
  366. package/dist/providers/Auth/sessionTiming.d.ts.map +1 -0
  367. package/dist/providers/Auth/sessionTiming.js +18 -0
  368. package/dist/providers/Auth/sessionTiming.js.map +1 -0
  369. package/dist/providers/Auth/tabSessionSync/index.d.ts +17 -0
  370. package/dist/providers/Auth/tabSessionSync/index.d.ts.map +1 -0
  371. package/dist/providers/Auth/tabSessionSync/index.js +263 -0
  372. package/dist/providers/Auth/tabSessionSync/index.js.map +1 -0
  373. package/dist/providers/Auth/tabSessionSync/index.spec.js +463 -0
  374. package/dist/providers/Auth/tabSessionSync/index.spec.js.map +1 -0
  375. package/dist/providers/Auth/tabSessionSync/types.d.ts +107 -0
  376. package/dist/providers/Auth/tabSessionSync/types.d.ts.map +1 -0
  377. package/dist/providers/Auth/tabSessionSync/types.js +6 -0
  378. package/dist/providers/Auth/tabSessionSync/types.js.map +1 -0
  379. package/dist/providers/Auth/tabSessionSync/useTabSessionSync.d.ts +11 -0
  380. package/dist/providers/Auth/tabSessionSync/useTabSessionSync.d.ts.map +1 -0
  381. package/dist/providers/Auth/tabSessionSync/useTabSessionSync.js +90 -0
  382. package/dist/providers/Auth/tabSessionSync/useTabSessionSync.js.map +1 -0
  383. package/dist/providers/Auth/tabSessionSync/utilities.d.ts +26 -0
  384. package/dist/providers/Auth/tabSessionSync/utilities.d.ts.map +1 -0
  385. package/dist/providers/Auth/tabSessionSync/utilities.js +159 -0
  386. package/dist/providers/Auth/tabSessionSync/utilities.js.map +1 -0
  387. package/dist/providers/Auth/types.d.ts +65 -0
  388. package/dist/providers/Auth/types.d.ts.map +1 -0
  389. package/dist/providers/Auth/types.js +2 -0
  390. package/dist/providers/Auth/types.js.map +1 -0
  391. package/dist/providers/Auth/useAuthSessionTimers.d.ts +26 -0
  392. package/dist/providers/Auth/useAuthSessionTimers.d.ts.map +1 -0
  393. package/dist/providers/Auth/useAuthSessionTimers.js +203 -0
  394. package/dist/providers/Auth/useAuthSessionTimers.js.map +1 -0
  395. package/dist/providers/Auth/useAuthSessionTimers.spec.js +311 -0
  396. package/dist/providers/Auth/useAuthSessionTimers.spec.js.map +1 -0
  397. package/dist/providers/FormErrorHandler/index.d.ts +5 -1
  398. package/dist/providers/FormErrorHandler/index.d.ts.map +1 -1
  399. package/dist/providers/FormErrorHandler/index.js.map +1 -1
  400. package/dist/providers/Hierarchy/index.d.ts.map +1 -1
  401. package/dist/providers/Hierarchy/index.js +53 -24
  402. package/dist/providers/Hierarchy/index.js.map +1 -1
  403. package/dist/providers/Hierarchy/types.d.ts +2 -0
  404. package/dist/providers/Hierarchy/types.d.ts.map +1 -1
  405. package/dist/providers/Hierarchy/types.js.map +1 -1
  406. package/dist/providers/HierarchyDnd/index.css +51 -0
  407. package/dist/providers/HierarchyDnd/index.d.ts +21 -0
  408. package/dist/providers/HierarchyDnd/index.d.ts.map +1 -0
  409. package/dist/providers/HierarchyDnd/index.js +163 -0
  410. package/dist/providers/HierarchyDnd/index.js.map +1 -0
  411. package/dist/providers/HierarchyDnd/types.d.ts +56 -0
  412. package/dist/providers/HierarchyDnd/types.d.ts.map +1 -0
  413. package/dist/providers/HierarchyDnd/types.js +21 -0
  414. package/dist/providers/HierarchyDnd/types.js.map +1 -0
  415. package/dist/providers/Locale/index.d.ts.map +1 -1
  416. package/dist/providers/Locale/index.js +41 -36
  417. package/dist/providers/Locale/index.js.map +1 -1
  418. package/dist/providers/Root/index.js +4 -4
  419. package/dist/providers/Root/index.js.map +1 -1
  420. package/dist/providers/RouteTransition/ProgressBar/index.js +4 -1
  421. package/dist/providers/RouteTransition/ProgressBar/index.js.map +1 -1
  422. package/dist/providers/RouteTransition/ProgressBar/index.spec.js +44 -0
  423. package/dist/providers/RouteTransition/ProgressBar/index.spec.js.map +1 -0
  424. package/dist/providers/RouteTransition/index.d.ts +2 -0
  425. package/dist/providers/RouteTransition/index.d.ts.map +1 -1
  426. package/dist/providers/RouteTransition/index.js +42 -14
  427. package/dist/providers/RouteTransition/index.js.map +1 -1
  428. package/dist/styles.css +1 -1
  429. package/dist/templates/Default/Wrapper/index.css +2 -1
  430. package/dist/templates/Default/Wrapper/index.d.ts +2 -0
  431. package/dist/templates/Default/Wrapper/index.d.ts.map +1 -1
  432. package/dist/templates/Default/Wrapper/index.js +12 -6
  433. package/dist/templates/Default/Wrapper/index.js.map +1 -1
  434. package/dist/templates/Default/index.css +3 -1
  435. package/dist/templates/Default/index.d.ts +1 -0
  436. package/dist/templates/Default/index.d.ts.map +1 -1
  437. package/dist/templates/Default/index.js +19 -15
  438. package/dist/templates/Default/index.js.map +1 -1
  439. package/dist/utilities/formatMetadata.d.ts.map +1 -1
  440. package/dist/utilities/formatMetadata.js +0 -5
  441. package/dist/utilities/formatMetadata.js.map +1 -1
  442. package/dist/utilities/getFilesFromClipboard.d.ts +10 -0
  443. package/dist/utilities/getFilesFromClipboard.d.ts.map +1 -0
  444. package/dist/utilities/getFilesFromClipboard.js +49 -0
  445. package/dist/utilities/getFilesFromClipboard.js.map +1 -0
  446. package/dist/utilities/slugify.d.ts.map +1 -1
  447. package/dist/utilities/slugify.js +1 -0
  448. package/dist/utilities/slugify.js.map +1 -1
  449. package/dist/views/Dashboard/Default/ModularDashboard/DashboardStepNav.d.ts.map +1 -1
  450. package/dist/views/Dashboard/Default/ModularDashboard/DashboardStepNav.js +3 -2
  451. package/dist/views/Dashboard/Default/ModularDashboard/DashboardStepNav.js.map +1 -1
  452. package/dist/views/Dashboard/Default/ModularDashboard/WidgetEditControl.d.ts.map +1 -1
  453. package/dist/views/Dashboard/Default/ModularDashboard/WidgetEditControl.js +7 -7
  454. package/dist/views/Dashboard/Default/ModularDashboard/WidgetEditControl.js.map +1 -1
  455. package/dist/views/Dashboard/Default/ModularDashboard/index.client.d.ts.map +1 -1
  456. package/dist/views/Dashboard/Default/ModularDashboard/index.client.js +104 -66
  457. package/dist/views/Dashboard/Default/ModularDashboard/index.client.js.map +1 -1
  458. package/dist/views/Dashboard/Default/ModularDashboard/index.css +33 -140
  459. package/dist/views/Edit/SetDocumentTitle/index.d.ts.map +1 -1
  460. package/dist/views/Edit/SetDocumentTitle/index.js +4 -1
  461. package/dist/views/Edit/SetDocumentTitle/index.js.map +1 -1
  462. package/dist/views/Edit/index.d.ts.map +1 -1
  463. package/dist/views/Edit/index.js +3 -2
  464. package/dist/views/Edit/index.js.map +1 -1
  465. package/dist/views/HierarchyList/DocumentListSelection/index.d.ts.map +1 -1
  466. package/dist/views/HierarchyList/DocumentListSelection/index.js +100 -105
  467. package/dist/views/HierarchyList/DocumentListSelection/index.js.map +1 -1
  468. package/dist/views/HierarchyList/HierarchyCards/DocumentCard/index.css +216 -0
  469. package/dist/views/HierarchyList/HierarchyCards/DocumentCard/index.d.ts +20 -0
  470. package/dist/views/HierarchyList/HierarchyCards/DocumentCard/index.d.ts.map +1 -0
  471. package/dist/views/HierarchyList/HierarchyCards/DocumentCard/index.js +182 -0
  472. package/dist/views/HierarchyList/HierarchyCards/DocumentCard/index.js.map +1 -0
  473. package/dist/views/HierarchyList/HierarchyCards/DragPreviewItem/index.css +38 -0
  474. package/dist/views/HierarchyList/HierarchyCards/DragPreviewItem/index.d.ts +15 -0
  475. package/dist/views/HierarchyList/HierarchyCards/DragPreviewItem/index.d.ts.map +1 -0
  476. package/dist/views/HierarchyList/HierarchyCards/DragPreviewItem/index.js +85 -0
  477. package/dist/views/HierarchyList/HierarchyCards/DragPreviewItem/index.js.map +1 -0
  478. package/dist/views/HierarchyList/HierarchyCards/FolderCard/index.css +98 -0
  479. package/dist/views/HierarchyList/HierarchyCards/FolderCard/index.d.ts +27 -0
  480. package/dist/views/HierarchyList/HierarchyCards/FolderCard/index.d.ts.map +1 -0
  481. package/dist/views/HierarchyList/HierarchyCards/FolderCard/index.js +84 -0
  482. package/dist/views/HierarchyList/HierarchyCards/FolderCard/index.js.map +1 -0
  483. package/dist/views/HierarchyList/HierarchyCards/HierarchyCard/index.d.ts +19 -0
  484. package/dist/views/HierarchyList/HierarchyCards/HierarchyCard/index.d.ts.map +1 -0
  485. package/dist/views/HierarchyList/HierarchyCards/HierarchyCard/index.js +100 -0
  486. package/dist/views/HierarchyList/HierarchyCards/HierarchyCard/index.js.map +1 -0
  487. package/dist/views/HierarchyList/HierarchyCards/PlaneItem/index.d.ts +53 -0
  488. package/dist/views/HierarchyList/HierarchyCards/PlaneItem/index.d.ts.map +1 -0
  489. package/dist/views/HierarchyList/HierarchyCards/PlaneItem/index.js +145 -0
  490. package/dist/views/HierarchyList/HierarchyCards/PlaneItem/index.js.map +1 -0
  491. package/dist/views/HierarchyList/HierarchyCards/getThumbnailSrc.d.ts +8 -0
  492. package/dist/views/HierarchyList/HierarchyCards/getThumbnailSrc.d.ts.map +1 -0
  493. package/dist/views/HierarchyList/HierarchyCards/getThumbnailSrc.js +21 -0
  494. package/dist/views/HierarchyList/HierarchyCards/getThumbnailSrc.js.map +1 -0
  495. package/dist/views/HierarchyList/HierarchyCards/index.css +115 -0
  496. package/dist/views/HierarchyList/HierarchyCards/index.d.ts +80 -0
  497. package/dist/views/HierarchyList/HierarchyCards/index.d.ts.map +1 -0
  498. package/dist/views/HierarchyList/HierarchyCards/index.js +457 -0
  499. package/dist/views/HierarchyList/HierarchyCards/index.js.map +1 -0
  500. package/dist/views/HierarchyList/HierarchyListHeader/index.d.ts +6 -1
  501. package/dist/views/HierarchyList/HierarchyListHeader/index.d.ts.map +1 -1
  502. package/dist/views/HierarchyList/HierarchyListHeader/index.js +10 -8
  503. package/dist/views/HierarchyList/HierarchyListHeader/index.js.map +1 -1
  504. package/dist/views/HierarchyList/HierarchyTable/ChildNameCell.d.ts.map +1 -1
  505. package/dist/views/HierarchyList/HierarchyTable/ChildNameCell.js +11 -10
  506. package/dist/views/HierarchyList/HierarchyTable/ChildNameCell.js.map +1 -1
  507. package/dist/views/HierarchyList/HierarchyTable/SlotTable.d.ts.map +1 -1
  508. package/dist/views/HierarchyList/HierarchyTable/SlotTable.js +3 -6
  509. package/dist/views/HierarchyList/HierarchyTable/SlotTable.js.map +1 -1
  510. package/dist/views/HierarchyList/HierarchyTable/index.css +51 -0
  511. package/dist/views/HierarchyList/HierarchyTable/index.d.ts +13 -1
  512. package/dist/views/HierarchyList/HierarchyTable/index.d.ts.map +1 -1
  513. package/dist/views/HierarchyList/HierarchyTable/index.js +156 -38
  514. package/dist/views/HierarchyList/HierarchyTable/index.js.map +1 -1
  515. package/dist/views/HierarchyList/HierarchyTable/types.d.ts +6 -0
  516. package/dist/views/HierarchyList/HierarchyTable/types.d.ts.map +1 -1
  517. package/dist/views/HierarchyList/HierarchyTable/types.js.map +1 -1
  518. package/dist/views/HierarchyList/index.d.ts.map +1 -1
  519. package/dist/views/HierarchyList/index.js +103 -20
  520. package/dist/views/HierarchyList/index.js.map +1 -1
  521. package/dist/views/List/ListHeader/index.d.ts +1 -10
  522. package/dist/views/List/ListHeader/index.d.ts.map +1 -1
  523. package/dist/views/List/ListHeader/index.js +1 -3
  524. package/dist/views/List/ListHeader/index.js.map +1 -1
  525. package/dist/views/List/ListSelection/index.d.ts.map +1 -1
  526. package/dist/views/List/ListSelection/index.js +138 -122
  527. package/dist/views/List/ListSelection/index.js.map +1 -1
  528. package/dist/views/List/handleHierarchy.d.ts +6 -1
  529. package/dist/views/List/handleHierarchy.d.ts.map +1 -1
  530. package/dist/views/List/handleHierarchy.js +34 -3
  531. package/dist/views/List/handleHierarchy.js.map +1 -1
  532. package/dist/views/List/index.client.d.ts.map +1 -1
  533. package/dist/views/List/index.client.js +128 -18
  534. package/dist/views/List/index.client.js.map +1 -1
  535. package/dist/views/List/index.css +5 -0
  536. package/dist/views/List/index.d.ts.map +1 -1
  537. package/dist/views/List/index.js +27 -16
  538. package/dist/views/List/index.js.map +1 -1
  539. package/dist/views/Root/getCustomCollectionViewByRoute.d.ts.map +1 -1
  540. package/dist/views/Root/getCustomCollectionViewByRoute.js.map +1 -1
  541. package/dist/views/Root/getCustomGlobalViewByRoute.d.ts.map +1 -1
  542. package/dist/views/Root/getCustomGlobalViewByRoute.js.map +1 -1
  543. package/dist/views/Root/getCustomViewByKey.d.ts.map +1 -1
  544. package/dist/views/Root/getCustomViewByKey.js.map +1 -1
  545. package/dist/views/Root/getRouteData.d.ts.map +1 -1
  546. package/dist/views/Root/getRouteData.js +8 -2
  547. package/dist/views/Root/getRouteData.js.map +1 -1
  548. package/dist/views/Root/index.d.ts.map +1 -1
  549. package/dist/views/Root/index.js +1 -0
  550. package/dist/views/Root/index.js.map +1 -1
  551. package/dist/views/Version/generateVersionViewMetadata.js.map +1 -1
  552. package/dist/views/Versions/generateVersionsViewMetadata.js.map +1 -1
  553. package/package.json +4 -4
  554. package/dist/elements/Hierarchy/Field/SelectedHierarchies.css +0 -36
  555. package/dist/elements/Hierarchy/Field/SelectedHierarchies.d.ts +0 -13
  556. package/dist/elements/Hierarchy/Field/SelectedHierarchies.d.ts.map +0 -1
  557. package/dist/elements/Hierarchy/Field/SelectedHierarchies.js +0 -141
  558. package/dist/elements/Hierarchy/Field/SelectedHierarchies.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["DEFAULT_HIERARCHY_TREE_LIMIT","formatAdminURL","PREFERENCE_KEYS","qs","React","createContext","use","useCallback","useState","useDebouncedCallback","useConfig","usePreferences","useRouter","HierarchyContext","undefined","HierarchyProvider","children","setPreference","router","config","routes","admin","adminRoute","api","serverURL","baseFilter","setBaseFilter","collectionSlug","setCollectionSlug","parent","setParent","parentFieldName","setParentFieldName","treeLimit","setTreeLimit","typeFieldName","setTypeFieldName","useAsTitle","setUseAsTitle","allowedCollections","setAllowedCollections","treeCache","setTreeCache","Map","expandedNodesByCollection","setExpandedNodesByCollection","selectedFiltersByCollection","setSelectedFiltersByCollection","isLoadingMore","setIsLoadingMore","loadingNodeId","setLoadingNodeId","treeRefreshKeys","setTreeRefreshKeys","getNodeChildren","parentId","cache","get","docs","filter","doc","docParentId","String","hydrate","data","newAllowedCollections","newBaseFilter","slug","expandedNodes","newExpandedNodes","newParent","newParentFieldName","selectedFilters","newSelectedFilters","treeData","newTreeLimit","newTypeFieldName","newUseAsTitle","prev","newCache","existingEntry","set","existingDocIds","Set","map","id","newDocs","has","loadedParents","length","newMap","existingExpanded","mergedExpanded","savePreferencesDebounced","preferenceKey","HIERARCHY_TREE","currentExpanded","currentFilters","Array","from","expanded","filters","toggleNodeForCollection","newExpanded","delete","add","toggleNode","getExpandedNodesForCollection","getTreeDataForCollection","setSelectedFilters","selectParent","queryParam","url","path","push","refresh","loadMoreChildren","parentKey","parentMeta","hasMore","currentChildren","nextPage","Math","floor","where","or","exists","equals","queryString","stringify","limit","page","sort","addQueryPrefix","apiRoute","response","fetch","credentials","ok","Error","json","uniqueNewDocs","hasNextPage","totalDocs","reset","refreshTree","next","value","_jsx","useHierarchy","context"],"sources":["../../../src/providers/Hierarchy/index.tsx"],"sourcesContent":["'use client'\n\nimport type { TypeWithID, Where } from 'payload'\n\nimport { DEFAULT_HIERARCHY_TREE_LIMIT, formatAdminURL, PREFERENCE_KEYS } from 'payload/shared'\nimport * as qs from 'qs-esm'\nimport React, { createContext, use, useCallback, useState } from 'react'\n\nimport type {\n AllowedCollection,\n HierarchyContextValue,\n HierarchyDocument,\n HierarchyHydrateData,\n HierarchyProviderProps,\n HierarchyTreeCacheEntry,\n} from './types.js'\n\nimport { useDebouncedCallback } from '../../hooks/useDebouncedCallback.js'\nimport { useConfig } from '../Config/index.js'\nimport { usePreferences } from '../Preferences/index.js'\nimport { useRouter } from '../RouterAdapter/index.js'\n\nconst HierarchyContext = createContext<HierarchyContextValue | undefined>(undefined)\n\nexport const HierarchyProvider: React.FC<HierarchyProviderProps> = ({ children }) => {\n const { setPreference } = usePreferences()\n const router = useRouter()\n const {\n config: {\n routes: { admin: adminRoute, api },\n serverURL,\n },\n } = useConfig()\n\n const [baseFilter, setBaseFilter] = useState<null | Where>(null)\n const [collectionSlug, setCollectionSlug] = useState<null | string>(null)\n const [parent, setParent] = useState<null | (Record<string, unknown> & TypeWithID)>(null)\n const [parentFieldName, setParentFieldName] = useState<string>('')\n const [treeLimit, setTreeLimit] = useState<number>(DEFAULT_HIERARCHY_TREE_LIMIT)\n const [typeFieldName, setTypeFieldName] = useState<null | string>(null)\n const [useAsTitle, setUseAsTitle] = useState<null | string>(null)\n const [allowedCollections, setAllowedCollections] = useState<AllowedCollection[] | null>(null)\n\n const [treeCache, setTreeCache] = useState<Map<string, HierarchyTreeCacheEntry>>(() => new Map())\n const [expandedNodesByCollection, setExpandedNodesByCollection] = useState<\n Map<string, Set<number | string>>\n >(() => new Map())\n const [selectedFiltersByCollection, setSelectedFiltersByCollection] = useState<\n Map<string, string[]>\n >(() => new Map())\n const [isLoadingMore, setIsLoadingMore] = useState<boolean>(false)\n const [loadingNodeId, setLoadingNodeId] = useState<null | number | string>(null)\n const [treeRefreshKeys, setTreeRefreshKeys] = useState<Map<string, number>>(() => new Map())\n\n const getNodeChildren = useCallback(\n (parentId: null | number | string): HierarchyDocument[] => {\n if (!collectionSlug) {\n return []\n }\n\n const cache = treeCache.get(collectionSlug)\n if (!cache) {\n return []\n }\n\n return cache.docs.filter((doc) => {\n const docParentId = doc[parentFieldName]\n if (parentId === null) {\n return docParentId === null || docParentId === undefined\n }\n return docParentId !== null && String(docParentId) === String(parentId)\n })\n },\n [collectionSlug, parentFieldName, treeCache],\n )\n\n const hydrate = useCallback((data: HierarchyHydrateData) => {\n const {\n allowedCollections: newAllowedCollections,\n baseFilter: newBaseFilter,\n collectionSlug: slug,\n expandedNodes: newExpandedNodes,\n parent: newParent,\n parentFieldName: newParentFieldName,\n selectedFilters: newSelectedFilters,\n treeData,\n treeLimit: newTreeLimit,\n typeFieldName: newTypeFieldName,\n useAsTitle: newUseAsTitle,\n } = data\n\n setCollectionSlug(slug)\n\n if (newBaseFilter !== undefined) {\n setBaseFilter(newBaseFilter ?? null)\n }\n\n if (newAllowedCollections) {\n setAllowedCollections(newAllowedCollections)\n }\n\n if (newParentFieldName) {\n setParentFieldName(newParentFieldName)\n }\n\n if (newTreeLimit !== undefined) {\n setTreeLimit(newTreeLimit)\n }\n\n if (newTypeFieldName !== undefined) {\n setTypeFieldName(newTypeFieldName)\n }\n\n if (newParent !== undefined) {\n setParent(newParent)\n }\n\n if (newUseAsTitle !== undefined) {\n setUseAsTitle(newUseAsTitle)\n }\n\n if (treeData) {\n setTreeCache((prev) => {\n const newCache = new Map(prev)\n const existingEntry = newCache.get(slug)\n\n // If baseFilter is provided, replace cache entirely (tenant changed)\n // Otherwise merge to support incremental loading\n if (newBaseFilter !== undefined || !existingEntry) {\n newCache.set(slug, { ...treeData, baseFilter: newBaseFilter ?? null })\n } else {\n const existingDocIds = new Set(existingEntry.docs.map((doc) => doc.id))\n const newDocs = treeData.docs.filter((doc) => !existingDocIds.has(doc.id))\n\n newCache.set(slug, {\n baseFilter: existingEntry.baseFilter,\n docs: [...existingEntry.docs, ...newDocs],\n loadedParents: {\n ...existingEntry.loadedParents,\n ...treeData.loadedParents,\n },\n })\n }\n\n return newCache\n })\n }\n\n if (newExpandedNodes && newExpandedNodes.length > 0) {\n setExpandedNodesByCollection((prev) => {\n const newMap = new Map(prev)\n const existingExpanded = newMap.get(slug) || new Set()\n const mergedExpanded = new Set([...existingExpanded, ...newExpandedNodes])\n newMap.set(slug, mergedExpanded)\n return newMap\n })\n }\n\n if (newSelectedFilters) {\n setSelectedFiltersByCollection((prev) => {\n const newMap = new Map(prev)\n newMap.set(slug, newSelectedFilters)\n return newMap\n })\n }\n }, [])\n\n const savePreferencesDebounced = useDebouncedCallback(\n async (slug: string, data: { expanded?: Set<number | string>; filters?: string[] }) => {\n const preferenceKey = `${PREFERENCE_KEYS.HIERARCHY_TREE}-${slug}`\n const currentExpanded = expandedNodesByCollection.get(slug) || new Set()\n const currentFilters = selectedFiltersByCollection.get(slug) || []\n\n await setPreference(preferenceKey, {\n expandedNodes: Array.from(data.expanded ?? currentExpanded),\n selectedFilters: data.filters ?? currentFilters,\n })\n },\n 500,\n )\n\n const toggleNodeForCollection = useCallback(\n (slug: string, id: number | string) => {\n setExpandedNodesByCollection((prev) => {\n const newMap = new Map(prev)\n const currentExpanded = newMap.get(slug) || new Set()\n const newExpanded = new Set(currentExpanded)\n\n if (newExpanded.has(id)) {\n newExpanded.delete(id)\n } else {\n newExpanded.add(id)\n }\n\n newMap.set(slug, newExpanded)\n savePreferencesDebounced(slug, { expanded: newExpanded })\n return newMap\n })\n },\n [savePreferencesDebounced],\n )\n\n const toggleNode = useCallback(\n (id: number | string) => {\n if (!collectionSlug) {\n return\n }\n toggleNodeForCollection(collectionSlug, id)\n },\n [collectionSlug, toggleNodeForCollection],\n )\n\n const getExpandedNodesForCollection = useCallback(\n (slug: string): Set<number | string> => {\n return expandedNodesByCollection.get(slug) || new Set()\n },\n [expandedNodesByCollection],\n )\n\n const getTreeDataForCollection = useCallback(\n (slug: string) => {\n return treeCache.get(slug) || null\n },\n [treeCache],\n )\n\n const setSelectedFilters = useCallback(\n (filters: string[]) => {\n if (!collectionSlug) {\n return\n }\n\n setSelectedFiltersByCollection((prev) => {\n const newMap = new Map(prev)\n newMap.set(collectionSlug, filters)\n savePreferencesDebounced(collectionSlug, { filters })\n return newMap\n })\n },\n [collectionSlug, savePreferencesDebounced],\n )\n\n const selectParent = useCallback(\n (id: null | number | string) => {\n if (!collectionSlug) {\n return\n }\n\n const queryParam = parentFieldName || 'parent'\n const url = formatAdminURL({\n adminRoute,\n path: `/collections/${collectionSlug}${id !== null ? `?${queryParam}=${id}` : ''}`,\n })\n router.push(url)\n router.refresh()\n },\n [adminRoute, collectionSlug, parentFieldName, router],\n )\n\n const loadMoreChildren = useCallback(\n async (parentId: null | number | string): Promise<void> => {\n if (!collectionSlug || isLoadingMore) {\n return\n }\n\n const cache = treeCache.get(collectionSlug)\n if (!cache) {\n return\n }\n\n const parentKey = parentId === null ? 'root' : String(parentId)\n const parentMeta = cache.loadedParents[parentKey]\n if (!parentMeta || !parentMeta.hasMore) {\n return\n }\n\n setIsLoadingMore(true)\n setLoadingNodeId(parentId)\n\n try {\n const currentChildren = cache.docs.filter((doc) => {\n const docParentId = doc[parentFieldName]\n if (parentId === null) {\n return docParentId === null || docParentId === undefined\n }\n return docParentId !== null && String(docParentId) === String(parentId)\n })\n\n const nextPage = Math.floor(currentChildren.length / treeLimit) + 1\n\n const where =\n parentId === null\n ? {\n or: [\n { [parentFieldName]: { exists: false } },\n { [parentFieldName]: { equals: null } },\n ],\n }\n : { [parentFieldName]: { equals: parentId } }\n\n const queryString = qs.stringify(\n { limit: treeLimit, page: nextPage, sort: useAsTitle ?? 'id', where },\n { addQueryPrefix: true },\n )\n const url = formatAdminURL({\n apiRoute: api,\n path: `/${collectionSlug}${queryString}`,\n serverURL,\n })\n const response = await fetch(url, {\n credentials: 'include',\n })\n\n if (!response.ok) {\n throw new Error('Failed to fetch more children')\n }\n\n const data = await response.json()\n const newDocs = data.docs || []\n\n setTreeCache((prev) => {\n const newCache = new Map(prev)\n const existingEntry = newCache.get(collectionSlug)\n\n if (existingEntry) {\n const existingDocIds = new Set(existingEntry.docs.map((doc) => doc.id))\n const uniqueNewDocs = newDocs.filter((doc) => !existingDocIds.has(doc.id))\n\n newCache.set(collectionSlug, {\n docs: [...existingEntry.docs, ...uniqueNewDocs],\n loadedParents: {\n ...existingEntry.loadedParents,\n [parentKey]: {\n hasMore: data.hasNextPage || false,\n totalDocs: data.totalDocs || 0,\n },\n },\n })\n }\n\n return newCache\n })\n } catch {\n // Failed to load more children - silently fail\n } finally {\n setIsLoadingMore(false)\n setLoadingNodeId(null)\n }\n },\n [\n api,\n collectionSlug,\n isLoadingMore,\n parentFieldName,\n serverURL,\n treeCache,\n treeLimit,\n useAsTitle,\n ],\n )\n\n const reset = useCallback(() => {\n setBaseFilter(null)\n setCollectionSlug(null)\n setParent(null)\n setParentFieldName('')\n setTreeLimit(DEFAULT_HIERARCHY_TREE_LIMIT)\n setTypeFieldName(null)\n setUseAsTitle(null)\n setTreeCache(new Map())\n setExpandedNodesByCollection(new Map())\n setSelectedFiltersByCollection(new Map())\n setIsLoadingMore(false)\n setLoadingNodeId(null)\n }, [])\n\n const refreshTree = useCallback((slug: string) => {\n setTreeCache((prev) => {\n const next = new Map(prev)\n next.delete(slug)\n return next\n })\n setTreeRefreshKeys((prev) => {\n const next = new Map(prev)\n next.set(slug, (next.get(slug) ?? 0) + 1)\n return next\n })\n }, [])\n\n const expandedNodes =\n collectionSlug && expandedNodesByCollection.has(collectionSlug)\n ? expandedNodesByCollection.get(collectionSlug)\n : new Set<number | string>()\n\n const selectedFilters =\n collectionSlug && selectedFiltersByCollection.has(collectionSlug)\n ? selectedFiltersByCollection.get(collectionSlug)\n : []\n\n const value: HierarchyContextValue = {\n allowedCollections,\n baseFilter,\n collectionSlug,\n expandedNodes,\n getExpandedNodesForCollection,\n getNodeChildren,\n getTreeDataForCollection,\n hydrate,\n isLoadingMore,\n loadingNodeId,\n loadMoreChildren,\n parent,\n parentFieldName,\n refreshTree,\n reset,\n selectedFilters,\n selectParent,\n setSelectedFilters,\n toggleNode,\n toggleNodeForCollection,\n treeLimit,\n treeRefreshKeys,\n typeFieldName,\n useAsTitle,\n }\n\n return <HierarchyContext value={value}>{children}</HierarchyContext>\n}\n\nexport const useHierarchy = (): HierarchyContextValue => {\n const context = use(HierarchyContext)\n if (!context) {\n throw new Error('useHierarchy must be used within HierarchyProvider')\n }\n return context\n}\n"],"mappings":"AAAA;;;AAIA,SAASA,4BAA4B,EAAEC,cAAc,EAAEC,eAAe,QAAQ;AAC9E,YAAYC,EAAA,MAAQ;AACpB,OAAOC,KAAA,IAASC,aAAa,EAAEC,GAAG,EAAEC,WAAW,EAAEC,QAAQ,QAAQ;AAWjE,SAASC,oBAAoB,QAAQ;AACrC,SAASC,SAAS,QAAQ;AAC1B,SAASC,cAAc,QAAQ;AAC/B,SAASC,SAAS,QAAQ;AAE1B,MAAMC,gBAAA,gBAAmBR,aAAA,CAAiDS,SAAA;AAE1E,OAAO,MAAMC,iBAAA,GAAsDA,CAAC;EAAEC;AAAQ,CAAE;EAC9E,MAAM;IAAEC;EAAa,CAAE,GAAGN,cAAA;EAC1B,MAAMO,MAAA,GAASN,SAAA;EACf,MAAM;IACJO,MAAA,EAAQ;MACNC,MAAA,EAAQ;QAAEC,KAAA,EAAOC,UAAU;QAAEC;MAAG,CAAE;MAClCC;IAAS;EACV,CACF,GAAGd,SAAA;EAEJ,MAAM,CAACe,UAAA,EAAYC,aAAA,CAAc,GAAGlB,QAAA,CAAuB;EAC3D,MAAM,CAACmB,cAAA,EAAgBC,iBAAA,CAAkB,GAA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vC,OAAO+E,MAAA;IACT;EACF,GAAG,EAAE;EAEL,MAAM9E,aAAA,GACJzC,cAAA,IAAkBiB,yBAAA,CAA0B2C,GAAG,CAAC5D,cAAA,IAC5CiB,yBAAA,CAA0Ba,GAAG,CAAC9B,cAAA,IAC9B,IAAIwD,GAAA;EAEV,MAAMX,eAAA,GACJ7C,cAAA,IAAkBmB,2BAAA,CAA4ByC,GAAG,CAAC5D,cAAA,IAC9CmB,2BAAA,CAA4BW,GAAG,CAAC9B,cAAA,IAChC,EAAE;EAER,MAAMwH,KAAA,GAA+B;IACnC5G,kBAAA;IACAd,UAAA;IACAE,cAAA;IACAyC,aAAA;IACAuC,6BAAA;IACArD,eAAA;IACAsD,wBAAA;IACA7C,OAAA;IACAf,aAAA;IACAE,aAAA;IACAkE,gBAAA;IACAvF,MAAA;IACAE,eAAA;IACAkH,WAAA;IACAD,KAAA;IACAxE,eAAA;IACAsC,YAAA;IACAD,kBAAA;IACAH,UAAA;IACAJ,uBAAA;IACArE,SAAA;IACAmB,eAAA;IACAjB,aAAA;IACAE;EACF;EAEA,oBAAO+G,IAAA,CAACvI,gBAAA;IAAiBsI,KAAA,EAAOA,KAAA;cAAQnI;;AAC1C;AAEA,OAAO,MAAMqI,YAAA,GAAeA,CAAA;EAC1B,MAAMC,OAAA,GAAUhJ,GAAA,CAAIO,gBAAA;EACpB,IAAI,CAACyI,OAAA,EAAS;IACZ,MAAM,IAAIX,KAAA,CAAM;EAClB;EACA,OAAOW,OAAA;AACT","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["DEFAULT_HIERARCHY_TREE_LIMIT","formatAdminURL","PREFERENCE_KEYS","qs","React","createContext","use","useCallback","useState","useDebouncedCallback","useConfig","usePreferences","useRouter","HierarchyContext","undefined","HierarchyProvider","children","setPreference","router","config","routes","admin","adminRoute","api","serverURL","baseFilter","setBaseFilter","collectionSlug","setCollectionSlug","parent","setParent","parentFieldName","setParentFieldName","treeLimit","setTreeLimit","typeFieldName","setTypeFieldName","useAsTitle","setUseAsTitle","allowedCollections","setAllowedCollections","treeCache","setTreeCache","Map","expandedNodesByCollection","setExpandedNodesByCollection","selectedFiltersByCollection","setSelectedFiltersByCollection","isLoadingMore","setIsLoadingMore","loadingNodeId","setLoadingNodeId","treeRefreshKeys","setTreeRefreshKeys","getNodeChildren","parentId","cache","get","docs","filter","doc","docParentId","String","hydrate","data","newAllowedCollections","newBaseFilter","slug","expandedNodes","newExpandedNodes","newParent","newParentFieldName","selectedFilters","newSelectedFilters","treeData","newTreeLimit","newTypeFieldName","newUseAsTitle","prev","newCache","existingEntry","set","existingDocIds","Set","map","id","newDocs","has","mergedLoadedParents","loadedParents","parentKey","meta","Object","entries","existingMeta","loadedCount","Math","max","totalDocs","hasMore","length","newMap","existingExpanded","mergedExpanded","savePreferencesDebounced","preferenceKey","HIERARCHY_TREE","currentExpanded","currentFilters","Array","from","expanded","filters","toggleNodeForCollection","newExpanded","delete","add","collapseAllForCollection","toggleNode","getExpandedNodesForCollection","getTreeDataForCollection","setSelectedFilters","selectParent","queryParam","url","path","push","refresh","loadMoreChildren","parentMeta","currentChildren","nextPage","floor","where","or","exists","equals","queryString","stringify","limit","page","sort","addQueryPrefix","apiRoute","response","fetch","credentials","ok","Error","json","uniqueNewDocs","hasNextPage","reset","refreshTree","next","value","_jsx","useHierarchy","context"],"sources":["../../../src/providers/Hierarchy/index.tsx"],"sourcesContent":["'use client'\n\nimport type { TypeWithID, Where } from 'payload'\n\nimport { DEFAULT_HIERARCHY_TREE_LIMIT, formatAdminURL, PREFERENCE_KEYS } from 'payload/shared'\nimport * as qs from 'qs-esm'\nimport React, { createContext, use, useCallback, useState } from 'react'\n\nimport type {\n AllowedCollection,\n HierarchyContextValue,\n HierarchyDocument,\n HierarchyHydrateData,\n HierarchyProviderProps,\n HierarchyTreeCacheEntry,\n} from './types.js'\n\nimport { useDebouncedCallback } from '../../hooks/useDebouncedCallback.js'\nimport { useConfig } from '../Config/index.js'\nimport { usePreferences } from '../Preferences/index.js'\nimport { useRouter } from '../RouterAdapter/index.js'\n\nconst HierarchyContext = createContext<HierarchyContextValue | undefined>(undefined)\n\nexport const HierarchyProvider: React.FC<HierarchyProviderProps> = ({ children }) => {\n const { setPreference } = usePreferences()\n const router = useRouter()\n const {\n config: {\n routes: { admin: adminRoute, api },\n serverURL,\n },\n } = useConfig()\n\n const [baseFilter, setBaseFilter] = useState<null | Where>(null)\n const [collectionSlug, setCollectionSlug] = useState<null | string>(null)\n const [parent, setParent] = useState<null | (Record<string, unknown> & TypeWithID)>(null)\n const [parentFieldName, setParentFieldName] = useState<string>('')\n const [treeLimit, setTreeLimit] = useState<number>(DEFAULT_HIERARCHY_TREE_LIMIT)\n const [typeFieldName, setTypeFieldName] = useState<null | string>(null)\n const [useAsTitle, setUseAsTitle] = useState<null | string>(null)\n const [allowedCollections, setAllowedCollections] = useState<AllowedCollection[] | null>(null)\n\n const [treeCache, setTreeCache] = useState<Map<string, HierarchyTreeCacheEntry>>(() => new Map())\n const [expandedNodesByCollection, setExpandedNodesByCollection] = useState<\n Map<string, Set<number | string>>\n >(() => new Map())\n const [selectedFiltersByCollection, setSelectedFiltersByCollection] = useState<\n Map<string, string[]>\n >(() => new Map())\n const [isLoadingMore, setIsLoadingMore] = useState<boolean>(false)\n const [loadingNodeId, setLoadingNodeId] = useState<null | number | string>(null)\n const [treeRefreshKeys, setTreeRefreshKeys] = useState<Map<string, number>>(() => new Map())\n\n const getNodeChildren = useCallback(\n (parentId: null | number | string): HierarchyDocument[] => {\n if (!collectionSlug) {\n return []\n }\n\n const cache = treeCache.get(collectionSlug)\n if (!cache) {\n return []\n }\n\n return cache.docs.filter((doc) => {\n const docParentId = doc[parentFieldName]\n if (parentId === null) {\n return docParentId === null || docParentId === undefined\n }\n return docParentId !== null && String(docParentId) === String(parentId)\n })\n },\n [collectionSlug, parentFieldName, treeCache],\n )\n\n const hydrate = useCallback((data: HierarchyHydrateData) => {\n const {\n allowedCollections: newAllowedCollections,\n baseFilter: newBaseFilter,\n collectionSlug: slug,\n expandedNodes: newExpandedNodes,\n parent: newParent,\n parentFieldName: newParentFieldName,\n selectedFilters: newSelectedFilters,\n treeData,\n treeLimit: newTreeLimit,\n typeFieldName: newTypeFieldName,\n useAsTitle: newUseAsTitle,\n } = data\n\n setCollectionSlug(slug)\n\n if (newBaseFilter !== undefined) {\n setBaseFilter(newBaseFilter ?? null)\n }\n\n if (newAllowedCollections) {\n setAllowedCollections(newAllowedCollections)\n }\n\n if (newParentFieldName) {\n setParentFieldName(newParentFieldName)\n }\n\n if (newTreeLimit !== undefined) {\n setTreeLimit(newTreeLimit)\n }\n\n if (newTypeFieldName !== undefined) {\n setTypeFieldName(newTypeFieldName)\n }\n\n if (newParent !== undefined) {\n setParent(newParent)\n }\n\n if (newUseAsTitle !== undefined) {\n setUseAsTitle(newUseAsTitle)\n }\n\n if (treeData) {\n setTreeCache((prev) => {\n const newCache = new Map(prev)\n const existingEntry = newCache.get(slug)\n\n // If baseFilter is provided, replace cache entirely (tenant changed)\n // Otherwise merge to support incremental loading\n if (newBaseFilter !== undefined || !existingEntry) {\n newCache.set(slug, { ...treeData, baseFilter: newBaseFilter ?? null })\n } else {\n const existingDocIds = new Set(existingEntry.docs.map((doc) => doc.id))\n const newDocs = treeData.docs.filter((doc) => !existingDocIds.has(doc.id))\n\n // Reconcile loadedCount/totalDocs against the deduped merge rather than\n // blindly overwriting: a shallower fetch (e.g. fewer pages walked) must not\n // regress loadedCount below what's already accumulated in docs, or downstream\n // page-number math in Tree will refetch and duplicate an already-shown page.\n const mergedLoadedParents = { ...existingEntry.loadedParents }\n for (const [parentKey, meta] of Object.entries(treeData.loadedParents)) {\n const existingMeta = existingEntry.loadedParents[parentKey]\n const loadedCount = Math.max(existingMeta?.loadedCount ?? 0, meta.loadedCount ?? 0)\n const totalDocs = Math.max(existingMeta?.totalDocs ?? 0, meta.totalDocs ?? 0)\n mergedLoadedParents[parentKey] = {\n hasMore: loadedCount < totalDocs,\n loadedCount,\n totalDocs,\n }\n }\n\n newCache.set(slug, {\n baseFilter: existingEntry.baseFilter,\n docs: [...existingEntry.docs, ...newDocs],\n loadedParents: mergedLoadedParents,\n })\n }\n\n return newCache\n })\n }\n\n if (newExpandedNodes && newExpandedNodes.length > 0) {\n setExpandedNodesByCollection((prev) => {\n const newMap = new Map(prev)\n const existingExpanded = newMap.get(slug) || new Set()\n const mergedExpanded = new Set([...existingExpanded, ...newExpandedNodes])\n newMap.set(slug, mergedExpanded)\n return newMap\n })\n }\n\n if (newSelectedFilters) {\n setSelectedFiltersByCollection((prev) => {\n const newMap = new Map(prev)\n newMap.set(slug, newSelectedFilters)\n return newMap\n })\n }\n }, [])\n\n const savePreferencesDebounced = useDebouncedCallback(\n async (slug: string, data: { expanded?: Set<number | string>; filters?: string[] }) => {\n const preferenceKey = `${PREFERENCE_KEYS.HIERARCHY_TREE}-${slug}`\n const currentExpanded = expandedNodesByCollection.get(slug) || new Set()\n const currentFilters = selectedFiltersByCollection.get(slug) || []\n\n await setPreference(preferenceKey, {\n expandedNodes: Array.from(data.expanded ?? currentExpanded),\n selectedFilters: data.filters ?? currentFilters,\n })\n },\n 500,\n )\n\n const toggleNodeForCollection = useCallback(\n (slug: string, id: number | string) => {\n setExpandedNodesByCollection((prev) => {\n const newMap = new Map(prev)\n const currentExpanded = newMap.get(slug) || new Set()\n const newExpanded = new Set(currentExpanded)\n\n if (newExpanded.has(id)) {\n newExpanded.delete(id)\n } else {\n newExpanded.add(id)\n }\n\n newMap.set(slug, newExpanded)\n savePreferencesDebounced(slug, { expanded: newExpanded })\n return newMap\n })\n },\n [savePreferencesDebounced],\n )\n\n const collapseAllForCollection = useCallback(\n (slug: string) => {\n setExpandedNodesByCollection((prev) => {\n // Always produce a new Map, even when the collection's set is already empty. The tree\n // may still be rendering server-provided nodes that only this state change can clear.\n const newMap = new Map(prev)\n const newExpanded = new Set<number | string>()\n\n newMap.set(slug, newExpanded)\n savePreferencesDebounced(slug, { expanded: newExpanded })\n return newMap\n })\n },\n [savePreferencesDebounced],\n )\n\n const toggleNode = useCallback(\n (id: number | string) => {\n if (!collectionSlug) {\n return\n }\n toggleNodeForCollection(collectionSlug, id)\n },\n [collectionSlug, toggleNodeForCollection],\n )\n\n const getExpandedNodesForCollection = useCallback(\n (slug: string): Set<number | string> => {\n return expandedNodesByCollection.get(slug) || new Set()\n },\n [expandedNodesByCollection],\n )\n\n const getTreeDataForCollection = useCallback(\n (slug: string) => {\n return treeCache.get(slug) || null\n },\n [treeCache],\n )\n\n const setSelectedFilters = useCallback(\n (filters: string[]) => {\n if (!collectionSlug) {\n return\n }\n\n setSelectedFiltersByCollection((prev) => {\n const newMap = new Map(prev)\n newMap.set(collectionSlug, filters)\n savePreferencesDebounced(collectionSlug, { filters })\n return newMap\n })\n },\n [collectionSlug, savePreferencesDebounced],\n )\n\n const selectParent = useCallback(\n (id: null | number | string) => {\n if (!collectionSlug) {\n return\n }\n\n const queryParam = parentFieldName || 'parent'\n const url = formatAdminURL({\n adminRoute,\n path: `/collections/${collectionSlug}${id !== null ? `?${queryParam}=${id}` : ''}`,\n })\n router.push(url)\n router.refresh()\n },\n [adminRoute, collectionSlug, parentFieldName, router],\n )\n\n const loadMoreChildren = useCallback(\n async (parentId: null | number | string): Promise<void> => {\n if (!collectionSlug || isLoadingMore) {\n return\n }\n\n const cache = treeCache.get(collectionSlug)\n if (!cache) {\n return\n }\n\n const parentKey = parentId === null ? 'root' : String(parentId)\n const parentMeta = cache.loadedParents[parentKey]\n if (!parentMeta || !parentMeta.hasMore) {\n return\n }\n\n setIsLoadingMore(true)\n setLoadingNodeId(parentId)\n\n try {\n const currentChildren = cache.docs.filter((doc) => {\n const docParentId = doc[parentFieldName]\n if (parentId === null) {\n return docParentId === null || docParentId === undefined\n }\n return docParentId !== null && String(docParentId) === String(parentId)\n })\n\n const nextPage = Math.floor(currentChildren.length / treeLimit) + 1\n\n const where =\n parentId === null\n ? {\n or: [\n { [parentFieldName]: { exists: false } },\n { [parentFieldName]: { equals: null } },\n ],\n }\n : { [parentFieldName]: { equals: parentId } }\n\n const queryString = qs.stringify(\n { limit: treeLimit, page: nextPage, sort: useAsTitle ?? 'id', where },\n { addQueryPrefix: true },\n )\n const url = formatAdminURL({\n apiRoute: api,\n path: `/${collectionSlug}${queryString}`,\n serverURL,\n })\n const response = await fetch(url, {\n credentials: 'include',\n })\n\n if (!response.ok) {\n throw new Error('Failed to fetch more children')\n }\n\n const data = await response.json()\n const newDocs = data.docs || []\n\n setTreeCache((prev) => {\n const newCache = new Map(prev)\n const existingEntry = newCache.get(collectionSlug)\n\n if (existingEntry) {\n const existingDocIds = new Set(existingEntry.docs.map((doc) => doc.id))\n const uniqueNewDocs = newDocs.filter((doc) => !existingDocIds.has(doc.id))\n\n newCache.set(collectionSlug, {\n docs: [...existingEntry.docs, ...uniqueNewDocs],\n loadedParents: {\n ...existingEntry.loadedParents,\n [parentKey]: {\n hasMore: data.hasNextPage || false,\n loadedCount: currentChildren.length + uniqueNewDocs.length,\n totalDocs: data.totalDocs || 0,\n },\n },\n })\n }\n\n return newCache\n })\n } catch {\n // Failed to load more children - silently fail\n } finally {\n setIsLoadingMore(false)\n setLoadingNodeId(null)\n }\n },\n [\n api,\n collectionSlug,\n isLoadingMore,\n parentFieldName,\n serverURL,\n treeCache,\n treeLimit,\n useAsTitle,\n ],\n )\n\n const reset = useCallback(() => {\n setBaseFilter(null)\n setCollectionSlug(null)\n setParent(null)\n setParentFieldName('')\n setTreeLimit(DEFAULT_HIERARCHY_TREE_LIMIT)\n setTypeFieldName(null)\n setUseAsTitle(null)\n setTreeCache(new Map())\n setExpandedNodesByCollection(new Map())\n setSelectedFiltersByCollection(new Map())\n setIsLoadingMore(false)\n setLoadingNodeId(null)\n }, [])\n\n const refreshTree = useCallback((slug: string) => {\n setTreeCache((prev) => {\n const next = new Map(prev)\n next.delete(slug)\n return next\n })\n setTreeRefreshKeys((prev) => {\n const next = new Map(prev)\n next.set(slug, (next.get(slug) ?? 0) + 1)\n return next\n })\n }, [])\n\n const expandedNodes =\n collectionSlug && expandedNodesByCollection.has(collectionSlug)\n ? expandedNodesByCollection.get(collectionSlug)\n : new Set<number | string>()\n\n const selectedFilters =\n collectionSlug && selectedFiltersByCollection.has(collectionSlug)\n ? selectedFiltersByCollection.get(collectionSlug)\n : []\n\n const value: HierarchyContextValue = {\n allowedCollections,\n baseFilter,\n collapseAllForCollection,\n collectionSlug,\n expandedNodes,\n getExpandedNodesForCollection,\n getNodeChildren,\n getTreeDataForCollection,\n hydrate,\n isLoadingMore,\n loadingNodeId,\n loadMoreChildren,\n parent,\n parentFieldName,\n refreshTree,\n reset,\n selectedFilters,\n selectParent,\n setSelectedFilters,\n toggleNode,\n toggleNodeForCollection,\n treeLimit,\n treeRefreshKeys,\n typeFieldName,\n useAsTitle,\n }\n\n return <HierarchyContext value={value}>{children}</HierarchyContext>\n}\n\nexport const useHierarchy = (): HierarchyContextValue => {\n const context = use(HierarchyContext)\n if (!context) {\n throw new Error('useHierarchy must be used within HierarchyProvider')\n }\n return context\n}\n"],"mappings":"AAAA;;;AAIA,SAASA,4BAA4B,EAAEC,cAAc,EAAEC,eAAe,QAAQ;AAC9E,YAAYC,EAAA,MAAQ;AACpB,OAAOC,KAAA,IAASC,aAAa,EAAEC,GAAG,EAAEC,WAAW,EAAEC,QAAQ,QAAQ;AAWjE,SAASC,oBAAoB,QAAQ;AACrC,SAASC,SAAS,QAAQ;AAC1B,SAASC,cAAc,QAAQ;AAC/B,SAASC,SAAS,QAAQ;AAE1B,MAAMC,gBAAA,gBAAmBR,aAAA,CAAiDS,SAAA;AAE1E,OAAO,MAAMC,iBAAA,GAAsDA,CAAC;EAAEC;AAAQ,CAAE;EAC9E,MAAM;IAAEC;EAAa,CAAE,GAAGN,cAAA;EAC1B,MAAMO,MAAA,GAASN,SAAA;EACf,MAAM;IACJO,MAAA,EAAQ;MACNC,MAAA,EAAQ;QAAEC,KAAA,EAAOC,UAAU;QAAEC;MAAG,CAAE;MAClCC;IAAS;EACV,CACF,G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AAA,CAA0Ba,GAAG,CAAC9B,cAAA,IAC9B,IAAIwD,GAAA;EAEV,MAAMX,eAAA,GACJ7C,cAAA,IAAkBmB,2BAAA,CAA4ByC,GAAG,CAAC5D,cAAA,IAC9CmB,2BAAA,CAA4BW,GAAG,CAAC9B,cAAA,IAChC,EAAE;EAER,MAAMgI,KAAA,GAA+B;IACnCpH,kBAAA;IACAd,UAAA;IACA4F,wBAAA;IACA1F,cAAA;IACAyC,aAAA;IACAmD,6BAAA;IACAjE,eAAA;IACAkE,wBAAA;IACAzD,OAAA;IACAf,aAAA;IACAE,aAAA;IACA8E,gBAAA;IACAnG,MAAA;IACAE,eAAA;IACA0H,WAAA;IACAD,KAAA;IACAhF,eAAA;IACAkD,YAAA;IACAD,kBAAA;IACAH,UAAA;IACAL,uBAAA;IACAhF,SAAA;IACAmB,eAAA;IACAjB,aAAA;IACAE;EACF;EAEA,oBAAOuH,IAAA,CAAC/I,gBAAA;IAAiB8I,KAAA,EAAOA,KAAA;cAAQ3I;;AAC1C;AAEA,OAAO,MAAM6I,YAAA,GAAeA,CAAA;EAC1B,MAAMC,OAAA,GAAUxJ,GAAA,CAAIO,gBAAA;EACpB,IAAI,CAACiJ,OAAA,EAAS;IACZ,MAAM,IAAIV,KAAA,CAAM;EAClB;EACA,OAAOU,OAAA;AACT","ignoreList":[]}
@@ -45,6 +45,8 @@ export type HierarchyHydrateData = {
45
45
  export type HierarchyContextValue = {
46
46
  allowedCollections: AllowedCollection[] | null;
47
47
  baseFilter: null | Where;
48
+ /** Collapse every expanded node for a specific collection (persists to preferences) */
49
+ collapseAllForCollection: (collectionSlug: string) => void;
48
50
  collectionSlug: null | string;
49
51
  expandedNodes: Set<number | string>;
50
52
  /** Get expanded nodes for a specific collection (use this in tabs to avoid cross-tab state conflicts) */
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/providers/Hierarchy/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa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SAAS,CAAA;CAC1B,CAAA;AAED,MAAM,MAAM,6BAA6B,GAAG;IAC1C,kBAAkB,CAAC,EAAE,iBAAiB,EAAE,GAAG,IAAI,CAAA;IAC/C,UAAU,CAAC,EAAE,IAAI,GAAG,KAAK,CAAA;IACzB,cAAc,EAAE,MAAM,CAAA;IACtB,aAAa,CAAC,EAAE,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,CAAA;IACnC,8FAA8F;IAC9F,MAAM,CAAC,EAAE,IAAI,GAAG,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,UAAU,CAAC,CAAA;IACtD,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,gDAAgD;IAChD,eAAe,CAAC,EAAE,MAAM,EAAE,CAAA;IAC1B,SAAS,CAAC,EAAE,aAAa,CAAA;IACzB,QAAQ,CAAC,EAAE,oBAAoB,CAAA;IAC/B,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,8EAA8E;IAC9E,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,UAAU,CAAC,EAAE,MAAM,CAAA;CACpB,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","names":[],"sources":["../../../src/providers/Hierarchy/types.ts"],"sourcesContent":["import type { PaginatedDocs, TypeWithID, Where } from 'payload'\n\nexport type HierarchyDocument = {\n [key: string]: unknown\n _hasChildren?: boolean\n} & TypeWithID\n\nexport type HierarchyInitialData = {\n baseFilter?: null | Where\n docs: HierarchyDocument[]\n loadedParents: Record<string, { hasMore: boolean; loadedCount?: number; totalDocs: number }>\n}\n\nexport type HierarchyTreeCacheEntry = {\n baseFilter?: null | Where\n docs: HierarchyDocument[]\n loadedParents: Record<string, { hasMore: boolean; loadedCount?: number; totalDocs: number }>\n}\n\nexport type AllowedCollection = { label: string; slug: string }\n\nexport type HierarchyHydrateData = {\n allowedCollections?: AllowedCollection[] | null\n baseFilter?: null | Where\n collectionSlug: string\n expandedNodes?: (number | string)[]\n /** The full data of the current parent (for accessing id, collectionSpecific values, etc.) */\n parent?: null | (Record<string, unknown> & TypeWithID)\n parentFieldName?: string\n /** Initial selected filters from preferences */\n selectedFilters?: string[]\n tableData?: PaginatedDocs\n treeData?: HierarchyInitialData\n treeLimit?: number\n /** Field name for collection-specific restrictions (e.g., 'hierarchyType') */\n typeFieldName?: string\n useAsTitle?: string\n}\n\nexport type HierarchyContextValue = {\n allowedCollections: AllowedCollection[] | null\n baseFilter: null | Where\n collectionSlug: null | string\n expandedNodes: Set<number | string>\n /** Get expanded nodes for a specific collection (use this in tabs to avoid cross-tab state conflicts) */\n getExpandedNodesForCollection: (collectionSlug: string) => Set<number | string>\n getNodeChildren: (parentId: null | number | string) => HierarchyDocument[]\n /** Get tree data for a specific collection (returns null if not hydrated or cleared by refresh) */\n getTreeDataForCollection: (collectionSlug: string) => HierarchyInitialData | null\n hydrate: (data: HierarchyHydrateData) => void\n isLoadingMore: boolean\n loadingNodeId: null | number | string\n loadMoreChildren: (parentId: null | number | string) => Promise<void>\n /** The full data of the current parent (for accessing id, collectionSpecific values, etc.) */\n parent: null | (Record<string, unknown> & TypeWithID)\n parentFieldName: string\n /** Refresh the tree for a specific collection by clearing its cache and incrementing its key */\n refreshTree: (collectionSlug: string) => void\n reset: () => void\n /** Selected collection type filters for the sidebar tree */\n selectedFilters: string[]\n selectParent: (id: null | number | string) => void\n /** Update selected filters (persists to preferences) */\n setSelectedFilters: (filters: string[]) => void\n toggleNode: (id: number | string) => void\n /** Toggle node expansion for a specific collection (use this in tabs to avoid cross-tab state conflicts) */\n toggleNodeForCollection: (collectionSlug: string, id: number | string) => void\n treeLimit: number\n /** Per-collection keys that change when refreshTree(slug) is called */\n treeRefreshKeys: Map<string, number>\n /** Field name for collection-specific restrictions (e.g., 'hierarchyType') */\n typeFieldName: null | string\n useAsTitle: null | string\n}\n\nexport type HierarchyProviderProps = {\n children: React.ReactNode\n}\n\nexport type HydrateHierarchyProviderProps = {\n allowedCollections?: AllowedCollection[] | null\n baseFilter?: null | Where\n collectionSlug: string\n expandedNodes?: (number | string)[]\n /** The full data of the current parent (for accessing id, collectionSpecific values, etc.) */\n parent?: null | (Record<string, unknown> & TypeWithID)\n parentFieldName?: string\n /** Initial selected filters from preferences */\n selectedFilters?: string[]\n tableData?: PaginatedDocs\n treeData?: HierarchyInitialData\n treeLimit?: number\n /** Field name for collection-specific restrictions (e.g., 'hierarchyType') */\n typeFieldName?: string\n useAsTitle?: string\n}\n"],"mappings":"AA+EA","ignoreList":[]}
1
+ {"version":3,"file":"types.js","names":[],"sources":["../../../src/providers/Hierarchy/types.ts"],"sourcesContent":["import type { PaginatedDocs, TypeWithID, Where } from 'payload'\n\nexport type HierarchyDocument = {\n [key: string]: unknown\n _hasChildren?: boolean\n} & TypeWithID\n\nexport type HierarchyInitialData = {\n baseFilter?: null | Where\n docs: HierarchyDocument[]\n loadedParents: Record<string, { hasMore: boolean; loadedCount?: number; totalDocs: number }>\n}\n\nexport type HierarchyTreeCacheEntry = {\n baseFilter?: null | Where\n docs: HierarchyDocument[]\n loadedParents: Record<string, { hasMore: boolean; loadedCount?: number; totalDocs: number }>\n}\n\nexport type AllowedCollection = { label: string; slug: string }\n\nexport type HierarchyHydrateData = {\n allowedCollections?: AllowedCollection[] | null\n baseFilter?: null | Where\n collectionSlug: string\n expandedNodes?: (number | string)[]\n /** The full data of the current parent (for accessing id, collectionSpecific values, etc.) */\n parent?: null | (Record<string, unknown> & TypeWithID)\n parentFieldName?: string\n /** Initial selected filters from preferences */\n selectedFilters?: string[]\n tableData?: PaginatedDocs\n treeData?: HierarchyInitialData\n treeLimit?: number\n /** Field name for collection-specific restrictions (e.g., 'hierarchyType') */\n typeFieldName?: string\n useAsTitle?: string\n}\n\nexport type HierarchyContextValue = {\n allowedCollections: AllowedCollection[] | null\n baseFilter: null | Where\n /** Collapse every expanded node for a specific collection (persists to preferences) */\n collapseAllForCollection: (collectionSlug: string) => void\n collectionSlug: null | string\n expandedNodes: Set<number | string>\n /** Get expanded nodes for a specific collection (use this in tabs to avoid cross-tab state conflicts) */\n getExpandedNodesForCollection: (collectionSlug: string) => Set<number | string>\n getNodeChildren: (parentId: null | number | string) => HierarchyDocument[]\n /** Get tree data for a specific collection (returns null if not hydrated or cleared by refresh) */\n getTreeDataForCollection: (collectionSlug: string) => HierarchyInitialData | null\n hydrate: (data: HierarchyHydrateData) => void\n isLoadingMore: boolean\n loadingNodeId: null | number | string\n loadMoreChildren: (parentId: null | number | string) => Promise<void>\n /** The full data of the current parent (for accessing id, collectionSpecific values, etc.) */\n parent: null | (Record<string, unknown> & TypeWithID)\n parentFieldName: string\n /** Refresh the tree for a specific collection by clearing its cache and incrementing its key */\n refreshTree: (collectionSlug: string) => void\n reset: () => void\n /** Selected collection type filters for the sidebar tree */\n selectedFilters: string[]\n selectParent: (id: null | number | string) => void\n /** Update selected filters (persists to preferences) */\n setSelectedFilters: (filters: string[]) => void\n toggleNode: (id: number | string) => void\n /** Toggle node expansion for a specific collection (use this in tabs to avoid cross-tab state conflicts) */\n toggleNodeForCollection: (collectionSlug: string, id: number | string) => void\n treeLimit: number\n /** Per-collection keys that change when refreshTree(slug) is called */\n treeRefreshKeys: Map<string, number>\n /** Field name for collection-specific restrictions (e.g., 'hierarchyType') */\n typeFieldName: null | string\n useAsTitle: null | string\n}\n\nexport type HierarchyProviderProps = {\n children: React.ReactNode\n}\n\nexport type HydrateHierarchyProviderProps = {\n allowedCollections?: AllowedCollection[] | null\n baseFilter?: null | Where\n collectionSlug: string\n expandedNodes?: (number | string)[]\n /** The full data of the current parent (for accessing id, collectionSpecific values, etc.) */\n parent?: null | (Record<string, unknown> & TypeWithID)\n parentFieldName?: string\n /** Initial selected filters from preferences */\n selectedFilters?: string[]\n tableData?: PaginatedDocs\n treeData?: HierarchyInitialData\n treeLimit?: number\n /** Field name for collection-specific restrictions (e.g., 'hierarchyType') */\n typeFieldName?: string\n useAsTitle?: string\n}\n"],"mappings":"AAiFA","ignoreList":[]}
@@ -0,0 +1,51 @@
1
+ @layer payload-default {
2
+ /*
3
+ * The stack is sized to a single 40px tile; the staggered tiles behind it are out of flow, so they
4
+ * spill past this box without shifting the lead tile away from the cursor.
5
+ */
6
+ .hierarchy-dnd__preview {
7
+ position: relative;
8
+ width: var(--spacer-6);
9
+ height: var(--spacer-6);
10
+ pointer-events: none;
11
+ }
12
+
13
+ /*
14
+ * Tiles fan down-and-right, first tile on top. Physical translate offsets are deliberate: the stack
15
+ * trails the pointer, which is not a document-flow direction.
16
+ */
17
+ .hierarchy-dnd__preview-card {
18
+ position: absolute;
19
+ inset-block-start: 0;
20
+ inset-inline-start: 0;
21
+ border-radius: var(--radius-medium);
22
+ box-shadow:
23
+ 0 0 0 var(--stroke-width-small) var(--color-border), var(--elevation-400-menu-panel);
24
+ /* Later tiles sit further back, so the lead tile is the one under the cursor. */
25
+ z-index: calc(3 - var(--preview-index));
26
+ transform: translate(
27
+ calc(var(--preview-index) * var(--spacer-1-5)),
28
+ calc(var(--preview-index) * var(--spacer-1-5))
29
+ );
30
+ }
31
+
32
+ /*
33
+ * Total count, not the overflow: three tiles look the same whether five or fifty are moving, so the
34
+ * pill has to carry the whole number.
35
+ */
36
+ .hierarchy-dnd__preview-count {
37
+ position: absolute;
38
+ z-index: 4;
39
+ inset-block-start: calc(var(--spacer-1-5) * -1);
40
+ inset-inline-end: calc(var(--spacer-1-5) * -1);
41
+ min-width: var(--spacer-4);
42
+ padding-block: var(--spacer-0);
43
+ padding-inline: var(--spacer-1);
44
+ border-radius: var(--radius-full);
45
+ background: var(--color-border-selected);
46
+ color: var(--color-text-onbrand);
47
+ font-size: var(--text-body-small-font-size);
48
+ line-height: var(--spacer-4);
49
+ text-align: center;
50
+ }
51
+ }
@@ -0,0 +1,21 @@
1
+ import React from 'react';
2
+ import type { HierarchyDragData, HierarchyDropData } from './types.js';
3
+ import './index.css';
4
+ type HierarchyDndContextValue = {
5
+ /** The drag in flight, or null. Drop targets read this to validate and style themselves. */
6
+ activeDrag: HierarchyDragData | null;
7
+ canDrop: (dropTarget: HierarchyDropData) => boolean;
8
+ };
9
+ export declare const useHierarchyDnd: () => HierarchyDndContextValue;
10
+ /**
11
+ * Hosts the drag context for moving documents and folders between folders.
12
+ *
13
+ * Mounted high enough to span both the nav and the view - the sidebar tree is a drop target - which
14
+ * is why it is rendered conditionally on the hierarchy view rather than always: it would otherwise
15
+ * wrap the array/blocks drag contexts on document views.
16
+ */
17
+ export declare const HierarchyDndProvider: React.FC<{
18
+ children: React.ReactNode;
19
+ }>;
20
+ export {};
21
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/providers/HierarchyDnd/index.tsx"],"names":[],"mappings":"AAcA,OAAO,KAAoE,MAAM,OAAO,CAAA;AAExF,OAAO,KAAK,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAA;AAStE,OAAO,aAAa,CAAA;AAgBpB,KAAK,wBAAwB,GAAG;IAC9B,4FAA4F;IAC5F,UAAU,EAAE,iBAAiB,GAAG,IAAI,CAAA;IACpC,OAAO,EAAE,CAAC,UAAU,EAAE,iBAAiB,KAAK,OAAO,CAAA;CACpD,CAAA;AAOD,eAAO,MAAM,eAAe,QAAO,wBAAwC,CAAA;AAE3E;;;;;;GAMG;AACH,eAAO,MAAM,oBAAoB,EAAE,KAAK,CAAC,EAAE,CAAC;IAAE,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CAAE,CA4HxE,CAAA"}
@@ -0,0 +1,163 @@
1
+ 'use client';
2
+
3
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
4
+ import { DndContext, DragOverlay, KeyboardSensor, PointerSensor, pointerWithin, useSensor, useSensors } from '@dnd-kit/core';
5
+ import { snapCenterToCursor } from '@dnd-kit/modifiers';
6
+ import React, { createContext, use, useCallback, useId, useMemo, useState } from 'react';
7
+ import { moveDocuments } from '../../elements/Hierarchy/move/moveDocuments.js';
8
+ import { useConfig } from '../Config/index.js';
9
+ import { useHierarchy } from '../Hierarchy/index.js';
10
+ import { useLocale } from '../Locale/index.js';
11
+ import { useRouteCache } from '../RouteCache/index.js';
12
+ import { useTranslation } from '../Translation/index.js';
13
+ import { canDropItems } from './types.js';
14
+ import './index.css';
15
+ const baseClass = 'hierarchy-dnd';
16
+ /**
17
+ * The overlay would otherwise be positioned against the dragged card's own rect, which puts a 40px
18
+ * stack at the top-left corner of a ~216px card - so it only sits under the cursor if you happened to
19
+ * grab that corner. Snapping the stack's centre to the pointer keeps it with the cursor wherever the
20
+ * card was picked up. Purely cosmetic: `pointerWithin` collision is computed from the pointer, not
21
+ * from the overlay.
22
+ */
23
+ const OVERLAY_MODIFIERS = [snapCenterToCursor];
24
+ /** How many thumbnails the stack shows; the count pill carries the rest. */
25
+ const MAX_PREVIEW_CARDS = 3;
26
+ const Context = /*#__PURE__*/createContext({
27
+ activeDrag: null,
28
+ canDrop: () => false
29
+ });
30
+ export const useHierarchyDnd = () => use(Context);
31
+ /**
32
+ * Hosts the drag context for moving documents and folders between folders.
33
+ *
34
+ * Mounted high enough to span both the nav and the view - the sidebar tree is a drop target - which
35
+ * is why it is rendered conditionally on the hierarchy view rather than always: it would otherwise
36
+ * wrap the array/blocks drag contexts on document views.
37
+ */
38
+ export const HierarchyDndProvider = ({
39
+ children
40
+ }) => {
41
+ const [activeDrag, setActiveDrag] = useState(null);
42
+ /*
43
+ * Without an explicit id, dnd-kit names the `aria-describedby` it puts on every draggable from a
44
+ * module-level counter, which does not line up between the server render and hydration - the
45
+ * card's attribute then mismatches and React discards the whole tree's hydration.
46
+ * See https://github.com/clauderic/dnd-kit/issues/926.
47
+ */
48
+ const dndContextID = useId();
49
+ const {
50
+ config: {
51
+ routes: {
52
+ api: apiRoute
53
+ }
54
+ }
55
+ } = useConfig();
56
+ const {
57
+ code: locale
58
+ } = useLocale();
59
+ const {
60
+ i18n,
61
+ t
62
+ } = useTranslation();
63
+ const {
64
+ clearRouteCache
65
+ } = useRouteCache();
66
+ const {
67
+ refreshTree
68
+ } = useHierarchy();
69
+ // A short distance threshold leaves plain clicks (which select) and the marquee intact; a drag
70
+ // only begins once the pointer has actually travelled.
71
+ const sensors = useSensors(useSensor(PointerSensor, {
72
+ activationConstraint: {
73
+ distance: 4
74
+ }
75
+ }), useSensor(KeyboardSensor));
76
+ const canDrop = useCallback(dropTarget => activeDrag ? canDropItems({
77
+ dropTarget,
78
+ items: activeDrag.items
79
+ }) : false, [activeDrag]);
80
+ const handleDragStart = useCallback(event => {
81
+ setActiveDrag(event.active.data.current ?? null);
82
+ }, []);
83
+ const handleDragEnd = useCallback(event_0 => {
84
+ const drag = event_0.active.data.current;
85
+ const drop = event_0.over?.data.current;
86
+ setActiveDrag(null);
87
+ if (!drag || !drop || drop.type !== 'hierarchy-folder') {
88
+ return;
89
+ }
90
+ // Validity is re-derived from the event rather than read off `canDrop`, whose `activeDrag` has
91
+ // just been cleared above.
92
+ if (!canDropItems({
93
+ dropTarget: drop,
94
+ items: drag.items
95
+ })) {
96
+ return;
97
+ }
98
+ const selections = {};
99
+ for (const item of drag.items) {
100
+ selections[item.collectionSlug] ??= {
101
+ ids: []
102
+ };
103
+ selections[item.collectionSlug].ids.push(item.id);
104
+ }
105
+ void moveDocuments({
106
+ apiRoute,
107
+ destination: {
108
+ id: drop.folderId,
109
+ title: drop.title
110
+ },
111
+ i18n,
112
+ label: drag.items.length === 1 ? drag.items[0].title : t('general:documents'),
113
+ locale,
114
+ parentFieldName: drop.parentFieldName,
115
+ selections,
116
+ t
117
+ }).then(({
118
+ totalMoved
119
+ }) => {
120
+ if (totalMoved > 0) {
121
+ drag.onMoveSuccess?.();
122
+ refreshTree(drop.hierarchySlug);
123
+ clearRouteCache();
124
+ }
125
+ });
126
+ }, [apiRoute, clearRouteCache, i18n, locale, refreshTree, t]);
127
+ const handleDragCancel = useCallback(() => setActiveDrag(null), []);
128
+ const contextValue = useMemo(() => ({
129
+ activeDrag,
130
+ canDrop
131
+ }), [activeDrag, canDrop]);
132
+ const previewCards = activeDrag?.preview.slice(0, MAX_PREVIEW_CARDS) ?? [];
133
+ const draggedCount = activeDrag?.items.length ?? 0;
134
+ return /*#__PURE__*/_jsx(Context, {
135
+ value: contextValue,
136
+ children: /*#__PURE__*/_jsxs(DndContext, {
137
+ collisionDetection: pointerWithin,
138
+ id: dndContextID,
139
+ onDragCancel: handleDragCancel,
140
+ onDragEnd: handleDragEnd,
141
+ onDragStart: handleDragStart,
142
+ sensors: sensors,
143
+ children: [children, /*#__PURE__*/_jsx(DragOverlay, {
144
+ dropAnimation: null,
145
+ modifiers: OVERLAY_MODIFIERS,
146
+ children: activeDrag ? /*#__PURE__*/_jsxs("div", {
147
+ className: `${baseClass}__preview`,
148
+ children: [previewCards.map((card, index) => /*#__PURE__*/_jsx("div", {
149
+ className: `${baseClass}__preview-card`,
150
+ style: {
151
+ '--preview-index': index
152
+ },
153
+ children: card
154
+ }, index)), draggedCount > 1 && /*#__PURE__*/_jsx("span", {
155
+ className: `${baseClass}__preview-count`,
156
+ children: draggedCount
157
+ })]
158
+ }) : null
159
+ })]
160
+ })
161
+ });
162
+ };
163
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":["DndContext","DragOverlay","KeyboardSensor","PointerSensor","pointerWithin","useSensor","useSensors","snapCenterToCursor","React","createContext","use","useCallback","useId","useMemo","useState","moveDocuments","useConfig","useHierarchy","useLocale","useRouteCache","useTranslation","canDropItems","baseClass","OVERLAY_MODIFIERS","MAX_PREVIEW_CARDS","Context","activeDrag","canDrop","useHierarchyDnd","HierarchyDndProvider","children","setActiveDrag","dndContextID","config","routes","api","apiRoute","code","locale","i18n","t","clearRouteCache","refreshTree","sensors","activationConstraint","distance","dropTarget","items","handleDragStart","event","active","data","current","handleDragEnd","drag","drop","over","type","selections","item","collectionSlug","ids","push","id","destination","folderId","title","label","length","parentFieldName","then","totalMoved","onMoveSuccess","hierarchySlug","handleDragCancel","contextValue","previewCards","preview","slice","draggedCount","_jsx","value","_jsxs","collisionDetection","onDragCancel","onDragEnd","onDragStart","dropAnimation","modifiers","className","map","card","index","style"],"sources":["../../../src/providers/HierarchyDnd/index.tsx"],"sourcesContent":["'use client'\n\nimport type { DragEndEvent, DragStartEvent } from '@dnd-kit/core'\n\nimport {\n DndContext,\n DragOverlay,\n KeyboardSensor,\n PointerSensor,\n pointerWithin,\n useSensor,\n useSensors,\n} from '@dnd-kit/core'\nimport { snapCenterToCursor } from '@dnd-kit/modifiers'\nimport React, { createContext, use, useCallback, useId, useMemo, useState } from 'react'\n\nimport type { HierarchyDragData, HierarchyDropData } from './types.js'\n\nimport { moveDocuments } from '../../elements/Hierarchy/move/moveDocuments.js'\nimport { useConfig } from '../Config/index.js'\nimport { useHierarchy } from '../Hierarchy/index.js'\nimport { useLocale } from '../Locale/index.js'\nimport { useRouteCache } from '../RouteCache/index.js'\nimport { useTranslation } from '../Translation/index.js'\nimport { canDropItems } from './types.js'\nimport './index.css'\n\nconst baseClass = 'hierarchy-dnd'\n\n/**\n * The overlay would otherwise be positioned against the dragged card's own rect, which puts a 40px\n * stack at the top-left corner of a ~216px card - so it only sits under the cursor if you happened to\n * grab that corner. Snapping the stack's centre to the pointer keeps it with the cursor wherever the\n * card was picked up. Purely cosmetic: `pointerWithin` collision is computed from the pointer, not\n * from the overlay.\n */\nconst OVERLAY_MODIFIERS = [snapCenterToCursor]\n\n/** How many thumbnails the stack shows; the count pill carries the rest. */\nconst MAX_PREVIEW_CARDS = 3\n\ntype HierarchyDndContextValue = {\n /** The drag in flight, or null. Drop targets read this to validate and style themselves. */\n activeDrag: HierarchyDragData | null\n canDrop: (dropTarget: HierarchyDropData) => boolean\n}\n\nconst Context = createContext<HierarchyDndContextValue>({\n activeDrag: null,\n canDrop: () => false,\n})\n\nexport const useHierarchyDnd = (): HierarchyDndContextValue => use(Context)\n\n/**\n * Hosts the drag context for moving documents and folders between folders.\n *\n * Mounted high enough to span both the nav and the view - the sidebar tree is a drop target - which\n * is why it is rendered conditionally on the hierarchy view rather than always: it would otherwise\n * wrap the array/blocks drag contexts on document views.\n */\nexport const HierarchyDndProvider: React.FC<{ children: React.ReactNode }> = ({ children }) => {\n const [activeDrag, setActiveDrag] = useState<HierarchyDragData | null>(null)\n\n /*\n * Without an explicit id, dnd-kit names the `aria-describedby` it puts on every draggable from a\n * module-level counter, which does not line up between the server render and hydration - the\n * card's attribute then mismatches and React discards the whole tree's hydration.\n * See https://github.com/clauderic/dnd-kit/issues/926.\n */\n const dndContextID = useId()\n\n const {\n config: {\n routes: { api: apiRoute },\n },\n } = useConfig()\n const { code: locale } = useLocale()\n const { i18n, t } = useTranslation()\n const { clearRouteCache } = useRouteCache()\n const { refreshTree } = useHierarchy()\n\n // A short distance threshold leaves plain clicks (which select) and the marquee intact; a drag\n // only begins once the pointer has actually travelled.\n const sensors = useSensors(\n useSensor(PointerSensor, { activationConstraint: { distance: 4 } }),\n useSensor(KeyboardSensor),\n )\n\n const canDrop = useCallback(\n (dropTarget: HierarchyDropData): boolean =>\n activeDrag ? canDropItems({ dropTarget, items: activeDrag.items }) : false,\n [activeDrag],\n )\n\n const handleDragStart = useCallback((event: DragStartEvent) => {\n setActiveDrag((event.active.data.current as HierarchyDragData | undefined) ?? null)\n }, [])\n\n const handleDragEnd = useCallback(\n (event: DragEndEvent) => {\n const drag = event.active.data.current as HierarchyDragData | undefined\n const drop = event.over?.data.current as HierarchyDropData | undefined\n\n setActiveDrag(null)\n\n if (!drag || !drop || drop.type !== 'hierarchy-folder') {\n return\n }\n\n // Validity is re-derived from the event rather than read off `canDrop`, whose `activeDrag` has\n // just been cleared above.\n if (!canDropItems({ dropTarget: drop, items: drag.items })) {\n return\n }\n\n const selections: Record<string, { ids: (number | string)[] }> = {}\n\n for (const item of drag.items) {\n selections[item.collectionSlug] ??= { ids: [] }\n selections[item.collectionSlug].ids.push(item.id)\n }\n\n void moveDocuments({\n apiRoute,\n destination: { id: drop.folderId, title: drop.title },\n i18n,\n label: drag.items.length === 1 ? drag.items[0].title : t('general:documents'),\n locale,\n parentFieldName: drop.parentFieldName,\n selections,\n t,\n }).then(({ totalMoved }) => {\n if (totalMoved > 0) {\n drag.onMoveSuccess?.()\n refreshTree(drop.hierarchySlug)\n clearRouteCache()\n }\n })\n },\n [apiRoute, clearRouteCache, i18n, locale, refreshTree, t],\n )\n\n const handleDragCancel = useCallback(() => setActiveDrag(null), [])\n\n const contextValue = useMemo<HierarchyDndContextValue>(\n () => ({ activeDrag, canDrop }),\n [activeDrag, canDrop],\n )\n\n const previewCards = activeDrag?.preview.slice(0, MAX_PREVIEW_CARDS) ?? []\n const draggedCount = activeDrag?.items.length ?? 0\n\n return (\n <Context value={contextValue}>\n <DndContext\n collisionDetection={pointerWithin}\n id={dndContextID}\n onDragCancel={handleDragCancel}\n onDragEnd={handleDragEnd}\n onDragStart={handleDragStart}\n sensors={sensors}\n >\n {children}\n <DragOverlay dropAnimation={null} modifiers={OVERLAY_MODIFIERS}>\n {activeDrag ? (\n <div className={`${baseClass}__preview`}>\n {previewCards.map((card, index) => (\n <div\n className={`${baseClass}__preview-card`}\n key={index}\n style={{ '--preview-index': index } as React.CSSProperties}\n >\n {card}\n </div>\n ))}\n {draggedCount > 1 && (\n <span className={`${baseClass}__preview-count`}>{draggedCount}</span>\n )}\n </div>\n ) : null}\n </DragOverlay>\n </DndContext>\n </Context>\n )\n}\n"],"mappings":"AAAA;;;AAIA,SACEA,UAAU,EACVC,WAAW,EACXC,cAAc,EACdC,aAAa,EACbC,aAAa,EACbC,SAAS,EACTC,UAAU,QACL;AACP,SAASC,kBAAkB,QAAQ;AACnC,OAAOC,KAAA,IAASC,aAAa,EAAEC,GAAG,EAAEC,WAAW,EAAEC,KAAK,EAAEC,OAAO,EAAEC,QAAQ,QAAQ;AAIjF,SAASC,aAAa,QAAQ;AAC9B,SAASC,SAAS,QAAQ;AAC1B,SAASC,YAAY,QAAQ;AAC7B,SAASC,SAAS,QAAQ;AAC1B,SAASC,aAAa,QAAQ;AAC9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AAGnE,SAAA,iBAA0B;sBAAGyD;;aAGnD;;;;AAKd","ignoreList":[]}
@@ -0,0 +1,56 @@
1
+ import type React from 'react';
2
+ export type HierarchyDragItem = {
3
+ collectionSlug: string;
4
+ id: number | string;
5
+ title: string;
6
+ };
7
+ /**
8
+ * Attached to every draggable card. Rides on dnd-kit's `active.data`, which is how the drag context
9
+ * - mounted above the view - gets at state that only exists below it: the current selection's
10
+ * contents, its card renders, and how to clear it afterwards.
11
+ */
12
+ export type HierarchyDragData = {
13
+ items: HierarchyDragItem[];
14
+ /**
15
+ * Called after a successful move, by the surface that started the drag. The selection provider
16
+ * lives below the drag context, so the context can't clear the selection itself.
17
+ */
18
+ onMoveSuccess?: () => void;
19
+ /**
20
+ * Ghosted card renders shown fanned under the cursor. Only the first few are used; the rest of
21
+ * the count collapses into a "+N" badge.
22
+ */
23
+ preview: React.ReactNode[];
24
+ type: 'hierarchy-items';
25
+ };
26
+ /**
27
+ * Attached to every drop target - folder cards, tree nodes, breadcrumbs.
28
+ */
29
+ export type HierarchyDropData = {
30
+ /**
31
+ * Collection slugs this destination accepts. Undefined or empty means unrestricted.
32
+ */
33
+ allowedCollections?: string[];
34
+ /**
35
+ * Ids of the destination's ancestors, so a folder can't be dropped into its own subtree.
36
+ */
37
+ ancestorIds: (number | string)[];
38
+ /** Destination hierarchy item, or null for root. */
39
+ folderId: null | number | string;
40
+ hierarchySlug: string;
41
+ parentFieldName: string;
42
+ title: string;
43
+ type: 'hierarchy-folder';
44
+ };
45
+ /**
46
+ * Whether `dropTarget` can accept `items`: the destination has to accept every dragged collection,
47
+ * and a folder can never land inside itself or its own descendants.
48
+ *
49
+ * Shared by the live `canDrop` (which styles hover states) and the drop handler (which re-derives
50
+ * validity from the event, because the active drag has already been cleared by then).
51
+ */
52
+ export declare const canDropItems: ({ dropTarget, items, }: {
53
+ dropTarget: HierarchyDropData;
54
+ items: HierarchyDragItem[];
55
+ }) => boolean;
56
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/providers/HierarchyDnd/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,MAAM,MAAM,iBAAiB,GAAG;IAC9B,cAAc,EAAE,MAAM,CAAA;IACtB,EAAE,EAAE,MAAM,GAAG,MAAM,CAAA;IACnB,KAAK,EAAE,MAAM,CAAA;CACd,CAAA;AAED;;;;GAIG;AACH,MAAM,MAAM,iBAAiB,GAAG;IAC9B,KAAK,EAAE,iBAAiB,EAAE,CAAA;IAC1B;;;OAGG;IACH,aAAa,CAAC,EAAE,MAAM,IAAI,CAAA;IAC1B;;;OAGG;IACH,OAAO,EAAE,KAAK,CAAC,SAAS,EAAE,CAAA;IAC1B,IAAI,EAAE,iBAAiB,CAAA;CACxB,CAAA;AAED;;GAEG;AACH,MAAM,MAAM,iBAAiB,GAAG;IAC9B;;OAEG;IACH,kBAAkB,CAAC,EAAE,MAAM,EAAE,CAAA;IAC7B;;OAEG;IACH,WAAW,EAAE,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,CAAA;IAChC,oDAAoD;IACpD,QAAQ,EAAE,IAAI,GAAG,MAAM,GAAG,MAAM,CAAA;IAChC,aAAa,EAAE,MAAM,CAAA;IACrB,eAAe,EAAE,MAAM,CAAA;IACvB,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,EAAE,kBAAkB,CAAA;CACzB,CAAA;AAED;;;;;;GAMG;AACH,eAAO,MAAM,YAAY,2BAGtB;IACD,UAAU,EAAE,iBAAiB,CAAA;IAC7B,KAAK,EAAE,iBAAiB,EAAE,CAAA;CAC3B,KAAG,OAmBA,CAAA"}
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Whether `dropTarget` can accept `items`: the destination has to accept every dragged collection,
3
+ * and a folder can never land inside itself or its own descendants.
4
+ *
5
+ * Shared by the live `canDrop` (which styles hover states) and the drop handler (which re-derives
6
+ * validity from the event, because the active drag has already been cleared by then).
7
+ */export const canDropItems = ({
8
+ dropTarget,
9
+ items
10
+ }) => items.every(item => {
11
+ if (dropTarget.allowedCollections?.length && !dropTarget.allowedCollections.includes(item.collectionSlug)) {
12
+ return false;
13
+ }
14
+ if (item.collectionSlug === dropTarget.hierarchySlug) {
15
+ // Ids are compared as strings because a folder id can arrive as either across the
16
+ // config/query/DOM boundaries.
17
+ return String(item.id) !== String(dropTarget.folderId) && !dropTarget.ancestorIds.some(id => String(id) === String(item.id));
18
+ }
19
+ return true;
20
+ });
21
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","names":["canDropItems","dropTarget","items","every","item","allowedCollections","length","includes","collectionSlug","hierarchySlug","String","id","folderId","ancestorIds","some"],"sources":["../../../src/providers/HierarchyDnd/types.ts"],"sourcesContent":["import type React from 'react'\n\nexport type HierarchyDragItem = {\n collectionSlug: string\n id: number | string\n title: string\n}\n\n/**\n * Attached to every draggable card. Rides on dnd-kit's `active.data`, which is how the drag context\n * - mounted above the view - gets at state that only exists below it: the current selection's\n * contents, its card renders, and how to clear it afterwards.\n */\nexport type HierarchyDragData = {\n items: HierarchyDragItem[]\n /**\n * Called after a successful move, by the surface that started the drag. The selection provider\n * lives below the drag context, so the context can't clear the selection itself.\n */\n onMoveSuccess?: () => void\n /**\n * Ghosted card renders shown fanned under the cursor. Only the first few are used; the rest of\n * the count collapses into a \"+N\" badge.\n */\n preview: React.ReactNode[]\n type: 'hierarchy-items'\n}\n\n/**\n * Attached to every drop target - folder cards, tree nodes, breadcrumbs.\n */\nexport type HierarchyDropData = {\n /**\n * Collection slugs this destination accepts. Undefined or empty means unrestricted.\n */\n allowedCollections?: string[]\n /**\n * Ids of the destination's ancestors, so a folder can't be dropped into its own subtree.\n */\n ancestorIds: (number | string)[]\n /** Destination hierarchy item, or null for root. */\n folderId: null | number | string\n hierarchySlug: string\n parentFieldName: string\n title: string\n type: 'hierarchy-folder'\n}\n\n/**\n * Whether `dropTarget` can accept `items`: the destination has to accept every dragged collection,\n * and a folder can never land inside itself or its own descendants.\n *\n * Shared by the live `canDrop` (which styles hover states) and the drop handler (which re-derives\n * validity from the event, because the active drag has already been cleared by then).\n */\nexport const canDropItems = ({\n dropTarget,\n items,\n}: {\n dropTarget: HierarchyDropData\n items: HierarchyDragItem[]\n}): boolean =>\n items.every((item) => {\n if (\n dropTarget.allowedCollections?.length &&\n !dropTarget.allowedCollections.includes(item.collectionSlug)\n ) {\n return false\n }\n\n if (item.collectionSlug === dropTarget.hierarchySlug) {\n // Ids are compared as strings because a folder id can arrive as either across the\n // config/query/DOM boundaries.\n return (\n String(item.id) !== String(dropTarget.folderId) &&\n !dropTarget.ancestorIds.some((id) => String(id) === String(item.id))\n )\n }\n\n return true\n })\n"],"mappings":"AAgDA;;;;;;GAOA,OAAO,MAAMA,YAAA,GAAeA,CAAC;EAC3BC,UAAU;EACVC;AAAK,CAIN,KACCA,KAAA,CAAMC,KAAK,CAAEC,IAAA;EACX,IACEH,UAAA,CAAWI,kBAAkB,EAAEC,MAAA,IAC/B,CAACL,UAAA,CAAWI,kBAAkB,CAACE,QAAQ,CAACH,IAAA,CAAKI,cAAc,GAC3D;IACA,OAAO;EACT;EAEA,IAAIJ,IAAA,CAAKI,cAAc,KAAKP,UAAA,CAAWQ,aAAa,EAAE;IACpD;IACA;IACA,OACEC,MAAA,CAAON,IAAA,CAAKO,EAAE,MAAMD,MAAA,CAAOT,UAAA,CAAWW,QAAQ,KAC9C,CAACX,UAAA,CAAWY,WAAW,CAACC,IAAI,CAAEH,EAAA,IAAOD,MAAA,CAAOC,EAAA,MAAQD,MAAA,CAAON,IAAA,CAAKO,EAAE;EAEtE;EAEA,OAAO;AACT","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/providers/Locale/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,SAAS,CAAA;AAGrC,OAAO,KAA0D,MAAM,OAAO,CAAA;AAS9E,eAAO,MAAM,oBAAoB;;4BAEP,OAAO;EAC/B,CAAA;AAcF,eAAO,MAAM,cAAc,EAAE,KAAK,CAAC,EAAE,CAAC;IAAE,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,CAAC,CAAA;CAAE,CA4F5F,CAAA;AAED,eAAO,MAAM,gBAAgB;;4BA7GH,OAAO;CA6G8B,CAAA;AAE/D;;;GAGG;AACH,eAAO,MAAM,SAAS,QAAO,MAA4B,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/providers/Locale/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,SAAS,CAAA;AAGrC,OAAO,KAA0D,MAAM,OAAO,CAAA;AAU9E,eAAO,MAAM,oBAAoB;;4BAEP,OAAO;EAC/B,CAAA;AAcF,eAAO,MAAM,cAAc,EAAE,KAAK,CAAC,EAAE,CAAC;IAAE,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,CAAC,CAAA;CAAE,CAuF5F,CAAA;AAED,eAAO,MAAM,gBAAgB;;4BAxGH,OAAO;CAwG8B,CAAA;AAE/D;;;GAGG;AACH,eAAO,MAAM,SAAS,QAAO,MAA4B,CAAA"}