govuk_publishing_components 35.3.3 → 35.3.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (272) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/govuk_publishing_components/analytics-ga4/ga4-core.js +4 -0
  3. data/app/assets/javascripts/govuk_publishing_components/analytics-ga4/init-ga4.js +1 -1
  4. data/app/assets/stylesheets/component_guide/application.scss +37 -1
  5. data/app/assets/stylesheets/govuk_publishing_components/components/_metadata.scss +10 -6
  6. data/app/assets/stylesheets/govuk_publishing_components/components/_organisation-logo.scss +2 -2
  7. data/app/assets/stylesheets/govuk_publishing_components/components/helpers/_brand-colours.scss +0 -24
  8. data/app/views/govuk_publishing_components/component_guide/example.html.erb +1 -1
  9. data/app/views/govuk_publishing_components/component_guide/preview.html.erb +1 -1
  10. data/app/views/govuk_publishing_components/component_guide/show.html.erb +1 -1
  11. data/app/views/govuk_publishing_components/components/_layout_super_navigation_header.html.erb +2 -2
  12. data/app/views/govuk_publishing_components/components/_metadata.html.erb +1 -1
  13. data/app/views/govuk_publishing_components/components/_related_navigation.html.erb +3 -1
  14. data/app/views/govuk_publishing_components/components/_share_links.html.erb +6 -2
  15. data/app/views/govuk_publishing_components/components/_step_by_step_nav_related.html.erb +1 -1
  16. data/app/views/govuk_publishing_components/components/docs/metadata.yml +1 -3
  17. data/app/views/govuk_publishing_components/components/docs/organisation_logo.yml +5 -5
  18. data/app/views/govuk_publishing_components/components/docs/step_by_step_nav_related.yml +1 -0
  19. data/app/views/govuk_publishing_components/components/related_navigation/_section.html.erb +1 -1
  20. data/app/views/layouts/govuk_publishing_components/application.html.erb +1 -0
  21. data/config/locales/en.yml +2 -2
  22. data/lib/govuk_publishing_components/app_helpers/asset_helper.rb +4 -0
  23. data/lib/govuk_publishing_components/presenters/breadcrumbs_helper.rb +1 -1
  24. data/lib/govuk_publishing_components/version.rb +1 -1
  25. data/node_modules/axe-core/axe.d.ts +77 -6
  26. data/node_modules/axe-core/axe.js +955 -600
  27. data/node_modules/axe-core/axe.min.js +2 -2
  28. data/node_modules/axe-core/locales/_template.json +6 -6
  29. data/node_modules/axe-core/locales/ja.json +91 -11
  30. data/node_modules/axe-core/package.json +5 -5
  31. data/node_modules/axe-core/sri-history.json +4 -0
  32. data/node_modules/govuk-frontend/README.md +4 -5
  33. data/node_modules/govuk-frontend/govuk/all-ie8.scss +8 -0
  34. data/node_modules/govuk-frontend/govuk/all.js +738 -258
  35. data/node_modules/govuk-frontend/govuk/all.js.map +1 -1
  36. data/node_modules/govuk-frontend/govuk/common/closest-attribute-value.js +11 -7
  37. data/node_modules/govuk-frontend/govuk/common/closest-attribute-value.js.map +1 -1
  38. data/node_modules/govuk-frontend/govuk/common/govuk-frontend-version.js +17 -0
  39. data/node_modules/govuk-frontend/govuk/common/govuk-frontend-version.js.map +1 -0
  40. data/node_modules/govuk-frontend/govuk/common/index.js +16 -4
  41. data/node_modules/govuk-frontend/govuk/common/index.js.map +1 -1
  42. data/node_modules/govuk-frontend/govuk/common/normalise-dataset.js +20 -10
  43. data/node_modules/govuk-frontend/govuk/common/normalise-dataset.js.map +1 -1
  44. data/node_modules/govuk-frontend/govuk/common.js +16 -4
  45. data/node_modules/govuk-frontend/govuk/common.js.map +1 -1
  46. data/node_modules/govuk-frontend/govuk/components/accordion/_index.scss +3 -3
  47. data/node_modules/govuk-frontend/govuk/components/accordion/accordion.js +234 -86
  48. data/node_modules/govuk-frontend/govuk/components/accordion/accordion.js.map +1 -1
  49. data/node_modules/govuk-frontend/govuk/components/accordion/fixtures.json +32 -13
  50. data/node_modules/govuk-frontend/govuk/components/accordion/macro-options.json +8 -2
  51. data/node_modules/govuk-frontend/govuk/components/accordion/template.njk +1 -0
  52. data/node_modules/govuk-frontend/govuk/components/back-link/_index.scss +1 -1
  53. data/node_modules/govuk-frontend/govuk/components/back-link/fixtures.json +1 -1
  54. data/node_modules/govuk-frontend/govuk/components/back-link/macro-options.json +1 -1
  55. data/node_modules/govuk-frontend/govuk/components/breadcrumbs/_index.scss +1 -1
  56. data/node_modules/govuk-frontend/govuk/components/breadcrumbs/fixtures.json +12 -12
  57. data/node_modules/govuk-frontend/govuk/components/breadcrumbs/macro-options.json +1 -1
  58. data/node_modules/govuk-frontend/govuk/components/button/_index.scss +8 -6
  59. data/node_modules/govuk-frontend/govuk/components/button/button.js +54 -19
  60. data/node_modules/govuk-frontend/govuk/components/button/button.js.map +1 -1
  61. data/node_modules/govuk-frontend/govuk/components/button/fixtures.json +11 -1
  62. data/node_modules/govuk-frontend/govuk/components/button/macro-options.json +7 -1
  63. data/node_modules/govuk-frontend/govuk/components/button/template.njk +1 -1
  64. data/node_modules/govuk-frontend/govuk/components/character-count/character-count.js +170 -76
  65. data/node_modules/govuk-frontend/govuk/components/character-count/character-count.js.map +1 -1
  66. data/node_modules/govuk-frontend/govuk/components/character-count/fixtures.json +24 -24
  67. data/node_modules/govuk-frontend/govuk/components/character-count/macro-options.json +3 -3
  68. data/node_modules/govuk-frontend/govuk/components/checkboxes/_index.scss +6 -6
  69. data/node_modules/govuk-frontend/govuk/components/checkboxes/checkboxes.js +75 -24
  70. data/node_modules/govuk-frontend/govuk/components/checkboxes/checkboxes.js.map +1 -1
  71. data/node_modules/govuk-frontend/govuk/components/checkboxes/fixtures.json +47 -47
  72. data/node_modules/govuk-frontend/govuk/components/checkboxes/macro-options.json +1 -1
  73. data/node_modules/govuk-frontend/govuk/components/checkboxes/template.njk +3 -3
  74. data/node_modules/govuk-frontend/govuk/components/cookie-banner/fixtures.json +24 -24
  75. data/node_modules/govuk-frontend/govuk/components/cookie-banner/macro-options.json +1 -1
  76. data/node_modules/govuk-frontend/govuk/components/date-input/fixtures.json +26 -26
  77. data/node_modules/govuk-frontend/govuk/components/date-input/macro-options.json +1 -1
  78. data/node_modules/govuk-frontend/govuk/components/date-input/template.njk +1 -1
  79. data/node_modules/govuk-frontend/govuk/components/details/details.js +39 -13
  80. data/node_modules/govuk-frontend/govuk/components/details/details.js.map +1 -1
  81. data/node_modules/govuk-frontend/govuk/components/details/fixtures.json +1 -1
  82. data/node_modules/govuk-frontend/govuk/components/details/macro-options.json +1 -1
  83. data/node_modules/govuk-frontend/govuk/components/error-message/fixtures.json +10 -10
  84. data/node_modules/govuk-frontend/govuk/components/error-message/macro-options.json +1 -1
  85. data/node_modules/govuk-frontend/govuk/components/error-summary/error-summary.js +67 -27
  86. data/node_modules/govuk-frontend/govuk/components/error-summary/error-summary.js.map +1 -1
  87. data/node_modules/govuk-frontend/govuk/components/error-summary/fixtures.json +19 -19
  88. data/node_modules/govuk-frontend/govuk/components/error-summary/macro-options.json +1 -1
  89. data/node_modules/govuk-frontend/govuk/components/fieldset/fixtures.json +19 -19
  90. data/node_modules/govuk-frontend/govuk/components/fieldset/macro-options.json +1 -1
  91. data/node_modules/govuk-frontend/govuk/components/file-upload/_index.scss +6 -1
  92. data/node_modules/govuk-frontend/govuk/components/file-upload/fixtures.json +14 -14
  93. data/node_modules/govuk-frontend/govuk/components/file-upload/macro-options.json +7 -1
  94. data/node_modules/govuk-frontend/govuk/components/file-upload/template.njk +2 -1
  95. data/node_modules/govuk-frontend/govuk/components/footer/_index.scss +0 -7
  96. data/node_modules/govuk-frontend/govuk/components/footer/fixtures.json +24 -24
  97. data/node_modules/govuk-frontend/govuk/components/footer/macro-options.json +1 -1
  98. data/node_modules/govuk-frontend/govuk/components/header/fixtures.json +22 -22
  99. data/node_modules/govuk-frontend/govuk/components/header/header.js +46 -14
  100. data/node_modules/govuk-frontend/govuk/components/header/header.js.map +1 -1
  101. data/node_modules/govuk-frontend/govuk/components/header/macro-options.json +1 -1
  102. data/node_modules/govuk-frontend/govuk/components/header/template.njk +1 -1
  103. data/node_modules/govuk-frontend/govuk/components/hint/fixtures.json +1 -1
  104. data/node_modules/govuk-frontend/govuk/components/hint/macro-options.json +1 -1
  105. data/node_modules/govuk-frontend/govuk/components/input/_index.scss +15 -3
  106. data/node_modules/govuk-frontend/govuk/components/input/fixtures.json +54 -41
  107. data/node_modules/govuk-frontend/govuk/components/input/macro-options.json +7 -1
  108. data/node_modules/govuk-frontend/govuk/components/input/template.njk +2 -1
  109. data/node_modules/govuk-frontend/govuk/components/inset-text/fixtures.json +1 -1
  110. data/node_modules/govuk-frontend/govuk/components/inset-text/macro-options.json +1 -1
  111. data/node_modules/govuk-frontend/govuk/components/label/fixtures.json +6 -6
  112. data/node_modules/govuk-frontend/govuk/components/label/macro-options.json +1 -1
  113. data/node_modules/govuk-frontend/govuk/components/notification-banner/fixtures.json +1 -1
  114. data/node_modules/govuk-frontend/govuk/components/notification-banner/macro-options.json +1 -1
  115. data/node_modules/govuk-frontend/govuk/components/notification-banner/notification-banner.js +49 -22
  116. data/node_modules/govuk-frontend/govuk/components/notification-banner/notification-banner.js.map +1 -1
  117. data/node_modules/govuk-frontend/govuk/components/pagination/fixtures.json +16 -16
  118. data/node_modules/govuk-frontend/govuk/components/pagination/macro-options.json +1 -1
  119. data/node_modules/govuk-frontend/govuk/components/panel/fixtures.json +10 -10
  120. data/node_modules/govuk-frontend/govuk/components/panel/macro-options.json +1 -1
  121. data/node_modules/govuk-frontend/govuk/components/phase-banner/fixtures.json +1 -1
  122. data/node_modules/govuk-frontend/govuk/components/phase-banner/macro-options.json +1 -1
  123. data/node_modules/govuk-frontend/govuk/components/radios/_index.scss +5 -5
  124. data/node_modules/govuk-frontend/govuk/components/radios/fixtures.json +46 -46
  125. data/node_modules/govuk-frontend/govuk/components/radios/macro-options.json +1 -1
  126. data/node_modules/govuk-frontend/govuk/components/radios/radios.js +65 -22
  127. data/node_modules/govuk-frontend/govuk/components/radios/radios.js.map +1 -1
  128. data/node_modules/govuk-frontend/govuk/components/radios/template.njk +2 -2
  129. data/node_modules/govuk-frontend/govuk/components/select/_index.scss +7 -1
  130. data/node_modules/govuk-frontend/govuk/components/select/fixtures.json +19 -20
  131. data/node_modules/govuk-frontend/govuk/components/select/macro-options.json +7 -1
  132. data/node_modules/govuk-frontend/govuk/components/select/template.njk +5 -2
  133. data/node_modules/govuk-frontend/govuk/components/skip-link/fixtures.json +1 -1
  134. data/node_modules/govuk-frontend/govuk/components/skip-link/macro-options.json +1 -1
  135. data/node_modules/govuk-frontend/govuk/components/skip-link/skip-link.js +41 -13
  136. data/node_modules/govuk-frontend/govuk/components/skip-link/skip-link.js.map +1 -1
  137. data/node_modules/govuk-frontend/govuk/components/summary-list/fixtures.json +34 -34
  138. data/node_modules/govuk-frontend/govuk/components/summary-list/macro-options.json +1 -1
  139. data/node_modules/govuk-frontend/govuk/components/table/fixtures.json +21 -21
  140. data/node_modules/govuk-frontend/govuk/components/table/macro-options.json +1 -1
  141. data/node_modules/govuk-frontend/govuk/components/tabs/fixtures.json +15 -15
  142. data/node_modules/govuk-frontend/govuk/components/tabs/macro-options.json +1 -1
  143. data/node_modules/govuk-frontend/govuk/components/tabs/tabs.js +178 -60
  144. data/node_modules/govuk-frontend/govuk/components/tabs/tabs.js.map +1 -1
  145. data/node_modules/govuk-frontend/govuk/components/tabs/template.njk +1 -1
  146. data/node_modules/govuk-frontend/govuk/components/tag/_index.scss +18 -18
  147. data/node_modules/govuk-frontend/govuk/components/tag/fixtures.json +1 -1
  148. data/node_modules/govuk-frontend/govuk/components/tag/macro-options.json +1 -1
  149. data/node_modules/govuk-frontend/govuk/components/textarea/_index.scss +8 -1
  150. data/node_modules/govuk-frontend/govuk/components/textarea/fixtures.json +18 -18
  151. data/node_modules/govuk-frontend/govuk/components/textarea/macro-options.json +7 -1
  152. data/node_modules/govuk-frontend/govuk/components/textarea/template.njk +2 -1
  153. data/node_modules/govuk-frontend/govuk/components/warning-text/fixtures.json +9 -5
  154. data/node_modules/govuk-frontend/govuk/components/warning-text/macro-options.json +3 -3
  155. data/node_modules/govuk-frontend/govuk/components/warning-text/template.njk +1 -1
  156. data/node_modules/govuk-frontend/govuk/core/_all.scss +1 -0
  157. data/node_modules/govuk-frontend/govuk/core/_govuk-frontend-version.scss +5 -0
  158. data/node_modules/govuk-frontend/govuk/helpers/_colour.scss +5 -2
  159. data/node_modules/govuk-frontend/govuk/helpers/_focused.scss +1 -1
  160. data/node_modules/govuk-frontend/govuk/helpers/_font-faces.scss +1 -1
  161. data/node_modules/govuk-frontend/govuk/i18n.js +38 -30
  162. data/node_modules/govuk-frontend/govuk/i18n.js.map +1 -1
  163. data/node_modules/govuk-frontend/govuk/macros/i18n.njk +12 -11
  164. data/node_modules/govuk-frontend/govuk/objects/_width-container.scss +1 -1
  165. data/node_modules/govuk-frontend/govuk/settings/_colours-organisations.scss +4 -0
  166. data/node_modules/govuk-frontend/govuk/settings/_ie8.scss +16 -0
  167. data/node_modules/govuk-frontend/govuk/settings/_links.scss +5 -1
  168. data/node_modules/govuk-frontend/govuk/tools/_ie8.scss +38 -2
  169. data/node_modules/govuk-frontend/govuk/vendor/polyfills/DOMTokenList.js +2 -1
  170. data/node_modules/govuk-frontend/govuk/vendor/polyfills/DOMTokenList.js.map +1 -1
  171. data/node_modules/govuk-frontend/govuk/vendor/polyfills/Date/now.js +2 -1
  172. data/node_modules/govuk-frontend/govuk/vendor/polyfills/Date/now.js.map +1 -1
  173. data/node_modules/govuk-frontend/govuk/vendor/polyfills/Document.js +2 -1
  174. data/node_modules/govuk-frontend/govuk/vendor/polyfills/Document.js.map +1 -1
  175. data/node_modules/govuk-frontend/govuk/vendor/polyfills/Element/prototype/classList.js +10 -3
  176. data/node_modules/govuk-frontend/govuk/vendor/polyfills/Element/prototype/classList.js.map +1 -1
  177. data/node_modules/govuk-frontend/govuk/vendor/polyfills/Element/prototype/closest.js +4 -1
  178. data/node_modules/govuk-frontend/govuk/vendor/polyfills/Element/prototype/closest.js.map +1 -1
  179. data/node_modules/govuk-frontend/govuk/vendor/polyfills/Element/prototype/dataset.js +13 -7
  180. data/node_modules/govuk-frontend/govuk/vendor/polyfills/Element/prototype/dataset.js.map +1 -1
  181. data/node_modules/govuk-frontend/govuk/vendor/polyfills/Element/prototype/matches.js +2 -1
  182. data/node_modules/govuk-frontend/govuk/vendor/polyfills/Element/prototype/matches.js.map +1 -1
  183. data/node_modules/govuk-frontend/govuk/vendor/polyfills/Element/prototype/nextElementSibling.js +8 -2
  184. data/node_modules/govuk-frontend/govuk/vendor/polyfills/Element/prototype/nextElementSibling.js.map +1 -1
  185. data/node_modules/govuk-frontend/govuk/vendor/polyfills/Element/prototype/previousElementSibling.js +8 -2
  186. data/node_modules/govuk-frontend/govuk/vendor/polyfills/Element/prototype/previousElementSibling.js.map +1 -1
  187. data/node_modules/govuk-frontend/govuk/vendor/polyfills/Element.js +4 -1
  188. data/node_modules/govuk-frontend/govuk/vendor/polyfills/Element.js.map +1 -1
  189. data/node_modules/govuk-frontend/govuk/vendor/polyfills/Event.js +10 -3
  190. data/node_modules/govuk-frontend/govuk/vendor/polyfills/Event.js.map +1 -1
  191. data/node_modules/govuk-frontend/govuk/vendor/polyfills/Function/prototype/bind.js +4 -1
  192. data/node_modules/govuk-frontend/govuk/vendor/polyfills/Function/prototype/bind.js.map +1 -1
  193. data/node_modules/govuk-frontend/govuk/vendor/polyfills/Object/defineProperty.js +2 -1
  194. data/node_modules/govuk-frontend/govuk/vendor/polyfills/Object/defineProperty.js.map +1 -1
  195. data/node_modules/govuk-frontend/govuk/vendor/polyfills/String/prototype/trim.js +3 -2
  196. data/node_modules/govuk-frontend/govuk/vendor/polyfills/String/prototype/trim.js.map +1 -1
  197. data/node_modules/govuk-frontend/govuk/vendor/polyfills/Window.js +2 -1
  198. data/node_modules/govuk-frontend/govuk/vendor/polyfills/Window.js.map +1 -1
  199. data/node_modules/govuk-frontend/govuk-esm/all.mjs +81 -60
  200. data/node_modules/govuk-frontend/govuk-esm/all.mjs.map +1 -0
  201. data/node_modules/govuk-frontend/govuk-esm/common/closest-attribute-value.mjs +12 -8
  202. data/node_modules/govuk-frontend/govuk-esm/common/closest-attribute-value.mjs.map +1 -0
  203. data/node_modules/govuk-frontend/govuk-esm/common/govuk-frontend-version.mjs +9 -0
  204. data/node_modules/govuk-frontend/govuk-esm/common/govuk-frontend-version.mjs.map +1 -0
  205. data/node_modules/govuk-frontend/govuk-esm/common/index.mjs +44 -29
  206. data/node_modules/govuk-frontend/govuk-esm/common/index.mjs.map +1 -0
  207. data/node_modules/govuk-frontend/govuk-esm/common/normalise-dataset.mjs +15 -9
  208. data/node_modules/govuk-frontend/govuk-esm/common/normalise-dataset.mjs.map +1 -0
  209. data/node_modules/govuk-frontend/govuk-esm/common.mjs +3 -5
  210. data/node_modules/govuk-frontend/govuk-esm/common.mjs.map +1 -0
  211. data/node_modules/govuk-frontend/govuk-esm/components/accordion/accordion.mjs +319 -211
  212. data/node_modules/govuk-frontend/govuk-esm/components/accordion/accordion.mjs.map +1 -0
  213. data/node_modules/govuk-frontend/govuk-esm/components/button/button.mjs +47 -30
  214. data/node_modules/govuk-frontend/govuk-esm/components/button/button.mjs.map +1 -0
  215. data/node_modules/govuk-frontend/govuk-esm/components/character-count/character-count.mjs +169 -115
  216. data/node_modules/govuk-frontend/govuk-esm/components/character-count/character-count.mjs.map +1 -0
  217. data/node_modules/govuk-frontend/govuk-esm/components/checkboxes/checkboxes.mjs +88 -51
  218. data/node_modules/govuk-frontend/govuk-esm/components/checkboxes/checkboxes.mjs.map +1 -0
  219. data/node_modules/govuk-frontend/govuk-esm/components/details/details.mjs +64 -54
  220. data/node_modules/govuk-frontend/govuk-esm/components/details/details.mjs.map +1 -0
  221. data/node_modules/govuk-frontend/govuk-esm/components/error-summary/error-summary.mjs +69 -50
  222. data/node_modules/govuk-frontend/govuk-esm/components/error-summary/error-summary.mjs.map +1 -0
  223. data/node_modules/govuk-frontend/govuk-esm/components/header/header.mjs +59 -35
  224. data/node_modules/govuk-frontend/govuk-esm/components/header/header.mjs.map +1 -0
  225. data/node_modules/govuk-frontend/govuk-esm/components/notification-banner/notification-banner.mjs +36 -25
  226. data/node_modules/govuk-frontend/govuk-esm/components/notification-banner/notification-banner.mjs.map +1 -0
  227. data/node_modules/govuk-frontend/govuk-esm/components/radios/radios.mjs +67 -38
  228. data/node_modules/govuk-frontend/govuk-esm/components/radios/radios.mjs.map +1 -0
  229. data/node_modules/govuk-frontend/govuk-esm/components/skip-link/skip-link.mjs +49 -32
  230. data/node_modules/govuk-frontend/govuk-esm/components/skip-link/skip-link.mjs.map +1 -0
  231. data/node_modules/govuk-frontend/govuk-esm/components/tabs/tabs.mjs +263 -163
  232. data/node_modules/govuk-frontend/govuk-esm/components/tabs/tabs.mjs.map +1 -0
  233. data/node_modules/govuk-frontend/govuk-esm/i18n.mjs +68 -57
  234. data/node_modules/govuk-frontend/govuk-esm/i18n.mjs.map +1 -0
  235. data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/DOMTokenList.mjs +5 -3
  236. data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/DOMTokenList.mjs.map +1 -0
  237. data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Date/now.mjs +4 -2
  238. data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Date/now.mjs.map +1 -0
  239. data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Document.mjs +4 -2
  240. data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Document.mjs.map +1 -0
  241. data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Element/prototype/classList.mjs +7 -4
  242. data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Element/prototype/classList.mjs.map +1 -0
  243. data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Element/prototype/closest.mjs +5 -2
  244. data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Element/prototype/closest.mjs.map +1 -0
  245. data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Element/prototype/dataset.mjs +13 -10
  246. data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Element/prototype/dataset.mjs.map +1 -0
  247. data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Element/prototype/matches.mjs +4 -2
  248. data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Element/prototype/matches.mjs.map +1 -0
  249. data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Element/prototype/nextElementSibling.mjs +6 -3
  250. data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Element/prototype/nextElementSibling.mjs.map +1 -0
  251. data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Element/prototype/previousElementSibling.mjs +6 -3
  252. data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Element/prototype/previousElementSibling.mjs.map +1 -0
  253. data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Element.mjs +5 -2
  254. data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Element.mjs.map +1 -0
  255. data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Event.mjs +7 -4
  256. data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Event.mjs.map +1 -0
  257. data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Function/prototype/bind.mjs +5 -2
  258. data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Function/prototype/bind.mjs.map +1 -0
  259. data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Object/defineProperty.mjs +4 -2
  260. data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Object/defineProperty.mjs.map +1 -0
  261. data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/String/prototype/trim.mjs +5 -3
  262. data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/String/prototype/trim.mjs.map +1 -0
  263. data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Window.mjs +4 -2
  264. data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Window.mjs.map +1 -0
  265. data/node_modules/govuk-frontend/govuk-prototype-kit/init.js +1 -0
  266. data/node_modules/govuk-frontend/govuk-prototype-kit.config.json +2 -1
  267. data/node_modules/govuk-frontend/package.json +3 -2
  268. metadata +44 -7
  269. /data/app/assets/images/govuk_publishing_components/crests/{dit_crest_13px.png → dbt_crest_13px.png} +0 -0
  270. /data/app/assets/images/govuk_publishing_components/crests/{dit_crest_13px_x2.png → dbt_crest_13px_x2.png} +0 -0
  271. /data/app/assets/images/govuk_publishing_components/crests/{dit_crest_18px.png → dbt_crest_18px.png} +0 -0
  272. /data/app/assets/images/govuk_publishing_components/crests/{dit_crest_18px_x2.png → dbt_crest_18px_x2.png} +0 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"closest-attribute-value.mjs","sources":["../../../src/govuk/common/closest-attribute-value.mjs"],"sourcesContent":["import '../vendor/polyfills/Element/prototype/closest.mjs'\n\n/**\n * Returns the value of the given attribute closest to the given element (including itself)\n *\n * @deprecated Will be made private in v5.0\n * @param {Element} $element - The element to start walking the DOM tree up\n * @param {string} attributeName - The name of the attribute\n * @returns {string | null} Attribute value\n */\nexport function closestAttributeValue ($element, attributeName) {\n var $closestElementWithAttribute = $element.closest('[' + attributeName + ']')\n return $closestElementWithAttribute\n ? $closestElementWithAttribute.getAttribute(attributeName)\n : null\n}\n"],"names":[],"mappings":";;AAEA;;;;;;;;AAQA,AAAO,SAAS,qBAAqB,EAAE,QAAQ,EAAE,aAAa,EAAE;EAC9D,IAAI,4BAA4B,GAAG,QAAQ,CAAC,OAAO,CAAC,GAAG,GAAG,aAAa,GAAG,GAAG,EAAC;EAC9E,OAAO,4BAA4B;MAC/B,4BAA4B,CAAC,YAAY,CAAC,aAAa,CAAC;MACxD,IAAI;CACT;;;;"}
