govuk_publishing_components 35.3.2 → 35.3.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (271) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/govuk_publishing_components/components/cookie-banner.js +11 -5
  3. data/app/assets/stylesheets/component_guide/application.scss +37 -1
  4. data/app/assets/stylesheets/govuk_publishing_components/components/_cookie-banner.scss +8 -59
  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 +24 -0
  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/_cookie_banner.html.erb +49 -57
  12. data/app/views/govuk_publishing_components/components/_layout_super_navigation_header.html.erb +3 -3
  13. data/app/views/govuk_publishing_components/components/_metadata.html.erb +1 -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/layouts/govuk_publishing_components/application.html.erb +1 -0
  20. data/config/locales/cy.yml +1 -1
  21. data/lib/govuk_publishing_components/app_helpers/asset_helper.rb +4 -0
  22. data/lib/govuk_publishing_components/presenters/breadcrumbs_helper.rb +1 -1
  23. data/lib/govuk_publishing_components/version.rb +1 -1
  24. data/node_modules/axe-core/axe.d.ts +77 -6
  25. data/node_modules/axe-core/axe.js +955 -600
  26. data/node_modules/axe-core/axe.min.js +2 -2
  27. data/node_modules/axe-core/locales/_template.json +6 -6
  28. data/node_modules/axe-core/locales/ja.json +91 -11
  29. data/node_modules/axe-core/package.json +5 -5
  30. data/node_modules/axe-core/sri-history.json +4 -0
  31. data/node_modules/govuk-frontend/README.md +4 -5
  32. data/node_modules/govuk-frontend/govuk/all-ie8.scss +8 -0
  33. data/node_modules/govuk-frontend/govuk/all.js +738 -258
  34. data/node_modules/govuk-frontend/govuk/all.js.map +1 -1
  35. data/node_modules/govuk-frontend/govuk/common/closest-attribute-value.js +11 -7
  36. data/node_modules/govuk-frontend/govuk/common/closest-attribute-value.js.map +1 -1
  37. data/node_modules/govuk-frontend/govuk/common/govuk-frontend-version.js +17 -0
  38. data/node_modules/govuk-frontend/govuk/common/govuk-frontend-version.js.map +1 -0
  39. data/node_modules/govuk-frontend/govuk/common/index.js +16 -4
  40. data/node_modules/govuk-frontend/govuk/common/index.js.map +1 -1
  41. data/node_modules/govuk-frontend/govuk/common/normalise-dataset.js +20 -10
  42. data/node_modules/govuk-frontend/govuk/common/normalise-dataset.js.map +1 -1
  43. data/node_modules/govuk-frontend/govuk/common.js +16 -4
  44. data/node_modules/govuk-frontend/govuk/common.js.map +1 -1
  45. data/node_modules/govuk-frontend/govuk/components/accordion/_index.scss +3 -3
  46. data/node_modules/govuk-frontend/govuk/components/accordion/accordion.js +234 -86
  47. data/node_modules/govuk-frontend/govuk/components/accordion/accordion.js.map +1 -1
  48. data/node_modules/govuk-frontend/govuk/components/accordion/fixtures.json +32 -13
  49. data/node_modules/govuk-frontend/govuk/components/accordion/macro-options.json +8 -2
  50. data/node_modules/govuk-frontend/govuk/components/accordion/template.njk +1 -0
  51. data/node_modules/govuk-frontend/govuk/components/back-link/_index.scss +1 -1
  52. data/node_modules/govuk-frontend/govuk/components/back-link/fixtures.json +1 -1
  53. data/node_modules/govuk-frontend/govuk/components/back-link/macro-options.json +1 -1
  54. data/node_modules/govuk-frontend/govuk/components/breadcrumbs/_index.scss +1 -1
  55. data/node_modules/govuk-frontend/govuk/components/breadcrumbs/fixtures.json +12 -12
  56. data/node_modules/govuk-frontend/govuk/components/breadcrumbs/macro-options.json +1 -1
  57. data/node_modules/govuk-frontend/govuk/components/button/_index.scss +8 -6
  58. data/node_modules/govuk-frontend/govuk/components/button/button.js +54 -19
  59. data/node_modules/govuk-frontend/govuk/components/button/button.js.map +1 -1
  60. data/node_modules/govuk-frontend/govuk/components/button/fixtures.json +11 -1
  61. data/node_modules/govuk-frontend/govuk/components/button/macro-options.json +7 -1
  62. data/node_modules/govuk-frontend/govuk/components/button/template.njk +1 -1
  63. data/node_modules/govuk-frontend/govuk/components/character-count/character-count.js +170 -76
  64. data/node_modules/govuk-frontend/govuk/components/character-count/character-count.js.map +1 -1
  65. data/node_modules/govuk-frontend/govuk/components/character-count/fixtures.json +24 -24
  66. data/node_modules/govuk-frontend/govuk/components/character-count/macro-options.json +3 -3
  67. data/node_modules/govuk-frontend/govuk/components/checkboxes/_index.scss +6 -6
  68. data/node_modules/govuk-frontend/govuk/components/checkboxes/checkboxes.js +75 -24
  69. data/node_modules/govuk-frontend/govuk/components/checkboxes/checkboxes.js.map +1 -1
  70. data/node_modules/govuk-frontend/govuk/components/checkboxes/fixtures.json +47 -47
  71. data/node_modules/govuk-frontend/govuk/components/checkboxes/macro-options.json +1 -1
  72. data/node_modules/govuk-frontend/govuk/components/checkboxes/template.njk +3 -3
  73. data/node_modules/govuk-frontend/govuk/components/cookie-banner/fixtures.json +24 -24
  74. data/node_modules/govuk-frontend/govuk/components/cookie-banner/macro-options.json +1 -1
  75. data/node_modules/govuk-frontend/govuk/components/date-input/fixtures.json +26 -26
  76. data/node_modules/govuk-frontend/govuk/components/date-input/macro-options.json +1 -1
  77. data/node_modules/govuk-frontend/govuk/components/date-input/template.njk +1 -1
  78. data/node_modules/govuk-frontend/govuk/components/details/details.js +39 -13
  79. data/node_modules/govuk-frontend/govuk/components/details/details.js.map +1 -1
  80. data/node_modules/govuk-frontend/govuk/components/details/fixtures.json +1 -1
  81. data/node_modules/govuk-frontend/govuk/components/details/macro-options.json +1 -1
  82. data/node_modules/govuk-frontend/govuk/components/error-message/fixtures.json +10 -10
  83. data/node_modules/govuk-frontend/govuk/components/error-message/macro-options.json +1 -1
  84. data/node_modules/govuk-frontend/govuk/components/error-summary/error-summary.js +67 -27
  85. data/node_modules/govuk-frontend/govuk/components/error-summary/error-summary.js.map +1 -1
  86. data/node_modules/govuk-frontend/govuk/components/error-summary/fixtures.json +19 -19
  87. data/node_modules/govuk-frontend/govuk/components/error-summary/macro-options.json +1 -1
  88. data/node_modules/govuk-frontend/govuk/components/fieldset/fixtures.json +19 -19
  89. data/node_modules/govuk-frontend/govuk/components/fieldset/macro-options.json +1 -1
  90. data/node_modules/govuk-frontend/govuk/components/file-upload/_index.scss +6 -1
  91. data/node_modules/govuk-frontend/govuk/components/file-upload/fixtures.json +14 -14
  92. data/node_modules/govuk-frontend/govuk/components/file-upload/macro-options.json +7 -1
  93. data/node_modules/govuk-frontend/govuk/components/file-upload/template.njk +2 -1
  94. data/node_modules/govuk-frontend/govuk/components/footer/_index.scss +0 -7
  95. data/node_modules/govuk-frontend/govuk/components/footer/fixtures.json +24 -24
  96. data/node_modules/govuk-frontend/govuk/components/footer/macro-options.json +1 -1
  97. data/node_modules/govuk-frontend/govuk/components/header/fixtures.json +22 -22
  98. data/node_modules/govuk-frontend/govuk/components/header/header.js +46 -14
  99. data/node_modules/govuk-frontend/govuk/components/header/header.js.map +1 -1
  100. data/node_modules/govuk-frontend/govuk/components/header/macro-options.json +1 -1
  101. data/node_modules/govuk-frontend/govuk/components/header/template.njk +1 -1
  102. data/node_modules/govuk-frontend/govuk/components/hint/fixtures.json +1 -1
  103. data/node_modules/govuk-frontend/govuk/components/hint/macro-options.json +1 -1
  104. data/node_modules/govuk-frontend/govuk/components/input/_index.scss +15 -3
  105. data/node_modules/govuk-frontend/govuk/components/input/fixtures.json +54 -41
  106. data/node_modules/govuk-frontend/govuk/components/input/macro-options.json +7 -1
  107. data/node_modules/govuk-frontend/govuk/components/input/template.njk +2 -1
  108. data/node_modules/govuk-frontend/govuk/components/inset-text/fixtures.json +1 -1
  109. data/node_modules/govuk-frontend/govuk/components/inset-text/macro-options.json +1 -1
  110. data/node_modules/govuk-frontend/govuk/components/label/fixtures.json +6 -6
  111. data/node_modules/govuk-frontend/govuk/components/label/macro-options.json +1 -1
  112. data/node_modules/govuk-frontend/govuk/components/notification-banner/fixtures.json +1 -1
  113. data/node_modules/govuk-frontend/govuk/components/notification-banner/macro-options.json +1 -1
  114. data/node_modules/govuk-frontend/govuk/components/notification-banner/notification-banner.js +49 -22
  115. data/node_modules/govuk-frontend/govuk/components/notification-banner/notification-banner.js.map +1 -1
  116. data/node_modules/govuk-frontend/govuk/components/pagination/fixtures.json +16 -16
  117. data/node_modules/govuk-frontend/govuk/components/pagination/macro-options.json +1 -1
  118. data/node_modules/govuk-frontend/govuk/components/panel/fixtures.json +10 -10
  119. data/node_modules/govuk-frontend/govuk/components/panel/macro-options.json +1 -1
  120. data/node_modules/govuk-frontend/govuk/components/phase-banner/fixtures.json +1 -1
  121. data/node_modules/govuk-frontend/govuk/components/phase-banner/macro-options.json +1 -1
  122. data/node_modules/govuk-frontend/govuk/components/radios/_index.scss +5 -5
  123. data/node_modules/govuk-frontend/govuk/components/radios/fixtures.json +46 -46
  124. data/node_modules/govuk-frontend/govuk/components/radios/macro-options.json +1 -1
  125. data/node_modules/govuk-frontend/govuk/components/radios/radios.js +65 -22
  126. data/node_modules/govuk-frontend/govuk/components/radios/radios.js.map +1 -1
  127. data/node_modules/govuk-frontend/govuk/components/radios/template.njk +2 -2
  128. data/node_modules/govuk-frontend/govuk/components/select/_index.scss +7 -1
  129. data/node_modules/govuk-frontend/govuk/components/select/fixtures.json +19 -20
  130. data/node_modules/govuk-frontend/govuk/components/select/macro-options.json +7 -1
  131. data/node_modules/govuk-frontend/govuk/components/select/template.njk +5 -2
  132. data/node_modules/govuk-frontend/govuk/components/skip-link/fixtures.json +1 -1
  133. data/node_modules/govuk-frontend/govuk/components/skip-link/macro-options.json +1 -1
  134. data/node_modules/govuk-frontend/govuk/components/skip-link/skip-link.js +41 -13
  135. data/node_modules/govuk-frontend/govuk/components/skip-link/skip-link.js.map +1 -1
  136. data/node_modules/govuk-frontend/govuk/components/summary-list/fixtures.json +34 -34
  137. data/node_modules/govuk-frontend/govuk/components/summary-list/macro-options.json +1 -1
  138. data/node_modules/govuk-frontend/govuk/components/table/fixtures.json +21 -21
  139. data/node_modules/govuk-frontend/govuk/components/table/macro-options.json +1 -1
  140. data/node_modules/govuk-frontend/govuk/components/tabs/fixtures.json +15 -15
  141. data/node_modules/govuk-frontend/govuk/components/tabs/macro-options.json +1 -1
  142. data/node_modules/govuk-frontend/govuk/components/tabs/tabs.js +178 -60
  143. data/node_modules/govuk-frontend/govuk/components/tabs/tabs.js.map +1 -1
  144. data/node_modules/govuk-frontend/govuk/components/tabs/template.njk +1 -1
  145. data/node_modules/govuk-frontend/govuk/components/tag/_index.scss +18 -18
  146. data/node_modules/govuk-frontend/govuk/components/tag/fixtures.json +1 -1
  147. data/node_modules/govuk-frontend/govuk/components/tag/macro-options.json +1 -1
  148. data/node_modules/govuk-frontend/govuk/components/textarea/_index.scss +8 -1
  149. data/node_modules/govuk-frontend/govuk/components/textarea/fixtures.json +18 -18
  150. data/node_modules/govuk-frontend/govuk/components/textarea/macro-options.json +7 -1
  151. data/node_modules/govuk-frontend/govuk/components/textarea/template.njk +2 -1
  152. data/node_modules/govuk-frontend/govuk/components/warning-text/fixtures.json +9 -5
  153. data/node_modules/govuk-frontend/govuk/components/warning-text/macro-options.json +3 -3
  154. data/node_modules/govuk-frontend/govuk/components/warning-text/template.njk +1 -1
  155. data/node_modules/govuk-frontend/govuk/core/_all.scss +1 -0
  156. data/node_modules/govuk-frontend/govuk/core/_govuk-frontend-version.scss +5 -0
  157. data/node_modules/govuk-frontend/govuk/helpers/_colour.scss +5 -2
  158. data/node_modules/govuk-frontend/govuk/helpers/_focused.scss +1 -1
  159. data/node_modules/govuk-frontend/govuk/helpers/_font-faces.scss +1 -1
  160. data/node_modules/govuk-frontend/govuk/i18n.js +38 -30
  161. data/node_modules/govuk-frontend/govuk/i18n.js.map +1 -1
  162. data/node_modules/govuk-frontend/govuk/macros/i18n.njk +12 -11
  163. data/node_modules/govuk-frontend/govuk/objects/_width-container.scss +1 -1
  164. data/node_modules/govuk-frontend/govuk/settings/_colours-organisations.scss +4 -0
  165. data/node_modules/govuk-frontend/govuk/settings/_ie8.scss +16 -0
  166. data/node_modules/govuk-frontend/govuk/settings/_links.scss +5 -1
  167. data/node_modules/govuk-frontend/govuk/tools/_ie8.scss +38 -2
  168. data/node_modules/govuk-frontend/govuk/vendor/polyfills/DOMTokenList.js +2 -1
  169. data/node_modules/govuk-frontend/govuk/vendor/polyfills/DOMTokenList.js.map +1 -1
  170. data/node_modules/govuk-frontend/govuk/vendor/polyfills/Date/now.js +2 -1
  171. data/node_modules/govuk-frontend/govuk/vendor/polyfills/Date/now.js.map +1 -1
  172. data/node_modules/govuk-frontend/govuk/vendor/polyfills/Document.js +2 -1
  173. data/node_modules/govuk-frontend/govuk/vendor/polyfills/Document.js.map +1 -1
  174. data/node_modules/govuk-frontend/govuk/vendor/polyfills/Element/prototype/classList.js +10 -3
  175. data/node_modules/govuk-frontend/govuk/vendor/polyfills/Element/prototype/classList.js.map +1 -1
  176. data/node_modules/govuk-frontend/govuk/vendor/polyfills/Element/prototype/closest.js +4 -1
  177. data/node_modules/govuk-frontend/govuk/vendor/polyfills/Element/prototype/closest.js.map +1 -1
  178. data/node_modules/govuk-frontend/govuk/vendor/polyfills/Element/prototype/dataset.js +13 -7
  179. data/node_modules/govuk-frontend/govuk/vendor/polyfills/Element/prototype/dataset.js.map +1 -1
  180. data/node_modules/govuk-frontend/govuk/vendor/polyfills/Element/prototype/matches.js +2 -1
  181. data/node_modules/govuk-frontend/govuk/vendor/polyfills/Element/prototype/matches.js.map +1 -1
  182. data/node_modules/govuk-frontend/govuk/vendor/polyfills/Element/prototype/nextElementSibling.js +8 -2
  183. data/node_modules/govuk-frontend/govuk/vendor/polyfills/Element/prototype/nextElementSibling.js.map +1 -1
  184. data/node_modules/govuk-frontend/govuk/vendor/polyfills/Element/prototype/previousElementSibling.js +8 -2
  185. data/node_modules/govuk-frontend/govuk/vendor/polyfills/Element/prototype/previousElementSibling.js.map +1 -1
  186. data/node_modules/govuk-frontend/govuk/vendor/polyfills/Element.js +4 -1
  187. data/node_modules/govuk-frontend/govuk/vendor/polyfills/Element.js.map +1 -1
  188. data/node_modules/govuk-frontend/govuk/vendor/polyfills/Event.js +10 -3
  189. data/node_modules/govuk-frontend/govuk/vendor/polyfills/Event.js.map +1 -1
  190. data/node_modules/govuk-frontend/govuk/vendor/polyfills/Function/prototype/bind.js +4 -1
  191. data/node_modules/govuk-frontend/govuk/vendor/polyfills/Function/prototype/bind.js.map +1 -1
  192. data/node_modules/govuk-frontend/govuk/vendor/polyfills/Object/defineProperty.js +2 -1
  193. data/node_modules/govuk-frontend/govuk/vendor/polyfills/Object/defineProperty.js.map +1 -1
  194. data/node_modules/govuk-frontend/govuk/vendor/polyfills/String/prototype/trim.js +3 -2
  195. data/node_modules/govuk-frontend/govuk/vendor/polyfills/String/prototype/trim.js.map +1 -1
  196. data/node_modules/govuk-frontend/govuk/vendor/polyfills/Window.js +2 -1
  197. data/node_modules/govuk-frontend/govuk/vendor/polyfills/Window.js.map +1 -1
  198. data/node_modules/govuk-frontend/govuk-esm/all.mjs +81 -60
  199. data/node_modules/govuk-frontend/govuk-esm/all.mjs.map +1 -0
  200. data/node_modules/govuk-frontend/govuk-esm/common/closest-attribute-value.mjs +12 -8
  201. data/node_modules/govuk-frontend/govuk-esm/common/closest-attribute-value.mjs.map +1 -0
  202. data/node_modules/govuk-frontend/govuk-esm/common/govuk-frontend-version.mjs +9 -0
  203. data/node_modules/govuk-frontend/govuk-esm/common/govuk-frontend-version.mjs.map +1 -0
  204. data/node_modules/govuk-frontend/govuk-esm/common/index.mjs +44 -29
  205. data/node_modules/govuk-frontend/govuk-esm/common/index.mjs.map +1 -0
  206. data/node_modules/govuk-frontend/govuk-esm/common/normalise-dataset.mjs +15 -9
  207. data/node_modules/govuk-frontend/govuk-esm/common/normalise-dataset.mjs.map +1 -0
  208. data/node_modules/govuk-frontend/govuk-esm/common.mjs +3 -5
  209. data/node_modules/govuk-frontend/govuk-esm/common.mjs.map +1 -0
  210. data/node_modules/govuk-frontend/govuk-esm/components/accordion/accordion.mjs +319 -211
  211. data/node_modules/govuk-frontend/govuk-esm/components/accordion/accordion.mjs.map +1 -0
  212. data/node_modules/govuk-frontend/govuk-esm/components/button/button.mjs +47 -30
  213. data/node_modules/govuk-frontend/govuk-esm/components/button/button.mjs.map +1 -0
  214. data/node_modules/govuk-frontend/govuk-esm/components/character-count/character-count.mjs +169 -115
  215. data/node_modules/govuk-frontend/govuk-esm/components/character-count/character-count.mjs.map +1 -0
  216. data/node_modules/govuk-frontend/govuk-esm/components/checkboxes/checkboxes.mjs +88 -51
  217. data/node_modules/govuk-frontend/govuk-esm/components/checkboxes/checkboxes.mjs.map +1 -0
  218. data/node_modules/govuk-frontend/govuk-esm/components/details/details.mjs +64 -54
  219. data/node_modules/govuk-frontend/govuk-esm/components/details/details.mjs.map +1 -0
  220. data/node_modules/govuk-frontend/govuk-esm/components/error-summary/error-summary.mjs +69 -50
  221. data/node_modules/govuk-frontend/govuk-esm/components/error-summary/error-summary.mjs.map +1 -0
  222. data/node_modules/govuk-frontend/govuk-esm/components/header/header.mjs +59 -35
  223. data/node_modules/govuk-frontend/govuk-esm/components/header/header.mjs.map +1 -0
  224. data/node_modules/govuk-frontend/govuk-esm/components/notification-banner/notification-banner.mjs +36 -25
  225. data/node_modules/govuk-frontend/govuk-esm/components/notification-banner/notification-banner.mjs.map +1 -0
  226. data/node_modules/govuk-frontend/govuk-esm/components/radios/radios.mjs +67 -38
  227. data/node_modules/govuk-frontend/govuk-esm/components/radios/radios.mjs.map +1 -0
  228. data/node_modules/govuk-frontend/govuk-esm/components/skip-link/skip-link.mjs +49 -32
  229. data/node_modules/govuk-frontend/govuk-esm/components/skip-link/skip-link.mjs.map +1 -0
  230. data/node_modules/govuk-frontend/govuk-esm/components/tabs/tabs.mjs +263 -163
  231. data/node_modules/govuk-frontend/govuk-esm/components/tabs/tabs.mjs.map +1 -0
  232. data/node_modules/govuk-frontend/govuk-esm/i18n.mjs +68 -57
  233. data/node_modules/govuk-frontend/govuk-esm/i18n.mjs.map +1 -0
  234. data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/DOMTokenList.mjs +5 -3
  235. data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/DOMTokenList.mjs.map +1 -0
  236. data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Date/now.mjs +4 -2
  237. data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Date/now.mjs.map +1 -0
  238. data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Document.mjs +4 -2
  239. data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Document.mjs.map +1 -0
  240. data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Element/prototype/classList.mjs +7 -4
  241. data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Element/prototype/classList.mjs.map +1 -0
  242. data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Element/prototype/closest.mjs +5 -2
  243. data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Element/prototype/closest.mjs.map +1 -0
  244. data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Element/prototype/dataset.mjs +13 -10
  245. data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Element/prototype/dataset.mjs.map +1 -0
  246. data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Element/prototype/matches.mjs +4 -2
  247. data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Element/prototype/matches.mjs.map +1 -0
  248. data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Element/prototype/nextElementSibling.mjs +6 -3
  249. data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Element/prototype/nextElementSibling.mjs.map +1 -0
  250. data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Element/prototype/previousElementSibling.mjs +6 -3
  251. data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Element/prototype/previousElementSibling.mjs.map +1 -0
  252. data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Element.mjs +5 -2
  253. data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Element.mjs.map +1 -0
  254. data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Event.mjs +7 -4
  255. data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Event.mjs.map +1 -0
  256. data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Function/prototype/bind.mjs +5 -2
  257. data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Function/prototype/bind.mjs.map +1 -0
  258. data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Object/defineProperty.mjs +4 -2
  259. data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Object/defineProperty.mjs.map +1 -0
  260. data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/String/prototype/trim.mjs +5 -3
  261. data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/String/prototype/trim.mjs.map +1 -0
  262. data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Window.mjs +4 -2
  263. data/node_modules/govuk-frontend/govuk-esm/vendor/polyfills/Window.mjs.map +1 -0
  264. data/node_modules/govuk-frontend/govuk-prototype-kit/init.js +1 -0
  265. data/node_modules/govuk-frontend/govuk-prototype-kit.config.json +2 -1
  266. data/node_modules/govuk-frontend/package.json +3 -2
  267. metadata +43 -6
  268. /data/app/assets/images/govuk_publishing_components/crests/{dit_crest_13px.png → dbt_crest_13px.png} +0 -0
  269. /data/app/assets/images/govuk_publishing_components/crests/{dit_crest_13px_x2.png → dbt_crest_13px_x2.png} +0 -0
  270. /data/app/assets/images/govuk_publishing_components/crests/{dit_crest_18px.png → dbt_crest_18px.png} +0 -0
  271. /data/app/assets/images/govuk_publishing_components/crests/{dit_crest_18px_x2.png → dbt_crest_18px_x2.png} +0 -0
