@elementor/editor-site-navigation 0.18.4 → 0.19.1

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/CHANGELOG.md CHANGED
@@ -3,6 +3,31 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [0.19.1](https://github.com/elementor/elementor-packages/compare/@elementor/editor-site-navigation@0.19.0...@elementor/editor-site-navigation@0.19.1) (2023-09-14)
7
+
8
+ **Note:** Version bump only for package @elementor/editor-site-navigation
9
+
10
+
11
+
12
+
13
+
14
+ # [0.19.0](https://github.com/elementor/elementor-packages/compare/@elementor/editor-site-navigation@0.18.4...@elementor/editor-site-navigation@0.19.0) (2023-09-11)
15
+
16
+
17
+ ### Bug Fixes
18
+
19
+ * ui adaptations [ED-11933] ([#107](https://github.com/elementor/elementor-packages/issues/107)) ([18ef329](https://github.com/elementor/elementor-packages/commit/18ef32928cbe921d7f5340c37c3c965b117d8d63))
20
+
21
+
22
+ ### Features
23
+
24
+ * **editor-documents:** mark experimental functions [ED-12066] ([#112](https://github.com/elementor/elementor-packages/issues/112)) ([f4b7a9a](https://github.com/elementor/elementor-packages/commit/f4b7a9ac7953a2b48062349495acff05b5640de3))
25
+ * **editor-panels:** mark experimental functions [ED-12067] ([#113](https://github.com/elementor/elementor-packages/issues/113)) ([152ef9f](https://github.com/elementor/elementor-packages/commit/152ef9f6980cd27571537db1738c69de63e2d4bb))
26
+
27
+
28
+
29
+
30
+
6
31
  ## [0.18.4](https://github.com/elementor/elementor-packages/compare/@elementor/editor-site-navigation@0.18.3...@elementor/editor-site-navigation@0.18.4) (2023-08-22)
7
32
 
8
33
  **Note:** Version bump only for package @elementor/editor-site-navigation
package/dist/index.js CHANGED
@@ -61,7 +61,7 @@ var import_editor_documents3 = require("@elementor/editor-documents");
61
61
  var React = __toESM(require("react"));
62
62
  var import_ui = require("@elementor/ui");
63
63
  function Indicator({ title, status }) {
64
- return /* @__PURE__ */ React.createElement(Tooltip, { title }, /* @__PURE__ */ React.createElement(import_ui.Stack, { component: "span", direction: "row", alignItems: "center", spacing: 2 }, /* @__PURE__ */ React.createElement(import_ui.Typography, { component: "span", variant: "body2", sx: { maxWidth: "120px" }, noWrap: true }, title), status.value !== "publish" && /* @__PURE__ */ React.createElement(import_ui.Typography, { component: "span", variant: "body2", sx: { fontStyle: "italic" } }, "(", status.label, ")")));
64
+ return /* @__PURE__ */ React.createElement(Tooltip, { title }, /* @__PURE__ */ React.createElement(import_ui.Stack, { component: "span", direction: "row", alignItems: "center", spacing: 0.5 }, /* @__PURE__ */ React.createElement(import_ui.Typography, { component: "span", variant: "body2", sx: { maxWidth: "120px" }, noWrap: true }, title), status.value !== "publish" && /* @__PURE__ */ React.createElement(import_ui.Typography, { component: "span", variant: "body2", sx: { fontStyle: "italic" } }, "(", status.label, ")")));
65
65
  }
66
66
  function Tooltip(props) {
67
67
  return /* @__PURE__ */ React.createElement(
@@ -70,7 +70,7 @@ function Tooltip(props) {
70
70
  PopperProps: {
71
71
  sx: {
72
72
  "&.MuiTooltip-popper .MuiTooltip-tooltip.MuiTooltip-tooltipPlacementBottom": {
73
- mt: 7
73
+ mt: 2.7
74
74
  }
75
75
  }
76
76
  },
@@ -126,13 +126,13 @@ function DocTypeChip({ postType, docType, label }) {
126
126
  import_ui2.Chip,
127
127
  {
128
128
  component: "span",
129
- size: "medium",
129
+ size: "small",
130
130
  variant: "standard",
131
131
  label,
132
132
  "data-value": docType,
133
133
  color,
134
134
  icon: /* @__PURE__ */ React2.createElement(Icon, null),
135
- sx: { ml: 3, cursor: "inherit" }
135
+ sx: { ml: 1, cursor: "inherit" }
136
136
  }
137
137
  );
138
138
  }
@@ -156,7 +156,7 @@ function useReverseHtmlEntities(escapedHTML = "") {
156
156
 
157
157
  // src/components/top-bar/post-list-item.tsx
158
158
  function PostListItem({ post, closePopup, ...props }) {
159
- const navigateToDocument = (0, import_editor_documents.useNavigateToDocument)();
159
+ const navigateToDocument = (0, import_editor_documents.__useNavigateToDocument)();
160
160
  const postTitle = useReverseHtmlEntities(post.title);
161
161
  return /* @__PURE__ */ React3.createElement(
162
162
  import_ui3.MenuItem,
@@ -218,7 +218,7 @@ var import_i18n = require("@wordpress/i18n");
218
218
  var import_editor_documents2 = require("@elementor/editor-documents");
219
219
  function CreatePostListItem({ closePopup, ...props }) {
220
220
  const { create, isLoading } = useCreatePage();
221
- const navigateToDocument = (0, import_editor_documents2.useNavigateToDocument)();
221
+ const navigateToDocument = (0, import_editor_documents2.__useNavigateToDocument)();
222
222
  return /* @__PURE__ */ React4.createElement(
223
223
  import_ui4.MenuItem,
224
224
  {
@@ -236,8 +236,8 @@ function CreatePostListItem({ closePopup, ...props }) {
236
236
 
237
237
  // src/components/top-bar/recently-edited.tsx
238
238
  function RecentlyEdited() {
239
- const activeDocument = (0, import_editor_documents3.useActiveDocument)();
240
- const hostDocument = (0, import_editor_documents3.useHostDocument)();
239
+ const activeDocument = (0, import_editor_documents3.__useActiveDocument)();
240
+ const hostDocument = (0, import_editor_documents3.__useHostDocument)();
241
241
  const document2 = activeDocument && activeDocument.type.value !== "kit" ? activeDocument : hostDocument;
242
242
  const { recentPosts } = useRecentPosts(document2?.id);
243
243
  const popupState = (0, import_ui5.usePopupState)({
@@ -267,10 +267,9 @@ function RecentlyEdited() {
267
267
  import_ui5.Menu,
268
268
  {
269
269
  MenuListProps: {
270
- dense: true,
271
- subheader: /* @__PURE__ */ React5.createElement(import_ui5.ListSubheader, { sx: { fontStyle: "italic", fontWeight: "300" } }, (0, import_i18n2.__)("Recent", "elementor"))
270
+ subheader: /* @__PURE__ */ React5.createElement(import_ui5.ListSubheader, { color: "primary", sx: { fontStyle: "italic", fontWeight: "300" } }, (0, import_i18n2.__)("Recent", "elementor"))
272
271
  },
273
- PaperProps: { sx: { mt: 4, width: 320 } },
272
+ PaperProps: { sx: { mt: 2.5, width: 320 } },
274
273
  ...(0, import_ui5.bindMenu)(popupState)
275
274
  },
276
275
  recentPosts.map((post) => /* @__PURE__ */ React5.createElement(PostListItem, { key: post.id, post, closePopup: popupState.close })),
@@ -595,7 +594,7 @@ var import_editor_documents4 = require("@elementor/editor-documents");
595
594
  function ListItemCreate() {
596
595
  const { type, resetEditMode } = usePostListContext();
597
596
  const { createPost } = usePostActions(type);
598
- const navigateToDocument = (0, import_editor_documents4.useNavigateToDocument)();
597
+ const navigateToDocument = (0, import_editor_documents4.__useNavigateToDocument)();
599
598
  const createPostCallback = (inputValue) => {
600
599
  createPost.mutateAsync({
601
600
  title: inputValue,
@@ -616,7 +615,7 @@ var import_i18n6 = require("@wordpress/i18n");
616
615
  var import_editor_documents5 = require("@elementor/editor-documents");
617
616
  function ListItemDuplicate() {
618
617
  const { type, editMode, resetEditMode } = usePostListContext();
619
- const navigateToDocument = (0, import_editor_documents5.useNavigateToDocument)();
618
+ const navigateToDocument = (0, import_editor_documents5.__useNavigateToDocument)();
620
619
  const { duplicatePost } = usePostActions(type);
621
620
  if ("duplicate" !== editMode.mode) {
622
621
  return null;
@@ -762,7 +761,7 @@ var import_react7 = require("react");
762
761
  var import_editor_documents6 = require("@elementor/editor-documents");
763
762
  function Delete({ post }) {
764
763
  const [isDialogOpen, setIsDialogOpen] = (0, import_react7.useState)(false);
765
- const activeDocument = (0, import_editor_documents6.useActiveDocument)();
764
+ const activeDocument = (0, import_editor_documents6.__useActiveDocument)();
766
765
  const isPostActive = activeDocument?.id === post.id;
767
766
  return /* @__PURE__ */ React16.createElement(React16.Fragment, null, /* @__PURE__ */ React16.createElement(
768
767
  ActionMenuItem,
@@ -901,8 +900,8 @@ function SetHome({ post }) {
901
900
  // src/components/panel/posts-list/list-items/list-item-view.tsx
902
901
  var import_i18n12 = require("@wordpress/i18n");
903
902
  function ListItemView({ post }) {
904
- const activeDocument = (0, import_editor_documents7.useActiveDocument)();
905
- const navigateToDocument = (0, import_editor_documents7.useNavigateToDocument)();
903
+ const activeDocument = (0, import_editor_documents7.__useActiveDocument)();
904
+ const navigateToDocument = (0, import_editor_documents7.__useNavigateToDocument)();
906
905
  const popupState = (0, import_ui12.usePopupState)({
907
906
  variant: "popover",
908
907
  popupId: "post-actions",
@@ -1055,7 +1054,7 @@ var {
1055
1054
  panel,
1056
1055
  usePanelStatus,
1057
1056
  usePanelActions
1058
- } = (0, import_editor_panels2.createPanel)({
1057
+ } = (0, import_editor_panels2.__createPanel)({
1059
1058
  id: "site-navigation-panel",
1060
1059
  component: shell_default
1061
1060
  });
@@ -1086,7 +1085,7 @@ var { env, validateEnv } = (0, import_env.parseEnv)("@elementor/editor-site-navi
1086
1085
  function init() {
1087
1086
  registerTopBarMenuItems();
1088
1087
  if (env.is_pages_panel_active) {
1089
- (0, import_editor_panels3.registerPanel)(panel);
1088
+ (0, import_editor_panels3.__registerPanel)(panel);
1090
1089
  registerButton();
1091
1090
  }
1092
1091
  }
package/dist/index.mjs CHANGED
@@ -35,13 +35,13 @@ import {
35
35
  MenuItem as MenuItem3
36
36
  } from "@elementor/ui";
37
37
  import { ChevronDownIcon } from "@elementor/icons";
38
- import { useActiveDocument, useHostDocument } from "@elementor/editor-documents";
38
+ import { __useActiveDocument as useActiveDocument, __useHostDocument as useHostDocument } from "@elementor/editor-documents";
39
39
 
40
40
  // src/components/top-bar/indicator.tsx
41
41
  import * as React from "react";
42
42
  import { Typography, Stack, Tooltip as BaseTooltip } from "@elementor/ui";
43
43
  function Indicator({ title, status }) {
44
- return /* @__PURE__ */ React.createElement(Tooltip, { title }, /* @__PURE__ */ React.createElement(Stack, { component: "span", direction: "row", alignItems: "center", spacing: 2 }, /* @__PURE__ */ React.createElement(Typography, { component: "span", variant: "body2", sx: { maxWidth: "120px" }, noWrap: true }, title), status.value !== "publish" && /* @__PURE__ */ React.createElement(Typography, { component: "span", variant: "body2", sx: { fontStyle: "italic" } }, "(", status.label, ")")));
44
+ return /* @__PURE__ */ React.createElement(Tooltip, { title }, /* @__PURE__ */ React.createElement(Stack, { component: "span", direction: "row", alignItems: "center", spacing: 0.5 }, /* @__PURE__ */ React.createElement(Typography, { component: "span", variant: "body2", sx: { maxWidth: "120px" }, noWrap: true }, title), status.value !== "publish" && /* @__PURE__ */ React.createElement(Typography, { component: "span", variant: "body2", sx: { fontStyle: "italic" } }, "(", status.label, ")")));
45
45
  }
46
46
  function Tooltip(props) {
47
47
  return /* @__PURE__ */ React.createElement(
@@ -50,7 +50,7 @@ function Tooltip(props) {
50
50
  PopperProps: {
51
51
  sx: {
52
52
  "&.MuiTooltip-popper .MuiTooltip-tooltip.MuiTooltip-tooltipPlacementBottom": {
53
- mt: 7
53
+ mt: 2.7
54
54
  }
55
55
  }
56
56
  },
@@ -108,13 +108,13 @@ function DocTypeChip({ postType, docType, label }) {
108
108
  Chip,
109
109
  {
110
110
  component: "span",
111
- size: "medium",
111
+ size: "small",
112
112
  variant: "standard",
113
113
  label,
114
114
  "data-value": docType,
115
115
  color,
116
116
  icon: /* @__PURE__ */ React2.createElement(Icon, null),
117
- sx: { ml: 3, cursor: "inherit" }
117
+ sx: { ml: 1, cursor: "inherit" }
118
118
  }
119
119
  );
120
120
  }
@@ -122,7 +122,7 @@ function DocTypeChip({ postType, docType, label }) {
122
122
  // src/components/top-bar/post-list-item.tsx
123
123
  import { MenuItem, ListItemText } from "@elementor/ui";
124
124
  import * as React3 from "react";
125
- import { useNavigateToDocument } from "@elementor/editor-documents";
125
+ import { __useNavigateToDocument as useNavigateToDocument } from "@elementor/editor-documents";
126
126
 
127
127
  // src/hooks/use-reverse-html-entities.ts
128
128
  import { useMemo } from "react";
@@ -197,7 +197,7 @@ async function addNewPage() {
197
197
  // src/components/top-bar/create-post-list-item.tsx
198
198
  import { PlusIcon } from "@elementor/icons";
199
199
  import { __ } from "@wordpress/i18n";
200
- import { useNavigateToDocument as useNavigateToDocument2 } from "@elementor/editor-documents";
200
+ import { __useNavigateToDocument as useNavigateToDocument2 } from "@elementor/editor-documents";
201
201
  function CreatePostListItem({ closePopup, ...props }) {
202
202
  const { create, isLoading } = useCreatePage();
203
203
  const navigateToDocument = useNavigateToDocument2();
@@ -249,10 +249,9 @@ function RecentlyEdited() {
249
249
  Menu,
250
250
  {
251
251
  MenuListProps: {
252
- dense: true,
253
- subheader: /* @__PURE__ */ React5.createElement(ListSubheader, { sx: { fontStyle: "italic", fontWeight: "300" } }, __2("Recent", "elementor"))
252
+ subheader: /* @__PURE__ */ React5.createElement(ListSubheader, { color: "primary", sx: { fontStyle: "italic", fontWeight: "300" } }, __2("Recent", "elementor"))
254
253
  },
255
- PaperProps: { sx: { mt: 4, width: 320 } },
254
+ PaperProps: { sx: { mt: 2.5, width: 320 } },
256
255
  ...bindMenu(popupState)
257
256
  },
258
257
  recentPosts.map((post) => /* @__PURE__ */ React5.createElement(PostListItem, { key: post.id, post, closePopup: popupState.close })),
@@ -279,7 +278,7 @@ import { __ as __15 } from "@wordpress/i18n";
279
278
  import { PagesIcon } from "@elementor/icons";
280
279
 
281
280
  // src/components/panel/panel.ts
282
- import { createPanel } from "@elementor/editor-panels";
281
+ import { __createPanel } from "@elementor/editor-panels";
283
282
 
284
283
  // src/components/panel/shell.tsx
285
284
  import * as React23 from "react";
@@ -579,7 +578,7 @@ function ListItemRename({ post }) {
579
578
  // src/components/panel/posts-list/list-items/list-item-create.tsx
580
579
  import * as React10 from "react";
581
580
  import { __ as __5 } from "@wordpress/i18n";
582
- import { useNavigateToDocument as useNavigateToDocument3 } from "@elementor/editor-documents";
581
+ import { __useNavigateToDocument as useNavigateToDocument3 } from "@elementor/editor-documents";
583
582
  function ListItemCreate() {
584
583
  const { type, resetEditMode } = usePostListContext();
585
584
  const { createPost } = usePostActions(type);
@@ -601,7 +600,7 @@ function ListItemCreate() {
601
600
  // src/components/panel/posts-list/list-items/list-item-duplicate.tsx
602
601
  import * as React11 from "react";
603
602
  import { __ as __6 } from "@wordpress/i18n";
604
- import { useNavigateToDocument as useNavigateToDocument4 } from "@elementor/editor-documents";
603
+ import { __useNavigateToDocument as useNavigateToDocument4 } from "@elementor/editor-documents";
605
604
  function ListItemDuplicate() {
606
605
  const { type, editMode, resetEditMode } = usePostListContext();
607
606
  const navigateToDocument = useNavigateToDocument4();
@@ -638,7 +637,7 @@ import {
638
637
  usePopupState as usePopupState2
639
638
  } from "@elementor/ui";
640
639
  import { DotsVerticalIcon, HomeIcon as HomeIcon2 } from "@elementor/icons";
641
- import { useActiveDocument as useActiveDocument3, useNavigateToDocument as useNavigateToDocument5 } from "@elementor/editor-documents";
640
+ import { __useActiveDocument as useActiveDocument3, __useNavigateToDocument as useNavigateToDocument5 } from "@elementor/editor-documents";
642
641
 
643
642
  // src/components/shared/page-title-and-status.tsx
644
643
  import * as React12 from "react";
@@ -772,7 +771,7 @@ import {
772
771
  Divider as Divider3
773
772
  } from "@elementor/ui";
774
773
  import { useState as useState6 } from "react";
775
- import { useActiveDocument as useActiveDocument2 } from "@elementor/editor-documents";
774
+ import { __useActiveDocument as useActiveDocument2 } from "@elementor/editor-documents";
776
775
  function Delete({ post }) {
777
776
  const [isDialogOpen, setIsDialogOpen] = useState6(false);
778
777
  const activeDocument = useActiveDocument2();
@@ -1068,7 +1067,7 @@ var {
1068
1067
  panel,
1069
1068
  usePanelStatus,
1070
1069
  usePanelActions
1071
- } = createPanel({
1070
+ } = __createPanel({
1072
1071
  id: "site-navigation-panel",
1073
1072
  component: shell_default
1074
1073
  });
@@ -1087,7 +1086,7 @@ function useToggleButtonProps() {
1087
1086
  }
1088
1087
 
1089
1088
  // src/init.ts
1090
- import { registerPanel } from "@elementor/editor-panels";
1089
+ import { __registerPanel } from "@elementor/editor-panels";
1091
1090
 
1092
1091
  // src/env.ts
1093
1092
  import { parseEnv } from "@elementor/env";
@@ -1099,7 +1098,7 @@ var { env, validateEnv } = parseEnv("@elementor/editor-site-navigation", (envDat
1099
1098
  function init() {
1100
1099
  registerTopBarMenuItems();
1101
1100
  if (env.is_pages_panel_active) {
1102
- registerPanel(panel);
1101
+ __registerPanel(panel);
1103
1102
  registerButton();
1104
1103
  }
1105
1104
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elementor/editor-site-navigation",
3
- "version": "0.18.4",
3
+ "version": "0.19.1",
4
4
  "private": false,
5
5
  "author": "Elementor Team",
6
6
  "homepage": "https://elementor.com/",
@@ -32,10 +32,10 @@
32
32
  "dev": "tsup --config=../../tsup.dev.ts"
33
33
  },
34
34
  "dependencies": {
35
- "@elementor/editor-app-bar": "^0.7.3",
36
- "@elementor/editor-documents": "^0.8.3",
37
- "@elementor/editor-panels": "^0.2.1",
38
- "@elementor/env": "^0.2.0",
35
+ "@elementor/editor-app-bar": "^0.9.0",
36
+ "@elementor/editor-documents": "^0.10.0",
37
+ "@elementor/editor-panels": "^0.4.0",
38
+ "@elementor/env": "^0.3.0",
39
39
  "@elementor/icons": "^0.7.0",
40
40
  "@elementor/query": "^0.1.1",
41
41
  "@elementor/ui": "^1.4.53",
@@ -49,5 +49,5 @@
49
49
  "elementor": {
50
50
  "type": "extension"
51
51
  },
52
- "gitHead": "dd77d56ac1157b6287657ae652f1579e1f362b49"
52
+ "gitHead": "7fe9af3ba0569f3003d2aa148cb4ad0bdf1c419e"
53
53
  }
@@ -14,7 +14,7 @@ jest.mock( '../../../../../hooks/use-posts-actions', () => ( {
14
14
  } ) );
15
15
 
16
16
  jest.mock( '@elementor/editor-documents', () => ( {
17
- useActiveDocument: jest.fn(),
17
+ __useActiveDocument: jest.fn(),
18
18
  } ) );
19
19
 
20
20
  describe( '@elementor/editor-site-navigation/pages-panel-actions - Delete', () => {
@@ -16,7 +16,7 @@ import {
16
16
  } from '@elementor/ui';
17
17
  import { usePostListContext } from '../../../../contexts/post-list-context';
18
18
  import { useState } from 'react';
19
- import { useActiveDocument } from '@elementor/editor-documents';
19
+ import { __useActiveDocument as useActiveDocument } from '@elementor/editor-documents';
20
20
 
21
21
  export default function Delete( { post }: { post: Post } ) {
22
22
  const [ isDialogOpen, setIsDialogOpen ] = useState( false );
@@ -1,11 +1,11 @@
1
- import { createPanel } from '@elementor/editor-panels';
1
+ import { __createPanel } from '@elementor/editor-panels';
2
2
  import Shell from './shell';
3
3
 
4
4
  export const {
5
5
  panel,
6
6
  usePanelStatus,
7
7
  usePanelActions,
8
- } = createPanel( {
8
+ } = __createPanel( {
9
9
  id: 'site-navigation-panel',
10
10
  component: Shell,
11
11
  } );
@@ -2,7 +2,7 @@ import * as React from 'react';
2
2
  import { act, fireEvent, screen, waitFor } from '@testing-library/react';
3
3
  import { Post } from '../../../../types';
4
4
  import PostListItem from '../post-list-item';
5
- import { useNavigateToDocument } from '@elementor/editor-documents';
5
+ import { __useNavigateToDocument as useNavigateToDocument } from '@elementor/editor-documents';
6
6
  import { renderWithQuery } from 'test-utils';
7
7
  import { PostListContextProvider } from '../../../../contexts/post-list-context';
8
8
 
@@ -17,8 +17,8 @@ jest.mock( '../../../../hooks/use-posts-actions', () => ( {
17
17
  } ) );
18
18
 
19
19
  jest.mock( '@elementor/editor-documents', () => ( {
20
- useActiveDocument: jest.fn(),
21
- useNavigateToDocument: jest.fn(),
20
+ __useActiveDocument: jest.fn(),
21
+ __useNavigateToDocument: jest.fn(),
22
22
  } ) );
23
23
 
24
24
  describe( '@elementor/editor-site-navigation - PostListItem', () => {
@@ -1,8 +1,9 @@
1
1
  import * as React from 'react';
2
2
  import { fireEvent, screen, waitFor } from '@testing-library/react';
3
3
  import PostsCollapsibleList from '../posts-collapsible-list';
4
- import { renderWithQuery } from 'test-utils';
4
+ import { createMockDocument, renderWithQuery } from 'test-utils';
5
5
  import { PostListContextProvider } from '../../../../contexts/post-list-context';
6
+ import { __useActiveDocument as useActiveDocument } from '@elementor/editor-documents';
6
7
 
7
8
  const mockMutateAsync = jest.fn();
8
9
  jest.mock( '../../../../hooks/use-posts-actions', () => ( {
@@ -41,14 +42,17 @@ jest.mock( '../../../../hooks/use-homepage', () => ( {
41
42
  } ) );
42
43
 
43
44
  jest.mock( '@elementor/editor-documents', () => ( {
44
- __esModule: true,
45
- useActiveDocument: jest.fn( () => ( {
46
- id: 2,
47
- } ) ),
48
- useNavigateToDocument: jest.fn(),
45
+ __useActiveDocument: jest.fn(),
46
+ __useNavigateToDocument: jest.fn(),
49
47
  } ) );
50
48
 
51
49
  describe( '@elementor/editor-site-navigation - PostsCollapsibleList', () => {
50
+ beforeEach( () => {
51
+ jest.mocked( useActiveDocument ).mockReturnValue( createMockDocument( ( {
52
+ id: 2,
53
+ } ) ) );
54
+ } );
55
+
52
56
  afterEach( () => {
53
57
  jest.clearAllMocks();
54
58
  } );
@@ -3,7 +3,7 @@ import { __ } from '@wordpress/i18n';
3
3
  import { usePostListContext } from '../../../../contexts/post-list-context';
4
4
  import { usePostActions } from '../../../../hooks/use-posts-actions';
5
5
  import EditModeTemplate from './edit-mode-template';
6
- import { useNavigateToDocument } from '@elementor/editor-documents';
6
+ import { __useNavigateToDocument as useNavigateToDocument } from '@elementor/editor-documents';
7
7
 
8
8
  export default function ListItemCreate() {
9
9
  const { type, resetEditMode } = usePostListContext();
@@ -3,7 +3,7 @@ import { __ } from '@wordpress/i18n';
3
3
  import { usePostListContext } from '../../../../contexts/post-list-context';
4
4
  import { usePostActions } from '../../../../hooks/use-posts-actions';
5
5
  import EditModeTemplate from './edit-mode-template';
6
- import { useNavigateToDocument } from '@elementor/editor-documents';
6
+ import { __useNavigateToDocument as useNavigateToDocument } from '@elementor/editor-documents';
7
7
 
8
8
  export default function ListItemDuplicate() {
9
9
  const { type, editMode, resetEditMode } = usePostListContext();
@@ -12,7 +12,7 @@ import {
12
12
  usePopupState,
13
13
  } from '@elementor/ui';
14
14
  import { DotsVerticalIcon, HomeIcon } from '@elementor/icons';
15
- import { useActiveDocument, useNavigateToDocument } from '@elementor/editor-documents';
15
+ import { __useActiveDocument as useActiveDocument, __useNavigateToDocument as useNavigateToDocument } from '@elementor/editor-documents';
16
16
  import PageTitleAndStatus from '../../../shared/page-title-and-status';
17
17
  import Rename from '../../actions-menu/actions/rename';
18
18
  import Duplicate from '../../actions-menu/actions/duplicate';
@@ -1,45 +1,34 @@
1
1
  import * as React from 'react';
2
2
  import { fireEvent, render, screen, waitFor } from '@testing-library/react';
3
- import { useHostDocument, useActiveDocument, useNavigateToDocument } from '@elementor/editor-documents';
3
+ import { __useActiveDocument as useActiveDocument, __useNavigateToDocument as useNavigateToDocument } from '@elementor/editor-documents';
4
4
  import RecentlyEdited from '../recently-edited';
5
5
  import { createMockDocument } from 'test-utils';
6
6
  import useRecentPosts, { Post } from '../../../hooks/use-recent-posts';
7
7
  import useCreatePage from '../../../hooks/use-create-page';
8
8
 
9
9
  jest.mock( '@elementor/editor-documents', () => ( {
10
- useActiveDocument: jest.fn(),
11
- useHostDocument: jest.fn(),
12
- useNavigateToDocument: jest.fn(),
10
+ __useActiveDocument: jest.fn(),
11
+ __useHostDocument: jest.fn(),
12
+ __useNavigateToDocument: jest.fn(),
13
13
  } ) );
14
14
 
15
- jest.mock( '../../../hooks/use-recent-posts', () => (
16
- {
17
- default: jest.fn( () => ( { isLoading: false, recentPosts: [] } ) ),
18
- __esModule: true,
19
- }
20
- ) );
21
- jest.mock( '../../../hooks/use-create-page', () => (
22
- {
23
- default: jest.fn( () => ( { create: jest.fn(), isLoading: false } ) ),
24
- __esModule: true,
25
- }
26
- ) );
15
+ jest.mock( '../../../hooks/use-recent-posts', () => ( {
16
+ __esModule: true,
17
+ default: jest.fn( () => ( { isLoading: false, recentPosts: [] } ) ),
18
+ } ) );
19
+
20
+ jest.mock( '../../../hooks/use-create-page', () => ( {
21
+ __esModule: true,
22
+ default: jest.fn( () => ( { create: jest.fn(), isLoading: false } ) ),
23
+ } ) );
27
24
 
28
25
  describe( '@elementor/recently-edited - Top bar add new page', () => {
29
26
  beforeEach( () => {
30
- jest.mocked( useActiveDocument ).mockImplementation( () =>
31
- createMockDocument( { id: 1, title: 'Active Document' } )
32
- );
33
-
34
- jest.mocked( useHostDocument ).mockImplementation( () =>
35
- createMockDocument( { id: 2, title: 'Host Document' } )
36
- );
27
+ jest.mocked( useActiveDocument ).mockReturnValue( createMockDocument() );
37
28
  } );
38
29
 
39
30
  it( 'should render add new page button', () => {
40
31
  // Arrange.
41
- mockActiveDocument();
42
-
43
32
  const isLoading = false;
44
33
  const recentPosts: Post[] = [];
45
34
 
@@ -58,8 +47,6 @@ describe( '@elementor/recently-edited - Top bar add new page', () => {
58
47
 
59
48
  it( 'should trigger create page hook on click', async () => {
60
49
  // Arrange.
61
- mockActiveDocument();
62
-
63
50
  const isLoading = false;
64
51
  const recentPosts: Post[] = [];
65
52
  const create = jest.fn().mockReturnValue( Promise.resolve( { id: 123 } ) );
@@ -86,16 +73,3 @@ describe( '@elementor/recently-edited - Top bar add new page', () => {
86
73
  expect( navigateToDocument ).toHaveBeenCalledWith( 123 );
87
74
  } );
88
75
  } );
89
-
90
- function mockActiveDocument() {
91
- jest.mocked( useActiveDocument ).mockImplementation( () =>
92
- createMockDocument( {
93
- id: 1,
94
- title: 'Header',
95
- type: {
96
- value: 'header',
97
- label: 'Header',
98
- },
99
- } )
100
- );
101
- }
@@ -1,14 +1,14 @@
1
1
  import * as React from 'react';
2
2
  import { fireEvent, render, screen } from '@testing-library/react';
3
- import { useHostDocument, useActiveDocument, useNavigateToDocument } from '@elementor/editor-documents';
3
+ import { __useHostDocument as useHostDocument, __useActiveDocument as useActiveDocument, __useNavigateToDocument as useNavigateToDocument } from '@elementor/editor-documents';
4
4
  import RecentlyEdited from '../recently-edited';
5
5
  import { createMockDocument } from 'test-utils';
6
6
  import useRecentPosts, { Post } from '../../../hooks/use-recent-posts';
7
7
 
8
8
  jest.mock( '@elementor/editor-documents', () => ( {
9
- useActiveDocument: jest.fn(),
10
- useHostDocument: jest.fn(),
11
- useNavigateToDocument: jest.fn(),
9
+ __useActiveDocument: jest.fn(),
10
+ __useHostDocument: jest.fn(),
11
+ __useNavigateToDocument: jest.fn(),
12
12
  } ) );
13
13
 
14
14
  jest.mock( '../../../hooks/use-recent-posts', () => (
@@ -19,17 +19,13 @@ jest.mock( '../../../hooks/use-recent-posts', () => (
19
19
  ) );
20
20
 
21
21
  describe( '@elementor/recently-edited - Top bar Recently Edited', () => {
22
- beforeEach( () => {
23
- jest.mocked( useActiveDocument ).mockImplementation( () =>
24
- createMockDocument( { id: 1, title: 'Active Document' } )
25
- );
26
-
27
- jest.mocked( useHostDocument ).mockImplementation( () =>
28
- createMockDocument( { id: 2, title: 'Host Document' } )
29
- );
30
- } );
31
-
32
22
  it( 'should show the title of the active document without its status when the document is published', async () => {
23
+ // Arrange.
24
+ jest.mocked( useActiveDocument ).mockReturnValue( createMockDocument( {
25
+ id: 1,
26
+ title: 'Active Document',
27
+ } ) );
28
+
33
29
  // Act.
34
30
  render( <RecentlyEdited /> );
35
31
 
@@ -40,16 +36,14 @@ describe( '@elementor/recently-edited - Top bar Recently Edited', () => {
40
36
 
41
37
  it( 'should show the title of the active document with its status when the document is not published', async () => {
42
38
  // Arrange.
43
- jest.mocked( useActiveDocument ).mockImplementation( () =>
44
- createMockDocument( {
45
- id: 1,
46
- title: 'Active Document',
47
- status: {
48
- value: 'draft',
49
- label: 'Draft',
50
- },
51
- } )
52
- );
39
+ jest.mocked( useActiveDocument ).mockReturnValue( createMockDocument( {
40
+ id: 1,
41
+ title: 'Active Document',
42
+ status: {
43
+ value: 'draft',
44
+ label: 'Draft',
45
+ },
46
+ } ) );
53
47
 
54
48
  // Act.
55
49
  render( <RecentlyEdited /> );
@@ -61,7 +55,12 @@ describe( '@elementor/recently-edited - Top bar Recently Edited', () => {
61
55
 
62
56
  it( 'should show the title of the host document when there is no active document', () => {
63
57
  // Arrange.
64
- jest.mocked( useActiveDocument ).mockImplementation( () => null );
58
+ jest.mocked( useActiveDocument ).mockReturnValue( null );
59
+
60
+ jest.mocked( useHostDocument ).mockReturnValue( createMockDocument( {
61
+ id: 1,
62
+ title: 'Host Document',
63
+ } ) );
65
64
 
66
65
  // Act.
67
66
  render( <RecentlyEdited /> );
@@ -72,17 +71,19 @@ describe( '@elementor/recently-edited - Top bar Recently Edited', () => {
72
71
 
73
72
  it( 'should show the title of the host document when the active document is kit', () => {
74
73
  // Arrange.
74
+ jest.mocked( useActiveDocument ).mockReturnValue( createMockDocument( {
75
+ id: 1,
76
+ title: 'Active Document',
77
+ type: {
78
+ value: 'kit',
79
+ label: 'Kit',
80
+ },
81
+ } ) );
75
82
 
76
- jest.mocked( useActiveDocument ).mockImplementation( () =>
77
- createMockDocument( {
78
- id: 1,
79
- title: 'Active Document',
80
- type: {
81
- value: 'kit',
82
- label: 'Kit',
83
- },
84
- } )
85
- );
83
+ jest.mocked( useHostDocument ).mockReturnValue( createMockDocument( {
84
+ id: 2,
85
+ title: 'Host Document',
86
+ } ) );
86
87
 
87
88
  // Act.
88
89
  render( <RecentlyEdited /> );
@@ -93,8 +94,8 @@ describe( '@elementor/recently-edited - Top bar Recently Edited', () => {
93
94
 
94
95
  it( 'should show nothing if there are no documents', () => {
95
96
  // Arrange.
96
- jest.mocked( useActiveDocument ).mockImplementation( () => null );
97
- jest.mocked( useHostDocument ).mockImplementation( () => null );
97
+ jest.mocked( useActiveDocument ).mockReturnValue( null );
98
+ jest.mocked( useHostDocument ).mockReturnValue( null );
98
99
 
99
100
  // Act.
100
101
  render( <RecentlyEdited /> );
@@ -106,16 +107,14 @@ describe( '@elementor/recently-edited - Top bar Recently Edited', () => {
106
107
 
107
108
  it( 'should show empty state', () => {
108
109
  // Arrange.
109
- jest.mocked( useActiveDocument ).mockImplementation( () =>
110
- createMockDocument( {
111
- id: 1,
112
- title: 'Header',
113
- type: {
114
- value: 'header',
115
- label: 'Header',
116
- },
117
- } )
118
- );
110
+ jest.mocked( useActiveDocument ).mockReturnValue( createMockDocument( {
111
+ id: 1,
112
+ title: 'Header',
113
+ type: {
114
+ value: 'header',
115
+ label: 'Header',
116
+ },
117
+ } ) );
119
118
 
120
119
  const isLoading = false;
121
120
  const recentPosts: Post[] = [];
@@ -135,16 +134,14 @@ describe( '@elementor/recently-edited - Top bar Recently Edited', () => {
135
134
 
136
135
  it( 'should open the recently edited menu on click', () => {
137
136
  // Arrange.
138
- jest.mocked( useActiveDocument ).mockImplementation( () =>
139
- createMockDocument( {
140
- id: 1,
141
- title: 'Header',
142
- type: {
143
- value: 'header',
144
- label: 'Header',
145
- },
146
- } )
147
- );
137
+ jest.mocked( useActiveDocument ).mockReturnValue( createMockDocument( {
138
+ id: 1,
139
+ title: 'Header',
140
+ type: {
141
+ value: 'header',
142
+ label: 'Header',
143
+ },
144
+ } ) );
148
145
 
149
146
  const isLoading = false;
150
147
  const recentPosts: Post[] = [ {
@@ -179,16 +176,14 @@ describe( '@elementor/recently-edited - Top bar Recently Edited', () => {
179
176
 
180
177
  it( 'should render titles with HTML entities', () => {
181
178
  // Arrange.
182
- jest.mocked( useActiveDocument ).mockImplementation( () =>
183
- createMockDocument( {
184
- id: 1,
185
- title: 'Header title with special char &#165;',
186
- type: {
187
- value: 'header',
188
- label: 'Header',
189
- },
190
- } )
191
- );
179
+ jest.mocked( useActiveDocument ).mockReturnValue( createMockDocument( {
180
+ id: 1,
181
+ title: 'Header title with special char &#165;',
182
+ type: {
183
+ value: 'header',
184
+ label: 'Header',
185
+ },
186
+ } ) );
192
187
 
193
188
  const isLoading = false;
194
189
  const recentPosts: Post[] = [
@@ -20,13 +20,13 @@ export default function DocTypeChip( { postType, docType, label }: Props ) {
20
20
  return (
21
21
  <Chip
22
22
  component="span"
23
- size="medium"
23
+ size="small"
24
24
  variant="standard"
25
25
  label={ label }
26
26
  data-value={ docType }
27
27
  color={ color }
28
28
  icon={ <Icon /> }
29
- sx={ { ml: 3, cursor: 'inherit' } }
29
+ sx={ { ml: 1, cursor: 'inherit' } }
30
30
  />
31
31
  );
32
32
  }
@@ -3,7 +3,7 @@ import * as React from 'react';
3
3
  import useCreatePage from '../../hooks/use-create-page';
4
4
  import { PlusIcon } from '@elementor/icons';
5
5
  import { __ } from '@wordpress/i18n';
6
- import { useNavigateToDocument } from '@elementor/editor-documents';
6
+ import { __useNavigateToDocument as useNavigateToDocument } from '@elementor/editor-documents';
7
7
 
8
8
  type Props = MenuItemProps & {
9
9
  closePopup: () => void;
@@ -10,7 +10,7 @@ type Props = {
10
10
  export default function Indicator( { title, status }: Props ) {
11
11
  return (
12
12
  <Tooltip title={ title }>
13
- <Stack component="span" direction="row" alignItems="center" spacing={ 2 }>
13
+ <Stack component="span" direction="row" alignItems="center" spacing={ 0.5 }>
14
14
  <Typography component="span" variant="body2" sx={ { maxWidth: '120px' } } noWrap>
15
15
  { title }
16
16
  </Typography>
@@ -29,7 +29,7 @@ function Tooltip( props: TooltipProps ) {
29
29
  PopperProps={ {
30
30
  sx: {
31
31
  '&.MuiTooltip-popper .MuiTooltip-tooltip.MuiTooltip-tooltipPlacementBottom': {
32
- mt: 7,
32
+ mt: 2.7,
33
33
  },
34
34
  },
35
35
  } }
@@ -2,7 +2,7 @@ import DocTypeChip from './chip-doc-type';
2
2
  import { MenuItem, MenuItemProps, ListItemText } from '@elementor/ui';
3
3
  import * as React from 'react';
4
4
  import { Post } from '../../hooks/use-recent-posts';
5
- import { useNavigateToDocument } from '@elementor/editor-documents';
5
+ import { __useNavigateToDocument as useNavigateToDocument } from '@elementor/editor-documents';
6
6
  import { useReverseHtmlEntities } from '../../hooks/use-reverse-html-entities';
7
7
 
8
8
  type Props = MenuItemProps & {
@@ -11,7 +11,7 @@ import {
11
11
  MenuItem,
12
12
  } from '@elementor/ui';
13
13
  import { ChevronDownIcon } from '@elementor/icons';
14
- import { useActiveDocument, useHostDocument } from '@elementor/editor-documents';
14
+ import { __useActiveDocument as useActiveDocument, __useHostDocument as useHostDocument } from '@elementor/editor-documents';
15
15
  import Indicator from './indicator';
16
16
  import useRecentPosts from '../../hooks/use-recent-posts';
17
17
  import { __ } from '@wordpress/i18n';
@@ -54,14 +54,13 @@ export default function RecentlyEdited() {
54
54
  </Button>
55
55
  <Menu
56
56
  MenuListProps={ {
57
- dense: true,
58
57
  subheader: (
59
- <ListSubheader sx={ { fontStyle: 'italic', fontWeight: '300' } }>
58
+ <ListSubheader color="primary" sx={ { fontStyle: 'italic', fontWeight: '300' } }>
60
59
  { __( 'Recent', 'elementor' ) }
61
60
  </ListSubheader>
62
61
  ),
63
62
  } }
64
- PaperProps={ { sx: { mt: 4, width: 320 } } }
63
+ PaperProps={ { sx: { mt: 2.5, width: 320 } } }
65
64
  { ...bindMenu( popupState ) }
66
65
  >
67
66
  { recentPosts.map( ( post ) => (
package/src/init.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import RecentlyEdited from './components/top-bar/recently-edited';
2
2
  import { injectIntoPageIndication, toolsMenu } from '@elementor/editor-app-bar';
3
3
  import { useToggleButtonProps } from './hooks/use-toggle-button-props';
4
- import { registerPanel } from '@elementor/editor-panels';
4
+ import { __registerPanel } from '@elementor/editor-panels';
5
5
  import { panel } from './components/panel/panel';
6
6
  import { env } from './env';
7
7
 
@@ -9,7 +9,7 @@ export default function init() {
9
9
  registerTopBarMenuItems();
10
10
  // TODO 06/06/2023 : remove if when we are production ready
11
11
  if ( env.is_pages_panel_active ) {
12
- registerPanel( panel );
12
+ __registerPanel( panel );
13
13
  registerButton();
14
14
  }
15
15
  }