@@ -0,0 +1,9 @@
1
+ /*
2
+ * This variable is automatically overwritten during builds and releases.
3
+ * It doesn't need to be updated manually.
4
+ */
5
+
6
+ var version = '4.6.0';
7
+
8
+ export { version };
9
+ //# sourceMappingURL=common/govuk-frontend-version.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"govuk-frontend-version.mjs","sources":["../../../src/govuk/common/govuk-frontend-version.mjs"],"sourcesContent":["/*\n * This variable is automatically overwritten during builds and releases.\n * It doesn't need to be updated manually.\n */\n\nexport var version = 'development'\n"],"names":[],"mappings":"AAAA;;;;;AAKA,AAAU,IAAC,OAAO,GAAG,OAAa;;;;"}
@@ -13,16 +13,18 @@
13
13
  * This seems to fail in IE8, requires more investigation.
14
14
  * See: https://github.com/imagitama/nodelist-foreach-polyfill
15
15
  *
16
- * @param {NodeListOf<Element>} nodes - NodeList from querySelectorAll()
17
- * @param {nodeListIterator} callback - Callback function to run for each node
16
+ * @deprecated Will be made private in v5.0
17
+ * @template {Node} ElementType
18
+ * @param {NodeListOf<ElementType>} nodes - NodeList from querySelectorAll()
19
+ * @param {nodeListIterator<ElementType>} callback - Callback function to run for each node
18
20
  * @returns {void}
