govuk_tech_docs 4.2.0 → 4.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (72) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +10 -0
  3. data/govuk_tech_docs.gemspec +1 -1
  4. data/lib/assets/stylesheets/_govuk_tech_docs.scss +3 -0
  5. data/lib/govuk_tech_docs/version.rb +1 -1
  6. data/node_modules/govuk-frontend/dist/govuk/all.bundle.js +508 -209
  7. data/node_modules/govuk-frontend/dist/govuk/all.bundle.mjs +505 -208
  8. data/node_modules/govuk-frontend/dist/govuk/all.mjs +3 -1
  9. data/node_modules/govuk-frontend/dist/govuk/all.scss +6 -0
  10. data/node_modules/govuk-frontend/dist/govuk/common/configuration.mjs +169 -0
  11. data/node_modules/govuk-frontend/dist/govuk/common/govuk-frontend-version.mjs +1 -1
  12. data/node_modules/govuk-frontend/dist/govuk/common/index.mjs +4 -87
  13. data/node_modules/govuk-frontend/dist/govuk/{govuk-frontend-component.mjs → component.mjs} +5 -5
  14. data/node_modules/govuk-frontend/dist/govuk/components/accordion/accordion.bundle.js +161 -116
  15. data/node_modules/govuk-frontend/dist/govuk/components/accordion/accordion.bundle.mjs +160 -115
  16. data/node_modules/govuk-frontend/dist/govuk/components/accordion/accordion.mjs +5 -8
  17. data/node_modules/govuk-frontend/dist/govuk/components/button/button.bundle.js +161 -116
  18. data/node_modules/govuk-frontend/dist/govuk/components/button/button.bundle.mjs +160 -115
  19. data/node_modules/govuk-frontend/dist/govuk/components/button/button.mjs +5 -8
  20. data/node_modules/govuk-frontend/dist/govuk/components/character-count/_index.scss +8 -0
  21. data/node_modules/govuk-frontend/dist/govuk/components/character-count/character-count.bundle.js +187 -145
  22. data/node_modules/govuk-frontend/dist/govuk/components/character-count/character-count.bundle.mjs +186 -144
  23. data/node_modules/govuk-frontend/dist/govuk/components/character-count/character-count.mjs +18 -17
  24. data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/checkboxes.bundle.js +9 -29
  25. data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/checkboxes.bundle.mjs +8 -28
  26. data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/checkboxes.mjs +2 -2
  27. data/node_modules/govuk-frontend/dist/govuk/components/error-summary/error-summary.bundle.js +161 -116
  28. data/node_modules/govuk-frontend/dist/govuk/components/error-summary/error-summary.bundle.mjs +160 -115
  29. data/node_modules/govuk-frontend/dist/govuk/components/error-summary/error-summary.mjs +6 -8
  30. data/node_modules/govuk-frontend/dist/govuk/components/exit-this-page/exit-this-page.bundle.js +161 -116
  31. data/node_modules/govuk-frontend/dist/govuk/components/exit-this-page/exit-this-page.bundle.mjs +160 -115
  32. data/node_modules/govuk-frontend/dist/govuk/components/exit-this-page/exit-this-page.mjs +5 -8
  33. data/node_modules/govuk-frontend/dist/govuk/components/file-upload/_index.scss +167 -0
  34. data/node_modules/govuk-frontend/dist/govuk/components/file-upload/file-upload.bundle.js +754 -0
  35. data/node_modules/govuk-frontend/dist/govuk/components/file-upload/file-upload.bundle.mjs +746 -0
  36. data/node_modules/govuk-frontend/dist/govuk/components/file-upload/file-upload.mjs +267 -0
  37. data/node_modules/govuk-frontend/dist/govuk/components/header/_index.scss +14 -10
  38. data/node_modules/govuk-frontend/dist/govuk/components/header/header.bundle.js +9 -29
  39. data/node_modules/govuk-frontend/dist/govuk/components/header/header.bundle.mjs +8 -28
  40. data/node_modules/govuk-frontend/dist/govuk/components/header/header.mjs +2 -2
  41. data/node_modules/govuk-frontend/dist/govuk/components/notification-banner/notification-banner.bundle.js +161 -116
  42. data/node_modules/govuk-frontend/dist/govuk/components/notification-banner/notification-banner.bundle.mjs +160 -115
  43. data/node_modules/govuk-frontend/dist/govuk/components/notification-banner/notification-banner.mjs +6 -8
  44. data/node_modules/govuk-frontend/dist/govuk/components/password-input/password-input.bundle.js +161 -117
  45. data/node_modules/govuk-frontend/dist/govuk/components/password-input/password-input.bundle.mjs +160 -116
  46. data/node_modules/govuk-frontend/dist/govuk/components/password-input/password-input.mjs +5 -9
  47. data/node_modules/govuk-frontend/dist/govuk/components/radios/radios.bundle.js +9 -29
  48. data/node_modules/govuk-frontend/dist/govuk/components/radios/radios.bundle.mjs +8 -28
  49. data/node_modules/govuk-frontend/dist/govuk/components/radios/radios.mjs +2 -2
  50. data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/service-navigation.bundle.js +9 -29
  51. data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/service-navigation.bundle.mjs +8 -28
  52. data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/service-navigation.mjs +2 -2
  53. data/node_modules/govuk-frontend/dist/govuk/components/skip-link/skip-link.bundle.js +10 -30
  54. data/node_modules/govuk-frontend/dist/govuk/components/skip-link/skip-link.bundle.mjs +9 -29
  55. data/node_modules/govuk-frontend/dist/govuk/components/skip-link/skip-link.mjs +3 -3
  56. data/node_modules/govuk-frontend/dist/govuk/components/summary-list/_index.scss +12 -21
  57. data/node_modules/govuk-frontend/dist/govuk/components/tabs/tabs.bundle.js +9 -29
  58. data/node_modules/govuk-frontend/dist/govuk/components/tabs/tabs.bundle.mjs +8 -28
  59. data/node_modules/govuk-frontend/dist/govuk/components/tabs/tabs.mjs +2 -2
  60. data/node_modules/govuk-frontend/dist/govuk/core/_govuk-frontend-properties.scss +1 -1
  61. data/node_modules/govuk-frontend/dist/govuk/errors/index.mjs +1 -1
  62. data/node_modules/govuk-frontend/dist/govuk/govuk-frontend.min.js +1 -1
  63. data/node_modules/govuk-frontend/dist/govuk/helpers/_colour.scss +2 -2
  64. data/node_modules/govuk-frontend/dist/govuk/init.mjs +28 -24
  65. data/node_modules/govuk-frontend/dist/govuk/settings/_colours-organisations.scss +18 -5
  66. data/node_modules/govuk-frontend/dist/govuk/settings/_typography-responsive.scss +5 -10
  67. data/node_modules/govuk-frontend/dist/govuk-prototype-kit/init.scss +1 -1
  68. data/package-lock.json +8 -7
  69. data/package.json +1 -1
  70. metadata +12 -10
  71. data/node_modules/govuk-frontend/dist/govuk/common/normalise-dataset.mjs +0 -18
  72. data/node_modules/govuk-frontend/dist/govuk/common/normalise-string.mjs +0 -31
