@nationalarchives/frontend 0.1.9-prerelease → 0.1.11-prerelease

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 (130) hide show
  1. package/README.md +3 -3
  2. package/govuk-prototype-kit.config.json +0 -3
  3. package/nationalarchives/_features.scss +4 -0
  4. package/nationalarchives/all.css +1 -1
  5. package/nationalarchives/all.css.map +1 -1
  6. package/nationalarchives/all.js +1 -1
  7. package/nationalarchives/all.js.map +1 -1
  8. package/nationalarchives/all.mjs +54 -3
  9. package/nationalarchives/all.scss +8 -4
  10. package/nationalarchives/assets/images/footer/facebook.svg +11 -0
  11. package/nationalarchives/assets/images/footer/flickr.svg +11 -0
  12. package/nationalarchives/assets/images/footer/instagram.svg +17 -0
  13. package/nationalarchives/assets/images/footer/rss.svg +13 -0
  14. package/nationalarchives/assets/images/footer/twitter.svg +14 -0
  15. package/nationalarchives/assets/images/footer/youtube.svg +12 -0
  16. package/nationalarchives/assets/images/tna-square-logo.svg +5 -24
  17. package/nationalarchives/components/_index.scss +13 -0
  18. package/nationalarchives/components/breadcrumbs/_index.scss +28 -6
  19. package/nationalarchives/components/breadcrumbs/breadcrumbs.stories.js +1 -2
  20. package/nationalarchives/components/breadcrumbs/fixtures.json +1 -1
  21. package/nationalarchives/components/breadcrumbs/macro.njk +1 -1
  22. package/nationalarchives/components/breadcrumbs/template.njk +14 -13
  23. package/nationalarchives/components/button/_index.scss +23 -11
  24. package/nationalarchives/components/button/button.stories.js +1 -2
  25. package/nationalarchives/components/button/fixtures.json +5 -5
  26. package/nationalarchives/components/button/macro.njk +1 -1
  27. package/nationalarchives/components/card/_index.scss +51 -7
  28. package/nationalarchives/components/card/card.js +2 -0
  29. package/nationalarchives/components/card/card.js.map +1 -0
  30. package/nationalarchives/components/card/card.mjs +45 -0
  31. package/nationalarchives/components/card/card.stories.js +18 -15
  32. package/nationalarchives/components/card/fixtures.json +14 -12
  33. package/nationalarchives/components/card/macro-options.json +18 -0
  34. package/nationalarchives/components/card/macro.njk +1 -1
  35. package/nationalarchives/components/card/template.njk +9 -4
  36. package/nationalarchives/components/filters/filters.stories.js +1 -2
  37. package/nationalarchives/components/filters/macro.njk +1 -1
  38. package/nationalarchives/components/filters/template.njk +2 -2
  39. package/nationalarchives/components/footer/_index.scss +68 -13
  40. package/nationalarchives/components/footer/fixtures.json +1 -1
  41. package/nationalarchives/components/footer/footer.stories.js +20 -23
  42. package/nationalarchives/components/footer/macro-options.json +12 -6
  43. package/nationalarchives/components/footer/macro.njk +1 -1
  44. package/nationalarchives/components/footer/template.njk +26 -16
  45. package/nationalarchives/components/grid/_index.scss +10 -12
  46. package/nationalarchives/components/grid/fixtures.json +12 -12
  47. package/nationalarchives/components/grid/grid.stories.js +56 -3
  48. package/nationalarchives/components/grid/macro-options.json +30 -0
  49. package/nationalarchives/components/grid/macro.njk +1 -1
  50. package/nationalarchives/components/grid/template.njk +17 -1
  51. package/nationalarchives/components/header/_index.scss +269 -60
  52. package/nationalarchives/components/header/header.js +1 -1
  53. package/nationalarchives/components/header/header.js.map +1 -1
  54. package/nationalarchives/components/header/header.mjs +7 -12
  55. package/nationalarchives/components/header/header.stories.js +156 -6
  56. package/nationalarchives/components/header/macro-options.json +83 -5
  57. package/nationalarchives/components/header/macro.njk +1 -1
  58. package/nationalarchives/components/header/template.njk +45 -36
  59. package/nationalarchives/components/hero/_index.scss +36 -6
  60. package/nationalarchives/components/hero/fixtures.json +16 -1
  61. package/nationalarchives/components/hero/hero.stories.js +32 -16
  62. package/nationalarchives/components/hero/macro-options.json +14 -2
  63. package/nationalarchives/components/hero/macro.njk +1 -1
  64. package/nationalarchives/components/hero/template.njk +7 -5
  65. package/nationalarchives/components/phase-banner/_index.scss +60 -0
  66. package/nationalarchives/components/phase-banner/fixtures.json +81 -0
  67. package/nationalarchives/components/phase-banner/macro-options.json +26 -0
  68. package/nationalarchives/components/phase-banner/macro.njk +3 -0
  69. package/nationalarchives/components/phase-banner/phase-banner.stories.js +64 -0
  70. package/nationalarchives/components/phase-banner/template.njk +16 -0
  71. package/nationalarchives/components/picture/_index.scss +77 -0
  72. package/nationalarchives/components/picture/fixtures.json +4 -0
  73. package/nationalarchives/components/picture/macro-options.json +88 -0
  74. package/nationalarchives/components/picture/macro.njk +3 -0
  75. package/nationalarchives/components/picture/picture.js +2 -0
  76. package/nationalarchives/components/picture/picture.js.map +1 -0
  77. package/nationalarchives/components/picture/picture.mjs +57 -0
  78. package/nationalarchives/components/picture/picture.stories.js +63 -0
  79. package/nationalarchives/components/picture/template.njk +42 -0
  80. package/nationalarchives/components/profile/_index.scss +2 -0
  81. package/nationalarchives/components/profile/fixtures.json +4 -0
  82. package/nationalarchives/components/profile/macro-options.json +14 -0
  83. package/nationalarchives/components/profile/macro.njk +3 -0
  84. package/nationalarchives/components/profile/profile.stories.js +32 -0
  85. package/nationalarchives/components/profile/template.njk +15 -0
  86. package/nationalarchives/components/sensitive-image/fixtures.json +3 -3
  87. package/nationalarchives/components/sensitive-image/macro.njk +1 -1
  88. package/nationalarchives/components/sensitive-image/sensitive-image.stories.js +1 -2
  89. package/nationalarchives/components/tabs/_index.scss +148 -0
  90. package/nationalarchives/components/tabs/fixtures.json +4 -0
  91. package/nationalarchives/components/tabs/macro-options.json +52 -0
  92. package/nationalarchives/components/tabs/macro.njk +3 -0
  93. package/nationalarchives/components/tabs/tabs.js +2 -0
  94. package/nationalarchives/components/tabs/tabs.js.map +1 -0
  95. package/nationalarchives/components/tabs/tabs.mjs +214 -0
  96. package/nationalarchives/components/tabs/tabs.stories.js +302 -0
  97. package/nationalarchives/components/tabs/template.njk +20 -0
  98. package/nationalarchives/patterns/_index.scss +1 -0
  99. package/nationalarchives/patterns/featured-collection/_index.scss +13 -0
  100. package/nationalarchives/patterns/featured-collection/featured-collection.stories.js +35 -0
  101. package/nationalarchives/patterns/featured-collection/macro-options.json +20 -0
  102. package/nationalarchives/patterns/featured-collection/macro.njk +3 -0
  103. package/nationalarchives/patterns/featured-collection/template.njk +96 -0
  104. package/nationalarchives/stories/development/contributing.mdx +39 -0
  105. package/nationalarchives/stories/development/dependencies.mdx +2 -0
  106. package/nationalarchives/stories/development/technologies.mdx +65 -0
  107. package/nationalarchives/stories/utilities/colour.stories.js +189 -0
  108. package/nationalarchives/stories/utilities/typography.mdx +1 -0
  109. package/nationalarchives/stories/utilities/typography.stories.js +15 -0
  110. package/nationalarchives/templates/layouts/_generic.njk +1 -1
  111. package/nationalarchives/tools/_assets.scss +5 -0
  112. package/nationalarchives/tools/_colour.scss +129 -0
  113. package/nationalarchives/tools/_grid.scss +2 -2
  114. package/nationalarchives/tools/_index.scss +5 -0
  115. package/nationalarchives/tools/_media.scss +12 -11
  116. package/nationalarchives/tools/_typography.scss +15 -0
  117. package/nationalarchives/utilities/_debug.scss +11 -0
  118. package/nationalarchives/utilities/_global.scss +120 -3
  119. package/nationalarchives/utilities/_index.scss +3 -0
  120. package/nationalarchives/utilities/_typography.scss +155 -111
  121. package/nationalarchives/variables/_assets.scss +1 -0
  122. package/nationalarchives/variables/_colour.scss +120 -11
  123. package/nationalarchives/variables/{_all.scss → _index.scss} +1 -0
  124. package/nationalarchives/variables/_media.scss +39 -11
  125. package/nationalarchives/variables/_typography.scss +1 -1
  126. package/package.json +18 -15
  127. package/nationalarchives/components/_all.scss +0 -7
  128. package/nationalarchives/stories/development/structure.mdx +0 -7
  129. package/nationalarchives/tools/_all.scss +0 -3
  130. package/nationalarchives/utilities/_all.scss +0 -2
