defra_ruby_template 5.4.1 → 5.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (427) hide show
  1. checksums.yaml +4 -4
  2. data/app/views/layouts/defra_ruby_template.html.erb +39 -18
  3. data/lib/defra_ruby_template/version.rb +1 -1
  4. data/node_modules/govuk-frontend/dist/govuk/all.bundle.js +882 -492
  5. data/node_modules/govuk-frontend/dist/govuk/all.bundle.js.map +1 -1
  6. data/node_modules/govuk-frontend/dist/govuk/all.bundle.mjs +877 -492
  7. data/node_modules/govuk-frontend/dist/govuk/all.bundle.mjs.map +1 -1
  8. data/node_modules/govuk-frontend/dist/govuk/all.mjs +5 -0
  9. data/node_modules/govuk-frontend/dist/govuk/all.mjs.map +1 -1
  10. data/node_modules/govuk-frontend/dist/govuk/all.scss +6 -0
  11. data/node_modules/govuk-frontend/dist/govuk/all.scss.map +1 -1
  12. data/node_modules/govuk-frontend/dist/govuk/assets/images/govuk-crest.svg +1 -0
  13. data/node_modules/govuk-frontend/dist/govuk/assets/rebrand/images/favicon.ico +0 -0
  14. data/node_modules/govuk-frontend/dist/govuk/assets/rebrand/images/favicon.svg +1 -0
  15. data/node_modules/govuk-frontend/dist/govuk/assets/rebrand/images/govuk-crest.svg +1 -0
  16. data/node_modules/govuk-frontend/dist/govuk/assets/rebrand/images/govuk-icon-180.png +0 -0
  17. data/node_modules/govuk-frontend/dist/govuk/assets/rebrand/images/govuk-icon-192.png +0 -0
  18. data/node_modules/govuk-frontend/dist/govuk/assets/rebrand/images/govuk-icon-512.png +0 -0
  19. data/node_modules/govuk-frontend/dist/govuk/assets/rebrand/images/govuk-icon-mask.svg +1 -0
  20. data/node_modules/govuk-frontend/dist/govuk/assets/rebrand/images/govuk-opengraph-image.png +0 -0
  21. data/node_modules/govuk-frontend/dist/govuk/assets/rebrand/manifest.json +39 -0
  22. data/node_modules/govuk-frontend/dist/govuk/common/closest-attribute-value.mjs.map +1 -1
  23. data/node_modules/govuk-frontend/dist/govuk/common/configuration.mjs +169 -0
  24. data/node_modules/govuk-frontend/dist/govuk/common/configuration.mjs.map +1 -0
  25. data/node_modules/govuk-frontend/dist/govuk/common/govuk-frontend-version.mjs +1 -1
  26. data/node_modules/govuk-frontend/dist/govuk/common/index.mjs +20 -83
  27. data/node_modules/govuk-frontend/dist/govuk/common/index.mjs.map +1 -1
  28. data/node_modules/govuk-frontend/dist/govuk/component.mjs +60 -0
  29. data/node_modules/govuk-frontend/dist/govuk/component.mjs.map +1 -0
  30. data/node_modules/govuk-frontend/dist/govuk/components/_index.scss +1 -0
  31. data/node_modules/govuk-frontend/dist/govuk/components/_index.scss.map +1 -1
  32. data/node_modules/govuk-frontend/dist/govuk/components/accordion/_index.scss +35 -31
  33. data/node_modules/govuk-frontend/dist/govuk/components/accordion/_index.scss.map +1 -1
  34. data/node_modules/govuk-frontend/dist/govuk/components/accordion/accordion.bundle.js +296 -195
  35. data/node_modules/govuk-frontend/dist/govuk/components/accordion/accordion.bundle.js.map +1 -1
  36. data/node_modules/govuk-frontend/dist/govuk/components/accordion/accordion.bundle.mjs +295 -194
  37. data/node_modules/govuk-frontend/dist/govuk/components/accordion/accordion.bundle.mjs.map +1 -1
  38. data/node_modules/govuk-frontend/dist/govuk/components/accordion/accordion.mjs +88 -110
  39. data/node_modules/govuk-frontend/dist/govuk/components/accordion/accordion.mjs.map +1 -1
  40. data/node_modules/govuk-frontend/dist/govuk/components/accordion/fixtures.json +16 -3
  41. data/node_modules/govuk-frontend/dist/govuk/components/back-link/fixtures.json +25 -15
  42. data/node_modules/govuk-frontend/dist/govuk/components/back-link/template-with-custom-link.html +1 -0
  43. data/node_modules/govuk-frontend/dist/govuk/components/back-link/template.njk +2 -2
  44. data/node_modules/govuk-frontend/dist/govuk/components/breadcrumbs/fixtures.json +53 -15
  45. data/node_modules/govuk-frontend/dist/govuk/components/breadcrumbs/macro-options.json +6 -0
  46. data/node_modules/govuk-frontend/dist/govuk/components/breadcrumbs/template-default.html +2 -2
  47. data/node_modules/govuk-frontend/dist/govuk/components/breadcrumbs/template-inverse.html +2 -2
  48. data/node_modules/govuk-frontend/dist/govuk/components/breadcrumbs/template-with-collapse-on-mobile.html +2 -2
  49. data/node_modules/govuk-frontend/dist/govuk/components/breadcrumbs/template-with-last-breadcrumb-as-current-page.html +2 -2
  50. data/node_modules/govuk-frontend/dist/govuk/components/breadcrumbs/template-with-multiple-levels.html +2 -2
  51. data/node_modules/govuk-frontend/dist/govuk/components/breadcrumbs/template-with-one-level.html +2 -2
  52. data/node_modules/govuk-frontend/dist/govuk/components/breadcrumbs/template-without-the-home-section.html +2 -2
  53. data/node_modules/govuk-frontend/dist/govuk/components/breadcrumbs/template.njk +2 -2
  54. data/node_modules/govuk-frontend/dist/govuk/components/button/button.bundle.js +217 -106
  55. data/node_modules/govuk-frontend/dist/govuk/components/button/button.bundle.js.map +1 -1
  56. data/node_modules/govuk-frontend/dist/govuk/components/button/button.bundle.mjs +216 -105
  57. data/node_modules/govuk-frontend/dist/govuk/components/button/button.bundle.mjs.map +1 -1
  58. data/node_modules/govuk-frontend/dist/govuk/components/button/button.mjs +9 -22
  59. data/node_modules/govuk-frontend/dist/govuk/components/button/button.mjs.map +1 -1
  60. data/node_modules/govuk-frontend/dist/govuk/components/button/fixtures.json +38 -0
  61. data/node_modules/govuk-frontend/dist/govuk/components/button/macro-options.json +2 -1
  62. data/node_modules/govuk-frontend/dist/govuk/components/character-count/_index.scss +12 -4
  63. data/node_modules/govuk-frontend/dist/govuk/components/character-count/_index.scss.map +1 -1
  64. data/node_modules/govuk-frontend/dist/govuk/components/character-count/character-count.bundle.js +256 -145
  65. data/node_modules/govuk-frontend/dist/govuk/components/character-count/character-count.bundle.js.map +1 -1
  66. data/node_modules/govuk-frontend/dist/govuk/components/character-count/character-count.bundle.mjs +255 -144
  67. data/node_modules/govuk-frontend/dist/govuk/components/character-count/character-count.bundle.mjs.map +1 -1
  68. data/node_modules/govuk-frontend/dist/govuk/components/character-count/character-count.mjs +29 -34
  69. data/node_modules/govuk-frontend/dist/govuk/components/character-count/character-count.mjs.map +1 -1
  70. data/node_modules/govuk-frontend/dist/govuk/components/character-count/fixtures.json +80 -1
  71. data/node_modules/govuk-frontend/dist/govuk/components/character-count/macro-options.json +6 -6
  72. data/node_modules/govuk-frontend/dist/govuk/components/character-count/template-with-error.html +12 -0
  73. data/node_modules/govuk-frontend/dist/govuk/components/character-count/template-with-hint-and-error.html +15 -0
  74. data/node_modules/govuk-frontend/dist/govuk/components/character-count/template.njk +5 -4
  75. data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/_index.scss +6 -1
  76. data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/_index.scss.map +1 -1
  77. data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/checkboxes.bundle.js +96 -50
  78. data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/checkboxes.bundle.js.map +1 -1
  79. data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/checkboxes.bundle.mjs +95 -49
  80. data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/checkboxes.bundle.mjs.map +1 -1
  81. data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/checkboxes.mjs +9 -18
  82. data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/checkboxes.mjs.map +1 -1
  83. data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/fixtures.json +88 -1
  84. data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/template-small-with-divider-and-none.html +34 -0
  85. data/node_modules/govuk-frontend/dist/govuk/components/cookie-banner/_index.scss +23 -14
  86. data/node_modules/govuk-frontend/dist/govuk/components/cookie-banner/_index.scss.map +1 -1
  87. data/node_modules/govuk-frontend/dist/govuk/components/cookie-banner/fixtures.json +23 -0
  88. data/node_modules/govuk-frontend/dist/govuk/components/date-input/_index.scss +2 -2
  89. data/node_modules/govuk-frontend/dist/govuk/components/date-input/_index.scss.map +1 -1
  90. data/node_modules/govuk-frontend/dist/govuk/components/date-input/fixtures.json +27 -0
  91. data/node_modules/govuk-frontend/dist/govuk/components/date-input/macro-options.json +2 -2
  92. data/node_modules/govuk-frontend/dist/govuk/components/details/_index.scss +7 -2
  93. data/node_modules/govuk-frontend/dist/govuk/components/details/_index.scss.map +1 -1
  94. data/node_modules/govuk-frontend/dist/govuk/components/details/fixtures.json +10 -0
  95. data/node_modules/govuk-frontend/dist/govuk/components/error-message/fixtures.json +9 -0
  96. data/node_modules/govuk-frontend/dist/govuk/components/error-summary/_index.scss +4 -0
  97. data/node_modules/govuk-frontend/dist/govuk/components/error-summary/_index.scss.map +1 -1
  98. data/node_modules/govuk-frontend/dist/govuk/components/error-summary/error-summary.bundle.js +238 -127
  99. data/node_modules/govuk-frontend/dist/govuk/components/error-summary/error-summary.bundle.js.map +1 -1
  100. data/node_modules/govuk-frontend/dist/govuk/components/error-summary/error-summary.bundle.mjs +237 -126
  101. data/node_modules/govuk-frontend/dist/govuk/components/error-summary/error-summary.bundle.mjs.map +1 -1
  102. data/node_modules/govuk-frontend/dist/govuk/components/error-summary/error-summary.mjs +10 -22
  103. data/node_modules/govuk-frontend/dist/govuk/components/error-summary/error-summary.mjs.map +1 -1
  104. data/node_modules/govuk-frontend/dist/govuk/components/error-summary/fixtures.json +19 -0
  105. data/node_modules/govuk-frontend/dist/govuk/components/exit-this-page/exit-this-page.bundle.js +218 -107
  106. data/node_modules/govuk-frontend/dist/govuk/components/exit-this-page/exit-this-page.bundle.js.map +1 -1
  107. data/node_modules/govuk-frontend/dist/govuk/components/exit-this-page/exit-this-page.bundle.mjs +217 -106
  108. data/node_modules/govuk-frontend/dist/govuk/components/exit-this-page/exit-this-page.bundle.mjs.map +1 -1
  109. data/node_modules/govuk-frontend/dist/govuk/components/exit-this-page/exit-this-page.mjs +10 -22
  110. data/node_modules/govuk-frontend/dist/govuk/components/exit-this-page/exit-this-page.mjs.map +1 -1
  111. data/node_modules/govuk-frontend/dist/govuk/components/exit-this-page/fixtures.json +4 -0
  112. data/node_modules/govuk-frontend/dist/govuk/components/fieldset/_index.scss +3 -5
  113. data/node_modules/govuk-frontend/dist/govuk/components/fieldset/_index.scss.map +1 -1
  114. data/node_modules/govuk-frontend/dist/govuk/components/fieldset/fixtures.json +18 -0
  115. data/node_modules/govuk-frontend/dist/govuk/components/file-upload/_index.scss +175 -9
  116. data/node_modules/govuk-frontend/dist/govuk/components/file-upload/_index.scss.map +1 -1
  117. data/node_modules/govuk-frontend/dist/govuk/components/file-upload/file-upload.bundle.js +744 -0
  118. data/node_modules/govuk-frontend/dist/govuk/components/file-upload/file-upload.bundle.js.map +1 -0
  119. data/node_modules/govuk-frontend/dist/govuk/components/file-upload/file-upload.bundle.mjs +736 -0
  120. data/node_modules/govuk-frontend/dist/govuk/components/file-upload/file-upload.bundle.mjs.map +1 -0
  121. data/node_modules/govuk-frontend/dist/govuk/components/file-upload/file-upload.mjs +257 -0
  122. data/node_modules/govuk-frontend/dist/govuk/components/file-upload/file-upload.mjs.map +1 -0
  123. data/node_modules/govuk-frontend/dist/govuk/components/file-upload/fixtures.json +220 -16
  124. data/node_modules/govuk-frontend/dist/govuk/components/file-upload/macro-options.json +52 -3
  125. data/node_modules/govuk-frontend/dist/govuk/components/file-upload/template-allows-direct-media-capture.html +6 -0
  126. data/node_modules/govuk-frontend/dist/govuk/components/file-upload/template-allows-image-files-only.html +6 -0
  127. data/node_modules/govuk-frontend/dist/govuk/components/file-upload/template-allows-multiple-files.html +6 -0
  128. data/node_modules/govuk-frontend/dist/govuk/components/file-upload/template-disabled.html +6 -0
  129. data/node_modules/govuk-frontend/dist/govuk/components/file-upload/template-enhanced-disabled.html +13 -0
  130. data/node_modules/govuk-frontend/dist/govuk/components/file-upload/template-enhanced-with-error-message-and-hint.html +16 -0
  131. data/node_modules/govuk-frontend/dist/govuk/components/file-upload/template-enhanced.html +10 -0
  132. data/node_modules/govuk-frontend/dist/govuk/components/file-upload/template-translated.html +10 -0
  133. data/node_modules/govuk-frontend/dist/govuk/components/file-upload/template.njk +42 -5
  134. data/node_modules/govuk-frontend/dist/govuk/components/footer/_index.scss +61 -19
  135. data/node_modules/govuk-frontend/dist/govuk/components/footer/_index.scss.map +1 -1
  136. data/node_modules/govuk-frontend/dist/govuk/components/footer/fixtures.json +34 -0
  137. data/node_modules/govuk-frontend/dist/govuk/components/footer/macro-options.json +6 -0
  138. data/node_modules/govuk-frontend/dist/govuk/components/footer/template.njk +10 -0
  139. data/node_modules/govuk-frontend/dist/govuk/components/header/_index.scss +223 -21
  140. data/node_modules/govuk-frontend/dist/govuk/components/header/_index.scss.map +1 -1
  141. data/node_modules/govuk-frontend/dist/govuk/components/header/fixtures.json +78 -32
  142. data/node_modules/govuk-frontend/dist/govuk/components/header/header.bundle.js +90 -43
  143. data/node_modules/govuk-frontend/dist/govuk/components/header/header.bundle.js.map +1 -1
  144. data/node_modules/govuk-frontend/dist/govuk/components/header/header.bundle.mjs +89 -42
  145. data/node_modules/govuk-frontend/dist/govuk/components/header/header.bundle.mjs.map +1 -1
  146. data/node_modules/govuk-frontend/dist/govuk/components/header/header.mjs +10 -18
  147. data/node_modules/govuk-frontend/dist/govuk/components/header/header.mjs.map +1 -1
  148. data/node_modules/govuk-frontend/dist/govuk/components/header/macro-options.json +31 -12
  149. data/node_modules/govuk-frontend/dist/govuk/components/header/template-default.html +20 -12
  150. data/node_modules/govuk-frontend/dist/govuk/components/header/template-full-width-with-navigation.html +21 -15
  151. data/node_modules/govuk-frontend/dist/govuk/components/header/template-full-width.html +21 -15
  152. data/node_modules/govuk-frontend/dist/govuk/components/header/template-navigation-item-with-html.html +20 -12
  153. data/node_modules/govuk-frontend/dist/govuk/components/header/template-navigation-item-with-text-without-link.html +20 -12
  154. data/node_modules/govuk-frontend/dist/govuk/components/header/template-with-custom-menu-button-label.html +20 -12
  155. data/node_modules/govuk-frontend/dist/govuk/components/header/template-with-custom-menu-button-text.html +20 -12
  156. data/node_modules/govuk-frontend/dist/govuk/components/header/template-with-custom-navigation-label.html +20 -12
  157. data/node_modules/govuk-frontend/dist/govuk/components/header/template-with-full-width-border.html +30 -0
  158. data/node_modules/govuk-frontend/dist/govuk/components/header/template-with-large-navigation.html +20 -12
  159. data/node_modules/govuk-frontend/dist/govuk/components/header/template-with-navigation.html +20 -12
  160. data/node_modules/govuk-frontend/dist/govuk/components/header/template-with-product-name.html +21 -15
  161. data/node_modules/govuk-frontend/dist/govuk/components/header/template-with-service-name-and-navigation.html +20 -12
  162. data/node_modules/govuk-frontend/dist/govuk/components/header/template-with-service-name-but-no-service-url.html +20 -12
  163. data/node_modules/govuk-frontend/dist/govuk/components/header/template-with-service-name.html +20 -12
  164. data/node_modules/govuk-frontend/dist/govuk/components/header/template-with-st-edwards-crown.html +10 -12
  165. data/node_modules/govuk-frontend/dist/govuk/components/header/template.njk +11 -41
  166. data/node_modules/govuk-frontend/dist/govuk/components/hint/fixtures.json +6 -0
  167. data/node_modules/govuk-frontend/dist/govuk/components/input/_index.scss +7 -4
  168. data/node_modules/govuk-frontend/dist/govuk/components/input/_index.scss.map +1 -1
  169. data/node_modules/govuk-frontend/dist/govuk/components/input/fixtures.json +97 -27
  170. data/node_modules/govuk-frontend/dist/govuk/components/input/macro-options.json +6 -6
  171. data/node_modules/govuk-frontend/dist/govuk/components/input/template-default.html +2 -2
  172. data/node_modules/govuk-frontend/dist/govuk/components/input/template-disabled.html +6 -0
  173. data/node_modules/govuk-frontend/dist/govuk/components/input/template-with-error-and-hint.html +12 -0
  174. data/node_modules/govuk-frontend/dist/govuk/components/input/template-with-error-message.html +2 -5
  175. data/node_modules/govuk-frontend/dist/govuk/components/input/template.njk +5 -4
  176. data/node_modules/govuk-frontend/dist/govuk/components/inset-text/fixtures.json +6 -0
  177. data/node_modules/govuk-frontend/dist/govuk/components/label/fixtures.json +17 -0
  178. data/node_modules/govuk-frontend/dist/govuk/components/notification-banner/_index.scss +3 -2
  179. data/node_modules/govuk-frontend/dist/govuk/components/notification-banner/_index.scss.map +1 -1
  180. data/node_modules/govuk-frontend/dist/govuk/components/notification-banner/fixtures.json +24 -0
  181. data/node_modules/govuk-frontend/dist/govuk/components/notification-banner/notification-banner.bundle.js +238 -127
  182. data/node_modules/govuk-frontend/dist/govuk/components/notification-banner/notification-banner.bundle.js.map +1 -1
  183. data/node_modules/govuk-frontend/dist/govuk/components/notification-banner/notification-banner.bundle.mjs +237 -126
  184. data/node_modules/govuk-frontend/dist/govuk/components/notification-banner/notification-banner.bundle.mjs.map +1 -1
  185. data/node_modules/govuk-frontend/dist/govuk/components/notification-banner/notification-banner.mjs +10 -22
  186. data/node_modules/govuk-frontend/dist/govuk/components/notification-banner/notification-banner.mjs.map +1 -1
  187. data/node_modules/govuk-frontend/dist/govuk/components/pagination/_index.scss +24 -37
  188. data/node_modules/govuk-frontend/dist/govuk/components/pagination/_index.scss.map +1 -1
  189. data/node_modules/govuk-frontend/dist/govuk/components/pagination/fixtures.json +15 -0
  190. data/node_modules/govuk-frontend/dist/govuk/components/pagination/macro-options.json +4 -4
  191. data/node_modules/govuk-frontend/dist/govuk/components/panel/_index.scss +13 -9
  192. data/node_modules/govuk-frontend/dist/govuk/components/panel/_index.scss.map +1 -1
  193. data/node_modules/govuk-frontend/dist/govuk/components/panel/fixtures.json +9 -0
  194. data/node_modules/govuk-frontend/dist/govuk/components/password-input/_index.scss +12 -9
  195. data/node_modules/govuk-frontend/dist/govuk/components/password-input/_index.scss.map +1 -1
  196. data/node_modules/govuk-frontend/dist/govuk/components/password-input/fixtures.json +27 -2
  197. data/node_modules/govuk-frontend/dist/govuk/components/password-input/macro-options.json +3 -3
  198. data/node_modules/govuk-frontend/dist/govuk/components/password-input/password-input.bundle.js +220 -110
  199. data/node_modules/govuk-frontend/dist/govuk/components/password-input/password-input.bundle.js.map +1 -1
  200. data/node_modules/govuk-frontend/dist/govuk/components/password-input/password-input.bundle.mjs +219 -109
  201. data/node_modules/govuk-frontend/dist/govuk/components/password-input/password-input.bundle.mjs.map +1 -1
  202. data/node_modules/govuk-frontend/dist/govuk/components/password-input/password-input.mjs +12 -25
  203. data/node_modules/govuk-frontend/dist/govuk/components/password-input/password-input.mjs.map +1 -1
  204. data/node_modules/govuk-frontend/dist/govuk/components/password-input/template-default.html +3 -3
  205. data/node_modules/govuk-frontend/dist/govuk/components/password-input/template.njk +4 -2
  206. data/node_modules/govuk-frontend/dist/govuk/components/phase-banner/_index.scss +0 -8
  207. data/node_modules/govuk-frontend/dist/govuk/components/phase-banner/_index.scss.map +1 -1
  208. data/node_modules/govuk-frontend/dist/govuk/components/phase-banner/fixtures.json +7 -0
  209. data/node_modules/govuk-frontend/dist/govuk/components/radios/_index.scss +7 -5
  210. data/node_modules/govuk-frontend/dist/govuk/components/radios/_index.scss.map +1 -1
  211. data/node_modules/govuk-frontend/dist/govuk/components/radios/fixtures.json +51 -5
  212. data/node_modules/govuk-frontend/dist/govuk/components/radios/radios.bundle.js +96 -50
  213. data/node_modules/govuk-frontend/dist/govuk/components/radios/radios.bundle.js.map +1 -1
  214. data/node_modules/govuk-frontend/dist/govuk/components/radios/radios.bundle.mjs +95 -49
  215. data/node_modules/govuk-frontend/dist/govuk/components/radios/radios.bundle.mjs.map +1 -1
  216. data/node_modules/govuk-frontend/dist/govuk/components/radios/radios.mjs +9 -18
  217. data/node_modules/govuk-frontend/dist/govuk/components/radios/radios.mjs.map +1 -1
  218. data/node_modules/govuk-frontend/dist/govuk/components/radios/template-small-with-a-divider.html +1 -1
  219. data/node_modules/govuk-frontend/dist/govuk/components/radios/template-with-a-divider.html +1 -1
  220. data/node_modules/govuk-frontend/dist/govuk/components/select/_index.scss +5 -5
  221. data/node_modules/govuk-frontend/dist/govuk/components/select/_index.scss.map +1 -1
  222. data/node_modules/govuk-frontend/dist/govuk/components/select/fixtures.json +43 -9
  223. data/node_modules/govuk-frontend/dist/govuk/components/select/macro-options.json +2 -2
  224. data/node_modules/govuk-frontend/dist/govuk/components/select/template-id.html +7 -0
  225. data/node_modules/govuk-frontend/dist/govuk/components/select/template.njk +6 -4
  226. data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/README.md +15 -0
  227. data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/_index.scss +187 -0
  228. data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/_index.scss.map +1 -0
  229. data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/_service-navigation.scss +4 -0
  230. data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/_service-navigation.scss.map +1 -0
  231. data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/fixtures.json +515 -0
  232. data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/macro-options.json +138 -0
  233. data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/macro.njk +3 -0
  234. data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/service-navigation.bundle.js +229 -0
  235. data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/service-navigation.bundle.js.map +1 -0
  236. data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/service-navigation.bundle.mjs +221 -0
  237. data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/service-navigation.bundle.mjs.map +1 -0
  238. data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/service-navigation.mjs +85 -0
  239. data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/service-navigation.mjs.map +1 -0
  240. data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/template-default.html +57 -0
  241. data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/template-with-html-navigation-items.html +49 -0
  242. data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/template-with-large-navigation.html +153 -0
  243. data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/template-with-long-service-name.html +20 -0
  244. data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/template-with-navigation-with-a-current-item.html +58 -0
  245. data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/template-with-navigation-with-an-active-item.html +58 -0
  246. data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/template-with-non-link-navigation-items.html +49 -0
  247. data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/template-with-service-link.html +20 -0
  248. data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/template-with-service-name-and-navigation.html +63 -0
  249. data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/template-with-service-name.html +18 -0
  250. data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/template.njk +103 -0
  251. data/node_modules/govuk-frontend/dist/govuk/components/skip-link/_index.scss +6 -4
  252. data/node_modules/govuk-frontend/dist/govuk/components/skip-link/_index.scss.map +1 -1
  253. data/node_modules/govuk-frontend/dist/govuk/components/skip-link/fixtures.json +9 -0
  254. data/node_modules/govuk-frontend/dist/govuk/components/skip-link/skip-link.bundle.js +95 -48
  255. data/node_modules/govuk-frontend/dist/govuk/components/skip-link/skip-link.bundle.js.map +1 -1
  256. data/node_modules/govuk-frontend/dist/govuk/components/skip-link/skip-link.bundle.mjs +94 -47
  257. data/node_modules/govuk-frontend/dist/govuk/components/skip-link/skip-link.bundle.mjs.map +1 -1
  258. data/node_modules/govuk-frontend/dist/govuk/components/skip-link/skip-link.mjs +15 -23
  259. data/node_modules/govuk-frontend/dist/govuk/components/skip-link/skip-link.mjs.map +1 -1
  260. data/node_modules/govuk-frontend/dist/govuk/components/summary-list/_index.scss +14 -22
  261. data/node_modules/govuk-frontend/dist/govuk/components/summary-list/_index.scss.map +1 -1
  262. data/node_modules/govuk-frontend/dist/govuk/components/summary-list/fixtures.json +174 -1
  263. data/node_modules/govuk-frontend/dist/govuk/components/summary-list/template-as-a-summary-card-extreme.html +106 -0
  264. data/node_modules/govuk-frontend/dist/govuk/components/table/fixtures.json +22 -1
  265. data/node_modules/govuk-frontend/dist/govuk/components/tabs/fixtures.json +15 -1
  266. data/node_modules/govuk-frontend/dist/govuk/components/tabs/tabs.bundle.js +95 -53
  267. data/node_modules/govuk-frontend/dist/govuk/components/tabs/tabs.bundle.js.map +1 -1
  268. data/node_modules/govuk-frontend/dist/govuk/components/tabs/tabs.bundle.mjs +94 -52
  269. data/node_modules/govuk-frontend/dist/govuk/components/tabs/tabs.bundle.mjs.map +1 -1
  270. data/node_modules/govuk-frontend/dist/govuk/components/tabs/tabs.mjs +15 -28
  271. data/node_modules/govuk-frontend/dist/govuk/components/tabs/tabs.mjs.map +1 -1
  272. data/node_modules/govuk-frontend/dist/govuk/components/tag/_index.scss +11 -8
  273. data/node_modules/govuk-frontend/dist/govuk/components/tag/_index.scss.map +1 -1
  274. data/node_modules/govuk-frontend/dist/govuk/components/tag/fixtures.json +14 -0
  275. data/node_modules/govuk-frontend/dist/govuk/components/task-list/_index.scss +12 -10
  276. data/node_modules/govuk-frontend/dist/govuk/components/task-list/_index.scss.map +1 -1
  277. data/node_modules/govuk-frontend/dist/govuk/components/task-list/fixtures.json +44 -0
  278. data/node_modules/govuk-frontend/dist/govuk/components/task-list/template-with-empty-values.html +27 -0
  279. data/node_modules/govuk-frontend/dist/govuk/components/task-list/template.njk +1 -1
  280. data/node_modules/govuk-frontend/dist/govuk/components/textarea/_index.scss +3 -3
  281. data/node_modules/govuk-frontend/dist/govuk/components/textarea/_index.scss.map +1 -1
  282. data/node_modules/govuk-frontend/dist/govuk/components/textarea/fixtures.json +32 -1
  283. data/node_modules/govuk-frontend/dist/govuk/components/textarea/macro-options.json +3 -3
  284. data/node_modules/govuk-frontend/dist/govuk/components/textarea/template.njk +6 -4
  285. data/node_modules/govuk-frontend/dist/govuk/components/warning-text/_index.scss +6 -5
  286. data/node_modules/govuk-frontend/dist/govuk/components/warning-text/_index.scss.map +1 -1
  287. data/node_modules/govuk-frontend/dist/govuk/components/warning-text/fixtures.json +8 -0
  288. data/node_modules/govuk-frontend/dist/govuk/core/_govuk-frontend-properties.scss +1 -1
  289. data/node_modules/govuk-frontend/dist/govuk/core/_govuk-frontend-properties.scss.map +1 -1
  290. data/node_modules/govuk-frontend/dist/govuk/errors/index.mjs +16 -3
  291. data/node_modules/govuk-frontend/dist/govuk/errors/index.mjs.map +1 -1
  292. data/node_modules/govuk-frontend/dist/govuk/govuk-frontend.min.css +2 -2
  293. data/node_modules/govuk-frontend/dist/govuk/govuk-frontend.min.css.map +1 -1
  294. data/node_modules/govuk-frontend/dist/govuk/govuk-frontend.min.js +1 -1
  295. data/node_modules/govuk-frontend/dist/govuk/govuk-frontend.min.js.map +1 -1
  296. data/node_modules/govuk-frontend/dist/govuk/helpers/_colour.scss +55 -8
  297. data/node_modules/govuk-frontend/dist/govuk/helpers/_colour.scss.map +1 -1
  298. data/node_modules/govuk-frontend/dist/govuk/helpers/_focused.scss +14 -4
  299. data/node_modules/govuk-frontend/dist/govuk/helpers/_focused.scss.map +1 -1
  300. data/node_modules/govuk-frontend/dist/govuk/helpers/_grid.scss +1 -1
  301. data/node_modules/govuk-frontend/dist/govuk/helpers/_grid.scss.map +1 -1
  302. data/node_modules/govuk-frontend/dist/govuk/helpers/_links.scss +2 -2
  303. data/node_modules/govuk-frontend/dist/govuk/helpers/_links.scss.map +1 -1
  304. data/node_modules/govuk-frontend/dist/govuk/helpers/_shape-arrow.scss +1 -1
  305. data/node_modules/govuk-frontend/dist/govuk/helpers/_shape-arrow.scss.map +1 -1
  306. data/node_modules/govuk-frontend/dist/govuk/helpers/_typography.scss +18 -1
  307. data/node_modules/govuk-frontend/dist/govuk/helpers/_typography.scss.map +1 -1
  308. data/node_modules/govuk-frontend/dist/govuk/helpers/_visually-hidden.scss +30 -62
  309. data/node_modules/govuk-frontend/dist/govuk/helpers/_visually-hidden.scss.map +1 -1
  310. data/node_modules/govuk-frontend/dist/govuk/i18n.mjs.map +1 -1
  311. data/node_modules/govuk-frontend/dist/govuk/init.mjs +90 -24
  312. data/node_modules/govuk-frontend/dist/govuk/init.mjs.map +1 -1
  313. data/node_modules/govuk-frontend/dist/govuk/macros/logo.njk +78 -0
  314. data/node_modules/govuk-frontend/dist/govuk/objects/_template.scss +5 -1
  315. data/node_modules/govuk-frontend/dist/govuk/objects/_template.scss.map +1 -1
  316. data/node_modules/govuk-frontend/dist/govuk/overrides/_typography.scss +5 -1
  317. data/node_modules/govuk-frontend/dist/govuk/overrides/_typography.scss.map +1 -1
  318. data/node_modules/govuk-frontend/dist/govuk/settings/_colours-applied.scss +39 -1
  319. data/node_modules/govuk-frontend/dist/govuk/settings/_colours-applied.scss.map +1 -1
  320. data/node_modules/govuk-frontend/dist/govuk/settings/_colours-organisations.scss +244 -10
  321. data/node_modules/govuk-frontend/dist/govuk/settings/_colours-organisations.scss.map +1 -1
  322. data/node_modules/govuk-frontend/dist/govuk/settings/_typography-responsive.scss +5 -10
  323. data/node_modules/govuk-frontend/dist/govuk/settings/_typography-responsive.scss.map +1 -1
  324. data/node_modules/govuk-frontend/dist/govuk/template.njk +20 -9
  325. data/node_modules/govuk-frontend/dist/govuk/tools/_index.scss +1 -0
  326. data/node_modules/govuk-frontend/dist/govuk/tools/_index.scss.map +1 -1
  327. data/node_modules/govuk-frontend/dist/govuk/tools/_rebrand.scss +65 -0
  328. data/node_modules/govuk-frontend/dist/govuk/tools/_rebrand.scss.map +1 -0
  329. data/node_modules/govuk-frontend/dist/govuk-prototype-kit/functions.js +25 -0
  330. data/node_modules/govuk-frontend/dist/govuk-prototype-kit/init.scss +1 -1
  331. data/node_modules/govuk-frontend/dist/govuk-prototype-kit/init.scss.map +1 -1
  332. data/node_modules/govuk-frontend/govuk-prototype-kit.config.json +8 -1
  333. data/node_modules/govuk-frontend/package.json +16 -16
  334. data/spec/spec_helper.rb +98 -0
  335. data/spec/tasks/assets_spec.rb +53 -0
  336. data/vendor/assets/assets/fonts/bold-affa96571d-v2.woff +0 -0
  337. data/vendor/assets/assets/fonts/bold-b542beb274-v2.woff2 +0 -0
  338. data/vendor/assets/assets/fonts/light-94a07e06a1-v2.woff2 +0 -0
  339. data/vendor/assets/assets/fonts/light-f591b13f7d-v2.woff +0 -0
  340. data/vendor/assets/assets/images/favicon.ico +0 -0
  341. data/vendor/assets/assets/images/favicon.svg +1 -0
  342. data/vendor/assets/assets/images/govuk-crest.svg +1 -0
  343. data/vendor/assets/assets/images/govuk-icon-180.png +0 -0
  344. data/vendor/assets/assets/images/govuk-icon-192.png +0 -0
  345. data/vendor/assets/assets/images/govuk-icon-512.png +0 -0
  346. data/vendor/assets/assets/images/govuk-icon-mask.svg +1 -0
  347. data/vendor/assets/assets/images/govuk-opengraph-image.png +0 -0
  348. data/vendor/assets/assets/manifest.json +39 -0
  349. data/vendor/assets/assets/rebrand/images/favicon.ico +0 -0
  350. data/vendor/assets/assets/rebrand/images/favicon.svg +1 -0
  351. data/vendor/assets/assets/rebrand/images/govuk-crest.svg +1 -0
  352. data/vendor/assets/assets/rebrand/images/govuk-icon-180.png +0 -0
  353. data/vendor/assets/assets/rebrand/images/govuk-icon-192.png +0 -0
  354. data/vendor/assets/assets/rebrand/images/govuk-icon-512.png +0 -0
  355. data/vendor/assets/assets/rebrand/images/govuk-icon-mask.svg +1 -0
  356. data/vendor/assets/assets/rebrand/images/govuk-opengraph-image.png +0 -0
  357. data/vendor/assets/assets/rebrand/manifest.json +39 -0
  358. data/vendor/assets/images/govuk-crest.svg +1 -0
  359. data/vendor/assets/javascripts/defra_ruby_template.js +882 -492
  360. data/vendor/assets/stylesheets/all.scss +6 -0
  361. data/vendor/assets/stylesheets/components/_index.scss +1 -0
  362. data/vendor/assets/stylesheets/components/accordion/_index.scss +35 -31
  363. data/vendor/assets/stylesheets/components/character-count/_index.scss +12 -4
  364. data/vendor/assets/stylesheets/components/checkboxes/_index.scss +6 -1
  365. data/vendor/assets/stylesheets/components/cookie-banner/_index.scss +23 -14
  366. data/vendor/assets/stylesheets/components/date-input/_index.scss +2 -2
  367. data/vendor/assets/stylesheets/components/details/_index.scss +7 -2
  368. data/vendor/assets/stylesheets/components/error-summary/_index.scss +4 -0
  369. data/vendor/assets/stylesheets/components/fieldset/_index.scss +3 -5
  370. data/vendor/assets/stylesheets/components/file-upload/_index.scss +175 -9
  371. data/vendor/assets/stylesheets/components/footer/_index.scss +61 -19
  372. data/vendor/assets/stylesheets/components/header/_index.scss +223 -21
  373. data/vendor/assets/stylesheets/components/input/_index.scss +7 -4
  374. data/vendor/assets/stylesheets/components/notification-banner/_index.scss +3 -2
  375. data/vendor/assets/stylesheets/components/pagination/_index.scss +24 -37
  376. data/vendor/assets/stylesheets/components/panel/_index.scss +13 -9
  377. data/vendor/assets/stylesheets/components/password-input/_index.scss +12 -9
  378. data/vendor/assets/stylesheets/components/phase-banner/_index.scss +0 -8
  379. data/vendor/assets/stylesheets/components/radios/_index.scss +7 -5
  380. data/vendor/assets/stylesheets/components/select/_index.scss +5 -5
  381. data/vendor/assets/stylesheets/components/service-navigation/_index.scss +187 -0
  382. data/vendor/assets/stylesheets/components/service-navigation/_service-navigation.scss +4 -0
  383. data/vendor/assets/stylesheets/components/skip-link/_index.scss +6 -4
  384. data/vendor/assets/stylesheets/components/summary-list/_index.scss +14 -22
  385. data/vendor/assets/stylesheets/components/tag/_index.scss +11 -8
  386. data/vendor/assets/stylesheets/components/task-list/_index.scss +12 -10
  387. data/vendor/assets/stylesheets/components/textarea/_index.scss +3 -3
  388. data/vendor/assets/stylesheets/components/warning-text/_index.scss +6 -5
  389. data/vendor/assets/stylesheets/core/_govuk-frontend-properties.scss +1 -1
  390. data/vendor/assets/stylesheets/defra_ruby_template.scss +6 -0
  391. data/vendor/assets/stylesheets/govuk-frontend.min.css +2 -2
  392. data/vendor/assets/stylesheets/helpers/_colour.scss +55 -8
  393. data/vendor/assets/stylesheets/helpers/_focused.scss +14 -4
  394. data/vendor/assets/stylesheets/helpers/_grid.scss +1 -1
  395. data/vendor/assets/stylesheets/helpers/_links.scss +2 -2
  396. data/vendor/assets/stylesheets/helpers/_shape-arrow.scss +1 -1
  397. data/vendor/assets/stylesheets/helpers/_typography.scss +18 -1
  398. data/vendor/assets/stylesheets/helpers/_visually-hidden.scss +30 -62
  399. data/vendor/assets/stylesheets/objects/_template.scss +5 -1
  400. data/vendor/assets/stylesheets/overrides/_typography.scss +5 -1
  401. data/vendor/assets/stylesheets/settings/_colours-applied.scss +39 -1
  402. data/vendor/assets/stylesheets/settings/_colours-organisations.scss +244 -10
  403. data/vendor/assets/stylesheets/settings/_typography-responsive.scss +5 -10
  404. data/vendor/assets/stylesheets/tools/_index.scss +1 -0
  405. data/vendor/assets/stylesheets/tools/_rebrand.scss +65 -0
  406. metadata +100 -24
  407. data/.github/dependabot.yml +0 -14
  408. data/.github/workflows/ci.yml +0 -31
  409. data/.gitignore +0 -8
  410. data/.rspec +0 -1
  411. data/.rubocop.yml +0 -3
  412. data/.ruby-version +0 -1
  413. data/Gemfile +0 -9
  414. data/Gemfile.lock +0 -58
  415. data/defra_ruby_template.gemspec +0 -35
  416. data/node_modules/.package-lock.json +0 -16
  417. data/node_modules/govuk-frontend/dist/govuk/assets/images/govuk-crest-2x.png +0 -0
  418. data/node_modules/govuk-frontend/dist/govuk/assets/images/govuk-crest.png +0 -0
  419. data/node_modules/govuk-frontend/dist/govuk/common/normalise-dataset.mjs +0 -18
  420. data/node_modules/govuk-frontend/dist/govuk/common/normalise-dataset.mjs.map +0 -1
  421. data/node_modules/govuk-frontend/dist/govuk/common/normalise-string.mjs +0 -31
  422. data/node_modules/govuk-frontend/dist/govuk/common/normalise-string.mjs.map +0 -1
  423. data/node_modules/govuk-frontend/dist/govuk/components/file-upload/template-with-value.html +0 -6
  424. data/node_modules/govuk-frontend/dist/govuk/govuk-frontend-component.mjs +0 -16
  425. data/node_modules/govuk-frontend/dist/govuk/govuk-frontend-component.mjs.map +0 -1
  426. data/package-lock.json +0 -24
  427. data/package.json +0 -29
