govuk_publishing_components 60.0.2 → 60.2.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 (386) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +2 -0
  3. data/app/assets/javascripts/govuk_publishing_components/analytics-ga4/ga4-page-views.js +11 -1
  4. data/app/assets/javascripts/govuk_publishing_components/components/feedback.js +0 -14
  5. data/app/assets/javascripts/govuk_publishing_components/vendor/lux/lux-reporter.js +570 -595
  6. data/app/assets/stylesheets/govuk_publishing_components/components/govspeak/_footnotes.scss +5 -0
  7. data/app/views/govuk_publishing_components/audit/_applications.html.erb +13 -13
  8. data/app/views/govuk_publishing_components/audit/_component_contents.html.erb +2 -2
  9. data/app/views/govuk_publishing_components/audit/_components.html.erb +17 -19
  10. data/app/views/govuk_publishing_components/audit/_items_in_applications.html.erb +3 -3
  11. data/app/views/govuk_publishing_components/audit/show.html.erb +5 -6
  12. data/app/views/govuk_publishing_components/component_guide/component_doc/_call.html.erb +2 -2
  13. data/app/views/govuk_publishing_components/component_guide/example.html.erb +4 -5
  14. data/app/views/govuk_publishing_components/component_guide/index.html.erb +9 -10
  15. data/app/views/govuk_publishing_components/component_guide/preview.html.erb +1 -1
  16. data/app/views/govuk_publishing_components/component_guide/show.html.erb +9 -10
  17. data/app/views/govuk_publishing_components/components/_accordion.html.erb +5 -5
  18. data/app/views/govuk_publishing_components/components/_action_link.html.erb +2 -2
  19. data/app/views/govuk_publishing_components/components/_add_another.html.erb +3 -3
  20. data/app/views/govuk_publishing_components/components/_attachment.html.erb +4 -4
  21. data/app/views/govuk_publishing_components/components/_back_link.html.erb +1 -1
  22. data/app/views/govuk_publishing_components/components/_back_to_top_link.html.erb +1 -1
  23. data/app/views/govuk_publishing_components/components/_big_number.html.erb +1 -1
  24. data/app/views/govuk_publishing_components/components/_cards.html.erb +4 -4
  25. data/app/views/govuk_publishing_components/components/_character_count.html.erb +1 -1
  26. data/app/views/govuk_publishing_components/components/_checkboxes.html.erb +3 -3
  27. data/app/views/govuk_publishing_components/components/_contents_list.html.erb +6 -9
  28. data/app/views/govuk_publishing_components/components/_contents_list_with_body.html.erb +2 -2
  29. data/app/views/govuk_publishing_components/components/_contextual_breadcrumbs.html.erb +2 -2
  30. data/app/views/govuk_publishing_components/components/_contextual_footer.html.erb +1 -1
  31. data/app/views/govuk_publishing_components/components/_contextual_sidebar.html.erb +6 -6
  32. data/app/views/govuk_publishing_components/components/_cookie_banner.html.erb +6 -6
  33. data/app/views/govuk_publishing_components/components/_date_input.html.erb +5 -5
  34. data/app/views/govuk_publishing_components/components/_details.html.erb +1 -1
  35. data/app/views/govuk_publishing_components/components/_devolved_nations.html.erb +1 -1
  36. data/app/views/govuk_publishing_components/components/_document_list.html.erb +8 -8
  37. data/app/views/govuk_publishing_components/components/_emergency_banner.html.erb +3 -3
  38. data/app/views/govuk_publishing_components/components/_feedback.html.erb +2 -2
  39. data/app/views/govuk_publishing_components/components/_fieldset.html.erb +3 -4
  40. data/app/views/govuk_publishing_components/components/_figure.html.erb +1 -1
  41. data/app/views/govuk_publishing_components/components/_file_upload.html.erb +5 -5
  42. data/app/views/govuk_publishing_components/components/_glance_metric.html.erb +1 -1
  43. data/app/views/govuk_publishing_components/components/_global_banner.html.erb +2 -2
  44. data/app/views/govuk_publishing_components/components/_google_tag_manager_script.html.erb +7 -7
  45. data/app/views/govuk_publishing_components/components/_govspeak_html_publication.html.erb +1 -1
  46. data/app/views/govuk_publishing_components/components/_image_card.html.erb +4 -5
  47. data/app/views/govuk_publishing_components/components/_input.html.erb +14 -14
  48. data/app/views/govuk_publishing_components/components/_intervention.html.erb +4 -6
  49. data/app/views/govuk_publishing_components/components/_label.html.erb +1 -1
  50. data/app/views/govuk_publishing_components/components/_layout_footer.html.erb +6 -9
  51. data/app/views/govuk_publishing_components/components/_layout_for_admin.html.erb +2 -2
  52. data/app/views/govuk_publishing_components/components/_layout_for_public.html.erb +15 -15
  53. data/app/views/govuk_publishing_components/components/_layout_super_navigation_header.html.erb +16 -19
  54. data/app/views/govuk_publishing_components/components/_machine_readable_metadata.html.erb +18 -17
  55. data/app/views/govuk_publishing_components/components/_metadata.html.erb +4 -4
  56. data/app/views/govuk_publishing_components/components/_notice.html.erb +1 -1
  57. data/app/views/govuk_publishing_components/components/_option_select.html.erb +8 -9
  58. data/app/views/govuk_publishing_components/components/_organisation_logo.html.erb +1 -1
  59. data/app/views/govuk_publishing_components/components/_password_input.html.erb +17 -17
  60. data/app/views/govuk_publishing_components/components/_phase_banner.html.erb +2 -3
  61. data/app/views/govuk_publishing_components/components/_previous_and_next_navigation.html.erb +6 -8
  62. data/app/views/govuk_publishing_components/components/_print_link.html.erb +3 -3
  63. data/app/views/govuk_publishing_components/components/_published_dates.html.erb +6 -7
  64. data/app/views/govuk_publishing_components/components/_radio.html.erb +7 -8
  65. data/app/views/govuk_publishing_components/components/_related_navigation.html.erb +4 -6
  66. data/app/views/govuk_publishing_components/components/_reorderable_list.html.erb +7 -7
  67. data/app/views/govuk_publishing_components/components/_search_with_autocomplete.html.erb +2 -2
  68. data/app/views/govuk_publishing_components/components/_secondary_navigation.html.erb +1 -1
  69. data/app/views/govuk_publishing_components/components/_select.html.erb +1 -1
  70. data/app/views/govuk_publishing_components/components/_select_with_search.html.erb +1 -1
  71. data/app/views/govuk_publishing_components/components/_share_links.html.erb +18 -18
  72. data/app/views/govuk_publishing_components/components/_signup_link.html.erb +3 -3
  73. data/app/views/govuk_publishing_components/components/_single_page_notification_button.html.erb +3 -3
  74. data/app/views/govuk_publishing_components/components/_skip_link.html.erb +2 -3
  75. data/app/views/govuk_publishing_components/components/_step_by_step_nav.html.erb +9 -10
  76. data/app/views/govuk_publishing_components/components/_step_by_step_nav_header.html.erb +2 -3
  77. data/app/views/govuk_publishing_components/components/_step_by_step_nav_related.html.erb +5 -9
  78. data/app/views/govuk_publishing_components/components/_subscription_links.html.erb +8 -8
  79. data/app/views/govuk_publishing_components/components/_summary_list.html.erb +1 -1
  80. data/app/views/govuk_publishing_components/components/_table.html.erb +3 -3
  81. data/app/views/govuk_publishing_components/components/_tag.html.erb +1 -1
  82. data/app/views/govuk_publishing_components/components/_textarea.html.erb +4 -4
  83. data/app/views/govuk_publishing_components/components/_translation_nav.html.erb +1 -2
  84. data/app/views/govuk_publishing_components/components/_warning_text.html.erb +2 -2
  85. data/app/views/govuk_publishing_components/components/attachment/_thumbnail_document.html.erb +1 -1
  86. data/app/views/govuk_publishing_components/components/attachment/_thumbnail_external.html.erb +1 -1
  87. data/app/views/govuk_publishing_components/components/attachment/_thumbnail_generic.html.erb +2 -2
  88. data/app/views/govuk_publishing_components/components/attachment/_thumbnail_html.html.erb +1 -1
  89. data/app/views/govuk_publishing_components/components/attachment/_thumbnail_pdf.html.erb +1 -1
  90. data/app/views/govuk_publishing_components/components/attachment/_thumbnail_spreadsheet.html.erb +3 -3
  91. data/app/views/govuk_publishing_components/components/cross_service_header/_one_login_header.html.erb +10 -10
  92. data/app/views/govuk_publishing_components/components/docs/govspeak.yml +7 -3
  93. data/app/views/govuk_publishing_components/components/feedback/_problem_form.html.erb +10 -10
  94. data/app/views/govuk_publishing_components/components/feedback/_yes_no_banner.html.erb +6 -8
  95. data/app/views/govuk_publishing_components/components/govuk_logo/_govuk_logo_crown_only.html.erb +1 -2
  96. data/app/views/govuk_publishing_components/components/layout_for_public/_account-layout.html.erb +2 -2
  97. data/app/views/govuk_publishing_components/components/layout_for_public/_account-navigation.html.erb +2 -2
  98. data/app/views/govuk_publishing_components/components/layout_header/_header_logo.html.erb +1 -1
  99. data/app/views/govuk_publishing_components/components/layout_header/_navigation_items.html.erb +2 -3
  100. data/app/views/govuk_publishing_components/components/metadata/_sentence.html.erb +1 -1
  101. data/app/views/govuk_publishing_components/components/related_navigation/_section.html.erb +4 -4
  102. data/app/views/govuk_publishing_components/components/search/_search_icon.html.erb +2 -3
  103. data/app/views/layouts/govuk_publishing_components/application.html.erb +3 -3
  104. data/lib/govuk_publishing_components/presenters/component_wrapper_helper.rb +1 -1
  105. data/lib/govuk_publishing_components/presenters/heading_helper.rb +3 -3
  106. data/lib/govuk_publishing_components/presenters/meta_tags.rb +1 -0
  107. data/lib/govuk_publishing_components/version.rb +1 -1
  108. data/node_modules/govuk-frontend/dist/govuk/all.bundle.js +99 -73
  109. data/node_modules/govuk-frontend/dist/govuk/all.bundle.js.map +1 -1
  110. data/node_modules/govuk-frontend/dist/govuk/all.bundle.mjs +99 -73
  111. data/node_modules/govuk-frontend/dist/govuk/all.bundle.mjs.map +1 -1
  112. data/node_modules/govuk-frontend/dist/govuk/common/configuration.mjs +29 -2
  113. data/node_modules/govuk-frontend/dist/govuk/common/configuration.mjs.map +1 -1
  114. data/node_modules/govuk-frontend/dist/govuk/common/govuk-frontend-version.mjs +1 -1
  115. data/node_modules/govuk-frontend/dist/govuk/common/index.mjs +5 -11
  116. data/node_modules/govuk-frontend/dist/govuk/common/index.mjs.map +1 -1
  117. data/node_modules/govuk-frontend/dist/govuk/component.mjs.map +1 -1
  118. data/node_modules/govuk-frontend/dist/govuk/components/accordion/accordion.bundle.js +13 -11
  119. data/node_modules/govuk-frontend/dist/govuk/components/accordion/accordion.bundle.js.map +1 -1
  120. data/node_modules/govuk-frontend/dist/govuk/components/accordion/accordion.bundle.mjs +13 -11
  121. data/node_modules/govuk-frontend/dist/govuk/components/accordion/accordion.bundle.mjs.map +1 -1
  122. data/node_modules/govuk-frontend/dist/govuk/components/accordion/accordion.mjs +4 -4
  123. data/node_modules/govuk-frontend/dist/govuk/components/accordion/accordion.mjs.map +1 -1
  124. data/node_modules/govuk-frontend/dist/govuk/components/accordion/fixtures.json +102 -97
  125. data/node_modules/govuk-frontend/dist/govuk/components/back-link/fixtures.json +21 -32
  126. data/node_modules/govuk-frontend/dist/govuk/components/breadcrumbs/fixtures.json +25 -45
  127. data/node_modules/govuk-frontend/dist/govuk/components/breadcrumbs/template-default.html +6 -0
  128. data/node_modules/govuk-frontend/dist/govuk/components/button/button.bundle.js +7 -5
  129. data/node_modules/govuk-frontend/dist/govuk/components/button/button.bundle.js.map +1 -1
  130. data/node_modules/govuk-frontend/dist/govuk/components/button/button.bundle.mjs +7 -5
  131. data/node_modules/govuk-frontend/dist/govuk/components/button/button.bundle.mjs.map +1 -1
  132. data/node_modules/govuk-frontend/dist/govuk/components/button/button.mjs.map +1 -1
  133. data/node_modules/govuk-frontend/dist/govuk/components/button/fixtures.json +66 -210
  134. data/node_modules/govuk-frontend/dist/govuk/components/character-count/character-count.bundle.js +10 -8
  135. data/node_modules/govuk-frontend/dist/govuk/components/character-count/character-count.bundle.js.map +1 -1
  136. data/node_modules/govuk-frontend/dist/govuk/components/character-count/character-count.bundle.mjs +10 -8
  137. data/node_modules/govuk-frontend/dist/govuk/components/character-count/character-count.bundle.mjs.map +1 -1
  138. data/node_modules/govuk-frontend/dist/govuk/components/character-count/character-count.mjs +1 -1
  139. data/node_modules/govuk-frontend/dist/govuk/components/character-count/character-count.mjs.map +1 -1
  140. data/node_modules/govuk-frontend/dist/govuk/components/character-count/fixtures.json +72 -86
  141. data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/checkboxes.bundle.js +10 -5
  142. data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/checkboxes.bundle.js.map +1 -1
  143. data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/checkboxes.bundle.mjs +10 -5
  144. data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/checkboxes.bundle.mjs.map +1 -1
  145. data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/checkboxes.mjs.map +1 -1
  146. data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/fixtures.json +305 -464
  147. data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/template-default.html +24 -19
  148. data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/template-with-divider-and-none.html +2 -4
  149. data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/template-with-divider-none-and-conditional-items.html +2 -4
  150. data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/template-with-error-message.html +12 -3
  151. data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/{template-with-fieldset-and-error-message.html → template-with-hint.html} +5 -5
  152. data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/template-with-hints-on-items.html +2 -4
  153. data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/template-with-pre-checked-values.html +36 -27
  154. data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/template-with-very-long-option-text.html +2 -5
  155. data/node_modules/govuk-frontend/dist/govuk/components/cookie-banner/fixtures.json +115 -79
  156. data/node_modules/govuk-frontend/dist/govuk/components/date-input/fixtures.json +147 -159
  157. data/node_modules/govuk-frontend/dist/govuk/components/date-input/template-default.html +30 -22
  158. data/node_modules/govuk-frontend/dist/govuk/components/details/fixtures.json +22 -22
  159. data/node_modules/govuk-frontend/dist/govuk/components/error-message/fixtures.json +10 -10
  160. data/node_modules/govuk-frontend/dist/govuk/components/error-summary/error-summary.bundle.js +8 -12
  161. data/node_modules/govuk-frontend/dist/govuk/components/error-summary/error-summary.bundle.js.map +1 -1
  162. data/node_modules/govuk-frontend/dist/govuk/components/error-summary/error-summary.bundle.mjs +8 -12
  163. data/node_modules/govuk-frontend/dist/govuk/components/error-summary/error-summary.bundle.mjs.map +1 -1
  164. data/node_modules/govuk-frontend/dist/govuk/components/error-summary/error-summary.mjs +2 -2
  165. data/node_modules/govuk-frontend/dist/govuk/components/error-summary/error-summary.mjs.map +1 -1
  166. data/node_modules/govuk-frontend/dist/govuk/components/error-summary/fixtures.json +21 -21
  167. data/node_modules/govuk-frontend/dist/govuk/components/exit-this-page/exit-this-page.bundle.js +9 -7
  168. data/node_modules/govuk-frontend/dist/govuk/components/exit-this-page/exit-this-page.bundle.js.map +1 -1
  169. data/node_modules/govuk-frontend/dist/govuk/components/exit-this-page/exit-this-page.bundle.mjs +9 -7
  170. data/node_modules/govuk-frontend/dist/govuk/components/exit-this-page/exit-this-page.bundle.mjs.map +1 -1
  171. data/node_modules/govuk-frontend/dist/govuk/components/exit-this-page/exit-this-page.mjs.map +1 -1
  172. data/node_modules/govuk-frontend/dist/govuk/components/exit-this-page/fixtures.json +19 -19
  173. data/node_modules/govuk-frontend/dist/govuk/components/fieldset/fixtures.json +19 -19
  174. data/node_modules/govuk-frontend/dist/govuk/components/file-upload/file-upload.bundle.js +10 -8
  175. data/node_modules/govuk-frontend/dist/govuk/components/file-upload/file-upload.bundle.js.map +1 -1
  176. data/node_modules/govuk-frontend/dist/govuk/components/file-upload/file-upload.bundle.mjs +10 -8
  177. data/node_modules/govuk-frontend/dist/govuk/components/file-upload/file-upload.bundle.mjs.map +1 -1
  178. data/node_modules/govuk-frontend/dist/govuk/components/file-upload/file-upload.mjs +1 -1
  179. data/node_modules/govuk-frontend/dist/govuk/components/file-upload/file-upload.mjs.map +1 -1
  180. data/node_modules/govuk-frontend/dist/govuk/components/file-upload/fixtures.json +99 -150
  181. data/node_modules/govuk-frontend/dist/govuk/components/footer/fixtures.json +53 -64
  182. data/node_modules/govuk-frontend/dist/govuk/components/header/_index.scss +10 -4
  183. data/node_modules/govuk-frontend/dist/govuk/components/header/_index.scss.map +1 -1
  184. data/node_modules/govuk-frontend/dist/govuk/components/header/fixtures.json +155 -103
  185. data/node_modules/govuk-frontend/dist/govuk/components/header/header.bundle.js +12 -6
  186. data/node_modules/govuk-frontend/dist/govuk/components/header/header.bundle.js.map +1 -1
  187. data/node_modules/govuk-frontend/dist/govuk/components/header/header.bundle.mjs +12 -6
  188. data/node_modules/govuk-frontend/dist/govuk/components/header/header.bundle.mjs.map +1 -1
  189. data/node_modules/govuk-frontend/dist/govuk/components/header/header.mjs +1 -0
  190. data/node_modules/govuk-frontend/dist/govuk/components/header/header.mjs.map +1 -1
  191. data/node_modules/govuk-frontend/dist/govuk/components/header/template-full-width-with-navigation.html +0 -1
  192. data/node_modules/govuk-frontend/dist/govuk/components/header/template-full-width.html +0 -1
  193. data/node_modules/govuk-frontend/dist/govuk/components/header/template-navigation-item-with-html.html +0 -3
  194. data/node_modules/govuk-frontend/dist/govuk/components/header/template-navigation-item-with-text-without-link.html +0 -3
  195. data/node_modules/govuk-frontend/dist/govuk/components/header/template-with-full-width-border.html +0 -1
  196. data/node_modules/govuk-frontend/dist/govuk/components/hint/fixtures.json +7 -7
  197. data/node_modules/govuk-frontend/dist/govuk/components/input/fixtures.json +158 -179
  198. data/node_modules/govuk-frontend/dist/govuk/components/inset-text/fixtures.json +7 -7
  199. data/node_modules/govuk-frontend/dist/govuk/components/label/fixtures.json +18 -18
  200. data/node_modules/govuk-frontend/dist/govuk/components/notification-banner/fixtures.json +74 -108
  201. data/node_modules/govuk-frontend/dist/govuk/components/notification-banner/notification-banner.bundle.js +7 -5
  202. data/node_modules/govuk-frontend/dist/govuk/components/notification-banner/notification-banner.bundle.js.map +1 -1
  203. data/node_modules/govuk-frontend/dist/govuk/components/notification-banner/notification-banner.bundle.mjs +7 -5
  204. data/node_modules/govuk-frontend/dist/govuk/components/notification-banner/notification-banner.bundle.mjs.map +1 -1
  205. data/node_modules/govuk-frontend/dist/govuk/components/notification-banner/notification-banner.mjs.map +1 -1
  206. data/node_modules/govuk-frontend/dist/govuk/components/notification-banner/template-with-text-as-html.html +7 -1
  207. data/node_modules/govuk-frontend/dist/govuk/components/pagination/_index.scss +4 -0
  208. data/node_modules/govuk-frontend/dist/govuk/components/pagination/_index.scss.map +1 -1
  209. data/node_modules/govuk-frontend/dist/govuk/components/pagination/fixtures.json +80 -98
  210. data/node_modules/govuk-frontend/dist/govuk/components/pagination/macro-options.json +4 -4
  211. data/node_modules/govuk-frontend/dist/govuk/components/panel/fixtures.json +22 -22
  212. data/node_modules/govuk-frontend/dist/govuk/components/password-input/fixtures.json +53 -48
  213. data/node_modules/govuk-frontend/dist/govuk/components/password-input/password-input.bundle.js +9 -7
  214. data/node_modules/govuk-frontend/dist/govuk/components/password-input/password-input.bundle.js.map +1 -1
  215. data/node_modules/govuk-frontend/dist/govuk/components/password-input/password-input.bundle.mjs +9 -7
  216. data/node_modules/govuk-frontend/dist/govuk/components/password-input/password-input.bundle.mjs.map +1 -1
  217. data/node_modules/govuk-frontend/dist/govuk/components/password-input/password-input.mjs.map +1 -1
  218. data/node_modules/govuk-frontend/dist/govuk/components/phase-banner/fixtures.json +8 -8
  219. data/node_modules/govuk-frontend/dist/govuk/components/radios/fixtures.json +213 -328
  220. data/node_modules/govuk-frontend/dist/govuk/components/radios/radios.bundle.js +10 -5
  221. data/node_modules/govuk-frontend/dist/govuk/components/radios/radios.bundle.js.map +1 -1
  222. data/node_modules/govuk-frontend/dist/govuk/components/radios/radios.bundle.mjs +10 -5
  223. data/node_modules/govuk-frontend/dist/govuk/components/radios/radios.bundle.mjs.map +1 -1
  224. data/node_modules/govuk-frontend/dist/govuk/components/radios/radios.mjs.map +1 -1
  225. data/node_modules/govuk-frontend/dist/govuk/components/radios/template-default.html +18 -16
  226. data/node_modules/govuk-frontend/dist/govuk/components/radios/template-with-hint.html +24 -0
  227. data/node_modules/govuk-frontend/dist/govuk/components/select/fixtures.json +99 -115
  228. data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/_index.scss +72 -5
  229. data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/_index.scss.map +1 -1
  230. data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/fixtures.json +228 -62
  231. data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/macro-options.json +6 -0
  232. data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/service-navigation.bundle.js +11 -6
  233. data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/service-navigation.bundle.js.map +1 -1
  234. data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/service-navigation.bundle.mjs +11 -6
  235. data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/service-navigation.bundle.mjs.map +1 -1
  236. data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/service-navigation.mjs.map +1 -1
  237. data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/{template-with-navigation-with-an-active-item.html → template-inverse.html} +7 -2
  238. data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/template-with-a-single-navigation-item-and-collapsenavigationonmobile-set-to-true.html +38 -0
  239. data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/template-with-a-single-navigation-item.html +35 -0
  240. data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/template-with-collapsenavigationonmobile-set-to-false.html +60 -0
  241. data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/template.njk +3 -0
  242. data/node_modules/govuk-frontend/dist/govuk/components/skip-link/_index.scss +1 -2
  243. data/node_modules/govuk-frontend/dist/govuk/components/skip-link/_index.scss.map +1 -1
  244. data/node_modules/govuk-frontend/dist/govuk/components/skip-link/fixtures.json +10 -10
  245. data/node_modules/govuk-frontend/dist/govuk/components/skip-link/skip-link.bundle.js +12 -19
  246. data/node_modules/govuk-frontend/dist/govuk/components/skip-link/skip-link.bundle.js.map +1 -1
  247. data/node_modules/govuk-frontend/dist/govuk/components/skip-link/skip-link.bundle.mjs +12 -19
  248. data/node_modules/govuk-frontend/dist/govuk/components/skip-link/skip-link.bundle.mjs.map +1 -1
  249. data/node_modules/govuk-frontend/dist/govuk/components/skip-link/skip-link.mjs +3 -9
  250. data/node_modules/govuk-frontend/dist/govuk/components/skip-link/skip-link.mjs.map +1 -1
  251. data/node_modules/govuk-frontend/dist/govuk/components/summary-list/fixtures.json +282 -518
  252. data/node_modules/govuk-frontend/dist/govuk/components/table/fixtures.json +75 -75
  253. data/node_modules/govuk-frontend/dist/govuk/components/tabs/fixtures.json +44 -39
  254. data/node_modules/govuk-frontend/dist/govuk/components/tabs/tabs.bundle.js +13 -14
  255. data/node_modules/govuk-frontend/dist/govuk/components/tabs/tabs.bundle.js.map +1 -1
  256. data/node_modules/govuk-frontend/dist/govuk/components/tabs/tabs.bundle.mjs +13 -14
  257. data/node_modules/govuk-frontend/dist/govuk/components/tabs/tabs.bundle.mjs.map +1 -1
  258. data/node_modules/govuk-frontend/dist/govuk/components/tabs/tabs.mjs +3 -3
  259. data/node_modules/govuk-frontend/dist/govuk/components/tabs/tabs.mjs.map +1 -1
  260. data/node_modules/govuk-frontend/dist/govuk/components/tag/fixtures.json +14 -26
  261. data/node_modules/govuk-frontend/dist/govuk/components/task-list/fixtures.json +14 -71
  262. data/node_modules/govuk-frontend/dist/govuk/components/textarea/fixtures.json +81 -81
  263. data/node_modules/govuk-frontend/dist/govuk/components/warning-text/fixtures.json +9 -9
  264. data/node_modules/govuk-frontend/dist/govuk/core/_govuk-frontend-properties.scss +5 -2
  265. data/node_modules/govuk-frontend/dist/govuk/core/_govuk-frontend-properties.scss.map +1 -1
  266. data/node_modules/govuk-frontend/dist/govuk/errors/index.mjs +5 -3
  267. data/node_modules/govuk-frontend/dist/govuk/errors/index.mjs.map +1 -1
  268. data/node_modules/govuk-frontend/dist/govuk/govuk-frontend.min.css +2 -2
  269. data/node_modules/govuk-frontend/dist/govuk/govuk-frontend.min.css.map +1 -1
  270. data/node_modules/govuk-frontend/dist/govuk/govuk-frontend.min.js +1 -1
  271. data/node_modules/govuk-frontend/dist/govuk/govuk-frontend.min.js.map +1 -1
  272. data/node_modules/govuk-frontend/dist/govuk/helpers/_colour.scss +31 -2
  273. data/node_modules/govuk-frontend/dist/govuk/helpers/_colour.scss.map +1 -1
  274. data/node_modules/govuk-frontend/dist/govuk/helpers/_visually-hidden.scss +4 -1
  275. data/node_modules/govuk-frontend/dist/govuk/helpers/_visually-hidden.scss.map +1 -1
  276. data/node_modules/govuk-frontend/dist/govuk/i18n.mjs +4 -2
  277. data/node_modules/govuk-frontend/dist/govuk/i18n.mjs.map +1 -1
  278. data/node_modules/govuk-frontend/dist/govuk/init.mjs +52 -43
  279. data/node_modules/govuk-frontend/dist/govuk/init.mjs.map +1 -1
  280. data/node_modules/govuk-frontend/dist/govuk/macros/logo.njk +2 -2
  281. data/node_modules/govuk-frontend/dist/govuk/settings/_colours-applied.scss +2 -2
  282. data/node_modules/govuk-frontend/dist/govuk/settings/_colours-applied.scss.map +1 -1
  283. data/node_modules/govuk-frontend/dist/govuk/settings/_index.scss +13 -0
  284. data/node_modules/govuk-frontend/dist/govuk/settings/_index.scss.map +1 -1
  285. data/node_modules/govuk-frontend/govuk-prototype-kit.config.json +1 -1
  286. data/node_modules/govuk-frontend/package.json +13 -13
  287. metadata +27 -102
  288. data/node_modules/govuk-frontend/dist/govuk/components/accordion/template-with-focusable-elements-inside.html +0 -26
  289. data/node_modules/govuk-frontend/dist/govuk/components/accordion/template-with-one-section-open.html +0 -30
  290. data/node_modules/govuk-frontend/dist/govuk/components/accordion/template-with-translations.html +0 -30
  291. data/node_modules/govuk-frontend/dist/govuk/components/back-link/template-with-custom-link.html +0 -1
  292. data/node_modules/govuk-frontend/dist/govuk/components/back-link/template-with-custom-text.html +0 -1
  293. data/node_modules/govuk-frontend/dist/govuk/components/breadcrumbs/template-with-multiple-levels.html +0 -16
  294. data/node_modules/govuk-frontend/dist/govuk/components/button/template-input-disabled.html +0 -1
  295. data/node_modules/govuk-frontend/dist/govuk/components/button/template-inverse-disabled.html +0 -3
  296. data/node_modules/govuk-frontend/dist/govuk/components/button/template-inverse-link.html +0 -3
  297. data/node_modules/govuk-frontend/dist/govuk/components/button/template-inverse-start.html +0 -6
  298. data/node_modules/govuk-frontend/dist/govuk/components/button/template-prevent-double-click.html +0 -3
  299. data/node_modules/govuk-frontend/dist/govuk/components/button/template-secondary-disabled.html +0 -3
  300. data/node_modules/govuk-frontend/dist/govuk/components/button/template-secondary-link.html +0 -3
  301. data/node_modules/govuk-frontend/dist/govuk/components/button/template-start-link.html +0 -6
  302. data/node_modules/govuk-frontend/dist/govuk/components/button/template-warning-disabled.html +0 -3
  303. data/node_modules/govuk-frontend/dist/govuk/components/button/template-warning-link.html +0 -3
  304. data/node_modules/govuk-frontend/dist/govuk/components/button/template-with-active-state.html +0 -3
  305. data/node_modules/govuk-frontend/dist/govuk/components/button/template-with-focus-state.html +0 -3
  306. data/node_modules/govuk-frontend/dist/govuk/components/button/template-with-hover-state.html +0 -3
  307. data/node_modules/govuk-frontend/dist/govuk/components/character-count/template-with-custom-textarea-description.html +0 -9
  308. data/node_modules/govuk-frontend/dist/govuk/components/character-count/template-with-error.html +0 -12
  309. data/node_modules/govuk-frontend/dist/govuk/components/character-count/template-with-translations.html +0 -9
  310. data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/template-small-with-disabled.html +0 -27
  311. data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/template-with-a-medium-legend.html +0 -33
  312. data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/template-with-conditional-item-checked.html +0 -39
  313. data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/template-with-conditional-items-with-special-characters.html +0 -39
  314. data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/template-with-disabled-item.html +0 -29
  315. data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/template-with-error-message-and-hints-on-items.html +0 -39
  316. data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/template-with-id-and-name.html +0 -30
  317. data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/template-with-single-option-and-hint-set-aria-describedby-on-input.html +0 -16
  318. data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/template-with-single-option-set-aria-describedby-on-input.html +0 -13
  319. data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/template-without-fieldset.html +0 -22
  320. data/node_modules/govuk-frontend/dist/govuk/components/cookie-banner/template-client-side-implementation.html +0 -60
  321. data/node_modules/govuk-frontend/dist/govuk/components/date-input/template-with-autocomplete-values.html +0 -36
  322. data/node_modules/govuk-frontend/dist/govuk/components/date-input/template-with-default-items.html +0 -36
  323. data/node_modules/govuk-frontend/dist/govuk/components/date-input/template-with-input-attributes.html +0 -36
  324. data/node_modules/govuk-frontend/dist/govuk/components/date-input/template-with-optional-form-group-classes.html +0 -36
  325. data/node_modules/govuk-frontend/dist/govuk/components/exit-this-page/template-translated.html +0 -5
  326. data/node_modules/govuk-frontend/dist/govuk/components/file-upload/template-allows-direct-media-capture.html +0 -6
  327. data/node_modules/govuk-frontend/dist/govuk/components/file-upload/template-allows-image-files-only.html +0 -6
  328. data/node_modules/govuk-frontend/dist/govuk/components/file-upload/template-allows-multiple-files.html +0 -6
  329. data/node_modules/govuk-frontend/dist/govuk/components/file-upload/template-disabled.html +0 -6
  330. data/node_modules/govuk-frontend/dist/govuk/components/file-upload/template-enhanced-disabled.html +0 -13
  331. data/node_modules/govuk-frontend/dist/govuk/components/file-upload/template-with-optional-form-group-classes.html +0 -6
  332. data/node_modules/govuk-frontend/dist/govuk/components/footer/template-with-meta.html +0 -56
  333. data/node_modules/govuk-frontend/dist/govuk/components/header/template-with-custom-menu-button-label.html +0 -59
  334. data/node_modules/govuk-frontend/dist/govuk/components/header/template-with-custom-navigation-label.html +0 -59
  335. data/node_modules/govuk-frontend/dist/govuk/components/input/template-disabled.html +0 -6
  336. data/node_modules/govuk-frontend/dist/govuk/components/input/template-with-autocapitalize-turned-off.html +0 -6
  337. data/node_modules/govuk-frontend/dist/govuk/components/input/template-with-autocomplete-attribute.html +0 -6
  338. data/node_modules/govuk-frontend/dist/govuk/components/input/template-with-optional-form-group-classes.html +0 -6
  339. data/node_modules/govuk-frontend/dist/govuk/components/input/template-with-pattern-attribute.html +0 -6
  340. data/node_modules/govuk-frontend/dist/govuk/components/input/template-with-prefix-and-long-suffix.html +0 -10
  341. data/node_modules/govuk-frontend/dist/govuk/components/input/template-with-spellcheck-disabled.html +0 -6
  342. data/node_modules/govuk-frontend/dist/govuk/components/input/template-with-spellcheck-enabled.html +0 -6
  343. data/node_modules/govuk-frontend/dist/govuk/components/notification-banner/template-auto-focus-disabled-with-type-as-success.html +0 -12
  344. data/node_modules/govuk-frontend/dist/govuk/components/notification-banner/template-auto-focus-explicitly-enabled-with-type-as-success.html +0 -12
  345. data/node_modules/govuk-frontend/dist/govuk/components/notification-banner/template-custom-tabindex.html +0 -12
  346. data/node_modules/govuk-frontend/dist/govuk/components/notification-banner/template-paragraph-as-html-heading.html +0 -10
  347. data/node_modules/govuk-frontend/dist/govuk/components/notification-banner/template-rolealert-overridden-to-roleregion-with-type-as-success.html +0 -12
  348. data/node_modules/govuk-frontend/dist/govuk/components/notification-banner/template-success-with-custom-html.html +0 -16
  349. data/node_modules/govuk-frontend/dist/govuk/components/notification-banner/template-with-a-list.html +0 -16
  350. data/node_modules/govuk-frontend/dist/govuk/components/pagination/template-with-custom-accessible-labels-on-item-links.html +0 -39
  351. data/node_modules/govuk-frontend/dist/govuk/components/pagination/template-with-custom-navigation-landmark.html +0 -39
  352. data/node_modules/govuk-frontend/dist/govuk/components/pagination/template-with-prev-and-next-only-in-a-different-language.html +0 -22
  353. data/node_modules/govuk-frontend/dist/govuk/components/panel/template-custom-heading-level.html +0 -8
  354. data/node_modules/govuk-frontend/dist/govuk/components/password-input/template-with-new-password-autocomplete.html +0 -11
  355. data/node_modules/govuk-frontend/dist/govuk/components/password-input/template-with-translations.html +0 -11
  356. data/node_modules/govuk-frontend/dist/govuk/components/radios/template-prechecked-using-value.html +0 -16
  357. data/node_modules/govuk-frontend/dist/govuk/components/radios/template-prechecked.html +0 -19
  358. data/node_modules/govuk-frontend/dist/govuk/components/radios/template-small-inline-extreme.html +0 -69
  359. data/node_modules/govuk-frontend/dist/govuk/components/radios/template-small-with-disabled.html +0 -27
  360. data/node_modules/govuk-frontend/dist/govuk/components/radios/template-with-a-medium-legend.html +0 -24
  361. data/node_modules/govuk-frontend/dist/govuk/components/radios/template-with-conditional-items-with-special-characters.html +0 -39
  362. data/node_modules/govuk-frontend/dist/govuk/components/radios/template-with-disabled.html +0 -29
  363. data/node_modules/govuk-frontend/dist/govuk/components/radios/template-with-idprefix.html +0 -16
  364. data/node_modules/govuk-frontend/dist/govuk/components/select/template-id.html +0 -7
  365. data/node_modules/govuk-frontend/dist/govuk/components/select/template-with-no-items.html +0 -7
  366. data/node_modules/govuk-frontend/dist/govuk/components/select/template-with-optional-form-group-classes.html +0 -10
  367. data/node_modules/govuk-frontend/dist/govuk/components/select/template-with-selected-value.html +0 -10
  368. data/node_modules/govuk-frontend/dist/govuk/components/summary-list/template-as-a-summary-card-with-a-custom-header-level.html +0 -28
  369. data/node_modules/govuk-frontend/dist/govuk/components/summary-list/template-check-your-answers.html +0 -98
  370. data/node_modules/govuk-frontend/dist/govuk/components/summary-list/template-overridden-widths.html +0 -58
  371. data/node_modules/govuk-frontend/dist/govuk/components/summary-list/template-translated.html +0 -51
  372. data/node_modules/govuk-frontend/dist/govuk/components/summary-list/template-with-no-first-action.html +0 -58
  373. data/node_modules/govuk-frontend/dist/govuk/components/summary-list/template-with-some-actions.html +0 -45
  374. data/node_modules/govuk-frontend/dist/govuk/components/table/template-with-small-text-modifier-for-tables-with-a-lot-of-data.html +0 -19
  375. data/node_modules/govuk-frontend/dist/govuk/components/tag/template-blue.html +0 -3
  376. data/node_modules/govuk-frontend/dist/govuk/components/task-list/template-example-with-3-states.html +0 -49
  377. data/node_modules/govuk-frontend/dist/govuk/components/textarea/template-with-autocomplete-attribute.html +0 -6
  378. data/node_modules/govuk-frontend/dist/govuk/components/textarea/template-with-optional-form-group-classes.html +0 -6
  379. data/node_modules/govuk-frontend/dist/govuk/components/textarea/template-with-spellcheck-disabled.html +0 -6
  380. data/node_modules/govuk-frontend/dist/govuk/components/textarea/template-with-spellcheck-enabled.html +0 -6
  381. /data/node_modules/govuk-frontend/dist/govuk/components/date-input/{template-complete-question.html → template-with-items.html} +0 -0
  382. /data/node_modules/govuk-frontend/dist/govuk/components/table/{template-table-with-head-and-caption.html → template-with-head-and-caption.html} +0 -0
  383. /data/node_modules/govuk-frontend/dist/govuk/components/table/{template-table-with-head.html → template-with-head.html} +0 -0
  384. /data/node_modules/govuk-frontend/dist/govuk/components/task-list/{template-example-with-all-possible-colours.html → template-with-all-possible-colours.html} +0 -0
  385. /data/node_modules/govuk-frontend/dist/govuk/components/task-list/{template-example-with-hint-text-and-additional-states.html → template-with-hint-text-and-additional-states.html} +0 -0
  386. /data/node_modules/govuk-frontend/dist/govuk/components/task-list/{template-example-with-very-long-single-word-tags.html → template-with-very-long-single-word-tags.html} +0 -0