@@ -1,13 +1,95 @@
1
1
  @use "sass:math";
2
- @use "../../variables/colour";
2
+ @use "../../utilities/global"; // To get %tna-invert
3
+ @use "../../tools/colour";
4
+ @use "../../variables/colour" as colourVars; // TODO
3
5
  @use "../../variables/grid";
4
- @use "../../variables/typography";
6
+ @use "../../tools/typography";
5
7
  @use "../../tools/media";
6
8
 
7
9
  .tna-header {
8
10
  color: #fff;
9
11
 
10
- background-color: colour.$tna-black;
12
+ background-color: colourVars.$tna-black;
13
+
14
+ // @include colour.invert;
15
+
16
+ &__exit {
17
+ padding-top: 0.5rem;
18
+ padding-bottom: 0.5rem;
19
+
20
+ text-align: right;
21
+
22
+ background-color: colourVars.$dark-grey;
23
+ }
24
+
25
+ &__exit-link {
26
+ color: #fff;
27
+ text-decoration: none;
28
+
29
+ &:hover {
30
+ text-decoration: underline;
31
+
32
+ // .tna-header__exit-link-icon {
33
+ // border-color: colour.$tna-yellow;
34
+
35
+ // &::before {
36
+ // border-top-color: colour.$tna-yellow;
37
+ // border-right-color: colour.$tna-yellow;
38
+ // }
39
+
40
+ // &::after {
41
+ // background-color: colour.$tna-yellow;
42
+ // }
43
+ // }
44
+ }
45
+ }
46
+
47
+ &__exit-link-icon {
48
+ width: 0.825rem;
49
+ height: 0.825rem;
50
+ margin-right: 0.125rem;
51
+ margin-left: 0.5rem;
52
+
53
+ display: inline-block;
54
+
55
+ position: relative;
56
+
57
+ vertical-align: middle;
58
+
59
+ border: 0.125rem #fff solid;
60
+
61
+ &::before {
62
+ position: absolute;
63
+ top: -0.25rem;
64
+ right: -0.25rem;
65
+ z-index: 2;
66
+
67
+ border: 0.25rem transparent solid;
68
+ border-top-color: #fff;
69
+ border-right-color: #fff;
70
+
71
+ content: "";
72
+ }
73
+
74
+ &::after {
75
+ width: 0.25rem;
76
+ height: 0.825rem;
77
+
78
+ position: absolute;
79
+ top: -0.125rem;
80
+ right: -0.125rem;
81
+ z-index: 1;
82
+
83
+ background-color: #fff;
84
+
85
+ outline: 0.2rem colourVars.$dark-grey solid;
86
+
87
+ transform: rotate(45deg) translateX(50%);
88
+ transform-origin: 100% 0;
89
+
90
+ content: "";
91
+ }
92
+ }
11
93
 
12
94
  &__contents {
13
95
  &.tna-container {
@@ -16,26 +98,27 @@
16
98
  }
17
99
 
18
100
  &__logo {
19
- padding-top: 1.5rem;
20
- padding-bottom: 1.5rem;
101
+ padding-top: 1.25rem;
102
+ padding-bottom: 1.25rem;
21
103
  }
22
104
 
23
105
  &__logo-link {
24
- display: -ms-flexbox;
25
106
  display: flex;
26
107
  align-items: flex-end;
27
108
 
28
109
  color: inherit;
29
110
  text-decoration: none;
30
111
 
31
- &:hover {
32
- outline: 0.375rem #fff solid;
112
+ &--href {
113
+ &:hover {
114
+ outline: 0.375rem #fff solid;
115
+ }
33
116
  }
34
117
  }
35
118
 
36
119
  .tna-logo {
37
- width: 100px;
38
- height: 100px;
120
+ width: 6.25rem;
121
+ height: 6.25rem;
39
122
 
40
123
  display: inline-block;
41
124
  }
@@ -45,6 +128,7 @@
45
128
  }
46
129
 
47
130
  .tna-logo__background {
131
+ fill: none;
48
132
  }
49
133
 
50
134
  &__logo-strapline {
@@ -52,31 +136,12 @@
52
136
 
53
137
  display: inline-block;
54
138
 
55
- line-height: 2.125rem;
139
+ line-height: 2.125;
56
140
  text-transform: uppercase;
57
141
  }
58
142
 
59
143
  &__navigation-toggle {
60
- }
61
-
62
- &__navigation-toggle-button {
63
- height: 2rem;
64
- padding: 0;
65
-
66
- display: block;
67
-
68
- position: relative;
69
-
70
- appearance: none;
71
-
72
- font-size: 0;
73
-
74
- background: none;
75
-
76
- border: 0 transparent solid;
77
- border-width: 0.25rem 0;
78
-
79
- cursor: pointer;
144
+ align-self: center;
80
145
  }
81
146
 
82
147
  &__hamburger {
@@ -87,6 +152,8 @@
87
152
 
88
153
  background-color: #fff;
89
154
 
155
+ transition: height 1ms 200ms;
156
+
90
157
  &::before,
91
158
  &::after {
92
159
  height: 0.25rem;
@@ -99,6 +166,11 @@
99
166
 
100
167
  background-color: inherit;
101
168
 
169
+ transition:
170
+ top 200ms 200ms,
171
+ bottom 200ms 200ms,
172
+ transform 200ms;
173
+
102
174
  content: "";
103
175
  }
104
176
 
@@ -111,12 +183,58 @@
111
183
  }
112
184
  }
113
185
 
186
+ &__navigation-toggle-button {
187
+ height: 2rem;
188
+ padding: 0;
189
+
190
+ display: block;
191
+
192
+ position: relative;
193
+
194
+ appearance: none;
195
+
196
+ font-size: 0;
197
+
198
+ background: none;
199
+
200
+ border: 0 transparent solid;
201
+ border-width: 0.25rem 0;
202
+
203
+ cursor: pointer;
204
+
205
+ &--opened {
206
+ .tna-header__hamburger {
207
+ height: 0;
208
+
209
+ &::before,
210
+ &::after {
211
+ transition:
212
+ top 200ms,
213
+ bottom 200ms,
214
+ transform 200ms 200ms;
215
+ }
216
+
217
+ &::before {
218
+ top: 0.625rem;
219
+
220
+ transform: rotate(-135deg);
221
+ }
222
+
223
+ &::after {
224
+ bottom: 0.625rem;
225
+
226
+ transform: rotate(135deg);
227
+ }
228
+ }
229
+ }
230
+ }
231
+
114
232
  &--yellow,
115
233
  &--pink,
116
234
  &--orange,
117
235
  &--green,
118
236
  &--blue {
119
- color: colour.$tna-black;
237
+ color: colourVars.$tna-black;
120
238
 
121
239
  .tna-header__logo-link {
122
240
  &:hover {
@@ -129,41 +247,82 @@
129
247
  }
130
248
 
131
249
  .tna-header__hamburger {
132
- background-color: colour.$tna-black;
250
+ background-color: colourVars.$tna-black;
133
251
  }
134
252
  }
135
253
 
136
254
  &--yellow {
137
- background-color: colour.$tna-yellow;
255
+ background-color: colourVars.$tna-yellow;
138
256
  }
139
257
 
140
258
  &--pink {
141
- background-color: colour.$tna-pink;
259
+ background-color: colourVars.$tna-pink;
142
260
  }
143
261
 
144
262
  &--orange {
145
- background-color: colour.$tna-orange;
263
+ background-color: colourVars.$tna-orange;
146
264
  }
147
265
 
148
266
  &--green {
149
- background-color: colour.$tna-green;
267
+ background-color: colourVars.$tna-green;
150
268
  }
151
269
 
152
270
  &--blue {
153
- background-color: colour.$tna-blue;
271
+ background-color: colourVars.$tna-blue;
154
272
  }
155
273
 
156
274
  &__navigation {
157
- display: -ms-flexbox;
158
275
  display: flex;
159
- justify-content: flex-end;
276
+ flex-direction: column-reverse;
277
+ justify-content: space-between;
160
278
  align-items: flex-end;
161
279
  }
162
280
 
281
+ &__top-navigation-items {
282
+ margin: 0;
283
+ padding: 1.25rem 0;
284
+
285
+ // order: 1;
286
+
287
+ list-style: none;
288
+
289
+ line-height: 1;
290
+ }
291
+
292
+ &__top-navigation-item {
293
+ margin-left: 0.75rem;
294
+
295
+ display: inline-block;
296
+ }
297
+
298
+ &__top-navigation-item-link {
299
+ display: inline-block;
300
+
301
+ text-decoration: none;
302
+
303
+ &,
304
+ &:link,
305
+ &:visited {
306
+ color: inherit;
307
+ }
308
+
309
+ &:hover,
310
+ &--selected {
311
+ &,
312
+ &:link,
313
+ &:visited {
314
+ text-decoration: underline;
315
+ text-decoration-thickness: 3px;
316
+ }
317
+ }
318
+ }
319
+
163
320
  &__navigation-items {
164
321
  margin: 0;
165
322
  padding: 0;
166
323
 
324
+ // order: 2;
325
+
167
326
  list-style: none;
168
327
 
169
328
  white-space: nowrap;
@@ -180,24 +339,32 @@
180
339
 
181
340
  display: inline-block;
182
341
 
183
- color: inherit;
184
- font-family: typography.$font-family-heading;
185
- font-weight: typography.$font-weight-heading;
342
+ @include typography.heading-font;
186
343
  text-decoration: none;
344
+ line-height: 2;
345
+
346
+ // transition:
347
+ // color 200ms,
348
+ // background-color 200ms;
187
349
 
188
- transition:
189
- color 200ms,
190
- background-color 200ms;
350
+ &,
351
+ &:link,
352
+ &:visited {
353
+ color: inherit;
354
+ }
191
355
 
192
356
  &:hover,
193
357
  &--selected {
194
- color: colour.$tna-black;
195
-
196
- background-color: #fff;
358
+ &,
359
+ &:link,
360
+ &:visited {
361
+ @include colour.colour-font("font-dark");
197
362
 
198
- transition:
199
- color 50ms,
200
- background-color 50ms;
363
+ @include colour.colour-background("page-background");
364
+ }
365
+ // transition:
366
+ // color 50ms,
367
+ // background-color 50ms;
201
368
  }
202
369
  }
203
370
 
@@ -227,23 +394,32 @@
227
394
  }
228
395
  }