@@ -1,19 +1,31 @@
1
- /* eslint-disable es-x/no-function-prototype-bind -- Polyfill imported */
1
+ import { nodeListForEach } from '../../common/index.mjs';
2
+ import '../../vendor/polyfills/Element/prototype/classList.mjs';
3
+ import '../../vendor/polyfills/Event.mjs';
4
+ import '../../vendor/polyfills/Function/prototype/bind.mjs';
2
5
 
3
- import { nodeListForEach } from '../../common/index.mjs'
4
- import '../../vendor/polyfills/Element/prototype/classList.mjs'
5
- import '../../vendor/polyfills/Event.mjs' // addEventListener, event.target normalization and DOMContentLoaded
6
- import '../../vendor/polyfills/Function/prototype/bind.mjs'
6
+ /* eslint-disable es-x/no-function-prototype-bind -- Polyfill imported */
7
7
 
8
8
  /**
9
9
  * Radios component
10
10
  *
11
11
  * @class
12
- * @param {HTMLElement} $module - HTML element to use for radios
12
+ * @param {Element} $module - HTML element to use for radios
13
13
  */
14
14
  function Radios ($module) {
15
- this.$module = $module
16
- this.$inputs = $module.querySelectorAll('input[type="radio"]')
15
+ if (!($module instanceof HTMLElement)) {
16
+ return this
17
+ }
18
+
19
+ var $inputs = $module.querySelectorAll('input[type="radio"]');
20
+ if (!$inputs.length) {
21
+ return this
22
+ }
23
+
24
+ /** @deprecated Will be made private in v5.0 */
25
+ this.$module = $module;
26
+
27
+ /** @deprecated Will be made private in v5.0 */
28
+ this.$inputs = $inputs;
17
29
  }
