@hmlr/govuk-react-components-library 1.0.3 → 1.2.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/.stylelintrc.json +1 -1
- package/README.md +216 -2
- package/assets/uml-diagram.svg +782 -578
- package/bundle-analysis-main.html +1 -1
- package/bundle-analysis-pdfvc.html +1 -1
- package/dist/PDFViewerCanvas.cjs.css +4 -4
- package/dist/PDFViewerCanvas.cjs.js +24 -4
- package/dist/PDFViewerCanvas.cjs.js.map +1 -1
- package/dist/PDFViewerCanvas.d.ts +30 -0
- package/dist/PDFViewerCanvas.esm.css +4 -4
- package/dist/PDFViewerCanvas.esm.js +24 -4
- package/dist/PDFViewerCanvas.esm.js.map +1 -1
- package/dist/index.cjs.css +22 -15
- package/dist/index.cjs.js +207 -111
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +183 -12
- package/dist/index.esm.css +22 -15
- package/dist/index.esm.js +206 -116
- package/dist/index.esm.js.map +1 -1
- package/dist/types/components/CardColumn/CardColumn.types.d.ts +20 -0
- package/dist/types/components/DataNavigation/DataNavigation.types.d.ts +27 -2
- package/dist/types/components/DifferenceNavigation/DifferenceNavigation.types.d.ts +25 -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/Footer/Footer.types.d.ts +7 -0
- package/dist/types/components/PDFViewerCanvas/PDFViewerCanvas.types.d.ts +30 -0
- package/dist/types/components/Pagination/Pagination.types.d.ts +23 -13
- package/dist/types/components/Pagination/index.d.ts +2 -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 +49 -0
- package/dist/types/components/PasswordInput/index.d.ts +2 -0
- package/dist/types/components/index.d.ts +2 -0
- package/dist/types/dynamics/types.d.ts +1 -1
- package/dist/types/utils/WithReference.types.d.ts +7 -2
- package/package.json +63 -61
- package/scripts/generateStories.mjs +433 -0
- package/dist/types/JestSetup.d.ts +0 -1
package/dist/index.cjs.js
CHANGED
|
@@ -92,10 +92,10 @@ function ExtractAccordionConfigFromAttributes(remainingAttributes) {
|
|
|
92
92
|
return accordionConfig;
|
|
93
93
|
}
|
|
94
94
|
|
|
95
|
-
const Accordion = ({ headingLevel: HeadingLevel = "h2", items, className, id, ...attributes }) => {
|
|
95
|
+
const Accordion = ({ headingLevel: HeadingLevel = "h2", items = [], className, id, ...attributes }) => {
|
|
96
96
|
const remainingAttributes = { ...attributes };
|
|
97
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
|
|
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
99
|
};
|
|
100
100
|
|
|
101
101
|
const LinkWithRef = ({ children, to, href, forwardedRef = null, ...attributes }) => {
|
|
@@ -178,40 +178,39 @@ const Boolean$1 = ({ className, errorMessage, fieldset, formGroup, hint, idPrefi
|
|
|
178
178
|
return null;
|
|
179
179
|
};
|
|
180
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
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
}) })] }));
|
|
181
|
+
const innerHtml = (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [getHintComponent(), getErrorMessageComponent(), jsxRuntime.jsx("div", { className: `govuk-${controlType} ${className || ""}`, ...attributes, "data-module": `govuk-${controlType}`, children: items?.map((item, index) => {
|
|
182
|
+
if (!item) {
|
|
183
|
+
return null;
|
|
184
|
+
}
|
|
185
|
+
if (item.behaviour === "exclusive") {
|
|
186
|
+
delete item.behaviour;
|
|
187
|
+
}
|
|
188
|
+
const { id, children, hint: itemHint, conditional: itemConditional, behaviour, label, reactListKey, ...itemAttributes } = item;
|
|
189
|
+
const idSuffix = `-${index + 1}`;
|
|
190
|
+
const idValue = id || `${idPrefixValue}${index === 0 ? "" : idSuffix}`;
|
|
191
|
+
const nameValue = item.name ? item.name : name;
|
|
192
|
+
const conditionalId = itemConditional?.children
|
|
193
|
+
? `conditional-${idValue}`
|
|
194
|
+
: undefined;
|
|
195
|
+
const itemHintId = `${idValue}-item-hint`;
|
|
196
|
+
let itemDescribedBy = "";
|
|
197
|
+
if (controlType === "checkboxes" && !hasFieldset) {
|
|
198
|
+
itemDescribedBy = describedBy;
|
|
199
|
+
}
|
|
200
|
+
if (itemHint) {
|
|
201
|
+
itemDescribedBy += ` ${itemHintId}`;
|
|
202
|
+
}
|
|
203
|
+
if (item.divider) {
|
|
204
|
+
return (jsxRuntime.jsx("div", { className: `govuk-${controlType}__divider`, children: item.divider }, reactListKey || index));
|
|
205
|
+
}
|
|
206
|
+
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,
|
|
207
|
+
className: `govuk-${controlType}__label ${label?.className || ""}`,
|
|
208
|
+
htmlFor: idValue,
|
|
209
|
+
isPageHeading: false, children: children }), itemHint ? (jsxRuntime.jsx(Hint, { ...itemHint,
|
|
210
|
+
className: `govuk-${controlType}__hint ${itemHint.className || ""}`, id: itemHintId })) : ("")] }), itemConditional?.children ? (jsxRuntime.jsx("div", { className: `govuk-${controlType}__conditional ${item.checked
|
|
211
|
+
? ""
|
|
212
|
+
: `govuk-${controlType}__conditional--hidden`}`, id: conditionalId, children: itemConditional.children })) : ("")] }, reactListKey || index));
|
|
213
|
+
}) })] }));
|
|
215
214
|
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
215
|
};
|
|
217
216
|
|
|
@@ -595,9 +594,19 @@ var Card$1 = Object.assign(Card, {
|
|
|
595
594
|
ImgOverlay: CardImgOverlay
|
|
596
595
|
});
|
|
597
596
|
|
|
597
|
+
// The default colours come from the SCSS via govuk-functional-colour(), which
|
|
598
|
+
// resolves the govuk-frontend CSS custom properties (--govuk-colour-brand,
|
|
599
|
+
// --govuk-colour-header-background). We only need to set inline CSS variables
|
|
600
|
+
// here when the consumer explicitly overrides them via props.
|
|
598
601
|
const CardColumn = (props) => {
|
|
599
|
-
const { body, header, link } = props;
|
|
600
|
-
|
|
602
|
+
const { body, header, link, textColor, hoverColor } = props;
|
|
603
|
+
const inlineVars = textColor || hoverColor
|
|
604
|
+
? {
|
|
605
|
+
...(textColor && { "--card-text-color": textColor }),
|
|
606
|
+
...(hoverColor && { "--card-hover-color": hoverColor }),
|
|
607
|
+
}
|
|
608
|
+
: undefined;
|
|
609
|
+
return (jsxRuntime.jsx("div", { className: "col", children: jsxRuntime.jsxs(Card$1, { className: "card-styles", style: inlineVars, 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 })] }) }));
|
|
601
610
|
};
|
|
602
611
|
|
|
603
612
|
const CardLayout = (props) => {
|
|
@@ -664,9 +673,27 @@ const CookieActions = ({ actions }) => (jsxRuntime.jsx("div", { className: "govu
|
|
|
664
673
|
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 })] }));
|
|
665
674
|
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))) }));
|
|
666
675
|
|
|
667
|
-
const DataNavigation = ({ dataId, setDataFocus, previousText = "Previous", previousCondition, nextText = "Next", nextCondition, dataDescription, }) => {
|
|
668
|
-
//
|
|
669
|
-
|
|
676
|
+
const DataNavigation = ({ dataId, setDataFocus, previousText = "Previous", previousCondition, nextText = "Next", nextCondition, dataDescription, buttonColour, buttonTextColour, buttonShadowColour, buttonHoverColour, buttonHoverTextColour, }) => {
|
|
677
|
+
// CSS custom properties set directly on each <button> element via Button's
|
|
678
|
+
// ...attributes spread, so they sit on the same element that
|
|
679
|
+
// .app-data-navigation-button targets — no inheritance from a parent div needed.
|
|
680
|
+
const inlineVars = {
|
|
681
|
+
...(buttonColour && { "--data-nav-button-colour": buttonColour }),
|
|
682
|
+
...(buttonTextColour && {
|
|
683
|
+
"--data-nav-button-text-colour": buttonTextColour,
|
|
684
|
+
}),
|
|
685
|
+
...(buttonShadowColour && {
|
|
686
|
+
"--data-nav-button-shadow-colour": buttonShadowColour,
|
|
687
|
+
}),
|
|
688
|
+
...(buttonHoverColour && {
|
|
689
|
+
"--data-nav-button-hover-colour": buttonHoverColour,
|
|
690
|
+
}),
|
|
691
|
+
...(buttonHoverTextColour && {
|
|
692
|
+
"--data-nav-button-hover-text-colour": buttonHoverTextColour,
|
|
693
|
+
}),
|
|
694
|
+
};
|
|
695
|
+
const hasInlineVars = Object.keys(inlineVars).length > 0;
|
|
696
|
+
const renderNavButton = (id, onClick, disabled, content) => (jsxRuntime.jsx(Button, { id: id, onClick: onClick, "data-testid": id, disabled: disabled, className: "app-data-navigation-button", ...(hasInlineVars && { style: inlineVars }), children: content }));
|
|
670
697
|
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" }) })] })) })] }));
|
|
671
698
|
};
|
|
672
699
|
|
|
@@ -761,13 +788,33 @@ function titleCase(str) {
|
|
|
761
788
|
.join(" ");
|
|
762
789
|
}
|
|
763
790
|
|
|
764
|
-
const DifferenceNavigation = ({ differenceId, setDifferenceFocus, totalDifferences, keyword = "variation", plural = "variations", }) => {
|
|
791
|
+
const DifferenceNavigation = ({ differenceId, setDifferenceFocus, totalDifferences, keyword = "variation", plural = "variations", buttonColour, buttonTextColour, buttonShadowColour, buttonHoverColour, buttonHoverTextColour, }) => {
|
|
765
792
|
if (totalDifferences === 0) {
|
|
766
793
|
return (jsxRuntime.jsxs("p", { className: "govuk-body govuk-!-font-size-20 govuk-!-text-align-centre", children: ["No ", `${plural}`, " found"] }));
|
|
767
794
|
}
|
|
795
|
+
// CSS custom properties set directly on each <button> element via Button's
|
|
796
|
+
// ...attributes spread, so they sit on the same element that
|
|
797
|
+
// .app-difference-navigation-button targets — no inheritance from a parent
|
|
798
|
+
// div needed. Only written when a prop is explicitly provided.
|
|
799
|
+
const inlineVars = {
|
|
800
|
+
...(buttonColour && { "--diff-nav-button-colour": buttonColour }),
|
|
801
|
+
...(buttonTextColour && {
|
|
802
|
+
"--diff-nav-button-text-colour": buttonTextColour,
|
|
803
|
+
}),
|
|
804
|
+
...(buttonShadowColour && {
|
|
805
|
+
"--diff-nav-button-shadow-colour": buttonShadowColour,
|
|
806
|
+
}),
|
|
807
|
+
...(buttonHoverColour && {
|
|
808
|
+
"--diff-nav-button-hover-colour": buttonHoverColour,
|
|
809
|
+
}),
|
|
810
|
+
...(buttonHoverTextColour && {
|
|
811
|
+
"--diff-nav-button-hover-text-colour": buttonHoverTextColour,
|
|
812
|
+
}),
|
|
813
|
+
};
|
|
814
|
+
const hasInlineVars = Object.keys(inlineVars).length > 0;
|
|
768
815
|
const isPreviousDisabled = differenceId <= 1;
|
|
769
816
|
const isNextDisabled = differenceId === totalDifferences;
|
|
770
|
-
const renderButton = (id, onClick, disabled, content) => (jsxRuntime.jsx(Button, { id: id, onClick: onClick, "data-testid": id, disabled: disabled, children: content }));
|
|
817
|
+
const renderButton = (id, onClick, disabled, content) => (jsxRuntime.jsx(Button, { id: id, onClick: onClick, "data-testid": id, disabled: disabled, className: "app-difference-navigation-button", ...(hasInlineVars && { style: inlineVars }), children: content }));
|
|
771
818
|
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" }) })] })) }) })] }));
|
|
772
819
|
};
|
|
773
820
|
|
|
@@ -831,6 +878,24 @@ function ConfigureOverallErrorSummary($scope, config) {
|
|
|
831
878
|
govukFrontend.createAll(govukFrontend.ErrorSummary, config, $scope);
|
|
832
879
|
}
|
|
833
880
|
|
|
881
|
+
const ExitThisPage = ({ children = "Exit this page", className, redirectUrl = "https://www.bbc.co.uk/weather", activatedText, timedOutText, pressTwoMoreTimesText, pressOneMoreTimeText, ...attributes }) => {
|
|
882
|
+
const i18nProps = {};
|
|
883
|
+
if (activatedText)
|
|
884
|
+
i18nProps["data-i18n.activated"] = activatedText;
|
|
885
|
+
if (timedOutText)
|
|
886
|
+
i18nProps["data-i18n.timed-out"] = timedOutText;
|
|
887
|
+
if (pressTwoMoreTimesText)
|
|
888
|
+
i18nProps["data-i18n.press-two-more-times"] = pressTwoMoreTimesText;
|
|
889
|
+
if (pressOneMoreTimeText)
|
|
890
|
+
i18nProps["data-i18n.press-one-more-time"] = pressOneMoreTimeText;
|
|
891
|
+
return (jsxRuntime.jsx("div", { ...attributes, ...i18nProps, className: `govuk-exit-this-page${className ? ` ${className}` : ""}`, "data-module": "govuk-exit-this-page", children: jsxRuntime.jsxs("a", { href: redirectUrl, role: "button", draggable: false, className: "govuk-button govuk-button--warning govuk-exit-this-page__button govuk-js-exit-this-page-button", "data-module": "govuk-button", rel: "nofollow noreferrer", children: [jsxRuntime.jsx("span", { className: "govuk-visually-hidden", children: "Emergency" }), " ", children] }) }));
|
|
892
|
+
};
|
|
893
|
+
ExitThisPage.displayName = "ExitThisPage";
|
|
894
|
+
|
|
895
|
+
function ConfigureOverallExitThisPage($scope) {
|
|
896
|
+
govukFrontend.createAll(govukFrontend.ExitThisPage, {}, $scope);
|
|
897
|
+
}
|
|
898
|
+
|
|
834
899
|
const FileUpload = (props) => {
|
|
835
900
|
const { className, errorMessage, formGroup, hint, label, "aria-describedby": describedBy, id, ...attributes } = props;
|
|
836
901
|
let hintComponent;
|
|
@@ -851,9 +916,10 @@ const FileUpload = (props) => {
|
|
|
851
916
|
FileUpload.displayName = "FileUpload";
|
|
852
917
|
|
|
853
918
|
const Footer = (props) => {
|
|
854
|
-
const { className, containerClassName, meta, navigation, ...attributes } = props;
|
|
919
|
+
const { className, containerClassName, meta, navigation, contentLicence, ...attributes } = props;
|
|
855
920
|
let navigationComponent;
|
|
856
921
|
let metaComponent;
|
|
922
|
+
let contentLicenceComponent;
|
|
857
923
|
if (navigation && navigation.length > 0) {
|
|
858
924
|
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) => {
|
|
859
925
|
const { className: itemClassName, children: itemChildren, reactListKey, ...itemAttributes } = item;
|
|
@@ -863,54 +929,40 @@ const Footer = (props) => {
|
|
|
863
929
|
if (meta) {
|
|
864
930
|
metaComponent = (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("h2", { className: "govuk-visually-hidden", children: meta.visuallyHiddenTitle
|
|
865
931
|
? meta.visuallyHiddenTitle
|
|
866
|
-
: "Support links" }), meta.items && meta.items.length > 0 ? (jsxRuntime.jsx(
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
932
|
+
: "Support links" }), meta.items && meta.items.length > 0 ? (jsxRuntime.jsx("ul", { className: "govuk-footer__inline-list", children: meta.items.map((item, index) => {
|
|
933
|
+
const { className: itemClassName, children: itemChildren, reactListKey, ...itemAttributes } = item;
|
|
934
|
+
return (jsxRuntime.jsx("li", { className: "govuk-footer__inline-list-item", children: jsxRuntime.jsx(LinkWithRef, { className: `govuk-footer__link ${itemClassName || ""}`, ...itemAttributes, children: itemChildren }) }, reactListKey || index));
|
|
935
|
+
}) })) : null, meta.children ? (jsxRuntime.jsx("div", { className: "govuk-footer__meta-custom", children: meta.children })) : null] }));
|
|
936
|
+
}
|
|
937
|
+
if (contentLicence) {
|
|
938
|
+
const { className: contentLicenceClassName, children: contentLicenceChildren, ...contentLicenceAttributes } = contentLicence;
|
|
939
|
+
contentLicenceComponent = (jsxRuntime.jsx("div", { className: contentLicenceClassName, ...contentLicenceAttributes, children: contentLicenceChildren }));
|
|
940
|
+
}
|
|
941
|
+
else if (contentLicence === undefined) {
|
|
942
|
+
contentLicenceComponent = (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [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"] })] }));
|
|
870
943
|
}
|
|
871
|
-
|
|
944
|
+
else {
|
|
945
|
+
contentLicenceComponent = jsxRuntime.jsx(jsxRuntime.Fragment, {});
|
|
946
|
+
}
|
|
947
|
+
return (jsxRuntime.jsx("footer", { className: `govuk-footer ${className || ""}`, role: "contentinfo", ...attributes, children: jsxRuntime.jsxs("div", { className: `govuk-width-container ${containerClassName || ""}`, children: [jsxRuntime.jsx("svg", { focusable: "false", role: "presentation", xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 64 60", height: "30", width: "32", fill: "currentcolor", className: "govuk-footer__crown", children: jsxRuntime.jsxs("g", { children: [jsxRuntime.jsx("circle", { cx: "20", cy: "17.6", r: "3.7" }), jsxRuntime.jsx("circle", { cx: "10.2", cy: "23.5", r: "3.7" }), jsxRuntime.jsx("circle", { cx: "3.7", cy: "33.2", r: "3.7" }), jsxRuntime.jsx("circle", { cx: "31.7", cy: "30.6", r: "3.7" }), jsxRuntime.jsx("circle", { cx: "43.3", cy: "17.6", r: "3.7" }), jsxRuntime.jsx("circle", { cx: "53.2", cy: "23.5", r: "3.7" }), jsxRuntime.jsx("circle", { cx: "59.7", cy: "33.2", r: "3.7" }), jsxRuntime.jsx("circle", { cx: "31.7", cy: "30.6", r: "3.7" }), jsxRuntime.jsx("path", { d: "M33.1,9.8c.2-.1.3-.3.5-.5l4.6,2.4v-6.8l-4.6,1.5c-.1-.2-.3-.3-.5-.5l1.9-5.9h-6.7l1.9,5.9c-.2.1-.3.3-.5.5l-4.6-1.5v6.8l4.6-2.4c.1.2.3.3.5.5l-2.6,8c-.9,2.8,1.2,5.7,4.1,5.7h0c3,0,5.1-2.9,4.1-5.7l-2.6-8ZM37,37.9s-3.4,3.8-4.1,6.1c2.2,0,4.2-.5,6.4-2.8l-.7,8.5c-2-2.8-4.4-4.1-5.7-3.8.1,3.1.5,6.7,5.8,7.2,3.7.3,6.7-1.5,7-3.8.4-2.6-2-4.3-3.7-1.6-1.4-4.5,2.4-6.1,4.9-3.2-1.9-4.5-1.8-7.7,2.4-10.9,3,4,2.6,7.3-1.2,11.1,2.4-1.3,6.2,0,4,4.6-1.2-2.8-3.7-2.2-4.2.2-.3,1.7.7,3.7,3,4.2,1.9.3,4.7-.9,7-5.9-1.3,0-2.4.7-3.9,1.7l2.4-8c.6,2.3,1.4,3.7,2.2,4.5.6-1.6.5-2.8,0-5.3l5,1.8c-2.6,3.6-5.2,8.7-7.3,17.5-7.4-1.1-15.7-1.7-24.5-1.7h0c-8.8,0-17.1.6-24.5,1.7-2.1-8.9-4.7-13.9-7.3-17.5l5-1.8c-.5,2.5-.6,3.7,0,5.3.8-.8,1.6-2.3,2.2-4.5l2.4,8c-1.5-1-2.6-1.7-3.9-1.7,2.3,5,5.2,6.2,7,5.9,2.3-.4,3.3-2.4,3-4.2-.5-2.4-3-3.1-4.2-.2-2.2-4.6,1.6-6,4-4.6-3.7-3.7-4.2-7.1-1.2-11.1,4.2,3.2,4.3,6.4,2.4,10.9,2.5-2.8,6.3-1.3,4.9,3.2-1.8-2.7-4.1-1-3.7,1.6.3,2.3,3.3,4.1,7,3.8,5.4-.5,5.7-4.2,5.8-7.2-1.3-.2-3.7,1-5.7,3.8l-.7-8.5c2.2,2.3,4.2,2.7,6.4,2.8-.7-2.3-4.1-6.1-4.1-6.1h10.6,0Z" })] }) }), navigationComponent, jsxRuntime.jsxs("div", { className: "govuk-footer__meta", children: [jsxRuntime.jsxs("div", { className: "govuk-footer__meta-item govuk-footer__meta-item--grow", children: [metaComponent, contentLicenceComponent] }), 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" }) })] })] }) }));
|
|
872
948
|
};
|
|
873
949
|
|
|
950
|
+
// Tudor Crown SVG — govuk-frontend v5+ (replaces old St. Edward's Crown)
|
|
951
|
+
const GovUKLogotype = () => (jsxRuntime.jsxs("svg", { focusable: "false", role: "img", xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 324 60", height: "30", width: "162", fill: "currentcolor", className: "govuk-header__logotype", "aria-label": "GOV.UK", children: [jsxRuntime.jsx("title", { children: "GOV.UK" }), jsxRuntime.jsxs("g", { children: [jsxRuntime.jsx("circle", { cx: "20", cy: "17.6", r: "3.7" }), jsxRuntime.jsx("circle", { cx: "10.2", cy: "23.5", r: "3.7" }), jsxRuntime.jsx("circle", { cx: "3.7", cy: "33.2", r: "3.7" }), jsxRuntime.jsx("circle", { cx: "31.7", cy: "30.6", r: "3.7" }), jsxRuntime.jsx("circle", { cx: "43.3", cy: "17.6", r: "3.7" }), jsxRuntime.jsx("circle", { cx: "53.2", cy: "23.5", r: "3.7" }), jsxRuntime.jsx("circle", { cx: "59.7", cy: "33.2", r: "3.7" }), jsxRuntime.jsx("circle", { cx: "31.7", cy: "30.6", r: "3.7" }), jsxRuntime.jsx("path", { d: "M33.1,9.8c.2-.1.3-.3.5-.5l4.6,2.4v-6.8l-4.6,1.5c-.1-.2-.3-.3-.5-.5l1.9-5.9h-6.7l1.9,5.9c-.2.1-.3.3-.5.5l-4.6-1.5v6.8l4.6-2.4c.1.2.3.3.5.5l-2.6,8c-.9,2.8,1.2,5.7,4.1,5.7h0c3,0,5.1-2.9,4.1-5.7l-2.6-8ZM37,37.9s-3.4,3.8-4.1,6.1c2.2,0,4.2-.5,6.4-2.8l-.7,8.5c-2-2.8-4.4-4.1-5.7-3.8.1,3.1.5,6.7,5.8,7.2,3.7.3,6.7-1.5,7-3.8.4-2.6-2-4.3-3.7-1.6-1.4-4.5,2.4-6.1,4.9-3.2-1.9-4.5-1.8-7.7,2.4-10.9,3,4,2.6,7.3-1.2,11.1,2.4-1.3,6.2,0,4,4.6-1.2-2.8-3.7-2.2-4.2.2-.3,1.7.7,3.7,3,4.2,1.9.3,4.7-.9,7-5.9-1.3,0-2.4.7-3.9,1.7l2.4-8c.6,2.3,1.4,3.7,2.2,4.5.6-1.6.5-2.8,0-5.3l5,1.8c-2.6,3.6-5.2,8.7-7.3,17.5-7.4-1.1-15.7-1.7-24.5-1.7h0c-8.8,0-17.1.6-24.5,1.7-2.1-8.9-4.7-13.9-7.3-17.5l5-1.8c-.5,2.5-.6,3.7,0,5.3.8-.8,1.6-2.3,2.2-4.5l2.4,8c-1.5-1-2.6-1.7-3.9-1.7,2.3,5,5.2,6.2,7,5.9,2.3-.4,3.3-2.4,3-4.2-.5-2.4-3-3.1-4.2-.2-2.2-4.6,1.6-6,4-4.6-3.7-3.7-4.2-7.1-1.2-11.1,4.2,3.2,4.3,6.4,2.4,10.9,2.5-2.8,6.3-1.3,4.9,3.2-1.8-2.7-4.1-1-3.7,1.6.3,2.3,3.3,4.1,7,3.8,5.4-.5,5.7-4.2,5.8-7.2-1.3-.2-3.7,1-5.7,3.8l-.7-8.5c2.2,2.3,4.2,2.7,6.4,2.8-.7-2.3-4.1-6.1-4.1-6.1h10.6,0Z" })] }), jsxRuntime.jsx("circle", { className: "govuk-logo-dot", cx: "226", cy: "36", r: "7.3" }), jsxRuntime.jsx("path", { d: "M93.94 41.25c.4 1.81 1.2 3.21 2.21 4.62 1 1.4 2.21 2.41 3.61 3.21s3.21 1.2 5.22 1.2 3.61-.4 4.82-1c1.4-.6 2.41-1.4 3.21-2.41.8-1 1.4-2.01 1.61-3.01s.4-2.01.4-3.01v.14h-10.86v-7.02h20.07v24.08h-8.03v-5.56c-.6.8-1.38 1.61-2.19 2.41-.8.8-1.81 1.2-2.81 1.81-1 .4-2.21.8-3.41 1.2s-2.41.4-3.81.4a18.56 18.56 0 0 1-14.65-6.63c-1.6-2.01-3.01-4.41-3.81-7.02s-1.4-5.62-1.4-8.83.4-6.02 1.4-8.83a20.45 20.45 0 0 1 19.46-13.65c3.21 0 4.01.2 5.82.8 1.81.4 3.61 1.2 5.02 2.01 1.61.8 2.81 2.01 4.01 3.21s2.21 2.61 2.81 4.21l-7.63 4.41c-.4-1-1-1.81-1.61-2.61-.6-.8-1.4-1.4-2.21-2.01-.8-.6-1.81-1-2.81-1.4-1-.4-2.21-.4-3.61-.4-2.01 0-3.81.4-5.22 1.2-1.4.8-2.61 1.81-3.61 3.21s-1.61 2.81-2.21 4.62c-.4 1.81-.6 3.71-.6 5.42s.8 5.22.8 5.22Zm57.8-27.9c3.21 0 6.22.6 8.63 1.81 2.41 1.2 4.82 2.81 6.62 4.82S170.2 24.39 171 27s1.4 5.62 1.4 8.83-.4 6.02-1.4 8.83-2.41 5.02-4.01 7.02-4.01 3.61-6.62 4.82-5.42 1.81-8.63 1.81-6.22-.6-8.63-1.81-4.82-2.81-6.42-4.82-3.21-4.41-4.01-7.02-1.4-5.62-1.4-8.83.4-6.02 1.4-8.83 2.41-5.02 4.01-7.02 4.01-3.61 6.42-4.82 5.42-1.81 8.63-1.81Zm0 36.73c1.81 0 3.61-.4 5.02-1s2.61-1.81 3.61-3.01 1.81-2.81 2.21-4.41c.4-1.81.8-3.61.8-5.62 0-2.21-.2-4.21-.8-6.02s-1.2-3.21-2.21-4.62c-1-1.2-2.21-2.21-3.61-3.01s-3.21-1-5.02-1-3.61.4-5.02 1c-1.4.8-2.61 1.81-3.61 3.01s-1.81 2.81-2.21 4.62c-.4 1.81-.8 3.61-.8 5.62 0 2.41.2 4.21.8 6.02.4 1.81 1.2 3.21 2.21 4.41s2.21 2.21 3.61 3.01c1.4.8 3.21 1 5.02 1Zm36.32 7.96-12.24-44.15h9.83l8.43 32.77h.4l8.23-32.77h9.83L200.3 58.04h-12.24Zm74.14-7.96c2.18 0 3.51-.6 3.51-.6 1.2-.6 2.01-1 2.81-1.81s1.4-1.81 1.81-2.81a13 13 0 0 0 .8-4.01V13.9h8.63v28.15c0 2.41-.4 4.62-1.4 6.62-.8 2.01-2.21 3.61-3.61 5.02s-3.41 2.41-5.62 3.21-4.62 1.2-7.02 1.2-5.02-.4-7.02-1.2c-2.21-.8-4.01-1.81-5.62-3.21s-2.81-3.01-3.61-5.02-1.4-4.21-1.4-6.62V13.9h8.63v26.95c0 1.61.2 3.01.8 4.01.4 1.2 1.2 2.21 2.01 2.81.8.8 1.81 1.4 2.81 1.81 0 0 1.34.6 3.51.6Zm34.22-36.18v18.92l15.65-18.92h10.82l-15.03 17.32 16.03 26.83h-10.21l-11.44-20.21-5.62 6.22v13.99h-8.83V13.9" })] }));
|
|
874
952
|
const Header = (props) => {
|
|
875
|
-
const { className, containerClassName = "govuk-width-container", homepageUrlHref = "/", homepageUrlTo, navigation, navigationClassName, productName, serviceName, serviceUrlHref, serviceUrlTo, navigationLabel = "Menu", menuButtonLabel = "Show or hide menu", removeGovUKHeader = null,
|
|
953
|
+
const { className, containerClassName = "govuk-width-container", homepageUrlHref = "/", homepageUrlTo, navigation, navigationClassName, productName, serviceName, serviceUrlHref, serviceUrlTo, navigationLabel = "Menu", menuButtonLabel = "Show or hide menu", removeGovUKHeader = null, ...attributes } = props;
|
|
876
954
|
let productNameComponent = null;
|
|
877
955
|
let navigationComponent = null;
|
|
878
956
|
if (productName) {
|
|
879
957
|
productNameComponent = (jsxRuntime.jsx("span", { className: "govuk-header__product-name", children: productName }));
|
|
880
958
|
}
|
|
881
959
|
if (serviceName || navigation) {
|
|
882
|
-
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.
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
}
|
|
889
|
-
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: {
|
|
890
|
-
__html: `
|
|
891
|
-
<!--[if gt IE 8]><!-->
|
|
892
|
-
<svg
|
|
893
|
-
aria-hidden="true"
|
|
894
|
-
focusable="false"
|
|
895
|
-
class="govuk-header__logotype-crown"
|
|
896
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
897
|
-
viewBox="0 0 132 97"
|
|
898
|
-
height="30"
|
|
899
|
-
width="36"
|
|
900
|
-
>
|
|
901
|
-
<path
|
|
902
|
-
fill="currentColor"
|
|
903
|
-
fillRule="evenodd"
|
|
904
|
-
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"
|
|
905
|
-
/>
|
|
906
|
-
</svg>
|
|
907
|
-
<!--<![endif]-->
|
|
908
|
-
<!--[if IE 8]>
|
|
909
|
-
<img src="${logo}" class="govuk-header__logotype-crown-fallback-image" width="36" height="32" />
|
|
910
|
-
<![endif]-->
|
|
911
|
-
<span class="govuk-header__logotype-text">GOV.UK</span>
|
|
912
|
-
`,
|
|
913
|
-
} })), productNameComponent] }) }), navigationComponent] }) }));
|
|
960
|
+
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.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) => {
|
|
961
|
+
const { active: itemActive, className: itemClassName, children: itemChildren, reactListKey, ...itemAttributes } = item;
|
|
962
|
+
return itemChildren ? (jsxRuntime.jsx("li", { className: `govuk-header__navigation-item${itemActive ? " govuk-header__navigation-item--active" : ""}`, children: item.href || item.to ? (jsxRuntime.jsx(LinkWithRef, { className: `govuk-header__link ${itemClassName || ""}`, ...itemAttributes, children: itemChildren })) : (itemChildren) }, reactListKey || index)) : null;
|
|
963
|
+
}) })] })) : null] }));
|
|
964
|
+
}
|
|
965
|
+
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__homepage-link", children: [!removeGovUKHeader && jsxRuntime.jsx(GovUKLogotype, {}), productNameComponent] }) }), navigationComponent] }) }));
|
|
914
966
|
};
|
|
915
967
|
|
|
916
968
|
function ConfigureOverallHeader($scope) {
|
|
@@ -955,6 +1007,17 @@ const NotificationBanner = (props) => {
|
|
|
955
1007
|
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) })] }));
|
|
956
1008
|
};
|
|
957
1009
|
|
|
1010
|
+
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"
|
|
1011
|
+
? "M8.107-.008L6.693 1.406 10.986 5.7H-2v2h12.896L6.71 11.676l1.378 1.449 6.744-6.406L8.107-.008z"
|
|
1012
|
+
: "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" }) }));
|
|
1013
|
+
|
|
1014
|
+
const NavigationButton = ({ href, type, children, labelText, }) => {
|
|
1015
|
+
const defaultText = type === "next" ? "Next" : "Previous";
|
|
1016
|
+
const typeClass = type === "next" ? "next" : "prev";
|
|
1017
|
+
const icon = (jsxRuntime.jsx(SvgIcon, { type: type, className: `govuk-pagination__icon govuk-pagination__icon--${typeClass}`, focusable: "false", "aria-hidden": "true" }));
|
|
1018
|
+
return (jsxRuntime.jsxs("a", { className: "govuk-link govuk-pagination__link", href: href, rel: type, children: [type === "previous" && icon, jsxRuntime.jsxs("span", { className: "govuk-pagination__link-title", children: [children ?? defaultText, jsxRuntime.jsx("span", { className: "govuk-visually-hidden", children: " page" })] }), type === "next" && icon, labelText && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("span", { className: "govuk-visually-hidden", children: ":" }), jsxRuntime.jsx("span", { className: "govuk-pagination__link-label", children: labelText })] }))] }));
|
|
1019
|
+
};
|
|
1020
|
+
|
|
958
1021
|
const DOTS = "...";
|
|
959
1022
|
const UsePagination = ({ totalCount, pageSize, siblingCount = 1, currentPage, }) => {
|
|
960
1023
|
const range = (start, end) => {
|
|
@@ -990,29 +1053,13 @@ const UsePagination = ({ totalCount, pageSize, siblingCount = 1, currentPage, })
|
|
|
990
1053
|
return paginationRange;
|
|
991
1054
|
};
|
|
992
1055
|
|
|
993
|
-
const
|
|
994
|
-
|
|
995
|
-
: "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" }) }));
|
|
996
|
-
|
|
997
|
-
const NavigationButton = ({ isDisabled, onClick, children, name, type, }) => {
|
|
998
|
-
const typeClass = type === "next" ? type : "prev";
|
|
999
|
-
const Icon = (jsxRuntime.jsx(SvgIcon, { type: type, className: `govuk-pagination__icon govuk-pagination__icon--${typeClass}`, focusable: "false" }));
|
|
1000
|
-
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" })] }))] }));
|
|
1001
|
-
};
|
|
1002
|
-
|
|
1003
|
-
const Pagination = ({ onPageChange, totalCount, siblingCount = 1, currentPage, pageSize, className, previousName = "Previous", nextName = "Next", previousChildren, nextChildren, }) => {
|
|
1004
|
-
const paginationRange = UsePagination({
|
|
1005
|
-
currentPage,
|
|
1006
|
-
totalCount,
|
|
1007
|
-
siblingCount,
|
|
1008
|
-
pageSize,
|
|
1009
|
-
});
|
|
1010
|
-
if (!paginationRange || paginationRange.length < 2)
|
|
1056
|
+
const Pagination = ({ previous, next, items, className, }) => {
|
|
1057
|
+
if (!previous && !next && (!items || items.length === 0))
|
|
1011
1058
|
return null;
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
const
|
|
1015
|
-
return (jsxRuntime.jsxs(
|
|
1059
|
+
// Block layout is used when there are no numbered page items — govuk renders
|
|
1060
|
+
// the nav with an extra class and the link title with --decorated modifier.
|
|
1061
|
+
const isBlockLayout = !items || items.length === 0;
|
|
1062
|
+
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--ellipses", 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 }) }))] }));
|
|
1016
1063
|
};
|
|
1017
1064
|
|
|
1018
1065
|
const Panel = (props) => {
|
|
@@ -1021,6 +1068,49 @@ const Panel = (props) => {
|
|
|
1021
1068
|
return (jsxRuntime.jsxs("div", { className: `govuk-panel govuk-panel--confirmation ${className || ""}`, ...attributes, children: [jsxRuntime.jsx(HeadingLevel, { className: "govuk-panel__title", children: titleChildren }), innerHtml] }));
|
|
1022
1069
|
};
|
|
1023
1070
|
|
|
1071
|
+
const PasswordInput = React.forwardRef((props, ref) => {
|
|
1072
|
+
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;
|
|
1073
|
+
let describedByValue = describedBy || "";
|
|
1074
|
+
let hintComponent = null;
|
|
1075
|
+
let errorMessageComponent = null;
|
|
1076
|
+
if (hint) {
|
|
1077
|
+
const hintId = `${id}-hint`;
|
|
1078
|
+
describedByValue += ` ${hintId}`;
|
|
1079
|
+
hintComponent = jsxRuntime.jsx(Hint, { ...hint, id: hintId });
|
|
1080
|
+
}
|
|
1081
|
+
if (errorMessage) {
|
|
1082
|
+
const errorId = id ? `${id}-error` : "";
|
|
1083
|
+
describedByValue += ` ${errorId}`;
|
|
1084
|
+
errorMessageComponent = jsxRuntime.jsx(ErrorMessage, { ...errorMessage, id: errorId });
|
|
1085
|
+
}
|
|
1086
|
+
// Build i18n data attributes for the govuk-frontend JS module
|
|
1087
|
+
const i18nProps = {};
|
|
1088
|
+
if (showPasswordText)
|
|
1089
|
+
i18nProps["data-i18n.show-password"] = showPasswordText;
|
|
1090
|
+
if (hidePasswordText)
|
|
1091
|
+
i18nProps["data-i18n.hide-password"] = hidePasswordText;
|
|
1092
|
+
if (showPasswordAriaLabelText)
|
|
1093
|
+
i18nProps["data-i18n.show-password-aria-label"] =
|
|
1094
|
+
showPasswordAriaLabelText;
|
|
1095
|
+
if (hidePasswordAriaLabelText)
|
|
1096
|
+
i18nProps["data-i18n.hide-password-aria-label"] =
|
|
1097
|
+
hidePasswordAriaLabelText;
|
|
1098
|
+
if (passwordShownAnnouncementText)
|
|
1099
|
+
i18nProps["data-i18n.password-shown-announcement"] =
|
|
1100
|
+
passwordShownAnnouncementText;
|
|
1101
|
+
if (passwordHiddenAnnouncementText)
|
|
1102
|
+
i18nProps["data-i18n.password-hidden-announcement"] =
|
|
1103
|
+
passwordHiddenAnnouncementText;
|
|
1104
|
+
// Label handles isPageHeading internally — no extra wrapper needed here
|
|
1105
|
+
const labelEl = jsxRuntime.jsx(Label, { ...label, htmlFor: id });
|
|
1106
|
+
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: 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 }), 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": id, "aria-label": showPasswordAriaLabelText, hidden: true, children: showPasswordText })] })] }));
|
|
1107
|
+
});
|
|
1108
|
+
PasswordInput.displayName = "PasswordInput";
|
|
1109
|
+
|
|
1110
|
+
function ConfigureOverallPasswordInput($scope) {
|
|
1111
|
+
govukFrontend.createAll(govukFrontend.PasswordInput, {}, $scope);
|
|
1112
|
+
}
|
|
1113
|
+
|
|
1024
1114
|
function Slugify(str) {
|
|
1025
1115
|
str = str.replace(/^\s+|\s+$/g, ""); // trim leading/trailing white space
|
|
1026
1116
|
str = str.toLowerCase(); // convert string to lowercase
|
|
@@ -1188,7 +1278,7 @@ const PDFViewer = (props) => {
|
|
|
1188
1278
|
// 1) Let ResolvePDFSource handle base64/data/blob inputs synchronously.
|
|
1189
1279
|
try {
|
|
1190
1280
|
const resolved = ResolvePDFSource(src);
|
|
1191
|
-
if (resolved
|
|
1281
|
+
if (resolved?.source) {
|
|
1192
1282
|
sourceToUse = resolved.source;
|
|
1193
1283
|
if (resolved.isBase64Source) {
|
|
1194
1284
|
// ResolvePDFSource created an object URL for us (data/blob/base64)
|
|
@@ -1215,11 +1305,7 @@ const PDFViewer = (props) => {
|
|
|
1215
1305
|
signal: controller.signal,
|
|
1216
1306
|
credentials: "omit",
|
|
1217
1307
|
});
|
|
1218
|
-
if (
|
|
1219
|
-
console.warn(`PDFViewer: fetch returned ${resp.status} ${resp.statusText} for ${src}`);
|
|
1220
|
-
// fallback: keep using original src
|
|
1221
|
-
}
|
|
1222
|
-
else {
|
|
1308
|
+
if (resp.ok) {
|
|
1223
1309
|
const blob = await resp.blob();
|
|
1224
1310
|
if (blob && blob.size > 0) {
|
|
1225
1311
|
const obj = URL.createObjectURL(blob);
|
|
@@ -1231,9 +1317,13 @@ const PDFViewer = (props) => {
|
|
|
1231
1317
|
console.warn("PDFViewer: fetched blob is empty - falling back to original src");
|
|
1232
1318
|
}
|
|
1233
1319
|
}
|
|
1320
|
+
else {
|
|
1321
|
+
console.warn(`PDFViewer: fetch returned ${resp.status} ${resp.statusText} for ${src}`);
|
|
1322
|
+
// fallback: keep using original src
|
|
1323
|
+
}
|
|
1234
1324
|
}
|
|
1235
1325
|
catch (err) {
|
|
1236
|
-
if (err
|
|
1326
|
+
if (err instanceof Error && err.name === "AbortError") {
|
|
1237
1327
|
// aborted, nothing to do
|
|
1238
1328
|
if (!mounted)
|
|
1239
1329
|
return;
|
|
@@ -1560,11 +1650,14 @@ exports.ConfigureOverallAccordion = ConfigureOverallAccordion;
|
|
|
1560
1650
|
exports.ConfigureOverallButton = ConfigureOverallButton;
|
|
1561
1651
|
exports.ConfigureOverallCheckboxes = ConfigureOverallCheckboxes;
|
|
1562
1652
|
exports.ConfigureOverallErrorSummary = ConfigureOverallErrorSummary;
|
|
1653
|
+
exports.ConfigureOverallExitThisPage = ConfigureOverallExitThisPage;
|
|
1563
1654
|
exports.ConfigureOverallHeader = ConfigureOverallHeader;
|
|
1655
|
+
exports.ConfigureOverallPasswordInput = ConfigureOverallPasswordInput;
|
|
1564
1656
|
exports.ConfigureOverallRadios = ConfigureOverallRadios;
|
|
1565
1657
|
exports.ConfigureOverallSkipLink = ConfigureOverallSkipLink;
|
|
1566
1658
|
exports.ConfigureOverallTabs = ConfigureOverallTabs;
|
|
1567
1659
|
exports.CookieBanner = CookieBanner;
|
|
1660
|
+
exports.DOTS = DOTS;
|
|
1568
1661
|
exports.DataNavigation = DataNavigation;
|
|
1569
1662
|
exports.DateInput = DateInput;
|
|
1570
1663
|
exports.Details = Details;
|
|
@@ -1572,6 +1665,7 @@ exports.DifferenceNavigation = DifferenceNavigation;
|
|
|
1572
1665
|
exports.ErrorBoundary = ErrorBoundary;
|
|
1573
1666
|
exports.ErrorMessage = ErrorMessage;
|
|
1574
1667
|
exports.ErrorSummary = ErrorSummary;
|
|
1668
|
+
exports.ExitThisPage = ExitThisPage;
|
|
1575
1669
|
exports.ExtractAccordionConfigFromAttributes = ExtractAccordionConfigFromAttributes;
|
|
1576
1670
|
exports.Fieldset = Fieldset;
|
|
1577
1671
|
exports.FileUpload = FileUpload;
|
|
@@ -1591,6 +1685,7 @@ exports.PDFViewer = PDFViewer;
|
|
|
1591
1685
|
exports.PDFViewerBackend = PDFViewerBackend;
|
|
1592
1686
|
exports.Pagination = Pagination;
|
|
1593
1687
|
exports.Panel = Panel;
|
|
1688
|
+
exports.PasswordInput = PasswordInput;
|
|
1594
1689
|
exports.PhaseBanner = PhaseBanner;
|
|
1595
1690
|
exports.ProblemWithService = ProblemWithService;
|
|
1596
1691
|
exports.Radios = Radios;
|
|
@@ -1603,6 +1698,7 @@ exports.Tabs = Tabs;
|
|
|
1603
1698
|
exports.Tag = Tag;
|
|
1604
1699
|
exports.TaskList = TaskList;
|
|
1605
1700
|
exports.Textarea = Textarea;
|
|
1701
|
+
exports.UsePagination = UsePagination;
|
|
1606
1702
|
exports.WarningInfo = WarningInfo;
|
|
1607
1703
|
exports.WarningText = WarningText;
|
|
1608
1704
|
//# sourceMappingURL=index.cjs.js.map
|