@elementor/editor-site-navigation 4.5.0-1209 → 4.5.0-1211

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.js CHANGED
@@ -61,11 +61,11 @@ var import_editor_sidebar = require("@elementor/editor-sidebar");
61
61
  var import_editor_panels2 = require("@elementor/editor-panels");
62
62
 
63
63
  // src/components/panel/shell.tsx
64
- var React26 = __toESM(require("react"));
65
- var import_react9 = require("react");
64
+ var React27 = __toESM(require("react"));
65
+ var import_react10 = require("react");
66
66
  var import_editor_panels = require("@elementor/editor-panels");
67
- var import_ui16 = require("@elementor/ui");
68
- var import_i18n17 = require("@wordpress/i18n");
67
+ var import_ui17 = require("@elementor/ui");
68
+ var import_i18n19 = require("@wordpress/i18n");
69
69
 
70
70
  // src/contexts/content-panel-coordinator.tsx
71
71
  var React = __toESM(require("react"));
@@ -427,8 +427,8 @@ var ErrorSnackbar = ({ open, onClose }) => {
427
427
  var error_snackbar_default = ErrorSnackbar;
428
428
 
429
429
  // src/components/panel/shell-panel-body-content.tsx
430
- var React25 = __toESM(require("react"));
431
- var import_ui15 = require("@elementor/ui");
430
+ var React26 = __toESM(require("react"));
431
+ var import_ui16 = require("@elementor/ui");
432
432
 
433
433
  // src/contexts/post-list-context.tsx
434
434
  var React6 = __toESM(require("react"));
@@ -473,10 +473,10 @@ function usePostListContext() {
473
473
  }
474
474
 
475
475
  // src/components/panel/posts-list/posts-collapsible-list.tsx
476
- var React23 = __toESM(require("react"));
477
- var import_react8 = require("react");
478
- var import_ui13 = require("@elementor/ui");
479
- var import_i18n15 = require("@wordpress/i18n");
476
+ var React24 = __toESM(require("react"));
477
+ var import_react9 = require("react");
478
+ var import_ui14 = require("@elementor/ui");
479
+ var import_i18n17 = require("@wordpress/i18n");
480
480
 
481
481
  // src/hooks/use-homepage.ts
482
482
  var import_query2 = require("@elementor/query");
@@ -505,6 +505,70 @@ function useHomepage() {
505
505
  });
506
506
  }
507
507
 
508
+ // src/hooks/use-post-list-pagination.ts
509
+ var import_react4 = require("react");
510
+ function usePostListPagination({
511
+ fetchNextPage,
512
+ hasNextPage,
513
+ isFetchingNextPage,
514
+ loadedCount,
515
+ resetKey,
516
+ totalCount
517
+ }) {
518
+ const [visibleCount, setVisibleCount] = (0, import_react4.useState)(POST_PER_PAGE);
519
+ const pendingVisibleTargetRef = (0, import_react4.useRef)(null);
520
+ (0, import_react4.useEffect)(() => {
521
+ setVisibleCount(POST_PER_PAGE);
522
+ pendingVisibleTargetRef.current = null;
523
+ }, [resetKey]);
524
+ (0, import_react4.useEffect)(() => {
525
+ const target = pendingVisibleTargetRef.current;
526
+ if (target === null) {
527
+ return;
528
+ }
529
+ if (loadedCount >= target) {
530
+ setVisibleCount(target);
531
+ pendingVisibleTargetRef.current = null;
532
+ return;
533
+ }
534
+ if (!isFetchingNextPage) {
535
+ setVisibleCount(Math.min(target, loadedCount));
536
+ pendingVisibleTargetRef.current = null;
537
+ }
538
+ }, [isFetchingNextPage, loadedCount]);
539
+ const canShowLess = visibleCount > POST_PER_PAGE;
540
+ const canLoadMore = visibleCount < loadedCount || hasNextPage;
541
+ const handleLoadMore = (0, import_react4.useCallback)(() => {
542
+ if (isFetchingNextPage || !canLoadMore) {
543
+ return;
544
+ }
545
+ const targetVisible = Math.min(visibleCount + POST_PER_PAGE, totalCount);
546
+ if (targetVisible <= loadedCount) {
547
+ setVisibleCount(Math.min(targetVisible, loadedCount));
548
+ return;
549
+ }
550
+ if (hasNextPage) {
551
+ pendingVisibleTargetRef.current = targetVisible;
552
+ fetchNextPage();
553
+ return;
554
+ }
555
+ if (visibleCount < loadedCount) {
556
+ setVisibleCount(Math.min(visibleCount + POST_PER_PAGE, loadedCount));
557
+ }
558
+ }, [canLoadMore, fetchNextPage, hasNextPage, isFetchingNextPage, loadedCount, totalCount, visibleCount]);
559
+ const handleShowLess = (0, import_react4.useCallback)(() => {
560
+ pendingVisibleTargetRef.current = null;
561
+ setVisibleCount(POST_PER_PAGE);
562
+ }, []);
563
+ return {
564
+ canLoadMore,
565
+ canShowLess,
566
+ handleLoadMore,
567
+ handleShowLess,
568
+ visibleCount
569
+ };
570
+ }
571
+
508
572
  // src/hooks/use-posts.ts
509
573
  var import_query3 = require("@elementor/query");
510
574
  var postsQueryKeyBase = (postTypeSlug) => ["site-navigation", "posts", postTypeSlug];
