defra_ruby_template 5.4.1 → 5.11.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 (427) hide show
  1. checksums.yaml +4 -4
  2. data/app/views/layouts/defra_ruby_template.html.erb +39 -18
  3. data/lib/defra_ruby_template/version.rb +1 -1
  4. data/node_modules/govuk-frontend/dist/govuk/all.bundle.js +882 -492
  5. data/node_modules/govuk-frontend/dist/govuk/all.bundle.js.map +1 -1
  6. data/node_modules/govuk-frontend/dist/govuk/all.bundle.mjs +877 -492
  7. data/node_modules/govuk-frontend/dist/govuk/all.bundle.mjs.map +1 -1
  8. data/node_modules/govuk-frontend/dist/govuk/all.mjs +5 -0
  9. data/node_modules/govuk-frontend/dist/govuk/all.mjs.map +1 -1
  10. data/node_modules/govuk-frontend/dist/govuk/all.scss +6 -0
  11. data/node_modules/govuk-frontend/dist/govuk/all.scss.map +1 -1
  12. data/node_modules/govuk-frontend/dist/govuk/assets/images/govuk-crest.svg +1 -0
  13. data/node_modules/govuk-frontend/dist/govuk/assets/rebrand/images/favicon.ico +0 -0
  14. data/node_modules/govuk-frontend/dist/govuk/assets/rebrand/images/favicon.svg +1 -0
  15. data/node_modules/govuk-frontend/dist/govuk/assets/rebrand/images/govuk-crest.svg +1 -0
  16. data/node_modules/govuk-frontend/dist/govuk/assets/rebrand/images/govuk-icon-180.png +0 -0
  17. data/node_modules/govuk-frontend/dist/govuk/assets/rebrand/images/govuk-icon-192.png +0 -0
  18. data/node_modules/govuk-frontend/dist/govuk/assets/rebrand/images/govuk-icon-512.png +0 -0
  19. data/node_modules/govuk-frontend/dist/govuk/assets/rebrand/images/govuk-icon-mask.svg +1 -0
  20. data/node_modules/govuk-frontend/dist/govuk/assets/rebrand/images/govuk-opengraph-image.png +0 -0
  21. data/node_modules/govuk-frontend/dist/govuk/assets/rebrand/manifest.json +39 -0
  22. data/node_modules/govuk-frontend/dist/govuk/common/closest-attribute-value.mjs.map +1 -1
  23. data/node_modules/govuk-frontend/dist/govuk/common/configuration.mjs +169 -0
  24. data/node_modules/govuk-frontend/dist/govuk/common/configuration.mjs.map +1 -0
  25. data/node_modules/govuk-frontend/dist/govuk/common/govuk-frontend-version.mjs +1 -1
  26. data/node_modules/govuk-frontend/dist/govuk/common/index.mjs +20 -83
  27. data/node_modules/govuk-frontend/dist/govuk/common/index.mjs.map +1 -1
  28. data/node_modules/govuk-frontend/dist/govuk/component.mjs +60 -0
  29. data/node_modules/govuk-frontend/dist/govuk/component.mjs.map +1 -0
  30. data/node_modules/govuk-frontend/dist/govuk/components/_index.scss +1 -0
  31. data/node_modules/govuk-frontend/dist/govuk/components/_index.scss.map +1 -1
  32. data/node_modules/govuk-frontend/dist/govuk/components/accordion/_index.scss +35 -31
  33. data/node_modules/govuk-frontend/dist/govuk/components/accordion/_index.scss.map +1 -1
  34. data/node_modules/govuk-frontend/dist/govuk/components/accordion/accordion.bundle.js +296 -195
  35. data/node_modules/govuk-frontend/dist/govuk/components/accordion/accordion.bundle.js.map +1 -1
  36. data/node_modules/govuk-frontend/dist/govuk/components/accordion/accordion.bundle.mjs +295 -194
  37. data/node_modules/govuk-frontend/dist/govuk/components/accordion/accordion.bundle.mjs.map +1 -1
  38. data/node_modules/govuk-frontend/dist/govuk/components/accordion/accordion.mjs +88 -110
  39. data/node_modules/govuk-frontend/dist/govuk/components/accordion/accordion.mjs.map +1 -1
  40. data/node_modules/govuk-frontend/dist/govuk/components/accordion/fixtures.json +16 -3
  41. data/node_modules/govuk-frontend/dist/govuk/components/back-link/fixtures.json +25 -15
  42. data/node_modules/govuk-frontend/dist/govuk/components/back-link/template-with-custom-link.html +1 -0
  43. data/node_modules/govuk-frontend/dist/govuk/components/back-link/template.njk +2 -2
  44. data/node_modules/govuk-frontend/dist/govuk/components/breadcrumbs/fixtures.json +53 -15
  45. data/node_modules/govuk-frontend/dist/govuk/components/breadcrumbs/macro-options.json +6 -0
  46. data/node_modules/govuk-frontend/dist/govuk/components/breadcrumbs/template-default.html +2 -2
  47. data/node_modules/govuk-frontend/dist/govuk/components/breadcrumbs/template-inverse.html +2 -2
  48. data/node_modules/govuk-frontend/dist/govuk/components/breadcrumbs/template-with-collapse-on-mobile.html +2 -2
  49. data/node_modules/govuk-frontend/dist/govuk/components/breadcrumbs/template-with-last-breadcrumb-as-current-page.html +2 -2
  50. data/node_modules/govuk-frontend/dist/govuk/components/breadcrumbs/template-with-multiple-levels.html +2 -2
  51. data/node_modules/govuk-frontend/dist/govuk/components/breadcrumbs/template-with-one-level.html +2 -2
  52. data/node_modules/govuk-frontend/dist/govuk/components/breadcrumbs/template-without-the-home-section.html +2 -2
  53. data/node_modules/govuk-frontend/dist/govuk/components/breadcrumbs/template.njk +2 -2
  54. data/node_modules/govuk-frontend/dist/govuk/components/button/button.bundle.js +217 -106
  55. data/node_modules/govuk-frontend/dist/govuk/components/button/button.bundle.js.map +1 -1
  56. data/node_modules/govuk-frontend/dist/govuk/components/button/button.bundle.mjs +216 -105
  57. data/node_modules/govuk-frontend/dist/govuk/components/button/button.bundle.mjs.map +1 -1
  58. data/node_modules/govuk-frontend/dist/govuk/components/button/button.mjs +9 -22
  59. data/node_modules/govuk-frontend/dist/govuk/components/button/button.mjs.map +1 -1
  60. data/node_modules/govuk-frontend/dist/govuk/components/button/fixtures.json +38 -0
  61. data/node_modules/govuk-frontend/dist/govuk/components/button/macro-options.json +2 -1
  62. data/node_modules/govuk-frontend/dist/govuk/components/character-count/_index.scss +12 -4
  63. data/node_modules/govuk-frontend/dist/govuk/components/character-count/_index.scss.map +1 -1
  64. data/node_modules/govuk-frontend/dist/govuk/components/character-count/character-count.bundle.js +256 -145
  65. data/node_modules/govuk-frontend/dist/govuk/components/character-count/character-count.bundle.js.map +1 -1
  66. data/node_modules/govuk-frontend/dist/govuk/components/character-count/character-count.bundle.mjs +255 -144
  67. data/node_modules/govuk-frontend/dist/govuk/components/character-count/character-count.bundle.mjs.map +1 -1
  68. data/node_modules/govuk-frontend/dist/govuk/components/character-count/character-count.mjs +29 -34
  69. data/node_modules/govuk-frontend/dist/govuk/components/character-count/character-count.mjs.map +1 -1
  70. data/node_modules/govuk-frontend/dist/govuk/components/character-count/fixtures.json +80 -1
  71. data/node_modules/govuk-frontend/dist/govuk/components/character-count/macro-options.json +6 -6
  72. data/node_modules/govuk-frontend/dist/govuk/components/character-count/template-with-error.html +12 -0
  73. data/node_modules/govuk-frontend/dist/govuk/components/character-count/template-with-hint-and-error.html +15 -0
  74. data/node_modules/govuk-frontend/dist/govuk/components/character-count/template.njk +5 -4
  75. data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/_index.scss +6 -1
  76. data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/_index.scss.map +1 -1
  77. data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/checkboxes.bundle.js +96 -50
  78. data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/checkboxes.bundle.js.map +1 -1
  79. data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/checkboxes.bundle.mjs +95 -49
  80. data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/checkboxes.bundle.mjs.map +1 -1
  81. data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/checkboxes.mjs +9 -18
  82. data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/checkboxes.mjs.map +1 -1
  83. data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/fixtures.json +88 -1
  84. data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/template-small-with-divider-and-none.html +34 -0
  85. data/node_modules/govuk-frontend/dist/govuk/components/cookie-banner/_index.scss +23 -14
  86. data/node_modules/govuk-frontend/dist/govuk/components/cookie-banner/_index.scss.map +1 -1
  87. data/node_modules/govuk-frontend/dist/govuk/components/cookie-banner/fixtures.json +23 -0
  88. data/node_modules/govuk-frontend/dist/govuk/components/date-input/_index.scss +2 -2
  89. data/node_modules/govuk-frontend/dist/govuk/components/date-input/_index.scss.map +1 -1
  90. data/node_modules/govuk-frontend/dist/govuk/components/date-input/fixtures.json +27 -0
  91. data/node_modules/govuk-frontend/dist/govuk/components/date-input/macro-options.json +2 -2
  92. data/node_modules/govuk-frontend/dist/govuk/components/details/_index.scss +7 -2
  93. data/node_modules/govuk-frontend/dist/govuk/components/details/_index.scss.map +1 -1
  94. data/node_modules/govuk-frontend/dist/govuk/components/details/fixtures.json +10 -0
  95. data/node_modules/govuk-frontend/dist/govuk/components/error-message/fixtures.json +9 -0
  96. data/node_modules/govuk-frontend/dist/govuk/components/error-summary/_index.scss +4 -0
  97. data/node_modules/govuk-frontend/dist/govuk/components/error-summary/_index.scss.map +1 -1
  98. data/node_modules/govuk-frontend/dist/govuk/components/error-summary/error-summary.bundle.js +238 -127
  99. data/node_modules/govuk-frontend/dist/govuk/components/error-summary/error-summary.bundle.js.map +1 -1
  100. data/node_modules/govuk-frontend/dist/govuk/components/error-summary/error-summary.bundle.mjs +237 -126
  101. data/node_modules/govuk-frontend/dist/govuk/components/error-summary/error-summary.bundle.mjs.map +1 -1
  102. data/node_modules/govuk-frontend/dist/govuk/components/error-summary/error-summary.mjs +10 -22
  103. data/node_modules/govuk-frontend/dist/govuk/components/error-summary/error-summary.mjs.map +1 -1
  104. data/node_modules/govuk-frontend/dist/govuk/components/error-summary/fixtures.json +19 -0
  105. data/node_modules/govuk-frontend/dist/govuk/components/exit-this-page/exit-this-page.bundle.js +218 -107
  106. data/node_modules/govuk-frontend/dist/govuk/components/exit-this-page/exit-this-page.bundle.js.map +1 -1
  107. data/node_modules/govuk-frontend/dist/govuk/components/exit-this-page/exit-this-page.bundle.mjs +217 -106
  108. data/node_modules/govuk-frontend/dist/govuk/components/exit-this-page/exit-this-page.bundle.mjs.map +1 -1
  109. data/node_modules/govuk-frontend/dist/govuk/components/exit-this-page/exit-this-page.mjs +10 -22
  110. data/node_modules/govuk-frontend/dist/govuk/components/exit-this-page/exit-this-page.mjs.map +1 -1
  111. data/node_modules/govuk-frontend/dist/govuk/components/exit-this-page/fixtures.json +4 -0
  112. data/node_modules/govuk-frontend/dist/govuk/components/fieldset/_index.scss +3 -5
  113. data/node_modules/govuk-frontend/dist/govuk/components/fieldset/_index.scss.map +1 -1
  114. data/node_modules/govuk-frontend/dist/govuk/components/fieldset/fixtures.json +18 -0
  115. data/node_modules/govuk-frontend/dist/govuk/components/file-upload/_index.scss +175 -9
  116. data/node_modules/govuk-frontend/dist/govuk/components/file-upload/_index.scss.map +1 -1
  117. data/node_modules/govuk-frontend/dist/govuk/components/file-upload/file-upload.bundle.js +744 -0
  118. data/node_modules/govuk-frontend/dist/govuk/components/file-upload/file-upload.bundle.js.map +1 -0
  119. data/node_modules/govuk-frontend/dist/govuk/components/file-upload/file-upload.bundle.mjs +736 -0
  120. data/node_modules/govuk-frontend/dist/govuk/components/file-upload/file-upload.bundle.mjs.map +1 -0
  121. data/node_modules/govuk-frontend/dist/govuk/components/file-upload/file-upload.mjs +257 -0
  122. data/node_modules/govuk-frontend/dist/govuk/components/file-upload/file-upload.mjs.map +1 -0
  123. data/node_modules/govuk-frontend/dist/govuk/components/file-upload/fixtures.json +220 -16
  124. data/node_modules/govuk-frontend/dist/govuk/components/file-upload/macro-options.json +52 -3
  125. data/node_modules/govuk-frontend/dist/govuk/components/file-upload/template-allows-direct-media-capture.html +6 -0
  126. data/node_modules/govuk-frontend/dist/govuk/components/file-upload/template-allows-image-files-only.html +6 -0
  127. data/node_modules/govuk-frontend/dist/govuk/components/file-upload/template-allows-multiple-files.html +6 -0
  128. data/node_modules/govuk-frontend/dist/govuk/components/file-upload/template-disabled.html +6 -0
  129. data/node_modules/govuk-frontend/dist/govuk/components/file-upload/template-enhanced-disabled.html +13 -0
  130. data/node_modules/govuk-frontend/dist/govuk/components/file-upload/template-enhanced-with-error-message-and-hint.html +16 -0
  131. data/node_modules/govuk-frontend/dist/govuk/components/file-upload/template-enhanced.html +10 -0
  132. data/node_modules/govuk-frontend/dist/govuk/components/file-upload/template-translated.html +10 -0
  133. data/node_modules/govuk-frontend/dist/govuk/components/file-upload/template.njk +42 -5
  134. data/node_modules/govuk-frontend/dist/govuk/components/footer/_index.scss +61 -19
  135. data/node_modules/govuk-frontend/dist/govuk/components/footer/_index.scss.map +1 -1
  136. data/node_modules/govuk-frontend/dist/govuk/components/footer/fixtures.json +34 -0
  137. data/node_modules/govuk-frontend/dist/govuk/components/footer/macro-options.json +6 -0
  138. data/node_modules/govuk-frontend/dist/govuk/components/footer/template.njk +10 -0
  139. data/node_modules/govuk-frontend/dist/govuk/components/header/_index.scss +223 -21
  140. data/node_modules/govuk-frontend/dist/govuk/components/header/_index.scss.map +1 -1
  141. data/node_modules/govuk-frontend/dist/govuk/components/header/fixtures.json +78 -32
  142. data/node_modules/govuk-frontend/dist/govuk/components/header/header.bundle.js +90 -43
  143. data/node_modules/govuk-frontend/dist/govuk/components/header/header.bundle.js.map +1 -1
  144. data/node_modules/govuk-frontend/dist/govuk/components/header/header.bundle.mjs +89 -42
  145. data/node_modules/govuk-frontend/dist/govuk/components/header/header.bundle.mjs.map +1 -1
  146. data/node_modules/govuk-frontend/dist/govuk/components/header/header.mjs +10 -18
  147. data/node_modules/govuk-frontend/dist/govuk/components/header/header.mjs.map +1 -1
  148. data/node_modules/govuk-frontend/dist/govuk/components/header/macro-options.json +31 -12
  149. data/node_modules/govuk-frontend/dist/govuk/components/header/template-default.html +20 -12
  150. data/node_modules/govuk-frontend/dist/govuk/components/header/template-full-width-with-navigation.html +21 -15
  151. data/node_modules/govuk-frontend/dist/govuk/components/header/template-full-width.html +21 -15
  152. data/node_modules/govuk-frontend/dist/govuk/components/header/template-navigation-item-with-html.html +20 -12
  153. data/node_modules/govuk-frontend/dist/govuk/components/header/template-navigation-item-with-text-without-link.html +20 -12
  154. data/node_modules/govuk-frontend/dist/govuk/components/header/template-with-custom-menu-button-label.html +20 -12
  155. data/node_modules/govuk-frontend/dist/govuk/components/header/template-with-custom-menu-button-text.html +20 -12
  156. data/node_modules/govuk-frontend/dist/govuk/components/header/template-with-custom-navigation-label.html +20 -12
  157. data/node_modules/govuk-frontend/dist/govuk/components/header/template-with-full-width-border.html +30 -0
  158. data/node_modules/govuk-frontend/dist/govuk/components/header/template-with-large-navigation.html +20 -12
  159. data/node_modules/govuk-frontend/dist/govuk/components/header/template-with-navigation.html +20 -12
  160. data/node_modules/govuk-frontend/dist/govuk/components/header/template-with-product-name.html +21 -15
  161. data/node_modules/govuk-frontend/dist/govuk/components/header/template-with-service-name-and-navigation.html +20 -12
  162. data/node_modules/govuk-frontend/dist/govuk/components/header/template-with-service-name-but-no-service-url.html +20 -12
  163. data/node_modules/govuk-frontend/dist/govuk/components/header/template-with-service-name.html +20 -12
  164. data/node_modules/govuk-frontend/dist/govuk/components/header/template-with-st-edwards-crown.html +10 -12
  165. data/node_modules/govuk-frontend/dist/govuk/components/header/template.njk +11 -41
  166. data/node_modules/govuk-frontend/dist/govuk/components/hint/fixtures.json +6 -0
  167. data/node_modules/govuk-frontend/dist/govuk/components/input/_index.scss +7 -4
  168. data/node_modules/govuk-frontend/dist/govuk/components/input/_index.scss.map +1 -1
  169. data/node_modules/govuk-frontend/dist/govuk/components/input/fixtures.json +97 -27
  170. data/node_modules/govuk-frontend/dist/govuk/components/input/macro-options.json +6 -6
  171. data/node_modules/govuk-frontend/dist/govuk/components/input/template-default.html +2 -2
  172. data/node_modules/govuk-frontend/dist/govuk/components/input/template-disabled.html +6 -0
  173. data/node_modules/govuk-frontend/dist/govuk/components/input/template-with-error-and-hint.html +12 -0
  174. data/node_modules/govuk-frontend/dist/govuk/components/input/template-with-error-message.html +2 -5
  175. data/node_modules/govuk-frontend/dist/govuk/components/input/template.njk +5 -4
  176. data/node_modules/govuk-frontend/dist/govuk/components/inset-text/fixtures.json +6 -0
  177. data/node_modules/govuk-frontend/dist/govuk/components/label/fixtures.json +17 -0
  178. data/node_modules/govuk-frontend/dist/govuk/components/notification-banner/_index.scss +3 -2
  179. data/node_modules/govuk-frontend/dist/govuk/components/notification-banner/_index.scss.map +1 -1
  180. data/node_modules/govuk-frontend/dist/govuk/components/notification-banner/fixtures.json +24 -0
  181. data/node_modules/govuk-frontend/dist/govuk/components/notification-banner/notification-banner.bundle.js +238 -127
  182. data/node_modules/govuk-frontend/dist/govuk/components/notification-banner/notification-banner.bundle.js.map +1 -1
  183. data/node_modules/govuk-frontend/dist/govuk/components/notification-banner/notification-banner.bundle.mjs +237 -126
  184. data/node_modules/govuk-frontend/dist/govuk/components/notification-banner/notification-banner.bundle.mjs.map +1 -1
  185. data/node_modules/govuk-frontend/dist/govuk/components/notification-banner/notification-banner.mjs +10 -22
  186. data/node_modules/govuk-frontend/dist/govuk/components/notification-banner/notification-banner.mjs.map +1 -1
  187. data/node_modules/govuk-frontend/dist/govuk/components/pagination/_index.scss +24 -37
  188. data/node_modules/govuk-frontend/dist/govuk/components/pagination/_index.scss.map +1 -1
  189. data/node_modules/govuk-frontend/dist/govuk/components/pagination/fixtures.json +15 -0
  190. data/node_modules/govuk-frontend/dist/govuk/components/pagination/macro-options.json +4 -4
  191. data/node_modules/govuk-frontend/dist/govuk/components/panel/_index.scss +13 -9
  192. data/node_modules/govuk-frontend/dist/govuk/components/panel/_index.scss.map +1 -1
  193. data/node_modules/govuk-frontend/dist/govuk/components/panel/fixtures.json +9 -0
  194. data/node_modules/govuk-frontend/dist/govuk/components/password-input/_index.scss +12 -9
  195. data/node_modules/govuk-frontend/dist/govuk/components/password-input/_index.scss.map +1 -1
  196. data/node_modules/govuk-frontend/dist/govuk/components/password-input/fixtures.json +27 -2
  197. data/node_modules/govuk-frontend/dist/govuk/components/password-input/macro-options.json +3 -3
  198. data/node_modules/govuk-frontend/dist/govuk/components/password-input/password-input.bundle.js +220 -110
  199. data/node_modules/govuk-frontend/dist/govuk/components/password-input/password-input.bundle.js.map +1 -1
  200. data/node_modules/govuk-frontend/dist/govuk/components/password-input/password-input.bundle.mjs +219 -109
  201. data/node_modules/govuk-frontend/dist/govuk/components/password-input/password-input.bundle.mjs.map +1 -1
  202. data/node_modules/govuk-frontend/dist/govuk/components/password-input/password-input.mjs +12 -25
  203. data/node_modules/govuk-frontend/dist/govuk/components/password-input/password-input.mjs.map +1 -1
  204. data/node_modules/govuk-frontend/dist/govuk/components/password-input/template-default.html +3 -3
  205. data/node_modules/govuk-frontend/dist/govuk/components/password-input/template.njk +4 -2
  206. data/node_modules/govuk-frontend/dist/govuk/components/phase-banner/_index.scss +0 -8
  207. data/node_modules/govuk-frontend/dist/govuk/components/phase-banner/_index.scss.map +1 -1
  208. data/node_modules/govuk-frontend/dist/govuk/components/phase-banner/fixtures.json +7 -0
  209. data/node_modules/govuk-frontend/dist/govuk/components/radios/_index.scss +7 -5
  210. data/node_modules/govuk-frontend/dist/govuk/components/radios/_index.scss.map +1 -1
  211. data/node_modules/govuk-frontend/dist/govuk/components/radios/fixtures.json +51 -5
  212. data/node_modules/govuk-frontend/dist/govuk/components/radios/radios.bundle.js +96 -50
  213. data/node_modules/govuk-frontend/dist/govuk/components/radios/radios.bundle.js.map +1 -1
  214. data/node_modules/govuk-frontend/dist/govuk/components/radios/radios.bundle.mjs +95 -49
  215. data/node_modules/govuk-frontend/dist/govuk/components/radios/radios.bundle.mjs.map +1 -1
  216. data/node_modules/govuk-frontend/dist/govuk/components/radios/radios.mjs +9 -18
  217. data/node_modules/govuk-frontend/dist/govuk/components/radios/radios.mjs.map +1 -1
  218. data/node_modules/govuk-frontend/dist/govuk/components/radios/template-small-with-a-divider.html +1 -1
  219. data/node_modules/govuk-frontend/dist/govuk/components/radios/template-with-a-divider.html +1 -1
  220. data/node_modules/govuk-frontend/dist/govuk/components/select/_index.scss +5 -5
  221. data/node_modules/govuk-frontend/dist/govuk/components/select/_index.scss.map +1 -1
  222. data/node_modules/govuk-frontend/dist/govuk/components/select/fixtures.json +43 -9
  223. data/node_modules/govuk-frontend/dist/govuk/components/select/macro-options.json +2 -2
  224. data/node_modules/govuk-frontend/dist/govuk/components/select/template-id.html +7 -0
  225. data/node_modules/govuk-frontend/dist/govuk/components/select/template.njk +6 -4
  226. data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/README.md +15 -0
  227. data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/_index.scss +187 -0
  228. data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/_index.scss.map +1 -0
  229. data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/_service-navigation.scss +4 -0
  230. data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/_service-navigation.scss.map +1 -0
  231. data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/fixtures.json +515 -0
  232. data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/macro-options.json +138 -0
  233. data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/macro.njk +3 -0
  234. data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/service-navigation.bundle.js +229 -0
  235. data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/service-navigation.bundle.js.map +1 -0
  236. data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/service-navigation.bundle.mjs +221 -0
  237. data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/service-navigation.bundle.mjs.map +1 -0
  238. data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/service-navigation.mjs +85 -0
  239. data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/service-navigation.mjs.map +1 -0
  240. data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/template-default.html +57 -0
  241. data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/template-with-html-navigation-items.html +49 -0
  242. data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/template-with-large-navigation.html +153 -0
  243. data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/template-with-long-service-name.html +20 -0
  244. data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/template-with-navigation-with-a-current-item.html +58 -0
  245. data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/template-with-navigation-with-an-active-item.html +58 -0
  246. data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/template-with-non-link-navigation-items.html +49 -0
  247. data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/template-with-service-link.html +20 -0
  248. data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/template-with-service-name-and-navigation.html +63 -0
  249. data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/template-with-service-name.html +18 -0
  250. data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/template.njk +103 -0
  251. data/node_modules/govuk-frontend/dist/govuk/components/skip-link/_index.scss +6 -4
  252. data/node_modules/govuk-frontend/dist/govuk/components/skip-link/_index.scss.map +1 -1
  253. data/node_modules/govuk-frontend/dist/govuk/components/skip-link/fixtures.json +9 -0
  254. data/node_modules/govuk-frontend/dist/govuk/components/skip-link/skip-link.bundle.js +95 -48
  255. data/node_modules/govuk-frontend/dist/govuk/components/skip-link/skip-link.bundle.js.map +1 -1
  256. data/node_modules/govuk-frontend/dist/govuk/components/skip-link/skip-link.bundle.mjs +94 -47
  257. data/node_modules/govuk-frontend/dist/govuk/components/skip-link/skip-link.bundle.mjs.map +1 -1
  258. data/node_modules/govuk-frontend/dist/govuk/components/skip-link/skip-link.mjs +15 -23
  259. data/node_modules/govuk-frontend/dist/govuk/components/skip-link/skip-link.mjs.map +1 -1
  260. data/node_modules/govuk-frontend/dist/govuk/components/summary-list/_index.scss +14 -22
  261. data/node_modules/govuk-frontend/dist/govuk/components/summary-list/_index.scss.map +1 -1
  262. data/node_modules/govuk-frontend/dist/govuk/components/summary-list/fixtures.json +174 -1
  263. data/node_modules/govuk-frontend/dist/govuk/components/summary-list/template-as-a-summary-card-extreme.html +106 -0
  264. data/node_modules/govuk-frontend/dist/govuk/components/table/fixtures.json +22 -1
  265. data/node_modules/govuk-frontend/dist/govuk/components/tabs/fixtures.json +15 -1
  266. data/node_modules/govuk-frontend/dist/govuk/components/tabs/tabs.bundle.js +95 -53
  267. data/node_modules/govuk-frontend/dist/govuk/components/tabs/tabs.bundle.js.map +1 -1
  268. data/node_modules/govuk-frontend/dist/govuk/components/tabs/tabs.bundle.mjs +94 -52
  269. data/node_modules/govuk-frontend/dist/govuk/components/tabs/tabs.bundle.mjs.map +1 -1
  270. data/node_modules/govuk-frontend/dist/govuk/components/tabs/tabs.mjs +15 -28
  271. data/node_modules/govuk-frontend/dist/govuk/components/tabs/tabs.mjs.map +1 -1
  272. data/node_modules/govuk-frontend/dist/govuk/components/tag/_index.scss +11 -8
  273. data/node_modules/govuk-frontend/dist/govuk/components/tag/_index.scss.map +1 -1
  274. data/node_modules/govuk-frontend/dist/govuk/components/tag/fixtures.json +14 -0
  275. data/node_modules/govuk-frontend/dist/govuk/components/task-list/_index.scss +12 -10
  276. data/node_modules/govuk-frontend/dist/govuk/components/task-list/_index.scss.map +1 -1
  277. data/node_modules/govuk-frontend/dist/govuk/components/task-list/fixtures.json +44 -0
  278. data/node_modules/govuk-frontend/dist/govuk/components/task-list/template-with-empty-values.html +27 -0
  279. data/node_modules/govuk-frontend/dist/govuk/components/task-list/template.njk +1 -1
  280. data/node_modules/govuk-frontend/dist/govuk/components/textarea/_index.scss +3 -3
  281. data/node_modules/govuk-frontend/dist/govuk/components/textarea/_index.scss.map +1 -1
  282. data/node_modules/govuk-frontend/dist/govuk/components/textarea/fixtures.json +32 -1
  283. data/node_modules/govuk-frontend/dist/govuk/components/textarea/macro-options.json +3 -3
  284. data/node_modules/govuk-frontend/dist/govuk/components/textarea/template.njk +6 -4
  285. data/node_modules/govuk-frontend/dist/govuk/components/warning-text/_index.scss +6 -5
  286. data/node_modules/govuk-frontend/dist/govuk/components/warning-text/_index.scss.map +1 -1
  287. data/node_modules/govuk-frontend/dist/govuk/components/warning-text/fixtures.json +8 -0
  288. data/node_modules/govuk-frontend/dist/govuk/core/_govuk-frontend-properties.scss +1 -1
  289. data/node_modules/govuk-frontend/dist/govuk/core/_govuk-frontend-properties.scss.map +1 -1
  290. data/node_modules/govuk-frontend/dist/govuk/errors/index.mjs +16 -3
  291. data/node_modules/govuk-frontend/dist/govuk/errors/index.mjs.map +1 -1
  292. data/node_modules/govuk-frontend/dist/govuk/govuk-frontend.min.css +2 -2
  293. data/node_modules/govuk-frontend/dist/govuk/govuk-frontend.min.css.map +1 -1
  294. data/node_modules/govuk-frontend/dist/govuk/govuk-frontend.min.js +1 -1
  295. data/node_modules/govuk-frontend/dist/govuk/govuk-frontend.min.js.map +1 -1
  296. data/node_modules/govuk-frontend/dist/govuk/helpers/_colour.scss +55 -8
  297. data/node_modules/govuk-frontend/dist/govuk/helpers/_colour.scss.map +1 -1
  298. data/node_modules/govuk-frontend/dist/govuk/helpers/_focused.scss +14 -4
  299. data/node_modules/govuk-frontend/dist/govuk/helpers/_focused.scss.map +1 -1
  300. data/node_modules/govuk-frontend/dist/govuk/helpers/_grid.scss +1 -1
  301. data/node_modules/govuk-frontend/dist/govuk/helpers/_grid.scss.map +1 -1
  302. data/node_modules/govuk-frontend/dist/govuk/helpers/_links.scss +2 -2
  303. data/node_modules/govuk-frontend/dist/govuk/helpers/_links.scss.map +1 -1
  304. data/node_modules/govuk-frontend/dist/govuk/helpers/_shape-arrow.scss +1 -1
  305. data/node_modules/govuk-frontend/dist/govuk/helpers/_shape-arrow.scss.map +1 -1
  306. data/node_modules/govuk-frontend/dist/govuk/helpers/_typography.scss +18 -1
  307. data/node_modules/govuk-frontend/dist/govuk/helpers/_typography.scss.map +1 -1
  308. data/node_modules/govuk-frontend/dist/govuk/helpers/_visually-hidden.scss +30 -62
  309. data/node_modules/govuk-frontend/dist/govuk/helpers/_visually-hidden.scss.map +1 -1
  310. data/node_modules/govuk-frontend/dist/govuk/i18n.mjs.map +1 -1
  311. data/node_modules/govuk-frontend/dist/govuk/init.mjs +90 -24
  312. data/node_modules/govuk-frontend/dist/govuk/init.mjs.map +1 -1
  313. data/node_modules/govuk-frontend/dist/govuk/macros/logo.njk +78 -0
  314. data/node_modules/govuk-frontend/dist/govuk/objects/_template.scss +5 -1
  315. data/node_modules/govuk-frontend/dist/govuk/objects/_template.scss.map +1 -1
  316. data/node_modules/govuk-frontend/dist/govuk/overrides/_typography.scss +5 -1
  317. data/node_modules/govuk-frontend/dist/govuk/overrides/_typography.scss.map +1 -1
  318. data/node_modules/govuk-frontend/dist/govuk/settings/_colours-applied.scss +39 -1
  319. data/node_modules/govuk-frontend/dist/govuk/settings/_colours-applied.scss.map +1 -1
  320. data/node_modules/govuk-frontend/dist/govuk/settings/_colours-organisations.scss +244 -10
  321. data/node_modules/govuk-frontend/dist/govuk/settings/_colours-organisations.scss.map +1 -1
  322. data/node_modules/govuk-frontend/dist/govuk/settings/_typography-responsive.scss +5 -10
  323. data/node_modules/govuk-frontend/dist/govuk/settings/_typography-responsive.scss.map +1 -1
  324. data/node_modules/govuk-frontend/dist/govuk/template.njk +20 -9
  325. data/node_modules/govuk-frontend/dist/govuk/tools/_index.scss +1 -0
  326. data/node_modules/govuk-frontend/dist/govuk/tools/_index.scss.map +1 -1
  327. data/node_modules/govuk-frontend/dist/govuk/tools/_rebrand.scss +65 -0
  328. data/node_modules/govuk-frontend/dist/govuk/tools/_rebrand.scss.map +1 -0
  329. data/node_modules/govuk-frontend/dist/govuk-prototype-kit/functions.js +25 -0
  330. data/node_modules/govuk-frontend/dist/govuk-prototype-kit/init.scss +1 -1
  331. data/node_modules/govuk-frontend/dist/govuk-prototype-kit/init.scss.map +1 -1
  332. data/node_modules/govuk-frontend/govuk-prototype-kit.config.json +8 -1
  333. data/node_modules/govuk-frontend/package.json +16 -16
  334. data/spec/spec_helper.rb +98 -0
  335. data/spec/tasks/assets_spec.rb +53 -0
  336. data/vendor/assets/assets/fonts/bold-affa96571d-v2.woff +0 -0
  337. data/vendor/assets/assets/fonts/bold-b542beb274-v2.woff2 +0 -0
  338. data/vendor/assets/assets/fonts/light-94a07e06a1-v2.woff2 +0 -0
  339. data/vendor/assets/assets/fonts/light-f591b13f7d-v2.woff +0 -0
  340. data/vendor/assets/assets/images/favicon.ico +0 -0
  341. data/vendor/assets/assets/images/favicon.svg +1 -0
  342. data/vendor/assets/assets/images/govuk-crest.svg +1 -0
  343. data/vendor/assets/assets/images/govuk-icon-180.png +0 -0
  344. data/vendor/assets/assets/images/govuk-icon-192.png +0 -0
  345. data/vendor/assets/assets/images/govuk-icon-512.png +0 -0
  346. data/vendor/assets/assets/images/govuk-icon-mask.svg +1 -0
  347. data/vendor/assets/assets/images/govuk-opengraph-image.png +0 -0
  348. data/vendor/assets/assets/manifest.json +39 -0
  349. data/vendor/assets/assets/rebrand/images/favicon.ico +0 -0
  350. data/vendor/assets/assets/rebrand/images/favicon.svg +1 -0
  351. data/vendor/assets/assets/rebrand/images/govuk-crest.svg +1 -0
  352. data/vendor/assets/assets/rebrand/images/govuk-icon-180.png +0 -0
  353. data/vendor/assets/assets/rebrand/images/govuk-icon-192.png +0 -0
  354. data/vendor/assets/assets/rebrand/images/govuk-icon-512.png +0 -0
  355. data/vendor/assets/assets/rebrand/images/govuk-icon-mask.svg +1 -0
  356. data/vendor/assets/assets/rebrand/images/govuk-opengraph-image.png +0 -0
  357. data/vendor/assets/assets/rebrand/manifest.json +39 -0
  358. data/vendor/assets/images/govuk-crest.svg +1 -0
  359. data/vendor/assets/javascripts/defra_ruby_template.js +882 -492
  360. data/vendor/assets/stylesheets/all.scss +6 -0
  361. data/vendor/assets/stylesheets/components/_index.scss +1 -0
  362. data/vendor/assets/stylesheets/components/accordion/_index.scss +35 -31
  363. data/vendor/assets/stylesheets/components/character-count/_index.scss +12 -4
  364. data/vendor/assets/stylesheets/components/checkboxes/_index.scss +6 -1
  365. data/vendor/assets/stylesheets/components/cookie-banner/_index.scss +23 -14
  366. data/vendor/assets/stylesheets/components/date-input/_index.scss +2 -2
  367. data/vendor/assets/stylesheets/components/details/_index.scss +7 -2
  368. data/vendor/assets/stylesheets/components/error-summary/_index.scss +4 -0
  369. data/vendor/assets/stylesheets/components/fieldset/_index.scss +3 -5
  370. data/vendor/assets/stylesheets/components/file-upload/_index.scss +175 -9
  371. data/vendor/assets/stylesheets/components/footer/_index.scss +61 -19
  372. data/vendor/assets/stylesheets/components/header/_index.scss +223 -21
  373. data/vendor/assets/stylesheets/components/input/_index.scss +7 -4
  374. data/vendor/assets/stylesheets/components/notification-banner/_index.scss +3 -2
  375. data/vendor/assets/stylesheets/components/pagination/_index.scss +24 -37
  376. data/vendor/assets/stylesheets/components/panel/_index.scss +13 -9
  377. data/vendor/assets/stylesheets/components/password-input/_index.scss +12 -9
  378. data/vendor/assets/stylesheets/components/phase-banner/_index.scss +0 -8
  379. data/vendor/assets/stylesheets/components/radios/_index.scss +7 -5
  380. data/vendor/assets/stylesheets/components/select/_index.scss +5 -5
  381. data/vendor/assets/stylesheets/components/service-navigation/_index.scss +187 -0
  382. data/vendor/assets/stylesheets/components/service-navigation/_service-navigation.scss +4 -0
  383. data/vendor/assets/stylesheets/components/skip-link/_index.scss +6 -4
  384. data/vendor/assets/stylesheets/components/summary-list/_index.scss +14 -22
  385. data/vendor/assets/stylesheets/components/tag/_index.scss +11 -8
  386. data/vendor/assets/stylesheets/components/task-list/_index.scss +12 -10
  387. data/vendor/assets/stylesheets/components/textarea/_index.scss +3 -3
  388. data/vendor/assets/stylesheets/components/warning-text/_index.scss +6 -5
  389. data/vendor/assets/stylesheets/core/_govuk-frontend-properties.scss +1 -1
  390. data/vendor/assets/stylesheets/defra_ruby_template.scss +6 -0
  391. data/vendor/assets/stylesheets/govuk-frontend.min.css +2 -2
  392. data/vendor/assets/stylesheets/helpers/_colour.scss +55 -8
  393. data/vendor/assets/stylesheets/helpers/_focused.scss +14 -4
  394. data/vendor/assets/stylesheets/helpers/_grid.scss +1 -1
  395. data/vendor/assets/stylesheets/helpers/_links.scss +2 -2
  396. data/vendor/assets/stylesheets/helpers/_shape-arrow.scss +1 -1
  397. data/vendor/assets/stylesheets/helpers/_typography.scss +18 -1
  398. data/vendor/assets/stylesheets/helpers/_visually-hidden.scss +30 -62
  399. data/vendor/assets/stylesheets/objects/_template.scss +5 -1
  400. data/vendor/assets/stylesheets/overrides/_typography.scss +5 -1
  401. data/vendor/assets/stylesheets/settings/_colours-applied.scss +39 -1
  402. data/vendor/assets/stylesheets/settings/_colours-organisations.scss +244 -10
  403. data/vendor/assets/stylesheets/settings/_typography-responsive.scss +5 -10
  404. data/vendor/assets/stylesheets/tools/_index.scss +1 -0
  405. data/vendor/assets/stylesheets/tools/_rebrand.scss +65 -0
  406. metadata +100 -24
  407. data/.github/dependabot.yml +0 -14
  408. data/.github/workflows/ci.yml +0 -31
  409. data/.gitignore +0 -8
  410. data/.rspec +0 -1
  411. data/.rubocop.yml +0 -3
  412. data/.ruby-version +0 -1
  413. data/Gemfile +0 -9
  414. data/Gemfile.lock +0 -58
  415. data/defra_ruby_template.gemspec +0 -35
  416. data/node_modules/.package-lock.json +0 -16
  417. data/node_modules/govuk-frontend/dist/govuk/assets/images/govuk-crest-2x.png +0 -0
  418. data/node_modules/govuk-frontend/dist/govuk/assets/images/govuk-crest.png +0 -0
  419. data/node_modules/govuk-frontend/dist/govuk/common/normalise-dataset.mjs +0 -18
  420. data/node_modules/govuk-frontend/dist/govuk/common/normalise-dataset.mjs.map +0 -1
  421. data/node_modules/govuk-frontend/dist/govuk/common/normalise-string.mjs +0 -31
  422. data/node_modules/govuk-frontend/dist/govuk/common/normalise-string.mjs.map +0 -1
  423. data/node_modules/govuk-frontend/dist/govuk/components/file-upload/template-with-value.html +0 -6
  424. data/node_modules/govuk-frontend/dist/govuk/govuk-frontend-component.mjs +0 -16
  425. data/node_modules/govuk-frontend/dist/govuk/govuk-frontend-component.mjs.map +0 -1
  426. data/package-lock.json +0 -24
  427. data/package.json +0 -29
