govuk_publishing_components 42.1.0 → 43.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (487) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/stylesheets/govuk_publishing_components/_all_components.scss +1 -1
  3. data/app/assets/stylesheets/govuk_publishing_components/component_support.scss +4 -4
  4. data/app/assets/stylesheets/govuk_publishing_components/components/_breadcrumbs.scss +1 -1
  5. data/app/assets/stylesheets/govuk_publishing_components/components/_govspeak-html-publication.scss +5 -3
  6. data/app/assets/stylesheets/govuk_publishing_components/components/_layout-for-admin.scss +1 -1
  7. data/app/assets/stylesheets/govuk_publishing_components/components/_search.scss +2 -7
  8. data/app/assets/stylesheets/govuk_publishing_components/components/helpers/_brand-colours.scss +24 -2
  9. data/app/assets/stylesheets/govuk_publishing_components/components/helpers/_govuk-frontend-settings.scss +2 -0
  10. data/app/views/govuk_publishing_components/components/_breadcrumbs.html.erb +2 -1
  11. data/app/views/govuk_publishing_components/components/docs/organisation_logo.yml +1 -1
  12. data/lib/govuk_publishing_components/version.rb +1 -1
  13. data/node_modules/govuk-frontend/dist/govuk/_base.scss +3 -3
  14. data/node_modules/govuk-frontend/dist/govuk/_base.scss.map +1 -1
  15. data/node_modules/govuk-frontend/dist/govuk/all.bundle.js +451 -176
  16. data/node_modules/govuk-frontend/dist/govuk/all.bundle.js.map +1 -1
  17. data/node_modules/govuk-frontend/dist/govuk/all.bundle.mjs +450 -177
  18. data/node_modules/govuk-frontend/dist/govuk/all.bundle.mjs.map +1 -1
  19. data/node_modules/govuk-frontend/dist/govuk/all.mjs +13 -76
  20. data/node_modules/govuk-frontend/dist/govuk/all.mjs.map +1 -1
  21. data/node_modules/govuk-frontend/dist/govuk/all.scss +1 -9
  22. data/node_modules/govuk-frontend/dist/govuk/all.scss.map +1 -1
  23. data/node_modules/govuk-frontend/dist/govuk/common/closest-attribute-value.mjs.map +1 -1
  24. data/node_modules/govuk-frontend/dist/govuk/common/govuk-frontend-version.mjs +1 -1
  25. data/node_modules/govuk-frontend/dist/govuk/common/index.mjs +56 -36
  26. data/node_modules/govuk-frontend/dist/govuk/common/index.mjs.map +1 -1
  27. data/node_modules/govuk-frontend/dist/govuk/common/normalise-dataset.mjs +12 -20
  28. data/node_modules/govuk-frontend/dist/govuk/common/normalise-dataset.mjs.map +1 -1
  29. data/node_modules/govuk-frontend/dist/govuk/common/normalise-string.mjs +31 -0
  30. data/node_modules/govuk-frontend/dist/govuk/common/normalise-string.mjs.map +1 -0
  31. data/node_modules/govuk-frontend/dist/govuk/components/_all.scss +7 -35
  32. data/node_modules/govuk-frontend/dist/govuk/components/_all.scss.map +1 -1
  33. data/node_modules/govuk-frontend/dist/govuk/components/_index.scss +39 -0
  34. data/node_modules/govuk-frontend/dist/govuk/components/_index.scss.map +1 -0
  35. data/node_modules/govuk-frontend/dist/govuk/components/accordion/_index.scss +35 -31
  36. data/node_modules/govuk-frontend/dist/govuk/components/accordion/_index.scss.map +1 -1
  37. data/node_modules/govuk-frontend/dist/govuk/components/accordion/accordion.bundle.js +177 -133
  38. data/node_modules/govuk-frontend/dist/govuk/components/accordion/accordion.bundle.js.map +1 -1
  39. data/node_modules/govuk-frontend/dist/govuk/components/accordion/accordion.bundle.mjs +177 -133
  40. data/node_modules/govuk-frontend/dist/govuk/components/accordion/accordion.bundle.mjs.map +1 -1
  41. data/node_modules/govuk-frontend/dist/govuk/components/accordion/accordion.mjs +80 -76
  42. data/node_modules/govuk-frontend/dist/govuk/components/accordion/accordion.mjs.map +1 -1
  43. data/node_modules/govuk-frontend/dist/govuk/components/accordion/fixtures.json +16 -3
  44. data/node_modules/govuk-frontend/dist/govuk/components/accordion/template.njk +2 -1
  45. data/node_modules/govuk-frontend/dist/govuk/components/back-link/fixtures.json +25 -15
  46. data/node_modules/govuk-frontend/dist/govuk/components/back-link/template-with-custom-link.html +1 -0
  47. data/node_modules/govuk-frontend/dist/govuk/components/back-link/template.njk +6 -2
  48. data/node_modules/govuk-frontend/dist/govuk/components/breadcrumbs/fixtures.json +53 -15
  49. data/node_modules/govuk-frontend/dist/govuk/components/breadcrumbs/macro-options.json +6 -0
  50. data/node_modules/govuk-frontend/dist/govuk/components/breadcrumbs/template-default.html +2 -2
  51. data/node_modules/govuk-frontend/dist/govuk/components/breadcrumbs/template-inverse.html +2 -2
  52. data/node_modules/govuk-frontend/dist/govuk/components/breadcrumbs/template-with-collapse-on-mobile.html +2 -2
  53. data/node_modules/govuk-frontend/dist/govuk/components/breadcrumbs/template-with-last-breadcrumb-as-current-page.html +2 -2
  54. data/node_modules/govuk-frontend/dist/govuk/components/breadcrumbs/template-with-multiple-levels.html +2 -2
  55. data/node_modules/govuk-frontend/dist/govuk/components/breadcrumbs/template-with-one-level.html +2 -2
  56. data/node_modules/govuk-frontend/dist/govuk/components/breadcrumbs/template-without-the-home-section.html +2 -2
  57. data/node_modules/govuk-frontend/dist/govuk/components/breadcrumbs/template.njk +6 -4
  58. data/node_modules/govuk-frontend/dist/govuk/components/button/button.bundle.js +97 -39
  59. data/node_modules/govuk-frontend/dist/govuk/components/button/button.bundle.js.map +1 -1
  60. data/node_modules/govuk-frontend/dist/govuk/components/button/button.bundle.mjs +97 -39
  61. data/node_modules/govuk-frontend/dist/govuk/components/button/button.bundle.mjs.map +1 -1
  62. data/node_modules/govuk-frontend/dist/govuk/components/button/button.mjs +13 -3
  63. data/node_modules/govuk-frontend/dist/govuk/components/button/button.mjs.map +1 -1
  64. data/node_modules/govuk-frontend/dist/govuk/components/button/fixtures.json +38 -0
  65. data/node_modules/govuk-frontend/dist/govuk/components/button/template.njk +4 -2
  66. data/node_modules/govuk-frontend/dist/govuk/components/character-count/_index.scss +4 -4
  67. data/node_modules/govuk-frontend/dist/govuk/components/character-count/_index.scss.map +1 -1
  68. data/node_modules/govuk-frontend/dist/govuk/components/character-count/character-count.bundle.js +125 -69
  69. data/node_modules/govuk-frontend/dist/govuk/components/character-count/character-count.bundle.js.map +1 -1
  70. data/node_modules/govuk-frontend/dist/govuk/components/character-count/character-count.bundle.mjs +125 -69
  71. data/node_modules/govuk-frontend/dist/govuk/components/character-count/character-count.bundle.mjs.map +1 -1
  72. data/node_modules/govuk-frontend/dist/govuk/components/character-count/character-count.mjs +17 -3
  73. data/node_modules/govuk-frontend/dist/govuk/components/character-count/character-count.mjs.map +1 -1
  74. data/node_modules/govuk-frontend/dist/govuk/components/character-count/fixtures.json +46 -23
  75. data/node_modules/govuk-frontend/dist/govuk/components/character-count/macro-options.json +40 -0
  76. data/node_modules/govuk-frontend/dist/govuk/components/character-count/template-default.html +1 -4
  77. data/node_modules/govuk-frontend/dist/govuk/components/character-count/template-with-custom-rows.html +1 -4
  78. data/node_modules/govuk-frontend/dist/govuk/components/character-count/template-with-custom-textarea-description.html +1 -4
  79. data/node_modules/govuk-frontend/dist/govuk/components/character-count/template-with-default-value-exceeding-limit.html +1 -4
  80. data/node_modules/govuk-frontend/dist/govuk/components/character-count/template-with-default-value.html +1 -4
  81. data/node_modules/govuk-frontend/dist/govuk/components/character-count/template-with-hint.html +1 -4
  82. data/node_modules/govuk-frontend/dist/govuk/components/character-count/template-with-label-as-page-heading.html +1 -4
  83. data/node_modules/govuk-frontend/dist/govuk/components/character-count/template-with-threshold.html +1 -4
  84. data/node_modules/govuk-frontend/dist/govuk/components/character-count/template-with-translations.html +1 -4
  85. data/node_modules/govuk-frontend/dist/govuk/components/character-count/template-with-word-count.html +1 -4
  86. data/node_modules/govuk-frontend/dist/govuk/components/character-count/template.njk +72 -39
  87. data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/_index.scss +10 -2
  88. data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/_index.scss.map +1 -1
  89. data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/checkboxes.bundle.js +9 -1
  90. data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/checkboxes.bundle.js.map +1 -1
  91. data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/checkboxes.bundle.mjs +9 -1
  92. data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/checkboxes.bundle.mjs.map +1 -1
  93. data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/checkboxes.mjs +1 -1
  94. data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/checkboxes.mjs.map +1 -1
  95. data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/fixtures.json +153 -47
  96. data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/macro-options.json +40 -0
  97. data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/template-default.html +12 -12
  98. data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/template-small-with-conditional-reveal.html +11 -12
  99. data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/template-small-with-disabled.html +12 -12
  100. data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/template-small-with-divider-and-none.html +34 -0
  101. data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/template-small-with-error.html +12 -12
  102. data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/template-small-with-hint.html +13 -13
  103. data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/template-small-with-long-text.html +12 -12
  104. data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/template-small.html +12 -12
  105. data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/template-with-a-medium-legend.html +12 -12
  106. data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/template-with-conditional-item-checked.html +21 -24
  107. data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/template-with-conditional-items-with-special-characters.html +21 -24
  108. data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/template-with-conditional-items.html +21 -24
  109. data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/template-with-disabled-item.html +10 -10
  110. data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/template-with-divider-and-none.html +17 -16
  111. data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/template-with-divider-none-and-conditional-items.html +24 -24
  112. data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/template-with-error-message-and-hints-on-items.html +15 -15
  113. data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/template-with-error-message.html +12 -12
  114. data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/template-with-fieldset-and-error-message.html +12 -12
  115. data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/template-with-hints-on-items.html +10 -10
  116. data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/template-with-id-and-name.html +12 -12
  117. data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/template-with-legend-as-a-page-heading.html +12 -12
  118. data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/template-with-optional-form-group-classes-showing-group-error.html +21 -24
  119. data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/template-with-pre-checked-values.html +15 -16
  120. data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/template-with-single-option-and-hint-set-aria-describedby-on-input.html +5 -5
  121. data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/template-with-single-option-set-aria-describedby-on-input.html +4 -4
  122. data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/template-with-very-long-option-text.html +12 -12
  123. data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/template-without-fieldset.html +12 -12
  124. data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/template.njk +58 -54
  125. data/node_modules/govuk-frontend/dist/govuk/components/cookie-banner/_index.scss +17 -14
  126. data/node_modules/govuk-frontend/dist/govuk/components/cookie-banner/_index.scss.map +1 -1
  127. data/node_modules/govuk-frontend/dist/govuk/components/cookie-banner/fixtures.json +46 -23
  128. data/node_modules/govuk-frontend/dist/govuk/components/cookie-banner/template-accepted-confirmation-banner.html +11 -8
  129. data/node_modules/govuk-frontend/dist/govuk/components/cookie-banner/template-client-side-implementation.html +38 -29
  130. data/node_modules/govuk-frontend/dist/govuk/components/cookie-banner/template-default.html +18 -13
  131. data/node_modules/govuk-frontend/dist/govuk/components/cookie-banner/template-rejected-confirmation-banner.html +11 -8
  132. data/node_modules/govuk-frontend/dist/govuk/components/cookie-banner/template-with-html.html +19 -15
  133. data/node_modules/govuk-frontend/dist/govuk/components/cookie-banner/template.njk +37 -44
  134. data/node_modules/govuk-frontend/dist/govuk/components/date-input/_index.scss +1 -2
  135. data/node_modules/govuk-frontend/dist/govuk/components/date-input/_index.scss.map +1 -1
  136. data/node_modules/govuk-frontend/dist/govuk/components/date-input/fixtures.json +27 -0
  137. data/node_modules/govuk-frontend/dist/govuk/components/date-input/macro-options.json +40 -0
  138. data/node_modules/govuk-frontend/dist/govuk/components/date-input/template.njk +10 -3
  139. data/node_modules/govuk-frontend/dist/govuk/components/details/fixtures.json +10 -0
  140. data/node_modules/govuk-frontend/dist/govuk/components/details/template.njk +6 -2
  141. data/node_modules/govuk-frontend/dist/govuk/components/error-message/fixtures.json +9 -0
  142. data/node_modules/govuk-frontend/dist/govuk/components/error-message/template.njk +4 -1
  143. data/node_modules/govuk-frontend/dist/govuk/components/error-summary/_index.scss +14 -3
  144. data/node_modules/govuk-frontend/dist/govuk/components/error-summary/_index.scss.map +1 -1
  145. data/node_modules/govuk-frontend/dist/govuk/components/error-summary/error-summary.bundle.js +96 -37
  146. data/node_modules/govuk-frontend/dist/govuk/components/error-summary/error-summary.bundle.js.map +1 -1
  147. data/node_modules/govuk-frontend/dist/govuk/components/error-summary/error-summary.bundle.mjs +96 -37
  148. data/node_modules/govuk-frontend/dist/govuk/components/error-summary/error-summary.bundle.mjs.map +1 -1
  149. data/node_modules/govuk-frontend/dist/govuk/components/error-summary/error-summary.mjs +12 -1
  150. data/node_modules/govuk-frontend/dist/govuk/components/error-summary/error-summary.mjs.map +1 -1
  151. data/node_modules/govuk-frontend/dist/govuk/components/error-summary/fixtures.json +48 -18
  152. data/node_modules/govuk-frontend/dist/govuk/components/error-summary/macro-options.json +2 -2
  153. data/node_modules/govuk-frontend/dist/govuk/components/error-summary/template-default.html +8 -8
  154. data/node_modules/govuk-frontend/dist/govuk/components/error-summary/template-mixed-with-and-without-links.html +8 -8
  155. data/node_modules/govuk-frontend/dist/govuk/components/error-summary/template-with-description-only.html +12 -0
  156. data/node_modules/govuk-frontend/dist/govuk/components/error-summary/template-with-everything.html +8 -8
  157. data/node_modules/govuk-frontend/dist/govuk/components/error-summary/template-without-links.html +5 -5
  158. data/node_modules/govuk-frontend/dist/govuk/components/error-summary/template.njk +19 -14
  159. data/node_modules/govuk-frontend/dist/govuk/components/exit-this-page/exit-this-page.bundle.js +112 -61
  160. data/node_modules/govuk-frontend/dist/govuk/components/exit-this-page/exit-this-page.bundle.js.map +1 -1
  161. data/node_modules/govuk-frontend/dist/govuk/components/exit-this-page/exit-this-page.bundle.mjs +112 -61
  162. data/node_modules/govuk-frontend/dist/govuk/components/exit-this-page/exit-this-page.bundle.mjs.map +1 -1
  163. data/node_modules/govuk-frontend/dist/govuk/components/exit-this-page/exit-this-page.mjs +15 -4
  164. data/node_modules/govuk-frontend/dist/govuk/components/exit-this-page/exit-this-page.mjs.map +1 -1
  165. data/node_modules/govuk-frontend/dist/govuk/components/exit-this-page/fixtures.json +4 -0
  166. data/node_modules/govuk-frontend/dist/govuk/components/exit-this-page/template.njk +3 -1
  167. data/node_modules/govuk-frontend/dist/govuk/components/fieldset/_index.scss +3 -5
  168. data/node_modules/govuk-frontend/dist/govuk/components/fieldset/_index.scss.map +1 -1
  169. data/node_modules/govuk-frontend/dist/govuk/components/fieldset/fixtures.json +18 -0
  170. data/node_modules/govuk-frontend/dist/govuk/components/fieldset/template.njk +3 -1
  171. data/node_modules/govuk-frontend/dist/govuk/components/file-upload/_index.scss +8 -9
  172. data/node_modules/govuk-frontend/dist/govuk/components/file-upload/_index.scss.map +1 -1
  173. data/node_modules/govuk-frontend/dist/govuk/components/file-upload/fixtures.json +13 -0
  174. data/node_modules/govuk-frontend/dist/govuk/components/file-upload/macro-options.json +40 -0
  175. data/node_modules/govuk-frontend/dist/govuk/components/file-upload/template.njk +10 -2
  176. data/node_modules/govuk-frontend/dist/govuk/components/footer/_index.scss +1 -1
  177. data/node_modules/govuk-frontend/dist/govuk/components/footer/_index.scss.map +1 -1
  178. data/node_modules/govuk-frontend/dist/govuk/components/footer/fixtures.json +46 -23
  179. data/node_modules/govuk-frontend/dist/govuk/components/footer/template-default.html +10 -9
  180. data/node_modules/govuk-frontend/dist/govuk/components/footer/template-full-gds-example.html +41 -40
  181. data/node_modules/govuk-frontend/dist/govuk/components/footer/template-three-equal-columns.html +10 -9
  182. data/node_modules/govuk-frontend/dist/govuk/components/footer/template-with-custom-html-content-licence-and-copyright-notice.html +5 -4
  183. data/node_modules/govuk-frontend/dist/govuk/components/footer/template-with-custom-meta.html +14 -13
  184. data/node_modules/govuk-frontend/dist/govuk/components/footer/template-with-custom-text-content-licence-and-copyright-notice.html +5 -4
  185. data/node_modules/govuk-frontend/dist/govuk/components/footer/template-with-default-width-navigation-one-column.html +10 -9
  186. data/node_modules/govuk-frontend/dist/govuk/components/footer/template-with-default-width-navigation-two-columns.html +10 -9
  187. data/node_modules/govuk-frontend/dist/govuk/components/footer/template-with-meta-links-and-meta-content.html +56 -55
  188. data/node_modules/govuk-frontend/dist/govuk/components/footer/template-with-meta.html +28 -27
  189. data/node_modules/govuk-frontend/dist/govuk/components/footer/template-with-navigation.html +10 -9
  190. data/node_modules/govuk-frontend/dist/govuk/components/footer/template.njk +42 -38
  191. data/node_modules/govuk-frontend/dist/govuk/components/header/_index.scss +1 -1
  192. data/node_modules/govuk-frontend/dist/govuk/components/header/_index.scss.map +1 -1
  193. data/node_modules/govuk-frontend/dist/govuk/components/header/fixtures.json +49 -26
  194. data/node_modules/govuk-frontend/dist/govuk/components/header/header.bundle.js +8 -0
  195. data/node_modules/govuk-frontend/dist/govuk/components/header/header.bundle.js.map +1 -1
  196. data/node_modules/govuk-frontend/dist/govuk/components/header/header.bundle.mjs +8 -0
  197. data/node_modules/govuk-frontend/dist/govuk/components/header/header.bundle.mjs.map +1 -1
  198. data/node_modules/govuk-frontend/dist/govuk/components/header/header.mjs.map +1 -1
  199. data/node_modules/govuk-frontend/dist/govuk/components/header/macro-options.json +1 -1
  200. data/node_modules/govuk-frontend/dist/govuk/components/header/template-default.html +13 -16
  201. data/node_modules/govuk-frontend/dist/govuk/components/header/template-full-width-with-navigation.html +35 -36
  202. data/node_modules/govuk-frontend/dist/govuk/components/header/template-full-width.html +13 -16
  203. data/node_modules/govuk-frontend/dist/govuk/components/header/template-navigation-item-with-html.html +35 -36
  204. data/node_modules/govuk-frontend/dist/govuk/components/header/template-navigation-item-with-text-without-link.html +29 -30
  205. data/node_modules/govuk-frontend/dist/govuk/components/header/template-with-custom-menu-button-label.html +40 -41
  206. data/node_modules/govuk-frontend/dist/govuk/components/header/template-with-custom-menu-button-text.html +40 -41
  207. data/node_modules/govuk-frontend/dist/govuk/components/header/template-with-custom-navigation-label.html +40 -41
  208. data/node_modules/govuk-frontend/dist/govuk/components/header/template-with-large-navigation.html +100 -101
  209. data/node_modules/govuk-frontend/dist/govuk/components/header/template-with-navigation.html +40 -41
  210. data/node_modules/govuk-frontend/dist/govuk/components/header/template-with-product-name.html +13 -16
  211. data/node_modules/govuk-frontend/dist/govuk/components/header/template-with-service-name-and-navigation.html +40 -41
  212. data/node_modules/govuk-frontend/dist/govuk/components/header/template-with-service-name-but-no-service-url.html +13 -16
  213. data/node_modules/govuk-frontend/dist/govuk/components/header/template-with-service-name.html +13 -16
  214. data/node_modules/govuk-frontend/dist/govuk/components/header/template-with-st-edwards-crown.html +21 -0
  215. data/node_modules/govuk-frontend/dist/govuk/components/header/template.njk +31 -26
  216. data/node_modules/govuk-frontend/dist/govuk/components/hint/fixtures.json +6 -0
  217. data/node_modules/govuk-frontend/dist/govuk/components/hint/template.njk +3 -1
  218. data/node_modules/govuk-frontend/dist/govuk/components/input/_index.scss +7 -4
  219. data/node_modules/govuk-frontend/dist/govuk/components/input/_index.scss.map +1 -1
  220. data/node_modules/govuk-frontend/dist/govuk/components/input/fixtures.json +138 -25
  221. data/node_modules/govuk-frontend/dist/govuk/components/input/macro-options.json +67 -1
  222. data/node_modules/govuk-frontend/dist/govuk/components/input/template-disabled.html +6 -0
  223. data/node_modules/govuk-frontend/dist/govuk/components/input/template-with-autocapitalize-turned-off.html +6 -0
  224. data/node_modules/govuk-frontend/dist/govuk/components/input/template-with-error-and-hint.html +12 -0
  225. data/node_modules/govuk-frontend/dist/govuk/components/input/template-with-error-message.html +2 -5
  226. data/node_modules/govuk-frontend/dist/govuk/components/input/template.njk +70 -14
  227. data/node_modules/govuk-frontend/dist/govuk/components/inset-text/fixtures.json +7 -1
  228. data/node_modules/govuk-frontend/dist/govuk/components/inset-text/template-with-html.html +8 -9
  229. data/node_modules/govuk-frontend/dist/govuk/components/inset-text/template.njk +4 -2
  230. data/node_modules/govuk-frontend/dist/govuk/components/label/fixtures.json +17 -0
  231. data/node_modules/govuk-frontend/dist/govuk/components/label/template.njk +3 -1
  232. data/node_modules/govuk-frontend/dist/govuk/components/notification-banner/_index.scss +3 -2
  233. data/node_modules/govuk-frontend/dist/govuk/components/notification-banner/_index.scss.map +1 -1
  234. data/node_modules/govuk-frontend/dist/govuk/components/notification-banner/fixtures.json +50 -26
  235. data/node_modules/govuk-frontend/dist/govuk/components/notification-banner/notification-banner.bundle.js +96 -37
  236. data/node_modules/govuk-frontend/dist/govuk/components/notification-banner/notification-banner.bundle.js.map +1 -1
  237. data/node_modules/govuk-frontend/dist/govuk/components/notification-banner/notification-banner.bundle.mjs +96 -37
  238. data/node_modules/govuk-frontend/dist/govuk/components/notification-banner/notification-banner.bundle.mjs.map +1 -1
  239. data/node_modules/govuk-frontend/dist/govuk/components/notification-banner/notification-banner.mjs +12 -1
  240. data/node_modules/govuk-frontend/dist/govuk/components/notification-banner/notification-banner.mjs.map +1 -1
  241. data/node_modules/govuk-frontend/dist/govuk/components/notification-banner/template-auto-focus-disabled-with-type-as-success.html +4 -1
  242. data/node_modules/govuk-frontend/dist/govuk/components/notification-banner/template-auto-focus-explicitly-enabled-with-type-as-success.html +4 -1
  243. data/node_modules/govuk-frontend/dist/govuk/components/notification-banner/template-custom-tabindex.html +4 -1
  244. data/node_modules/govuk-frontend/dist/govuk/components/notification-banner/template-default.html +4 -1
  245. data/node_modules/govuk-frontend/dist/govuk/components/notification-banner/template-paragraph-as-html-heading.html +3 -2
  246. data/node_modules/govuk-frontend/dist/govuk/components/notification-banner/template-rolealert-overridden-to-roleregion-with-type-as-success.html +4 -1
  247. data/node_modules/govuk-frontend/dist/govuk/components/notification-banner/template-success-with-custom-html.html +9 -8
  248. data/node_modules/govuk-frontend/dist/govuk/components/notification-banner/template-with-a-list.html +9 -8
  249. data/node_modules/govuk-frontend/dist/govuk/components/notification-banner/template-with-long-heading.html +4 -1
  250. data/node_modules/govuk-frontend/dist/govuk/components/notification-banner/template-with-lots-of-content.html +12 -9
  251. data/node_modules/govuk-frontend/dist/govuk/components/notification-banner/template-with-text-as-html.html +8 -5
  252. data/node_modules/govuk-frontend/dist/govuk/components/notification-banner/template-with-type-as-success.html +4 -1
  253. data/node_modules/govuk-frontend/dist/govuk/components/notification-banner/template.njk +11 -7
  254. data/node_modules/govuk-frontend/dist/govuk/components/pagination/_index.scss +24 -37
  255. data/node_modules/govuk-frontend/dist/govuk/components/pagination/_index.scss.map +1 -1
  256. data/node_modules/govuk-frontend/dist/govuk/components/pagination/fixtures.json +30 -15
  257. data/node_modules/govuk-frontend/dist/govuk/components/pagination/template-default.html +38 -23
  258. data/node_modules/govuk-frontend/dist/govuk/components/pagination/template-first-page.html +28 -16
  259. data/node_modules/govuk-frontend/dist/govuk/components/pagination/template-last-page.html +29 -20
  260. data/node_modules/govuk-frontend/dist/govuk/components/pagination/template-with-custom-accessible-labels-on-item-links.html +38 -23
  261. data/node_modules/govuk-frontend/dist/govuk/components/pagination/template-with-custom-link-and-item-text.html +38 -23
  262. data/node_modules/govuk-frontend/dist/govuk/components/pagination/template-with-custom-navigation-landmark.html +38 -23
  263. data/node_modules/govuk-frontend/dist/govuk/components/pagination/template-with-many-pages.html +64 -39
  264. data/node_modules/govuk-frontend/dist/govuk/components/pagination/template-with-next-only.html +11 -4
  265. data/node_modules/govuk-frontend/dist/govuk/components/pagination/template-with-prev-and-next-only-and-labels.html +25 -13
  266. data/node_modules/govuk-frontend/dist/govuk/components/pagination/template-with-prev-and-next-only-and-very-long-labels.html +25 -13
  267. data/node_modules/govuk-frontend/dist/govuk/components/pagination/template-with-prev-and-next-only-in-a-different-language.html +21 -11
  268. data/node_modules/govuk-frontend/dist/govuk/components/pagination/template-with-prev-and-next-only.html +21 -11
  269. data/node_modules/govuk-frontend/dist/govuk/components/pagination/template-with-previous-only.html +11 -7
  270. data/node_modules/govuk-frontend/dist/govuk/components/pagination/template.njk +78 -63
  271. data/node_modules/govuk-frontend/dist/govuk/components/panel/_index.scss +14 -10
  272. data/node_modules/govuk-frontend/dist/govuk/components/panel/_index.scss.map +1 -1
  273. data/node_modules/govuk-frontend/dist/govuk/components/panel/fixtures.json +9 -0
  274. data/node_modules/govuk-frontend/dist/govuk/components/panel/template.njk +6 -3
  275. data/node_modules/govuk-frontend/dist/govuk/components/password-input/_index.scss +57 -0
  276. data/node_modules/govuk-frontend/dist/govuk/components/password-input/_index.scss.map +1 -0
  277. data/node_modules/govuk-frontend/dist/govuk/components/password-input/_password-input.scss +4 -0
  278. data/node_modules/govuk-frontend/dist/govuk/components/password-input/_password-input.scss.map +1 -0
  279. data/node_modules/govuk-frontend/dist/govuk/components/password-input/fixtures.json +196 -0
  280. data/node_modules/govuk-frontend/dist/govuk/components/password-input/macro-options.json +181 -0
  281. data/node_modules/govuk-frontend/dist/govuk/components/password-input/macro.njk +3 -0
  282. data/node_modules/govuk-frontend/dist/govuk/components/password-input/password-input.bundle.js +528 -0
  283. data/node_modules/govuk-frontend/dist/govuk/components/password-input/password-input.bundle.js.map +1 -0
  284. data/node_modules/govuk-frontend/dist/govuk/components/password-input/password-input.bundle.mjs +520 -0
  285. data/node_modules/govuk-frontend/dist/govuk/components/password-input/password-input.bundle.mjs.map +1 -0
  286. data/node_modules/govuk-frontend/dist/govuk/components/password-input/password-input.mjs +163 -0
  287. data/node_modules/govuk-frontend/dist/govuk/components/password-input/password-input.mjs.map +1 -0
  288. data/node_modules/govuk-frontend/dist/govuk/components/password-input/template-default.html +11 -0
  289. data/node_modules/govuk-frontend/dist/govuk/components/password-input/template-with-error-message.html +17 -0
  290. data/node_modules/govuk-frontend/dist/govuk/components/password-input/template-with-hint-text.html +14 -0
  291. data/node_modules/govuk-frontend/dist/govuk/components/password-input/template-with-input-width-class.html +11 -0
  292. data/node_modules/govuk-frontend/dist/govuk/components/password-input/template-with-label-as-page-heading.html +13 -0
  293. data/node_modules/govuk-frontend/dist/govuk/components/password-input/template-with-new-password-autocomplete.html +11 -0
  294. data/node_modules/govuk-frontend/dist/govuk/components/password-input/template-with-translations.html +11 -0
  295. data/node_modules/govuk-frontend/dist/govuk/components/password-input/template.njk +91 -0
  296. data/node_modules/govuk-frontend/dist/govuk/components/phase-banner/_index.scss +6 -8
  297. data/node_modules/govuk-frontend/dist/govuk/components/phase-banner/_index.scss.map +1 -1
  298. data/node_modules/govuk-frontend/dist/govuk/components/phase-banner/fixtures.json +7 -0
  299. data/node_modules/govuk-frontend/dist/govuk/components/phase-banner/template.njk +4 -2
  300. data/node_modules/govuk-frontend/dist/govuk/components/radios/_index.scss +11 -6
  301. data/node_modules/govuk-frontend/dist/govuk/components/radios/_index.scss.map +1 -1
  302. data/node_modules/govuk-frontend/dist/govuk/components/radios/fixtures.json +113 -48
  303. data/node_modules/govuk-frontend/dist/govuk/components/radios/macro-options.json +41 -1
  304. data/node_modules/govuk-frontend/dist/govuk/components/radios/radios.bundle.js +8 -0
  305. data/node_modules/govuk-frontend/dist/govuk/components/radios/radios.bundle.js.map +1 -1
  306. data/node_modules/govuk-frontend/dist/govuk/components/radios/radios.bundle.mjs +8 -0
  307. data/node_modules/govuk-frontend/dist/govuk/components/radios/radios.bundle.mjs.map +1 -1
  308. data/node_modules/govuk-frontend/dist/govuk/components/radios/radios.mjs.map +1 -1
  309. data/node_modules/govuk-frontend/dist/govuk/components/radios/template-default.html +8 -8
  310. data/node_modules/govuk-frontend/dist/govuk/components/radios/template-inline.html +8 -8
  311. data/node_modules/govuk-frontend/dist/govuk/components/radios/template-prechecked-using-value.html +8 -8
  312. data/node_modules/govuk-frontend/dist/govuk/components/radios/template-prechecked.html +8 -8
  313. data/node_modules/govuk-frontend/dist/govuk/components/radios/template-small-inline-extreme.html +40 -40
  314. data/node_modules/govuk-frontend/dist/govuk/components/radios/template-small-inline.html +12 -12
  315. data/node_modules/govuk-frontend/dist/govuk/components/radios/template-small-with-a-divider.html +13 -12
  316. data/node_modules/govuk-frontend/dist/govuk/components/radios/template-small-with-conditional-reveal.html +15 -16
  317. data/node_modules/govuk-frontend/dist/govuk/components/radios/template-small-with-disabled.html +12 -12
  318. data/node_modules/govuk-frontend/dist/govuk/components/radios/template-small-with-error.html +12 -12
  319. data/node_modules/govuk-frontend/dist/govuk/components/radios/template-small-with-hint.html +13 -13
  320. data/node_modules/govuk-frontend/dist/govuk/components/radios/template-small-with-long-text.html +12 -12
  321. data/node_modules/govuk-frontend/dist/govuk/components/radios/template-small.html +12 -12
  322. data/node_modules/govuk-frontend/dist/govuk/components/radios/template-with-a-divider.html +13 -12
  323. data/node_modules/govuk-frontend/dist/govuk/components/radios/template-with-a-medium-legend.html +8 -8
  324. data/node_modules/govuk-frontend/dist/govuk/components/radios/template-with-conditional-item-checked.html +21 -24
  325. data/node_modules/govuk-frontend/dist/govuk/components/radios/template-with-conditional-items-and-pre-checked-value.html +21 -24
  326. data/node_modules/govuk-frontend/dist/govuk/components/radios/template-with-conditional-items-with-special-characters.html +21 -24
  327. data/node_modules/govuk-frontend/dist/govuk/components/radios/template-with-conditional-items.html +21 -24
  328. data/node_modules/govuk-frontend/dist/govuk/components/radios/template-with-disabled.html +10 -10
  329. data/node_modules/govuk-frontend/dist/govuk/components/radios/template-with-fieldset-and-error-message.html +8 -8
  330. data/node_modules/govuk-frontend/dist/govuk/components/radios/template-with-hints-on-items.html +10 -10
  331. data/node_modules/govuk-frontend/dist/govuk/components/radios/template-with-idprefix.html +8 -8
  332. data/node_modules/govuk-frontend/dist/govuk/components/radios/template-with-legend-as-page-heading.html +8 -8
  333. data/node_modules/govuk-frontend/dist/govuk/components/radios/template-with-optional-form-group-classes-showing-group-error.html +21 -24
  334. data/node_modules/govuk-frontend/dist/govuk/components/radios/template-with-very-long-option-text.html +12 -12
  335. data/node_modules/govuk-frontend/dist/govuk/components/radios/template-without-fieldset.html +12 -12
  336. data/node_modules/govuk-frontend/dist/govuk/components/radios/template.njk +54 -50
  337. data/node_modules/govuk-frontend/dist/govuk/components/select/_index.scss +5 -5
  338. data/node_modules/govuk-frontend/dist/govuk/components/select/_index.scss.map +1 -1
  339. data/node_modules/govuk-frontend/dist/govuk/components/select/fixtures.json +42 -23
  340. data/node_modules/govuk-frontend/dist/govuk/components/select/macro-options.json +40 -0
  341. data/node_modules/govuk-frontend/dist/govuk/components/select/template-default.html +3 -6
  342. data/node_modules/govuk-frontend/dist/govuk/components/select/template-with-full-width-override.html +3 -6
  343. data/node_modules/govuk-frontend/dist/govuk/components/select/template-with-hint-text-and-error-message.html +3 -6
  344. data/node_modules/govuk-frontend/dist/govuk/components/select/template-with-label-as-page-heading.html +3 -6
  345. data/node_modules/govuk-frontend/dist/govuk/components/select/template-with-optional-form-group-classes.html +3 -6
  346. data/node_modules/govuk-frontend/dist/govuk/components/select/template-with-selected-value.html +3 -6
  347. data/node_modules/govuk-frontend/dist/govuk/components/select/template.njk +18 -8
  348. data/node_modules/govuk-frontend/dist/govuk/components/skip-link/_index.scss +7 -4
  349. data/node_modules/govuk-frontend/dist/govuk/components/skip-link/_index.scss.map +1 -1
  350. data/node_modules/govuk-frontend/dist/govuk/components/skip-link/fixtures.json +9 -0
  351. data/node_modules/govuk-frontend/dist/govuk/components/skip-link/skip-link.bundle.js +8 -0
  352. data/node_modules/govuk-frontend/dist/govuk/components/skip-link/skip-link.bundle.js.map +1 -1
  353. data/node_modules/govuk-frontend/dist/govuk/components/skip-link/skip-link.bundle.mjs +8 -0
  354. data/node_modules/govuk-frontend/dist/govuk/components/skip-link/skip-link.bundle.mjs.map +1 -1
  355. data/node_modules/govuk-frontend/dist/govuk/components/skip-link/skip-link.mjs.map +1 -1
  356. data/node_modules/govuk-frontend/dist/govuk/components/skip-link/template.njk +4 -1
  357. data/node_modules/govuk-frontend/dist/govuk/components/summary-list/_index.scss +2 -1
  358. data/node_modules/govuk-frontend/dist/govuk/components/summary-list/_index.scss.map +1 -1
  359. data/node_modules/govuk-frontend/dist/govuk/components/summary-list/fixtures.json +63 -32
  360. data/node_modules/govuk-frontend/dist/govuk/components/summary-list/template-as-a-summary-card-with-a-custom-header-level.html +25 -20
  361. data/node_modules/govuk-frontend/dist/govuk/components/summary-list/template-as-a-summary-card-with-a-html-header.html +25 -20
  362. data/node_modules/govuk-frontend/dist/govuk/components/summary-list/template-as-a-summary-card-with-a-text-header.html +25 -20
  363. data/node_modules/govuk-frontend/dist/govuk/components/summary-list/template-as-a-summary-card-with-actions-plus-summary-list-actions.html +46 -29
  364. data/node_modules/govuk-frontend/dist/govuk/components/summary-list/template-as-a-summary-card-with-actions.html +33 -23
  365. data/node_modules/govuk-frontend/dist/govuk/components/summary-list/template-check-your-answers.html +96 -97
  366. data/node_modules/govuk-frontend/dist/govuk/components/summary-list/template-default.html +35 -36
  367. data/node_modules/govuk-frontend/dist/govuk/components/summary-list/template-extreme.html +261 -70
  368. data/node_modules/govuk-frontend/dist/govuk/components/summary-list/template-no-border-on-last-row.html +35 -36
  369. data/node_modules/govuk-frontend/dist/govuk/components/summary-list/template-no-border.html +35 -36
  370. data/node_modules/govuk-frontend/dist/govuk/components/summary-list/template-overridden-widths.html +58 -45
  371. data/node_modules/govuk-frontend/dist/govuk/components/summary-list/template-translated.html +51 -45
  372. data/node_modules/govuk-frontend/dist/govuk/components/summary-list/template-with-actions.html +58 -45
  373. data/node_modules/govuk-frontend/dist/govuk/components/summary-list/template-with-no-first-action.html +58 -59
  374. data/node_modules/govuk-frontend/dist/govuk/components/summary-list/template-with-some-actions.html +45 -39
  375. data/node_modules/govuk-frontend/dist/govuk/components/summary-list/template.njk +68 -65
  376. data/node_modules/govuk-frontend/dist/govuk/components/table/_index.scss +10 -0
  377. data/node_modules/govuk-frontend/dist/govuk/components/table/_index.scss.map +1 -1
  378. data/node_modules/govuk-frontend/dist/govuk/components/table/fixtures.json +93 -21
  379. data/node_modules/govuk-frontend/dist/govuk/components/table/template-default.html +15 -15
  380. data/node_modules/govuk-frontend/dist/govuk/components/table/template-table-with-head-and-caption.html +15 -15
  381. data/node_modules/govuk-frontend/dist/govuk/components/table/template-table-with-head.html +15 -15
  382. data/node_modules/govuk-frontend/dist/govuk/components/table/template-with-small-text-modifier-for-tables-with-a-lot-of-data.html +19 -0
  383. data/node_modules/govuk-frontend/dist/govuk/components/table/template.njk +43 -31
  384. data/node_modules/govuk-frontend/dist/govuk/components/tabs/fixtures.json +27 -13
  385. data/node_modules/govuk-frontend/dist/govuk/components/tabs/tabs.bundle.js +13 -11
  386. data/node_modules/govuk-frontend/dist/govuk/components/tabs/tabs.bundle.js.map +1 -1
  387. data/node_modules/govuk-frontend/dist/govuk/components/tabs/tabs.bundle.mjs +13 -11
  388. data/node_modules/govuk-frontend/dist/govuk/components/tabs/tabs.bundle.mjs.map +1 -1
  389. data/node_modules/govuk-frontend/dist/govuk/components/tabs/tabs.mjs +5 -11
  390. data/node_modules/govuk-frontend/dist/govuk/components/tabs/tabs.mjs.map +1 -1
  391. data/node_modules/govuk-frontend/dist/govuk/components/tabs/template-default.html +110 -113
  392. data/node_modules/govuk-frontend/dist/govuk/components/tabs/template-tabs-with-anchor-in-panel.html +19 -21
  393. data/node_modules/govuk-frontend/dist/govuk/components/tabs/template.njk +30 -18
  394. data/node_modules/govuk-frontend/dist/govuk/components/tag/_index.scss +11 -8
  395. data/node_modules/govuk-frontend/dist/govuk/components/tag/_index.scss.map +1 -1
  396. data/node_modules/govuk-frontend/dist/govuk/components/tag/fixtures.json +14 -0
  397. data/node_modules/govuk-frontend/dist/govuk/components/tag/template.njk +5 -2
  398. data/node_modules/govuk-frontend/dist/govuk/components/task-list/_index.scss +12 -10
  399. data/node_modules/govuk-frontend/dist/govuk/components/task-list/_index.scss.map +1 -1
  400. data/node_modules/govuk-frontend/dist/govuk/components/task-list/fixtures.json +54 -10
  401. data/node_modules/govuk-frontend/dist/govuk/components/task-list/template-default.html +35 -28
  402. data/node_modules/govuk-frontend/dist/govuk/components/task-list/template-example-with-3-states.html +47 -38
  403. data/node_modules/govuk-frontend/dist/govuk/components/task-list/template-example-with-all-possible-colours.html +141 -116
  404. data/node_modules/govuk-frontend/dist/govuk/components/task-list/template-example-with-hint-text-and-additional-states.html +72 -59
  405. data/node_modules/govuk-frontend/dist/govuk/components/task-list/template-example-with-very-long-single-word-tags.html +35 -28
  406. data/node_modules/govuk-frontend/dist/govuk/components/task-list/template-with-empty-values.html +27 -0
  407. data/node_modules/govuk-frontend/dist/govuk/components/task-list/template.njk +33 -23
  408. data/node_modules/govuk-frontend/dist/govuk/components/textarea/_index.scss +3 -3
  409. data/node_modules/govuk-frontend/dist/govuk/components/textarea/_index.scss.map +1 -1
  410. data/node_modules/govuk-frontend/dist/govuk/components/textarea/fixtures.json +17 -0
  411. data/node_modules/govuk-frontend/dist/govuk/components/textarea/macro-options.json +40 -0
  412. data/node_modules/govuk-frontend/dist/govuk/components/textarea/template.njk +10 -2
  413. data/node_modules/govuk-frontend/dist/govuk/components/warning-text/_index.scss +5 -5
  414. data/node_modules/govuk-frontend/dist/govuk/components/warning-text/_index.scss.map +1 -1
  415. data/node_modules/govuk-frontend/dist/govuk/components/warning-text/fixtures.json +8 -0
  416. data/node_modules/govuk-frontend/dist/govuk/components/warning-text/template.njk +3 -2
  417. data/node_modules/govuk-frontend/dist/govuk/core/_all.scss +8 -6
  418. data/node_modules/govuk-frontend/dist/govuk/core/_all.scss.map +1 -1
  419. data/node_modules/govuk-frontend/dist/govuk/core/_govuk-frontend-properties.scss +1 -1
  420. data/node_modules/govuk-frontend/dist/govuk/core/_index.scss +8 -0
  421. data/node_modules/govuk-frontend/dist/govuk/core/_index.scss.map +1 -0
  422. data/node_modules/govuk-frontend/dist/govuk/errors/index.mjs.map +1 -1
  423. data/node_modules/govuk-frontend/dist/govuk/govuk-frontend-component.mjs.map +1 -1
  424. data/node_modules/govuk-frontend/dist/govuk/govuk-frontend.min.css +2 -2
  425. data/node_modules/govuk-frontend/dist/govuk/govuk-frontend.min.css.map +1 -1
  426. data/node_modules/govuk-frontend/dist/govuk/govuk-frontend.min.js +1 -1
  427. data/node_modules/govuk-frontend/dist/govuk/govuk-frontend.min.js.map +1 -1
  428. data/node_modules/govuk-frontend/dist/govuk/helpers/_all.scss +8 -12
  429. data/node_modules/govuk-frontend/dist/govuk/helpers/_all.scss.map +1 -1
  430. data/node_modules/govuk-frontend/dist/govuk/helpers/_colour.scss +44 -8
  431. data/node_modules/govuk-frontend/dist/govuk/helpers/_colour.scss.map +1 -1
  432. data/node_modules/govuk-frontend/dist/govuk/helpers/_grid.scss +1 -1
  433. data/node_modules/govuk-frontend/dist/govuk/helpers/_grid.scss.map +1 -1
  434. data/node_modules/govuk-frontend/dist/govuk/helpers/_index.scss +14 -0
  435. data/node_modules/govuk-frontend/dist/govuk/helpers/_index.scss.map +1 -0
  436. data/node_modules/govuk-frontend/dist/govuk/helpers/_links.scss +2 -2
  437. data/node_modules/govuk-frontend/dist/govuk/helpers/_links.scss.map +1 -1
  438. data/node_modules/govuk-frontend/dist/govuk/helpers/_shape-arrow.scss +1 -1
  439. data/node_modules/govuk-frontend/dist/govuk/helpers/_shape-arrow.scss.map +1 -1
  440. data/node_modules/govuk-frontend/dist/govuk/helpers/_typography.scss +19 -0
  441. data/node_modules/govuk-frontend/dist/govuk/helpers/_typography.scss.map +1 -1
  442. data/node_modules/govuk-frontend/dist/govuk/helpers/_visually-hidden.scss +30 -62
  443. data/node_modules/govuk-frontend/dist/govuk/helpers/_visually-hidden.scss.map +1 -1
  444. data/node_modules/govuk-frontend/dist/govuk/i18n.mjs +18 -12
  445. data/node_modules/govuk-frontend/dist/govuk/i18n.mjs.map +1 -1
  446. data/node_modules/govuk-frontend/dist/govuk/index.scss +11 -0
  447. data/node_modules/govuk-frontend/dist/govuk/index.scss.map +1 -0
  448. data/node_modules/govuk-frontend/dist/govuk/init.mjs +100 -0
  449. data/node_modules/govuk-frontend/dist/govuk/init.mjs.map +1 -0
  450. data/node_modules/govuk-frontend/dist/govuk/macros/attributes.njk +94 -0
  451. data/node_modules/govuk-frontend/dist/govuk/objects/_all.scss +8 -6
  452. data/node_modules/govuk-frontend/dist/govuk/objects/_all.scss.map +1 -1
  453. data/node_modules/govuk-frontend/dist/govuk/objects/_index.scss +8 -0
  454. data/node_modules/govuk-frontend/dist/govuk/objects/_index.scss.map +1 -0
  455. data/node_modules/govuk-frontend/dist/govuk/overrides/_all.scss +7 -5
  456. data/node_modules/govuk-frontend/dist/govuk/overrides/_all.scss.map +1 -1
  457. data/node_modules/govuk-frontend/dist/govuk/overrides/_index.scss +7 -0
  458. data/node_modules/govuk-frontend/dist/govuk/overrides/_index.scss.map +1 -0
  459. data/node_modules/govuk-frontend/dist/govuk/overrides/_typography.scss +10 -0
  460. data/node_modules/govuk-frontend/dist/govuk/overrides/_typography.scss.map +1 -1
  461. data/node_modules/govuk-frontend/dist/govuk/settings/_all.scss +8 -21
  462. data/node_modules/govuk-frontend/dist/govuk/settings/_all.scss.map +1 -1
  463. data/node_modules/govuk-frontend/dist/govuk/settings/_colours-organisations.scss +235 -9
  464. data/node_modules/govuk-frontend/dist/govuk/settings/_colours-organisations.scss.map +1 -1
  465. data/node_modules/govuk-frontend/dist/govuk/settings/_index.scss +23 -0
  466. data/node_modules/govuk-frontend/dist/govuk/settings/_index.scss.map +1 -0
  467. data/node_modules/govuk-frontend/dist/govuk/settings/_measurements.scss +1 -1
  468. data/node_modules/govuk-frontend/dist/govuk/settings/_measurements.scss.map +1 -1
  469. data/node_modules/govuk-frontend/dist/govuk/settings/_media-queries.scss +1 -1
  470. data/node_modules/govuk-frontend/dist/govuk/settings/_media-queries.scss.map +1 -1
  471. data/node_modules/govuk-frontend/dist/govuk/settings/_typography-responsive.scss +172 -13
  472. data/node_modules/govuk-frontend/dist/govuk/settings/_typography-responsive.scss.map +1 -1
  473. data/node_modules/govuk-frontend/dist/govuk/settings/_warnings.scss +8 -3
  474. data/node_modules/govuk-frontend/dist/govuk/settings/_warnings.scss.map +1 -1
  475. data/node_modules/govuk-frontend/dist/govuk/template.njk +3 -2
  476. data/node_modules/govuk-frontend/dist/govuk/tools/_all.scss +8 -5
  477. data/node_modules/govuk-frontend/dist/govuk/tools/_all.scss.map +1 -1
  478. data/node_modules/govuk-frontend/dist/govuk/tools/_index.scss +7 -0
  479. data/node_modules/govuk-frontend/dist/govuk/tools/_index.scss.map +1 -0
  480. data/node_modules/govuk-frontend/dist/govuk/utilities/_all.scss +8 -2
  481. data/node_modules/govuk-frontend/dist/govuk/utilities/_all.scss.map +1 -1
  482. data/node_modules/govuk-frontend/dist/govuk/utilities/_index.scss +4 -0
  483. data/node_modules/govuk-frontend/dist/govuk/utilities/_index.scss.map +1 -0
  484. data/node_modules/govuk-frontend/govuk-prototype-kit.config.json +5 -1
  485. data/node_modules/govuk-frontend/package.json +16 -15
  486. metadata +54 -2
  487. data/node_modules/govuk-frontend/dist/govuk/components/header/template-with-tudor-crown.html +0 -24
