@scottish-government/designsystem-react 0.12.0 → 0.13.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/.storybook/main.ts +6 -6
- package/.storybook/sgdsArgTypes.ts +84 -43
- package/CHANGELOG.md +27 -1
- package/dist/common/AbstractNotificationBanner/AbstractNotificationBanner.d.ts +9 -0
- package/dist/common/AbstractNotificationBanner/AbstractNotificationBanner.jsx +62 -0
- package/dist/common/AbstractNotificationBanner/index.d.ts +1 -0
- package/dist/common/AbstractNotificationBanner/index.js +8 -0
- package/dist/common/ActionLink/ActionLink.d.ts +5 -0
- package/dist/common/ActionLink/ActionLink.jsx +19 -0
- package/dist/common/ActionLink/index.d.ts +1 -0
- package/dist/common/ActionLink/index.js +8 -0
- package/dist/common/ConditionalWrapper/ConditionalWrapper.d.ts +8 -0
- package/dist/common/ConditionalWrapper/ConditionalWrapper.jsx +8 -0
- package/dist/common/ConditionalWrapper/index.d.ts +1 -0
- package/dist/common/ConditionalWrapper/index.js +8 -0
- package/dist/common/FileIcon/FileIcon.d.ts +6 -0
- package/dist/common/FileIcon/FileIcon.jsx +46 -0
- package/dist/common/FileIcon/index.d.ts +1 -0
- package/dist/common/FileIcon/index.js +8 -0
- package/dist/common/HintText/HintText.d.ts +5 -0
- package/dist/common/HintText/HintText.jsx +9 -0
- package/dist/common/HintText/index.d.ts +1 -0
- package/dist/common/HintText/index.js +8 -0
- package/dist/common/Icon/Icon.d.ts +6 -0
- package/dist/common/Icon/Icon.jsx +51 -0
- package/dist/common/Icon/index.d.ts +1 -0
- package/dist/common/Icon/index.js +8 -0
- package/dist/common/ScreenReaderText/ScreenReaderText.d.ts +5 -0
- package/dist/common/ScreenReaderText/ScreenReaderText.jsx +9 -0
- package/dist/common/ScreenReaderText/index.d.ts +1 -0
- package/dist/common/ScreenReaderText/index.js +8 -0
- package/dist/common/WrapperTag/WrapperTag.d.ts +8 -0
- package/dist/common/WrapperTag/WrapperTag.jsx +11 -0
- package/dist/common/WrapperTag/index.d.ts +1 -0
- package/dist/common/WrapperTag/index.js +8 -0
- package/dist/common/index.d.ts +8 -0
- package/dist/common/index.js +22 -0
- package/dist/components/Accordion/index.d.ts +1 -0
- package/dist/components/Accordion/index.js +8 -0
- package/dist/components/AspectBox/index.d.ts +1 -0
- package/dist/components/AspectBox/index.js +8 -0
- package/dist/components/BackToTop/index.d.ts +1 -0
- package/dist/components/BackToTop/index.js +8 -0
- package/dist/components/Breadcrumbs/index.d.ts +1 -0
- package/dist/components/Breadcrumbs/index.js +8 -0
- package/dist/components/Button/ButtonGroup.d.ts +5 -0
- package/dist/components/Button/ButtonGroup.jsx +13 -0
- package/dist/components/Button/index.d.ts +2 -0
- package/dist/components/Button/index.js +10 -0
- package/dist/components/CategoryItem/index.d.ts +1 -0
- package/dist/components/CategoryItem/index.js +8 -0
- package/dist/components/CategoryList/index.d.ts +1 -0
- package/dist/components/CategoryList/index.js +8 -0
- package/dist/components/Checkbox/index.d.ts +2 -0
- package/dist/components/Checkbox/index.js +10 -0
- package/dist/components/ConfirmationMessage/index.d.ts +1 -0
- package/dist/components/ConfirmationMessage/index.js +8 -0
- package/dist/components/ContentsNav/index.d.ts +1 -0
- package/dist/components/ContentsNav/index.js +8 -0
- package/dist/components/CookieBanner/index.d.ts +1 -0
- package/dist/components/CookieBanner/index.js +8 -0
- package/dist/components/DatePicker/DatePicker.jsx +2 -2
- package/dist/components/DatePicker/index.d.ts +1 -0
- package/dist/components/DatePicker/index.js +8 -0
- package/dist/components/Details/index.d.ts +1 -0
- package/dist/components/Details/index.js +8 -0
- package/dist/components/ErrorMessage/index.d.ts +1 -0
- package/dist/components/ErrorMessage/index.js +8 -0
- package/dist/components/ErrorSummary/index.d.ts +1 -0
- package/dist/components/ErrorSummary/index.js +8 -0
- package/dist/components/FeatureHeader/FeatureHeader.d.ts +13 -0
- package/dist/components/FeatureHeader/FeatureHeader.jsx +70 -0
- package/dist/components/FeatureHeader/index.d.ts +1 -0
- package/dist/components/FeatureHeader/index.js +8 -0
- package/dist/components/FileDownload/index.d.ts +1 -0
- package/dist/components/FileDownload/index.js +8 -0
- package/dist/components/HideThisPage/index.d.ts +1 -0
- package/dist/components/HideThisPage/index.js +8 -0
- package/dist/components/InsetText/index.d.ts +1 -0
- package/dist/components/InsetText/index.js +8 -0
- package/dist/components/NotificationBanner/index.d.ts +1 -0
- package/dist/components/NotificationBanner/index.js +8 -0
- package/dist/components/NotificationPanel/index.d.ts +1 -0
- package/dist/components/NotificationPanel/index.js +8 -0
- package/dist/components/PageHeader/index.d.ts +1 -0
- package/dist/components/PageHeader/index.js +8 -0
- package/dist/components/PageMetadata/index.d.ts +1 -0
- package/dist/components/PageMetadata/index.js +8 -0
- package/dist/components/Pagination/index.d.ts +1 -0
- package/dist/components/Pagination/index.js +8 -0
- package/dist/components/PhaseBanner/index.d.ts +1 -0
- package/dist/components/PhaseBanner/index.js +8 -0
- package/dist/components/Question/Question.jsx +1 -1
- package/dist/components/Question/index.d.ts +1 -0
- package/dist/components/Question/index.js +8 -0
- package/dist/components/RadioButton/index.d.ts +2 -0
- package/dist/components/RadioButton/index.js +10 -0
- package/dist/components/SearchFacets/index.d.ts +1 -0
- package/dist/components/SearchFacets/index.js +8 -0
- package/dist/components/SearchFilters/SearchFilters.jsx +6 -6
- package/dist/components/SearchFilters/index.d.ts +1 -0
- package/dist/components/SearchFilters/index.js +8 -0
- package/dist/components/SearchResult/SearchResult.jsx +2 -2
- package/dist/components/SearchResult/index.d.ts +1 -0
- package/dist/components/SearchResult/index.js +8 -0
- package/dist/components/SearchSort/SearchSort.jsx +2 -2
- package/dist/components/SearchSort/index.d.ts +1 -0
- package/dist/components/SearchSort/index.js +8 -0
- package/dist/components/Select/Select.jsx +1 -1
- package/dist/components/Select/index.d.ts +1 -0
- package/dist/components/Select/index.js +8 -0
- package/dist/components/SequentialNavigation/index.d.ts +1 -0
- package/dist/components/SequentialNavigation/index.js +8 -0
- package/dist/components/SideNavigation/index.d.ts +1 -0
- package/dist/components/SideNavigation/index.js +8 -0
- package/dist/components/SiteFooter/index.d.ts +1 -0
- package/dist/components/SiteFooter/index.js +8 -0
- package/dist/components/SiteHeader/SiteHeader.jsx +1 -1
- package/dist/components/SiteHeader/index.d.ts +1 -0
- package/dist/components/SiteHeader/index.js +8 -0
- package/dist/components/SiteNavigation/index.d.ts +1 -0
- package/dist/components/SiteNavigation/index.js +8 -0
- package/dist/components/SiteSearch/SiteSearch.jsx +1 -1
- package/dist/components/SiteSearch/index.d.ts +1 -0
- package/dist/components/SiteSearch/index.js +8 -0
- package/dist/components/SkipLinks/index.d.ts +1 -0
- package/dist/components/SkipLinks/index.js +8 -0
- package/dist/components/SummaryCard/index.d.ts +1 -0
- package/dist/components/SummaryCard/index.js +8 -0
- package/dist/components/SummaryList/index.d.ts +1 -0
- package/dist/components/SummaryList/index.js +8 -0
- package/dist/components/Table/index.d.ts +1 -0
- package/dist/components/Table/index.js +8 -0
- package/dist/components/Tabs/index.d.ts +1 -0
- package/dist/components/Tabs/index.js +8 -0
- package/dist/components/Tag/index.d.ts +1 -0
- package/dist/components/Tag/index.js +8 -0
- package/dist/components/TaskList/TaskList.jsx +1 -1
- package/dist/components/TaskList/index.d.ts +1 -0
- package/dist/components/TaskList/index.js +8 -0
- package/dist/components/TextInput/TextInput.jsx +2 -2
- package/dist/components/TextInput/index.d.ts +1 -0
- package/dist/components/TextInput/index.js +8 -0
- package/dist/components/Textarea/Textarea.jsx +1 -1
- package/dist/components/Textarea/index.d.ts +1 -0
- package/dist/components/Textarea/index.js +8 -0
- package/dist/components/WarningText/index.d.ts +1 -0
- package/dist/components/WarningText/index.js +8 -0
- package/dist/components/index.d.ts +46 -0
- package/dist/components/index.js +101 -0
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/index.js +8 -0
- package/dist/hooks/useTracking/index.d.ts +1 -0
- package/dist/hooks/useTracking/index.js +8 -0
- package/dist/hooks/useTracking/useTracking.d.ts +1 -0
- package/dist/hooks/useTracking/useTracking.js +21 -0
- package/dist/images/index.d.ts +2 -0
- package/dist/images/index.js +38 -0
- package/eslint.config.mjs +32 -0
- package/package.json +29 -22
- package/src/common/{AbstractNotificationBanner.test.tsx → AbstractNotificationBanner/AbstractNotificationBanner.test.tsx} +1 -1
- package/src/common/{AbstractNotificationBanner.tsx → AbstractNotificationBanner/AbstractNotificationBanner.tsx} +7 -6
- package/src/common/AbstractNotificationBanner/index.ts +1 -0
- package/src/common/AbstractNotificationBanner/types.ts +15 -0
- package/src/common/{ActionLink.tsx → ActionLink/ActionLink.tsx} +3 -1
- package/src/common/ActionLink/index.ts +1 -0
- package/src/common/ActionLink/types.ts +8 -0
- package/src/common/ConditionalWrapper/ConditionalWrapper.tsx +17 -0
- package/src/common/ConditionalWrapper/index.ts +1 -0
- package/src/common/ConditionalWrapper/types.ts +4 -0
- package/src/common/{FileIcon.tsx → FileIcon/FileIcon.tsx} +3 -2
- package/src/common/FileIcon/index.ts +1 -0
- package/src/common/FileIcon/types.ts +7 -0
- package/src/common/{HintText.test.tsx → HintText/HintText.test.tsx} +3 -15
- package/src/common/{HintText.tsx → HintText/HintText.tsx} +4 -4
- package/src/common/HintText/index.ts +1 -0
- package/src/common/HintText/types.ts +4 -0
- package/src/common/{Icon.tsx → Icon/Icon.tsx} +3 -2
- package/src/common/Icon/index.ts +1 -0
- package/src/common/Icon/types.ts +9 -0
- package/src/common/{ScreenReaderText.tsx → ScreenReaderText/ScreenReaderText.tsx} +1 -1
- package/src/common/ScreenReaderText/index.ts +1 -0
- package/src/common/{WrapperTag.tsx → WrapperTag/WrapperTag.tsx} +5 -3
- package/src/common/WrapperTag/index.ts +1 -0
- package/src/common/WrapperTag/types.ts +3 -0
- package/src/common/index.ts +8 -0
- package/src/components/Accordion/Accordion.Item.stories.tsx +1 -5
- package/src/components/Accordion/Accordion.stories.tsx +5 -5
- package/src/components/Accordion/Accordion.tsx +5 -4
- package/src/components/Accordion/index.ts +1 -0
- package/src/components/Accordion/types.ts +13 -0
- package/src/components/AspectBox/AspectBox.stories.tsx +1 -2
- package/src/components/AspectBox/AspectBox.tsx +5 -4
- package/src/components/AspectBox/index.ts +1 -0
- package/src/components/AspectBox/types.ts +3 -0
- package/src/components/BackToTop/BackToTop.tsx +3 -2
- package/src/components/BackToTop/index.ts +1 -0
- package/src/components/BackToTop/types.ts +3 -0
- package/src/components/Breadcrumbs/Breadcrumbs.tsx +4 -2
- package/src/components/Breadcrumbs/index.ts +1 -0
- package/src/components/Breadcrumbs/types.ts +6 -0
- package/src/components/Button/Button.tsx +2 -1
- package/src/components/{ButtonGroup → Button}/ButtonGroup.stories.tsx +1 -1
- package/src/components/{ButtonGroup → Button}/ButtonGroup.tsx +3 -1
- package/src/components/Button/index.ts +2 -0
- package/src/components/Button/types.ts +21 -0
- package/src/components/CategoryItem/CategoryItem.tsx +7 -4
- package/src/components/CategoryItem/index.ts +1 -0
- package/src/components/CategoryItem/types.ts +10 -0
- package/src/components/CategoryList/CategoryList.stories.tsx +1 -1
- package/src/components/CategoryList/CategoryList.test.tsx +1 -1
- package/src/components/CategoryList/CategoryList.tsx +4 -2
- package/src/components/CategoryList/index.ts +1 -0
- package/src/components/CategoryList/types.ts +5 -0
- package/src/components/Checkbox/Checkbox.stories.tsx +3 -3
- package/src/components/Checkbox/Checkbox.tsx +5 -4
- package/src/components/Checkbox/CheckboxGroup.tsx +3 -3
- package/src/components/Checkbox/index.ts +2 -0
- package/src/components/Checkbox/types.ts +9 -0
- package/src/components/ConfirmationMessage/ConfirmationMessage.tsx +2 -1
- package/src/components/ConfirmationMessage/index.ts +1 -0
- package/src/components/ConfirmationMessage/types.ts +7 -0
- package/src/components/ContentsNav/ContentsNav.stories.tsx +5 -1
- package/src/components/ContentsNav/ContentsNav.tsx +3 -2
- package/src/components/ContentsNav/index.ts +1 -0
- package/src/components/ContentsNav/types.ts +11 -0
- package/src/components/CookieBanner/CookieBanner.Buttons.stories.tsx +4 -4
- package/src/components/CookieBanner/CookieBanner.stories.tsx +7 -7
- package/src/components/CookieBanner/CookieBanner.test.tsx +6 -0
- package/src/components/CookieBanner/CookieBanner.tsx +13 -3
- package/src/components/CookieBanner/index.ts +1 -0
- package/src/components/DatePicker/DatePicker.test.tsx +0 -5
- package/src/components/DatePicker/DatePicker.tsx +5 -4
- package/src/components/DatePicker/index.ts +1 -0
- package/src/components/DatePicker/types.ts +20 -0
- package/src/components/Details/Details.stories.tsx +1 -1
- package/src/components/Details/Details.tsx +3 -1
- package/src/components/Details/index.ts +1 -0
- package/src/components/Details/types.ts +4 -0
- package/src/components/ErrorMessage/ErrorMessage.tsx +3 -1
- package/src/components/ErrorMessage/index.ts +1 -0
- package/src/components/ErrorMessage/types.ts +3 -0
- package/src/components/ErrorSummary/ErrorSummary.test.tsx +1 -1
- package/src/components/ErrorSummary/ErrorSummary.tsx +3 -2
- package/src/components/ErrorSummary/index.ts +1 -0
- package/src/components/ErrorSummary/types.ts +11 -0
- package/src/components/FileDownload/FileDownload.tsx +2 -1
- package/src/components/FileDownload/index.ts +1 -0
- package/src/components/FileDownload/types.ts +11 -0
- package/src/components/HideThisPage/HideThisPage.tsx +3 -2
- package/src/components/HideThisPage/index.ts +1 -0
- package/src/components/HideThisPage/types.ts +3 -0
- package/src/components/InsetText/InsetText.tsx +1 -1
- package/src/components/InsetText/index.ts +1 -0
- package/src/components/NotificationBanner/NotificationBanner.stories.tsx +2 -2
- package/src/components/NotificationBanner/NotificationBanner.tsx +5 -4
- package/src/components/NotificationBanner/index.ts +1 -0
- package/src/components/NotificationPanel/NotificationPanel.tsx +2 -1
- package/src/components/NotificationPanel/index.ts +1 -0
- package/src/components/NotificationPanel/types.ts +7 -0
- package/src/components/PageHeader/PageHeader.stories.tsx +1 -1
- package/src/components/PageHeader/PageHeader.tsx +3 -1
- package/src/components/PageHeader/index.ts +1 -0
- package/src/components/PageHeader/types.ts +5 -0
- package/src/components/PageMetadata/PageMetadata.stories.tsx +1 -1
- package/src/components/PageMetadata/PageMetadata.tsx +5 -3
- package/src/components/PageMetadata/index.ts +1 -0
- package/src/components/PageMetadata/types.ts +7 -0
- package/src/components/Pagination/Pagination.tsx +5 -3
- package/src/components/Pagination/index.ts +1 -0
- package/src/components/Pagination/types.ts +20 -0
- package/src/components/PhaseBanner/PhaseBanner.stories.tsx +1 -4
- package/src/components/PhaseBanner/PhaseBanner.tsx +2 -1
- package/src/components/PhaseBanner/index.ts +1 -0
- package/src/components/PhaseBanner/types.ts +3 -0
- package/src/components/Question/Question.stories.tsx +2 -3
- package/src/components/Question/Question.tsx +5 -4
- package/src/components/Question/index.ts +1 -0
- package/src/components/Question/types.ts +9 -0
- package/src/components/RadioButton/RadioButton.tsx +5 -4
- package/src/components/RadioButton/RadioGroup.stories.tsx +1 -2
- package/src/components/RadioButton/RadioGroup.test.tsx +1 -2
- package/src/components/RadioButton/RadioGroup.tsx +2 -1
- package/src/components/RadioButton/index.ts +2 -0
- package/src/components/RadioButton/types.ts +12 -0
- package/src/components/SearchFacets/SearchFacets.Group.stories.tsx +2 -3
- package/src/components/SearchFacets/SearchFacets.stories.tsx +1 -1
- package/src/components/SearchFacets/SearchFacets.tsx +7 -6
- package/src/components/SearchFacets/index.ts +1 -0
- package/src/components/SearchFacets/types.ts +14 -0
- package/src/components/SearchFilters/SearchFilters.Panel.stories.tsx +20 -9
- package/src/components/SearchFilters/SearchFilters.stories.tsx +3 -3
- package/src/components/SearchFilters/SearchFilters.test.tsx +1 -1
- package/src/components/SearchFilters/SearchFilters.tsx +8 -7
- package/src/components/SearchFilters/index.ts +1 -0
- package/src/components/SearchFilters/types.ts +14 -0
- package/src/components/SearchResult/SearchResult.stories.tsx +9 -10
- package/src/components/SearchResult/SearchResult.tsx +11 -10
- package/src/components/SearchResult/index.ts +1 -0
- package/src/components/SearchResult/types.ts +13 -0
- package/src/components/SearchSort/SearchSort.stories.tsx +2 -1
- package/src/components/SearchSort/SearchSort.tsx +4 -3
- package/src/components/SearchSort/index.ts +1 -0
- package/src/components/SearchSort/types.ts +7 -0
- package/src/components/Select/Select.tsx +6 -5
- package/src/components/Select/index.ts +1 -0
- package/src/components/Select/types.ts +7 -0
- package/src/components/SequentialNavigation/SequentialNavigation.tsx +6 -4
- package/src/components/SequentialNavigation/index.ts +1 -0
- package/src/components/SequentialNavigation/types.ts +12 -0
- package/src/components/SideNavigation/SideNavigation.tsx +5 -4
- package/src/components/SideNavigation/index.ts +1 -0
- package/src/components/SideNavigation/types.ts +16 -0
- package/src/components/SiteFooter/SiteFooter.tsx +7 -6
- package/src/components/SiteFooter/index.ts +1 -0
- package/src/components/SiteFooter/types.ts +20 -0
- package/src/components/SiteHeader/SiteHeader.stories.tsx +7 -6
- package/src/components/SiteHeader/SiteHeader.test.tsx +3 -3
- package/src/components/SiteHeader/SiteHeader.tsx +11 -10
- package/src/components/SiteHeader/index.ts +1 -0
- package/src/components/SiteHeader/types.ts +22 -0
- package/src/components/SiteNavigation/SiteNavigation.tsx +4 -2
- package/src/components/SiteNavigation/index.ts +1 -0
- package/src/components/SiteNavigation/types.ts +11 -0
- package/src/components/SiteSearch/SiteSearch.stories.tsx +4 -2
- package/src/components/SiteSearch/SiteSearch.tsx +7 -6
- package/src/components/SiteSearch/index.ts +1 -0
- package/src/components/SiteSearch/types.ts +13 -0
- package/src/components/SkipLinks/SkipLinks.stories.tsx +3 -3
- package/src/components/SkipLinks/SkipLinks.tsx +4 -4
- package/src/components/SkipLinks/index.ts +1 -0
- package/src/components/SkipLinks/types.ts +9 -0
- package/src/components/SummaryCard/SummaryCard.stories.tsx +1 -1
- package/src/components/SummaryCard/SummaryCard.test.tsx +2 -13
- package/src/components/SummaryCard/SummaryCard.tsx +6 -4
- package/src/components/SummaryCard/index.ts +1 -0
- package/src/components/SummaryCard/types.ts +6 -0
- package/src/components/SummaryList/SummaryList.Item.stories.tsx +5 -5
- package/src/components/SummaryList/SummaryList.stories.tsx +1 -1
- package/src/components/SummaryList/SummaryList.test.tsx +1 -6
- package/src/components/SummaryList/SummaryList.tsx +8 -6
- package/src/components/SummaryList/index.ts +1 -0
- package/src/components/SummaryList/types.ts +7 -0
- package/src/components/Table/Table.tsx +3 -2
- package/src/components/Table/index.ts +1 -0
- package/src/components/Table/types.ts +6 -0
- package/src/components/Tabs/Tabs.Item.stories.tsx +7 -7
- package/src/components/Tabs/Tabs.stories.tsx +3 -3
- package/src/components/Tabs/Tabs.tsx +7 -5
- package/src/components/Tabs/index.ts +1 -0
- package/src/components/Tabs/types.ts +19 -0
- package/src/components/Tag/Tag.tsx +3 -1
- package/src/components/Tag/index.ts +1 -0
- package/src/components/Tag/types.ts +5 -0
- package/src/components/TaskList/TaskList.Group.stories.tsx +0 -5
- package/src/components/TaskList/TaskList.stories.tsx +0 -1
- package/src/components/TaskList/TaskList.tsx +13 -10
- package/src/components/TaskList/index.ts +1 -0
- package/src/components/TaskList/types.ts +20 -0
- package/src/components/TextInput/TextInput.tsx +8 -8
- package/src/components/TextInput/index.ts +1 -0
- package/src/components/TextInput/types.ts +12 -0
- package/src/components/Textarea/Textarea.tsx +7 -6
- package/src/components/Textarea/index.ts +1 -0
- package/src/components/WarningText/WarningText.tsx +1 -1
- package/src/components/WarningText/index.ts +1 -0
- package/src/components/index.ts +46 -0
- package/src/hooks/index.ts +1 -0
- package/src/hooks/useTracking/index.ts +1 -0
- package/src/hooks/{useTracking.test.tsx → useTracking/useTracking.test.tsx} +5 -7
- package/src/hooks/{useTracking.ts → useTracking/useTracking.ts} +1 -1
- package/src/images/icons/arrow_upward.tsx +10 -10
- package/src/images/icons/calendar_today.tsx +10 -10
- package/src/images/icons/cancel.tsx +8 -8
- package/src/images/icons/check_circle.tsx +10 -10
- package/src/images/icons/chevron_left.tsx +10 -10
- package/src/images/icons/chevron_right.tsx +10 -10
- package/src/images/icons/close.tsx +10 -10
- package/src/images/icons/description.tsx +10 -10
- package/src/images/icons/double_chevron_left.tsx +8 -8
- package/src/images/icons/double_chevron_right.tsx +8 -8
- package/src/images/icons/error.tsx +10 -10
- package/src/images/icons/expand_less.tsx +10 -10
- package/src/images/icons/expand_more.tsx +10 -10
- package/src/images/icons/list.tsx +13 -13
- package/src/images/icons/menu.tsx +10 -10
- package/src/images/icons/priority_high.tsx +11 -11
- package/src/images/icons/search.tsx +10 -10
- package/src/images/index.ts +2 -0
- package/src/index.ts +4 -0
- package/src/shared-types.ts +40 -0
- package/vite.config.ts +4 -2
- package/@types/common/AbstractNotificationBanner.d.ts +0 -17
- package/@types/common/ActionLink.d.ts +0 -8
- package/@types/common/ConditionalWrapper.d.ts +0 -6
- package/@types/common/FileIcon.d.ts +0 -7
- package/@types/common/HintText.d.ts +0 -6
- package/@types/common/Icon.d.ts +0 -9
- package/@types/common/ScreenReaderText.d.ts +0 -4
- package/@types/common/WrapperTag.d.ts +0 -5
- package/@types/components/Accordion.d.ts +0 -15
- package/@types/components/AspectBox.d.ts +0 -5
- package/@types/components/BackToTop.d.ts +0 -5
- package/@types/components/Breadcrumbs.d.ts +0 -11
- package/@types/components/Button.d.ts +0 -17
- package/@types/components/ButtonGroup.d.ts +0 -5
- package/@types/components/CategoryItem.d.ts +0 -10
- package/@types/components/CategoryList.d.ts +0 -7
- package/@types/components/Checkbox.d.ts +0 -11
- package/@types/components/ConfirmationMessage.d.ts +0 -7
- package/@types/components/ContentsNav.d.ts +0 -13
- package/@types/components/DatePicker.d.ts +0 -20
- package/@types/components/Details.d.ts +0 -6
- package/@types/components/ErrorMessage.d.ts +0 -5
- package/@types/components/ErrorSummary.d.ts +0 -12
- package/@types/components/FileDownload.d.ts +0 -11
- package/@types/components/HideThisPage.d.ts +0 -5
- package/@types/components/InsetText.d.ts +0 -5
- package/@types/components/Metadata.d.ts +0 -11
- package/@types/components/NotificationPanel.d.ts +0 -7
- package/@types/components/PageHeader.d.ts +0 -7
- package/@types/components/Pagination.d.ts +0 -22
- package/@types/components/PhaseBanner.d.ts +0 -5
- package/@types/components/Question.d.ts +0 -11
- package/@types/components/RadioButton.d.ts +0 -14
- package/@types/components/SearchFacets.d.ts +0 -18
- package/@types/components/SearchFilters.d.ts +0 -14
- package/@types/components/SearchResult.d.ts +0 -30
- package/@types/components/SearchSort.d.ts +0 -9
- package/@types/components/Select.d.ts +0 -7
- package/@types/components/SequentialNavigation.d.ts +0 -14
- package/@types/components/SideNavigation.d.ts +0 -18
- package/@types/components/SiteFooter.d.ts +0 -25
- package/@types/components/SiteHeader.d.ts +0 -20
- package/@types/components/SiteNavigation.d.ts +0 -13
- package/@types/components/SiteSearch.d.ts +0 -14
- package/@types/components/SkipLinks.d.ts +0 -13
- package/@types/components/SummaryCard.d.ts +0 -6
- package/@types/components/SummaryList.d.ts +0 -14
- package/@types/components/Table.d.ts +0 -8
- package/@types/components/Tabs.d.ts +0 -21
- package/@types/components/Tag.d.ts +0 -5
- package/@types/components/TaskList.d.ts +0 -22
- package/@types/components/TextInput.d.ts +0 -12
- package/@types/components/Textarea.d.ts +0 -4
- package/@types/components/WarningText.d.ts +0 -5
- package/@types/global.d.ts +0 -1
- package/@types/sgds.d.ts +0 -49
- package/dist/tsconfig.tsbuildinfo +0 -1
- package/src/common/ConditionalWrapper.tsx +0 -9
- /package/src/common/{ActionLink.test.tsx → ActionLink/ActionLink.test.tsx} +0 -0
- /package/src/common/{ConditionalWrapper.test.tsx → ConditionalWrapper/ConditionalWrapper.test.tsx} +0 -0
- /package/src/common/{FileIcon.test.tsx → FileIcon/FileIcon.test.tsx} +0 -0
- /package/src/common/{Icon.test.tsx → Icon/Icon.test.tsx} +0 -0
- /package/src/common/{ScreenReaderText.test.tsx → ScreenReaderText/ScreenReaderText.test.tsx} +0 -0
- /package/src/common/{WrapperTag.test.tsx → WrapperTag/WrapperTag.test.tsx} +0 -0
- /package/src/components/{ButtonGroup → Button}/ButtonGroup.test.tsx +0 -0
|
@@ -2,8 +2,8 @@ import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
|
2
2
|
import argTypes from '../../../.storybook/sgdsArgTypes';
|
|
3
3
|
|
|
4
4
|
import Filters from './SearchFilters';
|
|
5
|
-
import DatePicker from '../DatePicker
|
|
6
|
-
import Checkbox from '../Checkbox
|
|
5
|
+
import DatePicker from '../DatePicker';
|
|
6
|
+
import Checkbox from '../Checkbox';
|
|
7
7
|
|
|
8
8
|
const meta = {
|
|
9
9
|
title: 'Components/Search results/Filters/Filter panel',
|
|
@@ -39,12 +39,22 @@ const meta = {
|
|
|
39
39
|
name: 'number'
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
|
+
},
|
|
43
|
+
args: {
|
|
44
|
+
heading: 'Filter',
|
|
45
|
+
legend: 'Select which publication types you would like to see'
|
|
42
46
|
}
|
|
43
47
|
} satisfies Meta<typeof Filters.Panel>;
|
|
44
48
|
|
|
45
49
|
export default meta;
|
|
46
50
|
type Story = StoryObj<typeof meta>;
|
|
47
51
|
|
|
52
|
+
type ContentTypeType = {
|
|
53
|
+
label: string;
|
|
54
|
+
value: string;
|
|
55
|
+
checked?: boolean;
|
|
56
|
+
};
|
|
57
|
+
|
|
48
58
|
const CONTENT_TYPES = [
|
|
49
59
|
{
|
|
50
60
|
label: 'Advice and guidance',
|
|
@@ -134,7 +144,7 @@ CONTENT_TYPES_WITH_SELECTED[4].checked = true;
|
|
|
134
144
|
CONTENT_TYPES_WITH_SELECTED[7].checked = true;
|
|
135
145
|
|
|
136
146
|
export const Default: Story = {
|
|
137
|
-
render: (
|
|
147
|
+
render: () => (
|
|
138
148
|
<Filters.Panel
|
|
139
149
|
heading="Filter by date"
|
|
140
150
|
legend="Filter by date"
|
|
@@ -155,12 +165,12 @@ export const Default: Story = {
|
|
|
155
165
|
};
|
|
156
166
|
|
|
157
167
|
export const Scrollable: Story = {
|
|
158
|
-
render: (args
|
|
168
|
+
render: ({ ...args }) => (
|
|
159
169
|
<Filters.Panel
|
|
170
|
+
{...args}
|
|
160
171
|
heading="Content type"
|
|
161
172
|
isScrollable
|
|
162
173
|
legend="Select which publication types you would like to see"
|
|
163
|
-
{...args}
|
|
164
174
|
>
|
|
165
175
|
<Filters.CheckboxGroup>
|
|
166
176
|
{CONTENT_TYPES.map((type) => (
|
|
@@ -177,16 +187,17 @@ export const Scrollable: Story = {
|
|
|
177
187
|
};
|
|
178
188
|
|
|
179
189
|
export const WithActiveFilterCount: Story = {
|
|
180
|
-
|
|
190
|
+
args: {},
|
|
191
|
+
render: ({ ...args }) => (
|
|
181
192
|
<Filters.Panel
|
|
182
|
-
|
|
193
|
+
{...args}
|
|
194
|
+
activeFilterCount={CONTENT_TYPES_WITH_SELECTED.filter((item: ContentTypeType) => item.checked).length}
|
|
183
195
|
heading="Content type"
|
|
184
196
|
isScrollable
|
|
185
197
|
legend="Select which publication types you would like to see"
|
|
186
|
-
{...args}
|
|
187
198
|
>
|
|
188
199
|
<Filters.CheckboxGroup>
|
|
189
|
-
{CONTENT_TYPES_WITH_SELECTED.map((type:
|
|
200
|
+
{CONTENT_TYPES_WITH_SELECTED.map((type: ContentTypeType) => (
|
|
190
201
|
<Checkbox
|
|
191
202
|
checked={type.checked || false}
|
|
192
203
|
key={type.value}
|
|
@@ -2,8 +2,8 @@ import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
|
2
2
|
import argTypes from '../../../.storybook/sgdsArgTypes';
|
|
3
3
|
|
|
4
4
|
import Filters from './SearchFilters';
|
|
5
|
-
import DatePicker from '../DatePicker
|
|
6
|
-
import Checkbox from '../Checkbox
|
|
5
|
+
import DatePicker from '../DatePicker';
|
|
6
|
+
import Checkbox from '../Checkbox';
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
const meta = {
|
|
@@ -104,7 +104,7 @@ const CONTENT_TYPES = [
|
|
|
104
104
|
];
|
|
105
105
|
|
|
106
106
|
export const Default: Story = {
|
|
107
|
-
render: (args
|
|
107
|
+
render: ({ ...args }) => (
|
|
108
108
|
<Filters {...args}>
|
|
109
109
|
<Filters.Panel legend="Select which publication types you would like to see" heading="Content type">
|
|
110
110
|
<Filters.CheckboxGroup>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { test, expect } from 'vitest';
|
|
2
2
|
import { render, screen, within } from '@testing-library/react';
|
|
3
3
|
import Filters from './SearchFilters';
|
|
4
|
-
import Checkbox from '../Checkbox
|
|
4
|
+
import Checkbox from '../Checkbox';
|
|
5
5
|
|
|
6
6
|
test('search filters boilerplate renders correctly', () => {
|
|
7
7
|
render(
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import Accordion from "../Accordion
|
|
2
|
-
import Button from "../Button
|
|
3
|
-
import SkipLinks from "../SkipLinks
|
|
1
|
+
import Accordion from "../Accordion";
|
|
2
|
+
import Button from "../Button";
|
|
3
|
+
import SkipLinks from "../SkipLinks";
|
|
4
4
|
import ConditionalWrapper from "../../common/ConditionalWrapper";
|
|
5
|
-
import CheckboxGroup from "../Checkbox
|
|
5
|
+
import { CheckboxGroup } from "../Checkbox";
|
|
6
|
+
import { SearchFiltersPanelProps, SearchFiltersCheckboxGroupProps, SearchFiltersProps } from "./types";
|
|
6
7
|
|
|
7
8
|
export const FilterPanel = ({
|
|
8
9
|
activeFilterCount = 0,
|
|
@@ -11,7 +12,7 @@ export const FilterPanel = ({
|
|
|
11
12
|
legend,
|
|
12
13
|
heading = 'Filter',
|
|
13
14
|
...props
|
|
14
|
-
}:
|
|
15
|
+
}: SearchFiltersPanelProps) => {
|
|
15
16
|
const headingWithCount = <>
|
|
16
17
|
{heading}
|
|
17
18
|
{activeFilterCount > 0 && <div className="ds_search-filters__filter-count">({activeFilterCount} selected)</div>}
|
|
@@ -36,7 +37,7 @@ export const FilterPanel = ({
|
|
|
36
37
|
const FilterCheckboxGroup = ({
|
|
37
38
|
children,
|
|
38
39
|
...props
|
|
39
|
-
}:
|
|
40
|
+
}: SearchFiltersCheckboxGroupProps) => {
|
|
40
41
|
return (
|
|
41
42
|
<CheckboxGroup
|
|
42
43
|
className="ds_search-filters__checkboxes"
|
|
@@ -52,7 +53,7 @@ const Filters = ({
|
|
|
52
53
|
children,
|
|
53
54
|
searchResultsContainerId = 'search-results',
|
|
54
55
|
...props
|
|
55
|
-
}:
|
|
56
|
+
}: SearchFiltersProps) => {
|
|
56
57
|
return (
|
|
57
58
|
<div className="ds_search-filters" {...props}>
|
|
58
59
|
<div className="ds_details ds_no-margin" data-module="ds-details">
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './SearchFilters';
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export interface SearchFiltersPanelProps extends React.AllHTMLAttributes<HTMLElement> {
|
|
2
|
+
activeFilterCount?: number;
|
|
3
|
+
heading: string | React.ReactNode;
|
|
4
|
+
isScrollable?: boolean;
|
|
5
|
+
legend: string;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export interface SearchFiltersCheckboxGroupProps {
|
|
9
|
+
children: React.ReactNode,
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export interface SearchFiltersProps extends React.AllHTMLAttributes<HTMLElement> {
|
|
13
|
+
searchResultsContainerId?: string;
|
|
14
|
+
}
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
2
|
import argTypes from '../../../.storybook/sgdsArgTypes';
|
|
3
|
-
|
|
4
3
|
import SearchResult from './SearchResult';
|
|
5
|
-
|
|
6
|
-
//@ts-ignore
|
|
4
|
+
// @ts-expect-error no types
|
|
7
5
|
import coo from '../../../static/images/highland-cow.jpg';
|
|
8
6
|
|
|
9
7
|
const meta = {
|
|
@@ -13,7 +11,8 @@ const meta = {
|
|
|
13
11
|
children: argTypes.children()
|
|
14
12
|
},
|
|
15
13
|
args: {
|
|
16
|
-
title: '
|
|
14
|
+
title: 'Greenhouse gas statistics 1990-2022',
|
|
15
|
+
href: '#foo'
|
|
17
16
|
}
|
|
18
17
|
} satisfies Meta<typeof SearchResult>;
|
|
19
18
|
|
|
@@ -22,7 +21,7 @@ type Story = StoryObj<typeof meta>;
|
|
|
22
21
|
|
|
23
22
|
export const Default: Story = {
|
|
24
23
|
render: (args) => (
|
|
25
|
-
<SearchResult
|
|
24
|
+
<SearchResult {...args}>
|
|
26
25
|
<SearchResult.Content>
|
|
27
26
|
Official statistics showing emissions of greenhouse gases in Scotland over the period 1990 to 2022.
|
|
28
27
|
</SearchResult.Content>
|
|
@@ -32,7 +31,7 @@ export const Default: Story = {
|
|
|
32
31
|
|
|
33
32
|
export const Metadata: Story = {
|
|
34
33
|
render: (args) => (
|
|
35
|
-
<SearchResult
|
|
34
|
+
<SearchResult {...args}>
|
|
36
35
|
<SearchResult.Content>
|
|
37
36
|
Official statistics showing emissions of greenhouse gases in Scotland over the period 1990 to 2022.
|
|
38
37
|
</SearchResult.Content>
|
|
@@ -50,7 +49,7 @@ export const Metadata: Story = {
|
|
|
50
49
|
|
|
51
50
|
export const Context: Story = {
|
|
52
51
|
render: (args) => (
|
|
53
|
-
<SearchResult
|
|
52
|
+
<SearchResult {...args}>
|
|
54
53
|
<SearchResult.Content>
|
|
55
54
|
Official statistics showing emissions of greenhouse gases in Scotland over the period 1990 to 2022.
|
|
56
55
|
</SearchResult.Content>
|
|
@@ -64,7 +63,7 @@ export const Context: Story = {
|
|
|
64
63
|
|
|
65
64
|
export const Media: Story = {
|
|
66
65
|
render: (args) => (
|
|
67
|
-
<SearchResult
|
|
66
|
+
<SearchResult {...args}>
|
|
68
67
|
<SearchResult.Content>
|
|
69
68
|
<SearchResult.Media>
|
|
70
69
|
<img src={coo} alt="" />
|
|
@@ -77,7 +76,7 @@ export const Media: Story = {
|
|
|
77
76
|
|
|
78
77
|
export const Promoted: Story = {
|
|
79
78
|
render: (args) => (
|
|
80
|
-
<SearchResult isPromoted
|
|
79
|
+
<SearchResult isPromoted {...args}>
|
|
81
80
|
<SearchResult.Content>
|
|
82
81
|
Official statistics showing emissions of greenhouse gases in Scotland over the period 1990 to 2022.
|
|
83
82
|
</SearchResult.Content>
|
|
@@ -87,7 +86,7 @@ export const Promoted: Story = {
|
|
|
87
86
|
|
|
88
87
|
export const KitchenSink: Story = {
|
|
89
88
|
render: (args) => (
|
|
90
|
-
<SearchResult isPromoted
|
|
89
|
+
<SearchResult isPromoted {...args}>
|
|
91
90
|
<SearchResult.Content>
|
|
92
91
|
<SearchResult.Media>
|
|
93
92
|
<img src={coo} alt="" />
|
|
@@ -1,19 +1,20 @@
|
|
|
1
1
|
import { Children, createContext, useContext } from 'react';
|
|
2
2
|
import ConditionalWrapper from '../../common/ConditionalWrapper';
|
|
3
|
-
import AspectBox from '../AspectBox
|
|
4
|
-
import Metadata from '../PageMetadata
|
|
3
|
+
import AspectBox from '../AspectBox';
|
|
4
|
+
import Metadata from '../PageMetadata';
|
|
5
|
+
import { SearchResultContextProps, SearchResultProps } from './types';
|
|
5
6
|
|
|
6
7
|
const SearchResultLinkHrefContext = createContext('');
|
|
7
8
|
|
|
8
9
|
const SearchResultContent = ({
|
|
9
10
|
children
|
|
10
|
-
}:
|
|
11
|
-
const otherChildren:
|
|
11
|
+
}: React.AllHTMLAttributes<HTMLElement>) => {
|
|
12
|
+
const otherChildren: React.ReactNode[] = [];
|
|
12
13
|
let imageChild: React.ReactNode = null;
|
|
13
14
|
|
|
14
15
|
// assign to slots
|
|
15
16
|
Children.forEach(children, (child: React.ReactNode) => {
|
|
16
|
-
const thisChild = child as React.
|
|
17
|
+
const thisChild = child as React.JSX.Element;
|
|
17
18
|
if (thisChild && thisChild.type === SearchResultMedia) {
|
|
18
19
|
imageChild = thisChild;
|
|
19
20
|
} else {
|
|
@@ -37,7 +38,7 @@ const SearchResultContent = ({
|
|
|
37
38
|
const SearchResultContext = ({
|
|
38
39
|
children,
|
|
39
40
|
title = 'Part of'
|
|
40
|
-
}:
|
|
41
|
+
}: SearchResultContextProps) => {
|
|
41
42
|
return (
|
|
42
43
|
<dl className="ds_search-result__context">
|
|
43
44
|
<dt className="ds_search-result__context-key">{title}:</dt>
|
|
@@ -48,7 +49,7 @@ const SearchResultContext = ({
|
|
|
48
49
|
|
|
49
50
|
const SearchResultContextItem = ({
|
|
50
51
|
children
|
|
51
|
-
}:
|
|
52
|
+
}: React.AllHTMLAttributes<HTMLElement>) => {
|
|
52
53
|
return (
|
|
53
54
|
<dd className="ds_search-result__context-value">
|
|
54
55
|
{children}
|
|
@@ -58,7 +59,7 @@ const SearchResultContextItem = ({
|
|
|
58
59
|
|
|
59
60
|
const SearchResultMedia = ({
|
|
60
61
|
children
|
|
61
|
-
}:
|
|
62
|
+
}: React.AllHTMLAttributes<HTMLElement>) => {
|
|
62
63
|
return (
|
|
63
64
|
<div className="ds_search-result__media-wrapper">
|
|
64
65
|
<a className="ds_search-result__media-link" href={useContext(SearchResultLinkHrefContext)} tabIndex={-1} aria-hidden="true">
|
|
@@ -72,7 +73,7 @@ const SearchResultMedia = ({
|
|
|
72
73
|
|
|
73
74
|
const SearchResultMeta = ({
|
|
74
75
|
children
|
|
75
|
-
}:
|
|
76
|
+
}: React.AllHTMLAttributes<HTMLElement>) => {
|
|
76
77
|
return (
|
|
77
78
|
<Metadata className="ds_search-result__metadata" isInline>
|
|
78
79
|
{children}
|
|
@@ -88,7 +89,7 @@ const SearchResult = ({
|
|
|
88
89
|
promotedTitle = 'Recommended',
|
|
89
90
|
title,
|
|
90
91
|
...props
|
|
91
|
-
}:
|
|
92
|
+
}: SearchResultProps) => {
|
|
92
93
|
const LINK_CLASS = 'ds_search-result__link';
|
|
93
94
|
|
|
94
95
|
return (
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './SearchResult';
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { LinkComponent } from "../../shared-types";
|
|
2
|
+
|
|
3
|
+
export interface SearchResultContextProps extends React.AllHTMLAttributes<HTMLDListElement> {
|
|
4
|
+
title: string;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export interface SearchResultProps extends React.AllHTMLAttributes<HTMLElement> {
|
|
8
|
+
href: string;
|
|
9
|
+
isPromoted?: boolean;
|
|
10
|
+
linkComponent?: LinkComponent;
|
|
11
|
+
promotedTitle?: string;
|
|
12
|
+
title: string;
|
|
13
|
+
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { AllHTMLAttributes } from "react";
|
|
2
|
-
import Button from "../Button
|
|
3
|
-
import Select from "../Select
|
|
2
|
+
import Button from "../Button";
|
|
3
|
+
import Select from "../Select";
|
|
4
|
+
import { SearchSortProps } from "./types";
|
|
4
5
|
|
|
5
6
|
const Option = ({
|
|
6
7
|
children,
|
|
@@ -20,7 +21,7 @@ const SearchSort = ({
|
|
|
20
21
|
label = 'Sort by',
|
|
21
22
|
onApply,
|
|
22
23
|
...props
|
|
23
|
-
}:
|
|
24
|
+
}: SearchSortProps) => {
|
|
24
25
|
return (
|
|
25
26
|
<div
|
|
26
27
|
className={[
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './SearchSort';
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import ErrorMessage from '../ErrorMessage
|
|
1
|
+
import ErrorMessage from '../ErrorMessage';
|
|
2
2
|
import HintText from '../../common/HintText';
|
|
3
|
+
import { SelectProps } from './types';
|
|
3
4
|
|
|
4
5
|
const Select = function ({
|
|
5
6
|
children,
|
|
@@ -16,7 +17,7 @@ const Select = function ({
|
|
|
16
17
|
placeholder,
|
|
17
18
|
width,
|
|
18
19
|
...props
|
|
19
|
-
}:
|
|
20
|
+
}: SelectProps) {
|
|
20
21
|
const errorMessageId = `error-message-${id}`;
|
|
21
22
|
const hintTextId = `hint-text-${id}`;
|
|
22
23
|
const describedbys: string[] = [];
|
|
@@ -24,13 +25,13 @@ const Select = function ({
|
|
|
24
25
|
if (hintText) { describedbys.push(hintTextId) };
|
|
25
26
|
if (errorMessage) { describedbys.push(errorMessageId) };
|
|
26
27
|
|
|
27
|
-
function handleBlur(event: React.FocusEvent) {
|
|
28
|
+
function handleBlur(event: React.FocusEvent<HTMLSelectElement>) {
|
|
28
29
|
if (typeof onBlur === 'function') {
|
|
29
30
|
onBlur(event);
|
|
30
31
|
}
|
|
31
32
|
}
|
|
32
33
|
|
|
33
|
-
function handleChange(event: React.ChangeEvent) {
|
|
34
|
+
function handleChange(event: React.ChangeEvent<HTMLSelectElement>) {
|
|
34
35
|
if (typeof onChange === 'function') {
|
|
35
36
|
onChange(event);
|
|
36
37
|
}
|
|
@@ -39,7 +40,7 @@ const Select = function ({
|
|
|
39
40
|
return (
|
|
40
41
|
<>
|
|
41
42
|
<label className="ds_label" htmlFor={id}>{label}</label>
|
|
42
|
-
{hintText && <HintText id={hintTextId}
|
|
43
|
+
{hintText && <HintText id={hintTextId}>{hintText}</HintText>}
|
|
43
44
|
{errorMessage && <ErrorMessage id={errorMessageId}>{errorMessage}</ErrorMessage>}
|
|
44
45
|
<div
|
|
45
46
|
className={[
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './Select';
|
|
@@ -1,10 +1,12 @@
|
|
|
1
|
+
import { SequentialNavigationLinkProps, SequentialNavigationProps } from "./types";
|
|
2
|
+
|
|
1
3
|
const SeqNavLink = ({
|
|
2
4
|
children,
|
|
3
5
|
href,
|
|
4
6
|
isPrev,
|
|
5
7
|
linkComponent,
|
|
6
8
|
textLabel
|
|
7
|
-
}:
|
|
9
|
+
}:SequentialNavigationLinkProps) => {
|
|
8
10
|
const LINK_CLASSES = [
|
|
9
11
|
'ds_sequential-nav__button',
|
|
10
12
|
isPrev ? 'ds_sequential-nav__button--left' : 'ds_sequential-nav__button--right'
|
|
@@ -39,7 +41,7 @@ const NextLink = ({
|
|
|
39
41
|
href,
|
|
40
42
|
linkComponent,
|
|
41
43
|
textLabel = 'Next'
|
|
42
|
-
}:
|
|
44
|
+
}: SequentialNavigationLinkProps) => {
|
|
43
45
|
return <SeqNavLink href={href} linkComponent={linkComponent} textLabel={textLabel}>{children}</SeqNavLink>
|
|
44
46
|
};
|
|
45
47
|
|
|
@@ -48,7 +50,7 @@ const PreviousLink = ({
|
|
|
48
50
|
href,
|
|
49
51
|
linkComponent,
|
|
50
52
|
textLabel = 'Previous'
|
|
51
|
-
}:
|
|
53
|
+
}: SequentialNavigationLinkProps) => {
|
|
52
54
|
return <SeqNavLink href={href} linkComponent={linkComponent} textLabel={textLabel} isPrev>{children}</SeqNavLink>
|
|
53
55
|
};
|
|
54
56
|
|
|
@@ -57,7 +59,7 @@ const SequentialNavigation = ({
|
|
|
57
59
|
children,
|
|
58
60
|
className,
|
|
59
61
|
...props
|
|
60
|
-
}:
|
|
62
|
+
}: SequentialNavigationProps) => {
|
|
61
63
|
return (
|
|
62
64
|
<nav
|
|
63
65
|
className={[
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './SequentialNavigation';
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { LinkComponent } from "../../shared-types";
|
|
2
|
+
|
|
3
|
+
export interface SequentialNavigationLinkProps extends React.AllHTMLAttributes<HTMLDivElement> {
|
|
4
|
+
href: string;
|
|
5
|
+
isPrev?: boolean;
|
|
6
|
+
linkComponent?: LinkComponent;
|
|
7
|
+
textLabel?: string;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export interface SequentialNavigationProps extends React.AllHTMLAttributes<HTMLElement> {
|
|
11
|
+
ariaLabel?: React.AriaAttributes['aria-label'];
|
|
12
|
+
}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { useEffect, useRef } from 'react';
|
|
2
|
-
// @ts-
|
|
2
|
+
// @ts-expect-error no types from core SGDS
|
|
3
3
|
import DSSideNavigation from '@scottish-government/design-system/src/components/side-navigation/side-navigation';
|
|
4
|
+
import { SideNavigationItemProps, SideNavigationListProps, SideNavigationProps } from './types';
|
|
4
5
|
|
|
5
6
|
const SideNavigationList = function ({
|
|
6
7
|
children,
|
|
7
8
|
isRoot
|
|
8
|
-
}:
|
|
9
|
+
}: SideNavigationListProps) {
|
|
9
10
|
return (
|
|
10
11
|
<ul className="ds_side-navigation__list"
|
|
11
12
|
id={isRoot ? 'side-navigation-root' : undefined }
|
|
@@ -21,7 +22,7 @@ const SideNavigationItem = function ({
|
|
|
21
22
|
isCurrent = false,
|
|
22
23
|
linkComponent,
|
|
23
24
|
title
|
|
24
|
-
}:
|
|
25
|
+
}: SideNavigationItemProps) {
|
|
25
26
|
const LINK_CLASS = 'ds_side-navigation__link';
|
|
26
27
|
|
|
27
28
|
return (
|
|
@@ -47,7 +48,7 @@ const SideNavigation = function ({
|
|
|
47
48
|
children,
|
|
48
49
|
className,
|
|
49
50
|
...props
|
|
50
|
-
}:
|
|
51
|
+
}: SideNavigationProps) {
|
|
51
52
|
const ref = useRef(null);
|
|
52
53
|
|
|
53
54
|
useEffect(() => {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './SideNavigation';
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { LinkComponent } from "../../shared-types";
|
|
2
|
+
|
|
3
|
+
export interface SideNavigationListProps extends React.AllHTMLAttributes<HTMLUListElement> {
|
|
4
|
+
isRoot?: boolean;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export interface SideNavigationItemProps extends React.AllHTMLAttributes<HTMLLIElement> {
|
|
8
|
+
isCurrent?: boolean;
|
|
9
|
+
href: string;
|
|
10
|
+
linkComponent?: LinkComponent;
|
|
11
|
+
title: string;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export interface SideNavigationProps extends React.AllHTMLAttributes<HTMLElement> {
|
|
15
|
+
ariaLabel?: string;
|
|
16
|
+
}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import React, { Children } from 'react';
|
|
2
2
|
import ConditionalWrapper from '../../common/ConditionalWrapper';
|
|
3
|
+
import { SiteFooterLicenseProps, SiteFooterLinkProps, SiteFooterOrgProps, SiteFooterProps } from './types';
|
|
3
4
|
|
|
4
5
|
const License = ({
|
|
5
6
|
children,
|
|
6
7
|
...props
|
|
7
|
-
}:
|
|
8
|
+
}: SiteFooterLicenseProps) => {
|
|
8
9
|
return (
|
|
9
10
|
<div className="ds_site-footer__copyright" {...props}>
|
|
10
11
|
{children}
|
|
@@ -15,7 +16,7 @@ const License = ({
|
|
|
15
16
|
const Links = ({
|
|
16
17
|
children,
|
|
17
18
|
...props
|
|
18
|
-
}:
|
|
19
|
+
}: React.AllHTMLAttributes<HTMLUListElement>) => {
|
|
19
20
|
return (
|
|
20
21
|
<ul className="ds_site-footer__site-items" {...props}>
|
|
21
22
|
{children}
|
|
@@ -28,7 +29,7 @@ const Link = ({
|
|
|
28
29
|
href,
|
|
29
30
|
linkComponent,
|
|
30
31
|
...props
|
|
31
|
-
}:
|
|
32
|
+
}: SiteFooterLinkProps) => {
|
|
32
33
|
function processChildren(children: React.ReactNode) {
|
|
33
34
|
if (linkComponent) {
|
|
34
35
|
return linkComponent({ href, children });
|
|
@@ -49,9 +50,9 @@ const Org = ({
|
|
|
49
50
|
title,
|
|
50
51
|
children,
|
|
51
52
|
...props
|
|
52
|
-
}:
|
|
53
|
+
}: SiteFooterOrgProps) => {
|
|
53
54
|
children = Children.map(children, child => {
|
|
54
|
-
|
|
55
|
+
const thisChild = child as React.ReactElement<HTMLElement>;
|
|
55
56
|
if (thisChild && ['img', 'svg', 'picture'].includes(thisChild.type as string)) {
|
|
56
57
|
return React.cloneElement(thisChild, { className: 'ds_site-footer__org-logo' });
|
|
57
58
|
} else {
|
|
@@ -75,7 +76,7 @@ const SiteFooter = ({
|
|
|
75
76
|
children,
|
|
76
77
|
className,
|
|
77
78
|
...props
|
|
78
|
-
}:
|
|
79
|
+
}: SiteFooterProps) => {
|
|
79
80
|
return (
|
|
80
81
|
<footer
|
|
81
82
|
className={[
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './SiteFooter';
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { LinkComponent } from "../../shared-types";
|
|
2
|
+
|
|
3
|
+
export interface SiteFooterLinkProps extends React.AllHTMLAttributes<HTMLLIElement> {
|
|
4
|
+
href?: string;
|
|
5
|
+
linkComponent?: LinkComponent;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export interface SiteFooterLicenseProps extends React.AllHTMLAttributes<HTMLDivElement> {
|
|
9
|
+
href?: string;
|
|
10
|
+
logoSrc?: string;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export interface SiteFooterOrgProps extends React.AllHTMLAttributes<HTMLDivElement> {
|
|
14
|
+
href?: string;
|
|
15
|
+
title: string;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export interface SiteFooterProps extends React.AllHTMLAttributes<HTMLElement> {
|
|
19
|
+
className?: string;
|
|
20
|
+
}
|
|
@@ -2,9 +2,9 @@ import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
|
2
2
|
import argTypes from '../../../.storybook/sgdsArgTypes';
|
|
3
3
|
|
|
4
4
|
import SiteHeader from './SiteHeader';
|
|
5
|
-
import SiteSearch from '../SiteSearch
|
|
6
|
-
import SiteNavigation from '../SiteNavigation
|
|
7
|
-
import PhaseBanner from '../PhaseBanner
|
|
5
|
+
import SiteSearch from '../SiteSearch';
|
|
6
|
+
import SiteNavigation from '../SiteNavigation';
|
|
7
|
+
import PhaseBanner from '../PhaseBanner';
|
|
8
8
|
|
|
9
9
|
const meta = {
|
|
10
10
|
title: 'Components/SiteHeader',
|
|
@@ -17,6 +17,7 @@ const meta = {
|
|
|
17
17
|
<SiteHeader.Brand
|
|
18
18
|
homeUrl="/"
|
|
19
19
|
siteTitle="Design System React"
|
|
20
|
+
key="1"
|
|
20
21
|
>
|
|
21
22
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 206.7 30.7">
|
|
22
23
|
<title>The Scottish Government</title>
|
|
@@ -26,7 +27,7 @@ const meta = {
|
|
|
26
27
|
<path fill="#333e48" d="M205.1 12.8c.8 0 1.3-.2 1.6-.5l-.4-1.3c-.1.2-.4.3-.8.3-.5 0-.8-.4-.8-1V6.1h1.6V4.6h-1.6V2.3H203v2.2h-1.3V6h1.3v4.7c0 1.4.7 2.1 2.1 2.1m-4.7-.2V6.9c0-1.7-.9-2.6-2.6-2.6-1.3 0-2.3.7-2.9 1.3v-1h-1.8v8.1h1.8V7c.4-.5 1.2-1.1 2.1-1.1 1 0 1.6.4 1.6 1.7v5.1h1.8zm-10.5-4.7h-4.5c.1-1 .8-2.1 2.3-2.1 1.5 0 2.1 1.2 2.2 2.1m-2.2 4.9c1.3 0 2.5-.4 3.3-1.2l-.8-1.2c-.6.6-1.5.9-2.3.9-1.5 0-2.4-1-2.6-2.2h6.2v-.4c0-2.5-1.5-4.4-4-4.4a4 4 0 0 0-4.1 4.2c.1 2.6 1.9 4.3 4.3 4.3m-5.9-.2V6.8c0-1.6-.9-2.4-2.3-2.4-1.2 0-2.3.8-2.7 1.5-.3-.9-1-1.5-2.2-1.5-1.2 0-2.3.8-2.6 1.3V4.6h-1.8v8.1h1.8V7c.4-.5 1.1-1.1 1.9-1.1 1 0 1.3.6 1.3 1.5v5.3h1.8V7c.4-.5 1.1-1.1 1.9-1.1 1 0 1.3.6 1.3 1.5v5.3h1.6zm-13.9 0V6.9c0-1.7-.9-2.6-2.6-2.6-1.3 0-2.3.7-2.9 1.3v-1h-1.8v8.1h1.8V7c.4-.5 1.2-1.1 2.1-1.1 1 0 1.6.4 1.6 1.7v5.1h1.8zm-11.1 0V7.1c.4-.6 1.3-1.1 2.1-1.1h.5V4.4c-1 0-2 .6-2.6 1.4V4.6H155v8.1h1.8zm-5.1-4.7h-4.5c.1-1 .8-2.1 2.3-2.1 1.5 0 2.1 1.2 2.2 2.1m-2.2 4.9c1.3 0 2.5-.4 3.3-1.2l-.8-1.2c-.6.6-1.5.9-2.3.9-1.5 0-2.4-1-2.6-2.2h6.2v-.4c0-2.5-1.5-4.4-4-4.4a4 4 0 0 0-4.1 4.2c.1 2.6 1.9 4.3 4.3 4.3m-7.8-.2 3.3-8.1h-1.9l-2.4 6.1-2.4-6.1h-1.9l3.3 8.1h2zm-9.7-1.3c-1.5 0-2.3-1.3-2.3-2.7 0-1.4.8-2.7 2.3-2.7 1.5 0 2.3 1.3 2.3 2.7 0 1.4-.8 2.7-2.3 2.7m0 1.5c2.6 0 4.1-1.9 4.1-4.2 0-2.3-1.6-4.2-4.1-4.2s-4.1 1.9-4.1 4.2a4 4 0 0 0 4.1 4.2m-10.7 0c3.5 0 5.6-2.4 5.6-6.2h-6.1v1.7h4a3.2 3.2 0 0 1-3.3 2.7c-2.2 0-3.8-1.7-3.8-4 0-2.4 1.6-4 3.8-4 1.2 0 2.3.7 2.9 1.5l1.6-.9a5.2 5.2 0 0 0-4.5-2.3 5.7 5.7 0 0 0-5.9 5.8c0 3.5 2.7 5.7 5.7 5.7m-11.5-.2V6.9c0-1.7-.9-2.6-2.6-2.6-1.3 0-2.3.7-2.8 1.3V1.5h-1.8v11.2h1.8V7c.4-.5 1.2-1.1 2.1-1.1 1 0 1.6.4 1.6 1.6v5.1h1.7zm-12.2.2c2.2 0 3.4-1.1 3.4-2.5 0-3.2-4.9-2.1-4.9-3.6 0-.6.6-1 1.5-1 1 0 1.9.4 2.4 1l.7-1.2a4.8 4.8 0 0 0-3.1-1.1c-2 0-3.2 1.1-3.2 2.4 0 3.1 4.9 2 4.9 3.6 0 .6-.6 1.1-1.6 1.1a4 4 0 0 1-2.7-1.1l-.8 1.3c.8.7 2 1.1 3.4 1.1m-5-8.2h-1.8v8.1h1.8V4.6zm-.9-1c.6 0 1.1-.5 1.1-1.1 0-.6-.5-1.1-1.1-1.1-.6 0-1.1.5-1.1 1.1 0 .6.5 1.1 1.1 1.1M88 12.8c.8 0 1.3-.2 1.6-.5l-.4-1.3c-.1.2-.4.3-.8.3-.5 0-.8-.4-.8-1V6.1h1.6V4.6h-1.6V2.3h-1.8v2.2h-1.3V6h1.3v4.7c.1 1.4.8 2.1 2.2 2.1m-5.6 0c.8 0 1.3-.2 1.6-.5l-.4-1.3c-.1.2-.4.3-.8.3-.5 0-.8-.4-.8-1V6.1h1.6V4.6H82V2.3h-1.8v2.2h-1.3V6h1.3v4.7c.1 1.4.8 2.1 2.2 2.1m-8.3-1.5c-1.5 0-2.3-1.3-2.3-2.7 0-1.4.8-2.7 2.3-2.7 1.5 0 2.3 1.3 2.3 2.7 0 1.4-.8 2.7-2.3 2.7m0 1.5c2.6 0 4.1-1.9 4.1-4.2 0-2.3-1.6-4.2-4.1-4.2-2.6 0-4.1 1.9-4.1 4.2a4 4 0 0 0 4.1 4.2m-8.1 0c1.6 0 2.5-.7 3.1-1.4L68 10.3c-.5.6-1.1 1-1.9 1-1.5 0-2.4-1.1-2.4-2.7s1-2.7 2.4-2.7c.8 0 1.4.3 1.9.9l1.2-1.1c-.6-.7-1.6-1.3-3.2-1.3a4.1 4.1 0 0 0-4.2 4.2c.1 2.4 1.8 4.2 4.2 4.2m-9.7 0c3 0 4.3-1.6 4.3-3.5 0-4.1-6.5-2.9-6.5-4.9.1-.8.8-1.4 1.9-1.4 1.2 0 2.4.4 3.2 1.3l1.1-1.5c-1-1-2.4-1.6-4.2-1.6-2.5 0-4.1 1.4-4.1 3.3 0 4.1 6.5 2.6 6.5 5 0 .8-.6 1.5-2.2 1.5s-2.8-.7-3.5-1.6l-1.1 1.5a6 6 0 0 0 4.6 1.9"/>
|
|
27
28
|
</svg>
|
|
28
29
|
</SiteHeader.Brand>,
|
|
29
|
-
<SiteHeader.Navigation>
|
|
30
|
+
<SiteHeader.Navigation key="2">
|
|
30
31
|
<SiteNavigation>
|
|
31
32
|
<SiteNavigation.Item href="#about">
|
|
32
33
|
About
|
|
@@ -51,10 +52,10 @@ const meta = {
|
|
|
51
52
|
</SiteNavigation.Item>
|
|
52
53
|
</SiteNavigation>
|
|
53
54
|
</SiteHeader.Navigation>,
|
|
54
|
-
<SiteHeader.Search>
|
|
55
|
+
<SiteHeader.Search key="3">
|
|
55
56
|
<SiteSearch id="site-header-search" />
|
|
56
57
|
</SiteHeader.Search>,
|
|
57
|
-
<SiteHeader.Phase>
|
|
58
|
+
<SiteHeader.Phase key="4">
|
|
58
59
|
<PhaseBanner phaseName="Beta">
|
|
59
60
|
This is a new service. Your{' '}
|
|
60
61
|
<a href="#feedback">
|