defra_ruby_template 5.4.0 → 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 (428) hide show
  1. checksums.yaml +4 -4
  2. data/app/views/layouts/defra_ruby_template.html.erb +43 -23
  3. data/lib/defra_ruby_template/version.rb +1 -1
  4. data/lib/defra_ruby_template.rb +3 -8
  5. data/node_modules/govuk-frontend/dist/govuk/all.bundle.js +882 -492
  6. data/node_modules/govuk-frontend/dist/govuk/all.bundle.js.map +1 -1
  7. data/node_modules/govuk-frontend/dist/govuk/all.bundle.mjs +877 -492
  8. data/node_modules/govuk-frontend/dist/govuk/all.bundle.mjs.map +1 -1
  9. data/node_modules/govuk-frontend/dist/govuk/all.mjs +5 -0
  10. data/node_modules/govuk-frontend/dist/govuk/all.mjs.map +1 -1
  11. data/node_modules/govuk-frontend/dist/govuk/all.scss +6 -0
  12. data/node_modules/govuk-frontend/dist/govuk/all.scss.map +1 -1
  13. data/node_modules/govuk-frontend/dist/govuk/assets/images/govuk-crest.svg +1 -0
  14. data/node_modules/govuk-frontend/dist/govuk/assets/rebrand/images/favicon.ico +0 -0
  15. data/node_modules/govuk-frontend/dist/govuk/assets/rebrand/images/favicon.svg +1 -0
  16. data/node_modules/govuk-frontend/dist/govuk/assets/rebrand/images/govuk-crest.svg +1 -0
  17. data/node_modules/govuk-frontend/dist/govuk/assets/rebrand/images/govuk-icon-180.png +0 -0
  18. data/node_modules/govuk-frontend/dist/govuk/assets/rebrand/images/govuk-icon-192.png +0 -0
  19. data/node_modules/govuk-frontend/dist/govuk/assets/rebrand/images/govuk-icon-512.png +0 -0
  20. data/node_modules/govuk-frontend/dist/govuk/assets/rebrand/images/govuk-icon-mask.svg +1 -0
  21. data/node_modules/govuk-frontend/dist/govuk/assets/rebrand/images/govuk-opengraph-image.png +0 -0
  22. data/node_modules/govuk-frontend/dist/govuk/assets/rebrand/manifest.json +39 -0
  23. data/node_modules/govuk-frontend/dist/govuk/common/closest-attribute-value.mjs.map +1 -1
  24. data/node_modules/govuk-frontend/dist/govuk/common/configuration.mjs +169 -0
  25. data/node_modules/govuk-frontend/dist/govuk/common/configuration.mjs.map +1 -0
  26. data/node_modules/govuk-frontend/dist/govuk/common/govuk-frontend-version.mjs +1 -1
  27. data/node_modules/govuk-frontend/dist/govuk/common/index.mjs +20 -83
  28. data/node_modules/govuk-frontend/dist/govuk/common/index.mjs.map +1 -1
  29. data/node_modules/govuk-frontend/dist/govuk/component.mjs +60 -0
  30. data/node_modules/govuk-frontend/dist/govuk/component.mjs.map +1 -0
  31. data/node_modules/govuk-frontend/dist/govuk/components/_index.scss +1 -0
  32. data/node_modules/govuk-frontend/dist/govuk/components/_index.scss.map +1 -1
  33. data/node_modules/govuk-frontend/dist/govuk/components/accordion/_index.scss +35 -31
  34. data/node_modules/govuk-frontend/dist/govuk/components/accordion/_index.scss.map +1 -1
  35. data/node_modules/govuk-frontend/dist/govuk/components/accordion/accordion.bundle.js +296 -195
  36. data/node_modules/govuk-frontend/dist/govuk/components/accordion/accordion.bundle.js.map +1 -1
  37. data/node_modules/govuk-frontend/dist/govuk/components/accordion/accordion.bundle.mjs +295 -194
  38. data/node_modules/govuk-frontend/dist/govuk/components/accordion/accordion.bundle.mjs.map +1 -1
  39. data/node_modules/govuk-frontend/dist/govuk/components/accordion/accordion.mjs +88 -110
  40. data/node_modules/govuk-frontend/dist/govuk/components/accordion/accordion.mjs.map +1 -1
  41. data/node_modules/govuk-frontend/dist/govuk/components/accordion/fixtures.json +16 -3
  42. data/node_modules/govuk-frontend/dist/govuk/components/back-link/fixtures.json +25 -15
  43. data/node_modules/govuk-frontend/dist/govuk/components/back-link/template-with-custom-link.html +1 -0
  44. data/node_modules/govuk-frontend/dist/govuk/components/back-link/template.njk +2 -2
  45. data/node_modules/govuk-frontend/dist/govuk/components/breadcrumbs/fixtures.json +53 -15
  46. data/node_modules/govuk-frontend/dist/govuk/components/breadcrumbs/macro-options.json +6 -0
  47. data/node_modules/govuk-frontend/dist/govuk/components/breadcrumbs/template-default.html +2 -2
  48. data/node_modules/govuk-frontend/dist/govuk/components/breadcrumbs/template-inverse.html +2 -2
  49. data/node_modules/govuk-frontend/dist/govuk/components/breadcrumbs/template-with-collapse-on-mobile.html +2 -2
  50. data/node_modules/govuk-frontend/dist/govuk/components/breadcrumbs/template-with-last-breadcrumb-as-current-page.html +2 -2
  51. data/node_modules/govuk-frontend/dist/govuk/components/breadcrumbs/template-with-multiple-levels.html +2 -2
  52. data/node_modules/govuk-frontend/dist/govuk/components/breadcrumbs/template-with-one-level.html +2 -2
  53. data/node_modules/govuk-frontend/dist/govuk/components/breadcrumbs/template-without-the-home-section.html +2 -2
  54. data/node_modules/govuk-frontend/dist/govuk/components/breadcrumbs/template.njk +2 -2
  55. data/node_modules/govuk-frontend/dist/govuk/components/button/button.bundle.js +217 -106
  56. data/node_modules/govuk-frontend/dist/govuk/components/button/button.bundle.js.map +1 -1
  57. data/node_modules/govuk-frontend/dist/govuk/components/button/button.bundle.mjs +216 -105
  58. data/node_modules/govuk-frontend/dist/govuk/components/button/button.bundle.mjs.map +1 -1
  59. data/node_modules/govuk-frontend/dist/govuk/components/button/button.mjs +9 -22
  60. data/node_modules/govuk-frontend/dist/govuk/components/button/button.mjs.map +1 -1
  61. data/node_modules/govuk-frontend/dist/govuk/components/button/fixtures.json +38 -0
  62. data/node_modules/govuk-frontend/dist/govuk/components/button/macro-options.json +2 -1
  63. data/node_modules/govuk-frontend/dist/govuk/components/character-count/_index.scss +12 -4
  64. data/node_modules/govuk-frontend/dist/govuk/components/character-count/_index.scss.map +1 -1
  65. data/node_modules/govuk-frontend/dist/govuk/components/character-count/character-count.bundle.js +256 -145
  66. data/node_modules/govuk-frontend/dist/govuk/components/character-count/character-count.bundle.js.map +1 -1
  67. data/node_modules/govuk-frontend/dist/govuk/components/character-count/character-count.bundle.mjs +255 -144
  68. data/node_modules/govuk-frontend/dist/govuk/components/character-count/character-count.bundle.mjs.map +1 -1
  69. data/node_modules/govuk-frontend/dist/govuk/components/character-count/character-count.mjs +29 -34
  70. data/node_modules/govuk-frontend/dist/govuk/components/character-count/character-count.mjs.map +1 -1
  71. data/node_modules/govuk-frontend/dist/govuk/components/character-count/fixtures.json +80 -1
  72. data/node_modules/govuk-frontend/dist/govuk/components/character-count/macro-options.json +6 -6
  73. data/node_modules/govuk-frontend/dist/govuk/components/character-count/template-with-error.html +12 -0
  74. data/node_modules/govuk-frontend/dist/govuk/components/character-count/template-with-hint-and-error.html +15 -0
  75. data/node_modules/govuk-frontend/dist/govuk/components/character-count/template.njk +5 -4
  76. data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/_index.scss +6 -1
  77. data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/_index.scss.map +1 -1
  78. data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/checkboxes.bundle.js +96 -50
  79. data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/checkboxes.bundle.js.map +1 -1
  80. data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/checkboxes.bundle.mjs +95 -49
  81. data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/checkboxes.bundle.mjs.map +1 -1
  82. data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/checkboxes.mjs +9 -18
  83. data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/checkboxes.mjs.map +1 -1
  84. data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/fixtures.json +88 -1
  85. data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/template-small-with-divider-and-none.html +34 -0
  86. data/node_modules/govuk-frontend/dist/govuk/components/cookie-banner/_index.scss +23 -14
  87. data/node_modules/govuk-frontend/dist/govuk/components/cookie-banner/_index.scss.map +1 -1
  88. data/node_modules/govuk-frontend/dist/govuk/components/cookie-banner/fixtures.json +23 -0
  89. data/node_modules/govuk-frontend/dist/govuk/components/date-input/_index.scss +2 -2
  90. data/node_modules/govuk-frontend/dist/govuk/components/date-input/_index.scss.map +1 -1
  91. data/node_modules/govuk-frontend/dist/govuk/components/date-input/fixtures.json +27 -0
  92. data/node_modules/govuk-frontend/dist/govuk/components/date-input/macro-options.json +2 -2
  93. data/node_modules/govuk-frontend/dist/govuk/components/details/_index.scss +7 -2
  94. data/node_modules/govuk-frontend/dist/govuk/components/details/_index.scss.map +1 -1
  95. data/node_modules/govuk-frontend/dist/govuk/components/details/fixtures.json +10 -0
  96. data/node_modules/govuk-frontend/dist/govuk/components/error-message/fixtures.json +9 -0
  97. data/node_modules/govuk-frontend/dist/govuk/components/error-summary/_index.scss +4 -0
  98. data/node_modules/govuk-frontend/dist/govuk/components/error-summary/_index.scss.map +1 -1
  99. data/node_modules/govuk-frontend/dist/govuk/components/error-summary/error-summary.bundle.js +238 -127
  100. data/node_modules/govuk-frontend/dist/govuk/components/error-summary/error-summary.bundle.js.map +1 -1
  101. data/node_modules/govuk-frontend/dist/govuk/components/error-summary/error-summary.bundle.mjs +237 -126
  102. data/node_modules/govuk-frontend/dist/govuk/components/error-summary/error-summary.bundle.mjs.map +1 -1
  103. data/node_modules/govuk-frontend/dist/govuk/components/error-summary/error-summary.mjs +10 -22
  104. data/node_modules/govuk-frontend/dist/govuk/components/error-summary/error-summary.mjs.map +1 -1
  105. data/node_modules/govuk-frontend/dist/govuk/components/error-summary/fixtures.json +19 -0
  106. data/node_modules/govuk-frontend/dist/govuk/components/exit-this-page/exit-this-page.bundle.js +218 -107
  107. data/node_modules/govuk-frontend/dist/govuk/components/exit-this-page/exit-this-page.bundle.js.map +1 -1
  108. data/node_modules/govuk-frontend/dist/govuk/components/exit-this-page/exit-this-page.bundle.mjs +217 -106
  109. data/node_modules/govuk-frontend/dist/govuk/components/exit-this-page/exit-this-page.bundle.mjs.map +1 -1
  110. data/node_modules/govuk-frontend/dist/govuk/components/exit-this-page/exit-this-page.mjs +10 -22
  111. data/node_modules/govuk-frontend/dist/govuk/components/exit-this-page/exit-this-page.mjs.map +1 -1
  112. data/node_modules/govuk-frontend/dist/govuk/components/exit-this-page/fixtures.json +4 -0
  113. data/node_modules/govuk-frontend/dist/govuk/components/fieldset/_index.scss +3 -5
  114. data/node_modules/govuk-frontend/dist/govuk/components/fieldset/_index.scss.map +1 -1
  115. data/node_modules/govuk-frontend/dist/govuk/components/fieldset/fixtures.json +18 -0
  116. data/node_modules/govuk-frontend/dist/govuk/components/file-upload/_index.scss +175 -9
  117. data/node_modules/govuk-frontend/dist/govuk/components/file-upload/_index.scss.map +1 -1
  118. data/node_modules/govuk-frontend/dist/govuk/components/file-upload/file-upload.bundle.js +744 -0
  119. data/node_modules/govuk-frontend/dist/govuk/components/file-upload/file-upload.bundle.js.map +1 -0
  120. data/node_modules/govuk-frontend/dist/govuk/components/file-upload/file-upload.bundle.mjs +736 -0
  121. data/node_modules/govuk-frontend/dist/govuk/components/file-upload/file-upload.bundle.mjs.map +1 -0
  122. data/node_modules/govuk-frontend/dist/govuk/components/file-upload/file-upload.mjs +257 -0
  123. data/node_modules/govuk-frontend/dist/govuk/components/file-upload/file-upload.mjs.map +1 -0
  124. data/node_modules/govuk-frontend/dist/govuk/components/file-upload/fixtures.json +220 -16
  125. data/node_modules/govuk-frontend/dist/govuk/components/file-upload/macro-options.json +52 -3
  126. data/node_modules/govuk-frontend/dist/govuk/components/file-upload/template-allows-direct-media-capture.html +6 -0
  127. data/node_modules/govuk-frontend/dist/govuk/components/file-upload/template-allows-image-files-only.html +6 -0
  128. data/node_modules/govuk-frontend/dist/govuk/components/file-upload/template-allows-multiple-files.html +6 -0
  129. data/node_modules/govuk-frontend/dist/govuk/components/file-upload/template-disabled.html +6 -0
  130. data/node_modules/govuk-frontend/dist/govuk/components/file-upload/template-enhanced-disabled.html +13 -0
  131. data/node_modules/govuk-frontend/dist/govuk/components/file-upload/template-enhanced-with-error-message-and-hint.html +16 -0
  132. data/node_modules/govuk-frontend/dist/govuk/components/file-upload/template-enhanced.html +10 -0
  133. data/node_modules/govuk-frontend/dist/govuk/components/file-upload/template-translated.html +10 -0
  134. data/node_modules/govuk-frontend/dist/govuk/components/file-upload/template.njk +42 -5
  135. data/node_modules/govuk-frontend/dist/govuk/components/footer/_index.scss +61 -19
  136. data/node_modules/govuk-frontend/dist/govuk/components/footer/_index.scss.map +1 -1
  137. data/node_modules/govuk-frontend/dist/govuk/components/footer/fixtures.json +34 -0
  138. data/node_modules/govuk-frontend/dist/govuk/components/footer/macro-options.json +6 -0
  139. data/node_modules/govuk-frontend/dist/govuk/components/footer/template.njk +10 -0
  140. data/node_modules/govuk-frontend/dist/govuk/components/header/_index.scss +223 -21
  141. data/node_modules/govuk-frontend/dist/govuk/components/header/_index.scss.map +1 -1
  142. data/node_modules/govuk-frontend/dist/govuk/components/header/fixtures.json +78 -32
  143. data/node_modules/govuk-frontend/dist/govuk/components/header/header.bundle.js +90 -43
  144. data/node_modules/govuk-frontend/dist/govuk/components/header/header.bundle.js.map +1 -1
  145. data/node_modules/govuk-frontend/dist/govuk/components/header/header.bundle.mjs +89 -42
  146. data/node_modules/govuk-frontend/dist/govuk/components/header/header.bundle.mjs.map +1 -1
  147. data/node_modules/govuk-frontend/dist/govuk/components/header/header.mjs +10 -18
  148. data/node_modules/govuk-frontend/dist/govuk/components/header/header.mjs.map +1 -1
  149. data/node_modules/govuk-frontend/dist/govuk/components/header/macro-options.json +31 -12
  150. data/node_modules/govuk-frontend/dist/govuk/components/header/template-default.html +20 -12
  151. data/node_modules/govuk-frontend/dist/govuk/components/header/template-full-width-with-navigation.html +21 -15
  152. data/node_modules/govuk-frontend/dist/govuk/components/header/template-full-width.html +21 -15
  153. data/node_modules/govuk-frontend/dist/govuk/components/header/template-navigation-item-with-html.html +20 -12
  154. data/node_modules/govuk-frontend/dist/govuk/components/header/template-navigation-item-with-text-without-link.html +20 -12
  155. data/node_modules/govuk-frontend/dist/govuk/components/header/template-with-custom-menu-button-label.html +20 -12
  156. data/node_modules/govuk-frontend/dist/govuk/components/header/template-with-custom-menu-button-text.html +20 -12
  157. data/node_modules/govuk-frontend/dist/govuk/components/header/template-with-custom-navigation-label.html +20 -12
  158. data/node_modules/govuk-frontend/dist/govuk/components/header/template-with-full-width-border.html +30 -0
  159. data/node_modules/govuk-frontend/dist/govuk/components/header/template-with-large-navigation.html +20 -12
  160. data/node_modules/govuk-frontend/dist/govuk/components/header/template-with-navigation.html +20 -12
  161. data/node_modules/govuk-frontend/dist/govuk/components/header/template-with-product-name.html +21 -15
  162. data/node_modules/govuk-frontend/dist/govuk/components/header/template-with-service-name-and-navigation.html +20 -12
  163. data/node_modules/govuk-frontend/dist/govuk/components/header/template-with-service-name-but-no-service-url.html +20 -12
  164. data/node_modules/govuk-frontend/dist/govuk/components/header/template-with-service-name.html +20 -12
  165. data/node_modules/govuk-frontend/dist/govuk/components/header/template-with-st-edwards-crown.html +10 -12
  166. data/node_modules/govuk-frontend/dist/govuk/components/header/template.njk +11 -41
  167. data/node_modules/govuk-frontend/dist/govuk/components/hint/fixtures.json +6 -0
  168. data/node_modules/govuk-frontend/dist/govuk/components/input/_index.scss +7 -4
  169. data/node_modules/govuk-frontend/dist/govuk/components/input/_index.scss.map +1 -1
  170. data/node_modules/govuk-frontend/dist/govuk/components/input/fixtures.json +97 -27
  171. data/node_modules/govuk-frontend/dist/govuk/components/input/macro-options.json +6 -6
  172. data/node_modules/govuk-frontend/dist/govuk/components/input/template-default.html +2 -2
  173. data/node_modules/govuk-frontend/dist/govuk/components/input/template-disabled.html +6 -0
  174. data/node_modules/govuk-frontend/dist/govuk/components/input/template-with-error-and-hint.html +12 -0
  175. data/node_modules/govuk-frontend/dist/govuk/components/input/template-with-error-message.html +2 -5
  176. data/node_modules/govuk-frontend/dist/govuk/components/input/template.njk +5 -4
  177. data/node_modules/govuk-frontend/dist/govuk/components/inset-text/fixtures.json +6 -0
  178. data/node_modules/govuk-frontend/dist/govuk/components/label/fixtures.json +17 -0
  179. data/node_modules/govuk-frontend/dist/govuk/components/notification-banner/_index.scss +3 -2
  180. data/node_modules/govuk-frontend/dist/govuk/components/notification-banner/_index.scss.map +1 -1
  181. data/node_modules/govuk-frontend/dist/govuk/components/notification-banner/fixtures.json +24 -0
  182. data/node_modules/govuk-frontend/dist/govuk/components/notification-banner/notification-banner.bundle.js +238 -127
  183. data/node_modules/govuk-frontend/dist/govuk/components/notification-banner/notification-banner.bundle.js.map +1 -1
  184. data/node_modules/govuk-frontend/dist/govuk/components/notification-banner/notification-banner.bundle.mjs +237 -126
  185. data/node_modules/govuk-frontend/dist/govuk/components/notification-banner/notification-banner.bundle.mjs.map +1 -1
  186. data/node_modules/govuk-frontend/dist/govuk/components/notification-banner/notification-banner.mjs +10 -22
  187. data/node_modules/govuk-frontend/dist/govuk/components/notification-banner/notification-banner.mjs.map +1 -1
  188. data/node_modules/govuk-frontend/dist/govuk/components/pagination/_index.scss +24 -37
  189. data/node_modules/govuk-frontend/dist/govuk/components/pagination/_index.scss.map +1 -1
  190. data/node_modules/govuk-frontend/dist/govuk/components/pagination/fixtures.json +15 -0
  191. data/node_modules/govuk-frontend/dist/govuk/components/pagination/macro-options.json +4 -4
  192. data/node_modules/govuk-frontend/dist/govuk/components/panel/_index.scss +13 -9
  193. data/node_modules/govuk-frontend/dist/govuk/components/panel/_index.scss.map +1 -1
  194. data/node_modules/govuk-frontend/dist/govuk/components/panel/fixtures.json +9 -0
  195. data/node_modules/govuk-frontend/dist/govuk/components/password-input/_index.scss +12 -9
  196. data/node_modules/govuk-frontend/dist/govuk/components/password-input/_index.scss.map +1 -1
  197. data/node_modules/govuk-frontend/dist/govuk/components/password-input/fixtures.json +27 -2
  198. data/node_modules/govuk-frontend/dist/govuk/components/password-input/macro-options.json +3 -3
  199. data/node_modules/govuk-frontend/dist/govuk/components/password-input/password-input.bundle.js +220 -110
  200. data/node_modules/govuk-frontend/dist/govuk/components/password-input/password-input.bundle.js.map +1 -1
  201. data/node_modules/govuk-frontend/dist/govuk/components/password-input/password-input.bundle.mjs +219 -109
  202. data/node_modules/govuk-frontend/dist/govuk/components/password-input/password-input.bundle.mjs.map +1 -1
  203. data/node_modules/govuk-frontend/dist/govuk/components/password-input/password-input.mjs +12 -25
  204. data/node_modules/govuk-frontend/dist/govuk/components/password-input/password-input.mjs.map +1 -1
  205. data/node_modules/govuk-frontend/dist/govuk/components/password-input/template-default.html +3 -3
  206. data/node_modules/govuk-frontend/dist/govuk/components/password-input/template.njk +4 -2
  207. data/node_modules/govuk-frontend/dist/govuk/components/phase-banner/_index.scss +0 -8
  208. data/node_modules/govuk-frontend/dist/govuk/components/phase-banner/_index.scss.map +1 -1
  209. data/node_modules/govuk-frontend/dist/govuk/components/phase-banner/fixtures.json +7 -0
  210. data/node_modules/govuk-frontend/dist/govuk/components/radios/_index.scss +7 -5
  211. data/node_modules/govuk-frontend/dist/govuk/components/radios/_index.scss.map +1 -1
  212. data/node_modules/govuk-frontend/dist/govuk/components/radios/fixtures.json +51 -5
  213. data/node_modules/govuk-frontend/dist/govuk/components/radios/radios.bundle.js +96 -50
  214. data/node_modules/govuk-frontend/dist/govuk/components/radios/radios.bundle.js.map +1 -1
  215. data/node_modules/govuk-frontend/dist/govuk/components/radios/radios.bundle.mjs +95 -49
  216. data/node_modules/govuk-frontend/dist/govuk/components/radios/radios.bundle.mjs.map +1 -1
  217. data/node_modules/govuk-frontend/dist/govuk/components/radios/radios.mjs +9 -18
  218. data/node_modules/govuk-frontend/dist/govuk/components/radios/radios.mjs.map +1 -1
  219. data/node_modules/govuk-frontend/dist/govuk/components/radios/template-small-with-a-divider.html +1 -1
  220. data/node_modules/govuk-frontend/dist/govuk/components/radios/template-with-a-divider.html +1 -1
  221. data/node_modules/govuk-frontend/dist/govuk/components/select/_index.scss +5 -5
  222. data/node_modules/govuk-frontend/dist/govuk/components/select/_index.scss.map +1 -1
  223. data/node_modules/govuk-frontend/dist/govuk/components/select/fixtures.json +43 -9
  224. data/node_modules/govuk-frontend/dist/govuk/components/select/macro-options.json +2 -2
  225. data/node_modules/govuk-frontend/dist/govuk/components/select/template-id.html +7 -0
  226. data/node_modules/govuk-frontend/dist/govuk/components/select/template.njk +6 -4
  227. data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/README.md +15 -0
  228. data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/_index.scss +187 -0
  229. data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/_index.scss.map +1 -0
  230. data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/_service-navigation.scss +4 -0
  231. data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/_service-navigation.scss.map +1 -0
  232. data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/fixtures.json +515 -0
  233. data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/macro-options.json +138 -0
  234. data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/macro.njk +3 -0
  235. data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/service-navigation.bundle.js +229 -0
  236. data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/service-navigation.bundle.js.map +1 -0
  237. data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/service-navigation.bundle.mjs +221 -0
  238. data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/service-navigation.bundle.mjs.map +1 -0
  239. data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/service-navigation.mjs +85 -0
  240. data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/service-navigation.mjs.map +1 -0
  241. data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/template-default.html +57 -0
  242. data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/template-with-html-navigation-items.html +49 -0
  243. data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/template-with-large-navigation.html +153 -0
  244. data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/template-with-long-service-name.html +20 -0
  245. data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/template-with-navigation-with-a-current-item.html +58 -0
  246. data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/template-with-navigation-with-an-active-item.html +58 -0
  247. data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/template-with-non-link-navigation-items.html +49 -0
  248. data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/template-with-service-link.html +20 -0
  249. data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/template-with-service-name-and-navigation.html +63 -0
  250. data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/template-with-service-name.html +18 -0
  251. data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/template.njk +103 -0
  252. data/node_modules/govuk-frontend/dist/govuk/components/skip-link/_index.scss +6 -4
  253. data/node_modules/govuk-frontend/dist/govuk/components/skip-link/_index.scss.map +1 -1
  254. data/node_modules/govuk-frontend/dist/govuk/components/skip-link/fixtures.json +9 -0
  255. data/node_modules/govuk-frontend/dist/govuk/components/skip-link/skip-link.bundle.js +95 -48
  256. data/node_modules/govuk-frontend/dist/govuk/components/skip-link/skip-link.bundle.js.map +1 -1
  257. data/node_modules/govuk-frontend/dist/govuk/components/skip-link/skip-link.bundle.mjs +94 -47
  258. data/node_modules/govuk-frontend/dist/govuk/components/skip-link/skip-link.bundle.mjs.map +1 -1
  259. data/node_modules/govuk-frontend/dist/govuk/components/skip-link/skip-link.mjs +15 -23
  260. data/node_modules/govuk-frontend/dist/govuk/components/skip-link/skip-link.mjs.map +1 -1
  261. data/node_modules/govuk-frontend/dist/govuk/components/summary-list/_index.scss +14 -22
  262. data/node_modules/govuk-frontend/dist/govuk/components/summary-list/_index.scss.map +1 -1
  263. data/node_modules/govuk-frontend/dist/govuk/components/summary-list/fixtures.json +174 -1
  264. data/node_modules/govuk-frontend/dist/govuk/components/summary-list/template-as-a-summary-card-extreme.html +106 -0
  265. data/node_modules/govuk-frontend/dist/govuk/components/table/fixtures.json +22 -1
  266. data/node_modules/govuk-frontend/dist/govuk/components/tabs/fixtures.json +15 -1
  267. data/node_modules/govuk-frontend/dist/govuk/components/tabs/tabs.bundle.js +95 -53
  268. data/node_modules/govuk-frontend/dist/govuk/components/tabs/tabs.bundle.js.map +1 -1
  269. data/node_modules/govuk-frontend/dist/govuk/components/tabs/tabs.bundle.mjs +94 -52
  270. data/node_modules/govuk-frontend/dist/govuk/components/tabs/tabs.bundle.mjs.map +1 -1
  271. data/node_modules/govuk-frontend/dist/govuk/components/tabs/tabs.mjs +15 -28
  272. data/node_modules/govuk-frontend/dist/govuk/components/tabs/tabs.mjs.map +1 -1
  273. data/node_modules/govuk-frontend/dist/govuk/components/tag/_index.scss +11 -8
  274. data/node_modules/govuk-frontend/dist/govuk/components/tag/_index.scss.map +1 -1
  275. data/node_modules/govuk-frontend/dist/govuk/components/tag/fixtures.json +14 -0
  276. data/node_modules/govuk-frontend/dist/govuk/components/task-list/_index.scss +12 -10
  277. data/node_modules/govuk-frontend/dist/govuk/components/task-list/_index.scss.map +1 -1
  278. data/node_modules/govuk-frontend/dist/govuk/components/task-list/fixtures.json +44 -0
  279. data/node_modules/govuk-frontend/dist/govuk/components/task-list/template-with-empty-values.html +27 -0
  280. data/node_modules/govuk-frontend/dist/govuk/components/task-list/template.njk +1 -1
  281. data/node_modules/govuk-frontend/dist/govuk/components/textarea/_index.scss +3 -3
  282. data/node_modules/govuk-frontend/dist/govuk/components/textarea/_index.scss.map +1 -1
  283. data/node_modules/govuk-frontend/dist/govuk/components/textarea/fixtures.json +32 -1
  284. data/node_modules/govuk-frontend/dist/govuk/components/textarea/macro-options.json +3 -3
  285. data/node_modules/govuk-frontend/dist/govuk/components/textarea/template.njk +6 -4
  286. data/node_modules/govuk-frontend/dist/govuk/components/warning-text/_index.scss +6 -5
  287. data/node_modules/govuk-frontend/dist/govuk/components/warning-text/_index.scss.map +1 -1
  288. data/node_modules/govuk-frontend/dist/govuk/components/warning-text/fixtures.json +8 -0
  289. data/node_modules/govuk-frontend/dist/govuk/core/_govuk-frontend-properties.scss +1 -1
  290. data/node_modules/govuk-frontend/dist/govuk/core/_govuk-frontend-properties.scss.map +1 -1
  291. data/node_modules/govuk-frontend/dist/govuk/errors/index.mjs +16 -3
  292. data/node_modules/govuk-frontend/dist/govuk/errors/index.mjs.map +1 -1
  293. data/node_modules/govuk-frontend/dist/govuk/govuk-frontend.min.css +2 -2
  294. data/node_modules/govuk-frontend/dist/govuk/govuk-frontend.min.css.map +1 -1
  295. data/node_modules/govuk-frontend/dist/govuk/govuk-frontend.min.js +1 -1
  296. data/node_modules/govuk-frontend/dist/govuk/govuk-frontend.min.js.map +1 -1
  297. data/node_modules/govuk-frontend/dist/govuk/helpers/_colour.scss +55 -8
  298. data/node_modules/govuk-frontend/dist/govuk/helpers/_colour.scss.map +1 -1
  299. data/node_modules/govuk-frontend/dist/govuk/helpers/_focused.scss +14 -4
  300. data/node_modules/govuk-frontend/dist/govuk/helpers/_focused.scss.map +1 -1
  301. data/node_modules/govuk-frontend/dist/govuk/helpers/_grid.scss +1 -1
  302. data/node_modules/govuk-frontend/dist/govuk/helpers/_grid.scss.map +1 -1
  303. data/node_modules/govuk-frontend/dist/govuk/helpers/_links.scss +2 -2
  304. data/node_modules/govuk-frontend/dist/govuk/helpers/_links.scss.map +1 -1
  305. data/node_modules/govuk-frontend/dist/govuk/helpers/_shape-arrow.scss +1 -1
  306. data/node_modules/govuk-frontend/dist/govuk/helpers/_shape-arrow.scss.map +1 -1
  307. data/node_modules/govuk-frontend/dist/govuk/helpers/_typography.scss +18 -1
  308. data/node_modules/govuk-frontend/dist/govuk/helpers/_typography.scss.map +1 -1
  309. data/node_modules/govuk-frontend/dist/govuk/helpers/_visually-hidden.scss +30 -62
  310. data/node_modules/govuk-frontend/dist/govuk/helpers/_visually-hidden.scss.map +1 -1
  311. data/node_modules/govuk-frontend/dist/govuk/i18n.mjs.map +1 -1
  312. data/node_modules/govuk-frontend/dist/govuk/init.mjs +90 -24
  313. data/node_modules/govuk-frontend/dist/govuk/init.mjs.map +1 -1
  314. data/node_modules/govuk-frontend/dist/govuk/macros/logo.njk +78 -0
  315. data/node_modules/govuk-frontend/dist/govuk/objects/_template.scss +5 -1
  316. data/node_modules/govuk-frontend/dist/govuk/objects/_template.scss.map +1 -1
  317. data/node_modules/govuk-frontend/dist/govuk/overrides/_typography.scss +5 -1
  318. data/node_modules/govuk-frontend/dist/govuk/overrides/_typography.scss.map +1 -1
  319. data/node_modules/govuk-frontend/dist/govuk/settings/_colours-applied.scss +39 -1
  320. data/node_modules/govuk-frontend/dist/govuk/settings/_colours-applied.scss.map +1 -1
  321. data/node_modules/govuk-frontend/dist/govuk/settings/_colours-organisations.scss +244 -10
  322. data/node_modules/govuk-frontend/dist/govuk/settings/_colours-organisations.scss.map +1 -1
  323. data/node_modules/govuk-frontend/dist/govuk/settings/_typography-responsive.scss +5 -10
  324. data/node_modules/govuk-frontend/dist/govuk/settings/_typography-responsive.scss.map +1 -1
  325. data/node_modules/govuk-frontend/dist/govuk/template.njk +20 -9
  326. data/node_modules/govuk-frontend/dist/govuk/tools/_index.scss +1 -0
  327. data/node_modules/govuk-frontend/dist/govuk/tools/_index.scss.map +1 -1
  328. data/node_modules/govuk-frontend/dist/govuk/tools/_rebrand.scss +65 -0
  329. data/node_modules/govuk-frontend/dist/govuk/tools/_rebrand.scss.map +1 -0
  330. data/node_modules/govuk-frontend/dist/govuk-prototype-kit/functions.js +25 -0
  331. data/node_modules/govuk-frontend/dist/govuk-prototype-kit/init.scss +1 -1
  332. data/node_modules/govuk-frontend/dist/govuk-prototype-kit/init.scss.map +1 -1
  333. data/node_modules/govuk-frontend/govuk-prototype-kit.config.json +8 -1
  334. data/node_modules/govuk-frontend/package.json +16 -16
  335. data/spec/spec_helper.rb +98 -0
  336. data/spec/tasks/assets_spec.rb +53 -0
  337. data/vendor/assets/assets/fonts/bold-affa96571d-v2.woff +0 -0
  338. data/vendor/assets/assets/fonts/bold-b542beb274-v2.woff2 +0 -0
  339. data/vendor/assets/assets/fonts/light-94a07e06a1-v2.woff2 +0 -0
  340. data/vendor/assets/assets/fonts/light-f591b13f7d-v2.woff +0 -0
  341. data/vendor/assets/assets/images/favicon.ico +0 -0
  342. data/vendor/assets/assets/images/favicon.svg +1 -0
  343. data/vendor/assets/assets/images/govuk-crest.svg +1 -0
  344. data/vendor/assets/assets/images/govuk-icon-180.png +0 -0
  345. data/vendor/assets/assets/images/govuk-icon-192.png +0 -0
  346. data/vendor/assets/assets/images/govuk-icon-512.png +0 -0
  347. data/vendor/assets/assets/images/govuk-icon-mask.svg +1 -0
  348. data/vendor/assets/assets/images/govuk-opengraph-image.png +0 -0
  349. data/vendor/assets/assets/manifest.json +39 -0
  350. data/vendor/assets/assets/rebrand/images/favicon.ico +0 -0
  351. data/vendor/assets/assets/rebrand/images/favicon.svg +1 -0
  352. data/vendor/assets/assets/rebrand/images/govuk-crest.svg +1 -0
  353. data/vendor/assets/assets/rebrand/images/govuk-icon-180.png +0 -0
  354. data/vendor/assets/assets/rebrand/images/govuk-icon-192.png +0 -0
  355. data/vendor/assets/assets/rebrand/images/govuk-icon-512.png +0 -0
  356. data/vendor/assets/assets/rebrand/images/govuk-icon-mask.svg +1 -0
  357. data/vendor/assets/assets/rebrand/images/govuk-opengraph-image.png +0 -0
  358. data/vendor/assets/assets/rebrand/manifest.json +39 -0
  359. data/vendor/assets/images/govuk-crest.svg +1 -0
  360. data/vendor/assets/javascripts/defra_ruby_template.js +882 -492
  361. data/vendor/assets/stylesheets/all.scss +6 -0
  362. data/vendor/assets/stylesheets/components/_index.scss +1 -0
  363. data/vendor/assets/stylesheets/components/accordion/_index.scss +35 -31
  364. data/vendor/assets/stylesheets/components/character-count/_index.scss +12 -4
  365. data/vendor/assets/stylesheets/components/checkboxes/_index.scss +6 -1
  366. data/vendor/assets/stylesheets/components/cookie-banner/_index.scss +23 -14
  367. data/vendor/assets/stylesheets/components/date-input/_index.scss +2 -2
  368. data/vendor/assets/stylesheets/components/details/_index.scss +7 -2
  369. data/vendor/assets/stylesheets/components/error-summary/_index.scss +4 -0
  370. data/vendor/assets/stylesheets/components/fieldset/_index.scss +3 -5
  371. data/vendor/assets/stylesheets/components/file-upload/_index.scss +175 -9
  372. data/vendor/assets/stylesheets/components/footer/_index.scss +61 -19
  373. data/vendor/assets/stylesheets/components/header/_index.scss +223 -21
  374. data/vendor/assets/stylesheets/components/input/_index.scss +7 -4
  375. data/vendor/assets/stylesheets/components/notification-banner/_index.scss +3 -2
  376. data/vendor/assets/stylesheets/components/pagination/_index.scss +24 -37
  377. data/vendor/assets/stylesheets/components/panel/_index.scss +13 -9
  378. data/vendor/assets/stylesheets/components/password-input/_index.scss +12 -9
  379. data/vendor/assets/stylesheets/components/phase-banner/_index.scss +0 -8
  380. data/vendor/assets/stylesheets/components/radios/_index.scss +7 -5
  381. data/vendor/assets/stylesheets/components/select/_index.scss +5 -5
  382. data/vendor/assets/stylesheets/components/service-navigation/_index.scss +187 -0
  383. data/vendor/assets/stylesheets/components/service-navigation/_service-navigation.scss +4 -0
  384. data/vendor/assets/stylesheets/components/skip-link/_index.scss +6 -4
  385. data/vendor/assets/stylesheets/components/summary-list/_index.scss +14 -22
  386. data/vendor/assets/stylesheets/components/tag/_index.scss +11 -8
  387. data/vendor/assets/stylesheets/components/task-list/_index.scss +12 -10
  388. data/vendor/assets/stylesheets/components/textarea/_index.scss +3 -3
  389. data/vendor/assets/stylesheets/components/warning-text/_index.scss +6 -5
  390. data/vendor/assets/stylesheets/core/_govuk-frontend-properties.scss +1 -1
  391. data/vendor/assets/stylesheets/defra_ruby_template.scss +6 -0
  392. data/vendor/assets/stylesheets/govuk-frontend.min.css +2 -2
  393. data/vendor/assets/stylesheets/helpers/_colour.scss +55 -8
  394. data/vendor/assets/stylesheets/helpers/_focused.scss +14 -4
  395. data/vendor/assets/stylesheets/helpers/_grid.scss +1 -1
  396. data/vendor/assets/stylesheets/helpers/_links.scss +2 -2
  397. data/vendor/assets/stylesheets/helpers/_shape-arrow.scss +1 -1
  398. data/vendor/assets/stylesheets/helpers/_typography.scss +18 -1
  399. data/vendor/assets/stylesheets/helpers/_visually-hidden.scss +30 -62
  400. data/vendor/assets/stylesheets/objects/_template.scss +5 -1
  401. data/vendor/assets/stylesheets/overrides/_typography.scss +5 -1
  402. data/vendor/assets/stylesheets/settings/_colours-applied.scss +39 -1
  403. data/vendor/assets/stylesheets/settings/_colours-organisations.scss +244 -10
  404. data/vendor/assets/stylesheets/settings/_typography-responsive.scss +5 -10
  405. data/vendor/assets/stylesheets/tools/_index.scss +1 -0
  406. data/vendor/assets/stylesheets/tools/_rebrand.scss +65 -0
  407. metadata +100 -24
  408. data/.github/dependabot.yml +0 -14
  409. data/.github/workflows/ci.yml +0 -31
  410. data/.gitignore +0 -8
  411. data/.rspec +0 -1
  412. data/.rubocop.yml +0 -3
  413. data/.ruby-version +0 -1
  414. data/Gemfile +0 -9
  415. data/Gemfile.lock +0 -58
  416. data/defra_ruby_template.gemspec +0 -35
  417. data/node_modules/.package-lock.json +0 -16
  418. data/node_modules/govuk-frontend/dist/govuk/assets/images/govuk-crest-2x.png +0 -0
  419. data/node_modules/govuk-frontend/dist/govuk/assets/images/govuk-crest.png +0 -0
  420. data/node_modules/govuk-frontend/dist/govuk/common/normalise-dataset.mjs +0 -18
  421. data/node_modules/govuk-frontend/dist/govuk/common/normalise-dataset.mjs.map +0 -1
  422. data/node_modules/govuk-frontend/dist/govuk/common/normalise-string.mjs +0 -31
  423. data/node_modules/govuk-frontend/dist/govuk/common/normalise-string.mjs.map +0 -1
  424. data/node_modules/govuk-frontend/dist/govuk/components/file-upload/template-with-value.html +0 -6
  425. data/node_modules/govuk-frontend/dist/govuk/govuk-frontend-component.mjs +0 -16
  426. data/node_modules/govuk-frontend/dist/govuk/govuk-frontend-component.mjs.map +0 -1
  427. data/package-lock.json +0 -24
  428. data/package.json +0 -29
