@types/govuk-frontend 5.4.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 (50) hide show
  1. govuk-frontend/LICENSE +21 -0
  2. govuk-frontend/README.md +15 -0
  3. govuk-frontend/dist/govuk/all.bundle.d.mts +14 -0
  4. govuk-frontend/dist/govuk/all.bundle.d.ts +39 -0
  5. govuk-frontend/dist/govuk/all.d.mts +1 -0
  6. govuk-frontend/dist/govuk/common/closest-attribute-value.d.mts +1 -0
  7. govuk-frontend/dist/govuk/common/closest-attribute-value.d.ts +9 -0
  8. govuk-frontend/dist/govuk/common/govuk-frontend-version.d.mts +1 -0
  9. govuk-frontend/dist/govuk/common/govuk-frontend-version.d.ts +6 -0
  10. govuk-frontend/dist/govuk/common/index.d.mts +1 -0
  11. govuk-frontend/dist/govuk/common/index.d.ts +159 -0
  12. govuk-frontend/dist/govuk/common/normalise-dataset.d.mts +1 -0
  13. govuk-frontend/dist/govuk/common/normalise-dataset.d.ts +16 -0
  14. govuk-frontend/dist/govuk/common/normalise-string.d.mts +1 -0
  15. govuk-frontend/dist/govuk/common/normalise-string.d.ts +22 -0
  16. govuk-frontend/dist/govuk/components/accordion/accordion.d.mts +1 -0
  17. govuk-frontend/dist/govuk/components/accordion/accordion.d.ts +120 -0
  18. govuk-frontend/dist/govuk/components/button/button.d.mts +1 -0
  19. govuk-frontend/dist/govuk/components/button/button.d.ts +48 -0
  20. govuk-frontend/dist/govuk/components/character-count/character-count.d.mts +1 -0
  21. govuk-frontend/dist/govuk/components/character-count/character-count.d.ts +158 -0
  22. govuk-frontend/dist/govuk/components/checkboxes/checkboxes.d.mts +1 -0
  23. govuk-frontend/dist/govuk/components/checkboxes/checkboxes.d.ts +27 -0
  24. govuk-frontend/dist/govuk/components/error-summary/error-summary.d.mts +1 -0
  25. govuk-frontend/dist/govuk/components/error-summary/error-summary.d.ts +51 -0
  26. govuk-frontend/dist/govuk/components/exit-this-page/exit-this-page.d.mts +1 -0
  27. govuk-frontend/dist/govuk/components/exit-this-page/exit-this-page.d.ts +77 -0
  28. govuk-frontend/dist/govuk/components/header/header.d.mts +1 -0
  29. govuk-frontend/dist/govuk/components/header/header.d.ts +19 -0
  30. govuk-frontend/dist/govuk/components/notification-banner/notification-banner.d.mts +1 -0
  31. govuk-frontend/dist/govuk/components/notification-banner/notification-banner.d.ts +50 -0
  32. govuk-frontend/dist/govuk/components/password-input/password-input.d.mts +1 -0
  33. govuk-frontend/dist/govuk/components/password-input/password-input.d.ts +90 -0
  34. govuk-frontend/dist/govuk/components/radios/radios.d.mts +1 -0
  35. govuk-frontend/dist/govuk/components/radios/radios.d.ts +27 -0
  36. govuk-frontend/dist/govuk/components/skip-link/skip-link.d.mts +1 -0
  37. govuk-frontend/dist/govuk/components/skip-link/skip-link.d.ts +19 -0
  38. govuk-frontend/dist/govuk/components/tabs/tabs.d.mts +1 -0
  39. govuk-frontend/dist/govuk/components/tabs/tabs.d.ts +16 -0
  40. govuk-frontend/dist/govuk/errors/index.d.mts +1 -0
  41. govuk-frontend/dist/govuk/errors/index.d.ts +83 -0
  42. govuk-frontend/dist/govuk/govuk-frontend-component.d.mts +1 -0
  43. govuk-frontend/dist/govuk/govuk-frontend-component.d.ts +9 -0
  44. govuk-frontend/dist/govuk/i18n.d.mts +1 -0
  45. govuk-frontend/dist/govuk/i18n.d.ts +211 -0
  46. govuk-frontend/dist/govuk/init.d.mts +1 -0
  47. govuk-frontend/dist/govuk/init.d.ts +93 -0
  48. govuk-frontend/index.d.mts +1 -0
  49. govuk-frontend/index.d.ts +3 -0
  50. govuk-frontend/package.json +32 -0
