govuk_publishing_components 55.0.1 → 55.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (167) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/govuk_publishing_components/components/file-upload.js +5 -0
  3. data/app/assets/stylesheets/govuk_publishing_components/components/_layout-super-navigation-header.scss +1 -0
  4. data/app/assets/stylesheets/govuk_publishing_components/components/_organisation-logo.scss +5 -2
  5. data/app/views/govuk_publishing_components/components/_file_upload.html.erb +13 -1
  6. data/app/views/govuk_publishing_components/components/_layout_super_navigation_header.html.erb +0 -1
  7. data/app/views/govuk_publishing_components/components/docs/file_upload.yml +6 -0
  8. data/app/views/govuk_publishing_components/components/feedback/_survey_signup_form.html.erb +1 -1
  9. data/lib/govuk_publishing_components/version.rb +1 -1
  10. data/node_modules/govuk-frontend/dist/govuk/all.bundle.js +313 -47
  11. data/node_modules/govuk-frontend/dist/govuk/all.bundle.js.map +1 -1
  12. data/node_modules/govuk-frontend/dist/govuk/all.bundle.mjs +312 -47
  13. data/node_modules/govuk-frontend/dist/govuk/all.bundle.mjs.map +1 -1
  14. data/node_modules/govuk-frontend/dist/govuk/all.mjs +2 -1
  15. data/node_modules/govuk-frontend/dist/govuk/all.mjs.map +1 -1
  16. data/node_modules/govuk-frontend/dist/govuk/common/configuration.mjs +21 -16
  17. data/node_modules/govuk-frontend/dist/govuk/common/configuration.mjs.map +1 -1
  18. data/node_modules/govuk-frontend/dist/govuk/common/govuk-frontend-version.mjs +1 -1
  19. data/node_modules/govuk-frontend/dist/govuk/common/index.mjs +3 -0
  20. data/node_modules/govuk-frontend/dist/govuk/common/index.mjs.map +1 -1
  21. data/node_modules/govuk-frontend/dist/govuk/{govuk-frontend-component.mjs → component.mjs} +5 -5
  22. data/node_modules/govuk-frontend/dist/govuk/component.mjs.map +1 -0
  23. data/node_modules/govuk-frontend/dist/govuk/components/accordion/accordion.bundle.js +27 -19
  24. data/node_modules/govuk-frontend/dist/govuk/components/accordion/accordion.bundle.js.map +1 -1
  25. data/node_modules/govuk-frontend/dist/govuk/components/accordion/accordion.bundle.mjs +27 -19
  26. data/node_modules/govuk-frontend/dist/govuk/components/accordion/accordion.bundle.mjs.map +1 -1
  27. data/node_modules/govuk-frontend/dist/govuk/components/accordion/accordion.mjs +1 -1
  28. data/node_modules/govuk-frontend/dist/govuk/components/accordion/accordion.mjs.map +1 -1
  29. data/node_modules/govuk-frontend/dist/govuk/components/button/button.bundle.js +27 -19
  30. data/node_modules/govuk-frontend/dist/govuk/components/button/button.bundle.js.map +1 -1
  31. data/node_modules/govuk-frontend/dist/govuk/components/button/button.bundle.mjs +27 -19
  32. data/node_modules/govuk-frontend/dist/govuk/components/button/button.bundle.mjs.map +1 -1
  33. data/node_modules/govuk-frontend/dist/govuk/components/button/button.mjs +1 -1
  34. data/node_modules/govuk-frontend/dist/govuk/components/button/button.mjs.map +1 -1
  35. data/node_modules/govuk-frontend/dist/govuk/components/button/macro-options.json +2 -1
  36. data/node_modules/govuk-frontend/dist/govuk/components/character-count/_index.scss +8 -0
  37. data/node_modules/govuk-frontend/dist/govuk/components/character-count/_index.scss.map +1 -1
  38. data/node_modules/govuk-frontend/dist/govuk/components/character-count/character-count.bundle.js +28 -20
  39. data/node_modules/govuk-frontend/dist/govuk/components/character-count/character-count.bundle.js.map +1 -1
  40. data/node_modules/govuk-frontend/dist/govuk/components/character-count/character-count.bundle.mjs +28 -20
  41. data/node_modules/govuk-frontend/dist/govuk/components/character-count/character-count.bundle.mjs.map +1 -1
  42. data/node_modules/govuk-frontend/dist/govuk/components/character-count/character-count.mjs +2 -2
  43. data/node_modules/govuk-frontend/dist/govuk/components/character-count/character-count.mjs.map +1 -1
  44. data/node_modules/govuk-frontend/dist/govuk/components/character-count/fixtures.json +16 -1
  45. data/node_modules/govuk-frontend/dist/govuk/components/character-count/macro-options.json +2 -2
  46. data/node_modules/govuk-frontend/dist/govuk/components/character-count/template.njk +5 -4
  47. data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/checkboxes.bundle.js +8 -5
  48. data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/checkboxes.bundle.js.map +1 -1
  49. data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/checkboxes.bundle.mjs +8 -5
  50. data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/checkboxes.bundle.mjs.map +1 -1
  51. data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/checkboxes.mjs +2 -2
  52. data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/checkboxes.mjs.map +1 -1
  53. data/node_modules/govuk-frontend/dist/govuk/components/error-summary/error-summary.bundle.js +27 -19
  54. data/node_modules/govuk-frontend/dist/govuk/components/error-summary/error-summary.bundle.js.map +1 -1
  55. data/node_modules/govuk-frontend/dist/govuk/components/error-summary/error-summary.bundle.mjs +27 -19
  56. data/node_modules/govuk-frontend/dist/govuk/components/error-summary/error-summary.bundle.mjs.map +1 -1
  57. data/node_modules/govuk-frontend/dist/govuk/components/error-summary/error-summary.mjs +1 -1
  58. data/node_modules/govuk-frontend/dist/govuk/components/error-summary/error-summary.mjs.map +1 -1
  59. data/node_modules/govuk-frontend/dist/govuk/components/exit-this-page/exit-this-page.bundle.js +27 -19
  60. data/node_modules/govuk-frontend/dist/govuk/components/exit-this-page/exit-this-page.bundle.js.map +1 -1
  61. data/node_modules/govuk-frontend/dist/govuk/components/exit-this-page/exit-this-page.bundle.mjs +27 -19
  62. data/node_modules/govuk-frontend/dist/govuk/components/exit-this-page/exit-this-page.bundle.mjs.map +1 -1
  63. data/node_modules/govuk-frontend/dist/govuk/components/exit-this-page/exit-this-page.mjs +1 -1
  64. data/node_modules/govuk-frontend/dist/govuk/components/exit-this-page/exit-this-page.mjs.map +1 -1
  65. data/node_modules/govuk-frontend/dist/govuk/components/file-upload/_index.scss +167 -0
  66. data/node_modules/govuk-frontend/dist/govuk/components/file-upload/_index.scss.map +1 -1
  67. data/node_modules/govuk-frontend/dist/govuk/components/file-upload/file-upload.bundle.js +754 -0
  68. data/node_modules/govuk-frontend/dist/govuk/components/file-upload/file-upload.bundle.js.map +1 -0
  69. data/node_modules/govuk-frontend/dist/govuk/components/file-upload/file-upload.bundle.mjs +746 -0
  70. data/node_modules/govuk-frontend/dist/govuk/components/file-upload/file-upload.bundle.mjs.map +1 -0
  71. data/node_modules/govuk-frontend/dist/govuk/components/file-upload/file-upload.mjs +267 -0
  72. data/node_modules/govuk-frontend/dist/govuk/components/file-upload/file-upload.mjs.map +1 -0
  73. data/node_modules/govuk-frontend/dist/govuk/components/file-upload/fixtures.json +207 -16
  74. data/node_modules/govuk-frontend/dist/govuk/components/file-upload/macro-options.json +52 -3
  75. data/node_modules/govuk-frontend/dist/govuk/components/file-upload/template-allows-direct-media-capture.html +6 -0
  76. data/node_modules/govuk-frontend/dist/govuk/components/file-upload/template-allows-image-files-only.html +6 -0
  77. data/node_modules/govuk-frontend/dist/govuk/components/file-upload/template-allows-multiple-files.html +6 -0
  78. data/node_modules/govuk-frontend/dist/govuk/components/file-upload/template-disabled.html +6 -0
  79. data/node_modules/govuk-frontend/dist/govuk/components/file-upload/template-enhanced-disabled.html +13 -0
  80. data/node_modules/govuk-frontend/dist/govuk/components/file-upload/template-enhanced-with-error-message-and-hint.html +16 -0
  81. data/node_modules/govuk-frontend/dist/govuk/components/file-upload/template-enhanced.html +10 -0
  82. data/node_modules/govuk-frontend/dist/govuk/components/file-upload/template-translated.html +10 -0
  83. data/node_modules/govuk-frontend/dist/govuk/components/file-upload/template.njk +42 -5
  84. data/node_modules/govuk-frontend/dist/govuk/components/header/_index.scss +14 -10
  85. data/node_modules/govuk-frontend/dist/govuk/components/header/_index.scss.map +1 -1
  86. data/node_modules/govuk-frontend/dist/govuk/components/header/header.bundle.js +8 -5
  87. data/node_modules/govuk-frontend/dist/govuk/components/header/header.bundle.js.map +1 -1
  88. data/node_modules/govuk-frontend/dist/govuk/components/header/header.bundle.mjs +8 -5
  89. data/node_modules/govuk-frontend/dist/govuk/components/header/header.bundle.mjs.map +1 -1
  90. data/node_modules/govuk-frontend/dist/govuk/components/header/header.mjs +2 -2
  91. data/node_modules/govuk-frontend/dist/govuk/components/header/header.mjs.map +1 -1
  92. data/node_modules/govuk-frontend/dist/govuk/components/header/macro-options.json +25 -12
  93. data/node_modules/govuk-frontend/dist/govuk/components/input/fixtures.json +16 -2
  94. data/node_modules/govuk-frontend/dist/govuk/components/input/macro-options.json +2 -2
  95. data/node_modules/govuk-frontend/dist/govuk/components/input/template-default.html +2 -2
  96. data/node_modules/govuk-frontend/dist/govuk/components/input/template.njk +5 -4
  97. data/node_modules/govuk-frontend/dist/govuk/components/notification-banner/notification-banner.bundle.js +27 -19
  98. data/node_modules/govuk-frontend/dist/govuk/components/notification-banner/notification-banner.bundle.js.map +1 -1
  99. data/node_modules/govuk-frontend/dist/govuk/components/notification-banner/notification-banner.bundle.mjs +27 -19
  100. data/node_modules/govuk-frontend/dist/govuk/components/notification-banner/notification-banner.bundle.mjs.map +1 -1
  101. data/node_modules/govuk-frontend/dist/govuk/components/notification-banner/notification-banner.mjs +1 -1
  102. data/node_modules/govuk-frontend/dist/govuk/components/notification-banner/notification-banner.mjs.map +1 -1
  103. data/node_modules/govuk-frontend/dist/govuk/components/password-input/fixtures.json +16 -2
  104. data/node_modules/govuk-frontend/dist/govuk/components/password-input/macro-options.json +2 -2
  105. data/node_modules/govuk-frontend/dist/govuk/components/password-input/password-input.bundle.js +27 -20
  106. data/node_modules/govuk-frontend/dist/govuk/components/password-input/password-input.bundle.js.map +1 -1
  107. data/node_modules/govuk-frontend/dist/govuk/components/password-input/password-input.bundle.mjs +27 -20
  108. data/node_modules/govuk-frontend/dist/govuk/components/password-input/password-input.bundle.mjs.map +1 -1
  109. data/node_modules/govuk-frontend/dist/govuk/components/password-input/password-input.mjs +1 -2
  110. data/node_modules/govuk-frontend/dist/govuk/components/password-input/password-input.mjs.map +1 -1
  111. data/node_modules/govuk-frontend/dist/govuk/components/password-input/template-default.html +3 -3
  112. data/node_modules/govuk-frontend/dist/govuk/components/password-input/template.njk +4 -2
  113. data/node_modules/govuk-frontend/dist/govuk/components/radios/radios.bundle.js +8 -5
  114. data/node_modules/govuk-frontend/dist/govuk/components/radios/radios.bundle.js.map +1 -1
  115. data/node_modules/govuk-frontend/dist/govuk/components/radios/radios.bundle.mjs +8 -5
  116. data/node_modules/govuk-frontend/dist/govuk/components/radios/radios.bundle.mjs.map +1 -1
  117. data/node_modules/govuk-frontend/dist/govuk/components/radios/radios.mjs +2 -2
  118. data/node_modules/govuk-frontend/dist/govuk/components/radios/radios.mjs.map +1 -1
  119. data/node_modules/govuk-frontend/dist/govuk/components/select/fixtures.json +16 -1
  120. data/node_modules/govuk-frontend/dist/govuk/components/select/macro-options.json +2 -2
  121. data/node_modules/govuk-frontend/dist/govuk/components/select/template-id.html +7 -0
  122. data/node_modules/govuk-frontend/dist/govuk/components/select/template.njk +6 -4
  123. data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/service-navigation.bundle.js +8 -5
  124. data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/service-navigation.bundle.js.map +1 -1
  125. data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/service-navigation.bundle.mjs +8 -5
  126. data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/service-navigation.bundle.mjs.map +1 -1
  127. data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/service-navigation.mjs +2 -2
  128. data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/service-navigation.mjs.map +1 -1
  129. data/node_modules/govuk-frontend/dist/govuk/components/skip-link/skip-link.bundle.js +9 -6
  130. data/node_modules/govuk-frontend/dist/govuk/components/skip-link/skip-link.bundle.js.map +1 -1
  131. data/node_modules/govuk-frontend/dist/govuk/components/skip-link/skip-link.bundle.mjs +9 -6
  132. data/node_modules/govuk-frontend/dist/govuk/components/skip-link/skip-link.bundle.mjs.map +1 -1
  133. data/node_modules/govuk-frontend/dist/govuk/components/skip-link/skip-link.mjs +3 -3
  134. data/node_modules/govuk-frontend/dist/govuk/components/skip-link/skip-link.mjs.map +1 -1
  135. data/node_modules/govuk-frontend/dist/govuk/components/summary-list/_index.scss +12 -21
  136. data/node_modules/govuk-frontend/dist/govuk/components/summary-list/_index.scss.map +1 -1
  137. data/node_modules/govuk-frontend/dist/govuk/components/summary-list/fixtures.json +142 -0
  138. data/node_modules/govuk-frontend/dist/govuk/components/summary-list/template-as-a-summary-card-extreme.html +106 -0
  139. data/node_modules/govuk-frontend/dist/govuk/components/tabs/tabs.bundle.js +8 -5
  140. data/node_modules/govuk-frontend/dist/govuk/components/tabs/tabs.bundle.js.map +1 -1
  141. data/node_modules/govuk-frontend/dist/govuk/components/tabs/tabs.bundle.mjs +8 -5
  142. data/node_modules/govuk-frontend/dist/govuk/components/tabs/tabs.bundle.mjs.map +1 -1
  143. data/node_modules/govuk-frontend/dist/govuk/components/tabs/tabs.mjs +2 -2
  144. data/node_modules/govuk-frontend/dist/govuk/components/tabs/tabs.mjs.map +1 -1
  145. data/node_modules/govuk-frontend/dist/govuk/components/textarea/fixtures.json +15 -1
  146. data/node_modules/govuk-frontend/dist/govuk/components/textarea/macro-options.json +2 -2
  147. data/node_modules/govuk-frontend/dist/govuk/components/textarea/template.njk +6 -4
  148. data/node_modules/govuk-frontend/dist/govuk/core/_govuk-frontend-properties.scss +1 -1
  149. data/node_modules/govuk-frontend/dist/govuk/errors/index.mjs +1 -1
  150. data/node_modules/govuk-frontend/dist/govuk/errors/index.mjs.map +1 -1
  151. data/node_modules/govuk-frontend/dist/govuk/govuk-frontend.min.css +2 -2
  152. data/node_modules/govuk-frontend/dist/govuk/govuk-frontend.min.css.map +1 -1
  153. data/node_modules/govuk-frontend/dist/govuk/govuk-frontend.min.js +1 -1
  154. data/node_modules/govuk-frontend/dist/govuk/govuk-frontend.min.js.map +1 -1
  155. data/node_modules/govuk-frontend/dist/govuk/helpers/_colour.scss +2 -2
  156. data/node_modules/govuk-frontend/dist/govuk/helpers/_colour.scss.map +1 -1
  157. data/node_modules/govuk-frontend/dist/govuk/init.mjs +11 -11
  158. data/node_modules/govuk-frontend/dist/govuk/init.mjs.map +1 -1
  159. data/node_modules/govuk-frontend/dist/govuk/settings/_colours-organisations.scss +18 -5
  160. data/node_modules/govuk-frontend/dist/govuk/settings/_colours-organisations.scss.map +1 -1
  161. data/node_modules/govuk-frontend/dist/govuk-prototype-kit/init.scss +1 -1
  162. data/node_modules/govuk-frontend/dist/govuk-prototype-kit/init.scss.map +1 -1
  163. data/node_modules/govuk-frontend/govuk-prototype-kit.config.json +1 -1
  164. data/node_modules/govuk-frontend/package.json +7 -7
  165. metadata +21 -5
  166. data/node_modules/govuk-frontend/dist/govuk/components/file-upload/template-with-value.html +0 -6
  167. data/node_modules/govuk-frontend/dist/govuk/govuk-frontend-component.mjs.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/govuk/components/header/_index.scss"],"names":[],"mappings":"AAAA;EACE,+CAA+C;EAC/C,+CAA+C;EAC/C,4CAA4C;EAC5C,yCAAyC;EACzC,kCAAkC;EAClC,4CAA4C;EAC5C,2CAA2C;EAC3C,uCAAuC;EACvC,8EAA8E;EAC9E,kFAAkF;EAClF,gCAAgC;EAChC,sCAAsC;EACtC,qCAAqC;;EAErC;IACE,+CAA+C;;IAE/C,2DAA2D;IAC3D,yBAAyB;IACzB,oCAAoC;EACtC;;EAEA;IACE,2BAA2B;IAC3B,wCAAwC;;IAExC;MACE,uBAAuB;IACzB;EACF;;EAEA;IACE,uBAAuB;IACvB,kBAAkB;IAClB,0CAA0C;IAC1C,gEAAgE;IAChE,0EAA0E;EAC5E;;EAEA;IACE,+CAA+C;;IAE/C;MACE,gCAAgC;IAClC;EACF;;EAEA;IACE,qBAAqB;IACrB,kBAAkB;IAClB,SAAS;;IAET,wEAAwE;IACxE,sDAAsD;IACtD,8BAA8B;IAC9B,kBAAkB;IAClB,mBAAmB;;IAEnB,wEAAwE;IACxE,eAAe;IACf;MACE,yBAAyB;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esContent":["@include govuk-exports(\"govuk/component/header\") {\n $govuk-header-background: govuk-colour(\"black\");\n $govuk-header-border-color: $govuk-brand-colour;\n $govuk-header-border-width: govuk-spacing(2);\n $govuk-header-text: govuk-colour(\"white\");\n $govuk-header-link-active: #1d8feb;\n $govuk-header-nav-item-border-color: #2e3133;\n $govuk-header-link-underline-thickness: 3px;\n $govuk-header-vertical-spacing-value: 2;\n // This crown height is only used to calculate top offset of mobile menu button\n // as the crown svg height is the only thing that controls the height of the header\n $govuk-header-crown-height: 30px;\n $govuk-header-menu-button-height: 24px;\n $govuk-header-menu-button-width: 80px;\n\n .govuk-header {\n @include govuk-font($size: 16, $line-height: 1);\n\n border-bottom: govuk-spacing(2) solid govuk-colour(\"white\");\n color: $govuk-header-text;\n background: $govuk-header-background;\n }\n\n .govuk-header__container--full-width {\n padding: 0 govuk-spacing(3);\n border-color: $govuk-header-border-color;\n\n .govuk-header__menu-button {\n right: govuk-spacing(3);\n }\n }\n\n .govuk-header__container {\n @include govuk-clearfix;\n position: relative;\n margin-bottom: -$govuk-header-border-width;\n padding-top: govuk-spacing($govuk-header-vertical-spacing-value);\n border-bottom: $govuk-header-border-width solid $govuk-header-border-color;\n }\n\n .govuk-header--full-width-border {\n border-bottom-color: $govuk-header-border-color;\n\n .govuk-header__container {\n border-bottom-color: transparent;\n }\n }\n\n .govuk-header__logotype {\n display: inline-block;\n position: relative;\n top: -3px;\n\n // Add a gap after the logo in case it's followed by a product name. This\n // gets removed later if the logotype is a :last-child.\n margin-right: govuk-spacing(1);\n fill: currentcolor;\n vertical-align: top;\n\n // Prevent readability backplate from obscuring underline in Windows High\n // Contrast Mode\n @media (forced-colors: active) {\n forced-color-adjust: none;\n color: linktext;\n }\n\n // Remove the gap after the logo if there's no product name to keep hover\n // and focus states neat\n &:last-child {\n margin-right: 0;\n }\n }\n\n .govuk-header__product-name {\n $product-name-offset: if($govuk-new-typography-scale, 7px, 10px);\n $product-name-offset-tablet: 5px;\n\n @include govuk-font-size($size: 24, $line-height: 1);\n @include govuk-typography-weight-regular;\n display: inline-table;\n\n // Maintain space below logo when wrapped\n margin-top: $product-name-offset;\n\n // Firefox places the GOV.UK logo one pixel higher, due to how it rounds\n // subpixels, so nudge the product name in FF to still be aligned.\n @-moz-document url-prefix() {\n margin-top: $product-name-offset - 0.5px;\n }\n\n // Align vertically with logo when not wrapped\n vertical-align: top;\n\n @include govuk-media-query($from: tablet) {\n margin-top: $product-name-offset-tablet;\n @-moz-document url-prefix() {\n margin-top: $product-name-offset-tablet - 0.5px;\n }\n }\n }\n\n .govuk-header__link {\n // Avoid using the `govuk-link-common` mixin because the links in the header\n // get a special treatment, because:\n //\n // - underlines are only visible on hover\n // - all links get a 3px underline regardless of text size, as there are\n // multiple grouped elements close to one another and having slightly\n // different underline widths looks unbalanced\n @include govuk-link-style-inverse;\n\n text-decoration: none;\n\n &:hover {\n text-decoration: underline;\n text-decoration-thickness: $govuk-header-link-underline-thickness;\n\n @if $govuk-link-underline-offset {\n text-underline-offset: $govuk-link-underline-offset;\n }\n }\n\n &:focus {\n @include govuk-focused-text;\n }\n }\n\n .govuk-header__link--homepage {\n // Font size needs to be set on the link so that the box sizing is correct\n // in Firefox\n display: inline-block;\n margin-right: govuk-spacing(2);\n font-size: 30px; // We don't have a mixin that produces 30px font size\n\n @include govuk-media-query($from: desktop) {\n display: inline;\n\n &:focus {\n // Replicate the focus box shadow but without the -2px y-offset of the first yellow shadow\n // This is to stop the logo getting cut off by the box shadow when focused on above a product name\n box-shadow: 0 0 $govuk-focus-colour;\n }\n }\n\n &:link,\n &:visited {\n text-decoration: none;\n }\n\n &:hover,\n &:active {\n // Negate the added border\n margin-bottom: $govuk-header-link-underline-thickness * -1;\n border-bottom: $govuk-header-link-underline-thickness solid;\n }\n\n // Remove any borders that show when focused and hovered.\n &:focus {\n margin-bottom: 0;\n border-bottom: 0;\n }\n }\n\n .govuk-header__service-name {\n display: inline-block;\n margin-bottom: govuk-spacing(2);\n @include govuk-font-size($size: 24);\n @include govuk-typography-weight-bold;\n }\n\n .govuk-header__logo,\n .govuk-header__content {\n box-sizing: border-box;\n }\n\n .govuk-header__logo {\n @include govuk-responsive-margin($govuk-header-vertical-spacing-value, \"bottom\");\n // Protect the absolute positioned menu button from overlapping with the\n // logo with right padding using the button's width\n padding-right: $govuk-header-menu-button-width;\n\n @include govuk-media-query($from: desktop) {\n width: 33.33%;\n padding-right: $govuk-gutter-half;\n float: left;\n vertical-align: top;\n\n // Reset float when logo is the last child, without a navigation\n &:last-child {\n width: auto;\n padding-right: 0;\n float: none;\n }\n }\n }\n\n .govuk-header__content {\n @include govuk-media-query($from: desktop) {\n width: 66.66%;\n padding-left: $govuk-gutter-half;\n float: left;\n }\n }\n\n .govuk-header__menu-button {\n @include govuk-font($size: 16);\n position: absolute;\n // calculate top offset by:\n // - getting the vertical spacing for the top and the bottom of the header\n // - adding that to the crown height\n // - dividing it by 2 so you have the vertical centre of the header\n // - subtracting half the height of the menu button\n top: (((govuk-spacing($govuk-header-vertical-spacing-value) * 2) + $govuk-header-crown-height) / 2) -\n ($govuk-header-menu-button-height / 2);\n right: 0;\n max-width: $govuk-header-menu-button-width;\n min-height: $govuk-header-menu-button-height;\n margin: 0;\n padding: 0;\n border: 0;\n color: govuk-colour(\"white\");\n background: none;\n word-break: break-all;\n cursor: pointer;\n\n &:hover {\n text-decoration: solid underline $govuk-header-link-underline-thickness;\n\n @if $govuk-link-underline-offset {\n text-underline-offset: $govuk-link-underline-offset;\n }\n }\n\n &:focus {\n @include govuk-focused-text;\n }\n\n &::after {\n @include govuk-shape-arrow($direction: down, $base: 10px, $display: inline-block);\n content: \"\";\n margin-left: govuk-spacing(1);\n }\n\n &[aria-expanded=\"true\"]::after {\n @include govuk-shape-arrow($direction: up, $base: 10px, $display: inline-block);\n }\n\n @include govuk-media-query($from: tablet) {\n top: govuk-spacing(3);\n }\n\n .govuk-frontend-supported & {\n display: block;\n }\n\n &[hidden],\n .govuk-frontend-supported &[hidden] {\n display: none;\n }\n }\n\n .govuk-header__navigation {\n @include govuk-media-query($from: desktop) {\n margin-bottom: govuk-spacing(2);\n }\n }\n\n .govuk-header__navigation-list {\n // Reset user-agent default list styles\n margin: 0;\n padding: 0;\n list-style: none;\n\n &[hidden] {\n display: none;\n }\n }\n\n .govuk-header__navigation--end {\n @include govuk-media-query($from: desktop) {\n margin: 0;\n padding: govuk-spacing(1) 0;\n text-align: right;\n }\n }\n\n .govuk-header__navigation-item {\n padding: govuk-spacing(2) 0;\n border-bottom: 1px solid $govuk-header-nav-item-border-color;\n\n @include govuk-media-query($from: desktop) {\n display: inline-block;\n margin-right: govuk-spacing(3);\n padding: govuk-spacing(1) 0;\n border: 0;\n }\n\n a {\n @include govuk-font-size($size: 16);\n @include govuk-typography-weight-bold;\n white-space: nowrap;\n }\n }\n\n .govuk-header__navigation-item--active {\n a {\n &:link,\n &:hover,\n &:visited {\n color: $govuk-header-link-active;\n }\n\n // When printing, use the normal blue as this contrasts better with the\n // white printing header\n @include govuk-media-query($media-type: print) {\n color: $govuk-brand-colour;\n }\n\n // When focussed, the text colour needs to be darker to ensure that colour\n // contrast is still acceptable\n &:focus {\n color: $govuk-focus-text-colour;\n }\n }\n }\n\n .govuk-header__navigation-item:last-child {\n margin-right: 0;\n border-bottom: 0;\n }\n\n @include govuk-media-query($media-type: print) {\n .govuk-header {\n border-bottom-width: 0;\n color: govuk-colour(\"black\");\n background: transparent;\n }\n\n .govuk-header__link {\n &:link,\n &:visited {\n color: govuk-colour(\"black\");\n }\n\n // Do not append link href to GOV.UK link when printing (e.g. '(/)')\n &::after {\n display: none;\n }\n }\n }\n}\n"]}
