@types/govuk-frontend 5.8.0 → 5.9.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 (28) hide show
  1. govuk-frontend/README.md +1 -1
  2. govuk-frontend/dist/govuk/all.bundle.d.mts +2 -1
  3. govuk-frontend/dist/govuk/all.bundle.d.ts +3 -1
  4. govuk-frontend/dist/govuk/common/closest-attribute-value.d.ts +4 -1
  5. govuk-frontend/dist/govuk/common/configuration.d.ts +25 -26
  6. govuk-frontend/dist/govuk/common/index.d.ts +5 -4
  7. govuk-frontend/dist/govuk/component.d.mts +1 -0
  8. govuk-frontend/dist/govuk/{govuk-frontend-component.d.ts → component.d.ts} +3 -1
  9. govuk-frontend/dist/govuk/components/accordion/accordion.d.ts +7 -2
  10. govuk-frontend/dist/govuk/components/button/button.d.ts +3 -1
  11. govuk-frontend/dist/govuk/components/character-count/character-count.d.ts +17 -6
  12. govuk-frontend/dist/govuk/components/checkboxes/checkboxes.d.ts +2 -2
  13. govuk-frontend/dist/govuk/components/error-summary/error-summary.d.ts +8 -3
  14. govuk-frontend/dist/govuk/components/exit-this-page/exit-this-page.d.ts +7 -2
  15. govuk-frontend/dist/govuk/components/file-upload/file-upload.d.mts +1 -0
  16. govuk-frontend/dist/govuk/components/file-upload/file-upload.d.ts +95 -0
  17. govuk-frontend/dist/govuk/components/header/header.d.ts +2 -2
  18. govuk-frontend/dist/govuk/components/notification-banner/notification-banner.d.ts +7 -2
  19. govuk-frontend/dist/govuk/components/password-input/password-input.d.ts +8 -2
  20. govuk-frontend/dist/govuk/components/radios/radios.d.ts +2 -2
  21. govuk-frontend/dist/govuk/components/service-navigation/service-navigation.d.ts +2 -2
  22. govuk-frontend/dist/govuk/components/skip-link/skip-link.d.ts +2 -2
  23. govuk-frontend/dist/govuk/components/tabs/tabs.d.ts +2 -2
  24. govuk-frontend/dist/govuk/errors/index.d.ts +2 -4
  25. govuk-frontend/dist/govuk/i18n.d.ts +6 -3
  26. govuk-frontend/dist/govuk/init.d.ts +11 -1
  27. govuk-frontend/package.json +3 -3
  28. govuk-frontend/dist/govuk/govuk-frontend-component.d.mts +0 -1