@@ -0,0 +1,27 @@
1
+ import { GOVUKFrontendComponent } from "../../govuk-frontend-component.js";
2
+
3
+ /**
4
+ * Checkboxes component
5
+ */
6
+ export class Checkboxes extends GOVUKFrontendComponent {
7
+ /**
8
+ * Name for the component used when initialising using data-module attributes.
9
+ */
10
+ static moduleName: string;
11
+
12
+ /**
13
+ * Checkboxes can be associated with a 'conditionally revealed' content block
14
+ * – for example, a checkbox for 'Phone' could reveal an additional form field
15
+ * for the user to enter their phone number.
16
+ *
17
+ * These associations are made using a `data-aria-controls` attribute, which
18
+ * is promoted to an aria-controls attribute during initialisation.
19
+ *
20
+ * We also need to restore the state of any conditional reveals on the page
21
+ * (for example if the user has navigated back), and set up event handlers to
22
+ * keep the reveal in sync with the checkbox state.
23
+ *
24
+ * @param {Element | null} $module - HTML element to use for checkboxes
25
+ */
26
+ constructor($module: Element | null);
27
+ }
@@ -0,0 +1 @@
1
+ export * from "./error-summary.js";
@@ -0,0 +1,51 @@
1
+ import { GOVUKFrontendComponent } from "../../govuk-frontend-component.js";
2
+
3
+ /**
4
+ * Error summary component
5
+ *
6
+ * Takes focus on initialisation for accessible announcement, unless disabled in
7
+ * configuration.
8
+ */
9
+ export class ErrorSummary extends GOVUKFrontendComponent {
10
+ /**
11
+ * Name for the component used when initialising using data-module attributes.
12
+ */
13
+ static moduleName: string;
14
+
15
+ /**
16
+ * Error summary default config
17
+ *
18
+ * @see {@link ErrorSummaryConfig}
19
+ */
20
+ static defaults: ErrorSummaryConfig;
21
+
22
+ /**
23
+ * Error summary config schema
24
+ *
25
+ * @satisfies {Schema}
26
+ */
27
+ static schema: Readonly<{
28
+ properties: {
29
+ disableAutoFocus: {
30
+ type: "boolean";
31
+ };
32
+ };
33
+ }>;
34
+
35
+ /**
36
+ * @param {Element | null} $module - HTML element to use for error summary
37
+ * @param {ErrorSummaryConfig} [config] - Error summary config
38
+ */
39
+ constructor($module: Element | null, config?: ErrorSummaryConfig);
40
+ }
41
+
42
+ /**
43
+ * Error summary config
44
+ */
45
+ export interface ErrorSummaryConfig {
46
+ /**
47
+ * - If set to `true` the error
48
+ * summary will not be focussed when the page loads.
49
+ */
50
+ disableAutoFocus?: boolean;
51
+ }
@@ -0,0 +1 @@
1
+ export * from "./exit-this-page.js";
@@ -0,0 +1,77 @@
1
+ import { GOVUKFrontendComponent } from "../../govuk-frontend-component.js";
2
+
3
+ /**
4
+ * Exit this page component
5
+ */
6
+ export class ExitThisPage extends GOVUKFrontendComponent {
7
+ /**
8
+ * Name for the component used when initialising using data-module attributes.
9
+ */
10
+ static moduleName: string;
11
+
12
+ /**
13
+ * Exit this page default config
14
+ *
15
+ * @see {@link ExitThisPageConfig}
16
+ */
17
+ static defaults: ExitThisPageConfig;
18
+
19
+ /**
20
+ * Exit this page config schema
21
+ *
22
+ * @satisfies {Schema}
23
+ */
24
+ static schema: Readonly<{
25
+ properties: {
26
+ i18n: {
27
+ type: "object";
28
+ };
29
+ };
30
+ }>;
31
+
32
+ /**
33
+ * @param {Element | null} $module - HTML element that wraps the Exit This Page button
34
+ * @param {ExitThisPageConfig} [config] - Exit This Page config
35
+ */
36
+ constructor($module: Element | null, config?: ExitThisPageConfig);
37
+ }
38
+
39
+ /**
40
+ * Exit this Page config
41
+ */
42
+ export interface ExitThisPageConfig {
43
+ /**
44
+ * - Exit this page translations
45
+ */
46
+ i18n?: ExitThisPageTranslations | undefined;
47
+ }
48
+
49
+ /**
50
+ * Messages used by the component programatically inserted text, including
51
+ * overlay text and screen reader announcements.
52
+ */
53
+ export interface ExitThisPageTranslations {
54
+ /**
55
+ * - Screen reader announcement for when EtP
56
+ * keypress functionality has been successfully activated.
57
+ */
58
+ activated?: string | undefined;
59
+
60
+ /**
61
+ * - Screen reader announcement for when the EtP
62
+ * keypress functionality has timed out.
63
+ */
64
+ timedOut?: string | undefined;
65
+
66
+ /**
67
+ * - Screen reader announcement informing
68
+ * the user they must press the activation key two more times.
69
+ */
70
+ pressTwoMoreTimes?: string | undefined;
71
+
72
+ /**
73
+ * - Screen reader announcement informing
74
+ * the user they must press the activation key one more time.
75
+ */
76
+ pressOneMoreTime?: string | undefined;
77
+ }
@@ -0,0 +1 @@
1
+ export * from "./header.js";
@@ -0,0 +1,19 @@
1
+ import { GOVUKFrontendComponent } from "../../govuk-frontend-component.js";
2
+
3
+ /**
4
+ * Header component
5
+ */
6
+ export class Header extends GOVUKFrontendComponent {
7
+ /**
8
+ * Name for the component used when initialising using data-module attributes.
9
+ */
10
+ static moduleName: string;
11
+
12
+ /**
13
+ * Apply a matchMedia for desktop which will trigger a state sync if the
14
+ * browser viewport moves between states.
15
+ *
16
+ * @param {Element | null} $module - HTML element to use for header
17
+ */
18
+ constructor($module: Element | null);
19
+ }
@@ -0,0 +1 @@
1
+ export * from "./notification-banner.js";
@@ -0,0 +1,50 @@
1
+ import { GOVUKFrontendComponent } from "../../govuk-frontend-component.js";
2
+
3
+ /**
4
+ * Notification Banner component
5
+ */
6
+ export class NotificationBanner extends GOVUKFrontendComponent {
7
+ /**
8
+ * Name for the component used when initialising using data-module attributes.
9
+ */
10
+ static moduleName: string;
11
+
12
+ /**
13
+ * Notification banner default config
14
+ *
15
+ * @see {@link NotificationBannerConfig}
16
+ */
17
+ static defaults: NotificationBannerConfig;
18
+
19
+ /**
20
+ * Notification banner config schema
21
+ *
22
+ * @satisfies {Schema}
23
+ */
24
+ static schema: Readonly<{
25
+ properties: {
26
+ disableAutoFocus: {
27
+ type: "boolean";
28
+ };
29
+ };
30
+ }>;
31
+
32
+ /**
33
+ * @param {Element | null} $module - HTML element to use for notification banner
34
+ * @param {NotificationBannerConfig} [config] - Notification banner config
35
+ */
36
+ constructor($module: Element | null, config?: NotificationBannerConfig);
37
+ }
38
+
39
+ /**
40
+ * Notification banner config
41
+ */
42
+ export interface NotificationBannerConfig {
43
+ /**
44
+ * - If set to `true` the
45
+ * notification banner will not be focussed when the page loads. This only
46
+ * applies if the component has a `role` of `alert` – in other cases the
47
+ * component will not be focused on page load, regardless of this option.
48
+ */
49
+ disableAutoFocus?: boolean | undefined;
50
+ }
@@ -0,0 +1 @@
1
+ export * from "./password-input.js";
@@ -0,0 +1,90 @@
1
+ import { GOVUKFrontendComponent } from "../../govuk-frontend-component.js";
2
+
3
+ /**
4
+ * Password input component
5
+ */
6
+ export class PasswordInput extends GOVUKFrontendComponent {
7
+ /**
8
+ * Name for the component used when initialising using data-module attributes.
9
+ */
10
+ static moduleName: string;
11
+
12
+ /**
13
+ * Password input default config
14
+ *
15
+ * @see {@link PasswordInputConfig}
16
+ */
17
+ static defaults: PasswordInputConfig;
18
+
19
+ /**
20
+ * Password input config schema
21
+ *
22
+ * @satisfies {Schema}
23
+ */
24
+ static schema: Readonly<{
25
+ properties: {
26
+ i18n: {
27
+ type: "object";
28
+ };
29
+ };
30
+ }>;
31
+
32
+ /**
33
+ * @param {Element | null} $module - HTML element to use for password input
34
+ * @param {PasswordInputConfig} [config] - Password input config
35
+ */
36
+ constructor($module: Element | null, config?: PasswordInputConfig);
37
+ }
38
+
39
+ /**
40
+ * Password input config
41
+ */
42
+ export interface PasswordInputConfig {
43
+ /**
44
+ * - Password input translations
45
+ */
46
+ i18n?: PasswordInputTranslations | undefined;
47
+ }
48
+
49
+ /**
50
+ * Messages displayed to the user indicating the state of the show/hide toggle.
51
+ */
52
+ export interface PasswordInputTranslations {
53
+ /**
54
+ * - Visible text of the button when the
55
+ * password is currently hidden. Plain text only.
56
+ */
57
+ showPassword?: string | undefined;
58
+
59
+ /**
60
+ * - Visible text of the button when the
61
+ * password is currently visible. Plain text only.
62
+ */
63
+ hidePassword?: string | undefined;
64
+
65
+ /**
66
+ * - aria-label of the button when
67
+ * the password is currently hidden. Plain text only.
68
+ */
69
+ showPasswordAriaLabel?: string | undefined;
70
+
71
+ /**
72
+ * - aria-label of the button when
73
+ * the password is currently visible. Plain text only.
74
+ */
75
+ hidePasswordAriaLabel?: string | undefined;
76
+
77
+ /**
78
+ * - Screen reader
79
+ * announcement to make when the password has just become visible.
80
+ * Plain text only.
81
+ */
82
+ passwordShownAnnouncement?: string | undefined;
83
+
84
+ /**
85
+ * - Screen reader
86
+ * announcement to make when the password has just been hidden.
87
+ * Plain text only.
88
+ */
89
+ passwordHiddenAnnouncement?: string | undefined;
90
+ }
@@ -0,0 +1 @@
1
+ export * from "./radios.js";
@@ -0,0 +1,27 @@
1
+ import { GOVUKFrontendComponent } from "../../govuk-frontend-component.js";
2
+
3
+ /**
4
+ * Radios component
5
+ */
6
+ export class Radios extends GOVUKFrontendComponent {
7
+ /**
8
+ * Name for the component used when initialising using data-module attributes.
9
+ */
10
+ static moduleName: string;
11
+
12
+ /**
13
+ * Radios can be associated with a 'conditionally revealed' content block –
14
+ * for example, a radio for 'Phone' could reveal an additional form field for
15
+ * the user to enter their phone number.
16
+ *
17
+ * These associations are made using a `data-aria-controls` attribute, which
18
+ * is promoted to an aria-controls attribute during initialisation.
19
+ *
20
+ * We also need to restore the state of any conditional reveals on the page
21
+ * (for example if the user has navigated back), and set up event handlers to
22
+ * keep the reveal in sync with the radio state.
23
+ *
24
+ * @param {Element | null} $module - HTML element to use for radios
25
+ */
26
+ constructor($module: Element | null);
27
+ }
@@ -0,0 +1 @@
1
+ export * from "./skip-link.js";
@@ -0,0 +1,19 @@
1
+ import { GOVUKFrontendComponent } from "../../govuk-frontend-component.js";
2
+
3
+ /**
4
+ * Skip link component
5
+ */
6
+ export class SkipLink extends GOVUKFrontendComponent {
7
+ /**
8
+ * Name for the component used when initialising using data-module attributes.
9
+ */
10
+ static moduleName: string;
11
+
12
+ /**
13
+ * @param {Element | null} $module - HTML element to use for skip link
14
+ * @throws {ElementError} when $module is not set or the wrong type
15
+ * @throws {ElementError} when $module.hash does not contain a hash
16
+ * @throws {ElementError} when the linked element is missing or the wrong type
17
+ */
18
+ constructor($module: Element | null);
19
+ }
@@ -0,0 +1 @@
1
+ export * from "./tabs.js";
@@ -0,0 +1,16 @@
1
+ import { GOVUKFrontendComponent } from "../../govuk-frontend-component.js";
2
+
3
+ /**
4
+ * Tabs component
5
+ */
6
+ export class Tabs extends GOVUKFrontendComponent {
7
+ /**
8
+ * Name for the component used when initialising using data-module attributes.
9
+ */
10
+ static moduleName: string;
11
+
12
+ /**
13
+ * @param {Element | null} $module - HTML element to use for tabs
14
+ */
15
+ constructor($module: Element | null);
16
+ }
@@ -0,0 +1 @@
1
+ export * from "./index.js";
@@ -0,0 +1,83 @@
1
+ /**
2
+ * GOV.UK Frontend error
3
+ *
4
+ * A base class for `Error`s thrown by GOV.UK Frontend.
5
+ *
6
+ * It is meant to be extended into specific types of errors
7
+ * to be thrown by our code.
8
+ *
9
+ * @example
10
+ * ```js
11
+ * class MissingRootError extends GOVUKFrontendError {
12
+ * // Setting an explicit name is important as extending the class will not
13
+ * // set a new `name` on the subclass. The `name` property is important
14
+ * // to ensure intelligible error names even if the class name gets
15
+ * // mangled by a minifier
16
+ * name = "MissingRootError"
17
+ * }
18
+ * ```
19
+ */
20
+ export class GOVUKFrontendError extends Error {
21
+ }
22
+
23
+ /**
24
+ * Indicates that GOV.UK Frontend is not supported
25
+ */
26
+ export class SupportError extends GOVUKFrontendError {
27
+ /**
28
+ * Checks if GOV.UK Frontend is supported on this page
29
+ *
30
+ * @param {HTMLElement | null} [$scope] - HTML element `<body>` checked for browser support
31
+ */
32
+ constructor($scope?: HTMLElement | null);
33
+ }
34
+
35
+ /**
36
+ * Indicates that a component has received an illegal configuration
37
+ */
38
+ export class ConfigError extends GOVUKFrontendError {
39
+ }
40
+
41
+ /**
42
+ * Indicates an issue with an element (possibly `null` or `undefined`)
43
+ */
44
+ export class ElementError extends GOVUKFrontendError {
45
+ /**
46
+ * @internal
47
+ * @overload
48
+ * @param {string} message - Element error message
49
+ */
50
+ constructor(message: string);
51
+
52
+ /**
53
+ * @internal
54
+ * @overload
55
+ * @param {ElementErrorOptions} options - Element error options
56
+ */
57
+ constructor(options: ElementErrorOptions);
58
+ }
59
+
60
+ /**
61
+ * Element error options
62
+ */
63
+ export interface ElementErrorOptions {
64
+ /**
65
+ * - The name of the component throwing the error
66
+ */
67
+ componentName: string;
68
+
69
+ /**
70
+ * - An identifier that'll let the user understand which element has an error. This is whatever makes the most sense
71
+ */
72
+ identifier: string;
73
+
74
+ /**
75
+ * - The element in error
76
+ */
77
+ element?: Element | null | undefined;
78
+
79
+ /**
80
+ * - The type that was expected for the identifier
81
+ */
82
+ expectedType?: string | undefined;
83
+ }
@@ -0,0 +1 @@
1
+ export * from "./govuk-frontend-component.js";
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Base Component class
3
+ *
4
+ * Centralises the behaviours shared by our components
5
+ *
6
+ * @internal
7
+ */
8
+ export class GOVUKFrontendComponent {
9
+ }
@@ -0,0 +1 @@
1
+ export * from "./i18n.js";