@proximus/lavender-header 2.0.0-alpha.2 → 2.0.0-alpha.200

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/dist/Header.d.ts CHANGED
@@ -3,15 +3,17 @@ import '@proximus/lavender-layout';
3
3
  import '@proximus/lavender-container';
4
4
  import '@proximus/lavender-button';
5
5
  import '@proximus/lavender-section';
6
- import '@proximus/lavender-cell';
6
+ import './HeaderItem';
7
+ import './Link.ts';
7
8
  import type { Dropdown } from '@proximus/lavender-dropdown';
8
9
  import type { Stack } from '@proximus/lavender-layout';
9
10
  import type { ButtonIcon } from '@proximus/lavender-button-icon';
10
- import './HeaderItem';
11
- import './Link.ts';
11
+ import type { HeaderEventMap } from './events.ts';
12
12
  export declare class Header extends WithExtraAttributes {
13
13
  #private;
14
14
  internals: ElementInternals;
15
+ /** Narrows listener types for the Header specific custom events. */
16
+ addEventListener: <K extends keyof HeaderEventMap>(type: K, listener: (ev: HeaderEventMap[K]) => unknown, options?: boolean | AddEventListenerOptions) => void;
15
17
  template: string;
16
18
  constructor();
17
19
  connectedCallback(): void;
@@ -20,16 +22,16 @@ export declare class Header extends WithExtraAttributes {
20
22
  get $backdropFilter(): HTMLDivElement;
21
23
  get $burgerMenu(): ButtonIcon;
22
24
  get $slotMain(): HTMLSlotElement;
23
- get $targetGroupDropdown(): Dropdown;
24
- get $userLanguageDropdown(): Dropdown;
25
+ get $targetGroupDropdown(): Dropdown | null;
26
+ get $userLanguageDropdown(): Dropdown | null;
25
27
  get $dropDownZoneDesktop(): Stack;
26
28
  get $primaryNavigation(): Element;
27
- get closeButtonAriaLabel(): string;
28
- set closeButtonAriaLabel(value: string);
29
- get burgerMenuAriaLabel(): string;
30
- set burgerMenuAriaLabel(value: string);
31
- get backToMenuLabel(): string;
32
- set backToMenuLabel(value: string);
33
- get primaryNavigationAriaLabel(): string;
34
- set primaryNavigationAriaLabel(value: string);
29
+ get closeButtonAriaLabel(): string | null;
30
+ set closeButtonAriaLabel(value: string | null);
31
+ get burgerMenuAriaLabel(): string | null;
32
+ set burgerMenuAriaLabel(value: string | null);
33
+ get backToMenuLabel(): string | null;
34
+ set backToMenuLabel(value: string | null);
35
+ get primaryNavigationAriaLabel(): string | null;
36
+ set primaryNavigationAriaLabel(value: string | null);
35
37
  }
@@ -1,6 +1,6 @@
1
1
  import { WithExtraAttributes } from '@proximus/lavender-common';
2
2
  export declare class HeaderItem extends WithExtraAttributes {
3
- private contentObserver;
3
+ #private;
4
4
  internals: ElementInternals;
5
5
  template: () => string;
6
6
  constructor();
@@ -9,11 +9,12 @@ export declare class HeaderItem extends WithExtraAttributes {
9
9
  disconnectedCallback(): void;
10
10
  attributeChangedCallback(name: string, oldValue: string, newValue: string): void;
11
11
  private setupButtonA11y;
12
- private updateDataLabel;
13
- get for(): string;
14
- set for(value: string);
12
+ get for(): string | null;
13
+ set for(value: string | null);
15
14
  get checked(): boolean;
16
15
  set checked(value: boolean);
17
- get $button(): HTMLButtonElement;
18
- get $a(): HTMLAnchorElement;
16
+ get current(): boolean;
17
+ set current(value: boolean);
18
+ get $button(): HTMLButtonElement | null;
19
+ get $a(): HTMLAnchorElement | null;
19
20
  }
@@ -0,0 +1,473 @@
1
+ {
2
+ "schemaVersion": "1.0.0",
3
+ "readme": "",
4
+ "modules": [
5
+ {
6
+ "kind": "javascript-module",
7
+ "path": "src/Header.ts",
8
+ "declarations": [
9
+ {
10
+ "kind": "class",
11
+ "description": "",
12
+ "name": "Header",
13
+ "members": [
14
+ {
15
+ "kind": "field",
16
+ "name": "internals",
17
+ "type": {
18
+ "text": "ElementInternals"
19
+ }
20
+ },
21
+ {
22
+ "kind": "field",
23
+ "name": "addEventListener",
24
+ "type": {
25
+ "text": "<K extends keyof HeaderEventMap>(\n type: K,\n listener: (ev: HeaderEventMap[K]) => unknown,\n options?: boolean | AddEventListenerOptions\n ) => void"
26
+ },
27
+ "description": "Narrows listener types for the Header specific custom events."
28
+ },
29
+ {
30
+ "kind": "field",
31
+ "name": "template",
32
+ "default": "` <div> <header> <slot name=\"skip\"></slot> <px-section id=\"navigation-container\" padding-bottom=\"none\" padding-bottom--mobile=\"s\" padding-bottom--tablet=\"s\" padding-top=\"s\" background-color=\"none\" > <div id=\"dropdown-zone--desktop\"> <slot name=\"target-group\"></slot> <px-spacer></px-spacer> <slot name=\"user-language\"></slot> </div> <px-hstack gap=\"default\" wrap=\"wrap\" id=\"navigation-wrapper\"> <px-hstack align-items=\"center\"> <slot name=\"header-logo\"></slot> </px-hstack> <slot name=\"header-logo\"></slot> <nav id=\"primary-navigation\" aria-label=\"${this.primaryNavigationAriaLabel}\"> <div role=\"list\"> <px-hstack gap=\"default\" wrap=\"wrap\" align-items=\"center\"> <slot name=\"header-entries\"></slot> </px-hstack> </div> </nav> <px-spacer></px-spacer> <px-hstack align-items=\"center\" gap=\"xs\"> <slot name=\"header-actions\"></slot> <px-button-icon id=\"burger-menu\" variant=\"naked\" aria-label=\"${this.burgerMenuAriaLabel ?? 'Open menu'}\" aria-expanded=\"false\" hidden--laptop hidden--desktop > <px-icon name=\"burger_menu\" from=\"lavender\" size=\"m\"></px-icon> </px-button-icon> </px-hstack> </px-hstack> </px-section> <px-section id=\"panel-container\" background-color=\"surface-default\" padding=\"none\" background-color=\"none\"> <slot name=\"header-panels\"> </px-section> </header> <div id=\"backdrop-filter\"></div> <slot name=\"main\"></slot> </div> `"
33
+ },
34
+ {
35
+ "kind": "field",
36
+ "name": "#onResize",
37
+ "privacy": "private"
38
+ },
39
+ {
40
+ "kind": "method",
41
+ "name": "#setMDDDialogOffset",
42
+ "privacy": "private"
43
+ },
44
+ {
45
+ "kind": "method",
46
+ "name": "#togglePanel",
47
+ "privacy": "private",
48
+ "parameters": [
49
+ {
50
+ "name": "id",
51
+ "type": {
52
+ "text": "string"
53
+ }
54
+ }
55
+ ]
56
+ },
57
+ {
58
+ "kind": "method",
59
+ "name": "#showMobileMenu",
60
+ "privacy": "private"
61
+ },
62
+ {
63
+ "kind": "method",
64
+ "name": "#hideMobileMenu",
65
+ "privacy": "private"
66
+ },
67
+ {
68
+ "kind": "method",
69
+ "name": "#hidePanel",
70
+ "privacy": "private"
71
+ },
72
+ {
73
+ "kind": "field",
74
+ "name": "#$mobileMenu",
75
+ "privacy": "private",
76
+ "readonly": true
77
+ },
78
+ {
79
+ "kind": "field",
80
+ "name": "#$navigationItems",
81
+ "privacy": "private",
82
+ "readonly": true
83
+ },
84
+ {
85
+ "kind": "field",
86
+ "name": "#$headerWrapper",
87
+ "privacy": "private",
88
+ "readonly": true
89
+ },
90
+ {
91
+ "kind": "field",
92
+ "name": "#$megaDropdowns",
93
+ "privacy": "private",
94
+ "readonly": true
95
+ },
96
+ {
97
+ "kind": "field",
98
+ "name": "$backdropFilter",
99
+ "readonly": true
100
+ },
101
+ {
102
+ "kind": "field",
103
+ "name": "$burgerMenu",
104
+ "readonly": true
105
+ },
106
+ {
107
+ "kind": "field",
108
+ "name": "$slotMain",
109
+ "readonly": true
110
+ },
111
+ {
112
+ "kind": "field",
113
+ "name": "$targetGroupDropdown",
114
+ "readonly": true
115
+ },
116
+ {
117
+ "kind": "field",
118
+ "name": "$userLanguageDropdown",
119
+ "readonly": true
120
+ },
121
+ {
122
+ "kind": "field",
123
+ "name": "$dropDownZoneDesktop",
124
+ "readonly": true
125
+ },
126
+ {
127
+ "kind": "field",
128
+ "name": "$primaryNavigation",
129
+ "readonly": true
130
+ },
131
+ {
132
+ "kind": "field",
133
+ "name": "closeButtonAriaLabel"
134
+ },
135
+ {
136
+ "kind": "field",
137
+ "name": "burgerMenuAriaLabel"
138
+ },
139
+ {
140
+ "kind": "field",
141
+ "name": "backToMenuLabel"
142
+ },
143
+ {
144
+ "kind": "field",
145
+ "name": "primaryNavigationAriaLabel"
146
+ },
147
+ {
148
+ "kind": "field",
149
+ "name": "innerHTML"
150
+ }
151
+ ],
152
+ "events": [
153
+ {
154
+ "name": "close-panel",
155
+ "type": {
156
+ "text": "CustomEvent"
157
+ }
158
+ }
159
+ ],
160
+ "attributes": [
161
+ {
162
+ "name": "burger-menu-aria-label"
163
+ },
164
+ {
165
+ "name": "close-button-aria-label"
166
+ },
167
+ {
168
+ "name": "primary-navigation-aria-label"
169
+ },
170
+ {
171
+ "name": "back-to-menu-label"
172
+ }
173
+ ],
174
+ "superclass": {
175
+ "name": "WithExtraAttributes",
176
+ "package": "@proximus/lavender-common"
177
+ },
178
+ "tagName": "px-header",
179
+ "customElement": true
180
+ }
181
+ ],
182
+ "exports": [
183
+ {
184
+ "kind": "js",
185
+ "name": "Header",
186
+ "declaration": {
187
+ "name": "Header",
188
+ "module": "src/Header.ts"
189
+ }
190
+ },
191
+ {
192
+ "kind": "custom-element-definition",
193
+ "name": "px-header",
194
+ "declaration": {
195
+ "name": "Header",
196
+ "module": "src/Header.ts"
197
+ }
198
+ }
199
+ ]
200
+ },
201
+ {
202
+ "kind": "javascript-module",
203
+ "path": "src/HeaderItem.ts",
204
+ "declarations": [
205
+ {
206
+ "kind": "class",
207
+ "description": "",
208
+ "name": "HeaderItem",
209
+ "members": [
210
+ {
211
+ "kind": "field",
212
+ "name": "internals",
213
+ "type": {
214
+ "text": "ElementInternals"
215
+ }
216
+ },
217
+ {
218
+ "kind": "field",
219
+ "name": "template"
220
+ },
221
+ {
222
+ "kind": "method",
223
+ "name": "setupButtonA11y",
224
+ "privacy": "private"
225
+ },
226
+ {
227
+ "kind": "field",
228
+ "name": "#updateDataLabel",
229
+ "privacy": "private"
230
+ },
231
+ {
232
+ "kind": "field",
233
+ "name": "#contentObserver",
234
+ "privacy": "private",
235
+ "default": "new MutationObserver(this.#updateDataLabel)"
236
+ },
237
+ {
238
+ "kind": "field",
239
+ "name": "for"
240
+ },
241
+ {
242
+ "kind": "field",
243
+ "name": "checked"
244
+ },
245
+ {
246
+ "kind": "field",
247
+ "name": "current"
248
+ },
249
+ {
250
+ "kind": "field",
251
+ "name": "$button",
252
+ "readonly": true
253
+ },
254
+ {
255
+ "kind": "field",
256
+ "name": "$a",
257
+ "readonly": true
258
+ },
259
+ {
260
+ "kind": "field",
261
+ "name": "adoptedStyleSheets",
262
+ "type": {
263
+ "text": "array"
264
+ },
265
+ "default": "[stylesheet]"
266
+ }
267
+ ],
268
+ "attributes": [
269
+ {
270
+ "name": "for"
271
+ },
272
+ {
273
+ "name": "href"
274
+ },
275
+ {
276
+ "name": "current"
277
+ }
278
+ ],
279
+ "superclass": {
280
+ "name": "WithExtraAttributes",
281
+ "package": "@proximus/lavender-common"
282
+ },
283
+ "tagName": "px-header-item",
284
+ "customElement": true
285
+ }
286
+ ],
287
+ "exports": [
288
+ {
289
+ "kind": "js",
290
+ "name": "HeaderItem",
291
+ "declaration": {
292
+ "name": "HeaderItem",
293
+ "module": "src/HeaderItem.ts"
294
+ }
295
+ },
296
+ {
297
+ "kind": "custom-element-definition",
298
+ "name": "px-header-item",
299
+ "declaration": {
300
+ "name": "HeaderItem",
301
+ "module": "src/HeaderItem.ts"
302
+ }
303
+ }
304
+ ]
305
+ },
306
+ {
307
+ "kind": "javascript-module",
308
+ "path": "src/Link.ts",
309
+ "declarations": [
310
+ {
311
+ "kind": "class",
312
+ "description": "",
313
+ "name": "MDDLink",
314
+ "members": [
315
+ {
316
+ "kind": "field",
317
+ "name": "template",
318
+ "default": "`<px-a font-weight=\"title\" font-size=\"body-m\" color=\"brand\" variant=\"no-style\"> <slot></slot> </px-a>`"
319
+ },
320
+ {
321
+ "kind": "field",
322
+ "name": "innerHTML"
323
+ }
324
+ ],
325
+ "superclass": {
326
+ "name": "HTMLElement"
327
+ },
328
+ "tagName": "px-mdd-a",
329
+ "customElement": true
330
+ }
331
+ ],
332
+ "exports": [
333
+ {
334
+ "kind": "js",
335
+ "name": "MDDLink",
336
+ "declaration": {
337
+ "name": "MDDLink",
338
+ "module": "src/Link.ts"
339
+ }
340
+ },
341
+ {
342
+ "kind": "custom-element-definition",
343
+ "name": "px-mdd-a",
344
+ "declaration": {
345
+ "name": "MDDLink",
346
+ "module": "src/Link.ts"
347
+ }
348
+ }
349
+ ]
350
+ },
351
+ {
352
+ "kind": "javascript-module",
353
+ "path": "src/MobileMenu.ts",
354
+ "declarations": [
355
+ {
356
+ "kind": "class",
357
+ "description": "",
358
+ "name": "HeaderMobileMenu",
359
+ "members": [
360
+ {
361
+ "kind": "field",
362
+ "name": "#template",
363
+ "privacy": "private",
364
+ "default": "`<px-mdd name=\"__lavender_mobile_menu\" hidden--laptop hidden--desktop > <span slot=\"title\"><slot name=\"title\"></slot></span> <px-mdd-section title-hidden></px-mdd-section> </px-mdd>`"
365
+ },
366
+ {
367
+ "kind": "method",
368
+ "name": "#createMobileMenuPanelDropDowns",
369
+ "privacy": "private"
370
+ },
371
+ {
372
+ "kind": "field",
373
+ "name": "$megaDropDown",
374
+ "readonly": true
375
+ },
376
+ {
377
+ "kind": "field",
378
+ "name": "innerHTML"
379
+ },
380
+ {
381
+ "kind": "field",
382
+ "name": "adoptedStyleSheets",
383
+ "type": {
384
+ "text": "array"
385
+ },
386
+ "default": "[stylesheet]"
387
+ }
388
+ ],
389
+ "superclass": {
390
+ "name": "HTMLElement"
391
+ },
392
+ "tagName": "px-header-mobile-menu",
393
+ "customElement": true
394
+ }
395
+ ],
396
+ "exports": [
397
+ {
398
+ "kind": "js",
399
+ "name": "HeaderMobileMenu",
400
+ "declaration": {
401
+ "name": "HeaderMobileMenu",
402
+ "module": "src/MobileMenu.ts"
403
+ }
404
+ },
405
+ {
406
+ "kind": "custom-element-definition",
407
+ "name": "px-header-mobile-menu",
408
+ "declaration": {
409
+ "name": "HeaderMobileMenu",
410
+ "module": "src/MobileMenu.ts"
411
+ }
412
+ }
413
+ ]
414
+ },
415
+ {
416
+ "kind": "javascript-module",
417
+ "path": "src/events.ts",
418
+ "declarations": [],
419
+ "exports": []
420
+ },
421
+ {
422
+ "kind": "javascript-module",
423
+ "path": "src/header-item.css",
424
+ "declarations": [],
425
+ "exports": []
426
+ },
427
+ {
428
+ "kind": "javascript-module",
429
+ "path": "src/header.css",
430
+ "declarations": [],
431
+ "exports": []
432
+ },
433
+ {
434
+ "kind": "javascript-module",
435
+ "path": "src/index.ts",
436
+ "declarations": [],
437
+ "exports": [
438
+ {
439
+ "kind": "js",
440
+ "name": "*",
441
+ "declaration": {
442
+ "name": "*",
443
+ "module": "src/Header"
444
+ }
445
+ },
446
+ {
447
+ "kind": "js",
448
+ "name": "*",
449
+ "declaration": {
450
+ "name": "*",
451
+ "module": "src/MobileMenu"
452
+ }
453
+ },
454
+ {
455
+ "kind": "js",
456
+ "name": "*",
457
+ "declaration": {
458
+ "name": "*",
459
+ "module": "src/HeaderItem"
460
+ }
461
+ },
462
+ {
463
+ "kind": "js",
464
+ "name": "*",
465
+ "declaration": {
466
+ "name": "*",
467
+ "module": "src/events"
468
+ }
469
+ }
470
+ ]
471
+ }
472
+ ]
473
+ }
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Custom events handled by the Header, on top of the standard DOM events.
3
+ * Declared locally (instead of augmenting the global `HTMLElementEventMap`)
4
+ * so these event names are only typed on the elements that actually use them.
5
+ */
6
+ export interface HeaderEventMap extends HTMLElementEventMap {
7
+ 'close-panel-from-dialog': CustomEvent<{
8
+ clientX: number;
9
+ clientY: number;
10
+ }>;
11
+ 'section-item-click': CustomEvent<{
12
+ for: string;
13
+ }>;
14
+ 'back-to-mobile-menu': CustomEvent;
15
+ 'close-panel': CustomEvent;
16
+ }
package/dist/index.d.ts CHANGED
@@ -1,3 +1,6 @@
1
+ import '@proximus/lavender-button-icon';
2
+ import '@proximus/lavender-cell';
1
3
  export * from './Header';
2
4
  export * from './MobileMenu';
3
5
  export * from './HeaderItem';
6
+ export type * from './events';