govuk_tech_docs 5.2.2 → 6.0.0.beta

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 (145) hide show
  1. checksums.yaml +4 -4
  2. data/.ruby-version +1 -0
  3. data/CHANGELOG.md +15 -0
  4. data/README.md +11 -3
  5. data/example/config/tech-docs.yml +1 -1
  6. data/govuk_tech_docs.gemspec +1 -1
  7. data/lib/assets/stylesheets/_core.scss +1 -0
  8. data/lib/assets/stylesheets/_govuk_tech_docs.scss +13 -15
  9. data/lib/assets/stylesheets/modules/_app-pane.scss +3 -3
  10. data/lib/assets/stylesheets/modules/_page-review.scss +4 -4
  11. data/lib/assets/stylesheets/modules/_search.scss +3 -3
  12. data/lib/assets/stylesheets/modules/_service-navigation.scss +5 -0
  13. data/lib/assets/stylesheets/modules/_technical-documentation.scss +7 -7
  14. data/lib/assets/stylesheets/modules/_toc.scss +13 -13
  15. data/lib/assets/stylesheets/palette/_syntax-highlighting.scss +9 -7
  16. data/lib/govuk_tech_docs/meta_tags.rb +1 -1
  17. data/lib/govuk_tech_docs/version.rb +1 -1
  18. data/lib/source/layouts/_header.erb +2 -16
  19. data/lib/source/layouts/_service_navigation.erb +27 -0
  20. data/lib/source/layouts/core.erb +7 -7
  21. data/node_modules/govuk-frontend/dist/govuk/_base.scss +1 -0
  22. data/node_modules/govuk-frontend/dist/govuk/all.bundle.js +87 -229
  23. data/node_modules/govuk-frontend/dist/govuk/all.bundle.mjs +88 -229
  24. data/node_modules/govuk-frontend/dist/govuk/all.mjs +0 -1
  25. data/node_modules/govuk-frontend/dist/govuk/assets/images/favicon.ico +0 -0
  26. data/node_modules/govuk-frontend/dist/govuk/assets/images/favicon.svg +1 -1
  27. data/node_modules/govuk-frontend/dist/govuk/assets/images/govuk-icon-180.png +0 -0
  28. data/node_modules/govuk-frontend/dist/govuk/assets/images/govuk-icon-192.png +0 -0
  29. data/node_modules/govuk-frontend/dist/govuk/assets/images/govuk-icon-512.png +0 -0
  30. data/node_modules/govuk-frontend/dist/govuk/assets/images/govuk-opengraph-image.png +0 -0
  31. data/node_modules/govuk-frontend/dist/govuk/common/govuk-frontend-version.mjs +1 -1
  32. data/node_modules/govuk-frontend/dist/govuk/components/accordion/_index.scss +18 -15
  33. data/node_modules/govuk-frontend/dist/govuk/components/accordion/accordion.bundle.js +1 -126
  34. data/node_modules/govuk-frontend/dist/govuk/components/accordion/accordion.bundle.mjs +1 -126
  35. data/node_modules/govuk-frontend/dist/govuk/components/back-link/_index.scss +2 -2
  36. data/node_modules/govuk-frontend/dist/govuk/components/breadcrumbs/_index.scss +2 -2
  37. data/node_modules/govuk-frontend/dist/govuk/components/button/_index.scss +18 -21
  38. data/node_modules/govuk-frontend/dist/govuk/components/character-count/_index.scss +2 -2
  39. data/node_modules/govuk-frontend/dist/govuk/components/character-count/character-count.bundle.js +20 -135
  40. data/node_modules/govuk-frontend/dist/govuk/components/character-count/character-count.bundle.mjs +20 -135
  41. data/node_modules/govuk-frontend/dist/govuk/components/character-count/character-count.mjs +19 -9
  42. data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/_index.scss +7 -6
  43. data/node_modules/govuk-frontend/dist/govuk/components/cookie-banner/_index.scss +2 -5
  44. data/node_modules/govuk-frontend/dist/govuk/components/date-input/_index.scss +5 -0
  45. data/node_modules/govuk-frontend/dist/govuk/components/details/_index.scss +6 -4
  46. data/node_modules/govuk-frontend/dist/govuk/components/error-message/_index.scss +1 -1
  47. data/node_modules/govuk-frontend/dist/govuk/components/error-summary/_index.scss +4 -2
  48. data/node_modules/govuk-frontend/dist/govuk/components/exit-this-page/_index.scss +1 -1
  49. data/node_modules/govuk-frontend/dist/govuk/components/exit-this-page/exit-this-page.bundle.js +1 -126
  50. data/node_modules/govuk-frontend/dist/govuk/components/exit-this-page/exit-this-page.bundle.mjs +1 -126
  51. data/node_modules/govuk-frontend/dist/govuk/components/file-upload/_index.scss +30 -38
  52. data/node_modules/govuk-frontend/dist/govuk/components/file-upload/file-upload.bundle.js +36 -132
  53. data/node_modules/govuk-frontend/dist/govuk/components/file-upload/file-upload.bundle.mjs +36 -132
  54. data/node_modules/govuk-frontend/dist/govuk/components/file-upload/file-upload.mjs +35 -6
  55. data/node_modules/govuk-frontend/dist/govuk/components/footer/_index.scss +30 -27
  56. data/node_modules/govuk-frontend/dist/govuk/components/header/_index.scss +89 -449
  57. data/node_modules/govuk-frontend/dist/govuk/components/hint/_index.scss +1 -1
  58. data/node_modules/govuk-frontend/dist/govuk/components/input/_index.scss +14 -20
  59. data/node_modules/govuk-frontend/dist/govuk/components/inset-text/_index.scss +2 -1
  60. data/node_modules/govuk-frontend/dist/govuk/components/notification-banner/_index.scss +10 -8
  61. data/node_modules/govuk-frontend/dist/govuk/components/pagination/_index.scss +12 -11
  62. data/node_modules/govuk-frontend/dist/govuk/components/panel/_index.scss +4 -4
  63. data/node_modules/govuk-frontend/dist/govuk/components/password-input/_index.scss +2 -2
  64. data/node_modules/govuk-frontend/dist/govuk/components/password-input/password-input.bundle.js +1 -126
  65. data/node_modules/govuk-frontend/dist/govuk/components/password-input/password-input.bundle.mjs +1 -126
  66. data/node_modules/govuk-frontend/dist/govuk/components/phase-banner/_index.scss +12 -6
  67. data/node_modules/govuk-frontend/dist/govuk/components/radios/_index.scss +8 -7
  68. data/node_modules/govuk-frontend/dist/govuk/components/select/_index.scss +6 -11
  69. data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/_index.scss +55 -76
  70. data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/service-navigation.bundle.js +30 -2
  71. data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/service-navigation.bundle.mjs +30 -2
  72. data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/service-navigation.mjs +30 -2
  73. data/node_modules/govuk-frontend/dist/govuk/components/skip-link/_index.scss +7 -2
  74. data/node_modules/govuk-frontend/dist/govuk/components/summary-list/_index.scss +25 -21
  75. data/node_modules/govuk-frontend/dist/govuk/components/table/_index.scss +7 -8
  76. data/node_modules/govuk-frontend/dist/govuk/components/tabs/_index.scss +9 -6
  77. data/node_modules/govuk-frontend/dist/govuk/components/tag/_index.scss +66 -31
  78. data/node_modules/govuk-frontend/dist/govuk/components/task-list/_index.scss +7 -5
  79. data/node_modules/govuk-frontend/dist/govuk/components/textarea/_index.scss +5 -10
  80. data/node_modules/govuk-frontend/dist/govuk/components/warning-text/_index.scss +5 -4
  81. data/node_modules/govuk-frontend/dist/govuk/core/_index.scss +0 -1
  82. data/node_modules/govuk-frontend/dist/govuk/core/_lists.scss +2 -2
  83. data/node_modules/govuk-frontend/dist/govuk/core/_section-break.scss +2 -1
  84. data/node_modules/govuk-frontend/dist/govuk/core/_typography.scss +6 -20
  85. data/node_modules/govuk-frontend/dist/govuk/custom-properties/_breakpoints.scss +17 -0
  86. data/node_modules/govuk-frontend/dist/govuk/custom-properties/_frontend-version.scss +15 -0
  87. data/node_modules/govuk-frontend/dist/govuk/custom-properties/_functional-colours.scss +17 -0
  88. data/node_modules/govuk-frontend/dist/govuk/custom-properties/_index.scss +5 -0
  89. data/node_modules/govuk-frontend/dist/govuk/govuk-frontend.min.js +1 -1
  90. data/node_modules/govuk-frontend/dist/govuk/helpers/_colour.scss +168 -82
  91. data/node_modules/govuk-frontend/dist/govuk/helpers/_focused.scss +41 -6
  92. data/node_modules/govuk-frontend/dist/govuk/helpers/_grid.scss +1 -1
  93. data/node_modules/govuk-frontend/dist/govuk/helpers/_links.scss +24 -40
  94. data/node_modules/govuk-frontend/dist/govuk/helpers/_media-queries.scss +172 -33
  95. data/node_modules/govuk-frontend/dist/govuk/helpers/_spacing.scss +1 -1
  96. data/node_modules/govuk-frontend/dist/govuk/helpers/_typography.scss +6 -30
  97. data/node_modules/govuk-frontend/dist/govuk/i18n.mjs +1 -126
  98. data/node_modules/govuk-frontend/dist/govuk/init.mjs +1 -2
  99. data/node_modules/govuk-frontend/dist/govuk/objects/_button-group.scss +1 -1
  100. data/node_modules/govuk-frontend/dist/govuk/objects/_form-group.scss +2 -1
  101. data/node_modules/govuk-frontend/dist/govuk/objects/_main-wrapper.scss +1 -1
  102. data/node_modules/govuk-frontend/dist/govuk/objects/_template.scss +3 -7
  103. data/node_modules/govuk-frontend/dist/govuk/objects/_width-container.scss +2 -2
  104. data/node_modules/govuk-frontend/dist/govuk/overrides/_display.scss +1 -1
  105. data/node_modules/govuk-frontend/dist/govuk/overrides/_typography.scss +0 -2
  106. data/node_modules/govuk-frontend/dist/govuk/overrides/_width.scss +5 -5
  107. data/node_modules/govuk-frontend/dist/govuk/settings/_colours-applied.scss +3 -188
  108. data/node_modules/govuk-frontend/dist/govuk/settings/_colours-functional.scss +366 -0
  109. data/node_modules/govuk-frontend/dist/govuk/settings/_colours-organisations.scss +9 -255
  110. data/node_modules/govuk-frontend/dist/govuk/settings/_colours-palette.scss +117 -25
  111. data/node_modules/govuk-frontend/dist/govuk/settings/_custom-properties.scss +18 -0
  112. data/node_modules/govuk-frontend/dist/govuk/settings/_index.scss +3 -14
  113. data/node_modules/govuk-frontend/dist/govuk/settings/_media-queries.scss +0 -9
  114. data/node_modules/govuk-frontend/dist/govuk/settings/_typography-responsive.scss +12 -189
  115. data/node_modules/govuk-frontend/dist/govuk/tools/_index.scss +0 -1
  116. data/node_modules/govuk-frontend/dist/govuk/tools/_px-to-em.scss +4 -2
  117. data/node_modules/govuk-frontend/dist/govuk/tools/_px-to-rem.scss +2 -0
  118. data/package-lock.json +3228 -4
  119. data/package.json +1 -1
  120. metadata +10 -26
  121. data/node_modules/govuk-frontend/dist/govuk/all.scss +0 -9
  122. data/node_modules/govuk-frontend/dist/govuk/assets/rebrand/images/favicon.ico +0 -0
  123. data/node_modules/govuk-frontend/dist/govuk/assets/rebrand/images/favicon.svg +0 -1
  124. data/node_modules/govuk-frontend/dist/govuk/assets/rebrand/images/govuk-crest.svg +0 -1
  125. data/node_modules/govuk-frontend/dist/govuk/assets/rebrand/images/govuk-icon-180.png +0 -0
  126. data/node_modules/govuk-frontend/dist/govuk/assets/rebrand/images/govuk-icon-192.png +0 -0
  127. data/node_modules/govuk-frontend/dist/govuk/assets/rebrand/images/govuk-icon-512.png +0 -0
  128. data/node_modules/govuk-frontend/dist/govuk/assets/rebrand/images/govuk-icon-mask.svg +0 -1
  129. data/node_modules/govuk-frontend/dist/govuk/assets/rebrand/images/govuk-opengraph-image.png +0 -0
  130. data/node_modules/govuk-frontend/dist/govuk/assets/rebrand/manifest.json +0 -39
  131. data/node_modules/govuk-frontend/dist/govuk/components/_all.scss +0 -10
  132. data/node_modules/govuk-frontend/dist/govuk/components/header/header.bundle.js +0 -238
  133. data/node_modules/govuk-frontend/dist/govuk/components/header/header.bundle.mjs +0 -230
  134. data/node_modules/govuk-frontend/dist/govuk/components/header/header.mjs +0 -89
  135. data/node_modules/govuk-frontend/dist/govuk/core/_all.scss +0 -10
  136. data/node_modules/govuk-frontend/dist/govuk/core/_govuk-frontend-properties.scss +0 -15
  137. data/node_modules/govuk-frontend/dist/govuk/helpers/_all.scss +0 -10
  138. data/node_modules/govuk-frontend/dist/govuk/objects/_all.scss +0 -10
  139. data/node_modules/govuk-frontend/dist/govuk/overrides/_all.scss +0 -9
  140. data/node_modules/govuk-frontend/dist/govuk/settings/_all.scss +0 -10
  141. data/node_modules/govuk-frontend/dist/govuk/tools/_all.scss +0 -10
  142. data/node_modules/govuk-frontend/dist/govuk/tools/_rebrand.scss +0 -65
  143. data/node_modules/govuk-frontend/dist/govuk/utilities/_all.scss +0 -10
  144. data/node_modules/govuk-frontend/dist/govuk/vendor/_sass-mq.scss +0 -349
  145. data/node_modules/govuk-frontend/dist/govuk-prototype-kit/functions.js +0 -25