18
30
 
19
31
  /**
@@ -31,11 +43,16 @@ function Radios ($module) {
31
43
  * the reveal in sync with the radio state.
32
44
  */
33
45
  Radios.prototype.init = function () {
34
- var $module = this.$module
35
- var $inputs = this.$inputs
46
+ // Check that required elements are present
47
+ if (!this.$module || !this.$inputs) {
48
+ return
49
+ }
50
+
51
+ var $module = this.$module;
52
+ var $inputs = this.$inputs;
36
53
 
37
54
  nodeListForEach($inputs, function ($input) {
38
- var targetId = $input.getAttribute('data-aria-controls')
55
+ var targetId = $input.getAttribute('data-aria-controls');
39
56
 
40
57
  // Skip radios without data-aria-controls attributes, or where the
41
58
  // target element does not exist.
@@ -45,35 +62,36 @@ Radios.prototype.init = function () {
45
62
 
46
63
  // Promote the data-aria-controls attribute to a aria-controls attribute
47
64
  // so that the relationship is exposed in the AOM
48
- $input.setAttribute('aria-controls', targetId)
49
- $input.removeAttribute('data-aria-controls')
50
- })
65
+ $input.setAttribute('aria-controls', targetId);
66
+ $input.removeAttribute('data-aria-controls');
67
+ });
51
68
 
