Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Export type declarations *.d.mts #4094

Closed
wants to merge 1 commit into from
Closed

Export type declarations *.d.mts #4094

wants to merge 1 commit into from

Conversation

colinrotherham
Copy link
Contributor

@colinrotherham colinrotherham commented Aug 16, 2023

Closes #2835 and up for discussion

Enables editor and IDE autocomplete via npm install govuk-frontend

@govuk-design-system-ci govuk-design-system-ci temporarily deployed to govuk-frontend-pr-4094 August 16, 2023 14:57 Inactive
@govuk-design-system-ci govuk-design-system-ci temporarily deployed to govuk-frontend-pr-4094 August 17, 2023 08:26 Inactive
@govuk-design-system-ci govuk-design-system-ci temporarily deployed to govuk-frontend-pr-4094 August 17, 2023 08:36 Inactive
@colinrotherham colinrotherham changed the base branch from main to build-types-fixes August 17, 2023 08:38
Base automatically changed from build-types-fixes to main August 17, 2023 10:07
@govuk-design-system-ci govuk-design-system-ci temporarily deployed to govuk-frontend-pr-4094 August 23, 2023 21:04 Inactive
@github-actions
Copy link

github-actions bot commented Aug 23, 2023

📋 Stats

File sizes

File Size
dist/govuk-frontend-development.min.css 112.86 KiB
dist/govuk-frontend-development.min.js 38.53 KiB
packages/govuk-frontend/dist/govuk/all.bundle.js 78.63 KiB
packages/govuk-frontend/dist/govuk/all.bundle.mjs 73.89 KiB
packages/govuk-frontend/dist/govuk/all.mjs 3.86 KiB
packages/govuk-frontend/dist/govuk/govuk-frontend-component.mjs 359 B
packages/govuk-frontend/dist/govuk/govuk-frontend.min.css 112.85 KiB
packages/govuk-frontend/dist/govuk/govuk-frontend.min.js 38.51 KiB
packages/govuk-frontend/dist/govuk/i18n.mjs 5.38 KiB

Modules

File Size (bundled) Size (minified)
all.mjs 70.21 KiB 36.78 KiB
accordion.mjs 21.67 KiB 12.42 KiB
button.mjs 4.67 KiB 2.16 KiB
character-count.mjs 21.24 KiB 9.45 KiB
checkboxes.mjs 5.83 KiB 2.83 KiB
error-summary.mjs 6.57 KiB 2.92 KiB
exit-this-page.mjs 16.04 KiB 8.86 KiB
header.mjs 4.46 KiB 2.6 KiB
notification-banner.mjs 4.93 KiB 2.09 KiB
radios.mjs 4.83 KiB 2.38 KiB
skip-link.mjs 4.39 KiB 2.18 KiB
tabs.mjs 10.13 KiB 6.11 KiB

View stats and visualisations on the review app


Action run for f15d73d

@colinrotherham colinrotherham changed the base branch from main to tsconfig-src-dev August 23, 2023 21:19
@govuk-design-system-ci govuk-design-system-ci temporarily deployed to govuk-frontend-pr-4094 August 23, 2023 21:19 Inactive
@govuk-design-system-ci govuk-design-system-ci temporarily deployed to govuk-frontend-pr-4094 August 24, 2023 15:20 Inactive
@govuk-design-system-ci govuk-design-system-ci temporarily deployed to govuk-frontend-pr-4094 August 24, 2023 16:32 Inactive
Base automatically changed from tsconfig-src-dev to main August 30, 2023 13:00
@govuk-design-system-ci govuk-design-system-ci temporarily deployed to govuk-frontend-pr-4094 August 31, 2023 13:17 Inactive
@colinrotherham colinrotherham changed the title [WIP] Export type declarations for component source code Export type declarations for component source code Aug 31, 2023
@colinrotherham colinrotherham marked this pull request as ready for review August 31, 2023 13:17
@colinrotherham colinrotherham requested a review from a team as a code owner August 31, 2023 13:17
@colinrotherham colinrotherham changed the title Export type declarations for component source code Export type declarations Aug 31, 2023
@colinrotherham colinrotherham changed the title Export type declarations Export type declarations *.d.mts Aug 31, 2023
@govuk-design-system-ci govuk-design-system-ci temporarily deployed to govuk-frontend-pr-4094 October 2, 2023 12:16 Inactive
Copy link

github-actions bot commented Nov 29, 2023

Other changes to npm package