@@ -1,9 +1,179 @@
1
1
  (function (global, factory) {
2
2
  typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
3
3
  typeof define === 'function' && define.amd ? define(['exports'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.GOVUKFrontend = {}));
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.GOVUKFrontend = global.GOVUKFrontend || {}));
5
5
  })(this, (function (exports) { 'use strict';
6
6
 
7
+ function isInitialised($root, moduleName) {
8
+ return $root instanceof HTMLElement && $root.hasAttribute(`data-${moduleName}-init`);
9
+ }
10
+
11
+ /**
12
+ * Checks if GOV.UK Frontend is supported on this page
13
+ *
14
+ * Some browsers will load and run our JavaScript but GOV.UK Frontend
15
+ * won't be supported.
16
+ *
17
+ * @param {HTMLElement | null} [$scope] - (internal) `<body>` HTML element checked for browser support
18
+ * @returns {boolean} Whether GOV.UK Frontend is supported on this page
19
+ */
20
+ function isSupported($scope = document.body) {
21
+ if (!$scope) {
22
+ return false;
23
+ }
24
+ return $scope.classList.contains('govuk-frontend-supported');
25
+ }
26
+ function isArray(option) {
27
+ return Array.isArray(option);
28
+ }
29
+ function isObject(option) {
30
+ return !!option && typeof option === 'object' && !isArray(option);
31
+ }
32
+ function formatErrorMessage(Component, message) {
33
+ return `${Component.moduleName}: ${message}`;
34
+ }
35
+ /**
36
+ * @typedef ComponentWithModuleName
37
+ * @property {string} moduleName - Name of the component
38
+ */
39
+ /**
40
+ * @import { ObjectNested } from './configuration.mjs'
41
+ */
42
+
43
+ class GOVUKFrontendError extends Error {
44
+ constructor(...args) {
45
+ super(...args);
46
+ this.name = 'GOVUKFrontendError';
47
+ }
48
+ }
49
+ class SupportError extends GOVUKFrontendError {
50
+ /**
51
+ * Checks if GOV.UK Frontend is supported on this page
52
+ *
53
+ * @param {HTMLElement | null} [$scope] - HTML element `<body>` checked for browser support
54
+ */
55
+ constructor($scope = document.body) {
56
+ const supportMessage = 'noModule' in HTMLScriptElement.prototype ? 'GOV.UK Frontend initialised without `<body class="govuk-frontend-supported">` from template `<script>` snippet' : 'GOV.UK Frontend is not supported in this browser';
57
+ super($scope ? supportMessage : 'GOV.UK Frontend initialised without `<script type="module">`');
58
+ this.name = 'SupportError';
59
+ }
60
+ }
61
+ class ConfigError extends GOVUKFrontendError {
62
+ constructor(...args) {
63
+ super(...args);
64
+ this.name = 'ConfigError';
65
+ }
66
+ }
67
+ class ElementError extends GOVUKFrontendError {
68
+ constructor(messageOrOptions) {
69
+ let message = typeof messageOrOptions === 'string' ? messageOrOptions : '';
70
+ if (typeof messageOrOptions === 'object') {
71
+ const {
72
+ component,
73
+ identifier,
74
+ element,
75
+ expectedType
76
+ } = messageOrOptions;
77
+ message = identifier;
78
+ message += element ? ` is not of type ${expectedType != null ? expectedType : 'HTMLElement'}` : ' not found';
79
+ message = formatErrorMessage(component, message);
80
+ }
81
+ super(message);
82
+ this.name = 'ElementError';
83
+ }
84
+ }
85
+ class InitError extends GOVUKFrontendError {
86
+ constructor(componentOrMessage) {
87
+ const message = typeof componentOrMessage === 'string' ? componentOrMessage : formatErrorMessage(componentOrMessage, `Root element (\`$root\`) already initialised`);
88
+ super(message);
89
+ this.name = 'InitError';
90
+ }
91
+ }
92
+ /**
93
+ * @import { ComponentWithModuleName } from '../common/index.mjs'
94
+ */
95
+
96
+ class Component {
97
+ /**
98
+ * Returns the root element of the component
99
+ *
100
+ * @protected
101
+ * @returns {RootElementType} - the root element of component
102
+ */
103
+ get $root() {
104
+ return this._$root;
105
+ }
106
+ constructor($root) {
107
+ this._$root = void 0;
108
+ const childConstructor = this.constructor;
109
+ if (typeof childConstructor.moduleName !== 'string') {
110
+ throw new InitError(`\`moduleName\` not defined in component`);
111
+ }
112
+ if (!($root instanceof childConstructor.elementType)) {
113
+ throw new ElementError({
114
+ element: $root,
115
+ component: childConstructor,
116
+ identifier: 'Root element (`$root`)',
117
+ expectedType: childConstructor.elementType.name
118
+ });
119
+ } else {
120
+ this._$root = $root;
121
+ }
122
+ childConstructor.checkSupport();
123
+ this.checkInitialised();
124
+ const moduleName = childConstructor.moduleName;
125
+ this.$root.setAttribute(`data-${moduleName}-init`, '');
126
+ }
127
+ checkInitialised() {
128
+ const constructor = this.constructor;
129
+ const moduleName = constructor.moduleName;
130
+ if (moduleName && isInitialised(this.$root, moduleName)) {
131
+ throw new InitError(constructor);
132
+ }
133
+ }
134
+ static checkSupport() {
135
+ if (!isSupported()) {
136
+ throw new SupportError();
137
+ }
138
+ }
139
+ }
140
+
141
+ /**
142
+ * @typedef ChildClass
143
+ * @property {string} moduleName - The module name that'll be looked for in the DOM when initialising the component
144
+ */
145
+
146
+ /**
147
+ * @typedef {typeof Component & ChildClass} ChildClassConstructor
148
+ */
149
+ Component.elementType = HTMLElement;
150
+
151
+ const configOverride = Symbol.for('configOverride');
152
+ class ConfigurableComponent extends Component {
153
+ [configOverride](param) {
154
+ return {};
155
+ }
156
+
157
+ /**
158
+ * Returns the root element of the component
159
+ *
160
+ * @protected
161
+ * @returns {ConfigurationType} - the root element of component
162
+ */
163
+ get config() {
164
+ return this._config;
165
+ }
166
+ constructor($root, config) {
167
+ super($root);
168
+ this._config = void 0;
169
+ const childConstructor = this.constructor;
170
+ if (!isObject(childConstructor.defaults)) {
171
+ throw new ConfigError(formatErrorMessage(childConstructor, 'Config passed as parameter into constructor but no defaults defined'));
172
+ }
173
+ const datasetConfig = normaliseDataset(childConstructor, this._$root.dataset);
174
+ this._config = mergeConfigs(childConstructor.defaults, config != null ? config : {}, this[configOverride](datasetConfig), datasetConfig);
175
+ }
176
+ }
7
177
  function normaliseString(value, property) {
8
178
  const trimmedValue = value ? value.trim() : '';
9
179
  let output;
@@ -28,11 +198,24 @@
28
198
  }
29
199
  return output;
30
200
  }
31
-
32
- /**
33
- * @typedef {import('./index.mjs').SchemaProperty} SchemaProperty
34
- */
35
-
201
+ function normaliseDataset(Component, dataset) {
202
+ if (!isObject(Component.schema)) {
203
+ throw new ConfigError(formatErrorMessage(Component, 'Config passed as parameter into constructor but no schema defined'));
204
+ }
205
+ const out = {};
206
+ const entries = Object.entries(Component.schema.properties);
207
+ for (const entry of entries) {
208
+ const [namespace, property] = entry;
209
+ const field = namespace.toString();
210
+ if (field in dataset) {
211
+ out[field] = normaliseString(dataset[field], property);
212
+ }
213
+ if ((property == null ? void 0 : property.type) === 'object') {
214
+ out[field] = extractConfigByNamespace(Component.schema, dataset, namespace);
215
+ }
216
+ }
217
+ return out;
218
+ }
36
219
  function mergeConfigs(...configObjects) {
37
220
  const formattedConfigObject = {};
38
221
  for (const configObject of configObjects) {
@@ -48,19 +231,19 @@
48
231
  }
49
232
  return formattedConfigObject;
50
233
  }
51
- function extractConfigByNamespace(Component, dataset, namespace) {
52
- const property = Component.schema.properties[namespace];
234
+ function extractConfigByNamespace(schema, dataset, namespace) {
235
+ const property = schema.properties[namespace];
53
236
  if ((property == null ? void 0 : property.type) !== 'object') {
54
237
  return;
55
238
  }
56
239
  const newObject = {
57
- [namespace]: ({})
240
+ [namespace]: {}
58
241
  };
59
242
  for (const [key, value] of Object.entries(dataset)) {
60
243
  let current = newObject;
61
244
  const keyParts = key.split('.');
62
245
  for (const [index, name] of keyParts.entries()) {
63
- if (typeof current === 'object') {
246
+ if (isObject(current)) {
64
247
  if (index < keyParts.length - 1) {
65
248
  if (!isObject(current[name])) {
66
249
  current[name] = {};
@@ -74,101 +257,39 @@
74
257
  }
75
258
  return newObject[namespace];
76
259
  }
77
- function isSupported($scope = document.body) {
78
- if (!$scope) {
79
- return false;
80
- }
81
- return $scope.classList.contains('govuk-frontend-supported');
82
- }
83
- function isArray(option) {
84
- return Array.isArray(option);
85
- }
86
- function isObject(option) {
87
- return !!option && typeof option === 'object' && !isArray(option);
88
- }
89
-
90
260
  /**
91
261
  * Schema for component config
92
262
  *
263
+ * @template {Partial<Record<keyof ConfigurationType, unknown>>} ConfigurationType
93
264
  * @typedef {object} Schema
94
- * @property {{ [field: string]: SchemaProperty | undefined }} properties - Schema properties
95
- * @property {SchemaCondition[]} [anyOf] - List of schema conditions
265
+ * @property {Record<keyof ConfigurationType, SchemaProperty | undefined>} properties - Schema properties
266
+ * @property {SchemaCondition<ConfigurationType>[]} [anyOf] - List of schema conditions
96
267
  */
97
-
98
268
  /**
99
269
  * Schema property for component config
100
270
  *
101
271
  * @typedef {object} SchemaProperty
102
272
  * @property {'string' | 'boolean' | 'number' | 'object'} type - Property type
103
273
  */
104
-
105
274
  /**
106
275
  * Schema condition for component config
107
276
  *
277
+ * @template {Partial<Record<keyof ConfigurationType, unknown>>} ConfigurationType
108
278
  * @typedef {object} SchemaCondition
109
- * @property {string[]} required - List of required config fields
279
+ * @property {(keyof ConfigurationType)[]} required - List of required config fields
110
280
  * @property {string} errorMessage - Error message when required config fields not provided
111
281
  */
112
-
113
- function normaliseDataset(Component, dataset) {
114
- const out = {};
115
- for (const [field, property] of Object.entries(Component.schema.properties)) {
116
- if (field in dataset) {
117
- out[field] = normaliseString(dataset[field], property);
118
- }
119
- if ((property == null ? void 0 : property.type) === 'object') {
120
- out[field] = extractConfigByNamespace(Component, dataset, field);
121
- }
122
- }
123
- return out;
124
- }
125
-
126
- class GOVUKFrontendError extends Error {
127
- constructor(...args) {
128
- super(...args);
129
- this.name = 'GOVUKFrontendError';
130
- }
131
- }
132
- class SupportError extends GOVUKFrontendError {
133
- /**
134
- * Checks if GOV.UK Frontend is supported on this page
135
- *
136
- * @param {HTMLElement | null} [$scope] - HTML element `<body>` checked for browser support
137
- */
138
- constructor($scope = document.body) {
139
- const supportMessage = 'noModule' in HTMLScriptElement.prototype ? 'GOV.UK Frontend initialised without `<body class="govuk-frontend-supported">` from template `<script>` snippet' : 'GOV.UK Frontend is not supported in this browser';
140
- super($scope ? supportMessage : 'GOV.UK Frontend initialised without `<script type="module">`');
141
- this.name = 'SupportError';
142
- }
143
- }
144
- class ElementError extends GOVUKFrontendError {
145
- constructor(messageOrOptions) {
146
- let message = typeof messageOrOptions === 'string' ? messageOrOptions : '';
147
- if (typeof messageOrOptions === 'object') {
148
- const {
149
- componentName,
150
- identifier,
151
- element,
152
- expectedType
153
- } = messageOrOptions;
154
- message = `${componentName}: ${identifier}`;
155
- message += element ? ` is not of type ${expectedType != null ? expectedType : 'HTMLElement'}` : ' not found';
156
- }
157
- super(message);
158
- this.name = 'ElementError';
159
- }
160
- }
161
-
162
- class GOVUKFrontendComponent {
163
- constructor() {
164
- this.checkSupport();
165
- }
166
- checkSupport() {
167
- if (!isSupported()) {
168
- throw new SupportError();
169
- }
170
- }
171
- }
282
+ /**
283
+ * @template {Partial<Record<keyof ConfigurationType, unknown>>} [ConfigurationType=ObjectNested]
284
+ * @typedef ChildClass
285
+ * @property {string} moduleName - The module name that'll be looked for in the DOM when initialising the component
286
+ * @property {Schema<ConfigurationType>} [schema] - The schema of the component configuration
287
+ * @property {ConfigurationType} [defaults] - The default values of the configuration of the component
288
+ */
289
+ /**
290
+ * @template {Partial<Record<keyof ConfigurationType, unknown>>} [ConfigurationType=ObjectNested]
291
+ * @typedef {typeof Component & ChildClass<ConfigurationType>} ChildClassConstructor<ConfigurationType>
292
+ */
172
293
 
173
294
  class I18n {
174
295
  constructor(translations = {}, config = {}) {
@@ -376,16 +497,15 @@
376
497
  * attribute, which also provides accessibility.
377
498
  *
378
499
  * @preserve
500
+ * @augments ConfigurableComponent<AccordionConfig>
379
501
  */
380
- class Accordion extends GOVUKFrontendComponent {
502
+ class Accordion extends ConfigurableComponent {
381
503
  /**
382
- * @param {Element | null} $module - HTML element to use for accordion
504
+ * @param {Element | null} $root - HTML element to use for accordion
383
505
  * @param {AccordionConfig} [config] - Accordion config
384
506
  */
385
- constructor($module, config = {}) {
386
- super();
387
- this.$module = void 0;
388
- this.config = void 0;
507
+ constructor($root, config = {}) {
508
+ super($root, config);
389
509
  this.i18n = void 0;
390
510
  this.controlsClass = 'govuk-accordion__controls';
391
511
  this.showAllClass = 'govuk-accordion__show-all';
@@ -407,33 +527,21 @@
407
527
  this.sectionSummaryFocusClass = 'govuk-accordion__section-summary-focus';
408
528
  this.sectionContentClass = 'govuk-accordion__section-content';
409
529
  this.$sections = void 0;
410
- this.browserSupportsSessionStorage = false;
411
530
  this.$showAllButton = null;
412
531
  this.$showAllIcon = null;
413
532
  this.$showAllText = null;
414
- if (!($module instanceof HTMLElement)) {
415
- throw new ElementError({
416
- componentName: 'Accordion',
417
- element: $module,
418
- identifier: 'Root element (`$module`)'
419
- });
420
- }
421
- this.$module = $module;
422
- this.config = mergeConfigs(Accordion.defaults, config, normaliseDataset(Accordion, $module.dataset));
423
533
  this.i18n = new I18n(this.config.i18n);
424
- const $sections = this.$module.querySelectorAll(`.${this.sectionClass}`);
534
+ const $sections = this.$root.querySelectorAll(`.${this.sectionClass}`);
425
535
  if (!$sections.length) {
426
536
  throw new ElementError({
427
- componentName: 'Accordion',
537
+ component: Accordion,
428
538
  identifier: `Sections (\`<div class="${this.sectionClass}">\`)`
429
539
  });
430
540
  }
431
541
  this.$sections = $sections;
432
- this.browserSupportsSessionStorage = helper.checkForSessionStorage();
433
542
  this.initControls();
434
543
  this.initSectionHeaders();
435
- const areAllSectionsOpen = this.checkIfAllSectionsOpen();
436
- this.updateShowAllButton(areAllSectionsOpen);
544
+ this.updateShowAllButton(this.areAllSectionsOpen());
437
545
  }
438
546
  initControls() {
439
547
  this.$showAllButton = document.createElement('button');
@@ -446,7 +554,7 @@
446
554
  const $accordionControls = document.createElement('div');
447
555
  $accordionControls.setAttribute('class', this.controlsClass);
448
556
  $accordionControls.appendChild(this.$showAllButton);
449
- this.$module.insertBefore($accordionControls, this.$module.firstChild);
557
+ this.$root.insertBefore($accordionControls, this.$root.firstChild);
450
558
  this.$showAllText = document.createElement('span');
451
559
  this.$showAllText.classList.add(this.showAllTextClass);
452
560
  this.$showAllButton.appendChild(this.$showAllText);
@@ -460,7 +568,7 @@
460
568
  const $header = $section.querySelector(`.${this.sectionHeaderClass}`);
461
569
  if (!$header) {
462
570
  throw new ElementError({
463
- componentName: 'Accordion',
571
+ component: Accordion,
464
572
  identifier: `Section headers (\`<div class="${this.sectionHeaderClass}">\`)`
465
573
  });
466
574
  }
@@ -476,22 +584,22 @@
476
584
  const $summary = $header.querySelector(`.${this.sectionSummaryClass}`);
477
585
  if (!$heading) {
478
586
  throw new ElementError({
479
- componentName: 'Accordion',
587
+ component: Accordion,
480
588
  identifier: `Section heading (\`.${this.sectionHeadingClass}\`)`
481
589
  });
482
590
  }
483
591
  if (!$span) {
484
592
  throw new ElementError({
485
- componentName: 'Accordion',
593
+ component: Accordion,
486
594
  identifier: `Section button placeholder (\`<span class="${this.sectionButtonClass}">\`)`
487
595
  });
488
596
  }
489
597
  const $button = document.createElement('button');
490
598
  $button.setAttribute('type', 'button');
491
- $button.setAttribute('aria-controls', `${this.$module.id}-content-${index + 1}`);
599
+ $button.setAttribute('aria-controls', `${this.$root.id}-content-${index + 1}`);
492
600
  for (const attr of Array.from($span.attributes)) {
493
- if (attr.nodeName !== 'id') {
494
- $button.setAttribute(attr.nodeName, `${attr.nodeValue}`);
601
+ if (attr.name !== 'id') {
602
+ $button.setAttribute(attr.name, attr.value);
495
603
  }
496
604
  }
497
605
  const $headingText = document.createElement('span');
@@ -500,7 +608,7 @@
500
608
  const $headingTextFocus = document.createElement('span');
501
609
  $headingTextFocus.classList.add(this.sectionHeadingTextFocusClass);
502
610
  $headingText.appendChild($headingTextFocus);
503
- $headingTextFocus.innerHTML = $span.innerHTML;
611
+ Array.from($span.childNodes).forEach($child => $headingTextFocus.appendChild($child));
504
612
  const $showHideToggle = document.createElement('span');
505
613
  $showHideToggle.classList.add(this.sectionShowHideToggleClass);
506
614
  $showHideToggle.setAttribute('data-nosnippet', '');
@@ -515,16 +623,16 @@
515
623
  $showHideToggleFocus.appendChild($showHideText);
516
624
  $button.appendChild($headingText);
517
625
  $button.appendChild(this.getButtonPunctuationEl());
518
- if ($summary != null && $summary.parentNode) {
626
+ if ($summary) {
519
627
  const $summarySpan = document.createElement('span');
520
628
  const $summarySpanFocus = document.createElement('span');
521
629
  $summarySpanFocus.classList.add(this.sectionSummaryFocusClass);
522
630
  $summarySpan.appendChild($summarySpanFocus);
523
631
  for (const attr of Array.from($summary.attributes)) {
524
- $summarySpan.setAttribute(attr.nodeName, `${attr.nodeValue}`);
632
+ $summarySpan.setAttribute(attr.name, attr.value);
525
633
  }
526
- $summarySpanFocus.innerHTML = $summary.innerHTML;
527
- $summary.parentNode.replaceChild($summarySpan, $summary);
634
+ Array.from($summary.childNodes).forEach($child => $summarySpanFocus.appendChild($child));
635
+ $summary.remove();
528
636
  $button.appendChild($summarySpan);
529
637
  $button.appendChild(this.getButtonPunctuationEl());
530
638
  }
@@ -543,15 +651,15 @@
543
651
  }
544
652
  }
545
653
  onSectionToggle($section) {
546
- const expanded = this.isExpanded($section);
547
- this.setExpanded(!expanded, $section);
548
- this.storeState($section);
654
+ const nowExpanded = !this.isExpanded($section);
655
+ this.setExpanded(nowExpanded, $section);
656
+ this.storeState($section, nowExpanded);
549
657
  }
550
658
  onShowOrHideAllToggle() {
551
- const nowExpanded = !this.checkIfAllSectionsOpen();
659
+ const nowExpanded = !this.areAllSectionsOpen();
552
660
  this.$sections.forEach($section => {
553
661
  this.setExpanded(nowExpanded, $section);
554
- this.storeState($section);
662
+ this.storeState($section, nowExpanded);
555
663
  });
556
664
  this.updateShowAllButton(nowExpanded);
557
665
  }
@@ -562,7 +670,7 @@
562
670
  const $content = $section.querySelector(`.${this.sectionContentClass}`);
563
671
  if (!$content) {
564
672
  throw new ElementError({
565
- componentName: 'Accordion',
673
+ component: Accordion,
566
674
  identifier: `Section content (\`<div class="${this.sectionContentClass}">\`)`
567
675
  });
568
676
  }
@@ -593,17 +701,13 @@
593
701
  $section.classList.remove(this.sectionExpandedClass);
594
702
  $showHideIcon.classList.add(this.downChevronIconClass);
595
703
  }
596
- const areAllSectionsOpen = this.checkIfAllSectionsOpen();
597
- this.updateShowAllButton(areAllSectionsOpen);
704
+ this.updateShowAllButton(this.areAllSectionsOpen());
598
705
  }
599
706
  isExpanded($section) {
600
707
  return $section.classList.contains(this.sectionExpandedClass);
601
708
  }
602
- checkIfAllSectionsOpen() {
603
- const sectionsCount = this.$sections.length;
604
- const expandedSectionCount = this.$module.querySelectorAll(`.${this.sectionExpandedClass}`).length;
605
- const areAllSectionsOpen = sectionsCount === expandedSectionCount;
606
- return areAllSectionsOpen;
709
+ areAllSectionsOpen() {
710
+ return Array.from(this.$sections).every($section => this.isExpanded($section));
607
711
  }
608
712
  updateShowAllButton(expanded) {
609
713
  if (!this.$showAllButton || !this.$showAllText || !this.$showAllIcon) {
@@ -613,78 +717,53 @@
613
717
  this.$showAllText.textContent = expanded ? this.i18n.t('hideAllSections') : this.i18n.t('showAllSections');
614
718
  this.$showAllIcon.classList.toggle(this.downChevronIconClass, !expanded);
615
719
  }
616
- storeState($section) {
617
- if (this.browserSupportsSessionStorage && this.config.rememberExpanded) {
618
- const $button = $section.querySelector(`.${this.sectionButtonClass}`);
619
- if ($button) {
620
- const contentId = $button.getAttribute('aria-controls');
621
- const contentState = $button.getAttribute('aria-expanded');
622
- if (contentId && contentState) {
623
- window.sessionStorage.setItem(contentId, contentState);
624
- }
625
- }
720
+
721
+ /**
722
+ * Get the identifier for a section
723
+ *
724
+ * We need a unique way of identifying each content in the Accordion.
725
+ * Since an `#id` should be unique and an `id` is required for `aria-`
726
+ * attributes `id` can be safely used.
727
+ *
728
+ * @param {Element} $section - Section element
729
+ * @returns {string | undefined | null} Identifier for section
730
+ */
731
+ getIdentifier($section) {
732
+ const $button = $section.querySelector(`.${this.sectionButtonClass}`);
733
+ return $button == null ? void 0 : $button.getAttribute('aria-controls');
734
+ }
735
+ storeState($section, isExpanded) {
736
+ if (!this.config.rememberExpanded) {
737
+ return;
738
+ }
739
+ const id = this.getIdentifier($section);
740
+ if (id) {
741
+ try {
742
+ window.sessionStorage.setItem(id, isExpanded.toString());
743
+ } catch (exception) {}
626
744
  }
627
745
  }
628
746
  setInitialState($section) {
629
- if (this.browserSupportsSessionStorage && this.config.rememberExpanded) {
630
- const $button = $section.querySelector(`.${this.sectionButtonClass}`);
631
- if ($button) {
632
- const contentId = $button.getAttribute('aria-controls');
633
- const contentState = contentId ? window.sessionStorage.getItem(contentId) : null;
634
- if (contentState !== null) {
635
- this.setExpanded(contentState === 'true', $section);
747
+ if (!this.config.rememberExpanded) {
748
+ return;
749
+ }
750
+ const id = this.getIdentifier($section);
751
+ if (id) {
752
+ try {
753
+ const state = window.sessionStorage.getItem(id);
754
+ if (state !== null) {
755
+ this.setExpanded(state === 'true', $section);
636
756
  }
637
- }
757
+ } catch (exception) {}
638
758
  }
639
759
  }
640
760
  getButtonPunctuationEl() {
641
761
  const $punctuationEl = document.createElement('span');
642
762
  $punctuationEl.classList.add('govuk-visually-hidden', this.sectionHeadingDividerClass);
643
- $punctuationEl.innerHTML = ', ';
763
+ $punctuationEl.textContent = ', ';
644
764
  return $punctuationEl;
645
765
  }
646
766
  }
647
- Accordion.moduleName = 'govuk-accordion';
648
- Accordion.defaults = Object.freeze({
649
- i18n: {
650
- hideAllSections: 'Hide all sections',
651
- hideSection: 'Hide',
652
- hideSectionAriaLabel: 'Hide this section',
653
- showAllSections: 'Show all sections',
654
- showSection: 'Show',
655
- showSectionAriaLabel: 'Show this section'
656
- },
657
- rememberExpanded: true
658
- });
659
- Accordion.schema = Object.freeze({
660
- properties: {
661
- i18n: {
662
- type: 'object'
663
- },
664
- rememberExpanded: {
665
- type: 'boolean'
666
- }
667
- }
668
- });
669
- const helper = {
670
- /**
671
- * Check for `window.sessionStorage`, and that it actually works.
672
- *
673
- * @returns {boolean} True if session storage is available
674
- */
675
- checkForSessionStorage: function () {
676
- const testString = 'this is the test string';
677
- let result;
678
- try {
679
- window.sessionStorage.setItem(testString, testString);
680
- result = window.sessionStorage.getItem(testString) === testString.toString();
681
- window.sessionStorage.removeItem(testString);
682
- return result;
683
- } catch (exception) {
684
- return false;
685
- }
686
- }
687
- };
688
767
 
689
768
  /**
690
769
  * Accordion config
@@ -720,8 +799,30 @@
720
799
  */
721
800
 
722
801
  /**
723
- * @typedef {import('../../common/index.mjs').Schema} Schema
802
+ * @import { Schema } from '../../common/configuration.mjs'
724
803
  */
804
+ Accordion.moduleName = 'govuk-accordion';
805
+ Accordion.defaults = Object.freeze({
806
+ i18n: {
807
+ hideAllSections: 'Hide all sections',
808
+ hideSection: 'Hide',
809
+ hideSectionAriaLabel: 'Hide this section',
810
+ showAllSections: 'Show all sections',
811
+ showSection: 'Show',
812
+ showSectionAriaLabel: 'Show this section'
813
+ },
814
+ rememberExpanded: true
815
+ });
816
+ Accordion.schema = Object.freeze({
817
+ properties: {
818
+ i18n: {
819
+ type: 'object'
820
+ },
821
+ rememberExpanded: {
822
+ type: 'boolean'
823
+ }
824
+ }
825
+ });
725
826
 
726
827
  exports.Accordion = Accordion;
727
828