@hmlr/govuk-react-components-library 1.0.1

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 (203) hide show
  1. package/.nvmrc +1 -0
  2. package/.stylelintrc.json +8 -0
  3. package/LICENCE +21 -0
  4. package/README.md +636 -0
  5. package/assets/Advance-submodule-behaviours.png +0 -0
  6. package/assets/logo.png +0 -0
  7. package/assets/uml-diagram.svg +2541 -0
  8. package/bundle-analysis-main.html +4951 -0
  9. package/bundle-analysis-pdfvc.html +4949 -0
  10. package/dist/PDFViewerCanvas.cjs.css +86 -0
  11. package/dist/PDFViewerCanvas.cjs.js +243 -0
  12. package/dist/PDFViewerCanvas.cjs.js.map +1 -0
  13. package/dist/PDFViewerCanvas.d.ts +19 -0
  14. package/dist/PDFViewerCanvas.esm.css +86 -0
  15. package/dist/PDFViewerCanvas.esm.js +241 -0
  16. package/dist/PDFViewerCanvas.esm.js.map +1 -0
  17. package/dist/index.cjs.css +11962 -0
  18. package/dist/index.cjs.js +1362 -0
  19. package/dist/index.cjs.js.map +1 -0
  20. package/dist/index.d.ts +743 -0
  21. package/dist/index.esm.css +11962 -0
  22. package/dist/index.esm.js +1284 -0
  23. package/dist/index.esm.js.map +1 -0
  24. package/dist/types/JestSetup.d.ts +1 -0
  25. package/dist/types/PDFViewerCanvas.d.ts +1 -0
  26. package/dist/types/components/Accordion/Accordion.config.d.ts +5 -0
  27. package/dist/types/components/Accordion/Accordion.d.ts +4 -0
  28. package/dist/types/components/Accordion/Accordion.types.d.ts +20 -0
  29. package/dist/types/components/Accordion/index.d.ts +2 -0
  30. package/dist/types/components/ActionLink/ActionLink.d.ts +4 -0
  31. package/dist/types/components/ActionLink/ActionLink.types.d.ts +13 -0
  32. package/dist/types/components/ActionLink/index.d.ts +1 -0
  33. package/dist/types/components/BackLink/BackLink.d.ts +4 -0
  34. package/dist/types/components/BackLink/BackLink.types.d.ts +9 -0
  35. package/dist/types/components/BackLink/index.d.ts +1 -0
  36. package/dist/types/components/Boolean/Boolean.d.ts +4 -0
  37. package/dist/types/components/Boolean/Boolean.types.d.ts +39 -0
  38. package/dist/types/components/Boolean/OmitKey.d.ts +5 -0
  39. package/dist/types/components/Boolean/index.d.ts +1 -0
  40. package/dist/types/components/Breadcrumbs/Breadcrumbs.d.ts +4 -0
  41. package/dist/types/components/Breadcrumbs/Breadcrumbs.types.d.ts +13 -0
  42. package/dist/types/components/Breadcrumbs/index.d.ts +1 -0
  43. package/dist/types/components/Button/Button.config.d.ts +2 -0
  44. package/dist/types/components/Button/Button.d.ts +4 -0
  45. package/dist/types/components/Button/Button.types.d.ts +13 -0
  46. package/dist/types/components/Button/index.d.ts +2 -0
  47. package/dist/types/components/CardColumn/CardColumn.d.ts +5 -0
  48. package/dist/types/components/CardColumn/CardColumn.types.d.ts +5 -0
  49. package/dist/types/components/CardColumn/index.d.ts +1 -0
  50. package/dist/types/components/CardLayout/CardLayout.d.ts +4 -0
  51. package/dist/types/components/CardLayout/CardLayout.types.d.ts +5 -0
  52. package/dist/types/components/CardLayout/index.d.ts +1 -0
  53. package/dist/types/components/CharacterCount/CharacterCount.config.d.ts +2 -0
  54. package/dist/types/components/CharacterCount/CharacterCount.d.ts +4 -0
  55. package/dist/types/components/CharacterCount/CharacterCount.types.d.ts +12 -0
  56. package/dist/types/components/CharacterCount/index.d.ts +1 -0
  57. package/dist/types/components/Checkboxes/Checkboxes.config.d.ts +1 -0
  58. package/dist/types/components/Checkboxes/Checkboxes.d.ts +4 -0
  59. package/dist/types/components/Checkboxes/Checkboxes.types.d.ts +3 -0
  60. package/dist/types/components/Checkboxes/index.d.ts +2 -0
  61. package/dist/types/components/CookieBanner/CookieBanner.d.ts +4 -0
  62. package/dist/types/components/CookieBanner/CookieBanner.types.d.ts +21 -0
  63. package/dist/types/components/CookieBanner/index.d.ts +1 -0
  64. package/dist/types/components/DataNavigation/DataNavigation.d.ts +4 -0
  65. package/dist/types/components/DataNavigation/DataNavigation.types.d.ts +9 -0
  66. package/dist/types/components/DataNavigation/index.d.ts +1 -0
  67. package/dist/types/components/DateInput/DateInput.d.ts +4 -0
  68. package/dist/types/components/DateInput/DateInput.types.d.ts +29 -0
  69. package/dist/types/components/DateInput/index.d.ts +1 -0
  70. package/dist/types/components/Details/Details.d.ts +4 -0
  71. package/dist/types/components/Details/Details.types.d.ts +5 -0
  72. package/dist/types/components/Details/index.d.ts +1 -0
  73. package/dist/types/components/DifferenceNavigation/DifferenceNavigation.d.ts +4 -0
  74. package/dist/types/components/DifferenceNavigation/DifferenceNavigation.types.d.ts +7 -0
  75. package/dist/types/components/DifferenceNavigation/index.d.ts +1 -0
  76. package/dist/types/components/ErrorBoundary/ErrorBoundary.d.ts +9 -0
  77. package/dist/types/components/ErrorBoundary/ErrorBoundary.types.d.ts +11 -0
  78. package/dist/types/components/ErrorBoundary/index.d.ts +1 -0
  79. package/dist/types/components/ErrorMessage/ErrorMessage.d.ts +4 -0
  80. package/dist/types/components/ErrorMessage/ErrorMessage.types.d.ts +6 -0
  81. package/dist/types/components/ErrorMessage/index.d.ts +1 -0
  82. package/dist/types/components/ErrorSummary/ErrorSummary.config.d.ts +2 -0
  83. package/dist/types/components/ErrorSummary/ErrorSummary.d.ts +4 -0
  84. package/dist/types/components/ErrorSummary/ErrorSummary.types.d.ts +13 -0
  85. package/dist/types/components/ErrorSummary/index.d.ts +2 -0
  86. package/dist/types/components/Fieldset/Fieldset.d.ts +4 -0
  87. package/dist/types/components/Fieldset/Fieldset.types.d.ts +12 -0
  88. package/dist/types/components/Fieldset/index.d.ts +1 -0
  89. package/dist/types/components/FileUpload/FileUpload.d.ts +4 -0
  90. package/dist/types/components/FileUpload/FileUpload.types.d.ts +15 -0
  91. package/dist/types/components/FileUpload/index.d.ts +1 -0
  92. package/dist/types/components/Footer/Footer.d.ts +4 -0
  93. package/dist/types/components/Footer/Footer.types.d.ts +33 -0
  94. package/dist/types/components/Footer/index.d.ts +1 -0
  95. package/dist/types/components/Header/Header.config.d.ts +1 -0
  96. package/dist/types/components/Header/Header.d.ts +4 -0
  97. package/dist/types/components/Header/Header.types.d.ts +28 -0
  98. package/dist/types/components/Header/index.d.ts +2 -0
  99. package/dist/types/components/Hint/Hint.d.ts +4 -0
  100. package/dist/types/components/Hint/Hint.types.d.ts +4 -0
  101. package/dist/types/components/Hint/index.d.ts +1 -0
  102. package/dist/types/components/Input/Input.d.ts +4 -0
  103. package/dist/types/components/Input/Input.types.d.ts +22 -0
  104. package/dist/types/components/Input/index.d.ts +1 -0
  105. package/dist/types/components/InsetText/InsetText.d.ts +4 -0
  106. package/dist/types/components/InsetText/InsetText.types.d.ts +4 -0
  107. package/dist/types/components/InsetText/index.d.ts +1 -0
  108. package/dist/types/components/Label/Label.d.ts +4 -0
  109. package/dist/types/components/Label/Label.types.d.ts +6 -0
  110. package/dist/types/components/Label/index.d.ts +1 -0
  111. package/dist/types/components/Landing/Landing.d.ts +4 -0
  112. package/dist/types/components/Landing/Landing.types.d.ts +4 -0
  113. package/dist/types/components/Landing/index.d.ts +1 -0
  114. package/dist/types/components/LinkWithRef/LinkWithRef.d.ts +4 -0
  115. package/dist/types/components/LinkWithRef/LinkWithRef.types.d.ts +9 -0
  116. package/dist/types/components/LinkWithRef/index.d.ts +1 -0
  117. package/dist/types/components/Loading/Loading.d.ts +5 -0
  118. package/dist/types/components/Loading/Loading.types.d.ts +4 -0
  119. package/dist/types/components/Loading/index.d.ts +1 -0
  120. package/dist/types/components/Main/Main.d.ts +4 -0
  121. package/dist/types/components/Main/Main.types.d.ts +5 -0
  122. package/dist/types/components/Main/index.d.ts +1 -0
  123. package/dist/types/components/NotFoundPage/NotFoundPage.d.ts +3 -0
  124. package/dist/types/components/NotFoundPage/index.d.ts +1 -0
  125. package/dist/types/components/NotificationBanner/NotificationBanner.config.d.ts +2 -0
  126. package/dist/types/components/NotificationBanner/NotificationBanner.d.ts +4 -0
  127. package/dist/types/components/NotificationBanner/NotificationBanner.types.d.ts +12 -0
  128. package/dist/types/components/NotificationBanner/index.d.ts +1 -0
  129. package/dist/types/components/PDFViewer/ObjectToQueryString.d.ts +1 -0
  130. package/dist/types/components/PDFViewer/PDFViewer.d.ts +4 -0
  131. package/dist/types/components/PDFViewer/PDFViewer.types.d.ts +25 -0
  132. package/dist/types/components/PDFViewer/PDFViewerBackend.d.ts +2 -0
  133. package/dist/types/components/PDFViewer/ResolvePDFSource.d.ts +4 -0
  134. package/dist/types/components/PDFViewer/Slugify.d.ts +1 -0
  135. package/dist/types/components/PDFViewer/index.d.ts +2 -0
  136. package/dist/types/components/PDFViewer/testutilities/SampleBase64.d.ts +44 -0
  137. package/dist/types/components/PDFViewerCanvas/PDFViewerCanvas.d.ts +9 -0
  138. package/dist/types/components/PDFViewerCanvas/PDFViewerCanvas.types.d.ts +8 -0
  139. package/dist/types/components/PDFViewerCanvas/index.d.ts +1 -0
  140. package/dist/types/components/Pagination/NavigationButton.d.ts +3 -0
  141. package/dist/types/components/Pagination/Pagination.d.ts +4 -0
  142. package/dist/types/components/Pagination/Pagination.types.d.ts +22 -0
  143. package/dist/types/components/Pagination/SvgIcon.d.ts +3 -0
  144. package/dist/types/components/Pagination/UsePagination.d.ts +9 -0
  145. package/dist/types/components/Pagination/index.d.ts +1 -0
  146. package/dist/types/components/Panel/Panel.d.ts +4 -0
  147. package/dist/types/components/Panel/Panel.types.d.ts +7 -0
  148. package/dist/types/components/Panel/index.d.ts +1 -0
  149. package/dist/types/components/PhaseBanner/PhaseBanner.d.ts +4 -0
  150. package/dist/types/components/PhaseBanner/PhaseBanner.types.d.ts +6 -0
  151. package/dist/types/components/PhaseBanner/index.d.ts +1 -0
  152. package/dist/types/components/ProblemWithService/ProblemWithService.d.ts +4 -0
  153. package/dist/types/components/ProblemWithService/ProblemWithService.types.d.ts +7 -0
  154. package/dist/types/components/ProblemWithService/index.d.ts +1 -0
  155. package/dist/types/components/Radios/Radios.config.d.ts +1 -0
  156. package/dist/types/components/Radios/Radios.d.ts +4 -0
  157. package/dist/types/components/Radios/Radios.types.d.ts +7 -0
  158. package/dist/types/components/Radios/index.d.ts +2 -0
  159. package/dist/types/components/Select/Select.d.ts +4 -0
  160. package/dist/types/components/Select/Select.types.d.ts +21 -0
  161. package/dist/types/components/Select/index.d.ts +1 -0
  162. package/dist/types/components/ServiceNavigation/ServiceNavigation.d.ts +4 -0
  163. package/dist/types/components/ServiceNavigation/ServiceNavigation.types.d.ts +21 -0
  164. package/dist/types/components/ServiceNavigation/index.d.ts +1 -0
  165. package/dist/types/components/SkipLink/SkipLink.config.d.ts +1 -0
  166. package/dist/types/components/SkipLink/SkipLink.d.ts +4 -0
  167. package/dist/types/components/SkipLink/SkipLink.types.d.ts +5 -0
  168. package/dist/types/components/SkipLink/index.d.ts +2 -0
  169. package/dist/types/components/SummaryList/SummaryList.d.ts +4 -0
  170. package/dist/types/components/SummaryList/SummaryList.types.d.ts +22 -0
  171. package/dist/types/components/SummaryList/index.d.ts +1 -0
  172. package/dist/types/components/Table/Table.d.ts +4 -0
  173. package/dist/types/components/Table/Table.types.d.ts +21 -0
  174. package/dist/types/components/Table/index.d.ts +1 -0
  175. package/dist/types/components/Tabs/Tabs.config.d.ts +1 -0
  176. package/dist/types/components/Tabs/Tabs.d.ts +4 -0
  177. package/dist/types/components/Tabs/Tabs.types.d.ts +14 -0
  178. package/dist/types/components/Tabs/index.d.ts +2 -0
  179. package/dist/types/components/Tag/Tag.d.ts +4 -0
  180. package/dist/types/components/Tag/Tag.types.d.ts +4 -0
  181. package/dist/types/components/Tag/index.d.ts +1 -0
  182. package/dist/types/components/TaskList/TaskList.d.ts +4 -0
  183. package/dist/types/components/TaskList/TaskList.types.d.ts +21 -0
  184. package/dist/types/components/TaskList/index.d.ts +1 -0
  185. package/dist/types/components/Textarea/Textarea.d.ts +4 -0
  186. package/dist/types/components/Textarea/Textarea.types.d.ts +14 -0
  187. package/dist/types/components/Textarea/index.d.ts +1 -0
  188. package/dist/types/components/WarningInfo/WarningInfo.d.ts +4 -0
  189. package/dist/types/components/WarningInfo/WarningInfo.types.d.ts +8 -0
  190. package/dist/types/components/WarningInfo/index.d.ts +1 -0
  191. package/dist/types/components/WarningText/WarningText.d.ts +4 -0
  192. package/dist/types/components/WarningText/WarningText.types.d.ts +4 -0
  193. package/dist/types/components/WarningText/index.d.ts +1 -0
  194. package/dist/types/components/index.d.ts +49 -0
  195. package/dist/types/dynamics/index.d.ts +3 -0
  196. package/dist/types/dynamics/types.d.ts +37 -0
  197. package/dist/types/index.d.ts +1 -0
  198. package/dist/types/utils/ProcessExampleData.d.ts +3 -0
  199. package/dist/types/utils/StoriesFromFixtures.d.ts +5 -0
  200. package/dist/types/utils/TitleCase.d.ts +2 -0
  201. package/dist/types/utils/WithReference.d.ts +5 -0
  202. package/dist/types/utils/WithReference.types.d.ts +10 -0
  203. package/package.json +180 -0