52
69
  // When the page is restored after navigating 'back' in some browsers the
53
70
  // state of form controls is not restored until *after* the DOMContentLoaded
54
71
  // event is fired, so we need to sync after the pageshow event in browsers
55
72
  // that support it.
56
- if ('onpageshow' in window) {
57
- window.addEventListener('pageshow', this.syncAllConditionalReveals.bind(this))
58
- } else {
59
- window.addEventListener('DOMContentLoaded', this.syncAllConditionalReveals.bind(this))
60
- }
73
+ window.addEventListener(
74
+ 'onpageshow' in window ? 'pageshow' : 'DOMContentLoaded',
75
+ this.syncAllConditionalReveals.bind(this)
76
+ );
61
77
 
62
78
  // Although we've set up handlers to sync state on the pageshow or
63
79
  // DOMContentLoaded event, init could be called after those events have fired,
64
80
  // for example if they are added to the page dynamically, so sync now too.
65
- this.syncAllConditionalReveals()
81
+ this.syncAllConditionalReveals();
66
82
 
67
83
  // Handle events
68
- $module.addEventListener('click', this.handleClick.bind(this))
69
- }
84
+ $module.addEventListener('click', this.handleClick.bind(this));
85
+ };
70
86
 
71
87
  /**
72
88
  * Sync the conditional reveal states for all radio buttons in this $module.
89
+ *
90
+ * @deprecated Will be made private in v5.0
73
91
  */
