@elementor/editor-site-navigation 4.5.0-1210 → 4.5.0-1212

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/dist/index.mjs CHANGED
@@ -30,11 +30,11 @@ import { isSidebarEnabled, sidebarTools } from "@elementor/editor-sidebar";
30
30
  import { createPanel } from "@elementor/editor-panels";
31
31
 
32
32
  // src/components/panel/shell.tsx
33
- import * as React26 from "react";
34
- import { useState as useState6 } from "react";
33
+ import * as React27 from "react";
34
+ import { useState as useState7 } from "react";
35
35
  import { Panel, PanelBody, PanelHeader, PanelHeaderTitle } from "@elementor/editor-panels";
36
- import { Divider as Divider4, Stack as Stack3 } from "@elementor/ui";
37
- import { __ as __18 } from "@wordpress/i18n";
36
+ import { Divider as Divider4, Stack as Stack4 } from "@elementor/ui";
37
+ import { __ as __19 } from "@wordpress/i18n";
38
38
 
39
39
  // src/contexts/content-panel-coordinator.tsx
40
40
  import * as React from "react";
@@ -396,8 +396,8 @@ var ErrorSnackbar = ({ open, onClose }) => {
396
396
  var error_snackbar_default = ErrorSnackbar;
397
397
 
398
398
  // src/components/panel/shell-panel-body-content.tsx
399
- import * as React25 from "react";
400
- import { List as List2, Skeleton as Skeleton2, Stack as Stack2 } from "@elementor/ui";
399
+ import * as React26 from "react";
400
+ import { List as List2, Skeleton as Skeleton2, Stack as Stack3 } from "@elementor/ui";
401
401
 
402
402
  // src/contexts/post-list-context.tsx
403
403
  import * as React6 from "react";
@@ -442,10 +442,10 @@ function usePostListContext() {
442
442
  }
443
443
 
444
444
  // src/components/panel/posts-list/posts-collapsible-list.tsx
445
- import * as React23 from "react";
446
- import { useEffect, useMemo as useMemo4, useState as useState5 } from "react";
447
- import { Box as Box6, Button as Button2, CircularProgress as CircularProgress4, Skeleton, Typography as Typography5 } from "@elementor/ui";
448
- import { __ as __16 } from "@wordpress/i18n";
445
+ import * as React24 from "react";
446
+ import { useEffect as useEffect2, useMemo as useMemo4, useRef as useRef4, useState as useState6 } from "react";
447
+ import { Box as Box7, Skeleton, Typography as Typography5 } from "@elementor/ui";
448
+ import { __ as __17 } from "@wordpress/i18n";
449
449
 
450
450
  // src/hooks/use-homepage.ts
451
451
  import { useQuery as useQuery2 } from "@elementor/query";
@@ -474,6 +474,70 @@ function useHomepage() {
474
474
  });
475
475
  }
476
476
 
477
+ // src/hooks/use-post-list-pagination.ts
478
+ import { useCallback as useCallback2, useEffect, useRef as useRef2, useState as useState3 } from "react";
479
+ function usePostListPagination({
480
+ fetchNextPage,
481
+ hasNextPage,
482
+ isFetchingNextPage,
483
+ loadedCount,
484
+ resetKey,
485
+ totalCount
486
+ }) {
487
+ const [visibleCount, setVisibleCount] = useState3(POST_PER_PAGE);
488
+ const pendingVisibleTargetRef = useRef2(null);
489
+ useEffect(() => {
490
+ setVisibleCount(POST_PER_PAGE);
491
+ pendingVisibleTargetRef.current = null;
492
+ }, [resetKey]);
493
+ useEffect(() => {
494
+ const target = pendingVisibleTargetRef.current;
495
+ if (target === null) {
496
+ return;
497
+ }
498
+ if (loadedCount >= target) {
499
+ setVisibleCount(target);
500
+ pendingVisibleTargetRef.current = null;
501
+ return;
502
+ }
503
+ if (!isFetchingNextPage) {
504
+ setVisibleCount(Math.min(target, loadedCount));
505
+ pendingVisibleTargetRef.current = null;
506
+ }
507
+ }, [isFetchingNextPage, loadedCount]);
508
+ const canShowLess = visibleCount > POST_PER_PAGE;
509
+ const canLoadMore = visibleCount < loadedCount || hasNextPage;
510
+ const handleLoadMore = useCallback2(() => {
511
+ if (isFetchingNextPage || !canLoadMore) {
512
+ return;
513
+ }
514
+ const targetVisible = Math.min(visibleCount + POST_PER_PAGE, totalCount);
515
+ if (targetVisible <= loadedCount) {
516
+ setVisibleCount(Math.min(targetVisible, loadedCount));
517
+ return;
518
+ }
519
+ if (hasNextPage) {
520
+ pendingVisibleTargetRef.current = targetVisible;
521
+ fetchNextPage();
522
+ return;
523
+ }
524
+ if (visibleCount < loadedCount) {
525
+ setVisibleCount(Math.min(visibleCount + POST_PER_PAGE, loadedCount));
526
+ }
527
+ }, [canLoadMore, fetchNextPage, hasNextPage, isFetchingNextPage, loadedCount, totalCount, visibleCount]);
528
+ const handleShowLess = useCallback2(() => {
529
+ pendingVisibleTargetRef.current = null;
530
+ setVisibleCount(POST_PER_PAGE);
531
+ }, []);
532
+ return {
533
+ canLoadMore,
534
+ canShowLess,
535
+ handleLoadMore,
536
+ handleShowLess,
537
+ visibleCount
538
+ };
539
+ }
540
+
477
541
  // src/hooks/use-posts.ts
