@eeacms/volto-tabs-block 7.5.0 → 8.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.
package/.eslintrc.js ADDED
@@ -0,0 +1,65 @@
1
+ const fs = require('fs');
2
+ const path = require('path');
3
+ const projectRootPath = fs.realpathSync(__dirname + '/../../../');
4
+
5
+ let voltoPath = path.join(projectRootPath, 'node_modules/@plone/volto');
6
+ let configFile;
7
+ if (fs.existsSync(`${projectRootPath}/tsconfig.json`))
8
+ configFile = `${projectRootPath}/tsconfig.json`;
9
+ else if (fs.existsSync(`${projectRootPath}/jsconfig.json`))
10
+ configFile = `${projectRootPath}/jsconfig.json`;
11
+
12
+ if (configFile) {
13
+ const jsConfig = require(configFile).compilerOptions;
14
+ const pathsConfig = jsConfig.paths;
15
+ if (pathsConfig['@plone/volto'])
16
+ voltoPath = `./${jsConfig.baseUrl}/${pathsConfig['@plone/volto'][0]}`;
17
+ }
18
+
19
+ const AddonConfigurationRegistry = require(`${voltoPath}/addon-registry.js`);
20
+ const reg = new AddonConfigurationRegistry(projectRootPath);
21
+
22
+ // Extends ESlint configuration for adding the aliases to `src` directories in Volto addons
23
+ const addonAliases = Object.keys(reg.packages).map((o) => [
24
+ o,
25
+ reg.packages[o].modulePath,
26
+ ]);
27
+
28
+ const addonExtenders = reg.getEslintExtenders().map((m) => require(m));
29
+
30
+ const defaultConfig = {
31
+ extends: `${voltoPath}/.eslintrc`,
32
+ settings: {
33
+ 'import/resolver': {
34
+ alias: {
35
+ map: [
36
+ ['@plone/volto', '@plone/volto/src'],
37
+ ['@plone/volto-slate', '@plone/volto/packages/volto-slate/src'],
38
+ ...addonAliases,
39
+ ['@package', `${__dirname}/src`],
40
+ ['@root', `${__dirname}/src`],
41
+ ['~', `${__dirname}/src`],
42
+ ],
43
+ extensions: ['.js', '.jsx', '.json'],
44
+ },
45
+ 'babel-plugin-root-import': {
46
+ rootPathSuffix: 'src',
47
+ },
48
+ },
49
+ },
50
+ rules: {
51
+ 'react/jsx-no-target-blank': [
52
+ 'error',
53
+ {
54
+ allowReferrer: true,
55
+ },
56
+ ],
57
+ }
58
+ };
59
+
60
+ const config = addonExtenders.reduce(
61
+ (acc, extender) => extender.modify(acc),
62
+ defaultConfig,
63
+ );
64
+
65
+ module.exports = config;
package/CHANGELOG.md CHANGED
@@ -4,10 +4,30 @@ All notable changes to this project will be documented in this file. Dates are d
4
4
 
5
5
  Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
6
6
 
