@itcenteratunihelsinki/huds-lib 0.6.5 → 0.6.7

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 (38) hide show
  1. package/dist/cjs/huds-lib.cjs.js +1 -1
  2. package/dist/cjs/{hy-accordion-container_89.cjs.entry.js → hy-accordion-container_83.cjs.entry.js} +610 -1317
  3. package/dist/cjs/loader.cjs.js +1 -1
  4. package/dist/collection/collection-manifest.json +0 -12
  5. package/dist/collection/components/cta-button/cta-button.js +26 -5
  6. package/dist/collection/components/hy-dropdown/hy-dropdown.js +2 -2
  7. package/dist/collection/components/navigation/hy-menu-main-group/hy-menu-main-group.js +20 -1
  8. package/dist/collection/components/site-header/site-header.css +16 -1
  9. package/dist/collection/components/site-header/site-header.js +15 -37
  10. package/dist/esm/huds-lib.js +1 -1
  11. package/dist/esm/{hy-accordion-container_89.entry.js → hy-accordion-container_83.entry.js} +612 -1313
  12. package/dist/esm/loader.js +1 -1
  13. package/dist/huds-lib/huds-lib.esm.js +1 -1
  14. package/dist/huds-lib/p-f86741ed.entry.js +86 -0
  15. package/dist/types/components/cta-button/cta-button.d.ts +1 -0
  16. package/dist/types/components/navigation/hy-menu-main-group/hy-menu-main-group.d.ts +1 -0
  17. package/dist/types/components/site-header/site-header.d.ts +0 -1
  18. package/dist/types/components.d.ts +5 -212
  19. package/package.json +1 -1
  20. package/dist/collection/components/navigation/menu/menu.css +0 -262
  21. package/dist/collection/components/navigation/menu/menu.js +0 -431
  22. package/dist/collection/components/navigation/menu-item/menu-item.css +0 -348
  23. package/dist/collection/components/navigation/menu-item/menu-item.js +0 -557
  24. package/dist/collection/components/navigation/menu-level-container/menu-level-container.css +0 -129
  25. package/dist/collection/components/navigation/menu-level-container/menu-level-container.js +0 -300
  26. package/dist/collection/components/navigation/menu-mobile-breadcrumb/menu-mobile-breadcrumb.css +0 -90
  27. package/dist/collection/components/navigation/menu-mobile-breadcrumb/menu-mobile-breadcrumb.js +0 -151
  28. package/dist/collection/components/navigation/mobile-menu-shortcuts/mobile-menu-shortcuts.css +0 -140
  29. package/dist/collection/components/navigation/mobile-menu-shortcuts/mobile-menu-shortcuts.js +0 -68
  30. package/dist/collection/components/site-header/hy-desktop-menu-links/hy-desktop-menu-links.css +0 -469
  31. package/dist/collection/components/site-header/hy-desktop-menu-links/hy-desktop-menu-links.js +0 -482
  32. package/dist/huds-lib/p-fd0fd0ea.entry.js +0 -86
  33. package/dist/types/components/navigation/menu/menu.d.ts +0 -30
  34. package/dist/types/components/navigation/menu-item/menu-item.d.ts +0 -31
  35. package/dist/types/components/navigation/menu-level-container/menu-level-container.d.ts +0 -27
  36. package/dist/types/components/navigation/menu-mobile-breadcrumb/menu-mobile-breadcrumb.d.ts +0 -12
  37. package/dist/types/components/navigation/mobile-menu-shortcuts/mobile-menu-shortcuts.d.ts +0 -13
  38. package/dist/types/components/site-header/hy-desktop-menu-links/hy-desktop-menu-links.d.ts +0 -60