19
21
  */
20
- export function nodeListForEach (nodes, callback) {
22
+ function nodeListForEach (nodes, callback) {
21
23
  if (window.NodeList.prototype.forEach) {
22
24
  return nodes.forEach(callback)
23
25
  }
24
26
  for (var i = 0; i < nodes.length; i++) {
25
- callback.call(window, nodes[i], i, nodes)
27
+ callback.call(window, nodes[i], i, nodes);
26
28
  }
27
29
  }
28
30
 
@@ -31,16 +33,17 @@ export function nodeListForEach (nodes, callback) {
31
33
  * without them conflicting with each other.
32
34
  * https://stackoverflow.com/a/8809472
33
35
  *
36
+ * @deprecated Will be made private in v5.0
34
37
  * @returns {string} Unique ID
35
38
  */
36
- export function generateUniqueID () {
37
- var d = new Date().getTime()
39
+ function generateUniqueID () {
40
+ var d = new Date().getTime();
38
41
  if (typeof window.performance !== 'undefined' && typeof window.performance.now === 'function') {
39
- d += window.performance.now() // use high-precision timer if available
42
+ d += window.performance.now(); // use high-precision timer if available
40
43
  }
41
44
  return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
42
- var r = (d + Math.random() * 16) % 16 | 0
43
- d = Math.floor(d / 16)
45
+ var r = (d + Math.random() * 16) % 16 | 0;
46
+ d = Math.floor(d / 16);
44
47
  return (c === 'x' ? r : (r & 0x3 | 0x8)).toString(16)
45
48
  })
46
49
  }
@@ -52,9 +55,10 @@ export function generateUniqueID () {
52
55
  * (e.g. {'i18n.showSection': 'Show section'}) and combines them together, with
53
56
  * greatest priority on the LAST item passed in.
54
57
  *
58
+ * @deprecated Will be made private in v5.0
55
59
  * @returns {Object<string, unknown>} A flattened object of key-value pairs.
56
60
  */
57
- export function mergeConfigs (/* configObject1, configObject2, ...configObjects */) {
61
+ function mergeConfigs (/* configObject1, configObject2, ...configObjects */) {
58
62
  /**
59
63
  * Function to take nested objects and flatten them to a dot-separated keyed
60
64
  * object. Doing this means we don't need to do any deep/recursive merging of
@@ -66,7 +70,8 @@ export function mergeConfigs (/* configObject1, configObject2, ...configObjects
66
70
  */
67
71
  var flattenObject = function (configObject) {
68
72
  // Prepare an empty return object
69
- var flattenedObject = {}
73
+ /** @type {Object<string, unknown>} */
74
+ var flattenedObject = {};
70
75
 
71
76
  /**
72
77
  * Our flattening function, this is called recursively for each level of
@@ -84,34 +89,35 @@ export function mergeConfigs (/* configObject1, configObject2, ...configObjects
84
89
  if (!Object.prototype.hasOwnProperty.call(obj, key)) {
85
90
  continue
86
91
  }
87
- var value = obj[key]
88
- var prefixedKey = prefix ? prefix + '.' + key : key
92
+ var value = obj[key];
93
+ var prefixedKey = prefix ? prefix + '.' + key : key;
89
94
  if (typeof value === 'object') {
90
95
  // If the value is a nested object, recurse over that too
91
- flattenLoop(value, prefixedKey)
96
+ flattenLoop(value, prefixedKey);
92
97
  } else {
93
98
  // Otherwise, add this value to our return object
94
- flattenedObject[prefixedKey] = value
99
+ flattenedObject[prefixedKey] = value;
95
100
  }
96
101
  }
97
- }
102
+ };
98
103
 
99
104
  // Kick off the recursive loop
100
- flattenLoop(configObject)
105
+ flattenLoop(configObject);
101
106
  return flattenedObject
102
- }
107
+ };
103
108
 
104
109
  // Start with an empty object as our base
105
- var formattedConfigObject = {}
110
+ /** @type {Object<string, unknown>} */
111
+ var formattedConfigObject = {};
106
112
 
107
113
  // Loop through each of the remaining passed objects and push their keys
108
114
  // one-by-one into configObject. Any duplicate keys will override the existing
109
115
  // key with the new value.
110
116
  for (var i = 0; i < arguments.length; i++) {
111
- var obj = flattenObject(arguments[i])
117
+ var obj = flattenObject(arguments[i]);
112
118
  for (var key in obj) {
113
119
  if (Object.prototype.hasOwnProperty.call(obj, key)) {
114
- formattedConfigObject[key] = obj[key]
120
+ formattedConfigObject[key] = obj[key];
115
121
  }
116
122
  }
117
123
  }
@@ -123,44 +129,53 @@ export function mergeConfigs (/* configObject1, configObject2, ...configObjects
123
129
  * Extracts keys starting with a particular namespace from a flattened config
124
130
  * object, removing the namespace in the process.
125
131
  *
132
+ * @deprecated Will be made private in v5.0
126
133
  * @param {Object<string, unknown>} configObject - The object to extract key-value pairs from.
127
134
  * @param {string} namespace - The namespace to filter keys with.
128
135
  * @returns {Object<string, unknown>} Flattened object with dot-separated key namespace removed
129
136
  * @throws {Error} Config object required
130
137
  * @throws {Error} Namespace string required
131
138
  */
132
- export function extractConfigByNamespace (configObject, namespace) {
139
+ function extractConfigByNamespace (configObject, namespace) {
133
140
  // Check we have what we need
134
141
  if (!configObject || typeof configObject !== 'object') {
135
142
  throw new Error('Provide a `configObject` of type "object".')
136
143
  }
144
+
137
145
  if (!namespace || typeof namespace !== 'string') {
138
146
  throw new Error('Provide a `namespace` of type "string" to filter the `configObject` by.')
139
147
  }
140
- var newObject = {}
148
+
149
+ /** @type {Object<string, unknown>} */
150
+ var newObject = {};
151
+
141
152
  for (var key in configObject) {
142
153
  // Split the key into parts, using . as our namespace separator
143
- var keyParts = key.split('.')
154
+ var keyParts = key.split('.');
144
155
  // Check if the first namespace matches the configured namespace
145
156
  if (Object.prototype.hasOwnProperty.call(configObject, key) && keyParts[0] === namespace) {
146
157
  // Remove the first item (the namespace) from the parts array,
147
158
  // but only if there is more than one part (we don't want blank keys!)
148
159
  if (keyParts.length > 1) {
149
- keyParts.shift()
160
+ keyParts.shift();
150
161
  }
151
162
  // Join the remaining parts back together
152
- var newKey = keyParts.join('.')
163
+ var newKey = keyParts.join('.');
153
164
  // Add them to our new object
154
- newObject[newKey] = configObject[key]
165
+ newObject[newKey] = configObject[key];
155
166
  }
156
167
  }
157
168
  return newObject
158
169
  }
159
170
 
160
171
  /**
172
+ * @template {Node} ElementType
161
173
  * @callback nodeListIterator
162
- * @param {Element} value - The current node being iterated on
174
+ * @param {ElementType} value - The current node being iterated on
163
175
  * @param {number} index - The current index in the iteration
164
- * @param {NodeListOf<Element>} nodes - NodeList from querySelectorAll()
176
+ * @param {NodeListOf<ElementType>} nodes - NodeList from querySelectorAll()
165
177
  * @returns {void}
166
178
  */
179
+
180
+ export { nodeListForEach, generateUniqueID, mergeConfigs, extractConfigByNamespace };
181
+ //# sourceMappingURL=common/index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.mjs","sources":["../../../src/govuk/common/index.mjs"],"sourcesContent":["/**\n * Common helpers which do not require polyfill.\n *\n * IMPORTANT: If a helper require a polyfill, please isolate it in its own module\n * so that the polyfill can be properly tree-shaken and does not burden\n * the components that do not need that helper\n *\n * @module common/index\n */\n\n/**\n * TODO: Ideally this would be a NodeList.prototype.forEach polyfill\n * This seems to fail in IE8, requires more investigation.\n * See: https://github.com/imagitama/nodelist-foreach-polyfill\n *\n * @deprecated Will be made private in v5.0\n * @template {Node} ElementType\n * @param {NodeListOf<ElementType>} nodes - NodeList from querySelectorAll()\n * @param {nodeListIterator<ElementType>} callback - Callback function to run for each node\n * @returns {void}\n */\nexport function nodeListForEach (nodes, callback) {\n if (window.NodeList.prototype.forEach) {\n return nodes.forEach(callback)\n }\n for (var i = 0; i < nodes.length; i++) {\n callback.call(window, nodes[i], i, nodes)\n }\n}\n\n/**\n * Used to generate a unique string, allows multiple instances of the component\n * without them conflicting with each other.\n * https://stackoverflow.com/a/8809472\n *\n * @deprecated Will be made private in v5.0\n * @returns {string} Unique ID\n */\nexport function generateUniqueID () {\n var d = new Date().getTime()\n if (typeof window.performance !== 'undefined' && typeof window.performance.now === 'function') {\n d += window.performance.now() // use high-precision timer if available\n }\n return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {\n var r = (d + Math.random() * 16) % 16 | 0\n d = Math.floor(d / 16)\n return (c === 'x' ? r : (r & 0x3 | 0x8)).toString(16)\n })\n}\n\n/**\n * Config flattening function\n *\n * Takes any number of objects, flattens them into namespaced key-value pairs,\n * (e.g. {'i18n.showSection': 'Show section'}) and combines them together, with\n * greatest priority on the LAST item passed in.\n *\n * @deprecated Will be made private in v5.0\n * @returns {Object<string, unknown>} A flattened object of key-value pairs.\n */\nexport function mergeConfigs (/* configObject1, configObject2, ...configObjects */) {\n /**\n * Function to take nested objects and flatten them to a dot-separated keyed\n * object. Doing this means we don't need to do any deep/recursive merging of\n * each of our objects, nor transform our dataset from a flat list into a\n * nested object.\n *\n * @param {Object<string, unknown>} configObject - Deeply nested object\n * @returns {Object<string, unknown>} Flattened object with dot-separated keys\n */\n var flattenObject = function (configObject) {\n // Prepare an empty return object\n /** @type {Object<string, unknown>} */\n var flattenedObject = {}\n\n /**\n * Our flattening function, this is called recursively for each level of\n * depth in the object. At each level we prepend the previous level names to\n * the key using `prefix`.\n *\n * @param {Partial<Object<string, unknown>>} obj - Object to flatten\n * @param {string} [prefix] - Optional dot-separated prefix\n */\n var flattenLoop = function (obj, prefix) {\n // Loop through keys...\n for (var key in obj) {\n // Check to see if this is a prototypical key/value,\n // if it is, skip it.\n if (!Object.prototype.hasOwnProperty.call(obj, key)) {\n continue\n }\n var value = obj[key]\n var prefixedKey = prefix ? prefix + '.' + key : key\n if (typeof value === 'object') {\n // If the value is a nested object, recurse over that too\n flattenLoop(value, prefixedKey)\n } else {\n // Otherwise, add this value to our return object\n flattenedObject[prefixedKey] = value\n }\n }\n }\n\n // Kick off the recursive loop\n flattenLoop(configObject)\n return flattenedObject\n }\n\n // Start with an empty object as our base\n /** @type {Object<string, unknown>} */\n var formattedConfigObject = {}\n\n // Loop through each of the remaining passed objects and push their keys\n // one-by-one into configObject. Any duplicate keys will override the existing\n // key with the new value.\n for (var i = 0; i < arguments.length; i++) {\n var obj = flattenObject(arguments[i])\n for (var key in obj) {\n if (Object.prototype.hasOwnProperty.call(obj, key)) {\n formattedConfigObject[key] = obj[key]\n }\n }\n }\n\n return formattedConfigObject\n}\n\n/**\n * Extracts keys starting with a particular namespace from a flattened config\n * object, removing the namespace in the process.\n *\n * @deprecated Will be made private in v5.0\n * @param {Object<string, unknown>} configObject - The object to extract key-value pairs from.\n * @param {string} namespace - The namespace to filter keys with.\n * @returns {Object<string, unknown>} Flattened object with dot-separated key namespace removed\n * @throws {Error} Config object required\n * @throws {Error} Namespace string required\n */\nexport function extractConfigByNamespace (configObject, namespace) {\n // Check we have what we need\n if (!configObject || typeof configObject !== 'object') {\n throw new Error('Provide a `configObject` of type \"object\".')\n }\n\n if (!namespace || typeof namespace !== 'string') {\n throw new Error('Provide a `namespace` of type \"string\" to filter the `configObject` by.')\n }\n\n /** @type {Object<string, unknown>} */\n var newObject = {}\n\n for (var key in configObject) {\n // Split the key into parts, using . as our namespace separator\n var keyParts = key.split('.')\n // Check if the first namespace matches the configured namespace\n if (Object.prototype.hasOwnProperty.call(configObject, key) && keyParts[0] === namespace) {\n // Remove the first item (the namespace) from the parts array,\n // but only if there is more than one part (we don't want blank keys!)\n if (keyParts.length > 1) {\n keyParts.shift()\n }\n // Join the remaining parts back together\n var newKey = keyParts.join('.')\n // Add them to our new object\n newObject[newKey] = configObject[key]\n }\n }\n return newObject\n}\n\n/**\n * @template {Node} ElementType\n * @callback nodeListIterator\n * @param {ElementType} value - The current node being iterated on\n * @param {number} index - The current index in the iteration\n * @param {NodeListOf<ElementType>} nodes - NodeList from querySelectorAll()\n * @returns {void}\n */\n"],"names":[],"mappings":"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"}
@@ -1,7 +1,7 @@
1
- /* eslint-disable es-x/no-string-prototype-trim -- Polyfill imported */
1
+ import '../vendor/polyfills/Element/prototype/dataset.mjs';
2
+ import '../vendor/polyfills/String/prototype/trim.mjs';
2
3
 
3
- import '../vendor/polyfills/Element/prototype/dataset.mjs'
4
- import '../vendor/polyfills/String/prototype/trim.mjs'
4
+ /* eslint-disable es-x/no-string-prototype-trim -- Polyfill imported */
5
5
 
6
6
  /**
7
7
  * Normalise string
@@ -14,15 +14,16 @@ import '../vendor/polyfills/String/prototype/trim.mjs'
14
14
  * Designed to be used to convert config passed via data attributes (which are
15
15
  * always strings) into something sensible.
16
16
  *
17
+ * @deprecated Will be made private in v5.0
17
18
  * @param {string} value - The value to normalise
18
19
  * @returns {string | boolean | number | undefined} Normalised data
19
20
  */
20
- export function normaliseString (value) {
21
+ function normaliseString (value) {
21
22
  if (typeof value !== 'string') {
22
23
  return value
23
24
  }
24
25
 
25
- var trimmedValue = value.trim()
26
+ var trimmedValue = value.trim();
26
27
 
27
28
  if (trimmedValue === 'true') {
28
29
  return true
@@ -34,7 +35,7 @@ export function normaliseString (value) {
34
35
 
35
36
  // Empty / whitespace-only strings are considered finite so we need to check
36
37
  // the length of the trimmed string as well
37
- if (trimmedValue.length > 0 && isFinite(trimmedValue)) {
38
+ if (trimmedValue.length > 0 && isFinite(Number(trimmedValue))) {
38
39
  return Number(trimmedValue)
39
40
  }
40
41
 
@@ -46,15 +47,20 @@ export function normaliseString (value) {
46
47
  *
47
48
  * Loop over an object and normalise each value using normaliseData function
48
49
  *
50
+ * @deprecated Will be made private in v5.0
49
51
  * @param {DOMStringMap} dataset - HTML element dataset
50
52
  * @returns {Object<string, unknown>} Normalised dataset
51
53
  */
52
- export function normaliseDataset (dataset) {
53
- var out = {}
54
+ function normaliseDataset (dataset) {
55
+ /** @type {Object<string, unknown>} */
56
+ var out = {};
54
57
 
55
58
  for (var key in dataset) {
56
- out[key] = normaliseString(dataset[key])
59
+ out[key] = normaliseString(dataset[key]);
57
60
  }
58
61
 
59
62
  return out
60
63
  }
64
+
65
+ export { normaliseString, normaliseDataset };
66
+ //# sourceMappingURL=common/normalise-dataset.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"normalise-dataset.mjs","sources":["../../../src/govuk/common/normalise-dataset.mjs"],"sourcesContent":["/* eslint-disable es-x/no-string-prototype-trim -- Polyfill imported */\n\nimport '../vendor/polyfills/Element/prototype/dataset.mjs'\nimport '../vendor/polyfills/String/prototype/trim.mjs'\n\n/**\n * Normalise string\n *\n * 'If it looks like a duck, and it quacks like a duck…' 🦆\n *\n * If the passed value looks like a boolean or a number, convert it to a boolean\n * or number.\n *\n * Designed to be used to convert config passed via data attributes (which are\n * always strings) into something sensible.\n *\n * @deprecated Will be made private in v5.0\n * @param {string} value - The value to normalise\n * @returns {string | boolean | number | undefined} Normalised data\n */\nexport function normaliseString (value) {\n if (typeof value !== 'string') {\n return value\n }\n\n var trimmedValue = value.trim()\n\n if (trimmedValue === 'true') {\n return true\n }\n\n if (trimmedValue === 'false') {\n return false\n }\n\n // Empty / whitespace-only strings are considered finite so we need to check\n // the length of the trimmed string as well\n if (trimmedValue.length > 0 && isFinite(Number(trimmedValue))) {\n return Number(trimmedValue)\n }\n\n return value\n}\n\n/**\n * Normalise dataset\n *\n * Loop over an object and normalise each value using normaliseData function\n *\n * @deprecated Will be made private in v5.0\n * @param {DOMStringMap} dataset - HTML element dataset\n * @returns {Object<string, unknown>} Normalised dataset\n */\nexport function normaliseDataset (dataset) {\n /** @type {Object<string, unknown>} */\n var out = {}\n\n for (var key in dataset) {\n out[key] = normaliseString(dataset[key])\n }\n\n return out\n}\n"],"names":[],"mappings":";;;AAAA;AACA,AAGA;;;;;;;;;;;;;;;;AAgBA,AAAO,SAAS,eAAe,EAAE,KAAK,EAAE;EACtC,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;IAC7B,OAAO,KAAK;GACb;;EAED,IAAI,YAAY,GAAG,KAAK,CAAC,IAAI,GAAE;;EAE/B,IAAI,YAAY,KAAK,MAAM,EAAE;IAC3B,OAAO,IAAI;GACZ;;EAED,IAAI,YAAY,KAAK,OAAO,EAAE;IAC5B,OAAO,KAAK;GACb;;;;EAID,IAAI,YAAY,CAAC,MAAM,GAAG,CAAC,IAAI,QAAQ,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC,EAAE;IAC7D,OAAO,MAAM,CAAC,YAAY,CAAC;GAC5B;;EAED,OAAO,KAAK;CACb;;;;;;;;;;;AAWD,AAAO,SAAS,gBAAgB,EAAE,OAAO,EAAE;;EAEzC,IAAI,GAAG,GAAG,GAAE;;EAEZ,KAAK,IAAI,GAAG,IAAI,OAAO,EAAE;IACvB,GAAG,CAAC,GAAG,CAAC,GAAG,eAAe,CAAC,OAAO,CAAC,GAAG,CAAC,EAAC;GACzC;;EAED,OAAO,GAAG;CACX;;;;"}
@@ -1,6 +1,4 @@
1
+ export { nodeListForEach, generateUniqueID, mergeConfigs, extractConfigByNamespace } from './common/index.mjs';
2
+
1
3
  // Implementation of common function is gathered in the `common` folder
2
- // as some are split in their own modules to limit impacts of the polyfills
3
- // they require.
4
- // This module exports the non polyfilled methods as they used to be
5
- // to avoid breaking changes
6
- export * from './common/index.mjs'
4
+ //# sourceMappingURL=common.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"common.mjs","sources":["../../src/govuk/common.mjs"],"sourcesContent":["// Implementation of common function is gathered in the `common` folder\n// as some are split in their own modules to limit impacts of the polyfills\n// they require.\n// This module exports the non polyfilled methods as they used to be\n// to avoid breaking changes\nexport * from './common/index.mjs'\n"],"names":[],"mappings":";;AAAA,uEAAuE"}