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,7 +1,5 @@
1
- import { mergeConfigs } from '../../common/index.mjs';
2
- import { normaliseDataset } from '../../common/normalise-dataset.mjs';
1
+ import { ConfigurableComponent } from '../../common/configuration.mjs';
3
2
  import { ElementError } from '../../errors/index.mjs';
4
- import { GOVUKFrontendComponent } from '../../govuk-frontend-component.mjs';
5
3
  import { I18n } from '../../i18n.mjs';
6
4
 
7
5
  /**
@@ -17,16 +15,15 @@ import { I18n } from '../../i18n.mjs';
17
15
  * attribute, which also provides accessibility.
18
16
  *
19
17
  * @preserve
18
+ * @augments ConfigurableComponent<AccordionConfig>
20
19
  */
21
- class Accordion extends GOVUKFrontendComponent {
20
+ class Accordion extends ConfigurableComponent {
22
21
  /**
23
- * @param {Element | null} $module - HTML element to use for accordion
22
+ * @param {Element | null} $root - HTML element to use for accordion
24
23
  * @param {AccordionConfig} [config] - Accordion config
25
24
  */
26
- constructor($module, config = {}) {
27
- super();
28
- this.$module = void 0;
29
- this.config = void 0;
25
+ constructor($root, config = {}) {
26
+ super($root, config);
30
27
  this.i18n = void 0;
31
28
  this.controlsClass = 'govuk-accordion__controls';
32
29
  this.showAllClass = 'govuk-accordion__show-all';
@@ -48,33 +45,21 @@ class Accordion extends GOVUKFrontendComponent {
48
45
  this.sectionSummaryFocusClass = 'govuk-accordion__section-summary-focus';
49
46
  this.sectionContentClass = 'govuk-accordion__section-content';
50
47
  this.$sections = void 0;
51
- this.browserSupportsSessionStorage = false;
52
48
  this.$showAllButton = null;
53
49
  this.$showAllIcon = null;
54
50
  this.$showAllText = null;
55
- if (!($module instanceof HTMLElement)) {
56
- throw new ElementError({
57
- componentName: 'Accordion',
58
- element: $module,
59
- identifier: 'Root element (`$module`)'
60
- });
61
- }
62
- this.$module = $module;
63
- this.config = mergeConfigs(Accordion.defaults, config, normaliseDataset(Accordion, $module.dataset));
64
51
  this.i18n = new I18n(this.config.i18n);
65
- const $sections = this.$module.querySelectorAll(`.${this.sectionClass}`);
52
+ const $sections = this.$root.querySelectorAll(`.${this.sectionClass}`);
66
53
  if (!$sections.length) {
67
54
  throw new ElementError({
68
- componentName: 'Accordion',
55
+ component: Accordion,
69
56
  identifier: `Sections (\`<div class="${this.sectionClass}">\`)`
70
57
  });
71
58
  }
72
59
  this.$sections = $sections;
73
- this.browserSupportsSessionStorage = helper.checkForSessionStorage();
74
60
  this.initControls();
75
61
  this.initSectionHeaders();
76
- const areAllSectionsOpen = this.checkIfAllSectionsOpen();
77
- this.updateShowAllButton(areAllSectionsOpen);
62
+ this.updateShowAllButton(this.areAllSectionsOpen());
78
63
  }
79
64
  initControls() {
80
65
  this.$showAllButton = document.createElement('button');
@@ -87,7 +72,7 @@ class Accordion extends GOVUKFrontendComponent {
87
72
  const $accordionControls = document.createElement('div');
88
73
  $accordionControls.setAttribute('class', this.controlsClass);
89
74
  $accordionControls.appendChild(this.$showAllButton);
90
- this.$module.insertBefore($accordionControls, this.$module.firstChild);
75
+ this.$root.insertBefore($accordionControls, this.$root.firstChild);
91
76
  this.$showAllText = document.createElement('span');
92
77
  this.$showAllText.classList.add(this.showAllTextClass);
93
78
  this.$showAllButton.appendChild(this.$showAllText);
@@ -101,7 +86,7 @@ class Accordion extends GOVUKFrontendComponent {
101
86
  const $header = $section.querySelector(`.${this.sectionHeaderClass}`);
102
87
  if (!$header) {
103
88
  throw new ElementError({
104
- componentName: 'Accordion',
89
+ component: Accordion,
105
90
  identifier: `Section headers (\`<div class="${this.sectionHeaderClass}">\`)`
106
91
  });
107
92
  }
@@ -117,22 +102,22 @@ class Accordion extends GOVUKFrontendComponent {
117
102
  const $summary = $header.querySelector(`.${this.sectionSummaryClass}`);
118
103
  if (!$heading) {
119
104
  throw new ElementError({
120
- componentName: 'Accordion',
105
+ component: Accordion,
121
106
  identifier: `Section heading (\`.${this.sectionHeadingClass}\`)`
122
107
  });
123
108
  }
124
109
  if (!$span) {
125
110
  throw new ElementError({
126
- componentName: 'Accordion',
111
+ component: Accordion,
127
112
  identifier: `Section button placeholder (\`<span class="${this.sectionButtonClass}">\`)`
128
113
  });
129
114
  }
130
115
  const $button = document.createElement('button');
131
116
  $button.setAttribute('type', 'button');
132
- $button.setAttribute('aria-controls', `${this.$module.id}-content-${index + 1}`);
117
+ $button.setAttribute('aria-controls', `${this.$root.id}-content-${index + 1}`);
133
118
  for (const attr of Array.from($span.attributes)) {
134
- if (attr.nodeName !== 'id') {
135
- $button.setAttribute(attr.nodeName, `${attr.nodeValue}`);
119
+ if (attr.name !== 'id') {
120
+ $button.setAttribute(attr.name, attr.value);
136
121
  }
137
122
  }
138
123
  const $headingText = document.createElement('span');
@@ -141,7 +126,7 @@ class Accordion extends GOVUKFrontendComponent {
141
126
  const $headingTextFocus = document.createElement('span');
142
127
  $headingTextFocus.classList.add(this.sectionHeadingTextFocusClass);
143
128
  $headingText.appendChild($headingTextFocus);
144
- $headingTextFocus.innerHTML = $span.innerHTML;
129
+ Array.from($span.childNodes).forEach($child => $headingTextFocus.appendChild($child));
145
130
  const $showHideToggle = document.createElement('span');
146
131
  $showHideToggle.classList.add(this.sectionShowHideToggleClass);
147
132
  $showHideToggle.setAttribute('data-nosnippet', '');
@@ -156,16 +141,16 @@ class Accordion extends GOVUKFrontendComponent {
156
141
  $showHideToggleFocus.appendChild($showHideText);
157
142
  $button.appendChild($headingText);
158
143
  $button.appendChild(this.getButtonPunctuationEl());
159
- if ($summary != null && $summary.parentNode) {
144
+ if ($summary) {
160
145
  const $summarySpan = document.createElement('span');
161
146
  const $summarySpanFocus = document.createElement('span');
162
147
  $summarySpanFocus.classList.add(this.sectionSummaryFocusClass);
163
148
  $summarySpan.appendChild($summarySpanFocus);
164
149
  for (const attr of Array.from($summary.attributes)) {
165
- $summarySpan.setAttribute(attr.nodeName, `${attr.nodeValue}`);
150
+ $summarySpan.setAttribute(attr.name, attr.value);
166
151
  }
167
- $summarySpanFocus.innerHTML = $summary.innerHTML;
168
- $summary.parentNode.replaceChild($summarySpan, $summary);
152
+ Array.from($summary.childNodes).forEach($child => $summarySpanFocus.appendChild($child));
153
+ $summary.remove();
169
154
  $button.appendChild($summarySpan);
170
155
  $button.appendChild(this.getButtonPunctuationEl());
171
156
  }
@@ -184,15 +169,15 @@ class Accordion extends GOVUKFrontendComponent {
184
169
  }
185
170
  }
186
171
  onSectionToggle($section) {
187
- const expanded = this.isExpanded($section);
188
- this.setExpanded(!expanded, $section);
189
- this.storeState($section);
172
+ const nowExpanded = !this.isExpanded($section);
173
+ this.setExpanded(nowExpanded, $section);
174
+ this.storeState($section, nowExpanded);
190
175
  }
191
176
  onShowOrHideAllToggle() {
192
- const nowExpanded = !this.checkIfAllSectionsOpen();
177
+ const nowExpanded = !this.areAllSectionsOpen();
193
178
  this.$sections.forEach($section => {
194
179
  this.setExpanded(nowExpanded, $section);
195
- this.storeState($section);
180
+ this.storeState($section, nowExpanded);
196
181
  });
197
182
  this.updateShowAllButton(nowExpanded);
198
183
  }
@@ -203,7 +188,7 @@ class Accordion extends GOVUKFrontendComponent {
203
188
  const $content = $section.querySelector(`.${this.sectionContentClass}`);
204
189
  if (!$content) {
205
190
  throw new ElementError({
206
- componentName: 'Accordion',
191
+ component: Accordion,
207
192
  identifier: `Section content (\`<div class="${this.sectionContentClass}">\`)`
208
193
  });
209
194
  }
@@ -234,17 +219,13 @@ class Accordion extends GOVUKFrontendComponent {
234
219
  $section.classList.remove(this.sectionExpandedClass);
235
220
  $showHideIcon.classList.add(this.downChevronIconClass);
236
221
  }
237
- const areAllSectionsOpen = this.checkIfAllSectionsOpen();
238
- this.updateShowAllButton(areAllSectionsOpen);
222
+ this.updateShowAllButton(this.areAllSectionsOpen());
239
223
  }
240
224
  isExpanded($section) {
241
225
  return $section.classList.contains(this.sectionExpandedClass);
242
226
  }
243
- checkIfAllSectionsOpen() {
244
- const sectionsCount = this.$sections.length;
245
- const expandedSectionCount = this.$module.querySelectorAll(`.${this.sectionExpandedClass}`).length;
246
- const areAllSectionsOpen = sectionsCount === expandedSectionCount;
247
- return areAllSectionsOpen;
227
+ areAllSectionsOpen() {
228
+ return Array.from(this.$sections).every($section => this.isExpanded($section));
248
229
  }
249
230
  updateShowAllButton(expanded) {
250
231
  if (!this.$showAllButton || !this.$showAllText || !this.$showAllIcon) {
@@ -254,78 +235,53 @@ class Accordion extends GOVUKFrontendComponent {
254
235
  this.$showAllText.textContent = expanded ? this.i18n.t('hideAllSections') : this.i18n.t('showAllSections');
255
236
  this.$showAllIcon.classList.toggle(this.downChevronIconClass, !expanded);
256
237
  }
257
- storeState($section) {
258
- if (this.browserSupportsSessionStorage && this.config.rememberExpanded) {
259
- const $button = $section.querySelector(`.${this.sectionButtonClass}`);
260
- if ($button) {
261
- const contentId = $button.getAttribute('aria-controls');
262
- const contentState = $button.getAttribute('aria-expanded');
263
- if (contentId && contentState) {
264
- window.sessionStorage.setItem(contentId, contentState);
265
- }
266
- }
238
+
239
+ /**
240
+ * Get the identifier for a section
241
+ *
242
+ * We need a unique way of identifying each content in the Accordion.
243
+ * Since an `#id` should be unique and an `id` is required for `aria-`
244
+ * attributes `id` can be safely used.
245
+ *
246
+ * @param {Element} $section - Section element
247
+ * @returns {string | undefined | null} Identifier for section
248
+ */
249
+ getIdentifier($section) {
250
+ const $button = $section.querySelector(`.${this.sectionButtonClass}`);
251
+ return $button == null ? void 0 : $button.getAttribute('aria-controls');
252
+ }
253
+ storeState($section, isExpanded) {
254
+ if (!this.config.rememberExpanded) {
255
+ return;
256
+ }
257
+ const id = this.getIdentifier($section);
258
+ if (id) {
259
+ try {
260
+ window.sessionStorage.setItem(id, isExpanded.toString());
261
+ } catch (exception) {}
267
262
  }
268
263
  }
269
264
  setInitialState($section) {
270
- if (this.browserSupportsSessionStorage && this.config.rememberExpanded) {
271
- const $button = $section.querySelector(`.${this.sectionButtonClass}`);
272
- if ($button) {
273
- const contentId = $button.getAttribute('aria-controls');
274
- const contentState = contentId ? window.sessionStorage.getItem(contentId) : null;
275
- if (contentState !== null) {
276
- this.setExpanded(contentState === 'true', $section);
265
+ if (!this.config.rememberExpanded) {
266
+ return;
267
+ }
268
+ const id = this.getIdentifier($section);
269
+ if (id) {
270
+ try {
271
+ const state = window.sessionStorage.getItem(id);
272
+ if (state !== null) {
273
+ this.setExpanded(state === 'true', $section);
277
274
  }
278
- }
275
+ } catch (exception) {}
279
276
  }
280
277
  }
281
278
  getButtonPunctuationEl() {
282
279
  const $punctuationEl = document.createElement('span');
283
280
  $punctuationEl.classList.add('govuk-visually-hidden', this.sectionHeadingDividerClass);
284
- $punctuationEl.innerHTML = ', ';
281
+ $punctuationEl.textContent = ', ';
285
282
  return $punctuationEl;
286
283
  }
287
284
  }
288
- Accordion.moduleName = 'govuk-accordion';
289
- Accordion.defaults = Object.freeze({
290
- i18n: {
291
- hideAllSections: 'Hide all sections',
292
- hideSection: 'Hide',
293
- hideSectionAriaLabel: 'Hide this section',
294
- showAllSections: 'Show all sections',
295
- showSection: 'Show',
296
- showSectionAriaLabel: 'Show this section'
297
- },
298
- rememberExpanded: true
299
- });
300
- Accordion.schema = Object.freeze({
301
- properties: {
302
- i18n: {
303
- type: 'object'
304
- },
305
- rememberExpanded: {
306
- type: 'boolean'
307
- }
308
- }
309
- });
310
- const helper = {
311
- /**
312
- * Check for `window.sessionStorage`, and that it actually works.
313
- *
314
- * @returns {boolean} True if session storage is available
315
- */
316
- checkForSessionStorage: function () {
317
- const testString = 'this is the test string';
318
- let result;
319
- try {
320
- window.sessionStorage.setItem(testString, testString);
321
- result = window.sessionStorage.getItem(testString) === testString.toString();
322
- window.sessionStorage.removeItem(testString);
323
- return result;
324
- } catch (exception) {
325
- return false;
326
- }
327
- }
328
- };
329
285
 
330
286
  /**
331
287
  * Accordion config
@@ -361,8 +317,30 @@ const helper = {
361
317
  */
362
318
 
363
319
  /**
364
- * @typedef {import('../../common/index.mjs').Schema} Schema
320
+ * @import { Schema } from '../../common/configuration.mjs'
365
321
  */
322
+ Accordion.moduleName = 'govuk-accordion';
323
+ Accordion.defaults = Object.freeze({
324
+ i18n: {
325
+ hideAllSections: 'Hide all sections',
326
+ hideSection: 'Hide',
327
+ hideSectionAriaLabel: 'Hide this section',
328
+ showAllSections: 'Show all sections',
329
+ showSection: 'Show',
330
+ showSectionAriaLabel: 'Show this section'
331
+ },
332
+ rememberExpanded: true
333
+ });
334
+ Accordion.schema = Object.freeze({
335
+ properties: {
336
+ i18n: {
337
+ type: 'object'
338
+ },
339
+ rememberExpanded: {
340
+ type: 'boolean'
341
+ }
342
+ }
343
+ });
366
344
 
367
345
  export { Accordion };
368
346
  //# sourceMappingURL=accordion.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"accordion.mjs","sources":["../../../../src/govuk/components/accordion/accordion.mjs"],"sourcesContent":["import { mergeConfigs } from '../../common/index.mjs'\nimport { normaliseDataset } from '../../common/normalise-dataset.mjs'\nimport { ElementError } from '../../errors/index.mjs'\nimport { GOVUKFrontendComponent } from '../../govuk-frontend-component.mjs'\nimport { I18n } from '../../i18n.mjs'\n\n/**\n * Accordion component\n *\n * This allows a collection of sections to be collapsed by default, showing only\n * their headers. Sections can be expanded or collapsed individually by clicking\n * their headers. A \"Show all sections\" button is also added to the top of the\n * accordion, which switches to \"Hide all sections\" when all the sections are\n * expanded.\n *\n * The state of each section is saved to the DOM via the `aria-expanded`\n * attribute, which also provides accessibility.\n *\n * @preserve\n */\nexport class Accordion extends GOVUKFrontendComponent {\n /** @private */\n $module\n\n /**\n * @private\n * @type {AccordionConfig}\n */\n config\n\n /** @private */\n i18n\n\n /** @private */\n controlsClass = 'govuk-accordion__controls'\n\n /** @private */\n showAllClass = 'govuk-accordion__show-all'\n\n /** @private */\n showAllTextClass = 'govuk-accordion__show-all-text'\n\n /** @private */\n sectionClass = 'govuk-accordion__section'\n\n /** @private */\n sectionExpandedClass = 'govuk-accordion__section--expanded'\n\n /** @private */\n sectionButtonClass = 'govuk-accordion__section-button'\n\n /** @private */\n sectionHeaderClass = 'govuk-accordion__section-header'\n\n /** @private */\n sectionHeadingClass = 'govuk-accordion__section-heading'\n\n /** @private */\n sectionHeadingDividerClass = 'govuk-accordion__section-heading-divider'\n\n /** @private */\n sectionHeadingTextClass = 'govuk-accordion__section-heading-text'\n\n /** @private */\n sectionHeadingTextFocusClass = 'govuk-accordion__section-heading-text-focus'\n\n /** @private */\n sectionShowHideToggleClass = 'govuk-accordion__section-toggle'\n\n /** @private */\n sectionShowHideToggleFocusClass = 'govuk-accordion__section-toggle-focus'\n\n /** @private */\n sectionShowHideTextClass = 'govuk-accordion__section-toggle-text'\n\n /** @private */\n upChevronIconClass = 'govuk-accordion-nav__chevron'\n\n /** @private */\n downChevronIconClass = 'govuk-accordion-nav__chevron--down'\n\n /** @private */\n sectionSummaryClass = 'govuk-accordion__section-summary'\n\n /** @private */\n sectionSummaryFocusClass = 'govuk-accordion__section-summary-focus'\n\n /** @private */\n sectionContentClass = 'govuk-accordion__section-content'\n\n /** @private */\n $sections\n\n /** @private */\n browserSupportsSessionStorage = false\n\n /**\n * @private\n * @type {HTMLButtonElement | null}\n */\n $showAllButton = null\n\n /**\n * @private\n * @type {HTMLElement | null}\n */\n $showAllIcon = null\n\n /**\n * @private\n * @type {HTMLElement | null}\n */\n $showAllText = null\n\n /**\n * @param {Element | null} $module - HTML element to use for accordion\n * @param {AccordionConfig} [config] - Accordion config\n */\n constructor($module, config = {}) {\n super()\n\n if (!($module instanceof HTMLElement)) {\n throw new ElementError({\n componentName: 'Accordion',\n element: $module,\n identifier: 'Root element (`$module`)'\n })\n }\n\n this.$module = $module\n\n this.config = mergeConfigs(\n Accordion.defaults,\n config,\n normaliseDataset(Accordion, $module.dataset)\n )\n\n this.i18n = new I18n(this.config.i18n)\n\n const $sections = this.$module.querySelectorAll(`.${this.sectionClass}`)\n if (!$sections.length) {\n throw new ElementError({\n componentName: 'Accordion',\n identifier: `Sections (\\`<div class=\"${this.sectionClass}\">\\`)`\n })\n }\n\n this.$sections = $sections\n this.browserSupportsSessionStorage = helper.checkForSessionStorage()\n\n this.initControls()\n this.initSectionHeaders()\n\n // See if \"Show all sections\" button text should be updated\n const areAllSectionsOpen = this.checkIfAllSectionsOpen()\n this.updateShowAllButton(areAllSectionsOpen)\n }\n\n /**\n * Initialise controls and set attributes\n *\n * @private\n */\n initControls() {\n // Create \"Show all\" button and set attributes\n this.$showAllButton = document.createElement('button')\n this.$showAllButton.setAttribute('type', 'button')\n this.$showAllButton.setAttribute('class', this.showAllClass)\n this.$showAllButton.setAttribute('aria-expanded', 'false')\n\n // Create icon, add to element\n this.$showAllIcon = document.createElement('span')\n this.$showAllIcon.classList.add(this.upChevronIconClass)\n this.$showAllButton.appendChild(this.$showAllIcon)\n\n // Create control wrapper and add controls to it\n const $accordionControls = document.createElement('div')\n $accordionControls.setAttribute('class', this.controlsClass)\n $accordionControls.appendChild(this.$showAllButton)\n this.$module.insertBefore($accordionControls, this.$module.firstChild)\n\n // Build additional wrapper for Show all toggle text and place after icon\n this.$showAllText = document.createElement('span')\n this.$showAllText.classList.add(this.showAllTextClass)\n this.$showAllButton.appendChild(this.$showAllText)\n\n // Handle click events on the show/hide all button\n this.$showAllButton.addEventListener('click', () =>\n this.onShowOrHideAllToggle()\n )\n\n // Handle 'beforematch' events, if the user agent supports them\n if ('onbeforematch' in document) {\n document.addEventListener('beforematch', (event) =>\n this.onBeforeMatch(event)\n )\n }\n }\n\n /**\n * Initialise section headers\n *\n * @private\n */\n initSectionHeaders() {\n this.$sections.forEach(($section, i) => {\n const $header = $section.querySelector(`.${this.sectionHeaderClass}`)\n if (!$header) {\n throw new ElementError({\n componentName: 'Accordion',\n identifier: `Section headers (\\`<div class=\"${this.sectionHeaderClass}\">\\`)`\n })\n }\n\n // Set header attributes\n this.constructHeaderMarkup($header, i)\n this.setExpanded(this.isExpanded($section), $section)\n\n // Handle events\n $header.addEventListener('click', () => this.onSectionToggle($section))\n\n // See if there is any state stored in sessionStorage and set the sections\n // to open or closed.\n this.setInitialState($section)\n })\n }\n\n /**\n * Construct section header\n *\n * @private\n * @param {Element} $header - Section header\n * @param {number} index - Section index\n */\n constructHeaderMarkup($header, index) {\n const $span = $header.querySelector(`.${this.sectionButtonClass}`)\n const $heading = $header.querySelector(`.${this.sectionHeadingClass}`)\n const $summary = $header.querySelector(`.${this.sectionSummaryClass}`)\n\n if (!$heading) {\n throw new ElementError({\n componentName: 'Accordion',\n identifier: `Section heading (\\`.${this.sectionHeadingClass}\\`)`\n })\n }\n\n if (!$span) {\n throw new ElementError({\n componentName: 'Accordion',\n identifier: `Section button placeholder (\\`<span class=\"${this.sectionButtonClass}\">\\`)`\n })\n }\n\n // Create a button element that will replace the\n // '.govuk-accordion__section-button' span\n const $button = document.createElement('button')\n $button.setAttribute('type', 'button')\n $button.setAttribute(\n 'aria-controls',\n `${this.$module.id}-content-${index + 1}`\n )\n\n // Copy all attributes from $span to $button (except `id`, which gets added\n // to the `$headingText` element)\n for (const attr of Array.from($span.attributes)) {\n if (attr.nodeName !== 'id') {\n $button.setAttribute(attr.nodeName, `${attr.nodeValue}`)\n }\n }\n\n // Create container for heading text so it can be styled\n const $headingText = document.createElement('span')\n $headingText.classList.add(this.sectionHeadingTextClass)\n // Copy the span ID to the heading text to allow it to be referenced by\n // `aria-labelledby` on the hidden content area without \"Show this section\"\n $headingText.id = $span.id\n\n // Create an inner heading text container to limit the width of the focus\n // state\n const $headingTextFocus = document.createElement('span')\n $headingTextFocus.classList.add(this.sectionHeadingTextFocusClass)\n $headingText.appendChild($headingTextFocus)\n // span could contain HTML elements\n // (see https://www.w3.org/TR/2011/WD-html5-20110525/content-models.html#phrasing-content)\n $headingTextFocus.innerHTML = $span.innerHTML\n\n // Create container for show / hide icons and text.\n const $showHideToggle = document.createElement('span')\n $showHideToggle.classList.add(this.sectionShowHideToggleClass)\n // Tell Google not to index the 'show' text as part of the heading. Must be\n // set on the element before it's added to the DOM.\n // See https://developers.google.com/search/docs/advanced/robots/robots_meta_tag#data-nosnippet-attr\n $showHideToggle.setAttribute('data-nosnippet', '')\n // Create an inner container to limit the width of the focus state\n const $showHideToggleFocus = document.createElement('span')\n $showHideToggleFocus.classList.add(this.sectionShowHideToggleFocusClass)\n $showHideToggle.appendChild($showHideToggleFocus)\n // Create wrapper for the show / hide text. Append text after the show/hide icon\n const $showHideText = document.createElement('span')\n const $showHideIcon = document.createElement('span')\n $showHideIcon.classList.add(this.upChevronIconClass)\n $showHideToggleFocus.appendChild($showHideIcon)\n $showHideText.classList.add(this.sectionShowHideTextClass)\n $showHideToggleFocus.appendChild($showHideText)\n\n // Append elements to the button:\n // 1. Heading text\n // 2. Punctuation\n // 3. (Optional: Summary line followed by punctuation)\n // 4. Show / hide toggle\n $button.appendChild($headingText)\n $button.appendChild(this.getButtonPunctuationEl())\n\n // If summary content exists add to DOM in correct order\n if ($summary?.parentNode) {\n // Create a new `span` element and copy the summary line content from the\n // original `div` to the new `span`. This is because the summary line text\n // is now inside a button element, which can only contain phrasing\n // content.\n const $summarySpan = document.createElement('span')\n // Create an inner summary container to limit the width of the summary\n // focus state\n const $summarySpanFocus = document.createElement('span')\n $summarySpanFocus.classList.add(this.sectionSummaryFocusClass)\n $summarySpan.appendChild($summarySpanFocus)\n\n // Get original attributes, and pass them to the replacement\n for (const attr of Array.from($summary.attributes)) {\n $summarySpan.setAttribute(attr.nodeName, `${attr.nodeValue}`)\n }\n\n // Copy original contents of summary to the new summary span\n $summarySpanFocus.innerHTML = $summary.innerHTML\n\n // Replace the original summary `div` with the new summary `span`\n $summary.parentNode.replaceChild($summarySpan, $summary)\n\n $button.appendChild($summarySpan)\n $button.appendChild(this.getButtonPunctuationEl())\n }\n\n $button.appendChild($showHideToggle)\n\n $heading.removeChild($span)\n $heading.appendChild($button)\n }\n\n /**\n * When a section is opened by the user agent via the 'beforematch' event\n *\n * @private\n * @param {Event} event - Generic event\n */\n onBeforeMatch(event) {\n const $fragment = event.target\n\n // Handle elements with `.closest()` support only\n if (!($fragment instanceof Element)) {\n return\n }\n\n // Handle when fragment is inside section\n const $section = $fragment.closest(`.${this.sectionClass}`)\n if ($section) {\n this.setExpanded(true, $section)\n }\n }\n\n /**\n * When section toggled, set and store state\n *\n * @private\n * @param {Element} $section - Section element\n */\n onSectionToggle($section) {\n const expanded = this.isExpanded($section)\n this.setExpanded(!expanded, $section)\n\n // Store the state in sessionStorage when a change is triggered\n this.storeState($section)\n }\n\n /**\n * When Open/Close All toggled, set and store state\n *\n * @private\n */\n onShowOrHideAllToggle() {\n const nowExpanded = !this.checkIfAllSectionsOpen()\n\n this.$sections.forEach(($section) => {\n this.setExpanded(nowExpanded, $section)\n this.storeState($section)\n })\n\n this.updateShowAllButton(nowExpanded)\n }\n\n /**\n * Set section attributes when opened/closed\n *\n * @private\n * @param {boolean} expanded - Section expanded\n * @param {Element} $section - Section element\n */\n setExpanded(expanded, $section) {\n const $showHideIcon = $section.querySelector(`.${this.upChevronIconClass}`)\n const $showHideText = $section.querySelector(\n `.${this.sectionShowHideTextClass}`\n )\n const $button = $section.querySelector(`.${this.sectionButtonClass}`)\n const $content = $section.querySelector(`.${this.sectionContentClass}`)\n\n if (!$content) {\n throw new ElementError({\n componentName: 'Accordion',\n identifier: `Section content (\\`<div class=\"${this.sectionContentClass}\">\\`)`\n })\n }\n\n if (!$showHideIcon || !$showHideText || !$button) {\n // Return early for elements we create\n return\n }\n\n const newButtonText = expanded\n ? this.i18n.t('hideSection')\n : this.i18n.t('showSection')\n\n $showHideText.textContent = newButtonText\n $button.setAttribute('aria-expanded', `${expanded}`)\n\n // Update aria-label combining\n const ariaLabelParts = []\n\n const $headingText = $section.querySelector(\n `.${this.sectionHeadingTextClass}`\n )\n if ($headingText) {\n ariaLabelParts.push(`${$headingText.textContent}`.trim())\n }\n\n const $summary = $section.querySelector(`.${this.sectionSummaryClass}`)\n if ($summary) {\n ariaLabelParts.push(`${$summary.textContent}`.trim())\n }\n\n const ariaLabelMessage = expanded\n ? this.i18n.t('hideSectionAriaLabel')\n : this.i18n.t('showSectionAriaLabel')\n ariaLabelParts.push(ariaLabelMessage)\n\n /*\n * Join with a comma to add pause for assistive technology.\n * Example: [heading]Section A ,[pause] Show this section.\n * https://accessibility.blog.gov.uk/2017/12/18/what-working-on-gov-uk-navigation-taught-us-about-accessibility/\n */\n $button.setAttribute('aria-label', ariaLabelParts.join(' , '))\n\n // Swap icon, change class\n if (expanded) {\n $content.removeAttribute('hidden')\n $section.classList.add(this.sectionExpandedClass)\n $showHideIcon.classList.remove(this.downChevronIconClass)\n } else {\n $content.setAttribute('hidden', 'until-found')\n $section.classList.remove(this.sectionExpandedClass)\n $showHideIcon.classList.add(this.downChevronIconClass)\n }\n\n // See if \"Show all sections\" button text should be updated\n const areAllSectionsOpen = this.checkIfAllSectionsOpen()\n this.updateShowAllButton(areAllSectionsOpen)\n }\n\n /**\n * Get state of section\n *\n * @private\n * @param {Element} $section - Section element\n * @returns {boolean} True if expanded\n */\n isExpanded($section) {\n return $section.classList.contains(this.sectionExpandedClass)\n }\n\n /**\n * Check if all sections are open\n *\n * @private\n * @returns {boolean} True if all sections are open\n */\n checkIfAllSectionsOpen() {\n const sectionsCount = this.$sections.length\n const expandedSectionCount = this.$module.querySelectorAll(\n `.${this.sectionExpandedClass}`\n ).length\n const areAllSectionsOpen = sectionsCount === expandedSectionCount\n\n return areAllSectionsOpen\n }\n\n /**\n * Update \"Show all sections\" button\n *\n * @private\n * @param {boolean} expanded - Section expanded\n */\n updateShowAllButton(expanded) {\n if (!this.$showAllButton || !this.$showAllText || !this.$showAllIcon) {\n return\n }\n\n this.$showAllButton.setAttribute('aria-expanded', expanded.toString())\n this.$showAllText.textContent = expanded\n ? this.i18n.t('hideAllSections')\n : this.i18n.t('showAllSections')\n this.$showAllIcon.classList.toggle(this.downChevronIconClass, !expanded)\n }\n\n /**\n * Set the state of the accordions in sessionStorage\n *\n * @private\n * @param {Element} $section - Section element\n */\n storeState($section) {\n if (this.browserSupportsSessionStorage && this.config.rememberExpanded) {\n // We need a unique way of identifying each content in the Accordion.\n // Since an `#id` should be unique and an `id` is required for `aria-`\n // attributes `id` can be safely used.\n const $button = $section.querySelector(`.${this.sectionButtonClass}`)\n\n if ($button) {\n const contentId = $button.getAttribute('aria-controls')\n const contentState = $button.getAttribute('aria-expanded')\n\n // Only set the state when both `contentId` and `contentState` are taken\n // from the DOM.\n if (contentId && contentState) {\n window.sessionStorage.setItem(contentId, contentState)\n }\n }\n }\n }\n\n /**\n * Read the state of the accordions from sessionStorage\n *\n * @private\n * @param {Element} $section - Section element\n */\n setInitialState($section) {\n if (this.browserSupportsSessionStorage && this.config.rememberExpanded) {\n const $button = $section.querySelector(`.${this.sectionButtonClass}`)\n\n if ($button) {\n const contentId = $button.getAttribute('aria-controls')\n const contentState = contentId\n ? window.sessionStorage.getItem(contentId)\n : null\n\n if (contentState !== null) {\n this.setExpanded(contentState === 'true', $section)\n }\n }\n }\n }\n\n /**\n * Create an element to improve semantics of the section button with\n * punctuation\n *\n * Adding punctuation to the button can also improve its general semantics by\n * dividing its contents into thematic chunks. See\n * https://github.com/alphagov/govuk-frontend/issues/2327#issuecomment-922957442\n *\n * @private\n * @returns {Element} DOM element\n */\n getButtonPunctuationEl() {\n const $punctuationEl = document.createElement('span')\n $punctuationEl.classList.add(\n 'govuk-visually-hidden',\n this.sectionHeadingDividerClass\n )\n $punctuationEl.innerHTML = ', '\n return $punctuationEl\n }\n\n /**\n * Name for the component used when initialising using data-module attributes.\n */\n static moduleName = 'govuk-accordion'\n\n /**\n * Accordion default config\n *\n * @see {@link AccordionConfig}\n * @constant\n * @type {AccordionConfig}\n */\n static defaults = Object.freeze({\n i18n: {\n hideAllSections: 'Hide all sections',\n hideSection: 'Hide',\n hideSectionAriaLabel: 'Hide this section',\n showAllSections: 'Show all sections',\n showSection: 'Show',\n showSectionAriaLabel: 'Show this section'\n },\n rememberExpanded: true\n })\n\n /**\n * Accordion config schema\n *\n * @constant\n * @satisfies {Schema}\n */\n static schema = Object.freeze({\n properties: {\n i18n: { type: 'object' },\n rememberExpanded: { type: 'boolean' }\n }\n })\n}\n\nconst helper = {\n /**\n * Check for `window.sessionStorage`, and that it actually works.\n *\n * @returns {boolean} True if session storage is available\n */\n checkForSessionStorage: function () {\n const testString = 'this is the test string'\n let result\n try {\n window.sessionStorage.setItem(testString, testString)\n result =\n window.sessionStorage.getItem(testString) === testString.toString()\n window.sessionStorage.removeItem(testString)\n return result\n } catch (exception) {\n return false\n }\n }\n}\n\n/**\n * Accordion config\n *\n * @see {@link Accordion.defaults}\n * @typedef {object} AccordionConfig\n * @property {AccordionTranslations} [i18n=Accordion.defaults.i18n] - Accordion translations\n * @property {boolean} [rememberExpanded] - Whether the expanded and collapsed\n * state of each section is remembered and restored when navigating.\n */\n\n/**\n * Accordion translations\n *\n * @see {@link Accordion.defaults.i18n}\n * @typedef {object} AccordionTranslations\n *\n * Messages used by the component for the labels of its buttons. This includes\n * the visible text shown on screen, and text to help assistive technology users\n * for the buttons toggling each section.\n * @property {string} [hideAllSections] - The text content for the 'Hide all\n * sections' button, used when at least one section is expanded.\n * @property {string} [hideSection] - The text content for the 'Hide'\n * button, used when a section is expanded.\n * @property {string} [hideSectionAriaLabel] - The text content appended to the\n * 'Hide' button's accessible name when a section is expanded.\n * @property {string} [showAllSections] - The text content for the 'Show all\n * sections' button, used when all sections are collapsed.\n * @property {string} [showSection] - The text content for the 'Show'\n * button, used when a section is collapsed.\n * @property {string} [showSectionAriaLabel] - The text content appended to the\n * 'Show' button's accessible name when a section is expanded.\n */\n\n/**\n * @typedef {import('../../common/index.mjs').Schema} Schema\n */\n"],"names":["Accordion","GOVUKFrontendComponent","constructor","$module","config","i18n","controlsClass","showAllClass","showAllTextClass","sectionClass","sectionExpandedClass","sectionButtonClass","sectionHeaderClass","sectionHeadingClass","sectionHeadingDividerClass","sectionHeadingTextClass","sectionHeadingTextFocusClass","sectionShowHideToggleClass","sectionShowHideToggleFocusClass","sectionShowHideTextClass","upChevronIconClass","downChevronIconClass","sectionSummaryClass","sectionSummaryFocusClass","sectionContentClass","$sections","browserSupportsSessionStorage","$showAllButton","$showAllIcon","$showAllText","HTMLElement","ElementError","componentName","element","identifier","mergeConfigs","defaults","normaliseDataset","dataset","I18n","querySelectorAll","length","helper","checkForSessionStorage","initControls","initSectionHeaders","areAllSectionsOpen","checkIfAllSectionsOpen","updateShowAllButton","document","createElement","setAttribute","classList","add","appendChild","$accordionControls","insertBefore","firstChild","addEventListener","onShowOrHideAllToggle","event","onBeforeMatch","forEach","$section","i","$header","querySelector","constructHeaderMarkup","setExpanded","isExpanded","onSectionToggle","setInitialState","index","$span","$heading","$summary","$button","id","attr","Array","from","attributes","nodeName","nodeValue","$headingText","$headingTextFocus","innerHTML","$showHideToggle","$showHideToggleFocus","$showHideText","$showHideIcon","getButtonPunctuationEl","parentNode","$summarySpan","$summarySpanFocus","replaceChild","removeChild","$fragment","target","Element","closest","expanded","storeState","nowExpanded","$content","newButtonText","t","textContent","ariaLabelParts","push","trim","ariaLabelMessage","join","removeAttribute","remove","contains","sectionsCount","expandedSectionCount","toString","toggle","rememberExpanded","contentId","getAttribute","contentState","window","sessionStorage","setItem","getItem","$punctuationEl","moduleName","Object","freeze","hideAllSections","hideSection","hideSectionAriaLabel","showAllSections","showSection","showSectionAriaLabel","schema","properties","type","testString","result","removeItem","exception"],"mappings":";;;;;;AAMA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMA,SAAS,SAASC,sBAAsB,CAAC;AA8FpD;AACF;AACA;AACA;AACEC,EAAAA,WAAWA,CAACC,OAAO,EAAEC,MAAM,GAAG,EAAE,EAAE;AAChC,IAAA,KAAK,EAAE,CAAA;AAAA,IAAA,IAAA,CAjGTD,OAAO,GAAA,KAAA,CAAA,CAAA;AAAA,IAAA,IAAA,CAMPC,MAAM,GAAA,KAAA,CAAA,CAAA;AAAA,IAAA,IAAA,CAGNC,IAAI,GAAA,KAAA,CAAA,CAAA;IAAA,IAGJC,CAAAA,aAAa,GAAG,2BAA2B,CAAA;IAAA,IAG3CC,CAAAA,YAAY,GAAG,2BAA2B,CAAA;IAAA,IAG1CC,CAAAA,gBAAgB,GAAG,gCAAgC,CAAA;IAAA,IAGnDC,CAAAA,YAAY,GAAG,0BAA0B,CAAA;IAAA,IAGzCC,CAAAA,oBAAoB,GAAG,oCAAoC,CAAA;IAAA,IAG3DC,CAAAA,kBAAkB,GAAG,iCAAiC,CAAA;IAAA,IAGtDC,CAAAA,kBAAkB,GAAG,iCAAiC,CAAA;IAAA,IAGtDC,CAAAA,mBAAmB,GAAG,kCAAkC,CAAA;IAAA,IAGxDC,CAAA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ACF,CAAC,CAAA;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;;;"}
1
+ {"version":3,"file":"accordion.mjs","sources":["../../../../src/govuk/components/accordion/accordion.mjs"],"sourcesContent":["import { ConfigurableComponent } from '../../common/configuration.mjs'\nimport { ElementError } from '../../errors/index.mjs'\nimport { I18n } from '../../i18n.mjs'\n\n/**\n * Accordion component\n *\n * This allows a collection of sections to be collapsed by default, showing only\n * their headers. Sections can be expanded or collapsed individually by clicking\n * their headers. A \"Show all sections\" button is also added to the top of the\n * accordion, which switches to \"Hide all sections\" when all the sections are\n * expanded.\n *\n * The state of each section is saved to the DOM via the `aria-expanded`\n * attribute, which also provides accessibility.\n *\n * @preserve\n * @augments ConfigurableComponent<AccordionConfig>\n */\nexport class Accordion extends ConfigurableComponent {\n /** @private */\n i18n\n\n /** @private */\n controlsClass = 'govuk-accordion__controls'\n\n /** @private */\n showAllClass = 'govuk-accordion__show-all'\n\n /** @private */\n showAllTextClass = 'govuk-accordion__show-all-text'\n\n /** @private */\n sectionClass = 'govuk-accordion__section'\n\n /** @private */\n sectionExpandedClass = 'govuk-accordion__section--expanded'\n\n /** @private */\n sectionButtonClass = 'govuk-accordion__section-button'\n\n /** @private */\n sectionHeaderClass = 'govuk-accordion__section-header'\n\n /** @private */\n sectionHeadingClass = 'govuk-accordion__section-heading'\n\n /** @private */\n sectionHeadingDividerClass = 'govuk-accordion__section-heading-divider'\n\n /** @private */\n sectionHeadingTextClass = 'govuk-accordion__section-heading-text'\n\n /** @private */\n sectionHeadingTextFocusClass = 'govuk-accordion__section-heading-text-focus'\n\n /** @private */\n sectionShowHideToggleClass = 'govuk-accordion__section-toggle'\n\n /** @private */\n sectionShowHideToggleFocusClass = 'govuk-accordion__section-toggle-focus'\n\n /** @private */\n sectionShowHideTextClass = 'govuk-accordion__section-toggle-text'\n\n /** @private */\n upChevronIconClass = 'govuk-accordion-nav__chevron'\n\n /** @private */\n downChevronIconClass = 'govuk-accordion-nav__chevron--down'\n\n /** @private */\n sectionSummaryClass = 'govuk-accordion__section-summary'\n\n /** @private */\n sectionSummaryFocusClass = 'govuk-accordion__section-summary-focus'\n\n /** @private */\n sectionContentClass = 'govuk-accordion__section-content'\n\n /** @private */\n $sections\n\n /**\n * @private\n * @type {HTMLButtonElement | null}\n */\n $showAllButton = null\n\n /**\n * @private\n * @type {HTMLElement | null}\n */\n $showAllIcon = null\n\n /**\n * @private\n * @type {HTMLElement | null}\n */\n $showAllText = null\n\n /**\n * @param {Element | null} $root - HTML element to use for accordion\n * @param {AccordionConfig} [config] - Accordion config\n */\n constructor($root, config = {}) {\n super($root, config)\n\n this.i18n = new I18n(this.config.i18n)\n\n const $sections = this.$root.querySelectorAll(`.${this.sectionClass}`)\n if (!$sections.length) {\n throw new ElementError({\n component: Accordion,\n identifier: `Sections (\\`<div class=\"${this.sectionClass}\">\\`)`\n })\n }\n\n this.$sections = $sections\n\n this.initControls()\n this.initSectionHeaders()\n\n this.updateShowAllButton(this.areAllSectionsOpen())\n }\n\n /**\n * Initialise controls and set attributes\n *\n * @private\n */\n initControls() {\n // Create \"Show all\" button and set attributes\n this.$showAllButton = document.createElement('button')\n this.$showAllButton.setAttribute('type', 'button')\n this.$showAllButton.setAttribute('class', this.showAllClass)\n this.$showAllButton.setAttribute('aria-expanded', 'false')\n\n // Create icon, add to element\n this.$showAllIcon = document.createElement('span')\n this.$showAllIcon.classList.add(this.upChevronIconClass)\n this.$showAllButton.appendChild(this.$showAllIcon)\n\n // Create control wrapper and add controls to it\n const $accordionControls = document.createElement('div')\n $accordionControls.setAttribute('class', this.controlsClass)\n $accordionControls.appendChild(this.$showAllButton)\n this.$root.insertBefore($accordionControls, this.$root.firstChild)\n\n // Build additional wrapper for Show all toggle text and place after icon\n this.$showAllText = document.createElement('span')\n this.$showAllText.classList.add(this.showAllTextClass)\n this.$showAllButton.appendChild(this.$showAllText)\n\n // Handle click events on the show/hide all button\n this.$showAllButton.addEventListener('click', () =>\n this.onShowOrHideAllToggle()\n )\n\n // Handle 'beforematch' events, if the user agent supports them\n if ('onbeforematch' in document) {\n document.addEventListener('beforematch', (event) =>\n this.onBeforeMatch(event)\n )\n }\n }\n\n /**\n * Initialise section headers\n *\n * @private\n */\n initSectionHeaders() {\n this.$sections.forEach(($section, i) => {\n const $header = $section.querySelector(`.${this.sectionHeaderClass}`)\n if (!$header) {\n throw new ElementError({\n component: Accordion,\n identifier: `Section headers (\\`<div class=\"${this.sectionHeaderClass}\">\\`)`\n })\n }\n\n // Set header attributes\n this.constructHeaderMarkup($header, i)\n this.setExpanded(this.isExpanded($section), $section)\n\n // Handle events\n $header.addEventListener('click', () => this.onSectionToggle($section))\n\n // See if there is any state stored in sessionStorage and set the sections\n // to open or closed.\n this.setInitialState($section)\n })\n }\n\n /**\n * Construct section header\n *\n * @private\n * @param {Element} $header - Section header\n * @param {number} index - Section index\n */\n constructHeaderMarkup($header, index) {\n const $span = $header.querySelector(`.${this.sectionButtonClass}`)\n const $heading = $header.querySelector(`.${this.sectionHeadingClass}`)\n const $summary = $header.querySelector(`.${this.sectionSummaryClass}`)\n\n if (!$heading) {\n throw new ElementError({\n component: Accordion,\n identifier: `Section heading (\\`.${this.sectionHeadingClass}\\`)`\n })\n }\n\n if (!$span) {\n throw new ElementError({\n component: Accordion,\n identifier: `Section button placeholder (\\`<span class=\"${this.sectionButtonClass}\">\\`)`\n })\n }\n\n // Create a button element that will replace the\n // '.govuk-accordion__section-button' span\n const $button = document.createElement('button')\n $button.setAttribute('type', 'button')\n $button.setAttribute(\n 'aria-controls',\n `${this.$root.id}-content-${index + 1}`\n )\n\n // Copy all attributes from $span to $button (except `id`, which gets added\n // to the `$headingText` element)\n for (const attr of Array.from($span.attributes)) {\n if (attr.name !== 'id') {\n $button.setAttribute(attr.name, attr.value)\n }\n }\n\n // Create container for heading text so it can be styled\n const $headingText = document.createElement('span')\n $headingText.classList.add(this.sectionHeadingTextClass)\n // Copy the span ID to the heading text to allow it to be referenced by\n // `aria-labelledby` on the hidden content area without \"Show this section\"\n $headingText.id = $span.id\n\n // Create an inner heading text container to limit the width of the focus\n // state\n const $headingTextFocus = document.createElement('span')\n $headingTextFocus.classList.add(this.sectionHeadingTextFocusClass)\n $headingText.appendChild($headingTextFocus)\n // span could contain HTML elements\n // (see https://www.w3.org/TR/2011/WD-html5-20110525/content-models.html#phrasing-content)\n Array.from($span.childNodes).forEach(($child) =>\n $headingTextFocus.appendChild($child)\n )\n\n // Create container for show / hide icons and text.\n const $showHideToggle = document.createElement('span')\n $showHideToggle.classList.add(this.sectionShowHideToggleClass)\n // Tell Google not to index the 'show' text as part of the heading. Must be\n // set on the element before it's added to the DOM.\n // See https://developers.google.com/search/docs/advanced/robots/robots_meta_tag#data-nosnippet-attr\n $showHideToggle.setAttribute('data-nosnippet', '')\n // Create an inner container to limit the width of the focus state\n const $showHideToggleFocus = document.createElement('span')\n $showHideToggleFocus.classList.add(this.sectionShowHideToggleFocusClass)\n $showHideToggle.appendChild($showHideToggleFocus)\n // Create wrapper for the show / hide text. Append text after the show/hide icon\n const $showHideText = document.createElement('span')\n const $showHideIcon = document.createElement('span')\n $showHideIcon.classList.add(this.upChevronIconClass)\n $showHideToggleFocus.appendChild($showHideIcon)\n $showHideText.classList.add(this.sectionShowHideTextClass)\n $showHideToggleFocus.appendChild($showHideText)\n\n // Append elements to the button:\n // 1. Heading text\n // 2. Punctuation\n // 3. (Optional: Summary line followed by punctuation)\n // 4. Show / hide toggle\n $button.appendChild($headingText)\n $button.appendChild(this.getButtonPunctuationEl())\n\n // If summary content exists add to DOM in correct order\n if ($summary) {\n // Create a new `span` element and copy the summary line content from the\n // original `div` to the new `span`. This is because the summary line text\n // is now inside a button element, which can only contain phrasing\n // content.\n const $summarySpan = document.createElement('span')\n // Create an inner summary container to limit the width of the summary\n // focus state\n const $summarySpanFocus = document.createElement('span')\n $summarySpanFocus.classList.add(this.sectionSummaryFocusClass)\n $summarySpan.appendChild($summarySpanFocus)\n\n // Get original attributes, and pass them to the replacement\n for (const attr of Array.from($summary.attributes)) {\n $summarySpan.setAttribute(attr.name, attr.value)\n }\n\n // Copy original contents of summary to the new summary span\n Array.from($summary.childNodes).forEach(($child) =>\n $summarySpanFocus.appendChild($child)\n )\n\n // Replace the original summary `div` with the new summary `span`\n $summary.remove()\n\n $button.appendChild($summarySpan)\n $button.appendChild(this.getButtonPunctuationEl())\n }\n\n $button.appendChild($showHideToggle)\n\n $heading.removeChild($span)\n $heading.appendChild($button)\n }\n\n /**\n * When a section is opened by the user agent via the 'beforematch' event\n *\n * @private\n * @param {Event} event - Generic event\n */\n onBeforeMatch(event) {\n const $fragment = event.target\n\n // Handle elements with `.closest()` support only\n if (!($fragment instanceof Element)) {\n return\n }\n\n // Handle when fragment is inside section\n const $section = $fragment.closest(`.${this.sectionClass}`)\n if ($section) {\n this.setExpanded(true, $section)\n }\n }\n\n /**\n * When section toggled, set and store state\n *\n * @private\n * @param {Element} $section - Section element\n */\n onSectionToggle($section) {\n const nowExpanded = !this.isExpanded($section)\n this.setExpanded(nowExpanded, $section)\n\n // Store the state in sessionStorage when a change is triggered\n this.storeState($section, nowExpanded)\n }\n\n /**\n * When Open/Close All toggled, set and store state\n *\n * @private\n */\n onShowOrHideAllToggle() {\n const nowExpanded = !this.areAllSectionsOpen()\n\n this.$sections.forEach(($section) => {\n this.setExpanded(nowExpanded, $section)\n this.storeState($section, nowExpanded)\n })\n\n this.updateShowAllButton(nowExpanded)\n }\n\n /**\n * Set section attributes when opened/closed\n *\n * @private\n * @param {boolean} expanded - Section expanded\n * @param {Element} $section - Section element\n */\n setExpanded(expanded, $section) {\n const $showHideIcon = $section.querySelector(`.${this.upChevronIconClass}`)\n const $showHideText = $section.querySelector(\n `.${this.sectionShowHideTextClass}`\n )\n const $button = $section.querySelector(`.${this.sectionButtonClass}`)\n const $content = $section.querySelector(`.${this.sectionContentClass}`)\n\n if (!$content) {\n throw new ElementError({\n component: Accordion,\n identifier: `Section content (\\`<div class=\"${this.sectionContentClass}\">\\`)`\n })\n }\n\n if (!$showHideIcon || !$showHideText || !$button) {\n // Return early for elements we create\n return\n }\n\n const newButtonText = expanded\n ? this.i18n.t('hideSection')\n : this.i18n.t('showSection')\n\n $showHideText.textContent = newButtonText\n $button.setAttribute('aria-expanded', `${expanded}`)\n\n // Update aria-label combining\n const ariaLabelParts = []\n\n const $headingText = $section.querySelector(\n `.${this.sectionHeadingTextClass}`\n )\n if ($headingText) {\n ariaLabelParts.push(`${$headingText.textContent}`.trim())\n }\n\n const $summary = $section.querySelector(`.${this.sectionSummaryClass}`)\n if ($summary) {\n ariaLabelParts.push(`${$summary.textContent}`.trim())\n }\n\n const ariaLabelMessage = expanded\n ? this.i18n.t('hideSectionAriaLabel')\n : this.i18n.t('showSectionAriaLabel')\n ariaLabelParts.push(ariaLabelMessage)\n\n /*\n * Join with a comma to add pause for assistive technology.\n * Example: [heading]Section A ,[pause] Show this section.\n * https://accessibility.blog.gov.uk/2017/12/18/what-working-on-gov-uk-navigation-taught-us-about-accessibility/\n */\n $button.setAttribute('aria-label', ariaLabelParts.join(' , '))\n\n // Swap icon, change class\n if (expanded) {\n $content.removeAttribute('hidden')\n $section.classList.add(this.sectionExpandedClass)\n $showHideIcon.classList.remove(this.downChevronIconClass)\n } else {\n $content.setAttribute('hidden', 'until-found')\n $section.classList.remove(this.sectionExpandedClass)\n $showHideIcon.classList.add(this.downChevronIconClass)\n }\n\n // See if \"Show all sections\" button text should be updated\n this.updateShowAllButton(this.areAllSectionsOpen())\n }\n\n /**\n * Get state of section\n *\n * @private\n * @param {Element} $section - Section element\n * @returns {boolean} True if expanded\n */\n isExpanded($section) {\n return $section.classList.contains(this.sectionExpandedClass)\n }\n\n /**\n * Check if all sections are open\n *\n * @private\n * @returns {boolean} True if all sections are open\n */\n areAllSectionsOpen() {\n return Array.from(this.$sections).every(($section) =>\n this.isExpanded($section)\n )\n }\n\n /**\n * Update \"Show all sections\" button\n *\n * @private\n * @param {boolean} expanded - Section expanded\n */\n updateShowAllButton(expanded) {\n if (!this.$showAllButton || !this.$showAllText || !this.$showAllIcon) {\n return\n }\n\n this.$showAllButton.setAttribute('aria-expanded', expanded.toString())\n this.$showAllText.textContent = expanded\n ? this.i18n.t('hideAllSections')\n : this.i18n.t('showAllSections')\n this.$showAllIcon.classList.toggle(this.downChevronIconClass, !expanded)\n }\n\n /**\n * Get the identifier for a section\n *\n * We need a unique way of identifying each content in the Accordion.\n * Since an `#id` should be unique and an `id` is required for `aria-`\n * attributes `id` can be safely used.\n *\n * @param {Element} $section - Section element\n * @returns {string | undefined | null} Identifier for section\n */\n getIdentifier($section) {\n const $button = $section.querySelector(`.${this.sectionButtonClass}`)\n\n return $button?.getAttribute('aria-controls')\n }\n\n /**\n * Set the state of the accordions in sessionStorage\n *\n * @private\n * @param {Element} $section - Section element\n * @param {boolean} isExpanded - Whether the section is expanded\n */\n storeState($section, isExpanded) {\n if (!this.config.rememberExpanded) {\n return\n }\n\n const id = this.getIdentifier($section)\n\n if (id) {\n try {\n window.sessionStorage.setItem(id, isExpanded.toString())\n } catch (exception) {}\n }\n }\n\n /**\n * Read the state of the accordions from sessionStorage\n *\n * @private\n * @param {Element} $section - Section element\n */\n setInitialState($section) {\n if (!this.config.rememberExpanded) {\n return\n }\n\n const id = this.getIdentifier($section)\n\n if (id) {\n try {\n const state = window.sessionStorage.getItem(id)\n\n if (state !== null) {\n this.setExpanded(state === 'true', $section)\n }\n } catch (exception) {}\n }\n }\n\n /**\n * Create an element to improve semantics of the section button with\n * punctuation\n *\n * Adding punctuation to the button can also improve its general semantics by\n * dividing its contents into thematic chunks. See\n * https://github.com/alphagov/govuk-frontend/issues/2327#issuecomment-922957442\n *\n * @private\n * @returns {Element} DOM element\n */\n getButtonPunctuationEl() {\n const $punctuationEl = document.createElement('span')\n $punctuationEl.classList.add(\n 'govuk-visually-hidden',\n this.sectionHeadingDividerClass\n )\n $punctuationEl.textContent = ', '\n return $punctuationEl\n }\n\n /**\n * Name for the component used when initialising using data-module attributes.\n */\n static moduleName = 'govuk-accordion'\n\n /**\n * Accordion default config\n *\n * @see {@link AccordionConfig}\n * @constant\n * @type {AccordionConfig}\n */\n static defaults = Object.freeze({\n i18n: {\n hideAllSections: 'Hide all sections',\n hideSection: 'Hide',\n hideSectionAriaLabel: 'Hide this section',\n showAllSections: 'Show all sections',\n showSection: 'Show',\n showSectionAriaLabel: 'Show this section'\n },\n rememberExpanded: true\n })\n\n /**\n * Accordion config schema\n *\n * @constant\n * @satisfies {Schema<AccordionConfig>}\n */\n static schema = Object.freeze({\n properties: {\n i18n: { type: 'object' },\n rememberExpanded: { type: 'boolean' }\n }\n })\n}\n\n/**\n * Accordion config\n *\n * @see {@link Accordion.defaults}\n * @typedef {object} AccordionConfig\n * @property {AccordionTranslations} [i18n=Accordion.defaults.i18n] - Accordion translations\n * @property {boolean} [rememberExpanded] - Whether the expanded and collapsed\n * state of each section is remembered and restored when navigating.\n */\n\n/**\n * Accordion translations\n *\n * @see {@link Accordion.defaults.i18n}\n * @typedef {object} AccordionTranslations\n *\n * Messages used by the component for the labels of its buttons. This includes\n * the visible text shown on screen, and text to help assistive technology users\n * for the buttons toggling each section.\n * @property {string} [hideAllSections] - The text content for the 'Hide all\n * sections' button, used when at least one section is expanded.\n * @property {string} [hideSection] - The text content for the 'Hide'\n * button, used when a section is expanded.\n * @property {string} [hideSectionAriaLabel] - The text content appended to the\n * 'Hide' button's accessible name when a section is expanded.\n * @property {string} [showAllSections] - The text content for the 'Show all\n * sections' button, used when all sections are collapsed.\n * @property {string} [showSection] - The text content for the 'Show'\n * button, used when a section is collapsed.\n * @property {string} [showSectionAriaLabel] - The text content appended to the\n * 'Show' button's accessible name when a section is expanded.\n */\n\n/**\n * @import { Schema } from '../../common/configuration.mjs'\n */\n"],"names":["Accordion","ConfigurableComponent","constructor","$root","config","i18n","controlsClass","showAllClass","showAllTextClass","sectionClass","sectionExpandedClass","sectionButtonClass","sectionHeaderClass","sectionHeadingClass","sectionHeadingDividerClass","sectionHeadingTextClass","sectionHeadingTextFocusClass","sectionShowHideToggleClass","sectionShowHideToggleFocusClass","sectionShowHideTextClass","upChevronIconClass","downChevronIconClass","sectionSummaryClass","sectionSummaryFocusClass","sectionContentClass","$sections","$showAllButton","$showAllIcon","$showAllText","I18n","querySelectorAll","length","ElementError","component","identifier","initControls","initSectionHeaders","updateShowAllButton","areAllSectionsOpen","document","createElement","setAttribute","classList","add","appendChild","$accordionControls","insertBefore","firstChild","addEventListener","onShowOrHideAllToggle","event","onBeforeMatch","forEach","$section","i","$header","querySelector","constructHeaderMarkup","setExpanded","isExpanded","onSectionToggle","setInitialState","index","$span","$heading","$summary","$button","id","attr","Array","from","attributes","name","value","$headingText","$headingTextFocus","childNodes","$child","$showHideToggle","$showHideToggleFocus","$showHideText","$showHideIcon","getButtonPunctuationEl","$summarySpan","$summarySpanFocus","remove","removeChild","$fragment","target","Element","closest","nowExpanded","storeState","expanded","$content","newButtonText","t","textContent","ariaLabelParts","push","trim","ariaLabelMessage","join","removeAttribute","contains","every","toString","toggle","getIdentifier","getAttribute","rememberExpanded","window","sessionStorage","setItem","exception","state","getItem","$punctuationEl","moduleName","defaults","Object","freeze","hideAllSections","hideSection","hideSectionAriaLabel","showAllSections","showSection","showSectionAriaLabel","schema","properties","type"],"mappings":";;;;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMA,SAAS,SAASC,qBAAqB,CAAC;AAkFnD;AACF;AACA;AACA;AACEC,EAAAA,WAAWA,CAACC,KAAK,EAAEC,MAAM,GAAG,EAAE,EAAE;AAC9B,IAAA,KAAK,CAACD,KAAK,EAAEC,MAAM,CAAC;AAAA,IAAA,IAAA,CArFtBC,IAAI,GAAA,MAAA;IAAA,IAGJC,CAAAA,aAAa,GAAG,2BAA2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