@@ -348,7 +348,7 @@
348
348
  return 'other';
349
349
  }
350
350
  const translation = this.translations[lookupKey];
351
- const preferredForm = this.hasIntlPluralRulesSupport() ? new Intl.PluralRules(this.locale).select(count) : this.selectPluralFormUsingFallbackRules(count);
351
+ const preferredForm = this.hasIntlPluralRulesSupport() ? new Intl.PluralRules(this.locale).select(count) : 'other';
352
352
  if (isObject(translation)) {
353
353
  if (preferredForm in translation) {
354
354
  return preferredForm;
@@ -359,132 +359,7 @@
359
359
  }
360
360
  throw new Error(`i18n: Plural form ".other" is required for "${this.locale}" locale`);
361
361
  }
362
- selectPluralFormUsingFallbackRules(count) {
363
- count = Math.abs(Math.floor(count));
364
- const ruleset = this.getPluralRulesForLocale();
365
- if (ruleset) {
366
- return I18n.pluralRules[ruleset](count);
367
- }
368
- return 'other';
369
- }
370
- getPluralRulesForLocale() {
371
- const localeShort = this.locale.split('-')[0];
372
- for (const pluralRule in I18n.pluralRulesMap) {
373
- const languages = I18n.pluralRulesMap[pluralRule];
374
- if (languages.includes(this.locale) || languages.includes(localeShort)) {
375
- return pluralRule;
376
- }
377
- }
378
- }
379
362
  }
