@elementor/editor-site-navigation 4.5.0-1233 → 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.js CHANGED
@@ -32,29 +32,44 @@ var index_exports = {};
32
32
  __export(index_exports, {
33
33
  ContentPanelAddIconButton: () => ContentPanelAddIconButton,
34
34
  ContentPanelCoordinatorProvider: () => ContentPanelCoordinatorProvider,
35
+ DEFAULT_SITE_CONTENT_SORT: () => DEFAULT_SITE_CONTENT_SORT,
36
+ EMPTY_SITE_CONTENT_STATUS_FILTERS: () => EMPTY_SITE_CONTENT_STATUS_FILTERS,
35
37
  POPUPS_SITE_CONTENT_SECTION_ID: () => POPUPS_SITE_CONTENT_SECTION_ID,
36
38
  POST_PER_PAGE: () => POST_PER_PAGE,
37
39
  PopupSectionAddButton: () => PopupSectionAddButton,
40
+ SITE_CONTENT_SELECTABLE_STATUS_FILTERS: () => SITE_CONTENT_SELECTABLE_STATUS_FILTERS,
38
41
  SiteContentCollapsibleList: () => CollapsibleList,
39
42
  SiteContentEditModeTemplate: () => EditModeTemplate,
40
43
  SiteContentListErrorState: () => ErrorState,
41
44
  SiteContentListItemActionsSlot: () => SiteContentListItemActionsSlot,
42
45
  SiteContentPageTitleAndStatus: () => PageTitleAndStatus,
43
46
  SiteContentPaginationActions: () => PostListPaginationActions,
47
+ SiteContentSectionToolbar: () => ContentPanelSectionToolbar,
48
+ SiteContentSectionToolbarProvider: () => SiteContentSectionToolbarProvider,
44
49
  contentPanelListItemButtonSx: () => contentPanelListItemButtonSx,
45
50
  contentPanelListRowPaddingSx: () => contentPanelListRowPaddingSx,
46
51
  env: () => env,
47
52
  extendIconsMap: () => extendIconsMap,
53
+ getContentPanelListItemRowStateSx: () => getContentPanelListItemRowStateSx,
54
+ getContentPanelListItemSx: () => getContentPanelListItemSx,
55
+ getRestOrderForSiteContentSort: () => getRestOrderForSiteContentSort,
56
+ getRestStatusForSiteContentFilters: () => getRestStatusForSiteContentFilters,
48
57
  getSiteContentHeaderCreateItems: () => getSiteContentHeaderCreateItems,
49
58
  getSiteContentSections: () => getSiteContentSections,
59
+ getSiteContentStatusFilterForCount: () => getSiteContentStatusFilterForCount,
60
+ hasActiveSiteContentStatusFilters: () => hasActiveSiteContentStatusFilters,
50
61
  init: () => init,
51
62
  injectIntoSiteContentListItemActions: () => injectIntoSiteContentListItemActions,
63
+ isSiteContentListNarrowed: () => isSiteContentListNarrowed,
64
+ isSiteContentTrashFilterActive: () => isSiteContentTrashFilterActive,
52
65
  registerSiteContentHeaderCreateItem: () => registerSiteContentHeaderCreateItem,
53
66
  registerSiteContentSection: () => registerSiteContentSection,
54
67
  resetSiteContentHeaderCreateItems: () => resetSiteContentHeaderCreateItems,
55
68
  resetSiteContentSections: () => resetSiteContentSections,
69
+ serializeSiteContentStatusFilters: () => serializeSiteContentStatusFilters,
56
70
  useContentPanelCoordinator: () => useContentPanelCoordinator,
57
- usePostListPagination: () => usePostListPagination
71
+ usePostListPagination: () => usePostListPagination,
72
+ useSiteContentSectionToolbar: () => useSiteContentSectionToolbar
58
73
  });
59
74
  module.exports = __toCommonJS(index_exports);
60
75
 
@@ -84,8 +99,8 @@ var import_editor_sidebar2 = require("@elementor/editor-sidebar");
84
99
  var import_editor_panels2 = require("@elementor/editor-panels");
85
100
 
86
101
  // src/components/panel/shell.tsx
87
- var React38 = __toESM(require("react"));
88
- var import_react14 = require("react");
102
+ var React39 = __toESM(require("react"));
103
+ var import_react16 = require("react");
89
104
  var import_editor_panels = require("@elementor/editor-panels");
90
105
  var import_editor_sidebar = require("@elementor/editor-sidebar");
91
106
  var import_ui27 = require("@elementor/ui");
@@ -94,119 +109,9 @@ var import_i18n28 = require("@wordpress/i18n");
94
109
  // src/contexts/content-panel-coordinator.tsx
95
110
  var React = __toESM(require("react"));
96
111
  var import_react = require("react");
97
-
98
- // src/site-content-sort.ts
99
- var import_i18n = require("@wordpress/i18n");
100
- var SITE_CONTENT_SORT_OPTIONS = ["oldest", "newest"];
101
- var DEFAULT_SITE_CONTENT_SORT = "oldest";
102
- var SITE_CONTENT_SORT_POPOVER_WIDTH_PX = 280;
103
- var sortLabels = {
104
- oldest: (0, import_i18n.__)("Oldest", "elementor"),
105
- newest: (0, import_i18n.__)("Newest", "elementor")
106
- };
107
- function getSiteContentSortLabel(sort) {
108
- return sortLabels[sort];
109
- }
110
- function hasActiveSiteContentSort(sort) {
111
- return sort !== DEFAULT_SITE_CONTENT_SORT;
112
- }
113
- function getRestOrderForSiteContentSort(sort) {
114
- if (sort === "newest") {
115
- return { order: "desc", orderby: "date" };
116
- }
117
- return { order: "asc", orderby: "date" };
118
- }
119
- function shouldPinHomepageForSiteContentSort(sort) {
120
- return sort === DEFAULT_SITE_CONTENT_SORT;
121
- }
122
-
123
- // src/site-content-status-filter.ts
124
- var import_i18n2 = require("@wordpress/i18n");
125
- var SITE_CONTENT_SELECTABLE_STATUS_FILTERS = [
126
- "publish",
127
- "draft",
128
- "pending",
129
- "private",
130
- "future",
131
- "trash"
132
- ];
133
- var EMPTY_SITE_CONTENT_STATUS_FILTERS = {
134
- draft: false,
135
- future: false,
136
- pending: false,
137
- private: false,
138
- publish: false,
139
- trash: false
140
- };
141
- var filterLabels = {
142
- publish: (0, import_i18n2.__)("Published", "elementor"),
143
- draft: (0, import_i18n2.__)("Drafts", "elementor"),
144
- pending: (0, import_i18n2.__)("Pending", "elementor"),
145
- private: (0, import_i18n2.__)("Private", "elementor"),
146
- future: (0, import_i18n2.__)("Scheduled", "elementor"),
147
- trash: (0, import_i18n2.__)("Trash", "elementor")
148
- };
149
- var SITE_CONTENT_ALL_FILTER_LABEL = (0, import_i18n2.__)("All", "elementor");
150
- var SITE_CONTENT_FILTER_POPOVER_WIDTH_PX = 280;
151
- function getSiteContentStatusFilterLabel(filter) {
152
- return filterLabels[filter];
153
- }
154
- function hasActiveSiteContentStatusFilters(filters) {
155
- return SITE_CONTENT_SELECTABLE_STATUS_FILTERS.some((key) => filters[key]);
156
- }
157
- function getActiveSiteContentStatusFilterKeys(filters) {
158
- return SITE_CONTENT_SELECTABLE_STATUS_FILTERS.filter((key) => filters[key]);
159
- }
160
- var serializeSiteContentStatusFilters = (statusFilters) => SITE_CONTENT_SELECTABLE_STATUS_FILTERS.map((key) => statusFilters[key] ? key : "").join("|");
161
- function getRestStatusForSiteContentFilters(filters) {
162
- if (filters.trash) {
163
- return "trash";
164
- }
165
- const active = getActiveSiteContentStatusFilterKeys(filters);
166
- if (0 === active.length) {
167
- return "any";
168
- }
169
- return active.join(",");
170
- }
171
- function isSiteContentTrashFilterActive(filters) {
172
- return filters.trash;
173
- }
174
- function isSiteContentListNarrowed(filters, search) {
175
- return hasActiveSiteContentStatusFilters(filters) || search.trim().length > 0;
176
- }
177
- function toggleSiteContentStatusFilter(filters, filter) {
178
- if ("trash" === filter) {
179
- const isTrashOn = !filters.trash;
180
- return {
181
- ...EMPTY_SITE_CONTENT_STATUS_FILTERS,
182
- trash: isTrashOn
183
- };
184
- }
185
- return {
186
- ...filters,
187
- trash: false,
188
- [filter]: !filters[filter]
189
- };
190
- }
191
- function shouldShowSiteContentStatusFilterRow(count, isLoadingCounts, isSelected) {
192
- if (isSelected) {
193
- return true;
194
- }
195
- if (isLoadingCounts || void 0 === count) {
196
- return false;
197
- }
198
- return count > 0;
199
- }
200
-
201
- // src/contexts/content-panel-coordinator.tsx
202
112
  var ContentPanelCoordinatorContext = (0, import_react.createContext)(null);
203
113
  function ContentPanelCoordinatorProvider({ children }) {
204
114
  const sectionsRef = (0, import_react.useRef)(/* @__PURE__ */ new Map());
205
- const [searchQuery, setSearchQuery] = (0, import_react.useState)("");
206
- const [siteContentSort, setSiteContentSortState] = (0, import_react.useState)(DEFAULT_SITE_CONTENT_SORT);
207
- const [statusFilters, setStatusFilters] = (0, import_react.useState)(
208
- EMPTY_SITE_CONTENT_STATUS_FILTERS
209
- );
210
115
  const registerSection = (0, import_react.useCallback)((type, handlers) => {
211
116
  sectionsRef.current.set(type, handlers);
212
117
  }, []);
@@ -221,50 +126,13 @@ function ContentPanelCoordinatorProvider({ children }) {
221
126
  handlers.setExpanded(true);
222
127
  handlers.startCreate();
223
128
  }, []);
224
- const clearActiveToolbarFilters = (0, import_react.useCallback)(() => {
225
- setSiteContentSortState(DEFAULT_SITE_CONTENT_SORT);
226
- setStatusFilters(EMPTY_SITE_CONTENT_STATUS_FILTERS);
227
- }, []);
228
- const clearSiteContentSort = (0, import_react.useCallback)(() => {
229
- setSiteContentSortState(DEFAULT_SITE_CONTENT_SORT);
230
- }, []);
231
- const clearStatusFilters = (0, import_react.useCallback)(() => {
232
- setStatusFilters(EMPTY_SITE_CONTENT_STATUS_FILTERS);
233
- }, []);
234
- const setSiteContentSort = (0, import_react.useCallback)((sort) => {
235
- setSiteContentSortState(sort);
236
- }, []);
237
- const toggleStatusFilter = (0, import_react.useCallback)((filter) => {
238
- setStatusFilters((current) => toggleSiteContentStatusFilter(current, filter));
239
- }, []);
240
129
  const value = (0, import_react.useMemo)(
241
130
  () => ({
242
- clearActiveToolbarFilters,
243
- clearSiteContentSort,
244
- clearStatusFilters,
245
131
  registerSection,
246
132
  requestCreate,
247
- searchQuery,
248
- setSearchQuery,
249
- setSiteContentSort,
250
- siteContentSort,
251
- statusFilters,
252
- toggleStatusFilter,
253
133
  unregisterSection
254
134
  }),
255
- [
256
- clearActiveToolbarFilters,
257
- clearSiteContentSort,
258
- clearStatusFilters,
259
- registerSection,
260
- requestCreate,
261
- searchQuery,
262
- siteContentSort,
263
- setSiteContentSort,
264
- statusFilters,
265
- toggleStatusFilter,
266
- unregisterSection
267
- ]
135
+ [registerSection, requestCreate, unregisterSection]
268
136
  );
269
137
  return /* @__PURE__ */ React.createElement(ContentPanelCoordinatorContext.Provider, { value }, children);
270
138
  }
@@ -283,20 +151,47 @@ var import_react2 = require("react");
283
151
 
284
152
  // src/api/post.ts
285
153
  var import_api_fetch = __toESM(require("@wordpress/api-fetch"));
