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.
- checksums.yaml +4 -4
- data/.ruby-version +1 -0
- data/CHANGELOG.md +15 -0
- data/README.md +11 -3
- data/example/config/tech-docs.yml +1 -1
- data/govuk_tech_docs.gemspec +1 -1
- data/lib/assets/stylesheets/_core.scss +1 -0
- data/lib/assets/stylesheets/_govuk_tech_docs.scss +13 -15
- data/lib/assets/stylesheets/modules/_app-pane.scss +3 -3
- data/lib/assets/stylesheets/modules/_page-review.scss +4 -4
- data/lib/assets/stylesheets/modules/_search.scss +3 -3
- data/lib/assets/stylesheets/modules/_service-navigation.scss +5 -0
- data/lib/assets/stylesheets/modules/_technical-documentation.scss +7 -7
- data/lib/assets/stylesheets/modules/_toc.scss +13 -13
- data/lib/assets/stylesheets/palette/_syntax-highlighting.scss +9 -7
- data/lib/govuk_tech_docs/meta_tags.rb +1 -1
- data/lib/govuk_tech_docs/version.rb +1 -1
- data/lib/source/layouts/_header.erb +2 -16
- data/lib/source/layouts/_service_navigation.erb +27 -0
- data/lib/source/layouts/core.erb +7 -7
- data/node_modules/govuk-frontend/dist/govuk/_base.scss +1 -0
- data/node_modules/govuk-frontend/dist/govuk/all.bundle.js +87 -229
- data/node_modules/govuk-frontend/dist/govuk/all.bundle.mjs +88 -229
- data/node_modules/govuk-frontend/dist/govuk/all.mjs +0 -1
- data/node_modules/govuk-frontend/dist/govuk/assets/images/favicon.ico +0 -0
- data/node_modules/govuk-frontend/dist/govuk/assets/images/favicon.svg +1 -1
- data/node_modules/govuk-frontend/dist/govuk/assets/images/govuk-icon-180.png +0 -0
- data/node_modules/govuk-frontend/dist/govuk/assets/images/govuk-icon-192.png +0 -0
- data/node_modules/govuk-frontend/dist/govuk/assets/images/govuk-icon-512.png +0 -0
- data/node_modules/govuk-frontend/dist/govuk/assets/images/govuk-opengraph-image.png +0 -0
- data/node_modules/govuk-frontend/dist/govuk/common/govuk-frontend-version.mjs +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/accordion/_index.scss +18 -15
- data/node_modules/govuk-frontend/dist/govuk/components/accordion/accordion.bundle.js +1 -126
- data/node_modules/govuk-frontend/dist/govuk/components/accordion/accordion.bundle.mjs +1 -126
- data/node_modules/govuk-frontend/dist/govuk/components/back-link/_index.scss +2 -2
- data/node_modules/govuk-frontend/dist/govuk/components/breadcrumbs/_index.scss +2 -2
- data/node_modules/govuk-frontend/dist/govuk/components/button/_index.scss +18 -21
- data/node_modules/govuk-frontend/dist/govuk/components/character-count/_index.scss +2 -2
- data/node_modules/govuk-frontend/dist/govuk/components/character-count/character-count.bundle.js +20 -135
- data/node_modules/govuk-frontend/dist/govuk/components/character-count/character-count.bundle.mjs +20 -135
- data/node_modules/govuk-frontend/dist/govuk/components/character-count/character-count.mjs +19 -9
- data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/_index.scss +7 -6
- data/node_modules/govuk-frontend/dist/govuk/components/cookie-banner/_index.scss +2 -5
- data/node_modules/govuk-frontend/dist/govuk/components/date-input/_index.scss +5 -0
- data/node_modules/govuk-frontend/dist/govuk/components/details/_index.scss +6 -4
- data/node_modules/govuk-frontend/dist/govuk/components/error-message/_index.scss +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/error-summary/_index.scss +4 -2
- data/node_modules/govuk-frontend/dist/govuk/components/exit-this-page/_index.scss +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/exit-this-page/exit-this-page.bundle.js +1 -126
- data/node_modules/govuk-frontend/dist/govuk/components/exit-this-page/exit-this-page.bundle.mjs +1 -126
- data/node_modules/govuk-frontend/dist/govuk/components/file-upload/_index.scss +30 -38
- data/node_modules/govuk-frontend/dist/govuk/components/file-upload/file-upload.bundle.js +36 -132
- data/node_modules/govuk-frontend/dist/govuk/components/file-upload/file-upload.bundle.mjs +36 -132
- data/node_modules/govuk-frontend/dist/govuk/components/file-upload/file-upload.mjs +35 -6
- data/node_modules/govuk-frontend/dist/govuk/components/footer/_index.scss +30 -27
- data/node_modules/govuk-frontend/dist/govuk/components/header/_index.scss +89 -449
- data/node_modules/govuk-frontend/dist/govuk/components/hint/_index.scss +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/input/_index.scss +14 -20
- data/node_modules/govuk-frontend/dist/govuk/components/inset-text/_index.scss +2 -1
- data/node_modules/govuk-frontend/dist/govuk/components/notification-banner/_index.scss +10 -8
- data/node_modules/govuk-frontend/dist/govuk/components/pagination/_index.scss +12 -11
- data/node_modules/govuk-frontend/dist/govuk/components/panel/_index.scss +4 -4
- data/node_modules/govuk-frontend/dist/govuk/components/password-input/_index.scss +2 -2
- data/node_modules/govuk-frontend/dist/govuk/components/password-input/password-input.bundle.js +1 -126
- data/node_modules/govuk-frontend/dist/govuk/components/password-input/password-input.bundle.mjs +1 -126
- data/node_modules/govuk-frontend/dist/govuk/components/phase-banner/_index.scss +12 -6
- data/node_modules/govuk-frontend/dist/govuk/components/radios/_index.scss +8 -7
- data/node_modules/govuk-frontend/dist/govuk/components/select/_index.scss +6 -11
- data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/_index.scss +55 -76
- data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/service-navigation.bundle.js +30 -2
- data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/service-navigation.bundle.mjs +30 -2
- data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/service-navigation.mjs +30 -2
- data/node_modules/govuk-frontend/dist/govuk/components/skip-link/_index.scss +7 -2
- data/node_modules/govuk-frontend/dist/govuk/components/summary-list/_index.scss +25 -21
- data/node_modules/govuk-frontend/dist/govuk/components/table/_index.scss +7 -8
- data/node_modules/govuk-frontend/dist/govuk/components/tabs/_index.scss +9 -6
- data/node_modules/govuk-frontend/dist/govuk/components/tag/_index.scss +66 -31
- data/node_modules/govuk-frontend/dist/govuk/components/task-list/_index.scss +7 -5
- data/node_modules/govuk-frontend/dist/govuk/components/textarea/_index.scss +5 -10
- data/node_modules/govuk-frontend/dist/govuk/components/warning-text/_index.scss +5 -4
- data/node_modules/govuk-frontend/dist/govuk/core/_index.scss +0 -1
- data/node_modules/govuk-frontend/dist/govuk/core/_lists.scss +2 -2
- data/node_modules/govuk-frontend/dist/govuk/core/_section-break.scss +2 -1
- data/node_modules/govuk-frontend/dist/govuk/core/_typography.scss +6 -20
- data/node_modules/govuk-frontend/dist/govuk/custom-properties/_breakpoints.scss +17 -0
- data/node_modules/govuk-frontend/dist/govuk/custom-properties/_frontend-version.scss +15 -0
- data/node_modules/govuk-frontend/dist/govuk/custom-properties/_functional-colours.scss +17 -0
- data/node_modules/govuk-frontend/dist/govuk/custom-properties/_index.scss +5 -0
- data/node_modules/govuk-frontend/dist/govuk/govuk-frontend.min.js +1 -1
- data/node_modules/govuk-frontend/dist/govuk/helpers/_colour.scss +168 -82
- data/node_modules/govuk-frontend/dist/govuk/helpers/_focused.scss +41 -6
- data/node_modules/govuk-frontend/dist/govuk/helpers/_grid.scss +1 -1
- data/node_modules/govuk-frontend/dist/govuk/helpers/_links.scss +24 -40
- data/node_modules/govuk-frontend/dist/govuk/helpers/_media-queries.scss +172 -33
- data/node_modules/govuk-frontend/dist/govuk/helpers/_spacing.scss +1 -1
- data/node_modules/govuk-frontend/dist/govuk/helpers/_typography.scss +6 -30
- data/node_modules/govuk-frontend/dist/govuk/i18n.mjs +1 -126
- data/node_modules/govuk-frontend/dist/govuk/init.mjs +1 -2
- data/node_modules/govuk-frontend/dist/govuk/objects/_button-group.scss +1 -1
- data/node_modules/govuk-frontend/dist/govuk/objects/_form-group.scss +2 -1
- data/node_modules/govuk-frontend/dist/govuk/objects/_main-wrapper.scss +1 -1
- data/node_modules/govuk-frontend/dist/govuk/objects/_template.scss +3 -7
- data/node_modules/govuk-frontend/dist/govuk/objects/_width-container.scss +2 -2
- data/node_modules/govuk-frontend/dist/govuk/overrides/_display.scss +1 -1
- data/node_modules/govuk-frontend/dist/govuk/overrides/_typography.scss +0 -2
- data/node_modules/govuk-frontend/dist/govuk/overrides/_width.scss +5 -5
- data/node_modules/govuk-frontend/dist/govuk/settings/_colours-applied.scss +3 -188
- data/node_modules/govuk-frontend/dist/govuk/settings/_colours-functional.scss +366 -0
- data/node_modules/govuk-frontend/dist/govuk/settings/_colours-organisations.scss +9 -255
- data/node_modules/govuk-frontend/dist/govuk/settings/_colours-palette.scss +117 -25
- data/node_modules/govuk-frontend/dist/govuk/settings/_custom-properties.scss +18 -0
- data/node_modules/govuk-frontend/dist/govuk/settings/_index.scss +3 -14
- data/node_modules/govuk-frontend/dist/govuk/settings/_media-queries.scss +0 -9
- data/node_modules/govuk-frontend/dist/govuk/settings/_typography-responsive.scss +12 -189
- data/node_modules/govuk-frontend/dist/govuk/tools/_index.scss +0 -1
- data/node_modules/govuk-frontend/dist/govuk/tools/_px-to-em.scss +4 -2
- data/node_modules/govuk-frontend/dist/govuk/tools/_px-to-rem.scss +2 -0
- data/package-lock.json +3228 -4
- data/package.json +1 -1
- metadata +10 -26
- data/node_modules/govuk-frontend/dist/govuk/all.scss +0 -9
- data/node_modules/govuk-frontend/dist/govuk/assets/rebrand/images/favicon.ico +0 -0
- data/node_modules/govuk-frontend/dist/govuk/assets/rebrand/images/favicon.svg +0 -1
- data/node_modules/govuk-frontend/dist/govuk/assets/rebrand/images/govuk-crest.svg +0 -1
- data/node_modules/govuk-frontend/dist/govuk/assets/rebrand/images/govuk-icon-180.png +0 -0
- data/node_modules/govuk-frontend/dist/govuk/assets/rebrand/images/govuk-icon-192.png +0 -0
- data/node_modules/govuk-frontend/dist/govuk/assets/rebrand/images/govuk-icon-512.png +0 -0
- data/node_modules/govuk-frontend/dist/govuk/assets/rebrand/images/govuk-icon-mask.svg +0 -1
- data/node_modules/govuk-frontend/dist/govuk/assets/rebrand/images/govuk-opengraph-image.png +0 -0
- data/node_modules/govuk-frontend/dist/govuk/assets/rebrand/manifest.json +0 -39
- data/node_modules/govuk-frontend/dist/govuk/components/_all.scss +0 -10
- data/node_modules/govuk-frontend/dist/govuk/components/header/header.bundle.js +0 -238
- data/node_modules/govuk-frontend/dist/govuk/components/header/header.bundle.mjs +0 -230
- data/node_modules/govuk-frontend/dist/govuk/components/header/header.mjs +0 -89
- data/node_modules/govuk-frontend/dist/govuk/core/_all.scss +0 -10
- data/node_modules/govuk-frontend/dist/govuk/core/_govuk-frontend-properties.scss +0 -15
- data/node_modules/govuk-frontend/dist/govuk/helpers/_all.scss +0 -10
- data/node_modules/govuk-frontend/dist/govuk/objects/_all.scss +0 -10
- data/node_modules/govuk-frontend/dist/govuk/overrides/_all.scss +0 -9
- data/node_modules/govuk-frontend/dist/govuk/settings/_all.scss +0 -10
- data/node_modules/govuk-frontend/dist/govuk/tools/_all.scss +0 -10
- data/node_modules/govuk-frontend/dist/govuk/tools/_rebrand.scss +0 -65
- data/node_modules/govuk-frontend/dist/govuk/utilities/_all.scss +0 -10
- data/node_modules/govuk-frontend/dist/govuk/vendor/_sass-mq.scss +0 -349
- data/node_modules/govuk-frontend/dist/govuk-prototype-kit/functions.js +0 -25
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const version = '
|
|
1
|
+
const version = '6.0.0';
|
|
2
2
|
|
|
3
3
|
function getBreakpoint(name) {
|
|
4
4
|
const property = `--govuk-breakpoint-${name}`;
|
|
@@ -423,7 +423,7 @@ class I18n {
|
|
|
423
423
|
return 'other';
|
|
424
424
|
}
|
|
425
425
|
const translation = this.translations[lookupKey];
|
|
426
|
-
const preferredForm = this.hasIntlPluralRulesSupport() ? new Intl.PluralRules(this.locale).select(count) :
|
|
426
|
+
const preferredForm = this.hasIntlPluralRulesSupport() ? new Intl.PluralRules(this.locale).select(count) : 'other';
|
|
427
427
|
if (isObject(translation)) {
|
|
428
428
|
if (preferredForm in translation) {
|
|
429
429
|
return preferredForm;
|
|
@@ -434,132 +434,7 @@ class I18n {
|
|
|
434
434
|
}
|
|
435
435
|
throw new Error(`i18n: Plural form ".other" is required for "${this.locale}" locale`);
|
|
436
436
|
}
|
|
437
|
-
selectPluralFormUsingFallbackRules(count) {
|
|
438
|
-
count = Math.abs(Math.floor(count));
|
|
439
|
-
const ruleset = this.getPluralRulesForLocale();
|
|
440
|
-
if (ruleset) {
|
|
441
|
-
return I18n.pluralRules[ruleset](count);
|
|
442
|
-
}
|
|
443
|
-
return 'other';
|
|
444
|
-
}
|
|
445
|
-
getPluralRulesForLocale() {
|
|
446
|
-
const localeShort = this.locale.split('-')[0];
|
|
447
|
-
for (const pluralRule in I18n.pluralRulesMap) {
|
|
448
|
-
const languages = I18n.pluralRulesMap[pluralRule];
|
|
449
|
-
if (languages.includes(this.locale) || languages.includes(localeShort)) {
|
|
450
|
-
return pluralRule;
|
|
451
|
-
}
|
|
452
|
-
}
|
|
453
|
-
}
|
|
454
437
|
}
|
|
455
|
-
I18n.pluralRulesMap = {
|
|
456
|
-
arabic: ['ar'],
|
|
457
|
-
chinese: ['my', 'zh', 'id', 'ja', 'jv', 'ko', 'ms', 'th', 'vi'],
|
|
458
|
-
french: ['hy', 'bn', 'fr', 'gu', 'hi', 'fa', 'pa', 'zu'],
|
|
459
|
-
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'],
|
|
460
|
-
irish: ['ga'],
|
|
461
|
-
russian: ['ru', 'uk'],
|
|
462
|
-
scottish: ['gd'],
|
|
463
|
-
spanish: ['pt-PT', 'it', 'es'],
|
|
464
|
-
welsh: ['cy']
|
|
465
|
-
};
|
|
466
|
-
I18n.pluralRules = {
|
|
467
|
-
arabic(n) {
|
|
468
|
-
if (n === 0) {
|
|
469
|
-
return 'zero';
|
|
470
|
-
}
|
|
471
|
-
if (n === 1) {
|
|
472
|
-
return 'one';
|
|
473
|
-
}
|
|
474
|
-
if (n === 2) {
|
|
475
|
-
return 'two';
|
|
476
|
-
}
|
|
477
|
-
if (n % 100 >= 3 && n % 100 <= 10) {
|
|
478
|
-
return 'few';
|
|
479
|
-
}
|
|
480
|
-
if (n % 100 >= 11 && n % 100 <= 99) {
|
|
481
|
-
return 'many';
|
|
482
|
-
}
|
|
483
|
-
return 'other';
|
|
484
|
-
},
|
|
485
|
-
chinese() {
|
|
486
|
-
return 'other';
|
|
487
|
-
},
|
|
488
|
-
french(n) {
|
|
489
|
-
return n === 0 || n === 1 ? 'one' : 'other';
|
|
490
|
-
},
|
|
491
|
-
german(n) {
|
|
492
|
-
return n === 1 ? 'one' : 'other';
|
|
493
|
-
},
|
|
494
|
-
irish(n) {
|
|
495
|
-
if (n === 1) {
|
|
496
|
-
return 'one';
|
|
497
|
-
}
|
|
498
|
-
if (n === 2) {
|
|
499
|
-
return 'two';
|
|
500
|
-
}
|
|
501
|
-
if (n >= 3 && n <= 6) {
|
|
502
|
-
return 'few';
|
|
503
|
-
}
|
|
504
|
-
if (n >= 7 && n <= 10) {
|
|
505
|
-
return 'many';
|
|
506
|
-
}
|
|
507
|
-
return 'other';
|
|
508
|
-
},
|
|
509
|
-
russian(n) {
|
|
510
|
-
const lastTwo = n % 100;
|
|
511
|
-
const last = lastTwo % 10;
|
|
512
|
-
if (last === 1 && lastTwo !== 11) {
|
|
513
|
-
return 'one';
|
|
514
|
-
}
|
|
515
|
-
if (last >= 2 && last <= 4 && !(lastTwo >= 12 && lastTwo <= 14)) {
|
|
516
|
-
return 'few';
|
|
517
|
-
}
|
|
518
|
-
if (last === 0 || last >= 5 && last <= 9 || lastTwo >= 11 && lastTwo <= 14) {
|
|
519
|
-
return 'many';
|
|
520
|
-
}
|
|
521
|
-
return 'other';
|
|
522
|
-
},
|
|
523
|
-
scottish(n) {
|
|
524
|
-
if (n === 1 || n === 11) {
|
|
525
|
-
return 'one';
|
|
526
|
-
}
|
|
527
|
-
if (n === 2 || n === 12) {
|
|
528
|
-
return 'two';
|
|
529
|
-
}
|
|
530
|
-
if (n >= 3 && n <= 10 || n >= 13 && n <= 19) {
|
|
531
|
-
return 'few';
|
|
532
|
-
}
|
|
533
|
-
return 'other';
|
|
534
|
-
},
|
|
535
|
-
spanish(n) {
|
|
536
|
-
if (n === 1) {
|
|
537
|
-
return 'one';
|
|
538
|
-
}
|
|
539
|
-
if (n % 1000000 === 0 && n !== 0) {
|
|
540
|
-
return 'many';
|
|
541
|
-
}
|
|
542
|
-
return 'other';
|
|
543
|
-
},
|
|
544
|
-
welsh(n) {
|
|
545
|
-
if (n === 0) {
|
|
546
|
-
return 'zero';
|
|
547
|
-
}
|
|
548
|
-
if (n === 1) {
|
|
549
|
-
return 'one';
|
|
550
|
-
}
|
|
551
|
-
if (n === 2) {
|
|
552
|
-
return 'two';
|
|
553
|
-
}
|
|
554
|
-
if (n === 3) {
|
|
555
|
-
return 'few';
|
|
556
|
-
}
|
|
557
|
-
if (n === 6) {
|
|
558
|
-
return 'many';
|
|
559
|
-
}
|
|
560
|
-
return 'other';
|
|
561
|
-
}
|
|
562
|
-
};
|
|
563
438
|
|
|
564
439
|
/**
|
|
565
440
|
* Accordion component
|
|
@@ -1005,6 +880,7 @@ class CharacterCount extends ConfigurableComponent {
|
|
|
1005
880
|
var _ref, _this$config$maxwords;
|
|
1006
881
|
super($root, config);
|
|
1007
882
|
this.$textarea = void 0;
|
|
883
|
+
this.count = 0;
|
|
1008
884
|
this.$visibleCountMessage = void 0;
|
|
1009
885
|
this.$screenReaderCountMessage = void 0;
|
|
1010
886
|
this.lastInputTimestamp = null;
|
|
@@ -1060,15 +936,22 @@ class CharacterCount extends ConfigurableComponent {
|
|
|
1060
936
|
$textareaDescription.classList.add('govuk-visually-hidden');
|
|
1061
937
|
this.$textarea.removeAttribute('maxlength');
|
|
1062
938
|
this.bindChangeEvents();
|
|
1063
|
-
window.addEventListener('pageshow', () =>
|
|
939
|
+
window.addEventListener('pageshow', () => {
|
|
940
|
+
if (this.$textarea.value !== this.$textarea.textContent) {
|
|
941
|
+
this.updateCount();
|
|
942
|
+
this.updateCountMessage();
|
|
943
|
+
}
|
|
944
|
+
});
|
|
945
|
+
this.updateCount();
|
|
1064
946
|
this.updateCountMessage();
|
|
1065
947
|
}
|
|
1066
948
|
bindChangeEvents() {
|
|
1067
|
-
this.$textarea.addEventListener('
|
|
949
|
+
this.$textarea.addEventListener('input', () => this.handleInput());
|
|
1068
950
|
this.$textarea.addEventListener('focus', () => this.handleFocus());
|
|
1069
951
|
this.$textarea.addEventListener('blur', () => this.handleBlur());
|
|
1070
952
|
}
|
|
1071
|
-
|
|
953
|
+
handleInput() {
|
|
954
|
+
this.updateCount();
|
|
1072
955
|
this.updateVisibleCountMessage();
|
|
1073
956
|
this.lastInputTimestamp = Date.now();
|
|
1074
957
|
}
|
|
@@ -1095,7 +978,7 @@ class CharacterCount extends ConfigurableComponent {
|
|
|
1095
978
|
this.updateScreenReaderCountMessage();
|
|
1096
979
|
}
|
|
1097
980
|
updateVisibleCountMessage() {
|
|
1098
|
-
const remainingNumber = this.maxLength - this.count
|
|
981
|
+
const remainingNumber = this.maxLength - this.count;
|
|
1099
982
|
const isError = remainingNumber < 0;
|
|
1100
983
|
this.$visibleCountMessage.classList.toggle('govuk-character-count__message--disabled', !this.isOverThreshold());
|
|
1101
984
|
if (!this.$errorMessage) {
|
|
@@ -1113,16 +996,18 @@ class CharacterCount extends ConfigurableComponent {
|
|
|
1113
996
|
}
|
|
1114
997
|
this.$screenReaderCountMessage.textContent = this.getCountMessage();
|
|
1115
998
|
}
|
|
1116
|
-
|
|
999
|
+
updateCount() {
|
|
1000
|
+
const text = this.$textarea.value;
|
|
1117
1001
|
if (this.config.maxwords) {
|
|
1118
1002
|
var _text$match;
|
|
1119
1003
|
const tokens = (_text$match = text.match(/\S+/g)) != null ? _text$match : [];
|
|
1120
|
-
|
|
1004
|
+
this.count = tokens.length;
|
|
1005
|
+
return;
|
|
1121
1006
|
}
|
|
1122
|
-
|
|
1007
|
+
this.count = text.length;
|
|
1123
1008
|
}
|
|
1124
1009
|
getCountMessage() {
|
|
1125
|
-
const remainingNumber = this.maxLength - this.count
|
|
1010
|
+
const remainingNumber = this.maxLength - this.count;
|
|
1126
1011
|
const countType = this.config.maxwords ? 'words' : 'characters';
|
|
1127
1012
|
return this.formatCountMessage(remainingNumber, countType);
|
|
1128
1013
|
}
|
|
@@ -1139,7 +1024,7 @@ class CharacterCount extends ConfigurableComponent {
|
|
|
1139
1024
|
if (!this.config.threshold) {
|
|
1140
1025
|
return true;
|
|
1141
1026
|
}
|
|
1142
|
-
const currentLength = this.count
|
|
1027
|
+
const currentLength = this.count;
|
|
1143
1028
|
const maxLength = this.maxLength;
|
|
1144
1029
|
const thresholdValue = maxLength * this.config.threshold / 100;
|
|
1145
1030
|
return thresholdValue <= currentLength;
|
|
@@ -1795,7 +1680,7 @@ class FileUpload extends ConfigurableComponent {
|
|
|
1795
1680
|
if (this.$button.disabled) return;
|
|
1796
1681
|
if (event.target instanceof Node) {
|
|
1797
1682
|
if (this.$root.contains(event.target)) {
|
|
1798
|
-
if (event.dataTransfer &&
|
|
1683
|
+
if (event.dataTransfer && this.canDrop(event.dataTransfer)) {
|
|
1799
1684
|
if (!this.$button.classList.contains('govuk-file-upload-button--dragging')) {
|
|
1800
1685
|
this.showDraggingState();
|
|
1801
1686
|
this.$announcements.innerText = this.i18n.t('enteredDropZone');
|
|
@@ -1817,12 +1702,30 @@ class FileUpload extends ConfigurableComponent {
|
|
|
1817
1702
|
}
|
|
1818
1703
|
onDrop(event) {
|
|
1819
1704
|
event.preventDefault();
|
|
1820
|
-
if (event.dataTransfer &&
|
|
1705
|
+
if (event.dataTransfer && this.canFillInput(event.dataTransfer)) {
|
|
1821
1706
|
this.$input.files = event.dataTransfer.files;
|
|
1822
1707
|
this.$input.dispatchEvent(new CustomEvent('change'));
|
|
1823
1708
|
this.hideDraggingState();
|
|
1824
1709
|
}
|
|
1825
1710
|
}
|
|
1711
|
+
canFillInput(dataTransfer) {
|
|
1712
|
+
return this.matchesInputCapacity(dataTransfer.files.length);
|
|
1713
|
+
}
|
|
1714
|
+
canDrop(dataTransfer) {
|
|
1715
|
+
if (dataTransfer.items.length) {
|
|
1716
|
+
return this.matchesInputCapacity(countFileItems(dataTransfer.items));
|
|
1717
|
+
}
|
|
1718
|
+
if (dataTransfer.types.length) {
|
|
1719
|
+
return dataTransfer.types.includes('Files');
|
|
1720
|
+
}
|
|
1721
|
+
return true;
|
|
1722
|
+
}
|
|
1723
|
+
matchesInputCapacity(numberOfFiles) {
|
|
1724
|
+
if (this.$input.multiple) {
|
|
1725
|
+
return numberOfFiles > 0;
|
|
1726
|
+
}
|
|
1727
|
+
return numberOfFiles === 1;
|
|
1728
|
+
}
|
|
1826
1729
|
onChange() {
|
|
1827
1730
|
const fileCount = this.$input.files.length;
|
|
1828
1731
|
if (fileCount === 0) {
|
|
@@ -1869,6 +1772,13 @@ class FileUpload extends ConfigurableComponent {
|
|
|
1869
1772
|
this.$root.classList.toggle('govuk-drop-zone--disabled', this.$button.disabled);
|
|
1870
1773
|
}
|
|
1871
1774
|
}
|
|
1775
|
+
|
|
1776
|
+
/**
|
|
1777
|
+
* Counts the number of `DataTransferItem` whose kind is `file`
|
|
1778
|
+
*
|
|
1779
|
+
* @param {DataTransferItemList} list - The list
|
|
1780
|
+
* @returns {number} - The number of items whose kind is `file` in the list
|
|
1781
|
+
*/
|
|
1872
1782
|
FileUpload.moduleName = 'govuk-file-upload';
|
|
1873
1783
|
FileUpload.defaults = Object.freeze({
|
|
1874
1784
|
i18n: {
|
|
@@ -1890,10 +1800,14 @@ FileUpload.schema = Object.freeze({
|
|
|
1890
1800
|
}
|
|
1891
1801
|
}
|
|
1892
1802
|
});
|
|
1893
|
-
function
|
|
1894
|
-
|
|
1895
|
-
|
|
1896
|
-
|
|
1803
|
+
function countFileItems(list) {
|
|
1804
|
+
let result = 0;
|
|
1805
|
+
for (let i = 0; i < list.length; i++) {
|
|
1806
|
+
if (list[i].kind === 'file') {
|
|
1807
|
+
result++;
|
|
1808
|
+
}
|
|
1809
|
+
}
|
|
1810
|
+
return result;
|
|
1897
1811
|
}
|
|
1898
1812
|
|
|
1899
1813
|
/**
|
|
@@ -1931,89 +1845,6 @@ function isContainingFiles(dataTransfer) {
|
|
|
1931
1845
|
* @import { TranslationPluralForms } from '../../i18n.mjs'
|
|
1932
1846
|
*/
|
|
1933
1847
|
|
|
1934
|
-
/**
|
|
1935
|
-
* Header component
|
|
1936
|
-
*
|
|
1937
|
-
* @preserve
|
|
1938
|
-
*/
|
|
1939
|
-
class Header extends Component {
|
|
1940
|
-
/**
|
|
1941
|
-
* Apply a matchMedia for desktop which will trigger a state sync if the
|
|
1942
|
-
* browser viewport moves between states.
|
|
1943
|
-
*
|
|
1944
|
-
* @param {Element | null} $root - HTML element to use for header
|
|
1945
|
-
*/
|
|
1946
|
-
constructor($root) {
|
|
1947
|
-
super($root);
|
|
1948
|
-
this.$menuButton = void 0;
|
|
1949
|
-
this.$menu = void 0;
|
|
1950
|
-
this.menuIsOpen = false;
|
|
1951
|
-
this.mql = null;
|
|
1952
|
-
const $menuButton = this.$root.querySelector('.govuk-js-header-toggle');
|
|
1953
|
-
if (!$menuButton) {
|
|
1954
|
-
return this;
|
|
1955
|
-
}
|
|
1956
|
-
this.$root.classList.add('govuk-header--with-js-navigation');
|
|
1957
|
-
const menuId = $menuButton.getAttribute('aria-controls');
|
|
1958
|
-
if (!menuId) {
|
|
1959
|
-
throw new ElementError({
|
|
1960
|
-
component: Header,
|
|
1961
|
-
identifier: 'Navigation button (`<button class="govuk-js-header-toggle">`) attribute (`aria-controls`)'
|
|
1962
|
-
});
|
|
1963
|
-
}
|
|
1964
|
-
const $menu = document.getElementById(menuId);
|
|
1965
|
-
if (!$menu) {
|
|
1966
|
-
throw new ElementError({
|
|
1967
|
-
component: Header,
|
|
1968
|
-
element: $menu,
|
|
1969
|
-
identifier: `Navigation (\`<ul id="${menuId}">\`)`
|
|
1970
|
-
});
|
|
1971
|
-
}
|
|
1972
|
-
this.$menu = $menu;
|
|
1973
|
-
this.$menuButton = $menuButton;
|
|
1974
|
-
this.setupResponsiveChecks();
|
|
1975
|
-
this.$menuButton.addEventListener('click', () => this.handleMenuButtonClick());
|
|
1976
|
-
}
|
|
1977
|
-
setupResponsiveChecks() {
|
|
1978
|
-
const breakpoint = getBreakpoint('desktop');
|
|
1979
|
-
if (!breakpoint.value) {
|
|
1980
|
-
throw new ElementError({
|
|
1981
|
-
component: Header,
|
|
1982
|
-
identifier: `CSS custom property (\`${breakpoint.property}\`) on pseudo-class \`:root\``
|
|
1983
|
-
});
|
|
1984
|
-
}
|
|
1985
|
-
this.mql = window.matchMedia(`(min-width: ${breakpoint.value})`);
|
|
1986
|
-
if ('addEventListener' in this.mql) {
|
|
1987
|
-
this.mql.addEventListener('change', () => this.checkMode());
|
|
1988
|
-
} else {
|
|
1989
|
-
this.mql.addListener(() => this.checkMode());
|
|
1990
|
-
}
|
|
1991
|
-
this.checkMode();
|
|
1992
|
-
}
|
|
1993
|
-
checkMode() {
|
|
1994
|
-
if (!this.mql || !this.$menu || !this.$menuButton) {
|
|
1995
|
-
return;
|
|
1996
|
-
}
|
|
1997
|
-
if (this.mql.matches) {
|
|
1998
|
-
this.$menu.removeAttribute('hidden');
|
|
1999
|
-
this.$menuButton.setAttribute('hidden', '');
|
|
2000
|
-
} else {
|
|
2001
|
-
this.$menuButton.removeAttribute('hidden');
|
|
2002
|
-
this.$menuButton.setAttribute('aria-expanded', this.menuIsOpen.toString());
|
|
2003
|
-
if (this.menuIsOpen) {
|
|
2004
|
-
this.$menu.removeAttribute('hidden');
|
|
2005
|
-
} else {
|
|
2006
|
-
this.$menu.setAttribute('hidden', '');
|
|
2007
|
-
}
|
|
2008
|
-
}
|
|
2009
|
-
}
|
|
2010
|
-
handleMenuButtonClick() {
|
|
2011
|
-
this.menuIsOpen = !this.menuIsOpen;
|
|
2012
|
-
this.checkMode();
|
|
2013
|
-
}
|
|
2014
|
-
}
|
|
2015
|
-
Header.moduleName = 'govuk-header';
|
|
2016
|
-
|
|
2017
1848
|
/**
|
|
2018
1849
|
* Notification Banner component
|
|
2019
1850
|
*
|
|
@@ -2345,9 +2176,9 @@ class ServiceNavigation extends Component {
|
|
|
2345
2176
|
}
|
|
2346
2177
|
if (this.mql.matches) {
|
|
2347
2178
|
this.$menu.removeAttribute('hidden');
|
|
2348
|
-
this.$menuButton
|
|
2179
|
+
setAttributes(this.$menuButton, attributesForHidingButton);
|
|
2349
2180
|
} else {
|
|
2350
|
-
this.$menuButton.
|
|
2181
|
+
removeAttributes(this.$menuButton, Object.keys(attributesForHidingButton));
|
|
2351
2182
|
this.$menuButton.setAttribute('aria-expanded', this.menuIsOpen.toString());
|
|
2352
2183
|
if (this.menuIsOpen) {
|
|
2353
2184
|
this.$menu.removeAttribute('hidden');
|
|
@@ -2362,6 +2193,34 @@ class ServiceNavigation extends Component {
|
|
|
2362
2193
|
}
|
|
2363
2194
|
}
|
|
2364
2195
|
ServiceNavigation.moduleName = 'govuk-service-navigation';
|
|
2196
|
+
const attributesForHidingButton = {
|
|
2197
|
+
hidden: '',
|
|
2198
|
+
'aria-hidden': 'true'
|
|
2199
|
+
};
|
|
2200
|
+
|
|
2201
|
+
/**
|
|
2202
|
+
* Sets a group of attributes on the given element
|
|
2203
|
+
*
|
|
2204
|
+
* @param {Element} $element - The element to set the attribute on
|
|
2205
|
+
* @param {{[attributeName: string]: string}} attributes - The attributes to set
|
|
2206
|
+
*/
|
|
2207
|
+
function setAttributes($element, attributes) {
|
|
2208
|
+
for (const attributeName in attributes) {
|
|
2209
|
+
$element.setAttribute(attributeName, attributes[attributeName]);
|
|
2210
|
+
}
|
|
2211
|
+
}
|
|
2212
|
+
|
|
2213
|
+
/**
|
|
2214
|
+
* Removes a list of attributes from the given element
|
|
2215
|
+
*
|
|
2216
|
+
* @param {Element} $element - The element to remove the attributes from
|
|
2217
|
+
* @param {string[]} attributeNames - The names of the attributes to remove
|
|
2218
|
+
*/
|
|
2219
|
+
function removeAttributes($element, attributeNames) {
|
|
2220
|
+
for (const attributeName of attributeNames) {
|
|
2221
|
+
$element.removeAttribute(attributeName);
|
|
2222
|
+
}
|
|
2223
|
+
}
|
|
2365
2224
|
|
|
2366
2225
|
/**
|
|
2367
2226
|
* Skip link component
|
|
@@ -2717,7 +2576,7 @@ function initAll(scopeOrConfig = {}) {
|
|
|
2717
2576
|
}
|
|
2718
2577
|
return;
|
|
2719
2578
|
}
|
|
2720
|
-
const components = [[Accordion, config.accordion], [Button, config.button], [CharacterCount, config.characterCount], [Checkboxes], [ErrorSummary, config.errorSummary], [ExitThisPage, config.exitThisPage], [FileUpload, config.fileUpload], [
|
|
2579
|
+
const components = [[Accordion, config.accordion], [Button, config.button], [CharacterCount, config.characterCount], [Checkboxes], [ErrorSummary, config.errorSummary], [ExitThisPage, config.exitThisPage], [FileUpload, config.fileUpload], [NotificationBanner, config.notificationBanner], [PasswordInput, config.passwordInput], [Radios], [ServiceNavigation], [SkipLink], [Tabs]];
|
|
2721
2580
|
components.forEach(([Component, componentConfig]) => {
|
|
2722
2581
|
createAll(Component, componentConfig, options);
|
|
2723
2582
|
});
|
|
@@ -2841,5 +2700,5 @@ function createAll(Component, config, scopeOrOptions) {
|
|
|
2841
2700
|
* @property {OnErrorCallback<ComponentClass>} [onError] - callback function if error throw by component on init
|
|
2842
2701
|
*/
|
|
2843
2702
|
|
|
2844
|
-
export { Accordion, Button, CharacterCount, Checkboxes, Component, ConfigurableComponent, ErrorSummary, ExitThisPage, FileUpload,
|
|
2703
|
+
export { Accordion, Button, CharacterCount, Checkboxes, Component, ConfigurableComponent, ErrorSummary, ExitThisPage, FileUpload, NotificationBanner, PasswordInput, Radios, ServiceNavigation, SkipLink, Tabs, createAll, initAll, isSupported, version };
|
|
2845
2704
|
//# sourceMappingURL=all.bundle.mjs.map
|
|
@@ -6,7 +6,6 @@ export { Checkboxes } from './components/checkboxes/checkboxes.mjs';
|
|
|
6
6
|
export { ErrorSummary } from './components/error-summary/error-summary.mjs';
|
|
7
7
|
export { ExitThisPage } from './components/exit-this-page/exit-this-page.mjs';
|
|
8
8
|
export { FileUpload } from './components/file-upload/file-upload.mjs';
|
|
9
|
-
export { Header } from './components/header/header.mjs';
|
|
10
9
|
export { NotificationBanner } from './components/notification-banner/notification-banner.mjs';
|
|
11
10
|
export { PasswordInput } from './components/password-input/password-input.mjs';
|
|
12
11
|
export { Radios } from './components/radios/radios.mjs';
|
|
Binary file
|
|
@@ -1 +1 @@
|
|
|
1
|
-
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path fill="#
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path fill="#1D70B8" d="M0 0h32v32H0z"/><path fill="#fff" d="m16.88 7.87 2.11 1.1V5.86l-2.11.67c-.06-.08-.13-.15-.2-.21s.85-2.68.85-2.68h-3.04l.85 2.67c-.08.07-.15.14-.2.21s-2.11-.66-2.11-.66v3.11l2.11-1.11c.06.09.14.16.22.22l-1.21 3.66v.01c0 .01 0 0 0 0-.06.18-.09.38-.09.58 0 .99.73 1.81 1.68 1.95h.04c.08.01.16.02.25.02.08 0 .17 0 .25-.02h.04c.95-.14 1.68-.96 1.68-1.95 0-.2-.03-.39-.09-.58s0 0 0-.01L16.7 8.08c.08-.06.16-.13.22-.22M9.16 12.3a1.75 1.75 0 1 0 1.52-3.15c-.86-.41-1.91-.04-2.33.83s-.05 1.91.81 2.32M4.82 15.87c.9.37 1.92-.05 2.29-.94s-.05-1.92-.95-2.29c-.88-.36-1.91.07-2.28.96s.06 1.91.94 2.27M22.86 12.3a1.75 1.75 0 1 1-1.52-3.15c.86-.41 1.91-.04 2.33.83s.05 1.91-.81 2.32M27.18 15.84c-.9.37-1.92-.05-2.29-.94s.05-1.92.95-2.29c.88-.36 1.91.07 2.28.96s-.06 1.91-.94 2.27M16 25.68c3.59 0 6.99.24 10.02.68.86-3.61 1.91-5.68 2.99-7.16l-2.03-.72c.2 1.03.23 1.51 0 2.18-.34-.33-.65-.93-.9-1.85l-.99 3.28c.6-.41 1.06-.68 1.59-.69-.94 2.02-2.11 2.54-2.87 2.4-.93-.17-1.35-1-1.21-1.7.21-.99 1.23-1.25 1.71-.1.91-1.86-.63-2.44-1.63-1.89 1.53-1.52 1.7-2.88.47-4.52-1.72 1.31-1.74 2.61-.97 4.44-1-1.15-2.56-.53-2 1.32.72-1.12 1.68-.42 1.53.65-.13.93-1.35 1.68-2.87 1.54-2.18-.2-2.31-1.71-2.37-2.95.54-.1 1.5.4 2.33 1.56l.3-3.48c-.9.93-1.71 1.11-2.62 1.14.3-.94 1.69-2.48 1.69-2.48h-4.34s1.38 1.54 1.69 2.48c-.91-.03-1.72-.21-2.62-1.14l.3 3.48c.82-1.16 1.79-1.66 2.33-1.56-.05 1.25-.18 2.75-2.37 2.95-1.52.13-2.75-.62-2.87-1.54-.15-1.06.81-1.77 1.53-.65.56-1.85-1-2.47-2-1.32.77-1.83.75-3.13-.97-4.44-1.23 1.64-1.06 2.99.47 4.52-.99-.55-2.54.03-1.63 1.89.48-1.16 1.5-.9 1.71.1.14.7-.28 1.53-1.21 1.7-.76.14-1.93-.38-2.87-2.4.53.01.99.28 1.59.69l-.99-3.28c-.25.92-.57 1.52-.9 1.85-.23-.66-.19-1.14 0-2.18l-2.03.72c1.08 1.47 2.13 3.54 2.99 7.16 3.03-.43 6.42-.68 10.01-.68"/></svg>
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
@include govuk-exports("govuk/component/accordion") {
|
|
2
2
|
$govuk-accordion-base-colour: govuk-colour("black");
|
|
3
|
-
$govuk-accordion-hover-colour: govuk-colour("
|
|
4
|
-
$govuk-accordion-icon-focus-colour:
|
|
3
|
+
$govuk-accordion-hover-colour: govuk-colour("black", $variant: "tint-95");
|
|
4
|
+
$govuk-accordion-icon-focus-colour: govuk-functional-colour(focus);
|
|
5
5
|
$govuk-accordion-bottom-border-width: 1px;
|
|
6
6
|
|
|
7
7
|
.govuk-accordion {
|
|
@@ -39,7 +39,8 @@
|
|
|
39
39
|
.govuk-frontend-supported {
|
|
40
40
|
.govuk-accordion {
|
|
41
41
|
// Border at the bottom of the whole accordion
|
|
42
|
-
border-bottom: $govuk-accordion-bottom-border-width solid
|
|
42
|
+
border-bottom: $govuk-accordion-bottom-border-width solid;
|
|
43
|
+
border-bottom-color: govuk-functional-colour(border);
|
|
43
44
|
}
|
|
44
45
|
|
|
45
46
|
.govuk-accordion__section {
|
|
@@ -83,13 +84,13 @@
|
|
|
83
84
|
|
|
84
85
|
border-width: 0;
|
|
85
86
|
|
|
86
|
-
color:
|
|
87
|
+
color: govuk-functional-colour(link);
|
|
87
88
|
background: none;
|
|
88
89
|
|
|
89
90
|
cursor: pointer;
|
|
90
91
|
-webkit-appearance: none;
|
|
91
92
|
|
|
92
|
-
@
|
|
93
|
+
@media #{govuk-from-breakpoint(tablet)} {
|
|
93
94
|
margin-bottom: 14px;
|
|
94
95
|
}
|
|
95
96
|
|
|
@@ -188,14 +189,16 @@
|
|
|
188
189
|
|
|
189
190
|
border: 0;
|
|
190
191
|
|
|
191
|
-
border-top: $govuk-accordion-bottom-border-width solid
|
|
192
|
+
border-top: $govuk-accordion-bottom-border-width solid;
|
|
192
193
|
|
|
193
194
|
// Visually separate the section from the one underneath when user changes
|
|
194
195
|
// colours in their browser. See
|
|
195
196
|
// https://github.com/alphagov/govuk-frontend/issues/2321#issuecomment-924201488
|
|
196
197
|
border-bottom: govuk-spacing(2) solid transparent;
|
|
197
198
|
|
|
198
|
-
color:
|
|
199
|
+
border-top-color: govuk-functional-colour(border);
|
|
200
|
+
|
|
201
|
+
color: govuk-functional-colour(text);
|
|
199
202
|
background: none;
|
|
200
203
|
|
|
201
204
|
text-align: left;
|
|
@@ -203,12 +206,12 @@
|
|
|
203
206
|
cursor: pointer;
|
|
204
207
|
-webkit-appearance: none;
|
|
205
208
|
|
|
206
|
-
@
|
|
209
|
+
@media #{govuk-from-breakpoint(tablet)} {
|
|
207
210
|
padding-bottom: govuk-spacing(2);
|
|
208
211
|
}
|
|
209
212
|
|
|
210
213
|
&:active {
|
|
211
|
-
color:
|
|
214
|
+
color: govuk-functional-colour(link-active);
|
|
212
215
|
background: none;
|
|
213
216
|
}
|
|
214
217
|
|
|
@@ -266,7 +269,7 @@
|
|
|
266
269
|
padding-bottom: govuk-spacing(3);
|
|
267
270
|
border-bottom: 0;
|
|
268
271
|
|
|
269
|
-
@
|
|
272
|
+
@media #{govuk-from-breakpoint(tablet)} {
|
|
270
273
|
padding-bottom: govuk-spacing(4);
|
|
271
274
|
}
|
|
272
275
|
}
|
|
@@ -276,7 +279,7 @@
|
|
|
276
279
|
.govuk-accordion__section-button:focus .govuk-accordion__section-toggle-focus {
|
|
277
280
|
padding-bottom: 3px;
|
|
278
281
|
|
|
279
|
-
@
|
|
282
|
+
@media #{govuk-from-breakpoint(desktop)} {
|
|
280
283
|
padding-bottom: 2px;
|
|
281
284
|
}
|
|
282
285
|
}
|
|
@@ -298,7 +301,7 @@
|
|
|
298
301
|
.govuk-accordion__section-toggle {
|
|
299
302
|
@include govuk-font-size($size: 19);
|
|
300
303
|
@include govuk-typography-weight-regular;
|
|
301
|
-
color:
|
|
304
|
+
color: govuk-functional-colour(link);
|
|
302
305
|
}
|
|
303
306
|
|
|
304
307
|
// Add space between the icon and text. Avoid applying spacing directly to
|
|
@@ -355,12 +358,12 @@
|
|
|
355
358
|
// remove hover state as it can be stuck in that state (iOS).
|
|
356
359
|
@media (hover: none) {
|
|
357
360
|
.govuk-accordion__section-header:hover {
|
|
358
|
-
border-top-color:
|
|
361
|
+
border-top-color: govuk-functional-colour(border);
|
|
359
362
|
|
|
360
|
-
box-shadow: inset 0 3px 0 0
|
|
363
|
+
box-shadow: inset 0 3px 0 0 govuk-functional-colour(link);
|
|
361
364
|
|
|
362
365
|
.govuk-accordion__section-button {
|
|
363
|
-
border-top-color:
|
|
366
|
+
border-top-color: govuk-functional-colour(border);
|
|
364
367
|
}
|
|
365
368
|
}
|
|
366
369
|
}
|