@hmlr/govuk-react-components-library 1.2.2 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (209) hide show
  1. package/README.md +6 -8
  2. package/dist/PDFViewerCanvas.cjs.js +4 -3
  3. package/dist/PDFViewerCanvas.cjs.js.map +1 -1
  4. package/dist/PDFViewerCanvas.esm.js +4 -3
  5. package/dist/PDFViewerCanvas.esm.js.map +1 -1
  6. package/dist/index.cjs.css +127 -134
  7. package/dist/index.cjs.js +52 -27
  8. package/dist/index.cjs.js.map +1 -1
  9. package/dist/index.d.ts +31 -62
  10. package/dist/index.esm.css +127 -134
  11. package/dist/index.esm.js +52 -27
  12. package/dist/index.esm.js.map +1 -1
  13. package/dist/types/PDFViewerCanvas.d.ts +1 -0
  14. package/dist/types/components/Accordion/Accordion.config.d.ts +5 -0
  15. package/dist/types/components/Accordion/Accordion.d.ts +4 -0
  16. package/dist/types/components/Accordion/Accordion.types.d.ts +20 -0
  17. package/dist/types/components/Accordion/index.d.ts +2 -0
  18. package/dist/types/components/ActionLink/ActionLink.d.ts +4 -0
  19. package/dist/types/components/ActionLink/ActionLink.types.d.ts +13 -0
  20. package/dist/types/components/ActionLink/index.d.ts +1 -0
  21. package/dist/types/components/BackLink/BackLink.d.ts +4 -0
  22. package/dist/types/components/BackLink/BackLink.types.d.ts +9 -0
  23. package/dist/types/components/BackLink/index.d.ts +1 -0
  24. package/dist/types/components/Boolean/Boolean.d.ts +4 -0
  25. package/dist/types/components/Boolean/Boolean.types.d.ts +37 -0
  26. package/dist/types/components/Boolean/OmitKey.d.ts +5 -0
  27. package/dist/types/components/Boolean/index.d.ts +1 -0
  28. package/dist/types/components/Breadcrumbs/Breadcrumbs.d.ts +4 -0
  29. package/dist/types/components/Breadcrumbs/Breadcrumbs.types.d.ts +13 -0
  30. package/dist/types/components/Breadcrumbs/index.d.ts +1 -0
  31. package/dist/types/components/Button/Button.config.d.ts +2 -0
  32. package/dist/types/components/Button/Button.d.ts +4 -0
  33. package/dist/types/components/Button/Button.types.d.ts +13 -0
  34. package/dist/types/components/Button/index.d.ts +2 -0
  35. package/dist/types/components/CardColumn/CardColumn.d.ts +5 -0
  36. package/dist/types/components/CardColumn/CardColumn.types.d.ts +25 -0
  37. package/dist/types/components/CardColumn/index.d.ts +1 -0
  38. package/dist/types/components/CardLayout/CardLayout.d.ts +4 -0
  39. package/dist/types/components/CardLayout/CardLayout.types.d.ts +5 -0
  40. package/dist/types/components/CardLayout/index.d.ts +1 -0
  41. package/dist/types/components/CharacterCount/CharacterCount.config.d.ts +2 -0
  42. package/dist/types/components/CharacterCount/CharacterCount.d.ts +4 -0
  43. package/dist/types/components/CharacterCount/CharacterCount.types.d.ts +12 -0
  44. package/dist/types/components/CharacterCount/index.d.ts +1 -0
  45. package/dist/types/components/Checkboxes/Checkboxes.config.d.ts +1 -0
  46. package/dist/types/components/Checkboxes/Checkboxes.d.ts +4 -0
  47. package/dist/types/components/Checkboxes/Checkboxes.types.d.ts +3 -0
  48. package/dist/types/components/Checkboxes/index.d.ts +2 -0
  49. package/dist/types/components/CookieBanner/CookieBanner.d.ts +4 -0
  50. package/dist/types/components/CookieBanner/CookieBanner.types.d.ts +21 -0
  51. package/dist/types/components/CookieBanner/index.d.ts +1 -0
  52. package/dist/types/components/DataNavigation/DataNavigation.d.ts +4 -0
  53. package/dist/types/components/DataNavigation/DataNavigation.types.d.ts +34 -0
  54. package/dist/types/components/DataNavigation/index.d.ts +1 -0
  55. package/dist/types/components/DateInput/DateInput.d.ts +4 -0
  56. package/dist/types/components/DateInput/DateInput.types.d.ts +27 -0
  57. package/dist/types/components/DateInput/index.d.ts +1 -0
  58. package/dist/types/components/Details/Details.d.ts +4 -0
  59. package/dist/types/components/Details/Details.types.d.ts +5 -0
  60. package/dist/types/components/Details/index.d.ts +1 -0
  61. package/dist/types/components/DifferenceNavigation/DifferenceNavigation.d.ts +4 -0
  62. package/dist/types/components/DifferenceNavigation/DifferenceNavigation.types.d.ts +32 -0
  63. package/dist/types/components/DifferenceNavigation/index.d.ts +1 -0
  64. package/dist/types/components/ErrorBoundary/ErrorBoundary.d.ts +9 -0
  65. package/dist/types/components/ErrorBoundary/ErrorBoundary.types.d.ts +11 -0
  66. package/dist/types/components/ErrorBoundary/index.d.ts +1 -0
  67. package/dist/types/components/ErrorMessage/ErrorMessage.d.ts +4 -0
  68. package/dist/types/components/ErrorMessage/ErrorMessage.types.d.ts +6 -0
  69. package/dist/types/components/ErrorMessage/index.d.ts +1 -0
  70. package/dist/types/components/ErrorSummary/ErrorSummary.config.d.ts +2 -0
  71. package/dist/types/components/ErrorSummary/ErrorSummary.d.ts +4 -0
  72. package/dist/types/components/ErrorSummary/ErrorSummary.types.d.ts +13 -0
  73. package/dist/types/components/ErrorSummary/index.d.ts +2 -0
  74. package/dist/types/components/ExitThisPage/ExitThisPage.config.d.ts +1 -0
  75. package/dist/types/components/ExitThisPage/ExitThisPage.d.ts +4 -0
  76. package/dist/types/components/ExitThisPage/ExitThisPage.types.d.ts +17 -0
  77. package/dist/types/components/ExitThisPage/index.d.ts +2 -0
  78. package/dist/types/components/Fieldset/Fieldset.d.ts +4 -0
  79. package/dist/types/components/Fieldset/Fieldset.types.d.ts +12 -0
  80. package/dist/types/components/Fieldset/index.d.ts +1 -0
  81. package/dist/types/components/FileUpload/FileUpload.d.ts +4 -0
  82. package/dist/types/components/FileUpload/FileUpload.types.d.ts +13 -0
  83. package/dist/types/components/FileUpload/index.d.ts +1 -0
  84. package/dist/types/components/Footer/Footer.d.ts +4 -0
  85. package/dist/types/components/Footer/Footer.types.d.ts +40 -0
  86. package/dist/types/components/Footer/index.d.ts +1 -0
  87. package/dist/types/components/Header/Header.config.d.ts +1 -0
  88. package/dist/types/components/Header/Header.d.ts +4 -0
  89. package/dist/types/components/Header/Header.types.d.ts +28 -0
  90. package/dist/types/components/Header/index.d.ts +2 -0
  91. package/dist/types/components/Hint/Hint.d.ts +4 -0
  92. package/dist/types/components/Hint/Hint.types.d.ts +4 -0
  93. package/dist/types/components/Hint/index.d.ts +1 -0
  94. package/dist/types/components/Input/Input.d.ts +4 -0
  95. package/dist/types/components/Input/Input.types.d.ts +17 -0
  96. package/dist/types/components/Input/index.d.ts +1 -0
  97. package/dist/types/components/InsetText/InsetText.d.ts +4 -0
  98. package/dist/types/components/InsetText/InsetText.types.d.ts +4 -0
  99. package/dist/types/components/InsetText/index.d.ts +1 -0
  100. package/dist/types/components/Label/Label.d.ts +4 -0
  101. package/dist/types/components/Label/Label.types.d.ts +6 -0
  102. package/dist/types/components/Label/index.d.ts +1 -0
  103. package/dist/types/components/Landing/Landing.d.ts +4 -0
  104. package/dist/types/components/Landing/Landing.types.d.ts +4 -0
  105. package/dist/types/components/Landing/index.d.ts +1 -0
  106. package/dist/types/components/LinkWithRef/LinkWithRef.d.ts +4 -0
  107. package/dist/types/components/LinkWithRef/LinkWithRef.types.d.ts +9 -0
  108. package/dist/types/components/LinkWithRef/index.d.ts +1 -0
  109. package/dist/types/components/Loading/Loading.d.ts +5 -0
  110. package/dist/types/components/Loading/Loading.types.d.ts +4 -0
  111. package/dist/types/components/Loading/index.d.ts +1 -0
  112. package/dist/types/components/Main/Main.d.ts +4 -0
  113. package/dist/types/components/Main/Main.types.d.ts +5 -0
  114. package/dist/types/components/Main/index.d.ts +1 -0
  115. package/dist/types/components/NotFoundPage/NotFoundPage.d.ts +3 -0
  116. package/dist/types/components/NotFoundPage/index.d.ts +1 -0
  117. package/dist/types/components/NotificationBanner/NotificationBanner.config.d.ts +2 -0
  118. package/dist/types/components/NotificationBanner/NotificationBanner.d.ts +4 -0
  119. package/dist/types/components/NotificationBanner/NotificationBanner.types.d.ts +12 -0
  120. package/dist/types/components/NotificationBanner/index.d.ts +1 -0
  121. package/dist/types/components/PDFViewer/ObjectToQueryString.d.ts +1 -0
  122. package/dist/types/components/PDFViewer/PDFViewer.d.ts +4 -0
  123. package/dist/types/components/PDFViewer/PDFViewer.types.d.ts +25 -0
  124. package/dist/types/components/PDFViewer/PDFViewerBackend.d.ts +2 -0
  125. package/dist/types/components/PDFViewer/ResolvePDFSource.d.ts +27 -0
  126. package/dist/types/components/PDFViewer/Slugify.d.ts +1 -0
  127. package/dist/types/components/PDFViewer/index.d.ts +2 -0
  128. package/dist/types/components/PDFViewer/testutilities/SampleBase64.d.ts +44 -0
  129. package/dist/types/components/PDFViewerCanvas/PDFViewerCanvas.d.ts +9 -0
  130. package/dist/types/components/PDFViewerCanvas/PDFViewerCanvas.types.d.ts +38 -0
  131. package/dist/types/components/PDFViewerCanvas/index.d.ts +1 -0
  132. package/dist/types/components/Pagination/NavigationButton.d.ts +3 -0
  133. package/dist/types/components/Pagination/Pagination.d.ts +4 -0
  134. package/dist/types/components/Pagination/Pagination.types.d.ts +32 -0
  135. package/dist/types/components/Pagination/SvgIcon.d.ts +3 -0
  136. package/dist/types/components/Pagination/UsePagination.d.ts +9 -0
  137. package/dist/types/components/Pagination/index.d.ts +3 -0
  138. package/dist/types/components/Panel/Panel.d.ts +4 -0
  139. package/dist/types/components/Panel/Panel.types.d.ts +7 -0
  140. package/dist/types/components/Panel/index.d.ts +1 -0
  141. package/dist/types/components/PasswordInput/PasswordInput.config.d.ts +1 -0
  142. package/dist/types/components/PasswordInput/PasswordInput.d.ts +4 -0
  143. package/dist/types/components/PasswordInput/PasswordInput.types.d.ts +35 -0
  144. package/dist/types/components/PasswordInput/index.d.ts +2 -0
  145. package/dist/types/components/PhaseBanner/PhaseBanner.d.ts +4 -0
  146. package/dist/types/components/PhaseBanner/PhaseBanner.types.d.ts +6 -0
  147. package/dist/types/components/PhaseBanner/index.d.ts +1 -0
  148. package/dist/types/components/ProblemWithService/ProblemWithService.d.ts +4 -0
  149. package/dist/types/components/ProblemWithService/ProblemWithService.types.d.ts +7 -0
  150. package/dist/types/components/ProblemWithService/index.d.ts +1 -0
  151. package/dist/types/components/Radios/Radios.config.d.ts +1 -0
  152. package/dist/types/components/Radios/Radios.d.ts +4 -0
  153. package/dist/types/components/Radios/Radios.types.d.ts +7 -0
  154. package/dist/types/components/Radios/index.d.ts +2 -0
  155. package/dist/types/components/Select/Select.d.ts +4 -0
  156. package/dist/types/components/Select/Select.types.d.ts +19 -0
  157. package/dist/types/components/Select/index.d.ts +1 -0
  158. package/dist/types/components/ServiceNavigation/ServiceNavigation.d.ts +4 -0
  159. package/dist/types/components/ServiceNavigation/ServiceNavigation.types.d.ts +21 -0
  160. package/dist/types/components/ServiceNavigation/index.d.ts +1 -0
  161. package/dist/types/components/SkipLink/SkipLink.config.d.ts +1 -0
  162. package/dist/types/components/SkipLink/SkipLink.d.ts +4 -0
  163. package/dist/types/components/SkipLink/SkipLink.types.d.ts +5 -0
  164. package/dist/types/components/SkipLink/index.d.ts +2 -0
  165. package/dist/types/components/SummaryList/SummaryList.d.ts +4 -0
  166. package/dist/types/components/SummaryList/SummaryList.types.d.ts +22 -0
  167. package/dist/types/components/SummaryList/index.d.ts +1 -0
  168. package/dist/types/components/Table/Table.d.ts +4 -0
  169. package/dist/types/components/Table/Table.types.d.ts +21 -0
  170. package/dist/types/components/Table/index.d.ts +1 -0
  171. package/dist/types/components/Tabs/Tabs.config.d.ts +1 -0
  172. package/dist/types/components/Tabs/Tabs.d.ts +4 -0
  173. package/dist/types/components/Tabs/Tabs.types.d.ts +14 -0
  174. package/dist/types/components/Tabs/index.d.ts +2 -0
  175. package/dist/types/components/Tag/Tag.d.ts +4 -0
  176. package/dist/types/components/Tag/Tag.types.d.ts +4 -0
  177. package/dist/types/components/Tag/index.d.ts +1 -0
  178. package/dist/types/components/TaskList/TaskList.d.ts +4 -0
  179. package/dist/types/components/TaskList/TaskList.types.d.ts +21 -0
  180. package/dist/types/components/TaskList/index.d.ts +1 -0
  181. package/dist/types/components/Textarea/Textarea.d.ts +4 -0
  182. package/dist/types/components/Textarea/Textarea.types.d.ts +14 -0
  183. package/dist/types/components/Textarea/index.d.ts +1 -0
  184. package/dist/types/components/WarningInfo/WarningInfo.d.ts +4 -0
  185. package/dist/types/components/WarningInfo/WarningInfo.types.d.ts +8 -0
  186. package/dist/types/components/WarningInfo/index.d.ts +1 -0
  187. package/dist/types/components/WarningText/WarningText.d.ts +4 -0
  188. package/dist/types/components/WarningText/WarningText.types.d.ts +4 -0
  189. package/dist/types/components/WarningText/index.d.ts +1 -0
  190. package/dist/types/components/common.types.d.ts +10 -0
  191. package/dist/types/components/index.d.ts +51 -0
  192. package/dist/types/dynamics/index.d.ts +3 -0
  193. package/dist/types/dynamics/types.d.ts +37 -0
  194. package/dist/types/index.d.ts +1 -0
  195. package/dist/types/utils/ProcessExampleData.d.ts +3 -0
  196. package/dist/types/utils/StoriesFromFixtures.d.ts +5 -0
  197. package/dist/types/utils/TitleCase.d.ts +2 -0
  198. package/dist/types/utils/WithReference.d.ts +5 -0
  199. package/dist/types/utils/WithReference.types.d.ts +15 -0
  200. package/package.json +86 -58
  201. package/.gitattributes +0 -5
  202. package/.nvmrc +0 -1
  203. package/.stylelintrc.json +0 -8
  204. package/assets/Advance-submodule-behaviours.png +0 -0
  205. package/assets/logo.png +0 -0
  206. package/assets/uml-diagram.svg +0 -2745
  207. package/bundle-analysis-main.html +0 -4949
  208. package/bundle-analysis-pdfvc.html +0 -4949
  209. package/scripts/generateStories.mjs +0 -433