@@ -1 +1 @@
1
- {"version":3,"file":"tabs.bundle.js","sources":["../../../../src/govuk/common/index.mjs","../../../../src/govuk/errors/index.mjs","../../../../src/govuk/govuk-frontend-component.mjs","../../../../src/govuk/components/tabs/tabs.mjs"],"sourcesContent":["import { normaliseString } from './normalise-string.mjs'\n\n/**\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 * Config merging function\n *\n * Takes any number of objects and combines them together, with\n * greatest priority on the LAST item passed in.\n *\n * @internal\n * @param {...{ [key: string]: unknown }} configObjects - Config objects to merge\n * @returns {{ [key: string]: unknown }} A merged config object\n */\nexport function mergeConfigs(...configObjects) {\n // Start with an empty object as our base\n /** @type {{ [key: string]: unknown }} */\n const formattedConfigObject = {}\n\n // Loop through each of the passed objects\n for (const configObject of configObjects) {\n for (const key of Object.keys(configObject)) {\n const option = formattedConfigObject[key]\n const override = configObject[key]\n\n // Push their keys one-by-one into formattedConfigObject. Any duplicate\n // keys with object values will be merged, otherwise the new value will\n // override the existing value.\n if (isObject(option) && isObject(override)) {\n // @ts-expect-error Index signature for type 'string' is missing\n formattedConfigObject[key] = mergeConfigs(option, override)\n } else {\n // Apply override\n formattedConfigObject[key] = override\n }\n }\n }\n\n return formattedConfigObject\n}\n\n/**\n * Extracts keys starting with a particular namespace from dataset ('data-*')\n * object, removing the namespace in the process, normalising all values\n *\n * @internal\n * @param {{ schema: Schema }} Component - Component class\n * @param {DOMStringMap} dataset - The object to extract key-value pairs from\n * @param {string} namespace - The namespace to filter keys with\n * @returns {ObjectNested | undefined} Nested object with dot-separated key namespace removed\n */\nexport function extractConfigByNamespace(Component, dataset, namespace) {\n const property = Component.schema.properties[namespace]\n\n // Only extract configs for object schema properties\n if (property?.type !== 'object') {\n return\n }\n\n // Add default empty config\n const newObject = {\n [namespace]: /** @type {ObjectNested} */ ({})\n }\n\n for (const [key, value] of Object.entries(dataset)) {\n /** @type {ObjectNested | ObjectNested[NestedKey]} */\n let current = newObject\n\n // Split the key into parts, using . as our namespace separator\n const keyParts = key.split('.')\n\n /**\n * Create new level per part\n *\n * e.g. 'i18n.textareaDescription.other' becomes\n * `{ i18n: { textareaDescription: { other } } }`\n */\n for (const [index, name] of keyParts.entries()) {\n if (typeof current === 'object') {\n // Drop down to nested object until the last part\n if (index < keyParts.length - 1) {\n // New nested object (optionally) replaces existing value\n if (!isObject(current[name])) {\n current[name] = {}\n }\n\n // Drop down into new or existing nested object\n current = current[name]\n } else if (key !== namespace) {\n // Normalised value (optionally) replaces existing value\n current[name] = normaliseString(value)\n }\n }\n }\n }\n\n return newObject[namespace]\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 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 * @internal\n * @param {HTMLElement | null} [$scope] - HTML element `<body>` 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 * Validate component config by schema\n *\n * Follows limited examples in JSON schema for wider support in future\n *\n * {@link https://ajv.js.org/json-schema.html#compound-keywords}\n * {@link https://ajv.js.org/packages/ajv-errors.html#single-message}\n *\n * @internal\n * @param {Schema} schema - Config schema\n * @param {{ [key: string]: unknown }} config - Component config\n * @returns {string[]} List of validation errors\n */\nexport function validateConfig(schema, config) {\n const validationErrors = []\n\n // Check errors for each schema\n for (const [name, conditions] of Object.entries(schema)) {\n const errors = []\n\n // Check errors for each schema condition\n if (Array.isArray(conditions)) {\n for (const { required, errorMessage } of conditions) {\n if (!required.every((key) => !!config[key])) {\n errors.push(errorMessage) // Missing config key value\n }\n }\n\n // Check one condition passes or add errors\n if (name === 'anyOf' && !(conditions.length - errors.length >= 1)) {\n validationErrors.push(...errors)\n }\n }\n }\n\n return validationErrors\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 */\nfunction isObject(option) {\n return !!option && typeof option === 'object' && !isArray(option)\n}\n\n/**\n * Schema for component config\n *\n * @typedef {object} Schema\n * @property {{ [field: string]: SchemaProperty | undefined }} properties - Schema properties\n * @property {SchemaCondition[]} [anyOf] - List of schema conditions\n */\n\n/**\n * Schema property for component config\n *\n * @typedef {object} SchemaProperty\n * @property {'string' | 'boolean' | 'number' | 'object'} type - Property type\n */\n\n/**\n * Schema condition for component config\n *\n * @typedef {object} SchemaCondition\n * @property {string[]} required - List of required config fields\n * @property {string} errorMessage - Error message when required config fields not provided\n */\n\n/**\n * @internal\n * @typedef {keyof ObjectNested} NestedKey\n * @typedef {{ [key: string]: string | boolean | number | ObjectNested | undefined }} ObjectNested\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 * @abstract\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 { componentName, identifier, element, expectedType } =\n messageOrOptions\n\n // Add prefix and identifier\n message = `${componentName}: ${identifier}`\n\n // Append reason\n message += element\n ? ` is not of type ${expectedType ?? 'HTMLElement'}`\n : ' not found'\n }\n\n super(message)\n }\n}\n\n/**\n * Element error options\n *\n * @internal\n * @typedef {object} ElementErrorOptions\n * @property {string} componentName - The name of the component throwing the error\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 */\n","import { isSupported } from './common/index.mjs'\nimport { SupportError } from './errors/index.mjs'\n\n/**\n * Base Component class\n *\n * Centralises the behaviours shared by our components\n *\n * @internal\n * @abstract\n */\nexport class GOVUKFrontendComponent {\n /**\n * Constructs a new component, validating that GOV.UK Frontend is supported\n *\n * @internal\n */\n constructor() {\n this.checkSupport()\n }\n\n /**\n * Validates whether GOV.UK Frontend is supported\n *\n * @private\n * @throws {SupportError} when GOV.UK Frontend is not supported\n */\n checkSupport() {\n if (!isSupported()) {\n throw new SupportError()\n }\n }\n}\n","import { getBreakpoint, getFragmentFromUrl } from '../../common/index.mjs'\nimport { ElementError } from '../../errors/index.mjs'\nimport { GOVUKFrontendComponent } from '../../govuk-frontend-component.mjs'\n\n/**\n * Tabs component\n *\n * @preserve\n */\nexport class Tabs extends GOVUKFrontendComponent {\n /** @private */\n $module\n\n /** @private */\n $tabs\n\n /** @private */\n $tabList\n\n /** @private */\n $tabListItems\n\n /** @private */\n jsHiddenClass = 'govuk-tabs__panel--hidden'\n\n /** @private */\n changingHash = false\n\n /** @private */\n boundTabClick\n\n /** @private */\n boundTabKeydown\n\n /** @private */\n boundOnHashChange\n\n /**\n * @private\n * @type {MediaQueryList | null}\n */\n mql = null\n\n /**\n * @param {Element | null} $module - HTML element to use for tabs\n */\n constructor($module) {\n super()\n\n if (!$module) {\n throw new ElementError({\n componentName: 'Tabs',\n element: $module,\n identifier: 'Root element (`$module`)'\n })\n }\n\n const $tabs = $module.querySelectorAll('a.govuk-tabs__tab')\n if (!$tabs.length) {\n throw new ElementError({\n componentName: 'Tabs',\n identifier: 'Links (`<a class=\"govuk-tabs__tab\">`)'\n })\n }\n\n this.$module = $module\n this.$tabs = $tabs\n\n // Save bound functions so we can remove event listeners during teardown\n this.boundTabClick = this.onTabClick.bind(this)\n this.boundTabKeydown = this.onTabKeydown.bind(this)\n this.boundOnHashChange = this.onHashChange.bind(this)\n\n const $tabList = this.$module.querySelector('.govuk-tabs__list')\n const $tabListItems = this.$module.querySelectorAll(\n 'li.govuk-tabs__list-item'\n )\n\n if (!$tabList) {\n throw new ElementError({\n componentName: 'Tabs',\n identifier: 'List (`<ul class=\"govuk-tabs__list\">`)'\n })\n }\n\n if (!$tabListItems.length) {\n throw new ElementError({\n componentName: 'Tabs',\n identifier: 'List items (`<li class=\"govuk-tabs__list-item\">`)'\n })\n }\n\n this.$tabList = $tabList\n this.$tabListItems = $tabListItems\n\n this.setupResponsiveChecks()\n }\n\n /**\n * Setup viewport resize check\n *\n * @private\n */\n setupResponsiveChecks() {\n const breakpoint = getBreakpoint('tablet')\n\n if (!breakpoint.value) {\n throw new ElementError({\n componentName: 'Tabs',\n identifier: `CSS custom property (\\`${breakpoint.property}\\`) on pseudo-class \\`:root\\``\n })\n }\n\n // Media query list for GOV.UK Frontend tablet 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 * Setup or teardown handler for viewport resize check\n *\n * @private\n */\n checkMode() {\n if (this.mql?.matches) {\n this.setup()\n } else {\n this.teardown()\n }\n }\n\n /**\n * Setup tab component\n *\n * @private\n */\n setup() {\n this.$tabList.setAttribute('role', 'tablist')\n\n this.$tabListItems.forEach(($item) => {\n $item.setAttribute('role', 'presentation')\n })\n\n this.$tabs.forEach(($tab) => {\n // Set HTML attributes\n this.setAttributes($tab)\n\n // Handle events\n $tab.addEventListener('click', this.boundTabClick, true)\n $tab.addEventListener('keydown', this.boundTabKeydown, true)\n\n // Remove old active panels\n this.hideTab($tab)\n })\n\n // Show either the active tab according to the URL's hash or the first tab\n const $activeTab = this.getTab(window.location.hash) ?? this.$tabs[0]\n\n this.showTab($activeTab)\n\n // Handle hashchange events\n window.addEventListener('hashchange', this.boundOnHashChange, true)\n }\n\n /**\n * Teardown tab component\n *\n * @private\n */\n teardown() {\n this.$tabList.removeAttribute('role')\n\n this.$tabListItems.forEach(($item) => {\n $item.removeAttribute('role')\n })\n\n this.$tabs.forEach(($tab) => {\n // Remove events\n $tab.removeEventListener('click', this.boundTabClick, true)\n $tab.removeEventListener('keydown', this.boundTabKeydown, true)\n\n // Unset HTML attributes\n this.unsetAttributes($tab)\n })\n\n // Remove hashchange event handler\n window.removeEventListener('hashchange', this.boundOnHashChange, true)\n }\n\n /**\n * Handle hashchange event\n *\n * @private\n * @returns {void | undefined} Returns void, or undefined when prevented\n */\n onHashChange() {\n const hash = window.location.hash\n const $tabWithHash = this.getTab(hash)\n if (!$tabWithHash) {\n return\n }\n\n // Prevent changing the hash\n if (this.changingHash) {\n this.changingHash = false\n return\n }\n\n // Show either the active tab according to the URL's hash or the first tab\n const $previousTab = this.getCurrentTab()\n if (!$previousTab) {\n return\n }\n\n this.hideTab($previousTab)\n this.showTab($tabWithHash)\n $tabWithHash.focus()\n }\n\n /**\n * Hide panel for tab link\n *\n * @private\n * @param {HTMLAnchorElement} $tab - Tab link\n */\n hideTab($tab) {\n this.unhighlightTab($tab)\n this.hidePanel($tab)\n }\n\n /**\n * Show panel for tab link\n *\n * @private\n * @param {HTMLAnchorElement} $tab - Tab link\n */\n showTab($tab) {\n this.highlightTab($tab)\n this.showPanel($tab)\n }\n\n /**\n * Get tab link by hash\n *\n * @private\n * @param {string} hash - Hash fragment including #\n * @returns {HTMLAnchorElement | null} Tab link\n */\n getTab(hash) {\n return this.$module.querySelector(`a.govuk-tabs__tab[href=\"${hash}\"]`)\n }\n\n /**\n * Set tab link and panel attributes\n *\n * @private\n * @param {HTMLAnchorElement} $tab - Tab link\n */\n setAttributes($tab) {\n const panelId = getFragmentFromUrl($tab.href)\n if (!panelId) {\n return\n }\n\n // Set tab attributes\n $tab.setAttribute('id', `tab_${panelId}`)\n $tab.setAttribute('role', 'tab')\n $tab.setAttribute('aria-controls', panelId)\n $tab.setAttribute('aria-selected', 'false')\n $tab.setAttribute('tabindex', '-1')\n\n // Set panel attributes\n const $panel = this.getPanel($tab)\n if (!$panel) {\n return\n }\n\n $panel.setAttribute('role', 'tabpanel')\n $panel.setAttribute('aria-labelledby', $tab.id)\n $panel.classList.add(this.jsHiddenClass)\n }\n\n /**\n * Unset tab link and panel attributes\n *\n * @private\n * @param {HTMLAnchorElement} $tab - Tab link\n */\n unsetAttributes($tab) {\n // unset tab attributes\n $tab.removeAttribute('id')\n $tab.removeAttribute('role')\n $tab.removeAttribute('aria-controls')\n $tab.removeAttribute('aria-selected')\n $tab.removeAttribute('tabindex')\n\n // unset panel attributes\n const $panel = this.getPanel($tab)\n if (!$panel) {\n return\n }\n\n $panel.removeAttribute('role')\n $panel.removeAttribute('aria-labelledby')\n $panel.classList.remove(this.jsHiddenClass)\n }\n\n /**\n * Handle tab link clicks\n *\n * @private\n * @param {MouseEvent} event - Mouse click event\n * @returns {void} Returns void\n */\n onTabClick(event) {\n const $currentTab = this.getCurrentTab()\n const $nextTab = event.currentTarget\n\n if (!$currentTab || !($nextTab instanceof HTMLAnchorElement)) {\n return\n }\n\n event.preventDefault()\n\n this.hideTab($currentTab)\n this.showTab($nextTab)\n this.createHistoryEntry($nextTab)\n }\n\n /**\n * Update browser URL hash fragment for tab\n *\n * - Allows back/forward to navigate tabs\n * - Avoids page jump when hash changes\n *\n * @private\n * @param {HTMLAnchorElement} $tab - Tab link\n */\n createHistoryEntry($tab) {\n const $panel = this.getPanel($tab)\n if (!$panel) {\n return\n }\n\n // Save and restore the id so the page doesn't jump when a user clicks a tab\n // (which changes the hash)\n const panelId = $panel.id\n $panel.id = ''\n this.changingHash = true\n window.location.hash = panelId\n $panel.id = panelId\n }\n\n /**\n * Handle tab keydown event\n *\n * - Press right/down arrow for next tab\n * - Press left/up arrow for previous tab\n *\n * @private\n * @param {KeyboardEvent} event - Keydown event\n */\n onTabKeydown(event) {\n switch (event.key) {\n // 'Left', 'Right', 'Up' and 'Down' required for Edge 16 support.\n case 'ArrowLeft':\n case 'ArrowUp':\n case 'Left':\n case 'Up':\n this.activatePreviousTab()\n event.preventDefault()\n break\n case 'ArrowRight':\n case 'ArrowDown':\n case 'Right':\n case 'Down':\n this.activateNextTab()\n event.preventDefault()\n break\n }\n }\n\n /**\n * Activate next tab\n *\n * @private\n */\n activateNextTab() {\n const $currentTab = this.getCurrentTab()\n if (!$currentTab?.parentElement) {\n return\n }\n\n const $nextTabListItem = $currentTab.parentElement.nextElementSibling\n if (!$nextTabListItem) {\n return\n }\n\n const $nextTab = $nextTabListItem.querySelector('a.govuk-tabs__tab')\n if (!$nextTab) {\n return\n }\n\n this.hideTab($currentTab)\n this.showTab($nextTab)\n $nextTab.focus()\n this.createHistoryEntry($nextTab)\n }\n\n /**\n * Activate previous tab\n *\n * @private\n */\n activatePreviousTab() {\n const $currentTab = this.getCurrentTab()\n if (!$currentTab?.parentElement) {\n return\n }\n\n const $previousTabListItem =\n $currentTab.parentElement.previousElementSibling\n if (!$previousTabListItem) {\n return\n }\n\n const $previousTab = $previousTabListItem.querySelector('a.govuk-tabs__tab')\n if (!$previousTab) {\n return\n }\n\n this.hideTab($currentTab)\n this.showTab($previousTab)\n $previousTab.focus()\n this.createHistoryEntry($previousTab)\n }\n\n /**\n * Get tab panel for tab link\n *\n * @private\n * @param {HTMLAnchorElement} $tab - Tab link\n * @returns {Element | null} Tab panel\n */\n getPanel($tab) {\n const panelId = getFragmentFromUrl($tab.href)\n if (!panelId) {\n return null\n }\n\n return this.$module.querySelector(`#${panelId}`)\n }\n\n /**\n * Show tab panel for tab link\n *\n * @private\n * @param {HTMLAnchorElement} $tab - Tab link\n */\n showPanel($tab) {\n const $panel = this.getPanel($tab)\n if (!$panel) {\n return\n }\n\n $panel.classList.remove(this.jsHiddenClass)\n }\n\n /**\n * Hide tab panel for tab link\n *\n * @private\n * @param {HTMLAnchorElement} $tab - Tab link\n */\n hidePanel($tab) {\n const $panel = this.getPanel($tab)\n if (!$panel) {\n return\n }\n\n $panel.classList.add(this.jsHiddenClass)\n }\n\n /**\n * Unset 'selected' state for tab link\n *\n * @private\n * @param {HTMLAnchorElement} $tab - Tab link\n */\n unhighlightTab($tab) {\n if (!$tab.parentElement) {\n return\n }\n\n $tab.setAttribute('aria-selected', 'false')\n $tab.parentElement.classList.remove('govuk-tabs__list-item--selected')\n $tab.setAttribute('tabindex', '-1')\n }\n\n /**\n * Set 'selected' state for tab link\n *\n * @private\n * @param {HTMLAnchorElement} $tab - Tab link\n */\n highlightTab($tab) {\n if (!$tab.parentElement) {\n return\n }\n\n $tab.setAttribute('aria-selected', 'true')\n $tab.parentElement.classList.add('govuk-tabs__list-item--selected')\n $tab.setAttribute('tabindex', '0')\n }\n\n /**\n * Get current tab link\n *\n * @private\n * @returns {HTMLAnchorElement | null} Tab link\n */\n getCurrentTab() {\n return this.$module.querySelector(\n '.govuk-tabs__list-item--selected a.govuk-tabs__tab'\n )\n }\n\n /**\n * Name for the component used when initialising using data-module attributes.\n */\n static moduleName = 'govuk-tabs'\n}\n"],"names":["getFragmentFromUrl","url","includes","undefined","split","pop","getBreakpoint","name","property","value","window","getComputedStyle","document","documentElement","getPropertyValue","isSupported","$scope","body","classList","contains","GOVUKFrontendError","Error","constructor","args","SupportError","supportMessage","HTMLScriptElement","prototype","ElementError","messageOrOptions","message","componentName","identifier","element","expectedType","GOVUKFrontendComponent","checkSupport","Tabs","$module","$tabs","$tabList","$tabListItems","jsHiddenClass","changingHash","boundTabClick","boundTabKeydown","boundOnHashChange","mql","querySelectorAll","length","onTabClick","bind","onTabKeydown","onHashChange","querySelector","setupResponsiveChecks","breakpoint","matchMedia","addEventListener","checkMode","addListener","_this$mql","matches","setup","teardown","_this$getTab","setAttribute","forEach","$item","$tab","setAttributes","hideTab","$activeTab","getTab","location","hash","showTab","removeAttribute","removeEventListener","unsetAttributes","$tabWithHash","$previousTab","getCurrentTab","focus","unhighlightTab","hidePanel","highlightTab","showPanel","panelId","href","$panel","getPanel","id","add","remove","event","$currentTab","$nextTab","currentTarget","HTMLAnchorElement","preventDefault","createHistoryEntry","key","activatePreviousTab","activateNextTab","parentElement","$nextTabListItem","nextElementSibling","$previousTabListItem","previousElementSibling","moduleName"],"mappings":";;;;;;EAmHO,SAASA,kBAAkBA,CAACC,GAAG,EAAE;EACtC,EAAA,IAAI,CAACA,GAAG,CAACC,QAAQ,CAAC,GAAG,CAAC,EAAE;EACtB,IAAA,OAAOC,SAAS,CAAA;EAClB,GAAA;IAEA,OAAOF,GAAG,CAACG,KAAK,CAAC,GAAG,CAAC,CAACC,GAAG,EAAE,CAAA;EAC7B,CAAA;EASO,SAASC,aAAaA,CAACC,IAAI,EAAE;EAClC,EAAA,MAAMC,QAAQ,GAAI,CAA8BD,4BAAAA,EAAAA,IAAK,CAAC,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,IAAIN,SAAAA;KACjB,CAAA;EACH,CAAA;EA0DO,SAASY,WAAWA,CAACC,MAAM,GAAGJ,QAAQ,CAACK,IAAI,EAAE;IAClD,IAAI,CAACD,MAAM,EAAE;EACX,IAAA,O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AAA,IAAI,CAACH,YAAY,CAAC,UAAU,EAAE,GAAG,CAAC,CAAA;EACpC,GAAA;EAQAgB,EAAAA,aAAaA,GAAG;EACd,IAAA,OAAO,IAAI,CAAC5C,OAAO,CAACgB,aAAa,CAC/B,oDACF,CAAC,CAAA;EACH,GAAA;EAMF,CAAA;EArhBajB,IAAI,CAohBRyE,UAAU,GAAG,YAAY;;;;;;;;"}
1
+ {"version":3,"file":"tabs.bundle.js","sources":["../../../../src/govuk/common/index.mjs","../../../../src/govuk/errors/index.mjs","../../../../src/govuk/component.mjs","../../../../src/govuk/components/tabs/tabs.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, getFragmentFromUrl } from '../../common/index.mjs'\nimport { Component } from '../../component.mjs'\nimport { ElementError } from '../../errors/index.mjs'\n\n/**\n * Tabs component\n *\n * @preserve\n */\nexport class Tabs extends Component {\n /** @private */\n $tabs\n\n /** @private */\n $tabList\n\n /** @private */\n $tabListItems\n\n /** @private */\n jsHiddenClass = 'govuk-tabs__panel--hidden'\n\n /** @private */\n changingHash = false\n\n /** @private */\n boundTabClick\n\n /** @private */\n boundTabKeydown\n\n /** @private */\n boundOnHashChange\n\n /**\n * @private\n * @type {MediaQueryList | null}\n */\n mql = null\n\n /**\n * @param {Element | null} $root - HTML element to use for tabs\n */\n constructor($root) {\n super($root)\n\n const $tabs = this.$root.querySelectorAll('a.govuk-tabs__tab')\n if (!$tabs.length) {\n throw new ElementError({\n component: Tabs,\n identifier: 'Links (`<a class=\"govuk-tabs__tab\">`)'\n })\n }\n\n this.$tabs = $tabs\n\n // Save bound functions so we can remove event listeners during teardown\n this.boundTabClick = this.onTabClick.bind(this)\n this.boundTabKeydown = this.onTabKeydown.bind(this)\n this.boundOnHashChange = this.onHashChange.bind(this)\n\n const $tabList = this.$root.querySelector('.govuk-tabs__list')\n const $tabListItems = this.$root.querySelectorAll(\n 'li.govuk-tabs__list-item'\n )\n\n if (!$tabList) {\n throw new ElementError({\n component: Tabs,\n identifier: 'List (`<ul class=\"govuk-tabs__list\">`)'\n })\n }\n\n if (!$tabListItems.length) {\n throw new ElementError({\n component: Tabs,\n identifier: 'List items (`<li class=\"govuk-tabs__list-item\">`)'\n })\n }\n\n this.$tabList = $tabList\n this.$tabListItems = $tabListItems\n\n this.setupResponsiveChecks()\n }\n\n /**\n * Setup viewport resize check\n *\n * @private\n */\n setupResponsiveChecks() {\n const breakpoint = getBreakpoint('tablet')\n\n if (!breakpoint.value) {\n throw new ElementError({\n component: Tabs,\n identifier: `CSS custom property (\\`${breakpoint.property}\\`) on pseudo-class \\`:root\\``\n })\n }\n\n // Media query list for GOV.UK Frontend tablet 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 * Setup or teardown handler for viewport resize check\n *\n * @private\n */\n checkMode() {\n if (this.mql?.matches) {\n this.setup()\n } else {\n this.teardown()\n }\n }\n\n /**\n * Setup tab component\n *\n * @private\n */\n setup() {\n this.$tabList.setAttribute('role', 'tablist')\n\n this.$tabListItems.forEach(($item) => {\n $item.setAttribute('role', 'presentation')\n })\n\n this.$tabs.forEach(($tab) => {\n // Set HTML attributes\n this.setAttributes($tab)\n\n // Handle events\n $tab.addEventListener('click', this.boundTabClick, true)\n $tab.addEventListener('keydown', this.boundTabKeydown, true)\n\n // Remove old active panels\n this.hideTab($tab)\n })\n\n // Show either the active tab according to the URL's hash or the first tab\n const $activeTab = this.getTab(window.location.hash) ?? this.$tabs[0]\n\n this.showTab($activeTab)\n\n // Handle hashchange events\n window.addEventListener('hashchange', this.boundOnHashChange, true)\n }\n\n /**\n * Teardown tab component\n *\n * @private\n */\n teardown() {\n this.$tabList.removeAttribute('role')\n\n this.$tabListItems.forEach(($item) => {\n $item.removeAttribute('role')\n })\n\n this.$tabs.forEach(($tab) => {\n // Remove events\n $tab.removeEventListener('click', this.boundTabClick, true)\n $tab.removeEventListener('keydown', this.boundTabKeydown, true)\n\n // Unset HTML attributes\n this.unsetAttributes($tab)\n })\n\n // Remove hashchange event handler\n window.removeEventListener('hashchange', this.boundOnHashChange, true)\n }\n\n /**\n * Handle hashchange event\n *\n * @private\n * @returns {void | undefined} Returns void, or undefined when prevented\n */\n onHashChange() {\n const hash = window.location.hash\n const $tabWithHash = this.getTab(hash)\n if (!$tabWithHash) {\n return\n }\n\n // Prevent changing the hash\n if (this.changingHash) {\n this.changingHash = false\n return\n }\n\n // Show either the active tab according to the URL's hash or the first tab\n const $previousTab = this.getCurrentTab()\n if (!$previousTab) {\n return\n }\n\n this.hideTab($previousTab)\n this.showTab($tabWithHash)\n $tabWithHash.focus()\n }\n\n /**\n * Hide panel for tab link\n *\n * @private\n * @param {HTMLAnchorElement} $tab - Tab link\n */\n hideTab($tab) {\n this.unhighlightTab($tab)\n this.hidePanel($tab)\n }\n\n /**\n * Show panel for tab link\n *\n * @private\n * @param {HTMLAnchorElement} $tab - Tab link\n */\n showTab($tab) {\n this.highlightTab($tab)\n this.showPanel($tab)\n }\n\n /**\n * Get tab link by hash\n *\n * @private\n * @param {string} hash - Hash fragment including #\n * @returns {HTMLAnchorElement | null} Tab link\n */\n getTab(hash) {\n return this.$root.querySelector(`a.govuk-tabs__tab[href=\"${hash}\"]`)\n }\n\n /**\n * Set tab link and panel attributes\n *\n * @private\n * @param {HTMLAnchorElement} $tab - Tab link\n */\n setAttributes($tab) {\n const panelId = getFragmentFromUrl($tab.href)\n if (!panelId) {\n return\n }\n\n // Set tab attributes\n $tab.setAttribute('id', `tab_${panelId}`)\n $tab.setAttribute('role', 'tab')\n $tab.setAttribute('aria-controls', panelId)\n $tab.setAttribute('aria-selected', 'false')\n $tab.setAttribute('tabindex', '-1')\n\n // Set panel attributes\n const $panel = this.getPanel($tab)\n if (!$panel) {\n return\n }\n\n $panel.setAttribute('role', 'tabpanel')\n $panel.setAttribute('aria-labelledby', $tab.id)\n $panel.classList.add(this.jsHiddenClass)\n }\n\n /**\n * Unset tab link and panel attributes\n *\n * @private\n * @param {HTMLAnchorElement} $tab - Tab link\n */\n unsetAttributes($tab) {\n // unset tab attributes\n $tab.removeAttribute('id')\n $tab.removeAttribute('role')\n $tab.removeAttribute('aria-controls')\n $tab.removeAttribute('aria-selected')\n $tab.removeAttribute('tabindex')\n\n // unset panel attributes\n const $panel = this.getPanel($tab)\n if (!$panel) {\n return\n }\n\n $panel.removeAttribute('role')\n $panel.removeAttribute('aria-labelledby')\n $panel.classList.remove(this.jsHiddenClass)\n }\n\n /**\n * Handle tab link clicks\n *\n * @private\n * @param {MouseEvent} event - Mouse click event\n * @returns {void} Returns void\n */\n onTabClick(event) {\n const $currentTab = this.getCurrentTab()\n const $nextTab = event.currentTarget\n\n if (!$currentTab || !($nextTab instanceof HTMLAnchorElement)) {\n return\n }\n\n event.preventDefault()\n\n this.hideTab($currentTab)\n this.showTab($nextTab)\n this.createHistoryEntry($nextTab)\n }\n\n /**\n * Update browser URL hash fragment for tab\n *\n * - Allows back/forward to navigate tabs\n * - Avoids page jump when hash changes\n *\n * @private\n * @param {HTMLAnchorElement} $tab - Tab link\n */\n createHistoryEntry($tab) {\n const $panel = this.getPanel($tab)\n if (!$panel) {\n return\n }\n\n // Save and restore the id so the page doesn't jump when a user clicks a tab\n // (which changes the hash)\n const panelId = $panel.id\n $panel.id = ''\n this.changingHash = true\n window.location.hash = panelId\n $panel.id = panelId\n }\n\n /**\n * Handle tab keydown event\n *\n * - Press right arrow for next tab\n * - Press left arrow for previous tab\n *\n * @private\n * @param {KeyboardEvent} event - Keydown event\n */\n onTabKeydown(event) {\n switch (event.key) {\n // 'Left' and 'Right' required for Edge 16 support.\n case 'ArrowLeft':\n case 'Left':\n this.activatePreviousTab()\n event.preventDefault()\n break\n case 'ArrowRight':\n case 'Right':\n this.activateNextTab()\n event.preventDefault()\n break\n }\n }\n\n /**\n * Activate next tab\n *\n * @private\n */\n activateNextTab() {\n const $currentTab = this.getCurrentTab()\n if (!$currentTab?.parentElement) {\n return\n }\n\n const $nextTabListItem = $currentTab.parentElement.nextElementSibling\n if (!$nextTabListItem) {\n return\n }\n\n const $nextTab = $nextTabListItem.querySelector('a.govuk-tabs__tab')\n if (!$nextTab) {\n return\n }\n\n this.hideTab($currentTab)\n this.showTab($nextTab)\n $nextTab.focus()\n this.createHistoryEntry($nextTab)\n }\n\n /**\n * Activate previous tab\n *\n * @private\n */\n activatePreviousTab() {\n const $currentTab = this.getCurrentTab()\n if (!$currentTab?.parentElement) {\n return\n }\n\n const $previousTabListItem =\n $currentTab.parentElement.previousElementSibling\n if (!$previousTabListItem) {\n return\n }\n\n const $previousTab = $previousTabListItem.querySelector('a.govuk-tabs__tab')\n if (!$previousTab) {\n return\n }\n\n this.hideTab($currentTab)\n this.showTab($previousTab)\n $previousTab.focus()\n this.createHistoryEntry($previousTab)\n }\n\n /**\n * Get tab panel for tab link\n *\n * @private\n * @param {HTMLAnchorElement} $tab - Tab link\n * @returns {Element | null} Tab panel\n */\n getPanel($tab) {\n const panelId = getFragmentFromUrl($tab.href)\n if (!panelId) {\n return null\n }\n\n return this.$root.querySelector(`#${panelId}`)\n }\n\n /**\n * Show tab panel for tab link\n *\n * @private\n * @param {HTMLAnchorElement} $tab - Tab link\n */\n showPanel($tab) {\n const $panel = this.getPanel($tab)\n if (!$panel) {\n return\n }\n\n $panel.classList.remove(this.jsHiddenClass)\n }\n\n /**\n * Hide tab panel for tab link\n *\n * @private\n * @param {HTMLAnchorElement} $tab - Tab link\n */\n hidePanel($tab) {\n const $panel = this.getPanel($tab)\n if (!$panel) {\n return\n }\n\n $panel.classList.add(this.jsHiddenClass)\n }\n\n /**\n * Unset 'selected' state for tab link\n *\n * @private\n * @param {HTMLAnchorElement} $tab - Tab link\n */\n unhighlightTab($tab) {\n if (!$tab.parentElement) {\n return\n }\n\n $tab.setAttribute('aria-selected', 'false')\n $tab.parentElement.classList.remove('govuk-tabs__list-item--selected')\n $tab.setAttribute('tabindex', '-1')\n }\n\n /**\n * Set 'selected' state for tab link\n *\n * @private\n * @param {HTMLAnchorElement} $tab - Tab link\n */\n highlightTab($tab) {\n if (!$tab.parentElement) {\n return\n }\n\n $tab.setAttribute('aria-selected', 'true')\n $tab.parentElement.classList.add('govuk-tabs__list-item--selected')\n $tab.setAttribute('tabindex', '0')\n }\n\n /**\n * Get current tab link\n *\n * @private\n * @returns {HTMLAnchorElement | null} Tab link\n */\n getCurrentTab() {\n return this.$root.querySelector(\n '.govuk-tabs__list-item--selected a.govuk-tabs__tab'\n )\n }\n\n /**\n * Name for the component used when initialising using data-module attributes.\n */\n static moduleName = 'govuk-tabs'\n}\n"],"names":["getFragmentFromUrl","url","includes","undefined","split","pop","getBreakpoint","name","property","value","window","getComputedStyle","document","documentElement","getPropertyValue","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","Tabs","$tabs","$tabList","$tabListItems","jsHiddenClass","changingHash","boundTabClick","boundTabKeydown","boundOnHashChange","mql","querySelectorAll","length","onTabClick","bind","onTabKeydown","onHashChange","querySelector","setupResponsiveChecks","breakpoint","matchMedia","addEventListener","checkMode","addListener","_this$mql","matches","setup","teardown","_this$getTab","forEach","$item","$tab","setAttributes","hideTab","$activeTab","getTab","location","hash","showTab","removeAttribute","removeEventListener","unsetAttributes","$tabWithHash","$previousTab","getCurrentTab","focus","unhighlightTab","hidePanel","highlightTab","showPanel","panelId","href","$panel","getPanel","id","add","remove","event","$currentTab","$nextTab","currentTarget","HTMLAnchorElement","preventDefault","createHistoryEntry","key","activatePreviousTab","activateNextTab","parentElement","$nextTabListItem","nextElementSibling","$previousTabListItem","previousElementSibling"],"mappings":";;;;;;EAkBO,SAASA,kBAAkBA,CAACC,GAAG,EAAE;EACtC,EAAA,IAAI,CAACA,GAAG,CAACC,QAAQ,CAAC,GAAG,CAAC,EAAE;EACtB,IAAA,OAAOC,SAAS;EAClB;IAEA,OAAOF,GAAG,CAACG,KAAK,CAAC,GAAG,CAAC,CAACC,GAAG,EAAE;EAC7B;EASO,SAASC,aAAaA,CAACC,IAAI,EAAE;EAClC,EAAA,MAAMC,QAAQ,GAAG,CAA+BD,4BAAAA,EAAAA,IAAI,CAAE,CAAA;EAGtD,EAAA,MAAME,KAAK,GAAGC,MAAM,CACjBC,gBAAgB,CAACC,QAAQ,CAACC,eAAe,CAAC,CAC1CC,gBAAgB,CAACN,QAAQ,CAAC;IAE7B,OAAO;MACLA,QAAQ;MACRC,KAAK,EAAEA,KAAK,IAAIN;KACjB;EACH;EAwD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,IAAI,CAACoC,aAAa,EAAE;EACvB,MAAA;EACF;EAEApC,IAAAA,IAAI,CAAC/B,YAAY,CAAC,eAAe,EAAE,MAAM,CAAC;MAC1C+B,IAAI,CAACoC,aAAa,CAAC7F,SAAS,CAACiF,GAAG,CAAC,iCAAiC,CAAC;EACnExB,IAAAA,IAAI,CAAC/B,YAAY,CAAC,UAAU,EAAE,GAAG,CAAC;EACpC;EAQA4C,EAAAA,aAAaA,GAAG;EACd,IAAA,OAAO,IAAI,CAAC7E,KAAK,CAACkD,aAAa,CAC7B,oDACF,CAAC;EACH;EAMF;EArgBahB,IAAI,CAogBRjC,UAAU,GAAG,YAAY;;;;;;;;"}
@@ -12,34 +12,34 @@ function getBreakpoint(name) {
12
12
  value: value || undefined
13
13
  };
