govuk_tech_docs 4.1.2 → 4.3.0

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 (74) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +18 -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/meta_tags.rb +5 -1
  6. data/lib/govuk_tech_docs/version.rb +1 -1
  7. data/lib/source/layouts/core.erb +21 -5
  8. data/node_modules/govuk-frontend/dist/govuk/all.bundle.js +508 -209
  9. data/node_modules/govuk-frontend/dist/govuk/all.bundle.mjs +505 -208
  10. data/node_modules/govuk-frontend/dist/govuk/all.mjs +3 -1
  11. data/node_modules/govuk-frontend/dist/govuk/all.scss +6 -0
  12. data/node_modules/govuk-frontend/dist/govuk/common/configuration.mjs +169 -0
  13. data/node_modules/govuk-frontend/dist/govuk/common/govuk-frontend-version.mjs +1 -1
  14. data/node_modules/govuk-frontend/dist/govuk/common/index.mjs +4 -87
  15. data/node_modules/govuk-frontend/dist/govuk/{govuk-frontend-component.mjs → component.mjs} +5 -5
  16. data/node_modules/govuk-frontend/dist/govuk/components/accordion/accordion.bundle.js +161 -116
  17. data/node_modules/govuk-frontend/dist/govuk/components/accordion/accordion.bundle.mjs +160 -115
  18. data/node_modules/govuk-frontend/dist/govuk/components/accordion/accordion.mjs +5 -8
  19. data/node_modules/govuk-frontend/dist/govuk/components/button/button.bundle.js +161 -116
  20. data/node_modules/govuk-frontend/dist/govuk/components/button/button.bundle.mjs +160 -115
  21. data/node_modules/govuk-frontend/dist/govuk/components/button/button.mjs +5 -8
  22. data/node_modules/govuk-frontend/dist/govuk/components/character-count/_index.scss +8 -0
  23. data/node_modules/govuk-frontend/dist/govuk/components/character-count/character-count.bundle.js +187 -145
  24. data/node_modules/govuk-frontend/dist/govuk/components/character-count/character-count.bundle.mjs +186 -144
  25. data/node_modules/govuk-frontend/dist/govuk/components/character-count/character-count.mjs +18 -17
  26. data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/checkboxes.bundle.js +9 -29
  27. data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/checkboxes.bundle.mjs +8 -28
  28. data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/checkboxes.mjs +2 -2
  29. data/node_modules/govuk-frontend/dist/govuk/components/error-summary/error-summary.bundle.js +161 -116
  30. data/node_modules/govuk-frontend/dist/govuk/components/error-summary/error-summary.bundle.mjs +160 -115
  31. data/node_modules/govuk-frontend/dist/govuk/components/error-summary/error-summary.mjs +6 -8
  32. data/node_modules/govuk-frontend/dist/govuk/components/exit-this-page/exit-this-page.bundle.js +161 -116
  33. data/node_modules/govuk-frontend/dist/govuk/components/exit-this-page/exit-this-page.bundle.mjs +160 -115
  34. data/node_modules/govuk-frontend/dist/govuk/components/exit-this-page/exit-this-page.mjs +5 -8
  35. data/node_modules/govuk-frontend/dist/govuk/components/file-upload/_index.scss +167 -0
  36. data/node_modules/govuk-frontend/dist/govuk/components/file-upload/file-upload.bundle.js +754 -0
  37. data/node_modules/govuk-frontend/dist/govuk/components/file-upload/file-upload.bundle.mjs +746 -0
  38. data/node_modules/govuk-frontend/dist/govuk/components/file-upload/file-upload.mjs +267 -0
  39. data/node_modules/govuk-frontend/dist/govuk/components/header/_index.scss +14 -10
  40. data/node_modules/govuk-frontend/dist/govuk/components/header/header.bundle.js +9 -29
  41. data/node_modules/govuk-frontend/dist/govuk/components/header/header.bundle.mjs +8 -28
  42. data/node_modules/govuk-frontend/dist/govuk/components/header/header.mjs +2 -2
  43. data/node_modules/govuk-frontend/dist/govuk/components/notification-banner/notification-banner.bundle.js +161 -116
  44. data/node_modules/govuk-frontend/dist/govuk/components/notification-banner/notification-banner.bundle.mjs +160 -115
  45. data/node_modules/govuk-frontend/dist/govuk/components/notification-banner/notification-banner.mjs +6 -8
  46. data/node_modules/govuk-frontend/dist/govuk/components/password-input/password-input.bundle.js +161 -117
  47. data/node_modules/govuk-frontend/dist/govuk/components/password-input/password-input.bundle.mjs +160 -116
  48. data/node_modules/govuk-frontend/dist/govuk/components/password-input/password-input.mjs +5 -9
  49. data/node_modules/govuk-frontend/dist/govuk/components/radios/radios.bundle.js +9 -29
  50. data/node_modules/govuk-frontend/dist/govuk/components/radios/radios.bundle.mjs +8 -28
  51. data/node_modules/govuk-frontend/dist/govuk/components/radios/radios.mjs +2 -2
  52. data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/service-navigation.bundle.js +9 -29
  53. data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/service-navigation.bundle.mjs +8 -28
  54. data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/service-navigation.mjs +2 -2
  55. data/node_modules/govuk-frontend/dist/govuk/components/skip-link/skip-link.bundle.js +10 -30
  56. data/node_modules/govuk-frontend/dist/govuk/components/skip-link/skip-link.bundle.mjs +9 -29
  57. data/node_modules/govuk-frontend/dist/govuk/components/skip-link/skip-link.mjs +3 -3
  58. data/node_modules/govuk-frontend/dist/govuk/components/summary-list/_index.scss +12 -21
  59. data/node_modules/govuk-frontend/dist/govuk/components/tabs/tabs.bundle.js +9 -29
  60. data/node_modules/govuk-frontend/dist/govuk/components/tabs/tabs.bundle.mjs +8 -28
  61. data/node_modules/govuk-frontend/dist/govuk/components/tabs/tabs.mjs +2 -2
  62. data/node_modules/govuk-frontend/dist/govuk/core/_govuk-frontend-properties.scss +1 -1
  63. data/node_modules/govuk-frontend/dist/govuk/errors/index.mjs +1 -1
  64. data/node_modules/govuk-frontend/dist/govuk/govuk-frontend.min.js +1 -1
  65. data/node_modules/govuk-frontend/dist/govuk/helpers/_colour.scss +2 -2
  66. data/node_modules/govuk-frontend/dist/govuk/init.mjs +28 -24
  67. data/node_modules/govuk-frontend/dist/govuk/settings/_colours-organisations.scss +18 -5
  68. data/node_modules/govuk-frontend/dist/govuk/settings/_typography-responsive.scss +5 -10
  69. data/node_modules/govuk-frontend/dist/govuk-prototype-kit/init.scss +1 -1
  70. data/package-lock.json +8 -7
  71. data/package.json +1 -1
  72. metadata +12 -10
  73. data/node_modules/govuk-frontend/dist/govuk/common/normalise-dataset.mjs +0 -18
  74. data/node_modules/govuk-frontend/dist/govuk/common/normalise-string.mjs +0 -31