@@ -1,28 +1,73 @@
1
- function mergeConfigs(...configObjects) {
2
- function flattenObject(configObject) {
3
- const flattenedObject = {};
4
- function flattenLoop(obj, prefix) {
5
- for (const [key, value] of Object.entries(obj)) {
6
- const prefixedKey = prefix ? `${prefix}.${key}` : key;
7
- if (value && typeof value === 'object') {
8
- flattenLoop(value, prefixedKey);
9
- } else {
10
- flattenedObject[prefixedKey] = value;
11
- }
12
- }
1
+ function normaliseString(value, property) {
2
+ const trimmedValue = value ? value.trim() : '';
3
+ let output;
4
+ let outputType = property == null ? void 0 : property.type;
5
+ if (!outputType) {
6
+ if (['true', 'false'].includes(trimmedValue)) {
7
+ outputType = 'boolean';
8
+ }
9
+ if (trimmedValue.length > 0 && isFinite(Number(trimmedValue))) {
10
+ outputType = 'number';
13
11
  }
14
- flattenLoop(configObject);
15
- return flattenedObject;
16
12
  }
13
+ switch (outputType) {
14
+ case 'boolean':
15
+ output = trimmedValue === 'true';
16
+ break;
17
+ case 'number':
18
+ output = Number(trimmedValue);
19
+ break;
20
+ default:
21
+ output = value;
22
+ }
23
+ return output;
24
+ }
25
+
26
+ /**
27
+ * @typedef {import('./index.mjs').SchemaProperty} SchemaProperty
28
+ */
29
+
30
+ function mergeConfigs(...configObjects) {
17
31
  const formattedConfigObject = {};
18
32
  for (const configObject of configObjects) {
19
- const obj = flattenObject(configObject);
20
- for (const [key, value] of Object.entries(obj)) {
21
- formattedConfigObject[key] = value;
33
+ for (const key of Object.keys(configObject)) {
34
+ const option = formattedConfigObject[key];
35
+ const override = configObject[key];
36
+ if (isObject(option) && isObject(override)) {
37
+ formattedConfigObject[key] = mergeConfigs(option, override);
38
+ } else {
39
+ formattedConfigObject[key] = override;
40
+ }
22
41
  }
23
42
  }
24
43
  return formattedConfigObject;
25
44
  }
45
+ function extractConfigByNamespace(Component, dataset, namespace) {
46
+ const property = Component.schema.properties[namespace];
47
+ if ((property == null ? void 0 : property.type) !== 'object') {
48
+ return;
49
+ }
50
+ const newObject = {
51
+ [namespace]: ({})
52
+ };
53
+ for (const [key, value] of Object.entries(dataset)) {
54
+ let current = newObject;
55
+ const keyParts = key.split('.');
56
+ for (const [index, name] of keyParts.entries()) {
57
+ if (typeof current === 'object') {
58
+ if (index < keyParts.length - 1) {
59
+ if (!isObject(current[name])) {
60
+ current[name] = {};
61
+ }
62
+ current = current[name];
63
+ } else if (key !== namespace) {
64
+ current[name] = normaliseString(value);
65
+ }
66
+ }
67
+ }
68
+ }
69
+ return newObject[namespace];
70
+ }
26
71
  function setFocus($element, options = {}) {
27
72
  var _options$onBeforeFocu;
28
73
  const isFocusable = $element.getAttribute('tabindex');
@@ -53,14 +98,28 @@ function isSupported($scope = document.body) {
53
98
  }
54
99
  return $scope.classList.contains('govuk-frontend-supported');
55
100
  }
101
+ function isArray(option) {
102
+ return Array.isArray(option);
103
+ }
104
+ function isObject(option) {
105
+ return !!option && typeof option === 'object' && !isArray(option);
106
+ }
56
107
 
57
108
  /**
58
109
  * Schema for component config
59
110
  *
60
111
  * @typedef {object} Schema
112
+ * @property {{ [field: string]: SchemaProperty | undefined }} properties - Schema properties
61
113
  * @property {SchemaCondition[]} [anyOf] - List of schema conditions
62
114
  */
63
115
 
116
+ /**
117
+ * Schema property for component config
118
+ *
119
+ * @typedef {object} SchemaProperty
120
+ * @property {'string' | 'boolean' | 'number' | 'object'} type - Property type
121
+ */
122
+
64
123
  /**
65
124
  * Schema condition for component config
66
125
  *
@@ -69,26 +128,15 @@ function isSupported($scope = document.body) {
69
128
  * @property {string} errorMessage - Error message when required config fields not provided
70
129
  */
71
130
 
72
- function normaliseString(value) {
73
- if (typeof value !== 'string') {
74
- return value;
75
- }
76
- const trimmedValue = value.trim();
77
- if (trimmedValue === 'true') {
78
- return true;
79
- }
80
- if (trimmedValue === 'false') {
81
- return false;
82
- }
83
- if (trimmedValue.length > 0 && isFinite(Number(trimmedValue))) {
84
- return Number(trimmedValue);
85
- }
86
- return value;
87
- }
88
- function normaliseDataset(dataset) {
131
+ function normaliseDataset(Component, dataset) {
89
132
  const out = {};
90
- for (const [key, value] of Object.entries(dataset)) {
91
- out[key] = normaliseString(value);
133
+ for (const [field, property] of Object.entries(Component.schema.properties)) {
134
+ if (field in dataset) {
135
+ out[field] = normaliseString(dataset[field], property);
136
+ }
137
+ if ((property == null ? void 0 : property.type) === 'object') {
138
+ out[field] = extractConfigByNamespace(Component, dataset, field);
139
+ }
92
140
  }
93
141
  return out;
94
142
  }
@@ -162,7 +210,7 @@ class NotificationBanner extends GOVUKFrontendComponent {
162
210
  });
163
211
  }
164
212
  this.$module = $module;
165
- this.config = mergeConfigs(NotificationBanner.defaults, config, normaliseDataset($module.dataset));
213
+ this.config = mergeConfigs(NotificationBanner.defaults, config, normaliseDataset(NotificationBanner, $module.dataset));
166
214
  if (this.$module.getAttribute('role') === 'alert' && !this.config.disableAutoFocus) {
167
215
  setFocus(this.$module);
168
216
  }
@@ -178,10 +226,21 @@ class NotificationBanner extends GOVUKFrontendComponent {
178
226
  * applies if the component has a `role` of `alert` – in other cases the
179
227
  * component will not be focused on page load, regardless of this option.
180
228
  */
229
+
230
+ /**
231
+ * @typedef {import('../../common/index.mjs').Schema} Schema
232
+ */
181
233
  NotificationBanner.moduleName = 'govuk-notification-banner';
182
234
  NotificationBanner.defaults = Object.freeze({
183
235
  disableAutoFocus: false
184
236
  });
237
+ NotificationBanner.schema = Object.freeze({
238
+ properties: {
239
+ disableAutoFocus: {
240
+ type: 'boolean'
241
+ }
242
+ }
243
+ });
185
244
 
186
245
  export { NotificationBanner };
187
246
  //# sourceMappingURL=notification-banner.bundle.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"notification-banner.bundle.mjs","sources":["../../../../src/govuk/common/index.mjs","../../../../src/govuk/common/normalise-dataset.mjs","../../../../src/govuk/errors/index.mjs","../../../../src/govuk/govuk-frontend-component.mjs","../../../../src/govuk/components/notification-banner/notification-banner.mjs"],"sourcesContent":["/**\n * Common helpers which do not require polyfill.\n *\n * IMPORTANT: If a helper require a polyfill, please isolate it in its own module\n * so that the polyfill can be properly tree-shaken and does not burden\n * the components that do not need that helper\n */\n\n/**\n * Config flattening function\n *\n * Takes any number of objects, flattens them into namespaced key-value pairs,\n * (e.g. \\{'i18n.showSection': 'Show section'\\}) and combines them together, with\n * greatest priority on the LAST item passed in.\n *\n * @internal\n * @param {...{ [key: string]: unknown }} configObjects - Config object to merge\n * @returns {{ [key: string]: unknown }} A flattened object of key-value pairs.\n */\nexport function mergeConfigs(...configObjects) {\n /**\n * Function to take nested objects and flatten them to a dot-separated keyed\n * object. Doing this means we don't need to do any deep/recursive merging of\n * each of our objects, nor transform our dataset from a flat list into a\n * nested object.\n *\n * @internal\n * @param {{ [key: string]: unknown }} configObject - Deeply nested object\n * @returns {{ [key: string]: unknown }} Flattened object with dot-separated keys\n */\n function flattenObject(configObject) {\n // Prepare an empty return object\n /** @type {{ [key: string]: unknown }} */\n const flattenedObject = {}\n\n /**\n * Our flattening function, this is called recursively for each level of\n * depth in the object. At each level we prepend the previous level names to\n * the key using `prefix`.\n *\n * @internal\n * @param {Partial<{ [key: string]: unknown }>} obj - Object to flatten\n * @param {string} [prefix] - Optional dot-separated prefix\n */\n function flattenLoop(obj, prefix) {\n for (const [key, value] of Object.entries(obj)) {\n const prefixedKey = prefix ? `${prefix}.${key}` : key\n\n // If the value is a nested object, recurse over that too\n if (value && typeof value === 'object') {\n flattenLoop(value, prefixedKey)\n } else {\n // Otherwise, add this value to our return object\n flattenedObject[prefixedKey] = value\n }\n }\n }\n\n // Kick off the recursive loop\n flattenLoop(configObject)\n return flattenedObject\n }\n\n // Start with an empty object as our base\n /** @type {{ [key: string]: unknown }} */\n const formattedConfigObject = {}\n\n // Loop through each of the passed objects\n for (const configObject of configObjects) {\n const obj = flattenObject(configObject)\n\n // Push their keys one-by-one into formattedConfigObject. Any duplicate\n // keys will override the existing key with the new value.\n for (const [key, value] of Object.entries(obj)) {\n formattedConfigObject[key] = value\n }\n }\n\n return formattedConfigObject\n}\n\n/**\n * Extracts keys starting with a particular namespace from a flattened config\n * object, removing the namespace in the process.\n *\n * @internal\n * @param {{ [key: string]: unknown }} configObject - The object to extract key-value pairs from.\n * @param {string} namespace - The namespace to filter keys with.\n * @returns {{ [key: string]: unknown }} Flattened object with dot-separated key namespace removed\n */\nexport function extractConfigByNamespace(configObject, namespace) {\n /** @type {{ [key: string]: unknown }} */\n const newObject = {}\n\n for (const [key, value] of Object.entries(configObject)) {\n // Split the key into parts, using . as our namespace separator\n const keyParts = key.split('.')\n\n // Check if the first namespace matches the configured namespace\n if (keyParts[0] === namespace) {\n // Remove the first item (the namespace) from the parts array,\n // but only if there is more than one part (we don't want blank keys!)\n if (keyParts.length > 1) {\n keyParts.shift()\n }\n\n // Join the remaining parts back together\n const newKey = keyParts.join('.')\n\n // Add them to our new object\n newObject[newKey] = value\n }\n }\n\n return newObject\n}\n\n/**\n * Get hash fragment from URL\n *\n * Extract the hash fragment (everything after the hash) from a URL,\n * but not including the hash symbol\n *\n * @private\n * @param {string} url - URL\n * @returns {string | undefined} Fragment from URL, without the hash\n */\nexport function getFragmentFromUrl(url) {\n if (!url.includes('#')) {\n return undefined\n }\n\n return url.split('#').pop()\n}\n\n/**\n * Get GOV.UK Frontend breakpoint value from CSS custom property\n *\n * @private\n * @param {string} name - Breakpoint name\n * @returns {{ property: string, value?: string }} Breakpoint object\n */\nexport function getBreakpoint(name) {\n const property = `--govuk-frontend-breakpoint-${name}`\n\n // Get value from `<html>` with breakpoints on CSS :root\n const value = window\n .getComputedStyle(document.documentElement)\n .getPropertyValue(property)\n\n return {\n property,\n value: value || undefined\n }\n}\n\n/**\n * Move focus to element\n *\n * Sets tabindex to -1 to make the element programmatically focusable,\n * but removes it on blur as the element doesn't need to be focused again.\n *\n * @private\n * @template {HTMLElement} FocusElement\n * @param {FocusElement} $element - HTML element\n * @param {object} [options] - Handler options\n * @param {function(this: FocusElement): void} [options.onBeforeFocus] - Callback before focus\n * @param {function(this: FocusElement): void} [options.onBlur] - Callback on blur\n */\nexport function setFocus($element, options = {}) {\n const isFocusable = $element.getAttribute('tabindex')\n\n if (!isFocusable) {\n $element.setAttribute('tabindex', '-1')\n }\n\n /**\n * Handle element focus\n */\n function onFocus() {\n $element.addEventListener('blur', onBlur, { once: true })\n }\n\n /**\n * Handle element blur\n */\n function onBlur() {\n options.onBlur?.call($element)\n\n if (!isFocusable) {\n $element.removeAttribute('tabindex')\n }\n }\n\n // Add listener to reset element on blur, after focus\n $element.addEventListener('focus', onFocus, { once: true })\n\n // Focus element\n options.onBeforeFocus?.call($element)\n $element.focus()\n}\n\n/**\n * Checks if GOV.UK Frontend is supported on this page\n *\n * Some browsers will load and run our JavaScript but GOV.UK Frontend\n * won't be supported.\n *\n * @internal\n * @param {HTMLElement | null} [$scope] - HTML element `<body>` checked for browser support\n * @returns {boolean} Whether GOV.UK Frontend is supported on this page\n */\nexport function isSupported($scope = document.body) {\n if (!$scope) {\n return false\n }\n\n return $scope.classList.contains('govuk-frontend-supported')\n}\n\n/**\n * Validate component config by schema\n *\n * @internal\n * @param {Schema} schema - Config schema\n * @param {{ [key: string]: unknown }} config - Component config\n * @returns {string[]} List of validation errors\n */\nexport function validateConfig(schema, config) {\n const validationErrors = []\n\n // Check errors for each schema\n for (const [name, conditions] of Object.entries(schema)) {\n const errors = []\n\n // Check errors for each schema condition\n for (const { required, errorMessage } of conditions) {\n if (!required.every((key) => !!config[key])) {\n errors.push(errorMessage) // Missing config key value\n }\n }\n\n // Check one condition passes or add errors\n if (name === 'anyOf' && !(conditions.length - errors.length >= 1)) {\n validationErrors.push(...errors)\n }\n }\n\n return validationErrors\n}\n\n/**\n * Schema for component config\n *\n * @typedef {object} Schema\n * @property {SchemaCondition[]} [anyOf] - List of schema conditions\n */\n\n/**\n * Schema condition for component config\n *\n * @typedef {object} SchemaCondition\n * @property {string[]} required - List of required config fields\n * @property {string} errorMessage - Error message when required config fields not provided\n */\n","/**\n * Normalise string\n *\n * 'If it looks like a duck, and it quacks like a duck…' 🦆\n *\n * If the passed value looks like a boolean or a number, convert it to a boolean\n * or number.\n *\n * Designed to be used to convert config passed via data attributes (which are\n * always strings) into something sensible.\n *\n * @internal\n * @param {string | undefined} value - The value to normalise\n * @returns {string | boolean | number | undefined} Normalised data\n */\nexport function normaliseString(value) {\n if (typeof value !== 'string') {\n return value\n }\n\n const trimmedValue = value.trim()\n\n if (trimmedValue === 'true') {\n return true\n }\n\n if (trimmedValue === 'false') {\n return false\n }\n\n // Empty / whitespace-only strings are considered finite so we need to check\n // the length of the trimmed string as well\n if (trimmedValue.length > 0 && isFinite(Number(trimmedValue))) {\n return Number(trimmedValue)\n }\n\n return value\n}\n\n/**\n * Normalise dataset\n *\n * Loop over an object and normalise each value using normaliseData function\n *\n * @internal\n * @param {DOMStringMap} dataset - HTML element dataset\n * @returns {{ [key: string]: string | boolean | number | undefined }} Normalised dataset\n */\nexport function normaliseDataset(dataset) {\n /** @type {ReturnType<typeof normaliseDataset>} */\n const out = {}\n\n for (const [key, value] of Object.entries(dataset)) {\n out[key] = normaliseString(value)\n }\n\n return out\n}\n","/**\n * GOV.UK Frontend error\n *\n * A base class for `Error`s thrown by GOV.UK Frontend.\n *\n * It is meant to be extended into specific types of errors\n * to be thrown by our code.\n *\n * @example\n * ```js\n * class MissingRootError extends GOVUKFrontendError {\n * // Setting an explicit name is important as extending the class will not\n * // set a new `name` on the subclass. The `name` property is important\n * // to ensure intelligible error names even if the class name gets\n * // mangled by a minifier\n * name = \"MissingRootError\"\n * }\n * ```\n * @abstract\n */\nexport class GOVUKFrontendError extends Error {\n name = 'GOVUKFrontendError'\n}\n\n/**\n * Indicates that GOV.UK Frontend is not supported\n */\nexport class SupportError extends GOVUKFrontendError {\n name = 'SupportError'\n\n /**\n * Checks if GOV.UK Frontend is supported on this page\n *\n * @param {HTMLElement | null} [$scope] - HTML element `<body>` checked for browser support\n */\n constructor($scope = document.body) {\n const supportMessage =\n 'noModule' in HTMLScriptElement.prototype\n ? 'GOV.UK Frontend initialised without `<body class=\"govuk-frontend-supported\">` from template `<script>` snippet'\n : 'GOV.UK Frontend is not supported in this browser'\n\n super(\n $scope\n ? supportMessage\n : 'GOV.UK Frontend initialised without `<script type=\"module\">`'\n )\n }\n}\n\n/**\n * Indicates that a component has received an illegal configuration\n */\nexport class ConfigError extends GOVUKFrontendError {\n name = 'ConfigError'\n}\n\n/**\n * Indicates an issue with an element (possibly `null` or `undefined`)\n */\nexport class ElementError extends GOVUKFrontendError {\n name = 'ElementError'\n\n /**\n * @internal\n * @overload\n * @param {string} message - Element error message\n */\n\n /**\n * @internal\n * @overload\n * @param {ElementErrorOptions} options - Element error options\n */\n\n /**\n * @internal\n * @param {string | ElementErrorOptions} messageOrOptions - Element error message or options\n */\n constructor(messageOrOptions) {\n let message = typeof messageOrOptions === 'string' ? messageOrOptions : ''\n\n // Build message from options\n if (typeof messageOrOptions === 'object') {\n const { componentName, identifier, element, expectedType } =\n messageOrOptions\n\n // Add prefix and identifier\n message = `${componentName}: ${identifier}`\n\n // Append reason\n message += element\n ? ` is not of type ${expectedType ?? 'HTMLElement'}`\n : ' not found'\n }\n\n super(message)\n }\n}\n\n/**\n * Element error options\n *\n * @internal\n * @typedef {object} ElementErrorOptions\n * @property {string} componentName - The name of the component throwing the error\n * @property {string} identifier - An identifier that'll let the user understand which element has an error. This is whatever makes the most sense\n * @property {Element | null} [element] - The element in error\n * @property {string} [expectedType] - The type that was expected for the identifier\n */\n","import { isSupported } from './common/index.mjs'\nimport { SupportError } from './errors/index.mjs'\n\n/**\n * Base Component class\n *\n * Centralises the behaviours shared by our components\n *\n * @internal\n * @abstract\n */\nexport class GOVUKFrontendComponent {\n /**\n * Constructs a new component, validating that GOV.UK Frontend is supported\n *\n * @internal\n */\n constructor() {\n this.checkSupport()\n }\n\n /**\n * Validates whether GOV.UK Frontend is supported\n *\n * @private\n */\n checkSupport() {\n if (!isSupported()) {\n throw new SupportError()\n }\n }\n}\n","import { mergeConfigs, setFocus } from '../../common/index.mjs'\nimport { normaliseDataset } from '../../common/normalise-dataset.mjs'\nimport { ElementError } from '../../errors/index.mjs'\nimport { GOVUKFrontendComponent } from '../../govuk-frontend-component.mjs'\n\n/**\n * Notification Banner component\n *\n * @preserve\n */\nexport class NotificationBanner extends GOVUKFrontendComponent {\n /** @private */\n $module\n\n /**\n * @private\n * @type {NotificationBannerConfig}\n */\n config\n\n /**\n * @param {Element | null} $module - HTML element to use for notification banner\n * @param {NotificationBannerConfig} [config] - Notification banner config\n */\n constructor($module, config = {}) {\n super()\n\n if (!($module instanceof HTMLElement)) {\n throw new ElementError({\n componentName: 'Notification banner',\n element: $module,\n identifier: 'Root element (`$module`)'\n })\n }\n\n this.$module = $module\n\n this.config = mergeConfigs(\n NotificationBanner.defaults,\n config,\n normaliseDataset($module.dataset)\n )\n\n /**\n * Focus the notification banner\n *\n * If `role=\"alert\"` is set, focus the element to help some assistive\n * technologies prioritise announcing it.\n *\n * You can turn off the auto-focus functionality by setting\n * `data-disable-auto-focus=\"true\"` in the component HTML. You might wish to\n * do this based on user research findings, or to avoid a clash with another\n * element which should be focused when the page loads.\n */\n if (\n this.$module.getAttribute('role') === 'alert' &&\n !this.config.disableAutoFocus\n ) {\n setFocus(this.$module)\n }\n }\n\n /**\n * Name for the component used when initialising using data-module attributes.\n */\n static moduleName = 'govuk-notification-banner'\n\n /**\n * Notification banner default config\n *\n * @see {@link NotificationBannerConfig}\n * @constant\n * @type {NotificationBannerConfig}\n */\n static defaults = Object.freeze({\n disableAutoFocus: false\n })\n}\n\n/**\n * Notification banner config\n *\n * @typedef {object} NotificationBannerConfig\n * @property {boolean} [disableAutoFocus=false] - If set to `true` the\n * notification banner will not be focussed when the page loads. This only\n * applies if the component has a `role` of `alert` – in other cases the\n * component will not be focused on page load, regardless of this option.\n */\n"],"names":["mergeConfigs","configObjects","flattenObject","configObject","flattenedObject","flattenLoop","obj","prefix","key","value","Object","entries","prefixedKey","formattedConfigObject","setFocus","$element","options","_options$onBeforeFocu","isFocusable","getAttribute","setAttribute","onFocus","addEventListener","onBlur","once","_options$onBlur","call","removeAttribute","onBeforeFocus","focus","isSupported","$scope","document","body","classList","contains","normaliseString","trimmedValue","trim","length","isFinite","Number","normaliseDataset","dataset","out","GOVUKFrontendError","Error","constructor","args","name","SupportError","supportMessage","HTMLScriptElement","prototype","ElementError","messageOrOptions","message","componentName","identifier","element","expectedType","GOVUKFrontendComponent","checkSupport","NotificationBanner","$module","config","HTMLElement","defaults","disableAutoFocus","moduleName","freeze"],"mappings":"AAmBO,SAASA,YAAYA,CAAC,GAAGC,aAAa,EAAE;EAW7C,SAASC,aAAaA,CAACC,YAAY,EAAE;IAGnC,MAAMC,eAAe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CAAA;AAAA,IAAA,IAAA,CAMPC,MAAM,GAAA,KAAA,CAAA,CAAA;AASJ,IAAA,IAAI,EAAED,OAAO,YAAYE,WAAW,CAAC,EAAE;MACrC,MAAM,IAAIZ,YAAY,CAAC;AACrBG,QAAAA,aAAa,EAAE,qBAAqB;AACpCE,QAAAA,OAAO,EAAEK,OAAO;AAChBN,QAAAA,UAAU,EAAE,0BAAA;AACd,OAAC,CAAC,CAAA;AACJ,KAAA;IAEA,IAAI,CAACM,OAAO,GAAGA,OAAO,CAAA;AAEtB,IAAA,IAAI,CAACC,MAAM,GAAGjE,YAAY,CACxB+D,kBAAkB,CAACI,QAAQ,EAC3BF,MAAM,EACNvB,gBAAgB,CAACsB,OAAO,CAACrB,OAAO,CAClC,CAAC,CAAA;AAaD,IAAA,IACE,IAAI,CAACqB,OAAO,CAAC7C,YAAY,CAAC,MAAM,CAAC,KAAK,OAAO,IAC7C,CAAC,IAAI,CAAC8C,MAAM,CAACG,gBAAgB,EAC7B;AACAtD,MAAAA,QAAQ,CAAC,IAAI,CAACkD,OAAO,CAAC,CAAA;AACxB,KAAA;AACF,GAAA;AAiBF,CAAA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA7EaD,kBAAkB,CAuDtBM,UAAU,GAAG,2BAA2B,CAAA;AAvDpCN,kBAAkB,CAgEtBI,QAAQ,GAAGzD,MAAM,CAAC4D,MAAM,CAAC;AAC9BF,EAAAA,gBAAgB,EAAE,KAAA;AACpB,CAAC,CAAC;;;;"}
1
+ {"version":3,"file":"notification-banner.bundle.mjs","sources":["../../../../src/govuk/common/normalise-string.mjs","../../../../src/govuk/common/index.mjs","../../../../src/govuk/common/normalise-dataset.mjs","../../../../src/govuk/errors/index.mjs","../../../../src/govuk/govuk-frontend-component.mjs","../../../../src/govuk/components/notification-banner/notification-banner.mjs"],"sourcesContent":["/**\n * Normalise string\n *\n * 'If it looks like a duck, and it quacks like a duck…' 🦆\n *\n * If the passed value looks like a boolean or a number, convert it to a boolean\n * or number.\n *\n * Designed to be used to convert config passed via data attributes (which are\n * always strings) into something sensible.\n *\n * @internal\n * @param {DOMStringMap[string]} value - The value to normalise\n * @param {SchemaProperty} [property] - Component schema property\n * @returns {string | boolean | number | undefined} Normalised data\n */\nexport function normaliseString(value, property) {\n const trimmedValue = value ? value.trim() : ''\n\n let output\n let outputType = property?.type\n\n // No schema type set? Determine automatically\n if (!outputType) {\n if (['true', 'false'].includes(trimmedValue)) {\n outputType = 'boolean'\n }\n\n // Empty / whitespace-only strings are considered finite so we need to check\n // the length of the trimmed string as well\n if (trimmedValue.length > 0 && isFinite(Number(trimmedValue))) {\n outputType = 'number'\n }\n }\n\n switch (outputType) {\n case 'boolean':\n output = trimmedValue === 'true'\n break\n\n case 'number':\n output = Number(trimmedValue)\n break\n\n default:\n output = value\n }\n\n return output\n}\n\n/**\n * @typedef {import('./index.mjs').SchemaProperty} SchemaProperty\n */\n","import { normaliseString } from './normalise-string.mjs'\n\n/**\n * Common helpers which do not require polyfill.\n *\n * IMPORTANT: If a helper require a polyfill, please isolate it in its own module\n * so that the polyfill can be properly tree-shaken and does not burden\n * the components that do not need that helper\n */\n\n/**\n * Config merging function\n *\n * Takes any number of objects and combines them together, with\n * greatest priority on the LAST item passed in.\n *\n * @internal\n * @param {...{ [key: string]: unknown }} configObjects - Config objects to merge\n * @returns {{ [key: string]: unknown }} A merged config object\n */\nexport function mergeConfigs(...configObjects) {\n // Start with an empty object as our base\n /** @type {{ [key: string]: unknown }} */\n const formattedConfigObject = {}\n\n // Loop through each of the passed objects\n for (const configObject of configObjects) {\n for (const key of Object.keys(configObject)) {\n const option = formattedConfigObject[key]\n const override = configObject[key]\n\n // Push their keys one-by-one into formattedConfigObject. Any duplicate\n // keys with object values will be merged, otherwise the new value will\n // override the existing value.\n if (isObject(option) && isObject(override)) {\n // @ts-expect-error Index signature for type 'string' is missing\n formattedConfigObject[key] = mergeConfigs(option, override)\n } else {\n // Apply override\n formattedConfigObject[key] = override\n }\n }\n }\n\n return formattedConfigObject\n}\n\n/**\n * Extracts keys starting with a particular namespace from dataset ('data-*')\n * object, removing the namespace in the process, normalising all values\n *\n * @internal\n * @param {{ schema: Schema }} Component - Component class\n * @param {DOMStringMap} dataset - The object to extract key-value pairs from\n * @param {string} namespace - The namespace to filter keys with\n * @returns {ObjectNested | undefined} Nested object with dot-separated key namespace removed\n */\nexport function extractConfigByNamespace(Component, dataset, namespace) {\n const property = Component.schema.properties[namespace]\n\n // Only extract configs for object schema properties\n if (property?.type !== 'object') {\n return\n }\n\n // Add default empty config\n const newObject = {\n [namespace]: /** @type {ObjectNested} */ ({})\n }\n\n for (const [key, value] of Object.entries(dataset)) {\n /** @type {ObjectNested | ObjectNested[NestedKey]} */\n let current = newObject\n\n // Split the key into parts, using . as our namespace separator\n const keyParts = key.split('.')\n\n /**\n * Create new level per part\n *\n * e.g. 'i18n.textareaDescription.other' becomes\n * `{ i18n: { textareaDescription: { other } } }`\n */\n for (const [index, name] of keyParts.entries()) {\n if (typeof current === 'object') {\n // Drop down to nested object until the last part\n if (index < keyParts.length - 1) {\n // New nested object (optionally) replaces existing value\n if (!isObject(current[name])) {\n current[name] = {}\n }\n\n // Drop down into new or existing nested object\n current = current[name]\n } else if (key !== namespace) {\n // Normalised value (optionally) replaces existing value\n current[name] = normaliseString(value)\n }\n }\n }\n }\n\n return newObject[namespace]\n}\n\n/**\n * Get hash fragment from URL\n *\n * Extract the hash fragment (everything after the hash) from a URL,\n * but not including the hash symbol\n *\n * @private\n * @param {string} url - URL\n * @returns {string | undefined} Fragment from URL, without the hash\n */\nexport function getFragmentFromUrl(url) {\n if (!url.includes('#')) {\n return undefined\n }\n\n return url.split('#').pop()\n}\n\n/**\n * Get GOV.UK Frontend breakpoint value from CSS custom property\n *\n * @private\n * @param {string} name - Breakpoint name\n * @returns {{ property: string, value?: string }} Breakpoint object\n */\nexport function getBreakpoint(name) {\n const property = `--govuk-frontend-breakpoint-${name}`\n\n // Get value from `<html>` with breakpoints on CSS :root\n const value = window\n .getComputedStyle(document.documentElement)\n .getPropertyValue(property)\n\n return {\n property,\n value: value || undefined\n }\n}\n\n/**\n * Move focus to element\n *\n * Sets tabindex to -1 to make the element programmatically focusable,\n * but removes it on blur as the element doesn't need to be focused again.\n *\n * @private\n * @template {HTMLElement} FocusElement\n * @param {FocusElement} $element - HTML element\n * @param {object} [options] - Handler options\n * @param {function(this: FocusElement): void} [options.onBeforeFocus] - Callback before focus\n * @param {function(this: FocusElement): void} [options.onBlur] - Callback on blur\n */\nexport function setFocus($element, options = {}) {\n const isFocusable = $element.getAttribute('tabindex')\n\n if (!isFocusable) {\n $element.setAttribute('tabindex', '-1')\n }\n\n /**\n * Handle element focus\n */\n function onFocus() {\n $element.addEventListener('blur', onBlur, { once: true })\n }\n\n /**\n * Handle element blur\n */\n function onBlur() {\n options.onBlur?.call($element)\n\n if (!isFocusable) {\n $element.removeAttribute('tabindex')\n }\n }\n\n // Add listener to reset element on blur, after focus\n $element.addEventListener('focus', onFocus, { once: true })\n\n // Focus element\n options.onBeforeFocus?.call($element)\n $element.focus()\n}\n\n/**\n * Checks if GOV.UK Frontend is supported on this page\n *\n * Some browsers will load and run our JavaScript but GOV.UK Frontend\n * won't be supported.\n *\n * @internal\n * @param {HTMLElement | null} [$scope] - HTML element `<body>` checked for browser support\n * @returns {boolean} Whether GOV.UK Frontend is supported on this page\n */\nexport function isSupported($scope = document.body) {\n if (!$scope) {\n return false\n }\n\n return $scope.classList.contains('govuk-frontend-supported')\n}\n\n/**\n * Validate component config by schema\n *\n * Follows limited examples in JSON schema for wider support in future\n *\n * {@link https://ajv.js.org/json-schema.html#compound-keywords}\n * {@link https://ajv.js.org/packages/ajv-errors.html#single-message}\n *\n * @internal\n * @param {Schema} schema - Config schema\n * @param {{ [key: string]: unknown }} config - Component config\n * @returns {string[]} List of validation errors\n */\nexport function validateConfig(schema, config) {\n const validationErrors = []\n\n // Check errors for each schema\n for (const [name, conditions] of Object.entries(schema)) {\n const errors = []\n\n // Check errors for each schema condition\n if (Array.isArray(conditions)) {\n for (const { required, errorMessage } of conditions) {\n if (!required.every((key) => !!config[key])) {\n errors.push(errorMessage) // Missing config key value\n }\n }\n\n // Check one condition passes or add errors\n if (name === 'anyOf' && !(conditions.length - errors.length >= 1)) {\n validationErrors.push(...errors)\n }\n }\n }\n\n return validationErrors\n}\n\n/**\n * Check for an array\n *\n * @internal\n * @param {unknown} option - Option to check\n * @returns {boolean} Whether the option is an array\n */\nfunction isArray(option) {\n return Array.isArray(option)\n}\n\n/**\n * Check for an object\n *\n * @internal\n * @param {unknown} option - Option to check\n * @returns {boolean} Whether the option is an object\n */\nfunction isObject(option) {\n return !!option && typeof option === 'object' && !isArray(option)\n}\n\n/**\n * Schema for component config\n *\n * @typedef {object} Schema\n * @property {{ [field: string]: SchemaProperty | undefined }} properties - Schema properties\n * @property {SchemaCondition[]} [anyOf] - List of schema conditions\n */\n\n/**\n * Schema property for component config\n *\n * @typedef {object} SchemaProperty\n * @property {'string' | 'boolean' | 'number' | 'object'} type - Property type\n */\n\n/**\n * Schema condition for component config\n *\n * @typedef {object} SchemaCondition\n * @property {string[]} required - List of required config fields\n * @property {string} errorMessage - Error message when required config fields not provided\n */\n\n/**\n * @internal\n * @typedef {keyof ObjectNested} NestedKey\n * @typedef {{ [key: string]: string | boolean | number | ObjectNested | undefined }} ObjectNested\n */\n","import { extractConfigByNamespace } from './index.mjs'\nimport { normaliseString } from './normalise-string.mjs'\n\n/**\n * Normalise dataset\n *\n * Loop over an object and normalise each value using {@link normaliseString},\n * optionally expanding nested `i18n.field`\n *\n * @internal\n * @param {{ schema: Schema }} Component - Component class\n * @param {DOMStringMap} dataset - HTML element dataset\n * @returns {ObjectNested} Normalised dataset\n */\nexport function normaliseDataset(Component, dataset) {\n const out = /** @type {ReturnType<typeof normaliseDataset>} */ ({})\n\n // Normalise top-level dataset ('data-*') values using schema types\n for (const [field, property] of Object.entries(Component.schema.properties)) {\n if (field in dataset) {\n out[field] = normaliseString(dataset[field], property)\n }\n\n /**\n * Extract and normalise nested object values automatically using\n * {@link normaliseString} but only schema object types are allowed\n */\n if (property?.type === 'object') {\n out[field] = extractConfigByNamespace(Component, dataset, field)\n }\n }\n\n return out\n}\n\n/**\n * @internal\n * @typedef {import('./index.mjs').ObjectNested} ObjectNested\n * @typedef {import('./index.mjs').Schema} Schema\n */\n","/**\n * GOV.UK Frontend error\n *\n * A base class for `Error`s thrown by GOV.UK Frontend.\n *\n * It is meant to be extended into specific types of errors\n * to be thrown by our code.\n *\n * @example\n * ```js\n * class MissingRootError extends GOVUKFrontendError {\n * // Setting an explicit name is important as extending the class will not\n * // set a new `name` on the subclass. The `name` property is important\n * // to ensure intelligible error names even if the class name gets\n * // mangled by a minifier\n * name = \"MissingRootError\"\n * }\n * ```\n * @abstract\n */\nexport class GOVUKFrontendError extends Error {\n name = 'GOVUKFrontendError'\n}\n\n/**\n * Indicates that GOV.UK Frontend is not supported\n */\nexport class SupportError extends GOVUKFrontendError {\n name = 'SupportError'\n\n /**\n * Checks if GOV.UK Frontend is supported on this page\n *\n * @param {HTMLElement | null} [$scope] - HTML element `<body>` checked for browser support\n */\n constructor($scope = document.body) {\n const supportMessage =\n 'noModule' in HTMLScriptElement.prototype\n ? 'GOV.UK Frontend initialised without `<body class=\"govuk-frontend-supported\">` from template `<script>` snippet'\n : 'GOV.UK Frontend is not supported in this browser'\n\n super(\n $scope\n ? supportMessage\n : 'GOV.UK Frontend initialised without `<script type=\"module\">`'\n )\n }\n}\n\n/**\n * Indicates that a component has received an illegal configuration\n */\nexport class ConfigError extends GOVUKFrontendError {\n name = 'ConfigError'\n}\n\n/**\n * Indicates an issue with an element (possibly `null` or `undefined`)\n */\nexport class ElementError extends GOVUKFrontendError {\n name = 'ElementError'\n\n /**\n * @internal\n * @overload\n * @param {string} message - Element error message\n */\n\n /**\n * @internal\n * @overload\n * @param {ElementErrorOptions} options - Element error options\n */\n\n /**\n * @internal\n * @param {string | ElementErrorOptions} messageOrOptions - Element error message or options\n */\n constructor(messageOrOptions) {\n let message = typeof messageOrOptions === 'string' ? messageOrOptions : ''\n\n // Build message from options\n if (typeof messageOrOptions === 'object') {\n const { componentName, identifier, element, expectedType } =\n messageOrOptions\n\n // Add prefix and identifier\n message = `${componentName}: ${identifier}`\n\n // Append reason\n message += element\n ? ` is not of type ${expectedType ?? 'HTMLElement'}`\n : ' not found'\n }\n\n super(message)\n }\n}\n\n/**\n * Element error options\n *\n * @internal\n * @typedef {object} ElementErrorOptions\n * @property {string} componentName - The name of the component throwing the error\n * @property {string} identifier - An identifier that'll let the user understand which element has an error. This is whatever makes the most sense\n * @property {Element | null} [element] - The element in error\n * @property {string} [expectedType] - The type that was expected for the identifier\n */\n","import { isSupported } from './common/index.mjs'\nimport { SupportError } from './errors/index.mjs'\n\n/**\n * Base Component class\n *\n * Centralises the behaviours shared by our components\n *\n * @internal\n * @abstract\n */\nexport class GOVUKFrontendComponent {\n /**\n * Constructs a new component, validating that GOV.UK Frontend is supported\n *\n * @internal\n */\n constructor() {\n this.checkSupport()\n }\n\n /**\n * Validates whether GOV.UK Frontend is supported\n *\n * @private\n * @throws {SupportError} when GOV.UK Frontend is not supported\n */\n checkSupport() {\n if (!isSupported()) {\n throw new SupportError()\n }\n }\n}\n","import { mergeConfigs, setFocus } from '../../common/index.mjs'\nimport { normaliseDataset } from '../../common/normalise-dataset.mjs'\nimport { ElementError } from '../../errors/index.mjs'\nimport { GOVUKFrontendComponent } from '../../govuk-frontend-component.mjs'\n\n/**\n * Notification Banner component\n *\n * @preserve\n */\nexport class NotificationBanner extends GOVUKFrontendComponent {\n /** @private */\n $module\n\n /**\n * @private\n * @type {NotificationBannerConfig}\n */\n config\n\n /**\n * @param {Element | null} $module - HTML element to use for notification banner\n * @param {NotificationBannerConfig} [config] - Notification banner config\n */\n constructor($module, config = {}) {\n super()\n\n if (!($module instanceof HTMLElement)) {\n throw new ElementError({\n componentName: 'Notification banner',\n element: $module,\n identifier: 'Root element (`$module`)'\n })\n }\n\n this.$module = $module\n\n this.config = mergeConfigs(\n NotificationBanner.defaults,\n config,\n normaliseDataset(NotificationBanner, $module.dataset)\n )\n\n /**\n * Focus the notification banner\n *\n * If `role=\"alert\"` is set, focus the element to help some assistive\n * technologies prioritise announcing it.\n *\n * You can turn off the auto-focus functionality by setting\n * `data-disable-auto-focus=\"true\"` in the component HTML. You might wish to\n * do this based on user research findings, or to avoid a clash with another\n * element which should be focused when the page loads.\n */\n if (\n this.$module.getAttribute('role') === 'alert' &&\n !this.config.disableAutoFocus\n ) {\n setFocus(this.$module)\n }\n }\n\n /**\n * Name for the component used when initialising using data-module attributes.\n */\n static moduleName = 'govuk-notification-banner'\n\n /**\n * Notification banner default config\n *\n * @see {@link NotificationBannerConfig}\n * @constant\n * @type {NotificationBannerConfig}\n */\n static defaults = Object.freeze({\n disableAutoFocus: false\n })\n\n /**\n * Notification banner config schema\n *\n * @constant\n * @satisfies {Schema}\n */\n static schema = Object.freeze({\n properties: {\n disableAutoFocus: { type: 'boolean' }\n }\n })\n}\n\n/**\n * Notification banner config\n *\n * @typedef {object} NotificationBannerConfig\n * @property {boolean} [disableAutoFocus=false] - If set to `true` the\n * notification banner will not be focussed when the page loads. This only\n * applies if the component has a `role` of `alert` – in other cases the\n * component will not be focused on page load, regardless of this option.\n */\n\n/**\n * @typedef {import('../../common/index.mjs').Schema} Schema\n */\n"],"names":["normaliseString","value","property","trimmedValue","trim","output","outputType","type","includes","length","isFinite","Number","mergeConfigs","configObjects","formattedConfigObject","configObject","key","Object","keys","option","override","isObject","extractConfigByNamespace","Component","dataset","namespace","schema","properties","newObject","entries","current","keyParts","split","index","name","setFocus","$element","options","_options$onBeforeFocu","isFocusable","getAttribute","setAttribute","onFocus","addEventListener","onBlur","once","_options$onBlur","call","removeAttribute","onBeforeFocus","focus","isSupported","$scope","document","body","classList","contains","isArray","Array","normaliseDataset","out","field","GOVUKFrontendError","Error","constructor","args","SupportError","supportMessage","HTMLScriptElement","prototype","ElementError","messageOrOptions","message","componentName","identifier","element","expectedType","GOVUKFrontendComponent","checkSupport","NotificationBanner","$module","config","HTMLElement","defaults","disableAutoFocus","moduleName","freeze"],"mappings":"AAgBO,SAASA,eAAeA,CAACC,KAAK,EAAEC,QAAQ,EAAE;EAC/C,MAAMC,YAAY,GAAGF,KAAK,GAAGA,KAAK,CAACG,IAAI,EAAE,GAAG,EAAE,CAAA;AAE9C,EAAA,IAAIC,MAAM,CAAA;AACV,EAAA,IAAIC,UAAU,GAAGJ,QAAQ,IAARA,IAAAA,GAAAA,KAAAA,CAAAA,GAAAA,QAAQ,CAAEK,IAAI,CAAA;EAG/B,IAAI,CAACD,UAAU,EAAE;IACf,IAAI,CAAC,MAAM,EAAE,OAAO,CAAC,CAACE,QAAQ,CAACL,YAAY,CAAC,EAAE;AAC5CG,MAAAA,UAAU,GAAG,SAAS,CAAA;AACxB,KAAA;AAIA,IAAA,IAAIH,YAAY,CAACM,MAAM,GAAG,CAAC,IAAIC,QAAQ,CAACC,MAAM,CAACR,YAAY,CAAC,CAAC,EAAE;AAC7DG,MAAAA,UAAU,GAAG,QAAQ,CAAA;AACvB,KAAA;AACF,GAAA;AAEA,EAAA,QAAQA,UAAU;AAChB,IAAA,KAAK,SAAS;MACZD,MAAM,GAAGF,YAAY,KAAK,MAAM,CAAA;AAChC,MAAA,MAAA;AAEF,IAAA,KAAK,QAAQ;AACXE,MAAAA,MAAM,GAAGM,MAAM,CAACR,YAAY,CAAC,CAAA;AAC7B,MAAA,MAAA;AAEF,IAAA;AACEE,MAAAA,MAAM,GAAGJ,KAAK,CAAA;AAClB,GAAA;AAEA,EAAA,OAAOI,MAAM,CAAA;AACf,CAAA;;AAEA;AACA;AACA;;ACjCO,SAASO,YAAYA,CAAC,GAAGC,aAAa,EAAE;EAG7C,MAAMC,qBAAqB,GAAG,EAAE,CAAA;AAGhC,EAAA,KAAK,MAAMC,YAAY,IAAIF,aAAa,EAAE;IACxC,KAAK,MAAMG,GAAG,IAAIC,MAAM,CAACC,IAAI,CAAC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,EACNtB,gBAAgB,CAACoB,kBAAkB,EAAEC,OAAO,CAACxD,OAAO,CACtD,CAAC,CAAA;AAaD,IAAA,IACE,IAAI,CAACwD,OAAO,CAACxC,YAAY,CAAC,MAAM,CAAC,KAAK,OAAO,IAC7C,CAAC,IAAI,CAACyC,MAAM,CAACG,gBAAgB,EAC7B;AACAjD,MAAAA,QAAQ,CAAC,IAAI,CAAC6C,OAAO,CAAC,CAAA;AACxB,KAAA;AACF,GAAA;AA6BF,CAAA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AA7FaD,kBAAkB,CAuDtBM,UAAU,GAAG,2BAA2B,CAAA;AAvDpCN,kBAAkB,CAgEtBI,QAAQ,GAAGlE,MAAM,CAACqE,MAAM,CAAC;AAC9BF,EAAAA,gBAAgB,EAAE,KAAA;AACpB,CAAC,CAAC,CAAA;AAlESL,kBAAkB,CA0EtBrD,MAAM,GAAGT,MAAM,CAACqE,MAAM,CAAC;AAC5B3D,EAAAA,UAAU,EAAE;AACVyD,IAAAA,gBAAgB,EAAE;AAAE7E,MAAAA,IAAI,EAAE,SAAA;AAAU,KAAA;AACtC,GAAA;AACF,CAAC,CAAC;;;;"}
@@ -25,7 +25,7 @@ class NotificationBanner extends GOVUKFrontendComponent {
25
25
  });
26
26
  }
27
27
  this.$module = $module;
28
- this.config = mergeConfigs(NotificationBanner.defaults, config, normaliseDataset($module.dataset));
28
+ this.config = mergeConfigs(NotificationBanner.defaults, config, normaliseDataset(NotificationBanner, $module.dataset));
29
29
  if (this.$module.getAttribute('role') === 'alert' && !this.config.disableAutoFocus) {
30
30
  setFocus(this.$module);
31
31
  }
@@ -41,10 +41,21 @@ class NotificationBanner extends GOVUKFrontendComponent {
41
41
  * applies if the component has a `role` of `alert` – in other cases the
42
42
  * component will not be focused on page load, regardless of this option.
43
43
  */
44
+
45
+ /**
46
+ * @typedef {import('../../common/index.mjs').Schema} Schema
47
+ */
44
48
  NotificationBanner.moduleName = 'govuk-notification-banner';
45
49
  NotificationBanner.defaults = Object.freeze({
46
50
  disableAutoFocus: false
47
51
  });
52
+ NotificationBanner.schema = Object.freeze({
53
+ properties: {
54
+ disableAutoFocus: {
55
+ type: 'boolean'
56
+ }
57
+ }
58
+ });
48
59
 
49
60
  export { NotificationBanner };
50
61
  //# sourceMappingURL=notification-banner.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"notification-banner.mjs","sources":["../../../../src/govuk/components/notification-banner/notification-banner.mjs"],"sourcesContent":["import { mergeConfigs, setFocus } from '../../common/index.mjs'\nimport { normaliseDataset } from '../../common/normalise-dataset.mjs'\nimport { ElementError } from '../../errors/index.mjs'\nimport { GOVUKFrontendComponent } from '../../govuk-frontend-component.mjs'\n\n/**\n * Notification Banner component\n *\n * @preserve\n */\nexport class NotificationBanner extends GOVUKFrontendComponent {\n /** @private */\n $module\n\n /**\n * @private\n * @type {NotificationBannerConfig}\n */\n config\n\n /**\n * @param {Element | null} $module - HTML element to use for notification banner\n * @param {NotificationBannerConfig} [config] - Notification banner config\n */\n constructor($module, config = {}) {\n super()\n\n if (!($module instanceof HTMLElement)) {\n throw new ElementError({\n componentName: 'Notification banner',\n element: $module,\n identifier: 'Root element (`$module`)'\n })\n }\n\n this.$module = $module\n\n this.config = mergeConfigs(\n NotificationBanner.defaults,\n config,\n normaliseDataset($module.dataset)\n )\n\n /**\n * Focus the notification banner\n *\n * If `role=\"alert\"` is set, focus the element to help some assistive\n * technologies prioritise announcing it.\n *\n * You can turn off the auto-focus functionality by setting\n * `data-disable-auto-focus=\"true\"` in the component HTML. You might wish to\n * do this based on user research findings, or to avoid a clash with another\n * element which should be focused when the page loads.\n */\n if (\n this.$module.getAttribute('role') === 'alert' &&\n !this.config.disableAutoFocus\n ) {\n setFocus(this.$module)\n }\n }\n\n /**\n * Name for the component used when initialising using data-module attributes.\n */\n static moduleName = 'govuk-notification-banner'\n\n /**\n * Notification banner default config\n *\n * @see {@link NotificationBannerConfig}\n * @constant\n * @type {NotificationBannerConfig}\n */\n static defaults = Object.freeze({\n disableAutoFocus: false\n })\n}\n\n/**\n * Notification banner config\n *\n * @typedef {object} NotificationBannerConfig\n * @property {boolean} [disableAutoFocus=false] - If set to `true` the\n * notification banner will not be focussed when the page loads. This only\n * applies if the component has a `role` of `alert` – in other cases the\n * component will not be focused on page load, regardless of this option.\n */\n"],"names":["NotificationBanner","GOVUKFrontendComponent","constructor","$module","config","HTMLElement","ElementError","componentName","element","identifier","mergeConfigs","defaults","normaliseDataset","dataset","getAttribute","disableAutoFocus","setFocus","moduleName","Object","freeze"],"mappings":";;;;;AAKA;AACA;AACA;AACA;AACA;AACO,MAAMA,kBAAkB,SAASC,sBAAsB,CAAC;AAU7D;AACF;AACA;AACA;AACEC,EAAAA,WAAWA,CAACC,OAAO,EAAEC,MAAM,GAAG,EAAE,EAAE;AAChC,IAAA,KAAK,EAAE,CAAA;AAAA,IAAA,IAAA,CAbTD,OAAO,GAAA,KAAA,CAAA,CAAA;AAAA,IAAA,IAAA,CAMPC,MAAM,GAAA,KAAA,CAAA,CAAA;AASJ,IAAA,IAAI,EAAED,OAAO,YAAYE,WAAW,CAAC,EAAE;MACrC,MAAM,IAAIC,YAAY,CAAC;AACrBC,QAAAA,aAAa,EAAE,qBAAqB;AACpCC,QAAAA,OAAO,EAAEL,OAAO;AAChBM,QAAAA,UAAU,EAAE,0BAAA;AACd,OAAC,CAAC,CAAA;AACJ,KAAA;IAEA,IAAI,CAACN,OAAO,GAAGA,OAAO,CAAA;AAEtB,IAAA,IAAI,CAACC,MAAM,GAAGM,YAAY,CACxBV,kBAAkB,CAACW,QAAQ,EAC3BP,MAAM,EACNQ,gBAAgB,CAACT,OAAO,CAACU,OAAO,CAClC,CAAC,CAAA;AAaD,IAAA,IACE,IAAI,CAACV,OAAO,CAACW,YAAY,CAAC,MAAM,CAAC,KAAK,OAAO,IAC7C,CAAC,IAAI,CAACV,MAAM,CAACW,gBAAgB,EAC7B;AACAC,MAAAA,QAAQ,CAAC,IAAI,CAACb,OAAO,CAAC,CAAA;AACxB,KAAA;AACF,GAAA;AAiBF,CAAA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA7EaH,kBAAkB,CAuDtBiB,UAAU,GAAG,2BAA2B,CAAA;AAvDpCjB,kBAAkB,CAgEtBW,QAAQ,GAAGO,MAAM,CAACC,MAAM,CAAC;AAC9BJ,EAAAA,gBAAgB,EAAE,KAAA;AACpB,CAAC,CAAC;;;;"}
1
+ {"version":3,"file":"notification-banner.mjs","sources":["../../../../src/govuk/components/notification-banner/notification-banner.mjs"],"sourcesContent":["import { mergeConfigs, setFocus } from '../../common/index.mjs'\nimport { normaliseDataset } from '../../common/normalise-dataset.mjs'\nimport { ElementError } from '../../errors/index.mjs'\nimport { GOVUKFrontendComponent } from '../../govuk-frontend-component.mjs'\n\n/**\n * Notification Banner component\n *\n * @preserve\n */\nexport class NotificationBanner extends GOVUKFrontendComponent {\n /** @private */\n $module\n\n /**\n * @private\n * @type {NotificationBannerConfig}\n */\n config\n\n /**\n * @param {Element | null} $module - HTML element to use for notification banner\n * @param {NotificationBannerConfig} [config] - Notification banner config\n */\n constructor($module, config = {}) {\n super()\n\n if (!($module instanceof HTMLElement)) {\n throw new ElementError({\n componentName: 'Notification banner',\n element: $module,\n identifier: 'Root element (`$module`)'\n })\n }\n\n this.$module = $module\n\n this.config = mergeConfigs(\n NotificationBanner.defaults,\n config,\n normaliseDataset(NotificationBanner, $module.dataset)\n )\n\n /**\n * Focus the notification banner\n *\n * If `role=\"alert\"` is set, focus the element to help some assistive\n * technologies prioritise announcing it.\n *\n * You can turn off the auto-focus functionality by setting\n * `data-disable-auto-focus=\"true\"` in the component HTML. You might wish to\n * do this based on user research findings, or to avoid a clash with another\n * element which should be focused when the page loads.\n */\n if (\n this.$module.getAttribute('role') === 'alert' &&\n !this.config.disableAutoFocus\n ) {\n setFocus(this.$module)\n }\n }\n\n /**\n * Name for the component used when initialising using data-module attributes.\n */\n static moduleName = 'govuk-notification-banner'\n\n /**\n * Notification banner default config\n *\n * @see {@link NotificationBannerConfig}\n * @constant\n * @type {NotificationBannerConfig}\n */\n static defaults = Object.freeze({\n disableAutoFocus: false\n })\n\n /**\n * Notification banner config schema\n *\n * @constant\n * @satisfies {Schema}\n */\n static schema = Object.freeze({\n properties: {\n disableAutoFocus: { type: 'boolean' }\n }\n })\n}\n\n/**\n * Notification banner config\n *\n * @typedef {object} NotificationBannerConfig\n * @property {boolean} [disableAutoFocus=false] - If set to `true` the\n * notification banner will not be focussed when the page loads. This only\n * applies if the component has a `role` of `alert` – in other cases the\n * component will not be focused on page load, regardless of this option.\n */\n\n/**\n * @typedef {import('../../common/index.mjs').Schema} Schema\n */\n"],"names":["NotificationBanner","GOVUKFrontendComponent","constructor","$module","config","HTMLElement","ElementError","componentName","element","identifier","mergeConfigs","defaults","normaliseDataset","dataset","getAttribute","disableAutoFocus","setFocus","moduleName","Object","freeze","schema","properties","type"],"mappings":";;;;;AAKA;AACA;AACA;AACA;AACA;AACO,MAAMA,kBAAkB,SAASC,sBAAsB,CAAC;AAU7D;AACF;AACA;AACA;AACEC,EAAAA,WAAWA,CAACC,OAAO,EAAEC,MAAM,GAAG,EAAE,EAAE;AAChC,IAAA,KAAK,EAAE,CAAA;AAAA,IAAA,IAAA,CAbTD,OAAO,GAAA,KAAA,CAAA,CAAA;AAAA,IAAA,IAAA,CAMPC,MAAM,GAAA,KAAA,CAAA,CAAA;AASJ,IAAA,IAAI,EAAED,OAAO,YAAYE,WAAW,CAAC,EAAE;MACrC,MAAM,IAAIC,YAAY,CAAC;AACrBC,QAAAA,aAAa,EAAE,qBAAqB;AACpCC,QAAAA,OAAO,EAAEL,OAAO;AAChBM,QAAAA,UAAU,EAAE,0BAAA;AACd,OAAC,CAAC,CAAA;AACJ,KAAA;IAEA,IAAI,CAACN,OAAO,GAAGA,OAAO,CAAA;AAEtB,IAAA,IAAI,CAACC,MAAM,GAAGM,YAAY,CACxBV,kBAAkB,CAACW,QAAQ,EAC3BP,MAAM,EACNQ,gBAAgB,CAACZ,kBAAkB,EAAEG,OAAO,CAACU,OAAO,CACtD,CAAC,CAAA;AAaD,IAAA,IACE,IAAI,CAACV,OAAO,CAACW,YAAY,CAAC,MAAM,CAAC,KAAK,OAAO,IAC7C,CAAC,IAAI,CAACV,MAAM,CAACW,gBAAgB,EAC7B;AACAC,MAAAA,QAAQ,CAAC,IAAI,CAACb,OAAO,CAAC,CAAA;AACxB,KAAA;AACF,GAAA;AA6BF,CAAA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AA7FaH,kBAAkB,CAuDtBiB,UAAU,GAAG,2BAA2B,CAAA;AAvDpCjB,kBAAkB,CAgEtBW,QAAQ,GAAGO,MAAM,CAACC,MAAM,CAAC;AAC9BJ,EAAAA,gBAAgB,EAAE,KAAA;AACpB,CAAC,CAAC,CAAA;AAlESf,kBAAkB,CA0EtBoB,MAAM,GAAGF,MAAM,CAACC,MAAM,CAAC;AAC5BE,EAAAA,UAAU,EAAE;AACVN,IAAAA,gBAAgB,EAAE;AAAEO,MAAAA,IAAI,EAAE,SAAA;AAAU,KAAA;AACtC,GAAA;AACF,CAAC,CAAC;;;;"}
@@ -5,5 +5,8 @@
5
5
  </h2>
6
6
  </div>
7
7
  <div class="govuk-notification-banner__content">
8
- <p class="govuk-notification-banner__heading">Email sent to example@email.com</p></div>
8
+ <p class="govuk-notification-banner__heading">
9
+ Email sent to example@email.com
10
+ </p>
11
+ </div>
9
12
  </div>
@@ -5,5 +5,8 @@
5
5
  </h2>
6
6
  </div>
7
7
  <div class="govuk-notification-banner__content">
8
- <p class="govuk-notification-banner__heading">Email sent to example@email.com</p></div>
8
+ <p class="govuk-notification-banner__heading">
9
+ Email sent to example@email.com
10
+ </p>
11
+ </div>
9
12
  </div>
@@ -5,5 +5,8 @@
5
5
  </h2>
6
6
  </div>
7
7
  <div class="govuk-notification-banner__content">
8
- <p class="govuk-notification-banner__heading">Email sent to example@email.com</p></div>
8
+ <p class="govuk-notification-banner__heading">
9
+ Email sent to example@email.com
10
+ </p>
11
+ </div>
9
12
  </div>
@@ -5,5 +5,8 @@
5
5
  </h2>
6
6
  </div>
7
7
  <div class="govuk-notification-banner__content">
8
- <p class="govuk-notification-banner__heading">This publication was withdrawn on 7 March 2014.</p></div>
8
+ <p class="govuk-notification-banner__heading">
9
+ This publication was withdrawn on 7 March 2014.
10
+ </p>
11
+ </div>
9
12
  </div>
@@ -4,6 +4,7 @@
4
4
  Important
5
5
  </h2>
6
6
  </div>
7
- <div class="govuk-notification-banner__content"><p class="govuk-notification-banner__heading">You have 9 days to send a response.</p>
8
- </div>
7
+ <div class="govuk-notification-banner__content">
8
+ <p class="govuk-notification-banner__heading">You have 9 days to send a response.</p>
9
+ </div>
9
10
  </div>
@@ -5,5 +5,8 @@
5
5
  </h2>
6
6
  </div>
7
7
  <div class="govuk-notification-banner__content">
8
- <p class="govuk-notification-banner__heading">Email sent to example@email.com</p></div>
8
+ <p class="govuk-notification-banner__heading">
9
+ Email sent to example@email.com
10
+ </p>
11
+ </div>
9
12
  </div>
@@ -4,12 +4,13 @@
4
4
  Success
5
5
  </h2>
6
6
  </div>
7
- <div class="govuk-notification-banner__content"><h3 class="govuk-notification-banner__heading">
8
- 4 files uploaded
9
- </h3>
10
- <ul class="govuk-!-margin-0 govuk-list">
11
- <li><a href="link-1" class="govuk-notification-banner__link">government-strategy.pdf</a></li>
12
- <li><a href="link-2" class="govuk-notification-banner__link">government-strategy-v1.pdf</a></li>
13
- </ul>
14
- </div>
7
+ <div class="govuk-notification-banner__content">
8
+ <h3 class="govuk-notification-banner__heading">
9
+ 4 files uploaded
10
+ </h3>
11
+ <ul class="govuk-!-margin-0 govuk-list">
12
+ <li><a href="link-1" class="govuk-notification-banner__link">government-strategy.pdf</a></li>
13
+ <li><a href="link-2" class="govuk-notification-banner__link">government-strategy-v1.pdf</a></li>
14
+ </ul>
15
+ </div>
15
16
  </div>
@@ -4,12 +4,13 @@
4
4
  Important
5
5
  </h2>
6
6
  </div>
7
- <div class="govuk-notification-banner__content"><h3 class="govuk-notification-banner__heading">4 files uploaded</h3>
8
- <ul class="govuk-list govuk-list--bullet govuk-!-margin-bottom-0">
9
- <li><a href="#" class="govuk-notification-banner__link">government-strategy.pdf</a></li>
10
- <li><a href="#" class="govuk-notification-banner__link">government-strategy-v2.pdf</a></li>
11
- <li><a href="#" class="govuk-notification-banner__link">government-strategy-v3-FINAL.pdf</a></li>
12
- <li><a href="#" class="govuk-notification-banner__link">government-strategy-v4-FINAL-v2.pdf</a></li>
13
- </ul>
14
- </div>
7
+ <div class="govuk-notification-banner__content">
8
+ <h3 class="govuk-notification-banner__heading">4 files uploaded</h3>
9
+ <ul class="govuk-list govuk-list--bullet govuk-!-margin-bottom-0">
10
+ <li><a href="#" class="govuk-notification-banner__link">government-strategy.pdf</a></li>
11
+ <li><a href="#" class="govuk-notification-banner__link">government-strategy-v2.pdf</a></li>
12
+ <li><a href="#" class="govuk-notification-banner__link">government-strategy-v3-FINAL.pdf</a></li>
13
+ <li><a href="#" class="govuk-notification-banner__link">government-strategy-v4-FINAL-v2.pdf</a></li>
14
+ </ul>
15
+ </div>
15
16
  </div>
@@ -5,5 +5,8 @@
5
5
  </h2>
6
6
  </div>
7
7
  <div class="govuk-notification-banner__content">
8
- <p class="govuk-notification-banner__heading">This publication was withdrawn on 7 March 2014, before being sent in, sent back, queried, lost, found, subjected to public inquiry, lost again, and finally buried in soft peat for three months and recycled as firelighters.</p></div>
8
+ <p class="govuk-notification-banner__heading">
9
+ This publication was withdrawn on 7 March 2014, before being sent in, sent back, queried, lost, found, subjected to public inquiry, lost again, and finally buried in soft peat for three months and recycled as firelighters.
10
+ </p>
11
+ </div>
9
12
  </div>
@@ -4,13 +4,16 @@
4
4
  Important
5
5
  </h2>
6
6
  </div>
7
- <div class="govuk-notification-banner__content"><h3 class="govuk-notification-banner__heading">
8
- Check if you need to apply the reverse charge to this application
9
- </h3>
10
- <p class="govuk-body">You will have to apply the <a href="#" class="govuk-notification-banner__link">reverse charge</a> if the applicant supplies any of these services:</p>
11
- <ul class="govuk-list govuk-list--bullet govuk-list--spaced">
12
- <li>constructing, altering, repairing, extending, demolishing or dismantling buildings or structures (whether permanent or not), including offshore installation services</li>
13
- <li>constructing, altering, repairing, extending, demolishing of any works forming, or planned to form, part of the land, including (in particular) walls, roadworks, power lines, electronic communications equipment, aircraft runways, railways, inland waterways, docks and harbours</li>
14
- </ul>
15
- </div>
7
+ <div class="govuk-notification-banner__content">
8
+ <h3 class="govuk-notification-banner__heading">
9
+ Check if you need to apply the reverse charge to this application
10
+ </h3>
11
+ <p class="govuk-body">
12
+ You will have to apply the <a href="#" class="govuk-notification-banner__link">reverse charge</a> if the applicant supplies any of these services:
13
+ </p>
14
+ <ul class="govuk-list govuk-list--bullet govuk-list--spaced">
15
+ <li>constructing, altering, repairing, extending, demolishing or dismantling buildings or structures (whether permanent or not), including offshore installation services</li>
16
+ <li>constructing, altering, repairing, extending, demolishing of any works forming, or planned to form, part of the land, including (in particular) walls, roadworks, power lines, electronic communications equipment, aircraft runways, railways, inland waterways, docks and harbours</li>
17
+ </ul>
18
+ </div>
16
19
  </div>
@@ -4,9 +4,12 @@
4
4
  Important
5
5
  </h2>
6
6
  </div>
7
- <div class="govuk-notification-banner__content"><h3 class="govuk-notification-banner__heading">
8
- This publication was withdrawn on 7 March 2014
9
- </h3>
10
- <p class="govuk-body">Archived and replaced by the <a href="#" class="govuk-notification-banner__link">new planning guidance</a> launched 6 March 2014 on an external website</p>
11
- </div>
7
+ <div class="govuk-notification-banner__content">
8
+ <h3 class="govuk-notification-banner__heading">
9
+ This publication was withdrawn on 7 March 2014
10
+ </h3>
11
+ <p class="govuk-body">
12
+ Archived and replaced by the <a href="#" class="govuk-notification-banner__link">new planning guidance</a> launched 6 March 2014 on an external website
13
+ </p>
14
+ </div>
12
15
  </div>
@@ -5,5 +5,8 @@
5
5
  </h2>
6
6
  </div>
7
7
  <div class="govuk-notification-banner__content">
8
- <p class="govuk-notification-banner__heading">Email sent to example@email.com</p></div>
8
+ <p class="govuk-notification-banner__heading">
9
+ Email sent to example@email.com
10
+ </p>
11
+ </div>
9
12
  </div>
@@ -1,3 +1,5 @@
1
+ {% from "../../macros/attributes.njk" import govukAttributes %}
2
+
1
3
  {%- if params.type == "success" %}
2
4
  {% set successBanner = true %}
3
5
  {% endif %}
@@ -28,18 +30,20 @@
28
30
 
29
31
  <div class="govuk-notification-banner {%- if typeClass %} {{ typeClass }}{% endif %}{% if params.classes %} {{ params.classes }}{% endif %}" role="{{ role }}" aria-labelledby="{{ params.titleId | default("govuk-notification-banner-title", true) }}" data-module="govuk-notification-banner"
30
32
  {%- if params.disableAutoFocus !== undefined %} data-disable-auto-focus="{{ params.disableAutoFocus }}"{% endif %}
31
- {%- for attribute, value in params.attributes %} {{ attribute }}="{{ value }}"{% endfor %}>
33
+ {{- govukAttributes(params.attributes) }}>
32
34
  <div class="govuk-notification-banner__header">
33
35
  <h{{ params.titleHeadingLevel | default(2, true) }} class="govuk-notification-banner__title" id="{{ params.titleId | default("govuk-notification-banner-title", true) }}">
34
36
  {{ title }}
35
37
  </h{{ params.titleHeadingLevel | default(2, true) }}>
36
38
  </div>
37
39
  <div class="govuk-notification-banner__content">
38
- {%- if caller or params.html -%}
39
- {{ caller() if caller else params.html | safe }}
40
- {%- elif params.text -%}
41
- {# Set default style for single line content #}
42
- <p class="govuk-notification-banner__heading">{{ params.text }}</p>
43
- {%- endif -%}
40
+ {% if caller or params.html %}
41
+ {{ caller() if caller else params.html | safe | trim | indent(4) }}
42
+ {% elif params.text %}
43
+ {# Set default style for single line content -#}
44
+ <p class="govuk-notification-banner__heading">
45
+ {{ params.text | trim | indent(6) }}
46
+ </p>
47
+ {% endif %}
44
48
  </div>
45
49
  </div>