74
92
  Radios.prototype.syncAllConditionalReveals = function () {
75
- nodeListForEach(this.$inputs, this.syncConditionalRevealWithInputState.bind(this))
76
- }
93
+ nodeListForEach(this.$inputs, this.syncConditionalRevealWithInputState.bind(this));
94
+ };
77
95
 
78
96
  /**
79
97
  * Sync conditional reveal with the input state
@@ -81,18 +99,23 @@ Radios.prototype.syncAllConditionalReveals = function () {
81
99
  * Synchronise the visibility of the conditional reveal, and its accessible
82
100
  * state, with the input's checked state.
83
101
  *
102
+ * @deprecated Will be made private in v5.0
84
103
  * @param {HTMLInputElement} $input - Radio input
85
104
  */
86
105
  Radios.prototype.syncConditionalRevealWithInputState = function ($input) {
87
- var $target = document.getElementById($input.getAttribute('aria-controls'))
106
+ var targetId = $input.getAttribute('aria-controls');
107
+ if (!targetId) {
108
+ return
109
+ }
88
110
 
111
+ var $target = document.getElementById(targetId);
89
112
  if ($target && $target.classList.contains('govuk-radios__conditional')) {
90
- var inputIsChecked = $input.checked
113
+ var inputIsChecked = $input.checked;
91
114
 
92
- $input.setAttribute('aria-expanded', inputIsChecked)
93
- $target.classList.toggle('govuk-radios__conditional--hidden', !inputIsChecked)
115
+ $input.setAttribute('aria-expanded', inputIsChecked.toString());
116
+ $target.classList.toggle('govuk-radios__conditional--hidden', !inputIsChecked);
94
117
  }
95
- }
118
+ };
96
119
 
97
120
  /**
98
121
  * Click event handler
@@ -102,28 +125,34 @@ Radios.prototype.syncConditionalRevealWithInputState = function ($input) {
102
125
  * with the same name (because checking one radio could have un-checked a radio
103
126
  * in another $module)
104
127
  *
128
+ * @deprecated Will be made private in v5.0
105
129
  * @param {MouseEvent} event - Click event
106
130
  */
107
131
  Radios.prototype.handleClick = function (event) {
108
- var $clickedInput = event.target
132
+ var $component = this;
133
+ var $clickedInput = event.target;
109
134
 
110
135
  // Ignore clicks on things that aren't radio buttons
111
- if ($clickedInput.type !== 'radio') {
136
+ if (!($clickedInput instanceof HTMLInputElement) || $clickedInput.type !== 'radio') {
112
137
  return
113
138
  }
114
139
 
115
140
  // We only need to consider radios with conditional reveals, which will have
116
141
  // aria-controls attributes.
117
- var $allInputs = document.querySelectorAll('input[type="radio"][aria-controls]')
142
+ var $allInputs = document.querySelectorAll('input[type="radio"][aria-controls]');
143
+
144
+ var $clickedInputForm = $clickedInput.form;
145
+ var $clickedInputName = $clickedInput.name;
118
146
 
119
147
  nodeListForEach($allInputs, function ($input) {
120
- var hasSameFormOwner = ($input.form === $clickedInput.form)
121
- var hasSameName = ($input.name === $clickedInput.name)
148
+ var hasSameFormOwner = $input.form === $clickedInputForm;
149
+ var hasSameName = $input.name === $clickedInputName;
122
150
 
123
151
  if (hasSameName && hasSameFormOwner) {
124
- this.syncConditionalRevealWithInputState($input)
152
+ $component.syncConditionalRevealWithInputState($input);
125
153
  }
126
- }.bind(this))
127
- }
154
+ });
155
+ };
128
156
 
