@scottish-government/designsystem-react 0.8.0 → 0.10.0-beta.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 +20 -0
- package/.storybook/manager.ts +13 -0
- package/.storybook/preview-head.html +1 -0
- package/.storybook/preview.tsx +56 -0
- package/.storybook/sgdsArgTypes.ts +123 -0
- package/.storybook/sgdsTheme.ts +9 -0
- package/.storybook/vitest.setup.ts +7 -0
- package/@types/common/AbstractNotificationBanner.d.ts +2 -2
- package/@types/common/ActionLink.d.ts +1 -1
- package/@types/common/Icon.d.ts +1 -1
- package/@types/components/Accordion.d.ts +2 -3
- package/@types/components/Button.d.ts +5 -5
- package/@types/components/CategoryItem.d.ts +10 -0
- package/@types/components/CategoryList.d.ts +7 -0
- package/@types/components/Checkbox.d.ts +2 -2
- package/@types/components/ContentsNav.d.ts +1 -1
- package/@types/components/DatePicker.d.ts +1 -1
- package/@types/components/ErrorMessage.d.ts +1 -2
- package/@types/components/ErrorSummary.d.ts +1 -1
- package/@types/components/FileDownload.d.ts +2 -2
- package/@types/components/Metadata.d.ts +1 -1
- package/@types/components/Pagination.d.ts +1 -1
- package/@types/components/RadioButton.d.ts +2 -2
- package/@types/components/SideNavigation.d.ts +1 -1
- package/@types/components/SiteNavigation.d.ts +1 -1
- package/@types/components/SummaryList.d.ts +1 -1
- package/@types/components/Tabs.d.ts +3 -3
- package/@types/components/TextInput.d.ts +1 -1
- package/@types/sgds.d.ts +2 -1
- package/CHANGELOG.md +29 -0
- package/dist/common/AbstractNotificationBanner.jsx +4 -4
- package/dist/common/Icon.jsx +2 -2
- package/dist/components/Accordion/Accordion.jsx +8 -7
- package/dist/components/Button/Button.jsx +6 -6
- package/dist/components/CategoryItem/CategoryItem.jsx +35 -0
- package/dist/components/CategoryList/CategoryList.jsx +55 -0
- package/dist/components/Checkbox/Checkbox.jsx +7 -4
- package/dist/components/Checkbox/CheckboxGroup.jsx +5 -11
- package/dist/components/ContentsNav/ContentsNav.jsx +2 -2
- package/dist/components/DatePicker/DatePicker.jsx +1 -1
- package/dist/components/ErrorMessage/ErrorMessage.jsx +3 -3
- package/dist/components/FileDownload/FileDownload.jsx +2 -2
- package/dist/components/NotificationBanner/NotificationBanner.jsx +2 -2
- package/dist/components/PageMetadata/PageMetadata.jsx +4 -4
- package/dist/components/Pagination/Pagination.jsx +4 -4
- package/dist/components/Question/Question.jsx +1 -1
- package/dist/components/RadioButton/RadioButton.jsx +6 -2
- package/dist/components/RadioButton/RadioGroup.jsx +7 -47
- package/dist/components/Select/Select.jsx +1 -1
- package/dist/components/SideNavigation/SideNavigation.jsx +2 -2
- package/dist/components/SiteHeader/SiteHeader.jsx +3 -3
- package/dist/components/SiteNavigation/SiteNavigation.jsx +2 -2
- package/dist/components/SiteSearch/SiteSearch.jsx +1 -1
- package/dist/components/SkipLinks/SkipLinks.jsx +1 -1
- package/dist/components/SummaryList/SummaryList.jsx +3 -3
- package/dist/components/Tabs/Tabs.jsx +6 -7
- package/dist/components/TextInput/TextInput.jsx +5 -5
- package/dist/components/Textarea/Textarea.jsx +1 -1
- package/dist/hooks/useTracking.js +21 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/utils/context.js +5 -0
- package/package.json +15 -4
- package/src/common/AbstractNotificationBanner.test.tsx +1 -1
- package/src/common/AbstractNotificationBanner.tsx +4 -4
- package/src/common/Icon.test.tsx +1 -1
- package/src/common/Icon.tsx +2 -2
- package/src/components/Accordion/Accordion.stories.tsx +111 -0
- package/src/components/Accordion/Accordion.test.tsx +5 -17
- package/src/components/Accordion/Accordion.tsx +11 -10
- package/src/components/AspectBox/AspectBox.stories.tsx +64 -0
- package/src/components/BackToTop/BackToTop.stories.tsx +36 -0
- package/src/components/Breadcrumbs/Breadcrumbs.stories.tsx +49 -0
- package/src/components/Breadcrumbs/Breadcrumbs.test.tsx +0 -1
- package/src/components/Breadcrumbs/Breadcrumbs.tsx +1 -1
- package/src/components/Button/Button.stories.tsx +194 -0
- package/src/components/Button/Button.test.tsx +4 -4
- package/src/components/Button/Button.tsx +9 -9
- package/src/components/CategoryItem/CategoryItem.stories.tsx +55 -0
- package/src/components/CategoryItem/CategoryItem.test.tsx +93 -0
- package/src/components/CategoryItem/CategoryItem.tsx +56 -0
- package/src/components/CategoryList/CategoryList.stories.tsx +65 -0
- package/src/components/CategoryList/CategoryList.test.tsx +59 -0
- package/src/components/CategoryList/CategoryList.tsx +33 -0
- package/src/components/Checkbox/Checkbox.stories.tsx +85 -0
- package/src/components/Checkbox/Checkbox.test.tsx +2 -2
- package/src/components/Checkbox/Checkbox.tsx +11 -6
- package/src/components/Checkbox/CheckboxGroup.stories.tsx +68 -0
- package/src/components/Checkbox/CheckboxGroup.tsx +7 -12
- package/src/components/ConfirmationMessage/ConfirmationMessage.stories.tsx +38 -0
- package/src/components/ContentsNav/ContentsNav.stories.tsx +43 -0
- package/src/components/ContentsNav/ContentsNav.test.tsx +2 -2
- package/src/components/ContentsNav/ContentsNav.tsx +2 -2
- package/src/components/CookieBanner/CookieBanner.stories.tsx +33 -0
- package/src/components/DatePicker/DatePicker.stories.tsx +113 -0
- package/src/components/DatePicker/DatePicker.tsx +1 -1
- package/src/components/Details/Details.stories.tsx +36 -0
- package/src/components/ErrorMessage/ErrorMessage.stories.tsx +19 -0
- package/src/components/ErrorMessage/ErrorMessage.test.tsx +3 -15
- package/src/components/ErrorMessage/ErrorMessage.tsx +1 -3
- package/src/components/ErrorSummary/ErrorSummary.stories.tsx +38 -0
- package/src/components/FileDownload/FileDownload.stories.tsx +75 -0
- package/src/components/FileDownload/FileDownload.test.tsx +1 -1
- package/src/components/FileDownload/FileDownload.tsx +2 -2
- package/src/components/HideThisPage/HideThisPage.stories.tsx +20 -0
- package/src/components/InsetText/InsetText.stories.tsx +21 -0
- package/src/components/NotificationBanner/NotificationBanner.stories.tsx +57 -0
- package/src/components/NotificationBanner/NotificationBanner.test.tsx +1 -1
- package/src/components/NotificationBanner/NotificationBanner.tsx +4 -4
- package/src/components/NotificationPanel/NotificationPanel.stories.tsx +32 -0
- package/src/components/PageHeader/PageHeader.stories.tsx +60 -0
- package/src/components/PageMetadata/PageMetadata.stories.tsx +58 -0
- package/src/components/PageMetadata/PageMetadata.test.tsx +2 -2
- package/src/components/PageMetadata/PageMetadata.tsx +4 -4
- package/src/components/Pagination/Pagination.stories.tsx +69 -0
- package/src/components/Pagination/Pagination.test.tsx +1 -1
- package/src/components/Pagination/Pagination.tsx +4 -4
- package/src/components/PhaseBanner/PhaseBanner.stories.tsx +38 -0
- package/src/components/Question/Question.stories.tsx +78 -0
- package/src/components/Question/Question.tsx +1 -1
- package/src/components/RadioButton/RadioButton.stories.tsx +67 -0
- package/src/components/RadioButton/RadioButton.test.tsx +2 -1
- package/src/components/RadioButton/RadioButton.tsx +9 -3
- package/src/components/RadioButton/RadioGroup.stories.tsx +77 -0
- package/src/components/RadioButton/RadioGroup.test.tsx +2 -2
- package/src/components/RadioButton/RadioGroup.tsx +8 -15
- package/src/components/Select/Select.stories.tsx +76 -0
- package/src/components/Select/Select.tsx +1 -1
- package/src/components/SequentialNavigation/SequentialNavigation.stories.tsx +31 -0
- package/src/components/SideNavigation/SideNavigation.stories.tsx +92 -0
- package/src/components/SideNavigation/SideNavigation.test.tsx +2 -2
- package/src/components/SideNavigation/SideNavigation.tsx +2 -2
- package/src/components/SiteFooter/SiteFooter.stories.tsx +65 -0
- package/src/components/SiteHeader/SiteHeader.stories.tsx +92 -0
- package/src/components/SiteHeader/SiteHeader.tsx +2 -7
- package/src/components/SiteNavigation/SiteNavigation.stories.tsx +45 -0
- package/src/components/SiteNavigation/SiteNavigation.test.tsx +1 -1
- package/src/components/SiteNavigation/SiteNavigation.tsx +2 -2
- package/src/components/SiteSearch/SiteSearch.stories.tsx +81 -0
- package/src/components/SiteSearch/SiteSearch.tsx +1 -1
- package/src/components/SkipLinks/SkipLinks.stories.tsx +57 -0
- package/src/components/SkipLinks/SkipLinks.tsx +1 -1
- package/src/components/SummaryCard/SummaryCard.stories.tsx +46 -0
- package/src/components/SummaryList/SummaryList.stories.tsx +75 -0
- package/src/components/SummaryList/SummaryList.test.tsx +1 -1
- package/src/components/SummaryList/SummaryList.tsx +3 -3
- package/src/components/Table/Table.stories.tsx +96 -0
- package/src/components/Tabs/Tabs.stories.tsx +90 -0
- package/src/components/Tabs/Tabs.test.tsx +6 -8
- package/src/components/Tabs/Tabs.tsx +8 -9
- package/src/components/Tag/Tag.stories.tsx +25 -0
- package/src/components/TaskList/TaskList.stories.tsx +129 -0
- package/src/components/TextInput/TextInput.stories.tsx +123 -0
- package/src/components/TextInput/TextInput.test.tsx +2 -2
- package/src/components/TextInput/TextInput.tsx +5 -5
- package/src/components/Textarea/Textarea.stories.tsx +71 -0
- package/src/components/Textarea/Textarea.tsx +1 -1
- package/src/components/WarningText/WarningText.stories.tsx +21 -0
- package/src/hooks/useTracking.test.tsx +64 -0
- package/src/hooks/useTracking.ts +19 -0
- package/src/utils/context.ts +3 -0
- package/static/data/autocomplete-dummy-data.json +2361 -0
- package/static/images/highland-cow.jpg +0 -0
- package/static/images/scottish-government--min.svg +11 -0
- package/static/images/scottish-government.svg +6 -0
- package/tsconfig.json +3 -2
- package/vite.config.ts +45 -11
- package/vitest-setup.ts +1 -0
- package/vitest.shims.d.ts +1 -0
- package/src/utils/slugify.ts +0 -13
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
|
+
import argTypes from '../../../.storybook/sgdsArgTypes';
|
|
3
|
+
|
|
4
|
+
import SiteFooter from './SiteFooter';
|
|
5
|
+
|
|
6
|
+
const meta = {
|
|
7
|
+
title: 'Components/Site footer',
|
|
8
|
+
component: SiteFooter,
|
|
9
|
+
argTypes: {
|
|
10
|
+
children: argTypes.children()
|
|
11
|
+
},
|
|
12
|
+
args: {
|
|
13
|
+
children: <>
|
|
14
|
+
<SiteFooter.Links>
|
|
15
|
+
<SiteFooter.Link href="#">
|
|
16
|
+
Privacy
|
|
17
|
+
</SiteFooter.Link>
|
|
18
|
+
<SiteFooter.Link href="#">
|
|
19
|
+
Cookies
|
|
20
|
+
</SiteFooter.Link>
|
|
21
|
+
<SiteFooter.Link href="#">
|
|
22
|
+
Accessibility
|
|
23
|
+
</SiteFooter.Link>
|
|
24
|
+
</SiteFooter.Links>
|
|
25
|
+
<SiteFooter.License>
|
|
26
|
+
<svg focusable="false" version="1.1" width="41" height="17" id="ogl-logo" xmlns="http://www.w3.org/2000/svg" x="0px" y="0px"
|
|
27
|
+
viewBox="0 0 852.16 345.09">
|
|
28
|
+
<title>ogl</title>
|
|
29
|
+
<polygon className="fill" points="743.3 251.79 743.3 0.2 653.9 57.2 653.9 341.2 852.16 341.2 852.16 251.79 743.3 251.79"></polygon>
|
|
30
|
+
<path className="fill" d="M599.62,312.56a83.12,83.12,0,1,1,15.26-107.08l75.36-48a172.35,172.35,0,0,0-295.59,7.84A172.61,172.61,0,0,0,244.49,77.59C149.35,77.59,72,155,72,250.14s77.4,172.54,172.54,172.54A172.6,172.6,0,0,0,394.65,335a172.29,172.29,0,0,0,263.9,44.78l34.25,39.07h5.33V264H557ZM244.49,333.28a83.14,83.14,0,1,1,83.14-83.14A83.24,83.24,0,0,1,244.49,333.28Z" transform="translate(-71.95 -77.59)"/>
|
|
31
|
+
</svg>
|
|
32
|
+
<p>
|
|
33
|
+
All content is available under the{' '}
|
|
34
|
+
<a href="https://www.nationalarchives.gov.uk/doc/open-government-licence/version/3/">
|
|
35
|
+
Open Government Licence v3.0
|
|
36
|
+
</a>
|
|
37
|
+
, except for graphic assets and where otherwise stated
|
|
38
|
+
</p>
|
|
39
|
+
<p>
|
|
40
|
+
© Crown Copyright
|
|
41
|
+
</p>
|
|
42
|
+
</SiteFooter.License>
|
|
43
|
+
<SiteFooter.Org
|
|
44
|
+
href="https://www.gov.scot/"
|
|
45
|
+
title="The Scottish Government"
|
|
46
|
+
>
|
|
47
|
+
<svg xmlns="http://www.w3.org/2000/sv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-7.2 0-3.9-2.6-7.1-7-7.1s-7 3.2-7 7.1c0 4 2.7 7.2 7 7.2m-16.3-2.9c-2.4 0-3.9-1.7-3.9-4.3 0-2.6 1.5-4.4 3.9-4.4 1.4 0 2.8.8 3.5 1.8v5.1c-.7 1-2.2 1.8-3.5 1.8m-.6 8.1c3.3 0 7-1.3 7-6.2V6.4h-3v1.9a5.2 5.2 0 0 0-4.4-2.2c-3.5 0-6 2.6-6 7 0 4.5 2.6 7 6 7 1.8 0 3.3-.9 4.4-2.3v1.5c0 2.9-2.1 3.8-4 3.8-1.8 0-3.2-.5-4.3-1.7l-1.4 2.1c1.7 1.5 3.4 2 5.7 2"/>
|
|
52
|
+
<path fill="#fff" d="M1.1 0h48.5v29.9H1.1z"/>
|
|
53
|
+
<path fill="#0065bd" d="m7.9 1.4 17.3 10.2L42.6 1.4zm0 27.1 17.3-10.1 17.4 10.1zm-5.4-24v20.9L19.7 15zm45.7 0v20.9L30.9 15z"/>
|
|
54
|
+
</svg>
|
|
55
|
+
</SiteFooter.Org>
|
|
56
|
+
</>
|
|
57
|
+
}
|
|
58
|
+
} satisfies Meta<typeof SiteFooter>;
|
|
59
|
+
|
|
60
|
+
export default meta;
|
|
61
|
+
type Story = StoryObj<typeof meta>;
|
|
62
|
+
|
|
63
|
+
export const Default: Story = {
|
|
64
|
+
|
|
65
|
+
};
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
|
+
import argTypes from '../../../.storybook/sgdsArgTypes';
|
|
3
|
+
|
|
4
|
+
import SiteHeader from './SiteHeader';
|
|
5
|
+
import SiteSearch from '../SiteSearch/SiteSearch';
|
|
6
|
+
import SiteNavigation from '../SiteNavigation/SiteNavigation';
|
|
7
|
+
import PhaseBanner from '../PhaseBanner/PhaseBanner';
|
|
8
|
+
|
|
9
|
+
const meta = {
|
|
10
|
+
title: 'Components/Site header',
|
|
11
|
+
component: SiteHeader,
|
|
12
|
+
argTypes: {
|
|
13
|
+
children: argTypes.children()
|
|
14
|
+
},
|
|
15
|
+
args: {
|
|
16
|
+
children: [
|
|
17
|
+
<SiteHeader.Brand
|
|
18
|
+
homeUrl="/"
|
|
19
|
+
siteTitle="Design System React"
|
|
20
|
+
>
|
|
21
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 206.7 30.7">
|
|
22
|
+
<title>The Scottish Government</title>
|
|
23
|
+
<path fill="#fff" d="M0 0h46.8v28.9H0z"/>
|
|
24
|
+
<path fill="#0065bd" d="m6.5 1.3 16.8 9.9 16.8-9.9zm0 26.2 16.8-9.8 16.8 9.8zM1.3 4.3v20.3L18 14.5zm44.2 0v20.3L28.8 14.5z"/>
|
|
25
|
+
<path fill="#858b91" d="M202.7 26.1c-1.4 0-2.3-1.1-2.3-2.7s.9-2.7 2.3-2.7c.8 0 1.7.5 2.1 1.1V25c-.4.6-1.3 1.1-2.1 1.1m3.8 1.3v-8.1h-1.8v1.1a3.2 3.2 0 0 0-2.6-1.3c-2.1 0-3.6 1.6-3.6 4.2 0 2.7 1.5 4.2 3.6 4.2 1.1 0 2-.5 2.6-1.3v1.1h1.8zm-15.3 0v-1.1c.6.8 1.6 1.3 2.6 1.3 2.1 0 3.6-1.6 3.6-4.2s-1.5-4.2-3.6-4.2c-1 0-1.9.5-2.6 1.3v-4.2h-1.8v11.2h1.8zm0-2.4v-3.2c.4-.6 1.3-1.1 2.1-1.1 1.4 0 2.3 1.1 2.3 2.7s-.9 2.7-2.3 2.7c-.9 0-1.7-.5-2.1-1.1m-4.5 2.6c.8 0 1.3-.2 1.7-.5l-.4-1.3c-.1.2-.5.3-.8.3-.5 0-.8-.4-.8-1v-8.8h-1.8v9.3c0 1.3.8 2 2.1 2m-6.6-4.1h-4l2-5.3 2 5.3zm3.6 3.9-4.4-11.2h-2.4l-4.4 11.2h2.2l.8-2.2h5.1l.8 2.2h2.3zm-11.9-4.8h-4v1.5h4v-1.5zm-5.7 4.8v-5.7c0-1.7-.9-2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#get-started">
|
|
35
|
+
Get started
|
|
36
|
+
</SiteNavigation.Item>
|
|
37
|
+
<SiteNavigation.Item href="#styles">
|
|
38
|
+
Styles
|
|
39
|
+
</SiteNavigation.Item>
|
|
40
|
+
<SiteNavigation.Item
|
|
41
|
+
isCurrent
|
|
42
|
+
href="#components"
|
|
43
|
+
>
|
|
44
|
+
Components
|
|
45
|
+
</SiteNavigation.Item>
|
|
46
|
+
<SiteNavigation.Item href="#patterns">
|
|
47
|
+
Patterns
|
|
48
|
+
</SiteNavigation.Item>
|
|
49
|
+
<SiteNavigation.Item href="#guidance">
|
|
50
|
+
Guidance
|
|
51
|
+
</SiteNavigation.Item>
|
|
52
|
+
</SiteNavigation>
|
|
53
|
+
</SiteHeader.Navigation>,
|
|
54
|
+
<SiteHeader.Search>
|
|
55
|
+
<SiteSearch id="site-header-search" />
|
|
56
|
+
</SiteHeader.Search>,
|
|
57
|
+
<SiteHeader.Phase>
|
|
58
|
+
<PhaseBanner phaseName="Beta">
|
|
59
|
+
This is a new service. Your{' '}
|
|
60
|
+
<a href="#feedback">
|
|
61
|
+
feedback
|
|
62
|
+
</a>
|
|
63
|
+
{' '}will help us to improve it.
|
|
64
|
+
</PhaseBanner>
|
|
65
|
+
</SiteHeader.Phase>
|
|
66
|
+
]
|
|
67
|
+
}
|
|
68
|
+
} satisfies Meta<typeof SiteHeader>;
|
|
69
|
+
|
|
70
|
+
export default meta;
|
|
71
|
+
type Story = StoryObj<typeof meta>;
|
|
72
|
+
|
|
73
|
+
export const Default: Story = {
|
|
74
|
+
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
export const BrandOnly: Story = {
|
|
78
|
+
args: {
|
|
79
|
+
children: <SiteHeader.Brand
|
|
80
|
+
homeUrl="/"
|
|
81
|
+
siteTitle="Design System React"
|
|
82
|
+
>
|
|
83
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 206.7 30.7">
|
|
84
|
+
<title>The Scottish Government</title>
|
|
85
|
+
<path fill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.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"/>
|
|
89
|
+
</svg>
|
|
90
|
+
</SiteHeader.Brand>
|
|
91
|
+
}
|
|
92
|
+
};
|
|
@@ -56,11 +56,6 @@ const Search = ({
|
|
|
56
56
|
|
|
57
57
|
const SiteHeader = ({
|
|
58
58
|
children,
|
|
59
|
-
logo = {},
|
|
60
|
-
navigationItems,
|
|
61
|
-
phaseBanner,
|
|
62
|
-
siteSearch,
|
|
63
|
-
siteTitle,
|
|
64
59
|
...props
|
|
65
60
|
}: SGDS.Component.SiteHeader) => {
|
|
66
61
|
const mobileMenuRef = useRef(null);
|
|
@@ -108,8 +103,8 @@ const SiteHeader = ({
|
|
|
108
103
|
<div className="ds_site-header__controls">
|
|
109
104
|
<label aria-controls="mobile-navigation" className="ds_site-header__control js-toggle-menu" htmlFor="menu">
|
|
110
105
|
<span className="ds_site-header__control-text">Menu</span>
|
|
111
|
-
<Icon
|
|
112
|
-
<Icon
|
|
106
|
+
<Icon isFilled className="ds_site-header__control-icon" icon="Menu" aria-hidden="true" />
|
|
107
|
+
<Icon isFilled className="ds_site-header__control-icon ds_site-header__control-icon--active-icon" icon="Close" aria-hidden="true" />
|
|
113
108
|
</label>
|
|
114
109
|
</div>
|
|
115
110
|
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
|
+
import argTypes from '../../../.storybook/sgdsArgTypes';
|
|
3
|
+
|
|
4
|
+
import SiteNavigation from './SiteNavigation';
|
|
5
|
+
|
|
6
|
+
const meta = {
|
|
7
|
+
title: 'Components/Site navigation',
|
|
8
|
+
component: SiteNavigation,
|
|
9
|
+
argTypes: {
|
|
10
|
+
linkComponent: argTypes.linkComponent(),
|
|
11
|
+
children: argTypes.children()
|
|
12
|
+
},
|
|
13
|
+
args: {
|
|
14
|
+
children: <>
|
|
15
|
+
<SiteNavigation.Item href="#about">
|
|
16
|
+
About
|
|
17
|
+
</SiteNavigation.Item>
|
|
18
|
+
<SiteNavigation.Item href="#get-started">
|
|
19
|
+
Get started
|
|
20
|
+
</SiteNavigation.Item>
|
|
21
|
+
<SiteNavigation.Item href="#styles">
|
|
22
|
+
Styles
|
|
23
|
+
</SiteNavigation.Item>
|
|
24
|
+
<SiteNavigation.Item
|
|
25
|
+
isCurrent
|
|
26
|
+
href="#components"
|
|
27
|
+
>
|
|
28
|
+
Components
|
|
29
|
+
</SiteNavigation.Item>
|
|
30
|
+
<SiteNavigation.Item href="#patterns">
|
|
31
|
+
Patterns
|
|
32
|
+
</SiteNavigation.Item>
|
|
33
|
+
<SiteNavigation.Item href="#guidance">
|
|
34
|
+
Guidance
|
|
35
|
+
</SiteNavigation.Item>
|
|
36
|
+
</>
|
|
37
|
+
}
|
|
38
|
+
} satisfies Meta<typeof SiteNavigation>;
|
|
39
|
+
|
|
40
|
+
export default meta;
|
|
41
|
+
type Story = StoryObj<typeof meta>;
|
|
42
|
+
|
|
43
|
+
export const Default: Story = {
|
|
44
|
+
|
|
45
|
+
};
|
|
@@ -64,7 +64,7 @@ test('site navigation link with custom element', () => {
|
|
|
64
64
|
|
|
65
65
|
test('highlights current item', () => {
|
|
66
66
|
render(
|
|
67
|
-
<SiteNavigation.Item href={LINK_HREF}
|
|
67
|
+
<SiteNavigation.Item href={LINK_HREF} isCurrent>{LINK_TEXT}</SiteNavigation.Item>
|
|
68
68
|
);
|
|
69
69
|
|
|
70
70
|
const link = screen.getByRole('link');
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
const Item = ({
|
|
2
2
|
children,
|
|
3
|
-
|
|
3
|
+
isCurrent = false,
|
|
4
4
|
href,
|
|
5
5
|
linkComponent
|
|
6
6
|
}: SGDS.Component.SiteNavigation.Item) => {
|
|
7
7
|
const classNames = ['ds_site-navigation__link'];
|
|
8
8
|
let ariaCurrent: React.AriaAttributes["aria-current"];
|
|
9
9
|
|
|
10
|
-
if (
|
|
10
|
+
if (isCurrent) {
|
|
11
11
|
classNames.push('ds_current');
|
|
12
12
|
ariaCurrent = 'page';
|
|
13
13
|
}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
|
+
import argTypes from '../../../.storybook/sgdsArgTypes';
|
|
3
|
+
|
|
4
|
+
import SiteSearch from './SiteSearch';
|
|
5
|
+
|
|
6
|
+
type AutocompleteResponseObject = {
|
|
7
|
+
key: string,
|
|
8
|
+
displayText: string,
|
|
9
|
+
weight: string,
|
|
10
|
+
type: string,
|
|
11
|
+
category: string
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
const suggestionMappingFunction = function (request: XMLHttpRequest) {
|
|
15
|
+
const responseObj = JSON.parse(request.response).map((item: string) => ({
|
|
16
|
+
key: '',
|
|
17
|
+
displayText: item,
|
|
18
|
+
weight: '',
|
|
19
|
+
type: '',
|
|
20
|
+
category: ''
|
|
21
|
+
}));
|
|
22
|
+
const siteSearchElement = document.getElementById('site-search') as HTMLInputElement;
|
|
23
|
+
const filteredResults = responseObj.filter((item: AutocompleteResponseObject) => (item.displayText.toLowerCase().indexOf(siteSearchElement.value.toLowerCase()) > -1));
|
|
24
|
+
return filteredResults.slice(0,6);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const meta = {
|
|
28
|
+
title: 'Components/Site search',
|
|
29
|
+
component: SiteSearch,
|
|
30
|
+
argTypes: {
|
|
31
|
+
action: {
|
|
32
|
+
description: 'The value of the search form\'s action atttribute',
|
|
33
|
+
type: 'string'
|
|
34
|
+
},
|
|
35
|
+
autocompleteEndpoint: {
|
|
36
|
+
description: 'The endpoint used by the autocomplete',
|
|
37
|
+
type: 'string'
|
|
38
|
+
},
|
|
39
|
+
autocompleteSuggestionMappingFunction: {
|
|
40
|
+
control: false,
|
|
41
|
+
description: 'A JavaScript function that maps the results from the endpoint into the expected format',
|
|
42
|
+
type: 'function'
|
|
43
|
+
},
|
|
44
|
+
id: argTypes.id(),
|
|
45
|
+
method: {
|
|
46
|
+
description: 'The form method to use',
|
|
47
|
+
options: ['GET', 'POST'],
|
|
48
|
+
control: { type: 'radio' },
|
|
49
|
+
type: 'string'
|
|
50
|
+
},
|
|
51
|
+
minLength: {
|
|
52
|
+
description: 'The number of characters that need to be entered before requests are sent to the autocomplete endpoint',
|
|
53
|
+
type: 'number'
|
|
54
|
+
},
|
|
55
|
+
name: {
|
|
56
|
+
description: '',
|
|
57
|
+
type: 'string'
|
|
58
|
+
},
|
|
59
|
+
placeholder: {
|
|
60
|
+
description: '',
|
|
61
|
+
type: 'string'
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
args: {
|
|
65
|
+
id: 'site-search'
|
|
66
|
+
}
|
|
67
|
+
} satisfies Meta<typeof SiteSearch>;
|
|
68
|
+
|
|
69
|
+
export default meta;
|
|
70
|
+
type Story = StoryObj<typeof meta>;
|
|
71
|
+
|
|
72
|
+
export const Default: Story = {
|
|
73
|
+
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
export const Autocomplete: Story = {
|
|
77
|
+
args: {
|
|
78
|
+
autocompleteEndpoint: 'static/data/autocomplete-dummy-data.json?',
|
|
79
|
+
autocompleteSuggestionMappingFunction: suggestionMappingFunction
|
|
80
|
+
}
|
|
81
|
+
}
|
|
@@ -81,7 +81,7 @@ const SiteSearch = function ({
|
|
|
81
81
|
type="search"
|
|
82
82
|
/>
|
|
83
83
|
|
|
84
|
-
<Button type="submit" icon="Search"
|
|
84
|
+
<Button type="submit" icon="Search" isIconOnly>Search</Button>
|
|
85
85
|
|
|
86
86
|
{hasAutocomplete && (
|
|
87
87
|
<div id="autocomplete-suggestions" className="ds_autocomplete__suggestions">
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
|
+
import argTypes from '../../../.storybook/sgdsArgTypes';
|
|
3
|
+
|
|
4
|
+
import SkipLinks from './SkipLinks';
|
|
5
|
+
|
|
6
|
+
const meta = {
|
|
7
|
+
title: 'Components/Skip links',
|
|
8
|
+
component: SkipLinks,
|
|
9
|
+
argTypes: {
|
|
10
|
+
mainContentId: {
|
|
11
|
+
description: 'The id attribute of the ‘main content’ element to link to',
|
|
12
|
+
type: 'string'
|
|
13
|
+
},
|
|
14
|
+
mainLinkText: {
|
|
15
|
+
description: 'The text to use for the ‘main content’ link',
|
|
16
|
+
type: 'string'
|
|
17
|
+
},
|
|
18
|
+
isStatic: {
|
|
19
|
+
control: 'boolean',
|
|
20
|
+
description: 'Use the ‘static’ display variant'
|
|
21
|
+
},
|
|
22
|
+
children: argTypes.children()
|
|
23
|
+
},
|
|
24
|
+
args: {
|
|
25
|
+
|
|
26
|
+
}
|
|
27
|
+
} satisfies Meta<typeof SkipLinks>;
|
|
28
|
+
|
|
29
|
+
export default meta;
|
|
30
|
+
type Story = StoryObj<typeof meta>;
|
|
31
|
+
|
|
32
|
+
export const Default: Story = {
|
|
33
|
+
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
export const MultipleLinks: Story = {
|
|
37
|
+
args: {
|
|
38
|
+
children: <>
|
|
39
|
+
<SkipLinks.Link fragmentId="my-main-content">
|
|
40
|
+
Skip to main content
|
|
41
|
+
</SkipLinks.Link>
|
|
42
|
+
<SkipLinks.Link fragmentId="other-important-content">
|
|
43
|
+
Other important content
|
|
44
|
+
</SkipLinks.Link>
|
|
45
|
+
</>
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
export const Static: Story = {
|
|
50
|
+
args: {
|
|
51
|
+
isStatic: true,
|
|
52
|
+
children:
|
|
53
|
+
<SkipLinks.Link fragmentId="search-results">
|
|
54
|
+
Skip to search results
|
|
55
|
+
</SkipLinks.Link>
|
|
56
|
+
}
|
|
57
|
+
};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
|
+
import argTypes from '../../../.storybook/sgdsArgTypes';
|
|
3
|
+
|
|
4
|
+
import SummaryCard from './SummaryCard';
|
|
5
|
+
import SummaryList from '../SummaryList/SummaryList';
|
|
6
|
+
|
|
7
|
+
const meta = {
|
|
8
|
+
title: 'Components/Summary card',
|
|
9
|
+
component: SummaryCard,
|
|
10
|
+
argTypes: {
|
|
11
|
+
headingLevel: argTypes.headingLevel(),
|
|
12
|
+
children: argTypes.children()
|
|
13
|
+
},
|
|
14
|
+
args: {
|
|
15
|
+
children: [
|
|
16
|
+
<SummaryCard.Action key="foo" href="#foo">
|
|
17
|
+
Change
|
|
18
|
+
</SummaryCard.Action>,
|
|
19
|
+
<SummaryCard.Action key="bar" onclick={() => alert('click')}>
|
|
20
|
+
Delete
|
|
21
|
+
</SummaryCard.Action>,
|
|
22
|
+
<SummaryList key="baz">
|
|
23
|
+
<SummaryList.Item title="Phone number">
|
|
24
|
+
<SummaryList.Value>
|
|
25
|
+
0123 456 7890
|
|
26
|
+
</SummaryList.Value>
|
|
27
|
+
</SummaryList.Item>
|
|
28
|
+
<SummaryList.Item title="Address">
|
|
29
|
+
<SummaryList.Value>
|
|
30
|
+
Victoria Quay<br />
|
|
31
|
+
Edinburgh<br />
|
|
32
|
+
EH6 6QQ
|
|
33
|
+
</SummaryList.Value>
|
|
34
|
+
</SummaryList.Item>
|
|
35
|
+
</SummaryList>
|
|
36
|
+
],
|
|
37
|
+
title: 'Joe Bloggs'
|
|
38
|
+
}
|
|
39
|
+
} satisfies Meta<typeof SummaryCard>;
|
|
40
|
+
|
|
41
|
+
export default meta;
|
|
42
|
+
type Story = StoryObj<typeof meta>;
|
|
43
|
+
|
|
44
|
+
export const Default: Story = {
|
|
45
|
+
|
|
46
|
+
};
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
|
+
import argTypes from '../../../.storybook/sgdsArgTypes';
|
|
3
|
+
|
|
4
|
+
import SummaryList from './SummaryList';
|
|
5
|
+
|
|
6
|
+
const meta = {
|
|
7
|
+
title: 'Components/Summary list',
|
|
8
|
+
component: SummaryList,
|
|
9
|
+
argTypes: {
|
|
10
|
+
isBorderless: argTypes.noBorder(),
|
|
11
|
+
children: argTypes.children()
|
|
12
|
+
},
|
|
13
|
+
args: {
|
|
14
|
+
children: <>
|
|
15
|
+
<SummaryList.Item title="Name">
|
|
16
|
+
<SummaryList.Value>
|
|
17
|
+
Jane Smith
|
|
18
|
+
</SummaryList.Value>
|
|
19
|
+
<SummaryList.Action href="#foo">
|
|
20
|
+
Change
|
|
21
|
+
</SummaryList.Action>
|
|
22
|
+
<SummaryList.Action onclick={function w(){}}>
|
|
23
|
+
Delete
|
|
24
|
+
</SummaryList.Action>
|
|
25
|
+
</SummaryList.Item>
|
|
26
|
+
<SummaryList.Item title="Date of birth">
|
|
27
|
+
<SummaryList.Value>
|
|
28
|
+
13 April 2001
|
|
29
|
+
</SummaryList.Value>
|
|
30
|
+
<SummaryList.Action href="#bar">
|
|
31
|
+
Change
|
|
32
|
+
</SummaryList.Action>
|
|
33
|
+
</SummaryList.Item>
|
|
34
|
+
<SummaryList.Item title="Address">
|
|
35
|
+
<SummaryList.Value>
|
|
36
|
+
Scottish Government<br />
|
|
37
|
+
St Andrew's House<br />
|
|
38
|
+
Regent Road<br />
|
|
39
|
+
Edinburgh<br />
|
|
40
|
+
EH1 3DG
|
|
41
|
+
</SummaryList.Value>
|
|
42
|
+
<SummaryList.Action href="#baz">
|
|
43
|
+
Change
|
|
44
|
+
</SummaryList.Action>
|
|
45
|
+
</SummaryList.Item>
|
|
46
|
+
<SummaryList.Item title="Contact details">
|
|
47
|
+
<SummaryList.Value name="Email">
|
|
48
|
+
email@gov.scot
|
|
49
|
+
</SummaryList.Value>
|
|
50
|
+
<SummaryList.Value name="Telephone">
|
|
51
|
+
0123 456 7890
|
|
52
|
+
</SummaryList.Value>
|
|
53
|
+
<SummaryList.Action href="foo">
|
|
54
|
+
Change
|
|
55
|
+
</SummaryList.Action>
|
|
56
|
+
<SummaryList.Action onclick={function w(){}}>
|
|
57
|
+
Delete
|
|
58
|
+
</SummaryList.Action>
|
|
59
|
+
</SummaryList.Item>
|
|
60
|
+
</>
|
|
61
|
+
}
|
|
62
|
+
} satisfies Meta<typeof SummaryList>;
|
|
63
|
+
|
|
64
|
+
export default meta;
|
|
65
|
+
type Story = StoryObj<typeof meta>;
|
|
66
|
+
|
|
67
|
+
export const Default: Story = {
|
|
68
|
+
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
export const NoBorder: Story = {
|
|
72
|
+
args: {
|
|
73
|
+
isBorderless: true
|
|
74
|
+
}
|
|
75
|
+
};
|
|
@@ -73,14 +73,14 @@ const Value = ({
|
|
|
73
73
|
const SummaryList = ({
|
|
74
74
|
children,
|
|
75
75
|
className,
|
|
76
|
-
|
|
76
|
+
isBorderless,
|
|
77
77
|
...props
|
|
78
78
|
}: SGDS.Component.SummaryList) => {
|
|
79
79
|
return (
|
|
80
80
|
<ol
|
|
81
81
|
className={[
|
|
82
82
|
'ds_summary-list',
|
|
83
|
-
|
|
83
|
+
isBorderless && 'ds_summary-list--no-border',
|
|
84
84
|
className
|
|
85
85
|
].join(' ')}
|
|
86
86
|
{...props}
|
|
@@ -98,6 +98,6 @@ SummaryList.Value = Value;
|
|
|
98
98
|
SummaryList.displayName = 'SummaryList';
|
|
99
99
|
SummaryList.Action.displayName = 'SummaryList.Action';
|
|
100
100
|
Item.displayName = 'SummaryList.Item';
|
|
101
|
-
Value.displayName = '
|
|
101
|
+
Value.displayName = 'SummaryList.Value';
|
|
102
102
|
|
|
103
103
|
export default SummaryList;
|