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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -30,11 +30,57 @@ import { isSidebarEnabled, sidebarTools } from "@elementor/editor-sidebar";
30
30
  import { createPanel } from "@elementor/editor-panels";
31
31
 
32
32
  // src/components/panel/shell.tsx
33
- import * as React24 from "react";
33
+ import * as React26 from "react";
34
34
  import { useState as useState6 } from "react";
35
35
  import { Panel, PanelBody, PanelHeader, PanelHeaderTitle } from "@elementor/editor-panels";
36
- import { Divider as Divider4, List as List2, Stack as Stack2 } from "@elementor/ui";
37
- import { __ as __16 } from "@wordpress/i18n";
36
+ import { Divider as Divider4, Stack as Stack3 } from "@elementor/ui";
37
+ import { __ as __18 } from "@wordpress/i18n";
38
+
39
+ // src/contexts/content-panel-coordinator.tsx
40
+ import * as React from "react";
41
+ import { createContext, useCallback, useContext, useMemo, useRef, useState } from "react";
42
+ var ContentPanelCoordinatorContext = createContext(null);
43
+ function ContentPanelCoordinatorProvider({ children }) {
44
+ const sectionsRef = useRef(/* @__PURE__ */ new Map());
45
+ const [searchQuery, setSearchQuery] = useState("");
46
+ const registerSection = useCallback((type, handlers) => {
47
+ sectionsRef.current.set(type, handlers);
48
+ }, []);
49
+ const unregisterSection = useCallback((type) => {
50
+ sectionsRef.current.delete(type);
51
+ }, []);
52
+ const requestCreate = useCallback((type) => {
53
+ const handlers = sectionsRef.current.get(type);
54
+ if (!handlers) {
55
+ return;
56
+ }
57
+ handlers.setExpanded(true);
58
+ handlers.startCreate();
59
+ }, []);
60
+ const value = useMemo(
61
+ () => ({
62
+ registerSection,
63
+ unregisterSection,
64
+ requestCreate,
65
+ searchQuery,
66
+ setSearchQuery
67
+ }),
68
+ [registerSection, unregisterSection, requestCreate, searchQuery]
69
+ );
70
+ return /* @__PURE__ */ React.createElement(ContentPanelCoordinatorContext.Provider, { value }, children);
71
+ }
72
+ function useContentPanelCoordinator() {
73
+ const context = useContext(ContentPanelCoordinatorContext);
74
+ if (!context) {
75
+ throw new Error(
76
+ "The `useContentPanelCoordinator()` hook must be used within a `<ContentPanelCoordinatorProvider />`"
77
+ );
78
+ }
79
+ return context;
80
+ }
81
+
82
+ // src/hooks/use-accessible-panel-post-types.ts
83
+ import { useMemo as useMemo2 } from "react";
38
84
 
39
85
  // src/api/post.ts
40
86
  import apiFetch from "@wordpress/api-fetch";
@@ -61,6 +107,15 @@ var panelPostTypeSlugs = Object.keys(postTypesMap);
61
107
  function getPostTypeCreateCapability(postTypeSlug) {
62
108
  return postTypesMap[postTypeSlug].createCapability;
63
109
  }
110
+ function getAccessiblePanelPostTypes(capabilities) {
111
+ return panelPostTypeSlugs.filter((slug) => capabilities[getPostTypeCreateCapability(slug)]);
112
+ }
113
+ function getCannotEditPanelItemMessage(postTypeSlug) {
114
+ if ("page" === postTypeSlug) {
115
+ return __("You cannot edit this page.", "elementor");
116
+ }
117
+ return __("You cannot edit this post.", "elementor");
118
+ }
64
119
  var POST_PER_PAGE = 10;
65
120
  var getRequest = async (postTypeSlug, page, search = "") => {
66
121
  const baseUri = `/wp/v2/${postTypesMap[postTypeSlug].rest_base}`;
@@ -124,89 +179,56 @@ var duplicateRequest = (originalPost) => {
124
179
  });
125
180
  };
126
181
 
127
- // src/contexts/content-panel-coordinator.tsx
128
- import * as React from "react";
129
- import { createContext, useCallback, useContext, useMemo, useRef, useState } from "react";
130
- var ContentPanelCoordinatorContext = createContext(null);
131
- function ContentPanelCoordinatorProvider({ children }) {
132
- const sectionsRef = useRef(/* @__PURE__ */ new Map());
133
- const [searchQuery, setSearchQuery] = useState("");
134
- const registerSection = useCallback((type, handlers) => {
135
- sectionsRef.current.set(type, handlers);
136
- }, []);
137
- const unregisterSection = useCallback((type) => {
138
- sectionsRef.current.delete(type);
139
- }, []);
140
- const requestCreate = useCallback((type) => {
141
- const handlers = sectionsRef.current.get(type);
142
- if (!handlers) {
143
- return;
144
- }
145
- handlers.setExpanded(true);
146
- handlers.startCreate();
147
- }, []);
148
- const value = useMemo(
149
- () => ({
150
- registerSection,
151
- unregisterSection,
152
- requestCreate,
153
- searchQuery,
154
- setSearchQuery
155
- }),
156
- [registerSection, unregisterSection, requestCreate, searchQuery]
157
- );
158
- return /* @__PURE__ */ React.createElement(ContentPanelCoordinatorContext.Provider, { value }, children);
159
- }
160
- function useContentPanelCoordinator() {
161
- const context = useContext(ContentPanelCoordinatorContext);
162
- if (!context) {
163
- throw new Error(
164
- "The `useContentPanelCoordinator()` hook must be used within a `<ContentPanelCoordinatorProvider />`"
165
- );
166
- }
167
- return context;
168
- }
182
+ // src/env.ts
183
+ import { parseEnv } from "@elementor/env";
184
+ var { env } = parseEnv("@elementor/editor-site-navigation", (envData) => {
185
+ return envData;
186
+ });
169
187
 