229
396
 
397
+ .tna-logo {
398
+ width: 4.5rem;
399
+ height: 4.5rem;
400
+ }
401
+
402
+ &__logo-strapline {
403
+ line-height: 1.55;
404
+ }
405
+
230
406
  &__navigation-toggle {
231
407
  &.tna-column {
232
- padding-top: 1rem;
233
408
  padding-right: $compensated-container-padding;
234
409
  padding-left: 0;
235
410
  }
236
411
  }
237
412
 
238
413
  &__navigation {
239
- color: colour.$base-font-colour;
414
+ @include colour.colour-font("font-base");
415
+ @include typography.relative-font-size(20);
240
416
 
241
417
  &.tna-column {
242
418
  padding-right: 0;
243
419
  padding-left: 0;
244
420
  }
245
421
 
246
- .js-enabled & {
422
+ .tna-template--js-enabled & {
247
423
  display: none;
248
424
 
249
425
  &--open {
@@ -252,10 +428,29 @@
252
428
  }
253
429
  }
254
430
 
431
+ &__top-navigation-items {
432
+ padding: 0.5rem 1rem;
433
+
434
+ // text-align: center;
435
+
436
+ @include colour.colour-background("page-background");
437
+
438
+ border-bottom: 1px solid;
439
+ @include colour.colour-border("keyline");
440
+ }
441
+
442
+ &__top-navigation-item {
443
+ margin: 0;
444
+ padding: 0.5rem;
445
+ }
446
+
447
+ &__top-navigation-item-link {
448
+ }
449
+
255
450
  &__navigation-items {
256
451
  width: 100%;
257
452
 
258
- background-color: #fff;
453
+ @include colour.colour-background("page-background");
259
454
  }
260
455
 
261
456
  &__navigation-item {
@@ -263,7 +458,8 @@
263
458
 
264
459
  display: block;
265
460
 
266
- border-bottom: 1px colour.$keyline-colour solid;
461
+ border-bottom: 1px solid;
462
+ @include colour.colour-border("keyline");
267
463
  }
268
464
 
269
465
  &__navigation-item-link {
@@ -274,6 +470,8 @@
274
470
 
275
471
  position: relative;
276
472
 
473
+ line-height: 1.6;
474
+
277
475
  &::after {
278
476
  width: 0;
279
477
 
@@ -282,9 +480,9 @@
282
480
  bottom: 0;
283
481
  left: 0;
284
482
 
285
- background-color: colour.$tna-black;
483
+ @include colour.colour-background("font-dark");
286
484
 
287
- transition: width 200ms;
485
+ // transition: width 200ms;
288
486
 
289
487
  content: "";
290
488
  }
@@ -293,7 +491,7 @@
293
491
  &::after {
294
492
  width: 0.25rem;
295
493
 
296
- transition: width 50ms;
494
+ // transition: width 50ms;
297
495
  }
298
496
  }
299
497
 
@@ -305,4 +503,15 @@
305
503
  }
306
504
  }
