defra_ruby_template 5.4.0 → 5.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (428) hide show
  1. checksums.yaml +4 -4
  2. data/app/views/layouts/defra_ruby_template.html.erb +43 -23
  3. data/lib/defra_ruby_template/version.rb +1 -1
  4. data/lib/defra_ruby_template.rb +3 -8
  5. data/node_modules/govuk-frontend/dist/govuk/all.bundle.js +882 -492
  6. data/node_modules/govuk-frontend/dist/govuk/all.bundle.js.map +1 -1
  7. data/node_modules/govuk-frontend/dist/govuk/all.bundle.mjs +877 -492
  8. data/node_modules/govuk-frontend/dist/govuk/all.bundle.mjs.map +1 -1
  9. data/node_modules/govuk-frontend/dist/govuk/all.mjs +5 -0
  10. data/node_modules/govuk-frontend/dist/govuk/all.mjs.map +1 -1
  11. data/node_modules/govuk-frontend/dist/govuk/all.scss +6 -0
  12. data/node_modules/govuk-frontend/dist/govuk/all.scss.map +1 -1
  13. data/node_modules/govuk-frontend/dist/govuk/assets/images/govuk-crest.svg +1 -0
  14. data/node_modules/govuk-frontend/dist/govuk/assets/rebrand/images/favicon.ico +0 -0
  15. data/node_modules/govuk-frontend/dist/govuk/assets/rebrand/images/favicon.svg +1 -0
  16. data/node_modules/govuk-frontend/dist/govuk/assets/rebrand/images/govuk-crest.svg +1 -0
  17. data/node_modules/govuk-frontend/dist/govuk/assets/rebrand/images/govuk-icon-180.png +0 -0
  18. data/node_modules/govuk-frontend/dist/govuk/assets/rebrand/images/govuk-icon-192.png +0 -0
  19. data/node_modules/govuk-frontend/dist/govuk/assets/rebrand/images/govuk-icon-512.png +0 -0
  20. data/node_modules/govuk-frontend/dist/govuk/assets/rebrand/images/govuk-icon-mask.svg +1 -0
  21. data/node_modules/govuk-frontend/dist/govuk/assets/rebrand/images/govuk-opengraph-image.png +0 -0
  22. data/node_modules/govuk-frontend/dist/govuk/assets/rebrand/manifest.json +39 -0
  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/configuration.mjs +169 -0
  25. data/node_modules/govuk-frontend/dist/govuk/common/configuration.mjs.map +1 -0
  26. data/node_modules/govuk-frontend/dist/govuk/common/govuk-frontend-version.mjs +1 -1
  27. data/node_modules/govuk-frontend/dist/govuk/common/index.mjs +20 -83
  28. data/node_modules/govuk-frontend/dist/govuk/common/index.mjs.map +1 -1
  29. data/node_modules/govuk-frontend/dist/govuk/component.mjs +60 -0
  30. data/node_modules/govuk-frontend/dist/govuk/component.mjs.map +1 -0
  31. data/node_modules/govuk-frontend/dist/govuk/components/_index.scss +1 -0
  32. data/node_modules/govuk-frontend/dist/govuk/components/_index.scss.map +1 -1
  33. data/node_modules/govuk-frontend/dist/govuk/components/accordion/_index.scss +35 -31
  34. data/node_modules/govuk-frontend/dist/govuk/components/accordion/_index.scss.map +1 -1
  35. data/node_modules/govuk-frontend/dist/govuk/components/accordion/accordion.bundle.js +296 -195
  36. data/node_modules/govuk-frontend/dist/govuk/components/accordion/accordion.bundle.js.map +1 -1
  37. data/node_modules/govuk-frontend/dist/govuk/components/accordion/accordion.bundle.mjs +295 -194
  38. data/node_modules/govuk-frontend/dist/govuk/components/accordion/accordion.bundle.mjs.map +1 -1
  39. data/node_modules/govuk-frontend/dist/govuk/components/accordion/accordion.mjs +88 -110
  40. data/node_modules/govuk-frontend/dist/govuk/components/accordion/accordion.mjs.map +1 -1
  41. data/node_modules/govuk-frontend/dist/govuk/components/accordion/fixtures.json +16 -3
  42. data/node_modules/govuk-frontend/dist/govuk/components/back-link/fixtures.json +25 -15
  43. data/node_modules/govuk-frontend/dist/govuk/components/back-link/template-with-custom-link.html +1 -0
  44. data/node_modules/govuk-frontend/dist/govuk/components/back-link/template.njk +2 -2
  45. data/node_modules/govuk-frontend/dist/govuk/components/breadcrumbs/fixtures.json +53 -15
  46. data/node_modules/govuk-frontend/dist/govuk/components/breadcrumbs/macro-options.json +6 -0
  47. data/node_modules/govuk-frontend/dist/govuk/components/breadcrumbs/template-default.html +2 -2
  48. data/node_modules/govuk-frontend/dist/govuk/components/breadcrumbs/template-inverse.html +2 -2
  49. data/node_modules/govuk-frontend/dist/govuk/components/breadcrumbs/template-with-collapse-on-mobile.html +2 -2
  50. data/node_modules/govuk-frontend/dist/govuk/components/breadcrumbs/template-with-last-breadcrumb-as-current-page.html +2 -2
  51. data/node_modules/govuk-frontend/dist/govuk/components/breadcrumbs/template-with-multiple-levels.html +2 -2
  52. data/node_modules/govuk-frontend/dist/govuk/components/breadcrumbs/template-with-one-level.html +2 -2
  53. data/node_modules/govuk-frontend/dist/govuk/components/breadcrumbs/template-without-the-home-section.html +2 -2
  54. data/node_modules/govuk-frontend/dist/govuk/components/breadcrumbs/template.njk +2 -2
  55. data/node_modules/govuk-frontend/dist/govuk/components/button/button.bundle.js +217 -106
  56. data/node_modules/govuk-frontend/dist/govuk/components/button/button.bundle.js.map +1 -1
  57. data/node_modules/govuk-frontend/dist/govuk/components/button/button.bundle.mjs +216 -105
  58. data/node_modules/govuk-frontend/dist/govuk/components/button/button.bundle.mjs.map +1 -1
  59. data/node_modules/govuk-frontend/dist/govuk/components/button/button.mjs +9 -22
  60. data/node_modules/govuk-frontend/dist/govuk/components/button/button.mjs.map +1 -1
  61. data/node_modules/govuk-frontend/dist/govuk/components/button/fixtures.json +38 -0
  62. data/node_modules/govuk-frontend/dist/govuk/components/button/macro-options.json +2 -1
  63. data/node_modules/govuk-frontend/dist/govuk/components/character-count/_index.scss +12 -4
  64. data/node_modules/govuk-frontend/dist/govuk/components/character-count/_index.scss.map +1 -1
  65. data/node_modules/govuk-frontend/dist/govuk/components/character-count/character-count.bundle.js +256 -145
  66. data/node_modules/govuk-frontend/dist/govuk/components/character-count/character-count.bundle.js.map +1 -1
  67. data/node_modules/govuk-frontend/dist/govuk/components/character-count/character-count.bundle.mjs +255 -144
  68. data/node_modules/govuk-frontend/dist/govuk/components/character-count/character-count.bundle.mjs.map +1 -1
  69. data/node_modules/govuk-frontend/dist/govuk/components/character-count/character-count.mjs +29 -34
  70. data/node_modules/govuk-frontend/dist/govuk/components/character-count/character-count.mjs.map +1 -1
  71. data/node_modules/govuk-frontend/dist/govuk/components/character-count/fixtures.json +80 -1
  72. data/node_modules/govuk-frontend/dist/govuk/components/character-count/macro-options.json +6 -6
  73. data/node_modules/govuk-frontend/dist/govuk/components/character-count/template-with-error.html +12 -0
  74. data/node_modules/govuk-frontend/dist/govuk/components/character-count/template-with-hint-and-error.html +15 -0
  75. data/node_modules/govuk-frontend/dist/govuk/components/character-count/template.njk +5 -4
  76. data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/_index.scss +6 -1
  77. data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/_index.scss.map +1 -1
  78. data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/checkboxes.bundle.js +96 -50
  79. data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/checkboxes.bundle.js.map +1 -1
  80. data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/checkboxes.bundle.mjs +95 -49
  81. data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/checkboxes.bundle.mjs.map +1 -1
  82. data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/checkboxes.mjs +9 -18
  83. data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/checkboxes.mjs.map +1 -1
  84. data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/fixtures.json +88 -1
  85. data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/template-small-with-divider-and-none.html +34 -0
  86. data/node_modules/govuk-frontend/dist/govuk/components/cookie-banner/_index.scss +23 -14
  87. data/node_modules/govuk-frontend/dist/govuk/components/cookie-banner/_index.scss.map +1 -1
  88. data/node_modules/govuk-frontend/dist/govuk/components/cookie-banner/fixtures.json +23 -0
  89. data/node_modules/govuk-frontend/dist/govuk/components/date-input/_index.scss +2 -2
  90. data/node_modules/govuk-frontend/dist/govuk/components/date-input/_index.scss.map +1 -1
  91. data/node_modules/govuk-frontend/dist/govuk/components/date-input/fixtures.json +27 -0
  92. data/node_modules/govuk-frontend/dist/govuk/components/date-input/macro-options.json +2 -2
  93. data/node_modules/govuk-frontend/dist/govuk/components/details/_index.scss +7 -2
  94. data/node_modules/govuk-frontend/dist/govuk/components/details/_index.scss.map +1 -1
  95. data/node_modules/govuk-frontend/dist/govuk/components/details/fixtures.json +10 -0
  96. data/node_modules/govuk-frontend/dist/govuk/components/error-message/fixtures.json +9 -0
  97. data/node_modules/govuk-frontend/dist/govuk/components/error-summary/_index.scss +4 -0
  98. data/node_modules/govuk-frontend/dist/govuk/components/error-summary/_index.scss.map +1 -1
  99. data/node_modules/govuk-frontend/dist/govuk/components/error-summary/error-summary.bundle.js +238 -127
  100. data/node_modules/govuk-frontend/dist/govuk/components/error-summary/error-summary.bundle.js.map +1 -1
  101. data/node_modules/govuk-frontend/dist/govuk/components/error-summary/error-summary.bundle.mjs +237 -126
  102. data/node_modules/govuk-frontend/dist/govuk/components/error-summary/error-summary.bundle.mjs.map +1 -1
  103. data/node_modules/govuk-frontend/dist/govuk/components/error-summary/error-summary.mjs +10 -22
  104. data/node_modules/govuk-frontend/dist/govuk/components/error-summary/error-summary.mjs.map +1 -1
  105. data/node_modules/govuk-frontend/dist/govuk/components/error-summary/fixtures.json +19 -0
  106. data/node_modules/govuk-frontend/dist/govuk/components/exit-this-page/exit-this-page.bundle.js +218 -107
  107. data/node_modules/govuk-frontend/dist/govuk/components/exit-this-page/exit-this-page.bundle.js.map +1 -1
  108. data/node_modules/govuk-frontend/dist/govuk/components/exit-this-page/exit-this-page.bundle.mjs +217 -106
  109. data/node_modules/govuk-frontend/dist/govuk/components/exit-this-page/exit-this-page.bundle.mjs.map +1 -1
  110. data/node_modules/govuk-frontend/dist/govuk/components/exit-this-page/exit-this-page.mjs +10 -22
  111. data/node_modules/govuk-frontend/dist/govuk/components/exit-this-page/exit-this-page.mjs.map +1 -1
  112. data/node_modules/govuk-frontend/dist/govuk/components/exit-this-page/fixtures.json +4 -0
  113. data/node_modules/govuk-frontend/dist/govuk/components/fieldset/_index.scss +3 -5
  114. data/node_modules/govuk-frontend/dist/govuk/components/fieldset/_index.scss.map +1 -1
  115. data/node_modules/govuk-frontend/dist/govuk/components/fieldset/fixtures.json +18 -0
  116. data/node_modules/govuk-frontend/dist/govuk/components/file-upload/_index.scss +175 -9
  117. data/node_modules/govuk-frontend/dist/govuk/components/file-upload/_index.scss.map +1 -1
  118. data/node_modules/govuk-frontend/dist/govuk/components/file-upload/file-upload.bundle.js +744 -0
  119. data/node_modules/govuk-frontend/dist/govuk/components/file-upload/file-upload.bundle.js.map +1 -0
  120. data/node_modules/govuk-frontend/dist/govuk/components/file-upload/file-upload.bundle.mjs +736 -0
  121. data/node_modules/govuk-frontend/dist/govuk/components/file-upload/file-upload.bundle.mjs.map +1 -0
  122. data/node_modules/govuk-frontend/dist/govuk/components/file-upload/file-upload.mjs +257 -0
  123. data/node_modules/govuk-frontend/dist/govuk/components/file-upload/file-upload.mjs.map +1 -0
  124. data/node_modules/govuk-frontend/dist/govuk/components/file-upload/fixtures.json +220 -16
  125. data/node_modules/govuk-frontend/dist/govuk/components/file-upload/macro-options.json +52 -3
  126. data/node_modules/govuk-frontend/dist/govuk/components/file-upload/template-allows-direct-media-capture.html +6 -0
  127. data/node_modules/govuk-frontend/dist/govuk/components/file-upload/template-allows-image-files-only.html +6 -0
  128. data/node_modules/govuk-frontend/dist/govuk/components/file-upload/template-allows-multiple-files.html +6 -0
  129. data/node_modules/govuk-frontend/dist/govuk/components/file-upload/template-disabled.html +6 -0
  130. data/node_modules/govuk-frontend/dist/govuk/components/file-upload/template-enhanced-disabled.html +13 -0
  131. data/node_modules/govuk-frontend/dist/govuk/components/file-upload/template-enhanced-with-error-message-and-hint.html +16 -0
  132. data/node_modules/govuk-frontend/dist/govuk/components/file-upload/template-enhanced.html +10 -0
  133. data/node_modules/govuk-frontend/dist/govuk/components/file-upload/template-translated.html +10 -0
  134. data/node_modules/govuk-frontend/dist/govuk/components/file-upload/template.njk +42 -5
  135. data/node_modules/govuk-frontend/dist/govuk/components/footer/_index.scss +61 -19
  136. data/node_modules/govuk-frontend/dist/govuk/components/footer/_index.scss.map +1 -1
  137. data/node_modules/govuk-frontend/dist/govuk/components/footer/fixtures.json +34 -0
  138. data/node_modules/govuk-frontend/dist/govuk/components/footer/macro-options.json +6 -0
  139. data/node_modules/govuk-frontend/dist/govuk/components/footer/template.njk +10 -0
  140. data/node_modules/govuk-frontend/dist/govuk/components/header/_index.scss +223 -21
  141. data/node_modules/govuk-frontend/dist/govuk/components/header/_index.scss.map +1 -1
  142. data/node_modules/govuk-frontend/dist/govuk/components/header/fixtures.json +78 -32
  143. data/node_modules/govuk-frontend/dist/govuk/components/header/header.bundle.js +90 -43
  144. data/node_modules/govuk-frontend/dist/govuk/components/header/header.bundle.js.map +1 -1
  145. data/node_modules/govuk-frontend/dist/govuk/components/header/header.bundle.mjs +89 -42
  146. data/node_modules/govuk-frontend/dist/govuk/components/header/header.bundle.mjs.map +1 -1
  147. data/node_modules/govuk-frontend/dist/govuk/components/header/header.mjs +10 -18
  148. data/node_modules/govuk-frontend/dist/govuk/components/header/header.mjs.map +1 -1
  149. data/node_modules/govuk-frontend/dist/govuk/components/header/macro-options.json +31 -12
  150. data/node_modules/govuk-frontend/dist/govuk/components/header/template-default.html +20 -12
  151. data/node_modules/govuk-frontend/dist/govuk/components/header/template-full-width-with-navigation.html +21 -15
  152. data/node_modules/govuk-frontend/dist/govuk/components/header/template-full-width.html +21 -15
  153. data/node_modules/govuk-frontend/dist/govuk/components/header/template-navigation-item-with-html.html +20 -12
  154. data/node_modules/govuk-frontend/dist/govuk/components/header/template-navigation-item-with-text-without-link.html +20 -12
  155. data/node_modules/govuk-frontend/dist/govuk/components/header/template-with-custom-menu-button-label.html +20 -12
  156. data/node_modules/govuk-frontend/dist/govuk/components/header/template-with-custom-menu-button-text.html +20 -12
  157. data/node_modules/govuk-frontend/dist/govuk/components/header/template-with-custom-navigation-label.html +20 -12
  158. data/node_modules/govuk-frontend/dist/govuk/components/header/template-with-full-width-border.html +30 -0
  159. data/node_modules/govuk-frontend/dist/govuk/components/header/template-with-large-navigation.html +20 -12
  160. data/node_modules/govuk-frontend/dist/govuk/components/header/template-with-navigation.html +20 -12
  161. data/node_modules/govuk-frontend/dist/govuk/components/header/template-with-product-name.html +21 -15
  162. data/node_modules/govuk-frontend/dist/govuk/components/header/template-with-service-name-and-navigation.html +20 -12
  163. data/node_modules/govuk-frontend/dist/govuk/components/header/template-with-service-name-but-no-service-url.html +20 -12
  164. data/node_modules/govuk-frontend/dist/govuk/components/header/template-with-service-name.html +20 -12
  165. data/node_modules/govuk-frontend/dist/govuk/components/header/template-with-st-edwards-crown.html +10 -12
  166. data/node_modules/govuk-frontend/dist/govuk/components/header/template.njk +11 -41
  167. data/node_modules/govuk-frontend/dist/govuk/components/hint/fixtures.json +6 -0
  168. data/node_modules/govuk-frontend/dist/govuk/components/input/_index.scss +7 -4
  169. data/node_modules/govuk-frontend/dist/govuk/components/input/_index.scss.map +1 -1
  170. data/node_modules/govuk-frontend/dist/govuk/components/input/fixtures.json +97 -27
  171. data/node_modules/govuk-frontend/dist/govuk/components/input/macro-options.json +6 -6
  172. data/node_modules/govuk-frontend/dist/govuk/components/input/template-default.html +2 -2
  173. data/node_modules/govuk-frontend/dist/govuk/components/input/template-disabled.html +6 -0
  174. data/node_modules/govuk-frontend/dist/govuk/components/input/template-with-error-and-hint.html +12 -0
  175. data/node_modules/govuk-frontend/dist/govuk/components/input/template-with-error-message.html +2 -5
  176. data/node_modules/govuk-frontend/dist/govuk/components/input/template.njk +5 -4
  177. data/node_modules/govuk-frontend/dist/govuk/components/inset-text/fixtures.json +6 -0
  178. data/node_modules/govuk-frontend/dist/govuk/components/label/fixtures.json +17 -0
  179. data/node_modules/govuk-frontend/dist/govuk/components/notification-banner/_index.scss +3 -2
  180. data/node_modules/govuk-frontend/dist/govuk/components/notification-banner/_index.scss.map +1 -1
  181. data/node_modules/govuk-frontend/dist/govuk/components/notification-banner/fixtures.json +24 -0
  182. data/node_modules/govuk-frontend/dist/govuk/components/notification-banner/notification-banner.bundle.js +238 -127
  183. data/node_modules/govuk-frontend/dist/govuk/components/notification-banner/notification-banner.bundle.js.map +1 -1
  184. data/node_modules/govuk-frontend/dist/govuk/components/notification-banner/notification-banner.bundle.mjs +237 -126
  185. data/node_modules/govuk-frontend/dist/govuk/components/notification-banner/notification-banner.bundle.mjs.map +1 -1
  186. data/node_modules/govuk-frontend/dist/govuk/components/notification-banner/notification-banner.mjs +10 -22
  187. data/node_modules/govuk-frontend/dist/govuk/components/notification-banner/notification-banner.mjs.map +1 -1
  188. data/node_modules/govuk-frontend/dist/govuk/components/pagination/_index.scss +24 -37
  189. data/node_modules/govuk-frontend/dist/govuk/components/pagination/_index.scss.map +1 -1
  190. data/node_modules/govuk-frontend/dist/govuk/components/pagination/fixtures.json +15 -0
  191. data/node_modules/govuk-frontend/dist/govuk/components/pagination/macro-options.json +4 -4
  192. data/node_modules/govuk-frontend/dist/govuk/components/panel/_index.scss +13 -9
  193. data/node_modules/govuk-frontend/dist/govuk/components/panel/_index.scss.map +1 -1
  194. data/node_modules/govuk-frontend/dist/govuk/components/panel/fixtures.json +9 -0
  195. data/node_modules/govuk-frontend/dist/govuk/components/password-input/_index.scss +12 -9
  196. data/node_modules/govuk-frontend/dist/govuk/components/password-input/_index.scss.map +1 -1
  197. data/node_modules/govuk-frontend/dist/govuk/components/password-input/fixtures.json +27 -2
  198. data/node_modules/govuk-frontend/dist/govuk/components/password-input/macro-options.json +3 -3
  199. data/node_modules/govuk-frontend/dist/govuk/components/password-input/password-input.bundle.js +220 -110
  200. data/node_modules/govuk-frontend/dist/govuk/components/password-input/password-input.bundle.js.map +1 -1
  201. data/node_modules/govuk-frontend/dist/govuk/components/password-input/password-input.bundle.mjs +219 -109
  202. data/node_modules/govuk-frontend/dist/govuk/components/password-input/password-input.bundle.mjs.map +1 -1
  203. data/node_modules/govuk-frontend/dist/govuk/components/password-input/password-input.mjs +12 -25
  204. data/node_modules/govuk-frontend/dist/govuk/components/password-input/password-input.mjs.map +1 -1
  205. data/node_modules/govuk-frontend/dist/govuk/components/password-input/template-default.html +3 -3
  206. data/node_modules/govuk-frontend/dist/govuk/components/password-input/template.njk +4 -2
  207. data/node_modules/govuk-frontend/dist/govuk/components/phase-banner/_index.scss +0 -8
  208. data/node_modules/govuk-frontend/dist/govuk/components/phase-banner/_index.scss.map +1 -1
  209. data/node_modules/govuk-frontend/dist/govuk/components/phase-banner/fixtures.json +7 -0
  210. data/node_modules/govuk-frontend/dist/govuk/components/radios/_index.scss +7 -5
  211. data/node_modules/govuk-frontend/dist/govuk/components/radios/_index.scss.map +1 -1
  212. data/node_modules/govuk-frontend/dist/govuk/components/radios/fixtures.json +51 -5
  213. data/node_modules/govuk-frontend/dist/govuk/components/radios/radios.bundle.js +96 -50
  214. data/node_modules/govuk-frontend/dist/govuk/components/radios/radios.bundle.js.map +1 -1
  215. data/node_modules/govuk-frontend/dist/govuk/components/radios/radios.bundle.mjs +95 -49
  216. data/node_modules/govuk-frontend/dist/govuk/components/radios/radios.bundle.mjs.map +1 -1
  217. data/node_modules/govuk-frontend/dist/govuk/components/radios/radios.mjs +9 -18
  218. data/node_modules/govuk-frontend/dist/govuk/components/radios/radios.mjs.map +1 -1
  219. data/node_modules/govuk-frontend/dist/govuk/components/radios/template-small-with-a-divider.html +1 -1
  220. data/node_modules/govuk-frontend/dist/govuk/components/radios/template-with-a-divider.html +1 -1
  221. data/node_modules/govuk-frontend/dist/govuk/components/select/_index.scss +5 -5
  222. data/node_modules/govuk-frontend/dist/govuk/components/select/_index.scss.map +1 -1
  223. data/node_modules/govuk-frontend/dist/govuk/components/select/fixtures.json +43 -9
  224. data/node_modules/govuk-frontend/dist/govuk/components/select/macro-options.json +2 -2
  225. data/node_modules/govuk-frontend/dist/govuk/components/select/template-id.html +7 -0
  226. data/node_modules/govuk-frontend/dist/govuk/components/select/template.njk +6 -4
  227. data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/README.md +15 -0
  228. data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/_index.scss +187 -0
  229. data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/_index.scss.map +1 -0
  230. data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/_service-navigation.scss +4 -0
  231. data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/_service-navigation.scss.map +1 -0
  232. data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/fixtures.json +515 -0
  233. data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/macro-options.json +138 -0
  234. data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/macro.njk +3 -0
  235. data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/service-navigation.bundle.js +229 -0
  236. data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/service-navigation.bundle.js.map +1 -0
  237. data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/service-navigation.bundle.mjs +221 -0
  238. data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/service-navigation.bundle.mjs.map +1 -0
  239. data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/service-navigation.mjs +85 -0
  240. data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/service-navigation.mjs.map +1 -0
  241. data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/template-default.html +57 -0
  242. data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/template-with-html-navigation-items.html +49 -0
  243. data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/template-with-large-navigation.html +153 -0
  244. data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/template-with-long-service-name.html +20 -0
  245. data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/template-with-navigation-with-a-current-item.html +58 -0
  246. data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/template-with-navigation-with-an-active-item.html +58 -0
  247. data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/template-with-non-link-navigation-items.html +49 -0
  248. data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/template-with-service-link.html +20 -0
  249. data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/template-with-service-name-and-navigation.html +63 -0
  250. data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/template-with-service-name.html +18 -0
  251. data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/template.njk +103 -0
  252. data/node_modules/govuk-frontend/dist/govuk/components/skip-link/_index.scss +6 -4
  253. data/node_modules/govuk-frontend/dist/govuk/components/skip-link/_index.scss.map +1 -1
  254. data/node_modules/govuk-frontend/dist/govuk/components/skip-link/fixtures.json +9 -0
  255. data/node_modules/govuk-frontend/dist/govuk/components/skip-link/skip-link.bundle.js +95 -48
  256. data/node_modules/govuk-frontend/dist/govuk/components/skip-link/skip-link.bundle.js.map +1 -1
  257. data/node_modules/govuk-frontend/dist/govuk/components/skip-link/skip-link.bundle.mjs +94 -47
  258. data/node_modules/govuk-frontend/dist/govuk/components/skip-link/skip-link.bundle.mjs.map +1 -1
  259. data/node_modules/govuk-frontend/dist/govuk/components/skip-link/skip-link.mjs +15 -23
  260. data/node_modules/govuk-frontend/dist/govuk/components/skip-link/skip-link.mjs.map +1 -1
  261. data/node_modules/govuk-frontend/dist/govuk/components/summary-list/_index.scss +14 -22
  262. data/node_modules/govuk-frontend/dist/govuk/components/summary-list/_index.scss.map +1 -1
  263. data/node_modules/govuk-frontend/dist/govuk/components/summary-list/fixtures.json +174 -1
  264. data/node_modules/govuk-frontend/dist/govuk/components/summary-list/template-as-a-summary-card-extreme.html +106 -0
  265. data/node_modules/govuk-frontend/dist/govuk/components/table/fixtures.json +22 -1
  266. data/node_modules/govuk-frontend/dist/govuk/components/tabs/fixtures.json +15 -1
  267. data/node_modules/govuk-frontend/dist/govuk/components/tabs/tabs.bundle.js +95 -53
  268. data/node_modules/govuk-frontend/dist/govuk/components/tabs/tabs.bundle.js.map +1 -1
  269. data/node_modules/govuk-frontend/dist/govuk/components/tabs/tabs.bundle.mjs +94 -52
  270. data/node_modules/govuk-frontend/dist/govuk/components/tabs/tabs.bundle.mjs.map +1 -1
  271. data/node_modules/govuk-frontend/dist/govuk/components/tabs/tabs.mjs +15 -28
  272. data/node_modules/govuk-frontend/dist/govuk/components/tabs/tabs.mjs.map +1 -1
  273. data/node_modules/govuk-frontend/dist/govuk/components/tag/_index.scss +11 -8
  274. data/node_modules/govuk-frontend/dist/govuk/components/tag/_index.scss.map +1 -1
  275. data/node_modules/govuk-frontend/dist/govuk/components/tag/fixtures.json +14 -0
  276. data/node_modules/govuk-frontend/dist/govuk/components/task-list/_index.scss +12 -10
  277. data/node_modules/govuk-frontend/dist/govuk/components/task-list/_index.scss.map +1 -1
  278. data/node_modules/govuk-frontend/dist/govuk/components/task-list/fixtures.json +44 -0
  279. data/node_modules/govuk-frontend/dist/govuk/components/task-list/template-with-empty-values.html +27 -0
  280. data/node_modules/govuk-frontend/dist/govuk/components/task-list/template.njk +1 -1
  281. data/node_modules/govuk-frontend/dist/govuk/components/textarea/_index.scss +3 -3
  282. data/node_modules/govuk-frontend/dist/govuk/components/textarea/_index.scss.map +1 -1
  283. data/node_modules/govuk-frontend/dist/govuk/components/textarea/fixtures.json +32 -1
  284. data/node_modules/govuk-frontend/dist/govuk/components/textarea/macro-options.json +3 -3
  285. data/node_modules/govuk-frontend/dist/govuk/components/textarea/template.njk +6 -4
  286. data/node_modules/govuk-frontend/dist/govuk/components/warning-text/_index.scss +6 -5
  287. data/node_modules/govuk-frontend/dist/govuk/components/warning-text/_index.scss.map +1 -1
  288. data/node_modules/govuk-frontend/dist/govuk/components/warning-text/fixtures.json +8 -0
  289. data/node_modules/govuk-frontend/dist/govuk/core/_govuk-frontend-properties.scss +1 -1
  290. data/node_modules/govuk-frontend/dist/govuk/core/_govuk-frontend-properties.scss.map +1 -1
  291. data/node_modules/govuk-frontend/dist/govuk/errors/index.mjs +16 -3
  292. data/node_modules/govuk-frontend/dist/govuk/errors/index.mjs.map +1 -1
  293. data/node_modules/govuk-frontend/dist/govuk/govuk-frontend.min.css +2 -2
  294. data/node_modules/govuk-frontend/dist/govuk/govuk-frontend.min.css.map +1 -1
  295. data/node_modules/govuk-frontend/dist/govuk/govuk-frontend.min.js +1 -1
  296. data/node_modules/govuk-frontend/dist/govuk/govuk-frontend.min.js.map +1 -1
  297. data/node_modules/govuk-frontend/dist/govuk/helpers/_colour.scss +55 -8
  298. data/node_modules/govuk-frontend/dist/govuk/helpers/_colour.scss.map +1 -1
  299. data/node_modules/govuk-frontend/dist/govuk/helpers/_focused.scss +14 -4
  300. data/node_modules/govuk-frontend/dist/govuk/helpers/_focused.scss.map +1 -1
  301. data/node_modules/govuk-frontend/dist/govuk/helpers/_grid.scss +1 -1
  302. data/node_modules/govuk-frontend/dist/govuk/helpers/_grid.scss.map +1 -1
  303. data/node_modules/govuk-frontend/dist/govuk/helpers/_links.scss +2 -2
  304. data/node_modules/govuk-frontend/dist/govuk/helpers/_links.scss.map +1 -1
  305. data/node_modules/govuk-frontend/dist/govuk/helpers/_shape-arrow.scss +1 -1
  306. data/node_modules/govuk-frontend/dist/govuk/helpers/_shape-arrow.scss.map +1 -1
  307. data/node_modules/govuk-frontend/dist/govuk/helpers/_typography.scss +18 -1
  308. data/node_modules/govuk-frontend/dist/govuk/helpers/_typography.scss.map +1 -1
  309. data/node_modules/govuk-frontend/dist/govuk/helpers/_visually-hidden.scss +30 -62
  310. data/node_modules/govuk-frontend/dist/govuk/helpers/_visually-hidden.scss.map +1 -1
  311. data/node_modules/govuk-frontend/dist/govuk/i18n.mjs.map +1 -1
  312. data/node_modules/govuk-frontend/dist/govuk/init.mjs +90 -24
  313. data/node_modules/govuk-frontend/dist/govuk/init.mjs.map +1 -1
  314. data/node_modules/govuk-frontend/dist/govuk/macros/logo.njk +78 -0
  315. data/node_modules/govuk-frontend/dist/govuk/objects/_template.scss +5 -1
  316. data/node_modules/govuk-frontend/dist/govuk/objects/_template.scss.map +1 -1
  317. data/node_modules/govuk-frontend/dist/govuk/overrides/_typography.scss +5 -1
  318. data/node_modules/govuk-frontend/dist/govuk/overrides/_typography.scss.map +1 -1
  319. data/node_modules/govuk-frontend/dist/govuk/settings/_colours-applied.scss +39 -1
  320. data/node_modules/govuk-frontend/dist/govuk/settings/_colours-applied.scss.map +1 -1
  321. data/node_modules/govuk-frontend/dist/govuk/settings/_colours-organisations.scss +244 -10
  322. data/node_modules/govuk-frontend/dist/govuk/settings/_colours-organisations.scss.map +1 -1
  323. data/node_modules/govuk-frontend/dist/govuk/settings/_typography-responsive.scss +5 -10
  324. data/node_modules/govuk-frontend/dist/govuk/settings/_typography-responsive.scss.map +1 -1
  325. data/node_modules/govuk-frontend/dist/govuk/template.njk +20 -9
  326. data/node_modules/govuk-frontend/dist/govuk/tools/_index.scss +1 -0
  327. data/node_modules/govuk-frontend/dist/govuk/tools/_index.scss.map +1 -1
  328. data/node_modules/govuk-frontend/dist/govuk/tools/_rebrand.scss +65 -0
  329. data/node_modules/govuk-frontend/dist/govuk/tools/_rebrand.scss.map +1 -0
  330. data/node_modules/govuk-frontend/dist/govuk-prototype-kit/functions.js +25 -0
  331. data/node_modules/govuk-frontend/dist/govuk-prototype-kit/init.scss +1 -1
  332. data/node_modules/govuk-frontend/dist/govuk-prototype-kit/init.scss.map +1 -1
  333. data/node_modules/govuk-frontend/govuk-prototype-kit.config.json +8 -1
  334. data/node_modules/govuk-frontend/package.json +16 -16
  335. data/spec/spec_helper.rb +98 -0
  336. data/spec/tasks/assets_spec.rb +53 -0
  337. data/vendor/assets/assets/fonts/bold-affa96571d-v2.woff +0 -0
  338. data/vendor/assets/assets/fonts/bold-b542beb274-v2.woff2 +0 -0
  339. data/vendor/assets/assets/fonts/light-94a07e06a1-v2.woff2 +0 -0
  340. data/vendor/assets/assets/fonts/light-f591b13f7d-v2.woff +0 -0
  341. data/vendor/assets/assets/images/favicon.ico +0 -0
  342. data/vendor/assets/assets/images/favicon.svg +1 -0
  343. data/vendor/assets/assets/images/govuk-crest.svg +1 -0
  344. data/vendor/assets/assets/images/govuk-icon-180.png +0 -0
  345. data/vendor/assets/assets/images/govuk-icon-192.png +0 -0
  346. data/vendor/assets/assets/images/govuk-icon-512.png +0 -0
  347. data/vendor/assets/assets/images/govuk-icon-mask.svg +1 -0
  348. data/vendor/assets/assets/images/govuk-opengraph-image.png +0 -0
  349. data/vendor/assets/assets/manifest.json +39 -0
  350. data/vendor/assets/assets/rebrand/images/favicon.ico +0 -0
  351. data/vendor/assets/assets/rebrand/images/favicon.svg +1 -0
  352. data/vendor/assets/assets/rebrand/images/govuk-crest.svg +1 -0
  353. data/vendor/assets/assets/rebrand/images/govuk-icon-180.png +0 -0
  354. data/vendor/assets/assets/rebrand/images/govuk-icon-192.png +0 -0
  355. data/vendor/assets/assets/rebrand/images/govuk-icon-512.png +0 -0
  356. data/vendor/assets/assets/rebrand/images/govuk-icon-mask.svg +1 -0
  357. data/vendor/assets/assets/rebrand/images/govuk-opengraph-image.png +0 -0
  358. data/vendor/assets/assets/rebrand/manifest.json +39 -0
  359. data/vendor/assets/images/govuk-crest.svg +1 -0
  360. data/vendor/assets/javascripts/defra_ruby_template.js +882 -492
  361. data/vendor/assets/stylesheets/all.scss +6 -0
  362. data/vendor/assets/stylesheets/components/_index.scss +1 -0
  363. data/vendor/assets/stylesheets/components/accordion/_index.scss +35 -31
  364. data/vendor/assets/stylesheets/components/character-count/_index.scss +12 -4
  365. data/vendor/assets/stylesheets/components/checkboxes/_index.scss +6 -1
  366. data/vendor/assets/stylesheets/components/cookie-banner/_index.scss +23 -14
  367. data/vendor/assets/stylesheets/components/date-input/_index.scss +2 -2
  368. data/vendor/assets/stylesheets/components/details/_index.scss +7 -2
  369. data/vendor/assets/stylesheets/components/error-summary/_index.scss +4 -0
  370. data/vendor/assets/stylesheets/components/fieldset/_index.scss +3 -5
  371. data/vendor/assets/stylesheets/components/file-upload/_index.scss +175 -9
  372. data/vendor/assets/stylesheets/components/footer/_index.scss +61 -19
  373. data/vendor/assets/stylesheets/components/header/_index.scss +223 -21
  374. data/vendor/assets/stylesheets/components/input/_index.scss +7 -4
  375. data/vendor/assets/stylesheets/components/notification-banner/_index.scss +3 -2
  376. data/vendor/assets/stylesheets/components/pagination/_index.scss +24 -37
  377. data/vendor/assets/stylesheets/components/panel/_index.scss +13 -9
  378. data/vendor/assets/stylesheets/components/password-input/_index.scss +12 -9
  379. data/vendor/assets/stylesheets/components/phase-banner/_index.scss +0 -8
  380. data/vendor/assets/stylesheets/components/radios/_index.scss +7 -5
  381. data/vendor/assets/stylesheets/components/select/_index.scss +5 -5
  382. data/vendor/assets/stylesheets/components/service-navigation/_index.scss +187 -0
  383. data/vendor/assets/stylesheets/components/service-navigation/_service-navigation.scss +4 -0
  384. data/vendor/assets/stylesheets/components/skip-link/_index.scss +6 -4
  385. data/vendor/assets/stylesheets/components/summary-list/_index.scss +14 -22
  386. data/vendor/assets/stylesheets/components/tag/_index.scss +11 -8
  387. data/vendor/assets/stylesheets/components/task-list/_index.scss +12 -10
  388. data/vendor/assets/stylesheets/components/textarea/_index.scss +3 -3
  389. data/vendor/assets/stylesheets/components/warning-text/_index.scss +6 -5
  390. data/vendor/assets/stylesheets/core/_govuk-frontend-properties.scss +1 -1
  391. data/vendor/assets/stylesheets/defra_ruby_template.scss +6 -0
  392. data/vendor/assets/stylesheets/govuk-frontend.min.css +2 -2
  393. data/vendor/assets/stylesheets/helpers/_colour.scss +55 -8
  394. data/vendor/assets/stylesheets/helpers/_focused.scss +14 -4
  395. data/vendor/assets/stylesheets/helpers/_grid.scss +1 -1
  396. data/vendor/assets/stylesheets/helpers/_links.scss +2 -2
  397. data/vendor/assets/stylesheets/helpers/_shape-arrow.scss +1 -1
  398. data/vendor/assets/stylesheets/helpers/_typography.scss +18 -1
  399. data/vendor/assets/stylesheets/helpers/_visually-hidden.scss +30 -62
  400. data/vendor/assets/stylesheets/objects/_template.scss +5 -1
  401. data/vendor/assets/stylesheets/overrides/_typography.scss +5 -1
  402. data/vendor/assets/stylesheets/settings/_colours-applied.scss +39 -1
  403. data/vendor/assets/stylesheets/settings/_colours-organisations.scss +244 -10
  404. data/vendor/assets/stylesheets/settings/_typography-responsive.scss +5 -10
  405. data/vendor/assets/stylesheets/tools/_index.scss +1 -0
  406. data/vendor/assets/stylesheets/tools/_rebrand.scss +65 -0
  407. metadata +100 -24
  408. data/.github/dependabot.yml +0 -14
  409. data/.github/workflows/ci.yml +0 -31
  410. data/.gitignore +0 -8
  411. data/.rspec +0 -1
  412. data/.rubocop.yml +0 -3
  413. data/.ruby-version +0 -1
  414. data/Gemfile +0 -9
  415. data/Gemfile.lock +0 -58
  416. data/defra_ruby_template.gemspec +0 -35
  417. data/node_modules/.package-lock.json +0 -16
  418. data/node_modules/govuk-frontend/dist/govuk/assets/images/govuk-crest-2x.png +0 -0
  419. data/node_modules/govuk-frontend/dist/govuk/assets/images/govuk-crest.png +0 -0
  420. data/node_modules/govuk-frontend/dist/govuk/common/normalise-dataset.mjs +0 -18
  421. data/node_modules/govuk-frontend/dist/govuk/common/normalise-dataset.mjs.map +0 -1
  422. data/node_modules/govuk-frontend/dist/govuk/common/normalise-string.mjs +0 -31
  423. data/node_modules/govuk-frontend/dist/govuk/common/normalise-string.mjs.map +0 -1
  424. data/node_modules/govuk-frontend/dist/govuk/components/file-upload/template-with-value.html +0 -6
  425. data/node_modules/govuk-frontend/dist/govuk/govuk-frontend-component.mjs +0 -16
  426. data/node_modules/govuk-frontend/dist/govuk/govuk-frontend-component.mjs.map +0 -1
  427. data/package-lock.json +0 -24
  428. data/package.json +0 -29
