@ecl/site-header 5.0.0-alpha.1 → 5.0.0-alpha.11

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/README.md CHANGED
@@ -11,15 +11,16 @@ npm install --save @ecl/site-header
11
11
  - **"logged"** (boolean) (default: false): Whether the user is logged in or not
12
12
  - **"menu"** (associative array): Menu content, if any. Uses ECL Menu structure
13
13
  - **"banner_top"** (string) OR (object with Link component in property): Class name
14
- - **"icon_path"** (string) (default: ''): file containing the svg icons
15
14
  - **"site_name"** (string) (default: '') Site name
15
+ - **"site_name_mobile_only"** (boolean): Whether the site name should be hidden on desktop or not
16
16
  - **"logo"** (associative array) (default: predefined structure): Logo image settings. format:
17
17
  - "title" (string) (default: ''): Logo title attribute.
18
18
  - "alt" (string) (default: ''): Logo alt attribute.
19
+ - "breakpoint": (string) (default: 's') Expected value in EU is "l"
19
20
  - "href" (string) (default: ''): Logo URL.
20
21
  - "src_desktop" (string) (default: ''): Desktop logo image file path
21
22
  - "src_mobile" (string) (default: ''): Mobile logo image file path for EU only
22
- - "size": (string) (default: 'm'): Three sizes in desktop (s, m, l)
23
+ - "size": (string) (default: 'l'): Three sizes in desktop (s, m, l)
23
24
  - **"login_box"** (associative array) format:
24
25
  - "id": (string) Id of the box
25
26
  - "description" (string) Label for the logged in users
@@ -30,6 +31,14 @@ npm install --save @ecl/site-header
30
31
  - "href_not_logged" (string) Link to the login form
31
32
  - "label_logged" (string) Label for the logged in users
32
33
  - "href_logged" (string) Link to the logout form
34
+ - **"custom_action"** (associative array) (default: {}):
35
+ - "link" (object) (default: predefined structure) predefined structure for the Link component
36
+ - "icon" (optional) (associative array) OR (array) of associate arrays - Default structure of the icon component, but extra_classes is an internal key.
37
+ The name has to be non empty for the icon to be printed.
38
+ - "overlay": (associative array) (optional):
39
+ - "title": (string) (default: '') Overlay title
40
+ - "close": (associative array) (default: {})
41
+ - "content": (string) (default: '') HTML for the popover
33
42
  - **"language_selector"** (associative array) (default: predefined structure): Language switcher settings. format:
34
43
  - "href" (string) (default: ''): URL for switcher
35
44
  - "label" (string) (default: ''): Switcher language label, eg. 'English' in eu, 'EN' in ec
