@elementor/editor-site-navigation 0.15.0 → 0.17.0

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.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,28 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # [0.17.0](https://github.com/elementor/elementor-packages/compare/@elementor/editor-site-navigation@0.16.0...@elementor/editor-site-navigation@0.17.0) (2023-07-30)
7
+
8
+
9
+ ### Features
10
+
11
+ * **site-navigation:** add set as homepage action to pages panel [ED-10865] ([#97](https://github.com/elementor/elementor-packages/issues/97)) ([e947107](https://github.com/elementor/elementor-packages/commit/e947107f29ae43cc1569820a1f6acd6d60fda38e))
12
+
13
+
14
+
15
+
16
+
17
+ # [0.16.0](https://github.com/elementor/elementor-packages/compare/@elementor/editor-site-navigation@0.15.0...@elementor/editor-site-navigation@0.16.0) (2023-07-30)
18
+
19
+
20
+ ### Features
21
+
22
+ * **site-navigation:** add delete action to pages panel [ED-10868] ([#94](https://github.com/elementor/elementor-packages/issues/94)) ([96447ff](https://github.com/elementor/elementor-packages/commit/96447ff3dede4681b10d904ee1ad9e82ef677392))
23
+
24
+
25
+
26
+
27
+
6
28
  # [0.15.0](https://github.com/elementor/elementor-packages/compare/@elementor/editor-site-navigation@0.14.0...@elementor/editor-site-navigation@0.15.0) (2023-07-30)
7
29
 
8
30
 
package/dist/index.js CHANGED
@@ -250,22 +250,22 @@ function RecentlyEdited() {
250
250
  var import_editor_app_bar = require("@elementor/editor-app-bar");
251
251
 
252
252
  // src/hooks/use-toggle-button-props.ts
253
- var import_i18n14 = require("@wordpress/i18n");
253
+ var import_i18n15 = require("@wordpress/i18n");
254
254
  var import_icons15 = require("@elementor/icons");
255
255
 
256
256
  // src/components/panel/panel.ts
257
257
  var import_editor_panels2 = require("@elementor/editor-panels");
258
258
 
259
259
  // src/components/panel/shell.tsx
260
- var React24 = __toESM(require("react"));
261
- var import_ui14 = require("@elementor/ui");
260
+ var React23 = __toESM(require("react"));
261
+ var import_ui15 = require("@elementor/ui");
262
262
  var import_editor_panels = require("@elementor/editor-panels");
263
- var import_i18n13 = require("@wordpress/i18n");
263
+ var import_i18n14 = require("@wordpress/i18n");
264
264
 
265
265
  // src/components/panel/posts-list/posts-collapsible-list.tsx
266
- var React22 = __toESM(require("react"));
266
+ var React21 = __toESM(require("react"));
267
267
  var import_icons13 = require("@elementor/icons");
268
- var import_ui12 = require("@elementor/ui");
268
+ var import_ui13 = require("@elementor/ui");
269
269
 
270
270
  // src/hooks/use-posts.ts
271
271
  var import_query = require("@elementor/query");
@@ -412,7 +412,7 @@ function CollapsibleList({
412
412
  }
413
413
 
414
414
  // src/components/panel/posts-list/post-list-item.tsx
415
- var React21 = __toESM(require("react"));
415
+ var React20 = __toESM(require("react"));
416
416
 
417
417
  // src/components/panel/posts-list/list-items/list-item-rename.tsx
418
418
  var React9 = __toESM(require("react"));
@@ -586,8 +586,8 @@ function ListItemDuplicate() {
586
586
  }
587
587
 
588
588
  // src/components/panel/posts-list/list-items/list-item-view.tsx
589
- var React20 = __toESM(require("react"));
590
- var import_ui11 = require("@elementor/ui");
589
+ var React19 = __toESM(require("react"));
590
+ var import_ui12 = require("@elementor/ui");
591
591
  var import_icons12 = require("@elementor/icons");
592
592
  var import_editor_documents5 = require("@elementor/editor-documents");
593
593
 
@@ -635,160 +635,247 @@ function PageTitleAndStatus({ page }) {
635
635
  }
636
636
 
637
637
  // src/components/panel/actions-menu/actions/rename.tsx
638
- var React15 = __toESM(require("react"));
638
+ var React14 = __toESM(require("react"));
639
639
  var import_icons7 = require("@elementor/icons");
640
640
  var import_i18n7 = require("@wordpress/i18n");
641
641
 
642
642
  // src/components/panel/actions-menu/action-menu-item.tsx
643
- var React14 = __toESM(require("react"));
644
-
645
- // src/components/panel/actions-menu/action-list-item.tsx
646
643
  var React13 = __toESM(require("react"));
647
644
  var import_ui9 = require("@elementor/ui");
648
- function ActionListItem({ title, icon: Icon, disabled, onClick }) {
649
- return /* @__PURE__ */ React13.createElement(
645
+ function ActionMenuItem({ title, icon: Icon, ListItemButtonProps }) {
646
+ return /* @__PURE__ */ React13.createElement(import_ui9.MenuItem, { disableGutters: true }, /* @__PURE__ */ React13.createElement(
650
647
  import_ui9.ListItemButton,
651
648
  {
652
- disabled,
653
- onClick
649
+ ...ListItemButtonProps
654
650
  },
655
651
  /* @__PURE__ */ React13.createElement(import_ui9.ListItemIcon, null, /* @__PURE__ */ React13.createElement(Icon, null)),
656
652
  /* @__PURE__ */ React13.createElement(import_ui9.ListItemText, null, title)
657
- );
658
- }
659
-
660
- // src/components/panel/actions-menu/action-menu-item.tsx
661
- var import_ui10 = require("@elementor/ui");
662
- function ActionMenuItem(props) {
663
- return /* @__PURE__ */ React14.createElement(import_ui10.MenuItem, { disableGutters: true }, /* @__PURE__ */ React14.createElement(ActionListItem, { ...props }));
653
+ ));
664
654
  }
665
655
 
666
656
  // src/components/panel/actions-menu/actions/rename.tsx
667
657
  function Rename({ post }) {
668
658
  const { setEditMode } = usePostListContext();
669
- return /* @__PURE__ */ React15.createElement(
659
+ return /* @__PURE__ */ React14.createElement(
670
660
  ActionMenuItem,
671
661
  {
672
662
  title: (0, import_i18n7.__)("Rename", "elementor"),
673
663
  icon: import_icons7.EraseIcon,
674
- onClick: () => {
675
- setEditMode({
676
- mode: "rename",
677
- details: {
678
- postId: post.id
679
- }
680
- });
664
+ ListItemButtonProps: {
665
+ onClick: () => {
666
+ setEditMode({
667
+ mode: "rename",
668
+ details: {
669
+ postId: post.id
670
+ }
671
+ });
672
+ }
681
673
  }
682
674
  }
683
675
  );
684
676
  }
685
677
 
686
678
  // src/components/panel/actions-menu/actions/duplicate.tsx
687
- var React16 = __toESM(require("react"));
679
+ var React15 = __toESM(require("react"));
688
680
  var import_icons8 = require("@elementor/icons");
689
681
  var import_i18n8 = require("@wordpress/i18n");
690
682
  function Duplicate({ post, popupState }) {
691
683
  const { setEditMode } = usePostListContext();
692
- return /* @__PURE__ */ React16.createElement(
684
+ const onClick = () => {
685
+ popupState.close();
686
+ setEditMode({
687
+ mode: "duplicate",
688
+ details: {
689
+ postId: post.id,
690
+ title: post.title.rendered
691
+ }
692
+ });
693
+ };
694
+ return /* @__PURE__ */ React15.createElement(
693
695
  ActionMenuItem,
694
696
  {
695
697
  title: (0, import_i18n8.__)("Duplicate", "elementor"),
696
698
  icon: import_icons8.CopyIcon,
697
- onClick: () => {
698
- popupState.close();
699
- setEditMode({
700
- mode: "duplicate",
701
- details: {
702
- postId: post.id,
703
- title: post.title.rendered
704
- }
705
- });
699
+ ListItemButtonProps: {
700
+ onClick
706
701
  }
707
702
  }
708
703
  );
709
704
  }
710
705
 
711
706
  // src/components/panel/actions-menu/actions/delete.tsx
712
- var React17 = __toESM(require("react"));
707
+ var React16 = __toESM(require("react"));
713
708
  var import_icons9 = require("@elementor/icons");
714
- var import_editor_documents4 = require("@elementor/editor-documents");
715
709
  var import_i18n9 = require("@wordpress/i18n");
710
+ var import_ui10 = require("@elementor/ui");
711
+ var import_react7 = require("react");
712
+ var import_editor_documents4 = require("@elementor/editor-documents");
716
713
  function Delete({ post }) {
714
+ const [isDialogOpen, setIsDialogOpen] = (0, import_react7.useState)(false);
717
715
  const activeDocument = (0, import_editor_documents4.useActiveDocument)();
718
- const isActive = activeDocument?.id === post.id;
719
- return /* @__PURE__ */ React17.createElement(
716
+ const isPostActive = activeDocument?.id === post.id;
717
+ return /* @__PURE__ */ React16.createElement(React16.Fragment, null, /* @__PURE__ */ React16.createElement(
720
718
  ActionMenuItem,
721
719
  {
722
720
  title: (0, import_i18n9.__)("Delete", "elementor"),
723
721
  icon: import_icons9.TrashIcon,
724
- disabled: post.isHome || isActive,
725
- onClick: () => null
722
+ ListItemButtonProps: {
723
+ disabled: post.isHome || isPostActive,
724
+ onClick: () => setIsDialogOpen(true),
725
+ sx: { "&:hover": { color: "error.main" } }
726
+ }
726
727
  }
728
+ ), isDialogOpen && /* @__PURE__ */ React16.createElement(DeleteDialog, { post, setIsDialogOpen }));
729
+ }
730
+ function DeleteDialog({ post, setIsDialogOpen }) {
731
+ const { type } = usePostListContext();
732
+ const { deletePost } = usePostActions(type);
733
+ const dialogTitle = (0, import_i18n9.sprintf)((0, import_i18n9.__)("Delete \u201C%s\u201D?", "elementor"), post.title.rendered);
734
+ const deletePage = async () => {
735
+ await deletePost.mutateAsync(post.id);
736
+ };
737
+ const handleCancel = () => {
738
+ if (deletePost.isLoading) {
739
+ return;
740
+ }
741
+ setIsDialogOpen(false);
742
+ };
743
+ return /* @__PURE__ */ React16.createElement(
744
+ import_ui10.Dialog,
745
+ {
746
+ open: true,
747
+ onClose: handleCancel,
748
+ "aria-labelledby": "delete-dialog"
749
+ },
750
+ /* @__PURE__ */ React16.createElement(import_ui10.DialogTitle, null, dialogTitle),
751
+ /* @__PURE__ */ React16.createElement(import_ui10.Divider, null),
752
+ /* @__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"))),
753
+ /* @__PURE__ */ React16.createElement(import_ui10.DialogActions, null, /* @__PURE__ */ React16.createElement(import_ui10.Button, { variant: "contained", color: "secondary", onClick: handleCancel, disabled: deletePost.isLoading }, (0, import_i18n9.__)("Cancel", "elementor")), /* @__PURE__ */ React16.createElement(import_ui10.Button, { variant: "contained", color: "error", onClick: deletePage, disabled: deletePost.isLoading }, !deletePost.isLoading ? (0, import_i18n9.__)("Delete", "elementor") : /* @__PURE__ */ React16.createElement(import_ui10.CircularProgress, null)))
727
754
  );
728
755
  }
729
756
 
730
757
  // src/components/panel/actions-menu/actions/view.tsx
731
- var React18 = __toESM(require("react"));
758
+ var React17 = __toESM(require("react"));
732
759
  var import_icons10 = require("@elementor/icons");
733
760
  var import_i18n10 = require("@wordpress/i18n");
734
761
  function View({ post }) {
735
762
  const { type } = usePostListContext();
736
763
  const title = (0, import_i18n10.__)("View %s", "elementor").replace("%s", postTypesMap[type].labels.singular_name);
737
- return /* @__PURE__ */ React18.createElement(
764
+ return /* @__PURE__ */ React17.createElement(
738
765
  ActionMenuItem,
739
766
  {
740
767
  title,
741
768
  icon: import_icons10.EyeIcon,
742
- onClick: () => {
743
- window.open(post.link, "_blank");
769
+ ListItemButtonProps: {
770
+ onClick: () => window.open(post.link, "_blank")
744
771
  }
745
772
  }
746
773
  );
747
774
  }
748
775
 
749
776
  // src/components/panel/actions-menu/actions/set-home.tsx
750
- var React19 = __toESM(require("react"));
777
+ var React18 = __toESM(require("react"));
751
778
  var import_icons11 = require("@elementor/icons");
752
779
  var import_i18n11 = require("@wordpress/i18n");
780
+
781
+ // src/hooks/use-homepage-actions.ts
782
+ var import_query4 = require("@elementor/query");
783
+
784
+ // src/api/settings.ts
785
+ var import_api_fetch4 = __toESM(require("@wordpress/api-fetch"));
786
+ var getSettings = () => {
787
+ const baseUri = "/wp/v2/settings";
788
+ const keys = ["show_on_front", "page_on_front"];
789
+ const queryParams = new URLSearchParams({
790
+ _fields: keys.join(",")
791
+ });
792
+ const uri = baseUri + "?" + queryParams.toString();
793
+ return (0, import_api_fetch4.default)({ path: uri });
794
+ };
795
+ var updateSettings = (settings) => {
796
+ return (0, import_api_fetch4.default)({
797
+ path: "/wp/v2/settings",
798
+ method: "POST",
799
+ data: settings
800
+ });
801
+ };
802
+
803
+ // src/hooks/use-homepage.ts
804
+ var import_query3 = require("@elementor/query");
805
+ var settingsQueryKey = () => ["site-navigation", "homepage"];
806
+ function useHomepage() {
807
+ return (0, import_query3.useQuery)({
808
+ queryKey: settingsQueryKey(),
809
+ queryFn: () => getSettings()
810
+ });
811
+ }
812
+
813
+ // src/hooks/use-homepage-actions.ts
814
+ function useHomepageActions() {
815
+ const invalidateSettings = useInvalidateSettings();
816
+ const onSuccess = async () => invalidateSettings({ exact: true });
817
+ const updateSettingsMutation = (0, import_query4.useMutation)(
818
+ (settings) => updateSettings(settings),
819
+ { onSuccess }
820
+ );
821
+ return { updateSettingsMutation };
822
+ }
823
+ function useInvalidateSettings() {
824
+ const queryClient = (0, import_query4.useQueryClient)();
825
+ return (options = {}) => {
826
+ const queryKey = settingsQueryKey();
827
+ return queryClient.invalidateQueries(queryKey, options);
828
+ };
829
+ }
830
+
831
+ // src/components/panel/actions-menu/actions/set-home.tsx
832
+ var import_ui11 = require("@elementor/ui");
753
833
  function SetHome({ post }) {
754
- return /* @__PURE__ */ React19.createElement(
834
+ const { updateSettingsMutation } = useHomepageActions();
835
+ const handleClick = () => {
836
+ updateSettingsMutation.mutateAsync({ show_on_front: "page", page_on_front: post.id });
837
+ };
838
+ return /* @__PURE__ */ React18.createElement(
755
839
  ActionMenuItem,
756
840
  {
757
841
  title: (0, import_i18n11.__)("Set as homepage", "elementor"),
758
- icon: import_icons11.HomeIcon,
759
- disabled: !!post.isHome,
760
- onClick: () => null
842
+ icon: !updateSettingsMutation.isLoading ? import_icons11.HomeIcon : import_ui11.CircularProgress,
843
+ ListItemButtonProps: {
844
+ disabled: !!post.isHome || post.status !== "publish" || updateSettingsMutation.isLoading,
845
+ onClick: handleClick
846
+ }
761
847
  }
762
848
  );
763
849
  }
764
850
 
765
851
  // src/components/panel/posts-list/list-items/list-item-view.tsx
852
+ var import_i18n12 = require("@wordpress/i18n");
766
853
  function ListItemView({ post }) {
767
854
  const activeDocument = (0, import_editor_documents5.useActiveDocument)();
768
855
  const navigateToDocument = (0, import_editor_documents5.useNavigateToDocument)();
769
- const popupState = (0, import_ui11.usePopupState)({
856
+ const popupState = (0, import_ui12.usePopupState)({
770
857
  variant: "popover",
771
858
  popupId: "post-actions",
772
859
  disableAutoFocus: true
773
860
  });
774
861
  const isActive = activeDocument?.id === post.id;
775
- return /* @__PURE__ */ React20.createElement(React20.Fragment, null, /* @__PURE__ */ React20.createElement(
776
- import_ui11.ListItem,
862
+ return /* @__PURE__ */ React19.createElement(React19.Fragment, null, /* @__PURE__ */ React19.createElement(
863
+ import_ui12.ListItem,
777
864
  {
778
865
  disablePadding: true,
779
- secondaryAction: /* @__PURE__ */ React20.createElement(
780
- import_ui11.ToggleButton,
866
+ secondaryAction: /* @__PURE__ */ React19.createElement(
867
+ import_ui12.ToggleButton,
781
868
  {
782
869
  value: true,
783
870
  size: "small",
784
871
  selected: popupState.isOpen,
785
- ...(0, import_ui11.bindTrigger)(popupState)
872
+ ...(0, import_ui12.bindTrigger)(popupState)
786
873
  },
787
- /* @__PURE__ */ React20.createElement(import_icons12.DotsVerticalIcon, { fontSize: "small" })
874
+ /* @__PURE__ */ React19.createElement(import_icons12.DotsVerticalIcon, { fontSize: "small" })
788
875
  )
789
876
  },
790
- /* @__PURE__ */ React20.createElement(
791
- import_ui11.ListItemButton,
877
+ /* @__PURE__ */ React19.createElement(
878
+ import_ui12.ListItemButton,
792
879
  {
793
880
  selected: isActive,
794
881
  onClick: () => {
@@ -798,29 +885,29 @@ function ListItemView({ post }) {
798
885
  },
799
886
  dense: true
800
887
  },
801
- /* @__PURE__ */ React20.createElement(import_ui11.ListItemIcon, null),
802
- /* @__PURE__ */ React20.createElement(
803
- import_ui11.ListItemText,
888
+ /* @__PURE__ */ React19.createElement(import_ui12.ListItemIcon, null),
889
+ /* @__PURE__ */ React19.createElement(
890
+ import_ui12.ListItemText,
804
891
  {
805
892
  disableTypography: true
806
893
  },
807
- /* @__PURE__ */ React20.createElement(PageTitleAndStatus, { page: post })
894
+ /* @__PURE__ */ React19.createElement(PageTitleAndStatus, { page: post })
808
895
  ),
809
- post.isHome && /* @__PURE__ */ React20.createElement(import_ui11.ListItemIcon, null, /* @__PURE__ */ React20.createElement(import_icons12.HomeIcon, { color: "disabled" }))
896
+ post.isHome && /* @__PURE__ */ React19.createElement(import_ui12.ListItemIcon, null, /* @__PURE__ */ React19.createElement(import_icons12.HomeIcon, { titleAccess: (0, import_i18n12.__)("Homepage", "elementor"), color: "disabled" }))
810
897
  )
811
- ), /* @__PURE__ */ React20.createElement(
812
- import_ui11.Menu,
898
+ ), /* @__PURE__ */ React19.createElement(
899
+ import_ui12.Menu,
813
900
  {
814
901
  PaperProps: { sx: { mt: 4, width: 200 } },
815
902
  MenuListProps: { dense: true },
816
- ...(0, import_ui11.bindMenu)(popupState)
903
+ ...(0, import_ui12.bindMenu)(popupState)
817
904
  },
818
- /* @__PURE__ */ React20.createElement(Rename, { post }),
819
- /* @__PURE__ */ React20.createElement(Duplicate, { post, popupState }),
820
- /* @__PURE__ */ React20.createElement(Delete, { post }),
821
- /* @__PURE__ */ React20.createElement(View, { post }),
822
- /* @__PURE__ */ React20.createElement(import_ui11.Divider, null),
823
- /* @__PURE__ */ React20.createElement(SetHome, { post })
905
+ /* @__PURE__ */ React19.createElement(Rename, { post }),
906
+ /* @__PURE__ */ React19.createElement(Duplicate, { post, popupState }),
907
+ /* @__PURE__ */ React19.createElement(Delete, { post }),
908
+ /* @__PURE__ */ React19.createElement(View, { post }),
909
+ /* @__PURE__ */ React19.createElement(import_ui12.Divider, null),
910
+ /* @__PURE__ */ React19.createElement(SetHome, { post })
824
911
  ));
825
912
  }
826
913
 
@@ -828,72 +915,78 @@ function ListItemView({ post }) {
828
915
  function PostListItem2({ post }) {
829
916
  const { editMode } = usePostListContext();
830
917
  if ("rename" === editMode.mode && post?.id && post?.id === editMode.details.postId) {
831
- return /* @__PURE__ */ React21.createElement(ListItemRename, { post });
918
+ return /* @__PURE__ */ React20.createElement(ListItemRename, { post });
832
919
  }
833
920
  if ("create" === editMode.mode && !post) {
834
- return /* @__PURE__ */ React21.createElement(ListItemCreate, null);
921
+ return /* @__PURE__ */ React20.createElement(ListItemCreate, null);
835
922
  }
836
923
  if ("duplicate" === editMode.mode && !post) {
837
- return /* @__PURE__ */ React21.createElement(ListItemDuplicate, null);
924
+ return /* @__PURE__ */ React20.createElement(ListItemDuplicate, null);
838
925
  }
839
926
  if (!post) {
840
927
  return null;
841
928
  }
842
- return /* @__PURE__ */ React21.createElement(ListItemView, { post });
929
+ return /* @__PURE__ */ React20.createElement(ListItemView, { post });
843
930
  }
844
931
 
845
932
  // src/components/panel/posts-list/posts-collapsible-list.tsx
846
933
  function PostsCollapsibleList({ isOpenByDefault = false }) {
847
934
  const { type, editMode } = usePostListContext();
848
935
  const { data: posts, isLoading: postsLoading } = usePosts(type);
936
+ const { data: homepageSettings } = useHomepage();
849
937
  if (!posts || postsLoading) {
850
- return /* @__PURE__ */ React22.createElement(import_ui12.Box, { spacing: 4, sx: { px: 6 } }, /* @__PURE__ */ React22.createElement(import_ui12.Skeleton, { variant: "text", sx: { fontSize: "2rem" } }), /* @__PURE__ */ React22.createElement(import_ui12.Skeleton, { variant: "rounded", width: "100%", height: "48" }));
938
+ return /* @__PURE__ */ React21.createElement(import_ui13.Box, { spacing: 4, sx: { px: 6 } }, /* @__PURE__ */ React21.createElement(import_ui13.Skeleton, { variant: "text", sx: { fontSize: "2rem" } }), /* @__PURE__ */ React21.createElement(import_ui13.Skeleton, { variant: "rounded", width: "100%", height: "48" }));
851
939
  }
852
940
  const label = `${postTypesMap[type].labels.plural_name} (${posts.length.toString()})`;
853
- return /* @__PURE__ */ React22.createElement(import_ui12.List, { dense: true }, /* @__PURE__ */ React22.createElement(
941
+ const isHomepageSet = homepageSettings?.show_on_front === "page" && !!homepageSettings?.page_on_front;
942
+ const homepageId = isHomepageSet ? homepageSettings.page_on_front : null;
943
+ return /* @__PURE__ */ React21.createElement(import_ui13.List, { dense: true }, /* @__PURE__ */ React21.createElement(
854
944
  CollapsibleList,
855
945
  {
856
946
  label,
857
947
  Icon: import_icons13.PageTypeIcon,
858
948
  isOpenByDefault: isOpenByDefault || false
859
949
  },
860
- posts.map((post) => /* @__PURE__ */ React22.createElement(PostListItem2, { key: post.id, post })),
861
- ["duplicate", "create"].includes(editMode.mode) && /* @__PURE__ */ React22.createElement(PostListItem2, null)
950
+ posts.map((post) => {
951
+ post = { ...post, isHome: post.id === homepageId };
952
+ return /* @__PURE__ */ React21.createElement(PostListItem2, { key: post.id, post });
953
+ }),
954
+ ["duplicate", "create"].includes(editMode.mode) && /* @__PURE__ */ React21.createElement(PostListItem2, null)
862
955
  ));
863
956
  }
864
957
 
865
958
  // src/components/panel/add-new-button.tsx
866
- var React23 = __toESM(require("react"));
867
- var import_ui13 = require("@elementor/ui");
959
+ var React22 = __toESM(require("react"));
960
+ var import_ui14 = require("@elementor/ui");
868
961
  var import_icons14 = require("@elementor/icons");
869
- var import_i18n12 = require("@wordpress/i18n");
962
+ var import_i18n13 = require("@wordpress/i18n");
870
963
  function AddNewButton() {
871
964
  const { setEditMode } = usePostListContext();
872
- return /* @__PURE__ */ React23.createElement(
873
- import_ui13.Button,
965
+ return /* @__PURE__ */ React22.createElement(
966
+ import_ui14.Button,
874
967
  {
875
968
  size: "small",
876
969
  sx: { mt: 4, mb: 4, mr: 5 },
877
- startIcon: /* @__PURE__ */ React23.createElement(import_icons14.PlusIcon, null),
970
+ startIcon: /* @__PURE__ */ React22.createElement(import_icons14.PlusIcon, null),
878
971
  onClick: () => {
879
972
  setEditMode({ mode: "create", details: {} });
880
973
  }
881
974
  },
882
- (0, import_i18n12.__)("Add New", "elementor")
975
+ (0, import_i18n13.__)("Add New", "elementor")
883
976
  );
884
977
  }
885
978
 
886
979
  // src/components/panel/shell.tsx
887
980
  var Shell = () => {
888
- return /* @__PURE__ */ React24.createElement(import_editor_panels.Panel, null, /* @__PURE__ */ React24.createElement(import_editor_panels.PanelHeader, null, /* @__PURE__ */ React24.createElement(import_editor_panels.PanelHeaderTitle, null, (0, import_i18n13.__)("Pages", "elementor"))), /* @__PURE__ */ React24.createElement(import_editor_panels.PanelBody, null, /* @__PURE__ */ React24.createElement(PostListContextProvider, { type: "page" }, /* @__PURE__ */ React24.createElement(
889
- import_ui14.Box,
981
+ return /* @__PURE__ */ React23.createElement(import_editor_panels.Panel, null, /* @__PURE__ */ React23.createElement(import_editor_panels.PanelHeader, null, /* @__PURE__ */ React23.createElement(import_editor_panels.PanelHeaderTitle, null, (0, import_i18n14.__)("Pages", "elementor"))), /* @__PURE__ */ React23.createElement(import_editor_panels.PanelBody, null, /* @__PURE__ */ React23.createElement(PostListContextProvider, { type: "page" }, /* @__PURE__ */ React23.createElement(
982
+ import_ui15.Box,
890
983
  {
891
984
  display: "flex",
892
985
  justifyContent: "flex-end",
893
986
  alignItems: "center"
894
987
  },
895
- /* @__PURE__ */ React24.createElement(AddNewButton, null)
896
- ), /* @__PURE__ */ React24.createElement(PostsCollapsibleList, { isOpenByDefault: true }))));
988
+ /* @__PURE__ */ React23.createElement(AddNewButton, null)
989
+ ), /* @__PURE__ */ React23.createElement(PostsCollapsibleList, { isOpenByDefault: true }))));
897
990
  };
898
991
  var shell_default = Shell;
899
992
 
@@ -912,7 +1005,7 @@ function useToggleButtonProps() {
912
1005
  const { isOpen, isBlocked } = usePanelStatus();
913
1006
  const { open, close } = usePanelActions();
914
1007
  return {
915
- title: (0, import_i18n14.__)("Pages", "elementor"),
1008
+ title: (0, import_i18n15.__)("Pages", "elementor"),
916
1009
  icon: import_icons15.PagesIcon,
917
1010
  onClick: () => isOpen ? close() : open(),
918
1011
  selected: isOpen,