@@ -1 +1 @@
1
- {"version":3,"file":"i18n.mjs","sources":["../../src/govuk/i18n.mjs"],"sourcesContent":["/**\n * Internal support for selecting messages to render, with placeholder\n * interpolation and locale-aware number formatting and pluralisation\n *\n * @internal\n */\nexport class I18n {\n translations\n locale\n\n /**\n * @internal\n * @param {{ [key: string]: string | TranslationPluralForms }} translations - Key-value pairs of the translation strings to use.\n * @param {object} [config] - Configuration options for the function.\n * @param {string | null} [config.locale] - An overriding locale for the PluralRules functionality.\n */\n constructor(translations = {}, config = {}) {\n // Make list of translations available throughout function\n this.translations = translations\n\n // The locale to use for PluralRules and NumberFormat\n this.locale = config.locale ?? (document.documentElement.lang || 'en')\n }\n\n /**\n * The most used function - takes the key for a given piece of UI text and\n * returns the appropriate string.\n *\n * @internal\n * @param {string} lookupKey - The lookup key of the string to use.\n * @param {{ [key: string]: unknown }} [options] - Any options passed with the translation string, e.g: for string interpolation.\n * @returns {string} The appropriate translation string.\n * @throws {Error} Lookup key required\n * @throws {Error} Options required for `${}` placeholders\n */\n t(lookupKey, options) {\n if (!lookupKey) {\n // Print a console error if no lookup key has been provided\n throw new Error('i18n: lookup key missing')\n }\n\n // Fetch the translation for that lookup key\n let translation = this.translations[lookupKey]\n\n // If the `count` option is set, determine which plural suffix is needed and\n // change the lookupKey to match. We check to see if it's numeric instead of\n // falsy, as this could legitimately be 0.\n if (typeof options?.count === 'number' && typeof translation === 'object') {\n const translationPluralForm =\n translation[this.getPluralSuffix(lookupKey, options.count)]\n\n // Update translation with plural suffix\n if (translationPluralForm) {\n translation = translationPluralForm\n }\n }\n\n if (typeof translation === 'string') {\n // Check for ${} placeholders in the translation string\n if (translation.match(/%{(.\\S+)}/)) {\n if (!options) {\n throw new Error(\n 'i18n: cannot replace placeholders in string if no option data provided'\n )\n }\n\n return this.replacePlaceholders(translation, options)\n }\n\n return translation\n }\n\n // If the key wasn't found in our translations object,\n // return the lookup key itself as the fallback\n return lookupKey\n }\n\n /**\n * Takes a translation string with placeholders, and replaces the placeholders\n * with the provided data\n *\n * @internal\n * @param {string} translationString - The translation string\n * @param {{ [key: string]: unknown }} options - Any options passed with the translation string, e.g: for string interpolation.\n * @returns {string} The translation string to output, with $\\{\\} placeholders replaced\n */\n replacePlaceholders(translationString, options) {\n const formatter = Intl.NumberFormat.supportedLocalesOf(this.locale).length\n ? new Intl.NumberFormat(this.locale)\n : undefined\n\n return translationString.replace(\n /%{(.\\S+)}/g,\n\n /**\n * Replace translation string placeholders\n *\n * @internal\n * @param {string} placeholderWithBraces - Placeholder with braces\n * @param {string} placeholderKey - Placeholder key\n * @returns {string} Placeholder value\n */\n function (placeholderWithBraces, placeholderKey) {\n if (Object.prototype.hasOwnProperty.call(options, placeholderKey)) {\n const placeholderValue = options[placeholderKey]\n\n // If a user has passed `false` as the value for the placeholder\n // treat it as though the value should not be displayed\n if (\n placeholderValue === false ||\n (typeof placeholderValue !== 'number' &&\n typeof placeholderValue !== 'string')\n ) {\n return ''\n }\n\n // If the placeholder's value is a number, localise the number formatting\n if (typeof placeholderValue === 'number') {\n return formatter\n ? formatter.format(placeholderValue)\n : `${placeholderValue}`\n }\n\n return placeholderValue\n }\n\n throw new Error(\n `i18n: no data found to replace ${placeholderWithBraces} placeholder in string`\n )\n }\n )\n }\n\n /**\n * Check to see if the browser supports Intl.PluralRules\n *\n * It requires all conditions to be met in order to be supported:\n * - The implementation of Intl supports PluralRules (NOT true in Safari 10–12)\n * - The browser/OS has plural rules for the current locale (browser dependent)\n *\n * {@link https://browsersl.ist/#q=supports+es6-module+and+not+supports+intl-pluralrules}\n *\n * @internal\n * @returns {boolean} Returns true if all conditions are met. Returns false otherwise.\n */\n hasIntlPluralRulesSupport() {\n return Boolean(\n 'PluralRules' in window.Intl &&\n Intl.PluralRules.supportedLocalesOf(this.locale).length\n )\n }\n\n /**\n * Get the appropriate suffix for the plural form.\n *\n * Uses Intl.PluralRules (or our own fallback implementation) to get the\n * 'preferred' form to use for the given count.\n *\n * Checks that a translation has been provided for that plural form – if it\n * hasn't, it'll fall back to the 'other' plural form (unless that doesn't exist\n * either, in which case an error will be thrown)\n *\n * @internal\n * @param {string} lookupKey - The lookup key of the string to use.\n * @param {number} count - Number used to determine which pluralisation to use.\n * @returns {PluralRule} The suffix associated with the correct pluralisation for this locale.\n * @throws {Error} Plural form `.other` required when preferred plural form is missing\n */\n getPluralSuffix(lookupKey, count) {\n // Validate that the number is actually a number.\n //\n // Number(count) will turn anything that can't be converted to a Number type\n // into 'NaN'. isFinite filters out NaN, as it isn't a finite number.\n count = Number(count)\n if (!isFinite(count)) {\n return 'other'\n }\n\n // Fetch the translation for that lookup key\n const translation = this.translations[lookupKey]\n\n // Check to verify that all the requirements for Intl.PluralRules are met.\n // If so, we can use that instead of our custom implementation. Otherwise,\n // use the hardcoded fallback.\n const preferredForm = this.hasIntlPluralRulesSupport()\n ? new Intl.PluralRules(this.locale).select(count)\n : this.selectPluralFormUsingFallbackRules(count)\n\n // Use the correct plural form if provided\n if (typeof translation === 'object') {\n if (preferredForm in translation) {\n return preferredForm\n // Fall back to `other` if the plural form is missing, but log a warning\n // to the console\n } else if ('other' in translation) {\n console.warn(\n `i18n: Missing plural form \".${preferredForm}\" for \"${this.locale}\" locale. Falling back to \".other\".`\n )\n\n return 'other'\n }\n }\n\n // If the required `other` plural form is missing, all we can do is error\n throw new Error(\n `i18n: Plural form \".other\" is required for \"${this.locale}\" locale`\n )\n }\n\n /**\n * Get the plural form using our fallback implementation\n *\n * This is split out into a separate function to make it easier to test the\n * fallback behaviour in an environment where Intl.PluralRules exists.\n *\n * @internal\n * @param {number} count - Number used to determine which pluralisation to use.\n * @returns {PluralRule} The pluralisation form for count in this locale.\n */\n selectPluralFormUsingFallbackRules(count) {\n // Currently our custom code can only handle positive integers, so let's\n // make sure our number is one of those.\n count = Math.abs(Math.floor(count))\n\n const ruleset = this.getPluralRulesForLocale()\n\n if (ruleset) {\n return I18n.pluralRules[ruleset](count)\n }\n\n return 'other'\n }\n\n /**\n * Work out which pluralisation rules to use for the current locale\n *\n * The locale may include a regional indicator (such as en-GB), but we don't\n * usually care about this part, as pluralisation rules are usually the same\n * regardless of region. There are exceptions, however, (e.g. Portuguese) so\n * this searches by both the full and shortened locale codes, just to be sure.\n *\n * @internal\n * @returns {string | undefined} The name of the pluralisation rule to use (a key for one\n * of the functions in this.pluralRules)\n */\n getPluralRulesForLocale() {\n const localeShort = this.locale.split('-')[0]\n\n // Look through the plural rules map to find which `pluralRule` is\n // appropriate for our current `locale`.\n for (const pluralRule in I18n.pluralRulesMap) {\n const languages = I18n.pluralRulesMap[pluralRule]\n if (languages.includes(this.locale) || languages.includes(localeShort)) {\n return pluralRule\n }\n }\n }\n\n /**\n * Map of plural rules to languages where those rules apply.\n *\n * Note: These groups are named for the most dominant or recognisable language\n * that uses each system. The groupings do not imply that the languages are\n * related to one another. Many languages have evolved the same systems\n * independently of one another.\n *\n * Code to support more languages can be found in the i18n spike:\n * {@link https://github.com/alphagov/govuk-frontend/blob/spike-i18n-support/src/govuk/i18n.mjs}\n *\n * Languages currently supported:\n *\n * Arabic: Arabic (ar)\n * Chinese: Burmese (my), Chinese (zh), Indonesian (id), Japanese (ja),\n * Javanese (jv), Korean (ko), Malay (ms), Thai (th), Vietnamese (vi)\n * French: Armenian (hy), Bangla (bn), French (fr), Gujarati (gu), Hindi (hi),\n * Persian Farsi (fa), Punjabi (pa), Zulu (zu)\n * German: Afrikaans (af), Albanian (sq), Azerbaijani (az), Basque (eu),\n * Bulgarian (bg), Catalan (ca), Danish (da), Dutch (nl), English (en),\n * Estonian (et), Finnish (fi), Georgian (ka), German (de), Greek (el),\n * Hungarian (hu), Luxembourgish (lb), Norwegian (no), Somali (so),\n * Swahili (sw), Swedish (sv), Tamil (ta), Telugu (te), Turkish (tr),\n * Urdu (ur)\n * Irish: Irish Gaelic (ga)\n * Russian: Russian (ru), Ukrainian (uk)\n * Scottish: Scottish Gaelic (gd)\n * Spanish: European Portuguese (pt-PT), Italian (it), Spanish (es)\n * Welsh: Welsh (cy)\n *\n * @internal\n * @type {{ [key: string]: string[] }}\n */\n static pluralRulesMap = {\n arabic: ['ar'],\n chinese: ['my', 'zh', 'id', 'ja', 'jv', 'ko', 'ms', 'th', 'vi'],\n french: ['hy', 'bn', 'fr', 'gu', 'hi', 'fa', 'pa', 'zu'],\n german: [\n 'af',\n 'sq',\n 'az',\n 'eu',\n 'bg',\n 'ca',\n 'da',\n 'nl',\n 'en',\n 'et',\n 'fi',\n 'ka',\n 'de',\n 'el',\n 'hu',\n 'lb',\n 'no',\n 'so',\n 'sw',\n 'sv',\n 'ta',\n 'te',\n 'tr',\n 'ur'\n ],\n irish: ['ga'],\n russian: ['ru', 'uk'],\n scottish: ['gd'],\n spanish: ['pt-PT', 'it', 'es'],\n welsh: ['cy']\n }\n\n /**\n * Different pluralisation rule sets\n *\n * Returns the appropriate suffix for the plural form associated with `n`.\n * Possible suffixes: 'zero', 'one', 'two', 'few', 'many', 'other' (the actual\n * meaning of each differs per locale). 'other' should always exist, even in\n * languages without plurals, such as Chinese.\n * {@link https://cldr.unicode.org/index/cldr-spec/plural-rules}\n *\n * The count must be a positive integer. Negative numbers and decimals aren't accounted for\n *\n * @internal\n * @type {{ [key: string]: (count: number) => PluralRule }}\n */\n static pluralRules = {\n arabic(n) {\n if (n === 0) {\n return 'zero'\n }\n if (n === 1) {\n return 'one'\n }\n if (n === 2) {\n return 'two'\n }\n if (n % 100 >= 3 && n % 100 <= 10) {\n return 'few'\n }\n if (n % 100 >= 11 && n % 100 <= 99) {\n return 'many'\n }\n return 'other'\n },\n chinese() {\n return 'other'\n },\n french(n) {\n return n === 0 || n === 1 ? 'one' : 'other'\n },\n german(n) {\n return n === 1 ? 'one' : 'other'\n },\n irish(n) {\n if (n === 1) {\n return 'one'\n }\n if (n === 2) {\n return 'two'\n }\n if (n >= 3 && n <= 6) {\n return 'few'\n }\n if (n >= 7 && n <= 10) {\n return 'many'\n }\n return 'other'\n },\n russian(n) {\n const lastTwo = n % 100\n const last = lastTwo % 10\n if (last === 1 && lastTwo !== 11) {\n return 'one'\n }\n if (last >= 2 && last <= 4 && !(lastTwo >= 12 && lastTwo <= 14)) {\n return 'few'\n }\n if (\n last === 0 ||\n (last >= 5 && last <= 9) ||\n (lastTwo >= 11 && lastTwo <= 14)\n ) {\n return 'many'\n }\n // Note: The 'other' suffix is only used by decimal numbers in Russian.\n // We don't anticipate it being used, but it's here for consistency.\n return 'other'\n },\n scottish(n) {\n if (n === 1 || n === 11) {\n return 'one'\n }\n if (n === 2 || n === 12) {\n return 'two'\n }\n if ((n >= 3 && n <= 10) || (n >= 13 && n <= 19)) {\n return 'few'\n }\n return 'other'\n },\n spanish(n) {\n if (n === 1) {\n return 'one'\n }\n if (n % 1000000 === 0 && n !== 0) {\n return 'many'\n }\n return 'other'\n },\n welsh(n) {\n if (n === 0) {\n return 'zero'\n }\n if (n === 1) {\n return 'one'\n }\n if (n === 2) {\n return 'two'\n }\n if (n === 3) {\n return 'few'\n }\n if (n === 6) {\n return 'many'\n }\n return 'other'\n }\n }\n}\n\n/**\n * Plural rule category mnemonic tags\n *\n * @internal\n * @typedef {'zero' | 'one' | 'two' | 'few' | 'many' | 'other'} PluralRule\n */\n\n/**\n * Translated message by plural rule they correspond to.\n *\n * Allows to group pluralised messages under a single key when passing\n * translations to a component's constructor\n *\n * @internal\n * @typedef {object} TranslationPluralForms\n * @property {string} [other] - General plural form\n * @property {string} [zero] - Plural form used with 0\n * @property {string} [one] - Plural form used with 1\n * @property {string} [two] - Plural form used with 2\n * @property {string} [few] - Plural form used for a few\n * @property {string} [many] - Plural form used for many\n */\n"],"names":["I18n","constructor","translations","config","_config$locale","locale","document","documentElement","lang","t","lookupKey","options","Error","translation","count","translationPluralForm","getPluralSuffix","match","replacePlaceholders","translationString","formatter","Intl","NumberFormat","supportedLocalesOf","length","undefined","replace","placeholderWithBraces","placeholderKey","Object","prototype","hasOwnProperty","call","placeholderValue","format","hasIntlPluralRulesSupport","Boolean","window","PluralRules","Number","isFinite","preferredForm","select","selectPluralFormUsingFallbackRules","console","warn","Math","abs","floor","ruleset","getPluralRulesForLocale","pluralRules","localeShort","split","pluralRule","pluralRulesMap","languages","includes","arabic","chinese","french","german","irish","russian","scottish","spanish","welsh","n","lastTwo","last"],"mappings":"AAMO,MAAMA,IAAI,CAAC;EAUhBC,WAAWA,CAACC,YAAY,GAAG,EAAE,EAAEC,MAAM,GAAG,EAAE,EAAE;AAAA,IAAA,IAAAC,cAAA,CAAA;AAAA,IAAA,IAAA,CAT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A,IAAKA,CAAC,IAAI,CAAC,IAAIA,CAAC,IAAI,EAAE,IAAMA,CAAC,IAAI,EAAE,IAAIA,CAAC,IAAI,EAAG,EAAE;AAC/C,MAAA,OAAO,KAAK,CAAA;AACd,KAAA;AACA,IAAA,OAAO,OAAO,CAAA;GACf;EACDF,OAAOA,CAACE,CAAC,EAAE;IACT,IAAIA,CAAC,KAAK,CAAC,EAAE;AACX,MAAA,OAAO,KAAK,CAAA;AACd,KAAA;IACA,IAAIA,CAAC,GAAG,OAAO,KAAK,CAAC,IAAIA,CAAC,KAAK,CAAC,EAAE;AAChC,MAAA,OAAO,MAAM,CAAA;AACf,KAAA;AACA,IAAA,OAAO,OAAO,CAAA;GACf;EACDD,KAAKA,CAACC,CAAC,EAAE;IACP,IAAIA,CAAC,KAAK,CAAC,EAAE;AACX,MAAA,OAAO,MAAM,CAAA;AACf,KAAA;IACA,IAAIA,CAAC,KAAK,CAAC,EAAE;AACX,MAAA,OAAO,KAAK,CAAA;AACd,KAAA;IACA,IAAIA,CAAC,KAAK,CAAC,EAAE;AACX,MAAA,OAAO,KAAK,CAAA;AACd,KAAA;IACA,IAAIA,CAAC,KAAK,CAAC,EAAE;AACX,MAAA,OAAO,KAAK,CAAA;AACd,KAAA;IACA,IAAIA,CAAC,KAAK,CAAC,EAAE;AACX,MAAA,OAAO,MAAM,CAAA;AACf,KAAA;AACA,IAAA,OAAO,OAAO,CAAA;AAChB,GAAA;AACF,CAAC;;;;"}
1
+ {"version":3,"file":"i18n.mjs","sources":["../../src/govuk/i18n.mjs"],"sourcesContent":["/**\n * Internal support for selecting messages to render, with placeholder\n * interpolation and locale-aware number formatting and pluralisation\n *\n * @internal\n */\nexport class I18n {\n translations\n locale\n\n /**\n * @internal\n * @param {{ [key: string]: string | TranslationPluralForms }} translations - Key-value pairs of the translation strings to use.\n * @param {object} [config] - Configuration options for the function.\n * @param {string | null} [config.locale] - An overriding locale for the PluralRules functionality.\n */\n constructor(translations = {}, config = {}) {\n // Make list of translations available throughout function\n this.translations = translations\n\n // The locale to use for PluralRules and NumberFormat\n this.locale = config.locale ?? (document.documentElement.lang || 'en')\n }\n\n /**\n * The most used function - takes the key for a given piece of UI text and\n * returns the appropriate string.\n *\n * @internal\n * @param {string} lookupKey - The lookup key of the string to use.\n * @param {{ [key: string]: unknown }} [options] - Any options passed with the translation string, e.g: for string interpolation.\n * @returns {string} The appropriate translation string.\n * @throws {Error} Lookup key required\n * @throws {Error} Options required for `${}` placeholders\n */\n t(lookupKey, options) {\n if (!lookupKey) {\n // Print a console error if no lookup key has been provided\n throw new Error('i18n: lookup key missing')\n }\n\n // Fetch the translation for that lookup key\n let translation = this.translations[lookupKey]\n\n // If the `count` option is set, determine which plural suffix is needed and\n // change the lookupKey to match. We check to see if it's numeric instead of\n // falsy, as this could legitimately be 0.\n if (typeof options?.count === 'number' && typeof translation === 'object') {\n const translationPluralForm =\n translation[this.getPluralSuffix(lookupKey, options.count)]\n\n // Update translation with plural suffix\n if (translationPluralForm) {\n translation = translationPluralForm\n }\n }\n\n if (typeof translation === 'string') {\n // Check for ${} placeholders in the translation string\n if (translation.match(/%{(.\\S+)}/)) {\n if (!options) {\n throw new Error(\n 'i18n: cannot replace placeholders in string if no option data provided'\n )\n }\n\n return this.replacePlaceholders(translation, options)\n }\n\n return translation\n }\n\n // If the key wasn't found in our translations object,\n // return the lookup key itself as the fallback\n return lookupKey\n }\n\n /**\n * Takes a translation string with placeholders, and replaces the placeholders\n * with the provided data\n *\n * @internal\n * @param {string} translationString - The translation string\n * @param {{ [key: string]: unknown }} options - Any options passed with the translation string, e.g: for string interpolation.\n * @returns {string} The translation string to output, with $\\{\\} placeholders replaced\n */\n replacePlaceholders(translationString, options) {\n const formatter = Intl.NumberFormat.supportedLocalesOf(this.locale).length\n ? new Intl.NumberFormat(this.locale)\n : undefined\n\n return translationString.replace(\n /%{(.\\S+)}/g,\n\n /**\n * Replace translation string placeholders\n *\n * @internal\n * @param {string} placeholderWithBraces - Placeholder with braces\n * @param {string} placeholderKey - Placeholder key\n * @returns {string} Placeholder value\n */\n function (placeholderWithBraces, placeholderKey) {\n if (Object.prototype.hasOwnProperty.call(options, placeholderKey)) {\n const placeholderValue = options[placeholderKey]\n\n // If a user has passed `false` as the value for the placeholder\n // treat it as though the value should not be displayed\n if (\n placeholderValue === false ||\n (typeof placeholderValue !== 'number' &&\n typeof placeholderValue !== 'string')\n ) {\n return ''\n }\n\n // If the placeholder's value is a number, localise the number formatting\n if (typeof placeholderValue === 'number') {\n return formatter\n ? formatter.format(placeholderValue)\n : `${placeholderValue}`\n }\n\n return placeholderValue\n }\n\n throw new Error(\n `i18n: no data found to replace ${placeholderWithBraces} placeholder in string`\n )\n }\n )\n }\n\n /**\n * Check to see if the browser supports Intl.PluralRules\n *\n * It requires all conditions to be met in order to be supported:\n * - The implementation of Intl supports PluralRules (NOT true in Safari 10–12)\n * - The browser/OS has plural rules for the current locale (browser dependent)\n *\n * {@link https://browsersl.ist/#q=supports+es6-module+and+not+supports+intl-pluralrules}\n *\n * @internal\n * @returns {boolean} Returns true if all conditions are met. Returns false otherwise.\n */\n hasIntlPluralRulesSupport() {\n return Boolean(\n 'PluralRules' in window.Intl &&\n Intl.PluralRules.supportedLocalesOf(this.locale).length\n )\n }\n\n /**\n * Get the appropriate suffix for the plural form.\n *\n * Uses Intl.PluralRules (or our own fallback implementation) to get the\n * 'preferred' form to use for the given count.\n *\n * Checks that a translation has been provided for that plural form – if it\n * hasn't, it'll fall back to the 'other' plural form (unless that doesn't exist\n * either, in which case an error will be thrown)\n *\n * @internal\n * @param {string} lookupKey - The lookup key of the string to use.\n * @param {number} count - Number used to determine which pluralisation to use.\n * @returns {PluralRule} The suffix associated with the correct pluralisation for this locale.\n * @throws {Error} Plural form `.other` required when preferred plural form is missing\n */\n getPluralSuffix(lookupKey, count) {\n // Validate that the number is actually a number.\n //\n // Number(count) will turn anything that can't be converted to a Number type\n // into 'NaN'. isFinite filters out NaN, as it isn't a finite number.\n count = Number(count)\n if (!isFinite(count)) {\n return 'other'\n }\n\n // Fetch the translation for that lookup key\n const translation = this.translations[lookupKey]\n\n // Check to verify that all the requirements for Intl.PluralRules are met.\n // If so, we can use that instead of our custom implementation. Otherwise,\n // use the hardcoded fallback.\n const preferredForm = this.hasIntlPluralRulesSupport()\n ? new Intl.PluralRules(this.locale).select(count)\n : this.selectPluralFormUsingFallbackRules(count)\n\n // Use the correct plural form if provided\n if (typeof translation === 'object') {\n if (preferredForm in translation) {\n return preferredForm\n // Fall back to `other` if the plural form is missing, but log a warning\n // to the console\n } else if ('other' in translation) {\n console.warn(\n `i18n: Missing plural form \".${preferredForm}\" for \"${this.locale}\" locale. Falling back to \".other\".`\n )\n\n return 'other'\n }\n }\n\n // If the required `other` plural form is missing, all we can do is error\n throw new Error(\n `i18n: Plural form \".other\" is required for \"${this.locale}\" locale`\n )\n }\n\n /**\n * Get the plural form using our fallback implementation\n *\n * This is split out into a separate function to make it easier to test the\n * fallback behaviour in an environment where Intl.PluralRules exists.\n *\n * @internal\n * @param {number} count - Number used to determine which pluralisation to use.\n * @returns {PluralRule} The pluralisation form for count in this locale.\n */\n selectPluralFormUsingFallbackRules(count) {\n // Currently our custom code can only handle positive integers, so let's\n // make sure our number is one of those.\n count = Math.abs(Math.floor(count))\n\n const ruleset = this.getPluralRulesForLocale()\n\n if (ruleset) {\n return I18n.pluralRules[ruleset](count)\n }\n\n return 'other'\n }\n\n /**\n * Work out which pluralisation rules to use for the current locale\n *\n * The locale may include a regional indicator (such as en-GB), but we don't\n * usually care about this part, as pluralisation rules are usually the same\n * regardless of region. There are exceptions, however, (e.g. Portuguese) so\n * this searches by both the full and shortened locale codes, just to be sure.\n *\n * @internal\n * @returns {string | undefined} The name of the pluralisation rule to use (a key for one\n * of the functions in this.pluralRules)\n */\n getPluralRulesForLocale() {\n const localeShort = this.locale.split('-')[0]\n\n // Look through the plural rules map to find which `pluralRule` is\n // appropriate for our current `locale`.\n for (const pluralRule in I18n.pluralRulesMap) {\n const languages = I18n.pluralRulesMap[pluralRule]\n if (languages.includes(this.locale) || languages.includes(localeShort)) {\n return pluralRule\n }\n }\n }\n\n /**\n * Map of plural rules to languages where those rules apply.\n *\n * Note: These groups are named for the most dominant or recognisable language\n * that uses each system. The groupings do not imply that the languages are\n * related to one another. Many languages have evolved the same systems\n * independently of one another.\n *\n * Code to support more languages can be found in the i18n spike:\n * {@link https://github.com/alphagov/govuk-frontend/blob/spike-i18n-support/src/govuk/i18n.mjs}\n *\n * Languages currently supported:\n *\n * Arabic: Arabic (ar)\n * Chinese: Burmese (my), Chinese (zh), Indonesian (id), Japanese (ja),\n * Javanese (jv), Korean (ko), Malay (ms), Thai (th), Vietnamese (vi)\n * French: Armenian (hy), Bangla (bn), French (fr), Gujarati (gu), Hindi (hi),\n * Persian Farsi (fa), Punjabi (pa), Zulu (zu)\n * German: Afrikaans (af), Albanian (sq), Azerbaijani (az), Basque (eu),\n * Bulgarian (bg), Catalan (ca), Danish (da), Dutch (nl), English (en),\n * Estonian (et), Finnish (fi), Georgian (ka), German (de), Greek (el),\n * Hungarian (hu), Luxembourgish (lb), Norwegian (no), Somali (so),\n * Swahili (sw), Swedish (sv), Tamil (ta), Telugu (te), Turkish (tr),\n * Urdu (ur)\n * Irish: Irish Gaelic (ga)\n * Russian: Russian (ru), Ukrainian (uk)\n * Scottish: Scottish Gaelic (gd)\n * Spanish: European Portuguese (pt-PT), Italian (it), Spanish (es)\n * Welsh: Welsh (cy)\n *\n * @internal\n * @type {{ [key: string]: string[] }}\n */\n static pluralRulesMap = {\n arabic: ['ar'],\n chinese: ['my', 'zh', 'id', 'ja', 'jv', 'ko', 'ms', 'th', 'vi'],\n french: ['hy', 'bn', 'fr', 'gu', 'hi', 'fa', 'pa', 'zu'],\n german: [\n 'af',\n 'sq',\n 'az',\n 'eu',\n 'bg',\n 'ca',\n 'da',\n 'nl',\n 'en',\n 'et',\n 'fi',\n 'ka',\n 'de',\n 'el',\n 'hu',\n 'lb',\n 'no',\n 'so',\n 'sw',\n 'sv',\n 'ta',\n 'te',\n 'tr',\n 'ur'\n ],\n irish: ['ga'],\n russian: ['ru', 'uk'],\n scottish: ['gd'],\n spanish: ['pt-PT', 'it', 'es'],\n welsh: ['cy']\n }\n\n /**\n * Different pluralisation rule sets\n *\n * Returns the appropriate suffix for the plural form associated with `n`.\n * Possible suffixes: 'zero', 'one', 'two', 'few', 'many', 'other' (the actual\n * meaning of each differs per locale). 'other' should always exist, even in\n * languages without plurals, such as Chinese.\n * {@link https://cldr.unicode.org/index/cldr-spec/plural-rules}\n *\n * The count must be a positive integer. Negative numbers and decimals aren't accounted for\n *\n * @internal\n * @type {{ [key: string]: (count: number) => PluralRule }}\n */\n static pluralRules = {\n arabic(n) {\n if (n === 0) {\n return 'zero'\n }\n if (n === 1) {\n return 'one'\n }\n if (n === 2) {\n return 'two'\n }\n if (n % 100 >= 3 && n % 100 <= 10) {\n return 'few'\n }\n if (n % 100 >= 11 && n % 100 <= 99) {\n return 'many'\n }\n return 'other'\n },\n chinese() {\n return 'other'\n },\n french(n) {\n return n === 0 || n === 1 ? 'one' : 'other'\n },\n german(n) {\n return n === 1 ? 'one' : 'other'\n },\n irish(n) {\n if (n === 1) {\n return 'one'\n }\n if (n === 2) {\n return 'two'\n }\n if (n >= 3 && n <= 6) {\n return 'few'\n }\n if (n >= 7 && n <= 10) {\n return 'many'\n }\n return 'other'\n },\n russian(n) {\n const lastTwo = n % 100\n const last = lastTwo % 10\n if (last === 1 && lastTwo !== 11) {\n return 'one'\n }\n if (last >= 2 && last <= 4 && !(lastTwo >= 12 && lastTwo <= 14)) {\n return 'few'\n }\n if (\n last === 0 ||\n (last >= 5 && last <= 9) ||\n (lastTwo >= 11 && lastTwo <= 14)\n ) {\n return 'many'\n }\n // Note: The 'other' suffix is only used by decimal numbers in Russian.\n // We don't anticipate it being used, but it's here for consistency.\n return 'other'\n },\n scottish(n) {\n if (n === 1 || n === 11) {\n return 'one'\n }\n if (n === 2 || n === 12) {\n return 'two'\n }\n if ((n >= 3 && n <= 10) || (n >= 13 && n <= 19)) {\n return 'few'\n }\n return 'other'\n },\n spanish(n) {\n if (n === 1) {\n return 'one'\n }\n if (n % 1000000 === 0 && n !== 0) {\n return 'many'\n }\n return 'other'\n },\n welsh(n) {\n if (n === 0) {\n return 'zero'\n }\n if (n === 1) {\n return 'one'\n }\n if (n === 2) {\n return 'two'\n }\n if (n === 3) {\n return 'few'\n }\n if (n === 6) {\n return 'many'\n }\n return 'other'\n }\n }\n}\n\n/**\n * Plural rule category mnemonic tags\n *\n * @internal\n * @typedef {'zero' | 'one' | 'two' | 'few' | 'many' | 'other'} PluralRule\n */\n\n/**\n * Translated message by plural rule they correspond to.\n *\n * Allows to group pluralised messages under a single key when passing\n * translations to a component's constructor\n *\n * @internal\n * @typedef {object} TranslationPluralForms\n * @property {string} [other] - General plural form\n * @property {string} [zero] - Plural form used with 0\n * @property {string} [one] - Plural form used with 1\n * @property {string} [two] - Plural form used with 2\n * @property {string} [few] - Plural form used for a few\n * @property {string} [many] - Plural form used for many\n */\n"],"names":["I18n","constructor","translations","config","_config$locale","locale","document","documentElement","lang","t","lookupKey","options","Error","translation","count","translationPluralForm","getPluralSuffix","match","replacePlaceholders","translationString","formatter","Intl","NumberFormat","supportedLocalesOf","length","undefined","replace","placeholderWithBraces","placeholderKey","Object","prototype","hasOwnProperty","call","placeholderValue","format","hasIntlPluralRulesSupport","Boolean","window","PluralRules","Number","isFinite","preferredForm","select","selectPluralFormUsingFallbackRules","console","warn","Math","abs","floor","ruleset","getPluralRulesForLocale","pluralRules","localeShort","split","pluralRule","pluralRulesMap","languages","includes","arabic","chinese","french","german","irish","russian","scottish","spanish","welsh","n","lastTwo","last"],"mappings":"AAMO,MAAMA,IAAI,CAAC;EAUhBC,WAAWA,CAACC,YAAY,GAAG,EAAE,EAAEC,MAAM,GAAG,EAAE,EAAE;AAAA,IAAA,IAAAC,cAAA;AAAA,IAAA,IAAA,CAT5CF,YAAY,GAAA,MAAA;AAAA,IAAA,IAAA,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AC,EAAE;AACX,MAAA,OAAO,KAAK;AACd;IACA,IAAIA,CAAC,KAAK,CAAC,EAAE;AACX,MAAA,OAAO,MAAM;AACf;AACA,IAAA,OAAO,OAAO;AAChB;AACF,CAAC;;;;"}
@@ -5,10 +5,12 @@ import { CharacterCount } from './components/character-count/character-count.mjs
5
5
  import { Checkboxes } from './components/checkboxes/checkboxes.mjs';
