@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
govuk-frontend/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) Microsoft Corporation.
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE
@@ -0,0 +1,15 @@
1
+ # Installation
2
+ > `npm install --save @types/govuk-frontend`
3
+
4
+ # Summary
5
+ This package contains type definitions for govuk-frontend (https://github.com/alphagov/govuk-frontend).
6
+
7
+ # Details
8
+ Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/govuk-frontend.
9
+
10
+ ### Additional Details
11
+ * Last updated: Thu, 25 Jul 2024 08:37:24 GMT
12
+ * Dependencies: none
13
+
14
+ # Credits
15
+ These definitions were written by [Colin Rotherham](https://github.com/colinrotherham).
@@ -0,0 +1,14 @@
1
+ export { version } from "./common/govuk-frontend-version.mjs";
2
+ export { Accordion } from "./components/accordion/accordion.mjs";
3
+ export { Button } from "./components/button/button.mjs";
4
+ export { CharacterCount } from "./components/character-count/character-count.mjs";
5
+ export { Checkboxes } from "./components/checkboxes/checkboxes.mjs";
6
+ export { ErrorSummary } from "./components/error-summary/error-summary.mjs";
7
+ export { ExitThisPage } from "./components/exit-this-page/exit-this-page.mjs";
8
+ export { Header } from "./components/header/header.mjs";
9
+ export { NotificationBanner } from "./components/notification-banner/notification-banner.mjs";
10
+ export { PasswordInput } from "./components/password-input/password-input.mjs";
11
+ export { Radios } from "./components/radios/radios.mjs";
12
+ export { SkipLink } from "./components/skip-link/skip-link.mjs";
13
+ export { Tabs } from "./components/tabs/tabs.mjs";
14
+ export { type Config, type ConfigKey, createAll, initAll } from "./init.mjs";
@@ -0,0 +1,39 @@
1
+ import { version } from "./common/govuk-frontend-version.js";
2
+ import { Accordion } from "./components/accordion/accordion.js";
3
+ import { Button } from "./components/button/button.js";
4
+ import { CharacterCount } from "./components/character-count/character-count.js";
5
+ import { Checkboxes } from "./components/checkboxes/checkboxes.js";
6
+ import { ErrorSummary } from "./components/error-summary/error-summary.js";
7
+ import { ExitThisPage } from "./components/exit-this-page/exit-this-page.js";
8
+ import { Header } from "./components/header/header.js";
9
+ import { NotificationBanner } from "./components/notification-banner/notification-banner.js";
10
+ import { PasswordInput } from "./components/password-input/password-input.js";
11
+ import { Radios } from "./components/radios/radios.js";
12
+ import { SkipLink } from "./components/skip-link/skip-link.js";
13
+ import { Tabs } from "./components/tabs/tabs.js";
14
+ import { type Config as ConfigImport, type ConfigKey as ConfigKeyImport, createAll, initAll } from "./init.js";
15
+
16
+ declare namespace GOVUKFrontend {
17
+ type Config = ConfigImport;
18
+ type ConfigKey = ConfigKeyImport;
19
+ }
20
+
21
+ declare const GOVUKFrontend: {
22
+ version: typeof version;
23
+ Accordion: typeof Accordion;
24
+ Button: typeof Button;
25
+ CharacterCount: typeof CharacterCount;
26
+ Checkboxes: typeof Checkboxes;
27
+ ErrorSummary: typeof ErrorSummary;
28
+ ExitThisPage: typeof ExitThisPage;
29
+ Header: typeof Header;
30
+ NotificationBanner: typeof NotificationBanner;
31
+ PasswordInput: typeof PasswordInput;
32
+ Radios: typeof Radios;
33
+ SkipLink: typeof SkipLink;
34
+ Tabs: typeof Tabs;
35
+ createAll: typeof createAll;
36
+ initAll: typeof initAll;
37
+ };
38
+
39
+ export = GOVUKFrontend;
@@ -0,0 +1 @@
1
+ export * from "./all.bundle.mjs";
@@ -0,0 +1 @@
1
+ export * from "./closest-attribute-value.js";
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Returns the value of the given attribute closest to the given element (including itself)
3
+ *
4
+ * @internal
5
+ * @param {Element} $element - The element to start walking the DOM tree up
6
+ * @param {string} attributeName - The name of the attribute
7
+ * @returns {string | null} Attribute value
8
+ */
9
+ export function closestAttributeValue($element: Element, attributeName: string): string | null;
@@ -0,0 +1 @@
1
+ export * from "./govuk-frontend-version.js";
@@ -0,0 +1,6 @@
1
+ /**
2
+ * GOV.UK Frontend release version
3
+ *
4
+ * {@link https://github.com/alphagov/govuk-frontend/releases}
5
+ */
6
+ export const version: "development";
@@ -0,0 +1 @@
1
+ export * from "./index.js";
@@ -0,0 +1,159 @@
1
+ /**
2
+ * Common helpers which do not require polyfill.
3
+ *
4
+ * IMPORTANT: If a helper require a polyfill, please isolate it in its own module
5
+ * so that the polyfill can be properly tree-shaken and does not burden
6
+ * the components that do not need that helper
7
+ */
8
+ /**
9
+ * Config merging function
10
+ *
11
+ * Takes any number of objects and combines them together, with
12
+ * greatest priority on the LAST item passed in.
13
+ *
14
+ * @internal
15
+ * @param {...{ [key: string]: unknown }} configObjects - Config objects to merge
16
+ * @returns {{ [key: string]: unknown }} A merged config object
17
+ */
18
+ export function mergeConfigs(
19
+ ...configObjects: Array<{
20
+ [key: string]: unknown;
21
+ }>
22
+ ): {
23
+ [key: string]: unknown;
24
+ };
25
+
26
+ /**
27
+ * Extracts keys starting with a particular namespace from dataset ('data-*')
28
+ * object, removing the namespace in the process, normalising all values
29
+ *
30
+ * @internal
31
+ * @param {{ schema: Schema }} Component - Component class
32
+ * @param {DOMStringMap} dataset - The object to extract key-value pairs from
33
+ * @param {string} namespace - The namespace to filter keys with
34
+ * @returns {ObjectNested | undefined} Nested object with dot-separated key namespace removed
35
+ */
36
+ export function extractConfigByNamespace(
37
+ Component: {
38
+ schema: Schema;
39
+ },
40
+ dataset: DOMStringMap,
41
+ namespace: string,
42
+ ): ObjectNested | undefined;
43
+
44
+ /**
45
+ * Get hash fragment from URL
46
+ *
47
+ * Extract the hash fragment (everything after the hash) from a URL,
48
+ * but not including the hash symbol
49
+ *
50
+ * @param {string} url - URL
51
+ * @returns {string | undefined} Fragment from URL, without the hash
52
+ */
53
+ export function getFragmentFromUrl(url: string): string | undefined;
54
+
55
+ /**
56
+ * Get GOV.UK Frontend breakpoint value from CSS custom property
57
+ *
58
+ * @param {string} name - Breakpoint name
59
+ * @returns {{ property: string, value?: string }} Breakpoint object
60
+ */
61
+ export function getBreakpoint(name: string): {
62
+ property: string;
63
+ value?: string;
64
+ };
65
+
66
+ /**
67
+ * Move focus to element
68
+ *
69
+ * Sets tabindex to -1 to make the element programmatically focusable,
70
+ * but removes it on blur as the element doesn't need to be focused again.
71
+ *
72
+ * @template {HTMLElement} FocusElement
73
+ * @param {FocusElement} $element - HTML element
74
+ * @param {object} [options] - Handler options
75
+ * @param {function(this: FocusElement): void} [options.onBeforeFocus] - Callback before focus
76
+ * @param {function(this: FocusElement): void} [options.onBlur] - Callback on blur
77
+ */
78
+ export function setFocus<FocusElement extends HTMLElement>(
79
+ $element: FocusElement,
80
+ options?: {
81
+ onBeforeFocus?: ((this: FocusElement) => void) | undefined;
82
+ onBlur?: ((this: FocusElement) => void) | undefined;
83
+ },
84
+ ): void;
85
+
86
+ /**
87
+ * Checks if GOV.UK Frontend is supported on this page
88
+ *
89
+ * Some browsers will load and run our JavaScript but GOV.UK Frontend
90
+ * won't be supported.
91
+ *
92
+ * @internal
93
+ * @param {HTMLElement | null} [$scope] - HTML element `<body>` checked for browser support
94
+ * @returns {boolean} Whether GOV.UK Frontend is supported on this page
95
+ */
96
+ export function isSupported($scope?: HTMLElement | null): boolean;
97
+
98
+ /**
99
+ * Validate component config by schema
100
+ *
101
+ * Follows limited examples in JSON schema for wider support in future
102
+ *
103
+ * {@link https://ajv.js.org/json-schema.html#compound-keywords}
104
+ * {@link https://ajv.js.org/packages/ajv-errors.html#single-message}
105
+ *
106
+ * @internal
107
+ * @param {Schema} schema - Config schema
108
+ * @param {{ [key: string]: unknown }} config - Component config
109
+ * @returns {string[]} List of validation errors
110
+ */
111
+ export function validateConfig(schema: Schema, config: {
112
+ [key: string]: unknown;
113
+ }): string[];
114
+
115
+ /**
116
+ * Schema for component config
117
+ */
118
+ export interface Schema {
119
+ /**
120
+ * - Schema properties
121
+ */
122
+ properties: {
123
+ [field: string]: SchemaProperty | undefined;
124
+ };
125
+
126
+ /**
127
+ * - List of schema conditions
128
+ */
129
+ anyOf?: SchemaCondition[] | undefined;
130
+ }
131
+
132
+ /**
133
+ * Schema property for component config
134
+ */
135
+ export interface SchemaProperty {
136
+ /**
137
+ * - Property type
138
+ */
139
+ type: "string" | "boolean" | "number" | "object";
140
+ }
141
+
142
+ /**
143
+ * Schema condition for component config
144
+ */
145
+ export interface SchemaCondition {
146
+ /**
147
+ * - List of required config fields
148
+ */
149
+ required: string[];
150
+
151
+ /**
152
+ * - Error message when required config fields not provided
153
+ */
154
+ errorMessage: string;
155
+ }
156
+ export type NestedKey = keyof ObjectNested;
157
+ export interface ObjectNested {
158
+ [key: string]: string | boolean | number | ObjectNested | undefined;
159
+ }
@@ -0,0 +1 @@
1
+ export * from "./normalise-dataset.js";
@@ -0,0 +1,16 @@
1
+ import { type ObjectNested, type Schema } from "./index.js";
2
+
3
+ /**
4
+ * Normalise dataset
5
+ *
6
+ * Loop over an object and normalise each value using {@link normaliseString},
7
+ * optionally expanding nested `i18n.field`
8
+ *
9
+ * @internal
10
+ * @param {{ schema: Schema }} Component - Component class
11
+ * @param {DOMStringMap} dataset - HTML element dataset
12
+ * @returns {ObjectNested} Normalised dataset
13
+ */
14
+ export function normaliseDataset(Component: {
15
+ schema: Schema;
16
+ }, dataset: DOMStringMap): ObjectNested;
@@ -0,0 +1 @@
1
+ export * from "./normalise-string.js";
@@ -0,0 +1,22 @@
1
+ import { type SchemaProperty } from "./index.js";
2
+
3
+ /**
4
+ * Normalise string
5
+ *
6
+ * 'If it looks like a duck, and it quacks like a duck…' 🦆
7
+ *
8
+ * If the passed value looks like a boolean or a number, convert it to a boolean
9
+ * or number.
10
+ *
11
+ * Designed to be used to convert config passed via data attributes (which are
12
+ * always strings) into something sensible.
13
+ *
14
+ * @internal
15
+ * @param {DOMStringMap[string]} value - The value to normalise
16
+ * @param {SchemaProperty} [property] - Component schema property
17
+ * @returns {string | boolean | number | undefined} Normalised data
18
+ */
19
+ export function normaliseString(
20
+ value: DOMStringMap[string],
21
+ property?: SchemaProperty,
22
+ ): string | boolean | number | undefined;
@@ -0,0 +1 @@
1
+ export * from "./accordion.js";
@@ -0,0 +1,120 @@
1
+ import { GOVUKFrontendComponent } from "../../govuk-frontend-component.js";
2
+
3
+ /**
4
+ * Accordion component
5
+ *
6
+ * This allows a collection of sections to be collapsed by default, showing only
7
+ * their headers. Sections can be expanded or collapsed individually by clicking
8
+ * their headers. A "Show all sections" button is also added to the top of the
9
+ * accordion, which switches to "Hide all sections" when all the sections are
10
+ * expanded.
11
+ *
12
+ * The state of each section is saved to the DOM via the `aria-expanded`
13
+ * attribute, which also provides accessibility.
14
+ */
15
+ export class Accordion extends GOVUKFrontendComponent {
16
+ /**
17
+ * Name for the component used when initialising using data-module attributes.
18
+ */
19
+ static moduleName: string;
20
+
21
+ /**
22
+ * Accordion default config
23
+ *
24
+ * @see {@link AccordionConfig}
25
+ */
26
+ static defaults: AccordionConfig;
27
+
28
+ /**
29
+ * Accordion config schema
30
+ *
31
+ * @satisfies {Schema}
32
+ */
33
+ static schema: Readonly<{
34
+ properties: {
35
+ i18n: {
36
+ type: "object";
37
+ };
38
+ rememberExpanded: {
39
+ type: "boolean";
40
+ };
41
+ };
42
+ }>;
43
+
44
+ /**
45
+ * @param {Element | null} $module - HTML element to use for accordion
46
+ * @param {AccordionConfig} [config] - Accordion config
47
+ */
48
+ constructor($module: Element | null, config?: AccordionConfig);
49
+
50
+ /**
51
+ * Get the identifier for a section
52
+ *
53
+ * We need a unique way of identifying each content in the Accordion.
54
+ * Since an `#id` should be unique and an `id` is required for `aria-`
55
+ * attributes `id` can be safely used.
56
+ *
57
+ * @param {Element} $section - Section element
58
+ * @returns {string | undefined | null} Identifier for section
59
+ */
60
+ getIdentifier($section: Element): string | undefined | null;
61
+ }
62
+
63
+ /**
64
+ * Accordion config
65
+ */
66
+ export interface AccordionConfig {
67
+ /**
68
+ * - Accordion translations
69
+ */
70
+ i18n?: AccordionTranslations | undefined;
71
+
72
+ /**
73
+ * - Whether the expanded and collapsed
74
+ * state of each section is remembered and restored when navigating.
75
+ */
76
+ rememberExpanded?: boolean | undefined;
77
+ }
78
+
79
+ /**
80
+ * Messages used by the component for the labels of its buttons. This includes
81
+ * the visible text shown on screen, and text to help assistive technology users
82
+ * for the buttons toggling each section.
83
+ */
84
+ export interface AccordionTranslations {
85
+ /**
86
+ * - The text content for the 'Hide all
87
+ * sections' button, used when at least one section is expanded.
88
+ */
89
+ hideAllSections?: string | undefined;
90
+
91
+ /**
92
+ * - The text content for the 'Hide'
93
+ * button, used when a section is expanded.
94
+ */
95
+ hideSection?: string | undefined;
96
+
97
+ /**
98
+ * - The text content appended to the
99
+ * 'Hide' button's accessible name when a section is expanded.
100
+ */
101
+ hideSectionAriaLabel?: string | undefined;
102
+
103
+ /**
104
+ * - The text content for the 'Show all
105
+ * sections' button, used when all sections are collapsed.
106
+ */
107
+ showAllSections?: string | undefined;
108
+
109
+ /**
110
+ * - The text content for the 'Show'
111
+ * button, used when a section is collapsed.
112
+ */
113
+ showSection?: string | undefined;
114
+
115
+ /**
116
+ * - The text content appended to the
117
+ * 'Show' button's accessible name when a section is expanded.
118
+ */
119
+ showSectionAriaLabel?: string | undefined;
120
+ }
@@ -0,0 +1 @@
1
+ export * from "./button.js";
@@ -0,0 +1,48 @@
1
+ import { GOVUKFrontendComponent } from "../../govuk-frontend-component.js";
2
+
3
+ /**
4
+ * JavaScript enhancements for the Button component
5
+ */
6
+ export class Button extends GOVUKFrontendComponent {
7
+ /**
8
+ * Name for the component used when initialising using data-module attributes.
9
+ */
10
+ static moduleName: string;
11
+
12
+ /**
13
+ * Button default config
14
+ *
15
+ * @see {@link ButtonConfig}
16
+ */
17
+ static defaults: ButtonConfig;
18
+
19
+ /**
20
+ * Button config schema
21
+ *
22
+ * @satisfies {Schema}
23
+ */
24
+ static schema: Readonly<{
25
+ properties: {
26
+ preventDoubleClick: {
27
+ type: "boolean";
28
+ };
29
+ };
30
+ }>;
31
+
32
+ /**
33
+ * @param {Element | null} $module - HTML element to use for button
34
+ * @param {ButtonConfig} [config] - Button config
35
+ */
36
+ constructor($module: Element | null, config?: ButtonConfig);
37
+ }
38
+
39
+ /**
40
+ * Button config
41
+ */
42
+ export interface ButtonConfig {
43
+ /**
44
+ * - Prevent accidental double
45
+ * clicks on submit buttons from submitting forms multiple times.
46
+ */
47
+ preventDoubleClick?: boolean | undefined;
48
+ }
@@ -0,0 +1 @@
1
+ export * from "./character-count.js";
@@ -0,0 +1,158 @@
1
+ import { GOVUKFrontendComponent } from "../../govuk-frontend-component.js";
2
+ import { type TranslationPluralForms } from "../../i18n.js";
3
+
4
+ /**
5
+ * Character count component
6
+ *
7
+ * Tracks the number of characters or words in the `.govuk-js-character-count`
8
+ * `<textarea>` inside the element. Displays a message with the remaining number
9
+ * of characters/words available, or the number of characters/words in excess.
10
+ *
11
+ * You can configure the message to only appear after a certain percentage
12
+ * of the available characters/words has been entered.
13
+ */
14
+ export class CharacterCount extends GOVUKFrontendComponent {
15
+ /**
16
+ * Name for the component used when initialising using data-module attributes.
17
+ */
18
+ static moduleName: string;
19
+
20
+ /**
21
+ * Character count default config
22
+ *
23
+ * @see {@link CharacterCountConfig}
24
+ */
25
+ static defaults: CharacterCountConfig;
26
+
27
+ /**
28
+ * Character count config schema
29
+ *
30
+ * @satisfies {Schema}
31
+ */
32
+ static schema: Readonly<{
33
+ properties: {
34
+ i18n: {
35
+ type: "object";
36
+ };
37
+ maxwords: {
38
+ type: "number";
39
+ };
40
+ maxlength: {
41
+ type: "number";
42
+ };
43
+ threshold: {
44
+ type: "number";
45
+ };
46
+ };
47
+ anyOf: Array<{
48
+ required: string[];
49
+ errorMessage: string;
50
+ }>;
51
+ }>;
52
+
53
+ /**
54
+ * @param {Element | null} $module - HTML element to use for character count
55
+ * @param {CharacterCountConfig} [config] - Character count config
56
+ */
57
+ constructor($module: Element | null, config?: CharacterCountConfig);
58
+ }
59
+
60
+ /**
61
+ * Character count config
62
+ */
63
+ export interface CharacterCountConfig {
64
+ /**
65
+ * - The maximum number of characters.
66
+ * If maxwords is provided, the maxlength option will be ignored.
67
+ */
68
+ maxlength?: number | undefined;
69
+
70
+ /**
71
+ * - The maximum number of words. If maxwords is
72
+ * provided, the maxlength option will be ignored.
73
+ */
74
+ maxwords?: number | undefined;
75
+
76
+ /**
77
+ * - The percentage value of the limit at
78
+ * which point the count message is displayed. If this attribute is set, the
79
+ * count message will be hidden by default.
80
+ */
81
+ threshold?: number | undefined;
82
+
83
+ /**
84
+ * - Character count translations
85
+ */
86
+ i18n?: CharacterCountTranslations | undefined;
87
+ }
88
+
89
+ /**
90
+ * Messages shown to users as they type. It provides feedback on how many words
91
+ * or characters they have remaining or if they are over the limit. This also
92
+ * includes a message used as an accessible description for the textarea.
93
+ */
94
+ export interface CharacterCountTranslations {
95
+ /**
96
+ * - Message displayed
97
+ * when the number of characters is under the configured maximum, `maxlength`.
98
+ * This message is displayed visually and through assistive technologies. The
99
+ * component will replace the `%{count}` placeholder with the number of
100
+ * remaining characters. This is a [pluralised list of
101
+ * messages](https://frontend.design-system.service.gov.uk/localise-govuk-frontend).
102
+ */
103
+ charactersUnderLimit?: TranslationPluralForms | undefined;
104
+
105
+ /**
106
+ * - Message displayed when the number of
107
+ * characters reaches the configured maximum, `maxlength`. This message is
108
+ * displayed visually and through assistive technologies.
109
+ */
110
+ charactersAtLimit?: string | undefined;
111
+
112
+ /**
113
+ * - Message displayed
114
+ * when the number of characters is over the configured maximum, `maxlength`.
115
+ * This message is displayed visually and through assistive technologies. The
116
+ * component will replace the `%{count}` placeholder with the number of
117
+ * remaining characters. This is a [pluralised list of
118
+ * messages](https://frontend.design-system.service.gov.uk/localise-govuk-frontend).
119
+ */
120
+ charactersOverLimit?: TranslationPluralForms | undefined;
121
+
122
+ /**
123
+ * - Message displayed when
124
+ * the number of words is under the configured maximum, `maxlength`. This
125
+ * message is displayed visually and through assistive technologies. The
126
+ * component will replace the `%{count}` placeholder with the number of
127
+ * remaining words. This is a [pluralised list of
128
+ * messages](https://frontend.design-system.service.gov.uk/localise-govuk-frontend).
129
+ */
130
+ wordsUnderLimit?: TranslationPluralForms | undefined;
131
+
132
+ /**
133
+ * - Message displayed when the number of
134
+ * words reaches the configured maximum, `maxlength`. This message is
135
+ * displayed visually and through assistive technologies.
136
+ */
137
+ wordsAtLimit?: string | undefined;
138
+
139
+ /**
140
+ * - Message displayed when
141
+ * the number of words is over the configured maximum, `maxlength`. This
142
+ * message is displayed visually and through assistive technologies. The
143
+ * component will replace the `%{count}` placeholder with the number of
144
+ * remaining words. This is a [pluralised list of
145
+ * messages](https://frontend.design-system.service.gov.uk/localise-govuk-frontend).
146
+ */
147
+ wordsOverLimit?: TranslationPluralForms | undefined;
148
+
149
+ /**
150
+ * - Message made
151
+ * available to assistive technologies, if none is already present in the
152
+ * HTML, to describe that the component accepts only a limited amount of
153
+ * content. It is visible on the page when JavaScript is unavailable. The
154
+ * component will replace the `%{count}` placeholder with the value of the
155
+ * `maxlength` or `maxwords` parameter.
156
+ */
157
+ textareaDescription?: TranslationPluralForms | undefined;
158
+ }
@@ -0,0 +1 @@
1
+ export * from "./checkboxes.js";