14
14
  }
15
+ function isInitialised($root, moduleName) {
16
+ return $root instanceof HTMLElement && $root.hasAttribute(`data-${moduleName}-init`);
17
+ }
18
+
19
+ /**
20
+ * Checks if GOV.UK Frontend is supported on this page
21
+ *
22
+ * Some browsers will load and run our JavaScript but GOV.UK Frontend
23
+ * won't be supported.
24
+ *
25
+ * @param {HTMLElement | null} [$scope] - (internal) `<body>` HTML element checked for browser support
26
+ * @returns {boolean} Whether GOV.UK Frontend is supported on this page
27
+ */
15
28
  function isSupported($scope = document.body) {
16
29
  if (!$scope) {
17
30
  return false;
18
31
  }
19
32
  return $scope.classList.contains('govuk-frontend-supported');
20
33
  }
21
-
22
- /**
23
- * Schema for component config
24
- *
25
- * @typedef {object} Schema
26
- * @property {{ [field: string]: SchemaProperty | undefined }} properties - Schema properties
27
- * @property {SchemaCondition[]} [anyOf] - List of schema conditions
28
- */
29
-
34
+ function formatErrorMessage(Component, message) {
35
+ return `${Component.moduleName}: ${message}`;
36
+ }
30
37
  /**
31
- * Schema property for component config
32
- *
33
- * @typedef {object} SchemaProperty
34
- * @property {'string' | 'boolean' | 'number' | 'object'} type - Property type
38
+ * @typedef ComponentWithModuleName
39
+ * @property {string} moduleName - Name of the component
35
40
  */
