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,3 +1,173 @@
1
+ function isInitialised($root, moduleName) {
2
+ return $root instanceof HTMLElement && $root.hasAttribute(`data-${moduleName}-init`);
3
+ }
4
+
5
+ /**
6
+ * Checks if GOV.UK Frontend is supported on this page
7
+ *
8
+ * Some browsers will load and run our JavaScript but GOV.UK Frontend
9
+ * won't be supported.
10
+ *
11
+ * @param {HTMLElement | null} [$scope] - (internal) `<body>` HTML element checked for browser support
12
+ * @returns {boolean} Whether GOV.UK Frontend is supported on this page
13
+ */
14
+ function isSupported($scope = document.body) {
15
+ if (!$scope) {
16
+ return false;
17
+ }
18
+ return $scope.classList.contains('govuk-frontend-supported');
19
+ }
20
+ function isArray(option) {
21
+ return Array.isArray(option);
22
+ }
23
+ function isObject(option) {
24
+ return !!option && typeof option === 'object' && !isArray(option);
25
+ }
26
+ function formatErrorMessage(Component, message) {
27
+ return `${Component.moduleName}: ${message}`;
28
+ }
29
+ /**
30
+ * @typedef ComponentWithModuleName
31
+ * @property {string} moduleName - Name of the component
32
+ */
33
+ /**
34
+ * @import { ObjectNested } from './configuration.mjs'
35
+ */
36
+
37
+ class GOVUKFrontendError extends Error {
38
+ constructor(...args) {
39
+ super(...args);
40
+ this.name = 'GOVUKFrontendError';
41
+ }
42
+ }
43
+ class SupportError extends GOVUKFrontendError {
44
+ /**
45
+ * Checks if GOV.UK Frontend is supported on this page
46
+ *
47
+ * @param {HTMLElement | null} [$scope] - HTML element `<body>` checked for browser support
48
+ */
49
+ constructor($scope = document.body) {
50
+ 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';
51
+ super($scope ? supportMessage : 'GOV.UK Frontend initialised without `<script type="module">`');
52
+ this.name = 'SupportError';
53
+ }
54
+ }
55
+ class ConfigError extends GOVUKFrontendError {
56
+ constructor(...args) {
57
+ super(...args);
58
+ this.name = 'ConfigError';
59
+ }
60
+ }
61
+ class ElementError extends GOVUKFrontendError {
62
+ constructor(messageOrOptions) {
63
+ let message = typeof messageOrOptions === 'string' ? messageOrOptions : '';
64
+ if (typeof messageOrOptions === 'object') {
65
+ const {
66
+ component,
67
+ identifier,
68
+ element,
69
+ expectedType
70
+ } = messageOrOptions;
71
+ message = identifier;
72
+ message += element ? ` is not of type ${expectedType != null ? expectedType : 'HTMLElement'}` : ' not found';
73
+ message = formatErrorMessage(component, message);
74
+ }
75
+ super(message);
76
+ this.name = 'ElementError';
77
+ }
78
+ }
79
+ class InitError extends GOVUKFrontendError {
80
+ constructor(componentOrMessage) {
81
+ const message = typeof componentOrMessage === 'string' ? componentOrMessage : formatErrorMessage(componentOrMessage, `Root element (\`$root\`) already initialised`);
82
+ super(message);
83
+ this.name = 'InitError';
84
+ }
85
+ }
86
+ /**
87
+ * @import { ComponentWithModuleName } from '../common/index.mjs'
88
+ */
89
+
90
+ class Component {
91
+ /**
92
+ * Returns the root element of the component
93
+ *
94
+ * @protected
95
+ * @returns {RootElementType} - the root element of component
96
+ */
97
+ get $root() {
98
+ return this._$root;
99
+ }
100
+ constructor($root) {
101
+ this._$root = void 0;
102
+ const childConstructor = this.constructor;
103
+ if (typeof childConstructor.moduleName !== 'string') {
104
+ throw new InitError(`\`moduleName\` not defined in component`);
105
+ }
106
+ if (!($root instanceof childConstructor.elementType)) {
107
+ throw new ElementError({
108
+ element: $root,
109
+ component: childConstructor,
110
+ identifier: 'Root element (`$root`)',
111
+ expectedType: childConstructor.elementType.name
112
+ });
113
+ } else {
114
+ this._$root = $root;
115
+ }
116
+ childConstructor.checkSupport();
117
+ this.checkInitialised();
118
+ const moduleName = childConstructor.moduleName;
119
+ this.$root.setAttribute(`data-${moduleName}-init`, '');
120
+ }
121
+ checkInitialised() {
122
+ const constructor = this.constructor;
123
+ const moduleName = constructor.moduleName;
124
+ if (moduleName && isInitialised(this.$root, moduleName)) {
125
+ throw new InitError(constructor);
126
+ }
127
+ }
128
+ static checkSupport() {
129
+ if (!isSupported()) {
130
+ throw new SupportError();
131
+ }
132
+ }
133
+ }
134
+
135
+ /**
136
+ * @typedef ChildClass
137
+ * @property {string} moduleName - The module name that'll be looked for in the DOM when initialising the component
138
+ */
139
+
140
+ /**
141
+ * @typedef {typeof Component & ChildClass} ChildClassConstructor
142
+ */
143
+ Component.elementType = HTMLElement;
144
+
145
+ const configOverride = Symbol.for('configOverride');
146
+ class ConfigurableComponent extends Component {
147
+ [configOverride](param) {
148
+ return {};
149
+ }
150
+
151
+ /**
152
+ * Returns the root element of the component
153
+ *
154
+ * @protected
155
+ * @returns {ConfigurationType} - the root element of component
156
+ */
157
+ get config() {
158
+ return this._config;
159
+ }
160
+ constructor($root, config) {
161
+ super($root);
162
+ this._config = void 0;
163
+ const childConstructor = this.constructor;
164
+ if (!isObject(childConstructor.defaults)) {
165
+ throw new ConfigError(formatErrorMessage(childConstructor, 'Config passed as parameter into constructor but no defaults defined'));
166
+ }
167
+ const datasetConfig = normaliseDataset(childConstructor, this._$root.dataset);
168
+ this._config = mergeConfigs(childConstructor.defaults, config != null ? config : {}, this[configOverride](datasetConfig), datasetConfig);
169
+ }
170
+ }
1
171
  function normaliseString(value, property) {
2
172
  const trimmedValue = value ? value.trim() : '';
3
173
  let output;
@@ -22,11 +192,24 @@ function normaliseString(value, property) {
22
192
  }
23
193
  return output;
24
194
  }
