@elementor/editor-site-navigation 4.5.0-1234 → 4.5.0-1235

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (27) hide show
  1. package/dist/index.d.mts +83 -15
  2. package/dist/index.d.ts +83 -15
  3. package/dist/index.js +975 -822
  4. package/dist/index.mjs +938 -800
  5. package/package.json +12 -12
  6. package/src/components/panel/content-panel-active-filters.tsx +2 -2
  7. package/src/components/panel/content-panel-chrome.ts +47 -21
  8. package/src/components/panel/content-panel-search.tsx +9 -4
  9. package/src/components/panel/{content-panel-toolbar.tsx → content-panel-section-toolbar.tsx} +9 -2
  10. package/src/components/panel/content-panel-sort-list.tsx +2 -2
  11. package/src/components/panel/content-panel-sort.tsx +2 -2
  12. package/src/components/panel/content-panel-status-filter-list.tsx +25 -10
  13. package/src/components/panel/content-panel-status-filter.tsx +2 -2
  14. package/src/components/panel/posts-list/collapsible-list.tsx +3 -0
  15. package/src/components/panel/posts-list/list-items/edit-mode-template.tsx +6 -0
  16. package/src/components/panel/posts-list/list-items/list-item-create.tsx +1 -0
  17. package/src/components/panel/posts-list/list-items/list-item-duplicate.tsx +1 -0
  18. package/src/components/panel/posts-list/list-items/list-item-view.tsx +15 -3
  19. package/src/components/panel/posts-list/posts-collapsible-list.tsx +42 -18
  20. package/src/components/panel/shell.tsx +0 -3
  21. package/src/components/shared/page-title-and-status.tsx +4 -3
  22. package/src/contexts/content-panel-coordinator.tsx +2 -65
  23. package/src/contexts/site-content-section-toolbar.tsx +61 -0
  24. package/src/hooks/use-homepage-actions.ts +12 -1
  25. package/src/hooks/use-site-content-section-list-controls.ts +64 -0
  26. package/src/index.ts +28 -1
  27. package/src/site-content-status-filter.ts +11 -0
package/dist/index.mjs CHANGED
@@ -30,7 +30,7 @@ import { isSidebarEnabled as isSidebarEnabled2, sidebarTools } from "@elementor/
30
30
  import { createPanel } from "@elementor/editor-panels";
31
31
 
32
32
  // src/components/panel/shell.tsx
33
- import * as React38 from "react";
33
+ import * as React39 from "react";
34
34
  import { useState as useState10 } from "react";
35
35
  import { Panel, PanelBody, PanelHeader, PanelHeaderTitle } from "@elementor/editor-panels";
36
36
  import { isSidebarEnabled } from "@elementor/editor-sidebar";
@@ -39,120 +39,10 @@ import { __ as __28 } from "@wordpress/i18n";
39
39
 
40
40
  // src/contexts/content-panel-coordinator.tsx
41
41
  import * as React from "react";
42
- import { createContext, useCallback, useContext, useMemo, useRef, useState } from "react";
43
-
44
- // src/site-content-sort.ts
45
- import { __ } from "@wordpress/i18n";
46
- var SITE_CONTENT_SORT_OPTIONS = ["oldest", "newest"];
47
- var DEFAULT_SITE_CONTENT_SORT = "oldest";
48
- var SITE_CONTENT_SORT_POPOVER_WIDTH_PX = 280;
49
- var sortLabels = {
50
- oldest: __("Oldest", "elementor"),
51
- newest: __("Newest", "elementor")
52
- };
53
- function getSiteContentSortLabel(sort) {
54
- return sortLabels[sort];
55
- }
56
- function hasActiveSiteContentSort(sort) {
57
- return sort !== DEFAULT_SITE_CONTENT_SORT;
58
- }
59
- function getRestOrderForSiteContentSort(sort) {
60
- if (sort === "newest") {
61
- return { order: "desc", orderby: "date" };
62
- }
63
- return { order: "asc", orderby: "date" };
64
- }
65
- function shouldPinHomepageForSiteContentSort(sort) {
66
- return sort === DEFAULT_SITE_CONTENT_SORT;
67
- }
68
-
69
- // src/site-content-status-filter.ts
70
- import { __ as __2 } from "@wordpress/i18n";
71
- var SITE_CONTENT_SELECTABLE_STATUS_FILTERS = [
72
- "publish",
73
- "draft",
74
- "pending",
75
- "private",
76
- "future",
77
- "trash"
78
- ];
79
- var EMPTY_SITE_CONTENT_STATUS_FILTERS = {
80
- draft: false,
81
- future: false,
82
- pending: false,
83
- private: false,
84
- publish: false,
85
- trash: false
86
- };
87
- var filterLabels = {
88
- publish: __2("Published", "elementor"),
89
- draft: __2("Drafts", "elementor"),
90
- pending: __2("Pending", "elementor"),
91
- private: __2("Private", "elementor"),
92
- future: __2("Scheduled", "elementor"),
93
- trash: __2("Trash", "elementor")
94
- };
95
- var SITE_CONTENT_ALL_FILTER_LABEL = __2("All", "elementor");
96
- var SITE_CONTENT_FILTER_POPOVER_WIDTH_PX = 280;
97
- function getSiteContentStatusFilterLabel(filter) {
98
- return filterLabels[filter];
99
- }
100
- function hasActiveSiteContentStatusFilters(filters) {
101
- return SITE_CONTENT_SELECTABLE_STATUS_FILTERS.some((key) => filters[key]);
102
- }
103
- function getActiveSiteContentStatusFilterKeys(filters) {
104
- return SITE_CONTENT_SELECTABLE_STATUS_FILTERS.filter((key) => filters[key]);
105
- }
106
- var serializeSiteContentStatusFilters = (statusFilters) => SITE_CONTENT_SELECTABLE_STATUS_FILTERS.map((key) => statusFilters[key] ? key : "").join("|");
107
- function getRestStatusForSiteContentFilters(filters) {
108
- if (filters.trash) {
109
- return "trash";
110
- }
111
- const active = getActiveSiteContentStatusFilterKeys(filters);
112
- if (0 === active.length) {
113
- return "any";
114
- }
115
- return active.join(",");
116
- }
117
- function isSiteContentTrashFilterActive(filters) {
118
- return filters.trash;
119
- }
120
- function isSiteContentListNarrowed(filters, search) {
121
- return hasActiveSiteContentStatusFilters(filters) || search.trim().length > 0;
122
- }
123
- function toggleSiteContentStatusFilter(filters, filter) {
124
- if ("trash" === filter) {
125
- const isTrashOn = !filters.trash;
126
- return {
127
- ...EMPTY_SITE_CONTENT_STATUS_FILTERS,
128
- trash: isTrashOn
129
- };
130
- }
131
- return {
132
- ...filters,
133
- trash: false,
134
- [filter]: !filters[filter]
135
- };
136
- }
137
- function shouldShowSiteContentStatusFilterRow(count, isLoadingCounts, isSelected) {
138
- if (isSelected) {
139
- return true;
140
- }
141
- if (isLoadingCounts || void 0 === count) {
142
- return false;
143
- }
144
- return count > 0;
145
- }
146
-
147
- // src/contexts/content-panel-coordinator.tsx
42
+ import { createContext, useCallback, useContext, useMemo, useRef } from "react";
148
43
  var ContentPanelCoordinatorContext = createContext(null);
149
44
  function ContentPanelCoordinatorProvider({ children }) {
150
45
  const sectionsRef = useRef(/* @__PURE__ */ new Map());
151
- const [searchQuery, setSearchQuery] = useState("");
152
- const [siteContentSort, setSiteContentSortState] = useState(DEFAULT_SITE_CONTENT_SORT);
153
- const [statusFilters, setStatusFilters] = useState(
154
- EMPTY_SITE_CONTENT_STATUS_FILTERS
155
- );
156
46
  const registerSection = useCallback((type, handlers) => {
157
47
  sectionsRef.current.set(type, handlers);
158
48
  }, []);
@@ -167,50 +57,13 @@ function ContentPanelCoordinatorProvider({ children }) {
167
57
  handlers.setExpanded(true);
168
58
  handlers.startCreate();
169
59
  }, []);
170
- const clearActiveToolbarFilters = useCallback(() => {
171
- setSiteContentSortState(DEFAULT_SITE_CONTENT_SORT);
172
- setStatusFilters(EMPTY_SITE_CONTENT_STATUS_FILTERS);
173
- }, []);
174
- const clearSiteContentSort = useCallback(() => {
175
- setSiteContentSortState(DEFAULT_SITE_CONTENT_SORT);
176
- }, []);
177
- const clearStatusFilters = useCallback(() => {
178
- setStatusFilters(EMPTY_SITE_CONTENT_STATUS_FILTERS);
179
- }, []);
180
- const setSiteContentSort = useCallback((sort) => {
181
- setSiteContentSortState(sort);
182
- }, []);
183
- const toggleStatusFilter = useCallback((filter) => {
184
- setStatusFilters((current) => toggleSiteContentStatusFilter(current, filter));
185
- }, []);
186
60
  const value = useMemo(
187
61
  () => ({
188
- clearActiveToolbarFilters,
189
- clearSiteContentSort,
190
- clearStatusFilters,
191
62
  registerSection,
192
63
  requestCreate,
193
- searchQuery,
194
- setSearchQuery,
195
- setSiteContentSort,
196
- siteContentSort,
197
- statusFilters,
198
- toggleStatusFilter,
199
64
  unregisterSection
200
65
  }),
201
- [
202
- clearActiveToolbarFilters,
203
- clearSiteContentSort,
204
- clearStatusFilters,
205
- registerSection,
206
- requestCreate,
207
- searchQuery,
208
- siteContentSort,
209
- setSiteContentSort,
210
- statusFilters,
211
- toggleStatusFilter,
212
- unregisterSection
213
- ]
66
+ [registerSection, requestCreate, unregisterSection]
214
67
  );
215
68
  return /* @__PURE__ */ React.createElement(ContentPanelCoordinatorContext.Provider, { value }, children);
216
69
  }
@@ -229,20 +82,47 @@ import { useMemo as useMemo2 } from "react";
229
82
 
230
83
  // src/api/post.ts
231
84
  import apiFetch from "@wordpress/api-fetch";