129
- export default Radios
157
+ export default Radios;
158
+ //# sourceMappingURL=components/radios/radios.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"radios.mjs","sources":["../../../../src/govuk/components/radios/radios.mjs"],"sourcesContent":["/* eslint-disable es-x/no-function-prototype-bind -- Polyfill imported */\n\nimport { nodeListForEach } from '../../common/index.mjs'\nimport '../../vendor/polyfills/Element/prototype/classList.mjs'\nimport '../../vendor/polyfills/Event.mjs' // addEventListener, event.target normalization and DOMContentLoaded\nimport '../../vendor/polyfills/Function/prototype/bind.mjs'\n\n/**\n * Radios component\n *\n * @class\n * @param {Element} $module - HTML element to use for radios\n */\nfunction Radios ($module) {\n if (!($module instanceof HTMLElement)) {\n return this\n }\n\n var $inputs = $module.querySelectorAll('input[type=\"radio\"]')\n if (!$inputs.length) {\n return this\n }\n\n /** @deprecated Will be made private in v5.0 */\n this.$module = $module\n\n /** @deprecated Will be made private in v5.0 */\n this.$inputs = $inputs\n}\n\n/**\n * Initialise component\n *\n * Radios can be associated with a 'conditionally revealed' content block – for\n * example, a radio for 'Phone' could reveal an additional form field for the\n * user to enter their phone number.\n *\n * These associations are made using a `data-aria-controls` attribute, which is\n * promoted to an aria-controls attribute during initialisation.\n *\n * We also need to restore the state of any conditional reveals on the page (for\n * example if the user has navigated back), and set up event handlers to keep\n * the reveal in sync with the radio state.\n */\nRadios.prototype.init = function () {\n // Check that required elements are present\n if (!this.$module || !this.$inputs) {\n return\n }\n\n var $module = this.$module\n var $inputs = this.$inputs\n\n nodeListForEach($inputs, function ($input) {\n var targetId = $input.getAttribute('data-aria-controls')\n\n // Skip radios without data-aria-controls attributes, or where the\n // target element does not exist.\n if (!targetId || !document.getElementById(targetId)) {\n return\n }\n\n // Promote the data-aria-controls attribute to a aria-controls attribute\n // so that the relationship is exposed in the AOM\n $input.setAttribute('aria-controls', targetId)\n $input.removeAttribute('data-aria-controls')\n })\n\n // When the page is restored after navigating 'back' in some browsers the\n // state of form controls is not restored until *after* the DOMContentLoaded\n // event is fired, so we need to sync after the pageshow event in browsers\n // that support it.\n window.addEventListener(\n 'onpageshow' in window ? 'pageshow' : 'DOMContentLoaded',\n this.syncAllConditionalReveals.bind(this)\n )\n\n // Although we've set up handlers to sync state on the pageshow or\n // DOMContentLoaded event, init could be called after those events have fired,\n // for example if they are added to the page dynamically, so sync now too.\n this.syncAllConditionalReveals()\n\n // Handle events\n $module.addEventListener('click', this.handleClick.bind(this))\n}\n\n/**\n * Sync the conditional reveal states for all radio buttons in this $module.\n *\n * @deprecated Will be made private in v5.0\n */\nRadios.prototype.syncAllConditionalReveals = function () {\n nodeListForEach(this.$inputs, this.syncConditionalRevealWithInputState.bind(this))\n}\n\n/**\n * Sync conditional reveal with the input state\n *\n * Synchronise the visibility of the conditional reveal, and its accessible\n * state, with the input's checked state.\n *\n * @deprecated Will be made private in v5.0\n * @param {HTMLInputElement} $input - Radio input\n */\nRadios.prototype.syncConditionalRevealWithInputState = function ($input) {\n var targetId = $input.getAttribute('aria-controls')\n if (!targetId) {\n return\n }\n\n var $target = document.getElementById(targetId)\n if ($target && $target.classList.contains('govuk-radios__conditional')) {\n var inputIsChecked = $input.checked\n\n $input.setAttribute('aria-expanded', inputIsChecked.toString())\n $target.classList.toggle('govuk-radios__conditional--hidden', !inputIsChecked)\n }\n}\n\n/**\n * Click event handler\n *\n * Handle a click within the $module – if the click occurred on a radio, sync\n * the state of the conditional reveal for all radio buttons in the same form\n * with the same name (because checking one radio could have un-checked a radio\n * in another $module)\n *\n * @deprecated Will be made private in v5.0\n * @param {MouseEvent} event - Click event\n */\nRadios.prototype.handleClick = function (event) {\n var $component = this\n var $clickedInput = event.target\n\n // Ignore clicks on things that aren't radio buttons\n if (!($clickedInput instanceof HTMLInputElement) || $clickedInput.type !== 'radio') {\n return\n }\n\n // We only need to consider radios with conditional reveals, which will have\n // aria-controls attributes.\n var $allInputs = document.querySelectorAll('input[type=\"radio\"][aria-controls]')\n\n var $clickedInputForm = $clickedInput.form\n var $clickedInputName = $clickedInput.name\n\n nodeListForEach($allInputs, function ($input) {\n var hasSameFormOwner = $input.form === $clickedInputForm\n var hasSameName = $input.name === $clickedInputName\n\n if (hasSameName && hasSameFormOwner) {\n $component.syncConditionalRevealWithInputState($input)\n }\n })\n}\n\nexport default Radios\n"],"names":[],"mappings":"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"}
@@ -1,86 +1,101 @@
1
- /* eslint-disable es-x/no-function-prototype-bind -- Polyfill imported */
1
+ import '../../vendor/polyfills/Element/prototype/classList.mjs';
2
+ import '../../vendor/polyfills/Event.mjs';
3
+ import '../../vendor/polyfills/Function/prototype/bind.mjs';
2
4
 