@@ -1 +1 @@
1
- {"version":3,"file":"character-count.mjs","sources":["../../../../src/govuk/components/character-count/character-count.mjs"],"sourcesContent":["import { closestAttributeValue } from '../../common/closest-attribute-value.mjs'\nimport { mergeConfigs, validateConfig } from '../../common/index.mjs'\nimport { normaliseDataset } from '../../common/normalise-dataset.mjs'\nimport { ConfigError, ElementError } from '../../errors/index.mjs'\nimport { GOVUKFrontendComponent } from '../../govuk-frontend-component.mjs'\nimport { I18n } from '../../i18n.mjs'\n\n/**\n * Character count component\n *\n * Tracks the number of characters or words in the `.govuk-js-character-count`\n * `<textarea>` inside the element. Displays a message with the remaining number\n * of characters/words available, or the number of characters/words in excess.\n *\n * You can configure the message to only appear after a certain percentage\n * of the available characters/words has been entered.\n *\n * @preserve\n */\nexport class CharacterCount extends GOVUKFrontendComponent {\n /** @private */\n $module\n\n /** @private */\n $textarea\n\n /** @private */\n $visibleCountMessage\n\n /** @private */\n $screenReaderCountMessage\n\n /**\n * @private\n * @type {number | null}\n */\n lastInputTimestamp = null\n\n /** @private */\n lastInputValue = ''\n\n /**\n * @private\n * @type {number | null}\n */\n valueChecker = null\n\n /**\n * @private\n * @type {CharacterCountConfig}\n */\n config\n\n /** @private */\n i18n\n\n /** @private */\n maxLength\n\n /**\n * @param {Element | null} $module - HTML element to use for character count\n * @param {CharacterCountConfig} [config] - Character count config\n */\n constructor($module, config = {}) {\n super()\n\n if (!($module instanceof HTMLElement)) {\n throw new ElementError({\n componentName: 'Character count',\n element: $module,\n identifier: 'Root element (`$module`)'\n })\n }\n\n const $textarea = $module.querySelector('.govuk-js-character-count')\n if (\n !(\n $textarea instanceof HTMLTextAreaElement ||\n $textarea instanceof HTMLInputElement\n )\n ) {\n throw new ElementError({\n componentName: 'Character count',\n element: $textarea,\n expectedType: 'HTMLTextareaElement or HTMLInputElement',\n identifier: 'Form field (`.govuk-js-character-count`)'\n })\n }\n\n // Read config set using dataset ('data-' values)\n const datasetConfig = normaliseDataset(CharacterCount, $module.dataset)\n\n // To ensure data-attributes take complete precedence, even if they change\n // the type of count, we need to reset the `maxlength` and `maxwords` from\n // the JavaScript config.\n //\n // We can't mutate `config`, though, as it may be shared across multiple\n // components inside `initAll`.\n /** @type {CharacterCountConfig} */\n let configOverrides = {}\n if ('maxwords' in datasetConfig || 'maxlength' in datasetConfig) {\n configOverrides = {\n maxlength: undefined,\n maxwords: undefined\n }\n }\n\n this.config = mergeConfigs(\n CharacterCount.defaults,\n config,\n configOverrides,\n datasetConfig\n )\n\n // Check for valid config\n const errors = validateConfig(CharacterCount.schema, this.config)\n if (errors[0]) {\n throw new ConfigError(`Character count: ${errors[0]}`)\n }\n\n this.i18n = new I18n(this.config.i18n, {\n // Read the fallback if necessary rather than have it set in the defaults\n locale: closestAttributeValue($module, 'lang')\n })\n\n // Determine the limit attribute (characters or words)\n this.maxLength = this.config.maxwords ?? this.config.maxlength ?? Infinity\n\n this.$module = $module\n this.$textarea = $textarea\n\n const textareaDescriptionId = `${this.$textarea.id}-info`\n const $textareaDescription = document.getElementById(textareaDescriptionId)\n if (!$textareaDescription) {\n throw new ElementError({\n componentName: 'Character count',\n element: $textareaDescription,\n identifier: `Count message (\\`id=\"${textareaDescriptionId}\"\\`)`\n })\n }\n\n // Inject a description for the textarea if none is present already\n // for when the component was rendered with no maxlength, maxwords\n // nor custom textareaDescriptionText\n if (`${$textareaDescription.textContent}`.match(/^\\s*$/)) {\n $textareaDescription.textContent = this.i18n.t('textareaDescription', {\n count: this.maxLength\n })\n }\n\n // Move the textarea description to be immediately after the textarea\n // Kept for backwards compatibility\n this.$textarea.insertAdjacentElement('afterend', $textareaDescription)\n\n // Create the *screen reader* specific live-updating counter\n // This doesn't need any styling classes, as it is never visible\n const $screenReaderCountMessage = document.createElement('div')\n $screenReaderCountMessage.className =\n 'govuk-character-count__sr-status govuk-visually-hidden'\n $screenReaderCountMessage.setAttribute('aria-live', 'polite')\n this.$screenReaderCountMessage = $screenReaderCountMessage\n $textareaDescription.insertAdjacentElement(\n 'afterend',\n $screenReaderCountMessage\n )\n\n // Create our live-updating counter element, copying the classes from the\n // textarea description for backwards compatibility as these may have been\n // configured\n const $visibleCountMessage = document.createElement('div')\n $visibleCountMessage.className = $textareaDescription.className\n $visibleCountMessage.classList.add('govuk-character-count__status')\n $visibleCountMessage.setAttribute('aria-hidden', 'true')\n this.$visibleCountMessage = $visibleCountMessage\n $textareaDescription.insertAdjacentElement('afterend', $visibleCountMessage)\n\n // Hide the textarea description\n $textareaDescription.classList.add('govuk-visually-hidden')\n\n // Remove hard limit if set\n this.$textarea.removeAttribute('maxlength')\n\n this.bindChangeEvents()\n\n // When the page is restored after navigating 'back' in some browsers the\n // state of form controls is not restored until *after* the DOMContentLoaded\n // event is fired, so we need to sync after the pageshow event.\n window.addEventListener('pageshow', () => this.updateCountMessage())\n\n // Although we've set up handlers to sync state on the pageshow event, init\n // could be called after those events have fired, for example if they are\n // added to the page dynamically, so update now too.\n this.updateCountMessage()\n }\n\n /**\n * Bind change events\n *\n * Set up event listeners on the $textarea so that the count messages update\n * when the user types.\n *\n * @private\n */\n bindChangeEvents() {\n this.$textarea.addEventListener('keyup', () => this.handleKeyUp())\n\n // Bind focus/blur events to start/stop polling\n this.$textarea.addEventListener('focus', () => this.handleFocus())\n this.$textarea.addEventListener('blur', () => this.handleBlur())\n }\n\n /**\n * Handle key up event\n *\n * Update the visible character counter and keep track of when the last update\n * happened for each keypress\n *\n * @private\n */\n handleKeyUp() {\n this.updateVisibleCountMessage()\n this.lastInputTimestamp = Date.now()\n }\n\n /**\n * Handle focus event\n *\n * Speech recognition software such as Dragon NaturallySpeaking will modify\n * the fields by directly changing its `value`. These changes don't trigger\n * events in JavaScript, so we need to poll to handle when and if they occur.\n *\n * Once the keyup event hasn't been detected for at least 1000 ms (1s), check\n * if the textarea value has changed and update the count message if it has.\n *\n * This is so that the update triggered by the manual comparison doesn't\n * conflict with debounced KeyboardEvent updates.\n *\n * @private\n */\n handleFocus() {\n this.valueChecker = window.setInterval(() => {\n if (\n !this.lastInputTimestamp ||\n Date.now() - 500 >= this.lastInputTimestamp\n ) {\n this.updateIfValueChanged()\n }\n }, 1000)\n }\n\n /**\n * Handle blur event\n *\n * Stop checking the textarea value once the textarea no longer has focus\n *\n * @private\n */\n handleBlur() {\n // Cancel value checking on blur\n if (this.valueChecker) {\n window.clearInterval(this.valueChecker)\n }\n }\n\n /**\n * Update count message if textarea value has changed\n *\n * @private\n */\n updateIfValueChanged() {\n if (this.$textarea.value !== this.lastInputValue) {\n this.lastInputValue = this.$textarea.value\n this.updateCountMessage()\n }\n }\n\n /**\n * Update count message\n *\n * Helper function to update both the visible and screen reader-specific\n * counters simultaneously (e.g. on init)\n *\n * @private\n */\n updateCountMessage() {\n this.updateVisibleCountMessage()\n this.updateScreenReaderCountMessage()\n }\n\n /**\n * Update visible count message\n *\n * @private\n */\n updateVisibleCountMessage() {\n const remainingNumber = this.maxLength - this.count(this.$textarea.value)\n const isError = remainingNumber < 0\n\n // If input is over the threshold, remove the disabled class which renders\n // the counter invisible.\n this.$visibleCountMessage.classList.toggle(\n 'govuk-character-count__message--disabled',\n !this.isOverThreshold()\n )\n\n // Update styles\n this.$textarea.classList.toggle('govuk-textarea--error', isError)\n this.$visibleCountMessage.classList.toggle('govuk-error-message', isError)\n this.$visibleCountMessage.classList.toggle('govuk-hint', !isError)\n\n // Update message\n this.$visibleCountMessage.textContent = this.getCountMessage()\n }\n\n /**\n * Update screen reader count message\n *\n * @private\n */\n updateScreenReaderCountMessage() {\n // If over the threshold, remove the aria-hidden attribute, allowing screen\n // readers to announce the content of the element.\n if (this.isOverThreshold()) {\n this.$screenReaderCountMessage.removeAttribute('aria-hidden')\n } else {\n this.$screenReaderCountMessage.setAttribute('aria-hidden', 'true')\n }\n\n // Update message\n this.$screenReaderCountMessage.textContent = this.getCountMessage()\n }\n\n /**\n * Count the number of characters (or words, if `config.maxwords` is set)\n * in the given text\n *\n * @private\n * @param {string} text - The text to count the characters of\n * @returns {number} the number of characters (or words) in the text\n */\n count(text) {\n if (this.config.maxwords) {\n const tokens = text.match(/\\S+/g) ?? [] // Matches consecutive non-whitespace chars\n return tokens.length\n }\n\n return text.length\n }\n\n /**\n * Get count message\n *\n * @private\n * @returns {string} Status message\n */\n getCountMessage() {\n const remainingNumber = this.maxLength - this.count(this.$textarea.value)\n const countType = this.config.maxwords ? 'words' : 'characters'\n return this.formatCountMessage(remainingNumber, countType)\n }\n\n /**\n * Formats the message shown to users according to what's counted\n * and how many remain\n *\n * @private\n * @param {number} remainingNumber - The number of words/characaters remaining\n * @param {string} countType - \"words\" or \"characters\"\n * @returns {string} Status message\n */\n formatCountMessage(remainingNumber, countType) {\n if (remainingNumber === 0) {\n return this.i18n.t(`${countType}AtLimit`)\n }\n\n const translationKeySuffix =\n remainingNumber < 0 ? 'OverLimit' : 'UnderLimit'\n\n return this.i18n.t(`${countType}${translationKeySuffix}`, {\n count: Math.abs(remainingNumber)\n })\n }\n\n /**\n * Check if count is over threshold\n *\n * Checks whether the value is over the configured threshold for the input.\n * If there is no configured threshold, it is set to 0 and this function will\n * always return true.\n *\n * @private\n * @returns {boolean} true if the current count is over the config.threshold\n * (or no threshold is set)\n */\n isOverThreshold() {\n // No threshold means we're always above threshold so save some computation\n if (!this.config.threshold) {\n return true\n }\n\n // Determine the remaining number of characters/words\n const currentLength = this.count(this.$textarea.value)\n const maxLength = this.maxLength\n\n const thresholdValue = (maxLength * this.config.threshold) / 100\n\n return thresholdValue <= currentLength\n }\n\n /**\n * Name for the component used when initialising using data-module attributes.\n */\n static moduleName = 'govuk-character-count'\n\n /**\n * Character count default config\n *\n * @see {@link CharacterCountConfig}\n * @constant\n * @type {CharacterCountConfig}\n */\n static defaults = Object.freeze({\n threshold: 0,\n i18n: {\n // Characters\n charactersUnderLimit: {\n one: 'You have %{count} character remaining',\n other: 'You have %{count} characters remaining'\n },\n charactersAtLimit: 'You have 0 characters remaining',\n charactersOverLimit: {\n one: 'You have %{count} character too many',\n other: 'You have %{count} characters too many'\n },\n // Words\n wordsUnderLimit: {\n one: 'You have %{count} word remaining',\n other: 'You have %{count} words remaining'\n },\n wordsAtLimit: 'You have 0 words remaining',\n wordsOverLimit: {\n one: 'You have %{count} word too many',\n other: 'You have %{count} words too many'\n },\n textareaDescription: {\n other: ''\n }\n }\n })\n\n /**\n * Character count config schema\n *\n * @constant\n * @satisfies {Schema}\n */\n static schema = Object.freeze({\n properties: {\n i18n: { type: 'object' },\n maxwords: { type: 'number' },\n maxlength: { type: 'number' },\n threshold: { type: 'number' }\n },\n anyOf: [\n {\n required: ['maxwords'],\n errorMessage: 'Either \"maxlength\" or \"maxwords\" must be provided'\n },\n {\n required: ['maxlength'],\n errorMessage: 'Either \"maxlength\" or \"maxwords\" must be provided'\n }\n ]\n })\n}\n\n/**\n * Character count config\n *\n * @see {@link CharacterCount.defaults}\n * @typedef {object} CharacterCountConfig\n * @property {number} [maxlength] - The maximum number of characters.\n * If maxwords is provided, the maxlength option will be ignored.\n * @property {number} [maxwords] - The maximum number of words. If maxwords is\n * provided, the maxlength option will be ignored.\n * @property {number} [threshold=0] - The percentage value of the limit at\n * which point the count message is displayed. If this attribute is set, the\n * count message will be hidden by default.\n * @property {CharacterCountTranslations} [i18n=CharacterCount.defaults.i18n] - Character count translations\n */\n\n/**\n * Character count translations\n *\n * @see {@link CharacterCount.defaults.i18n}\n * @typedef {object} CharacterCountTranslations\n *\n * Messages shown to users as they type. It provides feedback on how many words\n * or characters they have remaining or if they are over the limit. This also\n * includes a message used as an accessible description for the textarea.\n * @property {TranslationPluralForms} [charactersUnderLimit] - Message displayed\n * when the number of characters is under the configured maximum, `maxlength`.\n * This message is displayed visually and through assistive technologies. The\n * component will replace the `%{count}` placeholder with the number of\n * remaining characters. This is a [pluralised list of\n * messages](https://frontend.design-system.service.gov.uk/localise-govuk-frontend).\n * @property {string} [charactersAtLimit] - Message displayed when the number of\n * characters reaches the configured maximum, `maxlength`. This message is\n * displayed visually and through assistive technologies.\n * @property {TranslationPluralForms} [charactersOverLimit] - Message displayed\n * when the number of characters is over the configured maximum, `maxlength`.\n * This message is displayed visually and through assistive technologies. The\n * component will replace the `%{count}` placeholder with the number of\n * remaining characters. This is a [pluralised list of\n * messages](https://frontend.design-system.service.gov.uk/localise-govuk-frontend).\n * @property {TranslationPluralForms} [wordsUnderLimit] - Message displayed when\n * the number of words is under the configured maximum, `maxlength`. This\n * message is displayed visually and through assistive technologies. The\n * component will replace the `%{count}` placeholder with the number of\n * remaining words. This is a [pluralised list of\n * messages](https://frontend.design-system.service.gov.uk/localise-govuk-frontend).\n * @property {string} [wordsAtLimit] - Message displayed when the number of\n * words reaches the configured maximum, `maxlength`. This message is\n * displayed visually and through assistive technologies.\n * @property {TranslationPluralForms} [wordsOverLimit] - Message displayed when\n * the number of words is over the configured maximum, `maxlength`. This\n * message is displayed visually and through assistive technologies. The\n * component will replace the `%{count}` placeholder with the number of\n * remaining words. This is a [pluralised list of\n * messages](https://frontend.design-system.service.gov.uk/localise-govuk-frontend).\n * @property {TranslationPluralForms} [textareaDescription] - Message made\n * available to assistive technologies, if none is already present in the\n * HTML, to describe that the component accepts only a limited amount of\n * content. It is visible on the page when JavaScript is unavailable. The\n * component will replace the `%{count}` placeholder with the value of the\n * `maxlength` or `maxwords` parameter.\n */\n\n/**\n * @typedef {import('../../common/index.mjs').Schema} Schema\n * @typedef {import('../../i18n.mjs').TranslationPluralForms} TranslationPluralForms\n */\n"],"names":["CharacterCount","GOVUKFrontendComponent","constructor","$module","config","_ref","_this$config$maxwords","$textarea","$visibleCountMessage","$screenReaderCountMessage","lastInputTimestamp","lastInputValue","valueChecker","i18n","maxLength","HTMLElement","ElementError","componentName","element","identifier","querySelector","HTMLTextAreaElement","HTMLInputElement","expectedType","datasetConfig","normaliseDataset","dataset","configOverrides","maxlength","undefined","maxwords","mergeConfigs","defaults","errors","validateConfig","schema","ConfigError","I18n","locale","closestAttributeValue","Infinity","textareaDescriptionId","id","$textareaDescription","document","getElementById","textContent","match","t","count","insertAdjacentElement","createElement","className","setAttribute","classList","add","removeAttribute","bindChangeEvents","window","addEventListener","updateCountMessage","handleKeyUp","handleFocus","handleBlur","updateVisibleCountMessage","Date","now","setInterval","updateIfValueChanged","clearInterval","value","updateScreenReaderCountMessage","remainingNumber","isError","toggle","isOverThreshold","getCountMessage","text","_text$match","tokens","length","countType","formatCountMessage","translationKeySuffix","Math","abs","threshold","currentLength","thresholdValue","moduleName","Object","freeze","charactersUnderLimit","one","other","charactersAtLimit","charactersOverLimit","wordsUnderLimit","wordsAtLimit","wordsOverLimit","textareaDescription","properties","type","anyOf","required","errorMessage"],"mappings":";;;;;;;AAOA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMA,cAAc,SAASC,sBAAsB,CAAC;AAwCzD;AACF;AACA;AACA;AACEC,EAAAA,WAAWA,CAACC,OAAO,EAAEC,MAAM,GAAG,EAAE,EAAE;IAAA,IAAAC,IAAA,EAAAC,qBAAA,CAAA;AAChC,IAAA,KAAK,EAAE,CAAA;AAAA,IAAA,IAAA,CA3CTH,OAAO,GAAA,KAAA,CAAA,CAAA;AAAA,IAAA,IAAA,CAGPI,SAAS,GAAA,KAAA,CAAA,CAAA;AAAA,IAAA,IAAA,CAGTC,oBAAoB,GAAA,KAAA,CAAA,CAAA;AAAA,IAAA,IAAA,CAGpBC,yBAAyB,GAAA,KAAA,CAAA,CAAA;IAAA,IAMzBC,CAAAA,kBAAkB,GAAG,IAAI,CAAA;IAAA,IAGzBC,CAAAA,cAAc,GAAG,EAAE,CAAA;IAAA,IAMnBC,CAAAA,YAAY,GAAG,IAAI,CAAA;AAAA,IAAA,IAAA,CAMnBR,MAAM,GAAA,KAAA,CAAA,CAAA;AAAA,IAAA,IAAA,CAGNS,IAAI,GAAA,KAAA,CAAA,CAAA;AAAA,IAAA,IAAA,CAGJC,SAAS,GAAA,KAAA,CAAA,CAAA;AASP,IAAA,IAAI,EAAEX,OAAO,YAAYY,WAAW,CAAC,EAAE;MACrC,MAAM,IAAIC,YAAY,CAAC;AACrBC,QAAAA,aAAa,EAAE,iBAAiB;AAChCC,QAAAA,OAAO,EAAEf,OAAO;AAChBgB,QAAAA,UAAU,EAAE,0BAAA;AACd,OAAC,CAAC,CAAA;AACJ,KAAA;AAEA,IAAA,MAAMZ,SAAS,GAAGJ,OAAO,CAACiB,aAAa,CAAC,2BAA2B,CAAC,CAAA;IACpE,IACE,EACEb,SAAS,YAAYc,mBAAmB,IACxCd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EwE,MAAAA,IAAI,EAAE,QAAA;KAAU;AAC5B1E,IAAAA,SAAS,EAAE;AAAE0E,MAAAA,IAAI,EAAE,QAAA;KAAU;AAC7BhB,IAAAA,SAAS,EAAE;AAAEgB,MAAAA,IAAI,EAAE,QAAA;AAAS,KAAA;GAC7B;AACDC,EAAAA,KAAK,EAAE,CACL;IACEC,QAAQ,EAAE,CAAC,UAAU,CAAC;AACtBC,IAAAA,YAAY,EAAE,mDAAA;AAChB,GAAC,EACD;IACED,QAAQ,EAAE,CAAC,WAAW,CAAC;AACvBC,IAAAA,YAAY,EAAE,mDAAA;GACf,CAAA;AAEL,CAAC,CAAC;;;;"}
1
+ {"version":3,"file":"character-count.mjs","sources":["../../../../src/govuk/components/character-count/character-count.mjs"],"sourcesContent":["import { closestAttributeValue } from '../../common/closest-attribute-value.mjs'\nimport {\n validateConfig,\n ConfigurableComponent,\n configOverride\n} from '../../common/configuration.mjs'\nimport { formatErrorMessage } from '../../common/index.mjs'\nimport { ConfigError, ElementError } from '../../errors/index.mjs'\nimport { I18n } from '../../i18n.mjs'\n\n/**\n * Character count component\n *\n * Tracks the number of characters or words in the `.govuk-js-character-count`\n * `<textarea>` inside the element. Displays a message with the remaining number\n * of characters/words available, or the number of characters/words in excess.\n *\n * You can configure the message to only appear after a certain percentage\n * of the available characters/words has been entered.\n *\n * @preserve\n * @augments ConfigurableComponent<CharacterCountConfig>\n */\nexport class CharacterCount extends ConfigurableComponent {\n /** @private */\n $textarea\n\n /** @private */\n $visibleCountMessage\n\n /** @private */\n $screenReaderCountMessage\n\n /**\n * @private\n * @type {number | null}\n */\n lastInputTimestamp = null\n\n /** @private */\n lastInputValue = ''\n\n /**\n * @private\n * @type {number | null}\n */\n valueChecker = null\n\n /** @private */\n i18n\n\n /** @private */\n maxLength;\n\n /**\n * Character count config override\n *\n * To ensure data-attributes take complete precedence, even if they change\n * the type of count, we need to reset the `maxlength` and `maxwords` from\n * the JavaScript config.\n *\n * @internal\n * @param {CharacterCountConfig} datasetConfig - configuration specified by dataset\n * @returns {CharacterCountConfig} - configuration to override by dataset\n */\n [configOverride](datasetConfig) {\n let configOverrides = {}\n if ('maxwords' in datasetConfig || 'maxlength' in datasetConfig) {\n configOverrides = {\n maxlength: undefined,\n maxwords: undefined\n }\n }\n\n return configOverrides\n }\n\n /**\n * @param {Element | null} $root - HTML element to use for character count\n * @param {CharacterCountConfig} [config] - Character count config\n */\n constructor($root, config = {}) {\n super($root, config)\n\n const $textarea = this.$root.querySelector('.govuk-js-character-count')\n if (\n !(\n $textarea instanceof HTMLTextAreaElement ||\n $textarea instanceof HTMLInputElement\n )\n ) {\n throw new ElementError({\n component: CharacterCount,\n element: $textarea,\n expectedType: 'HTMLTextareaElement or HTMLInputElement',\n identifier: 'Form field (`.govuk-js-character-count`)'\n })\n }\n\n // Check for valid config\n const errors = validateConfig(CharacterCount.schema, this.config)\n if (errors[0]) {\n throw new ConfigError(formatErrorMessage(CharacterCount, errors[0]))\n }\n\n this.i18n = new I18n(this.config.i18n, {\n // Read the fallback if necessary rather than have it set in the defaults\n locale: closestAttributeValue(this.$root, 'lang')\n })\n\n // Determine the limit attribute (characters or words)\n this.maxLength = this.config.maxwords ?? this.config.maxlength ?? Infinity\n\n this.$textarea = $textarea\n\n const textareaDescriptionId = `${this.$textarea.id}-info`\n const $textareaDescription = document.getElementById(textareaDescriptionId)\n if (!$textareaDescription) {\n throw new ElementError({\n component: CharacterCount,\n element: $textareaDescription,\n identifier: `Count message (\\`id=\"${textareaDescriptionId}\"\\`)`\n })\n }\n\n // Pre-existing validation error rendered from server\n this.$errorMessage = this.$root.querySelector('.govuk-error-message')\n\n // Inject a description for the textarea if none is present already\n // for when the component was rendered with no maxlength, maxwords\n // nor custom textareaDescriptionText\n if (`${$textareaDescription.textContent}`.match(/^\\s*$/)) {\n $textareaDescription.textContent = this.i18n.t('textareaDescription', {\n count: this.maxLength\n })\n }\n\n // Move the textarea description to be immediately after the textarea\n // Kept for backwards compatibility\n this.$textarea.insertAdjacentElement('afterend', $textareaDescription)\n\n // Create the *screen reader* specific live-updating counter\n // This doesn't need any styling classes, as it is never visible\n const $screenReaderCountMessage = document.createElement('div')\n $screenReaderCountMessage.className =\n 'govuk-character-count__sr-status govuk-visually-hidden'\n $screenReaderCountMessage.setAttribute('aria-live', 'polite')\n this.$screenReaderCountMessage = $screenReaderCountMessage\n $textareaDescription.insertAdjacentElement(\n 'afterend',\n $screenReaderCountMessage\n )\n\n // Create our live-updating counter element, copying the classes from the\n // textarea description for backwards compatibility as these may have been\n // configured\n const $visibleCountMessage = document.createElement('div')\n $visibleCountMessage.className = $textareaDescription.className\n $visibleCountMessage.classList.add('govuk-character-count__status')\n $visibleCountMessage.setAttribute('aria-hidden', 'true')\n this.$visibleCountMessage = $visibleCountMessage\n $textareaDescription.insertAdjacentElement('afterend', $visibleCountMessage)\n\n // Hide the textarea description\n $textareaDescription.classList.add('govuk-visually-hidden')\n\n // Remove hard limit if set\n this.$textarea.removeAttribute('maxlength')\n\n this.bindChangeEvents()\n\n // When the page is restored after navigating 'back' in some browsers the\n // state of form controls is not restored until *after* the DOMContentLoaded\n // event is fired, so we need to sync after the pageshow event.\n window.addEventListener('pageshow', () => this.updateCountMessage())\n\n // Although we've set up handlers to sync state on the pageshow event, init\n // could be called after those events have fired, for example if they are\n // added to the page dynamically, so update now too.\n this.updateCountMessage()\n }\n\n /**\n * Bind change events\n *\n * Set up event listeners on the $textarea so that the count messages update\n * when the user types.\n *\n * @private\n */\n bindChangeEvents() {\n this.$textarea.addEventListener('keyup', () => this.handleKeyUp())\n\n // Bind focus/blur events to start/stop polling\n this.$textarea.addEventListener('focus', () => this.handleFocus())\n this.$textarea.addEventListener('blur', () => this.handleBlur())\n }\n\n /**\n * Handle key up event\n *\n * Update the visible character counter and keep track of when the last update\n * happened for each keypress\n *\n * @private\n */\n handleKeyUp() {\n this.updateVisibleCountMessage()\n this.lastInputTimestamp = Date.now()\n }\n\n /**\n * Handle focus event\n *\n * Speech recognition software such as Dragon NaturallySpeaking will modify\n * the fields by directly changing its `value`. These changes don't trigger\n * events in JavaScript, so we need to poll to handle when and if they occur.\n *\n * Once the keyup event hasn't been detected for at least 1000 ms (1s), check\n * if the textarea value has changed and update the count message if it has.\n *\n * This is so that the update triggered by the manual comparison doesn't\n * conflict with debounced KeyboardEvent updates.\n *\n * @private\n */\n handleFocus() {\n this.valueChecker = window.setInterval(() => {\n if (\n !this.lastInputTimestamp ||\n Date.now() - 500 >= this.lastInputTimestamp\n ) {\n this.updateIfValueChanged()\n }\n }, 1000)\n }\n\n /**\n * Handle blur event\n *\n * Stop checking the textarea value once the textarea no longer has focus\n *\n * @private\n */\n handleBlur() {\n // Cancel value checking on blur\n if (this.valueChecker) {\n window.clearInterval(this.valueChecker)\n }\n }\n\n /**\n * Update count message if textarea value has changed\n *\n * @private\n */\n updateIfValueChanged() {\n if (this.$textarea.value !== this.lastInputValue) {\n this.lastInputValue = this.$textarea.value\n this.updateCountMessage()\n }\n }\n\n /**\n * Update count message\n *\n * Helper function to update both the visible and screen reader-specific\n * counters simultaneously (e.g. on init)\n *\n * @private\n */\n updateCountMessage() {\n this.updateVisibleCountMessage()\n this.updateScreenReaderCountMessage()\n }\n\n /**\n * Update visible count message\n *\n * @private\n */\n updateVisibleCountMessage() {\n const remainingNumber = this.maxLength - this.count(this.$textarea.value)\n const isError = remainingNumber < 0\n\n // If input is over the threshold, remove the disabled class which renders\n // the counter invisible.\n this.$visibleCountMessage.classList.toggle(\n 'govuk-character-count__message--disabled',\n !this.isOverThreshold()\n )\n\n // Update styles\n if (!this.$errorMessage) {\n // Only toggle the textarea error class if there isn't an error message\n // already, as it may be unrelated to the limit (eg: allowed characters)\n // and would set the border colour back to black.\n this.$textarea.classList.toggle('govuk-textarea--error', isError)\n }\n this.$visibleCountMessage.classList.toggle('govuk-error-message', isError)\n this.$visibleCountMessage.classList.toggle('govuk-hint', !isError)\n\n // Update message\n this.$visibleCountMessage.textContent = this.getCountMessage()\n }\n\n /**\n * Update screen reader count message\n *\n * @private\n */\n updateScreenReaderCountMessage() {\n // If over the threshold, remove the aria-hidden attribute, allowing screen\n // readers to announce the content of the element.\n if (this.isOverThreshold()) {\n this.$screenReaderCountMessage.removeAttribute('aria-hidden')\n } else {\n this.$screenReaderCountMessage.setAttribute('aria-hidden', 'true')\n }\n\n // Update message\n this.$screenReaderCountMessage.textContent = this.getCountMessage()\n }\n\n /**\n * Count the number of characters (or words, if `config.maxwords` is set)\n * in the given text\n *\n * @private\n * @param {string} text - The text to count the characters of\n * @returns {number} the number of characters (or words) in the text\n */\n count(text) {\n if (this.config.maxwords) {\n const tokens = text.match(/\\S+/g) ?? [] // Matches consecutive non-whitespace chars\n return tokens.length\n }\n\n return text.length\n }\n\n /**\n * Get count message\n *\n * @private\n * @returns {string} Status message\n */\n getCountMessage() {\n const remainingNumber = this.maxLength - this.count(this.$textarea.value)\n const countType = this.config.maxwords ? 'words' : 'characters'\n return this.formatCountMessage(remainingNumber, countType)\n }\n\n /**\n * Formats the message shown to users according to what's counted\n * and how many remain\n *\n * @private\n * @param {number} remainingNumber - The number of words/characaters remaining\n * @param {string} countType - \"words\" or \"characters\"\n * @returns {string} Status message\n */\n formatCountMessage(remainingNumber, countType) {\n if (remainingNumber === 0) {\n return this.i18n.t(`${countType}AtLimit`)\n }\n\n const translationKeySuffix =\n remainingNumber < 0 ? 'OverLimit' : 'UnderLimit'\n\n return this.i18n.t(`${countType}${translationKeySuffix}`, {\n count: Math.abs(remainingNumber)\n })\n }\n\n /**\n * Check if count is over threshold\n *\n * Checks whether the value is over the configured threshold for the input.\n * If there is no configured threshold, it is set to 0 and this function will\n * always return true.\n *\n * @private\n * @returns {boolean} true if the current count is over the config.threshold\n * (or no threshold is set)\n */\n isOverThreshold() {\n // No threshold means we're always above threshold so save some computation\n if (!this.config.threshold) {\n return true\n }\n\n // Determine the remaining number of characters/words\n const currentLength = this.count(this.$textarea.value)\n const maxLength = this.maxLength\n\n const thresholdValue = (maxLength * this.config.threshold) / 100\n\n return thresholdValue <= currentLength\n }\n\n /**\n * Name for the component used when initialising using data-module attributes.\n */\n static moduleName = 'govuk-character-count'\n\n /**\n * Character count default config\n *\n * @see {@link CharacterCountConfig}\n * @constant\n * @type {CharacterCountConfig}\n */\n static defaults = Object.freeze({\n threshold: 0,\n i18n: {\n // Characters\n charactersUnderLimit: {\n one: 'You have %{count} character remaining',\n other: 'You have %{count} characters remaining'\n },\n charactersAtLimit: 'You have 0 characters remaining',\n charactersOverLimit: {\n one: 'You have %{count} character too many',\n other: 'You have %{count} characters too many'\n },\n // Words\n wordsUnderLimit: {\n one: 'You have %{count} word remaining',\n other: 'You have %{count} words remaining'\n },\n wordsAtLimit: 'You have 0 words remaining',\n wordsOverLimit: {\n one: 'You have %{count} word too many',\n other: 'You have %{count} words too many'\n },\n textareaDescription: {\n other: ''\n }\n }\n })\n\n /**\n * Character count config schema\n *\n * @constant\n * @satisfies {Schema<CharacterCountConfig>}\n */\n static schema = Object.freeze({\n properties: {\n i18n: { type: 'object' },\n maxwords: { type: 'number' },\n maxlength: { type: 'number' },\n threshold: { type: 'number' }\n },\n anyOf: [\n {\n required: ['maxwords'],\n errorMessage: 'Either \"maxlength\" or \"maxwords\" must be provided'\n },\n {\n required: ['maxlength'],\n errorMessage: 'Either \"maxlength\" or \"maxwords\" must be provided'\n }\n ]\n })\n}\n\n/**\n * Character count config\n *\n * @see {@link CharacterCount.defaults}\n * @typedef {object} CharacterCountConfig\n * @property {number} [maxlength] - The maximum number of characters.\n * If maxwords is provided, the maxlength option will be ignored.\n * @property {number} [maxwords] - The maximum number of words. If maxwords is\n * provided, the maxlength option will be ignored.\n * @property {number} [threshold=0] - The percentage value of the limit at\n * which point the count message is displayed. If this attribute is set, the\n * count message will be hidden by default.\n * @property {CharacterCountTranslations} [i18n=CharacterCount.defaults.i18n] - Character count translations\n */\n\n/**\n * Character count translations\n *\n * @see {@link CharacterCount.defaults.i18n}\n * @typedef {object} CharacterCountTranslations\n *\n * Messages shown to users as they type. It provides feedback on how many words\n * or characters they have remaining or if they are over the limit. This also\n * includes a message used as an accessible description for the textarea.\n * @property {TranslationPluralForms} [charactersUnderLimit] - Message displayed\n * when the number of characters is under the configured maximum, `maxlength`.\n * This message is displayed visually and through assistive technologies. The\n * component will replace the `%{count}` placeholder with the number of\n * remaining characters. This is a [pluralised list of\n * messages](https://frontend.design-system.service.gov.uk/localise-govuk-frontend).\n * @property {string} [charactersAtLimit] - Message displayed when the number of\n * characters reaches the configured maximum, `maxlength`. This message is\n * displayed visually and through assistive technologies.\n * @property {TranslationPluralForms} [charactersOverLimit] - Message displayed\n * when the number of characters is over the configured maximum, `maxlength`.\n * This message is displayed visually and through assistive technologies. The\n * component will replace the `%{count}` placeholder with the number of\n * remaining characters. This is a [pluralised list of\n * messages](https://frontend.design-system.service.gov.uk/localise-govuk-frontend).\n * @property {TranslationPluralForms} [wordsUnderLimit] - Message displayed when\n * the number of words is under the configured maximum, `maxlength`. This\n * message is displayed visually and through assistive technologies. The\n * component will replace the `%{count}` placeholder with the number of\n * remaining words. This is a [pluralised list of\n * messages](https://frontend.design-system.service.gov.uk/localise-govuk-frontend).\n * @property {string} [wordsAtLimit] - Message displayed when the number of\n * words reaches the configured maximum, `maxlength`. This message is\n * displayed visually and through assistive technologies.\n * @property {TranslationPluralForms} [wordsOverLimit] - Message displayed when\n * the number of words is over the configured maximum, `maxlength`. This\n * message is displayed visually and through assistive technologies. The\n * component will replace the `%{count}` placeholder with the number of\n * remaining words. This is a [pluralised list of\n * messages](https://frontend.design-system.service.gov.uk/localise-govuk-frontend).\n * @property {TranslationPluralForms} [textareaDescription] - Message made\n * available to assistive technologies, if none is already present in the\n * HTML, to describe that the component accepts only a limited amount of\n * content. It is visible on the page when JavaScript is unavailable. The\n * component will replace the `%{count}` placeholder with the value of the\n * `maxlength` or `maxwords` parameter.\n */\n\n/**\n * @import { Schema } from '../../common/configuration.mjs'\n * @import { TranslationPluralForms } from '../../i18n.mjs'\n */\n"],"names":["CharacterCount","ConfigurableComponent","configOverride","datasetConfig","configOverrides","maxlength","undefined","maxwords","constructor","$root","config","_ref","_this$config$maxwords","$textarea","$visibleCountMessage","$screenReaderCountMessage","lastInputTimestamp","lastInputValue","valueChecker","i18n","maxLength","querySelector","HTMLTextAreaElement","HTMLInputElement","ElementError","component","element","expectedType","identifier","errors","validateConfig","schema","ConfigError","formatErrorMessage","I18n","locale","closestAttributeValue","Infinity","textareaDescriptionId","id","$textareaDescription","document","getElementById","$errorMessage","textContent","match","t","count","insertAdjacentElement","createElement","className","setAttribute","classList","add","removeAttribute","bindChangeEvents","window","addEventListener","updateCountMessage","handleKeyUp","handleFocus","handleBlur","updateVisibleCountMessage","Date","now","setInterval","updateIfValueChanged","clearInterval","value","updateScreenReaderCountMessage","remainingNumber","isError","toggle","isOverThreshold","getCountMessage","text","_text$match","tokens","length","countType","formatCountMessage","translationKeySuffix","Math","abs","threshold","currentLength","thresholdValue","moduleName","defaults","Object","freeze","charactersUnderLimit","one","other","charactersAtLimit","charactersOverLimit","wordsUnderLimit","wordsAtLimit","wordsOverLimit","textareaDescription","properties","type","anyOf","required","errorMessage"],"mappings":";;;;;;AAUA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMA,cAAc,SAASC,qBAAqB,CAAC;EA0CxD,CAACC,cAAc,CAAEC,CAAAA,aAAa,EAAE;IAC9B,IAAIC,eAAe,GAAG,EAAE;AACxB,IAAA,IAAI,UAAU,IAAID,aAAa,IAAI,WAAW,IAAIA,aAAa,EAAE;AAC/DC,MAAAA,eAAe,GAAG;AAChBC,QAAAA,SAAS,EAAEC,SAAS;AACpBC,QAAAA,QAAQ,EAAED;OACX;AACH;AAEA,IAAA,OAAOF,eAAe;AACxB;;AAEA;AACF;AACA;AACA;AACEI,EAAAA,WAAWA,CAACC,KAAK,EAAEC,MAAM,GAAG,EAAE,EAAE;IAAA,IAAAC,IAAA,EAAAC,qBAAA;AAC9B,IAAA,KAAK,CAACH,KAAK,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;AACZjE,EAAAA,IAAI,EAAE;AAEJwE,IAAAA,oBAAoB,EAAE;AACpBC,MAAAA,GAAG,EAAE,uCAAuC;AAC5CC,MAAAA,KAAK,EAAE;KACR;AACDC,IAAAA,iBAAiB,EAAE,iCAAiC;AACpDC,IAAAA,mBAAmB,EAAE;AACnBH,MAAAA,GAAG,EAAE,sCAAsC;AAC3CC,MAAAA,KAAK,EAAE;KACR;AAEDG,IAAAA,eAAe,EAAE;AACfJ,MAAAA,GAAG,EAAE,kCAAkC;AACvCC,MAAAA,KAAK,EAAE;KACR;AACDI,IAAAA,YAAY,EAAE,4BAA4B;AAC1CC,IAAAA,cAAc,EAAE;AACdN,MAAAA,GAAG,EAAE,iCAAiC;AACtCC,MAAAA,KAAK,EAAE;KACR;AACDM,IAAAA,mBAAmB,EAAE;AACnBN,MAAAA,KAAK,EAAE;AACT;AACF;AACF,CAAC,CAAC;AAjaS7F,cAAc,CAyalB+B,MAAM,GAAG0D,MAAM,CAACC,MAAM,CAAC;AAC5BU,EAAAA,UAAU,EAAE;AACVjF,IAAAA,IAAI,EAAE;AAAEkF,MAAAA,IAAI,EAAE;KAAU;AACxB9F,IAAAA,QAAQ,EAAE;AAAE8F,MAAAA,IAAI,EAAE;KAAU;AAC5BhG,IAAAA,SAAS,EAAE;AAAEgG,MAAAA,IAAI,EAAE;KAAU;AAC7BjB,IAAAA,SAAS,EAAE;AAAEiB,MAAAA,IAAI,EAAE;AAAS;GAC7B;AACDC,EAAAA,KAAK,EAAE,CACL;IACEC,QAAQ,EAAE,CAAC,UAAU,CAAC;AACtBC,IAAAA,YAAY,EAAE;AAChB,GAAC,EACD;IACED,QAAQ,EAAE,CAAC,WAAW,CAAC;AACvBC,IAAAA,YAAY,EAAE;GACf;AAEL,CAAC,CAAC;;;;"}
@@ -5,7 +5,6 @@
5
5
  "name": "default",