@@ -121,7 +121,9 @@
121
121
  /// @access public
122
122
 
123
123
  @function govuk-shade($colour, $percentage) {
124
- @return mix(#000000, $colour, $percentage);
124
+ // Ensure the output is a hex string so that Safari <12 can render the colour
125
+ // without issues from float values in `rgb()`
126
+ @return _as-hexadecimal(mix(#000000, $colour, $percentage));
125
127
  }
126
128
 
127
129
  /// Make a colour lighter by mixing it with white
@@ -132,7 +134,34 @@
132
134
  /// @access public
133
135
 
134
136
  @function govuk-tint($colour, $percentage) {
135
- @return mix(govuk-colour("white"), $colour, $percentage);
137
+ // Ensure the output is a hex string so that Safari <12 can render the colour
138
+ // without issues from float values in `rgb()`
139
+ @return _as-hexadecimal(mix(govuk-colour("white"), $colour, $percentage));
140
+ }
141
+
142
+ /// Converts a colour with potential float values for its RGB channels
143
+ /// into hexadecimal notation
144
+ ///
145
+ /// This ensures the colour is rendered properly by Safari < 12
146
+ ///
147
+ /// @param {Colour} $colour - The colour to convert
148
+ /// @return {Colour}
149
+ /// @access private
150
+ @function _as-hexadecimal($colour) {
151
+ @if not function-exists(change-color) {
152
+ @return $colour;
153
+ }
154
+
155
+ // `red`,`green` and `blue` functions are limited to 'legacy' colour spaces
156
+ // ensuring we don't get floating computations on them
157
+ $parts: (
158
+ "red": red($colour),
159
+ "green": green($colour),
160
+ "blue": blue($colour),
161
+ "alpha": alpha($colour)
162
+ );
163
+
164
+ @return change-color($colour, $parts...);
136
165
  }
137
166
 
138
167
  /*# sourceMappingURL=_colour.scss.map */
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/govuk/helpers/_colour.scss"],"names":[],"mappings":"AAAA,qCAAqC;AACrC,2CAA2C;AAC3C,8BAA8B;;AAE9B,GAAG;AACH,wBAAwB;AACxB,GAAG;;AAEH,aAAa;AACb,EAAE;AACF,4EAA4E;AAC5E,uBAAuB;AACvB,mEAAmE;AACnE,yEAAyE;AACzE,6EAA6E;AAC7E,4BAA4B;AAC5B,kDAAkD;AAClD,EAAE;AACF,8DAA8D;AAC9D,iBAAiB;;AAEjB;EACE,iDAAiD;EACjD;IACE;;yCAEqC;EACvC;;EAEA;IACE,0EAA0E;IAC1E,4BAA4B;EAC9B;;EAEA;IACE,oCAAoC;EACtC;;EAEA,wCAAwC;AAC1C;;AAEA,+CAA+C;AAC/C,EAAE;AACF,2EAA2E;AAC3E,sEAAsE;AACtE,8EAA8E;AAC9E,6EAA6E;AAC7E,2EAA2E;AAC3E,0EAA0E;AAC1E,0EAA0E;AAC1E,oEAAoE;AACpE,EAAE;AACF,6DAA6D;AAC7D,wDAAwD;AACxD,iBAAiB;;AAEjB;EACE,yEAAyE;EACzE,8CAA8C;EAC9C;IACE,4EAA4E;EAC9E;;EAEA,yCAAyC;EACzC;IACE,gDAAgD;EAClD;;EAEA,0EAA0E;EAC1E,+BAA+B;EAC/B,+EAA+E;EAC/E;IACE;;;;KAIC;EACH;;EAEA,sCAAsC;EACtC;IACE;;;;KAIC;EACH;;EAEA,iEAAiE;;EAEjE;IACE;;;KAGC;EACH;;EAEA,6EAA6E;EAC7E,6EAA6E;EAC7E,mDAAmD;EACnD;IACE,wBAAwB;EAC1B;;EAEA,0EAA0E;EAC1E,+BAA+B;EAC/B,iFAAiF;;EAEjF;IACE,uCAAuC;EACzC,EAAE;IACA,oCAAoC;EACtC;AACF;;AAEA,+CAA+C;AAC/C,EAAE;AACF,4CAA4C;AAC5C,wEAAwE;AACxE,mBAAmB;AACnB,iBAAiB;;AAEjB;EACE,0CAA0C;AAC5C;;AAEA,gDAAgD;AAChD,EAAE;AACF,2CAA2C;AAC3C,wEAAwE;AACxE,mBAAmB;AACnB,iBAAiB;;AAEjB;EACE,wDAAwD;AAC1D","file":"_colour.scss","sourcesContent":["@import \"../settings/colours-palette\";\n@import \"../settings/colours-organisations\";\n@import \"../settings/warnings\";\n\n////\n/// @group helpers/colour\n////\n\n/// Get colour\n///\n/// @param {String | Colour} $colour - Name of colour from the colour palette\n/// (`$govuk-colours`)\n/// @param {String | Colour | Boolean} $legacy [false] - Deprecated.\n/// The `$legacy` parameter is deprecated and is non-operational, as the\n/// legacy colour palette has been removed. The parameter will be removed in\n/// the next major version.\n/// @return {Colour} Representation of named colour\n///\n/// @throw if `$colour` is not a colour from the colour palette\n/// @access public\n\n@function govuk-colour($colour, $legacy: false) {\n // Output a warning if $legacy is set to anything.\n @if $legacy and _should-warn(\"legacy-colour-param\") {\n @warn _warning-text(\"legacy-colour-param\", \"The `$legacy` parameter of \" +\n \"`govuk-colour` is deprecated and is non-operational. It will be \" +\n \"removed in the next major version.\");\n }\n\n @if type-of($colour) == \"color\" {\n // stylelint-disable-next-line scss/function-quote-no-quoted-strings-inside\n $colour: quote(\"#{$colour}\");\n }\n\n @if not map-has-key($govuk-colours, $colour) {\n @error \"Unknown colour `#{$colour}`\";\n }\n\n @return map-get($govuk-colours, $colour);\n}\n\n/// Get the colour for a government organisation\n///\n/// @param {String} $organisation - Organisation name, lowercase, hyphenated\n/// @param {Boolean} $websafe - Deprecated. Use $contrast-safe instead.\n/// @param {Boolean} $contrast-safe [true] - By default a version of the colour\n/// will be returned which has a minimum 4.5:1 contrast ratio when used with\n/// white, as per the WCAG 2.1 Level AA guidelines. If you want to use the\n/// non-contrast safe version you can set this to `false` but your should\n/// ensure that you still meets contrast requirements for accessibility -\n/// for example, do not use the non-contrast safe version for text.\n///\n/// @return {Colour} Representation of colour for organisation\n/// @throw if `$organisation` is not a known organisation\n/// @access public\n\n@function govuk-organisation-colour($organisation, $websafe: null, $contrast-safe: true) {\n // Check if the $organisation exists in the aliases map. If so, change the\n // value of $organisation to the aliased value.\n @if map-has-key($_govuk_colours-organisations-aliases, $organisation) {\n $organisation: map-get($_govuk_colours-organisations-aliases, $organisation);\n }\n\n // Check to see if the organisation exists\n @if not map-has-key($govuk-colours-organisations, $organisation) {\n @error \"Unknown organisation `#{$organisation}`\";\n }\n\n // Output a deprecation warning if the legacy colour palette is being used.\n // Remove in next major version.\n $is-legacy: $govuk-colours-organisations == $_govuk-legacy-organisation-colours;\n @if $is-legacy and _should-warn(\"legacy-organisation-colours\") {\n @warn _warning-text(\"legacy-organisation-colours\",\n \"We've updated the organisation colour palette. Opt in to the new \" +\n \"colours using `$govuk-new-organisation-colours: true`. The old \" +\n \"palette is deprecated and we'll remove it in the next major version.\"\n );\n }\n\n // Output a warning if $websafe is set.\n @if $websafe and _should-warn(\"organisation-colour-websafe-param\") {\n @warn _warning-text(\"organisation-colour-websafe-param\",\n \"The `$websafe` parameter of `govuk-organisation-colour` has been \" +\n \"renamed to `$contrast-safe`. The old parameter name will be removed in \" +\n \"the next major version.\"\n );\n }\n\n $org-colour: map-get($govuk-colours-organisations, $organisation);\n\n @if map-has-key($org-colour, deprecation-message) and _should-warn(\"organisation-colours\") {\n @warn _warning-text(\n \"organisation-colours\",\n map-get($org-colour, deprecation-message)\n );\n }\n\n // If the $websafe parameter is being used (it has been explicitly set as true\n // or false), assume the user hasn't updated to use $contrast-safe yet and map\n // the old parameter's value onto the new parameter.\n @if type-of($websafe) != \"null\" {\n $contrast-safe: $websafe;\n }\n\n // Determine the contrast-safe key to use depending on whether it's the new\n // palette or the legacy palette\n $safe-key: if($govuk-new-organisation-colours, \"contrast-safe\", \"colour-websafe\");\n\n @if $contrast-safe and map-has-key($org-colour, $safe-key) {\n @return map-get($org-colour, $safe-key);\n } @else {\n @return map-get($org-colour, colour);\n }\n}\n\n/// Make a colour darker by mixing it with black\n///\n/// @param {Colour} $colour - colour to shade\n/// @param {Number} $percentage - percentage of black to mix with $colour\n/// @return {Colour}\n/// @access public\n\n@function govuk-shade($colour, $percentage) {\n @return mix(#000000, $colour, $percentage);\n}\n\n/// Make a colour lighter by mixing it with white\n///\n/// @param {Colour} $colour - colour to tint\n/// @param {Number} $percentage - percentage of white to mix with $colour\n/// @return {Colour}\n/// @access public\n\n@function govuk-tint($colour, $percentage) {\n @return mix(govuk-colour(\"white\"), $colour, $percentage);\n}\n"]}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2D;AAC7D;;AAEA,gDAAgD;AAChD,EAAE;AACF,2CAA2C;AAC3C,wEAAwE;AACxE,mBAAmB;AACnB,iBAAiB;;AAEjB;EACE,4EAA4E;EAC5E,6CAA6C;EAC7C,yEAAyE;AAC3E;;AAEA,qEAAqE;AACrE,4BAA4B;AAC5B,EAAE;AACF,8DAA8D;AAC9D,EAAE;AACF,kDAAkD;AAClD,mBAAmB;AACnB,kBAAkB;AAClB;EACE;IACE,eAAe;EACjB;;EAEA,0EAA0E;EAC1E,qDAAqD;EACrD;;;;;GAKC;;EAED,wCAAwC;AAC1C","file":"_colour.scss","sourcesContent":["@import \"../settings/colours-palette\";\n@import \"../settings/colours-organisations\";\n@import \"../settings/warnings\";\n\n////\n/// @group helpers/colour\n////\n\n/// Get colour\n///\n/// @param {String | Colour} $colour - Name of colour from the colour palette\n/// (`$govuk-colours`)\n/// @param {String | Colour | Boolean} $legacy [false] - Deprecated.\n/// The `$legacy` parameter is deprecated and is non-operational, as the\n/// legacy colour palette has been removed. The parameter will be removed in\n/// the next major version.\n/// @return {Colour} Representation of named colour\n///\n/// @throw if `$colour` is not a colour from the colour palette\n/// @access public\n\n@function govuk-colour($colour, $legacy: false) {\n // Output a warning if $legacy is set to anything.\n @if $legacy and _should-warn(\"legacy-colour-param\") {\n @warn _warning-text(\"legacy-colour-param\", \"The `$legacy` parameter of \" +\n \"`govuk-colour` is deprecated and is non-operational. It will be \" +\n \"removed in the next major version.\");\n }\n\n @if type-of($colour) == \"color\" {\n // stylelint-disable-next-line scss/function-quote-no-quoted-strings-inside\n $colour: quote(\"#{$colour}\");\n }\n\n @if not map-has-key($govuk-colours, $colour) {\n @error \"Unknown colour `#{$colour}`\";\n }\n\n @return map-get($govuk-colours, $colour);\n}\n\n/// Get the colour for a government organisation\n///\n/// @param {String} $organisation - Organisation name, lowercase, hyphenated\n/// @param {Boolean} $websafe - Deprecated. Use $contrast-safe instead.\n/// @param {Boolean} $contrast-safe [true] - By default a version of the colour\n/// will be returned which has a minimum 4.5:1 contrast ratio when used with\n/// white, as per the WCAG 2.1 Level AA guidelines. If you want to use the\n/// non-contrast safe version you can set this to `false` but your should\n/// ensure that you still meets contrast requirements for accessibility -\n/// for example, do not use the non-contrast safe version for text.\n///\n/// @return {Colour} Representation of colour for organisation\n/// @throw if `$organisation` is not a known organisation\n/// @access public\n\n@function govuk-organisation-colour($organisation, $websafe: null, $contrast-safe: true) {\n // Check if the $organisation exists in the aliases map. If so, change the\n // value of $organisation to the aliased value.\n @if map-has-key($_govuk_colours-organisations-aliases, $organisation) {\n $organisation: map-get($_govuk_colours-organisations-aliases, $organisation);\n }\n\n // Check to see if the organisation exists\n @if not map-has-key($govuk-colours-organisations, $organisation) {\n @error \"Unknown organisation `#{$organisation}`\";\n }\n\n // Output a deprecation warning if the legacy colour palette is being used.\n // Remove in next major version.\n $is-legacy: $govuk-colours-organisations == $_govuk-legacy-organisation-colours;\n @if $is-legacy and _should-warn(\"legacy-organisation-colours\") {\n @warn _warning-text(\"legacy-organisation-colours\",\n \"We've updated the organisation colour palette. Opt in to the new \" +\n \"colours using `$govuk-new-organisation-colours: true`. The old \" +\n \"palette is deprecated and we'll remove it in the next major version.\"\n );\n }\n\n // Output a warning if $websafe is set.\n @if $websafe and _should-warn(\"organisation-colour-websafe-param\") {\n @warn _warning-text(\"organisation-colour-websafe-param\",\n \"The `$websafe` parameter of `govuk-organisation-colour` has been \" +\n \"renamed to `$contrast-safe`. The old parameter name will be removed in \" +\n \"the next major version.\"\n );\n }\n\n $org-colour: map-get($govuk-colours-organisations, $organisation);\n\n @if map-has-key($org-colour, deprecation-message) and _should-warn(\"organisation-colours\") {\n @warn _warning-text(\n \"organisation-colours\",\n map-get($org-colour, deprecation-message)\n );\n }\n\n // If the $websafe parameter is being used (it has been explicitly set as true\n // or false), assume the user hasn't updated to use $contrast-safe yet and map\n // the old parameter's value onto the new parameter.\n @if type-of($websafe) != \"null\" {\n $contrast-safe: $websafe;\n }\n\n // Determine the contrast-safe key to use depending on whether it's the new\n // palette or the legacy palette\n $safe-key: if($govuk-new-organisation-colours, \"contrast-safe\", \"colour-websafe\");\n\n @if $contrast-safe and map-has-key($org-colour, $safe-key) {\n @return map-get($org-colour, $safe-key);\n } @else {\n @return map-get($org-colour, colour);\n }\n}\n\n/// Make a colour darker by mixing it with black\n///\n/// @param {Colour} $colour - colour to shade\n/// @param {Number} $percentage - percentage of black to mix with $colour\n/// @return {Colour}\n/// @access public\n\n@function govuk-shade($colour, $percentage) {\n // Ensure the output is a hex string so that Safari <12 can render the colour\n // without issues from float values in `rgb()`\n @return _as-hexadecimal(mix(#000000, $colour, $percentage));\n}\n\n/// Make a colour lighter by mixing it with white\n///\n/// @param {Colour} $colour - colour to tint\n/// @param {Number} $percentage - percentage of white to mix with $colour\n/// @return {Colour}\n/// @access public\n\n@function govuk-tint($colour, $percentage) {\n // Ensure the output is a hex string so that Safari <12 can render the colour\n // without issues from float values in `rgb()`\n @return _as-hexadecimal(mix(govuk-colour(\"white\"), $colour, $percentage));\n}\n\n/// Converts a colour with potential float values for its RGB channels\n/// into hexadecimal notation\n///\n/// This ensures the colour is rendered properly by Safari < 12\n///\n/// @param {Colour} $colour - The colour to convert\n/// @return {Colour}\n/// @access private\n@function _as-hexadecimal($colour) {\n @if not function-exists(change-color) {\n @return $colour;\n }\n\n // `red`,`green` and `blue` functions are limited to 'legacy' colour spaces\n // ensuring we don't get floating computations on them\n $parts: (\n \"red\": red($colour),\n \"green\": green($colour),\n \"blue\": blue($colour),\n \"alpha\": alpha($colour)\n );\n\n @return change-color($colour, $parts...);\n}\n"]}
@@ -77,7 +77,10 @@
77
77
 
