@eeacms/volto-eea-design-system 0.7.1 → 0.7.5

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,44 @@ 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
+ #### [0.7.5](https://github.com/eea/volto-eea-design-system/compare/0.7.3...0.7.5)
8
+
9
+ - Update package.json [`e21e00d`](https://github.com/eea/volto-eea-design-system/commit/e21e00dc1e0b54daef2c71311a9da709bc1f7e6d)
10
+ - Autobuild of docusaurus docs [`ca7c756`](https://github.com/eea/volto-eea-design-system/commit/ca7c75680763219f0acdc4c91d348c4520de13f4)
11
+ - change(megamenu): mobile menu improvements #223 [`b3cabfe`](https://github.com/eea/volto-eea-design-system/commit/b3cabfe3ddc42c2ea39ae20d01bb6fd0db478ecc)
12
+ - change(megamenu): enable active border only for items not titles [`fb0b869`](https://github.com/eea/volto-eea-design-system/commit/fb0b8696dd73cbf3083c3006a7cff5a1901a6bac)
13
+ - change(megamenu): removed icon from at a change menu items and they are no longer bold as requested [`043e772`](https://github.com/eea/volto-eea-design-system/commit/043e77219979711d2f25845c6811b546e791fbf7)
14
+ - change(megamenu): mobile menu design tweaks as seen in latest figma [`26d74dc`](https://github.com/eea/volto-eea-design-system/commit/26d74dc063f0b3f8d541c714a10038d79145047e)
15
+ - change(megamenu): handle default active sub accordion [`6192a99`](https://github.com/eea/volto-eea-design-system/commit/6192a9938b53522682953cb73d7ccfc6ef9c1aec)
16
+ - change(megamenu): fixed key error warnings [`075bf01`](https://github.com/eea/volto-eea-design-system/commit/075bf0167554869e9fc2f4938c972112e4afa2f7)
17
+ - change(megamenu): reset first level panels after each item pass [`175351b`](https://github.com/eea/volto-eea-design-system/commit/175351bdc9bab5c2d02b2717c24071ba62d4b924)
18
+ - change(megamenu): render accordion only if children have children [`be63ce2`](https://github.com/eea/volto-eea-design-system/commit/be63ce2a8e240eac26eedeff0ca104813afbc6b3)
19
+
20
+ #### [0.7.3](https://github.com/eea/volto-eea-design-system/compare/0.7.2...0.7.3)
21
+
22
+ > 4 August 2022
23
+
24
+ - Release [`#218`](https://github.com/eea/volto-eea-design-system/pull/218)
25
+ - Autobuild of docusaurus docs [`93ddb4d`](https://github.com/eea/volto-eea-design-system/commit/93ddb4d3c856adc4a99ad3260671d7c78615bd74)
26
+ - change(megamenu): added icon on mega menu header section [`d0ad4d8`](https://github.com/eea/volto-eea-design-system/commit/d0ad4d80fc4941e0cdbd8a2d81415387f86efc1c)
27
+
28
+ #### [0.7.2](https://github.com/eea/volto-eea-design-system/compare/0.7.1...0.7.2)
29
+
30
+ > 3 August 2022
31
+
32
+ - Develop [`#217`](https://github.com/eea/volto-eea-design-system/pull/217)
33
+ - Search input focus [`#215`](https://github.com/eea/volto-eea-design-system/pull/215)
34
+ - Make cypress tests work with both slate and draft selectors [`4d8e5b1`](https://github.com/eea/volto-eea-design-system/commit/4d8e5b1d7719637a46eac8232891fc5ed1f51b6f)
35
+ - Autobuild of docusaurus docs [`580af5b`](https://github.com/eea/volto-eea-design-system/commit/580af5b9d1791804239db8bd40f740d7fafc8a2a)
36
+ - fix(contentBox): z-index of content hidden by bg when using content-box-inner [`c5a7dac`](https://github.com/eea/volto-eea-design-system/commit/c5a7dac923d648d8fe9c9a9cbb8001969d32aea2)
37
+ - Autobuild of docusaurus docs [`2438b3e`](https://github.com/eea/volto-eea-design-system/commit/2438b3ef8035ffa2ad50c0d36bfac281fe7e5d68)
38
+ - Set focus on search input field in the popup on click [`d12c051`](https://github.com/eea/volto-eea-design-system/commit/d12c05106d9b95df1885ffa12cb284a0e50e0dfd)
39
+
7
40
  #### [0.7.1](https://github.com/eea/volto-eea-design-system/compare/0.7.0...0.7.1)
8
41
 
42
+ > 1 August 2022
43
+
44
+ - Release [`#214`](https://github.com/eea/volto-eea-design-system/pull/214)
9
45
  - Replace useLayoutEffect with useEffect, less notifications [`#213`](https://github.com/eea/volto-eea-design-system/pull/213)
10
46
  - Autobuild of docusaurus docs [`d763e15`](https://github.com/eea/volto-eea-design-system/commit/d763e15196988c7224fd79be9cbab1034caa0920)
11
47
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eeacms/volto-eea-design-system",
3
- "version": "0.7.1",
3
+ "version": "0.7.5",
4
4
  "description": "@eeacms/volto-eea-design-system: Volto add-on",
5
5
  "main": "src/index.js",
6
6
  "author": "European Environment Agency: IDM2 A-Team",
@@ -101,6 +101,7 @@ const Main = ({
101
101
  const [menuIsActive, setMenuIsActive] = React.useState(false);
102
102
  const [searchIsActive, setSearchIsActive] = React.useState(false);
103
103
  const [burger, setBurger] = React.useState('');
104
+ const searchInputRef = React.useRef(null);
104
105
 
105
106
  React.useEffect(() => {
106
107
  setMenuIsActive(false);
@@ -112,6 +113,12 @@ const Main = ({
112
113
  }
113
114
  }, [pathname]);
114
115
 
116
+ React.useEffect(() => {
117
+ if (searchIsActive) {
118
+ searchInputRef.current && searchInputRef.current.focus();
119
+ }
120
+ }, [searchIsActive]);
121
+
115
122
  const searchOnClick = (e, x) => {
116
123
  if (menuIsActive === true) {
117
124
  setBurger('');
@@ -237,6 +244,7 @@ const Main = ({
237
244
  {searchIsActive && (
238
245
  <HeaderSearchPopUp
239
246
  onClose={searchOnClick}
247
+ searchInputRef={searchInputRef}
240
248
  triggerRefs={[searchButtonRef]}
241
249
  />
242
250
  )}
@@ -9,9 +9,13 @@ import {
9
9
  Accordion,
10
10
  } from 'semantic-ui-react';
11
11
 
12
+ import { cloneDeep } from 'lodash';
13
+
12
14
  import { Link } from 'react-router-dom';
13
15
  import { useClickOutside } from '@eeacms/volto-eea-design-system/helpers';
14
16
 
17
+ import linkArrowsSVG from '@eeacms/volto-eea-design-system/../theme/themes/eea/assets/images/Svg/arrow-double-right.svg';
18
+
15
19
  const createColumns = (item, length, renderMenuItem) => {
16
20
  let subArrays = [];
17
21
  let size = length;
@@ -72,13 +76,7 @@ const Topics = ({ menuItem, renderMenuItem }) => (
72
76
  <React.Fragment key={index}>
73
77
  {section.title === 'At a glance' ? (
74
78
  <Grid.Column width={3} id="at-a-glance">
75
- <Item
76
- item={section}
77
- icon={true}
78
- iconName="ri-leaf-line"
79
- key={index}
80
- renderMenuItem={renderMenuItem}
81
- />
79
+ <Item item={section} key={index} renderMenuItem={renderMenuItem} />
82
80
  </Grid.Column>
83
81
  ) : (
84
82
  <Grid.Column width={9} key={index}>
@@ -147,45 +145,62 @@ const FirstLevelContent = ({ element, renderMenuItem, pathName }) => {
147
145
  const topics = element.title === 'Topics' ? true : false;
148
146
  let defaultIndex = -1;
149
147
 
150
- const firstLevelPanels = [];
151
- let content;
152
- if (!topics) {
153
- element.items.forEach((item, index) => {
154
- let x = {};
155
- x.key = item['@id'] || item['url'];
156
- if (pathName.indexOf(item.url) !== -1) {
157
- defaultIndex = index;
158
- }
159
- x.title = (
160
- <Accordion.Title key={`title=${index}`} index={index}>
161
- {item.title}
162
- <Icon className="ri-arrow-down-s-line" size="small" />
163
- </Accordion.Title>
164
- );
165
- x.content = (
166
- <Accordion.Content key={index}>
167
- {renderMenuItem(item, { className: 'item title-item' })}
168
- <SecondLevelContent element={item} renderMenuItem={renderMenuItem} />
169
- </Accordion.Content>
170
- );
171
- firstLevelPanels.push(x);
172
- });
173
- content = (
174
- <Accordion.Accordion
175
- defaultActiveIndex={defaultIndex}
176
- panels={firstLevelPanels}
177
- />
178
- );
179
- } else {
180
- content = (
181
- <SecondLevelContent
182
- element={element}
183
- topics={true}
184
- renderMenuItem={renderMenuItem}
185
- />
186
- );
187
- }
188
- return <>{content}</>;
148
+ return (
149
+ <>
150
+ {!topics ? (
151
+ <React.Fragment>
152
+ {element.items.map((item, index) => {
153
+ let firstLevelPanels = [];
154
+ if (!item.items.length) {
155
+ return (
156
+ <React.Fragment key={index}>
157
+ {renderMenuItem(item, { className: 'item' })}
158
+ </React.Fragment>
159
+ );
160
+ }
161
+ let x = {};
162
+ x.key = item['@id'] || item['url'];
163
+ if (pathName.indexOf(item.url) !== -1) {
164
+ defaultIndex = index;
165
+ }
166
+ x.title = (
167
+ <Accordion.Title key={`title=${index}`}>
168
+ {item.title}
169
+ <Icon className="ri-arrow-down-s-line" size="small" />
170
+ </Accordion.Title>
171
+ );
172
+ let overflow_item = cloneDeep(item);
173
+ overflow_item.title = 'See all';
174
+ x.content = (
175
+ <Accordion.Content>
176
+ {renderMenuItem(overflow_item, {
177
+ className: 'item title-item',
178
+ })}
179
+ <SecondLevelContent
180
+ element={item}
181
+ renderMenuItem={renderMenuItem}
182
+ />
183
+ </Accordion.Content>
184
+ );
185
+ firstLevelPanels.push(x);
186
+ return (
187
+ <Accordion.Accordion
188
+ panels={firstLevelPanels}
189
+ key={index}
190
+ defaultActiveIndex={defaultIndex === index ? 0 : -1}
191
+ />
192
+ );
193
+ })}
194
+ </React.Fragment>
195
+ ) : (
196
+ <SecondLevelContent
197
+ element={element}
198
+ topics={true}
199
+ renderMenuItem={renderMenuItem}
200
+ />
201
+ )}
202
+ </>
203
+ );
189
204
  };
190
205
 
191
206
  const SecondLevelContent = ({ element, topics = false, renderMenuItem }) => {
@@ -251,9 +266,11 @@ const NestedAccordion = ({ menuItems, renderMenuItem, pathName }) => {
251
266
  <Icon className="ri-arrow-down-s-line" size="small" />
252
267
  </Accordion.Title>
253
268
  );
269
+ let overview = cloneDeep(element);
270
+ overview.title = 'See all';
254
271
  x.content = (
255
272
  <Accordion.Content key={index}>
256
- {renderMenuItem(element, { className: 'item' })}
273
+ {renderMenuItem(overview, { className: 'item' })}
257
274
  <FirstLevelContent
258
275
  element={element}
259
276
  renderMenuItem={renderMenuItem}
@@ -289,7 +306,22 @@ function HeaderMenuPopUp({
289
306
  <Container>
290
307
  {menuItem && (
291
308
  <div className="menu-content tablet hidden mobile hidden">
292
- <h3 className="title">{renderMenuItem(menuItem)}</h3>
309
+ <h3 className="title">
310
+ {renderMenuItem(
311
+ menuItem,
312
+ { className: 'title-link' },
313
+ {
314
+ iconPosition: 'right',
315
+ children: (
316
+ <img
317
+ src={linkArrowsSVG}
318
+ className={'title-img'}
319
+ alt={'Title icon'}
320
+ />
321
+ ),
322
+ },
323
+ )}
324
+ </h3>
293
325
  <Divider fitted />
294
326
  {menuItem.title === 'Topics' ? (
295
327
  <Topics menuItem={menuItem} renderMenuItem={renderMenuItem} />
@@ -3,7 +3,7 @@ import { Container, Input } from 'semantic-ui-react';
3
3
 
4
4
  import { useClickOutside } from '@eeacms/volto-eea-design-system/helpers';
5
5
 
6
- function HeaderSearchPopUp({ onClose, triggerRefs = [] }) {
6
+ function HeaderSearchPopUp({ onClose, searchInputRef, triggerRefs = [] }) {
7
7
  const nodeRef = React.useRef();
8
8
 
9
9
  useClickOutside({ targetRefs: [nodeRef, ...triggerRefs], callback: onClose });
@@ -13,6 +13,7 @@ function HeaderSearchPopUp({ onClose, triggerRefs = [] }) {
13
13
  <Container>
14
14
  <div className="wrapper">
15
15
  <Input
16
+ ref={searchInputRef}
16
17
  className="search"
17
18
  icon={{ className: 'ri-search-line', link: true }}
18
19
  placeholder="Search..."
@@ -0,0 +1,4 @@
1
+ <svg width="12" height="11" viewBox="0 0 12 11" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <path d="M3.81846 5.50017L-3.83247e-07 1.66422L1.09077 0.568456L6 5.50017L1.09077 10.4319L-4.78974e-08 9.33612L3.81846 5.50017Z" fill="white"/>
3
+ <path d="M9.81846 5.50017L6 1.66422L7.09077 0.568456L12 5.50017L7.09077 10.4319L6 9.33612L9.81846 5.50017Z" fill="white"/>
4
+ </svg>
@@ -27,6 +27,8 @@
27
27
  .content-box-inner {
28
28
  padding-top: @contentBoxContainerMarginTop;
29
29
  padding-bottom: @contentBoxContainerMarginBottom;
30
+ position: relative;
31
+ z-index: 1;
30
32
  }
31
33
 
32
34
  &.primary {
@@ -543,6 +543,9 @@
543
543
  .title {
544
544
  font-size: @megaMenuTitleFontSize;
545
545
  font-weight: @megaMenuTitleFontWeight;
546
+ .title-img {
547
+ margin-left: @megaMenuTitleImgMarginLeft;
548
+ }
546
549
  }
547
550
 
548
551
  .sub-title {
@@ -562,7 +565,11 @@
562
565
  }
563
566
  }
564
567
  }
565
- #mega-menu .ui.list .item {
568
+
569
+ #mega-menu .ui.list {
570
+ margin: 0;
571
+ }
572
+ #mega-menu .item {
566
573
  display: flex;
567
574
  font-size: @megaMenuListItemFontSize;
568
575
  font-weight: @megaMenuListItemFontWeight;
@@ -571,6 +578,10 @@
571
578
 
572
579
  #mega-menu a.item {
573
580
  color: @megaMenuTextColor;
581
+ display: @megaMenuTextDisplay;
582
+ &:hover {
583
+ text-decoration: @megaMenuTextHoverDecoration;
584
+ }
574
585
 
575
586
  i.icon {
576
587
  color: @megaMenuTextColor;
@@ -583,7 +594,7 @@
583
594
  // To override the grid column paddings
584
595
  padding: @megaMenuGlancePaddingLeft !important;
585
596
 
586
- .ui.list .item {
597
+ .item {
587
598
  font-size: @megaMenuGlanceListItemFontSize;
588
599
  font-weight: @megaMenuGlanceListItemFontWeight;
589
600
  margin: @megaMenuGlanceListItemMargin;
@@ -604,8 +615,9 @@
604
615
  padding-top: @megaMenuContentPaddingTop;
605
616
  }
606
617
 
607
- #mega-menu .active > span {
608
- border-bottom: 2px solid #FFF;
618
+ #mega-menu .active:not(.title-link) > span {
619
+ border-left: @megaMenuListItemActiveBorder;
620
+ padding-left: @megaMenuListItemActivePadding;
609
621
  }
610
622
 
611
623
  /*Mega Menu Accordion - Tablet & Mobile */
@@ -133,7 +133,9 @@
133
133
  /* Mega menu */
134
134
  @mobileMegaMenuWidth: 94%;
135
135
  @megaMenuBackgroundColor: @darkMidnightBlue;
136
+ @megaMenuTextDisplay: flex;
136
137
  @megaMenuTextColor: @white;
138
+ @megaMenuTextHoverDecoration: underline;
137
139
  @mobileMegaMenuPadding: @rem-space-4 0;
138
140
  @tabletMegaMenuPadding: @rem-space-9;
139
141
  @computerMegaMenuPadding: @rem-space-10 0 0 0;
@@ -142,6 +144,7 @@
142
144
  /* Title */
143
145
  @megaMenuTitleFontSize: @font-size-4;
144
146
  @megaMenuTitleFontWeight: @font-weight-7;
147
+ @megaMenuTitleImgMarginLeft: 4px;
145
148
 
146
149
  /* Sub Title */
147
150
  @megaMenuSubTitleFontSize: @font-size-2;
@@ -151,14 +154,15 @@
151
154
  @megaMenuListItemFontSize: @font-size-1;
152
155
  @megaMenuListItemFontWeight: @font-weight-4;
153
156
  @megaMenuListItemPadding: @rem-space-2 0;
154
- @megaMenuListItemActiveBorder: 2px solid #FFF;
157
+ @megaMenuListItemActiveBorder: 4px solid #FFF;
158
+ @megaMenuListItemActivePadding: 8px;
155
159
 
156
160
  /* At a glance */
157
161
  @megaMenuGlanceBackgroundColor: @secondaryColor;
158
162
  @megaMenuGlancePaddingLeft: @rem-space-8 @rem-space-5;
159
163
  @megaMenuGlanceListItemFontSize: @font-size-2;
160
- @megaMenuGlanceListItemFontWeight: @font-weight-6;
161
- @megaMenuGlanceListItemMargin: @rem-space-6 0;
164
+ @megaMenuGlanceListItemFontWeight: @font-weight-4;
165
+ @megaMenuGlanceListItemMargin: @rem-space-4 0;
162
166
 
163
167
  /* Accordion */
164
168
  @megaMenuAccordionTitleFontSize: @font-size-3;