25
-
26
- /**
27
- * @typedef {import('./index.mjs').SchemaProperty} SchemaProperty
28
- */
29
-
195
+ function normaliseDataset(Component, dataset) {
196
+ if (!isObject(Component.schema)) {
197
+ throw new ConfigError(formatErrorMessage(Component, 'Config passed as parameter into constructor but no schema defined'));
198
+ }
199
+ const out = {};
200
+ const entries = Object.entries(Component.schema.properties);
201
+ for (const entry of entries) {
202
+ const [namespace, property] = entry;
203
+ const field = namespace.toString();
204
+ if (field in dataset) {
205
+ out[field] = normaliseString(dataset[field], property);
206
+ }
207
+ if ((property == null ? void 0 : property.type) === 'object') {
208
+ out[field] = extractConfigByNamespace(Component.schema, dataset, namespace);
209
+ }
210
+ }
211
+ return out;
212
+ }
30
213
  function mergeConfigs(...configObjects) {
31
214
  const formattedConfigObject = {};
32
215
  for (const configObject of configObjects) {
@@ -42,19 +225,19 @@ function mergeConfigs(...configObjects) {
42
225
  }
43
226
  return formattedConfigObject;
44
227
  }
45
- function extractConfigByNamespace(Component, dataset, namespace) {
46
- const property = Component.schema.properties[namespace];
228
+ function extractConfigByNamespace(schema, dataset, namespace) {
229
+ const property = schema.properties[namespace];
47
230
  if ((property == null ? void 0 : property.type) !== 'object') {
48
231
  return;
49
232
  }
50
233
  const newObject = {
51
- [namespace]: ({})
234
+ [namespace]: {}
52
235
  };
53
236
  for (const [key, value] of Object.entries(dataset)) {
54
237
  let current = newObject;
55
238
  const keyParts = key.split('.');
56
239
  for (const [index, name] of keyParts.entries()) {
57
- if (typeof current === 'object') {
240
+ if (isObject(current)) {
58
241
  if (index < keyParts.length - 1) {
59
242
  if (!isObject(current[name])) {
60
243
  current[name] = {};
@@ -68,101 +251,39 @@ function extractConfigByNamespace(Component, dataset, namespace) {
68
251
  }
69
252
  return newObject[namespace];
70
253
  }
71
- function isSupported($scope = document.body) {
72
- if (!$scope) {
73
- return false;
74
- }
75
- return $scope.classList.contains('govuk-frontend-supported');
76
- }
77
- function isArray(option) {
78
- return Array.isArray(option);
79
- }
80
- function isObject(option) {
81
- return !!option && typeof option === 'object' && !isArray(option);
82
- }
83
-
84
254
  /**
85
255
  * Schema for component config
86
256
  *
257
+ * @template {Partial<Record<keyof ConfigurationType, unknown>>} ConfigurationType
87
258
  * @typedef {object} Schema
88
- * @property {{ [field: string]: SchemaProperty | undefined }} properties - Schema properties
89
- * @property {SchemaCondition[]} [anyOf] - List of schema conditions
259
+ * @property {Record<keyof ConfigurationType, SchemaProperty | undefined>} properties - Schema properties
260
+ * @property {SchemaCondition<ConfigurationType>[]} [anyOf] - List of schema conditions
90
261
  */
91
-
92
262
  /**
93
263
  * Schema property for component config
94
264
  *
95
265
  * @typedef {object} SchemaProperty
96
266
  * @property {'string' | 'boolean' | 'number' | 'object'} type - Property type
97
267
  */
98
-
99
268
  /**
100
269
  * Schema condition for component config
101
270
  *
271
+ * @template {Partial<Record<keyof ConfigurationType, unknown>>} ConfigurationType
102
272
  * @typedef {object} SchemaCondition
103
- * @property {string[]} required - List of required config fields
273
+ * @property {(keyof ConfigurationType)[]} required - List of required config fields
104
274
  * @property {string} errorMessage - Error message when required config fields not provided
105
275
  */
106
-
107
- function normaliseDataset(Component, dataset) {
108
- const out = {};
109
- for (const [field, property] of Object.entries(Component.schema.properties)) {
110
- if (field in dataset) {
111
- out[field] = normaliseString(dataset[field], property);
112
- }
113
- if ((property == null ? void 0 : property.type) === 'object') {
114
- out[field] = extractConfigByNamespace(Component, dataset, field);
115
- }
116
- }
117
- return out;
118
- }
119
-
120
- class GOVUKFrontendError extends Error {
121
- constructor(...args) {
122
- super(...args);
123
- this.name = 'GOVUKFrontendError';
124
- }
125
- }
126
- class SupportError extends GOVUKFrontendError {
127
- /**
128
- * Checks if GOV.UK Frontend is supported on this page
129
- *
130
- * @param {HTMLElement | null} [$scope] - HTML element `<body>` checked for browser support
131
- */
132
- constructor($scope = document.body) {
133
- 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';
134
- super($scope ? supportMessage : 'GOV.UK Frontend initialised without `<script type="module">`');
135
- this.name = 'SupportError';
136
- }
137
- }
138
- class ElementError extends GOVUKFrontendError {
139
- constructor(messageOrOptions) {
140
- let message = typeof messageOrOptions === 'string' ? messageOrOptions : '';
141
- if (typeof messageOrOptions === 'object') {
142
- const {
143
- componentName,
144
- identifier,
145
- element,
146
- expectedType
147
- } = messageOrOptions;
148
- message = `${componentName}: ${identifier}`;
149
- message += element ? ` is not of type ${expectedType != null ? expectedType : 'HTMLElement'}` : ' not found';
150
- }
151
- super(message);
152
- this.name = 'ElementError';
153
- }
154
- }
155
-
156
- class GOVUKFrontendComponent {
157
- constructor() {
158
- this.checkSupport();
159
- }
160
- checkSupport() {
161
- if (!isSupported()) {
162
- throw new SupportError();
163
- }
164
- }
165
- }
276
+ /**
277
+ * @template {Partial<Record<keyof ConfigurationType, unknown>>} [ConfigurationType=ObjectNested]
278
+ * @typedef ChildClass
279
+ * @property {string} moduleName - The module name that'll be looked for in the DOM when initialising the component
280
+ * @property {Schema<ConfigurationType>} [schema] - The schema of the component configuration
281
+ * @property {ConfigurationType} [defaults] - The default values of the configuration of the component
282
+ */
283
+ /**
284
+ * @template {Partial<Record<keyof ConfigurationType, unknown>>} [ConfigurationType=ObjectNested]
285
+ * @typedef {typeof Component & ChildClass<ConfigurationType>} ChildClassConstructor<ConfigurationType>
286
+ */
166
287
 
167
288
  class I18n {
168
289
  constructor(translations = {}, config = {}) {
@@ -370,16 +491,15 @@ I18n.pluralRules = {
370
491
  * attribute, which also provides accessibility.
371
492
  *
372
493
  * @preserve
494
+ * @augments ConfigurableComponent<AccordionConfig>
373
495
  */
374
- class Accordion extends GOVUKFrontendComponent {
496
+ class Accordion extends ConfigurableComponent {
375
497
  /**
376
- * @param {Element | null} $module - HTML element to use for accordion
498
+ * @param {Element | null} $root - HTML element to use for accordion
377
499
  * @param {AccordionConfig} [config] - Accordion config
378
500
  */
379
- constructor($module, config = {}) {
380
- super();
381
- this.$module = void 0;
382
- this.config = void 0;
501
+ constructor($root, config = {}) {
502
+ super($root, config);
383
503
  this.i18n = void 0;
384
504
  this.controlsClass = 'govuk-accordion__controls';
385
505
  this.showAllClass = 'govuk-accordion__show-all';
@@ -401,33 +521,21 @@ class Accordion extends GOVUKFrontendComponent {
401
521
  this.sectionSummaryFocusClass = 'govuk-accordion__section-summary-focus';
402
522
  this.sectionContentClass = 'govuk-accordion__section-content';
403
523
  this.$sections = void 0;
404
- this.browserSupportsSessionStorage = false;
405
524
  this.$showAllButton = null;
406
525
  this.$showAllIcon = null;
407
526
  this.$showAllText = null;
408
- if (!($module instanceof HTMLElement)) {
409
- throw new ElementError({
410
- componentName: 'Accordion',
411
- element: $module,
412
- identifier: 'Root element (`$module`)'
413
- });
414
- }
415
- this.$module = $module;
416
- this.config = mergeConfigs(Accordion.defaults, config, normaliseDataset(Accordion, $module.dataset));
417
527
  this.i18n = new I18n(this.config.i18n);
418
- const $sections = this.$module.querySelectorAll(`.${this.sectionClass}`);
528
+ const $sections = this.$root.querySelectorAll(`.${this.sectionClass}`);
419
529
  if (!$sections.length) {
420
530
  throw new ElementError({
421
- componentName: 'Accordion',
531
+ component: Accordion,
422
532
  identifier: `Sections (\`<div class="${this.sectionClass}">\`)`
423
533
  });
424
534
  }
425
535
  this.$sections = $sections;
426
- this.browserSupportsSessionStorage = helper.checkForSessionStorage();
427
536
  this.initControls();
428
537
  this.initSectionHeaders();
429
- const areAllSectionsOpen = this.checkIfAllSectionsOpen();
430
- this.updateShowAllButton(areAllSectionsOpen);
538
+ this.updateShowAllButton(this.areAllSectionsOpen());
431
539
  }
432
540
  initControls() {
433
541
  this.$showAllButton = document.createElement('button');
@@ -440,7 +548,7 @@ class Accordion extends GOVUKFrontendComponent {
440
548
  const $accordionControls = document.createElement('div');
441
549
  $accordionControls.setAttribute('class', this.controlsClass);
442
550
  $accordionControls.appendChild(this.$showAllButton);
443
- this.$module.insertBefore($accordionControls, this.$module.firstChild);
551
+ this.$root.insertBefore($accordionControls, this.$root.firstChild);
444
552
  this.$showAllText = document.createElement('span');
445
553
  this.$showAllText.classList.add(this.showAllTextClass);
446
554
  this.$showAllButton.appendChild(this.$showAllText);
@@ -454,7 +562,7 @@ class Accordion extends GOVUKFrontendComponent {
454
562
  const $header = $section.querySelector(`.${this.sectionHeaderClass}`);
455
563
  if (!$header) {
456
564
  throw new ElementError({
457
- componentName: 'Accordion',
565
+ component: Accordion,
458
566
  identifier: `Section headers (\`<div class="${this.sectionHeaderClass}">\`)`
459
567
  });
460
568
  }
@@ -470,22 +578,22 @@ class Accordion extends GOVUKFrontendComponent {
470
578
  const $summary = $header.querySelector(`.${this.sectionSummaryClass}`);
471
579
  if (!$heading) {
472
580
  throw new ElementError({
473
- componentName: 'Accordion',
581
+ component: Accordion,
474
582
  identifier: `Section heading (\`.${this.sectionHeadingClass}\`)`
475
583
  });
476
584
  }
477
585
  if (!$span) {
478
586
  throw new ElementError({
479
- componentName: 'Accordion',
587
+ component: Accordion,
480
588
  identifier: `Section button placeholder (\`<span class="${this.sectionButtonClass}">\`)`
481
589
  });
482
590
  }
483
591
  const $button = document.createElement('button');
484
592
  $button.setAttribute('type', 'button');
485
- $button.setAttribute('aria-controls', `${this.$module.id}-content-${index + 1}`);
593
+ $button.setAttribute('aria-controls', `${this.$root.id}-content-${index + 1}`);
486
594
  for (const attr of Array.from($span.attributes)) {
487
- if (attr.nodeName !== 'id') {
488
- $button.setAttribute(attr.nodeName, `${attr.nodeValue}`);
595
+ if (attr.name !== 'id') {
596
+ $button.setAttribute(attr.name, attr.value);
489
597
  }
490
598
  }
491
599
  const $headingText = document.createElement('span');
@@ -494,7 +602,7 @@ class Accordion extends GOVUKFrontendComponent {
494
602
  const $headingTextFocus = document.createElement('span');
495
603
  $headingTextFocus.classList.add(this.sectionHeadingTextFocusClass);
496
604
  $headingText.appendChild($headingTextFocus);
497
- $headingTextFocus.innerHTML = $span.innerHTML;
605
+ Array.from($span.childNodes).forEach($child => $headingTextFocus.appendChild($child));
498
606
  const $showHideToggle = document.createElement('span');
499
607
  $showHideToggle.classList.add(this.sectionShowHideToggleClass);
500
608
  $showHideToggle.setAttribute('data-nosnippet', '');
@@ -509,16 +617,16 @@ class Accordion extends GOVUKFrontendComponent {
509
617
  $showHideToggleFocus.appendChild($showHideText);
510
618
  $button.appendChild($headingText);
511
619
  $button.appendChild(this.getButtonPunctuationEl());
512
- if ($summary != null && $summary.parentNode) {
620
+ if ($summary) {
513
621
  const $summarySpan = document.createElement('span');
514
622
  const $summarySpanFocus = document.createElement('span');
515
623
  $summarySpanFocus.classList.add(this.sectionSummaryFocusClass);
516
624
  $summarySpan.appendChild($summarySpanFocus);
517
625
  for (const attr of Array.from($summary.attributes)) {
518
- $summarySpan.setAttribute(attr.nodeName, `${attr.nodeValue}`);
626
+ $summarySpan.setAttribute(attr.name, attr.value);
519
627
  }
520
- $summarySpanFocus.innerHTML = $summary.innerHTML;
521
- $summary.parentNode.replaceChild($summarySpan, $summary);
628
+ Array.from($summary.childNodes).forEach($child => $summarySpanFocus.appendChild($child));
629
+ $summary.remove();
522
630
  $button.appendChild($summarySpan);
523
631
  $button.appendChild(this.getButtonPunctuationEl());
524
632
  }
@@ -537,15 +645,15 @@ class Accordion extends GOVUKFrontendComponent {
537
645
  }
538
646
  }
539
647
  onSectionToggle($section) {
540
- const expanded = this.isExpanded($section);
541
- this.setExpanded(!expanded, $section);
542
- this.storeState($section);
648
+ const nowExpanded = !this.isExpanded($section);
649
+ this.setExpanded(nowExpanded, $section);
650
+ this.storeState($section, nowExpanded);
543
651
  }
544
652
  onShowOrHideAllToggle() {
545
- const nowExpanded = !this.checkIfAllSectionsOpen();
653
+ const nowExpanded = !this.areAllSectionsOpen();
546
654
  this.$sections.forEach($section => {
547
655
  this.setExpanded(nowExpanded, $section);
548
- this.storeState($section);
656
+ this.storeState($section, nowExpanded);
549
657
  });
550
658
  this.updateShowAllButton(nowExpanded);
551
659
  }
@@ -556,7 +664,7 @@ class Accordion extends GOVUKFrontendComponent {
556
664
  const $content = $section.querySelector(`.${this.sectionContentClass}`);
557
665
  if (!$content) {
558
666
  throw new ElementError({
559
- componentName: 'Accordion',
667
+ component: Accordion,
560
668
  identifier: `Section content (\`<div class="${this.sectionContentClass}">\`)`
561
669
  });
562
670
  }
@@ -587,17 +695,13 @@ class Accordion extends GOVUKFrontendComponent {
587
695
  $section.classList.remove(this.sectionExpandedClass);
588
696
  $showHideIcon.classList.add(this.downChevronIconClass);
589
697
  }
590
- const areAllSectionsOpen = this.checkIfAllSectionsOpen();
591
- this.updateShowAllButton(areAllSectionsOpen);
698
+ this.updateShowAllButton(this.areAllSectionsOpen());
592
699
  }
593
700
  isExpanded($section) {
594
701
  return $section.classList.contains(this.sectionExpandedClass);
595
702
  }
596
- checkIfAllSectionsOpen() {
597
- const sectionsCount = this.$sections.length;
598
- const expandedSectionCount = this.$module.querySelectorAll(`.${this.sectionExpandedClass}`).length;
599
- const areAllSectionsOpen = sectionsCount === expandedSectionCount;
600
- return areAllSectionsOpen;
703
+ areAllSectionsOpen() {
704
+ return Array.from(this.$sections).every($section => this.isExpanded($section));
601
705
  }
602
706
  updateShowAllButton(expanded) {
603
707
  if (!this.$showAllButton || !this.$showAllText || !this.$showAllIcon) {
@@ -607,78 +711,53 @@ class Accordion extends GOVUKFrontendComponent {
607
711
  this.$showAllText.textContent = expanded ? this.i18n.t('hideAllSections') : this.i18n.t('showAllSections');
608
712
  this.$showAllIcon.classList.toggle(this.downChevronIconClass, !expanded);
609
713
  }
610
- storeState($section) {
611
- if (this.browserSupportsSessionStorage && this.config.rememberExpanded) {
612
- const $button = $section.querySelector(`.${this.sectionButtonClass}`);
613
- if ($button) {
614
- const contentId = $button.getAttribute('aria-controls');
615
- const contentState = $button.getAttribute('aria-expanded');
616
- if (contentId && contentState) {
617
- window.sessionStorage.setItem(contentId, contentState);
618
- }
619
- }
714
+
715
+ /**
716
+ * Get the identifier for a section
717
+ *
718
+ * We need a unique way of identifying each content in the Accordion.
719
+ * Since an `#id` should be unique and an `id` is required for `aria-`
720
+ * attributes `id` can be safely used.
721
+ *
722
+ * @param {Element} $section - Section element
723
+ * @returns {string | undefined | null} Identifier for section
724
+ */
725
+ getIdentifier($section) {
726
+ const $button = $section.querySelector(`.${this.sectionButtonClass}`);
727
+ return $button == null ? void 0 : $button.getAttribute('aria-controls');
728
+ }
729
+ storeState($section, isExpanded) {
730
+ if (!this.config.rememberExpanded) {
731
+ return;
732
+ }
733
+ const id = this.getIdentifier($section);
734
+ if (id) {
735
+ try {
736
+ window.sessionStorage.setItem(id, isExpanded.toString());
737
+ } catch (exception) {}
620
738
  }
621
739
  }
622
740
  setInitialState($section) {
623
- if (this.browserSupportsSessionStorage && this.config.rememberExpanded) {
624
- const $button = $section.querySelector(`.${this.sectionButtonClass}`);
625
- if ($button) {
626
- const contentId = $button.getAttribute('aria-controls');
627
- const contentState = contentId ? window.sessionStorage.getItem(contentId) : null;
628
- if (contentState !== null) {
629
- this.setExpanded(contentState === 'true', $section);
741
+ if (!this.config.rememberExpanded) {
742
+ return;
743
+ }
744
+ const id = this.getIdentifier($section);
745
+ if (id) {
746
+ try {
747
+ const state = window.sessionStorage.getItem(id);
748
+ if (state !== null) {
749
+ this.setExpanded(state === 'true', $section);
630
750
  }
631
- }
751
+ } catch (exception) {}
632
752
  }
633
753
  }
634
754
  getButtonPunctuationEl() {
635
755
  const $punctuationEl = document.createElement('span');
636
756
  $punctuationEl.classList.add('govuk-visually-hidden', this.sectionHeadingDividerClass);
637
- $punctuationEl.innerHTML = ', ';
757
+ $punctuationEl.textContent = ', ';
638
758
  return $punctuationEl;
639
759
  }
640
760
  }
641
- Accordion.moduleName = 'govuk-accordion';
642
- Accordion.defaults = Object.freeze({
643
- i18n: {
644
- hideAllSections: 'Hide all sections',
645
- hideSection: 'Hide',
646
- hideSectionAriaLabel: 'Hide this section',
647
- showAllSections: 'Show all sections',
648
- showSection: 'Show',
649
- showSectionAriaLabel: 'Show this section'
650
- },
651
- rememberExpanded: true
652
- });
653
- Accordion.schema = Object.freeze({
654
- properties: {
655
- i18n: {
656
- type: 'object'
657
- },
658
- rememberExpanded: {
659
- type: 'boolean'
660
- }
661
- }
662
- });
663
- const helper = {
664
- /**
665
- * Check for `window.sessionStorage`, and that it actually works.
666
- *
667
- * @returns {boolean} True if session storage is available
668
- */
669
- checkForSessionStorage: function () {
670
- const testString = 'this is the test string';
671
- let result;
672
- try {
673
- window.sessionStorage.setItem(testString, testString);
674
- result = window.sessionStorage.getItem(testString) === testString.toString();
675
- window.sessionStorage.removeItem(testString);
676
- return result;
677
- } catch (exception) {
678
- return false;
679
- }
680
- }
681
- };
682
761
 
683
762
  /**
684
763
  * Accordion config
@@ -714,8 +793,30 @@ const helper = {
714
793
  */
715
794
 
716
795
  /**
717
- * @typedef {import('../../common/index.mjs').Schema} Schema
796
+ * @import { Schema } from '../../common/configuration.mjs'
718
797
  */
798
+ Accordion.moduleName = 'govuk-accordion';
799
+ Accordion.defaults = Object.freeze({
800
+ i18n: {
801
+ hideAllSections: 'Hide all sections',
802
+ hideSection: 'Hide',
803
+ hideSectionAriaLabel: 'Hide this section',
804
+ showAllSections: 'Show all sections',
805
+ showSection: 'Show',
806
+ showSectionAriaLabel: 'Show this section'
807
+ },
808
+ rememberExpanded: true
809
+ });
810
+ Accordion.schema = Object.freeze({
811
+ properties: {
812
+ i18n: {
813
+ type: 'object'
814
+ },
815
+ rememberExpanded: {
816
+ type: 'boolean'
817
+ }
818
+ }
819
+ });
719
820
 
720
821
  export { Accordion };
721
822
  //# sourceMappingURL=accordion.bundle.mjs.map