@@ -0,0 +1,1284 @@
1
+ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
2
+ import { Accordion as Accordion$1, createAll, Button as Button$1, Checkboxes as Checkboxes$1, ErrorSummary as ErrorSummary$1, Header as Header$1, Radios as Radios$1, SkipLink as SkipLink$1, Tabs as Tabs$1 } from 'govuk-frontend';
3
+ import { Link, useLocation } from 'react-router-dom';
4
+ import * as React from 'react';
5
+ import React__default, { useContext, useMemo, createElement, Component, useState, useEffect } from 'react';
6
+
7
+ function ConfigureOverallAccordion($scope, config) {
8
+ if (JSON.stringify(config) === JSON.stringify({})) {
9
+ config = Accordion$1.defaults;
10
+ }
11
+ createAll(Accordion$1, config, $scope);
12
+ }
13
+ function ExtractAccordionConfigFromAttributes(remainingAttributes) {
14
+ const accordionTranslations = {};
15
+ if (remainingAttributes?.hideAllSectionsText) {
16
+ Object.assign(accordionTranslations, {
17
+ hideAllSections: remainingAttributes.hideAllSectionsText,
18
+ });
19
+ remainingAttributes["data-i18n.hide-all-sections"] =
20
+ remainingAttributes.hideAllSectionsText;
21
+ delete remainingAttributes.hideAllSectionsText;
22
+ }
23
+ if (remainingAttributes?.hideSectionText) {
24
+ Object.assign(accordionTranslations, {
25
+ hideSection: remainingAttributes.hideSectionText,
26
+ });
27
+ remainingAttributes["data-i18n.hide-section"] =
28
+ remainingAttributes.hideSectionText;
29
+ delete remainingAttributes.hideSectionText;
30
+ }
31
+ if (remainingAttributes?.hideSectionAriaLabelText) {
32
+ Object.assign(accordionTranslations, {
33
+ hideSectionAriaLabel: remainingAttributes.hideSectionAriaLabelText,
34
+ });
35
+ remainingAttributes["data-i18n.hide-section-aria-label"] =
36
+ remainingAttributes.hideSectionAriaLabelText;
37
+ delete remainingAttributes.hideSectionAriaLabelText;
38
+ }
39
+ if (remainingAttributes?.showAllSectionsText) {
40
+ Object.assign(accordionTranslations, {
41
+ showAllSections: remainingAttributes.showAllSectionsText,
42
+ });
43
+ remainingAttributes["data-i18n.show-all-sections"] =
44
+ remainingAttributes.showAllSectionsText;
45
+ delete remainingAttributes.showAllSectionsText;
46
+ }
47
+ if (remainingAttributes?.showSectionText) {
48
+ Object.assign(accordionTranslations, {
49
+ showSection: remainingAttributes.showSectionText,
50
+ });
51
+ remainingAttributes["data-i18n.show-section"] =
52
+ remainingAttributes.showSectionText;
53
+ delete remainingAttributes.showSectionText;
54
+ }
55
+ if (remainingAttributes?.showSectionAriaLabelText) {
56
+ Object.assign(accordionTranslations, {
57
+ showSectionAriaLabel: remainingAttributes.showSectionAriaLabelText,
58
+ });
59
+ remainingAttributes["data-i18n.show-section-aria-label"] =
60
+ remainingAttributes.showSectionAriaLabelText;
61
+ delete remainingAttributes.showSectionAriaLabelText;
62
+ }
63
+ const accordionConfig = { i18n: accordionTranslations };
64
+ if (remainingAttributes?.rememberExpanded) {
65
+ Object.assign(accordionConfig, {
66
+ rememberExpanded: remainingAttributes.rememberExpanded,
67
+ });
68
+ remainingAttributes["data-remember-expanded"] =
69
+ remainingAttributes.rememberExpanded;
70
+ delete remainingAttributes.rememberExpanded;
71
+ }
72
+ return accordionConfig;
73
+ }
74
+
75
+ const Accordion = ({ headingLevel: HeadingLevel = "h2", items, className, id, ...attributes }) => {
76
+ const remainingAttributes = { ...attributes };
77
+ ExtractAccordionConfigFromAttributes(remainingAttributes);
78
+ return (jsx("div", { ...remainingAttributes, id: id, className: `govuk-accordion ${className || ""}`, "data-module": "govuk-accordion", children: items.filter(Boolean).map((item, index) => (jsxs("div", { className: `govuk-accordion__section ${item.expanded ? "govuk-accordion__section--expanded" : ""}`, children: [jsxs("div", { className: "govuk-accordion__section-header", children: [jsx(HeadingLevel, { className: "govuk-accordion__section-heading", children: jsx("span", { className: "govuk-accordion__section-button", id: `${id}-heading-${index + 1}`, children: item.heading.children }) }), item.summary && (jsx("div", { className: "govuk-accordion__section-summary govuk-body", id: `${id}-summary-${index + 1}`, children: item.summary.children }))] }), jsx("div", { id: `${id}-content-${index + 1}`, className: "govuk-accordion__section-content", "aria-labelledby": `${id}-heading-${index + 1}`, children: item.content.children })] }, item.reactListKey || index))) }));
79
+ };
80
+
81
+ const LinkWithRef = ({ children, to, href, forwardedRef = null, ...attributes }) => {
82
+ if (to) {
83
+ return (jsx(Link, { ref: forwardedRef, to: to, ...attributes, children: children }));
84
+ }
85
+ return (jsx("a", { ref: forwardedRef, href: href || "#", ...attributes, children: children }));
86
+ };
87
+
88
+ const ActionLink = (props) => {
89
+ const { children, visuallyHiddenText, className, href, to, ...attributes } = props;
90
+ const contents = (jsxs(Fragment, { children: [children, visuallyHiddenText && (jsx("span", { className: "govuk-visually-hidden", children: visuallyHiddenText }))] }));
91
+ return (jsx(LinkWithRef, { className: `govuk-link ${className || ""}`, to: to, href: href, ...attributes, children: contents }));
92
+ };
93
+
94
+ const BackLink = (props) => {
95
+ const { to, state, children = "Back", className, ...attributes } = props;
96
+ return (jsx(LinkWithRef, { className: `govuk-back-link back-link-style-override ${className || ""}`, to: to, state: state, ...attributes, children: children }));
97
+ };
98
+
99
+ const ErrorMessage = ({ className, children, visuallyHiddenText = "Error", ...attributes }) => {
100
+ let visuallyHiddenTextComponent = null;
101
+ if (visuallyHiddenText) {
102
+ visuallyHiddenTextComponent = (jsxs("span", { className: "govuk-visually-hidden", children: [visuallyHiddenText, ": "] }));
103
+ }
104
+ return (jsxs("p", { className: `govuk-error-message ${className || ""}`, ...attributes, children: [visuallyHiddenTextComponent, children] }));
105
+ };
106
+
107
+ const Fieldset = (props) => {
108
+ const { legend, className, children, ...attributes } = props;
109
+ let legendComponent;
110
+ if (legend && legend.children) {
111
+ legendComponent = (jsx("legend", { className: `govuk-fieldset__legend ${legend.className || ""}`, children: legend.isPageHeading ? (jsx("h1", { className: "govuk-fieldset__heading", children: legend.children })) : (legend.children) }));
112
+ }
113
+ return (jsxs("fieldset", { className: `govuk-fieldset ${className || ""}`, ...attributes, children: [legendComponent, children] }));
114
+ };
115
+
116
+ const Hint = (props) => {
117
+ const { className, children, ...attributes } = props;
118
+ return (jsx("div", { className: `govuk-hint ${className || ""}`, ...attributes, children: children }));
119
+ };
120
+
121
+ const Label = ({ className = "", htmlFor, children, isPageHeading, ...attributes }) => {
122
+ if (!children)
123
+ return null;
124
+ const label = (jsx("label", { className: `govuk-label ${className}`, htmlFor: htmlFor, ...attributes, children: children }));
125
+ return isPageHeading ? (jsx("h1", { className: "govuk-label-wrapper", children: label })) : (label);
126
+ };
127
+
128
+ function omit(object, key) {
129
+ if (!object)
130
+ return {}; // Return an empty object if `object` is undefined
131
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
132
+ const { [key]: deletedKey, ...otherKeys } = object;
133
+ return otherKeys;
134
+ }
135
+ // export default function omit(object, key) {
136
+ // // eslint-disable-next-line @typescript-eslint/no-unused-vars
137
+ // const { [key]: deletedKey, ...otherKeys } = object;
138
+ // return otherKeys;
139
+ // }
140
+
141
+ const Boolean$1 = ({ className, errorMessage, fieldset, formGroup, hint, idPrefix, items, controlType, name, onChange, onBlur, "aria-describedby": describedByProp, ...attributes }) => {
142
+ const idPrefixValue = idPrefix || name;
143
+ let describedBy = describedByProp || fieldset?.["aria-describedby"] || "";
144
+ const getHintComponent = () => {
145
+ if (hint) {
146
+ const hintId = `${idPrefixValue}-hint`;
147
+ describedBy += ` ${hintId}`;
148
+ return jsx(Hint, { ...hint, id: hintId });
149
+ }
150
+ return null;
151
+ };
152
+ const getErrorMessageComponent = () => {
153
+ if (errorMessage) {
154
+ const errorId = `${idPrefixValue}-error`;
155
+ describedBy += ` ${errorId}`;
156
+ return jsx(ErrorMessage, { ...errorMessage, id: errorId });
157
+ }
158
+ return null;
159
+ };
160
+ const hasFieldset = !!fieldset;
161
+ const innerHtml = (jsxs(Fragment, { children: [getHintComponent(), getErrorMessageComponent(), jsx("div", { className: `govuk-${controlType} ${className || ""}`, ...attributes, "data-module": `govuk-${controlType}`, children: items &&
162
+ items.map((item, index) => {
163
+ if (!item) {
164
+ return null;
165
+ }
166
+ if (item.behaviour === "exclusive") {
167
+ delete item.behaviour;
168
+ }
169
+ const { id, children, hint: itemHint, conditional: itemConditional, behaviour, label, reactListKey, ...itemAttributes } = item;
170
+ const idSuffix = `-${index + 1}`;
171
+ const idValue = id || `${idPrefixValue}${index === 0 ? "" : idSuffix}`;
172
+ const nameValue = item.name ? item.name : name;
173
+ const conditionalId = itemConditional?.children
174
+ ? `conditional-${idValue}`
175
+ : undefined;
176
+ const itemHintId = `${idValue}-item-hint`;
177
+ let itemDescribedBy = "";
178
+ if (controlType === "checkboxes" && !hasFieldset) {
179
+ itemDescribedBy = describedBy;
180
+ }
181
+ if (itemHint) {
182
+ itemDescribedBy += ` ${itemHintId}`;
183
+ }
184
+ if (item.divider) {
185
+ return (jsx("div", { className: `govuk-${controlType}__divider`, children: item.divider }, reactListKey || index));
186
+ }
187
+ return (jsxs(React__default.Fragment, { children: [jsxs("div", { className: `govuk-${controlType}__item`, children: [jsx("input", { className: `govuk-${controlType}__input`, id: idValue, name: nameValue, type: controlType === "radios" ? "radio" : "checkbox", "data-aria-controls": conditionalId, "aria-describedby": itemDescribedBy || undefined, onChange: onChange, onBlur: onBlur, "data-behaviour": behaviour, ...itemAttributes }), jsx(Label, { ...label,
188
+ className: `govuk-${controlType}__label ${label?.className || ""}`,
189
+ htmlFor: idValue,
190
+ isPageHeading: false, children: children }), itemHint ? (jsx(Hint, { ...itemHint,
191
+ className: `govuk-${controlType}__hint ${itemHint.className || ""}`, id: itemHintId })) : ("")] }), itemConditional?.children ? (jsx("div", { className: `govuk-${controlType}__conditional ${item.checked
192
+ ? ""
193
+ : `govuk-${controlType}__conditional--hidden`}`, id: conditionalId, children: itemConditional.children })) : ("")] }, reactListKey || index));
194
+ }) })] }));
195
+ return (jsx("div", { className: `govuk-form-group${errorMessage ? " govuk-form-group--error" : ""} ${formGroup?.className || ""}`, children: hasFieldset ? (jsx(Fieldset, { ...omit(fieldset, "role"), "aria-describedby": describedBy.trim() || undefined, children: innerHtml })) : (innerHtml) }));
196
+ };
197
+
198
+ const Breadcrumbs = (props) => {
199
+ const { items, className, collapseOnMobile, ...attributes } = props;
200
+ const breadcrumbs = items
201
+ ? items.map((item, index) => {
202
+ const { href, to, reactListKey, children, ...itemAttributes } = item;
203
+ return href || to ? (jsx("li", { className: "govuk-breadcrumbs__list-item", children: jsx(LinkWithRef, { href: href, to: to, className: "govuk-breadcrumbs__link", ...itemAttributes, children: children }) }, reactListKey || index)) : (jsx("li", { className: "govuk-breadcrumbs__list-item", "aria-current": "page", children: children }, reactListKey || index));
204
+ })
205
+ : null;
206
+ return (jsx("div", { className: `govuk-breadcrumbs ${className || ""} ${collapseOnMobile ? "govuk-breadcrumbs--collapse-on-mobile" : ""}`, ...attributes, children: jsx("ol", { className: "govuk-breadcrumbs__list", children: breadcrumbs }) }));
207
+ };
208
+
209
+ const Button = (props) => {
210
+ const { element, href, to, isStartButton, disabled, className, preventDoubleClick, name, type, children, ...attributes } = props;
211
+ let el = "";
212
+ let buttonAttributes = {
213
+ name,
214
+ type,
215
+ ...attributes,
216
+ "data-module": "govuk-button",
217
+ };
218
+ let buttonElement = null;
219
+ if (element) {
220
+ el = element;
221
+ }
222
+ else if (href || to) {
223
+ el = "a";
224
+ }
225
+ else {
226
+ el = "button";
227
+ }
228
+ let iconHtml;
229
+ if (isStartButton) {
230
+ iconHtml = (jsx("svg", { className: "govuk-button__start-icon", xmlns: "http://www.w3.org/2000/svg", width: "17.5", height: "19", viewBox: "0 0 33 40", "aria-hidden": "true", focusable: "false", children: jsx("path", { fill: "currentColor", d: "M0 0h13l20 20-20 20H0l20-20z" }) }));
231
+ }
232
+ const commonAttributes = {
233
+ className: `govuk-button ${className || ""}${disabled ? " govuk-button--disabled" : ""} ${isStartButton ? "govuk-button--start" : ""}`,
234
+ // ref: buttonRef,
235
+ };
236
+ if (preventDoubleClick) {
237
+ buttonAttributes["data-prevent-double-click"] = preventDoubleClick;
238
+ }
239
+ if (disabled) {
240
+ buttonAttributes = {
241
+ ...buttonAttributes,
242
+ "aria-disabled": "true",
243
+ disabled: true,
244
+ };
245
+ }
246
+ if (el === "a") {
247
+ const linkAttributes = {
248
+ ...commonAttributes,
249
+ role: "button",
250
+ draggable: "false",
251
+ ...attributes,
252
+ "data-module": "govuk-button",
253
+ href,
254
+ to,
255
+ };
256
+ buttonElement = (jsxs(LinkWithRef, { ...linkAttributes, children: [children, iconHtml] }));
257
+ }
258
+ else if (el === "button") {
259
+ buttonElement = (jsxs("button", { ...buttonAttributes, ...commonAttributes, children: [children, iconHtml] }));
260
+ }
261
+ else if (el === "input") {
262
+ if (!type) {
263
+ buttonAttributes.type = "submit";
264
+ }
265
+ buttonElement = (jsx("input", { value: children, ...buttonAttributes, ...commonAttributes }));
266
+ }
267
+ return buttonElement;
268
+ };
269
+ Button.displayName = "Button";
270
+
271
+ function ConfigureOverallButton($scope, config) {
272
+ createAll(Button$1, config, $scope);
273
+ }
274
+
275
+ function getDefaultExportFromCjs (x) {
276
+ return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
277
+ }
278
+
279
+ var classnames = {exports: {}};
280
+
281
+ /*!
282
+ Copyright (c) 2018 Jed Watson.
283
+ Licensed under the MIT License (MIT), see
284
+ http://jedwatson.github.io/classnames
285
+ */
286
+
287
+ var hasRequiredClassnames;
288
+
289
+ function requireClassnames () {
290
+ if (hasRequiredClassnames) return classnames.exports;
291
+ hasRequiredClassnames = 1;
292
+ (function (module) {
293
+ /* global define */
294
+
295
+ (function () {
296
+
297
+ var hasOwn = {}.hasOwnProperty;
298
+
299
+ function classNames () {
300
+ var classes = '';
301
+
302
+ for (var i = 0; i < arguments.length; i++) {
303
+ var arg = arguments[i];
304
+ if (arg) {
305
+ classes = appendClass(classes, parseValue(arg));
306
+ }
307
+ }
308
+
309
+ return classes;
310
+ }
311
+
312
+ function parseValue (arg) {
313
+ if (typeof arg === 'string' || typeof arg === 'number') {
314
+ return arg;
315
+ }
316
+
317
+ if (typeof arg !== 'object') {
318
+ return '';
319
+ }
320
+
321
+ if (Array.isArray(arg)) {
322
+ return classNames.apply(null, arg);
323
+ }
324
+
325
+ if (arg.toString !== Object.prototype.toString && !arg.toString.toString().includes('[native code]')) {
326
+ return arg.toString();
327
+ }
328
+
329
+ var classes = '';
330
+
331
+ for (var key in arg) {
332
+ if (hasOwn.call(arg, key) && arg[key]) {
333
+ classes = appendClass(classes, key);
334
+ }
335
+ }
336
+
337
+ return classes;
338
+ }
339
+
340
+ function appendClass (value, newClass) {
341
+ if (!newClass) {
342
+ return value;
343
+ }
344
+
345
+ if (value) {
346
+ return value + ' ' + newClass;
347
+ }
348
+
349
+ return value + newClass;
350
+ }
351
+
352
+ if (module.exports) {
353
+ classNames.default = classNames;
354
+ module.exports = classNames;
355
+ } else {
356
+ window.classNames = classNames;
357
+ }
358
+ }());
359
+ } (classnames));
360
+ return classnames.exports;
361
+ }
362
+
363
+ var classnamesExports = requireClassnames();
364
+ var classNames = /*@__PURE__*/getDefaultExportFromCjs(classnamesExports);
365
+
366
+ const DEFAULT_BREAKPOINTS = ['xxl', 'xl', 'lg', 'md', 'sm', 'xs'];
367
+ const DEFAULT_MIN_BREAKPOINT = 'xs';
368
+ const ThemeContext = /*#__PURE__*/React.createContext({
369
+ prefixes: {},
370
+ breakpoints: DEFAULT_BREAKPOINTS,
371
+ minBreakpoint: DEFAULT_MIN_BREAKPOINT
372
+ });
373
+ const {
374
+ Consumer,
375
+ Provider
376
+ } = ThemeContext;
377
+ function useBootstrapPrefix(prefix, defaultPrefix) {
378
+ const {
379
+ prefixes
380
+ } = useContext(ThemeContext);
381
+ return prefix || prefixes[defaultPrefix] || defaultPrefix;
382
+ }
383
+
384
+ const CardBody = /*#__PURE__*/React.forwardRef(({
385
+ className,
386
+ bsPrefix,
387
+ as: Component = 'div',
388
+ ...props
389
+ }, ref) => {
390
+ bsPrefix = useBootstrapPrefix(bsPrefix, 'card-body');
391
+ return /*#__PURE__*/jsx(Component, {
392
+ ref: ref,
393
+ className: classNames(className, bsPrefix),
394
+ ...props
395
+ });
396
+ });
397
+ CardBody.displayName = 'CardBody';
398
+
399
+ const CardFooter = /*#__PURE__*/React.forwardRef(({
400
+ className,
401
+ bsPrefix,
402
+ as: Component = 'div',
403
+ ...props
404
+ }, ref) => {
405
+ bsPrefix = useBootstrapPrefix(bsPrefix, 'card-footer');
406
+ return /*#__PURE__*/jsx(Component, {
407
+ ref: ref,
408
+ className: classNames(className, bsPrefix),
409
+ ...props
410
+ });
411
+ });
412
+ CardFooter.displayName = 'CardFooter';
413
+
414
+ const context = /*#__PURE__*/React.createContext(null);
415
+ context.displayName = 'CardHeaderContext';
416
+
417
+ const CardHeader = /*#__PURE__*/React.forwardRef(({
418
+ bsPrefix,
419
+ className,
420
+ // Need to define the default "as" during prop destructuring to be compatible with styled-components github.com/react-bootstrap/react-bootstrap/issues/3595
421
+ as: Component = 'div',
422
+ ...props
423
+ }, ref) => {
424
+ const prefix = useBootstrapPrefix(bsPrefix, 'card-header');
425
+ const contextValue = useMemo(() => ({
426
+ cardHeaderBsPrefix: prefix
427
+ }), [prefix]);
428
+ return /*#__PURE__*/jsx(context.Provider, {
429
+ value: contextValue,
430
+ children: /*#__PURE__*/jsx(Component, {
431
+ ref: ref,
432
+ ...props,
433
+ className: classNames(className, prefix)
434
+ })
435
+ });
436
+ });
437
+ CardHeader.displayName = 'CardHeader';
438
+
439
+ const CardImg = /*#__PURE__*/React.forwardRef(
440
+ // Need to define the default "as" during prop destructuring to be compatible with styled-components github.com/react-bootstrap/react-bootstrap/issues/3595
441
+ ({
442
+ bsPrefix,
443
+ className,
444
+ variant,
445
+ as: Component = 'img',
446
+ ...props
447
+ }, ref) => {
448
+ const prefix = useBootstrapPrefix(bsPrefix, 'card-img');
449
+ return /*#__PURE__*/jsx(Component, {
450
+ ref: ref,
451
+ className: classNames(variant ? `${prefix}-${variant}` : prefix, className),
452
+ ...props
453
+ });
454
+ });
455
+ CardImg.displayName = 'CardImg';
456
+
457
+ const CardImgOverlay = /*#__PURE__*/React.forwardRef(({
458
+ className,
459
+ bsPrefix,
460
+ as: Component = 'div',
461
+ ...props
462
+ }, ref) => {
463
+ bsPrefix = useBootstrapPrefix(bsPrefix, 'card-img-overlay');
464
+ return /*#__PURE__*/jsx(Component, {
465
+ ref: ref,
466
+ className: classNames(className, bsPrefix),
467
+ ...props
468
+ });
469
+ });
470
+ CardImgOverlay.displayName = 'CardImgOverlay';
471
+
472
+ const CardLink = /*#__PURE__*/React.forwardRef(({
473
+ className,
474
+ bsPrefix,
475
+ as: Component = 'a',
476
+ ...props
477
+ }, ref) => {
478
+ bsPrefix = useBootstrapPrefix(bsPrefix, 'card-link');
479
+ return /*#__PURE__*/jsx(Component, {
480
+ ref: ref,
481
+ className: classNames(className, bsPrefix),
482
+ ...props
483
+ });
484
+ });
485
+ CardLink.displayName = 'CardLink';
486
+
487
+ var divWithClassName = (className => /*#__PURE__*/React.forwardRef((p, ref) => /*#__PURE__*/jsx("div", {
488
+ ...p,
489
+ ref: ref,
490
+ className: classNames(p.className, className)
491
+ })));
492
+
493
+ const DivStyledAsH6 = divWithClassName('h6');
494
+ const CardSubtitle = /*#__PURE__*/React.forwardRef(({
495
+ className,
496
+ bsPrefix,
497
+ as: Component = DivStyledAsH6,
498
+ ...props
499
+ }, ref) => {
500
+ bsPrefix = useBootstrapPrefix(bsPrefix, 'card-subtitle');
501
+ return /*#__PURE__*/jsx(Component, {
502
+ ref: ref,
503
+ className: classNames(className, bsPrefix),
504
+ ...props
505
+ });
506
+ });
507
+ CardSubtitle.displayName = 'CardSubtitle';
508
+
509
+ const CardText = /*#__PURE__*/React.forwardRef(({
510
+ className,
511
+ bsPrefix,
512
+ as: Component = 'p',
513
+ ...props
514
+ }, ref) => {
515
+ bsPrefix = useBootstrapPrefix(bsPrefix, 'card-text');
516
+ return /*#__PURE__*/jsx(Component, {
517
+ ref: ref,
518
+ className: classNames(className, bsPrefix),
519
+ ...props
520
+ });
521
+ });
522
+ CardText.displayName = 'CardText';
523
+
524
+ const DivStyledAsH5 = divWithClassName('h5');
525
+ const CardTitle = /*#__PURE__*/React.forwardRef(({
526
+ className,
527
+ bsPrefix,
528
+ as: Component = DivStyledAsH5,
529
+ ...props
530
+ }, ref) => {
531
+ bsPrefix = useBootstrapPrefix(bsPrefix, 'card-title');
532
+ return /*#__PURE__*/jsx(Component, {
533
+ ref: ref,
534
+ className: classNames(className, bsPrefix),
535
+ ...props
536
+ });
537
+ });
538
+ CardTitle.displayName = 'CardTitle';
539
+
540
+ const Card = /*#__PURE__*/React.forwardRef(({
541
+ bsPrefix,
542
+ className,
543
+ bg,
544
+ text,
545
+ border,
546
+ body = false,
547
+ children,
548
+ // Need to define the default "as" during prop destructuring to be compatible with styled-components github.com/react-bootstrap/react-bootstrap/issues/3595
549
+ as: Component = 'div',
550
+ ...props
551
+ }, ref) => {
552
+ const prefix = useBootstrapPrefix(bsPrefix, 'card');
553
+ return /*#__PURE__*/jsx(Component, {
554
+ ref: ref,
555
+ ...props,
556
+ className: classNames(className, prefix, bg && `bg-${bg}`, text && `text-${text}`, border && `border-${border}`),
557
+ children: body ? /*#__PURE__*/jsx(CardBody, {
558
+ children: children
559
+ }) : children
560
+ });
561
+ });
562
+ Card.displayName = 'Card';
563
+ var Card$1 = Object.assign(Card, {
564
+ Img: CardImg,
565
+ Title: CardTitle,
566
+ Subtitle: CardSubtitle,
567
+ Body: CardBody,
568
+ Link: CardLink,
569
+ Text: CardText,
570
+ Header: CardHeader,
571
+ Footer: CardFooter,
572
+ ImgOverlay: CardImgOverlay
573
+ });
574
+
575
+ const CardColumn = (props) => {
576
+ const { body, header, link } = props;
577
+ return (jsx("div", { className: "col", children: jsxs(Card$1, { className: "card-styles", children: [jsx(Link, { to: link, children: jsx(Card$1.Header, { className: "card-header govuk-!-font-size-27 govuk-!-font-weight-bold", children: header }) }), jsx(Card$1.Body, { className: "govuk-!-font-size-19", children: body })] }) }));
578
+ };
579
+
580
+ const CardLayout = (props) => {
581
+ const { cardColumns: children, numberOfGridColumns = 3 } = props;
582
+ const divideByColumn = [];
583
+ let accumulator = [];
584
+ children.map((child, index) => {
585
+ accumulator.push(createElement(CardColumn, { ...child, key: `card-column-${index}` }));
586
+ if (index % numberOfGridColumns === numberOfGridColumns - 1) {
587
+ divideByColumn.push(jsx("div", { className: `row row-cols-1 row-cols-md-${numberOfGridColumns} govuk-!-margin-bottom-8`, children: accumulator }, `card-layout-${index}`));
588
+ accumulator = [];
589
+ }
590
+ });
591
+ if (accumulator.length > 0) {
592
+ divideByColumn.push(jsx("div", { className: `row row-cols-1 row-cols-md-${numberOfGridColumns} govuk-!-margin-bottom-8`, children: accumulator }, `card-layout-final`));
593
+ }
594
+ return jsx(Fragment, { children: divideByColumn });
595
+ };
596
+
597
+ const defaultProps$1 = {
598
+ "aria-describedby": "",
599
+ rows: 5,
600
+ id: "",
601
+ name: "",
602
+ };
603
+ const Textarea = React__default.forwardRef((props = defaultProps$1, ref) => {
604
+ const { className, "aria-describedby": describedBy, errorMessage, formGroup, hint, label, id, ...attributes } = props;
605
+ let describedByValue = describedBy || "";
606
+ let hintComponent = null;
607
+ let errorMessageComponent = null;
608
+ if (hint) {
609
+ const hintId = `${id}-hint`;
610
+ describedByValue += ` ${hintId}`;
611
+ hintComponent = jsx(Hint, { ...hint, id: hintId });
612
+ }
613
+ if (errorMessage) {
614
+ const errorId = id ? `${id}-error` : "";
615
+ describedByValue += ` ${errorId}`;
616
+ errorMessageComponent = jsx(ErrorMessage, { ...errorMessage, id: errorId });
617
+ }
618
+ return (jsxs("div", { className: `govuk-form-group${errorMessage ? " govuk-form-group--error" : ""} ${formGroup?.className || ""}`, children: [jsx(Label, { ...label, htmlFor: id }), hintComponent, errorMessageComponent, jsx("textarea", { ...attributes, id: id, ref: ref, className: `govuk-textarea${errorMessage ? " govuk-textarea--error" : ""} ${className || ""}`, "aria-describedby": describedByValue?.trim() || undefined })] }));
619
+ });
620
+ Textarea.displayName = "Textarea";
621
+
622
+ const CharacterCount = (props) => {
623
+ const { id, className, maxlength, threshold, maxwords, errorMessage, countMessage, ...attributes } = props;
624
+ const characterCountInfoId = `${id}-info`;
625
+ return (jsxs("div", { className: "govuk-character-count", "data-module": "govuk-character-count", "data-maxlength": maxlength, "data-threshold": threshold, "data-maxwords": maxwords, children: [jsx(Textarea, { id: id, ...attributes, errorMessage: errorMessage, className: `govuk-js-character-count ${className || ""}${errorMessage ? " govuk-textarea--error" : ""}`, "aria-describedby": characterCountInfoId }), jsxs(Hint, { id: characterCountInfoId, className: `govuk-hint govuk-character-count__message ${countMessage?.className || ""}`, "aria-live": "polite", children: ["You have ", maxlength || maxwords, " ", maxwords ? "words" : "characters", " ", "remaining"] })] }));
626
+ };
627
+ CharacterCount.displayName = "CharacterCount";
628
+
629
+ const Checkboxes = (props) => {
630
+ return jsx(Boolean$1, { ...props, controlType: "checkboxes" });
631
+ };
632
+
633
+ function ConfigureOverallCheckboxes($scope) {
634
+ createAll(Checkboxes$1, undefined, $scope);
635
+ }
636
+
637
+ const CookieActions = ({ actions }) => (jsx("div", { className: "govuk-button-group", children: actions.map((action, index) => {
638
+ const { className: actionClassName, children: actionChildren, ...actionProps } = action;
639
+ return action.href || action.to ? (action.type === "button" || action.type === "submit" ? (jsx(Button, { className: actionClassName, ...action }, index)) : (jsx(LinkWithRef, { ...actionProps, className: `govuk-link ${actionClassName || ""}`, children: actionChildren }, index))) : (jsx(Button, { ...action }, index));
640
+ }) }));
641
+ const CookieMessage = ({ headingChildren, children, className, actions, }) => (jsxs("div", { className: `govuk-cookie-banner__message govuk-width-container ${className || ""}`, children: [jsx("div", { className: "govuk-grid-row", children: jsxs("div", { className: "govuk-grid-column-two-thirds", children: [headingChildren && (jsx("h2", { className: "govuk-cookie-banner__heading govuk-heading-m", children: headingChildren })), jsx("div", { className: "govuk-cookie-banner__content", children: typeof children === "string" ? (jsx("p", { className: "govuk-body", children: children })) : (children) })] }) }), actions && jsx(CookieActions, { actions: actions })] }));
642
+ const CookieBanner = ({ className, messages, "aria-label": ariaLabel = "Cookie banner", ...attributes }) => (jsx("div", { className: `govuk-cookie-banner ${className || ""}`, "data-nosnippet": true, role: "region", "aria-label": ariaLabel, ...attributes, children: messages.map((message, index) => (jsx(CookieMessage, { headingChildren: message.headingChildren, className: message.className, actions: message.actions, ...message, children: message.children }, index))) }));
643
+
644
+ const DataNavigation = ({ dataId, setDataFocus, previousText = "Previous", previousCondition, nextText = "Next", nextCondition, dataDescription, }) => {
645
+ // Helper to render the navigation buttons
646
+ const renderNavButton = (id, onClick, disabled, content) => (jsx(Button, { id: id, onClick: onClick, "data-testid": id, disabled: disabled, children: content }));
647
+ return (jsxs("div", { className: "govuk-grid-row", children: [jsx("div", { className: "govuk-grid-column-one-third govuk-!-text-align-left", children: renderNavButton("previous-data", () => setDataFocus(dataId - 1), previousCondition, jsxs(Fragment, { children: [jsx("svg", { className: "govuk-button__start-icon back-button", xmlns: "http://www.w3.org/2000/svg", width: "16", height: "16", viewBox: "0 0 24 24", "aria-hidden": "true", focusable: "false", transform: "rotate(180)", children: jsx("path", { fill: "currentColor", d: "M8.122 24l-4.122-4 8-8-8-8 4.122-4 11.878 12z" }) }), "\u00A0", previousText] })) }), jsx("div", { className: "govuk-grid-column-one-third govuk-!-text-align-centre", children: jsx(Label, { children: dataDescription }) }), jsx("div", { className: "govuk-grid-column-one-third govuk-!-text-align-right", children: renderNavButton("next-data", () => setDataFocus(dataId + 1), nextCondition, jsxs(Fragment, { children: [nextText, jsx("svg", { className: "govuk-button__start-icon", xmlns: "http://www.w3.org/2000/svg", width: "16", height: "16", viewBox: "0 0 24 24", "aria-hidden": "true", focusable: "false", children: jsx("path", { fill: "currentColor", d: "M8.122 24l-4.122-4 8-8-8-8 4.122-4 11.878 12z" }) })] })) })] }));
648
+ };
649
+
650
+ const defaultProps = {
651
+ type: "text",
652
+ };
653
+ const Input = React__default.forwardRef((props = defaultProps, ref) => {
654
+ const { className, "aria-describedby": describedBy, errorMessage, formGroup, hint, label, name, id, prefix, suffix, ...attributes } = props;
655
+ let describedByValue = describedBy || "";
656
+ let hintComponent = null;
657
+ let errorMessageComponent = null;
658
+ if (hint) {
659
+ const hintId = `${id}-hint`;
660
+ describedByValue += ` ${hintId}`;
661
+ hintComponent = jsx(Hint, { ...hint, id: hintId });
662
+ }
663
+ if (errorMessage) {
664
+ const errorId = id ? `${id}-error` : "";
665
+ describedByValue += ` ${errorId}`;
666
+ errorMessageComponent = jsx(ErrorMessage, { ...errorMessage, id: errorId });
667
+ }
668
+ const input = (jsx("input", { ref: ref, id: id, className: `govuk-input ${className || ""} ${errorMessage ? " govuk-input--error" : ""}`, name: name || id, "aria-describedby": describedByValue || undefined, ...attributes }));
669
+ return (jsxs("div", { className: `govuk-form-group ${formGroup?.className || ""} ${errorMessage ? "govuk-form-group--error" : ""}`, children: [jsx(Label, { ...label, htmlFor: id }), hintComponent, errorMessageComponent, prefix || suffix ? (jsxs("div", { className: "govuk-input__wrapper", children: [prefix ? (jsx("div", { "aria-hidden": "true", ...prefix,
670
+ className: `govuk-input__prefix ${prefix.className ? prefix.className : ""}` })) : null, input, suffix ? (jsx("div", { "aria-hidden": "true", ...suffix,
671
+ className: `govuk-input__suffix ${suffix.className ? suffix.className : ""}` })) : null] })) : (input)] }));
672
+ });
673
+ Input.displayName = "Input";
674
+
675
+ const DateInput = (props) => {
676
+ const { className, errorMessage, fieldset, formGroup, hint, id, items, namePrefix, onChange, ...attributes } = props;
677
+ let describedBy = fieldset?.["aria-describedby"]
678
+ ? fieldset["aria-describedby"]
679
+ : "";
680
+ let hintComponent;
681
+ let errorMessageComponent;
682
+ let dateInputItems = [];
683
+ if (hint) {
684
+ const hintId = `${id}-hint`;
685
+ describedBy += ` ${hintId}`;
686
+ hintComponent = jsx(Hint, { ...hint, id: hintId });
687
+ }
688
+ if (errorMessage) {
689
+ const errorId = id ? `${id}-error` : "";
690
+ describedBy += ` ${errorId}`;
691
+ errorMessageComponent = jsx(ErrorMessage, { ...errorMessage, id: errorId });
692
+ }
693
+ if (items && items.length > 0) {
694
+ dateInputItems = items;
695
+ }
696
+ else {
697
+ dateInputItems = [
698
+ {
699
+ name: "day",
700
+ className: "govuk-input--width-2",
701
+ type: "text",
702
+ },
703
+ {
704
+ name: "month",
705
+ className: "govuk-input--width-2",
706
+ type: "text",
707
+ },
708
+ {
709
+ name: "year",
710
+ className: "govuk-input--width-4",
711
+ type: "text",
712
+ },
713
+ ];
714
+ }
715
+ const itemComponents = dateInputItems
716
+ .filter((item) => item)
717
+ .map((item, index) => {
718
+ const { name: itemName, inputMode: itemInputMode, label: itemLabel, reactListKey: itemReactListKey, id: itemId, className: itemClassName, pattern: itemPattern, ...itemAttributes } = item;
719
+ return (jsx("div", { className: "govuk-date-input__item", children: jsx(Input, { onChange: onChange, ...itemAttributes, label: {
720
+ children: itemLabel ||
721
+ itemName.charAt(0).toUpperCase() + itemName.slice(1),
722
+ className: "govuk-date-input__label",
723
+ }, id: itemId || `${id}-${itemName}`, className: `govuk-date-input__input ${itemClassName || ""}`, name: namePrefix ? `${namePrefix}-${itemName}` : itemName, type: "text", inputMode: itemInputMode || "numeric", pattern: itemPattern || "[0-9]*" }) }, itemReactListKey || index));
724
+ });
725
+ const innerHtml = (jsxs(Fragment, { children: [hintComponent, errorMessageComponent, jsx("div", { className: `govuk-date-input ${className || ""}`, ...attributes, id: id, children: itemComponents })] }));
726
+ return (jsx("div", { className: `govuk-form-group${errorMessage ? " govuk-form-group--error" : ""} ${formGroup?.className || ""}`, children: fieldset ? (jsx(Fieldset, { ...fieldset, "aria-describedby": describedBy || undefined, role: "group", children: innerHtml })) : (jsx(Fragment, { children: innerHtml })) }));
727
+ };
728
+
729
+ const Details = ({ className, children, summaryChildren, ...attributes }) => {
730
+ return (jsxs("details", { className: `govuk-details ${className || ""}`, ...attributes, "data-module": "govuk-details", children: [jsx("summary", { className: "govuk-details__summary", children: jsx("span", { className: "govuk-details__summary-text", children: summaryChildren }) }), jsx("div", { className: "govuk-details__text", children: children })] }));
731
+ };
732
+
733
+ function titleCase(str) {
734
+ return str
735
+ .toLowerCase()
736
+ .split(" ")
737
+ .map((word) => word.charAt(0).toUpperCase() + word.slice(1))
738
+ .join(" ");
739
+ }
740
+
741
+ const DifferenceNavigation = ({ differenceId, setDifferenceFocus, totalDifferences, keyword = "variation", plural = "variations", }) => {
742
+ if (totalDifferences === 0) {
743
+ return (jsxs("p", { className: "govuk-body govuk-!-font-size-20 govuk-!-text-align-centre", children: ["No ", `${plural}`, " found"] }));
744
+ }
745
+ const isPreviousDisabled = differenceId <= 1;
746
+ const isNextDisabled = differenceId === totalDifferences;
747
+ const renderButton = (id, onClick, disabled, content) => (jsx(Button, { id: id, onClick: onClick, "data-testid": id, disabled: disabled, children: content }));
748
+ return (jsxs("div", { className: "govuk-grid-row", children: [jsx("div", { className: "govuk-grid-column-one-third", children: jsx("div", { className: "govuk-!-text-align-left", children: renderButton(`previous-${keyword}`, () => setDifferenceFocus(differenceId - 1), isPreviousDisabled, jsxs(Fragment, { children: [" ", jsx("svg", { className: "govuk-button__start-icon back-button", xmlns: "http://www.w3.org/2000/svg", width: "16", height: "16", viewBox: "0 0 24 24", "aria-hidden": "true", focusable: "false", transform: "rotate(180)", children: jsx("path", { fill: "currentColor", d: "M8.122 24l-4.122-4 8-8-8-8 4.122-4 11.878 12z" }) }), "\u00A0Previous", " "] })) }) }), jsx("div", { className: "govuk-grid-column-one-third", children: jsxs(Label, { className: "govuk-!-text-align-centre", children: [titleCase(keyword), " ", differenceId, " of ", totalDifferences] }) }), jsx("div", { className: "govuk-grid-column-one-third", children: jsx("div", { className: "govuk-!-text-align-right", children: renderButton(`next-${keyword}`, () => setDifferenceFocus(differenceId + 1), isNextDisabled, jsxs(Fragment, { children: [" ", "Next", jsx("svg", { className: "govuk-button__start-icon back-button", xmlns: "http://www.w3.org/2000/svg", width: "16", height: "16", viewBox: "0 0 24 24", "aria-hidden": "true", focusable: "false", children: jsx("path", { fill: "currentColor", d: "M8.122 24l-4.122-4 8-8-8-8 4.122-4 11.878 12z" }) })] })) }) })] }));
749
+ };
750
+
751
+ const Main = ({ children, backLink = "", backLinkState = null, }) => (jsx("div", { className: "govuk-width-container", children: jsxs("main", { className: "govuk-main-wrapper", id: "main-content", "data-testid": "main-content", children: [backLink && (jsx("div", { className: "govuk-grid-row", children: jsx("div", { className: "govuk-grid-column-two-thirds", children: jsx(BackLink, { to: { pathname: backLink }, state: backLinkState }) }) })), children && jsx("div", { children: children })] }) }));
752
+
753
+ const ProblemWithService = ({ message = "", applicationName = "Document and plan retrieval system", applicationRoute = "/", reportingLink = "http://marval-live/MSMselfservice/AutoGen.aspx?page=1268", basePageName = "dashboard", }) => {
754
+ const { state } = useLocation();
755
+ const determineMessage = state?.message || message;
756
+ const determineApplicationName = state?.applicationName || applicationName;
757
+ const refreshPage = () => {
758
+ if (window.location.pathname === "/")
759
+ window.location.reload();
760
+ };
761
+ const hasMessage = () => Boolean(determineMessage?.trim());
762
+ return (jsxs(Main, { children: [jsx("h1", { className: "govuk-heading-xl", children: "Sorry, there is a problem with the service" }), hasMessage() && (jsx("div", { className: "govuk-error-summary", "aria-labelledby": "error-summary-title", role: "alert", tabIndex: -1, "data-module": "govuk-error-summary", children: jsx("div", { className: "govuk-error-summary__body", children: jsx("p", { children: determineMessage }) }) })), jsx("p", { className: "govuk-body", children: "Try again later." }), jsxs("p", { className: "govuk-body", children: ["You can go back to", " ", jsx(LinkWithRef, { className: "govuk-link", to: applicationRoute, onClick: refreshPage, children: determineApplicationName }), " ", basePageName, "."] }), jsxs("p", { className: "govuk-body", children: ["If the problem continues\u00A0", jsxs("a", { href: reportingLink, className: "govuk-link", target: "_blank", rel: "noreferrer", children: ["contact support", jsx("span", { className: "nav-panel__text opens-in-new-window" }), jsx("span", { className: "visually-hidden", children: "(Opens in a new window or tab)" })] }), "."] })] }));
763
+ };
764
+
765
+ class ErrorBoundary extends Component {
766
+ constructor(props) {
767
+ super(props);
768
+ this.state = {
769
+ hasError: false,
770
+ message: props.message || "",
771
+ applicationName: props.applicationName || "",
772
+ };
773
+ }
774
+ static getDerivedStateFromError() {
775
+ // Update state to render fallback UI on error
776
+ return { hasError: true };
777
+ }
778
+ componentDidCatch(error, info) {
779
+ console.error("Error caught by ErrorBoundary:", error, info);
780
+ // Optionally log error details to an external service here
781
+ this.setState({ message: error.message });
782
+ }
783
+ render() {
784
+ const { hasError, message, applicationName } = this.state;
785
+ if (hasError) {
786
+ return (jsx(ProblemWithService, { message: message, applicationName: applicationName, basePageName: this.props.basePageName }));
787
+ }
788
+ return this.props.children;
789
+ }
790
+ }
791
+
792
+ const ErrorSummary = (props) => {
793
+ const { className, descriptionChildren, errorList, titleChildren = "There is a problem", disableAutoFocus, ...attributes } = props;
794
+ let description;
795
+ if (descriptionChildren) {
796
+ description = jsx("p", { children: descriptionChildren });
797
+ }
798
+ return (jsxs("div", { className: `govuk-error-summary ${className || ""}`, "aria-labelledby": "error-summary-title", role: "alert", "data-disable-auto-focus": disableAutoFocus ? "true" : null, ...attributes, "data-module": "govuk-error-summary", children: [jsx("h2", { className: "govuk-error-summary__title", id: "error-summary-title", children: titleChildren }), jsxs("div", { className: "govuk-error-summary__body", children: [description, jsx("ul", { className: "govuk-list govuk-error-summary__list", children: errorList
799
+ ? errorList.map((error, index) => {
800
+ const { reactListKey, children, href, ...errorAttributes } = error;
801
+ return (jsx("li", { children: href ? (jsx("a", { ...errorAttributes, href: href, children: children })) : (jsx(Fragment, { children: children })) }, reactListKey || index));
802
+ })
803
+ : null })] })] }));
804
+ };
805
+ ErrorSummary.displayName = "ErrorSummary";
806
+
807
+ function ConfigureOverallErrorSummary($scope, config) {
808
+ createAll(ErrorSummary$1, config, $scope);
809
+ }
810
+
811
+ const FileUpload = (props) => {
812
+ const { className, errorMessage, formGroup, hint, label, "aria-describedby": describedBy, id, ...attributes } = props;
813
+ let hintComponent;
814
+ let errorMessageComponent;
815
+ let describedByValue = describedBy || "";
816
+ if (hint) {
817
+ const hintId = `${props.id}-hint`;
818
+ describedByValue += ` ${hintId}`;
819
+ hintComponent = jsx(Hint, { ...props.hint, id: hintId });
820
+ }
821
+ if (errorMessage) {
822
+ const errorId = `${id}-error`;
823
+ describedByValue += ` ${errorId}`;
824
+ errorMessageComponent = jsx(ErrorMessage, { ...errorMessage, id: errorId });
825
+ }
826
+ return (jsxs("div", { className: `govuk-form-group${errorMessage ? " govuk-form-group--error" : ""} ${formGroup?.className || ""}`, children: [jsx(Label, { ...label, htmlFor: id }), hintComponent, errorMessageComponent, jsx("input", { ...attributes, id: id, className: `govuk-file-upload ${className || ""}${errorMessage ? " govuk-file-upload--error" : ""}`, type: "file", "aria-describedby": describedByValue || undefined })] }));
827
+ };
828
+ FileUpload.displayName = "FileUpload";
829
+
830
+ const Footer = (props) => {
831
+ const { className, containerClassName, meta, navigation, ...attributes } = props;
832
+ let navigationComponent;
833
+ let metaComponent;
834
+ if (navigation && navigation.length > 0) {
835
+ navigationComponent = (jsxs(Fragment, { children: [jsx("div", { className: "govuk-footer__navigation", children: navigation.map((nav, navIndex) => (jsxs("div", { className: `govuk-footer__section govuk-grid-column-${nav.width ? nav.width : "full"}`, children: [jsx("h2", { className: "govuk-footer__heading govuk-heading-m", children: nav.title }), nav.items && nav.items.length > 0 ? (jsx("ul", { className: `govuk-footer__list ${nav.columns ? `govuk-footer__list--columns-${nav.columns}` : ""}`, children: nav.items.map((item, index) => {
836
+ const { className: itemClassName, children: itemChildren, reactListKey, ...itemAttributes } = item;
837
+ return (jsx(React__default.Fragment, { children: (item.href || item.to) && itemChildren && (jsx("li", { className: "govuk-footer__list-item", children: jsx(LinkWithRef, { className: `govuk-footer__link ${itemClassName || ""}`, ...itemAttributes, children: itemChildren }) })) }, reactListKey || index));
838
+ }) })) : null] }, nav.reactListKey || navIndex))) }), jsx("hr", { className: "govuk-footer__section-break" })] }));
839
+ }
840
+ if (meta) {
841
+ metaComponent = (jsxs(Fragment, { children: [jsx("h2", { className: "govuk-visually-hidden", children: meta.visuallyHiddenTitle
842
+ ? meta.visuallyHiddenTitle
843
+ : "Support links" }), meta.items && meta.items.length > 0 ? (jsx(Fragment, { children: jsx("ul", { className: "govuk-footer__inline-list", children: meta.items.map((item, index) => {
844
+ const { className: itemClassName, children: itemChildren, reactListKey, ...itemAttributes } = item;
845
+ return (jsx("li", { className: "govuk-footer__inline-list-item", children: jsx(LinkWithRef, { className: `govuk-footer__link ${itemClassName || ""}`, ...itemAttributes, children: itemChildren }) }, reactListKey || index));
846
+ }) }) })) : null, meta.children ? (jsx("div", { className: "govuk-footer__meta-custom", children: meta.children })) : null] }));
847
+ }
848
+ return (jsx("footer", { className: `govuk-footer ${className || ""}`, role: "contentinfo", ...attributes, children: jsxs("div", { className: `govuk-width-container ${containerClassName || ""}`, children: [navigationComponent, jsxs("div", { className: "govuk-footer__meta", children: [jsxs("div", { className: "govuk-footer__meta-item govuk-footer__meta-item--grow", children: [metaComponent, jsx("svg", { "aria-hidden": "true", focusable: "false", className: "govuk-footer__licence-logo", xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 483.2 195.7", height: "17", width: "41", children: jsx("path", { fill: "currentColor", d: "M421.5 142.8V.1l-50.7 32.3v161.1h112.4v-50.7zm-122.3-9.6A47.12 47.12 0 0 1 221 97.8c0-26 21.1-47.1 47.1-47.1 16.7 0 31.4 8.7 39.7 21.8l42.7-27.2A97.63 97.63 0 0 0 268.1 0c-36.5 0-68.3 20.1-85.1 49.7A98 98 0 0 0 97.8 0C43.9 0 0 43.9 0 97.8s43.9 97.8 97.8 97.8c36.5 0 68.3-20.1 85.1-49.7a97.76 97.76 0 0 0 149.6 25.4l19.4 22.2h3v-87.8h-80l24.3 27.5zM97.8 145c-26 0-47.1-21.1-47.1-47.1s21.1-47.1 47.1-47.1 47.2 21 47.2 47S123.8 145 97.8 145" }) }), jsxs("span", { className: "govuk-footer__licence-description", children: ["All content is available under the", " ", jsx("a", { className: "govuk-footer__link", href: "https://www.nationalarchives.gov.uk/doc/open-government-licence/version/3/", rel: "license", children: "Open Government Licence v3.0" }), ", except where otherwise stated"] })] }), jsx("div", { className: "govuk-footer__meta-item", children: jsx("a", { className: "govuk-footer__link govuk-footer__copyright-logo", href: "https://www.nationalarchives.gov.uk/information-management/re-using-public-sector-information/uk-government-licensing-framework/crown-copyright/", children: "\u00A9 Crown copyright" }) })] })] }) }));
849
+ };
850
+
851
+ const Header = (props) => {
852
+ const { className, containerClassName = "govuk-width-container", homepageUrlHref = "/", homepageUrlTo, navigation, navigationClassName, productName, serviceName, serviceUrlHref, serviceUrlTo, navigationLabel = "Menu", menuButtonLabel = "Show or hide menu", removeGovUKHeader = null, logo, ...attributes } = props;
853
+ let productNameComponent = null;
854
+ let navigationComponent = null;
855
+ if (productName) {
856
+ productNameComponent = (jsx("span", { className: "govuk-header__product-name", children: productName }));
857
+ }
858
+ if (serviceName || navigation) {
859
+ navigationComponent = (jsxs("div", { className: "govuk-header__content", children: [serviceName ? (jsx(LinkWithRef, { href: serviceUrlHref, to: serviceUrlTo, className: "govuk-header__link govuk-header__link--service-name", children: serviceName })) : null, navigation ? (jsx(Fragment, { children: jsxs("nav", { className: `govuk-header__navigation ${navigationClassName || ""}`, "aria-label": navigationLabel, children: [jsx("button", { type: "button", className: "govuk-header__menu-button govuk-js-header-toggle", "aria-controls": "navigation", "aria-label": menuButtonLabel, children: "Menu" }), jsx("ul", { id: "navigation", className: "govuk-header__navigation-list", children: navigation.map((item, index) => {
860
+ const { active: itemActive, className: itemClassName, children: itemChildren, reactListKey, ...itemAttributes } = item;
861
+ return itemChildren ? (jsx("li", { className: `govuk-header__navigation-item${itemActive
862
+ ? " govuk-header__navigation-item--active"
863
+ : ""}`, children: item.href || item.to ? (jsx(LinkWithRef, { className: `govuk-header__link ${itemClassName || ""}`, ...itemAttributes, children: itemChildren })) : (itemChildren) }, reactListKey || index)) : null;
864
+ }) })] }) })) : null] }));
865
+ }
866
+ return (jsx("header", { className: `govuk-header ${className || ""}`, role: "banner", "data-module": "govuk-header", ...attributes, children: jsxs("div", { className: `govuk-header__container ${containerClassName}`, children: [jsx("div", { className: "govuk-header__logo", children: jsxs(LinkWithRef, { to: homepageUrlTo, href: homepageUrlHref, className: "govuk-header__link govuk-header__link--homepage", children: [!removeGovUKHeader && (jsx("span", { className: "govuk-header__logotype", dangerouslySetInnerHTML: {
867
+ __html: `
868
+ <!--[if gt IE 8]><!-->
869
+ <svg
870
+ aria-hidden="true"
871
+ focusable="false"
872
+ class="govuk-header__logotype-crown"
873
+ xmlns="http://www.w3.org/2000/svg"
874
+ viewBox="0 0 132 97"
875
+ height="30"
876
+ width="36"
877
+ >
878
+ <path
879
+ fill="currentColor"
880
+ fillRule="evenodd"
881
+ d="M25 30.2c3.5 1.5 7.7-.2 9.1-3.7 1.5-3.6-.2-7.8-3.9-9.2-3.6-1.4-7.6.3-9.1 3.9-1.4 3.5.3 7.5 3.9 9zM9 39.5c3.6 1.5 7.8-.2 9.2-3.7 1.5-3.6-.2-7.8-3.9-9.1-3.6-1.5-7.6.2-9.1 3.8-1.4 3.5.3 7.5 3.8 9zM4.4 57.2c3.5 1.5 7.7-.2 9.1-3.8 1.5-3.6-.2-7.7-3.9-9.1-3.5-1.5-7.6.3-9.1 3.8-1.4 3.5.3 7.6 3.9 9.1zm38.3-21.4c3.5 1.5 7.7-.2 9.1-3.8 1.5-3.6-.2-7.7-3.9-9.1-3.6-1.5-7.6.3-9.1 3.8-1.3 3.6.4 7.7 3.9 9.1zm64.4-5.6c-3.6 1.5-7.8-.2-9.1-3.7-1.5-3.6.2-7.8 3.8-9.2 3.6-1.4 7.7.3 9.2 3.9 1.3 3.5-.4 7.5-3.9 9zm15.9 9.3c-3.6 1.5-7.7-.2-9.1-3.7-1.5-3.6.2-7.8 3.7-9.1 3.6-1.5 7.7.2 9.2 3.8 1.5 3.5-.3 7.5-3.8 9zm4.7 17.7c-3.6 1.5-7.8-.2-9.2-3.8-1.5-3.6.2-7.7 3.9-9.1 3.6-1.5 7.7.3 9.2 3.8 1.3 3.5-.4 7.6-3.9 9.1zM89.3 35.8c-3.6 1.5-7.8-.2-9.2-3.8-1.4-3.6.2-7.7 3.9-9.1 3.6-1.5 7.7.3 9.2 3.8 1.4 3.6-.3 7.7-3.9 9.1zM69.7 17.7l8.9 4.7V9.3l-8.9 2.8c-.2-.3-.5-.6-.9-.9L72.4 0H59.6l3.5 11.2c-.3.3-.6.5-.9.9l-8.8-2.8v13.1l8.8-4.7c.3.3.6.7.9.9l-5 15.4v.1c-.2.8-.4 1.6-.4 2.4 0 4.1 3.1 7.5 7 8.1h.2c.3 0 .7.1 1 .1.4 0 .7 0 1-.1h.2c4-.6 7.1-4.1 7.1-8.1 0-.8-.1-1.7-.4-2.4V34l-5.1-15.4c.4-.2.7-.6 1-.9zM66 92.8c16.9 0 32.8 1.1 47.1 3.2 4-16.9 8.9-26.7 14-33.5l-9.6-3.4c1 4.9 1.1 7.2 0 10.2-1.5-1.4-3-4.3-4.2-8.7L108.6 76c2.8-2 5-3.2 7.5-3.3-4.4 9.4-10 11.9-13.6 11.2-4.3-.8-6.3-4.6-5.6-7.9 1-4.7 5.7-5.9 8-.5 4.3-8.7-3-11.4-7.6-8.8 7.1-7.2 7.9-13.5 2.1-21.1-8 6.1-8.1 12.3-4.5 20.8-4.7-5.4-12.1-2.5-9.5 6.2 3.4-5.2 7.9-2 7.2 3.1-.6 4.3-6.4 7.8-13.5 7.2-10.3-.9-10.9-8-11.2-13.8 2.5-.5 7.1 1.8 11 7.3L80.2 60c-4.1 4.4-8 5.3-12.3 5.4 1.4-4.4 8-11.6 8-11.6H55.5s6.4 7.2 7.9 11.6c-4.2-.1-8-1-12.3-5.4l1.4 16.4c3.9-5.5 8.5-7.7 10.9-7.3-.3 5.8-.9 12.8-11.1 13.8-7.2.6-12.9-2.9-13.5-7.2-.7-5 3.8-8.3 7.1-3.1 2.7-8.7-4.6-11.6-9.4-6.2 3.7-8.5 3.6-14.7-4.6-20.8-5.8 7.6-5 13.9 2.2 21.1-4.7-2.6-11.9.1-7.7 8.8 2.3-5.5 7.1-4.2 8.1.5.7 3.3-1.3 7.1-5.7 7.9-3.5.7-9-1.8-13.5-11.2 2.5.1 4.7 1.3 7.5 3.3l-4.7-15.4c-1.2 4.4-2.7 7.2-4.3 8.7-1.1-3-.9-5.3 0-10.2l-9.5 3.4c5 6.9 9.9 16.7 14 33.5 14.8-2.1 30.8-3.2 47.7-3.2z"
882
+ />
883
+ </svg>
884
+ <!--<![endif]-->
885
+ <!--[if IE 8]>
886
+ <img src="${logo}" class="govuk-header__logotype-crown-fallback-image" width="36" height="32" />
887
+ <![endif]-->
888
+ <span class="govuk-header__logotype-text">GOV.UK</span>
889
+ `,
890
+ } })), productNameComponent] }) }), navigationComponent] }) }));
891
+ };
892
+
893
+ function ConfigureOverallHeader($scope) {
894
+ createAll(Header$1, undefined, $scope);
895
+ }
896
+
897
+ const InsetText = ({ className, children, ...attributes }) => {
898
+ return (jsx("div", { className: `govuk-inset-text ${className || ""}`, ...attributes, children: children }));
899
+ };
900
+
901
+ const Landing = (props) => {
902
+ const { to = "/" } = props;
903
+ return (jsx(Main, { children: jsx("div", { className: "govuk-grid-row", children: jsx("div", { className: "govuk-hint govuk-grid-column-full", children: jsx("div", { className: "centered-wheel", children: jsx("h2", { className: "govuk-heading-m", children: jsx(Link, { to: to, children: "Single sign on" }) }) }) }) }) }));
904
+ };
905
+
906
+ const Loading = ({ message = null, html = null }) => {
907
+ return (jsx("div", { className: "govuk-grid-row", children: jsxs("div", { className: "govuk-grid-column-full", children: [message || html ? (jsx("div", { className: "govuk-grid-row", children: jsx("div", { className: "govuk-grid-column-full head-space", children: html ? (html) : (jsx("h2", { className: "govuk-heading-m govuk-!-text-align-centre", children: message })) }) })) : null, jsx("div", { className: "govuk-hint govuk-grid-column-full", children: jsx("div", { className: "centered-wheel", "data-testid": "centered-wheel-identifier", children: jsx("div", { className: "loading-wheel-2", "data-testid": "loading-wheel-2-identifier" }) }) })] }) }));
908
+ };
909
+
910
+ const NotFoundPage = () => {
911
+ return (jsx(Main, { children: jsxs("div", { children: [jsx("h1", { className: "govuk-heading-xl", children: "Page not found" }), jsx("p", { className: "govuk-body", children: "If you typed the web address, check it is correct." }), jsx("p", { className: "govuk-body", children: "If you pasted the web address, check you copied the entire address." })] }) }));
912
+ };
913
+
914
+ const NotificationBanner = (props) => {
915
+ const { type, titleChildren, titleHeadingLevel: HeadingLevel = "h2", children, className, titleId = "govuk-notification-banner-title", role, disableAutoFocus, ...attributes } = props;
916
+ let successBanner = false;
917
+ if (type === "success") {
918
+ successBanner = true;
919
+ }
920
+ let typeClass = "";
921
+ if (successBanner) {
922
+ typeClass = `govuk-notification-banner--${type}`;
923
+ }
924
+ let roleAttribute = "region";
925
+ if (role) {
926
+ roleAttribute = role;
927
+ }
928
+ else if (successBanner) {
929
+ roleAttribute = "alert";
930
+ }
931
+ const title = titleChildren || (successBanner ? "Success" : "Important");
932
+ return (jsxs("div", { className: `govuk-notification-banner ${typeClass} ${className || ""}`, role: roleAttribute, "aria-labelledby": titleId, "data-module": "govuk-notification-banner", ...(disableAutoFocus ? { "data-disable-auto-focus": "true" } : {}), ...attributes, children: [jsx("div", { className: "govuk-notification-banner__header", children: jsx(HeadingLevel, { className: "govuk-notification-banner__title", id: titleId, children: title }) }), jsx("div", { className: "govuk-notification-banner__content", children: typeof children === "string" ? (jsx("p", { className: "govuk-notification-banner__heading", children: children })) : (children) })] }));
933
+ };
934
+
935
+ const DOTS = "...";
936
+ const UsePagination = ({ totalCount, pageSize, siblingCount = 1, currentPage, }) => {
937
+ const range = (start, end) => {
938
+ return Array.from({ length: end - start + 1 }, (_, idx) => idx + start);
939
+ };
940
+ const paginationRange = useMemo(() => {
941
+ const totalPages = Math.ceil(totalCount / pageSize);
942
+ const visiblePages = siblingCount + 10;
943
+ // Case 1: Show all pages when total pages is less than the number of visible pages
944
+ if (visiblePages >= totalPages) {
945
+ return range(1, totalPages);
946
+ }
947
+ const firstPage = 1;
948
+ const lastPage = totalPages;
949
+ const leftSibling = Math.max(currentPage - siblingCount, firstPage);
950
+ const rightSibling = Math.min(currentPage + siblingCount, lastPage);
951
+ const showLeftDots = leftSibling > 2;
952
+ const showRightDots = rightSibling < totalPages - 2;
953
+ // Case 2: Only right dots are shown
954
+ if (!showLeftDots && showRightDots) {
955
+ const leftPages = range(1, 8 + 2 * siblingCount);
956
+ return [...leftPages, DOTS, lastPage];
957
+ }
958
+ // Case 3: Only left dots are shown
959
+ if (showLeftDots && !showRightDots) {
960
+ const rightPages = range(totalPages - (6 + 2 * siblingCount) + 1, lastPage);
961
+ return [firstPage, DOTS, ...rightPages];
962
+ }
963
+ // Case 4: Both left and right dots are shown
964
+ const middlePages = range(leftSibling, rightSibling);
965
+ return [firstPage, DOTS, ...middlePages, DOTS, lastPage];
966
+ }, [totalCount, pageSize, siblingCount, currentPage]);
967
+ return paginationRange;
968
+ };
969
+
970
+ const SvgIcon = ({ type, ...props }) => (jsx("svg", { xmlns: "http://www.w3.org/2000/svg", width: 15, height: 13, "aria-hidden": "true", ...props, children: jsx("path", { d: type === "next"
971
+ ? "M8.107-.008L6.693 1.406 10.986 5.7H-2v2h12.896L6.71 11.676l1.378 1.449 6.744-6.406L8.107-.008z"
972
+ : "M6.594-.008-.133 6.72l6.744 6.406 1.377-1.449-4.185-3.977h12.896v-2H3.715l4.293-4.293L6.594-.008z" }) }));
973
+
974
+ const NavigationButton = ({ isDisabled, onClick, children, name, type, }) => {
975
+ const typeClass = type === "next" ? type : "prev";
976
+ const Icon = (jsx(SvgIcon, { type: type, className: `govuk-pagination__icon govuk-pagination__icon--${typeClass}`, focusable: "false" }));
977
+ return isDisabled ? (jsxs("div", { rel: type, children: [type === "previous" && Icon, jsx("span", { className: "govuk-pagination__link-title", children: name }), type === "next" && Icon, children && (jsxs(Fragment, { children: [type === "previous" && jsx(Fragment, { children: "\u00A0" }), jsx("span", { className: "govuk-visually-hidden", children: ":" }), children, type === "next" && jsx(Fragment, { children: " \u00A0" })] }))] })) : (jsxs("a", { className: "govuk-link govuk-pagination__link", href: "#", rel: type, onClick: onClick, children: [type === "previous" && Icon, jsx("span", { className: "govuk-pagination__link-title", children: name }), type === "next" && Icon, children && (jsxs(Fragment, { children: [type === "previous" && jsx(Fragment, { children: "\u00A0\u00A0" }), jsx("span", { className: "govuk-visually-hidden", children: ":" }), children, type === "next" && jsx(Fragment, { children: "\u00A0\u00A0" })] }))] }));
978
+ };
979
+
980
+ const Pagination = ({ onPageChange, totalCount, siblingCount = 1, currentPage, pageSize, className, previousName = "Previous", nextName = "Next", previousChildren, nextChildren, }) => {
981
+ const paginationRange = UsePagination({
982
+ currentPage,
983
+ totalCount,
984
+ siblingCount,
985
+ pageSize,
986
+ });
987
+ if (!paginationRange || paginationRange.length < 2)
988
+ return null;
989
+ const onNext = () => onPageChange(currentPage + 1);
990
+ const onPrevious = () => onPageChange(currentPage - 1);
991
+ const lastPage = paginationRange[paginationRange.length - 1];
992
+ return (jsxs(Fragment, { children: [jsx("div", { className: "govuk-!-padding-bottom-2" }), jsx("div", { className: `govuk-grid-column-full ${className || ""}`, children: jsxs("nav", { className: "govuk-pagination", role: "navigation", "aria-label": "Pagination", children: [jsx("div", { className: "govuk-pagination__prev", children: jsx(NavigationButton, { isDisabled: currentPage === 1, onClick: onPrevious, name: previousName, type: "previous", children: previousChildren }) }), jsx("ul", { className: "govuk-pagination__list", children: paginationRange.map((pageNumber, index) => pageNumber === DOTS ? (jsx("li", { className: "govuk-pagination__item govuk-pagination__item--ellipses", children: DOTS }, index)) : (jsx("li", { className: `govuk-pagination__item ${pageNumber === currentPage ? "govuk-pagination__item--current" : ""}`, children: jsx("a", { className: "govuk-link govuk-pagination__link", href: "#", "aria-label": `Page ${pageNumber}`, "aria-current": pageNumber === currentPage ? "page" : undefined, onClick: () => onPageChange(pageNumber), children: pageNumber }) }, index))) }), jsx("div", { className: "govuk-pagination__next", children: jsx(NavigationButton, { isDisabled: currentPage === lastPage, onClick: onNext, name: nextName, type: "next", children: nextChildren }) })] }) }), jsx("div", { className: "govuk-!-padding-bottom-4" })] }));
993
+ };
994
+
995
+ const Panel = (props) => {
996
+ const { headingLevel: HeadingLevel = "h1", children, className, titleChildren, ...attributes } = props;
997
+ const innerHtml = children ? (jsx("div", { className: "govuk-panel__body", children: children })) : null;
998
+ return (jsxs("div", { className: `govuk-panel govuk-panel--confirmation ${className || ""}`, ...attributes, children: [jsx(HeadingLevel, { className: "govuk-panel__title", children: titleChildren }), innerHtml] }));
999
+ };
1000
+
1001
+ function Slugify(str) {
1002
+ str = str.replace(/^\s+|\s+$/g, ""); // trim leading/trailing white space
1003
+ str = str.toLowerCase(); // convert string to lowercase
1004
+ str = str
1005
+ .replace(/[^a-z0-9 -]/g, "") // remove any non-alphanumeric characters
1006
+ .replace(/\s+/g, "-") // replace spaces with hyphens
1007
+ .replace(/-+/g, "-"); // remove consecutive hyphens
1008
+ return str;
1009
+ }
1010
+
1011
+ const PDFViewer = (props) => {
1012
+ const viewerRef = React__default.useRef(null);
1013
+ const { iframeId, src, viewerLocation, documentName, documentNameColour, backend, toolbar = "minimal", additionalBackendAttributes, ...attributes } = props;
1014
+ const [loading, setLoading] = useState(false);
1015
+ useEffect(() => {
1016
+ setLoading(true);
1017
+ const element = viewerRef.current;
1018
+ if (!element)
1019
+ return; // Guard against null
1020
+ const jsProps = {
1021
+ iframeId,
1022
+ source: src,
1023
+ viewerLocation,
1024
+ documentName,
1025
+ documentNameColour,
1026
+ element,
1027
+ toolbar,
1028
+ ...additionalBackendAttributes,
1029
+ };
1030
+ backend(jsProps);
1031
+ setLoading(false);
1032
+ }, []);
1033
+ return (jsxs(Fragment, { children: [loading && jsx(Loading, { message: "Loading PDF Document" }), jsx("div", { ref: viewerRef, id: `viewer ${documentName ? Slugify(documentName) : ""}`, "data-testid": `viewer ${documentName ? Slugify(documentName) : ""}`, style: { width: "100%", height: "100%" }, ...attributes })] }));
1034
+ };
1035
+
1036
+ const ObjectToQueryString = (queryParameters) => {
1037
+ return queryParameters
1038
+ ? Object.entries(queryParameters).reduce((queryString, [key, val]) => {
1039
+ const symbol = queryString.length === 0 ? "?" : "&";
1040
+ queryString += val ? `${symbol}${key}=${val}` : "";
1041
+ return queryString;
1042
+ }, "")
1043
+ : "";
1044
+ };
1045
+
1046
+ const _base64ToArrayBuffer = (base64) => {
1047
+ const binaryString = window.atob(base64);
1048
+ const len = binaryString.length;
1049
+ const bytes = new Uint8Array(len);
1050
+ for (let i = 0; i < len; i++) {
1051
+ bytes[i] = binaryString.charCodeAt(i);
1052
+ }
1053
+ return bytes.buffer;
1054
+ };
1055
+ const isBase64 = (value) => /^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=|[A-Za-z0-9+/]{4})$/.test(value);
1056
+ const ResolvePDFSource = (source) => {
1057
+ const isBase64Source = isBase64(source);
1058
+ if (!isBase64Source) {
1059
+ return { isBase64Source, source };
1060
+ }
1061
+ const blob = new Blob([_base64ToArrayBuffer(source)], {
1062
+ type: "application/pdf",
1063
+ });
1064
+ return { isBase64Source, source: URL.createObjectURL(blob) };
1065
+ };
1066
+
1067
+ const PDFViewerBackend = ({ iframeId, source, viewerLocation = "/pdfjs-4.4.168-dist/web/viewer.html", documentName, documentNameColour = "black", toolbar = "minimal", element, ...remaining }) => {
1068
+ const sourceDeterminer = ResolvePDFSource(source);
1069
+ const iframe = document.createElement("iframe");
1070
+ const queryString = ObjectToQueryString({
1071
+ ...remaining,
1072
+ file: sourceDeterminer.source,
1073
+ document_name: documentName,
1074
+ document_name_colour: documentNameColour,
1075
+ toolbar,
1076
+ });
1077
+ // console.log(queryString);
1078
+ iframe.id = `${iframeId}`;
1079
+ iframe.title = `${documentName} `;
1080
+ iframe.src = `${viewerLocation}${queryString}`;
1081
+ iframe.style.width = "100%";
1082
+ iframe.style.height = "94%";
1083
+ if (sourceDeterminer.isBase64Source) {
1084
+ iframe.addEventListener("beforeunload", (event) => {
1085
+ event.preventDefault();
1086
+ URL.revokeObjectURL(sourceDeterminer.source);
1087
+ });
1088
+ }
1089
+ element.appendChild(iframe);
1090
+ };
1091
+
1092
+ const Tag = (props) => {
1093
+ const { children, className, ...attributes } = props;
1094
+ return (jsx("strong", { className: `govuk-tag ${className || ""}`, ...attributes, children: children }));
1095
+ };
1096
+
1097
+ const PhaseBanner = (props) => {
1098
+ const { className, tag, children, ...attributes } = props;
1099
+ return (jsx("div", { className: `govuk-phase-banner ${className || ""}`, ...attributes, children: jsxs("p", { className: "govuk-phase-banner__content", children: [jsx(Tag, { className: `govuk-phase-banner__content__tag ${tag?.className || ""}`, children: tag && tag.children }), jsx("span", { className: "govuk-phase-banner__text", children: children })] }) }));
1100
+ };
1101
+
1102
+ const Radios = (props) => {
1103
+ const { value, defaultValue, items, ...restProps } = props;
1104
+ const processedItems = items
1105
+ ? items.map((item) => {
1106
+ if (item) {
1107
+ return {
1108
+ ...item,
1109
+ ...(value != null && { checked: item.value === value }),
1110
+ ...(defaultValue != null && {
1111
+ defaultChecked: item.value === defaultValue,
1112
+ }),
1113
+ };
1114
+ }
1115
+ return item;
1116
+ })
1117
+ : undefined;
1118
+ return jsx(Boolean$1, { items: processedItems, ...restProps, controlType: "radios" });
1119
+ };
1120
+
1121
+ function ConfigureOverallRadios($scope) {
1122
+ createAll(Radios$1, undefined, $scope);
1123
+ }
1124
+
1125
+ const Select = (props) => {
1126
+ const { className, "aria-describedby": describedBy, errorMessage, formGroup, hint, id, items, label, ...attributes } = props;
1127
+ let describedByValue = describedBy || "";
1128
+ let hintComponent;
1129
+ let errorMessageComponent;
1130
+ if (hint) {
1131
+ const hintId = `${id}-hint`;
1132
+ describedByValue += ` ${hintId}`;
1133
+ hintComponent = jsx(Hint, { ...hint, id: hintId });
1134
+ }
1135
+ if (errorMessage) {
1136
+ const errorId = id ? `${id}-error` : "";
1137
+ describedByValue += ` ${errorId}`;
1138
+ errorMessageComponent = jsx(ErrorMessage, { ...errorMessage, id: errorId });
1139
+ }
1140
+ const options = items
1141
+ ? items
1142
+ .filter((item) => item)
1143
+ .map((option, index) => {
1144
+ const { reactListKey, children, ...optionAttributes } = option;
1145
+ return (createElement("option", { ...optionAttributes, key: reactListKey || index }, children));
1146
+ })
1147
+ : null;
1148
+ return (jsxs("div", { className: `govuk-form-group${errorMessage ? " govuk-form-group--error" : ""} ${formGroup?.className || ""}`, children: [jsx(Label, { ...label, htmlFor: id }), hintComponent, errorMessageComponent, jsx("select", { className: `govuk-select ${className || ""}${errorMessage ? " govuk-select--error" : ""}`, id: id, "aria-describedby": describedByValue || undefined, ...attributes, children: options })] }));
1149
+ };
1150
+
1151
+ const ServiceNavigation = (props) => {
1152
+ const { className, containerClassName = "govuk-width-container", menuButtonLabel = "Show or hide menu", navigation, navigationClassName, navigationLabel = "Menu", serviceName, serviceUrlHref, serviceUrlTo, ...attributes } = props;
1153
+ return (jsx("section", { "aria-label": "Service information", className: `govuk-service-navigation ${className || ""}`, "data-module": "govuk-service-navigation", ...attributes, children: jsx("div", { className: `govuk-width-container ${containerClassName}`, children: jsxs("div", { className: "govuk-service-navigation__container", children: [serviceName ? (jsx("span", { className: "govuk-service-navigation__service-name", children: jsx(LinkWithRef, { href: serviceUrlHref, to: serviceUrlTo, className: "govuk-header__link govuk-header__link--service-name", children: serviceName }) })) : null, navigation ? (jsxs("nav", { "aria-label": navigationLabel, className: `govuk-service-navigation__wrapper ${navigationClassName || ""}`, children: [jsx("button", { type: "button", className: "govuk-service-navigation__toggle govuk-js-service-navigation-toggle", "aria-controls": "navigation", "aria-label": menuButtonLabel, hidden: true, children: "Menu" }), jsx("ul", { className: "govuk-service-navigation__list", id: "navigation", children: navigation.map((item, index) => {
1154
+ const { active: itemActive, className: itemClassName, children: itemChildren, reactListKey, ...itemAttributes } = item;
1155
+ return itemChildren ? (jsx("li", { className: `govuk-service-navigation__item${itemActive
1156
+ ? " govuk-service-navigation__item--active"
1157
+ : ""}`, children: item.href || item.to ? (jsx(LinkWithRef, { className: `govuk-service-navigation__link ${itemClassName || ""}`, "aria-current": itemActive ? "true" : "false", ...itemAttributes, children: itemActive ? (jsx("strong", { className: "govuk-service-navigation__active-fallback", children: itemChildren })) : (itemChildren) })) : (itemChildren) }, reactListKey || index)) : null;
1158
+ }) })] })) : null] }) }) }));
1159
+ };
1160
+
1161
+ const SkipLink = (props) => {
1162
+ const { href = "#content", className, children, ...attributes } = props;
1163
+ return (jsx("a", { href: href, className: `govuk-skip-link ${className || ""}`, "data-module": "govuk-skip-link", ...attributes, children: children }));
1164
+ };
1165
+
1166
+ function ConfigureOverallSkipLink($scope) {
1167
+ createAll(SkipLink$1, undefined, $scope);
1168
+ }
1169
+
1170
+ const actions = (row) => {
1171
+ const actionLinks = row.actions?.items.map((action, index) => {
1172
+ const { reactListKey, ...actionAttributes } = action;
1173
+ return jsx(ActionLink, { ...actionAttributes }, reactListKey || index);
1174
+ });
1175
+ if (row.actions?.items.length) {
1176
+ return (jsx("dd", { className: `govuk-summary-list__actions ${row.actions.className || ""}`, children: row.actions.items.length === 1 ? (actionLinks) : (jsx("ul", { className: "govuk-summary-list__actions-list", children: actionLinks?.map((actionLink) => (jsx("li", { className: "govuk-summary-list__actions-list-item", children: actionLink }, actionLink.key))) })) }));
1177
+ }
1178
+ return null;
1179
+ };
1180
+ const SummaryList = (props) => {
1181
+ const { className, rows, ...attributes } = props;
1182
+ const filteredRows = rows ? rows.filter((row) => row) : [];
1183
+ const anyRowHasActions = filteredRows.some((item) => item.actions?.items && item.actions?.items.length > 0);
1184
+ return (jsx("dl", { className: `govuk-summary-list ${className || ""}`, ...attributes, children: filteredRows.map((row, index) => (jsxs("div", { className: `govuk-summary-list__row ${anyRowHasActions && !row.actions?.items
1185
+ ? "govuk-summary-list__row--no-actions"
1186
+ : ""} ${row.className || ""}`, children: [jsx("dt", { className: `govuk-summary-list__key ${row.key?.className || ""}`, children: row.key?.children }), jsx("dd", { className: `govuk-summary-list__value ${row.value?.className || ""}`, children: row.value?.children }), actions(row)] }, row.reactListKey || index))) }));
1187
+ };
1188
+
1189
+ const Table = ({ caption, captionClassName, className, firstCellIsHeader, head, rows, footer, ...attributes }) => {
1190
+ // Memoize caption component to avoid re-renders if it doesn't change
1191
+ const captionComponent = useMemo(() => caption && (jsx("caption", { className: `govuk-table__caption ${captionClassName || ""}`, children: caption })), [caption, captionClassName]);
1192
+ // Memoize head component
1193
+ const headComponent = useMemo(() => head && (jsx("thead", { className: "govuk-table__head", children: jsx("tr", { className: "govuk-table__row", children: head.map(({ className, format, children, reactListKey, ...itemAttributes }, index) => (jsx("th", { scope: "col", className: `govuk-table__header ${format ? `govuk-table__header--${format}` : ""} ${className || ""}`, ...itemAttributes, children: children }, reactListKey || index))) }) })), [head]);
1194
+ // Memoize footer component
1195
+ const footerComponent = useMemo(() => footer && (jsx("tfoot", { className: "govuk-table__head", children: jsx("tr", { className: "govuk-table__row", children: footer.map(({ className, format, children, reactListKey, ...itemAttributes }, index) => (jsx("th", { scope: "col", className: `govuk-table__header ${format ? `govuk-table__header--${format}` : ""} ${className || ""}`, ...itemAttributes, children: children }, reactListKey || index))) }) })), [footer]);
1196
+ // Filter rows that contain cells
1197
+ const filteredRows = rows?.filter((row) => row.cells) || [];
1198
+ return (jsxs("table", { className: `govuk-table ${className}`, ...attributes, children: [captionComponent, headComponent, jsx("tbody", { className: "govuk-table__body", children: filteredRows.map(({ cells, reactListKey }, rowIndex) => (jsx("tr", { className: "govuk-table__row", children: cells.map(({ className, children, format, reactListKey, ...cellAttributes }, cellIndex) => {
1199
+ const cellClassNames = `govuk-table__cell ${className || ""} ${format ? `govuk-table__cell--${format}` : ""}`;
1200
+ const headerClassNames = `govuk-table__header ${className || ""}`;
1201
+ // Check if the first cell should be a header
1202
+ if (cellIndex === 0 && firstCellIsHeader) {
1203
+ return (jsx("th", { scope: "row", className: headerClassNames, ...cellAttributes, children: children }, reactListKey || cellIndex));
1204
+ }
1205
+ return (jsx("td", { className: cellClassNames, ...cellAttributes, children: children }, reactListKey || cellIndex));
1206
+ }) }, reactListKey || rowIndex))) }), footerComponent] }));
1207
+ };
1208
+
1209
+ const Tabs = ({ className = "", id, idPrefix = "", items = [], title = "Contents", ...attributes }) => {
1210
+ const filteredItems = items.filter(Boolean); // filter out any falsy items in a cleaner way
1211
+ const renderTab = (item, index) => {
1212
+ const tabId = item.id || `${idPrefix}-${index + 1}`;
1213
+ return (jsx("li", { className: `govuk-tabs__list-item ${index === 0 ? "govuk-tabs__list-item--selected" : ""}`, children: jsx("a", { className: "govuk-tabs__tab", href: `#${tabId}`, ...item, children: item.label }) }, tabId));
1214
+ };
1215
+ const renderPanel = (item, index) => {
1216
+ const panelId = item.id || `${idPrefix}-${index + 1}`;
1217
+ return (jsx("div", { id: panelId, className: `govuk-tabs__panel ${index > 0 ? "govuk-tabs__panel--hidden" : ""}`, ...item.panel }, panelId));
1218
+ };
1219
+ return (jsxs("div", { id: id, className: `govuk-tabs ${className}`, ...attributes, "data-module": "govuk-tabs", children: [jsx("h2", { className: "govuk-tabs__title", children: title }), filteredItems.length > 0 && (jsxs(Fragment, { children: [jsx("ul", { className: "govuk-tabs__list", children: filteredItems.map(renderTab) }), filteredItems.map(renderPanel)] }))] }));
1220
+ };
1221
+
1222
+ function ConfigureOverallTabs($scope) {
1223
+ createAll(Tabs$1, undefined, $scope);
1224
+ }
1225
+
1226
+ const TaskList = (props) => {
1227
+ const { className, idPrefix, items, ...attributes } = props;
1228
+ const renderTaskListItem = (item, index) => {
1229
+ if (!item)
1230
+ return null;
1231
+ const { title, hint, status, href, ...attributes } = item;
1232
+ const itemId = `${idPrefix}-${index + 1}`;
1233
+ return (jsxs("li", { id: itemId, className: "govuk-task-list__item govuk-task-list__item--with-link", ...attributes, children: [jsxs("div", { className: "govuk-task-list__name-and-hint", children: [jsx(LinkWithRef, { className: "govuk-link govuk-task-list__link", href: href, "aria-describedby": `${itemId}-status`, children: title.children }), hint ? (jsx(Hint, { id: `${itemId}-hint`, className: "govuk-task-list__hint", ...hint })) : null] }), jsx("div", { className: "govuk-task-list__status", id: `${itemId}-status`, children: status.tag ? jsx(Tag, { ...status.tag }) : status.children })] }, itemId));
1234
+ };
1235
+ return (jsx("ul", { className: `govuk-task-list ${className || ""}`, ...attributes, children: items.map(renderTaskListItem) }));
1236
+ };
1237
+
1238
+ const WarningInfo = ({ messageHeading = "Warning or Info Heading", message = "Warning or Info Heading message", advice = "Try again later.", applicationName = "Document and plan retrieval system", applicationRoute = "/", basePageName = "dashboard", }) => {
1239
+ let determineMessage;
1240
+ const { state } = useLocation();
1241
+ if (state && state.message) {
1242
+ determineMessage = state.message;
1243
+ }
1244
+ else {
1245
+ determineMessage = message;
1246
+ }
1247
+ let determineMessageHeading;
1248
+ if (state && state.messageHeading) {
1249
+ determineMessageHeading = state.messageHeading;
1250
+ }
1251
+ else {
1252
+ determineMessageHeading = messageHeading;
1253
+ }
1254
+ let determineAdvice;
1255
+ if (state && state.advice) {
1256
+ determineAdvice = state.advice;
1257
+ }
1258
+ else {
1259
+ determineAdvice = advice;
1260
+ }
1261
+ let determineApplicationName;
1262
+ if (state && state.applicationName) {
1263
+ determineApplicationName = state.applicationName;
1264
+ }
1265
+ else {
1266
+ determineApplicationName = applicationName;
1267
+ }
1268
+ const refreshPage = () => {
1269
+ if (window.location.pathname === "/") {
1270
+ window.location.reload();
1271
+ }
1272
+ };
1273
+ const hasMessage = () => {
1274
+ return determineMessage?.length > 0;
1275
+ };
1276
+ return (jsx(Main, { children: jsxs(Fragment, { children: [jsx("h1", { className: "govuk-heading-xl", children: determineMessageHeading }), hasMessage() && (jsxs("div", { className: "govuk-warning-text", children: [jsx("span", { className: "govuk-warning-text__icon", "aria-hidden": "true", children: "!" }), jsxs("strong", { className: "govuk-warning-text__text", children: [jsx("span", { className: "govuk-visually-hidden", children: "Warning" }), determineMessage] })] })), jsx("p", { className: "govuk-body", children: determineAdvice }), jsxs("p", { className: "govuk-body", children: ["You can go back to", " ", jsx(LinkWithRef, { className: "govuk-link", to: applicationRoute, onClick: () => refreshPage(), children: determineApplicationName }), " ", basePageName, "."] })] }) }));
1277
+ };
1278
+
1279
+ const WarningText = ({ children = "Warning message", className, ...attributes }) => {
1280
+ return (jsxs("div", { className: `govuk-warning-text ${className || ""}`, ...attributes, children: [jsx("span", { className: "govuk-warning-text__icon", "aria-hidden": "true", children: "!" }), jsxs("strong", { className: "govuk-warning-text__text", children: [jsx("span", { className: "govuk-visually-hidden", children: "Warning" }), children] })] }));
1281
+ };
1282
+
1283
+ export { Accordion, ActionLink, BackLink, Boolean$1 as Boolean, Breadcrumbs, Button, CardColumn, CardLayout, CharacterCount, Checkboxes as Checkbox, ConfigureOverallAccordion, ConfigureOverallButton, ConfigureOverallCheckboxes, ConfigureOverallErrorSummary, ConfigureOverallHeader, ConfigureOverallRadios, ConfigureOverallSkipLink, ConfigureOverallTabs, CookieBanner, DataNavigation, DateInput, Details, DifferenceNavigation, ErrorBoundary, ErrorMessage, ErrorSummary, ExtractAccordionConfigFromAttributes, Fieldset, FileUpload, Footer, Header, Hint, Input, InsetText, Label, Landing, LinkWithRef, Loading, Main, NotFoundPage, NotificationBanner, PDFViewer, PDFViewerBackend, Pagination, Panel, PhaseBanner, ProblemWithService, Radios, Select, ServiceNavigation, SkipLink, SummaryList, Table, Tabs, Tag, TaskList, Textarea, WarningInfo, WarningText };
1284
+ //# sourceMappingURL=index.esm.js.map