232
- import { __ as __3 } from "@wordpress/i18n";
85
+ import { __ as __2 } from "@wordpress/i18n";
86
+
87
+ // src/site-content-sort.ts
88
+ import { __ } from "@wordpress/i18n";
89
+ var SITE_CONTENT_SORT_OPTIONS = ["oldest", "newest"];
90
+ var DEFAULT_SITE_CONTENT_SORT = "oldest";
91
+ var SITE_CONTENT_SORT_POPOVER_WIDTH_PX = 280;
92
+ var sortLabels = {
93
+ oldest: __("Oldest", "elementor"),
94
+ newest: __("Newest", "elementor")
95
+ };
96
+ function getSiteContentSortLabel(sort) {
97
+ return sortLabels[sort];
98
+ }
99
+ function hasActiveSiteContentSort(sort) {
100
+ return sort !== DEFAULT_SITE_CONTENT_SORT;
101
+ }
102
+ function getRestOrderForSiteContentSort(sort) {
103
+ if (sort === "newest") {
104
+ return { order: "desc", orderby: "date" };
105
+ }
106
+ return { order: "asc", orderby: "date" };
107
+ }
108
+ function shouldPinHomepageForSiteContentSort(sort) {
109
+ return sort === DEFAULT_SITE_CONTENT_SORT;
110
+ }
111
+
112
+ // src/api/post.ts
233
113
  var postTypesMap = {
234
114
  page: {
235
115
  labels: {
236
- singular_name: __3("Page", "elementor"),
237
- plural_name: __3("Pages", "elementor")
116
+ singular_name: __2("Page", "elementor"),
117
+ plural_name: __2("Pages", "elementor")
238
118
  },
239
119
  rest_base: "pages",
240
120
  createCapability: "edit_pages"
241
121
  },
242
122
  post: {
243
123
  labels: {
244
- singular_name: __3("Post", "elementor"),
245
- plural_name: __3("Posts", "elementor")
124
+ singular_name: __2("Post", "elementor"),
125
+ plural_name: __2("Posts", "elementor")
246
126
  },
247
127
  rest_base: "posts",
248
128
  createCapability: "edit_posts"
@@ -257,9 +137,9 @@ function getAccessiblePanelPostTypes(capabilities) {
257
137
  }
258
138
  function getCannotEditPanelItemMessage(postTypeSlug) {
259
139
  if ("page" === postTypeSlug) {
260
- return __3("You cannot edit this page.", "elementor");
140
+ return __2("You cannot edit this page.", "elementor");
261
141
  }
262
- return __3("You cannot edit this post.", "elementor");
142
+ return __2("You cannot edit this post.", "elementor");
263
143
  }
264
144
  var POST_PER_PAGE = 10;
265
145
  var COUNT_QUERY_PER_PAGE = 1;
@@ -388,9 +268,7 @@ function useAccessiblePanelPostTypes() {
388
268
  var CONTENT_PANEL_INSET_SPACING = 2;
389
269
  var CONTENT_PANEL_LIST_ROW_GAP = 0.5;
390
270
  var CONTENT_PANEL_LIST_ROW_INSET_INLINE = 0.75;
391
- var CONTENT_PANEL_LIST_ROW_ACTIVE_SECONDARY_ACTIONS_COUNT = 2;
392
- var CONTENT_PANEL_LIST_ROW_ACTIVE_SECONDARY_ACTION_SLOT_WIDTH = 5.5;
393
- var CONTENT_PANEL_LIST_ROW_ACTIVE_SECONDARY_INSET = CONTENT_PANEL_LIST_ROW_ACTIVE_SECONDARY_ACTIONS_COUNT * CONTENT_PANEL_LIST_ROW_ACTIVE_SECONDARY_ACTION_SLOT_WIDTH;
271
+ var CONTENT_PANEL_LIST_ROW_SECONDARY_ACTION_SLOT_WIDTH = 5.5;
394
272
  var CONTENT_PANEL_LIST_ROW_TITLE_FONT_SIZE = "0.75rem";
395
273
  var CONTENT_PANEL_LIST_SECTION_BOTTOM_SPACING = 1;
396
274
  var CONTENT_PANEL_SECTION_HEADER_PADDING_BLOCK = 1.25;
@@ -402,19 +280,38 @@ var contentPanelInsetPaddingSx = {
402
280
  var contentPanelListRowPaddingSx = {
403
281
  ...contentPanelInsetPaddingSx
404
282
  };
405
- var contentPanelListItemActiveActionsInsetSx = {
283
+ var contentPanelListItemSecondaryInsetSx = (trailingActionCount) => ({
406
284
  "&& > .MuiListItemButton-root": {
407
- paddingInlineEnd: CONTENT_PANEL_LIST_ROW_ACTIVE_SECONDARY_INSET,
285
+ paddingInlineEnd: trailingActionCount * CONTENT_PANEL_LIST_ROW_SECONDARY_ACTION_SLOT_WIDTH,
408
286
  paddingRight: "unset"
409
287
  }
410
- };
411
- function getContentPanelListItemSx(hasActiveRowActions) {
412
- if (!hasActiveRowActions) {
413
- return contentPanelListRowPaddingSx;
414
- }
288
+ });
289
+ function getContentPanelListItemSx(trailingActionCount) {
415
290
  return {
416
291
  ...contentPanelListRowPaddingSx,
417
- ...contentPanelListItemActiveActionsInsetSx
292
+ ...contentPanelListItemSecondaryInsetSx(trailingActionCount)
293
+ };
294
+ }
295
+ function getContentPanelListItemRowStateSx(isActive, allowRowHover) {
296
+ if (isActive) {
297
+ return {
298
+ borderRadius: 1,
299
+ backgroundColor: "action.selected",
300
+ "&:hover": {
301
+ backgroundColor: "action.selected"
302
+ }
303
+ };
304
+ }
305
+ if (!allowRowHover) {
306
+ return {
307
+ borderRadius: 1
308
+ };
309
+ }
310
+ return {
311
+ borderRadius: 1,
312
+ "&:hover": {
313
+ backgroundColor: "action.hover"
314
+ }
418
315
  };
419
316
  }
420
317
  var contentPanelHeaderStackSx = {
@@ -438,27 +335,34 @@ var contentPanelListSectionListSx = {
438
335
  gap: CONTENT_PANEL_LIST_ROW_GAP,
439
336
  paddingBlockEnd: CONTENT_PANEL_LIST_SECTION_BOTTOM_SPACING
440
337
  };
441
- var contentPanelListItemButtonSx = {
442
- justifyContent: "flex-start",
443
- paddingInline: CONTENT_PANEL_LIST_ROW_INSET_INLINE,
444
- textAlign: "start",
445
- width: "100%",
338
+ var contentPanelListItemButtonTransparentSx = {
339
+ backgroundColor: "transparent",
446
340
  "&.Mui-selected": {
447
- backgroundColor: "action.selected"
341
+ backgroundColor: "transparent"
448
342
  },
449
343
  "&.Mui-selected:hover": {
450
- backgroundColor: "action.selected"
344
+ backgroundColor: "transparent"
451
345
  },
452
- "&:hover:not(.Mui-disabled)": {
453
- backgroundColor: "action.hover"
346
+ "&:hover": {
347
+ backgroundColor: "transparent"
348
+ },
349
+ "&.Mui-disabled": {
350
+ backgroundColor: "transparent"
454
351
  }
455
352
  };
353
+ var contentPanelListItemButtonSx = {
354
+ ...contentPanelListItemButtonTransparentSx,
355
+ justifyContent: "flex-start",
356
+ paddingInline: CONTENT_PANEL_LIST_ROW_INSET_INLINE,
357
+ textAlign: "start",
358
+ width: "100%"
359
+ };
456
360
 
457
361
  // src/components/panel/content-panel-header-add.tsx
458
362
  import * as React5 from "react";
459
363
  import { PageTypeIcon as PageTypeIcon2, PostTypeIcon as PostTypeIcon2 } from "@elementor/icons";
460
364
  import { bindMenu, bindTrigger, ListItemIcon as ListItemIcon2, ListItemText as ListItemText2, Menu, MenuItem as MenuItem2, usePopupState } from "@elementor/ui";
461
- import { __ as __6 } from "@wordpress/i18n";
365
+ import { __ as __5 } from "@wordpress/i18n";
462
366
 
463
367
  // src/hooks/use-can-create.ts
464
368
  function useCanCreate(postTypeSlug) {
@@ -502,21 +406,21 @@ import * as React4 from "react";
502
406
  import { useRef as useRef2 } from "react";
503
407
  import { PopupTemplateIcon } from "@elementor/icons";
504
408
  import { Box as Box2, ListItemIcon, ListItemText, MenuItem } from "@elementor/ui";
505
- import { __ as __5 } from "@wordpress/i18n";
409
+ import { __ as __4 } from "@wordpress/i18n";
506
410
 
507
411
  // src/components/panel/popups/site-content-popups-promotion-chip.tsx
508
412
  import * as React3 from "react";
509
- import { forwardRef, useCallback as useCallback2, useImperativeHandle, useState as useState2 } from "react";
413
+ import { forwardRef, useCallback as useCallback2, useImperativeHandle, useState } from "react";
510
414
  import { trackUpgradePromotionClick, trackViewPromotion } from "@elementor/editor-controls";
511
415
  import { PromotionChip, PromotionPopover, useCanvasClickHandler } from "@elementor/editor-ui";
512
416
  import { Box } from "@elementor/ui";
513
- import { __ as __4 } from "@wordpress/i18n";
417
+ import { __ as __3 } from "@wordpress/i18n";
514
418
  var TRACKING_DATA = {
515
419
  target_name: "popups",
516
420
  target_location: "widget_panel"
517
421
  };
518
422
  var SiteContentPopupsPromotionChip = forwardRef((_, ref) => {
519
- const [isOpen, setIsOpen] = useState2(false);
423
+ const [isOpen, setIsOpen] = useState(false);
520
424
  const upgradeUrl = env.popups?.upgrade_url ?? POPUP_SITE_CONTENT_UPGRADE_URL;
521
425
  useCanvasClickHandler(isOpen, () => setIsOpen(false));
522
426
  const toggle = useCallback2(() => {
@@ -532,9 +436,9 @@ var SiteContentPopupsPromotionChip = forwardRef((_, ref) => {
532
436
  PromotionPopover,
533
437
  {
534
438
  open: isOpen,
535
- title: __4("Popups", "elementor"),
536
- content: __4("Upgrade to continue creating and editing popups.", "elementor"),
537
- ctaText: __4("Upgrade now", "elementor"),
439
+ title: __3("Popups", "elementor"),
440
+ content: __3("Upgrade to continue creating and editing popups.", "elementor"),
441
+ ctaText: __3("Upgrade now", "elementor"),
538
442
  ctaUrl: upgradeUrl,
539
443
  onClose: (event) => {
540
444
  event.stopPropagation();
@@ -560,7 +464,7 @@ var SiteContentPopupsPromotionChip = forwardRef((_, ref) => {
560
464
  function PopupHeaderCreateMenuItem({ onSelect }) {
561
465
  const promotionRef = useRef2(null);
562
466
  const canCreate = env.popups?.can_use ?? false;
563
- const label = __5("Popup", "elementor");
467
+ const label = __4("Popup", "elementor");
564
468
  const handleClick = () => {
565
469
  if (!canCreate) {
566
470
  promotionRef.current?.toggle();
@@ -617,7 +521,7 @@ function ContentPanelHeaderAdd() {
617
521
  return /* @__PURE__ */ React5.createElement(React5.Fragment, null, /* @__PURE__ */ React5.createElement(
618
522
  ContentPanelAddIconButton,
619
523
  {
620
- "aria-label": __6("Add new", "elementor"),
524
+ "aria-label": __5("Add new", "elementor"),
621
525
  ...buttonProps,
622
526
  disabled: !canAddAny
623
527
  }
@@ -629,388 +533,60 @@ function ContentPanelHeaderAdd() {
629
533
  })))));
630
534
  }
631
535
 
632
- // src/components/panel/content-panel-toolbar.tsx
633
- import * as React13 from "react";
634
- import { Box as Box5, Stack as Stack4 } from "@elementor/ui";
635
-
636
- // src/components/panel/content-panel-active-filters.tsx
637
- import * as React7 from "react";
638
- import { Chip, Stack } from "@elementor/ui";
639
- import { __ as __7 } from "@wordpress/i18n";
640
-
641
- // src/components/panel/content-panel-clear-filters-button.tsx
536
+ // src/components/panel/error-snackbar.tsx
642
537
  import * as React6 from "react";
643
- import { BrushBigIcon } from "@elementor/icons";
644
- import { Box as Box3, IconButton as IconButton2, Tooltip } from "@elementor/ui";
645
- function ContentPanelClearFiltersButton({ ariaLabel, onClear, sx, tooltipText }) {
646
- return /* @__PURE__ */ React6.createElement(Tooltip, { disableInteractive: true, placement: "top", title: tooltipText }, /* @__PURE__ */ React6.createElement(Box3, null, /* @__PURE__ */ React6.createElement(IconButton2, { "aria-label": ariaLabel, onClick: onClear, size: "tiny", sx }, /* @__PURE__ */ React6.createElement(BrushBigIcon, { fontSize: "tiny" }))));
647
- }
538
+ import { Alert, Snackbar, Typography } from "@elementor/ui";
539
+ var ErrorSnackbar = ({ open, onClose }) => {
540
+ return /* @__PURE__ */ React6.createElement(
541
+ Snackbar,
542
+ {
543
+ open,
544
+ onClose,
545
+ anchorOrigin: {
546
+ vertical: "bottom",
547
+ horizontal: "left"
548
+ }
549
+ },
550
+ /* @__PURE__ */ React6.createElement(Alert, { onClose, severity: "error", sx: { width: "100%" } }, /* @__PURE__ */ React6.createElement(
551
+ Typography,
552
+ {
553
+ component: "span",
554
+ sx: {
555
+ fontWeight: "bold"
556
+ }
557
+ },
558
+ "We couldn\u2019t complete the action."
559
+ ), " ", "Please try again")
560
+ );
561
+ };
562
+ var error_snackbar_default = ErrorSnackbar;
648
563
 
649
- // src/components/panel/content-panel-active-filters.tsx
650
- var contentPanelFilterChipSx = {
651
- "& .MuiChip-deleteIcon": {
652
- display: "none",
653
- transition: "opacity 0.2s"
654
- },
655
- "&:hover .MuiChip-deleteIcon": {
656
- display: "block"
657
- }
564
+ // src/components/panel/shell-panel-body-content.tsx
565
+ import * as React38 from "react";
566
+ import { List as List2, Skeleton as Skeleton2, Stack as Stack8 } from "@elementor/ui";
567
+
568
+ // src/contexts/post-list-context.tsx
569
+ import * as React7 from "react";
570
+ import { createContext as createContext2, useContext as useContext2, useState as useState2 } from "react";
571
+ var defaultValues = {
572
+ type: "page",
573
+ editMode: { mode: "none", details: {} },
574
+ setEditMode: () => null,
575
+ resetEditMode: () => null,
576
+ setError: () => null
658
577
  };
659
- function ContentPanelActiveFilters() {
660
- const { clearActiveToolbarFilters, setSiteContentSort, siteContentSort, statusFilters, toggleStatusFilter } = useContentPanelCoordinator();
661
- const hasStatusFilters = hasActiveSiteContentStatusFilters(statusFilters);
662
- const hasSort = hasActiveSiteContentSort(siteContentSort);
663
- if (!hasStatusFilters && !hasSort) {
664
- return null;
665
- }
666
- const activeKeys = getActiveSiteContentStatusFilterKeys(statusFilters);
667
- return /* @__PURE__ */ React7.createElement(Stack, { alignItems: "center", direction: "row", justifyContent: "space-between" }, /* @__PURE__ */ React7.createElement(Stack, { alignItems: "center", direction: "row", flexWrap: "wrap", gap: 0.5 }, hasSort && /* @__PURE__ */ React7.createElement(
668
- Chip,
669
- {
670
- label: getSiteContentSortLabel(siteContentSort),
671
- onDelete: () => setSiteContentSort(DEFAULT_SITE_CONTENT_SORT),
672
- size: "tiny",
673
- sx: contentPanelFilterChipSx
674
- }
675
- ), activeKeys.map((key) => /* @__PURE__ */ React7.createElement(
676
- Chip,
677
- {
678
- key,
679
- label: getSiteContentStatusFilterLabel(key),
680
- onDelete: () => toggleStatusFilter(key),
681
- size: "tiny",
682
- sx: contentPanelFilterChipSx
683
- }
684
- ))), /* @__PURE__ */ React7.createElement(
685
- ContentPanelClearFiltersButton,
686
- {
687
- ariaLabel: __7("Clear Filters", "elementor"),
688
- onClear: clearActiveToolbarFilters,
689
- sx: { margin: "0 0 auto auto" },
690
- tooltipText: __7("Clear Filters", "elementor")
691
- }
692
- ));
693
- }
694
-
695
- // src/components/panel/content-panel-search.tsx
696
- import * as React8 from "react";
697
- import { SearchIcon } from "@elementor/icons";
698
- import { Box as Box4, InputAdornment, TextField } from "@elementor/ui";
699
- import { __ as __8 } from "@wordpress/i18n";
700
- function ContentPanelSearch() {
701
- const { searchQuery, setSearchQuery } = useContentPanelCoordinator();
702
- return /* @__PURE__ */ React8.createElement(Box4, { component: "search", "aria-label": __8("Search site content", "elementor") }, /* @__PURE__ */ React8.createElement(
703
- TextField,
704
- {
705
- fullWidth: true,
706
- size: "tiny",
707
- value: searchQuery,
708
- placeholder: __8("Search", "elementor"),
709
- onChange: (event) => setSearchQuery(event.target.value),
710
- inputProps: {
711
- "aria-label": __8("Search", "elementor")
712
- },
713
- InputProps: {
714
- startAdornment: /* @__PURE__ */ React8.createElement(InputAdornment, { position: "start" }, /* @__PURE__ */ React8.createElement(SearchIcon, { fontSize: "tiny" }))
715
- }
716
- }
717
- ));
718
- }
719
-
720
- // src/components/panel/content-panel-sort.tsx
721
- import * as React10 from "react";
722
- import { PopoverBody, PopoverHeader } from "@elementor/editor-ui";
723
- import { ArrowsSortIcon } from "@elementor/icons";
724
- import { bindPopover, bindToggle, Divider, Popover, ToggleButton, Tooltip as Tooltip2, usePopupState as usePopupState2 } from "@elementor/ui";
725
- import { __ as __9 } from "@wordpress/i18n";
726
-
727
- // src/components/panel/content-panel-sort-list.tsx
728
- import * as React9 from "react";
729
- import { CheckIcon } from "@elementor/icons";
730
- import { MenuItem as MenuItem3, MenuList, Stack as Stack2, Typography } from "@elementor/ui";
731
- var renderSortMenuItemContent = (label, selected) => /* @__PURE__ */ React9.createElement(Stack2, { alignItems: "center", direction: "row", gap: 1, width: "100%" }, /* @__PURE__ */ React9.createElement(Typography, { sx: { color: "text.secondary", flex: 1 }, variant: "caption" }, label), selected ? /* @__PURE__ */ React9.createElement(CheckIcon, { "aria-hidden": true, fontSize: "tiny" }) : null);
732
- function ContentPanelSortList() {
733
- const { setSiteContentSort, siteContentSort } = useContentPanelCoordinator();
734
- return /* @__PURE__ */ React9.createElement(MenuList, { dense: true }, SITE_CONTENT_SORT_OPTIONS.map((option) => {
735
- const isSelected = siteContentSort === option;
736
- return /* @__PURE__ */ React9.createElement(
737
- MenuItem3,
738
- {
739
- key: option,
740
- "aria-checked": isSelected,
741
- onClick: () => setSiteContentSort(option),
742
- role: "menuitemradio",
743
- selected: isSelected
744
- },
745
- renderSortMenuItemContent(getSiteContentSortLabel(option), isSelected)
746
- );
747
- }));
748
- }
749
-
750
- // src/components/panel/content-panel-sort.tsx
751
- function ContentPanelSort() {
752
- const { clearSiteContentSort, siteContentSort } = useContentPanelCoordinator();
753
- const popupState = usePopupState2({
754
- variant: "popover",
755
- disableAutoFocus: true
756
- });
757
- const hasActiveSort = hasActiveSiteContentSort(siteContentSort);
758
- return /* @__PURE__ */ React10.createElement(React10.Fragment, null, /* @__PURE__ */ React10.createElement(Tooltip2, { placement: "top", title: __9("Sort", "elementor") }, /* @__PURE__ */ React10.createElement(
759
- ToggleButton,
760
- {
761
- "aria-label": __9("Sort", "elementor"),
762
- selected: popupState.isOpen || hasActiveSort,
763
- size: "tiny",
764
- value: "sort",
765
- ...bindToggle(popupState)
766
- },
767
- /* @__PURE__ */ React10.createElement(ArrowsSortIcon, { fontSize: "tiny" })
768
- )), /* @__PURE__ */ React10.createElement(
769
- Popover,
770
- {
771
- anchorOrigin: {
772
- horizontal: "right",
773
- vertical: "top"
774
- },
775
- sx: {
776
- maxWidth: `${SITE_CONTENT_SORT_POPOVER_WIDTH_PX}px`
777
- },
778
- transformOrigin: {
779
- horizontal: -21,
780
- vertical: "top"
781
- },
782
- ...bindPopover(popupState)
783
- },
784
- /* @__PURE__ */ React10.createElement(
785
- PopoverHeader,
786
- {
787
- actions: hasActiveSort ? [
788
- /* @__PURE__ */ React10.createElement(
789
- ContentPanelClearFiltersButton,
790
- {
791
- ariaLabel: __9("Clear sort", "elementor"),
792
- key: "clear-sort",
793
- onClear: clearSiteContentSort,
794
- tooltipText: __9("Clear sort", "elementor")
795
- }
796
- )
797
- ] : [],
798
- icon: /* @__PURE__ */ React10.createElement(ArrowsSortIcon, { fontSize: "tiny" }),
799
- onClose: popupState.close,
800
- title: __9("Sort", "elementor")
801
- }
802
- ),
803
- /* @__PURE__ */ React10.createElement(Divider, { sx: { borderWidth: "1px 0 0 0" } }),
804
- /* @__PURE__ */ React10.createElement(PopoverBody, { height: "auto", width: SITE_CONTENT_SORT_POPOVER_WIDTH_PX }, /* @__PURE__ */ React10.createElement(ContentPanelSortList, null))
805
- ));
806
- }
807
-
808
- // src/components/panel/content-panel-status-filter.tsx
809
- import * as React12 from "react";
810
- import { PopoverBody as PopoverBody2, PopoverHeader as PopoverHeader2 } from "@elementor/editor-ui";
811
- import { FilterIcon } from "@elementor/icons";
812
- import { bindPopover as bindPopover2, bindToggle as bindToggle2, Divider as Divider2, Popover as Popover2, ToggleButton as ToggleButton2, Tooltip as Tooltip3, usePopupState as usePopupState3 } from "@elementor/ui";
813
- import { __ as __10 } from "@wordpress/i18n";
814
-
815
- // src/components/panel/content-panel-status-filter-list.tsx
816
- import * as React11 from "react";
817
- import { CheckIcon as CheckIcon2 } from "@elementor/icons";
818
- import { MenuItem as MenuItem4, MenuList as MenuList2, Stack as Stack3, Typography as Typography2 } from "@elementor/ui";
819
-
820
- // src/hooks/use-site-content-status-filter-counts.ts
821
- import { useQuery as useQuery2 } from "@elementor/query";
822
- var STATUS_FILTER_COUNTS_STALE_TIME_MS = 30 * 1e3;
823
- var siteContentStatusFilterCountsQueryKeyBase = ["site-navigation", "status-filter-counts"];
824
- var siteContentStatusFilterCountsQueryKey = (postTypes) => [
825
- ...siteContentStatusFilterCountsQueryKeyBase,
826
- postTypes.join(",")
827
- ];
828
- var sumFulfilledTotals = (results) => {
829
- const fulfilled = results.filter(
830
- (result) => "fulfilled" === result.status
831
- );
832
- if (fulfilled.length !== results.length) {
833
- return void 0;
834
- }
835
- return fulfilled.reduce((sum, result) => sum + result.value, 0);
836
- };
837
- var fetchStatusFilterCounts = async (postTypes) => {
838
- const entries = await Promise.all(
839
- SITE_CONTENT_SELECTABLE_STATUS_FILTERS.map(async (status) => {
840
- const results = await Promise.allSettled(postTypes.map((slug) => fetchPostsTotal(slug, status)));
841
- const total = sumFulfilledTotals(results);
842
- if (void 0 === total) {
843
- return null;
844
- }
845
- return [status, total];
846
- })
847
- );
848
- return Object.fromEntries(entries.filter((entry) => null !== entry));
849
- };
850
- function useSiteContentStatusFilterCounts(postTypes, enabled) {
851
- return useQuery2({
852
- enabled: enabled && postTypes.length > 0,
853
- queryFn: () => fetchStatusFilterCounts(postTypes),
854
- queryKey: siteContentStatusFilterCountsQueryKey(postTypes),
855
- staleTime: STATUS_FILTER_COUNTS_STALE_TIME_MS
856
- });
857
- }
858
-
859
- // src/components/panel/content-panel-status-filter-list.tsx
860
- var renderFilterMenuItemContent = (label, selected) => /* @__PURE__ */ React11.createElement(Stack3, { alignItems: "center", direction: "row", gap: 1, width: "100%" }, /* @__PURE__ */ React11.createElement(Typography2, { sx: { color: "text.secondary", flex: 1 }, variant: "caption" }, label), selected ? /* @__PURE__ */ React11.createElement(CheckIcon2, { "aria-hidden": true, fontSize: "tiny" }) : null);
861
- function ContentPanelStatusFilterList({ loadCounts }) {
862
- const { clearStatusFilters, statusFilters, toggleStatusFilter } = useContentPanelCoordinator();
863
- const { accessiblePostTypes } = useAccessiblePanelPostTypes();
864
- const { data: statusCounts, isPending: isLoadingCounts } = useSiteContentStatusFilterCounts(
865
- accessiblePostTypes,
866
- loadCounts
867
- );
868
- const isAllSelected = !hasActiveSiteContentStatusFilters(statusFilters);
869
- const visibleFilters = SITE_CONTENT_SELECTABLE_STATUS_FILTERS.filter(
870
- (filter) => shouldShowSiteContentStatusFilterRow(statusCounts?.[filter], isLoadingCounts, statusFilters[filter])
871
- );
872
- return /* @__PURE__ */ React11.createElement(MenuList2, { dense: true }, /* @__PURE__ */ React11.createElement(
873
- MenuItem4,
874
- {
875
- "aria-checked": isAllSelected,
876
- onClick: clearStatusFilters,
877
- role: "menuitemcheckbox",
878
- selected: isAllSelected
879
- },
880
- renderFilterMenuItemContent(SITE_CONTENT_ALL_FILTER_LABEL, isAllSelected)
881
- ), visibleFilters.map((filter) => {
882
- const isSelected = statusFilters[filter];
883
- return /* @__PURE__ */ React11.createElement(
884
- MenuItem4,
885
- {
886
- key: filter,
887
- "aria-checked": isSelected,
888
- onClick: () => toggleStatusFilter(filter),
889
- role: "menuitemcheckbox",
890
- selected: isSelected
891
- },
892
- renderFilterMenuItemContent(getSiteContentStatusFilterLabel(filter), isSelected)
893
- );
894
- }));
895
- }
896
-
897
- // src/components/panel/content-panel-status-filter.tsx
898
- function ContentPanelStatusFilter() {
899
- const { clearStatusFilters, statusFilters } = useContentPanelCoordinator();
900
- const popupState = usePopupState3({
901
- variant: "popover",
902
- disableAutoFocus: true
903
- });
904
- const hasActiveFilters = hasActiveSiteContentStatusFilters(statusFilters);
905
- return /* @__PURE__ */ React12.createElement(React12.Fragment, null, /* @__PURE__ */ React12.createElement(Tooltip3, { placement: "top", title: __10("Filters", "elementor") }, /* @__PURE__ */ React12.createElement(
906
- ToggleButton2,
907
- {
908
- "aria-label": __10("Filters", "elementor"),
909
- selected: popupState.isOpen || hasActiveFilters,
910
- size: "tiny",
911
- value: "filter",
912
- ...bindToggle2(popupState)
913
- },
914
- /* @__PURE__ */ React12.createElement(FilterIcon, { fontSize: "tiny" })
915
- )), /* @__PURE__ */ React12.createElement(
916
- Popover2,
917
- {
918
- anchorOrigin: {
919
- horizontal: "right",
920
- vertical: "top"
921
- },
922
- sx: {
923
- maxWidth: `${SITE_CONTENT_FILTER_POPOVER_WIDTH_PX}px`
924
- },
925
- transformOrigin: {
926
- horizontal: -21,
927
- vertical: "top"
928
- },
929
- ...bindPopover2(popupState)
930
- },
931
- /* @__PURE__ */ React12.createElement(
932
- PopoverHeader2,
933
- {
934
- actions: hasActiveFilters ? [
935
- /* @__PURE__ */ React12.createElement(
936
- ContentPanelClearFiltersButton,
937
- {
938
- ariaLabel: __10("Clear all", "elementor"),
939
- key: "clear-all-filters",
940
- onClear: clearStatusFilters,
941
- tooltipText: __10("Clear all", "elementor")
942
- }
943
- )
944
- ] : [],
945
- icon: /* @__PURE__ */ React12.createElement(FilterIcon, { fontSize: "tiny" }),
946
- onClose: popupState.close,
947
- title: __10("Filters", "elementor")
948
- }
949
- ),
950
- /* @__PURE__ */ React12.createElement(Divider2, { sx: { borderWidth: "1px 0 0 0" } }),
951
- /* @__PURE__ */ React12.createElement(PopoverBody2, { height: "auto", width: SITE_CONTENT_FILTER_POPOVER_WIDTH_PX }, /* @__PURE__ */ React12.createElement(ContentPanelStatusFilterList, { loadCounts: popupState.isOpen }))
952
- ));
953
- }
954
-
955
- // src/components/panel/content-panel-toolbar.tsx
956
- function ContentPanelToolbar() {
957
- return /* @__PURE__ */ React13.createElement(Box5, { sx: contentPanelSearchBoxSx }, /* @__PURE__ */ React13.createElement(Stack4, { gap: 0.75, width: "100%" }, /* @__PURE__ */ React13.createElement(Stack4, { alignItems: "center", direction: "row", gap: 0.5, width: "100%" }, /* @__PURE__ */ React13.createElement(Box5, { sx: { flexGrow: 1, minWidth: 0 } }, /* @__PURE__ */ React13.createElement(ContentPanelSearch, null)), /* @__PURE__ */ React13.createElement(ContentPanelStatusFilter, null), /* @__PURE__ */ React13.createElement(ContentPanelSort, null)), /* @__PURE__ */ React13.createElement(ContentPanelActiveFilters, null)));
958
- }
959
-
960
- // src/components/panel/error-snackbar.tsx
961
- import * as React14 from "react";
962
- import { Alert, Snackbar, Typography as Typography3 } from "@elementor/ui";
963
- var ErrorSnackbar = ({ open, onClose }) => {
964
- return /* @__PURE__ */ React14.createElement(
965
- Snackbar,
966
- {
967
- open,
968
- onClose,
969
- anchorOrigin: {
970
- vertical: "bottom",
971
- horizontal: "left"
972
- }
973
- },
974
- /* @__PURE__ */ React14.createElement(Alert, { onClose, severity: "error", sx: { width: "100%" } }, /* @__PURE__ */ React14.createElement(
975
- Typography3,
976
- {
977
- component: "span",
978
- sx: {
979
- fontWeight: "bold"
980
- }
981
- },
982
- "We couldn\u2019t complete the action."
983
- ), " ", "Please try again")
984
- );
985
- };
986
- var error_snackbar_default = ErrorSnackbar;
987
-
988
- // src/components/panel/shell-panel-body-content.tsx
989
- import * as React37 from "react";
990
- import { List as List2, Skeleton as Skeleton2, Stack as Stack8 } from "@elementor/ui";
991
-
992
- // src/contexts/post-list-context.tsx
993
- import * as React15 from "react";
994
- import { createContext as createContext2, useContext as useContext2, useState as useState3 } from "react";
995
- var defaultValues = {
996
- type: "page",
997
- editMode: { mode: "none", details: {} },
998
- setEditMode: () => null,
999
- resetEditMode: () => null,
1000
- setError: () => null
1001
- };
1002
- var PostListContext = createContext2(defaultValues);
1003
- var PostListContextProvider = ({
1004
- type,
1005
- setError,
1006
- children
1007
- }) => {
1008
- const [editMode, setEditMode] = useState3(defaultValues.editMode);
1009
- const resetEditMode = () => {
1010
- setEditMode(defaultValues.editMode);
1011
- };
1012
- return /* @__PURE__ */ React15.createElement(
1013
- PostListContext.Provider,
578
+ var PostListContext = createContext2(defaultValues);
579
+ var PostListContextProvider = ({
580
+ type,
581
+ setError,
582
+ children
583
+ }) => {
584
+ const [editMode, setEditMode] = useState2(defaultValues.editMode);
585
+ const resetEditMode = () => {
586
+ setEditMode(defaultValues.editMode);
587
+ };
588
+ return /* @__PURE__ */ React7.createElement(
589
+ PostListContext.Provider,
1014
590
  {
1015
591
  value: {
1016
592
  type,
@@ -1031,29 +607,197 @@ function usePostListContext() {
1031
607
  return context;
1032
608
  }
1033
609
 
1034
- // src/site-content-sections.ts
1035
- var registeredSections = /* @__PURE__ */ new Map();
1036
- var DEFAULT_SECTION_PRIORITY = 0;
1037
- function registerSiteContentSection(section) {
1038
- registeredSections.set(section.id, section);
1039
- }
1040
- function getSiteContentSections() {
1041
- return Array.from(registeredSections.values()).sort(
1042
- (first, second) => (first.priority ?? DEFAULT_SECTION_PRIORITY) - (second.priority ?? DEFAULT_SECTION_PRIORITY)
610
+ // src/site-content-sections.ts
611
+ var registeredSections = /* @__PURE__ */ new Map();
612
+ var DEFAULT_SECTION_PRIORITY = 0;
613
+ function registerSiteContentSection(section) {
614
+ registeredSections.set(section.id, section);
615
+ }
616
+ function getSiteContentSections() {
617
+ return Array.from(registeredSections.values()).sort(
618
+ (first, second) => (first.priority ?? DEFAULT_SECTION_PRIORITY) - (second.priority ?? DEFAULT_SECTION_PRIORITY)
619
+ );
620
+ }
621
+ function resetSiteContentSections() {
622
+ registeredSections.clear();
623
+ }
624
+
625
+ // src/components/panel/posts-list/posts-collapsible-list.tsx
626
+ import * as React36 from "react";
627
+ import { useEffect as useEffect3, useMemo as useMemo5, useRef as useRef5, useState as useState9 } from "react";
628
+ import { Box as Box11, Skeleton, Typography as Typography7 } from "@elementor/ui";
629
+ import { __ as __26, sprintf as sprintf5 } from "@wordpress/i18n";
630
+
631
+ // src/contexts/site-content-section-toolbar.tsx
632
+ import * as React8 from "react";
633
+ import { createContext as createContext3, useContext as useContext3, useMemo as useMemo3 } from "react";
634
+
635
+ // src/hooks/use-site-content-section-list-controls.ts
636
+ import { useCallback as useCallback3, useEffect, useState as useState3 } from "react";
637
+
638
+ // src/site-content-status-filter.ts
639
+ import { __ as __6 } from "@wordpress/i18n";
640
+ var SITE_CONTENT_SELECTABLE_STATUS_FILTERS = [
641
+ "publish",
642
+ "draft",
643
+ "pending",
644
+ "private",
645
+ "future",
646
+ "trash"
647
+ ];
648
+ var EMPTY_SITE_CONTENT_STATUS_FILTERS = {
649
+ draft: false,
650
+ future: false,
651
+ pending: false,
652
+ private: false,
653
+ publish: false,
654
+ trash: false
655
+ };
656
+ var filterLabels = {
657
+ publish: __6("Published", "elementor"),
658
+ draft: __6("Drafts", "elementor"),
659
+ pending: __6("Pending", "elementor"),
660
+ private: __6("Private", "elementor"),
661
+ future: __6("Scheduled", "elementor"),
662
+ trash: __6("Trash", "elementor")
663
+ };
664
+ var SITE_CONTENT_ALL_FILTER_LABEL = __6("All", "elementor");
665
+ var SITE_CONTENT_FILTER_POPOVER_WIDTH_PX = 280;
666
+ function getSiteContentStatusFilterLabel(filter) {
667
+ return filterLabels[filter];
668
+ }
669
+ function hasActiveSiteContentStatusFilters(filters) {
670
+ return SITE_CONTENT_SELECTABLE_STATUS_FILTERS.some((key) => filters[key]);
671
+ }
672
+ function getActiveSiteContentStatusFilterKeys(filters) {
673
+ return SITE_CONTENT_SELECTABLE_STATUS_FILTERS.filter((key) => filters[key]);
674
+ }
675
+ var serializeSiteContentStatusFilters = (statusFilters) => SITE_CONTENT_SELECTABLE_STATUS_FILTERS.map((key) => statusFilters[key] ? key : "").join("|");
676
+ function getRestStatusForSiteContentFilters(filters) {
677
+ if (filters.trash) {
678
+ return "trash";
679
+ }
680
+ const active = getActiveSiteContentStatusFilterKeys(filters);
681
+ if (0 === active.length) {
682
+ return "any";
683
+ }
684
+ return active.join(",");
685
+ }
686
+ function isSiteContentTrashFilterActive(filters) {
687
+ return filters.trash;
688
+ }
689
+ function isSiteContentListNarrowed(filters, search) {
690
+ return hasActiveSiteContentStatusFilters(filters) || search.trim().length > 0;
691
+ }
692
+ function toggleSiteContentStatusFilter(filters, filter) {
693
+ if ("trash" === filter) {
694
+ const isTrashOn = !filters.trash;
695
+ return {
696
+ ...EMPTY_SITE_CONTENT_STATUS_FILTERS,
697
+ trash: isTrashOn
698
+ };
699
+ }
700
+ return {
701
+ ...filters,
702
+ trash: false,
703
+ [filter]: !filters[filter]
704
+ };
705
+ }
706
+ function getSiteContentStatusFilterForCount(status) {
707
+ if ("trash" === status) {
708
+ return { ...EMPTY_SITE_CONTENT_STATUS_FILTERS, trash: true };
709
+ }
710
+ return {
711
+ ...EMPTY_SITE_CONTENT_STATUS_FILTERS,
712
+ [status]: true
713
+ };
714
+ }
715
+ function shouldShowSiteContentStatusFilterRow(count, isLoadingCounts, isSelected) {
716
+ if (isSelected) {
717
+ return true;
718
+ }
719
+ if (isLoadingCounts || void 0 === count) {
720
+ return false;
721
+ }
722
+ return count > 0;
723
+ }
724
+
725
+ // src/hooks/use-site-content-section-list-controls.ts
726
+ var SEARCH_DEBOUNCE_MS = 300;
727
+ function useSiteContentSectionListControls() {
728
+ const [searchQuery, setSearchQuery] = useState3("");
729
+ const [debouncedSearch, setDebouncedSearch] = useState3("");
730
+ const [siteContentSort, setSiteContentSortState] = useState3(DEFAULT_SITE_CONTENT_SORT);
731
+ const [statusFilters, setStatusFilters] = useState3(
732
+ EMPTY_SITE_CONTENT_STATUS_FILTERS
733
+ );
734
+ const trimmedSearch = searchQuery.trim();
735
+ useEffect(() => {
736
+ const handle = window.setTimeout(() => setDebouncedSearch(trimmedSearch), SEARCH_DEBOUNCE_MS);
737
+ return () => window.clearTimeout(handle);
738
+ }, [trimmedSearch]);
739
+ const clearActiveToolbarFilters = useCallback3(() => {
740
+ setSiteContentSortState(DEFAULT_SITE_CONTENT_SORT);
741
+ setStatusFilters(EMPTY_SITE_CONTENT_STATUS_FILTERS);
742
+ }, []);
743
+ const clearSiteContentSort = useCallback3(() => {
744
+ setSiteContentSortState(DEFAULT_SITE_CONTENT_SORT);
745
+ }, []);
746
+ const clearStatusFilters = useCallback3(() => {
747
+ setStatusFilters(EMPTY_SITE_CONTENT_STATUS_FILTERS);
748
+ }, []);
749
+ const setSiteContentSort = useCallback3((sort) => {
750
+ setSiteContentSortState(sort);
751
+ }, []);
752
+ const toggleStatusFilter = useCallback3((filter) => {
753
+ setStatusFilters((current) => toggleSiteContentStatusFilter(current, filter));
754
+ }, []);
755
+ return {
756
+ clearActiveToolbarFilters,
757
+ clearSiteContentSort,
758
+ clearStatusFilters,
759
+ debouncedSearch,
760
+ searchQuery,
761
+ setSearchQuery,
762
+ setSiteContentSort,
763
+ siteContentSort,
764
+ statusFilters,
765
+ toggleStatusFilter
766
+ };
767
+ }
768
+
769
+ // src/contexts/site-content-section-toolbar.tsx
770
+ var SiteContentSectionToolbarContext = createContext3(null);
771
+ function SiteContentSectionToolbarProvider({
772
+ children,
773
+ statusFilterCountSlugs = [],
774
+ statusFilterCounts,
775
+ statusFilterCountsPending = false
776
+ }) {
777
+ const controls = useSiteContentSectionListControls();
778
+ const value = useMemo3(
779
+ () => ({
780
+ ...controls,
781
+ statusFilterCountSlugs,
782
+ statusFilterCounts,
783
+ statusFilterCountsPending
784
+ }),
785
+ [controls, statusFilterCountSlugs, statusFilterCounts, statusFilterCountsPending]
1043
786
  );
787
+ return /* @__PURE__ */ React8.createElement(SiteContentSectionToolbarContext.Provider, { value }, children);
1044
788
  }
1045
- function resetSiteContentSections() {
1046
- registeredSections.clear();
789
+ function useSiteContentSectionToolbar() {
790
+ const context = useContext3(SiteContentSectionToolbarContext);
791
+ if (!context) {
792
+ throw new Error(
793
+ "The `useSiteContentSectionToolbar()` hook must be used within a `<SiteContentSectionToolbarProvider />`"
794
+ );
795
+ }
796
+ return context;
1047
797
  }
1048
798
 
1049
- // src/components/panel/posts-list/posts-collapsible-list.tsx
1050
- import * as React35 from "react";
1051
- import { useEffect as useEffect2, useMemo as useMemo4, useRef as useRef5, useState as useState9 } from "react";
1052
- import { Box as Box11, Skeleton, Typography as Typography7 } from "@elementor/ui";
1053
- import { __ as __26 } from "@wordpress/i18n";
1054
-
1055
799
  // src/hooks/use-homepage.ts
1056
- import { useQuery as useQuery3 } from "@elementor/query";
800
+ import { useQuery as useQuery2 } from "@elementor/query";
1057
801
 
1058
802
  // src/api/settings.ts
1059
803
  import apiFetch3 from "@wordpress/api-fetch";
@@ -1073,14 +817,14 @@ var updateSettings = (settings) => {
1073
817
  // src/hooks/use-homepage.ts
1074
818
  var settingsQueryKey = () => ["site-navigation", "homepage"];
1075
819
  function useHomepage() {
1076
- return useQuery3({
820
+ return useQuery2({
1077
821
  queryKey: settingsQueryKey(),
1078
822
  queryFn: () => getSettings()
1079
823
  });
1080
824
  }
1081
825
 
1082
826
  // src/hooks/use-post-list-pagination.ts
1083
- import { useCallback as useCallback3, useEffect, useRef as useRef3, useState as useState4 } from "react";
827
+ import { useCallback as useCallback4, useEffect as useEffect2, useRef as useRef3, useState as useState4 } from "react";
1084
828
  function usePostListPagination({
1085
829
  fetchNextPage,
1086
830
  hasNextPage,
@@ -1091,11 +835,11 @@ function usePostListPagination({
1091
835
  }) {
1092
836
  const [visibleCount, setVisibleCount] = useState4(POST_PER_PAGE);
1093
837
  const pendingVisibleTargetRef = useRef3(null);
1094
- useEffect(() => {
838
+ useEffect2(() => {
1095
839
  setVisibleCount(POST_PER_PAGE);
1096
840
  pendingVisibleTargetRef.current = null;
1097
841
  }, [resetKey]);
1098
- useEffect(() => {
842
+ useEffect2(() => {
1099
843
  const target = pendingVisibleTargetRef.current;
1100
844
  if (target === null) {
1101
845
  return;
@@ -1112,7 +856,7 @@ function usePostListPagination({
1112
856
  }, [isFetchingNextPage, loadedCount]);
1113
857
  const canShowLess = visibleCount > POST_PER_PAGE;
1114
858
  const canLoadMore = visibleCount < loadedCount || hasNextPage;
1115
- const handleLoadMore = useCallback3(() => {
859
+ const handleLoadMore = useCallback4(() => {
1116
860
  if (isFetchingNextPage || !canLoadMore) {
1117
861
  return;
1118
862
  }
@@ -1130,7 +874,7 @@ function usePostListPagination({
1130
874
  setVisibleCount(Math.min(visibleCount + POST_PER_PAGE, loadedCount));
1131
875
  }
1132
876
  }, [canLoadMore, fetchNextPage, hasNextPage, isFetchingNextPage, loadedCount, totalCount, visibleCount]);
1133
- const handleShowLess = useCallback3(() => {
877
+ const handleShowLess = useCallback4(() => {
1134
878
  pendingVisibleTargetRef.current = null;
1135
879
  setVisibleCount(POST_PER_PAGE);
1136
880
  }, []);
@@ -1143,63 +887,405 @@ function usePostListPagination({
1143
887
  };
1144
888
  }
1145
889
 
1146
- // src/hooks/use-posts.ts
1147
- import { keepPreviousData, useInfiniteQuery } from "@elementor/query";
1148
- var postsQueryKeyBase = (postTypeSlug) => ["site-navigation", "posts", postTypeSlug];
1149
- var postsQueryKey = (postTypeSlug, trimmedSearch = "", restStatus = "any", sort = DEFAULT_SITE_CONTENT_SORT) => [...postsQueryKeyBase(postTypeSlug), restStatus, trimmedSearch, sort];
1150
- var flattenData = (data) => {
1151
- if (!data) {
1152
- return data;
890
+ // src/hooks/use-posts.ts
891
+ import { keepPreviousData, useInfiniteQuery } from "@elementor/query";
892
+ var postsQueryKeyBase = (postTypeSlug) => ["site-navigation", "posts", postTypeSlug];
893
+ var postsQueryKey = (postTypeSlug, trimmedSearch = "", restStatus = "any", sort = DEFAULT_SITE_CONTENT_SORT) => [...postsQueryKeyBase(postTypeSlug), restStatus, trimmedSearch, sort];
894
+ var flattenData = (data) => {
895
+ if (!data) {
896
+ return data;
897
+ }
898
+ const flattened = [];
899
+ const seenIds = /* @__PURE__ */ new Set();
900
+ data.pages.forEach((page) => {
901
+ page.data.forEach((post) => {
902
+ if (seenIds.has(post.id)) {
903
+ return;
904
+ }
905
+ seenIds.add(post.id);
906
+ flattened.push(post);
907
+ });
908
+ });
909
+ return flattened;
910
+ };
911
+ function usePosts(postTypeSlug, search = "", statusFilters = EMPTY_SITE_CONTENT_STATUS_FILTERS, sort = DEFAULT_SITE_CONTENT_SORT) {
912
+ const trimmedSearch = search.trim();
913
+ const restStatus = getRestStatusForSiteContentFilters(statusFilters);
914
+ const query = useInfiniteQuery({
915
+ queryKey: postsQueryKey(postTypeSlug, trimmedSearch, restStatus, sort),
916
+ queryFn: ({ pageParam = 1 }) => getRequest(postTypeSlug, pageParam, trimmedSearch, restStatus, POST_PER_PAGE, sort),
917
+ initialPageParam: 1,
918
+ getNextPageParam: (lastPage) => {
919
+ return lastPage.currentPage < lastPage.totalPages ? lastPage.currentPage + 1 : void 0;
920
+ },
921
+ placeholderData: keepPreviousData
922
+ });
923
+ return { ...query, data: { posts: flattenData(query.data), total: query.data?.pages[0]?.totalPosts ?? 0 } };
924
+ }
925
+
926
+ // src/hooks/use-posts-baseline-total.ts
927
+ import { useQuery as useQuery3 } from "@elementor/query";
928
+ var postsBaselineTotalQueryKeyBase = (postTypeSlug) => [
929
+ "site-navigation",
930
+ "posts-baseline-total",
931
+ postTypeSlug
932
+ ];
933
+ var postsBaselineTotalQueryKey = (postTypeSlug, status = "any") => [
934
+ ...postsBaselineTotalQueryKeyBase(postTypeSlug),
935
+ status
936
+ ];
937
+ function usePostsBaselineTotal(postTypeSlug, enabled, status = "any") {
938
+ return useQuery3({
939
+ enabled,
940
+ queryFn: () => fetchPostsTotal(postTypeSlug, status),
941
+ queryKey: postsBaselineTotalQueryKey(postTypeSlug, status)
942
+ });
943
+ }
944
+
945
+ // src/components/panel/content-panel-section-toolbar.tsx
946
+ import * as React16 from "react";
947
+ import { Box as Box5, Stack as Stack4 } from "@elementor/ui";
948
+
949
+ // src/components/panel/content-panel-active-filters.tsx
950
+ import * as React10 from "react";
951
+ import { Chip, Stack } from "@elementor/ui";
952
+ import { __ as __7 } from "@wordpress/i18n";
953
+
954
+ // src/components/panel/content-panel-clear-filters-button.tsx
955
+ import * as React9 from "react";
956
+ import { BrushBigIcon } from "@elementor/icons";
957
+ import { Box as Box3, IconButton as IconButton2, Tooltip } from "@elementor/ui";
958
+ function ContentPanelClearFiltersButton({ ariaLabel, onClear, sx, tooltipText }) {
959
+ return /* @__PURE__ */ React9.createElement(Tooltip, { disableInteractive: true, placement: "top", title: tooltipText }, /* @__PURE__ */ React9.createElement(Box3, null, /* @__PURE__ */ React9.createElement(IconButton2, { "aria-label": ariaLabel, onClick: onClear, size: "tiny", sx }, /* @__PURE__ */ React9.createElement(BrushBigIcon, { fontSize: "tiny" }))));
960
+ }
961
+
962
+ // src/components/panel/content-panel-active-filters.tsx
963
+ var contentPanelFilterChipSx = {
964
+ "& .MuiChip-deleteIcon": {
965
+ display: "none",
966
+ transition: "opacity 0.2s"
967
+ },
968
+ "&:hover .MuiChip-deleteIcon": {
969
+ display: "block"
970
+ }
971
+ };
972
+ function ContentPanelActiveFilters() {
973
+ const { clearActiveToolbarFilters, setSiteContentSort, siteContentSort, statusFilters, toggleStatusFilter } = useSiteContentSectionToolbar();
974
+ const hasStatusFilters = hasActiveSiteContentStatusFilters(statusFilters);
975
+ const hasSort = hasActiveSiteContentSort(siteContentSort);
976
+ if (!hasStatusFilters && !hasSort) {
977
+ return null;
978
+ }
979
+ const activeKeys = getActiveSiteContentStatusFilterKeys(statusFilters);
980
+ return /* @__PURE__ */ React10.createElement(Stack, { alignItems: "center", direction: "row", justifyContent: "space-between" }, /* @__PURE__ */ React10.createElement(Stack, { alignItems: "center", direction: "row", flexWrap: "wrap", gap: 0.5 }, hasSort && /* @__PURE__ */ React10.createElement(
981
+ Chip,
982
+ {
983
+ label: getSiteContentSortLabel(siteContentSort),
984
+ onDelete: () => setSiteContentSort(DEFAULT_SITE_CONTENT_SORT),
985
+ size: "tiny",
986
+ sx: contentPanelFilterChipSx
987
+ }
988
+ ), activeKeys.map((key) => /* @__PURE__ */ React10.createElement(
989
+ Chip,
990
+ {
991
+ key,
992
+ label: getSiteContentStatusFilterLabel(key),
993
+ onDelete: () => toggleStatusFilter(key),
994
+ size: "tiny",
995
+ sx: contentPanelFilterChipSx
996
+ }
997
+ ))), /* @__PURE__ */ React10.createElement(
998
+ ContentPanelClearFiltersButton,
999
+ {
1000
+ ariaLabel: __7("Clear Filters", "elementor"),
1001
+ onClear: clearActiveToolbarFilters,
1002
+ sx: { margin: "0 0 auto auto" },
1003
+ tooltipText: __7("Clear Filters", "elementor")
1004
+ }
1005
+ ));
1006
+ }
1007
+
1008
+ // src/components/panel/content-panel-search.tsx
1009
+ import * as React11 from "react";
1010
+ import { SearchIcon } from "@elementor/icons";
1011
+ import { Box as Box4, InputAdornment, TextField } from "@elementor/ui";
1012
+ import { __ as __8 } from "@wordpress/i18n";
1013
+ function ContentPanelSearch({ searchAriaLabel }) {
1014
+ const { searchQuery, setSearchQuery } = useSiteContentSectionToolbar();
1015
+ const ariaLabel = searchAriaLabel ?? __8("Search site content", "elementor");
1016
+ return /* @__PURE__ */ React11.createElement(Box4, { component: "search", "aria-label": ariaLabel }, /* @__PURE__ */ React11.createElement(
1017
+ TextField,
1018
+ {
1019
+ fullWidth: true,
1020
+ size: "tiny",
1021
+ value: searchQuery,
1022
+ placeholder: __8("Search", "elementor"),
1023
+ onChange: (event) => setSearchQuery(event.target.value),
1024
+ inputProps: {
1025
+ "aria-label": __8("Search", "elementor")
1026
+ },
1027
+ InputProps: {
1028
+ startAdornment: /* @__PURE__ */ React11.createElement(InputAdornment, { position: "start" }, /* @__PURE__ */ React11.createElement(SearchIcon, { fontSize: "tiny" }))
1029
+ }
1030
+ }
1031
+ ));
1032
+ }
1033
+
1034
+ // src/components/panel/content-panel-sort.tsx
1035
+ import * as React13 from "react";
1036
+ import { PopoverBody, PopoverHeader } from "@elementor/editor-ui";
1037
+ import { ArrowsSortIcon } from "@elementor/icons";
1038
+ import { bindPopover, bindToggle, Divider, Popover, ToggleButton, Tooltip as Tooltip2, usePopupState as usePopupState2 } from "@elementor/ui";
1039
+ import { __ as __9 } from "@wordpress/i18n";
1040
+
1041
+ // src/components/panel/content-panel-sort-list.tsx
1042
+ import * as React12 from "react";
1043
+ import { CheckIcon } from "@elementor/icons";
1044
+ import { MenuItem as MenuItem3, MenuList, Stack as Stack2, Typography as Typography2 } from "@elementor/ui";
1045
+ var renderSortMenuItemContent = (label, selected) => /* @__PURE__ */ React12.createElement(Stack2, { alignItems: "center", direction: "row", gap: 1, width: "100%" }, /* @__PURE__ */ React12.createElement(Typography2, { sx: { color: "text.secondary", flex: 1 }, variant: "caption" }, label), selected ? /* @__PURE__ */ React12.createElement(CheckIcon, { "aria-hidden": true, fontSize: "tiny" }) : null);
1046
+ function ContentPanelSortList() {
1047
+ const { setSiteContentSort, siteContentSort } = useSiteContentSectionToolbar();
1048
+ return /* @__PURE__ */ React12.createElement(MenuList, { dense: true }, SITE_CONTENT_SORT_OPTIONS.map((option) => {
1049
+ const isSelected = siteContentSort === option;
1050
+ return /* @__PURE__ */ React12.createElement(
1051
+ MenuItem3,
1052
+ {
1053
+ key: option,
1054
+ "aria-checked": isSelected,
1055
+ onClick: () => setSiteContentSort(option),
1056
+ role: "menuitemradio",
1057
+ selected: isSelected
1058
+ },
1059
+ renderSortMenuItemContent(getSiteContentSortLabel(option), isSelected)
1060
+ );
1061
+ }));
1062
+ }
1063
+
1064
+ // src/components/panel/content-panel-sort.tsx
1065
+ function ContentPanelSort() {
1066
+ const { clearSiteContentSort, siteContentSort } = useSiteContentSectionToolbar();
1067
+ const popupState = usePopupState2({
1068
+ variant: "popover",
1069
+ disableAutoFocus: true
1070
+ });
1071
+ const hasActiveSort = hasActiveSiteContentSort(siteContentSort);
1072
+ return /* @__PURE__ */ React13.createElement(React13.Fragment, null, /* @__PURE__ */ React13.createElement(Tooltip2, { placement: "top", title: __9("Sort", "elementor") }, /* @__PURE__ */ React13.createElement(
1073
+ ToggleButton,
1074
+ {
1075
+ "aria-label": __9("Sort", "elementor"),
1076
+ selected: popupState.isOpen || hasActiveSort,
1077
+ size: "tiny",
1078
+ value: "sort",
1079
+ ...bindToggle(popupState)
1080
+ },
1081
+ /* @__PURE__ */ React13.createElement(ArrowsSortIcon, { fontSize: "tiny" })
1082
+ )), /* @__PURE__ */ React13.createElement(
1083
+ Popover,
1084
+ {
1085
+ anchorOrigin: {
1086
+ horizontal: "right",
1087
+ vertical: "top"
1088
+ },
1089
+ sx: {
1090
+ maxWidth: `${SITE_CONTENT_SORT_POPOVER_WIDTH_PX}px`
1091
+ },
1092
+ transformOrigin: {
1093
+ horizontal: -21,
1094
+ vertical: "top"
1095
+ },
1096
+ ...bindPopover(popupState)
1097
+ },
1098
+ /* @__PURE__ */ React13.createElement(
1099
+ PopoverHeader,
1100
+ {
1101
+ actions: hasActiveSort ? [
1102
+ /* @__PURE__ */ React13.createElement(
1103
+ ContentPanelClearFiltersButton,
1104
+ {
1105
+ ariaLabel: __9("Clear sort", "elementor"),
1106
+ key: "clear-sort",
1107
+ onClear: clearSiteContentSort,
1108
+ tooltipText: __9("Clear sort", "elementor")
1109
+ }
1110
+ )
1111
+ ] : [],
1112
+ icon: /* @__PURE__ */ React13.createElement(ArrowsSortIcon, { fontSize: "tiny" }),
1113
+ onClose: popupState.close,
1114
+ title: __9("Sort", "elementor")
1115
+ }
1116
+ ),
1117
+ /* @__PURE__ */ React13.createElement(Divider, { sx: { borderWidth: "1px 0 0 0" } }),
1118
+ /* @__PURE__ */ React13.createElement(PopoverBody, { height: "auto", width: SITE_CONTENT_SORT_POPOVER_WIDTH_PX }, /* @__PURE__ */ React13.createElement(ContentPanelSortList, null))
1119
+ ));
1120
+ }
1121
+
1122
+ // src/components/panel/content-panel-status-filter.tsx
1123
+ import * as React15 from "react";
1124
+ import { PopoverBody as PopoverBody2, PopoverHeader as PopoverHeader2 } from "@elementor/editor-ui";
1125
+ import { FilterIcon } from "@elementor/icons";
1126
+ import { bindPopover as bindPopover2, bindToggle as bindToggle2, Divider as Divider2, Popover as Popover2, ToggleButton as ToggleButton2, Tooltip as Tooltip3, usePopupState as usePopupState3 } from "@elementor/ui";
1127
+ import { __ as __10 } from "@wordpress/i18n";
1128
+
1129
+ // src/components/panel/content-panel-status-filter-list.tsx
1130
+ import * as React14 from "react";
1131
+ import { CheckIcon as CheckIcon2 } from "@elementor/icons";
1132
+ import { MenuItem as MenuItem4, MenuList as MenuList2, Stack as Stack3, Typography as Typography3 } from "@elementor/ui";
1133
+
1134
+ // src/hooks/use-site-content-status-filter-counts.ts
1135
+ import { useQuery as useQuery4 } from "@elementor/query";
1136
+ var STATUS_FILTER_COUNTS_STALE_TIME_MS = 30 * 1e3;
1137
+ var siteContentStatusFilterCountsQueryKeyBase = ["site-navigation", "status-filter-counts"];
1138
+ var siteContentStatusFilterCountsQueryKey = (postTypes) => [
1139
+ ...siteContentStatusFilterCountsQueryKeyBase,
1140
+ postTypes.join(",")
1141
+ ];
1142
+ var sumFulfilledTotals = (results) => {
1143
+ const fulfilled = results.filter(
1144
+ (result) => "fulfilled" === result.status
1145
+ );
1146
+ if (fulfilled.length !== results.length) {
1147
+ return void 0;
1153
1148
  }
1154
- const flattened = [];
1155
- const seenIds = /* @__PURE__ */ new Set();
1156
- data.pages.forEach((page) => {
1157
- page.data.forEach((post) => {
1158
- if (seenIds.has(post.id)) {
1159
- return;
1149
+ return fulfilled.reduce((sum, result) => sum + result.value, 0);
1150
+ };
1151
+ var fetchStatusFilterCounts = async (postTypes) => {
1152
+ const entries = await Promise.all(
1153
+ SITE_CONTENT_SELECTABLE_STATUS_FILTERS.map(async (status) => {
1154
+ const results = await Promise.allSettled(postTypes.map((slug) => fetchPostsTotal(slug, status)));
1155
+ const total = sumFulfilledTotals(results);
1156
+ if (void 0 === total) {
1157
+ return null;
1160
1158
  }
1161
- seenIds.add(post.id);
1162
- flattened.push(post);
1163
- });
1164
- });
1165
- return flattened;
1159
+ return [status, total];
1160
+ })
1161
+ );
1162
+ return Object.fromEntries(entries.filter((entry) => null !== entry));
1166
1163
  };
1167
- function usePosts(postTypeSlug, search = "", statusFilters = EMPTY_SITE_CONTENT_STATUS_FILTERS, sort = DEFAULT_SITE_CONTENT_SORT) {
1168
- const trimmedSearch = search.trim();
1169
- const restStatus = getRestStatusForSiteContentFilters(statusFilters);
1170
- const query = useInfiniteQuery({
1171
- queryKey: postsQueryKey(postTypeSlug, trimmedSearch, restStatus, sort),
1172
- queryFn: ({ pageParam = 1 }) => getRequest(postTypeSlug, pageParam, trimmedSearch, restStatus, POST_PER_PAGE, sort),
1173
- initialPageParam: 1,
1174
- getNextPageParam: (lastPage) => {
1175
- return lastPage.currentPage < lastPage.totalPages ? lastPage.currentPage + 1 : void 0;
1176
- },
1177
- placeholderData: keepPreviousData
1164
+ function useSiteContentStatusFilterCounts(postTypes, enabled) {
1165
+ return useQuery4({
1166
+ enabled: enabled && postTypes.length > 0,
1167
+ queryFn: () => fetchStatusFilterCounts(postTypes),
1168
+ queryKey: siteContentStatusFilterCountsQueryKey(postTypes),
1169
+ staleTime: STATUS_FILTER_COUNTS_STALE_TIME_MS
1178
1170
  });
1179
- return { ...query, data: { posts: flattenData(query.data), total: query.data?.pages[0]?.totalPosts ?? 0 } };
1180
1171
  }
1181
1172
 
1182
- // src/hooks/use-posts-baseline-total.ts
1183
- import { useQuery as useQuery4 } from "@elementor/query";
1184
- var postsBaselineTotalQueryKeyBase = (postTypeSlug) => [
1185
- "site-navigation",
1186
- "posts-baseline-total",
1187
- postTypeSlug
1188
- ];
1189
- var postsBaselineTotalQueryKey = (postTypeSlug, status = "any") => [
1190
- ...postsBaselineTotalQueryKeyBase(postTypeSlug),
1191
- status
1192
- ];
1193
- function usePostsBaselineTotal(postTypeSlug, enabled, status = "any") {
1194
- return useQuery4({
1195
- enabled,
1196
- queryFn: () => fetchPostsTotal(postTypeSlug, status),
1197
- queryKey: postsBaselineTotalQueryKey(postTypeSlug, status)
1173
+ // src/components/panel/content-panel-status-filter-list.tsx
1174
+ var renderFilterMenuItemContent = (label, selected) => /* @__PURE__ */ React14.createElement(Stack3, { alignItems: "center", direction: "row", gap: 1, width: "100%" }, /* @__PURE__ */ React14.createElement(Typography3, { sx: { color: "text.secondary", flex: 1 }, variant: "caption" }, label), selected ? /* @__PURE__ */ React14.createElement(CheckIcon2, { "aria-hidden": true, fontSize: "tiny" }) : null);
1175
+ function ContentPanelStatusFilterList({ loadCounts }) {
1176
+ const {
1177
+ clearStatusFilters,
1178
+ statusFilterCountSlugs,
1179
+ statusFilterCounts: presetStatusCounts,
1180
+ statusFilterCountsPending,
1181
+ statusFilters,
1182
+ toggleStatusFilter
1183
+ } = useSiteContentSectionToolbar();
1184
+ const shouldLoadPostTypeCounts = loadCounts && statusFilterCountSlugs.length > 0 && !presetStatusCounts;
1185
+ const { data: fetchedStatusCounts, isPending: isFetchingStatusCounts } = useSiteContentStatusFilterCounts(
1186
+ statusFilterCountSlugs,
1187
+ shouldLoadPostTypeCounts
1188
+ );
1189
+ const statusCounts = presetStatusCounts ?? fetchedStatusCounts;
1190
+ const isLoadingCounts = Boolean(presetStatusCounts ? statusFilterCountsPending : isFetchingStatusCounts);
1191
+ const isAllSelected = !hasActiveSiteContentStatusFilters(statusFilters);
1192
+ const visibleFilters = statusFilterCountSlugs.length === 0 ? SITE_CONTENT_SELECTABLE_STATUS_FILTERS : SITE_CONTENT_SELECTABLE_STATUS_FILTERS.filter(
1193
+ (filter) => shouldShowSiteContentStatusFilterRow(
1194
+ statusCounts?.[filter],
1195
+ isLoadingCounts,
1196
+ statusFilters[filter]
1197
+ )
1198
+ );
1199
+ return /* @__PURE__ */ React14.createElement(MenuList2, { dense: true }, /* @__PURE__ */ React14.createElement(
1200
+ MenuItem4,
1201
+ {
1202
+ "aria-checked": isAllSelected,
1203
+ onClick: clearStatusFilters,
1204
+ role: "menuitemcheckbox",
1205
+ selected: isAllSelected
1206
+ },
1207
+ renderFilterMenuItemContent(SITE_CONTENT_ALL_FILTER_LABEL, isAllSelected)
1208
+ ), visibleFilters.map((filter) => {
1209
+ const isSelected = statusFilters[filter];
1210
+ return /* @__PURE__ */ React14.createElement(
1211
+ MenuItem4,
1212
+ {
1213
+ key: filter,
1214
+ "aria-checked": isSelected,
1215
+ onClick: () => toggleStatusFilter(filter),
1216
+ role: "menuitemcheckbox",
1217
+ selected: isSelected
1218
+ },
1219
+ renderFilterMenuItemContent(getSiteContentStatusFilterLabel(filter), isSelected)
1220
+ );
1221
+ }));
1222
+ }
1223
+
1224
+ // src/components/panel/content-panel-status-filter.tsx
1225
+ function ContentPanelStatusFilter() {
1226
+ const { clearStatusFilters, statusFilters } = useSiteContentSectionToolbar();
1227
+ const popupState = usePopupState3({
1228
+ variant: "popover",
1229
+ disableAutoFocus: true
1198
1230
  });
1231
+ const hasActiveFilters = hasActiveSiteContentStatusFilters(statusFilters);
1232
+ return /* @__PURE__ */ React15.createElement(React15.Fragment, null, /* @__PURE__ */ React15.createElement(Tooltip3, { placement: "top", title: __10("Filters", "elementor") }, /* @__PURE__ */ React15.createElement(
1233
+ ToggleButton2,
1234
+ {
1235
+ "aria-label": __10("Filters", "elementor"),
1236
+ selected: popupState.isOpen || hasActiveFilters,
1237
+ size: "tiny",
1238
+ value: "filter",
1239
+ ...bindToggle2(popupState)
1240
+ },
1241
+ /* @__PURE__ */ React15.createElement(FilterIcon, { fontSize: "tiny" })
1242
+ )), /* @__PURE__ */ React15.createElement(
1243
+ Popover2,
1244
+ {
1245
+ anchorOrigin: {
1246
+ horizontal: "right",
1247
+ vertical: "top"
1248
+ },
1249
+ sx: {
1250
+ maxWidth: `${SITE_CONTENT_FILTER_POPOVER_WIDTH_PX}px`
1251
+ },
1252
+ transformOrigin: {
1253
+ horizontal: -21,
1254
+ vertical: "top"
1255
+ },
1256
+ ...bindPopover2(popupState)
1257
+ },
1258
+ /* @__PURE__ */ React15.createElement(
1259
+ PopoverHeader2,
1260
+ {
1261
+ actions: hasActiveFilters ? [
1262
+ /* @__PURE__ */ React15.createElement(
1263
+ ContentPanelClearFiltersButton,
1264
+ {
1265
+ ariaLabel: __10("Clear all", "elementor"),
1266
+ key: "clear-all-filters",
1267
+ onClear: clearStatusFilters,
1268
+ tooltipText: __10("Clear all", "elementor")
1269
+ }
1270
+ )
1271
+ ] : [],
1272
+ icon: /* @__PURE__ */ React15.createElement(FilterIcon, { fontSize: "tiny" }),
1273
+ onClose: popupState.close,
1274
+ title: __10("Filters", "elementor")
1275
+ }
1276
+ ),
1277
+ /* @__PURE__ */ React15.createElement(Divider2, { sx: { borderWidth: "1px 0 0 0" } }),
1278
+ /* @__PURE__ */ React15.createElement(PopoverBody2, { height: "auto", width: SITE_CONTENT_FILTER_POPOVER_WIDTH_PX }, /* @__PURE__ */ React15.createElement(ContentPanelStatusFilterList, { loadCounts: popupState.isOpen }))
1279
+ ));
1280
+ }
1281
+
1282
+ // src/components/panel/content-panel-section-toolbar.tsx
1283
+ function ContentPanelSectionToolbar({ addAction, searchAriaLabel }) {
1284
+ return /* @__PURE__ */ React16.createElement(Box5, { sx: contentPanelSearchBoxSx }, /* @__PURE__ */ React16.createElement(Stack4, { gap: 0.75, width: "100%" }, /* @__PURE__ */ React16.createElement(Stack4, { alignItems: "center", direction: "row", gap: 0.5, width: "100%" }, /* @__PURE__ */ React16.createElement(Box5, { sx: { flexGrow: 1, minWidth: 0 } }, /* @__PURE__ */ React16.createElement(ContentPanelSearch, { searchAriaLabel })), /* @__PURE__ */ React16.createElement(ContentPanelStatusFilter, null), /* @__PURE__ */ React16.createElement(ContentPanelSort, null), addAction), /* @__PURE__ */ React16.createElement(ContentPanelActiveFilters, null)));
1199
1285
  }
1200
1286
 
1201
1287
  // src/components/panel/section-add-button.tsx
1202
- import * as React16 from "react";
1288
+ import * as React17 from "react";
1203
1289
  import { __ as __11, sprintf } from "@wordpress/i18n";
1204
1290
  function SectionAddButton({ onBeforeCreate }) {
1205
1291
  const { type, setEditMode } = usePostListContext();
@@ -1210,7 +1296,7 @@ function SectionAddButton({ onBeforeCreate }) {
1210
1296
  __11("New %s", "elementor"),
1211
1297
  singularName
1212
1298
  );
1213
- return /* @__PURE__ */ React16.createElement(
1299
+ return /* @__PURE__ */ React17.createElement(
1214
1300
  ContentPanelAddIconButton,
1215
1301
  {
1216
1302
  "aria-label": ariaLabel,
@@ -1225,7 +1311,7 @@ function SectionAddButton({ onBeforeCreate }) {
1225
1311
  }
1226
1312
 
1227
1313
  // src/components/panel/posts-list/collapsible-list.tsx
1228
- import * as React17 from "react";
1314
+ import * as React18 from "react";
1229
1315
  import { useId } from "react";
1230
1316
  import { CollapseIcon } from "@elementor/editor-ui";
1231
1317
  import { Box as Box6, Chip as Chip2, Collapse, Divider as Divider3, List, ListItemButton, ListItemText as ListItemText3, Stack as Stack5 } from "@elementor/ui";
@@ -1247,6 +1333,7 @@ function CollapsibleList({
1247
1333
  headerRef,
1248
1334
  isOpen,
1249
1335
  onOpenChange,
1336
+ sectionToolbar,
1250
1337
  title,
1251
1338
  trailingActions,
1252
1339
  children
@@ -1257,7 +1344,7 @@ function CollapsibleList({
1257
1344
  const chipLabel = countChipLabel ?? count.toString();
1258
1345
  const sectionHeaderAriaLabel = getSectionHeaderAriaLabel(title, chipLabel);
1259
1346
  const handleClick = () => onOpenChange(!isOpen);
1260
- return /* @__PURE__ */ React17.createElement(React17.Fragment, null, /* @__PURE__ */ React17.createElement(
1347
+ return /* @__PURE__ */ React18.createElement(React18.Fragment, null, /* @__PURE__ */ React18.createElement(
1261
1348
  Box6,
1262
1349
  {
1263
1350
  sx: {
@@ -1268,7 +1355,7 @@ function CollapsibleList({
1268
1355
  width: "100%"
1269
1356
  }
1270
1357
  },
1271
- /* @__PURE__ */ React17.createElement(
1358
+ /* @__PURE__ */ React18.createElement(
1272
1359
  ListItemButton,
1273
1360
  {
1274
1361
  ref: headerRef,
@@ -1282,7 +1369,7 @@ function CollapsibleList({
1282
1369
  onClick: handleClick,
1283
1370
  sx: sectionHeaderListItemButtonSx
1284
1371
  },
1285
- /* @__PURE__ */ React17.createElement(Stack5, { alignItems: "center", direction: "row", flexGrow: 1, gap: 0.5, minWidth: 0, width: "100%" }, /* @__PURE__ */ React17.createElement(Stack5, { alignItems: "center", direction: "row", flex: 1, gap: 0.5, minWidth: 0 }, /* @__PURE__ */ React17.createElement(
1372
+ /* @__PURE__ */ React18.createElement(Stack5, { alignItems: "center", direction: "row", flexGrow: 1, gap: 0.5, minWidth: 0, width: "100%" }, /* @__PURE__ */ React18.createElement(Stack5, { alignItems: "center", direction: "row", flex: 1, gap: 0.5, minWidth: 0 }, /* @__PURE__ */ React18.createElement(
1286
1373
  ListItemText3,
1287
1374
  {
1288
1375
  secondary: title,
@@ -1293,9 +1380,9 @@ function CollapsibleList({
1293
1380
  },
1294
1381
  sx: { flexGrow: 0, flexShrink: 1, marginInlineEnd: 1 }
1295
1382
  }
1296
- ), /* @__PURE__ */ React17.createElement(Chip2, { label: chipLabel, size: "tiny" })), /* @__PURE__ */ React17.createElement(CollapseIcon, { color: "secondary", fontSize: "tiny", open: isOpen, sx: { flexShrink: 0 } }))
1383
+ ), /* @__PURE__ */ React18.createElement(Chip2, { label: chipLabel, size: "tiny" })), /* @__PURE__ */ React18.createElement(CollapseIcon, { color: "secondary", fontSize: "tiny", open: isOpen, sx: { flexShrink: 0 } }))
1297
1384
  ),
1298
- trailingActions && /* @__PURE__ */ React17.createElement(
1385
+ trailingActions && /* @__PURE__ */ React18.createElement(
1299
1386
  Stack5,
1300
1387
  {
1301
1388
  alignItems: "center",
@@ -1306,16 +1393,16 @@ function CollapsibleList({
1306
1393
  },
1307
1394
  trailingActions
1308
1395
  )
1309
- ), /* @__PURE__ */ React17.createElement(Collapse, { "aria-labelledby": labelId, id: contentId, in: isOpen, timeout: "auto", unmountOnExit: true }, /* @__PURE__ */ React17.createElement(List, { dense: true, disablePadding: true, sx: contentPanelListSectionListSx }, children)), /* @__PURE__ */ React17.createElement(Divider3, null));
1396
+ ), isOpen && sectionToolbar, /* @__PURE__ */ React18.createElement(Collapse, { "aria-labelledby": labelId, id: contentId, in: isOpen, timeout: "auto", unmountOnExit: true }, /* @__PURE__ */ React18.createElement(List, { dense: true, disablePadding: true, sx: contentPanelListSectionListSx }, children)), /* @__PURE__ */ React18.createElement(Divider3, null));
1310
1397
  }
1311
1398
 
1312
1399
  // src/components/panel/posts-list/error-state.tsx
1313
- import * as React18 from "react";
1400
+ import * as React19 from "react";
1314
1401
  import { Error404TemplateIcon } from "@elementor/icons";
1315
1402
  import { Box as Box7, Link, Typography as Typography4 } from "@elementor/ui";
1316
1403
  import { __ as __12 } from "@wordpress/i18n";
1317
1404
  function ErrorState() {
1318
- return /* @__PURE__ */ React18.createElement(
1405
+ return /* @__PURE__ */ React19.createElement(
1319
1406
  Box7,
1320
1407
  {
1321
1408
  sx: {
@@ -1327,8 +1414,8 @@ function ErrorState() {
1327
1414
  gap: "16px"
1328
1415
  }
1329
1416
  },
1330
- /* @__PURE__ */ React18.createElement(Error404TemplateIcon, null),
1331
- /* @__PURE__ */ React18.createElement(
1417
+ /* @__PURE__ */ React19.createElement(Error404TemplateIcon, null),
1418
+ /* @__PURE__ */ React19.createElement(
1332
1419
  Box7,
1333
1420
  {
1334
1421
  sx: {
@@ -1339,17 +1426,17 @@ function ErrorState() {
1339
1426
  gap: "8px"
1340
1427
  }
1341
1428
  },
1342
- /* @__PURE__ */ React18.createElement(Typography4, { variant: "body1", color: "text.primary" }, __12("We couldn\u2019t display your pages.", "elementor")),
1343
- /* @__PURE__ */ React18.createElement(Box7, null, /* @__PURE__ */ React18.createElement(Typography4, { variant: "body2", color: "text.primary", sx: { textAlign: "center" } }, __12("It\u2019s probably a temporary issue.", "elementor")), /* @__PURE__ */ React18.createElement(Typography4, { variant: "body2", color: "text.primary", sx: { textAlign: "center" } }, __12("If the problem persists,", "elementor"), " ", /* @__PURE__ */ React18.createElement(Link, { target: "_blank", href: "https://go.elementor.com/wp-editor-support-open-ticket/" }, "Notify support")))
1429
+ /* @__PURE__ */ React19.createElement(Typography4, { variant: "body1", color: "text.primary" }, __12("We couldn\u2019t display your pages.", "elementor")),
1430
+ /* @__PURE__ */ React19.createElement(Box7, null, /* @__PURE__ */ React19.createElement(Typography4, { variant: "body2", color: "text.primary", sx: { textAlign: "center" } }, __12("It\u2019s probably a temporary issue.", "elementor")), /* @__PURE__ */ React19.createElement(Typography4, { variant: "body2", color: "text.primary", sx: { textAlign: "center" } }, __12("If the problem persists,", "elementor"), " ", /* @__PURE__ */ React19.createElement(Link, { target: "_blank", href: "https://go.elementor.com/wp-editor-support-open-ticket/" }, "Notify support")))
1344
1431
  )
1345
1432
  );
1346
1433
  }
1347
1434
 
1348
1435
  // src/components/panel/posts-list/post-list-item.tsx
1349
- import * as React33 from "react";
1436
+ import * as React34 from "react";
1350
1437
 
1351
1438
  // src/components/panel/posts-list/list-items/list-item-create.tsx
1352
- import * as React20 from "react";
1439
+ import * as React21 from "react";
1353
1440
  import { __useNavigateToDocument as useNavigateToDocument } from "@elementor/editor-documents";
1354
1441
  import { __ as __14, sprintf as sprintf2 } from "@wordpress/i18n";
1355
1442
 
@@ -1432,7 +1519,7 @@ function useInvalidatePosts(postTypeSlug) {
1432
1519
  }
1433
1520
 
1434
1521
  // src/components/panel/posts-list/list-items/edit-mode-template.tsx
1435
- import * as React19 from "react";
1522
+ import * as React20 from "react";
1436
1523
  import { useRef as useRef4, useState as useState5 } from "react";
1437
1524
  import { XIcon } from "@elementor/icons";
1438
1525
  import { Box as Box8, CircularProgress, IconButton as IconButton3, ListItem, ListItemText as ListItemText4 } from "@elementor/ui";
@@ -1480,6 +1567,7 @@ function EditModeTemplate({ postTitle, isLoading, callback, onDismiss }) {
1480
1567
  const [touched, setTouched] = useState5(false);
1481
1568
  const [inputError, setInputError] = useState5(null);
1482
1569
  const closeButton = useRef4();
1570
+ const hasSubmittedRef = useRef4(false);
1483
1571
  const onBlur = (e) => {
1484
1572
  if (closeButton.current === e.relatedTarget) {
1485
1573
  return;
@@ -1498,9 +1586,13 @@ function EditModeTemplate({ postTitle, isLoading, callback, onDismiss }) {
1498
1586
  return input.trim() !== "";
1499
1587
  };
1500
1588
  const runCallback = () => {
1589
+ if (hasSubmittedRef.current || isLoading) {
1590
+ return;
1591
+ }
1501
1592
  if (!validateInput(title)) {
1502
1593
  return;
1503
1594
  }
1595
+ hasSubmittedRef.current = true;
1504
1596
  callback(title);
1505
1597
  };
1506
1598
  const onChange = (e) => {
@@ -1515,21 +1607,21 @@ function EditModeTemplate({ postTitle, isLoading, callback, onDismiss }) {
1515
1607
  }
1516
1608
  setTitle(value);
1517
1609
  };
1518
- return /* @__PURE__ */ React19.createElement(React19.Fragment, null, /* @__PURE__ */ React19.createElement(
1610
+ return /* @__PURE__ */ React20.createElement(React20.Fragment, null, /* @__PURE__ */ React20.createElement(
1519
1611
  ListItem,
1520
1612
  {
1521
1613
  disablePadding: true,
1522
1614
  sx: contentPanelListRowPaddingSx,
1523
- secondaryAction: /* @__PURE__ */ React19.createElement(CloseButton, { isLoading, closeButton, onDismiss: dismissEditMode })
1615
+ secondaryAction: /* @__PURE__ */ React20.createElement(CloseButton, { isLoading, closeButton, onDismiss: dismissEditMode })
1524
1616
  },
1525
- /* @__PURE__ */ React19.createElement(
1617
+ /* @__PURE__ */ React20.createElement(
1526
1618
  Box8,
1527
1619
  {
1528
1620
  component: "form",
1529
1621
  onSubmit: onFormSubmit,
1530
1622
  sx: { ...editModeListItemButtonSx, display: "flex", width: "100%" }
1531
1623
  },
1532
- /* @__PURE__ */ React19.createElement(Box8, { sx: editRowIndicatorSx(!!inputError) }, /* @__PURE__ */ React19.createElement(
1624
+ /* @__PURE__ */ React20.createElement(Box8, { sx: editRowIndicatorSx(!!inputError) }, /* @__PURE__ */ React20.createElement(
1533
1625
  Box8,
1534
1626
  {
1535
1627
  autoFocus: true,
@@ -1545,10 +1637,10 @@ function EditModeTemplate({ postTitle, isLoading, callback, onDismiss }) {
1545
1637
  }
1546
1638
  ))
1547
1639
  )
1548
- ), inputError && /* @__PURE__ */ React19.createElement(ListItem, { disablePadding: true, sx: contentPanelListRowPaddingSx }, /* @__PURE__ */ React19.createElement(ListItemText4, { sx: { color: "error.main", ...contentPanelListRowTitleSx } }, inputError)));
1640
+ ), inputError && /* @__PURE__ */ React20.createElement(ListItem, { disablePadding: true, sx: contentPanelListRowPaddingSx }, /* @__PURE__ */ React20.createElement(ListItemText4, { sx: { color: "error.main", ...contentPanelListRowTitleSx } }, inputError)));
1549
1641
  }
1550
1642
  function CloseButton({ isLoading, closeButton, onDismiss }) {
1551
- return /* @__PURE__ */ React19.createElement(IconButton3, { size: "tiny", color: "secondary", onClick: onDismiss, ref: closeButton, disabled: isLoading }, isLoading ? /* @__PURE__ */ React19.createElement(CircularProgress, { size: "1rem" }) : /* @__PURE__ */ React19.createElement(XIcon, { fontSize: "tiny" }));
1643
+ return /* @__PURE__ */ React20.createElement(IconButton3, { size: "tiny", color: "secondary", onClick: onDismiss, ref: closeButton, disabled: isLoading }, isLoading ? /* @__PURE__ */ React20.createElement(CircularProgress, { size: "1rem" }) : /* @__PURE__ */ React20.createElement(XIcon, { fontSize: "tiny" }));
1552
1644
  }
1553
1645
 
1554
1646
  // src/components/panel/posts-list/list-items/list-item-create.tsx
@@ -1563,6 +1655,7 @@ function ListItemCreate() {
1563
1655
  title: inputValue,
1564
1656
  status: "draft"
1565
1657
  });
1658
+ resetEditMode();
1566
1659
  navigateToDocument(id);
1567
1660
  } catch {
1568
1661
  setError();
@@ -1575,7 +1668,7 @@ function ListItemCreate() {
1575
1668
  __14("New %s", "elementor"),
1576
1669
  postTypesMap[type].labels.singular_name
1577
1670
  );
1578
- return /* @__PURE__ */ React20.createElement(
1671
+ return /* @__PURE__ */ React21.createElement(
1579
1672
  EditModeTemplate,
1580
1673
  {
1581
1674
  postTitle: newItemLabel,
@@ -1586,7 +1679,7 @@ function ListItemCreate() {
1586
1679
  }
1587
1680
 
1588
1681
  // src/components/panel/posts-list/list-items/list-item-duplicate.tsx
1589
- import * as React21 from "react";
1682
+ import * as React22 from "react";
1590
1683
  import { __useNavigateToDocument as useNavigateToDocument2 } from "@elementor/editor-documents";
1591
1684
  import { __ as __15 } from "@wordpress/i18n";
1592
1685
  function ListItemDuplicate() {
@@ -1603,6 +1696,7 @@ function ListItemDuplicate() {
1603
1696
  id: editMode.details.postId,
1604
1697
  title: inputValue
1605
1698
  });
1699
+ resetEditMode();
1606
1700
  navigateToDocument(postId);
1607
1701
  } catch {
1608
1702
  setError();
@@ -1610,7 +1704,7 @@ function ListItemDuplicate() {
1610
1704
  resetEditMode();
1611
1705
  }
1612
1706
  };
1613
- return /* @__PURE__ */ React21.createElement(
1707
+ return /* @__PURE__ */ React22.createElement(
1614
1708
  EditModeTemplate,
1615
1709
  {
1616
1710
  postTitle: `${editMode.details.title} ${__15("copy", "elementor")}`,
@@ -1621,7 +1715,7 @@ function ListItemDuplicate() {
1621
1715
  }
1622
1716
 
1623
1717
  // src/components/panel/posts-list/list-items/list-item-rename.tsx
1624
- import * as React22 from "react";
1718
+ import * as React23 from "react";
1625
1719
  import { __useActiveDocument as useActiveDocument } from "@elementor/editor-documents";
1626
1720
 
1627
1721
  // src/hooks/use-rename-active-document.ts
@@ -1672,11 +1766,11 @@ function ListItemRename({ post }) {
1672
1766
  resetEditMode();
1673
1767
  }
1674
1768
  };
1675
- return /* @__PURE__ */ React22.createElement(EditModeTemplate, { postTitle: title, isLoading: updatePost.isPending, callback: renamePostCallback });
1769
+ return /* @__PURE__ */ React23.createElement(EditModeTemplate, { postTitle: title, isLoading: updatePost.isPending, callback: renamePostCallback });
1676
1770
  }
1677
1771
 
1678
1772
  // src/components/panel/posts-list/list-items/list-item-view.tsx
1679
- import * as React32 from "react";
1773
+ import * as React33 from "react";
1680
1774
  import { useState as useState8 } from "react";
1681
1775
  import {
1682
1776
  __useActiveDocument as useActiveDocument3,
@@ -1700,12 +1794,12 @@ import {
1700
1794
  import { __ as __24 } from "@wordpress/i18n";
1701
1795
 
1702
1796
  // src/components/shared/page-title-and-status.tsx
1703
- import * as React23 from "react";
1797
+ import * as React24 from "react";
1704
1798
  import { Box as Box9, Chip as Chip3, Typography as Typography5 } from "@elementor/ui";
1705
1799
  import { __ as __16 } from "@wordpress/i18n";
1706
1800
 
1707
1801
  // src/hooks/use-reverse-html-entities.ts
1708
- import { useMemo as useMemo3 } from "react";
1802
+ import { useMemo as useMemo4 } from "react";
1709
1803
 
1710
1804
  // src/utils/post-title-plain.ts
1711
1805
  function getPostTitlePlain(renderedTitle) {
@@ -1719,7 +1813,7 @@ function getPostTitlePlain(renderedTitle) {
1719
1813
 
1720
1814
  // src/hooks/use-reverse-html-entities.ts
1721
1815
  function useReverseHtmlEntities(escapedHTML = "") {
1722
- return useMemo3(() => getPostTitlePlain(escapedHTML), [escapedHTML]);
1816
+ return useMemo4(() => getPostTitlePlain(escapedHTML), [escapedHTML]);
1723
1817
  }
1724
1818
 
1725
1819
  // src/components/shared/page-title-and-status.tsx
@@ -1763,7 +1857,7 @@ var PageStatus = ({ status }) => {
1763
1857
  }
1764
1858
  const { color, label } = getStatusChipConfig(status);
1765
1859
  const isKnownStatus = isKnownPanelStatus(status);
1766
- return /* @__PURE__ */ React23.createElement(
1860
+ return /* @__PURE__ */ React24.createElement(
1767
1861
  Chip3,
1768
1862
  {
1769
1863
  color,
@@ -1786,14 +1880,15 @@ var PageStatus = ({ status }) => {
1786
1880
  }
1787
1881
  );
1788
1882
  };
1789
- var PageTitle = ({ title }) => {
1883
+ var PageTitle = ({ status, title }) => {
1790
1884
  const modifiedTitle = useReverseHtmlEntities(title);
1791
- return /* @__PURE__ */ React23.createElement(
1885
+ const titleColor = "trash" === status ? "text.disabled" : "text.secondary";
1886
+ return /* @__PURE__ */ React24.createElement(
1792
1887
  Typography5,
1793
1888
  {
1794
1889
  component: "span",
1795
1890
  variant: "body2",
1796
- color: "text.secondary",
1891
+ color: titleColor,
1797
1892
  noWrap: true,
1798
1893
  sx: {
1799
1894
  ...contentPanelListRowTitleSx,
@@ -1808,11 +1903,11 @@ var PageTitle = ({ title }) => {
1808
1903
  );
1809
1904
  };
1810
1905
  function PageTitleAndStatus({ title, status }) {
1811
- return /* @__PURE__ */ React23.createElement(Box9, { alignItems: "center", display: "flex", minWidth: 0, sx: { overflow: "hidden" } }, /* @__PURE__ */ React23.createElement(PageTitle, { title }), /* @__PURE__ */ React23.createElement(PageStatus, { status }));
1906
+ return /* @__PURE__ */ React24.createElement(Box9, { alignItems: "center", display: "flex", minWidth: 0, sx: { overflow: "hidden" } }, /* @__PURE__ */ React24.createElement(PageTitle, { status, title }), /* @__PURE__ */ React24.createElement(PageStatus, { status }));
1812
1907
  }
1813
1908
 
1814
1909
  // src/components/panel/actions-menu/actions/delete.tsx
1815
- import * as React25 from "react";
1910
+ import * as React26 from "react";
1816
1911
  import { useState as useState6 } from "react";
1817
1912
  import { __useActiveDocument as useActiveDocument2 } from "@elementor/editor-documents";
1818
1913
  import { TrashIcon } from "@elementor/icons";
@@ -1829,18 +1924,18 @@ import {
1829
1924
  import { __ as __17, sprintf as sprintf3 } from "@wordpress/i18n";
1830
1925
 
1831
1926
  // src/components/panel/actions-menu/action-menu-item.tsx
1832
- import * as React24 from "react";
1927
+ import * as React25 from "react";
1833
1928
  import { ListItemIcon as ListItemIcon3, ListItemText as ListItemText5, MenuItem as MenuItem5 } from "@elementor/ui";
1834
1929
  function ActionMenuItem({ description, icon: Icon, MenuItemProps, title }) {
1835
- return /* @__PURE__ */ React24.createElement(MenuItem5, { ...MenuItemProps }, /* @__PURE__ */ React24.createElement(
1930
+ return /* @__PURE__ */ React25.createElement(MenuItem5, { ...MenuItemProps }, /* @__PURE__ */ React25.createElement(
1836
1931
  ListItemIcon3,
1837
1932
  {
1838
1933
  sx: {
1839
1934
  color: "inherit"
1840
1935
  }
1841
1936
  },
1842
- /* @__PURE__ */ React24.createElement(Icon, null)
1843
- ), /* @__PURE__ */ React24.createElement(ListItemText5, { primary: title, secondary: description }));
1937
+ /* @__PURE__ */ React25.createElement(Icon, null)
1938
+ ), /* @__PURE__ */ React25.createElement(ListItemText5, { primary: title, secondary: description }));
1844
1939
  }
1845
1940
 
1846
1941
  // src/components/panel/actions-menu/actions/delete.tsx
@@ -1850,7 +1945,7 @@ function Delete({ post }) {
1850
1945
  const isPostActive = activeDocument?.id === post.id;
1851
1946
  const userCanDelete = post.user_can.delete;
1852
1947
  const isDisabled = !userCanDelete || post.isHome || isPostActive;
1853
- return /* @__PURE__ */ React25.createElement(React25.Fragment, null, /* @__PURE__ */ React25.createElement(
1948
+ return /* @__PURE__ */ React26.createElement(React26.Fragment, null, /* @__PURE__ */ React26.createElement(
1854
1949
  ActionMenuItem,
1855
1950
  {
1856
1951
  title: __17("Delete", "elementor"),
@@ -1861,7 +1956,7 @@ function Delete({ post }) {
1861
1956
  sx: { "&:hover": { color: "error.main" } }
1862
1957
  }
1863
1958
  }
1864
- ), isDialogOpen && /* @__PURE__ */ React25.createElement(DeleteDialog, { post, setIsDialogOpen }));
1959
+ ), isDialogOpen && /* @__PURE__ */ React26.createElement(DeleteDialog, { post, setIsDialogOpen }));
1865
1960
  }
1866
1961
  function DeleteDialog({
1867
1962
  post,
@@ -1892,7 +1987,7 @@ function DeleteDialog({
1892
1987
  }
1893
1988
  setIsDialogOpen(false);
1894
1989
  };
1895
- return /* @__PURE__ */ React25.createElement(Dialog, { open: true, onClose: handleCancel, "aria-labelledby": "delete-dialog" }, /* @__PURE__ */ React25.createElement(DialogTitle, { noWrap: true }, dialogTitle), /* @__PURE__ */ React25.createElement(Divider4, null), /* @__PURE__ */ React25.createElement(DialogContent, null, /* @__PURE__ */ React25.createElement(DialogContentText, null, dialogBody)), /* @__PURE__ */ React25.createElement(DialogActions, null, /* @__PURE__ */ React25.createElement(
1990
+ return /* @__PURE__ */ React26.createElement(Dialog, { open: true, onClose: handleCancel, "aria-labelledby": "delete-dialog" }, /* @__PURE__ */ React26.createElement(DialogTitle, { noWrap: true }, dialogTitle), /* @__PURE__ */ React26.createElement(Divider4, null), /* @__PURE__ */ React26.createElement(DialogContent, null, /* @__PURE__ */ React26.createElement(DialogContentText, null, dialogBody)), /* @__PURE__ */ React26.createElement(DialogActions, null, /* @__PURE__ */ React26.createElement(
1896
1991
  Button,
1897
1992
  {
1898
1993
  variant: "contained",
@@ -1901,11 +1996,11 @@ function DeleteDialog({
1901
1996
  disabled: deletePost.isPending
1902
1997
  },
1903
1998
  __17("Cancel", "elementor")
1904
- ), /* @__PURE__ */ React25.createElement(Button, { variant: "contained", color: "error", onClick: deletePage, disabled: deletePost.isPending }, !deletePost.isPending ? __17("Delete", "elementor") : /* @__PURE__ */ React25.createElement(CircularProgress2, null))));
1999
+ ), /* @__PURE__ */ React26.createElement(Button, { variant: "contained", color: "error", onClick: deletePage, disabled: deletePost.isPending }, !deletePost.isPending ? __17("Delete", "elementor") : /* @__PURE__ */ React26.createElement(CircularProgress2, null))));
1905
2000
  }
1906
2001
 
1907
2002
  // src/components/panel/actions-menu/actions/duplicate.tsx
1908
- import * as React26 from "react";
2003
+ import * as React27 from "react";
1909
2004
  import { CopyIcon } from "@elementor/icons";
1910
2005
  import { __ as __18 } from "@wordpress/i18n";
1911
2006
  function Duplicate({ post, popupState }) {
@@ -1922,7 +2017,7 @@ function Duplicate({ post, popupState }) {
1922
2017
  });
1923
2018
  };
1924
2019
  const isDisabled = !canCreate;
1925
- return /* @__PURE__ */ React26.createElement(
2020
+ return /* @__PURE__ */ React27.createElement(
1926
2021
  ActionMenuItem,
1927
2022
  {
1928
2023
  title: __18("Duplicate", "elementor"),
@@ -1936,7 +2031,7 @@ function Duplicate({ post, popupState }) {
1936
2031
  }
1937
2032
 
1938
2033
  // src/components/panel/actions-menu/actions/force-delete.tsx
1939
- import * as React27 from "react";
2034
+ import * as React28 from "react";
1940
2035
  import { useState as useState7 } from "react";
1941
2036
  import { TrashIcon as TrashIcon2 } from "@elementor/icons";
1942
2037
  import {
@@ -1952,7 +2047,7 @@ import {
1952
2047
  import { __ as __19, sprintf as sprintf4 } from "@wordpress/i18n";
1953
2048
  function ForceDelete({ post }) {
1954
2049
  const [isDialogOpen, setIsDialogOpen] = useState7(false);
1955
- return /* @__PURE__ */ React27.createElement(React27.Fragment, null, /* @__PURE__ */ React27.createElement(
2050
+ return /* @__PURE__ */ React28.createElement(React28.Fragment, null, /* @__PURE__ */ React28.createElement(
1956
2051
  ActionMenuItem,
1957
2052
  {
1958
2053
  icon: TrashIcon2,
@@ -1963,7 +2058,7 @@ function ForceDelete({ post }) {
1963
2058
  },
1964
2059
  title: __19("Delete permanently", "elementor")
1965
2060
  }
1966
- ), isDialogOpen && /* @__PURE__ */ React27.createElement(ForceDeleteDialog, { post, setIsDialogOpen }));
2061
+ ), isDialogOpen && /* @__PURE__ */ React28.createElement(ForceDeleteDialog, { post, setIsDialogOpen }));
1967
2062
  }
1968
2063
  function ForceDeleteDialog({
1969
2064
  post,
@@ -1988,7 +2083,7 @@ function ForceDeleteDialog({
1988
2083
  }
1989
2084
  setIsDialogOpen(false);
1990
2085
  };
1991
- return /* @__PURE__ */ React27.createElement(Dialog2, { "aria-labelledby": "force-delete-dialog", onClose: handleCancel, open: true }, /* @__PURE__ */ React27.createElement(DialogTitle2, { noWrap: true }, dialogTitle), /* @__PURE__ */ React27.createElement(Divider5, null), /* @__PURE__ */ React27.createElement(DialogContent2, null, /* @__PURE__ */ React27.createElement(DialogContentText2, null, dialogBody)), /* @__PURE__ */ React27.createElement(DialogActions2, null, /* @__PURE__ */ React27.createElement(
2086
+ return /* @__PURE__ */ React28.createElement(Dialog2, { "aria-labelledby": "force-delete-dialog", onClose: handleCancel, open: true }, /* @__PURE__ */ React28.createElement(DialogTitle2, { noWrap: true }, dialogTitle), /* @__PURE__ */ React28.createElement(Divider5, null), /* @__PURE__ */ React28.createElement(DialogContent2, null, /* @__PURE__ */ React28.createElement(DialogContentText2, null, dialogBody)), /* @__PURE__ */ React28.createElement(DialogActions2, null, /* @__PURE__ */ React28.createElement(
1992
2087
  Button2,
1993
2088
  {
1994
2089
  variant: "contained",
@@ -1997,7 +2092,7 @@ function ForceDeleteDialog({
1997
2092
  disabled: forceDeletePost.isPending
1998
2093
  },
1999
2094
  __19("Cancel", "elementor")
2000
- ), /* @__PURE__ */ React27.createElement(
2095
+ ), /* @__PURE__ */ React28.createElement(
2001
2096
  Button2,
2002
2097
  {
2003
2098
  variant: "contained",
@@ -2005,17 +2100,17 @@ function ForceDeleteDialog({
2005
2100
  onClick: () => void handleDelete(),
2006
2101
  disabled: forceDeletePost.isPending
2007
2102
  },
2008
- !forceDeletePost.isPending ? __19("Delete permanently", "elementor") : /* @__PURE__ */ React27.createElement(CircularProgress3, null)
2103
+ !forceDeletePost.isPending ? __19("Delete permanently", "elementor") : /* @__PURE__ */ React28.createElement(CircularProgress3, null)
2009
2104
  )));
2010
2105
  }
2011
2106
 
2012
2107
  // src/components/panel/actions-menu/actions/rename.tsx
2013
- import * as React28 from "react";
2108
+ import * as React29 from "react";
2014
2109
  import { EraseIcon } from "@elementor/icons";
2015
2110
  import { __ as __20 } from "@wordpress/i18n";
2016
2111
  function Rename({ post }) {
2017
2112
  const { setEditMode } = usePostListContext();
2018
- return /* @__PURE__ */ React28.createElement(
2113
+ return /* @__PURE__ */ React29.createElement(
2019
2114
  ActionMenuItem,
2020
2115
  {
2021
2116
  title: __20("Rename", "elementor"),
@@ -2036,7 +2131,7 @@ function Rename({ post }) {
2036
2131
  }
2037
2132
 
2038
2133
  // src/components/panel/actions-menu/actions/restore.tsx
2039
- import * as React29 from "react";
2134
+ import * as React30 from "react";
2040
2135
  import { RefreshIcon } from "@elementor/icons";
2041
2136
  import { __ as __21 } from "@wordpress/i18n";
2042
2137
  function Restore({ post }) {
@@ -2049,7 +2144,7 @@ function Restore({ post }) {
2049
2144
  setError();
2050
2145
  }
2051
2146
  };
2052
- return /* @__PURE__ */ React29.createElement(
2147
+ return /* @__PURE__ */ React30.createElement(
2053
2148
  ActionMenuItem,
2054
2149
  {
2055
2150
  description: __21("Restored as draft", "elementor"),
@@ -2064,7 +2159,7 @@ function Restore({ post }) {
2064
2159
  }
2065
2160
 
2066
2161
  // src/components/panel/actions-menu/actions/set-home.tsx
2067
- import * as React30 from "react";
2162
+ import * as React31 from "react";
2068
2163
  import { ConfirmationDialog } from "@elementor/editor-ui";
2069
2164
  import { HomeIcon } from "@elementor/icons";
2070
2165
  import { Button as Button3, CircularProgress as CircularProgress4, DialogActions as DialogActions3 } from "@elementor/ui";
@@ -2073,8 +2168,17 @@ import { __ as __22 } from "@wordpress/i18n";
2073
2168
  // src/hooks/use-homepage-actions.ts
2074
2169
  import { useMutation as useMutation2, useQueryClient as useQueryClient2 } from "@elementor/query";
2075
2170
  function useHomepageActions() {
2171
+ const queryClient = useQueryClient2();
2076
2172
  const invalidateSettings = useInvalidateSettings();
2077
- const onSuccess = async () => invalidateSettings({ exact: true });
2173
+ const onSuccess = async (_data, settings) => {
2174
+ const homepageQueryKey = settingsQueryKey();
2175
+ if ("page" === settings.show_on_front) {
2176
+ queryClient.setQueryData(homepageQueryKey, settings.page_on_front);
2177
+ } else {
2178
+ queryClient.setQueryData(homepageQueryKey, 0);
2179
+ }
2180
+ await invalidateSettings({ exact: true });
2181
+ };
2078
2182
  const updateSettingsMutation = useMutation2({
2079
2183
  mutationFn: (settings) => updateSettings(settings),
2080
2184
  onSuccess
@@ -2118,7 +2222,7 @@ function SetHome({ post, closeMenu, onRequestRemoveHomepage }) {
2118
2222
  const isRemoveHomeDisabled = !canManageOptions || updateSettingsMutation.isPending;
2119
2223
  const isDisabled = isPostHomepage ? isRemoveHomeDisabled : isSetHomeDisabled;
2120
2224
  const title = isPostHomepage ? __22("Remove as homepage", "elementor") : __22("Set as homepage", "elementor");
2121
- return /* @__PURE__ */ React30.createElement(
2225
+ return /* @__PURE__ */ React31.createElement(
2122
2226
  ActionMenuItem,
2123
2227
  {
2124
2228
  title,
@@ -2156,10 +2260,10 @@ function RemoveHomepageDialog({ open, onClose }) {
2156
2260
  };
2157
2261
  const isPending = updateSettingsMutation.isPending;
2158
2262
  const removeHomepageLabel = __22("Remove as homepage", "elementor");
2159
- return /* @__PURE__ */ React30.createElement(ConfirmationDialog, { open: true, onClose: handleCancel }, /* @__PURE__ */ React30.createElement(ConfirmationDialog.Title, { iconColor: "secondary" }, __22("Remove this page as your homepage?", "elementor")), /* @__PURE__ */ React30.createElement(ConfirmationDialog.Content, null, /* @__PURE__ */ React30.createElement(ConfirmationDialog.ContentText, null, __22(
2263
+ return /* @__PURE__ */ React31.createElement(ConfirmationDialog, { open: true, onClose: handleCancel }, /* @__PURE__ */ React31.createElement(ConfirmationDialog.Title, { iconColor: "secondary" }, __22("Remove this page as your homepage?", "elementor")), /* @__PURE__ */ React31.createElement(ConfirmationDialog.Content, null, /* @__PURE__ */ React31.createElement(ConfirmationDialog.ContentText, null, __22(
2160
2264
  "Your homepage will go back to showing your latest posts. You can set a page as your homepage again at any time.",
2161
2265
  "elementor"
2162
- ))), /* @__PURE__ */ React30.createElement(DialogActions3, null, /* @__PURE__ */ React30.createElement(Button3, { color: "secondary", disabled: isPending, onClick: handleCancel }, __22("Not now", "elementor")), /* @__PURE__ */ React30.createElement(
2266
+ ))), /* @__PURE__ */ React31.createElement(DialogActions3, null, /* @__PURE__ */ React31.createElement(Button3, { color: "secondary", disabled: isPending, onClick: handleCancel }, __22("Not now", "elementor")), /* @__PURE__ */ React31.createElement(
2163
2267
  Button3,
2164
2268
  {
2165
2269
  color: "secondary",
@@ -2168,18 +2272,18 @@ function RemoveHomepageDialog({ open, onClose }) {
2168
2272
  sx: { ml: 1 },
2169
2273
  variant: "contained"
2170
2274
  },
2171
- !isPending ? removeHomepageLabel : /* @__PURE__ */ React30.createElement(CircularProgress4, null)
2275
+ !isPending ? removeHomepageLabel : /* @__PURE__ */ React31.createElement(CircularProgress4, null)
2172
2276
  )));
2173
2277
  }
2174
2278
 
2175
2279
  // src/components/panel/actions-menu/actions/view.tsx
2176
- import * as React31 from "react";
2280
+ import * as React32 from "react";
2177
2281
  import { EyeIcon } from "@elementor/icons";
2178
2282
  import { __ as __23 } from "@wordpress/i18n";
2179
2283
  function View({ post }) {
2180
2284
  const { type } = usePostListContext();
2181
2285
  const title = __23("View %s", "elementor").replace("%s", postTypesMap[type].labels.singular_name);
2182
- return /* @__PURE__ */ React31.createElement(
2286
+ return /* @__PURE__ */ React32.createElement(
2183
2287
  ActionMenuItem,
2184
2288
  {
2185
2289
  title,
@@ -2206,10 +2310,10 @@ var DisabledPostTooltip = ({
2206
2310
  postTypeSlug
2207
2311
  }) => {
2208
2312
  if (isDisabled) {
2209
- const title = /* @__PURE__ */ React32.createElement(Typography6, { variant: "caption" }, getCannotEditPanelItemMessage(postTypeSlug), /* @__PURE__ */ React32.createElement("br", null), __24("To edit it directly, contact the site owner", "elementor"));
2210
- return /* @__PURE__ */ React32.createElement(Tooltip4, { title, placement: "bottom", arrow: false }, /* @__PURE__ */ React32.createElement("span", null, children));
2313
+ const title = /* @__PURE__ */ React33.createElement(Typography6, { variant: "caption" }, getCannotEditPanelItemMessage(postTypeSlug), /* @__PURE__ */ React33.createElement("br", null), __24("To edit it directly, contact the site owner", "elementor"));
2314
+ return /* @__PURE__ */ React33.createElement(Tooltip4, { title, placement: "bottom", arrow: false }, /* @__PURE__ */ React33.createElement("span", null, children));
2211
2315
  }
2212
- return /* @__PURE__ */ React32.createElement(React32.Fragment, null, children);
2316
+ return /* @__PURE__ */ React33.createElement(React33.Fragment, null, children);
2213
2317
  };
2214
2318
  function ListItemView({ post }) {
2215
2319
  const { type } = usePostListContext();
@@ -2230,12 +2334,18 @@ function ListItemView({ post }) {
2230
2334
  const menuTriggerProps = bindTrigger2(popupState);
2231
2335
  const hasListItemActions = useSiteContentListItemActionsInjections().length > 0;
2232
2336
  const showListItemActions = isActive && post.user_can.edit && !isTrashed && hasListItemActions;
2233
- const listRow = /* @__PURE__ */ React32.createElement(
2337
+ const isHome = Boolean(post.isHome);
2338
+ const trailingActionCount = 1 + (showListItemActions ? 1 : 0) + (isHome ? 1 : 0);
2339
+ const allowRowHover = !isEditBlocked;
2340
+ const listRow = /* @__PURE__ */ React33.createElement(
2234
2341
  ListItem2,
2235
2342
  {
2236
2343
  disablePadding: true,
2237
- sx: getContentPanelListItemSx(showListItemActions),
2238
- secondaryAction: /* @__PURE__ */ React32.createElement(Stack6, { alignItems: "center", direction: "row", spacing: 0 }, showListItemActions && /* @__PURE__ */ React32.createElement(SiteContentListItemActionsSlot, { post, title }), /* @__PURE__ */ React32.createElement(
2344
+ sx: {
2345
+ ...getContentPanelListItemSx(trailingActionCount),
2346
+ ...getContentPanelListItemRowStateSx(isActive, allowRowHover)
2347
+ },
2348
+ secondaryAction: /* @__PURE__ */ React33.createElement(Stack6, { alignItems: "center", direction: "row", spacing: 0 }, showListItemActions && /* @__PURE__ */ React33.createElement(SiteContentListItemActionsSlot, { post, title }), isHome && /* @__PURE__ */ React33.createElement(HomeIcon2, { color: "disabled", fontSize: "tiny", titleAccess: __24("Homepage", "elementor") }), /* @__PURE__ */ React33.createElement(
2239
2349
  IconButton4,
2240
2350
  {
2241
2351
  "aria-label": __24("More actions", "elementor"),
@@ -2246,10 +2356,10 @@ function ListItemView({ post }) {
2246
2356
  menuTriggerProps.onClick?.(event);
2247
2357
  }
2248
2358
  },
2249
- /* @__PURE__ */ React32.createElement(DotsVerticalIcon, { fontSize: "tiny" })
2359
+ /* @__PURE__ */ React33.createElement(DotsVerticalIcon, { fontSize: "tiny" })
2250
2360
  ))
2251
2361
  },
2252
- /* @__PURE__ */ React32.createElement(
2362
+ /* @__PURE__ */ React33.createElement(
2253
2363
  ListItemButton2,
2254
2364
  {
2255
2365
  dense: true,
@@ -2265,18 +2375,17 @@ function ListItemView({ post }) {
2265
2375
  shape: "rounded",
2266
2376
  sx: contentPanelListItemButtonSx
2267
2377
  },
2268
- /* @__PURE__ */ React32.createElement(ListItemText6, { disableTypography: true, sx: { flex: 1, minWidth: 0 } }, /* @__PURE__ */ React32.createElement(PageTitleAndStatus, { title, status })),
2269
- post.isHome && /* @__PURE__ */ React32.createElement(HomeIcon2, { titleAccess: __24("Homepage", "elementor"), color: "disabled" })
2378
+ /* @__PURE__ */ React33.createElement(ListItemText6, { disableTypography: true, sx: { flex: 1, minWidth: 0 } }, /* @__PURE__ */ React33.createElement(PageTitleAndStatus, { title, status }))
2270
2379
  )
2271
2380
  );
2272
- return /* @__PURE__ */ React32.createElement(React32.Fragment, null, isEditBlocked ? /* @__PURE__ */ React32.createElement(DisabledPostTooltip, { isDisabled: true, postTypeSlug: type }, listRow) : listRow, /* @__PURE__ */ React32.createElement(
2381
+ return /* @__PURE__ */ React33.createElement(React33.Fragment, null, isEditBlocked ? /* @__PURE__ */ React33.createElement(DisabledPostTooltip, { isDisabled: true, postTypeSlug: type }, listRow) : listRow, /* @__PURE__ */ React33.createElement(
2273
2382
  Menu2,
2274
2383
  {
2275
2384
  PaperProps: { sx: { mt: 2, width: 200 } },
2276
2385
  MenuListProps: { dense: true },
2277
2386
  ...bindMenu2(popupState)
2278
2387
  },
2279
- isTrashed ? /* @__PURE__ */ React32.createElement(React32.Fragment, null, /* @__PURE__ */ React32.createElement(Restore, { post }), /* @__PURE__ */ React32.createElement(ForceDelete, { post })) : /* @__PURE__ */ React32.createElement(React32.Fragment, null, /* @__PURE__ */ React32.createElement(Rename, { post }), /* @__PURE__ */ React32.createElement(Duplicate, { post, popupState }), /* @__PURE__ */ React32.createElement(Delete, { post }), /* @__PURE__ */ React32.createElement(View, { post }), type === "page" && /* @__PURE__ */ React32.createElement(React32.Fragment, null, /* @__PURE__ */ React32.createElement(Divider6, null), /* @__PURE__ */ React32.createElement(
2388
+ isTrashed ? /* @__PURE__ */ React33.createElement(React33.Fragment, null, /* @__PURE__ */ React33.createElement(Restore, { post }), /* @__PURE__ */ React33.createElement(ForceDelete, { post })) : /* @__PURE__ */ React33.createElement(React33.Fragment, null, /* @__PURE__ */ React33.createElement(Rename, { post }), /* @__PURE__ */ React33.createElement(Duplicate, { post, popupState }), /* @__PURE__ */ React33.createElement(Delete, { post }), /* @__PURE__ */ React33.createElement(View, { post }), type === "page" && /* @__PURE__ */ React33.createElement(React33.Fragment, null, /* @__PURE__ */ React33.createElement(Divider6, null), /* @__PURE__ */ React33.createElement(
2280
2389
  SetHome,
2281
2390
  {
2282
2391
  post,
@@ -2284,7 +2393,7 @@ function ListItemView({ post }) {
2284
2393
  onRequestRemoveHomepage: () => setIsRemoveHomeDialogOpen(true)
2285
2394
  }
2286
2395
  )))
2287
- ), /* @__PURE__ */ React32.createElement(
2396
+ ), /* @__PURE__ */ React33.createElement(
2288
2397
  RemoveHomepageDialog,
2289
2398
  {
2290
2399
  open: isRemoveHomeDialogOpen,
@@ -2297,22 +2406,22 @@ function ListItemView({ post }) {
2297
2406
  function PostListItem({ post }) {
2298
2407
  const { editMode } = usePostListContext();
2299
2408
  if ("rename" === editMode.mode && post?.id && post?.id === editMode.details.postId) {
2300
- return /* @__PURE__ */ React33.createElement(ListItemRename, { post });
2409
+ return /* @__PURE__ */ React34.createElement(ListItemRename, { post });
2301
2410
  }
2302
2411
  if ("create" === editMode.mode && !post) {
2303
- return /* @__PURE__ */ React33.createElement(ListItemCreate, null);
2412
+ return /* @__PURE__ */ React34.createElement(ListItemCreate, null);
2304
2413
  }
2305
2414
  if ("duplicate" === editMode.mode && !post) {
2306
- return /* @__PURE__ */ React33.createElement(ListItemDuplicate, null);
2415
+ return /* @__PURE__ */ React34.createElement(ListItemDuplicate, null);
2307
2416
  }
2308
2417
  if (!post) {
2309
2418
  return null;
2310
2419
  }
2311
- return /* @__PURE__ */ React33.createElement(ListItemView, { post });
2420
+ return /* @__PURE__ */ React34.createElement(ListItemView, { post });
2312
2421
  }
2313
2422
 
2314
2423
  // src/components/panel/posts-list/post-list-pagination-actions.tsx
2315
- import * as React34 from "react";
2424
+ import * as React35 from "react";
2316
2425
  import { CollapseIcon as CollapseIcon2 } from "@elementor/editor-ui";
2317
2426
  import { Box as Box10, Button as Button4, CircularProgress as CircularProgress5, Stack as Stack7 } from "@elementor/ui";
2318
2427
  import { __ as __25 } from "@wordpress/i18n";
@@ -2334,26 +2443,26 @@ function PostListPaginationActions({
2334
2443
  }
2335
2444
  const loadMoreLabel = __25("Load more", "elementor");
2336
2445
  const showLessLabel = __25("Show less", "elementor");
2337
- const loadMoreButton = /* @__PURE__ */ React34.createElement(
2446
+ const loadMoreButton = /* @__PURE__ */ React35.createElement(
2338
2447
  Button4,
2339
2448
  {
2340
2449
  ...listPaginationButtonProps,
2341
2450
  ref: loadMoreButtonRef,
2342
2451
  "aria-label": loadMoreLabel,
2343
2452
  disabled: isLoadingMore,
2344
- endIcon: isLoadingMore ? void 0 : /* @__PURE__ */ React34.createElement(CollapseIcon2, { open: false }),
2453
+ endIcon: isLoadingMore ? void 0 : /* @__PURE__ */ React35.createElement(CollapseIcon2, { open: false }),
2345
2454
  fullWidth: true,
2346
2455
  onClick: onLoadMore,
2347
2456
  sx: { flex: 1, my: 0.5 }
2348
2457
  },
2349
- isLoadingMore ? /* @__PURE__ */ React34.createElement(CircularProgress5, { size: 20 }) : loadMoreLabel
2458
+ isLoadingMore ? /* @__PURE__ */ React35.createElement(CircularProgress5, { size: 20 }) : loadMoreLabel
2350
2459
  );
2351
- const showLessButton = /* @__PURE__ */ React34.createElement(
2460
+ const showLessButton = /* @__PURE__ */ React35.createElement(
2352
2461
  Button4,
2353
2462
  {
2354
2463
  ...listPaginationButtonProps,
2355
2464
  "aria-label": showLessLabel,
2356
- endIcon: /* @__PURE__ */ React34.createElement(CollapseIcon2, { open: true }),
2465
+ endIcon: /* @__PURE__ */ React35.createElement(CollapseIcon2, { open: true }),
2357
2466
  fullWidth: true,
2358
2467
  onClick: onShowLess,
2359
2468
  sx: { flex: 1, my: 0.5 }
@@ -2361,27 +2470,21 @@ function PostListPaginationActions({
2361
2470
  showLessLabel
2362
2471
  );
2363
2472
  if (canShowLess && canLoadMore) {
2364
- return /* @__PURE__ */ React34.createElement(Box10, { sx: { px: 2, width: "100%" } }, /* @__PURE__ */ React34.createElement(Stack7, { direction: "row", spacing: 1 }, showLessButton, loadMoreButton));
2473
+ return /* @__PURE__ */ React35.createElement(Box10, { sx: { px: 2, width: "100%" } }, /* @__PURE__ */ React35.createElement(Stack7, { direction: "row", spacing: 1 }, showLessButton, loadMoreButton));
2365
2474
  }
2366
- return /* @__PURE__ */ React34.createElement(Box10, { sx: { px: 2, width: "100%" } }, canShowLess ? showLessButton : loadMoreButton);
2475
+ return /* @__PURE__ */ React35.createElement(Box10, { sx: { px: 2, width: "100%" } }, canShowLess ? showLessButton : loadMoreButton);
2367
2476
  }
2368
2477
 
2369
2478
  // src/components/panel/posts-list/posts-collapsible-list.tsx
2370
- var SEARCH_DEBOUNCE_MS = 300;
2371
- function PostsCollapsibleList({ isOpenByDefault = false }) {
2479
+ function PostsCollapsibleListContent({ isOpenByDefault = false }) {
2372
2480
  const { type, editMode, resetEditMode, setEditMode } = usePostListContext();
2373
- const { registerSection, searchQuery, siteContentSort, statusFilters, unregisterSection } = useContentPanelCoordinator();
2481
+ const { registerSection, unregisterSection } = useContentPanelCoordinator();
2482
+ const { clearStatusFilters, debouncedSearch, siteContentSort, statusFilters } = useSiteContentSectionToolbar();
2374
2483
  const [isOpen, setIsOpen] = useState9(isOpenByDefault);
2375
- const trimmedSearch = searchQuery.trim();
2376
- const [debouncedSearch, setDebouncedSearch] = useState9(trimmedSearch);
2377
2484
  const focusAfterShowLessRef = useRef5(false);
2378
2485
  const listTopRef = useRef5(null);
2379
2486
  const loadMoreButtonRef = useRef5(null);
2380
2487
  const sectionHeaderRef = useRef5(null);
2381
- useEffect2(() => {
2382
- const handle = window.setTimeout(() => setDebouncedSearch(trimmedSearch), SEARCH_DEBOUNCE_MS);
2383
- return () => window.clearTimeout(handle);
2384
- }, [trimmedSearch]);
2385
2488
  const {
2386
2489
  data: { posts, total },
2387
2490
  isError: postsError,
@@ -2397,23 +2500,28 @@ function PostsCollapsibleList({ isOpenByDefault = false }) {
2397
2500
  const { data: homepageId } = useHomepage();
2398
2501
  const isPageType = type === "page";
2399
2502
  const statusFiltersKey = serializeSiteContentStatusFilters(statusFilters);
2400
- useEffect2(() => {
2503
+ useEffect3(() => {
2401
2504
  if (isTrashFilter) {
2402
2505
  resetEditMode();
2403
2506
  }
2404
2507
  }, [isTrashFilter, resetEditMode]);
2405
- useEffect2(() => {
2508
+ useEffect3(() => {
2406
2509
  registerSection(type, {
2407
2510
  setExpanded: setIsOpen,
2408
- startCreate: () => setEditMode({ mode: "create", details: {} })
2511
+ startCreate: () => {
2512
+ if (isSiteContentTrashFilterActive(statusFilters)) {
2513
+ clearStatusFilters();
2514
+ }
2515
+ setEditMode({ mode: "create", details: {} });
2516
+ }
2409
2517
  });
2410
2518
  return () => unregisterSection(type);
2411
- }, [registerSection, unregisterSection, type, setEditMode]);
2412
- const filteredPosts = useMemo4(() => {
2519
+ }, [clearStatusFilters, registerSection, setEditMode, statusFilters, type, unregisterSection]);
2520
+ const filteredPosts = useMemo5(() => {
2413
2521
  if (!posts) {
2414
2522
  return [];
2415
2523
  }
2416
- const mappedPosts = isPageType ? posts.map((post) => post.id === homepageId ? { ...post, isHome: true } : post) : posts;
2524
+ const mappedPosts = isPageType ? posts.map((post) => ({ ...post, isHome: post.id === homepageId })) : posts;
2417
2525
  const shouldPinHomepage = isPageType && shouldPinHomepageForSiteContentSort(siteContentSort);
2418
2526
  const sorted = shouldPinHomepage ? [...mappedPosts].sort((a, b) => {
2419
2527
  if (a.id === homepageId) {
@@ -2434,7 +2542,7 @@ function PostsCollapsibleList({ isOpenByDefault = false }) {
2434
2542
  resetKey: `${type}:${debouncedSearch}:${statusFiltersKey}:${siteContentSort}`,
2435
2543
  totalCount: total
2436
2544
  });
2437
- const displayedPosts = useMemo4(
2545
+ const displayedPosts = useMemo5(
2438
2546
  () => filteredPosts.slice(0, pagination.visibleCount),
2439
2547
  [filteredPosts, pagination.visibleCount]
2440
2548
  );
@@ -2446,7 +2554,7 @@ function PostsCollapsibleList({ isOpenByDefault = false }) {
2446
2554
  listTop.scrollIntoView({ block: "nearest" });
2447
2555
  }
2448
2556
  };
2449
- useEffect2(() => {
2557
+ useEffect3(() => {
2450
2558
  if (!focusAfterShowLessRef.current) {
2451
2559
  return;
2452
2560
  }
@@ -2458,22 +2566,27 @@ function PostsCollapsibleList({ isOpenByDefault = false }) {
2458
2566
  }
2459
2567
  sectionHeaderRef.current?.focus();
2460
2568
  }, [pagination.canLoadMore, pagination.visibleCount]);
2461
- useEffect2(() => {
2569
+ useEffect3(() => {
2462
2570
  if ((debouncedSearch || hasActiveSiteContentStatusFilters(statusFilters)) && filteredPosts.length > 0) {
2463
2571
  setIsOpen(true);
2464
2572
  }
2465
2573
  }, [debouncedSearch, filteredPosts.length, statusFilters]);
2466
2574
  if (postsError) {
2467
- return /* @__PURE__ */ React35.createElement(ErrorState, null);
2575
+ return /* @__PURE__ */ React36.createElement(ErrorState, null);
2468
2576
  }
2469
2577
  if (postsPending && !posts?.length) {
2470
- return /* @__PURE__ */ React35.createElement(Box11, { sx: { px: 2 } }, /* @__PURE__ */ React35.createElement(Box11, null, /* @__PURE__ */ React35.createElement(Skeleton, { sx: { my: 3 }, animation: "wave", variant: "rounded", width: "100%", height: "24px" }), /* @__PURE__ */ React35.createElement(Skeleton, { sx: { my: 3 }, animation: "wave", variant: "rounded", width: "70%", height: "24px" }), /* @__PURE__ */ React35.createElement(Skeleton, { sx: { my: 3 }, animation: "wave", variant: "rounded", width: "70%", height: "24px" }), /* @__PURE__ */ React35.createElement(Skeleton, { sx: { my: 3 }, animation: "wave", variant: "rounded", width: "70%", height: "24px" })));
2578
+ return /* @__PURE__ */ React36.createElement(Box11, { sx: { px: 2 } }, /* @__PURE__ */ React36.createElement(Box11, null, /* @__PURE__ */ React36.createElement(Skeleton, { sx: { my: 3 }, animation: "wave", variant: "rounded", width: "100%", height: "24px" }), /* @__PURE__ */ React36.createElement(Skeleton, { sx: { my: 3 }, animation: "wave", variant: "rounded", width: "70%", height: "24px" }), /* @__PURE__ */ React36.createElement(Skeleton, { sx: { my: 3 }, animation: "wave", variant: "rounded", width: "70%", height: "24px" }), /* @__PURE__ */ React36.createElement(Skeleton, { sx: { my: 3 }, animation: "wave", variant: "rounded", width: "70%", height: "24px" })));
2471
2579
  }
2472
2580
  const displayCount = total;
2473
2581
  const sectionTitle = postTypesMap[type].labels.plural_name;
2474
2582
  const showNoResults = (debouncedSearch || hasActiveSiteContentStatusFilters(statusFilters)) && filteredPosts.length === 0;
2475
2583
  const countChipLabel = isNarrowed && baselineTotal !== void 0 ? `${total} / ${baselineTotal}` : void 0;
2476
- return /* @__PURE__ */ React35.createElement(
2584
+ const searchAriaLabel = sprintf5(
2585
+ /* translators: %s: document type plural label. */
2586
+ __26("Search %s", "elementor"),
2587
+ sectionTitle
2588
+ );
2589
+ return /* @__PURE__ */ React36.createElement(
2477
2590
  CollapsibleList,
2478
2591
  {
2479
2592
  count: displayCount,
@@ -2481,16 +2594,22 @@ function PostsCollapsibleList({ isOpenByDefault = false }) {
2481
2594
  headerRef: sectionHeaderRef,
2482
2595
  isOpen,
2483
2596
  onOpenChange: setIsOpen,
2484
- title: sectionTitle,
2485
- trailingActions: isTrashFilter ? null : /* @__PURE__ */ React35.createElement(SectionAddButton, { onBeforeCreate: () => setIsOpen(true) })
2597
+ sectionToolbar: /* @__PURE__ */ React36.createElement(
2598
+ ContentPanelSectionToolbar,
2599
+ {
2600
+ addAction: isTrashFilter ? void 0 : /* @__PURE__ */ React36.createElement(SectionAddButton, { onBeforeCreate: () => setIsOpen(true) }),
2601
+ searchAriaLabel
2602
+ }
2603
+ ),
2604
+ title: sectionTitle
2486
2605
  },
2487
- showNoResults && /* @__PURE__ */ React35.createElement(Box11, { sx: { py: 2, px: 2 } }, /* @__PURE__ */ React35.createElement(Typography7, { variant: "body2", color: "text.secondary" }, __26("No results found", "elementor"))),
2488
- /* @__PURE__ */ React35.createElement(Box11, { ref: listTopRef }),
2606
+ showNoResults && /* @__PURE__ */ React36.createElement(Box11, { sx: { py: 2, px: 2 } }, /* @__PURE__ */ React36.createElement(Typography7, { variant: "body2", color: "text.secondary" }, __26("No results found", "elementor"))),
2607
+ /* @__PURE__ */ React36.createElement(Box11, { ref: listTopRef }),
2489
2608
  displayedPosts.map((post) => {
2490
- return /* @__PURE__ */ React35.createElement(PostListItem, { key: post.id, post });
2609
+ return /* @__PURE__ */ React36.createElement(PostListItem, { key: post.id, post });
2491
2610
  }),
2492
- !isTrashFilter && ["duplicate", "create"].includes(editMode.mode) && /* @__PURE__ */ React35.createElement(PostListItem, null),
2493
- /* @__PURE__ */ React35.createElement(
2611
+ !isTrashFilter && ["duplicate", "create"].includes(editMode.mode) && /* @__PURE__ */ React36.createElement(PostListItem, null),
2612
+ /* @__PURE__ */ React36.createElement(
2494
2613
  PostListPaginationActions,
2495
2614
  {
2496
2615
  canLoadMore: pagination.canLoadMore,
@@ -2503,13 +2622,17 @@ function PostsCollapsibleList({ isOpenByDefault = false }) {
2503
2622
  )
2504
2623
  );
2505
2624
  }
2625
+ function PostsCollapsibleList(props) {
2626
+ const { type } = usePostListContext();
2627
+ return /* @__PURE__ */ React36.createElement(SiteContentSectionToolbarProvider, { statusFilterCountSlugs: [type] }, /* @__PURE__ */ React36.createElement(PostsCollapsibleListContent, { ...props }));
2628
+ }
2506
2629
 
2507
2630
  // src/components/panel/user-load-error.tsx
2508
- import * as React36 from "react";
2631
+ import * as React37 from "react";
2509
2632
  import { Box as Box12, Typography as Typography8 } from "@elementor/ui";
2510
2633
  import { __ as __27 } from "@wordpress/i18n";
2511
2634
  function UserLoadError() {
2512
- return /* @__PURE__ */ React36.createElement(Box12, { sx: { px: 2, py: 2 } }, /* @__PURE__ */ React36.createElement(Typography8, { variant: "body2", color: "text.secondary" }, __27(
2635
+ return /* @__PURE__ */ React37.createElement(Box12, { sx: { px: 2, py: 2 } }, /* @__PURE__ */ React37.createElement(Typography8, { variant: "body2", color: "text.secondary" }, __27(
2513
2636
  "We couldn\u2019t load your content permissions. Try closing and reopening this panel.",
2514
2637
  "elementor"
2515
2638
  )));
@@ -2523,13 +2646,13 @@ function ShellPanelBodyContent({
2523
2646
  showUserLoadError
2524
2647
  }) {
2525
2648
  if (isUserPending) {
2526
- return /* @__PURE__ */ React37.createElement(Stack8, { spacing: 1, sx: { px: 2, py: 1 } }, /* @__PURE__ */ React37.createElement(Skeleton2, { animation: "wave", height: 28, variant: "rounded", width: "100%" }), /* @__PURE__ */ React37.createElement(Skeleton2, { animation: "wave", height: 28, variant: "rounded", width: "80%" }));
2649
+ return /* @__PURE__ */ React38.createElement(Stack8, { spacing: 1, sx: { px: 2, py: 1 } }, /* @__PURE__ */ React38.createElement(Skeleton2, { animation: "wave", height: 28, variant: "rounded", width: "100%" }), /* @__PURE__ */ React38.createElement(Skeleton2, { animation: "wave", height: 28, variant: "rounded", width: "80%" }));
2527
2650
  }
2528
2651
  if (showUserLoadError) {
2529
- return /* @__PURE__ */ React37.createElement(UserLoadError, null);
2652
+ return /* @__PURE__ */ React38.createElement(UserLoadError, null);
2530
2653
  }
2531
2654
  const extraSections = getSiteContentSections();
2532
- return /* @__PURE__ */ React37.createElement(List2, { dense: true, disablePadding: true, sx: { py: 0, width: "100%" } }, accessiblePostTypes.map((postTypeSlug, index) => /* @__PURE__ */ React37.createElement(PostListContextProvider, { key: postTypeSlug, type: postTypeSlug, setError: onListError }, /* @__PURE__ */ React37.createElement(PostsCollapsibleList, { isOpenByDefault: index === 0 }))), extraSections.map((section) => /* @__PURE__ */ React37.createElement(React37.Fragment, { key: section.id }, section.render())));
2655
+ return /* @__PURE__ */ React38.createElement(List2, { dense: true, disablePadding: true, sx: { py: 0, width: "100%" } }, accessiblePostTypes.map((postTypeSlug, index) => /* @__PURE__ */ React38.createElement(PostListContextProvider, { key: postTypeSlug, type: postTypeSlug, setError: onListError }, /* @__PURE__ */ React38.createElement(PostsCollapsibleList, { isOpenByDefault: index === 0 }))), extraSections.map((section) => /* @__PURE__ */ React38.createElement(React38.Fragment, { key: section.id }, section.render())));
2533
2656
  }
2534
2657
 
2535
2658
  // src/components/panel/shell.tsx
@@ -2537,7 +2660,7 @@ var Shell = () => {
2537
2660
  const sidebarPanelChrome = isSidebarEnabled();
2538
2661
  const [isErrorSnackbarOpen, setIsErrorSnackbarOpen] = useState10(false);
2539
2662
  const { accessiblePostTypes, isUserPending, showUserLoadError } = useAccessiblePanelPostTypes();
2540
- return /* @__PURE__ */ React38.createElement(ContentPanelCoordinatorProvider, null, /* @__PURE__ */ React38.createElement(Panel, null, /* @__PURE__ */ React38.createElement(PanelHeader, null, /* @__PURE__ */ React38.createElement(
2663
+ return /* @__PURE__ */ React39.createElement(ContentPanelCoordinatorProvider, null, /* @__PURE__ */ React39.createElement(Panel, null, /* @__PURE__ */ React39.createElement(PanelHeader, null, /* @__PURE__ */ React39.createElement(
2541
2664
  Stack9,
2542
2665
  {
2543
2666
  alignItems: "center",
@@ -2548,9 +2671,9 @@ var Shell = () => {
2548
2671
  ...sidebarPanelChrome ? {} : { p: 1, pl: 2 }
2549
2672
  }
2550
2673
  },
2551
- /* @__PURE__ */ React38.createElement(PanelHeaderTitle, { sx: { flex: 1, minWidth: 0, textAlign: "start" } }, __28("Site content", "elementor")),
2552
- /* @__PURE__ */ React38.createElement(ContentPanelHeaderAdd, null)
2553
- )), /* @__PURE__ */ React38.createElement(Divider7, null), /* @__PURE__ */ React38.createElement(PanelBody, null, /* @__PURE__ */ React38.createElement(ContentPanelToolbar, null), /* @__PURE__ */ React38.createElement(Divider7, null), /* @__PURE__ */ React38.createElement(
2674
+ /* @__PURE__ */ React39.createElement(PanelHeaderTitle, { sx: { flex: 1, minWidth: 0, textAlign: "start" } }, __28("Site content", "elementor")),
2675
+ /* @__PURE__ */ React39.createElement(ContentPanelHeaderAdd, null)
2676
+ )), /* @__PURE__ */ React39.createElement(Divider7, null), /* @__PURE__ */ React39.createElement(PanelBody, null, /* @__PURE__ */ React39.createElement(
2554
2677
  ShellPanelBodyContent,
2555
2678
  {
2556
2679
  accessiblePostTypes,
@@ -2558,7 +2681,7 @@ var Shell = () => {
2558
2681
  onListError: () => setIsErrorSnackbarOpen(true),
2559
2682
  showUserLoadError
2560
2683
  }
2561
- ), /* @__PURE__ */ React38.createElement(error_snackbar_default, { open: isErrorSnackbarOpen, onClose: () => setIsErrorSnackbarOpen(false) }))));
2684
+ ), /* @__PURE__ */ React39.createElement(error_snackbar_default, { open: isErrorSnackbarOpen, onClose: () => setIsErrorSnackbarOpen(false) }))));
2562
2685
  };
2563
2686
  var shell_default = Shell;
2564
2687
 
@@ -2569,7 +2692,7 @@ var { panel, usePanelStatus, usePanelActions } = createPanel({
2569
2692
  });
2570
2693
 
2571
2694
  // src/components/top-bar/recently-edited.tsx
2572
- import * as React43 from "react";
2695
+ import * as React44 from "react";
2573
2696
  import {
2574
2697
  __useActiveDocument as useActiveDocument4,
2575
2698
  __useHostDocument as useHostDocument
@@ -2589,7 +2712,7 @@ import {
2589
2712
  import { __ as __30 } from "@wordpress/i18n";
2590
2713
 
2591
2714
  // src/components/top-bar/create-post-list-item.tsx
2592
- import * as React39 from "react";
2715
+ import * as React40 from "react";
2593
2716
  import { __useNavigateToDocument as useNavigateToDocument4 } from "@elementor/editor-documents";
2594
2717
  import { useMixpanel } from "@elementor/events";
2595
2718
  import { PlusIcon as PlusIcon2 } from "@elementor/icons";
@@ -2624,7 +2747,7 @@ function CreatePostListItem({ closePopup, ...props }) {
2624
2747
  const navigateToDocument = useNavigateToDocument4();
2625
2748
  const { data: user } = useUser();
2626
2749
  const { dispatchEvent, config } = useMixpanel();
2627
- return /* @__PURE__ */ React39.createElement(
2750
+ return /* @__PURE__ */ React40.createElement(
2628
2751
  MenuItem6,
2629
2752
  {
2630
2753
  disabled: isLoading || !user?.capabilities?.edit_pages,
@@ -2648,8 +2771,8 @@ function CreatePostListItem({ closePopup, ...props }) {
2648
2771
  },
2649
2772
  ...props
2650
2773
  },
2651
- /* @__PURE__ */ React39.createElement(ListItemIcon4, null, isLoading ? /* @__PURE__ */ React39.createElement(CircularProgress6, { size: "1.25rem" }) : /* @__PURE__ */ React39.createElement(PlusIcon2, { fontSize: "small" })),
2652
- /* @__PURE__ */ React39.createElement(
2774
+ /* @__PURE__ */ React40.createElement(ListItemIcon4, null, isLoading ? /* @__PURE__ */ React40.createElement(CircularProgress6, { size: "1.25rem" }) : /* @__PURE__ */ React40.createElement(PlusIcon2, { fontSize: "small" })),
2775
+ /* @__PURE__ */ React40.createElement(
2653
2776
  ListItemText7,
2654
2777
  {
2655
2778
  primaryTypographyProps: { variant: "body2" },
@@ -2660,13 +2783,13 @@ function CreatePostListItem({ closePopup, ...props }) {
2660
2783
  }
2661
2784
 
2662
2785
  // src/components/top-bar/indicator.tsx
2663
- import * as React40 from "react";
2786
+ import * as React41 from "react";
2664
2787
  import { Stack as Stack10, Tooltip as BaseTooltip, Typography as Typography9 } from "@elementor/ui";
2665
2788
  function Indicator({ title, status }) {
2666
- return /* @__PURE__ */ React40.createElement(Tooltip5, { title }, /* @__PURE__ */ React40.createElement(Stack10, { component: "span", direction: "row", alignItems: "center", spacing: 0.5 }, /* @__PURE__ */ React40.createElement(Typography9, { component: "span", variant: "body2", sx: { maxWidth: "120px" }, noWrap: true }, title), status.value !== "publish" && /* @__PURE__ */ React40.createElement(Typography9, { component: "span", variant: "body2", sx: { fontStyle: "italic" } }, "(", status.label, ")")));
2789
+ return /* @__PURE__ */ React41.createElement(Tooltip5, { title }, /* @__PURE__ */ React41.createElement(Stack10, { component: "span", direction: "row", alignItems: "center", spacing: 0.5 }, /* @__PURE__ */ React41.createElement(Typography9, { component: "span", variant: "body2", sx: { maxWidth: "120px" }, noWrap: true }, title), status.value !== "publish" && /* @__PURE__ */ React41.createElement(Typography9, { component: "span", variant: "body2", sx: { fontStyle: "italic" } }, "(", status.label, ")")));
2667
2790
  }
2668
2791
  function Tooltip5(props) {
2669
- return /* @__PURE__ */ React40.createElement(
2792
+ return /* @__PURE__ */ React41.createElement(
2670
2793
  BaseTooltip,
2671
2794
  {
2672
2795
  PopperProps: {
@@ -2682,20 +2805,20 @@ function Tooltip5(props) {
2682
2805
  }
2683
2806
 
2684
2807
  // src/components/top-bar/post-list-item.tsx
2685
- import * as React42 from "react";
2808
+ import * as React43 from "react";
2686
2809
  import { __useNavigateToDocument as useNavigateToDocument5 } from "@elementor/editor-documents";
2687
2810
  import { useMixpanel as useMixpanel2 } from "@elementor/events";
2688
2811
  import { ListItemText as ListItemText8, MenuItem as MenuItem7 } from "@elementor/ui";
2689
2812
 
2690
2813
  // src/components/top-bar/chip-doc-type.tsx
2691
- import * as React41 from "react";
2814
+ import * as React42 from "react";
2692
2815
  import { PostTypeIcon as PostTypeIcon3 } from "@elementor/icons";
2693
2816
  import { Chip as Chip4 } from "@elementor/ui";
2694
2817
  var iconsMap2 = getIconsMap();
2695
2818
  function DocTypeChip({ postType, docType, label }) {
2696
2819
  const color = "elementor_library" === postType ? "global" : "accent";
2697
2820
  const Icon = iconsMap2[docType] || PostTypeIcon3;
2698
- return /* @__PURE__ */ React41.createElement(
2821
+ return /* @__PURE__ */ React42.createElement(
2699
2822
  Chip4,
2700
2823
  {
2701
2824
  component: "span",
@@ -2704,7 +2827,7 @@ function DocTypeChip({ postType, docType, label }) {
2704
2827
  label,
2705
2828
  "data-value": docType,
2706
2829
  color,
2707
- icon: /* @__PURE__ */ React41.createElement(Icon, null),
2830
+ icon: /* @__PURE__ */ React42.createElement(Icon, null),
2708
2831
  sx: { ml: 1, cursor: "inherit" }
2709
2832
  }
2710
2833
  );
@@ -2715,7 +2838,7 @@ function PostListItem2({ post, closePopup, ...props }) {
2715
2838
  const navigateToDocument = useNavigateToDocument5();
2716
2839
  const postTitle = useReverseHtmlEntities(post.title);
2717
2840
  const { dispatchEvent, config } = useMixpanel2();
2718
- return /* @__PURE__ */ React42.createElement(
2841
+ return /* @__PURE__ */ React43.createElement(
2719
2842
  MenuItem7,
2720
2843
  {
2721
2844
  disabled: !post.user_can.edit,
@@ -2738,7 +2861,7 @@ function PostListItem2({ post, closePopup, ...props }) {
2738
2861
  },
2739
2862
  ...props
2740
2863
  },
2741
- /* @__PURE__ */ React42.createElement(
2864
+ /* @__PURE__ */ React43.createElement(
2742
2865
  ListItemText8,
2743
2866
  {
2744
2867
  sx: { flexGrow: 0 },
@@ -2746,7 +2869,7 @@ function PostListItem2({ post, closePopup, ...props }) {
2746
2869
  primary: postTitle
2747
2870
  }
2748
2871
  ),
2749
- /* @__PURE__ */ React42.createElement(DocTypeChip, { postType: post.type.post_type, docType: post.type.doc_type, label: post.type.label })
2872
+ /* @__PURE__ */ React43.createElement(DocTypeChip, { postType: post.type.post_type, docType: post.type.doc_type, label: post.type.label })
2750
2873
  );
2751
2874
  }
2752
2875
 
@@ -2772,12 +2895,12 @@ function RecentlyEdited() {
2772
2895
  return null;
2773
2896
  }
2774
2897
  const buttonProps = bindTrigger3(popupState);
2775
- return /* @__PURE__ */ React43.createElement(React43.Fragment, null, /* @__PURE__ */ React43.createElement(
2898
+ return /* @__PURE__ */ React44.createElement(React44.Fragment, null, /* @__PURE__ */ React44.createElement(
2776
2899
  Button5,
2777
2900
  {
2778
2901
  color: "inherit",
2779
2902
  size: "small",
2780
- endIcon: /* @__PURE__ */ React43.createElement(ChevronDownIcon, { fontSize: "small" }),
2903
+ endIcon: /* @__PURE__ */ React44.createElement(ChevronDownIcon, { fontSize: "small" }),
2781
2904
  ...buttonProps,
2782
2905
  onClick: (e) => {
2783
2906
  const extendedWindow = window;
@@ -2796,18 +2919,18 @@ function RecentlyEdited() {
2796
2919
  buttonProps.onClick(e);
2797
2920
  }
2798
2921
  },
2799
- /* @__PURE__ */ React43.createElement(Indicator, { title: documentTitle, status: document2.status })
2800
- ), /* @__PURE__ */ React43.createElement(
2922
+ /* @__PURE__ */ React44.createElement(Indicator, { title: documentTitle, status: document2.status })
2923
+ ), /* @__PURE__ */ React44.createElement(
2801
2924
  Menu3,
2802
2925
  {
2803
2926
  MenuListProps: {
2804
- subheader: /* @__PURE__ */ React43.createElement(ListSubheader, { sx: { color: "accent.main", fontStyle: "italic", fontWeight: "300" } }, __30("Recent", "elementor"))
2927
+ subheader: /* @__PURE__ */ React44.createElement(ListSubheader, { sx: { color: "accent.main", fontStyle: "italic", fontWeight: "300" } }, __30("Recent", "elementor"))
2805
2928
  },
2806
2929
  PaperProps: { sx: { mt: 2.5, width: 320 } },
2807
2930
  ...bindMenu3(popupState)
2808
2931
  },
2809
- recentPosts.map((post) => /* @__PURE__ */ React43.createElement(PostListItem2, { key: post.id, post, closePopup: popupState.close })),
2810
- recentPosts.length === 0 && /* @__PURE__ */ React43.createElement(MenuItem8, { disabled: true }, /* @__PURE__ */ React43.createElement(
2932
+ recentPosts.map((post) => /* @__PURE__ */ React44.createElement(PostListItem2, { key: post.id, post, closePopup: popupState.close })),
2933
+ recentPosts.length === 0 && /* @__PURE__ */ React44.createElement(MenuItem8, { disabled: true }, /* @__PURE__ */ React44.createElement(
2811
2934
  ListItemText9,
2812
2935
  {
2813
2936
  primaryTypographyProps: {
@@ -2817,8 +2940,8 @@ function RecentlyEdited() {
2817
2940
  primary: __30("There are no other pages or templates on this site yet.", "elementor")
2818
2941
  }
2819
2942
  )),
2820
- /* @__PURE__ */ React43.createElement(Divider8, { disabled: recentPosts.length === 0 }),
2821
- /* @__PURE__ */ React43.createElement(CreatePostListItem, { closePopup: popupState.close })
2943
+ /* @__PURE__ */ React44.createElement(Divider8, { disabled: recentPosts.length === 0 }),
2944
+ /* @__PURE__ */ React44.createElement(CreatePostListItem, { closePopup: popupState.close })
2822
2945
  ));
2823
2946
  }
2824
2947
 
@@ -2873,25 +2996,25 @@ function registerButton() {
2873
2996
  }
2874
2997
 
2875
2998
  // src/components/panel/popups/popup-section-add-button.tsx
2876
- import * as React44 from "react";
2877
- import { forwardRef as forwardRef2, useCallback as useCallback4, useImperativeHandle as useImperativeHandle2, useRef as useRef6 } from "react";
2999
+ import * as React45 from "react";
3000
+ import { forwardRef as forwardRef2, useCallback as useCallback5, useImperativeHandle as useImperativeHandle2, useRef as useRef6 } from "react";
2878
3001
  import { Stack as Stack11 } from "@elementor/ui";
2879
- import { __ as __32, sprintf as sprintf5 } from "@wordpress/i18n";
3002
+ import { __ as __32, sprintf as sprintf6 } from "@wordpress/i18n";
2880
3003
  var PopupSectionAddButton = forwardRef2(
2881
3004
  ({ disabled, onBeforeCreate, onCreate }, ref) => {
2882
3005
  const promotionRef = useRef6(null);
2883
3006
  const canCreate = env.popups?.can_use ?? false;
2884
- const togglePromotion = useCallback4(() => {
3007
+ const togglePromotion = useCallback5(() => {
2885
3008
  promotionRef.current?.toggle();
2886
3009
  }, []);
2887
3010
  useImperativeHandle2(ref, () => ({ togglePromotion }), [togglePromotion]);
2888
- const ariaLabel = sprintf5(
3011
+ const ariaLabel = sprintf6(
2889
3012
  /* translators: %s: Document type singular name. */
2890
3013
  __32("New %s", "elementor"),
2891
3014
  __32("Popup", "elementor")
2892
3015
  );
2893
3016
  if (canCreate) {
2894
- return /* @__PURE__ */ React44.createElement(
3017
+ return /* @__PURE__ */ React45.createElement(
2895
3018
  ContentPanelAddIconButton,
2896
3019
  {
2897
3020
  "aria-label": ariaLabel,
@@ -2904,7 +3027,7 @@ var PopupSectionAddButton = forwardRef2(
2904
3027
  }
2905
3028
  );
2906
3029
  }
2907
- return /* @__PURE__ */ React44.createElement(
3030
+ return /* @__PURE__ */ React45.createElement(
2908
3031
  Stack11,
2909
3032
  {
2910
3033
  alignItems: "center",
@@ -2916,35 +3039,50 @@ var PopupSectionAddButton = forwardRef2(
2916
3039
  },
2917
3040
  sx: { cursor: "pointer" }
2918
3041
  },
2919
- /* @__PURE__ */ React44.createElement(ContentPanelAddIconButton, { "aria-label": ariaLabel, tabIndex: -1 }),
2920
- /* @__PURE__ */ React44.createElement(SiteContentPopupsPromotionChip, { ref: promotionRef })
3042
+ /* @__PURE__ */ React45.createElement(ContentPanelAddIconButton, { "aria-label": ariaLabel, tabIndex: -1 }),
3043
+ /* @__PURE__ */ React45.createElement(SiteContentPopupsPromotionChip, { ref: promotionRef })
2921
3044
  );
2922
3045
  }
2923
3046
  );
2924
3047
  export {
2925
3048
  ContentPanelAddIconButton,
2926
3049
  ContentPanelCoordinatorProvider,
3050
+ DEFAULT_SITE_CONTENT_SORT,
3051
+ EMPTY_SITE_CONTENT_STATUS_FILTERS,
2927
3052
  POPUPS_SITE_CONTENT_SECTION_ID,
2928
3053
  POST_PER_PAGE,
2929
3054
  PopupSectionAddButton,
3055
+ SITE_CONTENT_SELECTABLE_STATUS_FILTERS,
2930
3056
  CollapsibleList as SiteContentCollapsibleList,
2931
3057
  EditModeTemplate as SiteContentEditModeTemplate,
2932
3058
  ErrorState as SiteContentListErrorState,
2933
3059
  SiteContentListItemActionsSlot,
2934
3060
  PageTitleAndStatus as SiteContentPageTitleAndStatus,
2935
3061
  PostListPaginationActions as SiteContentPaginationActions,
3062
+ ContentPanelSectionToolbar as SiteContentSectionToolbar,
3063
+ SiteContentSectionToolbarProvider,
2936
3064
  contentPanelListItemButtonSx,
2937
3065
  contentPanelListRowPaddingSx,
2938
3066
  env,
2939
3067
  extendIconsMap,
3068
+ getContentPanelListItemRowStateSx,
3069
+ getContentPanelListItemSx,
3070
+ getRestOrderForSiteContentSort,
3071
+ getRestStatusForSiteContentFilters,
2940
3072
  getSiteContentHeaderCreateItems,
2941
3073
  getSiteContentSections,
3074
+ getSiteContentStatusFilterForCount,
3075
+ hasActiveSiteContentStatusFilters,
2942
3076
  init,
2943
3077
  injectIntoSiteContentListItemActions,
3078
+ isSiteContentListNarrowed,
3079
+ isSiteContentTrashFilterActive,
2944
3080
  registerSiteContentHeaderCreateItem,
2945
3081
  registerSiteContentSection,
2946
3082
  resetSiteContentHeaderCreateItems,
2947
3083
  resetSiteContentSections,
3084
+ serializeSiteContentStatusFilters,
2948
3085
  useContentPanelCoordinator,
2949
- usePostListPagination
3086
+ usePostListPagination,
3087
+ useSiteContentSectionToolbar
2950
3088
  };