@eeacms/volto-tabs-block 2.1.0 → 2.2.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/CHANGELOG.md CHANGED
@@ -4,8 +4,20 @@ 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
+ #### [2.2.0](https://github.com/eea/volto-tabs-block/compare/2.1.0...2.2.0)
8
+
9
+ - Update package.json [`11a0af2`](https://github.com/eea/volto-tabs-block/commit/11a0af2bd4a4f4d803a8c51da3a3403725e0c618)
10
+ - use volto@16.0.0-alpha.14 in cypress tests [`80817ac`](https://github.com/eea/volto-tabs-block/commit/80817ac5cf880d01cc44654c1a0325438932b22f)
11
+ - imporve accordion break point [`39a6580`](https://github.com/eea/volto-tabs-block/commit/39a6580e1073505d642693520f9e14d15cbb6270)
12
+ - clean up [`3735cd1`](https://github.com/eea/volto-tabs-block/commit/3735cd171e57bdc02fd46281c9d50b4fba28b213)
13
+ - feat(accordion): initialize transformWidth with initial container width [`b0bc46c`](https://github.com/eea/volto-tabs-block/commit/b0bc46c863bd8b9092523b55460a2733c55336bb)
14
+ - update(jest): add @plone/volto-slate resolver refs- #153447 [`ea75f81`](https://github.com/eea/volto-tabs-block/commit/ea75f8160035137915ca23d9d0c990c318fff448)
15
+
7
16
  #### [2.1.0](https://github.com/eea/volto-tabs-block/compare/2.0.2...2.1.0)
8
17
 
18
+ > 1 July 2022
19
+
20
+ - Adjustments to tabs border [`#27`](https://github.com/eea/volto-tabs-block/pull/27)
9
21
  - adjustments to tabs border [`#26`](https://github.com/eea/volto-tabs-block/pull/26)
10
22
  - Release 2.1.0 [`3cdfa30`](https://github.com/eea/volto-tabs-block/commit/3cdfa30d4d03d864be8ad63f0648b4717298734a)
11
23
  - Squashed commit of the following: [`ca241f5`](https://github.com/eea/volto-tabs-block/commit/ca241f56a96817679a1948154e2a8cc0e17b96fe)
package/Jenkinsfile CHANGED
@@ -6,7 +6,7 @@ pipeline {
6
6
  NAMESPACE = "@eeacms"
7
7
  SONARQUBE_TAGS = "volto.eea.europa.eu,climate-energy.eea.europa.eu,biodiversity.europa.eu,www.eea.europa.eu-ims,sustainability.eionet.europa.eu,forest.eea.europa.eu,clms.land.copernicus.eu,industry.eea.europa.eu,water.europa.eu-freshwater,demo-www.eea.europa.eu,clmsdemo.devel6cph.eea.europa.eu,circularity.eea.europa.eu"
8
8
  DEPENDENCIES = "@eeacms/volto-block-style"
9
- VOLTO = "alpha"
9
+ VOLTO = "16.0.0-alpha.14"
10
10
  }
11
11
 
12
12
  stages {
@@ -11,7 +11,8 @@ module.exports = {
11
11
  '@package/(.*)$': '<rootDir>/src/$1',
12
12
  '@plone/volto-quanta/(.*)$': '<rootDir>/src/addons/volto-quanta/src/$1',
13
13
  '@eeacms/(.*?)/(.*)$': '<rootDir>/src/addons/$1/src/$2',
14
- 'volto-slate/(.*)$': '<rootDir>/src/addons/volto-slate/src/$1',
14
+ '@plone/volto-slate':
15
+ '<rootDir>/node_modules/@plone/volto/packages/volto-slate/src',
15
16
  '~/(.*)$': '<rootDir>/src/$1',
16
17
  'load-volto-addons':
17
18
  '<rootDir>/node_modules/@plone/volto/jest-addons-loader.js',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eeacms/volto-tabs-block",
3
- "version": "2.1.0",
3
+ "version": "2.2.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",
@@ -47,8 +47,12 @@ const View = (props) => {
47
47
  setActiveTab = () => {},
48
48
  } = props;
49
49
  const accordionConfig =
50
- config.blocks.blocksConfig.tabs_block.templates.accordion;
51
- const { icons, semanticIcon } = accordionConfig;
50
+ config.blocks.blocksConfig[TABS_BLOCK].templates?.['accordion'] || {};
51
+ const { icons, semanticIcon, transformWidth = 800 } = accordionConfig;
52
+
53
+ const tabsContainer = React.useRef();
54
+ const [mounted, setMounted] = React.useState(false);
55
+ const [initialWidth, setInitialWidth] = React.useState(transformWidth);
52
56
 
53
57
  const schema = React.useMemo(
54
58
  () =>
@@ -73,6 +77,7 @@ const View = (props) => {
73
77
  const title = tabs[tab].title;
74
78
  const defaultTitle = `Tab ${index + 1}`;
75
79
  const active = activeTabIndex === index;
80
+
76
81
  return {
77
82
  title: (
78
83
  <>
@@ -98,9 +103,23 @@ const View = (props) => {
98
103
  };
99
104
  });
100
105
 
106
+ React.useEffect(() => {
107
+ setMounted(true);
108
+ }, []);
109
+
110
+ React.useEffect(() => {
111
+ if (!mounted) return;
112
+ const { blockWidth, tabsTotalWidth } = tabsContainer.current?.state || {};
113
+ setInitialWidth(
114
+ tabsTotalWidth < blockWidth ? tabsTotalWidth + 1 : blockWidth + 1,
115
+ );
116
+ }, [mounted]);
117
+
101
118
  return (
102
119
  <>
103
120
  <Tabs
121
+ ref={tabsContainer}
122
+ transformWidth={initialWidth}
104
123
  className="tabs aa"
105
124
  selectedTabKey={tabsList[activeTabIndex]}
106
125
  items={items}
package/src/index.js CHANGED
@@ -49,6 +49,7 @@ export default (config) => {
49
49
  edit: AccordionEdit,
50
50
  view: AccordionView,
51
51
  schema: accordionSchema,
52
+ transformWidth: 800,
52
53
  icons: {
53
54
  closed: rightSVG,
54
55
  opened: downSVG,