307
505
  }
506
+
507
+ @include media.on-tiny {
508
+ .tna-logo {
509
+ width: 3.5rem;
510
+ height: 3.5rem;
511
+ }
512
+
513
+ &__logo-strapline {
514
+ line-height: 1.25;
515
+ }
516
+ }
308
517
  }
@@ -1,2 +1,2 @@
1
- !function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define("TNAFrontend",[],e):"object"==typeof exports?exports.TNAFrontend=e():(t.TNAFrontend=t.TNAFrontend||{},t.TNAFrontend["components/header/header"]=e())}(self,(()=>(()=>{"use strict";var t={d:(e,n)=>{for(var i in n)t.o(n,i)&&!t.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:n[i]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},e={};t.r(e),t.d(e,{Header:()=>o});function n(t){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},n(t)}function i(t,e){for(var i=0;i<e.length;i++){var o=e[i];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,(void 0,a=function(t,e){if("object"!==n(t)||null===t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var o=i.call(t,"string");if("object"!==n(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(o.key),"symbol"===n(a)?a:String(a)),o)}var a}var o=function(){function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.$module=e,this.$toggleButtonWrapper=e&&e.querySelector(".tna-header__navigation-toggle"),this.$navigation=e&&e.querySelector(".tna-header__navigation"),this.$links=e&&this.$navigation&&this.$navigation.querySelectorAll("[tabindex='0']"),this.menuOpened=!1,this.mql=window.matchMedia("(max-width: 768px)")}var e,n;return e=t,(n=[{key:"init",value:function(){var t=this;if(this.$module&&this.$toggleButtonWrapper&&this.$navigation){var e="menu-content-".concat(([1e7]+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g,(function(t){return(t^crypto.getRandomValues(new Uint8Array(1))[0]&15>>t/4).toString(16)})));this.$navigation.setAttribute("id",e),this.$toggleButton=document.createElement("button"),this.$toggleButton.innerText="Menu",this.$toggleButton.setAttribute("aria-controls",e),this.$toggleButton.setAttribute("aria-haspopup","true"),this.$toggleButton.classList.add("tna-header__navigation-toggle-button"),this.$hamburger=document.createElement("div"),this.$hamburger.classList.add("tna-header__hamburger"),this.$toggleButton.appendChild(this.$hamburger),this.$toggleButtonWrapper.appendChild(this.$toggleButton),this.syncState(),this.$toggleButton.addEventListener("click",(function(){return t.handleToggleNavigation()})),"addEventListener"in this.mql?this.mql.addEventListener("change",(function(){return t.syncState()})):this.mql.addListener((function(){return t.syncState()}))}}},{key:"handleToggleNavigation",value:function(){this.menuOpened=!this.menuOpened,this.syncState()}},{key:"syncState",value:function(){if(this.mql.matches)if(this.menuOpened){this.$navigation.classList.add("tna-header__navigation--open"),this.$navigation.hidden=!1,this.$navigation.setAttribute("aria-hidden","false"),this.$toggleButton.setAttribute("aria-expanded","true"),this.$toggleButton.setAttribute("title","Close menu");for(var t=0;t<this.$links.length;t++)this.$links[t].setAttribute("tabindex","0")}else{this.$navigation.classList.remove("tna-header__navigation--open"),this.$navigation.hidden=!0,this.$navigation.setAttribute("aria-hidden","true"),this.$toggleButton.setAttribute("aria-expanded","false"),this.$toggleButton.setAttribute("title","Open menu");for(var e=0;e<this.$links.length;e++)this.$links[e].setAttribute("tabindex","-1")}else{this.$navigation.classList.add("tna-header__navigation--open"),this.$navigation.hidden=!1,this.$navigation.setAttribute("aria-hidden","false"),this.$toggleButton.setAttribute("aria-expanded","true"),this.$toggleButton.setAttribute("title","Close menu");for(var n=0;n<this.$links.length;n++)this.$links[n].setAttribute("tabindex","0")}}}])&&i(e.prototype,n),Object.defineProperty(e,"prototype",{writable:!1}),t}();return e})()));
1
+ !function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define("TNAFrontend",[],e):"object"==typeof exports?exports.TNAFrontend=e():(t.TNAFrontend=t.TNAFrontend||{},t.TNAFrontend["components/header/header"]=e())}(self,(()=>(()=>{"use strict";var t={948:(t,e,n)=>{n.d(e,{Z:()=>i});const i=function(){return([1e7]+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g,(function(t){return(t^crypto.getRandomValues(new Uint8Array(1))[0]&15>>t/4).toString(16)}))}}},e={};function n(i){var o=e[i];if(void 0!==o)return o.exports;var a=e[i]={exports:{}};return t[i](a,a.exports,n),a.exports}n.d=(t,e)=>{for(var i in e)n.o(e,i)&&!n.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:e[i]})},n.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),n.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var i={};return(()=>{n.r(i),n.d(i,{Header:()=>a});var t=n(948);function e(t){return e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},e(t)}function o(t,n){for(var i=0;i<n.length;i++){var o=n[i];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,(void 0,a=function(t,n){if("object"!==e(t)||null===t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var o=i.call(t,"string");if("object"!==e(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(o.key),"symbol"===e(a)?a:String(a)),o)}var a}var a=function(){function e(t){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),this.$module=t,this.$toggleButtonWrapper=t&&t.querySelector(".tna-header__navigation-toggle"),this.$navigation=t&&t.querySelector(".tna-header__navigation"),this.$links=t&&this.$navigation&&this.$navigation.querySelectorAll("[tabindex='0']"),this.menuOpened=!1,this.mql=window.matchMedia("(max-width: 768px)")}var n,i;return n=e,(i=[{key:"init",value:function(){var e=this;if(this.$module&&this.$toggleButtonWrapper&&this.$navigation){var n="tna-menu-content-".concat((0,t.Z)());this.$navigation.setAttribute("id",n),this.$toggleButton=document.createElement("button"),this.$toggleButton.innerText="Menu",this.$toggleButton.setAttribute("aria-controls",n),this.$toggleButton.setAttribute("aria-haspopup","true"),this.$toggleButton.classList.add("tna-header__navigation-toggle-button"),this.$hamburger=document.createElement("div"),this.$hamburger.classList.add("tna-header__hamburger"),this.$toggleButton.appendChild(this.$hamburger),this.$toggleButtonWrapper.appendChild(this.$toggleButton),this.syncState(),this.$toggleButton.addEventListener("click",(function(){return e.handleToggleNavigation()})),"addEventListener"in this.mql?this.mql.addEventListener("change",(function(){return e.syncState()})):this.mql.addListener((function(){return e.syncState()}))}}},{key:"handleToggleNavigation",value:function(){this.menuOpened=!this.menuOpened,this.syncState()}},{key:"syncState",value:function(){if(this.mql.matches)if(this.menuOpened){this.$navigation.classList.add("tna-header__navigation--open"),this.$navigation.hidden=!1,this.$navigation.setAttribute("aria-hidden","false"),this.$toggleButton.setAttribute("aria-expanded","true"),this.$toggleButton.setAttribute("title","Close menu"),this.$toggleButton.classList.add("tna-header__navigation-toggle-button--opened");for(var t=0;t<this.$links.length;t++)this.$links[t].setAttribute("tabindex","0")}else{this.$navigation.classList.remove("tna-header__navigation--open"),this.$navigation.hidden=!0,this.$navigation.setAttribute("aria-hidden","true"),this.$toggleButton.setAttribute("aria-expanded","false"),this.$toggleButton.setAttribute("title","Open menu"),this.$toggleButton.classList.remove("tna-header__navigation-toggle-button--opened");for(var e=0;e<this.$links.length;e++)this.$links[e].setAttribute("tabindex","-1")}else{this.$navigation.classList.add("tna-header__navigation--open"),this.$navigation.hidden=!1,this.$navigation.setAttribute("aria-hidden","false"),this.$toggleButton.setAttribute("aria-expanded","true"),this.$toggleButton.setAttribute("title","Close menu");for(var n=0;n<this.$links.length;n++)this.$links[n].setAttribute("tabindex","0")}}}])&&o(n.prototype,i),Object.defineProperty(n,"prototype",{writable:!1}),e}()})(),i})()));
2
2
  //# sourceMappingURL=header.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"components/header/header.js","mappings":"CAAA,SAA2CA,EAAMC,GAC1B,iBAAZC,SAA0C,iBAAXC,OACxCA,OAAOD,QAAUD,IACQ,mBAAXG,QAAyBA,OAAOC,IAC9CD,OAAO,cAAe,GAAIH,GACA,iBAAZC,QACdA,QAAqB,YAAID,KAEzBD,EAAkB,YAAIA,EAAkB,aAAK,CAAC,EAAGA,EAAkB,YAAE,4BAA8BC,IACpG,CATD,CASGK,MAAM,I,mBCRT,IAAIC,EAAsB,CCA1BA,EAAwB,CAACL,EAASM,KACjC,IAAI,IAAIC,KAAOD,EACXD,EAAoBG,EAAEF,EAAYC,KAASF,EAAoBG,EAAER,EAASO,IAC5EE,OAAOC,eAAeV,EAASO,EAAK,CAAEI,YAAY,EAAMC,IAAKN,EAAWC,IAE1E,ECNDF,EAAwB,CAACQ,EAAKC,IAAUL,OAAOM,UAAUC,eAAeC,KAAKJ,EAAKC,GCClFT,EAAyBL,IACH,oBAAXkB,QAA0BA,OAAOC,aAC1CV,OAAOC,eAAeV,EAASkB,OAAOC,YAAa,CAAEC,MAAO,WAE7DX,OAAOC,eAAeV,EAAS,aAAc,CAAEoB,OAAO,GAAO,G,qsBCHvD,IAAMC,EAAM,WACjB,SAAAA,EAAYC,I,4FAASC,CAAA,KAAAF,GACnBG,KAAKF,QAAUA,EACfE,KAAKC,qBACHH,GAAWA,EAAQI,cAAc,kCACnCF,KAAKG,YACHL,GAAWA,EAAQI,cAAc,2BACnCF,KAAKI,OACHN,GACAE,KAAKG,aACLH,KAAKG,YAAYE,iBAAiB,kBACpCL,KAAKM,YAAa,E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C,KAAKG,YAAYgB,aAAa,cAAe,SAC7CnB,KAAKoB,cAAcD,aAAa,gBAAiB,QACjDnB,KAAKoB,cAAcD,aAAa,QAAS,cAEzC,IAAK,IAAIe,EAAI,EAAGA,EAAIlC,KAAKI,OAAO+B,OAAQD,IACtClC,KAAKI,OAAO8B,GAAGf,aAAa,WAAY,IAE5C,KAAO,CACLnB,KAAKG,YAAYqB,UAAUY,OAAO,gCAClCpC,KAAKG,YAAY8B,QAAS,EAC1BjC,KAAKG,YAAYgB,aAAa,cAAe,QAC7CnB,KAAKoB,cAAcD,aAAa,gBAAiB,SACjDnB,KAAKoB,cAAcD,aAAa,QAAS,aAEzC,IAAK,IAAIe,EAAI,EAAGA,EAAIlC,KAAKI,OAAO+B,OAAQD,IACtClC,KAAKI,OAAO8B,GAAGf,aAAa,WAAY,KAE5C,KACK,CACLnB,KAAKG,YAAYqB,UAAUC,IAAI,gCAC/BzB,KAAKG,YAAY8B,QAAS,EAC1BjC,KAAKG,YAAYgB,aAAa,cAAe,SAC7CnB,KAAKoB,cAAcD,aAAa,gBAAiB,QACjDnB,KAAKoB,cAAcD,aAAa,QAAS,cAEzC,IAAK,IAAIe,EAAI,EAAGA,EAAIlC,KAAKI,OAAO+B,OAAQD,IACtClC,KAAKI,OAAO8B,GAAGf,aAAa,WAAY,IAE5C,CACF,M,oEAACtB,CAAA,CAlGgB,G","sources":["webpack://TNAFrontend/webpack/universalModuleDefinition","webpack://TNAFrontend/webpack/bootstrap","webpack://TNAFrontend/webpack/runtime/define property getters","webpack://TNAFrontend/webpack/runtime/hasOwnProperty shorthand","webpack://TNAFrontend/webpack/runtime/make namespace object","webpack://TNAFrontend/./src/nationalarchives/components/header/header.mjs","webpack://TNAFrontend/./src/nationalarchives/lib/uuid.mjs"],"sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine(\"TNAFrontend\", [], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"TNAFrontend\"] = factory();\n\telse\n\t\troot[\"TNAFrontend\"] = root[\"TNAFrontend\"] || {}, root[\"TNAFrontend\"][\"components/header/header\"] = factory();\n})(self, () => {\nreturn ","// The require scope\nvar __webpack_require__ = {};\n\n","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","import uuidv4 from \"../../lib/uuid.mjs\";\n\nexport class Header {\n constructor($module) {\n this.$module = $module;\n this.$toggleButtonWrapper =\n $module && $module.querySelector(\".tna-header__navigation-toggle\");\n this.$navigation =\n $module && $module.querySelector(\".tna-header__navigation\");\n this.$links =\n $module &&\n this.$navigation &&\n this.$navigation.querySelectorAll(\"[tabindex='0']\");\n this.menuOpened = false;\n this.mql = window.matchMedia(\"(max-width: 768px)\");\n }\n\n init() {\n if (!this.$module || !this.$toggleButtonWrapper || !this.$navigation) {\n return;\n }\n\n // const uniqueLinkIds = []\n\n // for (let i = 0; i < this.$links.length; i++) {\n // const uniqueLinkId = uuidv4()\n // this.$links[i].setAttribute(\"id\", uniqueLinkId);\n // uniqueLinkIds.push(uniqueLinkId)\n // }\n\n const uniqueId = `menu-content-${uuidv4()}`;\n this.$navigation.setAttribute(\"id\", uniqueId);\n // this.$navigation.setAttribute(\"aria-owns\", uniqueLinkIds.join(\",\"));\n\n this.$toggleButton = document.createElement(\"button\");\n this.$toggleButton.innerText = \"Menu\";\n this.$toggleButton.setAttribute(\"aria-controls\", uniqueId);\n this.$toggleButton.setAttribute(\"aria-haspopup\", \"true\");\n this.$toggleButton.classList.add(\"tna-header__navigation-toggle-button\");\n\n this.$hamburger = document.createElement(\"div\");\n this.$hamburger.classList.add(\"tna-header__hamburger\");\n\n this.$toggleButton.appendChild(this.$hamburger);\n this.$toggleButtonWrapper.appendChild(this.$toggleButton);\n\n this.syncState();\n\n this.$toggleButton.addEventListener(\"click\", () =>\n this.handleToggleNavigation(),\n );\n\n if (\"addEventListener\" in this.mql) {\n this.mql.addEventListener(\"change\", () => this.syncState());\n // this.mql.addEventListener(\"change\", this.syncState.bind(this));\n } else {\n this.mql.addListener(() => this.syncState());\n // this.mql.addListener(this.syncState.bind(this));\n }\n }\n\n handleToggleNavigation() {\n this.menuOpened = !this.menuOpened;\n this.syncState();\n }\n\n syncState() {\n if (this.mql.matches) {\n if (this.menuOpened) {\n this.$navigation.classList.add(\"tna-header__navigation--open\");\n this.$navigation.hidden = false;\n this.$navigation.setAttribute(\"aria-hidden\", \"false\");\n this.$toggleButton.setAttribute(\"aria-expanded\", \"true\");\n this.$toggleButton.setAttribute(\"title\", \"Close menu\");\n\n for (let i = 0; i < this.$links.length; i++) {\n this.$links[i].setAttribute(\"tabindex\", \"0\");\n }\n } else {\n this.$navigation.classList.remove(\"tna-header__navigation--open\");\n this.$navigation.hidden = true;\n this.$navigation.setAttribute(\"aria-hidden\", \"true\");\n this.$toggleButton.setAttribute(\"aria-expanded\", \"false\");\n this.$toggleButton.setAttribute(\"title\", \"Open menu\");\n\n for (let i = 0; i < this.$links.length; i++) {\n this.$links[i].setAttribute(\"tabindex\", \"-1\");\n }\n }\n } else {\n this.$navigation.classList.add(\"tna-header__navigation--open\");\n this.$navigation.hidden = false;\n this.$navigation.setAttribute(\"aria-hidden\", \"false\");\n this.$toggleButton.setAttribute(\"aria-expanded\", \"true\");\n this.$toggleButton.setAttribute(\"title\", \"Close menu\");\n\n for (let i = 0; i < this.$links.length; i++) {\n this.$links[i].setAttribute(\"tabindex\", \"0\");\n }\n }\n }\n}\n","const uuidv4 = () =>\n ([1e7] + -1e3 + -4e3 + -8e3 + -1e11).replace(/[018]/g, (c) =>\n (\n c ^\n (crypto.getRandomValues(new Uint8Array(1))[0] & (15 >> (c / 4)))\n ).toString(16),\n );\n\nexport default uuidv4;\n"],"names":["root","factory","exports","module","define","amd","self","__webpack_require__","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","Symbol","toStringTag","value","Header","$module","_classCallCheck","this","$toggleButtonWrapper","querySelector","$navigation","$links","querySelectorAll","menuOpened","mql","window","matchMedia","_this","uniqueId","concat","replace","c","crypto","getRandomValues","Uint8Array","toString","setAttribute","$toggleButton","document","createElement","innerText","classList","add","$hamburger","appendChild","syncState","addEventListener","handleToggleNavigation","addListener","matches","hidden","i","length","remove"],"sourceRoot":""}