@@ -1,431 +0,0 @@
1
- import { Component, Element, Event, h, Listen, Prop, State } from '@stencil/core';
2
- import { MenuType } from '../../../utils/utils';
3
- import { jsonParserWorker } from '../../../global/globalScript';
4
- let breadcrumbTimeout = null;
5
- let addbreadTimeout = null;
6
- export class Menu {
7
- constructor() {
8
- this.isGroup = false;
9
- this.isDemo = false;
10
- this.menuIsOpen = true;
11
- this.menuType = null;
12
- }
13
- // Listener for removing a breadcrumb from mobile menu breadcrumbs.
14
- async removeBreadcrumb(data) {
15
- clearTimeout(breadcrumbTimeout);
16
- let breadcrumbs = await jsonParserWorker(this.breadcrumbs);
17
- breadcrumbTimeout = setTimeout(() => {
18
- let currentBreadcrumb = breadcrumbs
19
- .map(function (e) {
20
- return e.bid;
21
- })
22
- .indexOf(data.detail.bid);
23
- for (let i = currentBreadcrumb, l = this.breadcrumbs.length; i < l; i++) {
24
- this.menuContainerToggled.emit({
25
- triggerItem: this.breadcrumbs[i].bid,
26
- triggerType: 'remove',
27
- });
28
- }
29
- this.breadcrumbs = [];
30
- this.breadcrumbs = breadcrumbs.slice(0, -1);
31
- // Reset if home breadcrumb link has been clicked.
32
- if (currentBreadcrumb === 0) {
33
- this.breadcrumbs = [];
34
- // Notify menu-level-container toggle listener about closing all levels.
35
- let elements = this.el.querySelectorAll('.hy-menu-level-container--mobile');
36
- elements.forEach((element) => {
37
- if (!element.classList.contains('hy-menu-level-container--level-0')) {
38
- this.menuContainerToggled.emit({
39
- triggerItem: element.getAttribute('trigger-item'),
40
- triggerType: 'remove',
41
- });
42
- }
43
- });
44
- }
45
- }, 100);
46
- }
47
- // Listener for adding a breadcrumb to mobile menu breadcrumbs.
48
- addBreadcrumb(event) {
49
- clearTimeout(addbreadTimeout);
50
- addbreadTimeout = setTimeout(() => {
51
- this.breadcrumbs = [
52
- ...this.breadcrumbs,
53
- {
54
- label: event.detail.label,
55
- bid: event.detail.bid,
56
- url: event.detail.url,
57
- },
58
- ];
59
- }, 100);
60
- }
61
- async componentWillLoad() {
62
- this.breadcrumbs = [];
63
- }
64
- disconnectedCallback() {
65
- clearTimeout(breadcrumbTimeout);
66
- clearTimeout(addbreadTimeout);
67
- }
68
- componentWillUpdate() {
69
- // Pass the menu type and menu-button-submenu-expand attributes to
70
- // the child menu-level-container component.
71
- this.el.children[0].setAttribute('menu-type', this.menuType);
72
- this.el.children[0].setAttribute('menu-button-submenu-expand', this.menuButtonSubmenuExpand);
73
- }
74
- componentWillRender() {
75
- // Set the donate link data.
76
- if (this.dataMenuDonate) {
77
- this.donateLink = JSON.parse(this.dataMenuDonate);
78
- }
79
- // Set demo value to all children to provide better UI for DS users.
80
- if (this.isDemo) {
81
- const items = Array.from(this.el.children);
82
- items.forEach((item) => {
83
- item.setAttribute('is-demo', 'true');
84
- });
85
- }
86
- }
87
- render() {
88
- if (this.menuType === null)
89
- return;
90
- switch (this.menuType) {
91
- case MenuType.desktop:
92
- return (h("div", { class: 'hy-wrapper' },
93
- h("nav", { role: 'navigation', class: {
94
- 'hy-menu-wrapper--desktop': true,
95
- 'is-open': this.menuIsOpen,
96
- } },
97
- h("div", { class: 'hy-menu hy-menu--desktop' },
98
- h("slot", null)))));
99
- case MenuType.mobile:
100
- return (h("nav", { "data-is-group": this.isGroup, role: 'navigation', class: "hy-mobile-menu" },
101
- h("section", { class: "hy-mobile-menu__header" },
102
- h("div", { id: 'menu-bc-container', class: {
103
- 'hy-mobile-menu__breadcrumbs': true,
104
- 'is-empty': this.breadcrumbs.length === 0,
105
- } }, this.breadcrumbs.length ? (h("hy-menu-mobile-breadcrumb", { "label-back": this.menuButtonBreadcrumbReturn, "label-front-page": this.labelFrontPage, label: this.breadcrumbs[this.breadcrumbs.length - 1].label, bid: this.breadcrumbs[this.breadcrumbs.length - 1].bid })) : (h("hy-menu-mobile-breadcrumb", { "label-back": this.menuButtonBreadcrumbReturn, "label-front-page": this.menuButtonBreadcrumbHome, label: this.menuButtonBreadcrumbHome, "is-first": true, "logo-url": this.logoUrl }))),
106
- h("button", { class: `hy-mobile-menu__menu-close-button`, "aria-label": "Close menu", disabled: true, "aria-hidden": "true" },
107
- h("span", null, "Close"),
108
- h("hy-icon", { icon: 'hy-icon-remove', size: 16 }))),
109
- h("section", { class: "hy-mobile-menu__menu-container" },
110
- h("div", { "aria-hidden": `${!this.menuIsOpen}`, class: {
111
- 'hy-menu': true,
112
- 'hy-menu--mobile': true,
113
- 'is-open': this.menuIsOpen,
114
- 'is-demo': this.isDemo,
115
- } },
116
- h("slot", null))),
117
- !this.isGroup && (h("div", { class: 'hy-mobile-menu__donate' }, this.donateLink
118
- ? this.donateLink.map((i) => (h("a", { href: i.url },
119
- h("hy-icon", { icon: 'hy-icon-heart-support', fill: 'currentColor', size: 16 }),
120
- i.label)))
121
- : ''))));
122
- }
123
- }
124
- static get is() { return "hy-menu"; }
125
- static get encapsulation() { return "shadow"; }
126
- static get originalStyleUrls() { return {
127
- "$": ["menu.scss"]
128
- }; }
129
- static get styleUrls() { return {
130
- "$": ["menu.css"]
131
- }; }
132
- static get properties() { return {
133
- "dataMenuDonate": {
134
- "type": "string",
135
- "mutable": false,
136
- "complexType": {
137
- "original": "string",
138
- "resolved": "string",
139
- "references": {}
140
- },
141
- "required": false,
142
- "optional": false,
143
- "docs": {
144
- "tags": [],
145
- "text": ""
146
- },
147
- "attribute": "data-menu-donate",
148
- "reflect": false
149
- },
150
- "dataMenuLanguage": {
151
- "type": "string",
152
- "mutable": false,
153
- "complexType": {
154
- "original": "string",
155
- "resolved": "string",
156
- "references": {}
157
- },
158
- "required": false,
159
- "optional": false,
160
- "docs": {
161
- "tags": [],
162
- "text": ""
163
- },
164
- "attribute": "data-menu-language",
165
- "reflect": false
166
- },
167
- "isGroup": {
168
- "type": "boolean",
169
- "mutable": false,
170
- "complexType": {
171
- "original": "boolean",
172
- "resolved": "boolean",
173
- "references": {}
174
- },
175
- "required": false,
176
- "optional": false,
177
- "docs": {
178
- "tags": [],
179
- "text": ""
180
- },
181
- "attribute": "is-group",
182
- "reflect": false,
183
- "defaultValue": "false"
184
- },
185
- "isDemo": {
186
- "type": "boolean",
187
- "mutable": false,
188
- "complexType": {
189
- "original": "boolean",
190
- "resolved": "boolean",
191
- "references": {}
192
- },
193
- "required": false,
194
- "optional": false,
195
- "docs": {
196
- "tags": [],
197
- "text": ""
198
- },
199
- "attribute": "is-demo",
200
- "reflect": false,
201
- "defaultValue": "false"
202
- },
203
- "labelFrontPage": {
204
- "type": "string",
205
- "mutable": false,
206
- "complexType": {
207
- "original": "string",
208
- "resolved": "string",
209
- "references": {}
210
- },
211
- "required": false,
212
- "optional": false,
213
- "docs": {
214
- "tags": [],
215
- "text": ""
216
- },
217
- "attribute": "label-front-page",
218
- "reflect": false
219
- },
220
- "logoUrl": {
221
- "type": "string",
222
- "mutable": false,
223
- "complexType": {
224
- "original": "string",
225
- "resolved": "string",
226
- "references": {}
227
- },
228
- "required": false,
229
- "optional": false,
230
- "docs": {
231
- "tags": [],
232
- "text": ""
233
- },
234
- "attribute": "logo-url",
235
- "reflect": false
236
- },
237
- "logoLabel": {
238
- "type": "string",
239
- "mutable": false,
240
- "complexType": {
241
- "original": "string",
242
- "resolved": "string",
243
- "references": {}
244
- },
245
- "required": false,
246
- "optional": false,
247
- "docs": {
248
- "tags": [],
249
- "text": ""
250
- },
251
- "attribute": "logo-label",
252
- "reflect": false
253
- },
254
- "menuIsOpen": {
255
- "type": "boolean",
256
- "mutable": false,
257
- "complexType": {
258
- "original": "boolean",
259
- "resolved": "boolean",
260
- "references": {}
261
- },
262
- "required": false,
263
- "optional": false,
264
- "docs": {
265
- "tags": [],
266
- "text": ""
267
- },
268
- "attribute": "menu-is-open",
269
- "reflect": false,
270
- "defaultValue": "true"
271
- },
272
- "menuType": {
273
- "type": "string",
274
- "mutable": false,
275
- "complexType": {
276
- "original": "MenuType",
277
- "resolved": "MenuType.desktop | MenuType.mobile | MenuType.tablet",
278
- "references": {
279
- "MenuType": {
280
- "location": "import",
281
- "path": "../../../utils/utils"
282
- }
283
- }
284
- },
285
- "required": false,
286
- "optional": false,
287
- "docs": {
288
- "tags": [],
289
- "text": ""
290
- },
291
- "attribute": "menu-type",
292
- "reflect": false,
293
- "defaultValue": "null"
294
- },
295
- "menuButtonSubmenuExpand": {
296
- "type": "string",
297
- "mutable": false,
298
- "complexType": {
299
- "original": "string",
300
- "resolved": "string",
301
- "references": {}
302
- },
303
- "required": false,
304
- "optional": false,
305
- "docs": {
306
- "tags": [],
307
- "text": ""
308
- },
309
- "attribute": "menu-button-submenu-expand",
310
- "reflect": false
311
- },
312
- "menuButtonBreadcrumbReturn": {
313
- "type": "string",
314
- "mutable": false,
315
- "complexType": {
316
- "original": "string",
317
- "resolved": "string",
318
- "references": {}
319
- },
320
- "required": false,
321
- "optional": false,
322
- "docs": {
323
- "tags": [],
324
- "text": ""
325
- },
326
- "attribute": "menu-button-breadcrumb-return",
327
- "reflect": false
328
- },
329
- "menuButtonBreadcrumbHome": {
330
- "type": "string",
331
- "mutable": false,
332
- "complexType": {
333
- "original": "string",
334
- "resolved": "string",
335
- "references": {}
336
- },
337
- "required": false,
338
- "optional": false,
339
- "docs": {
340
- "tags": [],
341
- "text": ""
342
- },
343
- "attribute": "menu-button-breadcrumb-home",
344
- "reflect": false
345
- },
346
- "menuButtonBreadcrumbMain": {
347
- "type": "string",
348
- "mutable": false,
349
- "complexType": {
350
- "original": "string",
351
- "resolved": "string",
352
- "references": {}
353
- },
354
- "required": false,
355
- "optional": false,
356
- "docs": {
357
- "tags": [],
358
- "text": ""
359
- },
360
- "attribute": "menu-button-breadcrumb-main",
361
- "reflect": false
362
- },
363
- "menuButtonBreadcrumbLogourl": {
364
- "type": "string",
365
- "mutable": false,
366
- "complexType": {
367
- "original": "string",
368
- "resolved": "string",
369
- "references": {}
370
- },
371
- "required": false,
372
- "optional": false,
373
- "docs": {
374
- "tags": [],
375
- "text": ""
376
- },
377
- "attribute": "menu-button-breadcrumb-logourl",
378
- "reflect": false
379
- },
380
- "dataSiteHeaderLabels": {
381
- "type": "string",
382
- "mutable": false,
383
- "complexType": {
384
- "original": "string",
385
- "resolved": "string",
386
- "references": {}
387
- },
388
- "required": false,
389
- "optional": false,
390
- "docs": {
391
- "tags": [],
392
- "text": ""
393
- },
394
- "attribute": "data-site-header-labels",
395
- "reflect": false
396
- }
397
- }; }
398
- static get states() { return {
399
- "breadcrumbs": {}
400
- }; }
401
- static get events() { return [{
402
- "method": "menuContainerToggled",
403
- "name": "menuContainerToggled",
404
- "bubbles": true,
405
- "cancelable": true,
406
- "composed": true,
407
- "docs": {
408
- "tags": [],
409
- "text": ""
410
- },
411
- "complexType": {
412
- "original": "any",
413
- "resolved": "any",
414
- "references": {}
415
- }
416
- }]; }
417
- static get elementRef() { return "el"; }
418
- static get listeners() { return [{
419
- "name": "removeBreadcrumb",
420
- "method": "removeBreadcrumb",
421
- "target": undefined,
422
- "capture": false,
423
- "passive": false
424
- }, {
425
- "name": "addBreadcrumb",
426
- "method": "addBreadcrumb",
427
- "target": undefined,
428
- "capture": false,
429
- "passive": false
430
- }]; }
431
- }