286
- var import_i18n3 = require("@wordpress/i18n");
154
+ var import_i18n2 = require("@wordpress/i18n");
155
+
156
+ // src/site-content-sort.ts
157
+ var import_i18n = require("@wordpress/i18n");
158
+ var SITE_CONTENT_SORT_OPTIONS = ["oldest", "newest"];
159
+ var DEFAULT_SITE_CONTENT_SORT = "oldest";
160
+ var SITE_CONTENT_SORT_POPOVER_WIDTH_PX = 280;
161
+ var sortLabels = {
162
+ oldest: (0, import_i18n.__)("Oldest", "elementor"),
163
+ newest: (0, import_i18n.__)("Newest", "elementor")
164
+ };
165
+ function getSiteContentSortLabel(sort) {
166
+ return sortLabels[sort];
167
+ }
168
+ function hasActiveSiteContentSort(sort) {
169
+ return sort !== DEFAULT_SITE_CONTENT_SORT;
170
+ }
171
+ function getRestOrderForSiteContentSort(sort) {
172
+ if (sort === "newest") {
173
+ return { order: "desc", orderby: "date" };
174
+ }
175
+ return { order: "asc", orderby: "date" };
176
+ }
177
+ function shouldPinHomepageForSiteContentSort(sort) {
178
+ return sort === DEFAULT_SITE_CONTENT_SORT;
179
+ }
180
+
181
+ // src/api/post.ts
287
182
  var postTypesMap = {
288
183
  page: {
289
184
  labels: {
290
- singular_name: (0, import_i18n3.__)("Page", "elementor"),
291
- plural_name: (0, import_i18n3.__)("Pages", "elementor")
185
+ singular_name: (0, import_i18n2.__)("Page", "elementor"),
186
+ plural_name: (0, import_i18n2.__)("Pages", "elementor")
292
187
  },
293
188
  rest_base: "pages",
294
189
  createCapability: "edit_pages"
295
190
  },
296
191
  post: {
297
192
  labels: {
298
- singular_name: (0, import_i18n3.__)("Post", "elementor"),
299
- plural_name: (0, import_i18n3.__)("Posts", "elementor")
193
+ singular_name: (0, import_i18n2.__)("Post", "elementor"),
194
+ plural_name: (0, import_i18n2.__)("Posts", "elementor")
300
195
  },
301
196
  rest_base: "posts",
302
197
  createCapability: "edit_posts"
@@ -311,9 +206,9 @@ function getAccessiblePanelPostTypes(capabilities) {
311
206
  }
312
207
  function getCannotEditPanelItemMessage(postTypeSlug) {
313
208
  if ("page" === postTypeSlug) {
314
- return (0, import_i18n3.__)("You cannot edit this page.", "elementor");
209
+ return (0, import_i18n2.__)("You cannot edit this page.", "elementor");
315
210
  }
316
- return (0, import_i18n3.__)("You cannot edit this post.", "elementor");
211
+ return (0, import_i18n2.__)("You cannot edit this post.", "elementor");
317
212
  }
318
213
  var POST_PER_PAGE = 10;
319
214
  var COUNT_QUERY_PER_PAGE = 1;
@@ -442,9 +337,7 @@ function useAccessiblePanelPostTypes() {
442
337
  var CONTENT_PANEL_INSET_SPACING = 2;
443
338
  var CONTENT_PANEL_LIST_ROW_GAP = 0.5;
444
339
  var CONTENT_PANEL_LIST_ROW_INSET_INLINE = 0.75;
445
- var CONTENT_PANEL_LIST_ROW_ACTIVE_SECONDARY_ACTIONS_COUNT = 2;
446
- var CONTENT_PANEL_LIST_ROW_ACTIVE_SECONDARY_ACTION_SLOT_WIDTH = 5.5;
447
- 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;
340
+ var CONTENT_PANEL_LIST_ROW_SECONDARY_ACTION_SLOT_WIDTH = 5.5;
448
341
  var CONTENT_PANEL_LIST_ROW_TITLE_FONT_SIZE = "0.75rem";
449
342
  var CONTENT_PANEL_LIST_SECTION_BOTTOM_SPACING = 1;
450
343
  var CONTENT_PANEL_SECTION_HEADER_PADDING_BLOCK = 1.25;
@@ -456,19 +349,38 @@ var contentPanelInsetPaddingSx = {
456
349
  var contentPanelListRowPaddingSx = {
457
350
  ...contentPanelInsetPaddingSx
458
351
  };
459
- var contentPanelListItemActiveActionsInsetSx = {
352
+ var contentPanelListItemSecondaryInsetSx = (trailingActionCount) => ({
460
353
  "&& > .MuiListItemButton-root": {
461
- paddingInlineEnd: CONTENT_PANEL_LIST_ROW_ACTIVE_SECONDARY_INSET,
354
+ paddingInlineEnd: trailingActionCount * CONTENT_PANEL_LIST_ROW_SECONDARY_ACTION_SLOT_WIDTH,
462
355
  paddingRight: "unset"
463
356
  }
464
- };
465
- function getContentPanelListItemSx(hasActiveRowActions) {
466
- if (!hasActiveRowActions) {
467
- return contentPanelListRowPaddingSx;
468
- }
357
+ });
358
+ function getContentPanelListItemSx(trailingActionCount) {
469
359
  return {
470
360
  ...contentPanelListRowPaddingSx,
471
- ...contentPanelListItemActiveActionsInsetSx
361
+ ...contentPanelListItemSecondaryInsetSx(trailingActionCount)
362
+ };
363
+ }
364
+ function getContentPanelListItemRowStateSx(isActive, allowRowHover) {
365
+ if (isActive) {
366
+ return {
367
+ borderRadius: 1,
368
+ backgroundColor: "action.selected",
369
+ "&:hover": {
370
+ backgroundColor: "action.selected"
371
+ }
372
+ };
373
+ }
374
+ if (!allowRowHover) {
375
+ return {
376
+ borderRadius: 1
377
+ };
378
+ }
379
+ return {
380
+ borderRadius: 1,
381
+ "&:hover": {
382
+ backgroundColor: "action.hover"
383
+ }
472
384
  };
473
385
  }
474
386
  var contentPanelHeaderStackSx = {
@@ -492,27 +404,34 @@ var contentPanelListSectionListSx = {
492
404
  gap: CONTENT_PANEL_LIST_ROW_GAP,
493
405
  paddingBlockEnd: CONTENT_PANEL_LIST_SECTION_BOTTOM_SPACING
494
406
  };
495
- var contentPanelListItemButtonSx = {
496
- justifyContent: "flex-start",
497
- paddingInline: CONTENT_PANEL_LIST_ROW_INSET_INLINE,
498
- textAlign: "start",
499
- width: "100%",
407
+ var contentPanelListItemButtonTransparentSx = {
408
+ backgroundColor: "transparent",
500
409
  "&.Mui-selected": {
501
- backgroundColor: "action.selected"
410
+ backgroundColor: "transparent"
502
411
  },
503
412
  "&.Mui-selected:hover": {
504
- backgroundColor: "action.selected"
413
+ backgroundColor: "transparent"
505
414
  },
506
- "&:hover:not(.Mui-disabled)": {
507
- backgroundColor: "action.hover"
415
+ "&:hover": {
416
+ backgroundColor: "transparent"
417
+ },
418
+ "&.Mui-disabled": {
419
+ backgroundColor: "transparent"
508
420
  }
509
421
  };
422
+ var contentPanelListItemButtonSx = {
423
+ ...contentPanelListItemButtonTransparentSx,
424
+ justifyContent: "flex-start",
425
+ paddingInline: CONTENT_PANEL_LIST_ROW_INSET_INLINE,
426
+ textAlign: "start",
427
+ width: "100%"
428
+ };
510
429
 
511
430
  // src/components/panel/content-panel-header-add.tsx
512
431
  var React5 = __toESM(require("react"));
513
432
  var import_icons4 = require("@elementor/icons");
514
433
  var import_ui4 = require("@elementor/ui");
515
- var import_i18n6 = require("@wordpress/i18n");
434
+ var import_i18n5 = require("@wordpress/i18n");
516
435
 
517
436
  // src/hooks/use-can-create.ts
518
437
  function useCanCreate(postTypeSlug) {
@@ -556,7 +475,7 @@ var React4 = __toESM(require("react"));
556
475
  var import_react4 = require("react");
557
476
  var import_icons3 = require("@elementor/icons");
558
477
  var import_ui3 = require("@elementor/ui");
559
- var import_i18n5 = require("@wordpress/i18n");
478
+ var import_i18n4 = require("@wordpress/i18n");
560
479
 
561
480
  // src/components/panel/popups/site-content-popups-promotion-chip.tsx
562
481
  var React3 = __toESM(require("react"));
@@ -564,7 +483,7 @@ var import_react3 = require("react");
564
483
  var import_editor_controls = require("@elementor/editor-controls");
565
484
  var import_editor_ui = require("@elementor/editor-ui");
566
485
  var import_ui2 = require("@elementor/ui");
567
- var import_i18n4 = require("@wordpress/i18n");
486
+ var import_i18n3 = require("@wordpress/i18n");
568
487
  var TRACKING_DATA = {
569
488
  target_name: "popups",
570
489
  target_location: "widget_panel"
@@ -586,9 +505,9 @@ var SiteContentPopupsPromotionChip = (0, import_react3.forwardRef)((_, ref) => {
586
505
  import_editor_ui.PromotionPopover,
587
506
  {
588
507
  open: isOpen,
589
- title: (0, import_i18n4.__)("Popups", "elementor"),
590
- content: (0, import_i18n4.__)("Upgrade to continue creating and editing popups.", "elementor"),
591
- ctaText: (0, import_i18n4.__)("Upgrade now", "elementor"),
508
+ title: (0, import_i18n3.__)("Popups", "elementor"),
509
+ content: (0, import_i18n3.__)("Upgrade to continue creating and editing popups.", "elementor"),
510
+ ctaText: (0, import_i18n3.__)("Upgrade now", "elementor"),
592
511
  ctaUrl: upgradeUrl,
593
512
  onClose: (event) => {
594
513
  event.stopPropagation();
@@ -614,7 +533,7 @@ var SiteContentPopupsPromotionChip = (0, import_react3.forwardRef)((_, ref) => {
614
533
  function PopupHeaderCreateMenuItem({ onSelect }) {
615
534
  const promotionRef = (0, import_react4.useRef)(null);
616
535
  const canCreate = env.popups?.can_use ?? false;
617
- const label = (0, import_i18n5.__)("Popup", "elementor");
536
+ const label = (0, import_i18n4.__)("Popup", "elementor");
618
537
  const handleClick = () => {
619
538
  if (!canCreate) {
620
539
  promotionRef.current?.toggle();
@@ -671,7 +590,7 @@ function ContentPanelHeaderAdd() {
671
590
  return /* @__PURE__ */ React5.createElement(React5.Fragment, null, /* @__PURE__ */ React5.createElement(
672
591
  ContentPanelAddIconButton,
673
592
  {
674
- "aria-label": (0, import_i18n6.__)("Add new", "elementor"),
593
+ "aria-label": (0, import_i18n5.__)("Add new", "elementor"),
675
594
  ...buttonProps,
676
595
  disabled: !canAddAny
677
596
  }
@@ -683,388 +602,60 @@ function ContentPanelHeaderAdd() {
683
602
  })))));
684
603
  }
685
604
 
686
- // src/components/panel/content-panel-toolbar.tsx
687
- var React13 = __toESM(require("react"));
688
- var import_ui12 = require("@elementor/ui");
689
-
690
- // src/components/panel/content-panel-active-filters.tsx
691
- var React7 = __toESM(require("react"));
692
- var import_ui6 = require("@elementor/ui");
693
- var import_i18n7 = require("@wordpress/i18n");
694
-
695
- // src/components/panel/content-panel-clear-filters-button.tsx
605
+ // src/components/panel/error-snackbar.tsx
696
606
  var React6 = __toESM(require("react"));
697
- var import_icons5 = require("@elementor/icons");
698
607
  var import_ui5 = require("@elementor/ui");
699
- function ContentPanelClearFiltersButton({ ariaLabel, onClear, sx, tooltipText }) {
700
- return /* @__PURE__ */ React6.createElement(import_ui5.Tooltip, { disableInteractive: true, placement: "top", title: tooltipText }, /* @__PURE__ */ React6.createElement(import_ui5.Box, null, /* @__PURE__ */ React6.createElement(import_ui5.IconButton, { "aria-label": ariaLabel, onClick: onClear, size: "tiny", sx }, /* @__PURE__ */ React6.createElement(import_icons5.BrushBigIcon, { fontSize: "tiny" }))));
701
- }
608
+ var ErrorSnackbar = ({ open, onClose }) => {
609
+ return /* @__PURE__ */ React6.createElement(
610
+ import_ui5.Snackbar,
611
+ {
612
+ open,
613
+ onClose,
614
+ anchorOrigin: {
615
+ vertical: "bottom",
616
+ horizontal: "left"
617
+ }
618
+ },
619
+ /* @__PURE__ */ React6.createElement(import_ui5.Alert, { onClose, severity: "error", sx: { width: "100%" } }, /* @__PURE__ */ React6.createElement(
620
+ import_ui5.Typography,
621
+ {
622
+ component: "span",
623
+ sx: {
624
+ fontWeight: "bold"
625
+ }
626
+ },
627
+ "We couldn\u2019t complete the action."
628
+ ), " ", "Please try again")
629
+ );
630
+ };
631
+ var error_snackbar_default = ErrorSnackbar;
702
632
 
703
- // src/components/panel/content-panel-active-filters.tsx
704
- var contentPanelFilterChipSx = {
705
- "& .MuiChip-deleteIcon": {
706
- display: "none",
707
- transition: "opacity 0.2s"
708
- },
709
- "&:hover .MuiChip-deleteIcon": {
710
- display: "block"
711
- }
633
+ // src/components/panel/shell-panel-body-content.tsx
634
+ var React38 = __toESM(require("react"));
635
+ var import_ui26 = require("@elementor/ui");
636
+
637
+ // src/contexts/post-list-context.tsx
638
+ var React7 = __toESM(require("react"));
639
+ var import_react5 = require("react");
640
+ var defaultValues = {
641
+ type: "page",
642
+ editMode: { mode: "none", details: {} },
643
+ setEditMode: () => null,
644
+ resetEditMode: () => null,
645
+ setError: () => null
712
646
  };
713
- function ContentPanelActiveFilters() {
714
- const { clearActiveToolbarFilters, setSiteContentSort, siteContentSort, statusFilters, toggleStatusFilter } = useContentPanelCoordinator();
715
- const hasStatusFilters = hasActiveSiteContentStatusFilters(statusFilters);
716
- const hasSort = hasActiveSiteContentSort(siteContentSort);
717
- if (!hasStatusFilters && !hasSort) {
718
- return null;
719
- }
720
- const activeKeys = getActiveSiteContentStatusFilterKeys(statusFilters);
721
- return /* @__PURE__ */ React7.createElement(import_ui6.Stack, { alignItems: "center", direction: "row", justifyContent: "space-between" }, /* @__PURE__ */ React7.createElement(import_ui6.Stack, { alignItems: "center", direction: "row", flexWrap: "wrap", gap: 0.5 }, hasSort && /* @__PURE__ */ React7.createElement(
722
- import_ui6.Chip,
723
- {
724
- label: getSiteContentSortLabel(siteContentSort),
725
- onDelete: () => setSiteContentSort(DEFAULT_SITE_CONTENT_SORT),
726
- size: "tiny",
727
- sx: contentPanelFilterChipSx
728
- }
729
- ), activeKeys.map((key) => /* @__PURE__ */ React7.createElement(
730
- import_ui6.Chip,
731
- {
732
- key,
733
- label: getSiteContentStatusFilterLabel(key),
734
- onDelete: () => toggleStatusFilter(key),
735
- size: "tiny",
736
- sx: contentPanelFilterChipSx
737
- }
738
- ))), /* @__PURE__ */ React7.createElement(
739
- ContentPanelClearFiltersButton,
740
- {
741
- ariaLabel: (0, import_i18n7.__)("Clear Filters", "elementor"),
742
- onClear: clearActiveToolbarFilters,
743
- sx: { margin: "0 0 auto auto" },
744
- tooltipText: (0, import_i18n7.__)("Clear Filters", "elementor")
745
- }
746
- ));
747
- }
748
-
749
- // src/components/panel/content-panel-search.tsx
750
- var React8 = __toESM(require("react"));
751
- var import_icons6 = require("@elementor/icons");
752
- var import_ui7 = require("@elementor/ui");
753
- var import_i18n8 = require("@wordpress/i18n");
754
- function ContentPanelSearch() {
755
- const { searchQuery, setSearchQuery } = useContentPanelCoordinator();
756
- return /* @__PURE__ */ React8.createElement(import_ui7.Box, { component: "search", "aria-label": (0, import_i18n8.__)("Search site content", "elementor") }, /* @__PURE__ */ React8.createElement(
757
- import_ui7.TextField,
758
- {
759
- fullWidth: true,
760
- size: "tiny",
761
- value: searchQuery,
762
- placeholder: (0, import_i18n8.__)("Search", "elementor"),
763
- onChange: (event) => setSearchQuery(event.target.value),
764
- inputProps: {
765
- "aria-label": (0, import_i18n8.__)("Search", "elementor")
766
- },
767
- InputProps: {
768
- startAdornment: /* @__PURE__ */ React8.createElement(import_ui7.InputAdornment, { position: "start" }, /* @__PURE__ */ React8.createElement(import_icons6.SearchIcon, { fontSize: "tiny" }))
769
- }
770
- }
771
- ));
772
- }
773
-
774
- // src/components/panel/content-panel-sort.tsx
775
- var React10 = __toESM(require("react"));
776
- var import_editor_ui2 = require("@elementor/editor-ui");
777
- var import_icons8 = require("@elementor/icons");
778
- var import_ui9 = require("@elementor/ui");
779
- var import_i18n9 = require("@wordpress/i18n");
780
-
781
- // src/components/panel/content-panel-sort-list.tsx
782
- var React9 = __toESM(require("react"));
783
- var import_icons7 = require("@elementor/icons");
784
- var import_ui8 = require("@elementor/ui");
785
- var renderSortMenuItemContent = (label, selected) => /* @__PURE__ */ React9.createElement(import_ui8.Stack, { alignItems: "center", direction: "row", gap: 1, width: "100%" }, /* @__PURE__ */ React9.createElement(import_ui8.Typography, { sx: { color: "text.secondary", flex: 1 }, variant: "caption" }, label), selected ? /* @__PURE__ */ React9.createElement(import_icons7.CheckIcon, { "aria-hidden": true, fontSize: "tiny" }) : null);
786
- function ContentPanelSortList() {
787
- const { setSiteContentSort, siteContentSort } = useContentPanelCoordinator();
788
- return /* @__PURE__ */ React9.createElement(import_ui8.MenuList, { dense: true }, SITE_CONTENT_SORT_OPTIONS.map((option) => {
789
- const isSelected = siteContentSort === option;
790
- return /* @__PURE__ */ React9.createElement(
791
- import_ui8.MenuItem,
792
- {
793
- key: option,
794
- "aria-checked": isSelected,
795
- onClick: () => setSiteContentSort(option),
796
- role: "menuitemradio",
797
- selected: isSelected
798
- },
799
- renderSortMenuItemContent(getSiteContentSortLabel(option), isSelected)
800
- );
801
- }));
802
- }
803
-
804
- // src/components/panel/content-panel-sort.tsx
805
- function ContentPanelSort() {
806
- const { clearSiteContentSort, siteContentSort } = useContentPanelCoordinator();
807
- const popupState = (0, import_ui9.usePopupState)({
808
- variant: "popover",
809
- disableAutoFocus: true
810
- });
811
- const hasActiveSort = hasActiveSiteContentSort(siteContentSort);
812
- return /* @__PURE__ */ React10.createElement(React10.Fragment, null, /* @__PURE__ */ React10.createElement(import_ui9.Tooltip, { placement: "top", title: (0, import_i18n9.__)("Sort", "elementor") }, /* @__PURE__ */ React10.createElement(
813
- import_ui9.ToggleButton,
814
- {
815
- "aria-label": (0, import_i18n9.__)("Sort", "elementor"),
816
- selected: popupState.isOpen || hasActiveSort,
817
- size: "tiny",
818
- value: "sort",
819
- ...(0, import_ui9.bindToggle)(popupState)
820
- },
821
- /* @__PURE__ */ React10.createElement(import_icons8.ArrowsSortIcon, { fontSize: "tiny" })
822
- )), /* @__PURE__ */ React10.createElement(
823
- import_ui9.Popover,
824
- {
825
- anchorOrigin: {
826
- horizontal: "right",
827
- vertical: "top"
828
- },
829
- sx: {
830
- maxWidth: `${SITE_CONTENT_SORT_POPOVER_WIDTH_PX}px`
831
- },
832
- transformOrigin: {
833
- horizontal: -21,
834
- vertical: "top"
835
- },
836
- ...(0, import_ui9.bindPopover)(popupState)
837
- },
838
- /* @__PURE__ */ React10.createElement(
839
- import_editor_ui2.PopoverHeader,
840
- {
841
- actions: hasActiveSort ? [
842
- /* @__PURE__ */ React10.createElement(
843
- ContentPanelClearFiltersButton,
844
- {
845
- ariaLabel: (0, import_i18n9.__)("Clear sort", "elementor"),
846
- key: "clear-sort",
847
- onClear: clearSiteContentSort,
848
- tooltipText: (0, import_i18n9.__)("Clear sort", "elementor")
849
- }
850
- )
851
- ] : [],
852
- icon: /* @__PURE__ */ React10.createElement(import_icons8.ArrowsSortIcon, { fontSize: "tiny" }),
853
- onClose: popupState.close,
854
- title: (0, import_i18n9.__)("Sort", "elementor")
855
- }
856
- ),
857
- /* @__PURE__ */ React10.createElement(import_ui9.Divider, { sx: { borderWidth: "1px 0 0 0" } }),
858
- /* @__PURE__ */ React10.createElement(import_editor_ui2.PopoverBody, { height: "auto", width: SITE_CONTENT_SORT_POPOVER_WIDTH_PX }, /* @__PURE__ */ React10.createElement(ContentPanelSortList, null))
859
- ));
860
- }
861
-
862
- // src/components/panel/content-panel-status-filter.tsx
863
- var React12 = __toESM(require("react"));
864
- var import_editor_ui3 = require("@elementor/editor-ui");
865
- var import_icons10 = require("@elementor/icons");
866
- var import_ui11 = require("@elementor/ui");
867
- var import_i18n10 = require("@wordpress/i18n");
868
-
869
- // src/components/panel/content-panel-status-filter-list.tsx
870
- var React11 = __toESM(require("react"));
871
- var import_icons9 = require("@elementor/icons");
872
- var import_ui10 = require("@elementor/ui");
873
-
874
- // src/hooks/use-site-content-status-filter-counts.ts
875
- var import_query2 = require("@elementor/query");
876
- var STATUS_FILTER_COUNTS_STALE_TIME_MS = 30 * 1e3;
877
- var siteContentStatusFilterCountsQueryKeyBase = ["site-navigation", "status-filter-counts"];
878
- var siteContentStatusFilterCountsQueryKey = (postTypes) => [
879
- ...siteContentStatusFilterCountsQueryKeyBase,
880
- postTypes.join(",")
881
- ];
882
- var sumFulfilledTotals = (results) => {
883
- const fulfilled = results.filter(
884
- (result) => "fulfilled" === result.status
885
- );
886
- if (fulfilled.length !== results.length) {
887
- return void 0;
888
- }
889
- return fulfilled.reduce((sum, result) => sum + result.value, 0);
890
- };
891
- var fetchStatusFilterCounts = async (postTypes) => {
892
- const entries = await Promise.all(
893
- SITE_CONTENT_SELECTABLE_STATUS_FILTERS.map(async (status) => {
894
- const results = await Promise.allSettled(postTypes.map((slug) => fetchPostsTotal(slug, status)));
895
- const total = sumFulfilledTotals(results);
896
- if (void 0 === total) {
897
- return null;
898
- }
899
- return [status, total];
900
- })
901
- );
902
- return Object.fromEntries(entries.filter((entry) => null !== entry));
903
- };
904
- function useSiteContentStatusFilterCounts(postTypes, enabled) {
905
- return (0, import_query2.useQuery)({
906
- enabled: enabled && postTypes.length > 0,
907
- queryFn: () => fetchStatusFilterCounts(postTypes),
908
- queryKey: siteContentStatusFilterCountsQueryKey(postTypes),
909
- staleTime: STATUS_FILTER_COUNTS_STALE_TIME_MS
910
- });
911
- }
912
-
913
- // src/components/panel/content-panel-status-filter-list.tsx
914
- var renderFilterMenuItemContent = (label, selected) => /* @__PURE__ */ React11.createElement(import_ui10.Stack, { alignItems: "center", direction: "row", gap: 1, width: "100%" }, /* @__PURE__ */ React11.createElement(import_ui10.Typography, { sx: { color: "text.secondary", flex: 1 }, variant: "caption" }, label), selected ? /* @__PURE__ */ React11.createElement(import_icons9.CheckIcon, { "aria-hidden": true, fontSize: "tiny" }) : null);
915
- function ContentPanelStatusFilterList({ loadCounts }) {
916
- const { clearStatusFilters, statusFilters, toggleStatusFilter } = useContentPanelCoordinator();
917
- const { accessiblePostTypes } = useAccessiblePanelPostTypes();
918
- const { data: statusCounts, isPending: isLoadingCounts } = useSiteContentStatusFilterCounts(
919
- accessiblePostTypes,
920
- loadCounts
921
- );
922
- const isAllSelected = !hasActiveSiteContentStatusFilters(statusFilters);
923
- const visibleFilters = SITE_CONTENT_SELECTABLE_STATUS_FILTERS.filter(
924
- (filter) => shouldShowSiteContentStatusFilterRow(statusCounts?.[filter], isLoadingCounts, statusFilters[filter])
925
- );
926
- return /* @__PURE__ */ React11.createElement(import_ui10.MenuList, { dense: true }, /* @__PURE__ */ React11.createElement(
927
- import_ui10.MenuItem,
928
- {
929
- "aria-checked": isAllSelected,
930
- onClick: clearStatusFilters,
931
- role: "menuitemcheckbox",
932
- selected: isAllSelected
933
- },
934
- renderFilterMenuItemContent(SITE_CONTENT_ALL_FILTER_LABEL, isAllSelected)
935
- ), visibleFilters.map((filter) => {
936
- const isSelected = statusFilters[filter];
937
- return /* @__PURE__ */ React11.createElement(
938
- import_ui10.MenuItem,
939
- {
940
- key: filter,
941
- "aria-checked": isSelected,
942
- onClick: () => toggleStatusFilter(filter),
943
- role: "menuitemcheckbox",
944
- selected: isSelected
945
- },
946
- renderFilterMenuItemContent(getSiteContentStatusFilterLabel(filter), isSelected)
947
- );
948
- }));
949
- }
950
-
951
- // src/components/panel/content-panel-status-filter.tsx
952
- function ContentPanelStatusFilter() {
953
- const { clearStatusFilters, statusFilters } = useContentPanelCoordinator();
954
- const popupState = (0, import_ui11.usePopupState)({
955
- variant: "popover",
956
- disableAutoFocus: true
957
- });
958
- const hasActiveFilters = hasActiveSiteContentStatusFilters(statusFilters);
959
- return /* @__PURE__ */ React12.createElement(React12.Fragment, null, /* @__PURE__ */ React12.createElement(import_ui11.Tooltip, { placement: "top", title: (0, import_i18n10.__)("Filters", "elementor") }, /* @__PURE__ */ React12.createElement(
960
- import_ui11.ToggleButton,
961
- {
962
- "aria-label": (0, import_i18n10.__)("Filters", "elementor"),
963
- selected: popupState.isOpen || hasActiveFilters,
964
- size: "tiny",
965
- value: "filter",
966
- ...(0, import_ui11.bindToggle)(popupState)
967
- },
968
- /* @__PURE__ */ React12.createElement(import_icons10.FilterIcon, { fontSize: "tiny" })
969
- )), /* @__PURE__ */ React12.createElement(
970
- import_ui11.Popover,
971
- {
972
- anchorOrigin: {
973
- horizontal: "right",
974
- vertical: "top"
975
- },
976
- sx: {
977
- maxWidth: `${SITE_CONTENT_FILTER_POPOVER_WIDTH_PX}px`
978
- },
979
- transformOrigin: {
980
- horizontal: -21,
981
- vertical: "top"
982
- },
983
- ...(0, import_ui11.bindPopover)(popupState)
984
- },
985
- /* @__PURE__ */ React12.createElement(
986
- import_editor_ui3.PopoverHeader,
987
- {
988
- actions: hasActiveFilters ? [
989
- /* @__PURE__ */ React12.createElement(
990
- ContentPanelClearFiltersButton,
991
- {
992
- ariaLabel: (0, import_i18n10.__)("Clear all", "elementor"),
993
- key: "clear-all-filters",
994
- onClear: clearStatusFilters,
995
- tooltipText: (0, import_i18n10.__)("Clear all", "elementor")
996
- }
997
- )
998
- ] : [],
999
- icon: /* @__PURE__ */ React12.createElement(import_icons10.FilterIcon, { fontSize: "tiny" }),
1000
- onClose: popupState.close,
1001
- title: (0, import_i18n10.__)("Filters", "elementor")
1002
- }
1003
- ),
1004
- /* @__PURE__ */ React12.createElement(import_ui11.Divider, { sx: { borderWidth: "1px 0 0 0" } }),
1005
- /* @__PURE__ */ React12.createElement(import_editor_ui3.PopoverBody, { height: "auto", width: SITE_CONTENT_FILTER_POPOVER_WIDTH_PX }, /* @__PURE__ */ React12.createElement(ContentPanelStatusFilterList, { loadCounts: popupState.isOpen }))
1006
- ));
1007
- }
1008
-
1009
- // src/components/panel/content-panel-toolbar.tsx
1010
- function ContentPanelToolbar() {
1011
- return /* @__PURE__ */ React13.createElement(import_ui12.Box, { sx: contentPanelSearchBoxSx }, /* @__PURE__ */ React13.createElement(import_ui12.Stack, { gap: 0.75, width: "100%" }, /* @__PURE__ */ React13.createElement(import_ui12.Stack, { alignItems: "center", direction: "row", gap: 0.5, width: "100%" }, /* @__PURE__ */ React13.createElement(import_ui12.Box, { 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)));
1012
- }
1013
-
1014
- // src/components/panel/error-snackbar.tsx
1015
- var React14 = __toESM(require("react"));
1016
- var import_ui13 = require("@elementor/ui");
1017
- var ErrorSnackbar = ({ open, onClose }) => {
1018
- return /* @__PURE__ */ React14.createElement(
1019
- import_ui13.Snackbar,
1020
- {
1021
- open,
1022
- onClose,
1023
- anchorOrigin: {
1024
- vertical: "bottom",
1025
- horizontal: "left"
1026
- }
1027
- },
1028
- /* @__PURE__ */ React14.createElement(import_ui13.Alert, { onClose, severity: "error", sx: { width: "100%" } }, /* @__PURE__ */ React14.createElement(
1029
- import_ui13.Typography,
1030
- {
1031
- component: "span",
1032
- sx: {
1033
- fontWeight: "bold"
1034
- }
1035
- },
1036
- "We couldn\u2019t complete the action."
1037
- ), " ", "Please try again")
1038
- );
1039
- };
1040
- var error_snackbar_default = ErrorSnackbar;
1041
-
1042
- // src/components/panel/shell-panel-body-content.tsx
1043
- var React37 = __toESM(require("react"));
1044
- var import_ui26 = require("@elementor/ui");
1045
-
1046
- // src/contexts/post-list-context.tsx
1047
- var React15 = __toESM(require("react"));
1048
- var import_react5 = require("react");
1049
- var defaultValues = {
1050
- type: "page",
1051
- editMode: { mode: "none", details: {} },
1052
- setEditMode: () => null,
1053
- resetEditMode: () => null,
1054
- setError: () => null
1055
- };
1056
- var PostListContext = (0, import_react5.createContext)(defaultValues);
1057
- var PostListContextProvider = ({
1058
- type,
1059
- setError,
1060
- children
1061
- }) => {
1062
- const [editMode, setEditMode] = (0, import_react5.useState)(defaultValues.editMode);
1063
- const resetEditMode = () => {
1064
- setEditMode(defaultValues.editMode);
1065
- };
1066
- return /* @__PURE__ */ React15.createElement(
1067
- PostListContext.Provider,
647
+ var PostListContext = (0, import_react5.createContext)(defaultValues);
648
+ var PostListContextProvider = ({
649
+ type,
650
+ setError,
651
+ children
652
+ }) => {
653
+ const [editMode, setEditMode] = (0, import_react5.useState)(defaultValues.editMode);
654
+ const resetEditMode = () => {
655
+ setEditMode(defaultValues.editMode);
656
+ };
657
+ return /* @__PURE__ */ React7.createElement(
658
+ PostListContext.Provider,
1068
659
  {
1069
660
  value: {
1070
661
  type,
@@ -1085,29 +676,197 @@ function usePostListContext() {
1085
676
  return context;
1086
677
  }
1087
678
 
1088
- // src/site-content-sections.ts
1089
- var registeredSections = /* @__PURE__ */ new Map();
1090
- var DEFAULT_SECTION_PRIORITY = 0;
1091
- function registerSiteContentSection(section) {
1092
- registeredSections.set(section.id, section);
1093
- }
1094
- function getSiteContentSections() {
1095
- return Array.from(registeredSections.values()).sort(
1096
- (first, second) => (first.priority ?? DEFAULT_SECTION_PRIORITY) - (second.priority ?? DEFAULT_SECTION_PRIORITY)
679
+ // src/site-content-sections.ts
680
+ var registeredSections = /* @__PURE__ */ new Map();
681
+ var DEFAULT_SECTION_PRIORITY = 0;
682
+ function registerSiteContentSection(section) {
683
+ registeredSections.set(section.id, section);
684
+ }
685
+ function getSiteContentSections() {
686
+ return Array.from(registeredSections.values()).sort(
687
+ (first, second) => (first.priority ?? DEFAULT_SECTION_PRIORITY) - (second.priority ?? DEFAULT_SECTION_PRIORITY)
688
+ );
689
+ }
690
+ function resetSiteContentSections() {
691
+ registeredSections.clear();
692
+ }
693
+
694
+ // src/components/panel/posts-list/posts-collapsible-list.tsx
695
+ var React36 = __toESM(require("react"));
696
+ var import_react15 = require("react");
697
+ var import_ui24 = require("@elementor/ui");
698
+ var import_i18n26 = require("@wordpress/i18n");
699
+
700
+ // src/contexts/site-content-section-toolbar.tsx
701
+ var React8 = __toESM(require("react"));
702
+ var import_react7 = require("react");
703
+
704
+ // src/hooks/use-site-content-section-list-controls.ts
705
+ var import_react6 = require("react");
706
+
707
+ // src/site-content-status-filter.ts
708
+ var import_i18n6 = require("@wordpress/i18n");
709
+ var SITE_CONTENT_SELECTABLE_STATUS_FILTERS = [
710
+ "publish",
711
+ "draft",
712
+ "pending",
713
+ "private",
714
+ "future",
715
+ "trash"
716
+ ];
717
+ var EMPTY_SITE_CONTENT_STATUS_FILTERS = {
718
+ draft: false,
719
+ future: false,
720
+ pending: false,
721
+ private: false,
722
+ publish: false,
723
+ trash: false
724
+ };
725
+ var filterLabels = {
726
+ publish: (0, import_i18n6.__)("Published", "elementor"),
727
+ draft: (0, import_i18n6.__)("Drafts", "elementor"),
728
+ pending: (0, import_i18n6.__)("Pending", "elementor"),
729
+ private: (0, import_i18n6.__)("Private", "elementor"),
730
+ future: (0, import_i18n6.__)("Scheduled", "elementor"),
731
+ trash: (0, import_i18n6.__)("Trash", "elementor")
732
+ };
733
+ var SITE_CONTENT_ALL_FILTER_LABEL = (0, import_i18n6.__)("All", "elementor");
734
+ var SITE_CONTENT_FILTER_POPOVER_WIDTH_PX = 280;
735
+ function getSiteContentStatusFilterLabel(filter) {
736
+ return filterLabels[filter];
737
+ }
738
+ function hasActiveSiteContentStatusFilters(filters) {
739
+ return SITE_CONTENT_SELECTABLE_STATUS_FILTERS.some((key) => filters[key]);
740
+ }
741
+ function getActiveSiteContentStatusFilterKeys(filters) {
742
+ return SITE_CONTENT_SELECTABLE_STATUS_FILTERS.filter((key) => filters[key]);
743
+ }
744
+ var serializeSiteContentStatusFilters = (statusFilters) => SITE_CONTENT_SELECTABLE_STATUS_FILTERS.map((key) => statusFilters[key] ? key : "").join("|");
745
+ function getRestStatusForSiteContentFilters(filters) {
746
+ if (filters.trash) {
747
+ return "trash";
748
+ }
749
+ const active = getActiveSiteContentStatusFilterKeys(filters);
750
+ if (0 === active.length) {
751
+ return "any";
752
+ }
753
+ return active.join(",");
754
+ }
755
+ function isSiteContentTrashFilterActive(filters) {
756
+ return filters.trash;
757
+ }
758
+ function isSiteContentListNarrowed(filters, search) {
759
+ return hasActiveSiteContentStatusFilters(filters) || search.trim().length > 0;
760
+ }
761
+ function toggleSiteContentStatusFilter(filters, filter) {
762
+ if ("trash" === filter) {
763
+ const isTrashOn = !filters.trash;
764
+ return {
765
+ ...EMPTY_SITE_CONTENT_STATUS_FILTERS,
766
+ trash: isTrashOn
767
+ };
768
+ }
769
+ return {
770
+ ...filters,
771
+ trash: false,
772
+ [filter]: !filters[filter]
773
+ };
774
+ }
775
+ function getSiteContentStatusFilterForCount(status) {
776
+ if ("trash" === status) {
777
+ return { ...EMPTY_SITE_CONTENT_STATUS_FILTERS, trash: true };
778
+ }
779
+ return {
780
+ ...EMPTY_SITE_CONTENT_STATUS_FILTERS,
781
+ [status]: true
782
+ };
783
+ }
784
+ function shouldShowSiteContentStatusFilterRow(count, isLoadingCounts, isSelected) {
785
+ if (isSelected) {
786
+ return true;
787
+ }
788
+ if (isLoadingCounts || void 0 === count) {
789
+ return false;
790
+ }
791
+ return count > 0;
792
+ }
793
+
794
+ // src/hooks/use-site-content-section-list-controls.ts
795
+ var SEARCH_DEBOUNCE_MS = 300;
796
+ function useSiteContentSectionListControls() {
797
+ const [searchQuery, setSearchQuery] = (0, import_react6.useState)("");
798
+ const [debouncedSearch, setDebouncedSearch] = (0, import_react6.useState)("");
799
+ const [siteContentSort, setSiteContentSortState] = (0, import_react6.useState)(DEFAULT_SITE_CONTENT_SORT);
800
+ const [statusFilters, setStatusFilters] = (0, import_react6.useState)(
801
+ EMPTY_SITE_CONTENT_STATUS_FILTERS
802
+ );
803
+ const trimmedSearch = searchQuery.trim();
804
+ (0, import_react6.useEffect)(() => {
805
+ const handle = window.setTimeout(() => setDebouncedSearch(trimmedSearch), SEARCH_DEBOUNCE_MS);
806
+ return () => window.clearTimeout(handle);
807
+ }, [trimmedSearch]);
808
+ const clearActiveToolbarFilters = (0, import_react6.useCallback)(() => {
809
+ setSiteContentSortState(DEFAULT_SITE_CONTENT_SORT);
810
+ setStatusFilters(EMPTY_SITE_CONTENT_STATUS_FILTERS);
811
+ }, []);
812
+ const clearSiteContentSort = (0, import_react6.useCallback)(() => {
813
+ setSiteContentSortState(DEFAULT_SITE_CONTENT_SORT);
814
+ }, []);
815
+ const clearStatusFilters = (0, import_react6.useCallback)(() => {
816
+ setStatusFilters(EMPTY_SITE_CONTENT_STATUS_FILTERS);
817
+ }, []);
818
+ const setSiteContentSort = (0, import_react6.useCallback)((sort) => {
819
+ setSiteContentSortState(sort);
820
+ }, []);
821
+ const toggleStatusFilter = (0, import_react6.useCallback)((filter) => {
822
+ setStatusFilters((current) => toggleSiteContentStatusFilter(current, filter));
823
+ }, []);
824
+ return {
825
+ clearActiveToolbarFilters,
826
+ clearSiteContentSort,
827
+ clearStatusFilters,
828
+ debouncedSearch,
829
+ searchQuery,
830
+ setSearchQuery,
831
+ setSiteContentSort,
832
+ siteContentSort,
833
+ statusFilters,
834
+ toggleStatusFilter
835
+ };
836
+ }
837
+
838
+ // src/contexts/site-content-section-toolbar.tsx
839
+ var SiteContentSectionToolbarContext = (0, import_react7.createContext)(null);
840
+ function SiteContentSectionToolbarProvider({
841
+ children,
842
+ statusFilterCountSlugs = [],
843
+ statusFilterCounts,
844
+ statusFilterCountsPending = false
845
+ }) {
846
+ const controls = useSiteContentSectionListControls();
847
+ const value = (0, import_react7.useMemo)(
848
+ () => ({
849
+ ...controls,
850
+ statusFilterCountSlugs,
851
+ statusFilterCounts,
852
+ statusFilterCountsPending
853
+ }),
854
+ [controls, statusFilterCountSlugs, statusFilterCounts, statusFilterCountsPending]
1097
855
  );
856
+ return /* @__PURE__ */ React8.createElement(SiteContentSectionToolbarContext.Provider, { value }, children);
1098
857
  }
1099
- function resetSiteContentSections() {
1100
- registeredSections.clear();
858
+ function useSiteContentSectionToolbar() {
859
+ const context = (0, import_react7.useContext)(SiteContentSectionToolbarContext);
860
+ if (!context) {
861
+ throw new Error(
862
+ "The `useSiteContentSectionToolbar()` hook must be used within a `<SiteContentSectionToolbarProvider />`"
863
+ );
864
+ }
865
+ return context;
1101
866
  }
1102
867
 
1103
- // src/components/panel/posts-list/posts-collapsible-list.tsx
1104
- var React35 = __toESM(require("react"));
1105
- var import_react13 = require("react");
1106
- var import_ui24 = require("@elementor/ui");
1107
- var import_i18n26 = require("@wordpress/i18n");
1108
-
1109
868
  // src/hooks/use-homepage.ts
1110
- var import_query3 = require("@elementor/query");
869
+ var import_query2 = require("@elementor/query");
1111
870
 
1112
871
  // src/api/settings.ts
1113
872
  var import_api_fetch3 = __toESM(require("@wordpress/api-fetch"));
@@ -1127,14 +886,14 @@ var updateSettings = (settings) => {
1127
886
  // src/hooks/use-homepage.ts
1128
887
  var settingsQueryKey = () => ["site-navigation", "homepage"];
1129
888
  function useHomepage() {
1130
- return (0, import_query3.useQuery)({
889
+ return (0, import_query2.useQuery)({
1131
890
  queryKey: settingsQueryKey(),
1132
891
  queryFn: () => getSettings()
1133
892
  });
1134
893
  }
1135
894
 
1136
895
  // src/hooks/use-post-list-pagination.ts
1137
- var import_react6 = require("react");
896
+ var import_react8 = require("react");
1138
897
  function usePostListPagination({
1139
898
  fetchNextPage,
1140
899
  hasNextPage,
@@ -1143,13 +902,13 @@ function usePostListPagination({
1143
902
  resetKey,
1144
903
  totalCount
1145
904
  }) {
1146
- const [visibleCount, setVisibleCount] = (0, import_react6.useState)(POST_PER_PAGE);
1147
- const pendingVisibleTargetRef = (0, import_react6.useRef)(null);
1148
- (0, import_react6.useEffect)(() => {
905
+ const [visibleCount, setVisibleCount] = (0, import_react8.useState)(POST_PER_PAGE);
906
+ const pendingVisibleTargetRef = (0, import_react8.useRef)(null);
907
+ (0, import_react8.useEffect)(() => {
1149
908
  setVisibleCount(POST_PER_PAGE);
1150
909
  pendingVisibleTargetRef.current = null;
1151
910
  }, [resetKey]);
1152
- (0, import_react6.useEffect)(() => {
911
+ (0, import_react8.useEffect)(() => {
1153
912
  const target = pendingVisibleTargetRef.current;
1154
913
  if (target === null) {
1155
914
  return;
@@ -1166,7 +925,7 @@ function usePostListPagination({
1166
925
  }, [isFetchingNextPage, loadedCount]);
1167
926
  const canShowLess = visibleCount > POST_PER_PAGE;
1168
927
  const canLoadMore = visibleCount < loadedCount || hasNextPage;
1169
- const handleLoadMore = (0, import_react6.useCallback)(() => {
928
+ const handleLoadMore = (0, import_react8.useCallback)(() => {
1170
929
  if (isFetchingNextPage || !canLoadMore) {
1171
930
  return;
1172
931
  }
@@ -1184,7 +943,7 @@ function usePostListPagination({
1184
943
  setVisibleCount(Math.min(visibleCount + POST_PER_PAGE, loadedCount));
1185
944
  }
1186
945
  }, [canLoadMore, fetchNextPage, hasNextPage, isFetchingNextPage, loadedCount, totalCount, visibleCount]);
1187
- const handleShowLess = (0, import_react6.useCallback)(() => {
946
+ const handleShowLess = (0, import_react8.useCallback)(() => {
1188
947
  pendingVisibleTargetRef.current = null;
1189
948
  setVisibleCount(POST_PER_PAGE);
1190
949
  }, []);
@@ -1197,63 +956,405 @@ function usePostListPagination({
1197
956
  };
1198
957
  }
1199
958
 
1200
- // src/hooks/use-posts.ts
1201
- var import_query4 = require("@elementor/query");
1202
- var postsQueryKeyBase = (postTypeSlug) => ["site-navigation", "posts", postTypeSlug];
1203
- var postsQueryKey = (postTypeSlug, trimmedSearch = "", restStatus = "any", sort = DEFAULT_SITE_CONTENT_SORT) => [...postsQueryKeyBase(postTypeSlug), restStatus, trimmedSearch, sort];
1204
- var flattenData = (data) => {
1205
- if (!data) {
1206
- return data;
959
+ // src/hooks/use-posts.ts
960
+ var import_query3 = require("@elementor/query");
961
+ var postsQueryKeyBase = (postTypeSlug) => ["site-navigation", "posts", postTypeSlug];
962
+ var postsQueryKey = (postTypeSlug, trimmedSearch = "", restStatus = "any", sort = DEFAULT_SITE_CONTENT_SORT) => [...postsQueryKeyBase(postTypeSlug), restStatus, trimmedSearch, sort];
963
+ var flattenData = (data) => {
964
+ if (!data) {
965
+ return data;
966
+ }
967
+ const flattened = [];
968
+ const seenIds = /* @__PURE__ */ new Set();
969
+ data.pages.forEach((page) => {
970
+ page.data.forEach((post) => {
971
+ if (seenIds.has(post.id)) {
972
+ return;
973
+ }
974
+ seenIds.add(post.id);
975
+ flattened.push(post);
976
+ });
977
+ });
978
+ return flattened;
979
+ };
980
+ function usePosts(postTypeSlug, search = "", statusFilters = EMPTY_SITE_CONTENT_STATUS_FILTERS, sort = DEFAULT_SITE_CONTENT_SORT) {
981
+ const trimmedSearch = search.trim();
982
+ const restStatus = getRestStatusForSiteContentFilters(statusFilters);
983
+ const query = (0, import_query3.useInfiniteQuery)({
984
+ queryKey: postsQueryKey(postTypeSlug, trimmedSearch, restStatus, sort),
985
+ queryFn: ({ pageParam = 1 }) => getRequest(postTypeSlug, pageParam, trimmedSearch, restStatus, POST_PER_PAGE, sort),
986
+ initialPageParam: 1,
987
+ getNextPageParam: (lastPage) => {
988
+ return lastPage.currentPage < lastPage.totalPages ? lastPage.currentPage + 1 : void 0;
989
+ },
990
+ placeholderData: import_query3.keepPreviousData
991
+ });
992
+ return { ...query, data: { posts: flattenData(query.data), total: query.data?.pages[0]?.totalPosts ?? 0 } };
993
+ }
994
+
995
+ // src/hooks/use-posts-baseline-total.ts
996
+ var import_query4 = require("@elementor/query");
997
+ var postsBaselineTotalQueryKeyBase = (postTypeSlug) => [
998
+ "site-navigation",
999
+ "posts-baseline-total",
1000
+ postTypeSlug
1001
+ ];
1002
+ var postsBaselineTotalQueryKey = (postTypeSlug, status = "any") => [
1003
+ ...postsBaselineTotalQueryKeyBase(postTypeSlug),
1004
+ status
1005
+ ];
1006
+ function usePostsBaselineTotal(postTypeSlug, enabled, status = "any") {
1007
+ return (0, import_query4.useQuery)({
1008
+ enabled,
1009
+ queryFn: () => fetchPostsTotal(postTypeSlug, status),
1010
+ queryKey: postsBaselineTotalQueryKey(postTypeSlug, status)
1011
+ });
1012
+ }
1013
+
1014
+ // src/components/panel/content-panel-section-toolbar.tsx
1015
+ var React16 = __toESM(require("react"));
1016
+ var import_ui13 = require("@elementor/ui");
1017
+
1018
+ // src/components/panel/content-panel-active-filters.tsx
1019
+ var React10 = __toESM(require("react"));
1020
+ var import_ui7 = require("@elementor/ui");
1021
+ var import_i18n7 = require("@wordpress/i18n");
1022
+
1023
+ // src/components/panel/content-panel-clear-filters-button.tsx
1024
+ var React9 = __toESM(require("react"));
1025
+ var import_icons5 = require("@elementor/icons");
1026
+ var import_ui6 = require("@elementor/ui");
1027
+ function ContentPanelClearFiltersButton({ ariaLabel, onClear, sx, tooltipText }) {
1028
+ return /* @__PURE__ */ React9.createElement(import_ui6.Tooltip, { disableInteractive: true, placement: "top", title: tooltipText }, /* @__PURE__ */ React9.createElement(import_ui6.Box, null, /* @__PURE__ */ React9.createElement(import_ui6.IconButton, { "aria-label": ariaLabel, onClick: onClear, size: "tiny", sx }, /* @__PURE__ */ React9.createElement(import_icons5.BrushBigIcon, { fontSize: "tiny" }))));
1029
+ }
1030
+
1031
+ // src/components/panel/content-panel-active-filters.tsx
1032
+ var contentPanelFilterChipSx = {
1033
+ "& .MuiChip-deleteIcon": {
1034
+ display: "none",
1035
+ transition: "opacity 0.2s"
1036
+ },
1037
+ "&:hover .MuiChip-deleteIcon": {
1038
+ display: "block"
1039
+ }
1040
+ };
1041
+ function ContentPanelActiveFilters() {
1042
+ const { clearActiveToolbarFilters, setSiteContentSort, siteContentSort, statusFilters, toggleStatusFilter } = useSiteContentSectionToolbar();
1043
+ const hasStatusFilters = hasActiveSiteContentStatusFilters(statusFilters);
1044
+ const hasSort = hasActiveSiteContentSort(siteContentSort);
1045
+ if (!hasStatusFilters && !hasSort) {
1046
+ return null;
1047
+ }
1048
+ const activeKeys = getActiveSiteContentStatusFilterKeys(statusFilters);
1049
+ return /* @__PURE__ */ React10.createElement(import_ui7.Stack, { alignItems: "center", direction: "row", justifyContent: "space-between" }, /* @__PURE__ */ React10.createElement(import_ui7.Stack, { alignItems: "center", direction: "row", flexWrap: "wrap", gap: 0.5 }, hasSort && /* @__PURE__ */ React10.createElement(
1050
+ import_ui7.Chip,
1051
+ {
1052
+ label: getSiteContentSortLabel(siteContentSort),
1053
+ onDelete: () => setSiteContentSort(DEFAULT_SITE_CONTENT_SORT),
1054
+ size: "tiny",
1055
+ sx: contentPanelFilterChipSx
1056
+ }
1057
+ ), activeKeys.map((key) => /* @__PURE__ */ React10.createElement(
1058
+ import_ui7.Chip,
1059
+ {
1060
+ key,
1061
+ label: getSiteContentStatusFilterLabel(key),
1062
+ onDelete: () => toggleStatusFilter(key),
1063
+ size: "tiny",
1064
+ sx: contentPanelFilterChipSx
1065
+ }
1066
+ ))), /* @__PURE__ */ React10.createElement(
1067
+ ContentPanelClearFiltersButton,
1068
+ {
1069
+ ariaLabel: (0, import_i18n7.__)("Clear Filters", "elementor"),
1070
+ onClear: clearActiveToolbarFilters,
1071
+ sx: { margin: "0 0 auto auto" },
1072
+ tooltipText: (0, import_i18n7.__)("Clear Filters", "elementor")
1073
+ }
1074
+ ));
1075
+ }
1076
+
1077
+ // src/components/panel/content-panel-search.tsx
1078
+ var React11 = __toESM(require("react"));
1079
+ var import_icons6 = require("@elementor/icons");
1080
+ var import_ui8 = require("@elementor/ui");
1081
+ var import_i18n8 = require("@wordpress/i18n");
1082
+ function ContentPanelSearch({ searchAriaLabel }) {
1083
+ const { searchQuery, setSearchQuery } = useSiteContentSectionToolbar();
1084
+ const ariaLabel = searchAriaLabel ?? (0, import_i18n8.__)("Search site content", "elementor");
1085
+ return /* @__PURE__ */ React11.createElement(import_ui8.Box, { component: "search", "aria-label": ariaLabel }, /* @__PURE__ */ React11.createElement(
1086
+ import_ui8.TextField,
1087
+ {
1088
+ fullWidth: true,
1089
+ size: "tiny",
1090
+ value: searchQuery,
1091
+ placeholder: (0, import_i18n8.__)("Search", "elementor"),
1092
+ onChange: (event) => setSearchQuery(event.target.value),
1093
+ inputProps: {
1094
+ "aria-label": (0, import_i18n8.__)("Search", "elementor")
1095
+ },
1096
+ InputProps: {
1097
+ startAdornment: /* @__PURE__ */ React11.createElement(import_ui8.InputAdornment, { position: "start" }, /* @__PURE__ */ React11.createElement(import_icons6.SearchIcon, { fontSize: "tiny" }))
1098
+ }
1099
+ }
1100
+ ));
1101
+ }
1102
+
1103
+ // src/components/panel/content-panel-sort.tsx
1104
+ var React13 = __toESM(require("react"));
1105
+ var import_editor_ui2 = require("@elementor/editor-ui");
1106
+ var import_icons8 = require("@elementor/icons");
1107
+ var import_ui10 = require("@elementor/ui");
1108
+ var import_i18n9 = require("@wordpress/i18n");
1109
+
1110
+ // src/components/panel/content-panel-sort-list.tsx
1111
+ var React12 = __toESM(require("react"));
1112
+ var import_icons7 = require("@elementor/icons");
1113
+ var import_ui9 = require("@elementor/ui");
1114
+ var renderSortMenuItemContent = (label, selected) => /* @__PURE__ */ React12.createElement(import_ui9.Stack, { alignItems: "center", direction: "row", gap: 1, width: "100%" }, /* @__PURE__ */ React12.createElement(import_ui9.Typography, { sx: { color: "text.secondary", flex: 1 }, variant: "caption" }, label), selected ? /* @__PURE__ */ React12.createElement(import_icons7.CheckIcon, { "aria-hidden": true, fontSize: "tiny" }) : null);
1115
+ function ContentPanelSortList() {
1116
+ const { setSiteContentSort, siteContentSort } = useSiteContentSectionToolbar();
1117
+ return /* @__PURE__ */ React12.createElement(import_ui9.MenuList, { dense: true }, SITE_CONTENT_SORT_OPTIONS.map((option) => {
1118
+ const isSelected = siteContentSort === option;
1119
+ return /* @__PURE__ */ React12.createElement(
1120
+ import_ui9.MenuItem,
1121
+ {
1122
+ key: option,
1123
+ "aria-checked": isSelected,
1124
+ onClick: () => setSiteContentSort(option),
1125
+ role: "menuitemradio",
1126
+ selected: isSelected
1127
+ },
1128
+ renderSortMenuItemContent(getSiteContentSortLabel(option), isSelected)
1129
+ );
1130
+ }));
1131
+ }
1132
+
1133
+ // src/components/panel/content-panel-sort.tsx
1134
+ function ContentPanelSort() {
1135
+ const { clearSiteContentSort, siteContentSort } = useSiteContentSectionToolbar();
1136
+ const popupState = (0, import_ui10.usePopupState)({
1137
+ variant: "popover",
1138
+ disableAutoFocus: true
1139
+ });
1140
+ const hasActiveSort = hasActiveSiteContentSort(siteContentSort);
1141
+ return /* @__PURE__ */ React13.createElement(React13.Fragment, null, /* @__PURE__ */ React13.createElement(import_ui10.Tooltip, { placement: "top", title: (0, import_i18n9.__)("Sort", "elementor") }, /* @__PURE__ */ React13.createElement(
1142
+ import_ui10.ToggleButton,
1143
+ {
1144
+ "aria-label": (0, import_i18n9.__)("Sort", "elementor"),
1145
+ selected: popupState.isOpen || hasActiveSort,
1146
+ size: "tiny",
1147
+ value: "sort",
1148
+ ...(0, import_ui10.bindToggle)(popupState)
1149
+ },
1150
+ /* @__PURE__ */ React13.createElement(import_icons8.ArrowsSortIcon, { fontSize: "tiny" })
1151
+ )), /* @__PURE__ */ React13.createElement(
1152
+ import_ui10.Popover,
1153
+ {
1154
+ anchorOrigin: {
1155
+ horizontal: "right",
1156
+ vertical: "top"
1157
+ },
1158
+ sx: {
1159
+ maxWidth: `${SITE_CONTENT_SORT_POPOVER_WIDTH_PX}px`
1160
+ },
1161
+ transformOrigin: {
1162
+ horizontal: -21,
1163
+ vertical: "top"
1164
+ },
1165
+ ...(0, import_ui10.bindPopover)(popupState)
1166
+ },
1167
+ /* @__PURE__ */ React13.createElement(
1168
+ import_editor_ui2.PopoverHeader,
1169
+ {
1170
+ actions: hasActiveSort ? [
1171
+ /* @__PURE__ */ React13.createElement(
1172
+ ContentPanelClearFiltersButton,
1173
+ {
1174
+ ariaLabel: (0, import_i18n9.__)("Clear sort", "elementor"),
1175
+ key: "clear-sort",
1176
+ onClear: clearSiteContentSort,
1177
+ tooltipText: (0, import_i18n9.__)("Clear sort", "elementor")
1178
+ }
1179
+ )
1180
+ ] : [],
1181
+ icon: /* @__PURE__ */ React13.createElement(import_icons8.ArrowsSortIcon, { fontSize: "tiny" }),
1182
+ onClose: popupState.close,
1183
+ title: (0, import_i18n9.__)("Sort", "elementor")
1184
+ }
1185
+ ),
1186
+ /* @__PURE__ */ React13.createElement(import_ui10.Divider, { sx: { borderWidth: "1px 0 0 0" } }),
1187
+ /* @__PURE__ */ React13.createElement(import_editor_ui2.PopoverBody, { height: "auto", width: SITE_CONTENT_SORT_POPOVER_WIDTH_PX }, /* @__PURE__ */ React13.createElement(ContentPanelSortList, null))
1188
+ ));
1189
+ }
1190
+
1191
+ // src/components/panel/content-panel-status-filter.tsx
1192
+ var React15 = __toESM(require("react"));
1193
+ var import_editor_ui3 = require("@elementor/editor-ui");
1194
+ var import_icons10 = require("@elementor/icons");
1195
+ var import_ui12 = require("@elementor/ui");
1196
+ var import_i18n10 = require("@wordpress/i18n");
1197
+
1198
+ // src/components/panel/content-panel-status-filter-list.tsx
1199
+ var React14 = __toESM(require("react"));
1200
+ var import_icons9 = require("@elementor/icons");
1201
+ var import_ui11 = require("@elementor/ui");
1202
+
1203
+ // src/hooks/use-site-content-status-filter-counts.ts
1204
+ var import_query5 = require("@elementor/query");
1205
+ var STATUS_FILTER_COUNTS_STALE_TIME_MS = 30 * 1e3;
1206
+ var siteContentStatusFilterCountsQueryKeyBase = ["site-navigation", "status-filter-counts"];
1207
+ var siteContentStatusFilterCountsQueryKey = (postTypes) => [
1208
+ ...siteContentStatusFilterCountsQueryKeyBase,
1209
+ postTypes.join(",")
1210
+ ];
1211
+ var sumFulfilledTotals = (results) => {
1212
+ const fulfilled = results.filter(
1213
+ (result) => "fulfilled" === result.status
1214
+ );
1215
+ if (fulfilled.length !== results.length) {
1216
+ return void 0;
1207
1217
  }
1208
- const flattened = [];
1209
- const seenIds = /* @__PURE__ */ new Set();
1210
- data.pages.forEach((page) => {
1211
- page.data.forEach((post) => {
1212
- if (seenIds.has(post.id)) {
1213
- return;
1218
+ return fulfilled.reduce((sum, result) => sum + result.value, 0);
1219
+ };
1220
+ var fetchStatusFilterCounts = async (postTypes) => {
1221
+ const entries = await Promise.all(
1222
+ SITE_CONTENT_SELECTABLE_STATUS_FILTERS.map(async (status) => {
1223
+ const results = await Promise.allSettled(postTypes.map((slug) => fetchPostsTotal(slug, status)));
1224
+ const total = sumFulfilledTotals(results);
1225
+ if (void 0 === total) {
1226
+ return null;
1214
1227
  }
1215
- seenIds.add(post.id);
1216
- flattened.push(post);
1217
- });
1218
- });
1219
- return flattened;
1228
+ return [status, total];
1229
+ })
1230
+ );
1231
+ return Object.fromEntries(entries.filter((entry) => null !== entry));
1220
1232
  };
1221
- function usePosts(postTypeSlug, search = "", statusFilters = EMPTY_SITE_CONTENT_STATUS_FILTERS, sort = DEFAULT_SITE_CONTENT_SORT) {
1222
- const trimmedSearch = search.trim();
1223
- const restStatus = getRestStatusForSiteContentFilters(statusFilters);
1224
- const query = (0, import_query4.useInfiniteQuery)({
1225
- queryKey: postsQueryKey(postTypeSlug, trimmedSearch, restStatus, sort),
1226
- queryFn: ({ pageParam = 1 }) => getRequest(postTypeSlug, pageParam, trimmedSearch, restStatus, POST_PER_PAGE, sort),
1227
- initialPageParam: 1,
1228
- getNextPageParam: (lastPage) => {
1229
- return lastPage.currentPage < lastPage.totalPages ? lastPage.currentPage + 1 : void 0;
1230
- },
1231
- placeholderData: import_query4.keepPreviousData
1233
+ function useSiteContentStatusFilterCounts(postTypes, enabled) {
1234
+ return (0, import_query5.useQuery)({
1235
+ enabled: enabled && postTypes.length > 0,
1236
+ queryFn: () => fetchStatusFilterCounts(postTypes),
1237
+ queryKey: siteContentStatusFilterCountsQueryKey(postTypes),
1238
+ staleTime: STATUS_FILTER_COUNTS_STALE_TIME_MS
1232
1239
  });
1233
- return { ...query, data: { posts: flattenData(query.data), total: query.data?.pages[0]?.totalPosts ?? 0 } };
1234
1240
  }
1235
1241
 
1236
- // src/hooks/use-posts-baseline-total.ts
1237
- var import_query5 = require("@elementor/query");
1238
- var postsBaselineTotalQueryKeyBase = (postTypeSlug) => [
1239
- "site-navigation",
1240
- "posts-baseline-total",
1241
- postTypeSlug
1242
- ];
1243
- var postsBaselineTotalQueryKey = (postTypeSlug, status = "any") => [
1244
- ...postsBaselineTotalQueryKeyBase(postTypeSlug),
1245
- status
1246
- ];
1247
- function usePostsBaselineTotal(postTypeSlug, enabled, status = "any") {
1248
- return (0, import_query5.useQuery)({
1249
- enabled,
1250
- queryFn: () => fetchPostsTotal(postTypeSlug, status),
1251
- queryKey: postsBaselineTotalQueryKey(postTypeSlug, status)
1242
+ // src/components/panel/content-panel-status-filter-list.tsx
1243
+ var renderFilterMenuItemContent = (label, selected) => /* @__PURE__ */ React14.createElement(import_ui11.Stack, { alignItems: "center", direction: "row", gap: 1, width: "100%" }, /* @__PURE__ */ React14.createElement(import_ui11.Typography, { sx: { color: "text.secondary", flex: 1 }, variant: "caption" }, label), selected ? /* @__PURE__ */ React14.createElement(import_icons9.CheckIcon, { "aria-hidden": true, fontSize: "tiny" }) : null);
1244
+ function ContentPanelStatusFilterList({ loadCounts }) {
1245
+ const {
1246
+ clearStatusFilters,
1247
+ statusFilterCountSlugs,
1248
+ statusFilterCounts: presetStatusCounts,
1249
+ statusFilterCountsPending,
1250
+ statusFilters,
1251
+ toggleStatusFilter
1252
+ } = useSiteContentSectionToolbar();
1253
+ const shouldLoadPostTypeCounts = loadCounts && statusFilterCountSlugs.length > 0 && !presetStatusCounts;
1254
+ const { data: fetchedStatusCounts, isPending: isFetchingStatusCounts } = useSiteContentStatusFilterCounts(
1255
+ statusFilterCountSlugs,
1256
+ shouldLoadPostTypeCounts
1257
+ );
1258
+ const statusCounts = presetStatusCounts ?? fetchedStatusCounts;
1259
+ const isLoadingCounts = Boolean(presetStatusCounts ? statusFilterCountsPending : isFetchingStatusCounts);
1260
+ const isAllSelected = !hasActiveSiteContentStatusFilters(statusFilters);
1261
+ const visibleFilters = statusFilterCountSlugs.length === 0 ? SITE_CONTENT_SELECTABLE_STATUS_FILTERS : SITE_CONTENT_SELECTABLE_STATUS_FILTERS.filter(
1262
+ (filter) => shouldShowSiteContentStatusFilterRow(
1263
+ statusCounts?.[filter],
1264
+ isLoadingCounts,
1265
+ statusFilters[filter]
1266
+ )
1267
+ );
1268
+ return /* @__PURE__ */ React14.createElement(import_ui11.MenuList, { dense: true }, /* @__PURE__ */ React14.createElement(
1269
+ import_ui11.MenuItem,
1270
+ {
1271
+ "aria-checked": isAllSelected,
1272
+ onClick: clearStatusFilters,
1273
+ role: "menuitemcheckbox",
1274
+ selected: isAllSelected
1275
+ },
1276
+ renderFilterMenuItemContent(SITE_CONTENT_ALL_FILTER_LABEL, isAllSelected)
1277
+ ), visibleFilters.map((filter) => {
1278
+ const isSelected = statusFilters[filter];
1279
+ return /* @__PURE__ */ React14.createElement(
1280
+ import_ui11.MenuItem,
1281
+ {
1282
+ key: filter,
1283
+ "aria-checked": isSelected,
1284
+ onClick: () => toggleStatusFilter(filter),
1285
+ role: "menuitemcheckbox",
1286
+ selected: isSelected
1287
+ },
1288
+ renderFilterMenuItemContent(getSiteContentStatusFilterLabel(filter), isSelected)
1289
+ );
1290
+ }));
1291
+ }
1292
+
1293
+ // src/components/panel/content-panel-status-filter.tsx
1294
+ function ContentPanelStatusFilter() {
1295
+ const { clearStatusFilters, statusFilters } = useSiteContentSectionToolbar();
1296
+ const popupState = (0, import_ui12.usePopupState)({
1297
+ variant: "popover",
1298
+ disableAutoFocus: true
1252
1299
  });
1300
+ const hasActiveFilters = hasActiveSiteContentStatusFilters(statusFilters);
1301
+ return /* @__PURE__ */ React15.createElement(React15.Fragment, null, /* @__PURE__ */ React15.createElement(import_ui12.Tooltip, { placement: "top", title: (0, import_i18n10.__)("Filters", "elementor") }, /* @__PURE__ */ React15.createElement(
1302
+ import_ui12.ToggleButton,
1303
+ {
1304
+ "aria-label": (0, import_i18n10.__)("Filters", "elementor"),
1305
+ selected: popupState.isOpen || hasActiveFilters,
1306
+ size: "tiny",
1307
+ value: "filter",
1308
+ ...(0, import_ui12.bindToggle)(popupState)
1309
+ },
1310
+ /* @__PURE__ */ React15.createElement(import_icons10.FilterIcon, { fontSize: "tiny" })
1311
+ )), /* @__PURE__ */ React15.createElement(
1312
+ import_ui12.Popover,
1313
+ {
1314
+ anchorOrigin: {
1315
+ horizontal: "right",
1316
+ vertical: "top"
1317
+ },
1318
+ sx: {
1319
+ maxWidth: `${SITE_CONTENT_FILTER_POPOVER_WIDTH_PX}px`
1320
+ },
1321
+ transformOrigin: {
1322
+ horizontal: -21,
1323
+ vertical: "top"
1324
+ },
1325
+ ...(0, import_ui12.bindPopover)(popupState)
1326
+ },
1327
+ /* @__PURE__ */ React15.createElement(
1328
+ import_editor_ui3.PopoverHeader,
1329
+ {
1330
+ actions: hasActiveFilters ? [
1331
+ /* @__PURE__ */ React15.createElement(
1332
+ ContentPanelClearFiltersButton,
1333
+ {
1334
+ ariaLabel: (0, import_i18n10.__)("Clear all", "elementor"),
1335
+ key: "clear-all-filters",
1336
+ onClear: clearStatusFilters,
1337
+ tooltipText: (0, import_i18n10.__)("Clear all", "elementor")
1338
+ }
1339
+ )
1340
+ ] : [],
1341
+ icon: /* @__PURE__ */ React15.createElement(import_icons10.FilterIcon, { fontSize: "tiny" }),
1342
+ onClose: popupState.close,
1343
+ title: (0, import_i18n10.__)("Filters", "elementor")
1344
+ }
1345
+ ),
1346
+ /* @__PURE__ */ React15.createElement(import_ui12.Divider, { sx: { borderWidth: "1px 0 0 0" } }),
1347
+ /* @__PURE__ */ React15.createElement(import_editor_ui3.PopoverBody, { height: "auto", width: SITE_CONTENT_FILTER_POPOVER_WIDTH_PX }, /* @__PURE__ */ React15.createElement(ContentPanelStatusFilterList, { loadCounts: popupState.isOpen }))
1348
+ ));
1349
+ }
1350
+
1351
+ // src/components/panel/content-panel-section-toolbar.tsx
1352
+ function ContentPanelSectionToolbar({ addAction, searchAriaLabel }) {
1353
+ return /* @__PURE__ */ React16.createElement(import_ui13.Box, { sx: contentPanelSearchBoxSx }, /* @__PURE__ */ React16.createElement(import_ui13.Stack, { gap: 0.75, width: "100%" }, /* @__PURE__ */ React16.createElement(import_ui13.Stack, { alignItems: "center", direction: "row", gap: 0.5, width: "100%" }, /* @__PURE__ */ React16.createElement(import_ui13.Box, { 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)));
1253
1354
  }
1254
1355
 
1255
1356
  // src/components/panel/section-add-button.tsx
1256
- var React16 = __toESM(require("react"));
1357
+ var React17 = __toESM(require("react"));
1257
1358
  var import_i18n11 = require("@wordpress/i18n");
1258
1359
  function SectionAddButton({ onBeforeCreate }) {
1259
1360
  const { type, setEditMode } = usePostListContext();
@@ -1264,7 +1365,7 @@ function SectionAddButton({ onBeforeCreate }) {
1264
1365
  (0, import_i18n11.__)("New %s", "elementor"),
1265
1366
  singularName
1266
1367
  );
1267
- return /* @__PURE__ */ React16.createElement(
1368
+ return /* @__PURE__ */ React17.createElement(
1268
1369
  ContentPanelAddIconButton,
1269
1370
  {
1270
1371
  "aria-label": ariaLabel,
@@ -1279,8 +1380,8 @@ function SectionAddButton({ onBeforeCreate }) {
1279
1380
  }
1280
1381
 
1281
1382
  // src/components/panel/posts-list/collapsible-list.tsx
1282
- var React17 = __toESM(require("react"));
1283
- var import_react7 = require("react");
1383
+ var React18 = __toESM(require("react"));
1384
+ var import_react9 = require("react");
1284
1385
  var import_editor_ui4 = require("@elementor/editor-ui");
1285
1386
  var import_ui14 = require("@elementor/ui");
1286
1387
  var sectionHeaderListItemButtonSx = {
@@ -1301,17 +1402,18 @@ function CollapsibleList({
1301
1402
  headerRef,
1302
1403
  isOpen,
1303
1404
  onOpenChange,
1405
+ sectionToolbar,
1304
1406
  title,
1305
1407
  trailingActions,
1306
1408
  children
1307
1409
  }) {
1308
- const id = (0, import_react7.useId)();
1410
+ const id = (0, import_react9.useId)();
1309
1411
  const labelId = `label-${id}`;
1310
1412
  const contentId = `content-${id}`;
1311
1413
  const chipLabel = countChipLabel ?? count.toString();
1312
1414
  const sectionHeaderAriaLabel = getSectionHeaderAriaLabel(title, chipLabel);
1313
1415
  const handleClick = () => onOpenChange(!isOpen);
1314
- return /* @__PURE__ */ React17.createElement(React17.Fragment, null, /* @__PURE__ */ React17.createElement(
1416
+ return /* @__PURE__ */ React18.createElement(React18.Fragment, null, /* @__PURE__ */ React18.createElement(
1315
1417
  import_ui14.Box,
1316
1418
  {
1317
1419
  sx: {
@@ -1322,7 +1424,7 @@ function CollapsibleList({
1322
1424
  width: "100%"
1323
1425
  }
1324
1426
  },
1325
- /* @__PURE__ */ React17.createElement(
1427
+ /* @__PURE__ */ React18.createElement(
1326
1428
  import_ui14.ListItemButton,
1327
1429
  {
1328
1430
  ref: headerRef,
@@ -1336,7 +1438,7 @@ function CollapsibleList({
1336
1438
  onClick: handleClick,
1337
1439
  sx: sectionHeaderListItemButtonSx
1338
1440
  },
1339
- /* @__PURE__ */ React17.createElement(import_ui14.Stack, { alignItems: "center", direction: "row", flexGrow: 1, gap: 0.5, minWidth: 0, width: "100%" }, /* @__PURE__ */ React17.createElement(import_ui14.Stack, { alignItems: "center", direction: "row", flex: 1, gap: 0.5, minWidth: 0 }, /* @__PURE__ */ React17.createElement(
1441
+ /* @__PURE__ */ React18.createElement(import_ui14.Stack, { alignItems: "center", direction: "row", flexGrow: 1, gap: 0.5, minWidth: 0, width: "100%" }, /* @__PURE__ */ React18.createElement(import_ui14.Stack, { alignItems: "center", direction: "row", flex: 1, gap: 0.5, minWidth: 0 }, /* @__PURE__ */ React18.createElement(
1340
1442
  import_ui14.ListItemText,
1341
1443
  {
1342
1444
  secondary: title,
@@ -1347,9 +1449,9 @@ function CollapsibleList({
1347
1449
  },
1348
1450
  sx: { flexGrow: 0, flexShrink: 1, marginInlineEnd: 1 }
1349
1451
  }
1350
- ), /* @__PURE__ */ React17.createElement(import_ui14.Chip, { label: chipLabel, size: "tiny" })), /* @__PURE__ */ React17.createElement(import_editor_ui4.CollapseIcon, { color: "secondary", fontSize: "tiny", open: isOpen, sx: { flexShrink: 0 } }))
1452
+ ), /* @__PURE__ */ React18.createElement(import_ui14.Chip, { label: chipLabel, size: "tiny" })), /* @__PURE__ */ React18.createElement(import_editor_ui4.CollapseIcon, { color: "secondary", fontSize: "tiny", open: isOpen, sx: { flexShrink: 0 } }))
1351
1453
  ),
1352
- trailingActions && /* @__PURE__ */ React17.createElement(
1454
+ trailingActions && /* @__PURE__ */ React18.createElement(
1353
1455
  import_ui14.Stack,
1354
1456
  {
1355
1457
  alignItems: "center",
@@ -1360,16 +1462,16 @@ function CollapsibleList({
1360
1462
  },
1361
1463
  trailingActions
1362
1464
  )
1363
- ), /* @__PURE__ */ React17.createElement(import_ui14.Collapse, { "aria-labelledby": labelId, id: contentId, in: isOpen, timeout: "auto", unmountOnExit: true }, /* @__PURE__ */ React17.createElement(import_ui14.List, { dense: true, disablePadding: true, sx: contentPanelListSectionListSx }, children)), /* @__PURE__ */ React17.createElement(import_ui14.Divider, null));
1465
+ ), isOpen && sectionToolbar, /* @__PURE__ */ React18.createElement(import_ui14.Collapse, { "aria-labelledby": labelId, id: contentId, in: isOpen, timeout: "auto", unmountOnExit: true }, /* @__PURE__ */ React18.createElement(import_ui14.List, { dense: true, disablePadding: true, sx: contentPanelListSectionListSx }, children)), /* @__PURE__ */ React18.createElement(import_ui14.Divider, null));
1364
1466
  }
1365
1467
 
1366
1468
  // src/components/panel/posts-list/error-state.tsx
1367
- var React18 = __toESM(require("react"));
1469
+ var React19 = __toESM(require("react"));
1368
1470
  var import_icons11 = require("@elementor/icons");
1369
1471
  var import_ui15 = require("@elementor/ui");
1370
1472
  var import_i18n12 = require("@wordpress/i18n");
1371
1473
  function ErrorState() {
1372
- return /* @__PURE__ */ React18.createElement(
1474
+ return /* @__PURE__ */ React19.createElement(
1373
1475
  import_ui15.Box,
1374
1476
  {
1375
1477
  sx: {
@@ -1381,8 +1483,8 @@ function ErrorState() {
1381
1483
  gap: "16px"
1382
1484
  }
1383
1485
  },
1384
- /* @__PURE__ */ React18.createElement(import_icons11.Error404TemplateIcon, null),
1385
- /* @__PURE__ */ React18.createElement(
1486
+ /* @__PURE__ */ React19.createElement(import_icons11.Error404TemplateIcon, null),
1487
+ /* @__PURE__ */ React19.createElement(
1386
1488
  import_ui15.Box,
1387
1489
  {
1388
1490
  sx: {
@@ -1393,17 +1495,17 @@ function ErrorState() {
1393
1495
  gap: "8px"
1394
1496
  }
1395
1497
  },
1396
- /* @__PURE__ */ React18.createElement(import_ui15.Typography, { variant: "body1", color: "text.primary" }, (0, import_i18n12.__)("We couldn\u2019t display your pages.", "elementor")),
1397
- /* @__PURE__ */ React18.createElement(import_ui15.Box, null, /* @__PURE__ */ React18.createElement(import_ui15.Typography, { variant: "body2", color: "text.primary", sx: { textAlign: "center" } }, (0, import_i18n12.__)("It\u2019s probably a temporary issue.", "elementor")), /* @__PURE__ */ React18.createElement(import_ui15.Typography, { variant: "body2", color: "text.primary", sx: { textAlign: "center" } }, (0, import_i18n12.__)("If the problem persists,", "elementor"), " ", /* @__PURE__ */ React18.createElement(import_ui15.Link, { target: "_blank", href: "https://go.elementor.com/wp-editor-support-open-ticket/" }, "Notify support")))
1498
+ /* @__PURE__ */ React19.createElement(import_ui15.Typography, { variant: "body1", color: "text.primary" }, (0, import_i18n12.__)("We couldn\u2019t display your pages.", "elementor")),
1499
+ /* @__PURE__ */ React19.createElement(import_ui15.Box, null, /* @__PURE__ */ React19.createElement(import_ui15.Typography, { variant: "body2", color: "text.primary", sx: { textAlign: "center" } }, (0, import_i18n12.__)("It\u2019s probably a temporary issue.", "elementor")), /* @__PURE__ */ React19.createElement(import_ui15.Typography, { variant: "body2", color: "text.primary", sx: { textAlign: "center" } }, (0, import_i18n12.__)("If the problem persists,", "elementor"), " ", /* @__PURE__ */ React19.createElement(import_ui15.Link, { target: "_blank", href: "https://go.elementor.com/wp-editor-support-open-ticket/" }, "Notify support")))
1398
1500
  )
1399
1501
  );
1400
1502
  }
1401
1503
 
1402
1504
  // src/components/panel/posts-list/post-list-item.tsx
1403
- var React33 = __toESM(require("react"));
1505
+ var React34 = __toESM(require("react"));
1404
1506
 
1405
1507
  // src/components/panel/posts-list/list-items/list-item-create.tsx
1406
- var React20 = __toESM(require("react"));
1508
+ var React21 = __toESM(require("react"));
1407
1509
  var import_editor_documents = require("@elementor/editor-documents");
1408
1510
  var import_i18n14 = require("@wordpress/i18n");
1409
1511
 
@@ -1486,8 +1588,8 @@ function useInvalidatePosts(postTypeSlug) {
1486
1588
  }
1487
1589
 
1488
1590
  // src/components/panel/posts-list/list-items/edit-mode-template.tsx
1489
- var React19 = __toESM(require("react"));
1490
- var import_react8 = require("react");
1591
+ var React20 = __toESM(require("react"));
1592
+ var import_react10 = require("react");
1491
1593
  var import_icons12 = require("@elementor/icons");
1492
1594
  var import_ui16 = require("@elementor/ui");
1493
1595
  var import_i18n13 = require("@wordpress/i18n");
@@ -1530,10 +1632,11 @@ var editRowInputSx = {
1530
1632
  function EditModeTemplate({ postTitle, isLoading, callback, onDismiss }) {
1531
1633
  const { resetEditMode } = usePostListContext();
1532
1634
  const dismissEditMode = onDismiss ?? resetEditMode;
1533
- const [title, setTitle] = (0, import_react8.useState)(postTitle);
1534
- const [touched, setTouched] = (0, import_react8.useState)(false);
1535
- const [inputError, setInputError] = (0, import_react8.useState)(null);
1536
- const closeButton = (0, import_react8.useRef)();
1635
+ const [title, setTitle] = (0, import_react10.useState)(postTitle);
1636
+ const [touched, setTouched] = (0, import_react10.useState)(false);
1637
+ const [inputError, setInputError] = (0, import_react10.useState)(null);
1638
+ const closeButton = (0, import_react10.useRef)();
1639
+ const hasSubmittedRef = (0, import_react10.useRef)(false);
1537
1640
  const onBlur = (e) => {
1538
1641
  if (closeButton.current === e.relatedTarget) {
1539
1642
  return;
@@ -1552,9 +1655,13 @@ function EditModeTemplate({ postTitle, isLoading, callback, onDismiss }) {
1552
1655
  return input.trim() !== "";
1553
1656
  };
1554
1657
  const runCallback = () => {
1658
+ if (hasSubmittedRef.current || isLoading) {
1659
+ return;
1660
+ }
1555
1661
  if (!validateInput(title)) {
1556
1662
  return;
1557
1663
  }
1664
+ hasSubmittedRef.current = true;
1558
1665
  callback(title);
1559
1666
  };
1560
1667
  const onChange = (e) => {
@@ -1569,21 +1676,21 @@ function EditModeTemplate({ postTitle, isLoading, callback, onDismiss }) {
1569
1676
  }
1570
1677
  setTitle(value);
1571
1678
  };
1572
- return /* @__PURE__ */ React19.createElement(React19.Fragment, null, /* @__PURE__ */ React19.createElement(
1679
+ return /* @__PURE__ */ React20.createElement(React20.Fragment, null, /* @__PURE__ */ React20.createElement(
1573
1680
  import_ui16.ListItem,
1574
1681
  {
1575
1682
  disablePadding: true,
1576
1683
  sx: contentPanelListRowPaddingSx,
1577
- secondaryAction: /* @__PURE__ */ React19.createElement(CloseButton, { isLoading, closeButton, onDismiss: dismissEditMode })
1684
+ secondaryAction: /* @__PURE__ */ React20.createElement(CloseButton, { isLoading, closeButton, onDismiss: dismissEditMode })
1578
1685
  },
1579
- /* @__PURE__ */ React19.createElement(
1686
+ /* @__PURE__ */ React20.createElement(
1580
1687
  import_ui16.Box,
1581
1688
  {
1582
1689
  component: "form",
1583
1690
  onSubmit: onFormSubmit,
1584
1691
  sx: { ...editModeListItemButtonSx, display: "flex", width: "100%" }
1585
1692
  },
1586
- /* @__PURE__ */ React19.createElement(import_ui16.Box, { sx: editRowIndicatorSx(!!inputError) }, /* @__PURE__ */ React19.createElement(
1693
+ /* @__PURE__ */ React20.createElement(import_ui16.Box, { sx: editRowIndicatorSx(!!inputError) }, /* @__PURE__ */ React20.createElement(
1587
1694
  import_ui16.Box,
1588
1695
  {
1589
1696
  autoFocus: true,
@@ -1599,10 +1706,10 @@ function EditModeTemplate({ postTitle, isLoading, callback, onDismiss }) {
1599
1706
  }
1600
1707
  ))
1601
1708
  )
1602
- ), inputError && /* @__PURE__ */ React19.createElement(import_ui16.ListItem, { disablePadding: true, sx: contentPanelListRowPaddingSx }, /* @__PURE__ */ React19.createElement(import_ui16.ListItemText, { sx: { color: "error.main", ...contentPanelListRowTitleSx } }, inputError)));
1709
+ ), inputError && /* @__PURE__ */ React20.createElement(import_ui16.ListItem, { disablePadding: true, sx: contentPanelListRowPaddingSx }, /* @__PURE__ */ React20.createElement(import_ui16.ListItemText, { sx: { color: "error.main", ...contentPanelListRowTitleSx } }, inputError)));
1603
1710
  }
1604
1711
  function CloseButton({ isLoading, closeButton, onDismiss }) {
1605
- return /* @__PURE__ */ React19.createElement(import_ui16.IconButton, { size: "tiny", color: "secondary", onClick: onDismiss, ref: closeButton, disabled: isLoading }, isLoading ? /* @__PURE__ */ React19.createElement(import_ui16.CircularProgress, { size: "1rem" }) : /* @__PURE__ */ React19.createElement(import_icons12.XIcon, { fontSize: "tiny" }));
1712
+ return /* @__PURE__ */ React20.createElement(import_ui16.IconButton, { size: "tiny", color: "secondary", onClick: onDismiss, ref: closeButton, disabled: isLoading }, isLoading ? /* @__PURE__ */ React20.createElement(import_ui16.CircularProgress, { size: "1rem" }) : /* @__PURE__ */ React20.createElement(import_icons12.XIcon, { fontSize: "tiny" }));
1606
1713
  }
1607
1714
 
1608
1715
  // src/components/panel/posts-list/list-items/list-item-create.tsx
@@ -1617,6 +1724,7 @@ function ListItemCreate() {
1617
1724
  title: inputValue,
1618
1725
  status: "draft"
1619
1726
  });
1727
+ resetEditMode();
1620
1728
  navigateToDocument(id);
1621
1729
  } catch {
1622
1730
  setError();
@@ -1629,7 +1737,7 @@ function ListItemCreate() {
1629
1737
  (0, import_i18n14.__)("New %s", "elementor"),
1630
1738
  postTypesMap[type].labels.singular_name
1631
1739
  );
1632
- return /* @__PURE__ */ React20.createElement(
1740
+ return /* @__PURE__ */ React21.createElement(
1633
1741
  EditModeTemplate,
1634
1742
  {
1635
1743
  postTitle: newItemLabel,
@@ -1640,7 +1748,7 @@ function ListItemCreate() {
1640
1748
  }
1641
1749
 
1642
1750
  // src/components/panel/posts-list/list-items/list-item-duplicate.tsx
1643
- var React21 = __toESM(require("react"));
1751
+ var React22 = __toESM(require("react"));
1644
1752
  var import_editor_documents2 = require("@elementor/editor-documents");
1645
1753
  var import_i18n15 = require("@wordpress/i18n");
1646
1754
  function ListItemDuplicate() {
@@ -1657,6 +1765,7 @@ function ListItemDuplicate() {
1657
1765
  id: editMode.details.postId,
1658
1766
  title: inputValue
1659
1767
  });
1768
+ resetEditMode();
1660
1769
  navigateToDocument(postId);
1661
1770
  } catch {
1662
1771
  setError();
@@ -1664,7 +1773,7 @@ function ListItemDuplicate() {
1664
1773
  resetEditMode();
1665
1774
  }
1666
1775
  };
1667
- return /* @__PURE__ */ React21.createElement(
1776
+ return /* @__PURE__ */ React22.createElement(
1668
1777
  EditModeTemplate,
1669
1778
  {
1670
1779
  postTitle: `${editMode.details.title} ${(0, import_i18n15.__)("copy", "elementor")}`,
@@ -1675,7 +1784,7 @@ function ListItemDuplicate() {
1675
1784
  }
1676
1785
 
1677
1786
  // src/components/panel/posts-list/list-items/list-item-rename.tsx
1678
- var React22 = __toESM(require("react"));
1787
+ var React23 = __toESM(require("react"));
1679
1788
  var import_editor_documents3 = require("@elementor/editor-documents");
1680
1789
 
1681
1790
  // src/hooks/use-rename-active-document.ts
@@ -1726,24 +1835,24 @@ function ListItemRename({ post }) {
1726
1835
  resetEditMode();
1727
1836
  }
1728
1837
  };
1729
- return /* @__PURE__ */ React22.createElement(EditModeTemplate, { postTitle: title, isLoading: updatePost.isPending, callback: renamePostCallback });
1838
+ return /* @__PURE__ */ React23.createElement(EditModeTemplate, { postTitle: title, isLoading: updatePost.isPending, callback: renamePostCallback });
1730
1839
  }
1731
1840
 
1732
1841
  // src/components/panel/posts-list/list-items/list-item-view.tsx
1733
- var React32 = __toESM(require("react"));
1734
- var import_react12 = require("react");
1842
+ var React33 = __toESM(require("react"));
1843
+ var import_react14 = require("react");
1735
1844
  var import_editor_documents5 = require("@elementor/editor-documents");
1736
1845
  var import_icons20 = require("@elementor/icons");
1737
1846
  var import_ui22 = require("@elementor/ui");
1738
1847
  var import_i18n24 = require("@wordpress/i18n");
1739
1848
 
1740
1849
  // src/components/shared/page-title-and-status.tsx
1741
- var React23 = __toESM(require("react"));
1850
+ var React24 = __toESM(require("react"));
1742
1851
  var import_ui17 = require("@elementor/ui");
1743
1852
  var import_i18n16 = require("@wordpress/i18n");
1744
1853
 
1745
1854
  // src/hooks/use-reverse-html-entities.ts
1746
- var import_react9 = require("react");
1855
+ var import_react11 = require("react");
1747
1856
 
1748
1857
  // src/utils/post-title-plain.ts
1749
1858
  function getPostTitlePlain(renderedTitle) {
@@ -1757,7 +1866,7 @@ function getPostTitlePlain(renderedTitle) {
1757
1866
 
1758
1867
  // src/hooks/use-reverse-html-entities.ts
1759
1868
  function useReverseHtmlEntities(escapedHTML = "") {
1760
- return (0, import_react9.useMemo)(() => getPostTitlePlain(escapedHTML), [escapedHTML]);
1869
+ return (0, import_react11.useMemo)(() => getPostTitlePlain(escapedHTML), [escapedHTML]);
1761
1870
  }
1762
1871
 
1763
1872
  // src/components/shared/page-title-and-status.tsx
@@ -1801,7 +1910,7 @@ var PageStatus = ({ status }) => {
1801
1910
  }
1802
1911
  const { color, label } = getStatusChipConfig(status);
1803
1912
  const isKnownStatus = isKnownPanelStatus(status);
1804
- return /* @__PURE__ */ React23.createElement(
1913
+ return /* @__PURE__ */ React24.createElement(
1805
1914
  import_ui17.Chip,
1806
1915
  {
1807
1916
  color,
@@ -1824,14 +1933,15 @@ var PageStatus = ({ status }) => {
1824
1933
  }
1825
1934
  );
1826
1935
  };
1827
- var PageTitle = ({ title }) => {
1936
+ var PageTitle = ({ status, title }) => {
1828
1937
  const modifiedTitle = useReverseHtmlEntities(title);
1829
- return /* @__PURE__ */ React23.createElement(
1938
+ const titleColor = "trash" === status ? "text.disabled" : "text.secondary";
1939
+ return /* @__PURE__ */ React24.createElement(
1830
1940
  import_ui17.Typography,
1831
1941
  {
1832
1942
  component: "span",
1833
1943
  variant: "body2",
1834
- color: "text.secondary",
1944
+ color: titleColor,
1835
1945
  noWrap: true,
1836
1946
  sx: {
1837
1947
  ...contentPanelListRowTitleSx,
@@ -1846,40 +1956,40 @@ var PageTitle = ({ title }) => {
1846
1956
  );
1847
1957
  };
1848
1958
  function PageTitleAndStatus({ title, status }) {
1849
- return /* @__PURE__ */ React23.createElement(import_ui17.Box, { alignItems: "center", display: "flex", minWidth: 0, sx: { overflow: "hidden" } }, /* @__PURE__ */ React23.createElement(PageTitle, { title }), /* @__PURE__ */ React23.createElement(PageStatus, { status }));
1959
+ return /* @__PURE__ */ React24.createElement(import_ui17.Box, { alignItems: "center", display: "flex", minWidth: 0, sx: { overflow: "hidden" } }, /* @__PURE__ */ React24.createElement(PageTitle, { status, title }), /* @__PURE__ */ React24.createElement(PageStatus, { status }));
1850
1960
  }
1851
1961
 
1852
1962
  // src/components/panel/actions-menu/actions/delete.tsx
1853
- var React25 = __toESM(require("react"));
1854
- var import_react10 = require("react");
1963
+ var React26 = __toESM(require("react"));
1964
+ var import_react12 = require("react");
1855
1965
  var import_editor_documents4 = require("@elementor/editor-documents");
1856
1966
  var import_icons13 = require("@elementor/icons");
1857
1967
  var import_ui19 = require("@elementor/ui");
1858
1968
  var import_i18n17 = require("@wordpress/i18n");
1859
1969
 
1860
1970
  // src/components/panel/actions-menu/action-menu-item.tsx
1861
- var React24 = __toESM(require("react"));
1971
+ var React25 = __toESM(require("react"));
1862
1972
  var import_ui18 = require("@elementor/ui");
1863
1973
  function ActionMenuItem({ description, icon: Icon, MenuItemProps, title }) {
1864
- return /* @__PURE__ */ React24.createElement(import_ui18.MenuItem, { ...MenuItemProps }, /* @__PURE__ */ React24.createElement(
1974
+ return /* @__PURE__ */ React25.createElement(import_ui18.MenuItem, { ...MenuItemProps }, /* @__PURE__ */ React25.createElement(
1865
1975
  import_ui18.ListItemIcon,
1866
1976
  {
1867
1977
  sx: {
1868
1978
  color: "inherit"
1869
1979
  }
1870
1980
  },
1871
- /* @__PURE__ */ React24.createElement(Icon, null)
1872
- ), /* @__PURE__ */ React24.createElement(import_ui18.ListItemText, { primary: title, secondary: description }));
1981
+ /* @__PURE__ */ React25.createElement(Icon, null)
1982
+ ), /* @__PURE__ */ React25.createElement(import_ui18.ListItemText, { primary: title, secondary: description }));
1873
1983
  }
1874
1984
 
1875
1985
  // src/components/panel/actions-menu/actions/delete.tsx
1876
1986
  function Delete({ post }) {
1877
- const [isDialogOpen, setIsDialogOpen] = (0, import_react10.useState)(false);
1987
+ const [isDialogOpen, setIsDialogOpen] = (0, import_react12.useState)(false);
1878
1988
  const activeDocument = (0, import_editor_documents4.__useActiveDocument)();
1879
1989
  const isPostActive = activeDocument?.id === post.id;
1880
1990
  const userCanDelete = post.user_can.delete;
1881
1991
  const isDisabled = !userCanDelete || post.isHome || isPostActive;
1882
- return /* @__PURE__ */ React25.createElement(React25.Fragment, null, /* @__PURE__ */ React25.createElement(
1992
+ return /* @__PURE__ */ React26.createElement(React26.Fragment, null, /* @__PURE__ */ React26.createElement(
1883
1993
  ActionMenuItem,
1884
1994
  {
1885
1995
  title: (0, import_i18n17.__)("Delete", "elementor"),
@@ -1890,7 +2000,7 @@ function Delete({ post }) {
1890
2000
  sx: { "&:hover": { color: "error.main" } }
1891
2001
  }
1892
2002
  }
1893
- ), isDialogOpen && /* @__PURE__ */ React25.createElement(DeleteDialog, { post, setIsDialogOpen }));
2003
+ ), isDialogOpen && /* @__PURE__ */ React26.createElement(DeleteDialog, { post, setIsDialogOpen }));
1894
2004
  }
1895
2005
  function DeleteDialog({
1896
2006
  post,
@@ -1921,7 +2031,7 @@ function DeleteDialog({
1921
2031
  }
1922
2032
  setIsDialogOpen(false);
1923
2033
  };
1924
- return /* @__PURE__ */ React25.createElement(import_ui19.Dialog, { open: true, onClose: handleCancel, "aria-labelledby": "delete-dialog" }, /* @__PURE__ */ React25.createElement(import_ui19.DialogTitle, { noWrap: true }, dialogTitle), /* @__PURE__ */ React25.createElement(import_ui19.Divider, null), /* @__PURE__ */ React25.createElement(import_ui19.DialogContent, null, /* @__PURE__ */ React25.createElement(import_ui19.DialogContentText, null, dialogBody)), /* @__PURE__ */ React25.createElement(import_ui19.DialogActions, null, /* @__PURE__ */ React25.createElement(
2034
+ return /* @__PURE__ */ React26.createElement(import_ui19.Dialog, { open: true, onClose: handleCancel, "aria-labelledby": "delete-dialog" }, /* @__PURE__ */ React26.createElement(import_ui19.DialogTitle, { noWrap: true }, dialogTitle), /* @__PURE__ */ React26.createElement(import_ui19.Divider, null), /* @__PURE__ */ React26.createElement(import_ui19.DialogContent, null, /* @__PURE__ */ React26.createElement(import_ui19.DialogContentText, null, dialogBody)), /* @__PURE__ */ React26.createElement(import_ui19.DialogActions, null, /* @__PURE__ */ React26.createElement(
1925
2035
  import_ui19.Button,
1926
2036
  {
1927
2037
  variant: "contained",
@@ -1930,11 +2040,11 @@ function DeleteDialog({
1930
2040
  disabled: deletePost.isPending
1931
2041
  },
1932
2042
  (0, import_i18n17.__)("Cancel", "elementor")
1933
- ), /* @__PURE__ */ React25.createElement(import_ui19.Button, { variant: "contained", color: "error", onClick: deletePage, disabled: deletePost.isPending }, !deletePost.isPending ? (0, import_i18n17.__)("Delete", "elementor") : /* @__PURE__ */ React25.createElement(import_ui19.CircularProgress, null))));
2043
+ ), /* @__PURE__ */ React26.createElement(import_ui19.Button, { variant: "contained", color: "error", onClick: deletePage, disabled: deletePost.isPending }, !deletePost.isPending ? (0, import_i18n17.__)("Delete", "elementor") : /* @__PURE__ */ React26.createElement(import_ui19.CircularProgress, null))));
1934
2044
  }
1935
2045
 
1936
2046
  // src/components/panel/actions-menu/actions/duplicate.tsx
1937
- var React26 = __toESM(require("react"));
2047
+ var React27 = __toESM(require("react"));
1938
2048
  var import_icons14 = require("@elementor/icons");
1939
2049
  var import_i18n18 = require("@wordpress/i18n");
1940
2050
  function Duplicate({ post, popupState }) {
@@ -1951,7 +2061,7 @@ function Duplicate({ post, popupState }) {
1951
2061
  });
1952
2062
  };
1953
2063
  const isDisabled = !canCreate;
1954
- return /* @__PURE__ */ React26.createElement(
2064
+ return /* @__PURE__ */ React27.createElement(
1955
2065
  ActionMenuItem,
1956
2066
  {
1957
2067
  title: (0, import_i18n18.__)("Duplicate", "elementor"),
@@ -1965,14 +2075,14 @@ function Duplicate({ post, popupState }) {
1965
2075
  }
1966
2076
 
1967
2077
  // src/components/panel/actions-menu/actions/force-delete.tsx
1968
- var React27 = __toESM(require("react"));
1969
- var import_react11 = require("react");
2078
+ var React28 = __toESM(require("react"));
2079
+ var import_react13 = require("react");
1970
2080
  var import_icons15 = require("@elementor/icons");
1971
2081
  var import_ui20 = require("@elementor/ui");
1972
2082
  var import_i18n19 = require("@wordpress/i18n");
1973
2083
  function ForceDelete({ post }) {
1974
- const [isDialogOpen, setIsDialogOpen] = (0, import_react11.useState)(false);
1975
- return /* @__PURE__ */ React27.createElement(React27.Fragment, null, /* @__PURE__ */ React27.createElement(
2084
+ const [isDialogOpen, setIsDialogOpen] = (0, import_react13.useState)(false);
2085
+ return /* @__PURE__ */ React28.createElement(React28.Fragment, null, /* @__PURE__ */ React28.createElement(
1976
2086
  ActionMenuItem,
1977
2087
  {
1978
2088
  icon: import_icons15.TrashIcon,
@@ -1983,7 +2093,7 @@ function ForceDelete({ post }) {
1983
2093
  },
1984
2094
  title: (0, import_i18n19.__)("Delete permanently", "elementor")
1985
2095
  }
1986
- ), isDialogOpen && /* @__PURE__ */ React27.createElement(ForceDeleteDialog, { post, setIsDialogOpen }));
2096
+ ), isDialogOpen && /* @__PURE__ */ React28.createElement(ForceDeleteDialog, { post, setIsDialogOpen }));
1987
2097
  }
1988
2098
  function ForceDeleteDialog({
1989
2099
  post,
@@ -2008,7 +2118,7 @@ function ForceDeleteDialog({
2008
2118
  }
2009
2119
  setIsDialogOpen(false);
2010
2120
  };
2011
- return /* @__PURE__ */ React27.createElement(import_ui20.Dialog, { "aria-labelledby": "force-delete-dialog", onClose: handleCancel, open: true }, /* @__PURE__ */ React27.createElement(import_ui20.DialogTitle, { noWrap: true }, dialogTitle), /* @__PURE__ */ React27.createElement(import_ui20.Divider, null), /* @__PURE__ */ React27.createElement(import_ui20.DialogContent, null, /* @__PURE__ */ React27.createElement(import_ui20.DialogContentText, null, dialogBody)), /* @__PURE__ */ React27.createElement(import_ui20.DialogActions, null, /* @__PURE__ */ React27.createElement(
2121
+ return /* @__PURE__ */ React28.createElement(import_ui20.Dialog, { "aria-labelledby": "force-delete-dialog", onClose: handleCancel, open: true }, /* @__PURE__ */ React28.createElement(import_ui20.DialogTitle, { noWrap: true }, dialogTitle), /* @__PURE__ */ React28.createElement(import_ui20.Divider, null), /* @__PURE__ */ React28.createElement(import_ui20.DialogContent, null, /* @__PURE__ */ React28.createElement(import_ui20.DialogContentText, null, dialogBody)), /* @__PURE__ */ React28.createElement(import_ui20.DialogActions, null, /* @__PURE__ */ React28.createElement(
2012
2122
  import_ui20.Button,
2013
2123
  {
2014
2124
  variant: "contained",
@@ -2017,7 +2127,7 @@ function ForceDeleteDialog({
2017
2127
  disabled: forceDeletePost.isPending
2018
2128
  },
2019
2129
  (0, import_i18n19.__)("Cancel", "elementor")
2020
- ), /* @__PURE__ */ React27.createElement(
2130
+ ), /* @__PURE__ */ React28.createElement(
2021
2131
  import_ui20.Button,
2022
2132
  {
2023
2133
  variant: "contained",
@@ -2025,17 +2135,17 @@ function ForceDeleteDialog({
2025
2135
  onClick: () => void handleDelete(),
2026
2136
  disabled: forceDeletePost.isPending
2027
2137
  },
2028
- !forceDeletePost.isPending ? (0, import_i18n19.__)("Delete permanently", "elementor") : /* @__PURE__ */ React27.createElement(import_ui20.CircularProgress, null)
2138
+ !forceDeletePost.isPending ? (0, import_i18n19.__)("Delete permanently", "elementor") : /* @__PURE__ */ React28.createElement(import_ui20.CircularProgress, null)
2029
2139
  )));
2030
2140
  }
2031
2141
 
2032
2142
  // src/components/panel/actions-menu/actions/rename.tsx
2033
- var React28 = __toESM(require("react"));
2143
+ var React29 = __toESM(require("react"));
2034
2144
  var import_icons16 = require("@elementor/icons");
2035
2145
  var import_i18n20 = require("@wordpress/i18n");
2036
2146
  function Rename({ post }) {
2037
2147
  const { setEditMode } = usePostListContext();
2038
- return /* @__PURE__ */ React28.createElement(
2148
+ return /* @__PURE__ */ React29.createElement(
2039
2149
  ActionMenuItem,
2040
2150
  {
2041
2151
  title: (0, import_i18n20.__)("Rename", "elementor"),
@@ -2056,7 +2166,7 @@ function Rename({ post }) {
2056
2166
  }
2057
2167
 
2058
2168
  // src/components/panel/actions-menu/actions/restore.tsx
2059
- var React29 = __toESM(require("react"));
2169
+ var React30 = __toESM(require("react"));
2060
2170
  var import_icons17 = require("@elementor/icons");
2061
2171
  var import_i18n21 = require("@wordpress/i18n");
2062
2172
  function Restore({ post }) {
@@ -2069,7 +2179,7 @@ function Restore({ post }) {
2069
2179
  setError();
2070
2180
  }
2071
2181
  };
2072
- return /* @__PURE__ */ React29.createElement(
2182
+ return /* @__PURE__ */ React30.createElement(
2073
2183
  ActionMenuItem,
2074
2184
  {
2075
2185
  description: (0, import_i18n21.__)("Restored as draft", "elementor"),
@@ -2084,7 +2194,7 @@ function Restore({ post }) {
2084
2194
  }
2085
2195
 
2086
2196
  // src/components/panel/actions-menu/actions/set-home.tsx
2087
- var React30 = __toESM(require("react"));
2197
+ var React31 = __toESM(require("react"));
2088
2198
  var import_editor_ui5 = require("@elementor/editor-ui");
2089
2199
  var import_icons18 = require("@elementor/icons");
2090
2200
  var import_ui21 = require("@elementor/ui");
@@ -2093,8 +2203,17 @@ var import_i18n22 = require("@wordpress/i18n");
2093
2203
  // src/hooks/use-homepage-actions.ts
2094
2204
  var import_query8 = require("@elementor/query");
2095
2205
  function useHomepageActions() {
2206
+ const queryClient = (0, import_query8.useQueryClient)();
2096
2207
  const invalidateSettings = useInvalidateSettings();
2097
- const onSuccess = async () => invalidateSettings({ exact: true });
2208
+ const onSuccess = async (_data, settings) => {
2209
+ const homepageQueryKey = settingsQueryKey();
2210
+ if ("page" === settings.show_on_front) {
2211
+ queryClient.setQueryData(homepageQueryKey, settings.page_on_front);
2212
+ } else {
2213
+ queryClient.setQueryData(homepageQueryKey, 0);
2214
+ }
2215
+ await invalidateSettings({ exact: true });
2216
+ };
2098
2217
  const updateSettingsMutation = (0, import_query8.useMutation)({
2099
2218
  mutationFn: (settings) => updateSettings(settings),
2100
2219
  onSuccess
@@ -2138,7 +2257,7 @@ function SetHome({ post, closeMenu, onRequestRemoveHomepage }) {
2138
2257
  const isRemoveHomeDisabled = !canManageOptions || updateSettingsMutation.isPending;
2139
2258
  const isDisabled = isPostHomepage ? isRemoveHomeDisabled : isSetHomeDisabled;
2140
2259
  const title = isPostHomepage ? (0, import_i18n22.__)("Remove as homepage", "elementor") : (0, import_i18n22.__)("Set as homepage", "elementor");
2141
- return /* @__PURE__ */ React30.createElement(
2260
+ return /* @__PURE__ */ React31.createElement(
2142
2261
  ActionMenuItem,
2143
2262
  {
2144
2263
  title,
@@ -2176,10 +2295,10 @@ function RemoveHomepageDialog({ open, onClose }) {
2176
2295
  };
2177
2296
  const isPending = updateSettingsMutation.isPending;
2178
2297
  const removeHomepageLabel = (0, import_i18n22.__)("Remove as homepage", "elementor");
2179
- return /* @__PURE__ */ React30.createElement(import_editor_ui5.ConfirmationDialog, { open: true, onClose: handleCancel }, /* @__PURE__ */ React30.createElement(import_editor_ui5.ConfirmationDialog.Title, { iconColor: "secondary" }, (0, import_i18n22.__)("Remove this page as your homepage?", "elementor")), /* @__PURE__ */ React30.createElement(import_editor_ui5.ConfirmationDialog.Content, null, /* @__PURE__ */ React30.createElement(import_editor_ui5.ConfirmationDialog.ContentText, null, (0, import_i18n22.__)(
2298
+ return /* @__PURE__ */ React31.createElement(import_editor_ui5.ConfirmationDialog, { open: true, onClose: handleCancel }, /* @__PURE__ */ React31.createElement(import_editor_ui5.ConfirmationDialog.Title, { iconColor: "secondary" }, (0, import_i18n22.__)("Remove this page as your homepage?", "elementor")), /* @__PURE__ */ React31.createElement(import_editor_ui5.ConfirmationDialog.Content, null, /* @__PURE__ */ React31.createElement(import_editor_ui5.ConfirmationDialog.ContentText, null, (0, import_i18n22.__)(
2180
2299
  "Your homepage will go back to showing your latest posts. You can set a page as your homepage again at any time.",
2181
2300
  "elementor"
2182
- ))), /* @__PURE__ */ React30.createElement(import_ui21.DialogActions, null, /* @__PURE__ */ React30.createElement(import_ui21.Button, { color: "secondary", disabled: isPending, onClick: handleCancel }, (0, import_i18n22.__)("Not now", "elementor")), /* @__PURE__ */ React30.createElement(
2301
+ ))), /* @__PURE__ */ React31.createElement(import_ui21.DialogActions, null, /* @__PURE__ */ React31.createElement(import_ui21.Button, { color: "secondary", disabled: isPending, onClick: handleCancel }, (0, import_i18n22.__)("Not now", "elementor")), /* @__PURE__ */ React31.createElement(
2183
2302
  import_ui21.Button,
2184
2303
  {
2185
2304
  color: "secondary",
@@ -2188,18 +2307,18 @@ function RemoveHomepageDialog({ open, onClose }) {
2188
2307
  sx: { ml: 1 },
2189
2308
  variant: "contained"
2190
2309
  },
2191
- !isPending ? removeHomepageLabel : /* @__PURE__ */ React30.createElement(import_ui21.CircularProgress, null)
2310
+ !isPending ? removeHomepageLabel : /* @__PURE__ */ React31.createElement(import_ui21.CircularProgress, null)
2192
2311
  )));
2193
2312
  }
2194
2313
 
2195
2314
  // src/components/panel/actions-menu/actions/view.tsx
2196
- var React31 = __toESM(require("react"));
2315
+ var React32 = __toESM(require("react"));
2197
2316
  var import_icons19 = require("@elementor/icons");
2198
2317
  var import_i18n23 = require("@wordpress/i18n");
2199
2318
  function View({ post }) {
2200
2319
  const { type } = usePostListContext();
2201
2320
  const title = (0, import_i18n23.__)("View %s", "elementor").replace("%s", postTypesMap[type].labels.singular_name);
2202
- return /* @__PURE__ */ React31.createElement(
2321
+ return /* @__PURE__ */ React32.createElement(
2203
2322
  ActionMenuItem,
2204
2323
  {
2205
2324
  title,
@@ -2226,14 +2345,14 @@ var DisabledPostTooltip = ({
2226
2345
  postTypeSlug
2227
2346
  }) => {
2228
2347
  if (isDisabled) {
2229
- const title = /* @__PURE__ */ React32.createElement(import_ui22.Typography, { variant: "caption" }, getCannotEditPanelItemMessage(postTypeSlug), /* @__PURE__ */ React32.createElement("br", null), (0, import_i18n24.__)("To edit it directly, contact the site owner", "elementor"));
2230
- return /* @__PURE__ */ React32.createElement(import_ui22.Tooltip, { title, placement: "bottom", arrow: false }, /* @__PURE__ */ React32.createElement("span", null, children));
2348
+ const title = /* @__PURE__ */ React33.createElement(import_ui22.Typography, { variant: "caption" }, getCannotEditPanelItemMessage(postTypeSlug), /* @__PURE__ */ React33.createElement("br", null), (0, import_i18n24.__)("To edit it directly, contact the site owner", "elementor"));
2349
+ return /* @__PURE__ */ React33.createElement(import_ui22.Tooltip, { title, placement: "bottom", arrow: false }, /* @__PURE__ */ React33.createElement("span", null, children));
2231
2350
  }
2232
- return /* @__PURE__ */ React32.createElement(React32.Fragment, null, children);
2351
+ return /* @__PURE__ */ React33.createElement(React33.Fragment, null, children);
2233
2352
  };
2234
2353
  function ListItemView({ post }) {
2235
2354
  const { type } = usePostListContext();
2236
- const [isRemoveHomeDialogOpen, setIsRemoveHomeDialogOpen] = (0, import_react12.useState)(false);
2355
+ const [isRemoveHomeDialogOpen, setIsRemoveHomeDialogOpen] = (0, import_react14.useState)(false);
2237
2356
  const activeDocument = (0, import_editor_documents5.__useActiveDocument)();
2238
2357
  const navigateToDocument = (0, import_editor_documents5.__useNavigateToDocument)();
2239
2358
  const popupState = (0, import_ui22.usePopupState)({
@@ -2250,12 +2369,18 @@ function ListItemView({ post }) {
2250
2369
  const menuTriggerProps = (0, import_ui22.bindTrigger)(popupState);
2251
2370
  const hasListItemActions = useSiteContentListItemActionsInjections().length > 0;
2252
2371
  const showListItemActions = isActive && post.user_can.edit && !isTrashed && hasListItemActions;
2253
- const listRow = /* @__PURE__ */ React32.createElement(
2372
+ const isHome = Boolean(post.isHome);
2373
+ const trailingActionCount = 1 + (showListItemActions ? 1 : 0) + (isHome ? 1 : 0);
2374
+ const allowRowHover = !isEditBlocked;
2375
+ const listRow = /* @__PURE__ */ React33.createElement(
2254
2376
  import_ui22.ListItem,
2255
2377
  {
2256
2378
  disablePadding: true,
2257
- sx: getContentPanelListItemSx(showListItemActions),
2258
- secondaryAction: /* @__PURE__ */ React32.createElement(import_ui22.Stack, { alignItems: "center", direction: "row", spacing: 0 }, showListItemActions && /* @__PURE__ */ React32.createElement(SiteContentListItemActionsSlot, { post, title }), /* @__PURE__ */ React32.createElement(
2379
+ sx: {
2380
+ ...getContentPanelListItemSx(trailingActionCount),
2381
+ ...getContentPanelListItemRowStateSx(isActive, allowRowHover)
2382
+ },
2383
+ secondaryAction: /* @__PURE__ */ React33.createElement(import_ui22.Stack, { alignItems: "center", direction: "row", spacing: 0 }, showListItemActions && /* @__PURE__ */ React33.createElement(SiteContentListItemActionsSlot, { post, title }), isHome && /* @__PURE__ */ React33.createElement(import_icons20.HomeIcon, { color: "disabled", fontSize: "tiny", titleAccess: (0, import_i18n24.__)("Homepage", "elementor") }), /* @__PURE__ */ React33.createElement(
2259
2384
  import_ui22.IconButton,
2260
2385
  {
2261
2386
  "aria-label": (0, import_i18n24.__)("More actions", "elementor"),
@@ -2266,10 +2391,10 @@ function ListItemView({ post }) {
2266
2391
  menuTriggerProps.onClick?.(event);
2267
2392
  }
2268
2393
  },
2269
- /* @__PURE__ */ React32.createElement(import_icons20.DotsVerticalIcon, { fontSize: "tiny" })
2394
+ /* @__PURE__ */ React33.createElement(import_icons20.DotsVerticalIcon, { fontSize: "tiny" })
2270
2395
  ))
2271
2396
  },
2272
- /* @__PURE__ */ React32.createElement(
2397
+ /* @__PURE__ */ React33.createElement(
2273
2398
  import_ui22.ListItemButton,
2274
2399
  {
2275
2400
  dense: true,
@@ -2285,18 +2410,17 @@ function ListItemView({ post }) {
2285
2410
  shape: "rounded",
2286
2411
  sx: contentPanelListItemButtonSx
2287
2412
  },
2288
- /* @__PURE__ */ React32.createElement(import_ui22.ListItemText, { disableTypography: true, sx: { flex: 1, minWidth: 0 } }, /* @__PURE__ */ React32.createElement(PageTitleAndStatus, { title, status })),
2289
- post.isHome && /* @__PURE__ */ React32.createElement(import_icons20.HomeIcon, { titleAccess: (0, import_i18n24.__)("Homepage", "elementor"), color: "disabled" })
2413
+ /* @__PURE__ */ React33.createElement(import_ui22.ListItemText, { disableTypography: true, sx: { flex: 1, minWidth: 0 } }, /* @__PURE__ */ React33.createElement(PageTitleAndStatus, { title, status }))
2290
2414
  )
2291
2415
  );
2292
- return /* @__PURE__ */ React32.createElement(React32.Fragment, null, isEditBlocked ? /* @__PURE__ */ React32.createElement(DisabledPostTooltip, { isDisabled: true, postTypeSlug: type }, listRow) : listRow, /* @__PURE__ */ React32.createElement(
2416
+ return /* @__PURE__ */ React33.createElement(React33.Fragment, null, isEditBlocked ? /* @__PURE__ */ React33.createElement(DisabledPostTooltip, { isDisabled: true, postTypeSlug: type }, listRow) : listRow, /* @__PURE__ */ React33.createElement(
2293
2417
  import_ui22.Menu,
2294
2418
  {
2295
2419
  PaperProps: { sx: { mt: 2, width: 200 } },
2296
2420
  MenuListProps: { dense: true },
2297
2421
  ...(0, import_ui22.bindMenu)(popupState)
2298
2422
  },
2299
- 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(import_ui22.Divider, null), /* @__PURE__ */ React32.createElement(
2423
+ 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(import_ui22.Divider, null), /* @__PURE__ */ React33.createElement(
2300
2424
  SetHome,
2301
2425
  {
2302
2426
  post,
@@ -2304,7 +2428,7 @@ function ListItemView({ post }) {
2304
2428
  onRequestRemoveHomepage: () => setIsRemoveHomeDialogOpen(true)
2305
2429
  }
2306
2430
  )))
2307
- ), /* @__PURE__ */ React32.createElement(
2431
+ ), /* @__PURE__ */ React33.createElement(
2308
2432
  RemoveHomepageDialog,
2309
2433
  {
2310
2434
  open: isRemoveHomeDialogOpen,
@@ -2317,22 +2441,22 @@ function ListItemView({ post }) {
2317
2441
  function PostListItem({ post }) {
2318
2442
  const { editMode } = usePostListContext();
2319
2443
  if ("rename" === editMode.mode && post?.id && post?.id === editMode.details.postId) {
2320
- return /* @__PURE__ */ React33.createElement(ListItemRename, { post });
2444
+ return /* @__PURE__ */ React34.createElement(ListItemRename, { post });
2321
2445
  }
2322
2446
  if ("create" === editMode.mode && !post) {
2323
- return /* @__PURE__ */ React33.createElement(ListItemCreate, null);
2447
+ return /* @__PURE__ */ React34.createElement(ListItemCreate, null);
2324
2448
  }
2325
2449
  if ("duplicate" === editMode.mode && !post) {
2326
- return /* @__PURE__ */ React33.createElement(ListItemDuplicate, null);
2450
+ return /* @__PURE__ */ React34.createElement(ListItemDuplicate, null);
2327
2451
  }
2328
2452
  if (!post) {
2329
2453
  return null;
2330
2454
  }
2331
- return /* @__PURE__ */ React33.createElement(ListItemView, { post });
2455
+ return /* @__PURE__ */ React34.createElement(ListItemView, { post });
2332
2456
  }
2333
2457
 
2334
2458
  // src/components/panel/posts-list/post-list-pagination-actions.tsx
2335
- var React34 = __toESM(require("react"));
2459
+ var React35 = __toESM(require("react"));
2336
2460
  var import_editor_ui6 = require("@elementor/editor-ui");
2337
2461
  var import_ui23 = require("@elementor/ui");
2338
2462
  var import_i18n25 = require("@wordpress/i18n");
@@ -2354,26 +2478,26 @@ function PostListPaginationActions({
2354
2478
  }
2355
2479
  const loadMoreLabel = (0, import_i18n25.__)("Load more", "elementor");
2356
2480
  const showLessLabel = (0, import_i18n25.__)("Show less", "elementor");
2357
- const loadMoreButton = /* @__PURE__ */ React34.createElement(
2481
+ const loadMoreButton = /* @__PURE__ */ React35.createElement(
2358
2482
  import_ui23.Button,
2359
2483
  {
2360
2484
  ...listPaginationButtonProps,
2361
2485
  ref: loadMoreButtonRef,
2362
2486
  "aria-label": loadMoreLabel,
2363
2487
  disabled: isLoadingMore,
2364
- endIcon: isLoadingMore ? void 0 : /* @__PURE__ */ React34.createElement(import_editor_ui6.CollapseIcon, { open: false }),
2488
+ endIcon: isLoadingMore ? void 0 : /* @__PURE__ */ React35.createElement(import_editor_ui6.CollapseIcon, { open: false }),
2365
2489
  fullWidth: true,
2366
2490
  onClick: onLoadMore,
2367
2491
  sx: { flex: 1, my: 0.5 }
2368
2492
  },
2369
- isLoadingMore ? /* @__PURE__ */ React34.createElement(import_ui23.CircularProgress, { size: 20 }) : loadMoreLabel
2493
+ isLoadingMore ? /* @__PURE__ */ React35.createElement(import_ui23.CircularProgress, { size: 20 }) : loadMoreLabel
2370
2494
  );
2371
- const showLessButton = /* @__PURE__ */ React34.createElement(
2495
+ const showLessButton = /* @__PURE__ */ React35.createElement(
2372
2496
  import_ui23.Button,
2373
2497
  {
2374
2498
  ...listPaginationButtonProps,
2375
2499
  "aria-label": showLessLabel,
2376
- endIcon: /* @__PURE__ */ React34.createElement(import_editor_ui6.CollapseIcon, { open: true }),
2500
+ endIcon: /* @__PURE__ */ React35.createElement(import_editor_ui6.CollapseIcon, { open: true }),
2377
2501
  fullWidth: true,
2378
2502
  onClick: onShowLess,
2379
2503
  sx: { flex: 1, my: 0.5 }
@@ -2381,27 +2505,21 @@ function PostListPaginationActions({
2381
2505
  showLessLabel
2382
2506
  );
2383
2507
  if (canShowLess && canLoadMore) {
2384
- return /* @__PURE__ */ React34.createElement(import_ui23.Box, { sx: { px: 2, width: "100%" } }, /* @__PURE__ */ React34.createElement(import_ui23.Stack, { direction: "row", spacing: 1 }, showLessButton, loadMoreButton));
2508
+ return /* @__PURE__ */ React35.createElement(import_ui23.Box, { sx: { px: 2, width: "100%" } }, /* @__PURE__ */ React35.createElement(import_ui23.Stack, { direction: "row", spacing: 1 }, showLessButton, loadMoreButton));
2385
2509
  }
2386
- return /* @__PURE__ */ React34.createElement(import_ui23.Box, { sx: { px: 2, width: "100%" } }, canShowLess ? showLessButton : loadMoreButton);
2510
+ return /* @__PURE__ */ React35.createElement(import_ui23.Box, { sx: { px: 2, width: "100%" } }, canShowLess ? showLessButton : loadMoreButton);
2387
2511
  }
2388
2512
 
2389
2513
  // src/components/panel/posts-list/posts-collapsible-list.tsx
2390
- var SEARCH_DEBOUNCE_MS = 300;
2391
- function PostsCollapsibleList({ isOpenByDefault = false }) {
2514
+ function PostsCollapsibleListContent({ isOpenByDefault = false }) {
2392
2515
  const { type, editMode, resetEditMode, setEditMode } = usePostListContext();
2393
- const { registerSection, searchQuery, siteContentSort, statusFilters, unregisterSection } = useContentPanelCoordinator();
2394
- const [isOpen, setIsOpen] = (0, import_react13.useState)(isOpenByDefault);
2395
- const trimmedSearch = searchQuery.trim();
2396
- const [debouncedSearch, setDebouncedSearch] = (0, import_react13.useState)(trimmedSearch);
2397
- const focusAfterShowLessRef = (0, import_react13.useRef)(false);
2398
- const listTopRef = (0, import_react13.useRef)(null);
2399
- const loadMoreButtonRef = (0, import_react13.useRef)(null);
2400
- const sectionHeaderRef = (0, import_react13.useRef)(null);
2401
- (0, import_react13.useEffect)(() => {
2402
- const handle = window.setTimeout(() => setDebouncedSearch(trimmedSearch), SEARCH_DEBOUNCE_MS);
2403
- return () => window.clearTimeout(handle);
2404
- }, [trimmedSearch]);
2516
+ const { registerSection, unregisterSection } = useContentPanelCoordinator();
2517
+ const { clearStatusFilters, debouncedSearch, siteContentSort, statusFilters } = useSiteContentSectionToolbar();
2518
+ const [isOpen, setIsOpen] = (0, import_react15.useState)(isOpenByDefault);
2519
+ const focusAfterShowLessRef = (0, import_react15.useRef)(false);
2520
+ const listTopRef = (0, import_react15.useRef)(null);
2521
+ const loadMoreButtonRef = (0, import_react15.useRef)(null);
2522
+ const sectionHeaderRef = (0, import_react15.useRef)(null);
2405
2523
  const {
2406
2524
  data: { posts, total },
2407
2525
  isError: postsError,
@@ -2417,23 +2535,28 @@ function PostsCollapsibleList({ isOpenByDefault = false }) {
2417
2535
  const { data: homepageId } = useHomepage();
2418
2536
  const isPageType = type === "page";
2419
2537
  const statusFiltersKey = serializeSiteContentStatusFilters(statusFilters);
2420
- (0, import_react13.useEffect)(() => {
2538
+ (0, import_react15.useEffect)(() => {
2421
2539
  if (isTrashFilter) {
2422
2540
  resetEditMode();
2423
2541
  }
2424
2542
  }, [isTrashFilter, resetEditMode]);
2425
- (0, import_react13.useEffect)(() => {
2543
+ (0, import_react15.useEffect)(() => {
2426
2544
  registerSection(type, {
2427
2545
  setExpanded: setIsOpen,
2428
- startCreate: () => setEditMode({ mode: "create", details: {} })
2546
+ startCreate: () => {
2547
+ if (isSiteContentTrashFilterActive(statusFilters)) {
2548
+ clearStatusFilters();
2549
+ }
2550
+ setEditMode({ mode: "create", details: {} });
2551
+ }
2429
2552
  });
2430
2553
  return () => unregisterSection(type);
2431
- }, [registerSection, unregisterSection, type, setEditMode]);
2432
- const filteredPosts = (0, import_react13.useMemo)(() => {
2554
+ }, [clearStatusFilters, registerSection, setEditMode, statusFilters, type, unregisterSection]);
2555
+ const filteredPosts = (0, import_react15.useMemo)(() => {
2433
2556
  if (!posts) {
2434
2557
  return [];
2435
2558
  }
2436
- const mappedPosts = isPageType ? posts.map((post) => post.id === homepageId ? { ...post, isHome: true } : post) : posts;
2559
+ const mappedPosts = isPageType ? posts.map((post) => ({ ...post, isHome: post.id === homepageId })) : posts;
2437
2560
  const shouldPinHomepage = isPageType && shouldPinHomepageForSiteContentSort(siteContentSort);
2438
2561
  const sorted = shouldPinHomepage ? [...mappedPosts].sort((a, b) => {
2439
2562
  if (a.id === homepageId) {
@@ -2454,7 +2577,7 @@ function PostsCollapsibleList({ isOpenByDefault = false }) {
2454
2577
  resetKey: `${type}:${debouncedSearch}:${statusFiltersKey}:${siteContentSort}`,
2455
2578
  totalCount: total
2456
2579
  });
2457
- const displayedPosts = (0, import_react13.useMemo)(
2580
+ const displayedPosts = (0, import_react15.useMemo)(
2458
2581
  () => filteredPosts.slice(0, pagination.visibleCount),
2459
2582
  [filteredPosts, pagination.visibleCount]
2460
2583
  );
@@ -2466,7 +2589,7 @@ function PostsCollapsibleList({ isOpenByDefault = false }) {
2466
2589
  listTop.scrollIntoView({ block: "nearest" });
2467
2590
  }
2468
2591
  };
2469
- (0, import_react13.useEffect)(() => {
2592
+ (0, import_react15.useEffect)(() => {
2470
2593
  if (!focusAfterShowLessRef.current) {
2471
2594
  return;
2472
2595
  }
@@ -2478,22 +2601,27 @@ function PostsCollapsibleList({ isOpenByDefault = false }) {
2478
2601
  }
2479
2602
  sectionHeaderRef.current?.focus();
2480
2603
  }, [pagination.canLoadMore, pagination.visibleCount]);
2481
- (0, import_react13.useEffect)(() => {
2604
+ (0, import_react15.useEffect)(() => {
2482
2605
  if ((debouncedSearch || hasActiveSiteContentStatusFilters(statusFilters)) && filteredPosts.length > 0) {
2483
2606
  setIsOpen(true);
2484
2607
  }
2485
2608
  }, [debouncedSearch, filteredPosts.length, statusFilters]);
2486
2609
  if (postsError) {
2487
- return /* @__PURE__ */ React35.createElement(ErrorState, null);
2610
+ return /* @__PURE__ */ React36.createElement(ErrorState, null);
2488
2611
  }
2489
2612
  if (postsPending && !posts?.length) {
2490
- return /* @__PURE__ */ React35.createElement(import_ui24.Box, { sx: { px: 2 } }, /* @__PURE__ */ React35.createElement(import_ui24.Box, null, /* @__PURE__ */ React35.createElement(import_ui24.Skeleton, { sx: { my: 3 }, animation: "wave", variant: "rounded", width: "100%", height: "24px" }), /* @__PURE__ */ React35.createElement(import_ui24.Skeleton, { sx: { my: 3 }, animation: "wave", variant: "rounded", width: "70%", height: "24px" }), /* @__PURE__ */ React35.createElement(import_ui24.Skeleton, { sx: { my: 3 }, animation: "wave", variant: "rounded", width: "70%", height: "24px" }), /* @__PURE__ */ React35.createElement(import_ui24.Skeleton, { sx: { my: 3 }, animation: "wave", variant: "rounded", width: "70%", height: "24px" })));
2613
+ return /* @__PURE__ */ React36.createElement(import_ui24.Box, { sx: { px: 2 } }, /* @__PURE__ */ React36.createElement(import_ui24.Box, null, /* @__PURE__ */ React36.createElement(import_ui24.Skeleton, { sx: { my: 3 }, animation: "wave", variant: "rounded", width: "100%", height: "24px" }), /* @__PURE__ */ React36.createElement(import_ui24.Skeleton, { sx: { my: 3 }, animation: "wave", variant: "rounded", width: "70%", height: "24px" }), /* @__PURE__ */ React36.createElement(import_ui24.Skeleton, { sx: { my: 3 }, animation: "wave", variant: "rounded", width: "70%", height: "24px" }), /* @__PURE__ */ React36.createElement(import_ui24.Skeleton, { sx: { my: 3 }, animation: "wave", variant: "rounded", width: "70%", height: "24px" })));
2491
2614
  }
2492
2615
  const displayCount = total;
2493
2616
  const sectionTitle = postTypesMap[type].labels.plural_name;
2494
2617
  const showNoResults = (debouncedSearch || hasActiveSiteContentStatusFilters(statusFilters)) && filteredPosts.length === 0;
2495
2618
  const countChipLabel = isNarrowed && baselineTotal !== void 0 ? `${total} / ${baselineTotal}` : void 0;
2496
- return /* @__PURE__ */ React35.createElement(
2619
+ const searchAriaLabel = (0, import_i18n26.sprintf)(
2620
+ /* translators: %s: document type plural label. */
2621
+ (0, import_i18n26.__)("Search %s", "elementor"),
2622
+ sectionTitle
2623
+ );
2624
+ return /* @__PURE__ */ React36.createElement(
2497
2625
  CollapsibleList,
2498
2626
  {
2499
2627
  count: displayCount,
@@ -2501,16 +2629,22 @@ function PostsCollapsibleList({ isOpenByDefault = false }) {
2501
2629
  headerRef: sectionHeaderRef,
2502
2630
  isOpen,
2503
2631
  onOpenChange: setIsOpen,
2504
- title: sectionTitle,
2505
- trailingActions: isTrashFilter ? null : /* @__PURE__ */ React35.createElement(SectionAddButton, { onBeforeCreate: () => setIsOpen(true) })
2632
+ sectionToolbar: /* @__PURE__ */ React36.createElement(
2633
+ ContentPanelSectionToolbar,
2634
+ {
2635
+ addAction: isTrashFilter ? void 0 : /* @__PURE__ */ React36.createElement(SectionAddButton, { onBeforeCreate: () => setIsOpen(true) }),
2636
+ searchAriaLabel
2637
+ }
2638
+ ),
2639
+ title: sectionTitle
2506
2640
  },
2507
- showNoResults && /* @__PURE__ */ React35.createElement(import_ui24.Box, { sx: { py: 2, px: 2 } }, /* @__PURE__ */ React35.createElement(import_ui24.Typography, { variant: "body2", color: "text.secondary" }, (0, import_i18n26.__)("No results found", "elementor"))),
2508
- /* @__PURE__ */ React35.createElement(import_ui24.Box, { ref: listTopRef }),
2641
+ showNoResults && /* @__PURE__ */ React36.createElement(import_ui24.Box, { sx: { py: 2, px: 2 } }, /* @__PURE__ */ React36.createElement(import_ui24.Typography, { variant: "body2", color: "text.secondary" }, (0, import_i18n26.__)("No results found", "elementor"))),
2642
+ /* @__PURE__ */ React36.createElement(import_ui24.Box, { ref: listTopRef }),
2509
2643
  displayedPosts.map((post) => {
2510
- return /* @__PURE__ */ React35.createElement(PostListItem, { key: post.id, post });
2644
+ return /* @__PURE__ */ React36.createElement(PostListItem, { key: post.id, post });
2511
2645
  }),
2512
- !isTrashFilter && ["duplicate", "create"].includes(editMode.mode) && /* @__PURE__ */ React35.createElement(PostListItem, null),
2513
- /* @__PURE__ */ React35.createElement(
2646
+ !isTrashFilter && ["duplicate", "create"].includes(editMode.mode) && /* @__PURE__ */ React36.createElement(PostListItem, null),
2647
+ /* @__PURE__ */ React36.createElement(
2514
2648
  PostListPaginationActions,
2515
2649
  {
2516
2650
  canLoadMore: pagination.canLoadMore,
@@ -2523,13 +2657,17 @@ function PostsCollapsibleList({ isOpenByDefault = false }) {
2523
2657
  )
2524
2658
  );
2525
2659
  }
2660
+ function PostsCollapsibleList(props) {
2661
+ const { type } = usePostListContext();
2662
+ return /* @__PURE__ */ React36.createElement(SiteContentSectionToolbarProvider, { statusFilterCountSlugs: [type] }, /* @__PURE__ */ React36.createElement(PostsCollapsibleListContent, { ...props }));
2663
+ }
2526
2664
 
2527
2665
  // src/components/panel/user-load-error.tsx
2528
- var React36 = __toESM(require("react"));
2666
+ var React37 = __toESM(require("react"));
2529
2667
  var import_ui25 = require("@elementor/ui");
2530
2668
  var import_i18n27 = require("@wordpress/i18n");
2531
2669
  function UserLoadError() {
2532
- return /* @__PURE__ */ React36.createElement(import_ui25.Box, { sx: { px: 2, py: 2 } }, /* @__PURE__ */ React36.createElement(import_ui25.Typography, { variant: "body2", color: "text.secondary" }, (0, import_i18n27.__)(
2670
+ return /* @__PURE__ */ React37.createElement(import_ui25.Box, { sx: { px: 2, py: 2 } }, /* @__PURE__ */ React37.createElement(import_ui25.Typography, { variant: "body2", color: "text.secondary" }, (0, import_i18n27.__)(
2533
2671
  "We couldn\u2019t load your content permissions. Try closing and reopening this panel.",
2534
2672
  "elementor"
2535
2673
  )));
@@ -2543,21 +2681,21 @@ function ShellPanelBodyContent({
2543
2681
  showUserLoadError
2544
2682
  }) {
2545
2683
  if (isUserPending) {
2546
- return /* @__PURE__ */ React37.createElement(import_ui26.Stack, { spacing: 1, sx: { px: 2, py: 1 } }, /* @__PURE__ */ React37.createElement(import_ui26.Skeleton, { animation: "wave", height: 28, variant: "rounded", width: "100%" }), /* @__PURE__ */ React37.createElement(import_ui26.Skeleton, { animation: "wave", height: 28, variant: "rounded", width: "80%" }));
2684
+ return /* @__PURE__ */ React38.createElement(import_ui26.Stack, { spacing: 1, sx: { px: 2, py: 1 } }, /* @__PURE__ */ React38.createElement(import_ui26.Skeleton, { animation: "wave", height: 28, variant: "rounded", width: "100%" }), /* @__PURE__ */ React38.createElement(import_ui26.Skeleton, { animation: "wave", height: 28, variant: "rounded", width: "80%" }));
2547
2685
  }
2548
2686
  if (showUserLoadError) {
2549
- return /* @__PURE__ */ React37.createElement(UserLoadError, null);
2687
+ return /* @__PURE__ */ React38.createElement(UserLoadError, null);
2550
2688
  }
2551
2689
  const extraSections = getSiteContentSections();
2552
- return /* @__PURE__ */ React37.createElement(import_ui26.List, { 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())));
2690
+ return /* @__PURE__ */ React38.createElement(import_ui26.List, { 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())));
2553
2691
  }
2554
2692
 
2555
2693
  // src/components/panel/shell.tsx
2556
2694
  var Shell = () => {
2557
2695
  const sidebarPanelChrome = (0, import_editor_sidebar.isSidebarEnabled)();
2558
- const [isErrorSnackbarOpen, setIsErrorSnackbarOpen] = (0, import_react14.useState)(false);
2696
+ const [isErrorSnackbarOpen, setIsErrorSnackbarOpen] = (0, import_react16.useState)(false);
2559
2697
  const { accessiblePostTypes, isUserPending, showUserLoadError } = useAccessiblePanelPostTypes();
2560
- return /* @__PURE__ */ React38.createElement(ContentPanelCoordinatorProvider, null, /* @__PURE__ */ React38.createElement(import_editor_panels.Panel, null, /* @__PURE__ */ React38.createElement(import_editor_panels.PanelHeader, null, /* @__PURE__ */ React38.createElement(
2698
+ return /* @__PURE__ */ React39.createElement(ContentPanelCoordinatorProvider, null, /* @__PURE__ */ React39.createElement(import_editor_panels.Panel, null, /* @__PURE__ */ React39.createElement(import_editor_panels.PanelHeader, null, /* @__PURE__ */ React39.createElement(
2561
2699
  import_ui27.Stack,
2562
2700
  {
2563
2701
  alignItems: "center",
@@ -2568,9 +2706,9 @@ var Shell = () => {
2568
2706
  ...sidebarPanelChrome ? {} : { p: 1, pl: 2 }
2569
2707
  }
2570
2708
  },
2571
- /* @__PURE__ */ React38.createElement(import_editor_panels.PanelHeaderTitle, { sx: { flex: 1, minWidth: 0, textAlign: "start" } }, (0, import_i18n28.__)("Site content", "elementor")),
2572
- /* @__PURE__ */ React38.createElement(ContentPanelHeaderAdd, null)
2573
- )), /* @__PURE__ */ React38.createElement(import_ui27.Divider, null), /* @__PURE__ */ React38.createElement(import_editor_panels.PanelBody, null, /* @__PURE__ */ React38.createElement(ContentPanelToolbar, null), /* @__PURE__ */ React38.createElement(import_ui27.Divider, null), /* @__PURE__ */ React38.createElement(
2709
+ /* @__PURE__ */ React39.createElement(import_editor_panels.PanelHeaderTitle, { sx: { flex: 1, minWidth: 0, textAlign: "start" } }, (0, import_i18n28.__)("Site content", "elementor")),
2710
+ /* @__PURE__ */ React39.createElement(ContentPanelHeaderAdd, null)
2711
+ )), /* @__PURE__ */ React39.createElement(import_ui27.Divider, null), /* @__PURE__ */ React39.createElement(import_editor_panels.PanelBody, null, /* @__PURE__ */ React39.createElement(
2574
2712
  ShellPanelBodyContent,
2575
2713
  {
2576
2714
  accessiblePostTypes,
@@ -2578,7 +2716,7 @@ var Shell = () => {
2578
2716
  onListError: () => setIsErrorSnackbarOpen(true),
2579
2717
  showUserLoadError
2580
2718
  }
2581
- ), /* @__PURE__ */ React38.createElement(error_snackbar_default, { open: isErrorSnackbarOpen, onClose: () => setIsErrorSnackbarOpen(false) }))));
2719
+ ), /* @__PURE__ */ React39.createElement(error_snackbar_default, { open: isErrorSnackbarOpen, onClose: () => setIsErrorSnackbarOpen(false) }))));
2582
2720
  };
2583
2721
  var shell_default = Shell;
2584
2722
 
@@ -2589,14 +2727,14 @@ var { panel, usePanelStatus, usePanelActions } = (0, import_editor_panels2.creat
2589
2727
  });
2590
2728
 
2591
2729
  // src/components/top-bar/recently-edited.tsx
2592
- var React43 = __toESM(require("react"));
2730
+ var React44 = __toESM(require("react"));
2593
2731
  var import_editor_documents8 = require("@elementor/editor-documents");
2594
2732
  var import_icons23 = require("@elementor/icons");
2595
2733
  var import_ui32 = require("@elementor/ui");
2596
2734
  var import_i18n30 = require("@wordpress/i18n");
2597
2735
 
2598
2736
  // src/components/top-bar/create-post-list-item.tsx
2599
- var React39 = __toESM(require("react"));
2737
+ var React40 = __toESM(require("react"));
2600
2738
  var import_editor_documents6 = require("@elementor/editor-documents");
2601
2739
  var import_events = require("@elementor/events");
2602
2740
  var import_icons21 = require("@elementor/icons");
@@ -2604,11 +2742,11 @@ var import_ui28 = require("@elementor/ui");
2604
2742
  var import_i18n29 = require("@wordpress/i18n");
2605
2743
 
2606
2744
  // src/hooks/use-create-page.ts
2607
- var import_react15 = require("react");
2745
+ var import_react17 = require("react");
2608
2746
  var import_api_fetch5 = __toESM(require("@wordpress/api-fetch"));
2609
2747
  var endpointPath = "/elementor/v1/site-navigation/add-new-post";
2610
2748
  function useCreatePage() {
2611
- const [isLoading, setIsLoading] = (0, import_react15.useState)(false);
2749
+ const [isLoading, setIsLoading] = (0, import_react17.useState)(false);
2612
2750
  return {
2613
2751
  create: () => {
2614
2752
  setIsLoading(true);
@@ -2631,7 +2769,7 @@ function CreatePostListItem({ closePopup, ...props }) {
2631
2769
  const navigateToDocument = (0, import_editor_documents6.__useNavigateToDocument)();
2632
2770
  const { data: user } = useUser();
2633
2771
  const { dispatchEvent, config } = (0, import_events.useMixpanel)();
2634
- return /* @__PURE__ */ React39.createElement(
2772
+ return /* @__PURE__ */ React40.createElement(
2635
2773
  import_ui28.MenuItem,
2636
2774
  {
2637
2775
  disabled: isLoading || !user?.capabilities?.edit_pages,
@@ -2655,8 +2793,8 @@ function CreatePostListItem({ closePopup, ...props }) {
2655
2793
  },
2656
2794
  ...props
2657
2795
  },
2658
- /* @__PURE__ */ React39.createElement(import_ui28.ListItemIcon, null, isLoading ? /* @__PURE__ */ React39.createElement(import_ui28.CircularProgress, { size: "1.25rem" }) : /* @__PURE__ */ React39.createElement(import_icons21.PlusIcon, { fontSize: "small" })),
2659
- /* @__PURE__ */ React39.createElement(
2796
+ /* @__PURE__ */ React40.createElement(import_ui28.ListItemIcon, null, isLoading ? /* @__PURE__ */ React40.createElement(import_ui28.CircularProgress, { size: "1.25rem" }) : /* @__PURE__ */ React40.createElement(import_icons21.PlusIcon, { fontSize: "small" })),
2797
+ /* @__PURE__ */ React40.createElement(
2660
2798
  import_ui28.ListItemText,
2661
2799
  {
2662
2800
  primaryTypographyProps: { variant: "body2" },
@@ -2667,13 +2805,13 @@ function CreatePostListItem({ closePopup, ...props }) {
2667
2805
  }
2668
2806
 
2669
2807
  // src/components/top-bar/indicator.tsx
2670
- var React40 = __toESM(require("react"));
2808
+ var React41 = __toESM(require("react"));
2671
2809
  var import_ui29 = require("@elementor/ui");
2672
2810
  function Indicator({ title, status }) {
2673
- return /* @__PURE__ */ React40.createElement(Tooltip5, { title }, /* @__PURE__ */ React40.createElement(import_ui29.Stack, { component: "span", direction: "row", alignItems: "center", spacing: 0.5 }, /* @__PURE__ */ React40.createElement(import_ui29.Typography, { component: "span", variant: "body2", sx: { maxWidth: "120px" }, noWrap: true }, title), status.value !== "publish" && /* @__PURE__ */ React40.createElement(import_ui29.Typography, { component: "span", variant: "body2", sx: { fontStyle: "italic" } }, "(", status.label, ")")));
2811
+ return /* @__PURE__ */ React41.createElement(Tooltip5, { title }, /* @__PURE__ */ React41.createElement(import_ui29.Stack, { component: "span", direction: "row", alignItems: "center", spacing: 0.5 }, /* @__PURE__ */ React41.createElement(import_ui29.Typography, { component: "span", variant: "body2", sx: { maxWidth: "120px" }, noWrap: true }, title), status.value !== "publish" && /* @__PURE__ */ React41.createElement(import_ui29.Typography, { component: "span", variant: "body2", sx: { fontStyle: "italic" } }, "(", status.label, ")")));
2674
2812
  }
2675
2813
  function Tooltip5(props) {
2676
- return /* @__PURE__ */ React40.createElement(
2814
+ return /* @__PURE__ */ React41.createElement(
2677
2815
  import_ui29.Tooltip,
2678
2816
  {
2679
2817
  PopperProps: {
@@ -2689,20 +2827,20 @@ function Tooltip5(props) {
2689
2827
  }
2690
2828
 
2691
2829
  // src/components/top-bar/post-list-item.tsx
2692
- var React42 = __toESM(require("react"));
2830
+ var React43 = __toESM(require("react"));
2693
2831
  var import_editor_documents7 = require("@elementor/editor-documents");
2694
2832
  var import_events2 = require("@elementor/events");
2695
2833
  var import_ui31 = require("@elementor/ui");
2696
2834
 
2697
2835
  // src/components/top-bar/chip-doc-type.tsx
2698
- var React41 = __toESM(require("react"));
2836
+ var React42 = __toESM(require("react"));
2699
2837
  var import_icons22 = require("@elementor/icons");
2700
2838
  var import_ui30 = require("@elementor/ui");
2701
2839
  var iconsMap2 = getIconsMap();
2702
2840
  function DocTypeChip({ postType, docType, label }) {
2703
2841
  const color = "elementor_library" === postType ? "global" : "accent";
2704
2842
  const Icon = iconsMap2[docType] || import_icons22.PostTypeIcon;
2705
- return /* @__PURE__ */ React41.createElement(
2843
+ return /* @__PURE__ */ React42.createElement(
2706
2844
  import_ui30.Chip,
2707
2845
  {
2708
2846
  component: "span",
@@ -2711,7 +2849,7 @@ function DocTypeChip({ postType, docType, label }) {
2711
2849
  label,
2712
2850
  "data-value": docType,
2713
2851
  color,
2714
- icon: /* @__PURE__ */ React41.createElement(Icon, null),
2852
+ icon: /* @__PURE__ */ React42.createElement(Icon, null),
2715
2853
  sx: { ml: 1, cursor: "inherit" }
2716
2854
  }
2717
2855
  );
@@ -2722,7 +2860,7 @@ function PostListItem2({ post, closePopup, ...props }) {
2722
2860
  const navigateToDocument = (0, import_editor_documents7.__useNavigateToDocument)();
2723
2861
  const postTitle = useReverseHtmlEntities(post.title);
2724
2862
  const { dispatchEvent, config } = (0, import_events2.useMixpanel)();
2725
- return /* @__PURE__ */ React42.createElement(
2863
+ return /* @__PURE__ */ React43.createElement(
2726
2864
  import_ui31.MenuItem,
2727
2865
  {
2728
2866
  disabled: !post.user_can.edit,
@@ -2745,7 +2883,7 @@ function PostListItem2({ post, closePopup, ...props }) {
2745
2883
  },
2746
2884
  ...props
2747
2885
  },
2748
- /* @__PURE__ */ React42.createElement(
2886
+ /* @__PURE__ */ React43.createElement(
2749
2887
  import_ui31.ListItemText,
2750
2888
  {
2751
2889
  sx: { flexGrow: 0 },
@@ -2753,7 +2891,7 @@ function PostListItem2({ post, closePopup, ...props }) {
2753
2891
  primary: postTitle
2754
2892
  }
2755
2893
  ),
2756
- /* @__PURE__ */ React42.createElement(DocTypeChip, { postType: post.type.post_type, docType: post.type.doc_type, label: post.type.label })
2894
+ /* @__PURE__ */ React43.createElement(DocTypeChip, { postType: post.type.post_type, docType: post.type.doc_type, label: post.type.label })
2757
2895
  );
2758
2896
  }
2759
2897
 
@@ -2779,12 +2917,12 @@ function RecentlyEdited() {
2779
2917
  return null;
2780
2918
  }
2781
2919
  const buttonProps = (0, import_ui32.bindTrigger)(popupState);
2782
- return /* @__PURE__ */ React43.createElement(React43.Fragment, null, /* @__PURE__ */ React43.createElement(
2920
+ return /* @__PURE__ */ React44.createElement(React44.Fragment, null, /* @__PURE__ */ React44.createElement(
2783
2921
  import_ui32.Button,
2784
2922
  {
2785
2923
  color: "inherit",
2786
2924
  size: "small",
2787
- endIcon: /* @__PURE__ */ React43.createElement(import_icons23.ChevronDownIcon, { fontSize: "small" }),
2925
+ endIcon: /* @__PURE__ */ React44.createElement(import_icons23.ChevronDownIcon, { fontSize: "small" }),
2788
2926
  ...buttonProps,
2789
2927
  onClick: (e) => {
2790
2928
  const extendedWindow = window;
@@ -2803,18 +2941,18 @@ function RecentlyEdited() {
2803
2941
  buttonProps.onClick(e);
2804
2942
  }
2805
2943
  },
2806
- /* @__PURE__ */ React43.createElement(Indicator, { title: documentTitle, status: document2.status })
2807
- ), /* @__PURE__ */ React43.createElement(
2944
+ /* @__PURE__ */ React44.createElement(Indicator, { title: documentTitle, status: document2.status })
2945
+ ), /* @__PURE__ */ React44.createElement(
2808
2946
  import_ui32.Menu,
2809
2947
  {
2810
2948
  MenuListProps: {
2811
- subheader: /* @__PURE__ */ React43.createElement(import_ui32.ListSubheader, { sx: { color: "accent.main", fontStyle: "italic", fontWeight: "300" } }, (0, import_i18n30.__)("Recent", "elementor"))
2949
+ subheader: /* @__PURE__ */ React44.createElement(import_ui32.ListSubheader, { sx: { color: "accent.main", fontStyle: "italic", fontWeight: "300" } }, (0, import_i18n30.__)("Recent", "elementor"))
2812
2950
  },
2813
2951
  PaperProps: { sx: { mt: 2.5, width: 320 } },
2814
2952
  ...(0, import_ui32.bindMenu)(popupState)
2815
2953
  },
2816
- recentPosts.map((post) => /* @__PURE__ */ React43.createElement(PostListItem2, { key: post.id, post, closePopup: popupState.close })),
2817
- recentPosts.length === 0 && /* @__PURE__ */ React43.createElement(import_ui32.MenuItem, { disabled: true }, /* @__PURE__ */ React43.createElement(
2954
+ recentPosts.map((post) => /* @__PURE__ */ React44.createElement(PostListItem2, { key: post.id, post, closePopup: popupState.close })),
2955
+ recentPosts.length === 0 && /* @__PURE__ */ React44.createElement(import_ui32.MenuItem, { disabled: true }, /* @__PURE__ */ React44.createElement(
2818
2956
  import_ui32.ListItemText,
2819
2957
  {
2820
2958
  primaryTypographyProps: {
@@ -2824,8 +2962,8 @@ function RecentlyEdited() {
2824
2962
  primary: (0, import_i18n30.__)("There are no other pages or templates on this site yet.", "elementor")
2825
2963
  }
2826
2964
  )),
2827
- /* @__PURE__ */ React43.createElement(import_ui32.Divider, { disabled: recentPosts.length === 0 }),
2828
- /* @__PURE__ */ React43.createElement(CreatePostListItem, { closePopup: popupState.close })
2965
+ /* @__PURE__ */ React44.createElement(import_ui32.Divider, { disabled: recentPosts.length === 0 }),
2966
+ /* @__PURE__ */ React44.createElement(CreatePostListItem, { closePopup: popupState.close })
2829
2967
  ));
2830
2968
  }
2831
2969
 
@@ -2880,25 +3018,25 @@ function registerButton() {
2880
3018
  }
2881
3019
 
2882
3020
  // src/components/panel/popups/popup-section-add-button.tsx
2883
- var React44 = __toESM(require("react"));
2884
- var import_react16 = require("react");
3021
+ var React45 = __toESM(require("react"));
3022
+ var import_react18 = require("react");
2885
3023
  var import_ui33 = require("@elementor/ui");
2886
3024
  var import_i18n32 = require("@wordpress/i18n");
2887
- var PopupSectionAddButton = (0, import_react16.forwardRef)(
3025
+ var PopupSectionAddButton = (0, import_react18.forwardRef)(
2888
3026
  ({ disabled, onBeforeCreate, onCreate }, ref) => {
2889
- const promotionRef = (0, import_react16.useRef)(null);
3027
+ const promotionRef = (0, import_react18.useRef)(null);
2890
3028
  const canCreate = env.popups?.can_use ?? false;
2891
- const togglePromotion = (0, import_react16.useCallback)(() => {
3029
+ const togglePromotion = (0, import_react18.useCallback)(() => {
2892
3030
  promotionRef.current?.toggle();
2893
3031
  }, []);
2894
- (0, import_react16.useImperativeHandle)(ref, () => ({ togglePromotion }), [togglePromotion]);
3032
+ (0, import_react18.useImperativeHandle)(ref, () => ({ togglePromotion }), [togglePromotion]);
2895
3033
  const ariaLabel = (0, import_i18n32.sprintf)(
2896
3034
  /* translators: %s: Document type singular name. */
2897
3035
  (0, import_i18n32.__)("New %s", "elementor"),
2898
3036
  (0, import_i18n32.__)("Popup", "elementor")
2899
3037
  );
2900
3038
  if (canCreate) {
2901
- return /* @__PURE__ */ React44.createElement(
3039
+ return /* @__PURE__ */ React45.createElement(
2902
3040
  ContentPanelAddIconButton,
2903
3041
  {
2904
3042
  "aria-label": ariaLabel,
@@ -2911,7 +3049,7 @@ var PopupSectionAddButton = (0, import_react16.forwardRef)(
2911
3049
  }
2912
3050
  );
2913
3051
  }
2914
- return /* @__PURE__ */ React44.createElement(
3052
+ return /* @__PURE__ */ React45.createElement(
2915
3053
  import_ui33.Stack,
2916
3054
  {
2917
3055
  alignItems: "center",
@@ -2923,8 +3061,8 @@ var PopupSectionAddButton = (0, import_react16.forwardRef)(
2923
3061
  },
2924
3062
  sx: { cursor: "pointer" }
2925
3063
  },
2926
- /* @__PURE__ */ React44.createElement(ContentPanelAddIconButton, { "aria-label": ariaLabel, tabIndex: -1 }),
2927
- /* @__PURE__ */ React44.createElement(SiteContentPopupsPromotionChip, { ref: promotionRef })
3064
+ /* @__PURE__ */ React45.createElement(ContentPanelAddIconButton, { "aria-label": ariaLabel, tabIndex: -1 }),
3065
+ /* @__PURE__ */ React45.createElement(SiteContentPopupsPromotionChip, { ref: promotionRef })
2928
3066
  );
2929
3067
  }
2930
3068
  );
@@ -2932,27 +3070,42 @@ var PopupSectionAddButton = (0, import_react16.forwardRef)(
2932
3070
  0 && (module.exports = {
2933
3071
  ContentPanelAddIconButton,
2934
3072
  ContentPanelCoordinatorProvider,
3073
+ DEFAULT_SITE_CONTENT_SORT,
3074
+ EMPTY_SITE_CONTENT_STATUS_FILTERS,
2935
3075
  POPUPS_SITE_CONTENT_SECTION_ID,
2936
3076
  POST_PER_PAGE,
2937
3077
  PopupSectionAddButton,
3078
+ SITE_CONTENT_SELECTABLE_STATUS_FILTERS,
2938
3079
  SiteContentCollapsibleList,
2939
3080
  SiteContentEditModeTemplate,
2940
3081
  SiteContentListErrorState,
2941
3082
  SiteContentListItemActionsSlot,
2942
3083
  SiteContentPageTitleAndStatus,
2943
3084
  SiteContentPaginationActions,
3085
+ SiteContentSectionToolbar,
3086
+ SiteContentSectionToolbarProvider,
2944
3087
  contentPanelListItemButtonSx,
2945
3088
  contentPanelListRowPaddingSx,
2946
3089
  env,
2947
3090
  extendIconsMap,
3091
+ getContentPanelListItemRowStateSx,
3092
+ getContentPanelListItemSx,
3093
+ getRestOrderForSiteContentSort,
3094
+ getRestStatusForSiteContentFilters,
2948
3095
  getSiteContentHeaderCreateItems,
2949
3096
  getSiteContentSections,
3097
+ getSiteContentStatusFilterForCount,
3098
+ hasActiveSiteContentStatusFilters,
2950
3099
  init,
2951
3100
  injectIntoSiteContentListItemActions,
3101
+ isSiteContentListNarrowed,
3102
+ isSiteContentTrashFilterActive,
2952
3103
  registerSiteContentHeaderCreateItem,
2953
3104
  registerSiteContentSection,
2954
3105
  resetSiteContentHeaderCreateItems,
2955
3106
  resetSiteContentSections,
3107
+ serializeSiteContentStatusFilters,
2956
3108
  useContentPanelCoordinator,
2957
- usePostListPagination
3109
+ usePostListPagination,
3110
+ useSiteContentSectionToolbar
2958
3111
  });