@@ -0,0 +1,267 @@
1
+ import { closestAttributeValue } from '../../common/closest-attribute-value.mjs';
2
+ import { ConfigurableComponent } from '../../common/configuration.mjs';
3
+ import { formatErrorMessage } from '../../common/index.mjs';
4
+ import { ElementError } from '../../errors/index.mjs';
5
+ import { I18n } from '../../i18n.mjs';
6
+
7
+ /**
8
+ * File upload component
9
+ *
10
+ * @preserve
11
+ * @augments ConfigurableComponent<FileUploadConfig>
12
+ */
13
+ class FileUpload extends ConfigurableComponent {
14
+ /**
15
+ * @param {Element | null} $root - File input element
16
+ * @param {FileUploadConfig} [config] - File Upload config
17
+ */
18
+ constructor($root, config = {}) {
19
+ super($root, config);
20
+ this.$input = void 0;
21
+ this.$button = void 0;
22
+ this.$status = void 0;
23
+ this.i18n = void 0;
24
+ this.id = void 0;
25
+ const $input = this.$root.querySelector('input');
26
+ if ($input === null) {
27
+ throw new ElementError({
28
+ component: FileUpload,
29
+ identifier: 'File inputs (`<input type="file">`)'
30
+ });
31
+ }
32
+ if ($input.type !== 'file') {
33
+ throw new ElementError(formatErrorMessage(FileUpload, 'File input (`<input type="file">`) attribute (`type`) is not `file`'));
34
+ }
35
+ this.$input = $input;
36
+ this.$input.setAttribute('hidden', 'true');
37
+ if (!this.$input.id) {
38
+ throw new ElementError({
39
+ component: FileUpload,
40
+ identifier: 'File input (`<input type="file">`) attribute (`id`)'
41
+ });
42
+ }
43
+ this.id = this.$input.id;
44
+ this.i18n = new I18n(this.config.i18n, {
45
+ locale: closestAttributeValue(this.$root, 'lang')
46
+ });
47
+ const $label = this.findLabel();
48
+ if (!$label.id) {
49
+ $label.id = `${this.id}-label`;
50
+ }
51
+ this.$input.id = `${this.id}-input`;
52
+ const $button = document.createElement('button');
53
+ $button.classList.add('govuk-file-upload-button');
54
+ $button.type = 'button';
55
+ $button.id = this.id;
56
+ $button.classList.add('govuk-file-upload-button--empty');
57
+ const ariaDescribedBy = this.$input.getAttribute('aria-describedby');
58
+ if (ariaDescribedBy) {
59
+ $button.setAttribute('aria-describedby', ariaDescribedBy);
60
+ }
61
+ const $status = document.createElement('span');
62
+ $status.className = 'govuk-body govuk-file-upload-button__status';
63
+ $status.setAttribute('aria-live', 'polite');
64
+ $status.innerText = this.i18n.t('noFileChosen');
65
+ $button.appendChild($status);
66
+ const commaSpan = document.createElement('span');
67
+ commaSpan.className = 'govuk-visually-hidden';
68
+ commaSpan.innerText = ', ';
69
+ commaSpan.id = `${this.id}-comma`;
70
+ $button.appendChild(commaSpan);
71
+ const containerSpan = document.createElement('span');
72
+ containerSpan.className = 'govuk-file-upload-button__pseudo-button-container';
73
+ const buttonSpan = document.createElement('span');
74
+ buttonSpan.className = 'govuk-button govuk-button--secondary govuk-file-upload-button__pseudo-button';
75
+ buttonSpan.innerText = this.i18n.t('chooseFilesButton');
76
+ containerSpan.appendChild(buttonSpan);
77
+ containerSpan.insertAdjacentText('beforeend', ' ');
78
+ const instructionSpan = document.createElement('span');
79
+ instructionSpan.className = 'govuk-body govuk-file-upload-button__instruction';
80
+ instructionSpan.innerText = this.i18n.t('dropInstruction');
81
+ containerSpan.appendChild(instructionSpan);
82
+ $button.appendChild(containerSpan);
83
+ $button.setAttribute('aria-labelledby', `${$label.id} ${commaSpan.id} ${$button.id}`);
84
+ $button.addEventListener('click', this.onClick.bind(this));
85
+ $button.addEventListener('dragover', event => {
86
+ event.preventDefault();
87
+ });
88
+ this.$root.insertAdjacentElement('afterbegin', $button);
89
+ this.$input.setAttribute('tabindex', '-1');
90
+ this.$input.setAttribute('aria-hidden', 'true');
91
+ this.$button = $button;
92
+ this.$status = $status;
93
+ this.$input.addEventListener('change', this.onChange.bind(this));
94
+ this.updateDisabledState();
95
+ this.observeDisabledState();
96
+ this.$announcements = document.createElement('span');
97
+ this.$announcements.classList.add('govuk-file-upload-announcements');
98
+ this.$announcements.classList.add('govuk-visually-hidden');
99
+ this.$announcements.setAttribute('aria-live', 'assertive');
100
+ this.$root.insertAdjacentElement('afterend', this.$announcements);
101
+ this.$button.addEventListener('drop', this.onDrop.bind(this));
102
+ document.addEventListener('dragenter', this.updateDropzoneVisibility.bind(this));
103
+ document.addEventListener('dragenter', () => {
104
+ this.enteredAnotherElement = true;
105
+ });
106
+ document.addEventListener('dragleave', () => {
107
+ if (!this.enteredAnotherElement && !this.$button.disabled) {
108
+ this.hideDraggingState();
109
+ this.$announcements.innerText = this.i18n.t('leftDropZone');
110
+ }
111
+ this.enteredAnotherElement = false;
112
+ });
113
+ }
114
+
115
+ /**
116
+ * Updates the visibility of the dropzone as users enters the various elements on the page
117
+ *
118
+ * @param {DragEvent} event - The `dragenter` event
119
+ */
120
+ updateDropzoneVisibility(event) {
121
+ if (this.$button.disabled) return;
122
+ if (event.target instanceof Node) {
123
+ if (this.$root.contains(event.target)) {
124
+ if (event.dataTransfer && isContainingFiles(event.dataTransfer)) {
125
+ if (!this.$button.classList.contains('govuk-file-upload-button--dragging')) {
126
+ this.showDraggingState();
127
+ this.$announcements.innerText = this.i18n.t('enteredDropZone');
128
+ }
129
+ }
130
+ } else {
131
+ if (this.$button.classList.contains('govuk-file-upload-button--dragging')) {
132
+ this.hideDraggingState();
133
+ this.$announcements.innerText = this.i18n.t('leftDropZone');
134
+ }
135
+ }
136
+ }
137
+ }
138
+ showDraggingState() {
139
+ this.$button.classList.add('govuk-file-upload-button--dragging');
140
+ }
141
+ hideDraggingState() {
142
+ this.$button.classList.remove('govuk-file-upload-button--dragging');
143
+ }
144
+
145
+ /**
146
+ * Handles user dropping on the component
147
+ *
148
+ * @param {DragEvent} event - The `dragenter` event
149
+ */
150
+ onDrop(event) {
151
+ event.preventDefault();
152
+ if (event.dataTransfer && isContainingFiles(event.dataTransfer)) {
153
+ this.$input.files = event.dataTransfer.files;
154
+ this.$input.dispatchEvent(new CustomEvent('change'));
155
+ this.hideDraggingState();
156
+ }
157
+ }
158
+ onChange() {
159
+ const fileCount = this.$input.files.length;
160
+ if (fileCount === 0) {
161
+ this.$status.innerText = this.i18n.t('noFileChosen');
162
+ this.$button.classList.add('govuk-file-upload-button--empty');
163
+ } else {
164
+ if (fileCount === 1) {
165
+ this.$status.innerText = this.$input.files[0].name;
166
+ } else {
167
+ this.$status.innerText = this.i18n.t('multipleFilesChosen', {
168
+ count: fileCount
169
+ });
170
+ }
171
+ this.$button.classList.remove('govuk-file-upload-button--empty');
172
+ }
173
+ }
174
+ findLabel() {
175
+ const $label = document.querySelector(`label[for="${this.$input.id}"]`);
176
+ if (!$label) {
177
+ throw new ElementError({
178
+ component: FileUpload,
179
+ identifier: `Field label (\`<label for=${this.$input.id}>\`)`
180
+ });
181
+ }
182
+ return $label;
183
+ }
184
+ onClick() {
185
+ this.$input.click();
186
+ }
187
+ observeDisabledState() {
188
+ const observer = new MutationObserver(mutationList => {
189
+ for (const mutation of mutationList) {
190
+ if (mutation.type === 'attributes' && mutation.attributeName === 'disabled') {
191
+ this.updateDisabledState();
192
+ }
193
+ }
194
+ });
195
+ observer.observe(this.$input, {
196
+ attributes: true
197
+ });
198
+ }
199
+ updateDisabledState() {
200
+ this.$button.disabled = this.$input.disabled;
201
+ this.$root.classList.toggle('govuk-drop-zone--disabled', this.$button.disabled);
202
+ }
203
+ }
204
+ FileUpload.moduleName = 'govuk-file-upload';
205
+ FileUpload.defaults = Object.freeze({
206
+ i18n: {
207
+ chooseFilesButton: 'Choose file',
208
+ dropInstruction: 'or drop file',
209
+ noFileChosen: 'No file chosen',
210
+ multipleFilesChosen: {
211
+ one: '%{count} file chosen',
212
+ other: '%{count} files chosen'
213
+ },
214
+ enteredDropZone: 'Entered drop zone',
215
+ leftDropZone: 'Left drop zone'
216
+ }
217
+ });
218
+ FileUpload.schema = Object.freeze({
219
+ properties: {
220
+ i18n: {
221
+ type: 'object'
222
+ }
223
+ }
224
+ });
225
+ function isContainingFiles(dataTransfer) {
226
+ const hasNoTypesInfo = dataTransfer.types.length === 0;
227
+ const isDraggingFiles = dataTransfer.types.some(type => type === 'Files');
228
+ return hasNoTypesInfo || isDraggingFiles;
229
+ }
230
+
231
+ /**
232
+ * @typedef {HTMLInputElement & {files: FileList}} HTMLFileInputElement
233
+ */
234
+
235
+ /**
236
+ * File upload config
237
+ *
238
+ * @see {@link FileUpload.defaults}
239
+ * @typedef {object} FileUploadConfig
240
+ * @property {FileUploadTranslations} [i18n=FileUpload.defaults.i18n] - File upload translations
241
+ */
242
+
243
+ /**
244
+ * File upload translations
245
+ *
246
+ * @see {@link FileUpload.defaults.i18n}
247
+ * @typedef {object} FileUploadTranslations
248
+ *
249
+ * Messages used by the component
250
+ * @property {string} [chooseFile] - The text of the button that opens the file picker
251
+ * @property {string} [dropInstruction] - The text informing users they can drop files
252
+ * @property {TranslationPluralForms} [multipleFilesChosen] - The text displayed when multiple files
253
+ * have been chosen by the user
254
+ * @property {string} [noFileChosen] - The text to displayed when no file has been chosen by the user
255
+ * @property {string} [enteredDropZone] - The text announced by assistive technology
256
+ * when user drags files and enters the drop zone
257
+ * @property {string} [leftDropZone] - The text announced by assistive technology
258
+ * when user drags files and leaves the drop zone without dropping
259
+ */
260
+
261
+ /**
262
+ * @import { Schema } from '../../common/configuration.mjs'
263
+ * @import { TranslationPluralForms } from '../../i18n.mjs'
264
+ */
265
+
266
+ export { FileUpload };
267
+ //# sourceMappingURL=file-upload.mjs.map
@@ -204,18 +204,9 @@
204
204
 
