@elementor/editor-site-navigation 0.22.4 → 0.22.6

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 (44) hide show
  1. package/CHANGELOG.md +38 -324
  2. package/dist/index.js +147 -156
  3. package/dist/index.mjs +168 -175
  4. package/package.json +49 -49
  5. package/src/api/post.ts +18 -18
  6. package/src/api/recent-posts.ts +1 -1
  7. package/src/api/settings.ts +4 -4
  8. package/src/api/user.ts +4 -4
  9. package/src/components/panel/actions-menu/action-menu-item.tsx +7 -10
  10. package/src/components/panel/actions-menu/actions/__tests__/set-home.test.tsx +12 -9
  11. package/src/components/panel/actions-menu/actions/delete.tsx +27 -25
  12. package/src/components/panel/actions-menu/actions/duplicate.tsx +5 -7
  13. package/src/components/panel/actions-menu/actions/rename.tsx +11 -13
  14. package/src/components/panel/actions-menu/actions/set-home.tsx +6 -8
  15. package/src/components/panel/actions-menu/actions/view.tsx +3 -5
  16. package/src/components/panel/error-snackbar.tsx +4 -3
  17. package/src/components/panel/panel.ts +1 -5
  18. package/src/components/panel/posts-list/__tests__/posts-collapsible-list.test.tsx +66 -19
  19. package/src/components/panel/posts-list/collapsible-list.tsx +38 -29
  20. package/src/components/panel/posts-list/error-state.tsx +35 -27
  21. package/src/components/panel/posts-list/list-items/edit-mode-template.tsx +18 -40
  22. package/src/components/panel/posts-list/list-items/list-item-create.tsx +5 -1
  23. package/src/components/panel/posts-list/list-items/list-item-duplicate.tsx +5 -1
  24. package/src/components/panel/posts-list/list-items/list-item-rename.tsx +3 -5
  25. package/src/components/panel/posts-list/list-items/list-item-view.tsx +20 -19
  26. package/src/components/panel/posts-list/posts-collapsible-list.tsx +22 -24
  27. package/src/components/shared/page-title-and-status.tsx +4 -2
  28. package/src/components/top-bar/__tests__/add-new-page.test.tsx +33 -16
  29. package/src/components/top-bar/__tests__/recently-edited.test.tsx +157 -120
  30. package/src/components/top-bar/chip-doc-type.tsx +1 -3
  31. package/src/components/top-bar/create-post-list-item.tsx +1 -1
  32. package/src/components/top-bar/indicator.tsx +17 -15
  33. package/src/components/top-bar/post-list-item.tsx +2 -6
  34. package/src/components/top-bar/recently-edited.tsx +13 -19
  35. package/src/contexts/post-list-context.tsx +40 -34
  36. package/src/env.ts +2 -2
  37. package/src/hooks/__tests__/use-posts.test.ts +19 -3
  38. package/src/hooks/use-create-page.ts +2 -2
  39. package/src/hooks/use-homepage.ts +1 -1
  40. package/src/hooks/use-posts.ts +1 -1
  41. package/src/hooks/use-toggle-button-props.ts +1 -5
  42. package/src/hooks/use-user.ts +1 -1
  43. package/src/icons-map.ts +1 -1
  44. package/src/types.ts +22 -22
package/dist/index.js CHANGED
@@ -168,14 +168,7 @@ function PostListItem({ post, closePopup, ...props }) {
168
168
  primary: postTitle
169
169
  }
170
170
  ),
171
- /* @__PURE__ */ React3.createElement(
172
- DocTypeChip,
173
- {
174
- postType: post.type.post_type,
175
- docType: post.type.doc_type,
176
- label: post.type.label
177
- }
178
- )
171
+ /* @__PURE__ */ React3.createElement(DocTypeChip, { postType: post.type.post_type, docType: post.type.doc_type, label: post.type.label })
179
172
  );
180
173
  }
181
174
 