@@ -1,6 +1,4 @@
1
- import { mergeConfigs } from '../../common/index.mjs';
2
- import { normaliseDataset } from '../../common/normalise-dataset.mjs';
3
- import { GOVUKFrontendComponent } from '../../govuk-frontend-component.mjs';
1
+ import { ConfigurableComponent } from '../../common/configuration.mjs';
4
2
 
5
3
  const DEBOUNCE_TIMEOUT_IN_SECONDS = 1;
6
4
 
@@ -8,17 +6,16 @@ const DEBOUNCE_TIMEOUT_IN_SECONDS = 1;
8
6
  * JavaScript enhancements for the Button component
9
7
  *
10
8
  * @preserve
9
+ * @augments ConfigurableComponent<ButtonConfig>
11
10
  */
12
- class Button extends GOVUKFrontendComponent {
11
+ class Button extends ConfigurableComponent {
13
12
  /**
14
13
  * @param {Element | null} $root - HTML element to use for button
15
14
  * @param {ButtonConfig} [config] - Button config
16
15
  */
17
16
  constructor($root, config = {}) {
18
- super($root);
19
- this.config = void 0;
17
+ super($root, config);
20
18
  this.debounceFormSubmitTimer = null;
21
- this.config = mergeConfigs(Button.defaults, config, normaliseDataset(Button, this.$root.dataset));
22
19
  this.$root.addEventListener('keydown', event => this.handleKeyDown(event));
23
20
  this.$root.addEventListener('click', event => this.debounce(event));
24
21
  }
@@ -55,7 +52,7 @@ class Button extends GOVUKFrontendComponent {
55
52
  */
56
53
 
57
54
  /**
58
- * @typedef {import('../../common/index.mjs').Schema} Schema
55
+ * @import { Schema } from '../../common/configuration.mjs'
59
56
  */
60
57
  Button.moduleName = 'govuk-button';
61
58
  Button.defaults = Object.freeze({
@@ -11,6 +11,14 @@
11
11
  .govuk-textarea {
12
12
  margin-bottom: govuk-spacing(1);
13
13
  }
14
+
15
+ // If the textarea enters the error state whilst the user is focused on it,
16
+ // show the error state. This presents feedback to the user that the value
17
+ // has become invalid without needing to see the counter.
18
+ .govuk-textarea--error:focus {
19
+ border-color: $govuk-error-colour;
20
+ box-shadow: inset 0 0 0 $govuk-border-width-form-element $govuk-error-colour;
21
+ }
14
22
  }
15
23
 
16
24
  .govuk-character-count__message {
@@ -1,7 +1,7 @@
1
1
  (function (global, factory) {
2
2
  typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
3
3
  typeof define === 'function' && define.amd ? define(['exports'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.GOVUKFrontend = {}));
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.GOVUKFrontend = global.GOVUKFrontend || {}));
5
5
  })(this, (function (exports) { 'use strict';
6
6
 
7
7
  function closestAttributeValue($element, attributeName) {
@@ -9,76 +9,6 @@
9
9
  return $closestElementWithAttribute ? $closestElementWithAttribute.getAttribute(attributeName) : null;
10
10
  }
11
11
 
12
- function normaliseString(value, property) {
13
- const trimmedValue = value ? value.trim() : '';
14
- let output;
15
- let outputType = property == null ? void 0 : property.type;
16
- if (!outputType) {
17
- if (['true', 'false'].includes(trimmedValue)) {
18
- outputType = 'boolean';
19
- }
20
- if (trimmedValue.length > 0 && isFinite(Number(trimmedValue))) {
21
- outputType = 'number';
22
- }
23
- }
24
- switch (outputType) {
25
- case 'boolean':
26
- output = trimmedValue === 'true';
27
- break;
28
- case 'number':
29
- output = Number(trimmedValue);
30
- break;
31
- default:
32
- output = value;
33
- }
34
- return output;
35
- }
36
-
37
- /**
38
- * @typedef {import('./index.mjs').SchemaProperty} SchemaProperty
39
- */
40
-
41
- function mergeConfigs(...configObjects) {
42
- const formattedConfigObject = {};
43
- for (const configObject of configObjects) {
44
- for (const key of Object.keys(configObject)) {
45
- const option = formattedConfigObject[key];
46
- const override = configObject[key];
47
- if (isObject(option) && isObject(override)) {
48
- formattedConfigObject[key] = mergeConfigs(option, override);
49
- } else {
50
- formattedConfigObject[key] = override;
51
- }
52
- }
53
- }
54
- return formattedConfigObject;
55
- }
56
- function extractConfigByNamespace(Component, dataset, namespace) {
57
- const property = Component.schema.properties[namespace];
58
- if ((property == null ? void 0 : property.type) !== 'object') {
59
- return;
60
- }
61
- const newObject = {
62
- [namespace]: ({})
63
- };
64
- for (const [key, value] of Object.entries(dataset)) {
65
- let current = newObject;
66
- const keyParts = key.split('.');
67
- for (const [index, name] of keyParts.entries()) {
68
- if (typeof current === 'object') {
69
- if (index < keyParts.length - 1) {
70
- if (!isObject(current[name])) {
71
- current[name] = {};
72
- }
73
- current = current[name];
74
- } else if (key !== namespace) {
75
- current[name] = normaliseString(value);
76
- }
77
- }
78
- }
79
- }
80
- return newObject[namespace];
81
- }
82
12
  function isInitialised($root, moduleName) {
83
13
  return $root instanceof HTMLElement && $root.hasAttribute(`data-${moduleName}-init`);
84
14
  }
@@ -98,26 +28,6 @@
98
28
  }
99
29
  return $scope.classList.contains('govuk-frontend-supported');
100
30
  }
101
- function validateConfig(schema, config) {
102
- const validationErrors = [];
103
- for (const [name, conditions] of Object.entries(schema)) {
104
- const errors = [];
105
- if (Array.isArray(conditions)) {
106
- for (const {
107
- required,
108
- errorMessage
109
- } of conditions) {
110
- if (!required.every(key => !!config[key])) {
111
- errors.push(errorMessage);
112
- }
113
- }
114
- if (name === 'anyOf' && !(conditions.length - errors.length >= 1)) {
115
- validationErrors.push(...errors);
116
- }
117
- }
118
- }
119
- return validationErrors;
120
- }
121
31
  function isArray(option) {
122
32
  return Array.isArray(option);
123
33
  }
@@ -127,46 +37,13 @@
127
37
  function formatErrorMessage(Component, message) {
128
38
  return `${Component.moduleName}: ${message}`;
129
39
  }
130
-
131
- /**
132
- * Schema for component config
133
- *
134
- * @typedef {object} Schema
135
- * @property {{ [field: string]: SchemaProperty | undefined }} properties - Schema properties
136
- * @property {SchemaCondition[]} [anyOf] - List of schema conditions
137
- */
138
-
139
- /**
140
- * Schema property for component config
141
- *
142
- * @typedef {object} SchemaProperty
143
- * @property {'string' | 'boolean' | 'number' | 'object'} type - Property type
144
- */
145
-
146
- /**
147
- * Schema condition for component config
148
- *
149
- * @typedef {object} SchemaCondition
150
- * @property {string[]} required - List of required config fields
151
- * @property {string} errorMessage - Error message when required config fields not provided
152
- */
153
40
  /**
154
41
  * @typedef ComponentWithModuleName
155
42
  * @property {string} moduleName - Name of the component
156
43
  */
157
-
158
- function normaliseDataset(Component, dataset) {
159
- const out = {};
160
- for (const [field, property] of Object.entries(Component.schema.properties)) {
161
- if (field in dataset) {
162
- out[field] = normaliseString(dataset[field], property);
163
- }
164
- if ((property == null ? void 0 : property.type) === 'object') {
165
- out[field] = extractConfigByNamespace(Component, dataset, field);
166
- }
167
- }
168
- return out;
169
- }
44
+ /**
45
+ * @import { ObjectNested } from './configuration.mjs'
46
+ */
170
47
 
171
48
  class GOVUKFrontendError extends Error {
172
49
  constructor(...args) {
@@ -218,10 +95,10 @@
218
95
  }
219
96
  }
220
97
  /**
221
- * @typedef {import('../common/index.mjs').ComponentWithModuleName} ComponentWithModuleName
98
+ * @import { ComponentWithModuleName } from '../common/index.mjs'
222
99
  */
223
100
 
224
- class GOVUKFrontendComponent {
101
+ class Component {
225
102
  /**
226
103
  * Returns the root element of the component
227
104
  *
@@ -272,9 +149,172 @@
272
149
  */
273
150
 
274
151
  /**
275
- * @typedef {typeof GOVUKFrontendComponent & ChildClass} ChildClassConstructor
152
+ * @typedef {typeof Component & ChildClass} ChildClassConstructor
153
+ */
154
+ Component.elementType = HTMLElement;
155
+
156
+ const configOverride = Symbol.for('configOverride');
157
+ class ConfigurableComponent extends Component {
158
+ [configOverride](param) {
159
+ return {};
160
+ }
161
+
162
+ /**
163
+ * Returns the root element of the component
164
+ *
165
+ * @protected
166
+ * @returns {ConfigurationType} - the root element of component
167
+ */
168
+ get config() {
169
+ return this._config;
170
+ }
171
+ constructor($root, config) {
172
+ super($root);
173
+ this._config = void 0;
174
+ const childConstructor = this.constructor;
175
+ if (!isObject(childConstructor.defaults)) {
176
+ throw new ConfigError(formatErrorMessage(childConstructor, 'Config passed as parameter into constructor but no defaults defined'));
177
+ }
178
+ const datasetConfig = normaliseDataset(childConstructor, this._$root.dataset);
179
+ this._config = mergeConfigs(childConstructor.defaults, config != null ? config : {}, this[configOverride](datasetConfig), datasetConfig);
180
+ }
181
+ }
182
+ function normaliseString(value, property) {
183
+ const trimmedValue = value ? value.trim() : '';
184
+ let output;
185
+ let outputType = property == null ? void 0 : property.type;
186
+ if (!outputType) {
187
+ if (['true', 'false'].includes(trimmedValue)) {
188
+ outputType = 'boolean';
189
+ }
190
+ if (trimmedValue.length > 0 && isFinite(Number(trimmedValue))) {
191
+ outputType = 'number';
192
+ }
193
+ }
194
+ switch (outputType) {
195
+ case 'boolean':
196
+ output = trimmedValue === 'true';
197
+ break;
198
+ case 'number':
199
+ output = Number(trimmedValue);
200
+ break;
201
+ default:
202
+ output = value;
203
+ }
204
+ return output;
205
+ }
206
+ function normaliseDataset(Component, dataset) {
207
+ if (!isObject(Component.schema)) {
208
+ throw new ConfigError(formatErrorMessage(Component, 'Config passed as parameter into constructor but no schema defined'));
209
+ }
210
+ const out = {};
211
+ const entries = Object.entries(Component.schema.properties);
212
+ for (const entry of entries) {
213
+ const [namespace, property] = entry;
214
+ const field = namespace.toString();
215
+ if (field in dataset) {
216
+ out[field] = normaliseString(dataset[field], property);
217
+ }
218
+ if ((property == null ? void 0 : property.type) === 'object') {
219
+ out[field] = extractConfigByNamespace(Component.schema, dataset, namespace);
220
+ }
221
+ }
222
+ return out;
223
+ }
224
+ function mergeConfigs(...configObjects) {
225
+ const formattedConfigObject = {};
226
+ for (const configObject of configObjects) {
227
+ for (const key of Object.keys(configObject)) {
228
+ const option = formattedConfigObject[key];
229
+ const override = configObject[key];
230
+ if (isObject(option) && isObject(override)) {
231
+ formattedConfigObject[key] = mergeConfigs(option, override);
232
+ } else {
233
+ formattedConfigObject[key] = override;
234
+ }
235
+ }
236
+ }
237
+ return formattedConfigObject;
238
+ }
239
+ function validateConfig(schema, config) {
240
+ const validationErrors = [];
241
+ for (const [name, conditions] of Object.entries(schema)) {
242
+ const errors = [];
243
+ if (Array.isArray(conditions)) {
244
+ for (const {
245
+ required,
246
+ errorMessage
247
+ } of conditions) {
248
+ if (!required.every(key => !!config[key])) {
249
+ errors.push(errorMessage);
250
+ }
251
+ }
252
+ if (name === 'anyOf' && !(conditions.length - errors.length >= 1)) {
253
+ validationErrors.push(...errors);
254
+ }
255
+ }
256
+ }
257
+ return validationErrors;
258
+ }
259
+ function extractConfigByNamespace(schema, dataset, namespace) {
260
+ const property = schema.properties[namespace];
261
+ if ((property == null ? void 0 : property.type) !== 'object') {
262
+ return;
263
+ }
264
+ const newObject = {
265
+ [namespace]: {}
266
+ };
267
+ for (const [key, value] of Object.entries(dataset)) {
268
+ let current = newObject;
269
+ const keyParts = key.split('.');
270
+ for (const [index, name] of keyParts.entries()) {
271
+ if (isObject(current)) {
272
+ if (index < keyParts.length - 1) {
273
+ if (!isObject(current[name])) {
274
+ current[name] = {};
275
+ }
276
+ current = current[name];
277
+ } else if (key !== namespace) {
278
+ current[name] = normaliseString(value);
279
+ }
280
+ }
281
+ }
282
+ }
283
+ return newObject[namespace];
284
+ }
285
+ /**
286
+ * Schema for component config
287
+ *
288
+ * @template {Partial<Record<keyof ConfigurationType, unknown>>} ConfigurationType
289
+ * @typedef {object} Schema
290
+ * @property {Record<keyof ConfigurationType, SchemaProperty | undefined>} properties - Schema properties
291
+ * @property {SchemaCondition<ConfigurationType>[]} [anyOf] - List of schema conditions
292
+ */
293
+ /**
294
+ * Schema property for component config
295
+ *
296
+ * @typedef {object} SchemaProperty
297
+ * @property {'string' | 'boolean' | 'number' | 'object'} type - Property type
298
+ */
299
+ /**
300
+ * Schema condition for component config
301
+ *
302
+ * @template {Partial<Record<keyof ConfigurationType, unknown>>} ConfigurationType
303
+ * @typedef {object} SchemaCondition
304
+ * @property {(keyof ConfigurationType)[]} required - List of required config fields
305
+ * @property {string} errorMessage - Error message when required config fields not provided
306
+ */
307
+ /**
308
+ * @template {Partial<Record<keyof ConfigurationType, unknown>>} [ConfigurationType=ObjectNested]
309
+ * @typedef ChildClass
310
+ * @property {string} moduleName - The module name that'll be looked for in the DOM when initialising the component
311
+ * @property {Schema<ConfigurationType>} [schema] - The schema of the component configuration
312
+ * @property {ConfigurationType} [defaults] - The default values of the configuration of the component
313
+ */
314
+ /**
315
+ * @template {Partial<Record<keyof ConfigurationType, unknown>>} [ConfigurationType=ObjectNested]
316
+ * @typedef {typeof Component & ChildClass<ConfigurationType>} ChildClassConstructor<ConfigurationType>
276
317
  */
277
- GOVUKFrontendComponent.elementType = HTMLElement;
278
318
 
279
319
  class I18n {
280
320
  constructor(translations = {}, config = {}) {
@@ -480,22 +520,33 @@
480
520
  * of the available characters/words has been entered.
481
521
  *
482
522
  * @preserve
523
+ * @augments ConfigurableComponent<CharacterCountConfig>
483
524
  */
484
- class CharacterCount extends GOVUKFrontendComponent {
525
+ class CharacterCount extends ConfigurableComponent {
526
+ [configOverride](datasetConfig) {
527
+ let configOverrides = {};
528
+ if ('maxwords' in datasetConfig || 'maxlength' in datasetConfig) {
529
+ configOverrides = {
530
+ maxlength: undefined,
531
+ maxwords: undefined
532
+ };
533
+ }
534
+ return configOverrides;
535
+ }
536
+
485
537
  /**
486
538
  * @param {Element | null} $root - HTML element to use for character count
487
539
  * @param {CharacterCountConfig} [config] - Character count config
488
540
  */
489
541
  constructor($root, config = {}) {
490
542
  var _ref, _this$config$maxwords;
491
- super($root);
543
+ super($root, config);
492
544
  this.$textarea = void 0;
493
545
  this.$visibleCountMessage = void 0;
494
546
  this.$screenReaderCountMessage = void 0;
495
547
  this.lastInputTimestamp = null;
496
548
  this.lastInputValue = '';
497
549
  this.valueChecker = null;
498
- this.config = void 0;
499
550
  this.i18n = void 0;
500
551
  this.maxLength = void 0;
501
552
  const $textarea = this.$root.querySelector('.govuk-js-character-count');
@@ -507,15 +558,6 @@
507
558
  identifier: 'Form field (`.govuk-js-character-count`)'
508
559
  });
509
560
  }
510
- const datasetConfig = normaliseDataset(CharacterCount, this.$root.dataset);
511
- let configOverrides = {};
512
- if ('maxwords' in datasetConfig || 'maxlength' in datasetConfig) {
513
- configOverrides = {
514
- maxlength: undefined,
515
- maxwords: undefined
516
- };
517
- }
518
- this.config = mergeConfigs(CharacterCount.defaults, config, configOverrides, datasetConfig);
519
561
  const errors = validateConfig(CharacterCount.schema, this.config);
520
562
  if (errors[0]) {
521
563
  throw new ConfigError(formatErrorMessage(CharacterCount, errors[0]));
@@ -701,8 +743,8 @@
701
743
  */
702
744
 
703
745
  /**
704
- * @typedef {import('../../common/index.mjs').Schema} Schema
705
- * @typedef {import('../../i18n.mjs').TranslationPluralForms} TranslationPluralForms
746
+ * @import { Schema } from '../../common/configuration.mjs'
747
+ * @import { TranslationPluralForms } from '../../i18n.mjs'
706
748
  */
707
749
  CharacterCount.moduleName = 'govuk-character-count';
708
750
  CharacterCount.defaults = Object.freeze({