6
6
  "options": {
7
7
  "name": "more-detail",
8
- "id": "more-detail",
9
8
  "maxlength": 10,
10
9
  "label": {
11
10
  "text": "Can you provide more detail?"
@@ -14,6 +13,7 @@
14
13
  "hidden": false,
15
14
  "description": "",
16
15
  "previewLayoutModifiers": [],
16
+ "screenshot": false,
17
17
  "html": "<div class=\"govuk-form-group govuk-character-count\" data-module=\"govuk-character-count\" data-maxlength=\"10\">\n <label class=\"govuk-label\" for=\"more-detail\">\n Can you provide more detail?\n </label>\n <textarea class=\"govuk-textarea govuk-js-character-count\" id=\"more-detail\" name=\"more-detail\" rows=\"5\" aria-describedby=\"more-detail-info\"></textarea>\n <div id=\"more-detail-info\" class=\"govuk-hint govuk-character-count__message\">\n You can enter up to 10 characters\n </div>\n</div>"
18
18
  },
19
19
  {
@@ -30,6 +30,7 @@
30
30
  "hidden": false,
31
31
  "description": "with textarea description translated into Welsh.",
32
32
  "previewLayoutModifiers": [],
33
+ "screenshot": false,
33
34
  "html": "<div class=\"govuk-form-group govuk-character-count\" data-module=\"govuk-character-count\" data-maxlength=\"10\">\n <label class=\"govuk-label\" for=\"custom-textarea-description\">\n Can you provide more detail?\n </label>\n <textarea class=\"govuk-textarea govuk-js-character-count\" id=\"custom-textarea-description\" name=\"custom-textarea-description\" rows=\"5\" aria-describedby=\"custom-textarea-description-info\"></textarea>\n <div id=\"custom-textarea-description-info\" class=\"govuk-hint govuk-character-count__message\">\n Gallwch ddefnyddio hyd at 10 nod\n </div>\n</div>"
34
35
  },
35
36
  {
@@ -48,8 +49,50 @@
48
49
  "hidden": false,
49
50
  "description": "",
50
51
  "previewLayoutModifiers": [],
52
+ "screenshot": false,
51
53
  "html": "<div class=\"govuk-form-group govuk-character-count\" data-module=\"govuk-character-count\" data-maxlength=\"10\">\n <label class=\"govuk-label\" for=\"with-hint\">\n Can you provide more detail?\n </label>\n <div id=\"with-hint-hint\" class=\"govuk-hint\">\n Don&#39;t include personal or financial information, eg your National Insurance number or credit card details.\n </div>\n <textarea class=\"govuk-textarea govuk-js-character-count\" id=\"with-hint\" name=\"with-hint\" rows=\"5\" aria-describedby=\"with-hint-info with-hint-hint\"></textarea>\n <div id=\"with-hint-info\" class=\"govuk-hint govuk-character-count__message\">\n You can enter up to 10 characters\n </div>\n</div>"
52
54
  },
55
+ {
56
+ "name": "with error",
57
+ "options": {
58
+ "name": "with-error",
59
+ "id": "with-error",
60
+ "maxlength": 10,
61
+ "label": {
62
+ "text": "Can you provide more detail?"
63
+ },
64
+ "errorMessage": {
65
+ "text": "Please provide more detail"
66
+ }
67
+ },
68
+ "hidden": false,
69
+ "description": "",
70
+ "previewLayoutModifiers": [],
71
+ "screenshot": false,
72
+ "html": "<div class=\"govuk-form-group govuk-form-group--error govuk-character-count\" data-module=\"govuk-character-count\" data-maxlength=\"10\">\n <label class=\"govuk-label\" for=\"with-error\">\n Can you provide more detail?\n </label>\n <p id=\"with-error-error\" class=\"govuk-error-message\">\n <span class=\"govuk-visually-hidden\">Error:</span> Please provide more detail\n </p>\n <textarea class=\"govuk-textarea govuk-textarea--error govuk-js-character-count\" id=\"with-error\" name=\"with-error\" rows=\"5\" aria-describedby=\"with-error-info with-error-error\"></textarea>\n <div id=\"with-error-info\" class=\"govuk-hint govuk-character-count__message\">\n You can enter up to 10 characters\n </div>\n</div>"
73
+ },
74
+ {
75
+ "name": "with hint and error",
76
+ "options": {
77
+ "name": "with-error",
78
+ "id": "with-error",
79
+ "maxlength": 10,
80
+ "label": {
81
+ "text": "Can you provide more detail?"
82
+ },
83
+ "errorMessage": {
84
+ "text": "Please provide more detail"
85
+ },
86
+ "hint": {
87
+ "text": "Don't include personal or financial information, eg your National Insurance number or credit card details."
88
+ }
89
+ },
90
+ "hidden": false,
91
+ "description": "",
92
+ "previewLayoutModifiers": [],
93
+ "screenshot": false,
94
+ "html": "<div class=\"govuk-form-group govuk-form-group--error govuk-character-count\" data-module=\"govuk-character-count\" data-maxlength=\"10\">\n <label class=\"govuk-label\" for=\"with-error\">\n Can you provide more detail?\n </label>\n <div id=\"with-error-hint\" class=\"govuk-hint\">\n Don&#39;t include personal or financial information, eg your National Insurance number or credit card details.\n </div>\n <p id=\"with-error-error\" class=\"govuk-error-message\">\n <span class=\"govuk-visually-hidden\">Error:</span> Please provide more detail\n </p>\n <textarea class=\"govuk-textarea govuk-textarea--error govuk-js-character-count\" id=\"with-error\" name=\"with-error\" rows=\"5\" aria-describedby=\"with-error-info with-error-hint with-error-error\"></textarea>\n <div id=\"with-error-info\" class=\"govuk-hint govuk-character-count__message\">\n You can enter up to 10 characters\n </div>\n</div>"
95
+ },
53
96
  {
54
97
  "name": "with default value",
55
98
  "options": {
@@ -64,6 +107,7 @@
64
107
  "hidden": false,
65
108
  "description": "",
66
109
  "previewLayoutModifiers": [],
110
+ "screenshot": false,
67
111
  "html": "<div class=\"govuk-form-group govuk-character-count\" data-module=\"govuk-character-count\" data-maxlength=\"100\">\n <label class=\"govuk-label\" for=\"with-default-value\">\n Full address\n </label>\n <textarea class=\"govuk-textarea govuk-js-character-count\" id=\"with-default-value\" name=\"default-value\" rows=\"5\" aria-describedby=\"with-default-value-info\">221B Baker Street\nLondon\nNW1 6XE\n</textarea>\n <div id=\"with-default-value-info\" class=\"govuk-hint govuk-character-count__message\">\n You can enter up to 100 characters\n </div>\n</div>"
68
112
  },
69
113
  {
@@ -83,6 +127,7 @@
83
127
  "hidden": false,
84
128
  "description": "",
85
129
  "previewLayoutModifiers": [],
130
+ "screenshot": false,
86
131
  "html": "<div class=\"govuk-form-group govuk-form-group--error govuk-character-count\" data-module=\"govuk-character-count\" data-maxlength=\"10\">\n <label class=\"govuk-label\" for=\"exceeding-characters\">\n Full address\n </label>\n <p id=\"exceeding-characters-error\" class=\"govuk-error-message\">\n <span class=\"govuk-visually-hidden\">Error:</span> Please do not exceed the maximum allowed limit\n </p>\n <textarea class=\"govuk-textarea govuk-textarea--error govuk-js-character-count\" id=\"exceeding-characters\" name=\"exceeding\" rows=\"5\" aria-describedby=\"exceeding-characters-info exceeding-characters-error\">221B Baker Street\nLondon\nNW1 6XE\n</textarea>\n <div id=\"exceeding-characters-info\" class=\"govuk-hint govuk-character-count__message\">\n You can enter up to 10 characters\n </div>\n</div>"
87
132
  },
88
133
  {
@@ -99,6 +144,7 @@
99
144
  "hidden": false,
100
145
  "description": "",
101
146
  "previewLayoutModifiers": [],
147
+ "screenshot": false,
102
148
  "html": "<div class=\"govuk-form-group govuk-character-count\" data-module=\"govuk-character-count\" data-maxlength=\"10\">\n <label class=\"govuk-label\" for=\"custom-rows\">\n Full address\n </label>\n <textarea class=\"govuk-textarea govuk-js-character-count\" id=\"custom-rows\" name=\"custom\" rows=\"8\" aria-describedby=\"custom-rows-info\"></textarea>\n <div id=\"custom-rows-info\" class=\"govuk-hint govuk-character-count__message\">\n You can enter up to 10 characters\n </div>\n</div>"
103
149
  },
104
150
  {
@@ -116,6 +162,7 @@
116
162
  "hidden": false,
117
163
  "description": "",
118
164
  "previewLayoutModifiers": [],
165
+ "screenshot": false,
119
166
  "html": "<div class=\"govuk-form-group govuk-character-count\" data-module=\"govuk-character-count\" data-maxlength=\"10\">\n <h1 class=\"govuk-label-wrapper\">\n <label class=\"govuk-label govuk-label--l\" for=\"textarea-with-page-heading\">\n Full address\n </label>\n </h1>\n <textarea class=\"govuk-textarea govuk-js-character-count\" id=\"textarea-with-page-heading\" name=\"address\" rows=\"5\" aria-describedby=\"textarea-with-page-heading-info\"></textarea>\n <div id=\"textarea-with-page-heading-info\" class=\"govuk-hint govuk-character-count__message\">\n You can enter up to 10 characters\n </div>\n</div>"
120
167
  },
121
168
  {
@@ -131,6 +178,7 @@
131
178
  "hidden": false,
132
179
  "description": "",
133
180
  "previewLayoutModifiers": [],
181
+ "screenshot": false,
134
182
  "html": "<div class=\"govuk-form-group govuk-character-count\" data-module=\"govuk-character-count\" data-maxwords=\"10\">\n <label class=\"govuk-label\" for=\"word-count\">\n Full address\n </label>\n <textarea class=\"govuk-textarea govuk-js-character-count\" id=\"word-count\" name=\"word-count\" rows=\"5\" aria-describedby=\"word-count-info\"></textarea>\n <div id=\"word-count-info\" class=\"govuk-hint govuk-character-count__message\">\n You can enter up to 10 words\n </div>\n</div>"
135
183
  },
136
184
  {
@@ -147,6 +195,7 @@
147
195
  "hidden": false,
148
196
  "description": "",
149
197
  "previewLayoutModifiers": [],
198
+ "screenshot": false,
150
199
  "html": "<div class=\"govuk-form-group govuk-character-count\" data-module=\"govuk-character-count\" data-maxlength=\"10\" data-threshold=\"75\">\n <label class=\"govuk-label\" for=\"with-threshold\">\n Full address\n </label>\n <textarea class=\"govuk-textarea govuk-js-character-count\" id=\"with-threshold\" name=\"with-threshold\" rows=\"5\" aria-describedby=\"with-threshold-info\"></textarea>\n <div id=\"with-threshold-info\" class=\"govuk-hint govuk-character-count__message\">\n You can enter up to 10 characters\n </div>\n</div>"
151
200
  },
152
201
  {
@@ -180,6 +229,7 @@
180
229
  "hidden": false,
181
230
  "description": "",
182
231
  "previewLayoutModifiers": [],
232
+ "screenshot": false,
183
233
  "html": "<div class=\"govuk-form-group govuk-character-count\" data-module=\"govuk-character-count\" data-maxlength=\"10\" data-i18n.characters-under-limit.other=\"%{count} characters to go\" data-i18n.characters-under-limit.one=\"One character to go\" data-i18n.characters-at-limit=\"Zero characters left\" data-i18n.characters-over-limit.other=\"%{count} characters too many\" data-i18n.characters-over-limit.one=\"One character too many\" data-i18n.words-under-limit.other=\"%{count} words to go\" data-i18n.words-under-limit.one=\"One word to go\" data-i18n.words-at-limit=\"Zero words left\" data-i18n.words-over-limit.other=\"%{count} words too many\" data-i18n.words-over-limit.one=\"One word too many\">\n <label class=\"govuk-label\" for=\"with-translations\">\n Full address\n </label>\n <textarea class=\"govuk-textarea govuk-js-character-count\" id=\"with-translations\" name=\"with-translations\" rows=\"5\" aria-describedby=\"with-translations-info\"></textarea>\n <div id=\"with-translations-info\" class=\"govuk-hint govuk-character-count__message\">\n You can enter up to 10 characters\n </div>\n</div>"
184
234
  },
185
235
  {
@@ -196,8 +246,25 @@
196
246
  "hidden": true,
197
247
  "description": "",
198
248
  "previewLayoutModifiers": [],
249
+ "screenshot": false,
199
250
  "html": "<div class=\"govuk-form-group govuk-character-count\" data-module=\"govuk-character-count\" data-maxlength=\"10\">\n <label class=\"govuk-label\" for=\"with-classes\">\n With classes\n </label>\n <textarea class=\"govuk-textarea govuk-js-character-count app-character-count--custom-modifier\" id=\"with-classes\" name=\"with-classes\" rows=\"5\" aria-describedby=\"with-classes-info\"></textarea>\n <div id=\"with-classes-info\" class=\"govuk-hint govuk-character-count__message\">\n You can enter up to 10 characters\n </div>\n</div>"
200
251
  },
252
+ {
253
+ "name": "id",
254
+ "options": {
255
+ "id": "character-count-id",
256
+ "name": "test-name",
257
+ "maxlength": 10,
258
+ "label": {
259
+ "text": "With custom id"
260
+ }
261
+ },
262
+ "hidden": true,
263
+ "description": "",
264
+ "previewLayoutModifiers": [],
265
+ "screenshot": false,
266
+ "html": "<div class=\"govuk-form-group govuk-character-count\" data-module=\"govuk-character-count\" data-maxlength=\"10\">\n <label class=\"govuk-label\" for=\"character-count-id\">\n With custom id\n </label>\n <textarea class=\"govuk-textarea govuk-js-character-count\" id=\"character-count-id\" name=\"test-name\" rows=\"5\" aria-describedby=\"character-count-id-info\"></textarea>\n <div id=\"character-count-id-info\" class=\"govuk-hint govuk-character-count__message\">\n You can enter up to 10 characters\n </div>\n</div>"
267
+ },
201
268
  {
202
269
  "name": "attributes",
203
270
  "options": {
@@ -214,6 +281,7 @@
214
281
  "hidden": true,
215
282
  "description": "",
216
283
  "previewLayoutModifiers": [],
284
+ "screenshot": false,
217
285
  "html": "<div class=\"govuk-form-group govuk-character-count\" data-module=\"govuk-character-count\" data-maxlength=\"10\">\n <label class=\"govuk-label\" for=\"with-attributes\">\n With attributes\n </label>\n <textarea class=\"govuk-textarea govuk-js-character-count\" id=\"with-attributes\" name=\"with-attributes\" rows=\"5\" aria-describedby=\"with-attributes-info\" data-attribute=\"my data value\"></textarea>\n <div id=\"with-attributes-info\" class=\"govuk-hint govuk-character-count__message\">\n You can enter up to 10 characters\n </div>\n</div>"
218
286
  },
219
287
  {
@@ -232,6 +300,7 @@
232
300
  "hidden": true,
233
301
  "description": "",
234
302
  "previewLayoutModifiers": [],
303
+ "screenshot": false,
235
304
  "html": "<div class=\"govuk-form-group govuk-character-count app-character-count--custom-modifier\" data-module=\"govuk-character-count\" data-maxlength=\"10\">\n <label class=\"govuk-label\" for=\"with-formgroup\">\n With formgroup\n </label>\n <textarea class=\"govuk-textarea govuk-js-character-count\" id=\"with-formgroup\" name=\"with-formgroup\" rows=\"5\" aria-describedby=\"with-formgroup-info\"></textarea>\n <div id=\"with-formgroup-info\" class=\"govuk-hint govuk-character-count__message\">\n You can enter up to 10 characters\n </div>\n</div>"
236
305
  },
237
306
  {
@@ -250,6 +319,7 @@
250
319
  "hidden": true,
251
320
  "description": "",
252
321
  "previewLayoutModifiers": [],
322
+ "screenshot": false,
253
323
  "html": "<div class=\"govuk-form-group govuk-character-count\" data-module=\"govuk-character-count\" data-maxlength=\"10\">\n <label class=\"govuk-label\" for=\"with-custom-countmessage-class\">\n With custom countMessage class\n </label>\n <textarea class=\"govuk-textarea govuk-js-character-count\" id=\"with-custom-countmessage-class\" name=\"with-custom-countmessage-class\" rows=\"5\" aria-describedby=\"with-custom-countmessage-class-info\"></textarea>\n <div id=\"with-custom-countmessage-class-info\" class=\"govuk-hint govuk-character-count__message app-custom-count-message\">\n You can enter up to 10 characters\n </div>\n</div>"
254
324
  },
255
325
  {
@@ -266,6 +336,7 @@
266
336
  "hidden": true,
267
337
  "description": "",
268
338
  "previewLayoutModifiers": [],
339
+ "screenshot": false,
269
340
  "html": "<div class=\"govuk-form-group govuk-character-count\" data-module=\"govuk-character-count\" data-maxlength=\"10\">\n <label class=\"govuk-label\" for=\"with-spellcheck\">\n With spellcheck\n </label>\n <textarea class=\"govuk-textarea govuk-js-character-count\" id=\"with-spellcheck\" name=\"with-spellcheck\" rows=\"5\" spellcheck=\"true\" aria-describedby=\"with-spellcheck-info\"></textarea>\n <div id=\"with-spellcheck-info\" class=\"govuk-hint govuk-character-count__message\">\n You can enter up to 10 characters\n </div>\n</div>"
270
341
  },
271
342
  {
@@ -282,6 +353,7 @@
282
353
  "hidden": true,
283
354
  "description": "",
284
355
  "previewLayoutModifiers": [],
356
+ "screenshot": false,
285
357
  "html": "<div class=\"govuk-form-group govuk-character-count\" data-module=\"govuk-character-count\" data-maxlength=\"10\">\n <label class=\"govuk-label\" for=\"without-spellcheck\">\n Without spellcheck\n </label>\n <textarea class=\"govuk-textarea govuk-js-character-count\" id=\"without-spellcheck\" name=\"without-spellcheck\" rows=\"5\" spellcheck=\"false\" aria-describedby=\"without-spellcheck-info\"></textarea>\n <div id=\"without-spellcheck-info\" class=\"govuk-hint govuk-character-count__message\">\n You can enter up to 10 characters\n </div>\n</div>"
286
358
  },
287
359
  {
@@ -301,6 +373,7 @@
301
373
  "hidden": true,
302
374
  "description": "",
303
375
  "previewLayoutModifiers": [],
376
+ "screenshot": false,
304
377
  "html": "<div class=\"govuk-form-group govuk-form-group--error govuk-character-count\" data-module=\"govuk-character-count\" data-maxlength=\"10\">\n <label class=\"govuk-label\" for=\"with-custom-error-class\">\n With custom error class\n </label>\n <p id=\"with-custom-error-class-error\" class=\"govuk-error-message\">\n <span class=\"govuk-visually-hidden\">Error:</span> Error message\n </p>\n <textarea class=\"govuk-textarea govuk-textarea--error govuk-js-character-count app-character-count--custom-modifier\" id=\"with-custom-error-class\" name=\"with-custom-error-class\" rows=\"5\" aria-describedby=\"with-custom-error-class-info with-custom-error-class-error\"></textarea>\n <div id=\"with-custom-error-class-info\" class=\"govuk-hint govuk-character-count__message\">\n You can enter up to 10 characters\n </div>\n</div>"
305
378
  },
306
379
  {
@@ -316,6 +389,7 @@
316
389
  "hidden": true,
317
390
  "description": "",
318
391
  "previewLayoutModifiers": [],
392
+ "screenshot": false,
319
393
  "html": "<div class=\"govuk-form-group govuk-character-count\" data-module=\"govuk-character-count\" data-maxlength=\"10\">\n <label class=\"govuk-label\" for=\"1_more-detail\">\n Can you provide more detail?\n </label>\n <textarea class=\"govuk-textarea govuk-js-character-count\" id=\"1_more-detail\" name=\"more-detail\" rows=\"5\" aria-describedby=\"1_more-detail-info\"></textarea>\n <div id=\"1_more-detail-info\" class=\"govuk-hint govuk-character-count__message\">\n You can enter up to 10 characters\n </div>\n</div>"
320
394
  },
321
395
  {
@@ -331,6 +405,7 @@
331
405
  "hidden": true,
332
406
  "description": "",
333
407
  "previewLayoutModifiers": [],
408
+ "screenshot": false,
334
409
  "html": "<div class=\"govuk-form-group govuk-character-count\" data-module=\"govuk-character-count\" data-maxlength=\"10\">\n <label class=\"govuk-label\" for=\"user1.profile[address]\">\n Full address\n </label>\n <textarea class=\"govuk-textarea govuk-js-character-count\" id=\"user1.profile[address]\" name=\"address\" rows=\"5\" aria-describedby=\"user1.profile[address]-info\"></textarea>\n <div id=\"user1.profile[address]-info\" class=\"govuk-hint govuk-character-count__message\">\n You can enter up to 10 characters\n </div>\n</div>"
335
410
  },
336
411
  {
@@ -349,6 +424,7 @@
349
424
  "hidden": true,
350
425
  "description": "",
351
426
  "previewLayoutModifiers": [],
427
+ "screenshot": false,
352
428
  "html": "<div class=\"govuk-form-group govuk-character-count\" data-module=\"govuk-character-count\" data-maxlength=\"10\">\n <label class=\"govuk-label\" for=\"maxlength-should-be-removed\">\n Full address\n </label>\n <textarea class=\"govuk-textarea govuk-js-character-count\" id=\"maxlength-should-be-removed\" name=\"address\" rows=\"5\" aria-describedby=\"maxlength-should-be-removed-info\" maxlength=\"10\"></textarea>\n <div id=\"maxlength-should-be-removed-info\" class=\"govuk-hint govuk-character-count__message\">\n You can enter up to 10 characters\n </div>\n</div>"
353
429
  },
354
430
  {
@@ -363,6 +439,7 @@
363
439
  "hidden": true,
364
440
  "description": "",
365
441
  "previewLayoutModifiers": [],
442
+ "screenshot": false,
366
443
  "html": "<div class=\"govuk-form-group govuk-character-count\" data-module=\"govuk-character-count\">\n <label class=\"govuk-label\" for=\"to-configure-in-javascript\">\n Full address\n </label>\n <textarea class=\"govuk-textarea govuk-js-character-count\" id=\"to-configure-in-javascript\" name=\"address\" rows=\"5\" aria-describedby=\"to-configure-in-javascript-info\"></textarea>\n <div id=\"to-configure-in-javascript-info\" class=\"govuk-hint govuk-character-count__message\">\n \n </div>\n</div>"
367
444
  },
368
445
  {
@@ -378,6 +455,7 @@
378
455
  "hidden": true,
379
456
  "description": "",
380
457
  "previewLayoutModifiers": [],
458
+ "screenshot": false,
381
459
  "html": "<div class=\"govuk-form-group govuk-character-count\" data-module=\"govuk-character-count\" data-i18n.textarea-description.other=\"No more than %{count} characters\">\n <label class=\"govuk-label\" for=\"no-maximum\">\n Full address\n </label>\n <textarea class=\"govuk-textarea govuk-js-character-count\" id=\"no-maximum\" name=\"no-maximum\" rows=\"5\" aria-describedby=\"no-maximum-info\"></textarea>\n <div id=\"no-maximum-info\" class=\"govuk-hint govuk-character-count__message\">\n \n </div>\n</div>"
382
460
  },
383
461
  {
@@ -392,6 +470,7 @@
392
470
  "hidden": true,
393
471
  "description": "",
394
472
  "previewLayoutModifiers": [],
473
+ "screenshot": false,
395
474
  "html": "<div class=\"govuk-form-group govuk-character-count\" data-module=\"govuk-character-count\">\n <label class=\"govuk-label\" for=\"no-maximum\">\n Full address\n </label>\n <textarea class=\"govuk-textarea govuk-js-character-count\" id=\"no-maximum\" name=\"no-maximum\" rows=\"5\" aria-describedby=\"no-maximum-info\"></textarea>\n <div id=\"no-maximum-info\" class=\"govuk-hint govuk-character-count__message\">\n \n </div>\n</div>"
396
475
  }
397
476
  ]
@@ -2,8 +2,8 @@
2
2
  {
3
3
  "name": "id",
4
4
  "type": "string",
5
- "required": true,
6
- "description": "The ID of the textarea."
5
+ "required": false,
6
+ "description": "The ID of the textarea. Defaults to the value of `name`."
7
7
  },
8
8
  {
9
9
  "name": "name",
@@ -164,7 +164,7 @@
164
164
  "name": "charactersUnderLimitText",
165
165
  "type": "object",
166
166
  "required": false,
167
- "description": "Message displayed when the number of characters is under the configured maximum, `maxlength`. This message is displayed visually and through assistive technologies. The component will replace the `%{count}` placeholder with the number of remaining characters. This is a [pluralised list of messages](https://frontend.design-system.service.gov.uk/localise-govuk-frontend)."
167
+ "description": "Message displayed when the number of characters is under the configured maximum, `maxlength`. This message is displayed visually and through assistive technologies. The component will replace the `%{count}` placeholder with the number of remaining characters. [Our pluralisation rules apply to this macro option](https://frontend.design-system.service.gov.uk/localise-govuk-frontend/#understanding-pluralisation-rules)."
168
168
  },
169
169
  {
170
170
  "name": "charactersAtLimitText",
@@ -176,13 +176,13 @@
176
176
  "name": "charactersOverLimitText",
177
177
  "type": "object",
178
178
  "required": false,
179
- "description": "Message displayed when the number of characters is over the configured maximum, `maxlength`. This message is displayed visually and through assistive technologies. The component will replace the `%{count}` placeholder with the number of characters above the maximum. This is a [pluralised list of messages](https://frontend.design-system.service.gov.uk/localise-govuk-frontend)."
179
+ "description": "Message displayed when the number of characters is over the configured maximum, `maxlength`. This message is displayed visually and through assistive technologies. The component will replace the `%{count}` placeholder with the number of characters above the maximum.[Our pluralisation rules apply to this macro option](https://frontend.design-system.service.gov.uk/localise-govuk-frontend/#understanding-pluralisation-rules)."
180
180
  },
181
181
  {
182
182
  "name": "wordsUnderLimitText",
183
183
  "type": "object",
184
184
  "required": false,
185
- "description": "Message displayed when the number of words is under the configured maximum, `maxwords`. This message is displayed visually and through assistive technologies. The component will replace the `%{count}` placeholder with the number of remaining words. This is a [pluralised list of messages](https://frontend.design-system.service.gov.uk/localise-govuk-frontend)."
185
+ "description": "Message displayed when the number of words is under the configured maximum, `maxwords`. This message is displayed visually and through assistive technologies. The component will replace the `%{count}` placeholder with the number of remaining words. [Our pluralisation rules apply to this macro option](https://frontend.design-system.service.gov.uk/localise-govuk-frontend/#understanding-pluralisation-rules)."
186
186
  },
187
187
  {
188
188
  "name": "wordsAtLimitText",
@@ -194,6 +194,6 @@
194
194
  "name": "wordsOverLimitText",
195
195
  "type": "object",
196
196
  "required": false,
197
- "description": "Message displayed when the number of words is over the configured maximum, `maxwords`. This message is displayed visually and through assistive technologies. The component will replace the `%{count}` placeholder with the number of characters above the maximum. This is a [pluralised list of messages](https://frontend.design-system.service.gov.uk/localise-govuk-frontend)."
197
+ "description": "Message displayed when the number of words is over the configured maximum, `maxwords`. This message is displayed visually and through assistive technologies. The component will replace the `%{count}` placeholder with the number of characters above the maximum. [Our pluralisation rules apply to this macro option](https://frontend.design-system.service.gov.uk/localise-govuk-frontend/#understanding-pluralisation-rules)."
198
198
  }
199
199
  ]
@@ -0,0 +1,12 @@
1
+ <div class="govuk-form-group govuk-form-group--error govuk-character-count" data-module="govuk-character-count" data-maxlength="10">
2
+ <label class="govuk-label" for="with-error">
3
+ Can you provide more detail?
4
+ </label>
5
+ <p id="with-error-error" class="govuk-error-message">
6
+ <span class="govuk-visually-hidden">Error:</span> Please provide more detail
7
+ </p>
8
+ <textarea class="govuk-textarea govuk-textarea--error govuk-js-character-count" id="with-error" name="with-error" rows="5" aria-describedby="with-error-info with-error-error"></textarea>
9
+ <div id="with-error-info" class="govuk-hint govuk-character-count__message">
10
+ You can enter up to 10 characters
11
+ </div>
12
+ </div>
@@ -0,0 +1,15 @@
1
+ <div class="govuk-form-group govuk-form-group--error govuk-character-count" data-module="govuk-character-count" data-maxlength="10">
2
+ <label class="govuk-label" for="with-error">
3
+ Can you provide more detail?
4
+ </label>
5
+ <div id="with-error-hint" class="govuk-hint">
6
+ Don&#39;t include personal or financial information, eg your National Insurance number or credit card details.
7
+ </div>
8
+ <p id="with-error-error" class="govuk-error-message">
9
+ <span class="govuk-visually-hidden">Error:</span> Please provide more detail
10
+ </p>
11
+ <textarea class="govuk-textarea govuk-textarea--error govuk-js-character-count" id="with-error" name="with-error" rows="5" aria-describedby="with-error-info with-error-hint with-error-error"></textarea>
12
+ <div id="with-error-info" class="govuk-hint govuk-character-count__message">
13
+ You can enter up to 10 characters
14
+ </div>
15
+ </div>
@@ -12,11 +12,12 @@
12
12
  {%- set textareaDescriptionLength = params.maxwords or params.maxlength -%}
13
13
  {%- set textareaDescriptionText = params.textareaDescriptionText or 'You can enter up to %{count} ' + ('words' if params.maxwords else 'characters') -%}
14
14
  {%- set textareaDescriptionTextNoLimit = textareaDescriptionText | replace('%{count}', textareaDescriptionLength) if not hasNoLimit -%}
15
+ {%- set id = params.id if params.id else params.name -%}
15
16
 
16
17
  {%- set countMessageHtml %}
17
18
  {{ govukHint({
18
19
  text: textareaDescriptionTextNoLimit,
19
- id: params.id + '-info',
20
+ id: id + '-info',
20
21
  classes: 'govuk-character-count__message' + (' ' + params.countMessage.classes if params.countMessage.classes)
21
22
  }) | trim }}
22
23
  {% if params.formGroup.afterInput %}
@@ -91,9 +92,9 @@
91
92
  {% endfor -%}
92
93
 
93
94
  {{ govukTextarea({
94
- id: params.id,
95
+ id: id,
95
96
  name: params.name,
96
- describedBy: params.id + '-info',
97
+ describedBy: id + '-info',
97
98
  rows: params.rows,
98
99
  spellcheck: params.spellcheck,
99
100
  value: params.value,
@@ -112,7 +113,7 @@
112
113
  classes: params.label.classes,
113
114
  isPageHeading: params.label.isPageHeading,
114
115
  attributes: params.label.attributes,
115
- for: params.id
116
+ for: id
116
117
  },
117
118
  hint: params.hint,
118
119
  errorMessage: params.errorMessage,
@@ -159,7 +159,7 @@
159
159
  // to be an even number in order to be centred under the 40px checkbox or radio.
160
160
  $conditional-border-width: $govuk-border-width-narrow;
161
161
  // Calculate the amount of padding needed to keep the border centered against the checkbox.
162
- $conditional-border-padding: ($govuk-checkboxes-size / 2) - ($conditional-border-width / 2);
162
+ $conditional-border-padding: ($govuk-touch-target-size / 2) - ($conditional-border-width / 2);
163
163
  // Move the border centered with the checkbox
164
164
  $conditional-margin-left: $conditional-border-padding;
165
165
  // Move the contents of the conditional inline with the label
@@ -255,6 +255,11 @@
255
255
  padding-left: ($govuk-touch-target-size - $input-offset) - ($margin-left + $conditional-border-width);
256
256
  }
257
257
 
258
+ .govuk-checkboxes__divider {
259
+ width: $govuk-small-checkboxes-size;
260
+ margin-bottom: govuk-spacing(1);
261
+ }
262
+
258
263
  // Hover state for small checkboxes.
259
264
  //
260
265
  // We use a hover state for small checkboxes because the touch target size