@@ -65,9 +74,7 @@ npm install --save @ecl/site-header
65
74
  ```twig
66
75
  {% include '@ecl/site-header/site-header.html.twig' with {
67
76
  banner_top: 'Class name',
68
- banner: 'Class name',
69
77
  site_name: 'This site name'
70
- icon_path: '/icons.svg',
71
78
  logo: {
72
79
  alt: 'European Commission',
73
80
  href: '/example',
@@ -87,6 +94,20 @@ npm install --save @ecl/site-header
87
94
  ...
88
95
  ],
89
96
  },
97
+ },
98
+ custom_action: {
99
+ href: '/notifications',
100
+ icon: 'bell',
101
+ label: 'Notifications',
102
+ aria_label: 'View notifications',
103
+ indicator: true,
104
+ overlay: {
105
+ title: 'Notifications',
106
+ close: {
107
+ label: 'Close'
108
+ },
109
+ content: '<p>You have new notifications.</p>',
110
+ },
90
111
  },
91
112
  login_toggle: {
92
113
  label_not_logged: 'Log in',
@@ -6,19 +6,20 @@ $theme: null !default;
6
6
  $language-switcher: null !default;
7
7
  $language-list: null !default;
8
8
 
9
- .ecl-site-header__language {
9
+ .ecl-site-header__language,
10
+ .ecl-site-header__custom-action {
10
11
  margin: 0;
11
12
  position: static;
12
13
  }
13
14
 
14
15
  @mixin with-scrollbar {
15
16
  overflow-y: auto;
16
- scrollbar-color: var(--c-n) rgba(0, 0, 0, 0);
17
+ scrollbar-color: var(--cm-surface-medium, var(--c-n)) rgb(0, 0, 0, 0);
17
18
  scrollbar-width: thin;
18
19
  }
19
20
 
20
21
  @mixin arrow-up {
21
- background-color: map.get($theme, 'color', 'white');
22
+ background-color: var(--cm-surface-inverted, #fff);
22
23
  border: map.get($language-switcher, 'arrow-border');
23
24
  box-shadow: map.get($language-switcher, 'arrow-shadow');
24
25
  clip-path: polygon(
@@ -43,8 +44,9 @@ $language-list: null !default;
43
44
  width: map.get($language-switcher, 'arrow-size');
44
45
  }
45
46
 
46
- .ecl-site-header__language-container {
47
- background-color: map.get($theme, 'color', 'white');
47
+ .ecl-site-header__language-container,
48
+ .ecl-site-header__custom-action-overlay {
49
+ background-color: var(--cm-surface-inverted, #fff);
48
50
  box-shadow: map.get($language-switcher, 'shadow');
49
51
  color: map.get($language-list, 'color');
50
52
  font: var(--f-m);
@@ -84,15 +86,16 @@ $language-list: null !default;
84
86
  .ecl-site-header__language-container--push-right::before,
85
87
  .ecl-site-header__language-container--full::before {
86
88
  left: auto;
87
- right: var(--ecl-language-arrow-position);
89
+ right: var(--ecl-overlay-arrow-position);
88
90
  }
89
91
 
90
92
  .ecl-site-header__language-container--push-left::before {
91
93
  right: auto;
92
- left: var(--ecl-language-arrow-position);
94
+ left: var(--ecl-overlay-arrow-position);
93
95
  }
94
96
 
95
- .ecl-site-header__language-header {
97
+ .ecl-site-header__language-header,
98
+ .ecl-site-header__custom-action-header {
96
99
  align-items: center;
97
100
  display: flex;
98
101
  justify-content: space-between;
@@ -102,11 +105,13 @@ $language-list: null !default;
102
105
  );
103
106
  }
104
107
 
105
- .ecl-site-header__language-title {
108
+ .ecl-site-header__language-title,
109
+ .ecl-site-header__custom-action-title {
106
110
  font: map.get($language-list, 'header-font-mobile');
107
111
  }
108
112
 
109
- .ecl-site-header__language-close {
113
+ .ecl-site-header__language-close,
114
+ .ecl-site-header__custom-action-close {
110
115
  position: absolute;
111
116
  right: map.get($language-switcher, 'close-right');
112
117
  top: map.get($language-switcher, 'close-top');
@@ -117,7 +122,8 @@ $language-list: null !default;
117
122
  }
118
123
  }
119
124
 
120
- .ecl-site-header__language-content {
125
+ .ecl-site-header__language-content,
126
+ .ecl-site-header__custom-action-content {
121
127
  display: flex;
122
128
  flex-direction: column;
123
129
 
@@ -159,7 +165,8 @@ $language-list: null !default;
159
165
  padding: 0;
160
166
  }
161
167
 
162
- .ecl-site-header__language-link {
168
+ .ecl-site-header__language-link,
169
+ .ecl-site-header__custom-action-link {
163
170
  align-items: baseline;
164
171
  border-inline-start: map.get($language-list, 'item-active-border-width') solid
165
172
  transparent;
@@ -178,7 +185,8 @@ $language-list: null !default;
178
185
  }
179
186
  }
180
187
 
181
- .ecl-site-header__language-link-code {
188
+ .ecl-site-header__language-link-code,
189
+ .ecl-site-header__custom-action-link-code {
182
190
  color: map.get($language-list, 'code-color');
183
191
  font: var(--f-m);
184
192
  font-weight: map.get($language-list, 'code-font-weight');
@@ -220,10 +228,12 @@ $language-list: null !default;
220
228
  }
221
229
 
222
230
  @include breakpoints.up('m') {
223
- .ecl-site-header__language {
231
+ .ecl-site-header__language,
232
+ .ecl-site-header__custom-action {
224
233
  position: relative;
225
234
  }
226
235
 
236
+ .ecl-site-header__custom-action-overlay,
227
237
  .ecl-site-header__language-container {
228
238
  left: 50%;
229
239
  padding-block-start: map.get(
@@ -249,7 +259,12 @@ $language-list: null !default;
249
259
  transform: translateX(-50%);
250
260
  }
251
261
 
252
- .ecl-site-header__language-title {
262
+ .ecl-site-header__custom-action-overlay {
263
+ width: 400px;
264
+ }
265
+
266
+ .ecl-site-header__language-title,
267
+ .ecl-site-header__custom-action-title {
253
268
  font: map.get($language-list, 'header-font-desktop');
254
269
  }
255
270
 
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@ecl/site-header",
3
3
  "author": "European Commission",
4
4
  "license": "EUPL-1.2",
5
- "version": "5.0.0-alpha.1",
5
+ "version": "5.0.0-alpha.11",
6
6
  "description": "ECL Site Header",
7
7
  "publishConfig": {
8
8
  "access": "public"
@@ -10,20 +10,20 @@
10
10
  "main": "site-header.js",
11
11
  "module": "site-header.js",
12
12
  "dependencies": {
13
- "@ecl/button": "5.0.0-alpha.1",
14
- "@ecl/dom-utils": "5.0.0-alpha.1",
15
- "@ecl/grid": "5.0.0-alpha.1",
16
- "@ecl/icon": "5.0.0-alpha.1",
17
- "@ecl/link": "5.0.0-alpha.1",
18
- "@ecl/menu": "5.0.0-alpha.1",
19
- "@ecl/notification": "5.0.0-alpha.1",
20
- "@ecl/picture": "5.0.0-alpha.1",
21
- "@ecl/search-form": "5.0.0-alpha.1",
13
+ "@ecl/button": "5.0.0-alpha.11",
14
+ "@ecl/dom-utils": "5.0.0-alpha.11",
15
+ "@ecl/grid": "5.0.0-alpha.11",
16
+ "@ecl/icon": "5.0.0-alpha.11",
17
+ "@ecl/link": "5.0.0-alpha.11",
18
+ "@ecl/menu": "5.0.0-alpha.11",
19
+ "@ecl/notification": "5.0.0-alpha.11",
20
+ "@ecl/picture": "5.0.0-alpha.11",
21
+ "@ecl/search-form": "5.0.0-alpha.11",
22
22
  "focus-trap": "7.6.4"
23
23
  },
24
24
  "devDependencies": {
25
- "@ecl/resources-ec-logo": "5.0.0-alpha.1",
26
- "@ecl/resources-eu-logo": "5.0.0-alpha.1"
25
+ "@ecl/resources-ec-logo": "5.0.0-alpha.11",
26
+ "@ecl/resources-eu-logo": "5.0.0-alpha.11"
27
27
  },
28
28
  "repository": {
29
29
  "type": "git",
@@ -39,5 +39,5 @@
39
39
  "design-system",
40
40
  "twig"
41
41
  ],
42
- "gitHead": "f800b6d2de209fcfe182aadca5f7e45ad497b23a"
42
+ "gitHead": "e2c8581dfaabe6f67ff063fed5839034f0148db3"
43
43
  }
@@ -11,34 +11,21 @@ $theme: null !default;
11
11
  $site-header: null !default;
12
12
  $language-list: null !default;
13
13
 
14
- @use 'site-header-language-switcher' with (
14
+ @use 'site-header-dropdown' with (
15
15
  $theme: $theme,
16
16
  $language-switcher: map.get($site-header, 'language-switcher'),
17
17
  $language-list: $language-list
18
18
  );
19
19
 
20
20
  .ecl-site-header {
21
+ background-color: map.get($site-header, 'background-color');
22
+ box-shadow: var(--sh-2);
21
23
  margin: 0;
22
24
  position: relative;
23
25
  z-index: map.get($theme, 'z-index', 'modal');
24
26
 
25
27
  .ecl-site-header__inner {
26
- box-shadow: var(--sh-6);
27
- }
28
-
29
- .ecl-site-header__background {
30
- background-color: map.get($site-header, 'background-color');
31
- background-image: url('data:image/svg+xml;base64,' + map.get(
32
- $site-header,
33
- 'background-image'
34
- ));
35
- background-position: right bottom;
36
- background-repeat: no-repeat;
37
- background-size: auto 100%;
38
- }
39
-
40
- &.ecl-site-header--rtl .ecl-site-header__background {
41
- background-position: left bottom;
28
+ box-shadow: var(--sh-2);
42
29
  }
43
30
 
44
31
  .ecl-menu,
@@ -53,7 +40,7 @@ $language-list: null !default;
53
40
  .ecl-menu__open,
54
41
  .ecl-mega-menu__open {
55
42
  position: relative;
56
- top: calc(-1 * var(--s-2xs));
43
+ top: calc(-1 * var(--s-xl));
57
44
  z-index: 54;
58
45
  }
59
46
 
@@ -74,7 +61,6 @@ $language-list: null !default;
74
61
  }
75
62
 
76
63
  .ecl-site-header__header {
77
- box-shadow: var(--sh-6);
78
64
  position: relative;
79
65
  z-index: 54;
80
66
  }
@@ -108,22 +94,22 @@ $language-list: null !default;
108
94
 
109
95
  &:hover {
110
96
  border-left: none;
111
- color: var(--c-d);
97
+ color: var(--cm-on-surface-brand);
112
98
  }
113
99
 
114
100
  &:focus-visible {
115
- color: var(--c-d);
101
+ color: var(--cm-on-surface-brand);
116
102
  }
117
103
 
118
104
  &:active {
119
- background-color: var(--c-n);
105
+ background-color: var(--cm-on-surface-neutral-medium);
120
106
  }
121
107
  }
122
108
 
123
109
  .ecl-site-header__action {
110
+ align-items: center;
124
111
  align-self: flex-end;
125
112
  display: flex;
126
- padding-bottom: var(--s-2xs);
127
113
 
128
114
  .ecl-button {
129
115
  box-sizing: border-box;
@@ -145,6 +131,7 @@ $language-list: null !default;
145
131
  text-transform: uppercase;
146
132
  }
147
133
 
134
+ .ecl-site-header__custom-action-toggle,
148
135
  .ecl-site-header__login-toggle,
149
136
  .ecl-site-header__search-toggle,
150
137
  .ecl-site-header__language-selector {
@@ -163,23 +150,47 @@ $language-list: null !default;
163
150
 
164
151
  &:active,
165
152
  &[aria-expanded='true'] {
166
- background-color: var(--c-n-80);
153
+ background-color: var(--cm-surface-neutral-low);
154
+ }
155
+ }
156
+
157
+ .ecl-site-header__custom-action-toggle {
158
+ &:hover {
159
+ text-decoration: none;
160
+ color: map.get($site-header, 'toggle-color');
161
+ }
162
+
163
+ .ecl-link__icon-container {
164
+ .ecl-site-header__icon {
165
+ margin-inline-end: 0;
166
+ }
167
+ }
168
+
169
+ .ecl-indicator:not(:empty) {
170
+ left: -18px;
171
+ right: auto;
167
172
  }
168
173
  }
169
174
 
170
175
  .ecl-site-header__login-box,
171
176
  .ecl-site-header__search {
172
- background-color: map.get($theme, 'color', 'white');
173
- box-shadow: var(--sh-12);
177
+ background-color: var(--cm-surface-inverted);
178
+ box-shadow: var(--sh-3);
174
179
  box-sizing: border-box;
175
- color: var(--c-d);
180
+ color: var(--cm-on-surface-brand);
176
181
  display: none;
177
182
  font: var(--f-m);
178
183
  left: 0;
179
184
  margin-top: var(--s-l);
180
- padding: var(--s-3xl) var(--s-m);
185
+ padding: var(--s-5xl) var(--s-m);
181
186
  position: absolute;
182
187
  z-index: map.get($theme, 'z-index', 'modal') + 1;
188
+
189
+ .ecl-search-form__button,
190
+ .ecl-search-form__text-input,
191
+ .ecl-search-form__text-input::placeholder {
192
+ font: var(--f-s);
193
+ }
183
194
  }
184
195
 
185
196
  .ecl-site-header__login-box {
@@ -189,7 +200,7 @@ $language-list: null !default;
189
200
  width: 100%;
190
201
 
191
202
  &::before {
192
- @include site-header-language-switcher.arrow-up;
203
+ @include site-header-dropdown.arrow-up;
193
204
 
194
205
  left: auto;
195
206
  right: var(--ecl-login-arrow-position);
@@ -206,13 +217,14 @@ $language-list: null !default;
206
217
  }
207
218
 
208
219
  .ecl-site-header__login-separator {
209
- background-color: var(--c-n);
220
+ background-color: var(--cm-border-neutral);
210
221
  border-width: 0;
211
222
  height: 1px;
212
223
  margin-bottom: var(--s-m);
213
224
  margin-top: var(--s-m);
214
225
  }
215
226
 
227
+ .ecl-site-header__custom-action-icon,
216
228
  .ecl-site-header__language-icon {
217
229
  align-items: center;
218
230
  display: flex;
@@ -224,7 +236,7 @@ $language-list: null !default;
224
236
  display: flex;
225
237
 
226
238
  &::before {
227
- @include site-header-language-switcher.arrow-up;
239
+ @include site-header-dropdown.arrow-up;
228
240
 
229
241
  left: auto;
230
242
  right: var(--ecl-search-arrow-position);
@@ -232,28 +244,31 @@ $language-list: null !default;
232
244
  }
233
245
 
234
246
  .ecl-site-header__notification {
235
- background-color: var(--c-bg);
236
- border-top: 1px solid var(--c-n-60);
247
+ background-color: var(--cm-surface-inverted);
237
248
  display: flex;
238
249
 
239
250
  .ecl-notification {
240
- background: map.get($theme, 'color', 'white');
241
- margin: var(--s-xl) 0;
251
+ background: var(--cm-surface-inverted);
252
+ margin: 0 0 var(--s-xl);
253
+ }
254
+
255
+ .ecl-notification__description,
256
+ .ecl-notification__link {
257
+ font: var(--f-s);
242
258
  }
243
259
  }
244
260
 
245
261
  .ecl-site-header__banner-top {
246
- background: var(--c-n-40);
247
- border-top: 1px solid var(--c-n);
248
- font: var(--f-m);
262
+ border-top: 1px solid var(--cm-border-neutral);
263
+ font: var(--f-s);
249
264
  padding: var(--s-xs) 0;
250
265
  }
251
266
 
252
267
  .ecl-site-header__banner {
253
- background-color: map.get($site-header, 'banner-background');
268
+ background: var(--cm-surface-neutral-lowest);
254
269
  color: map.get($site-header, 'banner-text-color');
255
270
  display: block;
256
- font: var(--f-l);
271
+ font: var(--f-2xl);
257
272
  min-height: 1.75rem;
258
273
  padding: var(--s-m) 0;
259
274
 
@@ -264,7 +279,7 @@ $language-list: null !default;
264
279
  }
265
280
 
266
281
  .ecl-site-header__site-name {
267
- margin-inline-end: var(--s-3xl);
282
+ margin-inline-end: var(--s-5xl);
268
283
  }
269
284
 
270
285
  // Menu display and position
@@ -298,7 +313,19 @@ $menu-top: calc(44px + 2 * var(--s-xs));
298
313
  top: $menu-top;
299
314
  }
300
315
 
316
+ @include breakpoints.up('s') {
317
+ .ecl-site-header__logo-image {
318
+ height: map.get($site-header, 'logo-height-lg-m');
319
+ }
320
+
321
+ .ecl-site-header .ecl-mega-menu__open,
322
+ .ecl-site-header .ecl-menu__open {
323
+ top: calc(-1 * var(--s-s));
324
+ }
325
+ }
326
+
301
327
  @include breakpoints.down('m') {
328
+ .ecl-site-header__custom-action-toggle,
302
329
  .ecl-site-header__login-toggle,
303
330
  .ecl-site-header__search-toggle,
304
331
  .ecl-site-header__language-selector {
@@ -309,6 +336,10 @@ $menu-top: calc(44px + 2 * var(--s-xs));
309
336
  line-height: 0;
310
337
  padding: var(--s-xs) 0;
311
338
 
339
+ .ecl-link__icon-container {
340
+ margin-inline-start: 0;
341
+ }
342
+
312
343
  .ecl-icon {
313
344
  width: 1.5rem;
314
345
  height: 1.5rem;
@@ -334,8 +365,6 @@ $menu-top: calc(44px + 2 * var(--s-xs));
334
365
 
335
366
  @include breakpoints.up('l') {
336
367
  .ecl-site-header {
337
- box-shadow: var(--sh-6);
338
-
339
368
  .ecl-site-header__cta {
340
369
  align-self: center;
341
370
  margin: 0;
@@ -350,7 +379,7 @@ $menu-top: calc(44px + 2 * var(--s-xs));
350
379
  width: 100%;
351
380
 
352
381
  .ecl-menu__mega {
353
- box-shadow: var(--sh-6);
382
+ box-shadow: var(--sh-2);
354
383
  }
355
384
  }
356
385
 
@@ -387,6 +416,10 @@ $menu-top: calc(44px + 2 * var(--s-xs));
387
416
  padding: var(--s-m) 0;
388
417
  }
389
418
 
419
+ .ecl-site-header__site-name--mobile-only {
420
+ display: none;
421
+ }
422
+
390
423
  .ecl-site-header__top {
391
424
  align-items: flex-end;
392
425
  }
@@ -435,7 +468,7 @@ $menu-top: calc(44px + 2 * var(--s-xs));
435
468
  left: 50%;
436
469
  margin-top: var(--s-l);
437
470
  min-width: 22rem;
438
- padding: var(--s-3xl);
471
+ padding: var(--s-5xl);
439
472
  transform: translateX(-50%);
440
473
  width: auto;
441
474
 
@@ -444,12 +477,13 @@ $menu-top: calc(44px + 2 * var(--s-xs));
444
477
  }
445
478
  }
446
479
 
480
+ .ecl-site-header__custom-action-toggle,
447
481
  .ecl-site-header__login-toggle,
448
482
  .ecl-site-header__language-selector {
449
483
  align-items: center;
450
484
  display: flex;
451
485
  flex-direction: row;
452
- font: var(--f-m);
486
+ font: var(--f-s);
453
487
 
454
488
  .ecl-site-header__icon {
455
489
  flex-shrink: 0;
@@ -485,7 +519,7 @@ $menu-top: calc(44px + 2 * var(--s-xs));
485
519
  }
486
520
 
487
521
  .ecl-site-header__search {
488
- background-color: map.get($theme, 'color', 'white');
522
+ background-color: var(--cm-surface-inverted);
489
523
  border-width: 0;
490
524
  box-shadow: none;
491
525
  display: flex;
@@ -497,7 +531,7 @@ $menu-top: calc(44px + 2 * var(--s-xs));
497
531
 
498
532
  .ecl-site-header__banner {
499
533
  box-shadow: none;
500
- font: var(--f-l);
534
+ font: var(--f-3xl);
501
535
  min-height: 0;
502
536
  padding: 0;
503
537