36
-
37
41
  /**
38
- * Schema condition for component config
39
- *
40
- * @typedef {object} SchemaCondition
41
- * @property {string[]} required - List of required config fields
42
- * @property {string} errorMessage - Error message when required config fields not provided
42
+ * @import { ObjectNested } from './configuration.mjs'
43
43
  */
44
44
 
45
45
  class GOVUKFrontendError extends Error {
@@ -65,42 +65,96 @@ class ElementError extends GOVUKFrontendError {
65
65
  let message = typeof messageOrOptions === 'string' ? messageOrOptions : '';
66
66
  if (typeof messageOrOptions === 'object') {
67
67
  const {
68
- componentName,
68
+ component,
69
69
  identifier,
70
70
  element,
71
71
  expectedType
72
72
  } = messageOrOptions;
73
- message = `${componentName}: ${identifier}`;
73
+ message = identifier;
74
74
  message += element ? ` is not of type ${expectedType != null ? expectedType : 'HTMLElement'}` : ' not found';
75
+ message = formatErrorMessage(component, message);
75
76
  }
76
77
  super(message);
77
78
  this.name = 'ElementError';
78
79
  }
79
80
  }
81
+ class InitError extends GOVUKFrontendError {
82
+ constructor(componentOrMessage) {
83
+ const message = typeof componentOrMessage === 'string' ? componentOrMessage : formatErrorMessage(componentOrMessage, `Root element (\`$root\`) already initialised`);
84
+ super(message);
85
+ this.name = 'InitError';
86
+ }
87
+ }
88
+ /**
89
+ * @import { ComponentWithModuleName } from '../common/index.mjs'
90
+ */
80
91
 