170
- // src/contexts/post-list-context.tsx
171
- import * as React2 from "react";
172
- import { createContext as createContext2, useContext as useContext2, useState as useState2 } from "react";
173
- var defaultValues = {
174
- type: "page",
175
- editMode: { mode: "none", details: {} },
176
- setEditMode: () => null,
177
- resetEditMode: () => null,
178
- setError: () => null
188
+ // src/hooks/use-user.ts
189
+ import { useQuery } from "@elementor/query";
190
+
191
+ // src/api/user.ts
192
+ import apiFetch2 from "@wordpress/api-fetch";
193
+ var getUser = () => {
194
+ const baseUri = "/wp/v2/users/me";
195
+ const keys = ["capabilities"];
196
+ const queryParams = new URLSearchParams({
197
+ _fields: keys.join(","),
198
+ context: "edit"
199
+ });
200
+ const uri = baseUri + "?" + queryParams.toString();
201
+ return apiFetch2({ path: uri });
179
202
  };
180
- var PostListContext = createContext2(defaultValues);
181
- var PostListContextProvider = ({
182
- type,
183
- setError,
184
- children
185
- }) => {
186
- const [editMode, setEditMode] = useState2(defaultValues.editMode);
187
- const resetEditMode = () => {
188
- setEditMode(defaultValues.editMode);
203
+
204
+ // src/hooks/use-user.ts
205
+ var userQueryKey = () => ["site-navigation", "user"];
206
+ function useUser() {
207
+ return useQuery({
208
+ queryKey: userQueryKey(),
209
+ queryFn: getUser,
210
+ staleTime: 30 * 60 * 1e3
211
+ });
212
+ }
213
+
214
+ // src/hooks/use-accessible-panel-post-types.ts
215
+ function useAccessiblePanelPostTypes() {
216
+ const { data: user, isPending: isUserPending, isError: isUserError } = useUser();
217
+ const accessiblePostTypes = useMemo2(() => {
218
+ if (user?.capabilities) {
219
+ return getAccessiblePanelPostTypes(user.capabilities);
220
+ }
221
+ if (isUserError && env.can_access_site_content_panel) {
222
+ return panelPostTypeSlugs;
223
+ }
224
+ return [];
225
+ }, [user, isUserError]);
226
+ const showUserLoadError = isUserError && accessiblePostTypes.length === 0;
227
+ return {
228
+ accessiblePostTypes,
229
+ isUserPending,
230
+ showUserLoadError
189
231
  };
190
- return /* @__PURE__ */ React2.createElement(
191
- PostListContext.Provider,
192
- {
193
- value: {
194
- type,
195
- editMode,
196
- setEditMode,
197
- resetEditMode,
198
- setError
199
- }
200
- },
201
- children
202
- );
203
- };
204
- function usePostListContext() {
205
- const context = useContext2(PostListContext);
206
- if (!context) {
207
- throw new Error("The `usePostListContext()` hook must be used within an `<PostListContextProvider />`");
208
- }
209
- return context;
210
232
  }
211
233
 
212
234
  // src/components/panel/content-panel-chrome.ts
@@ -262,44 +284,25 @@ var contentPanelListItemButtonSx = {
262
284
  };
263
285
 
264
286
  // src/components/panel/content-panel-header-add.tsx
265
- import * as React4 from "react";
287
+ import * as React3 from "react";
266
288
  import { PageTypeIcon as PageTypeIcon2, PostTypeIcon as PostTypeIcon2 } from "@elementor/icons";
267
289
  import { bindMenu, bindTrigger, ListItemIcon, ListItemText, Menu, MenuItem, usePopupState } from "@elementor/ui";
268
290
  import { __ as __2 } from "@wordpress/i18n";
269
291
 
270
- // src/hooks/use-user.ts
271
- import { useQuery } from "@elementor/query";
272
-
273
- // src/api/user.ts
274
- import apiFetch2 from "@wordpress/api-fetch";
275
- var getUser = () => {
276
- const baseUri = "/wp/v2/users/me";
277
- const keys = ["capabilities"];
278
- const queryParams = new URLSearchParams({
279
- _fields: keys.join(","),
280
- context: "edit"
281
- });
282
- const uri = baseUri + "?" + queryParams.toString();
283
- return apiFetch2({ path: uri });
284
- };
285
-
286
- // src/hooks/use-user.ts
287
- var userQueryKey = () => ["site-navigation", "user"];
288
- function useUser() {
289
- return useQuery({
290
- queryKey: userQueryKey(),
291
- queryFn: getUser,
292
- staleTime: 30 * 60 * 1e3
293
- });
292
+ // src/hooks/use-can-create.ts
293
+ function useCanCreate(postTypeSlug) {
294
+ const { data: user } = useUser();
295
+ const capability = getPostTypeCreateCapability(postTypeSlug);
296
+ return !!user?.capabilities?.[capability];
294
297
  }
295
298
 
296
299
  // src/components/panel/content-panel-add-icon-button.tsx
297
- import * as React3 from "react";
300
+ import * as React2 from "react";
298
301
  import { PlusIcon } from "@elementor/icons";
299
302
  import { IconButton } from "@elementor/ui";
300
303
  var CONTENT_PANEL_ADD_ICON_SIZE = "tiny";
301
304
  function ContentPanelAddIconButton(props) {
302
- return /* @__PURE__ */ React3.createElement(IconButton, { size: CONTENT_PANEL_ADD_ICON_SIZE, variant: "outlined", ...props }, /* @__PURE__ */ React3.createElement(PlusIcon, { fontSize: CONTENT_PANEL_ADD_ICON_SIZE }));
305
+ return /* @__PURE__ */ React2.createElement(IconButton, { size: CONTENT_PANEL_ADD_ICON_SIZE, variant: "outlined", ...props }, /* @__PURE__ */ React2.createElement(PlusIcon, { fontSize: CONTENT_PANEL_ADD_ICON_SIZE }));
303
306
  }
304
307
 
305
308
  // src/components/panel/content-panel-header-add.tsx
@@ -307,45 +310,46 @@ var typeIcons = {
307
310
  page: PageTypeIcon2,
308
311
  post: PostTypeIcon2
309
312
  };
313
+ function HeaderAddMenuItem({ slug, onSelect }) {
314
+ const canCreate = useCanCreate(slug);
315
+ const Icon = typeIcons[slug];
316
+ const singularName = postTypesMap[slug].labels.singular_name;
317
+ return /* @__PURE__ */ React3.createElement(MenuItem, { disabled: !canCreate, onClick: () => onSelect(slug) }, /* @__PURE__ */ React3.createElement(ListItemIcon, null, /* @__PURE__ */ React3.createElement(Icon, { fontSize: "small" })), /* @__PURE__ */ React3.createElement(ListItemText, { primary: singularName, primaryTypographyProps: { variant: "body2" } }));
318
+ }
310
319
  function ContentPanelHeaderAdd() {
311
320
  const { requestCreate } = useContentPanelCoordinator();
312
- const { data: user } = useUser();
321
+ const { accessiblePostTypes: accessibleSlugs } = useAccessiblePanelPostTypes();
313
322
  const popupState = usePopupState({
314
323
  variant: "popover",
315
324
  popupId: "elementor-content-panel-header-add"
316
325
  });
326
+ const canAddAny = accessibleSlugs.length > 0;
317
327
  const buttonProps = bindTrigger(popupState);
318
328
  const menuProps = bindMenu(popupState);
319
- return /* @__PURE__ */ React4.createElement(React4.Fragment, null, /* @__PURE__ */ React4.createElement(ContentPanelAddIconButton, { "aria-label": __2("Add new", "elementor"), ...buttonProps }), /* @__PURE__ */ React4.createElement(Menu, { ...menuProps }, panelPostTypeSlugs.map((slug) => {
320
- const Icon = typeIcons[slug];
321
- const createCapability = getPostTypeCreateCapability(slug);
322
- const singularName = postTypesMap[slug].labels.singular_name;
323
- return /* @__PURE__ */ React4.createElement(
324
- MenuItem,
325
- {
326
- key: slug,
327
- disabled: !user?.capabilities?.[createCapability],
328
- onClick: () => {
329
- popupState.close();
330
- requestAnimationFrame(() => {
331
- requestCreate(slug);
332
- });
333
- }
334
- },
335
- /* @__PURE__ */ React4.createElement(ListItemIcon, null, /* @__PURE__ */ React4.createElement(Icon, { fontSize: "small" })),
336
- /* @__PURE__ */ React4.createElement(ListItemText, { primary: singularName, primaryTypographyProps: { variant: "body2" } })
337
- );
338
- })));
329
+ const handleSelectType = (slug) => {
330
+ popupState.close();
331
+ requestAnimationFrame(() => {
332
+ requestCreate(slug);
333
+ });
334
+ };
335
+ return /* @__PURE__ */ React3.createElement(React3.Fragment, null, /* @__PURE__ */ React3.createElement(
336
+ ContentPanelAddIconButton,
337
+ {
338
+ "aria-label": __2("Add new", "elementor"),
339
+ ...buttonProps,
340
+ disabled: !canAddAny
341
+ }
342
+ ), /* @__PURE__ */ React3.createElement(Menu, { ...menuProps }, accessibleSlugs.map((slug) => /* @__PURE__ */ React3.createElement(HeaderAddMenuItem, { key: slug, onSelect: handleSelectType, slug }))));
339
343
  }
340
344
 
341
345
  // src/components/panel/content-panel-search.tsx
342
- import * as React5 from "react";
346
+ import * as React4 from "react";
343
347
  import { SearchIcon } from "@elementor/icons";
344
348
  import { Box, InputAdornment, TextField } from "@elementor/ui";
345
349
  import { __ as __3 } from "@wordpress/i18n";
346
350
  function ContentPanelSearch() {
347
351
  const { searchQuery, setSearchQuery } = useContentPanelCoordinator();
348
- return /* @__PURE__ */ React5.createElement(Box, { component: "search", sx: contentPanelSearchBoxSx, "aria-label": __3("Search site content", "elementor") }, /* @__PURE__ */ React5.createElement(
352
+ return /* @__PURE__ */ React4.createElement(Box, { component: "search", sx: contentPanelSearchBoxSx, "aria-label": __3("Search site content", "elementor") }, /* @__PURE__ */ React4.createElement(
349
353
  TextField,
350
354
  {
351
355
  fullWidth: true,
@@ -357,17 +361,17 @@ function ContentPanelSearch() {
357
361
  "aria-label": __3("Search", "elementor")
358
362
  },
359
363
  InputProps: {
360
- startAdornment: /* @__PURE__ */ React5.createElement(InputAdornment, { position: "start" }, /* @__PURE__ */ React5.createElement(SearchIcon, { fontSize: "tiny" }))
364
+ startAdornment: /* @__PURE__ */ React4.createElement(InputAdornment, { position: "start" }, /* @__PURE__ */ React4.createElement(SearchIcon, { fontSize: "tiny" }))
361
365
  }
362
366
  }
363
367
  ));
364
368
  }
365
369
 
366
370
  // src/components/panel/error-snackbar.tsx
367
- import * as React6 from "react";
371
+ import * as React5 from "react";
368
372
  import { Alert, Snackbar, Typography } from "@elementor/ui";
369
373
  var ErrorSnackbar = ({ open, onClose }) => {
370
- return /* @__PURE__ */ React6.createElement(
374
+ return /* @__PURE__ */ React5.createElement(
371
375
  Snackbar,
372
376
  {
373
377
  open,
@@ -377,7 +381,7 @@ var ErrorSnackbar = ({ open, onClose }) => {
377
381
  horizontal: "left"
378
382
  }
379
383
  },
380
- /* @__PURE__ */ React6.createElement(Alert, { onClose, severity: "error", sx: { width: "100%" } }, /* @__PURE__ */ React6.createElement(
384
+ /* @__PURE__ */ React5.createElement(Alert, { onClose, severity: "error", sx: { width: "100%" } }, /* @__PURE__ */ React5.createElement(
381
385
  Typography,
382
386
  {
383
387
  component: "span",
@@ -391,11 +395,57 @@ var ErrorSnackbar = ({ open, onClose }) => {
391
395
  };
392
396
  var error_snackbar_default = ErrorSnackbar;
393
397
 
398
+ // src/components/panel/shell-panel-body-content.tsx
399
+ import * as React25 from "react";
400
+ import { List as List2, Skeleton as Skeleton2, Stack as Stack2 } from "@elementor/ui";
401
+
402
+ // src/contexts/post-list-context.tsx
403
+ import * as React6 from "react";
404
+ import { createContext as createContext2, useContext as useContext2, useState as useState2 } from "react";
405
+ var defaultValues = {
406
+ type: "page",
407
+ editMode: { mode: "none", details: {} },
408
+ setEditMode: () => null,
409
+ resetEditMode: () => null,
410
+ setError: () => null
411
+ };
412
+ var PostListContext = createContext2(defaultValues);
413
+ var PostListContextProvider = ({
414
+ type,
415
+ setError,
416
+ children
417
+ }) => {
418
+ const [editMode, setEditMode] = useState2(defaultValues.editMode);
419
+ const resetEditMode = () => {
420
+ setEditMode(defaultValues.editMode);
421
+ };
422
+ return /* @__PURE__ */ React6.createElement(
423
+ PostListContext.Provider,
424
+ {
425
+ value: {
426
+ type,
427
+ editMode,
428
+ setEditMode,
429
+ resetEditMode,
430
+ setError
431
+ }
432
+ },
433
+ children
434
+ );
435
+ };
436
+ function usePostListContext() {
437
+ const context = useContext2(PostListContext);
438
+ if (!context) {
439
+ throw new Error("The `usePostListContext()` hook must be used within an `<PostListContextProvider />`");
440
+ }
441
+ return context;
442
+ }
443
+
394
444
  // src/components/panel/posts-list/posts-collapsible-list.tsx
395
445
  import * as React23 from "react";
396
- import { useEffect, useMemo as useMemo3, useState as useState5 } from "react";
446
+ import { useEffect, useMemo as useMemo4, useState as useState5 } from "react";
397
447
  import { Box as Box6, Button as Button2, CircularProgress as CircularProgress4, Skeleton, Typography as Typography5 } from "@elementor/ui";
398
- import { __ as __15 } from "@wordpress/i18n";
448
+ import { __ as __16 } from "@wordpress/i18n";
399
449
 
400
450
  // src/hooks/use-homepage.ts
401
451
  import { useQuery as useQuery2 } from "@elementor/query";
@@ -463,8 +513,7 @@ import * as React7 from "react";
463
513
  import { __ as __4, sprintf } from "@wordpress/i18n";
464
514
  function SectionAddButton({ onBeforeCreate }) {
465
515
  const { type, setEditMode } = usePostListContext();
466
- const { data: user } = useUser();
467
- const createCapability = getPostTypeCreateCapability(type);
516
+ const canCreate = useCanCreate(type);
468
517
  const singularName = postTypesMap[type].labels.singular_name;
469
518
  const ariaLabel = sprintf(
470
519
  /* translators: %s: Post type singular name (e.g. Page, Post). */
@@ -475,7 +524,7 @@ function SectionAddButton({ onBeforeCreate }) {
475
524
  ContentPanelAddIconButton,
476
525
  {
477
526
  "aria-label": ariaLabel,
478
- disabled: !user?.capabilities?.[createCapability],
527
+ disabled: !canCreate,
479
528
  onClick: (event) => {
480
529
  event.stopPropagation();
481
530
  onBeforeCreate?.();
@@ -937,14 +986,15 @@ import {
937
986
  Typography as Typography4,
938
987
  usePopupState as usePopupState2
939
988
  } from "@elementor/ui";
940
- import { __ as __14 } from "@wordpress/i18n";
989
+ import { __ as __15 } from "@wordpress/i18n";
941
990
 
942
991
  // src/components/shared/page-title-and-status.tsx
943
992
  import * as React14 from "react";
944
- import { Box as Box5, Typography as Typography3 } from "@elementor/ui";
993
+ import { Box as Box5, Chip as Chip2, Typography as Typography3 } from "@elementor/ui";
994
+ import { __ as __9 } from "@wordpress/i18n";
945
995
 
946
996
  // src/hooks/use-reverse-html-entities.ts
947
- import { useMemo as useMemo2 } from "react";
997
+ import { useMemo as useMemo3 } from "react";
948
998
 
949
999
  // src/utils/post-title-plain.ts
950
1000
  function getPostTitlePlain(renderedTitle) {
@@ -958,31 +1008,71 @@ function getPostTitlePlain(renderedTitle) {
958
1008
 
959
1009
  // src/hooks/use-reverse-html-entities.ts
960
1010
  function useReverseHtmlEntities(escapedHTML = "") {
961
- return useMemo2(() => getPostTitlePlain(escapedHTML), [escapedHTML]);
1011
+ return useMemo3(() => getPostTitlePlain(escapedHTML), [escapedHTML]);
962
1012
  }
963
1013
 
964
1014
  // src/components/shared/page-title-and-status.tsx
1015
+ function humanizeStatusSlug(status) {
1016
+ return status.replace(/[-_]+/g, " ").trim();
1017
+ }
1018
+ var statusChipConfig = {
1019
+ draft: {
1020
+ color: "default",
1021
+ label: __9("Draft", "elementor")
1022
+ },
1023
+ future: {
1024
+ color: "default",
1025
+ label: __9("Scheduled", "elementor")
1026
+ },
1027
+ pending: {
1028
+ color: "warning",
1029
+ label: __9("Pending Review", "elementor")
1030
+ },
1031
+ private: {
1032
+ color: "default",
1033
+ label: __9("Private", "elementor")
1034
+ }
1035
+ };
1036
+ function getStatusChipConfig(status) {
1037
+ const known = statusChipConfig[status];
1038
+ if (known) {
1039
+ return known;
1040
+ }
1041
+ return {
1042
+ color: "default",
1043
+ label: humanizeStatusSlug(status)
1044
+ };
1045
+ }
1046
+ function isKnownPanelStatus(status) {
1047
+ return status in statusChipConfig;
1048
+ }
965
1049
  var PageStatus = ({ status }) => {
966
1050
  if ("publish" === status) {
967
1051
  return null;
968
1052
  }
1053
+ const { color, label } = getStatusChipConfig(status);
1054
+ const isKnownStatus = isKnownPanelStatus(status);
969
1055
  return /* @__PURE__ */ React14.createElement(
970
- Typography3,
1056
+ Chip2,
971
1057
  {
1058
+ color,
972
1059
  component: "span",
973
- variant: "body2",
974
- color: "text.secondary",
1060
+ label,
1061
+ size: "tiny",
975
1062
  sx: {
976
- ...contentPanelListRowTitleSx,
977
- textTransform: "capitalize",
978
- fontStyle: "italic",
979
- whiteSpace: "nowrap",
980
- flexBasis: "content"
981
- }
982
- },
983
- "(",
984
- status,
985
- ")"
1063
+ flexShrink: isKnownStatus ? 0 : 1,
1064
+ maxWidth: isKnownStatus ? void 0 : "45%",
1065
+ minWidth: 0,
1066
+ ml: 0.5,
1067
+ "& .MuiChip-label": {
1068
+ overflow: "hidden",
1069
+ textOverflow: "ellipsis",
1070
+ whiteSpace: "nowrap"
1071
+ }
1072
+ },
1073
+ title: label,
1074
+ variant: "standard"
1075
+ }
986
1076
  );
987
1077
  };
988
1078
  var PageTitle = ({ title }) => {
@@ -1003,7 +1093,7 @@ var PageTitle = ({ title }) => {
1003
1093
  );
1004
1094
  };
1005
1095
  function PageTitleAndStatus({ title, status }) {
1006
- return /* @__PURE__ */ React14.createElement(Box5, { display: "flex" }, /* @__PURE__ */ React14.createElement(PageTitle, { title }), "\xA0", /* @__PURE__ */ React14.createElement(PageStatus, { status }));
1096
+ return /* @__PURE__ */ React14.createElement(Box5, { alignItems: "center", display: "flex", minWidth: 0 }, /* @__PURE__ */ React14.createElement(PageTitle, { title }), /* @__PURE__ */ React14.createElement(PageStatus, { status }));
1007
1097
  }
1008
1098
 
1009
1099
  // src/components/panel/actions-menu/actions/delete.tsx
@@ -1021,7 +1111,7 @@ import {
1021
1111
  DialogTitle,
1022
1112
  Divider as Divider2
1023
1113
  } from "@elementor/ui";
1024
- import { __ as __9, sprintf as sprintf3 } from "@wordpress/i18n";
1114
+ import { __ as __10, sprintf as sprintf3 } from "@wordpress/i18n";
1025
1115
 
1026
1116
  // src/components/panel/actions-menu/action-menu-item.tsx
1027
1117
  import * as React15 from "react";
@@ -1048,7 +1138,7 @@ function Delete({ post }) {
1048
1138
  return /* @__PURE__ */ React16.createElement(React16.Fragment, null, /* @__PURE__ */ React16.createElement(
1049
1139
  ActionMenuItem,
1050
1140
  {
1051
- title: __9("Delete", "elementor"),
1141
+ title: __10("Delete", "elementor"),
1052
1142
  icon: TrashIcon,
1053
1143
  MenuItemProps: {
1054
1144
  disabled: isDisabled,
@@ -1065,11 +1155,11 @@ function DeleteDialog({
1065
1155
  const { type } = usePostListContext();
1066
1156
  const { deletePost } = usePostActions(type);
1067
1157
  const { setError } = usePostListContext();
1068
- const dialogTitle = sprintf3(__9('Delete "%s"?', "elementor"), post.title.rendered);
1069
- const dialogBody = type === "post" ? __9(
1158
+ const dialogTitle = sprintf3(__10('Delete "%s"?', "elementor"), post.title.rendered);
1159
+ const dialogBody = type === "post" ? __10(
1070
1160
  "The post and its content will be deleted forever and we won\u2019t be able to recover them.",
1071
1161
  "elementor"
1072
- ) : __9(
1162
+ ) : __10(
1073
1163
  "The page and its content will be deleted forever and we won\u2019t be able to recover them.",
1074
1164
  "elementor"
1075
1165
  );
@@ -1095,18 +1185,17 @@ function DeleteDialog({
1095
1185
  onClick: handleCancel,
1096
1186
  disabled: deletePost.isPending
1097
1187
  },
1098
- __9("Cancel", "elementor")
1099
- ), /* @__PURE__ */ React16.createElement(Button, { variant: "contained", color: "error", onClick: deletePage, disabled: deletePost.isPending }, !deletePost.isPending ? __9("Delete", "elementor") : /* @__PURE__ */ React16.createElement(CircularProgress2, null))));
1188
+ __10("Cancel", "elementor")
1189
+ ), /* @__PURE__ */ React16.createElement(Button, { variant: "contained", color: "error", onClick: deletePage, disabled: deletePost.isPending }, !deletePost.isPending ? __10("Delete", "elementor") : /* @__PURE__ */ React16.createElement(CircularProgress2, null))));
1100
1190
  }
1101
1191
 
1102
1192
  // src/components/panel/actions-menu/actions/duplicate.tsx
1103
1193
  import * as React17 from "react";
1104
1194
  import { CopyIcon } from "@elementor/icons";
1105
- import { __ as __10 } from "@wordpress/i18n";
1195
+ import { __ as __11 } from "@wordpress/i18n";
1106
1196
  function Duplicate({ post, popupState }) {
1107
1197
  const { setEditMode, type } = usePostListContext();
1108
- const { data: user } = useUser();
1109
- const createCapability = getPostTypeCreateCapability(type);
1198
+ const canCreate = useCanCreate(type);
1110
1199
  const onClick = () => {
1111
1200
  popupState.close();
1112
1201
  setEditMode({
@@ -1117,11 +1206,11 @@ function Duplicate({ post, popupState }) {
1117
1206
  }
1118
1207
  });
1119
1208
  };
1120
- const isDisabled = !user?.capabilities?.[createCapability];
1209
+ const isDisabled = !canCreate;
1121
1210
  return /* @__PURE__ */ React17.createElement(
1122
1211
  ActionMenuItem,
1123
1212
  {
1124
- title: __10("Duplicate", "elementor"),
1213
+ title: __11("Duplicate", "elementor"),
1125
1214
  icon: CopyIcon,
1126
1215
  MenuItemProps: {
1127
1216
  disabled: isDisabled,
@@ -1134,13 +1223,13 @@ function Duplicate({ post, popupState }) {
1134
1223
  // src/components/panel/actions-menu/actions/rename.tsx
1135
1224
  import * as React18 from "react";
1136
1225
  import { EraseIcon } from "@elementor/icons";
1137
- import { __ as __11 } from "@wordpress/i18n";
1226
+ import { __ as __12 } from "@wordpress/i18n";
1138
1227
  function Rename({ post }) {
1139
1228
  const { setEditMode } = usePostListContext();
1140
1229
  return /* @__PURE__ */ React18.createElement(
1141
1230
  ActionMenuItem,
1142
1231
  {
1143
- title: __11("Rename", "elementor"),
1232
+ title: __12("Rename", "elementor"),
1144
1233
  icon: EraseIcon,
1145
1234
  MenuItemProps: {
1146
1235
  disabled: !post.user_can.edit,
@@ -1161,7 +1250,7 @@ function Rename({ post }) {
1161
1250
  import * as React19 from "react";
1162
1251
  import { HomeIcon } from "@elementor/icons";
1163
1252
  import { CircularProgress as CircularProgress3 } from "@elementor/ui";
1164
- import { __ as __12 } from "@wordpress/i18n";
1253
+ import { __ as __13 } from "@wordpress/i18n";
1165
1254
 
1166
1255
  // src/hooks/use-homepage-actions.ts
1167
1256
  import { useMutation as useMutation2, useQueryClient as useQueryClient2 } from "@elementor/query";
@@ -1203,7 +1292,7 @@ function SetHome({ post, closeMenu }) {
1203
1292
  return /* @__PURE__ */ React19.createElement(
1204
1293
  ActionMenuItem,
1205
1294
  {
1206
- title: __12("Set as homepage", "elementor"),
1295
+ title: __13("Set as homepage", "elementor"),
1207
1296
  icon: !updateSettingsMutation.isPending ? HomeIcon : CircularProgress3,
1208
1297
  MenuItemProps: {
1209
1298
  disabled: isDisabled,
@@ -1216,10 +1305,10 @@ function SetHome({ post, closeMenu }) {
1216
1305
  // src/components/panel/actions-menu/actions/view.tsx
1217
1306
  import * as React20 from "react";
1218
1307
  import { EyeIcon } from "@elementor/icons";
1219
- import { __ as __13 } from "@wordpress/i18n";
1308
+ import { __ as __14 } from "@wordpress/i18n";
1220
1309
  function View({ post }) {
1221
1310
  const { type } = usePostListContext();
1222
- const title = __13("View %s", "elementor").replace("%s", postTypesMap[type].labels.singular_name);
1311
+ const title = __14("View %s", "elementor").replace("%s", postTypesMap[type].labels.singular_name);
1223
1312
  return /* @__PURE__ */ React20.createElement(
1224
1313
  ActionMenuItem,
1225
1314
  {
@@ -1233,9 +1322,13 @@ function View({ post }) {
1233
1322
  }
1234
1323
 
1235
1324
  // src/components/panel/posts-list/list-items/list-item-view.tsx
1236
- var DisabledPostTooltip = ({ children, isDisabled }) => {
1325
+ var DisabledPostTooltip = ({
1326
+ children,
1327
+ isDisabled,
1328
+ postTypeSlug
1329
+ }) => {
1237
1330
  if (isDisabled) {
1238
- const title = /* @__PURE__ */ React21.createElement(Typography4, { variant: "caption" }, "You cannot edit this page.", /* @__PURE__ */ React21.createElement("br", null), "To edit it directly, contact the site owner");
1331
+ const title = /* @__PURE__ */ React21.createElement(Typography4, { variant: "caption" }, getCannotEditPanelItemMessage(postTypeSlug), /* @__PURE__ */ React21.createElement("br", null), __15("To edit it directly, contact the site owner", "elementor"));
1239
1332
  return /* @__PURE__ */ React21.createElement(Tooltip, { title, placement: "bottom", arrow: false }, /* @__PURE__ */ React21.createElement("span", null, children));
1240
1333
  }
1241
1334
  return /* @__PURE__ */ React21.createElement(React21.Fragment, null, children);
@@ -1254,7 +1347,7 @@ function ListItemView({ post }) {
1254
1347
  const title = isActive ? activeDocument?.title : post.title.rendered;
1255
1348
  const isDisabled = !post.user_can.edit;
1256
1349
  const menuTriggerProps = bindTrigger2(popupState);
1257
- return /* @__PURE__ */ React21.createElement(React21.Fragment, null, /* @__PURE__ */ React21.createElement(DisabledPostTooltip, { isDisabled }, /* @__PURE__ */ React21.createElement(
1350
+ return /* @__PURE__ */ React21.createElement(React21.Fragment, null, /* @__PURE__ */ React21.createElement(DisabledPostTooltip, { isDisabled, postTypeSlug: type }, /* @__PURE__ */ React21.createElement(
1258
1351
  ListItem2,
1259
1352
  {
1260
1353
  disablePadding: true,
@@ -1262,7 +1355,7 @@ function ListItemView({ post }) {
1262
1355
  secondaryAction: /* @__PURE__ */ React21.createElement(
1263
1356
  IconButton3,
1264
1357
  {
1265
- "aria-label": __14("More actions", "elementor"),
1358
+ "aria-label": __15("More actions", "elementor"),
1266
1359
  size: "tiny",
1267
1360
  ...menuTriggerProps,
1268
1361
  onClick: (event) => {
@@ -1289,7 +1382,7 @@ function ListItemView({ post }) {
1289
1382
  sx: contentPanelListItemButtonSx
1290
1383
  },
1291
1384
  /* @__PURE__ */ React21.createElement(ListItemText5, { disableTypography: true, sx: { flex: 1, minWidth: 0 } }, /* @__PURE__ */ React21.createElement(PageTitleAndStatus, { title, status })),
1292
- post.isHome && /* @__PURE__ */ React21.createElement(HomeIcon2, { titleAccess: __14("Homepage", "elementor"), color: "disabled" })
1385
+ post.isHome && /* @__PURE__ */ React21.createElement(HomeIcon2, { titleAccess: __15("Homepage", "elementor"), color: "disabled" })
1293
1386
  )
1294
1387
  )), /* @__PURE__ */ React21.createElement(
1295
1388
  Menu2,
@@ -1353,7 +1446,7 @@ function PostsCollapsibleList({ isOpenByDefault = false }) {
1353
1446
  });
1354
1447
  return () => unregisterSection(type);
1355
1448
  }, [registerSection, unregisterSection, type, setEditMode]);
1356
- const filteredPosts = useMemo3(() => {
1449
+ const filteredPosts = useMemo4(() => {
1357
1450
  if (!posts) {
1358
1451
  return [];
1359
1452
  }
@@ -1392,7 +1485,7 @@ function PostsCollapsibleList({ isOpenByDefault = false }) {
1392
1485
  title: sectionTitle,
1393
1486
  trailingActions: /* @__PURE__ */ React23.createElement(SectionAddButton, { onBeforeCreate: () => setIsOpen(true) })
1394
1487
  },
1395
- showNoResults && /* @__PURE__ */ React23.createElement(Box6, { sx: { py: 2, px: 2 } }, /* @__PURE__ */ React23.createElement(Typography5, { variant: "body2", color: "text.secondary" }, __15("No results found", "elementor"))),
1488
+ showNoResults && /* @__PURE__ */ React23.createElement(Box6, { sx: { py: 2, px: 2 } }, /* @__PURE__ */ React23.createElement(Typography5, { variant: "body2", color: "text.secondary" }, __16("No results found", "elementor"))),
1396
1489
  filteredPosts.map((post) => {
1397
1490
  return /* @__PURE__ */ React23.createElement(PostListItem, { key: post.id, post });
1398
1491
  }),
@@ -1405,16 +1498,44 @@ function PostsCollapsibleList({ isOpenByDefault = false }) {
1405
1498
  justifyContent: "center"
1406
1499
  }
1407
1500
  },
1408
- /* @__PURE__ */ React23.createElement(Button2, { onClick: fetchNextPage, color: "secondary" }, isFetchingNextPage ? /* @__PURE__ */ React23.createElement(CircularProgress4, null) : __15("Load more", "elementor"))
1501
+ /* @__PURE__ */ React23.createElement(Button2, { onClick: fetchNextPage, color: "secondary" }, isFetchingNextPage ? /* @__PURE__ */ React23.createElement(CircularProgress4, null) : __16("Load more", "elementor"))
1409
1502
  )
1410
1503
  );
1411
1504
  }
1412
1505
 
1506
+ // src/components/panel/user-load-error.tsx
1507
+ import * as React24 from "react";
1508
+ import { Box as Box7, Typography as Typography6 } from "@elementor/ui";
1509
+ import { __ as __17 } from "@wordpress/i18n";
1510
+ function UserLoadError() {
1511
+ return /* @__PURE__ */ React24.createElement(Box7, { sx: { px: 2, py: 2 } }, /* @__PURE__ */ React24.createElement(Typography6, { variant: "body2", color: "text.secondary" }, __17(
1512
+ "We couldn\u2019t load your content permissions. Try closing and reopening this panel.",
1513
+ "elementor"
1514
+ )));
1515
+ }
1516
+
1517
+ // src/components/panel/shell-panel-body-content.tsx
1518
+ function ShellPanelBodyContent({
1519
+ accessiblePostTypes,
1520
+ isUserPending,
1521
+ onListError,
1522
+ showUserLoadError
1523
+ }) {
1524
+ if (isUserPending) {
1525
+ return /* @__PURE__ */ React25.createElement(Stack2, { spacing: 1, sx: { px: 2, py: 1 } }, /* @__PURE__ */ React25.createElement(Skeleton2, { animation: "wave", height: 28, variant: "rounded", width: "100%" }), /* @__PURE__ */ React25.createElement(Skeleton2, { animation: "wave", height: 28, variant: "rounded", width: "80%" }));
1526
+ }
1527
+ if (showUserLoadError) {
1528
+ return /* @__PURE__ */ React25.createElement(UserLoadError, null);
1529
+ }
1530
+ return /* @__PURE__ */ React25.createElement(List2, { dense: true, disablePadding: true, sx: { py: 0, width: "100%" } }, accessiblePostTypes.map((postTypeSlug, index) => /* @__PURE__ */ React25.createElement(PostListContextProvider, { key: postTypeSlug, type: postTypeSlug, setError: onListError }, /* @__PURE__ */ React25.createElement(PostsCollapsibleList, { isOpenByDefault: index === 0 }))));
1531
+ }
1532
+
1413
1533
  // src/components/panel/shell.tsx
1414
1534
  var Shell = () => {
1415
1535
  const [isErrorSnackbarOpen, setIsErrorSnackbarOpen] = useState6(false);
1416
- return /* @__PURE__ */ React24.createElement(ContentPanelCoordinatorProvider, null, /* @__PURE__ */ React24.createElement(Panel, null, /* @__PURE__ */ React24.createElement(PanelHeader, null, /* @__PURE__ */ React24.createElement(
1417
- Stack2,
1536
+ const { accessiblePostTypes, isUserPending, showUserLoadError } = useAccessiblePanelPostTypes();
1537
+ return /* @__PURE__ */ React26.createElement(ContentPanelCoordinatorProvider, null, /* @__PURE__ */ React26.createElement(Panel, null, /* @__PURE__ */ React26.createElement(PanelHeader, null, /* @__PURE__ */ React26.createElement(
1538
+ Stack3,
1418
1539
  {
1419
1540
  alignItems: "center",
1420
1541
  direction: "row",
@@ -1423,17 +1544,17 @@ var Shell = () => {
1423
1544
  ...contentPanelHeaderStackSx
1424
1545
  }
1425
1546
  },
1426
- /* @__PURE__ */ React24.createElement(PanelHeaderTitle, { sx: { flex: 1, minWidth: 0, textAlign: "start" } }, __16("Site content", "elementor")),
1427
- /* @__PURE__ */ React24.createElement(ContentPanelHeaderAdd, null)
1428
- )), /* @__PURE__ */ React24.createElement(Divider4, null), /* @__PURE__ */ React24.createElement(PanelBody, null, /* @__PURE__ */ React24.createElement(ContentPanelSearch, null), /* @__PURE__ */ React24.createElement(List2, { dense: true, disablePadding: true, sx: { py: 0, width: "100%" } }, panelPostTypeSlugs.map((postTypeSlug, index) => /* @__PURE__ */ React24.createElement(
1429
- PostListContextProvider,
1547
+ /* @__PURE__ */ React26.createElement(PanelHeaderTitle, { sx: { flex: 1, minWidth: 0, textAlign: "start" } }, __18("Site content", "elementor")),
1548
+ /* @__PURE__ */ React26.createElement(ContentPanelHeaderAdd, null)
1549
+ )), /* @__PURE__ */ React26.createElement(Divider4, null), /* @__PURE__ */ React26.createElement(PanelBody, null, /* @__PURE__ */ React26.createElement(ContentPanelSearch, null), /* @__PURE__ */ React26.createElement(
1550
+ ShellPanelBodyContent,
1430
1551
  {
1431
- key: postTypeSlug,
1432
- type: postTypeSlug,
1433
- setError: () => setIsErrorSnackbarOpen(true)
1434
- },
1435
- /* @__PURE__ */ React24.createElement(PostsCollapsibleList, { isOpenByDefault: index === 0 })
1436
- ))), /* @__PURE__ */ React24.createElement(error_snackbar_default, { open: isErrorSnackbarOpen, onClose: () => setIsErrorSnackbarOpen(false) }))));
1552
+ accessiblePostTypes,
1553
+ isUserPending,
1554
+ onListError: () => setIsErrorSnackbarOpen(true),
1555
+ showUserLoadError
1556
+ }
1557
+ ), /* @__PURE__ */ React26.createElement(error_snackbar_default, { open: isErrorSnackbarOpen, onClose: () => setIsErrorSnackbarOpen(false) }))));
1437
1558
  };
1438
1559
  var shell_default = Shell;
1439
1560
 
@@ -1444,7 +1565,7 @@ var { panel, usePanelStatus, usePanelActions } = createPanel({
1444
1565
  });
1445
1566
 
1446
1567
  // src/components/top-bar/recently-edited.tsx
1447
- import * as React29 from "react";
1568
+ import * as React31 from "react";
1448
1569
  import {
1449
1570
  __useActiveDocument as useActiveDocument4,
1450
1571
  __useHostDocument as useHostDocument
@@ -1461,15 +1582,15 @@ import {
1461
1582
  MenuItem as MenuItem5,
1462
1583
  usePopupState as usePopupState3
1463
1584
  } from "@elementor/ui";
1464
- import { __ as __18 } from "@wordpress/i18n";
1585
+ import { __ as __20 } from "@wordpress/i18n";
1465
1586
 
1466
1587
  // src/components/top-bar/create-post-list-item.tsx
1467
- import * as React25 from "react";
1588
+ import * as React27 from "react";
1468
1589
  import { __useNavigateToDocument as useNavigateToDocument4 } from "@elementor/editor-documents";
1469
1590
  import { useMixpanel } from "@elementor/events";
1470
1591
  import { PlusIcon as PlusIcon2 } from "@elementor/icons";
1471
1592
  import { CircularProgress as CircularProgress5, ListItemIcon as ListItemIcon3, ListItemText as ListItemText6, MenuItem as MenuItem3 } from "@elementor/ui";
1472
- import { __ as __17 } from "@wordpress/i18n";
1593
+ import { __ as __19 } from "@wordpress/i18n";
1473
1594
 
1474
1595
  // src/hooks/use-create-page.ts
1475
1596
  import { useState as useState7 } from "react";
@@ -1499,7 +1620,7 @@ function CreatePostListItem({ closePopup, ...props }) {
1499
1620
  const navigateToDocument = useNavigateToDocument4();
1500
1621
  const { data: user } = useUser();
1501
1622
  const { dispatchEvent, config } = useMixpanel();
1502
- return /* @__PURE__ */ React25.createElement(
1623
+ return /* @__PURE__ */ React27.createElement(
1503
1624
  MenuItem3,
1504
1625
  {
1505
1626
  disabled: isLoading || !user?.capabilities?.edit_pages,
@@ -1523,25 +1644,25 @@ function CreatePostListItem({ closePopup, ...props }) {
1523
1644
  },
1524
1645
  ...props
1525
1646
  },
1526
- /* @__PURE__ */ React25.createElement(ListItemIcon3, null, isLoading ? /* @__PURE__ */ React25.createElement(CircularProgress5, { size: "1.25rem" }) : /* @__PURE__ */ React25.createElement(PlusIcon2, { fontSize: "small" })),
1527
- /* @__PURE__ */ React25.createElement(
1647
+ /* @__PURE__ */ React27.createElement(ListItemIcon3, null, isLoading ? /* @__PURE__ */ React27.createElement(CircularProgress5, { size: "1.25rem" }) : /* @__PURE__ */ React27.createElement(PlusIcon2, { fontSize: "small" })),
1648
+ /* @__PURE__ */ React27.createElement(
1528
1649
  ListItemText6,
1529
1650
  {
1530
1651
  primaryTypographyProps: { variant: "body2" },
1531
- primary: __17("Add new page", "elementor")
1652
+ primary: __19("Add new page", "elementor")
1532
1653
  }
1533
1654
  )
1534
1655
  );
1535
1656
  }
1536
1657
 
1537
1658
  // src/components/top-bar/indicator.tsx
1538
- import * as React26 from "react";
1539
- import { Stack as Stack3, Tooltip as BaseTooltip, Typography as Typography6 } from "@elementor/ui";
1659
+ import * as React28 from "react";
1660
+ import { Stack as Stack4, Tooltip as BaseTooltip, Typography as Typography7 } from "@elementor/ui";
1540
1661
  function Indicator({ title, status }) {
1541
- return /* @__PURE__ */ React26.createElement(Tooltip2, { title }, /* @__PURE__ */ React26.createElement(Stack3, { component: "span", direction: "row", alignItems: "center", spacing: 0.5 }, /* @__PURE__ */ React26.createElement(Typography6, { component: "span", variant: "body2", sx: { maxWidth: "120px" }, noWrap: true }, title), status.value !== "publish" && /* @__PURE__ */ React26.createElement(Typography6, { component: "span", variant: "body2", sx: { fontStyle: "italic" } }, "(", status.label, ")")));
1662
+ return /* @__PURE__ */ React28.createElement(Tooltip2, { title }, /* @__PURE__ */ React28.createElement(Stack4, { component: "span", direction: "row", alignItems: "center", spacing: 0.5 }, /* @__PURE__ */ React28.createElement(Typography7, { component: "span", variant: "body2", sx: { maxWidth: "120px" }, noWrap: true }, title), status.value !== "publish" && /* @__PURE__ */ React28.createElement(Typography7, { component: "span", variant: "body2", sx: { fontStyle: "italic" } }, "(", status.label, ")")));
1542
1663
  }
1543
1664
  function Tooltip2(props) {
1544
- return /* @__PURE__ */ React26.createElement(
1665
+ return /* @__PURE__ */ React28.createElement(
1545
1666
  BaseTooltip,
1546
1667
  {
1547
1668
  PopperProps: {
@@ -1557,21 +1678,21 @@ function Tooltip2(props) {
1557
1678
  }
1558
1679
 
1559
1680
  // src/components/top-bar/post-list-item.tsx
1560
- import * as React28 from "react";
1681
+ import * as React30 from "react";
1561
1682
  import { __useNavigateToDocument as useNavigateToDocument5 } from "@elementor/editor-documents";
1562
1683
  import { useMixpanel as useMixpanel2 } from "@elementor/events";
1563
1684
  import { ListItemText as ListItemText7, MenuItem as MenuItem4 } from "@elementor/ui";
1564
1685
 
1565
1686
  // src/components/top-bar/chip-doc-type.tsx
1566
- import * as React27 from "react";
1687
+ import * as React29 from "react";
1567
1688
  import { PostTypeIcon as PostTypeIcon3 } from "@elementor/icons";
1568
- import { Chip as Chip2 } from "@elementor/ui";
1689
+ import { Chip as Chip3 } from "@elementor/ui";
1569
1690
  var iconsMap2 = getIconsMap();
1570
1691
  function DocTypeChip({ postType, docType, label }) {
1571
1692
  const color = "elementor_library" === postType ? "global" : "accent";
1572
1693
  const Icon = iconsMap2[docType] || PostTypeIcon3;
1573
- return /* @__PURE__ */ React27.createElement(
1574
- Chip2,
1694
+ return /* @__PURE__ */ React29.createElement(
1695
+ Chip3,
1575
1696
  {
1576
1697
  component: "span",
1577
1698
  size: "small",
@@ -1579,7 +1700,7 @@ function DocTypeChip({ postType, docType, label }) {
1579
1700
  label,
1580
1701
  "data-value": docType,
1581
1702
  color,
1582
- icon: /* @__PURE__ */ React27.createElement(Icon, null),
1703
+ icon: /* @__PURE__ */ React29.createElement(Icon, null),
1583
1704
  sx: { ml: 1, cursor: "inherit" }
1584
1705
  }
1585
1706
  );
@@ -1590,7 +1711,7 @@ function PostListItem2({ post, closePopup, ...props }) {
1590
1711
  const navigateToDocument = useNavigateToDocument5();
1591
1712
  const postTitle = useReverseHtmlEntities(post.title);
1592
1713
  const { dispatchEvent, config } = useMixpanel2();
1593
- return /* @__PURE__ */ React28.createElement(
1714
+ return /* @__PURE__ */ React30.createElement(
1594
1715
  MenuItem4,
1595
1716
  {
1596
1717
  disabled: !post.user_can.edit,
@@ -1613,7 +1734,7 @@ function PostListItem2({ post, closePopup, ...props }) {
1613
1734
  },
1614
1735
  ...props
1615
1736
  },
1616
- /* @__PURE__ */ React28.createElement(
1737
+ /* @__PURE__ */ React30.createElement(
1617
1738
  ListItemText7,
1618
1739
  {
1619
1740
  sx: { flexGrow: 0 },
@@ -1621,7 +1742,7 @@ function PostListItem2({ post, closePopup, ...props }) {
1621
1742
  primary: postTitle
1622
1743
  }
1623
1744
  ),
1624
- /* @__PURE__ */ React28.createElement(DocTypeChip, { postType: post.type.post_type, docType: post.type.doc_type, label: post.type.label })
1745
+ /* @__PURE__ */ React30.createElement(DocTypeChip, { postType: post.type.post_type, docType: post.type.doc_type, label: post.type.label })
1625
1746
  );
1626
1747
  }
1627
1748
 
@@ -1647,12 +1768,12 @@ function RecentlyEdited() {
1647
1768
  return null;
1648
1769
  }
1649
1770
  const buttonProps = bindTrigger3(popupState);
1650
- return /* @__PURE__ */ React29.createElement(React29.Fragment, null, /* @__PURE__ */ React29.createElement(
1771
+ return /* @__PURE__ */ React31.createElement(React31.Fragment, null, /* @__PURE__ */ React31.createElement(
1651
1772
  Button3,
1652
1773
  {
1653
1774
  color: "inherit",
1654
1775
  size: "small",
1655
- endIcon: /* @__PURE__ */ React29.createElement(ChevronDownIcon, { fontSize: "small" }),
1776
+ endIcon: /* @__PURE__ */ React31.createElement(ChevronDownIcon, { fontSize: "small" }),
1656
1777
  ...buttonProps,
1657
1778
  onClick: (e) => {
1658
1779
  const extendedWindow = window;
@@ -1671,46 +1792,40 @@ function RecentlyEdited() {
1671
1792
  buttonProps.onClick(e);
1672
1793
  }
1673
1794
  },
1674
- /* @__PURE__ */ React29.createElement(Indicator, { title: documentTitle, status: document2.status })
1675
- ), /* @__PURE__ */ React29.createElement(
1795
+ /* @__PURE__ */ React31.createElement(Indicator, { title: documentTitle, status: document2.status })
1796
+ ), /* @__PURE__ */ React31.createElement(
1676
1797
  Menu3,
1677
1798
  {
1678
1799
  MenuListProps: {
1679
- subheader: /* @__PURE__ */ React29.createElement(ListSubheader, { sx: { color: "accent.main", fontStyle: "italic", fontWeight: "300" } }, __18("Recent", "elementor"))
1800
+ subheader: /* @__PURE__ */ React31.createElement(ListSubheader, { sx: { color: "accent.main", fontStyle: "italic", fontWeight: "300" } }, __20("Recent", "elementor"))
1680
1801
  },
1681
1802
  PaperProps: { sx: { mt: 2.5, width: 320 } },
1682
1803
  ...bindMenu3(popupState)
1683
1804
  },
1684
- recentPosts.map((post) => /* @__PURE__ */ React29.createElement(PostListItem2, { key: post.id, post, closePopup: popupState.close })),
1685
- recentPosts.length === 0 && /* @__PURE__ */ React29.createElement(MenuItem5, { disabled: true }, /* @__PURE__ */ React29.createElement(
1805
+ recentPosts.map((post) => /* @__PURE__ */ React31.createElement(PostListItem2, { key: post.id, post, closePopup: popupState.close })),
1806
+ recentPosts.length === 0 && /* @__PURE__ */ React31.createElement(MenuItem5, { disabled: true }, /* @__PURE__ */ React31.createElement(
1686
1807
  ListItemText8,
1687
1808
  {
1688
1809
  primaryTypographyProps: {
1689
1810
  variant: "caption",
1690
1811
  fontStyle: "italic"
1691
1812
  },
1692
- primary: __18("There are no other pages or templates on this site yet.", "elementor")
1813
+ primary: __20("There are no other pages or templates on this site yet.", "elementor")
1693
1814
  }
1694
1815
  )),
1695
- /* @__PURE__ */ React29.createElement(Divider5, { disabled: recentPosts.length === 0 }),
1696
- /* @__PURE__ */ React29.createElement(CreatePostListItem, { closePopup: popupState.close })
1816
+ /* @__PURE__ */ React31.createElement(Divider5, { disabled: recentPosts.length === 0 }),
1817
+ /* @__PURE__ */ React31.createElement(CreatePostListItem, { closePopup: popupState.close })
1697
1818
  ));
1698
1819
  }
1699
1820
 
1700
- // src/env.ts
1701
- import { parseEnv } from "@elementor/env";
1702
- var { env } = parseEnv("@elementor/editor-site-navigation", (envData) => {
1703
- return envData;
1704
- });
1705
-
1706
1821
  // src/hooks/use-toggle-button-props.ts
1707
1822
  import { PagesIcon } from "@elementor/icons";
1708
- import { __ as __19 } from "@wordpress/i18n";
1823
+ import { __ as __21 } from "@wordpress/i18n";
1709
1824
  function useToggleButtonProps() {
1710
1825
  const { isOpen: selectedState, isBlocked } = usePanelStatus();
1711
1826
  const { open, close } = usePanelActions();
1712
1827
  return {
1713
- title: __19("Site content", "elementor"),
1828
+ title: __21("Site content", "elementor"),
1714
1829
  icon: PagesIcon,
1715
1830
  onClick: () => {
1716
1831
  const extendedWindow = window;
@@ -1733,7 +1848,7 @@ function useToggleButtonProps() {
1733
1848
  // src/init.ts
1734
1849
  function init() {
1735
1850
  registerTopBarMenuItems();
1736
- if (env.is_pages_panel_active) {
1851
+ if (env.is_pages_panel_active && env.can_access_site_content_panel) {
1737
1852
  registerPanel(panel);
1738
1853
  registerButton();
1739
1854
  }