govuk-frontend/README.md CHANGED
@@ -8,7 +8,7 @@ This package contains type definitions for govuk-frontend (https://github.com/al
8
8
  Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/govuk-frontend.
9
9
 
10
10
  ### Additional Details
11
- * Last updated: Mon, 03 Feb 2025 16:02:40 GMT
11
+ * Last updated: Thu, 03 Apr 2025 22:35:25 GMT
12
12
  * Dependencies: none
13
13
 
14
14
  # Credits
@@ -1,12 +1,14 @@
1
1
  export { ConfigurableComponent } from "./common/configuration.mjs";
2
2
  export { version } from "./common/govuk-frontend-version.mjs";
3
3
  export { isSupported } from "./common/index.mjs";
4
+ export { Component } from "./component.mjs";
4
5
  export { Accordion } from "./components/accordion/accordion.mjs";
5
6
  export { Button } from "./components/button/button.mjs";
6
7
  export { CharacterCount } from "./components/character-count/character-count.mjs";
7
8
  export { Checkboxes } from "./components/checkboxes/checkboxes.mjs";
8
9
  export { ErrorSummary } from "./components/error-summary/error-summary.mjs";
9
10
  export { ExitThisPage } from "./components/exit-this-page/exit-this-page.mjs";
11
+ export { FileUpload } from "./components/file-upload/file-upload.mjs";
10
12
  export { Header } from "./components/header/header.mjs";
11
13
  export { NotificationBanner } from "./components/notification-banner/notification-banner.mjs";
12
14
  export { PasswordInput } from "./components/password-input/password-input.mjs";
@@ -14,5 +16,4 @@ export { Radios } from "./components/radios/radios.mjs";
14
16
  export { ServiceNavigation } from "./components/service-navigation/service-navigation.mjs";
15
17
  export { SkipLink } from "./components/skip-link/skip-link.mjs";
16
18
  export { Tabs } from "./components/tabs/tabs.mjs";
17
- export { GOVUKFrontendComponent as Component } from "./govuk-frontend-component.mjs";
18
19
  export { type Config, type ConfigKey, createAll, initAll } from "./init.mjs";
@@ -1,12 +1,14 @@
1
1
  import { ConfigurableComponent } from "./common/configuration.js";
2
2
  import { version } from "./common/govuk-frontend-version.js";
3
3
  import { isSupported } from "./common/index.js";
4
+ import { Component } from "./component.js";
4
5
  import { Accordion } from "./components/accordion/accordion.js";
5
6
  import { Button } from "./components/button/button.js";
6
7
  import { CharacterCount } from "./components/character-count/character-count.js";
7
8
  import { Checkboxes } from "./components/checkboxes/checkboxes.js";
8
9
  import { ErrorSummary } from "./components/error-summary/error-summary.js";
9
10
  import { ExitThisPage } from "./components/exit-this-page/exit-this-page.js";
11
+ import { FileUpload } from "./components/file-upload/file-upload.js";
10
12
  import { Header } from "./components/header/header.js";
11
13
  import { NotificationBanner } from "./components/notification-banner/notification-banner.js";
12
14
  import { PasswordInput } from "./components/password-input/password-input.js";
@@ -14,7 +16,6 @@ import { Radios } from "./components/radios/radios.js";
14
16
  import { ServiceNavigation } from "./components/service-navigation/service-navigation.js";
15
17
  import { SkipLink } from "./components/skip-link/skip-link.js";
16
18
  import { Tabs } from "./components/tabs/tabs.js";
17
- import { GOVUKFrontendComponent as Component } from "./govuk-frontend-component.js";
18
19
  import { type Config as ConfigImport, type ConfigKey as ConfigKeyImport, createAll, initAll } from "./init.js";
19
20
 
20
21
  declare namespace GOVUKFrontend {
@@ -31,6 +32,7 @@ declare const GOVUKFrontend: {
31
32
  Checkboxes: typeof Checkboxes;
32
33
  ErrorSummary: typeof ErrorSummary;
33
34
  ExitThisPage: typeof ExitThisPage;
35
+ FileUpload: typeof FileUpload;
34
36
  Header: typeof Header;
35
37
  NotificationBanner: typeof NotificationBanner;
36
38
  PasswordInput: typeof PasswordInput;
@@ -6,4 +6,7 @@
6
6
  * @param {string} attributeName - The name of the attribute
7
7
  * @returns {string | null} Attribute value
8
8
  */
9
- export function closestAttributeValue($element: Element, attributeName: string): string | null;
9
+ export function closestAttributeValue(
10
+ $element: Element,
11
+ attributeName: string,
12
+ ): string | null;
@@ -1,4 +1,4 @@
1
- import { GOVUKFrontendComponent } from "../govuk-frontend-component.js";
1
+ import { Component } from "../component.js";
2
2
 
3
3
  /**
4
4
  * Normalise string
@@ -28,13 +28,17 @@ export function normaliseString(
28
28
  * optionally expanding nested `i18n.field`
29
29
  *
30
30
  * @internal
31
- * @param {{ schema?: Schema<ObjectNested>, moduleName: string }} Component - Component class
31
+ * @template {Partial<Record<keyof ConfigurationType, unknown>>} ConfigurationType
32
+ * @template {[keyof ConfigurationType, SchemaProperty | undefined][]} SchemaEntryType
33
+ * @param {{ schema?: Schema<ConfigurationType>, moduleName: string }} Component - Component class
32
34
  * @param {DOMStringMap} dataset - HTML element dataset
33
35
  * @returns {ObjectNested} Normalised dataset
34
36
  */
35
- export function normaliseDataset(
37
+ export function normaliseDataset<
38
+ ConfigurationType extends Partial<Record<keyof ConfigurationType, unknown>>,
39
+ >(
36
40
  Component: {
37
- schema?: Schema<ObjectNested>;
41
+ schema?: Schema<ConfigurationType>;
38
42
  moduleName: string;
39
43
  },
40
44
  dataset: DOMStringMap,
@@ -51,9 +55,9 @@ export function normaliseDataset(
51
55
  * @returns {{ [key: string]: unknown }} A merged config object
52
56
  */
53
57
  export function mergeConfigs(
54
- ...configObjects: Array<{
58
+ ...configObjects: {
55
59
  [key: string]: unknown;
56
- }>
60
+ }[]
57
61
  ): {
58
62
  [key: string]: unknown;
59
63
  };
@@ -73,13 +77,8 @@ export function mergeConfigs(
73
77
  * @returns {string[]} List of validation errors
74
78
  */
75
79
  export function validateConfig<
76
- ConfigurationType extends Partial<
77
- Record<keyof ConfigurationType, unknown>
78
- >,
79
- >(
80
- schema: Schema<ConfigurationType>,
81
- config: ConfigurationType,
82
- ): string[];
80
+ ConfigurationType extends Partial<Record<keyof ConfigurationType, unknown>>,
81
+ >(schema: Schema<ConfigurationType>, config: ConfigurationType): string[];
83
82
 
84
83
  /**
85
84
  * Extracts keys starting with a particular namespace from dataset ('data-*')
@@ -93,9 +92,7 @@ export function validateConfig<
93
92
  * @returns {ObjectNested | undefined} Nested object with dot-separated key namespace removed
94
93
  */
95
94
  export function extractConfigByNamespace<
96
- ConfigurationType extends Partial<
97
- Record<keyof ConfigurationType, unknown>
98
- >,
95
+ ConfigurationType extends Partial<Record<keyof ConfigurationType, unknown>>,
99
96
  >(
100
97
  schema: Schema<ConfigurationType>,
101
98
  dataset: DOMStringMap,
@@ -109,8 +106,8 @@ export const configOverride: unique symbol;
109
106
  *
110
107
  * Centralises the behaviours shared by our components
111
108
  *
112
- * @template {Partial<Record<keyof ConfigurationType, unknown>>} [ConfigurationType=ObjectNested]
113
- * @template {Element & { dataset: DOMStringMap }} [RootElementType=HTMLElement]
109
+ * @template {Partial<Record<keyof ConfigurationType, unknown>>} ConfigurationType
110
+ * @template {Element & { dataset: DOMStringMap }} RootElementType
114
111
  */
115
112
  export abstract class ConfigurableComponent<
116
113
  ConfigurationType extends Partial<
@@ -119,7 +116,7 @@ export abstract class ConfigurableComponent<
119
116
  RootElementType extends Element & {
120
117
  dataset: DOMStringMap;
121
118
  } = HTMLElement,
122
- > extends GOVUKFrontendComponent<RootElementType> {
119
+ > extends Component<RootElementType> {
123
120
  /**
124
121
  * Constructs a new component, validating that GOV.UK Frontend is supported
125
122
  *
@@ -154,7 +151,9 @@ export abstract class ConfigurableComponent<
154
151
  * @param {Partial<ConfigurationType>} [param] - Configuration object
155
152
  * @returns {Partial<ConfigurationType>} return - Configuration object
156
153
  */
157
- [configOverride](param?: Partial<ConfigurationType>): Partial<ConfigurationType>;
154
+ [configOverride](
155
+ param?: Partial<ConfigurationType>,
156
+ ): Partial<ConfigurationType>;
158
157
  }
159
158
 
160
159
  export type NestedKey = keyof ObjectNested;
@@ -167,9 +166,7 @@ export interface ObjectNested {
167
166
  * Schema for component config
168
167
  */
169
168
  export interface Schema<
170
- ConfigurationType extends Partial<
171
- Record<keyof ConfigurationType, unknown>
172
- >,
169
+ ConfigurationType extends Partial<Record<keyof ConfigurationType, unknown>>,
173
170
  > {
174
171
  /**
175
172
  * - Schema properties
@@ -179,7 +176,7 @@ export interface Schema<
179
176
  /**
180
177
  * - List of schema conditions
181
178
  */
182
- anyOf?: SchemaCondition[] | undefined;
179
+ anyOf?: SchemaCondition<ConfigurationType>[] | undefined;
183
180
  }
184
181
 
185
182
  /**
@@ -195,11 +192,13 @@ export interface SchemaProperty {
195
192
  /**
196
193
  * Schema condition for component config
197
194
  */
198
- export interface SchemaCondition {
195
+ export interface SchemaCondition<
196
+ ConfigurationType extends Partial<Record<keyof ConfigurationType, unknown>>,
197
+ > {
199
198
  /**
200
199
  * - List of required config fields
201
200
  */
202
- required: string[];
201
+ required: (keyof ConfigurationType)[];
203
202
 
204
203
  /**
205
204
  * - Error message when required config fields not provided
@@ -81,9 +81,7 @@ export function isSupported($scope?: HTMLElement | null): boolean;
81
81
  */
82
82
  export function isObject<
83
83
  ObjectType extends Partial<Record<keyof ObjectType, unknown>> = ObjectNested,
84
- >(
85
- option: unknown,
86
- ): option is ObjectType;
84
+ >(option: unknown | ObjectType): option is ObjectType;
87
85
 
88
86
  /**
89
87
  * Format error message
@@ -93,7 +91,10 @@ export function isObject<
93
91
  * @param {string} message - Error message
94
92
  * @returns {string} - Formatted error message
95
93
  */
96
- export function formatErrorMessage(Component: ComponentWithModuleName, message: string): string;
94
+ export function formatErrorMessage(
95
+ Component: ComponentWithModuleName,
96
+ message: string,
97
+ ): string;
97
98
 
98
99
  export interface ComponentWithModuleName {
99
100
  /**
@@ -0,0 +1 @@
1
+ export * from "./component.js";
@@ -2,8 +2,10 @@
2
2
  * Base Component class
3
3
  *
4
4
  * Centralises the behaviours shared by our components
5
+ *
6
+ * @template {Element} [RootElementType=HTMLElement]
5
7
  */
6
- export abstract class GOVUKFrontendComponent<RootElementType extends Element = HTMLElement> {
8
+ export abstract class Component<RootElementType extends Element = HTMLElement> {
7
9
  static elementType: typeof Element;
8
10
 
9
11
  /**
@@ -12,7 +12,10 @@ import { ConfigurableComponent } from "../../common/configuration.js";
12
12
  * The state of each section is saved to the DOM via the `aria-expanded`
13
13
  * attribute, which also provides accessibility.
14
14
  */
15
- export class Accordion extends ConfigurableComponent<AccordionConfig, HTMLElement> {
15
+ export class Accordion extends ConfigurableComponent<
16
+ AccordionConfig,
17
+ HTMLElement
18
+ > {
16
19
  /**
17
20
  * Name for the component used when initialising using data-module attributes.
18
21
  */
@@ -22,13 +25,15 @@ export class Accordion extends ConfigurableComponent<AccordionConfig, HTMLElemen
22
25
  * Accordion default config
23
26
  *
24
27
  * @see {@link AccordionConfig}
28
+ * @constant
25
29
  */
26
30
  static defaults: AccordionConfig;
27
31
 
28
32
  /**
29
33
  * Accordion config schema
30
34
  *
31
- * @satisfies {Schema}
35
+ * @constant
36
+ * @satisfies {Schema<AccordionConfig>}
32
37
  */
33
38
  static schema: Readonly<{
34
39
  properties: {
@@ -13,13 +13,15 @@ export class Button extends ConfigurableComponent<ButtonConfig, HTMLElement> {
13
13
  * Button default config
14
14
  *
15
15
  * @see {@link ButtonConfig}
16
+ * @constant
16
17
  */
17
18
  static defaults: ButtonConfig;
18
19
 
19
20
  /**
20
21
  * Button config schema
21
22
  *
22
- * @satisfies {Schema}
23
+ * @constant
24
+ * @satisfies {Schema<ButtonConfig>}
23
25
  */
24
26
  static schema: Readonly<{
25
27
  properties: {
@@ -11,7 +11,10 @@ import { type TranslationPluralForms } from "../../i18n.js";
11
11
  * You can configure the message to only appear after a certain percentage
12
12
  * of the available characters/words has been entered.
13
13
  */
14
- export class CharacterCount extends ConfigurableComponent<CharacterCountConfig, HTMLElement> {
14
+ export class CharacterCount extends ConfigurableComponent<
15
+ CharacterCountConfig,
16
+ HTMLElement
17
+ > {
15
18
  /**
16
19
  * Name for the component used when initialising using data-module attributes.
17
20
  */
@@ -21,13 +24,15 @@ export class CharacterCount extends ConfigurableComponent<CharacterCountConfig,
21
24
  * Character count default config
22
25
  *
23
26
  * @see {@link CharacterCountConfig}
27
+ * @constant
24
28
  */
25
29
  static defaults: CharacterCountConfig;
26
30
 
27
31
  /**
28
32
  * Character count config schema
29
33
  *
30
- * @satisfies {Schema}
34
+ * @constant
35
+ * @satisfies {Schema<CharacterCountConfig>}
31
36
  */
32
37
  static schema: Readonly<{
33
38
  properties: {
@@ -44,10 +49,16 @@ export class CharacterCount extends ConfigurableComponent<CharacterCountConfig,
44
49
  type: "number";
45
50
  };
46
51
  };
47
- anyOf: Array<{
48
- required: string[];
49
- errorMessage: string;
50
- }>;
52
+ anyOf: (
53
+ | {
54
+ required: "maxwords"[];
55
+ errorMessage: string;
56
+ }
57
+ | {
58
+ required: "maxlength"[];
59
+ errorMessage: string;
60
+ }
61
+ )[];
51
62
  }>;
52
63
 
53
64
  /**
@@ -1,9 +1,9 @@
1
- import { GOVUKFrontendComponent } from "../../govuk-frontend-component.js";
1
+ import { Component } from "../../component.js";
2
2
 
3
3
  /**
4
4
  * Checkboxes component
5
5
  */
6
- export class Checkboxes extends GOVUKFrontendComponent<HTMLElement> {
6
+ export class Checkboxes extends Component<HTMLElement> {
7
7
  /**
8
8
  * Name for the component used when initialising using data-module attributes.
9
9
  */
@@ -6,7 +6,10 @@ import { ConfigurableComponent } from "../../common/configuration.js";
6
6
  * Takes focus on initialisation for accessible announcement, unless disabled in
7
7
  * configuration.
8
8
  */
9
- export class ErrorSummary extends ConfigurableComponent<ErrorSummaryConfig, HTMLElement> {
9
+ export class ErrorSummary extends ConfigurableComponent<
10
+ ErrorSummaryConfig,
11
+ HTMLElement
12
+ > {
10
13
  /**
11
14
  * Name for the component used when initialising using data-module attributes.
12
15
  */
@@ -16,13 +19,15 @@ export class ErrorSummary extends ConfigurableComponent<ErrorSummaryConfig, HTML
16
19
  * Error summary default config
17
20
  *
18
21
  * @see {@link ErrorSummaryConfig}
22
+ * @constant
19
23
  */
20
24
  static defaults: ErrorSummaryConfig;
21
25
 
22
26
  /**
23
27
  * Error summary config schema
24
28
  *
25
- * @satisfies {Schema}
29
+ * @constant
30
+ * @satisfies {Schema<ErrorSummaryConfig>}
26
31
  */
27
32
  static schema: Readonly<{
28
33
  properties: {
@@ -47,5 +52,5 @@ export interface ErrorSummaryConfig {
47
52
  * - If set to `true` the error
48
53
  * summary will not be focussed when the page loads.
49
54
  */
50
- disableAutoFocus?: boolean;
55
+ disableAutoFocus?: boolean | undefined;
51
56
  }
@@ -3,7 +3,10 @@ import { ConfigurableComponent } from "../../common/configuration.js";
3
3
  /**
4
4
  * Exit this page component
5
5
  */
6
- export class ExitThisPage extends ConfigurableComponent<ExitThisPageConfig, HTMLElement> {
6
+ export class ExitThisPage extends ConfigurableComponent<
7
+ ExitThisPageConfig,
8
+ HTMLElement
9
+ > {
7
10
  /**
8
11
  * Name for the component used when initialising using data-module attributes.
9
12
  */
@@ -13,13 +16,15 @@ export class ExitThisPage extends ConfigurableComponent<ExitThisPageConfig, HTML
13
16
  * Exit this page default config
14
17
  *
15
18
  * @see {@link ExitThisPageConfig}
19
+ * @constant
16
20
  */
17
21
  static defaults: ExitThisPageConfig;
18
22
 
19
23
  /**
20
24
  * Exit this page config schema
21
25
  *
22
- * @satisfies {Schema}
26
+ * @constant
27
+ * @satisfies {Schema<ExitThisPageConfig>}
23
28
  */
24
29
  static schema: Readonly<{
25
30
  properties: {
@@ -0,0 +1 @@
1
+ export * from "./file-upload.js";
@@ -0,0 +1,95 @@
1
+ import { ConfigurableComponent } from "../../common/configuration.js";
2
+ import { type TranslationPluralForms } from "../../i18n.js";
3
+
4
+ /**
5
+ * File upload component
6
+ */
7
+ export class FileUpload extends ConfigurableComponent<
8
+ FileUploadConfig,
9
+ HTMLElement
10
+ > {
11
+ /**
12
+ * Name for the component used when initialising using data-module attributes.
13
+ */
14
+ static moduleName: string;
15
+
16
+ /**
17
+ * File upload default config
18
+ *
19
+ * @see {@link FileUploadConfig}
20
+ * @constant
21
+ */
22
+ static defaults: FileUploadConfig;
23
+
24
+ /**
25
+ * File upload config schema
26
+ *
27
+ * @constant
28
+ * @satisfies {Schema<FileUploadConfig>}
29
+ */
30
+ static schema: Readonly<{
31
+ properties: {
32
+ i18n: {
33
+ type: "object";
34
+ };
35
+ };
36
+ }>;
37
+
38
+ /**
39
+ * @param {Element | null} $root - File input element
40
+ * @param {FileUploadConfig} [config] - File Upload config
41
+ */
42
+ constructor($root: Element | null, config?: FileUploadConfig);
43
+ }
44
+
45
+ export type HTMLFileInputElement = HTMLInputElement & {
46
+ files: FileList;
47
+ };
48
+
49
+ /**
50
+ * File upload config
51
+ */
52
+ export interface FileUploadConfig {
53
+ /**
54
+ * - File upload translations
55
+ */
56
+ i18n?: FileUploadTranslations | undefined;
57
+ }
58
+
59
+ /**
60
+ * Messages used by the component
61
+ */
62
+ export interface FileUploadTranslations {
63
+ /**
64
+ * - The text of the button that opens the file picker
65
+ */
66
+ chooseFile?: string | undefined;
67
+
68
+ /**
69
+ * - The text informing users they can drop files
70
+ */
71
+ dropInstruction?: string | undefined;
72
+
73
+ /**
74
+ * - The text displayed when multiple files
75
+ * have been chosen by the user
76
+ */
77
+ multipleFilesChosen?: TranslationPluralForms | undefined;
78
+
79
+ /**
80
+ * - The text to displayed when no file has been chosen by the user
81
+ */
82
+ noFileChosen?: string | undefined;
83
+
84
+ /**
85
+ * - The text announced by assistive technology
86
+ * when user drags files and enters the drop zone
87
+ */
88
+ enteredDropZone?: string | undefined;
89
+
90
+ /**
91
+ * - The text announced by assistive technology
92
+ * when user drags files and leaves the drop zone without dropping
93
+ */
94
+ leftDropZone?: string | undefined;
95
+ }
@@ -1,9 +1,9 @@
1
- import { GOVUKFrontendComponent } from "../../govuk-frontend-component.js";
1
+ import { Component } from "../../component.js";
2
2
 
3
3
  /**
4
4
  * Header component
5
5
  */
6
- export class Header extends GOVUKFrontendComponent<HTMLElement> {
6
+ export class Header extends Component<HTMLElement> {
7
7
  /**
8
8
  * Name for the component used when initialising using data-module attributes.
9
9
  */
@@ -3,7 +3,10 @@ import { ConfigurableComponent } from "../../common/configuration.js";
3
3
  /**
4
4
  * Notification Banner component
5
5
  */
6
- export class NotificationBanner extends ConfigurableComponent<NotificationBannerConfig, HTMLElement> {
6
+ export class NotificationBanner extends ConfigurableComponent<
7
+ NotificationBannerConfig,
8
+ HTMLElement
9
+ > {
7
10
  /**
8
11
  * Name for the component used when initialising using data-module attributes.
9
12
  */
@@ -13,13 +16,15 @@ export class NotificationBanner extends ConfigurableComponent<NotificationBanner
13
16
  * Notification banner default config
14
17
  *
15
18
  * @see {@link NotificationBannerConfig}
19
+ * @constant
16
20
  */
17
21
  static defaults: NotificationBannerConfig;
18
22
 
19
23
  /**
20
24
  * Notification banner config schema
21
25
  *
22
- * @satisfies {Schema}
26
+ * @constant
27
+ * @satisfies {Schema<NotificationBannerConfig>}
23
28
  */
24
29
  static schema: Readonly<{
25
30
  properties: {
@@ -3,7 +3,10 @@ import { ConfigurableComponent } from "../../common/configuration.js";
3
3
  /**
4
4
  * Password input component
5
5
  */
6
- export class PasswordInput extends ConfigurableComponent<PasswordInputConfig, HTMLElement> {
6
+ export class PasswordInput extends ConfigurableComponent<
7
+ PasswordInputConfig,
8
+ HTMLElement
9
+ > {
7
10
  /**
8
11
  * Name for the component used when initialising using data-module attributes.
9
12
  */
@@ -13,13 +16,16 @@ export class PasswordInput extends ConfigurableComponent<PasswordInputConfig, HT
13
16
  * Password input default config
14
17
  *
15
18
  * @see {@link PasswordInputConfig}
19
+ * @constant
20
+ * @default
16
21
  */
17
22
  static defaults: PasswordInputConfig;
18
23
 
19
24
  /**
20
25
  * Password input config schema
21
26
  *
22
- * @satisfies {Schema}
27
+ * @constant
28
+ * @satisfies {Schema<PasswordInputConfig>}
23
29
  */
24
30
  static schema: Readonly<{
25
31
  properties: {
@@ -1,9 +1,9 @@
1
- import { GOVUKFrontendComponent } from "../../govuk-frontend-component.js";
1
+ import { Component } from "../../component.js";
2
2
 
3
3
  /**
4
4
  * Radios component
5
5
  */
6
- export class Radios extends GOVUKFrontendComponent<HTMLElement> {
6
+ export class Radios extends Component<HTMLElement> {
7
7
  /**
8
8
  * Name for the component used when initialising using data-module attributes.
9
9
  */
@@ -1,9 +1,9 @@
1
- import { GOVUKFrontendComponent } from "../../govuk-frontend-component.js";
1
+ import { Component } from "../../component.js";
2
2
 
3
3
  /**
4
4
  * Service Navigation component
5
5
  */
6
- export class ServiceNavigation extends GOVUKFrontendComponent<HTMLElement> {
6
+ export class ServiceNavigation extends Component<HTMLElement> {
7
7
  /**
8
8
  * Name for the component used when initialising using data-module attributes.
9
9
  */
@@ -1,9 +1,9 @@
1
- import { GOVUKFrontendComponent } from "../../govuk-frontend-component.js";
1
+ import { Component } from "../../component.js";
2
2
 
3
3
  /**
4
4
  * Skip link component
5
5
  */
6
- export class SkipLink extends GOVUKFrontendComponent<HTMLAnchorElement> {
6
+ export class SkipLink extends Component<HTMLAnchorElement> {
7
7
  static elementType: {
8
8
  new(): HTMLAnchorElement;
9
9
  prototype: HTMLAnchorElement;
@@ -1,9 +1,9 @@
1
- import { GOVUKFrontendComponent } from "../../govuk-frontend-component.js";
1
+ import { Component } from "../../component.js";
2
2
 
3
3
  /**
4
4
  * Tabs component
5
5
  */
6
- export class Tabs extends GOVUKFrontendComponent<HTMLElement> {
6
+ export class Tabs extends Component<HTMLElement> {
7
7
  /**
8
8
  * Name for the component used when initialising using data-module attributes.
9
9
  */
@@ -19,8 +19,7 @@ import { type ComponentWithModuleName } from "../common/index.js";
19
19
  * }
20
20
  * ```
21
21
  */
22
- export abstract class GOVUKFrontendError extends Error {
23
- }
22
+ export abstract class GOVUKFrontendError extends Error {}
24
23
 
25
24
  /**
26
25
  * Indicates that GOV.UK Frontend is not supported
@@ -37,8 +36,7 @@ export class SupportError extends GOVUKFrontendError {
37
36
  /**
38
37
  * Indicates that a component has received an illegal configuration
39
38
  */
40
- export class ConfigError extends GOVUKFrontendError {
41
- }
39
+ export class ConfigError extends GOVUKFrontendError {}
42
40
 
43
41
  /**
44
42
  * Indicates an issue with an element (possibly `null` or `undefined`)
@@ -104,9 +104,12 @@ export class I18n {
104
104
  * @param {{ [key: string]: unknown }} options - Any options passed with the translation string, e.g: for string interpolation.
105
105
  * @returns {string} The translation string to output, with $\{\} placeholders replaced
106
106
  */
107
- replacePlaceholders(translationString: string, options: {
108
- [key: string]: unknown;
109
- }): string;
107
+ replacePlaceholders(
108
+ translationString: string,
109
+ options: {
110
+ [key: string]: unknown;
111
+ },
112
+ ): string;
110
113
 
111
114
  /**
112
115
  * Check to see if the browser supports Intl.PluralRules
@@ -3,6 +3,7 @@ import { type ButtonConfig } from "./components/button/button.js";
3
3
  import { type CharacterCountConfig } from "./components/character-count/character-count.js";
4
4
  import { type ErrorSummaryConfig } from "./components/error-summary/error-summary.js";
5
5
  import { type ExitThisPageConfig } from "./components/exit-this-page/exit-this-page.js";
6
+ import { type FileUploadConfig } from "./components/file-upload/file-upload.js";
6
7
  import { type NotificationBannerConfig } from "./components/notification-banner/notification-banner.js";
7
8
  import { type PasswordInputConfig } from "./components/password-input/password-input.js";
8
9
 
@@ -40,6 +41,11 @@ export interface Config {
40
41
  */
41
42
  exitThisPage?: ExitThisPageConfig | undefined;
42
43
 
44
+ /**
45
+ * - File Upload config
46
+ */
47
+ fileUpload?: FileUploadConfig | undefined;
48
+
43
49
  /**
44
50
  * - Notification Banner config
45
51
  */
@@ -125,5 +131,9 @@ export function initAll(
125
131
  export function createAll<ComponentClass extends CompatibleClass>(
126
132
  Component: ComponentClass,
127
133
  config?: ComponentConfig<ComponentClass>,
128
- createAllOptions?: OnErrorCallback<ComponentClass> | Element | Document | CreateAllOptions<ComponentClass>,
134
+ createAllOptions?:
135
+ | OnErrorCallback<ComponentClass>
136
+ | Element
137
+ | Document
138
+ | CreateAllOptions<ComponentClass>,
129
139
  ): Array<InstanceType<ComponentClass>>;
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@types/govuk-frontend",
3
- "version": "5.8.0",
3
+ "version": "5.9.0",
4
4
  "description": "TypeScript definitions for govuk-frontend",
5
5
  "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/govuk-frontend",
6
6
  "license": "MIT",
@@ -33,6 +33,6 @@
33
33
  "scripts": {},
34
34
  "dependencies": {},
35
35
  "peerDependencies": {},
36
- "typesPublisherContentHash": "3df1d321f714ae24feef605eab0f6302b12f0717613036605b5de394fb136253",
37
- "typeScriptVersion": "5.0"
36
+ "typesPublisherContentHash": "0c6bf1e47e944f9d230c1eed825ea255eb3d43f5684e51a3c8c070c2a8ec9177",
37
+ "typeScriptVersion": "5.1"
38
38
  }
@@ -1 +0,0 @@
1
- export * from "./govuk-frontend-component.js";