1
+ {"version":3,"file":"components/header/header.js","mappings":"CAAA,SAA2CA,EAAMC,GAC1B,iBAAZC,SAA0C,iBAAXC,OACxCA,OAAOD,QAAUD,IACQ,mBAAXG,QAAyBA,OAAOC,IAC9CD,OAAO,cAAe,GAAIH,GACA,iBAAZC,QACdA,QAAqB,YAAID,KAEzBD,EAAkB,YAAIA,EAAkB,aAAK,CAAC,EAAGA,EAAkB,YAAE,4BAA8BC,IACpG,CATD,CASGK,MAAM,I,yDCDT,QARe,WAAH,OACT,CAAC,MAAQ,KAAO,KAAO,KAAO,MAAMC,QAAQ,UAAU,SAACC,GAAC,OAErDA,EACCC,OAAOC,gBAAgB,IAAIC,WAAW,IAAI,GAAM,IAAOH,EAAI,GAC5DI,SAAS,GAAG,GACf,C,GCLCC,EAA2B,CAAC,EAGhC,SAASC,EAAoBC,GAE5B,IAAIC,EAAeH,EAAyBE,GAC5C,QAAqBE,IAAjBD,EACH,OAAOA,EAAad,QAGrB,IAAIC,EAASU,EAAyBE,GAAY,CAGjDb,QAAS,CAAC,GAOX,OAHAgB,EAAoBH,GAAUZ,E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KAAKG,YAAYyB,QAAS,EAC1B5B,KAAKG,YAAYW,aAAa,cAAe,SAC7Cd,KAAKe,cAAcD,aAAa,gBAAiB,QACjDd,KAAKe,cAAcD,aAAa,QAAS,cAEzC,IAAK,IAAIe,EAAI,EAAGA,EAAI7B,KAAKI,OAAO0B,OAAQD,IACtC7B,KAAKI,OAAOyB,GAAGf,aAAa,WAAY,IAE5C,CACF,M,oEAACjB,CAAA,CA7FgB,E","sources":["webpack://TNAFrontend/webpack/universalModuleDefinition","webpack://TNAFrontend/./src/nationalarchives/lib/uuid.mjs","webpack://TNAFrontend/webpack/bootstrap","webpack://TNAFrontend/webpack/runtime/define property getters","webpack://TNAFrontend/webpack/runtime/hasOwnProperty shorthand","webpack://TNAFrontend/webpack/runtime/make namespace object","webpack://TNAFrontend/./src/nationalarchives/components/header/header.mjs"],"sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine(\"TNAFrontend\", [], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"TNAFrontend\"] = factory();\n\telse\n\t\troot[\"TNAFrontend\"] = root[\"TNAFrontend\"] || {}, root[\"TNAFrontend\"][\"components/header/header\"] = factory();\n})(self, () => {\nreturn ","const uuidv4 = () =>\n ([1e7] + -1e3 + -4e3 + -8e3 + -1e11).replace(/[018]/g, (c) =>\n (\n c ^\n (crypto.getRandomValues(new Uint8Array(1))[0] & (15 >> (c / 4)))\n ).toString(16),\n );\n\nexport default uuidv4;\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","import uuidv4 from \"../../lib/uuid.mjs\";\n\nexport class Header {\n constructor($module) {\n this.$module = $module;\n this.$toggleButtonWrapper =\n $module && $module.querySelector(\".tna-header__navigation-toggle\");\n this.$navigation =\n $module && $module.querySelector(\".tna-header__navigation\");\n this.$links =\n $module &&\n this.$navigation &&\n this.$navigation.querySelectorAll(\"[tabindex='0']\");\n this.menuOpened = false;\n this.mql = window.matchMedia(\"(max-width: 768px)\");\n }\n\n init() {\n if (!this.$module || !this.$toggleButtonWrapper || !this.$navigation) {\n return;\n }\n\n const uniqueId = `tna-menu-content-${uuidv4()}`;\n this.$navigation.setAttribute(\"id\", uniqueId);\n\n this.$toggleButton = document.createElement(\"button\");\n this.$toggleButton.innerText = \"Menu\";\n this.$toggleButton.setAttribute(\"aria-controls\", uniqueId);\n this.$toggleButton.setAttribute(\"aria-haspopup\", \"true\");\n this.$toggleButton.classList.add(\"tna-header__navigation-toggle-button\");\n\n this.$hamburger = document.createElement(\"div\");\n this.$hamburger.classList.add(\"tna-header__hamburger\");\n\n this.$toggleButton.appendChild(this.$hamburger);\n this.$toggleButtonWrapper.appendChild(this.$toggleButton);\n\n this.syncState();\n\n this.$toggleButton.addEventListener(\"click\", () =>\n this.handleToggleNavigation(),\n );\n\n if (\"addEventListener\" in this.mql) {\n this.mql.addEventListener(\"change\", () => this.syncState());\n } else {\n this.mql.addListener(() => this.syncState());\n }\n }\n\n handleToggleNavigation() {\n this.menuOpened = !this.menuOpened;\n this.syncState();\n }\n\n syncState() {\n if (this.mql.matches) {\n if (this.menuOpened) {\n this.$navigation.classList.add(\"tna-header__navigation--open\");\n this.$navigation.hidden = false;\n this.$navigation.setAttribute(\"aria-hidden\", \"false\");\n this.$toggleButton.setAttribute(\"aria-expanded\", \"true\");\n this.$toggleButton.setAttribute(\"title\", \"Close menu\");\n this.$toggleButton.classList.add(\n \"tna-header__navigation-toggle-button--opened\",\n );\n\n for (let i = 0; i < this.$links.length; i++) {\n this.$links[i].setAttribute(\"tabindex\", \"0\");\n }\n } else {\n this.$navigation.classList.remove(\"tna-header__navigation--open\");\n this.$navigation.hidden = true;\n this.$navigation.setAttribute(\"aria-hidden\", \"true\");\n this.$toggleButton.setAttribute(\"aria-expanded\", \"false\");\n this.$toggleButton.setAttribute(\"title\", \"Open menu\");\n this.$toggleButton.classList.remove(\n \"tna-header__navigation-toggle-button--opened\",\n );\n\n for (let i = 0; i < this.$links.length; i++) {\n this.$links[i].setAttribute(\"tabindex\", \"-1\");\n }\n }\n } else {\n this.$navigation.classList.add(\"tna-header__navigation--open\");\n this.$navigation.hidden = false;\n this.$navigation.setAttribute(\"aria-hidden\", \"false\");\n this.$toggleButton.setAttribute(\"aria-expanded\", \"true\");\n this.$toggleButton.setAttribute(\"title\", \"Close menu\");\n\n for (let i = 0; i < this.$links.length; i++) {\n this.$links[i].setAttribute(\"tabindex\", \"0\");\n }\n }\n }\n}\n"],"names":["root","factory","exports","module","define","amd","self","replace","c","crypto","getRandomValues","Uint8Array","toString","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","undefined","__webpack_modules__","d","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","r","Symbol","toStringTag","value","Header","$module","_classCallCheck","this","$toggleButtonWrapper","querySelector","$navigation","$links","querySelectorAll","menuOpened","mql","window","matchMedia","_this","uniqueId","concat","uuidv4","setAttribute","$toggleButton","document","createElement","innerText","classList","add","$hamburger","appendChild","syncState","addEventListener","handleToggleNavigation","addListener","matches","hidden","i","length","remove"],"sourceRoot":""}
@@ -20,17 +20,8 @@ export class Header {
20
20
  return;
21
21
  }
