@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,79 @@
|
|
|
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 react_1 = __importStar(require("react"));
|
|
40
|
+
// @ts-ignore
|
|
41
|
+
const aspect_box_fallback_1 = __importDefault(require("@scottish-government/design-system/src/components/aspect-box/aspect-box-fallback"));
|
|
42
|
+
const AspectBox = ({ children, className, ratio, ...props }) => {
|
|
43
|
+
const ref = (0, react_1.useRef)(null);
|
|
44
|
+
(0, react_1.useEffect)(() => {
|
|
45
|
+
if (ref.current) {
|
|
46
|
+
new aspect_box_fallback_1.default(ref.current).init();
|
|
47
|
+
}
|
|
48
|
+
}, [ref]);
|
|
49
|
+
function processChild(child) {
|
|
50
|
+
if (['img', 'svg', 'picture'].includes(child.type)) {
|
|
51
|
+
return react_1.default.cloneElement(child, { className: 'ds_aspect-box__inner' });
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
let ratioClassName;
|
|
55
|
+
switch (ratio) {
|
|
56
|
+
case '1:1':
|
|
57
|
+
case 'square':
|
|
58
|
+
ratioClassName = 'ds_aspect-box--square';
|
|
59
|
+
break;
|
|
60
|
+
case '4:3':
|
|
61
|
+
ratioClassName = 'ds_aspect-box--43';
|
|
62
|
+
break;
|
|
63
|
+
case '21:9':
|
|
64
|
+
ratioClassName = 'ds_aspect-box--219';
|
|
65
|
+
break;
|
|
66
|
+
default:
|
|
67
|
+
ratioClassName = '';
|
|
68
|
+
break;
|
|
69
|
+
}
|
|
70
|
+
return (<div className={[
|
|
71
|
+
'ds_aspect-box',
|
|
72
|
+
ratioClassName,
|
|
73
|
+
className
|
|
74
|
+
].join(' ')} ref={ref} {...props}>
|
|
75
|
+
{react_1.Children.map(children, child => processChild(child))}
|
|
76
|
+
</div>);
|
|
77
|
+
};
|
|
78
|
+
AspectBox.displayName = 'AspectBox';
|
|
79
|
+
exports.default = AspectBox;
|
|
@@ -0,0 +1,27 @@
|
|
|
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
|
+
const Icon_1 = __importDefault(require("../../common/Icon"));
|
|
8
|
+
// @ts-ignore
|
|
9
|
+
const back_to_top_1 = __importDefault(require("@scottish-government/design-system/src/components/back-to-top/back-to-top"));
|
|
10
|
+
const BackToTop = ({ className, href = '#page-top', ...props }) => {
|
|
11
|
+
const ref = (0, react_1.useRef)(null);
|
|
12
|
+
(0, react_1.useEffect)(() => {
|
|
13
|
+
if (ref.current) {
|
|
14
|
+
new back_to_top_1.default(ref.current).init();
|
|
15
|
+
}
|
|
16
|
+
}, [ref]);
|
|
17
|
+
return (<div className={[
|
|
18
|
+
'ds_back-to-top',
|
|
19
|
+
className
|
|
20
|
+
].join(' ')} ref={ref} {...props}>
|
|
21
|
+
<a href={href} className="ds_back-to-top__button">Back to top
|
|
22
|
+
<Icon_1.default className="ds_back-to-top__icon" icon="ArrowUpward"/>
|
|
23
|
+
</a>
|
|
24
|
+
</div>);
|
|
25
|
+
};
|
|
26
|
+
BackToTop.displayName = 'BackToTop';
|
|
27
|
+
exports.default = BackToTop;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const Breadcrumb = ({ hidden, href, title }) => {
|
|
4
|
+
return (<li className={[
|
|
5
|
+
'ds_breadcrumbs__item',
|
|
6
|
+
hidden && 'visually-hidden'
|
|
7
|
+
].join(' ')}>
|
|
8
|
+
|
|
9
|
+
{href ? (<a className="ds_breadcrumbs__link" href={href}>
|
|
10
|
+
{title}
|
|
11
|
+
</a>) : (title)}
|
|
12
|
+
</li>);
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* @param {boolean} hideLastItem
|
|
16
|
+
* @param {Array} items
|
|
17
|
+
* @param {Object} props - Properties for the element
|
|
18
|
+
* @returns {JSX.Element} - The element
|
|
19
|
+
*/
|
|
20
|
+
const Breadcrumbs = ({ hideLastItem, items, ...props }) => {
|
|
21
|
+
return (<nav aria-label="Breadcrumb" {...props}>
|
|
22
|
+
<ol className="ds_breadcrumbs">
|
|
23
|
+
{items && items.map((item, index) => (<Breadcrumb title={item.title} href={item.href} hidden={(hideLastItem) && index + 1 === items.length} key={'breadcrumb' + index}/>))}
|
|
24
|
+
</ol>
|
|
25
|
+
</nav>);
|
|
26
|
+
};
|
|
27
|
+
Breadcrumbs.displayName = 'Breadcrumbs';
|
|
28
|
+
exports.default = Breadcrumbs;
|
|
@@ -0,0 +1,30 @@
|
|
|
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 Icon_1 = __importDefault(require("../../common/Icon"));
|
|
7
|
+
const ScreenReaderText_1 = __importDefault(require("../../common/ScreenReaderText"));
|
|
8
|
+
const WrapperTag_1 = __importDefault(require("../../common/WrapperTag"));
|
|
9
|
+
const Button = ({ buttonStyle, children, className, icon, iconLeft, iconOnly = false, href, small, styleAsLink, type = 'button', width, ...props }) => {
|
|
10
|
+
// determine which HTML tag to use
|
|
11
|
+
let tagName = 'button';
|
|
12
|
+
if (href) {
|
|
13
|
+
tagName = 'a';
|
|
14
|
+
}
|
|
15
|
+
return (<WrapperTag_1.default tagName={tagName} className={[
|
|
16
|
+
!styleAsLink ? 'ds_button' : 'ds_link',
|
|
17
|
+
width && `ds_button--${width}`,
|
|
18
|
+
buttonStyle && `ds_button--${buttonStyle}`,
|
|
19
|
+
small && 'ds_button--small',
|
|
20
|
+
(icon && !iconOnly) ? 'ds_button--has-icon' : undefined,
|
|
21
|
+
iconLeft && 'ds_button--has-icon--left',
|
|
22
|
+
className
|
|
23
|
+
].join(' ')} href={href} {...(tagName === 'button' ? { type: type } : {})} {...props}>
|
|
24
|
+
{iconOnly ? <ScreenReaderText_1.default>{children}</ScreenReaderText_1.default> : children}
|
|
25
|
+
|
|
26
|
+
{icon && <Icon_1.default icon={icon}/>}
|
|
27
|
+
</WrapperTag_1.default>);
|
|
28
|
+
};
|
|
29
|
+
Button.displayName = 'Button';
|
|
30
|
+
exports.default = Button;
|
|
@@ -0,0 +1,62 @@
|
|
|
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.CheckboxGroup = exports.Checkbox = void 0;
|
|
7
|
+
const react_1 = require("react");
|
|
8
|
+
// @ts-ignore
|
|
9
|
+
const checkboxes_1 = __importDefault(require("@scottish-government/design-system/src/forms/checkbox/checkboxes"));
|
|
10
|
+
const HintText_1 = __importDefault(require("../../common/HintText"));
|
|
11
|
+
const Checkbox = ({ checked, hintText, id, exclusive, label, name, onBlur, onChange, small }) => {
|
|
12
|
+
const hintTextId = `hint-text-${id}`;
|
|
13
|
+
const behaviour = exclusive && 'exclusive';
|
|
14
|
+
function handleBlur(event) {
|
|
15
|
+
if (typeof onBlur === 'function') {
|
|
16
|
+
onBlur(event);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
function handleChange(event) {
|
|
20
|
+
if (typeof onChange === 'function') {
|
|
21
|
+
onChange(event);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
return (<>
|
|
25
|
+
{exclusive && <p className="ds_checkbox-separator">or</p>}
|
|
26
|
+
<div className={[
|
|
27
|
+
'ds_checkbox',
|
|
28
|
+
small && 'ds_checkbox--small'
|
|
29
|
+
].join(' ')}>
|
|
30
|
+
|
|
31
|
+
<input aria-describedby={hintText ? hintTextId : undefined} className="ds_checkbox__input" data-behaviour={behaviour} defaultChecked={!!checked} id={id} name={name || id} onBlur={handleBlur} onChange={handleChange} type="checkbox"/>
|
|
32
|
+
<label className="ds_checkbox__label" htmlFor={id}>{label}</label>
|
|
33
|
+
{hintText && <HintText_1.default id={hintTextId} text={hintText}/>}
|
|
34
|
+
</div>
|
|
35
|
+
</>);
|
|
36
|
+
};
|
|
37
|
+
exports.Checkbox = Checkbox;
|
|
38
|
+
/**
|
|
39
|
+
* @param {Object} props - Properties for the element
|
|
40
|
+
* @param {Array} items - Checkboxes
|
|
41
|
+
* @param {boolean} small - Use the small display style for all checkboxes
|
|
42
|
+
* @returns {JSX.Element} - The element
|
|
43
|
+
*/
|
|
44
|
+
const CheckboxGroup = ({ className, items, small, ...props }) => {
|
|
45
|
+
const ref = (0, react_1.useRef)(null);
|
|
46
|
+
(0, react_1.useEffect)(() => {
|
|
47
|
+
if (ref.current) {
|
|
48
|
+
new checkboxes_1.default(ref.current).init();
|
|
49
|
+
}
|
|
50
|
+
}, [ref]);
|
|
51
|
+
return (<div className={[
|
|
52
|
+
'ds_checkboxes',
|
|
53
|
+
'ds_field-group',
|
|
54
|
+
className
|
|
55
|
+
].join(' ')} data-module="ds-checkboxes" ref={ref} {...props}>
|
|
56
|
+
{items && items.map((item, index) => (<exports.Checkbox exclusive={item.exclusive} checked={item.checked} hintText={item.hintText} id={item.id} key={'checkbox' + index} label={item.label} onBlur={item.onBlur} onChange={item.onChange} small={small || item.small}/>))}
|
|
57
|
+
</div>);
|
|
58
|
+
};
|
|
59
|
+
exports.CheckboxGroup = CheckboxGroup;
|
|
60
|
+
exports.Checkbox.displayName = 'Checkbox';
|
|
61
|
+
exports.CheckboxGroup.displayName = 'CheckboxGroup';
|
|
62
|
+
exports.default = exports.CheckboxGroup;
|
|
@@ -0,0 +1,24 @@
|
|
|
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 Icon_1 = __importDefault(require("../../common/Icon"));
|
|
7
|
+
const WrapperTag_1 = __importDefault(require("../../common/WrapperTag"));
|
|
8
|
+
const ConfirmationMessage = ({ ariaLive = 'polite', children, className, headingLevel = 'h3', title, ...props }) => {
|
|
9
|
+
return (<div aria-live={ariaLive} className={[
|
|
10
|
+
'ds_confirmation-message',
|
|
11
|
+
className
|
|
12
|
+
].join(' ')} {...props}>
|
|
13
|
+
<Icon_1.default className="ds_confirmation-message__icon" icon="CheckCircle" iconSize="24"/>
|
|
14
|
+
|
|
15
|
+
<WrapperTag_1.default className="ds_confirmation-message__title" tagName={headingLevel}>
|
|
16
|
+
{title}
|
|
17
|
+
</WrapperTag_1.default>
|
|
18
|
+
{children && <div className="ds_confirmation-message__body">
|
|
19
|
+
{children}
|
|
20
|
+
</div>}
|
|
21
|
+
</div>);
|
|
22
|
+
};
|
|
23
|
+
ConfirmationMessage.displayName = 'ConfirmationMessage';
|
|
24
|
+
exports.default = ConfirmationMessage;
|
|
@@ -0,0 +1,33 @@
|
|
|
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 = void 0;
|
|
7
|
+
const WrapperTag_1 = __importDefault(require("../../common/WrapperTag"));
|
|
8
|
+
const Link = ({ current, href, title }) => {
|
|
9
|
+
// determine which HTML tag to use
|
|
10
|
+
const tagName = href && !current ? 'a' : 'span';
|
|
11
|
+
return (<li aria-current={current && 'page' || undefined} className="ds_contents-nav__item">
|
|
12
|
+
<WrapperTag_1.default tagName={tagName} className={[
|
|
13
|
+
'ds_contents-nav__link',
|
|
14
|
+
current && 'ds_current'
|
|
15
|
+
].join(' ')} href={!current ? href : undefined}>
|
|
16
|
+
{title}
|
|
17
|
+
</WrapperTag_1.default>
|
|
18
|
+
</li>);
|
|
19
|
+
};
|
|
20
|
+
exports.Link = Link;
|
|
21
|
+
const ContentsNav = function ({ className, items, label = 'Pages in this section', title = 'Contents', ...props }) {
|
|
22
|
+
return (<nav aria-label={label} className={[
|
|
23
|
+
'ds_contents-nav',
|
|
24
|
+
className
|
|
25
|
+
].join(' ')} {...props}>
|
|
26
|
+
<h2 className="ds_contents-nav__title">{title}</h2>
|
|
27
|
+
<ul className="ds_contents-nav__list">
|
|
28
|
+
{items && items.map((item, index) => (<exports.Link current={item.current} href={item.href} title={item.title} key={'link' + index}/>))}
|
|
29
|
+
</ul>
|
|
30
|
+
</nav>);
|
|
31
|
+
};
|
|
32
|
+
ContentsNav.displayName = 'ContentsNav';
|
|
33
|
+
exports.default = ContentsNav;
|
|
@@ -0,0 +1,21 @@
|
|
|
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 AbstractNotificationBanner_1 = __importDefault(require("../../common/AbstractNotificationBanner"));
|
|
7
|
+
const CookieBanner = ({ children, className, title, ...props }) => {
|
|
8
|
+
return (<>
|
|
9
|
+
<AbstractNotificationBanner_1.default className={[
|
|
10
|
+
'ds_notification--large',
|
|
11
|
+
'ds_notification--cookie',
|
|
12
|
+
'js-initial-cookie-content',
|
|
13
|
+
className
|
|
14
|
+
].join(' ')} data-module="ds-cookie-notification" title={title} {...props}>
|
|
15
|
+
{children}
|
|
16
|
+
</AbstractNotificationBanner_1.default>
|
|
17
|
+
</>);
|
|
18
|
+
};
|
|
19
|
+
CookieBanner.displayName = 'CookieBanner';
|
|
20
|
+
CookieBanner.Buttons = AbstractNotificationBanner_1.default.Buttons;
|
|
21
|
+
exports.default = CookieBanner;
|
|
@@ -0,0 +1,54 @@
|
|
|
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 date_picker_1 = __importDefault(require("@scottish-government/design-system/src/components/date-picker/date-picker"));
|
|
9
|
+
const ErrorMessage_1 = __importDefault(require("../ErrorMessage/ErrorMessage"));
|
|
10
|
+
const TextInput_1 = __importDefault(require("../TextInput/TextInput"));
|
|
11
|
+
const DatePicker = ({ className, dateSelectCallback, disabledDates, error, errorMessage, hintText, id, iconPath = './', label, maxDate, minDate, multiple, name, onBlur, onChange, value, width = 'fixed-10', ...props }) => {
|
|
12
|
+
const ref = (0, react_1.useRef)(null);
|
|
13
|
+
(0, react_1.useEffect)(() => {
|
|
14
|
+
if (ref.current) {
|
|
15
|
+
new date_picker_1.default(ref.current, {
|
|
16
|
+
dateSelectCallback,
|
|
17
|
+
imagePath: iconPath
|
|
18
|
+
}).init();
|
|
19
|
+
}
|
|
20
|
+
}, [ref, dateSelectCallback, iconPath]);
|
|
21
|
+
function handleBlur(event) {
|
|
22
|
+
if (typeof onBlur === 'function') {
|
|
23
|
+
onBlur(event);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
function handleChange(event) {
|
|
27
|
+
if (typeof onChange === 'function') {
|
|
28
|
+
onChange(event);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
return (<div className={[
|
|
32
|
+
"ds_datepicker",
|
|
33
|
+
multiple && "ds_datepicker--multiple",
|
|
34
|
+
className
|
|
35
|
+
].join(' ')} data-disableddates={disabledDates} data-maxdate={maxDate} data-mindate={minDate} data-module="ds-datepicker" ref={ref} {...props}>
|
|
36
|
+
{(multiple ? (<fieldset className="ds_datepicker__input-wrapper">
|
|
37
|
+
<legend>{label}</legend>
|
|
38
|
+
{errorMessage && <ErrorMessage_1.default text={errorMessage}/>}
|
|
39
|
+
<div>
|
|
40
|
+
<TextInput_1.default className="js-datepicker-date" error={!!error} id={id + "-day"} hintText={hintText} label="Day" name={name + "-day"} onBlur={handleBlur} onChange={handleChange} value={value?.split('/')[0]} width="fixed-2"/>
|
|
41
|
+
</div>
|
|
42
|
+
|
|
43
|
+
<div>
|
|
44
|
+
<TextInput_1.default className="js-datepicker-month" error={!!error} id={id + "-month"} hintText={hintText} label="Month" name={name + "-month"} onBlur={handleBlur} onChange={handleChange} value={value?.split('/')[1]} width="fixed-2"/>
|
|
45
|
+
</div>
|
|
46
|
+
|
|
47
|
+
<div>
|
|
48
|
+
<TextInput_1.default className="js-datepicker-year" error={!!error} id={id + "-year"} hintText={hintText} label="Year" name={name + "-year"} onBlur={handleBlur} onChange={handleChange} value={value?.split('/')[2]} width="fixed-4"/>
|
|
49
|
+
</div>
|
|
50
|
+
</fieldset>) : (<TextInput_1.default error={!!error} errorMessage={errorMessage} id={id} hasButton hintText={hintText} label={label} name={name} onBlur={handleBlur} onChange={handleChange} placeholder="dd/mm/yyyy" value={value} width={width}/>))}
|
|
51
|
+
</div>);
|
|
52
|
+
};
|
|
53
|
+
DatePicker.displayName = 'DatePicker';
|
|
54
|
+
exports.default = DatePicker;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const Details = ({ children, className, summary, ...props }) => {
|
|
4
|
+
return (<details className={[
|
|
5
|
+
"ds_details",
|
|
6
|
+
className
|
|
7
|
+
].join(' ')} {...props}>
|
|
8
|
+
<summary className="ds_details__summary">
|
|
9
|
+
{summary}
|
|
10
|
+
</summary>
|
|
11
|
+
<div className="ds_details__text">
|
|
12
|
+
{children}
|
|
13
|
+
</div>
|
|
14
|
+
</details>);
|
|
15
|
+
};
|
|
16
|
+
Details.displayName = 'Details';
|
|
17
|
+
exports.default = Details;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const ErrorMessage = ({ children, className, id, text, ...props }) => {
|
|
4
|
+
return (<p className={[
|
|
5
|
+
'ds_question__error-message',
|
|
6
|
+
className
|
|
7
|
+
].join(' ')} dangerouslySetInnerHTML={text ? { __html: text } : undefined} id={id} {...props}>
|
|
8
|
+
{!text ? children : null}
|
|
9
|
+
</p>);
|
|
10
|
+
};
|
|
11
|
+
ErrorMessage.displayName = 'ErrorMessage';
|
|
12
|
+
exports.default = ErrorMessage;
|
|
@@ -0,0 +1,27 @@
|
|
|
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 ConditionalWrapper_1 = __importDefault(require("../../common/ConditionalWrapper"));
|
|
7
|
+
const Error = ({ fragmentId, title }) => {
|
|
8
|
+
return (<li>
|
|
9
|
+
<ConditionalWrapper_1.default condition={!!fragmentId} wrapper={() => <a href={`#${fragmentId}`}>{title}</a>}>{title}</ConditionalWrapper_1.default>
|
|
10
|
+
</li>);
|
|
11
|
+
};
|
|
12
|
+
const ErrorSummary = ({ className, errors, title = 'There is a problem', ...props }) => {
|
|
13
|
+
return (<>
|
|
14
|
+
{errors && errors.length && (<div className={[
|
|
15
|
+
'ds_error-summary',
|
|
16
|
+
className
|
|
17
|
+
].join(' ')} aria-labelledby="error-summary-title" role="alert" {...props}>
|
|
18
|
+
<h2 className="ds_error-summary__title" id="error-summary-title">{title}</h2>
|
|
19
|
+
|
|
20
|
+
<ul className="ds_error-summary__list">
|
|
21
|
+
{errors && errors.map((error, index) => (<Error fragmentId={error.fragmentId} title={error.title} key={'error' + index}/>))}
|
|
22
|
+
</ul>
|
|
23
|
+
</div>)}
|
|
24
|
+
</>);
|
|
25
|
+
};
|
|
26
|
+
ErrorSummary.displayName = 'ErrorSummary';
|
|
27
|
+
exports.default = ErrorSummary;
|
|
@@ -0,0 +1,50 @@
|
|
|
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
|
+
const FileIcon_1 = __importDefault(require("../../common/FileIcon"));
|
|
8
|
+
const FileDownload = ({ className, cover, highlighted, icon = 'Generic', fileSize, fileType, fileUrl, title, ...props }) => {
|
|
9
|
+
const hasMetadata = !!fileType || !!fileSize;
|
|
10
|
+
const metaContainerId = `file-download-${(0, react_1.useId)()}`;
|
|
11
|
+
return (<div className={[
|
|
12
|
+
'ds_file-download',
|
|
13
|
+
highlighted && 'ds_file-download--highlighted',
|
|
14
|
+
className
|
|
15
|
+
].join(' ')} {...props}>
|
|
16
|
+
<div className="ds_file-download__thumbnail">
|
|
17
|
+
<a className="ds_file-download__thumbnail-link" aria-hidden="true" tabIndex={-1} href={fileUrl}>
|
|
18
|
+
{cover ?
|
|
19
|
+
<img alt="" className="ds_file-download__thumbnail-image" src={cover}/>
|
|
20
|
+
:
|
|
21
|
+
<FileIcon_1.default ariaLabel="" className="ds_file-download__thumbnail-image" icon={icon}/>}
|
|
22
|
+
</a>
|
|
23
|
+
</div>
|
|
24
|
+
|
|
25
|
+
<div className="ds_file-download__content">
|
|
26
|
+
<a href={fileUrl} className="ds_file-download__title" aria-describedby={hasMetadata ? metaContainerId : undefined}>
|
|
27
|
+
{title}
|
|
28
|
+
</a>
|
|
29
|
+
|
|
30
|
+
{hasMetadata &&
|
|
31
|
+
<div id={metaContainerId} className="ds_file-download__details">
|
|
32
|
+
<dl className="ds_metadata ds_metadata--inline">
|
|
33
|
+
{fileType &&
|
|
34
|
+
<div className="ds_metadata__item">
|
|
35
|
+
<dt className="ds_metadata__key visually-hidden">File type</dt>
|
|
36
|
+
<dd className="ds_metadata__value">{fileType}<span className="visually-hidden">,</span></dd>
|
|
37
|
+
</div>}
|
|
38
|
+
|
|
39
|
+
{fileSize &&
|
|
40
|
+
<div className="ds_metadata__item">
|
|
41
|
+
<dt className="ds_metadata__key visually-hidden">File size</dt>
|
|
42
|
+
<dd className="ds_metadata__value">{fileSize}</dd>
|
|
43
|
+
</div>}
|
|
44
|
+
</dl>
|
|
45
|
+
</div>}
|
|
46
|
+
</div>
|
|
47
|
+
</div>);
|
|
48
|
+
};
|
|
49
|
+
FileDownload.displayName = 'FileDownload';
|
|
50
|
+
exports.default = FileDownload;
|
|
@@ -0,0 +1,71 @@
|
|
|
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 react_1 = __importStar(require("react"));
|
|
40
|
+
// @ts-ignore
|
|
41
|
+
const hide_this_page_1 = __importDefault(require("@scottish-government/design-system/src/components/hide-this-page/hide-this-page"));
|
|
42
|
+
const HideThisPage = ({ className, escapeUrl = 'https://www.bbc.co.uk/weather', ...props }) => {
|
|
43
|
+
const ref = (0, react_1.useRef)(null);
|
|
44
|
+
(0, react_1.useEffect)(() => {
|
|
45
|
+
if (ref.current) {
|
|
46
|
+
new hide_this_page_1.default().init();
|
|
47
|
+
const HIDE_THIS_PAGE_DIV_ID = 'hide-this-page-instruction';
|
|
48
|
+
if (!document.getElementById(HIDE_THIS_PAGE_DIV_ID)) {
|
|
49
|
+
const htpDiv = document.createElement('div');
|
|
50
|
+
htpDiv.id = HIDE_THIS_PAGE_DIV_ID;
|
|
51
|
+
htpDiv.classList.add('visually-hidden');
|
|
52
|
+
htpDiv.classList.add('ds_hide-page');
|
|
53
|
+
htpDiv.innerHTML = '<p>To leave the page quickly, press the escape key.</p>';
|
|
54
|
+
document.body.prepend(htpDiv);
|
|
55
|
+
}
|
|
56
|
+
document.body.classList.add('ds_has-hide-page');
|
|
57
|
+
}
|
|
58
|
+
}, [ref]);
|
|
59
|
+
return (<div className={[
|
|
60
|
+
'ds_hide-page',
|
|
61
|
+
className
|
|
62
|
+
].join(' ')} ref={ref} {...props}>
|
|
63
|
+
<a href={escapeUrl} className="ds_hide-page__button ds_button js-hide-page">
|
|
64
|
+
<strong>Hide this page</strong>
|
|
65
|
+
<span className="visually-hidden js-enabled-text">Or press escape key to hide this page</span>
|
|
66
|
+
</a>
|
|
67
|
+
<p className="ds_hide-page__text js-enabled-text">Or press Esc key</p>
|
|
68
|
+
</div>);
|
|
69
|
+
};
|
|
70
|
+
HideThisPage.displayName = 'HideThisPage';
|
|
71
|
+
exports.default = HideThisPage;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const InsetText = ({ children, className, ...props }) => {
|
|
4
|
+
return (<div className={[
|
|
5
|
+
'ds_inset-text',
|
|
6
|
+
className
|
|
7
|
+
].join(' ')} {...props}>
|
|
8
|
+
<div className="ds_inset-text__text">
|
|
9
|
+
{children}
|
|
10
|
+
</div>
|
|
11
|
+
</div>);
|
|
12
|
+
};
|
|
13
|
+
InsetText.displayName = 'InsetText';
|
|
14
|
+
exports.default = InsetText;
|
|
@@ -0,0 +1,26 @@
|
|
|
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
|
+
const AbstractNotificationBanner_1 = __importDefault(require("../../common/AbstractNotificationBanner"));
|
|
8
|
+
// @ts-ignore
|
|
9
|
+
const notification_banner_1 = __importDefault(require("@scottish-government/design-system/src/components/notification-banner/notification-banner"));
|
|
10
|
+
const NotificationBanner = ({ children, className, close, icon, iconColour, iconInverse, title, ...props }) => {
|
|
11
|
+
const ref = (0, react_1.useRef)(null);
|
|
12
|
+
(0, react_1.useEffect)(() => {
|
|
13
|
+
if (ref.current) {
|
|
14
|
+
new notification_banner_1.default(ref.current).init();
|
|
15
|
+
}
|
|
16
|
+
}, [ref]);
|
|
17
|
+
return (<AbstractNotificationBanner_1.default className={[
|
|
18
|
+
'ds_reversed',
|
|
19
|
+
className
|
|
20
|
+
].join(' ')} close={close} icon={icon ? "PriorityHigh" : undefined} iconColour={iconColour} iconInverse={iconInverse} ref={ref} title="Information" {...props}>
|
|
21
|
+
{children}
|
|
22
|
+
</AbstractNotificationBanner_1.default>);
|
|
23
|
+
};
|
|
24
|
+
NotificationBanner.displayName = 'NotificationBanner';
|
|
25
|
+
NotificationBanner.Buttons = AbstractNotificationBanner_1.default.Buttons;
|
|
26
|
+
exports.default = NotificationBanner;
|
|
@@ -0,0 +1,21 @@
|
|
|
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 WrapperTag_1 = __importDefault(require("../../common/WrapperTag"));
|
|
7
|
+
const NotificationPanel = function ({ ariaLive, children, className, headingLevel = 'h1', title, ...props }) {
|
|
8
|
+
return (<div aria-live={ariaLive} className={[
|
|
9
|
+
'ds_notification-panel',
|
|
10
|
+
className
|
|
11
|
+
].join(' ')} {...props}>
|
|
12
|
+
<WrapperTag_1.default className="ds_notification-panel__title" tagName={headingLevel}>
|
|
13
|
+
{title}
|
|
14
|
+
</WrapperTag_1.default>
|
|
15
|
+
<div className="ds_notification-panel__content">
|
|
16
|
+
{children}
|
|
17
|
+
</div>
|
|
18
|
+
</div>);
|
|
19
|
+
};
|
|
20
|
+
NotificationPanel.displayName = 'NotificationPanel';
|
|
21
|
+
exports.default = NotificationPanel;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const PageHeader = ({ children, className, label, title, ...props }) => {
|
|
4
|
+
return (<header className={[
|
|
5
|
+
'ds_page-header',
|
|
6
|
+
className
|
|
7
|
+
].join(' ')} {...props}>
|
|
8
|
+
{label && <span className="ds_page-header__label ds_content-label">{label}</span>}
|
|
9
|
+
<h1 className="ds_page-header__title">{title}</h1>
|
|
10
|
+
|
|
11
|
+
{children}
|
|
12
|
+
</header>);
|
|
13
|
+
};
|
|
14
|
+
PageHeader.displayName = 'PageHeader';
|
|
15
|
+
exports.default = PageHeader;
|