@elementor/editor-site-navigation 4.5.0-1217 → 4.5.0-1219

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.d.mts CHANGED
@@ -1,4 +1,5 @@
1
1
  import * as React from 'react';
2
+ import * as _elementor_locations from '@elementor/locations';
2
3
 
3
4
  type IconsMap = {
4
5
  [key: string]: React.ElementType;
@@ -7,4 +8,26 @@ declare function extendIconsMap(additionalIcons: IconsMap): void;
7
8
 
8
9
  declare function init(): void;
9
10
 
10
- export { extendIconsMap, init };
11
+ type Post = {
12
+ isHome?: boolean;
13
+ id: number;
14
+ link: string;
15
+ status: string;
16
+ type: string;
17
+ title: {
18
+ rendered: string;
19
+ };
20
+ user_can: {
21
+ edit: boolean;
22
+ delete: boolean;
23
+ };
24
+ };
25
+
26
+ type SiteContentListItemActionsProps = {
27
+ post: Post;
28
+ title: string;
29
+ };
30
+ declare const SiteContentListItemActionsSlot: React.ComponentType<SiteContentListItemActionsProps>;
31
+ declare const injectIntoSiteContentListItemActions: (args: _elementor_locations.InjectArgs<SiteContentListItemActionsProps>) => void;
32
+
33
+ export { type SiteContentListItemActionsProps, SiteContentListItemActionsSlot, extendIconsMap, init, injectIntoSiteContentListItemActions };
package/dist/index.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import * as React from 'react';
2
+ import * as _elementor_locations from '@elementor/locations';
2
3
 
3
4
  type IconsMap = {
4
5
  [key: string]: React.ElementType;
@@ -7,4 +8,26 @@ declare function extendIconsMap(additionalIcons: IconsMap): void;
7
8
 
8
9
  declare function init(): void;
9
10
 
10
- export { extendIconsMap, init };
11
+ type Post = {
12
+ isHome?: boolean;
13
+ id: number;
14
+ link: string;
15
+ status: string;
16
+ type: string;
17
+ title: {
18
+ rendered: string;
19
+ };
20
+ user_can: {
21
+ edit: boolean;
22
+ delete: boolean;
23
+ };
24
+ };
25
+
26
+ type SiteContentListItemActionsProps = {
27
+ post: Post;
28
+ title: string;
29
+ };
30
+ declare const SiteContentListItemActionsSlot: React.ComponentType<SiteContentListItemActionsProps>;
31
+ declare const injectIntoSiteContentListItemActions: (args: _elementor_locations.InjectArgs<SiteContentListItemActionsProps>) => void;
32
+
33
+ export { type SiteContentListItemActionsProps, SiteContentListItemActionsSlot, extendIconsMap, init, injectIntoSiteContentListItemActions };
package/dist/index.js CHANGED
@@ -30,8 +30,10 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
30
30
  // src/index.ts
31
31
  var index_exports = {};
32
32
  __export(index_exports, {
33
+ SiteContentListItemActionsSlot: () => SiteContentListItemActionsSlot,
33
34
  extendIconsMap: () => extendIconsMap,
34
- init: () => init
35
+ init: () => init,
36
+ injectIntoSiteContentListItemActions: () => injectIntoSiteContentListItemActions
35
37
  });
36
38
  module.exports = __toCommonJS(index_exports);
37
39
 
@@ -55,7 +57,7 @@ function getIconsMap() {
55
57
  // src/init.ts
56
58
  var import_editor_app_bar = require("@elementor/editor-app-bar");
57
59
  var import_editor_panels3 = require("@elementor/editor-panels");
58
- var import_editor_sidebar = require("@elementor/editor-sidebar");
60
+ var import_editor_sidebar2 = require("@elementor/editor-sidebar");
59
61
 
60
62
  // src/components/panel/panel.ts
61
63
  var import_editor_panels2 = require("@elementor/editor-panels");
@@ -64,6 +66,7 @@ var import_editor_panels2 = require("@elementor/editor-panels");
64
66
  var React34 = __toESM(require("react"));
65
67
  var import_react11 = require("react");
66
68
  var import_editor_panels = require("@elementor/editor-panels");
69
+ var import_editor_sidebar = require("@elementor/editor-sidebar");
67
70
  var import_ui23 = require("@elementor/ui");
68
71
  var import_i18n24 = require("@wordpress/i18n");
69
72
 
@@ -372,6 +375,7 @@ function useAccessiblePanelPostTypes() {
372
375
  var CONTENT_PANEL_INSET_SPACING = 2;
373
376
  var CONTENT_PANEL_LIST_ROW_GAP = 0.5;
374
377
  var CONTENT_PANEL_LIST_ROW_INSET_INLINE = 0.75;
378
+ var CONTENT_PANEL_LIST_ROW_ACTIVE_SECONDARY_INSET = 10;
375
379
  var CONTENT_PANEL_LIST_ROW_TITLE_FONT_SIZE = "0.75rem";
376
380
  var CONTENT_PANEL_LIST_SECTION_BOTTOM_SPACING = 1;
377
381
  var CONTENT_PANEL_SECTION_HEADER_PADDING_BLOCK = 1.25;
@@ -383,6 +387,21 @@ var contentPanelInsetPaddingSx = {
383
387
  var contentPanelListRowPaddingSx = {
384
388
  ...contentPanelInsetPaddingSx
385
389
  };
390
+ var contentPanelListItemActiveActionsInsetSx = {
391
+ "&& > .MuiListItemButton-root": {
392
+ paddingInlineEnd: CONTENT_PANEL_LIST_ROW_ACTIVE_SECONDARY_INSET,
393
+ paddingRight: "unset"
394
+ }
395
+ };
396
+ function getContentPanelListItemSx(hasActiveRowActions) {
397
+ if (!hasActiveRowActions) {
398
+ return contentPanelListRowPaddingSx;
399
+ }
400
+ return {
401
+ ...contentPanelListRowPaddingSx,
402
+ ...contentPanelListItemActiveActionsInsetSx
403
+ };
404
+ }
386
405
  var contentPanelHeaderStackSx = {
387
406
  width: "100%"
388
407
  };
@@ -1514,7 +1533,9 @@ var PageTitle = ({ title }) => {
1514
1533
  noWrap: true,
1515
1534
  sx: {
1516
1535
  ...contentPanelListRowTitleSx,
1517
- flexBasis: "auto"
1536
+ flex: 1,
1537
+ flexBasis: "auto",
1538
+ minWidth: 0
1518
1539
  }
1519
1540
  },
1520
1541
  modifiedTitle
@@ -1833,6 +1854,14 @@ function View({ post }) {
1833
1854
  );
1834
1855
  }
1835
1856
 
1857
+ // src/components/panel/posts-list/list-items/site-content-list-item-actions-location.tsx
1858
+ var import_locations = require("@elementor/locations");
1859
+ var {
1860
+ Slot: SiteContentListItemActionsSlot,
1861
+ inject: injectIntoSiteContentListItemActions,
1862
+ useInjections: useSiteContentListItemActionsInjections
1863
+ } = (0, import_locations.createLocation)();
1864
+
1836
1865
  // src/components/panel/posts-list/list-items/list-item-view.tsx
1837
1866
  var DisabledPostTooltip = ({
1838
1867
  children,
@@ -1861,12 +1890,14 @@ function ListItemView({ post }) {
1861
1890
  const isEditBlocked = !post.user_can.edit && !isTrashed;
1862
1891
  const isRowDisabled = isEditBlocked || isTrashed;
1863
1892
  const menuTriggerProps = (0, import_ui18.bindTrigger)(popupState);
1893
+ const hasListItemActions = useSiteContentListItemActionsInjections().length > 0;
1894
+ const showListItemActions = isActive && post.user_can.edit && !isTrashed && hasListItemActions;
1864
1895
  const listRow = /* @__PURE__ */ React28.createElement(
1865
1896
  import_ui18.ListItem,
1866
1897
  {
1867
1898
  disablePadding: true,
1868
- sx: contentPanelListRowPaddingSx,
1869
- secondaryAction: /* @__PURE__ */ React28.createElement(
1899
+ sx: getContentPanelListItemSx(showListItemActions),
1900
+ secondaryAction: /* @__PURE__ */ React28.createElement(import_ui18.Stack, { alignItems: "center", direction: "row", spacing: 0 }, showListItemActions && /* @__PURE__ */ React28.createElement(SiteContentListItemActionsSlot, { post, title }), /* @__PURE__ */ React28.createElement(
1870
1901
  import_ui18.IconButton,
1871
1902
  {
1872
1903
  "aria-label": (0, import_i18n20.__)("More actions", "elementor"),
@@ -1878,7 +1909,7 @@ function ListItemView({ post }) {
1878
1909
  }
1879
1910
  },
1880
1911
  /* @__PURE__ */ React28.createElement(import_icons17.DotsVerticalIcon, { fontSize: "tiny" })
1881
- )
1912
+ ))
1882
1913
  },
1883
1914
  /* @__PURE__ */ React28.createElement(
1884
1915
  import_ui18.ListItemButton,
@@ -2150,6 +2181,7 @@ function ShellPanelBodyContent({
2150
2181
 
2151
2182
  // src/components/panel/shell.tsx
2152
2183
  var Shell = () => {
2184
+ const sidebarPanelChrome = (0, import_editor_sidebar.isSidebarEnabled)();
2153
2185
  const [isErrorSnackbarOpen, setIsErrorSnackbarOpen] = (0, import_react11.useState)(false);
2154
2186
  const { accessiblePostTypes, isUserPending, showUserLoadError } = useAccessiblePanelPostTypes();
2155
2187
  return /* @__PURE__ */ React34.createElement(ContentPanelCoordinatorProvider, null, /* @__PURE__ */ React34.createElement(import_editor_panels.Panel, null, /* @__PURE__ */ React34.createElement(import_editor_panels.PanelHeader, null, /* @__PURE__ */ React34.createElement(
@@ -2159,7 +2191,8 @@ var Shell = () => {
2159
2191
  direction: "row",
2160
2192
  spacing: 0.5,
2161
2193
  sx: {
2162
- ...contentPanelHeaderStackSx
2194
+ ...contentPanelHeaderStackSx,
2195
+ ...sidebarPanelChrome ? {} : { p: 1, pl: 2 }
2163
2196
  }
2164
2197
  },
2165
2198
  /* @__PURE__ */ React34.createElement(import_editor_panels.PanelHeaderTitle, { sx: { flex: 1, minWidth: 0, textAlign: "start" } }, (0, import_i18n24.__)("Site content", "elementor")),
@@ -2465,7 +2498,7 @@ function registerTopBarMenuItems() {
2465
2498
  });
2466
2499
  }
2467
2500
  function registerButton() {
2468
- const menu = (0, import_editor_sidebar.isSidebarEnabled)() ? import_editor_sidebar.sidebarTools : import_editor_app_bar.toolsMenu;
2501
+ const menu = (0, import_editor_sidebar2.isSidebarEnabled)() ? import_editor_sidebar2.sidebarTools : import_editor_app_bar.toolsMenu;
2469
2502
  menu.registerToggleAction({
2470
2503
  id: "toggle-site-navigation-panel",
2471
2504
  priority: 6,
@@ -2474,6 +2507,8 @@ function registerButton() {
2474
2507
  }
2475
2508
  // Annotate the CommonJS export names for ESM import in node:
2476
2509
  0 && (module.exports = {
2510
+ SiteContentListItemActionsSlot,
2477
2511
  extendIconsMap,
2478
- init
2512
+ init,
2513
+ injectIntoSiteContentListItemActions
2479
2514
  });
package/dist/index.mjs CHANGED
@@ -24,7 +24,7 @@ function getIconsMap() {
24
24
  // src/init.ts
25
25
  import { injectIntoPageIndication, toolsMenu } from "@elementor/editor-app-bar";
26
26
  import { registerPanel } from "@elementor/editor-panels";
27
- import { isSidebarEnabled, sidebarTools } from "@elementor/editor-sidebar";
27
+ import { isSidebarEnabled as isSidebarEnabled2, sidebarTools } from "@elementor/editor-sidebar";
28
28
 
29
29
  // src/components/panel/panel.ts
30
30
  import { createPanel } from "@elementor/editor-panels";
@@ -33,7 +33,8 @@ import { createPanel } from "@elementor/editor-panels";
33
33
  import * as React34 from "react";
34
34
  import { useState as useState8 } from "react";
35
35
  import { Panel, PanelBody, PanelHeader, PanelHeaderTitle } from "@elementor/editor-panels";
36
- import { Divider as Divider6, Stack as Stack7 } from "@elementor/ui";
36
+ import { isSidebarEnabled } from "@elementor/editor-sidebar";
37
+ import { Divider as Divider6, Stack as Stack8 } from "@elementor/ui";
37
38
  import { __ as __24 } from "@wordpress/i18n";
38
39
 
39
40
  // src/contexts/content-panel-coordinator.tsx
@@ -341,6 +342,7 @@ function useAccessiblePanelPostTypes() {
341
342
  var CONTENT_PANEL_INSET_SPACING = 2;
342
343
  var CONTENT_PANEL_LIST_ROW_GAP = 0.5;
343
344
  var CONTENT_PANEL_LIST_ROW_INSET_INLINE = 0.75;
345
+ var CONTENT_PANEL_LIST_ROW_ACTIVE_SECONDARY_INSET = 10;
344
346
  var CONTENT_PANEL_LIST_ROW_TITLE_FONT_SIZE = "0.75rem";
345
347
  var CONTENT_PANEL_LIST_SECTION_BOTTOM_SPACING = 1;
346
348
  var CONTENT_PANEL_SECTION_HEADER_PADDING_BLOCK = 1.25;
@@ -352,6 +354,21 @@ var contentPanelInsetPaddingSx = {
352
354
  var contentPanelListRowPaddingSx = {
353
355
  ...contentPanelInsetPaddingSx
354
356
  };
357
+ var contentPanelListItemActiveActionsInsetSx = {
358
+ "&& > .MuiListItemButton-root": {
359
+ paddingInlineEnd: CONTENT_PANEL_LIST_ROW_ACTIVE_SECONDARY_INSET,
360
+ paddingRight: "unset"
361
+ }
362
+ };
363
+ function getContentPanelListItemSx(hasActiveRowActions) {
364
+ if (!hasActiveRowActions) {
365
+ return contentPanelListRowPaddingSx;
366
+ }
367
+ return {
368
+ ...contentPanelListRowPaddingSx,
369
+ ...contentPanelListItemActiveActionsInsetSx
370
+ };
371
+ }
355
372
  var contentPanelHeaderStackSx = {
356
373
  width: "100%"
357
374
  };
@@ -708,7 +725,7 @@ var error_snackbar_default = ErrorSnackbar;
708
725
 
709
726
  // src/components/panel/shell-panel-body-content.tsx
710
727
  import * as React33 from "react";
711
- import { List as List2, Skeleton as Skeleton2, Stack as Stack6 } from "@elementor/ui";
728
+ import { List as List2, Skeleton as Skeleton2, Stack as Stack7 } from "@elementor/ui";
712
729
 
713
730
  // src/contexts/post-list-context.tsx
714
731
  import * as React11 from "react";
@@ -1394,6 +1411,7 @@ import {
1394
1411
  ListItemButton as ListItemButton2,
1395
1412
  ListItemText as ListItemText5,
1396
1413
  Menu as Menu2,
1414
+ Stack as Stack5,
1397
1415
  Tooltip as Tooltip3,
1398
1416
  Typography as Typography5,
1399
1417
  usePopupState as usePopupState3
@@ -1498,7 +1516,9 @@ var PageTitle = ({ title }) => {
1498
1516
  noWrap: true,
1499
1517
  sx: {
1500
1518
  ...contentPanelListRowTitleSx,
1501
- flexBasis: "auto"
1519
+ flex: 1,
1520
+ flexBasis: "auto",
1521
+ minWidth: 0
1502
1522
  }
1503
1523
  },
1504
1524
  modifiedTitle
@@ -1835,6 +1855,14 @@ function View({ post }) {
1835
1855
  );
1836
1856
  }
1837
1857
 
1858
+ // src/components/panel/posts-list/list-items/site-content-list-item-actions-location.tsx
1859
+ import { createLocation } from "@elementor/locations";
1860
+ var {
1861
+ Slot: SiteContentListItemActionsSlot,
1862
+ inject: injectIntoSiteContentListItemActions,
1863
+ useInjections: useSiteContentListItemActionsInjections
1864
+ } = createLocation();
1865
+
1838
1866
  // src/components/panel/posts-list/list-items/list-item-view.tsx
1839
1867
  var DisabledPostTooltip = ({
1840
1868
  children,
@@ -1863,12 +1891,14 @@ function ListItemView({ post }) {
1863
1891
  const isEditBlocked = !post.user_can.edit && !isTrashed;
1864
1892
  const isRowDisabled = isEditBlocked || isTrashed;
1865
1893
  const menuTriggerProps = bindTrigger2(popupState);
1894
+ const hasListItemActions = useSiteContentListItemActionsInjections().length > 0;
1895
+ const showListItemActions = isActive && post.user_can.edit && !isTrashed && hasListItemActions;
1866
1896
  const listRow = /* @__PURE__ */ React28.createElement(
1867
1897
  ListItem2,
1868
1898
  {
1869
1899
  disablePadding: true,
1870
- sx: contentPanelListRowPaddingSx,
1871
- secondaryAction: /* @__PURE__ */ React28.createElement(
1900
+ sx: getContentPanelListItemSx(showListItemActions),
1901
+ secondaryAction: /* @__PURE__ */ React28.createElement(Stack5, { alignItems: "center", direction: "row", spacing: 0 }, showListItemActions && /* @__PURE__ */ React28.createElement(SiteContentListItemActionsSlot, { post, title }), /* @__PURE__ */ React28.createElement(
1872
1902
  IconButton4,
1873
1903
  {
1874
1904
  "aria-label": __20("More actions", "elementor"),
@@ -1880,7 +1910,7 @@ function ListItemView({ post }) {
1880
1910
  }
1881
1911
  },
1882
1912
  /* @__PURE__ */ React28.createElement(DotsVerticalIcon, { fontSize: "tiny" })
1883
- )
1913
+ ))
1884
1914
  },
1885
1915
  /* @__PURE__ */ React28.createElement(
1886
1916
  ListItemButton2,
@@ -1934,7 +1964,7 @@ function PostListItem({ post }) {
1934
1964
  // src/components/panel/posts-list/post-list-pagination-actions.tsx
1935
1965
  import * as React30 from "react";
1936
1966
  import { CollapseIcon as CollapseIcon2 } from "@elementor/editor-ui";
1937
- import { Box as Box8, Button as Button3, CircularProgress as CircularProgress5, Stack as Stack5 } from "@elementor/ui";
1967
+ import { Box as Box8, Button as Button3, CircularProgress as CircularProgress5, Stack as Stack6 } from "@elementor/ui";
1938
1968
  import { __ as __21 } from "@wordpress/i18n";
1939
1969
  var listPaginationButtonProps = {
1940
1970
  color: "secondary",
@@ -1981,7 +2011,7 @@ function PostListPaginationActions({
1981
2011
  showLessLabel
1982
2012
  );
1983
2013
  if (canShowLess && canLoadMore) {
1984
- return /* @__PURE__ */ React30.createElement(Box8, { sx: { px: 2, width: "100%" } }, /* @__PURE__ */ React30.createElement(Stack5, { direction: "row", spacing: 1 }, showLessButton, loadMoreButton));
2014
+ return /* @__PURE__ */ React30.createElement(Box8, { sx: { px: 2, width: "100%" } }, /* @__PURE__ */ React30.createElement(Stack6, { direction: "row", spacing: 1 }, showLessButton, loadMoreButton));
1985
2015
  }
1986
2016
  return /* @__PURE__ */ React30.createElement(Box8, { sx: { px: 2, width: "100%" } }, canShowLess ? showLessButton : loadMoreButton);
1987
2017
  }
@@ -2142,7 +2172,7 @@ function ShellPanelBodyContent({
2142
2172
  showUserLoadError
2143
2173
  }) {
2144
2174
  if (isUserPending) {
2145
- return /* @__PURE__ */ React33.createElement(Stack6, { spacing: 1, sx: { px: 2, py: 1 } }, /* @__PURE__ */ React33.createElement(Skeleton2, { animation: "wave", height: 28, variant: "rounded", width: "100%" }), /* @__PURE__ */ React33.createElement(Skeleton2, { animation: "wave", height: 28, variant: "rounded", width: "80%" }));
2175
+ return /* @__PURE__ */ React33.createElement(Stack7, { spacing: 1, sx: { px: 2, py: 1 } }, /* @__PURE__ */ React33.createElement(Skeleton2, { animation: "wave", height: 28, variant: "rounded", width: "100%" }), /* @__PURE__ */ React33.createElement(Skeleton2, { animation: "wave", height: 28, variant: "rounded", width: "80%" }));
2146
2176
  }
2147
2177
  if (showUserLoadError) {
2148
2178
  return /* @__PURE__ */ React33.createElement(UserLoadError, null);
@@ -2152,16 +2182,18 @@ function ShellPanelBodyContent({
2152
2182
 
2153
2183
  // src/components/panel/shell.tsx
2154
2184
  var Shell = () => {
2185
+ const sidebarPanelChrome = isSidebarEnabled();
2155
2186
  const [isErrorSnackbarOpen, setIsErrorSnackbarOpen] = useState8(false);
2156
2187
  const { accessiblePostTypes, isUserPending, showUserLoadError } = useAccessiblePanelPostTypes();
2157
2188
  return /* @__PURE__ */ React34.createElement(ContentPanelCoordinatorProvider, null, /* @__PURE__ */ React34.createElement(Panel, null, /* @__PURE__ */ React34.createElement(PanelHeader, null, /* @__PURE__ */ React34.createElement(
2158
- Stack7,
2189
+ Stack8,
2159
2190
  {
2160
2191
  alignItems: "center",
2161
2192
  direction: "row",
2162
2193
  spacing: 0.5,
2163
2194
  sx: {
2164
- ...contentPanelHeaderStackSx
2195
+ ...contentPanelHeaderStackSx,
2196
+ ...sidebarPanelChrome ? {} : { p: 1, pl: 2 }
2165
2197
  }
2166
2198
  },
2167
2199
  /* @__PURE__ */ React34.createElement(PanelHeaderTitle, { sx: { flex: 1, minWidth: 0, textAlign: "start" } }, __24("Site content", "elementor")),
@@ -2277,9 +2309,9 @@ function CreatePostListItem({ closePopup, ...props }) {
2277
2309
 
2278
2310
  // src/components/top-bar/indicator.tsx
2279
2311
  import * as React36 from "react";
2280
- import { Stack as Stack8, Tooltip as BaseTooltip, Typography as Typography8 } from "@elementor/ui";
2312
+ import { Stack as Stack9, Tooltip as BaseTooltip, Typography as Typography8 } from "@elementor/ui";
2281
2313
  function Indicator({ title, status }) {
2282
- return /* @__PURE__ */ React36.createElement(Tooltip4, { title }, /* @__PURE__ */ React36.createElement(Stack8, { component: "span", direction: "row", alignItems: "center", spacing: 0.5 }, /* @__PURE__ */ React36.createElement(Typography8, { component: "span", variant: "body2", sx: { maxWidth: "120px" }, noWrap: true }, title), status.value !== "publish" && /* @__PURE__ */ React36.createElement(Typography8, { component: "span", variant: "body2", sx: { fontStyle: "italic" } }, "(", status.label, ")")));
2314
+ return /* @__PURE__ */ React36.createElement(Tooltip4, { title }, /* @__PURE__ */ React36.createElement(Stack9, { component: "span", direction: "row", alignItems: "center", spacing: 0.5 }, /* @__PURE__ */ React36.createElement(Typography8, { component: "span", variant: "body2", sx: { maxWidth: "120px" }, noWrap: true }, title), status.value !== "publish" && /* @__PURE__ */ React36.createElement(Typography8, { component: "span", variant: "body2", sx: { fontStyle: "italic" } }, "(", status.label, ")")));
2283
2315
  }
2284
2316
  function Tooltip4(props) {
2285
2317
  return /* @__PURE__ */ React36.createElement(
@@ -2480,7 +2512,7 @@ function registerTopBarMenuItems() {
2480
2512
  });
2481
2513
  }
2482
2514
  function registerButton() {
2483
- const menu = isSidebarEnabled() ? sidebarTools : toolsMenu;
2515
+ const menu = isSidebarEnabled2() ? sidebarTools : toolsMenu;
2484
2516
  menu.registerToggleAction({
2485
2517
  id: "toggle-site-navigation-panel",
2486
2518
  priority: 6,
@@ -2488,6 +2520,8 @@ function registerButton() {
2488
2520
  });
2489
2521
  }
2490
2522
  export {
2523
+ SiteContentListItemActionsSlot,
2491
2524
  extendIconsMap,
2492
- init
2525
+ init,
2526
+ injectIntoSiteContentListItemActions
2493
2527
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elementor/editor-site-navigation",
3
- "version": "4.5.0-1217",
3
+ "version": "4.5.0-1219",
4
4
  "private": false,
5
5
  "author": "Elementor Team",
6
6
  "homepage": "https://elementor.com/",
@@ -39,16 +39,17 @@
39
39
  "dev": "tsup --config=../../tsup.dev.ts"
40
40
  },
41
41
  "dependencies": {
42
- "@elementor/editor-app-bar": "4.5.0-1217",
43
- "@elementor/editor-documents": "4.5.0-1217",
44
- "@elementor/editor-panels": "4.5.0-1217",
45
- "@elementor/editor-sidebar": "4.5.0-1217",
46
- "@elementor/editor-ui": "4.5.0-1217",
47
- "@elementor/editor-v1-adapters": "4.5.0-1217",
48
- "@elementor/env": "4.5.0-1217",
42
+ "@elementor/editor-app-bar": "4.5.0-1219",
43
+ "@elementor/editor-documents": "4.5.0-1219",
44
+ "@elementor/editor-panels": "4.5.0-1219",
45
+ "@elementor/editor-sidebar": "4.5.0-1219",
46
+ "@elementor/editor-ui": "4.5.0-1219",
47
+ "@elementor/editor-v1-adapters": "4.5.0-1219",
48
+ "@elementor/env": "4.5.0-1219",
49
+ "@elementor/events": "4.5.0-1219",
49
50
  "@elementor/icons": "~1.78.1",
50
- "@elementor/events": "4.5.0-1217",
51
- "@elementor/query": "4.5.0-1217",
51
+ "@elementor/locations": "4.5.0-1219",
52
+ "@elementor/query": "4.5.0-1219",
52
53
  "@elementor/ui": "1.41.4",
53
54
  "@wordpress/api-fetch": "^6.42.0",
54
55
  "@wordpress/i18n": "^5.13.0"
@@ -1,6 +1,7 @@
1
1
  const CONTENT_PANEL_INSET_SPACING = 2;
2
2
  const CONTENT_PANEL_LIST_ROW_GAP = 0.5;
3
3
  const CONTENT_PANEL_LIST_ROW_INSET_INLINE = 0.75;
4
+ const CONTENT_PANEL_LIST_ROW_ACTIVE_SECONDARY_INSET = 10;
4
5
  const CONTENT_PANEL_LIST_ROW_TITLE_FONT_SIZE = '0.75rem';
5
6
  const CONTENT_PANEL_LIST_SECTION_BOTTOM_SPACING = 1;
6
7
 
@@ -16,6 +17,24 @@ export const contentPanelListRowPaddingSx = {
16
17
  ...contentPanelInsetPaddingSx,
17
18
  };
18
19
 
20
+ const contentPanelListItemActiveActionsInsetSx = {
21
+ '&& > .MuiListItemButton-root': {
22
+ paddingInlineEnd: CONTENT_PANEL_LIST_ROW_ACTIVE_SECONDARY_INSET,
23
+ paddingRight: 'unset',
24
+ },
25
+ };
26
+
27
+ export function getContentPanelListItemSx( hasActiveRowActions: boolean ) {
28
+ if ( ! hasActiveRowActions ) {
29
+ return contentPanelListRowPaddingSx;
30
+ }
31
+
32
+ return {
33
+ ...contentPanelListRowPaddingSx,
34
+ ...contentPanelListItemActiveActionsInsetSx,
35
+ };
36
+ }
37
+
19
38
  export const contentPanelHeaderStackSx = {
20
39
  width: '100%',
21
40
  };
@@ -13,6 +13,7 @@ import {
13
13
  ListItemButton,
14
14
  ListItemText,
15
15
  Menu,
16
+ Stack,
16
17
  Tooltip,
17
18
  Typography,
18
19
  usePopupState,
@@ -30,7 +31,11 @@ import Rename from '../../actions-menu/actions/rename';
30
31
  import Restore from '../../actions-menu/actions/restore';
31
32
  import SetHome from '../../actions-menu/actions/set-home';
32
33
  import View from '../../actions-menu/actions/view';
33
- import { contentPanelListItemButtonSx, contentPanelListRowPaddingSx } from '../../content-panel-chrome';
34
+ import { contentPanelListItemButtonSx, getContentPanelListItemSx } from '../../content-panel-chrome';
35
+ import {
36
+ SiteContentListItemActionsSlot,
37
+ useSiteContentListItemActionsInjections,
38
+ } from './site-content-list-item-actions-location';
34
39
 
35
40
  const DisabledPostTooltip = ( {
36
41
  children,
@@ -79,23 +84,28 @@ export default function ListItemView( { post }: { post: Post } ) {
79
84
  const isEditBlocked = ! post.user_can.edit && ! isTrashed;
80
85
  const isRowDisabled = isEditBlocked || isTrashed;
81
86
  const menuTriggerProps = bindTrigger( popupState );
87
+ const hasListItemActions = useSiteContentListItemActionsInjections().length > 0;
88
+ const showListItemActions = isActive && post.user_can.edit && ! isTrashed && hasListItemActions;
82
89
 
83
90
  const listRow = (
84
91
  <ListItem
85
92
  disablePadding
86
- sx={ contentPanelListRowPaddingSx }
93
+ sx={ getContentPanelListItemSx( showListItemActions ) }
87
94
  secondaryAction={
88
- <IconButton
89
- aria-label={ __( 'More actions', 'elementor' ) }
90
- size="tiny"
91
- { ...menuTriggerProps }
92
- onClick={ ( event: React.MouseEvent ) => {
93
- event.stopPropagation();
94
- menuTriggerProps.onClick?.( event );
95
- } }
96
- >
97
- <DotsVerticalIcon fontSize="tiny" />
98
- </IconButton>
95
+ <Stack alignItems="center" direction="row" spacing={ 0 }>
96
+ { showListItemActions && <SiteContentListItemActionsSlot post={ post } title={ title } /> }
97
+ <IconButton
98
+ aria-label={ __( 'More actions', 'elementor' ) }
99
+ size="tiny"
100
+ { ...menuTriggerProps }
101
+ onClick={ ( event: React.MouseEvent ) => {
102
+ event.stopPropagation();
103
+ menuTriggerProps.onClick?.( event );
104
+ } }
105
+ >
106
+ <DotsVerticalIcon fontSize="tiny" />
107
+ </IconButton>
108
+ </Stack>
99
109
  }
100
110
  >
101
111
  <ListItemButton
@@ -0,0 +1,14 @@
1
+ import { createLocation } from '@elementor/locations';
2
+
3
+ import { type Post } from '../../../../types';
4
+
5
+ export type SiteContentListItemActionsProps = {
6
+ post: Post;
7
+ title: string;
8
+ };
9
+
10
+ export const {
11
+ Slot: SiteContentListItemActionsSlot,
12
+ inject: injectIntoSiteContentListItemActions,
13
+ useInjections: useSiteContentListItemActionsInjections,
14
+ } = createLocation< SiteContentListItemActionsProps >();
@@ -1,6 +1,7 @@
1
1
  import * as React from 'react';
2
2
  import { useState } from 'react';
3
3
  import { Panel, PanelBody, PanelHeader, PanelHeaderTitle } from '@elementor/editor-panels';
4
+ import { isSidebarEnabled } from '@elementor/editor-sidebar';
4
5
  import { Divider, Stack } from '@elementor/ui';
5
6
  import { __ } from '@wordpress/i18n';
6
7
 
@@ -13,6 +14,7 @@ import ErrorSnackbar from './error-snackbar';
13
14
  import ShellPanelBodyContent from './shell-panel-body-content';
14
15
 
15
16
  const Shell = () => {
17
+ const sidebarPanelChrome = isSidebarEnabled();
16
18
  const [ isErrorSnackbarOpen, setIsErrorSnackbarOpen ] = useState( false );
17
19
  const { accessiblePostTypes, isUserPending, showUserLoadError } = useAccessiblePanelPostTypes();
18
20
 
@@ -26,6 +28,7 @@ const Shell = () => {
26
28
  spacing={ 0.5 }
27
29
  sx={ {
28
30
  ...contentPanelHeaderStackSx,
31
+ ...( sidebarPanelChrome ? {} : { p: 1, pl: 2 } ),
29
32
  } }
30
33
  >
31
34
  <PanelHeaderTitle sx={ { flex: 1, minWidth: 0, textAlign: 'start' } }>
@@ -92,7 +92,9 @@ const PageTitle = ( { title }: { title: string } ) => {
92
92
  noWrap
93
93
  sx={ {
94
94
  ...contentPanelListRowTitleSx,
95
+ flex: 1,
95
96
  flexBasis: 'auto',
97
+ minWidth: 0,
96
98
  } }
97
99
  >
98
100
  { modifiedTitle }
package/src/index.ts CHANGED
@@ -1,3 +1,8 @@
1
1
  export { extendIconsMap } from './icons-map';
2
2
 
3
3
  export { init } from './init';
4
+ export {
5
+ injectIntoSiteContentListItemActions,
6
+ SiteContentListItemActionsSlot,
7
+ type SiteContentListItemActionsProps,
8
+ } from './components/panel/posts-list/list-items/site-content-list-item-actions-location';