1
+ {"version":3,"sources":["../../../../src/govuk/components/header/_index.scss"],"names":[],"mappings":"AAAA;EACE,+CAA+C;EAC/C,+CAA+C;EAC/C,4CAA4C;EAC5C,yCAAyC;EACzC,kCAAkC;EAClC,4CAA4C;EAC5C,2CAA2C;EAC3C,uCAAuC;EACvC,8EAA8E;EAC9E,kFAAkF;EAClF,gCAAgC;EACh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4DAA4D;;IAE5D;MACE,qBAAqB;MACrB,8BAA8B;MAC9B,2BAA2B;MAC3B,SAAS;IACX;;IAEA;MACE,mCAAmC;MACnC,qCAAqC;MACrC,mBAAmB;IACrB;EACF;;EAEA;IACE;MACE;;;QAGE,gCAAgC;MAClC;;MAEA,sEAAsE;MACtE,uBAAuB;MACvB;QACE,0BAA0B;MAC5B;;MAEA,yEAAyE;MACzE,8BAA8B;MAC9B;QACE,+BAA+B;MACjC;IACF;EACF;;EAEA;IACE,eAAe;IACf,gBAAgB;EAClB;;EAEA;IACE;MACE,sBAAsB;MACtB,4BAA4B;MAC5B,uBAAuB;IACzB;;IAEA;MACE;;QAEE,4BAA4B;MAC9B;;MAEA,mEAAmE;MACnE;QACE,aAAa;MACf;IACF;EACF;AACF","file":"_index.scss","sourcesContent":["@include govuk-exports(\"govuk/component/header\") {\n $govuk-header-background: govuk-colour(\"black\");\n $govuk-header-border-color: $govuk-brand-colour;\n $govuk-header-border-width: govuk-spacing(2);\n $govuk-header-text: govuk-colour(\"white\");\n $govuk-header-link-active: #1d8feb;\n $govuk-header-nav-item-border-color: #2e3133;\n $govuk-header-link-underline-thickness: 3px;\n $govuk-header-vertical-spacing-value: 2;\n // This crown height is only used to calculate top offset of mobile menu button\n // as the crown svg height is the only thing that controls the height of the header\n $govuk-header-crown-height: 30px;\n $govuk-header-menu-button-height: 24px;\n $govuk-header-menu-button-width: 80px;\n\n .govuk-header {\n @include govuk-font($size: 16, $line-height: 1);\n\n border-bottom: govuk-spacing(2) solid govuk-colour(\"white\");\n color: $govuk-header-text;\n background: $govuk-header-background;\n }\n\n .govuk-header__container--full-width {\n padding: 0 govuk-spacing(3);\n border-color: $govuk-header-border-color;\n\n .govuk-header__menu-button {\n right: govuk-spacing(3);\n }\n }\n\n .govuk-header__container {\n @include govuk-clearfix;\n position: relative;\n margin-bottom: -$govuk-header-border-width;\n padding-top: govuk-spacing($govuk-header-vertical-spacing-value);\n border-bottom: $govuk-header-border-width solid $govuk-header-border-color;\n }\n\n .govuk-header--full-width-border {\n border-bottom-color: $govuk-header-border-color;\n\n .govuk-header__container {\n border-bottom-color: transparent;\n }\n }\n\n .govuk-header__logotype {\n display: inline-block;\n position: relative;\n top: -3px;\n\n // Add a gap after the logo in case it's followed by a product name. This\n // gets removed later if the logotype is a :last-child.\n margin-right: govuk-spacing(1);\n fill: currentcolor;\n vertical-align: top;\n\n // Prevent readability backplate from obscuring underline in Windows High\n // Contrast Mode\n @media (forced-colors: active) {\n forced-color-adjust: none;\n color: linktext;\n }\n\n // Remove the gap after the logo if there's no product name to keep hover\n // and focus states neat\n &:last-child {\n margin-right: 0;\n }\n }\n\n .govuk-header__product-name {\n $product-name-offset: if($govuk-new-typography-scale, 7px, 10px);\n $product-name-offset-tablet: 5px;\n\n @include govuk-font-size($size: 24, $line-height: 1);\n @include govuk-typography-weight-regular;\n display: inline-table;\n\n // Maintain space below logo when wrapped\n margin-top: $product-name-offset;\n\n // Firefox places the GOV.UK logo one pixel higher, due to how it rounds\n // subpixels, so nudge the product name in FF to still be aligned.\n @-moz-document url-prefix() {\n margin-top: $product-name-offset - 0.5px;\n }\n\n // Align vertically with logo when not wrapped\n vertical-align: top;\n\n @include govuk-media-query($from: tablet) {\n margin-top: $product-name-offset-tablet;\n @-moz-document url-prefix() {\n margin-top: $product-name-offset-tablet - 0.5px;\n }\n }\n }\n\n .govuk-header__link {\n // Avoid using the `govuk-link-common` mixin because the links in the header\n // get a special treatment, because:\n //\n // - underlines are only visible on hover\n // - all links get a 3px underline regardless of text size, as there are\n // multiple grouped elements close to one another and having slightly\n // different underline widths looks unbalanced\n @include govuk-link-style-inverse;\n\n text-decoration: none;\n\n &:hover {\n text-decoration: underline;\n text-decoration-thickness: $govuk-header-link-underline-thickness;\n\n @if $govuk-link-underline-offset {\n text-underline-offset: $govuk-link-underline-offset;\n }\n }\n\n &:focus {\n @include govuk-focused-text;\n }\n }\n\n .govuk-header__link--homepage {\n // Font size needs to be set on the link so that the box sizing is correct\n // in Firefox\n display: inline-block;\n margin-right: govuk-spacing(2);\n font-size: 30px; // We don't have a mixin that produces 30px font size\n\n @include govuk-media-query($from: desktop) {\n display: inline;\n\n &:focus {\n // Replicate the focus box shadow but without the -2px y-offset of the first yellow shadow\n // This is to stop the logo getting cut off by the box shadow when focused on above a product name\n box-shadow: 0 0 $govuk-focus-colour;\n }\n }\n\n &:link,\n &:visited {\n text-decoration: none;\n }\n\n &:hover,\n &:active {\n // Negate the added border\n margin-bottom: $govuk-header-link-underline-thickness * -1;\n border-bottom: $govuk-header-link-underline-thickness solid;\n }\n\n // Remove any borders that show when focused and hovered.\n &:focus {\n margin-bottom: 0;\n border-bottom: 0;\n }\n }\n\n .govuk-header__service-name {\n display: inline-block;\n margin-bottom: govuk-spacing(2);\n @include govuk-font-size($size: 24);\n @include govuk-typography-weight-bold;\n }\n\n .govuk-header__logo,\n .govuk-header__content {\n box-sizing: border-box;\n }\n\n .govuk-header__logo {\n @include govuk-responsive-margin($govuk-header-vertical-spacing-value, \"bottom\");\n // Protect the absolute positioned menu button from overlapping with the\n // logo with right padding using the button's width\n padding-right: $govuk-header-menu-button-width;\n\n @include govuk-media-query($from: desktop) {\n width: 33.33%;\n padding-right: $govuk-gutter-half;\n float: left;\n vertical-align: top;\n\n // Reset float when logo is the last child, without a navigation\n &:last-child {\n width: auto;\n padding-right: 0;\n float: none;\n }\n }\n }\n\n .govuk-header__content {\n @include govuk-media-query($from: desktop) {\n width: 66.66%;\n padding-left: $govuk-gutter-half;\n float: left;\n }\n }\n\n .govuk-header__menu-button {\n @include govuk-font($size: 16);\n max-width: $govuk-header-menu-button-width;\n min-height: $govuk-header-menu-button-height;\n margin-bottom: govuk-spacing(1);\n padding: 0;\n border: 0;\n color: govuk-colour(\"white\");\n background: none;\n word-break: break-all;\n cursor: pointer;\n\n &:hover {\n text-decoration: solid underline $govuk-header-link-underline-thickness;\n\n @if $govuk-link-underline-offset {\n text-underline-offset: $govuk-link-underline-offset;\n }\n }\n\n &:focus {\n @include govuk-focused-text;\n }\n\n &::after {\n @include govuk-shape-arrow($direction: down, $base: 10px, $display: inline-block);\n content: \"\";\n margin-left: govuk-spacing(1);\n }\n\n &[aria-expanded=\"true\"]::after {\n @include govuk-shape-arrow($direction: up, $base: 10px, $display: inline-block);\n }\n\n @include govuk-media-query($from: mobile) {\n position: absolute;\n // calculate top offset by:\n // - getting the vertical spacing for the top and the bottom of the header\n // - adding that to the crown height\n // - dividing it by 2 so you have the vertical centre of the header\n // - subtracting half the height of the menu button\n top: (((govuk-spacing($govuk-header-vertical-spacing-value) * 2) + $govuk-header-crown-height) / 2) -\n ($govuk-header-menu-button-height / 2);\n right: 0;\n margin: 0;\n }\n\n @include govuk-media-query($from: tablet) {\n top: govuk-spacing(3);\n }\n\n .govuk-frontend-supported & {\n display: block;\n }\n\n &[hidden],\n .govuk-frontend-supported &[hidden] {\n display: none;\n }\n }\n\n .govuk-header__navigation {\n @include govuk-media-query($from: desktop) {\n margin-bottom: govuk-spacing(2);\n }\n }\n\n .govuk-header__navigation-list {\n // Reset user-agent default list styles\n margin: 0;\n padding: 0;\n list-style: none;\n\n &[hidden] {\n display: none;\n }\n }\n\n .govuk-header__navigation--end {\n @include govuk-media-query($from: desktop) {\n margin: 0;\n padding: govuk-spacing(1) 0;\n text-align: right;\n }\n }\n\n .govuk-header__navigation-item {\n padding: govuk-spacing(2) 0;\n border-bottom: 1px solid $govuk-header-nav-item-border-color;\n\n @include govuk-media-query($from: desktop) {\n display: inline-block;\n margin-right: govuk-spacing(3);\n padding: govuk-spacing(1) 0;\n border: 0;\n }\n\n a {\n @include govuk-font-size($size: 16);\n @include govuk-typography-weight-bold;\n white-space: nowrap;\n }\n }\n\n .govuk-header__navigation-item--active {\n a {\n &:link,\n &:hover,\n &:visited {\n color: $govuk-header-link-active;\n }\n\n // When printing, use the normal blue as this contrasts better with the\n // white printing header\n @include govuk-media-query($media-type: print) {\n color: $govuk-brand-colour;\n }\n\n // When focussed, the text colour needs to be darker to ensure that colour\n // contrast is still acceptable\n &:focus {\n color: $govuk-focus-text-colour;\n }\n }\n }\n\n .govuk-header__navigation-item:last-child {\n margin-right: 0;\n border-bottom: 0;\n }\n\n @include govuk-media-query($media-type: print) {\n .govuk-header {\n border-bottom-width: 0;\n color: govuk-colour(\"black\");\n background: transparent;\n }\n\n .govuk-header__link {\n &:link,\n &:visited {\n color: govuk-colour(\"black\");\n }\n\n // Do not append link href to GOV.UK link when printing (e.g. '(/)')\n &::after {\n display: none;\n }\n }\n }\n}\n"]}
@@ -38,6 +38,9 @@
38
38
  * @typedef ComponentWithModuleName