6
6
  import { ErrorSummary } from './components/error-summary/error-summary.mjs';
7
7
  import { ExitThisPage } from './components/exit-this-page/exit-this-page.mjs';
8
+ import { FileUpload } from './components/file-upload/file-upload.mjs';
8
9
  import { Header } from './components/header/header.mjs';
9
10
  import { NotificationBanner } from './components/notification-banner/notification-banner.mjs';
10
11
  import { PasswordInput } from './components/password-input/password-input.mjs';
11
12
  import { Radios } from './components/radios/radios.mjs';
13
+ import { ServiceNavigation } from './components/service-navigation/service-navigation.mjs';
12
14
  import { SkipLink } from './components/skip-link/skip-link.mjs';
13
15
  import { Tabs } from './components/tabs/tabs.mjs';
14
16
  import { SupportError } from './errors/index.mjs';
@@ -19,19 +21,28 @@ import { SupportError } from './errors/index.mjs';
19
21
  * Use the `data-module` attributes to find, instantiate and init all of the
20
22
  * components provided as part of GOV.UK Frontend.
21
23
  *
22
- * @param {Config & { scope?: Element }} [config] - Config for all components (with optional scope)
24
+ * @param {Config & { scope?: Element, onError?: OnErrorCallback<CompatibleClass> }} [config] - Config for all components (with optional scope)
23
25
  */