diff --git a/packages/govuk-frontend/dist/govuk/all.d.mts b/packages/govuk-frontend/dist/govuk/all.d.mts
new file mode 100644
index 000000000..80b4caadd
--- /dev/null
+++ b/packages/govuk-frontend/dist/govuk/all.d.mts
@@ -0,0 +1,93 @@
+/**
+ * Config for all components via `initAll()`
+ */
+export type Config = {
+    /**
+     * - Accordion config
+     */
+    accordion?: import("./components/accordion/accordion.mjs").AccordionConfig | undefined;
+    /**
+     * - Button config
+     */
+    button?: import("./components/button/button.mjs").ButtonConfig | undefined;
+    /**
+     * - Character Count config
+     */
+    characterCount?: import("./components/character-count/character-count.mjs").CharacterCountConfig | undefined;
+    /**
+     * - Error Summary config
+     */
+    errorSummary?: import("./components/error-summary/error-summary.mjs").ErrorSummaryConfig | undefined;
+    /**
+     * - Exit This Page config
+     */
+    exitThisPage?: import("./components/exit-this-page/exit-this-page.mjs").ExitThisPageConfig | undefined;
+    /**
+     * - Notification Banner config
+     */
+    notificationBanner?: import("./components/notification-banner/notification-banner.mjs").NotificationBannerConfig | undefined;
+};
+/**
+ * Config for individual components
+ */
+export type AccordionConfig = import('./components/accordion/accordion.mjs').AccordionConfig;
+/**
+ * Config for individual components
+ */
+export type AccordionTranslations = import('./components/accordion/accordion.mjs').AccordionTranslations;
+/**
+ * Config for individual components
+ */
+export type ButtonConfig = import('./components/button/button.mjs').ButtonConfig;
+/**
+ * Config for individual components
+ */
+export type CharacterCountConfig = import('./components/character-count/character-count.mjs').CharacterCountConfig;
+/**
+ * Config for individual components
+ */
+export type CharacterCountTranslations = import('./components/character-count/character-count.mjs').CharacterCountTranslations;
+/**
+ * Config for individual components
+ */
+export type ErrorSummaryConfig = import('./components/error-summary/error-summary.mjs').ErrorSummaryConfig;
+/**
+ * Config for individual components
+ */
+export type ExitThisPageConfig = import('./components/exit-this-page/exit-this-page.mjs').ExitThisPageConfig;
+/**
+ * Config for individual components
+ */
+export type ExitThisPageTranslations = import('./components/exit-this-page/exit-this-page.mjs').ExitThisPageTranslations;
+/**
+ * Config for individual components
+ */
+export type NotificationBannerConfig = import('./components/notification-banner/notification-banner.mjs').NotificationBannerConfig;
+/**
+ * Component config keys, e.g. `accordion` and `characterCount`
+ */
+export type ConfigKey = keyof Config;
+/**
+ * Initialise all components
+ *
+ * Use the `data-module` attributes to find, instantiate and init all of the
+ * components provided as part of GOV.UK Frontend.
+ *
+ * @param {Config & { scope?: Element }} [config] - Config for all components (with optional scope)
+ */
+export function initAll(config?: (Config & {
+    scope?: Element | undefined;
+}) | undefined): void;
+import { version } from './common/govuk-frontend-version.mjs';
+import { Accordion } from './components/accordion/accordion.mjs';
+import { Button } from './components/button/button.mjs';
+import { CharacterCount } from './components/character-count/character-count.mjs';
+import { Checkboxes } from './components/checkboxes/checkboxes.mjs';
+import { ErrorSummary } from './components/error-summary/error-summary.mjs';
+import { ExitThisPage } from './components/exit-this-page/exit-this-page.mjs';
+import { Header } from './components/header/header.mjs';
+import { NotificationBanner } from './components/notification-banner/notification-banner.mjs';
+import { Radios } from './components/radios/radios.mjs';
+import { SkipLink } from './components/skip-link/skip-link.mjs';
+import { Tabs } from './components/tabs/tabs.mjs';
+export { version, Accordion, Button, CharacterCount, Checkboxes, ErrorSummary, ExitThisPage, Header, NotificationBanner, Radios, SkipLink, Tabs };
diff --git a/packages/govuk-frontend/dist/govuk/common/closest-attribute-value.d.mts b/packages/govuk-frontend/dist/govuk/common/closest-attribute-value.d.mts
new file mode 100644
index 000000000..f8b233519
--- /dev/null
+++ b/packages/govuk-frontend/dist/govuk/common/closest-attribute-value.d.mts
@@ -0,0 +1,9 @@
+/**
+ * Returns the value of the given attribute closest to the given element (including itself)
+ *
+ * @internal
+ * @param {Element} $element - The element to start walking the DOM tree up
+ * @param {string} attributeName - The name of the attribute
+ * @returns {string | null} Attribute value
+ */
+export function closestAttributeValue($element: Element, attributeName: string): string | null;
diff --git a/packages/govuk-frontend/dist/govuk/common/govuk-frontend-version.d.mts b/packages/govuk-frontend/dist/govuk/common/govuk-frontend-version.d.mts
new file mode 100644
index 000000000..41b014810
--- /dev/null
+++ b/packages/govuk-frontend/dist/govuk/common/govuk-frontend-version.d.mts
@@ -0,0 +1,6 @@
+/**
+ * GOV.UK Frontend release version
+ *
+ * {@link https://github.com/alphagov/govuk-frontend/releases}
+ */
+export const version: "development";
diff --git a/packages/govuk-frontend/dist/govuk/common/index.d.mts b/packages/govuk-frontend/dist/govuk/common/index.d.mts
new file mode 100644
index 000000000..ccd0abbb5
--- /dev/null
+++ b/packages/govuk-frontend/dist/govuk/common/index.d.mts
@@ -0,0 +1,120 @@
+/**
+ * Common helpers which do not require polyfill.
+ *
+ * IMPORTANT: If a helper require a polyfill, please isolate it in its own module
+ * so that the polyfill can be properly tree-shaken and does not burden
+ * the components that do not need that helper
+ */
+/**
+ * Config flattening function
+ *
+ * Takes any number of objects, flattens them into namespaced key-value pairs,
+ * (e.g. \{'i18n.showSection': 'Show section'\}) and combines them together, with
+ * greatest priority on the LAST item passed in.
+ *
+ * @internal
+ * @param {...{ [key: string]: unknown }} configObjects - Config object to merge
+ * @returns {{ [key: string]: unknown }} A flattened object of key-value pairs.
+ */
+export function mergeConfigs(...configObjects: {
+    [key: string]: unknown;
+}[]): {
+    [key: string]: unknown;
+};
+/**
+ * Extracts keys starting with a particular namespace from a flattened config
+ * object, removing the namespace in the process.
+ *
+ * @internal
+ * @param {{ [key: string]: unknown }} configObject - The object to extract key-value pairs from.
+ * @param {string} namespace - The namespace to filter keys with.
+ * @returns {{ [key: string]: unknown }} Flattened object with dot-separated key namespace removed
+ */
+export function extractConfigByNamespace(configObject: {
+    [key: string]: unknown;
+}, namespace: string): {
+    [key: string]: unknown;
+};
+/**
+ * Get hash fragment from URL
+ *
+ * Extract the hash fragment (everything after the hash) from a URL,
+ * but not including the hash symbol
+ *
+ * @private
+ * @param {string} url - URL
+ * @returns {string | undefined} Fragment from URL, without the hash
+ */
+export function getFragmentFromUrl(url: string): string | undefined;
+/**
+ * Get GOV.UK Frontend breakpoint value from CSS custom property
+ *
+ * @private
+ * @param {string} name - Breakpoint name
+ * @returns {{ property: string, value?: string }} Breakpoint object
+ */
+export function getBreakpoint(name: string): {
+    property: string;
+    value?: string | undefined;
+};
+/**
+ * Move focus to element
+ *
+ * Sets tabindex to -1 to make the element programmatically focusable,
+ * but removes it on blur as the element doesn't need to be focused again.
+ *
+ * @private
+ * @template {HTMLElement} FocusElement
+ * @param {FocusElement} $element - HTML element
+ * @param {object} [options] - Handler options
+ * @param {function(this: FocusElement): void} [options.onBeforeFocus] - Callback before focus
+ * @param {function(this: FocusElement): void} [options.onBlur] - Callback on blur
+ */
+export function setFocus<FocusElement extends HTMLElement>($element: FocusElement, options?: {
+    onBeforeFocus?: ((this: FocusElement) => void) | undefined;
+    onBlur?: ((this: FocusElement) => void) | undefined;
+} | undefined): void;
+/**
+ * Checks if GOV.UK Frontend is supported on this page
+ *
+ * Some browsers will load and run our JavaScript but GOV.UK Frontend
+ * won't be supported.
+ *
+ * @internal
+ * @param {HTMLElement | null} [$scope] - HTML element `<body>` checked for browser support
+ * @returns {boolean} Whether GOV.UK Frontend is supported on this page
+ */
+export function isSupported($scope?: HTMLElement | null | undefined): boolean;
+/**
+ * Validate component config by schema
+ *
+ * @internal
+ * @param {Schema} schema - Config schema
+ * @param {{ [key: string]: unknown }} config - Component config
+ * @returns {string[]} List of validation errors
+ */
+export function validateConfig(schema: Schema, config: {
+    [key: string]: unknown;
+}): string[];
+/**
+ * Schema for component config
+ */
+export type Schema = {
+    /**
+     * - List of schema conditions
+     */
+    anyOf?: SchemaCondition[] | undefined;
+};
+/**
+ * Schema condition for component config
+ */
+export type SchemaCondition = {
+    /**
+     * - List of required config fields
+     */
+    required: string[];
+    /**
+     * - Error message when required config fields not provided
+     */
+    errorMessage: string;
+};
diff --git a/packages/govuk-frontend/dist/govuk/common/normalise-dataset.d.mts b/packages/govuk-frontend/dist/govuk/common/normalise-dataset.d.mts
new file mode 100644
index 000000000..8fe4823ef
--- /dev/null
+++ b/packages/govuk-frontend/dist/govuk/common/normalise-dataset.d.mts
@@ -0,0 +1,28 @@
+/**
+ * Normalise string
+ *
+ * 'If it looks like a duck, and it quacks like a duck…' 🦆
+ *
+ * If the passed value looks like a boolean or a number, convert it to a boolean
+ * or number.
+ *
+ * Designed to be used to convert config passed via data attributes (which are
+ * always strings) into something sensible.
+ *
+ * @internal
+ * @param {string | undefined} value - The value to normalise
+ * @returns {string | boolean | number | undefined} Normalised data
+ */
+export function normaliseString(value: string | undefined): string | boolean | number | undefined;
+/**
+ * Normalise dataset
+ *
+ * Loop over an object and normalise each value using normaliseData function
+ *
+ * @internal
+ * @param {DOMStringMap} dataset - HTML element dataset
+ * @returns {{ [key: string]: string | boolean | number | undefined }} Normalised dataset
+ */
+export function normaliseDataset(dataset: DOMStringMap): {
+    [key: string]: string | number | boolean | undefined;
+};
diff --git a/packages/govuk-frontend/dist/govuk/components/accordion/accordion.d.mts b/packages/govuk-frontend/dist/govuk/components/accordion/accordion.d.mts
new file mode 100644
index 000000000..89233a78c
--- /dev/null
+++ b/packages/govuk-frontend/dist/govuk/components/accordion/accordion.d.mts
@@ -0,0 +1,247 @@
+/**
+ * Accordion component
+ *
+ * This allows a collection of sections to be collapsed by default, showing only
+ * their headers. Sections can be expanded or collapsed individually by clicking
+ * their headers. A "Show all sections" button is also added to the top of the
+ * accordion, which switches to "Hide all sections" when all the sections are
+ * expanded.
+ *
+ * The state of each section is saved to the DOM via the `aria-expanded`
+ * attribute, which also provides accessibility.
+ *
+ * @preserve
+ */
+export class Accordion extends GOVUKFrontendComponent {
+    /**
+     * Name for the component used when initialising using data-module attributes.
+     */
+    static moduleName: string;
+    /**
+     * Accordion default config
+     *
+     * @see {@link AccordionConfig}
+     * @constant
+     * @type {AccordionConfig}
+     */
+    static defaults: AccordionConfig;
+    /**
+     * @param {Element | null} $module - HTML element to use for accordion
+     * @param {AccordionConfig} [config] - Accordion config
+     */
+    constructor($module: Element | null, config?: AccordionConfig | undefined);
+    /** @private */
+    private $module;
+    /**
+     * @private
+     * @type {AccordionConfig}
+     */
+    private config;
+    /** @private */
+    private i18n;
+    /** @private */
+    private controlsClass;
+    /** @private */
+    private showAllClass;
+    /** @private */
+    private showAllTextClass;
+    /** @private */
+    private sectionClass;
+    /** @private */
+    private sectionExpandedClass;
+    /** @private */
+    private sectionButtonClass;
+    /** @private */
+    private sectionHeaderClass;
+    /** @private */
+    private sectionHeadingClass;
+    /** @private */
+    private sectionHeadingDividerClass;
+    /** @private */
+    private sectionHeadingTextClass;
+    /** @private */
+    private sectionHeadingTextFocusClass;
+    /** @private */
+    private sectionShowHideToggleClass;
+    /** @private */
+    private sectionShowHideToggleFocusClass;
+    /** @private */
+    private sectionShowHideTextClass;
+    /** @private */
+    private upChevronIconClass;
+    /** @private */
+    private downChevronIconClass;
+    /** @private */
+    private sectionSummaryClass;
+    /** @private */
+    private sectionSummaryFocusClass;
+    /** @private */
+    private sectionContentClass;
+    /** @private */
+    private $sections;
+    /** @private */
+    private browserSupportsSessionStorage;
+    /**
+     * @private
+     * @type {HTMLButtonElement | null}
+     */
+    private $showAllButton;
+    /**
+     * @private
+     * @type {HTMLElement | null}
+     */
+    private $showAllIcon;
+    /**
+     * @private
+     * @type {HTMLElement | null}
+     */
+    private $showAllText;
+    /**
+     * Initialise controls and set attributes
+     *
+     * @private
+     */
+    private initControls;
+    /**
+     * Initialise section headers
+     *
+     * @private
+     */
+    private initSectionHeaders;
+    /**
+     * Construct section header
+     *
+     * @private
+     * @param {Element} $header - Section header
+     * @param {number} index - Section index
+     */
+    private constructHeaderMarkup;
+    /**
+     * When a section is opened by the user agent via the 'beforematch' event
+     *
+     * @private
+     * @param {Event} event - Generic event
+     */
+    private onBeforeMatch;
+    /**
+     * When section toggled, set and store state
+     *
+     * @private
+     * @param {Element} $section - Section element
+     */
+    private onSectionToggle;
+    /**
+     * When Open/Close All toggled, set and store state
+     *
+     * @private
+     */
+    private onShowOrHideAllToggle;
+    /**
+     * Set section attributes when opened/closed
+     *
+     * @private
+     * @param {boolean} expanded - Section expanded
+     * @param {Element} $section - Section element
+     */
+    private setExpanded;
+    /**
+     * Get state of section
+     *
+     * @private
+     * @param {Element} $section - Section element
+     * @returns {boolean} True if expanded
+     */
+    private isExpanded;
+    /**
+     * Check if all sections are open
+     *
+     * @private
+     * @returns {boolean} True if all sections are open
+     */
+    private checkIfAllSectionsOpen;
+    /**
+     * Update "Show all sections" button
+     *
+     * @private
+     * @param {boolean} expanded - Section expanded
+     */
+    private updateShowAllButton;
+    /**
+     * Set the state of the accordions in sessionStorage
+     *
+     * @private
+     * @param {Element} $section - Section element
+     */
+    private storeState;
+    /**
+     * Read the state of the accordions from sessionStorage
+     *
+     * @private
+     * @param {Element} $section - Section element
+     */
+    private setInitialState;
+    /**
+     * Create an element to improve semantics of the section button with
+     * punctuation
+     *
+     * Adding punctuation to the button can also improve its general semantics by
+     * dividing its contents into thematic chunks. See
+     * https://github.com/alphagov/govuk-frontend/issues/2327#issuecomment-922957442
+     *
+     * @private
+     * @returns {Element} DOM element
+     */
+    private getButtonPunctuationEl;
+}
+/**
+ * Accordion config
+ */
+export type AccordionConfig = {
+    /**
+     * - Accordion translations
+     */
+    i18n?: AccordionTranslations | undefined;
+    /**
+     * - Whether the expanded and collapsed
+     * state of each section is remembered and restored when navigating.
+     */
+    rememberExpanded?: boolean | undefined;
+};
+/**
+ * Messages used by the component for the labels of its buttons. This includes
+ * the visible text shown on screen, and text to help assistive technology users
+ * for the buttons toggling each section.
+ */
+export type AccordionTranslations = {
+    /**
+     * - The text content for the 'Hide all
+     * sections' button, used when at least one section is expanded.
+     */
+    hideAllSections?: string | undefined;
+    /**
+     * - The text content for the 'Hide'
+     * button, used when a section is expanded.
+     */
+    hideSection?: string | undefined;
+    /**
+     * - The text content appended to the
+     * 'Hide' button's accessible name when a section is expanded.
+     */
+    hideSectionAriaLabel?: string | undefined;
+    /**
+     * - The text content for the 'Show all
+     * sections' button, used when all sections are collapsed.
+     */
+    showAllSections?: string | undefined;
+    /**
+     * - The text content for the 'Show'
+     * button, used when a section is collapsed.
+     */
+    showSection?: string | undefined;
+    /**
+     * - The text content appended to the
+     * 'Show' button's accessible name when a section is expanded.
+     */
+    showSectionAriaLabel?: string | undefined;
+};
+import { GOVUKFrontendComponent } from '../../govuk-frontend-component.mjs';
diff --git a/packages/govuk-frontend/dist/govuk/components/button/button.d.mts b/packages/govuk-frontend/dist/govuk/components/button/button.d.mts
new file mode 100644
index 000000000..64da5ad1b
--- /dev/null
+++ b/packages/govuk-frontend/dist/govuk/components/button/button.d.mts
@@ -0,0 +1,72 @@
+/**
+ * JavaScript enhancements for the Button component
+ *
+ * @preserve
+ */
+export class Button extends GOVUKFrontendComponent {
+    /**
+     * Name for the component used when initialising using data-module attributes.
+     */
+    static moduleName: string;
+    /**
+     * Button default config
+     *
+     * @see {@link ButtonConfig}
+     * @constant
+     * @type {ButtonConfig}
+     */
+    static defaults: ButtonConfig;
+    /**
+     * @param {Element | null} $module - HTML element to use for button
+     * @param {ButtonConfig} [config] - Button config
+     */
+    constructor($module: Element | null, config?: ButtonConfig | undefined);
+    /** @private */
+    private $module;
+    /**
+     * @private
+     * @type {ButtonConfig}
+     */
+    private config;
+    /**
+     * @private
+     * @type {number | null}
+     */
+    private debounceFormSubmitTimer;
+    /**
+     * Trigger a click event when the space key is pressed
+     *
+     * Some screen readers tell users they can use the space bar to activate
+     * things with the 'button' role, so we need to match the functionality of
+     * native HTML buttons.
+     *
+     * See https://github.com/alphagov/govuk_elements/pull/272#issuecomment-233028270
+     *
+     * @private
+     * @param {KeyboardEvent} event - Keydown event
+     */
+    private handleKeyDown;
+    /**
+     * Debounce double-clicks
+     *
+     * If the click quickly succeeds a previous click then nothing will happen.
+     * This stops people accidentally causing multiple form submissions by double
+     * clicking buttons.
+     *
+     * @private
+     * @param {MouseEvent} event - Mouse click event
+     * @returns {undefined | false} Returns undefined, or false when debounced
+     */
+    private debounce;
+}
+/**
+ * Button config
+ */
+export type ButtonConfig = {
+    /**
+     * - Prevent accidental double
+     * clicks on submit buttons from submitting forms multiple times.
+     */
+    preventDoubleClick?: boolean | undefined;
+};
+import { GOVUKFrontendComponent } from '../../govuk-frontend-component.mjs';
diff --git a/packages/govuk-frontend/dist/govuk/components/character-count/character-count.d.mts b/packages/govuk-frontend/dist/govuk/components/character-count/character-count.d.mts
new file mode 100644
index 000000000..58c39c5e5
--- /dev/null
+++ b/packages/govuk-frontend/dist/govuk/components/character-count/character-count.d.mts
@@ -0,0 +1,271 @@
+/**
+ * Character count component
+ *
+ * Tracks the number of characters or words in the `.govuk-js-character-count`
+ * `<textarea>` inside the element. Displays a message with the remaining number
+ * of characters/words available, or the number of characters/words in excess.
+ *
+ * You can configure the message to only appear after a certain percentage
+ * of the available characters/words has been entered.
+ *
+ * @preserve
+ */
+export class CharacterCount extends GOVUKFrontendComponent {
+    /**
+     * Name for the component used when initialising using data-module attributes.
+     */
+    static moduleName: string;
+    /**
+     * Character count default config
+     *
+     * @see {@link CharacterCountConfig}
+     * @constant
+     * @type {CharacterCountConfig}
+     */
+    static defaults: CharacterCountConfig;
+    /**
+     * Character count config schema
+     *
+     * @constant
+     * @satisfies {Schema}
+     */
+    static schema: Readonly<{
+        anyOf: {
+            required: string[];
+            errorMessage: string;
+        }[];
+    }>;
+    /**
+     * @param {Element | null} $module - HTML element to use for character count
+     * @param {CharacterCountConfig} [config] - Character count config
+     */
+    constructor($module: Element | null, config?: CharacterCountConfig | undefined);
+    /** @private */
+    private $module;
+    /** @private */
+    private $textarea;
+    /** @private */
+    private $visibleCountMessage;
+    /** @private */
+    private $screenReaderCountMessage;
+    /**
+     * @private
+     * @type {number | null}
+     */
+    private lastInputTimestamp;
+    /** @private */
+    private lastInputValue;
+    /**
+     * @private
+     * @type {number | null}
+     */
+    private valueChecker;
+    /**
+     * @private
+     * @type {CharacterCountConfig}
+     */
+    private config;
+    /** @private */
+    private i18n;
+    /** @private */
+    private maxLength;
+    /**
+     * Bind change events
+     *
+     * Set up event listeners on the $textarea so that the count messages update
+     * when the user types.
+     *
+     * @private
+     */
+    private bindChangeEvents;
+    /**
+     * Handle key up event
+     *
+     * Update the visible character counter and keep track of when the last update
+     * happened for each keypress
+     *
+     * @private
+     */
+    private handleKeyUp;
+    /**
+     * Handle focus event
+     *
+     * Speech recognition software such as Dragon NaturallySpeaking will modify
+     * the fields by directly changing its `value`. These changes don't trigger
+     * events in JavaScript, so we need to poll to handle when and if they occur.
+     *
+     * Once the keyup event hasn't been detected for at least 1000 ms (1s), check
+     * if the textarea value has changed and update the count message if it has.
+     *
+     * This is so that the update triggered by the manual comparison doesn't
+     * conflict with debounced KeyboardEvent updates.
+     *
+     * @private
+     */
+    private handleFocus;
+    /**
+     * Handle blur event
+     *
+     * Stop checking the textarea value once the textarea no longer has focus
+     *
+     * @private
+     */
+    private handleBlur;
+    /**
+     * Update count message if textarea value has changed
+     *
+     * @private
+     */
+    private updateIfValueChanged;
+    /**
+     * Update count message
+     *
+     * Helper function to update both the visible and screen reader-specific
+     * counters simultaneously (e.g. on init)
+     *
+     * @private
+     */
+    private updateCountMessage;
+    /**
+     * Update visible count message
+     *
+     * @private
+     */
+    private updateVisibleCountMessage;
+    /**
+     * Update screen reader count message
+     *
+     * @private
+     */
+    private updateScreenReaderCountMessage;
+    /**
+     * Count the number of characters (or words, if `config.maxwords` is set)
+     * in the given text
+     *
+     * @private
+     * @param {string} text - The text to count the characters of
+     * @returns {number} the number of characters (or words) in the text
+     */
+    private count;
+    /**
+     * Get count message
+     *
+     * @private
+     * @returns {string} Status message
+     */
+    private getCountMessage;
+    /**
+     * Formats the message shown to users according to what's counted
+     * and how many remain
+     *
+     * @private
+     * @param {number} remainingNumber - The number of words/characaters remaining
+     * @param {string} countType - "words" or "characters"
+     * @returns {string} Status message
+     */
+    private formatCountMessage;
+    /**
+     * Check if count is over threshold
+     *
+     * Checks whether the value is over the configured threshold for the input.
+     * If there is no configured threshold, it is set to 0 and this function will
+     * always return true.
+     *
+     * @private
+     * @returns {boolean} true if the current count is over the config.threshold
+     *   (or no threshold is set)
+     */
+    private isOverThreshold;
+}
+/**
+ * Character count config
+ */
+export type CharacterCountConfig = {
+    /**
+     * - The maximum number of characters.
+     * If maxwords is provided, the maxlength option will be ignored.
+     */
+    maxlength?: number | undefined;
+    /**
+     * - The maximum number of words. If maxwords is
+     * provided, the maxlength option will be ignored.
+     */
+    maxwords?: number | undefined;
+    /**
+     * - The percentage value of the limit at
+     * which point the count message is displayed. If this attribute is set, the
+     * count message will be hidden by default.
+     */
+    threshold?: number | undefined;
+    /**
+     * - Character count translations
+     */
+    i18n?: CharacterCountTranslations | undefined;
+};
+/**
+ * Messages shown to users as they type. It provides feedback on how many words
+ * or characters they have remaining or if they are over the limit. This also
+ * includes a message used as an accessible description for the textarea.
+ */
+export type CharacterCountTranslations = {
+    /**
+     * - Message displayed
+     * when the number of characters is under the configured maximum, `maxlength`.
+     * This message is displayed visually and through assistive technologies. The
+     * component will replace the `%{count}` placeholder with the number of
+     * remaining characters. This is a [pluralised list of
+     * messages](https://frontend.design-system.service.gov.uk/localise-govuk-frontend).
+     */
+    charactersUnderLimit?: import("../../i18n.mjs").TranslationPluralForms | undefined;
+    /**
+     * - Message displayed when the number of
+     * characters reaches the configured maximum, `maxlength`. This message is
+     * displayed visually and through assistive technologies.
+     */
+    charactersAtLimit?: string | undefined;
+    /**
+     * - Message displayed
+     * when the number of characters is over the configured maximum, `maxlength`.
+     * This message is displayed visually and through assistive technologies. The
+     * component will replace the `%{count}` placeholder with the number of
+     * remaining characters. This is a [pluralised list of
+     * messages](https://frontend.design-system.service.gov.uk/localise-govuk-frontend).
+     */
+    charactersOverLimit?: import("../../i18n.mjs").TranslationPluralForms | undefined;
+    /**
+     * - Message displayed when
+     * the number of words is under the configured maximum, `maxlength`. This
+     * message is displayed visually and through assistive technologies. The
+     * component will replace the `%{count}` placeholder with the number of
+     * remaining words. This is a [pluralised list of
+     * messages](https://frontend.design-system.service.gov.uk/localise-govuk-frontend).
+     */
+    wordsUnderLimit?: import("../../i18n.mjs").TranslationPluralForms | undefined;
+    /**
+     * - Message displayed when the number of
+     * words reaches the configured maximum, `maxlength`. This message is
+     * displayed visually and through assistive technologies.
+     */
+    wordsAtLimit?: string | undefined;
+    /**
+     * - Message displayed when
+     * the number of words is over the configured maximum, `maxlength`. This
+     * message is displayed visually and through assistive technologies. The
+     * component will replace the `%{count}` placeholder with the number of
+     * remaining words. This is a [pluralised list of
+     * messages](https://frontend.design-system.service.gov.uk/localise-govuk-frontend).
+     */
+    wordsOverLimit?: import("../../i18n.mjs").TranslationPluralForms | undefined;
+    /**
+     * - Message made
+     * available to assistive technologies, if none is already present in the
+     * HTML, to describe that the component accepts only a limited amount of
+     * content. It is visible on the page when JavaScript is unavailable. The
+     * component will replace the `%{count}` placeholder with the value of the
+     * `maxlength` or `maxwords` parameter.
+     */
+    textareaDescription?: import("../../i18n.mjs").TranslationPluralForms | undefined;
+};
+export type Schema = import('../../common/index.mjs').Schema;
+export type TranslationPluralForms = import('../../i18n.mjs').TranslationPluralForms;
+import { GOVUKFrontendComponent } from '../../govuk-frontend-component.mjs';
diff --git a/packages/govuk-frontend/dist/govuk/components/checkboxes/checkboxes.d.mts b/packages/govuk-frontend/dist/govuk/components/checkboxes/checkboxes.d.mts
new file mode 100644
index 000000000..712c491e2
--- /dev/null
+++ b/packages/govuk-frontend/dist/govuk/components/checkboxes/checkboxes.d.mts
@@ -0,0 +1,79 @@
+/**
+ * Checkboxes component
+ *
+ * @preserve
+ */
+export class Checkboxes extends GOVUKFrontendComponent {
+    /**
+     * Name for the component used when initialising using data-module attributes.
+     */
+    static moduleName: string;
+    /**
+     * Checkboxes can be associated with a 'conditionally revealed' content block
+     * – for example, a checkbox for 'Phone' could reveal an additional form field
+     * for the user to enter their phone number.
+     *
+     * These associations are made using a `data-aria-controls` attribute, which
+     * is promoted to an aria-controls attribute during initialisation.
+     *
+     * We also need to restore the state of any conditional reveals on the page
+     * (for example if the user has navigated back), and set up event handlers to
+     * keep the reveal in sync with the checkbox state.
+     *
+     * @param {Element | null} $module - HTML element to use for checkboxes
+     */
+    constructor($module: Element | null);
+    /** @private */
+    private $module;
+    /** @private */
+    private $inputs;
+    /**
+     * Sync the conditional reveal states for all checkboxes in this $module.
+     *
+     * @private
+     */
+    private syncAllConditionalReveals;
+    /**
+     * Sync conditional reveal with the input state
+     *
+     * Synchronise the visibility of the conditional reveal, and its accessible
+     * state, with the input's checked state.
+     *
+     * @private
+     * @param {HTMLInputElement} $input - Checkbox input
+     */
+    private syncConditionalRevealWithInputState;
+    /**
+     * Uncheck other checkboxes
+     *
+     * Find any other checkbox inputs with the same name value, and uncheck them.
+     * This is useful for when a “None of these" checkbox is checked.
+     *
+     * @private
+     * @param {HTMLInputElement} $input - Checkbox input
+     */
+    private unCheckAllInputsExcept;
+    /**
+     * Uncheck exclusive checkboxes
+     *
+     * Find any checkbox inputs with the same name value and the 'exclusive'
+     * behaviour, and uncheck them. This helps prevent someone checking both a
+     * regular checkbox and a "None of these" checkbox in the same fieldset.
+     *
+     * @private
+     * @param {HTMLInputElement} $input - Checkbox input
+     */
+    private unCheckExclusiveInputs;
+    /**
+     * Click event handler
+     *
+     * Handle a click within the $module – if the click occurred on a checkbox,
+     * sync the state of any associated conditional reveal with the checkbox
+     * state.
+     *
+     * @private
+     * @param {MouseEvent} event - Click event
+     */
+    private handleClick;
+}
+import { GOVUKFrontendComponent } from '../../govuk-frontend-component.mjs';
diff --git a/packages/govuk-frontend/dist/govuk/components/error-summary/error-summary.d.mts b/packages/govuk-frontend/dist/govuk/components/error-summary/error-summary.d.mts
new file mode 100644
index 000000000..708fe9d8b
--- /dev/null
+++ b/packages/govuk-frontend/dist/govuk/components/error-summary/error-summary.d.mts
@@ -0,0 +1,89 @@
+/**
+ * Error summary component
+ *
+ * Takes focus on initialisation for accessible announcement, unless disabled in
+ * configuration.
+ *
+ * @preserve
+ */
+export class ErrorSummary extends GOVUKFrontendComponent {
+    /**
+     * Name for the component used when initialising using data-module attributes.
+     */
+    static moduleName: string;
+    /**
+     * Error summary default config
+     *
+     * @see {@link ErrorSummaryConfig}
+     * @constant
+     * @type {ErrorSummaryConfig}
+     */
+    static defaults: ErrorSummaryConfig;
+    /**
+     * @param {Element | null} $module - HTML element to use for error summary
+     * @param {ErrorSummaryConfig} [config] - Error summary config
+     */
+    constructor($module: Element | null, config?: ErrorSummaryConfig | undefined);
+    /** @private */
+    private $module;
+    /**
+     * @private
+     * @type {ErrorSummaryConfig}
+     */
+    private config;
+    /**
+     * Click event handler
+     *
+     * @private
+     * @param {MouseEvent} event - Click event
+     */
+    private handleClick;
+    /**
+     * Focus the target element
+     *
+     * By default, the browser will scroll the target into view. Because our
+     * labels or legends appear above the input, this means the user will be
+     * presented with an input without any context, as the label or legend will be
+     * off the top of the screen.
+     *
+     * Manually handling the click event, scrolling the question into view and
+     * then focussing the element solves this.
+     *
+     * This also results in the label and/or legend being announced correctly in
+     * NVDA (as tested in 2018.3.2) - without this only the field type is
+     * announced (e.g. "Edit, has autocomplete").
+     *
+     * @private
+     * @param {EventTarget} $target - Event target
+     * @returns {boolean} True if the target was able to be focussed
+     */
+    private focusTarget;
+    /**
+     * Get associated legend or label
+     *
+     * Returns the first element that exists from this list:
+     *
+     * - The `<legend>` associated with the closest `<fieldset>` ancestor, as long
+     *   as the top of it is no more than half a viewport height away from the
+     *   bottom of the input
+     * - The first `<label>` that is associated with the input using for="inputId"
+     * - The closest parent `<label>`
+     *
+     * @private
+     * @param {Element} $input - The input
+     * @returns {Element | null} Associated legend or label, or null if no
+     *   associated legend or label can be found
+     */
+    private getAssociatedLegendOrLabel;
+}
+/**
+ * Error summary config
+ */
+export type ErrorSummaryConfig = {
+    /**
+     * - If set to `true` the error
+     * summary will not be focussed when the page loads.
+     */
+    disableAutoFocus?: boolean | undefined;
+};
+import { GOVUKFrontendComponent } from '../../govuk-frontend-component.mjs';
diff --git a/packages/govuk-frontend/dist/govuk/components/exit-this-page/exit-this-page.d.mts b/packages/govuk-frontend/dist/govuk/components/exit-this-page/exit-this-page.d.mts
new file mode 100644
index 000000000..da4bb4414
--- /dev/null
+++ b/packages/govuk-frontend/dist/govuk/components/exit-this-page/exit-this-page.d.mts
@@ -0,0 +1,193 @@
+/**
+ * Exit this page component
+ *
+ * @preserve
+ */
+export class ExitThisPage extends GOVUKFrontendComponent {
+    /**
+     * Name for the component used when initialising using data-module attributes.
+     */
+    static moduleName: string;
+    /**
+     * Exit this page default config
+     *
+     * @see {@link ExitThisPageConfig}
+     * @constant
+     * @type {ExitThisPageConfig}
+     */
+    static defaults: ExitThisPageConfig;
+    /**
+     * @param {Element | null} $module - HTML element that wraps the Exit This Page button
+     * @param {ExitThisPageConfig} [config] - Exit This Page config
+     */
+    constructor($module: Element | null, config?: ExitThisPageConfig | undefined);
+    /** @private */
+    private $module;
+    /**
+     * @private
+     * @type {ExitThisPageConfig}
+     */
+    private config;
+    /** @private */
+    private i18n;
+    /** @private */
+    private $button;
+    /**
+     * @private
+     * @type {HTMLAnchorElement | null}
+     */
+    private $skiplinkButton;
+    /**
+     * @private
+     * @type {HTMLElement | null}
+     */
+    private $updateSpan;
+    /**
+     * @private
+     * @type {HTMLElement | null}
+     */
+    private $indicatorContainer;
+    /**
+     * @private
+     * @type {HTMLElement | null}
+     */
+    private $overlay;
+    /** @private */
+    private keypressCounter;
+    /** @private */
+    private lastKeyWasModified;
+    /** @private */
+    private timeoutTime;
+    /**
+     * @private
+     * @type {number | null}
+     */
+    private keypressTimeoutId;
+    /**
+     * @private
+     * @type {number | null}
+     */
+    private timeoutMessageId;
+    /**
+     * Create the <span> we use for screen reader announcements.
+     *
+     * @private
+     */
+    private initUpdateSpan;
+    /**
+     * Create button click handlers.
+     *
+     * @private
+     */
+    private initButtonClickHandler;
+    /**
+     * Create the HTML for the 'three lights' indicator on the button.
+     *
+     * @private
+     */
+    private buildIndicator;
+    /**
+     * Update whether the lights are visible and which ones are lit up depending on
+     * the value of `keypressCounter`.
+     *
+     * @private
+     */
+    private updateIndicator;
+    /**
+     * Initiates the redirection away from the current page.
+     * Includes the loading overlay functionality, which covers the current page with a
+     * white overlay so that the contents are not visible during the loading
+     * process. This is particularly important on slow network connections.
+     *
+     * @private
+     */
+    private exitPage;
+    /**
+     * Pre-activation logic for when the button is clicked/activated via mouse or
+     * pointer.
+     *
+     * We do this to differentiate it from the keyboard activation event because we
+     * need to run `e.preventDefault` as the button or skiplink are both links and we
+     * want to apply some additional logic in `exitPage` before navigating.
+     *
+     * @private
+     * @param {MouseEvent} event - mouse click event
+     */
+    private handleClick;
+    /**
+     * Logic for the 'quick escape' keyboard sequence functionality (pressing the
+     * Shift key three times without interruption, within a time limit).
+     *
+     * @private
+     * @param {KeyboardEvent} event - keyup event
+     */
+    private handleKeypress;
+    /**
+     * Starts the 'quick escape' keyboard sequence timer.
+     *
+     * This can be invoked several times. We want this to be possible so that the
+     * timer is restarted each time the shortcut key is pressed (e.g. the user has
+     * up to n seconds between each keypress, rather than n seconds to invoke the
+     * entire sequence.)
+     *
+     * @private
+     */
+    private setKeypressTimer;
+    /**
+     * Stops and resets the 'quick escape' keyboard sequence timer.
+     *
+     * @private
+     */
+    private resetKeypressTimer;
+    /**
+     * Reset the page using the EtP button
+     *
+     * We use this in situations where a user may re-enter a page using the browser
+     * back button. In these cases, the browser can choose to restore the state of
+     * the page as it was previously, including restoring the 'ghost page' overlay,
+     * the announcement span having it's role set to "alert" and the keypress
+     * indicator still active, leaving the page in an unusable state.
+     *
+     * By running this check when the page is shown, we can programatically restore
+     * the page and the component to a "default" state
+     *
+     * @private
+     */
+    private resetPage;
+}
+/**
+ * Exit this Page config
+ */
+export type ExitThisPageConfig = {
+    /**
+     * - Exit this page translations
+     */
+    i18n?: ExitThisPageTranslations | undefined;
+};
+/**
+ * Messages used by the component programatically inserted text, including
+ * overlay text and screen reader announcements.
+ */
+export type ExitThisPageTranslations = {
+    /**
+     * - Screen reader announcement for when EtP
+     * keypress functionality has been successfully activated.
+     */
+    activated?: string | undefined;
+    /**
+     * - Screen reader announcement for when the EtP
+     * keypress functionality has timed out.
+     */
+    timedOut?: string | undefined;
+    /**
+     * - Screen reader announcement informing
+     * the user they must press the activation key two more times.
+     */
+    pressTwoMoreTimes?: string | undefined;
+    /**
+     * - Screen reader announcement informing
+     * the user they must press the activation key one more time.
+     */
+    pressOneMoreTime?: string | undefined;
+};
+import { GOVUKFrontendComponent } from '../../govuk-frontend-component.mjs';
diff --git a/packages/govuk-frontend/dist/govuk/components/header/header.d.mts b/packages/govuk-frontend/dist/govuk/components/header/header.d.mts
new file mode 100644
index 000000000..b1596574b
--- /dev/null
+++ b/packages/govuk-frontend/dist/govuk/components/header/header.d.mts
@@ -0,0 +1,68 @@
+/**
+ * Header component
+ *
+ * @preserve
+ */
+export class Header extends GOVUKFrontendComponent {
+    /**
+     * Name for the component used when initialising using data-module attributes.
+     */
+    static moduleName: string;
+    /**
+     * Apply a matchMedia for desktop which will trigger a state sync if the
+     * browser viewport moves between states.
+     *
+     * @param {Element | null} $module - HTML element to use for header
+     */
+    constructor($module: Element | null);
+    /** @private */
+    private $module;
+    /** @private */
+    private $menuButton;
+    /** @private */
+    private $menu;
+    /**
+     * Save the opened/closed state for the nav in memory so that we can
+     * accurately maintain state when the screen is changed from small to big and
+     * back to small
+     *
+     * @private
+     */
+    private menuIsOpen;
+    /**
+     * A global const for storing a matchMedia instance which we'll use to detect
+     * when a screen size change happens. We rely on it being null if the feature
+     * isn't available to initially apply hidden attributes
+     *
+     * @private
+     * @type {MediaQueryList | null}
+     */
+    private mql;
+    /**
+     * Setup viewport resize check
+     *
+     * @private
+     */
+    private setupResponsiveChecks;
+    /**
+     * Sync menu state
+     *
+     * Uses the global variable menuIsOpen to correctly set the accessible and
+     * visual states of the menu and the menu button.
+     * Additionally will force the menu to be visible and the menu button to be
+     * hidden if the matchMedia is triggered to desktop.
+     *
+     * @private
+     */
+    private checkMode;
+    /**
+     * Handle menu button click
+     *
+     * When the menu button is clicked, change the visibility of the menu and then
+     * sync the accessibility state and menu button state
+     *
+     * @private
+     */
+    private handleMenuButtonClick;
+}
+import { GOVUKFrontendComponent } from '../../govuk-frontend-component.mjs';
diff --git a/packages/govuk-frontend/dist/govuk/components/notification-banner/notification-banner.d.mts b/packages/govuk-frontend/dist/govuk/components/notification-banner/notification-banner.d.mts
new file mode 100644
index 000000000..696d5e125
--- /dev/null
+++ b/packages/govuk-frontend/dist/govuk/components/notification-banner/notification-banner.d.mts
@@ -0,0 +1,44 @@
+/**
+ * Notification Banner component
+ *
+ * @preserve
+ */
+export class NotificationBanner extends GOVUKFrontendComponent {
+    /**
+     * Name for the component used when initialising using data-module attributes.
+     */
+    static moduleName: string;
+    /**
+     * Notification banner default config
+     *
+     * @see {@link NotificationBannerConfig}
+     * @constant
+     * @type {NotificationBannerConfig}
+     */
+    static defaults: NotificationBannerConfig;
+    /**
+     * @param {Element | null} $module - HTML element to use for notification banner
+     * @param {NotificationBannerConfig} [config] - Notification banner config
+     */
+    constructor($module: Element | null, config?: NotificationBannerConfig | undefined);
+    /** @private */
+    private $module;
+    /**
+     * @private
+     * @type {NotificationBannerConfig}
+     */
+    private config;
+}
+/**
+ * Notification banner config
+ */
+export type NotificationBannerConfig = {
+    /**
+     * - If set to `true` the
+     * notification banner will not be focussed when the page loads. This only
+     * applies if the component has a `role` of `alert` – in other cases the
+     * component will not be focused on page load, regardless of this option.
+     */
+    disableAutoFocus?: boolean | undefined;
+};
+import { GOVUKFrontendComponent } from '../../govuk-frontend-component.mjs';
diff --git a/packages/govuk-frontend/dist/govuk/components/radios/radios.d.mts b/packages/govuk-frontend/dist/govuk/components/radios/radios.d.mts
new file mode 100644
index 000000000..3901263f8
--- /dev/null
+++ b/packages/govuk-frontend/dist/govuk/components/radios/radios.d.mts
@@ -0,0 +1,59 @@
+/**
+ * Radios component
+ *
+ * @preserve
+ */
+export class Radios extends GOVUKFrontendComponent {
+    /**
+     * Name for the component used when initialising using data-module attributes.
+     */
+    static moduleName: string;
+    /**
+     * Radios can be associated with a 'conditionally revealed' content block –
+     * for example, a radio for 'Phone' could reveal an additional form field for
+     * the user to enter their phone number.
+     *
+     * These associations are made using a `data-aria-controls` attribute, which
+     * is promoted to an aria-controls attribute during initialisation.
+     *
+     * We also need to restore the state of any conditional reveals on the page
+     * (for example if the user has navigated back), and set up event handlers to
+     * keep the reveal in sync with the radio state.
+     *
+     * @param {Element | null} $module - HTML element to use for radios
+     */
+    constructor($module: Element | null);
+    /** @private */
+    private $module;
+    /** @private */
+    private $inputs;
+    /**
+     * Sync the conditional reveal states for all radio buttons in this $module.
+     *
+     * @private
+     */
+    private syncAllConditionalReveals;
+    /**
+     * Sync conditional reveal with the input state
+     *
+     * Synchronise the visibility of the conditional reveal, and its accessible
+     * state, with the input's checked state.
+     *
+     * @private
+     * @param {HTMLInputElement} $input - Radio input
+     */
+    private syncConditionalRevealWithInputState;
+    /**
+     * Click event handler
+     *
+     * Handle a click within the $module – if the click occurred on a radio, sync
+     * the state of the conditional reveal for all radio buttons in the same form
+     * with the same name (because checking one radio could have un-checked a
+     * radio in another $module)
+     *
+     * @private
+     * @param {MouseEvent} event - Click event
+     */
+    private handleClick;
+}
+import { GOVUKFrontendComponent } from '../../govuk-frontend-component.mjs';
diff --git a/packages/govuk-frontend/dist/govuk/components/skip-link/skip-link.d.mts b/packages/govuk-frontend/dist/govuk/components/skip-link/skip-link.d.mts
new file mode 100644
index 000000000..4ed8d45bd
--- /dev/null
+++ b/packages/govuk-frontend/dist/govuk/components/skip-link/skip-link.d.mts
@@ -0,0 +1,21 @@
+/**
+ * Skip link component
+ *
+ * @preserve
+ */
+export class SkipLink extends GOVUKFrontendComponent {
+    /**
+     * Name for the component used when initialising using data-module attributes.
+     */
+    static moduleName: string;
+    /**
+     * @param {Element | null} $module - HTML element to use for skip link
+     * @throws {ElementError} when $module is not set or the wrong type
+     * @throws {ElementError} when $module.hash does not contain a hash
+     * @throws {ElementError} when the linked element is missing or the wrong type
+     */
+    constructor($module: Element | null);
+    /** @private */
+    private $module;
+}
+import { GOVUKFrontendComponent } from '../../govuk-frontend-component.mjs';
diff --git a/packages/govuk-frontend/dist/govuk/components/tabs/tabs.d.mts b/packages/govuk-frontend/dist/govuk/components/tabs/tabs.d.mts
new file mode 100644
index 000000000..f5b1d819a
--- /dev/null
+++ b/packages/govuk-frontend/dist/govuk/components/tabs/tabs.d.mts
@@ -0,0 +1,189 @@
+/**
+ * Tabs component
+ *
+ * @preserve
+ */
+export class Tabs extends GOVUKFrontendComponent {
+    /**
+     * Name for the component used when initialising using data-module attributes.
+     */
+    static moduleName: string;
+    /**
+     * @param {Element | null} $module - HTML element to use for tabs
+     */
+    constructor($module: Element | null);
+    /** @private */
+    private $module;
+    /** @private */
+    private $tabs;
+    /** @private */
+    private $tabList;
+    /** @private */
+    private $tabListItems;
+    /** @private */
+    private jsHiddenClass;
+    /** @private */
+    private changingHash;
+    /** @private */
+    private boundTabClick;
+    /** @private */
+    private boundTabKeydown;
+    /** @private */
+    private boundOnHashChange;
+    /**
+     * @private
+     * @type {MediaQueryList | null}
+     */
+    private mql;
+    /**
+     * Setup viewport resize check
+     *
+     * @private
+     */
+    private setupResponsiveChecks;
+    /**
+     * Setup or teardown handler for viewport resize check
+     *
+     * @private
+     */
+    private checkMode;
+    /**
+     * Setup tab component
+     *
+     * @private
+     */
+    private setup;
+    /**
+     * Teardown tab component
+     *
+     * @private
+     */
+    private teardown;
+    /**
+     * Handle hashchange event
+     *
+     * @private
+     * @returns {void | undefined} Returns void, or undefined when prevented
+     */
+    private onHashChange;
+    /**
+     * Hide panel for tab link
+     *
+     * @private
+     * @param {HTMLAnchorElement} $tab - Tab link
+     */
+    private hideTab;
+    /**
+     * Show panel for tab link
+     *
+     * @private
+     * @param {HTMLAnchorElement} $tab - Tab link
+     */
+    private showTab;
+    /**
+     * Get tab link by hash
+     *
+     * @private
+     * @param {string} hash - Hash fragment including #
+     * @returns {HTMLAnchorElement | null} Tab link
+     */
+    private getTab;
+    /**
+     * Set tab link and panel attributes
+     *
+     * @private
+     * @param {HTMLAnchorElement} $tab - Tab link
+     */
+    private setAttributes;
+    /**
+     * Unset tab link and panel attributes
+     *
+     * @private
+     * @param {HTMLAnchorElement} $tab - Tab link
+     */
+    private unsetAttributes;
+    /**
+     * Handle tab link clicks
+     *
+     * @private
+     * @param {MouseEvent} event - Mouse click event
+     * @returns {void} Returns void
+     */
+    private onTabClick;
+    /**
+     * Update browser URL hash fragment for tab
+     *
+     * - Allows back/forward to navigate tabs
+     * - Avoids page jump when hash changes
+     *
+     * @private
+     * @param {HTMLAnchorElement} $tab - Tab link
+     */
+    private createHistoryEntry;
+    /**
+     * Handle tab keydown event
+     *
+     * - Press right/down arrow for next tab
+     * - Press left/up arrow for previous tab
+     *
+     * @private
+     * @param {KeyboardEvent} event - Keydown event
+     */
+    private onTabKeydown;
+    /**
+     * Activate next tab
+     *
+     * @private
+     */
+    private activateNextTab;
+    /**
+     * Activate previous tab
+     *
+     * @private
+     */
+    private activatePreviousTab;
+    /**
+     * Get tab panel for tab link
+     *
+     * @private
+     * @param {HTMLAnchorElement} $tab - Tab link
+     * @returns {Element | null} Tab panel
+     */
+    private getPanel;
+    /**
+     * Show tab panel for tab link
+     *
+     * @private
+     * @param {HTMLAnchorElement} $tab - Tab link
+     */
+    private showPanel;
+    /**
+     * Hide tab panel for tab link
+     *
+     * @private
+     * @param {HTMLAnchorElement} $tab - Tab link
+     */
+    private hidePanel;
+    /**
+     * Unset 'selected' state for tab link
+     *
+     * @private
+     * @param {HTMLAnchorElement} $tab - Tab link
+     */
+    private unhighlightTab;
+    /**
+     * Set 'selected' state for tab link
+     *
+     * @private
+     * @param {HTMLAnchorElement} $tab - Tab link
+     */
+    private highlightTab;
+    /**
+     * Get current tab link
+     *
+     * @private
+     * @returns {HTMLAnchorElement | null} Tab link
+     */
+    private getCurrentTab;
+}
+import { GOVUKFrontendComponent } from '../../govuk-frontend-component.mjs';
diff --git a/packages/govuk-frontend/dist/govuk/errors/index.d.mts b/packages/govuk-frontend/dist/govuk/errors/index.d.mts
new file mode 100644
index 000000000..d22350614
--- /dev/null
+++ b/packages/govuk-frontend/dist/govuk/errors/index.d.mts
@@ -0,0 +1,76 @@
+/**
+ * GOV.UK Frontend error
+ *
+ * A base class for `Error`s thrown by GOV.UK Frontend.
+ *
+ * It is meant to be extended into specific types of errors
+ * to be thrown by our code.
+ *
+ * @example
+ * ```js
+ * class MissingRootError extends GOVUKFrontendError {
+ *   // Setting an explicit name is important as extending the class will not
+ *   // set a new `name` on the subclass. The `name` property is important
+ *   // to ensure intelligible error names even if the class name gets
+ *   // mangled by a minifier
+ *   name = "MissingRootError"
+ * }
+ * ```
+ * @abstract
+ */
+export class GOVUKFrontendError extends Error {
+}
+/**
+ * Indicates that GOV.UK Frontend is not supported
+ */
+export class SupportError extends GOVUKFrontendError {
+    /**
+     * Checks if GOV.UK Frontend is supported on this page
+     *
+     * @param {HTMLElement | null} [$scope] - HTML element `<body>` checked for browser support
+     */
+    constructor($scope?: HTMLElement | null | undefined);
+}
+/**
+ * Indicates that a component has received an illegal configuration
+ */
+export class ConfigError extends GOVUKFrontendError {
+}
+/**
+ * Indicates an issue with an element (possibly `null` or `undefined`)
+ */
+export class ElementError extends GOVUKFrontendError {
+    /**
+     * @internal
+     * @overload
+     * @param {string} message - Element error message
+     */
+    constructor(message: string);
+    /**
+     * @internal
+     * @overload
+     * @param {ElementErrorOptions} options - Element error options
+     */
+    constructor(options: ElementErrorOptions);
+}
+/**
+ * Element error options
+ */
+export type ElementErrorOptions = {
+    /**
+     * - The name of the component throwing the error
+     */
+    componentName: string;
+    /**
+     * - An identifier that'll let the user understand which element has an error. This is whatever makes the most sense
+     */
+    identifier: string;
+    /**
+     * - The element in error
+     */
+    element?: Element | null | undefined;
+    /**
+     * - The type that was expected for the identifier
+     */
+    expectedType?: string | undefined;
+};
diff --git a/packages/govuk-frontend/dist/govuk/govuk-frontend-component.d.mts b/packages/govuk-frontend/dist/govuk/govuk-frontend-component.d.mts
new file mode 100644
index 000000000..5abec9edb
--- /dev/null
+++ b/packages/govuk-frontend/dist/govuk/govuk-frontend-component.d.mts
@@ -0,0 +1,17 @@
+/**
+ * Base Component class
+ *
+ * Centralises the behaviours shared by our components
+ *
+ * @internal
+ * @abstract
+ */
+export class GOVUKFrontendComponent {
+    /**
+     * Validates whether GOV.UK Frontend is supported
+     *
+     * @private
+     * @throws {SupportError} when GOV.UK Frontend is not supported
+     */
+    private checkSupport;
+}
diff --git a/packages/govuk-frontend/dist/govuk/i18n.d.mts b/packages/govuk-frontend/dist/govuk/i18n.d.mts
new file mode 100644
index 000000000..90829b603
--- /dev/null
+++ b/packages/govuk-frontend/dist/govuk/i18n.d.mts
@@ -0,0 +1,192 @@
+/**
+ * Internal support for selecting messages to render, with placeholder
+ * interpolation and locale-aware number formatting and pluralisation
+ *
+ * @internal
+ */
+export class I18n {
+    /**
+     * Map of plural rules to languages where those rules apply.
+     *
+     * Note: These groups are named for the most dominant or recognisable language
+     * that uses each system. The groupings do not imply that the languages are
+     * related to one another. Many languages have evolved the same systems
+     * independently of one another.
+     *
+     * Code to support more languages can be found in the i18n spike:
+     * {@link https://github.com/alphagov/govuk-frontend/blob/spike-i18n-support/src/govuk/i18n.mjs}
+     *
+     * Languages currently supported:
+     *
+     * Arabic: Arabic (ar)
+     * Chinese: Burmese (my), Chinese (zh), Indonesian (id), Japanese (ja),
+     *   Javanese (jv), Korean (ko), Malay (ms), Thai (th), Vietnamese (vi)
+     * French: Armenian (hy), Bangla (bn), French (fr), Gujarati (gu), Hindi (hi),
+     *   Persian Farsi (fa), Punjabi (pa), Zulu (zu)
+     * German: Afrikaans (af), Albanian (sq), Azerbaijani (az), Basque (eu),
+     *   Bulgarian (bg), Catalan (ca), Danish (da), Dutch (nl), English (en),
+     *   Estonian (et), Finnish (fi), Georgian (ka), German (de), Greek (el),
+     *   Hungarian (hu), Luxembourgish (lb), Norwegian (no), Somali (so),
+     *   Swahili (sw), Swedish (sv), Tamil (ta), Telugu (te), Turkish (tr),
+     *   Urdu (ur)
+     * Irish: Irish Gaelic (ga)
+     * Russian: Russian (ru), Ukrainian (uk)
+     * Scottish: Scottish Gaelic (gd)
+     * Spanish: European Portuguese (pt-PT), Italian (it), Spanish (es)
+     * Welsh: Welsh (cy)
+     *
+     * @internal
+     * @type {{ [key: string]: string[] }}
+     */
+    static pluralRulesMap: {
+        [key: string]: string[];
+    };
+    /**
+     * Different pluralisation rule sets
+     *
+     * Returns the appropriate suffix for the plural form associated with `n`.
+     * Possible suffixes: 'zero', 'one', 'two', 'few', 'many', 'other' (the actual
+     * meaning of each differs per locale). 'other' should always exist, even in
+     * languages without plurals, such as Chinese.
+     * {@link https://cldr.unicode.org/index/cldr-spec/plural-rules}
+     *
+     * The count must be a positive integer. Negative numbers and decimals aren't accounted for
+     *
+     * @internal
+     * @type {{ [key: string]: (count: number) => PluralRule }}
+     */
+    static pluralRules: {
+        [key: string]: (count: number) => PluralRule;
+    };
+    /**
+     * @internal
+     * @param {{ [key: string]: unknown }} translations - Key-value pairs of the translation strings to use.
+     * @param {object} [config] - Configuration options for the function.
+     * @param {string | null} [config.locale] - An overriding locale for the PluralRules functionality.
+     */
+    constructor(translations?: {
+        [key: string]: unknown;
+    }, config?: {
+        locale?: string | null | undefined;
+    } | undefined);
+    translations: {
+        [key: string]: unknown;
+    };
+    locale: string;
+    /**
+     * The most used function - takes the key for a given piece of UI text and
+     * returns the appropriate string.
+     *
+     * @internal
+     * @param {string} lookupKey - The lookup key of the string to use.
+     * @param {{ [key: string]: unknown }} [options] - Any options passed with the translation string, e.g: for string interpolation.
+     * @returns {string} The appropriate translation string.
+     * @throws {Error} Lookup key required
+     * @throws {Error} Options required for `${}` placeholders
+     */
+    t(lookupKey: string, options?: {
+        [key: string]: unknown;
+    } | undefined): string;
+    /**
+     * Takes a translation string with placeholders, and replaces the placeholders
+     * with the provided data
+     *
+     * @internal
+     * @param {string} translationString - The translation string
+     * @param {{ [key: string]: unknown }} options - Any options passed with the translation string, e.g: for string interpolation.
+     * @returns {string} The translation string to output, with $\{\} placeholders replaced
+     */
+    replacePlaceholders(translationString: string, options: {
+        [key: string]: unknown;
+    }): string;
+    /**
+     * Check to see if the browser supports Intl.PluralRules
+     *
+     * It requires all conditions to be met in order to be supported:
+     * - The implementation of Intl supports PluralRules (NOT true in Safari 10–12)
+     * - The browser/OS has plural rules for the current locale (browser dependent)
+     *
+     * {@link https://browsersl.ist/#q=supports+es6-module+and+not+supports+intl-pluralrules}
+     *
+     * @internal
+     * @returns {boolean} Returns true if all conditions are met. Returns false otherwise.
+     */
+    hasIntlPluralRulesSupport(): boolean;
+    /**
+     * Get the appropriate suffix for the plural form.
+     *
+     * Uses Intl.PluralRules (or our own fallback implementation) to get the
+     * 'preferred' form to use for the given count.
+     *
+     * Checks that a translation has been provided for that plural form – if it
+     * hasn't, it'll fall back to the 'other' plural form (unless that doesn't exist
+     * either, in which case an error will be thrown)
+     *
+     * @internal
+     * @param {string} lookupKey - The lookup key of the string to use.
+     * @param {number} count - Number used to determine which pluralisation to use.
+     * @returns {PluralRule} The suffix associated with the correct pluralisation for this locale.
+     * @throws {Error} Plural form `.other` required when preferred plural form is missing
+     */
+    getPluralSuffix(lookupKey: string, count: number): PluralRule;
+    /**
+     * Get the plural form using our fallback implementation
+     *
+     * This is split out into a separate function to make it easier to test the
+     * fallback behaviour in an environment where Intl.PluralRules exists.
+     *
+     * @internal
+     * @param {number} count - Number used to determine which pluralisation to use.
+     * @returns {PluralRule} The pluralisation form for count in this locale.
+     */
+    selectPluralFormUsingFallbackRules(count: number): PluralRule;
+    /**
+     * Work out which pluralisation rules to use for the current locale
+     *
+     * The locale may include a regional indicator (such as en-GB), but we don't
+     * usually care about this part, as pluralisation rules are usually the same
+     * regardless of region. There are exceptions, however, (e.g. Portuguese) so
+     * this searches by both the full and shortened locale codes, just to be sure.
+     *
+     * @internal
+     * @returns {string | undefined} The name of the pluralisation rule to use (a key for one
+     *   of the functions in this.pluralRules)
+     */
+    getPluralRulesForLocale(): string | undefined;
+}
+/**
+ * Plural rule category mnemonic tags
+ */
+export type PluralRule = 'zero' | 'one' | 'two' | 'few' | 'many' | 'other';
+/**
+ * Translated message by plural rule they correspond to.
+ *
+ * Allows to group pluralised messages under a single key when passing
+ * translations to a component's constructor
+ */
+export type TranslationPluralForms = {
+    /**
+     * - General plural form
+     */
+    other?: string | undefined;
+    /**
+     * - Plural form used with 0
+     */
+    zero?: string | undefined;
+    /**
+     * - Plural form used with 1
+     */
+    one?: string | undefined;
+    /**
+     * - Plural form used with 2
+     */
+    two?: string | undefined;
+    /**
+     * - Plural form used for a few
+     */
+    few?: string | undefined;
+    /**
+     * - Plural form used for many
+     */
+    many?: string | undefined;
+};

Action run for f15d73d

Base automatically changed from build-dist-diff to main November 30, 2023 13:47
@govuk-design-system-ci govuk-design-system-ci temporarily deployed to govuk-frontend-pr-4094 March 8, 2024 15:49 Inactive
@querkmachine
Copy link
Member

We're still interested in shipping proper type definitions in the future, but this work isn't in our team roadmap for the immediate future.

As such, I'm closing this off for housekeeping purposes. Happy to hear more thoughts and feedback on the issue, however: #2835

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Export type declarations for component source code
3 participants