78
78
  @mixin govuk-visually-hidden-focusable($important: true) {
79
79
  // IE 11 doesn't support the combined `:not(:active, :focus)` syntax.
80
- &:not(:active):not(:focus) {
80
+ // Also allows for ':focus' companion classes from postcss-pseudo-classes
81
+ // which the plugin unfortunately doesn't handle automatically.
82
+ // stylelint-disable-next-line selector-class-pattern
83
+ &:not(:active):not(:focus):not(.\:focus) {
81
84
  @include _govuk-visually-hide-content($important: $important);
82
85
  }
83
86
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/govuk/helpers/_visually-hidden.scss"],"names":[],"mappings":"AAAA,GAAG;AACH,+BAA+B;AAC/B,GAAG;;AAEH,0EAA0E;AAC1E,EAAE;AACF,gFAAgF;AAChF,sEAAsE;AACtE,2HAA2H;AAC3H,uCAAuC;AACvC,EAAE;AACF,uEAAuE;AACvE,EAAE;AACF,kBAAkB;;AAElB;EACE,mDAAmD;;EAEnD,2CAA2C;EAC3C,4CAA4C;EAC5C,2EAA2E;EAC3E,sCAAsC;EACtC,0CAA0C;EAC1C,2CAA2C;;EAE3C,iDAAiD;;EAEjD,mCAAmC;EACnC,oDAAoD;EACpD,8DAAsD;UAAtD,sDAAsD;;EAEtD,0CAA0C;;EAE1C,4EAA4E;EAC5E,yCAAyC;EACzC,uFAAuF;EACvF,oDAAoD;;EAEpD,6EAA6E;EAC7E,4EAA4E;EAC5E,8BAA8B;EAC9B,yBAAiB;MAAjB,qBAAiB;UAAjB,iBAAiB;AACnB;;AAEA,qEAAqE;AACrE,EAAE;AACF,uEAAuE;AACvE,EAAE;AACF,iBAAiB;;AAEjB;EACE,6DAA6D;;EAE7D,qEAAqE;EACrE,0EAA0E;EAC1E,4EAA4E;EAC5E,0CAA0C;EAC1C;IACE,gBAAgB;EAClB;;EAEA;IACE,gBAAgB;EAClB;AACF;;AAEA,4EAA4E;AAC5E,8EAA8E;AAC9E,qBAAqB;AACrB,EAAE;AACF,uEAAuE;AACvE,EAAE;AACF,iBAAiB;;AAEjB;EACE,oEAAoE;EACpE;IACE,6DAA6D;EAC/D;AACF","file":"_visually-hidden.scss","sourcesContent":["////\n/// @group helpers/accessibility\n////\n\n/// Helper function containing the common code for the following two mixins\n///\n/// @link https://snook.ca/archives/html_and_css/hiding-content-for-accessibility\n/// - Hiding Content for Accessibility, Jonathan Snook, February 2011\n/// @link https://github.com/h5bp/html5-boilerplate/blob/9f13695d21ff92c55c78dfa9f16bb02a1b6e911f/src/css/main.css#L121-L158\n/// - h5bp/html5-boilerplate - Thanks!\n///\n/// @param {Boolean} $important [true] - Whether to mark as `!important`\n///\n/// @access private\n\n@mixin _govuk-visually-hide-content($important: true) {\n position: absolute if($important, !important, null);\n\n width: 1px if($important, !important, null);\n height: 1px if($important, !important, null);\n // If margin is set to a negative value it can cause text to be announced in\n // the wrong order in VoiceOver for OSX\n margin: 0 if($important, !important, null);\n padding: 0 if($important, !important, null);\n\n overflow: hidden if($important, !important, null);\n\n // `clip` is needed for IE11 support\n clip: rect(0 0 0 0) if($important, !important, null);\n clip-path: inset(50%) if($important, !important, null);\n\n border: 0 if($important, !important, null);\n\n // For long content, line feeds are not interpreted as spaces and small width\n // causes content to wrap 1 word per line:\n // https://medium.com/@jessebeach/beware-smushed-off-screen-accessible-text-5952a4c2cbfe\n white-space: nowrap if($important, !important, null);\n\n // Prevent users from selecting or copying visually-hidden text. This prevents\n // a user unintentionally copying more text than they intended and needing to\n // manually trim it down again.\n user-select: none;\n}\n\n/// Hide an element visually, but have it available for screen readers\n///\n/// @param {Boolean} $important [true] - Whether to mark as `!important`\n///\n/// @access public\n\n@mixin govuk-visually-hidden($important: true) {\n @include _govuk-visually-hide-content($important: $important);\n\n // Absolute positioning has the unintended consequence of removing any\n // whitespace surrounding visually hidden text from the accessibility tree.\n // Insert a space character before and after visually hidden text to separate\n // it from any visible text surrounding it.\n &::before {\n content: \"\\00a0\";\n }\n\n &::after {\n content: \"\\00a0\";\n }\n}\n\n/// Hide an element visually, but have it available for screen readers whilst\n/// allowing the element to be focused when navigated to via the keyboard (e.g.\n/// for the skip link)\n///\n/// @param {Boolean} $important [true] - Whether to mark as `!important`\n///\n/// @access public\n\n@mixin govuk-visually-hidden-focusable($important: true) {\n // IE 11 doesn't support the combined `:not(:active, :focus)` syntax.\n &:not(:active):not(:focus) {\n @include _govuk-visually-hide-content($important: $important);\n }\n}\n"]}
1
+ {"version":3,"sources":["../../../src/govuk/helpers/_visually-hidden.scss"],"names":[],"mappings":"AAAA,GAAG;AACH,+BAA+B;AAC/B,GAAG;;AAEH,0EAA0E;AAC1E,EAAE;AACF,gFAAgF;AAChF,sEAAsE;AACtE,2HAA2H;AAC3H,uCAAuC;AACvC,EAAE;AACF,uEAAuE;AACvE,EAAE;AACF,kBAAkB;;AAElB;EACE,mDAAmD;;EAEnD,2CAA2C;EAC3C,4CAA4C;EAC5C,2EAA2E;EAC3E,sCAAsC;EACtC,0CAA0C;EAC1C,2CAA2C;;EAE3C,iDAAiD;;EAEjD,mCAAmC;EACnC,oDAAoD;EACpD,8DAAsD;UAAtD,sDAAsD;;EAEtD,0CAA0C;;EAE1C,4EAA4E;EAC5E,yCAAyC;EACzC,uFAAuF;EACvF,oDAAoD;;EAEpD,6EAA6E;EAC7E,4EAA4E;EAC5E,8BAA8B;EAC9B,yBAAiB;MAAjB,qBAAiB;UAAjB,iBAAiB;AACnB;;AAEA,qEAAqE;AACrE,EAAE;AACF,uEAAuE;AACvE,EAAE;AACF,iBAAiB;;AAEjB;EACE,6DAA6D;;EAE7D,qEAAqE;EACrE,0EAA0E;EAC1E,4EAA4E;EAC5E,0CAA0C;EAC1C;IACE,gBAAgB;EAClB;;EAEA;IACE,gBAAgB;EAClB;AACF;;AAEA,4EAA4E;AAC5E,8EAA8E;AAC9E,qBAAqB;AACrB,EAAE;AACF,uEAAuE;AACvE,EAAE;AACF,iBAAiB;;AAEjB;EACE,oEAAoE;EACpE,wEAAwE;EACxE,8DAA8D;EAC9D,oDAAoD;EACpD;IACE,6DAA6D;EAC/D;AACF","file":"_visually-hidden.scss","sourcesContent":["////\n/// @group helpers/accessibility\n////\n\n/// Helper function containing the common code for the following two mixins\n///\n/// @link https://snook.ca/archives/html_and_css/hiding-content-for-accessibility\n/// - Hiding Content for Accessibility, Jonathan Snook, February 2011\n/// @link https://github.com/h5bp/html5-boilerplate/blob/9f13695d21ff92c55c78dfa9f16bb02a1b6e911f/src/css/main.css#L121-L158\n/// - h5bp/html5-boilerplate - Thanks!\n///\n/// @param {Boolean} $important [true] - Whether to mark as `!important`\n///\n/// @access private\n\n@mixin _govuk-visually-hide-content($important: true) {\n position: absolute if($important, !important, null);\n\n width: 1px if($important, !important, null);\n height: 1px if($important, !important, null);\n // If margin is set to a negative value it can cause text to be announced in\n // the wrong order in VoiceOver for OSX\n margin: 0 if($important, !important, null);\n padding: 0 if($important, !important, null);\n\n overflow: hidden if($important, !important, null);\n\n // `clip` is needed for IE11 support\n clip: rect(0 0 0 0) if($important, !important, null);\n clip-path: inset(50%) if($important, !important, null);\n\n border: 0 if($important, !important, null);\n\n // For long content, line feeds are not interpreted as spaces and small width\n // causes content to wrap 1 word per line:\n // https://medium.com/@jessebeach/beware-smushed-off-screen-accessible-text-5952a4c2cbfe\n white-space: nowrap if($important, !important, null);\n\n // Prevent users from selecting or copying visually-hidden text. This prevents\n // a user unintentionally copying more text than they intended and needing to\n // manually trim it down again.\n user-select: none;\n}\n\n/// Hide an element visually, but have it available for screen readers\n///\n/// @param {Boolean} $important [true] - Whether to mark as `!important`\n///\n/// @access public\n\n@mixin govuk-visually-hidden($important: true) {\n @include _govuk-visually-hide-content($important: $important);\n\n // Absolute positioning has the unintended consequence of removing any\n // whitespace surrounding visually hidden text from the accessibility tree.\n // Insert a space character before and after visually hidden text to separate\n // it from any visible text surrounding it.\n &::before {\n content: \"\\00a0\";\n }\n\n &::after {\n content: \"\\00a0\";\n }\n}\n\n/// Hide an element visually, but have it available for screen readers whilst\n/// allowing the element to be focused when navigated to via the keyboard (e.g.\n/// for the skip link)\n///\n/// @param {Boolean} $important [true] - Whether to mark as `!important`\n///\n/// @access public\n\n@mixin govuk-visually-hidden-focusable($important: true) {\n // IE 11 doesn't support the combined `:not(:active, :focus)` syntax.\n // Also allows for ':focus' companion classes from postcss-pseudo-classes\n // which the plugin unfortunately doesn't handle automatically.\n // stylelint-disable-next-line selector-class-pattern\n &:not(:active):not(:focus):not(.\\:focus) {\n @include _govuk-visually-hide-content($important: $important);\n }\n}\n"]}
@@ -1,3 +1,5 @@
1
+ import { isObject } from './common/index.mjs';
2
+
1
3
  class I18n {
2
4
  constructor(translations = {}, config = {}) {
3
5
  var _config$locale;
@@ -11,7 +13,7 @@ class I18n {
11
13
  throw new Error('i18n: lookup key missing');
12
14
  }
13
15
  let translation = this.translations[lookupKey];
14
- if (typeof (options == null ? void 0 : options.count) === 'number' && typeof translation === 'object') {
16
+ if (typeof (options == null ? void 0 : options.count) === 'number' && isObject(translation)) {
15
17
  const translationPluralForm = translation[this.getPluralSuffix(lookupKey, options.count)];
16
18
  if (translationPluralForm) {
17
19
  translation = translationPluralForm;
@@ -54,7 +56,7 @@ class I18n {
54
56
  }
55
57
  const translation = this.translations[lookupKey];
56
58
  const preferredForm = this.hasIntlPluralRulesSupport() ? new Intl.PluralRules(this.locale).select(count) : this.selectPluralFormUsingFallbackRules(count);
57
- if (typeof translation === 'object') {
59
+ if (isObject(translation)) {
58
60
  if (preferredForm in translation) {
59
61
  return preferredForm;
60
62
  } else if ('other' in translation) {
@@ -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;AAAA,IAAA,IAAA,CAT5CF,YAAY,GAAA,MAAA;AAAA,IAAA,IAAA,CACZG,MAAM,GAAA,MAAA;IAUJ,IAAI,CAACH,YAAY,GAAGA,YAAY;AAGhC,IAAA,IAAI,CAACG,MAAM,GAAA,CAAAD,cAAA,GAAGD,MAAM,CAACE,MAAM,KAAAD,IAAAA,GAAAA,cAAA,GAAKE,QAAQ,CAACC,eAAe,CAACC,IAAI,IAAI,IAAK;AACxE;AAaAC,EAAAA,CAACA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E,IACvBD,OAAO,IAAI,EAAE,IAAIA,OAAO,IAAI,EAAG,EAChC;AACA,MAAA,OAAO,MAAM;AACf;AAGA,IAAA,OAAO,OAAO;GACf;EACDJ,QAAQA,CAACG,CAAC,EAAE;AACV,IAAA,IAAIA,CAAC,KAAK,CAAC,IAAIA,CAAC,KAAK,EAAE,EAAE;AACvB,MAAA,OAAO,KAAK;AACd;AACA,IAAA,IAAIA,CAAC,KAAK,CAAC,IAAIA,CAAC,KAAK,EAAE,EAAE;AACvB,MAAA,OAAO,KAAK;AACd;AACA,IAAA,IAAKA,CAAC,IAAI,CAAC,IAAIA,CAAC,IAAI,EAAE,IAAMA,CAAC,IAAI,EAAE,IAAIA,CAAC,IAAI,EAAG,EAAE;AAC/C,MAAA,OAAO,KAAK;AACd;AACA,IAAA,OAAO,OAAO;GACf;EACDF,OAAOA,CAACE,CAAC,EAAE;IACT,IAAIA,CAAC,KAAK,CAAC,EAAE;AACX,MAAA,OAAO,KAAK;AACd;IACA,IAAIA,CAAC,GAAG,OAAO,KAAK,CAAC,IAAIA,CAAC,KAAK,CAAC,EAAE;AAChC,MAAA,OAAO,MAAM;AACf;AACA,IAAA,OAAO,OAAO;GACf;EACDD,KAAKA,CAACC,CAAC,EAAE;IACP,IAAIA,CAAC,KAAK,CAAC,EAAE;AACX,MAAA,OAAO,MAAM;AACf;IACA,IAAIA,CAAC,KAAK,CAAC,EAAE;AACX,MAAA,OAAO,KAAK;AACd;IACA,IAAIA,CAAC,KAAK,CAAC,EAAE;AACX,MAAA,OAAO,KAAK;AACd;IACA,IAAIA,CAAC,KAAK,CAAC,EAAE;AACX,MAAA,OAAO,KAAK;AACd;IACA,IAAIA,CAAC,KAAK,CAAC,EAAE;AACX,MAAA,OAAO,MAAM;AACf;AACA,IAAA,OAAO,OAAO;AAChB;AACF,CAAC;;;;"}
1
+ {"version":3,"file":"i18n.mjs","sources":["../../src/govuk/i18n.mjs"],"sourcesContent":["import { isObject } from './common/index.mjs'\n\n/**\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' && isObject(translation)) {\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 // eslint-disable-next-line @typescript-eslint/prefer-regexp-exec\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 // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-conversion\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 (isObject(translation)) {\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","isObject","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":";;AAQO,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,CACZG,MAAM,GAAA,MAAA;IAUJ,IAAI,CAACH,YAAY,GAAGA,YAAY;AAGhC,IAAA,IAAI,CAACG,MAAM,GAAA,CAAAD,cAAA,GAAGD,MAAM,CAACE,MAAM,KAAA,IAAA,GAAAD,cAAA,GAAKE,QAAQ,CAACC,eAAe,CAACC,IAAI,IAAI,IAAK;AACxE,EAAA;AAaAC,EAAAA,CAACA,CAACC,SAAS,EAAEC,OAAO,EAAE;IACpB,IAAI,CAACD,SAAS,EAAE;AAEd,MAAA,MAAM,IAAIE,KAAK,CAAC,0BAA0B,CAAC;AAC7C,IAAA;AAGA,IAAA,IAAIC,WAAW,GAAG,IAAI,CAACX,YAAY,CAACQ,SAAS,CAAC;AAK9C,IAAA,IAAI,QAAOC,OAAO,IAAA,IAAA,GAAA,MAAA,GAAPA,OAAO,CAAEG,KAAK,CAAA,KAAK,QAAQ,IAAIC,QAAQ,CAACF,WAAW,CAAC,EAAE;AAC/D,MAAA,MAAMG,qBAAqB,GACzBH,WAAW,CAAC,IAAI,CAACI,eAAe,CAACP,SAAS,EAAEC,OAAO,CAACG,KAAK,CAAC,CAAC;AAG7D,MAAA,IAAIE,qBAAqB,EAAE;AACzBH,QAAAA,WAAW,GAAGG,qBAAqB;AACrC,MAAA;AACF,IAAA;AAEA,IAAA,IAAI,OAAOH,WAAW,KAAK,QAAQ,EAAE;AAGnC,MAAA,IAAIA,WAAW,CAACK,KAAK,CAAC,WAAW,CAAC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EAAE,IAAMA,CAAC,IAAI,EAAE,IAAIA,CAAC,IAAI,EAAG,EAAE;AAC/C,MAAA,OAAO,KAAK;AACd,IAAA;AACA,IAAA,OAAO,OAAO;EAChB,CAAC;EACDF,OAAOA,CAACE,CAAC,EAAE;IACT,IAAIA,CAAC,KAAK,CAAC,EAAE;AACX,MAAA,OAAO,KAAK;AACd,IAAA;IACA,IAAIA,CAAC,GAAG,OAAO,KAAK,CAAC,IAAIA,CAAC,KAAK,CAAC,EAAE;AAChC,MAAA,OAAO,MAAM;AACf,IAAA;AACA,IAAA,OAAO,OAAO;EAChB,CAAC;EACDD,KAAKA,CAACC,CAAC,EAAE;IACP,IAAIA,CAAC,KAAK,CAAC,EAAE;AACX,MAAA,OAAO,MAAM;AACf,IAAA;IACA,IAAIA,CAAC,KAAK,CAAC,EAAE;AACX,MAAA,OAAO,KAAK;AACd,IAAA;IACA,IAAIA,CAAC,KAAK,CAAC,EAAE;AACX,MAAA,OAAO,KAAK;AACd,IAAA;IACA,IAAIA,CAAC,KAAK,CAAC,EAAE;AACX,MAAA,OAAO,KAAK;AACd,IAAA;IACA,IAAIA,CAAC,KAAK,CAAC,EAAE;AACX,MAAA,OAAO,MAAM;AACf,IAAA;AACA,IAAA,OAAO,OAAO;AAChB,EAAA;AACF,CAAC;;;;"}
@@ -1,4 +1,5 @@
1
- import { isSupported } from './common/index.mjs';
1
+ import { normaliseOptions } from './common/configuration.mjs';
2
+ import { isSupported, isObject } from './common/index.mjs';
2
3
  import { Accordion } from './components/accordion/accordion.mjs';
3
4
  import { Button } from './components/button/button.mjs';
4
5
  import { CharacterCount } from './components/character-count/character-count.mjs';
@@ -13,7 +14,7 @@ import { Radios } from './components/radios/radios.mjs';
13
14
  import { ServiceNavigation } from './components/service-navigation/service-navigation.mjs';
14
15
  import { SkipLink } from './components/skip-link/skip-link.mjs';
15
16
  import { Tabs } from './components/tabs/tabs.mjs';
16
- import { SupportError } from './errors/index.mjs';
17
+ import { SupportError, ElementError } from './errors/index.mjs';
17
18
 
18
19
  /**
19
20
  * Initialise all components
@@ -21,28 +22,34 @@ import { SupportError } from './errors/index.mjs';
21
22
  * Use the `data-module` attributes to find, instantiate and init all of the
22
23
  * components provided as part of GOV.UK Frontend.
23
24
  *
24
- * @param {Config & { scope?: Element, onError?: OnErrorCallback<CompatibleClass> }} [config] - Config for all components (with optional scope)
25
+ * @param {Config | Element | Document | null} [scopeOrConfig] - Scope of the document to search within or config for all components (with optional scope)
25
26
  */
26
- function initAll(config) {
27
- var _config$scope;
28
- config = typeof config !== 'undefined' ? config : {};
29
- if (!isSupported()) {
30
- if (config.onError) {
31
- config.onError(new SupportError(), {
27
+ function initAll(scopeOrConfig = {}) {
28
+ const config = isObject(scopeOrConfig) ? scopeOrConfig : {};
29
+ const options = normaliseOptions(scopeOrConfig);
30
+ try {
31
+ if (!isSupported()) {
32
+ throw new SupportError();
33
+ }
34
+ if (options.scope === null) {
35
+ throw new ElementError({
36
+ element: options.scope,
37
+ identifier: 'GOV.UK Frontend scope element (`$scope`)'
38
+ });
39
+ }
40
+ } catch (error) {
41
+ if (options.onError) {
42
+ options.onError(error, {
32
43
  config
33
44
  });
34
45
  } else {
35
- console.log(new SupportError());
46
+ console.log(error);
36
47
  }
37
48
  return;
38
49
  }
39
50
  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
- };
44
- components.forEach(([Component, config]) => {
45
- createAll(Component, config, options);
51
+ components.forEach(([Component, componentConfig]) => {
52
+ createAll(Component, componentConfig, options);
46
53
  });
47
54
  }
48
55
 
@@ -58,42 +65,42 @@ function initAll(config) {
58
65
  * @template {CompatibleClass} ComponentClass
59
66
  * @param {ComponentClass} Component - class of the component to create
60
67
  * @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
68
+ * @param {OnErrorCallback<ComponentClass> | Element | Document | null | CreateAllOptions<ComponentClass>} [scopeOrOptions] - options for createAll including scope of the document to search within and callback function if error throw by component on init
62
69
  * @returns {Array<InstanceType<ComponentClass>>} - array of instantiated components
63
70
  */
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
- }
79
- const $elements = $scope.querySelectorAll(`[data-module="${Component.moduleName}"]`);
80
- if (!isSupported()) {
81
- if (onError) {
82
- onError(new SupportError(), {
71
+ function createAll(Component, config, scopeOrOptions) {
72
+ let $elements;
73
+ const options = normaliseOptions(scopeOrOptions);
74
+ try {
75
+ var _options$scope;
76
+ if (!isSupported()) {
77
+ throw new SupportError();
78
+ }
79
+ if (options.scope === null) {
80
+ throw new ElementError({
81
+ element: options.scope,
82
+ component: Component,
83
+ identifier: 'Scope element (`$scope`)'
84
+ });
85
+ }
86
+ $elements = (_options$scope = options.scope) == null ? void 0 : _options$scope.querySelectorAll(`[data-module="${Component.moduleName}"]`);
87
+ } catch (error) {
88
+ if (options.onError) {
89
+ options.onError(error, {
83
90
  component: Component,
84
91
  config
85
92
  });
86
93
  } else {
87
- console.log(new SupportError());
94
+ console.log(error);
88
95
  }
89
96
  return [];
90
97
  }
91
- return Array.from($elements).map($element => {
98
+ return Array.from($elements != null ? $elements : []).map($element => {
92
99
  try {
93
100
  return typeof config !== 'undefined' ? new Component($element, config) : new Component($element);
94
101
  } catch (error) {
95
- if (onError) {
96
- onError(error, {
102
+ if (options.onError) {
103
+ options.onError(error, {
97
104
  element: $element,
98
105
  component: Component,
99
106
  config
@@ -112,6 +119,8 @@ function createAll(Component, config, createAllOptions) {
112
119
  * Config for all components via `initAll()`
113
120
  *
114
121
  * @typedef {object} Config
122
+ * @property {Element | Document | null} [scope] - Scope of the document to search within
123
+ * @property {OnErrorCallback<CompatibleClass>} [onError] - Initialisation error callback
115
124
  * @property {AccordionConfig} [accordion] - Accordion config
116
125
  * @property {ButtonConfig} [button] - Button config
117
126
  * @property {CharacterCountConfig} [characterCount] - Character Count config
@@ -136,7 +145,7 @@ function createAll(Component, config, createAllOptions) {
136
145
  /**
137
146
  * Component config keys, e.g. `accordion` and `characterCount`
138
147
  *
139
- * @typedef {keyof Config} ConfigKey
148
+ * @typedef {keyof Omit<Config, 'scope' | 'onError'>} ConfigKey
140
149
  */
141
150
  /**
142
151
  * @template {CompatibleClass} ComponentClass
@@ -147,7 +156,7 @@ function createAll(Component, config, createAllOptions) {
147
156
  * @typedef {object} ErrorContext
148
157
  * @property {Element} [element] - Element used for component module initialisation
149
158
  * @property {ComponentClass} [component] - Class of component
150
- * @property {ComponentConfig<ComponentClass>} config - Config supplied to component
159
+ * @property {Config | ComponentConfig<ComponentClass>} [config] - Config supplied to components
151
160
  */
152
161
  /**
153
162
  * @template {CompatibleClass} ComponentClass
@@ -158,7 +167,7 @@ function createAll(Component, config, createAllOptions) {
158
167
  /**
159
168
  * @template {CompatibleClass} ComponentClass
160
169
  * @typedef {object} CreateAllOptions
161
- * @property {Element | Document} [scope] - scope of the document to search within
170
+ * @property {Element | Document | null} [scope] - scope of the document to search within
162
171
  * @property {OnErrorCallback<ComponentClass>} [onError] - callback function if error throw by component on init
163
172
  */
164
173
 
@@ -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 { 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,CAAC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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;;;;"}
1
+ {"version":3,"file":"init.mjs","sources":["../../src/govuk/init.mjs"],"sourcesContent":["import { normaliseOptions } from './common/configuration.mjs'\nimport { isObject, 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 { ElementError, 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 | Element | Document | null} [scopeOrConfig] - Scope of the document to search within or config for all components (with optional scope)\n */\nfunction initAll(scopeOrConfig = {}) {\n const config = isObject(scopeOrConfig) ? scopeOrConfig : {}\n\n // Extract initialisation options\n const options = normaliseOptions(scopeOrConfig)\n\n try {\n // Skip initialisation when GOV.UK Frontend is not supported\n if (!isSupported()) {\n throw new SupportError()\n }\n\n // Users can initialise GOV.UK Frontend in certain sections of the page\n // unless the scope is null (for example, query selector not found)\n if (options.scope === null) {\n throw new ElementError({\n element: options.scope,\n identifier: 'GOV.UK Frontend scope element (`$scope`)'\n })\n }\n } catch (error) {\n if (options.onError) {\n options.onError(error, {\n config\n })\n } else {\n console.log(error)\n }\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 components.forEach(([Component, componentConfig]) => {\n createAll(Component, componentConfig, 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 | null | CreateAllOptions<ComponentClass>} [scopeOrOptions] - 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, scopeOrOptions) {\n let /** @type {NodeListOf<Element> | undefined} */ $elements\n\n // Extract initialisation options\n const options = normaliseOptions(scopeOrOptions)\n\n try {\n // Skip initialisation when GOV.UK Frontend is not supported\n if (!isSupported()) {\n throw new SupportError()\n }\n\n // Users can initialise GOV.UK Frontend in certain sections of the page\n // unless the scope is null (for example, query selector not found)\n if (options.scope === null) {\n throw new ElementError({\n element: options.scope,\n component: Component,\n identifier: 'Scope element (`$scope`)'\n })\n }\n\n $elements = options.scope?.querySelectorAll(\n `[data-module=\"${Component.moduleName}\"]`\n )\n } catch (error) {\n if (options.onError) {\n options.onError(error, {\n component: Component,\n config\n })\n } else {\n console.log(error)\n }\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 (options.onError) {\n options.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 {Element | Document | null} [scope] - Scope of the document to search within\n * @property {OnErrorCallback<CompatibleClass>} [onError] - Initialisation error callback\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 Omit<Config, 'scope' | 'onError'>} 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 {Config | ComponentConfig<ComponentClass>} [config] - Config supplied to components\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 | null} [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","scopeOrConfig","config","isObject","options","normaliseOptions","isSupported","SupportError","scope","ElementError","element","identifier","error","onError","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","forEach","Component","componentConfig","createAll","scopeOrOptions","$elements","_options$scope","component","querySelectorAll","moduleName","Array","from","map","$element","filter","Boolean"],"mappings":";;;;;;;;;;;;;;;;;;AAkBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,OAAOA,CAACC,aAAa,GAAG,EAAE,EAAE;EACnC,MAAMC,MAAM,GAAGC,QAAQ,CAACF,aAAa,CAAC,GAAGA,aAAa,GAAG,EAAE;AAG3D,EAAA,MAAMG,OAAO,GAAGC,gBAAgB,CAACJ,aAAa,CAAC;EAE/C,IAAI;AAEF,IAAA,IAAI,CAACK,WAAW,EAAE,EAAE;MAClB,MAAM,IAAIC,YAAY,EAAE;AAC1B,IAAA;AAIA,IAAA,IAAIH,OAAO,CAACI,KAAK,KAAK,IAAI,EAAE;MAC1B,MAAM,IAAIC,YAAY,CAAC;QACrBC,OAAO,EAAEN,OAAO,CAACI,KAAK;AACtBG,QAAAA,UAAU,EAAE;AACd,OAAC,CAAC;AACJ,IAAA;EACF,CAAC,CAAC,OAAOC,KAAK,EAAE;IACd,IAAIR,OAAO,CAACS,OAAO,EAAE;AACnBT,MAAAA,OAAO,CAACS,OAAO,CAACD,KAAK,EAAE;AACrBV,QAAAA;AACF,OAAC,CAAC;AACJ,IAAA,CAAC,MAAM;AACLY,MAAAA,OAAO,CAACC,GAAG,CAACH,KAAK,CAAC;AACpB,IAAA;AAEA,IAAA;AACF,EAAA;AAEA,EAAA,MAAMI,UAAU,GAAyB,CACvC,CAACC,SAAS,EAAEf,MAAM,CAACgB,SAAS,CAAC,EAC7B,CAACC,MAAM,EAAEjB,MAAM,CAACkB,MAAM,CAAC,EACvB,CAACC,cAAc,EAAEnB,MAAM,CAACoB,cAAc,CAAC,EACvC,CAACC,UAAU,CAAC,EACZ,CAACC,YAAY,EAAEtB,MAAM,CAACuB,YAAY,CAAC,EACnC,CAACC,YAAY,EAAExB,MAAM,CAACyB,YAAY,CAAC,EACnC,CAACC,UAAU,EAAE1B,MAAM,CAAC2B,UAAU,CAAC,EAC/B,CAACC,MAAM,CAAC,E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
  use alongide the Tudor Crown, so don't bother with offsetting for the
50
50
  St. Edward's Crown. #}
51
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.1s-4,3.6-6.5,4.7c-2.6,1.1-5.5,1.7-8.7,1.7s-6.1-.6-8.7-1.7c-2.6-1.1-4.7-2.7-6.5-4.7-1.8-2-3.1-4.4-4.1-7.1-.9-2.7-1.4-5.6-1.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8-1 1.4-2.01 1.61-3.01s.4-2.01.4-3.01v.14h-10.86v-7.02h20.07v24.08h-8.03v-5.56c-.6.8-1.38 1.61-2.19 2.41-.8.8-1.81 1.2-2.81 1.81-1 .4-2.21.8-3.41 1.2s-2.41.4-3.81.4a18.56 18.56 0 0 1-14.65-6.63c-1.6-2.01-3.01-4.41-3.81-7.02s-1.4-5.62-1.4-8.83.4-6.02 1.4-8.83a20.45 20.45 0 0 1 19.46-13.65c3.21 0 4.01.2 5.82.8 1.81.4 3.61 1.2 5.02 2.01 1.61.8 2.81 2.01 4.01 3.21s2.21 2.61 2.81 4.21l-7.63 4.41c-.4-1-1-1.81-1.61-2.61-.6-.8-1.4-1.4-2.21-2.01-.8-.6-1.81-1-2.81-1.4-1-.4-2.21-.4-3.61-.4-2.01 0-3.81.4-5.22 1.2-1.4.8-2.61 1.81-3.61 3.21s-1.61 2.81-2.21 4.62c-.4 1.81-.6 3.71-.6 5.42s.8 5.22.8 5.22Zm57.8-27.9c3.21 0 6.22.6 8.63 1.81 2.41 1.2 4.82 2.81 6.62 4.82S170.2 24.39 171 27s1.4 5.62 1.4 8.83-.4 6.02-1.4 8.83-2.41 5.02-4.01 7.02-4.01 3.61-6.62 4.82-5.42 1.81-8.63 1.81-6.22-.6-8.63-1.81-4.82-2.81-6.42-4.82-3.21-4.41-4.01-7.02-1.4-5.62-1.4-8.83.4-6.02 1.4-8.83 2.41-5.02 4.01-7.02 4.01-3.61 6.42-4.82 5.42-1.81 8.63-1.81Zm0 36.73c1.81 0 3.61-.4 5.02-1s2.61-1.81 3.61-3.01 1.81-2.81 2.21-4.41c.4-1.81.8-3.61.8-5.62 0-2.21-.2-4.21-.8-6.02s-1.2-3.21-2.21-4.62c-1-1.2-2.21-2.21-3.61-3.01s-3.21-1-5.02-1-3.61.4-5.02 1c-1.4.8-2.61 1.81-3.61 3.01s-1.81 2.81-2.21 4.62c-.4 1.81-.8 3.61-.8 5.62 0 2.41.2 4.21.8 6.02.4 1.81 1.2 3.21 2.21 4.41s2.21 2.21 3.61 3.01c1.4.8 3.21 1 5.02 1Zm36.32 7.96-12.24-44.15h9.83l8.43 32.77h.4l8.23-32.77h9.83L200.3 58.04h-12.24Zm74.14-7.96c2.18 0 3.51-.6 3.51-.6 1.2-.6 2.01-1 2.81-1.81s1.4-1.81 1.81-2.81a13 13 0 0 0 .8-4.01V13.9h8.63v28.15c0 2.41-.4 4.62-1.4 6.62-.8 2.01-2.21 3.61-3.61 5.02s-3.41 2.41-5.62 3.21-4.62 1.2-7.02 1.2-5.02-.4-7.02-1.2c-2.21-.8-4.01-1.81-5.62-3.21s-2.81-3.01-3.61-5.02-1.4-4.21-1.4-6.62V13.9h8.63v26.95c0 1.61.2 3.01.8 4.01.4 1.2 1.2 2.21 2.01 2.81.8.8 1.81 1.4 2.81 1.81 0 0 1.34.6 3.51.6Zm34.22-36.18v18.92l15.65-18.92h10.82l-15.03 17.32 16.03 26.83h-10.21l-11.44-20.21-5.62 6.22v13.99h-8.83V13.9"/>
54
54
  {%- endset %}
55
55
 
56
56
  {#- The SVG needs `focusable="false"` so that Internet Explorer does not treat
@@ -184,12 +184,12 @@ $govuk-link-active-colour: govuk-colour("black") !default;
184
184
  ///
185
185
  /// @type Colour
186
186
  /// @access private
187
- $_govuk-rebrand-template-background-colour: #f4f8fb; // Blue tint 95%
187
+ $_govuk-rebrand-template-background-colour: govuk-tint($govuk-brand-colour, 95%);
188
188
 
189
189
  /// Border colour for areas on a light-blue background
190
190
  ///
191
191
  /// @type Colour
192
192
  /// @access private
193
- $_govuk-rebrand-border-colour-on-blue-tint-95: #8eb8dc; // Blue tint 50%
193
+ $_govuk-rebrand-border-colour-on-blue-tint-95: govuk-tint($govuk-brand-colour, 50%);
194
194
 
195
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,2B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;AACf,iBAAiB;;AAEjB,uDAAuD;;AAEvD,sBAAsB;AACtB,EAAE;AACF,oCAAoC;AACpC,EAAE;AACF,eAAe;AACf,iBAAiB;;AAEjB,0DAA0D;;AAE1D,qBAAqB;AACrB,EAAE;AACF,yCAAyC;AACzC,EAAE;AACF,eAAe;AACf,iBAAiB;;AAEjB,sDAAsD;;AAEtD,+EAA+E;AAC/E,OAAO;AACP,+EAA+E;;AAE/E,cAAc;AACd,EAAE;AACF,eAAe;AACf,iBAAiB;;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;;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"]}
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,6BAA6B;AAC7B,EAAE;AACF,iEAAiE;AACjE,kEAAkE;AAClE,EAAE;AACF,eAAe;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D,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,gFAAgF;;AAEhF,qDAAqD;AACrD,EAAE;AACF,eAAe;AACf,kBAAkB;AAClB,mFAAmF","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: govuk-tint($govuk-brand-colour, 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: govuk-tint($govuk-brand-colour, 50%);\n"]}