24
26
  function initAll(config) {
25
27
  var _config$scope;
26
28
  config = typeof config !== 'undefined' ? config : {};
27
29
  if (!isSupported()) {
28
- console.log(new SupportError());
30
+ if (config.onError) {
31
+ config.onError(new SupportError(), {
32
+ config
33
+ });
34
+ } else {
35
+ console.log(new SupportError());
36
+ }
29
37
  return;
30
38
  }
31
- const components = [[Accordion, config.accordion], [Button, config.button], [CharacterCount, config.characterCount], [Checkboxes], [ErrorSummary, config.errorSummary], [ExitThisPage, config.exitThisPage], [Header], [NotificationBanner, config.notificationBanner], [PasswordInput, config.passwordInput], [Radios], [SkipLink], [Tabs]];
32
- const $scope = (_config$scope = config.scope) != null ? _config$scope : document;
39
+ const components = [[Accordion, config.accordion], [Button, config.button], [CharacterCount, config.characterCount], [Checkboxes], [ErrorSummary, config.errorSummary], [ExitThisPage, config.exitThisPage], [FileUpload, config.fileUpload], [Header], [NotificationBanner, config.notificationBanner], [PasswordInput, config.passwordInput], [Radios], [ServiceNavigation], [SkipLink], [Tabs]];
40
+ const options = {
41
+ scope: (_config$scope = config.scope) != null ? _config$scope : document,
42
+ onError: config.onError
43
+ };
33
44
  components.forEach(([Component, config]) => {
34
- createAll(Component, config, $scope);
45
+ createAll(Component, config, options);
35
46
  });
36
47
  }
