@eeacms/volto-eea-website-theme 3.19.0 → 4.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (113) hide show
  1. package/.eslintrc.js +7 -6
  2. package/CHANGELOG.md +28 -0
  3. package/DEVELOP.md +19 -17
  4. package/README.md +27 -15
  5. package/docker-compose.yml +1 -1
  6. package/jest-addon.config.js +8 -4
  7. package/package.json +1 -1
  8. package/src/actions/navigation.js +1 -1
  9. package/src/components/manage/Blocks/ContextNavigation/ContextNavigationEdit.jsx +4 -2
  10. package/src/components/manage/Blocks/ContextNavigation/ContextNavigationEdit.test.jsx +25 -19
  11. package/src/components/manage/Blocks/ContextNavigation/ContextNavigationView.jsx +2 -1
  12. package/src/components/manage/Blocks/ContextNavigation/ContextNavigationView.test.jsx +6 -4
  13. package/src/components/manage/Blocks/ContextNavigation/variations/Accordion.jsx +2 -2
  14. package/src/components/manage/Blocks/ContextNavigation/variations/ReportNavigation.jsx +4 -2
  15. package/src/components/manage/Blocks/ContextNavigation/variations/ReportNavigation.test.jsx +1 -1
  16. package/src/components/manage/Blocks/GroupBlockTemplate/FlexGroup/FlexGroup.jsx +12 -44
  17. package/src/components/manage/Blocks/GroupBlockTemplate/FlexGroup/RenderBlocks.jsx +5 -4
  18. package/src/components/manage/Blocks/GroupBlockTemplate/FlexGroup/editor-flex.less +45 -4
  19. package/src/components/manage/Blocks/LayoutSettings/LayoutSettingsEdit.jsx +2 -1
  20. package/src/components/manage/Blocks/LayoutSettings/LayoutSettingsEdit.test.jsx +12 -4
  21. package/src/components/manage/Blocks/LayoutSettings/LayoutSettingsView.jsx +1 -1
  22. package/src/components/manage/Blocks/Title/Edit.jsx +3 -3
  23. package/src/components/manage/Blocks/Title/View.jsx +2 -1
  24. package/src/components/manage/Blocks/Title/variations/WebReport.jsx +2 -2
  25. package/src/components/manage/Blocks/Title/variations/WebReport.test.jsx +6 -4
  26. package/src/components/manage/Blocks/Title/variations/WebReportPage.jsx +2 -2
  27. package/src/components/manage/Blocks/Title/variations/WebReportPage.test.jsx +6 -4
  28. package/src/components/theme/Banner/View.jsx +1 -1
  29. package/src/components/theme/BaseTag.jsx +2 -1
  30. package/src/components/theme/BaseTag.test.jsx +7 -2
  31. package/src/components/theme/DraftBackground/DraftBackground.jsx +2 -1
  32. package/src/components/theme/Homepage/HomePageInverseView.jsx +3 -3
  33. package/src/components/theme/Homepage/HomePageInverseView.test.jsx +1 -1
  34. package/src/components/theme/Homepage/HomePageView.jsx +3 -3
  35. package/src/components/theme/Homepage/HomePageView.test.jsx +1 -1
  36. package/src/components/theme/Logo.jsx +3 -3
  37. package/src/components/theme/NotFound/GoneView.jsx +3 -2
  38. package/src/components/theme/NotFound/GoneView.test.jsx +5 -4
  39. package/src/components/theme/NotFound/NotFound.jsx +1 -1
  40. package/src/components/theme/NotFound/NotFound.test.jsx +3 -2
  41. package/src/components/theme/PrintLoader/PrintLoader.test.jsx +1 -1
  42. package/src/components/theme/SubsiteClass.jsx +6 -4
  43. package/src/components/theme/SubsiteClass.test.jsx +3 -2
  44. package/src/components/theme/WebReport/WebReportSectionView.jsx +2 -2
  45. package/src/components/theme/WebReport/WebReportSectionView.test.jsx +10 -5
  46. package/src/components/theme/Widgets/ADUserGroupSelectWidget.jsx +2 -2
  47. package/src/components/theme/Widgets/ContributorsViewWidget.jsx +1 -1
  48. package/src/components/theme/Widgets/CreatableSelectWidget.jsx +7 -4
  49. package/src/components/theme/Widgets/CreatorsViewWidget.jsx +1 -1
  50. package/src/components/theme/Widgets/DateWidget.jsx +1 -1
  51. package/src/components/theme/Widgets/DateWidget.test.js +1 -1
  52. package/src/components/theme/Widgets/DatetimeWidget.jsx +1 -1
  53. package/src/components/theme/Widgets/DatetimeWidget.test.js +1 -1
  54. package/src/components/theme/Widgets/ImageViewWidget.jsx +1 -0
  55. package/src/components/theme/Widgets/NavigationBehaviorWidget.jsx +7 -3
  56. package/src/components/theme/Widgets/NavigationBehaviorWidget.test.jsx +51 -46
  57. package/src/components/theme/Widgets/UserSelectWidget.jsx +13 -10
  58. package/src/customizations/@plone/volto-slate/blocks/Table/TableBlockView.jsx +3 -3
  59. package/src/customizations/@plone/volto-slate/blocks/Text/TextBlockView.jsx +2 -2
  60. package/src/customizations/@plone/volto-slate/editor/SlateEditor.jsx +23 -10
  61. package/src/customizations/@plone/volto-slate/editor/render.jsx +7 -3
  62. package/src/customizations/@plone/volto-slate/utils/blocks.js +11 -8
  63. package/src/customizations/volto/components/manage/Blocks/Grid/View.jsx +2 -2
  64. package/src/customizations/volto/components/manage/Blocks/Image/Edit.jsx +30 -27
  65. package/src/customizations/volto/components/manage/Blocks/Image/Edit.test.jsx +244 -246
  66. package/src/customizations/volto/components/manage/Blocks/Image/View.jsx +23 -25
  67. package/src/customizations/volto/components/manage/Blocks/LeadImage/Edit.jsx +6 -4
  68. package/src/customizations/volto/components/manage/Blocks/LeadImage/LeadImageSidebar.jsx +4 -2
  69. package/src/customizations/volto/components/manage/Blocks/LeadImage/View.jsx +2 -2
  70. package/src/customizations/volto/components/manage/Controlpanels/Groups/RenderGroups.jsx +1 -1
  71. package/src/customizations/volto/components/manage/Controlpanels/Groups/RenderGroups.test.jsx +108 -42
  72. package/src/customizations/volto/components/manage/Diff/DiffField.jsx +4 -3
  73. package/src/customizations/volto/components/manage/Display/Display.jsx +8 -7
  74. package/src/customizations/volto/components/manage/History/History.jsx +58 -52
  75. package/src/customizations/volto/components/manage/Sidebar/ObjectBrowserBody.jsx +42 -21
  76. package/src/customizations/volto/components/manage/Sidebar/ObjectBrowserNav.jsx +2 -1
  77. package/src/customizations/volto/components/manage/Sidebar/SidebarPopup.jsx +46 -24
  78. package/src/customizations/volto/components/manage/Sidebar/objectBrowserSelection.js +58 -0
  79. package/src/customizations/volto/components/manage/Toolbar/More.jsx +8 -10
  80. package/src/customizations/volto/components/manage/Widgets/NumberWidget.jsx +1 -1
  81. package/src/customizations/volto/components/manage/Widgets/NumberWidget.test.jsx +6 -1
  82. package/src/customizations/volto/components/manage/Widgets/ObjectBrowserWidget.jsx +66 -12
  83. package/src/customizations/volto/components/manage/Workflow/Workflow.jsx +10 -9
  84. package/src/customizations/volto/components/theme/Breadcrumbs/Breadcrumbs.jsx +3 -2
  85. package/src/customizations/volto/components/theme/Comments/Comments.jsx +9 -8
  86. package/src/customizations/volto/components/theme/Comments/Comments.test.jsx +29 -7
  87. package/src/customizations/volto/components/theme/ContactForm/ContactForm.jsx +1 -1
  88. package/src/customizations/volto/components/theme/ContactForm/ContactForm.test.js +5 -0
  89. package/src/customizations/volto/components/theme/ContentMetadataTags/ContentMetadataTags.jsx +5 -7
  90. package/src/customizations/volto/components/theme/EventDetails/EventDetails.jsx +2 -2
  91. package/src/customizations/volto/components/theme/Footer/Footer.jsx +1 -1
  92. package/src/customizations/volto/components/theme/Header/Header.jsx +10 -8
  93. package/src/customizations/volto/components/theme/Header/Header.test.jsx +1 -1
  94. package/src/customizations/volto/components/theme/Header/LanguageSwitcher.jsx +3 -3
  95. package/src/customizations/volto/components/theme/Image/Image.jsx +4 -3
  96. package/src/customizations/volto/components/theme/Unauthorized/Unauthorized.jsx +1 -1
  97. package/src/customizations/volto/components/theme/View/DefaultView.jsx +4 -3
  98. package/src/customizations/volto/components/theme/View/EventView.jsx +3 -2
  99. package/src/customizations/volto/helpers/Html/Html.jsx +16 -6
  100. package/src/customizations/volto/helpers/Html/Readme.md +7 -1
  101. package/src/customizations/volto/reducers/breadcrumbs/breadcrumbs.js +3 -6
  102. package/src/customizations/volto/server.jsx +10 -10
  103. package/src/helpers/schema-utils.js +1 -1
  104. package/src/helpers/schema-utils.test.js +1 -1
  105. package/src/hocs/withErrorBoundary.jsx +1 -1
  106. package/src/hocs/withErrorBoundary.test.jsx +4 -11
  107. package/src/hocs/withRootNavigation.jsx +3 -2
  108. package/src/hocs/withRootNavigation.test.jsx +18 -14
  109. package/src/index.js +3 -3
  110. package/src/slate.js +1 -1
  111. package/src/customizations/volto/components/manage/Blocks/LeadImage/AlignChooser.jsx +0 -76
  112. package/src/customizations/volto/components/manage/Blocks/LeadImage/AlignChooser.test.js +0 -50
  113. package/src/customizations/volto/components/manage/Sidebar/SidebarPopup copy.jsx +0 -82
