@scottish-government/designsystem-react 0.10.1 → 0.11.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/manager.ts +1 -7
- package/.storybook/sgdsArgTypes.ts +19 -0
- package/@types/components/Accordion.d.ts +3 -2
- package/@types/components/ButtonGroup.d.ts +5 -0
- package/@types/components/RadioButton.d.ts +2 -2
- package/@types/components/SearchFacets.d.ts +18 -0
- package/@types/components/SearchFilters.d.ts +14 -0
- package/@types/components/SearchResult.d.ts +30 -0
- package/@types/components/SearchSort.d.ts +9 -0
- package/@types/components/SideNavigation.d.ts +1 -1
- package/CHANGELOG.md +31 -5
- package/README.md +3 -0
- package/dist/common/AbstractNotificationBanner.jsx +2 -5
- package/dist/components/Accordion/Accordion.jsx +8 -3
- package/dist/components/ButtonGroup/ButtonGroup.jsx +13 -0
- package/dist/components/RadioButton/RadioGroup.jsx +1 -1
- package/dist/components/SearchFacets/SearchFacets.jsx +101 -0
- package/dist/components/SearchFilters/SearchFilters.jsx +63 -0
- package/dist/components/SearchResult/SearchResult.jsx +93 -0
- package/dist/components/SearchSort/SearchSort.jsx +28 -0
- package/dist/components/SideNavigation/SideNavigation.jsx +2 -2
- package/dist/components/TaskList/TaskList.jsx +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -3
- package/src/common/AbstractNotificationBanner.tsx +2 -6
- package/src/components/Accordion/Accordion.Item.stories.tsx +63 -0
- package/src/components/Accordion/Accordion.stories.tsx +4 -54
- package/src/components/Accordion/Accordion.test.tsx +48 -14
- package/src/components/Accordion/Accordion.tsx +12 -1
- package/src/components/AspectBox/AspectBox.stories.tsx +1 -1
- package/src/components/BackToTop/BackToTop.stories.tsx +1 -1
- package/src/components/Breadcrumbs/Breadcrumbs.Item.stories.tsx +42 -0
- package/src/components/Breadcrumbs/Breadcrumbs.stories.tsx +0 -1
- package/src/components/Button/Button.stories.tsx +1 -1
- package/src/components/ButtonGroup/ButtonGroup.stories.tsx +41 -0
- package/src/components/ButtonGroup/ButtonGroup.test.tsx +45 -0
- package/src/components/ButtonGroup/ButtonGroup.tsx +20 -0
- package/src/components/CategoryItem/CategoryItem.stories.tsx +1 -1
- package/src/components/CategoryList/CategoryList.stories.tsx +1 -1
- package/src/components/Checkbox/Checkbox.stories.tsx +1 -1
- package/src/components/Checkbox/CheckboxGroup.stories.tsx +1 -1
- package/src/components/ConfirmationMessage/ConfirmationMessage.stories.tsx +1 -1
- package/src/components/ContentsNav/ContentsNav.Item.stories.tsx +53 -0
- package/src/components/ContentsNav/ContentsNav.stories.tsx +1 -2
- package/src/components/CookieBanner/CookieBanner.Buttons.stories.tsx +27 -0
- package/src/components/CookieBanner/CookieBanner.stories.tsx +2 -2
- package/src/components/DatePicker/DatePicker.stories.tsx +1 -1
- package/src/components/ErrorMessage/ErrorMessage.stories.tsx +1 -1
- package/src/components/ErrorSummary/ErrorSummary.Item.stories.tsx +35 -0
- package/src/components/ErrorSummary/ErrorSummary.stories.tsx +1 -2
- package/src/components/FileDownload/FileDownload.stories.tsx +1 -1
- package/src/components/HideThisPage/HideThisPage.stories.tsx +1 -1
- package/src/components/InsetText/InsetText.stories.tsx +1 -1
- package/src/components/NotificationBanner/NotificationBanner.stories.tsx +1 -1
- package/src/components/NotificationPanel/NotificationPanel.stories.tsx +1 -1
- package/src/components/PageHeader/PageHeader.stories.tsx +1 -1
- package/src/components/PageMetadata/PageMetadata.Item.stories.tsx +40 -0
- package/src/components/PageMetadata/PageMetadata.stories.tsx +10 -5
- package/src/components/PhaseBanner/PhaseBanner.stories.tsx +1 -1
- package/src/components/RadioButton/RadioButton.stories.tsx +1 -1
- package/src/components/RadioButton/RadioGroup.stories.tsx +1 -1
- package/src/components/RadioButton/RadioGroup.tsx +2 -2
- package/src/components/SearchFacets/SearchFacets.Group.stories.tsx +56 -0
- package/src/components/SearchFacets/SearchFacets.Item.stories.tsx +53 -0
- package/src/components/SearchFacets/SearchFacets.stories.tsx +38 -0
- package/src/components/SearchFacets/SearchFacets.test.tsx +214 -0
- package/src/components/SearchFacets/SearchFacets.tsx +99 -0
- package/src/components/SearchFilters/SearchFilters.Panel.stories.tsx +201 -0
- package/src/components/SearchFilters/SearchFilters.stories.tsx +137 -0
- package/src/components/SearchFilters/SearchFilters.test.tsx +161 -0
- package/src/components/SearchFilters/SearchFilters.tsx +89 -0
- package/src/components/SearchResult/SearchResult.stories.tsx +111 -0
- package/src/components/SearchResult/SearchResult.test.tsx +215 -0
- package/src/components/SearchResult/SearchResult.tsx +137 -0
- package/src/components/SearchSort/SearchSort.stories.tsx +32 -0
- package/src/components/SearchSort/SearchSort.test.tsx +129 -0
- package/src/components/SearchSort/SearchSort.tsx +45 -0
- package/src/components/SequentialNavigation/SequentialNavigation.Next.stories.tsx +35 -0
- package/src/components/SequentialNavigation/SequentialNavigation.Previous.stories.tsx +35 -0
- package/src/components/SequentialNavigation/SequentialNavigation.stories.tsx +1 -2
- package/src/components/SequentialNavigation/SequentialNavigation.test.tsx +15 -0
- package/src/components/SideNavigation/SideNavigation.Item.stories.tsx +45 -0
- package/src/components/SideNavigation/SideNavigation.List.stories.tsx +53 -0
- package/src/components/SideNavigation/SideNavigation.stories.tsx +1 -2
- package/src/components/SideNavigation/SideNavigation.tsx +2 -1
- package/src/components/SiteFooter/SiteFooter.License.stories.tsx +46 -0
- package/src/components/SiteFooter/SiteFooter.Link.stories.tsx +34 -0
- package/src/components/SiteFooter/SiteFooter.Links.stories.tsx +32 -0
- package/src/components/SiteFooter/SiteFooter.Org.stories.tsx +45 -0
- package/src/components/SiteFooter/SiteFooter.stories.tsx +1 -1
- package/src/components/SiteHeader/SiteHeader.Brand.stories.tsx +45 -0
- package/src/components/SiteHeader/SiteHeader.stories.tsx +1 -1
- package/src/components/SiteNavigation/SiteNavigation.Item.stories.tsx +40 -0
- package/src/components/SiteNavigation/SiteNavigation.stories.tsx +1 -2
- package/src/components/SkipLinks/SkipLinks.Item.stories.tsx +37 -0
- package/src/components/SkipLinks/SkipLinks.stories.tsx +1 -1
- package/src/components/SummaryCard/SummaryCard.Action.stories.tsx +39 -0
- package/src/components/SummaryCard/SummaryCard.stories.tsx +8 -1
- package/src/components/SummaryList/SummaryList.Action.stories.tsx +32 -0
- package/src/components/SummaryList/SummaryList.Item.stories.tsx +50 -0
- package/src/components/SummaryList/SummaryList.Value.stories.tsx +30 -0
- package/src/components/SummaryList/SummaryList.stories.tsx +1 -1
- package/src/components/Tabs/Tabs.Item.stories.tsx +37 -0
- package/src/components/Tag/Tag.stories.tsx +2 -6
- package/src/components/TaskList/TaskList.Group.stories.tsx +110 -0
- package/src/components/TaskList/TaskList.Item.stories.tsx +77 -0
- package/src/components/TaskList/TaskList.stories.tsx +1 -1
- package/src/components/TaskList/TaskList.test.tsx +21 -1
- package/src/components/TaskList/TaskList.tsx +1 -0
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
|
+
import argTypes from '../../../.storybook/sgdsArgTypes';
|
|
3
|
+
|
|
4
|
+
import SideNavigation from './SideNavigation';
|
|
5
|
+
|
|
6
|
+
const meta = {
|
|
7
|
+
title: 'Components/SideNavigation/SideNavigation.Item',
|
|
8
|
+
component: SideNavigation.Item,
|
|
9
|
+
decorators: [
|
|
10
|
+
Story => (
|
|
11
|
+
<nav className="ds_side-navigation">
|
|
12
|
+
<ul className="ds_side-navigation__list">
|
|
13
|
+
<Story />
|
|
14
|
+
</ul>
|
|
15
|
+
</nav>
|
|
16
|
+
)
|
|
17
|
+
],
|
|
18
|
+
argTypes: {
|
|
19
|
+
href: argTypes.href(),
|
|
20
|
+
isCurrent: argTypes.isCurrent(),
|
|
21
|
+
linkComponent: argTypes.linkComponent(),
|
|
22
|
+
title: {
|
|
23
|
+
description: 'Text of the navigation item',
|
|
24
|
+
type: 'string'
|
|
25
|
+
},
|
|
26
|
+
children: argTypes.children()
|
|
27
|
+
},
|
|
28
|
+
args: {
|
|
29
|
+
href: '#bananas',
|
|
30
|
+
title: 'Bananas'
|
|
31
|
+
}
|
|
32
|
+
} satisfies Meta<typeof SideNavigation.Item>;
|
|
33
|
+
|
|
34
|
+
export default meta;
|
|
35
|
+
type Story = StoryObj<typeof meta>;
|
|
36
|
+
|
|
37
|
+
export const Default: Story = {
|
|
38
|
+
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
export const CurrentItem: Story = {
|
|
42
|
+
args: {
|
|
43
|
+
isCurrent: true
|
|
44
|
+
}
|
|
45
|
+
};
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
|
+
import argTypes from '../../../.storybook/sgdsArgTypes';
|
|
3
|
+
|
|
4
|
+
import SideNavigation from './SideNavigation';
|
|
5
|
+
|
|
6
|
+
const meta = {
|
|
7
|
+
title: 'Components/SideNavigation/SideNavigation.List',
|
|
8
|
+
component: SideNavigation.List,
|
|
9
|
+
decorators: [
|
|
10
|
+
Story => (
|
|
11
|
+
<nav className="ds_side-navigation">
|
|
12
|
+
<Story />
|
|
13
|
+
</nav>
|
|
14
|
+
)
|
|
15
|
+
],
|
|
16
|
+
argTypes: {
|
|
17
|
+
isRoot: {
|
|
18
|
+
description: 'Indicates that this is the root list in a nested structure. Required for mobile navigation.',
|
|
19
|
+
control: 'boolean'
|
|
20
|
+
},
|
|
21
|
+
children: argTypes.children()
|
|
22
|
+
},
|
|
23
|
+
args: {
|
|
24
|
+
children: <>
|
|
25
|
+
<SideNavigation.Item
|
|
26
|
+
isCurrent
|
|
27
|
+
href="#apples"
|
|
28
|
+
title="Apples"
|
|
29
|
+
>
|
|
30
|
+
</SideNavigation.Item>
|
|
31
|
+
<SideNavigation.Item
|
|
32
|
+
href="#bananas"
|
|
33
|
+
title="Bananas"
|
|
34
|
+
/>
|
|
35
|
+
<SideNavigation.Item
|
|
36
|
+
href="#cherries"
|
|
37
|
+
title="Cherries"
|
|
38
|
+
/>
|
|
39
|
+
<SideNavigation.Item
|
|
40
|
+
href="#dates"
|
|
41
|
+
title="Dates"
|
|
42
|
+
/>
|
|
43
|
+
</>,
|
|
44
|
+
isRoot: true
|
|
45
|
+
}
|
|
46
|
+
} satisfies Meta<typeof SideNavigation.List>;
|
|
47
|
+
|
|
48
|
+
export default meta;
|
|
49
|
+
type Story = StoryObj<typeof meta>;
|
|
50
|
+
|
|
51
|
+
export const Default: Story = {
|
|
52
|
+
|
|
53
|
+
};
|
|
@@ -4,10 +4,9 @@ import argTypes from '../../../.storybook/sgdsArgTypes';
|
|
|
4
4
|
import SideNavigation from './SideNavigation';
|
|
5
5
|
|
|
6
6
|
const meta = {
|
|
7
|
-
title: 'Components/
|
|
7
|
+
title: 'Components/SideNavigation',
|
|
8
8
|
component: SideNavigation,
|
|
9
9
|
argTypes: {
|
|
10
|
-
linkComponent: argTypes.linkComponent(),
|
|
11
10
|
children: argTypes.children()
|
|
12
11
|
},
|
|
13
12
|
args: {
|
|
@@ -43,6 +43,7 @@ const SideNavigationItem = function ({
|
|
|
43
43
|
};
|
|
44
44
|
|
|
45
45
|
const SideNavigation = function ({
|
|
46
|
+
ariaLabel = 'Sections',
|
|
46
47
|
children,
|
|
47
48
|
className,
|
|
48
49
|
...props
|
|
@@ -57,7 +58,7 @@ const SideNavigation = function ({
|
|
|
57
58
|
|
|
58
59
|
return (
|
|
59
60
|
<nav
|
|
60
|
-
aria-label=
|
|
61
|
+
aria-label={ariaLabel}
|
|
61
62
|
className={[
|
|
62
63
|
'ds_side-navigation',
|
|
63
64
|
className
|
|
@@ -0,0 +1,46 @@
|
|
|
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/SiteFooter/SiteFooter.License',
|
|
8
|
+
component: SiteFooter.License,
|
|
9
|
+
decorators: [
|
|
10
|
+
Story => (
|
|
11
|
+
<nav className="ds_site-footer" style={{borderTop: 0}}>
|
|
12
|
+
<Story />
|
|
13
|
+
</nav>
|
|
14
|
+
)
|
|
15
|
+
],
|
|
16
|
+
argTypes: {
|
|
17
|
+
children: argTypes.children()
|
|
18
|
+
},
|
|
19
|
+
args: {
|
|
20
|
+
children: <>
|
|
21
|
+
<svg focusable="false" version="1.1" width="41" height="17" id="ogl-logo" xmlns="http://www.w3.org/2000/svg" x="0px" y="0px"
|
|
22
|
+
viewBox="0 0 852.16 345.09">
|
|
23
|
+
<title>ogl</title>
|
|
24
|
+
<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>
|
|
25
|
+
<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)"/>
|
|
26
|
+
</svg>
|
|
27
|
+
<p>
|
|
28
|
+
All content is available under the{' '}
|
|
29
|
+
<a href="https://www.nationalarchives.gov.uk/doc/open-government-licence/version/3/">
|
|
30
|
+
Open Government Licence v3.0
|
|
31
|
+
</a>
|
|
32
|
+
, except for graphic assets and where otherwise stated
|
|
33
|
+
</p>
|
|
34
|
+
<p>
|
|
35
|
+
© Crown Copyright
|
|
36
|
+
</p>
|
|
37
|
+
</>
|
|
38
|
+
}
|
|
39
|
+
} satisfies Meta<typeof SiteFooter.License>;
|
|
40
|
+
|
|
41
|
+
export default meta;
|
|
42
|
+
type Story = StoryObj<typeof meta>;
|
|
43
|
+
|
|
44
|
+
export const Default: Story = {
|
|
45
|
+
|
|
46
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
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/SiteFooter/SiteFooter.Link',
|
|
8
|
+
component: SiteFooter.Link,
|
|
9
|
+
decorators: [
|
|
10
|
+
Story => (
|
|
11
|
+
<div className="ds_site-footer__site-items" style={{ borderBottom: 0 }}>
|
|
12
|
+
<ul>
|
|
13
|
+
<Story />
|
|
14
|
+
</ul>
|
|
15
|
+
</div>
|
|
16
|
+
)
|
|
17
|
+
],
|
|
18
|
+
argTypes: {
|
|
19
|
+
href: argTypes.href(),
|
|
20
|
+
linkComponent: argTypes.linkComponent(),
|
|
21
|
+
children: argTypes.children()
|
|
22
|
+
},
|
|
23
|
+
args: {
|
|
24
|
+
children: 'Cookies',
|
|
25
|
+
href: '#cookies'
|
|
26
|
+
}
|
|
27
|
+
} satisfies Meta<typeof SiteFooter.Link>;
|
|
28
|
+
|
|
29
|
+
export default meta;
|
|
30
|
+
type Story = StoryObj<typeof meta>;
|
|
31
|
+
|
|
32
|
+
export const Default: Story = {
|
|
33
|
+
|
|
34
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
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/SiteFooter/SiteFooter.Links',
|
|
8
|
+
component: SiteFooter.Links,
|
|
9
|
+
argTypes: {
|
|
10
|
+
children: argTypes.children()
|
|
11
|
+
},
|
|
12
|
+
args: {
|
|
13
|
+
children: <>
|
|
14
|
+
<SiteFooter.Link href="#">
|
|
15
|
+
Privacy
|
|
16
|
+
</SiteFooter.Link>
|
|
17
|
+
<SiteFooter.Link href="#">
|
|
18
|
+
Cookies
|
|
19
|
+
</SiteFooter.Link>
|
|
20
|
+
<SiteFooter.Link href="#">
|
|
21
|
+
Accessibility
|
|
22
|
+
</SiteFooter.Link>
|
|
23
|
+
</>
|
|
24
|
+
}
|
|
25
|
+
} satisfies Meta<typeof SiteFooter.Links>;
|
|
26
|
+
|
|
27
|
+
export default meta;
|
|
28
|
+
type Story = StoryObj<typeof meta>;
|
|
29
|
+
|
|
30
|
+
export const Default: Story = {
|
|
31
|
+
|
|
32
|
+
};
|
|
@@ -0,0 +1,45 @@
|
|
|
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/SiteFooter/SiteFooter.Org',
|
|
8
|
+
component: SiteFooter.Org,
|
|
9
|
+
decorators: [
|
|
10
|
+
Story => (
|
|
11
|
+
<div className="ds_site-footer__content" style={{borderTop: 0}}>
|
|
12
|
+
<Story />
|
|
13
|
+
</div>
|
|
14
|
+
)
|
|
15
|
+
],
|
|
16
|
+
argTypes: {
|
|
17
|
+
href: argTypes.href(),
|
|
18
|
+
title: {
|
|
19
|
+
description: 'Title for the parent org link',
|
|
20
|
+
type: 'string'
|
|
21
|
+
},
|
|
22
|
+
children: argTypes.children()
|
|
23
|
+
},
|
|
24
|
+
args: {
|
|
25
|
+
children: <>
|
|
26
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="300" height="55" viewBox="0 0 157.4 29.9">
|
|
27
|
+
<defs>
|
|
28
|
+
<path id="a" d="M0 0h157.4v29.9H0z"/>
|
|
29
|
+
</defs>
|
|
30
|
+
<path fill="#333e48" d="M154.6 20.3a4 4 0 0 0 2.8-.9l-.7-2.3c-.2.3-.7.5-1.3.5-.8 0-1.3-.7-1.3-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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"/>
|
|
31
|
+
<path fill="#fff" d="M1.1 0h48.5v29.9H1.1z"/>
|
|
32
|
+
<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"/>
|
|
33
|
+
</svg>
|
|
34
|
+
</>,
|
|
35
|
+
href: 'https://www.gov.scot/',
|
|
36
|
+
title: 'The Scottish Government'
|
|
37
|
+
}
|
|
38
|
+
} satisfies Meta<typeof SiteFooter.Org>;
|
|
39
|
+
|
|
40
|
+
export default meta;
|
|
41
|
+
type Story = StoryObj<typeof meta>;
|
|
42
|
+
|
|
43
|
+
export const Default: Story = {
|
|
44
|
+
|
|
45
|
+
};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
|
+
import argTypes from '../../../.storybook/sgdsArgTypes';
|
|
3
|
+
|
|
4
|
+
import SiteHeader from './SiteHeader';
|
|
5
|
+
|
|
6
|
+
const meta = {
|
|
7
|
+
title: 'Components/SiteHeader/SiteHeader.Brand',
|
|
8
|
+
component: SiteHeader.Brand,
|
|
9
|
+
argTypes: {
|
|
10
|
+
homeUrl: {
|
|
11
|
+
description: 'URL of the home page, used by the logo link',
|
|
12
|
+
type: 'string'
|
|
13
|
+
},
|
|
14
|
+
siteTitle: {
|
|
15
|
+
description: 'Text to use in the site title',
|
|
16
|
+
type: 'string'
|
|
17
|
+
},
|
|
18
|
+
children: argTypes.children()
|
|
19
|
+
},
|
|
20
|
+
args: {
|
|
21
|
+
children:
|
|
22
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="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-.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"/>
|
|
28
|
+
</svg>
|
|
29
|
+
,
|
|
30
|
+
homeUrl: '/'
|
|
31
|
+
}
|
|
32
|
+
} satisfies Meta<typeof SiteHeader.Brand>;
|
|
33
|
+
|
|
34
|
+
export default meta;
|
|
35
|
+
type Story = StoryObj<typeof meta>;
|
|
36
|
+
|
|
37
|
+
export const Default: Story = {
|
|
38
|
+
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
export const WithSiteTitle: Story = {
|
|
42
|
+
args: {
|
|
43
|
+
siteTitle: 'Design System React'
|
|
44
|
+
}
|
|
45
|
+
};
|
|
@@ -7,7 +7,7 @@ import SiteNavigation from '../SiteNavigation/SiteNavigation';
|
|
|
7
7
|
import PhaseBanner from '../PhaseBanner/PhaseBanner';
|
|
8
8
|
|
|
9
9
|
const meta = {
|
|
10
|
-
title: 'Components/
|
|
10
|
+
title: 'Components/SiteHeader',
|
|
11
11
|
component: SiteHeader,
|
|
12
12
|
argTypes: {
|
|
13
13
|
children: argTypes.children()
|
|
@@ -0,0 +1,40 @@
|
|
|
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/SiteNavigation/SiteNavigation.Item',
|
|
8
|
+
component: SiteNavigation.Item,
|
|
9
|
+
decorators: [
|
|
10
|
+
Story => (
|
|
11
|
+
<nav className="ds_site-navigation">
|
|
12
|
+
<ul className="ds_site-navigation__list">
|
|
13
|
+
<Story />
|
|
14
|
+
</ul>
|
|
15
|
+
</nav>
|
|
16
|
+
)
|
|
17
|
+
],
|
|
18
|
+
argTypes: {
|
|
19
|
+
href: argTypes.href({type: {name: 'string', required: true}}),
|
|
20
|
+
linkComponent: argTypes.linkComponent(),
|
|
21
|
+
children: argTypes.children()
|
|
22
|
+
},
|
|
23
|
+
args: {
|
|
24
|
+
children: 'About',
|
|
25
|
+
href: '#about'
|
|
26
|
+
}
|
|
27
|
+
} satisfies Meta<typeof SiteNavigation.Item>;
|
|
28
|
+
|
|
29
|
+
export default meta;
|
|
30
|
+
type Story = StoryObj<typeof meta>;
|
|
31
|
+
|
|
32
|
+
export const Default: Story = {
|
|
33
|
+
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
export const CurrentItem: Story = {
|
|
37
|
+
args: {
|
|
38
|
+
isCurrent: true
|
|
39
|
+
}
|
|
40
|
+
};
|
|
@@ -4,10 +4,9 @@ import argTypes from '../../../.storybook/sgdsArgTypes';
|
|
|
4
4
|
import SiteNavigation from './SiteNavigation';
|
|
5
5
|
|
|
6
6
|
const meta = {
|
|
7
|
-
title: 'Components/
|
|
7
|
+
title: 'Components/SiteNavigation',
|
|
8
8
|
component: SiteNavigation,
|
|
9
9
|
argTypes: {
|
|
10
|
-
linkComponent: argTypes.linkComponent(),
|
|
11
10
|
children: argTypes.children()
|
|
12
11
|
},
|
|
13
12
|
args: {
|
|
@@ -0,0 +1,37 @@
|
|
|
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/SkipLinks/SkipLinks.Link',
|
|
8
|
+
component: SkipLinks.Link,
|
|
9
|
+
decorators: [
|
|
10
|
+
Story => (
|
|
11
|
+
<ul className="ds_skip-links">
|
|
12
|
+
<Story />
|
|
13
|
+
</ul>
|
|
14
|
+
)
|
|
15
|
+
],
|
|
16
|
+
argTypes: {
|
|
17
|
+
fragmentId: {
|
|
18
|
+
description: 'ID of the destination element',
|
|
19
|
+
type: {
|
|
20
|
+
name: 'string',
|
|
21
|
+
required: true
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
children: argTypes.children()
|
|
25
|
+
},
|
|
26
|
+
args: {
|
|
27
|
+
children: 'Skip to main content',
|
|
28
|
+
fragmentId: 'my-main-content'
|
|
29
|
+
}
|
|
30
|
+
} satisfies Meta<typeof SkipLinks.Link>;
|
|
31
|
+
|
|
32
|
+
export default meta;
|
|
33
|
+
type Story = StoryObj<typeof meta>;
|
|
34
|
+
|
|
35
|
+
export const Default: Story = {
|
|
36
|
+
|
|
37
|
+
};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
|
+
import argTypes from '../../../.storybook/sgdsArgTypes';
|
|
3
|
+
|
|
4
|
+
import SummaryCard from './SummaryCard';
|
|
5
|
+
|
|
6
|
+
const meta = {
|
|
7
|
+
title: 'Components/SummaryCard/SummaryCard.Action',
|
|
8
|
+
component: SummaryCard.Action,
|
|
9
|
+
decorators: [
|
|
10
|
+
Story => (
|
|
11
|
+
<div className="ds_summary-card__header">
|
|
12
|
+
<Story />
|
|
13
|
+
</div>
|
|
14
|
+
)
|
|
15
|
+
],
|
|
16
|
+
argTypes: {
|
|
17
|
+
href: argTypes.href(),
|
|
18
|
+
onClick: argTypes.onClick(),
|
|
19
|
+
children: argTypes.children()
|
|
20
|
+
},
|
|
21
|
+
args: {
|
|
22
|
+
children: 'Change',
|
|
23
|
+
href: '#foo'
|
|
24
|
+
}
|
|
25
|
+
} satisfies Meta<typeof SummaryCard.Action>;
|
|
26
|
+
|
|
27
|
+
export default meta;
|
|
28
|
+
type Story = StoryObj<typeof meta>;
|
|
29
|
+
|
|
30
|
+
export const Default: Story = {
|
|
31
|
+
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
export const ActionIsHtmlButton: Story = {
|
|
35
|
+
args: {
|
|
36
|
+
children: 'Change',
|
|
37
|
+
href: undefined
|
|
38
|
+
}
|
|
39
|
+
};
|
|
@@ -5,10 +5,17 @@ import SummaryCard from './SummaryCard';
|
|
|
5
5
|
import SummaryList from '../SummaryList/SummaryList';
|
|
6
6
|
|
|
7
7
|
const meta = {
|
|
8
|
-
title: 'Components/
|
|
8
|
+
title: 'Components/SummaryCard',
|
|
9
9
|
component: SummaryCard,
|
|
10
10
|
argTypes: {
|
|
11
11
|
headingLevel: argTypes.headingLevel(),
|
|
12
|
+
title: {
|
|
13
|
+
description: 'The title of the summary card',
|
|
14
|
+
type: {
|
|
15
|
+
name: 'string',
|
|
16
|
+
required: true
|
|
17
|
+
}
|
|
18
|
+
},
|
|
12
19
|
children: argTypes.children()
|
|
13
20
|
},
|
|
14
21
|
args: {
|
|
@@ -0,0 +1,32 @@
|
|
|
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/SummaryList/SummaryList.Action',
|
|
8
|
+
component: SummaryList.Action,
|
|
9
|
+
argTypes: {
|
|
10
|
+
href: argTypes.href(),
|
|
11
|
+
onClick: argTypes.onClick(),
|
|
12
|
+
children: argTypes.children()
|
|
13
|
+
},
|
|
14
|
+
args: {
|
|
15
|
+
children: 'Change',
|
|
16
|
+
href: '#foo'
|
|
17
|
+
}
|
|
18
|
+
} satisfies Meta<typeof SummaryList.Action>;
|
|
19
|
+
|
|
20
|
+
export default meta;
|
|
21
|
+
type Story = StoryObj<typeof meta>;
|
|
22
|
+
|
|
23
|
+
export const Default: Story = {
|
|
24
|
+
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
export const ActionIsHtmlButton: Story = {
|
|
28
|
+
args: {
|
|
29
|
+
children: 'Change',
|
|
30
|
+
href: undefined
|
|
31
|
+
}
|
|
32
|
+
};
|
|
@@ -0,0 +1,50 @@
|
|
|
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/SummaryList/SummaryList.Item',
|
|
8
|
+
component: SummaryList.Item,
|
|
9
|
+
decorators: [
|
|
10
|
+
Story => (
|
|
11
|
+
<ul>
|
|
12
|
+
<Story />
|
|
13
|
+
</ul>
|
|
14
|
+
)
|
|
15
|
+
],
|
|
16
|
+
argTypes: {
|
|
17
|
+
Title: {
|
|
18
|
+
description: 'Title of the summary list item.',
|
|
19
|
+
type: {
|
|
20
|
+
name: 'string',
|
|
21
|
+
required: true
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
children: argTypes.children()
|
|
25
|
+
},
|
|
26
|
+
args: {
|
|
27
|
+
title: 'Contact details',
|
|
28
|
+
children: [
|
|
29
|
+
<SummaryList.Value name="Email">
|
|
30
|
+
email@gov.scot
|
|
31
|
+
</SummaryList.Value>,
|
|
32
|
+
<SummaryList.Value name="Telephone">
|
|
33
|
+
0123 456 7890
|
|
34
|
+
</SummaryList.Value>,
|
|
35
|
+
<SummaryList.Action href="foo">
|
|
36
|
+
Change
|
|
37
|
+
</SummaryList.Action>,
|
|
38
|
+
<SummaryList.Action onclick={function w(){}}>
|
|
39
|
+
Delete
|
|
40
|
+
</SummaryList.Action>
|
|
41
|
+
]
|
|
42
|
+
}
|
|
43
|
+
} satisfies Meta<typeof SummaryList.Item>;
|
|
44
|
+
|
|
45
|
+
export default meta;
|
|
46
|
+
type Story = StoryObj<typeof meta>;
|
|
47
|
+
|
|
48
|
+
export const Default: Story = {
|
|
49
|
+
|
|
50
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
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/SummaryList/SummaryList.Value',
|
|
8
|
+
component: SummaryList.Value,
|
|
9
|
+
argTypes: {
|
|
10
|
+
name: {
|
|
11
|
+
description: 'Name of the summary value',
|
|
12
|
+
type: {
|
|
13
|
+
name: 'string',
|
|
14
|
+
required: true
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
children: argTypes.children()
|
|
18
|
+
},
|
|
19
|
+
args: {
|
|
20
|
+
children: 'Jane Smith',
|
|
21
|
+
name: 'Name'
|
|
22
|
+
}
|
|
23
|
+
} satisfies Meta<typeof SummaryList.Value>;
|
|
24
|
+
|
|
25
|
+
export default meta;
|
|
26
|
+
type Story = StoryObj<typeof meta>;
|
|
27
|
+
|
|
28
|
+
export const Default: Story = {
|
|
29
|
+
|
|
30
|
+
};
|
|
@@ -4,7 +4,7 @@ import argTypes from '../../../.storybook/sgdsArgTypes';
|
|
|
4
4
|
import SummaryList from './SummaryList';
|
|
5
5
|
|
|
6
6
|
const meta = {
|
|
7
|
-
title: 'Components/
|
|
7
|
+
title: 'Components/SummaryList',
|
|
8
8
|
component: SummaryList,
|
|
9
9
|
argTypes: {
|
|
10
10
|
isBorderless: argTypes.noBorder(),
|