37
48
 
@@ -44,25 +55,58 @@ function initAll(config) {
44
55
  *
45
56
  * Any component errors will be caught and logged to the console.
46
57
  *
47
- * @template {CompatibleClass} T
48
- * @param {T} Component - class of the component to create
49
- * @param {T["defaults"]} [config] - config for the component
50
- * @param {Element|Document} [$scope] - scope of the document to search within
51
- * @returns {Array<InstanceType<T>>} - array of instantiated components
58
+ * @template {CompatibleClass} ComponentClass
59
+ * @param {ComponentClass} Component - class of the component to create
60
+ * @param {ComponentConfig<ComponentClass>} [config] - Config supplied to component
61
+ * @param {OnErrorCallback<ComponentClass> | Element | Document | CreateAllOptions<ComponentClass> } [createAllOptions] - options for createAll including scope of the document to search within and callback function if error throw by component on init
62
+ * @returns {Array<InstanceType<ComponentClass>>} - array of instantiated components
52
63
  */
53
- function createAll(Component, config, $scope = document) {
64
+ function createAll(Component, config, createAllOptions) {
65
+ let $scope = document;
66
+ let onError;
67
+ if (typeof createAllOptions === 'object') {
68
+ var _createAllOptions$sco;
69
+ createAllOptions = createAllOptions;
70
+ $scope = (_createAllOptions$sco = createAllOptions.scope) != null ? _createAllOptions$sco : $scope;
71
+ onError = createAllOptions.onError;
72
+ }
73
+ if (typeof createAllOptions === 'function') {
74
+ onError = createAllOptions;
75
+ }
76
+ if (createAllOptions instanceof HTMLElement) {
77
+ $scope = createAllOptions;
78
+ }
54
79
  const $elements = $scope.querySelectorAll(`[data-module="${Component.moduleName}"]`);
80
+ if (!isSupported()) {
81
+ if (onError) {
82
+ onError(new SupportError(), {
83
+ component: Component,
84
+ config
85
+ });
86
+ } else {
87
+ console.log(new SupportError());
88
+ }
89
+ return [];
90
+ }
55
91
  return Array.from($elements).map($element => {
56
92
  try {
57
- return 'defaults' in Component && typeof config !== 'undefined' ? new Component($element, config) : new Component($element);
93
+ return typeof config !== 'undefined' ? new Component($element, config) : new Component($element);
58
94
  } catch (error) {
59
- console.log(error);
95
+ if (onError) {
96
+ onError(error, {
97
+ element: $element,
98
+ component: Component,
99
+ config
100
+ });
101
+ } else {
102
+ console.log(error);
103
+ }
60
104
  return null;
61
105
  }
62
106
  }).filter(Boolean);
63
107
  }
64
108
  /**
65
- * @typedef {{new (...args: any[]): any, defaults?: object, moduleName: string}} CompatibleClass
109
+ * @typedef {{new (...args: any[]): any, moduleName: string}} CompatibleClass
66
110
  */
67
111
  /**
68
112
  * Config for all components via `initAll()`
@@ -73,28 +117,50 @@ function createAll(Component, config, $scope = document) {
73
117
  * @property {CharacterCountConfig} [characterCount] - Character Count config
74
118
  * @property {ErrorSummaryConfig} [errorSummary] - Error Summary config
75
119
  * @property {ExitThisPageConfig} [exitThisPage] - Exit This Page config
120
+ * @property {FileUploadConfig} [fileUpload] - File Upload config
76
121
  * @property {NotificationBannerConfig} [notificationBanner] - Notification Banner config
77
122
  * @property {PasswordInputConfig} [passwordInput] - Password input config
78
123
  */
79
124
  /**
80
125
  * Config for individual components
81
126
  *
82
- * @typedef {import('./components/accordion/accordion.mjs').AccordionConfig} AccordionConfig
83
- * @typedef {import('./components/accordion/accordion.mjs').AccordionTranslations} AccordionTranslations
84
- * @typedef {import('./components/button/button.mjs').ButtonConfig} ButtonConfig
85
- * @typedef {import('./components/character-count/character-count.mjs').CharacterCountConfig} CharacterCountConfig
86
- * @typedef {import('./components/character-count/character-count.mjs').CharacterCountTranslations} CharacterCountTranslations
87
- * @typedef {import('./components/error-summary/error-summary.mjs').ErrorSummaryConfig} ErrorSummaryConfig
88
- * @typedef {import('./components/exit-this-page/exit-this-page.mjs').ExitThisPageConfig} ExitThisPageConfig
89
- * @typedef {import('./components/exit-this-page/exit-this-page.mjs').ExitThisPageTranslations} ExitThisPageTranslations
90
- * @typedef {import('./components/notification-banner/notification-banner.mjs').NotificationBannerConfig} NotificationBannerConfig
91
- * @typedef {import('./components/password-input/password-input.mjs').PasswordInputConfig} PasswordInputConfig
127
+ * @import { AccordionConfig } from './components/accordion/accordion.mjs'
128
+ * @import { ButtonConfig } from './components/button/button.mjs'
129
+ * @import { CharacterCountConfig } from './components/character-count/character-count.mjs'
130
+ * @import { ErrorSummaryConfig } from './components/error-summary/error-summary.mjs'
131
+ * @import { ExitThisPageConfig } from './components/exit-this-page/exit-this-page.mjs'
132
+ * @import { NotificationBannerConfig } from './components/notification-banner/notification-banner.mjs'
133
+ * @import { PasswordInputConfig } from './components/password-input/password-input.mjs'
134
+ * @import { FileUploadConfig } from './components/file-upload/file-upload.mjs'
92
135
  */
93
136
  /**
94
137
  * Component config keys, e.g. `accordion` and `characterCount`
95
138
  *
96
139
  * @typedef {keyof Config} ConfigKey
97
140
  */
141
+ /**
142
+ * @template {CompatibleClass} ComponentClass
143
+ * @typedef {ConstructorParameters<ComponentClass>[1]} ComponentConfig
144
+ */
145
+ /**
146
+ * @template {CompatibleClass} ComponentClass
147
+ * @typedef {object} ErrorContext
148
+ * @property {Element} [element] - Element used for component module initialisation
149
+ * @property {ComponentClass} [component] - Class of component
150
+ * @property {ComponentConfig<ComponentClass>} config - Config supplied to component
151
+ */
152
+ /**
153
+ * @template {CompatibleClass} ComponentClass
154
+ * @callback OnErrorCallback
155
+ * @param {unknown} error - Thrown error
156
+ * @param {ErrorContext<ComponentClass>} context - Object containing the element, component class and configuration
157
+ */
158
+ /**
159
+ * @template {CompatibleClass} ComponentClass
160
+ * @typedef {object} CreateAllOptions
161
+ * @property {Element | Document} [scope] - scope of the document to search within
162
+ * @property {OnErrorCallback<ComponentClass>} [onError] - callback function if error throw by component on init
163
+ */
98
164
 
99
165
  export { createAll, initAll };
100
166
  //# sourceMappingURL=init.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"init.mjs","sources":["../../src/govuk/init.mjs"],"sourcesContent":["import { isSupported } from './common/index.mjs'\nimport { Accordion } from './components/accordion/accordion.mjs'\nimport { Button } from './components/button/button.mjs'\nimport { CharacterCount } from './components/character-count/character-count.mjs'\nimport { Checkboxes } from './components/checkboxes/checkboxes.mjs'\nimport { ErrorSummary } from './components/error-summary/error-summary.mjs'\nimport { ExitThisPage } from './components/exit-this-page/exit-this-page.mjs'\nimport { Header } from './components/header/header.mjs'\nimport { NotificationBanner } from './components/notification-banner/notification-banner.mjs'\nimport { PasswordInput } from './components/password-input/password-input.mjs'\nimport { Radios } from './components/radios/radios.mjs'\nimport { SkipLink } from './components/skip-link/skip-link.mjs'\nimport { Tabs } from './components/tabs/tabs.mjs'\nimport { SupportError } from './errors/index.mjs'\n\n/**\n * Initialise all components\n *\n * Use the `data-module` attributes to find, instantiate and init all of the\n * components provided as part of GOV.UK Frontend.\n *\n * @param {Config & { scope?: Element }} [config] - Config for all components (with optional scope)\n */\nfunction initAll(config) {\n config = typeof config !== 'undefined' ? config : {}\n\n // Skip initialisation when GOV.UK Frontend is not supported\n if (!isSupported()) {\n console.log(new SupportError())\n return\n }\n\n const components = /** @type {const} */ ([\n [Accordion, config.accordion],\n [Button, config.button],\n [CharacterCount, config.characterCount],\n [Checkboxes],\n [ErrorSummary, config.errorSummary],\n [ExitThisPage, config.exitThisPage],\n [Header],\n [NotificationBanner, config.notificationBanner],\n [PasswordInput, config.passwordInput],\n [Radios],\n [SkipLink],\n [Tabs]\n ])\n\n // Allow the user to initialise GOV.UK Frontend in only certain sections of the page\n // Defaults to the entire document if nothing is set.\n const $scope = config.scope ?? document\n\n components.forEach(([Component, config]) => {\n createAll(Component, config, $scope)\n })\n}\n\n/**\n * Create all instances of a specific component on the page\n *\n * Uses the `data-module` attribute to find all elements matching the specified\n * component on the page, creating instances of the component object for each\n * of them.\n *\n * Any component errors will be caught and logged to the console.\n *\n * @template {CompatibleClass} T\n * @param {T} Component - class of the component to create\n * @param {T[\"defaults\"]} [config] - config for the component\n * @param {Element|Document} [$scope] - scope of the document to search within\n * @returns {Array<InstanceType<T>>} - array of instantiated components\n */\nfunction createAll(Component, config, $scope = document) {\n const $elements = $scope.querySelectorAll(\n `[data-module=\"${Component.moduleName}\"]`\n )\n\n /* eslint-disable-next-line @typescript-eslint/no-unsafe-return --\n * We can't define CompatibleClass as `{new(): CompatibleClass, moduleName: string}`,\n * as when doing `typeof Accordion` (or any component), TypeScript doesn't seem\n * to acknowledge the static `moduleName` that's set in our component classes.\n * This means we have to set the constructor of `CompatibleClass` as `{new(): any}`,\n * leading to ESLint frowning that we're returning `any[]`.\n */\n return Array.from($elements)\n .map(($element) => {\n try {\n // Only pass config to components that accept it\n // eslint-disable-next-line @typescript-eslint/no-unsafe-return\n return 'defaults' in Component && typeof config !== 'undefined'\n ? new Component($element, config)\n : new Component($element)\n } catch (error) {\n console.log(error)\n return null\n }\n })\n .filter(Boolean) // Exclude components that errored\n}\n\nexport { initAll, createAll }\n\n/* eslint-disable jsdoc/valid-types --\n * `{new(...args: any[] ): object}` is not recognised as valid\n * https://github.com/gajus/eslint-plugin-jsdoc/issues/145#issuecomment-1308722878\n * https://github.com/jsdoc-type-pratt-parser/jsdoc-type-pratt-parser/issues/131\n **/\n\n/**\n * @typedef {{new (...args: any[]): any, defaults?: object, moduleName: string}} CompatibleClass\n */\n\n/* eslint-enable jsdoc/valid-types */\n\n/**\n * Config for all components via `initAll()`\n *\n * @typedef {object} Config\n * @property {AccordionConfig} [accordion] - Accordion config\n * @property {ButtonConfig} [button] - Button config\n * @property {CharacterCountConfig} [characterCount] - Character Count config\n * @property {ErrorSummaryConfig} [errorSummary] - Error Summary config\n * @property {ExitThisPageConfig} [exitThisPage] - Exit This Page config\n * @property {NotificationBannerConfig} [notificationBanner] - Notification Banner config\n * @property {PasswordInputConfig} [passwordInput] - Password input config\n */\n\n/**\n * Config for individual components\n *\n * @typedef {import('./components/accordion/accordion.mjs').AccordionConfig} AccordionConfig\n * @typedef {import('./components/accordion/accordion.mjs').AccordionTranslations} AccordionTranslations\n * @typedef {import('./components/button/button.mjs').ButtonConfig} ButtonConfig\n * @typedef {import('./components/character-count/character-count.mjs').CharacterCountConfig} CharacterCountConfig\n * @typedef {import('./components/character-count/character-count.mjs').CharacterCountTranslations} CharacterCountTranslations\n * @typedef {import('./components/error-summary/error-summary.mjs').ErrorSummaryConfig} ErrorSummaryConfig\n * @typedef {import('./components/exit-this-page/exit-this-page.mjs').ExitThisPageConfig} ExitThisPageConfig\n * @typedef {import('./components/exit-this-page/exit-this-page.mjs').ExitThisPageTranslations} ExitThisPageTranslations\n * @typedef {import('./components/notification-banner/notification-banner.mjs').NotificationBannerConfig} NotificationBannerConfig\n * @typedef {import('./components/password-input/password-input.mjs').PasswordInputConfig} PasswordInputConfig\n */\n\n/**\n * Component config keys, e.g. `accordion` and `characterCount`\n *\n * @typedef {keyof Config} ConfigKey\n */\n"],"names":["initAll","config","_config$scope","isSupported","console","log","SupportError","components","Accordion","accordion","Button","button","CharacterCount","characterCount","Checkboxes","ErrorSummary","errorSummary","ExitThisPage","exitThisPage","Header","NotificationBanner","notificationBanner","PasswordInput","passwordInput","Radios","SkipLink","Tabs","$scope","scope","document","forEach","Component","createAll","$elements","querySelectorAll","moduleName","Array","from","map","$element","error","filter","Boolean"],"mappings":";;;;;;;;;;;;;;;AAeA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,OAAOA,CAACC,MAAM,EAAE;AAAA,EAAA,IAAAC,aAAA,CAAA;EACvBD,MAAM,GAAG,OAAOA,MAAM,KAAK,WAAW,GAAGA,MAAM,GAAG,EAAE,CAAA;AAGpD,EAAA,IAAI,CAACE,WAAW,EAAE,EAAE;AAClBC,IA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AS,CAAC,CACzBK,GAAG,CAAEC,QAAQ,IAAK;IACjB,IAAI;MAGF,OAAO,UAAU,IAAIR,SAAS,IAAI,OAAO9B,MAAM,KAAK,WAAW,GAC3D,IAAI8B,SAAS,CAACQ,QAAQ,EAAEtC,MAAM,CAAC,GAC/B,IAAI8B,SAAS,CAACQ,QAAQ,CAAC,CAAA;KAC5B,CAAC,OAAOC,KAAK,EAAE;AACdpC,MAAAA,OAAO,CAACC,GAAG,CAACmC,KAAK,CAAC,CAAA;AAClB,MAAA,OAAO,IAAI,CAAA;AACb,KAAA;AACF,GAAC,CAAC,CACDC,MAAM,CAACC,OAAO,CAAC,CAAA;AACpB,CAAA;AAUA;AACA;AACA;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;;;;"}
1
+ {"version":3,"file":"init.mjs","sources":["../../src/govuk/init.mjs"],"sourcesContent":["import { isSupported } from './common/index.mjs'\nimport { Accordion } from './components/accordion/accordion.mjs'\nimport { Button } from './components/button/button.mjs'\nimport { CharacterCount } from './components/character-count/character-count.mjs'\nimport { Checkboxes } from './components/checkboxes/checkboxes.mjs'\nimport { ErrorSummary } from './components/error-summary/error-summary.mjs'\nimport { ExitThisPage } from './components/exit-this-page/exit-this-page.mjs'\nimport { FileUpload } from './components/file-upload/file-upload.mjs'\nimport { Header } from './components/header/header.mjs'\nimport { NotificationBanner } from './components/notification-banner/notification-banner.mjs'\nimport { PasswordInput } from './components/password-input/password-input.mjs'\nimport { Radios } from './components/radios/radios.mjs'\nimport { ServiceNavigation } from './components/service-navigation/service-navigation.mjs'\nimport { SkipLink } from './components/skip-link/skip-link.mjs'\nimport { Tabs } from './components/tabs/tabs.mjs'\nimport { SupportError } from './errors/index.mjs'\n\n/**\n * Initialise all components\n *\n * Use the `data-module` attributes to find, instantiate and init all of the\n * components provided as part of GOV.UK Frontend.\n *\n * @param {Config & { scope?: Element, onError?: OnErrorCallback<CompatibleClass> }} [config] - Config for all components (with optional scope)\n */\nfunction initAll(config) {\n config = typeof config !== 'undefined' ? config : {}\n\n // Skip initialisation when GOV.UK Frontend is not supported\n if (!isSupported()) {\n if (config.onError) {\n config.onError(new SupportError(), {\n config\n })\n } else {\n console.log(new SupportError())\n }\n return\n }\n\n const components = /** @type {const} */ ([\n [Accordion, config.accordion],\n [Button, config.button],\n [CharacterCount, config.characterCount],\n [Checkboxes],\n [ErrorSummary, config.errorSummary],\n [ExitThisPage, config.exitThisPage],\n [FileUpload, config.fileUpload],\n [Header],\n [NotificationBanner, config.notificationBanner],\n [PasswordInput, config.passwordInput],\n [Radios],\n [ServiceNavigation],\n [SkipLink],\n [Tabs]\n ])\n\n // Allow the user to initialise GOV.UK Frontend in only certain sections of the page\n // Defaults to the entire document if nothing is set.\n // const $scope = config.scope ?? document\n\n const options = {\n scope: config.scope ?? document,\n onError: config.onError\n }\n\n components.forEach(([Component, config]) => {\n createAll(Component, config, options)\n })\n}\n\n/**\n * Create all instances of a specific component on the page\n *\n * Uses the `data-module` attribute to find all elements matching the specified\n * component on the page, creating instances of the component object for each\n * of them.\n *\n * Any component errors will be caught and logged to the console.\n *\n * @template {CompatibleClass} ComponentClass\n * @param {ComponentClass} Component - class of the component to create\n * @param {ComponentConfig<ComponentClass>} [config] - Config supplied to component\n * @param {OnErrorCallback<ComponentClass> | Element | Document | CreateAllOptions<ComponentClass> } [createAllOptions] - options for createAll including scope of the document to search within and callback function if error throw by component on init\n * @returns {Array<InstanceType<ComponentClass>>} - array of instantiated components\n */\nfunction createAll(Component, config, createAllOptions) {\n let /** @type {Element | Document} */ $scope = document\n let /** @type {OnErrorCallback<Component> | undefined} */ onError\n\n if (typeof createAllOptions === 'object') {\n createAllOptions = /** @type {CreateAllOptions<Component>} */ (\n // eslint-disable-next-line no-self-assign\n createAllOptions\n )\n\n $scope = createAllOptions.scope ?? $scope\n onError = createAllOptions.onError\n }\n\n if (typeof createAllOptions === 'function') {\n onError = createAllOptions\n }\n\n if (createAllOptions instanceof HTMLElement) {\n $scope = createAllOptions\n }\n\n const $elements = $scope.querySelectorAll(\n `[data-module=\"${Component.moduleName}\"]`\n )\n\n // Skip initialisation when GOV.UK Frontend is not supported\n if (!isSupported()) {\n if (onError) {\n onError(new SupportError(), {\n component: Component,\n config\n })\n } else {\n console.log(new SupportError())\n }\n return []\n }\n\n /* eslint-disable-next-line @typescript-eslint/no-unsafe-return --\n * We can't define CompatibleClass as `{new(): CompatibleClass, moduleName: string}`,\n * as when doing `typeof Accordion` (or any component), TypeScript doesn't seem\n * to acknowledge the static `moduleName` that's set in our component classes.\n * This means we have to set the constructor of `CompatibleClass` as `{new(): any}`,\n * leading to ESLint frowning that we're returning `any[]`.\n */\n return Array.from($elements)\n .map(($element) => {\n try {\n // Only pass config to components that accept it\n // eslint-disable-next-line @typescript-eslint/no-unsafe-return\n return typeof config !== 'undefined'\n ? new Component($element, config)\n : new Component($element)\n } catch (error) {\n if (onError) {\n onError(error, {\n element: $element,\n component: Component,\n config\n })\n } else {\n console.log(error)\n }\n\n return null\n }\n })\n .filter(Boolean) // Exclude components that errored\n}\n\nexport { initAll, createAll }\n\n/* eslint-disable jsdoc/valid-types --\n * `{new(...args: any[] ): object}` is not recognised as valid\n * https://github.com/gajus/eslint-plugin-jsdoc/issues/145#issuecomment-1308722878\n * https://github.com/jsdoc-type-pratt-parser/jsdoc-type-pratt-parser/issues/131\n **/\n\n/**\n * @typedef {{new (...args: any[]): any, moduleName: string}} CompatibleClass\n */\n\n/* eslint-enable jsdoc/valid-types */\n\n/**\n * Config for all components via `initAll()`\n *\n * @typedef {object} Config\n * @property {AccordionConfig} [accordion] - Accordion config\n * @property {ButtonConfig} [button] - Button config\n * @property {CharacterCountConfig} [characterCount] - Character Count config\n * @property {ErrorSummaryConfig} [errorSummary] - Error Summary config\n * @property {ExitThisPageConfig} [exitThisPage] - Exit This Page config\n * @property {FileUploadConfig} [fileUpload] - File Upload config\n * @property {NotificationBannerConfig} [notificationBanner] - Notification Banner config\n * @property {PasswordInputConfig} [passwordInput] - Password input config\n */\n\n/**\n * Config for individual components\n *\n * @import { AccordionConfig } from './components/accordion/accordion.mjs'\n * @import { ButtonConfig } from './components/button/button.mjs'\n * @import { CharacterCountConfig } from './components/character-count/character-count.mjs'\n * @import { ErrorSummaryConfig } from './components/error-summary/error-summary.mjs'\n * @import { ExitThisPageConfig } from './components/exit-this-page/exit-this-page.mjs'\n * @import { NotificationBannerConfig } from './components/notification-banner/notification-banner.mjs'\n * @import { PasswordInputConfig } from './components/password-input/password-input.mjs'\n * @import { FileUploadConfig } from './components/file-upload/file-upload.mjs'\n */\n\n/**\n * Component config keys, e.g. `accordion` and `characterCount`\n *\n * @typedef {keyof Config} ConfigKey\n */\n\n/**\n * @template {CompatibleClass} ComponentClass\n * @typedef {ConstructorParameters<ComponentClass>[1]} ComponentConfig\n */\n\n/**\n * @template {CompatibleClass} ComponentClass\n * @typedef {object} ErrorContext\n * @property {Element} [element] - Element used for component module initialisation\n * @property {ComponentClass} [component] - Class of component\n * @property {ComponentConfig<ComponentClass>} config - Config supplied to component\n */\n\n/**\n * @template {CompatibleClass} ComponentClass\n * @callback OnErrorCallback\n * @param {unknown} error - Thrown error\n * @param {ErrorContext<ComponentClass>} context - Object containing the element, component class and configuration\n */\n\n/**\n * @template {CompatibleClass} ComponentClass\n * @typedef {object} CreateAllOptions\n * @property {Element | Document} [scope] - scope of the document to search within\n * @property {OnErrorCallback<ComponentClass>} [onError] - callback function if error throw by component on init\n */\n"],"names":["initAll","config","_config$scope","isSupported","onError","SupportError","console","log","components","Accordion","accordion","Button","button","CharacterCount","characterCount","Checkboxes","ErrorSummary","errorSummary","ExitThisPage","exitThisPage","FileUpload","fileUpload","Header","NotificationBanner","notificationBanner","PasswordInput","passwordInput","Radios","ServiceNavigation","SkipLink","Tabs","options","scope","document","forEach","Component","createAll","createAllOptions","$scope","_createAllOptions$sco","HTMLElement","$elements","querySelectorAll","moduleName","component","Array","from","map","$element","error","element","filter","Boolean"],"mappings":";;;;;;;;;;;;;;;;;AAiBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,OAAOA,CAACC,MAAM,EAAE;AAAA,EAAA,IAAAC,aAAA;EACvBD,MAAM,GAAG,OAAOA,MAAM,KAAK,WAAW,GAAGA,MAAM,GAAG,EAAE;AAGpD,EAAA,IAAI,CAACE,WAAW,EAAE,EAAE;IAClB,IAAIF,MAAM,CAACG,OAAO,EAAE;AAClBH,MAAAA,MAAM,CAACG,OAAO,CAAC,IAAIC,YAAY,EAAE,EAAE;AACjCJ,QAAAA;AACF,OAAC,CAAC;AACJ,KAAC,MAAM;AACLK,MAAAA,OAAO,CAACC,GAAG,CAAC,IAAIF,YAAY,EAAE,CAAC;AACjC;AACA,IAAA;AACF;AAEA,EAAA,MAAMG,UAAU,GAAyB,CACvC,CAACC,SAAS,EAAER,MAAM,CAACS,SAAS,CAAC,EAC7B,CAACC,MAAM,EAAEV,MAAM,CAACW,MAAM,CAAC,EACvB,CAACC,cAAc,EAAEZ,MAAM,CAACa,cAAc,CAAC,EACvC,CAACC,UAAU,CAAC,EACZ,CAACC,YAAY,EAAEf,MAAM,CAACgB,YAAY,CAAC,EACnC,CAACC,YAAY,EAAEjB,MAAM,CAACkB,YAAY,CAAC,EACnC,CAACC,UAAU,EAAEnB,MAAM,CAACoB,UAAU,CAAC,EAC/B,CAACC,MAAM,CAAC,EACR,CAACC,kBAAkB,EAAEtB,MAAM,CAACuB,kBAAkB,CAAC,EAC/C,CAACC,aAAa,EAAExB,MAAM,CAACyB,aAAa,CAAC,EACrC,CAACC,MAAM,CAAC,EACR,CAACC,iBAAiB,CAAC,EACnB,CAACC,QAAQ,CAAC,EACV,CAACC,IAAI,CAAC,CACN;AAMF,EAAA,MAAMC,OAAO,GAAG;IACdC,KAAK,EAAA,CAAA9B,aAAA,GAAED,MAAM,CAAC+B,KAAK,K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;AACLK,MAAAA,OAAO,CAACC,GAAG,CAAC,IAAIF,YAAY,EAAE,CAAC;AACjC;AACA,IAAA,OAAO,EAAE;AACX;EASA,OAAOwC,KAAK,CAACC,IAAI,CAACL,SAAS,CAAC,CACzBM,GAAG,CAAEC,QAAQ,IAAK;IACjB,IAAI;AAGF,MAAA,OAAO,OAAO/C,MAAM,KAAK,WAAW,GAChC,IAAIkC,SAAS,CAACa,QAAQ,EAAE/C,MAAM,CAAC,GAC/B,IAAIkC,SAAS,CAACa,QAAQ,CAAC;KAC5B,CAAC,OAAOC,KAAK,EAAE;AACd,MAAA,IAAI7C,OAAO,EAAE;QACXA,OAAO,CAAC6C,KAAK,EAAE;AACbC,UAAAA,OAAO,EAAEF,QAAQ;AACjBJ,UAAAA,SAAS,EAAET,SAAS;AACpBlC,UAAAA;AACF,SAAC,CAAC;AACJ,OAAC,MAAM;AACLK,QAAAA,OAAO,CAACC,GAAG,CAAC0C,KAAK,CAAC;AACpB;AAEA,MAAA,OAAO,IAAI;AACb;AACF,GAAC,CAAC,CACDE,MAAM,CAACC,OAAO,CAAC;AACpB;AAUA;AACA;AACA;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;;;;"}
@@ -0,0 +1,78 @@
1
+ {#- This macro is for interal use within GOV.UK Frontend. It isn't intended for
2
+ external use and may receive undocumented breaking changes in non-breaking
3
+ releases of Frontend. #}
4
+
5
+ {% from "./attributes.njk" import govukAttributes %}
6
+
7
+ {% macro govukLogo(params) %}
8
+ {#- Default options #}
9
+ {%- set rebrand = params.rebrand | default(false) %}
10
+ {%- set useLogotype = params.useLogotype | default(true) %}
11
+ {%- set useTudorCrown = params.useTudorCrown | default(true) %}
12
+
13
+ {# Force use of Tudor Crown if rebrand flag is on. #}
14
+ {%- set useTudorCrown = true if rebrand else useTudorCrown %}
15
+
16
+ {#- Calculate how wide the logo needs to be for the given parameters. #}
17
+ {%- set svgWidth = 32 if useTudorCrown else 36 %}
18
+ {%- set svgWidth = svgWidth + 116 if (useLogotype and not rebrand) else svgWidth %}
19
+ {%- set svgWidth = svgWidth + 130 if (useLogotype and rebrand) else svgWidth %}
20
+
21
+ {#- Charles III's Tudor Crown icon has been the default since February 2024. #}
22
+ {%- set _tudorCrown %}
23
+ <g>
24
+ <circle cx="20" cy="17.6" r="3.7"/>
25
+ <circle cx="10.2" cy="23.5" r="3.7"/>
26
+ <circle cx="3.7" cy="33.2" r="3.7"/>
27
+ <circle cx="31.7" cy="30.6" r="3.7"/>
28
+ <circle cx="43.3" cy="17.6" r="3.7"/>
29
+ <circle cx="53.2" cy="23.5" r="3.7"/>
30
+ <circle cx="59.7" cy="33.2" r="3.7"/>
31
+ <circle cx="31.7" cy="30.6" r="3.7"/>
32
+ <path d="M33.1,9.8c.2-.1.3-.3.5-.5l4.6,2.4v-6.8l-4.6,1.5c-.1-.2-.3-.3-.5-.5l1.9-5.9h-6.7l1.9,5.9c-.2.1-.3.3-.5.5l-4.6-1.5v6.8l4.6-2.4c.1.2.3.3.5.5l-2.6,8c-.9,2.8,1.2,5.7,4.1,5.7h0c3,0,5.1-2.9,4.1-5.7l-2.6-8ZM37,37.9s-3.4,3.8-4.1,6.1c2.2,0,4.2-.5,6.4-2.8l-.7,8.5c-2-2.8-4.4-4.1-5.7-3.8.1,3.1.5,6.7,5.8,7.2,3.7.3,6.7-1.5,7-3.8.4-2.6-2-4.3-3.7-1.6-1.4-4.5,2.4-6.1,4.9-3.2-1.9-4.5-1.8-7.7,2.4-10.9,3,4,2.6,7.3-1.2,11.1,2.4-1.3,6.2,0,4,4.6-1.2-2.8-3.7-2.2-4.2.2-.3,1.7.7,3.7,3,4.2,1.9.3,4.7-.9,7-5.9-1.3,0-2.4.7-3.9,1.7l2.4-8c.6,2.3,1.4,3.7,2.2,4.5.6-1.6.5-2.8,0-5.3l5,1.8c-2.6,3.6-5.2,8.7-7.3,17.5-7.4-1.1-15.7-1.7-24.5-1.7h0c-8.8,0-17.1.6-24.5,1.7-2.1-8.9-4.7-13.9-7.3-17.5l5-1.8c-.5,2.5-.6,3.7,0,5.3.8-.8,1.6-2.3,2.2-4.5l2.4,8c-1.5-1-2.6-1.7-3.9-1.7,2.3,5,5.2,6.2,7,5.9,2.3-.4,3.3-2.4,3-4.2-.5-2.4-3-3.1-4.2-.2-2.2-4.6,1.6-6,4-4.6-3.7-3.7-4.2-7.1-1.2-11.1,4.2,3.2,4.3,6.4,2.4,10.9,2.5-2.8,6.3-1.3,4.9,3.2-1.8-2.7-4.1-1-3.7,1.6.3,2.3,3.3,4.1,7,3.8,5.4-.5,5.7-4.2,5.8-7.2-1.3-.2-3.7,1-5.7,3.8l-.7-8.5c2.2,2.3,4.2,2.7,6.4,2.8-.7-2.3-4.1-6.1-4.1-6.1h10.6,0Z"/>
33
+ </g>
34
+ {%- endset %}
35
+
36
+ {#- St. Edward's Crown was the logo under Elizabeth II. It's included to avoid
37
+ a breaking change in services. It can be removed in Frontend v6. #}
38
+ {%- set _stEdwardsCrown %}
39
+ <path d="M13.4,22.3c2,.8,4.2-.2,5-2s-.2-4.2-2-5c-2-.8-4.2.2-5,2-.8,2,0,4.2,2,5M4.8,27.3c2,.8,4.2-.2,5-2s-.2-4.2-2-5c-2-.8-4.2.2-5,2-1,2,0,4.2,2,5M2.2,36.9c2,.8,4.2-.2,5-2,.8-2-.2-4.2-2-5-2-.8-4.2.2-5,2-.8,2,0,4.2,2,5M23,25.3c2,.8,4.2-.2,5-2s-.2-4.2-2-5c-2-.8-4.2.2-5,2s0,4.2,2,5M57.8,22.3c-2,.8-4.2-.2-5-2s.2-4.2,2-5c2-.8,4.2.2,5,2,1,2,0,4.2-2,5M66.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.6,7.6,1.2,11.4-2.6-1.4-6.4,0-4.2,4.8,1.2-3,3.8-2.2,4.4.2.4,1.8-.8,3.8-3,4.4-2,.4-5-1-7.4-6,1.4,0,2.6.8,4,1.8l-3-8.4c-.6,2.4-1.4,3.8-2.4,4.8-.6-1.6-.4-3,0-5.6l-5.2,1.8c3,3.8,5.6,9,7.8,18.2,7.6-1,16.4-1.8,25.4-1.8"/>
40
+ {%- endset %}
41
+
42
+ {#- The GOV.UK logotype with standard dot. This needs to be slightly offset if
43
+ using the St. Edward's Crown, as that crown is wider. #}
44
+ {%- set _logotype %}
45
+ <path {%- if not useTudorCrown %} transform="translate(8 0)"{% endif %} d="M88.6,33.2c0,1.8.2,3.4.6,5s1.2,3,2,4.4c1,1.2,2,2.2,3.4,3s3,1.2,5,1.2,3.4-.2,4.6-.8,2.2-1.4,3-2.2,1.2-1.8,1.6-3c.2-1,.4-2,.4-3v-.4h-10.6v-6.4h18.8v23h-7.4v-5c-.6.8-1.2,1.6-2,2.2-.8.6-1.6,1.2-2.6,1.8-1,.4-2,.8-3.2,1.2s-2.4.4-3.6.4c-3,0-5.8-.6-8-1.6-2.4-1.2-4.4-2.6-6-4.6s-2.8-4.2-3.6-6.8c-.6-2.8-1-5.6-1-8.6s.4-5.8,1.4-8.4,2.2-4.8,4-6.8,3.8-3.4,6.2-4.6c2.4-1.2,5.2-1.6,8.2-1.6s3.8.2,5.6.6c1.8.4,3.4,1.2,4.8,2s2.8,1.8,3.8,3c1.2,1.2,2,2.6,2.8,4l-7.4,4.2c-.4-.8-1-1.8-1.6-2.4-.6-.8-1.2-1.4-2-2s-1.6-1-2.6-1.4-2.2-.4-3.4-.4c-2,0-3.6.4-5,1.2-1.4.8-2.6,1.8-3.4,3-1,1.2-1.6,2.8-2,4.4-.6,1.6-.8,3.8-.8,5.4ZM161.4,24.6c-.8-2.6-2.2-4.8-4-6.8s-3.8-3.4-6.2-4.6c-2.4-1.2-5.2-1.6-8.4-1.6s-5.8.6-8.4,1.6c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-5.4,2.4-5.4,5.4s2.4,5.4,5.4,5.4,5.4-2.4,5.4-5.4-2.4-5.4-5.4-5.4Z"/>
46
+ {%- endset %}
47
+
48
+ {#- The GOV.UK logotype with raised and coloured dot. This is only intended for
49
+ use alongide the Tudor Crown, so don't bother with offsetting for the
50
+ St. Edward's Crown. #}
51
+ {%- set _dotLogotype %}
52
+ <circle class="govuk-logo-dot" cx="227" cy="36" r="7.3"/>
53
+ <path d="M94.7,36.1c0,1.9.2,3.6.7,5.4.5,1.7,1.2,3.2,2.1,4.5.9,1.3,2.2,2.4,3.6,3.2,1.5.8,3.2,1.2,5.3,1.2s3.6-.3,4.9-.9c1.3-.6,2.3-1.4,3.1-2.3.8-.9,1.3-2,1.6-3,.3-1.1.5-2.1.5-3v-.4h-11v-6.6h19.5v24h-7.7v-5.4c-.5.8-1.2,1.6-2,2.3-.8.7-1.7,1.3-2.7,1.8-1,.5-2.1.9-3.3,1.2-1.2.3-2.5.4-3.8.4-3.2,0-6-.6-8.4-1.7-2.5-1.1-4.5-2.7-6.2-4.7-1.7-2-3-4.4-3.8-7.1-.9-2.7-1.3-5.6-1.3-8.7s.5-6,1.5-8.7,2.4-5.1,4.2-7.1c1.8-2,4-3.6,6.5-4.7s5.4-1.7,8.6-1.7,4,.2,5.9.7c1.8.5,3.5,1.1,5.1,2,1.5.9,2.9,1.9,4,3.2,1.2,1.2,2.1,2.6,2.8,4.1l-7.7,4.3c-.5-.9-1-1.8-1.6-2.6-.6-.8-1.3-1.5-2.2-2.1-.8-.6-1.7-1-2.8-1.4-1-.3-2.2-.5-3.5-.5-2,0-3.8.4-5.3,1.2s-2.7,1.9-3.6,3.2c-.9,1.3-1.7,2.8-2.1,4.6s-.7,3.5-.7,5.3v.3h0ZM152.9,13.7c3.2,0,6.1.6,8.7,1.7,2.6,1.2,4.7,2.7,6.5,4.7,1.8,2,3.1,4.4,4.1,7.1s1.4,5.6,1.4,8.7-.5,6-1.4,8.7c-.9,2.7-2.3,5.1-4.1,7.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focusable="false"` so that Internet Explorer does not treat
57
+ it as an interactive element - without this it will be 'focusable' when using
58
+ the keyboard to navigate. #}
59
+ <svg
60
+ focusable="false"
61
+ role="{{ "img" if params.ariaLabelText else "presentation" }}"
62
+ xmlns="http://www.w3.org/2000/svg"
63
+ {#- The viewbox is 2x the actual display dimensions #}
64
+ viewBox="0 0 {{ svgWidth * 2 }} 60"
65
+ height="30"
66
+ width="{{ svgWidth }}"
67
+ fill="currentcolor"
68
+ {%- if params.classes %} class="{{ params.classes }}"{% endif %}
69
+ {%- if params.ariaLabelText %} aria-label="{{ params.ariaLabelText }}"{% endif %}
70
+ {{- govukAttributes(params.attributes) }}
71
+ >
72
+ {%- if params.ariaLabelText %}<title>{{ params.ariaLabelText }}</title>{% endif %}
73
+ {{ (_stEdwardsCrown if not useTudorCrown else _tudorCrown) | safe | trim | indent(2) }}
74
+ {% if useLogotype %}
75
+ {{ (_dotLogotype if rebrand else _logotype) | safe | trim | indent(2) }}
76
+ {% endif %}
77
+ </svg>
78
+ {% endmacro %}
@@ -5,7 +5,11 @@
5
5
  .govuk-template {
6
6
  // Set the overall page background colour to the same colour as used by the
7
7
  // footer to give the illusion of a long footer.
8
- background-color: $govuk-canvas-background-colour;
8
+ @include _govuk-rebrand(
9
+ background-color,
10
+ $from: $govuk-template-background-colour,
11
+ $to: $_govuk-rebrand-template-background-colour
12
+ );
9
13
 
10
14
  // Prevent automatic text sizing, as we already cater for small devices and
11
15
  // would like the browser to stay on 100% text zoom by default.
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/govuk/objects/_template.scss"],"names":[],"mappings":"AAAA,iBAAiB;;AAEjB;EACE,+BAA+B;EAC/B;IACE,0EAA0E;IAC1E,+CAA+C;IAC/C,iDAAiD;;IAEjD,0EAA0E;IAC1E,8DAA8D;IAC9D,8BAAsB;OAAtB,2BAAsB;YAAtB,sBAAsB;;IAEtB,sEAAsE;IACtE,sCAAsC;IACtC,CAAC;IACD,0EAA0E;IAC1E,kGAAkG;IAClG,iCAAiC;IACjC,CAAC;IACD,4EAA4E;IAC5E,yEAAyE;IACzE,oEAAoE;IACpE,+EAA+E;IAC/E,+CAA+C;IAC/C;MACE,oCAAoC;;MAEpC;QACE,qBAAqB;MACvB;IACF;;IAEA,yEAAyE;IACzE,mEAAmE;IACnE;MACE,kBAAkB;IACpB;EACF;;EAEA,+BAA+B;EAC/B;IACE,2EAA2E;IAC3E,iBAAiB;IACjB,SAAS;IACT,yEAAyE;IACzE,+CAA+C;EACjD;AACF","file":"_template.scss","sourcesContent":["@import \"../base\";\n\n@include govuk-exports(\"govuk/objects/template\") {\n // Applied to the <html> element\n .govuk-template {\n // Set the overall page background colour to the same colour as used by the\n // footer to give the illusion of a long footer.\n background-color: $govuk-canvas-background-colour;\n\n // Prevent automatic text sizing, as we already cater for small devices and\n // would like the browser to stay on 100% text zoom by default.\n text-size-adjust: 100%;\n\n // Add scroll padding to the top of govuk-template but remove it if the\n // exit this page component is present.\n //\n // This is a solution to exit this page potentially failing WCAG SC 2.4.12:\n // Focus Not Obscured (https://www.w3.org/WAI/WCAG22/Understanding/focus-not-obscured-minimum.html)\n // due to it's sticky positioning.\n //\n // This will apply scroll-padding-top in any browsers that don't support :has\n // (https://caniuse.com/css-has). This is part of the reason we do this in\n // a \"wrong way round\" way as we hypothesise that the risks of having\n // scroll-padding unnecessarily is better than risking not having scroll-padding\n // and needing it to account for exit this page.\n @supports (position: sticky) {\n scroll-padding-top: govuk-spacing(9);\n\n &:not(:has(.govuk-exit-this-page)) {\n scroll-padding-top: 0;\n }\n }\n\n // Force the scrollbar to always display in IE, to prevent horizontal page\n // jumps as content height changes (e.g. autocomplete results open).\n @include govuk-media-query($media-type: screen) {\n overflow-y: scroll;\n }\n }\n\n // Applied to the <body> element\n .govuk-template__body {\n // The default margins set by user-agents are not required since we have our\n // own containers.\n margin: 0;\n // Set the overall body of the page back to the typical background colour.\n background-color: $govuk-body-background-colour;\n }\n}\n"]}
1
+ {"version":3,"sources":["../../../src/govuk/objects/_template.scss"],"names":[],"mappings":"AAAA,iBAAiB;;AAEjB;EACE,+BAA+B;EAC/B;IACE,0EAA0E;IAC1E,+CAA+C;IAC/C;;;;KAIC;;IAED,0EAA0E;IAC1E,8DAA8D;IAC9D,8BAAsB;OAAtB,2BAAsB;YAAtB,sBAAsB;;IAEtB,sEAAsE;IACtE,sCAAsC;IACtC,CAAC;IACD,0EAA0E;IAC1E,kGAAkG;IAClG,iCAAiC;IACjC,CAAC;IACD,4EAA4E;IAC5E,yEAAyE;IACzE,oEAAoE;IACpE,+EAA+E;IAC/E,+CAA+C;IAC/C;MACE,oCAAoC;;MAEpC;QACE,qBAAqB;MACvB;IACF;;IAEA,yEAAyE;IACzE,mEAAmE;IACnE;MACE,kBAAkB;IACpB;EACF;;EAEA,+BAA+B;EAC/B;IACE,2EAA2E;IAC3E,iBAAiB;IACjB,SAAS;IACT,yEAAyE;IACzE,+CAA+C;EACjD;AACF","file":"_template.scss","sourcesContent":["@import \"../base\";\n\n@include govuk-exports(\"govuk/objects/template\") {\n // Applied to the <html> element\n .govuk-template {\n // Set the overall page background colour to the same colour as used by the\n // footer to give the illusion of a long footer.\n @include _govuk-rebrand(\n background-color,\n $from: $govuk-template-background-colour,\n $to: $_govuk-rebrand-template-background-colour\n );\n\n // Prevent automatic text sizing, as we already cater for small devices and\n // would like the browser to stay on 100% text zoom by default.\n text-size-adjust: 100%;\n\n // Add scroll padding to the top of govuk-template but remove it if the\n // exit this page component is present.\n //\n // This is a solution to exit this page potentially failing WCAG SC 2.4.12:\n // Focus Not Obscured (https://www.w3.org/WAI/WCAG22/Understanding/focus-not-obscured-minimum.html)\n // due to it's sticky positioning.\n //\n // This will apply scroll-padding-top in any browsers that don't support :has\n // (https://caniuse.com/css-has). This is part of the reason we do this in\n // a \"wrong way round\" way as we hypothesise that the risks of having\n // scroll-padding unnecessarily is better than risking not having scroll-padding\n // and needing it to account for exit this page.\n @supports (position: sticky) {\n scroll-padding-top: govuk-spacing(9);\n\n &:not(:has(.govuk-exit-this-page)) {\n scroll-padding-top: 0;\n }\n }\n\n // Force the scrollbar to always display in IE, to prevent horizontal page\n // jumps as content height changes (e.g. autocomplete results open).\n @include govuk-media-query($media-type: screen) {\n overflow-y: scroll;\n }\n }\n\n // Applied to the <body> element\n .govuk-template__body {\n // The default margins set by user-agents are not required since we have our\n // own containers.\n margin: 0;\n // Set the overall body of the page back to the typical background colour.\n background-color: $govuk-body-background-colour;\n }\n}\n"]}
@@ -28,11 +28,15 @@
28
28
  @include govuk-typography-weight-bold($important: true);
29
29
  }
30
30
 
31
- // Tabular numbers
31
+ // Typography helpers
32
32
 
33
33
  .govuk-\!-font-tabular-numbers {
34
34
  @include govuk-font-tabular-numbers($important: true);
35
35
  }
36
+
37
+ .govuk-\!-text-break-word {
38
+ @include govuk-text-break-word($important: true);
39
+ }
36
40
  }
37
41
 
38
42
  /*# sourceMappingURL=_typography.scss.map */
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/govuk/overrides/_typography.scss"],"names":[],"mappings":"AAAA;EACE,2BAA2B;;EAE3B,0EAA0E;EAC1E,4CAA4C;EAC5C,CAAC;EACD,oCAAoC;EACpC;IACE;MACE,kDAAkD;;MAElD,oDAAoD;MACpD;QACE,gBAAgB;MAClB;;MAEA,iDAAiD;IACnD;EACF;;EAEA,SAAS;;EAET;IACE,0DAA0D;EAC5D;;EAEA;IACE,uDAAuD;EACzD;;EAEA,iBAAiB;;EAEjB;IACE,qDAAqD;EACvD;AACF","file":"_typography.scss","sourcesContent":["@include govuk-exports(\"govuk/overrides/typography\") {\n // Font size and line height\n\n // Generate typography override classes for each responsive font map in the\n // typography scale eg .govuk-\\!-font-size-80\n //\n // govuk-!-font-size-14 is deprecated\n @each $size, $font-map in $govuk-typography-scale {\n .govuk-\\!-font-size-#{$size} {\n $font-map: map-get($govuk-typography-scale, $size);\n\n // Add underscore to deprecated typography scale keys\n @if map-has-key($font-map, \"deprecation\") {\n $size: _#{$size};\n }\n\n @include govuk-font-size($size, $important: true);\n }\n }\n\n // Weights\n\n .govuk-\\!-font-weight-regular {\n @include govuk-typography-weight-regular($important: true);\n }\n\n .govuk-\\!-font-weight-bold {\n @include govuk-typography-weight-bold($important: true);\n }\n\n // Tabular numbers\n\n .govuk-\\!-font-tabular-numbers {\n @include govuk-font-tabular-numbers($important: true);\n }\n}\n"]}
1
+ {"version":3,"sources":["../../../src/govuk/overrides/_typography.scss"],"names":[],"mappings":"AAAA;EACE,2BAA2B;;EAE3B,0EAA0E;EAC1E,4CAA4C;EAC5C,CAAC;EACD,oCAAoC;EACpC;IACE;MACE,kDAAkD;;MAElD,oDAAoD;MACpD;QACE,gBAAgB;MAClB;;MAEA,iDAAiD;IACnD;EACF;;EAEA,SAAS;;EAET;IACE,0DAA0D;EAC5D;;EAEA;IACE,uDAAuD;EACzD;;EAEA,oBAAoB;;EAEpB;IACE,qDAAqD;EACvD;;EAEA;IACE,gDAAgD;EAClD;AACF","file":"_typography.scss","sourcesContent":["@include govuk-exports(\"govuk/overrides/typography\") {\n // Font size and line height\n\n // Generate typography override classes for each responsive font map in the\n // typography scale eg .govuk-\\!-font-size-80\n //\n // govuk-!-font-size-14 is deprecated\n @each $size, $font-map in $govuk-typography-scale {\n .govuk-\\!-font-size-#{$size} {\n $font-map: map-get($govuk-typography-scale, $size);\n\n // Add underscore to deprecated typography scale keys\n @if map-has-key($font-map, \"deprecation\") {\n $size: _#{$size};\n }\n\n @include govuk-font-size($size, $important: true);\n }\n }\n\n // Weights\n\n .govuk-\\!-font-weight-regular {\n @include govuk-typography-weight-regular($important: true);\n }\n\n .govuk-\\!-font-weight-bold {\n @include govuk-typography-weight-bold($important: true);\n }\n\n // Typography helpers\n\n .govuk-\\!-font-tabular-numbers {\n @include govuk-font-tabular-numbers($important: true);\n }\n\n .govuk-\\!-text-break-word {\n @include govuk-text-break-word($important: true);\n }\n}\n"]}
@@ -29,9 +29,31 @@ $govuk-text-colour: govuk-colour("black") !default;
29
29
  ///
30
30
  /// @type Colour
31
31
  /// @access public
32
-
32
+ /// @deprecated "$govuk-canvas-background-colour has been deprecated and will be removed in the next major
33
+ /// version. Use `$govuk-template-background-colour` if you want to change the background of
34
+ /// the `<html>` element and background colour of elements that need to match for visual
35
+ /// continuity.
33
36
  $govuk-canvas-background-colour: govuk-colour("light-grey") !default;
34
37
 
38
+ // Output a deprecation warning if $govuk-canvas-background-colour is being overridden
39
+ // Remove in next major version.
40
+ @if $govuk-canvas-background-colour != govuk-colour("light-grey") {
41
+ @include _warning(
42
+ "$govuk-canvas-background-colour",
43
+ "$govuk-canvas-background-colour has been deprecated and will be removed in the next major version."
44
+ );
45
+ }
46
+
47
+ /// Template background colour
48
+ ///
49
+ /// Used by components that want to give the illusion of extending
50
+ /// the template background (such as the footer and cookie banner).
51
+ ///
52
+ /// @type Colour
53
+ /// @access public
54
+
55
+ $govuk-template-background-colour: govuk-colour("light-grey") !default;
56
+
35
57
  /// Body background colour
36
58
  ///
37
59
  /// @type Colour
@@ -154,4 +176,20 @@ $govuk-link-hover-colour: govuk-colour("dark-blue") !default;
154
176
 
155
177
  $govuk-link-active-colour: govuk-colour("black") !default;
156
178
 
179
+ // =============================================================================
180
+ // Brand refresh
181
+ // =============================================================================
182
+
183
+ /// Updated template background colour
184
+ ///
185
+ /// @type Colour
186
+ /// @access private
187
+ $_govuk-rebrand-template-background-colour: #f4f8fb; // Blue tint 95%
188
+
189
+ /// Border colour for areas on a light-blue background
190
+ ///
191
+ /// @type Colour
192
+ /// @access private
193
+ $_govuk-rebrand-border-colour-on-blue-tint-95: #8eb8dc; // Blue tint 50%
194
+
157
195
  /*# sourceMappingURL=_colours-applied.scss.map */
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/govuk/settings/_colours-applied.scss"],"names":[],"mappings":"AAAA,GAAG;AACH,0BAA0B;AAC1B,GAAG;;AAEH,2BAA2B;;AAE3B,2DAA2D;AAC3D,SAAS;AACT,2DAA2D;;AAE3D,eAAe;AACf,EAAE;AACF,eAAe;AACf,iBAAi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AAEjB,iDAAiD;;AAEjD,sBAAsB;AACtB,EAAE;AACF,eAAe;AACf,iBAAiB;;AAEjB,2DAA2D;;AAE3D,oBAAoB;AACpB,EAAE;AACF,eAAe;AACf,iBAAiB;;AAEjB,4DAA4D;;AAE5D,qBAAqB;AACrB,EAAE;AACF,eAAe;AACf,iBAAiB;;AAEjB,yDAAyD","file":"_colours-applied.scss","sourcesContent":["////\n/// @group settings/colours\n////\n\n@import \"../helpers/colour\";\n\n// =========================================================\n// Generic\n// =========================================================\n\n/// Brand colour\n///\n/// @type Colour\n/// @access public\n\n$govuk-brand-colour: govuk-colour(\"blue\") !default;\n\n/// Text colour\n///\n/// @type Colour\n/// @access public\n\n$govuk-text-colour: govuk-colour(\"black\") !default;\n\n/// Canvas background colour\n///\n/// Used by the footer component and template to give the illusion of a long\n/// footer.\n///\n/// @type Colour\n/// @access public\n\n$govuk-canvas-background-colour: govuk-colour(\"light-grey\") !default;\n\n/// Body background colour\n///\n/// @type Colour\n/// @access public\n\n$govuk-body-background-colour: govuk-colour(\"white\") !default;\n\n/// Text colour for print media\n///\n/// Use 'true black' to avoid printers using colour ink to print body text\n///\n/// @type Colour\n/// @access public\n\n$govuk-print-text-colour: #000000 !default;\n\n/// Secondary text colour\n///\n/// Used in for example 'muted' text and help text.\n///\n/// @type Colour\n/// @access public\n\n$govuk-secondary-text-colour: govuk-colour(\"dark-grey\") !default;\n\n/// Focus colour\n///\n/// Used for outline (and background, where appropriate) when interactive\n/// elements (links, form controls) have keyboard focus.\n///\n/// @type Colour\n/// @access public\n\n$govuk-focus-colour: govuk-colour(\"yellow\") !default;\n\n/// Focused text colour\n///\n/// Ensure that the contrast between the text and background colour passes\n/// WCAG Level AA contrast requirements.\n///\n/// @type Colour\n/// @access public\n\n$govuk-focus-text-colour: govuk-colour(\"black\") !default;\n\n/// Error colour\n///\n/// Used to highlight error messages and form controls in an error state\n///\n/// @type Colour\n/// @access public\n\n$govuk-error-colour: govuk-colour(\"red\") !default;\n\n/// Success colour\n///\n/// Used to highlight success messages and banners\n///\n/// @type Colour\n/// @access public\n\n$govuk-success-colour: govuk-colour(\"green\") !default;\n\n/// Border colour\n///\n/// Used in for example borders, separators, rules and keylines.\n///\n/// @type Colour\n/// @access public\n\n$govuk-border-colour: govuk-colour(\"mid-grey\") !default;\n\n/// Input border colour\n///\n/// Used for form inputs and controls\n///\n/// @type Colour\n/// @access public\n\n$govuk-input-border-colour: govuk-colour(\"black\") !default;\n\n/// Input hover colour\n///\n/// Used for hover states on form controls\n///\n/// @type Colour\n/// @access public\n\n$govuk-hover-colour: govuk-colour(\"mid-grey\") !default;\n\n// =============================================================================\n// Links\n// =============================================================================\n\n/// Link colour\n///\n/// @type Colour\n/// @access public\n\n$govuk-link-colour: govuk-colour(\"blue\") !default;\n\n/// Visited link colour\n///\n/// @type Colour\n/// @access public\n\n$govuk-link-visited-colour: govuk-colour(\"purple\") !default;\n\n/// Link hover colour\n///\n/// @type Colour\n/// @access public\n\n$govuk-link-hover-colour: govuk-colour(\"dark-blue\") !default;\n\n/// Active link colour\n///\n/// @type Colour\n/// @access public\n\n$govuk-link-active-colour: govuk-colour(\"black\") !default;\n"]}
1
+ {"version":3,"sources":["../../../src/govuk/settings/_colours-applied.scss"],"names":[],"mappings":"AAAA,GAAG;AACH,0BAA0B;AAC1B,GAAG;;AAEH,2BAA2B;;AAE3B,2DAA2D;AAC3D,SAAS;AACT,2DAA2D;;AAE3D,eAAe;AACf,EAAE;AACF,eAAe;AACf,iBAAiB;;AAEjB,kDAAkD;;AAElD,cAAc;AACd,EAAE;AACF,eAAe;AACf,iBAAiB;;AAEjB,kDAAkD;;AAElD,2BAA2B;AAC3B,EAAE;AACF,2EAA2E;AAC3E,UAAU;AACV,EAAE;AACF,eAAe;AACf,iBAAiB;AACjB,yGAAyG;AACzG,2FAA2F;AAC3F,uFAAuF;AACvF,cAAc;AACd,oEAAoE;;AAEpE,qFAAqF;AACrF,+BAA+B;AAC/B;EACE;;;GAGC;AACH;;AAEA,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E3D,oBAAoB;AACpB,EAAE;AACF,eAAe;AACf,iBAAiB;;AAEjB,4DAA4D;;AAE5D,qBAAqB;AACrB,EAAE;AACF,eAAe;AACf,iBAAiB;;AAEjB,yDAAyD;;AAEzD,+EAA+E;AAC/E,eAAe;AACf,+EAA+E;;AAE/E,qCAAqC;AACrC,EAAE;AACF,eAAe;AACf,kBAAkB;AAClB,mDAAmD,EAAE,eAAe;;AAEpE,qDAAqD;AACrD,EAAE;AACF,eAAe;AACf,kBAAkB;AAClB,sDAAsD,EAAE,eAAe","file":"_colours-applied.scss","sourcesContent":["////\n/// @group settings/colours\n////\n\n@import \"../helpers/colour\";\n\n// =========================================================\n// Generic\n// =========================================================\n\n/// Brand colour\n///\n/// @type Colour\n/// @access public\n\n$govuk-brand-colour: govuk-colour(\"blue\") !default;\n\n/// Text colour\n///\n/// @type Colour\n/// @access public\n\n$govuk-text-colour: govuk-colour(\"black\") !default;\n\n/// Canvas background colour\n///\n/// Used by the footer component and template to give the illusion of a long\n/// footer.\n///\n/// @type Colour\n/// @access public\n/// @deprecated \"$govuk-canvas-background-colour has been deprecated and will be removed in the next major\n/// version. Use `$govuk-template-background-colour` if you want to change the background of\n/// the `<html>` element and background colour of elements that need to match for visual\n/// continuity.\n$govuk-canvas-background-colour: govuk-colour(\"light-grey\") !default;\n\n// Output a deprecation warning if $govuk-canvas-background-colour is being overridden\n// Remove in next major version.\n@if $govuk-canvas-background-colour != govuk-colour(\"light-grey\") {\n @include _warning(\n \"$govuk-canvas-background-colour\",\n \"$govuk-canvas-background-colour has been deprecated and will be removed in the next major version.\"\n );\n}\n\n/// Template background colour\n///\n/// Used by components that want to give the illusion of extending\n/// the template background (such as the footer and cookie banner).\n///\n/// @type Colour\n/// @access public\n\n$govuk-template-background-colour: govuk-colour(\"light-grey\") !default;\n\n/// Body background colour\n///\n/// @type Colour\n/// @access public\n\n$govuk-body-background-colour: govuk-colour(\"white\") !default;\n\n/// Text colour for print media\n///\n/// Use 'true black' to avoid printers using colour ink to print body text\n///\n/// @type Colour\n/// @access public\n\n$govuk-print-text-colour: #000000 !default;\n\n/// Secondary text colour\n///\n/// Used in for example 'muted' text and help text.\n///\n/// @type Colour\n/// @access public\n\n$govuk-secondary-text-colour: govuk-colour(\"dark-grey\") !default;\n\n/// Focus colour\n///\n/// Used for outline (and background, where appropriate) when interactive\n/// elements (links, form controls) have keyboard focus.\n///\n/// @type Colour\n/// @access public\n\n$govuk-focus-colour: govuk-colour(\"yellow\") !default;\n\n/// Focused text colour\n///\n/// Ensure that the contrast between the text and background colour passes\n/// WCAG Level AA contrast requirements.\n///\n/// @type Colour\n/// @access public\n\n$govuk-focus-text-colour: govuk-colour(\"black\") !default;\n\n/// Error colour\n///\n/// Used to highlight error messages and form controls in an error state\n///\n/// @type Colour\n/// @access public\n\n$govuk-error-colour: govuk-colour(\"red\") !default;\n\n/// Success colour\n///\n/// Used to highlight success messages and banners\n///\n/// @type Colour\n/// @access public\n\n$govuk-success-colour: govuk-colour(\"green\") !default;\n\n/// Border colour\n///\n/// Used in for example borders, separators, rules and keylines.\n///\n/// @type Colour\n/// @access public\n\n$govuk-border-colour: govuk-colour(\"mid-grey\") !default;\n\n/// Input border colour\n///\n/// Used for form inputs and controls\n///\n/// @type Colour\n/// @access public\n\n$govuk-input-border-colour: govuk-colour(\"black\") !default;\n\n/// Input hover colour\n///\n/// Used for hover states on form controls\n///\n/// @type Colour\n/// @access public\n\n$govuk-hover-colour: govuk-colour(\"mid-grey\") !default;\n\n// =============================================================================\n// Links\n// =============================================================================\n\n/// Link colour\n///\n/// @type Colour\n/// @access public\n\n$govuk-link-colour: govuk-colour(\"blue\") !default;\n\n/// Visited link colour\n///\n/// @type Colour\n/// @access public\n\n$govuk-link-visited-colour: govuk-colour(\"purple\") !default;\n\n/// Link hover colour\n///\n/// @type Colour\n/// @access public\n\n$govuk-link-hover-colour: govuk-colour(\"dark-blue\") !default;\n\n/// Active link colour\n///\n/// @type Colour\n/// @access public\n\n$govuk-link-active-colour: govuk-colour(\"black\") !default;\n\n// =============================================================================\n// Brand refresh\n// =============================================================================\n\n/// Updated template background colour\n///\n/// @type Colour\n/// @access private\n$_govuk-rebrand-template-background-colour: #f4f8fb; // Blue tint 95%\n\n/// Border colour for areas on a light-blue background\n///\n/// @type Colour\n/// @access private\n$_govuk-rebrand-border-colour-on-blue-tint-95: #8eb8dc; // Blue tint 50%\n"]}