@payloadcms/ui 4.0.0-internal.5d5a2b2 → 4.0.0-internal.688c4d0

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 (493) hide show
  1. package/dist/css/colors.css +107 -60
  2. package/dist/css/radius.css +1 -3
  3. package/dist/css/theme.css +4 -0
  4. package/dist/css/utilities.css +5 -0
  5. package/dist/elements/APIKeyInput/index.css +92 -0
  6. package/dist/elements/APIKeyInput/index.d.ts +14 -0
  7. package/dist/elements/APIKeyInput/index.d.ts.map +1 -0
  8. package/dist/elements/APIKeyInput/index.js +86 -0
  9. package/dist/elements/APIKeyInput/index.js.map +1 -0
  10. package/dist/elements/AddNewRelation/index.d.ts.map +1 -1
  11. package/dist/elements/AddNewRelation/index.js +85 -103
  12. package/dist/elements/AddNewRelation/index.js.map +1 -1
  13. package/dist/elements/AppHeader/index.d.ts +2 -1
  14. package/dist/elements/AppHeader/index.d.ts.map +1 -1
  15. package/dist/elements/AppHeader/index.js +7 -27
  16. package/dist/elements/AppHeader/index.js.map +1 -1
  17. package/dist/elements/BulkUpload/ActionsBar/index.css +10 -4
  18. package/dist/elements/BulkUpload/ActionsBar/index.d.ts.map +1 -1
  19. package/dist/elements/BulkUpload/ActionsBar/index.js +43 -40
  20. package/dist/elements/BulkUpload/ActionsBar/index.js.map +1 -1
  21. package/dist/elements/BulkUpload/AddFilesView/index.js +1 -1
  22. package/dist/elements/BulkUpload/AddFilesView/index.js.map +1 -1
  23. package/dist/elements/BulkUpload/AddingFilesView/index.css +25 -0
  24. package/dist/elements/BulkUpload/AddingFilesView/index.d.ts +1 -1
  25. package/dist/elements/BulkUpload/AddingFilesView/index.d.ts.map +1 -1
  26. package/dist/elements/BulkUpload/AddingFilesView/index.js +1 -1
  27. package/dist/elements/BulkUpload/AddingFilesView/index.js.map +1 -1
  28. package/dist/elements/BulkUpload/EditForm/index.css +9 -0
  29. package/dist/elements/BulkUpload/EditForm/index.d.ts +1 -1
  30. package/dist/elements/BulkUpload/EditForm/index.d.ts.map +1 -1
  31. package/dist/elements/BulkUpload/EditForm/index.js +1 -1
  32. package/dist/elements/BulkUpload/EditForm/index.js.map +1 -1
  33. package/dist/elements/BulkUpload/EditMany/DrawerContent.d.ts +1 -1
  34. package/dist/elements/BulkUpload/EditMany/DrawerContent.d.ts.map +1 -1
  35. package/dist/elements/BulkUpload/EditMany/DrawerContent.js +59 -55
  36. package/dist/elements/BulkUpload/EditMany/DrawerContent.js.map +1 -1
  37. package/dist/elements/BulkUpload/EditMany/index.css +71 -0
  38. package/dist/elements/BulkUpload/EditMany/index.d.ts +1 -1
  39. package/dist/elements/BulkUpload/EditMany/index.d.ts.map +1 -1
  40. package/dist/elements/BulkUpload/EditMany/index.js +1 -1
  41. package/dist/elements/BulkUpload/EditMany/index.js.map +1 -1
  42. package/dist/elements/BulkUpload/FileSidebar/index.css +54 -75
  43. package/dist/elements/BulkUpload/FileSidebar/index.d.ts.map +1 -1
  44. package/dist/elements/BulkUpload/FileSidebar/index.js +60 -50
  45. package/dist/elements/BulkUpload/FileSidebar/index.js.map +1 -1
  46. package/dist/elements/BulkUpload/FormsManager/index.d.ts.map +1 -1
  47. package/dist/elements/BulkUpload/FormsManager/index.js +13 -0
  48. package/dist/elements/BulkUpload/FormsManager/index.js.map +1 -1
  49. package/dist/elements/Button/index.css +8 -0
  50. package/dist/elements/Chip/index.css +1 -1
  51. package/dist/elements/CodeEditor/CodeEditor.d.ts.map +1 -1
  52. package/dist/elements/CodeEditor/CodeEditor.js +19 -0
  53. package/dist/elements/CodeEditor/CodeEditor.js.map +1 -1
  54. package/dist/elements/ColumnSelector/index.js +1 -1
  55. package/dist/elements/ColumnSelector/index.js.map +1 -1
  56. package/dist/elements/Combobox/index.css +9 -8
  57. package/dist/elements/ConfirmationModal/index.css +7 -0
  58. package/dist/elements/ConfirmationModal/index.d.ts +1 -0
  59. package/dist/elements/ConfirmationModal/index.d.ts.map +1 -1
  60. package/dist/elements/ConfirmationModal/index.js +7 -3
  61. package/dist/elements/ConfirmationModal/index.js.map +1 -1
  62. package/dist/elements/DatePicker/DatePicker.d.ts.map +1 -1
  63. package/dist/elements/DatePicker/DatePicker.js +4 -2
  64. package/dist/elements/DatePicker/DatePicker.js.map +1 -1
  65. package/dist/elements/DatePicker/index.css +5 -0
  66. package/dist/elements/DatePicker/index.js +1 -1
  67. package/dist/elements/DatePicker/index.js.map +1 -1
  68. package/dist/elements/DeleteMany/index.d.ts +3 -26
  69. package/dist/elements/DeleteMany/index.d.ts.map +1 -1
  70. package/dist/elements/DeleteMany/index.js +1 -95
  71. package/dist/elements/DeleteMany/index.js.map +1 -1
  72. package/dist/elements/Dialog/DialogModal/index.d.ts +1 -1
  73. package/dist/elements/Dialog/DialogModal/index.d.ts.map +1 -1
  74. package/dist/elements/Dialog/DialogModal/index.js.map +1 -1
  75. package/dist/elements/Dialog/index.css +4 -0
  76. package/dist/elements/DocumentControls/index.css +10 -0
  77. package/dist/elements/DocumentControls/index.d.ts +6 -0
  78. package/dist/elements/DocumentControls/index.d.ts.map +1 -1
  79. package/dist/elements/DocumentControls/index.js +7 -6
  80. package/dist/elements/DocumentControls/index.js.map +1 -1
  81. package/dist/elements/DocumentDrawer/DrawerContent.d.ts.map +1 -1
  82. package/dist/elements/DocumentDrawer/DrawerContent.js +10 -6
  83. package/dist/elements/DocumentDrawer/DrawerContent.js.map +1 -1
  84. package/dist/elements/DocumentDrawer/DrawerHeader/index.css +76 -4
  85. package/dist/elements/DocumentDrawer/DrawerHeader/index.d.ts +7 -1
  86. package/dist/elements/DocumentDrawer/DrawerHeader/index.d.ts.map +1 -1
  87. package/dist/elements/DocumentDrawer/DrawerHeader/index.js +148 -87
  88. package/dist/elements/DocumentDrawer/DrawerHeader/index.js.map +1 -1
  89. package/dist/elements/DocumentDrawer/types.d.ts +1 -0
  90. package/dist/elements/DocumentDrawer/types.d.ts.map +1 -1
  91. package/dist/elements/DocumentDrawer/types.js.map +1 -1
  92. package/dist/elements/DocumentFields/index.css +61 -2
  93. package/dist/elements/DraggableSortable/index.js.map +1 -1
  94. package/dist/elements/Drawer/index.css +57 -26
  95. package/dist/elements/Drawer/index.d.ts +25 -0
  96. package/dist/elements/Drawer/index.d.ts.map +1 -1
  97. package/dist/elements/Drawer/index.js +133 -54
  98. package/dist/elements/Drawer/index.js.map +1 -1
  99. package/dist/elements/Drawer/types.d.ts +1 -0
  100. package/dist/elements/Drawer/types.d.ts.map +1 -1
  101. package/dist/elements/Drawer/types.js.map +1 -1
  102. package/dist/elements/EditMany/DrawerContent.d.ts +1 -1
  103. package/dist/elements/EditMany/DrawerContent.d.ts.map +1 -1
  104. package/dist/elements/EditMany/DrawerContent.js +76 -71
  105. package/dist/elements/EditMany/DrawerContent.js.map +1 -1
  106. package/dist/elements/EditMany/index.css +71 -0
  107. package/dist/elements/EditMany/index.d.ts +9 -11
  108. package/dist/elements/EditMany/index.d.ts.map +1 -1
  109. package/dist/elements/EditMany/index.js +2 -40
  110. package/dist/elements/EditMany/index.js.map +1 -1
  111. package/dist/elements/FieldSelect/index.css +3 -0
  112. package/dist/elements/FileDetails/DraggableFileDetails/index.css +32 -0
  113. package/dist/elements/FileDetails/DraggableFileDetails/index.d.ts +1 -1
  114. package/dist/elements/FileDetails/DraggableFileDetails/index.d.ts.map +1 -1
  115. package/dist/elements/FileDetails/DraggableFileDetails/index.js +19 -18
  116. package/dist/elements/FileDetails/DraggableFileDetails/index.js.map +1 -1
  117. package/dist/elements/GroupByControl/index.d.ts.map +1 -1
  118. package/dist/elements/GroupByControl/index.js +5 -6
  119. package/dist/elements/GroupByControl/index.js.map +1 -1
  120. package/dist/elements/Hierarchy/Drawer/index.css +3 -21
  121. package/dist/elements/Hierarchy/Drawer/index.d.ts.map +1 -1
  122. package/dist/elements/Hierarchy/Drawer/index.js +5 -3
  123. package/dist/elements/Hierarchy/Drawer/index.js.map +1 -1
  124. package/dist/elements/Hierarchy/Field/SelectedHierarchies.css +36 -0
  125. package/dist/elements/Hierarchy/Field/SelectedHierarchies.d.ts +1 -1
  126. package/dist/elements/Hierarchy/Field/SelectedHierarchies.d.ts.map +1 -1
  127. package/dist/elements/Hierarchy/Field/SelectedHierarchies.js +1 -1
  128. package/dist/elements/Hierarchy/Field/SelectedHierarchies.js.map +1 -1
  129. package/dist/elements/Hierarchy/Field/index.client.d.ts +1 -1
  130. package/dist/elements/Hierarchy/Field/index.client.d.ts.map +1 -1
  131. package/dist/elements/Hierarchy/Field/index.client.js +5 -2
  132. package/dist/elements/Hierarchy/Field/index.client.js.map +1 -1
  133. package/dist/elements/Hierarchy/Field/index.css +37 -0
  134. package/dist/elements/Hierarchy/MoveMany/index.d.ts +0 -1
  135. package/dist/elements/Hierarchy/MoveMany/index.d.ts.map +1 -1
  136. package/dist/elements/Hierarchy/MoveMany/index.js +0 -1
  137. package/dist/elements/Hierarchy/MoveMany/index.js.map +1 -1
  138. package/dist/elements/Hierarchy/Tree/LoadMore/index.css +27 -0
  139. package/dist/elements/Hierarchy/Tree/LoadMore/index.d.ts +1 -1
  140. package/dist/elements/Hierarchy/Tree/LoadMore/index.d.ts.map +1 -1
  141. package/dist/elements/Hierarchy/Tree/LoadMore/index.js +1 -1
  142. package/dist/elements/Hierarchy/Tree/LoadMore/index.js.map +1 -1
  143. package/dist/elements/Hierarchy/Tree/TreeFocusContext.d.ts.map +1 -1
  144. package/dist/elements/Hierarchy/Tree/TreeFocusContext.js +36 -16
  145. package/dist/elements/Hierarchy/Tree/TreeFocusContext.js.map +1 -1
  146. package/dist/elements/Hierarchy/Tree/TreeNode/index.d.ts.map +1 -1
  147. package/dist/elements/Hierarchy/Tree/TreeNode/index.js +20 -15
  148. package/dist/elements/Hierarchy/Tree/TreeNode/index.js.map +1 -1
  149. package/dist/elements/LeaveWithoutSaving/usePreventLeave.js.map +1 -1
  150. package/dist/elements/ListControls/index.css +5 -0
  151. package/dist/elements/ListControls/index.d.ts.map +1 -1
  152. package/dist/elements/ListControls/index.js +1 -1
  153. package/dist/elements/ListControls/index.js.map +1 -1
  154. package/dist/elements/ListDrawer/DrawerContent.d.ts.map +1 -1
  155. package/dist/elements/ListDrawer/DrawerContent.js +12 -6
  156. package/dist/elements/ListDrawer/DrawerContent.js.map +1 -1
  157. package/dist/elements/ListSelection/index.css +1 -1
  158. package/dist/elements/LoadMoreRow/index.css +34 -0
  159. package/dist/elements/LoadMoreRow/index.d.ts +1 -1
  160. package/dist/elements/LoadMoreRow/index.d.ts.map +1 -1
  161. package/dist/elements/LoadMoreRow/index.js +4 -8
  162. package/dist/elements/LoadMoreRow/index.js.map +1 -1
  163. package/dist/elements/Loading/index.css +28 -74
  164. package/dist/elements/Loading/index.d.ts.map +1 -1
  165. package/dist/elements/Loading/index.js +16 -60
  166. package/dist/elements/Loading/index.js.map +1 -1
  167. package/dist/elements/Localizer/index.d.ts.map +1 -1
  168. package/dist/elements/Localizer/index.js +3 -4
  169. package/dist/elements/Localizer/index.js.map +1 -1
  170. package/dist/elements/MenuSeparator/index.d.ts +4 -0
  171. package/dist/elements/MenuSeparator/index.d.ts.map +1 -0
  172. package/dist/elements/MenuSeparator/index.js +10 -0
  173. package/dist/elements/MenuSeparator/index.js.map +1 -0
  174. package/dist/elements/Nav/index.d.ts.map +1 -1
  175. package/dist/elements/Nav/index.js +4 -23
  176. package/dist/elements/Nav/index.js.map +1 -1
  177. package/dist/elements/Pill/index.css +1 -1
  178. package/dist/elements/PillSelector/index.css +1 -1
  179. package/dist/elements/Popup/PopupButtonList/index.css +43 -4
  180. package/dist/elements/Popup/PopupButtonList/index.d.ts.map +1 -1
  181. package/dist/elements/Popup/PopupButtonList/index.js +1 -0
  182. package/dist/elements/Popup/PopupButtonList/index.js.map +1 -1
  183. package/dist/elements/Popup/PopupGroupLabel/index.css +12 -0
  184. package/dist/elements/Popup/index.d.ts +7 -0
  185. package/dist/elements/Popup/index.d.ts.map +1 -1
  186. package/dist/elements/Popup/index.js +125 -59
  187. package/dist/elements/Popup/index.js.map +1 -1
  188. package/dist/elements/PublishButton/ScheduleDrawer/buildUpcomingScheduleWhere.d.ts +13 -0
  189. package/dist/elements/PublishButton/ScheduleDrawer/buildUpcomingScheduleWhere.d.ts.map +1 -0
  190. package/dist/elements/PublishButton/ScheduleDrawer/buildUpcomingScheduleWhere.js +41 -0
  191. package/dist/elements/PublishButton/ScheduleDrawer/buildUpcomingScheduleWhere.js.map +1 -0
  192. package/dist/elements/PublishButton/ScheduleDrawer/index.d.ts +1 -0
  193. package/dist/elements/PublishButton/ScheduleDrawer/index.d.ts.map +1 -1
  194. package/dist/elements/PublishButton/ScheduleDrawer/index.js +9 -31
  195. package/dist/elements/PublishButton/ScheduleDrawer/index.js.map +1 -1
  196. package/dist/elements/PublishButton/index.d.ts.map +1 -1
  197. package/dist/elements/PublishButton/index.js +4 -5
  198. package/dist/elements/PublishButton/index.js.map +1 -1
  199. package/dist/elements/ReactSelect/MultiValue/index.css +1 -1
  200. package/dist/elements/ReactSelect/index.css +53 -52
  201. package/dist/elements/ReactSelect/index.d.ts.map +1 -1
  202. package/dist/elements/ReactSelect/index.js +87 -11
  203. package/dist/elements/ReactSelect/index.js.map +1 -1
  204. package/dist/elements/ReactSelect/types.d.ts +6 -1
  205. package/dist/elements/ReactSelect/types.d.ts.map +1 -1
  206. package/dist/elements/ReactSelect/types.js.map +1 -1
  207. package/dist/elements/RenderTitle/index.css +10 -0
  208. package/dist/elements/RenderTitle/index.d.ts +5 -0
  209. package/dist/elements/RenderTitle/index.d.ts.map +1 -1
  210. package/dist/elements/RenderTitle/index.js +52 -27
  211. package/dist/elements/RenderTitle/index.js.map +1 -1
  212. package/dist/elements/SchedulePublishButton/index.d.ts.map +1 -1
  213. package/dist/elements/SchedulePublishButton/index.js +6 -1
  214. package/dist/elements/SchedulePublishButton/index.js.map +1 -1
  215. package/dist/elements/SelectMany/index.js +1 -1
  216. package/dist/elements/SelectMany/index.js.map +1 -1
  217. package/dist/elements/Spinner/index.css +16 -0
  218. package/dist/elements/Table/DefaultCell/fields/Blocks/index.d.ts.map +1 -1
  219. package/dist/elements/Table/DefaultCell/fields/Blocks/index.js +1 -2
  220. package/dist/elements/Table/DefaultCell/fields/Blocks/index.js.map +1 -1
  221. package/dist/elements/Table/OrderableRow.d.ts.map +1 -1
  222. package/dist/elements/Table/OrderableRow.js +1 -1
  223. package/dist/elements/Table/OrderableRow.js.map +1 -1
  224. package/dist/elements/Table/RelationshipProvider/index.d.ts.map +1 -1
  225. package/dist/elements/Table/RelationshipProvider/index.js +1 -0
  226. package/dist/elements/Table/RelationshipProvider/index.js.map +1 -1
  227. package/dist/elements/Table/index.css +17 -10
  228. package/dist/elements/Tabs/index.css +100 -0
  229. package/dist/elements/Tabs/index.d.ts +32 -0
  230. package/dist/elements/Tabs/index.d.ts.map +1 -0
  231. package/dist/elements/Tabs/index.js +62 -0
  232. package/dist/elements/Tabs/index.js.map +1 -0
  233. package/dist/elements/TimezonePicker/index.css +58 -24
  234. package/dist/elements/TimezonePicker/index.d.ts.map +1 -1
  235. package/dist/elements/TimezonePicker/index.js +31 -4
  236. package/dist/elements/TimezonePicker/index.js.map +1 -1
  237. package/dist/elements/Tooltip/index.css +20 -4
  238. package/dist/elements/Tooltip/index.d.ts.map +1 -1
  239. package/dist/elements/Tooltip/index.js +71 -3
  240. package/dist/elements/Tooltip/index.js.map +1 -1
  241. package/dist/elements/UnpublishButton/index.d.ts.map +1 -1
  242. package/dist/elements/UnpublishButton/index.js +5 -13
  243. package/dist/elements/UnpublishButton/index.js.map +1 -1
  244. package/dist/elements/UserMenu/LanguageMenu/index.d.ts +6 -0
  245. package/dist/elements/UserMenu/LanguageMenu/index.d.ts.map +1 -0
  246. package/dist/elements/UserMenu/LanguageMenu/index.js +133 -0
  247. package/dist/elements/UserMenu/LanguageMenu/index.js.map +1 -0
  248. package/dist/elements/UserMenu/SettingsMenu/index.d.ts +11 -0
  249. package/dist/elements/UserMenu/SettingsMenu/index.d.ts.map +1 -0
  250. package/dist/elements/UserMenu/SettingsMenu/index.js +114 -0
  251. package/dist/elements/UserMenu/SettingsMenu/index.js.map +1 -0
  252. package/dist/elements/UserMenu/SubMenuHeader/index.d.ts +6 -0
  253. package/dist/elements/UserMenu/SubMenuHeader/index.d.ts.map +1 -0
  254. package/dist/elements/UserMenu/SubMenuHeader/index.js +34 -0
  255. package/dist/elements/UserMenu/SubMenuHeader/index.js.map +1 -0
  256. package/dist/elements/UserMenu/ThemeMenu/index.d.ts +6 -0
  257. package/dist/elements/UserMenu/ThemeMenu/index.d.ts.map +1 -0
  258. package/dist/elements/UserMenu/ThemeMenu/index.js +145 -0
  259. package/dist/elements/UserMenu/ThemeMenu/index.js.map +1 -0
  260. package/dist/elements/UserMenu/index.css +80 -0
  261. package/dist/elements/UserMenu/index.d.ts +9 -0
  262. package/dist/elements/UserMenu/index.d.ts.map +1 -0
  263. package/dist/elements/UserMenu/index.js +201 -0
  264. package/dist/elements/UserMenu/index.js.map +1 -0
  265. package/dist/elements/WhereBuilder/Condition/index.css +1 -1
  266. package/dist/elements/WhereBuilder/Condition/index.d.ts.map +1 -1
  267. package/dist/elements/WhereBuilder/Condition/index.js +3 -0
  268. package/dist/elements/WhereBuilder/Condition/index.js.map +1 -1
  269. package/dist/exports/client/index.d.ts +12 -1
  270. package/dist/exports/client/index.d.ts.map +1 -1
  271. package/dist/exports/client/index.js +2 -2
  272. package/dist/exports/client/index.js.map +3 -3
  273. package/dist/exports/shared/index.js +2 -2
  274. package/dist/exports/shared/index.js.map +2 -2
  275. package/dist/fields/Blocks/BlockSelector/BlockSearch/index.css +1 -49
  276. package/dist/fields/Blocks/BlockSelector/BlockSearch/index.d.ts.map +1 -1
  277. package/dist/fields/Blocks/BlockSelector/BlockSearch/index.js +27 -20
  278. package/dist/fields/Blocks/BlockSelector/BlockSearch/index.js.map +1 -1
  279. package/dist/fields/Blocks/BlockSelector/index.css +17 -3
  280. package/dist/fields/Blocks/BlockSelector/index.js +1 -1
  281. package/dist/fields/Blocks/BlockSelector/index.js.map +1 -1
  282. package/dist/fields/Blocks/index.d.ts.map +1 -1
  283. package/dist/fields/Blocks/index.js +6 -11
  284. package/dist/fields/Blocks/index.js.map +1 -1
  285. package/dist/fields/Group/index.css +1 -1
  286. package/dist/fields/Join/index.js +1 -1
  287. package/dist/fields/Join/index.js.map +1 -1
  288. package/dist/fields/Relationship/select-components/MultiValueLabel/index.css +3 -3
  289. package/dist/fields/Row/index.d.ts +1 -1
  290. package/dist/fields/Tabs/Tab/index.d.ts +0 -1
  291. package/dist/fields/Tabs/Tab/index.d.ts.map +1 -1
  292. package/dist/fields/Tabs/Tab/index.js +12 -23
  293. package/dist/fields/Tabs/Tab/index.js.map +1 -1
  294. package/dist/fields/Tabs/index.d.ts.map +1 -1
  295. package/dist/fields/Tabs/index.js +37 -37
  296. package/dist/fields/Tabs/index.js.map +1 -1
  297. package/dist/fields/Upload/HasMany/index.css +4 -0
  298. package/dist/forms/RenderFields/RenderField.d.ts +1 -1
  299. package/dist/forms/RenderFields/RenderField.js +2 -1
  300. package/dist/forms/RenderFields/RenderField.js.map +1 -1
  301. package/dist/forms/fieldSchemasToFormState/addFieldStatePromise.js +1 -1
  302. package/dist/forms/fieldSchemasToFormState/addFieldStatePromise.js.map +1 -1
  303. package/dist/forms/fieldSchemasToFormState/calculateDefaultValues/promise.js +1 -1
  304. package/dist/forms/fieldSchemasToFormState/calculateDefaultValues/promise.js.map +1 -1
  305. package/dist/forms/fieldSchemasToFormState/renderField.js +1 -1
  306. package/dist/forms/fieldSchemasToFormState/renderField.js.map +1 -1
  307. package/dist/forms/useField/index.js.map +1 -1
  308. package/dist/icons/Dots/index.css +4 -4
  309. package/dist/icons/Gear/index.d.ts.map +1 -1
  310. package/dist/icons/Gear/index.js +8 -1
  311. package/dist/icons/Gear/index.js.map +1 -1
  312. package/dist/icons/InteractionEnter/index.css +5 -0
  313. package/dist/icons/InteractionEnter/index.d.ts +11 -0
  314. package/dist/icons/InteractionEnter/index.d.ts.map +1 -0
  315. package/dist/icons/InteractionEnter/index.js +25 -0
  316. package/dist/icons/InteractionEnter/index.js.map +1 -0
  317. package/dist/icons/{Write → Key}/index.css +1 -1
  318. package/dist/icons/Key/index.d.ts +7 -0
  319. package/dist/icons/Key/index.d.ts.map +1 -0
  320. package/dist/icons/Key/index.js +24 -0
  321. package/dist/icons/Key/index.js.map +1 -0
  322. package/dist/icons/LogOut/index.js +2 -2
  323. package/dist/icons/LogOut/index.js.map +1 -1
  324. package/dist/icons/Schedule/index.d.ts.map +1 -1
  325. package/dist/icons/Schedule/index.js +38 -39
  326. package/dist/icons/Schedule/index.js.map +1 -1
  327. package/dist/icons/VariableColor/index.css +5 -0
  328. package/dist/icons/VariableColor/index.d.ts +7 -0
  329. package/dist/icons/VariableColor/index.d.ts.map +1 -0
  330. package/dist/icons/VariableColor/index.js +23 -0
  331. package/dist/icons/VariableColor/index.js.map +1 -0
  332. package/dist/icons/WarningTriangle/index.css +5 -0
  333. package/dist/icons/WarningTriangle/index.d.ts +6 -0
  334. package/dist/icons/WarningTriangle/index.d.ts.map +1 -0
  335. package/dist/icons/WarningTriangle/index.js +21 -0
  336. package/dist/icons/WarningTriangle/index.js.map +1 -0
  337. package/dist/icons/Write/index.d.ts +0 -1
  338. package/dist/icons/Write/index.d.ts.map +1 -1
  339. package/dist/icons/Write/index.js +1 -2
  340. package/dist/icons/Write/index.js.map +1 -1
  341. package/dist/providers/Auth/index.d.ts +3 -1
  342. package/dist/providers/Auth/index.d.ts.map +1 -1
  343. package/dist/providers/Auth/index.js +8 -3
  344. package/dist/providers/Auth/index.js.map +1 -1
  345. package/dist/providers/Config/index.js.map +1 -1
  346. package/dist/providers/DocumentInfo/index.d.ts.map +1 -1
  347. package/dist/providers/DocumentInfo/index.js +4 -0
  348. package/dist/providers/DocumentInfo/index.js.map +1 -1
  349. package/dist/providers/DocumentInfo/types.d.ts +4 -0
  350. package/dist/providers/DocumentInfo/types.d.ts.map +1 -1
  351. package/dist/providers/DocumentInfo/types.js.map +1 -1
  352. package/dist/providers/ListQuery/index.d.ts.map +1 -1
  353. package/dist/providers/ListQuery/index.js +1 -8
  354. package/dist/providers/ListQuery/index.js.map +1 -1
  355. package/dist/providers/Root/index.d.ts.map +1 -1
  356. package/dist/providers/Root/index.js +27 -24
  357. package/dist/providers/Root/index.js.map +1 -1
  358. package/dist/providers/TableColumns/RenderDefaultCell/index.css +1 -0
  359. package/dist/providers/Theme/index.d.ts +17 -2
  360. package/dist/providers/Theme/index.d.ts.map +1 -1
  361. package/dist/providers/Theme/index.js +126 -75
  362. package/dist/providers/Theme/index.js.map +1 -1
  363. package/dist/styles.css +1 -1
  364. package/dist/templates/Default/index.d.ts.map +1 -1
  365. package/dist/templates/Default/index.js +9 -1
  366. package/dist/templates/Default/index.js.map +1 -1
  367. package/dist/utilities/buildClientFieldSchemaMap/traverseFields.js +1 -2
  368. package/dist/utilities/buildClientFieldSchemaMap/traverseFields.js.map +1 -1
  369. package/dist/utilities/buildFieldSchemaMap/traverseFields.js +1 -2
  370. package/dist/utilities/buildFieldSchemaMap/traverseFields.js.map +1 -1
  371. package/dist/utilities/copyDataFromLocale.js +1 -1
  372. package/dist/utilities/copyDataFromLocale.js.map +1 -1
  373. package/dist/utilities/formatDocTitle/formatDateTitle.d.ts.map +1 -1
  374. package/dist/utilities/formatDocTitle/formatDateTitle.js +1 -1
  375. package/dist/utilities/formatDocTitle/formatDateTitle.js.map +1 -1
  376. package/dist/utilities/getHasScheduledPublish.d.ts +12 -0
  377. package/dist/utilities/getHasScheduledPublish.d.ts.map +1 -0
  378. package/dist/utilities/getHasScheduledPublish.js +38 -0
  379. package/dist/utilities/getHasScheduledPublish.js.map +1 -0
  380. package/dist/utilities/getVersions.d.ts.map +1 -1
  381. package/dist/utilities/getVersions.js +1 -21
  382. package/dist/utilities/getVersions.js.map +1 -1
  383. package/dist/utilities/renderTable.js +1 -1
  384. package/dist/utilities/renderTable.js.map +1 -1
  385. package/dist/utilities/traverseForLocalizedFields.d.ts.map +1 -1
  386. package/dist/utilities/traverseForLocalizedFields.js +3 -0
  387. package/dist/utilities/traverseForLocalizedFields.js.map +1 -1
  388. package/dist/views/Account/ResetPreferences/index.js +1 -0
  389. package/dist/views/Account/ResetPreferences/index.js.map +1 -1
  390. package/dist/views/Account/Settings/index.css +30 -13
  391. package/dist/views/Account/ToggleTheme/index.d.ts.map +1 -1
  392. package/dist/views/Account/ToggleTheme/index.js +31 -47
  393. package/dist/views/Account/ToggleTheme/index.js.map +1 -1
  394. package/dist/views/Dashboard/Default/ModularDashboard/index.client.js.map +1 -1
  395. package/dist/views/Document/index.d.ts.map +1 -1
  396. package/dist/views/Document/index.js +10 -1
  397. package/dist/views/Document/index.js.map +1 -1
  398. package/dist/views/Edit/Auth/APIKey.d.ts.map +1 -1
  399. package/dist/views/Edit/Auth/APIKey.js +10 -32
  400. package/dist/views/Edit/Auth/APIKey.js.map +1 -1
  401. package/dist/views/Edit/Auth/index.css +0 -67
  402. package/dist/views/Edit/index.d.ts.map +1 -1
  403. package/dist/views/Edit/index.js +62 -48
  404. package/dist/views/Edit/index.js.map +1 -1
  405. package/dist/views/HierarchyList/DocumentListSelection/index.js +4 -4
  406. package/dist/views/HierarchyList/DocumentListSelection/index.js.map +1 -1
  407. package/dist/views/List/ListHeader/index.css +23 -1
  408. package/dist/views/List/ListHeader/index.d.ts.map +1 -1
  409. package/dist/views/List/ListHeader/index.js +0 -1
  410. package/dist/views/List/ListHeader/index.js.map +1 -1
  411. package/dist/views/List/ListSelection/index.d.ts.map +1 -1
  412. package/dist/views/List/ListSelection/index.js +80 -29
  413. package/dist/views/List/ListSelection/index.js.map +1 -1
  414. package/dist/views/List/handleGroupBy.d.ts.map +1 -1
  415. package/dist/views/List/handleGroupBy.js +9 -0
  416. package/dist/views/List/handleGroupBy.js.map +1 -1
  417. package/dist/views/List/index.client.d.ts.map +1 -1
  418. package/dist/views/List/index.client.js +4 -3
  419. package/dist/views/List/index.client.js.map +1 -1
  420. package/dist/views/List/index.css +15 -0
  421. package/dist/views/List/index.d.ts.map +1 -1
  422. package/dist/views/List/index.js +11 -4
  423. package/dist/views/List/index.js.map +1 -1
  424. package/dist/views/List/renderListViewSlots.d.ts.map +1 -1
  425. package/dist/views/List/renderListViewSlots.js +8 -0
  426. package/dist/views/List/renderListViewSlots.js.map +1 -1
  427. package/dist/views/Logout/LogoutClient.d.ts +14 -0
  428. package/dist/views/Logout/LogoutClient.d.ts.map +1 -1
  429. package/dist/views/Logout/LogoutClient.js +38 -32
  430. package/dist/views/Logout/LogoutClient.js.map +1 -1
  431. package/dist/views/Logout/index.d.ts.map +1 -1
  432. package/dist/views/Logout/index.js +7 -2
  433. package/dist/views/Logout/index.js.map +1 -1
  434. package/dist/views/Verify/index.client.d.ts +4 -0
  435. package/dist/views/Verify/index.client.d.ts.map +1 -1
  436. package/dist/views/Verify/index.client.js +81 -0
  437. package/dist/views/Verify/index.client.js.map +1 -1
  438. package/dist/views/Verify/index.css +38 -0
  439. package/dist/views/Verify/index.d.ts +1 -1
  440. package/dist/views/Verify/index.d.ts.map +1 -1
  441. package/dist/views/Verify/index.js +13 -19
  442. package/dist/views/Verify/index.js.map +1 -1
  443. package/dist/views/Version/Default/index.css +3 -5
  444. package/dist/views/Version/Default/index.d.ts.map +1 -1
  445. package/dist/views/Version/Default/index.js +7 -28
  446. package/dist/views/Version/Default/index.js.map +1 -1
  447. package/dist/views/Version/RenderFieldsToDiff/buildVersionFields.js +2 -2
  448. package/dist/views/Version/RenderFieldsToDiff/buildVersionFields.js.map +1 -1
  449. package/dist/views/Version/RenderFieldsToDiff/fields/Checkbox/index.js.map +1 -1
  450. package/dist/views/Version/RenderFieldsToDiff/utilities/getFieldsForRowComparison.d.ts.map +1 -1
  451. package/dist/views/Version/RenderFieldsToDiff/utilities/getFieldsForRowComparison.js +3 -3
  452. package/dist/views/Version/RenderFieldsToDiff/utilities/getFieldsForRowComparison.js.map +1 -1
  453. package/dist/views/Version/Restore/index.css +2 -2
  454. package/dist/views/Version/SelectComparison/VersionDrawer/index.css +5 -0
  455. package/dist/views/Version/SelectComparison/VersionDrawer/index.d.ts +1 -1
  456. package/dist/views/Version/SelectComparison/VersionDrawer/index.d.ts.map +1 -1
  457. package/dist/views/Version/SelectComparison/VersionDrawer/index.js +1 -2
  458. package/dist/views/Version/SelectComparison/VersionDrawer/index.js.map +1 -1
  459. package/dist/views/Version/SelectComparison/index.css +5 -0
  460. package/dist/views/Version/SelectComparison/index.d.ts +1 -1
  461. package/dist/views/Version/SelectComparison/index.d.ts.map +1 -1
  462. package/dist/views/Version/SelectComparison/index.js +1 -1
  463. package/dist/views/Version/SelectComparison/index.js.map +1 -1
  464. package/dist/views/Version/SelectLocales/index.d.ts +1 -2
  465. package/dist/views/Version/SelectLocales/index.d.ts.map +1 -1
  466. package/dist/views/Version/SelectLocales/index.js +83 -32
  467. package/dist/views/Version/SelectLocales/index.js.map +1 -1
  468. package/dist/views/Versions/cells/CreatedAt/index.js.map +1 -1
  469. package/dist/views/Versions/index.css +20 -13
  470. package/dist/views/Versions/index.d.ts +1 -1
  471. package/dist/views/Versions/index.d.ts.map +1 -1
  472. package/dist/views/Versions/index.js +3 -26
  473. package/dist/views/Versions/index.js.map +1 -1
  474. package/package.json +5 -5
  475. package/dist/elements/BulkUpload/AddingFilesView/index.scss +0 -25
  476. package/dist/elements/BulkUpload/EditForm/index.scss +0 -11
  477. package/dist/elements/BulkUpload/EditMany/index.scss +0 -171
  478. package/dist/elements/EditMany/index.scss +0 -182
  479. package/dist/elements/FileDetails/DraggableFileDetails/index.scss +0 -35
  480. package/dist/elements/Hierarchy/Field/SelectedHierarchies.scss +0 -78
  481. package/dist/elements/Hierarchy/Field/index.scss +0 -41
  482. package/dist/elements/Hierarchy/MoveMany/index.scss +0 -7
  483. package/dist/elements/Hierarchy/Tree/LoadMore/index.scss +0 -26
  484. package/dist/elements/Hierarchy/Tree/TreeConnector.d.ts +0 -7
  485. package/dist/elements/Hierarchy/Tree/TreeConnector.d.ts.map +0 -1
  486. package/dist/elements/Hierarchy/Tree/TreeConnector.js +0 -23
  487. package/dist/elements/Hierarchy/Tree/TreeConnector.js.map +0 -1
  488. package/dist/elements/LoadMoreRow/index.scss +0 -45
  489. package/dist/fields/Tabs/Tab/index.css +0 -82
  490. package/dist/views/Unauthorized/index.scss +0 -14
  491. package/dist/views/Verify/index.scss +0 -18
  492. package/dist/views/Version/SelectComparison/VersionDrawer/index.scss +0 -18
  493. package/dist/views/Version/SelectComparison/index.scss +0 -9