@@ -295,26 +288,17 @@ function RecentlyEdited() {
295
288
  const extendedWindow = window;
296
289
  const config = extendedWindow?.elementor?.editorEvents?.config;
297
290
  if (config) {
298
- extendedWindow.elementor.editorEvents.dispatchEvent(
299
- config.names.topBar.documentNameDropdown,
300
- {
301
- location: config.locations.topBar,
302
- secondaryLocation: config.secondaryLocations.documentNameDropdown,
303
- trigger: config.triggers.dropdownClick,
304
- element: config.elements.dropdown
305
- }
306
- );
291
+ extendedWindow.elementor.editorEvents.dispatchEvent(config.names.topBar.documentNameDropdown, {
292
+ location: config.locations.topBar,
293
+ secondaryLocation: config.secondaryLocations.documentNameDropdown,
294
+ trigger: config.triggers.dropdownClick,
295
+ element: config.elements.dropdown
296
+ });
307
297
  }
308
298
  buttonProps.onClick(e);
309
299
  }
310
300
  },
311
- /* @__PURE__ */ React5.createElement(
312
- Indicator,
313
- {
314
- title: documentTitle,
315
- status: document2.status
316
- }
317
- )
301
+ /* @__PURE__ */ React5.createElement(Indicator, { title: documentTitle, status: document2.status })
318
302
  ), /* @__PURE__ */ React5.createElement(
319
303
  import_ui5.Menu,
320
304
  {
@@ -478,13 +462,19 @@ var PostListContextProvider = ({
478
462
  const resetEditMode = () => {
479
463
  setEditMode(defaultValues.editMode);
480
464
  };
481
- return /* @__PURE__ */ React6.createElement(PostListContext.Provider, { value: {
482
- type,
483
- editMode,
484
- setEditMode,
485
- resetEditMode,
486
- setError
487
- } }, children);
465
+ return /* @__PURE__ */ React6.createElement(
466
+ PostListContext.Provider,
467
+ {
468
+ value: {
469
+ type,
470
+ editMode,
471
+ setEditMode,
472
+ resetEditMode,
473
+ setError
474
+ }
475
+ },
476
+ children
477
+ );
488
478
  };
489
479
  function usePostListContext() {
490
480
  const context = (0, import_react3.useContext)(PostListContext);
@@ -517,19 +507,25 @@ function CollapsibleList({
517
507
  children
518
508
  }) {
519
509
  const [isOpen, setIsOpen] = (0, import_react4.useState)(isOpenByDefault);
520
- return /* @__PURE__ */ React7.createElement(React7.Fragment, null, /* @__PURE__ */ React7.createElement(import_ui6.ListItem, null, /* @__PURE__ */ React7.createElement(StyledListItemIcon, { sx: {
521
- color: "text.secondary"
522
- } }, /* @__PURE__ */ React7.createElement(
523
- import_ui6.IconButton,
510
+ return /* @__PURE__ */ React7.createElement(React7.Fragment, null, /* @__PURE__ */ React7.createElement(import_ui6.ListItem, null, /* @__PURE__ */ React7.createElement(
511
+ StyledListItemIcon,
524
512
  {
525
- onClick: () => setIsOpen((prev) => !prev),
526
- size: "small",
527
513
  sx: {
528
- color: "inherit"
514
+ color: "text.secondary"
529
515
  }
530
516
  },
531
- /* @__PURE__ */ React7.createElement(RotateIcon, { fontSize: "small", isOpen })
532
- )), /* @__PURE__ */ React7.createElement(
517
+ /* @__PURE__ */ React7.createElement(
518
+ import_ui6.IconButton,
519
+ {
520
+ onClick: () => setIsOpen((prev) => !prev),
521
+ size: "small",
522
+ sx: {
523
+ color: "inherit"
524
+ }
525
+ },
526
+ /* @__PURE__ */ React7.createElement(RotateIcon, { fontSize: "small", isOpen })
527
+ )
528
+ ), /* @__PURE__ */ React7.createElement(
533
529
  StyledListItemIcon,
534
530
  {
535
531
  size: "small",
@@ -538,15 +534,13 @@ function CollapsibleList({
538
534
  }
539
535
  },
540
536
  /* @__PURE__ */ React7.createElement(Icon, { fontSize: "small" })
541
- ), /* @__PURE__ */ React7.createElement(import_ui6.ListItemText, { primaryTypographyProps: { variant: "subtitle2", component: "span" }, primary: label })), /* @__PURE__ */ React7.createElement(
542
- import_ui6.Collapse,
537
+ ), /* @__PURE__ */ React7.createElement(
538
+ import_ui6.ListItemText,
543
539
  {
544
- in: isOpen,
545
- timeout: "auto",
546
- unmountOnExit: true
547
- },
548
- /* @__PURE__ */ React7.createElement(import_ui6.List, { dense: true }, children)
549
- ), /* @__PURE__ */ React7.createElement(import_ui6.Divider, { sx: { mt: 1 } }));
540
+ primaryTypographyProps: { variant: "subtitle2", component: "span" },
541
+ primary: label
542
+ }
543
+ )), /* @__PURE__ */ React7.createElement(import_ui6.Collapse, { in: isOpen, timeout: "auto", unmountOnExit: true }, /* @__PURE__ */ React7.createElement(import_ui6.List, { dense: true }, children)), /* @__PURE__ */ React7.createElement(import_ui6.Divider, { sx: { mt: 1 } }));
550
544
  }
551
545
 
552
546
  // src/components/panel/posts-list/post-list-item.tsx
@@ -634,41 +628,25 @@ function EditModeTemplate({ postTitle, isLoading, callback }) {
634
628
  }
635
629
  setTitle(value);
636
630
  };
637
- return /* @__PURE__ */ React8.createElement(React8.Fragment, null, /* @__PURE__ */ React8.createElement(
638
- import_ui7.ListItem,
631
+ return /* @__PURE__ */ React8.createElement(React8.Fragment, null, /* @__PURE__ */ React8.createElement(import_ui7.ListItem, { secondaryAction: /* @__PURE__ */ React8.createElement(CloseButton, { isLoading, closeButton }) }, /* @__PURE__ */ React8.createElement(import_ui7.Box, { width: "100%", component: "form", onSubmit: onFormSubmit }, /* @__PURE__ */ React8.createElement(
632
+ import_ui7.TextField,
639
633
  {
640
- secondaryAction: /* @__PURE__ */ React8.createElement(CloseButton, { isLoading, closeButton })
641
- },
642
- /* @__PURE__ */ React8.createElement(import_ui7.Box, { width: "100%", component: "form", onSubmit: onFormSubmit }, /* @__PURE__ */ React8.createElement(
643
- import_ui7.TextField,
644
- {
645
- autoFocus: true,
646
- fullWidth: true,
647
- value: title,
648
- onChange,
649
- disabled: isLoading,
650
- error: !!inputError,
651
- onBlur,
652
- variant: "outlined",
653
- color: "secondary",
654
- size: "small"
655
- }
656
- ))
657
- ), inputError && /* @__PURE__ */ React8.createElement(import_ui7.ListItem, null, /* @__PURE__ */ React8.createElement(import_ui7.ListItemText, { sx: { color: "error.main" } }, inputError)));
634
+ autoFocus: true,
635
+ fullWidth: true,
636
+ value: title,
637
+ onChange,
638
+ disabled: isLoading,
639
+ error: !!inputError,
640
+ onBlur,
641
+ variant: "outlined",
642
+ color: "secondary",
643
+ size: "small"
644
+ }
645
+ ))), inputError && /* @__PURE__ */ React8.createElement(import_ui7.ListItem, null, /* @__PURE__ */ React8.createElement(import_ui7.ListItemText, { sx: { color: "error.main" } }, inputError)));
658
646
  }
659
647
  function CloseButton({ isLoading, closeButton }) {
660
648
  const { resetEditMode } = usePostListContext();
661
- return /* @__PURE__ */ React8.createElement(
662
- import_ui7.IconButton,
663
- {
664
- size: "small",
665
- color: "secondary",
666
- onClick: resetEditMode,
667
- ref: closeButton,
668
- disabled: isLoading
669
- },
670
- isLoading ? /* @__PURE__ */ React8.createElement(import_ui7.CircularProgress, null) : /* @__PURE__ */ React8.createElement(import_icons6.XIcon, { fontSize: "small" })
671
- );
649
+ return /* @__PURE__ */ React8.createElement(import_ui7.IconButton, { size: "small", color: "secondary", onClick: resetEditMode, ref: closeButton, disabled: isLoading }, isLoading ? /* @__PURE__ */ React8.createElement(import_ui7.CircularProgress, null) : /* @__PURE__ */ React8.createElement(import_icons6.XIcon, { fontSize: "small" }));
672
650
  }
673
651
 
674
652
  // src/components/panel/posts-list/list-items/list-item-rename.tsx
@@ -747,7 +725,14 @@ function ListItemCreate() {
747
725
  resetEditMode();
748
726
  }
749
727
  };
