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