380
- I18n.pluralRulesMap = {
381
- arabic: ['ar'],
382
- chinese: ['my', 'zh', 'id', 'ja', 'jv', 'ko', 'ms', 'th', 'vi'],
383
- french: ['hy', 'bn', 'fr', 'gu', 'hi', 'fa', 'pa', 'zu'],
384
- german: ['af', 'sq', 'az', 'eu', 'bg', 'ca', 'da', 'nl', 'en', 'et', 'fi', 'ka', 'de', 'el', 'hu', 'lb', 'no', 'so', 'sw', 'sv', 'ta', 'te', 'tr', 'ur'],
385
- irish: ['ga'],
386
- russian: ['ru', 'uk'],
387
- scottish: ['gd'],
388
- spanish: ['pt-PT', 'it', 'es'],
389
- welsh: ['cy']
390
- };
391
- I18n.pluralRules = {
392
- arabic(n) {
393
- if (n === 0) {
394
- return 'zero';
395
- }
396
- if (n === 1) {
397
- return 'one';
398
- }
399
- if (n === 2) {
400
- return 'two';
401
- }
402
- if (n % 100 >= 3 && n % 100 <= 10) {
403
- return 'few';
404
- }
405
- if (n % 100 >= 11 && n % 100 <= 99) {
406
- return 'many';
407
- }
408
- return 'other';
409
- },
410
- chinese() {
411
- return 'other';
412
- },
413
- french(n) {
414
- return n === 0 || n === 1 ? 'one' : 'other';
415
- },
416
- german(n) {
417
- return n === 1 ? 'one' : 'other';
418
- },
419
- irish(n) {
420
- if (n === 1) {
421
- return 'one';
422
- }
423
- if (n === 2) {
424
- return 'two';
425
- }
426
- if (n >= 3 && n <= 6) {
427
- return 'few';
428
- }
429
- if (n >= 7 && n <= 10) {
430
- return 'many';
431
- }
432
- return 'other';
433
- },
434
- russian(n) {
435
- const lastTwo = n % 100;
436
- const last = lastTwo % 10;
437
- if (last === 1 && lastTwo !== 11) {
438
- return 'one';
439
- }
440
- if (last >= 2 && last <= 4 && !(lastTwo >= 12 && lastTwo <= 14)) {
441
- return 'few';
442
- }
443
- if (last === 0 || last >= 5 && last <= 9 || lastTwo >= 11 && lastTwo <= 14) {
444
- return 'many';
445
- }
446
- return 'other';
447
- },
448
- scottish(n) {
449
- if (n === 1 || n === 11) {
450
- return 'one';
451
- }
452
- if (n === 2 || n === 12) {
453
- return 'two';
454
- }
455
- if (n >= 3 && n <= 10 || n >= 13 && n <= 19) {
456
- return 'few';
457
- }
458
- return 'other';
459
- },
460
- spanish(n) {
461
- if (n === 1) {
462
- return 'one';
463
- }
464
- if (n % 1000000 === 0 && n !== 0) {
465
- return 'many';
466
- }
467
- return 'other';
468
- },
469
- welsh(n) {
470
- if (n === 0) {
471
- return 'zero';
472
- }
473
- if (n === 1) {
474
- return 'one';
475
- }
476
- if (n === 2) {
477
- return 'two';
478
- }
479
- if (n === 3) {
480
- return 'few';
481
- }
482
- if (n === 6) {
483
- return 'many';
484
- }
485
- return 'other';
486
- }
487
- };
488
363
 
