@eeacms/volto-eea-design-system 0.6.0 → 0.7.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 (31) hide show
  1. package/CHANGELOG.md +90 -0
  2. package/package.json +3 -2
  3. package/src/index.js +4 -1
  4. package/src/semantic.less +4 -0
  5. package/src/ui/CallToAction/CallToAction.stories.jsx +33 -91
  6. package/src/ui/ContextNavigation/ContextNavigation.stories.jsx +73 -0
  7. package/src/ui/Header/Header.jsx +30 -11
  8. package/src/ui/Header/HeaderMenuPopUp.js +149 -67
  9. package/src/ui/UnderlinedTitle/UnderlinedTitle.stories.jsx +98 -0
  10. package/theme/theme.config +26 -11
  11. package/theme/themes/eea/assets/logo/eionet.svg +11 -9
  12. package/theme/themes/eea/collections/menu.variables +1 -1
  13. package/theme/themes/eea/elements/button.overrides +45 -0
  14. package/theme/themes/eea/elements/container.overrides +5 -2
  15. package/theme/themes/eea/extras/banner.variables +1 -1
  16. package/theme/themes/eea/extras/contentBox.less +9 -1
  17. package/theme/themes/eea/extras/contextNavigation.less +80 -0
  18. package/theme/themes/eea/extras/contextNavigation.variables +0 -0
  19. package/theme/themes/eea/extras/footer.less +0 -9
  20. package/theme/themes/eea/extras/footer.variables +1 -6
  21. package/theme/themes/eea/extras/header.less +8 -3
  22. package/theme/themes/eea/extras/header.variables +3 -0
  23. package/theme/themes/eea/extras/hero.less +9 -0
  24. package/theme/themes/eea/extras/hero.variables +7 -5
  25. package/theme/themes/eea/globals/site.variables +14 -4
  26. package/theme/themes/eea/globals/utilities.less +22 -4
  27. package/theme/themes/eea/modules/accordion.overrides +41 -0
  28. package/theme/themes/eea/modules/accordion.variables +6 -6
  29. package/theme/themes/eea/views/card.overrides +4 -0
  30. package/theme/themes/eea/views/card.variables +2 -2
  31. package/theme/themes/eea/views/item.overrides +21 -3