750
- return /* @__PURE__ */ React10.createElement(EditModeTemplate, { postTitle: (0, import_i18n5.__)("New Page", "elementor"), isLoading: createPost.isPending, callback: createPostCallback });
728
+ return /* @__PURE__ */ React10.createElement(
729
+ EditModeTemplate,
730
+ {
731
+ postTitle: (0, import_i18n5.__)("New Page", "elementor"),
732
+ isLoading: createPost.isPending,
733
+ callback: createPostCallback
734
+ }
735
+ );
751
736
  }
752
737
 
753
738
  // src/components/panel/posts-list/list-items/list-item-duplicate.tsx
@@ -775,7 +760,14 @@ function ListItemDuplicate() {
775
760
  resetEditMode();
776
761
  }
777
762
  };
778
- return /* @__PURE__ */ React11.createElement(EditModeTemplate, { postTitle: `${editMode.details.title} ${(0, import_i18n6.__)("copy", "elementor")}`, isLoading: duplicatePost.isPending, callback: duplicatePostCallback });
763
+ return /* @__PURE__ */ React11.createElement(
764
+ EditModeTemplate,
765
+ {
766
+ postTitle: `${editMode.details.title} ${(0, import_i18n6.__)("copy", "elementor")}`,
767
+ isLoading: duplicatePost.isPending,
768
+ callback: duplicatePostCallback
769
+ }
770
+ );
779
771
  }
