govuk_tech_docs 5.2.1 → 5.2.2
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/CHANGELOG.md +4 -0
- data/README.md +2 -1
- data/govuk_tech_docs.gemspec +1 -1
- data/lib/govuk_tech_docs/version.rb +1 -1
- data/node_modules/govuk-frontend/dist/govuk/all.bundle.js +97 -72
- data/node_modules/govuk-frontend/dist/govuk/all.bundle.mjs +97 -72
- 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/accordion.bundle.js +13 -11
- data/node_modules/govuk-frontend/dist/govuk/components/accordion/accordion.bundle.mjs +13 -11
- data/node_modules/govuk-frontend/dist/govuk/components/accordion/accordion.mjs +4 -4
- 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/character-count.bundle.js +10 -8
- data/node_modules/govuk-frontend/dist/govuk/components/character-count/character-count.bundle.mjs +10 -8
- data/node_modules/govuk-frontend/dist/govuk/components/character-count/character-count.mjs +1 -1
- 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/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/exit-this-page.bundle.js +9 -7
- data/node_modules/govuk-frontend/dist/govuk/components/exit-this-page/exit-this-page.bundle.mjs +9 -7
- data/node_modules/govuk-frontend/dist/govuk/components/file-upload/file-upload.bundle.js +10 -8
- data/node_modules/govuk-frontend/dist/govuk/components/file-upload/file-upload.bundle.mjs +10 -8
- data/node_modules/govuk-frontend/dist/govuk/components/file-upload/file-upload.mjs +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/header/header.bundle.js +10 -5
- data/node_modules/govuk-frontend/dist/govuk/components/header/header.bundle.mjs +10 -5
- 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 +4 -0
- data/node_modules/govuk-frontend/dist/govuk/components/password-input/password-input.bundle.js +9 -7
- data/node_modules/govuk-frontend/dist/govuk/components/password-input/password-input.bundle.mjs +9 -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/service-navigation/_index.scss +6 -1
- data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/service-navigation.bundle.js +10 -5
- data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/service-navigation.bundle.mjs +10 -5
- data/node_modules/govuk-frontend/dist/govuk/components/skip-link/_index.scss +1 -2
- 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/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/core/_govuk-frontend-properties.scss +1 -1
- 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 +31 -2
- data/node_modules/govuk-frontend/dist/govuk/helpers/_visually-hidden.scss +4 -1
- data/node_modules/govuk-frontend/dist/govuk/i18n.mjs +4 -2
- data/node_modules/govuk-frontend/dist/govuk/init.mjs +52 -43
- data/package-lock.json +2496 -4409
- data/package.json +2 -2
- metadata +7 -5
|
@@ -36,9 +36,6 @@
|
|
|
36
36
|
* @typedef ComponentWithModuleName
|
|
37
37
|
* @property {string} moduleName - Name of the component
|
|
38
38
|
*/
|
|
39
|
-
/**
|
|
40
|
-
* @import { ObjectNested } from './configuration.mjs'
|
|
41
|
-
*/
|
|
42
39
|
|
|
43
40
|
class GOVUKFrontendError extends Error {
|
|
44
41
|
constructor(...args) {
|
|
@@ -67,7 +64,7 @@
|
|
|
67
64
|
class ElementError extends GOVUKFrontendError {
|
|
68
65
|
constructor(messageOrOptions) {
|
|
69
66
|
let message = typeof messageOrOptions === 'string' ? messageOrOptions : '';
|
|
70
|
-
if (
|
|
67
|
+
if (isObject(messageOrOptions)) {
|
|
71
68
|
const {
|
|
72
69
|
component,
|
|
73
70
|
identifier,
|
|
@@ -76,7 +73,9 @@
|
|
|
76
73
|
} = messageOrOptions;
|
|
77
74
|
message = identifier;
|
|
78
75
|
message += element ? ` is not of type ${expectedType != null ? expectedType : 'HTMLElement'}` : ' not found';
|
|
79
|
-
|
|
76
|
+
if (component) {
|
|
77
|
+
message = formatErrorMessage(component, message);
|
|
78
|
+
}
|
|
80
79
|
}
|
|
81
80
|
super(message);
|
|
82
81
|
this.name = 'ElementError';
|
|
@@ -290,6 +289,9 @@
|
|
|
290
289
|
* @template {Partial<Record<keyof ConfigurationType, unknown>>} [ConfigurationType=ObjectNested]
|
|
291
290
|
* @typedef {typeof Component & ChildClass<ConfigurationType>} ChildClassConstructor<ConfigurationType>
|
|
292
291
|
*/
|
|
292
|
+
/**
|
|
293
|
+
* @import { CompatibleClass, Config, CreateAllOptions, OnErrorCallback } from '../init.mjs'
|
|
294
|
+
*/
|
|
293
295
|
|
|
294
296
|
const DEBOUNCE_TIMEOUT_IN_SECONDS = 1;
|
|
295
297
|
|
|
@@ -30,9 +30,6 @@ function formatErrorMessage(Component, message) {
|
|
|
30
30
|
* @typedef ComponentWithModuleName
|
|
31
31
|
* @property {string} moduleName - Name of the component
|
|
32
32
|
*/
|
|
33
|
-
/**
|
|
34
|
-
* @import { ObjectNested } from './configuration.mjs'
|
|
35
|
-
*/
|
|
36
33
|
|
|
37
34
|
class GOVUKFrontendError extends Error {
|
|
38
35
|
constructor(...args) {
|
|
@@ -61,7 +58,7 @@ class ConfigError extends GOVUKFrontendError {
|
|
|
61
58
|
class ElementError extends GOVUKFrontendError {
|
|
62
59
|
constructor(messageOrOptions) {
|
|
63
60
|
let message = typeof messageOrOptions === 'string' ? messageOrOptions : '';
|
|
64
|
-
if (
|
|
61
|
+
if (isObject(messageOrOptions)) {
|
|
65
62
|
const {
|
|
66
63
|
component,
|
|
67
64
|
identifier,
|
|
@@ -70,7 +67,9 @@ class ElementError extends GOVUKFrontendError {
|
|
|
70
67
|
} = messageOrOptions;
|
|
71
68
|
message = identifier;
|
|
72
69
|
message += element ? ` is not of type ${expectedType != null ? expectedType : 'HTMLElement'}` : ' not found';
|
|
73
|
-
|
|
70
|
+
if (component) {
|
|
71
|
+
message = formatErrorMessage(component, message);
|
|
72
|
+
}
|
|
74
73
|
}
|
|
75
74
|
super(message);
|
|
76
75
|
this.name = 'ElementError';
|
|
@@ -284,6 +283,9 @@ function extractConfigByNamespace(schema, dataset, namespace) {
|
|
|
284
283
|
* @template {Partial<Record<keyof ConfigurationType, unknown>>} [ConfigurationType=ObjectNested]
|
|
285
284
|
* @typedef {typeof Component & ChildClass<ConfigurationType>} ChildClassConstructor<ConfigurationType>
|
|
286
285
|
*/
|
|
286
|
+
/**
|
|
287
|
+
* @import { CompatibleClass, Config, CreateAllOptions, OnErrorCallback } from '../init.mjs'
|
|
288
|
+
*/
|
|
287
289
|
|
|
288
290
|
const DEBOUNCE_TIMEOUT_IN_SECONDS = 1;
|
|
289
291
|
|
data/node_modules/govuk-frontend/dist/govuk/components/character-count/character-count.bundle.js
CHANGED
|
@@ -41,9 +41,6 @@
|
|
|
41
41
|
* @typedef ComponentWithModuleName
|
|
42
42
|
* @property {string} moduleName - Name of the component
|
|
43
43
|
*/
|
|
44
|
-
/**
|
|
45
|
-
* @import { ObjectNested } from './configuration.mjs'
|
|
46
|
-
*/
|
|
47
44
|
|
|
48
45
|
class GOVUKFrontendError extends Error {
|
|
49
46
|
constructor(...args) {
|
|
@@ -72,7 +69,7 @@
|
|
|
72
69
|
class ElementError extends GOVUKFrontendError {
|
|
73
70
|
constructor(messageOrOptions) {
|
|
74
71
|
let message = typeof messageOrOptions === 'string' ? messageOrOptions : '';
|
|
75
|
-
if (
|
|
72
|
+
if (isObject(messageOrOptions)) {
|
|
76
73
|
const {
|
|
77
74
|
component,
|
|
78
75
|
identifier,
|
|
@@ -81,7 +78,9 @@
|
|
|
81
78
|
} = messageOrOptions;
|
|
82
79
|
message = identifier;
|
|
83
80
|
message += element ? ` is not of type ${expectedType != null ? expectedType : 'HTMLElement'}` : ' not found';
|
|
84
|
-
|
|
81
|
+
if (component) {
|
|
82
|
+
message = formatErrorMessage(component, message);
|
|
83
|
+
}
|
|
85
84
|
}
|
|
86
85
|
super(message);
|
|
87
86
|
this.name = 'ElementError';
|
|
@@ -315,6 +314,9 @@
|
|
|
315
314
|
* @template {Partial<Record<keyof ConfigurationType, unknown>>} [ConfigurationType=ObjectNested]
|
|
316
315
|
* @typedef {typeof Component & ChildClass<ConfigurationType>} ChildClassConstructor<ConfigurationType>
|
|
317
316
|
*/
|
|
317
|
+
/**
|
|
318
|
+
* @import { CompatibleClass, Config, CreateAllOptions, OnErrorCallback } from '../init.mjs'
|
|
319
|
+
*/
|
|
318
320
|
|
|
319
321
|
class I18n {
|
|
320
322
|
constructor(translations = {}, config = {}) {
|
|
@@ -329,7 +331,7 @@
|
|
|
329
331
|
throw new Error('i18n: lookup key missing');
|
|
330
332
|
}
|
|
331
333
|
let translation = this.translations[lookupKey];
|
|
332
|
-
if (typeof (options == null ? void 0 : options.count) === 'number' &&
|
|
334
|
+
if (typeof (options == null ? void 0 : options.count) === 'number' && isObject(translation)) {
|
|
333
335
|
const translationPluralForm = translation[this.getPluralSuffix(lookupKey, options.count)];
|
|
334
336
|
if (translationPluralForm) {
|
|
335
337
|
translation = translationPluralForm;
|
|
@@ -372,7 +374,7 @@
|
|
|
372
374
|
}
|
|
373
375
|
const translation = this.translations[lookupKey];
|
|
374
376
|
const preferredForm = this.hasIntlPluralRulesSupport() ? new Intl.PluralRules(this.locale).select(count) : this.selectPluralFormUsingFallbackRules(count);
|
|
375
|
-
if (
|
|
377
|
+
if (isObject(translation)) {
|
|
376
378
|
if (preferredForm in translation) {
|
|
377
379
|
return preferredForm;
|
|
378
380
|
} else if ('other' in translation) {
|
|
@@ -577,7 +579,7 @@
|
|
|
577
579
|
});
|
|
578
580
|
}
|
|
579
581
|
this.$errorMessage = this.$root.querySelector('.govuk-error-message');
|
|
580
|
-
if (
|
|
582
|
+
if ($textareaDescription.textContent.match(/^\s*$/)) {
|
|
581
583
|
$textareaDescription.textContent = this.i18n.t('textareaDescription', {
|
|
582
584
|
count: this.maxLength
|
|
583
585
|
});
|
data/node_modules/govuk-frontend/dist/govuk/components/character-count/character-count.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';
|
|
@@ -309,6 +308,9 @@ function extractConfigByNamespace(schema, dataset, namespace) {
|
|
|
309
308
|
* @template {Partial<Record<keyof ConfigurationType, unknown>>} [ConfigurationType=ObjectNested]
|
|
310
309
|
* @typedef {typeof Component & ChildClass<ConfigurationType>} ChildClassConstructor<ConfigurationType>
|
|
311
310
|
*/
|
|
311
|
+
/**
|
|
312
|
+
* @import { CompatibleClass, Config, CreateAllOptions, OnErrorCallback } from '../init.mjs'
|
|
313
|
+
*/
|
|
312
314
|
|
|
313
315
|
class I18n {
|
|
314
316
|
constructor(translations = {}, config = {}) {
|
|
@@ -323,7 +325,7 @@ class I18n {
|
|
|
323
325
|
throw new Error('i18n: lookup key missing');
|
|
324
326
|
}
|
|
325
327
|
let translation = this.translations[lookupKey];
|
|
326
|
-
if (typeof (options == null ? void 0 : options.count) === 'number' &&
|
|
328
|
+
if (typeof (options == null ? void 0 : options.count) === 'number' && isObject(translation)) {
|
|
327
329
|
const translationPluralForm = translation[this.getPluralSuffix(lookupKey, options.count)];
|
|
328
330
|
if (translationPluralForm) {
|
|
329
331
|
translation = translationPluralForm;
|
|
@@ -366,7 +368,7 @@ class I18n {
|
|
|
366
368
|
}
|
|
367
369
|
const translation = this.translations[lookupKey];
|
|
368
370
|
const preferredForm = this.hasIntlPluralRulesSupport() ? new Intl.PluralRules(this.locale).select(count) : this.selectPluralFormUsingFallbackRules(count);
|
|
369
|
-
if (
|
|
371
|
+
if (isObject(translation)) {
|
|
370
372
|
if (preferredForm in translation) {
|
|
371
373
|
return preferredForm;
|
|
372
374
|
} else if ('other' in translation) {
|
|
@@ -571,7 +573,7 @@ class CharacterCount extends ConfigurableComponent {
|
|
|
571
573
|
});
|
|
572
574
|
}
|
|
573
575
|
this.$errorMessage = this.$root.querySelector('.govuk-error-message');
|
|
574
|
-
if (
|
|
576
|
+
if ($textareaDescription.textContent.match(/^\s*$/)) {
|
|
575
577
|
$textareaDescription.textContent = this.i18n.t('textareaDescription', {
|
|
576
578
|
count: this.maxLength
|
|
577
579
|
});
|
|
@@ -72,7 +72,7 @@ class CharacterCount extends ConfigurableComponent {
|
|
|
72
72
|
});
|
|
73
73
|
}
|
|
74
74
|
this.$errorMessage = this.$root.querySelector('.govuk-error-message');
|
|
75
|
-
if (
|
|
75
|
+
if ($textareaDescription.textContent.match(/^\s*$/)) {
|
|
76
76
|
$textareaDescription.textContent = this.i18n.t('textareaDescription', {
|
|
77
77
|
count: this.maxLength
|
|
78
78
|
});
|
|
@@ -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';
|
data/node_modules/govuk-frontend/dist/govuk/components/error-summary/error-summary.bundle.js
CHANGED
|
@@ -4,12 +4,6 @@
|
|
|
4
4
|
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.GOVUKFrontend = global.GOVUKFrontend || {}));
|
|
5
5
|
})(this, (function (exports) { 'use strict';
|
|
6
6
|
|
|
7
|
-
function getFragmentFromUrl(url) {
|
|
8
|
-
if (!url.includes('#')) {
|
|
9
|
-
return undefined;
|
|
10
|
-
}
|
|
11
|
-
return url.split('#').pop();
|
|
12
|
-
}
|
|
13
7
|
function setFocus($element, options = {}) {
|
|
14
8
|
var _options$onBeforeFocu;
|
|
15
9
|
const isFocusable = $element.getAttribute('tabindex');
|
|
@@ -66,9 +60,6 @@
|
|
|
66
60
|
* @typedef ComponentWithModuleName
|
|
67
61
|
* @property {string} moduleName - Name of the component
|
|
68
62
|
*/
|
|
69
|
-
/**
|
|
70
|
-
* @import { ObjectNested } from './configuration.mjs'
|
|
71
|
-
*/
|
|
72
63
|
|
|
73
64
|
class GOVUKFrontendError extends Error {
|
|
74
65
|
constructor(...args) {
|
|
@@ -97,7 +88,7 @@
|
|
|
97
88
|
class ElementError extends GOVUKFrontendError {
|
|
98
89
|
constructor(messageOrOptions) {
|
|
99
90
|
let message = typeof messageOrOptions === 'string' ? messageOrOptions : '';
|
|
100
|
-
if (
|
|
91
|
+
if (isObject(messageOrOptions)) {
|
|
101
92
|
const {
|
|
102
93
|
component,
|
|
103
94
|
identifier,
|
|
@@ -106,7 +97,9 @@
|
|
|
106
97
|
} = messageOrOptions;
|
|
107
98
|
message = identifier;
|
|
108
99
|
message += element ? ` is not of type ${expectedType != null ? expectedType : 'HTMLElement'}` : ' not found';
|
|
109
|
-
|
|
100
|
+
if (component) {
|
|
101
|
+
message = formatErrorMessage(component, message);
|
|
102
|
+
}
|
|
110
103
|
}
|
|
111
104
|
super(message);
|
|
112
105
|
this.name = 'ElementError';
|
|
@@ -320,6 +313,9 @@
|
|
|
320
313
|
* @template {Partial<Record<keyof ConfigurationType, unknown>>} [ConfigurationType=ObjectNested]
|
|
321
314
|
* @typedef {typeof Component & ChildClass<ConfigurationType>} ChildClassConstructor<ConfigurationType>
|
|
322
315
|
*/
|
|
316
|
+
/**
|
|
317
|
+
* @import { CompatibleClass, Config, CreateAllOptions, OnErrorCallback } from '../init.mjs'
|
|
318
|
+
*/
|
|
323
319
|
|
|
324
320
|
/**
|
|
325
321
|
* Error summary component
|
|
@@ -352,7 +348,7 @@
|
|
|
352
348
|
if (!($target instanceof HTMLAnchorElement)) {
|
|
353
349
|
return false;
|
|
354
350
|
}
|
|
355
|
-
const inputId =
|
|
351
|
+
const inputId = $target.hash.replace('#', '');
|
|
356
352
|
if (!inputId) {
|
|
357
353
|
return false;
|
|
358
354
|
}
|
data/node_modules/govuk-frontend/dist/govuk/components/error-summary/error-summary.bundle.mjs
CHANGED
|
@@ -1,9 +1,3 @@
|
|
|
1
|
-
function getFragmentFromUrl(url) {
|
|
2
|
-
if (!url.includes('#')) {
|
|
3
|
-
return undefined;
|
|
4
|
-
}
|
|
5
|
-
return url.split('#').pop();
|
|
6
|
-
}
|
|
7
1
|
function setFocus($element, options = {}) {
|
|
8
2
|
var _options$onBeforeFocu;
|
|
9
3
|
const isFocusable = $element.getAttribute('tabindex');
|
|
@@ -60,9 +54,6 @@ function formatErrorMessage(Component, message) {
|
|
|
60
54
|
* @typedef ComponentWithModuleName
|
|
61
55
|
* @property {string} moduleName - Name of the component
|
|
62
56
|
*/
|
|
63
|
-
/**
|
|
64
|
-
* @import { ObjectNested } from './configuration.mjs'
|
|
65
|
-
*/
|
|
66
57
|
|
|
67
58
|
class GOVUKFrontendError extends Error {
|
|
68
59
|
constructor(...args) {
|
|
@@ -91,7 +82,7 @@ class ConfigError extends GOVUKFrontendError {
|
|
|
91
82
|
class ElementError extends GOVUKFrontendError {
|
|
92
83
|
constructor(messageOrOptions) {
|
|
93
84
|
let message = typeof messageOrOptions === 'string' ? messageOrOptions : '';
|
|
94
|
-
if (
|
|
85
|
+
if (isObject(messageOrOptions)) {
|
|
95
86
|
const {
|
|
96
87
|
component,
|
|
97
88
|
identifier,
|
|
@@ -100,7 +91,9 @@ class ElementError extends GOVUKFrontendError {
|
|
|
100
91
|
} = messageOrOptions;
|
|
101
92
|
message = identifier;
|
|
102
93
|
message += element ? ` is not of type ${expectedType != null ? expectedType : 'HTMLElement'}` : ' not found';
|
|
103
|
-
|
|
94
|
+
if (component) {
|
|
95
|
+
message = formatErrorMessage(component, message);
|
|
96
|
+
}
|
|
104
97
|
}
|
|
105
98
|
super(message);
|
|
106
99
|
this.name = 'ElementError';
|
|
@@ -314,6 +307,9 @@ function extractConfigByNamespace(schema, dataset, namespace) {
|
|
|
314
307
|
* @template {Partial<Record<keyof ConfigurationType, unknown>>} [ConfigurationType=ObjectNested]
|
|
315
308
|
* @typedef {typeof Component & ChildClass<ConfigurationType>} ChildClassConstructor<ConfigurationType>
|
|
316
309
|
*/
|
|
310
|
+
/**
|
|
311
|
+
* @import { CompatibleClass, Config, CreateAllOptions, OnErrorCallback } from '../init.mjs'
|
|
312
|
+
*/
|
|
317
313
|
|
|
318
314
|
/**
|
|
319
315
|
* Error summary component
|
|
@@ -346,7 +342,7 @@ class ErrorSummary extends ConfigurableComponent {
|
|
|
346
342
|
if (!($target instanceof HTMLAnchorElement)) {
|
|
347
343
|
return false;
|
|
348
344
|
}
|
|
349
|
-
const inputId =
|
|
345
|
+
const inputId = $target.hash.replace('#', '');
|
|
350
346
|
if (!inputId) {
|
|
351
347
|
return false;
|
|
352
348
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ConfigurableComponent } from '../../common/configuration.mjs';
|
|
2
|
-
import { setFocus
|
|
2
|
+
import { setFocus } from '../../common/index.mjs';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Error summary component
|
|
@@ -32,7 +32,7 @@ class ErrorSummary extends ConfigurableComponent {
|
|
|
32
32
|
if (!($target instanceof HTMLAnchorElement)) {
|
|
33
33
|
return false;
|
|
34
34
|
}
|
|
35
|
-
const inputId =
|
|
35
|
+
const inputId = $target.hash.replace('#', '');
|
|
36
36
|
if (!inputId) {
|
|
37
37
|
return false;
|
|
38
38
|
}
|
data/node_modules/govuk-frontend/dist/govuk/components/exit-this-page/exit-this-page.bundle.js
CHANGED
|
@@ -36,9 +36,6 @@
|
|
|
36
36
|
* @typedef ComponentWithModuleName
|
|
37
37
|
* @property {string} moduleName - Name of the component
|
|
38
38
|
*/
|
|
39
|
-
/**
|
|
40
|
-
* @import { ObjectNested } from './configuration.mjs'
|
|
41
|
-
*/
|
|
42
39
|
|
|
43
40
|
class GOVUKFrontendError extends Error {
|
|
44
41
|
constructor(...args) {
|
|
@@ -67,7 +64,7 @@
|
|
|
67
64
|
class ElementError extends GOVUKFrontendError {
|
|
68
65
|
constructor(messageOrOptions) {
|
|
69
66
|
let message = typeof messageOrOptions === 'string' ? messageOrOptions : '';
|
|
70
|
-
if (
|
|
67
|
+
if (isObject(messageOrOptions)) {
|
|
71
68
|
const {
|
|
72
69
|
component,
|
|
73
70
|
identifier,
|
|
@@ -76,7 +73,9 @@
|
|
|
76
73
|
} = messageOrOptions;
|
|
77
74
|
message = identifier;
|
|
78
75
|
message += element ? ` is not of type ${expectedType != null ? expectedType : 'HTMLElement'}` : ' not found';
|
|
79
|
-
|
|
76
|
+
if (component) {
|
|
77
|
+
message = formatErrorMessage(component, message);
|
|
78
|
+
}
|
|
80
79
|
}
|
|
81
80
|
super(message);
|
|
82
81
|
this.name = 'ElementError';
|
|
@@ -290,6 +289,9 @@
|
|
|
290
289
|
* @template {Partial<Record<keyof ConfigurationType, unknown>>} [ConfigurationType=ObjectNested]
|
|
291
290
|
* @typedef {typeof Component & ChildClass<ConfigurationType>} ChildClassConstructor<ConfigurationType>
|
|
292
291
|
*/
|
|
292
|
+
/**
|
|
293
|
+
* @import { CompatibleClass, Config, CreateAllOptions, OnErrorCallback } from '../init.mjs'
|
|
294
|
+
*/
|
|
293
295
|
|
|
294
296
|
class I18n {
|
|
295
297
|
constructor(translations = {}, config = {}) {
|
|
@@ -304,7 +306,7 @@
|
|
|
304
306
|
throw new Error('i18n: lookup key missing');
|
|
305
307
|
}
|
|
306
308
|
let translation = this.translations[lookupKey];
|
|
307
|
-
if (typeof (options == null ? void 0 : options.count) === 'number' &&
|
|
309
|
+
if (typeof (options == null ? void 0 : options.count) === 'number' && isObject(translation)) {
|
|
308
310
|
const translationPluralForm = translation[this.getPluralSuffix(lookupKey, options.count)];
|
|
309
311
|
if (translationPluralForm) {
|
|
310
312
|
translation = translationPluralForm;
|
|
@@ -347,7 +349,7 @@
|
|
|
347
349
|
}
|
|
348
350
|
const translation = this.translations[lookupKey];
|
|
349
351
|
const preferredForm = this.hasIntlPluralRulesSupport() ? new Intl.PluralRules(this.locale).select(count) : this.selectPluralFormUsingFallbackRules(count);
|
|
350
|
-
if (
|
|
352
|
+
if (isObject(translation)) {
|
|
351
353
|
if (preferredForm in translation) {
|
|
352
354
|
return preferredForm;
|
|
353
355
|
} else if ('other' in translation) {
|
data/node_modules/govuk-frontend/dist/govuk/components/exit-this-page/exit-this-page.bundle.mjs
CHANGED
|
@@ -30,9 +30,6 @@ function formatErrorMessage(Component, message) {
|
|
|
30
30
|
* @typedef ComponentWithModuleName
|
|
31
31
|
* @property {string} moduleName - Name of the component
|
|
32
32
|
*/
|
|
33
|
-
/**
|
|
34
|
-
* @import { ObjectNested } from './configuration.mjs'
|
|
35
|
-
*/
|
|
36
33
|
|
|
37
34
|
class GOVUKFrontendError extends Error {
|
|
38
35
|
constructor(...args) {
|
|
@@ -61,7 +58,7 @@ class ConfigError extends GOVUKFrontendError {
|
|
|
61
58
|
class ElementError extends GOVUKFrontendError {
|
|
62
59
|
constructor(messageOrOptions) {
|
|
63
60
|
let message = typeof messageOrOptions === 'string' ? messageOrOptions : '';
|
|
64
|
-
if (
|
|
61
|
+
if (isObject(messageOrOptions)) {
|
|
65
62
|
const {
|
|
66
63
|
component,
|
|
67
64
|
identifier,
|
|
@@ -70,7 +67,9 @@ class ElementError extends GOVUKFrontendError {
|
|
|
70
67
|
} = messageOrOptions;
|
|
71
68
|
message = identifier;
|
|
72
69
|
message += element ? ` is not of type ${expectedType != null ? expectedType : 'HTMLElement'}` : ' not found';
|
|
73
|
-
|
|
70
|
+
if (component) {
|
|
71
|
+
message = formatErrorMessage(component, message);
|
|
72
|
+
}
|
|
74
73
|
}
|
|
75
74
|
super(message);
|
|
76
75
|
this.name = 'ElementError';
|
|
@@ -284,6 +283,9 @@ function extractConfigByNamespace(schema, dataset, namespace) {
|
|
|
284
283
|
* @template {Partial<Record<keyof ConfigurationType, unknown>>} [ConfigurationType=ObjectNested]
|
|
285
284
|
* @typedef {typeof Component & ChildClass<ConfigurationType>} ChildClassConstructor<ConfigurationType>
|
|
286
285
|
*/
|
|
286
|
+
/**
|
|
287
|
+
* @import { CompatibleClass, Config, CreateAllOptions, OnErrorCallback } from '../init.mjs'
|
|
288
|
+
*/
|
|
287
289
|
|
|
288
290
|
class I18n {
|
|
289
291
|
constructor(translations = {}, config = {}) {
|
|
@@ -298,7 +300,7 @@ class I18n {
|
|
|
298
300
|
throw new Error('i18n: lookup key missing');
|
|
299
301
|
}
|
|
300
302
|
let translation = this.translations[lookupKey];
|
|
301
|
-
if (typeof (options == null ? void 0 : options.count) === 'number' &&
|
|
303
|
+
if (typeof (options == null ? void 0 : options.count) === 'number' && isObject(translation)) {
|
|
302
304
|
const translationPluralForm = translation[this.getPluralSuffix(lookupKey, options.count)];
|
|
303
305
|
if (translationPluralForm) {
|
|
304
306
|
translation = translationPluralForm;
|
|
@@ -341,7 +343,7 @@ class I18n {
|
|
|
341
343
|
}
|
|
342
344
|
const translation = this.translations[lookupKey];
|
|
343
345
|
const preferredForm = this.hasIntlPluralRulesSupport() ? new Intl.PluralRules(this.locale).select(count) : this.selectPluralFormUsingFallbackRules(count);
|
|
344
|
-
if (
|
|
346
|
+
if (isObject(translation)) {
|
|
345
347
|
if (preferredForm in translation) {
|
|
346
348
|
return preferredForm;
|
|
347
349
|
} else if ('other' in translation) {
|
|
@@ -41,9 +41,6 @@
|
|
|
41
41
|
* @typedef ComponentWithModuleName
|
|
42
42
|
* @property {string} moduleName - Name of the component
|
|
43
43
|
*/
|
|
44
|
-
/**
|
|
45
|
-
* @import { ObjectNested } from './configuration.mjs'
|
|
46
|
-
*/
|
|
47
44
|
|
|
48
45
|
class GOVUKFrontendError extends Error {
|
|
49
46
|
constructor(...args) {
|
|
@@ -72,7 +69,7 @@
|
|
|
72
69
|
class ElementError extends GOVUKFrontendError {
|
|
73
70
|
constructor(messageOrOptions) {
|
|
74
71
|
let message = typeof messageOrOptions === 'string' ? messageOrOptions : '';
|
|
75
|
-
if (
|
|
72
|
+
if (isObject(messageOrOptions)) {
|
|
76
73
|
const {
|
|
77
74
|
component,
|
|
78
75
|
identifier,
|
|
@@ -81,7 +78,9 @@
|
|
|
81
78
|
} = messageOrOptions;
|
|
82
79
|
message = identifier;
|
|
83
80
|
message += element ? ` is not of type ${expectedType != null ? expectedType : 'HTMLElement'}` : ' not found';
|
|
84
|
-
|
|
81
|
+
if (component) {
|
|
82
|
+
message = formatErrorMessage(component, message);
|
|
83
|
+
}
|
|
85
84
|
}
|
|
86
85
|
super(message);
|
|
87
86
|
this.name = 'ElementError';
|
|
@@ -295,6 +294,9 @@
|
|
|
295
294
|
* @template {Partial<Record<keyof ConfigurationType, unknown>>} [ConfigurationType=ObjectNested]
|
|
296
295
|
* @typedef {typeof Component & ChildClass<ConfigurationType>} ChildClassConstructor<ConfigurationType>
|
|
297
296
|
*/
|
|
297
|
+
/**
|
|
298
|
+
* @import { CompatibleClass, Config, CreateAllOptions, OnErrorCallback } from '../init.mjs'
|
|
299
|
+
*/
|
|
298
300
|
|
|
299
301
|
class I18n {
|
|
300
302
|
constructor(translations = {}, config = {}) {
|
|
@@ -309,7 +311,7 @@
|
|
|
309
311
|
throw new Error('i18n: lookup key missing');
|
|
310
312
|
}
|
|
311
313
|
let translation = this.translations[lookupKey];
|
|
312
|
-
if (typeof (options == null ? void 0 : options.count) === 'number' &&
|
|
314
|
+
if (typeof (options == null ? void 0 : options.count) === 'number' && isObject(translation)) {
|
|
313
315
|
const translationPluralForm = translation[this.getPluralSuffix(lookupKey, options.count)];
|
|
314
316
|
if (translationPluralForm) {
|
|
315
317
|
translation = translationPluralForm;
|
|
@@ -352,7 +354,7 @@
|
|
|
352
354
|
}
|
|
353
355
|
const translation = this.translations[lookupKey];
|
|
354
356
|
const preferredForm = this.hasIntlPluralRulesSupport() ? new Intl.PluralRules(this.locale).select(count) : this.selectPluralFormUsingFallbackRules(count);
|
|
355
|
-
if (
|
|
357
|
+
if (isObject(translation)) {
|
|
356
358
|
if (preferredForm in translation) {
|
|
357
359
|
return preferredForm;
|
|
358
360
|
} else if ('other' in translation) {
|
|
@@ -520,7 +522,6 @@
|
|
|
520
522
|
throw new ElementError(formatErrorMessage(FileUpload, 'File input (`<input type="file">`) attribute (`type`) is not `file`'));
|
|
521
523
|
}
|
|
522
524
|
this.$input = $input;
|
|
523
|
-
this.$input.setAttribute('hidden', 'true');
|
|
524
525
|
if (!this.$input.id) {
|
|
525
526
|
throw new ElementError({
|
|
526
527
|
component: FileUpload,
|
|
@@ -536,6 +537,7 @@
|
|
|
536
537
|
$label.id = `${this.id}-label`;
|
|
537
538
|
}
|
|
538
539
|
this.$input.id = `${this.id}-input`;
|
|
540
|
+
this.$input.setAttribute('hidden', 'true');
|
|
539
541
|
const $button = document.createElement('button');
|
|
540
542
|
$button.classList.add('govuk-file-upload-button');
|
|
541
543
|
$button.type = 'button';
|