205
205
  .govuk-header__menu-button {
206
206
  @include govuk-font($size: 16);
207
- position: absolute;
208
- // calculate top offset by:
209
- // - getting the vertical spacing for the top and the bottom of the header
210
- // - adding that to the crown height
211
- // - dividing it by 2 so you have the vertical centre of the header
212
- // - subtracting half the height of the menu button
213
- top: (((govuk-spacing($govuk-header-vertical-spacing-value) * 2) + $govuk-header-crown-height) / 2) -
214
- ($govuk-header-menu-button-height / 2);
215
- right: 0;
216
207
  max-width: $govuk-header-menu-button-width;
217
208
  min-height: $govuk-header-menu-button-height;
218
- margin: 0;
209
+ margin-bottom: govuk-spacing(1);
219
210
  padding: 0;
220
211
  border: 0;
221
212
  color: govuk-colour("white");
@@ -246,6 +237,19 @@
246
237
  @include govuk-shape-arrow($direction: up, $base: 10px, $display: inline-block);
247
238
  }
248
239
 
240
+ @include govuk-media-query($from: mobile) {
241
+ position: absolute;
242
+ // calculate top offset by:
243
+ // - getting the vertical spacing for the top and the bottom of the header
244
+ // - adding that to the crown height
245
+ // - dividing it by 2 so you have the vertical centre of the header
246
+ // - subtracting half the height of the menu button
247
+ top: (((govuk-spacing($govuk-header-vertical-spacing-value) * 2) + $govuk-header-crown-height) / 2) -
248
+ ($govuk-header-menu-button-height / 2);
249
+ right: 0;
250
+ margin: 0;
251
+ }
252
+
249
253
  @include govuk-media-query($from: tablet) {
250
254
  top: govuk-spacing(3);
251
255
  }