package/CHANGELOG.md CHANGED
@@ -4,8 +4,98 @@ 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.0](https://github.com/eea/volto-eea-design-system/compare/0.6.5...0.7.0)
8
+
9
+ - Autobuild of docusaurus docs [`dd56a87`](https://github.com/eea/volto-eea-design-system/commit/dd56a87ca49282b8660b2fc1edc73f31441cceb2)
10
+ - change(mega menu): use non variable to fix build of volto-kitkat-frontend [`3ecd652`](https://github.com/eea/volto-eea-design-system/commit/3ecd652405ba616c9defc86fd793f8c066c0af1e)
11
+ - Autobuild of docusaurus docs [`a67aeb8`](https://github.com/eea/volto-eea-design-system/commit/a67aeb89dd7590605af9fd1fc4d99812061e166b)
12
+ - change(header): prefix mega-menu active class for adding border [`32898cb`](https://github.com/eea/volto-eea-design-system/commit/32898cb19c20ee7696c51b99cd9df25a333ae6e9)
13
+ - bump release version to 0.7.0 [`fa82cbd`](https://github.com/eea/volto-eea-design-system/commit/fa82cbd7d50765c322bc5c7c58abb5675e0aadad)
14
+ - Theme fixes, mega menu selected element both in desktop and mobile #211 [`b482729`](https://github.com/eea/volto-eea-design-system/commit/b4827292a9badb02f178b7431cc63e11070784ea)
15
+ - change(tests): try to modify tests to use slate instead of draft [`a2e2485`](https://github.com/eea/volto-eea-design-system/commit/a2e248593433a7a8bf612008c12a3a20a0049d86)
16
+ - change(tests): use data-slate-editor instead of contents that was found in draft js instead of slate [`1e0413c`](https://github.com/eea/volto-eea-design-system/commit/1e0413cf117c098b188e00249c323f2f718b9299)
17
+ - fix(container): add padding also for block editors when we are on the add page not just edit [`b857aad`](https://github.com/eea/volto-eea-design-system/commit/b857aad7855c30c5059b0f0f7c0f720826a71aa7)
18
+ - fix eslint warnings [`3b30282`](https://github.com/eea/volto-eea-design-system/commit/3b30282ea4df59f2d05644cae5c1d703b4dc48b3)
19
+ - feature(megamenu): open default accordions on mobile navigation based on pathname [`cc299c1`](https://github.com/eea/volto-eea-design-system/commit/cc299c1047f96aa5f85cdc4bb8bb9b3b4fb9ca5e)
20
+ - fix(megamenu): key warning errors [`4ecd279`](https://github.com/eea/volto-eea-design-system/commit/4ecd27921546204dfa4aa23d25188876e52cda7a)
21
+ - change(megamenu): set active class on storybook list items [`112bff1`](https://github.com/eea/volto-eea-design-system/commit/112bff195cd07e789b352ae239a148a168b4d877)
22
+ - change(megamenu): add border for active element of menu [`5e7dfa5`](https://github.com/eea/volto-eea-design-system/commit/5e7dfa539dc0d126dfb057ac2d293c94b31561bb)
23
+ - change(megamenu): use renderMenuItem in order to render menu items [`9ed5cbd`](https://github.com/eea/volto-eea-design-system/commit/9ed5cbdf120ee2c92e5f14c09e5289a5abe3f8b0)
24
+ - change(megamenu): WIP bringing back rendering of item with callback and path modification [`6e43d43`](https://github.com/eea/volto-eea-design-system/commit/6e43d4340ea82afde950e5fee44a76119060fc28)
25
+ - Autobuild of docusaurus docs [`4772d30`](https://github.com/eea/volto-eea-design-system/commit/4772d30900d7689d8d3e64fab989f5d7e845074a)
26
+ - change(footer): replaced eionet logo with an svg variant and tweaked size of eionet to match size of eea logo [`32ce462`](https://github.com/eea/volto-eea-design-system/commit/32ce4623ad454edec864ad6c8b45cbf99465bede)
27
+ - Autobuild of docusaurus docs [`4b6cc9b`](https://github.com/eea/volto-eea-design-system/commit/4b6cc9b997f3ce4821843f7c36d163aa571e6e43)
28
+ - fix(header): bump opacity of gradient class to get rid of green hue of header text [`2011b40`](https://github.com/eea/volto-eea-design-system/commit/2011b40d384ae5b54a0525e6d9afc88c02f6ca90)
29
+ - Autobuild of docusaurus docs [`1453ad3`](https://github.com/eea/volto-eea-design-system/commit/1453ad3dec7ba4b020215cd34e3105e8442cb363)
30
+ - feat(accordion,buttons): primary, secondary and tertiary variations #209 [`c34617f`](https://github.com/eea/volto-eea-design-system/commit/c34617f7a7d7b6b7568c3127f4ae0f52bd57cf8a)
31
+ - change(stories): hide variant control from button link story [`43f8c41`](https://github.com/eea/volto-eea-design-system/commit/43f8c412f6762edbed9c60e613736d5b60677cd1)
32
+ - change(stories): hide variant control from button link story [`aea7126`](https://github.com/eea/volto-eea-design-system/commit/aea712668331f5681028d961b42a05655f1113d3)
33
+ - Autobuild of docusaurus docs [`b517dc8`](https://github.com/eea/volto-eea-design-system/commit/b517dc88b193f9c99580a9950f0bfe51cca13843)
34
+ - feature(mega-menu): added menu slide down animation #208 [`4360d0e`](https://github.com/eea/volto-eea-design-system/commit/4360d0ef570fbfcc9989170219f7826e5ed780cf)
35
+ - change(accordion): style default accordion using the grey from semantic ui [`e24907d`](https://github.com/eea/volto-eea-design-system/commit/e24907df397457bd9704905aa29ea5d7e1d396cd)
36
+ - Autobuild of docusaurus docs [`03e8086`](https://github.com/eea/volto-eea-design-system/commit/03e8086444f33224a21563ff01a51541232c8a0f)
37
+ - change(package): condition modification of navDepth settings [`dd21dad`](https://github.com/eea/volto-eea-design-system/commit/dd21dadf34f87f08223be3b98c06e7a2f0714326)
38
+ - Autobuild of docusaurus docs [`8efc75b`](https://github.com/eea/volto-eea-design-system/commit/8efc75b7446283129d3ee68dbab1f7dbd2e4c5ba)
39
+ - feature(theme): added context navigation component story and default style [`5a6955f`](https://github.com/eea/volto-eea-design-system/commit/5a6955fe935cf6a07f6593164014ed4c9e77d88f)
40
+ - refactor(callToAction): update tertiary state colors [`159668a`](https://github.com/eea/volto-eea-design-system/commit/159668ac526a98032392bcbd2c115dc448193152)
41
+ - refactor(accordion): add variations and create a default export [`4a9c68f`](https://github.com/eea/volto-eea-design-system/commit/4a9c68ffe933c9d700e46db3e0cbbd9e3820c7c7)
42
+ - refactor(accordion): add color variations [`3504c15`](https://github.com/eea/volto-eea-design-system/commit/3504c15cc861803dc263fb2ad3b6a478043ced33)
43
+ - refactor(callToAction): add tertiary variant and restructure exports [`ac6695a`](https://github.com/eea/volto-eea-design-system/commit/ac6695ab3066c41739ec4852f0ec3c3bb6cea346)
44
+ - refactor(colors): add tertiary shades for element states [`1e24a7e`](https://github.com/eea/volto-eea-design-system/commit/1e24a7e13b50f1ee7bd9bd44f3b2eb8e4460c691)
45
+ - fix(header): remove console log [`3a20023`](https://github.com/eea/volto-eea-design-system/commit/3a200233609bbcea39d8e519dc292a132a98aaa3)
46
+ - refactor(megaMenu): add slide down transition and update targetRefs on close [`9667157`](https://github.com/eea/volto-eea-design-system/commit/96671574f5f7dd992269c42e509598f62bba516d)
47
+
48
+ #### [0.6.5](https://github.com/eea/volto-eea-design-system/compare/0.6.1...0.6.5)
49
+
50
+ > 6 July 2022
51
+
52
+ - change(design-systems): header section fixes [`#207`](https://github.com/eea/volto-eea-design-system/pull/207)
53
+ - change(package): bump package version to 0.6.5 denoting bug fixes release [`0585aeb`](https://github.com/eea/volto-eea-design-system/commit/0585aebaeb9e3483ba230110d99a1a875590ad66)
54
+ - Autobuild of docusaurus docs [`590c55f`](https://github.com/eea/volto-eea-design-system/commit/590c55f1099d926959c2cca929ca8fab32fe41b4)
55
+ - fix(menu): removed minHeight that enlarged the global menu [`133be1e`](https://github.com/eea/volto-eea-design-system/commit/133be1e43d9b7778fd94388629400c5f2b707ff4)
56
+ - Autobuild of docusaurus docs [`91f0f33`](https://github.com/eea/volto-eea-design-system/commit/91f0f33cfeaf4d9aaecc870ca04a72318e8294ad)
57
+ - fix(contentBox): removed negative z-index that hid fullwidth bg color [`bd60faf`](https://github.com/eea/volto-eea-design-system/commit/bd60faff53205da95d94930517f2ac830ec523d1)
58
+ - Autobuild of docusaurus docs [`d337cf3`](https://github.com/eea/volto-eea-design-system/commit/d337cf3364624309727afbe25b88a5cca80ef290)
59
+ - change(typography): updated letterspacing values and clarified values used for certain type tokens [`8a13bf8`](https://github.com/eea/volto-eea-design-system/commit/8a13bf8b3691d288209532842fb2c80962d652c0)
60
+ - Autobuild of docusaurus docs [`416345a`](https://github.com/eea/volto-eea-design-system/commit/416345ab9f2a3dcc7a5c3cfff3847e7d71e24ae5)
61
+ - fix(header): double click to close dropdown is no longer required [`b8a2ed0`](https://github.com/eea/volto-eea-design-system/commit/b8a2ed0d1e671d12239ecaf250e68b3187c12a53)
62
+ - Autobuild of docusaurus docs [`596487f`](https://github.com/eea/volto-eea-design-system/commit/596487fb393bcf34a1f8258e18edae27a6e51bba)
63
+ - change(item): enable theming for icon and text color and added tertiary option [`6d4444f`](https://github.com/eea/volto-eea-design-system/commit/6d4444feedd1cd7e6e8f8da630b4b53a19050d1b)
64
+ - Autobuild of docusaurus docs [`886d6ac`](https://github.com/eea/volto-eea-design-system/commit/886d6acca4b91a9234eb544e96fb889d0df36956)
65
+ - change(header): top section chevron sizes and margin as requested in enhancements document [`b307c74`](https://github.com/eea/volto-eea-design-system/commit/b307c74a671c10a5a6703dcb2126c3c36679c6f5)
66
+ - fix(hero): image dimensions when full width and height isn't enabled [`4114f73`](https://github.com/eea/volto-eea-design-system/commit/4114f731cce63dc520bfd00cd487943181cec2ee)
67
+ - change(item): tweak size and padding of icon when used inside item [`dbdef19`](https://github.com/eea/volto-eea-design-system/commit/dbdef191e70bf59dcfddf63c8f9f9a1343266a59)
68
+ - Autobuild of docusaurus docs [`3551ada`](https://github.com/eea/volto-eea-design-system/commit/3551adad680c2c8da0cb345b6dd4d9f3c01e9f38)
69
+ - change(utilities): wrap in quotes h2 and h3 of quoted-wrapper [`8aa4716`](https://github.com/eea/volto-eea-design-system/commit/8aa471604fb127cfa535373bb90a44b4204dd0f4)
70
+ - Autobuild of docusaurus docs [`a92c31a`](https://github.com/eea/volto-eea-design-system/commit/a92c31a4e8e4473086554a1f4ab8c8d6cd2e5c85)
71
+ - change(hero): tweaked hero block height and padding [`994b6f8`](https://github.com/eea/volto-eea-design-system/commit/994b6f8943c061657792df8adcbdee5da487ce43)
72
+ - Autobuild of docusaurus docs [`772d55b`](https://github.com/eea/volto-eea-design-system/commit/772d55b041d0728e64cdfd19bcd0684df0312f42)
73
+ - change(cards): add underline to links when applied to headers and use tertiary color by default [`874f956`](https://github.com/eea/volto-eea-design-system/commit/874f956c61e65ddbb6a240865f3946bb84247712)
74
+ - Autobuild of docusaurus docs [`93ae789`](https://github.com/eea/volto-eea-design-system/commit/93ae7897286ff65be193f2c576e6472a8e883bde)
75
+ - fix(header): menu generation when atAGlance isn't found [`d68b03c`](https://github.com/eea/volto-eea-design-system/commit/d68b03c05f7671e7ea154efe0199c29a3734fbcf)
76
+
77
+ #### [0.6.1](https://github.com/eea/volto-eea-design-system/compare/0.6.0...0.6.1)
78
+
79
+ > 1 July 2022
80
+
81
+ - Release [`#206`](https://github.com/eea/volto-eea-design-system/pull/206)
82
+ - Autobuild of docusaurus docs [`aa070d4`](https://github.com/eea/volto-eea-design-system/commit/aa070d4397a7369cc439d78b6355a9e6f0c5c3ff)
83
+ - feat(headers): added underlined titles with theming support [`af67561`](https://github.com/eea/volto-eea-design-system/commit/af675616f9e002458501cf8b90742514153a298f)
84
+ - refactor(heading): move underline story and update controls [`2c9bfd2`](https://github.com/eea/volto-eea-design-system/commit/2c9bfd279eafc44435d223be326f9496856c2154)
85
+ - chore(countup): package for statistics [`26fcd09`](https://github.com/eea/volto-eea-design-system/commit/26fcd09bbd8d44119d5ca957542863be8c64836b)
86
+ - refactor(underlinedTitle): Restore text variation dropdown control [`bd8c611`](https://github.com/eea/volto-eea-design-system/commit/bd8c61129d2c80475af8d0e9310412d5c3a82169)
87
+ - refactor(underlineTitle): add content box for different variations [`0878915`](https://github.com/eea/volto-eea-design-system/commit/087891535059d6c2d7d2c2accded20f6ba601bb5)
88
+ - refactor(underlinedTitle): add control for changing heading size [`211f515`](https://github.com/eea/volto-eea-design-system/commit/211f5158bff2b437aac60f26ba63f9adb6be540a)
89
+ - refactor(utilities): add color variation for headings and text [`7e3a779`](https://github.com/eea/volto-eea-design-system/commit/7e3a779ec4fa3b712fcd32124f6f83ab784d2223)
90
+ - refactor(utilities): update border bottom utility and restore line height for headings [`7fe4a7b`](https://github.com/eea/volto-eea-design-system/commit/7fe4a7b9fee579d213fe3945a4e548ff089784bd)
91
+ - refactor(headings): update the line height of headers according to docusaurus instructions [`9da19b3`](https://github.com/eea/volto-eea-design-system/commit/9da19b3e1ea1fd93431e00edf3dc9a443e94f27a)
92
+ - feat(UnderlinedTitle): create story and necessary utilities [`8beb56b`](https://github.com/eea/volto-eea-design-system/commit/8beb56b64ca76fb9f0f6df0f3554e64449a64868)
93
+
7
94
  #### [0.6.0](https://github.com/eea/volto-eea-design-system/compare/0.5.5...0.6.0)
8
95
 
96
+ > 1 July 2022
97
+
98
+ - Pagination, Item refactoring, docusaurus updates, fixes from custom [`#205`](https://github.com/eea/volto-eea-design-system/pull/205)
9
99
  - [Tokens] Letter spacing update [`#189`](https://github.com/eea/volto-eea-design-system/pull/189)
10
100
  - Refactor docusaurus [`#180`](https://github.com/eea/volto-eea-design-system/pull/180)
11
101
  - [R2] Pagination [`#162`](https://github.com/eea/volto-eea-design-system/pull/162)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eeacms/volto-eea-design-system",
3
- "version": "0.6.0",
3
+ "version": "0.7.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",
@@ -22,7 +22,8 @@
22
22
  "dependencies": {
23
23
  "@eeacms/volto-corsproxy": "*",
24
24
  "remixicon": "2.5.0",
25
- "react-slick": "^0.28.1"
25
+ "react-slick": "^0.28.1",
26
+ "react-countup": "^6.3.0"
26
27
  },
27
28
  "devDependencies": {
28
29
  "@cypress/code-coverage": "^3.9.5",
package/src/index.js CHANGED
@@ -1,5 +1,8 @@
1
1
  const applyConfig = (config) => {
2
- config.settings.navDepth = 3;
2
+ config.settings = {
3
+ ...(config.settings || {}),
4
+ navDepth: 3,
5
+ };
3
6
  return config;
4
7
  };
5
8
 
package/src/semantic.less CHANGED
@@ -229,6 +229,10 @@
229
229
  @import '@eeacms/volto-eea-design-system/../theme/themes/eea/extras/header';
230
230
  }
231
231
 
232
+ & {
233
+ @import '@eeacms/volto-eea-design-system/../theme/themes/eea/extras/contextNavigation';
234
+ }
235
+
232
236
  & {
233
237
  @import '@eeacms/volto-eea-design-system/../theme/themes/eea/extras/inpageNavigation';
234
238
  }
@@ -5,6 +5,17 @@ export default {
5
5
  title: 'Components/Call To Action',
6
6
  component: Button,
7
7
  argTypes: {
8
+ variant: {
9
+ name: 'Variation',
10
+ defaultValue: 'primary',
11
+ options: ['default', 'primary', 'secondary', 'tertiary'],
12
+ control: { type: 'select' },
13
+ description: 'call to action variation',
14
+ table: {
15
+ defaultValue: { summary: 'primary' },
16
+ type: { summary: 'string' },
17
+ },
18
+ },
8
19
  label: {
9
20
  description: 'link label',
10
21
  table: {
@@ -37,49 +48,11 @@ export default {
37
48
 
38
49
  //Default Call To Action
39
50
  export const Default = (args) => {
40
- return (
41
- <Container>
42
- <Button as="a" disabled={args.disabled} href={args.href} target="_blank">
43
- {args.label}
44
- </Button>
45
- </Container>
46
- );
47
- };
48
- Default.args = {
49
- label: 'Default Call To Action',
50
- href: '/#',
51
- disabled: false,
52
- };
53
-
54
- //Primary Call To Action
55
- export const Primary = (args) => {
56
- return (
57
- <Container>
58
- <Button
59
- primary
60
- as="a"
61
- disabled={args.disabled}
62
- href={args.href}
63
- target="_blank"
64
- >
65
- {args.label}
66
- </Button>
67
- </Container>
68
- );
69
- };
70
- Primary.args = {
71
- label: 'Primary Call To Action',
72
- href: '/#',
73
- disabled: false,
74
- };
75
-
76
- //Secondary Call To Action
77
- export const Secondary = (args) => {
78
51
  return (
79
52
  <Container>
80
53
  <Button
81
- secondary
82
54
  as="a"
55
+ className={args.variant === 'default' ? '' : args.variant}
83
56
  disabled={args.disabled}
84
57
  href={args.href}
85
58
  target="_blank"
@@ -89,8 +62,9 @@ export const Secondary = (args) => {
89
62
  </Container>
90
63
  );
91
64
  };
92
- Secondary.args = {
93
- label: 'Secondary Call To Action',
65
+ Default.args = {
66
+ variant: 'primary',
67
+ label: 'Call To Action',
94
68
  href: '/#',
95
69
  disabled: false,
96
70
  };
@@ -99,64 +73,39 @@ Secondary.args = {
99
73
  export const Inverted = (args) => {
100
74
  return (
101
75
  <Container>
102
- <Segment compact>
76
+ <Segment compact className={args.variant === 'default' ? 'inverted' : ''}>
103
77
  <Button
104
- primary
105
78
  inverted
106
79
  as="a"
107
80
  disabled={args.disabled}
108
- href={args.href1}
81
+ href={args.href}
109
82
  target="_blank"
83
+ className={args.variant === 'default' ? '' : args.variant}
110
84
  >
111
- {args.button1}
112
- </Button>
113
- </Segment>
114
- <Segment compact>
115
- <Button
116
- secondary
117
- inverted
118
- as="a"
119
- disabled={args.disabled}
120
- href={args.href2}
121
- target="_blank"
122
- >
123
- {args.button2}
124
- </Button>
125
- </Segment>
126
- <Segment inverted compact>
127
- <Button
128
- inverted
129
- as="a"
130
- disabled={args.disabled}
131
- href={args.href3}
132
- target="_blank"
133
- >
134
- {args.button3}
85
+ {args.label}
135
86
  </Button>
136
87
  </Segment>
137
88
  </Container>
138
89
  );
139
90
  };
140
91
  Inverted.args = {
141
- button1: 'Primary Call To Action',
142
- button2: 'Secondary Call To Action',
143
- button3: 'Default Call To Action',
144
- href1: '/#',
145
- href2: '/#',
146
- href3: '/#',
92
+ variant: 'primary',
93
+ label: 'Inverted Call To Action',
94
+ href: '/#',
147
95
  disabled: false,
148
96
  };
149
- Inverted.parameters = {
150
- controls: { exclude: ['label', 'href'] },
151
- hideNoControlsWarning: true,
152
- };
153
97
 
154
98
  //Labeled Call To Action
155
99
  export const Labeled = (args) => {
156
100
  return (
157
101
  <Container>
158
102
  <Button
159
- className={args.variant + ' icon ' + args.icon_position + ' labeled'}
103
+ className={
104
+ (args.variant === 'default' ? '' : args.variant) +
105
+ ' icon ' +
106
+ args.icon_position +
107
+ ' labeled'
108
+ }
160
109
  as="a"
161
110
  disabled={args.disabled}
162
111
  href={args.href}
@@ -169,22 +118,14 @@ export const Labeled = (args) => {
169
118
  );
170
119
  };
171
120
  Labeled.args = {
121
+ variant: 'primary',
172
122
  label: 'Labeled Call To Action',
173
123
  icon: 'chevron right',
124
+ icon_position: 'right',
174
125
  href: '/#',
175
126
  disabled: false,
176
127
  };
177
128
  Labeled.argTypes = {
178
- variant: {
179
- options: ['primary', 'secondary', 'default'],
180
- description: 'call to action class',
181
- control: { type: 'radio' },
182
- defaultValue: 'secondary',
183
- table: {
184
- defaultValue: { summary: 'secondary' },
185
- type: { summary: 'string' },
186
- },
187
- },
188
129
  icon: {
189
130
  name: 'icon',
190
131
  defaultValue: 'chevron right',
@@ -213,10 +154,10 @@ Labeled.argTypes = {
213
154
  icon_position: {
214
155
  options: ['left', 'right'],
215
156
  control: { type: 'radio' },
216
- defaultValue: 'left',
157
+ defaultValue: 'right',
217
158
  description: 'icon left or right position',
218
159
  table: {
219
- defaultValue: { summary: 'left' },
160
+ defaultValue: { summary: 'right' },
220
161
  type: { summary: 'string' },
221
162
  },
222
163
  },
@@ -235,5 +176,6 @@ Link.args = {
235
176
  href: '/#',
236
177
  };
237
178
  Link.parameters = {
179
+ controls: { exclude: ['Variation', 'disabled'] },
238
180
  hideNoControlsWarning: true,
239
181
  };
@@ -0,0 +1,73 @@
1
+ import React from 'react';
2
+
3
+ const Template = (args) => (
4
+ <nav className="context-navigation">
5
+ <div className="context-navigation-header">Navigation</div>
6
+ <div role="list" className="ui list">
7
+ <div role="listitem" className="item level-1">
8
+ <div className="content">
9
+ <a title="" className="contenttype-folder" href="/api/folder1">
10
+ Folder1
11
+ </a>
12
+ </div>
13
+ </div>
14
+ <div role="listitem" className="item level-1">
15
+ <div className="content">
16
+ <a
17
+ title=""
18
+ className="contenttype-folder in_path"
19
+ href="/api/folder2/folder21"
20
+ >
21
+ Folder21
22
+ </a>
23
+ <div className="list">
24
+ <div role="listitem" className="item level-2">
25
+ <div className="content">
26
+ <a
27
+ title=""
28
+ className="contenttype-document"
29
+ href="/api/folder2/folder21/doc211"
30
+ >
31
+ Doc211
32
+ </a>
33
+ </div>
34
+ </div>
35
+ <div role="listitem" className="active item level-2">
36
+ <div className="content">
37
+ <a
38
+ title=""
39
+ className="contenttype-document"
40
+ href="/api/folder2/folder21/doc211-copy"
41
+ >
42
+ Doc212
43
+ <div className="content active-indicator">
44
+ <svg
45
+ xmlns="http://www.w3.org/2000/svg"
46
+ viewBox="0 0 36 36"
47
+ className="icon"
48
+ >
49
+ <path
50
+ fill-rule="evenodd"
51
+ d="M21.293 9.293L22.707 10.707 15.414 18 22.707 25.293 21.293 26.707 12.586 18z"
52
+ ></path>
53
+ </svg>
54
+ </div>
55
+ </a>
56
+ </div>
57
+ </div>
58
+ </div>
59
+ </div>
60
+ </div>
61
+ </div>
62
+ </nav>
63
+ );
64
+
65
+ export default {
66
+ title: 'Components/Navigation portlet',
67
+ component: Template,
68
+ };
69
+
70
+ export const Default = Template.bind({});
71
+ Default.args = {
72
+ root: 'https://www.eea.europa.eu/',
73
+ };
@@ -54,6 +54,8 @@ const TopDropdownMenu = ({
54
54
  text={mobileText || text}
55
55
  icon={icon || 'chevron down'}
56
56
  aria-label="dropdown"
57
+ closeOnChange={false}
58
+ closeOnBlur={false}
57
59
  >
58
60
  <Dropdown.Menu role="group">{children}</Dropdown.Menu>
59
61
  </Dropdown>
@@ -134,6 +136,19 @@ const Main = ({
134
136
  }
135
137
  };
136
138
 
139
+ const menuOnClickOutside = () => {
140
+ // restore active element if nothing was selected from the menu dropdown
141
+ if (pathname !== activeItem) {
142
+ setActiveItem(pathname);
143
+ }
144
+ // close mobile navigation when clicking outside if we have value for nav
145
+ if (burger) {
146
+ setBurger('');
147
+ }
148
+ // always close the menu
149
+ setMenuIsActive(false);
150
+ };
151
+
137
152
  const menuOnClick = (e, item) => {
138
153
  if (searchIsActive) setSearchIsActive(false);
139
154
  setActiveItem(item['@id'] || item.url);
@@ -151,6 +166,7 @@ const Main = ({
151
166
  const node = React.useRef();
152
167
  const searchButtonRef = React.useRef();
153
168
  const mobileMenuBurgerRef = React.useRef();
169
+ const desktopMenuRef = React.useRef();
154
170
 
155
171
  // disable sticky setting until feature is more stable
156
172
  // const isScrollingUp = useScrollingUp();
@@ -172,7 +188,10 @@ const Main = ({
172
188
  <Grid.Column mobile={4} tablet={4} computer={8}>
173
189
  <div className={inverted ? 'main-menu inverted' : 'main-menu'}>
174
190
  {menuItems && (
175
- <Menu className="eea-main-menu tablet or lower hidden" text>
191
+ <div
192
+ className="ui text eea-main-menu tablet or lower hidden menu"
193
+ ref={desktopMenuRef}
194
+ >
176
195
  {menuItems.map((item) => (
177
196
  <Menu.Item
178
197
  name={item['@id'] || item.url}
@@ -187,7 +206,7 @@ const Main = ({
187
206
  })}
188
207
  </Menu.Item>
189
208
  ))}
190
- </Menu>
209
+ </div>
191
210
  )}
192
211
  <div
193
212
  className="search-action"
@@ -221,15 +240,15 @@ const Main = ({
221
240
  triggerRefs={[searchButtonRef]}
222
241
  />
223
242
  )}
224
- {menuIsActive && (
225
- <HeaderMenuPopUp
226
- renderMenuItem={renderMenuItem}
227
- activeItem={activeItem}
228
- menuItems={menuItems}
229
- onClose={mobileBurgerOnClick}
230
- triggerRefs={[mobileMenuBurgerRef]}
231
- />
232
- )}
243
+ <HeaderMenuPopUp
244
+ renderMenuItem={renderMenuItem}
245
+ activeItem={activeItem}
246
+ menuItems={menuItems}
247
+ pathName={pathname}
248
+ onClose={menuOnClickOutside}
249
+ triggerRefs={[mobileMenuBurgerRef, desktopMenuRef]}
250
+ visible={menuIsActive}
251
+ />
233
252
  </div>
234
253
  );
235
254
  };