@@ -567,7 +631,7 @@ function SectionAddButton({ onBeforeCreate }) {
567
631
 
568
632
  // src/components/panel/posts-list/collapsible-list.tsx
569
633
  var React8 = __toESM(require("react"));
570
- var import_react4 = require("react");
634
+ var import_react5 = require("react");
571
635
  var import_editor_ui = require("@elementor/editor-ui");
572
636
  var import_ui5 = require("@elementor/ui");
573
637
  var sectionHeaderListItemButtonSx = {
@@ -584,13 +648,14 @@ function getSectionHeaderAriaLabel(title, count) {
584
648
  }
585
649
  function CollapsibleList({
586
650
  count,
651
+ headerRef,
587
652
  isOpen,
588
653
  onOpenChange,
589
654
  title,
590
655
  trailingActions,
591
656
  children
592
657
  }) {
593
- const id = (0, import_react4.useId)();
658
+ const id = (0, import_react5.useId)();
594
659
  const labelId = `label-${id}`;
595
660
  const contentId = `content-${id}`;
596
661
  const sectionHeaderAriaLabel = getSectionHeaderAriaLabel(title, count);
@@ -609,6 +674,7 @@ function CollapsibleList({
609
674
  /* @__PURE__ */ React8.createElement(
610
675
  import_ui5.ListItemButton,
611
676
  {
677
+ ref: headerRef,
612
678
  id: labelId,
613
679
  "aria-controls": contentId,
614
680
  "aria-expanded": isOpen,
@@ -755,7 +821,7 @@ function useInvalidatePosts(postTypeSlug) {
755
821
 
756
822
  // src/components/panel/posts-list/list-items/edit-mode-template.tsx
757
823
  var React10 = __toESM(require("react"));
758
- var import_react5 = require("react");
824
+ var import_react6 = require("react");
759
825
  var import_icons6 = require("@elementor/icons");
760
826
  var import_ui7 = require("@elementor/ui");
761
827
  var import_i18n6 = require("@wordpress/i18n");
@@ -797,10 +863,10 @@ var editRowInputSx = {
797
863
  };
798
864
  function EditModeTemplate({ postTitle, isLoading, callback }) {
799
865
  const { resetEditMode } = usePostListContext();
800
- const [title, setTitle] = (0, import_react5.useState)(postTitle);
801
- const [touched, setTouched] = (0, import_react5.useState)(false);
802
- const [inputError, setInputError] = (0, import_react5.useState)(null);
803
- const closeButton = (0, import_react5.useRef)();
866
+ const [title, setTitle] = (0, import_react6.useState)(postTitle);
867
+ const [touched, setTouched] = (0, import_react6.useState)(false);
868
+ const [inputError, setInputError] = (0, import_react6.useState)(null);
869
+ const closeButton = (0, import_react6.useRef)();
804
870
  const onBlur = (e) => {
805
871
  if (closeButton.current === e.relatedTarget) {
806
872
  return;
@@ -1002,14 +1068,15 @@ var React21 = __toESM(require("react"));
1002
1068
  var import_editor_documents5 = require("@elementor/editor-documents");
1003
1069
  var import_icons12 = require("@elementor/icons");
1004
1070
  var import_ui12 = require("@elementor/ui");
1005
- var import_i18n14 = require("@wordpress/i18n");
1071
+ var import_i18n15 = require("@wordpress/i18n");
1006
1072
 
1007
1073
  // src/components/shared/page-title-and-status.tsx
1008
1074
  var React14 = __toESM(require("react"));
1009
1075
  var import_ui8 = require("@elementor/ui");
1076
+ var import_i18n9 = require("@wordpress/i18n");
1010
1077
 
1011
1078
  // src/hooks/use-reverse-html-entities.ts
1012
- var import_react6 = require("react");
1079
+ var import_react7 = require("react");
1013
1080
 
1014
1081
  // src/utils/post-title-plain.ts
1015
1082
  function getPostTitlePlain(renderedTitle) {
@@ -1023,31 +1090,71 @@ function getPostTitlePlain(renderedTitle) {
1023
1090
 
1024
1091
  // src/hooks/use-reverse-html-entities.ts
1025
1092
  function useReverseHtmlEntities(escapedHTML = "") {
1026
- return (0, import_react6.useMemo)(() => getPostTitlePlain(escapedHTML), [escapedHTML]);
1093
+ return (0, import_react7.useMemo)(() => getPostTitlePlain(escapedHTML), [escapedHTML]);
1027
1094
  }
1028
1095
 
1029
1096
  // src/components/shared/page-title-and-status.tsx
1097
+ function humanizeStatusSlug(status) {
1098
+ return status.replace(/[-_]+/g, " ").trim();
1099
+ }
1100
+ var statusChipConfig = {
1101
+ draft: {
1102
+ color: "default",
1103
+ label: (0, import_i18n9.__)("Draft", "elementor")
1104
+ },
1105
+ future: {
1106
+ color: "default",
1107
+ label: (0, import_i18n9.__)("Scheduled", "elementor")
1108
+ },
1109
+ pending: {
1110
+ color: "warning",
1111
+ label: (0, import_i18n9.__)("Pending Review", "elementor")
1112
+ },
1113
+ private: {
1114
+ color: "default",
1115
+ label: (0, import_i18n9.__)("Private", "elementor")
1116
+ }
1117
+ };
1118
+ function getStatusChipConfig(status) {
1119
+ const known = statusChipConfig[status];
1120
+ if (known) {
1121
+ return known;
1122
+ }
1123
+ return {
1124
+ color: "default",
1125
+ label: humanizeStatusSlug(status)
1126
+ };
1127
+ }
1128
+ function isKnownPanelStatus(status) {
1129
+ return status in statusChipConfig;
1130
+ }
1030
1131
  var PageStatus = ({ status }) => {
1031
1132
  if ("publish" === status) {
1032
1133
  return null;
1033
1134
  }
1135
+ const { color, label } = getStatusChipConfig(status);
1136
+ const isKnownStatus = isKnownPanelStatus(status);
1034
1137
  return /* @__PURE__ */ React14.createElement(
1035
- import_ui8.Typography,
1138
+ import_ui8.Chip,
1036
1139
  {
1140
+ color,
1037
1141
  component: "span",
1038
- variant: "body2",
1039
- color: "text.secondary",
1142
+ label,
1143
+ size: "tiny",
1040
1144
  sx: {
1041
- ...contentPanelListRowTitleSx,
1042
- textTransform: "capitalize",
1043
- fontStyle: "italic",
1044
- whiteSpace: "nowrap",
1045
- flexBasis: "content"
1046
- }
1047
- },
1048
- "(",
1049
- status,
1050
- ")"
1145
+ flexShrink: isKnownStatus ? 0 : 1,
1146
+ maxWidth: isKnownStatus ? void 0 : "45%",
1147
+ minWidth: 0,
1148
+ ml: 0.5,
1149
+ "& .MuiChip-label": {
1150
+ overflow: "hidden",
1151
+ textOverflow: "ellipsis",
1152
+ whiteSpace: "nowrap"
1153
+ }
1154
+ },
1155
+ title: label,
1156
+ variant: "standard"
1157
+ }
1051
1158
  );
1052
1159
  };
1053
1160
  var PageTitle = ({ title }) => {
@@ -1068,16 +1175,16 @@ var PageTitle = ({ title }) => {
1068
1175
  );
1069
1176
  };
1070
1177
  function PageTitleAndStatus({ title, status }) {
1071
- return /* @__PURE__ */ React14.createElement(import_ui8.Box, { display: "flex" }, /* @__PURE__ */ React14.createElement(PageTitle, { title }), "\xA0", /* @__PURE__ */ React14.createElement(PageStatus, { status }));
1178
+ return /* @__PURE__ */ React14.createElement(import_ui8.Box, { alignItems: "center", display: "flex", minWidth: 0 }, /* @__PURE__ */ React14.createElement(PageTitle, { title }), /* @__PURE__ */ React14.createElement(PageStatus, { status }));
1072
1179
  }
1073
1180
 
1074
1181
  // src/components/panel/actions-menu/actions/delete.tsx
1075
1182
  var React16 = __toESM(require("react"));
1076
- var import_react7 = require("react");
1183
+ var import_react8 = require("react");
1077
1184
  var import_editor_documents4 = require("@elementor/editor-documents");
1078
1185
  var import_icons7 = require("@elementor/icons");
1079
1186
  var import_ui10 = require("@elementor/ui");
1080
- var import_i18n9 = require("@wordpress/i18n");
1187
+ var import_i18n10 = require("@wordpress/i18n");
1081
1188
 
1082
1189
  // src/components/panel/actions-menu/action-menu-item.tsx
1083
1190
  var React15 = __toESM(require("react"));
@@ -1096,7 +1203,7 @@ function ActionMenuItem({ title, icon: Icon, MenuItemProps }) {
1096
1203
 
1097
1204
  // src/components/panel/actions-menu/actions/delete.tsx
1098
1205
  function Delete({ post }) {
1099
- const [isDialogOpen, setIsDialogOpen] = (0, import_react7.useState)(false);
1206
+ const [isDialogOpen, setIsDialogOpen] = (0, import_react8.useState)(false);
1100
1207
  const activeDocument = (0, import_editor_documents4.__useActiveDocument)();
1101
1208
  const isPostActive = activeDocument?.id === post.id;
1102
1209
  const userCanDelete = post.user_can.delete;
@@ -1104,7 +1211,7 @@ function Delete({ post }) {
1104
1211
  return /* @__PURE__ */ React16.createElement(React16.Fragment, null, /* @__PURE__ */ React16.createElement(
1105
1212
  ActionMenuItem,
1106
1213
  {
1107
- title: (0, import_i18n9.__)("Delete", "elementor"),
1214
+ title: (0, import_i18n10.__)("Delete", "elementor"),
1108
1215
  icon: import_icons7.TrashIcon,
1109
1216
  MenuItemProps: {
1110
1217
  disabled: isDisabled,
@@ -1121,11 +1228,11 @@ function DeleteDialog({
1121
1228
  const { type } = usePostListContext();
1122
1229
  const { deletePost } = usePostActions(type);
1123
1230
  const { setError } = usePostListContext();
1124
- const dialogTitle = (0, import_i18n9.sprintf)((0, import_i18n9.__)('Delete "%s"?', "elementor"), post.title.rendered);
1125
- const dialogBody = type === "post" ? (0, import_i18n9.__)(
1231
+ const dialogTitle = (0, import_i18n10.sprintf)((0, import_i18n10.__)('Delete "%s"?', "elementor"), post.title.rendered);
1232
+ const dialogBody = type === "post" ? (0, import_i18n10.__)(
1126
1233
  "The post and its content will be deleted forever and we won\u2019t be able to recover them.",
1127
1234
  "elementor"
1128
- ) : (0, import_i18n9.__)(
1235
+ ) : (0, import_i18n10.__)(
1129
1236
  "The page and its content will be deleted forever and we won\u2019t be able to recover them.",
1130
1237
  "elementor"
1131
1238
  );
@@ -1151,14 +1258,14 @@ function DeleteDialog({
1151
1258
  onClick: handleCancel,
1152
1259
  disabled: deletePost.isPending
1153
1260
  },
1154
- (0, import_i18n9.__)("Cancel", "elementor")
1155
- ), /* @__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))));
1261
+ (0, import_i18n10.__)("Cancel", "elementor")
1262
+ ), /* @__PURE__ */ React16.createElement(import_ui10.Button, { variant: "contained", color: "error", onClick: deletePage, disabled: deletePost.isPending }, !deletePost.isPending ? (0, import_i18n10.__)("Delete", "elementor") : /* @__PURE__ */ React16.createElement(import_ui10.CircularProgress, null))));
1156
1263
  }
1157
1264
 
1158
1265
  // src/components/panel/actions-menu/actions/duplicate.tsx
1159
1266
  var React17 = __toESM(require("react"));
1160
1267
  var import_icons8 = require("@elementor/icons");
1161
- var import_i18n10 = require("@wordpress/i18n");
1268
+ var import_i18n11 = require("@wordpress/i18n");
1162
1269
  function Duplicate({ post, popupState }) {
1163
1270
  const { setEditMode, type } = usePostListContext();
1164
1271
  const canCreate = useCanCreate(type);
@@ -1176,7 +1283,7 @@ function Duplicate({ post, popupState }) {
1176
1283
  return /* @__PURE__ */ React17.createElement(
1177
1284
  ActionMenuItem,
1178
1285
  {
1179
- title: (0, import_i18n10.__)("Duplicate", "elementor"),
1286
+ title: (0, import_i18n11.__)("Duplicate", "elementor"),
1180
1287
  icon: import_icons8.CopyIcon,
1181
1288
  MenuItemProps: {
1182
1289
  disabled: isDisabled,
@@ -1189,13 +1296,13 @@ function Duplicate({ post, popupState }) {
1189
1296
  // src/components/panel/actions-menu/actions/rename.tsx
1190
1297
  var React18 = __toESM(require("react"));
1191
1298
  var import_icons9 = require("@elementor/icons");
1192
- var import_i18n11 = require("@wordpress/i18n");
1299
+ var import_i18n12 = require("@wordpress/i18n");
1193
1300
  function Rename({ post }) {
1194
1301
  const { setEditMode } = usePostListContext();
1195
1302
  return /* @__PURE__ */ React18.createElement(
1196
1303
  ActionMenuItem,
1197
1304
  {
1198
- title: (0, import_i18n11.__)("Rename", "elementor"),
1305
+ title: (0, import_i18n12.__)("Rename", "elementor"),
1199
1306
  icon: import_icons9.EraseIcon,
1200
1307
  MenuItemProps: {
1201
1308
  disabled: !post.user_can.edit,
@@ -1216,7 +1323,7 @@ function Rename({ post }) {
1216
1323
  var React19 = __toESM(require("react"));
1217
1324
  var import_icons10 = require("@elementor/icons");
1218
1325
  var import_ui11 = require("@elementor/ui");
1219
- var import_i18n12 = require("@wordpress/i18n");
1326
+ var import_i18n13 = require("@wordpress/i18n");
1220
1327
 
1221
1328
  // src/hooks/use-homepage-actions.ts
1222
1329
  var import_query6 = require("@elementor/query");
@@ -1258,7 +1365,7 @@ function SetHome({ post, closeMenu }) {
1258
1365
  return /* @__PURE__ */ React19.createElement(
1259
1366
  ActionMenuItem,
1260
1367
  {
1261
- title: (0, import_i18n12.__)("Set as homepage", "elementor"),
1368
+ title: (0, import_i18n13.__)("Set as homepage", "elementor"),
1262
1369
  icon: !updateSettingsMutation.isPending ? import_icons10.HomeIcon : import_ui11.CircularProgress,
1263
1370
  MenuItemProps: {
1264
1371
  disabled: isDisabled,
@@ -1271,10 +1378,10 @@ function SetHome({ post, closeMenu }) {
1271
1378
  // src/components/panel/actions-menu/actions/view.tsx
1272
1379
  var React20 = __toESM(require("react"));
1273
1380
  var import_icons11 = require("@elementor/icons");
1274
- var import_i18n13 = require("@wordpress/i18n");
1381
+ var import_i18n14 = require("@wordpress/i18n");
1275
1382
  function View({ post }) {
1276
1383
  const { type } = usePostListContext();
1277
- const title = (0, import_i18n13.__)("View %s", "elementor").replace("%s", postTypesMap[type].labels.singular_name);
1384
+ const title = (0, import_i18n14.__)("View %s", "elementor").replace("%s", postTypesMap[type].labels.singular_name);
1278
1385
  return /* @__PURE__ */ React20.createElement(
1279
1386
  ActionMenuItem,
1280
1387
  {
@@ -1294,7 +1401,7 @@ var DisabledPostTooltip = ({
1294
1401
  postTypeSlug
1295
1402
  }) => {
1296
1403
  if (isDisabled) {
1297
- const title = /* @__PURE__ */ React21.createElement(import_ui12.Typography, { variant: "caption" }, getCannotEditPanelItemMessage(postTypeSlug), /* @__PURE__ */ React21.createElement("br", null), (0, import_i18n14.__)("To edit it directly, contact the site owner", "elementor"));
1404
+ const title = /* @__PURE__ */ React21.createElement(import_ui12.Typography, { variant: "caption" }, getCannotEditPanelItemMessage(postTypeSlug), /* @__PURE__ */ React21.createElement("br", null), (0, import_i18n15.__)("To edit it directly, contact the site owner", "elementor"));
1298
1405
  return /* @__PURE__ */ React21.createElement(import_ui12.Tooltip, { title, placement: "bottom", arrow: false }, /* @__PURE__ */ React21.createElement("span", null, children));
1299
1406
  }
1300
1407
  return /* @__PURE__ */ React21.createElement(React21.Fragment, null, children);
@@ -1321,7 +1428,7 @@ function ListItemView({ post }) {
1321
1428
  secondaryAction: /* @__PURE__ */ React21.createElement(
1322
1429
  import_ui12.IconButton,
1323
1430
  {
1324
- "aria-label": (0, import_i18n14.__)("More actions", "elementor"),
1431
+ "aria-label": (0, import_i18n15.__)("More actions", "elementor"),
1325
1432
  size: "tiny",
1326
1433
  ...menuTriggerProps,
1327
1434
  onClick: (event) => {
@@ -1348,7 +1455,7 @@ function ListItemView({ post }) {
1348
1455
  sx: contentPanelListItemButtonSx
1349
1456
  },
1350
1457
  /* @__PURE__ */ React21.createElement(import_ui12.ListItemText, { disableTypography: true, sx: { flex: 1, minWidth: 0 } }, /* @__PURE__ */ React21.createElement(PageTitleAndStatus, { title, status })),
1351
- post.isHome && /* @__PURE__ */ React21.createElement(import_icons12.HomeIcon, { titleAccess: (0, import_i18n14.__)("Homepage", "elementor"), color: "disabled" })
1458
+ post.isHome && /* @__PURE__ */ React21.createElement(import_icons12.HomeIcon, { titleAccess: (0, import_i18n15.__)("Homepage", "elementor"), color: "disabled" })
1352
1459
  )
1353
1460
  )), /* @__PURE__ */ React21.createElement(
1354
1461
  import_ui12.Menu,
@@ -1383,15 +1490,74 @@ function PostListItem({ post }) {
1383
1490
  return /* @__PURE__ */ React22.createElement(ListItemView, { post });
1384
1491
  }
1385
1492
 
1493
+ // src/components/panel/posts-list/post-list-pagination-actions.tsx
1494
+ var React23 = __toESM(require("react"));
1495
+ var import_editor_ui2 = require("@elementor/editor-ui");
1496
+ var import_ui13 = require("@elementor/ui");
1497
+ var import_i18n16 = require("@wordpress/i18n");
1498
+ var listPaginationButtonProps = {
1499
+ color: "secondary",
1500
+ size: "small",
1501
+ variant: "outlined"
1502
+ };
1503
+ function PostListPaginationActions({
1504
+ canLoadMore,
1505
+ canShowLess,
1506
+ isLoadingMore,
1507
+ loadMoreButtonRef,
1508
+ onLoadMore,
1509
+ onShowLess
1510
+ }) {
1511
+ if (!canLoadMore && !canShowLess) {
1512
+ return null;
1513
+ }
1514
+ const loadMoreLabel = (0, import_i18n16.__)("Load more", "elementor");
1515
+ const showLessLabel = (0, import_i18n16.__)("Show less", "elementor");
1516
+ const loadMoreButton = /* @__PURE__ */ React23.createElement(
1517
+ import_ui13.Button,
1518
+ {
1519
+ ...listPaginationButtonProps,
1520
+ ref: loadMoreButtonRef,
1521
+ "aria-label": loadMoreLabel,
1522
+ disabled: isLoadingMore,
1523
+ endIcon: isLoadingMore ? void 0 : /* @__PURE__ */ React23.createElement(import_editor_ui2.CollapseIcon, { open: false }),
1524
+ fullWidth: true,
1525
+ onClick: onLoadMore,
1526
+ sx: { flex: 1, my: 0.5 }
1527
+ },
1528
+ isLoadingMore ? /* @__PURE__ */ React23.createElement(import_ui13.CircularProgress, { size: 20 }) : loadMoreLabel
1529
+ );
1530
+ const showLessButton = /* @__PURE__ */ React23.createElement(
1531
+ import_ui13.Button,
1532
+ {
1533
+ ...listPaginationButtonProps,
1534
+ "aria-label": showLessLabel,
1535
+ endIcon: /* @__PURE__ */ React23.createElement(import_editor_ui2.CollapseIcon, { open: true }),
1536
+ fullWidth: true,
1537
+ onClick: onShowLess,
1538
+ sx: { flex: 1, my: 0.5 }
1539
+ },
1540
+ showLessLabel
1541
+ );
1542
+ if (canShowLess && canLoadMore) {
1543
+ return /* @__PURE__ */ React23.createElement(import_ui13.Box, { sx: { px: 2, width: "100%" } }, /* @__PURE__ */ React23.createElement(import_ui13.Stack, { direction: "row", spacing: 1 }, showLessButton, loadMoreButton));
1544
+ }
1545
+ return /* @__PURE__ */ React23.createElement(import_ui13.Box, { sx: { px: 2, width: "100%" } }, canShowLess ? showLessButton : loadMoreButton);
1546
+ }
1547
+
1386
1548
  // src/components/panel/posts-list/posts-collapsible-list.tsx
1387
1549
  var SEARCH_DEBOUNCE_MS = 300;
1388
1550
  function PostsCollapsibleList({ isOpenByDefault = false }) {
1389
1551
  const { type, editMode, setEditMode } = usePostListContext();
1390
1552
  const { registerSection, unregisterSection, searchQuery } = useContentPanelCoordinator();
1391
- const [isOpen, setIsOpen] = (0, import_react8.useState)(isOpenByDefault);
1553
+ const [isOpen, setIsOpen] = (0, import_react9.useState)(isOpenByDefault);
1392
1554
  const trimmedSearch = searchQuery.trim();
1393
- const [debouncedSearch, setDebouncedSearch] = (0, import_react8.useState)(trimmedSearch);
1394
- (0, import_react8.useEffect)(() => {
1555
+ const [debouncedSearch, setDebouncedSearch] = (0, import_react9.useState)(trimmedSearch);
1556
+ const focusAfterShowLessRef = (0, import_react9.useRef)(false);
1557
+ const listTopRef = (0, import_react9.useRef)(null);
1558
+ const loadMoreButtonRef = (0, import_react9.useRef)(null);
1559
+ const sectionHeaderRef = (0, import_react9.useRef)(null);
1560
+ (0, import_react9.useEffect)(() => {
1395
1561
  const handle = window.setTimeout(() => setDebouncedSearch(trimmedSearch), SEARCH_DEBOUNCE_MS);
1396
1562
  return () => window.clearTimeout(handle);
1397
1563
  }, [trimmedSearch]);
@@ -1405,14 +1571,14 @@ function PostsCollapsibleList({ isOpenByDefault = false }) {
1405
1571
  } = usePosts(type, debouncedSearch);
1406
1572
  const { data: homepageId } = useHomepage();
1407
1573
  const isPageType = type === "page";
1408
- (0, import_react8.useEffect)(() => {
1574
+ (0, import_react9.useEffect)(() => {
1409
1575
  registerSection(type, {
1410
1576
  setExpanded: setIsOpen,
1411
1577
  startCreate: () => setEditMode({ mode: "create", details: {} })
1412
1578
  });
1413
1579
  return () => unregisterSection(type);
1414
1580
  }, [registerSection, unregisterSection, type, setEditMode]);
1415
- const filteredPosts = (0, import_react8.useMemo)(() => {
1581
+ const filteredPosts = (0, import_react9.useMemo)(() => {
1416
1582
  if (!posts) {
1417
1583
  return [];
1418
1584
  }
@@ -1428,53 +1594,88 @@ function PostsCollapsibleList({ isOpenByDefault = false }) {
1428
1594
  }) : mappedPosts;
1429
1595
  return sorted;
1430
1596
  }, [posts, isPageType, homepageId]);
1431
- (0, import_react8.useEffect)(() => {
1597
+ const pagination = usePostListPagination({
1598
+ fetchNextPage,
1599
+ hasNextPage,
1600
+ isFetchingNextPage,
1601
+ loadedCount: filteredPosts.length,
1602
+ resetKey: `${type}:${debouncedSearch}`,
1603
+ totalCount: total
1604
+ });
1605
+ const displayedPosts = (0, import_react9.useMemo)(
1606
+ () => filteredPosts.slice(0, pagination.visibleCount),
1607
+ [filteredPosts, pagination.visibleCount]
1608
+ );
1609
+ const handleShowLess = () => {
1610
+ focusAfterShowLessRef.current = true;
1611
+ pagination.handleShowLess();
1612
+ const listTop = listTopRef.current;
1613
+ if (listTop && typeof listTop.scrollIntoView === "function") {
1614
+ listTop.scrollIntoView({ block: "nearest" });
1615
+ }
1616
+ };
1617
+ (0, import_react9.useEffect)(() => {
1618
+ if (!focusAfterShowLessRef.current) {
1619
+ return;
1620
+ }
1621
+ focusAfterShowLessRef.current = false;
1622
+ const loadMoreButton = loadMoreButtonRef.current;
1623
+ if (loadMoreButton) {
1624
+ loadMoreButton.focus();
1625
+ return;
1626
+ }
1627
+ sectionHeaderRef.current?.focus();
1628
+ }, [pagination.canLoadMore, pagination.visibleCount]);
1629
+ (0, import_react9.useEffect)(() => {
1432
1630
  if (debouncedSearch && filteredPosts.length > 0) {
1433
1631
  setIsOpen(true);
1434
1632
  }
1435
1633
  }, [debouncedSearch, filteredPosts.length]);
1436
1634
  if (postsError) {
1437
- return /* @__PURE__ */ React23.createElement(ErrorState, null);
1635
+ return /* @__PURE__ */ React24.createElement(ErrorState, null);
1438
1636
  }
1439
1637
  if (postsPending && !posts?.length) {
1440
- return /* @__PURE__ */ React23.createElement(import_ui13.Box, { sx: { px: 2 } }, /* @__PURE__ */ React23.createElement(import_ui13.Box, null, /* @__PURE__ */ React23.createElement(import_ui13.Skeleton, { sx: { my: 3 }, animation: "wave", variant: "rounded", width: "100%", height: "24px" }), /* @__PURE__ */ React23.createElement(import_ui13.Skeleton, { sx: { my: 3 }, animation: "wave", variant: "rounded", width: "70%", height: "24px" }), /* @__PURE__ */ React23.createElement(import_ui13.Skeleton, { sx: { my: 3 }, animation: "wave", variant: "rounded", width: "70%", height: "24px" }), /* @__PURE__ */ React23.createElement(import_ui13.Skeleton, { sx: { my: 3 }, animation: "wave", variant: "rounded", width: "70%", height: "24px" })));
1638
+ return /* @__PURE__ */ React24.createElement(import_ui14.Box, { sx: { px: 2 } }, /* @__PURE__ */ React24.createElement(import_ui14.Box, null, /* @__PURE__ */ React24.createElement(import_ui14.Skeleton, { sx: { my: 3 }, animation: "wave", variant: "rounded", width: "100%", height: "24px" }), /* @__PURE__ */ React24.createElement(import_ui14.Skeleton, { sx: { my: 3 }, animation: "wave", variant: "rounded", width: "70%", height: "24px" }), /* @__PURE__ */ React24.createElement(import_ui14.Skeleton, { sx: { my: 3 }, animation: "wave", variant: "rounded", width: "70%", height: "24px" }), /* @__PURE__ */ React24.createElement(import_ui14.Skeleton, { sx: { my: 3 }, animation: "wave", variant: "rounded", width: "70%", height: "24px" })));
1441
1639
  }
1442
1640
  const displayCount = total;
1443
1641
  const sectionTitle = postTypesMap[type].labels.plural_name;
1444
1642
  const showNoResults = debouncedSearch && filteredPosts.length === 0;
1445
- return /* @__PURE__ */ React23.createElement(
1643
+ return /* @__PURE__ */ React24.createElement(
1446
1644
  CollapsibleList,
1447
1645
  {
1448
1646
  count: displayCount,
1647
+ headerRef: sectionHeaderRef,
1449
1648
  isOpen,
1450
1649
  onOpenChange: setIsOpen,
1451
1650
  title: sectionTitle,
1452
- trailingActions: /* @__PURE__ */ React23.createElement(SectionAddButton, { onBeforeCreate: () => setIsOpen(true) })
1651
+ trailingActions: /* @__PURE__ */ React24.createElement(SectionAddButton, { onBeforeCreate: () => setIsOpen(true) })
1453
1652
  },
1454
- showNoResults && /* @__PURE__ */ React23.createElement(import_ui13.Box, { sx: { py: 2, px: 2 } }, /* @__PURE__ */ React23.createElement(import_ui13.Typography, { variant: "body2", color: "text.secondary" }, (0, import_i18n15.__)("No results found", "elementor"))),
1455
- filteredPosts.map((post) => {
1456
- return /* @__PURE__ */ React23.createElement(PostListItem, { key: post.id, post });
1653
+ showNoResults && /* @__PURE__ */ React24.createElement(import_ui14.Box, { sx: { py: 2, px: 2 } }, /* @__PURE__ */ React24.createElement(import_ui14.Typography, { variant: "body2", color: "text.secondary" }, (0, import_i18n17.__)("No results found", "elementor"))),
1654
+ /* @__PURE__ */ React24.createElement(import_ui14.Box, { ref: listTopRef }),
1655
+ displayedPosts.map((post) => {
1656
+ return /* @__PURE__ */ React24.createElement(PostListItem, { key: post.id, post });
1457
1657
  }),
1458
- ["duplicate", "create"].includes(editMode.mode) && /* @__PURE__ */ React23.createElement(PostListItem, null),
1459
- hasNextPage && /* @__PURE__ */ React23.createElement(
1460
- import_ui13.Box,
1658
+ ["duplicate", "create"].includes(editMode.mode) && /* @__PURE__ */ React24.createElement(PostListItem, null),
1659
+ /* @__PURE__ */ React24.createElement(
1660
+ PostListPaginationActions,
1461
1661
  {
1462
- sx: {
1463
- display: "flex",
1464
- justifyContent: "center"
1465
- }
1466
- },
1467
- /* @__PURE__ */ React23.createElement(import_ui13.Button, { onClick: fetchNextPage, color: "secondary" }, isFetchingNextPage ? /* @__PURE__ */ React23.createElement(import_ui13.CircularProgress, null) : (0, import_i18n15.__)("Load more", "elementor"))
1662
+ canLoadMore: pagination.canLoadMore,
1663
+ canShowLess: pagination.canShowLess,
1664
+ isLoadingMore: isFetchingNextPage,
1665
+ loadMoreButtonRef,
1666
+ onLoadMore: pagination.handleLoadMore,
1667
+ onShowLess: handleShowLess
1668
+ }
1468
1669
  )
1469
1670
  );
1470
1671
  }
1471
1672
 
1472
1673
  // src/components/panel/user-load-error.tsx
1473
- var React24 = __toESM(require("react"));
1474
- var import_ui14 = require("@elementor/ui");
1475
- var import_i18n16 = require("@wordpress/i18n");
1674
+ var React25 = __toESM(require("react"));
1675
+ var import_ui15 = require("@elementor/ui");
1676
+ var import_i18n18 = require("@wordpress/i18n");
1476
1677
  function UserLoadError() {
1477
- return /* @__PURE__ */ React24.createElement(import_ui14.Box, { sx: { px: 2, py: 2 } }, /* @__PURE__ */ React24.createElement(import_ui14.Typography, { variant: "body2", color: "text.secondary" }, (0, import_i18n16.__)(
1678
+ return /* @__PURE__ */ React25.createElement(import_ui15.Box, { sx: { px: 2, py: 2 } }, /* @__PURE__ */ React25.createElement(import_ui15.Typography, { variant: "body2", color: "text.secondary" }, (0, import_i18n18.__)(
1478
1679
  "We couldn\u2019t load your content permissions. Try closing and reopening this panel.",
1479
1680
  "elementor"
1480
1681
  )));
@@ -1488,20 +1689,20 @@ function ShellPanelBodyContent({
1488
1689
  showUserLoadError
1489
1690
  }) {
1490
1691
  if (isUserPending) {
1491
- return /* @__PURE__ */ React25.createElement(import_ui15.Stack, { spacing: 1, sx: { px: 2, py: 1 } }, /* @__PURE__ */ React25.createElement(import_ui15.Skeleton, { animation: "wave", height: 28, variant: "rounded", width: "100%" }), /* @__PURE__ */ React25.createElement(import_ui15.Skeleton, { animation: "wave", height: 28, variant: "rounded", width: "80%" }));
1692
+ return /* @__PURE__ */ React26.createElement(import_ui16.Stack, { spacing: 1, sx: { px: 2, py: 1 } }, /* @__PURE__ */ React26.createElement(import_ui16.Skeleton, { animation: "wave", height: 28, variant: "rounded", width: "100%" }), /* @__PURE__ */ React26.createElement(import_ui16.Skeleton, { animation: "wave", height: 28, variant: "rounded", width: "80%" }));
1492
1693
  }
1493
1694
  if (showUserLoadError) {
1494
- return /* @__PURE__ */ React25.createElement(UserLoadError, null);
1695
+ return /* @__PURE__ */ React26.createElement(UserLoadError, null);
1495
1696
  }
1496
- return /* @__PURE__ */ React25.createElement(import_ui15.List, { 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 }))));
1697
+ return /* @__PURE__ */ React26.createElement(import_ui16.List, { 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 }))));
1497
1698
  }
1498
1699
 
1499
1700
  // src/components/panel/shell.tsx
1500
1701
  var Shell = () => {
1501
- const [isErrorSnackbarOpen, setIsErrorSnackbarOpen] = (0, import_react9.useState)(false);
1702
+ const [isErrorSnackbarOpen, setIsErrorSnackbarOpen] = (0, import_react10.useState)(false);
1502
1703
  const { accessiblePostTypes, isUserPending, showUserLoadError } = useAccessiblePanelPostTypes();
1503
- return /* @__PURE__ */ React26.createElement(ContentPanelCoordinatorProvider, null, /* @__PURE__ */ React26.createElement(import_editor_panels.Panel, null, /* @__PURE__ */ React26.createElement(import_editor_panels.PanelHeader, null, /* @__PURE__ */ React26.createElement(
1504
- import_ui16.Stack,
1704
+ return /* @__PURE__ */ React27.createElement(ContentPanelCoordinatorProvider, null, /* @__PURE__ */ React27.createElement(import_editor_panels.Panel, null, /* @__PURE__ */ React27.createElement(import_editor_panels.PanelHeader, null, /* @__PURE__ */ React27.createElement(
1705
+ import_ui17.Stack,
1505
1706
  {
1506
1707
  alignItems: "center",
1507
1708
  direction: "row",
@@ -1510,9 +1711,9 @@ var Shell = () => {
1510
1711
  ...contentPanelHeaderStackSx
1511
1712
  }
1512
1713
  },
1513
- /* @__PURE__ */ React26.createElement(import_editor_panels.PanelHeaderTitle, { sx: { flex: 1, minWidth: 0, textAlign: "start" } }, (0, import_i18n17.__)("Site content", "elementor")),
1514
- /* @__PURE__ */ React26.createElement(ContentPanelHeaderAdd, null)
1515
- )), /* @__PURE__ */ React26.createElement(import_ui16.Divider, null), /* @__PURE__ */ React26.createElement(import_editor_panels.PanelBody, null, /* @__PURE__ */ React26.createElement(ContentPanelSearch, null), /* @__PURE__ */ React26.createElement(
1714
+ /* @__PURE__ */ React27.createElement(import_editor_panels.PanelHeaderTitle, { sx: { flex: 1, minWidth: 0, textAlign: "start" } }, (0, import_i18n19.__)("Site content", "elementor")),
1715
+ /* @__PURE__ */ React27.createElement(ContentPanelHeaderAdd, null)
1716
+ )), /* @__PURE__ */ React27.createElement(import_ui17.Divider, null), /* @__PURE__ */ React27.createElement(import_editor_panels.PanelBody, null, /* @__PURE__ */ React27.createElement(ContentPanelSearch, null), /* @__PURE__ */ React27.createElement(
1516
1717
  ShellPanelBodyContent,
1517
1718
  {
1518
1719
  accessiblePostTypes,
@@ -1520,7 +1721,7 @@ var Shell = () => {
1520
1721
  onListError: () => setIsErrorSnackbarOpen(true),
1521
1722
  showUserLoadError
1522
1723
  }
1523
- ), /* @__PURE__ */ React26.createElement(error_snackbar_default, { open: isErrorSnackbarOpen, onClose: () => setIsErrorSnackbarOpen(false) }))));
1724
+ ), /* @__PURE__ */ React27.createElement(error_snackbar_default, { open: isErrorSnackbarOpen, onClose: () => setIsErrorSnackbarOpen(false) }))));
1524
1725
  };
1525
1726
  var shell_default = Shell;
1526
1727
 
@@ -1531,26 +1732,26 @@ var { panel, usePanelStatus, usePanelActions } = (0, import_editor_panels2.creat
1531
1732
  });
1532
1733
 
1533
1734
  // src/components/top-bar/recently-edited.tsx
1534
- var React31 = __toESM(require("react"));
1735
+ var React32 = __toESM(require("react"));
1535
1736
  var import_editor_documents8 = require("@elementor/editor-documents");
1536
1737
  var import_icons15 = require("@elementor/icons");
1537
- var import_ui21 = require("@elementor/ui");
1538
- var import_i18n19 = require("@wordpress/i18n");
1738
+ var import_ui22 = require("@elementor/ui");
1739
+ var import_i18n21 = require("@wordpress/i18n");
1539
1740
 
1540
1741
  // src/components/top-bar/create-post-list-item.tsx
1541
- var React27 = __toESM(require("react"));
1742
+ var React28 = __toESM(require("react"));
1542
1743
  var import_editor_documents6 = require("@elementor/editor-documents");
1543
1744
  var import_events = require("@elementor/events");
1544
1745
  var import_icons13 = require("@elementor/icons");
1545
- var import_ui17 = require("@elementor/ui");
1546
- var import_i18n18 = require("@wordpress/i18n");
1746
+ var import_ui18 = require("@elementor/ui");
1747
+ var import_i18n20 = require("@wordpress/i18n");
1547
1748
 
1548
1749
  // src/hooks/use-create-page.ts
1549
- var import_react10 = require("react");
1750
+ var import_react11 = require("react");
1550
1751
  var import_api_fetch5 = __toESM(require("@wordpress/api-fetch"));
1551
1752
  var endpointPath = "/elementor/v1/site-navigation/add-new-post";
1552
1753
  function useCreatePage() {
1553
- const [isLoading, setIsLoading] = (0, import_react10.useState)(false);
1754
+ const [isLoading, setIsLoading] = (0, import_react11.useState)(false);
1554
1755
  return {
1555
1756
  create: () => {
1556
1757
  setIsLoading(true);
@@ -1573,8 +1774,8 @@ function CreatePostListItem({ closePopup, ...props }) {
1573
1774
  const navigateToDocument = (0, import_editor_documents6.__useNavigateToDocument)();
1574
1775
  const { data: user } = useUser();
1575
1776
  const { dispatchEvent, config } = (0, import_events.useMixpanel)();
1576
- return /* @__PURE__ */ React27.createElement(
1577
- import_ui17.MenuItem,
1777
+ return /* @__PURE__ */ React28.createElement(
1778
+ import_ui18.MenuItem,
1578
1779
  {
1579
1780
  disabled: isLoading || !user?.capabilities?.edit_pages,
1580
1781
  onClick: async () => {
@@ -1597,26 +1798,26 @@ function CreatePostListItem({ closePopup, ...props }) {
1597
1798
  },
1598
1799
  ...props
1599
1800
  },
1600
- /* @__PURE__ */ React27.createElement(import_ui17.ListItemIcon, null, isLoading ? /* @__PURE__ */ React27.createElement(import_ui17.CircularProgress, { size: "1.25rem" }) : /* @__PURE__ */ React27.createElement(import_icons13.PlusIcon, { fontSize: "small" })),
1601
- /* @__PURE__ */ React27.createElement(
1602
- import_ui17.ListItemText,
1801
+ /* @__PURE__ */ React28.createElement(import_ui18.ListItemIcon, null, isLoading ? /* @__PURE__ */ React28.createElement(import_ui18.CircularProgress, { size: "1.25rem" }) : /* @__PURE__ */ React28.createElement(import_icons13.PlusIcon, { fontSize: "small" })),
1802
+ /* @__PURE__ */ React28.createElement(
1803
+ import_ui18.ListItemText,
1603
1804
  {
1604
1805
  primaryTypographyProps: { variant: "body2" },
1605
- primary: (0, import_i18n18.__)("Add new page", "elementor")
1806
+ primary: (0, import_i18n20.__)("Add new page", "elementor")
1606
1807
  }
1607
1808
  )
1608
1809
  );
1609
1810
  }
1610
1811
 
1611
1812
  // src/components/top-bar/indicator.tsx
1612
- var React28 = __toESM(require("react"));
1613
- var import_ui18 = require("@elementor/ui");
1813
+ var React29 = __toESM(require("react"));
1814
+ var import_ui19 = require("@elementor/ui");
1614
1815
  function Indicator({ title, status }) {
1615
- return /* @__PURE__ */ React28.createElement(Tooltip2, { title }, /* @__PURE__ */ React28.createElement(import_ui18.Stack, { component: "span", direction: "row", alignItems: "center", spacing: 0.5 }, /* @__PURE__ */ React28.createElement(import_ui18.Typography, { component: "span", variant: "body2", sx: { maxWidth: "120px" }, noWrap: true }, title), status.value !== "publish" && /* @__PURE__ */ React28.createElement(import_ui18.Typography, { component: "span", variant: "body2", sx: { fontStyle: "italic" } }, "(", status.label, ")")));
1816
+ return /* @__PURE__ */ React29.createElement(Tooltip2, { title }, /* @__PURE__ */ React29.createElement(import_ui19.Stack, { component: "span", direction: "row", alignItems: "center", spacing: 0.5 }, /* @__PURE__ */ React29.createElement(import_ui19.Typography, { component: "span", variant: "body2", sx: { maxWidth: "120px" }, noWrap: true }, title), status.value !== "publish" && /* @__PURE__ */ React29.createElement(import_ui19.Typography, { component: "span", variant: "body2", sx: { fontStyle: "italic" } }, "(", status.label, ")")));
1616
1817
  }
1617
1818
  function Tooltip2(props) {
1618
- return /* @__PURE__ */ React28.createElement(
1619
- import_ui18.Tooltip,
1819
+ return /* @__PURE__ */ React29.createElement(
1820
+ import_ui19.Tooltip,
1620
1821
  {
1621
1822
  PopperProps: {
1622
1823
  sx: {
@@ -1631,21 +1832,21 @@ function Tooltip2(props) {
1631
1832
  }
1632
1833
 
1633
1834
  // src/components/top-bar/post-list-item.tsx
1634
- var React30 = __toESM(require("react"));
1835
+ var React31 = __toESM(require("react"));
1635
1836
  var import_editor_documents7 = require("@elementor/editor-documents");
1636
1837
  var import_events2 = require("@elementor/events");
1637
- var import_ui20 = require("@elementor/ui");
1838
+ var import_ui21 = require("@elementor/ui");
1638
1839
 
1639
1840
  // src/components/top-bar/chip-doc-type.tsx
1640
- var React29 = __toESM(require("react"));
1841
+ var React30 = __toESM(require("react"));
1641
1842
  var import_icons14 = require("@elementor/icons");
1642
- var import_ui19 = require("@elementor/ui");
1843
+ var import_ui20 = require("@elementor/ui");
1643
1844
  var iconsMap2 = getIconsMap();
1644
1845
  function DocTypeChip({ postType, docType, label }) {
1645
1846
  const color = "elementor_library" === postType ? "global" : "accent";
1646
1847
  const Icon = iconsMap2[docType] || import_icons14.PostTypeIcon;
1647
- return /* @__PURE__ */ React29.createElement(
1648
- import_ui19.Chip,
1848
+ return /* @__PURE__ */ React30.createElement(
1849
+ import_ui20.Chip,
1649
1850
  {
1650
1851
  component: "span",
1651
1852
  size: "small",
@@ -1653,7 +1854,7 @@ function DocTypeChip({ postType, docType, label }) {
1653
1854
  label,
1654
1855
  "data-value": docType,
1655
1856
  color,
1656
- icon: /* @__PURE__ */ React29.createElement(Icon, null),
1857
+ icon: /* @__PURE__ */ React30.createElement(Icon, null),
1657
1858
  sx: { ml: 1, cursor: "inherit" }
1658
1859
  }
1659
1860
  );
@@ -1664,8 +1865,8 @@ function PostListItem2({ post, closePopup, ...props }) {
1664
1865
  const navigateToDocument = (0, import_editor_documents7.__useNavigateToDocument)();
1665
1866
  const postTitle = useReverseHtmlEntities(post.title);
1666
1867
  const { dispatchEvent, config } = (0, import_events2.useMixpanel)();
1667
- return /* @__PURE__ */ React30.createElement(
1668
- import_ui20.MenuItem,
1868
+ return /* @__PURE__ */ React31.createElement(
1869
+ import_ui21.MenuItem,
1669
1870
  {
1670
1871
  disabled: !post.user_can.edit,
1671
1872
  onClick: async () => {
@@ -1687,15 +1888,15 @@ function PostListItem2({ post, closePopup, ...props }) {
1687
1888
  },
1688
1889
  ...props
1689
1890
  },
1690
- /* @__PURE__ */ React30.createElement(
1691
- import_ui20.ListItemText,
1891
+ /* @__PURE__ */ React31.createElement(
1892
+ import_ui21.ListItemText,
1692
1893
  {
1693
1894
  sx: { flexGrow: 0 },
1694
1895
  primaryTypographyProps: { variant: "body2", noWrap: true },
1695
1896
  primary: postTitle
1696
1897
  }
1697
1898
  ),
1698
- /* @__PURE__ */ React30.createElement(DocTypeChip, { postType: post.type.post_type, docType: post.type.doc_type, label: post.type.label })
1899
+ /* @__PURE__ */ React31.createElement(DocTypeChip, { postType: post.type.post_type, docType: post.type.doc_type, label: post.type.label })
1699
1900
  );
1700
1901
  }
1701
1902
 
@@ -1712,7 +1913,7 @@ function RecentlyEdited() {
1712
1913
  return data.filter((post) => post.id !== document2?.id).splice(0, NUMBER_OF_RECENT_POSTS - 1);
1713
1914
  };
1714
1915
  const recentPosts = getRecentPosts();
1715
- const popupState = (0, import_ui21.usePopupState)({
1916
+ const popupState = (0, import_ui22.usePopupState)({
1716
1917
  variant: "popover",
1717
1918
  popupId: "elementor-v2-top-bar-recently-edited"
1718
1919
  });
@@ -1720,13 +1921,13 @@ function RecentlyEdited() {
1720
1921
  if (!document2) {
1721
1922
  return null;
1722
1923
  }
1723
- const buttonProps = (0, import_ui21.bindTrigger)(popupState);
1724
- return /* @__PURE__ */ React31.createElement(React31.Fragment, null, /* @__PURE__ */ React31.createElement(
1725
- import_ui21.Button,
1924
+ const buttonProps = (0, import_ui22.bindTrigger)(popupState);
1925
+ return /* @__PURE__ */ React32.createElement(React32.Fragment, null, /* @__PURE__ */ React32.createElement(
1926
+ import_ui22.Button,
1726
1927
  {
1727
1928
  color: "inherit",
1728
1929
  size: "small",
1729
- endIcon: /* @__PURE__ */ React31.createElement(import_icons15.ChevronDownIcon, { fontSize: "small" }),
1930
+ endIcon: /* @__PURE__ */ React32.createElement(import_icons15.ChevronDownIcon, { fontSize: "small" }),
1730
1931
  ...buttonProps,
1731
1932
  onClick: (e) => {
1732
1933
  const extendedWindow = window;
@@ -1745,40 +1946,40 @@ function RecentlyEdited() {
1745
1946
  buttonProps.onClick(e);
1746
1947
  }
1747
1948
  },
1748
- /* @__PURE__ */ React31.createElement(Indicator, { title: documentTitle, status: document2.status })
1749
- ), /* @__PURE__ */ React31.createElement(
1750
- import_ui21.Menu,
1949
+ /* @__PURE__ */ React32.createElement(Indicator, { title: documentTitle, status: document2.status })
1950
+ ), /* @__PURE__ */ React32.createElement(
1951
+ import_ui22.Menu,
1751
1952
  {
1752
1953
  MenuListProps: {
1753
- subheader: /* @__PURE__ */ React31.createElement(import_ui21.ListSubheader, { sx: { color: "accent.main", fontStyle: "italic", fontWeight: "300" } }, (0, import_i18n19.__)("Recent", "elementor"))
1954
+ subheader: /* @__PURE__ */ React32.createElement(import_ui22.ListSubheader, { sx: { color: "accent.main", fontStyle: "italic", fontWeight: "300" } }, (0, import_i18n21.__)("Recent", "elementor"))
1754
1955
  },
1755
1956
  PaperProps: { sx: { mt: 2.5, width: 320 } },
1756
- ...(0, import_ui21.bindMenu)(popupState)
1957
+ ...(0, import_ui22.bindMenu)(popupState)
1757
1958
  },
1758
- recentPosts.map((post) => /* @__PURE__ */ React31.createElement(PostListItem2, { key: post.id, post, closePopup: popupState.close })),
1759
- recentPosts.length === 0 && /* @__PURE__ */ React31.createElement(import_ui21.MenuItem, { disabled: true }, /* @__PURE__ */ React31.createElement(
1760
- import_ui21.ListItemText,
1959
+ recentPosts.map((post) => /* @__PURE__ */ React32.createElement(PostListItem2, { key: post.id, post, closePopup: popupState.close })),
1960
+ recentPosts.length === 0 && /* @__PURE__ */ React32.createElement(import_ui22.MenuItem, { disabled: true }, /* @__PURE__ */ React32.createElement(
1961
+ import_ui22.ListItemText,
1761
1962
  {
1762
1963
  primaryTypographyProps: {
1763
1964
  variant: "caption",
1764
1965
  fontStyle: "italic"
1765
1966
  },
1766
- primary: (0, import_i18n19.__)("There are no other pages or templates on this site yet.", "elementor")
1967
+ primary: (0, import_i18n21.__)("There are no other pages or templates on this site yet.", "elementor")
1767
1968
  }
1768
1969
  )),
1769
- /* @__PURE__ */ React31.createElement(import_ui21.Divider, { disabled: recentPosts.length === 0 }),
1770
- /* @__PURE__ */ React31.createElement(CreatePostListItem, { closePopup: popupState.close })
1970
+ /* @__PURE__ */ React32.createElement(import_ui22.Divider, { disabled: recentPosts.length === 0 }),
1971
+ /* @__PURE__ */ React32.createElement(CreatePostListItem, { closePopup: popupState.close })
1771
1972
  ));
1772
1973
  }
1773
1974
 
1774
1975
  // src/hooks/use-toggle-button-props.ts
1775
1976
  var import_icons16 = require("@elementor/icons");
1776
- var import_i18n20 = require("@wordpress/i18n");
1977
+ var import_i18n22 = require("@wordpress/i18n");
1777
1978
  function useToggleButtonProps() {
1778
1979
  const { isOpen: selectedState, isBlocked } = usePanelStatus();
1779
1980
  const { open, close } = usePanelActions();
1780
1981
  return {
1781
- title: (0, import_i18n20.__)("Site content", "elementor"),
1982
+ title: (0, import_i18n22.__)("Site content", "elementor"),
1782
1983
  icon: import_icons16.PagesIcon,
1783
1984
  onClick: () => {
1784
1985
  const extendedWindow = window;