39
39
  * @property {string} moduleName - Name of the component
40
40
  */
41
+ /**
42
+ * @import { ObjectNested } from './configuration.mjs'
43
+ */
41
44
 
42
45
  class GOVUKFrontendError extends Error {
43
46
  constructor(...args) {
@@ -83,10 +86,10 @@
83
86
  }
84
87
  }
85
88
  /**
86
- * @typedef {import('../common/index.mjs').ComponentWithModuleName} ComponentWithModuleName
89
+ * @import { ComponentWithModuleName } from '../common/index.mjs'
87
90
  */
88
91
 
89
- class GOVUKFrontendComponent {
92
+ class Component {
90
93
  /**
91
94
  * Returns the root element of the component
92
95
  *
@@ -137,16 +140,16 @@
137
140
  */
138
141
 
139
142
  /**
140
- * @typedef {typeof GOVUKFrontendComponent & ChildClass} ChildClassConstructor
143
+ * @typedef {typeof Component & ChildClass} ChildClassConstructor
141
144
  */
142
- GOVUKFrontendComponent.elementType = HTMLElement;
145
+ Component.elementType = HTMLElement;
143
146
 
144
147
  /**
145
148
  * Header component
146
149
  *
147
150
  * @preserve
148
151
  */
149
- class Header extends GOVUKFrontendComponent {
152
+ class Header extends Component {
150
153
  /**
151
154
  * Apply a matchMedia for desktop which will trigger a state sync if the
152
155
  * browser viewport moves between states.
@@ -1 +1 @@
1
- {"version":3,"file":"header.bundle.js","sources":["../../../../src/govuk/common/index.mjs","../../../../src/govuk/errors/index.mjs","../../../../src/govuk/govuk-frontend-component.mjs","../../../../src/govuk/components/header/header.mjs"],"sourcesContent":["/**\n * Common helpers which do not require polyfill.\n *\n * IMPORTANT: If a helper require a polyfill, please isolate it in its own module\n * so that the polyfill can be properly tree-shaken and does not burden\n * the components that do not need that helper\n */\n\n/**\n * Get hash fragment from URL\n *\n * Extract the hash fragment (everything after the hash) from a URL,\n * but not including the hash symbol\n *\n * @private\n * @param {string} url - URL\n * @returns {string | undefined} Fragment from URL, without the hash\n */\nexport function getFragmentFromUrl(url) {\n if (!url.includes('#')) {\n return undefined\n }\n\n return url.split('#').pop()\n}\n\n/**\n * Get GOV.UK Frontend breakpoint value from CSS custom property\n *\n * @private\n * @param {string} name - Breakpoint name\n * @returns {{ property: string, value?: string }} Breakpoint object\n */\nexport function getBreakpoint(name) {\n const property = `--govuk-frontend-breakpoint-${name}`\n\n // Get value from `<html>` with breakpoints on CSS :root\n const value = window\n .getComputedStyle(document.documentElement)\n .getPropertyValue(property)\n\n return {\n property,\n value: value || undefined\n }\n}\n\n/**\n * Move focus to element\n *\n * Sets tabindex to -1 to make the element programmatically focusable,\n * but removes it on blur as the element doesn't need to be focused again.\n *\n * @private\n * @template {HTMLElement} FocusElement\n * @param {FocusElement} $element - HTML element\n * @param {object} [options] - Handler options\n * @param {function(this: FocusElement): void} [options.onBeforeFocus] - Callback before focus\n * @param {function(this: FocusElement): void} [options.onBlur] - Callback on blur\n */\nexport function setFocus($element, options = {}) {\n const isFocusable = $element.getAttribute('tabindex')\n\n if (!isFocusable) {\n $element.setAttribute('tabindex', '-1')\n }\n\n /**\n * Handle element focus\n */\n function onFocus() {\n $element.addEventListener('blur', onBlur, { once: true })\n }\n\n /**\n * Handle element blur\n */\n function onBlur() {\n options.onBlur?.call($element)\n\n if (!isFocusable) {\n $element.removeAttribute('tabindex')\n }\n }\n\n // Add listener to reset element on blur, after focus\n $element.addEventListener('focus', onFocus, { once: true })\n\n // Focus element\n options.onBeforeFocus?.call($element)\n $element.focus()\n}\n\n/**\n * Checks if component is already initialised\n *\n * @internal\n * @param {Element} $root - HTML element to be checked\n * @param {string} moduleName - name of component module\n * @returns {boolean} Whether component is already initialised\n */\nexport function isInitialised($root, moduleName) {\n return (\n $root instanceof HTMLElement &&\n $root.hasAttribute(`data-${moduleName}-init`)\n )\n}\n\n/**\n * Checks if GOV.UK Frontend is supported on this page\n *\n * Some browsers will load and run our JavaScript but GOV.UK Frontend\n * won't be supported.\n *\n * @param {HTMLElement | null} [$scope] - (internal) `<body>` HTML element checked for browser support\n * @returns {boolean} Whether GOV.UK Frontend is supported on this page\n */\nexport function isSupported($scope = document.body) {\n if (!$scope) {\n return false\n }\n\n return $scope.classList.contains('govuk-frontend-supported')\n}\n\n/**\n * Check for an array\n *\n * @internal\n * @param {unknown} option - Option to check\n * @returns {boolean} Whether the option is an array\n */\nfunction isArray(option) {\n return Array.isArray(option)\n}\n\n/**\n * Check for an object\n *\n * @internal\n * @param {unknown} option - Option to check\n * @returns {boolean} Whether the option is an object\n */\nexport function isObject(option) {\n return !!option && typeof option === 'object' && !isArray(option)\n}\n\n/**\n * Format error message\n *\n * @internal\n * @param {ComponentWithModuleName} Component - Component that threw the error\n * @param {string} message - Error message\n * @returns {string} - Formatted error message\n */\nexport function formatErrorMessage(Component, message) {\n return `${Component.moduleName}: ${message}`\n}\n\n/* eslint-disable jsdoc/valid-types --\n * `{new(...args: any[] ): object}` is not recognised as valid\n * https://github.com/gajus/eslint-plugin-jsdoc/issues/145#issuecomment-1308722878\n * https://github.com/jsdoc-type-pratt-parser/jsdoc-type-pratt-parser/issues/131\n **/\n\n/**\n * @typedef ComponentWithModuleName\n * @property {string} moduleName - Name of the component\n */\n\n/* eslint-enable jsdoc/valid-types */\n","import { formatErrorMessage } from '../common/index.mjs'\n\n/**\n * GOV.UK Frontend error\n *\n * A base class for `Error`s thrown by GOV.UK Frontend.\n *\n * It is meant to be extended into specific types of errors\n * to be thrown by our code.\n *\n * @example\n * ```js\n * class MissingRootError extends GOVUKFrontendError {\n * // Setting an explicit name is important as extending the class will not\n * // set a new `name` on the subclass. The `name` property is important\n * // to ensure intelligible error names even if the class name gets\n * // mangled by a minifier\n * name = \"MissingRootError\"\n * }\n * ```\n * @virtual\n */\nexport class GOVUKFrontendError extends Error {\n name = 'GOVUKFrontendError'\n}\n\n/**\n * Indicates that GOV.UK Frontend is not supported\n */\nexport class SupportError extends GOVUKFrontendError {\n name = 'SupportError'\n\n /**\n * Checks if GOV.UK Frontend is supported on this page\n *\n * @param {HTMLElement | null} [$scope] - HTML element `<body>` checked for browser support\n */\n constructor($scope = document.body) {\n const supportMessage =\n 'noModule' in HTMLScriptElement.prototype\n ? 'GOV.UK Frontend initialised without `<body class=\"govuk-frontend-supported\">` from template `<script>` snippet'\n : 'GOV.UK Frontend is not supported in this browser'\n\n super(\n $scope\n ? supportMessage\n : 'GOV.UK Frontend initialised without `<script type=\"module\">`'\n )\n }\n}\n\n/**\n * Indicates that a component has received an illegal configuration\n */\nexport class ConfigError extends GOVUKFrontendError {\n name = 'ConfigError'\n}\n\n/**\n * Indicates an issue with an element (possibly `null` or `undefined`)\n */\nexport class ElementError extends GOVUKFrontendError {\n name = 'ElementError'\n\n /**\n * @internal\n * @overload\n * @param {string} message - Element error message\n */\n\n /**\n * @internal\n * @overload\n * @param {ElementErrorOptions} options - Element error options\n */\n\n /**\n * @internal\n * @param {string | ElementErrorOptions} messageOrOptions - Element error message or options\n */\n constructor(messageOrOptions) {\n let message = typeof messageOrOptions === 'string' ? messageOrOptions : ''\n\n // Build message from options\n if (typeof messageOrOptions === 'object') {\n const { component, identifier, element, expectedType } = messageOrOptions\n\n message = identifier\n\n // Append reason\n message += element\n ? ` is not of type ${expectedType ?? 'HTMLElement'}`\n : ' not found'\n\n message = formatErrorMessage(component, message)\n }\n\n super(message)\n }\n}\n\n/**\n * Indicates that a component is already initialised\n */\nexport class InitError extends GOVUKFrontendError {\n name = 'InitError'\n\n /**\n * @internal\n * @param {ComponentWithModuleName | string} componentOrMessage - name of the component module\n */\n constructor(componentOrMessage) {\n const message =\n typeof componentOrMessage === 'string'\n ? componentOrMessage\n : formatErrorMessage(\n componentOrMessage,\n `Root element (\\`$root\\`) already initialised`\n )\n\n super(message)\n }\n}\n\n/**\n * Element error options\n *\n * @internal\n * @typedef {object} ElementErrorOptions\n * @property {string} identifier - An identifier that'll let the user understand which element has an error. This is whatever makes the most sense\n * @property {Element | null} [element] - The element in error\n * @property {string} [expectedType] - The type that was expected for the identifier\n * @property {ComponentWithModuleName} component - Component throwing the error\n */\n\n/**\n * @typedef {import('../common/index.mjs').ComponentWithModuleName} ComponentWithModuleName\n */\n","import { isInitialised, isSupported } from './common/index.mjs'\nimport { ElementError, InitError, SupportError } from './errors/index.mjs'\n\n/**\n * Base Component class\n *\n * Centralises the behaviours shared by our components\n *\n * @virtual\n * @template {Element} [RootElementType=HTMLElement]\n */\nexport class GOVUKFrontendComponent {\n /**\n * @type {typeof Element}\n */\n static elementType = HTMLElement\n\n // allows Typescript user to work around the lack of types\n // in GOVUKFrontend package, Typescript is not aware of $root\n // in components that extend GOVUKFrontendComponent\n /**\n * Returns the root element of the component\n *\n * @protected\n * @returns {RootElementType} - the root element of component\n */\n get $root() {\n return this._$root\n }\n\n /**\n * @protected\n * @type {RootElementType}\n */\n _$root\n\n /**\n * Constructs a new component, validating that GOV.UK Frontend is supported\n *\n * @internal\n * @param {Element | null} [$root] - HTML element to use for component\n */\n constructor($root) {\n const childConstructor = /** @type {ChildClassConstructor} */ (\n this.constructor\n )\n\n // TypeScript does not enforce that inheriting classes will define a `moduleName`\n // (even if we add a `@virtual` `static moduleName` property to this class).\n // While we trust users to do this correctly, we do a little check to provide them\n // a helpful error message.\n //\n // After this, we'll be sure that `childConstructor` has a `moduleName`\n // as expected of the `ChildClassConstructor` we've cast `this.constructor` to.\n if (typeof childConstructor.moduleName !== 'string') {\n throw new InitError(`\\`moduleName\\` not defined in component`)\n }\n\n if (!($root instanceof childConstructor.elementType)) {\n throw new ElementError({\n element: $root,\n component: childConstructor,\n identifier: 'Root element (`$root`)',\n expectedType: childConstructor.elementType.name\n })\n } else {\n this._$root = /** @type {RootElementType} */ ($root)\n }\n\n childConstructor.checkSupport()\n\n this.checkInitialised()\n\n const moduleName = childConstructor.moduleName\n\n this.$root.setAttribute(`data-${moduleName}-init`, '')\n }\n\n /**\n * Validates whether component is already initialised\n *\n * @private\n * @throws {InitError} when component is already initialised\n */\n checkInitialised() {\n const constructor = /** @type {ChildClassConstructor} */ (this.constructor)\n const moduleName = constructor.moduleName\n\n if (moduleName && isInitialised(this.$root, moduleName)) {\n throw new InitError(constructor)\n }\n }\n\n /**\n * Validates whether components are supported\n *\n * @throws {SupportError} when the components are not supported\n */\n static checkSupport() {\n if (!isSupported()) {\n throw new SupportError()\n }\n }\n}\n\n/**\n * @typedef ChildClass\n * @property {string} moduleName - The module name that'll be looked for in the DOM when initialising the component\n */\n\n/**\n * @typedef {typeof GOVUKFrontendComponent & ChildClass} ChildClassConstructor\n */\n","import { getBreakpoint } from '../../common/index.mjs'\nimport { ElementError } from '../../errors/index.mjs'\nimport { GOVUKFrontendComponent } from '../../govuk-frontend-component.mjs'\n\n/**\n * Header component\n *\n * @preserve\n */\nexport class Header extends GOVUKFrontendComponent {\n /** @private */\n $menuButton\n\n /** @private */\n $menu\n\n /**\n * Save the opened/closed state for the nav in memory so that we can\n * accurately maintain state when the screen is changed from small to big and\n * back to small\n *\n * @private\n */\n menuIsOpen = false\n\n /**\n * A global const for storing a matchMedia instance which we'll use to detect\n * when a screen size change happens. We rely on it being null if the feature\n * isn't available to initially apply hidden attributes\n *\n * @private\n * @type {MediaQueryList | null}\n */\n mql = null\n\n /**\n * Apply a matchMedia for desktop which will trigger a state sync if the\n * browser viewport moves between states.\n *\n * @param {Element | null} $root - HTML element to use for header\n */\n constructor($root) {\n super($root)\n\n const $menuButton = this.$root.querySelector('.govuk-js-header-toggle')\n\n // Headers don't necessarily have a navigation. When they don't, the menu\n // toggle won't be rendered by our macro (or may be omitted when writing\n // plain HTML)\n if (!$menuButton) {\n return this\n }\n\n const menuId = $menuButton.getAttribute('aria-controls')\n if (!menuId) {\n throw new ElementError({\n component: Header,\n identifier:\n 'Navigation button (`<button class=\"govuk-js-header-toggle\">`) attribute (`aria-controls`)'\n })\n }\n\n const $menu = document.getElementById(menuId)\n if (!$menu) {\n throw new ElementError({\n component: Header,\n element: $menu,\n identifier: `Navigation (\\`<ul id=\"${menuId}\">\\`)`\n })\n }\n\n this.$menu = $menu\n this.$menuButton = $menuButton\n\n this.setupResponsiveChecks()\n\n this.$menuButton.addEventListener('click', () =>\n this.handleMenuButtonClick()\n )\n }\n\n /**\n * Setup viewport resize check\n *\n * @private\n */\n setupResponsiveChecks() {\n const breakpoint = getBreakpoint('desktop')\n\n if (!breakpoint.value) {\n throw new ElementError({\n component: Header,\n identifier: `CSS custom property (\\`${breakpoint.property}\\`) on pseudo-class \\`:root\\``\n })\n }\n\n // Media query list for GOV.UK Frontend desktop breakpoint\n this.mql = window.matchMedia(`(min-width: ${breakpoint.value})`)\n\n // MediaQueryList.addEventListener isn't supported by Safari < 14 so we need\n // to be able to fall back to the deprecated MediaQueryList.addListener\n if ('addEventListener' in this.mql) {\n this.mql.addEventListener('change', () => this.checkMode())\n } else {\n // @ts-expect-error Property 'addListener' does not exist\n // eslint-disable-next-line @typescript-eslint/no-unsafe-call\n this.mql.addListener(() => this.checkMode())\n }\n\n this.checkMode()\n }\n\n /**\n * Sync menu state\n *\n * Uses the global variable menuIsOpen to correctly set the accessible and\n * visual states of the menu and the menu button.\n * Additionally will force the menu to be visible and the menu button to be\n * hidden if the matchMedia is triggered to desktop.\n *\n * @private\n */\n checkMode() {\n if (!this.mql || !this.$menu || !this.$menuButton) {\n return\n }\n\n if (this.mql.matches) {\n this.$menu.removeAttribute('hidden')\n this.$menuButton.setAttribute('hidden', '')\n } else {\n this.$menuButton.removeAttribute('hidden')\n this.$menuButton.setAttribute('aria-expanded', this.menuIsOpen.toString())\n\n if (this.menuIsOpen) {\n this.$menu.removeAttribute('hidden')\n } else {\n this.$menu.setAttribute('hidden', '')\n }\n }\n }\n\n /**\n * Handle menu button click\n *\n * When the menu button is clicked, change the visibility of the menu and then\n * sync the accessibility state and menu button state\n *\n * @private\n */\n handleMenuButtonClick() {\n this.menuIsOpen = !this.menuIsOpen\n this.checkMode()\n }\n\n /**\n * Name for the component used when initialising using data-module attributes.\n */\n static moduleName = 'govuk-header'\n}\n"],"names":["getBreakpoint","name","property","value","window","getComputedStyle","document","documentElement","getPropertyValue","undefined","isInitialised","$root","moduleName","HTMLElement","hasAttribute","isSupported","$scope","body","classList","contains","formatErrorMessage","Component","message","GOVUKFrontendError","Error","constructor","args","SupportError","supportMessage","HTMLScriptElement","prototype","ElementError","messageOrOptions","component","identifier","element","expectedType","InitError","componentOrMessage","GOVUKFrontendComponent","_$root","childConstructor","elementType","checkSupport","checkInitialised","setAttribute","Header","$menuButton","$menu","menuIsOpen","mql","querySelector","menuId","getAttribute","getElementById","setupResponsiveChecks","addEventListener","handleMenuButtonClick","breakpoint","matchMedia","checkMode","addListener","matches","removeAttribute","toString"],"mappings":";;;;;;EAiCO,SAASA,aAAaA,CAACC,IAAI,EAAE;EAClC,EAAA,MAAMC,QAAQ,GAAG,CAA+BD,4BAAAA,EAAAA,IAAI,CAAE,CAAA,CAAA;EAGtD,EAAA,MAAME,KAAK,GAAGC,MAAM,CACjBC,gBAAgB,CAACC,QAAQ,CAACC,eAAe,CAAC,CAC1CC,gBAAgB,CAACN,QAAQ,CAAC,CAAA;IAE7B,OAAO;MACLA,QAAQ;MACRC,KAAK,EAAEA,KAAK,IAAIM,SAAAA;KACjB,CAAA;EACH,CAAA;EAwDO,SAASC,aAAaA,CAACC,KAAK,EAAEC,UAAU,EAAE;IAC/C,OACED,KAAK,YAAYE,WAAW,IAC5BF,KAAK,CAACG,YAAY,CAAC,CAAA,KAAA,EAAQF,UAAU,CAAA,KAAA,CAAO,CAAC,CAAA;EAEjD,CAAA;;EAEA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACO,SAASG,WAAWA,CAACC,MAAM,GA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A,IAAI,CAAChB,WAAW,CAACF,YAAY,CAAC,eAAe,EAAE,IAAI,CAACI,UAAU,CAACe,QAAQ,EAAE,CAAC,CAAA;QAE1E,IAAI,IAAI,CAACf,UAAU,EAAE;EACnB,QAAA,IAAI,CAACD,KAAK,CAACe,eAAe,CAAC,QAAQ,CAAC,CAAA;EACtC,OAAC,MAAM;UACL,IAAI,CAACf,KAAK,CAACH,YAAY,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAA;EACvC,OAAA;EACF,KAAA;EACF,GAAA;EAUAY,EAAAA,qBAAqBA,GAAG;EACtB,IAAA,IAAI,CAACR,UAAU,GAAG,CAAC,IAAI,CAACA,UAAU,CAAA;MAClC,IAAI,CAACW,SAAS,EAAE,CAAA;EAClB,GAAA;EAMF,CAAA;EAtJad,MAAM,CAqJVlC,UAAU,GAAG,cAAc;;;;;;;;"}
1
+ {"version":3,"file":"header.bundle.js","sources":["../../../../src/govuk/common/index.mjs","../../../../src/govuk/errors/index.mjs","../../../../src/govuk/component.mjs","../../../../src/govuk/components/header/header.mjs"],"sourcesContent":["/**\n * Common helpers which do not require polyfill.\n *\n * IMPORTANT: If a helper require a polyfill, please isolate it in its own module\n * so that the polyfill can be properly tree-shaken and does not burden\n * the components that do not need that helper\n */\n\n/**\n * Get hash fragment from URL\n *\n * Extract the hash fragment (everything after the hash) from a URL,\n * but not including the hash symbol\n *\n * @private\n * @param {string} url - URL\n * @returns {string | undefined} Fragment from URL, without the hash\n */\nexport function getFragmentFromUrl(url) {\n if (!url.includes('#')) {\n return undefined\n }\n\n return url.split('#').pop()\n}\n\n/**\n * Get GOV.UK Frontend breakpoint value from CSS custom property\n *\n * @private\n * @param {string} name - Breakpoint name\n * @returns {{ property: string, value?: string }} Breakpoint object\n */\nexport function getBreakpoint(name) {\n const property = `--govuk-frontend-breakpoint-${name}`\n\n // Get value from `<html>` with breakpoints on CSS :root\n const value = window\n .getComputedStyle(document.documentElement)\n .getPropertyValue(property)\n\n return {\n property,\n value: value || undefined\n }\n}\n\n/**\n * Move focus to element\n *\n * Sets tabindex to -1 to make the element programmatically focusable,\n * but removes it on blur as the element doesn't need to be focused again.\n *\n * @private\n * @template {HTMLElement} FocusElement\n * @param {FocusElement} $element - HTML element\n * @param {object} [options] - Handler options\n * @param {function(this: FocusElement): void} [options.onBeforeFocus] - Callback before focus\n * @param {function(this: FocusElement): void} [options.onBlur] - Callback on blur\n */\nexport function setFocus($element, options = {}) {\n const isFocusable = $element.getAttribute('tabindex')\n\n if (!isFocusable) {\n $element.setAttribute('tabindex', '-1')\n }\n\n /**\n * Handle element focus\n */\n function onFocus() {\n $element.addEventListener('blur', onBlur, { once: true })\n }\n\n /**\n * Handle element blur\n */\n function onBlur() {\n options.onBlur?.call($element)\n\n if (!isFocusable) {\n $element.removeAttribute('tabindex')\n }\n }\n\n // Add listener to reset element on blur, after focus\n $element.addEventListener('focus', onFocus, { once: true })\n\n // Focus element\n options.onBeforeFocus?.call($element)\n $element.focus()\n}\n\n/**\n * Checks if component is already initialised\n *\n * @internal\n * @param {Element} $root - HTML element to be checked\n * @param {string} moduleName - name of component module\n * @returns {boolean} Whether component is already initialised\n */\nexport function isInitialised($root, moduleName) {\n return (\n $root instanceof HTMLElement &&\n $root.hasAttribute(`data-${moduleName}-init`)\n )\n}\n\n/**\n * Checks if GOV.UK Frontend is supported on this page\n *\n * Some browsers will load and run our JavaScript but GOV.UK Frontend\n * won't be supported.\n *\n * @param {HTMLElement | null} [$scope] - (internal) `<body>` HTML element checked for browser support\n * @returns {boolean} Whether GOV.UK Frontend is supported on this page\n */\nexport function isSupported($scope = document.body) {\n if (!$scope) {\n return false\n }\n\n return $scope.classList.contains('govuk-frontend-supported')\n}\n\n/**\n * Check for an array\n *\n * @internal\n * @param {unknown} option - Option to check\n * @returns {boolean} Whether the option is an array\n */\nfunction isArray(option) {\n return Array.isArray(option)\n}\n\n/**\n * Check for an object\n *\n * @internal\n * @template {Partial<Record<keyof ObjectType, unknown>>} [ObjectType=ObjectNested]\n * @param {unknown | ObjectType} option - Option to check\n * @returns {option is ObjectType} Whether the option is an object\n */\nexport function isObject(option) {\n return !!option && typeof option === 'object' && !isArray(option)\n}\n\n/**\n * Format error message\n *\n * @internal\n * @param {ComponentWithModuleName} Component - Component that threw the error\n * @param {string} message - Error message\n * @returns {string} - Formatted error message\n */\nexport function formatErrorMessage(Component, message) {\n return `${Component.moduleName}: ${message}`\n}\n\n/* eslint-disable jsdoc/valid-types --\n * `{new(...args: any[] ): object}` is not recognised as valid\n * https://github.com/gajus/eslint-plugin-jsdoc/issues/145#issuecomment-1308722878\n * https://github.com/jsdoc-type-pratt-parser/jsdoc-type-pratt-parser/issues/131\n **/\n\n/**\n * @typedef ComponentWithModuleName\n * @property {string} moduleName - Name of the component\n */\n\n/* eslint-enable jsdoc/valid-types */\n\n/**\n * @import { ObjectNested } from './configuration.mjs'\n */\n","import { formatErrorMessage } from '../common/index.mjs'\n\n/**\n * GOV.UK Frontend error\n *\n * A base class for `Error`s thrown by GOV.UK Frontend.\n *\n * It is meant to be extended into specific types of errors\n * to be thrown by our code.\n *\n * @example\n * ```js\n * class MissingRootError extends GOVUKFrontendError {\n * // Setting an explicit name is important as extending the class will not\n * // set a new `name` on the subclass. The `name` property is important\n * // to ensure intelligible error names even if the class name gets\n * // mangled by a minifier\n * name = \"MissingRootError\"\n * }\n * ```\n * @virtual\n */\nexport class GOVUKFrontendError extends Error {\n name = 'GOVUKFrontendError'\n}\n\n/**\n * Indicates that GOV.UK Frontend is not supported\n */\nexport class SupportError extends GOVUKFrontendError {\n name = 'SupportError'\n\n /**\n * Checks if GOV.UK Frontend is supported on this page\n *\n * @param {HTMLElement | null} [$scope] - HTML element `<body>` checked for browser support\n */\n constructor($scope = document.body) {\n const supportMessage =\n 'noModule' in HTMLScriptElement.prototype\n ? 'GOV.UK Frontend initialised without `<body class=\"govuk-frontend-supported\">` from template `<script>` snippet'\n : 'GOV.UK Frontend is not supported in this browser'\n\n super(\n $scope\n ? supportMessage\n : 'GOV.UK Frontend initialised without `<script type=\"module\">`'\n )\n }\n}\n\n/**\n * Indicates that a component has received an illegal configuration\n */\nexport class ConfigError extends GOVUKFrontendError {\n name = 'ConfigError'\n}\n\n/**\n * Indicates an issue with an element (possibly `null` or `undefined`)\n */\nexport class ElementError extends GOVUKFrontendError {\n name = 'ElementError'\n\n /**\n * @internal\n * @overload\n * @param {string} message - Element error message\n */\n\n /**\n * @internal\n * @overload\n * @param {ElementErrorOptions} options - Element error options\n */\n\n /**\n * @internal\n * @param {string | ElementErrorOptions} messageOrOptions - Element error message or options\n */\n constructor(messageOrOptions) {\n let message = typeof messageOrOptions === 'string' ? messageOrOptions : ''\n\n // Build message from options\n if (typeof messageOrOptions === 'object') {\n const { component, identifier, element, expectedType } = messageOrOptions\n\n message = identifier\n\n // Append reason\n message += element\n ? ` is not of type ${expectedType ?? 'HTMLElement'}`\n : ' not found'\n\n message = formatErrorMessage(component, message)\n }\n\n super(message)\n }\n}\n\n/**\n * Indicates that a component is already initialised\n */\nexport class InitError extends GOVUKFrontendError {\n name = 'InitError'\n\n /**\n * @internal\n * @param {ComponentWithModuleName | string} componentOrMessage - name of the component module\n */\n constructor(componentOrMessage) {\n const message =\n typeof componentOrMessage === 'string'\n ? componentOrMessage\n : formatErrorMessage(\n componentOrMessage,\n `Root element (\\`$root\\`) already initialised`\n )\n\n super(message)\n }\n}\n\n/**\n * Element error options\n *\n * @internal\n * @typedef {object} ElementErrorOptions\n * @property {string} identifier - An identifier that'll let the user understand which element has an error. This is whatever makes the most sense\n * @property {Element | null} [element] - The element in error\n * @property {string} [expectedType] - The type that was expected for the identifier\n * @property {ComponentWithModuleName} component - Component throwing the error\n */\n\n/**\n * @import { ComponentWithModuleName } from '../common/index.mjs'\n */\n","import { isInitialised, isSupported } from './common/index.mjs'\nimport { ElementError, InitError, SupportError } from './errors/index.mjs'\n\n/**\n * Base Component class\n *\n * Centralises the behaviours shared by our components\n *\n * @virtual\n * @template {Element} [RootElementType=HTMLElement]\n */\nexport class Component {\n /**\n * @type {typeof Element}\n */\n static elementType = HTMLElement\n\n // allows Typescript user to work around the lack of types\n // in GOVUKFrontend package, Typescript is not aware of $root\n // in components that extend GOVUKFrontendComponent\n /**\n * Returns the root element of the component\n *\n * @protected\n * @returns {RootElementType} - the root element of component\n */\n get $root() {\n return this._$root\n }\n\n /**\n * @protected\n * @type {RootElementType}\n */\n _$root\n\n /**\n * Constructs a new component, validating that GOV.UK Frontend is supported\n *\n * @internal\n * @param {Element | null} [$root] - HTML element to use for component\n */\n constructor($root) {\n const childConstructor = /** @type {ChildClassConstructor} */ (\n this.constructor\n )\n\n // TypeScript does not enforce that inheriting classes will define a `moduleName`\n // (even if we add a `@virtual` `static moduleName` property to this class).\n // While we trust users to do this correctly, we do a little check to provide them\n // a helpful error message.\n //\n // After this, we'll be sure that `childConstructor` has a `moduleName`\n // as expected of the `ChildClassConstructor` we've cast `this.constructor` to.\n if (typeof childConstructor.moduleName !== 'string') {\n throw new InitError(`\\`moduleName\\` not defined in component`)\n }\n\n if (!($root instanceof childConstructor.elementType)) {\n throw new ElementError({\n element: $root,\n component: childConstructor,\n identifier: 'Root element (`$root`)',\n expectedType: childConstructor.elementType.name\n })\n } else {\n this._$root = /** @type {RootElementType} */ ($root)\n }\n\n childConstructor.checkSupport()\n\n this.checkInitialised()\n\n const moduleName = childConstructor.moduleName\n\n this.$root.setAttribute(`data-${moduleName}-init`, '')\n }\n\n /**\n * Validates whether component is already initialised\n *\n * @private\n * @throws {InitError} when component is already initialised\n */\n checkInitialised() {\n const constructor = /** @type {ChildClassConstructor} */ (this.constructor)\n const moduleName = constructor.moduleName\n\n if (moduleName && isInitialised(this.$root, moduleName)) {\n throw new InitError(constructor)\n }\n }\n\n /**\n * Validates whether components are supported\n *\n * @throws {SupportError} when the components are not supported\n */\n static checkSupport() {\n if (!isSupported()) {\n throw new SupportError()\n }\n }\n}\n\n/**\n * @typedef ChildClass\n * @property {string} moduleName - The module name that'll be looked for in the DOM when initialising the component\n */\n\n/**\n * @typedef {typeof Component & ChildClass} ChildClassConstructor\n */\n","import { getBreakpoint } from '../../common/index.mjs'\nimport { Component } from '../../component.mjs'\nimport { ElementError } from '../../errors/index.mjs'\n\n/**\n * Header component\n *\n * @preserve\n */\nexport class Header extends Component {\n /** @private */\n $menuButton\n\n /** @private */\n $menu\n\n /**\n * Save the opened/closed state for the nav in memory so that we can\n * accurately maintain state when the screen is changed from small to big and\n * back to small\n *\n * @private\n */\n menuIsOpen = false\n\n /**\n * A global const for storing a matchMedia instance which we'll use to detect\n * when a screen size change happens. We rely on it being null if the feature\n * isn't available to initially apply hidden attributes\n *\n * @private\n * @type {MediaQueryList | null}\n */\n mql = null\n\n /**\n * Apply a matchMedia for desktop which will trigger a state sync if the\n * browser viewport moves between states.\n *\n * @param {Element | null} $root - HTML element to use for header\n */\n constructor($root) {\n super($root)\n\n const $menuButton = this.$root.querySelector('.govuk-js-header-toggle')\n\n // Headers don't necessarily have a navigation. When they don't, the menu\n // toggle won't be rendered by our macro (or may be omitted when writing\n // plain HTML)\n if (!$menuButton) {\n return this\n }\n\n const menuId = $menuButton.getAttribute('aria-controls')\n if (!menuId) {\n throw new ElementError({\n component: Header,\n identifier:\n 'Navigation button (`<button class=\"govuk-js-header-toggle\">`) attribute (`aria-controls`)'\n })\n }\n\n const $menu = document.getElementById(menuId)\n if (!$menu) {\n throw new ElementError({\n component: Header,\n element: $menu,\n identifier: `Navigation (\\`<ul id=\"${menuId}\">\\`)`\n })\n }\n\n this.$menu = $menu\n this.$menuButton = $menuButton\n\n this.setupResponsiveChecks()\n\n this.$menuButton.addEventListener('click', () =>\n this.handleMenuButtonClick()\n )\n }\n\n /**\n * Setup viewport resize check\n *\n * @private\n */\n setupResponsiveChecks() {\n const breakpoint = getBreakpoint('desktop')\n\n if (!breakpoint.value) {\n throw new ElementError({\n component: Header,\n identifier: `CSS custom property (\\`${breakpoint.property}\\`) on pseudo-class \\`:root\\``\n })\n }\n\n // Media query list for GOV.UK Frontend desktop breakpoint\n this.mql = window.matchMedia(`(min-width: ${breakpoint.value})`)\n\n // MediaQueryList.addEventListener isn't supported by Safari < 14 so we need\n // to be able to fall back to the deprecated MediaQueryList.addListener\n if ('addEventListener' in this.mql) {\n this.mql.addEventListener('change', () => this.checkMode())\n } else {\n // @ts-expect-error Property 'addListener' does not exist\n // eslint-disable-next-line @typescript-eslint/no-unsafe-call\n this.mql.addListener(() => this.checkMode())\n }\n\n this.checkMode()\n }\n\n /**\n * Sync menu state\n *\n * Uses the global variable menuIsOpen to correctly set the accessible and\n * visual states of the menu and the menu button.\n * Additionally will force the menu to be visible and the menu button to be\n * hidden if the matchMedia is triggered to desktop.\n *\n * @private\n */\n checkMode() {\n if (!this.mql || !this.$menu || !this.$menuButton) {\n return\n }\n\n if (this.mql.matches) {\n this.$menu.removeAttribute('hidden')\n this.$menuButton.setAttribute('hidden', '')\n } else {\n this.$menuButton.removeAttribute('hidden')\n this.$menuButton.setAttribute('aria-expanded', this.menuIsOpen.toString())\n\n if (this.menuIsOpen) {\n this.$menu.removeAttribute('hidden')\n } else {\n this.$menu.setAttribute('hidden', '')\n }\n }\n }\n\n /**\n * Handle menu button click\n *\n * When the menu button is clicked, change the visibility of the menu and then\n * sync the accessibility state and menu button state\n *\n * @private\n */\n handleMenuButtonClick() {\n this.menuIsOpen = !this.menuIsOpen\n this.checkMode()\n }\n\n /**\n * Name for the component used when initialising using data-module attributes.\n */\n static moduleName = 'govuk-header'\n}\n"],"names":["getBreakpoint","name","property","value","window","getComputedStyle","document","documentElement","getPropertyValue","undefined","isInitialised","$root","moduleName","HTMLElement","hasAttribute","isSupported","$scope","body","classList","contains","formatErrorMessage","Component","message","GOVUKFrontendError","Error","constructor","args","SupportError","supportMessage","HTMLScriptElement","prototype","ElementError","messageOrOptions","component","identifier","element","expectedType","InitError","componentOrMessage","_$root","childConstructor","elementType","checkSupport","checkInitialised","setAttribute","Header","$menuButton","$menu","menuIsOpen","mql","querySelector","menuId","getAttribute","getElementById","setupResponsiveChecks","addEventListener","handleMenuButtonClick","breakpoint","matchMedia","checkMode","addListener","matches","removeAttribute","toString"],"mappings":";;;;;;EAiCO,SAASA,aAAaA,CAACC,IAAI,EAAE;EAClC,EAAA,MAAMC,QAAQ,GAAG,CAA+BD,4BAAAA,EAAAA,IAAI,CAAE,CAAA,CAAA;EAGtD,EAAA,MAAME,KAAK,GAAGC,MAAM,CACjBC,gBAAgB,CAACC,QAAQ,CAACC,eAAe,CAAC,CAC1CC,gBAAgB,CAACN,QAAQ,CAAC,CAAA;IAE7B,OAAO;MACLA,QAAQ;MACRC,KAAK,EAAEA,KAAK,IAAIM,SAAAA;KACjB,CAAA;EACH,CAAA;EAwDO,SAASC,aAAaA,CAACC,KAAK,EAAEC,UAAU,EAAE;IAC/C,OACED,KAAK,YAAYE,WAAW,IAC5BF,KAAK,CAACG,YAAY,CAAC,CAAA,KAAA,EAAQF,UAAU,CAAA,KAAA,CAAO,CAAC,CAAA;EAEjD,CAAA;;EAEA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACO,SAASG,WAAWA,CAACC,MAAM,GAAGV,QAAQ,CAACW,IAAI,EAAE;IAClD,IAAI,CAACD,MAAM,EAAE;EACX,IAAA,OAAO,KAAK,CAAA;EACd,GAAA;EAEA,EAAA,OAAOA,MAAM,CAACE,SAAS,CAACC,QAAQ,CAAC,0BAA0B,CAAC,CAAA;EAC9D,CAAA;EAiCO,SAASC,kBAAkBA,CAACC,SAAS,EAAEC,OAAO,EAAE;EACrD,EAAA,OAAO,GAAGD,SAAS,CAACT,UAAU,CAAA,EAAA,EAAKU,OAAO,CAAE,CAAA,CAAA;EAC9C,CAAA;EAQA;EACA;EACA;EACA;EAIA;EACA;EACA;;ECzJO,MAAMC,kBAAkB,SAASC,KAAK,CAAC;EAAAC,EAAAA,WAAAA,CAAA,GAAAC,IAAA,EAAA;EAAA,IAAA,KAAA,CAAA,GAAAA,IAAA,CAAA,CAAA;MAAA,IAC5CzB,CAAAA,IAAI,GAAG,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32,9 @@ function formatErrorMessage(Component, message) {
32
32
  * @typedef ComponentWithModuleName
33
33
  * @property {string} moduleName - Name of the component
34
34
  */
35
+ /**
36
+ * @import { ObjectNested } from './configuration.mjs'
37
+ */
35
38
 
36
39
  class GOVUKFrontendError extends Error {
37
40
  constructor(...args) {
@@ -77,10 +80,10 @@ class InitError extends GOVUKFrontendError {
77
80
  }
78
81
  }
79
82
  /**
80
- * @typedef {import('../common/index.mjs').ComponentWithModuleName} ComponentWithModuleName
83
+ * @import { ComponentWithModuleName } from '../common/index.mjs'
81
84
  */
82
85
 
83
- class GOVUKFrontendComponent {
86
+ class Component {
84
87
  /**
85
88
  * Returns the root element of the component
86
89
  *
@@ -131,16 +134,16 @@ class GOVUKFrontendComponent {
131
134
  */
132
135
 
133
136
  /**
134
- * @typedef {typeof GOVUKFrontendComponent & ChildClass} ChildClassConstructor
137
+ * @typedef {typeof Component & ChildClass} ChildClassConstructor
135
138
  */
136
- GOVUKFrontendComponent.elementType = HTMLElement;
139
+ Component.elementType = HTMLElement;
137
140
 
138
141
  /**
139
142
  * Header component
140
143
  *
141
144
  * @preserve
142
145
  */
143
- class Header extends GOVUKFrontendComponent {
146
+ class Header extends Component {
144
147
  /**
145
148
  * Apply a matchMedia for desktop which will trigger a state sync if the
146
149
  * browser viewport moves between states.
@@ -1 +1 @@
1
- {"version":3,"file":"header.bundle.mjs","sources":["../../../../src/govuk/common/index.mjs","../../../../src/govuk/errors/index.mjs","../../../../src/govuk/govuk-frontend-component.mjs","../../../../src/govuk/components/header/header.mjs"],"sourcesContent":["/**\n * Common helpers which do not require polyfill.\n *\n * IMPORTANT: If a helper require a polyfill, please isolate it in its own module\n * so that the polyfill can be properly tree-shaken and does not burden\n * the components that do not need that helper\n */\n\n/**\n * Get hash fragment from URL\n *\n * Extract the hash fragment (everything after the hash) from a URL,\n * but not including the hash symbol\n *\n * @private\n * @param {string} url - URL\n * @returns {string | undefined} Fragment from URL, without the hash\n */\nexport function getFragmentFromUrl(url) {\n if (!url.includes('#')) {\n return undefined\n }\n\n return url.split('#').pop()\n}\n\n/**\n * Get GOV.UK Frontend breakpoint value from CSS custom property\n *\n * @private\n * @param {string} name - Breakpoint name\n * @returns {{ property: string, value?: string }} Breakpoint object\n */\nexport function getBreakpoint(name) {\n const property = `--govuk-frontend-breakpoint-${name}`\n\n // Get value from `<html>` with breakpoints on CSS :root\n const value = window\n .getComputedStyle(document.documentElement)\n .getPropertyValue(property)\n\n return {\n property,\n value: value || undefined\n }\n}\n\n/**\n * Move focus to element\n *\n * Sets tabindex to -1 to make the element programmatically focusable,\n * but removes it on blur as the element doesn't need to be focused again.\n *\n * @private\n * @template {HTMLElement} FocusElement\n * @param {FocusElement} $element - HTML element\n * @param {object} [options] - Handler options\n * @param {function(this: FocusElement): void} [options.onBeforeFocus] - Callback before focus\n * @param {function(this: FocusElement): void} [options.onBlur] - Callback on blur\n */\nexport function setFocus($element, options = {}) {\n const isFocusable = $element.getAttribute('tabindex')\n\n if (!isFocusable) {\n $element.setAttribute('tabindex', '-1')\n }\n\n /**\n * Handle element focus\n */\n function onFocus() {\n $element.addEventListener('blur', onBlur, { once: true })\n }\n\n /**\n * Handle element blur\n */\n function onBlur() {\n options.onBlur?.call($element)\n\n if (!isFocusable) {\n $element.removeAttribute('tabindex')\n }\n }\n\n // Add listener to reset element on blur, after focus\n $element.addEventListener('focus', onFocus, { once: true })\n\n // Focus element\n options.onBeforeFocus?.call($element)\n $element.focus()\n}\n\n/**\n * Checks if component is already initialised\n *\n * @internal\n * @param {Element} $root - HTML element to be checked\n * @param {string} moduleName - name of component module\n * @returns {boolean} Whether component is already initialised\n */\nexport function isInitialised($root, moduleName) {\n return (\n $root instanceof HTMLElement &&\n $root.hasAttribute(`data-${moduleName}-init`)\n )\n}\n\n/**\n * Checks if GOV.UK Frontend is supported on this page\n *\n * Some browsers will load and run our JavaScript but GOV.UK Frontend\n * won't be supported.\n *\n * @param {HTMLElement | null} [$scope] - (internal) `<body>` HTML element checked for browser support\n * @returns {boolean} Whether GOV.UK Frontend is supported on this page\n */\nexport function isSupported($scope = document.body) {\n if (!$scope) {\n return false\n }\n\n return $scope.classList.contains('govuk-frontend-supported')\n}\n\n/**\n * Check for an array\n *\n * @internal\n * @param {unknown} option - Option to check\n * @returns {boolean} Whether the option is an array\n */\nfunction isArray(option) {\n return Array.isArray(option)\n}\n\n/**\n * Check for an object\n *\n * @internal\n * @param {unknown} option - Option to check\n * @returns {boolean} Whether the option is an object\n */\nexport function isObject(option) {\n return !!option && typeof option === 'object' && !isArray(option)\n}\n\n/**\n * Format error message\n *\n * @internal\n * @param {ComponentWithModuleName} Component - Component that threw the error\n * @param {string} message - Error message\n * @returns {string} - Formatted error message\n */\nexport function formatErrorMessage(Component, message) {\n return `${Component.moduleName}: ${message}`\n}\n\n/* eslint-disable jsdoc/valid-types --\n * `{new(...args: any[] ): object}` is not recognised as valid\n * https://github.com/gajus/eslint-plugin-jsdoc/issues/145#issuecomment-1308722878\n * https://github.com/jsdoc-type-pratt-parser/jsdoc-type-pratt-parser/issues/131\n **/\n\n/**\n * @typedef ComponentWithModuleName\n * @property {string} moduleName - Name of the component\n */\n\n/* eslint-enable jsdoc/valid-types */\n","import { formatErrorMessage } from '../common/index.mjs'\n\n/**\n * GOV.UK Frontend error\n *\n * A base class for `Error`s thrown by GOV.UK Frontend.\n *\n * It is meant to be extended into specific types of errors\n * to be thrown by our code.\n *\n * @example\n * ```js\n * class MissingRootError extends GOVUKFrontendError {\n * // Setting an explicit name is important as extending the class will not\n * // set a new `name` on the subclass. The `name` property is important\n * // to ensure intelligible error names even if the class name gets\n * // mangled by a minifier\n * name = \"MissingRootError\"\n * }\n * ```\n * @virtual\n */\nexport class GOVUKFrontendError extends Error {\n name = 'GOVUKFrontendError'\n}\n\n/**\n * Indicates that GOV.UK Frontend is not supported\n */\nexport class SupportError extends GOVUKFrontendError {\n name = 'SupportError'\n\n /**\n * Checks if GOV.UK Frontend is supported on this page\n *\n * @param {HTMLElement | null} [$scope] - HTML element `<body>` checked for browser support\n */\n constructor($scope = document.body) {\n const supportMessage =\n 'noModule' in HTMLScriptElement.prototype\n ? 'GOV.UK Frontend initialised without `<body class=\"govuk-frontend-supported\">` from template `<script>` snippet'\n : 'GOV.UK Frontend is not supported in this browser'\n\n super(\n $scope\n ? supportMessage\n : 'GOV.UK Frontend initialised without `<script type=\"module\">`'\n )\n }\n}\n\n/**\n * Indicates that a component has received an illegal configuration\n */\nexport class ConfigError extends GOVUKFrontendError {\n name = 'ConfigError'\n}\n\n/**\n * Indicates an issue with an element (possibly `null` or `undefined`)\n */\nexport class ElementError extends GOVUKFrontendError {\n name = 'ElementError'\n\n /**\n * @internal\n * @overload\n * @param {string} message - Element error message\n */\n\n /**\n * @internal\n * @overload\n * @param {ElementErrorOptions} options - Element error options\n */\n\n /**\n * @internal\n * @param {string | ElementErrorOptions} messageOrOptions - Element error message or options\n */\n constructor(messageOrOptions) {\n let message = typeof messageOrOptions === 'string' ? messageOrOptions : ''\n\n // Build message from options\n if (typeof messageOrOptions === 'object') {\n const { component, identifier, element, expectedType } = messageOrOptions\n\n message = identifier\n\n // Append reason\n message += element\n ? ` is not of type ${expectedType ?? 'HTMLElement'}`\n : ' not found'\n\n message = formatErrorMessage(component, message)\n }\n\n super(message)\n }\n}\n\n/**\n * Indicates that a component is already initialised\n */\nexport class InitError extends GOVUKFrontendError {\n name = 'InitError'\n\n /**\n * @internal\n * @param {ComponentWithModuleName | string} componentOrMessage - name of the component module\n */\n constructor(componentOrMessage) {\n const message =\n typeof componentOrMessage === 'string'\n ? componentOrMessage\n : formatErrorMessage(\n componentOrMessage,\n `Root element (\\`$root\\`) already initialised`\n )\n\n super(message)\n }\n}\n\n/**\n * Element error options\n *\n * @internal\n * @typedef {object} ElementErrorOptions\n * @property {string} identifier - An identifier that'll let the user understand which element has an error. This is whatever makes the most sense\n * @property {Element | null} [element] - The element in error\n * @property {string} [expectedType] - The type that was expected for the identifier\n * @property {ComponentWithModuleName} component - Component throwing the error\n */\n\n/**\n * @typedef {import('../common/index.mjs').ComponentWithModuleName} ComponentWithModuleName\n */\n","import { isInitialised, isSupported } from './common/index.mjs'\nimport { ElementError, InitError, SupportError } from './errors/index.mjs'\n\n/**\n * Base Component class\n *\n * Centralises the behaviours shared by our components\n *\n * @virtual\n * @template {Element} [RootElementType=HTMLElement]\n */\nexport class GOVUKFrontendComponent {\n /**\n * @type {typeof Element}\n */\n static elementType = HTMLElement\n\n // allows Typescript user to work around the lack of types\n // in GOVUKFrontend package, Typescript is not aware of $root\n // in components that extend GOVUKFrontendComponent\n /**\n * Returns the root element of the component\n *\n * @protected\n * @returns {RootElementType} - the root element of component\n */\n get $root() {\n return this._$root\n }\n\n /**\n * @protected\n * @type {RootElementType}\n */\n _$root\n\n /**\n * Constructs a new component, validating that GOV.UK Frontend is supported\n *\n * @internal\n * @param {Element | null} [$root] - HTML element to use for component\n */\n constructor($root) {\n const childConstructor = /** @type {ChildClassConstructor} */ (\n this.constructor\n )\n\n // TypeScript does not enforce that inheriting classes will define a `moduleName`\n // (even if we add a `@virtual` `static moduleName` property to this class).\n // While we trust users to do this correctly, we do a little check to provide them\n // a helpful error message.\n //\n // After this, we'll be sure that `childConstructor` has a `moduleName`\n // as expected of the `ChildClassConstructor` we've cast `this.constructor` to.\n if (typeof childConstructor.moduleName !== 'string') {\n throw new InitError(`\\`moduleName\\` not defined in component`)\n }\n\n if (!($root instanceof childConstructor.elementType)) {\n throw new ElementError({\n element: $root,\n component: childConstructor,\n identifier: 'Root element (`$root`)',\n expectedType: childConstructor.elementType.name\n })\n } else {\n this._$root = /** @type {RootElementType} */ ($root)\n }\n\n childConstructor.checkSupport()\n\n this.checkInitialised()\n\n const moduleName = childConstructor.moduleName\n\n this.$root.setAttribute(`data-${moduleName}-init`, '')\n }\n\n /**\n * Validates whether component is already initialised\n *\n * @private\n * @throws {InitError} when component is already initialised\n */\n checkInitialised() {\n const constructor = /** @type {ChildClassConstructor} */ (this.constructor)\n const moduleName = constructor.moduleName\n\n if (moduleName && isInitialised(this.$root, moduleName)) {\n throw new InitError(constructor)\n }\n }\n\n /**\n * Validates whether components are supported\n *\n * @throws {SupportError} when the components are not supported\n */\n static checkSupport() {\n if (!isSupported()) {\n throw new SupportError()\n }\n }\n}\n\n/**\n * @typedef ChildClass\n * @property {string} moduleName - The module name that'll be looked for in the DOM when initialising the component\n */\n\n/**\n * @typedef {typeof GOVUKFrontendComponent & ChildClass} ChildClassConstructor\n */\n","import { getBreakpoint } from '../../common/index.mjs'\nimport { ElementError } from '../../errors/index.mjs'\nimport { GOVUKFrontendComponent } from '../../govuk-frontend-component.mjs'\n\n/**\n * Header component\n *\n * @preserve\n */\nexport class Header extends GOVUKFrontendComponent {\n /** @private */\n $menuButton\n\n /** @private */\n $menu\n\n /**\n * Save the opened/closed state for the nav in memory so that we can\n * accurately maintain state when the screen is changed from small to big and\n * back to small\n *\n * @private\n */\n menuIsOpen = false\n\n /**\n * A global const for storing a matchMedia instance which we'll use to detect\n * when a screen size change happens. We rely on it being null if the feature\n * isn't available to initially apply hidden attributes\n *\n * @private\n * @type {MediaQueryList | null}\n */\n mql = null\n\n /**\n * Apply a matchMedia for desktop which will trigger a state sync if the\n * browser viewport moves between states.\n *\n * @param {Element | null} $root - HTML element to use for header\n */\n constructor($root) {\n super($root)\n\n const $menuButton = this.$root.querySelector('.govuk-js-header-toggle')\n\n // Headers don't necessarily have a navigation. When they don't, the menu\n // toggle won't be rendered by our macro (or may be omitted when writing\n // plain HTML)\n if (!$menuButton) {\n return this\n }\n\n const menuId = $menuButton.getAttribute('aria-controls')\n if (!menuId) {\n throw new ElementError({\n component: Header,\n identifier:\n 'Navigation button (`<button class=\"govuk-js-header-toggle\">`) attribute (`aria-controls`)'\n })\n }\n\n const $menu = document.getElementById(menuId)\n if (!$menu) {\n throw new ElementError({\n component: Header,\n element: $menu,\n identifier: `Navigation (\\`<ul id=\"${menuId}\">\\`)`\n })\n }\n\n this.$menu = $menu\n this.$menuButton = $menuButton\n\n this.setupResponsiveChecks()\n\n this.$menuButton.addEventListener('click', () =>\n this.handleMenuButtonClick()\n )\n }\n\n /**\n * Setup viewport resize check\n *\n * @private\n */\n setupResponsiveChecks() {\n const breakpoint = getBreakpoint('desktop')\n\n if (!breakpoint.value) {\n throw new ElementError({\n component: Header,\n identifier: `CSS custom property (\\`${breakpoint.property}\\`) on pseudo-class \\`:root\\``\n })\n }\n\n // Media query list for GOV.UK Frontend desktop breakpoint\n this.mql = window.matchMedia(`(min-width: ${breakpoint.value})`)\n\n // MediaQueryList.addEventListener isn't supported by Safari < 14 so we need\n // to be able to fall back to the deprecated MediaQueryList.addListener\n if ('addEventListener' in this.mql) {\n this.mql.addEventListener('change', () => this.checkMode())\n } else {\n // @ts-expect-error Property 'addListener' does not exist\n // eslint-disable-next-line @typescript-eslint/no-unsafe-call\n this.mql.addListener(() => this.checkMode())\n }\n\n this.checkMode()\n }\n\n /**\n * Sync menu state\n *\n * Uses the global variable menuIsOpen to correctly set the accessible and\n * visual states of the menu and the menu button.\n * Additionally will force the menu to be visible and the menu button to be\n * hidden if the matchMedia is triggered to desktop.\n *\n * @private\n */\n checkMode() {\n if (!this.mql || !this.$menu || !this.$menuButton) {\n return\n }\n\n if (this.mql.matches) {\n this.$menu.removeAttribute('hidden')\n this.$menuButton.setAttribute('hidden', '')\n } else {\n this.$menuButton.removeAttribute('hidden')\n this.$menuButton.setAttribute('aria-expanded', this.menuIsOpen.toString())\n\n if (this.menuIsOpen) {\n this.$menu.removeAttribute('hidden')\n } else {\n this.$menu.setAttribute('hidden', '')\n }\n }\n }\n\n /**\n * Handle menu button click\n *\n * When the menu button is clicked, change the visibility of the menu and then\n * sync the accessibility state and menu button state\n *\n * @private\n */\n handleMenuButtonClick() {\n this.menuIsOpen = !this.menuIsOpen\n this.checkMode()\n }\n\n /**\n * Name for the component used when initialising using data-module attributes.\n */\n static moduleName = 'govuk-header'\n}\n"],"names":["getBreakpoint","name","property","value","window","getComputedStyle","document","documentElement","getPropertyValue","undefined","isInitialised","$root","moduleName","HTMLElement","hasAttribute","isSupported","$scope","body","classList","contains","formatErrorMessage","Component","message","GOVUKFrontendError","Error","constructor","args","SupportError","supportMessage","HTMLScriptElement","prototype","ElementError","messageOrOptions","component","identifier","element","expectedType","InitError","componentOrMessage","GOVUKFrontendComponent","_$root","childConstructor","elementType","checkSupport","checkInitialised","setAttribute","Header","$menuButton","$menu","menuIsOpen","mql","querySelector","menuId","getAttribute","getElementById","setupResponsiveChecks","addEventListener","handleMenuButtonClick","breakpoint","matchMedia","checkMode","addListener","matches","removeAttribute","toString"],"mappings":"AAiCO,SAASA,aAAaA,CAACC,IAAI,EAAE;AAClC,EAAA,MAAMC,QAAQ,GAAG,CAA+BD,4BAAAA,EAAAA,IAAI,CAAE,CAAA,CAAA;AAGtD,EAAA,MAAME,KAAK,GAAGC,MAAM,CACjBC,gBAAgB,CAACC,QAAQ,CAACC,eAAe,CAAC,CAC1CC,gBAAgB,CAACN,QAAQ,CAAC,CAAA;EAE7B,OAAO;IACLA,QAAQ;IACRC,KAAK,EAAEA,KAAK,IAAIM,SAAAA;GACjB,CAAA;AACH,CAAA;AAwDO,SAASC,aAAaA,CAACC,KAAK,EAAEC,UAAU,EAAE;EAC/C,OACED,KAAK,YAAYE,WAAW,IAC5BF,KAAK,CAACG,YAAY,CAAC,CAAA,KAAA,EAAQF,UAAU,CAAA,KAAA,CAAO,CAAC,CAAA;AAEjD,CAAA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASG,WAAWA,CAACC,MAAM,GAAGV,QAAQ,CAACW,IAAI,EAAE;EAClD,IAAI,CAACD,MAAM,EAAE;AACX,IAAA,OAAO,KAAK,CAAA;AACd,GAAA;AAEA,EAAA,OAAOA,MAAM,CAACE,SAAS,CAACC,QAAQ,CAAC,0BAA0B,CAAC,CAAA;AAC9D,CAAA;AAgCO,SAASC,kBAAkBA,CAACC,SAAS,EAAEC,OAAO,EAAE;AACrD,EAAA,OAAO,GAAGD,SAAS,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E,EAAE,CAAC,CAAA;AACvC,OAAA;AACF,KAAA;AACF,GAAA;AAUAY,EAAAA,qBAAqBA,GAAG;AACtB,IAAA,IAAI,CAACR,UAAU,GAAG,CAAC,IAAI,CAACA,UAAU,CAAA;IAClC,IAAI,CAACW,SAAS,EAAE,CAAA;AAClB,GAAA;AAMF,CAAA;AAtJad,MAAM,CAqJVlC,UAAU,GAAG,cAAc;;;;"}
1
+ {"version":3,"file":"header.bundle.mjs","sources":["../../../../src/govuk/common/index.mjs","../../../../src/govuk/errors/index.mjs","../../../../src/govuk/component.mjs","../../../../src/govuk/components/header/header.mjs"],"sourcesContent":["/**\n * Common helpers which do not require polyfill.\n *\n * IMPORTANT: If a helper require a polyfill, please isolate it in its own module\n * so that the polyfill can be properly tree-shaken and does not burden\n * the components that do not need that helper\n */\n\n/**\n * Get hash fragment from URL\n *\n * Extract the hash fragment (everything after the hash) from a URL,\n * but not including the hash symbol\n *\n * @private\n * @param {string} url - URL\n * @returns {string | undefined} Fragment from URL, without the hash\n */\nexport function getFragmentFromUrl(url) {\n if (!url.includes('#')) {\n return undefined\n }\n\n return url.split('#').pop()\n}\n\n/**\n * Get GOV.UK Frontend breakpoint value from CSS custom property\n *\n * @private\n * @param {string} name - Breakpoint name\n * @returns {{ property: string, value?: string }} Breakpoint object\n */\nexport function getBreakpoint(name) {\n const property = `--govuk-frontend-breakpoint-${name}`\n\n // Get value from `<html>` with breakpoints on CSS :root\n const value = window\n .getComputedStyle(document.documentElement)\n .getPropertyValue(property)\n\n return {\n property,\n value: value || undefined\n }\n}\n\n/**\n * Move focus to element\n *\n * Sets tabindex to -1 to make the element programmatically focusable,\n * but removes it on blur as the element doesn't need to be focused again.\n *\n * @private\n * @template {HTMLElement} FocusElement\n * @param {FocusElement} $element - HTML element\n * @param {object} [options] - Handler options\n * @param {function(this: FocusElement): void} [options.onBeforeFocus] - Callback before focus\n * @param {function(this: FocusElement): void} [options.onBlur] - Callback on blur\n */\nexport function setFocus($element, options = {}) {\n const isFocusable = $element.getAttribute('tabindex')\n\n if (!isFocusable) {\n $element.setAttribute('tabindex', '-1')\n }\n\n /**\n * Handle element focus\n */\n function onFocus() {\n $element.addEventListener('blur', onBlur, { once: true })\n }\n\n /**\n * Handle element blur\n */\n function onBlur() {\n options.onBlur?.call($element)\n\n if (!isFocusable) {\n $element.removeAttribute('tabindex')\n }\n }\n\n // Add listener to reset element on blur, after focus\n $element.addEventListener('focus', onFocus, { once: true })\n\n // Focus element\n options.onBeforeFocus?.call($element)\n $element.focus()\n}\n\n/**\n * Checks if component is already initialised\n *\n * @internal\n * @param {Element} $root - HTML element to be checked\n * @param {string} moduleName - name of component module\n * @returns {boolean} Whether component is already initialised\n */\nexport function isInitialised($root, moduleName) {\n return (\n $root instanceof HTMLElement &&\n $root.hasAttribute(`data-${moduleName}-init`)\n )\n}\n\n/**\n * Checks if GOV.UK Frontend is supported on this page\n *\n * Some browsers will load and run our JavaScript but GOV.UK Frontend\n * won't be supported.\n *\n * @param {HTMLElement | null} [$scope] - (internal) `<body>` HTML element checked for browser support\n * @returns {boolean} Whether GOV.UK Frontend is supported on this page\n */\nexport function isSupported($scope = document.body) {\n if (!$scope) {\n return false\n }\n\n return $scope.classList.contains('govuk-frontend-supported')\n}\n\n/**\n * Check for an array\n *\n * @internal\n * @param {unknown} option - Option to check\n * @returns {boolean} Whether the option is an array\n */\nfunction isArray(option) {\n return Array.isArray(option)\n}\n\n/**\n * Check for an object\n *\n * @internal\n * @template {Partial<Record<keyof ObjectType, unknown>>} [ObjectType=ObjectNested]\n * @param {unknown | ObjectType} option - Option to check\n * @returns {option is ObjectType} Whether the option is an object\n */\nexport function isObject(option) {\n return !!option && typeof option === 'object' && !isArray(option)\n}\n\n/**\n * Format error message\n *\n * @internal\n * @param {ComponentWithModuleName} Component - Component that threw the error\n * @param {string} message - Error message\n * @returns {string} - Formatted error message\n */\nexport function formatErrorMessage(Component, message) {\n return `${Component.moduleName}: ${message}`\n}\n\n/* eslint-disable jsdoc/valid-types --\n * `{new(...args: any[] ): object}` is not recognised as valid\n * https://github.com/gajus/eslint-plugin-jsdoc/issues/145#issuecomment-1308722878\n * https://github.com/jsdoc-type-pratt-parser/jsdoc-type-pratt-parser/issues/131\n **/\n\n/**\n * @typedef ComponentWithModuleName\n * @property {string} moduleName - Name of the component\n */\n\n/* eslint-enable jsdoc/valid-types */\n\n/**\n * @import { ObjectNested } from './configuration.mjs'\n */\n","import { formatErrorMessage } from '../common/index.mjs'\n\n/**\n * GOV.UK Frontend error\n *\n * A base class for `Error`s thrown by GOV.UK Frontend.\n *\n * It is meant to be extended into specific types of errors\n * to be thrown by our code.\n *\n * @example\n * ```js\n * class MissingRootError extends GOVUKFrontendError {\n * // Setting an explicit name is important as extending the class will not\n * // set a new `name` on the subclass. The `name` property is important\n * // to ensure intelligible error names even if the class name gets\n * // mangled by a minifier\n * name = \"MissingRootError\"\n * }\n * ```\n * @virtual\n */\nexport class GOVUKFrontendError extends Error {\n name = 'GOVUKFrontendError'\n}\n\n/**\n * Indicates that GOV.UK Frontend is not supported\n */\nexport class SupportError extends GOVUKFrontendError {\n name = 'SupportError'\n\n /**\n * Checks if GOV.UK Frontend is supported on this page\n *\n * @param {HTMLElement | null} [$scope] - HTML element `<body>` checked for browser support\n */\n constructor($scope = document.body) {\n const supportMessage =\n 'noModule' in HTMLScriptElement.prototype\n ? 'GOV.UK Frontend initialised without `<body class=\"govuk-frontend-supported\">` from template `<script>` snippet'\n : 'GOV.UK Frontend is not supported in this browser'\n\n super(\n $scope\n ? supportMessage\n : 'GOV.UK Frontend initialised without `<script type=\"module\">`'\n )\n }\n}\n\n/**\n * Indicates that a component has received an illegal configuration\n */\nexport class ConfigError extends GOVUKFrontendError {\n name = 'ConfigError'\n}\n\n/**\n * Indicates an issue with an element (possibly `null` or `undefined`)\n */\nexport class ElementError extends GOVUKFrontendError {\n name = 'ElementError'\n\n /**\n * @internal\n * @overload\n * @param {string} message - Element error message\n */\n\n /**\n * @internal\n * @overload\n * @param {ElementErrorOptions} options - Element error options\n */\n\n /**\n * @internal\n * @param {string | ElementErrorOptions} messageOrOptions - Element error message or options\n */\n constructor(messageOrOptions) {\n let message = typeof messageOrOptions === 'string' ? messageOrOptions : ''\n\n // Build message from options\n if (typeof messageOrOptions === 'object') {\n const { component, identifier, element, expectedType } = messageOrOptions\n\n message = identifier\n\n // Append reason\n message += element\n ? ` is not of type ${expectedType ?? 'HTMLElement'}`\n : ' not found'\n\n message = formatErrorMessage(component, message)\n }\n\n super(message)\n }\n}\n\n/**\n * Indicates that a component is already initialised\n */\nexport class InitError extends GOVUKFrontendError {\n name = 'InitError'\n\n /**\n * @internal\n * @param {ComponentWithModuleName | string} componentOrMessage - name of the component module\n */\n constructor(componentOrMessage) {\n const message =\n typeof componentOrMessage === 'string'\n ? componentOrMessage\n : formatErrorMessage(\n componentOrMessage,\n `Root element (\\`$root\\`) already initialised`\n )\n\n super(message)\n }\n}\n\n/**\n * Element error options\n *\n * @internal\n * @typedef {object} ElementErrorOptions\n * @property {string} identifier - An identifier that'll let the user understand which element has an error. This is whatever makes the most sense\n * @property {Element | null} [element] - The element in error\n * @property {string} [expectedType] - The type that was expected for the identifier\n * @property {ComponentWithModuleName} component - Component throwing the error\n */\n\n/**\n * @import { ComponentWithModuleName } from '../common/index.mjs'\n */\n","import { isInitialised, isSupported } from './common/index.mjs'\nimport { ElementError, InitError, SupportError } from './errors/index.mjs'\n\n/**\n * Base Component class\n *\n * Centralises the behaviours shared by our components\n *\n * @virtual\n * @template {Element} [RootElementType=HTMLElement]\n */\nexport class Component {\n /**\n * @type {typeof Element}\n */\n static elementType = HTMLElement\n\n // allows Typescript user to work around the lack of types\n // in GOVUKFrontend package, Typescript is not aware of $root\n // in components that extend GOVUKFrontendComponent\n /**\n * Returns the root element of the component\n *\n * @protected\n * @returns {RootElementType} - the root element of component\n */\n get $root() {\n return this._$root\n }\n\n /**\n * @protected\n * @type {RootElementType}\n */\n _$root\n\n /**\n * Constructs a new component, validating that GOV.UK Frontend is supported\n *\n * @internal\n * @param {Element | null} [$root] - HTML element to use for component\n */\n constructor($root) {\n const childConstructor = /** @type {ChildClassConstructor} */ (\n this.constructor\n )\n\n // TypeScript does not enforce that inheriting classes will define a `moduleName`\n // (even if we add a `@virtual` `static moduleName` property to this class).\n // While we trust users to do this correctly, we do a little check to provide them\n // a helpful error message.\n //\n // After this, we'll be sure that `childConstructor` has a `moduleName`\n // as expected of the `ChildClassConstructor` we've cast `this.constructor` to.\n if (typeof childConstructor.moduleName !== 'string') {\n throw new InitError(`\\`moduleName\\` not defined in component`)\n }\n\n if (!($root instanceof childConstructor.elementType)) {\n throw new ElementError({\n element: $root,\n component: childConstructor,\n identifier: 'Root element (`$root`)',\n expectedType: childConstructor.elementType.name\n })\n } else {\n this._$root = /** @type {RootElementType} */ ($root)\n }\n\n childConstructor.checkSupport()\n\n this.checkInitialised()\n\n const moduleName = childConstructor.moduleName\n\n this.$root.setAttribute(`data-${moduleName}-init`, '')\n }\n\n /**\n * Validates whether component is already initialised\n *\n * @private\n * @throws {InitError} when component is already initialised\n */\n checkInitialised() {\n const constructor = /** @type {ChildClassConstructor} */ (this.constructor)\n const moduleName = constructor.moduleName\n\n if (moduleName && isInitialised(this.$root, moduleName)) {\n throw new InitError(constructor)\n }\n }\n\n /**\n * Validates whether components are supported\n *\n * @throws {SupportError} when the components are not supported\n */\n static checkSupport() {\n if (!isSupported()) {\n throw new SupportError()\n }\n }\n}\n\n/**\n * @typedef ChildClass\n * @property {string} moduleName - The module name that'll be looked for in the DOM when initialising the component\n */\n\n/**\n * @typedef {typeof Component & ChildClass} ChildClassConstructor\n */\n","import { getBreakpoint } from '../../common/index.mjs'\nimport { Component } from '../../component.mjs'\nimport { ElementError } from '../../errors/index.mjs'\n\n/**\n * Header component\n *\n * @preserve\n */\nexport class Header extends Component {\n /** @private */\n $menuButton\n\n /** @private */\n $menu\n\n /**\n * Save the opened/closed state for the nav in memory so that we can\n * accurately maintain state when the screen is changed from small to big and\n * back to small\n *\n * @private\n */\n menuIsOpen = false\n\n /**\n * A global const for storing a matchMedia instance which we'll use to detect\n * when a screen size change happens. We rely on it being null if the feature\n * isn't available to initially apply hidden attributes\n *\n * @private\n * @type {MediaQueryList | null}\n */\n mql = null\n\n /**\n * Apply a matchMedia for desktop which will trigger a state sync if the\n * browser viewport moves between states.\n *\n * @param {Element | null} $root - HTML element to use for header\n */\n constructor($root) {\n super($root)\n\n const $menuButton = this.$root.querySelector('.govuk-js-header-toggle')\n\n // Headers don't necessarily have a navigation. When they don't, the menu\n // toggle won't be rendered by our macro (or may be omitted when writing\n // plain HTML)\n if (!$menuButton) {\n return this\n }\n\n const menuId = $menuButton.getAttribute('aria-controls')\n if (!menuId) {\n throw new ElementError({\n component: Header,\n identifier:\n 'Navigation button (`<button class=\"govuk-js-header-toggle\">`) attribute (`aria-controls`)'\n })\n }\n\n const $menu = document.getElementById(menuId)\n if (!$menu) {\n throw new ElementError({\n component: Header,\n element: $menu,\n identifier: `Navigation (\\`<ul id=\"${menuId}\">\\`)`\n })\n }\n\n this.$menu = $menu\n this.$menuButton = $menuButton\n\n this.setupResponsiveChecks()\n\n this.$menuButton.addEventListener('click', () =>\n this.handleMenuButtonClick()\n )\n }\n\n /**\n * Setup viewport resize check\n *\n * @private\n */\n setupResponsiveChecks() {\n const breakpoint = getBreakpoint('desktop')\n\n if (!breakpoint.value) {\n throw new ElementError({\n component: Header,\n identifier: `CSS custom property (\\`${breakpoint.property}\\`) on pseudo-class \\`:root\\``\n })\n }\n\n // Media query list for GOV.UK Frontend desktop breakpoint\n this.mql = window.matchMedia(`(min-width: ${breakpoint.value})`)\n\n // MediaQueryList.addEventListener isn't supported by Safari < 14 so we need\n // to be able to fall back to the deprecated MediaQueryList.addListener\n if ('addEventListener' in this.mql) {\n this.mql.addEventListener('change', () => this.checkMode())\n } else {\n // @ts-expect-error Property 'addListener' does not exist\n // eslint-disable-next-line @typescript-eslint/no-unsafe-call\n this.mql.addListener(() => this.checkMode())\n }\n\n this.checkMode()\n }\n\n /**\n * Sync menu state\n *\n * Uses the global variable menuIsOpen to correctly set the accessible and\n * visual states of the menu and the menu button.\n * Additionally will force the menu to be visible and the menu button to be\n * hidden if the matchMedia is triggered to desktop.\n *\n * @private\n */\n checkMode() {\n if (!this.mql || !this.$menu || !this.$menuButton) {\n return\n }\n\n if (this.mql.matches) {\n this.$menu.removeAttribute('hidden')\n this.$menuButton.setAttribute('hidden', '')\n } else {\n this.$menuButton.removeAttribute('hidden')\n this.$menuButton.setAttribute('aria-expanded', this.menuIsOpen.toString())\n\n if (this.menuIsOpen) {\n this.$menu.removeAttribute('hidden')\n } else {\n this.$menu.setAttribute('hidden', '')\n }\n }\n }\n\n /**\n * Handle menu button click\n *\n * When the menu button is clicked, change the visibility of the menu and then\n * sync the accessibility state and menu button state\n *\n * @private\n */\n handleMenuButtonClick() {\n this.menuIsOpen = !this.menuIsOpen\n this.checkMode()\n }\n\n /**\n * Name for the component used when initialising using data-module attributes.\n */\n static moduleName = 'govuk-header'\n}\n"],"names":["getBreakpoint","name","property","value","window","getComputedStyle","document","documentElement","getPropertyValue","undefined","isInitialised","$root","moduleName","HTMLElement","hasAttribute","isSupported","$scope","body","classList","contains","formatErrorMessage","Component","message","GOVUKFrontendError","Error","constructor","args","SupportError","supportMessage","HTMLScriptElement","prototype","ElementError","messageOrOptions","component","identifier","element","expectedType","InitError","componentOrMessage","_$root","childConstructor","elementType","checkSupport","checkInitialised","setAttribute","Header","$menuButton","$menu","menuIsOpen","mql","querySelector","menuId","getAttribute","getElementById","setupResponsiveChecks","addEventListener","handleMenuButtonClick","breakpoint","matchMedia","checkMode","addListener","matches","removeAttribute","toString"],"mappings":"AAiCO,SAASA,aAAaA,CAACC,IAAI,EAAE;AAClC,EAAA,MAAMC,QAAQ,GAAG,CAA+BD,4BAAAA,EAAAA,IAAI,CAAE,CAAA,CAAA;AAGtD,EAAA,MAAME,KAAK,GAAGC,MAAM,CACjBC,gBAAgB,CAACC,QAAQ,CAACC,eAAe,CAAC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ACV,GAAG,IAAI,CAAC,IAAI,CAACF,KAAK,IAAI,CAAC,IAAI,CAACD,WAAW,EAAE;AACjD,MAAA,OAAA;AACF,KAAA;AAEA,IAAA,IAAI,IAAI,CAACG,GAAG,CAACY,OAAO,EAAE;AACpB,MAAA,IAAI,CAACd,KAAK,CAACe,eAAe,CAAC,QAAQ,CAAC,CAAA;MACpC,IAAI,CAAChB,WAAW,CAACF,YAAY,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAA;AAC7C,KAAC,MAAM;AACL,MAAA,IAAI,CAACE,WAAW,CAACgB,eAAe,CAAC,QAAQ,CAAC,CAAA;AAC1C,MAAA,IAAI,CAAChB,WAAW,CAACF,YAAY,CAAC,eAAe,EAAE,IAAI,CAACI,UAAU,CAACe,QAAQ,EAAE,CAAC,CAAA;MAE1E,IAAI,IAAI,CAACf,UAAU,EAAE;AACnB,QAAA,IAAI,CAACD,KAAK,CAACe,eAAe,CAAC,QAAQ,CAAC,CAAA;AACtC,OAAC,MAAM;QACL,IAAI,CAACf,KAAK,CAACH,YAAY,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAA;AACvC,OAAA;AACF,KAAA;AACF,GAAA;AAUAY,EAAAA,qBAAqBA,GAAG;AACtB,IAAA,IAAI,CAACR,UAAU,GAAG,CAAC,IAAI,CAACA,UAAU,CAAA;IAClC,IAAI,CAACW,SAAS,EAAE,CAAA;AAClB,GAAA;AAMF,CAAA;AAtJad,MAAM,CAqJVjC,UAAU,GAAG,cAAc;;;;"}
@@ -1,13 +1,13 @@
1
1
  import { getBreakpoint } from '../../common/index.mjs';
2
+ import { Component } from '../../component.mjs';
2
3
  import { ElementError } from '../../errors/index.mjs';
3
- import { GOVUKFrontendComponent } from '../../govuk-frontend-component.mjs';
4
4
 
5
5
  /**
6
6
  * Header component
7
7
  *
8
8
  * @preserve
9
9
  */
10
- class Header extends GOVUKFrontendComponent {
10
+ class Header extends Component {
11
11
  /**
12
12
  * Apply a matchMedia for desktop which will trigger a state sync if the
13
13
  * browser viewport moves between states.
@@ -1 +1 @@
1
- {"version":3,"file":"header.mjs","sources":["../../../../src/govuk/components/header/header.mjs"],"sourcesContent":["import { getBreakpoint } from '../../common/index.mjs'\nimport { ElementError } from '../../errors/index.mjs'\nimport { GOVUKFrontendComponent } from '../../govuk-frontend-component.mjs'\n\n/**\n * Header component\n *\n * @preserve\n */\nexport class Header extends GOVUKFrontendComponent {\n /** @private */\n $menuButton\n\n /** @private */\n $menu\n\n /**\n * Save the opened/closed state for the nav in memory so that we can\n * accurately maintain state when the screen is changed from small to big and\n * back to small\n *\n * @private\n */\n menuIsOpen = false\n\n /**\n * A global const for storing a matchMedia instance which we'll use to detect\n * when a screen size change happens. We rely on it being null if the feature\n * isn't available to initially apply hidden attributes\n *\n * @private\n * @type {MediaQueryList | null}\n */\n mql = null\n\n /**\n * Apply a matchMedia for desktop which will trigger a state sync if the\n * browser viewport moves between states.\n *\n * @param {Element | null} $root - HTML element to use for header\n */\n constructor($root) {\n super($root)\n\n const $menuButton = this.$root.querySelector('.govuk-js-header-toggle')\n\n // Headers don't necessarily have a navigation. When they don't, the menu\n // toggle won't be rendered by our macro (or may be omitted when writing\n // plain HTML)\n if (!$menuButton) {\n return this\n }\n\n const menuId = $menuButton.getAttribute('aria-controls')\n if (!menuId) {\n throw new ElementError({\n component: Header,\n identifier:\n 'Navigation button (`<button class=\"govuk-js-header-toggle\">`) attribute (`aria-controls`)'\n })\n }\n\n const $menu = document.getElementById(menuId)\n if (!$menu) {\n throw new ElementError({\n component: Header,\n element: $menu,\n identifier: `Navigation (\\`<ul id=\"${menuId}\">\\`)`\n })\n }\n\n this.$menu = $menu\n this.$menuButton = $menuButton\n\n this.setupResponsiveChecks()\n\n this.$menuButton.addEventListener('click', () =>\n this.handleMenuButtonClick()\n )\n }\n\n /**\n * Setup viewport resize check\n *\n * @private\n */\n setupResponsiveChecks() {\n const breakpoint = getBreakpoint('desktop')\n\n if (!breakpoint.value) {\n throw new ElementError({\n component: Header,\n identifier: `CSS custom property (\\`${breakpoint.property}\\`) on pseudo-class \\`:root\\``\n })\n }\n\n // Media query list for GOV.UK Frontend desktop breakpoint\n this.mql = window.matchMedia(`(min-width: ${breakpoint.value})`)\n\n // MediaQueryList.addEventListener isn't supported by Safari < 14 so we need\n // to be able to fall back to the deprecated MediaQueryList.addListener\n if ('addEventListener' in this.mql) {\n this.mql.addEventListener('change', () => this.checkMode())\n } else {\n // @ts-expect-error Property 'addListener' does not exist\n // eslint-disable-next-line @typescript-eslint/no-unsafe-call\n this.mql.addListener(() => this.checkMode())\n }\n\n this.checkMode()\n }\n\n /**\n * Sync menu state\n *\n * Uses the global variable menuIsOpen to correctly set the accessible and\n * visual states of the menu and the menu button.\n * Additionally will force the menu to be visible and the menu button to be\n * hidden if the matchMedia is triggered to desktop.\n *\n * @private\n */\n checkMode() {\n if (!this.mql || !this.$menu || !this.$menuButton) {\n return\n }\n\n if (this.mql.matches) {\n this.$menu.removeAttribute('hidden')\n this.$menuButton.setAttribute('hidden', '')\n } else {\n this.$menuButton.removeAttribute('hidden')\n this.$menuButton.setAttribute('aria-expanded', this.menuIsOpen.toString())\n\n if (this.menuIsOpen) {\n this.$menu.removeAttribute('hidden')\n } else {\n this.$menu.setAttribute('hidden', '')\n }\n }\n }\n\n /**\n * Handle menu button click\n *\n * When the menu button is clicked, change the visibility of the menu and then\n * sync the accessibility state and menu button state\n *\n * @private\n */\n handleMenuButtonClick() {\n this.menuIsOpen = !this.menuIsOpen\n this.checkMode()\n }\n\n /**\n * Name for the component used when initialising using data-module attributes.\n */\n static moduleName = 'govuk-header'\n}\n"],"names":["Header","GOVUKFrontendComponent","constructor","$root","$menuButton","$menu","menuIsOpen","mql","querySelector","menuId","getAttribute","ElementError","component","identifier","document","getElementById","element","setupResponsiveChecks","addEventListener","handleMenuButtonClick","breakpoint","getBreakpoint","value","property","window","matchMedia","checkMode","addListener","matches","removeAttribute","setAttribute","toString","moduleName"],"mappings":";;;;AAIA;AACA;AACA;AACA;AACA;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,MAAA,IAAI,CAAC1B,WAAW,CAACyB,eAAe,CAAC,QAAQ,CAAC,CAAA;AAC1C,MAAA,IAAI,CAACzB,WAAW,CAAC0B,YAAY,CAAC,eAAe,EAAE,IAAI,CAACxB,UAAU,CAACyB,QAAQ,EAAE,CAAC,CAAA;MAE1E,IAAI,IAAI,CAACzB,UAAU,EAAE;AACnB,QAAA,IAAI,CAACD,KAAK,CAACwB,eAAe,CAAC,QAAQ,CAAC,CAAA;AACtC,OAAC,MAAM;QACL,IAAI,CAACxB,KAAK,CAACyB,YAAY,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAA;AACvC,OAAA;AACF,KAAA;AACF,GAAA;AAUAX,EAAAA,qBAAqBA,GAAG;AACtB,IAAA,IAAI,CAACb,UAAU,GAAG,CAAC,IAAI,CAACA,UAAU,CAAA;IAClC,IAAI,CAACoB,SAAS,EAAE,CAAA;AAClB,GAAA;AAMF,CAAA;AAtJa1B,MAAM,CAqJVgC,UAAU,GAAG,cAAc;;;;"}
1
+ {"version":3,"file":"header.mjs","sources":["../../../../src/govuk/components/header/header.mjs"],"sourcesContent":["import { getBreakpoint } from '../../common/index.mjs'\nimport { Component } from '../../component.mjs'\nimport { ElementError } from '../../errors/index.mjs'\n\n/**\n * Header component\n *\n * @preserve\n */\nexport class Header extends Component {\n /** @private */\n $menuButton\n\n /** @private */\n $menu\n\n /**\n * Save the opened/closed state for the nav in memory so that we can\n * accurately maintain state when the screen is changed from small to big and\n * back to small\n *\n * @private\n */\n menuIsOpen = false\n\n /**\n * A global const for storing a matchMedia instance which we'll use to detect\n * when a screen size change happens. We rely on it being null if the feature\n * isn't available to initially apply hidden attributes\n *\n * @private\n * @type {MediaQueryList | null}\n */\n mql = null\n\n /**\n * Apply a matchMedia for desktop which will trigger a state sync if the\n * browser viewport moves between states.\n *\n * @param {Element | null} $root - HTML element to use for header\n */\n constructor($root) {\n super($root)\n\n const $menuButton = this.$root.querySelector('.govuk-js-header-toggle')\n\n // Headers don't necessarily have a navigation. When they don't, the menu\n // toggle won't be rendered by our macro (or may be omitted when writing\n // plain HTML)\n if (!$menuButton) {\n return this\n }\n\n const menuId = $menuButton.getAttribute('aria-controls')\n if (!menuId) {\n throw new ElementError({\n component: Header,\n identifier:\n 'Navigation button (`<button class=\"govuk-js-header-toggle\">`) attribute (`aria-controls`)'\n })\n }\n\n const $menu = document.getElementById(menuId)\n if (!$menu) {\n throw new ElementError({\n component: Header,\n element: $menu,\n identifier: `Navigation (\\`<ul id=\"${menuId}\">\\`)`\n })\n }\n\n this.$menu = $menu\n this.$menuButton = $menuButton\n\n this.setupResponsiveChecks()\n\n this.$menuButton.addEventListener('click', () =>\n this.handleMenuButtonClick()\n )\n }\n\n /**\n * Setup viewport resize check\n *\n * @private\n */\n setupResponsiveChecks() {\n const breakpoint = getBreakpoint('desktop')\n\n if (!breakpoint.value) {\n throw new ElementError({\n component: Header,\n identifier: `CSS custom property (\\`${breakpoint.property}\\`) on pseudo-class \\`:root\\``\n })\n }\n\n // Media query list for GOV.UK Frontend desktop breakpoint\n this.mql = window.matchMedia(`(min-width: ${breakpoint.value})`)\n\n // MediaQueryList.addEventListener isn't supported by Safari < 14 so we need\n // to be able to fall back to the deprecated MediaQueryList.addListener\n if ('addEventListener' in this.mql) {\n this.mql.addEventListener('change', () => this.checkMode())\n } else {\n // @ts-expect-error Property 'addListener' does not exist\n // eslint-disable-next-line @typescript-eslint/no-unsafe-call\n this.mql.addListener(() => this.checkMode())\n }\n\n this.checkMode()\n }\n\n /**\n * Sync menu state\n *\n * Uses the global variable menuIsOpen to correctly set the accessible and\n * visual states of the menu and the menu button.\n * Additionally will force the menu to be visible and the menu button to be\n * hidden if the matchMedia is triggered to desktop.\n *\n * @private\n */\n checkMode() {\n if (!this.mql || !this.$menu || !this.$menuButton) {\n return\n }\n\n if (this.mql.matches) {\n this.$menu.removeAttribute('hidden')\n this.$menuButton.setAttribute('hidden', '')\n } else {\n this.$menuButton.removeAttribute('hidden')\n this.$menuButton.setAttribute('aria-expanded', this.menuIsOpen.toString())\n\n if (this.menuIsOpen) {\n this.$menu.removeAttribute('hidden')\n } else {\n this.$menu.setAttribute('hidden', '')\n }\n }\n }\n\n /**\n * Handle menu button click\n *\n * When the menu button is clicked, change the visibility of the menu and then\n * sync the accessibility state and menu button state\n *\n * @private\n */\n handleMenuButtonClick() {\n this.menuIsOpen = !this.menuIsOpen\n this.checkMode()\n }\n\n /**\n * Name for the component used when initialising using data-module attributes.\n */\n static moduleName = 'govuk-header'\n}\n"],"names":["Header","Component","constructor","$root","$menuButton","$menu","menuIsOpen","mql","querySelector","menuId","getAttribute","ElementError","component","identifier","document","getElementById","element","setupResponsiveChecks","addEventListener","handleMenuButtonClick","breakpoint","getBreakpoint","value","property","window","matchMedia","checkMode","addListener","matches","removeAttribute","setAttribute","toString","moduleName"],"mappings":";;;;AAIA;AACA;AACA;AACA;AACA;AACO,MAAMA,MAAM,SAASC,SAAS,CAAC;AA0BpC;AACF;AACA;AACA;AACA;AACA;EACEC,WAAWA,CAACC,KAAK,EAAE;IACjB,KAAK,CAACA,KAAK,CAAC,CAAA;AAAA,IAAA,IAAA,CA/BdC,WAAW,GAAA,KAAA,CAAA,CAAA;AAAA,IAAA,IAAA,CAGXC,KAAK,GAAA,KAAA,CAAA,CAAA;IAAA,IASLC,CAAAA,UAAU,GAAG,KAAK,CAAA;IAAA,IAUlBC,CAAAA,GAAG,GAAG,IAAI,CAAA;IAWR,MAAMH,WAAW,GAAG,IAAI,CAACD,KAAK,CAACK,aAAa,CAAC,yBAAyB,CAAC,CAAA;IAKvE,IAAI,CAACJ,WAAW,EAAE;AAChB,MAAA,OAAO,IAAI,CAAA;AACb,KAAA;AAEA,IAAA,MAAMK,MAAM,GAAGL,WAAW,CAACM,YAAY,CAAC,eAAe,CAAC,CAAA;IACxD,IAAI,CAACD,MAAM,EAAE;MACX,MAAM,IAAIE,YAAY,CAAC;AACrBC,QAAAA,SAAS,EAAEZ,MAAM;AACjBa,QAAAA,UAAU,EACR,2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
- "description": "The name of your service, included in the header."
18
+ "description": "The name of your service, included in the header.",
19
+ "deprecated": "5.9.0"
19
20
  },
20
21
  {
21
22
  "name": "serviceUrl",
22
23
  "type": "string",
23
24
  "required": false,
24
- "description": "URL for the service name anchor."
25
+ "description": "URL for the service name anchor.",
26
+ "deprecated": "5.9.0"
25
27
  },
26
28
  {
27
29
  "name": "navigation",
28
30
  "type": "array",
29
31
  "required": false,
30
32
  "description": "Can be used to add navigation to the header component.",
33
+ "deprecated": "5.9.0",
31
34
  "params": [
32
35
  {
33
36
  "name": "text",
34
37
  "type": "string",
35
38
  "required": true,
36
- "description": "Text for the navigation item. If `html` is provided, the `text` option will be ignored."
39
+ "description": "Text for the navigation item. If `html` is provided, the `text` option will be ignored.",
40
+ "deprecated": "5.9.0"
37
41
  },
38
42
  {
39
43
  "name": "html",
40
44
  "type": "string",
41
45
  "required": true,
42
- "description": "HTML for the navigation item. If `html` is provided, the `text` option will be ignored."
46
+ "description": "HTML for the navigation item. If `html` is provided, the `text` option will be ignored.",
47
+ "deprecated": "5.9.0"
43
48
  },
44
49
  {
45
50
  "name": "href",
46
51
  "type": "string",
47
52
  "required": false,
48
- "description": "URL of the navigation item anchor."
53
+ "description": "URL of the navigation item anchor.",
54
+ "deprecated": "5.9.0"
49
55
  },
50
56
  {
51
57
  "name": "active",
52
58
  "type": "boolean",
53
59
  "required": false,
54
- "description": "Flag to mark the navigation item as active or not."
60
+ "description": "Flag to mark the navigation item as active or not.",
61
+ "deprecated": "5.9.0"
55
62
  },
56
63
  {
57
64
  "name": "attributes",
58
65
  "type": "object",
59
66
  "required": false,
60
- "description": "HTML attributes (for example data attributes) to add to the navigation item anchor."
67
+ "description": "HTML attributes (for example data attributes) to add to the navigation item anchor.",
68
+ "deprecated": "5.9.0"
61
69
  }
62
70
  ]
63
71
  },
@@ -65,25 +73,29 @@
65
73
  "name": "navigationClasses",
66
74
  "type": "string",
67
75
  "required": false,
68
- "description": "Classes for the navigation section of the header."
76
+ "description": "Classes for the navigation section of the header.",
77
+ "deprecated": "5.9.0"
69
78
  },
70
79
  {
71
80
  "name": "navigationLabel",
72
81
  "type": "string",
73
82
  "required": false,
74
- "description": "Text for the `aria-label` attribute of the navigation. Defaults to the same value as `menuButtonText`."
83
+ "description": "Text for the `aria-label` attribute of the navigation. Defaults to the same value as `menuButtonText`.",
84
+ "deprecated": "5.9.0"
75
85
  },
76
86
  {
77
87
  "name": "menuButtonLabel",
78
88
  "type": "string",
79
89
  "required": false,
80
- "description": "Text for the `aria-label` attribute of the button that opens the mobile navigation, if there is a mobile navigation menu."
90
+ "description": "Text for the `aria-label` attribute of the button that opens the mobile navigation, if there is a mobile navigation menu.",
91
+ "deprecated": "5.9.0"
81
92
  },
82
93
  {
83
94
  "name": "menuButtonText",
84
95
  "type": "string",
85
96
  "required": false,
86
- "description": "Text of the button that opens the mobile navigation menu, if there is a mobile navigation menu. There is no enforced character limit, but there is a limited display space so keep text as short as possible. By default, this is set to 'Menu'."
97
+ "description": "Text of the button that opens the mobile navigation menu, if there is a mobile navigation menu. There is no enforced character limit, but there is a limited display space so keep text as short as possible. By default, this is set to 'Menu'.",
98
+ "deprecated": "5.9.0"
87
99
  },
88
100
  {
89
101
  "name": "containerClasses",
@@ -107,6 +119,7 @@
107
119
  "name": "useTudorCrown",
108
120
  "type": "boolean",
109
121
  "required": false,
110
- "description": "Deprecated. If `true`, uses the Tudor crown from King Charles III's royal cypher. Otherwise, uses the St. Edward's crown. Default is `true`."
122
+ "description": "If `true`, uses the Tudor crown from King Charles III's royal cypher. Otherwise, uses the St. Edward's crown. Default is `true`.",
123
+ "deprecated": "5.2.0"
111
124
  }
112
125
  ]
@@ -7,14 +7,13 @@
7
7
  "label": {
8
8
  "text": "National Insurance number"
9
9
  },
10
- "id": "input-example",
11
10
  "name": "test-name"
12
11
  },
13
12
  "hidden": false,
14
13
  "description": "",
15
14
  "previewLayoutModifiers": [],
16
15
  "screenshot": false,
17
- "html": "<div class=\"govuk-form-group\">\n <label class=\"govuk-label\" for=\"input-example\">\n National Insurance number\n </label>\n <input class=\"govuk-input\" id=\"input-example\" name=\"test-name\" type=\"text\">\n</div>"
16
+ "html": "<div class=\"govuk-form-group\">\n <label class=\"govuk-label\" for=\"test-name\">\n National Insurance number\n </label>\n <input class=\"govuk-input\" id=\"test-name\" name=\"test-name\" type=\"text\">\n</div>"
18
17
  },
19
18
  {
20
19
  "name": "with hint text",
@@ -496,6 +495,21 @@
496
495
  "screenshot": false,
497
496
  "html": "<div class=\"govuk-form-group\">\n <label class=\"govuk-label\" for=\"with-classes\">\n With classes\n </label>\n <input class=\"govuk-input app-input--custom-modifier\" id=\"with-classes\" name=\"with-classes\" type=\"text\">\n</div>"
498
497
  },
498
+ {
499
+ "name": "id",
500
+ "options": {
501
+ "id": "input-id",
502
+ "name": "testing-name",
503
+ "label": {
504
+ "text": "With custom id"
505
+ }
506
+ },
507
+ "hidden": true,
508
+ "description": "",
509
+ "previewLayoutModifiers": [],
510
+ "screenshot": false,
511
+ "html": "<div class=\"govuk-form-group\">\n <label class=\"govuk-label\" for=\"input-id\">\n With custom id\n </label>\n <input class=\"govuk-input\" id=\"input-id\" name=\"testing-name\" type=\"text\">\n</div>"
512
+ },
499
513
  {
500
514
  "name": "custom type",
501
515
  "options": {