govuk_tech_docs 5.2.1 → 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/.github/dependabot.yml +59 -0
- data/.npmrc +1 -0
- data/.ruby-version +1 -0
- data/CHANGELOG.md +19 -0
- data/README.md +13 -4
- data/example/config/tech-docs.yml +1 -1
- data/govuk_tech_docs.gemspec +2 -2
- 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 +183 -300
- data/node_modules/govuk-frontend/dist/govuk/all.bundle.mjs +184 -300
- 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/configuration.mjs +29 -2
- data/node_modules/govuk-frontend/dist/govuk/common/govuk-frontend-version.mjs +1 -1
- data/node_modules/govuk-frontend/dist/govuk/common/index.mjs +4 -10
- 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 +14 -137
- data/node_modules/govuk-frontend/dist/govuk/components/accordion/accordion.bundle.mjs +14 -137
- data/node_modules/govuk-frontend/dist/govuk/components/accordion/accordion.mjs +4 -4
- 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/button/button.bundle.js +7 -5
- data/node_modules/govuk-frontend/dist/govuk/components/button/button.bundle.mjs +7 -5
- 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 +30 -143
- data/node_modules/govuk-frontend/dist/govuk/components/character-count/character-count.bundle.mjs +30 -143
- data/node_modules/govuk-frontend/dist/govuk/components/character-count/character-count.mjs +20 -10
- data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/_index.scss +7 -6
- data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/checkboxes.bundle.js +10 -5
- data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/checkboxes.bundle.mjs +10 -5
- 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/error-summary/error-summary.bundle.js +8 -12
- data/node_modules/govuk-frontend/dist/govuk/components/error-summary/error-summary.bundle.mjs +8 -12
- data/node_modules/govuk-frontend/dist/govuk/components/error-summary/error-summary.mjs +2 -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 +10 -133
- data/node_modules/govuk-frontend/dist/govuk/components/exit-this-page/exit-this-page.bundle.mjs +10 -133
- 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 +46 -140
- data/node_modules/govuk-frontend/dist/govuk/components/file-upload/file-upload.bundle.mjs +46 -140
- data/node_modules/govuk-frontend/dist/govuk/components/file-upload/file-upload.mjs +36 -7
- 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/notification-banner/notification-banner.bundle.js +7 -5
- data/node_modules/govuk-frontend/dist/govuk/components/notification-banner/notification-banner.bundle.mjs +7 -5
- data/node_modules/govuk-frontend/dist/govuk/components/pagination/_index.scss +16 -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 +10 -133
- data/node_modules/govuk-frontend/dist/govuk/components/password-input/password-input.bundle.mjs +10 -133
- 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/radios/radios.bundle.js +10 -5
- data/node_modules/govuk-frontend/dist/govuk/components/radios/radios.bundle.mjs +10 -5
- 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 +58 -74
- data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/service-navigation.bundle.js +40 -7
- data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/service-navigation.bundle.mjs +40 -7
- 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 +8 -4
- data/node_modules/govuk-frontend/dist/govuk/components/skip-link/skip-link.bundle.js +12 -19
- data/node_modules/govuk-frontend/dist/govuk/components/skip-link/skip-link.bundle.mjs +12 -19
- data/node_modules/govuk-frontend/dist/govuk/components/skip-link/skip-link.mjs +3 -9
- 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/tabs/tabs.bundle.js +12 -13
- data/node_modules/govuk-frontend/dist/govuk/components/tabs/tabs.bundle.mjs +12 -13
- data/node_modules/govuk-frontend/dist/govuk/components/tabs/tabs.mjs +3 -3
- 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/errors/index.mjs +5 -3
- data/node_modules/govuk-frontend/dist/govuk/govuk-frontend.min.js +1 -1
- data/node_modules/govuk-frontend/dist/govuk/helpers/_colour.scss +187 -72
- 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/helpers/_visually-hidden.scss +4 -1
- data/node_modules/govuk-frontend/dist/govuk/i18n.mjs +5 -128
- data/node_modules/govuk-frontend/dist/govuk/init.mjs +53 -45
- 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 +2461 -1150
- data/package.json +3 -3
- metadata +16 -30
- 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 -233
- data/node_modules/govuk-frontend/dist/govuk/components/header/header.bundle.mjs +0 -225
- 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
data/node_modules/govuk-frontend/dist/govuk/components/password-input/password-input.bundle.mjs
CHANGED
|
@@ -35,9 +35,6 @@ function formatErrorMessage(Component, message) {
|
|
|
35
35
|
* @typedef ComponentWithModuleName
|
|
36
36
|
* @property {string} moduleName - Name of the component
|
|
37
37
|
*/
|
|
38
|
-
/**
|
|
39
|
-
* @import { ObjectNested } from './configuration.mjs'
|
|
40
|
-
*/
|
|
41
38
|
|
|
42
39
|
class GOVUKFrontendError extends Error {
|
|
43
40
|
constructor(...args) {
|
|
@@ -66,7 +63,7 @@ class ConfigError extends GOVUKFrontendError {
|
|
|
66
63
|
class ElementError extends GOVUKFrontendError {
|
|
67
64
|
constructor(messageOrOptions) {
|
|
68
65
|
let message = typeof messageOrOptions === 'string' ? messageOrOptions : '';
|
|
69
|
-
if (
|
|
66
|
+
if (isObject(messageOrOptions)) {
|
|
70
67
|
const {
|
|
71
68
|
component,
|
|
72
69
|
identifier,
|
|
@@ -75,7 +72,9 @@ class ElementError extends GOVUKFrontendError {
|
|
|
75
72
|
} = messageOrOptions;
|
|
76
73
|
message = identifier;
|
|
77
74
|
message += element ? ` is not of type ${expectedType != null ? expectedType : 'HTMLElement'}` : ' not found';
|
|
78
|
-
|
|
75
|
+
if (component) {
|
|
76
|
+
message = formatErrorMessage(component, message);
|
|
77
|
+
}
|
|
79
78
|
}
|
|
80
79
|
super(message);
|
|
81
80
|
this.name = 'ElementError';
|
|
@@ -289,6 +288,9 @@ function extractConfigByNamespace(schema, dataset, namespace) {
|
|
|
289
288
|
* @template {Partial<Record<keyof ConfigurationType, unknown>>} [ConfigurationType=ObjectNested]
|
|
290
289
|
* @typedef {typeof Component & ChildClass<ConfigurationType>} ChildClassConstructor<ConfigurationType>
|
|
291
290
|
*/
|
|
291
|
+
/**
|
|
292
|
+
* @import { CompatibleClass, Config, CreateAllOptions, OnErrorCallback } from '../init.mjs'
|
|
293
|
+
*/
|
|
292
294
|
|
|
293
295
|
class I18n {
|
|
294
296
|
constructor(translations = {}, config = {}) {
|
|
@@ -303,7 +305,7 @@ class I18n {
|
|
|
303
305
|
throw new Error('i18n: lookup key missing');
|
|
304
306
|
}
|
|
305
307
|
let translation = this.translations[lookupKey];
|
|
306
|
-
if (typeof (options == null ? void 0 : options.count) === 'number' &&
|
|
308
|
+
if (typeof (options == null ? void 0 : options.count) === 'number' && isObject(translation)) {
|
|
307
309
|
const translationPluralForm = translation[this.getPluralSuffix(lookupKey, options.count)];
|
|
308
310
|
if (translationPluralForm) {
|
|
309
311
|
translation = translationPluralForm;
|
|
@@ -345,8 +347,8 @@ class I18n {
|
|
|
345
347
|
return 'other';
|
|
346
348
|
}
|
|
347
349
|
const translation = this.translations[lookupKey];
|
|
348
|
-
const preferredForm = this.hasIntlPluralRulesSupport() ? new Intl.PluralRules(this.locale).select(count) :
|
|
349
|
-
if (
|
|
350
|
+
const preferredForm = this.hasIntlPluralRulesSupport() ? new Intl.PluralRules(this.locale).select(count) : 'other';
|
|
351
|
+
if (isObject(translation)) {
|
|
350
352
|
if (preferredForm in translation) {
|
|
351
353
|
return preferredForm;
|
|
352
354
|
} else if ('other' in translation) {
|
|
@@ -356,132 +358,7 @@ class I18n {
|
|
|
356
358
|
}
|
|
357
359
|
throw new Error(`i18n: Plural form ".other" is required for "${this.locale}" locale`);
|
|
358
360
|
}
|
|
359
|
-
selectPluralFormUsingFallbackRules(count) {
|
|
360
|
-
count = Math.abs(Math.floor(count));
|
|
361
|
-
const ruleset = this.getPluralRulesForLocale();
|
|
362
|
-
if (ruleset) {
|
|
363
|
-
return I18n.pluralRules[ruleset](count);
|
|
364
|
-
}
|
|
365
|
-
return 'other';
|
|
366
|
-
}
|
|
367
|
-
getPluralRulesForLocale() {
|
|
368
|
-
const localeShort = this.locale.split('-')[0];
|
|
369
|
-
for (const pluralRule in I18n.pluralRulesMap) {
|
|
370
|
-
const languages = I18n.pluralRulesMap[pluralRule];
|
|
371
|
-
if (languages.includes(this.locale) || languages.includes(localeShort)) {
|
|
372
|
-
return pluralRule;
|
|
373
|
-
}
|
|
374
|
-
}
|
|
375
|
-
}
|
|
376
361
|
}
|
|
377
|
-
I18n.pluralRulesMap = {
|
|
378
|
-
arabic: ['ar'],
|
|
379
|
-
chinese: ['my', 'zh', 'id', 'ja', 'jv', 'ko', 'ms', 'th', 'vi'],
|
|
380
|
-
french: ['hy', 'bn', 'fr', 'gu', 'hi', 'fa', 'pa', 'zu'],
|
|
381
|
-
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'],
|
|
382
|
-
irish: ['ga'],
|
|
383
|
-
russian: ['ru', 'uk'],
|
|
384
|
-
scottish: ['gd'],
|
|
385
|
-
spanish: ['pt-PT', 'it', 'es'],
|
|
386
|
-
welsh: ['cy']
|
|
387
|
-
};
|
|
388
|
-
I18n.pluralRules = {
|
|
389
|
-
arabic(n) {
|
|
390
|
-
if (n === 0) {
|
|
391
|
-
return 'zero';
|
|
392
|
-
}
|
|
393
|
-
if (n === 1) {
|
|
394
|
-
return 'one';
|
|
395
|
-
}
|
|
396
|
-
if (n === 2) {
|
|
397
|
-
return 'two';
|
|
398
|
-
}
|
|
399
|
-
if (n % 100 >= 3 && n % 100 <= 10) {
|
|
400
|
-
return 'few';
|
|
401
|
-
}
|
|
402
|
-
if (n % 100 >= 11 && n % 100 <= 99) {
|
|
403
|
-
return 'many';
|
|
404
|
-
}
|
|
405
|
-
return 'other';
|
|
406
|
-
},
|
|
407
|
-
chinese() {
|
|
408
|
-
return 'other';
|
|
409
|
-
},
|
|
410
|
-
french(n) {
|
|
411
|
-
return n === 0 || n === 1 ? 'one' : 'other';
|
|
412
|
-
},
|
|
413
|
-
german(n) {
|
|
414
|
-
return n === 1 ? 'one' : 'other';
|
|
415
|
-
},
|
|
416
|
-
irish(n) {
|
|
417
|
-
if (n === 1) {
|
|
418
|
-
return 'one';
|
|
419
|
-
}
|
|
420
|
-
if (n === 2) {
|
|
421
|
-
return 'two';
|
|
422
|
-
}
|
|
423
|
-
if (n >= 3 && n <= 6) {
|
|
424
|
-
return 'few';
|
|
425
|
-
}
|
|
426
|
-
if (n >= 7 && n <= 10) {
|
|
427
|
-
return 'many';
|
|
428
|
-
}
|
|
429
|
-
return 'other';
|
|
430
|
-
},
|
|
431
|
-
russian(n) {
|
|
432
|
-
const lastTwo = n % 100;
|
|
433
|
-
const last = lastTwo % 10;
|
|
434
|
-
if (last === 1 && lastTwo !== 11) {
|
|
435
|
-
return 'one';
|
|
436
|
-
}
|
|
437
|
-
if (last >= 2 && last <= 4 && !(lastTwo >= 12 && lastTwo <= 14)) {
|
|
438
|
-
return 'few';
|
|
439
|
-
}
|
|
440
|
-
if (last === 0 || last >= 5 && last <= 9 || lastTwo >= 11 && lastTwo <= 14) {
|
|
441
|
-
return 'many';
|
|
442
|
-
}
|
|
443
|
-
return 'other';
|
|
444
|
-
},
|
|
445
|
-
scottish(n) {
|
|
446
|
-
if (n === 1 || n === 11) {
|
|
447
|
-
return 'one';
|
|
448
|
-
}
|
|
449
|
-
if (n === 2 || n === 12) {
|
|
450
|
-
return 'two';
|
|
451
|
-
}
|
|
452
|
-
if (n >= 3 && n <= 10 || n >= 13 && n <= 19) {
|
|
453
|
-
return 'few';
|
|
454
|
-
}
|
|
455
|
-
return 'other';
|
|
456
|
-
},
|
|
457
|
-
spanish(n) {
|
|
458
|
-
if (n === 1) {
|
|
459
|
-
return 'one';
|
|
460
|
-
}
|
|
461
|
-
if (n % 1000000 === 0 && n !== 0) {
|
|
462
|
-
return 'many';
|
|
463
|
-
}
|
|
464
|
-
return 'other';
|
|
465
|
-
},
|
|
466
|
-
welsh(n) {
|
|
467
|
-
if (n === 0) {
|
|
468
|
-
return 'zero';
|
|
469
|
-
}
|
|
470
|
-
if (n === 1) {
|
|
471
|
-
return 'one';
|
|
472
|
-
}
|
|
473
|
-
if (n === 2) {
|
|
474
|
-
return 'two';
|
|
475
|
-
}
|
|
476
|
-
if (n === 3) {
|
|
477
|
-
return 'few';
|
|
478
|
-
}
|
|
479
|
-
if (n === 6) {
|
|
480
|
-
return 'many';
|
|
481
|
-
}
|
|
482
|
-
return 'other';
|
|
483
|
-
}
|
|
484
|
-
};
|
|
485
362
|
|
|
486
363
|
/**
|
|
487
364
|
* Password input component
|
|
@@ -5,7 +5,15 @@
|
|
|
5
5
|
padding-top: govuk-spacing(2);
|
|
6
6
|
padding-bottom: govuk-spacing(2);
|
|
7
7
|
|
|
8
|
-
border-bottom: 1px solid
|
|
8
|
+
border-bottom: 1px solid;
|
|
9
|
+
border-bottom-color: govuk-functional-colour(border);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
// If the phase banner is already contained within a .govuk-width-container,
|
|
13
|
+
// don't double up the left and right margins on narrow viewports.
|
|
14
|
+
.govuk-width-container .govuk-phase-banner.govuk-width-container {
|
|
15
|
+
margin-right: 0;
|
|
16
|
+
margin-left: 0;
|
|
9
17
|
}
|
|
10
18
|
|
|
11
19
|
.govuk-phase-banner__content {
|
|
@@ -18,12 +26,10 @@
|
|
|
18
26
|
|
|
19
27
|
.govuk-phase-banner__content__tag {
|
|
20
28
|
@include govuk-font-size($size: 16);
|
|
21
|
-
margin-right: govuk-spacing(
|
|
29
|
+
margin-right: govuk-spacing(3);
|
|
22
30
|
|
|
23
|
-
@
|
|
24
|
-
|
|
25
|
-
margin-right: govuk-spacing(2);
|
|
26
|
-
}
|
|
31
|
+
@media #{govuk-from-breakpoint(tablet)} {
|
|
32
|
+
margin-right: govuk-spacing(2);
|
|
27
33
|
}
|
|
28
34
|
}
|
|
29
35
|
|
|
@@ -121,7 +121,7 @@
|
|
|
121
121
|
outline-color: Highlight;
|
|
122
122
|
}
|
|
123
123
|
|
|
124
|
-
box-shadow: 0 0 0 $govuk-radios-focus-width
|
|
124
|
+
box-shadow: 0 0 0 $govuk-radios-focus-width govuk-functional-colour(focus);
|
|
125
125
|
}
|
|
126
126
|
|
|
127
127
|
// Selected state
|
|
@@ -145,7 +145,7 @@
|
|
|
145
145
|
// =========================================================
|
|
146
146
|
|
|
147
147
|
.govuk-radios--inline {
|
|
148
|
-
@
|
|
148
|
+
@media #{govuk-from-breakpoint(tablet)} {
|
|
149
149
|
display: flex;
|
|
150
150
|
flex-wrap: wrap;
|
|
151
151
|
align-items: flex-start;
|
|
@@ -188,7 +188,8 @@
|
|
|
188
188
|
@include govuk-responsive-margin(4, "bottom");
|
|
189
189
|
margin-left: $conditional-margin-left;
|
|
190
190
|
padding-left: $conditional-padding-left;
|
|
191
|
-
border-left: $conditional-border-width solid
|
|
191
|
+
border-left: $conditional-border-width solid;
|
|
192
|
+
border-left-color: govuk-functional-colour(border);
|
|
192
193
|
|
|
193
194
|
.govuk-frontend-supported &--hidden {
|
|
194
195
|
display: none;
|
|
@@ -288,7 +289,7 @@
|
|
|
288
289
|
// Apply an outline for those modes to use instead.
|
|
289
290
|
outline: $govuk-radios-focus-width dashed transparent;
|
|
290
291
|
outline-offset: 1px;
|
|
291
|
-
box-shadow: 0 0 0 $govuk-hover-width
|
|
292
|
+
box-shadow: 0 0 0 $govuk-hover-width govuk-functional-colour(hover);
|
|
292
293
|
}
|
|
293
294
|
|
|
294
295
|
// Because we've overridden the border-shadow provided by the focus state,
|
|
@@ -303,8 +304,8 @@
|
|
|
303
304
|
}
|
|
304
305
|
// prettier-ignore
|
|
305
306
|
box-shadow:
|
|
306
|
-
0 0 0 $govuk-radios-focus-width
|
|
307
|
-
0 0 0 $govuk-hover-width
|
|
307
|
+
0 0 0 $govuk-radios-focus-width govuk-functional-colour(focus), // 1
|
|
308
|
+
0 0 0 $govuk-hover-width govuk-functional-colour(hover); // 2
|
|
308
309
|
}
|
|
309
310
|
|
|
310
311
|
// For devices that explicitly don't support hover, don't provide a hover
|
|
@@ -319,7 +320,7 @@
|
|
|
319
320
|
}
|
|
320
321
|
|
|
321
322
|
.govuk-radios__item:hover .govuk-radios__input:focus + .govuk-radios__label::before {
|
|
322
|
-
box-shadow: 0 0 0 $govuk-radios-focus-width
|
|
323
|
+
box-shadow: 0 0 0 $govuk-radios-focus-width govuk-functional-colour(focus);
|
|
323
324
|
}
|
|
324
325
|
}
|
|
325
326
|
}
|
|
@@ -23,6 +23,12 @@
|
|
|
23
23
|
}
|
|
24
24
|
return $scope.classList.contains('govuk-frontend-supported');
|
|
25
25
|
}
|
|
26
|
+
function isArray(option) {
|
|
27
|
+
return Array.isArray(option);
|
|
28
|
+
}
|
|
29
|
+
function isObject(option) {
|
|
30
|
+
return !!option && typeof option === 'object' && !isArray(option);
|
|
31
|
+
}
|
|
26
32
|
function formatErrorMessage(Component, message) {
|
|
27
33
|
return `${Component.moduleName}: ${message}`;
|
|
28
34
|
}
|
|
@@ -30,9 +36,6 @@
|
|
|
30
36
|
* @typedef ComponentWithModuleName
|
|
31
37
|
* @property {string} moduleName - Name of the component
|
|
32
38
|
*/
|
|
33
|
-
/**
|
|
34
|
-
* @import { ObjectNested } from './configuration.mjs'
|
|
35
|
-
*/
|
|
36
39
|
|
|
37
40
|
class GOVUKFrontendError extends Error {
|
|
38
41
|
constructor(...args) {
|
|
@@ -55,7 +58,7 @@
|
|
|
55
58
|
class ElementError extends GOVUKFrontendError {
|
|
56
59
|
constructor(messageOrOptions) {
|
|
57
60
|
let message = typeof messageOrOptions === 'string' ? messageOrOptions : '';
|
|
58
|
-
if (
|
|
61
|
+
if (isObject(messageOrOptions)) {
|
|
59
62
|
const {
|
|
60
63
|
component,
|
|
61
64
|
identifier,
|
|
@@ -64,7 +67,9 @@
|
|
|
64
67
|
} = messageOrOptions;
|
|
65
68
|
message = identifier;
|
|
66
69
|
message += element ? ` is not of type ${expectedType != null ? expectedType : 'HTMLElement'}` : ' not found';
|
|
67
|
-
|
|
70
|
+
if (component) {
|
|
71
|
+
message = formatErrorMessage(component, message);
|
|
72
|
+
}
|
|
68
73
|
}
|
|
69
74
|
super(message);
|
|
70
75
|
this.name = 'ElementError';
|
|
@@ -17,6 +17,12 @@ function isSupported($scope = document.body) {
|
|
|
17
17
|
}
|
|
18
18
|
return $scope.classList.contains('govuk-frontend-supported');
|
|
19
19
|
}
|
|
20
|
+
function isArray(option) {
|
|
21
|
+
return Array.isArray(option);
|
|
22
|
+
}
|
|
23
|
+
function isObject(option) {
|
|
24
|
+
return !!option && typeof option === 'object' && !isArray(option);
|
|
25
|
+
}
|
|
20
26
|
function formatErrorMessage(Component, message) {
|
|
21
27
|
return `${Component.moduleName}: ${message}`;
|
|
22
28
|
}
|
|
@@ -24,9 +30,6 @@ function formatErrorMessage(Component, message) {
|
|
|
24
30
|
* @typedef ComponentWithModuleName
|
|
25
31
|
* @property {string} moduleName - Name of the component
|
|
26
32
|
*/
|
|
27
|
-
/**
|
|
28
|
-
* @import { ObjectNested } from './configuration.mjs'
|
|
29
|
-
*/
|
|
30
33
|
|
|
31
34
|
class GOVUKFrontendError extends Error {
|
|
32
35
|
constructor(...args) {
|
|
@@ -49,7 +52,7 @@ class SupportError extends GOVUKFrontendError {
|
|
|
49
52
|
class ElementError extends GOVUKFrontendError {
|
|
50
53
|
constructor(messageOrOptions) {
|
|
51
54
|
let message = typeof messageOrOptions === 'string' ? messageOrOptions : '';
|
|
52
|
-
if (
|
|
55
|
+
if (isObject(messageOrOptions)) {
|
|
53
56
|
const {
|
|
54
57
|
component,
|
|
55
58
|
identifier,
|
|
@@ -58,7 +61,9 @@ class ElementError extends GOVUKFrontendError {
|
|
|
58
61
|
} = messageOrOptions;
|
|
59
62
|
message = identifier;
|
|
60
63
|
message += element ? ` is not of type ${expectedType != null ? expectedType : 'HTMLElement'}` : ' not found';
|
|
61
|
-
|
|
64
|
+
if (component) {
|
|
65
|
+
message = formatErrorMessage(component, message);
|
|
66
|
+
}
|
|
62
67
|
}
|
|
63
68
|
super(message);
|
|
64
69
|
this.name = 'ElementError';
|
|
@@ -16,21 +16,16 @@
|
|
|
16
16
|
max-width: 100%;
|
|
17
17
|
height: govuk-px-to-rem(40px);
|
|
18
18
|
padding: govuk-spacing(1);
|
|
19
|
-
border: $govuk-border-width-form-element solid
|
|
19
|
+
border: $govuk-border-width-form-element solid;
|
|
20
|
+
border-color: govuk-functional-colour(input-border);
|
|
20
21
|
|
|
21
22
|
// Default user agent colours for selects can have low contrast,
|
|
22
23
|
// and may look disabled (#2435)
|
|
23
|
-
color:
|
|
24
|
+
color: govuk-functional-colour(text);
|
|
24
25
|
background-color: govuk-colour("white");
|
|
25
26
|
|
|
26
27
|
&:focus {
|
|
27
|
-
|
|
28
|
-
// Ensure outline appears outside of the element
|
|
29
|
-
outline-offset: 0;
|
|
30
|
-
// Double the border by adding its width again. Use `box-shadow` to do
|
|
31
|
-
// this instead of changing `border-width` (which changes element size)
|
|
32
|
-
// and since `outline` is already used for the yellow focus state.
|
|
33
|
-
box-shadow: inset 0 0 0 $govuk-border-width-form-element;
|
|
28
|
+
@include govuk-focused-form-input;
|
|
34
29
|
}
|
|
35
30
|
|
|
36
31
|
&:disabled {
|
|
@@ -48,10 +43,10 @@
|
|
|
48
43
|
}
|
|
49
44
|
|
|
50
45
|
.govuk-select--error {
|
|
51
|
-
border-color:
|
|
46
|
+
border-color: govuk-functional-colour(error);
|
|
52
47
|
|
|
53
48
|
&:focus {
|
|
54
|
-
border-color:
|
|
49
|
+
border-color: govuk-functional-colour(input-border);
|
|
55
50
|
}
|
|
56
51
|
}
|
|
57
52
|
}
|
|
@@ -1,25 +1,16 @@
|
|
|
1
1
|
@include govuk-exports("govuk/component/service-navigation") {
|
|
2
2
|
$govuk-service-navigation-active-link-border-width: govuk-spacing(1);
|
|
3
|
-
$govuk-service-navigation-
|
|
4
|
-
$govuk-service-navigation-
|
|
5
|
-
|
|
6
|
-
// We make the link colour a little darker than normal here so that it has
|
|
7
|
-
// better perceptual contrast with the navigation background.
|
|
8
|
-
$govuk-service-navigation-link-colour: govuk-shade($govuk-link-colour, 10%);
|
|
3
|
+
$govuk-service-navigation-text-colour: govuk-functional-colour(surface-text);
|
|
4
|
+
$govuk-service-navigation-background: govuk-functional-colour(surface-background);
|
|
5
|
+
$govuk-service-navigation-border-colour: govuk-functional-colour(surface-border);
|
|
9
6
|
|
|
10
7
|
.govuk-service-navigation {
|
|
8
|
+
@include govuk-font($size: 19);
|
|
11
9
|
border-bottom-width: 1px;
|
|
12
10
|
border-bottom-style: solid;
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
$to: $_govuk-rebrand-border-colour-on-blue-tint-95
|
|
17
|
-
);
|
|
18
|
-
@include _govuk-rebrand(
|
|
19
|
-
"background-color",
|
|
20
|
-
$from: $govuk-service-navigation-background,
|
|
21
|
-
$to: $_govuk-rebrand-template-background-colour
|
|
22
|
-
);
|
|
11
|
+
border-bottom-color: $govuk-service-navigation-border-colour;
|
|
12
|
+
color: $govuk-service-navigation-text-colour;
|
|
13
|
+
background-color: $govuk-service-navigation-background;
|
|
23
14
|
}
|
|
24
15
|
|
|
25
16
|
.govuk-service-navigation__container {
|
|
@@ -27,7 +18,7 @@
|
|
|
27
18
|
flex-direction: column;
|
|
28
19
|
align-items: start;
|
|
29
20
|
|
|
30
|
-
@
|
|
21
|
+
@media #{govuk-from-breakpoint(tablet)} {
|
|
31
22
|
flex-direction: row;
|
|
32
23
|
flex-wrap: wrap;
|
|
33
24
|
}
|
|
@@ -39,26 +30,27 @@
|
|
|
39
30
|
.govuk-service-navigation__service-name {
|
|
40
31
|
position: relative;
|
|
41
32
|
margin: govuk-spacing(2) 0;
|
|
42
|
-
border: 0 solid $govuk-service-navigation-link-colour;
|
|
43
33
|
|
|
44
|
-
|
|
34
|
+
// A border matching the link colour is used to mark the active section –
|
|
35
|
+
// see the `govuk-service-navigation__item--active` class
|
|
36
|
+
border-width: 0;
|
|
37
|
+
border-style: solid;
|
|
38
|
+
border-color: govuk-functional-colour(link);
|
|
39
|
+
|
|
40
|
+
@media #{govuk-from-breakpoint(tablet)} {
|
|
45
41
|
// inline-block is used as a fallback for browsers that don't support flexbox
|
|
46
42
|
display: inline-block;
|
|
47
43
|
|
|
48
44
|
margin-top: 0;
|
|
49
45
|
margin-bottom: 0;
|
|
50
|
-
padding: govuk-spacing(
|
|
46
|
+
padding: govuk-spacing(3) 0;
|
|
51
47
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
// point. This gives us the perfect fractional line height to make the
|
|
59
|
-
// overall component 60px high
|
|
60
|
-
line-height: (29 / 19);
|
|
61
|
-
}
|
|
48
|
+
// More magic numbers ahoy:
|
|
49
|
+
// 29 is the desired height of the element (60), minus top and bottom
|
|
50
|
+
// padding (2×15), minus bottom border (1); 19 is the font-size at this
|
|
51
|
+
// point. This gives us the perfect fractional line height to make the
|
|
52
|
+
// overall component 60px high
|
|
53
|
+
line-height: (29 / 19);
|
|
62
54
|
|
|
63
55
|
&:not(:last-child) {
|
|
64
56
|
@include govuk-responsive-margin(6, $direction: right);
|
|
@@ -78,7 +70,7 @@
|
|
|
78
70
|
}
|
|
79
71
|
|
|
80
72
|
.govuk-service-navigation__item--active {
|
|
81
|
-
@
|
|
73
|
+
@media #{govuk-until-breakpoint(tablet)} {
|
|
82
74
|
// Negative offset the left margin so we can place a current page indicator
|
|
83
75
|
// to the left without misaligning the list item text.
|
|
84
76
|
margin-left: ((govuk-spacing(2) + $govuk-service-navigation-active-link-border-width) * -1);
|
|
@@ -86,12 +78,8 @@
|
|
|
86
78
|
border-left-width: $govuk-service-navigation-active-link-border-width;
|
|
87
79
|
}
|
|
88
80
|
|
|
89
|
-
@
|
|
90
|
-
|
|
91
|
-
"padding-bottom",
|
|
92
|
-
$from: govuk-spacing(4) - $govuk-service-navigation-active-link-border-width,
|
|
93
|
-
$to: govuk-spacing(3) - $govuk-service-navigation-active-link-border-width
|
|
94
|
-
);
|
|
81
|
+
@media #{govuk-from-breakpoint(tablet)} {
|
|
82
|
+
padding-bottom: govuk-spacing(3) - $govuk-service-navigation-active-link-border-width;
|
|
95
83
|
border-bottom-width: $govuk-service-navigation-active-link-border-width;
|
|
96
84
|
}
|
|
97
85
|
}
|
|
@@ -100,12 +88,6 @@
|
|
|
100
88
|
@include govuk-link-common;
|
|
101
89
|
@include govuk-link-style-no-underline;
|
|
102
90
|
@include govuk-link-style-no-visited-state;
|
|
103
|
-
|
|
104
|
-
&:not(:hover):not(:focus) {
|
|
105
|
-
// We set the colour here as we don't want to override the hover or
|
|
106
|
-
// focus colours
|
|
107
|
-
color: $govuk-service-navigation-link-colour;
|
|
108
|
-
}
|
|
109
91
|
}
|
|
110
92
|
|
|
111
93
|
//
|
|
@@ -113,7 +95,7 @@
|
|
|
113
95
|
//
|
|
114
96
|
|
|
115
97
|
.govuk-service-navigation__service-name {
|
|
116
|
-
@include govuk-
|
|
98
|
+
@include govuk-typography-weight-bold;
|
|
117
99
|
}
|
|
118
100
|
|
|
119
101
|
// Annoyingly this requires a compound selector in order to overcome the
|
|
@@ -139,7 +121,7 @@
|
|
|
139
121
|
margin: govuk-spacing(2) 0;
|
|
140
122
|
padding: 0;
|
|
141
123
|
border: 0;
|
|
142
|
-
color:
|
|
124
|
+
color: govuk-functional-colour(link);
|
|
143
125
|
background: none;
|
|
144
126
|
word-break: break-all;
|
|
145
127
|
cursor: pointer;
|
|
@@ -172,7 +154,6 @@
|
|
|
172
154
|
}
|
|
173
155
|
|
|
174
156
|
.govuk-service-navigation__list {
|
|
175
|
-
@include govuk-font($size: 19);
|
|
176
157
|
margin: 0;
|
|
177
158
|
margin-bottom: govuk-spacing(3);
|
|
178
159
|
padding: 0;
|
|
@@ -184,7 +165,7 @@
|
|
|
184
165
|
// readers would pointlessly announce.
|
|
185
166
|
// - Fixes an NVDA issue in Firefox and Chrome <= 124 where it would read
|
|
186
167
|
// all of the links as a run-on sentence.
|
|
187
|
-
@
|
|
168
|
+
@media #{govuk-from-breakpoint(tablet)} {
|
|
188
169
|
display: flex;
|
|
189
170
|
flex-wrap: wrap;
|
|
190
171
|
margin-bottom: 0;
|
|
@@ -211,37 +192,40 @@
|
|
|
211
192
|
|
|
212
193
|
// Inverted colour scheme style intended for product pages
|
|
213
194
|
.govuk-service-navigation--inverse {
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
border-bottom: none;
|
|
217
|
-
background-color: $govuk-brand-colour;
|
|
218
|
-
|
|
219
|
-
.govuk-width-container {
|
|
220
|
-
border-width: 1px 0;
|
|
221
|
-
border-style: solid;
|
|
222
|
-
border-color: $_govuk-rebrand-border-colour-on-blue-tint-95;
|
|
223
|
-
}
|
|
195
|
+
// Remove bottom border to add width-container ones
|
|
196
|
+
border-bottom: none;
|
|
224
197
|
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
}
|
|
198
|
+
// Set colour here so non-link text (service name, slot content) can
|
|
199
|
+
// use it too.
|
|
200
|
+
color: govuk-colour("white");
|
|
229
201
|
|
|
230
|
-
|
|
231
|
-
.govuk-service-navigation__item,
|
|
232
|
-
.govuk-service-navigation__service-name {
|
|
233
|
-
border-color: govuk-colour("white");
|
|
234
|
-
}
|
|
202
|
+
background-color: govuk-functional-colour(brand);
|
|
235
203
|
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
204
|
+
.govuk-width-container {
|
|
205
|
+
border-width: 1px 0;
|
|
206
|
+
border-style: solid;
|
|
207
|
+
border-color: $govuk-service-navigation-border-colour;
|
|
208
|
+
}
|
|
240
209
|
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
210
|
+
// Subtract 1px of space to account for the extra border-top
|
|
211
|
+
.govuk-service-navigation__container {
|
|
212
|
+
margin-top: -1px;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
// Override the 'active' border colour
|
|
216
|
+
.govuk-service-navigation__item,
|
|
217
|
+
.govuk-service-navigation__service-name {
|
|
218
|
+
border-color: govuk-colour("white");
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
// Override link styles
|
|
222
|
+
.govuk-service-navigation__link {
|
|
223
|
+
@include govuk-link-style-inverse;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
// Override mobile menu toggle colour when not focused
|
|
227
|
+
.govuk-service-navigation__toggle:not(:focus) {
|
|
228
|
+
color: currentcolor;
|
|
245
229
|
}
|
|
246
230
|
}
|
|
247
231
|
}
|