@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.
- package/README.md +6 -8
- package/dist/PDFViewerCanvas.cjs.js +4 -3
- package/dist/PDFViewerCanvas.cjs.js.map +1 -1
- package/dist/PDFViewerCanvas.esm.js +4 -3
- package/dist/PDFViewerCanvas.esm.js.map +1 -1
- package/dist/index.cjs.css +127 -134
- package/dist/index.cjs.js +52 -27
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +31 -62
- package/dist/index.esm.css +127 -134
- package/dist/index.esm.js +52 -27
- package/dist/index.esm.js.map +1 -1
- package/dist/types/PDFViewerCanvas.d.ts +1 -0
- package/dist/types/components/Accordion/Accordion.config.d.ts +5 -0
- package/dist/types/components/Accordion/Accordion.d.ts +4 -0
- package/dist/types/components/Accordion/Accordion.types.d.ts +20 -0
- package/dist/types/components/Accordion/index.d.ts +2 -0
- package/dist/types/components/ActionLink/ActionLink.d.ts +4 -0
- package/dist/types/components/ActionLink/ActionLink.types.d.ts +13 -0
- package/dist/types/components/ActionLink/index.d.ts +1 -0
- package/dist/types/components/BackLink/BackLink.d.ts +4 -0
- package/dist/types/components/BackLink/BackLink.types.d.ts +9 -0
- package/dist/types/components/BackLink/index.d.ts +1 -0
- package/dist/types/components/Boolean/Boolean.d.ts +4 -0
- package/dist/types/components/Boolean/Boolean.types.d.ts +37 -0
- package/dist/types/components/Boolean/OmitKey.d.ts +5 -0
- package/dist/types/components/Boolean/index.d.ts +1 -0
- package/dist/types/components/Breadcrumbs/Breadcrumbs.d.ts +4 -0
- package/dist/types/components/Breadcrumbs/Breadcrumbs.types.d.ts +13 -0
- package/dist/types/components/Breadcrumbs/index.d.ts +1 -0
- package/dist/types/components/Button/Button.config.d.ts +2 -0
- package/dist/types/components/Button/Button.d.ts +4 -0
- package/dist/types/components/Button/Button.types.d.ts +13 -0
- package/dist/types/components/Button/index.d.ts +2 -0
- package/dist/types/components/CardColumn/CardColumn.d.ts +5 -0
- package/dist/types/components/CardColumn/CardColumn.types.d.ts +25 -0
- package/dist/types/components/CardColumn/index.d.ts +1 -0
- package/dist/types/components/CardLayout/CardLayout.d.ts +4 -0
- package/dist/types/components/CardLayout/CardLayout.types.d.ts +5 -0
- package/dist/types/components/CardLayout/index.d.ts +1 -0
- package/dist/types/components/CharacterCount/CharacterCount.config.d.ts +2 -0
- package/dist/types/components/CharacterCount/CharacterCount.d.ts +4 -0
- package/dist/types/components/CharacterCount/CharacterCount.types.d.ts +12 -0
- package/dist/types/components/CharacterCount/index.d.ts +1 -0
- package/dist/types/components/Checkboxes/Checkboxes.config.d.ts +1 -0
- package/dist/types/components/Checkboxes/Checkboxes.d.ts +4 -0
- package/dist/types/components/Checkboxes/Checkboxes.types.d.ts +3 -0
- package/dist/types/components/Checkboxes/index.d.ts +2 -0
- package/dist/types/components/CookieBanner/CookieBanner.d.ts +4 -0
- package/dist/types/components/CookieBanner/CookieBanner.types.d.ts +21 -0
- package/dist/types/components/CookieBanner/index.d.ts +1 -0
- package/dist/types/components/DataNavigation/DataNavigation.d.ts +4 -0
- package/dist/types/components/DataNavigation/DataNavigation.types.d.ts +34 -0
- package/dist/types/components/DataNavigation/index.d.ts +1 -0
- package/dist/types/components/DateInput/DateInput.d.ts +4 -0
- package/dist/types/components/DateInput/DateInput.types.d.ts +27 -0
- package/dist/types/components/DateInput/index.d.ts +1 -0
- package/dist/types/components/Details/Details.d.ts +4 -0
- package/dist/types/components/Details/Details.types.d.ts +5 -0
- package/dist/types/components/Details/index.d.ts +1 -0
- package/dist/types/components/DifferenceNavigation/DifferenceNavigation.d.ts +4 -0
- package/dist/types/components/DifferenceNavigation/DifferenceNavigation.types.d.ts +32 -0
- package/dist/types/components/DifferenceNavigation/index.d.ts +1 -0
- package/dist/types/components/ErrorBoundary/ErrorBoundary.d.ts +9 -0
- package/dist/types/components/ErrorBoundary/ErrorBoundary.types.d.ts +11 -0
- package/dist/types/components/ErrorBoundary/index.d.ts +1 -0
- package/dist/types/components/ErrorMessage/ErrorMessage.d.ts +4 -0
- package/dist/types/components/ErrorMessage/ErrorMessage.types.d.ts +6 -0
- package/dist/types/components/ErrorMessage/index.d.ts +1 -0
- package/dist/types/components/ErrorSummary/ErrorSummary.config.d.ts +2 -0
- package/dist/types/components/ErrorSummary/ErrorSummary.d.ts +4 -0
- package/dist/types/components/ErrorSummary/ErrorSummary.types.d.ts +13 -0
- package/dist/types/components/ErrorSummary/index.d.ts +2 -0
- package/dist/types/components/ExitThisPage/ExitThisPage.config.d.ts +1 -0
- package/dist/types/components/ExitThisPage/ExitThisPage.d.ts +4 -0
- package/dist/types/components/ExitThisPage/ExitThisPage.types.d.ts +17 -0
- package/dist/types/components/ExitThisPage/index.d.ts +2 -0
- package/dist/types/components/Fieldset/Fieldset.d.ts +4 -0
- package/dist/types/components/Fieldset/Fieldset.types.d.ts +12 -0
- package/dist/types/components/Fieldset/index.d.ts +1 -0
- package/dist/types/components/FileUpload/FileUpload.d.ts +4 -0
- package/dist/types/components/FileUpload/FileUpload.types.d.ts +13 -0
- package/dist/types/components/FileUpload/index.d.ts +1 -0
- package/dist/types/components/Footer/Footer.d.ts +4 -0
- package/dist/types/components/Footer/Footer.types.d.ts +40 -0
- package/dist/types/components/Footer/index.d.ts +1 -0
- package/dist/types/components/Header/Header.config.d.ts +1 -0
- package/dist/types/components/Header/Header.d.ts +4 -0
- package/dist/types/components/Header/Header.types.d.ts +28 -0
- package/dist/types/components/Header/index.d.ts +2 -0
- package/dist/types/components/Hint/Hint.d.ts +4 -0
- package/dist/types/components/Hint/Hint.types.d.ts +4 -0
- package/dist/types/components/Hint/index.d.ts +1 -0
- package/dist/types/components/Input/Input.d.ts +4 -0
- package/dist/types/components/Input/Input.types.d.ts +17 -0
- package/dist/types/components/Input/index.d.ts +1 -0
- package/dist/types/components/InsetText/InsetText.d.ts +4 -0
- package/dist/types/components/InsetText/InsetText.types.d.ts +4 -0
- package/dist/types/components/InsetText/index.d.ts +1 -0
- package/dist/types/components/Label/Label.d.ts +4 -0
- package/dist/types/components/Label/Label.types.d.ts +6 -0
- package/dist/types/components/Label/index.d.ts +1 -0
- package/dist/types/components/Landing/Landing.d.ts +4 -0
- package/dist/types/components/Landing/Landing.types.d.ts +4 -0
- package/dist/types/components/Landing/index.d.ts +1 -0
- package/dist/types/components/LinkWithRef/LinkWithRef.d.ts +4 -0
- package/dist/types/components/LinkWithRef/LinkWithRef.types.d.ts +9 -0
- package/dist/types/components/LinkWithRef/index.d.ts +1 -0
- package/dist/types/components/Loading/Loading.d.ts +5 -0
- package/dist/types/components/Loading/Loading.types.d.ts +4 -0
- package/dist/types/components/Loading/index.d.ts +1 -0
- package/dist/types/components/Main/Main.d.ts +4 -0
- package/dist/types/components/Main/Main.types.d.ts +5 -0
- package/dist/types/components/Main/index.d.ts +1 -0
- package/dist/types/components/NotFoundPage/NotFoundPage.d.ts +3 -0
- package/dist/types/components/NotFoundPage/index.d.ts +1 -0
- package/dist/types/components/NotificationBanner/NotificationBanner.config.d.ts +2 -0
- package/dist/types/components/NotificationBanner/NotificationBanner.d.ts +4 -0
- package/dist/types/components/NotificationBanner/NotificationBanner.types.d.ts +12 -0
- package/dist/types/components/NotificationBanner/index.d.ts +1 -0
- package/dist/types/components/PDFViewer/ObjectToQueryString.d.ts +1 -0
- package/dist/types/components/PDFViewer/PDFViewer.d.ts +4 -0
- package/dist/types/components/PDFViewer/PDFViewer.types.d.ts +25 -0
- package/dist/types/components/PDFViewer/PDFViewerBackend.d.ts +2 -0
- package/dist/types/components/PDFViewer/ResolvePDFSource.d.ts +27 -0
- package/dist/types/components/PDFViewer/Slugify.d.ts +1 -0
- package/dist/types/components/PDFViewer/index.d.ts +2 -0
- package/dist/types/components/PDFViewer/testutilities/SampleBase64.d.ts +44 -0
- package/dist/types/components/PDFViewerCanvas/PDFViewerCanvas.d.ts +9 -0
- package/dist/types/components/PDFViewerCanvas/PDFViewerCanvas.types.d.ts +38 -0
- package/dist/types/components/PDFViewerCanvas/index.d.ts +1 -0
- package/dist/types/components/Pagination/NavigationButton.d.ts +3 -0
- package/dist/types/components/Pagination/Pagination.d.ts +4 -0
- package/dist/types/components/Pagination/Pagination.types.d.ts +32 -0
- package/dist/types/components/Pagination/SvgIcon.d.ts +3 -0
- package/dist/types/components/Pagination/UsePagination.d.ts +9 -0
- package/dist/types/components/Pagination/index.d.ts +3 -0
- package/dist/types/components/Panel/Panel.d.ts +4 -0
- package/dist/types/components/Panel/Panel.types.d.ts +7 -0
- package/dist/types/components/Panel/index.d.ts +1 -0
- package/dist/types/components/PasswordInput/PasswordInput.config.d.ts +1 -0
- package/dist/types/components/PasswordInput/PasswordInput.d.ts +4 -0
- package/dist/types/components/PasswordInput/PasswordInput.types.d.ts +35 -0
- package/dist/types/components/PasswordInput/index.d.ts +2 -0
- package/dist/types/components/PhaseBanner/PhaseBanner.d.ts +4 -0
- package/dist/types/components/PhaseBanner/PhaseBanner.types.d.ts +6 -0
- package/dist/types/components/PhaseBanner/index.d.ts +1 -0
- package/dist/types/components/ProblemWithService/ProblemWithService.d.ts +4 -0
- package/dist/types/components/ProblemWithService/ProblemWithService.types.d.ts +7 -0
- package/dist/types/components/ProblemWithService/index.d.ts +1 -0
- package/dist/types/components/Radios/Radios.config.d.ts +1 -0
- package/dist/types/components/Radios/Radios.d.ts +4 -0
- package/dist/types/components/Radios/Radios.types.d.ts +7 -0
- package/dist/types/components/Radios/index.d.ts +2 -0
- package/dist/types/components/Select/Select.d.ts +4 -0
- package/dist/types/components/Select/Select.types.d.ts +19 -0
- package/dist/types/components/Select/index.d.ts +1 -0
- package/dist/types/components/ServiceNavigation/ServiceNavigation.d.ts +4 -0
- package/dist/types/components/ServiceNavigation/ServiceNavigation.types.d.ts +21 -0
- package/dist/types/components/ServiceNavigation/index.d.ts +1 -0
- package/dist/types/components/SkipLink/SkipLink.config.d.ts +1 -0
- package/dist/types/components/SkipLink/SkipLink.d.ts +4 -0
- package/dist/types/components/SkipLink/SkipLink.types.d.ts +5 -0
- package/dist/types/components/SkipLink/index.d.ts +2 -0
- package/dist/types/components/SummaryList/SummaryList.d.ts +4 -0
- package/dist/types/components/SummaryList/SummaryList.types.d.ts +22 -0
- package/dist/types/components/SummaryList/index.d.ts +1 -0
- package/dist/types/components/Table/Table.d.ts +4 -0
- package/dist/types/components/Table/Table.types.d.ts +21 -0
- package/dist/types/components/Table/index.d.ts +1 -0
- package/dist/types/components/Tabs/Tabs.config.d.ts +1 -0
- package/dist/types/components/Tabs/Tabs.d.ts +4 -0
- package/dist/types/components/Tabs/Tabs.types.d.ts +14 -0
- package/dist/types/components/Tabs/index.d.ts +2 -0
- package/dist/types/components/Tag/Tag.d.ts +4 -0
- package/dist/types/components/Tag/Tag.types.d.ts +4 -0
- package/dist/types/components/Tag/index.d.ts +1 -0
- package/dist/types/components/TaskList/TaskList.d.ts +4 -0
- package/dist/types/components/TaskList/TaskList.types.d.ts +21 -0
- package/dist/types/components/TaskList/index.d.ts +1 -0
- package/dist/types/components/Textarea/Textarea.d.ts +4 -0
- package/dist/types/components/Textarea/Textarea.types.d.ts +14 -0
- package/dist/types/components/Textarea/index.d.ts +1 -0
- package/dist/types/components/WarningInfo/WarningInfo.d.ts +4 -0
- package/dist/types/components/WarningInfo/WarningInfo.types.d.ts +8 -0
- package/dist/types/components/WarningInfo/index.d.ts +1 -0
- package/dist/types/components/WarningText/WarningText.d.ts +4 -0
- package/dist/types/components/WarningText/WarningText.types.d.ts +4 -0
- package/dist/types/components/WarningText/index.d.ts +1 -0
- package/dist/types/components/common.types.d.ts +10 -0
- package/dist/types/components/index.d.ts +51 -0
- package/dist/types/dynamics/index.d.ts +3 -0
- package/dist/types/dynamics/types.d.ts +37 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/utils/ProcessExampleData.d.ts +3 -0
- package/dist/types/utils/StoriesFromFixtures.d.ts +5 -0
- package/dist/types/utils/TitleCase.d.ts +2 -0
- package/dist/types/utils/WithReference.d.ts +5 -0
- package/dist/types/utils/WithReference.types.d.ts +15 -0
- package/package.json +86 -58
- package/.gitattributes +0 -5
- package/.nvmrc +0 -1
- package/.stylelintrc.json +0 -8
- package/assets/Advance-submodule-behaviours.png +0 -0
- package/assets/logo.png +0 -0
- package/assets/uml-diagram.svg +0 -2745
- package/bundle-analysis-main.html +0 -4949
- package/bundle-analysis-pdfvc.html +0 -4949
- package/scripts/generateStories.mjs +0 -433
package/dist/index.cjs.js
CHANGED
|
@@ -249,7 +249,7 @@ const Button = (props) => {
|
|
|
249
249
|
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" }) }));
|
|
250
250
|
}
|
|
251
251
|
const commonAttributes = {
|
|
252
|
-
className: `govuk-button ${className || ""}
|
|
252
|
+
className: `govuk-button ${className || ""} ${isStartButton ? "govuk-button--start" : ""}`,
|
|
253
253
|
// ref: buttonRef,
|
|
254
254
|
};
|
|
255
255
|
if (preventDoubleClick) {
|
|
@@ -633,28 +633,36 @@ const defaultProps$1 = {
|
|
|
633
633
|
name: "",
|
|
634
634
|
};
|
|
635
635
|
const Textarea = React.forwardRef((props = defaultProps$1, ref) => {
|
|
636
|
-
const { className, "aria-describedby": describedBy, errorMessage, formGroup, hint, label, id, ...attributes } = props;
|
|
636
|
+
const { className, "aria-describedby": describedBy, errorMessage, formGroup, hint, label, id, name, ...attributes } = props;
|
|
637
|
+
// Mirrors govuk-frontend's Nunjucks macro, which defaults id to name when
|
|
638
|
+
// id isn't given - without this the textarea has no id, so its <label for>
|
|
639
|
+
// (and hint/error aria-describedby) can never associate with it.
|
|
640
|
+
const resolvedId = id || name;
|
|
637
641
|
let describedByValue = describedBy || "";
|
|
638
642
|
let hintComponent = null;
|
|
639
643
|
let errorMessageComponent = null;
|
|
640
644
|
if (hint) {
|
|
641
|
-
const hintId = `${
|
|
645
|
+
const hintId = `${resolvedId}-hint`;
|
|
642
646
|
describedByValue += ` ${hintId}`;
|
|
643
647
|
hintComponent = jsxRuntime.jsx(Hint, { ...hint, id: hintId });
|
|
644
648
|
}
|
|
645
649
|
if (errorMessage) {
|
|
646
|
-
const errorId =
|
|
650
|
+
const errorId = resolvedId ? `${resolvedId}-error` : "";
|
|
647
651
|
describedByValue += ` ${errorId}`;
|
|
648
652
|
errorMessageComponent = jsxRuntime.jsx(ErrorMessage, { ...errorMessage, id: errorId });
|
|
649
653
|
}
|
|
650
|
-
return (jsxRuntime.jsxs("div", { className: `govuk-form-group${errorMessage ? " govuk-form-group--error" : ""} ${formGroup?.className || ""}`, children: [jsxRuntime.jsx(Label, { ...label, htmlFor:
|
|
654
|
+
return (jsxRuntime.jsxs("div", { className: `govuk-form-group${errorMessage ? " govuk-form-group--error" : ""} ${formGroup?.className || ""}`, children: [jsxRuntime.jsx(Label, { ...label, htmlFor: resolvedId }), hintComponent, errorMessageComponent, jsxRuntime.jsx("textarea", { name: name, ...attributes, id: resolvedId, ref: ref, className: `govuk-textarea${errorMessage ? " govuk-textarea--error" : ""} ${className || ""}`, "aria-describedby": describedByValue?.trim() || undefined })] }));
|
|
651
655
|
});
|
|
652
656
|
Textarea.displayName = "Textarea";
|
|
653
657
|
|
|
654
658
|
const CharacterCount = (props) => {
|
|
655
|
-
const { id, className, maxlength, threshold, maxwords, errorMessage, countMessage, ...attributes } = props;
|
|
656
|
-
|
|
657
|
-
|
|
659
|
+
const { id, name, className, maxlength, threshold, maxwords, errorMessage, countMessage, ...attributes } = props;
|
|
660
|
+
// Mirrors govuk-frontend's Nunjucks macro, which defaults id to name when
|
|
661
|
+
// id isn't given - without this the count message's id (referenced by the
|
|
662
|
+
// textarea's aria-describedby) would render as literally "undefined-info".
|
|
663
|
+
const resolvedId = id || name;
|
|
664
|
+
const characterCountInfoId = `${resolvedId}-info`;
|
|
665
|
+
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: resolvedId, name: name, ...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"] })] }));
|
|
658
666
|
};
|
|
659
667
|
CharacterCount.displayName = "CharacterCount";
|
|
660
668
|
|
|
@@ -702,21 +710,25 @@ const defaultProps = {
|
|
|
702
710
|
};
|
|
703
711
|
const Input = React.forwardRef((props = defaultProps, ref) => {
|
|
704
712
|
const { className, "aria-describedby": describedBy, errorMessage, formGroup, hint, label, name, id, prefix, suffix, ...attributes } = props;
|
|
713
|
+
// Mirrors govuk-frontend's Nunjucks macro, which defaults id to name when
|
|
714
|
+
// id isn't given - without this the input has no id, so its <label for>
|
|
715
|
+
// (and hint/error aria-describedby) can never associate with it.
|
|
716
|
+
const resolvedId = id || name;
|
|
705
717
|
let describedByValue = describedBy || "";
|
|
706
718
|
let hintComponent = null;
|
|
707
719
|
let errorMessageComponent = null;
|
|
708
720
|
if (hint) {
|
|
709
|
-
const hintId = `${
|
|
721
|
+
const hintId = `${resolvedId}-hint`;
|
|
710
722
|
describedByValue += ` ${hintId}`;
|
|
711
723
|
hintComponent = jsxRuntime.jsx(Hint, { ...hint, id: hintId });
|
|
712
724
|
}
|
|
713
725
|
if (errorMessage) {
|
|
714
|
-
const errorId =
|
|
726
|
+
const errorId = resolvedId ? `${resolvedId}-error` : "";
|
|
715
727
|
describedByValue += ` ${errorId}`;
|
|
716
728
|
errorMessageComponent = jsxRuntime.jsx(ErrorMessage, { ...errorMessage, id: errorId });
|
|
717
729
|
}
|
|
718
|
-
const input = (jsxRuntime.jsx("input", { ref: ref, id:
|
|
719
|
-
return (jsxRuntime.jsxs("div", { className: `govuk-form-group ${formGroup?.className || ""} ${errorMessage ? "govuk-form-group--error" : ""}`, children: [jsxRuntime.jsx(Label, { ...label, htmlFor:
|
|
730
|
+
const input = (jsxRuntime.jsx("input", { ref: ref, id: resolvedId, className: `govuk-input ${className || ""} ${errorMessage ? " govuk-input--error" : ""}`, name: name || resolvedId, "aria-describedby": describedByValue || undefined, ...attributes }));
|
|
731
|
+
return (jsxRuntime.jsxs("div", { className: `govuk-form-group ${formGroup?.className || ""} ${errorMessage ? "govuk-form-group--error" : ""}`, children: [jsxRuntime.jsx(Label, { ...label, htmlFor: resolvedId }), hintComponent, errorMessageComponent, prefix || suffix ? (jsxRuntime.jsxs("div", { className: "govuk-input__wrapper", children: [prefix ? (jsxRuntime.jsx("div", { "aria-hidden": "true", ...prefix,
|
|
720
732
|
className: `govuk-input__prefix ${prefix.className ? prefix.className : ""}` })) : null, input, suffix ? (jsxRuntime.jsx("div", { "aria-hidden": "true", ...suffix,
|
|
721
733
|
className: `govuk-input__suffix ${suffix.className ? suffix.className : ""}` })) : null] })) : (input)] }));
|
|
722
734
|
});
|
|
@@ -897,21 +909,25 @@ function ConfigureOverallExitThisPage($scope) {
|
|
|
897
909
|
}
|
|
898
910
|
|
|
899
911
|
const FileUpload = (props) => {
|
|
900
|
-
const { className, errorMessage, formGroup, hint, label, "aria-describedby": describedBy, id, ...attributes } = props;
|
|
912
|
+
const { className, errorMessage, formGroup, hint, label, "aria-describedby": describedBy, id, name, ...attributes } = props;
|
|
913
|
+
// Mirrors govuk-frontend's Nunjucks macro, which defaults id to name when
|
|
914
|
+
// id isn't given - without this the input has no id, so its <label for>
|
|
915
|
+
// (and hint/error aria-describedby) can never associate with it.
|
|
916
|
+
const resolvedId = id || name;
|
|
901
917
|
let hintComponent;
|
|
902
918
|
let errorMessageComponent;
|
|
903
919
|
let describedByValue = describedBy || "";
|
|
904
920
|
if (hint) {
|
|
905
|
-
const hintId = `${
|
|
921
|
+
const hintId = `${resolvedId}-hint`;
|
|
906
922
|
describedByValue += ` ${hintId}`;
|
|
907
|
-
hintComponent = jsxRuntime.jsx(Hint, { ...
|
|
923
|
+
hintComponent = jsxRuntime.jsx(Hint, { ...hint, id: hintId });
|
|
908
924
|
}
|
|
909
925
|
if (errorMessage) {
|
|
910
|
-
const errorId = `${
|
|
926
|
+
const errorId = `${resolvedId}-error`;
|
|
911
927
|
describedByValue += ` ${errorId}`;
|
|
912
928
|
errorMessageComponent = jsxRuntime.jsx(ErrorMessage, { ...errorMessage, id: errorId });
|
|
913
929
|
}
|
|
914
|
-
return (jsxRuntime.jsxs("div", { className: `govuk-form-group${errorMessage ? " govuk-form-group--error" : ""} ${formGroup?.className || ""}`, children: [jsxRuntime.jsx(Label, { ...label, htmlFor:
|
|
930
|
+
return (jsxRuntime.jsxs("div", { className: `govuk-form-group${errorMessage ? " govuk-form-group--error" : ""} ${formGroup?.className || ""}`, children: [jsxRuntime.jsx(Label, { ...label, htmlFor: resolvedId }), hintComponent, errorMessageComponent, jsxRuntime.jsx("input", { name: name, ...attributes, id: resolvedId, className: `govuk-file-upload ${className || ""}${errorMessage ? " govuk-file-upload--error" : ""}`, type: "file", "aria-describedby": describedByValue || undefined })] }));
|
|
915
931
|
};
|
|
916
932
|
FileUpload.displayName = "FileUpload";
|
|
917
933
|
|
|
@@ -1072,7 +1088,7 @@ const Pagination = ({ previous, next, items, className, }) => {
|
|
|
1072
1088
|
// Block layout is used when there are no numbered page items — govuk renders
|
|
1073
1089
|
// the nav with an extra class and the link title with --decorated modifier.
|
|
1074
1090
|
const isBlockLayout = !items || items.length === 0;
|
|
1075
|
-
return (jsxRuntime.jsxs("nav", { className: `govuk-pagination${isBlockLayout ? " govuk-pagination--block" : ""}${className ? ` ${className}` : ""}`, role: "navigation", "aria-label": "Pagination", children: [previous && (jsxRuntime.jsx("div", { className: "govuk-pagination__prev", children: jsxRuntime.jsx(NavigationButton, { type: "previous", ...previous }) })), items && items.length > 0 && (jsxRuntime.jsx("ul", { className: "govuk-pagination__list", children: items.map((item, index) => item.ellipsis ? (jsxRuntime.jsx("li", { className: "govuk-pagination__item govuk-pagination__item--
|
|
1091
|
+
return (jsxRuntime.jsxs("nav", { className: `govuk-pagination${isBlockLayout ? " govuk-pagination--block" : ""}${className ? ` ${className}` : ""}`, role: "navigation", "aria-label": "Pagination", children: [previous && (jsxRuntime.jsx("div", { className: "govuk-pagination__prev", children: jsxRuntime.jsx(NavigationButton, { type: "previous", ...previous }) })), items && items.length > 0 && (jsxRuntime.jsx("ul", { className: "govuk-pagination__list", children: items.map((item, index) => item.ellipsis ? (jsxRuntime.jsx("li", { className: "govuk-pagination__item govuk-pagination__item--ellipsis", children: DOTS }, index)) : (jsxRuntime.jsx("li", { className: `govuk-pagination__item${item.current ? " govuk-pagination__item--current" : ""}`, children: jsxRuntime.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 && (jsxRuntime.jsx("div", { className: "govuk-pagination__next", children: jsxRuntime.jsx(NavigationButton, { type: "next", ...next }) }))] }));
|
|
1076
1092
|
};
|
|
1077
1093
|
|
|
1078
1094
|
const Panel = (props) => {
|
|
@@ -1083,16 +1099,21 @@ const Panel = (props) => {
|
|
|
1083
1099
|
|
|
1084
1100
|
const PasswordInput = React.forwardRef((props, ref) => {
|
|
1085
1101
|
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;
|
|
1102
|
+
// Mirrors govuk-frontend's Nunjucks macro, which defaults id to name
|
|
1103
|
+
// when id isn't given - without this the input has no id, so its
|
|
1104
|
+
// <label for> (and hint/error aria-describedby) can never associate
|
|
1105
|
+
// with it.
|
|
1106
|
+
const resolvedId = id || name;
|
|
1086
1107
|
let describedByValue = describedBy || "";
|
|
1087
1108
|
let hintComponent = null;
|
|
1088
1109
|
let errorMessageComponent = null;
|
|
1089
1110
|
if (hint) {
|
|
1090
|
-
const hintId = `${
|
|
1111
|
+
const hintId = `${resolvedId}-hint`;
|
|
1091
1112
|
describedByValue += ` ${hintId}`;
|
|
1092
1113
|
hintComponent = jsxRuntime.jsx(Hint, { ...hint, id: hintId });
|
|
1093
1114
|
}
|
|
1094
1115
|
if (errorMessage) {
|
|
1095
|
-
const errorId =
|
|
1116
|
+
const errorId = resolvedId ? `${resolvedId}-error` : "";
|
|
1096
1117
|
describedByValue += ` ${errorId}`;
|
|
1097
1118
|
errorMessageComponent = jsxRuntime.jsx(ErrorMessage, { ...errorMessage, id: errorId });
|
|
1098
1119
|
}
|
|
@@ -1115,8 +1136,8 @@ const PasswordInput = React.forwardRef((props, ref) => {
|
|
|
1115
1136
|
i18nProps["data-i18n.password-hidden-announcement"] =
|
|
1116
1137
|
passwordHiddenAnnouncementText;
|
|
1117
1138
|
// Label handles isPageHeading internally — no extra wrapper needed here
|
|
1118
|
-
const labelEl = jsxRuntime.jsx(Label, { ...label, htmlFor:
|
|
1119
|
-
return (jsxRuntime.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, jsxRuntime.jsxs("div", { className: "govuk-input__wrapper govuk-password-input__wrapper", children: [jsxRuntime.jsx("input", { ref: ref, id:
|
|
1139
|
+
const labelEl = jsxRuntime.jsx(Label, { ...label, htmlFor: resolvedId });
|
|
1140
|
+
return (jsxRuntime.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, jsxRuntime.jsxs("div", { className: "govuk-input__wrapper govuk-password-input__wrapper", children: [jsxRuntime.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 }), jsxRuntime.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 })] })] }));
|
|
1120
1141
|
});
|
|
1121
1142
|
PasswordInput.displayName = "PasswordInput";
|
|
1122
1143
|
|
|
@@ -1492,17 +1513,21 @@ function ConfigureOverallRadios($scope) {
|
|
|
1492
1513
|
}
|
|
1493
1514
|
|
|
1494
1515
|
const Select = (props) => {
|
|
1495
|
-
const { className, "aria-describedby": describedBy, errorMessage, formGroup, hint, id, items, label, ...attributes } = props;
|
|
1516
|
+
const { className, "aria-describedby": describedBy, errorMessage, formGroup, hint, id, name, items, label, ...attributes } = props;
|
|
1517
|
+
// Mirrors govuk-frontend's Nunjucks macro, which defaults id to name when
|
|
1518
|
+
// id isn't given - without this the select has no id, so its <label for>
|
|
1519
|
+
// (and hint/error aria-describedby) can never associate with it.
|
|
1520
|
+
const resolvedId = id || name;
|
|
1496
1521
|
let describedByValue = describedBy || "";
|
|
1497
1522
|
let hintComponent;
|
|
1498
1523
|
let errorMessageComponent;
|
|
1499
1524
|
if (hint) {
|
|
1500
|
-
const hintId = `${
|
|
1525
|
+
const hintId = `${resolvedId}-hint`;
|
|
1501
1526
|
describedByValue += ` ${hintId}`;
|
|
1502
1527
|
hintComponent = jsxRuntime.jsx(Hint, { ...hint, id: hintId });
|
|
1503
1528
|
}
|
|
1504
1529
|
if (errorMessage) {
|
|
1505
|
-
const errorId =
|
|
1530
|
+
const errorId = resolvedId ? `${resolvedId}-error` : "";
|
|
1506
1531
|
describedByValue += ` ${errorId}`;
|
|
1507
1532
|
errorMessageComponent = jsxRuntime.jsx(ErrorMessage, { ...errorMessage, id: errorId });
|
|
1508
1533
|
}
|
|
@@ -1514,12 +1539,12 @@ const Select = (props) => {
|
|
|
1514
1539
|
return (React.createElement("option", { ...optionAttributes, key: reactListKey || index }, children));
|
|
1515
1540
|
})
|
|
1516
1541
|
: null;
|
|
1517
|
-
return (jsxRuntime.jsxs("div", { className: `govuk-form-group${errorMessage ? " govuk-form-group--error" : ""} ${formGroup?.className || ""}`, children: [jsxRuntime.jsx(Label, { ...label, htmlFor:
|
|
1542
|
+
return (jsxRuntime.jsxs("div", { className: `govuk-form-group${errorMessage ? " govuk-form-group--error" : ""} ${formGroup?.className || ""}`, children: [jsxRuntime.jsx(Label, { ...label, htmlFor: resolvedId }), hintComponent, errorMessageComponent, jsxRuntime.jsx("select", { className: `govuk-select ${className || ""}${errorMessage ? " govuk-select--error" : ""}`, id: resolvedId, name: name, "aria-describedby": describedByValue || undefined, ...attributes, children: options })] }));
|
|
1518
1543
|
};
|
|
1519
1544
|
|
|
1520
1545
|
const ServiceNavigation = (props) => {
|
|
1521
1546
|
const { className, containerClassName = "govuk-width-container", menuButtonLabel = "Show or hide menu", navigation, navigationClassName, navigationLabel = "Menu", serviceName, serviceUrlHref, serviceUrlTo, ...attributes } = props;
|
|
1522
|
-
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-
|
|
1547
|
+
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-service-navigation__link", 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) => {
|
|
1523
1548
|
const { active: itemActive, className: itemClassName, children: itemChildren, reactListKey, ...itemAttributes } = item;
|
|
1524
1549
|
return itemChildren ? (jsxRuntime.jsx("li", { className: `govuk-service-navigation__item${itemActive
|
|
1525
1550
|
? " govuk-service-navigation__item--active"
|