@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
package/.svgrrc
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
declare namespace SGDS.Component {
|
|
2
2
|
namespace Accordion {
|
|
3
3
|
interface Item extends React.AllHTMLAttributes<HTMLElement> {
|
|
4
|
-
|
|
4
|
+
headingLevel?: SGDS.HeadingLevel,
|
|
5
5
|
id: string,
|
|
6
6
|
open?: boolean,
|
|
7
7
|
title: string
|
|
@@ -9,7 +9,7 @@ declare namespace SGDS.Component {
|
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
interface Accordion extends React.AllHTMLAttributes<HTMLElement> {
|
|
12
|
-
|
|
12
|
+
headingLevel?: SGDS.HeadingLevel,
|
|
13
13
|
hideOpenAll?: boolean
|
|
14
14
|
}
|
|
15
15
|
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
declare namespace SGDS.Component {
|
|
2
|
+
interface FileDownload extends React.AllHTMLAttributes<HTMLElement> {
|
|
3
|
+
cover?: string,
|
|
4
|
+
icon?: DocumentIconName,
|
|
5
|
+
fileSize?: string,
|
|
6
|
+
fileType?: string,
|
|
7
|
+
fileUrl: string,
|
|
8
|
+
highlighted?: boolean,
|
|
9
|
+
title: string
|
|
10
|
+
}
|
|
11
|
+
}
|
package/@types/sgds.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
declare namespace SGDS {
|
|
2
2
|
type AriaLive = 'polite' | 'assertive';
|
|
3
|
-
type
|
|
3
|
+
type HeadingLevel = 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';
|
|
4
4
|
type IconName = 'ArrowUpward' | 'CalendarToday' | 'Cancel' | 'CheckCircle' | 'ChevronLeft' | 'ChevronRight' | 'Close' | 'Description' | 'DoubleChevronLeft' | 'DoubleChevronRight' | 'Error' | 'ExpandLess' | 'ExpandMore' | 'List' | 'Menu' | 'PriorityHigh' | 'Search';
|
|
5
|
+
type DocumentIconName = 'Audio' | 'Csv' | 'Excel' | 'File' | 'Generic' | 'Geodata' | 'Ical' | 'Ico' | 'Image' | 'Odf' | 'Odg' | 'Odp' | 'Ods' | 'Odt' | 'Pdf' | 'Ppt' | 'Rtf' | 'Text' | 'Video' | 'Word' | 'Xml' | 'Zip';
|
|
5
6
|
type InputWidth = 'fixed-20' | 'fixed-10' | 'fixed-5' | 'fixed-4' | 'fixed-3' | 'fixed-2' | 'fluid-three-quarters' | 'fluid-two-thirds' | 'fluid-half' | 'fluid-one-third' | 'fluid-one-quarter';
|
|
6
7
|
type TagColour = 'grey' | 'green' | 'teal' | 'blue' | 'purple' | 'pink' | 'red' | 'orange' | 'yellow';
|
|
7
8
|
|
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
# Change log
|
|
2
|
+
|
|
3
|
+
All notable changes to the Scottish Government "Design System React" repository/package will be documented in this file.
|
|
4
|
+
|
|
5
|
+
Changes are grouped under the labels: `Added`, `Changed`, `Deprecated`, `Fixed`,
|
|
6
|
+
`Removed` and `Security`.
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
## [0.7.0]
|
|
11
|
+
### Changed
|
|
12
|
+
- Change all component file names to Pascal case
|
|
13
|
+
- Use uppercase text for const variable names
|
|
14
|
+
- Nomenclature: prefer 'heading' over 'header' in variable names when referring to HTML headings (H1-H6)
|
|
15
|
+
|
|
16
|
+
## [0.6.0] - 2025-07-29
|
|
17
|
+
### Added
|
|
18
|
+
- Add 'File download' component
|
|
19
|
+
- Add 'File icon' component
|
|
20
|
+
### Changed
|
|
21
|
+
- Reorganise SVG icon components into subfolders
|
|
22
|
+
|
|
23
|
+
## [0.5.1] - 2025-07-28
|
|
24
|
+
### Changed
|
|
25
|
+
- 'DisplayName' property of some compound components updated (Metadata.Item, TaskList.Item, TaskList.Group)
|
|
26
|
+
|
|
27
|
+
## [0.5.0] - 2025-07-28
|
|
28
|
+
### Added
|
|
29
|
+
- Add 'Tabs' component
|
|
30
|
+
|
|
31
|
+
## [0.4.0] - 2025-07-23
|
|
32
|
+
### Added
|
|
33
|
+
- Add 'Abstract notification banner' component
|
|
34
|
+
- Add 'Cookie banner' component
|
|
35
|
+
- Add 'Table' component
|
|
36
|
+
- Add code of conduct
|
|
37
|
+
### Changed
|
|
38
|
+
- 'Notification banner' refactored to use AbstractNotificationBanner
|
|
39
|
+
### Fixed
|
|
40
|
+
- Fixed miscellaneous type warnings in unit tests
|
|
41
|
+
|
|
42
|
+
## [0.3.0] - 2025-07-15
|
|
43
|
+
### Added
|
|
44
|
+
- Add 'Site header' component/pattern
|
|
45
|
+
### Changed
|
|
46
|
+
- SiteNavigation: add useRef, to support mobile navigation
|
|
47
|
+
- DatePicker: add 'dateSelectCallback' prop
|
|
48
|
+
|
|
49
|
+
## [0.2.0] - 2025-07-07
|
|
50
|
+
### Added
|
|
51
|
+
- Add 'Error summary' component
|
|
52
|
+
|
|
53
|
+
## [0.1.7] - 2025-06-27
|
|
54
|
+
### Added
|
|
55
|
+
- Add 'Summary card' component
|
|
56
|
+
- Add 'Summary list' component
|
|
57
|
+
|
|
58
|
+
## [0.1.6] - 2025-06-27
|
|
59
|
+
### Added
|
|
60
|
+
- Add 'Hide this page' component
|
|
61
|
+
|
|
62
|
+
## [0.1.5] - 2025-06-23
|
|
63
|
+
### Added
|
|
64
|
+
- Add 'Pagination' component
|
|
65
|
+
### Changed
|
|
66
|
+
- Icon: refactor to use icon components generated from DS source using SVGR
|
|
67
|
+
- Add 'aria-invalid' to form fields that are in an error state
|
|
68
|
+
|
|
69
|
+
## [0.1.2] - 2025-06-17
|
|
70
|
+
### Added
|
|
71
|
+
- Add readme file
|
|
72
|
+
|
|
73
|
+
## [0.1.1] - 2025-06-13
|
|
74
|
+
### Changed
|
|
75
|
+
- Allow all components to have additional CSS classes passed to them
|
|
76
|
+
|
|
77
|
+
## [0.1.0] - 2025-06-13
|
|
78
|
+
### Added
|
|
79
|
+
- Add npmignore file
|
|
80
|
+
### Fixed
|
|
81
|
+
- Fix broken content navigation spec
|
package/README.md
CHANGED
|
@@ -4,6 +4,10 @@ This repository contains a React implementation of the [Scottish Government Desi
|
|
|
4
4
|
|
|
5
5
|
There is a documentation site showing what is in this implementation and how to use it here: https://designsystem-react.vercel.app/
|
|
6
6
|
|
|
7
|
+
## 🚧 Under construction 🚧
|
|
8
|
+
|
|
9
|
+
Warning: This project is in an alpha state and could potentially receive large breaking changes with little warning while it is being developed.
|
|
10
|
+
|
|
7
11
|
## Feedback, help or support
|
|
8
12
|
|
|
9
13
|
If you need any help or want to give any feedback you can e-mail the Design System team at: [designsystem@gov.scot](mailto:designsystem@gov.scot).
|
|
@@ -0,0 +1,63 @@
|
|
|
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("./Icon"));
|
|
8
|
+
const ScreenReaderText_1 = __importDefault(require("./ScreenReaderText"));
|
|
9
|
+
const Buttons = ({ children }) => {
|
|
10
|
+
return (<>{children}</>);
|
|
11
|
+
};
|
|
12
|
+
const AbstractNotificationBanner = ({ children, className, close, icon, iconColour, iconInverse, title = 'Information', ...props }) => {
|
|
13
|
+
let content = [];
|
|
14
|
+
let buttons;
|
|
15
|
+
react_1.Children.forEach(children, (child) => {
|
|
16
|
+
if ((0, react_1.isValidElement)(child) && child.type === Buttons) {
|
|
17
|
+
buttons = child;
|
|
18
|
+
}
|
|
19
|
+
else {
|
|
20
|
+
content.push(child);
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
return (<div className={[
|
|
24
|
+
'ds_notification',
|
|
25
|
+
className
|
|
26
|
+
].join(' ')} data-module="ds-notification" {...props}>
|
|
27
|
+
<div className="ds_wrapper">
|
|
28
|
+
<div className={[
|
|
29
|
+
'ds_notification__content',
|
|
30
|
+
close && 'ds_notification__content--has-close'
|
|
31
|
+
].join(' ')}>
|
|
32
|
+
<h2 className="visually-hidden">{title}</h2>
|
|
33
|
+
|
|
34
|
+
{icon &&
|
|
35
|
+
<span className={[
|
|
36
|
+
'ds_notification__icon',
|
|
37
|
+
iconInverse && 'ds_notification__icon--inverse',
|
|
38
|
+
iconColour && 'ds_notification__icon--colour'
|
|
39
|
+
].join(' ')} aria-hidden="true">
|
|
40
|
+
<Icon_1.default icon={icon}/>
|
|
41
|
+
</span>}
|
|
42
|
+
|
|
43
|
+
<div className="ds_notification__text">
|
|
44
|
+
{content}
|
|
45
|
+
</div>
|
|
46
|
+
|
|
47
|
+
{close &&
|
|
48
|
+
<button type="button" className="ds_notification__close js-close-notification">
|
|
49
|
+
<ScreenReaderText_1.default>Close this notification</ScreenReaderText_1.default>
|
|
50
|
+
<Icon_1.default fill icon="Close" aria-hidden="true"/>
|
|
51
|
+
</button>}
|
|
52
|
+
|
|
53
|
+
{buttons &&
|
|
54
|
+
<div className="ds_button-group">
|
|
55
|
+
{buttons}
|
|
56
|
+
</div>}
|
|
57
|
+
</div>
|
|
58
|
+
</div>
|
|
59
|
+
</div>);
|
|
60
|
+
};
|
|
61
|
+
AbstractNotificationBanner.displayName = 'AbstractNotificationBanner';
|
|
62
|
+
AbstractNotificationBanner.Buttons = Buttons;
|
|
63
|
+
exports.default = AbstractNotificationBanner;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
/**
|
|
4
|
+
* Wraps all children in a specified HTML tag if a condition is met.
|
|
5
|
+
*/
|
|
6
|
+
const ConditionalWrapper = ({ condition, wrapper, children }) => condition ? wrapper(children) : children;
|
|
7
|
+
ConditionalWrapper.displayName = 'ConditionalWrapper';
|
|
8
|
+
exports.default = ConditionalWrapper;
|
|
@@ -0,0 +1,51 @@
|
|
|
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 = __importDefault(require("react"));
|
|
40
|
+
const FileIcons = __importStar(require("../images/documents"));
|
|
41
|
+
const FileIcon = ({ ariaLabel = '', className, icon }) => {
|
|
42
|
+
const Component = react_1.default.createElement(FileIcons[icon], {
|
|
43
|
+
className: className,
|
|
44
|
+
'aria-label': ariaLabel
|
|
45
|
+
});
|
|
46
|
+
return (<>
|
|
47
|
+
{Component}
|
|
48
|
+
</>);
|
|
49
|
+
};
|
|
50
|
+
FileIcon.displayName = 'FileIcon';
|
|
51
|
+
exports.default = FileIcon;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const HintText = ({ children, id, text, ...props }) => {
|
|
4
|
+
return (<p className="ds_hint-text" dangerouslySetInnerHTML={text ? { __html: text } : undefined} id={id} {...props}>
|
|
5
|
+
{!text ? children : null}
|
|
6
|
+
</p>);
|
|
7
|
+
};
|
|
8
|
+
HintText.displayName = 'HintText';
|
|
9
|
+
exports.default = HintText;
|
|
@@ -0,0 +1,57 @@
|
|
|
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 = __importDefault(require("react"));
|
|
40
|
+
const Icons = __importStar(require("../images/icons"));
|
|
41
|
+
const Icon = ({ ariaLabel, className, fill, icon, iconSize }) => {
|
|
42
|
+
const Component = react_1.default.createElement(Icons[icon], {
|
|
43
|
+
'aria-hidden': ariaLabel ? undefined : true,
|
|
44
|
+
'aria-label': ariaLabel,
|
|
45
|
+
className: [
|
|
46
|
+
'ds_icon',
|
|
47
|
+
className,
|
|
48
|
+
fill && 'ds_icon--fill',
|
|
49
|
+
iconSize && `ds_icon--${iconSize}`
|
|
50
|
+
].join(' ')
|
|
51
|
+
});
|
|
52
|
+
return (<>
|
|
53
|
+
{Component}
|
|
54
|
+
</>);
|
|
55
|
+
};
|
|
56
|
+
Icon.displayName = 'Icon';
|
|
57
|
+
exports.default = Icon;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const ScreenReaderText = ({ children, ...props }) => {
|
|
4
|
+
return (<span className="visually-hidden" {...props}>
|
|
5
|
+
{children}
|
|
6
|
+
</span>);
|
|
7
|
+
};
|
|
8
|
+
ScreenReaderText.displayName = 'ScreenReaderText';
|
|
9
|
+
exports.default = ScreenReaderText;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
/**
|
|
4
|
+
* Wraps all children in a specified HTML tag.
|
|
5
|
+
*/
|
|
6
|
+
const WrapperTag = ({ children, tagName = 'div', ...props }) => {
|
|
7
|
+
const TagName = tagName;
|
|
8
|
+
return <TagName {...props}>{children}</TagName>;
|
|
9
|
+
};
|
|
10
|
+
WrapperTag.displayName = 'WrapperTag';
|
|
11
|
+
exports.default = WrapperTag;
|
|
@@ -0,0 +1,51 @@
|
|
|
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 = __importDefault(require("react"));
|
|
40
|
+
const FileIcons = __importStar(require("../images/documents"));
|
|
41
|
+
const FileIcon = ({ ariaLabel = '', className, icon }) => {
|
|
42
|
+
const Component = react_1.default.createElement(FileIcons[icon], {
|
|
43
|
+
className: className,
|
|
44
|
+
'aria-label': ariaLabel
|
|
45
|
+
});
|
|
46
|
+
return (<>
|
|
47
|
+
{Component}
|
|
48
|
+
</>);
|
|
49
|
+
};
|
|
50
|
+
FileIcon.displayName = 'FileIcon';
|
|
51
|
+
exports.default = FileIcon;
|
package/dist/common/icon.jsx
CHANGED
|
@@ -37,7 +37,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
37
37
|
};
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
39
|
const react_1 = __importDefault(require("react"));
|
|
40
|
-
const Icons = __importStar(require("../icons"));
|
|
40
|
+
const Icons = __importStar(require("../images/icons"));
|
|
41
41
|
const Icon = ({ ariaLabel, className, fill, icon, iconSize }) => {
|
|
42
42
|
const Component = react_1.default.createElement(Icons[icon], {
|
|
43
43
|
'aria-hidden': ariaLabel ? undefined : true,
|
|
@@ -0,0 +1,102 @@
|
|
|
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
|
+
const WrapperTag_1 = __importDefault(require("../../common/WrapperTag"));
|
|
41
|
+
// @ts-ignore
|
|
42
|
+
const accordion_1 = __importDefault(require("@scottish-government/design-system/src/components/accordion/accordion"));
|
|
43
|
+
let accordionItemCounter = 0;
|
|
44
|
+
const AccordionItem = ({ children, className, headingLevel = 'h3', id: rawId, open = false, title, ...props }) => {
|
|
45
|
+
accordionItemCounter = accordionItemCounter + 1;
|
|
46
|
+
const processedId = rawId || `accordion-item-${accordionItemCounter}`;
|
|
47
|
+
return (<div className={[
|
|
48
|
+
'ds_accordion-item',
|
|
49
|
+
className
|
|
50
|
+
].join(' ')} id={processedId} {...props}>
|
|
51
|
+
<input aria-labelledby={`panel-${processedId}-heading`} className={[
|
|
52
|
+
'ds_accordion-item__control',
|
|
53
|
+
'visually-hidden'
|
|
54
|
+
].join(' ')} defaultChecked={open} id={`${processedId}-control`} type="checkbox"/>
|
|
55
|
+
<div className="ds_accordion-item__header">
|
|
56
|
+
<WrapperTag_1.default id={`panel-${processedId}-heading`} className="ds_accordion-item__title" tagName={headingLevel}>
|
|
57
|
+
{title}
|
|
58
|
+
</WrapperTag_1.default>
|
|
59
|
+
<span className='ds_accordion-item__indicator'/>
|
|
60
|
+
<label className="ds_accordion-item__label" htmlFor={`${processedId}-control`}>
|
|
61
|
+
<span className="visually-hidden">Show this section</span>
|
|
62
|
+
</label>
|
|
63
|
+
</div>
|
|
64
|
+
<div className="ds_accordion-item__body">
|
|
65
|
+
{children}
|
|
66
|
+
</div>
|
|
67
|
+
</div>);
|
|
68
|
+
};
|
|
69
|
+
const Accordion = ({ children, className, headingLevel = 'h3', hideOpenAll, ...props }) => {
|
|
70
|
+
const ref = (0, react_1.useRef)(null);
|
|
71
|
+
(0, react_1.useEffect)(() => {
|
|
72
|
+
if (ref.current) {
|
|
73
|
+
new accordion_1.default(ref.current).init();
|
|
74
|
+
}
|
|
75
|
+
}, [ref]);
|
|
76
|
+
if (!children) {
|
|
77
|
+
hideOpenAll = true;
|
|
78
|
+
}
|
|
79
|
+
function processChild(child) {
|
|
80
|
+
return react_1.default.cloneElement(child, { headingLevel: headingLevel });
|
|
81
|
+
}
|
|
82
|
+
return (<div className={[
|
|
83
|
+
'ds_accordion',
|
|
84
|
+
className
|
|
85
|
+
].join(' ')} ref={ref} {...props}>
|
|
86
|
+
{!hideOpenAll && (<button className={[
|
|
87
|
+
'ds_accordion__open-all',
|
|
88
|
+
'ds_link',
|
|
89
|
+
'js-open-all'
|
|
90
|
+
].join(' ')} type='button'>
|
|
91
|
+
Open all
|
|
92
|
+
{' '}
|
|
93
|
+
<span className="visually-hidden">sections</span>
|
|
94
|
+
</button>)}
|
|
95
|
+
|
|
96
|
+
{react_1.Children.map(children, child => processChild(child))}
|
|
97
|
+
</div>);
|
|
98
|
+
};
|
|
99
|
+
Accordion.displayName = 'Accordion';
|
|
100
|
+
AccordionItem.displayName = 'AccordionItem';
|
|
101
|
+
Accordion.Item = AccordionItem;
|
|
102
|
+
exports.default = Accordion;
|