780
772
 
781
773
  // src/components/panel/posts-list/list-items/list-item-view.tsx
@@ -838,9 +830,15 @@ var import_i18n7 = require("@wordpress/i18n");
838
830
  var React13 = __toESM(require("react"));
839
831
  var import_ui9 = require("@elementor/ui");
840
832
  function ActionMenuItem({ title, icon: Icon, MenuItemProps: MenuItemProps3 }) {
841
- return /* @__PURE__ */ React13.createElement(import_ui9.MenuItem, { ...MenuItemProps3 }, /* @__PURE__ */ React13.createElement(import_ui9.ListItemIcon, { sx: {
842
- color: "inherit"
843
- } }, /* @__PURE__ */ React13.createElement(Icon, null)), /* @__PURE__ */ React13.createElement(import_ui9.ListItemText, { primary: title }));
833
+ return /* @__PURE__ */ React13.createElement(import_ui9.MenuItem, { ...MenuItemProps3 }, /* @__PURE__ */ React13.createElement(
834
+ import_ui9.ListItemIcon,
835
+ {
836
+ sx: {
837
+ color: "inherit"
838
+ }
839
+ },
840
+ /* @__PURE__ */ React13.createElement(Icon, null)
841
+ ), /* @__PURE__ */ React13.createElement(import_ui9.ListItemText, { primary: title }));
844
842
  }
845
843
 
846
844
  // src/components/panel/actions-menu/actions/rename.tsx
@@ -923,7 +921,10 @@ function Delete({ post }) {
923
921
  }
924
922
  ), isDialogOpen && /* @__PURE__ */ React16.createElement(DeleteDialog, { post, setIsDialogOpen }));