@@ -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 getBreakpoint(name) {
@@ -34,33 +34,13 @@
34
34
  function formatErrorMessage(Component, message) {
35
35
  return `${Component.moduleName}: ${message}`;
36
36
  }
37
-
38
- /**
39
- * Schema for component config
40
- *
41
- * @typedef {object} Schema
42
- * @property {{ [field: string]: SchemaProperty | undefined }} properties - Schema properties
43
- * @property {SchemaCondition[]} [anyOf] - List of schema conditions
44
- */
45
-
46
- /**
47
- * Schema property for component config
48
- *
49
- * @typedef {object} SchemaProperty
50
- * @property {'string' | 'boolean' | 'number' | 'object'} type - Property type
51
- */
52
-
53
- /**
54
- * Schema condition for component config
55
- *
56
- * @typedef {object} SchemaCondition
57
- * @property {string[]} required - List of required config fields
58
- * @property {string} errorMessage - Error message when required config fields not provided
59
- */
60
37
  /**
61
38
  * @typedef ComponentWithModuleName
62
39
  * @property {string} moduleName - Name of the component
63
40
  */
41
+ /**
42
+ * @import { ObjectNested } from './configuration.mjs'
43
+ */
64
44
 
65
45
  class GOVUKFrontendError extends Error {
66
46
  constructor(...args) {
@@ -106,10 +86,10 @@
106
86
  }
107
87
  }
108
88
  /**
109
- * @typedef {import('../common/index.mjs').ComponentWithModuleName} ComponentWithModuleName
89
+ * @import { ComponentWithModuleName } from '../common/index.mjs'
110
90
  */
111
91
 
112
- class GOVUKFrontendComponent {
92
+ class Component {
113
93
  /**
114
94
  * Returns the root element of the component
115
95
  *
@@ -160,16 +140,16 @@
160
140
  */
161
141
 
162
142
  /**
163
- * @typedef {typeof GOVUKFrontendComponent & ChildClass} ChildClassConstructor
143
+ * @typedef {typeof Component & ChildClass} ChildClassConstructor
164
144
  */
165
- GOVUKFrontendComponent.elementType = HTMLElement;
145
+ Component.elementType = HTMLElement;
166
146
 
167
147
  /**
168
148
  * Header component
169
149
  *
170
150
  * @preserve
171
151
  */
172
- class Header extends GOVUKFrontendComponent {
152
+ class Header extends Component {
173
153
  /**
174
154
  * Apply a matchMedia for desktop which will trigger a state sync if the
175
155
  * browser viewport moves between states.
@@ -28,33 +28,13 @@ function isSupported($scope = document.body) {
28
28
  function formatErrorMessage(Component, message) {
29
29
  return `${Component.moduleName}: ${message}`;
30
30
  }
31
-
32
- /**
33
- * Schema for component config
34
- *
35
- * @typedef {object} Schema
36
- * @property {{ [field: string]: SchemaProperty | undefined }} properties - Schema properties
37
- * @property {SchemaCondition[]} [anyOf] - List of schema conditions
38
- */
39
-
40
- /**
41
- * Schema property for component config
42
- *
43
- * @typedef {object} SchemaProperty
44
- * @property {'string' | 'boolean' | 'number' | 'object'} type - Property type
45
- */
46
-
47
- /**
48
- * Schema condition for component config
49
- *
50
- * @typedef {object} SchemaCondition
51
- * @property {string[]} required - List of required config fields
52
- * @property {string} errorMessage - Error message when required config fields not provided
53
- */
54
31
  /**
55
32
  * @typedef ComponentWithModuleName
56
33
  * @property {string} moduleName - Name of the component
57
34
  */
35
+ /**
36
+ * @import { ObjectNested } from './configuration.mjs'
37
+ */
58
38
 
59
39
  class GOVUKFrontendError extends Error {
60
40
  constructor(...args) {
@@ -100,10 +80,10 @@ class InitError extends GOVUKFrontendError {
100
80
  }
101
81
  }
102
82
  /**
103
- * @typedef {import('../common/index.mjs').ComponentWithModuleName} ComponentWithModuleName
83
+ * @import { ComponentWithModuleName } from '../common/index.mjs'
104
84
  */
105
85
 
106
- class GOVUKFrontendComponent {
86
+ class Component {
107
87
  /**
108
88
  * Returns the root element of the component
109
89
  *
@@ -154,16 +134,16 @@ class GOVUKFrontendComponent {
154
134
  */
155
135
 
156
136
  /**
157
- * @typedef {typeof GOVUKFrontendComponent & ChildClass} ChildClassConstructor
137
+ * @typedef {typeof Component & ChildClass} ChildClassConstructor
158
138
  */
159
- GOVUKFrontendComponent.elementType = HTMLElement;
139
+ Component.elementType = HTMLElement;
160
140
 
161
141
  /**
162
142
  * Header component
163
143
  *
164
144
  * @preserve
165
145
  */
166
- class Header extends GOVUKFrontendComponent {
146
+ class Header extends Component {
167
147
  /**
168
148
  * Apply a matchMedia for desktop which will trigger a state sync if the
169
149
  * browser viewport moves between states.
@@ -1,13 +1,13 @@
1
1
  import { getBreakpoint } from '../../common/index.mjs';
2
+ import { Component } from '../../component.mjs';
2
3
  import { ElementError } from '../../errors/index.mjs';
3
- import { GOVUKFrontendComponent } from '../../govuk-frontend-component.mjs';
4
4
 
5
5
  /**
6
6
  * Header component
7
7
  *
8
8
  * @preserve
9
9
  */
10
- class Header extends GOVUKFrontendComponent {
10
+ class Header extends Component {
11
11
  /**
12
12
  * Apply a matchMedia for desktop which will trigger a state sync if the
13
13
  * browser viewport moves between states.