@@ -11,8 +11,9 @@ jest.mock('./schema', () => ({
11
11
  EditSchema: jest.fn(),
12
12
  }));
13
13
 
14
- jest.mock('@plone/volto/components', () => ({
15
- BlockDataForm: jest.fn(({ title, schema, formData, onChangeField }) => (
14
+ jest.mock('@plone/volto/components/manage/Form/BlockDataForm', () => ({
15
+ __esModule: true,
16
+ default: jest.fn(({ title, schema, formData, onChangeField }) => (
16
17
  <div data-testid="block-data-form">
17
18
  <div data-testid="form-title">{title}</div>
18
19
  <div data-testid="form-schema">{JSON.stringify(schema)}</div>
@@ -25,7 +26,11 @@ jest.mock('@plone/volto/components', () => ({
25
26
  </button>
26
27
  </div>
27
28
  )),
28
- SidebarPortal: jest.fn(({ selected, children }) => (
29
+ }));
30
+
31
+ jest.mock('@plone/volto/components/manage/Sidebar/SidebarPortal', () => ({
32
+ __esModule: true,
33
+ default: jest.fn(({ selected, children }) => (
29
34
  <div data-testid="sidebar-portal" data-selected={selected}>
30
35
  {children}
31
36
  </div>
@@ -43,7 +48,10 @@ jest.mock('./LayoutSettingsView', () => ({
43
48
 
44
49
  const mockLayoutSettingsView = require('./LayoutSettingsView').default;
45
50
 
46
- const { BlockDataForm, SidebarPortal } = require('@plone/volto/components');
51
+ const BlockDataForm =
52
+ require('@plone/volto/components/manage/Form/BlockDataForm').default;
53
+ const SidebarPortal =
54
+ require('@plone/volto/components/manage/Sidebar/SidebarPortal').default;
47
55
 
48
56
  describe('LayoutSettingsEdit', () => {
49
57
  const mockSchema = {
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { BodyClass } from '@plone/volto/helpers';
2
+ import BodyClass from '@plone/volto/helpers/BodyClass/BodyClass';
3
3
  import { getVoltoStyles } from '@eeacms/volto-eea-website-theme/helpers/schema-utils';
4
4
  import cx from 'classnames';
5
5
 
@@ -9,8 +9,8 @@ import PropTypes from 'prop-types';
9
9
  import { Editor, createEditor, Transforms, Node, Range } from 'slate';
10
10
  import { ReactEditor, Editable, Slate, withReact } from 'slate-react';
11
11
  import config from '@plone/volto/registry';
12
- import { SidebarPortal } from '@plone/volto/components';
13
- import { BodyClass } from '@plone/volto/helpers';
12
+ import SidebarPortal from '@plone/volto/components/manage/Sidebar/SidebarPortal';
13
+ import BodyClass from '@plone/volto/helpers/BodyClass/BodyClass';
14
14
  import View from '@eeacms/volto-eea-website-theme/components/manage/Blocks/Title/View';
15
15
  import BlockDataForm from '@plone/volto/components/manage/Form/BlockDataForm';
16
16
  import schema from './schema';
@@ -171,7 +171,7 @@ export const TitleBlockEdit = (props) => {
171
171
  banner={{
172
172
  title: {
173
173
  view: (
174
- <Slate editor={editor} onChange={handleChange} value={val}>
174
+ <Slate editor={editor} onChange={handleChange} initialValue={val}>
175
175
  <Editable
176
176
  readOnly={!editable}
177
177
  onKeyDown={handleKeyDown}
@@ -6,7 +6,8 @@
6
6
  import React from 'react';
7
7
 
8
8
  import PropTypes from 'prop-types';
9
- import { withBlockExtensions, BodyClass } from '@plone/volto/helpers';
9
+ import { withBlockExtensions } from '@plone/volto/helpers/Extensions';
10
+ import BodyClass from '@plone/volto/helpers/BodyClass/BodyClass';
10
11
  import DefaultTemplate from './variations/Default';
11
12
 
12
13
  /**
@@ -7,12 +7,12 @@ import React from 'react';
7
7
  import { Portal } from 'react-portal';
8
8
  import PropTypes from 'prop-types';
9
9
 
10
- import { MaybeWrap } from '@plone/volto/components';
10
+ import MaybeWrap from '@plone/volto/components/manage/MaybeWrap/MaybeWrap';
11
11
  import BannerView from '@eeacms/volto-eea-website-theme/components/theme/Banner/View';
12
12
  import Banner from '@eeacms/volto-eea-design-system/ui/Banner/Banner';
13
13
  import clsx from 'clsx';
14
14
 
15
- import { BodyClass } from '@plone/volto/helpers';
15
+ import BodyClass from '@plone/volto/helpers/BodyClass/BodyClass';
16
16
 
17
17
  function IsomorphicPortal({ children }) {
18
18
  const [isClient, setIsClient] = React.useState();
@@ -8,14 +8,16 @@ jest.mock('react-portal', () => ({
8
8
  Portal: ({ children }) => <div data-testid="portal">{children}</div>,
9
9
  }));
10
10
 
11
- jest.mock('@plone/volto/helpers', () => ({
12
- BodyClass: ({ className }) => (
11
+ jest.mock('@plone/volto/helpers/BodyClass/BodyClass', () => ({
12
+ __esModule: true,
13
+ default: ({ className }) => (
13
14
  <div data-testid="body-class" className={className} />
14
15
  ),
15
16
  }));
16
17
 
17
- jest.mock('@plone/volto/components', () => ({
18
- MaybeWrap: ({ condition, as: As, children }) =>
18
+ jest.mock('@plone/volto/components/manage/MaybeWrap/MaybeWrap', () => ({
19
+ __esModule: true,
20
+ default: ({ condition, as: As, children }) =>
19
21
  condition ? <As>{children}</As> : children,
20
22
  }));
21
23
 
@@ -7,11 +7,11 @@ import React from 'react';
7
7
  import { Portal } from 'react-portal';
8
8
  import PropTypes from 'prop-types';
9
9
 
10
- import { MaybeWrap } from '@plone/volto/components';
10
+ import MaybeWrap from '@plone/volto/components/manage/MaybeWrap/MaybeWrap';
11
11
  import BannerView from '@eeacms/volto-eea-website-theme/components/theme/Banner/View';
12
12
  import clsx from 'clsx';
13
13
 
14
- import { BodyClass } from '@plone/volto/helpers';
14
+ import BodyClass from '@plone/volto/helpers/BodyClass/BodyClass';
15
15
 
16
16
  function IsomorphicPortal({ children }) {
17
17
  const [isClient, setIsClient] = React.useState();
@@ -14,8 +14,9 @@ jest.mock('react-portal', () => ({
14
14
  ),
15
15
  }));
16
16
 
17
- jest.mock('@plone/volto/components', () => ({
18
- MaybeWrap: ({ children, condition, as: Component }) =>
17
+ jest.mock('@plone/volto/components/manage/MaybeWrap/MaybeWrap', () => ({
18
+ __esModule: true,
19
+ default: ({ children, condition, as: Component }) =>
19
20
  condition ? <Component>{children}</Component> : <div>{children}</div>,
20
21
  }));
21
22
 
@@ -51,8 +52,9 @@ jest.mock(
51
52
 
52
53
  jest.mock('clsx', () => jest.fn((classes) => classes));
53
54
 
54
- jest.mock('@plone/volto/helpers', () => ({
55
- BodyClass: ({ className }) => (
55
+ jest.mock('@plone/volto/helpers/BodyClass/BodyClass', () => ({
56
+ __esModule: true,
57
+ default: ({ className }) => (
56
58
  <div data-testid="body-class" data-classname={className} />
57
59
  ),
58
60
  }));
@@ -1,5 +1,5 @@
1
1
  import React, { useCallback, useMemo, useRef } from 'react';
2
- import { Helmet } from '@plone/volto/helpers';
2
+ import Helmet from '@plone/volto/helpers/Helmet/Helmet';
3
3
  import { compose } from 'redux';
4
4
  import { connect, useDispatch } from 'react-redux';
5
5
  import { withRouter } from 'react-router';
@@ -1,5 +1,6 @@
1
1
  import { useSelector } from 'react-redux';
2
- import { flattenToAppURL, Helmet } from '@plone/volto/helpers';
2
+ import Helmet from '@plone/volto/helpers//Helmet/Helmet';
3
+ import { flattenToAppURL } from '@plone/volto/helpers/Url/Url';
3
4
 
4
5
  export default function BaseTag(props) {
5
6
  const contentId = useSelector((store) => store?.content?.data?.['@id']);
@@ -6,7 +6,8 @@ import BaseTag from './BaseTag';
6
6
 
7
7
  const mockStore = configureStore();
8
8
 
9
- jest.mock('@plone/volto/helpers', () => ({
9
+ jest.mock('@plone/volto/helpers/Url/Url', () => ({
10
+ __esModule: true,
10
11
  flattenToAppURL: jest.fn((url) => {
11
12
  if (url.startsWith('http://') || url.startsWith('https://')) {
12
13
  const urlObj = new URL(url);
@@ -14,7 +15,11 @@ jest.mock('@plone/volto/helpers', () => ({
14
15
  }
15
16
  return url;
16
17
  }),
17
- Helmet: ({ base }) => (
18
+ }));
19
+
20
+ jest.mock('@plone/volto/helpers//Helmet/Helmet', () => ({
21
+ __esModule: true,
22
+ default: ({ base }) => (
18
23
  <div
19
24
  data-testid="helmet-base"
20
25
  data-target={base?.target}
@@ -1,4 +1,5 @@
1
- import { BodyClass, flattenToAppURL } from '@plone/volto/helpers';
1
+ import BodyClass from '@plone/volto/helpers/BodyClass/BodyClass';
2
+ import { flattenToAppURL } from '@plone/volto/helpers/Url/Url';
2
3
  import { connect } from 'react-redux';
3
4
  import { withRouter } from 'react-router-dom';
4
5
  import { compose } from 'redux';
@@ -5,11 +5,11 @@
5
5
 
6
6
  import React from 'react';
7
7
  import PropTypes from 'prop-types';
8
- import { DefaultView } from '@plone/volto/components/';
8
+ import DefaultView from '@plone/volto/components/theme/View/DefaultView';
9
9
 
10
- import { BodyClass } from '@plone/volto/helpers';
10
+ import BodyClass from '@plone/volto/helpers/BodyClass/BodyClass';
11
11
 
12
- import { hasBlocksData } from '@plone/volto/helpers';
12
+ import { hasBlocksData } from '@plone/volto/helpers/Blocks/Blocks';
13
13
 
14
14
  /**
15
15
  * Component to display the default view.
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import { render } from '@testing-library/react';
3
3
  import HomePageInverseView from './HomePageInverseView';
4
- import '@testing-library/jest-dom/extend-expect';
4
+ import '@testing-library/jest-dom';
5
5
 
6
6
  describe('HomePageInverseView Component', () => {
7
7
  it('renders without crashing', () => {
@@ -5,11 +5,11 @@
5
5
 
6
6
  import React from 'react';
7
7
  import PropTypes from 'prop-types';
8
- import { DefaultView } from '@plone/volto/components/';
8
+ import DefaultView from '@plone/volto/components/theme/View/DefaultView';
9
9
 
10
- import { BodyClass } from '@plone/volto/helpers';
10
+ import BodyClass from '@plone/volto/helpers/BodyClass/BodyClass';
11
11
 
12
- import { hasBlocksData } from '@plone/volto/helpers';
12
+ import { hasBlocksData } from '@plone/volto/helpers/Blocks/Blocks';
13
13
 
14
14
  /**
15
15
  * Component to display the default view.
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import { render } from '@testing-library/react';
3
3
  import HomePageView from './HomePageView';
4
- import '@testing-library/jest-dom/extend-expect';
4
+ import '@testing-library/jest-dom';
5
5
 
6
6
  describe('HomePageView Component', () => {
7
7
  it('renders without crashing', () => {
@@ -3,7 +3,7 @@ import { useSelector } from 'react-redux';
3
3
  import { defineMessages, useIntl } from 'react-intl';
4
4
  import config from '@plone/volto/registry';
5
5
 
6
- import { Logo } from '@eeacms/volto-eea-design-system/ui';
6
+ import Logo from '@eeacms/volto-eea-design-system/ui/Logo/Logo';
7
7
  import LogoImage from '@eeacms/volto-eea-design-system/../theme/themes/eea/assets/logo/eea-logo.svg';
8
8
 
9
9
  const messages = defineMessages({
@@ -55,8 +55,8 @@ const EEALogo = ({
55
55
  const url = config.settings.eea?.logoTargetUrl
56
56
  ? config.settings.eea.logoTargetUrl
57
57
  : config.settings.isMultilingual
58
- ? `/${lang}`
59
- : '/';
58
+ ? `/${lang}`
59
+ : '/';
60
60
 
61
61
  // Only pass inverted=true if we have an invertedSrc, otherwise the design system
62
62
  // Logo will try to use undefined invertedSrc instead of falling back to src
@@ -2,13 +2,14 @@ import { useEffect, useState } from 'react';
2
2
  import { compose } from 'redux';
3
3
  import { injectIntl } from 'react-intl';
4
4
  import { withRootNavigation } from '@eeacms/volto-eea-website-theme/hocs';
5
- import { BodyClass, toBackendLang } from '@plone/volto/helpers';
5
+ import BodyClass from '@plone/volto/helpers/BodyClass/BodyClass';
6
+ import { toBackendLang } from '@plone/volto/helpers/Utils/Utils';
6
7
  import { FormattedMessage } from 'react-intl';
7
8
  import { Link, useLocation } from 'react-router-dom';
8
9
  import { Container, Accordion } from 'semantic-ui-react';
9
10
  import { withServerErrorCode } from '@plone/volto/helpers/Utils/Utils';
10
11
  import { useDispatch, useSelector } from 'react-redux';
11
- import { getNavigation } from '@plone/volto/actions';
12
+ import { getNavigation } from '@plone/volto/actions/navigation/navigation';
12
13
  import config from '@plone/volto/registry';
13
14
 
14
15
  /**
@@ -14,19 +14,20 @@ jest.mock('@eeacms/volto-eea-website-theme/hocs', () => ({
14
14
  }));
15
15
 
16
16
  jest.mock('@plone/volto/helpers/Utils/Utils', () => ({
17
+ toBackendLang: jest.fn((lang) => lang),
17
18
  withServerErrorCode: () => (Component) => Component,
18
19
  }));
19
20
 
20
- jest.mock('@plone/volto/helpers', () => ({
21
- BodyClass: ({ className, children }) => (
21
+ jest.mock('@plone/volto/helpers/BodyClass/BodyClass', () => ({
22
+ __esModule: true,
23
+ default: ({ className, children }) => (
22
24
  <div data-testid="body-class" data-classname={className}>
23
25
  {children}
24
26
  </div>
25
27
  ),
26
- toBackendLang: jest.fn((lang) => lang),
27
28
  }));
28
29
 
29
- jest.mock('@plone/volto/actions', () => ({
30
+ jest.mock('@plone/volto/actions/navigation/navigation', () => ({
30
31
  getNavigation: jest.fn(() => ({ type: 'GET_NAVIGATION' })),
31
32
  }));
32
33
 
@@ -1,6 +1,6 @@
1
1
  import { compose } from 'redux';
2
2
  import { injectIntl } from 'react-intl';
3
3
  import { withRootNavigation } from '@eeacms/volto-eea-website-theme/hocs';
4
- import { NotFound } from '@plone/volto/components';
4
+ import NotFound from '@plone/volto/components/theme/NotFound/NotFound';
5
5
 
6
6
  export default compose(injectIntl, withRootNavigation)(NotFound);
@@ -8,8 +8,9 @@ import NotFound from './NotFound';
8
8
 
9
9
  const mockStore = configureStore();
10
10
 
11
- jest.mock('@plone/volto/components', () => ({
12
- NotFound: () => <div data-testid="volto-notfound">Not Found Page</div>,
11
+ jest.mock('@plone/volto/components/theme/NotFound/NotFound', () => ({
12
+ __esModule: true,
13
+ default: () => <div data-testid="volto-notfound">Not Found Page</div>,
13
14
  }));
14
15
 
15
16
  jest.mock('@eeacms/volto-eea-website-theme/hocs', () => ({
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import '@testing-library/jest-dom/extend-expect';
2
+ import '@testing-library/jest-dom';
3
3
  import { render, fireEvent } from '@testing-library/react';
4
4
  import { Provider } from 'react-redux';
5
5
  import configureStore from 'redux-mock-store';
@@ -3,13 +3,15 @@ import cx from 'classnames';
3
3
  import { useSelector } from 'react-redux';
4
4
  import { useLocation } from 'react-router-dom';
5
5
 
6
- import { BodyClass } from '@plone/volto/helpers';
6
+ import BodyClass from '@plone/volto/helpers/BodyClass/BodyClass';
7
7
  import { isSubsiteRoot } from 'volto-subsites/utils';
8
8
 
9
+ const EMPTY_SUBSITE = {};
10
+
9
11
  const SubsiteClass = () => {
10
- const subsite = useSelector(
11
- (state) => state.content?.data?.['@components']?.subsite || {},
12
- );
12
+ const subsite =
13
+ useSelector((state) => state.content?.data?.['@components']?.subsite) ||
14
+ EMPTY_SUBSITE;
13
15
  const location = useLocation();
14
16
 
15
17
  return (
@@ -13,8 +13,9 @@ jest.mock('volto-subsites/utils', () => ({
13
13
  isSubsiteRoot: (...args) => mockIsSubsiteRoot(...args),
14
14
  }));
15
15
 
16
- jest.mock('@plone/volto/helpers', () => ({
17
- BodyClass: ({ className }) => (
16
+ jest.mock('@plone/volto/helpers/BodyClass/BodyClass', () => ({
17
+ __esModule: true,
18
+ default: ({ className }) => (
18
19
  <div data-testid="body-class" data-classname={className} />
19
20
  ),
20
21
  }));
@@ -1,8 +1,8 @@
1
1
  import React, { useEffect } from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import { useHistory } from 'react-router-dom';
4
- import { isInternalURL, flattenToAppURL } from '@plone/volto/helpers';
5
- import { DefaultView } from '@plone/volto/components/';
4
+ import { isInternalURL, flattenToAppURL } from '@plone/volto/helpers/Url/Url';
5
+ import DefaultView from '@plone/volto/components/theme/View/DefaultView';
6
6
  import { Redirect } from 'react-router-dom';
7
7
 
8
8
  const WebReportSectionView = (props) => {
@@ -8,13 +8,14 @@ import WebReportSectionView from './WebReportSectionView';
8
8
  import '@testing-library/jest-dom';
9
9
 
10
10
  // Mock external dependencies
11
- jest.mock('@plone/volto/helpers', () => ({
11
+ jest.mock('@plone/volto/helpers/Url/Url', () => ({
12
12
  isInternalURL: jest.fn(),
13
13
  flattenToAppURL: jest.fn(),
14
14
  }));
15
15
 
16
- jest.mock('@plone/volto/components/', () => ({
17
- DefaultView: jest.fn(({ children, content, token, ...otherProps }) => (
16
+ jest.mock('@plone/volto/components/theme/View/DefaultView', () => ({
17
+ __esModule: true,
18
+ default: jest.fn(({ children }) => (
18
19
  <div data-testid="default-view">{children}</div>
19
20
  )),
20
21
  }));
@@ -24,8 +25,12 @@ jest.mock('react-router-dom', () => ({
24
25
  Redirect: jest.fn(({ to }) => <div data-testid="redirect" data-to={to} />),
25
26
  }));
26
27
 
27
- const { isInternalURL, flattenToAppURL } = require('@plone/volto/helpers');
28
- const { DefaultView } = require('@plone/volto/components/');
28
+ const {
29
+ isInternalURL,
30
+ flattenToAppURL,
31
+ } = require('@plone/volto/helpers/Url/Url');
32
+ const DefaultView =
33
+ require('@plone/volto/components/theme/View/DefaultView').default;
29
34
  const { Redirect } = require('react-router-dom');
30
35
 
31
36
  describe('WebReportSectionView', () => {
@@ -10,7 +10,7 @@ import { compose } from 'redux';
10
10
  import { connect } from 'react-redux';
11
11
  import { injectLazyLibs } from '@plone/volto/helpers/Loadable/Loadable';
12
12
  import { Popup } from 'semantic-ui-react';
13
- import { Icon } from '@plone/volto/components';
13
+ import Icon from '@plone/volto/components/theme/Icon/Icon';
14
14
  import { getSharing } from '@plone/volto/actions/sharing/sharing';
15
15
  import { getBaseUrl } from '@plone/volto/helpers/Url/Url';
16
16
 
@@ -27,7 +27,7 @@ import {
27
27
  MenuList,
28
28
  } from '@plone/volto/components/manage/Widgets/SelectStyling';
29
29
 
30
- import { FormFieldWrapper } from '@plone/volto/components';
30
+ import FormFieldWrapper from '@plone/volto/components/manage/Widgets/FormFieldWrapper';
31
31
 
32
32
  const messages = defineMessages({
33
33
  select: {
@@ -9,7 +9,7 @@ const ContributorsViewWidget = ({ value, content, children, className }) => {
9
9
  const key = `${label}-${index}`;
10
10
  return (
11
11
  <span key={key}>
12
- {index ? ', ' : ''}
12
+ {index > 0 && ', '}
13
13
  {children ? children(label) : label}
14
14
  </span>
15
15
  );
@@ -9,15 +9,18 @@ import React, { Component } from 'react';
9
9
  import PropTypes from 'prop-types';
10
10
  import { connect } from 'react-redux';
11
11
  import { compose } from 'redux';
12
- import { map } from 'lodash';
12
+ import map from 'lodash/map';
13
13
  import { defineMessages, injectIntl } from 'react-intl';
14
14
  import {
15
15
  getVocabFromHint,
16
16
  getVocabFromField,
17
17
  getVocabFromItems,
18
- } from '@plone/volto/helpers';
19
- import { FormFieldWrapper } from '@plone/volto/components';
20
- import { getVocabulary, getVocabularyTokenTitle } from '@plone/volto/actions';
18
+ } from '@plone/volto/helpers/Vocabularies/Vocabularies';
19
+ import FormFieldWrapper from '@plone/volto/components/manage/Widgets/FormFieldWrapper';
20
+ import {
21
+ getVocabulary,
22
+ getVocabularyTokenTitle,
23
+ } from '@plone/volto/actions/vocabularies/vocabularies';
21
24
  import { normalizeValue } from '@plone/volto/components/manage/Widgets/SelectUtils';
22
25
 
23
26
  import {
@@ -9,7 +9,7 @@ const CreatorsViewWidget = ({ value, content, children, className }) => {
9
9
  const key = `${label}-${index}`;
10
10
  return (
11
11
  <span key={key}>
12
- {index ? ', ' : ''}
12
+ {index > 0 && ', '}
13
13
  {children ? children(label) : label}
14
14
  </span>
15
15
  );
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import cx from 'classnames';
3
3
  import { useSelector } from 'react-redux';
4
- import { toBackendLang } from '@plone/volto/helpers';
4
+ import { toBackendLang } from '@plone/volto/helpers/Utils/Utils';
5
5
  import { formatDate } from '@plone/volto/helpers/Utils/Date';
6
6
  import config from '@plone/volto/registry';
7
7
 
@@ -22,7 +22,7 @@ describe('DateWidget', () => {
22
22
  </Provider>,
23
23
  );
24
24
  const json = component.toJSON();
25
- expect(json).toMatchSnapshot();
25
+ expect(json).toBeFalsy();
26
26
  });
27
27
 
28
28
  it('renders a date view widget component', () => {
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import cx from 'classnames';
3
3
  import { useSelector } from 'react-redux';
4
- import { toBackendLang } from '@plone/volto/helpers';
4
+ import { toBackendLang } from '@plone/volto/helpers/Utils/Utils';
5
5
  import { formatDate } from '@plone/volto/helpers/Utils/Date';
6
6
  import config from '@plone/volto/registry';
7
7
 
@@ -22,7 +22,7 @@ describe('DatetimeWidget', () => {
22
22
  </Provider>,
23
23
  );
24
24
  const json = component.toJSON();
25
- expect(json).toMatchSnapshot();
25
+ expect(json).toBeFalsy();
26
26
  });
27
27
 
28
28
  it('renders a datetime view widget component with a date and time', () => {
@@ -1,3 +1,4 @@
1
1
  export default function ImageViewWidget({ value }) {
2
+ // eslint-disable-next-line no-restricted-syntax
2
3
  return <img src={value?.download} alt={value?.filename} />;
3
4
  }
@@ -1,10 +1,11 @@
1
1
  import React, { useEffect, useCallback } from 'react';
2
2
  import { useSelector, useDispatch } from 'react-redux';
3
3
  import { v4 as uuid } from 'uuid';
4
- import { Icon, FormFieldWrapper } from '@plone/volto/components';
4
+ import Icon from '@plone/volto/components/theme/Icon/Icon';
5
+ import FormFieldWrapper from '@plone/volto/components/manage/Widgets/FormFieldWrapper';
5
6
  import ObjectWidget from '@plone/volto/components/manage/Widgets/ObjectWidget';
6
7
  import { Accordion, Button, Segment, Form, Dropdown } from 'semantic-ui-react';
7
- import { getNavigation } from '@plone/volto/actions';
8
+ import { getNavigation } from '@plone/volto/actions/navigation/navigation';
8
9
  import { defineMessages, useIntl } from 'react-intl';
9
10
  import config from '@plone/volto/registry';
10
11
 
@@ -13,6 +14,8 @@ import { numbersToMenuItemColumns } from '@eeacms/volto-eea-design-system/ui/Hea
13
14
  import upSVG from '@plone/volto/icons/up-key.svg';
14
15
  import downSVG from '@plone/volto/icons/down-key.svg';
15
16
 
17
+ const EMPTY_NAVIGATION = [];
18
+
16
19
  const messages = defineMessages({
17
20
  loadNavigationRoutes: {
18
21
  id: 'Load Main Navigation Routes',
@@ -257,7 +260,8 @@ const NavigationBehaviorWidget = (props) => {
257
260
  const { value = '{}', id, onChange } = props;
258
261
  const intl = useIntl();
259
262
  const dispatch = useDispatch();
260
- const navigation = useSelector((state) => state.navigation?.items || []);
263
+ const navigation =
264
+ useSelector((state) => state.navigation?.items) || EMPTY_NAVIGATION;
261
265
  const navigationLoaded = useSelector((state) => state.navigation?.loaded);
262
266
 
263
267
  // Parse JSON string to object