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
|
@@ -347,7 +347,7 @@ class I18n {
|
|
|
347
347
|
return 'other';
|
|
348
348
|
}
|
|
349
349
|
const translation = this.translations[lookupKey];
|
|
350
|
-
const preferredForm = this.hasIntlPluralRulesSupport() ? new Intl.PluralRules(this.locale).select(count) :
|
|
350
|
+
const preferredForm = this.hasIntlPluralRulesSupport() ? new Intl.PluralRules(this.locale).select(count) : 'other';
|
|
351
351
|
if (isObject(translation)) {
|
|
352
352
|
if (preferredForm in translation) {
|
|
353
353
|
return preferredForm;
|
|
@@ -358,132 +358,7 @@ class I18n {
|
|
|
358
358
|
}
|
|
359
359
|
throw new Error(`i18n: Plural form ".other" is required for "${this.locale}" locale`);
|
|
360
360
|
}
|
|
361
|
-
selectPluralFormUsingFallbackRules(count) {
|
|
362
|
-
count = Math.abs(Math.floor(count));
|
|
363
|
-
const ruleset = this.getPluralRulesForLocale();
|
|
364
|
-
if (ruleset) {
|
|
365
|
-
return I18n.pluralRules[ruleset](count);
|
|
366
|
-
}
|
|
367
|
-
return 'other';
|
|
368
|
-
}
|
|
369
|
-
getPluralRulesForLocale() {
|
|
370
|
-
const localeShort = this.locale.split('-')[0];
|
|
371
|
-
for (const pluralRule in I18n.pluralRulesMap) {
|
|
372
|
-
const languages = I18n.pluralRulesMap[pluralRule];
|
|
373
|
-
if (languages.includes(this.locale) || languages.includes(localeShort)) {
|
|
374
|
-
return pluralRule;
|
|
375
|
-
}
|
|
376
|
-
}
|
|
377
|
-
}
|
|
378
361
|
}
|
|
379
|
-
I18n.pluralRulesMap = {
|
|
380
|
-
arabic: ['ar'],
|
|
381
|
-
chinese: ['my', 'zh', 'id', 'ja', 'jv', 'ko', 'ms', 'th', 'vi'],
|
|
382
|
-
french: ['hy', 'bn', 'fr', 'gu', 'hi', 'fa', 'pa', 'zu'],
|
|
383
|
-
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'],
|
|
384
|
-
irish: ['ga'],
|
|
385
|
-
russian: ['ru', 'uk'],
|
|
386
|
-
scottish: ['gd'],
|
|
387
|
-
spanish: ['pt-PT', 'it', 'es'],
|
|
388
|
-
welsh: ['cy']
|
|
389
|
-
};
|
|
390
|
-
I18n.pluralRules = {
|
|
391
|
-
arabic(n) {
|
|
392
|
-
if (n === 0) {
|
|
393
|
-
return 'zero';
|
|
394
|
-
}
|
|
395
|
-
if (n === 1) {
|
|
396
|
-
return 'one';
|
|
397
|
-
}
|
|
398
|
-
if (n === 2) {
|
|
399
|
-
return 'two';
|
|
400
|
-
}
|
|
401
|
-
if (n % 100 >= 3 && n % 100 <= 10) {
|
|
402
|
-
return 'few';
|
|
403
|
-
}
|
|
404
|
-
if (n % 100 >= 11 && n % 100 <= 99) {
|
|
405
|
-
return 'many';
|
|
406
|
-
}
|
|
407
|
-
return 'other';
|
|
408
|
-
},
|
|
409
|
-
chinese() {
|
|
410
|
-
return 'other';
|
|
411
|
-
},
|
|
412
|
-
french(n) {
|
|
413
|
-
return n === 0 || n === 1 ? 'one' : 'other';
|
|
414
|
-
},
|
|
415
|
-
german(n) {
|
|
416
|
-
return n === 1 ? 'one' : 'other';
|
|
417
|
-
},
|
|
418
|
-
irish(n) {
|
|
419
|
-
if (n === 1) {
|
|
420
|
-
return 'one';
|
|
421
|
-
}
|
|
422
|
-
if (n === 2) {
|
|
423
|
-
return 'two';
|
|
424
|
-
}
|
|
425
|
-
if (n >= 3 && n <= 6) {
|
|
426
|
-
return 'few';
|
|
427
|
-
}
|
|
428
|
-
if (n >= 7 && n <= 10) {
|
|
429
|
-
return 'many';
|
|
430
|
-
}
|
|
431
|
-
return 'other';
|
|
432
|
-
},
|
|
433
|
-
russian(n) {
|
|
434
|
-
const lastTwo = n % 100;
|
|
435
|
-
const last = lastTwo % 10;
|
|
436
|
-
if (last === 1 && lastTwo !== 11) {
|
|
437
|
-
return 'one';
|
|
438
|
-
}
|
|
439
|
-
if (last >= 2 && last <= 4 && !(lastTwo >= 12 && lastTwo <= 14)) {
|
|
440
|
-
return 'few';
|
|
441
|
-
}
|
|
442
|
-
if (last === 0 || last >= 5 && last <= 9 || lastTwo >= 11 && lastTwo <= 14) {
|
|
443
|
-
return 'many';
|
|
444
|
-
}
|
|
445
|
-
return 'other';
|
|
446
|
-
},
|
|
447
|
-
scottish(n) {
|
|
448
|
-
if (n === 1 || n === 11) {
|
|
449
|
-
return 'one';
|
|
450
|
-
}
|
|
451
|
-
if (n === 2 || n === 12) {
|
|
452
|
-
return 'two';
|
|
453
|
-
}
|
|
454
|
-
if (n >= 3 && n <= 10 || n >= 13 && n <= 19) {
|
|
455
|
-
return 'few';
|
|
456
|
-
}
|
|
457
|
-
return 'other';
|
|
458
|
-
},
|
|
459
|
-
spanish(n) {
|
|
460
|
-
if (n === 1) {
|
|
461
|
-
return 'one';
|
|
462
|
-
}
|
|
463
|
-
if (n % 1000000 === 0 && n !== 0) {
|
|
464
|
-
return 'many';
|
|
465
|
-
}
|
|
466
|
-
return 'other';
|
|
467
|
-
},
|
|
468
|
-
welsh(n) {
|
|
469
|
-
if (n === 0) {
|
|
470
|
-
return 'zero';
|
|
471
|
-
}
|
|
472
|
-
if (n === 1) {
|
|
473
|
-
return 'one';
|
|
474
|
-
}
|
|
475
|
-
if (n === 2) {
|
|
476
|
-
return 'two';
|
|
477
|
-
}
|
|
478
|
-
if (n === 3) {
|
|
479
|
-
return 'few';
|
|
480
|
-
}
|
|
481
|
-
if (n === 6) {
|
|
482
|
-
return 'many';
|
|
483
|
-
}
|
|
484
|
-
return 'other';
|
|
485
|
-
}
|
|
486
|
-
};
|
|
487
362
|
|
|
488
363
|
/**
|
|
489
364
|
* File upload component
|
|
@@ -598,7 +473,7 @@ class FileUpload extends ConfigurableComponent {
|
|
|
598
473
|
if (this.$button.disabled) return;
|
|
599
474
|
if (event.target instanceof Node) {
|
|
600
475
|
if (this.$root.contains(event.target)) {
|
|
601
|
-
if (event.dataTransfer &&
|
|
476
|
+
if (event.dataTransfer && this.canDrop(event.dataTransfer)) {
|
|
602
477
|
if (!this.$button.classList.contains('govuk-file-upload-button--dragging')) {
|
|
603
478
|
this.showDraggingState();
|
|
604
479
|
this.$announcements.innerText = this.i18n.t('enteredDropZone');
|
|
@@ -620,12 +495,30 @@ class FileUpload extends ConfigurableComponent {
|
|
|
620
495
|
}
|
|
621
496
|
onDrop(event) {
|
|
622
497
|
event.preventDefault();
|
|
623
|
-
if (event.dataTransfer &&
|
|
498
|
+
if (event.dataTransfer && this.canFillInput(event.dataTransfer)) {
|
|
624
499
|
this.$input.files = event.dataTransfer.files;
|
|
625
500
|
this.$input.dispatchEvent(new CustomEvent('change'));
|
|
626
501
|
this.hideDraggingState();
|
|
627
502
|
}
|
|
628
503
|
}
|
|
504
|
+
canFillInput(dataTransfer) {
|
|
505
|
+
return this.matchesInputCapacity(dataTransfer.files.length);
|
|
506
|
+
}
|
|
507
|
+
canDrop(dataTransfer) {
|
|
508
|
+
if (dataTransfer.items.length) {
|
|
509
|
+
return this.matchesInputCapacity(countFileItems(dataTransfer.items));
|
|
510
|
+
}
|
|
511
|
+
if (dataTransfer.types.length) {
|
|
512
|
+
return dataTransfer.types.includes('Files');
|
|
513
|
+
}
|
|
514
|
+
return true;
|
|
515
|
+
}
|
|
516
|
+
matchesInputCapacity(numberOfFiles) {
|
|
517
|
+
if (this.$input.multiple) {
|
|
518
|
+
return numberOfFiles > 0;
|
|
519
|
+
}
|
|
520
|
+
return numberOfFiles === 1;
|
|
521
|
+
}
|
|
629
522
|
onChange() {
|
|
630
523
|
const fileCount = this.$input.files.length;
|
|
631
524
|
if (fileCount === 0) {
|
|
@@ -672,6 +565,13 @@ class FileUpload extends ConfigurableComponent {
|
|
|
672
565
|
this.$root.classList.toggle('govuk-drop-zone--disabled', this.$button.disabled);
|
|
673
566
|
}
|
|
674
567
|
}
|
|
568
|
+
|
|
569
|
+
/**
|
|
570
|
+
* Counts the number of `DataTransferItem` whose kind is `file`
|
|
571
|
+
*
|
|
572
|
+
* @param {DataTransferItemList} list - The list
|
|
573
|
+
* @returns {number} - The number of items whose kind is `file` in the list
|
|
574
|
+
*/
|
|
675
575
|
FileUpload.moduleName = 'govuk-file-upload';
|
|
676
576
|
FileUpload.defaults = Object.freeze({
|
|
677
577
|
i18n: {
|
|
@@ -693,10 +593,14 @@ FileUpload.schema = Object.freeze({
|
|
|
693
593
|
}
|
|
694
594
|
}
|
|
695
595
|
});
|
|
696
|
-
function
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
596
|
+
function countFileItems(list) {
|
|
597
|
+
let result = 0;
|
|
598
|
+
for (let i = 0; i < list.length; i++) {
|
|
599
|
+
if (list[i].kind === 'file') {
|
|
600
|
+
result++;
|
|
601
|
+
}
|
|
602
|
+
}
|
|
603
|
+
return result;
|
|
700
604
|
}
|
|
701
605
|
|
|
702
606
|
/**
|
|
@@ -117,7 +117,7 @@ class FileUpload extends ConfigurableComponent {
|
|
|
117
117
|
if (this.$button.disabled) return;
|
|
118
118
|
if (event.target instanceof Node) {
|
|
119
119
|
if (this.$root.contains(event.target)) {
|
|
120
|
-
if (event.dataTransfer &&
|
|
120
|
+
if (event.dataTransfer && this.canDrop(event.dataTransfer)) {
|
|
121
121
|
if (!this.$button.classList.contains('govuk-file-upload-button--dragging')) {
|
|
122
122
|
this.showDraggingState();
|
|
123
123
|
this.$announcements.innerText = this.i18n.t('enteredDropZone');
|
|
@@ -139,12 +139,30 @@ class FileUpload extends ConfigurableComponent {
|
|
|
139
139
|
}
|
|
140
140
|
onDrop(event) {
|
|
141
141
|
event.preventDefault();
|
|
142
|
-
if (event.dataTransfer &&
|
|
142
|
+
if (event.dataTransfer && this.canFillInput(event.dataTransfer)) {
|
|
143
143
|
this.$input.files = event.dataTransfer.files;
|
|
144
144
|
this.$input.dispatchEvent(new CustomEvent('change'));
|
|
145
145
|
this.hideDraggingState();
|
|
146
146
|
}
|
|
147
147
|
}
|
|
148
|
+
canFillInput(dataTransfer) {
|
|
149
|
+
return this.matchesInputCapacity(dataTransfer.files.length);
|
|
150
|
+
}
|
|
151
|
+
canDrop(dataTransfer) {
|
|
152
|
+
if (dataTransfer.items.length) {
|
|
153
|
+
return this.matchesInputCapacity(countFileItems(dataTransfer.items));
|
|
154
|
+
}
|
|
155
|
+
if (dataTransfer.types.length) {
|
|
156
|
+
return dataTransfer.types.includes('Files');
|
|
157
|
+
}
|
|
158
|
+
return true;
|
|
159
|
+
}
|
|
160
|
+
matchesInputCapacity(numberOfFiles) {
|
|
161
|
+
if (this.$input.multiple) {
|
|
162
|
+
return numberOfFiles > 0;
|
|
163
|
+
}
|
|
164
|
+
return numberOfFiles === 1;
|
|
165
|
+
}
|
|
148
166
|
onChange() {
|
|
149
167
|
const fileCount = this.$input.files.length;
|
|
150
168
|
if (fileCount === 0) {
|
|
@@ -191,6 +209,13 @@ class FileUpload extends ConfigurableComponent {
|
|
|
191
209
|
this.$root.classList.toggle('govuk-drop-zone--disabled', this.$button.disabled);
|
|
192
210
|
}
|
|
193
211
|
}
|
|
212
|
+
|
|
213
|
+
/**
|
|
214
|
+
* Counts the number of `DataTransferItem` whose kind is `file`
|
|
215
|
+
*
|
|
216
|
+
* @param {DataTransferItemList} list - The list
|
|
217
|
+
* @returns {number} - The number of items whose kind is `file` in the list
|
|
218
|
+
*/
|
|
194
219
|
FileUpload.moduleName = 'govuk-file-upload';
|
|
195
220
|
FileUpload.defaults = Object.freeze({
|
|
196
221
|
i18n: {
|
|
@@ -212,10 +237,14 @@ FileUpload.schema = Object.freeze({
|
|
|
212
237
|
}
|
|
213
238
|
}
|
|
214
239
|
});
|
|
215
|
-
function
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
240
|
+
function countFileItems(list) {
|
|
241
|
+
let result = 0;
|
|
242
|
+
for (let i = 0; i < list.length; i++) {
|
|
243
|
+
if (list[i].kind === 'file') {
|
|
244
|
+
result++;
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
return result;
|
|
219
248
|
}
|
|
220
249
|
|
|
221
250
|
/**
|
|
@@ -1,24 +1,21 @@
|
|
|
1
1
|
@include govuk-exports("govuk/component/footer") {
|
|
2
|
-
$govuk-footer-background:
|
|
3
|
-
$govuk-footer-text:
|
|
4
|
-
$govuk-footer-content-border:
|
|
2
|
+
$govuk-footer-background: govuk-functional-colour(surface-background);
|
|
3
|
+
$govuk-footer-text: govuk-functional-colour(surface-text);
|
|
4
|
+
$govuk-footer-content-border: govuk-functional-colour(surface-border);
|
|
5
5
|
|
|
6
6
|
// Royal Arms image dimensions
|
|
7
7
|
$govuk-footer-crest-image-width: 125px;
|
|
8
8
|
$govuk-footer-crest-image-height: 102px;
|
|
9
9
|
|
|
10
10
|
.govuk-footer {
|
|
11
|
-
@include govuk-font($size:
|
|
11
|
+
@include govuk-font($size: 19);
|
|
12
12
|
@include govuk-responsive-padding(7, "top");
|
|
13
13
|
@include govuk-responsive-padding(5, "bottom");
|
|
14
14
|
|
|
15
|
-
border-top: 10px solid
|
|
15
|
+
border-top: 10px solid;
|
|
16
|
+
border-top-color: govuk-functional-colour(brand);
|
|
16
17
|
color: $govuk-footer-text;
|
|
17
|
-
|
|
18
|
-
"background",
|
|
19
|
-
$from: $govuk-footer-background,
|
|
20
|
-
$to: $_govuk-rebrand-template-background-colour
|
|
21
|
-
);
|
|
18
|
+
background: govuk-functional-colour(template-background);
|
|
22
19
|
}
|
|
23
20
|
|
|
24
21
|
.govuk-footer__crown {
|
|
@@ -27,19 +24,16 @@
|
|
|
27
24
|
|
|
28
25
|
.govuk-footer__link {
|
|
29
26
|
@include govuk-link-common;
|
|
30
|
-
@include govuk-link-style-
|
|
27
|
+
@include govuk-link-style-default;
|
|
31
28
|
}
|
|
32
29
|
|
|
33
30
|
.govuk-footer__section-break {
|
|
34
31
|
margin: 0; // Reset `<hr>` default margins
|
|
35
32
|
@include govuk-responsive-margin(8, "bottom");
|
|
36
33
|
border: 0; // Reset `<hr>` default borders
|
|
37
|
-
border-bottom: 1px
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
$from: $govuk-footer-content-border,
|
|
41
|
-
$to: $_govuk-rebrand-border-colour-on-blue-tint-95
|
|
42
|
-
);
|
|
34
|
+
border-bottom-width: 1px;
|
|
35
|
+
border-bottom-style: solid;
|
|
36
|
+
border-bottom-color: $govuk-footer-content-border;
|
|
43
37
|
}
|
|
44
38
|
|
|
45
39
|
.govuk-footer__meta {
|
|
@@ -59,7 +53,7 @@
|
|
|
59
53
|
|
|
60
54
|
.govuk-footer__meta-item--grow {
|
|
61
55
|
flex: 1; // Support: Flexbox
|
|
62
|
-
@
|
|
56
|
+
@media #{govuk-until-breakpoint(tablet)} {
|
|
63
57
|
flex-basis: 320px; // Support: Flexbox
|
|
64
58
|
}
|
|
65
59
|
}
|
|
@@ -67,7 +61,7 @@
|
|
|
67
61
|
.govuk-footer__licence-logo {
|
|
68
62
|
display: inline-block;
|
|
69
63
|
margin-right: govuk-spacing(2);
|
|
70
|
-
@
|
|
64
|
+
@media #{govuk-until-breakpoint(desktop)} {
|
|
71
65
|
margin-bottom: govuk-spacing(3);
|
|
72
66
|
}
|
|
73
67
|
vertical-align: top;
|
|
@@ -84,6 +78,10 @@
|
|
|
84
78
|
text-wrap: balance;
|
|
85
79
|
}
|
|
86
80
|
|
|
81
|
+
.govuk-footer__copyright-logo {
|
|
82
|
+
@include govuk-link-style-text;
|
|
83
|
+
}
|
|
84
|
+
|
|
87
85
|
.govuk-footer__copyright-logo::before {
|
|
88
86
|
content: "";
|
|
89
87
|
display: block;
|
|
@@ -127,10 +125,18 @@
|
|
|
127
125
|
padding: 0;
|
|
128
126
|
}
|
|
129
127
|
|
|
128
|
+
.govuk-footer__inline-list:last-child {
|
|
129
|
+
margin-bottom: 0;
|
|
130
|
+
}
|
|
131
|
+
|
|
130
132
|
.govuk-footer__meta-custom {
|
|
131
133
|
margin-bottom: govuk-spacing(4);
|
|
132
134
|
}
|
|
133
135
|
|
|
136
|
+
.govuk-footer__meta-custom:last-child {
|
|
137
|
+
margin-bottom: 0;
|
|
138
|
+
}
|
|
139
|
+
|
|
134
140
|
.govuk-footer__inline-list-item {
|
|
135
141
|
display: inline-block;
|
|
136
142
|
margin-right: govuk-spacing(3);
|
|
@@ -141,16 +147,13 @@
|
|
|
141
147
|
margin-bottom: govuk-spacing(6);
|
|
142
148
|
padding-bottom: govuk-spacing(4);
|
|
143
149
|
|
|
144
|
-
@
|
|
150
|
+
@media #{govuk-until-breakpoint(tablet)} {
|
|
145
151
|
padding-bottom: govuk-spacing(2);
|
|
146
152
|
}
|
|
147
153
|
|
|
148
|
-
border-bottom: 1px
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
$from: $govuk-footer-content-border,
|
|
152
|
-
$to: $_govuk-rebrand-border-colour-on-blue-tint-95
|
|
153
|
-
);
|
|
154
|
+
border-bottom-width: 1px;
|
|
155
|
+
border-bottom-style: solid;
|
|
156
|
+
border-bottom-color: $govuk-footer-content-border;
|
|
154
157
|
}
|
|
155
158
|
|
|
156
159
|
.govuk-footer__navigation {
|
|
@@ -172,7 +175,7 @@
|
|
|
172
175
|
column-gap: $govuk-gutter; // Support: Columns
|
|
173
176
|
}
|
|
174
177
|
|
|
175
|
-
@
|
|
178
|
+
@media #{govuk-from-breakpoint(desktop)} {
|
|
176
179
|
.govuk-footer__list--columns-2 {
|
|
177
180
|
column-count: 2; // Support: Columns
|
|
178
181
|
}
|