package/dist/index.esm.js CHANGED
@@ -229,7 +229,7 @@ const Button = (props) => {
229
229
  iconHtml = (jsx("svg", { className: "govuk-button__start-icon", xmlns: "http://www.w3.org/2000/svg", width: "17.5", height: "19", viewBox: "0 0 33 40", "aria-hidden": "true", focusable: "false", children: jsx("path", { fill: "currentColor", d: "M0 0h13l20 20-20 20H0l20-20z" }) }));
230
230
  }
231
231
  const commonAttributes = {
232
- className: `govuk-button ${className || ""}${disabled ? " govuk-button--disabled" : ""} ${isStartButton ? "govuk-button--start" : ""}`,
232
+ className: `govuk-button ${className || ""} ${isStartButton ? "govuk-button--start" : ""}`,
233
233
  // ref: buttonRef,
234
234
  };
235
235
  if (preventDoubleClick) {
@@ -613,28 +613,36 @@ const defaultProps$1 = {
613
613
  name: "",
614
614
  };
615
615
  const Textarea = React__default.forwardRef((props = defaultProps$1, ref) => {
616
- const { className, "aria-describedby": describedBy, errorMessage, formGroup, hint, label, id, ...attributes } = props;
616
+ const { className, "aria-describedby": describedBy, errorMessage, formGroup, hint, label, id, name, ...attributes } = props;
617
+ // Mirrors govuk-frontend's Nunjucks macro, which defaults id to name when
618
+ // id isn't given - without this the textarea has no id, so its <label for>
619
+ // (and hint/error aria-describedby) can never associate with it.
620
+ const resolvedId = id || name;
617
621
  let describedByValue = describedBy || "";
618
622
  let hintComponent = null;
619
623
  let errorMessageComponent = null;
620
624
  if (hint) {
621
- const hintId = `${id}-hint`;
625
+ const hintId = `${resolvedId}-hint`;
622
626
  describedByValue += ` ${hintId}`;
623
627
  hintComponent = jsx(Hint, { ...hint, id: hintId });
624
628
  }
625
629
  if (errorMessage) {
626
- const errorId = id ? `${id}-error` : "";
630
+ const errorId = resolvedId ? `${resolvedId}-error` : "";
627
631
  describedByValue += ` ${errorId}`;
628
632
  errorMessageComponent = jsx(ErrorMessage, { ...errorMessage, id: errorId });
629
633
  }
630
- return (jsxs("div", { className: `govuk-form-group${errorMessage ? " govuk-form-group--error" : ""} ${formGroup?.className || ""}`, children: [jsx(Label, { ...label, htmlFor: id }), hintComponent, errorMessageComponent, jsx("textarea", { ...attributes, id: id, ref: ref, className: `govuk-textarea${errorMessage ? " govuk-textarea--error" : ""} ${className || ""}`, "aria-describedby": describedByValue?.trim() || undefined })] }));
634
+ return (jsxs("div", { className: `govuk-form-group${errorMessage ? " govuk-form-group--error" : ""} ${formGroup?.className || ""}`, children: [jsx(Label, { ...label, htmlFor: resolvedId }), hintComponent, errorMessageComponent, jsx("textarea", { name: name, ...attributes, id: resolvedId, ref: ref, className: `govuk-textarea${errorMessage ? " govuk-textarea--error" : ""} ${className || ""}`, "aria-describedby": describedByValue?.trim() || undefined })] }));
631
635
  });
632
636
  Textarea.displayName = "Textarea";
633
637
 
634
638
  const CharacterCount = (props) => {
635
- const { id, className, maxlength, threshold, maxwords, errorMessage, countMessage, ...attributes } = props;
636
- const characterCountInfoId = `${id}-info`;
637
- return (jsxs("div", { className: "govuk-character-count", "data-module": "govuk-character-count", "data-maxlength": maxlength, "data-threshold": threshold, "data-maxwords": maxwords, children: [jsx(Textarea, { id: id, ...attributes, errorMessage: errorMessage, className: `govuk-js-character-count ${className || ""}${errorMessage ? " govuk-textarea--error" : ""}`, "aria-describedby": characterCountInfoId }), jsxs(Hint, { id: characterCountInfoId, className: `govuk-hint govuk-character-count__message ${countMessage?.className || ""}`, "aria-live": "polite", children: ["You have ", maxlength || maxwords, " ", maxwords ? "words" : "characters", " ", "remaining"] })] }));
639
+ const { id, name, className, maxlength, threshold, maxwords, errorMessage, countMessage, ...attributes } = props;
640
+ // Mirrors govuk-frontend's Nunjucks macro, which defaults id to name when
641
+ // id isn't given - without this the count message's id (referenced by the
642
+ // textarea's aria-describedby) would render as literally "undefined-info".
643
+ const resolvedId = id || name;
644
+ const characterCountInfoId = `${resolvedId}-info`;
645
+ return (jsxs("div", { className: "govuk-character-count", "data-module": "govuk-character-count", "data-maxlength": maxlength, "data-threshold": threshold, "data-maxwords": maxwords, children: [jsx(Textarea, { id: resolvedId, name: name, ...attributes, errorMessage: errorMessage, className: `govuk-js-character-count ${className || ""}${errorMessage ? " govuk-textarea--error" : ""}`, "aria-describedby": characterCountInfoId }), jsxs(Hint, { id: characterCountInfoId, className: `govuk-hint govuk-character-count__message ${countMessage?.className || ""}`, "aria-live": "polite", children: ["You have ", maxlength || maxwords, " ", maxwords ? "words" : "characters", " ", "remaining"] })] }));
638
646
  };
639
647
  CharacterCount.displayName = "CharacterCount";
640
648
 
@@ -682,21 +690,25 @@ const defaultProps = {
682
690
  };
683
691
  const Input = React__default.forwardRef((props = defaultProps, ref) => {
684
692
  const { className, "aria-describedby": describedBy, errorMessage, formGroup, hint, label, name, id, prefix, suffix, ...attributes } = props;
693
+ // Mirrors govuk-frontend's Nunjucks macro, which defaults id to name when
694
+ // id isn't given - without this the input has no id, so its <label for>
695
+ // (and hint/error aria-describedby) can never associate with it.
696
+ const resolvedId = id || name;
685
697
  let describedByValue = describedBy || "";
686
698
  let hintComponent = null;
687
699
  let errorMessageComponent = null;
688
700
  if (hint) {
689
- const hintId = `${id}-hint`;
701
+ const hintId = `${resolvedId}-hint`;
690
702
  describedByValue += ` ${hintId}`;
691
703
  hintComponent = jsx(Hint, { ...hint, id: hintId });
692
704
  }
693
705
  if (errorMessage) {
694
- const errorId = id ? `${id}-error` : "";
706
+ const errorId = resolvedId ? `${resolvedId}-error` : "";
695
707
  describedByValue += ` ${errorId}`;
696
708
  errorMessageComponent = jsx(ErrorMessage, { ...errorMessage, id: errorId });
697
709
  }
698
- const input = (jsx("input", { ref: ref, id: id, className: `govuk-input ${className || ""} ${errorMessage ? " govuk-input--error" : ""}`, name: name || id, "aria-describedby": describedByValue || undefined, ...attributes }));
699
- return (jsxs("div", { className: `govuk-form-group ${formGroup?.className || ""} ${errorMessage ? "govuk-form-group--error" : ""}`, children: [jsx(Label, { ...label, htmlFor: id }), hintComponent, errorMessageComponent, prefix || suffix ? (jsxs("div", { className: "govuk-input__wrapper", children: [prefix ? (jsx("div", { "aria-hidden": "true", ...prefix,
710
+ const input = (jsx("input", { ref: ref, id: resolvedId, className: `govuk-input ${className || ""} ${errorMessage ? " govuk-input--error" : ""}`, name: name || resolvedId, "aria-describedby": describedByValue || undefined, ...attributes }));
711
+ return (jsxs("div", { className: `govuk-form-group ${formGroup?.className || ""} ${errorMessage ? "govuk-form-group--error" : ""}`, children: [jsx(Label, { ...label, htmlFor: resolvedId }), hintComponent, errorMessageComponent, prefix || suffix ? (jsxs("div", { className: "govuk-input__wrapper", children: [prefix ? (jsx("div", { "aria-hidden": "true", ...prefix,
700
712
  className: `govuk-input__prefix ${prefix.className ? prefix.className : ""}` })) : null, input, suffix ? (jsx("div", { "aria-hidden": "true", ...suffix,
701
713
  className: `govuk-input__suffix ${suffix.className ? suffix.className : ""}` })) : null] })) : (input)] }));
702
714
  });
@@ -877,21 +889,25 @@ function ConfigureOverallExitThisPage($scope) {
877
889
  }
878
890
 
879
891
  const FileUpload = (props) => {
880
- const { className, errorMessage, formGroup, hint, label, "aria-describedby": describedBy, id, ...attributes } = props;
892
+ const { className, errorMessage, formGroup, hint, label, "aria-describedby": describedBy, id, name, ...attributes } = props;
893
+ // Mirrors govuk-frontend's Nunjucks macro, which defaults id to name when
894
+ // id isn't given - without this the input has no id, so its <label for>
895
+ // (and hint/error aria-describedby) can never associate with it.
896
+ const resolvedId = id || name;
881
897
  let hintComponent;
882
898
  let errorMessageComponent;
883
899
  let describedByValue = describedBy || "";
884
900
  if (hint) {
885
- const hintId = `${props.id}-hint`;
901
+ const hintId = `${resolvedId}-hint`;
886
902
  describedByValue += ` ${hintId}`;
887
- hintComponent = jsx(Hint, { ...props.hint, id: hintId });
903
+ hintComponent = jsx(Hint, { ...hint, id: hintId });
888
904
  }
889
905
  if (errorMessage) {
890
- const errorId = `${id}-error`;
906
+ const errorId = `${resolvedId}-error`;
891
907
  describedByValue += ` ${errorId}`;
892
908
  errorMessageComponent = jsx(ErrorMessage, { ...errorMessage, id: errorId });
893
909
  }
894
- return (jsxs("div", { className: `govuk-form-group${errorMessage ? " govuk-form-group--error" : ""} ${formGroup?.className || ""}`, children: [jsx(Label, { ...label, htmlFor: id }), hintComponent, errorMessageComponent, jsx("input", { ...attributes, id: id, className: `govuk-file-upload ${className || ""}${errorMessage ? " govuk-file-upload--error" : ""}`, type: "file", "aria-describedby": describedByValue || undefined })] }));
910
+ return (jsxs("div", { className: `govuk-form-group${errorMessage ? " govuk-form-group--error" : ""} ${formGroup?.className || ""}`, children: [jsx(Label, { ...label, htmlFor: resolvedId }), hintComponent, errorMessageComponent, jsx("input", { name: name, ...attributes, id: resolvedId, className: `govuk-file-upload ${className || ""}${errorMessage ? " govuk-file-upload--error" : ""}`, type: "file", "aria-describedby": describedByValue || undefined })] }));
895
911
  };
896
912
  FileUpload.displayName = "FileUpload";
897
913
 
@@ -1052,7 +1068,7 @@ const Pagination = ({ previous, next, items, className, }) => {
1052
1068
  // Block layout is used when there are no numbered page items — govuk renders
1053
1069
  // the nav with an extra class and the link title with --decorated modifier.
1054
1070
  const isBlockLayout = !items || items.length === 0;
1055
- return (jsxs("nav", { className: `govuk-pagination${isBlockLayout ? " govuk-pagination--block" : ""}${className ? ` ${className}` : ""}`, role: "navigation", "aria-label": "Pagination", children: [previous && (jsx("div", { className: "govuk-pagination__prev", children: jsx(NavigationButton, { type: "previous", ...previous }) })), items && items.length > 0 && (jsx("ul", { className: "govuk-pagination__list", children: items.map((item, index) => item.ellipsis ? (jsx("li", { className: "govuk-pagination__item govuk-pagination__item--ellipses", children: DOTS }, index)) : (jsx("li", { className: `govuk-pagination__item${item.current ? " govuk-pagination__item--current" : ""}`, children: jsx("a", { className: "govuk-link govuk-pagination__link", href: item.href ?? "#", "aria-label": `Page ${item.number}`, ...(item.current ? { "aria-current": "page" } : {}), children: item.number }) }, index))) })), next && (jsx("div", { className: "govuk-pagination__next", children: jsx(NavigationButton, { type: "next", ...next }) }))] }));
1071
+ return (jsxs("nav", { className: `govuk-pagination${isBlockLayout ? " govuk-pagination--block" : ""}${className ? ` ${className}` : ""}`, role: "navigation", "aria-label": "Pagination", children: [previous && (jsx("div", { className: "govuk-pagination__prev", children: jsx(NavigationButton, { type: "previous", ...previous }) })), items && items.length > 0 && (jsx("ul", { className: "govuk-pagination__list", children: items.map((item, index) => item.ellipsis ? (jsx("li", { className: "govuk-pagination__item govuk-pagination__item--ellipsis", children: DOTS }, index)) : (jsx("li", { className: `govuk-pagination__item${item.current ? " govuk-pagination__item--current" : ""}`, children: jsx("a", { className: "govuk-link govuk-pagination__link", href: item.href ?? "#", "aria-label": `Page ${item.number}`, ...(item.current ? { "aria-current": "page" } : {}), children: item.number }) }, index))) })), next && (jsx("div", { className: "govuk-pagination__next", children: jsx(NavigationButton, { type: "next", ...next }) }))] }));
1056
1072
  };
1057
1073
 
1058
1074
  const Panel = (props) => {
@@ -1063,16 +1079,21 @@ const Panel = (props) => {
1063
1079
 
1064
1080
  const PasswordInput = React__default.forwardRef((props, ref) => {
1065
1081
  const { className, "aria-describedby": describedBy, errorMessage, formGroup, hint, label, name, id, autoComplete = "current-password", showPasswordText = "Show", hidePasswordText = "Hide", showPasswordAriaLabelText = "Show password", hidePasswordAriaLabelText = "Hide password", passwordShownAnnouncementText, passwordHiddenAnnouncementText, ...attributes } = props;
1082
+ // Mirrors govuk-frontend's Nunjucks macro, which defaults id to name
1083
+ // when id isn't given - without this the input has no id, so its
1084
+ // <label for> (and hint/error aria-describedby) can never associate
1085
+ // with it.
1086
+ const resolvedId = id || name;
1066
1087
  let describedByValue = describedBy || "";
1067
1088
  let hintComponent = null;
1068
1089
  let errorMessageComponent = null;
1069
1090
  if (hint) {
1070
- const hintId = `${id}-hint`;
1091
+ const hintId = `${resolvedId}-hint`;
1071
1092
  describedByValue += ` ${hintId}`;
1072
1093
  hintComponent = jsx(Hint, { ...hint, id: hintId });
1073
1094
  }
1074
1095
  if (errorMessage) {
1075
- const errorId = id ? `${id}-error` : "";
1096
+ const errorId = resolvedId ? `${resolvedId}-error` : "";
1076
1097
  describedByValue += ` ${errorId}`;
1077
1098
  errorMessageComponent = jsx(ErrorMessage, { ...errorMessage, id: errorId });
1078
1099
  }
@@ -1095,8 +1116,8 @@ const PasswordInput = React__default.forwardRef((props, ref) => {
1095
1116
  i18nProps["data-i18n.password-hidden-announcement"] =
1096
1117
  passwordHiddenAnnouncementText;
1097
1118
  // Label handles isPageHeading internally — no extra wrapper needed here
1098
- const labelEl = jsx(Label, { ...label, htmlFor: id });
1099
- return (jsxs("div", { className: `govuk-form-group${formGroup?.className ? ` ${formGroup.className}` : ""}${errorMessage ? " govuk-form-group--error" : ""} govuk-password-input`, "data-module": "govuk-password-input", ...i18nProps, children: [labelEl, hintComponent, errorMessageComponent, jsxs("div", { className: "govuk-input__wrapper govuk-password-input__wrapper", children: [jsx("input", { ref: ref, id: id, className: `govuk-input govuk-password-input__input govuk-js-password-input-input${className ? ` ${className}` : ""}${errorMessage ? " govuk-input--error" : ""}`, name: name || id, type: "password", spellCheck: false, autoComplete: autoComplete, autoCapitalize: "none", "aria-describedby": describedByValue.trim() || undefined, ...attributes }), jsx("button", { type: "button", className: "govuk-button govuk-button--secondary govuk-password-input__toggle govuk-js-password-input-toggle", "data-module": "govuk-button", "aria-controls": id, "aria-label": showPasswordAriaLabelText, hidden: true, children: showPasswordText })] })] }));
1119
+ const labelEl = jsx(Label, { ...label, htmlFor: resolvedId });
1120
+ return (jsxs("div", { className: `govuk-form-group${formGroup?.className ? ` ${formGroup.className}` : ""}${errorMessage ? " govuk-form-group--error" : ""} govuk-password-input`, "data-module": "govuk-password-input", ...i18nProps, children: [labelEl, hintComponent, errorMessageComponent, jsxs("div", { className: "govuk-input__wrapper govuk-password-input__wrapper", children: [jsx("input", { ref: ref, id: resolvedId, className: `govuk-input govuk-password-input__input govuk-js-password-input-input${className ? ` ${className}` : ""}${errorMessage ? " govuk-input--error" : ""}`, name: name || resolvedId, type: "password", spellCheck: false, autoComplete: autoComplete, autoCapitalize: "none", "aria-describedby": describedByValue.trim() || undefined, ...attributes }), jsx("button", { type: "button", className: "govuk-button govuk-button--secondary govuk-password-input__toggle govuk-js-password-input-toggle", "data-module": "govuk-button", "aria-controls": resolvedId, "aria-label": showPasswordAriaLabelText, hidden: true, children: showPasswordText })] })] }));
1100
1121
  });
1101
1122
  PasswordInput.displayName = "PasswordInput";
1102
1123
 
@@ -1472,17 +1493,21 @@ function ConfigureOverallRadios($scope) {
1472
1493
  }
1473
1494
 
1474
1495
  const Select = (props) => {
1475
- const { className, "aria-describedby": describedBy, errorMessage, formGroup, hint, id, items, label, ...attributes } = props;
1496
+ const { className, "aria-describedby": describedBy, errorMessage, formGroup, hint, id, name, items, label, ...attributes } = props;
1497
+ // Mirrors govuk-frontend's Nunjucks macro, which defaults id to name when
1498
+ // id isn't given - without this the select has no id, so its <label for>
1499
+ // (and hint/error aria-describedby) can never associate with it.
1500
+ const resolvedId = id || name;
1476
1501
  let describedByValue = describedBy || "";
1477
1502
  let hintComponent;
1478
1503
  let errorMessageComponent;
1479
1504
  if (hint) {
1480
- const hintId = `${id}-hint`;
1505
+ const hintId = `${resolvedId}-hint`;
1481
1506
  describedByValue += ` ${hintId}`;
1482
1507
  hintComponent = jsx(Hint, { ...hint, id: hintId });
1483
1508
  }
1484
1509
  if (errorMessage) {
1485
- const errorId = id ? `${id}-error` : "";
1510
+ const errorId = resolvedId ? `${resolvedId}-error` : "";
1486
1511
  describedByValue += ` ${errorId}`;
1487
1512
  errorMessageComponent = jsx(ErrorMessage, { ...errorMessage, id: errorId });
1488
1513
  }
@@ -1494,12 +1519,12 @@ const Select = (props) => {
1494
1519
  return (createElement("option", { ...optionAttributes, key: reactListKey || index }, children));
1495
1520
  })
1496
1521
  : null;
1497
- return (jsxs("div", { className: `govuk-form-group${errorMessage ? " govuk-form-group--error" : ""} ${formGroup?.className || ""}`, children: [jsx(Label, { ...label, htmlFor: id }), hintComponent, errorMessageComponent, jsx("select", { className: `govuk-select ${className || ""}${errorMessage ? " govuk-select--error" : ""}`, id: id, "aria-describedby": describedByValue || undefined, ...attributes, children: options })] }));
1522
+ return (jsxs("div", { className: `govuk-form-group${errorMessage ? " govuk-form-group--error" : ""} ${formGroup?.className || ""}`, children: [jsx(Label, { ...label, htmlFor: resolvedId }), hintComponent, errorMessageComponent, jsx("select", { className: `govuk-select ${className || ""}${errorMessage ? " govuk-select--error" : ""}`, id: resolvedId, name: name, "aria-describedby": describedByValue || undefined, ...attributes, children: options })] }));
1498
1523
  };
1499
1524
 
1500
1525
  const ServiceNavigation = (props) => {
1501
1526
  const { className, containerClassName = "govuk-width-container", menuButtonLabel = "Show or hide menu", navigation, navigationClassName, navigationLabel = "Menu", serviceName, serviceUrlHref, serviceUrlTo, ...attributes } = props;
1502
- return (jsx("section", { "aria-label": "Service information", className: `govuk-service-navigation ${className || ""}`, "data-module": "govuk-service-navigation", ...attributes, children: jsx("div", { className: `govuk-width-container ${containerClassName}`, children: jsxs("div", { className: "govuk-service-navigation__container", children: [serviceName ? (jsx("span", { className: "govuk-service-navigation__service-name", children: jsx(LinkWithRef, { href: serviceUrlHref, to: serviceUrlTo, className: "govuk-header__link govuk-header__link--service-name", children: serviceName }) })) : null, navigation ? (jsxs("nav", { "aria-label": navigationLabel, className: `govuk-service-navigation__wrapper ${navigationClassName || ""}`, children: [jsx("button", { type: "button", className: "govuk-service-navigation__toggle govuk-js-service-navigation-toggle", "aria-controls": "navigation", "aria-label": menuButtonLabel, hidden: true, children: "Menu" }), jsx("ul", { className: "govuk-service-navigation__list", id: "navigation", children: navigation.map((item, index) => {
1527
+ return (jsx("section", { "aria-label": "Service information", className: `govuk-service-navigation ${className || ""}`, "data-module": "govuk-service-navigation", ...attributes, children: jsx("div", { className: `govuk-width-container ${containerClassName}`, children: jsxs("div", { className: "govuk-service-navigation__container", children: [serviceName ? (jsx("span", { className: "govuk-service-navigation__service-name", children: jsx(LinkWithRef, { href: serviceUrlHref, to: serviceUrlTo, className: "govuk-service-navigation__link", children: serviceName }) })) : null, navigation ? (jsxs("nav", { "aria-label": navigationLabel, className: `govuk-service-navigation__wrapper ${navigationClassName || ""}`, children: [jsx("button", { type: "button", className: "govuk-service-navigation__toggle govuk-js-service-navigation-toggle", "aria-controls": "navigation", "aria-label": menuButtonLabel, hidden: true, children: "Menu" }), jsx("ul", { className: "govuk-service-navigation__list", id: "navigation", children: navigation.map((item, index) => {
1503
1528
  const { active: itemActive, className: itemClassName, children: itemChildren, reactListKey, ...itemAttributes } = item;
1504
1529
  return itemChildren ? (jsx("li", { className: `govuk-service-navigation__item${itemActive
1505
1530
  ? " govuk-service-navigation__item--active"