3
- import '../../vendor/polyfills/Element/prototype/classList.mjs'
4
- import '../../vendor/polyfills/Event.mjs' // addEventListener, event.target normalization and DOMContentLoaded
5
- import '../../vendor/polyfills/Function/prototype/bind.mjs'
5
+ /* eslint-disable es-x/no-function-prototype-bind -- Polyfill imported */
6
6
 
7
7
  /**
8
8
  * Skip link component
9
9
  *
10
10
  * @class
11
- * @param {HTMLElement} $module - HTML element to use for skip link
11
+ * @param {Element} $module - HTML element to use for skip link
12
12
  */
13
13
  function SkipLink ($module) {
14
- this.$module = $module
15
- this.$linkedElement = null
16
- this.linkedElementListener = false
14
+ if (!($module instanceof HTMLAnchorElement)) {
15
+ return this
16
+ }
17
+
18
+ /** @deprecated Will be made private in v5.0 */
19
+ this.$module = $module;
20
+
21
+ /** @deprecated Will be made private in v5.0 */
22
+ this.$linkedElement = null;
23
+
24
+ /** @deprecated Will be made private in v5.0 */
25
+ this.linkedElementListener = false;
17
26
  }
18
27
 
19
28
  /**
20
29
  * Initialise component
21
30
  */
22
31
  SkipLink.prototype.init = function () {
23
- // Check for module
32
+ // Check that required elements are present
24
33
  if (!this.$module) {
25
34
  return
26
35
  }
27
36
 
28
37
  // Check for linked element
29
- this.$linkedElement = this.getLinkedElement()
30
- if (!this.$linkedElement) {
38
+ var $linkedElement = this.getLinkedElement();
39
+ if (!$linkedElement) {
31
40
  return
32
41
  }
33
42
 
34
- this.$module.addEventListener('click', this.focusLinkedElement.bind(this))
35
- }
43
+ this.$linkedElement = $linkedElement;
44
+ this.$module.addEventListener('click', this.focusLinkedElement.bind(this));
45
+ };
36
46
 
37
47
  /**
38
48
  * Get linked element
39
49
  *
40
- * @returns {HTMLElement} $linkedElement - DOM element linked to from the skip link
50
+ * @deprecated Will be made private in v5.0
51
+ * @returns {HTMLElement | null} $linkedElement - DOM element linked to from the skip link
41
52
  */
42
53
  SkipLink.prototype.getLinkedElement = function () {
43
- var linkedElementId = this.getFragmentFromUrl()
44
-
54
+ var linkedElementId = this.getFragmentFromUrl();
45
55
  if (!linkedElementId) {
46
- return false
56
+ return null
47
57
  }
48
58
 
49
59
  return document.getElementById(linkedElementId)
50
- }
60
+ };
51
61
 
52
62
  /**
53
63
  * Focus the linked element
54
64
  *
55
65
  * Set tabindex and helper CSS class. Set listener to remove them on blur.
66
+ *
67
+ * @deprecated Will be made private in v5.0
56
68
  */
57
69
  SkipLink.prototype.focusLinkedElement = function () {
58
- var $linkedElement = this.$linkedElement
70
+ var $linkedElement = this.$linkedElement;
59
71
 
60
72
  if (!$linkedElement.getAttribute('tabindex')) {
61
73
  // Set the element tabindex to -1 so it can be focused with JavaScript.
62
- $linkedElement.setAttribute('tabindex', '-1')
63
- $linkedElement.classList.add('govuk-skip-link-focused-element')
74
+ $linkedElement.setAttribute('tabindex', '-1');
75
+ $linkedElement.classList.add('govuk-skip-link-focused-element');
64
76
 
65
77
  // Add listener for blur on the focused element (unless the listener has previously been added)
66
78
  if (!this.linkedElementListener) {
67
- this.$linkedElement.addEventListener('blur', this.removeFocusProperties.bind(this))
68
- this.linkedElementListener = true
79
+ this.$linkedElement.addEventListener('blur', this.removeFocusProperties.bind(this));
80
+ this.linkedElementListener = true;
69
81
  }
70
82
  }
71
- $linkedElement.focus()
72
- }
83
+
84
+ $linkedElement.focus();
85
+ };
73
86
 
74
87
  /**
75
88
  * Remove the tabindex that makes the linked element focusable because the element only needs to be
76
89
  * focusable until it has received programmatic focus and a screen reader has announced it.
77
90
  *
78
91
  * Remove the CSS class that removes the native focus styles.
92
+ *
93
+ * @deprecated Will be made private in v5.0
79
94
  */
80
95
  SkipLink.prototype.removeFocusProperties = function () {
81
- this.$linkedElement.removeAttribute('tabindex')
82
- this.$linkedElement.classList.remove('govuk-skip-link-focused-element')
83
- }
96
+ this.$linkedElement.removeAttribute('tabindex');
97
+ this.$linkedElement.classList.remove('govuk-skip-link-focused-element');
98
+ };
84
99
 
85
100
  /**
86
101
  * Get fragment from URL
@@ -88,15 +103,17 @@ SkipLink.prototype.removeFocusProperties = function () {
88
103
  * Extract the fragment (everything after the hash symbol) from a URL, but not including
89
104
  * the symbol.
90
105
  *
91
- * @returns {string} Fragment from URL, without the hash symbol
106
+ * @deprecated Will be made private in v5.0
107
+ * @returns {string | undefined} Fragment from URL, without the hash symbol
92
108
  */
93
109
  SkipLink.prototype.getFragmentFromUrl = function () {
94
110
  // Bail if the anchor link doesn't have a hash
95
111
  if (!this.$module.hash) {
96
- return false
112
+ return
97
113
  }
98
114
 
99
115
  return this.$module.hash.split('#').pop()
100
- }
116
+ };
101
117
 