81
- class GOVUKFrontendComponent {
82
- constructor() {
83
- this.checkSupport();
92
+ class Component {
93
+ /**
94
+ * Returns the root element of the component
95
+ *
96
+ * @protected
97
+ * @returns {RootElementType} - the root element of component
98
+ */
99
+ get $root() {
100
+ return this._$root;
101
+ }
102
+ constructor($root) {
103
+ this._$root = void 0;
104
+ const childConstructor = this.constructor;
105
+ if (typeof childConstructor.moduleName !== 'string') {
106
+ throw new InitError(`\`moduleName\` not defined in component`);
107
+ }
108
+ if (!($root instanceof childConstructor.elementType)) {
109
+ throw new ElementError({
110
+ element: $root,
111
+ component: childConstructor,
112
+ identifier: 'Root element (`$root`)',
113
+ expectedType: childConstructor.elementType.name
114
+ });
115
+ } else {
116
+ this._$root = $root;
117
+ }
118
+ childConstructor.checkSupport();
119
+ this.checkInitialised();
120
+ const moduleName = childConstructor.moduleName;
121
+ this.$root.setAttribute(`data-${moduleName}-init`, '');
122
+ }
123
+ checkInitialised() {
124
+ const constructor = this.constructor;
125
+ const moduleName = constructor.moduleName;
126
+ if (moduleName && isInitialised(this.$root, moduleName)) {
127
+ throw new InitError(constructor);
128
+ }
84
129
  }
85
- checkSupport() {
130
+ static checkSupport() {
86
131
  if (!isSupported()) {
87
132
  throw new SupportError();
88
133
  }
89
134
  }
90
135
  }
91
136
 
137
+ /**
138
+ * @typedef ChildClass
139
+ * @property {string} moduleName - The module name that'll be looked for in the DOM when initialising the component
140
+ */
141
+
142
+ /**
143
+ * @typedef {typeof Component & ChildClass} ChildClassConstructor
144
+ */
145
+ Component.elementType = HTMLElement;
146
+
92
147
  /**
93
148
  * Tabs component
94
149
  *
95
150
  * @preserve
96
151
  */
97
- class Tabs extends GOVUKFrontendComponent {
152
+ class Tabs extends Component {
98
153
  /**
99
- * @param {Element | null} $module - HTML element to use for tabs
154
+ * @param {Element | null} $root - HTML element to use for tabs
100
155
  */
101
- constructor($module) {
102
- super();
103
- this.$module = void 0;
156
+ constructor($root) {
157
+ super($root);
104
158
  this.$tabs = void 0;
105
159
  this.$tabList = void 0;
106
160
  this.$tabListItems = void 0;
@@ -110,36 +164,28 @@ class Tabs extends GOVUKFrontendComponent {
110
164
  this.boundTabKeydown = void 0;
111
165
  this.boundOnHashChange = void 0;
112
166
  this.mql = null;
113
- if (!$module) {
114
- throw new ElementError({
115
- componentName: 'Tabs',
116
- element: $module,
117
- identifier: 'Root element (`$module`)'
118
- });
119
- }
120
- const $tabs = $module.querySelectorAll('a.govuk-tabs__tab');
167
+ const $tabs = this.$root.querySelectorAll('a.govuk-tabs__tab');
121
168
  if (!$tabs.length) {
122
169
  throw new ElementError({
123
- componentName: 'Tabs',
170
+ component: Tabs,
124
171
  identifier: 'Links (`<a class="govuk-tabs__tab">`)'
125
172
  });
126
173
  }
127
- this.$module = $module;
128
174
  this.$tabs = $tabs;
129
175
  this.boundTabClick = this.onTabClick.bind(this);
130
176
  this.boundTabKeydown = this.onTabKeydown.bind(this);
131
177
  this.boundOnHashChange = this.onHashChange.bind(this);
132
- const $tabList = this.$module.querySelector('.govuk-tabs__list');
133
- const $tabListItems = this.$module.querySelectorAll('li.govuk-tabs__list-item');
178
+ const $tabList = this.$root.querySelector('.govuk-tabs__list');
179
+ const $tabListItems = this.$root.querySelectorAll('li.govuk-tabs__list-item');
134
180
  if (!$tabList) {
135
181
  throw new ElementError({
136
- componentName: 'Tabs',
182
+ component: Tabs,
137
183
  identifier: 'List (`<ul class="govuk-tabs__list">`)'
138
184
  });
139
185
  }
140
186
  if (!$tabListItems.length) {
141
187
  throw new ElementError({
142
- componentName: 'Tabs',
188
+ component: Tabs,
143
189
  identifier: 'List items (`<li class="govuk-tabs__list-item">`)'
144
190
  });
145
191
  }
@@ -151,7 +197,7 @@ class Tabs extends GOVUKFrontendComponent {
151
197
  const breakpoint = getBreakpoint('tablet');
152
198
  if (!breakpoint.value) {
153
199
  throw new ElementError({
154
- componentName: 'Tabs',
200
+ component: Tabs,
155
201
  identifier: `CSS custom property (\`${breakpoint.property}\`) on pseudo-class \`:root\``
156
202
  });
157
203
  }
@@ -226,7 +272,7 @@ class Tabs extends GOVUKFrontendComponent {
226
272
  this.showPanel($tab);
227
273
  }
228
274
  getTab(hash) {
229
- return this.$module.querySelector(`a.govuk-tabs__tab[href="${hash}"]`);
275
+ return this.$root.querySelector(`a.govuk-tabs__tab[href="${hash}"]`);
230
276
  }
231
277
  setAttributes($tab) {
232
278
  const panelId = getFragmentFromUrl($tab.href);
@@ -285,16 +331,12 @@ class Tabs extends GOVUKFrontendComponent {
285
331
  onTabKeydown(event) {
286
332
  switch (event.key) {
287
333
  case 'ArrowLeft':
288
- case 'ArrowUp':
289
334
  case 'Left':
290
- case 'Up':
291
335
  this.activatePreviousTab();
292
336
  event.preventDefault();
293
337
  break;
294
338
  case 'ArrowRight':
295
- case 'ArrowDown':
296
339
  case 'Right':
297
- case 'Down':
298
340
  this.activateNextTab();
299
341
  event.preventDefault();
300
342
  break;
@@ -341,7 +383,7 @@ class Tabs extends GOVUKFrontendComponent {
341
383
  if (!panelId) {
342
384
  return null;
343
385
  }
344
- return this.$module.querySelector(`#${panelId}`);
386
+ return this.$root.querySelector(`#${panelId}`);
345
387
  }
346
388
  showPanel($tab) {
347
389
  const $panel = this.getPanel($tab);
@@ -374,7 +416,7 @@ class Tabs extends GOVUKFrontendComponent {
374
416
  $tab.setAttribute('tabindex', '0');
375
417
  }
376
418
  getCurrentTab() {
377
- return this.$module.querySelector('.govuk-tabs__list-item--selected a.govuk-tabs__tab');
419
+ return this.$root.querySelector('.govuk-tabs__list-item--selected a.govuk-tabs__tab');
378
420
  }
379
421
  }
380
422
  Tabs.moduleName = 'govuk-tabs';