925
923
  }
926
- function DeleteDialog({ post, setIsDialogOpen }) {
924
+ function DeleteDialog({
925
+ post,
926
+ setIsDialogOpen
927
+ }) {
927
928
  const { type } = usePostListContext();
928
929
  const { deletePost } = usePostActions(type);
929
930
  const { setError } = usePostListContext();
@@ -942,18 +943,19 @@ function DeleteDialog({ post, setIsDialogOpen }) {
942
943
  }
943
944
  setIsDialogOpen(false);
944
945
  };
945
- return /* @__PURE__ */ React16.createElement(
946
- import_ui10.Dialog,
946
+ return /* @__PURE__ */ React16.createElement(import_ui10.Dialog, { open: true, onClose: handleCancel, "aria-labelledby": "delete-dialog" }, /* @__PURE__ */ React16.createElement(import_ui10.DialogTitle, { noWrap: true }, dialogTitle), /* @__PURE__ */ React16.createElement(import_ui10.Divider, null), /* @__PURE__ */ React16.createElement(import_ui10.DialogContent, null, /* @__PURE__ */ React16.createElement(import_ui10.DialogContentText, null, (0, import_i18n9.__)(
947
+ "The page and its content will be deleted forever and we won\u2019t be able to recover them.",
948
+ "elementor"
949
+ ))), /* @__PURE__ */ React16.createElement(import_ui10.DialogActions, null, /* @__PURE__ */ React16.createElement(
950
+ import_ui10.Button,
947
951
  {
948
- open: true,
949
- onClose: handleCancel,
950
- "aria-labelledby": "delete-dialog"
952
+ variant: "contained",
953
+ color: "secondary",
954
+ onClick: handleCancel,
955
+ disabled: deletePost.isPending
951
956
  },
952
- /* @__PURE__ */ React16.createElement(import_ui10.DialogTitle, { noWrap: true }, dialogTitle),
953
- /* @__PURE__ */ React16.createElement(import_ui10.Divider, null),
954
- /* @__PURE__ */ React16.createElement(import_ui10.DialogContent, null, /* @__PURE__ */ React16.createElement(import_ui10.DialogContentText, null, (0, import_i18n9.__)("The page and its content will be deleted forever and we won\u2019t be able to recover them.", "elementor"))),
955
- /* @__PURE__ */ React16.createElement(import_ui10.DialogActions, null, /* @__PURE__ */ React16.createElement(import_ui10.Button, { variant: "contained", color: "secondary", onClick: handleCancel, disabled: deletePost.isPending }, (0, import_i18n9.__)("Cancel", "elementor")), /* @__PURE__ */ React16.createElement(import_ui10.Button, { variant: "contained", color: "error", onClick: deletePage, disabled: deletePost.isPending }, !deletePost.isPending ? (0, import_i18n9.__)("Delete", "elementor") : /* @__PURE__ */ React16.createElement(import_ui10.CircularProgress, null)))
956
- );
957
+ (0, import_i18n9.__)("Cancel", "elementor")
958
+ ), /* @__PURE__ */ React16.createElement(import_ui10.Button, { variant: "contained", color: "error", onClick: deletePage, disabled: deletePost.isPending }, !deletePost.isPending ? (0, import_i18n9.__)("Delete", "elementor") : /* @__PURE__ */ React16.createElement(import_ui10.CircularProgress, null))));
957
959
  }
958
960
 
959
961
  // src/components/panel/actions-menu/actions/view.tsx
@@ -1063,15 +1065,7 @@ var import_i18n12 = require("@wordpress/i18n");
1063
1065
  var DisabledPostTooltip = ({ children, isDisabled }) => {
1064
1066
  if (isDisabled) {
1065
1067
  const title = /* @__PURE__ */ React19.createElement(import_ui12.Typography, { variant: "caption" }, "You cannot edit this page.", /* @__PURE__ */ React19.createElement("br", null), "To edit it directly, contact the site owner");
1066
- return /* @__PURE__ */ React19.createElement(
1067
- import_ui12.Tooltip,
1068
- {
1069
- title,
1070
- placement: "bottom",
1071
- arrow: false
1072
- },
1073
- children
1074
- );
1068
+ return /* @__PURE__ */ React19.createElement(import_ui12.Tooltip, { title, placement: "bottom", arrow: false }, children);
1075
1069
  }
1076
1070
  return /* @__PURE__ */ React19.createElement(React19.Fragment, null, children);
1077
1071
  };