478
542
  import { keepPreviousData, useInfiniteQuery } from "@elementor/query";
479
543
  var postsQueryKeyBase = (postTypeSlug) => ["site-navigation", "posts", postTypeSlug];
@@ -553,6 +617,7 @@ function getSectionHeaderAriaLabel(title, count) {
553
617
  }
554
618
  function CollapsibleList({
555
619
  count,
620
+ headerRef,
556
621
  isOpen,
557
622
  onOpenChange,
558
623
  title,
@@ -578,6 +643,7 @@ function CollapsibleList({
578
643
  /* @__PURE__ */ React8.createElement(
579
644
  ListItemButton,
580
645
  {
646
+ ref: headerRef,
581
647
  id: labelId,
582
648
  "aria-controls": contentId,
583
649
  "aria-expanded": isOpen,
@@ -724,7 +790,7 @@ function useInvalidatePosts(postTypeSlug) {
724
790
 
725
791
  // src/components/panel/posts-list/list-items/edit-mode-template.tsx
726
792
  import * as React10 from "react";
727
- import { useRef as useRef2, useState as useState3 } from "react";
793
+ import { useRef as useRef3, useState as useState4 } from "react";
728
794
  import { XIcon } from "@elementor/icons";
729
795
  import { Box as Box4, CircularProgress, IconButton as IconButton2, ListItem, ListItemText as ListItemText3 } from "@elementor/ui";
730
796
  import { __ as __6 } from "@wordpress/i18n";
@@ -766,10 +832,10 @@ var editRowInputSx = {
766
832
  };
767
833
  function EditModeTemplate({ postTitle, isLoading, callback }) {
768
834
  const { resetEditMode } = usePostListContext();
769
- const [title, setTitle] = useState3(postTitle);
770
- const [touched, setTouched] = useState3(false);
771
- const [inputError, setInputError] = useState3(null);
772
- const closeButton = useRef2();
835
+ const [title, setTitle] = useState4(postTitle);
836
+ const [touched, setTouched] = useState4(false);
837
+ const [inputError, setInputError] = useState4(null);
838
+ const closeButton = useRef3();
773
839
  const onBlur = (e) => {
774
840
  if (closeButton.current === e.relatedTarget) {
775
841
  return;
@@ -1098,7 +1164,7 @@ function PageTitleAndStatus({ title, status }) {
1098
1164
 
1099
1165
  // src/components/panel/actions-menu/actions/delete.tsx
1100
1166
  import * as React16 from "react";
1101
- import { useState as useState4 } from "react";
1167
+ import { useState as useState5 } from "react";
1102
1168
  import { __useActiveDocument as useActiveDocument2 } from "@elementor/editor-documents";
1103
1169
  import { TrashIcon } from "@elementor/icons";
1104
1170
  import {
@@ -1130,7 +1196,7 @@ function ActionMenuItem({ title, icon: Icon, MenuItemProps }) {
1130
1196
 
1131
1197
  // src/components/panel/actions-menu/actions/delete.tsx
1132
1198
  function Delete({ post }) {
1133
- const [isDialogOpen, setIsDialogOpen] = useState4(false);
1199
+ const [isDialogOpen, setIsDialogOpen] = useState5(false);
1134
1200
  const activeDocument = useActiveDocument2();
1135
1201
  const isPostActive = activeDocument?.id === post.id;
1136
1202
  const userCanDelete = post.user_can.delete;
@@ -1417,15 +1483,74 @@ function PostListItem({ post }) {
1417
1483
  return /* @__PURE__ */ React22.createElement(ListItemView, { post });
1418
1484
  }
1419
1485
 
1486
+ // src/components/panel/posts-list/post-list-pagination-actions.tsx
1487
+ import * as React23 from "react";
1488
+ import { CollapseIcon as CollapseIcon2 } from "@elementor/editor-ui";
1489
+ import { Box as Box6, Button as Button2, CircularProgress as CircularProgress4, Stack as Stack2 } from "@elementor/ui";
1490
+ import { __ as __16 } from "@wordpress/i18n";
1491
+ var listPaginationButtonProps = {
1492
+ color: "secondary",
1493
+ size: "small",
1494
+ variant: "outlined"
1495
+ };
1496
+ function PostListPaginationActions({
1497
+ canLoadMore,
1498
+ canShowLess,
1499
+ isLoadingMore,
1500
+ loadMoreButtonRef,
1501
+ onLoadMore,
1502
+ onShowLess
1503
+ }) {
1504
+ if (!canLoadMore && !canShowLess) {
1505
+ return null;
1506
+ }
1507
+ const loadMoreLabel = __16("Load more", "elementor");
1508
+ const showLessLabel = __16("Show less", "elementor");
1509
+ const loadMoreButton = /* @__PURE__ */ React23.createElement(
1510
+ Button2,
1511
+ {
1512
+ ...listPaginationButtonProps,
1513
+ ref: loadMoreButtonRef,
1514
+ "aria-label": loadMoreLabel,
1515
+ disabled: isLoadingMore,
1516
+ endIcon: isLoadingMore ? void 0 : /* @__PURE__ */ React23.createElement(CollapseIcon2, { open: false }),
1517
+ fullWidth: true,
1518
+ onClick: onLoadMore,
1519
+ sx: { flex: 1, my: 0.5 }
1520
+ },
1521
+ isLoadingMore ? /* @__PURE__ */ React23.createElement(CircularProgress4, { size: 20 }) : loadMoreLabel
1522
+ );
1523
+ const showLessButton = /* @__PURE__ */ React23.createElement(
1524
+ Button2,
1525
+ {
1526
+ ...listPaginationButtonProps,
1527
+ "aria-label": showLessLabel,
1528
+ endIcon: /* @__PURE__ */ React23.createElement(CollapseIcon2, { open: true }),
1529
+ fullWidth: true,
1530
+ onClick: onShowLess,
1531
+ sx: { flex: 1, my: 0.5 }
1532
+ },
1533
+ showLessLabel
1534
+ );
1535
+ if (canShowLess && canLoadMore) {
1536
+ return /* @__PURE__ */ React23.createElement(Box6, { sx: { px: 2, width: "100%" } }, /* @__PURE__ */ React23.createElement(Stack2, { direction: "row", spacing: 1 }, showLessButton, loadMoreButton));
1537
+ }
1538
+ return /* @__PURE__ */ React23.createElement(Box6, { sx: { px: 2, width: "100%" } }, canShowLess ? showLessButton : loadMoreButton);
1539
+ }
1540
+
1420
1541
  // src/components/panel/posts-list/posts-collapsible-list.tsx
1421
1542
  var SEARCH_DEBOUNCE_MS = 300;
1422
1543
  function PostsCollapsibleList({ isOpenByDefault = false }) {
1423
1544
  const { type, editMode, setEditMode } = usePostListContext();
1424
1545
  const { registerSection, unregisterSection, searchQuery } = useContentPanelCoordinator();
1425
- const [isOpen, setIsOpen] = useState5(isOpenByDefault);
1546
+ const [isOpen, setIsOpen] = useState6(isOpenByDefault);
1426
1547
  const trimmedSearch = searchQuery.trim();
1427
- const [debouncedSearch, setDebouncedSearch] = useState5(trimmedSearch);
1428
- useEffect(() => {
1548
+ const [debouncedSearch, setDebouncedSearch] = useState6(trimmedSearch);
1549
+ const focusAfterShowLessRef = useRef4(false);
1550
+ const listTopRef = useRef4(null);
1551
+ const loadMoreButtonRef = useRef4(null);
1552
+ const sectionHeaderRef = useRef4(null);
1553
+ useEffect2(() => {
1429
1554
  const handle = window.setTimeout(() => setDebouncedSearch(trimmedSearch), SEARCH_DEBOUNCE_MS);
1430
1555
  return () => window.clearTimeout(handle);
1431
1556
  }, [trimmedSearch]);
@@ -1439,7 +1564,7 @@ function PostsCollapsibleList({ isOpenByDefault = false }) {
1439
1564
  } = usePosts(type, debouncedSearch);
1440
1565
  const { data: homepageId } = useHomepage();
1441
1566
  const isPageType = type === "page";
1442
- useEffect(() => {
1567
+ useEffect2(() => {
1443
1568
  registerSection(type, {
1444
1569
  setExpanded: setIsOpen,
1445
1570
  startCreate: () => setEditMode({ mode: "create", details: {} })
@@ -1462,53 +1587,88 @@ function PostsCollapsibleList({ isOpenByDefault = false }) {
1462
1587
  }) : mappedPosts;
1463
1588
  return sorted;
1464
1589
  }, [posts, isPageType, homepageId]);
1465
- useEffect(() => {
1590
+ const pagination = usePostListPagination({
1591
+ fetchNextPage,
1592
+ hasNextPage,
1593
+ isFetchingNextPage,
1594
+ loadedCount: filteredPosts.length,
1595
+ resetKey: `${type}:${debouncedSearch}`,
1596
+ totalCount: total
1597
+ });
1598
+ const displayedPosts = useMemo4(
1599
+ () => filteredPosts.slice(0, pagination.visibleCount),
1600
+ [filteredPosts, pagination.visibleCount]
1601
+ );
1602
+ const handleShowLess = () => {
1603
+ focusAfterShowLessRef.current = true;
1604
+ pagination.handleShowLess();
1605
+ const listTop = listTopRef.current;
1606
+ if (listTop && typeof listTop.scrollIntoView === "function") {
1607
+ listTop.scrollIntoView({ block: "nearest" });
1608
+ }
1609
+ };
1610
+ useEffect2(() => {
1611
+ if (!focusAfterShowLessRef.current) {
1612
+ return;
1613
+ }
1614
+ focusAfterShowLessRef.current = false;
1615
+ const loadMoreButton = loadMoreButtonRef.current;
1616
+ if (loadMoreButton) {
1617
+ loadMoreButton.focus();
1618
+ return;
1619
+ }
1620
+ sectionHeaderRef.current?.focus();
1621
+ }, [pagination.canLoadMore, pagination.visibleCount]);
1622
+ useEffect2(() => {
1466
1623
  if (debouncedSearch && filteredPosts.length > 0) {
1467
1624
  setIsOpen(true);
1468
1625
  }
1469
1626
  }, [debouncedSearch, filteredPosts.length]);
1470
1627
  if (postsError) {
1471
- return /* @__PURE__ */ React23.createElement(ErrorState, null);
1628
+ return /* @__PURE__ */ React24.createElement(ErrorState, null);
1472
1629
  }
1473
1630
  if (postsPending && !posts?.length) {
1474
- return /* @__PURE__ */ React23.createElement(Box6, { sx: { px: 2 } }, /* @__PURE__ */ React23.createElement(Box6, null, /* @__PURE__ */ React23.createElement(Skeleton, { sx: { my: 3 }, animation: "wave", variant: "rounded", width: "100%", height: "24px" }), /* @__PURE__ */ React23.createElement(Skeleton, { sx: { my: 3 }, animation: "wave", variant: "rounded", width: "70%", height: "24px" }), /* @__PURE__ */ React23.createElement(Skeleton, { sx: { my: 3 }, animation: "wave", variant: "rounded", width: "70%", height: "24px" }), /* @__PURE__ */ React23.createElement(Skeleton, { sx: { my: 3 }, animation: "wave", variant: "rounded", width: "70%", height: "24px" })));
1631
+ return /* @__PURE__ */ React24.createElement(Box7, { sx: { px: 2 } }, /* @__PURE__ */ React24.createElement(Box7, null, /* @__PURE__ */ React24.createElement(Skeleton, { sx: { my: 3 }, animation: "wave", variant: "rounded", width: "100%", height: "24px" }), /* @__PURE__ */ React24.createElement(Skeleton, { sx: { my: 3 }, animation: "wave", variant: "rounded", width: "70%", height: "24px" }), /* @__PURE__ */ React24.createElement(Skeleton, { sx: { my: 3 }, animation: "wave", variant: "rounded", width: "70%", height: "24px" }), /* @__PURE__ */ React24.createElement(Skeleton, { sx: { my: 3 }, animation: "wave", variant: "rounded", width: "70%", height: "24px" })));
1475
1632
  }
1476
1633
  const displayCount = total;
1477
1634
  const sectionTitle = postTypesMap[type].labels.plural_name;
1478
1635
  const showNoResults = debouncedSearch && filteredPosts.length === 0;
1479
- return /* @__PURE__ */ React23.createElement(
1636
+ return /* @__PURE__ */ React24.createElement(
1480
1637
  CollapsibleList,
1481
1638
  {
1482
1639
  count: displayCount,
1640
+ headerRef: sectionHeaderRef,
1483
1641
  isOpen,
1484
1642
  onOpenChange: setIsOpen,
1485
1643
  title: sectionTitle,
1486
- trailingActions: /* @__PURE__ */ React23.createElement(SectionAddButton, { onBeforeCreate: () => setIsOpen(true) })
1644
+ trailingActions: /* @__PURE__ */ React24.createElement(SectionAddButton, { onBeforeCreate: () => setIsOpen(true) })
1487
1645
  },
1488
- showNoResults && /* @__PURE__ */ React23.createElement(Box6, { sx: { py: 2, px: 2 } }, /* @__PURE__ */ React23.createElement(Typography5, { variant: "body2", color: "text.secondary" }, __16("No results found", "elementor"))),
1489
- filteredPosts.map((post) => {
1490
- return /* @__PURE__ */ React23.createElement(PostListItem, { key: post.id, post });
1646
+ showNoResults && /* @__PURE__ */ React24.createElement(Box7, { sx: { py: 2, px: 2 } }, /* @__PURE__ */ React24.createElement(Typography5, { variant: "body2", color: "text.secondary" }, __17("No results found", "elementor"))),
1647
+ /* @__PURE__ */ React24.createElement(Box7, { ref: listTopRef }),
1648
+ displayedPosts.map((post) => {
1649
+ return /* @__PURE__ */ React24.createElement(PostListItem, { key: post.id, post });
1491
1650
  }),
1492
- ["duplicate", "create"].includes(editMode.mode) && /* @__PURE__ */ React23.createElement(PostListItem, null),
1493
- hasNextPage && /* @__PURE__ */ React23.createElement(
1494
- Box6,
1651
+ ["duplicate", "create"].includes(editMode.mode) && /* @__PURE__ */ React24.createElement(PostListItem, null),
1652
+ /* @__PURE__ */ React24.createElement(
1653
+ PostListPaginationActions,
1495
1654
  {
1496
- sx: {
1497
- display: "flex",
1498
- justifyContent: "center"
1499
- }
1500
- },
1501
- /* @__PURE__ */ React23.createElement(Button2, { onClick: fetchNextPage, color: "secondary" }, isFetchingNextPage ? /* @__PURE__ */ React23.createElement(CircularProgress4, null) : __16("Load more", "elementor"))
1655
+ canLoadMore: pagination.canLoadMore,
1656
+ canShowLess: pagination.canShowLess,
1657
+ isLoadingMore: isFetchingNextPage,
1658
+ loadMoreButtonRef,
1659
+ onLoadMore: pagination.handleLoadMore,
1660
+ onShowLess: handleShowLess
1661
+ }
1502
1662
  )
1503
1663
  );
1504
1664
  }
1505
1665
 
1506
1666
  // src/components/panel/user-load-error.tsx
1507
- import * as React24 from "react";
1508
- import { Box as Box7, Typography as Typography6 } from "@elementor/ui";
1509
- import { __ as __17 } from "@wordpress/i18n";
1667
+ import * as React25 from "react";
1668
+ import { Box as Box8, Typography as Typography6 } from "@elementor/ui";
1669
+ import { __ as __18 } from "@wordpress/i18n";
1510
1670
  function UserLoadError() {
1511
- return /* @__PURE__ */ React24.createElement(Box7, { sx: { px: 2, py: 2 } }, /* @__PURE__ */ React24.createElement(Typography6, { variant: "body2", color: "text.secondary" }, __17(
1671
+ return /* @__PURE__ */ React25.createElement(Box8, { sx: { px: 2, py: 2 } }, /* @__PURE__ */ React25.createElement(Typography6, { variant: "body2", color: "text.secondary" }, __18(
1512
1672
  "We couldn\u2019t load your content permissions. Try closing and reopening this panel.",
1513
1673
  "elementor"
1514
1674
  )));
@@ -1522,20 +1682,20 @@ function ShellPanelBodyContent({
1522
1682
  showUserLoadError
1523
1683
  }) {
1524
1684
  if (isUserPending) {
1525
- return /* @__PURE__ */ React25.createElement(Stack2, { spacing: 1, sx: { px: 2, py: 1 } }, /* @__PURE__ */ React25.createElement(Skeleton2, { animation: "wave", height: 28, variant: "rounded", width: "100%" }), /* @__PURE__ */ React25.createElement(Skeleton2, { animation: "wave", height: 28, variant: "rounded", width: "80%" }));
1685
+ return /* @__PURE__ */ React26.createElement(Stack3, { spacing: 1, sx: { px: 2, py: 1 } }, /* @__PURE__ */ React26.createElement(Skeleton2, { animation: "wave", height: 28, variant: "rounded", width: "100%" }), /* @__PURE__ */ React26.createElement(Skeleton2, { animation: "wave", height: 28, variant: "rounded", width: "80%" }));
1526
1686
  }
1527
1687
  if (showUserLoadError) {
1528
- return /* @__PURE__ */ React25.createElement(UserLoadError, null);
1688
+ return /* @__PURE__ */ React26.createElement(UserLoadError, null);
1529
1689
  }
1530
- return /* @__PURE__ */ React25.createElement(List2, { dense: true, disablePadding: true, sx: { py: 0, width: "100%" } }, accessiblePostTypes.map((postTypeSlug, index) => /* @__PURE__ */ React25.createElement(PostListContextProvider, { key: postTypeSlug, type: postTypeSlug, setError: onListError }, /* @__PURE__ */ React25.createElement(PostsCollapsibleList, { isOpenByDefault: index === 0 }))));
1690
+ return /* @__PURE__ */ React26.createElement(List2, { dense: true, disablePadding: true, sx: { py: 0, width: "100%" } }, accessiblePostTypes.map((postTypeSlug, index) => /* @__PURE__ */ React26.createElement(PostListContextProvider, { key: postTypeSlug, type: postTypeSlug, setError: onListError }, /* @__PURE__ */ React26.createElement(PostsCollapsibleList, { isOpenByDefault: index === 0 }))));
1531
1691
  }
1532
1692
 
1533
1693
  // src/components/panel/shell.tsx
1534
1694
  var Shell = () => {
1535
- const [isErrorSnackbarOpen, setIsErrorSnackbarOpen] = useState6(false);
1695
+ const [isErrorSnackbarOpen, setIsErrorSnackbarOpen] = useState7(false);
1536
1696
  const { accessiblePostTypes, isUserPending, showUserLoadError } = useAccessiblePanelPostTypes();
1537
- return /* @__PURE__ */ React26.createElement(ContentPanelCoordinatorProvider, null, /* @__PURE__ */ React26.createElement(Panel, null, /* @__PURE__ */ React26.createElement(PanelHeader, null, /* @__PURE__ */ React26.createElement(
1538
- Stack3,
1697
+ return /* @__PURE__ */ React27.createElement(ContentPanelCoordinatorProvider, null, /* @__PURE__ */ React27.createElement(Panel, null, /* @__PURE__ */ React27.createElement(PanelHeader, null, /* @__PURE__ */ React27.createElement(
1698
+ Stack4,
1539
1699
  {
1540
1700
  alignItems: "center",
1541
1701
  direction: "row",
@@ -1544,9 +1704,9 @@ var Shell = () => {
1544
1704
  ...contentPanelHeaderStackSx
1545
1705
  }
1546
1706
  },
1547
- /* @__PURE__ */ React26.createElement(PanelHeaderTitle, { sx: { flex: 1, minWidth: 0, textAlign: "start" } }, __18("Site content", "elementor")),
1548
- /* @__PURE__ */ React26.createElement(ContentPanelHeaderAdd, null)
1549
- )), /* @__PURE__ */ React26.createElement(Divider4, null), /* @__PURE__ */ React26.createElement(PanelBody, null, /* @__PURE__ */ React26.createElement(ContentPanelSearch, null), /* @__PURE__ */ React26.createElement(
1707
+ /* @__PURE__ */ React27.createElement(PanelHeaderTitle, { sx: { flex: 1, minWidth: 0, textAlign: "start" } }, __19("Site content", "elementor")),
1708
+ /* @__PURE__ */ React27.createElement(ContentPanelHeaderAdd, null)
1709
+ )), /* @__PURE__ */ React27.createElement(Divider4, null), /* @__PURE__ */ React27.createElement(PanelBody, null, /* @__PURE__ */ React27.createElement(ContentPanelSearch, null), /* @__PURE__ */ React27.createElement(
1550
1710
  ShellPanelBodyContent,
1551
1711
  {
1552
1712
  accessiblePostTypes,
@@ -1554,7 +1714,7 @@ var Shell = () => {
1554
1714
  onListError: () => setIsErrorSnackbarOpen(true),
1555
1715
  showUserLoadError
1556
1716
  }
1557
- ), /* @__PURE__ */ React26.createElement(error_snackbar_default, { open: isErrorSnackbarOpen, onClose: () => setIsErrorSnackbarOpen(false) }))));
1717
+ ), /* @__PURE__ */ React27.createElement(error_snackbar_default, { open: isErrorSnackbarOpen, onClose: () => setIsErrorSnackbarOpen(false) }))));
1558
1718
  };
1559
1719
  var shell_default = Shell;
1560
1720
 
@@ -1565,7 +1725,7 @@ var { panel, usePanelStatus, usePanelActions } = createPanel({
1565
1725
  });
1566
1726
 
1567
1727
  // src/components/top-bar/recently-edited.tsx
1568
- import * as React31 from "react";
1728
+ import * as React32 from "react";
1569
1729
  import {
1570
1730
  __useActiveDocument as useActiveDocument4,
1571
1731
  __useHostDocument as useHostDocument
@@ -1582,22 +1742,22 @@ import {
1582
1742
  MenuItem as MenuItem5,
1583
1743
  usePopupState as usePopupState3
1584
1744
  } from "@elementor/ui";
1585
- import { __ as __20 } from "@wordpress/i18n";
1745
+ import { __ as __21 } from "@wordpress/i18n";
1586
1746
 
1587
1747
  // src/components/top-bar/create-post-list-item.tsx
1588
- import * as React27 from "react";
1748
+ import * as React28 from "react";
1589
1749
  import { __useNavigateToDocument as useNavigateToDocument4 } from "@elementor/editor-documents";
1590
1750
  import { useMixpanel } from "@elementor/events";
1591
1751
  import { PlusIcon as PlusIcon2 } from "@elementor/icons";
1592
1752
  import { CircularProgress as CircularProgress5, ListItemIcon as ListItemIcon3, ListItemText as ListItemText6, MenuItem as MenuItem3 } from "@elementor/ui";
1593
- import { __ as __19 } from "@wordpress/i18n";
1753
+ import { __ as __20 } from "@wordpress/i18n";
1594
1754
 
1595
1755
  // src/hooks/use-create-page.ts
1596
- import { useState as useState7 } from "react";
1756
+ import { useState as useState8 } from "react";
1597
1757
  import apiFetch5 from "@wordpress/api-fetch";
1598
1758
  var endpointPath = "/elementor/v1/site-navigation/add-new-post";
1599
1759
  function useCreatePage() {
1600
- const [isLoading, setIsLoading] = useState7(false);
1760
+ const [isLoading, setIsLoading] = useState8(false);
1601
1761
  return {
1602
1762
  create: () => {
1603
1763
  setIsLoading(true);
@@ -1620,7 +1780,7 @@ function CreatePostListItem({ closePopup, ...props }) {
1620
1780
  const navigateToDocument = useNavigateToDocument4();
1621
1781
  const { data: user } = useUser();
1622
1782
  const { dispatchEvent, config } = useMixpanel();
1623
- return /* @__PURE__ */ React27.createElement(
1783
+ return /* @__PURE__ */ React28.createElement(
1624
1784
  MenuItem3,
1625
1785
  {
1626
1786
  disabled: isLoading || !user?.capabilities?.edit_pages,
@@ -1644,25 +1804,25 @@ function CreatePostListItem({ closePopup, ...props }) {
1644
1804
  },
1645
1805
  ...props
1646
1806
  },
1647
- /* @__PURE__ */ React27.createElement(ListItemIcon3, null, isLoading ? /* @__PURE__ */ React27.createElement(CircularProgress5, { size: "1.25rem" }) : /* @__PURE__ */ React27.createElement(PlusIcon2, { fontSize: "small" })),
1648
- /* @__PURE__ */ React27.createElement(
1807
+ /* @__PURE__ */ React28.createElement(ListItemIcon3, null, isLoading ? /* @__PURE__ */ React28.createElement(CircularProgress5, { size: "1.25rem" }) : /* @__PURE__ */ React28.createElement(PlusIcon2, { fontSize: "small" })),
1808
+ /* @__PURE__ */ React28.createElement(
1649
1809
  ListItemText6,
1650
1810
  {
1651
1811
  primaryTypographyProps: { variant: "body2" },
1652
- primary: __19("Add new page", "elementor")
1812
+ primary: __20("Add new page", "elementor")
1653
1813
  }
1654
1814
  )
1655
1815
  );
1656
1816
  }
1657
1817
 
1658
1818
  // src/components/top-bar/indicator.tsx
1659
- import * as React28 from "react";
1660
- import { Stack as Stack4, Tooltip as BaseTooltip, Typography as Typography7 } from "@elementor/ui";
1819
+ import * as React29 from "react";
1820
+ import { Stack as Stack5, Tooltip as BaseTooltip, Typography as Typography7 } from "@elementor/ui";
1661
1821
  function Indicator({ title, status }) {
1662
- return /* @__PURE__ */ React28.createElement(Tooltip2, { title }, /* @__PURE__ */ React28.createElement(Stack4, { component: "span", direction: "row", alignItems: "center", spacing: 0.5 }, /* @__PURE__ */ React28.createElement(Typography7, { component: "span", variant: "body2", sx: { maxWidth: "120px" }, noWrap: true }, title), status.value !== "publish" && /* @__PURE__ */ React28.createElement(Typography7, { component: "span", variant: "body2", sx: { fontStyle: "italic" } }, "(", status.label, ")")));
1822
+ return /* @__PURE__ */ React29.createElement(Tooltip2, { title }, /* @__PURE__ */ React29.createElement(Stack5, { component: "span", direction: "row", alignItems: "center", spacing: 0.5 }, /* @__PURE__ */ React29.createElement(Typography7, { component: "span", variant: "body2", sx: { maxWidth: "120px" }, noWrap: true }, title), status.value !== "publish" && /* @__PURE__ */ React29.createElement(Typography7, { component: "span", variant: "body2", sx: { fontStyle: "italic" } }, "(", status.label, ")")));
1663
1823
  }
1664
1824
  function Tooltip2(props) {
1665
- return /* @__PURE__ */ React28.createElement(
1825
+ return /* @__PURE__ */ React29.createElement(
1666
1826
  BaseTooltip,
1667
1827
  {
1668
1828
  PopperProps: {
@@ -1678,20 +1838,20 @@ function Tooltip2(props) {
1678
1838
  }
1679
1839
 
1680
1840
  // src/components/top-bar/post-list-item.tsx
1681
- import * as React30 from "react";
1841
+ import * as React31 from "react";
1682
1842
  import { __useNavigateToDocument as useNavigateToDocument5 } from "@elementor/editor-documents";
1683
1843
  import { useMixpanel as useMixpanel2 } from "@elementor/events";
1684
1844
  import { ListItemText as ListItemText7, MenuItem as MenuItem4 } from "@elementor/ui";
1685
1845
 
1686
1846
  // src/components/top-bar/chip-doc-type.tsx
1687
- import * as React29 from "react";
1847
+ import * as React30 from "react";
1688
1848
  import { PostTypeIcon as PostTypeIcon3 } from "@elementor/icons";
1689
1849
  import { Chip as Chip3 } from "@elementor/ui";
1690
1850
  var iconsMap2 = getIconsMap();
1691
1851
  function DocTypeChip({ postType, docType, label }) {
1692
1852
  const color = "elementor_library" === postType ? "global" : "accent";
1693
1853
  const Icon = iconsMap2[docType] || PostTypeIcon3;
1694
- return /* @__PURE__ */ React29.createElement(
1854
+ return /* @__PURE__ */ React30.createElement(
1695
1855
  Chip3,
1696
1856
  {
1697
1857
  component: "span",
@@ -1700,7 +1860,7 @@ function DocTypeChip({ postType, docType, label }) {
1700
1860
  label,
1701
1861
  "data-value": docType,
1702
1862
  color,
1703
- icon: /* @__PURE__ */ React29.createElement(Icon, null),
1863
+ icon: /* @__PURE__ */ React30.createElement(Icon, null),
1704
1864
  sx: { ml: 1, cursor: "inherit" }
1705
1865
  }
1706
1866
  );
@@ -1711,7 +1871,7 @@ function PostListItem2({ post, closePopup, ...props }) {
1711
1871
  const navigateToDocument = useNavigateToDocument5();
1712
1872
  const postTitle = useReverseHtmlEntities(post.title);
1713
1873
  const { dispatchEvent, config } = useMixpanel2();
1714
- return /* @__PURE__ */ React30.createElement(
1874
+ return /* @__PURE__ */ React31.createElement(
1715
1875
  MenuItem4,
1716
1876
  {
1717
1877
  disabled: !post.user_can.edit,
@@ -1734,7 +1894,7 @@ function PostListItem2({ post, closePopup, ...props }) {
1734
1894
  },
1735
1895
  ...props
1736
1896
  },
1737
- /* @__PURE__ */ React30.createElement(
1897
+ /* @__PURE__ */ React31.createElement(
1738
1898
  ListItemText7,
1739
1899
  {
1740
1900
  sx: { flexGrow: 0 },
@@ -1742,7 +1902,7 @@ function PostListItem2({ post, closePopup, ...props }) {
1742
1902
  primary: postTitle
1743
1903
  }
1744
1904
  ),
1745
- /* @__PURE__ */ React30.createElement(DocTypeChip, { postType: post.type.post_type, docType: post.type.doc_type, label: post.type.label })
1905
+ /* @__PURE__ */ React31.createElement(DocTypeChip, { postType: post.type.post_type, docType: post.type.doc_type, label: post.type.label })
1746
1906
  );
1747
1907
  }
1748
1908
 
@@ -1768,12 +1928,12 @@ function RecentlyEdited() {
1768
1928
  return null;
1769
1929
  }
1770
1930
  const buttonProps = bindTrigger3(popupState);
1771
- return /* @__PURE__ */ React31.createElement(React31.Fragment, null, /* @__PURE__ */ React31.createElement(
1931
+ return /* @__PURE__ */ React32.createElement(React32.Fragment, null, /* @__PURE__ */ React32.createElement(
1772
1932
  Button3,
1773
1933
  {
1774
1934
  color: "inherit",
1775
1935
  size: "small",
1776
- endIcon: /* @__PURE__ */ React31.createElement(ChevronDownIcon, { fontSize: "small" }),
1936
+ endIcon: /* @__PURE__ */ React32.createElement(ChevronDownIcon, { fontSize: "small" }),
1777
1937
  ...buttonProps,
1778
1938
  onClick: (e) => {
1779
1939
  const extendedWindow = window;
@@ -1792,40 +1952,40 @@ function RecentlyEdited() {
1792
1952
  buttonProps.onClick(e);
1793
1953
  }
1794
1954
  },
1795
- /* @__PURE__ */ React31.createElement(Indicator, { title: documentTitle, status: document2.status })
1796
- ), /* @__PURE__ */ React31.createElement(
1955
+ /* @__PURE__ */ React32.createElement(Indicator, { title: documentTitle, status: document2.status })
1956
+ ), /* @__PURE__ */ React32.createElement(
1797
1957
  Menu3,
1798
1958
  {
1799
1959
  MenuListProps: {
1800
- subheader: /* @__PURE__ */ React31.createElement(ListSubheader, { sx: { color: "accent.main", fontStyle: "italic", fontWeight: "300" } }, __20("Recent", "elementor"))
1960
+ subheader: /* @__PURE__ */ React32.createElement(ListSubheader, { sx: { color: "accent.main", fontStyle: "italic", fontWeight: "300" } }, __21("Recent", "elementor"))
1801
1961
  },
1802
1962
  PaperProps: { sx: { mt: 2.5, width: 320 } },
1803
1963
  ...bindMenu3(popupState)
1804
1964
  },
1805
- recentPosts.map((post) => /* @__PURE__ */ React31.createElement(PostListItem2, { key: post.id, post, closePopup: popupState.close })),
1806
- recentPosts.length === 0 && /* @__PURE__ */ React31.createElement(MenuItem5, { disabled: true }, /* @__PURE__ */ React31.createElement(
1965
+ recentPosts.map((post) => /* @__PURE__ */ React32.createElement(PostListItem2, { key: post.id, post, closePopup: popupState.close })),
1966
+ recentPosts.length === 0 && /* @__PURE__ */ React32.createElement(MenuItem5, { disabled: true }, /* @__PURE__ */ React32.createElement(
1807
1967
  ListItemText8,
1808
1968
  {
1809
1969
  primaryTypographyProps: {
1810
1970
  variant: "caption",
1811
1971
  fontStyle: "italic"
1812
1972
  },
1813
- primary: __20("There are no other pages or templates on this site yet.", "elementor")
1973
+ primary: __21("There are no other pages or templates on this site yet.", "elementor")
1814
1974
  }
1815
1975
  )),
1816
- /* @__PURE__ */ React31.createElement(Divider5, { disabled: recentPosts.length === 0 }),
1817
- /* @__PURE__ */ React31.createElement(CreatePostListItem, { closePopup: popupState.close })
1976
+ /* @__PURE__ */ React32.createElement(Divider5, { disabled: recentPosts.length === 0 }),
1977
+ /* @__PURE__ */ React32.createElement(CreatePostListItem, { closePopup: popupState.close })
1818
1978
  ));
1819
1979
  }
1820
1980
 
1821
1981
  // src/hooks/use-toggle-button-props.ts
1822
1982
  import { PagesIcon } from "@elementor/icons";
1823
- import { __ as __21 } from "@wordpress/i18n";
1983
+ import { __ as __22 } from "@wordpress/i18n";
1824
1984
  function useToggleButtonProps() {
1825
1985
  const { isOpen: selectedState, isBlocked } = usePanelStatus();
1826
1986
  const { open, close } = usePanelActions();
1827
1987
  return {
1828
- title: __21("Site content", "elementor"),
1988
+ title: __22("Site content", "elementor"),
1829
1989
  icon: PagesIcon,
1830
1990
  onClick: () => {
1831
1991
  const extendedWindow = window;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elementor/editor-site-navigation",
3
- "version": "4.5.0-1210",
3
+ "version": "4.5.0-1212",
4
4
  "private": false,
5
5
  "author": "Elementor Team",
6
6
  "homepage": "https://elementor.com/",
@@ -39,16 +39,16 @@
39
39
  "dev": "tsup --config=../../tsup.dev.ts"
40
40
  },
41
41
  "dependencies": {
42
- "@elementor/editor-app-bar": "4.5.0-1210",
43
- "@elementor/editor-documents": "4.5.0-1210",
44
- "@elementor/editor-panels": "4.5.0-1210",
45
- "@elementor/editor-sidebar": "4.5.0-1210",
46
- "@elementor/editor-ui": "4.5.0-1210",
47
- "@elementor/editor-v1-adapters": "4.5.0-1210",
48
- "@elementor/env": "4.5.0-1210",
42
+ "@elementor/editor-app-bar": "4.5.0-1212",
43
+ "@elementor/editor-documents": "4.5.0-1212",
44
+ "@elementor/editor-panels": "4.5.0-1212",
45
+ "@elementor/editor-sidebar": "4.5.0-1212",
46
+ "@elementor/editor-ui": "4.5.0-1212",
47
+ "@elementor/editor-v1-adapters": "4.5.0-1212",
48
+ "@elementor/env": "4.5.0-1212",
49
49
  "@elementor/icons": "~1.78.1",
50
- "@elementor/events": "4.5.0-1210",
51
- "@elementor/query": "4.5.0-1210",
50
+ "@elementor/events": "4.5.0-1212",
51
+ "@elementor/query": "4.5.0-1212",
52
52
  "@elementor/ui": "1.41.4",
53
53
  "@wordpress/api-fetch": "^6.42.0",
54
54
  "@wordpress/i18n": "^5.13.0"