@@ -1,13 +1,15 @@
1
1
  'use client';
2
2
 
3
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
4
4
  export * as PopupList from './PopupButtonList/index.js';
5
- import React, { useCallback, useEffect, useRef, useState } from 'react';
5
+ import React, { createContext, use, useCallback, useEffect, useRef, useState } from 'react';
6
6
  import { createPortal } from 'react-dom';
7
7
  import { useEffectEvent } from '../../hooks/useEffectEvent.js';
8
+ import { ThemeProvider } from '../../providers/Theme/index.js';
8
9
  import './index.css';
9
10
  import { PopupTrigger } from './PopupTrigger/index.js';
10
11
  const baseClass = 'popup';
12
+ const PopupContext = /*#__PURE__*/createContext(null);
11
13
  /**
12
14
  * Selector for all elements the browser considers tabbable.
13
15
  */
@@ -40,6 +42,7 @@ export const Popup = props => {
40
42
  renderButton,
41
43
  showOnHover = false,
42
44
  showScrollbar = false,
45
+ side,
43
46
  size = 'medium',
44
47
  theme = 'dark',
45
48
  verticalAlign = 'bottom'
@@ -52,6 +55,7 @@ export const Popup = props => {
52
55
  * If the popup was opened via mouse, we do not want to autofocus the first element.
53
56
  */
54
57
  const openedViaKeyboardRef = useRef(false);
58
+ const parentPopup = use(PopupContext);
55
59
  const [mounted, setMounted] = useState(false);
56
60
  const [active, setActiveInternal] = useState(initActive);
57
61
  const [isOnTop, setIsOnTop] = useState(verticalAlign === 'top');
@@ -85,50 +89,87 @@ export const Popup = props => {
85
89
  const popupRect = popup.getBoundingClientRect();
86
90
  // Gap between the popup and the trigger/viewport edges (in pixels)
87
91
  const offset = 10;
88
- // /////////////////////////////////////
89
- // Vertical Positioning
90
- // Calculates the `top` position in absolute page coordinates.
91
- // Uses `verticalAlign` prop as the preferred direction, but flips
92
- // to the opposite side if there's not enough viewport space.
93
- // /////////////////////////////////////
92
+ // Additional gap used in side mode so the child popup has breathing room from its parent
93
+ const sideOffset = 4;
94
94
  let top;
95
- let onTop = verticalAlign === 'top';
96
- if (verticalAlign === 'bottom') {
97
- top = triggerRect.bottom + window.scrollY + offset;
98
- if (triggerRect.bottom + popupRect.height + offset > window.innerHeight) {
99
- // Try to flip above — only do so if there's actually enough room
100
- const topIfAbove = triggerRect.top + window.scrollY - popupRect.height - offset;
101
- if (topIfAbove >= window.scrollY) {
102
- top = topIfAbove;
103
- onTop = true;
95
+ let left;
96
+ let caretLeft;
97
+ if (side) {
98
+ // /////////////////////////////////////
99
+ // Side Positioning
100
+ // Places the popup to the left or right of the parent popup (not just the trigger),
101
+ // top-aligned with the trigger. Flips to the opposite side if there is not enough
102
+ // viewport space.
103
+ // /////////////////////////////////////
104
+ // Top: align with trigger top, clamped to viewport
105
+ top = triggerRect.top + window.scrollY;
106
+ const maxTop = window.scrollY + window.innerHeight - popupRect.height - offset;
107
+ top = Math.max(window.scrollY + offset, Math.min(top, maxTop));
108
+ // Use the parent popup's bounding rect as the reference for left/right positioning
109
+ // so the child appears 4px from the parent popup edge, not just the trigger button.
110
+ const anchorRect = parentPopup?.popupRef.current ? parentPopup.popupRef.current.getBoundingClientRect() : triggerRect;
111
+ if (side === 'left') {
112
+ left = anchorRect.left - popupRect.width - sideOffset;
113
+ if (left < offset) {
114
+ // flip to right side
115
+ left = anchorRect.right + sideOffset;
116
+ }
117
+ } else {
118
+ left = anchorRect.right + sideOffset;
119
+ if (left + popupRect.width + offset > window.innerWidth) {
120
+ // flip to left side
121
+ left = anchorRect.left - popupRect.width - sideOffset;
104
122
  }
105
- // else: not enough room above either — keep below and let it overflow rather than going off-screen
106
123
  }
124
+ left = left + window.scrollX;
125
+ // Caret not used in side mode; set a neutral value
126
+ caretLeft = popupRect.width / 2;
127
+ setIsOnTop(false);
107
128
  } else {
108
- top = triggerRect.top + window.scrollY - popupRect.height - offset;
109
- if (triggerRect.top - popupRect.height - offset < 0) {
129
+ // /////////////////////////////////////
130
+ // Vertical Positioning
131
+ // Calculates the `top` position in absolute page coordinates.
132
+ // Uses `verticalAlign` prop as the preferred direction, but flips
133
+ // to the opposite side if there's not enough viewport space.
134
+ // /////////////////////////////////////
135
+ let onTop = verticalAlign === 'top';
136
+ if (verticalAlign === 'bottom') {
110
137
  top = triggerRect.bottom + window.scrollY + offset;
111
- onTop = false;
138
+ if (triggerRect.bottom + popupRect.height + offset > window.innerHeight) {
139
+ // Try to flip above — only do so if there's actually enough room
140
+ const topIfAbove = triggerRect.top + window.scrollY - popupRect.height - offset;
141
+ if (topIfAbove >= window.scrollY) {
142
+ top = topIfAbove;
143
+ onTop = true;
144
+ }
145
+ // else: not enough room above either — keep below and let it overflow rather than going off-screen
146
+ }
147
+ } else {
148
+ top = triggerRect.top + window.scrollY - popupRect.height - offset;
149
+ if (triggerRect.top - popupRect.height - offset < 0) {
150
+ top = triggerRect.bottom + window.scrollY + offset;
151
+ onTop = false;
152
+ }
112
153
  }
154
+ setIsOnTop(onTop);
155
+ // /////////////////////////////////////
156
+ // Horizontal Positioning
157
+ // Calculates the `left` position based on `horizontalAlign` prop:
158
+ // - 'left': aligns popup's left edge with trigger's left edge
159
+ // - 'right': aligns popup's right edge with trigger's right edge
160
+ // - 'center': centers popup horizontally relative to trigger
161
+ // Then clamps to keep the popup within viewport bounds.
162
+ // /////////////////////////////////////
163
+ left = horizontalAlign === 'right' ? triggerRect.right - popupRect.width : horizontalAlign === 'center' ? triggerRect.left + triggerRect.width / 2 - popupRect.width / 2 : triggerRect.left;
164
+ left = Math.max(offset, Math.min(left, window.innerWidth - popupRect.width - offset));
165
+ // /////////////////////////////////////
166
+ // Caret Positioning
167
+ // Positions the caret arrow to point at the trigger's horizontal center.
168
+ // Clamps between 12px from edges to prevent caret from overflowing the popup.
169
+ // /////////////////////////////////////
170
+ const triggerCenter = triggerRect.left + triggerRect.width / 2;
171
+ caretLeft = Math.max(12, Math.min(triggerCenter - left, popupRect.width - 12));
113
172
  }
114
- setIsOnTop(onTop);
115
- // /////////////////////////////////////
116
- // Horizontal Positioning
117
- // Calculates the `left` position based on `horizontalAlign` prop:
118
- // - 'left': aligns popup's left edge with trigger's left edge
119
- // - 'right': aligns popup's right edge with trigger's right edge
120
- // - 'center': centers popup horizontally relative to trigger
121
- // Then clamps to keep the popup within viewport bounds.
122
- // /////////////////////////////////////
123
- let left = horizontalAlign === 'right' ? triggerRect.right - popupRect.width : horizontalAlign === 'center' ? triggerRect.left + triggerRect.width / 2 - popupRect.width / 2 : triggerRect.left;
124
- left = Math.max(offset, Math.min(left, window.innerWidth - popupRect.width - offset));
125
- // /////////////////////////////////////
126
- // Caret Positioning
127
- // Positions the caret arrow to point at the trigger's horizontal center.
128
- // Clamps between 12px from edges to prevent caret from overflowing the popup.
129
- // /////////////////////////////////////
130
- const triggerCenter = triggerRect.left + triggerRect.width / 2;
131
- const caretLeft = Math.max(12, Math.min(triggerCenter - left, popupRect.width - 12));
132
173
  // /////////////////////////////////////
133
174
  // Apply Styles (only if changed)
134
175
  // Compares calculated position with current styles to avoid unnecessary
@@ -222,6 +263,10 @@ export const Popup = props => {
222
263
  // Check if the clicked element or any ancestor is an actionable element
223
264
  const actionable = target_0.closest('button, a[href], [role="button"], [role="menuitem"]');
224
265
  if (actionable && popupRef.current?.contains(actionable)) {
266
+ // Don't close if clicking a nested popup's trigger — it will manage its own open state
267
+ if (actionable.closest(`.${baseClass}__trigger-wrap`)) {
268
+ return;
269
+ }
225
270
  setActive(false);
226
271
  }
227
272
  });
@@ -230,10 +275,19 @@ export const Popup = props => {
230
275
  // /////////////////////////////////////
231
276
  useEffect(() => {
232
277
  if (!active) {
278
+ const popup_1 = popupRef.current;
279
+ if (popup_1) {
280
+ // Clear inline position styles so the CSS `top: -9999px` rule on
281
+ // `.popup__hidden-content` takes effect. Without this, the inline
282
+ // styles set during positioning would win over the CSS rule, keeping
283
+ // portaled children (e.g. a ReactSelect menu) visually on-screen.
284
+ popup_1.style.top = '';
285
+ popup_1.style.left = '';
286
+ }
233
287
  return;
234
288
  }
235
- const popup_1 = popupRef.current;
236
- if (!popup_1) {
289
+ const popup_2 = popupRef.current;
290
+ if (!popup_2) {
237
291
  return;
238
292
  }
239
293
  // /////////////////////////////////////
@@ -262,7 +316,7 @@ export const Popup = props => {
262
316
  if (openedViaKeyboardRef.current) {
263
317
  // Use requestAnimationFrame to ensure DOM is ready.
264
318
  requestAnimationFrame(() => {
265
- const firstFocusable = popup_1.querySelector(TABBABLE_SELECTOR);
319
+ const firstFocusable = popup_2.querySelector(TABBABLE_SELECTOR);
266
320
  firstFocusable?.focus();
267
321
  });
268
322
  }
@@ -279,7 +333,7 @@ export const Popup = props => {
279
333
  });
280
334
  document.addEventListener('mousedown', handleClickOutside);
281
335
  document.addEventListener('keydown', handleKeyDown);
282
- popup_1.addEventListener('click', handleActionableClick);
336
+ popup_2.addEventListener('click', handleActionableClick);
283
337
  return () => {
284
338
  cancelAnimationFrame(rafId);
285
339
  window.removeEventListener('resize', updatePosition);
@@ -288,7 +342,7 @@ export const Popup = props => {
288
342
  });
289
343
  document.removeEventListener('mousedown', handleClickOutside);
290
344
  document.removeEventListener('keydown', handleKeyDown);
291
- popup_1.removeEventListener('click', handleActionableClick);
345
+ popup_2.removeEventListener('click', handleActionableClick);
292
346
  };
293
347
  }, [active]);
294
348
  useEffect(() => {
@@ -326,21 +380,33 @@ export const Popup = props => {
326
380
  // Otherwise, modals opened from the popup will close unexpectedly when clicking within the modal, since
327
381
  // that closes the popup due to the click outside handler.
328
382
  /*#__PURE__*/
329
- createPortal(/*#__PURE__*/_jsxs("div", {
330
- className: active ? [`${baseClass}__content`, `${baseClass}--size-${size}`, isOnTop ? `${baseClass}--v-top` : `${baseClass}--v-bottom`, portalClassName].filter(Boolean).join(' ') :
331
- // tests do not accidentally target inactive popups.
332
- `${baseClass}__hidden-content`,
333
- "data-popup-id": id || undefined,
334
- "data-theme": theme === 'auto' ? undefined : theme,
335
- ref: popupRef,
336
- children: [/*#__PURE__*/_jsxs("div", {
337
- className: `${baseClass}__scroll-container${showScrollbar ? ` ${baseClass}__scroll-container--show-scrollbar` : ''}`,
338
- children: [render?.({
339
- close: () => setActive(false)
340
- }), children]
341
- }), caret && /*#__PURE__*/_jsx("div", {
342
- className: `${baseClass}__caret`
343
- })]
383
+ createPortal(/*#__PURE__*/_jsx(PopupContext, {
384
+ value: {
385
+ popupRef
386
+ },
387
+ children: /*#__PURE__*/_jsxs("div", {
388
+ className: active ? [`${baseClass}__content`, `${baseClass}--size-${size}`, side ? `${baseClass}--side-${side}` : isOnTop ? `${baseClass}--v-top` : `${baseClass}--v-bottom`, portalClassName].filter(Boolean).join(' ') :
389
+ // tests do not accidentally target inactive popups.
390
+ `${baseClass}__hidden-content`,
391
+ "data-popup-id": id || undefined,
392
+ "data-theme": theme === 'auto' ? undefined : theme,
393
+ ref: popupRef,
394
+ children: [/*#__PURE__*/_jsx("div", {
395
+ className: `${baseClass}__scroll-container${showScrollbar ? ` ${baseClass}__scroll-container--show-scrollbar` : ''}`,
396
+ children: theme === 'auto' ? /*#__PURE__*/_jsxs(_Fragment, {
397
+ children: [render?.({
398
+ close: () => setActive(false)
399
+ }), children]
400
+ }) : /*#__PURE__*/_jsxs(ThemeProvider, {
401
+ theme: theme,
402
+ children: [render?.({
403
+ close: () => setActive(false)
404
+ }), children]
405
+ })
406
+ }), caret && !side && /*#__PURE__*/_jsx("div", {
407
+ className: `${baseClass}__caret`
408
+ })]
409
+ })
344
410
  }), document.body) : null]
345
411
  });
346
412
  };
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["PopupList","React","useCallback","useEffect","useRef","useState","createPortal","useEffectEvent","PopupTrigger","baseClass","TABBABLE_SELECTOR","map","s","join","Popup","props","id","button","buttonClassName","buttonSize","buttonType","caret","children","className","disabled","forceOpen","horizontalAlign","initActive","noBackground","onToggleClose","onToggleOpen","portalClassName","render","renderButton","showOnHover","showScrollbar","size","theme","verticalAlign","popupRef","triggerRef","openedViaKeyboardRef","mounted","setMounted","active","setActiveInternal","isOnTop","setIsOnTop","setActive","isActive","viaKeyboard","current","updatePosition","trigger","popup","triggerRect","getBoundingClientRect","popupRect","offset","top","onTop","bottom","window","scrollY","height","innerHeight","topIfAbove","left","right","width","Math","max","min","innerWidth","triggerCenter","caretLeft","newTop","round","newLeft","scrollX","newCaretLeft","style","getPropertyValue","setProperty","handleClickOutside","e","target","isOutsidePopup","contains","isOutsideTrigger","clickedPopupContent","closest","isInsideChildPopup","handleKeyDown","key","preventDefault","querySelector","focus","focusable","Array","from","querySelectorAll","length","currentIndex","findIndex","el","document","activeElement","goBackward","shiftKey","nextIndex","handleActionableClick","actionable","rafId","requestAnimationFrame","firstFocusable","addEventListener","capture","passive","cancelAnimationFrame","removeEventListener","undefined","Trigger","_jsx","_jsxs","filter","Boolean","ref","onMouseEnter","onMouseLeave","role","tabIndex","close","body"],"sources":["../../../src/elements/Popup/index.tsx"],"sourcesContent":["'use client'\nimport type { CSSProperties } from 'react'\n\nexport * as PopupList from './PopupButtonList/index.js'\n\nimport React, { useCallback, useEffect, useRef, useState } from 'react'\nimport { createPortal } from 'react-dom'\n\nimport { useEffectEvent } from '../../hooks/useEffectEvent.js'\nimport './index.css'\nimport { PopupTrigger } from './PopupTrigger/index.js'\n\nconst baseClass = 'popup'\n\n/**\n * Selector for all elements the browser considers tabbable.\n */\nconst TABBABLE_SELECTOR = [\n 'a[href]',\n 'button:not(:disabled)',\n 'input:not(:disabled):not([type=\"hidden\"])',\n 'select:not(:disabled)',\n 'textarea:not(:disabled)',\n '[tabindex]',\n '[contenteditable]:not([contenteditable=\"false\"])',\n 'audio[controls]',\n 'video[controls]',\n 'summary',\n]\n .map((s) => `${s}:not([tabindex=\"-1\"])`)\n .join(', ')\n\nexport type PopupProps = {\n backgroundColor?: CSSProperties['backgroundColor']\n boundingRef?: React.RefObject<HTMLElement>\n button?: React.ReactNode\n /**\n * The class name to apply to the button that triggers the popup.\n */\n buttonClassName?: string\n buttonSize?: 'large' | 'medium'\n buttonType?: 'custom' | 'default'\n caret?: boolean\n children?: React.ReactNode\n /**\n * The class name to apply to the popup container containing the trigger.\n * This does not wrap the actual popup content, which is rendered in a portal.\n */\n className?: string\n disabled?: boolean\n /**\n * Force control the open state of the popup, regardless of the trigger.\n */\n forceOpen?: boolean\n /**\n * Preferred horizontal alignment of the popup, if there is enough space available.\n *\n * @default 'left'\n */\n horizontalAlign?: 'center' | 'left' | 'right'\n id?: string\n initActive?: boolean\n noBackground?: boolean\n onToggleClose?: () => void\n onToggleOpen?: (active: boolean) => void\n /**\n * Class name to apply to the portal container.\n */\n portalClassName?: string\n render?: (args: { close: () => void }) => React.ReactNode\n /**\n * Render prop for custom trigger button. Receives onClick/onKeyDown/aria props.\n * When provided, `button` and `buttonType` are ignored.\n */\n renderButton?: (props: {\n active: boolean\n 'aria-expanded': boolean\n 'aria-haspopup': true\n onClick: React.MouseEventHandler\n onKeyDown: React.KeyboardEventHandler\n }) => React.ReactNode\n showOnHover?: boolean\n /**\n * By default, the scrollbar is hidden. If you want to show it, set this to true.\n * In both cases, the container is still scrollable.\n *\n * @default false\n */\n showScrollbar?: boolean\n size?: 'fit-content' | 'large' | 'medium' | 'small'\n /**\n * Theme for the popup content. Defaults to 'dark'.\n * Set to 'auto' to inherit the current theme.\n *\n * @default 'dark'\n */\n theme?: 'auto' | 'dark' | 'light'\n /**\n * Preferred vertical alignment of the popup (position below or above the trigger),\n * if there is enough space available.\n *\n * If the popup is too close to the edge of the viewport, it will flip to the opposite side\n * regardless of the preferred vertical alignment.\n *\n * @default 'bottom'\n */\n verticalAlign?: 'bottom' | 'top'\n}\n\n/**\n * Component that renders a popup, as well as a button that triggers the popup.\n *\n * The popup is rendered in a portal, and is automatically positioned above / below the trigger,\n * depending on the verticalAlign prop and the space available.\n */\nexport const Popup: React.FC<PopupProps> = (props) => {\n const {\n id,\n button,\n buttonClassName,\n buttonSize,\n buttonType = 'default',\n caret = true,\n children,\n className,\n disabled,\n forceOpen,\n horizontalAlign = 'left',\n initActive = false,\n noBackground,\n onToggleClose,\n onToggleOpen,\n portalClassName,\n render,\n renderButton,\n showOnHover = false,\n showScrollbar = false,\n size = 'medium',\n theme = 'dark',\n verticalAlign = 'bottom',\n } = props\n\n const popupRef = useRef<HTMLDivElement>(null)\n const triggerRef = useRef<HTMLDivElement>(null)\n\n /**\n * Keeps track of whether the popup was opened via keyboard.\n * This is used to determine whether to autofocus the first element in the popup.\n * If the popup was opened via mouse, we do not want to autofocus the first element.\n */\n const openedViaKeyboardRef = useRef(false)\n\n const [mounted, setMounted] = useState(false)\n const [active, setActiveInternal] = useState(initActive)\n const [isOnTop, setIsOnTop] = useState(verticalAlign === 'top')\n\n // Track when component is mounted to avoid SSR/client hydration mismatch\n useEffect(() => {\n setMounted(true)\n }, [])\n\n const setActive = useCallback(\n (isActive: boolean, viaKeyboard = false) => {\n if (isActive) {\n openedViaKeyboardRef.current = viaKeyboard\n onToggleOpen?.(true)\n } else {\n onToggleClose?.()\n }\n setActiveInternal(isActive)\n },\n [onToggleClose, onToggleOpen],\n )\n\n // /////////////////////////////////////\n // Position Calculation\n //\n // Calculates and applies popup position relative to trigger.\n // Always checks viewport bounds (for flipping), but only updates\n // styles if the calculated position differs from current position.\n // /////////////////////////////////////\n\n const updatePosition = useEffectEvent(() => {\n const trigger = triggerRef.current\n const popup = popupRef.current\n if (!trigger || !popup) {\n return\n }\n\n const triggerRect = trigger.getBoundingClientRect()\n const popupRect = popup.getBoundingClientRect()\n\n // Gap between the popup and the trigger/viewport edges (in pixels)\n const offset = 10\n\n // /////////////////////////////////////\n // Vertical Positioning\n // Calculates the `top` position in absolute page coordinates.\n // Uses `verticalAlign` prop as the preferred direction, but flips\n // to the opposite side if there's not enough viewport space.\n // /////////////////////////////////////\n\n let top: number\n let onTop = verticalAlign === 'top'\n\n if (verticalAlign === 'bottom') {\n top = triggerRect.bottom + window.scrollY + offset\n\n if (triggerRect.bottom + popupRect.height + offset > window.innerHeight) {\n // Try to flip above — only do so if there's actually enough room\n const topIfAbove = triggerRect.top + window.scrollY - popupRect.height - offset\n if (topIfAbove >= window.scrollY) {\n top = topIfAbove\n onTop = true\n }\n // else: not enough room above either — keep below and let it overflow rather than going off-screen\n }\n } else {\n top = triggerRect.top + window.scrollY - popupRect.height - offset\n\n if (triggerRect.top - popupRect.height - offset < 0) {\n top = triggerRect.bottom + window.scrollY + offset\n onTop = false\n }\n }\n\n setIsOnTop(onTop)\n\n // /////////////////////////////////////\n // Horizontal Positioning\n // Calculates the `left` position based on `horizontalAlign` prop:\n // - 'left': aligns popup's left edge with trigger's left edge\n // - 'right': aligns popup's right edge with trigger's right edge\n // - 'center': centers popup horizontally relative to trigger\n // Then clamps to keep the popup within viewport bounds.\n // /////////////////////////////////////\n\n let left =\n horizontalAlign === 'right'\n ? triggerRect.right - popupRect.width\n : horizontalAlign === 'center'\n ? triggerRect.left + triggerRect.width / 2 - popupRect.width / 2\n : triggerRect.left\n\n left = Math.max(offset, Math.min(left, window.innerWidth - popupRect.width - offset))\n\n // /////////////////////////////////////\n // Caret Positioning\n // Positions the caret arrow to point at the trigger's horizontal center.\n // Clamps between 12px from edges to prevent caret from overflowing the popup.\n // /////////////////////////////////////\n\n const triggerCenter = triggerRect.left + triggerRect.width / 2\n const caretLeft = Math.max(12, Math.min(triggerCenter - left, popupRect.width - 12))\n\n // /////////////////////////////////////\n // Apply Styles (only if changed)\n // Compares calculated position with current styles to avoid unnecessary\n // DOM updates during scroll. This prevents visual lag by relying on the absolute\n // positioning where possible (popup slightly lags behind when scrolling really fast),\n // while still allowing position changes when needed (e.g., sticky parent, viewport flip).\n // Values are rounded to match browser's CSS precision and avoid false updates.\n // /////////////////////////////////////\n\n const newTop = `${Math.round(top)}px`\n const newLeft = `${Math.round(left + window.scrollX)}px`\n const newCaretLeft = `${Math.round(caretLeft)}px`\n\n if (popup.style.top !== newTop) {\n popup.style.top = newTop\n }\n if (popup.style.left !== newLeft) {\n popup.style.left = newLeft\n }\n if (popup.style.getPropertyValue('--caret-left') !== newCaretLeft) {\n popup.style.setProperty('--caret-left', newCaretLeft)\n }\n })\n\n // /////////////////////////////////////\n // Click Outside Handler\n // Closes popup when clicking outside both the popup and trigger.\n // Distinguishes between parent and child popups:\n // - Click in child popup: parent stays open\n // - Click in parent popup: child closes\n // /////////////////////////////////////\n\n const handleClickOutside = useEffectEvent((e: MouseEvent) => {\n const target = e.target as Node\n const isOutsidePopup = !popupRef.current?.contains(target)\n const isOutsideTrigger = !triggerRef.current?.contains(target)\n\n // Check if click is inside a popup portal\n const clickedPopupContent = (target as Element).closest?.('.popup__content')\n\n // If the clicked popup contains this popup's trigger, it's a parent popup\n // and we should close. If it doesn't contain our trigger, it's a child popup\n // and we should stay open to avoid closing parent when interacting with child.\n const isInsideChildPopup =\n clickedPopupContent && !clickedPopupContent.contains(triggerRef.current)\n\n if (isOutsidePopup && isOutsideTrigger && !isInsideChildPopup) {\n setActive(false)\n }\n })\n\n // /////////////////////////////////////\n // Keyboard Navigation\n // Handles keyboard interactions when popup is open:\n // - Escape: closes popup and returns focus to trigger\n // - Tab/Shift+Tab: cycles through focusable items with wrapping\n // - ArrowUp/ArrowDown: same as Shift+Tab/Tab for menu-style navigation\n // Focus is managed manually to support elements the browser might skip.\n // /////////////////////////////////////\n\n const handleKeyDown = useEffectEvent((e: KeyboardEvent) => {\n const popup = popupRef.current\n if (!popup || !active) {\n return\n }\n\n if (e.key === 'Escape') {\n e.preventDefault()\n setActive(false)\n triggerRef.current?.querySelector<HTMLElement>('button, [tabindex=\"0\"]')?.focus()\n return\n }\n\n if (e.key === 'Tab' || e.key === 'ArrowDown' || e.key === 'ArrowUp') {\n const focusable = Array.from(popup.querySelectorAll<HTMLElement>(TABBABLE_SELECTOR))\n if (focusable.length === 0) {\n return\n }\n\n e.preventDefault()\n\n const currentIndex = focusable.findIndex((el) => el === document.activeElement)\n const goBackward = e.key === 'ArrowUp' || (e.key === 'Tab' && e.shiftKey)\n\n let nextIndex: number\n if (currentIndex === -1) {\n nextIndex = goBackward ? focusable.length - 1 : 0\n } else if (goBackward) {\n nextIndex = currentIndex === 0 ? focusable.length - 1 : currentIndex - 1\n } else {\n nextIndex = currentIndex === focusable.length - 1 ? 0 : currentIndex + 1\n }\n\n focusable[nextIndex].focus()\n }\n })\n\n // /////////////////////////////////////\n // Click Handler for Actionable Elements\n // Closes popup when buttons/links inside are clicked (includes Enter/Space activation).\n // /////////////////////////////////////\n\n const handleActionableClick = useEffectEvent((e: MouseEvent) => {\n const target = e.target as HTMLElement\n\n // Allow opting out with data-popup-prevent-close attribute on element or ancestor\n if (target.closest('[data-popup-prevent-close]')) {\n return\n }\n\n // Check if the clicked element or any ancestor is an actionable element\n const actionable = target.closest('button, a[href], [role=\"button\"], [role=\"menuitem\"]')\n if (actionable && popupRef.current?.contains(actionable)) {\n setActive(false)\n }\n })\n\n // /////////////////////////////////////\n // Effect: Setup/Teardown position and focus management\n // /////////////////////////////////////\n\n useEffect(() => {\n if (!active) {\n return\n }\n\n const popup = popupRef.current\n if (!popup) {\n return\n }\n\n // /////////////////////////////////////\n // Initial Position\n // Calculate and apply popup position.\n // getBoundingClientRect() forces synchronous layout.\n //\n // We call updatePosition() twice: once synchronously (so the popup\n // snaps to roughly the right place immediately rather than flashing\n // from -9999px) and once in a requestAnimationFrame, which fires\n // after the browser has finished laying out the newly-visible popup\n // content. The rAF call is the authoritative one — it catches cases\n // where the popup height wasn't stable yet during the first call\n // (e.g. ColumnSelector content rendering after hidden → visible\n // class switch), which was causing incorrect flip-to-top decisions.\n // /////////////////////////////////////\n\n updatePosition()\n const rafId = requestAnimationFrame(() => {\n updatePosition()\n })\n\n // /////////////////////////////////////\n // Focus Management\n // When opened via keyboard, autofocus the first focusable button.\n // When opened via mouse, skip autofocus to avoid unwanted highlights.\n // /////////////////////////////////////\n\n if (openedViaKeyboardRef.current) {\n // Use requestAnimationFrame to ensure DOM is ready.\n requestAnimationFrame(() => {\n const firstFocusable = popup.querySelector<HTMLElement>(TABBABLE_SELECTOR)\n firstFocusable?.focus()\n })\n }\n\n // /////////////////////////////////////\n // Event Listeners\n // - resize/scroll: recalculate position (only applies styles if changed)\n // - mousedown: detect clicks outside to close\n // - keydown: handle keyboard navigation\n // /////////////////////////////////////\n\n window.addEventListener('resize', updatePosition)\n window.addEventListener('scroll', updatePosition, { capture: true, passive: true })\n document.addEventListener('mousedown', handleClickOutside)\n document.addEventListener('keydown', handleKeyDown)\n popup.addEventListener('click', handleActionableClick)\n\n return () => {\n cancelAnimationFrame(rafId)\n window.removeEventListener('resize', updatePosition)\n window.removeEventListener('scroll', updatePosition, { capture: true })\n document.removeEventListener('mousedown', handleClickOutside)\n document.removeEventListener('keydown', handleKeyDown)\n popup.removeEventListener('click', handleActionableClick)\n }\n }, [active])\n\n useEffect(() => {\n if (forceOpen !== undefined) {\n setActive(forceOpen)\n }\n }, [forceOpen, setActive])\n\n const Trigger = (\n <PopupTrigger\n active={active}\n button={button}\n buttonType={buttonType}\n className={buttonClassName}\n disabled={disabled}\n noBackground={noBackground}\n renderButton={renderButton}\n setActive={setActive}\n size={buttonSize}\n />\n )\n\n return (\n <div className={[baseClass, className].filter(Boolean).join(' ')} id={id}>\n <div className={`${baseClass}__trigger-wrap`} ref={triggerRef}>\n {showOnHover ? (\n <div\n className={`${baseClass}__on-hover-watch`}\n onMouseEnter={() => setActive(true)}\n onMouseLeave={() => setActive(false)}\n role=\"button\"\n tabIndex={0}\n >\n {Trigger}\n </div>\n ) : (\n Trigger\n )}\n </div>\n\n {mounted\n ? // We need to make sure the popup is part of the DOM (although invisible), even if it's not active.\n // This ensures that components within the popup, like modals, do not unmount when the popup closes.\n // Otherwise, modals opened from the popup will close unexpectedly when clicking within the modal, since\n // that closes the popup due to the click outside handler.\n createPortal(\n <div\n className={\n active\n ? [\n `${baseClass}__content`,\n `${baseClass}--size-${size}`,\n isOnTop ? `${baseClass}--v-top` : `${baseClass}--v-bottom`,\n portalClassName,\n ]\n .filter(Boolean)\n .join(' ')\n : // Do not share any class names between active and disabled popups, to make sure\n // tests do not accidentally target inactive popups.\n `${baseClass}__hidden-content`\n }\n data-popup-id={id || undefined}\n data-theme={theme === 'auto' ? undefined : theme}\n ref={popupRef}\n >\n <div\n className={`${baseClass}__scroll-container${showScrollbar ? ` ${baseClass}__scroll-container--show-scrollbar` : ''}`}\n >\n {render?.({ close: () => setActive(false) })}\n {children}\n </div>\n {caret && <div className={`${baseClass}__caret`} />}\n </div>,\n document.body,\n )\n : null}\n </div>\n )\n}\n"],"mappings":"AAAA;;;AAGA,OAAO,KAAKA,SAAS,MAAM;AAE3B,OAAOC,KAAA,IAASC,WAAW,EAAEC,SAAS,EAAEC,MAAM,EAAEC,QAAQ,QAAQ;AAChE,SAASC,YAAY,QAAQ;AAE7B,SAASC,cAAc,QAAQ;AAC/B,OAAO;AACP,SAASC,YAAY,QAAQ;AAE7B,MAAMC,SAAA,GAAY;AAElB;;;AAGA,MAAMC,iBAAA,GAAoB,CACxB,WACA,yBACA,6CACA,yBACA,2BACA,cACA,oDACA,mBACA,mBACA,UACD,CACEC,GAAG,CAAEC,CAAA,IAAM,GAAGA,CAAA,uBAAwB,EACtCC,IAAI,CAAC;AA+ER;;;;;;AAMA,OAAO,MAAMC,KAAA,GAA+BC,KAAA;EAC1C,MAAM;IACJC,EAAE;IACFC,MAAM;IACNC,eAAe;IACfC,UAAU;IACVC,UAAA,GAAa,SAAS;IACtBC,KAAA,GAAQ,IAAI;IACZC,QAAQ;IACRC,SAAS;IACTC,QAAQ;IACRC,SAAS;IACTC,eAAA,GAAkB,MAAM;IACxBC,UAAA,GAAa,KAAK;IAClBC,YAAY;IACZC,aAAa;IACbC,YAAY;IACZC,eAAe;IACfC,MAAM;IACNC,YAAY;IACZC,WAAA,GAAc,KA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,SAAA,EAAW,GAAGd,SAAA,gBAAyB;MAAEsH,GAAA,EAAKvF,UAAA;gBAChDN,WAAA,gBACCyF,IAAA,CAAC;QACCpG,SAAA,EAAW,GAAGd,SAAA,kBAA2B;QACzCuH,YAAA,EAAcA,CAAA,KAAMhF,SAAA,CAAU;QAC9BiF,YAAA,EAAcA,CAAA,KAAMjF,SAAA,CAAU;QAC9BkF,IAAA,EAAK;QACLC,QAAA,EAAU;kBAETT;WAGHA;QAIHhF,OAAA;IAEG;IACA;IACA;;IACApC,YAAA,cACEsH,KAAA,CAAC;MACCrG,SAAA,EACEqB,MAAA,GACI,CACE,GAAGnC,SAAA,WAAoB,EACvB,GAAGA,SAAA,UAAmB2B,IAAA,EAAM,EAC5BU,OAAA,GAAU,GAAGrC,SAAA,SAAkB,GAAG,GAAGA,SAAA,YAAqB,EAC1DsB,eAAA,CACD,CACE8F,MAAM,CAACC,OAAA,EACPjH,IAAI,CAAC;MAER;MACA,GAAGJ,SAAA,kBAA2B;MAEpC,iBAAeO,EAAA,IAAMyG,SAAA;MACrB,cAAYpF,KAAA,KAAU,SAASoF,SAAA,GAAYpF,KAAA;MAC3C0F,GAAA,EAAKxF,QAAA;8BAELqF,KAAA,CAAC;QACCrG,SAAA,EAAW,GAAGd,SAAA,qBAA8B0B,aAAA,GAAgB,IAAI1B,SAAA,oCAA6C,GAAG,IAAI;mBAEnHuB,MAAA,GAAS;UAAEoG,KAAA,EAAOA,CAAA,KAAMpF,SAAA,CAAU;QAAO,IACzC1B,QAAA;UAEFD,KAAA,iBAASsG,IAAA,CAAC;QAAIpG,SAAA,EAAW,GAAGd,SAAA;;QAE/BiG,QAAA,CAAS2B,IAAI,IAEf;;AAGV","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["PopupList","React","createContext","use","useCallback","useEffect","useRef","useState","createPortal","useEffectEvent","ThemeProvider","PopupTrigger","baseClass","PopupContext","TABBABLE_SELECTOR","map","s","join","Popup","props","id","button","buttonClassName","buttonSize","buttonType","caret","children","className","disabled","forceOpen","horizontalAlign","initActive","noBackground","onToggleClose","onToggleOpen","portalClassName","render","renderButton","showOnHover","showScrollbar","side","size","theme","verticalAlign","popupRef","triggerRef","openedViaKeyboardRef","parentPopup","mounted","setMounted","active","setActiveInternal","isOnTop","setIsOnTop","setActive","isActive","viaKeyboard","current","updatePosition","trigger","popup","triggerRect","getBoundingClientRect","popupRect","offset","sideOffset","top","left","caretLeft","window","scrollY","maxTop","innerHeight","height","Math","max","min","anchorRect","width","right","innerWidth","scrollX","onTop","bottom","topIfAbove","triggerCenter","newTop","round","newLeft","newCaretLeft","style","getPropertyValue","setProperty","handleClickOutside","e","target","isOutsidePopup","contains","isOutsideTrigger","clickedPopupContent","closest","isInsideChildPopup","handleKeyDown","key","preventDefault","querySelector","focus","focusable","Array","from","querySelectorAll","length","currentIndex","findIndex","el","document","activeElement","goBackward","shiftKey","nextIndex","handleActionableClick","actionable","rafId","requestAnimationFrame","firstFocusable","addEventListener","capture","passive","cancelAnimationFrame","removeEventListener","undefined","Trigger","_jsx","_jsxs","filter","Boolean","ref","onMouseEnter","onMouseLeave","role","tabIndex","value","_Fragment","close","body"],"sources":["../../../src/elements/Popup/index.tsx"],"sourcesContent":["'use client'\nimport type { CSSProperties } from 'react'\n\nexport * as PopupList from './PopupButtonList/index.js'\n\nimport React, { createContext, use, useCallback, useEffect, useRef, useState } from 'react'\nimport { createPortal } from 'react-dom'\n\nimport { useEffectEvent } from '../../hooks/useEffectEvent.js'\nimport { ThemeProvider } from '../../providers/Theme/index.js'\nimport './index.css'\nimport { PopupTrigger } from './PopupTrigger/index.js'\n\nconst baseClass = 'popup'\n\ntype PopupContextValue = {\n popupRef: React.RefObject<HTMLDivElement | null>\n}\n\nconst PopupContext = createContext<null | PopupContextValue>(null)\n\n/**\n * Selector for all elements the browser considers tabbable.\n */\nconst TABBABLE_SELECTOR = [\n 'a[href]',\n 'button:not(:disabled)',\n 'input:not(:disabled):not([type=\"hidden\"])',\n 'select:not(:disabled)',\n 'textarea:not(:disabled)',\n '[tabindex]',\n '[contenteditable]:not([contenteditable=\"false\"])',\n 'audio[controls]',\n 'video[controls]',\n 'summary',\n]\n .map((s) => `${s}:not([tabindex=\"-1\"])`)\n .join(', ')\n\nexport type PopupProps = {\n backgroundColor?: CSSProperties['backgroundColor']\n boundingRef?: React.RefObject<HTMLElement>\n button?: React.ReactNode\n /**\n * The class name to apply to the button that triggers the popup.\n */\n buttonClassName?: string\n buttonSize?: 'large' | 'medium'\n buttonType?: 'custom' | 'default'\n caret?: boolean\n children?: React.ReactNode\n /**\n * The class name to apply to the popup container containing the trigger.\n * This does not wrap the actual popup content, which is rendered in a portal.\n */\n className?: string\n disabled?: boolean\n /**\n * Force control the open state of the popup, regardless of the trigger.\n */\n forceOpen?: boolean\n /**\n * Preferred horizontal alignment of the popup, if there is enough space available.\n *\n * @default 'left'\n */\n horizontalAlign?: 'center' | 'left' | 'right'\n id?: string\n initActive?: boolean\n noBackground?: boolean\n onToggleClose?: () => void\n onToggleOpen?: (active: boolean) => void\n /**\n * Class name to apply to the portal container.\n */\n portalClassName?: string\n render?: (args: { close: () => void }) => React.ReactNode\n /**\n * Render prop for custom trigger button. Receives onClick/onKeyDown/aria props.\n * When provided, `button` and `buttonType` are ignored.\n */\n renderButton?: (props: {\n active: boolean\n 'aria-expanded': boolean\n 'aria-haspopup': true\n onClick: React.MouseEventHandler\n onKeyDown: React.KeyboardEventHandler\n }) => React.ReactNode\n showOnHover?: boolean\n /**\n * By default, the scrollbar is hidden. If you want to show it, set this to true.\n * In both cases, the container is still scrollable.\n *\n * @default false\n */\n showScrollbar?: boolean\n /**\n * Position the popup to the side of the trigger instead of above/below.\n * The popup's top edge aligns with the trigger's top edge (with viewport clamping).\n * Automatically flips to the opposite side if there is not enough space.\n * When set, `verticalAlign`, `horizontalAlign`, and the caret are ignored.\n */\n side?: 'left' | 'right'\n size?: 'fit-content' | 'large' | 'medium' | 'small'\n /**\n * Theme for the popup content. Defaults to 'dark'.\n * Set to 'auto' to inherit the current theme.\n *\n * @default 'dark'\n */\n theme?: 'auto' | 'dark' | 'light'\n /**\n * Preferred vertical alignment of the popup (position below or above the trigger),\n * if there is enough space available.\n *\n * If the popup is too close to the edge of the viewport, it will flip to the opposite side\n * regardless of the preferred vertical alignment.\n *\n * @default 'bottom'\n */\n verticalAlign?: 'bottom' | 'top'\n}\n\n/**\n * Component that renders a popup, as well as a button that triggers the popup.\n *\n * The popup is rendered in a portal, and is automatically positioned above / below the trigger,\n * depending on the verticalAlign prop and the space available.\n */\nexport const Popup: React.FC<PopupProps> = (props) => {\n const {\n id,\n button,\n buttonClassName,\n buttonSize,\n buttonType = 'default',\n caret = true,\n children,\n className,\n disabled,\n forceOpen,\n horizontalAlign = 'left',\n initActive = false,\n noBackground,\n onToggleClose,\n onToggleOpen,\n portalClassName,\n render,\n renderButton,\n showOnHover = false,\n showScrollbar = false,\n side,\n size = 'medium',\n theme = 'dark',\n verticalAlign = 'bottom',\n } = props\n\n const popupRef = useRef<HTMLDivElement>(null)\n const triggerRef = useRef<HTMLDivElement>(null)\n\n /**\n * Keeps track of whether the popup was opened via keyboard.\n * This is used to determine whether to autofocus the first element in the popup.\n * If the popup was opened via mouse, we do not want to autofocus the first element.\n */\n const openedViaKeyboardRef = useRef(false)\n\n const parentPopup = use(PopupContext)\n\n const [mounted, setMounted] = useState(false)\n const [active, setActiveInternal] = useState(initActive)\n const [isOnTop, setIsOnTop] = useState(verticalAlign === 'top')\n\n // Track when component is mounted to avoid SSR/client hydration mismatch\n useEffect(() => {\n setMounted(true)\n }, [])\n\n const setActive = useCallback(\n (isActive: boolean, viaKeyboard = false) => {\n if (isActive) {\n openedViaKeyboardRef.current = viaKeyboard\n onToggleOpen?.(true)\n } else {\n onToggleClose?.()\n }\n setActiveInternal(isActive)\n },\n [onToggleClose, onToggleOpen],\n )\n\n // /////////////////////////////////////\n // Position Calculation\n //\n // Calculates and applies popup position relative to trigger.\n // Always checks viewport bounds (for flipping), but only updates\n // styles if the calculated position differs from current position.\n // /////////////////////////////////////\n\n const updatePosition = useEffectEvent(() => {\n const trigger = triggerRef.current\n const popup = popupRef.current\n if (!trigger || !popup) {\n return\n }\n\n const triggerRect = trigger.getBoundingClientRect()\n const popupRect = popup.getBoundingClientRect()\n\n // Gap between the popup and the trigger/viewport edges (in pixels)\n const offset = 10\n // Additional gap used in side mode so the child popup has breathing room from its parent\n const sideOffset = 4\n\n let top: number\n let left: number\n let caretLeft: number\n\n if (side) {\n // /////////////////////////////////////\n // Side Positioning\n // Places the popup to the left or right of the parent popup (not just the trigger),\n // top-aligned with the trigger. Flips to the opposite side if there is not enough\n // viewport space.\n // /////////////////////////////////////\n\n // Top: align with trigger top, clamped to viewport\n top = triggerRect.top + window.scrollY\n const maxTop = window.scrollY + window.innerHeight - popupRect.height - offset\n top = Math.max(window.scrollY + offset, Math.min(top, maxTop))\n\n // Use the parent popup's bounding rect as the reference for left/right positioning\n // so the child appears 4px from the parent popup edge, not just the trigger button.\n const anchorRect = parentPopup?.popupRef.current\n ? parentPopup.popupRef.current.getBoundingClientRect()\n : triggerRect\n\n if (side === 'left') {\n left = anchorRect.left - popupRect.width - sideOffset\n if (left < offset) {\n // flip to right side\n left = anchorRect.right + sideOffset\n }\n } else {\n left = anchorRect.right + sideOffset\n if (left + popupRect.width + offset > window.innerWidth) {\n // flip to left side\n left = anchorRect.left - popupRect.width - sideOffset\n }\n }\n\n left = left + window.scrollX\n // Caret not used in side mode; set a neutral value\n caretLeft = popupRect.width / 2\n\n setIsOnTop(false)\n } else {\n // /////////////////////////////////////\n // Vertical Positioning\n // Calculates the `top` position in absolute page coordinates.\n // Uses `verticalAlign` prop as the preferred direction, but flips\n // to the opposite side if there's not enough viewport space.\n // /////////////////////////////////////\n\n let onTop = verticalAlign === 'top'\n\n if (verticalAlign === 'bottom') {\n top = triggerRect.bottom + window.scrollY + offset\n\n if (triggerRect.bottom + popupRect.height + offset > window.innerHeight) {\n // Try to flip above — only do so if there's actually enough room\n const topIfAbove = triggerRect.top + window.scrollY - popupRect.height - offset\n if (topIfAbove >= window.scrollY) {\n top = topIfAbove\n onTop = true\n }\n // else: not enough room above either — keep below and let it overflow rather than going off-screen\n }\n } else {\n top = triggerRect.top + window.scrollY - popupRect.height - offset\n\n if (triggerRect.top - popupRect.height - offset < 0) {\n top = triggerRect.bottom + window.scrollY + offset\n onTop = false\n }\n }\n\n setIsOnTop(onTop)\n\n // /////////////////////////////////////\n // Horizontal Positioning\n // Calculates the `left` position based on `horizontalAlign` prop:\n // - 'left': aligns popup's left edge with trigger's left edge\n // - 'right': aligns popup's right edge with trigger's right edge\n // - 'center': centers popup horizontally relative to trigger\n // Then clamps to keep the popup within viewport bounds.\n // /////////////////////////////////////\n\n left =\n horizontalAlign === 'right'\n ? triggerRect.right - popupRect.width\n : horizontalAlign === 'center'\n ? triggerRect.left + triggerRect.width / 2 - popupRect.width / 2\n : triggerRect.left\n\n left = Math.max(offset, Math.min(left, window.innerWidth - popupRect.width - offset))\n\n // /////////////////////////////////////\n // Caret Positioning\n // Positions the caret arrow to point at the trigger's horizontal center.\n // Clamps between 12px from edges to prevent caret from overflowing the popup.\n // /////////////////////////////////////\n\n const triggerCenter = triggerRect.left + triggerRect.width / 2\n caretLeft = Math.max(12, Math.min(triggerCenter - left, popupRect.width - 12))\n }\n\n // /////////////////////////////////////\n // Apply Styles (only if changed)\n // Compares calculated position with current styles to avoid unnecessary\n // DOM updates during scroll. This prevents visual lag by relying on the absolute\n // positioning where possible (popup slightly lags behind when scrolling really fast),\n // while still allowing position changes when needed (e.g., sticky parent, viewport flip).\n // Values are rounded to match browser's CSS precision and avoid false updates.\n // /////////////////////////////////////\n\n const newTop = `${Math.round(top)}px`\n const newLeft = `${Math.round(left + window.scrollX)}px`\n const newCaretLeft = `${Math.round(caretLeft)}px`\n\n if (popup.style.top !== newTop) {\n popup.style.top = newTop\n }\n if (popup.style.left !== newLeft) {\n popup.style.left = newLeft\n }\n if (popup.style.getPropertyValue('--caret-left') !== newCaretLeft) {\n popup.style.setProperty('--caret-left', newCaretLeft)\n }\n })\n\n // /////////////////////////////////////\n // Click Outside Handler\n // Closes popup when clicking outside both the popup and trigger.\n // Distinguishes between parent and child popups:\n // - Click in child popup: parent stays open\n // - Click in parent popup: child closes\n // /////////////////////////////////////\n\n const handleClickOutside = useEffectEvent((e: MouseEvent) => {\n const target = e.target as Node\n const isOutsidePopup = !popupRef.current?.contains(target)\n const isOutsideTrigger = !triggerRef.current?.contains(target)\n\n // Check if click is inside a popup portal\n const clickedPopupContent = (target as Element).closest?.('.popup__content')\n\n // If the clicked popup contains this popup's trigger, it's a parent popup\n // and we should close. If it doesn't contain our trigger, it's a child popup\n // and we should stay open to avoid closing parent when interacting with child.\n const isInsideChildPopup =\n clickedPopupContent && !clickedPopupContent.contains(triggerRef.current)\n\n if (isOutsidePopup && isOutsideTrigger && !isInsideChildPopup) {\n setActive(false)\n }\n })\n\n // /////////////////////////////////////\n // Keyboard Navigation\n // Handles keyboard interactions when popup is open:\n // - Escape: closes popup and returns focus to trigger\n // - Tab/Shift+Tab: cycles through focusable items with wrapping\n // - ArrowUp/ArrowDown: same as Shift+Tab/Tab for menu-style navigation\n // Focus is managed manually to support elements the browser might skip.\n // /////////////////////////////////////\n\n const handleKeyDown = useEffectEvent((e: KeyboardEvent) => {\n const popup = popupRef.current\n if (!popup || !active) {\n return\n }\n\n if (e.key === 'Escape') {\n e.preventDefault()\n setActive(false)\n triggerRef.current?.querySelector<HTMLElement>('button, [tabindex=\"0\"]')?.focus()\n return\n }\n\n if (e.key === 'Tab' || e.key === 'ArrowDown' || e.key === 'ArrowUp') {\n const focusable = Array.from(popup.querySelectorAll<HTMLElement>(TABBABLE_SELECTOR))\n if (focusable.length === 0) {\n return\n }\n\n e.preventDefault()\n\n const currentIndex = focusable.findIndex((el) => el === document.activeElement)\n const goBackward = e.key === 'ArrowUp' || (e.key === 'Tab' && e.shiftKey)\n\n let nextIndex: number\n if (currentIndex === -1) {\n nextIndex = goBackward ? focusable.length - 1 : 0\n } else if (goBackward) {\n nextIndex = currentIndex === 0 ? focusable.length - 1 : currentIndex - 1\n } else {\n nextIndex = currentIndex === focusable.length - 1 ? 0 : currentIndex + 1\n }\n\n focusable[nextIndex].focus()\n }\n })\n\n // /////////////////////////////////////\n // Click Handler for Actionable Elements\n // Closes popup when buttons/links inside are clicked (includes Enter/Space activation).\n // /////////////////////////////////////\n\n const handleActionableClick = useEffectEvent((e: MouseEvent) => {\n const target = e.target as HTMLElement\n\n // Allow opting out with data-popup-prevent-close attribute on element or ancestor\n if (target.closest('[data-popup-prevent-close]')) {\n return\n }\n\n // Check if the clicked element or any ancestor is an actionable element\n const actionable = target.closest('button, a[href], [role=\"button\"], [role=\"menuitem\"]')\n if (actionable && popupRef.current?.contains(actionable)) {\n // Don't close if clicking a nested popup's trigger — it will manage its own open state\n if (actionable.closest(`.${baseClass}__trigger-wrap`)) {\n return\n }\n setActive(false)\n }\n })\n\n // /////////////////////////////////////\n // Effect: Setup/Teardown position and focus management\n // /////////////////////////////////////\n\n useEffect(() => {\n if (!active) {\n const popup = popupRef.current\n if (popup) {\n // Clear inline position styles so the CSS `top: -9999px` rule on\n // `.popup__hidden-content` takes effect. Without this, the inline\n // styles set during positioning would win over the CSS rule, keeping\n // portaled children (e.g. a ReactSelect menu) visually on-screen.\n popup.style.top = ''\n popup.style.left = ''\n }\n return\n }\n\n const popup = popupRef.current\n if (!popup) {\n return\n }\n\n // /////////////////////////////////////\n // Initial Position\n // Calculate and apply popup position.\n // getBoundingClientRect() forces synchronous layout.\n //\n // We call updatePosition() twice: once synchronously (so the popup\n // snaps to roughly the right place immediately rather than flashing\n // from -9999px) and once in a requestAnimationFrame, which fires\n // after the browser has finished laying out the newly-visible popup\n // content. The rAF call is the authoritative one — it catches cases\n // where the popup height wasn't stable yet during the first call\n // (e.g. ColumnSelector content rendering after hidden → visible\n // class switch), which was causing incorrect flip-to-top decisions.\n // /////////////////////////////////////\n\n updatePosition()\n const rafId = requestAnimationFrame(() => {\n updatePosition()\n })\n\n // /////////////////////////////////////\n // Focus Management\n // When opened via keyboard, autofocus the first focusable button.\n // When opened via mouse, skip autofocus to avoid unwanted highlights.\n // /////////////////////////////////////\n\n if (openedViaKeyboardRef.current) {\n // Use requestAnimationFrame to ensure DOM is ready.\n requestAnimationFrame(() => {\n const firstFocusable = popup.querySelector<HTMLElement>(TABBABLE_SELECTOR)\n firstFocusable?.focus()\n })\n }\n\n // /////////////////////////////////////\n // Event Listeners\n // - resize/scroll: recalculate position (only applies styles if changed)\n // - mousedown: detect clicks outside to close\n // - keydown: handle keyboard navigation\n // /////////////////////////////////////\n\n window.addEventListener('resize', updatePosition)\n window.addEventListener('scroll', updatePosition, { capture: true, passive: true })\n document.addEventListener('mousedown', handleClickOutside)\n document.addEventListener('keydown', handleKeyDown)\n popup.addEventListener('click', handleActionableClick)\n\n return () => {\n cancelAnimationFrame(rafId)\n window.removeEventListener('resize', updatePosition)\n window.removeEventListener('scroll', updatePosition, { capture: true })\n document.removeEventListener('mousedown', handleClickOutside)\n document.removeEventListener('keydown', handleKeyDown)\n popup.removeEventListener('click', handleActionableClick)\n }\n }, [active])\n\n useEffect(() => {\n if (forceOpen !== undefined) {\n setActive(forceOpen)\n }\n }, [forceOpen, setActive])\n\n const Trigger = (\n <PopupTrigger\n active={active}\n button={button}\n buttonType={buttonType}\n className={buttonClassName}\n disabled={disabled}\n noBackground={noBackground}\n renderButton={renderButton}\n setActive={setActive}\n size={buttonSize}\n />\n )\n\n return (\n <div className={[baseClass, className].filter(Boolean).join(' ')} id={id}>\n <div className={`${baseClass}__trigger-wrap`} ref={triggerRef}>\n {showOnHover ? (\n <div\n className={`${baseClass}__on-hover-watch`}\n onMouseEnter={() => setActive(true)}\n onMouseLeave={() => setActive(false)}\n role=\"button\"\n tabIndex={0}\n >\n {Trigger}\n </div>\n ) : (\n Trigger\n )}\n </div>\n\n {mounted\n ? // We need to make sure the popup is part of the DOM (although invisible), even if it's not active.\n // This ensures that components within the popup, like modals, do not unmount when the popup closes.\n // Otherwise, modals opened from the popup will close unexpectedly when clicking within the modal, since\n // that closes the popup due to the click outside handler.\n createPortal(\n <PopupContext value={{ popupRef }}>\n <div\n className={\n active\n ? [\n `${baseClass}__content`,\n `${baseClass}--size-${size}`,\n side\n ? `${baseClass}--side-${side}`\n : isOnTop\n ? `${baseClass}--v-top`\n : `${baseClass}--v-bottom`,\n portalClassName,\n ]\n .filter(Boolean)\n .join(' ')\n : // Do not share any class names between active and disabled popups, to make sure\n // tests do not accidentally target inactive popups.\n `${baseClass}__hidden-content`\n }\n data-popup-id={id || undefined}\n data-theme={theme === 'auto' ? undefined : theme}\n ref={popupRef}\n >\n <div\n className={`${baseClass}__scroll-container${showScrollbar ? ` ${baseClass}__scroll-container--show-scrollbar` : ''}`}\n >\n {theme === 'auto' ? (\n <>\n {render?.({ close: () => setActive(false) })}\n {children}\n </>\n ) : (\n <ThemeProvider theme={theme}>\n {render?.({ close: () => setActive(false) })}\n {children}\n </ThemeProvider>\n )}\n </div>\n {caret && !side && <div className={`${baseClass}__caret`} />}\n </div>\n </PopupContext>,\n document.body,\n )\n : null}\n </div>\n )\n}\n"],"mappings":"AAAA;;;AAGA,OAAO,KAAKA,SAAS,MAAM;AAE3B,OAAOC,KAAA,IAASC,aAAa,EAAEC,GAAG,EAAEC,WAAW,EAAEC,SAAS,EAAEC,MAAM,EAAEC,QAAQ,QAAQ;AACpF,SAASC,YAAY,QAAQ;AAE7B,SAASC,cAAc,QAAQ;AAC/B,SAASC,aAAa,QAAQ;AAC9B,OAAO;AACP,SAASC,YAAY,QAAQ;AAE7B,MAAMC,SAAA,GAAY;AAMlB,MAAMC,YAAA,gBAAeX,aAAA,CAAwC;AAE7D;;;AAGA,MAAMY,iBAAA,GAAoB,CACxB,WACA,yBACA,6CACA,yBACA,2BACA,cACA,oDACA,mBACA,mBACA,UACD,CACEC,GAAG,CAAEC,CAAA,IAAM,GAAGA,CAAA,uBAAwB,EACtCC,IAAI,CAAC;AAsFR;;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GAC5BY,OAAA,GACE,GAAGxC,SAAA,SAAkB,GACrB,GAAGA,SAAA,YAAqB,EAC9BuB,eAAA,CACD,CACEmG,MAAM,CAACC,OAAA,EACPtH,IAAI,CAAC;QAER;QACA,GAAGL,SAAA,kBAA2B;QAEpC,iBAAeQ,EAAA,IAAM8G,SAAA;QACrB,cAAYxF,KAAA,KAAU,SAASwF,SAAA,GAAYxF,KAAA;QAC3C8F,GAAA,EAAK5F,QAAA;gCAELwF,IAAA,CAAC;UACCzG,SAAA,EAAW,GAAGf,SAAA,qBAA8B2B,aAAA,GAAgB,IAAI3B,SAAA,oCAA6C,GAAG,IAAI;oBAEnH8B,KAAA,KAAU,sBACT2F,KAAA,CAAAS,SAAA;uBACG1G,MAAA,GAAS;cAAE2G,KAAA,EAAOA,CAAA,KAAMzF,SAAA,CAAU;YAAO,IACzC5B,QAAA;4BAGH2G,KAAA,CAAC3H,aAAA;YAAcgC,KAAA,EAAOA,KAAA;uBACnBN,MAAA,GAAS;cAAE2G,KAAA,EAAOA,CAAA,KAAMzF,SAAA,CAAU;YAAO,IACzC5B,QAAA;;YAIND,KAAA,IAAS,CAACe,IAAA,iBAAQ4F,IAAA,CAAC;UAAIzG,SAAA,EAAW,GAAGf,SAAA;;;QAG1CuG,QAAA,CAAS6B,IAAI,IAEf;;AAGV","ignoreList":[]}
@@ -0,0 +1,13 @@
1
+ import type { Where } from 'payload';
2
+ type Args = {
3
+ collectionSlug?: string;
4
+ globalSlug?: string;
5
+ id?: number | string;
6
+ };
7
+ /**
8
+ * Builds the `where` query used to find upcoming scheduled
9
+ * publish/unpublish jobs for a given document or global.
10
+ */
11
+ export declare const buildUpcomingScheduleWhere: ({ id, collectionSlug, globalSlug }: Args) => Where;
12
+ export {};
13
+ //# sourceMappingURL=buildUpcomingScheduleWhere.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"buildUpcomingScheduleWhere.d.ts","sourceRoot":"","sources":["../../../../src/elements/PublishButton/ScheduleDrawer/buildUpcomingScheduleWhere.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAEpC,KAAK,IAAI,GAAG;IACV,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;CACrB,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,0BAA0B,GAAI,oCAAoC,IAAI,KAAG,KAsCrF,CAAA"}
@@ -0,0 +1,41 @@
1
+ /**
2
+ * Builds the `where` query used to find upcoming scheduled
3
+ * publish/unpublish jobs for a given document or global.
4
+ */export const buildUpcomingScheduleWhere = ({
5
+ id,
6
+ collectionSlug,
7
+ globalSlug
8
+ }) => {
9
+ const where = {
10
+ and: [{
11
+ taskSlug: {
12
+ equals: 'schedulePublish'
13
+ }
14
+ }, {
15
+ waitUntil: {
16
+ greater_than: new Date()
17
+ }
18
+ }]
19
+ };
20
+ if (collectionSlug) {
21
+ where.and.push({
22
+ 'input.doc.value': {
23
+ equals: String(id)
24
+ }
25
+ });
26
+ where.and.push({
27
+ 'input.doc.relationTo': {
28
+ equals: collectionSlug
29
+ }
30
+ });
31
+ }
32
+ if (globalSlug) {
33
+ where.and.push({
34
+ 'input.global': {
35
+ equals: globalSlug
36
+ }
37
+ });
38
+ }
39
+ return where;
40
+ };
41
+ //# sourceMappingURL=buildUpcomingScheduleWhere.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"buildUpcomingScheduleWhere.js","names":["buildUpcomingScheduleWhere","id","collectionSlug","globalSlug","where","and","taskSlug","equals","waitUntil","greater_than","Date","push","String"],"sources":["../../../../src/elements/PublishButton/ScheduleDrawer/buildUpcomingScheduleWhere.ts"],"sourcesContent":["import type { Where } from 'payload'\n\ntype Args = {\n collectionSlug?: string\n globalSlug?: string\n id?: number | string\n}\n\n/**\n * Builds the `where` query used to find upcoming scheduled\n * publish/unpublish jobs for a given document or global.\n */\nexport const buildUpcomingScheduleWhere = ({ id, collectionSlug, globalSlug }: Args): Where => {\n const where: Where = {\n and: [\n {\n taskSlug: {\n equals: 'schedulePublish',\n },\n },\n {\n waitUntil: {\n greater_than: new Date(),\n },\n },\n ],\n }\n\n if (collectionSlug) {\n where.and.push({\n 'input.doc.value': {\n equals: String(id),\n },\n })\n where.and.push({\n 'input.doc.relationTo': {\n equals: collectionSlug,\n },\n })\n }\n\n if (globalSlug) {\n where.and.push({\n 'input.global': {\n equals: globalSlug,\n },\n })\n }\n\n return where\n}\n"],"mappings":"AAQA;;;GAIA,OAAO,MAAMA,0BAAA,GAA6BA,CAAC;EAAEC,EAAE;EAAEC,cAAc;EAAEC;AAAU,CAAQ;EACjF,MAAMC,KAAA,GAAe;IACnBC,GAAA,EAAK,CACH;MACEC,QAAA,EAAU;QACRC,MAAA,EAAQ;MACV;IACF,GACA;MACEC,SAAA,EAAW;QACTC,YAAA,EAAc,IAAIC,IAAA;MACpB;IACF;EAEJ;EAEA,IAAIR,cAAA,EAAgB;IAClBE,KAAA,CAAMC,GAAG,CAACM,IAAI,CAAC;MACb,mBAAmB;QACjBJ,MAAA,EAAQK,MAAA,CAAOX,EAAA;MACjB;IACF;IACAG,KAAA,CAAMC,GAAG,CAACM,IAAI,CAAC;MACb,wBAAwB;QACtBJ,MAAA,EAAQL;MACV;IACF;EACF;EAEA,IAAIC,UAAA,EAAY;IACdC,KAAA,CAAMC,GAAG,CAACM,IAAI,CAAC;MACb,gBAAgB;QACdJ,MAAA,EAAQJ;MACV;IACF;EACF;EAEA,OAAOC,KAAA;AACT","ignoreList":[]}
@@ -4,6 +4,7 @@ import type { PublishType } from './types.js';
4
4
  import './index.css';
5
5
  type Props = {
6
6
  defaultType?: PublishType;
7
+ onUpcomingChange?: (hasUpcoming: boolean) => void;
7
8
  schedulePublishConfig?: SchedulePublish;
8
9
  slug: string;
9
10
  };
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/elements/PublishButton/ScheduleDrawer/index.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAU,eAAe,EAAS,MAAM,SAAS,CAAA;AAQ7D,OAAO,KAA+B,MAAM,OAAO,CAAA;AAGnD,OAAO,KAAK,EAAE,WAAW,EAAiB,MAAM,YAAY,CAAA;AAe5D,OAAO,aAAa,CAAA;AASpB,KAAK,KAAK,GAAG;IACX,WAAW,CAAC,EAAE,WAAW,CAAA;IACzB,qBAAqB,CAAC,EAAE,eAAe,CAAA;IACvC,IAAI,EAAE,MAAM,CAAA;CACb,CAAA;AAOD,eAAO,MAAM,cAAc,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,CAkU1C,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/elements/PublishButton/ScheduleDrawer/index.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAU,eAAe,EAAS,MAAM,SAAS,CAAA;AAQ7D,OAAO,KAA+B,MAAM,OAAO,CAAA;AAGnD,OAAO,KAAK,EAAE,WAAW,EAAiB,MAAM,YAAY,CAAA;AAe5D,OAAO,aAAa,CAAA;AAUpB,KAAK,KAAK,GAAG;IACX,WAAW,CAAC,EAAE,WAAW,CAAA;IACzB,gBAAgB,CAAC,EAAE,CAAC,WAAW,EAAE,OAAO,KAAK,IAAI,CAAA;IACjD,qBAAqB,CAAC,EAAE,eAAe,CAAA;IACvC,IAAI,EAAE,MAAM,CAAA;CACb,CAAA;AAOD,eAAO,MAAM,cAAc,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,CAiT1C,CAAA"}
@@ -28,6 +28,7 @@ import { ShimmerEffect } from '../../ShimmerEffect/index.js';
28
28
  import { Table } from '../../Table/index.js';
29
29
  import { TimezonePicker } from '../../TimezonePicker/index.js';
30
30
  import { buildUpcomingColumns } from './buildUpcomingColumns.js';
31
+ import { buildUpcomingScheduleWhere } from './buildUpcomingScheduleWhere.js';
31
32
  const baseClass = 'schedule-publish';
32
33
  const defaultLocaleOption = {
33
34
  label: 'All',
@@ -36,6 +37,7 @@ const defaultLocaleOption = {
36
37
  export const ScheduleDrawer = ({
37
38
  slug,
38
39
  defaultType,
40
+ onUpcomingChange,
39
41
  schedulePublishConfig
40
42
  }) => {
41
43
  const {
@@ -98,37 +100,12 @@ export const ScheduleDrawer = ({
98
100
  const fetchUpcoming = React.useCallback(async () => {
99
101
  const query = {
100
102
  sort: 'waitUntil',
101
- where: {
102
- and: [{
103
- taskSlug: {
104
- equals: 'schedulePublish'
105
- }
106
- }, {
107
- waitUntil: {
108
- greater_than: new Date()
109
- }
110
- }]
111
- }
103
+ where: buildUpcomingScheduleWhere({
104
+ id,
105
+ collectionSlug,
106
+ globalSlug
107
+ })
112
108
  };
113
- if (collectionSlug) {
114
- query.where.and.push({
115
- 'input.doc.value': {
116
- equals: String(id)
117
- }
118
- });
119
- query.where.and.push({
120
- 'input.doc.relationTo': {
121
- equals: collectionSlug
122
- }
123
- });
124
- }
125
- if (globalSlug) {
126
- query.where.and.push({
127
- 'input.global': {
128
- equals: globalSlug
129
- }
130
- });
131
- }
132
109
  const {
133
110
  docs
134
111
  } = await requests.post(formatAdminURL({
@@ -153,7 +130,8 @@ export const ScheduleDrawer = ({
153
130
  t
154
131
  }));
155
132
  setUpcoming(docs);
156
- }, [collectionSlug, globalSlug, api, i18n, dateFormat, localization, supportedTimezones, t, id]);
133
+ onUpcomingChange?.(docs.length > 0);
134
+ }, [collectionSlug, globalSlug, api, i18n, dateFormat, localization, supportedTimezones, t, id, onUpcomingChange]);
157
135
  const deleteHandler = React.useCallback(async id_0 => {
158
136
  try {
159
137
  await schedulePublish({