22
22
 
23
- // const uniqueLinkIds = []
24
-
25
- // for (let i = 0; i < this.$links.length; i++) {
26
- // const uniqueLinkId = uuidv4()
27
- // this.$links[i].setAttribute("id", uniqueLinkId);
28
- // uniqueLinkIds.push(uniqueLinkId)
29
- // }
30
-
31
- const uniqueId = `menu-content-${uuidv4()}`;
23
+ const uniqueId = `tna-menu-content-${uuidv4()}`;
32
24
  this.$navigation.setAttribute("id", uniqueId);
33
- // this.$navigation.setAttribute("aria-owns", uniqueLinkIds.join(","));
34
25
 
35
26
  this.$toggleButton = document.createElement("button");
36
27
  this.$toggleButton.innerText = "Menu";
@@ -52,10 +43,8 @@ export class Header {
52
43
 
53
44
  if ("addEventListener" in this.mql) {
54
45
  this.mql.addEventListener("change", () => this.syncState());
55
- // this.mql.addEventListener("change", this.syncState.bind(this));
56
46
  } else {
57
47
  this.mql.addListener(() => this.syncState());
58
- // this.mql.addListener(this.syncState.bind(this));
59
48
  }
60
49
  }
61
50
 
@@ -72,6 +61,9 @@ export class Header {
72
61
  this.$navigation.setAttribute("aria-hidden", "false");
73
62
  this.$toggleButton.setAttribute("aria-expanded", "true");
74
63
  this.$toggleButton.setAttribute("title", "Close menu");
64
+ this.$toggleButton.classList.add(
65
+ "tna-header__navigation-toggle-button--opened",
66
+ );
75
67
 
76
68
  for (let i = 0; i < this.$links.length; i++) {
77
69
  this.$links[i].setAttribute("tabindex", "0");
@@ -82,6 +74,9 @@ export class Header {
82
74
  this.$navigation.setAttribute("aria-hidden", "true");
83
75
  this.$toggleButton.setAttribute("aria-expanded", "false");
84
76
  this.$toggleButton.setAttribute("title", "Open menu");
77
+ this.$toggleButton.classList.remove(
78
+ "tna-header__navigation-toggle-button--opened",
79
+ );
85
80
 
86
81
  for (let i = 0; i < this.$links.length; i++) {
87
82
  this.$links[i].setAttribute("tabindex", "-1");