@scottish-government/designsystem-react 0.5.1 → 0.7.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/.svgrrc +2 -1
- package/.svgrrc_documents +15 -0
- package/@types/common/FileIcon.d.ts +7 -0
- package/@types/components/Accordion.d.ts +2 -2
- package/@types/components/ConfirmationMessage.d.ts +1 -1
- package/@types/components/FileDownload.d.ts +11 -0
- package/@types/components/NotificationPanel.d.ts +1 -1
- package/@types/components/SummaryCard.d.ts +1 -1
- package/@types/components/Tabs.d.ts +1 -1
- package/@types/sgds.d.ts +2 -1
- package/CHANGELOG.md +81 -0
- package/README.md +4 -0
- package/dist/common/AbstractNotificationBanner.jsx +63 -0
- package/dist/common/ConditionalWrapper.jsx +8 -0
- package/dist/common/FileIcon.jsx +51 -0
- package/dist/common/HintText.jsx +9 -0
- package/dist/common/Icon.jsx +57 -0
- package/dist/common/ScreenReaderText.jsx +9 -0
- package/dist/common/WrapperTag.jsx +11 -0
- package/dist/common/file-icon.jsx +51 -0
- package/dist/common/icon.jsx +1 -1
- package/dist/components/Accordion/Accordion.jsx +102 -0
- package/dist/components/AspectBox/AspectBox.jsx +79 -0
- package/dist/components/BackToTop/BackToTop.jsx +27 -0
- package/dist/components/Breadcrumbs/Breadcrumbs.jsx +28 -0
- package/dist/components/Button/Button.jsx +30 -0
- package/dist/components/Checkbox/Checkbox.jsx +62 -0
- package/dist/components/ConfirmationMessage/ConfirmationMessage.jsx +24 -0
- package/dist/components/ContentsNav/ContentsNav.jsx +33 -0
- package/dist/components/CookieBanner/CookieBanner.jsx +21 -0
- package/dist/components/DatePicker/DatePicker.jsx +54 -0
- package/dist/components/Details/Details.jsx +17 -0
- package/dist/components/ErrorMessage/ErrorMessage.jsx +12 -0
- package/dist/components/ErrorSummary/ErrorSummary.jsx +27 -0
- package/dist/components/FileDownload/FileDownload.jsx +50 -0
- package/dist/components/HideThisPage/HideThisPage.jsx +71 -0
- package/dist/components/InsetText/InsetText.jsx +14 -0
- package/dist/components/NotificationBanner/NotificationBanner.jsx +26 -0
- package/dist/components/NotificationPanel/NotificationPanel.jsx +21 -0
- package/dist/components/PageHeader/PageHeader.jsx +15 -0
- package/dist/components/PageMetadata/PageMetadata.jsx +26 -0
- package/dist/components/Pagination/Pagination.jsx +97 -0
- package/dist/components/PhaseBanner/PhaseBanner.jsx +23 -0
- package/dist/components/Question/Question.jsx +22 -0
- package/dist/components/RadioButton/RadioButton.jsx +43 -0
- package/dist/components/Select/Select.jsx +52 -0
- package/dist/components/SequentialNavigation/SequentialNavigation.jsx +31 -0
- package/dist/components/SideNavigation/SideNavigation.jsx +52 -0
- package/dist/components/SiteHeader/SiteHeader.jsx +68 -0
- package/dist/components/SiteNavigation/SiteNavigation.jsx +22 -0
- package/dist/components/SiteSearch/SiteSearch.jsx +55 -0
- package/dist/components/SkipLinks/SkipLinks.jsx +21 -0
- package/dist/components/SummaryCard/SummaryCard.jsx +67 -0
- package/dist/components/SummaryList/SummaryList.jsx +75 -0
- package/dist/components/Table/Table.jsx +24 -0
- package/dist/components/Tabs/Tabs.jsx +99 -0
- package/dist/components/Tag/Tag.jsx +13 -0
- package/dist/components/TaskList/TaskList.jsx +95 -0
- package/dist/components/TextInput/TextInput.jsx +58 -0
- package/dist/components/Textarea/Textarea.jsx +54 -0
- package/dist/components/WarningText/WarningText.jsx +16 -0
- package/dist/components/file-download/file-download.jsx +50 -0
- package/dist/images/documents/audio.jsx +47 -0
- package/dist/images/documents/csv.jsx +57 -0
- package/dist/images/documents/excel.jsx +57 -0
- package/dist/images/documents/file.jsx +48 -0
- package/dist/images/documents/generic.jsx +47 -0
- package/dist/images/documents/geodata.jsx +44 -0
- package/dist/images/documents/ical.jsx +48 -0
- package/dist/images/documents/ico.jsx +48 -0
- package/dist/images/documents/image.jsx +43 -0
- package/dist/images/documents/index.js +50 -0
- package/dist/images/documents/odf.jsx +46 -0
- package/dist/images/documents/odg.jsx +46 -0
- package/dist/images/documents/odp.jsx +45 -0
- package/dist/images/documents/ods.jsx +55 -0
- package/dist/images/documents/odt.jsx +46 -0
- package/dist/images/documents/pdf.jsx +48 -0
- package/dist/images/documents/ppt.jsx +47 -0
- package/dist/images/documents/rtf.jsx +48 -0
- package/dist/images/documents/text.jsx +48 -0
- package/dist/images/documents/video.jsx +47 -0
- package/dist/images/documents/word.jsx +48 -0
- package/dist/images/documents/xml.jsx +48 -0
- package/dist/images/documents/zip.jsx +48 -0
- package/dist/images/icons/arrow_upward.jsx +41 -0
- package/dist/images/icons/calendar_today.jsx +41 -0
- package/dist/images/icons/cancel.jsx +40 -0
- package/dist/images/icons/check_circle.jsx +41 -0
- package/dist/images/icons/chevron_left.jsx +41 -0
- package/dist/images/icons/chevron_right.jsx +41 -0
- package/dist/images/icons/close.jsx +41 -0
- package/dist/images/icons/description.jsx +41 -0
- package/dist/images/icons/double_chevron_left.jsx +40 -0
- package/dist/images/icons/double_chevron_right.jsx +40 -0
- package/dist/images/icons/error.jsx +41 -0
- package/dist/images/icons/expand_less.jsx +41 -0
- package/dist/images/icons/expand_more.jsx +41 -0
- package/dist/images/icons/index.js +40 -0
- package/dist/images/icons/list.jsx +44 -0
- package/dist/images/icons/menu.jsx +41 -0
- package/dist/images/icons/priority_high.jsx +42 -0
- package/dist/images/icons/search.jsx +41 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -1
- package/src/common/{abstract-notification-banner.test.tsx → AbstractNotificationBanner.test.tsx} +11 -11
- package/src/common/{abstract-notification-banner.tsx → AbstractNotificationBanner.tsx} +2 -2
- package/src/common/{conditional-wrapper.test.tsx → ConditionalWrapper.test.tsx} +1 -1
- package/src/common/FileIcon.test.tsx +50 -0
- package/src/common/FileIcon.tsx +25 -0
- package/src/common/{hint-text.test.tsx → HintText.test.tsx} +12 -12
- package/src/common/{icon.test.tsx → Icon.test.tsx} +16 -16
- package/src/common/{icon.tsx → Icon.tsx} +1 -1
- package/src/common/{screen-reader-text.test.tsx → ScreenReaderText.test.tsx} +5 -5
- package/src/common/{wrapper-tag.test.tsx → WrapperTag.test.tsx} +5 -5
- package/src/components/{accordion/accordion.test.tsx → Accordion/Accordion.test.tsx} +35 -35
- package/src/components/{accordion/accordion.tsx → Accordion/Accordion.tsx} +5 -5
- package/src/components/{aspect-box/aspect-box.test.tsx → AspectBox/AspectBox.test.tsx} +2 -2
- package/src/components/{back-to-top/back-to-top.test.tsx → BackToTop/BackToTop.test.tsx} +1 -1
- package/src/components/{back-to-top/back-to-top.tsx → BackToTop/BackToTop.tsx} +1 -1
- package/src/components/{breadcrumbs/breadcrumbs.test.tsx → Breadcrumbs/Breadcrumbs.test.tsx} +7 -7
- package/src/components/{button/button.test.tsx → Button/Button.test.tsx} +1 -1
- package/src/components/{button/button.tsx → Button/Button.tsx} +3 -3
- package/src/components/{checkbox/checkbox.test.tsx → Checkbox/Checkbox.test.tsx} +16 -16
- package/src/components/{checkbox/checkbox.tsx → Checkbox/Checkbox.tsx} +1 -1
- package/src/components/{confirmation-message/confirmation-message.test.tsx → ConfirmationMessage/ConfirmationMessage.test.tsx} +12 -14
- package/src/components/{confirmation-message/confirmation-message.tsx → ConfirmationMessage/ConfirmationMessage.tsx} +4 -4
- package/src/components/{contents-nav/contents-nav.test.tsx → ContentsNav/ContentsNav.test.tsx} +21 -28
- package/src/components/{contents-nav/contents-nav.tsx → ContentsNav/ContentsNav.tsx} +1 -1
- package/src/components/{cookie-banner/cookie-banner.test.tsx → CookieBanner/CookieBanner.test.tsx} +3 -3
- package/src/components/{cookie-banner/cookie-banner.tsx → CookieBanner/CookieBanner.tsx} +1 -1
- package/src/components/{date-picker/date-picker.test.tsx → DatePicker/DatePicker.test.tsx} +76 -66
- package/src/components/{date-picker/date-picker.tsx → DatePicker/DatePicker.tsx} +2 -2
- package/src/components/{details/details.test.tsx → Details/Details.test.tsx} +10 -10
- package/src/components/{error-message/error-message.test.tsx → ErrorMessage/ErrorMessage.test.tsx} +10 -10
- package/src/components/{error-summary/error-summary.test.tsx → ErrorSummary/ErrorSummary.test.tsx} +13 -14
- package/src/components/{error-summary/error-summary.tsx → ErrorSummary/ErrorSummary.tsx} +1 -1
- package/src/components/FileDownload/FileDownload.test.tsx +167 -0
- package/src/components/FileDownload/FileDownload.tsx +67 -0
- package/src/components/{hide-this-page/hide-this-page.test.tsx → HideThisPage/HideThisPage.test.tsx} +4 -4
- package/src/components/{hide-this-page/hide-this-page.tsx → HideThisPage/HideThisPage.tsx} +3 -3
- package/src/components/{inset-text/inset-text.test.tsx → InsetText/InsetText.test.tsx} +1 -1
- package/src/components/{notification-banner/notification-banner.test.tsx → NotificationBanner/NotificationBanner.test.tsx} +4 -4
- package/src/components/{notification-banner/notification-banner.tsx → NotificationBanner/NotificationBanner.tsx} +1 -1
- package/src/components/{notification-panel/notification-panel.test.tsx → NotificationPanel/NotificationPanel.test.tsx} +24 -23
- package/src/components/{notification-panel/notification-panel.tsx → NotificationPanel/NotificationPanel.tsx} +3 -3
- package/src/components/{page-header/page-header.test.tsx → PageHeader/PageHeader.test.tsx} +9 -9
- package/src/components/{page-metadata/page-metadata.test.tsx → PageMetadata/PageMetadata.test.tsx} +9 -9
- package/src/components/{pagination/pagination.test.tsx → Pagination/Pagination.test.tsx} +56 -56
- package/src/components/{pagination/pagination.tsx → Pagination/Pagination.tsx} +1 -1
- package/src/components/{phase-banner/phase-banner.test.tsx → PhaseBanner/PhaseBanner.test.tsx} +9 -9
- package/src/components/{phase-banner/phase-banner.tsx → PhaseBanner/PhaseBanner.tsx} +1 -1
- package/src/components/{question/question.test.tsx → Question/Question.test.tsx} +10 -10
- package/src/components/{question/question.tsx → Question/Question.tsx} +3 -3
- package/src/components/{radio-button/radio-button.test.tsx → RadioButton/RadioButton.test.tsx} +23 -23
- package/src/components/{radio-button/radio-button.tsx → RadioButton/RadioButton.tsx} +1 -1
- package/src/components/{select/select.test.tsx → Select/Select.test.tsx} +67 -64
- package/src/components/{select/select.tsx → Select/Select.tsx} +2 -2
- package/src/components/{sequential-navigation/sequential-navigation.test.tsx → SequentialNavigation/SequentialNavigation.test.tsx} +18 -18
- package/src/components/{side-navigation/side-navigation.test.tsx → SideNavigation/SideNavigation.test.tsx} +8 -8
- package/src/components/{site-header/site-header.test.tsx → SiteHeader/SiteHeader.test.tsx} +25 -25
- package/src/components/{site-header/site-header.tsx → SiteHeader/SiteHeader.tsx} +4 -4
- package/src/components/{site-navigation/site-navigation.test.tsx → SiteNavigation/SiteNavigation.test.tsx} +8 -8
- package/src/components/{site-search/site-search.test.tsx → SiteSearch/SiteSearch.test.tsx} +16 -16
- package/src/components/{site-search/site-search.tsx → SiteSearch/SiteSearch.tsx} +1 -1
- package/src/components/{skip-links/skip-links.test.tsx → SkipLinks/SkipLinks.test.tsx} +15 -15
- package/src/components/{summary-card/summary-card.test.tsx → SummaryCard/SummaryCard.test.tsx} +28 -28
- package/src/components/{summary-card/summary-card.tsx → SummaryCard/SummaryCard.tsx} +4 -4
- package/src/components/{summary-list/summary-list.test.tsx → SummaryList/SummaryList.test.tsx} +55 -56
- package/src/components/{summary-list/summary-list.tsx → SummaryList/SummaryList.tsx} +2 -2
- package/src/components/{table/table.test.tsx → Table/Table.test.tsx} +4 -4
- package/src/components/{tabs/tabs.test.tsx → Tabs/Tabs.test.tsx} +22 -42
- package/src/components/{tabs/tabs.tsx → Tabs/Tabs.tsx} +3 -3
- package/src/components/{tag/tag.test.tsx → Tag/Tag.test.tsx} +10 -10
- package/src/components/{task-list/task-list.test.tsx → TaskList/TaskList.test.tsx} +109 -108
- package/src/components/{task-list/task-list.tsx → TaskList/TaskList.tsx} +4 -4
- package/src/components/{text-input/text-input.test.tsx → TextInput/TextInput.test.tsx} +92 -87
- package/src/components/{text-input/text-input.tsx → TextInput/TextInput.tsx} +4 -4
- package/src/components/{textarea/textarea.test.tsx → Textarea/Textarea.test.tsx} +71 -67
- package/src/components/{textarea/textarea.tsx → Textarea/Textarea.tsx} +3 -3
- package/src/components/{warning-text/warning-text.test.tsx → WarningText/WarningText.test.tsx} +1 -1
- package/src/images/documents/audio.tsx +34 -0
- package/src/images/documents/csv.tsx +39 -0
- package/src/images/documents/excel.tsx +39 -0
- package/src/images/documents/file.tsx +30 -0
- package/src/images/documents/generic.tsx +26 -0
- package/src/images/documents/geodata.tsx +29 -0
- package/src/images/documents/ical.tsx +30 -0
- package/src/images/documents/ico.tsx +30 -0
- package/src/images/documents/image.tsx +25 -0
- package/src/images/documents/index.ts +22 -0
- package/src/images/documents/odf.tsx +28 -0
- package/src/images/documents/odg.tsx +28 -0
- package/src/images/documents/odp.tsx +33 -0
- package/src/images/documents/ods.tsx +37 -0
- package/src/images/documents/odt.tsx +28 -0
- package/src/images/documents/pdf.tsx +30 -0
- package/src/images/documents/ppt.tsx +28 -0
- package/src/images/documents/rtf.tsx +30 -0
- package/src/images/documents/text.tsx +30 -0
- package/src/images/documents/video.tsx +34 -0
- package/src/images/documents/word.tsx +30 -0
- package/src/images/documents/xml.tsx +30 -0
- package/src/images/documents/zip.tsx +30 -0
- package/src/images/icons/index.ts +17 -0
- package/vite.config.ts +1 -1
- package/src/icons/index.ts +0 -17
- /package/src/common/{conditional-wrapper.tsx → ConditionalWrapper.tsx} +0 -0
- /package/src/common/{hint-text.tsx → HintText.tsx} +0 -0
- /package/src/common/{screen-reader-text.tsx → ScreenReaderText.tsx} +0 -0
- /package/src/common/{wrapper-tag.tsx → WrapperTag.tsx} +0 -0
- /package/src/components/{aspect-box/aspect-box.tsx → AspectBox/AspectBox.tsx} +0 -0
- /package/src/components/{breadcrumbs/breadcrumbs.tsx → Breadcrumbs/Breadcrumbs.tsx} +0 -0
- /package/src/components/{details/details.tsx → Details/Details.tsx} +0 -0
- /package/src/components/{error-message/error-message.tsx → ErrorMessage/ErrorMessage.tsx} +0 -0
- /package/src/components/{inset-text/inset-text.tsx → InsetText/InsetText.tsx} +0 -0
- /package/src/components/{page-header/page-header.tsx → PageHeader/PageHeader.tsx} +0 -0
- /package/src/components/{page-metadata/page-metadata.tsx → PageMetadata/PageMetadata.tsx} +0 -0
- /package/src/components/{sequential-navigation/sequential-navigation.tsx → SequentialNavigation/SequentialNavigation.tsx} +0 -0
- /package/src/components/{side-navigation/side-navigation.tsx → SideNavigation/SideNavigation.tsx} +0 -0
- /package/src/components/{site-navigation/site-navigation.tsx → SiteNavigation/SiteNavigation.tsx} +0 -0
- /package/src/components/{skip-links/skip-links.tsx → SkipLinks/SkipLinks.tsx} +0 -0
- /package/src/components/{table/table.tsx → Table/Table.tsx} +0 -0
- /package/src/components/{tag/tag.tsx → Tag/Tag.tsx} +0 -0
- /package/src/components/{warning-text/warning-text.tsx → WarningText/WarningText.tsx} +0 -0
- /package/src/{icons/ArrowUpward.tsx → images/icons/arrow_upward.tsx} +0 -0
- /package/src/{icons/CalendarToday.tsx → images/icons/calendar_today.tsx} +0 -0
- /package/src/{icons/Cancel.tsx → images/icons/cancel.tsx} +0 -0
- /package/src/{icons/CheckCircle.tsx → images/icons/check_circle.tsx} +0 -0
- /package/src/{icons/ChevronLeft.tsx → images/icons/chevron_left.tsx} +0 -0
- /package/src/{icons/ChevronRight.tsx → images/icons/chevron_right.tsx} +0 -0
- /package/src/{icons/Close.tsx → images/icons/close.tsx} +0 -0
- /package/src/{icons/Description.tsx → images/icons/description.tsx} +0 -0
- /package/src/{icons/DoubleChevronLeft.tsx → images/icons/double_chevron_left.tsx} +0 -0
- /package/src/{icons/DoubleChevronRight.tsx → images/icons/double_chevron_right.tsx} +0 -0
- /package/src/{icons/Error.tsx → images/icons/error.tsx} +0 -0
- /package/src/{icons/ExpandLess.tsx → images/icons/expand_less.tsx} +0 -0
- /package/src/{icons/ExpandMore.tsx → images/icons/expand_more.tsx} +0 -0
- /package/src/{icons/List.tsx → images/icons/list.tsx} +0 -0
- /package/src/{icons/Menu.tsx → images/icons/menu.tsx} +0 -0
- /package/src/{icons/PriorityHigh.tsx → images/icons/priority_high.tsx} +0 -0
- /package/src/{icons/Search.tsx → images/icons/search.tsx} +0 -0
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const MetadataItem = ({ children, className, name, ...props }) => {
|
|
4
|
+
return (<div className={[
|
|
5
|
+
'ds_metadata__item',
|
|
6
|
+
className
|
|
7
|
+
].join(' ')} {...props}>
|
|
8
|
+
<dt className="ds_metadata__key">{name}</dt>{' '}
|
|
9
|
+
<dd className="ds_metadata__value">
|
|
10
|
+
{children}
|
|
11
|
+
</dd>
|
|
12
|
+
</div>);
|
|
13
|
+
};
|
|
14
|
+
const Metadata = ({ children, className, inline, ...props }) => {
|
|
15
|
+
return (<dl className={[
|
|
16
|
+
'ds_metadata',
|
|
17
|
+
inline && 'ds_metadata--inline',
|
|
18
|
+
className
|
|
19
|
+
].join(' ')} {...props}>
|
|
20
|
+
{children}
|
|
21
|
+
</dl>);
|
|
22
|
+
};
|
|
23
|
+
Metadata.displayName = 'Metadata';
|
|
24
|
+
MetadataItem.displayName = 'Metadata.Item';
|
|
25
|
+
Metadata.Item = MetadataItem;
|
|
26
|
+
exports.default = Metadata;
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.Ellipsis = exports.Page = void 0;
|
|
7
|
+
const Icon_1 = __importDefault(require("../../common/Icon"));
|
|
8
|
+
const Page = ({ ariaLabel, current = false, href, onClick, text }) => {
|
|
9
|
+
function handleClick(event) {
|
|
10
|
+
if (typeof onClick === 'function') {
|
|
11
|
+
onClick(event);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
return (<li className="ds_pagination__item">
|
|
15
|
+
<a aria-label={ariaLabel} className={[
|
|
16
|
+
'ds_pagination__link',
|
|
17
|
+
current ? 'ds_current' : undefined
|
|
18
|
+
].join(' ')} href={href} aria-current={current ? "page" : undefined} onClick={handleClick}>
|
|
19
|
+
<span className="ds_pagination__link-label">{text}</span>
|
|
20
|
+
</a>
|
|
21
|
+
</li>);
|
|
22
|
+
};
|
|
23
|
+
exports.Page = Page;
|
|
24
|
+
const Ellipsis = () => {
|
|
25
|
+
return (<li className="ds_pagination__item" aria-hidden="true">
|
|
26
|
+
<span className="ds_pagination__link ds_pagination__link--ellipsis">…</span>
|
|
27
|
+
</li>);
|
|
28
|
+
};
|
|
29
|
+
exports.Ellipsis = Ellipsis;
|
|
30
|
+
const Pagination = ({ ariaLabel = 'Pages', className, onClick, padding = 1, page = 1, pattern = '/search?page=$1', totalPages, ...props }) => {
|
|
31
|
+
padding = Number(padding);
|
|
32
|
+
page = Number(page);
|
|
33
|
+
const minToShow = padding + 2;
|
|
34
|
+
let includeFirst, includeLast;
|
|
35
|
+
let pages = [];
|
|
36
|
+
if (page <= minToShow) {
|
|
37
|
+
for (let i = 1; i <= minToShow + 1; i++) {
|
|
38
|
+
pages.push(Number(i));
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
else if (page <= totalPages - minToShow) {
|
|
42
|
+
pages = [page];
|
|
43
|
+
for (let i = 0; i < padding; i++) {
|
|
44
|
+
pages.unshift(page - 1 - i);
|
|
45
|
+
pages.push(Number(page) + 1 + i);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
else {
|
|
49
|
+
for (let i = totalPages; i > totalPages - minToShow - 1; i--) {
|
|
50
|
+
pages.push(Number(i));
|
|
51
|
+
}
|
|
52
|
+
pages.reverse();
|
|
53
|
+
}
|
|
54
|
+
// filter out pages that are out of bounds
|
|
55
|
+
pages = pages.filter(item => item > 0 && item <= totalPages);
|
|
56
|
+
if ((page - padding) > 2) {
|
|
57
|
+
includeFirst = true;
|
|
58
|
+
}
|
|
59
|
+
if ((page + padding < totalPages - 1)) {
|
|
60
|
+
includeLast = true;
|
|
61
|
+
}
|
|
62
|
+
return (<nav className={[
|
|
63
|
+
'ds_pagination',
|
|
64
|
+
className
|
|
65
|
+
].join(' ')} aria-label={ariaLabel} {...props}>
|
|
66
|
+
<ul className="ds_pagination__list">
|
|
67
|
+
{page > 1 && (<li className="ds_pagination__item">
|
|
68
|
+
<a aria-label="Previous page" className="ds_pagination__link ds_pagination__link--text ds_pagination__link--icon" href={pattern.replace('$1', String(page - 1))} data-search="pagination-previous" onClick={onClick}>
|
|
69
|
+
<Icon_1.default icon="ChevronLeft"/>
|
|
70
|
+
<span className="ds_pagination__link-label">Previous</span>
|
|
71
|
+
</a>
|
|
72
|
+
</li>)}
|
|
73
|
+
|
|
74
|
+
{includeFirst && (<>
|
|
75
|
+
<exports.Page ariaLabel="Page 1" href={pattern.replace('$1', String(1))} onClick={onClick} text="1"/>
|
|
76
|
+
<exports.Ellipsis />
|
|
77
|
+
</>)}
|
|
78
|
+
|
|
79
|
+
{pages && pages.map((item, index) => (<exports.Page ariaLabel={`Page ${item}`} current={item === page} href={pattern.replace('$1', String(item))} key={`pagination${index}`} onClick={onClick} pattern={pattern} text={item.toString()}/>))}
|
|
80
|
+
|
|
81
|
+
{includeLast && (<>
|
|
82
|
+
<exports.Ellipsis />
|
|
83
|
+
<exports.Page ariaLabel={`Page ${totalPages}`} href={pattern.replace('$1', String(totalPages))} onClick={onClick} pattern={pattern} text={totalPages.toString()}/>
|
|
84
|
+
</>)}
|
|
85
|
+
|
|
86
|
+
{page < totalPages && (<li className="ds_pagination__item">
|
|
87
|
+
<a aria-label="Next page" className="ds_pagination__link ds_pagination__link--text ds_pagination__link--icon" href={pattern.replace('$1', String(page + 1))} data-search="pagination-next" onClick={onClick}>
|
|
88
|
+
<span className="ds_pagination__link-label">Next</span>
|
|
89
|
+
<Icon_1.default icon="ChevronRight"/>
|
|
90
|
+
</a>
|
|
91
|
+
</li>)}
|
|
92
|
+
|
|
93
|
+
</ul>
|
|
94
|
+
</nav>);
|
|
95
|
+
};
|
|
96
|
+
Pagination.displayName = 'Pagination';
|
|
97
|
+
exports.default = Pagination;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const Tag_1 = __importDefault(require("../Tag/Tag"));
|
|
7
|
+
const PhaseBanner = ({ children, className, content, phaseName, ...props }) => {
|
|
8
|
+
return (<div className={[
|
|
9
|
+
'ds_phase-banner',
|
|
10
|
+
className
|
|
11
|
+
].join(' ')} {...props}>
|
|
12
|
+
<div className="ds_wrapper">
|
|
13
|
+
<p className="ds_phase-banner__content">
|
|
14
|
+
{phaseName && <Tag_1.default title={phaseName} className="ds_phase-banner__tag"/>}
|
|
15
|
+
<span className="ds_phase-banner__text">
|
|
16
|
+
{content ? content : children || "This is a new service"}
|
|
17
|
+
</span>
|
|
18
|
+
</p>
|
|
19
|
+
</div>
|
|
20
|
+
</div>);
|
|
21
|
+
};
|
|
22
|
+
PhaseBanner.displayName = 'PhaseBanner';
|
|
23
|
+
exports.default = PhaseBanner;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const ErrorMessage_1 = __importDefault(require("../ErrorMessage/ErrorMessage"));
|
|
7
|
+
const HintText_1 = __importDefault(require("../../common/HintText"));
|
|
8
|
+
const WrapperTag_1 = __importDefault(require("../../common/WrapperTag"));
|
|
9
|
+
const Question = function ({ children, className, error, errorMessage, hintText, legend, tagName = 'div', ...props }) {
|
|
10
|
+
return (<WrapperTag_1.default tagName={tagName} className={[
|
|
11
|
+
'ds_question',
|
|
12
|
+
error && 'ds_question--error',
|
|
13
|
+
className
|
|
14
|
+
].join(' ')} {...props}>
|
|
15
|
+
{legend && <legend>{legend}</legend>}
|
|
16
|
+
{hintText && <HintText_1.default text={hintText}/>}
|
|
17
|
+
{error && errorMessage && <ErrorMessage_1.default text={errorMessage}/>}
|
|
18
|
+
{children}
|
|
19
|
+
</WrapperTag_1.default>);
|
|
20
|
+
};
|
|
21
|
+
Question.displayName = 'Question';
|
|
22
|
+
exports.default = Question;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.Radio = void 0;
|
|
7
|
+
const HintText_1 = __importDefault(require("../../common/HintText"));
|
|
8
|
+
const Radio = ({ checked, hintText, id, label, name, onBlur, onChange, small }) => {
|
|
9
|
+
const hintTextId = `hint-text-${id}`;
|
|
10
|
+
function handleBlur(event) {
|
|
11
|
+
if (typeof onBlur === 'function') {
|
|
12
|
+
onBlur(event);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
function handleChange(event) {
|
|
16
|
+
if (typeof onChange === 'function') {
|
|
17
|
+
onChange(event);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
return (<div className={[
|
|
21
|
+
'ds_radio',
|
|
22
|
+
small && 'ds_radio--small'
|
|
23
|
+
].join(' ')}>
|
|
24
|
+
<input aria-describedby={hintText ? hintTextId : undefined} className="ds_radio__input" defaultChecked={!!checked} id={id} name={name} onBlur={handleBlur} onChange={handleChange} type="radio"/>
|
|
25
|
+
<label className="ds_radio__label" htmlFor={id}>{label}</label>
|
|
26
|
+
{hintText && <HintText_1.default id={hintTextId} text={hintText}/>}
|
|
27
|
+
</div>);
|
|
28
|
+
};
|
|
29
|
+
exports.Radio = Radio;
|
|
30
|
+
const RadioGroup = ({ className, inline, items, name, small, ...props }) => {
|
|
31
|
+
return (<div className={[
|
|
32
|
+
'ds_radios',
|
|
33
|
+
'ds_field-group',
|
|
34
|
+
inline && 'ds_field-group--inline',
|
|
35
|
+
className
|
|
36
|
+
].join(' ')} {...props}>
|
|
37
|
+
|
|
38
|
+
{items && items.map((item, index) => (<exports.Radio checked={item.checked} hintText={item.hintText} id={item.id} key={'radio' + index} label={item.label} name={name} onBlur={item.onBlur} onChange={item.onChange} small={small || item.small}/>))}
|
|
39
|
+
</div>);
|
|
40
|
+
};
|
|
41
|
+
exports.Radio.displayName = 'Radio';
|
|
42
|
+
RadioGroup.displayName = 'RadioGroup';
|
|
43
|
+
exports.default = RadioGroup;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const ErrorMessage_1 = __importDefault(require("../ErrorMessage/ErrorMessage"));
|
|
7
|
+
const HintText_1 = __importDefault(require("../../common/HintText"));
|
|
8
|
+
const Option = function ({ text, value }) {
|
|
9
|
+
return (<option value={value}>{text}</option>);
|
|
10
|
+
};
|
|
11
|
+
const Select = function ({ className, defaultValue, error, errorMessage, hintText, id, label, name, onBlur, onChange, options, placeholder, width, ...props }) {
|
|
12
|
+
const errorMessageId = `error-message-${id}`;
|
|
13
|
+
const hintTextId = `hint-text-${id}`;
|
|
14
|
+
const describedbys = [];
|
|
15
|
+
if (hintText) {
|
|
16
|
+
describedbys.push(hintTextId);
|
|
17
|
+
}
|
|
18
|
+
;
|
|
19
|
+
if (errorMessage) {
|
|
20
|
+
describedbys.push(errorMessageId);
|
|
21
|
+
}
|
|
22
|
+
;
|
|
23
|
+
function handleBlur(event) {
|
|
24
|
+
if (typeof onBlur === 'function') {
|
|
25
|
+
onBlur(event);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
function handleChange(event) {
|
|
29
|
+
if (typeof onChange === 'function') {
|
|
30
|
+
onChange(event);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
return (<>
|
|
34
|
+
<label className="ds_label" htmlFor={id}>{label}</label>
|
|
35
|
+
{hintText && <HintText_1.default id={hintTextId} text={hintText}/>}
|
|
36
|
+
{errorMessage && <ErrorMessage_1.default id={errorMessageId} text={errorMessage}/>}
|
|
37
|
+
<div className={[
|
|
38
|
+
"ds_select-wrapper",
|
|
39
|
+
error && 'ds_input--error',
|
|
40
|
+
width && `ds_input--${width}`,
|
|
41
|
+
className
|
|
42
|
+
].join(' ')} {...props}>
|
|
43
|
+
<select aria-describedby={describedbys.join(' ')} aria-invalid={error} className="ds_select" defaultValue={defaultValue} id={id} name={name || id} onBlur={handleBlur} onChange={handleChange}>
|
|
44
|
+
<option value="">{placeholder}</option>
|
|
45
|
+
{options && options.map((option, index) => (<Option value={option.value} text={option.text} key={`option-${index}`}/>))}
|
|
46
|
+
</select>
|
|
47
|
+
<span className="ds_select-arrow" aria-hidden="true"></span>
|
|
48
|
+
</div>
|
|
49
|
+
</>);
|
|
50
|
+
};
|
|
51
|
+
Select.displayName = 'Select';
|
|
52
|
+
exports.default = Select;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const NextLink = ({ href, title }) => {
|
|
4
|
+
return (<div className="ds_sequential-nav__item ds_sequential-nav__item--next">
|
|
5
|
+
<a href={href} className="ds_sequential-nav__button ds_sequential-nav__button--right">
|
|
6
|
+
<span className="ds_sequential-nav__text" data-label="Next">
|
|
7
|
+
{title}
|
|
8
|
+
</span>
|
|
9
|
+
</a>
|
|
10
|
+
</div>);
|
|
11
|
+
};
|
|
12
|
+
const PrevLink = ({ href, title, }) => {
|
|
13
|
+
return (<div className="ds_sequential-nav__item ds_sequential-nav__item--prev">
|
|
14
|
+
<a href={href} className="ds_sequential-nav__button ds_sequential-nav__button--left">
|
|
15
|
+
<span className="ds_sequential-nav__text" data-label="Previous">
|
|
16
|
+
{title}
|
|
17
|
+
</span>
|
|
18
|
+
</a>
|
|
19
|
+
</div>);
|
|
20
|
+
};
|
|
21
|
+
const SequentialNavigation = ({ ariaLabel = 'Article navigation', className, next, previous, ...props }) => {
|
|
22
|
+
return (<nav className={[
|
|
23
|
+
'ds_sequential-nav',
|
|
24
|
+
className
|
|
25
|
+
].join(' ')} aria-label={ariaLabel} {...props}>
|
|
26
|
+
{previous && <PrevLink href={previous.href} title={previous.title}></PrevLink>}
|
|
27
|
+
{next && <NextLink href={next.href} title={next.title}></NextLink>}
|
|
28
|
+
</nav>);
|
|
29
|
+
};
|
|
30
|
+
SequentialNavigation.displayName = 'SequentialNavigation';
|
|
31
|
+
exports.default = SequentialNavigation;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.Link = exports.List = void 0;
|
|
7
|
+
const react_1 = require("react");
|
|
8
|
+
// @ts-ignore
|
|
9
|
+
const side_navigation_1 = __importDefault(require("@scottish-government/design-system/src/components/side-navigation/side-navigation"));
|
|
10
|
+
const List = function ({ items, root }) {
|
|
11
|
+
return (<ul className="ds_side-navigation__list" id={root ? 'side-navigation-root' : undefined}>
|
|
12
|
+
{items && items.map((item, index) => (<exports.Link title={item.title} href={item.href} items={item.items} current={item.current} key={'sidenavitem' + index}/>))}
|
|
13
|
+
</ul>);
|
|
14
|
+
};
|
|
15
|
+
exports.List = List;
|
|
16
|
+
const Link = function ({ current = false, href, items, title }) {
|
|
17
|
+
return (<li className={[
|
|
18
|
+
'ds_side-navigation__item',
|
|
19
|
+
items && 'ds_side-navigation__item--has-children'
|
|
20
|
+
].join(' ')}>
|
|
21
|
+
{current ?
|
|
22
|
+
<span className="ds_side-navigation__link ds_current">{title}</span> :
|
|
23
|
+
<a href={href} className="ds_side-navigation__link">{title}</a>}
|
|
24
|
+
|
|
25
|
+
{items && <exports.List items={items}/>}
|
|
26
|
+
</li>);
|
|
27
|
+
};
|
|
28
|
+
exports.Link = Link;
|
|
29
|
+
const SideNavigation = function ({ children, className, items, ...props }) {
|
|
30
|
+
const ref = (0, react_1.useRef)(null);
|
|
31
|
+
(0, react_1.useEffect)(() => {
|
|
32
|
+
if (ref.current) {
|
|
33
|
+
new side_navigation_1.default(ref.current).init();
|
|
34
|
+
}
|
|
35
|
+
}, [ref]);
|
|
36
|
+
return (<nav aria-label="Sections" className={[
|
|
37
|
+
'ds_side-navigation',
|
|
38
|
+
className
|
|
39
|
+
].join(' ')} data-module="ds-side-navigation" ref={ref} {...props}>
|
|
40
|
+
<input type="checkbox" className="fully-hidden js-toggle-side-navigation" id="show-side-navigation" aria-controls="side-navigation-root"/>
|
|
41
|
+
<label className="ds_side-navigation__expand ds_link" htmlFor="show-side-navigation">
|
|
42
|
+
<span className="visually-hidden">Show all</span> Pages in this section
|
|
43
|
+
<span className="ds_side-navigation__expand-indicator"></span>
|
|
44
|
+
</label>
|
|
45
|
+
|
|
46
|
+
{items && <exports.List root items={items}/>}
|
|
47
|
+
</nav>);
|
|
48
|
+
};
|
|
49
|
+
SideNavigation.displayName = 'SideNavigation';
|
|
50
|
+
exports.Link.displayName = 'SideNavLink';
|
|
51
|
+
exports.List.displayName = 'SideNavList';
|
|
52
|
+
exports.default = SideNavigation;
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
"use strict";
|
|
3
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
4
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
5
|
+
};
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
const react_1 = require("react");
|
|
8
|
+
const Icon_1 = __importDefault(require("../../common/Icon"));
|
|
9
|
+
const PhaseBanner_1 = __importDefault(require("../PhaseBanner/PhaseBanner"));
|
|
10
|
+
const SiteNavigation_1 = __importDefault(require("../SiteNavigation/SiteNavigation"));
|
|
11
|
+
const SiteSearch_1 = __importDefault(require("../SiteSearch/SiteSearch"));
|
|
12
|
+
// @ts-ignore
|
|
13
|
+
const site_navigation_1 = __importDefault(require("@scottish-government/design-system/src/components/site-navigation/site-navigation"));
|
|
14
|
+
const SiteHeader = ({ logo = {}, navigationItems, phaseBanner, siteSearch, siteTitle, ...props }) => {
|
|
15
|
+
const mobileMenuRef = (0, react_1.useRef)(null);
|
|
16
|
+
(0, react_1.useEffect)(() => {
|
|
17
|
+
if (mobileMenuRef.current) {
|
|
18
|
+
new site_navigation_1.default(mobileMenuRef.current).init();
|
|
19
|
+
}
|
|
20
|
+
}, [mobileMenuRef]);
|
|
21
|
+
return (<header className="ds_site-header" {...props}>
|
|
22
|
+
<div className="ds_wrapper">
|
|
23
|
+
<div className="ds_site-header__content">
|
|
24
|
+
<div className="ds_site-branding">
|
|
25
|
+
{logo &&
|
|
26
|
+
<a className="ds_site-branding__logo ds_site-branding__link" href={logo.href ? logo.href : '/'}>
|
|
27
|
+
<img className="ds_site-branding__logo-image" src={logo.src} alt={logo.alt}/>
|
|
28
|
+
</a>}
|
|
29
|
+
|
|
30
|
+
{siteTitle && <div className="ds_site-branding__title">
|
|
31
|
+
{siteTitle}
|
|
32
|
+
</div>}
|
|
33
|
+
</div>
|
|
34
|
+
|
|
35
|
+
{navigationItems &&
|
|
36
|
+
<div className="ds_site-header__controls">
|
|
37
|
+
<label aria-controls="mobile-navigation" className="ds_site-header__control js-toggle-menu" htmlFor="menu">
|
|
38
|
+
<span className="ds_site-header__control-text">Menu</span>
|
|
39
|
+
<Icon_1.default fill className="ds_site-header__control-icon" icon="Menu" aria-hidden="true"/>
|
|
40
|
+
<Icon_1.default fill className="ds_site-header__control-icon ds_site-header__control-icon--active-icon" icon="Close" aria-hidden="true"/>
|
|
41
|
+
</label>
|
|
42
|
+
</div>}
|
|
43
|
+
|
|
44
|
+
{navigationItems &&
|
|
45
|
+
<input className="ds_site-navigation__toggle" id="menu" type="checkbox"/>}
|
|
46
|
+
{navigationItems &&
|
|
47
|
+
<SiteNavigation_1.default id="mobile-navigation" className="ds_site-navigation--mobile" items={navigationItems} ref={mobileMenuRef}/>}
|
|
48
|
+
|
|
49
|
+
{siteSearch &&
|
|
50
|
+
<SiteSearch_1.default className="ds_site-header__search" {...siteSearch}/>}
|
|
51
|
+
</div>
|
|
52
|
+
</div>
|
|
53
|
+
|
|
54
|
+
{phaseBanner &&
|
|
55
|
+
<PhaseBanner_1.default phaseName={phaseBanner.phaseName}>
|
|
56
|
+
{phaseBanner.content}
|
|
57
|
+
</PhaseBanner_1.default>}
|
|
58
|
+
|
|
59
|
+
{navigationItems &&
|
|
60
|
+
<div className="ds_site-header__navigation">
|
|
61
|
+
<div className="ds_wrapper">
|
|
62
|
+
<SiteNavigation_1.default items={navigationItems}/>
|
|
63
|
+
</div>
|
|
64
|
+
</div>}
|
|
65
|
+
</header>);
|
|
66
|
+
};
|
|
67
|
+
SiteHeader.displayName = 'SiteHeader';
|
|
68
|
+
exports.default = SiteHeader;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const SiteNavLink = ({ current = false, href, title }) => {
|
|
4
|
+
return (<li className="ds_site-navigation__item">
|
|
5
|
+
<a href={href} className={[
|
|
6
|
+
'ds_site-navigation__link',
|
|
7
|
+
current ? 'ds_current' : undefined
|
|
8
|
+
].join(' ')}>{title}</a>
|
|
9
|
+
</li>);
|
|
10
|
+
};
|
|
11
|
+
const SiteNavigation = ({ className, items, ...props }) => {
|
|
12
|
+
return (<nav className={[
|
|
13
|
+
'ds_site-navigation',
|
|
14
|
+
className
|
|
15
|
+
].join(' ')} {...props}>
|
|
16
|
+
<ul className="ds_site-navigation__list">
|
|
17
|
+
{items && items.map((item, index) => (<SiteNavLink current={item.current} href={item.href} title={item.title} key={`link-${index}`}/>))}
|
|
18
|
+
</ul>
|
|
19
|
+
</nav>);
|
|
20
|
+
};
|
|
21
|
+
SiteNavigation.displayName = 'SiteNavigation';
|
|
22
|
+
exports.default = SiteNavigation;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const react_1 = require("react");
|
|
7
|
+
// @ts-ignore
|
|
8
|
+
const autocomplete_1 = __importDefault(require("@scottish-government/design-system/src/components/autocomplete/autocomplete"));
|
|
9
|
+
const Button_1 = __importDefault(require("../Button/Button"));
|
|
10
|
+
const SiteSearch = function ({ action = '/search', autocompleteEndpoint, autocompleteSuggestionMappingFunction, className, id = 'site-search', method = 'GET', minLength = 3, name = 'q', placeholder = 'Search', ...props }) {
|
|
11
|
+
const ref = (0, react_1.useRef)(null);
|
|
12
|
+
const hasAutocomplete = !!autocompleteEndpoint;
|
|
13
|
+
let autocompleteId = hasAutocomplete ? id + '-autocomplete' : '';
|
|
14
|
+
(0, react_1.useEffect)(() => {
|
|
15
|
+
if (hasAutocomplete && ref.current) {
|
|
16
|
+
const options = {};
|
|
17
|
+
if (minLength) {
|
|
18
|
+
options.minLength = minLength;
|
|
19
|
+
}
|
|
20
|
+
if (autocompleteSuggestionMappingFunction) {
|
|
21
|
+
options.suggestionMappingFunction = autocompleteSuggestionMappingFunction;
|
|
22
|
+
}
|
|
23
|
+
const autocomplete = new autocomplete_1.default(document.getElementById(autocompleteId), autocompleteEndpoint, options);
|
|
24
|
+
autocomplete.init();
|
|
25
|
+
}
|
|
26
|
+
}, [ref, autocompleteEndpoint, autocompleteId, hasAutocomplete, minLength, autocompleteSuggestionMappingFunction]);
|
|
27
|
+
return (<div className={[
|
|
28
|
+
'ds_site-search', ,
|
|
29
|
+
className,
|
|
30
|
+
hasAutocomplete ? 'ds_autocomplete' : undefined
|
|
31
|
+
].join(' ')} id={autocompleteId ? autocompleteId : undefined} ref={ref} {...props}>
|
|
32
|
+
|
|
33
|
+
<form role="search" className="ds_site-search__form" method={method} action={action}>
|
|
34
|
+
<label className="ds_label visually-hidden" htmlFor={id} id={id + '-label'}>Search</label>
|
|
35
|
+
|
|
36
|
+
{hasAutocomplete && (<div role="status" aria-live="polite" id="autocomplete-status" className="visually-hidden"></div>)}
|
|
37
|
+
|
|
38
|
+
<div className="ds_input__wrapper ds_input__wrapper--has-icon">
|
|
39
|
+
<input aria-autocomplete={hasAutocomplete ? 'list' : undefined} aria-owns={hasAutocomplete ? 'autocomplete-suggestions' : undefined} autoComplete={hasAutocomplete ? 'off' : undefined} className={[
|
|
40
|
+
'ds_input',
|
|
41
|
+
'ds_site-search__input',
|
|
42
|
+
hasAutocomplete ? 'js-autocomplete-input' : undefined
|
|
43
|
+
].join(' ')} id={id} name={name} placeholder={placeholder} required spellCheck="false" type="search"/>
|
|
44
|
+
|
|
45
|
+
<Button_1.default type="submit" icon="Search" iconOnly>Search</Button_1.default>
|
|
46
|
+
|
|
47
|
+
{hasAutocomplete && (<div id="autocomplete-suggestions" className="ds_autocomplete__suggestions">
|
|
48
|
+
<ol className="ds_autocomplete__suggestions-list" role="listbox" aria-labelledby="site-search-label"></ol>
|
|
49
|
+
</div>)}
|
|
50
|
+
</div>
|
|
51
|
+
</form>
|
|
52
|
+
</div>);
|
|
53
|
+
};
|
|
54
|
+
SiteSearch.displayName = 'SiteSearch';
|
|
55
|
+
exports.default = SiteSearch;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SkipLink = void 0;
|
|
4
|
+
const SkipLink = ({ targetId, title }) => {
|
|
5
|
+
return (<li className="ds_skip-links__item">
|
|
6
|
+
<a href={`#${targetId}`} className="ds_skip-links__link">{title}</a>
|
|
7
|
+
</li>);
|
|
8
|
+
};
|
|
9
|
+
exports.SkipLink = SkipLink;
|
|
10
|
+
const SkipLinks = ({ items, mainContentId = 'main-content', mainLinkText = 'Skip to main content', ...props }) => {
|
|
11
|
+
return (<div className="ds_skip-links" {...props}>
|
|
12
|
+
<ul className="ds_skip-links__list">
|
|
13
|
+
<exports.SkipLink title={mainLinkText} targetId={mainContentId}/>
|
|
14
|
+
|
|
15
|
+
{items && items.map((item, index) => (<exports.SkipLink title={item.title} targetId={item.targetId} key={`skiplink-${index}`}/>))}
|
|
16
|
+
</ul>
|
|
17
|
+
</div>);
|
|
18
|
+
};
|
|
19
|
+
SkipLinks.displayName = 'SkipLinks';
|
|
20
|
+
exports.SkipLink.displayName = 'SkipLink';
|
|
21
|
+
exports.default = SkipLinks;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
const SummaryList_1 = __importStar(require("../SummaryList/SummaryList"));
|
|
40
|
+
const WrapperTag_1 = __importDefault(require("../../common/WrapperTag"));
|
|
41
|
+
function convertToSlug(string) {
|
|
42
|
+
return string.toLowerCase()
|
|
43
|
+
.replace(/[^\w ]+/g, "")
|
|
44
|
+
.replace(/ +/g, "-");
|
|
45
|
+
}
|
|
46
|
+
const SummaryCard = ({ actions, className, headingLevel = 'h3', items, title, ...props }) => {
|
|
47
|
+
const describedById = `summary-card-${convertToSlug(title)}`;
|
|
48
|
+
return (<div className={[
|
|
49
|
+
'ds_summary-card',
|
|
50
|
+
className
|
|
51
|
+
].join(' ')} {...props}>
|
|
52
|
+
<div className="ds_summary-card__header">
|
|
53
|
+
<WrapperTag_1.default className="ds_summary-card__header-title" id={describedById} tagName={headingLevel}>{title}</WrapperTag_1.default>
|
|
54
|
+
|
|
55
|
+
<ul className="ds_summary-card__actions-list">
|
|
56
|
+
{actions && actions.map((action, index) => (<li className="ds_summary-card__actions-list-item" key={'summarylistaction' + index}>
|
|
57
|
+
<SummaryList_1.Action describedby={describedById} href={action.href} onclick={action.onclick} title={action.title}/>
|
|
58
|
+
</li>))}
|
|
59
|
+
</ul>
|
|
60
|
+
</div>
|
|
61
|
+
<div className="ds_summary-card__content">
|
|
62
|
+
<SummaryList_1.default items={items}/>
|
|
63
|
+
</div>
|
|
64
|
+
</div>);
|
|
65
|
+
};
|
|
66
|
+
SummaryCard.displayName = 'SummaryCard';
|
|
67
|
+
exports.default = SummaryCard;
|