@eeacms/volto-eea-design-system 1.21.0 → 1.22.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,6 +4,25 @@ 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
+ ### [1.22.0](https://github.com/eea/volto-eea-design-system/compare/1.21.1...1.22.0) - 24 November 2023
8
+
9
+ #### :rocket: New Features
10
+
11
+ - feat(mega-menu): added ability to set a * option that would hold configuration for non specific layouts [David Ichim - [`11b4b8c`](https://github.com/eea/volto-eea-design-system/commit/11b4b8ca14741d2fac6b11a09ab6ad1af65264b2)]
12
+
13
+ #### :nail_care: Enhancements
14
+
15
+ - change(header): ensure header items are without large gaps when menu goes over 2 lines [David Ichim - [`f6aba05`](https://github.com/eea/volto-eea-design-system/commit/f6aba059320c608cadaf5563085ffa63d0812583)]
16
+
17
+ #### :hammer_and_wrench: Others
18
+
19
+ - Bump package version [David Ichim - [`4304cf6`](https://github.com/eea/volto-eea-design-system/commit/4304cf667fd63ac9ce13524dfaaa972bdd1dd009)]
20
+ ### [1.21.1](https://github.com/eea/volto-eea-design-system/compare/1.21.0...1.21.1) - 21 November 2023
21
+
22
+ #### :bug: Bug Fixes
23
+
24
+ - fix: Regression on Button.Action component when used with RSS link [Alin Voinea - [`dd4548d`](https://github.com/eea/volto-eea-design-system/commit/dd4548de999787eff688b4ee36860d69459735c3)]
25
+
7
26
  ### [1.21.0](https://github.com/eea/volto-eea-design-system/compare/1.20.0...1.21.0) - 20 November 2023
8
27
 
9
28
  #### :bug: Bug Fixes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eeacms/volto-eea-design-system",
3
- "version": "1.21.0",
3
+ "version": "1.22.0",
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",
@@ -78,7 +78,14 @@ Banner.Action = React.forwardRef(function (
78
78
  ) {
79
79
  return (
80
80
  <div className="action" ref={ref}>
81
- <Button className={className} basic icon inverted onClick={onClick}>
81
+ <Button
82
+ className={className}
83
+ basic
84
+ icon
85
+ inverted
86
+ onClick={onClick}
87
+ {...rest}
88
+ >
82
89
  <Icon className={icon} color={color} title={title}></Icon>
83
90
  <span className={titleClass || 'mobile-sr-only'}>{title}</span>
84
91
  </Button>
@@ -345,10 +345,14 @@ function HeaderMenuPopUp({
345
345
  (current) => current.url === activeItem || current['@id'] === activeItem,
346
346
  );
347
347
 
348
+ // Get layout for current menu item and fallback to a * layout that can
349
+ // be used for all menu items that don't have a specific layout
348
350
  const layout =
349
- !!menuItemsLayouts &&
350
- Object.keys(menuItemsLayouts).includes(menuItem?.url) &&
351
- menuItemsLayouts[menuItem.url];
351
+ (!!menuItemsLayouts &&
352
+ Object.keys(menuItemsLayouts).includes(menuItem?.url) &&
353
+ menuItemsLayouts[menuItem.url]) ||
354
+ (!!menuItemsLayouts && menuItemsLayouts['*']) ||
355
+ {};
352
356
 
353
357
  return (
354
358
  <Transition visible={visible} animation="slide down" duration={300}>
@@ -1,5 +1,7 @@
1
1
  import React from 'react';
2
- import { Tab, Container } from 'semantic-ui-react';
2
+ import { Tab, Container, Menu, Icon } from 'semantic-ui-react';
3
+ import cx from 'classnames';
4
+ import './style.less';
3
5
 
4
6
  export default {
5
7
  title: 'Components/Tab',
@@ -216,3 +218,188 @@ Vertical.argTypes = {
216
218
  },
217
219
  },
218
220
  };
221
+
222
+ function IconTabContent({
223
+ variant,
224
+ renderActive,
225
+ hideTabTitle,
226
+ iconPosition,
227
+ iconSize,
228
+ }) {
229
+ const panes = [
230
+ {
231
+ menuItem: (
232
+ <Menu.Item>
233
+ <div
234
+ className={cx({
235
+ 'asset-top': iconPosition === 'top',
236
+ 'asset-left': iconPosition === 'left',
237
+ 'asset-right': iconPosition === 'right',
238
+ })}
239
+ >
240
+ <Icon
241
+ className={cx('aligned ri-sun-line', iconSize)}
242
+ size={iconSize}
243
+ {...{
244
+ ...(hideTabTitle && {
245
+ role: 'img',
246
+ 'aria-hidden': 'false',
247
+ 'aria-label': 'Ground level ozone',
248
+ }),
249
+ }}
250
+ />
251
+ {!hideTabTitle && <>Ground level ozone</>}
252
+ </div>
253
+ </Menu.Item>
254
+ ),
255
+ render: () => (
256
+ <Tab.Pane>
257
+ is not directly emitted into the atmosphere. Instead, it forms in the
258
+ atmosphere from a chain of chemical reactions following emissions of
259
+ certain precursor gases: NOX, carbon monoxide (CO) and NMVOCs and
260
+ methane (CH4).
261
+ </Tab.Pane>
262
+ ),
263
+ },
264
+ {
265
+ menuItem: (
266
+ <Menu.Item>
267
+ <div
268
+ className={cx({
269
+ 'asset-top': iconPosition === 'top',
270
+ 'asset-left': iconPosition === 'left',
271
+ 'asset-right': iconPosition === 'right',
272
+ })}
273
+ >
274
+ <Icon
275
+ className={cx('aligned ri-moon-line', iconSize)}
276
+ size={iconSize}
277
+ {...{
278
+ ...(hideTabTitle && {
279
+ role: 'img',
280
+ 'aria-hidden': 'false',
281
+ 'aria-label': 'Nitrogen oxides',
282
+ }),
283
+ }}
284
+ />
285
+ {!hideTabTitle && <>Nitrogen oxides</>}
286
+ </div>
287
+ </Menu.Item>
288
+ ),
289
+ render: () => (
290
+ <Tab.Pane>
291
+ are emitted during fuel combustion from industrial facilities and the
292
+ road transport sector. NOX is a group of gases comprising nitrogen
293
+ monoxide (NO) and nitrogen dioxide (NO2). NO makes up the majority of
294
+ NOX emissions. NOX contributes to the formation of ozone and
295
+ particulate matter.
296
+ </Tab.Pane>
297
+ ),
298
+ },
299
+ {
300
+ menuItem: (
301
+ <Menu.Item>
302
+ <div
303
+ className={cx({
304
+ 'asset-top': iconPosition === 'top',
305
+ 'asset-left': iconPosition === 'left',
306
+ 'asset-right': iconPosition === 'right',
307
+ })}
308
+ >
309
+ <Icon
310
+ className={cx('aligned ri-flashlight-line', iconSize)}
311
+ size={iconSize}
312
+ {...{
313
+ ...(hideTabTitle && {
314
+ role: 'img',
315
+ 'aria-hidden': 'false',
316
+ 'aria-label': 'Particulate matter',
317
+ }),
318
+ }}
319
+ />
320
+ {!hideTabTitle && <>Particulate matter</>}
321
+ </div>
322
+ </Menu.Item>
323
+ ),
324
+ render: () => (
325
+ <Tab.Pane>
326
+ is a mixture of aerosol particles (solid and liquid) covering a wide
327
+ range of sizes and chemical compositions. PM is either directly
328
+ emitted as primary particles or it forms in the atmosphere from
329
+ emissions of certain precursor pollutants such as SO2, NOX, NH3 and
330
+ NMVOCs. PM is emitted from many anthropogenic sources, including both
331
+ combustion and non-combustion sources. Natural emissions of PM also
332
+ occur, including from sea salt and windblown Saharan dust.
333
+ </Tab.Pane>
334
+ ),
335
+ },
336
+ ];
337
+
338
+ return (
339
+ <Tab
340
+ panes={panes}
341
+ renderActiveOnly={renderActive}
342
+ menu={{
343
+ secondary: true,
344
+ pointing: true,
345
+ fluid: true,
346
+ className: variant,
347
+ tabIndex: 0,
348
+ }}
349
+ ></Tab>
350
+ );
351
+ }
352
+
353
+ const IconTabTemplate = (args) => (
354
+ <Container>
355
+ <IconTabContent {...args}></IconTabContent>
356
+ </Container>
357
+ );
358
+
359
+ export const MenuIcon = IconTabTemplate.bind({});
360
+
361
+ MenuIcon.args = {
362
+ renderActive: true,
363
+ hideTabTitle: false,
364
+ iconPosition: 'top',
365
+ iconSize: 'small',
366
+ variant: 'secondary',
367
+ };
368
+
369
+ MenuIcon.argTypes = {
370
+ hideTabTitle: {
371
+ description: 'hide label',
372
+ table: {
373
+ type: {
374
+ summary: 'boolean',
375
+ },
376
+ defaultValue: {
377
+ summary: false,
378
+ },
379
+ },
380
+ },
381
+ iconPosition: {
382
+ control: {
383
+ type: 'inline-radio',
384
+ options: ['top', 'left', 'right'],
385
+ },
386
+ description: 'icon position',
387
+ type: { name: 'string' },
388
+ table: {
389
+ defaultValue: { summary: '""' },
390
+ },
391
+ },
392
+ iconSize: {
393
+ control: { type: 'inline-radio' },
394
+ options: ['mini', 'tiny', 'small', 'big', 'massive'],
395
+ description: 'icon size',
396
+ table: {
397
+ type: {
398
+ summary: 'string',
399
+ },
400
+ defaultValue: {
401
+ summary: 'large',
402
+ },
403
+ },
404
+ },
405
+ };
@@ -0,0 +1,20 @@
1
+ .ui.menu .asset-top,
2
+ .ui.menu .asset-left,
3
+ .ui.menu .asset-right {
4
+ display: flex;
5
+ align-items: center;
6
+ gap: 0.6em;
7
+ }
8
+
9
+ .ui.menu .asset-top {
10
+ flex-direction: column;
11
+ text-align: center;
12
+ }
13
+
14
+ .ui.menu .asset-left {
15
+ flex-direction: row;
16
+ }
17
+
18
+ .ui.menu .asset-right {
19
+ flex-direction: row-reverse;
20
+ }
@@ -260,6 +260,7 @@
260
260
  width: 100%;
261
261
  align-items: flex-end;
262
262
  justify-content: flex-end;
263
+ gap: 0 @mainMenuGap;
263
264
 
264
265
  .item {
265
266
  a {
@@ -456,6 +457,7 @@
456
457
 
457
458
  .search-action {
458
459
  display: flex;
460
+ flex-shrink: 0;
459
461
  width: @mobileActionsBoxWidth;
460
462
  height: @mobileMainSectionHeight;
461
463
  align-items: center;
@@ -648,11 +650,12 @@
648
650
 
649
651
  .ui.text.menu {
650
652
  display: flex;
651
- width: 88%;
652
653
  max-height: 100%;
653
654
  flex-wrap: wrap;
654
- justify-content: space-between;
655
+ justify-content: end;
655
656
  margin: 0;
657
+ padding-left: 0;
658
+ gap: 0 @mainMenuGap;
656
659
 
657
660
  .item {
658
661
  padding: @mainMenuItemPadding;
@@ -115,6 +115,7 @@
115
115
  @computerLogoMarginTop : @rem-space-5;
116
116
 
117
117
  /* Main menu */
118
+ @mainMenuGap : @component-padding;
118
119
  @mainMenuItemColor : @primaryColor;
119
120
  @mainMenuItemInvertedColor : @white;
120
121
  @mainMenuItemFontSize : ~"min(max(0.875rem, 1.5vw), 1.125rem)";
@@ -104,3 +104,7 @@
104
104
  @size-12: @size-11 + @space-20; // 240px
105
105
  @size-13: @size-12 + @space-20; // 320px
106
106
  @size-14: @size-13 + @size-11; // 480px
107
+
108
+ // start of variables to use instead of direct tokens
109
+ @component-padding: @rem-space-5;
110
+ @component-separator: @rem-space-8;