7
+ ### [8.0.0](https://github.com/eea/volto-tabs-block/compare/7.5.1...8.0.0) - 22 April 2024
8
+
9
+ #### :rocket: New Features
10
+
11
+ - feat: Release 8.0.0 - Volto 17 support [alin - [`57dd000`](https://github.com/eea/volto-tabs-block/commit/57dd0008921899688a6175c9fb00588593a7b307)]
12
+ - feat: Volto 17 support - refs #264527 [EEA Jenkins - [`80b384c`](https://github.com/eea/volto-tabs-block/commit/80b384ca871dd2578b1cd0c0bf3e238d0289b977)]
13
+
14
+ #### :hammer_and_wrench: Others
15
+
16
+ ### [7.5.1](https://github.com/eea/volto-tabs-block/compare/7.5.0...7.5.1) - 28 March 2024
17
+
18
+ #### :nail_care: Enhancements
19
+
20
+ - change(accordion): added menu-item-text class to accordion tab span [David Ichim - [`6dad8b1`](https://github.com/eea/volto-tabs-block/commit/6dad8b11ab2a4c81a3e5718d89116d5f28593946)]
21
+
22
+ #### :house: Internal changes
23
+
24
+ - style: Automated code fix [eea-jenkins - [`730f20c`](https://github.com/eea/volto-tabs-block/commit/730f20ce438bcbaefa421ba73849fe6089de0466)]
25
+
7
26
  ### [7.5.0](https://github.com/eea/volto-tabs-block/compare/7.0.5...7.5.0) - 7 March 2024
8
27
 
9
28
  #### :boom: Breaking Change
10
29
 
30
+ - breaking(tabs): use DefaultEdit variation as base for responsive accordion edit refs #266327 #85 from eea/develop [ichim-david - [`2f7fc23`](https://github.com/eea/volto-tabs-block/commit/2f7fc23025532ab9cfb9788f7557dda2f686ac43)]
11
31
  - breaking(tabs): menu-item-text markup is now span instead of p tag [David Ichim - [`5aa7981`](https://github.com/eea/volto-tabs-block/commit/5aa798140654b4b6e3487c082483640432eddd65)]
12
32
 
13
33
  #### :bug: Bug Fixes
@@ -1,3 +1,5 @@
1
+ require('dotenv').config({ path: __dirname + '/.env' })
2
+
1
3
  module.exports = {
2
4
  testMatch: ['**/src/addons/**/?(*.)+(spec|test).[jt]s?(x)'],
3
5
  collectCoverageFrom: [
@@ -9,19 +11,26 @@ module.exports = {
9
11
  '@plone/volto/cypress': '<rootDir>/node_modules/@plone/volto/cypress',
10
12
  '@plone/volto/babel': '<rootDir>/node_modules/@plone/volto/babel',
11
13
  '@plone/volto/(.*)$': '<rootDir>/node_modules/@plone/volto/src/$1',
12
- '@package/(.*)$': '<rootDir>/src/$1',
13
- '@root/(.*)$': '<rootDir>/src/$1',
14
+ '@package/(.*)$': '<rootDir>/node_modules/@plone/volto/src/$1',
15
+ '@root/(.*)$': '<rootDir>/node_modules/@plone/volto/src/$1',
14
16
  '@plone/volto-quanta/(.*)$': '<rootDir>/src/addons/volto-quanta/src/$1',
17
+ '@eeacms/search/(.*)$': '<rootDir>/src/addons/volto-searchlib/searchlib/$1',
18
+ '@eeacms/search': '<rootDir>/src/addons/volto-searchlib/searchlib',
15
19
  '@eeacms/(.*?)/(.*)$': '<rootDir>/node_modules/@eeacms/$1/src/$2',
16
- '@plone/volto-slate':
20
+ '@plone/volto-slate$':
17
21
  '<rootDir>/node_modules/@plone/volto/packages/volto-slate/src',
22
+ '@plone/volto-slate/(.*)$':
23
+ '<rootDir>/node_modules/@plone/volto/packages/volto-slate/src/$1',
18
24
  '~/(.*)$': '<rootDir>/src/$1',
19
25
  'load-volto-addons':
20
26
  '<rootDir>/node_modules/@plone/volto/jest-addons-loader.js',
21
27
  },
22
- transformIgnorePatterns: ['node_modules/(?!@eeacms)/volto-anchors/helpers'],
28
+ transformIgnorePatterns: [
29
+ '/node_modules/(?!(@plone|@root|@package|@eeacms)/).*/',
30
+ ],
23
31
  transform: {
24
32
  '^.+\\.js(x)?$': 'babel-jest',
33
+ '^.+\\.ts(x)?$': 'babel-jest',
25
34
  '^.+\\.(png)$': 'jest-file',
26
35
  '^.+\\.(jpg)$': 'jest-file',
27
36
  '^.+\\.(svg)$': './node_modules/@plone/volto/jest-svgsystem-transform.js',
@@ -34,4 +43,9 @@ module.exports = {
34
43
  statements: 5,
35
44
  },
36
45
  },
37
- };
46
+ ...(process.env.JEST_USE_SETUP === 'ON' && {
47
+ setupFilesAfterEnv: [
48
+ '<rootDir>/node_modules/@eeacms/volto-tabs-block/jest.setup.js',
49
+ ],
50
+ }),
51
+ }
package/jest.setup.js ADDED
@@ -0,0 +1,65 @@
1
+ import { jest } from '@jest/globals';
2
+ import configureStore from 'redux-mock-store';
3
+ import thunk from 'redux-thunk';
4
+ import { blocksConfig } from '@plone/volto/config/Blocks';
5
+ import installSlate from '@plone/volto-slate/index';
6
+
7
+ var mockSemanticComponents = jest.requireActual('semantic-ui-react');
8
+ var mockComponents = jest.requireActual('@plone/volto/components');
9
+ var config = jest.requireActual('@plone/volto/registry').default;
10
+
11
+ config.blocks.blocksConfig = {
12
+ ...blocksConfig,
13
+ ...config.blocks.blocksConfig,
14
+ };
15
+
16
+ jest.doMock('semantic-ui-react', () => ({
17
+ __esModule: true,
18
+ ...mockSemanticComponents,
19
+ Popup: ({ content, trigger }) => {
20
+ return (
21
+ <div className="popup">
22
+ <div className="trigger">{trigger}</div>
23
+ <div className="content">{content}</div>
24
+ </div>
25
+ );
26
+ },
27
+ }));
28
+
29
+ jest.doMock('@plone/volto/components', () => {
30
+ return {
31
+ __esModule: true,
32
+ ...mockComponents,
33
+ SidebarPortal: ({ children }) => <div id="sidebar">{children}</div>,
34
+ };
35
+ });
36
+
37
+ jest.doMock('@plone/volto/registry', () =>
38
+ [installSlate].reduce((acc, apply) => apply(acc), config),
39
+ );
40
+
41
+ const mockStore = configureStore([thunk]);
42
+
43
+ global.fetch = jest.fn(() =>
44
+ Promise.resolve({
45
+ json: () => Promise.resolve({}),
46
+ }),
47
+ );
48
+
49
+ global.store = mockStore({
50
+ intl: {
51
+ locale: 'en',
52
+ messages: {},
53
+ formatMessage: jest.fn(),
54
+ },
55
+ content: {
56
+ create: {},
57
+ subrequests: [],
58
+ },
59
+ connected_data_parameters: {},
60
+ screen: {
61
+ page: {
62
+ width: 768,
63
+ },
64
+ },
65
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eeacms/volto-tabs-block",
3
- "version": "7.5.0",
3
+ "version": "8.0.0",
4
4
  "description": "volto-tabs-block: Volto add-on",
5
5
  "main": "src/index.js",
6
6
  "author": "European Environment Agency: IDM2 A-Team",
@@ -31,6 +31,7 @@
31
31
  "@cypress/code-coverage": "^3.10.0",
32
32
  "@plone/scripts": "*",
33
33
  "babel-plugin-transform-class-properties": "^6.24.1",
34
+ "dotenv": "^16.3.2",
34
35
  "husky": "^8.0.3",
35
36
  "lint-staged": "^14.0.1",
36
37
  "md5": "^2.3.0"
@@ -42,8 +42,11 @@ const View = (props) => {
42
42
  const accordionConfig = config.blocks.blocksConfig[
43
43
  TABS_BLOCK
44
44
  ].variations.filter((v, _i) => v.id === data.variation);
45
- const { icons, semanticIcon, transformWidth = 800 } =
46
- accordionConfig?.[0] || {};
45
+ const {
46
+ icons,
47
+ semanticIcon,
48
+ transformWidth = 800,
49
+ } = accordionConfig?.[0] || {};
47
50
 
48
51
  const tabsContainer = React.useRef();
49
52
  const [mounted, setMounted] = React.useState(false);
@@ -82,7 +85,7 @@ const View = (props) => {
82
85
  tabIndex={tabIndex}
83
86
  />
84
87
  ) : (
85
- <span>{title || defaultTitle}</span>
88
+ <span className="menu-item-text">{title || defaultTitle}</span>
86
89
  )}
87
90
  </>
88
91
  ),
@@ -135,9 +135,8 @@ const View = (props) => {
135
135
  }, [activeTab]);
136
136
  React.useEffect(() => {
137
137
  if (!slider.current?.innerSlider?.list) return;
138
- let inaccessibleElements = slider.current.innerSlider.list.querySelectorAll(
139
- '.slick-slide',
140
- );
138
+ let inaccessibleElements =
139
+ slider.current.innerSlider.list.querySelectorAll('.slick-slide');
141
140
  for (let element of inaccessibleElements) {
142
141
  element.setAttribute('tabindex', '0');
143
142
  element.setAttribute('aria-hidden', 'false');
@@ -154,8 +154,8 @@
154
154
  left: 0;
155
155
  width: 100%;
156
156
  height: 2px;
157
- background-color: @lightColor;
158
157
  border-radius: 2px;
158
+ background-color: @lightColor;
159
159
  opacity: 1;
160
160
  transform: translateY(-50%);
161
161
  }
@@ -180,8 +180,8 @@
180
180
  width: @dotsSize;
181
181
  height: @dotsSize;
182
182
  padding: 0;
183
- background-color: @lightColor;
184
183
  border-radius: 100%;
184
+ background-color: @lightColor;
185
185
  color: @lightColor;
186
186
 
187
187
  &::before {
@@ -304,7 +304,9 @@
304
304
  }
305
305
 
306
306
  @media only screen and (max-width: @largestMobileScreen + @largestMobileScreenOffset) {
307
- body:not(.has-toolbar):not(.has-sidebar):not(.has-toolbar-collapsed):not(.has-sidebar-collapsed),
307
+ body:not(.has-toolbar):not(.has-sidebar):not(.has-toolbar-collapsed):not(
308
+ .has-sidebar-collapsed
309
+ ),
308
310
  body.has-toolbar-collapsed:not(.has-sidebar):not(.has-sidebar-collapsed),
309
311
  body.has-toolbar:not(.has-sidebar):not(.has-sidebar-collapsed) {
310
312
  .tabs-block {
@@ -1,48 +0,0 @@
1
- const fs = require('fs');
2
- const path = require('path');
3
-
4
- const projectRootPath = fs.existsSync('./project')
5
- ? fs.realpathSync('./project')
6
- : fs.realpathSync('./../../../');
7
- const packageJson = require(path.join(projectRootPath, 'package.json'));
8
- const jsConfig = require(path.join(projectRootPath, 'jsconfig.json')).compilerOptions;
9
-
10
- const pathsConfig = jsConfig.paths;
11
-
12
- let voltoPath = path.join(projectRootPath, 'node_modules/@plone/volto');
13
-
14
- Object.keys(pathsConfig).forEach(pkg => {
15
- if (pkg === '@plone/volto') {
16
- voltoPath = `./${jsConfig.baseUrl}/${pathsConfig[pkg][0]}`;
17
- }
18
- });
19
- const AddonConfigurationRegistry = require(`${voltoPath}/addon-registry.js`);
20
- const reg = new AddonConfigurationRegistry(projectRootPath);
21
-
22
- // Extends ESlint configuration for adding the aliases to `src` directories in Volto addons
23
- const addonAliases = Object.keys(reg.packages).map(o => [
24
- o,
25
- reg.packages[o].modulePath,
26
- ]);
27
-
28
-
29
- module.exports = {
30
- extends: `${projectRootPath}/node_modules/@plone/volto/.eslintrc`,
31
- settings: {
32
- 'import/resolver': {
33
- alias: {
34
- map: [
35
- ['@plone/volto', '@plone/volto/src'],
36
- ...addonAliases,
37
- ['@package', `${__dirname}/src`],
38
- ['~', `${__dirname}/src`],
39
- ],
40
- extensions: ['.js', '.jsx', '.json'],
41
- },
42
- 'babel-plugin-root-import': {
43
- rootPathSuffix: 'src',
44
- },
45
- },
46
- },
47
- };
48
-