489
364
  /**
490
365
  * Accordion component
@@ -342,7 +342,7 @@ class I18n {
342
342
  return 'other';
343
343
  }
344
344
  const translation = this.translations[lookupKey];
345
- const preferredForm = this.hasIntlPluralRulesSupport() ? new Intl.PluralRules(this.locale).select(count) : this.selectPluralFormUsingFallbackRules(count);
345
+ const preferredForm = this.hasIntlPluralRulesSupport() ? new Intl.PluralRules(this.locale).select(count) : 'other';
346
346
  if (isObject(translation)) {
347
347
  if (preferredForm in translation) {
348
348
  return preferredForm;
@@ -353,132 +353,7 @@ class I18n {
353
353
  }
354
354
  throw new Error(`i18n: Plural form ".other" is required for "${this.locale}" locale`);
355
355
  }
356
- selectPluralFormUsingFallbackRules(count) {
357
- count = Math.abs(Math.floor(count));
358
- const ruleset = this.getPluralRulesForLocale();
359
- if (ruleset) {
360
- return I18n.pluralRules[ruleset](count);
361
- }
362
- return 'other';
363
- }
364
- getPluralRulesForLocale() {
365
- const localeShort = this.locale.split('-')[0];
366
- for (const pluralRule in I18n.pluralRulesMap) {
367
- const languages = I18n.pluralRulesMap[pluralRule];
368
- if (languages.includes(this.locale) || languages.includes(localeShort)) {
369
- return pluralRule;
370
- }
371
- }
372
- }
373
356
  }
374
- I18n.pluralRulesMap = {
375
- arabic: ['ar'],
376
- chinese: ['my', 'zh', 'id', 'ja', 'jv', 'ko', 'ms', 'th', 'vi'],
377
- french: ['hy', 'bn', 'fr', 'gu', 'hi', 'fa', 'pa', 'zu'],
378
- german: ['af', 'sq', 'az', 'eu', 'bg', 'ca', 'da', 'nl', 'en', 'et', 'fi', 'ka', 'de', 'el', 'hu', 'lb', 'no', 'so', 'sw', 'sv', 'ta', 'te', 'tr', 'ur'],
379
- irish: ['ga'],
380
- russian: ['ru', 'uk'],
381
- scottish: ['gd'],
382
- spanish: ['pt-PT', 'it', 'es'],
383
- welsh: ['cy']
384
- };
385
- I18n.pluralRules = {
386
- arabic(n) {
387
- if (n === 0) {
388
- return 'zero';
389
- }
390
- if (n === 1) {
391
- return 'one';
392
- }
393
- if (n === 2) {
394
- return 'two';
395
- }
396
- if (n % 100 >= 3 && n % 100 <= 10) {
397
- return 'few';
398
- }
399
- if (n % 100 >= 11 && n % 100 <= 99) {
400
- return 'many';
401
- }
402
- return 'other';
403
- },
404
- chinese() {
405
- return 'other';
406
- },
407
- french(n) {
408
- return n === 0 || n === 1 ? 'one' : 'other';
409
- },
410
- german(n) {
411
- return n === 1 ? 'one' : 'other';
412
- },
413
- irish(n) {
414
- if (n === 1) {
415
- return 'one';
416
- }
417
- if (n === 2) {
418
- return 'two';
419
- }
420
- if (n >= 3 && n <= 6) {
421
- return 'few';
422
- }
423
- if (n >= 7 && n <= 10) {
424
- return 'many';
425
- }
426
- return 'other';
427
- },
428
- russian(n) {
429
- const lastTwo = n % 100;
430
- const last = lastTwo % 10;
431
- if (last === 1 && lastTwo !== 11) {
432
- return 'one';
433
- }
434
- if (last >= 2 && last <= 4 && !(lastTwo >= 12 && lastTwo <= 14)) {
435
- return 'few';
436
- }
437
- if (last === 0 || last >= 5 && last <= 9 || lastTwo >= 11 && lastTwo <= 14) {
438
- return 'many';
439
- }
440
- return 'other';
441
- },
442
- scottish(n) {
443
- if (n === 1 || n === 11) {
444
- return 'one';
445
- }
446
- if (n === 2 || n === 12) {
447
- return 'two';
448
- }
449
- if (n >= 3 && n <= 10 || n >= 13 && n <= 19) {
450
- return 'few';
451
- }
452
- return 'other';
453
- },
454
- spanish(n) {
455
- if (n === 1) {
456
- return 'one';
457
- }
458
- if (n % 1000000 === 0 && n !== 0) {
459
- return 'many';
460
- }
461
- return 'other';
462
- },
463
- welsh(n) {
464
- if (n === 0) {
465
- return 'zero';
466
- }
467
- if (n === 1) {
468
- return 'one';
469
- }
470
- if (n === 2) {
471
- return 'two';
472
- }
473
- if (n === 3) {
474
- return 'few';
475
- }
476
- if (n === 6) {
477
- return 'many';
478
- }
479
- return 'other';
480
- }
481
- };
482
357
 
483
358
  /**
484
359
  * Accordion component
@@ -10,7 +10,7 @@
10
10
  $chevron-border-width: govuk-em($chevron-border-min-width, $font-size);
11
11
 
12
12
  // Colour of chevron
13
- $chevron-border-colour: $govuk-secondary-text-colour;
13
+ $chevron-border-colour: govuk-functional-colour(secondary-text);
14
14
 
15
15
  .govuk-back-link {
16
16
  @include govuk-font-size($size: $font-size);
@@ -59,7 +59,7 @@
59
59
  }
60
60
 
61
61
  .govuk-back-link:focus::before {
62
- border-color: $govuk-focus-text-colour;
62
+ border-color: govuk-functional-colour(focus-text);
63
63
  }
64
64
 
65
65
  .govuk-back-link::after {
@@ -10,7 +10,7 @@
10
10
  $chevron-border-width: govuk-em($chevron-border-min-width, $font-size);
11
11
 
12
12
  // Colour of chevron
13
- $chevron-border-colour: $govuk-secondary-text-colour;
13
+ $chevron-border-colour: govuk-functional-colour(secondary-text);
14
14
 
15
15
  // Calculated altitude (△↕) of the right-angled isosceles chevron with sides
16
16
  // of length 8 (7px + 1px border):
@@ -97,7 +97,7 @@
97
97
  }
98
98
 
99
99
  .govuk-breadcrumbs--collapse-on-mobile {
100
- @include govuk-media-query($until: tablet) {
100
+ @media #{govuk-until-breakpoint(tablet)} {
101
101
  .govuk-breadcrumbs__list-item {
102
102
  display: none;
103
103
 
@@ -28,31 +28,31 @@ $govuk-inverse-button-background-colour: govuk-colour("white") !default;
28
28
  /// @type Colour
29
29
  /// @access public
30
30
 
31
- $govuk-inverse-button-text-colour: $govuk-brand-colour !default;
31
+ $govuk-inverse-button-text-colour: govuk-functional-colour(brand) !default;
32
32
 
33
33
  @include govuk-exports("govuk/component/button") {
34
34
  $govuk-button-colour: $govuk-button-background-colour;
35
35
  $govuk-button-text-colour: $govuk-button-text-colour;
36
- $govuk-button-hover-colour: govuk-shade($govuk-button-colour, 20%);
37
- $govuk-button-shadow-colour: govuk-shade($govuk-button-colour, 60%);
36
+ $govuk-button-hover-colour: govuk-colour("green", $variant: "shade-25");
37
+ $govuk-button-shadow-colour: govuk-colour("green", $variant: "shade-50");
38
38
 
39
39
  // Secondary button variables
40
- $govuk-secondary-button-colour: govuk-colour("light-grey");
40
+ $govuk-secondary-button-colour: govuk-colour("black", $variant: "tint-95");
41
41
  $govuk-secondary-button-text-colour: govuk-colour("black");
42
- $govuk-secondary-button-hover-colour: govuk-shade($govuk-secondary-button-colour, 10%);
43
- $govuk-secondary-button-shadow-colour: govuk-shade($govuk-secondary-button-colour, 40%);
42
+ $govuk-secondary-button-hover-colour: govuk-colour("black", $variant: "tint-80");
43
+ $govuk-secondary-button-shadow-colour: govuk-colour("black", $variant: "tint-50");
44
44
 
45
45
  // Warning button variables
46
46
  $govuk-warning-button-colour: govuk-colour("red");
47
47
  $govuk-warning-button-text-colour: govuk-colour("white");
48
- $govuk-warning-button-hover-colour: govuk-shade($govuk-warning-button-colour, 20%);
49
- $govuk-warning-button-shadow-colour: govuk-shade($govuk-warning-button-colour, 60%);
48
+ $govuk-warning-button-hover-colour: govuk-colour("red", $variant: "shade-25");
49
+ $govuk-warning-button-shadow-colour: govuk-colour("red", $variant: "shade-50");
50
50
 
51
51
  // Inverse button variables
52
52
  $govuk-inverse-button-colour: $govuk-inverse-button-background-colour;
53
53
  $govuk-inverse-button-text-colour: $govuk-inverse-button-text-colour;
54
- $govuk-inverse-button-hover-colour: govuk-tint($govuk-inverse-button-text-colour, 90%);
55
- $govuk-inverse-button-shadow-colour: govuk-shade($govuk-inverse-button-text-colour, 30%);
54
+ $govuk-inverse-button-hover-colour: govuk-colour("blue", $variant: "tint-95");
55
+ $govuk-inverse-button-shadow-colour: govuk-colour("blue", $variant: "shade-50");
56
56
 
57
57
  // Because the shadow (s0) is visually 'part of' the button, we need to reduce
58
58
  // the height of the button to compensate by adjusting its padding (s1) and
@@ -82,7 +82,7 @@ $govuk-inverse-button-text-colour: $govuk-brand-colour !default;
82
82
  cursor: pointer;
83
83
  -webkit-appearance: none;
84
84
 
85
- @include govuk-media-query($from: tablet) {
85
+ @media #{govuk-from-breakpoint(tablet)} {
86
86
  width: auto;
87
87
  }
88
88
 
@@ -111,21 +111,18 @@ $govuk-inverse-button-text-colour: $govuk-brand-colour !default;
111
111
  }
112
112
 
113
113
  &:focus {
114
- border-color: $govuk-focus-colour;
114
+ border-color: govuk-functional-colour(focus);
115
115
  outline: $govuk-focus-width solid transparent;
116
- box-shadow: inset 0 0 0 1px $govuk-focus-colour;
116
+ box-shadow: inset 0 0 0 1px govuk-functional-colour(focus);
117
117
  }
118
118
 
119
119
  &:focus:not(:active):not(:hover) {
120
- border-color: $govuk-focus-colour;
121
- color: $govuk-focus-text-colour;
122
- background-color: $govuk-focus-colour;
123
- box-shadow: 0 2px 0 $govuk-focus-text-colour;
120
+ border-color: govuk-functional-colour(focus);
121
+ color: govuk-functional-colour(focus-text);
122
+ background-color: govuk-functional-colour(focus);
123
+ box-shadow: 0 2px 0 govuk-functional-colour(focus-text);
124
124
  }
125
125
 
126
- // The following adjustments do not work for <input type="button"> as
127
- // non-container elements cannot include pseudo elements (i.e. ::before).
128
-
129
126
  // Use a pseudo element to expand the click target area to include the
130
127
  // button's shadow as well, in case users try to click it.
131
128
  &::before {
@@ -247,7 +244,7 @@ $govuk-inverse-button-text-colour: $govuk-brand-colour !default;
247
244
  .govuk-button__start-icon {
248
245
  margin-left: govuk-spacing(1);
249
246
 
250
- @include govuk-media-query($from: desktop) {
247
+ @media #{govuk-from-breakpoint(desktop)} {
251
248
  margin-left: govuk-spacing(2);
252
249
  }
253
250
  vertical-align: middle;
@@ -16,8 +16,8 @@
16
16
  // show the error state. This presents feedback to the user that the value
17
17
  // has become invalid without needing to see the counter.
18
18
  .govuk-textarea--error:focus {
19
- border-color: $govuk-error-colour;
20
- box-shadow: inset 0 0 0 $govuk-border-width-form-element $govuk-error-colour;
19
+ border-color: govuk-functional-colour(error);
20
+ box-shadow: inset 0 0 0 $govuk-border-width-form-element govuk-functional-colour(error);
21
21
  }
22
22
  }
23
23
 
@@ -373,7 +373,7 @@
373
373
  return 'other';
374
374
  }
375
375
  const translation = this.translations[lookupKey];
376
- const preferredForm = this.hasIntlPluralRulesSupport() ? new Intl.PluralRules(this.locale).select(count) : this.selectPluralFormUsingFallbackRules(count);
376
+ const preferredForm = this.hasIntlPluralRulesSupport() ? new Intl.PluralRules(this.locale).select(count) : 'other';
377
377
  if (isObject(translation)) {
378
378
  if (preferredForm in translation) {
379
379
  return preferredForm;
@@ -384,132 +384,7 @@
384
384
  }
385
385
  throw new Error(`i18n: Plural form ".other" is required for "${this.locale}" locale`);
386
386
  }
387
- selectPluralFormUsingFallbackRules(count) {
388
- count = Math.abs(Math.floor(count));
389
- const ruleset = this.getPluralRulesForLocale();
390
- if (ruleset) {
391
- return I18n.pluralRules[ruleset](count);
392
- }
393
- return 'other';
394
- }
395
- getPluralRulesForLocale() {
396
- const localeShort = this.locale.split('-')[0];
397
- for (const pluralRule in I18n.pluralRulesMap) {
398
- const languages = I18n.pluralRulesMap[pluralRule];
399
- if (languages.includes(this.locale) || languages.includes(localeShort)) {
400
- return pluralRule;
401
- }
402
- }
403
- }
404
387
  }
405
- I18n.pluralRulesMap = {
406
- arabic: ['ar'],
407
- chinese: ['my', 'zh', 'id', 'ja', 'jv', 'ko', 'ms', 'th', 'vi'],
408
- french: ['hy', 'bn', 'fr', 'gu', 'hi', 'fa', 'pa', 'zu'],
409
- german: ['af', 'sq', 'az', 'eu', 'bg', 'ca', 'da', 'nl', 'en', 'et', 'fi', 'ka', 'de', 'el', 'hu', 'lb', 'no', 'so', 'sw', 'sv', 'ta', 'te', 'tr', 'ur'],
410
- irish: ['ga'],
411
- russian: ['ru', 'uk'],
412
- scottish: ['gd'],
413
- spanish: ['pt-PT', 'it', 'es'],
414
- welsh: ['cy']
415
- };
416
- I18n.pluralRules = {
417
- arabic(n) {
418
- if (n === 0) {
419
- return 'zero';
420
- }
421
- if (n === 1) {
422
- return 'one';
423
- }
424
- if (n === 2) {
425
- return 'two';
426
- }
427
- if (n % 100 >= 3 && n % 100 <= 10) {
428
- return 'few';
429
- }
430
- if (n % 100 >= 11 && n % 100 <= 99) {
431
- return 'many';
432
- }
433
- return 'other';
434
- },
435
- chinese() {
436
- return 'other';
437
- },
438
- french(n) {
439
- return n === 0 || n === 1 ? 'one' : 'other';
440
- },
441
- german(n) {
442
- return n === 1 ? 'one' : 'other';
443
- },
444
- irish(n) {
445
- if (n === 1) {
446
- return 'one';
447
- }
448
- if (n === 2) {
449
- return 'two';
450
- }
451
- if (n >= 3 && n <= 6) {
452
- return 'few';
453
- }
454
- if (n >= 7 && n <= 10) {
455
- return 'many';
456
- }
457
- return 'other';
458
- },
459
- russian(n) {
460
- const lastTwo = n % 100;
461
- const last = lastTwo % 10;
462
- if (last === 1 && lastTwo !== 11) {
463
- return 'one';
464
- }
465
- if (last >= 2 && last <= 4 && !(lastTwo >= 12 && lastTwo <= 14)) {
466
- return 'few';
467
- }
468
- if (last === 0 || last >= 5 && last <= 9 || lastTwo >= 11 && lastTwo <= 14) {
469
- return 'many';
470
- }
471
- return 'other';
472
- },
473
- scottish(n) {
474
- if (n === 1 || n === 11) {
475
- return 'one';
476
- }
477
- if (n === 2 || n === 12) {
478
- return 'two';
479
- }
480
- if (n >= 3 && n <= 10 || n >= 13 && n <= 19) {
481
- return 'few';
482
- }
483
- return 'other';
484
- },
485
- spanish(n) {
486
- if (n === 1) {
487
- return 'one';
488
- }
489
- if (n % 1000000 === 0 && n !== 0) {
490
- return 'many';
491
- }
492
- return 'other';
493
- },
494
- welsh(n) {
495
- if (n === 0) {
496
- return 'zero';
497
- }
498
- if (n === 1) {
499
- return 'one';
500
- }
501
- if (n === 2) {
502
- return 'two';
503
- }
504
- if (n === 3) {
505
- return 'few';
506
- }
507
- if (n === 6) {
508
- return 'many';
509
- }
510
- return 'other';
511
- }
512
- };
513
388
 
514
389
  /**
515
390
  * Character count component
@@ -544,6 +419,7 @@
544
419
  var _ref, _this$config$maxwords;
545
420
  super($root, config);
546
421
  this.$textarea = void 0;
422
+ this.count = 0;
547
423
  this.$visibleCountMessage = void 0;
548
424
  this.$screenReaderCountMessage = void 0;
549
425
  this.lastInputTimestamp = null;
@@ -599,15 +475,22 @@
599
475
  $textareaDescription.classList.add('govuk-visually-hidden');
600
476
  this.$textarea.removeAttribute('maxlength');
601
477
  this.bindChangeEvents();
602
- window.addEventListener('pageshow', () => this.updateCountMessage());
478
+ window.addEventListener('pageshow', () => {
479
+ if (this.$textarea.value !== this.$textarea.textContent) {
480
+ this.updateCount();
481
+ this.updateCountMessage();
482
+ }
483
+ });
484
+ this.updateCount();
603
485
  this.updateCountMessage();
604
486
  }
605
487
  bindChangeEvents() {
606
- this.$textarea.addEventListener('keyup', () => this.handleKeyUp());
488
+ this.$textarea.addEventListener('input', () => this.handleInput());
607
489
  this.$textarea.addEventListener('focus', () => this.handleFocus());
608
490
  this.$textarea.addEventListener('blur', () => this.handleBlur());
609
491
  }
610
- handleKeyUp() {
492
+ handleInput() {
493
+ this.updateCount();
611
494
  this.updateVisibleCountMessage();
612
495
  this.lastInputTimestamp = Date.now();
613
496
  }
@@ -634,7 +517,7 @@
634
517
  this.updateScreenReaderCountMessage();
635
518
  }
636
519
  updateVisibleCountMessage() {
637
- const remainingNumber = this.maxLength - this.count(this.$textarea.value);
520
+ const remainingNumber = this.maxLength - this.count;
638
521
  const isError = remainingNumber < 0;
639
522
  this.$visibleCountMessage.classList.toggle('govuk-character-count__message--disabled', !this.isOverThreshold());
640
523
  if (!this.$errorMessage) {
@@ -652,16 +535,18 @@
652
535
  }
653
536
  this.$screenReaderCountMessage.textContent = this.getCountMessage();
654
537
  }
655
- count(text) {
538
+ updateCount() {
539
+ const text = this.$textarea.value;
656
540
  if (this.config.maxwords) {
657
541
  var _text$match;
658
542
  const tokens = (_text$match = text.match(/\S+/g)) != null ? _text$match : [];
659
- return tokens.length;
543
+ this.count = tokens.length;
544
+ return;
660
545
  }
661
- return text.length;
546
+ this.count = text.length;
662
547
  }
663
548
  getCountMessage() {
664
- const remainingNumber = this.maxLength - this.count(this.$textarea.value);
549
+ const remainingNumber = this.maxLength - this.count;
665
550
  const countType = this.config.maxwords ? 'words' : 'characters';
666
551
  return this.formatCountMessage(remainingNumber, countType);
667
552
  }
@@ -678,7 +563,7 @@
678
563
  if (!this.config.threshold) {
679
564
  return true;
680
565
  }
681
- const currentLength = this.count(this.$textarea.value);
566
+ const currentLength = this.count;
682
567
  const maxLength = this.maxLength;
683
568
  const thresholdValue = maxLength * this.config.threshold / 100;
684
569
  return thresholdValue <= currentLength;