@@ -1091,15 +1085,7 @@ function ListItemView({ post }) {
1091
1085
  import_ui12.ListItem,
1092
1086
  {
1093
1087
  disablePadding: true,
1094
- secondaryAction: /* @__PURE__ */ React19.createElement(
1095
- import_ui12.IconButton,
1096
- {
1097
- value: true,
1098
- size: "small",
1099
- ...(0, import_ui12.bindTrigger)(popupState)
1100
- },
1101
- /* @__PURE__ */ React19.createElement(import_icons12.DotsVerticalIcon, { fontSize: "small" })
1102
- )
1088
+ secondaryAction: /* @__PURE__ */ React19.createElement(import_ui12.IconButton, { value: true, size: "small", ...(0, import_ui12.bindTrigger)(popupState) }, /* @__PURE__ */ React19.createElement(import_icons12.DotsVerticalIcon, { fontSize: "small" }))
1103
1089
  },
1104
1090
  /* @__PURE__ */ React19.createElement(
1105
1091
  import_ui12.ListItemButton,
@@ -1181,40 +1167,53 @@ var import_ui14 = require("@elementor/ui");
1181
1167
  var import_i18n14 = require("@wordpress/i18n");
1182
1168
  var React22 = __toESM(require("react"));
1183
1169
  function ErrorState() {
1184
- return /* @__PURE__ */ React22.createElement(import_ui14.Box, { sx: {
1185
- display: "flex",
1186
- flexDirection: "column",
1187
- justifyContent: "center",
1188
- alignItems: "center",
1189
- pt: "40px",
1190
- gap: "16px"
1191
- } }, /* @__PURE__ */ React22.createElement(import_icons14.Error404TemplateIcon, null), /* @__PURE__ */ React22.createElement(import_ui14.Box, { sx: {
1192
- display: "flex",
1193
- flexDirection: "column",
1194
- justifyContent: "center",
1195
- alignItems: "center",
1196
- gap: "8px"
1197
- } }, /* @__PURE__ */ React22.createElement(import_ui14.Typography, { variant: "body1", color: "text.primary" }, (0, import_i18n14.__)("We couldn\u2019t display your pages.", "elementor")), /* @__PURE__ */ React22.createElement(import_ui14.Box, null, /* @__PURE__ */ React22.createElement(import_ui14.Typography, { variant: "body2", color: "text.primary", sx: { textAlign: "center" } }, (0, import_i18n14.__)("It\u2019s probably a temporary issue.", "elementor")), /* @__PURE__ */ React22.createElement(import_ui14.Typography, { variant: "body2", color: "text.primary", sx: { textAlign: "center" } }, (0, import_i18n14.__)("If the problem persists,", "elementor"), " ", /* @__PURE__ */ React22.createElement(import_ui14.Link, { target: "_blank", href: "https://go.elementor.com/wp-editor-support-open-ticket/" }, "Notify support")))));
1170
+ return /* @__PURE__ */ React22.createElement(
1171
+ import_ui14.Box,
1172
+ {
1173
+ sx: {
1174
+ display: "flex",
1175
+ flexDirection: "column",
1176
+ justifyContent: "center",
1177
+ alignItems: "center",
1178
+ pt: "40px",
1179
+ gap: "16px"
1180
+ }
1181
+ },
1182
+ /* @__PURE__ */ React22.createElement(import_icons14.Error404TemplateIcon, null),
1183
+ /* @__PURE__ */ React22.createElement(
1184
+ import_ui14.Box,
1185
+ {
1186
+ sx: {
1187
+ display: "flex",
1188
+ flexDirection: "column",
1189
+ justifyContent: "center",
1190
+ alignItems: "center",
1191
+ gap: "8px"
1192
+ }
1193
+ },
1194
+ /* @__PURE__ */ React22.createElement(import_ui14.Typography, { variant: "body1", color: "text.primary" }, (0, import_i18n14.__)("We couldn\u2019t display your pages.", "elementor")),
1195
+ /* @__PURE__ */ React22.createElement(import_ui14.Box, null, /* @__PURE__ */ React22.createElement(import_ui14.Typography, { variant: "body2", color: "text.primary", sx: { textAlign: "center" } }, (0, import_i18n14.__)("It\u2019s probably a temporary issue.", "elementor")), /* @__PURE__ */ React22.createElement(import_ui14.Typography, { variant: "body2", color: "text.primary", sx: { textAlign: "center" } }, (0, import_i18n14.__)("If the problem persists,", "elementor"), " ", /* @__PURE__ */ React22.createElement(import_ui14.Link, { target: "_blank", href: "https://go.elementor.com/wp-editor-support-open-ticket/" }, "Notify support")))
1196
+ )
1197
+ );
1198
1198
  }
1199
1199
 
1200
1200
  // src/components/panel/posts-list/posts-collapsible-list.tsx
1201
1201
  function PostsCollapsibleList({ isOpenByDefault = false }) {
1202
1202
  const { type, editMode } = usePostListContext();
1203
- const { data: { posts, total }, isLoading: postsLoading, isError: postsError, fetchNextPage, hasNextPage, isFetchingNextPage } = usePosts(type);
1203
+ const {
1204
+ data: { posts, total },
1205
+ isLoading: postsLoading,
1206
+ isError: postsError,
1207
+ fetchNextPage,
1208
+ hasNextPage,
1209
+ isFetchingNextPage
1210
+ } = usePosts(type);
1204
1211
  const { data: homepageId } = useHomepage();
1205
1212
  if (postsError) {
1206
1213
  return /* @__PURE__ */ React23.createElement(ErrorState, null);
1207
1214
  }
1208
1215
  if (!posts || postsLoading) {
1209
- return /* @__PURE__ */ React23.createElement(import_ui15.Box, { sx: { px: 5 } }, /* @__PURE__ */ React23.createElement(
1210
- import_ui15.Box,
1211
- {
1212
- display: "flex",
1213
- justifyContent: "flex-end",
1214
- alignItems: "center"
1215
- },
1216
- /* @__PURE__ */ React23.createElement(import_ui15.Skeleton, { sx: { my: 4 }, animation: "wave", variant: "rounded", width: "110px", height: "28px" })
1217
- ), /* @__PURE__ */ React23.createElement(import_ui15.Box, null, /* @__PURE__ */ React23.createElement(import_ui15.Skeleton, { sx: { my: 3 }, animation: "wave", variant: "rounded", width: "100%", height: "24px" }), /* @__PURE__ */ React23.createElement(import_ui15.Skeleton, { sx: { my: 3 }, animation: "wave", variant: "rounded", width: "70%", height: "24px" }), /* @__PURE__ */ React23.createElement(import_ui15.Skeleton, { sx: { my: 3 }, animation: "wave", variant: "rounded", width: "70%", height: "24px" }), /* @__PURE__ */ React23.createElement(import_ui15.Skeleton, { sx: { my: 3 }, animation: "wave", variant: "rounded", width: "70%", height: "24px" })));
1216
+ return /* @__PURE__ */ React23.createElement(import_ui15.Box, { sx: { px: 5 } }, /* @__PURE__ */ React23.createElement(import_ui15.Box, { display: "flex", justifyContent: "flex-end", alignItems: "center" }, /* @__PURE__ */ React23.createElement(import_ui15.Skeleton, { sx: { my: 4 }, animation: "wave", variant: "rounded", width: "110px", height: "28px" })), /* @__PURE__ */ React23.createElement(import_ui15.Box, null, /* @__PURE__ */ React23.createElement(import_ui15.Skeleton, { sx: { my: 3 }, animation: "wave", variant: "rounded", width: "100%", height: "24px" }), /* @__PURE__ */ React23.createElement(import_ui15.Skeleton, { sx: { my: 3 }, animation: "wave", variant: "rounded", width: "70%", height: "24px" }), /* @__PURE__ */ React23.createElement(import_ui15.Skeleton, { sx: { my: 3 }, animation: "wave", variant: "rounded", width: "70%", height: "24px" }), /* @__PURE__ */ React23.createElement(import_ui15.Skeleton, { sx: { my: 3 }, animation: "wave", variant: "rounded", width: "70%", height: "24px" })));
1218
1217
  }
1219
1218
  const label = `${postTypesMap[type].labels.plural_name} (${total.toString()})`;
1220
1219
  const mappedPosts = posts.map((post) => {
@@ -1244,22 +1243,18 @@ function PostsCollapsibleList({ isOpenByDefault = false }) {
1244
1243
  }
1245
1244
  },
1246
1245
  /* @__PURE__ */ React23.createElement(AddNewButton, null)
1247
- ), /* @__PURE__ */ React23.createElement(import_ui15.List, { dense: true }, /* @__PURE__ */ React23.createElement(
1248
- CollapsibleList,
1246
+ ), /* @__PURE__ */ React23.createElement(import_ui15.List, { dense: true }, /* @__PURE__ */ React23.createElement(CollapsibleList, { label, Icon: import_icons15.PageTypeIcon, isOpenByDefault: isOpenByDefault || false }, sortedPosts.map((post) => {
1247
+ return /* @__PURE__ */ React23.createElement(PostListItem2, { key: post.id, post });
1248
+ }), ["duplicate", "create"].includes(editMode.mode) && /* @__PURE__ */ React23.createElement(PostListItem2, null), hasNextPage && /* @__PURE__ */ React23.createElement(
1249
+ import_ui15.Box,
1249
1250
  {
1250
- label,
1251
- Icon: import_icons15.PageTypeIcon,
1252
- isOpenByDefault: isOpenByDefault || false
1251
+ sx: {
1252
+ display: "flex",
1253
+ justifyContent: "center"
1254
+ }
1253
1255
  },
1254
- sortedPosts.map((post) => {
1255
- return /* @__PURE__ */ React23.createElement(PostListItem2, { key: post.id, post });
1256
- }),
1257
- ["duplicate", "create"].includes(editMode.mode) && /* @__PURE__ */ React23.createElement(PostListItem2, null),
1258
- hasNextPage && /* @__PURE__ */ React23.createElement(import_ui15.Box, { sx: {
1259
- display: "flex",
1260
- justifyContent: "center"
1261
- } }, /* @__PURE__ */ React23.createElement(import_ui15.Button, { onClick: fetchNextPage, color: "secondary" }, isFetchingNextPage ? /* @__PURE__ */ React23.createElement(import_ui15.CircularProgress, null) : "Load More"))
1262
- )));
1256
+ /* @__PURE__ */ React23.createElement(import_ui15.Button, { onClick: fetchNextPage, color: "secondary" }, isFetchingNextPage ? /* @__PURE__ */ React23.createElement(import_ui15.CircularProgress, null) : "Load More")
1257
+ ))));
1263
1258
  }
1264
1259
 
1265
1260
  // src/components/panel/error-snackbar.tsx
@@ -1298,11 +1293,7 @@ var Shell = () => {
1298
1293
  var shell_default = Shell;
1299
1294
 
1300
1295
  // src/components/panel/panel.ts
1301
- var {
1302
- panel,
1303
- usePanelStatus,
1304
- usePanelActions
1305
- } = (0, import_editor_panels2.__createPanel)({
1296
+ var { panel, usePanelStatus, usePanelActions } = (0, import_editor_panels2.__createPanel)({
1306
1297
  id: "site-navigation-panel",
1307
1298
  component: shell_default
1308
1299
  });