102
- export default SkipLink
118
+ export default SkipLink;
119
+ //# sourceMappingURL=components/skip-link/skip-link.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"skip-link.mjs","sources":["../../../../src/govuk/components/skip-link/skip-link.mjs"],"sourcesContent":["/* eslint-disable es-x/no-function-prototype-bind -- Polyfill imported */\n\nimport '../../vendor/polyfills/Element/prototype/classList.mjs'\nimport '../../vendor/polyfills/Event.mjs' // addEventListener, event.target normalization and DOMContentLoaded\nimport '../../vendor/polyfills/Function/prototype/bind.mjs'\n\n/**\n * Skip link component\n *\n * @class\n * @param {Element} $module - HTML element to use for skip link\n */\nfunction SkipLink ($module) {\n if (!($module instanceof HTMLAnchorElement)) {\n return this\n }\n\n /** @deprecated Will be made private in v5.0 */\n this.$module = $module\n\n /** @deprecated Will be made private in v5.0 */\n this.$linkedElement = null\n\n /** @deprecated Will be made private in v5.0 */\n this.linkedElementListener = false\n}\n\n/**\n * Initialise component\n */\nSkipLink.prototype.init = function () {\n // Check that required elements are present\n if (!this.$module) {\n return\n }\n\n // Check for linked element\n var $linkedElement = this.getLinkedElement()\n if (!$linkedElement) {\n return\n }\n\n this.$linkedElement = $linkedElement\n this.$module.addEventListener('click', this.focusLinkedElement.bind(this))\n}\n\n/**\n * Get linked element\n *\n * @deprecated Will be made private in v5.0\n * @returns {HTMLElement | null} $linkedElement - DOM element linked to from the skip link\n */\nSkipLink.prototype.getLinkedElement = function () {\n var linkedElementId = this.getFragmentFromUrl()\n if (!linkedElementId) {\n return null\n }\n\n return document.getElementById(linkedElementId)\n}\n\n/**\n * Focus the linked element\n *\n * Set tabindex and helper CSS class. Set listener to remove them on blur.\n *\n * @deprecated Will be made private in v5.0\n */\nSkipLink.prototype.focusLinkedElement = function () {\n var $linkedElement = this.$linkedElement\n\n if (!$linkedElement.getAttribute('tabindex')) {\n // Set the element tabindex to -1 so it can be focused with JavaScript.\n $linkedElement.setAttribute('tabindex', '-1')\n $linkedElement.classList.add('govuk-skip-link-focused-element')\n\n // Add listener for blur on the focused element (unless the listener has previously been added)\n if (!this.linkedElementListener) {\n this.$linkedElement.addEventListener('blur', this.removeFocusProperties.bind(this))\n this.linkedElementListener = true\n }\n }\n\n $linkedElement.focus()\n}\n\n/**\n * Remove the tabindex that makes the linked element focusable because the element only needs to be\n * focusable until it has received programmatic focus and a screen reader has announced it.\n *\n * Remove the CSS class that removes the native focus styles.\n *\n * @deprecated Will be made private in v5.0\n */\nSkipLink.prototype.removeFocusProperties = function () {\n this.$linkedElement.removeAttribute('tabindex')\n this.$linkedElement.classList.remove('govuk-skip-link-focused-element')\n}\n\n/**\n * Get fragment from URL\n *\n * Extract the fragment (everything after the hash symbol) from a URL, but not including\n * the symbol.\n *\n * @deprecated Will be made private in v5.0\n * @returns {string | undefined} Fragment from URL, without the hash symbol\n */\nSkipLink.prototype.getFragmentFromUrl = function () {\n // Bail if the anchor link doesn't have a hash\n if (!this.$module.hash) {\n return\n }\n\n return this.$module.hash.split('#').pop()\n}\n\nexport default SkipLink\n"],"names":[],"mappings":";;;;AAAA;AACA,AAIA;;;;;;;AAOA,SAAS,QAAQ,EAAE,OAAO,EAAE;EAC1B,IAAI,EAAE,OAAO,YAAY,iBAAiB,CAAC,EAAE;IAC3C,OAAO,IAAI;GACZ;;;EAGD,IAAI,CAAC,OAAO,GAAG,QAAO;;;EAGtB,IAAI,CAAC,cAAc,GAAG,KAAI;;;EAG1B,IAAI,CAAC,qBAAqB,GAAG,MAAK;CACnC;;;;;AAKD,QAAQ,CAAC,SAAS,CAAC,IAAI,GAAG,YAAY;;EAEpC,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE;IACjB,MAAM;GACP;;;EAGD,IAAI,cAAc,GAAG,IAAI,CAAC,gBAAgB,GAAE;EAC5C,IAAI,CAAC,cAAc,EAAE;IACnB,MAAM;GACP;;EAED,IAAI,CAAC,cAAc,GAAG,eAAc;EACpC,IAAI,CAAC,OAAO,CAAC,gBAAgB,CAAC,OAAO,EAAE,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,IAAI,CAAC,EAAC;EAC3E;;;;;;;;AAQD,QAAQ,CAAC,SAAS,CAAC,gBAAgB,GAAG,YAAY;EAChD,IAAI,eAAe,GAAG,IAAI,CAAC,kBAAkB,GAAE;EAC/C,IAAI,CAAC,eAAe,EAAE;IACpB,OAAO,IAAI;GACZ;;EAED,OAAO,QAAQ,CAAC,cAAc,CAAC,eAAe,CAAC;EAChD;;;;;;;;;AASD,QAAQ,CAAC,SAAS,CAAC,kBAAkB,GAAG,YAAY;EAClD,IAAI,cAAc,GAAG,IAAI,CAAC,eAAc;;EAExC,IAAI,CAAC,cAAc,CAAC,YAAY,CAAC,UAAU,CAAC,EAAE;;IAE5C,cAAc,CAAC,YAAY,CAAC,UAAU,EAAE,IAAI,EAAC;IAC7C,cAAc,CAAC,SAAS,CAAC,GAAG,CAAC,iCAAiC,EAAC;;;IAG/D,IAAI,CAAC,IAAI,CAAC,qBAAqB,EAAE;MAC/B,IAAI,CAAC,cAAc,CAAC,gBAAgB,CAAC,MAAM,EAAE,IAAI,CAAC,qBAAqB,CAAC,IAAI,CAAC,IAAI,CAAC,EAAC;MACnF,IAAI,CAAC,qBAAqB,GAAG,KAAI;KAClC;GACF;;EAED,cAAc,CAAC,KAAK,GAAE;EACvB;;;;;;;;;;AAUD,QAAQ,CAAC,SAAS,CAAC,qBAAqB,GAAG,YAAY;EACrD,IAAI,CAAC,cAAc,CAAC,eAAe,CAAC,UAAU,EAAC;EAC/C,IAAI,CAAC,cAAc,CAAC,SAAS,CAAC,MAAM,CAAC,iCAAiC,EAAC;EACxE;;;;;;;;;;;AAWD,QAAQ,CAAC,SAAS,CAAC,kBAAkB,GAAG,YAAY;;EAElD,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE;IACtB,MAAM;GACP;;EAED,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE;CAC1C;;;;"}